bunchee 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bin/cli.js +10 -3
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -290,7 +290,7 @@ If you're using `"use client"` or `"use server"` in a file that used as a depend
|
|
|
290
290
|
|
|
291
291
|
### Shared Modules
|
|
292
292
|
|
|
293
|
-
In some cases, you may need to share code across multiple bundles without promoting them to separate entries or exports. These modules should be bundled into shared chunks that can be reused by various bundles. By convention, files or directories prefixed with an underscore (`_<name>.<ext>` or `_<name
|
|
293
|
+
In some cases, you may need to share code across multiple bundles without promoting them to separate entries or exports. These modules should be bundled into shared chunks that can be reused by various bundles. By convention, files or directories **prefixed with an underscore** (`_<name>.<ext>` or `_<name>/**`) are treated as **shared modules**. They're private and not exposed publicly as entry points or exports. Testing, mocking related files are ignored. e.g. `_foo/a.test.ts` will not be treated as shared module.
|
|
294
294
|
|
|
295
295
|
<details>
|
|
296
296
|
<summary>Shared Utils Example</summary>
|
package/dist/bin/cli.js
CHANGED
|
@@ -75,6 +75,7 @@ const DEFAULT_TS_CONFIG = {
|
|
|
75
75
|
};
|
|
76
76
|
const BINARY_TAG = '$binary';
|
|
77
77
|
const PRIVATE_GLOB_PATTERN = '**/_*/**';
|
|
78
|
+
const TESTS_GLOB_PATTERN = '**/{__tests__/**,__mocks__/**,*.{test,spec}.*}';
|
|
78
79
|
|
|
79
80
|
function getDefaultExportFromCjs (x) {
|
|
80
81
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -641,7 +642,7 @@ function lint$1(pkg) {
|
|
|
641
642
|
}
|
|
642
643
|
}
|
|
643
644
|
|
|
644
|
-
var version = "6.1.
|
|
645
|
+
var version = "6.1.1";
|
|
645
646
|
|
|
646
647
|
async function writeDefaultTsconfig(tsConfigPath) {
|
|
647
648
|
await fs.promises.writeFile(tsConfigPath, JSON.stringify(DEFAULT_TS_CONFIG, null, 2), 'utf-8');
|
|
@@ -776,12 +777,18 @@ async function collectSourceEntries(sourceFolderPath) {
|
|
|
776
777
|
const binMatches = await glob.glob(binPattern, {
|
|
777
778
|
cwd: sourceFolderPath,
|
|
778
779
|
nodir: true,
|
|
779
|
-
ignore:
|
|
780
|
+
ignore: [
|
|
781
|
+
PRIVATE_GLOB_PATTERN,
|
|
782
|
+
TESTS_GLOB_PATTERN
|
|
783
|
+
]
|
|
780
784
|
});
|
|
781
785
|
const srcMatches = await glob.glob(srcPattern, {
|
|
782
786
|
cwd: sourceFolderPath,
|
|
783
787
|
nodir: true,
|
|
784
|
-
ignore:
|
|
788
|
+
ignore: [
|
|
789
|
+
PRIVATE_GLOB_PATTERN,
|
|
790
|
+
TESTS_GLOB_PATTERN
|
|
791
|
+
]
|
|
785
792
|
});
|
|
786
793
|
for (const file of binMatches){
|
|
787
794
|
// convert relative path to export path
|
package/dist/index.js
CHANGED
|
@@ -242,6 +242,7 @@ const DEFAULT_TS_CONFIG = {
|
|
|
242
242
|
};
|
|
243
243
|
const BINARY_TAG = '$binary';
|
|
244
244
|
const PRIVATE_GLOB_PATTERN = '**/_*/**';
|
|
245
|
+
const TESTS_GLOB_PATTERN = '**/{__tests__/**,__mocks__/**,*.{test,spec}.*}';
|
|
245
246
|
|
|
246
247
|
function posixRelativify(path) {
|
|
247
248
|
return path.startsWith('.') ? path : `./${path}`;
|
|
@@ -868,7 +869,8 @@ async function collectSourceEntriesByExportPath(sourceFolderPath, originalSubpat
|
|
|
868
869
|
const privatePattern = `**/_*{,/*}{,{.${suffixPattern}}}.{${extPattern}}`;
|
|
869
870
|
const privateFiles = await glob.glob(privatePattern, {
|
|
870
871
|
cwd: sourceFolderPath,
|
|
871
|
-
nodir: true
|
|
872
|
+
nodir: true,
|
|
873
|
+
ignore: TESTS_GLOB_PATTERN
|
|
872
874
|
});
|
|
873
875
|
for (const file of privateFiles){
|
|
874
876
|
const sourceFileAbsolutePath = path__default.default.join(sourceFolderPath, file);
|