-
Notifications
You must be signed in to change notification settings - Fork 31
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
d842231
commit a7bd23d
Showing
12 changed files
with
141 additions
and
5 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
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 @@ | ||
export const foo = 'foo'; |
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,7 @@ | ||
{ | ||
"extends": "@rslib/tsconfig/base", | ||
"compilerOptions": { | ||
"baseUrl": "./" | ||
}, | ||
"include": ["src"] | ||
} |
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 @@ | ||
{ | ||
"name": "sourcemap-default-test", | ||
"version": "1.0.0", | ||
"private": true, | ||
"type": "module" | ||
} |
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,11 @@ | ||
import { generateBundleEsmConfig } from '@e2e/helper'; | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
lib: [generateBundleEsmConfig()], | ||
source: { | ||
entry: { | ||
index: '../__fixtures__/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 @@ | ||
{ | ||
"name": "sourcemap-external-test", | ||
"version": "1.0.0", | ||
"private": true, | ||
"type": "module" | ||
} |
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,16 @@ | ||
import { generateBundleEsmConfig } from '@e2e/helper'; | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
lib: [generateBundleEsmConfig()], | ||
source: { | ||
entry: { | ||
index: '../__fixtures__/src/index.ts', | ||
}, | ||
}, | ||
output: { | ||
sourceMap: { | ||
js: 'cheap-module-source-map', | ||
}, | ||
}, | ||
}); |
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,62 @@ | ||
import os from 'node:os'; | ||
import { join } from 'node:path'; | ||
import { buildAndGetResults } from '@e2e/helper'; | ||
import { expect, test } from 'vitest'; | ||
|
||
test('should not generate js sourcemap by default', async () => { | ||
const fixturePath = join(__dirname, 'default'); | ||
const { contents } = await buildAndGetResults(fixturePath, 'js'); | ||
const files = Object.keys(contents.esm); | ||
|
||
expect(files).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/e2e/cases/sourcemap/default/dist/esm/index.js", | ||
] | ||
`); | ||
}); | ||
|
||
test('should generate js external sourcemap: cheap-module-source-map', async () => { | ||
const fixturePath = join(__dirname, 'external'); | ||
const { contents } = await buildAndGetResults(fixturePath, 'js'); | ||
const files = Object.keys(contents.esm); | ||
|
||
expect(files).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/e2e/cases/sourcemap/external/dist/esm/index.js", | ||
"<ROOT>/e2e/cases/sourcemap/external/dist/esm/index.js.map", | ||
] | ||
`); | ||
}); | ||
|
||
test('should generate js inline sourcemap: inline-cheap-module-source-map', async () => { | ||
const fixturePath = join(__dirname, 'inline'); | ||
const { contents } = await buildAndGetResults(fixturePath, 'js'); | ||
const files = Object.keys(contents.esm); | ||
const code = Object.values(contents.esm); | ||
|
||
expect(files).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/e2e/cases/sourcemap/inline/dist/esm/index.js", | ||
] | ||
`); | ||
|
||
if (os.platform() === 'win32') { | ||
expect(code).toMatchInlineSnapshot(` | ||
[ | ||
"const foo = 'foo'; | ||
export { foo }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9zb3VyY2VtYXAtaW5saW5lLXRlc3QvLi4vX19maXh0dXJlc19fL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgZm9vID0gJ2Zvbyc7XHJcbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9", | ||
] | ||
`); | ||
} else { | ||
expect(code).toMatchInlineSnapshot(` | ||
[ | ||
"const foo = 'foo'; | ||
export { foo }; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9zb3VyY2VtYXAtaW5saW5lLXRlc3QvLi4vX19maXh0dXJlc19fL3NyYy9pbmRleC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgY29uc3QgZm9vID0gJ2Zvbyc7XG4iXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==", | ||
] | ||
`); | ||
} | ||
}); |
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 @@ | ||
{ | ||
"name": "sourcemap-inline-test", | ||
"version": "1.0.0", | ||
"private": true, | ||
"type": "module" | ||
} |
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,16 @@ | ||
import { generateBundleEsmConfig } from '@e2e/helper'; | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
lib: [generateBundleEsmConfig()], | ||
source: { | ||
entry: { | ||
index: '../__fixtures__/src/index.ts', | ||
}, | ||
}, | ||
output: { | ||
sourceMap: { | ||
js: 'inline-cheap-module-source-map', | ||
}, | ||
}, | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.