@sanity/pkg-utils 7.7.1-canary.3 → 7.7.2-canary.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/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { cac } from "cac";
2
- var version = "7.7.1-canary.3";
2
+ var version = "7.7.2-canary.0";
3
3
  const cli = cac();
4
4
  cli.command("", "Check").alias("check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async (options) => {
5
5
  const { checkAction } = await import("./_chunks-es/checkAction.js");
package/dist/index.cjs CHANGED
@@ -14,7 +14,5 @@ exports.loadPkg = index.loadPkg;
14
14
  exports.loadPkgWithReporting = index.loadPkgWithReporting;
15
15
  exports.parseExports = index.parseExports;
16
16
  exports.parseStrictOptions = index.parseStrictOptions;
17
- exports.strictOptions = index.strictOptions;
18
- exports.toggle = index.toggle;
19
17
  exports.watch = index.watch;
20
18
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { PluginItem } from "@babel/core";
2
2
  import { OptimizeLodashOptions } from "@optimize-lodash/rollup-plugin";
3
3
  import { NormalizedOutputOptions, Plugin, Plugin as RollupPlugin, TreeshakingOptions } from "rollup";
4
- import { z } from "zod";
5
4
  import { IExtractorMessagesConfig } from "@microsoft/api-extractor";
6
5
  /**
7
6
  * Build the distribution files of a npm package.
@@ -35,43 +34,7 @@ declare function check(options: {
35
34
  strict?: boolean;
36
35
  tsconfig?: string;
37
36
  }): Promise<void>;
38
- /**
39
- * @public
40
- */
41
- declare const toggle: z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>;
42
- /**
43
- * @public
44
- */
45
- type ToggleType = z.infer<typeof toggle>;
46
- /**
47
- * @public
48
- */
49
- declare const strictOptions: z.ZodObject<{
50
- noPackageJsonTypings: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
51
- noImplicitSideEffects: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
52
- noImplicitBrowsersList: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
53
- alwaysPackageJsonTypes: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
54
- alwaysPackageJsonMain: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
55
- alwaysPackageJsonFiles: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
56
- }, "strict", z.ZodTypeAny, {
57
- noPackageJsonTypings: "error" | "off" | "warn";
58
- noImplicitSideEffects: "error" | "off" | "warn";
59
- noImplicitBrowsersList: "error" | "off" | "warn";
60
- alwaysPackageJsonTypes: "error" | "off" | "warn";
61
- alwaysPackageJsonMain: "error" | "off" | "warn";
62
- alwaysPackageJsonFiles: "error" | "off" | "warn";
63
- }, {
64
- noPackageJsonTypings?: "error" | "off" | "warn" | undefined;
65
- noImplicitSideEffects?: "error" | "off" | "warn" | undefined;
66
- noImplicitBrowsersList?: "error" | "off" | "warn" | undefined;
67
- alwaysPackageJsonTypes?: "error" | "off" | "warn" | undefined;
68
- alwaysPackageJsonMain?: "error" | "off" | "warn" | undefined;
69
- alwaysPackageJsonFiles?: "error" | "off" | "warn" | undefined;
70
- }>;
71
- /**
72
- * @public
73
- */
74
- type InferredStrictOptions = z.infer<typeof strictOptions>;
37
+ type ToggleType = 'error' | 'warn' | 'off';
75
38
  /**
76
39
  * @public
77
40
  */
@@ -80,12 +43,12 @@ interface StrictOptions {
80
43
  * Disallows a top level `typings` field in `package.json` if it is equal to `exports['.'].source`.
81
44
  * @defaultValue 'error'
82
45
  */
83
- noPackageJsonTypings?: ToggleType;
46
+ noPackageJsonTypings: ToggleType;
84
47
  /**
85
48
  * Requires specifying `sideEffects` in `package.json`.
86
49
  * @defaultValue 'warn'
87
50
  */
88
- noImplicitSideEffects?: ToggleType;
51
+ noImplicitSideEffects: ToggleType;
89
52
  /**
90
53
  * Requires specifying `browserslist` in `package.json`, instead of relying on it implicitly being:
91
54
  * @example
@@ -94,25 +57,30 @@ interface StrictOptions {
94
57
  * ```
95
58
  * @defaultValue 'warn'
96
59
  */
97
- noImplicitBrowsersList?: ToggleType;
60
+ noImplicitBrowsersList: ToggleType;
98
61
  /**
99
62
  * If typescript is used then `types` in `package.json` should be specified for npm listings to show the TS icon.
100
63
  * @defaultValue 'error'
101
64
  */
102
- alwaysPackageJsonTypes?: ToggleType;
65
+ alwaysPackageJsonTypes: ToggleType;
103
66
  /**
104
67
  * A lot of analysis tooling requiers the `main` field to work (like bundlephobia) and so it's best practice to always include it
105
68
  * @defaultValue 'error'
106
69
  */
107
- alwaysPackageJsonMain?: ToggleType;
70
+ alwaysPackageJsonMain: ToggleType;
108
71
  /**
109
72
  * Using `.npmignore` is error prone, it's best practice to always declare `files` instead
110
73
  * @defaultValue 'error'
111
74
  */
112
- alwaysPackageJsonFiles?: ToggleType;
75
+ alwaysPackageJsonFiles: ToggleType;
76
+ /**
77
+ * It's slow to perform type checking while generating dts files, so it's best practice to disable it with a `"noCheck": true` in the tsconfig.json file used by `package.config.ts`
78
+ * @defaultValue 'warn'
79
+ */
80
+ noCheckTypes: ToggleType;
113
81
  }
114
82
  /** @alpha */
115
- declare function parseStrictOptions(input: unknown): InferredStrictOptions;
83
+ declare function parseStrictOptions(input: unknown): StrictOptions;
116
84
  /** @public */
117
85
  type PkgFormat = 'commonjs' | 'esm';
118
86
  /** @public */
@@ -390,7 +358,7 @@ interface PkgConfigOptions {
390
358
  /**
391
359
  * Configure what checks are made when running `--strict` builds and checks
392
360
  */
393
- strictOptions?: StrictOptions;
361
+ strictOptions?: Partial<StrictOptions>;
394
362
  /**
395
363
  * .d.ts files can be generated either by using `@microsoft/api-extractor` or `rolldown`.
396
364
  * `rolldown` is the faster option, but is not yet stable.
@@ -408,7 +376,7 @@ declare function loadConfig(options: {
408
376
  declare const DEFAULT_BROWSERSLIST_QUERY: string[];
409
377
  /** @alpha */
410
378
  interface PackageJSON {
411
- type?: 'commonjs' | 'module';
379
+ type?: 'commonjs' | 'module' | undefined;
412
380
  version: string;
413
381
  private?: boolean;
414
382
  author?: string | {
@@ -495,7 +463,7 @@ declare function parseExports(options: {
495
463
  cwd: string;
496
464
  pkg: PackageJSON;
497
465
  strict: boolean;
498
- strictOptions: InferredStrictOptions;
466
+ strictOptions: StrictOptions;
499
467
  logger: Logger;
500
468
  }): (PkgExport & {
501
469
  _path: string;
@@ -553,4 +521,4 @@ declare function watch(options: {
553
521
  strict?: boolean;
554
522
  tsconfig?: string;
555
523
  }): Promise<void>;
556
- 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 };
524
+ export { DEFAULT_BROWSERSLIST_QUERY, PackageJSON, PkgBundle, PkgConfigOptions, PkgConfigProperty, PkgConfigPropertyResolver, PkgExport, PkgExports, PkgFormat, PkgRuleLevel, PkgRuntime, PkgTemplate, PkgTemplateDefinition, PkgTemplateFile, PkgTemplateOption, PkgTemplateResolver, PkgTemplateStringOption, ReactCompilerLogger, ReactCompilerLoggerEvent, ReactCompilerOptions, RollupPlugin, TSDocCustomTag, build, check, createLogger, defineConfig, defineTemplateOption, getExtractMessagesConfig, init, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions, watch };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { PluginItem } from "@babel/core";
2
2
  import { OptimizeLodashOptions } from "@optimize-lodash/rollup-plugin";
3
3
  import { NormalizedOutputOptions, Plugin, Plugin as RollupPlugin, TreeshakingOptions } from "rollup";
4
- import { z } from "zod";
5
4
  import { IExtractorMessagesConfig } from "@microsoft/api-extractor";
6
5
  /**
7
6
  * Build the distribution files of a npm package.
@@ -35,43 +34,7 @@ declare function check(options: {
35
34
  strict?: boolean;
36
35
  tsconfig?: string;
37
36
  }): Promise<void>;
38
- /**
39
- * @public
40
- */
41
- declare const toggle: z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>;
42
- /**
43
- * @public
44
- */
45
- type ToggleType = z.infer<typeof toggle>;
46
- /**
47
- * @public
48
- */
49
- declare const strictOptions: z.ZodObject<{
50
- noPackageJsonTypings: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
51
- noImplicitSideEffects: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
52
- noImplicitBrowsersList: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
53
- alwaysPackageJsonTypes: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
54
- alwaysPackageJsonMain: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
55
- alwaysPackageJsonFiles: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"error">, z.ZodLiteral<"warn">, z.ZodLiteral<"off">]>>;
56
- }, "strict", z.ZodTypeAny, {
57
- noPackageJsonTypings: "error" | "off" | "warn";
58
- noImplicitSideEffects: "error" | "off" | "warn";
59
- noImplicitBrowsersList: "error" | "off" | "warn";
60
- alwaysPackageJsonTypes: "error" | "off" | "warn";
61
- alwaysPackageJsonMain: "error" | "off" | "warn";
62
- alwaysPackageJsonFiles: "error" | "off" | "warn";
63
- }, {
64
- noPackageJsonTypings?: "error" | "off" | "warn" | undefined;
65
- noImplicitSideEffects?: "error" | "off" | "warn" | undefined;
66
- noImplicitBrowsersList?: "error" | "off" | "warn" | undefined;
67
- alwaysPackageJsonTypes?: "error" | "off" | "warn" | undefined;
68
- alwaysPackageJsonMain?: "error" | "off" | "warn" | undefined;
69
- alwaysPackageJsonFiles?: "error" | "off" | "warn" | undefined;
70
- }>;
71
- /**
72
- * @public
73
- */
74
- type InferredStrictOptions = z.infer<typeof strictOptions>;
37
+ type ToggleType = 'error' | 'warn' | 'off';
75
38
  /**
76
39
  * @public
77
40
  */
@@ -80,12 +43,12 @@ interface StrictOptions {
80
43
  * Disallows a top level `typings` field in `package.json` if it is equal to `exports['.'].source`.
81
44
  * @defaultValue 'error'
82
45
  */
83
- noPackageJsonTypings?: ToggleType;
46
+ noPackageJsonTypings: ToggleType;
84
47
  /**
85
48
  * Requires specifying `sideEffects` in `package.json`.
86
49
  * @defaultValue 'warn'
87
50
  */
88
- noImplicitSideEffects?: ToggleType;
51
+ noImplicitSideEffects: ToggleType;
89
52
  /**
90
53
  * Requires specifying `browserslist` in `package.json`, instead of relying on it implicitly being:
91
54
  * @example
@@ -94,25 +57,30 @@ interface StrictOptions {
94
57
  * ```
95
58
  * @defaultValue 'warn'
96
59
  */
97
- noImplicitBrowsersList?: ToggleType;
60
+ noImplicitBrowsersList: ToggleType;
98
61
  /**
99
62
  * If typescript is used then `types` in `package.json` should be specified for npm listings to show the TS icon.
100
63
  * @defaultValue 'error'
101
64
  */
102
- alwaysPackageJsonTypes?: ToggleType;
65
+ alwaysPackageJsonTypes: ToggleType;
103
66
  /**
104
67
  * A lot of analysis tooling requiers the `main` field to work (like bundlephobia) and so it's best practice to always include it
105
68
  * @defaultValue 'error'
106
69
  */
107
- alwaysPackageJsonMain?: ToggleType;
70
+ alwaysPackageJsonMain: ToggleType;
108
71
  /**
109
72
  * Using `.npmignore` is error prone, it's best practice to always declare `files` instead
110
73
  * @defaultValue 'error'
111
74
  */
112
- alwaysPackageJsonFiles?: ToggleType;
75
+ alwaysPackageJsonFiles: ToggleType;
76
+ /**
77
+ * It's slow to perform type checking while generating dts files, so it's best practice to disable it with a `"noCheck": true` in the tsconfig.json file used by `package.config.ts`
78
+ * @defaultValue 'warn'
79
+ */
80
+ noCheckTypes: ToggleType;
113
81
  }
114
82
  /** @alpha */
115
- declare function parseStrictOptions(input: unknown): InferredStrictOptions;
83
+ declare function parseStrictOptions(input: unknown): StrictOptions;
116
84
  /** @public */
117
85
  type PkgFormat = 'commonjs' | 'esm';
118
86
  /** @public */
@@ -390,7 +358,7 @@ interface PkgConfigOptions {
390
358
  /**
391
359
  * Configure what checks are made when running `--strict` builds and checks
392
360
  */
393
- strictOptions?: StrictOptions;
361
+ strictOptions?: Partial<StrictOptions>;
394
362
  /**
395
363
  * .d.ts files can be generated either by using `@microsoft/api-extractor` or `rolldown`.
396
364
  * `rolldown` is the faster option, but is not yet stable.
@@ -408,7 +376,7 @@ declare function loadConfig(options: {
408
376
  declare const DEFAULT_BROWSERSLIST_QUERY: string[];
409
377
  /** @alpha */
410
378
  interface PackageJSON {
411
- type?: 'commonjs' | 'module';
379
+ type?: 'commonjs' | 'module' | undefined;
412
380
  version: string;
413
381
  private?: boolean;
414
382
  author?: string | {
@@ -495,7 +463,7 @@ declare function parseExports(options: {
495
463
  cwd: string;
496
464
  pkg: PackageJSON;
497
465
  strict: boolean;
498
- strictOptions: InferredStrictOptions;
466
+ strictOptions: StrictOptions;
499
467
  logger: Logger;
500
468
  }): (PkgExport & {
501
469
  _path: string;
@@ -553,4 +521,4 @@ declare function watch(options: {
553
521
  strict?: boolean;
554
522
  tsconfig?: string;
555
523
  }): Promise<void>;
556
- 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 };
524
+ export { DEFAULT_BROWSERSLIST_QUERY, PackageJSON, PkgBundle, PkgConfigOptions, PkgConfigProperty, PkgConfigPropertyResolver, PkgExport, PkgExports, PkgFormat, PkgRuleLevel, PkgRuntime, PkgTemplate, PkgTemplateDefinition, PkgTemplateFile, PkgTemplateOption, PkgTemplateResolver, PkgTemplateStringOption, ReactCompilerLogger, ReactCompilerLoggerEvent, ReactCompilerOptions, RollupPlugin, TSDocCustomTag, build, check, createLogger, defineConfig, defineTemplateOption, getExtractMessagesConfig, init, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions, watch };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { build } from "./_chunks-es/build.js";
2
2
  import { check } from "./_chunks-es/check.js";
3
- import { DEFAULT_BROWSERSLIST_QUERY, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions, strictOptions, toggle } from "./_chunks-es/consoleSpy.js";
3
+ import { DEFAULT_BROWSERSLIST_QUERY, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions } from "./_chunks-es/consoleSpy.js";
4
4
  import { defineTemplateOption, init } from "./_chunks-es/init.js";
5
5
  import { createLogger } from "./_chunks-es/isRecord.js";
6
6
  import { getExtractMessagesConfig } from "./_chunks-es/index.js";
@@ -22,8 +22,6 @@ export {
22
22
  loadPkgWithReporting,
23
23
  parseExports,
24
24
  parseStrictOptions,
25
- strictOptions,
26
- toggle,
27
25
  watch
28
26
  };
29
27
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "7.7.1-canary.3",
3
+ "version": "7.7.2-canary.0",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -115,7 +115,7 @@
115
115
  "@commitlint/cli": "^19.8.1",
116
116
  "@commitlint/config-conventional": "^19.8.1",
117
117
  "@ianvs/prettier-plugin-sort-imports": "^4.4.2",
118
- "@sanity/prettier-config": "^1.0.4",
118
+ "@sanity/prettier-config": "^1.0.5",
119
119
  "@types/babel__core": "^7.20.5",
120
120
  "@types/find-config": "^1.0.4",
121
121
  "@types/fs-extra": "^11.0.4",
@@ -140,7 +140,7 @@
140
140
  "tsx": "^4.20.3",
141
141
  "typescript": "5.8.3",
142
142
  "vitest": "^3.2.4",
143
- "@sanity/pkg-utils": "7.7.1-canary.3"
143
+ "@sanity/pkg-utils": "7.7.2-canary.0"
144
144
  },
145
145
  "peerDependencies": {
146
146
  "babel-plugin-react-compiler": "*",
@@ -4,6 +4,8 @@
4
4
  "compilerOptions": {
5
5
  "allowJs": false,
6
6
  "checkJs": false,
7
- "isolatedDeclarations": true
7
+ "isolatedDeclarations": true,
8
+ "declaration": true,
9
+ "noCheck": true
8
10
  }
9
11
  }
@@ -16,6 +16,9 @@
16
16
  "esModuleInterop": true,
17
17
  "forceConsistentCasingInFileNames": true,
18
18
  "skipLibCheck": true,
19
+ "noUncheckedIndexedAccess": true,
20
+ "exactOptionalPropertyTypes": true,
21
+ "isolatedModules": true,
19
22
  "erasableSyntaxOnly": true
20
23
  }
21
24
  }