@sanity/pkg-utils 6.13.3-canary.0 → 6.13.3-canary.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "6.13.3-canary.0",
3
+ "version": "6.13.3-canary.3",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -145,8 +145,7 @@
145
145
  "ts-node": "^10.9.2",
146
146
  "typescript": "5.7.2",
147
147
  "vitest": "^2.1.8",
148
- "vitest-github-actions-reporter": "^0.11.1",
149
- "@sanity/pkg-utils": "6.13.3-canary.0"
148
+ "@sanity/pkg-utils": "6.13.3-canary.3"
150
149
  },
151
150
  "peerDependencies": {
152
151
  "babel-plugin-react-compiler": "*",
@@ -176,7 +175,7 @@
176
175
  "playground:build": "pnpm --filter './playground/**' build",
177
176
  "playground:clean": "pnpm --filter './playground/**' --silent clean",
178
177
  "pretest": "run-s playground:clean",
179
- "test": "vitest",
178
+ "test": "vitest run",
180
179
  "test:update-snapshots": "pnpm test run -- --update",
181
180
  "watch": "node -r esbuild-register scripts/watch"
182
181
  }
@@ -222,6 +222,9 @@ export interface PkgConfigOptions {
222
222
  bundledPackages?: PkgConfigProperty<string[]>
223
223
  customTags?: TSDocCustomTag[]
224
224
  rules?: {
225
+ /**
226
+ * @deprecated no longer needed since TypeScript 5.5 https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#consulting-package.json-dependencies-for-declaration-file-generation
227
+ */
225
228
  'ae-forgotten-export'?: PkgRuleLevel
226
229
  'ae-incompatible-release-tags'?: PkgRuleLevel
227
230
  'ae-internal-missing-underscore'?: PkgRuleLevel
@@ -1,7 +1,6 @@
1
1
  import path from 'node:path'
2
2
 
3
3
  import type {IConfigFile, IExtractorMessagesConfig} from '@microsoft/api-extractor'
4
- import ts from 'typescript'
5
4
 
6
5
  export function createApiExtractorConfig(options: {
7
6
  bundledPackages?: string[]
@@ -11,7 +10,6 @@ export function createApiExtractorConfig(options: {
11
10
  messages: IExtractorMessagesConfig
12
11
  projectFolder: string
13
12
  mainEntryPointFilePath: string
14
- tsconfig: ts.ParsedCommandLine
15
13
  tsconfigPath: string
16
14
  }): IConfigFile {
17
15
  const {
@@ -22,48 +20,16 @@ export function createApiExtractorConfig(options: {
22
20
  messages,
23
21
  projectFolder,
24
22
  mainEntryPointFilePath,
25
- tsconfig,
26
23
  tsconfigPath,
27
24
  } = options
28
25
 
29
- // When the module is 'preserve' it's necessary to override the tsconfig file as api-extractor doesn't handle it out of the box
30
- const workaroundModulePreserve = tsconfig.options.module === ts.ModuleKind.Preserve
31
- // If `paths` are used for self-referencing imports (e.g. the module is named `sanity`, and the `sanity/structure` export is also importing from `sanity/router`),
32
- const workaroundPaths = !!tsconfig.options.paths
33
-
34
- const overrideTsconfig = {
35
- extends: tsconfigPath,
36
- compilerOptions: {},
37
- }
38
-
39
- if (workaroundModulePreserve) {
40
- Object.assign(overrideTsconfig.compilerOptions, {
41
- // Set the equivalent options to `module: 'Preserve'`
42
- // https://github.com/microsoft/TypeScript/pull/56785/files?file-filters%5B%5D=.js&file-filters%5B%5D=.json&file-filters%5B%5D=.symbols&file-filters%5B%5D=.ts&file-filters%5B%5D=.types&show-viewed-files=true#diff-31d3c12bafea26bc9e8c8a77920c41af0c593206442add70c45a06c063767445
43
- module: 'ESNext',
44
- moduleResolution: 'Bundler',
45
- esModuleInterop: true,
46
- resolveJsonModule: true,
47
- })
48
- }
49
-
50
- if (workaroundPaths) {
51
- Object.assign(overrideTsconfig.compilerOptions, {
52
- // An empty object replaces whatever is in the original tsconfig file
53
- paths: {},
54
- })
55
- }
56
-
57
26
  return {
58
27
  apiReport: {
59
28
  enabled: false,
60
29
  reportFileName: '<unscopedPackageName>.api.md',
61
30
  },
62
31
  bundledPackages,
63
- compiler:
64
- workaroundModulePreserve || workaroundPaths
65
- ? {overrideTsconfig}
66
- : {tsconfigFilePath: tsconfigPath},
32
+ compiler: {tsconfigFilePath: tsconfigPath},
67
33
 
68
34
  docModel: {
69
35
  enabled: false,
@@ -50,7 +50,6 @@ export async function doExtract(
50
50
  const result = await extractTypes({
51
51
  bundledPackages: bundledPackages || [],
52
52
  customTags: config?.extract?.customTags,
53
- cwd,
54
53
  distPath: outDir,
55
54
  exportPath,
56
55
  files,
@@ -58,7 +57,6 @@ export async function doExtract(
58
57
  projectPath: cwd,
59
58
  rules: config?.extract?.rules,
60
59
  sourceTypesPath: sourceTypesPath,
61
- tsconfig: ts.config,
62
60
  tmpPath,
63
61
  tsconfigPath: path.resolve(cwd, ts.configPath || 'tsconfig.json'),
64
62
  })
@@ -102,7 +102,6 @@ export const dtsWatchTask: TaskHandler<DtsWatchTask, DtsResult> = {
102
102
  const result = await extractTypes({
103
103
  bundledPackages: bundledPackages || [],
104
104
  customTags: config?.extract?.customTags,
105
- cwd,
106
105
  distPath: outDir,
107
106
  exportPath,
108
107
  files,
@@ -110,7 +109,6 @@ export const dtsWatchTask: TaskHandler<DtsWatchTask, DtsResult> = {
110
109
  projectPath: cwd,
111
110
  rules: config?.extract?.rules,
112
111
  sourceTypesPath: sourceTypesPath,
113
- tsconfig: tsContext.config!,
114
112
  tmpPath,
115
113
  tsconfigPath: path.resolve(cwd, tsContext.configPath || 'tsconfig.json'),
116
114
  })
@@ -9,7 +9,6 @@ import {
9
9
  } from '@microsoft/api-extractor'
10
10
  import {mkdirp} from 'mkdirp'
11
11
  import prettier from 'prettier'
12
- import type ts from 'typescript'
13
12
 
14
13
  import type {BuildFile, PkgConfigOptions} from '../../core'
15
14
  import {createApiExtractorConfig} from './createApiExtractorConfig'
@@ -20,7 +19,6 @@ import {getExtractMessagesConfig} from './getExtractMessagesConfig'
20
19
  export async function extractTypes(options: {
21
20
  bundledPackages?: string[]
22
21
  customTags: NonNullable<PkgConfigOptions['extract']>['customTags']
23
- cwd: string
24
22
  distPath: string
25
23
  exportPath: string
26
24
  filePaths: string[]
@@ -29,7 +27,6 @@ export async function extractTypes(options: {
29
27
  rules?: NonNullable<PkgConfigOptions['extract']>['rules']
30
28
  sourceTypesPath: string
31
29
  tmpPath: string
32
- tsconfig: ts.ParsedCommandLine
33
30
  tsconfigPath: string
34
31
  }): Promise<{extractorResult: ExtractorResult; messages: ExtractorMessage[]}> {
35
32
  const {
@@ -43,7 +40,6 @@ export async function extractTypes(options: {
43
40
  rules,
44
41
  sourceTypesPath,
45
42
  tmpPath,
46
- tsconfig,
47
43
  tsconfigPath,
48
44
  } = options
49
45
 
@@ -63,7 +59,6 @@ export async function extractTypes(options: {
63
59
  messages: getExtractMessagesConfig({rules}),
64
60
  projectFolder: projectPath,
65
61
  mainEntryPointFilePath: sourceTypesPath,
66
- tsconfig,
67
62
  tsconfigPath,
68
63
  }),
69
64
  configObjectFullPath: undefined,
@@ -38,7 +38,7 @@ export function getExtractMessagesConfig(options: {
38
38
  },
39
39
 
40
40
  'ae-forgotten-export': {
41
- logLevel: ruleToLogLevel('ae-forgotten-export', 'error' as ExtractorLogLevel),
41
+ logLevel: ruleToLogLevel('ae-forgotten-export', 'none' as ExtractorLogLevel),
42
42
  addToApiReportFile: false,
43
43
  },
44
44