bunchee 5.3.0-beta.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-beta.0";
473
+ var version = "5.3.1";
474
474
 
475
475
  function relativify(path) {
476
476
  return path.startsWith('.') ? path : `./${path}`;
@@ -580,7 +580,6 @@ async function collectSourceEntriesByExportPath(sourceFolderPath, originalSubpat
580
580
  const exportType = getExportTypeFromExportPath(exportPath);
581
581
  sourceFilesMap[exportType] = indexAbsoluteFile;
582
582
  exportsEntries.set(exportPath, sourceFilesMap);
583
- break;
584
583
  }
585
584
  }
586
585
  }
@@ -1054,6 +1053,7 @@ async function run(args) {
1054
1053
  if (watch) {
1055
1054
  logWatcherBuildTime(assetJobs, spinner);
1056
1055
  } else {
1056
+ stopSpinner();
1057
1057
  if (assetJobs.length === 0) {
1058
1058
  logger.warn('The "src" directory does not contain any entry files. ' + 'For proper usage, please refer to the following link: ' + 'https://github.com/huozhi/bunchee#usage');
1059
1059
  }
package/dist/index.js CHANGED
@@ -696,7 +696,6 @@ async function collectSourceEntriesByExportPath(sourceFolderPath, originalSubpat
696
696
  const exportType = getExportTypeFromExportPath(exportPath);
697
697
  sourceFilesMap[exportType] = indexAbsoluteFile;
698
698
  exportsEntries.set(exportPath, sourceFilesMap);
699
- break;
700
699
  }
701
700
  }
702
701
  }
@@ -806,9 +805,9 @@ function createOutputState({ entries }) {
806
805
  return {
807
806
  name: 'collect-sizes',
808
807
  writeBundle (options, bundle) {
809
- const dir = options.dir || path__default.default.dirname(options.file);
808
+ const dir = options.dir || path.posix.dirname(options.file);
810
809
  Object.entries(bundle).forEach(([fileName, chunk])=>{
811
- const filePath = path__default.default.join(dir, fileName);
810
+ const filePath = path.posix.join(dir, fileName);
812
811
  if (chunk.type !== 'chunk') {
813
812
  return;
814
813
  }
@@ -819,7 +818,7 @@ function createOutputState({ entries }) {
819
818
  const sourceFileName = chunk.facadeModuleId || '';
820
819
  const exportPath = removeScope(reversedMapping.get(sourceFileName) || '.');
821
820
  addSize({
822
- 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,
823
822
  size,
824
823
  sourceFileName,
825
824
  exportPath
@@ -911,7 +910,8 @@ async function writeDefaultTsconfig(tsConfigPath) {
911
910
 
912
911
  const FILENAME_REGEX = /__filename/;
913
912
  const DIRNAME_REGEX = /__dirname/;
914
- const GLOBAL_REQUIRE_REGEX = /require(\.resolve)?\(/;
913
+ // not char, or space before require(.resolve)?(
914
+ const GLOBAL_REQUIRE_REGEX = /[\W\s]require(\.resolve)?\(/;
915
915
  const PolyfillComment = '/** rollup-private-do-not-use-esm-shim-polyfill */';
916
916
  const createESMShim = ({ filename, dirname, globalRequire })=>{
917
917
  const useNodeUrl = filename || dirname;
@@ -1162,9 +1162,9 @@ function aliasEntries({ entry: sourceFilePath, conditionNames, entries, format,
1162
1162
  // Resolved module bundle path
1163
1163
  let resolvedModuleBundle = sourceToRelativeBundleMap.get(resolved.id);
1164
1164
  if (resolved.id !== sourceFilePath && srcBundle && resolvedModuleBundle) {
1165
- const absoluteBundlePath = path__default.default.resolve(cwd, srcBundle);
1166
- const absoluteImportBundlePath = path__default.default.resolve(cwd, resolvedModuleBundle);
1167
- 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);
1168
1168
  const relativePath = relativify(filePathBase);
1169
1169
  return {
1170
1170
  id: relativePath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "5.3.0-beta.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",
@@ -36,21 +36,21 @@
36
36
  },
37
37
  "license": "MIT",
38
38
  "dependencies": {
39
- "@rollup/plugin-commonjs": "^25.0.7",
39
+ "@rollup/plugin-commonjs": "^26.0.1",
40
40
  "@rollup/plugin-json": "^6.1.0",
41
41
  "@rollup/plugin-node-resolve": "^15.2.3",
42
- "@rollup/plugin-replace": "^5.0.5",
42
+ "@rollup/plugin-replace": "^5.0.7",
43
43
  "@rollup/plugin-wasm": "^6.2.2",
44
44
  "@rollup/pluginutils": "^5.1.0",
45
45
  "@swc/core": "^1.6.1",
46
46
  "@swc/helpers": "^0.5.11",
47
47
  "arg": "^5.0.2",
48
48
  "clean-css": "^5.3.3",
49
- "magic-string": "^0.30.10",
49
+ "magic-string": "^0.30.11",
50
50
  "ora": "^8.0.1",
51
51
  "pretty-bytes": "^5.6.0",
52
- "rollup": "^4.17.2",
53
- "rollup-plugin-dts": "^6.1.0",
52
+ "rollup": "^4.19.1",
53
+ "rollup-plugin-dts": "^6.1.1",
54
54
  "rollup-plugin-swc3": "^0.11.1",
55
55
  "rollup-preserve-directives": "^1.1.1",
56
56
  "tslib": "^2.6.2"
@@ -75,6 +75,7 @@
75
75
  "@types/jest": "29.0.0",
76
76
  "@types/node": "^20.4.1",
77
77
  "bunchee": "link:./",
78
+ "cross-env": "^7.0.3",
78
79
  "husky": "^9.0.11",
79
80
  "jest": "29.0.1",
80
81
  "lint-staged": "^15.2.2",
@@ -107,14 +108,14 @@
107
108
  "scripts": {
108
109
  "test": "jest --env node",
109
110
  "test:update": "TEST_UPDATE_SNAPSHOT=1 pnpm test",
110
- "test:post": "POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
111
+ "test:post": "cross-env POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
111
112
  "test:ci": "[ -z $CI ] || pnpm test",
112
113
  "clean": "rm -rf ./dist",
113
114
  "typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit",
114
- "tsx": "SWC_NODE_IGNORE_DYNAMIC=1 node -r @swc-node/register",
115
- "ts-bunchee": "pnpm tsx ./src/bin/index.ts",
115
+ "cli": "cross-env SWC_NODE_IGNORE_DYNAMIC=1 node -r @swc-node/register",
116
+ "ts-bunchee": "pnpm cli ./src/bin/index.ts",
116
117
  "build-dir": "pnpm ts-bunchee --cwd",
117
- "build": "SWC_NODE_IGNORE_DYNAMIC=1 node -r @swc-node/register ./src/bin/index.ts --runtime node",
118
+ "build": "pnpm cli ./src/bin/index.ts --runtime node",
118
119
  "format": "prettier --write ."
119
120
  }
120
121
  }