-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Timeless0911 <[email protected]>
- Loading branch information
1 parent
676cad1
commit 53a8598
Showing
21 changed files
with
335 additions
and
24 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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": "outbase-custom-entry-dir-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,52 @@ | ||
import path from 'node:path'; | ||
import { defineConfig } from '@rslib/core'; | ||
import { generateBundleEsmConfig } from 'test-helper'; | ||
|
||
export default defineConfig({ | ||
lib: [ | ||
// default | ||
generateBundleEsmConfig({ | ||
bundle: false, | ||
source: { | ||
entry: { | ||
index: './src/utils/foo', | ||
}, | ||
}, | ||
output: { | ||
distPath: { | ||
root: './dist/esm0', | ||
}, | ||
}, | ||
}), | ||
// configured with relative outBase | ||
generateBundleEsmConfig({ | ||
bundle: false, | ||
outBase: './src/utils', | ||
source: { | ||
entry: { | ||
index: './src/utils/foo', | ||
}, | ||
}, | ||
output: { | ||
distPath: { | ||
root: './dist/esm1', | ||
}, | ||
}, | ||
}), | ||
// configured with absolute outBase | ||
generateBundleEsmConfig({ | ||
bundle: false, | ||
outBase: path.resolve(__dirname, 'src/utils'), | ||
source: { | ||
entry: { | ||
index: './src/utils/foo', | ||
}, | ||
}, | ||
output: { | ||
distPath: { | ||
root: './dist/esm2', | ||
}, | ||
}, | ||
}), | ||
], | ||
}); |
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 bar = '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 @@ | ||
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,2 @@ | ||
export { foo } from './foo'; | ||
export { bar } from './bar'; |
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,61 @@ | ||
import { join } from 'node:path'; | ||
import { buildAndGetResults } from 'test-helper'; | ||
import { describe, expect, test } from 'vitest'; | ||
|
||
describe('outBase', async () => { | ||
test('base', async () => { | ||
const fixturePath = join(__dirname, 'nested-dir'); | ||
const { files } = await buildAndGetResults({ | ||
fixturePath, | ||
}); | ||
|
||
expect(files.esm0!.sort()).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm0/bar/index.js", | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm0/foo/index.js", | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm0/index.js", | ||
] | ||
`); | ||
|
||
expect(files.esm1!.sort()).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm1/utils/bar/index.js", | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm1/utils/foo/index.js", | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm1/utils/index.js", | ||
] | ||
`); | ||
|
||
expect(files.esm2!.sort()).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm2/utils/bar/index.js", | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm2/utils/foo/index.js", | ||
"<ROOT>/tests/integration/outBase/nested-dir/dist/esm2/utils/index.js", | ||
] | ||
`); | ||
}); | ||
|
||
test('with custom entry', async () => { | ||
const fixturePath = join(__dirname, 'custom-entry'); | ||
const { files } = await buildAndGetResults({ | ||
fixturePath, | ||
}); | ||
|
||
expect(files.esm0!.sort()).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/tests/integration/outBase/custom-entry/dist/esm0/index.js", | ||
] | ||
`); | ||
|
||
expect(files.esm1!.sort()).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/tests/integration/outBase/custom-entry/dist/esm1/foo/index.js", | ||
] | ||
`); | ||
|
||
expect(files.esm2!.sort()).toMatchInlineSnapshot(` | ||
[ | ||
"<ROOT>/tests/integration/outBase/custom-entry/dist/esm2/foo/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "outbase-nested-dir-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,37 @@ | ||
import path from 'node:path'; | ||
import { defineConfig } from '@rslib/core'; | ||
import { generateBundleEsmConfig } from 'test-helper'; | ||
|
||
export default defineConfig({ | ||
lib: [ | ||
// default | ||
generateBundleEsmConfig({ | ||
bundle: false, | ||
output: { | ||
distPath: { | ||
root: './dist/esm0', | ||
}, | ||
}, | ||
}), | ||
// configured with relative outBase | ||
generateBundleEsmConfig({ | ||
bundle: false, | ||
outBase: './src', | ||
output: { | ||
distPath: { | ||
root: './dist/esm1', | ||
}, | ||
}, | ||
}), | ||
// configured with absolute outBase | ||
generateBundleEsmConfig({ | ||
bundle: false, | ||
outBase: path.resolve(__dirname, 'src'), | ||
output: { | ||
distPath: { | ||
root: './dist/esm2', | ||
}, | ||
}, | ||
}), | ||
], | ||
}); |
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 bar = '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 @@ | ||
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,2 @@ | ||
export { foo } from './foo'; | ||
export { bar } from './bar'; |
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 |
---|---|---|
|
@@ -11,5 +11,6 @@ | |
"dts", | ||
"shims", | ||
"id", | ||
"umd-name" | ||
"umd-name", | ||
"out-base" | ||
] |
Oops, something went wrong.