@sanity/pkg-utils 2.3.13-canary.1 → 2.3.13
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-fabfa3af.cjs → build-e6e2708e.cjs} +4 -4
- package/dist/_chunks/{build-fabfa3af.cjs.map → build-e6e2708e.cjs.map} +1 -1
- package/dist/_chunks/{buildAction-dae78abb.cjs → buildAction-4d12b69c.cjs} +2 -2
- package/dist/_chunks/{buildAction-dae78abb.cjs.map → buildAction-4d12b69c.cjs.map} +1 -1
- package/dist/_chunks/{check-332a2bb9.cjs → check-0665cb35.cjs} +3 -3
- package/dist/_chunks/{check-332a2bb9.cjs.map → check-0665cb35.cjs.map} +1 -1
- package/dist/_chunks/{checkAction-c39d7dbf.cjs → checkAction-c3e5da35.cjs} +2 -2
- package/dist/_chunks/{checkAction-c39d7dbf.cjs.map → checkAction-c3e5da35.cjs.map} +1 -1
- package/dist/_chunks/{consoleSpy-686c350b.cjs → consoleSpy-d738cb9f.cjs} +12 -52
- package/dist/_chunks/consoleSpy-d738cb9f.cjs.map +1 -0
- package/dist/_chunks/{index-1811ae9f.cjs → index-70f8931a.cjs} +7 -25
- package/dist/_chunks/index-70f8931a.cjs.map +1 -0
- package/dist/_chunks/{init-e45c0c31.cjs → init-2377e6e5.cjs} +2 -2
- package/dist/_chunks/{init-e45c0c31.cjs.map → init-2377e6e5.cjs.map} +1 -1
- package/dist/_chunks/{initAction-48ce747a.cjs → initAction-2abd8576.cjs} +2 -2
- package/dist/_chunks/{initAction-48ce747a.cjs.map → initAction-2abd8576.cjs.map} +1 -1
- package/dist/_chunks/{logger-718e11be.cjs → logger-c593f06b.cjs} +6 -8
- package/dist/_chunks/logger-c593f06b.cjs.map +1 -0
- package/dist/_chunks/{watch-4e565bee.cjs → watch-d390d5e4.cjs} +4 -4
- package/dist/_chunks/{watch-4e565bee.cjs.map → watch-d390d5e4.cjs.map} +1 -1
- package/dist/_chunks/{watchAction-a5721084.cjs → watchAction-63c8a721.cjs} +2 -2
- package/dist/_chunks/{watchAction-a5721084.cjs.map → watchAction-63c8a721.cjs.map} +1 -1
- package/dist/cli.cjs +5 -5
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +2 -9
- package/dist/index.js +19 -78
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/src/node/core/config/types.ts +0 -5
- package/src/node/core/pkg/loadPkgWithReporting.ts +18 -91
- package/src/node/core/pkg/types.ts +2 -4
- package/src/node/core/pkg/validatePkg.ts +3 -5
- package/src/node/tasks/rollup/resolveRollupConfig.ts +4 -10
- package/src/node/tasks/rollup/rollupTask.ts +0 -20
- package/dist/_chunks/consoleSpy-686c350b.cjs.map +0 -1
- package/dist/_chunks/index-1811ae9f.cjs.map +0 -1
- package/dist/_chunks/logger-718e11be.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchAction-
|
|
1
|
+
{"version":3,"file":"watchAction-63c8a721.cjs","sources":["../../src/cli/watchAction.ts"],"sourcesContent":["import {watch} from '../node/watch'\nimport {handleError} from './handleError'\n\nexport async function watchAction(options: {strict?: boolean; tsconfig?: string}): Promise<void> {\n try {\n await watch({\n cwd: process.cwd(),\n strict: options.strict,\n tsconfig: options.tsconfig,\n })\n } catch (err) {\n handleError(err)\n }\n}\n"],"names":["watchAction","options","watch","cwd","process","strict","tsconfig","err","handleError"],"mappings":";;;;AAGA,eAAsBA,YAAYC,OAA+D,EAAA;EAC3F,IAAA;IACF,MAAMC,WAAM,CAAA;MACVC,GAAA,EAAKC,QAAQD,GAAI,CAAA,CAAA;MACjBE,QAAQJ,OAAQ,CAAAI,MAAA;MAChBC,UAAUL,OAAQ,CAAAK;IAAA,CACnB,CAAA;WACMC,GAAK,EAAA;IACZC,WAAA,CAAAA,WAAA,CAAYD,GAAG,CAAA;EACjB;AACF;"}
|
package/dist/cli.cjs
CHANGED
|
@@ -7,13 +7,13 @@ function _interopDefaultCompat(e) {
|
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
9
|
var cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
|
|
10
|
-
var version = "2.3.13
|
|
10
|
+
var version = "2.3.13";
|
|
11
11
|
const cli = cac__default.default();
|
|
12
12
|
cli.command("", "Check").alias("check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async options => {
|
|
13
13
|
const {
|
|
14
14
|
checkAction
|
|
15
15
|
} = await Promise.resolve().then(function () {
|
|
16
|
-
return require('./_chunks/checkAction-
|
|
16
|
+
return require('./_chunks/checkAction-c3e5da35.cjs');
|
|
17
17
|
});
|
|
18
18
|
return checkAction(options);
|
|
19
19
|
});
|
|
@@ -21,7 +21,7 @@ cli.command("build", "Build package").option("--emitDeclarationOnly", "Emit d.ts
|
|
|
21
21
|
const {
|
|
22
22
|
buildAction
|
|
23
23
|
} = await Promise.resolve().then(function () {
|
|
24
|
-
return require('./_chunks/buildAction-
|
|
24
|
+
return require('./_chunks/buildAction-4d12b69c.cjs');
|
|
25
25
|
});
|
|
26
26
|
return buildAction(options);
|
|
27
27
|
});
|
|
@@ -29,7 +29,7 @@ cli.command("init [path]", "Initialize package").action(async p => {
|
|
|
29
29
|
const {
|
|
30
30
|
initAction
|
|
31
31
|
} = await Promise.resolve().then(function () {
|
|
32
|
-
return require('./_chunks/initAction-
|
|
32
|
+
return require('./_chunks/initAction-2abd8576.cjs');
|
|
33
33
|
});
|
|
34
34
|
return initAction({
|
|
35
35
|
path: p
|
|
@@ -39,7 +39,7 @@ cli.command("watch", "Watch package").option("--strict", "Strict mode").option("
|
|
|
39
39
|
const {
|
|
40
40
|
watchAction
|
|
41
41
|
} = await Promise.resolve().then(function () {
|
|
42
|
-
return require('./_chunks/watchAction-
|
|
42
|
+
return require('./_chunks/watchAction-63c8a721.cjs');
|
|
43
43
|
});
|
|
44
44
|
return watchAction(options);
|
|
45
45
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var build = require('./_chunks/build-
|
|
7
|
-
var check = require('./_chunks/check-
|
|
8
|
-
var consoleSpy = require('./_chunks/consoleSpy-
|
|
9
|
-
var logger = require('./_chunks/logger-
|
|
10
|
-
var init = require('./_chunks/init-
|
|
11
|
-
var index = require('./_chunks/index-
|
|
12
|
-
var watch = require('./_chunks/watch-
|
|
6
|
+
var build = require('./_chunks/build-e6e2708e.cjs');
|
|
7
|
+
var check = require('./_chunks/check-0665cb35.cjs');
|
|
8
|
+
var consoleSpy = require('./_chunks/consoleSpy-d738cb9f.cjs');
|
|
9
|
+
var logger = require('./_chunks/logger-c593f06b.cjs');
|
|
10
|
+
var init = require('./_chunks/init-2377e6e5.cjs');
|
|
11
|
+
var index = require('./_chunks/index-70f8931a.cjs');
|
|
12
|
+
var watch = require('./_chunks/watch-d390d5e4.cjs');
|
|
13
13
|
function defineConfig(configOptions) {
|
|
14
14
|
return configOptions;
|
|
15
15
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -218,16 +218,14 @@ export declare interface PackageJSON {
|
|
|
218
218
|
types?: string
|
|
219
219
|
browser?: {
|
|
220
220
|
source: string
|
|
221
|
-
import?: string
|
|
222
221
|
require?: string
|
|
222
|
+
import?: string
|
|
223
223
|
}
|
|
224
224
|
node?: {
|
|
225
225
|
source?: string
|
|
226
|
-
module?: string
|
|
227
|
-
import?: string
|
|
228
226
|
require?: string
|
|
227
|
+
import?: string
|
|
229
228
|
}
|
|
230
|
-
module?: string
|
|
231
229
|
import?: string
|
|
232
230
|
require?: string
|
|
233
231
|
default: string
|
|
@@ -328,11 +326,6 @@ export declare interface PkgConfigOptions {
|
|
|
328
326
|
* Build package with support for legacy exports (writes root `<export>.js` files)
|
|
329
327
|
*/
|
|
330
328
|
legacyExports?: boolean
|
|
331
|
-
/**
|
|
332
|
-
* Preserves module directives, such as `'use client'`
|
|
333
|
-
* @alpha
|
|
334
|
-
*/
|
|
335
|
-
preserveModuleDirectives?: boolean
|
|
336
329
|
minify?: boolean
|
|
337
330
|
/** @alpha */
|
|
338
331
|
rollup?: {
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,6 @@ 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';
|
|
36
35
|
import esbuild$1 from 'esbuild';
|
|
37
36
|
import treeify from 'treeify';
|
|
38
37
|
import prettyBytes from 'pretty-bytes';
|
|
@@ -126,20 +125,18 @@ const pkgSchema = z.object({
|
|
|
126
125
|
exports: z.optional(z.record(z.union([z.custom(val => /^\.\/.*\.json$/.test(val)), z.object({
|
|
127
126
|
types: z.optional(z.string()),
|
|
128
127
|
source: z.string(),
|
|
128
|
+
require: z.optional(z.string()),
|
|
129
129
|
browser: z.optional(z.object({
|
|
130
130
|
source: z.string(),
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
require: z.optional(z.string()),
|
|
132
|
+
import: z.optional(z.string())
|
|
133
133
|
})),
|
|
134
134
|
node: z.optional(z.object({
|
|
135
135
|
source: z.optional(z.string()),
|
|
136
|
-
|
|
137
|
-
import: z.optional(z.string())
|
|
138
|
-
require: z.optional(z.string())
|
|
136
|
+
require: z.optional(z.string()),
|
|
137
|
+
import: z.optional(z.string())
|
|
139
138
|
})),
|
|
140
|
-
module: z.optional(z.string()),
|
|
141
139
|
import: z.optional(z.string()),
|
|
142
|
-
require: z.optional(z.string()),
|
|
143
140
|
default: z.string()
|
|
144
141
|
})]))),
|
|
145
142
|
browserslist: z.optional(z.array(z.string()))
|
|
@@ -191,7 +188,6 @@ async function loadPkgWithReporting(options) {
|
|
|
191
188
|
const pkg = await loadPkg({
|
|
192
189
|
cwd
|
|
193
190
|
});
|
|
194
|
-
let shouldError = false;
|
|
195
191
|
if (pkg.exports) {
|
|
196
192
|
const _exports = Object.entries(pkg.exports);
|
|
197
193
|
for (const [expPath, exp] of _exports) {
|
|
@@ -200,61 +196,22 @@ async function loadPkgWithReporting(options) {
|
|
|
200
196
|
}
|
|
201
197
|
const keys = Object.keys(exp);
|
|
202
198
|
if (!assertFirst("types", keys)) {
|
|
203
|
-
|
|
204
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `types` property should be the first property"));
|
|
199
|
+
logger.warn("exports[\"".concat(expPath, "\"]: the `types` property should be the first property"));
|
|
205
200
|
}
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
if (!assertOrder("module", "require", nodeKeys)) {
|
|
216
|
-
logger.warn("exports[\"".concat(expPath, "\"]: the `node.module` property should come before `node.require` property"));
|
|
217
|
-
}
|
|
218
|
-
if (exp.import && exp.node.import && !assertOrder("node", "import", keys)) {
|
|
219
|
-
shouldError = true;
|
|
220
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `node` property should come before the `import` property"));
|
|
221
|
-
}
|
|
222
|
-
if (exp.module && exp.node.module && !assertOrder("node", "module", keys)) {
|
|
223
|
-
shouldError = true;
|
|
224
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `node` property should come before the `module` property"));
|
|
225
|
-
}
|
|
226
|
-
if (exp.node.import && !exp.node.require && !exp.node.module) {
|
|
227
|
-
shouldError = true;
|
|
228
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `node.module` property should be added so bundlers don't unintentionally try to bundle `node.import`"));
|
|
229
|
-
}
|
|
230
|
-
if (exp.node.import && !exp.node.require && exp.node.module && exp.import && exp.node.module !== exp.import) {
|
|
231
|
-
shouldError = true;
|
|
232
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `node.module` property should match `import`"));
|
|
233
|
-
}
|
|
234
|
-
if (exp.require && exp.node.require && exp.require === exp.node.require) {
|
|
235
|
-
shouldError = true;
|
|
236
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `node.require` property isn't necessary as it's identical to `require`"));
|
|
237
|
-
} else if (exp.require && exp.node.require && !assertOrder("node", "require", keys)) {
|
|
238
|
-
shouldError = true;
|
|
239
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `node` property should come before the `require` property"));
|
|
240
|
-
}
|
|
241
|
-
} else {
|
|
242
|
-
if (!assertOrder("import", "require", keys)) {
|
|
243
|
-
logger.warn("exports[\"".concat(expPath, "\"]: the `import` property should come before the `require` property"));
|
|
244
|
-
}
|
|
245
|
-
if (!assertOrder("module", "import", keys)) {
|
|
246
|
-
logger.warn("exports[\"".concat(expPath, "\"]: the `module` property should come before `import` property"));
|
|
247
|
-
}
|
|
201
|
+
if (!assertOrder("require", "import", keys)) {
|
|
202
|
+
logger.warn("exports[\"".concat(expPath, "\"]: the `require` property should come before the `import` property"));
|
|
203
|
+
}
|
|
204
|
+
if (!assertOrder("require", "node", keys)) {
|
|
205
|
+
logger.warn("exports[\"".concat(expPath, "\"]: the `require` property should come before the `node` property"));
|
|
206
|
+
}
|
|
207
|
+
if (!assertOrder("node", "import", keys)) {
|
|
208
|
+
logger.warn("exports[\"".concat(expPath, "\"]: the `node` property should come before `import` property"));
|
|
248
209
|
}
|
|
249
210
|
if (!assertLast("default", keys)) {
|
|
250
|
-
|
|
251
|
-
logger.error("exports[\"".concat(expPath, "\"]: the `default` property should be the last property"));
|
|
211
|
+
logger.warn("exports[\"".concat(expPath, "\"]: the `default` property should be the last property"));
|
|
252
212
|
}
|
|
253
213
|
}
|
|
254
214
|
}
|
|
255
|
-
if (shouldError) {
|
|
256
|
-
process.exit(1);
|
|
257
|
-
}
|
|
258
215
|
return pkg;
|
|
259
216
|
} catch (err) {
|
|
260
217
|
if (err instanceof ZodError) {
|
|
@@ -1458,10 +1415,10 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1458
1415
|
modules: false
|
|
1459
1416
|
}]]
|
|
1460
1417
|
}), minify && terser({
|
|
1461
|
-
compress:
|
|
1418
|
+
compress: {
|
|
1462
1419
|
// Needed until https://github.com/terser/terser/issues/1320 is fixed
|
|
1463
1420
|
directives: false
|
|
1464
|
-
}
|
|
1421
|
+
},
|
|
1465
1422
|
output: {
|
|
1466
1423
|
comments: (_node, comment) => {
|
|
1467
1424
|
const text = comment.value;
|
|
@@ -1472,9 +1429,7 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1472
1429
|
return false;
|
|
1473
1430
|
}
|
|
1474
1431
|
}
|
|
1475
|
-
})
|
|
1476
|
-
// Allows marking export files with `'use client'` at the top
|
|
1477
|
-
(config == null ? void 0 : config.preserveModuleDirectives) && preserveDirectives()].filter(Boolean);
|
|
1432
|
+
})].filter(Boolean);
|
|
1478
1433
|
const userPlugins = (_c = config == null ? void 0 : config.rollup) == null ? void 0 : _c.plugins;
|
|
1479
1434
|
const plugins = Array.isArray(userPlugins) ? defaultPlugins.concat(userPlugins) : resolveConfigProperty((_d = config == null ? void 0 : config.rollup) == null ? void 0 : _d.plugins, defaultPlugins);
|
|
1480
1435
|
return {
|
|
@@ -1531,8 +1486,7 @@ function resolveRollupConfig(ctx, buildTask) {
|
|
|
1531
1486
|
interop: "compat",
|
|
1532
1487
|
minifyInternalExports: minify,
|
|
1533
1488
|
sourcemap: (_ref11 = config == null ? void 0 : config.sourcemap) !== null && _ref11 !== void 0 ? _ref11 : true,
|
|
1534
|
-
hoistTransitiveImports: false
|
|
1535
|
-
preserveModules: (config == null ? void 0 : config.preserveModuleDirectives) ? true : false
|
|
1489
|
+
hoistTransitiveImports: false
|
|
1536
1490
|
}
|
|
1537
1491
|
};
|
|
1538
1492
|
}
|
|
@@ -1598,19 +1552,6 @@ async function execPromise(ctx, task) {
|
|
|
1598
1552
|
const bundle = await rollup({
|
|
1599
1553
|
...inputOptions,
|
|
1600
1554
|
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
|
-
}
|
|
1614
1555
|
consoleSpy.messages.push({
|
|
1615
1556
|
type: "warn",
|
|
1616
1557
|
code: warning.code,
|