@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.
Files changed (32) hide show
  1. package/dist/_chunks/{_resolveBuildContext-03173a8b.js → _resolveBuildContext-e3d4d924.js} +3 -1
  2. package/dist/_chunks/_resolveBuildContext-e3d4d924.js.map +1 -0
  3. package/dist/_chunks/{build-310be3da.js → build-ba5d11e7.js} +68 -64
  4. package/dist/_chunks/build-ba5d11e7.js.map +1 -0
  5. package/dist/_chunks/{buildAction-a9202a2e.js → buildAction-7dd5b756.js} +5 -4
  6. package/dist/_chunks/buildAction-7dd5b756.js.map +1 -0
  7. package/dist/_chunks/{check-11e7f6c3.js → check-8b65f4c4.js} +2 -2
  8. package/dist/_chunks/{check-11e7f6c3.js.map → check-8b65f4c4.js.map} +1 -1
  9. package/dist/_chunks/{checkAction-94065a29.js → checkAction-05a46549.js} +3 -3
  10. package/dist/_chunks/{checkAction-94065a29.js.map → checkAction-05a46549.js.map} +1 -1
  11. package/dist/_chunks/{index-ce8b8c19.js → index-eaeaf263.js} +2 -2
  12. package/dist/_chunks/{index-ce8b8c19.js.map → index-eaeaf263.js.map} +1 -1
  13. package/dist/_chunks/{watch-66b2cb5a.js → watch-aa39f968.js} +3 -3
  14. package/dist/_chunks/{watch-66b2cb5a.js.map → watch-aa39f968.js.map} +1 -1
  15. package/dist/_chunks/{watchAction-54591f0e.js → watchAction-f2bbad8d.js} +4 -4
  16. package/dist/_chunks/{watchAction-54591f0e.js.map → watchAction-f2bbad8d.js.map} +1 -1
  17. package/dist/cli.js +5 -5
  18. package/dist/cli.js.map +1 -1
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.esm.js +65 -59
  21. package/dist/index.esm.js.map +1 -1
  22. package/dist/index.js +5 -5
  23. package/package.json +1 -1
  24. package/src/cli/buildAction.ts +6 -1
  25. package/src/cli/index.ts +1 -0
  26. package/src/node/_core/contexts/buildContext.ts +1 -0
  27. package/src/node/_resolveBuildContext.ts +3 -1
  28. package/src/node/_resolveBuildTasks.ts +75 -72
  29. package/src/node/build.ts +3 -2
  30. package/dist/_chunks/_resolveBuildContext-03173a8b.js.map +0 -1
  31. package/dist/_chunks/build-310be3da.js.map +0 -1
  32. 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
- for (const exp of exports) {
379
- const output = exp.require;
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
- for (const exp of exports) {
390
- const output = exp.import;
391
- if (!output) continue;
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
- for (const exp of exports) {
401
- const output = (_a = exp.browser) == null ? void 0 : _a.require;
402
- if (!output) continue;
387
+ _addRollupTaskEntry("commonjs", ctx.runtime, {
388
+ path: exp._path,
389
+ source: exp.source,
390
+ output
391
+ });
392
+ }
403
393
 
404
- _addRollupTaskEntry("commonjs", "browser", {
405
- path: exp._path,
406
- source: ((_b = exp.browser) == null ? void 0 : _b.source) || exp.source,
407
- output
408
- });
409
- }
394
+ for (const exp of exports) {
395
+ const output = exp.import;
396
+ if (!output) continue;
410
397
 
411
- for (const exp of exports) {
412
- const output = (_c = exp.browser) == null ? void 0 : _c.import;
413
- if (!output) continue;
398
+ _addRollupTaskEntry("esm", ctx.runtime, {
399
+ path: exp._path,
400
+ source: exp.source,
401
+ output
402
+ });
403
+ }
414
404
 
415
- _addRollupTaskEntry("esm", "browser", {
416
- path: exp._path,
417
- source: ((_d = exp.browser) == null ? void 0 : _d.source) || exp.source,
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
- for (const bundle of bundles) {
423
- if (bundle.require) {
424
- _addRollupTaskEntry("commonjs", bundle.runtime || ctx.runtime, {
425
- path: "__bundle__",
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
- if (bundle.import) {
432
- _addRollupTaskEntry("commonjs", bundle.runtime || ctx.runtime, {
433
- path: "__bundle__",
434
- source: bundle.source,
435
- output: bundle.import
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
- if (dtsTask.entries.length) {
441
- tasks.push(dtsTask);
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
- tasks.push(...Object.values(rollupTasks));
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
- if (config == null ? void 0 : config.legacyExports) {
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
- if (relativeTargetPath) {
452
- fs$1.writeFileSync(path.resolve(cwd, "".concat(exp._path, ".js")), ["// AUTO-GENERATED \u2013 DO NOT EDIT", "export * from '".concat(relativeTargetPath, "'"), ""].join("\n"));
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