@sanity/pkg-utils 4.2.5 → 4.2.7
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/build-Dvr5eKKV.cjs +158 -0
- package/dist/_chunks/{build-CXc7iZ4I.cjs.map → build-Dvr5eKKV.cjs.map} +1 -1
- package/dist/_chunks/{buildAction-C7_2DRLs.cjs → buildAction-BqdY-x5D.cjs} +3 -7
- package/dist/_chunks/{buildAction-C7_2DRLs.cjs.map → buildAction-BqdY-x5D.cjs.map} +1 -1
- package/dist/_chunks/check-BSN1yLfm.cjs +118 -0
- package/dist/_chunks/check-BSN1yLfm.cjs.map +1 -0
- package/dist/_chunks/{checkAction-B86PejBD.cjs → checkAction-CplEAcgR.cjs} +3 -7
- package/dist/_chunks/{checkAction-B86PejBD.cjs.map → checkAction-CplEAcgR.cjs.map} +1 -1
- package/dist/_chunks/consoleSpy-1_g1SPGc.cjs +369 -0
- package/dist/_chunks/{consoleSpy-DnlN7UBk.cjs.map → consoleSpy-1_g1SPGc.cjs.map} +1 -1
- package/dist/_chunks/handleError-CGQ2DXMR.cjs +11 -0
- package/dist/_chunks/handleError-CGQ2DXMR.cjs.map +1 -0
- package/dist/_chunks/index-Dxhh31D_.cjs +19997 -0
- package/dist/_chunks/{index-KFzP3Jfd.cjs.map → index-Dxhh31D_.cjs.map} +1 -1
- package/dist/_chunks/{init-CZQh-Q_y.cjs → init-2mlaoNTF.cjs} +174 -261
- package/dist/_chunks/{init-CZQh-Q_y.cjs.map → init-2mlaoNTF.cjs.map} +1 -1
- package/dist/_chunks/{initAction-BYVnsbAj.cjs → initAction-BlTz_X1p.cjs} +3 -7
- package/dist/_chunks/{initAction-BYVnsbAj.cjs.map → initAction-BlTz_X1p.cjs.map} +1 -1
- package/dist/_chunks/{logger-CpjNjxqG.cjs → logger-CwHVwB-b.cjs} +11 -20
- package/dist/_chunks/logger-CwHVwB-b.cjs.map +1 -0
- package/dist/_chunks/watch-Dqp3kWd_.cjs +156 -0
- package/dist/_chunks/{watch-CvkxIHzY.cjs.map → watch-Dqp3kWd_.cjs.map} +1 -1
- package/dist/_chunks/{watchAction-CkOiWSyp.cjs → watchAction-4vv-wSLV.cjs} +3 -7
- package/dist/_chunks/{watchAction-CkOiWSyp.cjs.map → watchAction-4vv-wSLV.cjs.map} +1 -1
- package/dist/cli.cjs +18 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +3 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19893 -35944
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/node/tasks/rollup/resolveRollupConfig.ts +2 -2
- package/dist/_chunks/build-CXc7iZ4I.cjs +0 -216
- package/dist/_chunks/check-Do7O9Mjo.cjs +0 -223
- package/dist/_chunks/check-Do7O9Mjo.cjs.map +0 -1
- package/dist/_chunks/consoleSpy-DnlN7UBk.cjs +0 -632
- package/dist/_chunks/handleError-DB8KmYKe.cjs +0 -19
- package/dist/_chunks/handleError-DB8KmYKe.cjs.map +0 -1
- package/dist/_chunks/index-KFzP3Jfd.cjs +0 -35564
- package/dist/_chunks/logger-CpjNjxqG.cjs.map +0 -1
- package/dist/_chunks/watch-CvkxIHzY.cjs +0 -227
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var node = require("esbuild-register/dist/node"), path = require("path"), pkgUp = require("pkg-up"), findConfig = require("find-config"), logger = require("./logger-CwHVwB-b.cjs"), chalk = require("chalk"), zod = require("zod"), fs = require("fs/promises"), browserslist = require("browserslist");
|
|
3
|
+
require("fs");
|
|
4
|
+
var config = require("@sanity/browserslist-config");
|
|
5
|
+
require("mkdirp");
|
|
6
|
+
require("prompts");
|
|
7
|
+
var ts = require("typescript");
|
|
8
|
+
function _interopDefaultCompat(e) {
|
|
9
|
+
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
10
|
+
}
|
|
11
|
+
var path__default = /* @__PURE__ */ _interopDefaultCompat(path), pkgUp__default = /* @__PURE__ */ _interopDefaultCompat(pkgUp), findConfig__default = /* @__PURE__ */ _interopDefaultCompat(findConfig), chalk__default = /* @__PURE__ */ _interopDefaultCompat(chalk), fs__default = /* @__PURE__ */ _interopDefaultCompat(fs), browserslist__default = /* @__PURE__ */ _interopDefaultCompat(browserslist), config__default = /* @__PURE__ */ _interopDefaultCompat(config), ts__default = /* @__PURE__ */ _interopDefaultCompat(ts);
|
|
12
|
+
const CONFIG_FILE_NAMES = [
|
|
13
|
+
"package.config.ts",
|
|
14
|
+
"package.config.js",
|
|
15
|
+
"package.config.cjs",
|
|
16
|
+
"package.config.mjs"
|
|
17
|
+
];
|
|
18
|
+
function findConfigFile(cwd) {
|
|
19
|
+
const pkgJsonPath = findConfig__default.default("package.json", { cwd });
|
|
20
|
+
if (!pkgJsonPath)
|
|
21
|
+
return;
|
|
22
|
+
const pkgPath = path__default.default.dirname(pkgJsonPath);
|
|
23
|
+
for (const fileName of CONFIG_FILE_NAMES) {
|
|
24
|
+
const configPath = path__default.default.resolve(pkgPath, fileName);
|
|
25
|
+
if (logger.fileExists(configPath))
|
|
26
|
+
return configPath;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function loadConfig(options) {
|
|
30
|
+
const { cwd } = options, pkgPath = await pkgUp__default.default({ cwd });
|
|
31
|
+
if (!pkgPath)
|
|
32
|
+
return;
|
|
33
|
+
const root = path__default.default.dirname(pkgPath), configFile = await findConfigFile(root);
|
|
34
|
+
if (!configFile || !configFile.startsWith(cwd))
|
|
35
|
+
return;
|
|
36
|
+
const esbuildOptions = { extensions: [".js", ".mjs", ".ts"] }, { unregister } = globalThis.__DEV__ ? { unregister: () => {
|
|
37
|
+
} } : node.register(esbuildOptions), mod = require(configFile);
|
|
38
|
+
return unregister(), mod?.default || mod || void 0;
|
|
39
|
+
}
|
|
40
|
+
function resolveConfigProperty(prop, initialValue) {
|
|
41
|
+
return prop ? typeof prop == "function" ? prop(initialValue) : prop : initialValue;
|
|
42
|
+
}
|
|
43
|
+
const DEFAULT_BROWSERSLIST_QUERY = config__default.default;
|
|
44
|
+
async function loadPkg(options) {
|
|
45
|
+
const { cwd } = options, pkgPath = await pkgUp__default.default({ cwd });
|
|
46
|
+
if (!pkgPath)
|
|
47
|
+
throw new Error("no package.json found");
|
|
48
|
+
const buf = await fs__default.default.readFile(pkgPath), raw = JSON.parse(buf.toString());
|
|
49
|
+
return logger.validatePkg(raw), raw;
|
|
50
|
+
}
|
|
51
|
+
function assertFirst(a, arr) {
|
|
52
|
+
const aIdx = arr.indexOf(a);
|
|
53
|
+
return aIdx === -1 ? !0 : aIdx === 0;
|
|
54
|
+
}
|
|
55
|
+
function assertLast(a, arr) {
|
|
56
|
+
const aIdx = arr.indexOf(a);
|
|
57
|
+
return aIdx === -1 ? !0 : aIdx === arr.length - 1;
|
|
58
|
+
}
|
|
59
|
+
function assertOrder(a, b, arr) {
|
|
60
|
+
const aIdx = arr.indexOf(a), bIdx = arr.indexOf(b);
|
|
61
|
+
return aIdx === -1 || bIdx === -1 ? !0 : aIdx < bIdx;
|
|
62
|
+
}
|
|
63
|
+
async function loadPkgWithReporting(options) {
|
|
64
|
+
const { cwd, logger: logger2 } = options;
|
|
65
|
+
try {
|
|
66
|
+
const pkg = await loadPkg({ cwd });
|
|
67
|
+
let shouldError = !1;
|
|
68
|
+
if (pkg.exports) {
|
|
69
|
+
const _exports = Object.entries(pkg.exports);
|
|
70
|
+
for (const [expPath, exp] of _exports) {
|
|
71
|
+
if (typeof exp == "string")
|
|
72
|
+
continue;
|
|
73
|
+
const keys = Object.keys(exp);
|
|
74
|
+
if (assertFirst("types", keys) || (shouldError = !0, logger2.error(`exports["${expPath}"]: the \`types\` property should be the first property`)), exp.node) {
|
|
75
|
+
const nodeKeys = Object.keys(exp.node);
|
|
76
|
+
assertOrder("module", "import", nodeKeys) || (shouldError = !0, logger2.error(
|
|
77
|
+
`exports["${expPath}"]: the \`node.module\` property should come before the \`node.import\` property`
|
|
78
|
+
)), assertOrder("import", "require", nodeKeys) || logger2.warn(
|
|
79
|
+
`exports["${expPath}"]: the \`node.import\` property should come before the \`node.require\` property`
|
|
80
|
+
), assertOrder("module", "require", nodeKeys) || logger2.warn(
|
|
81
|
+
`exports["${expPath}"]: the \`node.module\` property should come before \`node.require\` property`
|
|
82
|
+
), exp.import && exp.node.import && !assertOrder("node", "import", keys) && (shouldError = !0, logger2.error(
|
|
83
|
+
`exports["${expPath}"]: the \`node\` property should come before the \`import\` property`
|
|
84
|
+
)), exp.module && exp.node.module && !assertOrder("node", "module", keys) && (shouldError = !0, logger2.error(
|
|
85
|
+
`exports["${expPath}"]: the \`node\` property should come before the \`module\` property`
|
|
86
|
+
)), exp.node.import && !exp.node.require && exp.node.module && exp.import && exp.node.module !== exp.import && (shouldError = !0, logger2.error(
|
|
87
|
+
`exports["${expPath}"]: the \`node.module\` property should match \`import\``
|
|
88
|
+
)), exp.require && exp.node.require && exp.require === exp.node.require ? (shouldError = !0, logger2.error(
|
|
89
|
+
`exports["${expPath}"]: the \`node.require\` property isn't necessary as it's identical to \`require\``
|
|
90
|
+
)) : exp.require && exp.node.require && !assertOrder("node", "require", keys) && (shouldError = !0, logger2.error(
|
|
91
|
+
`exports["${expPath}"]: the \`node\` property should come before the \`require\` property`
|
|
92
|
+
));
|
|
93
|
+
} else
|
|
94
|
+
assertOrder("import", "require", keys) || logger2.warn(
|
|
95
|
+
`exports["${expPath}"]: the \`import\` property should come before the \`require\` property`
|
|
96
|
+
), assertOrder("module", "import", keys) || logger2.warn(
|
|
97
|
+
`exports["${expPath}"]: the \`module\` property should come before \`import\` property`
|
|
98
|
+
);
|
|
99
|
+
assertLast("default", keys) || (shouldError = !0, logger2.error(
|
|
100
|
+
`exports["${expPath}"]: the \`default\` property should be the last property`
|
|
101
|
+
));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return shouldError && process.exit(1), pkg;
|
|
105
|
+
} catch (err) {
|
|
106
|
+
if (err instanceof zod.ZodError)
|
|
107
|
+
for (const issue of err.issues) {
|
|
108
|
+
if (issue.code === "invalid_type") {
|
|
109
|
+
logger2.error(
|
|
110
|
+
[
|
|
111
|
+
`\`${formatPath(issue.path)}\` `,
|
|
112
|
+
`in \`./package.json\` must be of type ${chalk__default.default.magenta(issue.expected)} `,
|
|
113
|
+
`(received ${chalk__default.default.magenta(issue.received)})`
|
|
114
|
+
].join("")
|
|
115
|
+
);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
logger2.error(issue);
|
|
119
|
+
}
|
|
120
|
+
else
|
|
121
|
+
logger2.error(err);
|
|
122
|
+
process.exit(1);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function formatPath(segments) {
|
|
126
|
+
return segments.map((s, idx) => idx === 0 ? s : typeof s == "number" ? `[${s}]` : s.startsWith(".") ? `["${s}"]` : `.${s}`).join("");
|
|
127
|
+
}
|
|
128
|
+
function validateExports(_exports, options) {
|
|
129
|
+
const { extMap, pkg } = options, ext = extMap[pkg.type || "commonjs"], errors = [];
|
|
130
|
+
for (const exp of _exports)
|
|
131
|
+
exp.require && !exp.require.endsWith(ext.commonjs) && errors.push(
|
|
132
|
+
`package.json with \`type: "${pkg.type}"\` - \`exports["${exp._path}"].require\` must end with "${ext.commonjs}"`
|
|
133
|
+
), exp.import && !exp.import.endsWith(ext.esm) && errors.push(
|
|
134
|
+
`package.json with \`type: "${pkg.type}"\` - \`exports["${exp._path}"].import\` must end with "${ext.esm}"`
|
|
135
|
+
);
|
|
136
|
+
return errors;
|
|
137
|
+
}
|
|
138
|
+
function parseExports(options) {
|
|
139
|
+
const { extMap, pkg, strict } = options, rootExport = {
|
|
140
|
+
_exported: !0,
|
|
141
|
+
_path: ".",
|
|
142
|
+
types: pkg.types,
|
|
143
|
+
source: pkg.source || "",
|
|
144
|
+
browser: pkg.browser && {
|
|
145
|
+
source: pkg.source || "",
|
|
146
|
+
require: pkg.main && pkg.browser[pkg.main],
|
|
147
|
+
import: pkg.module && pkg.browser[pkg.module]
|
|
148
|
+
},
|
|
149
|
+
require: pkg.main,
|
|
150
|
+
import: pkg.module,
|
|
151
|
+
default: pkg.module || pkg.main || ""
|
|
152
|
+
}, extraExports = [], errors = [];
|
|
153
|
+
if (pkg.exports) {
|
|
154
|
+
strict && !pkg.exports["./package.json"] && errors.push('package.json: `exports["./package.json"] must be declared.');
|
|
155
|
+
for (const [exportPath, exportEntry] of Object.entries(pkg.exports))
|
|
156
|
+
if (exportPath.endsWith(".json"))
|
|
157
|
+
exportPath === "./package.json" && exportEntry !== "./package.json" && errors.push('package.json: `exports["./package.json"] must be "./package.json".');
|
|
158
|
+
else if (logger.isRecord(exportEntry))
|
|
159
|
+
if (exportPath === ".")
|
|
160
|
+
exportEntry.require && rootExport.require && exportEntry.require !== rootExport.require && errors.push(
|
|
161
|
+
'package.json: mismatch between "main" and "exports.require". These must be equal.'
|
|
162
|
+
), exportEntry.import && rootExport.import && exportEntry.import !== rootExport.import && errors.push(
|
|
163
|
+
'package.json: mismatch between "module" and "exports.import" These must be equal.'
|
|
164
|
+
), exportEntry.types && rootExport.types && exportEntry.types !== rootExport.types && errors.push(
|
|
165
|
+
'package.json: mismatch between "types" and "exports.types". These must be equal.'
|
|
166
|
+
), exportEntry.source && rootExport.source && exportEntry.source !== rootExport.source && errors.push(
|
|
167
|
+
'package.json: mismatch between "source" and "exports.source". These must be equal.'
|
|
168
|
+
), Object.assign(rootExport, exportEntry);
|
|
169
|
+
else {
|
|
170
|
+
const extraExport = {
|
|
171
|
+
_exported: !0,
|
|
172
|
+
_path: exportPath,
|
|
173
|
+
...exportEntry
|
|
174
|
+
};
|
|
175
|
+
extraExports.push(extraExport);
|
|
176
|
+
}
|
|
177
|
+
else
|
|
178
|
+
errors.push("package.json: exports must be an object");
|
|
179
|
+
}
|
|
180
|
+
const _exports = [rootExport, ...extraExports];
|
|
181
|
+
if (errors.push(...validateExports(_exports, { extMap, pkg })), errors.length)
|
|
182
|
+
throw new Error(`
|
|
183
|
+
- ` + errors.join(`
|
|
184
|
+
- `));
|
|
185
|
+
return _exports;
|
|
186
|
+
}
|
|
187
|
+
const DEFAULT_PKG_EXT_MAP = {
|
|
188
|
+
// pkg.type: "commonjs"
|
|
189
|
+
commonjs: {
|
|
190
|
+
commonjs: ".js",
|
|
191
|
+
esm: ".mjs"
|
|
192
|
+
},
|
|
193
|
+
// pkg.type: "module"
|
|
194
|
+
module: {
|
|
195
|
+
commonjs: ".cjs",
|
|
196
|
+
esm: ".js"
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
function getPkgExtMap(options) {
|
|
200
|
+
const { legacyExports } = options, ret = { ...DEFAULT_PKG_EXT_MAP };
|
|
201
|
+
return legacyExports && (ret.commonjs = {
|
|
202
|
+
commonjs: ".js",
|
|
203
|
+
esm: ".esm.js"
|
|
204
|
+
}), ret;
|
|
205
|
+
}
|
|
206
|
+
async function loadTSConfig(options) {
|
|
207
|
+
const { cwd, tsconfigPath } = options, configPath = ts__default.default.findConfigFile(cwd, ts__default.default.sys.fileExists, tsconfigPath);
|
|
208
|
+
if (!configPath)
|
|
209
|
+
return;
|
|
210
|
+
const configFile = ts__default.default.readConfigFile(configPath, ts__default.default.sys.readFile);
|
|
211
|
+
return ts__default.default.parseJsonConfigFileContent(configFile.config, ts__default.default.sys, cwd);
|
|
212
|
+
}
|
|
213
|
+
function browserslistToEsbuild(browserslistConfig, options = {}) {
|
|
214
|
+
if (!browserslistConfig) {
|
|
215
|
+
const path2 = process.cwd();
|
|
216
|
+
browserslistConfig = browserslist__default.default.loadConfig({ path: path2, ...options });
|
|
217
|
+
}
|
|
218
|
+
const SUPPORTED_ESBUILD_TARGETS = [
|
|
219
|
+
"es",
|
|
220
|
+
"chrome",
|
|
221
|
+
"edge",
|
|
222
|
+
"firefox",
|
|
223
|
+
"ios",
|
|
224
|
+
"node",
|
|
225
|
+
"safari",
|
|
226
|
+
"opera",
|
|
227
|
+
"ie"
|
|
228
|
+
], UNSUPPORTED = ["android 4"], replaces = {
|
|
229
|
+
ios_saf: "ios",
|
|
230
|
+
android: "chrome"
|
|
231
|
+
}, separator = " ";
|
|
232
|
+
return browserslist__default.default(browserslistConfig, options).filter((b) => !UNSUPPORTED.some((u) => b.startsWith(u))).map((b) => b === "safari TP" ? browserslist__default.default("last 1 safari version")[0] : b).map((b) => b.split(separator)).map((b) => (replaces[b[0]] && (b[0] = replaces[b[0]]), b)).map((b) => (b[1].includes("-") && (b[1] = b[1].slice(0, b[1].indexOf("-"))), b)).map((b) => (b[1].endsWith(".0") && (b[1] = b[1].slice(0, -2)), b)).filter((b) => /^\d+(\.\d+)*$/.test(b[1])).filter((b) => SUPPORTED_ESBUILD_TARGETS.includes(b[0])).reduce((acc, b) => {
|
|
233
|
+
const existingIndex = acc.findIndex((br) => br[0] === b[0]);
|
|
234
|
+
return existingIndex !== -1 ? acc[existingIndex][1] = b[1] : acc.push(b), acc;
|
|
235
|
+
}, []).map((b) => b.join(""));
|
|
236
|
+
}
|
|
237
|
+
function pathContains(containerPath, itemPath) {
|
|
238
|
+
return !path__default.default.relative(containerPath, itemPath).startsWith("..");
|
|
239
|
+
}
|
|
240
|
+
function findCommonDirPath(filePaths) {
|
|
241
|
+
let ret;
|
|
242
|
+
for (const filePath of filePaths) {
|
|
243
|
+
let dirPath = path__default.default.dirname(filePath);
|
|
244
|
+
if (!ret) {
|
|
245
|
+
ret = dirPath;
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
for (; dirPath !== ret && (dirPath = path__default.default.dirname(dirPath), dirPath !== ret); ) {
|
|
249
|
+
if (pathContains(dirPath, ret)) {
|
|
250
|
+
ret = dirPath;
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
if (dirPath === ".")
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return ret;
|
|
258
|
+
}
|
|
259
|
+
function resolveBrowserTarget(versions) {
|
|
260
|
+
const target = versions.filter(
|
|
261
|
+
(version) => version.startsWith("chrome") || version.startsWith("edge") || version.startsWith("firefox") || version.startsWith("ios") || version.startsWith("safari") || version.startsWith("opera")
|
|
262
|
+
);
|
|
263
|
+
if (target.length !== 0)
|
|
264
|
+
return target;
|
|
265
|
+
}
|
|
266
|
+
function resolveNodeTarget(versions) {
|
|
267
|
+
const target = versions.filter((version) => version.startsWith("node"));
|
|
268
|
+
if (target.length !== 0)
|
|
269
|
+
return target;
|
|
270
|
+
}
|
|
271
|
+
async function resolveBuildContext(options) {
|
|
272
|
+
const {
|
|
273
|
+
config: config2,
|
|
274
|
+
cwd,
|
|
275
|
+
emitDeclarationOnly = !1,
|
|
276
|
+
extMap,
|
|
277
|
+
logger: logger2,
|
|
278
|
+
pkg,
|
|
279
|
+
strict,
|
|
280
|
+
tsconfig: tsconfigPath
|
|
281
|
+
} = options, tsconfig = await loadTSConfig({ cwd, tsconfigPath });
|
|
282
|
+
let browserslist2 = pkg.browserslist;
|
|
283
|
+
strict && !browserslist2 && (logger2.warn(
|
|
284
|
+
'Could not detect a `browserslist` property in `package.json`, using default configuration. Add `"browserslist": "extends @sanity/browserslist-config"` to silence this warning.'
|
|
285
|
+
), browserslist2 = DEFAULT_BROWSERSLIST_QUERY);
|
|
286
|
+
const targetVersions = browserslistToEsbuild(browserslist2);
|
|
287
|
+
strict && typeof pkg.sideEffects > "u" && logger2.error(
|
|
288
|
+
'No `sideEffects` field in `package.json`, assuming all files are side-effectful. Add `"sideEffects": true` to silence this warning. See https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects for how to define `sideEffects`.'
|
|
289
|
+
);
|
|
290
|
+
const nodeTarget = resolveNodeTarget(targetVersions), webTarget = resolveBrowserTarget(targetVersions);
|
|
291
|
+
if (!nodeTarget)
|
|
292
|
+
throw new Error("no matching `node` target");
|
|
293
|
+
if (!webTarget)
|
|
294
|
+
throw new Error("no matching `web` target");
|
|
295
|
+
const target = {
|
|
296
|
+
"*": webTarget.concat(nodeTarget),
|
|
297
|
+
browser: webTarget,
|
|
298
|
+
node: nodeTarget
|
|
299
|
+
}, parsedExports = parseExports({ extMap, pkg, strict }).reduce((acc, x) => {
|
|
300
|
+
const { _path: exportPath, ...exportEntry } = x;
|
|
301
|
+
return { ...acc, [exportPath]: exportEntry };
|
|
302
|
+
}, {}), exports2 = resolveConfigProperty(config2?.exports, parsedExports), parsedExternal = [
|
|
303
|
+
...pkg.dependencies ? Object.keys(pkg.dependencies) : [],
|
|
304
|
+
...pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : []
|
|
305
|
+
], external = config2 && Array.isArray(config2.external) ? [...parsedExternal, ...config2.external] : resolveConfigProperty(config2?.external, parsedExternal), outputPaths = Object.values(exports2).flatMap((exportEntry) => [
|
|
306
|
+
exportEntry.import,
|
|
307
|
+
exportEntry.require,
|
|
308
|
+
exportEntry.browser?.import,
|
|
309
|
+
exportEntry.browser?.require,
|
|
310
|
+
exportEntry.node?.source && exportEntry.node.import,
|
|
311
|
+
exportEntry.node?.source && exportEntry.node.require
|
|
312
|
+
].filter(Boolean)).map((p) => path__default.default.resolve(cwd, p)), commonDistPath = findCommonDirPath(outputPaths);
|
|
313
|
+
if (commonDistPath === cwd)
|
|
314
|
+
throw new Error(
|
|
315
|
+
"all output files must share a common parent directory which is not the root package directory"
|
|
316
|
+
);
|
|
317
|
+
if (commonDistPath && !pathContains(cwd, commonDistPath))
|
|
318
|
+
throw new Error("all output files must be located within the package");
|
|
319
|
+
const configDistPath = config2?.dist ? path__default.default.resolve(cwd, config2.dist) : void 0;
|
|
320
|
+
if (configDistPath && commonDistPath && configDistPath !== commonDistPath && !pathContains(configDistPath, commonDistPath))
|
|
321
|
+
throw logger2.log(`did you mean to configure \`dist: './${path__default.default.relative(cwd, commonDistPath)}'\`?`), new Error("all output files must be located with the configured `dist` path");
|
|
322
|
+
const distPath = configDistPath || commonDistPath;
|
|
323
|
+
if (!distPath)
|
|
324
|
+
throw new Error("could not detect `dist` path");
|
|
325
|
+
return {
|
|
326
|
+
config: config2,
|
|
327
|
+
cwd,
|
|
328
|
+
distPath,
|
|
329
|
+
emitDeclarationOnly,
|
|
330
|
+
exports: exports2,
|
|
331
|
+
external,
|
|
332
|
+
extMap,
|
|
333
|
+
files: [],
|
|
334
|
+
logger: logger2,
|
|
335
|
+
pkg,
|
|
336
|
+
runtime: config2?.runtime ?? "*",
|
|
337
|
+
strict,
|
|
338
|
+
target,
|
|
339
|
+
ts: {
|
|
340
|
+
config: tsconfig,
|
|
341
|
+
configPath: tsconfigPath
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function createConsoleSpy(options) {
|
|
346
|
+
const { onRestored } = options || {}, original = {
|
|
347
|
+
log: console.log,
|
|
348
|
+
warn: console.warn,
|
|
349
|
+
error: console.error
|
|
350
|
+
}, messages = [];
|
|
351
|
+
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 }), {
|
|
352
|
+
messages,
|
|
353
|
+
restore: () => {
|
|
354
|
+
console.log = original.log, console.warn = original.warn, console.error = original.error, onRestored?.(messages);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
exports.DEFAULT_BROWSERSLIST_QUERY = DEFAULT_BROWSERSLIST_QUERY;
|
|
359
|
+
exports.DEFAULT_PKG_EXT_MAP = DEFAULT_PKG_EXT_MAP;
|
|
360
|
+
exports.createConsoleSpy = createConsoleSpy;
|
|
361
|
+
exports.getPkgExtMap = getPkgExtMap;
|
|
362
|
+
exports.loadConfig = loadConfig;
|
|
363
|
+
exports.loadPkg = loadPkg;
|
|
364
|
+
exports.loadPkgWithReporting = loadPkgWithReporting;
|
|
365
|
+
exports.loadTSConfig = loadTSConfig;
|
|
366
|
+
exports.parseExports = parseExports;
|
|
367
|
+
exports.resolveBuildContext = resolveBuildContext;
|
|
368
|
+
exports.resolveConfigProperty = resolveConfigProperty;
|
|
369
|
+
//# sourceMappingURL=consoleSpy-1_g1SPGc.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consoleSpy-DnlN7UBk.cjs","sources":["../../src/node/core/config/findConfigFile.ts","../../src/node/core/config/loadConfig.ts","../../src/node/core/config/resolveConfigProperty.ts","../../src/node/core/defaults.ts","../../src/node/core/pkg/loadPkg.ts","../../src/node/core/pkg/helpers.ts","../../src/node/core/pkg/loadPkgWithReporting.ts","../../src/node/core/pkg/validateExports.ts","../../src/node/core/pkg/parseExports.ts","../../src/node/core/pkg/pkgExt.ts","../../src/node/core/ts/loadTSConfig.ts","../../node_modules/.pnpm/browserslist-to-esbuild@2.1.1_browserslist@4.23.0/node_modules/browserslist-to-esbuild/src/index.js","../../src/node/core/findCommonPath.ts","../../src/node/resolveBrowserTarget.ts","../../src/node/resolveNodeTarget.ts","../../src/node/resolveBuildContext.ts","../../src/node/consoleSpy.ts"],"sourcesContent":["import findConfig from 'find-config'\nimport path from 'path'\n\nimport {fileExists} from '../../fileExists'\n\nconst CONFIG_FILE_NAMES = [\n 'package.config.ts',\n 'package.config.js',\n 'package.config.cjs',\n 'package.config.mjs',\n]\n\n/** @internal */\nexport function findConfigFile(cwd: string): string | undefined {\n const pkgJsonPath = findConfig('package.json', {cwd})\n\n if (!pkgJsonPath) return undefined\n\n const pkgPath = path.dirname(pkgJsonPath)\n\n for (const fileName of CONFIG_FILE_NAMES) {\n const configPath = path.resolve(pkgPath, fileName)\n\n const exists = fileExists(configPath)\n\n if (exists) {\n return configPath\n }\n }\n\n return undefined\n}\n","import {register} from 'esbuild-register/dist/node'\nimport path from 'path'\nimport pkgUp from 'pkg-up'\n\nimport {findConfigFile} from './findConfigFile'\nimport {PkgConfigOptions} from './types'\n\n/** @internal */\nexport async function loadConfig(options: {cwd: string}): Promise<PkgConfigOptions | undefined> {\n const {cwd} = options\n\n const pkgPath = await pkgUp({cwd})\n\n if (!pkgPath) return undefined\n\n const root = path.dirname(pkgPath)\n\n const configFile = await findConfigFile(root)\n\n if (!configFile) {\n return undefined\n }\n\n // Do not accept config files outside of the root\n if (!configFile.startsWith(cwd)) {\n return undefined\n }\n\n const esbuildOptions = {extensions: ['.js', '.mjs', '.ts']}\n\n const {unregister} = globalThis.__DEV__ ? {unregister: () => undefined} : register(esbuildOptions)\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(configFile)\n\n unregister()\n\n return mod?.default || mod || undefined\n}\n","import {PkgConfigProperty, PkgConfigPropertyResolver} from './types'\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 (typeof prop === 'function') {\n return (prop as PkgConfigPropertyResolver<T>)(initialValue)\n }\n\n return prop\n}\n","import config from '@sanity/browserslist-config'\n\n/** @public */\nexport const DEFAULT_BROWSERSLIST_QUERY = config\n","import fs from 'fs/promises'\nimport pkgUp from 'pkg-up'\n\nimport {PackageJSON} from './types'\nimport {validatePkg} from './validatePkg'\n\n/** @internal */\nexport async function loadPkg(options: {cwd: string}): Promise<PackageJSON> {\n const {cwd} = options\n\n const pkgPath = await pkgUp({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","/** @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 chalk from 'chalk'\nimport {ZodError} from 'zod'\n\nimport {Logger} from '../../logger'\nimport {assertFirst, assertLast, assertOrder} from './helpers'\nimport {loadPkg} from './loadPkg'\nimport {PackageJSON} from './types'\n\n/** @internal */\nexport async function loadPkgWithReporting(options: {\n cwd: string\n logger: Logger\n}): Promise<PackageJSON> {\n const {cwd, logger} = options\n\n try {\n const pkg = await loadPkg({cwd})\n let shouldError = false\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') {\n continue\n }\n\n const keys = Object.keys(exp)\n\n if (!assertFirst('types', keys)) {\n shouldError = true\n logger.error(`exports[\"${expPath}\"]: the \\`types\\` property should be the first property`)\n }\n\n if (exp.node) {\n const nodeKeys = Object.keys(exp.node)\n\n if (!assertOrder('module', 'import', nodeKeys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.module\\` property should come before the \\`node.import\\` property`,\n )\n }\n\n if (!assertOrder('import', 'require', nodeKeys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`node.import\\` property should come before the \\`node.require\\` property`,\n )\n }\n\n if (!assertOrder('module', 'require', nodeKeys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`node.module\\` property should come before \\`node.require\\` property`,\n )\n }\n\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.module && exp.node.module && !assertOrder('node', 'module', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before the \\`module\\` property`,\n )\n }\n\n if (\n exp.node.import &&\n !exp.node.require &&\n exp.node.module &&\n exp.import &&\n exp.node.module !== exp.import\n ) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.module\\` property should match \\`import\\``,\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 if (!assertOrder('module', 'import', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`module\\` property should come before \\`import\\` 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 {PkgExport} from '../config'\nimport {PkgExtMap} from './pkgExt'\nimport {PackageJSON} from './types'\n\nexport function validateExports(\n _exports: (PkgExport & {_path: string})[],\n options: {extMap: PkgExtMap; pkg: PackageJSON},\n): string[] {\n const {extMap, pkg} = options\n const ext = extMap[pkg.type || 'commonjs']\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: \"${pkg.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: \"${pkg.type}\"\\` - \\`exports[\"${exp._path}\"].import\\` must end with \"${ext.esm}\"`,\n )\n }\n }\n\n return errors\n}\n","import {PkgExport} from '../config'\nimport {isRecord} from '../isRecord'\nimport {PkgExtMap} from './pkgExt'\nimport {PackageJSON} from './types'\nimport {validateExports} from './validateExports'\n\n/** @internal */\nexport function parseExports(options: {\n extMap: PkgExtMap\n pkg: PackageJSON\n strict: boolean\n}): (PkgExport & {_path: string})[] {\n const {extMap, pkg, strict} = options\n\n const rootExport: PkgExport & {_path: string} = {\n _exported: true,\n _path: '.',\n types: pkg.types,\n source: pkg.source || '',\n browser: pkg.browser && {\n source: pkg.source || '',\n require: pkg.main && pkg.browser[pkg.main],\n import: pkg.module && pkg.browser[pkg.module],\n },\n require: pkg.main,\n import: pkg.module,\n default: pkg.module || pkg.main || '',\n }\n\n const extraExports: (PkgExport & {_path: string})[] = []\n\n const errors: string[] = []\n\n if (pkg.exports) {\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 (exportPath.endsWith('.json')) {\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 (isRecord(exportEntry)) {\n if (exportPath === '.') {\n if (\n exportEntry.require &&\n rootExport.require &&\n exportEntry.require !== rootExport.require\n ) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exportEntry.import && rootExport.import && exportEntry.import !== rootExport.import) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\" These must be equal.',\n )\n }\n\n if (exportEntry.types && rootExport.types && exportEntry.types !== rootExport.types) {\n errors.push(\n 'package.json: mismatch between \"types\" and \"exports.types\". These must be equal.',\n )\n }\n\n if (exportEntry.source && rootExport.source && exportEntry.source !== rootExport.source) {\n errors.push(\n 'package.json: mismatch between \"source\" and \"exports.source\". These must be equal.',\n )\n }\n\n Object.assign(rootExport, exportEntry)\n } else {\n const extraExport: PkgExport & {_path: string} = {\n _exported: true,\n _path: exportPath,\n ...exportEntry,\n }\n\n extraExports.push(extraExport)\n }\n } else {\n errors.push('package.json: exports must be an object')\n }\n }\n }\n\n const _exports = [rootExport, ...extraExports]\n\n errors.push(...validateExports(_exports, {extMap, pkg}))\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n return _exports\n}\n","/** @internal */\nexport interface PkgExtMap {\n commonjs: {commonjs: string; esm: string}\n module: {commonjs: string; esm: string}\n}\n\n/** @internal */\nexport const DEFAULT_PKG_EXT_MAP: PkgExtMap = {\n // pkg.type: \"commonjs\"\n commonjs: {\n commonjs: '.js',\n esm: '.mjs',\n },\n\n // pkg.type: \"module\"\n module: {\n commonjs: '.cjs',\n esm: '.js',\n },\n}\n\n/** @internal */\nexport function getPkgExtMap(options: {legacyExports: boolean}): PkgExtMap {\n const {legacyExports} = options\n\n const ret = {...DEFAULT_PKG_EXT_MAP}\n\n // Fall back to legacy file extensions for package.json with `\"type\": \"commonjs\"`\n // NOTE: Not supported by Node 14+ and will be removed in a future version\n if (legacyExports) {\n ret['commonjs'] = {\n commonjs: '.js',\n esm: '.esm.js',\n }\n }\n\n return ret\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 const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n\n if (!configPath) {\n return undefined\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd)\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 path from '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","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 browserslistToEsbuild from 'browserslist-to-esbuild'\nimport path from 'path'\n\nimport {\n BuildContext,\n DEFAULT_BROWSERSLIST_QUERY,\n loadTSConfig,\n PackageJSON,\n parseExports,\n PkgConfigOptions,\n PkgExports,\n PkgExtMap,\n PkgRuntime,\n resolveConfigProperty,\n} from './core'\nimport {findCommonDirPath, pathContains} from './core/findCommonPath'\nimport {Logger} from './logger'\nimport {resolveBrowserTarget} from './resolveBrowserTarget'\nimport {resolveNodeTarget} from './resolveNodeTarget'\n\nexport async function resolveBuildContext(options: {\n config?: PkgConfigOptions\n cwd: string\n emitDeclarationOnly?: boolean\n extMap: PkgExtMap\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 extMap,\n logger,\n pkg,\n strict,\n tsconfig: tsconfigPath,\n } = options\n const tsconfig = await loadTSConfig({cwd, tsconfigPath})\n\n /* eslint-disable padding-line-between-statements */\n let browserslist = pkg.browserslist\n if (strict && !browserslist) {\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 browserslist = DEFAULT_BROWSERSLIST_QUERY\n }\n const targetVersions = browserslistToEsbuild(browserslist)\n /* eslint-enable padding-line-between-statements */\n\n if (strict && typeof pkg.sideEffects === 'undefined') {\n logger.error(\n 'No `sideEffects` field in `package.json`, assuming all files are side-effectful. Add `\"sideEffects\": true` to silence this warning. See https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects for how to define `sideEffects`.',\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({extMap, pkg, strict}).reduce<PkgExports>((acc, x) => {\n const {_path: exportPath, ...exportEntry} = x\n\n return {...acc, [exportPath]: exportEntry}\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\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(Boolean) as string[]\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 extMap,\n files: [],\n logger,\n pkg,\n runtime: config?.runtime ?? '*',\n strict,\n target,\n ts: {\n config: tsconfig,\n configPath: tsconfigPath,\n },\n }\n\n return ctx\n}\n","/* eslint-disable no-console */\n\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"],"names":["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AAO,IAAI,IAAoB,KAAA,QAAA,CAAS,KAAK,EAAC,IAAA,EAAM,MAAQ,EAAA,IAAA,EAAK,CAAA,CAAA;AACzE,EAAQ,OAAA,CAAA,KAAA,GAAQ,IAAI,IAAoB,KAAA,QAAA,CAAS,KAAK,EAAC,IAAA,EAAM,OAAS,EAAA,IAAA,EAAK,CAAA,CAAA;AAE3E,EAAO,OAAA;AAAA,IACL,QAAA;AAAA,IACA,SAAS,MAAM;AACb,MAAA,OAAA,CAAQ,MAAM,QAAS,CAAA,GAAA,CAAA;AACvB,MAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,IAAA,CAAA;AACxB,MAAA,OAAA,CAAQ,QAAQ,QAAS,CAAA,KAAA,CAAA;AAEzB,MAAA,UAAA,GAAa,QAAQ,CAAA,CAAA;AAAA,KACvB;AAAA,GACF,CAAA;AACF;;;;;;;;;;;;;;","x_google_ignoreList":[11]}
|
|
1
|
+
{"version":3,"file":"consoleSpy-1_g1SPGc.cjs","sources":["../../src/node/core/config/findConfigFile.ts","../../src/node/core/config/loadConfig.ts","../../src/node/core/config/resolveConfigProperty.ts","../../src/node/core/defaults.ts","../../src/node/core/pkg/loadPkg.ts","../../src/node/core/pkg/helpers.ts","../../src/node/core/pkg/loadPkgWithReporting.ts","../../src/node/core/pkg/validateExports.ts","../../src/node/core/pkg/parseExports.ts","../../src/node/core/pkg/pkgExt.ts","../../src/node/core/ts/loadTSConfig.ts","../../node_modules/.pnpm/browserslist-to-esbuild@2.1.1_browserslist@4.23.0/node_modules/browserslist-to-esbuild/src/index.js","../../src/node/core/findCommonPath.ts","../../src/node/resolveBrowserTarget.ts","../../src/node/resolveNodeTarget.ts","../../src/node/resolveBuildContext.ts","../../src/node/consoleSpy.ts"],"sourcesContent":["import findConfig from 'find-config'\nimport path from 'path'\n\nimport {fileExists} from '../../fileExists'\n\nconst CONFIG_FILE_NAMES = [\n 'package.config.ts',\n 'package.config.js',\n 'package.config.cjs',\n 'package.config.mjs',\n]\n\n/** @internal */\nexport function findConfigFile(cwd: string): string | undefined {\n const pkgJsonPath = findConfig('package.json', {cwd})\n\n if (!pkgJsonPath) return undefined\n\n const pkgPath = path.dirname(pkgJsonPath)\n\n for (const fileName of CONFIG_FILE_NAMES) {\n const configPath = path.resolve(pkgPath, fileName)\n\n const exists = fileExists(configPath)\n\n if (exists) {\n return configPath\n }\n }\n\n return undefined\n}\n","import {register} from 'esbuild-register/dist/node'\nimport path from 'path'\nimport pkgUp from 'pkg-up'\n\nimport {findConfigFile} from './findConfigFile'\nimport {PkgConfigOptions} from './types'\n\n/** @internal */\nexport async function loadConfig(options: {cwd: string}): Promise<PkgConfigOptions | undefined> {\n const {cwd} = options\n\n const pkgPath = await pkgUp({cwd})\n\n if (!pkgPath) return undefined\n\n const root = path.dirname(pkgPath)\n\n const configFile = await findConfigFile(root)\n\n if (!configFile) {\n return undefined\n }\n\n // Do not accept config files outside of the root\n if (!configFile.startsWith(cwd)) {\n return undefined\n }\n\n const esbuildOptions = {extensions: ['.js', '.mjs', '.ts']}\n\n const {unregister} = globalThis.__DEV__ ? {unregister: () => undefined} : register(esbuildOptions)\n\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const mod = require(configFile)\n\n unregister()\n\n return mod?.default || mod || undefined\n}\n","import {PkgConfigProperty, PkgConfigPropertyResolver} from './types'\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 (typeof prop === 'function') {\n return (prop as PkgConfigPropertyResolver<T>)(initialValue)\n }\n\n return prop\n}\n","import config from '@sanity/browserslist-config'\n\n/** @public */\nexport const DEFAULT_BROWSERSLIST_QUERY = config\n","import fs from 'fs/promises'\nimport pkgUp from 'pkg-up'\n\nimport {PackageJSON} from './types'\nimport {validatePkg} from './validatePkg'\n\n/** @internal */\nexport async function loadPkg(options: {cwd: string}): Promise<PackageJSON> {\n const {cwd} = options\n\n const pkgPath = await pkgUp({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","/** @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 chalk from 'chalk'\nimport {ZodError} from 'zod'\n\nimport {Logger} from '../../logger'\nimport {assertFirst, assertLast, assertOrder} from './helpers'\nimport {loadPkg} from './loadPkg'\nimport {PackageJSON} from './types'\n\n/** @internal */\nexport async function loadPkgWithReporting(options: {\n cwd: string\n logger: Logger\n}): Promise<PackageJSON> {\n const {cwd, logger} = options\n\n try {\n const pkg = await loadPkg({cwd})\n let shouldError = false\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') {\n continue\n }\n\n const keys = Object.keys(exp)\n\n if (!assertFirst('types', keys)) {\n shouldError = true\n logger.error(`exports[\"${expPath}\"]: the \\`types\\` property should be the first property`)\n }\n\n if (exp.node) {\n const nodeKeys = Object.keys(exp.node)\n\n if (!assertOrder('module', 'import', nodeKeys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.module\\` property should come before the \\`node.import\\` property`,\n )\n }\n\n if (!assertOrder('import', 'require', nodeKeys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`node.import\\` property should come before the \\`node.require\\` property`,\n )\n }\n\n if (!assertOrder('module', 'require', nodeKeys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`node.module\\` property should come before \\`node.require\\` property`,\n )\n }\n\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.module && exp.node.module && !assertOrder('node', 'module', keys)) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node\\` property should come before the \\`module\\` property`,\n )\n }\n\n if (\n exp.node.import &&\n !exp.node.require &&\n exp.node.module &&\n exp.import &&\n exp.node.module !== exp.import\n ) {\n shouldError = true\n logger.error(\n `exports[\"${expPath}\"]: the \\`node.module\\` property should match \\`import\\``,\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 if (!assertOrder('module', 'import', keys)) {\n logger.warn(\n `exports[\"${expPath}\"]: the \\`module\\` property should come before \\`import\\` 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 {PkgExport} from '../config'\nimport {PkgExtMap} from './pkgExt'\nimport {PackageJSON} from './types'\n\nexport function validateExports(\n _exports: (PkgExport & {_path: string})[],\n options: {extMap: PkgExtMap; pkg: PackageJSON},\n): string[] {\n const {extMap, pkg} = options\n const ext = extMap[pkg.type || 'commonjs']\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: \"${pkg.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: \"${pkg.type}\"\\` - \\`exports[\"${exp._path}\"].import\\` must end with \"${ext.esm}\"`,\n )\n }\n }\n\n return errors\n}\n","import {PkgExport} from '../config'\nimport {isRecord} from '../isRecord'\nimport {PkgExtMap} from './pkgExt'\nimport {PackageJSON} from './types'\nimport {validateExports} from './validateExports'\n\n/** @internal */\nexport function parseExports(options: {\n extMap: PkgExtMap\n pkg: PackageJSON\n strict: boolean\n}): (PkgExport & {_path: string})[] {\n const {extMap, pkg, strict} = options\n\n const rootExport: PkgExport & {_path: string} = {\n _exported: true,\n _path: '.',\n types: pkg.types,\n source: pkg.source || '',\n browser: pkg.browser && {\n source: pkg.source || '',\n require: pkg.main && pkg.browser[pkg.main],\n import: pkg.module && pkg.browser[pkg.module],\n },\n require: pkg.main,\n import: pkg.module,\n default: pkg.module || pkg.main || '',\n }\n\n const extraExports: (PkgExport & {_path: string})[] = []\n\n const errors: string[] = []\n\n if (pkg.exports) {\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 (exportPath.endsWith('.json')) {\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 (isRecord(exportEntry)) {\n if (exportPath === '.') {\n if (\n exportEntry.require &&\n rootExport.require &&\n exportEntry.require !== rootExport.require\n ) {\n errors.push(\n 'package.json: mismatch between \"main\" and \"exports.require\". These must be equal.',\n )\n }\n\n if (exportEntry.import && rootExport.import && exportEntry.import !== rootExport.import) {\n errors.push(\n 'package.json: mismatch between \"module\" and \"exports.import\" These must be equal.',\n )\n }\n\n if (exportEntry.types && rootExport.types && exportEntry.types !== rootExport.types) {\n errors.push(\n 'package.json: mismatch between \"types\" and \"exports.types\". These must be equal.',\n )\n }\n\n if (exportEntry.source && rootExport.source && exportEntry.source !== rootExport.source) {\n errors.push(\n 'package.json: mismatch between \"source\" and \"exports.source\". These must be equal.',\n )\n }\n\n Object.assign(rootExport, exportEntry)\n } else {\n const extraExport: PkgExport & {_path: string} = {\n _exported: true,\n _path: exportPath,\n ...exportEntry,\n }\n\n extraExports.push(extraExport)\n }\n } else {\n errors.push('package.json: exports must be an object')\n }\n }\n }\n\n const _exports = [rootExport, ...extraExports]\n\n errors.push(...validateExports(_exports, {extMap, pkg}))\n\n if (errors.length) {\n throw new Error('\\n- ' + errors.join('\\n- '))\n }\n\n return _exports\n}\n","/** @internal */\nexport interface PkgExtMap {\n commonjs: {commonjs: string; esm: string}\n module: {commonjs: string; esm: string}\n}\n\n/** @internal */\nexport const DEFAULT_PKG_EXT_MAP: PkgExtMap = {\n // pkg.type: \"commonjs\"\n commonjs: {\n commonjs: '.js',\n esm: '.mjs',\n },\n\n // pkg.type: \"module\"\n module: {\n commonjs: '.cjs',\n esm: '.js',\n },\n}\n\n/** @internal */\nexport function getPkgExtMap(options: {legacyExports: boolean}): PkgExtMap {\n const {legacyExports} = options\n\n const ret = {...DEFAULT_PKG_EXT_MAP}\n\n // Fall back to legacy file extensions for package.json with `\"type\": \"commonjs\"`\n // NOTE: Not supported by Node 14+ and will be removed in a future version\n if (legacyExports) {\n ret['commonjs'] = {\n commonjs: '.js',\n esm: '.esm.js',\n }\n }\n\n return ret\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 const configPath = ts.findConfigFile(cwd, ts.sys.fileExists, tsconfigPath)\n\n if (!configPath) {\n return undefined\n }\n\n const configFile = ts.readConfigFile(configPath, ts.sys.readFile)\n\n return ts.parseJsonConfigFileContent(configFile.config, ts.sys, cwd)\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 path from '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","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 browserslistToEsbuild from 'browserslist-to-esbuild'\nimport path from 'path'\n\nimport {\n BuildContext,\n DEFAULT_BROWSERSLIST_QUERY,\n loadTSConfig,\n PackageJSON,\n parseExports,\n PkgConfigOptions,\n PkgExports,\n PkgExtMap,\n PkgRuntime,\n resolveConfigProperty,\n} from './core'\nimport {findCommonDirPath, pathContains} from './core/findCommonPath'\nimport {Logger} from './logger'\nimport {resolveBrowserTarget} from './resolveBrowserTarget'\nimport {resolveNodeTarget} from './resolveNodeTarget'\n\nexport async function resolveBuildContext(options: {\n config?: PkgConfigOptions\n cwd: string\n emitDeclarationOnly?: boolean\n extMap: PkgExtMap\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 extMap,\n logger,\n pkg,\n strict,\n tsconfig: tsconfigPath,\n } = options\n const tsconfig = await loadTSConfig({cwd, tsconfigPath})\n\n /* eslint-disable padding-line-between-statements */\n let browserslist = pkg.browserslist\n if (strict && !browserslist) {\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 browserslist = DEFAULT_BROWSERSLIST_QUERY\n }\n const targetVersions = browserslistToEsbuild(browserslist)\n /* eslint-enable padding-line-between-statements */\n\n if (strict && typeof pkg.sideEffects === 'undefined') {\n logger.error(\n 'No `sideEffects` field in `package.json`, assuming all files are side-effectful. Add `\"sideEffects\": true` to silence this warning. See https://webpack.js.org/guides/tree-shaking/#clarifying-tree-shaking-and-sideeffects for how to define `sideEffects`.',\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({extMap, pkg, strict}).reduce<PkgExports>((acc, x) => {\n const {_path: exportPath, ...exportEntry} = x\n\n return {...acc, [exportPath]: exportEntry}\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\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(Boolean) as string[]\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 extMap,\n files: [],\n logger,\n pkg,\n runtime: config?.runtime ?? '*',\n strict,\n target,\n ts: {\n config: tsconfig,\n configPath: tsconfigPath,\n },\n }\n\n return ctx\n}\n","/* eslint-disable no-console */\n\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"],"names":["findConfig","path","fileExists","pkgUp","register","config","fs","validatePkg","logger","ZodError","chalk","isRecord","ts","browserslist","exports"],"mappings":";;;;;;;;;;;AAKA,MAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,SAAS,eAAe,KAAiC;AAC9D,QAAM,cAAcA,oBAAA,QAAW,gBAAgB,EAAC,IAAI,CAAA;AAEpD,MAAI,CAAC;AAAa;AAEZ,QAAA,UAAUC,cAAAA,QAAK,QAAQ,WAAW;AAExC,aAAW,YAAY,mBAAmB;AACxC,UAAM,aAAaA,cAAA,QAAK,QAAQ,SAAS,QAAQ;AAIjD,QAFeC,OAAAA,WAAW,UAAU;AAG3B,aAAA;AAAA,EAEX;AAGF;ACvBA,eAAsB,WAAW,SAA+D;AACxF,QAAA,EAAC,IAAO,IAAA,SAER,UAAU,MAAMC,uBAAM,EAAC,IAAA,CAAI;AAEjC,MAAI,CAAC;AAAS;AAER,QAAA,OAAOF,sBAAK,QAAQ,OAAO,GAE3B,aAAa,MAAM,eAAe,IAAI;AAO5C,MALI,CAAC,cAKD,CAAC,WAA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AK,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;;;;;;;;;;;;","x_google_ignoreList":[11]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var chalk = require("chalk");
|
|
3
|
+
function _interopDefaultCompat(e) {
|
|
4
|
+
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
5
|
+
}
|
|
6
|
+
var chalk__default = /* @__PURE__ */ _interopDefaultCompat(chalk);
|
|
7
|
+
function handleError(err) {
|
|
8
|
+
err instanceof Error ? console.error(chalk__default.default.red("error"), err.message) : console.error(err), process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
exports.handleError = handleError;
|
|
11
|
+
//# sourceMappingURL=handleError-CGQ2DXMR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleError-CGQ2DXMR.cjs","sources":["../../src/cli/handleError.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport chalk from 'chalk'\n\nexport function handleError(err: unknown): void {\n if (err instanceof Error) {\n console.error(chalk.red('error'), err.message)\n } else {\n console.error(err)\n }\n\n process.exit(1)\n}\n"],"names":["chalk"],"mappings":";;;;;;AAIO,SAAS,YAAY,KAAoB;AAC1C,iBAAe,QACjB,QAAQ,MAAMA,eAAAA,QAAM,IAAI,OAAO,GAAG,IAAI,OAAO,IAE7C,QAAQ,MAAM,GAAG,GAGnB,QAAQ,KAAK,CAAC;AAChB;;"}
|