bunchee 5.6.1 → 5.6.2

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
@@ -525,7 +525,7 @@ function lint$1(pkg) {
525
525
  }
526
526
  }
527
527
 
528
- var version = "5.6.1";
528
+ var version = "5.6.2";
529
529
 
530
530
  function relativify(path) {
531
531
  return path.startsWith('.') ? path : `./${path}`;
package/dist/index.js CHANGED
@@ -882,9 +882,9 @@ function createOutputState({ entries }) {
882
882
  return {
883
883
  name: 'collect-sizes',
884
884
  writeBundle (options, bundle) {
885
- const dir = options.dir || path.posix.dirname(options.file);
885
+ const dir = options.dir || path__default.default.dirname(options.file);
886
886
  Object.entries(bundle).forEach(([fileName, chunk])=>{
887
- const filePath = path.posix.join(dir, fileName);
887
+ const filePath = path__default.default.join(dir, fileName);
888
888
  if (chunk.type !== 'chunk') {
889
889
  return;
890
890
  }
@@ -895,7 +895,7 @@ function createOutputState({ entries }) {
895
895
  const sourceFileName = chunk.facadeModuleId || '';
896
896
  const exportPath = removeScope(reversedMapping.get(sourceFileName) || '.');
897
897
  addSize({
898
- fileName: path__default.default.isAbsolute(cwd) ? path.posix.relative(cwd, filePath) : filePath,
898
+ fileName: path__default.default.relative(cwd, filePath).replace(path__default.default.sep, '/'),
899
899
  size,
900
900
  sourceFileName,
901
901
  exportPath
@@ -1021,7 +1021,7 @@ async function writeDefaultTsconfig(tsConfigPath) {
1021
1021
  const FILENAME_REGEX = /__filename/;
1022
1022
  const DIRNAME_REGEX = /__dirname/;
1023
1023
  // not char, or space before require(.resolve)?(
1024
- const GLOBAL_REQUIRE_REGEX = /[\W\s]require(\.resolve)?\(/;
1024
+ const GLOBAL_REQUIRE_REGEX = /(?:^|[^.\w'"`])\brequire(\.resolve)?\(\s*[\r\n]*(['"`])/;
1025
1025
  const PolyfillComment = '/** rollup-private-do-not-use-esm-shim-polyfill */';
1026
1026
  const createESMShim = ({ filename, dirname, globalRequire })=>{
1027
1027
  const useNodeUrl = filename || dirname;
@@ -1306,10 +1306,11 @@ function prependDirectives() {
1306
1306
  handler (code, id) {
1307
1307
  var _moduleInfo_meta;
1308
1308
  const moduleInfo = this.getModuleInfo(id);
1309
- if (moduleInfo == null ? void 0 : (_moduleInfo_meta = moduleInfo.meta) == null ? void 0 : _moduleInfo_meta.preserveDirectives) {
1310
- const firstDirective = moduleInfo.meta.preserveDirectives.directives[0];
1309
+ const preserveDirectives = moduleInfo == null ? void 0 : (_moduleInfo_meta = moduleInfo.meta) == null ? void 0 : _moduleInfo_meta.preserveDirectives;
1310
+ if (preserveDirectives) {
1311
+ const firstDirective = preserveDirectives.directives[0];
1311
1312
  if (firstDirective) {
1312
- const directive = firstDirective.value;
1313
+ const directive = firstDirective;
1313
1314
  const directiveCode = `'${directive}';`;
1314
1315
  return directiveCode + '\n' + code;
1315
1316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "5.6.1",
3
+ "version": "5.6.2",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": "./dist/bin/cli.js",
6
6
  "main": "./dist/index.js",
@@ -51,7 +51,7 @@
51
51
  "rollup": "^4.24.0",
52
52
  "rollup-plugin-dts": "^6.1.1",
53
53
  "rollup-plugin-swc3": "^0.11.1",
54
- "rollup-preserve-directives": "^1.1.2",
54
+ "rollup-preserve-directives": "^1.1.3",
55
55
  "tslib": "^2.7.0",
56
56
  "yargs": "^17.7.2"
57
57
  },