@sanity/pkg-utils 2.1.0 → 2.2.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 (33) hide show
  1. package/dist/_chunks/{build-2a47293b.cjs → build-8d840bfe.cjs} +7 -11
  2. package/dist/_chunks/{build-2a47293b.cjs.map → build-8d840bfe.cjs.map} +1 -1
  3. package/dist/_chunks/{buildAction-404437e8.cjs → buildAction-02b78976.cjs} +2 -2
  4. package/dist/_chunks/{buildAction-404437e8.cjs.map → buildAction-02b78976.cjs.map} +1 -1
  5. package/dist/_chunks/{check-3bf5eb0d.cjs → check-37772bb3.cjs} +12 -11
  6. package/dist/_chunks/check-37772bb3.cjs.map +1 -0
  7. package/dist/_chunks/{checkAction-fcfe53a1.cjs → checkAction-59707d6a.cjs} +2 -2
  8. package/dist/_chunks/{checkAction-fcfe53a1.cjs.map → checkAction-59707d6a.cjs.map} +1 -1
  9. package/dist/_chunks/{index-58e287aa.cjs → index-49daefad.cjs} +52 -41
  10. package/dist/_chunks/index-49daefad.cjs.map +1 -0
  11. package/dist/_chunks/{resolveBuildContext-86a1602c.cjs → resolveBuildContext-c51eac50.cjs} +64 -23
  12. package/dist/_chunks/resolveBuildContext-c51eac50.cjs.map +1 -0
  13. package/dist/_chunks/{watch-86ed07a5.cjs → watch-6cfbe78a.cjs} +7 -11
  14. package/dist/_chunks/{watch-86ed07a5.cjs.map → watch-6cfbe78a.cjs.map} +1 -1
  15. package/dist/_chunks/{watchAction-b72906aa.cjs → watchAction-de3c9fdf.cjs} +2 -2
  16. package/dist/_chunks/{watchAction-b72906aa.cjs.map → watchAction-de3c9fdf.cjs.map} +1 -1
  17. package/dist/cli.cjs +4 -4
  18. package/dist/index.cjs +5 -5
  19. package/dist/index.d.ts +5 -0
  20. package/dist/index.js +131 -71
  21. package/dist/index.js.map +1 -1
  22. package/package.json +6 -6
  23. package/src/node/core/config/types.ts +5 -0
  24. package/src/node/core/pkg/helpers.ts +36 -0
  25. package/src/node/core/pkg/loadPkg.ts +5 -1
  26. package/src/node/core/pkg/loadPkgWithReporting.ts +38 -2
  27. package/src/node/core/pkg/parseExports.ts +1 -1
  28. package/src/node/core/pkg/validatePkg.ts +1 -1
  29. package/src/node/printPackageTree.ts +12 -8
  30. package/src/node/tasks/rollup/resolveRollupConfig.ts +1 -1
  31. package/dist/_chunks/check-3bf5eb0d.cjs.map +0 -1
  32. package/dist/_chunks/index-58e287aa.cjs.map +0 -1
  33. package/dist/_chunks/resolveBuildContext-86a1602c.cjs.map +0 -1
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.1.0";
10
+ var version = "2.2.0";
11
11
  const cli = cac__default.default();
12
12
  cli.command("", "Check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async options => {
13
13
  const {
14
14
  checkAction: statusAction
15
15
  } = await Promise.resolve().then(function () {
16
- return require('./_chunks/checkAction-fcfe53a1.cjs');
16
+ return require('./_chunks/checkAction-59707d6a.cjs');
17
17
  });
18
18
  return statusAction(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-404437e8.cjs');
24
+ return require('./_chunks/buildAction-02b78976.cjs');
25
25
  });
26
26
  return buildAction(options);
27
27
  });
@@ -29,7 +29,7 @@ cli.command("watch", "Watch package").option("--strict", "Strict mode").option("
29
29
  const {
30
30
  watchAction
31
31
  } = await Promise.resolve().then(function () {
32
- return require('./_chunks/watchAction-b72906aa.cjs');
32
+ return require('./_chunks/watchAction-de3c9fdf.cjs');
33
33
  });
34
34
  return watchAction(options);
35
35
  });
package/dist/index.cjs CHANGED
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', {
4
4
  value: true
5
5
  });
6
- var build = require('./_chunks/build-2a47293b.cjs');
7
- var check = require('./_chunks/check-3bf5eb0d.cjs');
8
- var resolveBuildContext = require('./_chunks/resolveBuildContext-86a1602c.cjs');
9
- var index = require('./_chunks/index-58e287aa.cjs');
10
- var watch = require('./_chunks/watch-86ed07a5.cjs');
6
+ var build = require('./_chunks/build-8d840bfe.cjs');
7
+ var check = require('./_chunks/check-37772bb3.cjs');
8
+ var resolveBuildContext = require('./_chunks/resolveBuildContext-c51eac50.cjs');
9
+ var index = require('./_chunks/index-49daefad.cjs');
10
+ var watch = require('./_chunks/watch-6cfbe78a.cjs');
11
11
  function defineConfig(configOptions) {
12
12
  return configOptions;
13
13
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {ExtractorMessage} from '@microsoft/api-extractor'
2
2
  import {IExtractorMessagesConfig} from '@microsoft/api-extractor'
3
3
  import {Observable} from 'rxjs'
4
+ import {PluginItem} from '@babel/core'
4
5
  import {Plugin as RollupPlugin} from 'rollup'
5
6
  import {RollupWatcherEvent} from 'rollup'
6
7
  import ts from 'typescript'
@@ -234,6 +235,10 @@ export declare interface PkgBundle {
234
235
 
235
236
  /** @public */
236
237
  export declare interface PkgConfigOptions {
238
+ /** @alpha */
239
+ babel?: {
240
+ plugins?: PluginItem[] | null | undefined
241
+ }
237
242
  bundles?: PkgBundle[]
238
243
  /** @alpha */
239
244
  define?: Record<string, string | number | boolean | undefined | null>
package/dist/index.js CHANGED
@@ -1,11 +1,3 @@
1
- const _excluded = ["_path"];
2
- 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; }
3
- 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; }
4
- 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; }
5
- 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; }
6
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
1
  import path from 'path';
10
2
  import { register } from 'esbuild-register/dist/node';
11
3
  import pkgUp from 'pkg-up';
@@ -124,6 +116,7 @@ const pkgSchema = z.object({
124
116
  exports: z.optional(z.record(z.union([z.custom(val => /^\.\/.*\.json$/.test(val)), z.object({
125
117
  types: z.optional(z.string()),
126
118
  source: z.string(),
119
+ require: z.optional(z.string()),
127
120
  browser: z.optional(z.object({
128
121
  source: z.string(),
129
122
  require: z.optional(z.string()),
@@ -134,7 +127,6 @@ const pkgSchema = z.object({
134
127
  require: z.optional(z.string()),
135
128
  import: z.optional(z.string())
136
129
  })),
137
- require: z.optional(z.string()),
138
130
  import: z.optional(z.string()),
139
131
  default: z.string()
140
132
  })]))),
@@ -152,7 +144,31 @@ async function loadPkg(options) {
152
144
  });
153
145
  if (!pkgPath) throw new Error("no package.json found");
154
146
  const buf = await fs.readFile(pkgPath);
155
- return validatePkg(JSON.parse(buf.toString()));
147
+ const raw = JSON.parse(buf.toString());
148
+ validatePkg(raw);
149
+ return raw;
150
+ }
151
+ function assertFirst(a, arr) {
152
+ const aIdx = arr.indexOf(a);
153
+ if (aIdx === -1) {
154
+ return true;
155
+ }
156
+ return aIdx === 0;
157
+ }
158
+ function assertLast(a, arr) {
159
+ const aIdx = arr.indexOf(a);
160
+ if (aIdx === -1) {
161
+ return true;
162
+ }
163
+ return aIdx === arr.length - 1;
164
+ }
165
+ function assertOrder(a, b, arr) {
166
+ const aIdx = arr.indexOf(a);
167
+ const bIdx = arr.indexOf(b);
168
+ if (aIdx === -1 || bIdx === -1) {
169
+ return true;
170
+ }
171
+ return aIdx < bIdx;
156
172
  }
157
173
  async function loadPkgWithReporting(options) {
158
174
  const {
@@ -163,8 +179,29 @@ async function loadPkgWithReporting(options) {
163
179
  const pkg = await loadPkg({
164
180
  cwd
165
181
  });
166
- if (pkg.type === void 0) {
167
- logger.warn('no "type" field in package.json, defaulting to "commonjs"');
182
+ if (pkg.exports) {
183
+ const _exports = Object.entries(pkg.exports);
184
+ for (const [expPath, exp] of _exports) {
185
+ if (typeof exp === "string") {
186
+ continue;
187
+ }
188
+ const keys = Object.keys(exp);
189
+ if (!assertFirst("types", keys)) {
190
+ logger.warn("exports[\"".concat(expPath, "\"]: the `types` property should be the first property"));
191
+ }
192
+ if (!assertOrder("require", "import", keys)) {
193
+ logger.warn("exports[\"".concat(expPath, "\"]: the `require` property should come before the `import` property"));
194
+ }
195
+ if (!assertOrder("require", "node", keys)) {
196
+ logger.warn("exports[\"".concat(expPath, "\"]: the `require` property should come before the `node` property"));
197
+ }
198
+ if (!assertOrder("node", "import", keys)) {
199
+ logger.warn("exports[\"".concat(expPath, "\"]: the `node` property should come before `import` property"));
200
+ }
201
+ if (!assertLast("default", keys)) {
202
+ logger.warn("exports[\"".concat(expPath, "\"]: the `default` property should be the last property"));
203
+ }
204
+ }
168
205
  }
169
206
  return pkg;
170
207
  } catch (err) {
@@ -227,8 +264,8 @@ function parseExports(options) {
227
264
  require: pkg.main && pkg.browser[pkg.main],
228
265
  import: pkg.module && pkg.browser[pkg.module]
229
266
  },
230
- import: pkg.module,
231
267
  require: pkg.main,
268
+ import: pkg.module,
232
269
  default: pkg.module || pkg.main || ""
233
270
  };
234
271
  const extraExports = [];
@@ -260,10 +297,11 @@ function parseExports(options) {
260
297
  }
261
298
  Object.assign(rootExport, exportEntry);
262
299
  } else {
263
- const extraExport = _objectSpread({
300
+ const extraExport = {
264
301
  _exported: true,
265
- _path: exportPath
266
- }, exportEntry);
302
+ _path: exportPath,
303
+ ...exportEntry
304
+ };
267
305
  extraExports.push(extraExport);
268
306
  }
269
307
  } else {
@@ -295,7 +333,9 @@ function getPkgExtMap(options) {
295
333
  const {
296
334
  legacyExports
297
335
  } = options;
298
- const ret = _objectSpread({}, DEFAULT_PKG_EXT_MAP);
336
+ const ret = {
337
+ ...DEFAULT_PKG_EXT_MAP
338
+ };
299
339
  if (legacyExports) {
300
340
  ret["commonjs"] = {
301
341
  commonjs: ".js",
@@ -484,12 +524,13 @@ async function resolveBuildContext(options) {
484
524
  strict
485
525
  }).reduce((acc, x) => {
486
526
  const {
487
- _path: exportPath
488
- } = x,
489
- exportEntry = _objectWithoutProperties(x, _excluded);
490
- return _objectSpread(_objectSpread({}, acc), {}, {
527
+ _path: exportPath,
528
+ ...exportEntry
529
+ } = x;
530
+ return {
531
+ ...acc,
491
532
  [exportPath]: exportEntry
492
- });
533
+ };
493
534
  }, {});
494
535
  const exports = resolveConfigProperty(config == null ? void 0 : config.exports, parsedExports);
495
536
  const parsedExternal = [...(pkg.dependencies ? Object.keys(pkg.dependencies) : []), ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [])];
@@ -547,9 +588,10 @@ function resolveBuildTasks(ctx) {
547
588
  const tasks = [];
548
589
  const exports = Object.entries(ctx.exports || {}).map(_ref2 => {
549
590
  let [_path, exp] = _ref2;
550
- return _objectSpread({
551
- _path
552
- }, exp);
591
+ return {
592
+ _path,
593
+ ...exp
594
+ };
553
595
  });
554
596
  const dtsTask = {
555
597
  type: "build:dts",
@@ -747,13 +789,14 @@ async function buildTypes(options) {
747
789
  tsconfig,
748
790
  strict = false
749
791
  } = options;
750
- const compilerOptions = _objectSpread(_objectSpread({}, tsconfig.options), {}, {
792
+ const compilerOptions = {
793
+ ...tsconfig.options,
751
794
  declaration: true,
752
795
  declarationDir: outDir,
753
796
  emitDeclarationOnly: true,
754
797
  noEmit: false,
755
798
  outDir
756
- });
799
+ };
757
800
  const program = ts.createProgram(tsconfig.fileNames, compilerOptions);
758
801
  const emitResult = program.emit();
759
802
  const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
@@ -827,15 +870,18 @@ async function createTSDocConfig(opts) {
827
870
  syntaxKind: t.syntaxKind,
828
871
  allowMultiple: t.allowMultiple
829
872
  })));
830
- const supportForTags = _objectSpread({}, tsDocBaseConfig.supportForTags);
873
+ const supportForTags = {
874
+ ...tsDocBaseConfig.supportForTags
875
+ };
831
876
  for (const customTag of customTags) {
832
877
  supportForTags["@".concat(customTag.name)] = true;
833
878
  }
834
- return TSDocConfigFile.loadFromObject(_objectSpread(_objectSpread({}, tsDocBaseConfig), {}, {
879
+ return TSDocConfigFile.loadFromObject({
880
+ ...tsDocBaseConfig,
835
881
  noStandardTags: false,
836
882
  tagDefinitions,
837
883
  supportForTags
838
- }));
884
+ });
839
885
  }
840
886
  async function extractModuleBlocksFromTypes(_ref3) {
841
887
  let {
@@ -975,9 +1021,10 @@ async function extractTypes(options) {
975
1021
  tsOutDir: tmpPath
976
1022
  });
977
1023
  const code = [typesBuf.toString(), ...moduleBlocks].join("\n\n");
978
- await fs.writeFile(typesPath, prettier.format(code, _objectSpread(_objectSpread({}, prettierConfig), {}, {
1024
+ await fs.writeFile(typesPath, prettier.format(code, {
1025
+ ...prettierConfig,
979
1026
  filepath: typesPath
980
- })));
1027
+ }));
981
1028
  files.push({
982
1029
  type: "types",
983
1030
  path: typesPath
@@ -1189,7 +1236,7 @@ function createConsoleSpy(options) {
1189
1236
  }
1190
1237
  function resolveRollupConfig(ctx, buildTask) {
1191
1238
  var _ref4, _ref7, _ref8, _ref9, _ref10, _ref11;
1192
- var _a, _b, _c;
1239
+ var _a, _b, _c, _d;
1193
1240
  const {
1194
1241
  format,
1195
1242
  runtime,
@@ -1215,9 +1262,10 @@ function resolveRollupConfig(ctx, buildTask) {
1215
1262
  return [key, path.resolve(cwd, ((_a2 = ts.config) == null ? void 0 : _a2.options.baseUrl) || ".", val[0])];
1216
1263
  }));
1217
1264
  const entries = buildTask.entries.map(entry => {
1218
- return _objectSpread(_objectSpread({}, entry), {}, {
1265
+ return {
1266
+ ...entry,
1219
1267
  name: path.relative(outDir, entry.output).replace(/\.[^/.]+$/, "")
1220
- });
1268
+ };
1221
1269
  }, {});
1222
1270
  const exportIds = _exports && Object.keys(_exports).map(exportPath => path.join(pkg.name, exportPath));
1223
1271
  const sourcePaths = _exports && Object.values(_exports).map(e => path.resolve(cwd, e.source));
@@ -1227,22 +1275,29 @@ function resolveRollupConfig(ctx, buildTask) {
1227
1275
  }));
1228
1276
  const defaultPlugins = [replace({
1229
1277
  preventAssignment: true,
1230
- values: _objectSpread({}, pkg.name === "@sanity/pkg-utils" ? _objectSpread({}, replacements) : _objectSpread({
1231
- "process.env.PKG_FILE_PATH": arg => {
1232
- const sourcePath = "./" + path.relative(cwd, arg);
1233
- const entry = entries.find(e => e.source === sourcePath);
1234
- if (!entry) {
1235
- console.error("could not find source entry: ".concat(sourcePath));
1236
- return "null";
1237
- }
1238
- return JSON.stringify(path.relative(cwd, path.resolve(outDir, entry.name + outputExt)));
1239
- },
1240
- "process.env.PKG_FORMAT": JSON.stringify(format),
1241
- "process.env.PKG_RUNTIME": JSON.stringify(runtime),
1242
- "process.env.PKG_VERSION": JSON.stringify(process.env.PKG_VERSION || pkg.version)
1243
- }, replacements))
1278
+ values: {
1279
+ ...(pkg.name === "@sanity/pkg-utils" ? {
1280
+ ...replacements
1281
+ } : {
1282
+ "process.env.PKG_FILE_PATH": arg => {
1283
+ const sourcePath = "./" + path.relative(cwd, arg);
1284
+ const entry = entries.find(e => e.source === sourcePath);
1285
+ if (!entry) {
1286
+ console.error("could not find source entry: ".concat(sourcePath));
1287
+ return "null";
1288
+ }
1289
+ return JSON.stringify(path.relative(cwd, path.resolve(outDir, entry.name + outputExt)));
1290
+ },
1291
+ "process.env.PKG_FORMAT": JSON.stringify(format),
1292
+ "process.env.PKG_RUNTIME": JSON.stringify(runtime),
1293
+ "process.env.PKG_VERSION": JSON.stringify(process.env.PKG_VERSION || pkg.version),
1294
+ ...replacements
1295
+ })
1296
+ }
1244
1297
  }), alias({
1245
- entries: _objectSpread({}, pathAliases)
1298
+ entries: {
1299
+ ...pathAliases
1300
+ }
1246
1301
  }), nodeResolve({
1247
1302
  browser: runtime === "browser",
1248
1303
  extensions: [".cjs", ".mjs", ".js", ".jsx", ".json", ".node"],
@@ -1256,7 +1311,7 @@ function resolveRollupConfig(ctx, buildTask) {
1256
1311
  tsconfig: ctx.ts.configPath || "tsconfig.json"
1257
1312
  }), getBabelOutputPlugin({
1258
1313
  babelrc: false,
1259
- plugins: ["@babel/plugin-proposal-object-rest-spread"],
1314
+ plugins: (_b = config == null ? void 0 : config.babel) == null ? void 0 : _b.plugins,
1260
1315
  presets: [["@babel/preset-env", {
1261
1316
  targets: pkg.browserslist || DEFAULT_BROWSERSLIST_QUERY,
1262
1317
  modules: false
@@ -1276,8 +1331,8 @@ function resolveRollupConfig(ctx, buildTask) {
1276
1331
  }
1277
1332
  }
1278
1333
  })].filter(Boolean);
1279
- const userPlugins = (_b = config == null ? void 0 : config.rollup) == null ? void 0 : _b.plugins;
1280
- const plugins = Array.isArray(userPlugins) ? defaultPlugins.concat(userPlugins) : resolveConfigProperty((_c = config == null ? void 0 : config.rollup) == null ? void 0 : _c.plugins, defaultPlugins);
1334
+ const userPlugins = (_c = config == null ? void 0 : config.rollup) == null ? void 0 : _c.plugins;
1335
+ const plugins = Array.isArray(userPlugins) ? defaultPlugins.concat(userPlugins) : resolveConfigProperty((_d = config == null ? void 0 : config.rollup) == null ? void 0 : _d.plugins, defaultPlugins);
1281
1336
  return {
1282
1337
  inputOptions: {
1283
1338
  context: cwd,
@@ -1300,9 +1355,10 @@ function resolveRollupConfig(ctx, buildTask) {
1300
1355
  return false;
1301
1356
  },
1302
1357
  input: entries.reduce((acc, entry) => {
1303
- return _objectSpread(_objectSpread({}, acc), {}, {
1358
+ return {
1359
+ ...acc,
1304
1360
  [entry.name]: entry.source
1305
- });
1361
+ };
1306
1362
  }, {}),
1307
1363
  plugins,
1308
1364
  treeshake: {
@@ -1387,7 +1443,8 @@ async function execPromise(ctx, task) {
1387
1443
  inputOptions,
1388
1444
  outputOptions
1389
1445
  } = resolveRollupConfig(ctx, task);
1390
- const bundle = await rollup(_objectSpread(_objectSpread({}, inputOptions), {}, {
1446
+ const bundle = await rollup({
1447
+ ...inputOptions,
1391
1448
  onwarn(warning) {
1392
1449
  consoleSpy.messages.push({
1393
1450
  type: "warn",
@@ -1395,7 +1452,7 @@ async function execPromise(ctx, task) {
1395
1452
  args: [warning.message]
1396
1453
  });
1397
1454
  }
1398
- }));
1455
+ });
1399
1456
  const {
1400
1457
  output
1401
1458
  } = await bundle.generate(outputOptions);
@@ -1428,9 +1485,10 @@ const rollupWatchTask = {
1428
1485
  outputOptions
1429
1486
  } = resolveRollupConfig(ctx, task);
1430
1487
  return new Observable(observer => {
1431
- const watchOptions = _objectSpread(_objectSpread({}, inputOptions), {}, {
1488
+ const watchOptions = {
1489
+ ...inputOptions,
1432
1490
  output: outputOptions
1433
- });
1491
+ };
1434
1492
  const watcher = watch$1(watchOptions);
1435
1493
  watcher.on("event", event => {
1436
1494
  observer.next(event);
@@ -1563,9 +1621,10 @@ function printPackageTree(ctx) {
1563
1621
  } = ctx;
1564
1622
  if (!exports) return;
1565
1623
  logger.log("".concat(chalk.blue(pkg.name), "@").concat(chalk.green(pkg.version)));
1566
- const tree = {
1567
- type: chalk.yellow(pkg.type)
1568
- };
1624
+ const tree = {};
1625
+ if (pkg.type) {
1626
+ tree.type = chalk.yellow(pkg.type);
1627
+ }
1569
1628
  if (pkg.bin) {
1570
1629
  tree.bin = Object.fromEntries(Object.entries(pkg.bin).map(_ref13 => {
1571
1630
  let [name, file] = _ref13;
@@ -1588,9 +1647,9 @@ function printPackageTree(ctx) {
1588
1647
  types: void 0,
1589
1648
  source: fileInfo(entry.source),
1590
1649
  browser: void 0,
1650
+ require: void 0,
1591
1651
  node: void 0,
1592
1652
  import: void 0,
1593
- require: void 0,
1594
1653
  default: fileInfo(entry.default)
1595
1654
  };
1596
1655
  if (entry.types) {
@@ -1607,6 +1666,11 @@ function printPackageTree(ctx) {
1607
1666
  } else {
1608
1667
  delete exp.browser;
1609
1668
  }
1669
+ if (entry.require) {
1670
+ exp.require = fileInfo(entry.require);
1671
+ } else {
1672
+ delete exp.require;
1673
+ }
1610
1674
  if (entry.node) {
1611
1675
  exp.node = {};
1612
1676
  if (entry.node.source) exp.node.source = fileInfo(entry.node.source);
@@ -1620,11 +1684,6 @@ function printPackageTree(ctx) {
1620
1684
  } else {
1621
1685
  delete exp.import;
1622
1686
  }
1623
- if (entry.require) {
1624
- exp.require = fileInfo(entry.require);
1625
- } else {
1626
- delete exp.require;
1627
- }
1628
1687
  return [chalk.cyan(path.join(pkg.name, exportPath)), exp];
1629
1688
  }));
1630
1689
  logger.log(treeify.asTree(tree, true, true));
@@ -1759,9 +1818,10 @@ function resolveWatchTasks(ctx) {
1759
1818
  const tasks = [];
1760
1819
  const exports = Object.entries(ctx.exports || {}).map(_ref17 => {
1761
1820
  let [_path, exp] = _ref17;
1762
- return _objectSpread({
1763
- _path
1764
- }, exp);
1821
+ return {
1822
+ _path,
1823
+ ...exp
1824
+ };
1765
1825
  });
1766
1826
  const dtsTask = {
1767
1827
  type: "watch:dts",