@sanity/pkg-utils 2.3.14 → 2.4.0
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/_chunks/{build-bf3729c7.cjs → build-fabfa3af.cjs} +2 -2
- package/dist/_chunks/{build-bf3729c7.cjs.map → build-fabfa3af.cjs.map} +1 -1
- package/dist/_chunks/{buildAction-e721d08b.cjs → buildAction-dae78abb.cjs} +2 -2
- package/dist/_chunks/{buildAction-e721d08b.cjs.map → buildAction-dae78abb.cjs.map} +1 -1
- package/dist/_chunks/{index-c026daa9.cjs → index-1811ae9f.cjs} +23 -5
- package/dist/_chunks/index-1811ae9f.cjs.map +1 -0
- package/dist/_chunks/{watch-d7a9e8b7.cjs → watch-4e565bee.cjs} +2 -2
- package/dist/_chunks/{watch-d7a9e8b7.cjs.map → watch-4e565bee.cjs.map} +1 -1
- package/dist/_chunks/{watchAction-06f283b6.cjs → watchAction-a5721084.cjs} +2 -2
- package/dist/_chunks/{watchAction-06f283b6.cjs.map → watchAction-a5721084.cjs.map} +1 -1
- package/dist/cli.cjs +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/node/core/config/types.ts +5 -0
- package/src/node/tasks/rollup/resolveRollupConfig.ts +10 -4
- package/src/node/tasks/rollup/rollupTask.ts +20 -0
- package/dist/_chunks/index-c026daa9.cjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
|
32
32
|
import replace from '@rollup/plugin-replace';
|
|
33
33
|
import terser from '@rollup/plugin-terser';
|
|
34
34
|
import esbuild from 'rollup-plugin-esbuild';
|
|
35
|
+
import preserveDirectives from 'rollup-plugin-preserve-directives';
|
|
35
36
|
import esbuild$1 from 'esbuild';
|
|
36
37
|
import treeify from 'treeify';
|
|
37
38
|
import prettyBytes from 'pretty-bytes';
|
|
@@ -1457,10 +1458,10 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1457
1458
|
modules: false
|
|
1458
1459
|
}]]
|
|
1459
1460
|
}), minify && terser({
|
|
1460
|
-
compress: {
|
|
1461
|
+
compress: (config == null ? void 0 : config.preserveModuleDirectives) ? {
|
|
1461
1462
|
// Needed until https://github.com/terser/terser/issues/1320 is fixed
|
|
1462
1463
|
directives: false
|
|
1463
|
-
},
|
|
1464
|
+
} : true,
|
|
1464
1465
|
output: {
|
|
1465
1466
|
comments: (_node, comment) => {
|
|
1466
1467
|
const text = comment.value;
|
|
@@ -1471,7 +1472,9 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1471
1472
|
return false;
|
|
1472
1473
|
}
|
|
1473
1474
|
}
|
|
1474
|
-
})
|
|
1475
|
+
}),
|
|
1476
|
+
// Allows marking export files with `'use client'` at the top
|
|
1477
|
+
(config == null ? void 0 : config.preserveModuleDirectives) && preserveDirectives()].filter(Boolean);
|
|
1475
1478
|
const userPlugins = (_c = config == null ? void 0 : config.rollup) == null ? void 0 : _c.plugins;
|
|
1476
1479
|
const plugins = Array.isArray(userPlugins) ? defaultPlugins.concat(userPlugins) : resolveConfigProperty((_d = config == null ? void 0 : config.rollup) == null ? void 0 : _d.plugins, defaultPlugins);
|
|
1477
1480
|
return {
|
|
@@ -1528,7 +1531,8 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1528
1531
|
interop: "compat",
|
|
1529
1532
|
minifyInternalExports: minify,
|
|
1530
1533
|
sourcemap: (_ref11 = config == null ? void 0 : config.sourcemap) !== null && _ref11 !== void 0 ? _ref11 : true,
|
|
1531
|
-
hoistTransitiveImports: false
|
|
1534
|
+
hoistTransitiveImports: false,
|
|
1535
|
+
preserveModules: (config == null ? void 0 : config.preserveModuleDirectives) ? true : false
|
|
1532
1536
|
}
|
|
1533
1537
|
};
|
|
1534
1538
|
}
|
|
@@ -1594,6 +1598,19 @@ async function execPromise(ctx, task) {
|
|
|
1594
1598
|
const bundle = await rollup({
|
|
1595
1599
|
...inputOptions,
|
|
1596
1600
|
onwarn(warning) {
|
|
1601
|
+
var _a;
|
|
1602
|
+
if (
|
|
1603
|
+
// Ignore the directive warning until the preserveDirectives plugin does it automatically: https://github.com/Ephem/rollup-plugin-preserve-directives#rollup-plugin-preserve-directives-warning
|
|
1604
|
+
warning.message.includes('Module level directives cause errors when bundled, "use client" in')) {
|
|
1605
|
+
if (!((_a = ctx.config) == null ? void 0 : _a.preserveModuleDirectives)) {
|
|
1606
|
+
consoleSpy.messages.push({
|
|
1607
|
+
type: "warn",
|
|
1608
|
+
code: warning.code,
|
|
1609
|
+
args: ["".concat(warning.message, " You can preserve it by setting \"preserveModuleDirectives: true\" in your \"package.config.ts\"")]
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1597
1614
|
consoleSpy.messages.push({
|
|
1598
1615
|
type: "warn",
|
|
1599
1616
|
code: warning.code,
|