@sanity/pkg-utils 7.11.3-canary.0 → 7.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/resolveRolldownConfig.cjs +15 -19
- package/dist/_chunks-cjs/resolveRolldownConfig.cjs.map +1 -1
- package/dist/_chunks-es/resolveRolldownConfig.js +15 -19
- package/dist/_chunks-es/resolveRolldownConfig.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.cts +0 -37
- package/dist/index.d.ts +0 -37
- package/package.json +3 -3
|
@@ -32,28 +32,24 @@ function resolveRolldownConfig(ctx, buildTask) {
|
|
|
32
32
|
tsconfigFilename: ctx.ts.configPath || "tsconfig.json"
|
|
33
33
|
},
|
|
34
34
|
experimental: {
|
|
35
|
-
attachDebugInfo: "
|
|
35
|
+
attachDebugInfo: "none"
|
|
36
36
|
},
|
|
37
37
|
external: (id, importer) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
), !0;
|
|
52
|
-
}
|
|
53
|
-
return external.some((name) => name === id || id.includes(`/${name}/`));
|
|
38
|
+
if (buildTask.type === "rolldown:dts" && ctx.bundledPackages.length > 0 && !id.startsWith(".") && (id.includes("/node_modules/") || id.split("/").length < 3))
|
|
39
|
+
return ctx.bundledPackages.some((name) => name === id || id.includes(`/${name}/`)) === !1;
|
|
40
|
+
if (exportIds?.includes(id))
|
|
41
|
+
return !0;
|
|
42
|
+
if (importer && (id.startsWith(".") || id.startsWith("/"))) {
|
|
43
|
+
const idPath = path__default.default.resolve(path__default.default.dirname(importer), id);
|
|
44
|
+
if (sourcePaths?.includes(idPath))
|
|
45
|
+
return logger.warn(
|
|
46
|
+
`detected self-referencing import \u2013 treating as external: ${path__default.default.relative(
|
|
47
|
+
cwd,
|
|
48
|
+
idPath
|
|
49
|
+
)}`
|
|
50
|
+
), !0;
|
|
54
51
|
}
|
|
55
|
-
|
|
56
|
-
return logger.info(`external: (id: ${id}, importer: ${importer}) -> ${result}`), result;
|
|
52
|
+
return external.some((name) => name === id || id.includes(`/node_modules/${name}/`));
|
|
57
53
|
},
|
|
58
54
|
input: entries.reduce(
|
|
59
55
|
(acc, entry) => Object.assign(acc, { [entry.name]: entry.source }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRolldownConfig.cjs","sources":["../../src/node/tasks/rolldown/resolveRolldownConfig.ts"],"sourcesContent":["import path from 'node:path'\nimport type {InputOptions, OutputOptions} from 'rolldown'\nimport {dts as dtsPlugin} from 'rolldown-plugin-dts'\nimport type {BuildContext} from '../../core/contexts/buildContext'\nimport {pkgExtMap as extMap} from '../../core/pkg/pkgExt'\nimport type {RolldownDtsTask} from '../types'\n\nexport interface RolldownConfig {\n inputOptions: InputOptions\n outputOptions: OutputOptions\n}\n\nexport function resolveRolldownConfig(\n ctx: BuildContext,\n buildTask: RolldownDtsTask,\n): RolldownConfig {\n const {format, runtime} = buildTask\n const {config, cwd, exports: _exports, external, distPath, logger, pkg, ts} = ctx\n const outputExt = extMap[pkg.type || 'commonjs'][format]\n const outDir = path.relative(cwd, distPath)\n\n const pathAliases = Object.fromEntries(\n Object.entries(ts.config?.options.paths || {}).map(([key, val]) => {\n return [key, path.resolve(cwd, ts.config?.options.baseUrl || '.', val[0]!)]\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 entryFileNames = `[name]${outputExt}`\n\n const inputOptions = {\n cwd,\n jsx: {\n mode:\n config?.jsx === 'automatic'\n ? 'automatic'\n : config?.jsx === 'preserve'\n ? 'preserve'\n : config?.jsx === 'transform'\n ? 'classic'\n : 'automatic',\n factory: config?.jsxFactory,\n fragment: config?.jsxFragment,\n importSource: config?.jsxImportSource,\n },\n define:\n pkg.name === '@sanity/pkg-utils'\n ? {...replacements}\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 platform:\n buildTask.type === 'rolldown:dts'\n ? 'node'\n : runtime === 'node'\n ? 'node'\n : runtime === 'browser'\n ? 'browser'\n : 'neutral',\n\n resolve: {\n alias: pathAliases,\n tsconfigFilename: ctx.ts.configPath || 'tsconfig.json',\n },\n experimental: {\n attachDebugInfo: 'full',\n },\n\n external: (id, importer) => {\n function scope() {\n if (\n buildTask.type === 'rolldown:dts' &&\n ctx.bundledPackages.length > 0 &&\n !id.startsWith('.') &&\n (id.includes('/node_modules/') || id.split('/').length < 3)\n ) {\n return (\n ctx.bundledPackages.some((name) => name === id || id.includes(`/${name}/`)) === false\n )\n }\n\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 return external.some((name) => name === id || id.includes(`/${name}/`))\n }\n const result = scope()\n logger.info(`external: (id: ${id}, importer: ${importer}) -> ${result}`)\n return result\n },\n\n input: entries.reduce<{[entryAlias: string]: string}>(\n (acc, entry) => Object.assign(acc, {[entry.name]: entry.source}),\n {},\n ),\n\n plugins: [\n dtsPlugin({\n emitDtsOnly: true,\n tsconfig: ctx.ts.configPath || 'tsconfig.json',\n tsgo:\n typeof pkg.devDependencies === 'object' &&\n '@typescript/native-preview' in pkg.devDependencies,\n // Enable the resolver by giving an allow list of packages to dig through node_modules.\n // If there are none that should be resolved, then this process is skipped and our build is faster.\n // If there's a match then it'll call the resolver function defined on `inputOptions.external`\n resolve: ctx.bundledPackages,\n // Always create dts from scratch, don't reuse contexts from previous builds\n newContext: true,\n }),\n ],\n\n treeshake: {\n moduleSideEffects: 'no-external',\n unknownGlobalSideEffects: false,\n annotations: true,\n },\n } satisfies InputOptions\n const outputOptions = {\n dir: outDir,\n entryFileNames,\n chunkFileNames:\n buildTask.type === 'rolldown:dts' ? `_chunks-dts/[name]${outputExt}` : undefined,\n esModule: true,\n format: buildTask.type === 'rolldown:dts' ? 'es' : format,\n sourcemap: buildTask.type === 'rolldown:dts' ? false : (config?.sourcemap ?? true),\n hoistTransitiveImports: false,\n /**\n * rolldown doesn't permit disabling chunks, we can only choose between automatic chunking (the default)\n * and manual chunking (using advancedChunks).\n * This matters for how we generate dts files.\n * While we use rolldown for dts generation, and rollup for the rest, we want to reduce the amount of dts files emitted as chunks,\n * and to make them predictable in how they're generated.\n */\n // @TODO the following breaks the dts generation, report bug to rolldown\n // advancedChunks:\n // buildTask.type === 'rolldown:dts'\n // ? {\n // groups: [\n // {\n // /**\n // * Groups all inlined typings specified by bundledPackages in extract.bundledPackages to its own chunk.\n // */\n // name: 'bundled-packages',\n // test: (id) => ctx.bundledPackages.includes(id),\n // priority: 1,\n // },\n // {\n // /**\n // * Put all other shared chunks into a single chunk.\n // */\n // name: 'shared',\n // minShareCount: 1,\n // },\n // ],\n // }\n // : {},\n } satisfies OutputOptions\n\n return {inputOptions, outputOptions}\n}\n"],"names":["extMap","path","dtsPlugin"],"mappings":";;;;;;AAYO,SAAS,sBACd,KACA,WACgB;AAChB,QAAM,EAAC,QAAQ,QAAA,IAAW,WACpB,EAAC,QAAQ,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AChE;AAAA,IACT;AAAA,IAEA,OAAO,QAAQ;AAAA,MACb,CAAC,KAAK,UAAU,OAAO,OAAO,KAAK,EAAC,CAAC,MAAM,IAAI,GAAG,MAAM,QAAO;AAAA,MAC/D,CAAA;AAAA,IAAC;AAAA,IAGH,SAAS;AAAA,MACPC,sBAAU;AAAA,QACR,aAAa;AAAA,QACb,UAAU,IAAI,GAAG,cAAc;AAAA,QAC/B,MACE,OAAO,IAAI,mBAAoB,YAC/B,gCAAgC,IAAI;AAAA;AAAA;AAAA;AAAA,QAItC,SAAS,IAAI;AAAA;AAAA,QAEb,YAAY;AAAA,MAAA,CACb;AAAA,IAAA;AAAA,IAGH,WAAW;AAAA,MACT,mBAAmB;AAAA,MACnB,0BAA0B;AAAA,MAC1B,aAAa;AAAA,IAAA;AAAA,EACf,GAEI,gBAAgB;AAAA,IACpB,KAAK;AAAA,IACL;AAAA,IACA,gBACE,UAAU,SAAS,iBAAiB,qBAAqB,SAAS,KAAK;AAAA,IACzE,UAAU;AAAA,IACV,QAAQ,UAAU,SAAS,iBAAiB,OAAO;AAAA,IACnD,WAAW,UAAU,SAAS,iBAAiB,KAAS,QAAQ,aAAa;AAAA,IAC7E,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAiC1B,SAAO,EAAC,cAAc,cAAA;AACxB;;"}
|
|
1
|
+
{"version":3,"file":"resolveRolldownConfig.cjs","sources":["../../src/node/tasks/rolldown/resolveRolldownConfig.ts"],"sourcesContent":["import path from 'node:path'\nimport type {InputOptions, OutputOptions} from 'rolldown'\nimport {dts as dtsPlugin} from 'rolldown-plugin-dts'\nimport type {BuildContext} from '../../core/contexts/buildContext'\nimport {pkgExtMap as extMap} from '../../core/pkg/pkgExt'\nimport type {RolldownDtsTask} from '../types'\n\nexport interface RolldownConfig {\n inputOptions: InputOptions\n outputOptions: OutputOptions\n}\n\nexport function resolveRolldownConfig(\n ctx: BuildContext,\n buildTask: RolldownDtsTask,\n): RolldownConfig {\n const {format, runtime} = buildTask\n const {config, cwd, exports: _exports, external, distPath, logger, pkg, ts} = ctx\n const outputExt = extMap[pkg.type || 'commonjs'][format]\n const outDir = path.relative(cwd, distPath)\n\n const pathAliases = Object.fromEntries(\n Object.entries(ts.config?.options.paths || {}).map(([key, val]) => {\n return [key, path.resolve(cwd, ts.config?.options.baseUrl || '.', val[0]!)]\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 entryFileNames = `[name]${outputExt}`\n\n const inputOptions = {\n cwd,\n jsx: {\n mode:\n config?.jsx === 'automatic'\n ? 'automatic'\n : config?.jsx === 'preserve'\n ? 'preserve'\n : config?.jsx === 'transform'\n ? 'classic'\n : 'automatic',\n factory: config?.jsxFactory,\n fragment: config?.jsxFragment,\n importSource: config?.jsxImportSource,\n },\n define:\n pkg.name === '@sanity/pkg-utils'\n ? {...replacements}\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 platform:\n buildTask.type === 'rolldown:dts'\n ? 'node'\n : runtime === 'node'\n ? 'node'\n : runtime === 'browser'\n ? 'browser'\n : 'neutral',\n\n resolve: {\n alias: pathAliases,\n tsconfigFilename: ctx.ts.configPath || 'tsconfig.json',\n },\n experimental: {\n attachDebugInfo: 'none',\n },\n\n external: (id, importer) => {\n if (\n buildTask.type === 'rolldown:dts' &&\n ctx.bundledPackages.length > 0 &&\n !id.startsWith('.') &&\n (id.includes('/node_modules/') || id.split('/').length < 3)\n ) {\n return ctx.bundledPackages.some((name) => name === id || id.includes(`/${name}/`)) === false\n }\n\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 return external.some((name) => name === id || id.includes(`/node_modules/${name}/`))\n },\n\n input: entries.reduce<{[entryAlias: string]: string}>(\n (acc, entry) => Object.assign(acc, {[entry.name]: entry.source}),\n {},\n ),\n\n plugins: [\n dtsPlugin({\n emitDtsOnly: true,\n tsconfig: ctx.ts.configPath || 'tsconfig.json',\n tsgo:\n typeof pkg.devDependencies === 'object' &&\n '@typescript/native-preview' in pkg.devDependencies,\n // Enable the resolver by giving an allow list of packages to dig through node_modules.\n // If there are none that should be resolved, then this process is skipped and our build is faster.\n // If there's a match then it'll call the resolver function defined on `inputOptions.external`\n resolve: ctx.bundledPackages,\n // Always create dts from scratch, don't reuse contexts from previous builds\n newContext: true,\n }),\n ],\n\n treeshake: {\n moduleSideEffects: 'no-external',\n unknownGlobalSideEffects: false,\n annotations: true,\n },\n } satisfies InputOptions\n const outputOptions = {\n dir: outDir,\n entryFileNames,\n chunkFileNames:\n buildTask.type === 'rolldown:dts' ? `_chunks-dts/[name]${outputExt}` : undefined,\n esModule: true,\n format: buildTask.type === 'rolldown:dts' ? 'es' : format,\n sourcemap: buildTask.type === 'rolldown:dts' ? false : (config?.sourcemap ?? true),\n hoistTransitiveImports: false,\n /**\n * rolldown doesn't permit disabling chunks, we can only choose between automatic chunking (the default)\n * and manual chunking (using advancedChunks).\n * This matters for how we generate dts files.\n * While we use rolldown for dts generation, and rollup for the rest, we want to reduce the amount of dts files emitted as chunks,\n * and to make them predictable in how they're generated.\n */\n // @TODO the following breaks the dts generation, report bug to rolldown\n // advancedChunks:\n // buildTask.type === 'rolldown:dts'\n // ? {\n // groups: [\n // {\n // /**\n // * Groups all inlined typings specified by bundledPackages in extract.bundledPackages to its own chunk.\n // */\n // name: 'bundled-packages',\n // test: (id) => ctx.bundledPackages.includes(id),\n // priority: 1,\n // },\n // {\n // /**\n // * Put all other shared chunks into a single chunk.\n // */\n // name: 'shared',\n // minShareCount: 1,\n // },\n // ],\n // }\n // : {},\n } satisfies OutputOptions\n\n return {inputOptions, outputOptions}\n}\n"],"names":["extMap","path","dtsPlugin"],"mappings":";;;;;;AAYO,SAAS,sBACd,KACA,WACgB;AAChB,QAAM,EAAC,QAAQ,QAAA,IAAW,WACpB,EAAC,QAAQ,KAAK,SAAS,UAAU,UAAU,UAAU,QAAQ,KAAK,GAAA,IAAM,KACxE,YAAYA,MAAAA,UAAO,IAAI,QAAQ,UAAU,EAAE,MAAM,GACjD,SAASC,cAAAA,QAAK,SAAS,KAAK,QAAQ,GAEpC,cAAc,OAAO;AAAA,IACzB,OAAO,QAAQ,GAAG,QAAQ,QAAQ,SAAS,CAAA,CAAE,EAAE,IAAI,CAAC,CAAC,KAAK,GAAG,MACpD,CAAC,KAAKA,sBAAK,QAAQ,KAAK,GAAG,QAAQ,QAAQ,WAAW,KAAK,IAAI,CAAC,CAAE,CAAC,CAC3E;AAAA,EAAA,GAGG,UAAU,UAAU,QAAQ,IAAI,CAAC,WAC9B;AAAA,IACL,GAAG;AAAA,IACH,MAAMA,cAAAA,QAAK,SAAS,QAAQ,MAAM,MAAM,EAAE,QAAQ,aAAa,EAAE;AAAA,EAAA,IAElE,CAAA,CAAE,GAEC,YACJ,YAAY,OAAO,KAAK,QAAQ,EAAE,IAAI,CAAC,eAAe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AAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAiC1B,SAAO,EAAC,cAAc,cAAA;AACxB;;"}
|
|
@@ -29,28 +29,24 @@ function resolveRolldownConfig(ctx, buildTask) {
|
|
|
29
29
|
tsconfigFilename: ctx.ts.configPath || "tsconfig.json"
|
|
30
30
|
},
|
|
31
31
|
experimental: {
|
|
32
|
-
attachDebugInfo: "
|
|
32
|
+
attachDebugInfo: "none"
|
|
33
33
|
},
|
|
34
34
|
external: (id, importer) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
), !0;
|
|
49
|
-
}
|
|
50
|
-
return external.some((name) => name === id || id.includes(`/${name}/`));
|
|
35
|
+
if (buildTask.type === "rolldown:dts" && ctx.bundledPackages.length > 0 && !id.startsWith(".") && (id.includes("/node_modules/") || id.split("/").length < 3))
|
|
36
|
+
return ctx.bundledPackages.some((name) => name === id || id.includes(`/${name}/`)) === !1;
|
|
37
|
+
if (exportIds?.includes(id))
|
|
38
|
+
return !0;
|
|
39
|
+
if (importer && (id.startsWith(".") || id.startsWith("/"))) {
|
|
40
|
+
const idPath = path.resolve(path.dirname(importer), id);
|
|
41
|
+
if (sourcePaths?.includes(idPath))
|
|
42
|
+
return logger.warn(
|
|
43
|
+
`detected self-referencing import \u2013 treating as external: ${path.relative(
|
|
44
|
+
cwd,
|
|
45
|
+
idPath
|
|
46
|
+
)}`
|
|
47
|
+
), !0;
|
|
51
48
|
}
|
|
52
|
-
|
|
53
|
-
return logger.info(`external: (id: ${id}, importer: ${importer}) -> ${result}`), result;
|
|
49
|
+
return external.some((name) => name === id || id.includes(`/node_modules/${name}/`));
|
|
54
50
|
},
|
|
55
51
|
input: entries.reduce(
|
|
56
52
|
(acc, entry) => Object.assign(acc, { [entry.name]: entry.source }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveRolldownConfig.js","sources":["../../src/node/tasks/rolldown/resolveRolldownConfig.ts"],"sourcesContent":["import path from 'node:path'\nimport type {InputOptions, OutputOptions} from 'rolldown'\nimport {dts as dtsPlugin} from 'rolldown-plugin-dts'\nimport type {BuildContext} from '../../core/contexts/buildContext'\nimport {pkgExtMap as extMap} from '../../core/pkg/pkgExt'\nimport type {RolldownDtsTask} from '../types'\n\nexport interface RolldownConfig {\n inputOptions: InputOptions\n outputOptions: OutputOptions\n}\n\nexport function resolveRolldownConfig(\n ctx: BuildContext,\n buildTask: RolldownDtsTask,\n): RolldownConfig {\n const {format, runtime} = buildTask\n const {config, cwd, exports: _exports, external, distPath, logger, pkg, ts} = ctx\n const outputExt = extMap[pkg.type || 'commonjs'][format]\n const outDir = path.relative(cwd, distPath)\n\n const pathAliases = Object.fromEntries(\n Object.entries(ts.config?.options.paths || {}).map(([key, val]) => {\n return [key, path.resolve(cwd, ts.config?.options.baseUrl || '.', val[0]!)]\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 entryFileNames = `[name]${outputExt}`\n\n const inputOptions = {\n cwd,\n jsx: {\n mode:\n config?.jsx === 'automatic'\n ? 'automatic'\n : config?.jsx === 'preserve'\n ? 'preserve'\n : config?.jsx === 'transform'\n ? 'classic'\n : 'automatic',\n factory: config?.jsxFactory,\n fragment: config?.jsxFragment,\n importSource: config?.jsxImportSource,\n },\n define:\n pkg.name === '@sanity/pkg-utils'\n ? {...replacements}\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 platform:\n buildTask.type === 'rolldown:dts'\n ? 'node'\n : runtime === 'node'\n ? 'node'\n : runtime === 'browser'\n ? 'browser'\n : 'neutral',\n\n resolve: {\n alias: pathAliases,\n tsconfigFilename: ctx.ts.configPath || 'tsconfig.json',\n },\n experimental: {\n attachDebugInfo: '
|
|
1
|
+
{"version":3,"file":"resolveRolldownConfig.js","sources":["../../src/node/tasks/rolldown/resolveRolldownConfig.ts"],"sourcesContent":["import path from 'node:path'\nimport type {InputOptions, OutputOptions} from 'rolldown'\nimport {dts as dtsPlugin} from 'rolldown-plugin-dts'\nimport type {BuildContext} from '../../core/contexts/buildContext'\nimport {pkgExtMap as extMap} from '../../core/pkg/pkgExt'\nimport type {RolldownDtsTask} from '../types'\n\nexport interface RolldownConfig {\n inputOptions: InputOptions\n outputOptions: OutputOptions\n}\n\nexport function resolveRolldownConfig(\n ctx: BuildContext,\n buildTask: RolldownDtsTask,\n): RolldownConfig {\n const {format, runtime} = buildTask\n const {config, cwd, exports: _exports, external, distPath, logger, pkg, ts} = ctx\n const outputExt = extMap[pkg.type || 'commonjs'][format]\n const outDir = path.relative(cwd, distPath)\n\n const pathAliases = Object.fromEntries(\n Object.entries(ts.config?.options.paths || {}).map(([key, val]) => {\n return [key, path.resolve(cwd, ts.config?.options.baseUrl || '.', val[0]!)]\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 entryFileNames = `[name]${outputExt}`\n\n const inputOptions = {\n cwd,\n jsx: {\n mode:\n config?.jsx === 'automatic'\n ? 'automatic'\n : config?.jsx === 'preserve'\n ? 'preserve'\n : config?.jsx === 'transform'\n ? 'classic'\n : 'automatic',\n factory: config?.jsxFactory,\n fragment: config?.jsxFragment,\n importSource: config?.jsxImportSource,\n },\n define:\n pkg.name === '@sanity/pkg-utils'\n ? {...replacements}\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 platform:\n buildTask.type === 'rolldown:dts'\n ? 'node'\n : runtime === 'node'\n ? 'node'\n : runtime === 'browser'\n ? 'browser'\n : 'neutral',\n\n resolve: {\n alias: pathAliases,\n tsconfigFilename: ctx.ts.configPath || 'tsconfig.json',\n },\n experimental: {\n attachDebugInfo: 'none',\n },\n\n external: (id, importer) => {\n if (\n buildTask.type === 'rolldown:dts' &&\n ctx.bundledPackages.length > 0 &&\n !id.startsWith('.') &&\n (id.includes('/node_modules/') || id.split('/').length < 3)\n ) {\n return ctx.bundledPackages.some((name) => name === id || id.includes(`/${name}/`)) === false\n }\n\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 return external.some((name) => name === id || id.includes(`/node_modules/${name}/`))\n },\n\n input: entries.reduce<{[entryAlias: string]: string}>(\n (acc, entry) => Object.assign(acc, {[entry.name]: entry.source}),\n {},\n ),\n\n plugins: [\n dtsPlugin({\n emitDtsOnly: true,\n tsconfig: ctx.ts.configPath || 'tsconfig.json',\n tsgo:\n typeof pkg.devDependencies === 'object' &&\n '@typescript/native-preview' in pkg.devDependencies,\n // Enable the resolver by giving an allow list of packages to dig through node_modules.\n // If there are none that should be resolved, then this process is skipped and our build is faster.\n // If there's a match then it'll call the resolver function defined on `inputOptions.external`\n resolve: ctx.bundledPackages,\n // Always create dts from scratch, don't reuse contexts from previous builds\n newContext: true,\n }),\n ],\n\n treeshake: {\n moduleSideEffects: 'no-external',\n unknownGlobalSideEffects: false,\n annotations: true,\n },\n } satisfies InputOptions\n const outputOptions = {\n dir: outDir,\n entryFileNames,\n chunkFileNames:\n buildTask.type === 'rolldown:dts' ? `_chunks-dts/[name]${outputExt}` : undefined,\n esModule: true,\n format: buildTask.type === 'rolldown:dts' ? 'es' : format,\n sourcemap: buildTask.type === 'rolldown:dts' ? false : (config?.sourcemap ?? true),\n hoistTransitiveImports: false,\n /**\n * rolldown doesn't permit disabling chunks, we can only choose between automatic chunking (the default)\n * and manual chunking (using advancedChunks).\n * This matters for how we generate dts files.\n * While we use rolldown for dts generation, and rollup for the rest, we want to reduce the amount of dts files emitted as chunks,\n * and to make them predictable in how they're generated.\n */\n // @TODO the following breaks the dts generation, report bug to rolldown\n // advancedChunks:\n // buildTask.type === 'rolldown:dts'\n // ? {\n // groups: [\n // {\n // /**\n // * Groups all inlined typings specified by bundledPackages in extract.bundledPackages to its own chunk.\n // */\n // name: 'bundled-packages',\n // test: (id) => ctx.bundledPackages.includes(id),\n // priority: 1,\n // },\n // {\n // /**\n // * Put all other shared chunks into a single chunk.\n // */\n // name: 'shared',\n // minShareCount: 1,\n // },\n // ],\n // }\n // : {},\n } satisfies OutputOptions\n\n return {inputOptions, outputOptions}\n}\n"],"names":["extMap","dtsPlugin"],"mappings":";;;AAYO,SAAS,sBACd,KACA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AAA,MAC/D,CAAA;AAAA,IAAC;AAAA,IAGH,SAAS;AAAA,MACPC,IAAU;AAAA,QACR,aAAa;AAAA,QACb,UAAU,IAAI,GAAG,cAAc;AAAA,QAC/B,MACE,OAAO,IAAI,mBAAoB,YAC/B,gCAAgC,IAAI;AAAA;AAAA;AAAA;AAAA,QAItC,SAAS,IAAI;AAAA;AAAA,QAEb,YAAY;AAAA,MAAA,CACb;AAAA,IAAA;AAAA,IAGH,WAAW;AAAA,MACT,mBAAmB;AAAA,MACnB,0BAA0B;AAAA,MAC1B,aAAa;AAAA,IAAA;AAAA,EACf,GAEI,gBAAgB;AAAA,IACpB,KAAK;AAAA,IACL;AAAA,IACA,gBACE,UAAU,SAAS,iBAAiB,qBAAqB,SAAS,KAAK;AAAA,IACzE,UAAU;AAAA,IACV,QAAQ,UAAU,SAAS,iBAAiB,OAAO;AAAA,IACnD,WAAW,UAAU,SAAS,iBAAiB,KAAS,QAAQ,aAAa;AAAA,IAC7E,wBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAiC1B,SAAO,EAAC,cAAc,cAAA;AACxB;"}
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cac } from "cac";
|
|
2
|
-
var version = "7.11.3
|
|
2
|
+
var version = "7.11.3";
|
|
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.cts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
//! User-defined Entry: [Entry-Module-Id: src/node/index.d.ts] [Name: Some("index.d")]
|
|
2
1
|
import { PluginItem } from "@babel/core";
|
|
3
2
|
import { OptimizeLodashOptions } from "@optimize-lodash/rollup-plugin";
|
|
4
3
|
import { Options } from "@vanilla-extract/rollup-plugin";
|
|
5
4
|
import { NormalizedOutputOptions, Plugin, Plugin as RollupPlugin, TreeshakingOptions } from "rollup";
|
|
6
5
|
import { IExtractorMessagesConfig } from "@microsoft/api-extractor";
|
|
7
|
-
|
|
8
|
-
//#region src/node/build.d.ts
|
|
9
|
-
|
|
10
6
|
/**
|
|
11
7
|
* Build the distribution files of a npm package.
|
|
12
8
|
*
|
|
@@ -34,16 +30,12 @@ declare function build(options: {
|
|
|
34
30
|
clean?: boolean;
|
|
35
31
|
quiet?: boolean;
|
|
36
32
|
}): Promise<void>;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/node/check.d.ts
|
|
39
33
|
/** @public */
|
|
40
34
|
declare function check(options: {
|
|
41
35
|
cwd: string;
|
|
42
36
|
strict?: boolean;
|
|
43
37
|
tsconfig?: string;
|
|
44
38
|
}): Promise<void>;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/node/strict.d.ts
|
|
47
39
|
type ToggleType = 'error' | 'warn' | 'off';
|
|
48
40
|
/**
|
|
49
41
|
* @public
|
|
@@ -91,8 +83,6 @@ interface StrictOptions {
|
|
|
91
83
|
}
|
|
92
84
|
/** @alpha */
|
|
93
85
|
declare function parseStrictOptions(input: unknown): StrictOptions;
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/node/core/config/types.d.ts
|
|
96
86
|
/** @public */
|
|
97
87
|
type PkgFormat = 'commonjs' | 'esm';
|
|
98
88
|
/** @public */
|
|
@@ -386,22 +376,14 @@ interface PkgConfigOptions {
|
|
|
386
376
|
*/
|
|
387
377
|
dts?: DtsType;
|
|
388
378
|
}
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region src/node/core/config/defineConfig.d.ts
|
|
391
379
|
/** @public */
|
|
392
380
|
declare function defineConfig<const T extends PkgConfigOptions>(configOptions: T): T;
|
|
393
|
-
//#endregion
|
|
394
|
-
//#region src/node/core/config/loadConfig.d.ts
|
|
395
381
|
/** @alpha */
|
|
396
382
|
declare function loadConfig(options: {
|
|
397
383
|
cwd: string;
|
|
398
384
|
}): Promise<PkgConfigOptions | undefined>;
|
|
399
|
-
//#endregion
|
|
400
|
-
//#region src/node/core/defaults.d.ts
|
|
401
385
|
/** @public */
|
|
402
386
|
declare const DEFAULT_BROWSERSLIST_QUERY: string[];
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region src/node/core/pkg/types.d.ts
|
|
405
387
|
/** @alpha */
|
|
406
388
|
interface PackageJSON {
|
|
407
389
|
type?: 'commonjs' | 'module' | undefined;
|
|
@@ -466,14 +448,10 @@ interface PackageJSON {
|
|
|
466
448
|
homepage?: string;
|
|
467
449
|
license?: string;
|
|
468
450
|
}
|
|
469
|
-
//#endregion
|
|
470
|
-
//#region src/node/core/pkg/loadPkg.d.ts
|
|
471
451
|
/** @internal */
|
|
472
452
|
declare function loadPkg(options: {
|
|
473
453
|
cwd: string;
|
|
474
454
|
}): Promise<PackageJSON>;
|
|
475
|
-
//#endregion
|
|
476
|
-
//#region src/node/logger.d.ts
|
|
477
455
|
/** @alpha */
|
|
478
456
|
interface Logger {
|
|
479
457
|
log: (...args: unknown[]) => void;
|
|
@@ -484,16 +462,12 @@ interface Logger {
|
|
|
484
462
|
}
|
|
485
463
|
/** @alpha */
|
|
486
464
|
declare function createLogger(quiet?: boolean): Logger;
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region src/node/core/pkg/loadPkgWithReporting.d.ts
|
|
489
465
|
/** @alpha */
|
|
490
466
|
declare function loadPkgWithReporting(options: {
|
|
491
467
|
cwd: string;
|
|
492
468
|
logger: Logger;
|
|
493
469
|
strict: boolean;
|
|
494
470
|
}): Promise<PackageJSON>;
|
|
495
|
-
//#endregion
|
|
496
|
-
//#region src/node/core/pkg/parseExports.d.ts
|
|
497
471
|
/** @alpha */
|
|
498
472
|
declare function parseExports(options: {
|
|
499
473
|
cwd: string;
|
|
@@ -504,8 +478,6 @@ declare function parseExports(options: {
|
|
|
504
478
|
}): (PkgExport & {
|
|
505
479
|
_path: string;
|
|
506
480
|
})[];
|
|
507
|
-
//#endregion
|
|
508
|
-
//#region src/node/core/template/types.d.ts
|
|
509
481
|
/** @public */
|
|
510
482
|
interface PkgTemplateFile {
|
|
511
483
|
name: string;
|
|
@@ -541,31 +513,22 @@ type PkgTemplateResolver = (options: {
|
|
|
541
513
|
}) => PkgTemplateDefinition | Promise<PkgTemplateDefinition>;
|
|
542
514
|
/** @public */
|
|
543
515
|
type PkgTemplate = PkgTemplateDefinition | PkgTemplateResolver;
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region src/node/core/template/define.d.ts
|
|
546
516
|
/** @public */
|
|
547
517
|
declare function defineTemplateOption<T>(option: PkgTemplateOption<T>): PkgTemplateOption<T>;
|
|
548
|
-
//#endregion
|
|
549
|
-
//#region src/node/init.d.ts
|
|
550
518
|
/** @public */
|
|
551
519
|
declare function init(options: {
|
|
552
520
|
cwd: string;
|
|
553
521
|
path: string;
|
|
554
522
|
}): Promise<void>;
|
|
555
|
-
//#endregion
|
|
556
|
-
//#region src/node/tasks/dts/getExtractMessagesConfig.d.ts
|
|
557
523
|
/** @alpha */
|
|
558
524
|
declare function getExtractMessagesConfig(options: {
|
|
559
525
|
rules: NonNullable<PkgConfigOptions['extract']>['rules'];
|
|
560
526
|
disabled?: boolean;
|
|
561
527
|
}): IExtractorMessagesConfig;
|
|
562
|
-
//#endregion
|
|
563
|
-
//#region src/node/watch.d.ts
|
|
564
528
|
/** @public */
|
|
565
529
|
declare function watch(options: {
|
|
566
530
|
cwd: string;
|
|
567
531
|
strict?: boolean;
|
|
568
532
|
tsconfig?: string;
|
|
569
533
|
}): Promise<void>;
|
|
570
|
-
//#endregion
|
|
571
534
|
export { DEFAULT_BROWSERSLIST_QUERY, PackageJSON, type PkgBundle, type PkgConfigOptions, type PkgConfigProperty, type PkgConfigPropertyResolver, type PkgExport, type PkgExports, type PkgFormat, type PkgRuleLevel, type PkgRuntime, type PkgTemplate, type PkgTemplateDefinition, type PkgTemplateFile, type PkgTemplateOption, type PkgTemplateResolver, type PkgTemplateStringOption, type ReactCompilerLogger, type ReactCompilerLoggerEvent, type ReactCompilerOptions, type RollupPlugin, type TSDocCustomTag, build, check, createLogger, defineConfig, defineTemplateOption, getExtractMessagesConfig, init, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions, watch };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
//! User-defined Entry: [Entry-Module-Id: src/node/index.d.ts] [Name: Some("index.d")]
|
|
2
1
|
import { PluginItem } from "@babel/core";
|
|
3
2
|
import { OptimizeLodashOptions } from "@optimize-lodash/rollup-plugin";
|
|
4
3
|
import { Options } from "@vanilla-extract/rollup-plugin";
|
|
5
4
|
import { NormalizedOutputOptions, Plugin, Plugin as RollupPlugin, TreeshakingOptions } from "rollup";
|
|
6
5
|
import { IExtractorMessagesConfig } from "@microsoft/api-extractor";
|
|
7
|
-
|
|
8
|
-
//#region src/node/build.d.ts
|
|
9
|
-
|
|
10
6
|
/**
|
|
11
7
|
* Build the distribution files of a npm package.
|
|
12
8
|
*
|
|
@@ -34,16 +30,12 @@ declare function build(options: {
|
|
|
34
30
|
clean?: boolean;
|
|
35
31
|
quiet?: boolean;
|
|
36
32
|
}): Promise<void>;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/node/check.d.ts
|
|
39
33
|
/** @public */
|
|
40
34
|
declare function check(options: {
|
|
41
35
|
cwd: string;
|
|
42
36
|
strict?: boolean;
|
|
43
37
|
tsconfig?: string;
|
|
44
38
|
}): Promise<void>;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/node/strict.d.ts
|
|
47
39
|
type ToggleType = 'error' | 'warn' | 'off';
|
|
48
40
|
/**
|
|
49
41
|
* @public
|
|
@@ -91,8 +83,6 @@ interface StrictOptions {
|
|
|
91
83
|
}
|
|
92
84
|
/** @alpha */
|
|
93
85
|
declare function parseStrictOptions(input: unknown): StrictOptions;
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/node/core/config/types.d.ts
|
|
96
86
|
/** @public */
|
|
97
87
|
type PkgFormat = 'commonjs' | 'esm';
|
|
98
88
|
/** @public */
|
|
@@ -386,22 +376,14 @@ interface PkgConfigOptions {
|
|
|
386
376
|
*/
|
|
387
377
|
dts?: DtsType;
|
|
388
378
|
}
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region src/node/core/config/defineConfig.d.ts
|
|
391
379
|
/** @public */
|
|
392
380
|
declare function defineConfig<const T extends PkgConfigOptions>(configOptions: T): T;
|
|
393
|
-
//#endregion
|
|
394
|
-
//#region src/node/core/config/loadConfig.d.ts
|
|
395
381
|
/** @alpha */
|
|
396
382
|
declare function loadConfig(options: {
|
|
397
383
|
cwd: string;
|
|
398
384
|
}): Promise<PkgConfigOptions | undefined>;
|
|
399
|
-
//#endregion
|
|
400
|
-
//#region src/node/core/defaults.d.ts
|
|
401
385
|
/** @public */
|
|
402
386
|
declare const DEFAULT_BROWSERSLIST_QUERY: string[];
|
|
403
|
-
//#endregion
|
|
404
|
-
//#region src/node/core/pkg/types.d.ts
|
|
405
387
|
/** @alpha */
|
|
406
388
|
interface PackageJSON {
|
|
407
389
|
type?: 'commonjs' | 'module' | undefined;
|
|
@@ -466,14 +448,10 @@ interface PackageJSON {
|
|
|
466
448
|
homepage?: string;
|
|
467
449
|
license?: string;
|
|
468
450
|
}
|
|
469
|
-
//#endregion
|
|
470
|
-
//#region src/node/core/pkg/loadPkg.d.ts
|
|
471
451
|
/** @internal */
|
|
472
452
|
declare function loadPkg(options: {
|
|
473
453
|
cwd: string;
|
|
474
454
|
}): Promise<PackageJSON>;
|
|
475
|
-
//#endregion
|
|
476
|
-
//#region src/node/logger.d.ts
|
|
477
455
|
/** @alpha */
|
|
478
456
|
interface Logger {
|
|
479
457
|
log: (...args: unknown[]) => void;
|
|
@@ -484,16 +462,12 @@ interface Logger {
|
|
|
484
462
|
}
|
|
485
463
|
/** @alpha */
|
|
486
464
|
declare function createLogger(quiet?: boolean): Logger;
|
|
487
|
-
//#endregion
|
|
488
|
-
//#region src/node/core/pkg/loadPkgWithReporting.d.ts
|
|
489
465
|
/** @alpha */
|
|
490
466
|
declare function loadPkgWithReporting(options: {
|
|
491
467
|
cwd: string;
|
|
492
468
|
logger: Logger;
|
|
493
469
|
strict: boolean;
|
|
494
470
|
}): Promise<PackageJSON>;
|
|
495
|
-
//#endregion
|
|
496
|
-
//#region src/node/core/pkg/parseExports.d.ts
|
|
497
471
|
/** @alpha */
|
|
498
472
|
declare function parseExports(options: {
|
|
499
473
|
cwd: string;
|
|
@@ -504,8 +478,6 @@ declare function parseExports(options: {
|
|
|
504
478
|
}): (PkgExport & {
|
|
505
479
|
_path: string;
|
|
506
480
|
})[];
|
|
507
|
-
//#endregion
|
|
508
|
-
//#region src/node/core/template/types.d.ts
|
|
509
481
|
/** @public */
|
|
510
482
|
interface PkgTemplateFile {
|
|
511
483
|
name: string;
|
|
@@ -541,31 +513,22 @@ type PkgTemplateResolver = (options: {
|
|
|
541
513
|
}) => PkgTemplateDefinition | Promise<PkgTemplateDefinition>;
|
|
542
514
|
/** @public */
|
|
543
515
|
type PkgTemplate = PkgTemplateDefinition | PkgTemplateResolver;
|
|
544
|
-
//#endregion
|
|
545
|
-
//#region src/node/core/template/define.d.ts
|
|
546
516
|
/** @public */
|
|
547
517
|
declare function defineTemplateOption<T>(option: PkgTemplateOption<T>): PkgTemplateOption<T>;
|
|
548
|
-
//#endregion
|
|
549
|
-
//#region src/node/init.d.ts
|
|
550
518
|
/** @public */
|
|
551
519
|
declare function init(options: {
|
|
552
520
|
cwd: string;
|
|
553
521
|
path: string;
|
|
554
522
|
}): Promise<void>;
|
|
555
|
-
//#endregion
|
|
556
|
-
//#region src/node/tasks/dts/getExtractMessagesConfig.d.ts
|
|
557
523
|
/** @alpha */
|
|
558
524
|
declare function getExtractMessagesConfig(options: {
|
|
559
525
|
rules: NonNullable<PkgConfigOptions['extract']>['rules'];
|
|
560
526
|
disabled?: boolean;
|
|
561
527
|
}): IExtractorMessagesConfig;
|
|
562
|
-
//#endregion
|
|
563
|
-
//#region src/node/watch.d.ts
|
|
564
528
|
/** @public */
|
|
565
529
|
declare function watch(options: {
|
|
566
530
|
cwd: string;
|
|
567
531
|
strict?: boolean;
|
|
568
532
|
tsconfig?: string;
|
|
569
533
|
}): Promise<void>;
|
|
570
|
-
//#endregion
|
|
571
534
|
export { DEFAULT_BROWSERSLIST_QUERY, PackageJSON, type PkgBundle, type PkgConfigOptions, type PkgConfigProperty, type PkgConfigPropertyResolver, type PkgExport, type PkgExports, type PkgFormat, type PkgRuleLevel, type PkgRuntime, type PkgTemplate, type PkgTemplateDefinition, type PkgTemplateFile, type PkgTemplateOption, type PkgTemplateResolver, type PkgTemplateStringOption, type ReactCompilerLogger, type ReactCompilerLoggerEvent, type ReactCompilerOptions, type RollupPlugin, type TSDocCustomTag, build, check, createLogger, defineConfig, defineTemplateOption, getExtractMessagesConfig, init, loadConfig, loadPkg, loadPkgWithReporting, parseExports, parseStrictOptions, watch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "7.11.3
|
|
3
|
+
"version": "7.11.3",
|
|
4
4
|
"description": "Simple utilities for modern npm packages.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"devDependencies": {
|
|
117
117
|
"@commitlint/cli": "^19.8.1",
|
|
118
118
|
"@commitlint/config-conventional": "^19.8.1",
|
|
119
|
-
"@ianvs/prettier-plugin-sort-imports": "^4.
|
|
119
|
+
"@ianvs/prettier-plugin-sort-imports": "^4.6.0",
|
|
120
120
|
"@sanity/prettier-config": "^1.0.6",
|
|
121
121
|
"@types/babel__core": "^7.20.5",
|
|
122
122
|
"@types/find-config": "^1.0.4",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"tsx": "^4.20.3",
|
|
143
143
|
"typescript": "5.9.2",
|
|
144
144
|
"vitest": "^3.2.4",
|
|
145
|
-
"@sanity/pkg-utils": "7.11.3
|
|
145
|
+
"@sanity/pkg-utils": "7.11.3"
|
|
146
146
|
},
|
|
147
147
|
"peerDependencies": {
|
|
148
148
|
"babel-plugin-react-compiler": "*",
|