-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55c6095
commit a05963a
Showing
55 changed files
with
651 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
crates/swc/tests/fixture/issues-3xxx/3067/amd/input/.swcrc
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,21 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"dynamicImport": true, | ||
}, | ||
"target": "es2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@print/c": ["./packages/c/src/index.js"], | ||
}, | ||
"externalHelpers": true, | ||
}, | ||
"module": { | ||
"type": "amd", | ||
"resolveFully": true, | ||
// This should say "resolve this fully to .mjs". | ||
// Normally should be paired with --out-file-extension in the cli | ||
"outFileExtension": "mjs", | ||
}, | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/swc/tests/fixture/issues-3xxx/3067/amd/input/packages/c/src/index.ts
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,6 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
import something from 'lodash/dist/something.js' | ||
export function displayC(): string { | ||
something() | ||
return 'Display C' | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/swc/tests/fixture/issues-3xxx/3067/amd/input/src/index.ts
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,14 @@ | ||
|
||
import { displayB } from './inner/b' | ||
import { displayC } from '@print/c' | ||
import { merge } from 'lodash' | ||
|
||
async function display() { | ||
const displayA = await import('./inner/a').then(c => c.displayA) | ||
console.log(displayA()) | ||
console.log(displayB()) | ||
console.log(displayC()) | ||
const foo = merge({}, { a: 22 }) | ||
} | ||
|
||
display() |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/amd/input/src/inner/a/index.ts
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,3 @@ | ||
export function displayA() { | ||
return 'Display A' | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/amd/input/src/inner/b/index.ts
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,3 @@ | ||
export function displayB() { | ||
return 'Display B' | ||
} |
23 changes: 23 additions & 0 deletions
23
crates/swc/tests/fixture/issues-3xxx/3067/amd/output/packages/c/src/index.ts
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 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
define([ | ||
"require", | ||
"exports", | ||
"@swc/helpers/_/_interop_require_default", | ||
"lodash/dist/something.js" | ||
], function(require, exports, _interop_require_default, _something) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayC", { | ||
enumerable: true, | ||
get: function() { | ||
return displayC; | ||
} | ||
}); | ||
_something = /*#__PURE__*/ _interop_require_default._(_something); | ||
function displayC() { | ||
(0, _something.default)(); | ||
return 'Display C'; | ||
} | ||
}); |
25 changes: 25 additions & 0 deletions
25
crates/swc/tests/fixture/issues-3xxx/3067/amd/output/src/index.ts
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,25 @@ | ||
define([ | ||
"require", | ||
"exports", | ||
"@swc/helpers/_/_interop_require_wildcard", | ||
"./inner/b/index.mjs", | ||
"../packages/c/src/index.mjs", | ||
"lodash" | ||
], function(require, exports, _interop_require_wildcard, _b, _c, _lodash) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
async function display() { | ||
const displayA = await new Promise((resolve, reject)=>require([ | ||
"./inner/a/index.mjs" | ||
], (m)=>resolve(/*#__PURE__*/ _interop_require_wildcard._(m)), reject)).then((c)=>c.displayA); | ||
console.log(displayA()); | ||
console.log((0, _b.displayB)()); | ||
console.log((0, _c.displayC)()); | ||
const foo = (0, _lodash.merge)({}, { | ||
a: 22 | ||
}); | ||
} | ||
display(); | ||
}); |
18 changes: 18 additions & 0 deletions
18
crates/swc/tests/fixture/issues-3xxx/3067/amd/output/src/inner/a/index.ts
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 @@ | ||
define([ | ||
"require", | ||
"exports" | ||
], function(require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayA", { | ||
enumerable: true, | ||
get: function() { | ||
return displayA; | ||
} | ||
}); | ||
function displayA() { | ||
return 'Display A'; | ||
} | ||
}); |
18 changes: 18 additions & 0 deletions
18
crates/swc/tests/fixture/issues-3xxx/3067/amd/output/src/inner/b/index.ts
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 @@ | ||
define([ | ||
"require", | ||
"exports" | ||
], function(require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayB", { | ||
enumerable: true, | ||
get: function() { | ||
return displayB; | ||
} | ||
}); | ||
function displayB() { | ||
return 'Display B'; | ||
} | ||
}); |
21 changes: 21 additions & 0 deletions
21
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/input/.swcrc
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,21 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"dynamicImport": true, | ||
}, | ||
"target": "es2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@print/c": ["./packages/c/src/index.js"], | ||
}, | ||
"externalHelpers": true, | ||
}, | ||
"module": { | ||
"type": "commonjs", | ||
"resolveFully": true, | ||
// This should say "resolve this fully to .mjs". | ||
// Normally should be paired with --out-file-extension in the cli | ||
"outFileExtension": "mjs", | ||
}, | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/input/packages/c/src/index.ts
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,6 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
import something from 'lodash/dist/something.js' | ||
export function displayC(): string { | ||
something() | ||
return 'Display C' | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/input/src/index.ts
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,14 @@ | ||
|
||
import { displayB } from './inner/b' | ||
import { displayC } from '@print/c' | ||
import { merge } from 'lodash' | ||
|
||
async function display() { | ||
const displayA = await import('./inner/a').then(c => c.displayA) | ||
console.log(displayA()) | ||
console.log(displayB()) | ||
console.log(displayC()) | ||
const foo = merge({}, { a: 22 }) | ||
} | ||
|
||
display() |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/input/src/inner/a/index.ts
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,3 @@ | ||
export function displayA() { | ||
return 'Display A' | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/input/src/inner/b/index.ts
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,3 @@ | ||
export function displayB() { | ||
return 'Display B' | ||
} |
17 changes: 17 additions & 0 deletions
17
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/packages/c/src/index.ts
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 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayC", { | ||
enumerable: true, | ||
get: function() { | ||
return displayC; | ||
} | ||
}); | ||
const _interop_require_default = require("@swc/helpers/_/_interop_require_default"); | ||
const _something = /*#__PURE__*/ _interop_require_default._(require("lodash/dist/something.js")); | ||
function displayC() { | ||
(0, _something.default)(); | ||
return 'Display C'; | ||
} |
18 changes: 18 additions & 0 deletions
18
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/src/index.ts
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 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); | ||
const _b = require("./inner/b/index.mjs"); | ||
const _c = require("../packages/c/src/index.mjs"); | ||
const _lodash = require("lodash"); | ||
async function display() { | ||
const displayA = await Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard._(require("./inner/a/index.mjs"))).then((c)=>c.displayA); | ||
console.log(displayA()); | ||
console.log((0, _b.displayB)()); | ||
console.log((0, _c.displayC)()); | ||
const foo = (0, _lodash.merge)({}, { | ||
a: 22 | ||
}); | ||
} | ||
display(); |
13 changes: 13 additions & 0 deletions
13
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/src/inner/a/index.ts
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,13 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayA", { | ||
enumerable: true, | ||
get: function() { | ||
return displayA; | ||
} | ||
}); | ||
function displayA() { | ||
return 'Display A'; | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/swc/tests/fixture/issues-3xxx/3067/commonjs/output/src/inner/b/index.ts
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,13 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "displayB", { | ||
enumerable: true, | ||
get: function() { | ||
return displayB; | ||
} | ||
}); | ||
function displayB() { | ||
return 'Display B'; | ||
} |
21 changes: 21 additions & 0 deletions
21
crates/swc/tests/fixture/issues-3xxx/3067/es6/input/.swcrc
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,21 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"dynamicImport": true, | ||
}, | ||
"target": "es2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@print/c": ["./packages/c/src/index.js"], | ||
}, | ||
"externalHelpers": true, | ||
}, | ||
"module": { | ||
"type": "es6", | ||
"resolveFully": true, | ||
// This should say "resolve this fully to .mjs". | ||
// Normally should be paired with --out-file-extension in the cli | ||
"outFileExtension": "mjs", | ||
}, | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/swc/tests/fixture/issues-3xxx/3067/es6/input/packages/c/src/index.ts
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,6 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
import something from 'lodash/dist/something.js' | ||
export function displayC(): string { | ||
something() | ||
return 'Display C' | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/swc/tests/fixture/issues-3xxx/3067/es6/input/src/index.ts
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,14 @@ | ||
|
||
import { displayB } from './inner/b' | ||
import { displayC } from '@print/c' | ||
import { merge } from 'lodash' | ||
|
||
async function display() { | ||
const displayA = await import('./inner/a').then(c => c.displayA) | ||
console.log(displayA()) | ||
console.log(displayB()) | ||
console.log(displayC()) | ||
const foo = merge({}, { a: 22 }) | ||
} | ||
|
||
display() |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/es6/input/src/inner/a/index.ts
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,3 @@ | ||
export function displayA() { | ||
return 'Display A' | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/es6/input/src/inner/b/index.ts
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,3 @@ | ||
export function displayB() { | ||
return 'Display B' | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/swc/tests/fixture/issues-3xxx/3067/es6/output/packages/c/src/index.ts
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,6 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
import something from "lodash/dist/something.js"; | ||
export function displayC() { | ||
something(); | ||
return 'Display C'; | ||
} |
13 changes: 13 additions & 0 deletions
13
crates/swc/tests/fixture/issues-3xxx/3067/es6/output/src/index.ts
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,13 @@ | ||
import { displayB } from "./inner/b/index.mjs"; | ||
import { displayC } from "../packages/c/src/index.mjs"; | ||
import { merge } from "lodash"; | ||
async function display() { | ||
const displayA = await import("./inner/a/index.mjs").then((c)=>c.displayA); | ||
console.log(displayA()); | ||
console.log(displayB()); | ||
console.log(displayC()); | ||
const foo = merge({}, { | ||
a: 22 | ||
}); | ||
} | ||
display(); |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/es6/output/src/inner/a/index.ts
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,3 @@ | ||
export function displayA() { | ||
return 'Display A'; | ||
} |
3 changes: 3 additions & 0 deletions
3
crates/swc/tests/fixture/issues-3xxx/3067/es6/output/src/inner/b/index.ts
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,3 @@ | ||
export function displayB() { | ||
return 'Display B'; | ||
} |
21 changes: 21 additions & 0 deletions
21
crates/swc/tests/fixture/issues-3xxx/3067/nodenext/input/.swcrc
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,21 @@ | ||
{ | ||
"jsc": { | ||
"parser": { | ||
"syntax": "typescript", | ||
"dynamicImport": true, | ||
}, | ||
"target": "es2020", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@print/c": ["./packages/c/src/index.js"], | ||
}, | ||
"externalHelpers": true, | ||
}, | ||
"module": { | ||
"type": "nodenext", | ||
"resolveFully": true, | ||
// This should say "resolve this fully to .mjs". | ||
// Normally should be paired with --out-file-extension in the cli | ||
"outFileExtension": "mjs", | ||
}, | ||
} |
6 changes: 6 additions & 0 deletions
6
crates/swc/tests/fixture/issues-3xxx/3067/nodenext/input/packages/c/src/index.ts
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,6 @@ | ||
// Simulate accessing a .js file in a third party package that shouldn't be edited | ||
import something from 'lodash/dist/something.js' | ||
export function displayC(): string { | ||
something() | ||
return 'Display C' | ||
} |
14 changes: 14 additions & 0 deletions
14
crates/swc/tests/fixture/issues-3xxx/3067/nodenext/input/src/index.ts
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,14 @@ | ||
|
||
import { displayB } from './inner/b' | ||
import { displayC } from '@print/c' | ||
import { merge } from 'lodash' | ||
|
||
async function display() { | ||
const displayA = await import('./inner/a').then(c => c.displayA) | ||
console.log(displayA()) | ||
console.log(displayB()) | ||
console.log(displayC()) | ||
const foo = merge({}, { a: 22 }) | ||
} | ||
|
||
display() |
Oops, something went wrong.