bunchee 5.1.3 → 5.1.5

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
@@ -474,7 +474,7 @@ function lint$1(pkg) {
474
474
  }
475
475
  }
476
476
 
477
- var version = "5.1.3";
477
+ var version = "5.1.5";
478
478
 
479
479
  function relativify(path) {
480
480
  return path.startsWith('.') ? path : `./${path}`;
package/dist/index.js CHANGED
@@ -312,7 +312,17 @@ function resolveTypescript(cwd) {
312
312
  const m = new module$1.Module('', undefined);
313
313
  m.paths = module$1.Module._nodeModulePaths(cwd);
314
314
  try {
315
- ts = m.require('typescript');
315
+ // Bun does not yet support the `Module` class properly.
316
+ if (typeof (m == null ? void 0 : m.require) === 'undefined') {
317
+ const tsPath = require.resolve('typescript', {
318
+ paths: [
319
+ cwd
320
+ ]
321
+ });
322
+ ts = require(tsPath);
323
+ } else {
324
+ ts = m.require('typescript');
325
+ }
316
326
  } catch (e) {
317
327
  console.error(e);
318
328
  if (!hasLoggedTsWarning) {
@@ -477,34 +487,40 @@ function inlineCss(options) {
477
487
  // Follow up for rollup 4 for better support of assertion support https://github.com/rollup/rollup/issues/4818
478
488
  return {
479
489
  name: 'inline-css',
480
- transform (code, id) {
481
- if (!filter(id)) return;
482
- if (options.skip) return '';
483
- const cssCode = minify(code);
484
- cssIds.add(id);
485
- return {
486
- code: helpers.cssImport.create(cssCode),
487
- map: {
488
- mappings: ''
489
- }
490
- };
490
+ transform: {
491
+ order: 'post',
492
+ handler (code, id) {
493
+ if (!filter(id)) return;
494
+ if (options.skip) return '';
495
+ const cssCode = minify(code);
496
+ cssIds.add(id);
497
+ return {
498
+ code: helpers.cssImport.create(cssCode),
499
+ map: {
500
+ mappings: ''
501
+ }
502
+ };
503
+ }
491
504
  },
492
- renderChunk (code) {
493
- const dependenciesIds = this.getModuleIds();
494
- let foundCss = false;
495
- for (const depId of dependenciesIds){
496
- if (depId && cssIds.has(depId)) {
497
- foundCss = true;
498
- break;
505
+ renderChunk: {
506
+ order: 'pre',
507
+ handler (code) {
508
+ const dependenciesIds = this.getModuleIds();
509
+ let foundCss = false;
510
+ for (const depId of dependenciesIds){
511
+ if (depId && cssIds.has(depId)) {
512
+ foundCss = true;
513
+ break;
514
+ }
499
515
  }
516
+ if (!foundCss) return;
517
+ return {
518
+ code: `${helpers.cssImport.global}\n${code}`,
519
+ map: {
520
+ mappings: ''
521
+ }
522
+ };
500
523
  }
501
- if (!foundCss) return;
502
- return {
503
- code: `${helpers.cssImport.global}\n${code}`,
504
- map: {
505
- mappings: ''
506
- }
507
- };
508
524
  }
509
525
  };
510
526
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunchee",
3
- "version": "5.1.3",
3
+ "version": "5.1.5",
4
4
  "description": "zero config bundler for js/ts/jsx libraries",
5
5
  "bin": "./dist/bin/cli.js",
6
6
  "main": "./dist/index.js",
@@ -42,13 +42,13 @@
42
42
  "@rollup/plugin-replace": "^5.0.5",
43
43
  "@rollup/plugin-wasm": "^6.2.2",
44
44
  "@rollup/pluginutils": "^5.1.0",
45
- "@swc/core": "^1.5.0",
45
+ "@swc/core": "^1.4.17",
46
46
  "@swc/helpers": "^0.5.11",
47
47
  "arg": "^5.0.2",
48
48
  "clean-css": "^5.3.3",
49
49
  "magic-string": "^0.30.10",
50
50
  "pretty-bytes": "^5.6.0",
51
- "rollup": "^4.16.4",
51
+ "rollup": "^4.17.2",
52
52
  "rollup-plugin-dts": "^6.1.0",
53
53
  "rollup-plugin-swc3": "^0.11.1",
54
54
  "rollup-preserve-directives": "^1.1.1",
@@ -108,6 +108,7 @@
108
108
  "test": "jest --env node",
109
109
  "test:update": "TEST_UPDATE_SNAPSHOT=1 pnpm test",
110
110
  "test:post": "POST_BUILD=1 pnpm jest test/compile.test.ts test/integration.test.ts",
111
+ "test:ci": "[ -z $CI ] || pnpm test",
111
112
  "clean": "rm -rf ./dist",
112
113
  "typecheck": "tsc --noEmit && tsc -p test/tsconfig.json --noEmit",
113
114
  "tsx": "node -r @swc-node/register",