bunchee 5.3.0 → 5.3.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/dist/bin/cli.js +1 -1
- package/dist/index.js +8 -7
- package/package.json +21 -23
package/dist/bin/cli.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -805,9 +805,9 @@ function createOutputState({ entries }) {
|
|
|
805
805
|
return {
|
|
806
806
|
name: 'collect-sizes',
|
|
807
807
|
writeBundle (options, bundle) {
|
|
808
|
-
const dir = options.dir ||
|
|
808
|
+
const dir = options.dir || path.posix.dirname(options.file);
|
|
809
809
|
Object.entries(bundle).forEach(([fileName, chunk])=>{
|
|
810
|
-
const filePath =
|
|
810
|
+
const filePath = path.posix.join(dir, fileName);
|
|
811
811
|
if (chunk.type !== 'chunk') {
|
|
812
812
|
return;
|
|
813
813
|
}
|
|
@@ -818,7 +818,7 @@ function createOutputState({ entries }) {
|
|
|
818
818
|
const sourceFileName = chunk.facadeModuleId || '';
|
|
819
819
|
const exportPath = removeScope(reversedMapping.get(sourceFileName) || '.');
|
|
820
820
|
addSize({
|
|
821
|
-
fileName: path__default.default.isAbsolute(cwd) ?
|
|
821
|
+
fileName: path__default.default.isAbsolute(cwd) ? path.posix.relative(cwd, filePath) : filePath,
|
|
822
822
|
size,
|
|
823
823
|
sourceFileName,
|
|
824
824
|
exportPath
|
|
@@ -910,7 +910,8 @@ async function writeDefaultTsconfig(tsConfigPath) {
|
|
|
910
910
|
|
|
911
911
|
const FILENAME_REGEX = /__filename/;
|
|
912
912
|
const DIRNAME_REGEX = /__dirname/;
|
|
913
|
-
|
|
913
|
+
// not char, or space before require(.resolve)?(
|
|
914
|
+
const GLOBAL_REQUIRE_REGEX = /[\W\s]require(\.resolve)?\(/;
|
|
914
915
|
const PolyfillComment = '/** rollup-private-do-not-use-esm-shim-polyfill */';
|
|
915
916
|
const createESMShim = ({ filename, dirname, globalRequire })=>{
|
|
916
917
|
const useNodeUrl = filename || dirname;
|
|
@@ -1161,9 +1162,9 @@ function aliasEntries({ entry: sourceFilePath, conditionNames, entries, format,
|
|
|
1161
1162
|
// Resolved module bundle path
|
|
1162
1163
|
let resolvedModuleBundle = sourceToRelativeBundleMap.get(resolved.id);
|
|
1163
1164
|
if (resolved.id !== sourceFilePath && srcBundle && resolvedModuleBundle) {
|
|
1164
|
-
const absoluteBundlePath =
|
|
1165
|
-
const absoluteImportBundlePath =
|
|
1166
|
-
const filePathBase =
|
|
1165
|
+
const absoluteBundlePath = path.posix.resolve(cwd, srcBundle);
|
|
1166
|
+
const absoluteImportBundlePath = path.posix.resolve(cwd, resolvedModuleBundle);
|
|
1167
|
+
const filePathBase = path.posix.relative(path.posix.dirname(absoluteBundlePath), absoluteImportBundlePath);
|
|
1167
1168
|
const relativePath = relativify(filePathBase);
|
|
1168
1169
|
return {
|
|
1169
1170
|
id: relativePath,
|
package/package.json
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bunchee",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "zero config bundler for js/ts/jsx libraries",
|
|
5
5
|
"bin": "./dist/bin/cli.js",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test": "jest --env node",
|
|
10
|
-
"test:update": "TEST_UPDATE_SNAPSHOT=1 pnpm test",
|
|
11
|
-
"test:post": "POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
|
|
12
|
-
"test:ci": "[ -z $CI ] || pnpm test",
|
|
13
|
-
"clean": "rm -rf ./dist",
|
|
14
|
-
"typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit",
|
|
15
|
-
"prepublishOnly": "pnpm clean && pnpm build && chmod +x ./dist/bin/cli.js && pnpm test:ci",
|
|
16
|
-
"tsx": "SWC_NODE_IGNORE_DYNAMIC=1 node -r @swc-node/register",
|
|
17
|
-
"ts-bunchee": "pnpm tsx ./src/bin/index.ts",
|
|
18
|
-
"build-dir": "pnpm ts-bunchee --cwd",
|
|
19
|
-
"build": "SWC_NODE_IGNORE_DYNAMIC=1 node -r @swc-node/register ./src/bin/index.ts --runtime node",
|
|
20
|
-
"format": "prettier --write .",
|
|
21
|
-
"prepare": "husky"
|
|
22
|
-
},
|
|
23
8
|
"type": "commonjs",
|
|
24
9
|
"keywords": [
|
|
25
10
|
"bundler",
|
|
@@ -51,21 +36,21 @@
|
|
|
51
36
|
},
|
|
52
37
|
"license": "MIT",
|
|
53
38
|
"dependencies": {
|
|
54
|
-
"@rollup/plugin-commonjs": "^
|
|
39
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
55
40
|
"@rollup/plugin-json": "^6.1.0",
|
|
56
41
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
57
|
-
"@rollup/plugin-replace": "^5.0.
|
|
42
|
+
"@rollup/plugin-replace": "^5.0.7",
|
|
58
43
|
"@rollup/plugin-wasm": "^6.2.2",
|
|
59
44
|
"@rollup/pluginutils": "^5.1.0",
|
|
60
45
|
"@swc/core": "^1.6.1",
|
|
61
46
|
"@swc/helpers": "^0.5.11",
|
|
62
47
|
"arg": "^5.0.2",
|
|
63
48
|
"clean-css": "^5.3.3",
|
|
64
|
-
"magic-string": "^0.30.
|
|
49
|
+
"magic-string": "^0.30.11",
|
|
65
50
|
"ora": "^8.0.1",
|
|
66
51
|
"pretty-bytes": "^5.6.0",
|
|
67
|
-
"rollup": "^4.
|
|
68
|
-
"rollup-plugin-dts": "^6.1.
|
|
52
|
+
"rollup": "^4.19.1",
|
|
53
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
69
54
|
"rollup-plugin-swc3": "^0.11.1",
|
|
70
55
|
"rollup-preserve-directives": "^1.1.1",
|
|
71
56
|
"tslib": "^2.6.2"
|
|
@@ -90,6 +75,7 @@
|
|
|
90
75
|
"@types/jest": "29.0.0",
|
|
91
76
|
"@types/node": "^20.4.1",
|
|
92
77
|
"bunchee": "link:./",
|
|
78
|
+
"cross-env": "^7.0.3",
|
|
93
79
|
"husky": "^9.0.11",
|
|
94
80
|
"jest": "29.0.1",
|
|
95
81
|
"lint-staged": "^15.2.2",
|
|
@@ -119,5 +105,17 @@
|
|
|
119
105
|
],
|
|
120
106
|
"testTimeout": 60000
|
|
121
107
|
},
|
|
122
|
-
"
|
|
123
|
-
|
|
108
|
+
"scripts": {
|
|
109
|
+
"test": "jest --env node",
|
|
110
|
+
"test:update": "TEST_UPDATE_SNAPSHOT=1 pnpm test",
|
|
111
|
+
"test:post": "cross-env POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
|
|
112
|
+
"test:ci": "[ -z $CI ] || pnpm test",
|
|
113
|
+
"clean": "rm -rf ./dist",
|
|
114
|
+
"typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit",
|
|
115
|
+
"cli": "cross-env SWC_NODE_IGNORE_DYNAMIC=1 node -r @swc-node/register",
|
|
116
|
+
"ts-bunchee": "pnpm cli ./src/bin/index.ts",
|
|
117
|
+
"build-dir": "pnpm ts-bunchee --cwd",
|
|
118
|
+
"build": "pnpm cli ./src/bin/index.ts --runtime node",
|
|
119
|
+
"format": "prettier --write ."
|
|
120
|
+
}
|
|
121
|
+
}
|