@sanity/pkg-utils 1.15.1 → 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/dist/_chunks/{_resolveBuildContext-03173a8b.js → _resolveBuildContext-e3d4d924.js} +3 -1
- package/dist/_chunks/_resolveBuildContext-e3d4d924.js.map +1 -0
- package/dist/_chunks/{build-310be3da.js → build-ba5d11e7.js} +68 -64
- package/dist/_chunks/build-ba5d11e7.js.map +1 -0
- package/dist/_chunks/{buildAction-a9202a2e.js → buildAction-7dd5b756.js} +5 -4
- package/dist/_chunks/buildAction-7dd5b756.js.map +1 -0
- package/dist/_chunks/{check-11e7f6c3.js → check-8b65f4c4.js} +2 -2
- package/dist/_chunks/{check-11e7f6c3.js.map → check-8b65f4c4.js.map} +1 -1
- package/dist/_chunks/{checkAction-94065a29.js → checkAction-05a46549.js} +3 -3
- package/dist/_chunks/{checkAction-94065a29.js.map → checkAction-05a46549.js.map} +1 -1
- package/dist/_chunks/{index-ce8b8c19.js → index-eaeaf263.js} +2 -2
- package/dist/_chunks/{index-ce8b8c19.js.map → index-eaeaf263.js.map} +1 -1
- package/dist/_chunks/{watch-66b2cb5a.js → watch-aa39f968.js} +3 -3
- package/dist/_chunks/{watch-66b2cb5a.js.map → watch-aa39f968.js.map} +1 -1
- package/dist/_chunks/{watchAction-54591f0e.js → watchAction-f2bbad8d.js} +4 -4
- package/dist/_chunks/{watchAction-54591f0e.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 +65 -59
- 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 +3 -1
- package/src/node/_resolveBuildTasks.ts +75 -72
- package/src/node/build.ts +3 -2
- package/dist/_chunks/_resolveBuildContext-03173a8b.js.map +0 -1
- package/dist/_chunks/build-310be3da.js.map +0 -1
- package/dist/_chunks/buildAction-a9202a2e.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
|
|
@@ -1409,6 +1412,7 @@ async function _resolveBuildContext(options) {
|
|
|
1409
1412
|
config,
|
|
1410
1413
|
cwd,
|
|
1411
1414
|
distPath,
|
|
1415
|
+
emitDeclarationOnly,
|
|
1412
1416
|
exports,
|
|
1413
1417
|
external,
|
|
1414
1418
|
files: [],
|
|
@@ -1441,6 +1445,7 @@ function _spinner(msg) {
|
|
|
1441
1445
|
async function build(options) {
|
|
1442
1446
|
const {
|
|
1443
1447
|
cwd,
|
|
1448
|
+
emitDeclarationOnly,
|
|
1444
1449
|
strict = false,
|
|
1445
1450
|
tsconfig: tsconfigOption
|
|
1446
1451
|
} = options;
|
|
@@ -1454,6 +1459,7 @@ async function build(options) {
|
|
|
1454
1459
|
const ctx = await _resolveBuildContext({
|
|
1455
1460
|
config,
|
|
1456
1461
|
cwd,
|
|
1462
|
+
emitDeclarationOnly,
|
|
1457
1463
|
pkg,
|
|
1458
1464
|
strict,
|
|
1459
1465
|
tsconfig
|