@sanity/pkg-utils 9.2.3 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-es/buildAction.js +147 -2
- package/dist/_chunks-es/buildAction.js.map +1 -1
- package/dist/_chunks-es/checkAction.js +179 -2
- package/dist/_chunks-es/checkAction.js.map +1 -1
- package/dist/_chunks-es/createApiExtractorConfig.js +52 -0
- package/dist/_chunks-es/createApiExtractorConfig.js.map +1 -0
- package/dist/_chunks-es/createTSDocConfig.js +31 -0
- package/dist/_chunks-es/createTSDocConfig.js.map +1 -0
- package/dist/_chunks-es/defaults.js +39 -0
- package/dist/_chunks-es/defaults.js.map +1 -0
- package/dist/_chunks-es/define.js +7 -0
- package/dist/_chunks-es/define.js.map +1 -0
- package/dist/_chunks-es/fileExists.js +12 -0
- package/dist/_chunks-es/fileExists.js.map +1 -0
- package/dist/_chunks-es/getExtractMessagesConfig.js +83 -0
- package/dist/_chunks-es/getExtractMessagesConfig.js.map +1 -0
- package/dist/_chunks-es/handleError.js +25 -1
- package/dist/_chunks-es/handleError.js.map +1 -1
- package/dist/_chunks-es/index.js +8 -212
- package/dist/_chunks-es/index.js.map +1 -1
- package/dist/_chunks-es/initAction.js +515 -2
- package/dist/_chunks-es/initAction.js.map +1 -1
- package/dist/_chunks-es/printExtractMessages.js +44 -0
- package/dist/_chunks-es/printExtractMessages.js.map +1 -0
- package/dist/_chunks-es/{consoleSpy.js → resolveBuildContext.js} +68 -95
- package/dist/_chunks-es/resolveBuildContext.js.map +1 -0
- package/dist/_chunks-es/resolveRolldownConfig.js +1 -1
- package/dist/_chunks-es/watchAction.js +106 -2
- package/dist/_chunks-es/watchAction.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -183
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -18
- package/dist/index.js.map +1 -1
- package/package.json +3 -10
- package/dist/_chunks-es/build.js +0 -150
- package/dist/_chunks-es/build.js.map +0 -1
- package/dist/_chunks-es/check.js +0 -189
- package/dist/_chunks-es/check.js.map +0 -1
- package/dist/_chunks-es/consoleSpy.js.map +0 -1
- package/dist/_chunks-es/init.js +0 -520
- package/dist/_chunks-es/init.js.map +0 -1
- package/dist/_chunks-es/isRecord.js +0 -37
- package/dist/_chunks-es/isRecord.js.map +0 -1
- package/dist/_chunks-es/watch.js +0 -109
- package/dist/_chunks-es/watch.js.map +0 -1
- package/tsconfig/isolated-declarations.json +0 -11
- package/tsconfig/recommended.json +0 -24
- package/tsconfig/strict.json +0 -15
- package/tsconfig/strictest.json +0 -16
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
import path, { resolve } from "node:path";
|
|
2
|
-
import { pathToFileURL } from "node:url";
|
|
3
|
-
import { packageUp } from "package-up";
|
|
4
|
-
import { tsImport } from "tsx/esm/api";
|
|
5
|
-
import findConfig from "find-config";
|
|
6
|
-
import { fileExists, isRecord } from "./isRecord.js";
|
|
7
1
|
import chalk from "chalk";
|
|
8
2
|
import { z, ZodError } from "zod/v3";
|
|
9
3
|
import fs from "node:fs/promises";
|
|
4
|
+
import { packageUp } from "package-up";
|
|
5
|
+
import path, { resolve } from "node:path";
|
|
10
6
|
import browserslist from "browserslist";
|
|
11
|
-
import
|
|
7
|
+
import { DEFAULT_BROWSERSLIST_QUERY } from "./defaults.js";
|
|
12
8
|
import { existsSync } from "node:fs";
|
|
9
|
+
import { isRecord } from "./handleError.js";
|
|
13
10
|
import ts from "typescript";
|
|
14
11
|
import { errorMap } from "zod-validation-error/v3";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const configPath = path.resolve(pkgPath, fileName);
|
|
28
|
-
if (fileExists(configPath))
|
|
29
|
-
return configPath;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async function loadConfig(options) {
|
|
33
|
-
const { cwd } = options, pkgPath = await packageUp({ cwd });
|
|
34
|
-
if (!pkgPath) return;
|
|
35
|
-
const root = path.dirname(pkgPath), configFile = findConfigFile(root);
|
|
36
|
-
if (!configFile || !configFile.startsWith(cwd))
|
|
37
|
-
return;
|
|
38
|
-
const mod = await tsImport(pathToFileURL(configFile).toString(), import.meta.url);
|
|
39
|
-
return mod?.default || mod || void 0;
|
|
12
|
+
function createConsoleSpy(options) {
|
|
13
|
+
const { onRestored } = options || {}, original = {
|
|
14
|
+
log: console.log,
|
|
15
|
+
warn: console.warn,
|
|
16
|
+
error: console.error
|
|
17
|
+
}, messages = [];
|
|
18
|
+
return console.log = (...args) => messages.push({ type: "log", args }), console.warn = (...args) => messages.push({ type: "warn", args }), console.error = (...args) => messages.push({ type: "error", args }), {
|
|
19
|
+
messages,
|
|
20
|
+
restore: () => {
|
|
21
|
+
console.log = original.log, console.warn = original.warn, console.error = original.error, onRestored?.(messages);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
40
24
|
}
|
|
41
25
|
function assertLast(a, arr) {
|
|
42
26
|
const aIdx = arr.indexOf(a);
|
|
@@ -46,7 +30,29 @@ function assertOrder(a, b, arr) {
|
|
|
46
30
|
const aIdx = arr.indexOf(a), bIdx = arr.indexOf(b);
|
|
47
31
|
return aIdx === -1 || bIdx === -1 ? !0 : aIdx < bIdx;
|
|
48
32
|
}
|
|
49
|
-
const
|
|
33
|
+
const exportEntrySchema = z.object({
|
|
34
|
+
types: z.optional(z.string()),
|
|
35
|
+
source: z.optional(z.string()),
|
|
36
|
+
browser: z.optional(
|
|
37
|
+
z.object({
|
|
38
|
+
source: z.string(),
|
|
39
|
+
import: z.optional(z.string()),
|
|
40
|
+
require: z.optional(z.string())
|
|
41
|
+
})
|
|
42
|
+
),
|
|
43
|
+
node: z.optional(
|
|
44
|
+
z.object({
|
|
45
|
+
source: z.optional(z.string()),
|
|
46
|
+
import: z.optional(z.string()),
|
|
47
|
+
require: z.optional(z.string())
|
|
48
|
+
})
|
|
49
|
+
),
|
|
50
|
+
import: z.optional(z.string()),
|
|
51
|
+
require: z.optional(z.string()),
|
|
52
|
+
default: z.optional(z.string())
|
|
53
|
+
}).refine((data) => data.default || data.import || data.require, {
|
|
54
|
+
message: 'Export must have either "default", "import", or "require" field'
|
|
55
|
+
}), basePkgSchema = z.object({
|
|
50
56
|
type: z.optional(z.enum(["commonjs", "module"])),
|
|
51
57
|
name: z.string(),
|
|
52
58
|
version: z.string(),
|
|
@@ -67,27 +73,7 @@ const pkgSchema = z.object({
|
|
|
67
73
|
(val) => typeof val == "string" && /^\.\/.*\.json$/.test(val)
|
|
68
74
|
),
|
|
69
75
|
z.custom((val) => typeof val == "string" && /^\.\/.*\.css$/.test(val)),
|
|
70
|
-
|
|
71
|
-
types: z.optional(z.string()),
|
|
72
|
-
source: z.optional(z.string()),
|
|
73
|
-
browser: z.optional(
|
|
74
|
-
z.object({
|
|
75
|
-
source: z.string(),
|
|
76
|
-
import: z.optional(z.string()),
|
|
77
|
-
require: z.optional(z.string())
|
|
78
|
-
})
|
|
79
|
-
),
|
|
80
|
-
node: z.optional(
|
|
81
|
-
z.object({
|
|
82
|
-
source: z.optional(z.string()),
|
|
83
|
-
import: z.optional(z.string()),
|
|
84
|
-
require: z.optional(z.string())
|
|
85
|
-
})
|
|
86
|
-
),
|
|
87
|
-
import: z.optional(z.string()),
|
|
88
|
-
require: z.optional(z.string()),
|
|
89
|
-
default: z.string()
|
|
90
|
-
}),
|
|
76
|
+
exportEntrySchema,
|
|
91
77
|
z.object({
|
|
92
78
|
types: z.optional(z.string()),
|
|
93
79
|
svelte: z.string(),
|
|
@@ -100,8 +86,24 @@ const pkgSchema = z.object({
|
|
|
100
86
|
sideEffects: z.optional(z.union([z.boolean(), z.array(z.string())])),
|
|
101
87
|
// @TODO type this properly
|
|
102
88
|
typesVersions: z.optional(z.any())
|
|
89
|
+
}), pkgSchema = basePkgSchema.transform((pkg) => {
|
|
90
|
+
if (!pkg.exports) return pkg;
|
|
91
|
+
const isModule = pkg.type === "module", transformedExports = {};
|
|
92
|
+
for (const [key, value] of Object.entries(pkg.exports))
|
|
93
|
+
if (typeof value == "string")
|
|
94
|
+
transformedExports[key] = value;
|
|
95
|
+
else if ("svelte" in value)
|
|
96
|
+
transformedExports[key] = value;
|
|
97
|
+
else {
|
|
98
|
+
const computedDefault = isModule ? value.import ?? value.require : value.require ?? value.import;
|
|
99
|
+
transformedExports[key] = {
|
|
100
|
+
...value,
|
|
101
|
+
default: value.default ?? computedDefault
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
return { ...pkg, exports: transformedExports };
|
|
103
105
|
}), typoMap = /* @__PURE__ */ new Map();
|
|
104
|
-
for (const key of
|
|
106
|
+
for (const key of basePkgSchema.keyof()._def.values)
|
|
105
107
|
typoMap.set(key.toUpperCase(), key);
|
|
106
108
|
function validatePkg(input) {
|
|
107
109
|
const pkg = pkgSchema.parse(input), invalidKey = Object.keys(input).find((key) => {
|
|
@@ -137,14 +139,6 @@ async function loadPkgWithReporting(options) {
|
|
|
137
139
|
const msg = 'package.json: `type` field is missing. Future versions of pkg-utils will require `"type": "module"`. Consider adding `"type": "module"` to prepare for this change.';
|
|
138
140
|
strictOptions2.preferModuleType === "error" ? (shouldError = !0, logger.error(msg)) : logger.warn(msg);
|
|
139
141
|
}
|
|
140
|
-
if (strictOptions2.noPackageJsonMain !== "off" && pkg.main) {
|
|
141
|
-
const msg = "package.json: the `main` field is no longer needed. All modern versions of Node.js and bundlers support the `exports` field. Remove the `main` field and use `exports` instead.";
|
|
142
|
-
strictOptions2.noPackageJsonMain === "error" ? (shouldError = !0, logger.error(msg)) : logger.warn(msg);
|
|
143
|
-
}
|
|
144
|
-
if (strictOptions2.noPackageJsonModule !== "off" && pkg.module) {
|
|
145
|
-
const msg = "package.json: the `module` field is no longer needed. All modern versions of Node.js and bundlers support the `exports` field. Remove the `module` field and use `exports` instead.";
|
|
146
|
-
strictOptions2.noPackageJsonModule === "error" ? (shouldError = !0, logger.error(msg)) : logger.warn(msg);
|
|
147
|
-
}
|
|
148
142
|
if (strictOptions2.noPackageJsonBrowser !== "off" && pkg.browser) {
|
|
149
143
|
const msg = "package.json: the `browser` field is no longer needed. Use the `browser` condition in `exports` instead for better support across modern bundlers.";
|
|
150
144
|
strictOptions2.noPackageJsonBrowser === "error" ? (shouldError = !0, logger.error(msg)) : logger.warn(msg);
|
|
@@ -235,7 +229,6 @@ function isPkgConfigPropertyResolver(prop) {
|
|
|
235
229
|
function resolveConfigProperty(prop, initialValue) {
|
|
236
230
|
return prop ? isPkgConfigPropertyResolver(prop) ? prop(initialValue) : prop : initialValue;
|
|
237
231
|
}
|
|
238
|
-
const DEFAULT_BROWSERSLIST_QUERY = config;
|
|
239
232
|
function pathContains(containerPath, itemPath) {
|
|
240
233
|
return !path.relative(containerPath, itemPath).startsWith("..");
|
|
241
234
|
}
|
|
@@ -433,8 +426,6 @@ const toggle = z.union([z.literal("error"), z.literal("warn"), z.literal("off")]
|
|
|
433
426
|
alwaysPackageJsonTypes: toggle.default("error"),
|
|
434
427
|
alwaysPackageJsonFiles: toggle.default("error"),
|
|
435
428
|
noCheckTypes: toggle.default("warn"),
|
|
436
|
-
noPackageJsonMain: toggle.default("warn"),
|
|
437
|
-
noPackageJsonModule: toggle.default("warn"),
|
|
438
429
|
noPackageJsonBrowser: toggle.default("warn"),
|
|
439
430
|
noPackageJsonTypesVersions: toggle.default("warn"),
|
|
440
431
|
preferModuleType: toggle.default("warn")
|
|
@@ -453,15 +444,15 @@ function isTruthy(value) {
|
|
|
453
444
|
}
|
|
454
445
|
async function resolveBuildContext(options) {
|
|
455
446
|
const {
|
|
456
|
-
config
|
|
447
|
+
config,
|
|
457
448
|
cwd,
|
|
458
449
|
emitDeclarationOnly = !1,
|
|
459
450
|
logger,
|
|
460
451
|
pkg,
|
|
461
452
|
strict: strict2,
|
|
462
453
|
tsconfig: tsconfigPath
|
|
463
|
-
} = options, tsconfig = await loadTSConfig({ cwd, tsconfigPath }), strictOptions2 = parseStrictOptions(
|
|
464
|
-
if (strictOptions2.noCheckTypes !== "off" && tsconfig?.options &&
|
|
454
|
+
} = options, tsconfig = await loadTSConfig({ cwd, tsconfigPath }), strictOptions2 = parseStrictOptions(config?.strictOptions ?? {});
|
|
455
|
+
if (strictOptions2.noCheckTypes !== "off" && tsconfig?.options && config?.dts !== "rolldown" && tsconfig.options.noCheck !== !1 && !tsconfig.options.noCheck) {
|
|
465
456
|
if (strictOptions2.noCheckTypes === "error")
|
|
466
457
|
throw new Error(
|
|
467
458
|
"`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."
|
|
@@ -508,13 +499,13 @@ async function resolveBuildContext(options) {
|
|
|
508
499
|
}).reduce(
|
|
509
500
|
(acc, { _path: exportPath, ...exportEntry }) => Object.assign(acc, { [exportPath]: exportEntry }),
|
|
510
501
|
{}
|
|
511
|
-
), exports$1 = resolveConfigProperty(
|
|
502
|
+
), exports$1 = resolveConfigProperty(config?.exports, parsedExports), parsedExternal = [
|
|
512
503
|
...pkg.dependencies ? Object.keys(pkg.dependencies) : [],
|
|
513
504
|
...pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []
|
|
514
|
-
], external =
|
|
505
|
+
], external = config && Array.isArray(config.external) ? [...parsedExternal, ...config.external] : resolveConfigProperty(config?.external, parsedExternal), externalWithTypes = /* @__PURE__ */ new Set([pkg.name, ...external, ...external.map(transformPackageName)]), bundledDependencies = (pkg.devDependencies ? Object.keys(pkg.devDependencies) : []).filter(
|
|
515
506
|
// Do not bundle anything that is marked as external
|
|
516
507
|
(_) => !externalWithTypes.has(_)
|
|
517
|
-
), bundledPackages =
|
|
508
|
+
), bundledPackages = config && Array.isArray(config.extract?.bundledPackages) ? [...bundledDependencies, ...config.extract.bundledPackages] : resolveConfigProperty(config?.extract?.bundledPackages, bundledDependencies), outputPaths = Object.values(exports$1).flatMap((exportEntry) => [
|
|
518
509
|
exportEntry.import,
|
|
519
510
|
exportEntry.require,
|
|
520
511
|
exportEntry.browser?.import,
|
|
@@ -528,14 +519,14 @@ async function resolveBuildContext(options) {
|
|
|
528
519
|
);
|
|
529
520
|
if (commonDistPath && !pathContains(cwd, commonDistPath))
|
|
530
521
|
throw new Error("all output files must be located within the package");
|
|
531
|
-
const configDistPath =
|
|
522
|
+
const configDistPath = config?.dist ? path.resolve(cwd, config.dist) : void 0;
|
|
532
523
|
if (configDistPath && commonDistPath && configDistPath !== commonDistPath && !pathContains(configDistPath, commonDistPath))
|
|
533
524
|
throw logger.log(`did you mean to configure \`dist: './${path.relative(cwd, commonDistPath)}'\`?`), new Error("all output files must be located with the configured `dist` path");
|
|
534
525
|
const distPath = configDistPath || commonDistPath;
|
|
535
526
|
if (!distPath)
|
|
536
527
|
throw new Error("could not detect `dist` path");
|
|
537
528
|
return {
|
|
538
|
-
config
|
|
529
|
+
config,
|
|
539
530
|
cwd,
|
|
540
531
|
distPath,
|
|
541
532
|
emitDeclarationOnly,
|
|
@@ -545,14 +536,14 @@ async function resolveBuildContext(options) {
|
|
|
545
536
|
files: [],
|
|
546
537
|
logger,
|
|
547
538
|
pkg,
|
|
548
|
-
runtime:
|
|
539
|
+
runtime: config?.runtime ?? "*",
|
|
549
540
|
strict: strict2,
|
|
550
541
|
target,
|
|
551
542
|
ts: {
|
|
552
543
|
config: tsconfig,
|
|
553
544
|
configPath: tsconfigPath
|
|
554
545
|
},
|
|
555
|
-
dts:
|
|
546
|
+
dts: config?.dts === "rolldown" ? "rolldown" : "api-extractor"
|
|
556
547
|
};
|
|
557
548
|
}
|
|
558
549
|
function transformPackageName(packageName) {
|
|
@@ -564,31 +555,13 @@ function transformPackageName(packageName) {
|
|
|
564
555
|
} else
|
|
565
556
|
return `@types/${packageName}`;
|
|
566
557
|
}
|
|
567
|
-
function createConsoleSpy(options) {
|
|
568
|
-
const { onRestored } = options || {}, original = {
|
|
569
|
-
log: console.log,
|
|
570
|
-
warn: console.warn,
|
|
571
|
-
error: console.error
|
|
572
|
-
}, messages = [];
|
|
573
|
-
return console.log = (...args) => messages.push({ type: "log", args }), console.warn = (...args) => messages.push({ type: "warn", args }), console.error = (...args) => messages.push({ type: "error", args }), {
|
|
574
|
-
messages,
|
|
575
|
-
restore: () => {
|
|
576
|
-
console.log = original.log, console.warn = original.warn, console.error = original.error, onRestored?.(messages);
|
|
577
|
-
}
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
558
|
export {
|
|
581
|
-
DEFAULT_BROWSERSLIST_QUERY,
|
|
582
559
|
createConsoleSpy,
|
|
583
560
|
getTargetPaths,
|
|
584
|
-
loadConfig,
|
|
585
|
-
loadPkg,
|
|
586
561
|
loadPkgWithReporting,
|
|
587
|
-
parseExports,
|
|
588
|
-
parseStrictOptions,
|
|
589
562
|
pkgExtMap,
|
|
590
563
|
resolveBuildContext,
|
|
591
564
|
resolveConfigProperty,
|
|
592
565
|
strict
|
|
593
566
|
};
|
|
594
|
-
//# sourceMappingURL=
|
|
567
|
+
//# sourceMappingURL=resolveBuildContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveBuildContext.js","sources":["../../src/node/consoleSpy.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.0/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/parseExports.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","/** @internal */\nexport function assertFirst<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 === 0\n}\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 {z} from 'zod/v3'\nimport type {PackageJSON} from './types.ts'\n\nconst exportEntrySchema = z\n .object({\n types: z.optional(z.string()),\n source: z.optional(z.string()),\n browser: z.optional(\n z.object({\n source: z.string(),\n import: z.optional(z.string()),\n require: z.optional(z.string()),\n }),\n ),\n node: z.optional(\n z.object({\n source: z.optional(z.string()),\n import: z.optional(z.string()),\n require: z.optional(z.string()),\n }),\n ),\n import: z.optional(z.string()),\n require: z.optional(z.string()),\n default: z.optional(z.string()),\n })\n .refine((data) => data.default || data.import || data.require, {\n message: 'Export must have either \"default\", \"import\", or \"require\" field',\n })\n\nconst basePkgSchema = z.object({\n type: z.optional(z.enum(['commonjs', 'module'])),\n name: z.string(),\n version: z.string(),\n license: z.string(),\n bin: z.optional(z.record(z.string())),\n dependencies: z.optional(z.record(z.string())),\n devDependencies: z.optional(z.record(z.string())),\n peerDependencies: z.optional(z.record(z.string())),\n source: z.optional(z.string()),\n main: z.optional(z.string()),\n browser: z.optional(z.record(z.string())),\n module: z.optional(z.string()),\n types: z.optional(z.string()),\n exports: z.optional(\n z.record(\n z.union([\n z.custom<`./${string}.json`>(\n (val) => typeof val === 'string' && /^\\.\\/.*\\.json$/.test(val),\n ),\n z.custom<`./${string}.css`>((val) => typeof val === 'string' && /^\\.\\/.*\\.css$/.test(val)),\n exportEntrySchema,\n z.object({\n types: z.optional(z.string()),\n svelte: z.string(),\n default: z.optional(z.string()),\n }),\n ]),\n ),\n ),\n browserslist: z.optional(z.union([z.string(), z.array(z.string())])),\n sideEffects: z.optional(z.union([z.boolean(), z.array(z.string())])),\n // @TODO type this properly\n typesVersions: z.optional(z.any()),\n})\n\nconst pkgSchema = basePkgSchema.transform((pkg): PackageJSON => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Schema validates PackageJSON structure\n if (!pkg.exports) return pkg as PackageJSON\n\n const isModule = pkg.type === 'module'\n const transformedExports: PackageJSON['exports'] = {}\n\n for (const [key, value] of Object.entries(pkg.exports)) {\n if (typeof value === 'string') {\n transformedExports[key] = value\n } else if ('svelte' in value) {\n transformedExports[key] = value\n } else {\n // Compute default: use `import` for type: 'module', otherwise `require`\n // The refine guarantees at least one of default/import/require exists\n const computedDefault = isModule\n ? (value.import ?? value.require)!\n : (value.require ?? value.import)!\n\n transformedExports[key] = {\n ...value,\n default: value.default ?? computedDefault,\n }\n }\n }\n\n return {...pkg, exports: transformedExports} as PackageJSON\n})\n\n// Create a map over known keys to catch casing mistakes\nconst typoMap = new Map<string, string>()\n\nfor (const key of basePkgSchema.keyof()._def.values) {\n typoMap.set(key.toUpperCase(), key)\n}\n\nexport function validatePkg(input: unknown): PackageJSON {\n const pkg = pkgSchema.parse(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 {packageUp} from 'package-up'\nimport type {PackageJSON} from './types.ts'\nimport {validatePkg} from './validatePkg.ts'\n\n/** @internal */\nexport async function loadPkg(options: {cwd: string}): Promise<PackageJSON> {\n const {cwd} = options\n\n const pkgPath = await packageUp({cwd})\n\n if (!pkgPath) throw new Error('no package.json found')\n\n const buf = await fs.readFile(pkgPath)\n\n const raw = JSON.parse(buf.toString())\n\n validatePkg(raw)\n\n return raw\n}\n","import chalk from 'chalk'\nimport {ZodError} from 'zod/v3'\nimport type {Logger} from '../../logger.ts'\nimport type {StrictOptions} from '../../strict.ts'\nimport {assertLast, assertOrder} from './helpers.ts'\nimport {loadPkg} from './loadPkg.ts'\nimport type {PackageJSON} from './types.ts'\n\n/** @alpha */\nexport async function loadPkgWithReporting(options: {\n cwd: string\n logger: Logger\n strict: boolean\n strictOptions: StrictOptions\n}): Promise<PackageJSON> {\n const {cwd, logger, strict, strictOptions} = options\n\n try {\n const pkg = await loadPkg({cwd})\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\n // validate exports\n if (pkg.exports) {\n const _exports = Object.entries(pkg.exports)\n\n for (const [expPath, exp] of _exports) {\n if (typeof exp === 'string' || '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.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 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 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 dirPath = path.dirname(dirPath)\n\n if (dirPath === ret) {\n break\n }\n\n if (pathContains(dirPath, ret)) {\n ret = dirPath\n break\n }\n\n if (dirPath === '.') return undefined\n }\n }\n\n return ret\n}\n","import type {PkgBundle, PkgExport} from '../../core/config/types.ts'\nimport type {PackageJSON} from '../../core/pkg/types.ts'\n\n/** @internal */\nexport const fileEnding: RegExp = /\\.[mc]?js$/\n/** @internal */\nexport const 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 {PkgExport} from '../config/types.ts'\nimport {pkgExtMap as extMap} from './pkgExt.ts'\nimport type {PackageJSON} from './types.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.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 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 type {PackageJSON} from './types.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 parseExports(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: (PkgExport & {_path: string})[] = []\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' && !existsSync(resolvePath(cwd, exportEntry))) {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}]\\`: file does not exist.`,\n )\n } else if (typeof exportEntry !== 'string') {\n errors.push(\n `package.json: \\`exports[${JSON.stringify(exportPath)}]\\`: export conditions not supported for CSS files.`,\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\n _exports.push(exp)\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","import ts from 'typescript'\n\n/** @internal */\nexport async function loadTSConfig(options: {\n cwd: string\n tsconfigPath: string\n}): Promise<ts.ParsedCommandLine | 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 })\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\n/** @alpha */\nexport function parseStrictOptions(input: unknown): StrictOptions {\n return validationSchema.parse({strictOptions: input}, {errorMap}).strictOptions\n}\n","import path from 'node:path'\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 {parseExports} from './core/pkg/parseExports.ts'\nimport type {PackageJSON} from './core/pkg/types.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 (tsconfig.options.noCheck !== false && !tsconfig.options.noCheck) {\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.',\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.',\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 = parseExports({\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":["strict","strictOptions","path","isPkgExport","extMap","isTruthy","resolvePath","browserslist","exports"],"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;AC1BO,SAAS,WAAc,GAAM,KAAmB;AACrD,QAAM,OAAO,IAAI,QAAQ,CAAC;AAG1B,SAAI,SAAS,KACJ,KAGF,SAAS,IAAI,SAAS;AAC/B;AAGO,SAAS,YAAe,GAAM,GAAM,KAAmB;AAC5D,QAAM,OAAO,IAAI,QAAQ,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A,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAAA,SACAA;AAAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,CAAA;AAAA,IACP;AAAA,IACA;AAAA,IACA,SAAS,QAAQ,WAAW;AAAA,IAC5B,QAAAR;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":[5]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { dts } from "rolldown-plugin-dts";
|
|
3
|
-
import { pkgExtMap } from "./
|
|
3
|
+
import { pkgExtMap } from "./resolveBuildContext.js";
|
|
4
4
|
function resolveRolldownConfig(ctx, buildTask) {
|
|
5
5
|
const { format, runtime } = buildTask, { config, cwd, exports: _exports, external, distPath, logger, pkg, ts } = ctx, outputExt = pkgExtMap[pkg.type || "commonjs"][format], outDir = path.relative(cwd, distPath), pathAliases = Object.fromEntries(
|
|
6
6
|
Object.entries(ts.config?.options.paths || {}).map(([key, val]) => [key, path.resolve(cwd, ts.config?.options.baseUrl || ".", val[0])])
|
|
@@ -1,5 +1,109 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { switchMap } from "rxjs";
|
|
3
|
+
import { loadConfig } from "./defaults.js";
|
|
4
|
+
import { getTargetPaths, loadPkgWithReporting, resolveBuildContext } from "./resolveBuildContext.js";
|
|
5
|
+
import { createLogger, handleError } from "./handleError.js";
|
|
6
|
+
import { watchTaskHandlers } from "./index.js";
|
|
7
|
+
function resolveWatchTasks(ctx) {
|
|
8
|
+
const { pkg, target } = ctx, tasks = [], exports$1 = Object.entries(ctx.exports || {}).map(
|
|
9
|
+
([_path, exp]) => ({ _path, ...exp })
|
|
10
|
+
), dtsTask = {
|
|
11
|
+
type: "watch:dts",
|
|
12
|
+
entries: []
|
|
13
|
+
}, rollupTasks = {};
|
|
14
|
+
function addRollupTaskEntry(format, runtime, entry) {
|
|
15
|
+
const buildId = `${format}:${runtime}`;
|
|
16
|
+
rollupTasks[buildId] ? rollupTasks[buildId].entries.push(entry) : rollupTasks[buildId] = {
|
|
17
|
+
type: "watch:js",
|
|
18
|
+
buildId,
|
|
19
|
+
entries: [entry],
|
|
20
|
+
runtime,
|
|
21
|
+
format,
|
|
22
|
+
target: target[runtime]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
for (const exp of exports$1) {
|
|
26
|
+
const importId = path.join(pkg.name, exp._path);
|
|
27
|
+
exp.source?.endsWith(".ts") && dtsTask.entries.push({
|
|
28
|
+
importId,
|
|
29
|
+
exportPath: exp._path,
|
|
30
|
+
sourcePath: exp.source,
|
|
31
|
+
targetPaths: getTargetPaths(pkg.type, exp)
|
|
32
|
+
}), exp.browser?.source?.endsWith(".ts") && dtsTask.entries.push({
|
|
33
|
+
importId,
|
|
34
|
+
exportPath: exp._path,
|
|
35
|
+
sourcePath: exp.browser.source,
|
|
36
|
+
targetPaths: getTargetPaths(pkg.type, exp.browser)
|
|
37
|
+
}), exp.node?.source?.endsWith(".ts") && dtsTask.entries.push({
|
|
38
|
+
importId,
|
|
39
|
+
exportPath: exp._path,
|
|
40
|
+
sourcePath: exp.node.source,
|
|
41
|
+
targetPaths: getTargetPaths(pkg.type, exp.node)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
for (const exp of exports$1) {
|
|
45
|
+
const output = exp.require;
|
|
46
|
+
output && addRollupTaskEntry("commonjs", ctx.runtime, {
|
|
47
|
+
path: exp._path,
|
|
48
|
+
source: exp.source,
|
|
49
|
+
output
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
for (const exp of exports$1) {
|
|
53
|
+
const output = exp.browser?.require;
|
|
54
|
+
output && addRollupTaskEntry("commonjs", "browser", {
|
|
55
|
+
path: exp._path,
|
|
56
|
+
source: exp.browser?.source || exp.source,
|
|
57
|
+
output
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
for (const exp of exports$1) {
|
|
61
|
+
const output = exp.import;
|
|
62
|
+
output && addRollupTaskEntry("esm", ctx.runtime, {
|
|
63
|
+
path: exp._path,
|
|
64
|
+
source: exp.source,
|
|
65
|
+
output
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
for (const exp of exports$1) {
|
|
69
|
+
const output = exp.browser?.import;
|
|
70
|
+
output && addRollupTaskEntry("esm", "browser", {
|
|
71
|
+
path: exp._path,
|
|
72
|
+
source: exp.browser?.source || exp.source,
|
|
73
|
+
output
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return dtsTask.entries.length && tasks.push(dtsTask), tasks.push(...Object.values(rollupTasks)), tasks;
|
|
77
|
+
}
|
|
78
|
+
async function watch(options) {
|
|
79
|
+
const { cwd, strict = !1, tsconfig: tsconfigOption } = options, logger = createLogger(), { watchConfigFiles } = await import("./watchConfigFiles.js");
|
|
80
|
+
(await watchConfigFiles({ cwd, logger })).pipe(
|
|
81
|
+
switchMap(async (configFiles) => {
|
|
82
|
+
if (!configFiles.map((f) => path.relative(cwd, f)).find((f) => f === "package.json"))
|
|
83
|
+
throw new Error("missing package.json");
|
|
84
|
+
const config = await loadConfig({ cwd }), { parseStrictOptions } = await import("./resolveBuildContext.js").then(function(n) {
|
|
85
|
+
return n.strict;
|
|
86
|
+
}), strictOptions = parseStrictOptions(config?.strictOptions ?? {}), pkg = await loadPkgWithReporting({ cwd, logger, strict, strictOptions }), tsconfig = tsconfigOption || config?.tsconfig || "tsconfig.json";
|
|
87
|
+
return resolveBuildContext({ config, cwd, logger, pkg, strict, tsconfig });
|
|
88
|
+
})
|
|
89
|
+
).subscribe(async (ctx) => {
|
|
90
|
+
const watchTasks = resolveWatchTasks(ctx);
|
|
91
|
+
for (const task of watchTasks) {
|
|
92
|
+
const handler = watchTaskHandlers[task.type];
|
|
93
|
+
handler.exec(ctx, task).subscribe({
|
|
94
|
+
error: (err) => {
|
|
95
|
+
ctx.logger.error(err), ctx.logger.log(), process.exit(1);
|
|
96
|
+
},
|
|
97
|
+
next: (result) => {
|
|
98
|
+
handler.complete(ctx, task, result);
|
|
99
|
+
},
|
|
100
|
+
complete: () => {
|
|
101
|
+
ctx.logger.success(handler.name(ctx, task)), ctx.logger.log();
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
3
107
|
async function watchAction(options) {
|
|
4
108
|
try {
|
|
5
109
|
await watch({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchAction.js","sources":["../../src/cli/watchAction.ts"],"sourcesContent":["import {watch} from '../node/watch.ts'\nimport {handleError} from './handleError.ts'\n\nexport async function watchAction(options: {strict?: boolean; tsconfig?: string}): Promise<void> {\n try {\n await watch({\n cwd: process.cwd(),\n strict: options.strict,\n tsconfig: options.tsconfig,\n })\n } catch (err) {\n handleError(err)\n }\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"watchAction.js","sources":["../../src/node/resolveWatchTasks.ts","../../src/node/watch.ts","../../src/cli/watchAction.ts"],"sourcesContent":["import path from 'node:path'\nimport type {PkgExport, PkgFormat, PkgRuntime} from './core/config/types.ts'\nimport type {BuildContext} from './core/contexts/buildContext.ts'\nimport {getTargetPaths} from './tasks/dts/getTargetPaths.ts'\nimport type {DtsWatchTask} from './tasks/dts/types.ts'\nimport type {RollupTaskEntry, RollupWatchTask, WatchTask} from './tasks/types.ts'\n\n/** @internal */\nexport function resolveWatchTasks(ctx: BuildContext): WatchTask[] {\n const {pkg, target} = ctx\n const tasks: WatchTask[] = []\n\n const exports = Object.entries(ctx.exports || {}).map(\n ([_path, exp]) => ({_path, ...exp}) as PkgExport & {_path: string},\n )\n\n const dtsTask: DtsWatchTask = {\n type: 'watch:dts',\n entries: [],\n }\n\n const rollupTasks: Record<string, RollupWatchTask> = {}\n\n function addRollupTaskEntry(format: PkgFormat, runtime: PkgRuntime, entry: RollupTaskEntry) {\n const buildId = `${format}:${runtime}`\n\n if (rollupTasks[buildId]) {\n rollupTasks[buildId].entries.push(entry)\n } else {\n rollupTasks[buildId] = {\n type: 'watch:js',\n buildId,\n entries: [entry],\n runtime,\n format,\n target: target[runtime],\n }\n }\n }\n\n // Parse `dts` tasks\n for (const exp of exports) {\n const importId = path.join(pkg.name, exp._path)\n\n if (exp.source?.endsWith('.ts')) {\n dtsTask.entries.push({\n importId,\n exportPath: exp._path,\n sourcePath: exp.source,\n targetPaths: getTargetPaths(pkg.type, exp),\n })\n }\n\n if (exp.browser?.source?.endsWith('.ts')) {\n dtsTask.entries.push({\n importId,\n exportPath: exp._path,\n sourcePath: exp.browser.source,\n targetPaths: getTargetPaths(pkg.type, exp.browser),\n })\n }\n\n if (exp.node?.source?.endsWith('.ts')) {\n dtsTask.entries.push({\n importId,\n exportPath: exp._path,\n sourcePath: exp.node.source,\n targetPaths: getTargetPaths(pkg.type, exp.node),\n })\n }\n }\n\n // Parse rollup:commonjs:* tasks\n for (const exp of exports) {\n const output = exp.require\n\n if (!output) continue\n\n addRollupTaskEntry('commonjs', ctx.runtime, {\n path: exp._path,\n source: exp.source,\n output,\n })\n }\n\n // Parse rollup:commonjs:browser tasks\n for (const exp of exports) {\n const output = exp.browser?.require\n\n if (!output) continue\n\n addRollupTaskEntry('commonjs', 'browser', {\n path: exp._path,\n source: exp.browser?.source || exp.source,\n output,\n })\n }\n\n // Parse rollup:esm:* tasks\n for (const exp of exports) {\n const output = exp.import\n\n if (!output) continue\n\n addRollupTaskEntry('esm', ctx.runtime, {\n path: exp._path,\n source: exp.source,\n output,\n })\n }\n\n // Parse rollup:esm:browser tasks\n for (const exp of exports) {\n const output = exp.browser?.import\n\n if (!output) continue\n\n addRollupTaskEntry('esm', 'browser', {\n path: exp._path,\n source: exp.browser?.source || exp.source,\n output,\n })\n }\n\n if (dtsTask.entries.length) {\n tasks.push(dtsTask)\n }\n\n tasks.push(...Object.values(rollupTasks))\n\n return tasks\n}\n","import path from 'node:path'\nimport {switchMap} from 'rxjs'\nimport {loadConfig} from './core/config/loadConfig.ts'\nimport {loadPkgWithReporting} from './core/pkg/loadPkgWithReporting.ts'\nimport {createLogger} from './logger.ts'\nimport {resolveBuildContext} from './resolveBuildContext.ts'\nimport {resolveWatchTasks} from './resolveWatchTasks.ts'\nimport {watchTaskHandlers} from './tasks/index.ts'\nimport {type TaskHandler, type WatchTask} from './tasks/types.ts'\n\n/** @public */\nexport async function watch(options: {\n cwd: string\n strict?: boolean\n tsconfig?: string\n}): Promise<void> {\n const {cwd, strict = false, tsconfig: tsconfigOption} = options\n\n const logger = createLogger()\n\n const {watchConfigFiles} = await import('./watchConfigFiles.ts')\n const configFiles$ = await watchConfigFiles({cwd, logger})\n\n const ctx$ = configFiles$.pipe(\n switchMap(async (configFiles) => {\n const files = configFiles.map((f) => path.relative(cwd, f))\n\n const packageJsonPath = files.find((f) => f === 'package.json')\n\n if (!packageJsonPath) {\n throw new Error('missing package.json')\n }\n\n const config = await loadConfig({cwd})\n const {parseStrictOptions} = await import('./strict.ts')\n const strictOptions = parseStrictOptions(config?.strictOptions ?? {})\n const pkg = await loadPkgWithReporting({cwd, logger, strict, strictOptions})\n const tsconfig = tsconfigOption || config?.tsconfig || 'tsconfig.json'\n\n return resolveBuildContext({config, cwd, logger, pkg, strict, tsconfig})\n }),\n )\n\n ctx$.subscribe(async (ctx) => {\n const watchTasks = resolveWatchTasks(ctx)\n\n for (const task of watchTasks) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- TypeScript can't infer the correct handler type from discriminated union\n const handler = watchTaskHandlers[task.type] as TaskHandler<WatchTask, unknown>\n const result$ = handler.exec(ctx, task)\n\n result$.subscribe({\n error: (err) => {\n ctx.logger.error(err)\n ctx.logger.log()\n\n process.exit(1)\n },\n next: (result) => {\n handler.complete(ctx, task, result)\n },\n complete: () => {\n ctx.logger.success(handler.name(ctx, task))\n ctx.logger.log()\n },\n })\n }\n })\n}\n","import {watch} from '../node/watch.ts'\nimport {handleError} from './handleError.ts'\n\nexport async function watchAction(options: {strict?: boolean; tsconfig?: string}): Promise<void> {\n try {\n await watch({\n cwd: process.cwd(),\n strict: options.strict,\n tsconfig: options.tsconfig,\n })\n } catch (err) {\n handleError(err)\n }\n}\n"],"names":["exports"],"mappings":";;;;;;AAQO,SAAS,kBAAkB,KAAgC;AAChE,QAAM,EAAC,KAAK,OAAA,IAAU,KAChB,QAAqB,CAAA,GAErBA,YAAU,OAAO,QAAQ,IAAI,WAAW,CAAA,CAAE,EAAE;AAAA,IAChD,CAAC,CAAC,OAAO,GAAG,OAAO,EAAC,OAAO,GAAG,IAAA;AAAA,EAAG,GAG7B,UAAwB;AAAA,IAC5B,MAAM;AAAA,IACN,SAAS,CAAA;AAAA,EAAC,GAGN,cAA+C,CAAA;AAErD,WAAS,mBAAmB,QAAmB,SAAqB,OAAwB;AAC1F,UAAM,UAAU,GAAG,MAAM,IAAI,OAAO;AAEhC,gBAAY,OAAO,IACrB,YAAY,OAAO,EAAE,QAAQ,KAAK,KAAK,IAEvC,YAAY,OAAO,IAAI;AAAA,MACrB,MAAM;AAAA,MACN;AAAA,MACA,SAAS,CAAC,KAAK;AAAA,MACf;AAAA,MACA;AAAA,MACA,QAAQ,OAAO,OAAO;AAAA,IAAA;AAAA,EAG5B;AAGA,aAAW,OAAOA,WAAS;AACzB,UAAM,WAAW,KAAK,KAAK,IAAI,MAAM,IAAI,KAAK;AAE1C,QAAI,QAAQ,SAAS,KAAK,KAC5B,QAAQ,Q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,MAAM,CAAC,WAAW;AAChB,kBAAQ,SAAS,KAAK,MAAM,MAAM;AAAA,QACpC;AAAA,QACA,UAAU,MAAM;AACd,cAAI,OAAO,QAAQ,QAAQ,KAAK,KAAK,IAAI,CAAC,GAC1C,IAAI,OAAO,IAAA;AAAA,QACb;AAAA,MAAA,CACD;AAAA,IACH;AAAA,EACF,CAAC;AACH;ACjEA,eAAsB,YAAY,SAA+D;AAC/F,MAAI;AACF,UAAM,MAAM;AAAA,MACV,KAAK,QAAQ,IAAA;AAAA,MACb,QAAQ,QAAQ;AAAA,MAChB,UAAU,QAAQ;AAAA,IAAA,CACnB;AAAA,EACH,SAAS,KAAK;AACZ,gBAAY,GAAG;AAAA,EACjB;AACF;"}
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cac } from "cac";
|
|
2
|
-
var version = "
|
|
2
|
+
var version = "10.0.0";
|
|
3
3
|
const cli = cac();
|
|
4
4
|
cli.command("", "Check").alias("check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async (options) => {
|
|
5
5
|
const { checkAction } = await import("./_chunks-es/checkAction.js");
|