@sanity/pkg-utils 1.15.0 → 1.16.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/README.md +21 -0
- package/dist/_chunks/{_resolveBuildContext-0e601cff.js → _resolveBuildContext-e3d4d924.js} +4 -4
- package/dist/_chunks/_resolveBuildContext-e3d4d924.js.map +1 -0
- package/dist/_chunks/{build-3762711f.js → build-ba5d11e7.js} +68 -64
- package/dist/_chunks/build-ba5d11e7.js.map +1 -0
- package/dist/_chunks/{buildAction-b4e23900.js → buildAction-7dd5b756.js} +5 -4
- package/dist/_chunks/buildAction-7dd5b756.js.map +1 -0
- package/dist/_chunks/{check-e60e8979.js → check-8b65f4c4.js} +2 -2
- package/dist/_chunks/{check-e60e8979.js.map → check-8b65f4c4.js.map} +1 -1
- package/dist/_chunks/{checkAction-6de69604.js → checkAction-05a46549.js} +3 -3
- package/dist/_chunks/{checkAction-6de69604.js.map → checkAction-05a46549.js.map} +1 -1
- package/dist/_chunks/{index-00a76fd5.js → index-eaeaf263.js} +2 -2
- package/dist/_chunks/{index-00a76fd5.js.map → index-eaeaf263.js.map} +1 -1
- package/dist/_chunks/{watch-69b1e41c.js → watch-aa39f968.js} +3 -3
- package/dist/_chunks/{watch-69b1e41c.js.map → watch-aa39f968.js.map} +1 -1
- package/dist/_chunks/{watchAction-72377ec8.js → watchAction-f2bbad8d.js} +4 -4
- package/dist/_chunks/{watchAction-72377ec8.js.map → watchAction-f2bbad8d.js.map} +1 -1
- package/dist/cli.js +5 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +66 -62
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/cli/buildAction.ts +6 -1
- package/src/cli/index.ts +1 -0
- package/src/node/_core/contexts/buildContext.ts +1 -0
- package/src/node/_resolveBuildContext.ts +8 -2
- package/src/node/_resolveBuildTasks.ts +75 -72
- package/src/node/build.ts +3 -2
- package/dist/_chunks/_resolveBuildContext-0e601cff.js.map +0 -1
- package/dist/_chunks/build-3762711f.js.map +0 -1
- package/dist/_chunks/buildAction-b4e23900.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -375,81 +375,83 @@ function _resolveBuildTasks(ctx) {
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
if (!output) continue;
|
|
381
|
-
|
|
382
|
-
_addRollupTaskEntry("commonjs", ctx.runtime, {
|
|
383
|
-
path: exp._path,
|
|
384
|
-
source: exp.source,
|
|
385
|
-
output
|
|
386
|
-
});
|
|
378
|
+
if (dtsTask.entries.length) {
|
|
379
|
+
tasks.push(dtsTask);
|
|
387
380
|
}
|
|
388
381
|
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
_addRollupTaskEntry("esm", ctx.runtime, {
|
|
394
|
-
path: exp._path,
|
|
395
|
-
source: exp.source,
|
|
396
|
-
output
|
|
397
|
-
});
|
|
398
|
-
}
|
|
382
|
+
if (!ctx.emitDeclarationOnly) {
|
|
383
|
+
for (const exp of exports) {
|
|
384
|
+
const output = exp.require;
|
|
385
|
+
if (!output) continue;
|
|
399
386
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
387
|
+
_addRollupTaskEntry("commonjs", ctx.runtime, {
|
|
388
|
+
path: exp._path,
|
|
389
|
+
source: exp.source,
|
|
390
|
+
output
|
|
391
|
+
});
|
|
392
|
+
}
|
|
403
393
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
output
|
|
408
|
-
});
|
|
409
|
-
}
|
|
394
|
+
for (const exp of exports) {
|
|
395
|
+
const output = exp.import;
|
|
396
|
+
if (!output) continue;
|
|
410
397
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
398
|
+
_addRollupTaskEntry("esm", ctx.runtime, {
|
|
399
|
+
path: exp._path,
|
|
400
|
+
source: exp.source,
|
|
401
|
+
output
|
|
402
|
+
});
|
|
403
|
+
}
|
|
414
404
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
output
|
|
419
|
-
});
|
|
420
|
-
}
|
|
405
|
+
for (const exp of exports) {
|
|
406
|
+
const output = (_a = exp.browser) == null ? void 0 : _a.require;
|
|
407
|
+
if (!output) continue;
|
|
421
408
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
source: bundle.source,
|
|
427
|
-
output: bundle.require
|
|
409
|
+
_addRollupTaskEntry("commonjs", "browser", {
|
|
410
|
+
path: exp._path,
|
|
411
|
+
source: ((_b = exp.browser) == null ? void 0 : _b.source) || exp.source,
|
|
412
|
+
output
|
|
428
413
|
});
|
|
429
414
|
}
|
|
430
415
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
416
|
+
for (const exp of exports) {
|
|
417
|
+
const output = (_c = exp.browser) == null ? void 0 : _c.import;
|
|
418
|
+
if (!output) continue;
|
|
419
|
+
|
|
420
|
+
_addRollupTaskEntry("esm", "browser", {
|
|
421
|
+
path: exp._path,
|
|
422
|
+
source: ((_d = exp.browser) == null ? void 0 : _d.source) || exp.source,
|
|
423
|
+
output
|
|
436
424
|
});
|
|
437
425
|
}
|
|
438
|
-
}
|
|
439
426
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
427
|
+
for (const bundle of bundles) {
|
|
428
|
+
if (bundle.require) {
|
|
429
|
+
_addRollupTaskEntry("commonjs", bundle.runtime || ctx.runtime, {
|
|
430
|
+
path: "__bundle__",
|
|
431
|
+
source: bundle.source,
|
|
432
|
+
output: bundle.require
|
|
433
|
+
});
|
|
434
|
+
}
|
|
443
435
|
|
|
444
|
-
|
|
436
|
+
if (bundle.import) {
|
|
437
|
+
_addRollupTaskEntry("commonjs", bundle.runtime || ctx.runtime, {
|
|
438
|
+
path: "__bundle__",
|
|
439
|
+
source: bundle.source,
|
|
440
|
+
output: bundle.import
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
445
444
|
|
|
446
|
-
|
|
447
|
-
for (const exp of exports) {
|
|
448
|
-
if (exp._exported && exp._path !== ".") {
|
|
449
|
-
const relativeTargetPath = (((_e = exp.browser) == null ? void 0 : _e.import) || exp.import || "").replace(/\.[^/.]+$/, "");
|
|
445
|
+
tasks.push(...Object.values(rollupTasks));
|
|
450
446
|
|
|
451
|
-
|
|
452
|
-
|
|
447
|
+
if (config == null ? void 0 : config.legacyExports) {
|
|
448
|
+
for (const exp of exports) {
|
|
449
|
+
if (exp._exported && exp._path !== ".") {
|
|
450
|
+
const relativeTargetPath = (((_e = exp.browser) == null ? void 0 : _e.import) || exp.import || "").replace(/\.[^/.]+$/, "");
|
|
451
|
+
|
|
452
|
+
if (relativeTargetPath) {
|
|
453
|
+
fs$1.writeFileSync(path.resolve(cwd, "".concat(exp._path, ".js")), ["// AUTO-GENERATED \u2013 DO NOT EDIT", "export * from '".concat(relativeTargetPath, "'"), ""].join("\n"));
|
|
454
|
+
}
|
|
453
455
|
}
|
|
454
456
|
}
|
|
455
457
|
}
|
|
@@ -1327,6 +1329,7 @@ async function _resolveBuildContext(options) {
|
|
|
1327
1329
|
const {
|
|
1328
1330
|
config,
|
|
1329
1331
|
cwd,
|
|
1332
|
+
emitDeclarationOnly = false,
|
|
1330
1333
|
pkg,
|
|
1331
1334
|
strict,
|
|
1332
1335
|
tsconfig: tsconfigPath
|
|
@@ -1375,9 +1378,7 @@ async function _resolveBuildContext(options) {
|
|
|
1375
1378
|
const exports = _resolveConfigProperty(config == null ? void 0 : config.exports, parsedExports);
|
|
1376
1379
|
|
|
1377
1380
|
const parsedExternal = [...(pkg.dependencies ? Object.keys(pkg.dependencies) : []), ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [])];
|
|
1378
|
-
|
|
1379
|
-
const external = _resolveConfigProperty(config == null ? void 0 : config.external, parsedExternal);
|
|
1380
|
-
|
|
1381
|
+
const external = config && Array.isArray(config.external) ? [...parsedExternal, ...config.external] : _resolveConfigProperty(config == null ? void 0 : config.external, parsedExternal);
|
|
1381
1382
|
const outputPaths = Object.values(exports).flatMap(exportEntry => {
|
|
1382
1383
|
var _a, _b, _c, _d;
|
|
1383
1384
|
|
|
@@ -1411,6 +1412,7 @@ async function _resolveBuildContext(options) {
|
|
|
1411
1412
|
config,
|
|
1412
1413
|
cwd,
|
|
1413
1414
|
distPath,
|
|
1415
|
+
emitDeclarationOnly,
|
|
1414
1416
|
exports,
|
|
1415
1417
|
external,
|
|
1416
1418
|
files: [],
|
|
@@ -1443,6 +1445,7 @@ function _spinner(msg) {
|
|
|
1443
1445
|
async function build(options) {
|
|
1444
1446
|
const {
|
|
1445
1447
|
cwd,
|
|
1448
|
+
emitDeclarationOnly,
|
|
1446
1449
|
strict = false,
|
|
1447
1450
|
tsconfig: tsconfigOption
|
|
1448
1451
|
} = options;
|
|
@@ -1456,6 +1459,7 @@ async function build(options) {
|
|
|
1456
1459
|
const ctx = await _resolveBuildContext({
|
|
1457
1460
|
config,
|
|
1458
1461
|
cwd,
|
|
1462
|
+
emitDeclarationOnly,
|
|
1459
1463
|
pkg,
|
|
1460
1464
|
strict,
|
|
1461
1465
|
tsconfig
|