@sanity/pkg-utils 7.2.10-canary.0 → 7.2.10-canary.1

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/index.d.ts CHANGED
@@ -3,9 +3,6 @@ import { OptimizeLodashOptions } from "@optimize-lodash/rollup-plugin";
3
3
  import { NormalizedOutputOptions, Plugin, Plugin as RollupPlugin, TreeshakingOptions } from "rollup";
4
4
  import { z } from "zod";
5
5
  import { IExtractorMessagesConfig } from "@microsoft/api-extractor";
6
-
7
- //#region src/node/build.d.ts
8
-
9
6
  /**
10
7
  * Build the distribution files of a npm package.
11
8
  *
@@ -32,16 +29,12 @@ declare function build(options: {
32
29
  tsconfig?: string;
33
30
  clean?: boolean;
34
31
  }): Promise<void>;
35
- //#endregion
36
- //#region src/node/check.d.ts
37
32
  /** @public */
38
33
  declare function check(options: {
39
34
  cwd: string;
40
35
  strict?: boolean;
41
36
  tsconfig?: string;
42
37
  }): Promise<void>;
43
- //#endregion
44
- //#region src/node/strict.d.ts
45
38
  /**
46
39
  * @public
47
40
  */
@@ -120,8 +113,6 @@ interface StrictOptions {
120
113
  }
121
114
  /** @alpha */
122
115
  declare function parseStrictOptions(input: unknown): InferredStrictOptions;
123
- //#endregion
124
- //#region src/node/core/config/types.d.ts
125
116
  /** @public */
126
117
  type PkgFormat = 'commonjs' | 'esm';
127
118
  /** @public */
@@ -394,22 +385,14 @@ interface PkgConfigOptions {
394
385
  */
395
386
  dts?: DtsType;
396
387
  }
397
- //#endregion
398
- //#region src/node/core/config/defineConfig.d.ts
399
388
  /** @public */
400
389
  declare function defineConfig<const T extends PkgConfigOptions>(configOptions: T): T;
401
- //#endregion
402
- //#region src/node/core/config/loadConfig.d.ts
403
390
  /** @alpha */
404
391
  declare function loadConfig(options: {
405
392
  cwd: string;
406
393
  }): Promise<PkgConfigOptions | undefined>;
407
- //#endregion
408
- //#region src/node/core/defaults.d.ts
409
394
  /** @public */
410
395
  declare const DEFAULT_BROWSERSLIST_QUERY: string[];
411
- //#endregion
412
- //#region src/node/core/pkg/types.d.ts
413
396
  /** @alpha */
414
397
  interface PackageJSON {
415
398
  type?: 'commonjs' | 'module';
@@ -474,14 +457,10 @@ interface PackageJSON {
474
457
  homepage?: string;
475
458
  license?: string;
476
459
  }
477
- //#endregion
478
- //#region src/node/core/pkg/loadPkg.d.ts
479
460
  /** @internal */
480
461
  declare function loadPkg(options: {
481
462
  cwd: string;
482
463
  }): Promise<PackageJSON>;
483
- //#endregion
484
- //#region src/node/logger.d.ts
485
464
  /** @alpha */
486
465
  interface Logger {
487
466
  log: (...args: unknown[]) => void;
@@ -492,16 +471,12 @@ interface Logger {
492
471
  }
493
472
  /** @alpha */
494
473
  declare function createLogger(): Logger;
495
- //#endregion
496
- //#region src/node/core/pkg/loadPkgWithReporting.d.ts
497
474
  /** @alpha */
498
475
  declare function loadPkgWithReporting(options: {
499
476
  cwd: string;
500
477
  logger: Logger;
501
478
  strict: boolean;
502
479
  }): Promise<PackageJSON>;
503
- //#endregion
504
- //#region src/node/core/pkg/parseExports.d.ts
505
480
  /** @alpha */
506
481
  declare function parseExports(options: {
507
482
  cwd: string;
@@ -512,8 +487,6 @@ declare function parseExports(options: {
512
487
  }): (PkgExport & {
513
488
  _path: string;
514
489
  })[];
515
- //#endregion
516
- //#region src/node/core/template/types.d.ts
517
490
  /** @public */
518
491
  interface PkgTemplateFile {
519
492
  name: string;
@@ -549,31 +522,22 @@ type PkgTemplateResolver = (options: {
549
522
  }) => PkgTemplateDefinition | Promise<PkgTemplateDefinition>;
550
523
  /** @public */
551
524
  type PkgTemplate = PkgTemplateDefinition | PkgTemplateResolver;
552
- //#endregion
553
- //#region src/node/core/template/define.d.ts
554
525
  /** @public */
555
526
  declare function defineTemplateOption<T>(option: PkgTemplateOption<T>): PkgTemplateOption<T>;
556
- //#endregion
557
- //#region src/node/init.d.ts
558
527
  /** @public */
559
528
  declare function init(options: {
560
529
  cwd: string;
561
530
  path: string;
562
531
  }): Promise<void>;
563
- //#endregion
564
- //#region src/node/tasks/dts/getExtractMessagesConfig.d.ts
565
532
  /** @alpha */
566
533
  declare function getExtractMessagesConfig(options: {
567
534
  rules: NonNullable<PkgConfigOptions['extract']>['rules'];
568
535
  disabled?: boolean;
569
536
  }): IExtractorMessagesConfig;
570
- //#endregion
571
- //#region src/node/watch.d.ts
572
537
  /** @public */
573
538
  declare function watch(options: {
574
539
  cwd: string;
575
540
  strict?: boolean;
576
541
  tsconfig?: string;
577
542
  }): Promise<void>;
578
- //#endregion
579
543
  export { DEFAULT_BROWSERSLIST_QUERY, InferredStrictOptions, PackageJSON, PkgBundle, PkgConfigOptions, PkgConfigProperty, PkgConfigPropertyResolver, PkgExport, PkgExports, PkgFormat, PkgRuleLevel, PkgRuntime, PkgTemplate, PkgTemplateDefinition, PkgTemplateFile, PkgTemplateOption, PkgTemplateResolver, PkgTemplateStringOption, ReactCompilerLogger, ReactCompilerLoggerEvent, ReactCompilerOptions, RollupPlugin, StrictOptions, TSDocCustomTag, ToggleType, build, check, createLogger, defineConfig, defineTemplateOption, getExtractMessagesConfig, init, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions, strictOptions, toggle, watch };
package/dist/index.js CHANGED
@@ -23,15 +23,15 @@ import { parse as parse$1, print } from "recast";
23
23
  import typeScriptParser from "recast/parsers/typescript.js";
24
24
  import { rolldown } from "rolldown";
25
25
  import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin";
26
- import alias from "@rollup/plugin-alias";
27
26
  import { getBabelOutputPlugin, babel } from "@rollup/plugin-babel";
28
- import commonjs from "@rollup/plugin-commonjs";
29
- import json from "@rollup/plugin-json";
30
- import { nodeResolve } from "@rollup/plugin-node-resolve";
31
27
  import terser from "@rollup/plugin-terser";
32
28
  import { dts } from "rolldown-plugin-dts";
33
29
  import esbuild from "rollup-plugin-esbuild";
34
30
  import { rollup, watch as watch$1 } from "rollup";
31
+ import alias from "@rollup/plugin-alias";
32
+ import commonjs from "@rollup/plugin-commonjs";
33
+ import json from "@rollup/plugin-json";
34
+ import { nodeResolve } from "@rollup/plugin-node-resolve";
35
35
  import replace from "@rollup/plugin-replace";
36
36
  import esbuild$1 from "esbuild";
37
37
  import treeify from "treeify";
@@ -1175,16 +1175,6 @@ function resolveRolldownConfig(ctx, buildTask) {
1175
1175
  Object.entries(config2?.define || {}).map(([key, val]) => [key, JSON.stringify(val)])
1176
1176
  ), { optimizeLodash: enableOptimizeLodash = hasDependency$1(pkg, "lodash") } = config2?.rollup || {};
1177
1177
  [
1178
- alias({
1179
- entries: { ...pathAliases }
1180
- }),
1181
- nodeResolve({
1182
- browser: runtime === "browser",
1183
- extensions: [".cjs", ".mjs", ".js", ".jsx", ".json", ".node"],
1184
- preferBuiltins: !0
1185
- }),
1186
- commonjs(),
1187
- json(),
1188
1178
  esbuild({
1189
1179
  target,
1190
1180
  tsconfig: ctx.ts.configPath || "tsconfig.json",
@@ -1228,6 +1218,17 @@ function resolveRolldownConfig(ctx, buildTask) {
1228
1218
  "process.env.PKG_VERSION": JSON.stringify(process.env.PKG_VERSION || pkg.version),
1229
1219
  ...replacements
1230
1220
  },
1221
+ platform: buildTask.type === "rolldown:dts" || runtime === "node" ? "node" : runtime === "browser" ? "browser" : "neutral",
1222
+ resolve: {
1223
+ alias: pathAliases,
1224
+ tsconfigFilename: ctx.ts.configPath || "tsconfig.json"
1225
+ },
1226
+ transform: {
1227
+ target
1228
+ },
1229
+ experimental: {
1230
+ attachDebugInfo: "none"
1231
+ },
1231
1232
  external: (id, importer) => {
1232
1233
  if (exportIds?.includes(id))
1233
1234
  return !0;