@sanity/pkg-utils 11.0.4 → 11.0.6

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.
@@ -36,8 +36,14 @@ function resolveVanillaExtract(config) {
36
36
  function resolveVanillaExtractCssName(options, context) {
37
37
  return options.extract?.name ? options.extract.name : context.compatMode ? DEFAULT_VANILLA_EXTRACT_CSS_NAME : context.runtime === "node" ? "bundle.node.css" : context.runtime === "browser" ? "bundle.browser.css" : DEFAULT_VANILLA_EXTRACT_CSS_NAME;
38
38
  }
39
- function createConditionalCssExport(cssFile, shimFile) {
40
- return { browser: cssFile, style: cssFile, node: shimFile, default: shimFile };
39
+ function cssShimFileName(cssFileName) {
40
+ return `${cssFileName.replace(/\.css$/, "-css")}.js`;
41
+ }
42
+ function cssShimDtsFileName(cssFileName) {
43
+ return `${cssFileName.replace(/\.css$/, "-css")}.d.ts`;
44
+ }
45
+ function createConditionalCssExport(cssFile, shimFile, shimDtsFile) {
46
+ return { types: shimDtsFile, browser: cssFile, style: cssFile, node: shimFile, default: shimFile };
41
47
  }
42
48
  function hasMatchingExport(value, expected) {
43
49
  if (typeof value != "object" || value === null) return !1;
@@ -58,7 +64,7 @@ function detectIndent(source) {
58
64
  return indent.includes(" ") ? " " : indent.length;
59
65
  }
60
66
  async function writeBundleCssExports(options) {
61
- const { cwd, distPath, cssName, logger } = options, pkgPath = path.resolve(cwd, "package.json"), source = await readFile(pkgPath, "utf8"), pkg = JSON.parse(source), distRel = (path.relative(cwd, distPath) || "dist").split(path.sep).join("/"), exportKey = `./${cssName}`, cssFile = `./${path.posix.join(distRel, cssName)}`, shimFile = `./${path.posix.join(distRel, `${cssName}.js`)}`, conditionalExport = createConditionalCssExport(cssFile, shimFile), publishConfig = pkg.publishConfig, publishConfigExports = isRecord(publishConfig?.exports) ? publishConfig.exports : void 0, exportsMatch = hasMatchingExport(pkg.exports?.[exportKey], conditionalExport), publishConfigExportsMatch = !publishConfigExports || hasMatchingExport(publishConfigExports[exportKey], conditionalExport);
67
+ const { cwd, distPath, cssName, logger } = options, pkgPath = path.resolve(cwd, "package.json"), source = await readFile(pkgPath, "utf8"), pkg = JSON.parse(source), distRel = (path.relative(cwd, distPath) || "dist").split(path.sep).join("/"), exportKey = `./${cssName}`, cssFile = `./${path.posix.join(distRel, cssName)}`, shimFile = `./${path.posix.join(distRel, cssShimFileName(cssName))}`, shimDtsFile = `./${path.posix.join(distRel, cssShimDtsFileName(cssName))}`, conditionalExport = createConditionalCssExport(cssFile, shimFile, shimDtsFile), publishConfig = pkg.publishConfig, publishConfigExports = isRecord(publishConfig?.exports) ? publishConfig.exports : void 0, exportsMatch = hasMatchingExport(pkg.exports?.[exportKey], conditionalExport), publishConfigExportsMatch = !publishConfigExports || hasMatchingExport(publishConfigExports[exportKey], conditionalExport);
62
68
  exportsMatch && publishConfigExportsMatch || (pkg.exports = insertCssExport(pkg.exports ?? {}, exportKey, conditionalExport), publishConfig && publishConfigExports && (publishConfig.exports = insertCssExport(publishConfigExports, exportKey, conditionalExport)), await writeFile(pkgPath, `${JSON.stringify(pkg, null, detectIndent(source))}
63
69
  `), logger.log(
64
70
  `Updated package.json: added \`exports["${exportKey}"]\`${publishConfigExports ? ` and \`publishConfig.exports["${exportKey}"]\`` : ""} for vanilla-extract compat mode`
@@ -418,13 +424,13 @@ function replaceFileEnding(filePath) {
418
424
  }
419
425
  }
420
426
  function bundleCssShim(options) {
421
- const cssName = options.fileName.replace(/\.js$/, "");
427
+ const { cssName } = options, shimFileName = cssShimFileName(cssName);
422
428
  return {
423
429
  name: "pkg-utils:bundle-css-shim",
424
430
  generateBundle() {
425
431
  this.emitFile({
426
432
  type: "asset",
427
- fileName: options.fileName,
433
+ fileName: shimFileName,
428
434
  source: `// No-op shim for \`${cssName}\` in runtimes that cannot import \`.css\` files directly.
429
435
  export default ""
430
436
  `
@@ -434,6 +440,13 @@ export default ""
434
440
  source: `// Type declarations for \`${cssName}\` and its no-op JS shim.
435
441
  declare const _default: string
436
442
  export default _default
443
+ `
444
+ }), this.emitFile({
445
+ type: "asset",
446
+ fileName: cssShimDtsFileName(cssName),
447
+ source: `// Type declarations for \`${cssName}\` and its no-op JS shim.
448
+ declare const _default: string
449
+ export default _default
437
450
  `
438
451
  });
439
452
  }
@@ -547,8 +560,9 @@ function resolveRollupConfig(ctx, buildTask) {
547
560
  minify: vanillaExtract.options.minify ?? !0
548
561
  }),
549
562
  // In compat mode, emit the no-op JS shim that the `node`/`default` conditions of the
550
- // `./<css>` export resolve to.
551
- vanillaExtract.compatMode && bundleCssShim({ fileName: `${vanillaExtractCssName}.js` }),
563
+ // `./<css>` export resolve to (named `bundle-css.js`, not `bundle.css.js`, so it does not
564
+ // match vanilla-extract's `cssFileFilter`).
565
+ vanillaExtract.compatMode && bundleCssShim({ cssName: vanillaExtractCssName }),
552
566
  (config?.babel?.reactCompiler || enableStyledComponents) && babel({
553
567
  babelrc: !1,
554
568
  presets: ["@babel/preset-typescript"],
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/node/core/config/vanillaExtract.ts","../../src/node/core/pkg/writeBundleCssExports.ts","../../src/node/tasks/dts/printDiagnostic.ts","../../src/node/tasks/dts/buildTypes.ts","../../src/node/tasks/dts/DtsError.ts","../../src/node/tasks/dts/extractTypes.ts","../../src/node/tasks/dts/doExtract.ts","../../src/node/tasks/dts/dtsTask.ts","../../src/node/tasks/dts/dtsWatchTask.ts","../../src/node/tasks/rolldown/rolldownDtsTask.ts","../../src/node/tasks/rollup/bundleCssShim.ts","../../src/node/tasks/rollup/optimizeCss.ts","../../src/node/tasks/rollup/resolveRollupConfig.ts","../../src/node/tasks/rollup/rollupTask.ts","../../src/node/tasks/rollup/rollupWatchTask.ts","../../src/node/tasks/index.ts"],"sourcesContent":["import type {PkgConfigOptions, PkgRuntime, PkgVanillaExtractOptions} from './types.ts'\n\n/** The default name of the extracted CSS file. */\nconst DEFAULT_VANILLA_EXTRACT_CSS_NAME = 'bundle.css'\n\nexport interface ResolvedVanillaExtract {\n enabled: boolean\n /** Normalized options (the object form, or `{}` when `vanillaExtract: true`). */\n options: PkgVanillaExtractOptions\n /**\n * Whether to automatically wire up the conditional CSS export pattern (intro import, JS shim, and\n * the `package.json` export). Only `true` when vanilla-extract is enabled.\n */\n compatMode: boolean\n}\n\n/**\n * Normalize the `rollup.vanillaExtract` config into a consistent shape and resolve whether\n * compatibility mode is active.\n * @internal\n */\nexport function resolveVanillaExtract(\n config: PkgConfigOptions | undefined,\n): ResolvedVanillaExtract {\n const value = config?.rollup?.vanillaExtract\n const enabled = Boolean(value)\n const options: PkgVanillaExtractOptions = value === true || !value ? {} : value\n const compatMode = enabled ? (options.extract?.compatMode ?? true) : false\n\n return {enabled, options, compatMode}\n}\n\n/**\n * Resolve the name of the emitted CSS file. In compat mode this is a stable, runtime-independent\n * name (so it can back a single conditional export); otherwise it keeps the historical\n * runtime-suffixed defaults.\n * @internal\n */\nexport function resolveVanillaExtractCssName(\n options: PkgVanillaExtractOptions,\n context: {compatMode: boolean; runtime: PkgRuntime},\n): string {\n if (options.extract?.name) {\n return options.extract.name\n }\n\n if (context.compatMode) {\n return DEFAULT_VANILLA_EXTRACT_CSS_NAME\n }\n\n if (context.runtime === 'node') return 'bundle.node.css'\n if (context.runtime === 'browser') return 'bundle.browser.css'\n return DEFAULT_VANILLA_EXTRACT_CSS_NAME\n}\n","import {readFile, writeFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport type {Logger} from '../../logger.ts'\nimport {isRecord} from '../isRecord.ts'\n\n/**\n * Build the conditional CSS export object that vanilla-extract compat mode expects, e.g.\n * ```json\n * {\n * \"browser\": \"./dist/bundle.css\",\n * \"style\": \"./dist/bundle.css\",\n * \"node\": \"./dist/bundle.css.js\",\n * \"default\": \"./dist/bundle.css.js\"\n * }\n * ```\n */\nfunction createConditionalCssExport(cssFile: string, shimFile: string) {\n return {browser: cssFile, style: cssFile, node: shimFile, default: shimFile}\n}\n\nfunction hasMatchingExport(value: unknown, expected: Record<string, string>): boolean {\n if (typeof value !== 'object' || value === null) return false\n const actual = Object.fromEntries(Object.entries(value))\n const keys = Object.keys(expected)\n return (\n keys.length === Object.keys(actual).length && keys.every((key) => actual[key] === expected[key])\n )\n}\n\n/**\n * Insert (or replace) the `\"./<cssName>\"` export in an `exports`-shaped map, preserving the existing\n * order and placing it before `./package.json` when present.\n */\nfunction insertCssExport(\n exports: Record<string, unknown>,\n exportKey: string,\n conditionalExport: Record<string, string>,\n): Record<string, unknown> {\n const nextExports: Record<string, unknown> = {}\n let inserted = false\n for (const [key, value] of Object.entries(exports)) {\n if (key === exportKey) continue\n if (key === './package.json' && !inserted) {\n nextExports[exportKey] = conditionalExport\n inserted = true\n }\n nextExports[key] = value\n }\n if (!inserted) {\n nextExports[exportKey] = conditionalExport\n }\n return nextExports\n}\n\nfunction detectIndent(source: string): string | number {\n const match = source.match(/\\n([ \\t]+)\\S/)\n if (!match) return 2\n const indent = match[1]!\n return indent.includes('\\t') ? '\\t' : indent.length\n}\n\n/**\n * Write the conditional `\"./<cssName>\"` export to `package.json` (used by vanilla-extract compat\n * mode), so userland does not have to maintain it by hand. The write is idempotent: if the export\n * already matches, the file is left untouched.\n *\n * When `publishConfig.exports` is present, the same conditional CSS export is mirrored into it. The\n * conditional CSS export has no `source`/`development`/`monorepo` conditions to strip, so the entry\n * is identical in both places. Keeping them in sync prevents the `publishConfig.exports` validation\n * from failing with a \"missing export path\" error for the auto-added `./<cssName>` export.\n *\n * @internal\n */\nexport async function writeBundleCssExports(options: {\n cwd: string\n distPath: string\n cssName: string\n logger: Logger\n}): Promise<void> {\n const {cwd, distPath, cssName, logger} = options\n\n const pkgPath = path.resolve(cwd, 'package.json')\n const source = await readFile(pkgPath, 'utf8')\n // oxlint-disable-next-line no-unsafe-type-assertion\n const pkg = JSON.parse(source) as {\n exports?: Record<string, unknown>\n publishConfig?: {exports?: Record<string, unknown>}\n }\n\n // Normalize to POSIX separators - `path.relative` uses `\\\\` on Windows, but `exports` paths in\n // package.json must always use `/`.\n const distRel = (path.relative(cwd, distPath) || 'dist').split(path.sep).join('/')\n const exportKey = `./${cssName}`\n const cssFile = `./${path.posix.join(distRel, cssName)}`\n const shimFile = `./${path.posix.join(distRel, `${cssName}.js`)}`\n const conditionalExport = createConditionalCssExport(cssFile, shimFile)\n\n // Only mirror into `publishConfig.exports` when it already exists; never create it here.\n const publishConfig = pkg.publishConfig\n const publishConfigExports = isRecord(publishConfig?.exports) ? publishConfig.exports : undefined\n\n const exportsMatch = hasMatchingExport(pkg.exports?.[exportKey], conditionalExport)\n const publishConfigExportsMatch =\n !publishConfigExports || hasMatchingExport(publishConfigExports[exportKey], conditionalExport)\n\n if (exportsMatch && publishConfigExportsMatch) {\n return\n }\n\n pkg.exports = insertCssExport(pkg.exports ?? {}, exportKey, conditionalExport)\n\n if (publishConfig && publishConfigExports) {\n publishConfig.exports = insertCssExport(publishConfigExports, exportKey, conditionalExport)\n }\n\n await writeFile(pkgPath, `${JSON.stringify(pkg, null, detectIndent(source))}\\n`)\n logger.log(\n `Updated package.json: added \\`exports[\"${exportKey}\"]\\`${\n publishConfigExports ? ` and \\`publishConfig.exports[\"${exportKey}\"]\\`` : ''\n } for vanilla-extract compat mode`,\n )\n}\n","import path from 'node:path'\nimport ts from '@typescript/typescript6'\nimport chalk from 'chalk'\nimport type {Logger} from '../../logger.ts'\n\nexport function printDiagnostic(options: {\n cwd: string\n logger: Logger\n diagnostic: ts.Diagnostic\n}): void {\n const {cwd, logger, diagnostic} = options\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const {line, character} = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start)\n const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n')\n\n const file = path.relative(cwd, diagnostic.file.fileName)\n\n const output = [\n `${chalk.yellow(file)}:${chalk.blue(line + 1)}:${chalk.blue(character + 1)} - `,\n `${chalk.gray(`TS${diagnostic.code}:`)} ${message}`,\n ].join('')\n\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n logger.error(output)\n }\n\n if (diagnostic.category === ts.DiagnosticCategory.Warning) {\n logger.warn(output)\n }\n\n if (diagnostic.category === ts.DiagnosticCategory.Message) {\n logger.log(output)\n }\n\n if (diagnostic.category === ts.DiagnosticCategory.Suggestion) {\n logger.log(output)\n }\n } else {\n logger.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n }\n}\n","import ts from '@typescript/typescript6'\nimport type {Logger} from '../../logger.ts'\nimport {printDiagnostic} from './printDiagnostic.ts'\n\n/** @internal */\nexport async function buildTypes(options: {\n cwd: string\n logger: Logger\n outDir: string\n tsconfig: ts.ParsedCommandLine\n strict: boolean\n checkTypes?: boolean\n}): Promise<void> {\n const {cwd, logger, outDir, tsconfig, strict, checkTypes} = options\n\n const compilerOptions: ts.CompilerOptions = {\n ...tsconfig.options,\n declaration: true,\n declarationDir: outDir,\n emitDeclarationOnly: true,\n noEmit: false,\n noEmitOnError: strict ? true : (tsconfig.options.noEmitOnError ?? true),\n noCheck:\n checkTypes === false\n ? true\n : (tsconfig.options.noCheck ?? tsconfig.options.isolatedDeclarations),\n outDir,\n }\n\n const program = ts.createProgram(tsconfig.fileNames, compilerOptions)\n\n const emitResult = program.emit()\n\n const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics)\n\n for (const diagnostic of allDiagnostics) {\n printDiagnostic({cwd, logger, diagnostic})\n }\n\n if (emitResult.emitSkipped) {\n const errors = allDiagnostics.filter((diag) => diag.category === ts.DiagnosticCategory.Error)\n\n if (errors.length) {\n throw new Error('failed to compile TypeScript definitions')\n }\n }\n}\n","import type {ExtractorMessage} from '@microsoft/api-extractor'\n\n/** @internal */\nexport class DtsError extends Error {\n messages: ExtractorMessage[]\n\n constructor(message: string, messages: ExtractorMessage[]) {\n super(message)\n this.messages = messages\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport {\n Extractor,\n ExtractorConfig,\n type ExtractorMessage,\n type ExtractorResult,\n} from '@microsoft/api-extractor'\nimport type ts from '@typescript/typescript6'\nimport {mkdirp} from 'mkdirp'\nimport * as prettier from 'prettier'\nimport type {PkgConfigOptions} from '../../core/config/types.ts'\nimport type {BuildFile} from '../../core/contexts/buildContext.ts'\nimport {createApiExtractorConfig} from './createApiExtractorConfig.ts'\nimport {createTSDocConfig} from './createTSDocConfig.ts'\nimport {getExtractMessagesConfig} from './getExtractMessagesConfig.ts'\n\nexport async function extractTypes(options: {\n bundledPackages?: string[]\n customTags: NonNullable<PkgConfigOptions['extract']>['customTags']\n cwd: string\n distPath: string\n exportPath: string\n filePaths: string[]\n files: BuildFile[]\n projectPath: string\n rules?: NonNullable<PkgConfigOptions['extract']>['rules']\n sourceTypesPath: string\n tmpPath: string\n tsconfig: ts.ParsedCommandLine\n tsconfigPath: string\n /**\n * If the extractor is disabled then it means API Extractor is only used to bundle dts, and not check tsdoc release tags.\n */\n extractorDisabled: boolean\n}): Promise<{extractorResult: ExtractorResult; messages: ExtractorMessage[]}> {\n const {\n bundledPackages,\n customTags,\n distPath,\n exportPath,\n files,\n filePaths,\n projectPath,\n rules,\n sourceTypesPath,\n tmpPath,\n tsconfig,\n tsconfigPath,\n extractorDisabled,\n } = options\n\n const tsdocConfigFile = await createTSDocConfig({\n customTags: customTags || [],\n })\n\n const filePath = filePaths[0]!.replace(/\\.d\\.[mc]ts$/, '.d.ts')\n // If there are package.config.ts `bundles` we might not have something that should leave behind a `.d.ts` file and need to handle that\n const shouldCleanUpDts = !filePaths.includes(filePath)\n const extractorConfig: ExtractorConfig = ExtractorConfig.prepare({\n configObject: createApiExtractorConfig({\n bundledPackages,\n distPath,\n exportPath,\n filePath,\n messages: getExtractMessagesConfig({rules, disabled: extractorDisabled}),\n projectFolder: projectPath,\n mainEntryPointFilePath: sourceTypesPath,\n tsconfig,\n tsconfigPath,\n dtsRollupEnabled: true,\n }),\n configObjectFullPath: undefined,\n tsdocConfigFile,\n packageJsonFullPath: path.resolve(projectPath, 'package.json'),\n })\n\n const messages: ExtractorMessage[] = []\n\n // Invoke API Extractor\n const extractorResult = Extractor.invoke(extractorConfig, {\n // Equivalent to the \"--local\" command-line parameter\n localBuild: true,\n // Equivalent to the \"--verbose\" command-line parameter\n showVerboseMessages: true,\n // handle messages\n messageCallback(message: ExtractorMessage) {\n messages.push(message)\n message.handled = true\n },\n })\n\n const typesPath = path.resolve(distPath, filePath)\n const typesBuf = await fs.readFile(typesPath)\n const prettierConfig = await prettier.resolveConfig(typesPath)\n\n await mkdirp(path.dirname(typesPath))\n\n const {extractModuleBlocksFromTypes} = await import('./extractModuleBlocks.ts')\n const moduleBlocks = extractModuleBlocksFromTypes({\n extractResult: extractorResult,\n tsOutDir: tmpPath,\n })\n\n const code = [typesBuf.toString(), ...moduleBlocks].join('\\n\\n')\n const prettyCode = await prettier.format(code, {\n ...prettierConfig,\n filepath: typesPath,\n })\n\n for (const expFilePath of filePaths) {\n const expTypesPath = path.resolve(distPath, expFilePath)\n\n await fs.writeFile(expTypesPath, prettyCode)\n\n // Add to `files` in context\n files.push({\n type: 'types',\n path: expTypesPath,\n })\n }\n\n if (shouldCleanUpDts) {\n await fs.unlink(typesPath)\n }\n\n return {extractorResult, messages}\n}\n","import path from 'node:path'\nimport {ExtractorLogLevel, type ExtractorMessage} from '@microsoft/api-extractor'\nimport {rimraf} from 'rimraf'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport {buildTypes} from './buildTypes.ts'\nimport {DtsError} from './DtsError.ts'\nimport {extractTypes} from './extractTypes.ts'\nimport type {DtsResult, DtsTask, DtsWatchTask} from './types.ts'\n\n/**\n * - Build type definitions to a temporary directory using TypeScript compiler.\n * - Create a type definition bundle for each export entry.\n * - When done, remove the temporary directory.\n */\nexport async function doExtract(\n ctx: BuildContext,\n task: DtsTask | DtsWatchTask,\n): Promise<DtsResult> {\n const {config, cwd, files, logger, strict, ts, bundledPackages} = ctx\n\n if (!ts.config || !ts.configPath) {\n return {type: 'dts', messages: [], results: []}\n }\n\n const {outDir, rootDir = cwd} = ts.config.options\n\n if (!outDir) {\n throw new Error('tsconfig.json is missing `compilerOptions.outDir`')\n }\n\n const tmpPath = path.resolve(outDir, '__tmp__')\n\n await buildTypes({\n cwd,\n logger,\n outDir: tmpPath,\n strict,\n tsconfig: ts.config,\n checkTypes: config?.extract?.checkTypes,\n })\n const messages: ExtractorMessage[] = []\n\n const results: {sourcePath: string; filePaths: string[]}[] = []\n\n for (const entry of task.entries) {\n const exportPath = entry.exportPath === '.' ? './index' : entry.exportPath\n\n const sourceTypesPath = path.resolve(\n tmpPath,\n path.relative(rootDir, path.resolve(cwd, entry.sourcePath)).replace(/\\.ts$/, '.d.ts'),\n )\n\n const targetPaths = entry.targetPaths.map((targetPath) => path.resolve(cwd, targetPath))\n const filePaths = targetPaths.map((targetPath) => path.relative(outDir, targetPath))\n const result = await extractTypes({\n bundledPackages: bundledPackages || [],\n customTags: config?.extract?.customTags,\n cwd,\n distPath: outDir,\n exportPath,\n files,\n filePaths,\n projectPath: cwd,\n rules: config?.extract?.rules,\n sourceTypesPath: sourceTypesPath,\n tsconfig: ts.config,\n tmpPath,\n tsconfigPath: path.resolve(cwd, ts.configPath || 'tsconfig.json'),\n extractorDisabled: config?.extract?.enabled === false,\n })\n\n messages.push(...result.messages)\n\n const errors = result.messages.filter((msg) => msg.logLevel === ExtractorLogLevel.Error)\n\n if (errors.length > 0) {\n await rimraf(tmpPath)\n throw new DtsError(`encountered ${errors.length} errors when extracting types`, errors)\n }\n\n results.push({sourcePath: path.resolve(cwd, entry.sourcePath), filePaths: targetPaths})\n }\n\n await rimraf(tmpPath)\n\n return {type: 'dts', messages, results}\n}\n","import chalk from 'chalk'\nimport {from} from 'rxjs'\nimport {printExtractMessages} from '../../printExtractMessages.ts'\nimport type {TaskHandler} from '../types.ts'\nimport {doExtract} from './doExtract.ts'\nimport {DtsError} from './DtsError.ts'\nimport type {DtsResult, DtsTask} from './types.ts'\n\n/** @internal */\nexport const dtsTask: TaskHandler<DtsTask, DtsResult> = {\n name: (ctx, task) =>\n [\n `Build type definitions with ${chalk.bold(ctx.dts)}...`,\n ' entries:',\n ...task.entries.map((entry) => {\n return entry.targetPaths\n .map((targetPath) => {\n return [\n ` - ${chalk.cyan(entry.importId)}: `,\n `${chalk.yellow(entry.sourcePath)} ${chalk.gray('→')} ${chalk.yellow(targetPath)}`,\n ].join('')\n })\n .join('\\n')\n }),\n ].join('\\n'),\n exec: (ctx, task) => {\n return from(doExtract(ctx, task))\n },\n complete: (ctx, _task, result) => {\n printExtractMessages(ctx, result.messages)\n },\n error: (ctx, _task, err) => {\n const {logger} = ctx\n\n if (err instanceof DtsError) {\n printExtractMessages(ctx, err.messages)\n } else if (err instanceof Error) {\n logger.error(err)\n }\n },\n}\n","import path from 'node:path'\nimport type {ExtractorMessage} from '@microsoft/api-extractor'\nimport ts from '@typescript/typescript6'\nimport chalk from 'chalk'\nimport * as rimraf from 'rimraf'\nimport {Observable} from 'rxjs'\nimport {printExtractMessages} from '../../printExtractMessages.ts'\nimport type {TaskHandler} from '../types.ts'\nimport {buildTypes} from './buildTypes.ts'\nimport {DtsError} from './DtsError.ts'\nimport {extractTypes} from './extractTypes.ts'\nimport type {DtsResult, DtsWatchTask} from './types.ts'\n\n/** @internal */\nexport const dtsWatchTask: TaskHandler<DtsWatchTask, DtsResult> = {\n name: (_ctx, task) =>\n [\n 'build type definitions',\n ...task.entries.map((entry) => {\n return entry.targetPaths.map((targetPath) => {\n return [\n ` - ${chalk.cyan(entry.importId)}: `,\n `${chalk.yellow(entry.sourcePath)} ${chalk.gray('→')} ${chalk.yellow(targetPath)}`,\n ].join('')\n })\n }),\n ].join('\\n'),\n exec: (ctx, task) => {\n const {config, cwd, files, logger, strict, ts: tsContext, bundledPackages} = ctx\n\n return new Observable((observer) => {\n const {config: tsConfig, configPath: tsConfigPath} = tsContext\n\n if (!tsConfig || !tsConfigPath) {\n observer.next({type: 'dts', messages: [], results: []})\n observer.complete()\n\n return () => {}\n }\n\n const {outDir, rootDir = cwd} = tsConfig.options\n\n if (!outDir) {\n observer.error(new Error('tsconfig.json is missing `compilerOptions.outDir`'))\n\n return () => {}\n }\n\n const tmpPath = path.resolve(outDir, '__tmp__')\n\n buildTypes({\n cwd,\n logger,\n outDir: tmpPath,\n tsconfig: tsConfig,\n strict,\n checkTypes: config?.extract?.checkTypes,\n }).catch((err) => {\n observer.error(err)\n })\n\n const host = ts.createWatchCompilerHost(\n tsConfigPath,\n {\n ...tsConfig.options,\n declaration: true,\n declarationDir: tmpPath,\n emitDeclarationOnly: true,\n noEmit: false,\n noEmitOnError: strict ? true : (tsConfig.options.noEmitOnError ?? true),\n noCheck:\n config?.extract?.checkTypes === false\n ? true\n : (tsConfig.options.noCheck ?? tsConfig.options.isolatedDeclarations),\n outDir: tmpPath,\n },\n ts.sys,\n ts.createEmitAndSemanticDiagnosticsBuilderProgram,\n (diagnostic) => {\n logger.error(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n },\n (diagnostic) => {\n logger.info(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n },\n )\n\n // oxlint-disable-next-line unbound-method\n const origPostProgramCreate = host.afterProgramCreate\n\n host.afterProgramCreate = async (program) => {\n origPostProgramCreate?.(program)\n\n const messages: ExtractorMessage[] = []\n const results: {sourcePath: string; filePaths: string[]}[] = []\n\n for (const entry of task.entries) {\n const exportPath = entry.exportPath === '.' ? './index' : entry.exportPath\n\n const sourceTypesPath = path.resolve(\n tmpPath,\n path.relative(rootDir, path.resolve(cwd, entry.sourcePath)).replace(/\\.ts$/, '.d.ts'),\n )\n\n const targetPaths = entry.targetPaths.map((targetPath) => path.resolve(cwd, targetPath))\n const filePaths = targetPaths.map((targetPath) => path.relative(outDir, targetPath))\n\n try {\n const result = await extractTypes({\n bundledPackages: bundledPackages || [],\n customTags: config?.extract?.customTags,\n cwd,\n distPath: outDir,\n exportPath,\n files,\n filePaths,\n projectPath: cwd,\n rules: config?.extract?.rules,\n sourceTypesPath: sourceTypesPath,\n tsconfig: tsConfig,\n tmpPath,\n tsconfigPath: path.resolve(cwd, tsConfigPath),\n extractorDisabled: config?.extract?.enabled === false,\n })\n\n messages.push(...result.messages)\n results.push({sourcePath: path.resolve(cwd, entry.sourcePath), filePaths: targetPaths})\n } catch (err) {\n if (err instanceof DtsError) {\n messages.push(...err.messages)\n } else {\n observer.error(err)\n\n return\n }\n }\n }\n\n observer.next({type: 'dts', messages, results})\n }\n\n const watchProgram = ts.createWatchProgram(host)\n\n return () => {\n watchProgram.close()\n rimraf.sync(tmpPath)\n }\n })\n },\n complete: (ctx, task, result) => {\n const {logger} = ctx\n\n printExtractMessages(ctx, result.messages)\n\n logger.success(\n `build type definitions\\n ${task.entries\n .map(\n (entry) =>\n ` - ${chalk.cyan(entry.importId)}: ${chalk.yellow(entry.sourcePath)} ${chalk.gray('→')} ${chalk.yellow(entry.targetPaths.join(', '))}`,\n )\n .join('\\n ')}`,\n )\n logger.log('')\n },\n error: (ctx, _task, err) => {\n const {logger} = ctx\n\n if (err instanceof DtsError) {\n printExtractMessages(ctx, err.messages)\n } else if (err instanceof Error) {\n logger.error(err)\n }\n },\n}\n","import path from 'node:path'\nimport chalk from 'chalk'\nimport {from} from 'rxjs'\nimport {createConsoleSpy} from '../../consoleSpy.ts'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport type {RolldownDtsTask, TaskHandler} from '../types.ts'\n\n/** @internal */\nexport const rolldownDtsTask: TaskHandler<RolldownDtsTask> = {\n name: (ctx, task) => {\n const bundleEntries = task.entries.filter((e) => e.path.includes('__$$bundle_'))\n const entries = task.entries.filter((e) => !e.path.includes('__$$bundle_'))\n\n const targetLines = task.target.length\n ? [` target:`, ...task.target.map((t) => ` - ${chalk.yellow(t)}`)]\n : []\n\n const bundlesLines = bundleEntries.length\n ? [\n ' bundles:',\n ...bundleEntries.map((e) =>\n [\n ` - `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(replaceFileEnding(e.output))}`,\n ].join(''),\n ),\n ]\n : []\n\n const entriesLines = entries.length\n ? [\n ' entries:',\n ...entries.map((e) =>\n [\n ` - `,\n `${chalk.cyan(path.join(ctx.pkg.name, e.path))}: `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(replaceFileEnding(e.output))}`,\n ].join(''),\n ),\n ]\n : []\n\n return [\n `Build type definitions with ${chalk.bold('rolldown')}...`,\n ` format: ${chalk.yellow(task.format)}`,\n ...targetLines,\n ...bundlesLines,\n ...entriesLines,\n ].join('\\n')\n },\n exec: (ctx, task) => {\n return from(execPromise(ctx, task))\n },\n complete: () => {\n //\n },\n error: (_ctx, _task, err) => {\n console.error(err)\n },\n}\n\nasync function execPromise(ctx: BuildContext, task: RolldownDtsTask) {\n const [{rolldown}, {resolveRolldownConfig}] = await Promise.all([\n import('rolldown'),\n import('./resolveRolldownConfig.ts'),\n ])\n const {distPath, files, logger} = ctx\n const outDir = path.relative(ctx.cwd, distPath)\n\n // Prevent rolldown from printing directly to the console\n const consoleSpy = createConsoleSpy({\n onRestored: (messages) => {\n for (const msg of messages) {\n const text = String(msg.args[0])\n\n if (msg.code === 'CIRCULAR_DEPENDENCY') {\n continue // ignore\n }\n\n if (text.startsWith('Dynamic import can only')) {\n continue // ignore\n }\n\n if (text.startsWith('Sourcemap is likely to be incorrect')) {\n continue // ignore\n }\n\n if (msg.type === 'log') {\n logger.info(...msg.args)\n }\n\n if (msg.type === 'warn') {\n logger.warn(...msg.args)\n }\n\n if (msg.type === 'error') {\n logger.error(...msg.args)\n }\n }\n },\n })\n\n try {\n const {inputOptions, outputOptions} = resolveRolldownConfig(ctx, task)\n\n // Create bundle\n const bundle = await rolldown({\n ...inputOptions,\n onwarn(warning) {\n consoleSpy.messages.push({\n type: 'warn',\n code: warning.code,\n args: [warning.message],\n })\n },\n })\n\n // generate output specific code in-memory\n // you can call this function multiple times on the same bundle object\n const {output} = await bundle.generate(outputOptions)\n\n for (const chunkOrAsset of output) {\n if (chunkOrAsset.type === 'asset') {\n files.push({\n type: 'asset',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n } else {\n files.push({\n type: 'chunk',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n }\n }\n\n // or write the bundle to disk\n await bundle.write(outputOptions)\n\n // closes the bundle\n await bundle.close()\n\n // Restore console\n consoleSpy.restore()\n } catch (err) {\n // Restore console\n consoleSpy.restore()\n throw err\n }\n}\n\nfunction replaceFileEnding(filePath: string) {\n switch (true) {\n case filePath.endsWith('.mjs'):\n return filePath.replace(/\\.mjs$/, '.d.mts')\n case filePath.endsWith('.cjs'):\n return filePath.replace(/\\.cjs$/, '.d.cts')\n default:\n return filePath.replace(/\\.js$/, '.d.ts')\n }\n}\n","import type {Plugin} from 'rollup'\n\n/**\n * Emits a no-op JavaScript shim (`export default \"\"`) alongside the extracted CSS. The conditional\n * `./<css>` export points its `node`/`default` conditions at this file so that the self-referential\n * `import \"<pkg>/<css>\"` resolves to a harmless module in runtimes that cannot import `.css` files,\n * instead of throwing `Error: Unknown file extension \".css\"`.\n *\n * A matching `.d.ts` declaration is emitted next to the shim as well. Both the `browser`/`style`\n * (`<css>`) and the `node`/`default` (`<css>.js`) conditions of the `./<css>` export resolve their\n * types to the same `<css>.d.ts` file, so type-aware tooling (e.g. dts export checkers that load a\n * `.d.ts` for every export target) does not crash on a missing declaration file.\n *\n * @param options.fileName - The shim file name, e.g. `bundle.css.js`.\n * @internal\n */\nexport function bundleCssShim(options: {fileName: string}): Plugin {\n const cssName = options.fileName.replace(/\\.js$/, '')\n\n return {\n name: 'pkg-utils:bundle-css-shim',\n generateBundle() {\n this.emitFile({\n type: 'asset',\n fileName: options.fileName,\n source: `// No-op shim for \\`${cssName}\\` in runtimes that cannot import \\`.css\\` files directly.\\nexport default \"\"\\n`,\n })\n this.emitFile({\n type: 'asset',\n fileName: `${cssName}.d.ts`,\n source: `// Type declarations for \\`${cssName}\\` and its no-op JS shim.\\ndeclare const _default: string\\nexport default _default\\n`,\n })\n },\n }\n}\n","import {basename} from 'node:path'\nimport browserslist from 'browserslist'\nimport {browserslistToTargets, transform} from 'lightningcss'\nimport type {OutputAsset, Plugin} from 'rollup'\n\nexport function optimizeCss(options: {\n extractFileName: string\n browserslist: string | string[]\n minify?: boolean\n}): Plugin {\n return {\n name: 'optimize-css',\n\n async generateBundle(_outputOptions, bundle, _isWrite) {\n for (const [fileName, assetOrChunk] of Object.entries(bundle)) {\n // find CSS assets\n if (assetOrChunk.type === 'asset') {\n const asset = assetOrChunk\n if (asset.originalFileNames.includes(options.extractFileName)) {\n const sourceMapFileName = `${fileName}.map`\n await transformCss(\n asset,\n bundle[sourceMapFileName]?.type === 'asset' ? bundle[sourceMapFileName] : undefined,\n options.browserslist,\n options.minify ?? true,\n )\n }\n }\n }\n },\n }\n}\n\nasync function transformCss(\n asset: OutputAsset,\n sourceMapAsset: OutputAsset | undefined,\n browserslistConfig: string | string[],\n minify: boolean,\n) {\n const css = asset.source.toString()\n const file = asset.fileName\n\n const targets = browserslistToTargets(browserslist(browserslistConfig))\n\n // process (and, unless disabled, minify) css using lightningcss\n const lightningCssResult = transform({\n filename: file,\n code: Buffer.from(css),\n minify,\n cssModules: false,\n targets,\n sourceMap: !!sourceMapAsset,\n inputSourceMap: sourceMapAsset ? sourceMapAsset.source.toString() : undefined,\n })\n\n if (lightningCssResult.warnings.length) {\n // eslint-disable-next-line no-console\n console.warn(lightningCssResult.warnings)\n }\n\n asset.source = new TextDecoder().decode(lightningCssResult.code)\n if (sourceMapAsset && lightningCssResult.map) {\n sourceMapAsset.source = new TextDecoder().decode(lightningCssResult.map)\n asset.source += `\\n/*# sourceMappingURL=${basename(sourceMapAsset.fileName)}*/\\n`\n }\n}\n","import path from 'node:path'\nimport {optimizeLodashImports} from '@optimize-lodash/rollup-plugin'\nimport alias from '@rollup/plugin-alias'\nimport {babel, getBabelOutputPlugin} from '@rollup/plugin-babel'\nimport commonjs from '@rollup/plugin-commonjs'\nimport json from '@rollup/plugin-json'\nimport {nodeResolve} from '@rollup/plugin-node-resolve'\nimport replace from '@rollup/plugin-replace'\nimport terser from '@rollup/plugin-terser'\nimport type {PackageJSON} from '@sanity/parse-package-json'\nimport {vanillaExtractPlugin} from '@vanilla-extract/rollup-plugin'\nimport type {InputOptions, OutputOptions, RenderedChunk} from 'rollup'\nimport esbuild from 'rollup-plugin-esbuild'\nimport {pkgExtMap as extMap} from '../../../node/core/pkg/pkgExt.ts'\nimport {resolveConfigProperty} from '../../core/config/resolveConfigProperty.ts'\nimport {\n resolveVanillaExtract,\n resolveVanillaExtractCssName,\n} from '../../core/config/vanillaExtract.ts'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport {DEFAULT_BROWSERSLIST_QUERY} from '../../core/defaults.ts'\nimport type {RollupTask, RollupWatchTask} from '../types.ts'\nimport {bundleCssShim} from './bundleCssShim.ts'\nimport {optimizeCss} from './optimizeCss.ts'\n\n// Type guard to filter out falsy values\nfunction isTruthy<T>(value: T | false | null | undefined | 0 | ''): value is T {\n return Boolean(value)\n}\n\n/**\n * Check if a package is in the peerDependencies\n */\nfunction hasPeerDependency(pkg: PackageJSON, packageName: string): boolean {\n return pkg.peerDependencies ? packageName in pkg.peerDependencies : false\n}\n\n/**\n * Check if a package is in the devDependencies\n */\nfunction hasDevDependency(pkg: PackageJSON, packageName: string): boolean {\n return pkg.devDependencies ? packageName in pkg.devDependencies : false\n}\n\n// Track if we've already logged styled-components messages to avoid duplicates\nlet styledComponentsLogged = false\n\n/**\n * Determine if styled-components should be enabled\n */\nfunction shouldEnableStyledComponents(\n config: BuildContext['config'],\n pkg: PackageJSON,\n logger: BuildContext['logger'],\n): boolean {\n const hasStyledComponents = hasPeerDependency(pkg, 'styled-components')\n const hasBabelPluginStyledComponents = hasDevDependency(pkg, 'babel-plugin-styled-components')\n const styledComponentsConfigSet = config?.babel?.styledComponents !== undefined\n\n // If explicitly set, respect that\n if (styledComponentsConfigSet) {\n return !!config?.babel?.styledComponents\n }\n\n // Log messages only once per build\n if (!styledComponentsLogged) {\n styledComponentsLogged = true\n\n if (hasStyledComponents) {\n if (hasBabelPluginStyledComponents) {\n // Log that auto-enabling will happen\n logger.log(\n 'Detected styled-components in peerDependencies and babel-plugin-styled-components in devDependencies. Automatically enabling babel.styledComponents. To disable this, set `babel: { styledComponents: false }` in package.config.ts.',\n )\n } else {\n // Warn if styled-components is present but babel-plugin-styled-components is not\n logger.warn(\n 'Detected styled-components in peerDependencies. Consider installing babel-plugin-styled-components as a devDependency to enable better debugging and optimization. Add `\"babel-plugin-styled-components\": \"^2.0.0\"` to devDependencies and it will be automatically enabled, or set `babel: { styledComponents: false }` in package.config.ts to disable this warning.',\n )\n }\n }\n }\n\n // Auto-enable if both styled-components and babel plugin are present\n if (hasStyledComponents && hasBabelPluginStyledComponents) {\n return true\n }\n\n return false\n}\n\nexport interface RollupConfig {\n inputOptions: InputOptions\n outputOptions: OutputOptions\n}\n\n/** @internal */\nexport function resolveRollupConfig(\n ctx: BuildContext,\n buildTask: RollupTask | RollupWatchTask,\n): RollupConfig {\n const {format, runtime, target} = buildTask\n const {config, cwd, exports: _exports, external, distPath, logger, pkg, ts} = ctx\n const outputExt = extMap[pkg.type || 'commonjs'][format]\n const minify = config?.minify ?? false\n const outDir = path.relative(cwd, distPath)\n\n const pathAliases = Object.fromEntries(\n Object.entries(ts.config?.options.paths || {}).flatMap(([key, val]) => {\n const pathAlias = val[0]\n if (!pathAlias) return []\n return [[key, path.resolve(cwd, ts.config?.options.baseUrl || '.', pathAlias)]]\n }),\n )\n\n const entries = buildTask.entries.map((entry) => {\n return {\n ...entry,\n name: path.relative(outDir, entry.output).replace(/\\.[^/.]+$/, ''),\n }\n }, {})\n\n const exportIds =\n _exports && Object.keys(_exports).map((exportPath) => path.join(pkg.name, exportPath))\n\n const sourcePaths = _exports && Object.values(_exports).map((e) => path.resolve(cwd, e.source))\n\n const replacements = Object.fromEntries(\n Object.entries(config?.define || {}).map(([key, val]) => [key, JSON.stringify(val)]),\n )\n\n const {optimizeLodash: enableOptimizeLodash = hasDependency(pkg, 'lodash')} = config?.rollup || {}\n\n // Auto-detect if styled-components should be enabled\n const enableStyledComponents = shouldEnableStyledComponents(config, pkg, logger)\n\n // Resolve vanilla-extract options + the conditional CSS export \"compat mode\"\n const vanillaExtract = resolveVanillaExtract(config)\n const vanillaExtractCssName = resolveVanillaExtractCssName(vanillaExtract.options, {\n compatMode: vanillaExtract.compatMode,\n runtime,\n })\n\n const defaultPlugins = [\n replace({\n preventAssignment: true,\n values:\n pkg.name === '@sanity/pkg-utils'\n ? {...replacements}\n : {\n 'process.env.PKG_FILE_PATH': (arg) => {\n const sourcePath = `./${path.relative(cwd, arg)}`\n const entry = entries.find((e) => e.source === sourcePath)\n\n if (!entry) {\n console.error(`could not find source entry: ${sourcePath}`)\n\n return 'null'\n }\n\n return JSON.stringify(\n path.relative(cwd, path.resolve(outDir, entry.name + outputExt)),\n )\n },\n 'process.env.PKG_FORMAT': JSON.stringify(format),\n 'process.env.PKG_RUNTIME': JSON.stringify(runtime),\n 'process.env.PKG_VERSION': JSON.stringify(process.env['PKG_VERSION'] || pkg.version),\n ...replacements,\n },\n }),\n alias({\n entries: {...pathAliases},\n }),\n nodeResolve({\n browser: runtime === 'browser',\n extensions: ['.cjs', '.mjs', '.js', '.jsx', '.json', '.node'],\n preferBuiltins: true,\n }),\n commonjs(),\n json(),\n vanillaExtract.enabled &&\n vanillaExtractPlugin({\n identifiers: vanillaExtract.options.identifiers ?? 'short',\n cwd: vanillaExtract.options.cwd,\n esbuildOptions: vanillaExtract.options.esbuildOptions,\n unstable_injectFilescopes: vanillaExtract.options.unstable_injectFilescopes,\n extract: {\n name: vanillaExtractCssName,\n sourcemap: vanillaExtract.options.extract?.sourcemap ?? true,\n },\n }),\n vanillaExtract.enabled &&\n optimizeCss({\n extractFileName: vanillaExtractCssName,\n browserslist: vanillaExtract.options.browserslist || DEFAULT_BROWSERSLIST_QUERY,\n minify: vanillaExtract.options.minify ?? true,\n }),\n // In compat mode, emit the no-op JS shim that the `node`/`default` conditions of the\n // `./<css>` export resolve to.\n vanillaExtract.compatMode && bundleCssShim({fileName: `${vanillaExtractCssName}.js`}),\n (config?.babel?.reactCompiler || enableStyledComponents) &&\n babel({\n babelrc: false,\n presets: ['@babel/preset-typescript'],\n babelHelpers: 'bundled',\n parallel: true,\n extensions: ['.ts', '.tsx', '.js', '.jsx'],\n plugins: [\n // The styled-components plugin needs to run before the react-compiler plugin, in case the css prop is used\n enableStyledComponents && [\n 'babel-plugin-styled-components',\n {\n // Unnecessary, as the way we use styled-components in Sanity is usually by wrapping `@sanity/ui` primitives, not declaring new ones like \"const Button = styled.button``\"\n fileName: false,\n // Transpile `styled.button`...`` to `styled.button([\"...\"])` so that the `pure` option below\n // can annotate a plain call expression. Pure annotations on tagged template expressions are\n // not supported by any bundler (https://github.com/rollup/rollup/issues/4035), so without\n // this transpilation unused styled components can't be tree-shaken at all.\n transpileTemplateLiterals: true,\n // Massively helps dead code elimination and tree-shaking\n pure: true,\n // disabled, as pkg-utils tends to be used for npm publishing, while other tooling, like `sanity dev`, `next dev`, etc are used for testing\n cssProp: false,\n ...(typeof config?.babel?.styledComponents === 'object'\n ? config.babel.styledComponents\n : {}),\n },\n ],\n config?.babel?.reactCompiler && [\n 'babel-plugin-react-compiler',\n config?.reactCompilerOptions || {},\n ],\n ].filter(isTruthy),\n }),\n esbuild({\n jsx: config?.jsx ?? 'automatic',\n jsxFactory: config?.jsxFactory ?? 'createElement',\n jsxFragment: config?.jsxFragment ?? 'Fragment',\n jsxImportSource: config?.jsxImportSource ?? 'react',\n target,\n tsconfig: ctx.ts.configPath || 'tsconfig.json',\n treeShaking: true,\n minifySyntax: config?.minify !== false,\n supported: {\n 'template-literal': true,\n },\n }),\n Array.isArray(config?.babel?.plugins) &&\n getBabelOutputPlugin({\n babelrc: false,\n parallel: true,\n plugins: config.babel.plugins,\n }),\n enableOptimizeLodash &&\n optimizeLodashImports({\n useLodashEs: format === 'esm' && hasDependency(pkg, 'lodash-es') ? true : undefined,\n ...(typeof config?.rollup?.optimizeLodash === 'boolean'\n ? {}\n : config?.rollup?.optimizeLodash),\n }),\n minify &&\n terser({\n compress: {directives: false, passes: 10},\n ecma: 2020,\n output: {\n comments: (_node, comment) => {\n const text = comment.value\n const cType = comment.type\n\n // Check if this is a multiline comment\n if (cType === 'comment2') {\n // Keep licensing comments\n return /@preserve|@license|@cc_on/i.test(text)\n }\n\n return false\n },\n preserve_annotations: true,\n },\n }),\n ].filter(isTruthy)\n\n const userPlugins = config?.rollup?.plugins\n\n const plugins = Array.isArray(userPlugins)\n ? defaultPlugins.concat(userPlugins)\n : resolveConfigProperty(config?.rollup?.plugins, defaultPlugins)\n\n const hashChunkFileNames = config?.rollup?.hashChunkFileNames ?? false\n const chunksFolder = hashChunkFileNames ? '_chunks' : '_chunks-[format]'\n const chunkFileNames = `${chunksFolder}/${hashChunkFileNames ? '[name]-[hash]' : '[name]'}${outputExt}`\n const entryFileNames = `[name]${outputExt}`\n\n return {\n inputOptions: {\n context: cwd,\n\n external: (id, importer) => {\n // Check if the id is a self-referencing import\n if (exportIds?.includes(id)) {\n return true\n }\n\n // Check if the id is a file path that points to an exported source file\n if (importer && (id.startsWith('.') || id.startsWith('/'))) {\n const idPath = path.resolve(path.dirname(importer), id)\n\n if (sourcePaths?.includes(idPath)) {\n logger.warn(\n `detected self-referencing import – treating as external: ${path.relative(\n cwd,\n idPath,\n )}`,\n )\n\n return true\n }\n }\n\n const idParts = id.split('/')\n\n const name = idParts[0]!.startsWith('@') ? `${idParts[0]}/${idParts[1]}` : idParts[0]\n\n if (name && external.includes(name)) {\n return true\n }\n\n return false\n },\n\n input: entries.reduce<{[entryAlias: string]: string}>(\n (acc, entry) => Object.assign(acc, {[entry.name]: entry.source}),\n {},\n ),\n\n watch: {\n chokidar: {\n usePolling: true,\n },\n },\n\n plugins,\n\n // Rely on Rollup's `recommended` tree-shaking defaults instead of customizing\n // `moduleSideEffects`/`propertyReadSideEffects` ourselves. Previously we set\n // `moduleSideEffects` to the equivalent of `'no-external'` (with a `.css` exemption),\n // which incorrectly stripped intentional side-effect-only imports of external packages\n // (e.g. `import 'react-time-ago/locale/en'`) from the bundle. The `recommended` preset\n // uses `moduleSideEffects: true`, so these imports are preserved while `package.json`\n // `sideEffects` fields are still honored for bundled modules.\n treeshake: {\n preset: 'recommended',\n ...config?.rollup?.treeshake,\n },\n experimentalLogSideEffects: config?.rollup?.experimentalLogSideEffects,\n },\n outputOptions: {\n chunkFileNames,\n compact: minify,\n dir: outDir,\n entryFileNames,\n esModule: true,\n format,\n interop: 'compat',\n sourcemap: config?.sourcemap ?? true,\n hoistTransitiveImports: false,\n minifyInternalExports: minify,\n assetFileNames: '[name][extname]',\n ...config?.rollup?.output,\n // In compat mode, inject the self-referential bundle.css import into the `index` entry chunk\n // so userland does not need to set `rollup.output.intro` themselves. Use `require()` for CommonJS output\n // (a top-level `import` would be invalid in a `.cjs` bundle).\n ...(vanillaExtract.compatMode\n ? {\n intro: composeIntro(\n format === 'commonjs'\n ? `require(${JSON.stringify(`${pkg.name}/${vanillaExtractCssName}`)})`\n : `import ${JSON.stringify(`${pkg.name}/${vanillaExtractCssName}`)}`,\n config?.rollup?.output?.intro,\n ),\n }\n : {}),\n },\n }\n}\n\n/**\n * Build an `intro` function that prepends `autoImport` to the `index` entry chunk only,\n * preserving any user-provided `intro`.\n */\nfunction composeIntro(\n autoImport: string,\n userIntro: OutputOptions['intro'],\n): (chunkInfo: RenderedChunk) => Promise<string> {\n return async (chunkInfo) => {\n const auto = chunkInfo.isEntry && chunkInfo.name === 'index' ? `${autoImport}\\n` : ''\n const user =\n typeof userIntro === 'function'\n ? await userIntro(chunkInfo)\n : typeof userIntro === 'string'\n ? userIntro\n : ''\n\n return `${auto}${user}`\n }\n}\n\nfunction hasDependency(pkg: PackageJSON, packageName: string): boolean {\n return pkg.dependencies\n ? packageName in pkg.dependencies\n : pkg.peerDependencies\n ? packageName in pkg.peerDependencies\n : false\n}\n","import path from 'node:path'\nimport chalk from 'chalk'\nimport {rollup} from 'rollup'\nimport {from} from 'rxjs'\nimport {createConsoleSpy} from '../../consoleSpy.ts'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport type {RollupTask, TaskHandler} from '../types.ts'\nimport {resolveRollupConfig} from './resolveRollupConfig.ts'\n\n/** @internal */\nexport const rollupTask: TaskHandler<RollupTask> = {\n name: (ctx, task) => {\n const bundleEntries = task.entries.filter((e) => e.path.includes('__$$bundle_'))\n const entries = task.entries.filter((e) => !e.path.includes('__$$bundle_'))\n\n const targetLines = task.target.length\n ? [` target:`, ...task.target.map((t) => ` - ${chalk.yellow(t)}`)]\n : []\n\n const bundlesLines = bundleEntries.length\n ? [\n ' bundles:',\n ...bundleEntries.map((e) =>\n [\n ` - `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(e.output)}`,\n ].join(''),\n ),\n ]\n : []\n\n const entriesLines = entries.length\n ? [\n ' entries:',\n ...entries.map((e) =>\n [\n ` - `,\n `${chalk.cyan(path.join(ctx.pkg.name, e.path))}: `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(e.output)}`,\n ].join(''),\n ),\n ]\n : []\n\n return [\n `Build javascript files...`,\n ` format: ${chalk.yellow(task.format)}`,\n ...targetLines,\n ...bundlesLines,\n ...entriesLines,\n ].join('\\n')\n },\n exec: (ctx, task) => {\n return from(execPromise(ctx, task))\n },\n complete: () => {\n //\n },\n error: (_ctx, _task, err) => {\n console.error(err)\n },\n}\n\nasync function execPromise(ctx: BuildContext, task: RollupTask) {\n const {distPath, files, logger} = ctx\n const outDir = path.relative(ctx.cwd, distPath)\n\n // Prevent rollup from printing directly to the console\n const consoleSpy = createConsoleSpy({\n onRestored: (messages) => {\n for (const msg of messages) {\n const text = String(msg.args[0])\n\n if (msg.code === 'CIRCULAR_DEPENDENCY') {\n continue // ignore\n }\n\n if (text.startsWith('Dynamic import can only')) {\n continue // ignore\n }\n\n if (text.startsWith('Sourcemap is likely to be incorrect')) {\n continue // ignore\n }\n\n if (msg.type === 'log') {\n logger.info(...msg.args)\n }\n\n if (msg.type === 'warn') {\n logger.warn(...msg.args)\n }\n\n if (msg.type === 'error') {\n logger.error(...msg.args)\n }\n }\n },\n })\n\n try {\n const {inputOptions, outputOptions} = resolveRollupConfig(ctx, task)\n\n // Create bundle\n const bundle = await rollup({\n ...inputOptions,\n onwarn(warning) {\n consoleSpy.messages.push({\n type: 'warn',\n code: warning.code,\n args: [warning.message],\n })\n },\n })\n\n // generate output specific code in-memory\n // you can call this function multiple times on the same bundle object\n const {output} = await bundle.generate(outputOptions)\n\n for (const chunkOrAsset of output) {\n if (chunkOrAsset.type === 'asset') {\n files.push({\n type: 'asset',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n } else {\n files.push({\n type: 'chunk',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n }\n }\n\n // or write the bundle to disk\n await bundle.write(outputOptions)\n\n // closes the bundle\n await bundle.close()\n\n // Restore console\n consoleSpy.restore()\n } catch (err) {\n // Restore console\n consoleSpy.restore()\n throw err\n }\n}\n","import path from 'node:path'\nimport chalk from 'chalk'\nimport {watch as rollupWatch, type RollupWatcherEvent, type RollupWatchOptions} from 'rollup'\nimport {Observable} from 'rxjs'\nimport type {RollupWatchTask, TaskHandler} from '../types.ts'\nimport {resolveRollupConfig} from './resolveRollupConfig.ts'\n\n/** @internal */\nexport const rollupWatchTask: TaskHandler<RollupWatchTask, RollupWatcherEvent> = {\n name: (ctx, task) =>\n `build javascript files (target ${task.target.join(' + ')}, format ${\n task.format\n })\\n ${task.entries\n .map((e) => `${chalk.blue(path.join(ctx.pkg.name, e.path))}: ${e.source} -> ${e.output}`)\n .join('\\n ')}`,\n exec: (ctx, task) => {\n const {inputOptions, outputOptions} = resolveRollupConfig(ctx, task)\n\n return new Observable((observer) => {\n const watchOptions: RollupWatchOptions = {\n ...inputOptions,\n output: outputOptions,\n }\n\n const watcher = rollupWatch(watchOptions)\n\n watcher.on('event', (event) => {\n observer.next(event)\n })\n\n return () => {\n void watcher.close()\n }\n })\n },\n complete: (ctx, task, event) => {\n const {logger} = ctx\n\n if (event.code === 'BUNDLE_END') {\n logger.success(\n `build javascript files (target ${task.target.join(' + ')}, format ${\n task.format\n })\\n ${task.entries\n .map((e) => `${chalk.blue(path.join(ctx.pkg.name, e.path))}: ${e.source} -> ${e.output}`)\n .join('\\n ')}`,\n )\n logger.log('')\n\n return\n }\n\n if (event.code === 'BUNDLE_START') {\n return\n }\n\n if (event.code === 'END') {\n return\n }\n\n if (event.code === 'ERROR') {\n logger.error(event.code, event)\n\n return\n }\n\n if (event.code === 'START') {\n return\n }\n },\n error: (ctx, _task, err) => {\n const {logger} = ctx\n\n if (err instanceof Error) {\n logger.log(err)\n }\n },\n}\n","import {dtsTask} from './dts/dtsTask.ts'\nimport {dtsWatchTask} from './dts/dtsWatchTask.ts'\nimport {rolldownDtsTask} from './rolldown/rolldownDtsTask.ts'\nimport {rollupTask} from './rollup/rollupTask.ts'\nimport {rollupWatchTask} from './rollup/rollupWatchTask.ts'\nimport type {BuildTaskHandlers, WatchTaskHandlers} from './types.ts'\n\n/** @internal */\nexport const buildTaskHandlers: BuildTaskHandlers = {\n 'build:dts': dtsTask,\n 'build:js': rollupTask,\n 'rolldown:dts': rolldownDtsTask,\n}\n\n/** @internal */\nexport const watchTaskHandlers: WatchTaskHandlers = {\n 'watch:dts': dtsWatchTask,\n 'watch:js': rollupWatchTask,\n}\n"],"names":["ts","rimraf","execPromise","extMap","rollupWatch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,mCAAmC;AAkBlC,SAAS,sBACd,QACwB;AACxB,QAAM,QAAQ,QAAQ,QAAQ,gBACxB,UAAU,CAAA,CAAQ,OAClB,UAAoC,UAAU,MAAQ,CAAC,QAAQ,CAAA,IAAK,OACpE,aAAa,UAAW,QAAQ,SAAS,cAAc,KAAQ;AAErE,SAAO,EAAC,SAAS,SAA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;AAAA,MAAA,GAGJ,UAAUI,MAAY,YAAY;AAExC,aAAA,QAAQ,GAAG,SAAS,CAAC,UAAU;AAC7B,iBAAS,KAAK,KAAK;AAAA,MACrB,CAAC,GAEM,MAAM;AACN,gBAAQ,MAAA;AAAA,MACf;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA,UAAU,CAAC,KAAK,MAAM,UAAU;AAC9B,UAAM,EAAC,WAAU;AAEjB,QAAI,MAAM,SAAS,cAAc;AAC/B,aAAO;AAAA,QACL,kCAAkC,KAAK,OAAO,KAAK,KAAK,CAAC,YACvD,KAAK,MACP;AAAA,SAAa,KAAK,QACf,IAAI,CAAC,MAAM,GAAG,MAAM,KAAK,KAAK,KAAK,IAAI,IAAI,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,OAAO,EAAE,MAAM,EAAE,EACvF,KAAK;AAAA,QAAW,CAAC;AAAA,MAAA,GAEtB,OAAO,IAAI,EAAE;AAEb;AAAA,IACF;AAEA,QAAI,MAAM,SAAS,kBAIf,MAAM,SAAS,OAInB;AAAA,UAAI,MAAM,SAAS,SAAS;AAC1B,eAAO,MAAM,MAAM,MAAM,KAAK;AAE9B;AAAA,MACF;AAEI,YAAM;AAAA,IAAA;AAAA,EAGZ;AAAA,EACA,OAAO,CAAC,KAAK,OAAO,QAAQ;AAC1B,UAAM,EAAC,WAAU;AAEb,mBAAe,SACjB,OAAO,IAAI,GAAG;AAAA,EAElB;AACF,GCpEa,oBAAuC;AAAA,EAClD,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,gBAAgB;AAClB,GAGa,oBAAuC;AAAA,EAClD,aAAa;AAAA,EACb,YAAY;AACd;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/node/core/config/vanillaExtract.ts","../../src/node/core/pkg/cssShimFileName.ts","../../src/node/core/pkg/writeBundleCssExports.ts","../../src/node/tasks/dts/printDiagnostic.ts","../../src/node/tasks/dts/buildTypes.ts","../../src/node/tasks/dts/DtsError.ts","../../src/node/tasks/dts/extractTypes.ts","../../src/node/tasks/dts/doExtract.ts","../../src/node/tasks/dts/dtsTask.ts","../../src/node/tasks/dts/dtsWatchTask.ts","../../src/node/tasks/rolldown/rolldownDtsTask.ts","../../src/node/tasks/rollup/bundleCssShim.ts","../../src/node/tasks/rollup/optimizeCss.ts","../../src/node/tasks/rollup/resolveRollupConfig.ts","../../src/node/tasks/rollup/rollupTask.ts","../../src/node/tasks/rollup/rollupWatchTask.ts","../../src/node/tasks/index.ts"],"sourcesContent":["import type {PkgConfigOptions, PkgRuntime, PkgVanillaExtractOptions} from './types.ts'\n\n/** The default name of the extracted CSS file. */\nconst DEFAULT_VANILLA_EXTRACT_CSS_NAME = 'bundle.css'\n\nexport interface ResolvedVanillaExtract {\n enabled: boolean\n /** Normalized options (the object form, or `{}` when `vanillaExtract: true`). */\n options: PkgVanillaExtractOptions\n /**\n * Whether to automatically wire up the conditional CSS export pattern (intro import, JS shim, and\n * the `package.json` export). Only `true` when vanilla-extract is enabled.\n */\n compatMode: boolean\n}\n\n/**\n * Normalize the `rollup.vanillaExtract` config into a consistent shape and resolve whether\n * compatibility mode is active.\n * @internal\n */\nexport function resolveVanillaExtract(\n config: PkgConfigOptions | undefined,\n): ResolvedVanillaExtract {\n const value = config?.rollup?.vanillaExtract\n const enabled = Boolean(value)\n const options: PkgVanillaExtractOptions = value === true || !value ? {} : value\n const compatMode = enabled ? (options.extract?.compatMode ?? true) : false\n\n return {enabled, options, compatMode}\n}\n\n/**\n * Resolve the name of the emitted CSS file. In compat mode this is a stable, runtime-independent\n * name (so it can back a single conditional export); otherwise it keeps the historical\n * runtime-suffixed defaults.\n * @internal\n */\nexport function resolveVanillaExtractCssName(\n options: PkgVanillaExtractOptions,\n context: {compatMode: boolean; runtime: PkgRuntime},\n): string {\n if (options.extract?.name) {\n return options.extract.name\n }\n\n if (context.compatMode) {\n return DEFAULT_VANILLA_EXTRACT_CSS_NAME\n }\n\n if (context.runtime === 'node') return 'bundle.node.css'\n if (context.runtime === 'browser') return 'bundle.browser.css'\n return DEFAULT_VANILLA_EXTRACT_CSS_NAME\n}\n","/**\n * The no-op JS shim file name for a CSS file under vanilla-extract compat mode.\n *\n * `bundle.css` → `bundle-css.js` — deliberately not `${cssFileName}.js` (`bundle.css.js`),\n * which vanilla-extract's `cssFileFilter` (`/\\.css\\.(js|cjs|mjs|jsx|ts|tsx)$/`) would treat as\n * a stylesheet module. Kept in sync with `cssShimFileName` in\n * `@sanity/vanilla-extract-rolldown-plugin`.\n *\n * @internal\n */\nexport function cssShimFileName(cssFileName: string): string {\n return `${cssFileName.replace(/\\.css$/, '-css')}.js`\n}\n\n/**\n * The `.d.ts` companion for {@link cssShimFileName}. `bundle.css` → `bundle-css.d.ts`.\n *\n * @internal\n */\nexport function cssShimDtsFileName(cssFileName: string): string {\n return `${cssFileName.replace(/\\.css$/, '-css')}.d.ts`\n}\n","import {readFile, writeFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport type {Logger} from '../../logger.ts'\nimport {isRecord} from '../isRecord.ts'\nimport {cssShimDtsFileName, cssShimFileName} from './cssShimFileName.ts'\n\n/**\n * Build the conditional CSS export object that vanilla-extract compat mode expects, e.g.\n * ```json\n * {\n * \"types\": \"./dist/bundle-css.d.ts\",\n * \"browser\": \"./dist/bundle.css\",\n * \"style\": \"./dist/bundle.css\",\n * \"node\": \"./dist/bundle-css.js\",\n * \"default\": \"./dist/bundle-css.js\"\n * }\n * ```\n * The shim is named `bundle-css.js` (not `bundle.css.js`) so it does not match\n * vanilla-extract's `cssFileFilter`. An explicit `types` condition (rather than relying on\n * TypeScript's extension-substitution fallback, which only works when the shim shares the CSS\n * file's basename, and which TypeScript is deprecating anyway - microsoft/TypeScript#50762)\n * points resolvers straight at the shim's declaration file.\n */\nfunction createConditionalCssExport(cssFile: string, shimFile: string, shimDtsFile: string) {\n return {types: shimDtsFile, browser: cssFile, style: cssFile, node: shimFile, default: shimFile}\n}\n\nfunction hasMatchingExport(value: unknown, expected: Record<string, string>): boolean {\n if (typeof value !== 'object' || value === null) return false\n const actual = Object.fromEntries(Object.entries(value))\n const keys = Object.keys(expected)\n return (\n keys.length === Object.keys(actual).length && keys.every((key) => actual[key] === expected[key])\n )\n}\n\n/**\n * Insert (or replace) the `\"./<cssName>\"` export in an `exports`-shaped map, preserving the existing\n * order and placing it before `./package.json` when present.\n */\nfunction insertCssExport(\n exports: Record<string, unknown>,\n exportKey: string,\n conditionalExport: Record<string, string>,\n): Record<string, unknown> {\n const nextExports: Record<string, unknown> = {}\n let inserted = false\n for (const [key, value] of Object.entries(exports)) {\n if (key === exportKey) continue\n if (key === './package.json' && !inserted) {\n nextExports[exportKey] = conditionalExport\n inserted = true\n }\n nextExports[key] = value\n }\n if (!inserted) {\n nextExports[exportKey] = conditionalExport\n }\n return nextExports\n}\n\nfunction detectIndent(source: string): string | number {\n const match = source.match(/\\n([ \\t]+)\\S/)\n if (!match) return 2\n const indent = match[1]!\n return indent.includes('\\t') ? '\\t' : indent.length\n}\n\n/**\n * Write the conditional `\"./<cssName>\"` export to `package.json` (used by vanilla-extract compat\n * mode), so userland does not have to maintain it by hand. The write is idempotent: if the export\n * already matches, the file is left untouched.\n *\n * When `publishConfig.exports` is present, the same conditional CSS export is mirrored into it. The\n * conditional CSS export has no `source`/`development`/`monorepo` conditions to strip, so the entry\n * is identical in both places. Keeping them in sync prevents the `publishConfig.exports` validation\n * from failing with a \"missing export path\" error for the auto-added `./<cssName>` export.\n *\n * @internal\n */\nexport async function writeBundleCssExports(options: {\n cwd: string\n distPath: string\n cssName: string\n logger: Logger\n}): Promise<void> {\n const {cwd, distPath, cssName, logger} = options\n\n const pkgPath = path.resolve(cwd, 'package.json')\n const source = await readFile(pkgPath, 'utf8')\n // oxlint-disable-next-line no-unsafe-type-assertion\n const pkg = JSON.parse(source) as {\n exports?: Record<string, unknown>\n publishConfig?: {exports?: Record<string, unknown>}\n }\n\n // Normalize to POSIX separators - `path.relative` uses `\\\\` on Windows, but `exports` paths in\n // package.json must always use `/`.\n const distRel = (path.relative(cwd, distPath) || 'dist').split(path.sep).join('/')\n const exportKey = `./${cssName}`\n const cssFile = `./${path.posix.join(distRel, cssName)}`\n const shimFile = `./${path.posix.join(distRel, cssShimFileName(cssName))}`\n const shimDtsFile = `./${path.posix.join(distRel, cssShimDtsFileName(cssName))}`\n const conditionalExport = createConditionalCssExport(cssFile, shimFile, shimDtsFile)\n\n // Only mirror into `publishConfig.exports` when it already exists; never create it here.\n const publishConfig = pkg.publishConfig\n const publishConfigExports = isRecord(publishConfig?.exports) ? publishConfig.exports : undefined\n\n const exportsMatch = hasMatchingExport(pkg.exports?.[exportKey], conditionalExport)\n const publishConfigExportsMatch =\n !publishConfigExports || hasMatchingExport(publishConfigExports[exportKey], conditionalExport)\n\n if (exportsMatch && publishConfigExportsMatch) {\n return\n }\n\n pkg.exports = insertCssExport(pkg.exports ?? {}, exportKey, conditionalExport)\n\n if (publishConfig && publishConfigExports) {\n publishConfig.exports = insertCssExport(publishConfigExports, exportKey, conditionalExport)\n }\n\n await writeFile(pkgPath, `${JSON.stringify(pkg, null, detectIndent(source))}\\n`)\n logger.log(\n `Updated package.json: added \\`exports[\"${exportKey}\"]\\`${\n publishConfigExports ? ` and \\`publishConfig.exports[\"${exportKey}\"]\\`` : ''\n } for vanilla-extract compat mode`,\n )\n}\n","import path from 'node:path'\nimport ts from '@typescript/typescript6'\nimport chalk from 'chalk'\nimport type {Logger} from '../../logger.ts'\n\nexport function printDiagnostic(options: {\n cwd: string\n logger: Logger\n diagnostic: ts.Diagnostic\n}): void {\n const {cwd, logger, diagnostic} = options\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const {line, character} = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start)\n const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n')\n\n const file = path.relative(cwd, diagnostic.file.fileName)\n\n const output = [\n `${chalk.yellow(file)}:${chalk.blue(line + 1)}:${chalk.blue(character + 1)} - `,\n `${chalk.gray(`TS${diagnostic.code}:`)} ${message}`,\n ].join('')\n\n if (diagnostic.category === ts.DiagnosticCategory.Error) {\n logger.error(output)\n }\n\n if (diagnostic.category === ts.DiagnosticCategory.Warning) {\n logger.warn(output)\n }\n\n if (diagnostic.category === ts.DiagnosticCategory.Message) {\n logger.log(output)\n }\n\n if (diagnostic.category === ts.DiagnosticCategory.Suggestion) {\n logger.log(output)\n }\n } else {\n logger.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n }\n}\n","import ts from '@typescript/typescript6'\nimport type {Logger} from '../../logger.ts'\nimport {printDiagnostic} from './printDiagnostic.ts'\n\n/** @internal */\nexport async function buildTypes(options: {\n cwd: string\n logger: Logger\n outDir: string\n tsconfig: ts.ParsedCommandLine\n strict: boolean\n checkTypes?: boolean\n}): Promise<void> {\n const {cwd, logger, outDir, tsconfig, strict, checkTypes} = options\n\n const compilerOptions: ts.CompilerOptions = {\n ...tsconfig.options,\n declaration: true,\n declarationDir: outDir,\n emitDeclarationOnly: true,\n noEmit: false,\n noEmitOnError: strict ? true : (tsconfig.options.noEmitOnError ?? true),\n noCheck:\n checkTypes === false\n ? true\n : (tsconfig.options.noCheck ?? tsconfig.options.isolatedDeclarations),\n outDir,\n }\n\n const program = ts.createProgram(tsconfig.fileNames, compilerOptions)\n\n const emitResult = program.emit()\n\n const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics)\n\n for (const diagnostic of allDiagnostics) {\n printDiagnostic({cwd, logger, diagnostic})\n }\n\n if (emitResult.emitSkipped) {\n const errors = allDiagnostics.filter((diag) => diag.category === ts.DiagnosticCategory.Error)\n\n if (errors.length) {\n throw new Error('failed to compile TypeScript definitions')\n }\n }\n}\n","import type {ExtractorMessage} from '@microsoft/api-extractor'\n\n/** @internal */\nexport class DtsError extends Error {\n messages: ExtractorMessage[]\n\n constructor(message: string, messages: ExtractorMessage[]) {\n super(message)\n this.messages = messages\n }\n}\n","import fs from 'node:fs/promises'\nimport path from 'node:path'\nimport {\n Extractor,\n ExtractorConfig,\n type ExtractorMessage,\n type ExtractorResult,\n} from '@microsoft/api-extractor'\nimport type ts from '@typescript/typescript6'\nimport {mkdirp} from 'mkdirp'\nimport * as prettier from 'prettier'\nimport type {PkgConfigOptions} from '../../core/config/types.ts'\nimport type {BuildFile} from '../../core/contexts/buildContext.ts'\nimport {createApiExtractorConfig} from './createApiExtractorConfig.ts'\nimport {createTSDocConfig} from './createTSDocConfig.ts'\nimport {getExtractMessagesConfig} from './getExtractMessagesConfig.ts'\n\nexport async function extractTypes(options: {\n bundledPackages?: string[]\n customTags: NonNullable<PkgConfigOptions['extract']>['customTags']\n cwd: string\n distPath: string\n exportPath: string\n filePaths: string[]\n files: BuildFile[]\n projectPath: string\n rules?: NonNullable<PkgConfigOptions['extract']>['rules']\n sourceTypesPath: string\n tmpPath: string\n tsconfig: ts.ParsedCommandLine\n tsconfigPath: string\n /**\n * If the extractor is disabled then it means API Extractor is only used to bundle dts, and not check tsdoc release tags.\n */\n extractorDisabled: boolean\n}): Promise<{extractorResult: ExtractorResult; messages: ExtractorMessage[]}> {\n const {\n bundledPackages,\n customTags,\n distPath,\n exportPath,\n files,\n filePaths,\n projectPath,\n rules,\n sourceTypesPath,\n tmpPath,\n tsconfig,\n tsconfigPath,\n extractorDisabled,\n } = options\n\n const tsdocConfigFile = await createTSDocConfig({\n customTags: customTags || [],\n })\n\n const filePath = filePaths[0]!.replace(/\\.d\\.[mc]ts$/, '.d.ts')\n // If there are package.config.ts `bundles` we might not have something that should leave behind a `.d.ts` file and need to handle that\n const shouldCleanUpDts = !filePaths.includes(filePath)\n const extractorConfig: ExtractorConfig = ExtractorConfig.prepare({\n configObject: createApiExtractorConfig({\n bundledPackages,\n distPath,\n exportPath,\n filePath,\n messages: getExtractMessagesConfig({rules, disabled: extractorDisabled}),\n projectFolder: projectPath,\n mainEntryPointFilePath: sourceTypesPath,\n tsconfig,\n tsconfigPath,\n dtsRollupEnabled: true,\n }),\n configObjectFullPath: undefined,\n tsdocConfigFile,\n packageJsonFullPath: path.resolve(projectPath, 'package.json'),\n })\n\n const messages: ExtractorMessage[] = []\n\n // Invoke API Extractor\n const extractorResult = Extractor.invoke(extractorConfig, {\n // Equivalent to the \"--local\" command-line parameter\n localBuild: true,\n // Equivalent to the \"--verbose\" command-line parameter\n showVerboseMessages: true,\n // handle messages\n messageCallback(message: ExtractorMessage) {\n messages.push(message)\n message.handled = true\n },\n })\n\n const typesPath = path.resolve(distPath, filePath)\n const typesBuf = await fs.readFile(typesPath)\n const prettierConfig = await prettier.resolveConfig(typesPath)\n\n await mkdirp(path.dirname(typesPath))\n\n const {extractModuleBlocksFromTypes} = await import('./extractModuleBlocks.ts')\n const moduleBlocks = extractModuleBlocksFromTypes({\n extractResult: extractorResult,\n tsOutDir: tmpPath,\n })\n\n const code = [typesBuf.toString(), ...moduleBlocks].join('\\n\\n')\n const prettyCode = await prettier.format(code, {\n ...prettierConfig,\n filepath: typesPath,\n })\n\n for (const expFilePath of filePaths) {\n const expTypesPath = path.resolve(distPath, expFilePath)\n\n await fs.writeFile(expTypesPath, prettyCode)\n\n // Add to `files` in context\n files.push({\n type: 'types',\n path: expTypesPath,\n })\n }\n\n if (shouldCleanUpDts) {\n await fs.unlink(typesPath)\n }\n\n return {extractorResult, messages}\n}\n","import path from 'node:path'\nimport {ExtractorLogLevel, type ExtractorMessage} from '@microsoft/api-extractor'\nimport {rimraf} from 'rimraf'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport {buildTypes} from './buildTypes.ts'\nimport {DtsError} from './DtsError.ts'\nimport {extractTypes} from './extractTypes.ts'\nimport type {DtsResult, DtsTask, DtsWatchTask} from './types.ts'\n\n/**\n * - Build type definitions to a temporary directory using TypeScript compiler.\n * - Create a type definition bundle for each export entry.\n * - When done, remove the temporary directory.\n */\nexport async function doExtract(\n ctx: BuildContext,\n task: DtsTask | DtsWatchTask,\n): Promise<DtsResult> {\n const {config, cwd, files, logger, strict, ts, bundledPackages} = ctx\n\n if (!ts.config || !ts.configPath) {\n return {type: 'dts', messages: [], results: []}\n }\n\n const {outDir, rootDir = cwd} = ts.config.options\n\n if (!outDir) {\n throw new Error('tsconfig.json is missing `compilerOptions.outDir`')\n }\n\n const tmpPath = path.resolve(outDir, '__tmp__')\n\n await buildTypes({\n cwd,\n logger,\n outDir: tmpPath,\n strict,\n tsconfig: ts.config,\n checkTypes: config?.extract?.checkTypes,\n })\n const messages: ExtractorMessage[] = []\n\n const results: {sourcePath: string; filePaths: string[]}[] = []\n\n for (const entry of task.entries) {\n const exportPath = entry.exportPath === '.' ? './index' : entry.exportPath\n\n const sourceTypesPath = path.resolve(\n tmpPath,\n path.relative(rootDir, path.resolve(cwd, entry.sourcePath)).replace(/\\.ts$/, '.d.ts'),\n )\n\n const targetPaths = entry.targetPaths.map((targetPath) => path.resolve(cwd, targetPath))\n const filePaths = targetPaths.map((targetPath) => path.relative(outDir, targetPath))\n const result = await extractTypes({\n bundledPackages: bundledPackages || [],\n customTags: config?.extract?.customTags,\n cwd,\n distPath: outDir,\n exportPath,\n files,\n filePaths,\n projectPath: cwd,\n rules: config?.extract?.rules,\n sourceTypesPath: sourceTypesPath,\n tsconfig: ts.config,\n tmpPath,\n tsconfigPath: path.resolve(cwd, ts.configPath || 'tsconfig.json'),\n extractorDisabled: config?.extract?.enabled === false,\n })\n\n messages.push(...result.messages)\n\n const errors = result.messages.filter((msg) => msg.logLevel === ExtractorLogLevel.Error)\n\n if (errors.length > 0) {\n await rimraf(tmpPath)\n throw new DtsError(`encountered ${errors.length} errors when extracting types`, errors)\n }\n\n results.push({sourcePath: path.resolve(cwd, entry.sourcePath), filePaths: targetPaths})\n }\n\n await rimraf(tmpPath)\n\n return {type: 'dts', messages, results}\n}\n","import chalk from 'chalk'\nimport {from} from 'rxjs'\nimport {printExtractMessages} from '../../printExtractMessages.ts'\nimport type {TaskHandler} from '../types.ts'\nimport {doExtract} from './doExtract.ts'\nimport {DtsError} from './DtsError.ts'\nimport type {DtsResult, DtsTask} from './types.ts'\n\n/** @internal */\nexport const dtsTask: TaskHandler<DtsTask, DtsResult> = {\n name: (ctx, task) =>\n [\n `Build type definitions with ${chalk.bold(ctx.dts)}...`,\n ' entries:',\n ...task.entries.map((entry) => {\n return entry.targetPaths\n .map((targetPath) => {\n return [\n ` - ${chalk.cyan(entry.importId)}: `,\n `${chalk.yellow(entry.sourcePath)} ${chalk.gray('→')} ${chalk.yellow(targetPath)}`,\n ].join('')\n })\n .join('\\n')\n }),\n ].join('\\n'),\n exec: (ctx, task) => {\n return from(doExtract(ctx, task))\n },\n complete: (ctx, _task, result) => {\n printExtractMessages(ctx, result.messages)\n },\n error: (ctx, _task, err) => {\n const {logger} = ctx\n\n if (err instanceof DtsError) {\n printExtractMessages(ctx, err.messages)\n } else if (err instanceof Error) {\n logger.error(err)\n }\n },\n}\n","import path from 'node:path'\nimport type {ExtractorMessage} from '@microsoft/api-extractor'\nimport ts from '@typescript/typescript6'\nimport chalk from 'chalk'\nimport * as rimraf from 'rimraf'\nimport {Observable} from 'rxjs'\nimport {printExtractMessages} from '../../printExtractMessages.ts'\nimport type {TaskHandler} from '../types.ts'\nimport {buildTypes} from './buildTypes.ts'\nimport {DtsError} from './DtsError.ts'\nimport {extractTypes} from './extractTypes.ts'\nimport type {DtsResult, DtsWatchTask} from './types.ts'\n\n/** @internal */\nexport const dtsWatchTask: TaskHandler<DtsWatchTask, DtsResult> = {\n name: (_ctx, task) =>\n [\n 'build type definitions',\n ...task.entries.map((entry) => {\n return entry.targetPaths.map((targetPath) => {\n return [\n ` - ${chalk.cyan(entry.importId)}: `,\n `${chalk.yellow(entry.sourcePath)} ${chalk.gray('→')} ${chalk.yellow(targetPath)}`,\n ].join('')\n })\n }),\n ].join('\\n'),\n exec: (ctx, task) => {\n const {config, cwd, files, logger, strict, ts: tsContext, bundledPackages} = ctx\n\n return new Observable((observer) => {\n const {config: tsConfig, configPath: tsConfigPath} = tsContext\n\n if (!tsConfig || !tsConfigPath) {\n observer.next({type: 'dts', messages: [], results: []})\n observer.complete()\n\n return () => {}\n }\n\n const {outDir, rootDir = cwd} = tsConfig.options\n\n if (!outDir) {\n observer.error(new Error('tsconfig.json is missing `compilerOptions.outDir`'))\n\n return () => {}\n }\n\n const tmpPath = path.resolve(outDir, '__tmp__')\n\n buildTypes({\n cwd,\n logger,\n outDir: tmpPath,\n tsconfig: tsConfig,\n strict,\n checkTypes: config?.extract?.checkTypes,\n }).catch((err) => {\n observer.error(err)\n })\n\n const host = ts.createWatchCompilerHost(\n tsConfigPath,\n {\n ...tsConfig.options,\n declaration: true,\n declarationDir: tmpPath,\n emitDeclarationOnly: true,\n noEmit: false,\n noEmitOnError: strict ? true : (tsConfig.options.noEmitOnError ?? true),\n noCheck:\n config?.extract?.checkTypes === false\n ? true\n : (tsConfig.options.noCheck ?? tsConfig.options.isolatedDeclarations),\n outDir: tmpPath,\n },\n ts.sys,\n ts.createEmitAndSemanticDiagnosticsBuilderProgram,\n (diagnostic) => {\n logger.error(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n },\n (diagnostic) => {\n logger.info(ts.flattenDiagnosticMessageText(diagnostic.messageText, '\\n'))\n },\n )\n\n // oxlint-disable-next-line unbound-method\n const origPostProgramCreate = host.afterProgramCreate\n\n host.afterProgramCreate = async (program) => {\n origPostProgramCreate?.(program)\n\n const messages: ExtractorMessage[] = []\n const results: {sourcePath: string; filePaths: string[]}[] = []\n\n for (const entry of task.entries) {\n const exportPath = entry.exportPath === '.' ? './index' : entry.exportPath\n\n const sourceTypesPath = path.resolve(\n tmpPath,\n path.relative(rootDir, path.resolve(cwd, entry.sourcePath)).replace(/\\.ts$/, '.d.ts'),\n )\n\n const targetPaths = entry.targetPaths.map((targetPath) => path.resolve(cwd, targetPath))\n const filePaths = targetPaths.map((targetPath) => path.relative(outDir, targetPath))\n\n try {\n const result = await extractTypes({\n bundledPackages: bundledPackages || [],\n customTags: config?.extract?.customTags,\n cwd,\n distPath: outDir,\n exportPath,\n files,\n filePaths,\n projectPath: cwd,\n rules: config?.extract?.rules,\n sourceTypesPath: sourceTypesPath,\n tsconfig: tsConfig,\n tmpPath,\n tsconfigPath: path.resolve(cwd, tsConfigPath),\n extractorDisabled: config?.extract?.enabled === false,\n })\n\n messages.push(...result.messages)\n results.push({sourcePath: path.resolve(cwd, entry.sourcePath), filePaths: targetPaths})\n } catch (err) {\n if (err instanceof DtsError) {\n messages.push(...err.messages)\n } else {\n observer.error(err)\n\n return\n }\n }\n }\n\n observer.next({type: 'dts', messages, results})\n }\n\n const watchProgram = ts.createWatchProgram(host)\n\n return () => {\n watchProgram.close()\n rimraf.sync(tmpPath)\n }\n })\n },\n complete: (ctx, task, result) => {\n const {logger} = ctx\n\n printExtractMessages(ctx, result.messages)\n\n logger.success(\n `build type definitions\\n ${task.entries\n .map(\n (entry) =>\n ` - ${chalk.cyan(entry.importId)}: ${chalk.yellow(entry.sourcePath)} ${chalk.gray('→')} ${chalk.yellow(entry.targetPaths.join(', '))}`,\n )\n .join('\\n ')}`,\n )\n logger.log('')\n },\n error: (ctx, _task, err) => {\n const {logger} = ctx\n\n if (err instanceof DtsError) {\n printExtractMessages(ctx, err.messages)\n } else if (err instanceof Error) {\n logger.error(err)\n }\n },\n}\n","import path from 'node:path'\nimport chalk from 'chalk'\nimport {from} from 'rxjs'\nimport {createConsoleSpy} from '../../consoleSpy.ts'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport type {RolldownDtsTask, TaskHandler} from '../types.ts'\n\n/** @internal */\nexport const rolldownDtsTask: TaskHandler<RolldownDtsTask> = {\n name: (ctx, task) => {\n const bundleEntries = task.entries.filter((e) => e.path.includes('__$$bundle_'))\n const entries = task.entries.filter((e) => !e.path.includes('__$$bundle_'))\n\n const targetLines = task.target.length\n ? [` target:`, ...task.target.map((t) => ` - ${chalk.yellow(t)}`)]\n : []\n\n const bundlesLines = bundleEntries.length\n ? [\n ' bundles:',\n ...bundleEntries.map((e) =>\n [\n ` - `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(replaceFileEnding(e.output))}`,\n ].join(''),\n ),\n ]\n : []\n\n const entriesLines = entries.length\n ? [\n ' entries:',\n ...entries.map((e) =>\n [\n ` - `,\n `${chalk.cyan(path.join(ctx.pkg.name, e.path))}: `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(replaceFileEnding(e.output))}`,\n ].join(''),\n ),\n ]\n : []\n\n return [\n `Build type definitions with ${chalk.bold('rolldown')}...`,\n ` format: ${chalk.yellow(task.format)}`,\n ...targetLines,\n ...bundlesLines,\n ...entriesLines,\n ].join('\\n')\n },\n exec: (ctx, task) => {\n return from(execPromise(ctx, task))\n },\n complete: () => {\n //\n },\n error: (_ctx, _task, err) => {\n console.error(err)\n },\n}\n\nasync function execPromise(ctx: BuildContext, task: RolldownDtsTask) {\n const [{rolldown}, {resolveRolldownConfig}] = await Promise.all([\n import('rolldown'),\n import('./resolveRolldownConfig.ts'),\n ])\n const {distPath, files, logger} = ctx\n const outDir = path.relative(ctx.cwd, distPath)\n\n // Prevent rolldown from printing directly to the console\n const consoleSpy = createConsoleSpy({\n onRestored: (messages) => {\n for (const msg of messages) {\n const text = String(msg.args[0])\n\n if (msg.code === 'CIRCULAR_DEPENDENCY') {\n continue // ignore\n }\n\n if (text.startsWith('Dynamic import can only')) {\n continue // ignore\n }\n\n if (text.startsWith('Sourcemap is likely to be incorrect')) {\n continue // ignore\n }\n\n if (msg.type === 'log') {\n logger.info(...msg.args)\n }\n\n if (msg.type === 'warn') {\n logger.warn(...msg.args)\n }\n\n if (msg.type === 'error') {\n logger.error(...msg.args)\n }\n }\n },\n })\n\n try {\n const {inputOptions, outputOptions} = resolveRolldownConfig(ctx, task)\n\n // Create bundle\n const bundle = await rolldown({\n ...inputOptions,\n onwarn(warning) {\n consoleSpy.messages.push({\n type: 'warn',\n code: warning.code,\n args: [warning.message],\n })\n },\n })\n\n // generate output specific code in-memory\n // you can call this function multiple times on the same bundle object\n const {output} = await bundle.generate(outputOptions)\n\n for (const chunkOrAsset of output) {\n if (chunkOrAsset.type === 'asset') {\n files.push({\n type: 'asset',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n } else {\n files.push({\n type: 'chunk',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n }\n }\n\n // or write the bundle to disk\n await bundle.write(outputOptions)\n\n // closes the bundle\n await bundle.close()\n\n // Restore console\n consoleSpy.restore()\n } catch (err) {\n // Restore console\n consoleSpy.restore()\n throw err\n }\n}\n\nfunction replaceFileEnding(filePath: string) {\n switch (true) {\n case filePath.endsWith('.mjs'):\n return filePath.replace(/\\.mjs$/, '.d.mts')\n case filePath.endsWith('.cjs'):\n return filePath.replace(/\\.cjs$/, '.d.cts')\n default:\n return filePath.replace(/\\.js$/, '.d.ts')\n }\n}\n","import type {Plugin} from 'rollup'\nimport {cssShimDtsFileName, cssShimFileName} from '../../core/pkg/cssShimFileName.ts'\n\n/**\n * Emits a no-op JavaScript shim alongside the extracted CSS. The conditional `./<css>` export\n * points its `node`/`default` conditions at this file so that the self-referential\n * `import \"<pkg>/<css>\"` resolves to a harmless module in runtimes that cannot import `.css`\n * files, instead of throwing `Error: Unknown file extension \".css\"`.\n *\n * Matching `.d.ts` declarations are emitted for both export targets:\n * - `<css>.d.ts` for the extracted CSS file (`browser` / `style` conditions)\n * - `<css-shim>.d.ts` (e.g. `bundle-css.d.ts`) for the JS shim (`node` / `default` conditions)\n *\n * The shim is named `bundle-css.js` rather than `bundle.css.js` so it does not match\n * vanilla-extract's `cssFileFilter` (`/\\.css\\.(js|…)$/`).\n *\n * @param options.cssName - The CSS file name, e.g. `bundle.css`.\n * @internal\n */\nexport function bundleCssShim(options: {cssName: string}): Plugin {\n const {cssName} = options\n const shimFileName = cssShimFileName(cssName)\n\n return {\n name: 'pkg-utils:bundle-css-shim',\n generateBundle() {\n this.emitFile({\n type: 'asset',\n fileName: shimFileName,\n source: `// No-op shim for \\`${cssName}\\` in runtimes that cannot import \\`.css\\` files directly.\\nexport default \"\"\\n`,\n })\n this.emitFile({\n type: 'asset',\n fileName: `${cssName}.d.ts`,\n source: `// Type declarations for \\`${cssName}\\` and its no-op JS shim.\\ndeclare const _default: string\\nexport default _default\\n`,\n })\n this.emitFile({\n type: 'asset',\n fileName: cssShimDtsFileName(cssName),\n source: `// Type declarations for \\`${cssName}\\` and its no-op JS shim.\\ndeclare const _default: string\\nexport default _default\\n`,\n })\n },\n }\n}\n","import {basename} from 'node:path'\nimport browserslist from 'browserslist'\nimport {browserslistToTargets, transform} from 'lightningcss'\nimport type {OutputAsset, Plugin} from 'rollup'\n\nexport function optimizeCss(options: {\n extractFileName: string\n browserslist: string | string[]\n minify?: boolean\n}): Plugin {\n return {\n name: 'optimize-css',\n\n async generateBundle(_outputOptions, bundle, _isWrite) {\n for (const [fileName, assetOrChunk] of Object.entries(bundle)) {\n // find CSS assets\n if (assetOrChunk.type === 'asset') {\n const asset = assetOrChunk\n if (asset.originalFileNames.includes(options.extractFileName)) {\n const sourceMapFileName = `${fileName}.map`\n await transformCss(\n asset,\n bundle[sourceMapFileName]?.type === 'asset' ? bundle[sourceMapFileName] : undefined,\n options.browserslist,\n options.minify ?? true,\n )\n }\n }\n }\n },\n }\n}\n\nasync function transformCss(\n asset: OutputAsset,\n sourceMapAsset: OutputAsset | undefined,\n browserslistConfig: string | string[],\n minify: boolean,\n) {\n const css = asset.source.toString()\n const file = asset.fileName\n\n const targets = browserslistToTargets(browserslist(browserslistConfig))\n\n // process (and, unless disabled, minify) css using lightningcss\n const lightningCssResult = transform({\n filename: file,\n code: Buffer.from(css),\n minify,\n cssModules: false,\n targets,\n sourceMap: !!sourceMapAsset,\n inputSourceMap: sourceMapAsset ? sourceMapAsset.source.toString() : undefined,\n })\n\n if (lightningCssResult.warnings.length) {\n // eslint-disable-next-line no-console\n console.warn(lightningCssResult.warnings)\n }\n\n asset.source = new TextDecoder().decode(lightningCssResult.code)\n if (sourceMapAsset && lightningCssResult.map) {\n sourceMapAsset.source = new TextDecoder().decode(lightningCssResult.map)\n asset.source += `\\n/*# sourceMappingURL=${basename(sourceMapAsset.fileName)}*/\\n`\n }\n}\n","import path from 'node:path'\nimport {optimizeLodashImports} from '@optimize-lodash/rollup-plugin'\nimport alias from '@rollup/plugin-alias'\nimport {babel, getBabelOutputPlugin} from '@rollup/plugin-babel'\nimport commonjs from '@rollup/plugin-commonjs'\nimport json from '@rollup/plugin-json'\nimport {nodeResolve} from '@rollup/plugin-node-resolve'\nimport replace from '@rollup/plugin-replace'\nimport terser from '@rollup/plugin-terser'\nimport type {PackageJSON} from '@sanity/parse-package-json'\nimport {vanillaExtractPlugin} from '@vanilla-extract/rollup-plugin'\nimport type {InputOptions, OutputOptions, RenderedChunk} from 'rollup'\nimport esbuild from 'rollup-plugin-esbuild'\nimport {pkgExtMap as extMap} from '../../../node/core/pkg/pkgExt.ts'\nimport {resolveConfigProperty} from '../../core/config/resolveConfigProperty.ts'\nimport {\n resolveVanillaExtract,\n resolveVanillaExtractCssName,\n} from '../../core/config/vanillaExtract.ts'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport {DEFAULT_BROWSERSLIST_QUERY} from '../../core/defaults.ts'\nimport type {RollupTask, RollupWatchTask} from '../types.ts'\nimport {bundleCssShim} from './bundleCssShim.ts'\nimport {optimizeCss} from './optimizeCss.ts'\n\n// Type guard to filter out falsy values\nfunction isTruthy<T>(value: T | false | null | undefined | 0 | ''): value is T {\n return Boolean(value)\n}\n\n/**\n * Check if a package is in the peerDependencies\n */\nfunction hasPeerDependency(pkg: PackageJSON, packageName: string): boolean {\n return pkg.peerDependencies ? packageName in pkg.peerDependencies : false\n}\n\n/**\n * Check if a package is in the devDependencies\n */\nfunction hasDevDependency(pkg: PackageJSON, packageName: string): boolean {\n return pkg.devDependencies ? packageName in pkg.devDependencies : false\n}\n\n// Track if we've already logged styled-components messages to avoid duplicates\nlet styledComponentsLogged = false\n\n/**\n * Determine if styled-components should be enabled\n */\nfunction shouldEnableStyledComponents(\n config: BuildContext['config'],\n pkg: PackageJSON,\n logger: BuildContext['logger'],\n): boolean {\n const hasStyledComponents = hasPeerDependency(pkg, 'styled-components')\n const hasBabelPluginStyledComponents = hasDevDependency(pkg, 'babel-plugin-styled-components')\n const styledComponentsConfigSet = config?.babel?.styledComponents !== undefined\n\n // If explicitly set, respect that\n if (styledComponentsConfigSet) {\n return !!config?.babel?.styledComponents\n }\n\n // Log messages only once per build\n if (!styledComponentsLogged) {\n styledComponentsLogged = true\n\n if (hasStyledComponents) {\n if (hasBabelPluginStyledComponents) {\n // Log that auto-enabling will happen\n logger.log(\n 'Detected styled-components in peerDependencies and babel-plugin-styled-components in devDependencies. Automatically enabling babel.styledComponents. To disable this, set `babel: { styledComponents: false }` in package.config.ts.',\n )\n } else {\n // Warn if styled-components is present but babel-plugin-styled-components is not\n logger.warn(\n 'Detected styled-components in peerDependencies. Consider installing babel-plugin-styled-components as a devDependency to enable better debugging and optimization. Add `\"babel-plugin-styled-components\": \"^2.0.0\"` to devDependencies and it will be automatically enabled, or set `babel: { styledComponents: false }` in package.config.ts to disable this warning.',\n )\n }\n }\n }\n\n // Auto-enable if both styled-components and babel plugin are present\n if (hasStyledComponents && hasBabelPluginStyledComponents) {\n return true\n }\n\n return false\n}\n\nexport interface RollupConfig {\n inputOptions: InputOptions\n outputOptions: OutputOptions\n}\n\n/** @internal */\nexport function resolveRollupConfig(\n ctx: BuildContext,\n buildTask: RollupTask | RollupWatchTask,\n): RollupConfig {\n const {format, runtime, target} = buildTask\n const {config, cwd, exports: _exports, external, distPath, logger, pkg, ts} = ctx\n const outputExt = extMap[pkg.type || 'commonjs'][format]\n const minify = config?.minify ?? false\n const outDir = path.relative(cwd, distPath)\n\n const pathAliases = Object.fromEntries(\n Object.entries(ts.config?.options.paths || {}).flatMap(([key, val]) => {\n const pathAlias = val[0]\n if (!pathAlias) return []\n return [[key, path.resolve(cwd, ts.config?.options.baseUrl || '.', pathAlias)]]\n }),\n )\n\n const entries = buildTask.entries.map((entry) => {\n return {\n ...entry,\n name: path.relative(outDir, entry.output).replace(/\\.[^/.]+$/, ''),\n }\n }, {})\n\n const exportIds =\n _exports && Object.keys(_exports).map((exportPath) => path.join(pkg.name, exportPath))\n\n const sourcePaths = _exports && Object.values(_exports).map((e) => path.resolve(cwd, e.source))\n\n const replacements = Object.fromEntries(\n Object.entries(config?.define || {}).map(([key, val]) => [key, JSON.stringify(val)]),\n )\n\n const {optimizeLodash: enableOptimizeLodash = hasDependency(pkg, 'lodash')} = config?.rollup || {}\n\n // Auto-detect if styled-components should be enabled\n const enableStyledComponents = shouldEnableStyledComponents(config, pkg, logger)\n\n // Resolve vanilla-extract options + the conditional CSS export \"compat mode\"\n const vanillaExtract = resolveVanillaExtract(config)\n const vanillaExtractCssName = resolveVanillaExtractCssName(vanillaExtract.options, {\n compatMode: vanillaExtract.compatMode,\n runtime,\n })\n\n const defaultPlugins = [\n replace({\n preventAssignment: true,\n values:\n pkg.name === '@sanity/pkg-utils'\n ? {...replacements}\n : {\n 'process.env.PKG_FILE_PATH': (arg) => {\n const sourcePath = `./${path.relative(cwd, arg)}`\n const entry = entries.find((e) => e.source === sourcePath)\n\n if (!entry) {\n console.error(`could not find source entry: ${sourcePath}`)\n\n return 'null'\n }\n\n return JSON.stringify(\n path.relative(cwd, path.resolve(outDir, entry.name + outputExt)),\n )\n },\n 'process.env.PKG_FORMAT': JSON.stringify(format),\n 'process.env.PKG_RUNTIME': JSON.stringify(runtime),\n 'process.env.PKG_VERSION': JSON.stringify(process.env['PKG_VERSION'] || pkg.version),\n ...replacements,\n },\n }),\n alias({\n entries: {...pathAliases},\n }),\n nodeResolve({\n browser: runtime === 'browser',\n extensions: ['.cjs', '.mjs', '.js', '.jsx', '.json', '.node'],\n preferBuiltins: true,\n }),\n commonjs(),\n json(),\n vanillaExtract.enabled &&\n vanillaExtractPlugin({\n identifiers: vanillaExtract.options.identifiers ?? 'short',\n cwd: vanillaExtract.options.cwd,\n esbuildOptions: vanillaExtract.options.esbuildOptions,\n unstable_injectFilescopes: vanillaExtract.options.unstable_injectFilescopes,\n extract: {\n name: vanillaExtractCssName,\n sourcemap: vanillaExtract.options.extract?.sourcemap ?? true,\n },\n }),\n vanillaExtract.enabled &&\n optimizeCss({\n extractFileName: vanillaExtractCssName,\n browserslist: vanillaExtract.options.browserslist || DEFAULT_BROWSERSLIST_QUERY,\n minify: vanillaExtract.options.minify ?? true,\n }),\n // In compat mode, emit the no-op JS shim that the `node`/`default` conditions of the\n // `./<css>` export resolve to (named `bundle-css.js`, not `bundle.css.js`, so it does not\n // match vanilla-extract's `cssFileFilter`).\n vanillaExtract.compatMode && bundleCssShim({cssName: vanillaExtractCssName}),\n (config?.babel?.reactCompiler || enableStyledComponents) &&\n babel({\n babelrc: false,\n presets: ['@babel/preset-typescript'],\n babelHelpers: 'bundled',\n parallel: true,\n extensions: ['.ts', '.tsx', '.js', '.jsx'],\n plugins: [\n // The styled-components plugin needs to run before the react-compiler plugin, in case the css prop is used\n enableStyledComponents && [\n 'babel-plugin-styled-components',\n {\n // Unnecessary, as the way we use styled-components in Sanity is usually by wrapping `@sanity/ui` primitives, not declaring new ones like \"const Button = styled.button``\"\n fileName: false,\n // Transpile `styled.button`...`` to `styled.button([\"...\"])` so that the `pure` option below\n // can annotate a plain call expression. Pure annotations on tagged template expressions are\n // not supported by any bundler (https://github.com/rollup/rollup/issues/4035), so without\n // this transpilation unused styled components can't be tree-shaken at all.\n transpileTemplateLiterals: true,\n // Massively helps dead code elimination and tree-shaking\n pure: true,\n // disabled, as pkg-utils tends to be used for npm publishing, while other tooling, like `sanity dev`, `next dev`, etc are used for testing\n cssProp: false,\n ...(typeof config?.babel?.styledComponents === 'object'\n ? config.babel.styledComponents\n : {}),\n },\n ],\n config?.babel?.reactCompiler && [\n 'babel-plugin-react-compiler',\n config?.reactCompilerOptions || {},\n ],\n ].filter(isTruthy),\n }),\n esbuild({\n jsx: config?.jsx ?? 'automatic',\n jsxFactory: config?.jsxFactory ?? 'createElement',\n jsxFragment: config?.jsxFragment ?? 'Fragment',\n jsxImportSource: config?.jsxImportSource ?? 'react',\n target,\n tsconfig: ctx.ts.configPath || 'tsconfig.json',\n treeShaking: true,\n minifySyntax: config?.minify !== false,\n supported: {\n 'template-literal': true,\n },\n }),\n Array.isArray(config?.babel?.plugins) &&\n getBabelOutputPlugin({\n babelrc: false,\n parallel: true,\n plugins: config.babel.plugins,\n }),\n enableOptimizeLodash &&\n optimizeLodashImports({\n useLodashEs: format === 'esm' && hasDependency(pkg, 'lodash-es') ? true : undefined,\n ...(typeof config?.rollup?.optimizeLodash === 'boolean'\n ? {}\n : config?.rollup?.optimizeLodash),\n }),\n minify &&\n terser({\n compress: {directives: false, passes: 10},\n ecma: 2020,\n output: {\n comments: (_node, comment) => {\n const text = comment.value\n const cType = comment.type\n\n // Check if this is a multiline comment\n if (cType === 'comment2') {\n // Keep licensing comments\n return /@preserve|@license|@cc_on/i.test(text)\n }\n\n return false\n },\n preserve_annotations: true,\n },\n }),\n ].filter(isTruthy)\n\n const userPlugins = config?.rollup?.plugins\n\n const plugins = Array.isArray(userPlugins)\n ? defaultPlugins.concat(userPlugins)\n : resolveConfigProperty(config?.rollup?.plugins, defaultPlugins)\n\n const hashChunkFileNames = config?.rollup?.hashChunkFileNames ?? false\n const chunksFolder = hashChunkFileNames ? '_chunks' : '_chunks-[format]'\n const chunkFileNames = `${chunksFolder}/${hashChunkFileNames ? '[name]-[hash]' : '[name]'}${outputExt}`\n const entryFileNames = `[name]${outputExt}`\n\n return {\n inputOptions: {\n context: cwd,\n\n external: (id, importer) => {\n // Check if the id is a self-referencing import\n if (exportIds?.includes(id)) {\n return true\n }\n\n // Check if the id is a file path that points to an exported source file\n if (importer && (id.startsWith('.') || id.startsWith('/'))) {\n const idPath = path.resolve(path.dirname(importer), id)\n\n if (sourcePaths?.includes(idPath)) {\n logger.warn(\n `detected self-referencing import – treating as external: ${path.relative(\n cwd,\n idPath,\n )}`,\n )\n\n return true\n }\n }\n\n const idParts = id.split('/')\n\n const name = idParts[0]!.startsWith('@') ? `${idParts[0]}/${idParts[1]}` : idParts[0]\n\n if (name && external.includes(name)) {\n return true\n }\n\n return false\n },\n\n input: entries.reduce<{[entryAlias: string]: string}>(\n (acc, entry) => Object.assign(acc, {[entry.name]: entry.source}),\n {},\n ),\n\n watch: {\n chokidar: {\n usePolling: true,\n },\n },\n\n plugins,\n\n // Rely on Rollup's `recommended` tree-shaking defaults instead of customizing\n // `moduleSideEffects`/`propertyReadSideEffects` ourselves. Previously we set\n // `moduleSideEffects` to the equivalent of `'no-external'` (with a `.css` exemption),\n // which incorrectly stripped intentional side-effect-only imports of external packages\n // (e.g. `import 'react-time-ago/locale/en'`) from the bundle. The `recommended` preset\n // uses `moduleSideEffects: true`, so these imports are preserved while `package.json`\n // `sideEffects` fields are still honored for bundled modules.\n treeshake: {\n preset: 'recommended',\n ...config?.rollup?.treeshake,\n },\n experimentalLogSideEffects: config?.rollup?.experimentalLogSideEffects,\n },\n outputOptions: {\n chunkFileNames,\n compact: minify,\n dir: outDir,\n entryFileNames,\n esModule: true,\n format,\n interop: 'compat',\n sourcemap: config?.sourcemap ?? true,\n hoistTransitiveImports: false,\n minifyInternalExports: minify,\n assetFileNames: '[name][extname]',\n ...config?.rollup?.output,\n // In compat mode, inject the self-referential bundle.css import into the `index` entry chunk\n // so userland does not need to set `rollup.output.intro` themselves. Use `require()` for CommonJS output\n // (a top-level `import` would be invalid in a `.cjs` bundle).\n ...(vanillaExtract.compatMode\n ? {\n intro: composeIntro(\n format === 'commonjs'\n ? `require(${JSON.stringify(`${pkg.name}/${vanillaExtractCssName}`)})`\n : `import ${JSON.stringify(`${pkg.name}/${vanillaExtractCssName}`)}`,\n config?.rollup?.output?.intro,\n ),\n }\n : {}),\n },\n }\n}\n\n/**\n * Build an `intro` function that prepends `autoImport` to the `index` entry chunk only,\n * preserving any user-provided `intro`.\n */\nfunction composeIntro(\n autoImport: string,\n userIntro: OutputOptions['intro'],\n): (chunkInfo: RenderedChunk) => Promise<string> {\n return async (chunkInfo) => {\n const auto = chunkInfo.isEntry && chunkInfo.name === 'index' ? `${autoImport}\\n` : ''\n const user =\n typeof userIntro === 'function'\n ? await userIntro(chunkInfo)\n : typeof userIntro === 'string'\n ? userIntro\n : ''\n\n return `${auto}${user}`\n }\n}\n\nfunction hasDependency(pkg: PackageJSON, packageName: string): boolean {\n return pkg.dependencies\n ? packageName in pkg.dependencies\n : pkg.peerDependencies\n ? packageName in pkg.peerDependencies\n : false\n}\n","import path from 'node:path'\nimport chalk from 'chalk'\nimport {rollup} from 'rollup'\nimport {from} from 'rxjs'\nimport {createConsoleSpy} from '../../consoleSpy.ts'\nimport type {BuildContext} from '../../core/contexts/buildContext.ts'\nimport type {RollupTask, TaskHandler} from '../types.ts'\nimport {resolveRollupConfig} from './resolveRollupConfig.ts'\n\n/** @internal */\nexport const rollupTask: TaskHandler<RollupTask> = {\n name: (ctx, task) => {\n const bundleEntries = task.entries.filter((e) => e.path.includes('__$$bundle_'))\n const entries = task.entries.filter((e) => !e.path.includes('__$$bundle_'))\n\n const targetLines = task.target.length\n ? [` target:`, ...task.target.map((t) => ` - ${chalk.yellow(t)}`)]\n : []\n\n const bundlesLines = bundleEntries.length\n ? [\n ' bundles:',\n ...bundleEntries.map((e) =>\n [\n ` - `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(e.output)}`,\n ].join(''),\n ),\n ]\n : []\n\n const entriesLines = entries.length\n ? [\n ' entries:',\n ...entries.map((e) =>\n [\n ` - `,\n `${chalk.cyan(path.join(ctx.pkg.name, e.path))}: `,\n `${chalk.yellow(e.source)} ${chalk.gray('→')} ${chalk.yellow(e.output)}`,\n ].join(''),\n ),\n ]\n : []\n\n return [\n `Build javascript files...`,\n ` format: ${chalk.yellow(task.format)}`,\n ...targetLines,\n ...bundlesLines,\n ...entriesLines,\n ].join('\\n')\n },\n exec: (ctx, task) => {\n return from(execPromise(ctx, task))\n },\n complete: () => {\n //\n },\n error: (_ctx, _task, err) => {\n console.error(err)\n },\n}\n\nasync function execPromise(ctx: BuildContext, task: RollupTask) {\n const {distPath, files, logger} = ctx\n const outDir = path.relative(ctx.cwd, distPath)\n\n // Prevent rollup from printing directly to the console\n const consoleSpy = createConsoleSpy({\n onRestored: (messages) => {\n for (const msg of messages) {\n const text = String(msg.args[0])\n\n if (msg.code === 'CIRCULAR_DEPENDENCY') {\n continue // ignore\n }\n\n if (text.startsWith('Dynamic import can only')) {\n continue // ignore\n }\n\n if (text.startsWith('Sourcemap is likely to be incorrect')) {\n continue // ignore\n }\n\n if (msg.type === 'log') {\n logger.info(...msg.args)\n }\n\n if (msg.type === 'warn') {\n logger.warn(...msg.args)\n }\n\n if (msg.type === 'error') {\n logger.error(...msg.args)\n }\n }\n },\n })\n\n try {\n const {inputOptions, outputOptions} = resolveRollupConfig(ctx, task)\n\n // Create bundle\n const bundle = await rollup({\n ...inputOptions,\n onwarn(warning) {\n consoleSpy.messages.push({\n type: 'warn',\n code: warning.code,\n args: [warning.message],\n })\n },\n })\n\n // generate output specific code in-memory\n // you can call this function multiple times on the same bundle object\n const {output} = await bundle.generate(outputOptions)\n\n for (const chunkOrAsset of output) {\n if (chunkOrAsset.type === 'asset') {\n files.push({\n type: 'asset',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n } else {\n files.push({\n type: 'chunk',\n path: path.resolve(outDir, chunkOrAsset.fileName),\n })\n }\n }\n\n // or write the bundle to disk\n await bundle.write(outputOptions)\n\n // closes the bundle\n await bundle.close()\n\n // Restore console\n consoleSpy.restore()\n } catch (err) {\n // Restore console\n consoleSpy.restore()\n throw err\n }\n}\n","import path from 'node:path'\nimport chalk from 'chalk'\nimport {watch as rollupWatch, type RollupWatcherEvent, type RollupWatchOptions} from 'rollup'\nimport {Observable} from 'rxjs'\nimport type {RollupWatchTask, TaskHandler} from '../types.ts'\nimport {resolveRollupConfig} from './resolveRollupConfig.ts'\n\n/** @internal */\nexport const rollupWatchTask: TaskHandler<RollupWatchTask, RollupWatcherEvent> = {\n name: (ctx, task) =>\n `build javascript files (target ${task.target.join(' + ')}, format ${\n task.format\n })\\n ${task.entries\n .map((e) => `${chalk.blue(path.join(ctx.pkg.name, e.path))}: ${e.source} -> ${e.output}`)\n .join('\\n ')}`,\n exec: (ctx, task) => {\n const {inputOptions, outputOptions} = resolveRollupConfig(ctx, task)\n\n return new Observable((observer) => {\n const watchOptions: RollupWatchOptions = {\n ...inputOptions,\n output: outputOptions,\n }\n\n const watcher = rollupWatch(watchOptions)\n\n watcher.on('event', (event) => {\n observer.next(event)\n })\n\n return () => {\n void watcher.close()\n }\n })\n },\n complete: (ctx, task, event) => {\n const {logger} = ctx\n\n if (event.code === 'BUNDLE_END') {\n logger.success(\n `build javascript files (target ${task.target.join(' + ')}, format ${\n task.format\n })\\n ${task.entries\n .map((e) => `${chalk.blue(path.join(ctx.pkg.name, e.path))}: ${e.source} -> ${e.output}`)\n .join('\\n ')}`,\n )\n logger.log('')\n\n return\n }\n\n if (event.code === 'BUNDLE_START') {\n return\n }\n\n if (event.code === 'END') {\n return\n }\n\n if (event.code === 'ERROR') {\n logger.error(event.code, event)\n\n return\n }\n\n if (event.code === 'START') {\n return\n }\n },\n error: (ctx, _task, err) => {\n const {logger} = ctx\n\n if (err instanceof Error) {\n logger.log(err)\n }\n },\n}\n","import {dtsTask} from './dts/dtsTask.ts'\nimport {dtsWatchTask} from './dts/dtsWatchTask.ts'\nimport {rolldownDtsTask} from './rolldown/rolldownDtsTask.ts'\nimport {rollupTask} from './rollup/rollupTask.ts'\nimport {rollupWatchTask} from './rollup/rollupWatchTask.ts'\nimport type {BuildTaskHandlers, WatchTaskHandlers} from './types.ts'\n\n/** @internal */\nexport const buildTaskHandlers: BuildTaskHandlers = {\n 'build:dts': dtsTask,\n 'build:js': rollupTask,\n 'rolldown:dts': rolldownDtsTask,\n}\n\n/** @internal */\nexport const watchTaskHandlers: WatchTaskHandlers = {\n 'watch:dts': dtsWatchTask,\n 'watch:js': rollupWat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E,MAAM,EAAE,EACvF,KAAK;AAAA,QAAW,CAAC;AAAA,MAAA,GAEtB,OAAO,IAAI,EAAE;AAEb;AAAA,IACF;AAEA,QAAI,MAAM,SAAS,kBAIf,MAAM,SAAS,OAInB;AAAA,UAAI,MAAM,SAAS,SAAS;AAC1B,eAAO,MAAM,MAAM,MAAM,KAAK;AAE9B;AAAA,MACF;AAEI,YAAM;AAAA,IAAA;AAAA,EAGZ;AAAA,EACA,OAAO,CAAC,KAAK,OAAO,QAAQ;AAC1B,UAAM,EAAC,WAAU;AAEb,mBAAe,SACjB,OAAO,IAAI,GAAG;AAAA,EAElB;AACF,GCpEa,oBAAuC;AAAA,EAClD,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,gBAAgB;AAClB,GAGa,oBAAuC;AAAA,EAClD,aAAa;AAAA,EACb,YAAY;AACd;"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveBuildContext.js","sources":["../../src/node/consoleSpy.ts","../../src/node/core/pkg/dependencyPlacement.ts","../../src/node/core/pkg/helpers.ts","../../src/node/core/pkg/validatePkg.ts","../../src/node/core/pkg/loadPkg.ts","../../src/node/core/pkg/loadPkgWithReporting.ts","../../../../../node_modules/.pnpm/browserslist-to-esbuild@2.1.1_browserslist@4.28.6/node_modules/browserslist-to-esbuild/src/index.js","../../src/node/core/config/resolveConfigProperty.ts","../../src/node/core/findCommonPath.ts","../../src/node/tasks/dts/getTargetPaths.ts","../../src/node/core/pkg/pkgExt.ts","../../src/node/core/pkg/validateExports.ts","../../src/node/core/pkg/parseAndValidateExports.ts","../../src/node/core/ts/loadTSConfig.ts","../../src/node/resolveBrowserTarget.ts","../../src/node/resolveNodeTarget.ts","../../src/node/strict.ts","../../src/node/resolveBuildContext.ts"],"sourcesContent":["// oxlint-disable no-console\nexport interface ConsoleSpyMsg {\n type: 'log' | 'warn' | 'error'\n code?: string\n args: unknown[]\n}\n\nexport interface ConsoleSpy {\n messages: ConsoleSpyMsg[]\n restore: () => void\n}\n\nexport function createConsoleSpy(options?: {\n onRestored?: (messages: ConsoleSpyMsg[]) => void\n}): ConsoleSpy {\n const {onRestored} = options || {}\n\n const original = {\n log: console.log,\n warn: console.warn,\n error: console.error,\n }\n\n const messages: ConsoleSpyMsg[] = []\n\n console.log = (...args: unknown[]) => messages.push({type: 'log', args})\n console.warn = (...args: unknown[]) => messages.push({type: 'warn', args})\n console.error = (...args: unknown[]) => messages.push({type: 'error', args})\n\n return {\n messages,\n restore: () => {\n console.log = original.log\n console.warn = original.warn\n console.error = original.error\n\n onRestored?.(messages)\n },\n }\n}\n","import type {PackageJSON} from '@sanity/parse-package-json'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\n\n/**\n * The `package.json` fields a dependency placement rule can reference.\n */\ntype DependencyField = 'dependencies' | 'devDependencies' | 'peerDependencies'\n\n/**\n * Describes where a given package may, and may not, be declared in `package.json`.\n */\ninterface DependencyPlacementRule {\n /** The name of the package this rule applies to. */\n name: string\n /** The `strictOptions` toggle that controls whether this rule runs. */\n option: keyof StrictOptions\n /** Fields the package must _not_ be declared in. */\n disallowedIn: DependencyField[]\n /** Fields the package is allowed to be declared in (used for messaging). */\n allowedIn: DependencyField[]\n /**\n * When set and the package is declared in `peerDependencies`, the version range must be\n * exactly this value (e.g. `*` for `@types/*` packages).\n */\n requiredPeerVersion?: string\n}\n\n/**\n * The set of dependency placement rules enforced in `--strict` mode.\n */\nconst dependencyPlacementRules: DependencyPlacementRule[] = [\n {\n name: 'react-is',\n option: 'noReactIsPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: '@sanity/ui',\n option: 'noSanityUiPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: '@sanity/icons',\n option: 'noSanityIconsPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: 'sanity',\n option: 'noSanityDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: 'styled-components',\n option: 'noStyledComponentsDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: 'react',\n option: 'noReactDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: 'react-dom',\n option: 'noReactDomDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: '@types/react',\n option: 'noReactTypesDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n requiredPeerVersion: '*',\n },\n {\n name: '@types/react-dom',\n option: 'noReactDomTypesDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n requiredPeerVersion: '*',\n },\n {\n name: '@types/node',\n option: 'noNodeTypesDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n requiredPeerVersion: '*',\n },\n {\n name: 'rxjs',\n option: 'noRxjsPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: '@sanity/client',\n option: 'noSanityClientPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n]\n\nfunction formatFields(fields: DependencyField[]): string {\n const labels = fields.map((field) => `\\`${field}\\``)\n\n if (labels.length <= 1) {\n return labels.join('')\n }\n\n return `${labels.slice(0, -1).join(', ')} or ${labels[labels.length - 1]}`\n}\n\n/**\n * Validates that well-known packages are declared in the correct `package.json` dependency\n * fields. Returns `true` if any rule with severity `error` was violated.\n * @internal\n */\nexport function checkDependencyPlacement(options: {\n pkg: PackageJSON\n logger: Logger\n strictOptions: StrictOptions\n}): boolean {\n const {pkg, logger, strictOptions} = options\n let shouldError = false\n\n const report = (level: 'error' | 'warn', message: string) => {\n if (level === 'error') {\n shouldError = true\n logger.error(message)\n } else {\n logger.warn(message)\n }\n }\n\n for (const rule of dependencyPlacementRules) {\n const level = strictOptions[rule.option]\n\n if (level === 'off') {\n continue\n }\n\n for (const field of rule.disallowedIn) {\n if (Object.hasOwn(pkg[field] ?? {}, rule.name)) {\n report(\n level,\n `package.json: \\`${rule.name}\\` should not be in \\`${field}\\`. It should be in ${formatFields(\n rule.allowedIn,\n )} instead.`,\n )\n }\n }\n\n if (rule.requiredPeerVersion !== undefined) {\n const peerDependencies = pkg.peerDependencies ?? {}\n\n if (\n Object.hasOwn(peerDependencies, rule.name) &&\n peerDependencies[rule.name] !== rule.requiredPeerVersion\n ) {\n report(\n level,\n `package.json: \\`${rule.name}\\` in \\`peerDependencies\\` should be set to \"${rule.requiredPeerVersion}\" (got \"${peerDependencies[rule.name]}\").`,\n )\n }\n }\n }\n\n return shouldError\n}\n","/** @internal */\nexport function assertLast<T>(a: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n\n // if not found, then we don't care\n if (aIdx === -1) {\n return true\n }\n\n return aIdx === arr.length - 1\n}\n\n/** @internal */\nexport function assertOrder<T>(a: T, b: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n const bIdx = arr.indexOf(b)\n\n // if either is not found, then we don't care\n if (aIdx === -1 || bIdx === -1) {\n return true\n }\n\n return aIdx < bIdx\n}\n","import {parsePackage, _typoMap as typoMap, type PackageJSON} from '@sanity/parse-package-json'\n\nexport function validatePkg(input: unknown): PackageJSON {\n const pkg = parsePackage(input)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Need to check raw input for typos\n const invalidKey = Object.keys(input as PackageJSON).find((key) => {\n const needle = key.toUpperCase()\n\n return typoMap.has(needle) ? typoMap.get(needle) !== key : false\n })\n\n if (invalidKey) {\n throw new TypeError(\n `\n- package.json: \"${invalidKey}\" is not a valid key. Did you mean \"${typoMap.get(invalidKey.toUpperCase())}\"?`,\n )\n }\n\n return pkg\n}\n","import fs from 'node:fs/promises'\nimport type {PackageJSON} from '@sanity/parse-package-json'\nimport {validatePkg} from './validatePkg.ts'\n\n/** @internal */\nexport async function loadPkg(options: {pkgPath: string}): Promise<PackageJSON> {\n const {pkgPath} = options\n\n const raw = JSON.parse(await fs.readFile(pkgPath, 'utf-8'))\n\n validatePkg(raw)\n\n return raw\n}\n","import {ZodError, type PackageJSON} from '@sanity/parse-package-json'\nimport chalk from 'chalk'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\nimport {checkDependencyPlacement} from './dependencyPlacement.ts'\nimport {assertLast, assertOrder} from './helpers.ts'\nimport {loadPkg} from './loadPkg.ts'\n\n/**\n * Helper function to recursively compare export values, excluding source, development, and monorepo conditions\n */\nfunction areExportValuesEqual(value1: unknown, value2: unknown): boolean {\n // If both are strings, simple comparison\n if (typeof value1 === 'string' && typeof value2 === 'string') {\n return value1 === value2\n }\n\n // If types don't match, they're not equal\n if (typeof value1 !== typeof value2) {\n return false\n }\n\n // Both are objects, compare recursively\n if (\n typeof value1 === 'object' &&\n value1 !== null &&\n typeof value2 === 'object' &&\n value2 !== null &&\n !Array.isArray(value1) &&\n !Array.isArray(value2)\n ) {\n const obj1 = value1 as Record<string, any>\n const obj2 = value2 as Record<string, any>\n\n const keys1 = Object.keys(obj1).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n const keys2 = Object.keys(obj2).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n\n // Check if they have the same keys\n if (keys1.length !== keys2.length) {\n return false\n }\n\n for (const key of keys1) {\n if (!keys2.includes(key)) {\n return false\n }\n\n const val1 = obj1[key]\n const val2 = obj2[key]\n\n // Skip if either value is undefined\n if (val1 === undefined || val2 === undefined) {\n return false\n }\n\n // Recursively compare nested values\n if (!areExportValuesEqual(val1, val2)) {\n return false\n }\n }\n\n return true\n }\n\n return false\n}\n\n/** @alpha */\nexport async function loadPkgWithReporting(options: {\n pkgPath: string\n logger: Logger\n strict: boolean\n strictOptions: StrictOptions\n}): Promise<PackageJSON> {\n const {pkgPath, logger, strict, strictOptions} = options\n\n try {\n const pkg = await loadPkg({pkgPath})\n let shouldError = false\n\n if (strict) {\n // Check for missing or commonjs type field\n if (strictOptions.preferModuleType !== 'off') {\n if (!pkg.type) {\n const msg =\n 'package.json: `type` field is missing. Future versions of pkg-utils will require `\"type\": \"module\"`. Consider adding `\"type\": \"module\"` to prepare for this change.'\n if (strictOptions.preferModuleType === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n } else if (pkg.type === 'commonjs') {\n const msg =\n 'package.json: `type` is set to \"commonjs\". Future versions of pkg-utils will require `\"type\": \"module\"`. Consider migrating to ES modules to prepare for this change.'\n if (strictOptions.preferModuleType === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n }\n }\n\n // Check for banned root-level fields\n if (strictOptions.noPackageJsonBrowser !== 'off' && pkg.browser) {\n const msg =\n 'package.json: the `browser` field is no longer needed. Use the `browser` condition in `exports` instead for better support across modern bundlers.'\n if (strictOptions.noPackageJsonBrowser === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n }\n\n if (strictOptions.noPackageJsonTypesVersions !== 'off' && pkg.typesVersions) {\n const msg =\n 'package.json: the `typesVersions` field is no longer needed. TypeScript has long supported conditional exports and the `types` condition. Remove the `typesVersions` field and use the `types` condition in `exports` instead.'\n if (strictOptions.noPackageJsonTypesVersions === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n }\n\n // Check that well-known packages are declared in the correct dependency fields\n if (checkDependencyPlacement({pkg, logger, strictOptions})) {\n shouldError = true\n }\n }\n\n // validate exports\n if (pkg.exports) {\n const _exports = Object.entries(pkg.exports)\n\n for (const [expPath, exp] of _exports) {\n // Skip plain string exports, svelte exports, and conditional CSS exports (a flat\n // condition -> path map at a `.css` subpath); none of these use standard export conditions.\n if (typeof exp === 'string' || expPath.endsWith('.css') || 'svelte' in exp) {\n continue\n }\n\n const keys = Object.keys(exp)\n\n if (exp.types) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`types\\` condition shouldn't be used as dts files are generated in such a way that both CJS and ESM is supported`,\n )\n }\n\n if (exp.module) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`module\\` condition shouldn't be used as it's not well supported in all bundlers.`,\n )\n }\n\n if (exp.development && exp.source && exp.development !== exp.source) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`development\\` condition must have the same value as \\`source\\` when both are present. Expected \"${exp.source}\" but got \"${exp.development}\"`,\n )\n }\n\n if (exp.monorepo && exp.source && exp.monorepo !== exp.source) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`monorepo\\` condition must have the same value as \\`source\\` when both are present. Expected \"${exp.source}\" but got \"${exp.monorepo}\"`,\n )\n }\n\n if (exp.node) {\n if (exp.import && exp.node.import && !assertOrder('node', 'import', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before the \\`import\\` property`,\n )\n }\n\n if (exp.node.module) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.module\\` condition shouldn't be used as it's not well supported in all bundlers. A better strategy is to refactor the codebase to no longer be vulnerable to the \"dual package hazard\"`,\n )\n }\n\n if (\n !exp.node.source &&\n exp.node.import &&\n (exp.node.require || exp.require) &&\n (exp.node.import.endsWith('.cjs.js') || exp.node.import.endsWith('.cjs.mjs'))\n ) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.import\\` re-export pattern shouldn't be used as it's not well supported in all bundlers. A better strategy is to refactor the codebase to no longer be vulnerable to the \"dual package hazard\"`,\n )\n }\n\n if (exp.require && exp.node.require && exp.require === exp.node.require) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.require\\` property isn't necessary as it's identical to \\`require\\``,\n )\n } else if (exp.require && exp.node.require && !assertOrder('node', 'require', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before the \\`require\\` property`,\n )\n }\n } else {\n if (!assertOrder('import', 'require', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`import\\` property should come before the \\`require\\` property`,\n )\n }\n }\n\n if (!assertLast('default', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`default\\` property should be the last property`,\n )\n }\n }\n }\n\n // validate publishConfig.exports\n if (strict && pkg.exports && Object.keys(pkg.exports).length > 0) {\n // Check if exports contains source, development, or monorepo conditions\n const hasSourceOrDevelopment = Object.entries(pkg.exports).some(([, exp]) => {\n if (typeof exp === 'string') return false\n if (typeof exp === 'object' && 'svelte' in exp) return false\n return Boolean(exp.source || exp.development || exp.monorepo)\n })\n\n if (hasSourceOrDevelopment) {\n if (!pkg.publishConfig?.exports) {\n const msg =\n 'package.json: `publishConfig.exports` is missing. Adding it helps avoid publishing to npm with the `source`, `development`, or `monorepo` condition that points to code that cannot be used by the resolver. ' +\n 'See https://tsdown.dev/options/package-exports#dev-exports for more information.'\n if (strictOptions.noPublishConfigExports === 'error') {\n shouldError = true\n logger.error(msg)\n } else if (strictOptions.noPublishConfigExports !== 'off') {\n logger.warn(msg)\n }\n } else {\n // Validate publishConfig.exports structure\n const publishExports = pkg.publishConfig.exports\n\n // Check that all keys in exports exist in publishConfig.exports\n for (const exportPath of Object.keys(pkg.exports)) {\n if (!(exportPath in publishExports)) {\n shouldError = true\n logger.error(\n `publishConfig.exports: missing export path \"${exportPath}\" that exists in exports`,\n )\n }\n }\n\n // Check that all keys in publishConfig.exports exist in exports\n for (const exportPath of Object.keys(publishExports)) {\n if (!(exportPath in pkg.exports)) {\n shouldError = true\n logger.error(\n `publishConfig.exports: unexpected export path \"${exportPath}\" that does not exist in exports`,\n )\n }\n }\n\n // Validate each export path\n for (const [exportPath, exp] of Object.entries(pkg.exports)) {\n if (typeof exp === 'string' || 'svelte' in exp) {\n // For string or svelte exports, publishConfig should match\n const publishExp = publishExports[exportPath]\n if (\n typeof publishExp !== 'string' &&\n (typeof publishExp !== 'object' || !('svelte' in publishExp))\n ) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should be a string matching exports[\"${exportPath}\"]`,\n )\n }\n continue\n }\n\n const publishExp = publishExports[exportPath]\n if (!publishExp) {\n continue\n }\n if (typeof publishExp === 'string') {\n // publishConfig has a string, validate it's correct\n // It should be a condensed form when only default remains after removing source/development/monorepo\n const conditions = Object.keys(exp).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n if (conditions.length !== 1 || conditions[0] !== 'default') {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: is a string but exports[\"${exportPath}\"] has multiple conditions besides source/development/monorepo: ${conditions.join(', ')}`,\n )\n } else {\n // Validate that the string value matches the default condition value\n const expectedValue = exp.default\n if (publishExp !== expectedValue) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should be \"${expectedValue}\" but got \"${publishExp}\"`,\n )\n }\n }\n continue\n }\n\n if ('svelte' in publishExp) {\n continue\n }\n\n // Validate conditions\n const exportConditions = Object.keys(exp).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n const publishConditions = Object.keys(publishExp)\n\n // Check for source, development, or monorepo in publishConfig\n if ('source' in publishExp) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should not contain the \\`source\\` condition`,\n )\n }\n\n if ('development' in publishExp) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should not contain the \\`development\\` condition`,\n )\n }\n\n if ('monorepo' in publishExp) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should not contain the \\`monorepo\\` condition`,\n )\n }\n\n // Check that all conditions match (except source/development/monorepo)\n for (const condition of exportConditions) {\n if (!(condition in publishExp)) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: missing \\`${condition}\\` condition that exists in exports[\"${exportPath}\"]`,\n )\n }\n }\n\n for (const condition of publishConditions) {\n if (!exportConditions.includes(condition)) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: unexpected \\`${condition}\\` condition that does not exist in exports[\"${exportPath}\"]`,\n )\n }\n }\n\n // Validate that values match for all conditions\n for (const condition of exportConditions) {\n if (condition in publishExp) {\n const exportValue = (exp as Record<string, unknown>)[condition]\n const publishValue = (publishExp as Record<string, unknown>)[condition]\n\n // Compare values recursively for nested objects\n if (!areExportValuesEqual(exportValue, publishValue)) {\n const exportValueStr =\n typeof exportValue === 'string' ? exportValue : JSON.stringify(exportValue)\n const publishValueStr =\n typeof publishValue === 'string' ? publishValue : JSON.stringify(publishValue)\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"].${condition}: should be ${exportValueStr} but got ${publishValueStr}`,\n )\n }\n }\n }\n }\n }\n }\n }\n\n if (shouldError) {\n process.exit(1)\n }\n\n return pkg\n } catch (err) {\n if (err instanceof ZodError) {\n for (const issue of err.issues) {\n if (issue.code === 'invalid_type') {\n logger.error(\n [\n `\\`${formatPath(issue.path)}\\` `,\n `in \\`./package.json\\` must be of type ${chalk.magenta(issue.expected)} `,\n `(received ${chalk.magenta(issue.received)})`,\n ].join(''),\n )\n continue\n }\n\n logger.error(issue)\n }\n } else {\n logger.error(err)\n }\n\n return process.exit(1)\n }\n}\n\nfunction formatPath(segments: Array<string | number>) {\n return segments\n .map((s, idx) => {\n if (idx === 0) return s\n\n if (typeof s === 'number') {\n return `[${s}]`\n }\n\n if (s.startsWith('.')) {\n return `[\"${s}\"]`\n }\n\n return `.${s}`\n })\n .join('')\n}\n","import browserslist from 'browserslist'\n\n// convert the browserslist field in package.json to\n// esbuild compatible array of browsers\nexport default function browserslistToEsbuild(browserslistConfig, options = {}) {\n if (!browserslistConfig) {\n // the path from where the script is run\n const path = process.cwd()\n\n // read config if none is passed\n browserslistConfig = browserslist.loadConfig({ path, ...options })\n }\n\n const SUPPORTED_ESBUILD_TARGETS = [\n 'es',\n 'chrome',\n 'edge',\n 'firefox',\n 'ios',\n 'node',\n 'safari',\n 'opera',\n 'ie',\n ]\n\n // https://github.com/eBay/browserslist-config/issues/16#issuecomment-863870093\n const UNSUPPORTED = ['android 4']\n\n const replaces = {\n ios_saf: 'ios',\n android: 'chrome',\n }\n\n const separator = ' '\n\n return (\n browserslist(browserslistConfig, options)\n // filter out the unsupported ones\n .filter((b) => !UNSUPPORTED.some((u) => b.startsWith(u)))\n // replaces safari TP with latest safari version\n .map((b) => {\n if (b === 'safari TP') {\n return browserslist('last 1 safari version')[0]\n }\n\n return b\n })\n // transform into ['chrome', '88']\n .map((b) => b.split(separator))\n // replace the similar browser\n .map((b) => {\n if (replaces[b[0]]) {\n b[0] = replaces[b[0]]\n }\n\n return b\n })\n // 11.0-12.0 --> 11.0\n .map((b) => {\n if (b[1].includes('-')) {\n b[1] = b[1].slice(0, b[1].indexOf('-'))\n }\n\n return b\n })\n // 11.0 --> 11\n .map((b) => {\n if (b[1].endsWith('.0')) {\n b[1] = b[1].slice(0, -2)\n }\n\n return b\n })\n // removes invalid versions that will break esbuild\n // https://github.com/evanw/esbuild/blob/35c0d65b9d4f29a26176404d2890d1b499634e9f/compat-table/src/caniuse.ts#L119-L122\n .filter((b) => /^\\d+(\\.\\d+)*$/.test(b[1]))\n // only get the targets supported by esbuild\n .filter((b) => SUPPORTED_ESBUILD_TARGETS.includes(b[0]))\n // only get the oldest version, assuming that the older version\n // is last in the array\n .reduce((acc, b) => {\n const existingIndex = acc.findIndex((br) => br[0] === b[0])\n\n if (existingIndex !== -1) {\n acc[existingIndex][1] = b[1]\n } else {\n acc.push(b)\n }\n return acc\n }, [])\n // remove separator\n .map((b) => b.join(''))\n )\n}\n","import type {PkgConfigProperty, PkgConfigPropertyResolver} from './types.ts'\n\nfunction isPkgConfigPropertyResolver<T>(\n prop: PkgConfigProperty<T>,\n): prop is PkgConfigPropertyResolver<T> {\n return typeof prop === 'function'\n}\n\n/** @internal */\nexport function resolveConfigProperty<T>(\n prop: PkgConfigProperty<T> | undefined,\n initialValue: T,\n): T {\n if (!prop) return initialValue\n\n if (isPkgConfigPropertyResolver(prop)) {\n return prop(initialValue)\n }\n\n return prop\n}\n","import path from 'node:path'\n\nexport function pathContains(containerPath: string, itemPath: string): boolean {\n return !path.relative(containerPath, itemPath).startsWith('..')\n}\n\nexport function findCommonDirPath(filePaths: string[]): string | undefined {\n let ret: string | undefined = undefined\n\n for (const filePath of filePaths) {\n let dirPath = path.dirname(filePath)\n\n if (!ret) {\n ret = dirPath\n continue\n }\n\n while (dirPath !== ret) {\n if (pathContains(dirPath, ret)) {\n ret = dirPath\n break\n }\n\n dirPath = path.dirname(dirPath)\n\n if (dirPath === ret) {\n break\n }\n\n if (dirPath === '.') return undefined\n }\n }\n\n return ret\n}\n","import type {PackageJSON} from '@sanity/parse-package-json'\nimport type {PkgBundle, PkgExport} from '../../core/config/types.ts'\n\n/** @internal */\nexport const fileEnding: RegExp = /\\.[mc]?js$/\n/** @internal */\nconst dtsEnding = '.d.ts'\n/** @internal */\nexport const defaultEnding = '.js'\n/** @internal */\nexport const mjsEnding = '.mjs'\n/** @internal */\nexport const cjsEnding = '.cjs'\nconst mtsEnding = '.d.mts'\nconst ctsEnding = '.d.cts'\n\n/** @internal */\nexport function getTargetPaths(\n _type: PackageJSON['type'],\n expOrBundle: PkgExport | PkgExport['browser'] | PkgExport['node'] | PkgBundle,\n): string[] {\n const type = (_type === 'module' ? 'module' : 'commonjs') satisfies PackageJSON['type']\n\n const set = new Set<string>()\n\n if (expOrBundle?.import) {\n set.add(expOrBundle.import.replace(fileEnding, type === 'module' ? dtsEnding : mtsEnding))\n }\n\n if (expOrBundle?.require) {\n set.add(expOrBundle.require.replace(fileEnding, type === 'commonjs' ? dtsEnding : ctsEnding))\n }\n\n if (isPkgExport(expOrBundle)) {\n if (!expOrBundle.browser?.source) {\n if (expOrBundle.browser?.import) {\n set.add(\n expOrBundle.browser.import.replace(fileEnding, type === 'module' ? dtsEnding : mtsEnding),\n )\n }\n\n if (expOrBundle.browser?.require) {\n set.add(\n expOrBundle.browser.require.replace(\n fileEnding,\n type === 'commonjs' ? dtsEnding : ctsEnding,\n ),\n )\n }\n }\n\n if (!expOrBundle.node?.source) {\n if (expOrBundle.node?.import) {\n set.add(\n expOrBundle.node.import.replace(fileEnding, type === 'module' ? dtsEnding : mtsEnding),\n )\n }\n\n if (expOrBundle.node?.require) {\n set.add(\n expOrBundle.node.require.replace(fileEnding, type === 'commonjs' ? dtsEnding : ctsEnding),\n )\n }\n }\n }\n\n return Array.from(set)\n}\n\nfunction isPkgExport(exp: any): exp is PkgExport {\n return exp?.browser || exp?.node || exp?.default\n}\n","import {cjsEnding, defaultEnding, mjsEnding} from '../../tasks/dts/getTargetPaths.ts'\n\n/** @internal */\nexport interface PkgExtMap {\n commonjs: {commonjs: string; esm: string}\n module: {commonjs: string; esm: string}\n}\n\n/** @internal */\nexport const pkgExtMap: PkgExtMap = {\n // pkg.type: \"commonjs\"\n commonjs: {\n commonjs: defaultEnding,\n esm: mjsEnding,\n },\n\n // pkg.type: \"module\"\n module: {\n commonjs: cjsEnding,\n esm: defaultEnding,\n },\n}\n","import type {PackageJSON} from '@sanity/parse-package-json'\nimport type {PkgExport} from '../config/types.ts'\nimport {pkgExtMap as extMap} from './pkgExt.ts'\n\nexport function validateExports(\n _exports: (PkgExport & {_path: string})[],\n options: {pkg: PackageJSON},\n): string[] {\n const {pkg} = options\n const type = pkg.type || 'commonjs'\n const ext = extMap[type]\n\n const errors: string[] = []\n\n for (const exp of _exports) {\n if (exp._path === '.') {\n if (exp.require && pkg.main && exp.require !== pkg.main) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exp.import && pkg.module && exp.import !== pkg.module) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\". These must be equal.',\n )\n }\n }\n if (exp.require && !exp.require.endsWith(ext.commonjs)) {\n errors.push(\n `package.json with \\`type: \"${type}\"\\` - \\`exports[\"${exp._path}\"].require\\` must end with \"${ext.commonjs}\"`,\n )\n }\n\n if (exp.import && !exp.import.endsWith(ext.esm)) {\n errors.push(\n `package.json with \\`type: \"${type}\"\\` - \\`exports[\"${exp._path}\"].import\\` must end with \"${ext.esm}\"`,\n )\n }\n }\n\n return errors\n}\n","import {existsSync} from 'node:fs'\nimport {resolve as resolvePath} from 'node:path'\nimport {parseExports, type PackageJSON} from '@sanity/parse-package-json'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\nimport {defaultEnding, fileEnding} from '../../tasks/dts/getTargetPaths.ts'\nimport type {PkgExport} from '../config/types.ts'\nimport {isRecord} from '../isRecord.ts'\nimport {pkgExtMap} from './pkgExt.ts'\nimport {validateExports} from './validateExports.ts'\n\n// Type guard to filter out falsy values\nfunction isTruthy<T>(value: T | false | null | undefined | 0 | ''): value is T {\n return Boolean(value)\n}\n\n/** @alpha */\nexport function parseAndValidateExports(options: {\n cwd: string\n pkg: PackageJSON\n strict: boolean\n strictOptions: StrictOptions\n logger: Logger\n}): (PkgExport & {_path: string})[] {\n const {cwd, pkg, strict, strictOptions, logger} = options\n const type = pkg.type || 'commonjs'\n const errors: string[] = []\n\n const report = (kind: 'warn' | 'error', message: string) => {\n if (kind === 'warn') {\n logger.warn(message)\n } else {\n errors.push(message)\n }\n }\n\n if (!Array.isArray(pkg.files) && strict && strictOptions.alwaysPackageJsonFiles !== 'off') {\n report(\n strictOptions.alwaysPackageJsonFiles,\n 'package.json: `files` should be used over `.npmignore`',\n )\n }\n\n if (pkg.source) {\n if (\n strict &&\n pkg.exports?.['.'] &&\n typeof pkg.exports['.'] === 'object' &&\n 'source' in pkg.exports['.'] &&\n pkg.exports['.'].source === pkg.source\n ) {\n errors.push(\n 'package.json: the \"source\" property can be removed, as it is equal to exports[\".\"].source.',\n )\n } else if (!pkg.exports && pkg.main) {\n const extMap = pkgExtMap[type]\n const importExport = pkg.main.replace(fileEnding, extMap.esm)\n const requireExport = pkg.main.replace(fileEnding, extMap.commonjs)\n const defaultExport = pkg.main.replace(fileEnding, defaultEnding)\n\n const maybeBrowserCondition = []\n\n if (pkg.browser) {\n const browserConditions = []\n\n if (pkg.module && pkg.browser?.[pkg.module]) {\n browserConditions.push(\n ` \"import\": ${JSON.stringify(pkg.browser[pkg.module]!.replace(fileEnding, extMap.esm))}`,\n )\n } else if (pkg.browser?.[pkg.main]) {\n browserConditions.push(\n ` \"import\": ${JSON.stringify(pkg.browser[pkg.main]!.replace(fileEnding, extMap.esm))}`,\n )\n }\n\n if (pkg.browser?.[pkg.main]) {\n browserConditions.push(\n ` \"require\": ${JSON.stringify(pkg.browser[pkg.main]!.replace(fileEnding, extMap.commonjs))}`,\n )\n }\n\n if (browserConditions.length) {\n maybeBrowserCondition.push(\n ` \"browser\": {`,\n ` \"source\": ${JSON.stringify(pkg.browser?.[pkg.source] || pkg.source)},`,\n ...browserConditions,\n ` }`,\n )\n }\n }\n\n errors.push(\n ...[\n 'package.json: `exports` are missing, it should be:',\n `\"exports\": {`,\n ` \".\": {`,\n ` \"source\": ${JSON.stringify(pkg.source)},`,\n // If browser conditions are detected then add them to the suggestion\n ...(maybeBrowserCondition.length > 0 ? maybeBrowserCondition : []),\n type === 'commonjs' && ` \"import\": ${JSON.stringify(importExport)},`,\n type === 'module' && ` \"require\": ${JSON.stringify(requireExport)},`,\n ` \"default\": ${JSON.stringify(defaultExport)}`,\n ` },`,\n ` \"./package.json\": \"./package.json\"`,\n `}`,\n ].filter(isTruthy),\n )\n }\n }\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n if (!pkg.exports) {\n throw new Error(\n '\\n- ' +\n [\n 'package.json: `exports` are missing, please set a minimal configuration, for example:',\n `\"exports\": {`,\n ` \".\": {`,\n ` \"source\": \"./src/index.js\",`,\n ` \"default\": \"./dist/index.js\"`,\n ` },`,\n ` \"./package.json\": \"./package.json\"`,\n `}`,\n ].join('\\n- '),\n )\n }\n\n const _exports = parseExports({pkg})\n\n if (strict && strictOptions.noPackageJsonTypings !== 'off' && 'typings' in pkg) {\n report(strictOptions.noPackageJsonTypings, 'package.json: `typings` should be `types`')\n }\n\n if (\n strict &&\n strictOptions.alwaysPackageJsonTypes !== 'off' &&\n !pkg.types &&\n typeof pkg.exports?.['.'] === 'object' &&\n 'source' in pkg.exports['.'] &&\n pkg.exports['.'].source?.endsWith('.ts')\n ) {\n report(\n strictOptions.alwaysPackageJsonTypes,\n 'package.json: `types` must be declared for the npm listing to show as a TypeScript module.',\n )\n }\n\n if (strict && !pkg.exports['./package.json']) {\n errors.push('package.json: `exports[\"./package.json\"] must be declared.')\n }\n\n for (const [exportPath, exportEntry] of Object.entries(pkg.exports)) {\n if (\n exportPath.endsWith('.json') ||\n (typeof exportEntry === 'string' && exportEntry.endsWith('.json'))\n ) {\n if (exportPath === './package.json') {\n if (exportEntry !== './package.json') {\n errors.push('package.json: `exports[\"./package.json\"]` must be \"./package.json\".')\n }\n }\n } else if (exportPath.endsWith('.css')) {\n if (typeof exportEntry === 'string') {\n if (!existsSync(resolvePath(cwd, exportEntry))) {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}]\\`: file does not exist.`,\n )\n }\n } else if (isRecord(exportEntry)) {\n // Conditional CSS export, e.g.\n // \"./bundle.css\": { \"browser\": \"./dist/bundle.css\", \"node\": \"./dist/bundle.css.js\", \"default\": \"./dist/bundle.css.js\" }\n // This lets a package re-add a `import \"<pkg>/bundle.css\"` that resolves to the real CSS in\n // bundler/browser environments and to a no-op JS shim in CSS-unaware runtimes (e.g. Node).\n // Only the shape is validated here: the targets usually point at generated `dist` files that\n // do not exist yet at validation time, so file existence is intentionally not checked.\n for (const [condition, target] of Object.entries(exportEntry)) {\n if (typeof target !== 'string') {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}][${JSON.stringify(condition)}]\\`: must be a string path.`,\n )\n }\n }\n } else {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}]\\`: must be a string path or an object of export conditions.`,\n )\n }\n } else if (isRecord(exportEntry) && 'svelte' in exportEntry) {\n // @TODO should we report a warning or a debug message here about a detected svelte export that is ignored?\n } else if (isPkgExport(exportEntry)) {\n const exp = {\n _exported: true,\n _path: exportPath,\n ...exportEntry,\n } satisfies PkgExport & {_path: string}\n\n // Infer the `default` condition based on the `type` and other conditions\n if (!exp.default) {\n const fallback = type === 'module' ? exp.import : exp.require\n\n if (fallback) {\n exp.default = fallback\n }\n }\n\n // Infer the `require` condition based on the `type` and other conditions\n if (!exp.require && type === 'commonjs' && exp.default) {\n exp.require = exp.default\n }\n\n // Infer the `import` condition based on the `type` and other conditions\n if (!exp.import && type === 'module' && exp.default) {\n exp.import = exp.default\n }\n\n if (exportPath === '.') {\n if (exportEntry.require && pkg.main && exportEntry.require !== pkg.main) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exportEntry.import && pkg.module && exportEntry.import !== pkg.module) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\" These must be equal.',\n )\n }\n }\n } else if (!isRecord(exportEntry)) {\n errors.push('package.json: exports must be an object')\n }\n }\n\n errors.push(...validateExports(_exports, {pkg}))\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n return _exports\n}\n\nfunction isPkgExport(value: unknown): value is PkgExport {\n return isRecord(value) && 'source' in value && typeof value['source'] === 'string'\n}\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/** @internal */\nexport async function loadTSConfig(options: {\n cwd: string\n tsconfigPath: string\n}): Promise<ReturnType<typeof ts.parseJsonConfigFileContent> | undefined> {\n const {cwd, tsconfigPath} = options\n\n // oxlint-disable-next-line unbound-method\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n\n if (!configPath) {\n return undefined\n }\n\n // oxlint-disable-next-line unbound-method\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd)\n}\n","export function resolveBrowserTarget(versions: string[]): string[] | undefined {\n const target: string[] = versions.filter(\n (version) =>\n version.startsWith('chrome') ||\n version.startsWith('edge') ||\n version.startsWith('firefox') ||\n version.startsWith('ios') ||\n version.startsWith('safari') ||\n version.startsWith('opera'),\n )\n\n if (target.length === 0) {\n return undefined\n }\n\n return target\n}\n","export function resolveNodeTarget(versions: string[]): string[] | undefined {\n const target: string[] = versions.filter((version) => version.startsWith('node'))\n\n if (target.length === 0) {\n return undefined\n }\n\n return target\n}\n","import {errorMap} from 'zod-validation-error/v3'\nimport {z} from 'zod/v3'\n\nconst toggle = z.union([z.literal('error'), z.literal('warn'), z.literal('off')])\n\ntype ToggleType = 'error' | 'warn' | 'off'\n\nconst strictOptions = z\n .object({\n noPackageJsonTypings: toggle.default('error'),\n noImplicitSideEffects: toggle.default('warn'),\n noImplicitBrowsersList: toggle.default('warn'),\n alwaysPackageJsonTypes: toggle.default('error'),\n alwaysPackageJsonFiles: toggle.default('error'),\n noCheckTypes: toggle.default('warn'),\n noPackageJsonBrowser: toggle.default('warn'),\n noPackageJsonTypesVersions: toggle.default('warn'),\n preferModuleType: toggle.default('warn'),\n noPublishConfigExports: toggle.default('warn'),\n noReactIsPeerDependency: toggle.default('error'),\n noSanityUiPeerDependency: toggle.default('error'),\n noSanityIconsPeerDependency: toggle.default('error'),\n noSanityDependency: toggle.default('error'),\n noStyledComponentsDependency: toggle.default('error'),\n noReactDependency: toggle.default('error'),\n noReactDomDependency: toggle.default('error'),\n noReactTypesDependency: toggle.default('error'),\n noReactDomTypesDependency: toggle.default('error'),\n noNodeTypesDependency: toggle.default('error'),\n noRxjsPeerDependency: toggle.default('error'),\n noSanityClientPeerDependency: toggle.default('error'),\n })\n .strict()\n\n/**\n * To make error message paths line up with the paths in package.config.ts the schema is hoisted into a root schema\n * This way errors will say `Expected boolean, received string at \"strict.noPackageJsonTypings\"` instead of `Expected boolean, received string at \"noPackageJsonTypings\"`.\n */\nconst validationSchema = z.object({\n strictOptions: strictOptions.default({}),\n})\n\n/**\n * @public\n */\nexport interface StrictOptions {\n /**\n * Disallows a top level `typings` field in `package.json` if it is equal to `exports['.'].source`.\n * @defaultValue 'error'\n */\n noPackageJsonTypings: ToggleType\n /**\n * Requires specifying `sideEffects` in `package.json`.\n * @defaultValue 'warn'\n */\n noImplicitSideEffects: ToggleType\n /**\n * Requires specifying `browserslist` in `package.json`, instead of relying on it implicitly being:\n * @example\n * ```\n * \"browserslist\": \"extends @sanity/browserslist-config\"\n * ```\n * @defaultValue 'warn'\n */\n noImplicitBrowsersList: ToggleType\n /**\n * If typescript is used then `types` in `package.json` should be specified for npm listings to show the TS icon.\n * @defaultValue 'error'\n */\n alwaysPackageJsonTypes: ToggleType\n /**\n * Using `.npmignore` is error prone, it's best practice to always declare `files` instead\n * @defaultValue 'error'\n */\n alwaysPackageJsonFiles: ToggleType\n /**\n * 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`\n * @defaultValue 'warn'\n */\n noCheckTypes: ToggleType\n /**\n * Disallows the `browser` field in `package.json` as the `browser` condition in `exports` is better supported.\n * @defaultValue 'warn'\n */\n noPackageJsonBrowser: ToggleType\n /**\n * Disallows the `typesVersions` field in `package.json` as TypeScript has long supported conditional exports and the `types` condition.\n * @defaultValue 'warn'\n */\n noPackageJsonTypesVersions: ToggleType\n /**\n * Warns if `type` field is missing or set to `commonjs`. Future versions will require `\"type\": \"module\"`.\n * @defaultValue 'warn'\n */\n preferModuleType: ToggleType\n /**\n * Warns if `publishConfig.exports` is missing when `source`, `development`, or `monorepo` conditions are used in exports.\n * @defaultValue 'warn'\n */\n noPublishConfigExports: ToggleType\n /**\n * Disallows `react-is` in `peerDependencies`. It should be in `dependencies` (or `devDependencies`) instead.\n * @defaultValue 'error'\n */\n noReactIsPeerDependency: ToggleType\n /**\n * Disallows `@sanity/ui` in `peerDependencies`. It should be in `dependencies` (or `devDependencies`) instead.\n * @defaultValue 'error'\n */\n noSanityUiPeerDependency: ToggleType\n /**\n * Disallows `@sanity/icons` in `peerDependencies`. It should be in `dependencies` (or `devDependencies`) instead.\n * @defaultValue 'error'\n */\n noSanityIconsPeerDependency: ToggleType\n /**\n * Disallows `sanity` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noSanityDependency: ToggleType\n /**\n * Disallows `styled-components` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noStyledComponentsDependency: ToggleType\n /**\n * Disallows `react` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noReactDependency: ToggleType\n /**\n * Disallows `react-dom` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noReactDomDependency: ToggleType\n /**\n * Disallows `@types/react` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`, and when declared as a peer dependency the version range should be `*`.\n * @defaultValue 'error'\n */\n noReactTypesDependency: ToggleType\n /**\n * Disallows `@types/react-dom` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`, and when declared as a peer dependency the version range should be `*`.\n * @defaultValue 'error'\n */\n noReactDomTypesDependency: ToggleType\n /**\n * Disallows `@types/node` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`, and when declared as a peer dependency the version range should be `*`.\n * @defaultValue 'error'\n */\n noNodeTypesDependency: ToggleType\n /**\n * Disallows `rxjs` in `peerDependencies`. It should only be in `dependencies` and/or `devDependencies`.\n * @defaultValue 'error'\n */\n noRxjsPeerDependency: ToggleType\n /**\n * Disallows `@sanity/client` in `peerDependencies`. It should only be in `dependencies` and/or `devDependencies`.\n * @defaultValue 'error'\n */\n noSanityClientPeerDependency: ToggleType\n}\n\n/** @alpha */\nexport function parseStrictOptions(input: unknown): StrictOptions {\n return validationSchema.parse({strictOptions: input}, {errorMap}).strictOptions\n}\n","import path from 'node:path'\nimport type {PackageJSON} from '@sanity/parse-package-json'\nimport browserslistToEsbuild from 'browserslist-to-esbuild'\nimport {resolveConfigProperty} from './core/config/resolveConfigProperty.ts'\nimport {type PkgConfigOptions, type PkgExports, type PkgRuntime} from './core/config/types.ts'\nimport type {BuildContext} from './core/contexts/buildContext.ts'\nimport {DEFAULT_BROWSERSLIST_QUERY} from './core/defaults.ts'\nimport {findCommonDirPath, pathContains} from './core/findCommonPath.ts'\nimport {parseAndValidateExports} from './core/pkg/parseAndValidateExports.ts'\nimport {loadTSConfig} from './core/ts/loadTSConfig.ts'\nimport type {Logger} from './logger.ts'\nimport {resolveBrowserTarget} from './resolveBrowserTarget.ts'\nimport {resolveNodeTarget} from './resolveNodeTarget.ts'\nimport {parseStrictOptions} from './strict.ts'\n\n// Type guard to filter out falsy values\nfunction isTruthy<T>(value: T | false | null | undefined | 0 | ''): value is T {\n return Boolean(value)\n}\n\nexport async function resolveBuildContext(options: {\n config?: PkgConfigOptions | undefined\n cwd: string\n emitDeclarationOnly?: boolean\n logger: Logger\n pkg: PackageJSON\n strict: boolean\n tsconfig: string\n}): Promise<BuildContext> {\n const {\n config,\n cwd,\n emitDeclarationOnly = false,\n logger,\n pkg,\n strict,\n tsconfig: tsconfigPath,\n } = options\n const tsconfig = await loadTSConfig({cwd, tsconfigPath})\n const strictOptions = parseStrictOptions(config?.strictOptions ?? {})\n\n if (strictOptions.noCheckTypes !== 'off' && tsconfig?.options && config?.dts !== 'rolldown') {\n if (\n tsconfig.options.noCheck !== false &&\n !tsconfig.options.noCheck &&\n config?.extract?.checkTypes !== false\n ) {\n if (strictOptions.noCheckTypes === 'error') {\n throw new Error(\n '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it. You can set `noCheck: true` in tsconfig.json or set `extract: { checkTypes: false }` in package.config.ts to disable type checking.',\n )\n } else {\n logger.warn(\n '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it. You can set `noCheck: true` in tsconfig.json or set `extract: { checkTypes: false }` in package.config.ts to disable type checking.',\n )\n }\n }\n }\n\n let browserslist = pkg.browserslist\n if (!browserslist) {\n if (strict && strictOptions.noImplicitBrowsersList !== 'off') {\n if (strictOptions.noImplicitBrowsersList === 'error') {\n throw new Error(\n '\\n- ' +\n `package.json: \"browserslist\" is missing, set it to \\`\"browserslist\": \"extends @sanity/browserslist-config\"\\``,\n )\n } else {\n logger.warn(\n 'Could not detect a `browserslist` property in `package.json`, using default configuration. Add `\"browserslist\": \"extends @sanity/browserslist-config\"` to silence this warning.',\n )\n }\n }\n browserslist = DEFAULT_BROWSERSLIST_QUERY\n }\n const targetVersions = browserslistToEsbuild(browserslist)\n\n if (\n strict &&\n strictOptions.noImplicitSideEffects !== 'off' &&\n typeof pkg.sideEffects === 'undefined'\n ) {\n const msg =\n 'package.json: `sideEffects` is missing, see https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects for how to define `sideEffects`'\n\n if (strictOptions.noImplicitSideEffects === 'error') {\n throw new Error(msg)\n } else {\n logger.warn(msg)\n }\n }\n\n const nodeTarget = resolveNodeTarget(targetVersions)\n const webTarget = resolveBrowserTarget(targetVersions)\n\n if (!nodeTarget) {\n throw new Error('no matching `node` target')\n }\n\n if (!webTarget) {\n throw new Error('no matching `web` target')\n }\n\n const target: Record<PkgRuntime, string[]> = {\n '*': webTarget.concat(nodeTarget),\n 'browser': webTarget,\n 'node': nodeTarget,\n }\n\n const parsedExports = parseAndValidateExports({\n cwd,\n pkg,\n strict,\n strictOptions,\n logger,\n }).reduce<PkgExports>(\n (acc, {_path: exportPath, ...exportEntry}) => Object.assign(acc, {[exportPath]: exportEntry}),\n {},\n )\n\n const exports = resolveConfigProperty(config?.exports, parsedExports)\n\n const parsedExternal = [\n ...(pkg.dependencies ? Object.keys(pkg.dependencies) : []),\n ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []),\n ]\n\n // Merge externals if an array is provided, replace if it's a function\n const external =\n config && Array.isArray(config.external)\n ? [...parsedExternal, ...config.external]\n : resolveConfigProperty(config?.external, parsedExternal)\n // Merge bundledPackages with dev deps, replace if it's a function\n const externalWithTypes = new Set([pkg.name, ...external, ...external.map(transformPackageName)])\n const bundledDependencies = (pkg.devDependencies ? Object.keys(pkg.devDependencies) : []).filter(\n // Do not bundle anything that is marked as external\n (_) => !externalWithTypes.has(_),\n )\n const bundledPackages =\n config && Array.isArray(config.extract?.bundledPackages)\n ? [...bundledDependencies, ...config.extract.bundledPackages]\n : resolveConfigProperty(config?.extract?.bundledPackages, bundledDependencies)\n\n const outputPaths = Object.values(exports)\n .flatMap((exportEntry) => {\n return [\n exportEntry.import,\n exportEntry.require,\n exportEntry.browser?.import,\n exportEntry.browser?.require,\n exportEntry.node?.source && exportEntry.node.import,\n exportEntry.node?.source && exportEntry.node.require,\n ].filter(isTruthy)\n })\n .map((p) => path.resolve(cwd, p))\n\n const commonDistPath = findCommonDirPath(outputPaths)\n\n if (commonDistPath === cwd) {\n throw new Error(\n 'all output files must share a common parent directory which is not the root package directory',\n )\n }\n\n if (commonDistPath && !pathContains(cwd, commonDistPath)) {\n throw new Error('all output files must be located within the package')\n }\n\n const configDistPath = config?.dist ? path.resolve(cwd, config.dist) : undefined\n\n if (\n configDistPath &&\n commonDistPath &&\n configDistPath !== commonDistPath &&\n !pathContains(configDistPath, commonDistPath)\n ) {\n logger.log(`did you mean to configure \\`dist: './${path.relative(cwd, commonDistPath)}'\\`?`)\n\n throw new Error('all output files must be located with the configured `dist` path')\n }\n\n const distPath = configDistPath || commonDistPath\n\n if (!distPath) {\n throw new Error('could not detect `dist` path')\n }\n\n const ctx: BuildContext = {\n config,\n cwd,\n distPath,\n emitDeclarationOnly,\n exports,\n external,\n bundledPackages,\n files: [],\n logger,\n pkg,\n runtime: config?.runtime ?? '*',\n strict,\n target,\n ts: {\n config: tsconfig,\n configPath: tsconfigPath,\n },\n dts: config?.dts === 'rolldown' ? 'rolldown' : 'api-extractor',\n }\n\n return ctx\n}\n\nfunction transformPackageName(packageName: string): string {\n if (packageName.startsWith('@types/')) {\n // If it already starts with @types, return it as is\n return packageName\n } else if (packageName.startsWith('@')) {\n // Handle scoped packages\n const [scope, name] = packageName.split('/')\n\n return `@types/${scope?.slice(1)}__${name}`\n } else {\n // Handle regular packages\n return `@types/${packageName}`\n }\n}\n"],"names":["strictOptions","typoMap","strict","publishExp","path","isPkgExport","extMap","isTruthy","resolvePath","browserslist"],"mappings":";;;;;;;;;;;AAYO,SAAS,iBAAiB,SAElB;AACb,QAAM,EAAC,WAAA,IAAc,WAAW,CAAA,GAE1B,WAAW;AAAA,IACf,KAAK,QAAQ;AAAA,IACb,MAAM,QAAQ;AAAA,IACd,OAAO,QAAQ;AAAA,EAAA,GAGX,WAA4B,CAAA;AAElC,SAAA,QAAQ,MAAM,IAAI,SAAoB,SAAS,KAAK,EAAC,MAAM,OAAO,KAAA,CAAK,GACvE,QAAQ,OAAO,IAAI,SAAoB,SAAS,KAAK,EAAC,MAAM,QAAQ,KAAA,CAAK,GACzE,QAAQ,QAAQ,IAAI,SAAoB,SAAS,KAAK,EAAC,MAAM,SAAS,KAAA,CAAK,GAEpE;AAAA,IACL;AAAA,IACA,SAAS,MAAM;AACb,cAAQ,MAAM,SAAS,KACvB,QAAQ,OAAO,SAAS,MACxB,QAAQ,QAAQ,SAAS,OAEzB,aAAa,QAAQ;AAAA,IACvB;AAAA,EAAA;AAEJ;ACRA,MAAM,2BAAsD;AAAA,EAC1D;AAAA,IACE,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,cAAc,CAAC,kBAAkB;AAAA,IACjC,WAAW,CAAC,gBAAgB,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,IAAI,CAAC,MAAM,KAAK,QAAQ,KAAK,CAAC,CAAC,GAE5B,iBAAiB,kBAAkB,WAAW;AAEpD,MAAI,mBAAmB;AACrB,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAIJ,MAAI,kBAAkB,CAAC,aAAa,KAAK,cAAc;AACrD,UAAM,IAAI,MAAM,qDAAqD;AAGvE,QAAM,iBAAiB,QAAQ,OAAO,KAAK,QAAQ,KAAK,OAAO,IAAI,IAAI;AAEvE,MACE,kBACA,kBACA,mBAAmB,kBACnB,CAAC,aAAa,gBAAgB,cAAc;AAE5C,UAAA,OAAO,IAAI,wCAAwC,KAAK,SAAS,KAAK,cAAc,CAAC,MAAM,GAErF,IAAI,MAAM,kEAAkE;AAGpF,QAAM,WAAW,kBAAkB;AAEnC,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,8BAA8B;AAwBhD,SArB0B;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,CAAA;AAAA,IACP;AAAA,IACA;AAAA,IACA,SAAS,QAAQ,WAAW;AAAA,IAC5B,QAAAE;AAAA,IACA;AAAA,IACA,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,YAAY;AAAA,IAAA;AAAA,IAEd,KAAK,QAAQ,QAAQ,aAAa,aAAa;AAAA,EAAA;AAInD;AAEA,SAAS,qBAAqB,aAA6B;AACzD,MAAI,YAAY,WAAW,SAAS;AAElC,WAAO;AACF,MAAI,YAAY,WAAW,GAAG,GAAG;AAEtC,UAAM,CAAC,OAAO,IAAI,IAAI,YAAY,MAAM,GAAG;AAE3C,WAAO,UAAU,OAAO,MAAM,CAAC,CAAC,KAAK,IAAI;AAAA,EAC3C;AAEE,WAAO,UAAU,WAAW;AAEhC;","x_google_ignoreList":[6]}
1
+ {"version":3,"file":"resolveBuildContext.js","sources":["../../src/node/consoleSpy.ts","../../src/node/core/pkg/dependencyPlacement.ts","../../src/node/core/pkg/helpers.ts","../../src/node/core/pkg/validatePkg.ts","../../src/node/core/pkg/loadPkg.ts","../../src/node/core/pkg/loadPkgWithReporting.ts","../../../../../node_modules/.pnpm/browserslist-to-esbuild@2.1.1_browserslist@4.28.6/node_modules/browserslist-to-esbuild/src/index.js","../../src/node/core/config/resolveConfigProperty.ts","../../src/node/core/findCommonPath.ts","../../src/node/tasks/dts/getTargetPaths.ts","../../src/node/core/pkg/pkgExt.ts","../../src/node/core/pkg/validateExports.ts","../../src/node/core/pkg/parseAndValidateExports.ts","../../src/node/core/ts/loadTSConfig.ts","../../src/node/resolveBrowserTarget.ts","../../src/node/resolveNodeTarget.ts","../../src/node/strict.ts","../../src/node/resolveBuildContext.ts"],"sourcesContent":["// oxlint-disable no-console\nexport interface ConsoleSpyMsg {\n type: 'log' | 'warn' | 'error'\n code?: string\n args: unknown[]\n}\n\nexport interface ConsoleSpy {\n messages: ConsoleSpyMsg[]\n restore: () => void\n}\n\nexport function createConsoleSpy(options?: {\n onRestored?: (messages: ConsoleSpyMsg[]) => void\n}): ConsoleSpy {\n const {onRestored} = options || {}\n\n const original = {\n log: console.log,\n warn: console.warn,\n error: console.error,\n }\n\n const messages: ConsoleSpyMsg[] = []\n\n console.log = (...args: unknown[]) => messages.push({type: 'log', args})\n console.warn = (...args: unknown[]) => messages.push({type: 'warn', args})\n console.error = (...args: unknown[]) => messages.push({type: 'error', args})\n\n return {\n messages,\n restore: () => {\n console.log = original.log\n console.warn = original.warn\n console.error = original.error\n\n onRestored?.(messages)\n },\n }\n}\n","import type {PackageJSON} from '@sanity/parse-package-json'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\n\n/**\n * The `package.json` fields a dependency placement rule can reference.\n */\ntype DependencyField = 'dependencies' | 'devDependencies' | 'peerDependencies'\n\n/**\n * Describes where a given package may, and may not, be declared in `package.json`.\n */\ninterface DependencyPlacementRule {\n /** The name of the package this rule applies to. */\n name: string\n /** The `strictOptions` toggle that controls whether this rule runs. */\n option: keyof StrictOptions\n /** Fields the package must _not_ be declared in. */\n disallowedIn: DependencyField[]\n /** Fields the package is allowed to be declared in (used for messaging). */\n allowedIn: DependencyField[]\n /**\n * When set and the package is declared in `peerDependencies`, the version range must be\n * exactly this value (e.g. `*` for `@types/*` packages).\n */\n requiredPeerVersion?: string\n}\n\n/**\n * The set of dependency placement rules enforced in `--strict` mode.\n */\nconst dependencyPlacementRules: DependencyPlacementRule[] = [\n {\n name: 'react-is',\n option: 'noReactIsPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: '@sanity/ui',\n option: 'noSanityUiPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: '@sanity/icons',\n option: 'noSanityIconsPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: 'sanity',\n option: 'noSanityDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: 'styled-components',\n option: 'noStyledComponentsDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: 'react',\n option: 'noReactDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: 'react-dom',\n option: 'noReactDomDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n },\n {\n name: '@types/react',\n option: 'noReactTypesDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n requiredPeerVersion: '*',\n },\n {\n name: '@types/react-dom',\n option: 'noReactDomTypesDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n requiredPeerVersion: '*',\n },\n {\n name: '@types/node',\n option: 'noNodeTypesDependency',\n disallowedIn: ['dependencies'],\n allowedIn: ['devDependencies', 'peerDependencies'],\n requiredPeerVersion: '*',\n },\n {\n name: 'rxjs',\n option: 'noRxjsPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n {\n name: '@sanity/client',\n option: 'noSanityClientPeerDependency',\n disallowedIn: ['peerDependencies'],\n allowedIn: ['dependencies', 'devDependencies'],\n },\n]\n\nfunction formatFields(fields: DependencyField[]): string {\n const labels = fields.map((field) => `\\`${field}\\``)\n\n if (labels.length <= 1) {\n return labels.join('')\n }\n\n return `${labels.slice(0, -1).join(', ')} or ${labels[labels.length - 1]}`\n}\n\n/**\n * Validates that well-known packages are declared in the correct `package.json` dependency\n * fields. Returns `true` if any rule with severity `error` was violated.\n * @internal\n */\nexport function checkDependencyPlacement(options: {\n pkg: PackageJSON\n logger: Logger\n strictOptions: StrictOptions\n}): boolean {\n const {pkg, logger, strictOptions} = options\n let shouldError = false\n\n const report = (level: 'error' | 'warn', message: string) => {\n if (level === 'error') {\n shouldError = true\n logger.error(message)\n } else {\n logger.warn(message)\n }\n }\n\n for (const rule of dependencyPlacementRules) {\n const level = strictOptions[rule.option]\n\n if (level === 'off') {\n continue\n }\n\n for (const field of rule.disallowedIn) {\n if (Object.hasOwn(pkg[field] ?? {}, rule.name)) {\n report(\n level,\n `package.json: \\`${rule.name}\\` should not be in \\`${field}\\`. It should be in ${formatFields(\n rule.allowedIn,\n )} instead.`,\n )\n }\n }\n\n if (rule.requiredPeerVersion !== undefined) {\n const peerDependencies = pkg.peerDependencies ?? {}\n\n if (\n Object.hasOwn(peerDependencies, rule.name) &&\n peerDependencies[rule.name] !== rule.requiredPeerVersion\n ) {\n report(\n level,\n `package.json: \\`${rule.name}\\` in \\`peerDependencies\\` should be set to \"${rule.requiredPeerVersion}\" (got \"${peerDependencies[rule.name]}\").`,\n )\n }\n }\n }\n\n return shouldError\n}\n","/** @internal */\nexport function assertLast<T>(a: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n\n // if not found, then we don't care\n if (aIdx === -1) {\n return true\n }\n\n return aIdx === arr.length - 1\n}\n\n/** @internal */\nexport function assertOrder<T>(a: T, b: T, arr: T[]): boolean {\n const aIdx = arr.indexOf(a)\n const bIdx = arr.indexOf(b)\n\n // if either is not found, then we don't care\n if (aIdx === -1 || bIdx === -1) {\n return true\n }\n\n return aIdx < bIdx\n}\n","import {parsePackage, _typoMap as typoMap, type PackageJSON} from '@sanity/parse-package-json'\n\nexport function validatePkg(input: unknown): PackageJSON {\n const pkg = parsePackage(input)\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Need to check raw input for typos\n const invalidKey = Object.keys(input as PackageJSON).find((key) => {\n const needle = key.toUpperCase()\n\n return typoMap.has(needle) ? typoMap.get(needle) !== key : false\n })\n\n if (invalidKey) {\n throw new TypeError(\n `\n- package.json: \"${invalidKey}\" is not a valid key. Did you mean \"${typoMap.get(invalidKey.toUpperCase())}\"?`,\n )\n }\n\n return pkg\n}\n","import fs from 'node:fs/promises'\nimport type {PackageJSON} from '@sanity/parse-package-json'\nimport {validatePkg} from './validatePkg.ts'\n\n/** @internal */\nexport async function loadPkg(options: {pkgPath: string}): Promise<PackageJSON> {\n const {pkgPath} = options\n\n const raw = JSON.parse(await fs.readFile(pkgPath, 'utf-8'))\n\n validatePkg(raw)\n\n return raw\n}\n","import {ZodError, type PackageJSON} from '@sanity/parse-package-json'\nimport chalk from 'chalk'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\nimport {checkDependencyPlacement} from './dependencyPlacement.ts'\nimport {assertLast, assertOrder} from './helpers.ts'\nimport {loadPkg} from './loadPkg.ts'\n\n/**\n * Helper function to recursively compare export values, excluding source, development, and monorepo conditions\n */\nfunction areExportValuesEqual(value1: unknown, value2: unknown): boolean {\n // If both are strings, simple comparison\n if (typeof value1 === 'string' && typeof value2 === 'string') {\n return value1 === value2\n }\n\n // If types don't match, they're not equal\n if (typeof value1 !== typeof value2) {\n return false\n }\n\n // Both are objects, compare recursively\n if (\n typeof value1 === 'object' &&\n value1 !== null &&\n typeof value2 === 'object' &&\n value2 !== null &&\n !Array.isArray(value1) &&\n !Array.isArray(value2)\n ) {\n const obj1 = value1 as Record<string, any>\n const obj2 = value2 as Record<string, any>\n\n const keys1 = Object.keys(obj1).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n const keys2 = Object.keys(obj2).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n\n // Check if they have the same keys\n if (keys1.length !== keys2.length) {\n return false\n }\n\n for (const key of keys1) {\n if (!keys2.includes(key)) {\n return false\n }\n\n const val1 = obj1[key]\n const val2 = obj2[key]\n\n // Skip if either value is undefined\n if (val1 === undefined || val2 === undefined) {\n return false\n }\n\n // Recursively compare nested values\n if (!areExportValuesEqual(val1, val2)) {\n return false\n }\n }\n\n return true\n }\n\n return false\n}\n\n/** @alpha */\nexport async function loadPkgWithReporting(options: {\n pkgPath: string\n logger: Logger\n strict: boolean\n strictOptions: StrictOptions\n}): Promise<PackageJSON> {\n const {pkgPath, logger, strict, strictOptions} = options\n\n try {\n const pkg = await loadPkg({pkgPath})\n let shouldError = false\n\n if (strict) {\n // Check for missing or commonjs type field\n if (strictOptions.preferModuleType !== 'off') {\n if (!pkg.type) {\n const msg =\n 'package.json: `type` field is missing. Future versions of pkg-utils will require `\"type\": \"module\"`. Consider adding `\"type\": \"module\"` to prepare for this change.'\n if (strictOptions.preferModuleType === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n } else if (pkg.type === 'commonjs') {\n const msg =\n 'package.json: `type` is set to \"commonjs\". Future versions of pkg-utils will require `\"type\": \"module\"`. Consider migrating to ES modules to prepare for this change.'\n if (strictOptions.preferModuleType === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n }\n }\n\n // Check for banned root-level fields\n if (strictOptions.noPackageJsonBrowser !== 'off' && pkg.browser) {\n const msg =\n 'package.json: the `browser` field is no longer needed. Use the `browser` condition in `exports` instead for better support across modern bundlers.'\n if (strictOptions.noPackageJsonBrowser === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n }\n\n if (strictOptions.noPackageJsonTypesVersions !== 'off' && pkg.typesVersions) {\n const msg =\n 'package.json: the `typesVersions` field is no longer needed. TypeScript has long supported conditional exports and the `types` condition. Remove the `typesVersions` field and use the `types` condition in `exports` instead.'\n if (strictOptions.noPackageJsonTypesVersions === 'error') {\n shouldError = true\n logger.error(msg)\n } else {\n logger.warn(msg)\n }\n }\n\n // Check that well-known packages are declared in the correct dependency fields\n if (checkDependencyPlacement({pkg, logger, strictOptions})) {\n shouldError = true\n }\n }\n\n // validate exports\n if (pkg.exports) {\n const _exports = Object.entries(pkg.exports)\n\n for (const [expPath, exp] of _exports) {\n // Skip plain string exports, svelte exports, and conditional CSS exports (a flat\n // condition -> path map at a `.css` subpath); none of these use standard export conditions.\n if (typeof exp === 'string' || expPath.endsWith('.css') || 'svelte' in exp) {\n continue\n }\n\n const keys = Object.keys(exp)\n\n if (exp.types) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`types\\` condition shouldn't be used as dts files are generated in such a way that both CJS and ESM is supported`,\n )\n }\n\n if (exp.module) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`module\\` condition shouldn't be used as it's not well supported in all bundlers.`,\n )\n }\n\n if (exp.development && exp.source && exp.development !== exp.source) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`development\\` condition must have the same value as \\`source\\` when both are present. Expected \"${exp.source}\" but got \"${exp.development}\"`,\n )\n }\n\n if (exp.monorepo && exp.source && exp.monorepo !== exp.source) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`monorepo\\` condition must have the same value as \\`source\\` when both are present. Expected \"${exp.source}\" but got \"${exp.monorepo}\"`,\n )\n }\n\n if (exp.node) {\n if (exp.import && exp.node.import && !assertOrder('node', 'import', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before the \\`import\\` property`,\n )\n }\n\n if (exp.node.module) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.module\\` condition shouldn't be used as it's not well supported in all bundlers. A better strategy is to refactor the codebase to no longer be vulnerable to the \"dual package hazard\"`,\n )\n }\n\n if (\n !exp.node.source &&\n exp.node.import &&\n (exp.node.require || exp.require) &&\n (exp.node.import.endsWith('.cjs.js') || exp.node.import.endsWith('.cjs.mjs'))\n ) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.import\\` re-export pattern shouldn't be used as it's not well supported in all bundlers. A better strategy is to refactor the codebase to no longer be vulnerable to the \"dual package hazard\"`,\n )\n }\n\n if (exp.require && exp.node.require && exp.require === exp.node.require) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.require\\` property isn't necessary as it's identical to \\`require\\``,\n )\n } else if (exp.require && exp.node.require && !assertOrder('node', 'require', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before the \\`require\\` property`,\n )\n }\n } else {\n if (!assertOrder('import', 'require', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`import\\` property should come before the \\`require\\` property`,\n )\n }\n }\n\n if (!assertLast('default', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`default\\` property should be the last property`,\n )\n }\n }\n }\n\n // validate publishConfig.exports\n if (strict && pkg.exports && Object.keys(pkg.exports).length > 0) {\n // Check if exports contains source, development, or monorepo conditions\n const hasSourceOrDevelopment = Object.entries(pkg.exports).some(([, exp]) => {\n if (typeof exp === 'string') return false\n if (typeof exp === 'object' && 'svelte' in exp) return false\n return Boolean(exp.source || exp.development || exp.monorepo)\n })\n\n if (hasSourceOrDevelopment) {\n if (!pkg.publishConfig?.exports) {\n const msg =\n 'package.json: `publishConfig.exports` is missing. Adding it helps avoid publishing to npm with the `source`, `development`, or `monorepo` condition that points to code that cannot be used by the resolver. ' +\n 'See https://tsdown.dev/options/package-exports#dev-exports for more information.'\n if (strictOptions.noPublishConfigExports === 'error') {\n shouldError = true\n logger.error(msg)\n } else if (strictOptions.noPublishConfigExports !== 'off') {\n logger.warn(msg)\n }\n } else {\n // Validate publishConfig.exports structure\n const publishExports = pkg.publishConfig.exports\n\n // Check that all keys in exports exist in publishConfig.exports\n for (const exportPath of Object.keys(pkg.exports)) {\n if (!(exportPath in publishExports)) {\n shouldError = true\n logger.error(\n `publishConfig.exports: missing export path \"${exportPath}\" that exists in exports`,\n )\n }\n }\n\n // Check that all keys in publishConfig.exports exist in exports\n for (const exportPath of Object.keys(publishExports)) {\n if (!(exportPath in pkg.exports)) {\n shouldError = true\n logger.error(\n `publishConfig.exports: unexpected export path \"${exportPath}\" that does not exist in exports`,\n )\n }\n }\n\n // Validate each export path\n for (const [exportPath, exp] of Object.entries(pkg.exports)) {\n if (typeof exp === 'string' || 'svelte' in exp) {\n // For string or svelte exports, publishConfig should match\n const publishExp = publishExports[exportPath]\n if (\n typeof publishExp !== 'string' &&\n (typeof publishExp !== 'object' || !('svelte' in publishExp))\n ) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should be a string matching exports[\"${exportPath}\"]`,\n )\n }\n continue\n }\n\n const publishExp = publishExports[exportPath]\n if (!publishExp) {\n continue\n }\n if (typeof publishExp === 'string') {\n // publishConfig has a string, validate it's correct\n // It should be a condensed form when only default remains after removing source/development/monorepo\n const conditions = Object.keys(exp).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n if (conditions.length !== 1 || conditions[0] !== 'default') {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: is a string but exports[\"${exportPath}\"] has multiple conditions besides source/development/monorepo: ${conditions.join(', ')}`,\n )\n } else {\n // Validate that the string value matches the default condition value\n const expectedValue = exp.default\n if (publishExp !== expectedValue) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should be \"${expectedValue}\" but got \"${publishExp}\"`,\n )\n }\n }\n continue\n }\n\n if ('svelte' in publishExp) {\n continue\n }\n\n // Validate conditions\n const exportConditions = Object.keys(exp).filter(\n (k) => k !== 'source' && k !== 'development' && k !== 'monorepo',\n )\n const publishConditions = Object.keys(publishExp)\n\n // Check for source, development, or monorepo in publishConfig\n if ('source' in publishExp) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should not contain the \\`source\\` condition`,\n )\n }\n\n if ('development' in publishExp) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should not contain the \\`development\\` condition`,\n )\n }\n\n if ('monorepo' in publishExp) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: should not contain the \\`monorepo\\` condition`,\n )\n }\n\n // Check that all conditions match (except source/development/monorepo)\n for (const condition of exportConditions) {\n if (!(condition in publishExp)) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: missing \\`${condition}\\` condition that exists in exports[\"${exportPath}\"]`,\n )\n }\n }\n\n for (const condition of publishConditions) {\n if (!exportConditions.includes(condition)) {\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"]: unexpected \\`${condition}\\` condition that does not exist in exports[\"${exportPath}\"]`,\n )\n }\n }\n\n // Validate that values match for all conditions\n for (const condition of exportConditions) {\n if (condition in publishExp) {\n const exportValue = (exp as Record<string, unknown>)[condition]\n const publishValue = (publishExp as Record<string, unknown>)[condition]\n\n // Compare values recursively for nested objects\n if (!areExportValuesEqual(exportValue, publishValue)) {\n const exportValueStr =\n typeof exportValue === 'string' ? exportValue : JSON.stringify(exportValue)\n const publishValueStr =\n typeof publishValue === 'string' ? publishValue : JSON.stringify(publishValue)\n shouldError = true\n logger.error(\n `publishConfig.exports[\"${exportPath}\"].${condition}: should be ${exportValueStr} but got ${publishValueStr}`,\n )\n }\n }\n }\n }\n }\n }\n }\n\n if (shouldError) {\n process.exit(1)\n }\n\n return pkg\n } catch (err) {\n if (err instanceof ZodError) {\n for (const issue of err.issues) {\n if (issue.code === 'invalid_type') {\n logger.error(\n [\n `\\`${formatPath(issue.path)}\\` `,\n `in \\`./package.json\\` must be of type ${chalk.magenta(issue.expected)} `,\n `(received ${chalk.magenta(issue.received)})`,\n ].join(''),\n )\n continue\n }\n\n logger.error(issue)\n }\n } else {\n logger.error(err)\n }\n\n return process.exit(1)\n }\n}\n\nfunction formatPath(segments: Array<string | number>) {\n return segments\n .map((s, idx) => {\n if (idx === 0) return s\n\n if (typeof s === 'number') {\n return `[${s}]`\n }\n\n if (s.startsWith('.')) {\n return `[\"${s}\"]`\n }\n\n return `.${s}`\n })\n .join('')\n}\n","import browserslist from 'browserslist'\n\n// convert the browserslist field in package.json to\n// esbuild compatible array of browsers\nexport default function browserslistToEsbuild(browserslistConfig, options = {}) {\n if (!browserslistConfig) {\n // the path from where the script is run\n const path = process.cwd()\n\n // read config if none is passed\n browserslistConfig = browserslist.loadConfig({ path, ...options })\n }\n\n const SUPPORTED_ESBUILD_TARGETS = [\n 'es',\n 'chrome',\n 'edge',\n 'firefox',\n 'ios',\n 'node',\n 'safari',\n 'opera',\n 'ie',\n ]\n\n // https://github.com/eBay/browserslist-config/issues/16#issuecomment-863870093\n const UNSUPPORTED = ['android 4']\n\n const replaces = {\n ios_saf: 'ios',\n android: 'chrome',\n }\n\n const separator = ' '\n\n return (\n browserslist(browserslistConfig, options)\n // filter out the unsupported ones\n .filter((b) => !UNSUPPORTED.some((u) => b.startsWith(u)))\n // replaces safari TP with latest safari version\n .map((b) => {\n if (b === 'safari TP') {\n return browserslist('last 1 safari version')[0]\n }\n\n return b\n })\n // transform into ['chrome', '88']\n .map((b) => b.split(separator))\n // replace the similar browser\n .map((b) => {\n if (replaces[b[0]]) {\n b[0] = replaces[b[0]]\n }\n\n return b\n })\n // 11.0-12.0 --> 11.0\n .map((b) => {\n if (b[1].includes('-')) {\n b[1] = b[1].slice(0, b[1].indexOf('-'))\n }\n\n return b\n })\n // 11.0 --> 11\n .map((b) => {\n if (b[1].endsWith('.0')) {\n b[1] = b[1].slice(0, -2)\n }\n\n return b\n })\n // removes invalid versions that will break esbuild\n // https://github.com/evanw/esbuild/blob/35c0d65b9d4f29a26176404d2890d1b499634e9f/compat-table/src/caniuse.ts#L119-L122\n .filter((b) => /^\\d+(\\.\\d+)*$/.test(b[1]))\n // only get the targets supported by esbuild\n .filter((b) => SUPPORTED_ESBUILD_TARGETS.includes(b[0]))\n // only get the oldest version, assuming that the older version\n // is last in the array\n .reduce((acc, b) => {\n const existingIndex = acc.findIndex((br) => br[0] === b[0])\n\n if (existingIndex !== -1) {\n acc[existingIndex][1] = b[1]\n } else {\n acc.push(b)\n }\n return acc\n }, [])\n // remove separator\n .map((b) => b.join(''))\n )\n}\n","import type {PkgConfigProperty, PkgConfigPropertyResolver} from './types.ts'\n\nfunction isPkgConfigPropertyResolver<T>(\n prop: PkgConfigProperty<T>,\n): prop is PkgConfigPropertyResolver<T> {\n return typeof prop === 'function'\n}\n\n/** @internal */\nexport function resolveConfigProperty<T>(\n prop: PkgConfigProperty<T> | undefined,\n initialValue: T,\n): T {\n if (!prop) return initialValue\n\n if (isPkgConfigPropertyResolver(prop)) {\n return prop(initialValue)\n }\n\n return prop\n}\n","import path from 'node:path'\n\nexport function pathContains(containerPath: string, itemPath: string): boolean {\n return !path.relative(containerPath, itemPath).startsWith('..')\n}\n\nexport function findCommonDirPath(filePaths: string[]): string | undefined {\n let ret: string | undefined = undefined\n\n for (const filePath of filePaths) {\n let dirPath = path.dirname(filePath)\n\n if (!ret) {\n ret = dirPath\n continue\n }\n\n while (dirPath !== ret) {\n if (pathContains(dirPath, ret)) {\n ret = dirPath\n break\n }\n\n dirPath = path.dirname(dirPath)\n\n if (dirPath === ret) {\n break\n }\n\n if (dirPath === '.') return undefined\n }\n }\n\n return ret\n}\n","import type {PackageJSON} from '@sanity/parse-package-json'\nimport type {PkgBundle, PkgExport} from '../../core/config/types.ts'\n\n/** @internal */\nexport const fileEnding: RegExp = /\\.[mc]?js$/\n/** @internal */\nconst dtsEnding = '.d.ts'\n/** @internal */\nexport const defaultEnding = '.js'\n/** @internal */\nexport const mjsEnding = '.mjs'\n/** @internal */\nexport const cjsEnding = '.cjs'\nconst mtsEnding = '.d.mts'\nconst ctsEnding = '.d.cts'\n\n/** @internal */\nexport function getTargetPaths(\n _type: PackageJSON['type'],\n expOrBundle: PkgExport | PkgExport['browser'] | PkgExport['node'] | PkgBundle,\n): string[] {\n const type = (_type === 'module' ? 'module' : 'commonjs') satisfies PackageJSON['type']\n\n const set = new Set<string>()\n\n if (expOrBundle?.import) {\n set.add(expOrBundle.import.replace(fileEnding, type === 'module' ? dtsEnding : mtsEnding))\n }\n\n if (expOrBundle?.require) {\n set.add(expOrBundle.require.replace(fileEnding, type === 'commonjs' ? dtsEnding : ctsEnding))\n }\n\n if (isPkgExport(expOrBundle)) {\n if (!expOrBundle.browser?.source) {\n if (expOrBundle.browser?.import) {\n set.add(\n expOrBundle.browser.import.replace(fileEnding, type === 'module' ? dtsEnding : mtsEnding),\n )\n }\n\n if (expOrBundle.browser?.require) {\n set.add(\n expOrBundle.browser.require.replace(\n fileEnding,\n type === 'commonjs' ? dtsEnding : ctsEnding,\n ),\n )\n }\n }\n\n if (!expOrBundle.node?.source) {\n if (expOrBundle.node?.import) {\n set.add(\n expOrBundle.node.import.replace(fileEnding, type === 'module' ? dtsEnding : mtsEnding),\n )\n }\n\n if (expOrBundle.node?.require) {\n set.add(\n expOrBundle.node.require.replace(fileEnding, type === 'commonjs' ? dtsEnding : ctsEnding),\n )\n }\n }\n }\n\n return Array.from(set)\n}\n\nfunction isPkgExport(exp: any): exp is PkgExport {\n return exp?.browser || exp?.node || exp?.default\n}\n","import {cjsEnding, defaultEnding, mjsEnding} from '../../tasks/dts/getTargetPaths.ts'\n\n/** @internal */\nexport interface PkgExtMap {\n commonjs: {commonjs: string; esm: string}\n module: {commonjs: string; esm: string}\n}\n\n/** @internal */\nexport const pkgExtMap: PkgExtMap = {\n // pkg.type: \"commonjs\"\n commonjs: {\n commonjs: defaultEnding,\n esm: mjsEnding,\n },\n\n // pkg.type: \"module\"\n module: {\n commonjs: cjsEnding,\n esm: defaultEnding,\n },\n}\n","import type {PackageJSON} from '@sanity/parse-package-json'\nimport type {PkgExport} from '../config/types.ts'\nimport {pkgExtMap as extMap} from './pkgExt.ts'\n\nexport function validateExports(\n _exports: (PkgExport & {_path: string})[],\n options: {pkg: PackageJSON},\n): string[] {\n const {pkg} = options\n const type = pkg.type || 'commonjs'\n const ext = extMap[type]\n\n const errors: string[] = []\n\n for (const exp of _exports) {\n if (exp._path === '.') {\n if (exp.require && pkg.main && exp.require !== pkg.main) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exp.import && pkg.module && exp.import !== pkg.module) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\". These must be equal.',\n )\n }\n }\n if (exp.require && !exp.require.endsWith(ext.commonjs)) {\n errors.push(\n `package.json with \\`type: \"${type}\"\\` - \\`exports[\"${exp._path}\"].require\\` must end with \"${ext.commonjs}\"`,\n )\n }\n\n if (exp.import && !exp.import.endsWith(ext.esm)) {\n errors.push(\n `package.json with \\`type: \"${type}\"\\` - \\`exports[\"${exp._path}\"].import\\` must end with \"${ext.esm}\"`,\n )\n }\n }\n\n return errors\n}\n","import {existsSync} from 'node:fs'\nimport {resolve as resolvePath} from 'node:path'\nimport {parseExports, type PackageJSON} from '@sanity/parse-package-json'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\nimport {defaultEnding, fileEnding} from '../../tasks/dts/getTargetPaths.ts'\nimport type {PkgExport} from '../config/types.ts'\nimport {isRecord} from '../isRecord.ts'\nimport {pkgExtMap} from './pkgExt.ts'\nimport {validateExports} from './validateExports.ts'\n\n// Type guard to filter out falsy values\nfunction isTruthy<T>(value: T | false | null | undefined | 0 | ''): value is T {\n return Boolean(value)\n}\n\n/** @alpha */\nexport function parseAndValidateExports(options: {\n cwd: string\n pkg: PackageJSON\n strict: boolean\n strictOptions: StrictOptions\n logger: Logger\n}): (PkgExport & {_path: string})[] {\n const {cwd, pkg, strict, strictOptions, logger} = options\n const type = pkg.type || 'commonjs'\n const errors: string[] = []\n\n const report = (kind: 'warn' | 'error', message: string) => {\n if (kind === 'warn') {\n logger.warn(message)\n } else {\n errors.push(message)\n }\n }\n\n if (!Array.isArray(pkg.files) && strict && strictOptions.alwaysPackageJsonFiles !== 'off') {\n report(\n strictOptions.alwaysPackageJsonFiles,\n 'package.json: `files` should be used over `.npmignore`',\n )\n }\n\n if (pkg.source) {\n if (\n strict &&\n pkg.exports?.['.'] &&\n typeof pkg.exports['.'] === 'object' &&\n 'source' in pkg.exports['.'] &&\n pkg.exports['.'].source === pkg.source\n ) {\n errors.push(\n 'package.json: the \"source\" property can be removed, as it is equal to exports[\".\"].source.',\n )\n } else if (!pkg.exports && pkg.main) {\n const extMap = pkgExtMap[type]\n const importExport = pkg.main.replace(fileEnding, extMap.esm)\n const requireExport = pkg.main.replace(fileEnding, extMap.commonjs)\n const defaultExport = pkg.main.replace(fileEnding, defaultEnding)\n\n const maybeBrowserCondition = []\n\n if (pkg.browser) {\n const browserConditions = []\n\n if (pkg.module && pkg.browser?.[pkg.module]) {\n browserConditions.push(\n ` \"import\": ${JSON.stringify(pkg.browser[pkg.module]!.replace(fileEnding, extMap.esm))}`,\n )\n } else if (pkg.browser?.[pkg.main]) {\n browserConditions.push(\n ` \"import\": ${JSON.stringify(pkg.browser[pkg.main]!.replace(fileEnding, extMap.esm))}`,\n )\n }\n\n if (pkg.browser?.[pkg.main]) {\n browserConditions.push(\n ` \"require\": ${JSON.stringify(pkg.browser[pkg.main]!.replace(fileEnding, extMap.commonjs))}`,\n )\n }\n\n if (browserConditions.length) {\n maybeBrowserCondition.push(\n ` \"browser\": {`,\n ` \"source\": ${JSON.stringify(pkg.browser?.[pkg.source] || pkg.source)},`,\n ...browserConditions,\n ` }`,\n )\n }\n }\n\n errors.push(\n ...[\n 'package.json: `exports` are missing, it should be:',\n `\"exports\": {`,\n ` \".\": {`,\n ` \"source\": ${JSON.stringify(pkg.source)},`,\n // If browser conditions are detected then add them to the suggestion\n ...(maybeBrowserCondition.length > 0 ? maybeBrowserCondition : []),\n type === 'commonjs' && ` \"import\": ${JSON.stringify(importExport)},`,\n type === 'module' && ` \"require\": ${JSON.stringify(requireExport)},`,\n ` \"default\": ${JSON.stringify(defaultExport)}`,\n ` },`,\n ` \"./package.json\": \"./package.json\"`,\n `}`,\n ].filter(isTruthy),\n )\n }\n }\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n if (!pkg.exports) {\n throw new Error(\n '\\n- ' +\n [\n 'package.json: `exports` are missing, please set a minimal configuration, for example:',\n `\"exports\": {`,\n ` \".\": {`,\n ` \"source\": \"./src/index.js\",`,\n ` \"default\": \"./dist/index.js\"`,\n ` },`,\n ` \"./package.json\": \"./package.json\"`,\n `}`,\n ].join('\\n- '),\n )\n }\n\n const _exports = parseExports({pkg})\n\n if (strict && strictOptions.noPackageJsonTypings !== 'off' && 'typings' in pkg) {\n report(strictOptions.noPackageJsonTypings, 'package.json: `typings` should be `types`')\n }\n\n if (\n strict &&\n strictOptions.alwaysPackageJsonTypes !== 'off' &&\n !pkg.types &&\n typeof pkg.exports?.['.'] === 'object' &&\n 'source' in pkg.exports['.'] &&\n pkg.exports['.'].source?.endsWith('.ts')\n ) {\n report(\n strictOptions.alwaysPackageJsonTypes,\n 'package.json: `types` must be declared for the npm listing to show as a TypeScript module.',\n )\n }\n\n if (strict && !pkg.exports['./package.json']) {\n errors.push('package.json: `exports[\"./package.json\"] must be declared.')\n }\n\n for (const [exportPath, exportEntry] of Object.entries(pkg.exports)) {\n if (\n exportPath.endsWith('.json') ||\n (typeof exportEntry === 'string' && exportEntry.endsWith('.json'))\n ) {\n if (exportPath === './package.json') {\n if (exportEntry !== './package.json') {\n errors.push('package.json: `exports[\"./package.json\"]` must be \"./package.json\".')\n }\n }\n } else if (exportPath.endsWith('.css')) {\n if (typeof exportEntry === 'string') {\n if (!existsSync(resolvePath(cwd, exportEntry))) {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}]\\`: file does not exist.`,\n )\n }\n } else if (isRecord(exportEntry)) {\n // Conditional CSS export, e.g.\n // \"./bundle.css\": { \"types\": \"./dist/bundle-css.d.ts\", \"browser\": \"./dist/bundle.css\", \"node\": \"./dist/bundle-css.js\", \"default\": \"./dist/bundle-css.js\" }\n // This lets a package re-add a `import \"<pkg>/bundle.css\"` that resolves to the real CSS in\n // bundler/browser environments and to a no-op JS shim in CSS-unaware runtimes (e.g. Node).\n // Only the shape is validated here: the targets usually point at generated `dist` files that\n // do not exist yet at validation time, so file existence is intentionally not checked.\n for (const [condition, target] of Object.entries(exportEntry)) {\n if (typeof target !== 'string') {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}][${JSON.stringify(condition)}]\\`: must be a string path.`,\n )\n }\n }\n } else {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}]\\`: must be a string path or an object of export conditions.`,\n )\n }\n } else if (isRecord(exportEntry) && 'svelte' in exportEntry) {\n // @TODO should we report a warning or a debug message here about a detected svelte export that is ignored?\n } else if (isPkgExport(exportEntry)) {\n const exp = {\n _exported: true,\n _path: exportPath,\n ...exportEntry,\n } satisfies PkgExport & {_path: string}\n\n // Infer the `default` condition based on the `type` and other conditions\n if (!exp.default) {\n const fallback = type === 'module' ? exp.import : exp.require\n\n if (fallback) {\n exp.default = fallback\n }\n }\n\n // Infer the `require` condition based on the `type` and other conditions\n if (!exp.require && type === 'commonjs' && exp.default) {\n exp.require = exp.default\n }\n\n // Infer the `import` condition based on the `type` and other conditions\n if (!exp.import && type === 'module' && exp.default) {\n exp.import = exp.default\n }\n\n if (exportPath === '.') {\n if (exportEntry.require && pkg.main && exportEntry.require !== pkg.main) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exportEntry.import && pkg.module && exportEntry.import !== pkg.module) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\" These must be equal.',\n )\n }\n }\n } else if (!isRecord(exportEntry)) {\n errors.push('package.json: exports must be an object')\n }\n }\n\n errors.push(...validateExports(_exports, {pkg}))\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n return _exports\n}\n\nfunction isPkgExport(value: unknown): value is PkgExport {\n return isRecord(value) && 'source' in value && typeof value['source'] === 'string'\n}\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/** @internal */\nexport async function loadTSConfig(options: {\n cwd: string\n tsconfigPath: string\n}): Promise<ReturnType<typeof ts.parseJsonConfigFileContent> | undefined> {\n const {cwd, tsconfigPath} = options\n\n // oxlint-disable-next-line unbound-method\n const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n\n if (!configPath) {\n return undefined\n }\n\n // oxlint-disable-next-line unbound-method\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd)\n}\n","export function resolveBrowserTarget(versions: string[]): string[] | undefined {\n const target: string[] = versions.filter(\n (version) =>\n version.startsWith('chrome') ||\n version.startsWith('edge') ||\n version.startsWith('firefox') ||\n version.startsWith('ios') ||\n version.startsWith('safari') ||\n version.startsWith('opera'),\n )\n\n if (target.length === 0) {\n return undefined\n }\n\n return target\n}\n","export function resolveNodeTarget(versions: string[]): string[] | undefined {\n const target: string[] = versions.filter((version) => version.startsWith('node'))\n\n if (target.length === 0) {\n return undefined\n }\n\n return target\n}\n","import {errorMap} from 'zod-validation-error/v3'\nimport {z} from 'zod/v3'\n\nconst toggle = z.union([z.literal('error'), z.literal('warn'), z.literal('off')])\n\ntype ToggleType = 'error' | 'warn' | 'off'\n\nconst strictOptions = z\n .object({\n noPackageJsonTypings: toggle.default('error'),\n noImplicitSideEffects: toggle.default('warn'),\n noImplicitBrowsersList: toggle.default('warn'),\n alwaysPackageJsonTypes: toggle.default('error'),\n alwaysPackageJsonFiles: toggle.default('error'),\n noCheckTypes: toggle.default('warn'),\n noPackageJsonBrowser: toggle.default('warn'),\n noPackageJsonTypesVersions: toggle.default('warn'),\n preferModuleType: toggle.default('warn'),\n noPublishConfigExports: toggle.default('warn'),\n noReactIsPeerDependency: toggle.default('error'),\n noSanityUiPeerDependency: toggle.default('error'),\n noSanityIconsPeerDependency: toggle.default('error'),\n noSanityDependency: toggle.default('error'),\n noStyledComponentsDependency: toggle.default('error'),\n noReactDependency: toggle.default('error'),\n noReactDomDependency: toggle.default('error'),\n noReactTypesDependency: toggle.default('error'),\n noReactDomTypesDependency: toggle.default('error'),\n noNodeTypesDependency: toggle.default('error'),\n noRxjsPeerDependency: toggle.default('error'),\n noSanityClientPeerDependency: toggle.default('error'),\n })\n .strict()\n\n/**\n * To make error message paths line up with the paths in package.config.ts the schema is hoisted into a root schema\n * This way errors will say `Expected boolean, received string at \"strict.noPackageJsonTypings\"` instead of `Expected boolean, received string at \"noPackageJsonTypings\"`.\n */\nconst validationSchema = z.object({\n strictOptions: strictOptions.default({}),\n})\n\n/**\n * @public\n */\nexport interface StrictOptions {\n /**\n * Disallows a top level `typings` field in `package.json` if it is equal to `exports['.'].source`.\n * @defaultValue 'error'\n */\n noPackageJsonTypings: ToggleType\n /**\n * Requires specifying `sideEffects` in `package.json`.\n * @defaultValue 'warn'\n */\n noImplicitSideEffects: ToggleType\n /**\n * Requires specifying `browserslist` in `package.json`, instead of relying on it implicitly being:\n * @example\n * ```\n * \"browserslist\": \"extends @sanity/browserslist-config\"\n * ```\n * @defaultValue 'warn'\n */\n noImplicitBrowsersList: ToggleType\n /**\n * If typescript is used then `types` in `package.json` should be specified for npm listings to show the TS icon.\n * @defaultValue 'error'\n */\n alwaysPackageJsonTypes: ToggleType\n /**\n * Using `.npmignore` is error prone, it's best practice to always declare `files` instead\n * @defaultValue 'error'\n */\n alwaysPackageJsonFiles: ToggleType\n /**\n * 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`\n * @defaultValue 'warn'\n */\n noCheckTypes: ToggleType\n /**\n * Disallows the `browser` field in `package.json` as the `browser` condition in `exports` is better supported.\n * @defaultValue 'warn'\n */\n noPackageJsonBrowser: ToggleType\n /**\n * Disallows the `typesVersions` field in `package.json` as TypeScript has long supported conditional exports and the `types` condition.\n * @defaultValue 'warn'\n */\n noPackageJsonTypesVersions: ToggleType\n /**\n * Warns if `type` field is missing or set to `commonjs`. Future versions will require `\"type\": \"module\"`.\n * @defaultValue 'warn'\n */\n preferModuleType: ToggleType\n /**\n * Warns if `publishConfig.exports` is missing when `source`, `development`, or `monorepo` conditions are used in exports.\n * @defaultValue 'warn'\n */\n noPublishConfigExports: ToggleType\n /**\n * Disallows `react-is` in `peerDependencies`. It should be in `dependencies` (or `devDependencies`) instead.\n * @defaultValue 'error'\n */\n noReactIsPeerDependency: ToggleType\n /**\n * Disallows `@sanity/ui` in `peerDependencies`. It should be in `dependencies` (or `devDependencies`) instead.\n * @defaultValue 'error'\n */\n noSanityUiPeerDependency: ToggleType\n /**\n * Disallows `@sanity/icons` in `peerDependencies`. It should be in `dependencies` (or `devDependencies`) instead.\n * @defaultValue 'error'\n */\n noSanityIconsPeerDependency: ToggleType\n /**\n * Disallows `sanity` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noSanityDependency: ToggleType\n /**\n * Disallows `styled-components` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noStyledComponentsDependency: ToggleType\n /**\n * Disallows `react` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noReactDependency: ToggleType\n /**\n * Disallows `react-dom` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`.\n * @defaultValue 'error'\n */\n noReactDomDependency: ToggleType\n /**\n * Disallows `@types/react` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`, and when declared as a peer dependency the version range should be `*`.\n * @defaultValue 'error'\n */\n noReactTypesDependency: ToggleType\n /**\n * Disallows `@types/react-dom` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`, and when declared as a peer dependency the version range should be `*`.\n * @defaultValue 'error'\n */\n noReactDomTypesDependency: ToggleType\n /**\n * Disallows `@types/node` in `dependencies`. It should only be in `devDependencies` and/or `peerDependencies`, and when declared as a peer dependency the version range should be `*`.\n * @defaultValue 'error'\n */\n noNodeTypesDependency: ToggleType\n /**\n * Disallows `rxjs` in `peerDependencies`. It should only be in `dependencies` and/or `devDependencies`.\n * @defaultValue 'error'\n */\n noRxjsPeerDependency: ToggleType\n /**\n * Disallows `@sanity/client` in `peerDependencies`. It should only be in `dependencies` and/or `devDependencies`.\n * @defaultValue 'error'\n */\n noSanityClientPeerDependency: ToggleType\n}\n\n/** @alpha */\nexport function parseStrictOptions(input: unknown): StrictOptions {\n return validationSchema.parse({strictOptions: input}, {errorMap}).strictOptions\n}\n","import path from 'node:path'\nimport type {PackageJSON} from '@sanity/parse-package-json'\nimport browserslistToEsbuild from 'browserslist-to-esbuild'\nimport {resolveConfigProperty} from './core/config/resolveConfigProperty.ts'\nimport {type PkgConfigOptions, type PkgExports, type PkgRuntime} from './core/config/types.ts'\nimport type {BuildContext} from './core/contexts/buildContext.ts'\nimport {DEFAULT_BROWSERSLIST_QUERY} from './core/defaults.ts'\nimport {findCommonDirPath, pathContains} from './core/findCommonPath.ts'\nimport {parseAndValidateExports} from './core/pkg/parseAndValidateExports.ts'\nimport {loadTSConfig} from './core/ts/loadTSConfig.ts'\nimport type {Logger} from './logger.ts'\nimport {resolveBrowserTarget} from './resolveBrowserTarget.ts'\nimport {resolveNodeTarget} from './resolveNodeTarget.ts'\nimport {parseStrictOptions} from './strict.ts'\n\n// Type guard to filter out falsy values\nfunction isTruthy<T>(value: T | false | null | undefined | 0 | ''): value is T {\n return Boolean(value)\n}\n\nexport async function resolveBuildContext(options: {\n config?: PkgConfigOptions | undefined\n cwd: string\n emitDeclarationOnly?: boolean\n logger: Logger\n pkg: PackageJSON\n strict: boolean\n tsconfig: string\n}): Promise<BuildContext> {\n const {\n config,\n cwd,\n emitDeclarationOnly = false,\n logger,\n pkg,\n strict,\n tsconfig: tsconfigPath,\n } = options\n const tsconfig = await loadTSConfig({cwd, tsconfigPath})\n const strictOptions = parseStrictOptions(config?.strictOptions ?? {})\n\n if (strictOptions.noCheckTypes !== 'off' && tsconfig?.options && config?.dts !== 'rolldown') {\n if (\n tsconfig.options.noCheck !== false &&\n !tsconfig.options.noCheck &&\n config?.extract?.checkTypes !== false\n ) {\n if (strictOptions.noCheckTypes === 'error') {\n throw new Error(\n '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it. You can set `noCheck: true` in tsconfig.json or set `extract: { checkTypes: false }` in package.config.ts to disable type checking.',\n )\n } else {\n logger.warn(\n '`noCheck` is not set to `true` in the tsconfig.json file used by `package.config.ts`. This makes generating dts files slower than it needs to be, as it will perform type checking on the dts files while at it. You can set `noCheck: true` in tsconfig.json or set `extract: { checkTypes: false }` in package.config.ts to disable type checking.',\n )\n }\n }\n }\n\n let browserslist = pkg.browserslist\n if (!browserslist) {\n if (strict && strictOptions.noImplicitBrowsersList !== 'off') {\n if (strictOptions.noImplicitBrowsersList === 'error') {\n throw new Error(\n '\\n- ' +\n `package.json: \"browserslist\" is missing, set it to \\`\"browserslist\": \"extends @sanity/browserslist-config\"\\``,\n )\n } else {\n logger.warn(\n 'Could not detect a `browserslist` property in `package.json`, using default configuration. Add `\"browserslist\": \"extends @sanity/browserslist-config\"` to silence this warning.',\n )\n }\n }\n browserslist = DEFAULT_BROWSERSLIST_QUERY\n }\n const targetVersions = browserslistToEsbuild(browserslist)\n\n if (\n strict &&\n strictOptions.noImplicitSideEffects !== 'off' &&\n typeof pkg.sideEffects === 'undefined'\n ) {\n const msg =\n 'package.json: `sideEffects` is missing, see https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects for how to define `sideEffects`'\n\n if (strictOptions.noImplicitSideEffects === 'error') {\n throw new Error(msg)\n } else {\n logger.warn(msg)\n }\n }\n\n const nodeTarget = resolveNodeTarget(targetVersions)\n const webTarget = resolveBrowserTarget(targetVersions)\n\n if (!nodeTarget) {\n throw new Error('no matching `node` target')\n }\n\n if (!webTarget) {\n throw new Error('no matching `web` target')\n }\n\n const target: Record<PkgRuntime, string[]> = {\n '*': webTarget.concat(nodeTarget),\n 'browser': webTarget,\n 'node': nodeTarget,\n }\n\n const parsedExports = parseAndValidateExports({\n cwd,\n pkg,\n strict,\n strictOptions,\n logger,\n }).reduce<PkgExports>(\n (acc, {_path: exportPath, ...exportEntry}) => Object.assign(acc, {[exportPath]: exportEntry}),\n {},\n )\n\n const exports = resolveConfigProperty(config?.exports, parsedExports)\n\n const parsedExternal = [\n ...(pkg.dependencies ? Object.keys(pkg.dependencies) : []),\n ...(pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []),\n ]\n\n // Merge externals if an array is provided, replace if it's a function\n const external =\n config && Array.isArray(config.external)\n ? [...parsedExternal, ...config.external]\n : resolveConfigProperty(config?.external, parsedExternal)\n // Merge bundledPackages with dev deps, replace if it's a function\n const externalWithTypes = new Set([pkg.name, ...external, ...external.map(transformPackageName)])\n const bundledDependencies = (pkg.devDependencies ? Object.keys(pkg.devDependencies) : []).filter(\n // Do not bundle anything that is marked as external\n (_) => !externalWithTypes.has(_),\n )\n const bundledPackages =\n config && Array.isArray(config.extract?.bundledPackages)\n ? [...bundledDependencies, ...config.extract.bundledPackages]\n : resolveConfigProperty(config?.extract?.bundledPackages, bundledDependencies)\n\n const outputPaths = Object.values(exports)\n .flatMap((exportEntry) => {\n return [\n exportEntry.import,\n exportEntry.require,\n exportEntry.browser?.import,\n exportEntry.browser?.require,\n exportEntry.node?.source && exportEntry.node.import,\n exportEntry.node?.source && exportEntry.node.require,\n ].filter(isTruthy)\n })\n .map((p) => path.resolve(cwd, p))\n\n const commonDistPath = findCommonDirPath(outputPaths)\n\n if (commonDistPath === cwd) {\n throw new Error(\n 'all output files must share a common parent directory which is not the root package directory',\n )\n }\n\n if (commonDistPath && !pathContains(cwd, commonDistPath)) {\n throw new Error('all output files must be located within the package')\n }\n\n const configDistPath = config?.dist ? path.resolve(cwd, config.dist) : undefined\n\n if (\n configDistPath &&\n commonDistPath &&\n configDistPath !== commonDistPath &&\n !pathContains(configDistPath, commonDistPath)\n ) {\n logger.log(`did you mean to configure \\`dist: './${path.relative(cwd, commonDistPath)}'\\`?`)\n\n throw new Error('all output files must be located with the configured `dist` path')\n }\n\n const distPath = configDistPath || commonDistPath\n\n if (!distPath) {\n throw new Error('could not detect `dist` path')\n }\n\n const ctx: BuildContext = {\n config,\n cwd,\n distPath,\n emitDeclarationOnly,\n exports,\n external,\n bundledPackages,\n files: [],\n logger,\n pkg,\n runtime: config?.runtime ?? '*',\n strict,\n target,\n ts: {\n config: tsconfig,\n configPath: tsconfigPath,\n },\n dts: config?.dts === 'rolldown' ? 'rolldown' : 'api-extractor',\n }\n\n return ctx\n}\n\nfunction transformPackageName(packageName: string): string {\n if (packageName.startsWith('@types/')) {\n // If it already starts with @types, return it as is\n return packageName\n } else if (packageName.startsWith('@')) {\n // Handle scoped packages\n const [scope, name] = packageName.split('/')\n\n return `@types/${scope?.slice(1)}__${name}`\n } else {\n // Handle regular packages\n return `@types/${packageName}`\n }\n}\n"],"names":["strictOptions","typoMap","strict","publishExp","path","isPkgExport","extMap","isTruthy","resolvePath","browserslist"],"mappings":";;;;;;;;;;;AAYO,SAAS,iBAAiB,SAElB;AACb,QAAM,EAAC,WAAA,IAAc,WAAW,CAAA,GAE1B,WAAW;AAAA,IACf,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AAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,CAAA;AAAA,IACP;AAAA,IACA;AAAA,IACA,SAAS,QAAQ,WAAW;AAAA,IAC5B,QAAAE;AAAA,IACA;AAAA,IACA,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,YAAY;AAAA,IAAA;AAAA,IAEd,KAAK,QAAQ,QAAQ,aAAa,aAAa;AAAA,EAAA;AAInD;AAEA,SAAS,qBAAqB,aAA6B;AACzD,MAAI,YAAY,WAAW,SAAS;AAElC,WAAO;AACF,MAAI,YAAY,WAAW,GAAG,GAAG;AAEtC,UAAM,CAAC,OAAO,IAAI,IAAI,YAAY,MAAM,GAAG;AAE3C,WAAO,UAAU,OAAO,MAAM,CAAC,CAAC,KAAK,IAAI;AAAA,EAC3C;AAEE,WAAO,UAAU,WAAW;AAEhC;","x_google_ignoreList":[6]}
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { cac } from "cac";
2
- var version = "11.0.4";
2
+ var version = "11.0.6";
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.d.ts CHANGED
@@ -166,9 +166,12 @@ interface PkgVanillaExtractOptions extends Omit<Options, "extract"> {
166
166
  * not have to. When enabled, pkg-utils:
167
167
  *
168
168
  * - injects `import "<pkg-name>/<name>"` into each entry chunk (no manual `rollup.output.intro`),
169
- * - emits a no-op `<name>.js` shim for runtimes that cannot import `.css` files, and
169
+ * - emits a no-op shim (e.g. `bundle-css.js` for `name: "bundle.css"`) for runtimes that cannot
170
+ * import `.css` files — named with a hyphen rather than a `.css.js` suffix so it does not
171
+ * match vanilla-extract's `cssFileFilter`, and
170
172
  * - writes the conditional `"./<name>"` export to `package.json`
171
- * (`browser`/`style` → the real CSS, `node`/`default` → the shim).
173
+ * (`types` → the shim's `.d.ts`, `browser`/`style` → the real CSS, `node`/`default` → the
174
+ * shim).
172
175
  *
173
176
  * The result is that `import "<pkg>/<name>"` resolves to the real CSS in bundlers/browsers and
174
177
  * to the no-op shim in Node and similar runtimes. Disable it to wire these up yourself.
@@ -340,7 +343,7 @@ interface PkgConfigOptions {
340
343
  * minifying the extracted CSS. Pass `true` to use the defaults, or an object to customize.
341
344
  *
342
345
  * By default (`extract.compatMode: true`) pkg-utils also injects the self-referential
343
- * `import "<pkg>/bundle.css"`, emits a `bundle.css.js` shim, and writes the conditional
346
+ * `import "<pkg>/bundle.css"`, emits a `bundle-css.js` shim, and writes the conditional
344
347
  * `"./bundle.css"` export to `package.json` - see {@link PkgVanillaExtractOptions}.
345
348
  * @alpha
346
349
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/node/strict.ts","../src/node/core/config/types.ts","../src/node/core/config/defineConfig.ts","../src/node/core/config/loadConfig.ts","../src/node/core/defaults.ts","../src/node/core/template/types.ts","../src/node/core/template/define.ts"],"mappings":";;;;;;KAKK;;;;UAwCY;;;;;EAKf,sBAAsB;;;;;EAKtB,uBAAuB;;;;;;;;;EASvB,wBAAwB;;;;;EAKxB,wBAAwB;;;;;EAKxB,wBAAwB;;;;;EAKxB,cAAc;;;;;EAKd,sBAAsB;;;;;EAKtB,4BAA4B;;;;;EAK5B,kBAAkB;;;;;EAKlB,wBAAwB;;;;;EAKxB,yBAAyB;;;;;EAKzB,0BAA0B;;;;;EAK1B,6BAA6B;;;;;EAK7B,oBAAoB;;;;;EAKpB,8BAA8B;;;;;EAK9B,mBAAmB;;;;;EAKnB,sBAAsB;;;;;EAKtB,wBAAwB;;;;;EAKxB,2BAA2B;;;;;EAK3B,uBAAuB;;;;;EAKvB,sBAAsB;;;;;EAKtB,8BAA8B;;;KCpJpB;;;;;;UAOK,iCAAiC,KAAK;;;;;EAKrD;;;;;EAKA;;;;;EAKA,cAAc;;;;EAId;;;;;IAKE;;;;;IAKA;;;;;;;;;;;;;;IAcA;;;;KAKQ;;KAGA,0BAA0B,MAAM,MAAM,MAAM;;KAG5C,kBAAkB,KAAK,0BAA0B,KAAK;;UAGjD;EACf;EACA;EACA;EACA,UAAU;;;KAIA;;UAGK;EACf;EACA;EACA;;KAGU;;UAGK;;EAEf;IACE,UAAU;;IAEV;;IAEA;;MAIM;;;;;MAKA;;MAEA;;MAEA;;MAEA;;MAEA;;;;;;;;MAQA;MACA;;MAEA;;;;;;;EAOR,uBAAuB,QAAQ;EAC/B,UAAU;;EAEV,SAAS;;;;EAIT;EACA,UAAU,kBAAkB;;;;;;EAM5B;;;;IAIE;;;;;;;IAOA;;;;;;;;IAQA,kBAAkB;IAClB,aAAa;IACb;MACE,iCAAiC;MACjC,mCAAmC;MACnC,2BAA2B;MAC3B,kCAAkC;MAClC,wBAAwB;MACxB,0BAA0B;;;;;;;;;;EAU9B,WAAW;;;;EAIX;;;;EAIA;;;;EAIA;;;;EAIA;EACA;;EAEA;IACE,UAAU,kBAAkB;IAC5B,SAAS,QAAQ;;;;;;IAMjB,YAAY;;IAEZ;;;;;;IAMA;;;;;;;;IAQA,2BAA2B;;;;;;;;;;IAU3B,2BAA2B;;;;;EAK7B,UAAU;EACV;;;;EAIA;EACA;;;;EAIA,gBAAgB,QAAQ;;;;;;EAMxB,MAAM;;;;;;;;;;EAUN;;;iBC7Qc,mBAAmB,UAAU,kBAAkB,eAAe,IAAI;;iBCI5D,WAAW;EAC/B;EACA;IACE,QAAQ;;cCPC;;UCMI,wBAAwB;EACvC;EACA;EACA;EACA,UAAU,MAAM,SAAS,wBAAwB;EACjD,SAAS,cAAc;EACvB,YAAY;;;KAIF,kBAAkB,cAAc,wBAAwB;;iBChBpD,qBAAqB,GAAG,QAAQ,kBAAkB,KAAK,kBAAkB"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/node/strict.ts","../src/node/core/config/types.ts","../src/node/core/config/defineConfig.ts","../src/node/core/config/loadConfig.ts","../src/node/core/defaults.ts","../src/node/core/template/types.ts","../src/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;IAC5B,SAAS,QAAQ;;;;;;IAMjB,YAAY;;IAEZ;;;;;;IAMA;;;;;;;;IAQA,2BAA2B;;;;;;;;;;IAU3B,2BAA2B;;;;;EAK7B,UAAU;EACV;;;;EAIA;EACA;;;;EAIA,gBAAgB,QAAQ;;;;;;EAMxB,MAAM;;;;;;;;;;EAUN;;;iBChRc,mBAAmB,UAAU,kBAAkB,eAAe,IAAI;;iBCI5D,WAAW;EAC/B;EACA;IACE,QAAQ;;cCPC;;UCMI,wBAAwB;EACvC;EACA;EACA;EACA,UAAU,MAAM,SAAS,wBAAwB;EACjD,SAAS,cAAc;EACvB,YAAY;;;KAIF,kBAAkB,cAAc,wBAAwB;;iBChBpD,qBAAqB,GAAG,QAAQ,kBAAkB,KAAK,kBAAkB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/pkg-utils",
3
- "version": "11.0.4",
3
+ "version": "11.0.6",
4
4
  "description": "Simple utilities for modern npm packages.",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -84,7 +84,7 @@
84
84
  "tsx": "^4.23.0",
85
85
  "zod": "^4.4.3",
86
86
  "zod-validation-error": "^5.0.0",
87
- "@sanity/parse-package-json": "^2.2.5"
87
+ "@sanity/parse-package-json": "^2.2.6"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@types/babel__core": "^7.20.5",
@@ -98,7 +98,7 @@
98
98
  "rollup-plugin-visualizer": "^7.0.1",
99
99
  "typescript": "7.0.2",
100
100
  "vitest": "^4.1.10",
101
- "@sanity/tsconfig": "^2.2.0"
101
+ "@sanity/tsconfig": "^2.2.1"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "babel-plugin-react-compiler": "*",