@sanity/pkg-utils 1.17.2 → 1.18.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 (30) hide show
  1. package/dist/_chunks/_handleError-869dec25.js +0 -5
  2. package/dist/_chunks/_handleError-869dec25.js.map +1 -1
  3. package/dist/_chunks/_resolveBuildContext-7ca7e64e.js +3 -122
  4. package/dist/_chunks/_resolveBuildContext-7ca7e64e.js.map +1 -1
  5. package/dist/_chunks/{build-072e58ec.js → build-f39a3550.js} +2 -46
  6. package/dist/_chunks/{build-072e58ec.js.map → build-f39a3550.js.map} +1 -1
  7. package/dist/_chunks/{buildAction-35aab706.js → buildAction-8f449d1d.js} +5 -35
  8. package/dist/_chunks/{buildAction-35aab706.js.map → buildAction-8f449d1d.js.map} +1 -1
  9. package/dist/_chunks/check-87cbb6cc.js +0 -55
  10. package/dist/_chunks/check-87cbb6cc.js.map +1 -1
  11. package/dist/_chunks/checkAction-e7e455d4.js +0 -17
  12. package/dist/_chunks/checkAction-e7e455d4.js.map +1 -1
  13. package/dist/_chunks/{index-68bcc7e2.js → index-7a851efa.js} +47 -223
  14. package/dist/_chunks/index-7a851efa.js.map +1 -0
  15. package/dist/_chunks/{watch-e09a4a66.js → watch-f6cf9246.js} +2 -57
  16. package/dist/_chunks/{watch-e09a4a66.js.map → watch-f6cf9246.js.map} +1 -1
  17. package/dist/_chunks/{watchAction-c64a95c7.js → watchAction-4cf253a0.js} +5 -38
  18. package/dist/_chunks/{watchAction-c64a95c7.js.map → watchAction-4cf253a0.js.map} +1 -1
  19. package/dist/cli.js +3 -6
  20. package/dist/cli.js.map +1 -1
  21. package/dist/index.esm.js +56 -396
  22. package/dist/index.esm.js.map +1 -1
  23. package/dist/index.js +5 -43
  24. package/dist/index.js.map +1 -1
  25. package/package.json +3 -1
  26. package/src/node/_tasks/dts/_doExtract.ts +2 -8
  27. package/src/node/_tasks/dts/_extractModuleBlocks.ts +45 -0
  28. package/src/node/_tasks/dts/_extractTypes.ts +11 -1
  29. package/dist/_chunks/index-68bcc7e2.js.map +0 -1
  30. package/src/node/_tasks/dts/_declareModuleFix.ts +0 -98
@@ -1,22 +1,17 @@
1
1
  'use strict';
2
2
 
3
3
  var chalk = require('chalk');
4
-
5
4
  function _interopDefaultLegacy(e) {
6
5
  return e && typeof e === 'object' && 'default' in e ? e : {
7
6
  'default': e
8
7
  };
9
8
  }
10
-
11
9
  var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
12
-
13
10
  function _handleError(err) {
14
11
  if (err instanceof Error) {
15
12
  console.error(chalk__default["default"].red("error"), err.message);
16
13
  }
17
-
18
14
  process.exit(1);
19
15
  }
20
-
21
16
  exports._handleError = _handleError;
22
17
  //# sourceMappingURL=_handleError-869dec25.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_handleError-869dec25.js","sources":["../../src/cli/_handleError.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport chalk from 'chalk'\n\nexport function _handleError(err: unknown): void {\n if (err instanceof Error) {\n console.error(chalk.red('error'), err.message)\n }\n\n process.exit(1)\n}\n"],"names":["_handleError","err","Error","console","error","chalk","red","message","process","exit"],"mappings":";;;;;;;;;;;;AACO,SAASA,YAAT,CAAsBC,GAAtB,EAA2B;EAChC,IAAIA,GAAG,YAAYC,KAAnB,EAA0B;IACxBC,OAAO,CAACC,KAAR,CAAcC,yBAAAA,CAAMC,GAAND,CAAU,OAAVA,CAAd,EAAkCJ,GAAG,CAACM,OAAtC;EACD;;EACDC,OAAO,CAACC,IAAR,CAAa,CAAb;AACF;;"}
1
+ {"version":3,"file":"_handleError-869dec25.js","sources":["../../src/cli/_handleError.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport chalk from 'chalk'\n\nexport function _handleError(err: unknown): void {\n if (err instanceof Error) {\n console.error(chalk.red('error'), err.message)\n }\n\n process.exit(1)\n}\n"],"names":["_handleError","err","Error","console","error","chalk","red","message","process","exit"],"mappings":";;;;;;;;;AACO,SAASA,YAAY,CAACC,GAAG,EAAE;EAChC,IAAIA,GAAG,YAAYC,KAAK,EAAE;IACxBC,OAAO,CAACC,KAAK,CAACC,yBAAK,CAACC,GAAG,CAAC,OAAO,CAAC,EAAEL,GAAG,CAACM,OAAO,CAAC;EAC/C;EACDC,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;AACjB;"}
@@ -1,55 +1,32 @@
1
1
  'use strict';
2
2
 
3
3
  const _excluded = ["_path"];
4
-
5
4
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
-
7
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
-
9
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
8
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
-
15
9
  var path = require('path');
16
-
17
10
  var node = require('esbuild-register/dist/node');
18
-
19
11
  var pkgUp = require('pkg-up');
20
-
21
12
  var fs = require('fs/promises');
22
-
23
13
  var findConfig = require('find-config');
24
-
25
14
  var chalk = require('chalk');
26
-
27
15
  var zod = require('zod');
28
-
29
16
  var ts = require('typescript');
30
-
31
17
  var browserslist = require('browserslist');
32
-
33
18
  function _interopDefaultLegacy(e) {
34
19
  return e && typeof e === 'object' && 'default' in e ? e : {
35
20
  'default': e
36
21
  };
37
22
  }
38
-
39
23
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
40
-
41
24
  var pkgUp__default = /*#__PURE__*/_interopDefaultLegacy(pkgUp);
42
-
43
25
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
44
-
45
26
  var findConfig__default = /*#__PURE__*/_interopDefaultLegacy(findConfig);
46
-
47
27
  var chalk__default = /*#__PURE__*/_interopDefaultLegacy(chalk);
48
-
49
28
  var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
50
-
51
29
  var browserslist__default = /*#__PURE__*/_interopDefaultLegacy(browserslist);
52
-
53
30
  const _MODULE_EXT = {
54
31
  commonjs: {
55
32
  commonjs: ".js",
@@ -63,32 +40,25 @@ const _MODULE_EXT = {
63
40
  const _DEFAULTS = {
64
41
  browserslist: ["> 0.2% and supports es6-module and supports es6-module-dynamic-import", "not dead", "not IE 11", "maintained node versions"]
65
42
  };
66
-
67
43
  function _isRecord(value) {
68
44
  return Boolean(value) && !Array.isArray(value) && typeof value === "object";
69
45
  }
70
-
71
46
  const CONFIG_FILE_NAMES = ["package.config.ts", "package.config.js", "package.config.cjs", "package.config.mjs"];
72
-
73
47
  async function _findConfigFile(cwd) {
74
48
  const pkgJsonPath = findConfig__default["default"]("package.json", {
75
49
  cwd
76
50
  });
77
51
  if (!pkgJsonPath) return void 0;
78
52
  const pkgPath = path__default["default"].dirname(pkgJsonPath);
79
-
80
53
  for (const fileName of CONFIG_FILE_NAMES) {
81
54
  const configPath = path__default["default"].resolve(pkgPath, fileName);
82
55
  const exists = await _fileExists(configPath);
83
-
84
56
  if (exists) {
85
57
  return configPath;
86
58
  }
87
59
  }
88
-
89
60
  return void 0;
90
61
  }
91
-
92
62
  async function _fileExists(filePath) {
93
63
  try {
94
64
  await fs.stat(filePath);
@@ -97,7 +67,6 @@ async function _fileExists(filePath) {
97
67
  return false;
98
68
  }
99
69
  }
100
-
101
70
  async function _loadConfig(options) {
102
71
  const {
103
72
  cwd
@@ -108,41 +77,32 @@ async function _loadConfig(options) {
108
77
  if (!pkgPath) return void 0;
109
78
  const root = path__default["default"].dirname(pkgPath);
110
79
  const configFile = await _findConfigFile(root);
111
-
112
80
  if (!configFile) {
113
81
  return void 0;
114
82
  }
115
-
116
83
  if (!configFile.startsWith(cwd)) {
117
84
  return void 0;
118
85
  }
119
-
120
86
  try {
121
87
  const {
122
88
  unregister
123
89
  } = node.register({
124
90
  extensions: [".js", ".mjs", ".ts"]
125
91
  });
126
-
127
92
  const mod = require(configFile);
128
-
129
93
  unregister();
130
94
  return (mod == null ? void 0 : mod.default) || mod || void 0;
131
95
  } catch (_) {
132
96
  return void 0;
133
97
  }
134
98
  }
135
-
136
99
  function _resolveConfigProperty(prop, initialValue) {
137
100
  if (!prop) return initialValue;
138
-
139
101
  if (typeof prop === "function") {
140
102
  return prop(initialValue);
141
103
  }
142
-
143
104
  return prop;
144
105
  }
145
-
146
106
  const pkgSchema = zod.z.object({
147
107
  type: zod.z.optional(zod.z.enum(["commonjs", "module"])),
148
108
  name: zod.z.string(),
@@ -176,14 +136,12 @@ const pkgSchema = zod.z.object({
176
136
  })]))),
177
137
  browserslist: zod.z.optional(zod.z.array(zod.z.string()))
178
138
  });
179
-
180
139
  function _validatePkg(input) {
181
140
  const pkg = pkgSchema.parse(input);
182
141
  return _objectSpread(_objectSpread({}, pkg), {}, {
183
142
  type: pkg.type || "commonjs"
184
143
  });
185
144
  }
186
-
187
145
  async function _loadPkg(options) {
188
146
  const {
189
147
  cwd
@@ -195,7 +153,6 @@ async function _loadPkg(options) {
195
153
  const buf = await fs__default["default"].readFile(pkgPath);
196
154
  return _validatePkg(JSON.parse(buf.toString()));
197
155
  }
198
-
199
156
  async function _loadPkgWithReporting(options) {
200
157
  try {
201
158
  return await _loadPkg(options);
@@ -209,47 +166,37 @@ async function _loadPkgWithReporting(options) {
209
166
  } else {
210
167
  console.error(err);
211
168
  }
212
-
213
169
  process.exit(1);
214
170
  }
215
171
  }
216
-
217
172
  function _formatPath(segments) {
218
173
  return segments.map((s, idx) => {
219
174
  if (idx === 0) return s;
220
-
221
175
  if (typeof s === "number") {
222
176
  return "[".concat(s, "]");
223
177
  }
224
-
225
178
  if (s.startsWith(".")) {
226
179
  return "[\"".concat(s, "\"]");
227
180
  }
228
-
229
181
  return ".".concat(s);
230
182
  }).join("");
231
183
  }
232
-
233
184
  function _validateExports(_exports, options) {
234
185
  const {
235
186
  pkg
236
187
  } = options;
237
188
  const ext = _MODULE_EXT[pkg.type];
238
189
  const errors = [];
239
-
240
190
  for (const exp of _exports) {
241
191
  if (exp.require && !exp.require.endsWith(ext.commonjs)) {
242
192
  errors.push("package.json with `type: \"".concat(pkg.type, "\"` - `exports[\"").concat(exp._path, "\"].require` must end with \"").concat(ext.commonjs, "\""));
243
193
  }
244
-
245
194
  if (exp.import && !exp.import.endsWith(ext.esm)) {
246
195
  errors.push("package.json with `type: \"".concat(pkg.type, "\"` - `exports[\"").concat(exp._path, "\"].import` must end with \"").concat(ext.esm, "\""));
247
196
  }
248
197
  }
249
-
250
198
  return errors;
251
199
  }
252
-
253
200
  function _parseExports(options) {
254
201
  const {
255
202
  pkg,
@@ -271,12 +218,10 @@ function _parseExports(options) {
271
218
  };
272
219
  const extraExports = [];
273
220
  const errors = [];
274
-
275
221
  if (pkg.exports) {
276
222
  if (strict && !pkg.exports["./package.json"]) {
277
223
  errors.push('package.json: `exports["./package.json"] must be declared.');
278
224
  }
279
-
280
225
  for (const [exportPath, exportEntry] of Object.entries(pkg.exports)) {
281
226
  if (exportPath.endsWith(".json")) {
282
227
  if (exportPath === "./package.json") {
@@ -289,26 +234,21 @@ function _parseExports(options) {
289
234
  if (exportEntry.require && rootExport.require && exportEntry.require !== rootExport.require) {
290
235
  errors.push('package.json: mismatch between "main" and "exports.require". These must be equal.');
291
236
  }
292
-
293
237
  if (exportEntry.import && rootExport.import && exportEntry.import !== rootExport.import) {
294
238
  errors.push('package.json: mismatch between "module" and "exports.import" These must be equal.');
295
239
  }
296
-
297
240
  if (exportEntry.types && rootExport.types && exportEntry.types !== rootExport.types) {
298
241
  errors.push('package.json: mismatch between "types" and "exports.types". These must be equal.');
299
242
  }
300
-
301
243
  if (exportEntry.source && rootExport.source && exportEntry.source !== rootExport.source) {
302
244
  errors.push('package.json: mismatch between "source" and "exports.source". These must be equal.');
303
245
  }
304
-
305
246
  Object.assign(rootExport, exportEntry);
306
247
  } else {
307
248
  const extraExport = _objectSpread({
308
249
  _exported: true,
309
250
  _path: exportPath
310
251
  }, exportEntry);
311
-
312
252
  extraExports.push(extraExport);
313
253
  }
314
254
  } else {
@@ -316,74 +256,57 @@ function _parseExports(options) {
316
256
  }
317
257
  }
318
258
  }
319
-
320
259
  const _exports = [rootExport, ...extraExports];
321
260
  errors.push(..._validateExports(_exports, {
322
261
  pkg
323
262
  }));
324
-
325
263
  if (errors.length) {
326
264
  throw new Error("\n- " + errors.join("\n- "));
327
265
  }
328
-
329
266
  return _exports;
330
267
  }
331
-
332
268
  async function _loadTSConfig(options) {
333
269
  const {
334
270
  cwd,
335
271
  tsconfigPath
336
272
  } = options;
337
273
  const configPath = ts__default["default"].findConfigFile(cwd, ts__default["default"].sys.fileExists, tsconfigPath);
338
-
339
274
  if (!configPath) {
340
275
  throw new Error("could not find a valid '".concat(tsconfigPath, "'"));
341
276
  }
342
-
343
277
  const configFile = ts__default["default"].readConfigFile(configPath, ts__default["default"].sys.readFile);
344
278
  return ts__default["default"].parseJsonConfigFileContent(configFile.config, ts__default["default"].sys, cwd);
345
279
  }
346
-
347
280
  function _pathContains(containerPath, itemPath) {
348
281
  return !path__default["default"].relative(containerPath, itemPath).startsWith("..");
349
282
  }
350
-
351
283
  function _findCommonDirPath(filePaths) {
352
284
  let ret = void 0;
353
-
354
285
  for (const filePath of filePaths) {
355
286
  let dirPath = path__default["default"].dirname(filePath);
356
-
357
287
  if (!ret) {
358
288
  ret = dirPath;
359
289
  continue;
360
290
  }
361
-
362
291
  while (dirPath !== ret) {
363
292
  dirPath = path__default["default"].dirname(dirPath);
364
-
365
293
  if (dirPath === ret) {
366
294
  break;
367
295
  }
368
-
369
296
  if (_pathContains(dirPath, ret)) {
370
297
  ret = dirPath;
371
298
  break;
372
299
  }
373
-
374
300
  if (dirPath === ".") return void 0;
375
301
  }
376
302
  }
377
-
378
303
  return ret;
379
304
  }
380
-
381
305
  function _sortAsNumber(a, b) {
382
306
  const aVersion = Number(a);
383
307
  const bVersion = Number(b);
384
308
  return aVersion - bVersion;
385
309
  }
386
-
387
310
  function _resolveBrowserslistVersions(query) {
388
311
  const result = browserslist__default["default"](query);
389
312
  const entries = result.map(key => {
@@ -420,55 +343,41 @@ function _resolveBrowserslistVersions(query) {
420
343
  versions.node.sort(_sortAsNumber);
421
344
  return versions;
422
345
  }
423
-
424
346
  function _resolveBrowserTarget(versions) {
425
347
  const target = [];
426
-
427
348
  if (versions.chrome.length) {
428
349
  target.push("chrome".concat(versions.chrome[0]));
429
350
  }
430
-
431
351
  if (versions.ff.length) {
432
352
  target.push("firefox".concat(versions.ff[0]));
433
353
  }
434
-
435
354
  if (versions.edge.length) {
436
355
  target.push("edge".concat(versions.edge[0]));
437
356
  }
438
-
439
357
  if (versions.iosSaf.length) {
440
358
  target.push("ios".concat(versions.iosSaf[0]));
441
359
  }
442
-
443
360
  if (versions.saf.length) {
444
361
  target.push("safari".concat(versions.saf[0]));
445
362
  }
446
-
447
363
  if (versions.opera.length) {
448
364
  target.push("opera".concat(versions.opera[0]));
449
365
  }
450
-
451
366
  if (target.length === 0) {
452
367
  return void 0;
453
368
  }
454
-
455
369
  return target;
456
370
  }
457
-
458
371
  function _resolveNodeTarget(versions) {
459
372
  const target = [];
460
-
461
373
  if (versions.node.length) {
462
374
  target.push("node".concat(versions.node[0]));
463
375
  }
464
-
465
376
  if (target.length === 0) {
466
377
  return void 0;
467
378
  }
468
-
469
379
  return target;
470
380
  }
471
-
472
381
  function _createLogger() {
473
382
  return {
474
383
  log: function () {
@@ -478,36 +387,30 @@ function _createLogger() {
478
387
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
479
388
  args[_key] = arguments[_key];
480
389
  }
481
-
482
390
  console.log(chalk__default["default"].blue(" info"), ...args);
483
391
  },
484
392
  warn: function () {
485
393
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
486
394
  args[_key2] = arguments[_key2];
487
395
  }
488
-
489
396
  console.log(chalk__default["default"].yellow(" warn"), ...args);
490
397
  },
491
398
  error: function () {
492
399
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
493
400
  args[_key3] = arguments[_key3];
494
401
  }
495
-
496
402
  console.log(chalk__default["default"].red(" fail"), ...args);
497
403
  },
498
404
  success: function () {
499
405
  for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
500
406
  args[_key4] = arguments[_key4];
501
407
  }
502
-
503
408
  console.log(chalk__default["default"].green(" ok "), ...args);
504
409
  }
505
410
  };
506
411
  }
507
-
508
412
  async function _resolveBuildContext(options) {
509
413
  var _ref;
510
-
511
414
  const {
512
415
  config,
513
416
  cwd,
@@ -516,81 +419,60 @@ async function _resolveBuildContext(options) {
516
419
  strict,
517
420
  tsconfig: tsconfigPath
518
421
  } = options;
519
-
520
422
  const logger = _createLogger();
521
-
522
423
  const tsconfig = await _loadTSConfig({
523
424
  cwd,
524
425
  tsconfigPath
525
426
  });
526
-
527
427
  const targetVersions = _resolveBrowserslistVersions(pkg.browserslist || _DEFAULTS.browserslist);
528
-
529
428
  const nodeTarget = _resolveNodeTarget(targetVersions);
530
-
531
429
  const webTarget = _resolveBrowserTarget(targetVersions);
532
-
533
430
  if (!nodeTarget) {
534
431
  throw new Error("no matching `node` target");
535
432
  }
536
-
537
433
  if (!webTarget) {
538
434
  throw new Error("no matching `web` target");
539
435
  }
540
-
541
436
  const target = {
542
437
  "*": webTarget.concat(nodeTarget),
543
438
  browser: webTarget,
544
439
  node: nodeTarget
545
440
  };
546
-
547
441
  const parsedExports = _parseExports({
548
442
  pkg,
549
443
  strict
550
444
  }).reduce((acc, x) => {
551
445
  const {
552
- _path: exportPath
553
- } = x,
554
- exportEntry = _objectWithoutProperties(x, _excluded);
555
-
446
+ _path: exportPath
447
+ } = x,
448
+ exportEntry = _objectWithoutProperties(x, _excluded);
556
449
  return _objectSpread(_objectSpread({}, acc), {}, {
557
450
  [exportPath]: exportEntry
558
451
  });
559
452
  }, {});
560
-
561
453
  const exports = _resolveConfigProperty(config == null ? void 0 : config.exports, parsedExports);
562
-
563
454
  const parsedExternal = [...(pkg.dependencies ? Object.keys(pkg.dependencies) : []), ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [])];
564
455
  const external = config && Array.isArray(config.external) ? [...parsedExternal, ...config.external] : _resolveConfigProperty(config == null ? void 0 : config.external, parsedExternal);
565
456
  const outputPaths = Object.values(exports).flatMap(exportEntry => {
566
457
  var _a, _b, _c, _d;
567
-
568
458
  return [exportEntry.import, exportEntry.require, (_a = exportEntry.browser) == null ? void 0 : _a.import, (_b = exportEntry.browser) == null ? void 0 : _b.require, (_c = exportEntry.node) == null ? void 0 : _c.import, (_d = exportEntry.node) == null ? void 0 : _d.require].filter(Boolean);
569
459
  }).map(p => path__default["default"].resolve(cwd, p));
570
-
571
460
  const commonDistPath = _findCommonDirPath(outputPaths);
572
-
573
461
  if (commonDistPath === cwd) {
574
462
  throw new Error("all output files must share a common parent directory which is not the root package directory");
575
463
  }
576
-
577
464
  if (commonDistPath && !_pathContains(cwd, commonDistPath)) {
578
465
  throw new Error("all output files must be located within the package");
579
466
  }
580
-
581
467
  const configDistPath = (config == null ? void 0 : config.dist) ? path__default["default"].resolve(cwd, config.dist) : void 0;
582
-
583
468
  if (configDistPath && commonDistPath && configDistPath !== commonDistPath && !_pathContains(configDistPath, commonDistPath)) {
584
469
  logger.log("did you mean to configure `dist: './".concat(path__default["default"].relative(cwd, commonDistPath), "'`?"));
585
470
  throw new Error("all output files must be located with the configured `dist` path");
586
471
  }
587
-
588
472
  const distPath = configDistPath || commonDistPath;
589
-
590
473
  if (!distPath) {
591
474
  throw new Error("could not detect `dist` path");
592
475
  }
593
-
594
476
  const ctx = {
595
477
  config,
596
478
  cwd,
@@ -611,7 +493,6 @@ async function _resolveBuildContext(options) {
611
493
  };
612
494
  return ctx;
613
495
  }
614
-
615
496
  exports._DEFAULTS = _DEFAULTS;
616
497
  exports._MODULE_EXT = _MODULE_EXT;
617
498
  exports._isRecord = _isRecord;