aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/js_parser.zig1
-rw-r--r--test/bun.js/transpiler.test.js62
2 files changed, 62 insertions, 1 deletions
diff --git a/src/js_parser.zig b/src/js_parser.zig
index 4866954e4..a69db9db4 100644
--- a/src/js_parser.zig
+++ b/src/js_parser.zig
@@ -17079,7 +17079,6 @@ fn NewParser_(
S.Local{
.kind = .k_let,
.decls = decls,
- .is_export = is_export,
},
stmt_loc,
),
diff --git a/test/bun.js/transpiler.test.js b/test/bun.js/transpiler.test.js
index 51e1e669d..3bb458697 100644
--- a/test/bun.js/transpiler.test.js
+++ b/test/bun.js/transpiler.test.js
@@ -96,6 +96,68 @@ describe("Bun.Transpiler", () => {
});
});
+ describe("generated closures", () => {
+ const input1 = `namespace test {
+ export enum x { y }
+}`;
+ const output1 = `var test;
+(function(test) {
+ let x;
+ (function(x) {
+ x[x["y"] = 0] = "y";
+ })(x = test.x || (test.x = {}));
+})(test || (test = {}))`;
+
+ it("namespace with exported enum", () => {
+ ts.expectPrinted_(input1, output1);
+ });
+
+ const input2 = `export namespace test {
+ export enum x { y }
+}`;
+ const output2 = `export var test;
+(function(test) {
+ let x;
+ (function(x) {
+ x[x["y"] = 0] = "y";
+ })(x = test.x || (test.x = {}));
+})(test || (test = {}))`;
+
+ it("exported namespace with exported enum", () => {
+ ts.expectPrinted_(input2, output2);
+ });
+
+ const input3 = `namespace first {
+ export namespace second {
+ enum x { y }
+ }
+}`;
+ const output3 = `var first;
+(function(first) {
+ let second;
+ (function(second) {
+ let x;
+ (function(x) {
+ x[x["y"] = 0] = "y";
+ })(x || (x = {}));
+ })(second = first.second || (first.second = {}));
+})(first || (first = {}))`
+
+ it("exported inner namespace", () => {
+ ts.expectPrinted_(input3, output3);
+ });
+
+ const input4 = `export enum x { y }`
+ const output4 = `export var x;
+(function(x) {
+ x[x["y"] = 0] = "y";
+})(x || (x = {}))`
+
+ it("exported enum", () => {
+ ts.expectPrinted_(input4, output4);
+ });
+ })
+
describe("exports.replace", () => {
const transpiler = new Bun.Transpiler({
exports: {