bunchee 5.1.4 → 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 +1 -1
- package/dist/index.js +42 -26
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
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
|
-
|
|
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
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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
|
}
|