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 CHANGED
@@ -470,7 +470,7 @@ function lint$1(pkg) {
470
470
  }
471
471
  }
472
472
 
473
- var version = "5.3.0";
473
+ var version = "5.3.1";
474
474
 
475
475
  function relativify(path) {
476
476
  return path.startsWith('.') ? path : `./${path}`;
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 || path__default.default.dirname(options.file);
808
+ const dir = options.dir || path.posix.dirname(options.file);
809
809
  Object.entries(bundle).forEach(([fileName, chunk])=>{
810
- const filePath = path__default.default.join(dir, fileName);
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) ? path__default.default.relative(cwd, filePath) : filePath,
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
- const GLOBAL_REQUIRE_REGEX = /require(\.resolve)?\(/;
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 = path__default.default.resolve(cwd, srcBundle);
1165
- const absoluteImportBundlePath = path__default.default.resolve(cwd, resolvedModuleBundle);
1166
- const filePathBase = path__default.default.relative(path__default.default.dirname(absoluteBundlePath), absoluteImportBundlePath);
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.0",
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": "^25.0.7",
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.5",
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.10",
49
+ "magic-string": "^0.30.11",
65
50
  "ora": "^8.0.1",
66
51
  "pretty-bytes": "^5.6.0",
67
- "rollup": "^4.17.2",
68
- "rollup-plugin-dts": "^6.1.0",
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
- "packageManager": "pnpm@9.4.0"
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
+ }