@maltty/cli 1.0.0-rc.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{_format-CeQhQTl5.js → _format-XTN-U4H5.js} +4 -2
- package/dist/{_format-CeQhQTl5.js.map → _format-XTN-U4H5.js.map} +1 -1
- package/dist/attemptAsync-D_oWcKfe.js +74 -0
- package/dist/attemptAsync-D_oWcKfe.js.map +1 -0
- package/dist/commands/add/command.d.ts +0 -1
- package/dist/commands/add/command.d.ts.map +1 -1
- package/dist/commands/add/command.js +4 -4
- package/dist/commands/add/command.js.map +1 -1
- package/dist/commands/add/config.d.ts +0 -1
- package/dist/commands/add/config.d.ts.map +1 -1
- package/dist/commands/add/config.js +3 -3
- package/dist/commands/add/config.js.map +1 -1
- package/dist/commands/add/index.d.ts +0 -1
- package/dist/commands/add/index.d.ts.map +1 -1
- package/dist/commands/add/index.js.map +1 -1
- package/dist/commands/add/middleware.d.ts +0 -1
- package/dist/commands/add/middleware.d.ts.map +1 -1
- package/dist/commands/add/middleware.js +3 -3
- package/dist/commands/add/middleware.js.map +1 -1
- package/dist/commands/build.d.ts +7 -8
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +3 -3
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/commands.d.ts +6 -7
- package/dist/commands/commands.d.ts.map +1 -1
- package/dist/commands/commands.js +5 -5
- package/dist/commands/commands.js.map +1 -1
- package/dist/commands/dev.d.ts +5 -6
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +3 -3
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +5 -6
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +7 -6
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/run.d.ts +11 -12
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +6 -6
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/stories.d.ts +3 -4
- package/dist/commands/stories.d.ts.map +1 -1
- package/dist/commands/stories.js.map +1 -1
- package/dist/{config-helpers-pv_2Spux.js → config-helpers-DAy-Arox.js} +1 -1
- package/dist/{config-helpers-pv_2Spux.js.map → config-helpers-DAy-Arox.js.map} +1 -1
- package/dist/{defu-BBwssjW3.js → defu-BOMYL43b.js} +1 -13
- package/dist/{defu-BBwssjW3.js.map → defu-BOMYL43b.js.map} +1 -1
- package/dist/{detect-AOq1ehTE.js → detect-Gdceq3rh.js} +4 -4
- package/dist/{detect-AOq1ehTE.js.map → detect-Gdceq3rh.js.map} +1 -1
- package/dist/{dist-Xa07jNxS.js → dist-BGEDDbkB.js} +1430 -859
- package/dist/dist-BGEDDbkB.js.map +1 -0
- package/dist/{dist-DW_gRP7_.js → dist-FY8K5na4.js} +37 -8
- package/dist/dist-FY8K5na4.js.map +1 -0
- package/dist/fs-Uxhr-pvi-AfTuGWmD.js +98 -0
- package/dist/fs-Uxhr-pvi-AfTuGWmD.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/{jiti-CxWlVmZ_.js → jiti-DLiXBetA.js} +15 -10
- package/dist/{jiti-CxWlVmZ_.js.map → jiti-DLiXBetA.js.map} +1 -1
- package/dist/json-DjLTvRvF.js +82 -0
- package/dist/json-DjLTvRvF.js.map +1 -0
- package/dist/{json5-z-PGDMyy.js → json5-Dgws4cj9.js} +22 -8
- package/dist/{json5-z-PGDMyy.js.map → json5-Dgws4cj9.js.map} +1 -1
- package/dist/{jsonc-DqZkfC3S.js → jsonc-B3DUZTiW.js} +9 -15
- package/dist/jsonc-B3DUZTiW.js.map +1 -0
- package/dist/jsonc-BjIiMOLf.js +2 -0
- package/dist/{main-C_8x2aB3.js → main-CMmTVJ4V.js} +2 -2
- package/dist/{main-C_8x2aB3.js.map → main-CMmTVJ4V.js.map} +1 -1
- package/dist/{manifest-BIKVDJML.js → manifest-C192Fk9X.js} +3 -3
- package/dist/{manifest-BIKVDJML.js.map → manifest-C192Fk9X.js.map} +1 -1
- package/dist/{multipart-parser-MNkxNO83.js → multipart-parser-XnJOfY8C.js} +14 -4
- package/dist/{multipart-parser-MNkxNO83.js.map → multipart-parser-XnJOfY8C.js.map} +1 -1
- package/dist/{node-C91xGGqn.js → node-Bbe24r0m.js} +28 -105
- package/dist/node-Bbe24r0m.js.map +1 -0
- package/dist/{node-Drmc03fL.js → node-lkjrm0W1.js} +95 -33
- package/dist/{node-Drmc03fL.js.map → node-lkjrm0W1.js.map} +1 -1
- package/dist/{ohash-BPoV4zBH.js → ohash-Cgvv31gH.js} +5 -3
- package/dist/ohash-Cgvv31gH.js.map +1 -0
- package/dist/pnpm-workspace.yaml +10 -10
- package/dist/{chunk-DsIazq42.js → rolldown-runtime-C7HZzL1F.js} +2 -2
- package/dist/{toml-LuHsHQtV.js → toml-BrfNstp2.js} +34 -3
- package/dist/{toml-LuHsHQtV.js.map → toml-BrfNstp2.js.map} +1 -1
- package/dist/{utils-DlIJNGLQ.js → utils-ioeFEbm4.js} +208 -236
- package/dist/utils-ioeFEbm4.js.map +1 -0
- package/dist/{validate-C_SXBoLq.js → validate-CX8axBK6.js} +1 -1
- package/dist/{validate-C_SXBoLq.js.map → validate-CX8axBK6.js.map} +1 -1
- package/dist/{write-CSwG4Stj.js → write-C6VsyUuc.js} +6 -4
- package/dist/{write-CSwG4Stj.js.map → write-C6VsyUuc.js.map} +1 -1
- package/dist/{yaml-BS9RDuUr.js → yaml-Cp5SldPx.js} +78 -18
- package/dist/yaml-Cp5SldPx.js.map +1 -0
- package/package.json +14 -14
- package/dist/attemptAsync-BdXzRSIT.js +0 -42
- package/dist/attemptAsync-BdXzRSIT.js.map +0 -1
- package/dist/dist-DW_gRP7_.js.map +0 -1
- package/dist/dist-Xa07jNxS.js.map +0 -1
- package/dist/json-D7WbuVK1.js +0 -43
- package/dist/json-D7WbuVK1.js.map +0 -1
- package/dist/jsonc-DqZkfC3S.js.map +0 -1
- package/dist/jsonc-KADMdSjU.js +0 -2
- package/dist/node-C91xGGqn.js.map +0 -1
- package/dist/ohash-BPoV4zBH.js.map +0 -1
- package/dist/utils-DlIJNGLQ.js.map +0 -1
- package/dist/yaml-BS9RDuUr.js.map +0 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { r as __toESM } from "./
|
|
2
|
-
import { i as toError, n as err, r as ok, t as attemptAsync } from "./attemptAsync-
|
|
3
|
-
import { a as isAbsolute$1, i as extname$2, l as resolve$1, n as basename$1, o as join$1, r as dirname$1, s as normalize, t as defu } from "./defu-
|
|
4
|
-
import {
|
|
1
|
+
import { r as __toESM } from "./rolldown-runtime-C7HZzL1F.js";
|
|
2
|
+
import { i as toError, n as err, r as ok, t as attemptAsync } from "./attemptAsync-D_oWcKfe.js";
|
|
3
|
+
import { a as isAbsolute$1, i as extname$2, l as resolve$1, n as basename$1, o as join$1, r as dirname$1, s as normalize, t as defu } from "./defu-BOMYL43b.js";
|
|
4
|
+
import { t as a } from "./_format-XTN-U4H5.js";
|
|
5
|
+
import { t as r } from "./jsonc-B3DUZTiW.js";
|
|
5
6
|
import path, { isAbsolute, resolve } from "node:path";
|
|
6
7
|
import { readFile, rm } from "node:fs/promises";
|
|
7
8
|
import { z } from "zod";
|
|
@@ -12,7 +13,6 @@ import { format, inspect } from "node:util";
|
|
|
12
13
|
import { homedir } from "node:os";
|
|
13
14
|
import assert from "node:assert";
|
|
14
15
|
import process$1 from "node:process";
|
|
15
|
-
import v8 from "node:v8";
|
|
16
16
|
//#region ../utils/dist/tag.js
|
|
17
17
|
/**
|
|
18
18
|
* Property key used to brand objects with a tag string.
|
|
@@ -43,7 +43,7 @@ function withTag(obj, tag) {
|
|
|
43
43
|
return copy;
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
-
//#region ../../node_modules/.pnpm/exsolve@1.
|
|
46
|
+
//#region ../../node_modules/.pnpm/exsolve@1.1.1/node_modules/exsolve/dist/index.mjs
|
|
47
47
|
const nodeBuiltins = [
|
|
48
48
|
"_http_agent",
|
|
49
49
|
"_http_client",
|
|
@@ -114,9 +114,8 @@ const nodeBuiltins = [
|
|
|
114
114
|
"worker_threads",
|
|
115
115
|
"zlib"
|
|
116
116
|
];
|
|
117
|
-
const own$1 = {}.hasOwnProperty;
|
|
118
117
|
const classRegExp = /^([A-Z][a-z\d]*)+$/;
|
|
119
|
-
const kTypes = new Set([
|
|
118
|
+
const kTypes = /* @__PURE__ */ new Set([
|
|
120
119
|
"string",
|
|
121
120
|
"function",
|
|
122
121
|
"number",
|
|
@@ -128,83 +127,95 @@ const kTypes = new Set([
|
|
|
128
127
|
"symbol"
|
|
129
128
|
]);
|
|
130
129
|
const messages = /* @__PURE__ */ new Map();
|
|
131
|
-
const nodeInternalPrefix = "__node_internal_";
|
|
132
|
-
let userStackTraceLimit;
|
|
133
|
-
/**
|
|
134
|
-
* Create a list string in the form like 'A and B' or 'A, B, ..., and Z'.
|
|
135
|
-
* We cannot use Intl.ListFormat because it's not available in
|
|
136
|
-
* --without-intl builds.
|
|
137
|
-
*
|
|
138
|
-
* @param {Array<string>} array
|
|
139
|
-
* An array of strings.
|
|
140
|
-
* @param {string} [type]
|
|
141
|
-
* The list type to be inserted before the last element.
|
|
142
|
-
* @returns {string}
|
|
143
|
-
*/
|
|
144
130
|
function formatList(array, type = "and") {
|
|
145
|
-
|
|
131
|
+
switch (array.length) {
|
|
132
|
+
case 0: return "";
|
|
133
|
+
case 1: return `${array[0]}`;
|
|
134
|
+
case 2: return `${array[0]} ${type} ${array[1]}`;
|
|
135
|
+
case 3: return `${array[0]}, ${array[1]}, ${type} ${array[2]}`;
|
|
136
|
+
default: return `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function getExpectedArgumentLength(message) {
|
|
140
|
+
let expectedLength = 0;
|
|
141
|
+
const regex = /%[dfijoOs]/g;
|
|
142
|
+
while (regex.exec(message) !== null) expectedLength++;
|
|
143
|
+
return expectedLength;
|
|
146
144
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Utility function for registering the error codes.
|
|
149
|
-
*/
|
|
150
145
|
function createError(sym, value, constructor) {
|
|
151
146
|
messages.set(sym, value);
|
|
152
147
|
return makeNodeErrorWithCode(constructor, sym);
|
|
153
148
|
}
|
|
149
|
+
const kIsNodeError = Symbol("kIsNodeError");
|
|
154
150
|
function makeNodeErrorWithCode(Base, key) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
const message = messages.get(key);
|
|
152
|
+
const expectedLength = typeof message === "string" ? getExpectedArgumentLength(message) : -1;
|
|
153
|
+
switch (expectedLength) {
|
|
154
|
+
case 0: {
|
|
155
|
+
class NodeError extends Base {
|
|
156
|
+
code = key;
|
|
157
|
+
constructor(...args) {
|
|
158
|
+
assert.ok(args.length === 0, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`);
|
|
159
|
+
super(message);
|
|
160
|
+
}
|
|
161
|
+
get ["constructor"]() {
|
|
162
|
+
return Base;
|
|
163
|
+
}
|
|
164
|
+
get [kIsNodeError]() {
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
toString() {
|
|
170
168
|
return `${this.name} [${key}]: ${this.message}`;
|
|
171
|
-
}
|
|
172
|
-
enumerable: false,
|
|
173
|
-
writable: true,
|
|
174
|
-
configurable: true
|
|
169
|
+
}
|
|
175
170
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
171
|
+
return NodeError;
|
|
172
|
+
}
|
|
173
|
+
case -1: {
|
|
174
|
+
class NodeError extends Base {
|
|
175
|
+
code = key;
|
|
176
|
+
constructor(...args) {
|
|
177
|
+
super();
|
|
178
|
+
Object.defineProperty(this, "message", {
|
|
179
|
+
value: getMessage(key, args, this),
|
|
180
|
+
enumerable: false,
|
|
181
|
+
writable: true,
|
|
182
|
+
configurable: true
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
get ["constructor"]() {
|
|
186
|
+
return Base;
|
|
187
|
+
}
|
|
188
|
+
get [kIsNodeError]() {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
toString() {
|
|
192
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return NodeError;
|
|
196
|
+
}
|
|
197
|
+
default: {
|
|
198
|
+
class NodeError extends Base {
|
|
199
|
+
code = key;
|
|
200
|
+
constructor(...args) {
|
|
201
|
+
assert.ok(args.length === expectedLength, `Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`);
|
|
202
|
+
args.unshift(message);
|
|
203
|
+
super(Reflect.apply(format, null, args));
|
|
204
|
+
}
|
|
205
|
+
get ["constructor"]() {
|
|
206
|
+
return Base;
|
|
207
|
+
}
|
|
208
|
+
get [kIsNodeError]() {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
toString() {
|
|
212
|
+
return `${this.name} [${key}]: ${this.message}`;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return NodeError;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
189
218
|
}
|
|
190
|
-
/**
|
|
191
|
-
* This function removes unnecessary frames from Node.js core errors.
|
|
192
|
-
*/
|
|
193
|
-
function hideStackFrames(wrappedFunction) {
|
|
194
|
-
const hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
195
|
-
Object.defineProperty(wrappedFunction, "name", { value: hidden });
|
|
196
|
-
return wrappedFunction;
|
|
197
|
-
}
|
|
198
|
-
const captureLargerStackTrace = hideStackFrames(function(error) {
|
|
199
|
-
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
200
|
-
if (stackTraceLimitIsWritable) {
|
|
201
|
-
userStackTraceLimit = Error.stackTraceLimit;
|
|
202
|
-
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
203
|
-
}
|
|
204
|
-
Error.captureStackTrace(error);
|
|
205
|
-
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
|
206
|
-
return error;
|
|
207
|
-
});
|
|
208
219
|
function getMessage(key, parameters, self) {
|
|
209
220
|
const message = messages.get(key);
|
|
210
221
|
assert.ok(message !== void 0, "expected `message` to be found");
|
|
@@ -212,27 +223,42 @@ function getMessage(key, parameters, self) {
|
|
|
212
223
|
assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
|
|
213
224
|
return Reflect.apply(message, self, parameters);
|
|
214
225
|
}
|
|
215
|
-
const
|
|
216
|
-
let expectedLength = 0;
|
|
217
|
-
while (regex.exec(message) !== null) expectedLength++;
|
|
226
|
+
const expectedLength = getExpectedArgumentLength(message);
|
|
218
227
|
assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
|
|
219
228
|
if (parameters.length === 0) return message;
|
|
220
229
|
parameters.unshift(message);
|
|
221
230
|
return Reflect.apply(format, null, parameters);
|
|
222
231
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Determine the specific type of a value for type-mismatch errors.
|
|
225
|
-
*/
|
|
226
232
|
function determineSpecificType(value) {
|
|
227
|
-
if (value === null
|
|
228
|
-
if (
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
if (value === null) return "null";
|
|
234
|
+
else if (value === void 0) return "undefined";
|
|
235
|
+
const type = typeof value;
|
|
236
|
+
switch (type) {
|
|
237
|
+
case "bigint": return `type bigint (${value}n)`;
|
|
238
|
+
case "number":
|
|
239
|
+
if (value === 0) return 1 / value === Number.NEGATIVE_INFINITY ? "type number (-0)" : "type number (0)";
|
|
240
|
+
else if (Number.isNaN(value)) return "type number (NaN)";
|
|
241
|
+
else if (value === Number.POSITIVE_INFINITY) return "type number (Infinity)";
|
|
242
|
+
else if (value === Number.NEGATIVE_INFINITY) return "type number (-Infinity)";
|
|
243
|
+
return `type number (${value})`;
|
|
244
|
+
case "boolean": return value ? "type boolean (true)" : "type boolean (false)";
|
|
245
|
+
case "symbol": return `type symbol (${String(value)})`;
|
|
246
|
+
case "function": return `function ${value.name}`;
|
|
247
|
+
case "object":
|
|
248
|
+
if (value.constructor && value.constructor.name) return `an instance of ${value.constructor.name}`;
|
|
249
|
+
return `${inspect(value, { depth: -1 })}`;
|
|
250
|
+
case "string": {
|
|
251
|
+
let string = value;
|
|
252
|
+
if (string.length > 28) string = `${string.slice(0, 25)}...`;
|
|
253
|
+
if (!string.includes("'")) return `type string ('${string}')`;
|
|
254
|
+
return `type string (${JSON.stringify(string)})`;
|
|
255
|
+
}
|
|
256
|
+
default: {
|
|
257
|
+
let inspected = inspect(value, { colors: false });
|
|
258
|
+
if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
|
|
259
|
+
return `type ${type} (${inspected})`;
|
|
260
|
+
}
|
|
232
261
|
}
|
|
233
|
-
let inspected = inspect(value, { colors: false });
|
|
234
|
-
if (inspected.length > 28) inspected = `${inspected.slice(0, 25)}...`;
|
|
235
|
-
return `type ${typeof value} (${inspected})`;
|
|
236
262
|
}
|
|
237
263
|
createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
238
264
|
assert.ok(typeof name === "string", "'name' must be a string");
|
|
@@ -258,7 +284,7 @@ createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
|
258
284
|
if (instances.length > 0) {
|
|
259
285
|
const pos = types.indexOf("object");
|
|
260
286
|
if (pos !== -1) {
|
|
261
|
-
types.
|
|
287
|
+
types.splice(pos, 1);
|
|
262
288
|
instances.push("Object");
|
|
263
289
|
}
|
|
264
290
|
}
|
|
@@ -278,20 +304,11 @@ createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
|
278
304
|
message += `. Received ${determineSpecificType(actual)}`;
|
|
279
305
|
return message;
|
|
280
306
|
}, TypeError);
|
|
281
|
-
const ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
282
|
-
"
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* @param {string} [base]
|
|
287
|
-
*/
|
|
288
|
-
(request, reason, base) => {
|
|
289
|
-
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
290
|
-
},
|
|
291
|
-
TypeError
|
|
292
|
-
);
|
|
293
|
-
const ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => {
|
|
294
|
-
return `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
307
|
+
const ERR_INVALID_MODULE_SPECIFIER = createError("ERR_INVALID_MODULE_SPECIFIER", (request, reason, base) => {
|
|
308
|
+
return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
|
309
|
+
}, TypeError);
|
|
310
|
+
const ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path, base, message) => {
|
|
311
|
+
return `Invalid package config ${path}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
|
295
312
|
}, Error);
|
|
296
313
|
const ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = false, base) => {
|
|
297
314
|
const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
@@ -301,30 +318,24 @@ const ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (pa
|
|
|
301
318
|
}
|
|
302
319
|
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? "; targets must start with \"./\"" : ""}`;
|
|
303
320
|
}, Error);
|
|
304
|
-
const ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path
|
|
305
|
-
|
|
321
|
+
const ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", function(path, base, exactUrl = false) {
|
|
322
|
+
if (exactUrl && typeof exactUrl === "string") this.url = `${exactUrl}`;
|
|
323
|
+
return `Cannot find ${exactUrl ? "module" : "package"} '${path}' imported from ${base}`;
|
|
306
324
|
}, Error);
|
|
307
|
-
createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error);
|
|
308
325
|
const ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => {
|
|
309
326
|
return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`;
|
|
310
327
|
}, TypeError);
|
|
311
|
-
const ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
312
|
-
"
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
320
|
-
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
321
|
-
},
|
|
322
|
-
Error
|
|
323
|
-
);
|
|
324
|
-
const ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error);
|
|
328
|
+
const ERR_PACKAGE_PATH_NOT_EXPORTED = createError("ERR_PACKAGE_PATH_NOT_EXPORTED", (packagePath, subpath, base) => {
|
|
329
|
+
if (subpath === ".") return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
330
|
+
return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
|
331
|
+
}, Error);
|
|
332
|
+
const ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", function(path, base, exactUrl = void 0) {
|
|
333
|
+
this.url = exactUrl;
|
|
334
|
+
return `Directory import '${path}' is not supported resolving ES modules imported from ${base}`;
|
|
335
|
+
}, Error);
|
|
325
336
|
const ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", "Failed to resolve module specifier \"%s\" from \"%s\": Invalid relative URL or base scheme is not hierarchical.", TypeError);
|
|
326
|
-
const ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path
|
|
327
|
-
return `Unknown file extension "${extension}" for ${path
|
|
337
|
+
const ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path) => {
|
|
338
|
+
return `Unknown file extension "${extension}" for ${path}`;
|
|
328
339
|
}, TypeError);
|
|
329
340
|
createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
|
|
330
341
|
let inspected = inspect(value);
|
|
@@ -405,33 +416,25 @@ const protocolHandlers = {
|
|
|
405
416
|
"node:": () => "builtin"
|
|
406
417
|
};
|
|
407
418
|
function mimeToFormat(mime) {
|
|
408
|
-
if (mime &&
|
|
419
|
+
if (mime && /^\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?$/i.test(mime)) return "module";
|
|
409
420
|
if (mime === "application/json") return "json";
|
|
410
421
|
return null;
|
|
411
422
|
}
|
|
412
423
|
function getDataProtocolModuleFormat(parsed) {
|
|
413
|
-
const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(parsed.pathname) || [
|
|
424
|
+
const { 1: mime } = /^([^/]+\/[^;,]+)(?:[^,]*?)(;base64)?,/.exec(parsed.pathname) || [
|
|
414
425
|
null,
|
|
415
426
|
null,
|
|
416
427
|
null
|
|
417
428
|
];
|
|
418
429
|
return mimeToFormat(mime);
|
|
419
430
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
*
|
|
423
|
-
* Should give similar result to
|
|
424
|
-
* `require('node:path').extname(require('node:url').fileURLToPath(url))`
|
|
425
|
-
* when used with a `file:` URL.
|
|
426
|
-
*
|
|
427
|
-
*/
|
|
431
|
+
const DOT_CODE = 46;
|
|
432
|
+
const SLASH_CODE = 47;
|
|
428
433
|
function extname$1(url) {
|
|
429
434
|
const pathname = url.pathname;
|
|
430
|
-
let
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (code === 47) return "";
|
|
434
|
-
if (code === 46) return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
|
|
435
|
+
for (let i = pathname.length - 1; i > 0; i--) switch (pathname.charCodeAt(i)) {
|
|
436
|
+
case SLASH_CODE: return "";
|
|
437
|
+
case DOT_CODE: return pathname.charCodeAt(i - 1) === SLASH_CODE ? "" : pathname.slice(i);
|
|
435
438
|
}
|
|
436
439
|
return "";
|
|
437
440
|
}
|
|
@@ -444,11 +447,12 @@ function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
|
444
447
|
}
|
|
445
448
|
if (ext === "") {
|
|
446
449
|
const { type: packageType } = getPackageScopeConfig(url);
|
|
447
|
-
if (packageType === "
|
|
448
|
-
|
|
450
|
+
if (packageType === "module") return "module";
|
|
451
|
+
if (packageType !== "none") return packageType;
|
|
452
|
+
return "commonjs";
|
|
449
453
|
}
|
|
450
|
-
const format
|
|
451
|
-
if (format
|
|
454
|
+
const format = extensionFormatMap[ext];
|
|
455
|
+
if (format) return format;
|
|
452
456
|
if (ignoreErrors) return;
|
|
453
457
|
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url));
|
|
454
458
|
}
|
|
@@ -481,19 +485,11 @@ function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
|
481
485
|
if (!main) process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
|
|
482
486
|
else if (path.resolve(packagePath, main) !== urlPath) process$1.emitWarning(`Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(packagePath.length)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, "DeprecationWarning", "DEP0151");
|
|
483
487
|
}
|
|
484
|
-
function tryStatSync(path
|
|
488
|
+
function tryStatSync(path) {
|
|
485
489
|
try {
|
|
486
|
-
return statSync(path
|
|
490
|
+
return statSync(path);
|
|
487
491
|
} catch {}
|
|
488
492
|
}
|
|
489
|
-
/**
|
|
490
|
-
* Legacy CommonJS main resolution:
|
|
491
|
-
* 1. let M = pkg_url + (json main field)
|
|
492
|
-
* 2. TRY(M, M.js, M.json, M.node)
|
|
493
|
-
* 3. TRY(M/index.js, M/index.json, M/index.node)
|
|
494
|
-
* 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)
|
|
495
|
-
* 5. NOT_FOUND
|
|
496
|
-
*/
|
|
497
493
|
function fileExists(url) {
|
|
498
494
|
const stats = statSync(url, { throwIfNoEntry: false });
|
|
499
495
|
const isFile = stats ? stats.isFile() : void 0;
|
|
@@ -504,7 +500,7 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
504
500
|
if (packageConfig.main !== void 0) {
|
|
505
501
|
guess = new URL$1(packageConfig.main, packageJsonUrl);
|
|
506
502
|
if (fileExists(guess)) return guess;
|
|
507
|
-
const tries
|
|
503
|
+
const tries = [
|
|
508
504
|
`./${packageConfig.main}.js`,
|
|
509
505
|
`./${packageConfig.main}.json`,
|
|
510
506
|
`./${packageConfig.main}.node`,
|
|
@@ -512,9 +508,9 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
|
512
508
|
`./${packageConfig.main}/index.json`,
|
|
513
509
|
`./${packageConfig.main}/index.node`
|
|
514
510
|
];
|
|
515
|
-
let i
|
|
516
|
-
while (++i
|
|
517
|
-
guess = new URL$1(tries
|
|
511
|
+
let i = -1;
|
|
512
|
+
while (++i < tries.length) {
|
|
513
|
+
guess = new URL$1(tries[i], packageJsonUrl);
|
|
518
514
|
if (fileExists(guess)) break;
|
|
519
515
|
guess = void 0;
|
|
520
516
|
}
|
|
@@ -646,7 +642,7 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
646
642
|
}
|
|
647
643
|
return resolveResult;
|
|
648
644
|
}
|
|
649
|
-
if (lastException === void 0 || lastException === null) return
|
|
645
|
+
if (lastException === void 0 || lastException === null) return lastException;
|
|
650
646
|
throw lastException;
|
|
651
647
|
}
|
|
652
648
|
if (typeof target === "object" && target !== null) {
|
|
@@ -666,7 +662,7 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b
|
|
|
666
662
|
return resolveResult;
|
|
667
663
|
}
|
|
668
664
|
}
|
|
669
|
-
return
|
|
665
|
+
return;
|
|
670
666
|
}
|
|
671
667
|
if (target === null) return null;
|
|
672
668
|
throw invalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base);
|
|
@@ -740,7 +736,7 @@ function patternKeyCompare(a, b) {
|
|
|
740
736
|
return 0;
|
|
741
737
|
}
|
|
742
738
|
function packageImportsResolve(name, base, conditions) {
|
|
743
|
-
if (name === "#" || name.
|
|
739
|
+
if (name === "#" || name.endsWith("/")) throw new ERR_INVALID_MODULE_SPECIFIER(name, "is not a valid internal imports specifier name", fileURLToPath(base));
|
|
744
740
|
let packageJsonUrl;
|
|
745
741
|
const packageConfig = getPackageScopeConfig(base);
|
|
746
742
|
if (packageConfig.exists) {
|
|
@@ -757,7 +753,7 @@ function packageImportsResolve(name, base, conditions) {
|
|
|
757
753
|
while (++i < keys.length) {
|
|
758
754
|
const key = keys[i];
|
|
759
755
|
const patternIndex = key.indexOf("*");
|
|
760
|
-
if (patternIndex !== -1 && name.startsWith(key.slice(0,
|
|
756
|
+
if (patternIndex !== -1 && name.startsWith(key.slice(0, patternIndex))) {
|
|
761
757
|
const patternTrailer = key.slice(patternIndex + 1);
|
|
762
758
|
if (name.length >= key.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key) === 1 && key.lastIndexOf("*") === patternIndex) {
|
|
763
759
|
bestMatch = key;
|
|
@@ -774,10 +770,6 @@ function packageImportsResolve(name, base, conditions) {
|
|
|
774
770
|
}
|
|
775
771
|
throw importNotDefined(name, packageJsonUrl, base);
|
|
776
772
|
}
|
|
777
|
-
/**
|
|
778
|
-
* @param {string} specifier
|
|
779
|
-
* @param {URL} base
|
|
780
|
-
*/
|
|
781
773
|
function parsePackageName(specifier, base) {
|
|
782
774
|
let separatorIndex = specifier.indexOf("/");
|
|
783
775
|
let validPackageName = true;
|
|
@@ -812,12 +804,12 @@ function packageResolve(specifier, base, conditions) {
|
|
|
812
804
|
packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
813
805
|
continue;
|
|
814
806
|
}
|
|
815
|
-
const packageConfig
|
|
807
|
+
const packageConfig = read$1(packageJsonPath, {
|
|
816
808
|
base,
|
|
817
809
|
specifier
|
|
818
810
|
});
|
|
819
|
-
if (packageConfig
|
|
820
|
-
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig
|
|
811
|
+
if (packageConfig.exports !== void 0 && packageConfig.exports !== null) return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions);
|
|
812
|
+
if (packageSubpath === ".") return legacyMainResolve(packageJsonUrl, packageConfig, base);
|
|
821
813
|
return new URL$1(packageSubpath, packageJsonUrl);
|
|
822
814
|
} while (packageJsonPath.length !== lastPath.length);
|
|
823
815
|
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), false);
|
|
@@ -834,21 +826,6 @@ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
|
|
834
826
|
if (specifier[0] === "/") return true;
|
|
835
827
|
return isRelativeSpecifier(specifier);
|
|
836
828
|
}
|
|
837
|
-
/**
|
|
838
|
-
* The “Resolver Algorithm Specification” as detailed in the Node docs (which is
|
|
839
|
-
* sync and slightly lower-level than `resolve`).
|
|
840
|
-
*
|
|
841
|
-
* @param {string} specifier
|
|
842
|
-
* `/example.js`, `./example.js`, `../example.js`, `some-package`, `fs`, etc.
|
|
843
|
-
* @param {URL} base
|
|
844
|
-
* Full URL (to a file) that `specifier` is resolved relative from.
|
|
845
|
-
* @param {Set<string>} [conditions]
|
|
846
|
-
* Conditions.
|
|
847
|
-
* @param {boolean} [preserveSymlinks]
|
|
848
|
-
* Keep symlinks instead of resolving them.
|
|
849
|
-
* @returns {URL}
|
|
850
|
-
* A URL object to the found thing.
|
|
851
|
-
*/
|
|
852
829
|
function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
853
830
|
const protocol = base.protocol;
|
|
854
831
|
const isData = protocol === "data:";
|
|
@@ -875,16 +852,10 @@ function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
|
875
852
|
if (resolved.protocol !== "file:") return resolved;
|
|
876
853
|
return finalizeResolution(resolved, base, preserveSymlinks);
|
|
877
854
|
}
|
|
878
|
-
const DEFAULT_CONDITIONS_SET = /*
|
|
879
|
-
const
|
|
880
|
-
const
|
|
881
|
-
|
|
882
|
-
* Synchronously resolves a module url based on the options provided.
|
|
883
|
-
*
|
|
884
|
-
* @param {string} input - The identifier or path of the module to resolve.
|
|
885
|
-
* @param {ResolveOptions} [options] - Options to resolve the module. See {@link ResolveOptions}.
|
|
886
|
-
* @returns {string} The resolved URL as a string.
|
|
887
|
-
*/
|
|
855
|
+
const DEFAULT_CONDITIONS_SET = /* #__PURE__ */ new Set(["node", "import"]);
|
|
856
|
+
const DEFAULT_CONDITIONS_KEY = "2:6:import4:node";
|
|
857
|
+
const isWindows = /* #__PURE__ */ (() => process.platform === "win32")();
|
|
858
|
+
const globalCache = /* #__PURE__ */ (() => globalThis["__EXSOLVE_CACHE__"] ||= /* @__PURE__ */ new Map())();
|
|
888
859
|
function resolveModuleURL(input, options) {
|
|
889
860
|
const parsedInput = _parseInput(input);
|
|
890
861
|
if ("external" in parsedInput) return parsedInput.external;
|
|
@@ -949,15 +920,6 @@ function resolveModuleURL(input, options) {
|
|
|
949
920
|
if (cacheObj) cacheObj.set(cacheKey, resolved.href);
|
|
950
921
|
return resolved.href;
|
|
951
922
|
}
|
|
952
|
-
/**
|
|
953
|
-
* Synchronously resolves a module then converts it to a file path
|
|
954
|
-
*
|
|
955
|
-
* (throws error if reolved path is not file:// scheme)
|
|
956
|
-
*
|
|
957
|
-
* @param {string} id - The identifier or path of the module to resolve.
|
|
958
|
-
* @param {ResolveOptions} [options] - Options to resolve the module. See {@link ResolveOptions}.
|
|
959
|
-
* @returns {string} The resolved URL as a string.
|
|
960
|
-
*/
|
|
961
923
|
function resolveModulePath(id, options) {
|
|
962
924
|
const resolved = resolveModuleURL(id, options);
|
|
963
925
|
if (!resolved) return;
|
|
@@ -994,21 +956,31 @@ function _fmtPath(input) {
|
|
|
994
956
|
return input;
|
|
995
957
|
}
|
|
996
958
|
}
|
|
997
|
-
function _cacheKey(id,
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
959
|
+
function _cacheKey(id, options) {
|
|
960
|
+
let from;
|
|
961
|
+
if (Array.isArray(options?.from)) from = options.from;
|
|
962
|
+
else if (options?.from) from = [options.from];
|
|
963
|
+
return _cacheKeyValues([id]) + _conditionsKey(options?.conditions) + _cacheKeyValues(options?.extensions) + _cacheKeyValues(from) + _cacheKeyValues(options?.suffixes);
|
|
964
|
+
}
|
|
965
|
+
function _conditionsKey(conditions) {
|
|
966
|
+
if (!conditions) return DEFAULT_CONDITIONS_KEY;
|
|
967
|
+
return _cacheKeyValues([...new Set(conditions)].sort());
|
|
968
|
+
}
|
|
969
|
+
function _cacheKeyValues(values) {
|
|
970
|
+
if (!values) return "-";
|
|
971
|
+
let key = `${values.length}:`;
|
|
972
|
+
for (const value of values) {
|
|
973
|
+
const stringValue = String(value);
|
|
974
|
+
key += `${stringValue.length}:${stringValue}`;
|
|
975
|
+
}
|
|
976
|
+
return key;
|
|
1005
977
|
}
|
|
1006
978
|
function _join(a, b) {
|
|
1007
979
|
if (!a || !b || b === "/") return a;
|
|
1008
980
|
return (a.endsWith("/") ? a : a + "/") + (b.startsWith("/") ? b.slice(1) : b);
|
|
1009
981
|
}
|
|
1010
|
-
function _normalizeWinPath(path
|
|
1011
|
-
return path
|
|
982
|
+
function _normalizeWinPath(path) {
|
|
983
|
+
return path.replace(/\\/g, "/").replace(/^[a-z]:\//, (r) => r.toUpperCase());
|
|
1012
984
|
}
|
|
1013
985
|
function _isURL(input) {
|
|
1014
986
|
return input instanceof URL || input?.constructor?.name === "URL";
|
|
@@ -1233,7 +1205,13 @@ function readUser(options) {
|
|
|
1233
1205
|
return read(options);
|
|
1234
1206
|
}
|
|
1235
1207
|
//#endregion
|
|
1236
|
-
//#region ../../node_modules/.pnpm/
|
|
1208
|
+
//#region ../../node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs
|
|
1209
|
+
function n(t, n) {
|
|
1210
|
+
let r = JSON.parse(t, n?.reviver);
|
|
1211
|
+
return a(t, r, n), r;
|
|
1212
|
+
}
|
|
1213
|
+
//#endregion
|
|
1214
|
+
//#region ../../node_modules/.pnpm/pkg-types@2.3.1/node_modules/pkg-types/dist/index.mjs
|
|
1237
1215
|
const defaultFindOptions = {
|
|
1238
1216
|
startingFrom: ".",
|
|
1239
1217
|
rootPattern: /^node_modules$/,
|
|
@@ -1257,12 +1235,12 @@ async function findFile(filename, _options = {}) {
|
|
|
1257
1235
|
if (leadingSlash) segments[0] = "/" + segments[0];
|
|
1258
1236
|
let root = segments.findIndex((r) => r.match(options.rootPattern));
|
|
1259
1237
|
if (root === -1) root = 0;
|
|
1260
|
-
if (options.reverse) for (let index = root + 1; index <= segments.length; index++) for (const
|
|
1261
|
-
const filePath = join$1(...segments.slice(0, index),
|
|
1238
|
+
if (options.reverse) for (let index = root + 1; index <= segments.length; index++) for (const filename of filenames) {
|
|
1239
|
+
const filePath = join$1(...segments.slice(0, index), filename);
|
|
1262
1240
|
if (await options.test(filePath)) return filePath;
|
|
1263
1241
|
}
|
|
1264
|
-
else for (let index = segments.length; index > root; index--) for (const
|
|
1265
|
-
const filePath = join$1(...segments.slice(0, index),
|
|
1242
|
+
else for (let index = segments.length; index > root; index--) for (const filename of filenames) {
|
|
1243
|
+
const filePath = join$1(...segments.slice(0, index), filename);
|
|
1266
1244
|
if (await options.test(filePath)) return filePath;
|
|
1267
1245
|
}
|
|
1268
1246
|
throw new Error(`Cannot find matching ${filename} in ${options.startingFrom} or parent directories`);
|
|
@@ -1349,12 +1327,7 @@ async function findWorkspaceDir(id = process.cwd(), options = {}) {
|
|
|
1349
1327
|
throw new Error(`Cannot detect workspace root from ${id}`);
|
|
1350
1328
|
}
|
|
1351
1329
|
//#endregion
|
|
1352
|
-
//#region ../../node_modules/.pnpm/c12@4.0.0-beta.
|
|
1353
|
-
/**
|
|
1354
|
-
* Load and interpolate environment variables into `process.env`.
|
|
1355
|
-
* If you need more control (or access to the values), consider using `loadDotenv` instead
|
|
1356
|
-
*
|
|
1357
|
-
*/
|
|
1330
|
+
//#region ../../node_modules/.pnpm/c12@4.0.0-beta.5_chokidar@5.0.0_dotenv@17.4.2_giget@1.2.5_jiti@2.7.0_magicast@0.5.3/node_modules/c12/dist/index.mjs
|
|
1358
1331
|
async function setupDotenv(options) {
|
|
1359
1332
|
const targetEnvironment = options.env ?? process.env;
|
|
1360
1333
|
const environment = await loadDotenv({
|
|
@@ -1371,7 +1344,6 @@ async function setupDotenv(options) {
|
|
|
1371
1344
|
}
|
|
1372
1345
|
return environment;
|
|
1373
1346
|
}
|
|
1374
|
-
/** Load environment variables into an object. */
|
|
1375
1347
|
async function loadDotenv(options) {
|
|
1376
1348
|
const environment = Object.create(null);
|
|
1377
1349
|
const cwd = resolve$1(options.cwd || ".");
|
|
@@ -1408,7 +1380,7 @@ let _parseEnv = nodeUtil.parseEnv;
|
|
|
1408
1380
|
async function readEnvFile(path) {
|
|
1409
1381
|
const src = readFileSync(path, "utf8");
|
|
1410
1382
|
if (!_parseEnv) try {
|
|
1411
|
-
const dotenv = await import("./main-
|
|
1383
|
+
const dotenv = await import("./main-CMmTVJ4V.js").then((m) => /* @__PURE__ */ __toESM(m.default, 1));
|
|
1412
1384
|
_parseEnv = (src) => dotenv.parse(src);
|
|
1413
1385
|
} catch {
|
|
1414
1386
|
throw new Error("Failed to parse .env file: `node:util.parseEnv` is not available and `dotenv` package is not installed. Please upgrade your runtime or install `dotenv` as a dependency.");
|
|
@@ -1451,11 +1423,11 @@ function getDotEnvVars(targetEnvironment) {
|
|
|
1451
1423
|
const _normalize = (p) => p?.replace(/\\/g, "/");
|
|
1452
1424
|
let importCounter = 0;
|
|
1453
1425
|
const ASYNC_LOADERS = {
|
|
1454
|
-
".yaml": () => import("./yaml-
|
|
1455
|
-
".yml": () => import("./yaml-
|
|
1456
|
-
".jsonc": () => import("./jsonc-
|
|
1457
|
-
".json5": () => import("./json5-
|
|
1458
|
-
".toml": () => import("./toml-
|
|
1426
|
+
".yaml": () => import("./yaml-Cp5SldPx.js").then((r) => r.parseYAML),
|
|
1427
|
+
".yml": () => import("./yaml-Cp5SldPx.js").then((r) => r.parseYAML),
|
|
1428
|
+
".jsonc": () => import("./jsonc-BjIiMOLf.js").then((r) => r.parseJSONC),
|
|
1429
|
+
".json5": () => import("./json5-Dgws4cj9.js").then((r) => r.parseJSON5),
|
|
1430
|
+
".toml": () => import("./toml-BrfNstp2.js").then((r) => r.parseTOML)
|
|
1459
1431
|
};
|
|
1460
1432
|
const SUPPORTED_EXTENSIONS = Object.freeze([
|
|
1461
1433
|
".js",
|
|
@@ -1633,12 +1605,12 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
1633
1605
|
}
|
|
1634
1606
|
const _merger = options.merger || defu;
|
|
1635
1607
|
const customProviderKeys = Object.keys(sourceOptions.giget?.providers || {}).map((key) => `${key}:`);
|
|
1636
|
-
const gigetPrefixes = customProviderKeys.length > 0 ? [
|
|
1608
|
+
const gigetPrefixes = customProviderKeys.length > 0 ? [.../* @__PURE__ */ new Set([...customProviderKeys, ...GIGET_PREFIXES])] : GIGET_PREFIXES;
|
|
1637
1609
|
if (options.giget !== false && gigetPrefixes.some((prefix) => source.startsWith(prefix))) {
|
|
1638
|
-
const { downloadTemplate } = await import("./dist-
|
|
1610
|
+
const { downloadTemplate } = await import("./dist-BGEDDbkB.js").catch((error) => {
|
|
1639
1611
|
throw new Error(`Extending config from \`${source}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: error });
|
|
1640
1612
|
});
|
|
1641
|
-
const { digest } = await import("./ohash-
|
|
1613
|
+
const { digest } = await import("./ohash-Cgvv31gH.js").then((n) => n.n);
|
|
1642
1614
|
const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
|
|
1643
1615
|
let cloneDir;
|
|
1644
1616
|
const localNodeModules = resolve$1(options.cwd, "node_modules");
|
|
@@ -1680,13 +1652,14 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
1680
1652
|
const _configURL = pathToFileURL(res.configFile);
|
|
1681
1653
|
_configURL.search = `_${++importCounter}`;
|
|
1682
1654
|
res.config = await import(_configURL.href).then(_resolveModule, async (error) => {
|
|
1683
|
-
const { createJiti } = await import("./jiti-
|
|
1655
|
+
const { createJiti } = await import("./jiti-DLiXBetA.js").catch(() => {
|
|
1684
1656
|
throw new Error(`Failed to load config file \`${res.configFile}\`: ${error?.message}. Hint install \`jiti\` for compatibility.`, { cause: error });
|
|
1685
1657
|
});
|
|
1686
1658
|
const jiti = createJiti(join$1(options.cwd || ".", options.configFile || "/"), {
|
|
1687
1659
|
interopDefault: true,
|
|
1688
1660
|
moduleCache: false,
|
|
1689
|
-
extensions: [...SUPPORTED_EXTENSIONS]
|
|
1661
|
+
extensions: [...SUPPORTED_EXTENSIONS],
|
|
1662
|
+
...options.jitiOptions
|
|
1690
1663
|
});
|
|
1691
1664
|
options.import = (id) => jiti.import(id);
|
|
1692
1665
|
return _resolveModule(await options.import(res.configFile));
|
|
@@ -1718,7 +1691,6 @@ function tryResolve(id, options) {
|
|
|
1718
1691
|
});
|
|
1719
1692
|
return res ? normalize(res) : void 0;
|
|
1720
1693
|
}
|
|
1721
|
-
/** Returns `true`/`false` if the path exists, `null` if it doesn't. */
|
|
1722
1694
|
function _isDirectory(path) {
|
|
1723
1695
|
try {
|
|
1724
1696
|
return statSync(path).isDirectory();
|
|
@@ -1902,4 +1874,4 @@ async function loadConfig(options) {
|
|
|
1902
1874
|
//#endregion
|
|
1903
1875
|
export { loadConfig as n, compileTargets as t };
|
|
1904
1876
|
|
|
1905
|
-
//# sourceMappingURL=utils-
|
|
1877
|
+
//# sourceMappingURL=utils-ioeFEbm4.js.map
|