-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add identifier for export default function without identifer (#81)
- Loading branch information
Showing
38 changed files
with
282 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
126 changes: 126 additions & 0 deletions
126
crates/rolldown/tests/esbuild/default/export_froms_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/export_froms_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// h.js | ||
async function foo$1() {} | ||
var h_ns = { | ||
get default() { return foo$1 } | ||
}; | ||
var init_h = __esm({ | ||
'h.js'() { | ||
foo$1.prop = 123 | ||
} | ||
}); | ||
// g.js | ||
async function g_default() {} | ||
var g_ns = { | ||
get default() { return g_default } | ||
}; | ||
var init_g = __esm({ | ||
'g.js'() { | ||
|
||
} | ||
}); | ||
// f.js | ||
function foo() {} | ||
var f_ns = { | ||
get default() { return foo } | ||
}; | ||
var init_f = __esm({ | ||
'f.js'() { | ||
foo.prop = 123 | ||
} | ||
}); | ||
// e.js | ||
function e_default() {} | ||
var e_ns = { | ||
get default() { return e_default } | ||
}; | ||
var init_e = __esm({ | ||
'e.js'() { | ||
|
||
} | ||
}); | ||
// d.js | ||
var Foo; | ||
var d_ns = { | ||
get default() { return Foo } | ||
}; | ||
var init_d = __esm({ | ||
'd.js'() { | ||
Foo = class Foo {} | ||
Foo.prop = 123 | ||
} | ||
}); | ||
// c.js | ||
var c_default; | ||
var c_ns = { | ||
get default() { return c_default } | ||
}; | ||
var init_c = __esm({ | ||
'c.js'() { | ||
c_default = class {} | ||
|
||
} | ||
}); | ||
// b.js | ||
var xyz; | ||
var b_ns = { | ||
get xyz() { return xyz } | ||
}; | ||
var init_b = __esm({ | ||
'b.js'() { | ||
xyz = null | ||
} | ||
}); | ||
// a.js | ||
var abc; | ||
var a_ns = { | ||
get abc() { return abc } | ||
}; | ||
var init_a = __esm({ | ||
'a.js'() { | ||
abc = undefined | ||
} | ||
}); | ||
// commonjs.js | ||
function Fn() {} | ||
var commonjs_default,v,l,c,Class; | ||
var commonjs_ns = { | ||
get Fn() { return Fn }, | ||
get Class() { return Class }, | ||
get abc() { return abc }, | ||
get v() { return v }, | ||
get default() { return commonjs_default }, | ||
get c() { return c }, | ||
get b() { return b_ns }, | ||
get l() { return l } | ||
}; | ||
var init_commonjs = __esm({ | ||
'commonjs.js'() { | ||
commonjs_default = 123 | ||
v = 234 | ||
l = 234 | ||
c = 234 | ||
|
||
|
||
Class = class Class {} | ||
|
||
|
||
|
||
} | ||
}); | ||
// main.js | ||
(init_commonjs(), __toCommonJS(commonjs_ns)) | ||
(init_c(), __toCommonJS(c_ns)) | ||
(init_d(), __toCommonJS(d_ns)) | ||
(init_e(), __toCommonJS(e_ns)) | ||
(init_f(), __toCommonJS(f_ns)) | ||
(init_g(), __toCommonJS(g_ns)) | ||
(init_h(), __toCommonJS(h_ns)) | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
crates/rolldown/tests/esbuild/default/nested_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/nested_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// foo.js | ||
var require_foo = __commonJS({ | ||
'foo.js'(exports, module) { | ||
module.exports = function() { | ||
return 123 | ||
} | ||
} | ||
}); | ||
// main.js | ||
function nestedScope() { | ||
const fn = require_foo() | ||
console.log(fn()) | ||
} | ||
nestedScope() | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
crates/rolldown/tests/esbuild/default/new_expression_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/new_expression_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// foo.js | ||
var require_foo = __commonJS({ | ||
'foo.js'(exports, module) { | ||
class Foo {} | ||
module.exports = {Foo}; | ||
} | ||
}); | ||
// main.js | ||
new (require_foo()).Foo(); | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
crates/rolldown/tests/esbuild/default/require_child_dir_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/require_child_dir_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// dir/index.js | ||
var require_dir_index = __commonJS({ | ||
'dir/index.js'(exports, module) { | ||
module.exports = 123 | ||
} | ||
}); | ||
// main.js | ||
console.log(require_dir_index()) | ||
``` |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/esbuild/default/require_child_dir_common_js/test.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
15 changes: 15 additions & 0 deletions
15
crates/rolldown/tests/esbuild/default/require_child_dir_es6/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/require_child_dir_es6 | ||
--- | ||
# main.js | ||
|
||
```js | ||
// dir/index.js | ||
var dir_index_default = 123 | ||
|
||
// main.js | ||
|
||
console.log(dir_index_default) | ||
``` |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/esbuild/default/require_child_dir_es6/test.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
17 changes: 17 additions & 0 deletions
17
crates/rolldown/tests/esbuild/default/require_parent_dir_common_js/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/require_parent_dir_common_js | ||
--- | ||
# main.js | ||
|
||
```js | ||
// index.js | ||
var require_require_parent_dir_common_js_index = __commonJS({ | ||
'index.js'(exports, module) { | ||
module.exports = 123 | ||
} | ||
}); | ||
// dir/entry.js | ||
console.log(require_require_parent_dir_common_js_index()) | ||
``` |
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
crates/rolldown/tests/esbuild/default/require_parent_dir_common_js/test.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"input": { | ||
"input": [ | ||
{ | ||
"name": "main", | ||
"import": "dir/entry.js" | ||
} | ||
] | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
crates/rolldown/tests/esbuild/default/require_parent_dir_es6/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/esbuild/default/require_parent_dir_es6 | ||
--- | ||
# main.js | ||
|
||
```js | ||
// index.js | ||
var require_parent_dir_es6_index_default = 123 | ||
|
||
// dir/entry.js | ||
|
||
console.log(require_parent_dir_es6_index_default) | ||
``` |
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
crates/rolldown/tests/esbuild/default/require_parent_dir_es6/test.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"input": { | ||
"input": [ | ||
{ | ||
"name": "main", | ||
"import": "dir/entry.js" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters