aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-15 01:01:18 +0000
committerGitHub <noreply@github.com>2021-02-15 09:01:18 +0800
commit203ca2586a759ac2fce057e80ae9195d28ef247e (patch)
treee79bd4439583213094b46fc144e0919f07678100 /test
parentc21f096ab882dc37771375c4eadafe61a3e6ac51 (diff)
downloadtracifyjs-203ca2586a759ac2fce057e80ae9195d28ef247e.tar.gz
tracifyjs-203ca2586a759ac2fce057e80ae9195d28ef247e.zip
introduce `hoist_exports` (#4651)
Diffstat (limited to 'test')
-rw-r--r--test/compress/exports.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/compress/exports.js b/test/compress/exports.js
index afa546ec..75ce5a43 100644
--- a/test/compress/exports.js
+++ b/test/compress/exports.js
@@ -142,3 +142,38 @@ mangle_rename: {
}
}
}
+
+hoist_exports: {
+ options = {
+ evaluate: true,
+ hoist_exports: true,
+ reduce_vars: true,
+ toplevel: true,
+ unused: true,
+ }
+ mangle = {
+ toplevel: true,
+ }
+ input: {
+ const a = 42;
+ export let bbb, { foo: ccc } = a;
+ export function fff(d, { [bbb]: e }) {
+ d(e, fff);
+ }
+ export default a;
+ export default async function g(x, ...{ [ccc]: y }) {
+ (await x)(g, y);
+ }
+ }
+ expect: {
+ let f, { foo: o } = 42;
+ function c(t, { [f]: a }) {
+ t(a, c);
+ }
+ export default 42;
+ export default async function t(a, ...{ [o]: f }) {
+ (await a)(t, f);
+ };
+ export { f as bbb, o as ccc, c as fff };
+ }
+}