@sanity/tsdown-config 0.24.0 → 0.24.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc.d.mts","names":[],"sources":["../src/tsdoc/checkTsdoc.ts"],"mappings":";;;UAkBiB;EACf,SAAS;EACT,UAAU;EACV,WAAW;;;UAII,0BAA0B;;EAEzC;;;;;EAKA;;;;;EAKA;;;;;EAKA;;;;;EAKA,SAAS;;;UAIM;EACf,UAAU;EACV;EACA;;;;;;;iBAQoB,WAAW,SAAS,oBAAoB,QAAQ"}
1
+ {"version":3,"file":"tsdoc.d.mts","names":[],"sources":["../src/tsdoc/checkTsdoc.ts"],"mappings":";;;UAmBiB;EACf,SAAS;EACT,UAAU;EACV,WAAW;;;UAII,0BAA0B;;EAEzC;;;;;EAKA;;;;;EAKA;;;;;EAKA;;;;;EAKA,SAAS;;;UAIM;EACf,UAAU;EACV;EACA;;;;;;;iBAQoB,WAAW,SAAS,oBAAoB,QAAQ"}
package/dist/tsdoc.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import path from "node:path";
3
- import { existsSync } from "node:fs";
3
+ import { existsSync, readFileSync } from "node:fs";
4
4
  import { Extractor, ExtractorConfig, ExtractorLogLevel } from "@microsoft/api-extractor";
5
5
  import ts from "@typescript/typescript6";
6
6
  import { readFile } from "node:fs/promises";
@@ -123,6 +123,106 @@ function getExtractMessagesConfig(options) {
123
123
  };
124
124
  }
125
125
  /**
126
+ * The exports-object identifiers of rolldown's namespace interop: `<module>_exports` (the
127
+ * declaration bundling pass names them after the virtual declaration module, e.g. `inner.d.ts`
128
+ * → `inner_d_exports`), with rolldown's `$<n>` suffix when deconflicting renames one.
129
+ */
130
+ const RE_WRAPPER_NAME = /_exports(\$\d+)?$/, RE_RELATIVE_SPECIFIER = /^\.\.?\//;
131
+ /**
132
+ * Finds the local names of the `declare namespace <name>_exports {…}` wrappers that the
133
+ * declaration bundling pass (tsdown / rolldown-plugin-dts) synthesizes for namespace re-exports
134
+ * like `export * as ns from './module'` (or `import * as ns` + `export {ns}`).
135
+ *
136
+ * Bundling loses the doc comment of the re-export statement, so the wrapper cannot carry a
137
+ * release tag — there is no way to tag it from userland, and API Extractor would flag it with
138
+ * `ae-missing-release-tag` (https://github.com/sanity-io/pkg-utils/issues/3281). Skipping it
139
+ * matches how API Extractor treats the equivalent namespace of its own rollups (it never
140
+ * checks those). The members re-exported through the wrapper keep their own doc comments in
141
+ * the output; API Extractor does not flag them individually either way (only directly exported
142
+ * declarations are consumable entities of the missing-release-tag check).
143
+ *
144
+ * A name only qualifies when all of these hold, so user-authored symbols that merely resemble
145
+ * the interop naming stay checked:
146
+ *
147
+ * - it matches rolldown's `<module>_exports` naming (with an optional `$<n>` deconflict suffix)
148
+ * - it is declared as a namespace — in the entry itself, or in a sibling chunk the entry
149
+ * imports (a wrapper shared by several entries lives in the chunk that owns the module's
150
+ * declarations)
151
+ * - that namespace has the synthesized body shape: nothing but `export { … };` specifier lists
152
+ * pointing at sibling declarations of the same file. A user-authored namespace declares its
153
+ * own members (`declare namespace config_exports { const userValue: string; }`), and those
154
+ * members are what the author tags — so it stays checked even when the bundler's
155
+ * deconflicting hands it a wrapper-shaped name
156
+ * - the entry does not export the name unaliased: a synthesized wrapper is always re-exported
157
+ * under the alias of the original namespace re-export (`export { inner_d_exports as inner }`),
158
+ * while an unaliased export (`export { foo_exports }`, `export declare namespace foo_exports`)
159
+ * is a name the author chose — and can tag
160
+ * @internal
161
+ */
162
+ function collectSynthesizedNamespaceWrappers(entryDtsFile) {
163
+ let entry = parseDts(entryDtsFile);
164
+ if (!entry) return /* @__PURE__ */ new Set();
165
+ let unaliasedExports = /* @__PURE__ */ new Set(), wrapperShapedNames = /* @__PURE__ */ new Set(), chunkFiles = /* @__PURE__ */ new Set();
166
+ for (let statement of entry.statements) if (collectWrapperShapedNamespaceName(statement, wrapperShapedNames), ts.isExportDeclaration(statement)) {
167
+ let { exportClause } = statement;
168
+ if (exportClause && ts.isNamedExports(exportClause)) for (let element of exportClause.elements) (!element.propertyName || element.propertyName.text === element.name.text) && unaliasedExports.add(element.name.text);
169
+ else exportClause && ts.isNamespaceExport(exportClause) && unaliasedExports.add(exportClause.name.text);
170
+ collectChunkFile(entryDtsFile, statement.moduleSpecifier, chunkFiles);
171
+ } else ts.isImportDeclaration(statement) ? collectChunkFile(entryDtsFile, statement.moduleSpecifier, chunkFiles) : collectExportedDeclarationNames(statement, unaliasedExports);
172
+ for (let chunkFile of chunkFiles) {
173
+ let chunk = parseDts(chunkFile);
174
+ if (chunk) for (let statement of chunk.statements) collectWrapperShapedNamespaceName(statement, wrapperShapedNames);
175
+ }
176
+ let wrappers = /* @__PURE__ */ new Set();
177
+ for (let name of wrapperShapedNames) RE_WRAPPER_NAME.test(name) && !unaliasedExports.has(name) && wrappers.add(name);
178
+ return wrappers;
179
+ }
180
+ function parseDts(filePath) {
181
+ if (existsSync(filePath)) return ts.createSourceFile(filePath, readFileSync(filePath, "utf8"), ts.ScriptTarget.Latest, !1);
182
+ }
183
+ /**
184
+ * Collects the name of a top-level `declare namespace <Identifier> {…}` statement whose body has
185
+ * the shape the declaration bundling pass synthesizes: only `export { … };` specifier lists
186
+ * naming sibling declarations of the same file, never members of its own. Every namespace
187
+ * re-export the bundler rewrites comes out that way, whatever the re-exported module holds
188
+ * (values, types, a default export, further namespace re-exports).
189
+ */
190
+ function collectWrapperShapedNamespaceName(statement, names) {
191
+ if (!ts.isModuleDeclaration(statement) || !ts.isIdentifier(statement.name) || (statement.flags & ts.NodeFlags.Namespace) === 0) return;
192
+ let { body } = statement;
193
+ !body || !ts.isModuleBlock(body) || body.statements.every((member) => ts.isExportDeclaration(member) && !member.moduleSpecifier && member.exportClause !== void 0 && ts.isNamedExports(member.exportClause)) && names.add(statement.name.text);
194
+ }
195
+ /**
196
+ * Collects the names a declaration with an `export` modifier exports directly, e.g.
197
+ * `export declare namespace foo_exports {…}` — those names are user-chosen (the author can
198
+ * tag them), unlike the alias-only re-export of a synthesized wrapper.
199
+ */
200
+ function collectExportedDeclarationNames(statement, names) {
201
+ if ((ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : void 0)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {
202
+ if (ts.isVariableStatement(statement)) for (let declaration of statement.declarationList.declarations) ts.isIdentifier(declaration.name) && names.add(declaration.name.text);
203
+ else ((ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement) || ts.isInterfaceDeclaration(statement) || ts.isTypeAliasDeclaration(statement) || ts.isEnumDeclaration(statement)) && statement.name || ts.isModuleDeclaration(statement) && ts.isIdentifier(statement.name)) && names.add(statement.name.text);
204
+ }
205
+ }
206
+ /**
207
+ * Resolves the sibling chunk file a relative import/export specifier points at, mapping the
208
+ * runtime extension to the declaration extension the chunk is emitted with on disk
209
+ * (`./chunk.js` → `./chunk.d.ts`, like the declaration output of the bundling pass itself).
210
+ */
211
+ function collectChunkFile(entryDtsFile, moduleSpecifier, files) {
212
+ if (!moduleSpecifier || !ts.isStringLiteral(moduleSpecifier)) return;
213
+ let specifier = moduleSpecifier.text;
214
+ if (!RE_RELATIVE_SPECIFIER.test(specifier)) return;
215
+ let dtsFile = specifierToDtsFile(specifier);
216
+ dtsFile && files.add(path.resolve(path.dirname(entryDtsFile), dtsFile));
217
+ }
218
+ /** `./chunk.js` → `./chunk.d.ts` (`.mjs` → `.d.mts`, `.cjs` → `.d.cts`). */
219
+ function specifierToDtsFile(specifier) {
220
+ if (/\.d\.[mc]?ts$/.test(specifier)) return specifier;
221
+ if (specifier.endsWith(".mjs")) return `${specifier.slice(0, -4)}.d.mts`;
222
+ if (specifier.endsWith(".cjs")) return `${specifier.slice(0, -4)}.d.cts`;
223
+ if (specifier.endsWith(".js")) return `${specifier.slice(0, -3)}.d.ts`;
224
+ }
225
+ /**
126
226
  * Run `@microsoft/api-extractor` against the given entry declaration files to check that TSDoc
127
227
  * tags are valid and release tags are correct. Import from `@sanity/tsdown-config/tsdoc`.
128
228
  * @public
@@ -134,7 +234,7 @@ async function checkTsdoc(options) {
134
234
  }), outDir = tsconfig?.options.outDir ?? (outDirOption ? path.resolve(cwd, outDirOption) : void 0) ?? commonParentDir(entryDtsFiles) ?? path.resolve(cwd, "dist"), tsdocConfigFile = await createTSDocConfig({ customTags }), messagesConfig = getExtractMessagesConfig({ rules }), allMessages = [];
135
235
  for (let exportPath of entryDtsFiles) {
136
236
  if (!existsSync(exportPath)) continue;
137
- let relativeDtsPath = path.relative(outDir, exportPath), extractorConfig = ExtractorConfig.prepare({
237
+ let synthesizedWrappers = collectSynthesizedNamespaceWrappers(exportPath), relativeDtsPath = path.relative(outDir, exportPath), extractorConfig = ExtractorConfig.prepare({
138
238
  configObject: createApiExtractorConfig({
139
239
  bundledPackages,
140
240
  distPath: outDir,
@@ -154,7 +254,7 @@ async function checkTsdoc(options) {
154
254
  localBuild: !0,
155
255
  showVerboseMessages: !0,
156
256
  messageCallback(message) {
157
- allMessages.push(message), message.handled = !0;
257
+ message.handled = !0, !isSynthesizedNamespaceWrapperMessage(message, synthesizedWrappers) && allMessages.push(message);
158
258
  }
159
259
  });
160
260
  }
@@ -172,6 +272,20 @@ function loadTSConfig(options) {
172
272
  let configFile = ts.readConfigFile(configPath, ts.sys.readFile);
173
273
  return ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
174
274
  }
275
+ /** The quoted symbol name leading api-extractor's `ae-missing-release-tag` message text. */
276
+ const RE_MISSING_RELEASE_TAG_SYMBOL = /^"([^"]+)" is part of the package's API/;
277
+ /**
278
+ * Whether a message is an `ae-missing-release-tag` complaint about a namespace wrapper the
279
+ * declaration bundling pass synthesized (which userland can never tag). The flagged symbol is
280
+ * only identifiable through the message text: api-extractor quotes the local name of the
281
+ * declaration, and attaches no structured properties (its source location maps through
282
+ * `.d.ts.map` files, often landing on an unrelated source position).
283
+ */
284
+ function isSynthesizedNamespaceWrapperMessage(message, synthesizedWrappers) {
285
+ if (synthesizedWrappers.size === 0 || message.messageId !== "ae-missing-release-tag") return !1;
286
+ let symbolName = RE_MISSING_RELEASE_TAG_SYMBOL.exec(message.text)?.[1];
287
+ return symbolName !== void 0 && synthesizedWrappers.has(symbolName);
288
+ }
175
289
  function commonParentDir(files) {
176
290
  if (files.length === 0) return;
177
291
  let dir = path.dirname(files[0]);
@@ -1 +1 @@
1
- {"version":3,"file":"tsdoc.mjs","names":[],"sources":["../src/tsdoc/createApiExtractorConfig.ts","../src/tsdoc/createTSDocConfig.ts","../src/tsdoc/getExtractMessagesConfig.ts","../src/tsdoc/checkTsdoc.ts"],"sourcesContent":["import path from 'node:path'\nimport type {IConfigFile, IExtractorMessagesConfig} from '@microsoft/api-extractor'\n\n/** @internal */\nexport function createApiExtractorConfig(options: {\n bundledPackages?: string[]\n distPath: string\n exportPath: string\n filePath: string\n messages: IExtractorMessagesConfig\n projectFolder: string\n mainEntryPointFilePath: string\n /**\n * Only `compilerOptions.paths` is read: when present, API Extractor gets an override that\n * clears `paths` so self-referencing package imports resolve through `node_modules` instead.\n */\n tsconfig: {options: {paths?: unknown}}\n tsconfigPath: string\n}): IConfigFile {\n const {\n bundledPackages,\n distPath,\n exportPath,\n filePath,\n messages,\n projectFolder,\n mainEntryPointFilePath,\n tsconfig,\n tsconfigPath,\n } = options\n\n return {\n apiReport: {\n enabled: false,\n reportFileName: '<unscopedPackageName>.api.md',\n },\n bundledPackages,\n\n // 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`),\n compiler: tsconfig.options.paths\n ? {\n overrideTsconfig: {\n extends: tsconfigPath,\n compilerOptions: {\n // An empty object replaces whatever is in the original tsconfig file\n paths: {},\n },\n },\n }\n : {tsconfigFilePath: tsconfigPath},\n\n docModel: {\n enabled: false,\n apiJsonFilePath: path.resolve(distPath, `${exportPath}.api.json`),\n },\n dtsRollup: {\n // Types come from tsdown; this check only runs API Extractor's TSDoc/release-tag rules\n enabled: false,\n untrimmedFilePath: path.resolve(distPath, filePath),\n },\n tsdocMetadata: {\n enabled: false,\n },\n messages,\n mainEntryPointFilePath,\n projectFolder,\n }\n}\n","import {readFile} from 'node:fs/promises'\nimport {createRequire} from 'node:module'\nimport {TSDocConfigFile} from '@microsoft/tsdoc-config'\nimport {parse} from 'jsonc-parser'\nimport type {PackageTsdocCustomTag} from './types.ts'\n\nconst require = createRequire(import.meta.url)\n\n/** @internal */\nexport async function createTSDocConfig(opts: {\n customTags: PackageTsdocCustomTag[]\n}): Promise<TSDocConfigFile | undefined> {\n const {customTags} = opts\n\n if (customTags.length === 0) {\n return undefined\n }\n\n const tsDocBaseBuf = await readFile(\n require.resolve('@microsoft/api-extractor/extends/tsdoc-base.json'),\n )\n\n // Include the definitions that are required for API Extractor\n // extends: ['@microsoft/api-extractor/extends/tsdoc-base.json'],\n const tsDocBaseConfig = parse(tsDocBaseBuf.toString())\n\n // Define custom tags and specify how they should be parsed\n const tagDefinitions = (tsDocBaseConfig.tagDefinitions || []).concat(\n customTags.map((t) => ({\n tagName: `@${t.name}`,\n syntaxKind: t.syntaxKind,\n allowMultiple: t.allowMultiple,\n })),\n )\n\n // Indicate that custom tags are supported by your tooling.\n // (Without this, warnings may be reported saying that a tag is unsupported.)\n const supportForTags = {...tsDocBaseConfig.supportForTags}\n\n for (const customTag of customTags) {\n supportForTags[`@${customTag.name}`] = true\n }\n\n return TSDocConfigFile.loadFromObject({\n ...tsDocBaseConfig,\n noStandardTags: false,\n tagDefinitions,\n supportForTags,\n })\n}\n","import {ExtractorLogLevel, type IExtractorMessagesConfig} from '@microsoft/api-extractor'\nimport type {PackageTsdocOptions, PackageTsdocRuleLevel} from './types.ts'\n\nconst LOG_LEVELS: Record<PackageTsdocRuleLevel, ExtractorLogLevel> = {\n error: ExtractorLogLevel.Error,\n info: ExtractorLogLevel.Info,\n off: ExtractorLogLevel.None,\n warn: ExtractorLogLevel.Warning,\n}\n\n/** @internal */\nexport function getExtractMessagesConfig(options: {\n rules: PackageTsdocOptions['rules']\n disabled?: boolean\n}): IExtractorMessagesConfig {\n const {rules, disabled = false} = options\n\n function ruleToLogLevel(\n key: keyof NonNullable<PackageTsdocOptions['rules']>,\n defaultLevel?: ExtractorLogLevel,\n ) {\n const r = rules?.[key]\n\n return r ? LOG_LEVELS[r] : defaultLevel || ExtractorLogLevel.Warning\n }\n\n return {\n compilerMessageReporting: {\n default: {\n logLevel: disabled ? ExtractorLogLevel.None : ExtractorLogLevel.Warning,\n },\n },\n\n extractorMessageReporting: disabled\n ? {\n default: {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n }\n : {\n 'default': {\n logLevel: ExtractorLogLevel.Warning,\n addToApiReportFile: false,\n },\n\n 'ae-forgotten-export': {\n /**\n * This is hardcoded to `none` as it's no longer needed since TypeScript 5.5 https://github.com/microsoft/TypeScript/issues/42873\n * It's hardcoded to `none` since supported by API Extractor when using `module: 'Preserve'` doesn't support it well since `@microsoft/api-extractor` v7.49.0, which upgraded from TS 5.4 to 5.7 internally\n */\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n\n 'ae-incompatible-release-tags': {\n logLevel: ruleToLogLevel('ae-incompatible-release-tags', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'ae-internal-missing-underscore': {\n logLevel: ruleToLogLevel('ae-internal-missing-underscore'),\n addToApiReportFile: false,\n },\n\n 'ae-missing-release-tag': {\n logLevel: ruleToLogLevel('ae-missing-release-tag', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'ae-wrong-input-file-type': {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n },\n\n tsdocMessageReporting: disabled\n ? {\n default: {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n }\n : {\n 'default': {\n logLevel: ExtractorLogLevel.Warning,\n addToApiReportFile: false,\n },\n\n 'tsdoc-link-tag-unescaped-text': {\n logLevel: ruleToLogLevel('tsdoc-link-tag-unescaped-text', ExtractorLogLevel.Warning),\n addToApiReportFile: false,\n },\n\n 'tsdoc-undefined-tag': {\n logLevel: ruleToLogLevel('tsdoc-undefined-tag', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'tsdoc-unsupported-tag': {\n logLevel: ruleToLogLevel('tsdoc-unsupported-tag', ExtractorLogLevel.None),\n addToApiReportFile: false,\n },\n },\n }\n}\n","import {existsSync} from 'node:fs'\nimport path from 'node:path'\nimport {\n Extractor,\n ExtractorConfig,\n ExtractorLogLevel,\n type ExtractorMessage,\n} from '@microsoft/api-extractor'\n// The JS compiler API is loaded from the official `@typescript/typescript6` compat package\n// instead of the `typescript` peer dependency, as TypeScript 7 (the Go-native compiler) no longer\n// ships it\nimport ts from '@typescript/typescript6'\nimport {createApiExtractorConfig} from './createApiExtractorConfig.ts'\nimport {createTSDocConfig} from './createTSDocConfig.ts'\nimport {getExtractMessagesConfig} from './getExtractMessagesConfig.ts'\nimport type {PackageTsdocOptions} from './types.ts'\n\n/** @public */\nexport interface CheckTsdocLogger {\n log: (...args: unknown[]) => void\n warn: (...args: unknown[]) => void\n error: (...args: unknown[]) => void\n}\n\n/** @public */\nexport interface CheckTsdocOptions extends PackageTsdocOptions {\n /** Package root (directory containing `package.json`). */\n cwd: string\n /**\n * Absolute paths to the entry `.d.ts` / `.d.mts` / `.d.cts` files to check.\n * JS-only entries with no declarations are skipped automatically when listed.\n */\n entryDtsFiles: string[]\n /**\n * Path to the tsconfig used for the build, relative to `cwd` or absolute.\n * @defaultValue `'tsconfig.json'`\n */\n tsconfig?: string\n /**\n * Directory of distributed files (used for API Extractor's path mapping). Defaults to the\n * common parent of `entryDtsFiles`, or `dist` under `cwd` when the list is empty.\n */\n outDir?: string\n /**\n * When provided, messages are printed through this logger. Errors throw after reporting so\n * callers (and tsdown's `build:done` hook) fail the build.\n */\n logger?: CheckTsdocLogger\n}\n\n/** @public */\nexport interface CheckTsdocResult {\n messages: ExtractorMessage[]\n errorCount: number\n warningCount: number\n}\n\n/**\n * Run `@microsoft/api-extractor` against the given entry declaration files to check that TSDoc\n * tags are valid and release tags are correct. Import from `@sanity/tsdown-config/tsdoc`.\n * @public\n */\nexport async function checkTsdoc(options: CheckTsdocOptions): Promise<CheckTsdocResult> {\n const {\n cwd,\n entryDtsFiles,\n bundledPackages,\n customTags = [],\n rules = {},\n logger,\n outDir: outDirOption,\n } = options\n\n const tsconfigPath = path.resolve(cwd, options.tsconfig || 'tsconfig.json')\n const tsconfig = loadTSConfig({cwd, tsconfigPath})\n // api-extractor needs a `compilerOptions.outDir` for its path mapping; tsdown does not, so\n // fall back to the configured outDir / dist folder when the tsconfig leaves it unset\n const outDir =\n tsconfig?.options.outDir ??\n (outDirOption ? path.resolve(cwd, outDirOption) : undefined) ??\n commonParentDir(entryDtsFiles) ??\n path.resolve(cwd, 'dist')\n\n const tsdocConfigFile = await createTSDocConfig({customTags})\n const messagesConfig = getExtractMessagesConfig({rules})\n const allMessages: ExtractorMessage[] = []\n\n for (const exportPath of entryDtsFiles) {\n if (!existsSync(exportPath)) continue\n\n const relativeDtsPath = path.relative(outDir, exportPath)\n const extractorConfig = ExtractorConfig.prepare({\n configObject: createApiExtractorConfig({\n bundledPackages,\n distPath: outDir,\n exportPath,\n filePath: relativeDtsPath,\n messages: messagesConfig,\n projectFolder: cwd,\n mainEntryPointFilePath: exportPath,\n tsconfig: tsconfig ?? {options: {}},\n tsconfigPath,\n }),\n configObjectFullPath: undefined,\n tsdocConfigFile,\n packageJsonFullPath: path.resolve(cwd, 'package.json'),\n })\n\n Extractor.invoke(extractorConfig, {\n localBuild: true,\n showVerboseMessages: true,\n messageCallback(message: ExtractorMessage) {\n allMessages.push(message)\n message.handled = true\n },\n })\n }\n\n const warnings = allMessages.filter((msg) => msg.logLevel === ExtractorLogLevel.Warning)\n const errors = allMessages.filter((msg) => msg.logLevel === ExtractorLogLevel.Error)\n\n if (logger) {\n reportMessages(cwd, logger, warnings, errors)\n }\n\n if (errors.length) {\n throw new Error(\n `TSDoc/release-tag check failed with ${errors.length} error${errors.length === 1 ? '' : 's'}`,\n )\n }\n\n return {\n messages: allMessages,\n errorCount: errors.length,\n warningCount: warnings.length,\n }\n}\n\nfunction loadTSConfig(options: {\n cwd: string\n tsconfigPath: string\n}): ReturnType<typeof ts.parseJsonConfigFileContent> | undefined {\n const {cwd, tsconfigPath} = options\n // Resolve a relative name from `cwd` (e.g. `tsconfig.dist.json`); an absolute path is kept.\n let configPath: string | undefined\n if (path.isAbsolute(tsconfigPath)) {\n configPath = tsconfigPath\n } else {\n // oxlint-disable-next-line unbound-method\n configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n }\n if (!configPath || !existsSync(configPath)) return undefined\n // oxlint-disable-next-line unbound-method\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n // Relative `extends`/`include`/`paths` are resolved from the tsconfig's directory, not `cwd`\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath))\n}\n\nfunction commonParentDir(files: string[]): string | undefined {\n if (files.length === 0) return undefined\n let dir = path.dirname(files[0]!)\n for (const file of files.slice(1)) {\n while (dir !== path.dirname(dir) && !file.startsWith(dir + path.sep) && file !== dir) {\n dir = path.dirname(dir)\n }\n }\n return dir\n}\n\nfunction reportMessages(\n cwd: string,\n logger: CheckTsdocLogger,\n warnings: ExtractorMessage[],\n errors: ExtractorMessage[],\n): void {\n if (warnings.length) {\n logger.log()\n }\n\n for (const msg of warnings) {\n if (msg.messageId === 'TS6307') {\n // Ignore this warning:\n // > TS6307: <filename> is not in project file list.\n // > Projects must list all files or use an 'include' pattern.\n continue\n }\n const sourceFilePath = msg.sourceFilePath && path.relative(cwd, msg.sourceFilePath)\n logger.warn(\n `${sourceFilePath || '?'}:${msg.sourceFileLine}:${msg.sourceFileColumn} - warning ${msg.messageId}\\n${msg.text}\\n`,\n )\n }\n\n if (!warnings.length && errors.length) {\n logger.log()\n }\n\n for (const msg of errors) {\n const sourceFilePath = msg.sourceFilePath && path.relative(cwd, msg.sourceFilePath)\n logger.error(\n `${sourceFilePath || '?'}:${msg.sourceFileLine}:${msg.sourceFileColumn} - error ${msg.messageId}\\n${msg.text}\\n`,\n )\n }\n}\n"],"mappings":";;;;;;;;;AAIA,SAAgB,yBAAyB,SAczB;CACd,IAAM,EACJ,iBACA,UACA,YACA,UACA,UACA,eACA,wBACA,UACA,iBACE;CAEJ,OAAO;EACL,WAAW;GACT,SAAS;GACT,gBAAgB;EAClB;EACA;EAGA,UAAU,SAAS,QAAQ,QACvB,EACE,kBAAkB;GAChB,SAAS;GACT,iBAAiB,EAEf,OAAO,CAAC,EACV;EACF,EACF,IACA,EAAC,kBAAkB,aAAY;EAEnC,UAAU;GACR,SAAS;GACT,iBAAiB,KAAK,QAAQ,UAAU,GAAG,WAAW,UAAU;EAClE;EACA,WAAW;GAET,SAAS;GACT,mBAAmB,KAAK,QAAQ,UAAU,QAAQ;EACpD;EACA,eAAe,EACb,SAAS,GACX;EACA;EACA;EACA;CACF;AACF;AC7DA,MAAM,UAAU,cAAc,YAAY,GAAG;;AAG7C,eAAsB,kBAAkB,MAEC;CACvC,IAAM,EAAC,eAAc;CAErB,IAAI,WAAW,WAAW,GACxB;CAGF,IAAM,eAAe,MAAM,SACzB,QAAQ,QAAQ,kDAAkD,CACpE,GAIM,kBAAkB,MAAM,aAAa,SAAS,CAAC,GAG/C,kBAAkB,gBAAgB,kBAAkB,CAAC,EAAA,CAAG,OAC5D,WAAW,KAAK,OAAO;EACrB,SAAS,IAAI,EAAE;EACf,YAAY,EAAE;EACd,eAAe,EAAE;CACnB,EAAE,CACJ,GAIM,iBAAiB,EAAC,GAAG,gBAAgB,eAAc;CAEzD,KAAK,IAAM,aAAa,YACtB,eAAe,IAAI,UAAU,UAAU;CAGzC,OAAO,gBAAgB,eAAe;EACpC,GAAG;EACH,gBAAgB;EAChB;EACA;CACF,CAAC;AACH;AC9CA,MAAM,aAA+D;CACnE,OAAO,kBAAkB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C/G;CACF;AACF"}
1
+ {"version":3,"file":"tsdoc.mjs","names":[],"sources":["../src/tsdoc/createApiExtractorConfig.ts","../src/tsdoc/createTSDocConfig.ts","../src/tsdoc/getExtractMessagesConfig.ts","../src/tsdoc/synthesizedNamespaces.ts","../src/tsdoc/checkTsdoc.ts"],"sourcesContent":["import path from 'node:path'\nimport type {IConfigFile, IExtractorMessagesConfig} from '@microsoft/api-extractor'\n\n/** @internal */\nexport function createApiExtractorConfig(options: {\n bundledPackages?: string[]\n distPath: string\n exportPath: string\n filePath: string\n messages: IExtractorMessagesConfig\n projectFolder: string\n mainEntryPointFilePath: string\n /**\n * Only `compilerOptions.paths` is read: when present, API Extractor gets an override that\n * clears `paths` so self-referencing package imports resolve through `node_modules` instead.\n */\n tsconfig: {options: {paths?: unknown}}\n tsconfigPath: string\n}): IConfigFile {\n const {\n bundledPackages,\n distPath,\n exportPath,\n filePath,\n messages,\n projectFolder,\n mainEntryPointFilePath,\n tsconfig,\n tsconfigPath,\n } = options\n\n return {\n apiReport: {\n enabled: false,\n reportFileName: '<unscopedPackageName>.api.md',\n },\n bundledPackages,\n\n // 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`),\n compiler: tsconfig.options.paths\n ? {\n overrideTsconfig: {\n extends: tsconfigPath,\n compilerOptions: {\n // An empty object replaces whatever is in the original tsconfig file\n paths: {},\n },\n },\n }\n : {tsconfigFilePath: tsconfigPath},\n\n docModel: {\n enabled: false,\n apiJsonFilePath: path.resolve(distPath, `${exportPath}.api.json`),\n },\n dtsRollup: {\n // Types come from tsdown; this check only runs API Extractor's TSDoc/release-tag rules\n enabled: false,\n untrimmedFilePath: path.resolve(distPath, filePath),\n },\n tsdocMetadata: {\n enabled: false,\n },\n messages,\n mainEntryPointFilePath,\n projectFolder,\n }\n}\n","import {readFile} from 'node:fs/promises'\nimport {createRequire} from 'node:module'\nimport {TSDocConfigFile} from '@microsoft/tsdoc-config'\nimport {parse} from 'jsonc-parser'\nimport type {PackageTsdocCustomTag} from './types.ts'\n\nconst require = createRequire(import.meta.url)\n\n/** @internal */\nexport async function createTSDocConfig(opts: {\n customTags: PackageTsdocCustomTag[]\n}): Promise<TSDocConfigFile | undefined> {\n const {customTags} = opts\n\n if (customTags.length === 0) {\n return undefined\n }\n\n const tsDocBaseBuf = await readFile(\n require.resolve('@microsoft/api-extractor/extends/tsdoc-base.json'),\n )\n\n // Include the definitions that are required for API Extractor\n // extends: ['@microsoft/api-extractor/extends/tsdoc-base.json'],\n const tsDocBaseConfig = parse(tsDocBaseBuf.toString())\n\n // Define custom tags and specify how they should be parsed\n const tagDefinitions = (tsDocBaseConfig.tagDefinitions || []).concat(\n customTags.map((t) => ({\n tagName: `@${t.name}`,\n syntaxKind: t.syntaxKind,\n allowMultiple: t.allowMultiple,\n })),\n )\n\n // Indicate that custom tags are supported by your tooling.\n // (Without this, warnings may be reported saying that a tag is unsupported.)\n const supportForTags = {...tsDocBaseConfig.supportForTags}\n\n for (const customTag of customTags) {\n supportForTags[`@${customTag.name}`] = true\n }\n\n return TSDocConfigFile.loadFromObject({\n ...tsDocBaseConfig,\n noStandardTags: false,\n tagDefinitions,\n supportForTags,\n })\n}\n","import {ExtractorLogLevel, type IExtractorMessagesConfig} from '@microsoft/api-extractor'\nimport type {PackageTsdocOptions, PackageTsdocRuleLevel} from './types.ts'\n\nconst LOG_LEVELS: Record<PackageTsdocRuleLevel, ExtractorLogLevel> = {\n error: ExtractorLogLevel.Error,\n info: ExtractorLogLevel.Info,\n off: ExtractorLogLevel.None,\n warn: ExtractorLogLevel.Warning,\n}\n\n/** @internal */\nexport function getExtractMessagesConfig(options: {\n rules: PackageTsdocOptions['rules']\n disabled?: boolean\n}): IExtractorMessagesConfig {\n const {rules, disabled = false} = options\n\n function ruleToLogLevel(\n key: keyof NonNullable<PackageTsdocOptions['rules']>,\n defaultLevel?: ExtractorLogLevel,\n ) {\n const r = rules?.[key]\n\n return r ? LOG_LEVELS[r] : defaultLevel || ExtractorLogLevel.Warning\n }\n\n return {\n compilerMessageReporting: {\n default: {\n logLevel: disabled ? ExtractorLogLevel.None : ExtractorLogLevel.Warning,\n },\n },\n\n extractorMessageReporting: disabled\n ? {\n default: {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n }\n : {\n 'default': {\n logLevel: ExtractorLogLevel.Warning,\n addToApiReportFile: false,\n },\n\n 'ae-forgotten-export': {\n /**\n * This is hardcoded to `none` as it's no longer needed since TypeScript 5.5 https://github.com/microsoft/TypeScript/issues/42873\n * It's hardcoded to `none` since supported by API Extractor when using `module: 'Preserve'` doesn't support it well since `@microsoft/api-extractor` v7.49.0, which upgraded from TS 5.4 to 5.7 internally\n */\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n\n 'ae-incompatible-release-tags': {\n logLevel: ruleToLogLevel('ae-incompatible-release-tags', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'ae-internal-missing-underscore': {\n logLevel: ruleToLogLevel('ae-internal-missing-underscore'),\n addToApiReportFile: false,\n },\n\n 'ae-missing-release-tag': {\n logLevel: ruleToLogLevel('ae-missing-release-tag', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'ae-wrong-input-file-type': {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n },\n\n tsdocMessageReporting: disabled\n ? {\n default: {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n }\n : {\n 'default': {\n logLevel: ExtractorLogLevel.Warning,\n addToApiReportFile: false,\n },\n\n 'tsdoc-link-tag-unescaped-text': {\n logLevel: ruleToLogLevel('tsdoc-link-tag-unescaped-text', ExtractorLogLevel.Warning),\n addToApiReportFile: false,\n },\n\n 'tsdoc-undefined-tag': {\n logLevel: ruleToLogLevel('tsdoc-undefined-tag', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'tsdoc-unsupported-tag': {\n logLevel: ruleToLogLevel('tsdoc-unsupported-tag', ExtractorLogLevel.None),\n addToApiReportFile: false,\n },\n },\n }\n}\n","import {existsSync, readFileSync} from 'node:fs'\nimport path from 'node:path'\n// The JS compiler API is loaded from the official `@typescript/typescript6` compat package\n// instead of the `typescript` peer dependency, as TypeScript 7 (the Go-native compiler) no longer\n// ships it\nimport ts from '@typescript/typescript6'\n\n/**\n * The exports-object identifiers of rolldown's namespace interop: `<module>_exports` (the\n * declaration bundling pass names them after the virtual declaration module, e.g. `inner.d.ts`\n * → `inner_d_exports`), with rolldown's `$<n>` suffix when deconflicting renames one.\n */\nconst RE_WRAPPER_NAME = /_exports(\\$\\d+)?$/\n\n/** Matches the relative specifiers of emitted sibling chunks (`./chunk-<hash>.js`). */\nconst RE_RELATIVE_SPECIFIER = /^\\.\\.?\\//\n\n/**\n * Finds the local names of the `declare namespace <name>_exports {…}` wrappers that the\n * declaration bundling pass (tsdown / rolldown-plugin-dts) synthesizes for namespace re-exports\n * like `export * as ns from './module'` (or `import * as ns` + `export {ns}`).\n *\n * Bundling loses the doc comment of the re-export statement, so the wrapper cannot carry a\n * release tag — there is no way to tag it from userland, and API Extractor would flag it with\n * `ae-missing-release-tag` (https://github.com/sanity-io/pkg-utils/issues/3281). Skipping it\n * matches how API Extractor treats the equivalent namespace of its own rollups (it never\n * checks those). The members re-exported through the wrapper keep their own doc comments in\n * the output; API Extractor does not flag them individually either way (only directly exported\n * declarations are consumable entities of the missing-release-tag check).\n *\n * A name only qualifies when all of these hold, so user-authored symbols that merely resemble\n * the interop naming stay checked:\n *\n * - it matches rolldown's `<module>_exports` naming (with an optional `$<n>` deconflict suffix)\n * - it is declared as a namespace — in the entry itself, or in a sibling chunk the entry\n * imports (a wrapper shared by several entries lives in the chunk that owns the module's\n * declarations)\n * - that namespace has the synthesized body shape: nothing but `export { … };` specifier lists\n * pointing at sibling declarations of the same file. A user-authored namespace declares its\n * own members (`declare namespace config_exports { const userValue: string; }`), and those\n * members are what the author tags — so it stays checked even when the bundler's\n * deconflicting hands it a wrapper-shaped name\n * - the entry does not export the name unaliased: a synthesized wrapper is always re-exported\n * under the alias of the original namespace re-export (`export { inner_d_exports as inner }`),\n * while an unaliased export (`export { foo_exports }`, `export declare namespace foo_exports`)\n * is a name the author chose — and can tag\n * @internal\n */\nexport function collectSynthesizedNamespaceWrappers(entryDtsFile: string): Set<string> {\n const entry = parseDts(entryDtsFile)\n if (!entry) return new Set()\n\n const unaliasedExports = new Set<string>()\n const wrapperShapedNames = new Set<string>()\n const chunkFiles = new Set<string>()\n\n for (const statement of entry.statements) {\n collectWrapperShapedNamespaceName(statement, wrapperShapedNames)\n\n if (ts.isExportDeclaration(statement)) {\n const {exportClause} = statement\n if (exportClause && ts.isNamedExports(exportClause)) {\n for (const element of exportClause.elements) {\n if (!element.propertyName || element.propertyName.text === element.name.text) {\n unaliasedExports.add(element.name.text)\n }\n }\n } else if (exportClause && ts.isNamespaceExport(exportClause)) {\n unaliasedExports.add(exportClause.name.text)\n }\n collectChunkFile(entryDtsFile, statement.moduleSpecifier, chunkFiles)\n } else if (ts.isImportDeclaration(statement)) {\n collectChunkFile(entryDtsFile, statement.moduleSpecifier, chunkFiles)\n } else {\n collectExportedDeclarationNames(statement, unaliasedExports)\n }\n }\n\n for (const chunkFile of chunkFiles) {\n const chunk = parseDts(chunkFile)\n if (!chunk) continue\n for (const statement of chunk.statements) {\n collectWrapperShapedNamespaceName(statement, wrapperShapedNames)\n }\n }\n\n const wrappers = new Set<string>()\n for (const name of wrapperShapedNames) {\n if (RE_WRAPPER_NAME.test(name) && !unaliasedExports.has(name)) wrappers.add(name)\n }\n return wrappers\n}\n\nfunction parseDts(filePath: string): ts.SourceFile | undefined {\n if (!existsSync(filePath)) return undefined\n return ts.createSourceFile(\n filePath,\n readFileSync(filePath, 'utf8'),\n ts.ScriptTarget.Latest,\n false,\n )\n}\n\n/**\n * Collects the name of a top-level `declare namespace <Identifier> {…}` statement whose body has\n * the shape the declaration bundling pass synthesizes: only `export { … };` specifier lists\n * naming sibling declarations of the same file, never members of its own. Every namespace\n * re-export the bundler rewrites comes out that way, whatever the re-exported module holds\n * (values, types, a default export, further namespace re-exports).\n */\nfunction collectWrapperShapedNamespaceName(statement: ts.Statement, names: Set<string>): void {\n if (\n !ts.isModuleDeclaration(statement) ||\n !ts.isIdentifier(statement.name) ||\n (statement.flags & ts.NodeFlags.Namespace) === 0\n ) {\n return\n }\n\n const {body} = statement\n if (!body || !ts.isModuleBlock(body)) return\n\n const onlyReExportsSiblings = body.statements.every(\n (member) =>\n ts.isExportDeclaration(member) &&\n !member.moduleSpecifier &&\n member.exportClause !== undefined &&\n ts.isNamedExports(member.exportClause),\n )\n if (!onlyReExportsSiblings) return\n\n names.add(statement.name.text)\n}\n\n/**\n * Collects the names a declaration with an `export` modifier exports directly, e.g.\n * `export declare namespace foo_exports {…}` — those names are user-chosen (the author can\n * tag them), unlike the alias-only re-export of a synthesized wrapper.\n */\nfunction collectExportedDeclarationNames(statement: ts.Statement, names: Set<string>): void {\n const modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined\n if (!modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) return\n\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name)) names.add(declaration.name.text)\n }\n } else if (\n (ts.isFunctionDeclaration(statement) ||\n ts.isClassDeclaration(statement) ||\n ts.isInterfaceDeclaration(statement) ||\n ts.isTypeAliasDeclaration(statement) ||\n ts.isEnumDeclaration(statement)) &&\n statement.name\n ) {\n names.add(statement.name.text)\n } else if (ts.isModuleDeclaration(statement) && ts.isIdentifier(statement.name)) {\n names.add(statement.name.text)\n }\n}\n\n/**\n * Resolves the sibling chunk file a relative import/export specifier points at, mapping the\n * runtime extension to the declaration extension the chunk is emitted with on disk\n * (`./chunk.js` → `./chunk.d.ts`, like the declaration output of the bundling pass itself).\n */\nfunction collectChunkFile(\n entryDtsFile: string,\n moduleSpecifier: ts.Expression | undefined,\n files: Set<string>,\n): void {\n if (!moduleSpecifier || !ts.isStringLiteral(moduleSpecifier)) return\n const specifier = moduleSpecifier.text\n if (!RE_RELATIVE_SPECIFIER.test(specifier)) return\n const dtsFile = specifierToDtsFile(specifier)\n if (!dtsFile) return\n files.add(path.resolve(path.dirname(entryDtsFile), dtsFile))\n}\n\n/** `./chunk.js` → `./chunk.d.ts` (`.mjs` → `.d.mts`, `.cjs` → `.d.cts`). */\nfunction specifierToDtsFile(specifier: string): string | undefined {\n if (/\\.d\\.[mc]?ts$/.test(specifier)) return specifier\n if (specifier.endsWith('.mjs')) return `${specifier.slice(0, -4)}.d.mts`\n if (specifier.endsWith('.cjs')) return `${specifier.slice(0, -4)}.d.cts`\n if (specifier.endsWith('.js')) return `${specifier.slice(0, -3)}.d.ts`\n return undefined\n}\n","import {existsSync} from 'node:fs'\nimport path from 'node:path'\nimport {\n Extractor,\n ExtractorConfig,\n ExtractorLogLevel,\n type ExtractorMessage,\n} from '@microsoft/api-extractor'\n// The JS compiler API is loaded from the official `@typescript/typescript6` compat package\n// instead of the `typescript` peer dependency, as TypeScript 7 (the Go-native compiler) no longer\n// ships it\nimport ts from '@typescript/typescript6'\nimport {createApiExtractorConfig} from './createApiExtractorConfig.ts'\nimport {createTSDocConfig} from './createTSDocConfig.ts'\nimport {getExtractMessagesConfig} from './getExtractMessagesConfig.ts'\nimport {collectSynthesizedNamespaceWrappers} from './synthesizedNamespaces.ts'\nimport type {PackageTsdocOptions} from './types.ts'\n\n/** @public */\nexport interface CheckTsdocLogger {\n log: (...args: unknown[]) => void\n warn: (...args: unknown[]) => void\n error: (...args: unknown[]) => void\n}\n\n/** @public */\nexport interface CheckTsdocOptions extends PackageTsdocOptions {\n /** Package root (directory containing `package.json`). */\n cwd: string\n /**\n * Absolute paths to the entry `.d.ts` / `.d.mts` / `.d.cts` files to check.\n * JS-only entries with no declarations are skipped automatically when listed.\n */\n entryDtsFiles: string[]\n /**\n * Path to the tsconfig used for the build, relative to `cwd` or absolute.\n * @defaultValue `'tsconfig.json'`\n */\n tsconfig?: string\n /**\n * Directory of distributed files (used for API Extractor's path mapping). Defaults to the\n * common parent of `entryDtsFiles`, or `dist` under `cwd` when the list is empty.\n */\n outDir?: string\n /**\n * When provided, messages are printed through this logger. Errors throw after reporting so\n * callers (and tsdown's `build:done` hook) fail the build.\n */\n logger?: CheckTsdocLogger\n}\n\n/** @public */\nexport interface CheckTsdocResult {\n messages: ExtractorMessage[]\n errorCount: number\n warningCount: number\n}\n\n/**\n * Run `@microsoft/api-extractor` against the given entry declaration files to check that TSDoc\n * tags are valid and release tags are correct. Import from `@sanity/tsdown-config/tsdoc`.\n * @public\n */\nexport async function checkTsdoc(options: CheckTsdocOptions): Promise<CheckTsdocResult> {\n const {\n cwd,\n entryDtsFiles,\n bundledPackages,\n customTags = [],\n rules = {},\n logger,\n outDir: outDirOption,\n } = options\n\n const tsconfigPath = path.resolve(cwd, options.tsconfig || 'tsconfig.json')\n const tsconfig = loadTSConfig({cwd, tsconfigPath})\n // api-extractor needs a `compilerOptions.outDir` for its path mapping; tsdown does not, so\n // fall back to the configured outDir / dist folder when the tsconfig leaves it unset\n const outDir =\n tsconfig?.options.outDir ??\n (outDirOption ? path.resolve(cwd, outDirOption) : undefined) ??\n commonParentDir(entryDtsFiles) ??\n path.resolve(cwd, 'dist')\n\n const tsdocConfigFile = await createTSDocConfig({customTags})\n const messagesConfig = getExtractMessagesConfig({rules})\n const allMessages: ExtractorMessage[] = []\n\n for (const exportPath of entryDtsFiles) {\n if (!existsSync(exportPath)) continue\n\n // The declaration bundling pass synthesizes `declare namespace <name>_exports` wrappers\n // for namespace re-exports and loses the doc comment of the re-export statement, so the\n // wrappers can never carry a release tag — `ae-missing-release-tag` skips them.\n // https://github.com/sanity-io/pkg-utils/issues/3281\n const synthesizedWrappers = collectSynthesizedNamespaceWrappers(exportPath)\n const relativeDtsPath = path.relative(outDir, exportPath)\n const extractorConfig = ExtractorConfig.prepare({\n configObject: createApiExtractorConfig({\n bundledPackages,\n distPath: outDir,\n exportPath,\n filePath: relativeDtsPath,\n messages: messagesConfig,\n projectFolder: cwd,\n mainEntryPointFilePath: exportPath,\n tsconfig: tsconfig ?? {options: {}},\n tsconfigPath,\n }),\n configObjectFullPath: undefined,\n tsdocConfigFile,\n packageJsonFullPath: path.resolve(cwd, 'package.json'),\n })\n\n Extractor.invoke(extractorConfig, {\n localBuild: true,\n showVerboseMessages: true,\n messageCallback(message: ExtractorMessage) {\n message.handled = true\n if (isSynthesizedNamespaceWrapperMessage(message, synthesizedWrappers)) return\n allMessages.push(message)\n },\n })\n }\n\n const warnings = allMessages.filter((msg) => msg.logLevel === ExtractorLogLevel.Warning)\n const errors = allMessages.filter((msg) => msg.logLevel === ExtractorLogLevel.Error)\n\n if (logger) {\n reportMessages(cwd, logger, warnings, errors)\n }\n\n if (errors.length) {\n throw new Error(\n `TSDoc/release-tag check failed with ${errors.length} error${errors.length === 1 ? '' : 's'}`,\n )\n }\n\n return {\n messages: allMessages,\n errorCount: errors.length,\n warningCount: warnings.length,\n }\n}\n\nfunction loadTSConfig(options: {\n cwd: string\n tsconfigPath: string\n}): ReturnType<typeof ts.parseJsonConfigFileContent> | undefined {\n const {cwd, tsconfigPath} = options\n // Resolve a relative name from `cwd` (e.g. `tsconfig.dist.json`); an absolute path is kept.\n let configPath: string | undefined\n if (path.isAbsolute(tsconfigPath)) {\n configPath = tsconfigPath\n } else {\n // oxlint-disable-next-line unbound-method\n configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n }\n if (!configPath || !existsSync(configPath)) return undefined\n // oxlint-disable-next-line unbound-method\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n // Relative `extends`/`include`/`paths` are resolved from the tsconfig's directory, not `cwd`\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath))\n}\n\n/** The quoted symbol name leading api-extractor's `ae-missing-release-tag` message text. */\nconst RE_MISSING_RELEASE_TAG_SYMBOL = /^\"([^\"]+)\" is part of the package's API/\n\n/**\n * Whether a message is an `ae-missing-release-tag` complaint about a namespace wrapper the\n * declaration bundling pass synthesized (which userland can never tag). The flagged symbol is\n * only identifiable through the message text: api-extractor quotes the local name of the\n * declaration, and attaches no structured properties (its source location maps through\n * `.d.ts.map` files, often landing on an unrelated source position).\n */\nfunction isSynthesizedNamespaceWrapperMessage(\n message: ExtractorMessage,\n synthesizedWrappers: Set<string>,\n): boolean {\n if (synthesizedWrappers.size === 0 || message.messageId !== 'ae-missing-release-tag') {\n return false\n }\n const symbolName = RE_MISSING_RELEASE_TAG_SYMBOL.exec(message.text)?.[1]\n return symbolName !== undefined && synthesizedWrappers.has(symbolName)\n}\n\nfunction commonParentDir(files: string[]): string | undefined {\n if (files.length === 0) return undefined\n let dir = path.dirname(files[0]!)\n for (const file of files.slice(1)) {\n while (dir !== path.dirname(dir) && !file.startsWith(dir + path.sep) && file !== dir) {\n dir = path.dirname(dir)\n }\n }\n return dir\n}\n\nfunction reportMessages(\n cwd: string,\n logger: CheckTsdocLogger,\n warnings: ExtractorMessage[],\n errors: ExtractorMessage[],\n): void {\n if (warnings.length) {\n logger.log()\n }\n\n for (const msg of warnings) {\n if (msg.messageId === 'TS6307') {\n // Ignore this warning:\n // > TS6307: <filename> is not in project file list.\n // > Projects must list all files or use an 'include' pattern.\n continue\n }\n const sourceFilePath = msg.sourceFilePath && path.relative(cwd, msg.sourceFilePath)\n logger.warn(\n `${sourceFilePath || '?'}:${msg.sourceFileLine}:${msg.sourceFileColumn} - warning ${msg.messageId}\\n${msg.text}\\n`,\n )\n }\n\n if (!warnings.length && errors.length) {\n logger.log()\n }\n\n for (const msg of errors) {\n const sourceFilePath = msg.sourceFilePath && path.relative(cwd, msg.sourceFilePath)\n logger.error(\n `${sourceFilePath || '?'}:${msg.sourceFileLine}:${msg.sourceFileColumn} - error ${msg.messageId}\\n${msg.text}\\n`,\n )\n }\n}\n"],"mappings":";;;;;;;;;AAIA,SAAgB,yBAAyB,SAczB;CACd,IAAM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AkB,KAAK,SAAS,KAAK,IAAI,cAAc;EAClF,OAAO,KACL,GAAG,kBAAkB,IAAI,GAAG,IAAI,eAAe,GAAG,IAAI,iBAAiB,aAAa,IAAI,UAAU,IAAI,IAAI,KAAK,GACjH;CACF;CAEA,AAAI,CAAC,SAAS,UAAU,OAAO,UAC7B,OAAO,IAAI;CAGb,KAAK,IAAM,OAAO,QAAQ;EACxB,IAAM,iBAAiB,IAAI,kBAAkB,KAAK,SAAS,KAAK,IAAI,cAAc;EAClF,OAAO,MACL,GAAG,kBAAkB,IAAI,GAAG,IAAI,eAAe,GAAG,IAAI,iBAAiB,WAAW,IAAI,UAAU,IAAI,IAAI,KAAK,GAC/G;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/tsdown-config",
3
- "version": "0.24.0",
3
+ "version": "0.24.2",
4
4
  "description": "Shared configuration for tsdown",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -43,23 +43,23 @@
43
43
  "@sanity/browserslist-config": "^1.0.5",
44
44
  "@typescript/typescript6": "^6.0.2",
45
45
  "@vitejs/plugin-react": "^6.0.5",
46
- "browserslist": "^4.28.7",
46
+ "browserslist": "^4.28.8",
47
47
  "jsonc-parser": "^3.3.1",
48
48
  "lightningcss": "^1.33.0",
49
49
  "package-manager-detector": "^1.8.0",
50
50
  "publint": "^0.3.23",
51
- "@sanity/vanilla-extract-tsdown-plugin": "^0.3.0"
51
+ "@sanity/vanilla-extract-tsdown-plugin": "^0.3.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@tsdown/css": "^0.22.14",
55
55
  "@types/babel__core": "^7.20.5",
56
56
  "babel-plugin-react-compiler": "^1.0.0",
57
- "rolldown": "~1.2.0",
57
+ "rolldown": "~1.2.4",
58
58
  "tinyexec": "^1.3.0",
59
59
  "tsdown": "^0.22.14",
60
60
  "typescript": "7.0.2",
61
61
  "vitest": "^4.1.10",
62
- "@sanity/pkg-utils": "^12.1.0",
62
+ "@sanity/pkg-utils": "^12.1.3",
63
63
  "@sanity/tsconfig": "^2.2.1"
64
64
  },
65
65
  "peerDependencies": {