@cloudflare/vite-plugin 1.25.2 → 1.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs
CHANGED
|
@@ -4,17 +4,17 @@ import { randomUUID } from "node:crypto";
|
|
|
4
4
|
import { CoreHeaders, Log, LogLevel, Miniflare, Request as Request$1, Response as Response$1, coupleWebSocket, getDefaultDevRegistryPath, getNodeCompat, getWorkerRegistry, kUnsafeEphemeralUniqueKey } from "miniflare";
|
|
5
5
|
import * as wrangler from "wrangler";
|
|
6
6
|
import * as nodePath from "node:path";
|
|
7
|
-
import path3, { relative, resolve } from "node:path";
|
|
7
|
+
import path3, { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
8
8
|
import * as util$1 from "node:util";
|
|
9
9
|
import { format, inspect } from "node:util";
|
|
10
10
|
import * as vite from "vite";
|
|
11
11
|
import { version } from "vite";
|
|
12
12
|
import * as fs$1 from "node:fs";
|
|
13
13
|
import fs, { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
14
|
-
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
15
|
-
import process2 from "node:process";
|
|
16
14
|
import os from "node:os";
|
|
17
15
|
import { getCloudflarePreset, nonPrefixedNodeModules } from "@cloudflare/unenv-preset";
|
|
16
|
+
import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
|
|
17
|
+
import process$1 from "node:process";
|
|
18
18
|
import v8 from "node:v8";
|
|
19
19
|
import { defineEnv } from "unenv";
|
|
20
20
|
import * as fsp from "node:fs/promises";
|
|
@@ -2228,7 +2228,7 @@ function constructWranglerConfig(workerOrWorkers) {
|
|
|
2228
2228
|
__name(constructWranglerConfig, "constructWranglerConfig");
|
|
2229
2229
|
|
|
2230
2230
|
//#endregion
|
|
2231
|
-
//#region ../workers-utils/dist/chunk-
|
|
2231
|
+
//#region ../workers-utils/dist/chunk-66S7A4CD.mjs
|
|
2232
2232
|
var UserError = class extends Error {
|
|
2233
2233
|
static {
|
|
2234
2234
|
__name(this, "UserError");
|
|
@@ -2984,10 +2984,10 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
2984
2984
|
return result;
|
|
2985
2985
|
}
|
|
2986
2986
|
__name(parseTree, "parseTree");
|
|
2987
|
-
function findNodeAtLocation(root,
|
|
2987
|
+
function findNodeAtLocation(root, path2) {
|
|
2988
2988
|
if (!root) return;
|
|
2989
2989
|
let node = root;
|
|
2990
|
-
for (let segment of
|
|
2990
|
+
for (let segment of path2) if (typeof segment === "string") {
|
|
2991
2991
|
if (node.type !== "object" || !Array.isArray(node.children)) return;
|
|
2992
2992
|
let found = false;
|
|
2993
2993
|
for (const propertyNode of node.children) if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
@@ -3214,13 +3214,13 @@ function getNodeType(value) {
|
|
|
3214
3214
|
}
|
|
3215
3215
|
__name(getNodeType, "getNodeType");
|
|
3216
3216
|
function setProperty(text, originalPath, value, options) {
|
|
3217
|
-
const
|
|
3217
|
+
const path2 = originalPath.slice();
|
|
3218
3218
|
const root = parseTree(text, []);
|
|
3219
3219
|
let parent = void 0;
|
|
3220
3220
|
let lastSegment = void 0;
|
|
3221
|
-
while (
|
|
3222
|
-
lastSegment =
|
|
3223
|
-
parent = findNodeAtLocation(root,
|
|
3221
|
+
while (path2.length > 0) {
|
|
3222
|
+
lastSegment = path2.pop();
|
|
3223
|
+
parent = findNodeAtLocation(root, path2);
|
|
3224
3224
|
if (parent === void 0 && value !== void 0) if (typeof lastSegment === "string") value = { [lastSegment]: value };
|
|
3225
3225
|
else value = [value];
|
|
3226
3226
|
else break;
|
|
@@ -3462,8 +3462,8 @@ function format2(documentText, range, options) {
|
|
|
3462
3462
|
return format$1(documentText, range, options);
|
|
3463
3463
|
}
|
|
3464
3464
|
__name(format2, "format");
|
|
3465
|
-
function modify(text,
|
|
3466
|
-
return setProperty(text,
|
|
3465
|
+
function modify(text, path2, value, options) {
|
|
3466
|
+
return setProperty(text, path2, value, options);
|
|
3467
3467
|
}
|
|
3468
3468
|
__name(modify, "modify");
|
|
3469
3469
|
function applyEdits(text, edits) {
|
|
@@ -4265,26 +4265,26 @@ function parseTOML(tomlContent, filePath) {
|
|
|
4265
4265
|
}
|
|
4266
4266
|
}
|
|
4267
4267
|
__name(parseTOML, "parseTOML");
|
|
4268
|
-
function parsePackageJSON(input,
|
|
4269
|
-
return parseJSON(input,
|
|
4268
|
+
function parsePackageJSON(input, file2) {
|
|
4269
|
+
return parseJSON(input, file2);
|
|
4270
4270
|
}
|
|
4271
4271
|
__name(parsePackageJSON, "parsePackageJSON");
|
|
4272
|
-
function parseJSON(input,
|
|
4273
|
-
return parseJSONC(input,
|
|
4272
|
+
function parseJSON(input, file2) {
|
|
4273
|
+
return parseJSONC(input, file2, {
|
|
4274
4274
|
allowEmptyContent: false,
|
|
4275
4275
|
allowTrailingComma: false,
|
|
4276
4276
|
disallowComments: true
|
|
4277
4277
|
});
|
|
4278
4278
|
}
|
|
4279
4279
|
__name(parseJSON, "parseJSON");
|
|
4280
|
-
function parseJSONC(input,
|
|
4280
|
+
function parseJSONC(input, file2, options = { allowTrailingComma: true }) {
|
|
4281
4281
|
const errors = [];
|
|
4282
4282
|
const data$1 = parse2(input, errors, options);
|
|
4283
4283
|
if (errors.length) throw new ParseError({
|
|
4284
4284
|
text: printParseErrorCode(errors[0].error),
|
|
4285
4285
|
location: {
|
|
4286
4286
|
...indexLocation({
|
|
4287
|
-
file,
|
|
4287
|
+
file: file2,
|
|
4288
4288
|
fileText: input
|
|
4289
4289
|
}, errors[0].offset + 1),
|
|
4290
4290
|
length: errors[0].length
|
|
@@ -4294,35 +4294,35 @@ function parseJSONC(input, file, options = { allowTrailingComma: true }) {
|
|
|
4294
4294
|
return data$1;
|
|
4295
4295
|
}
|
|
4296
4296
|
__name(parseJSONC, "parseJSONC");
|
|
4297
|
-
function readFileSyncToBuffer(
|
|
4297
|
+
function readFileSyncToBuffer(file2) {
|
|
4298
4298
|
try {
|
|
4299
|
-
return readFileSync(
|
|
4299
|
+
return readFileSync(file2);
|
|
4300
4300
|
} catch (err) {
|
|
4301
4301
|
const { message } = err;
|
|
4302
4302
|
throw new ParseError({
|
|
4303
|
-
text: `Could not read file: ${
|
|
4304
|
-
notes: [{ text: message.replace(
|
|
4303
|
+
text: `Could not read file: ${file2}`,
|
|
4304
|
+
notes: [{ text: message.replace(file2, resolve(file2)) }]
|
|
4305
4305
|
});
|
|
4306
4306
|
}
|
|
4307
4307
|
}
|
|
4308
4308
|
__name(readFileSyncToBuffer, "readFileSyncToBuffer");
|
|
4309
|
-
function readFileSync$1(
|
|
4309
|
+
function readFileSync$1(file2) {
|
|
4310
4310
|
try {
|
|
4311
|
-
return removeBOMAndValidate(readFileSync(
|
|
4311
|
+
return removeBOMAndValidate(readFileSync(file2), file2);
|
|
4312
4312
|
} catch (err) {
|
|
4313
4313
|
if (err instanceof ParseError) throw err;
|
|
4314
4314
|
const { message } = err;
|
|
4315
4315
|
throw new ParseError({
|
|
4316
|
-
text: `Could not read file: ${
|
|
4317
|
-
notes: [{ text: message.replace(
|
|
4316
|
+
text: `Could not read file: ${file2}`,
|
|
4317
|
+
notes: [{ text: message.replace(file2, resolve(file2)) }],
|
|
4318
4318
|
telemetryMessage: "Could not read file"
|
|
4319
4319
|
});
|
|
4320
4320
|
}
|
|
4321
4321
|
}
|
|
4322
4322
|
__name(readFileSync$1, "readFileSync");
|
|
4323
|
-
function indexLocation(
|
|
4323
|
+
function indexLocation(file2, index) {
|
|
4324
4324
|
let lineText, line = 0, column = 0, cursor = 0;
|
|
4325
|
-
const { fileText = "" } =
|
|
4325
|
+
const { fileText = "" } = file2;
|
|
4326
4326
|
for (const row of fileText.split("\n")) {
|
|
4327
4327
|
line++;
|
|
4328
4328
|
cursor += row.length + 1;
|
|
@@ -4336,14 +4336,14 @@ function indexLocation(file, index) {
|
|
|
4336
4336
|
lineText,
|
|
4337
4337
|
line,
|
|
4338
4338
|
column,
|
|
4339
|
-
...
|
|
4339
|
+
...file2
|
|
4340
4340
|
};
|
|
4341
4341
|
}
|
|
4342
4342
|
__name(indexLocation, "indexLocation");
|
|
4343
|
-
function searchLocation(
|
|
4343
|
+
function searchLocation(file2, query) {
|
|
4344
4344
|
let lineText, length, line = 0, column = 0;
|
|
4345
4345
|
const queryText = String(query);
|
|
4346
|
-
const { fileText = "" } =
|
|
4346
|
+
const { fileText = "" } = file2;
|
|
4347
4347
|
for (const content of fileText.split("\n")) {
|
|
4348
4348
|
line++;
|
|
4349
4349
|
const index = content.indexOf(queryText);
|
|
@@ -4359,7 +4359,7 @@ function searchLocation(file, query) {
|
|
|
4359
4359
|
line,
|
|
4360
4360
|
column,
|
|
4361
4361
|
length,
|
|
4362
|
-
...
|
|
4362
|
+
...file2
|
|
4363
4363
|
};
|
|
4364
4364
|
}
|
|
4365
4365
|
__name(searchLocation, "searchLocation");
|
|
@@ -4478,12 +4478,12 @@ var UNSUPPORTED_BOMS = [
|
|
|
4478
4478
|
encoding: "UTF-16 LE"
|
|
4479
4479
|
}
|
|
4480
4480
|
];
|
|
4481
|
-
function removeBOMAndValidate(buffer,
|
|
4481
|
+
function removeBOMAndValidate(buffer, file2) {
|
|
4482
4482
|
for (const bom of UNSUPPORTED_BOMS) if (buffer.length >= bom.buffer.length && buffer.subarray(0, bom.buffer.length).equals(bom.buffer)) throw new ParseError({
|
|
4483
4483
|
text: `Configuration file contains ${bom.encoding} byte order marker`,
|
|
4484
|
-
notes: [{ text: `The file "${
|
|
4484
|
+
notes: [{ text: `The file "${file2}" appears to be encoded as ${bom.encoding}. Please save the file as UTF-8 without BOM.` }],
|
|
4485
4485
|
location: {
|
|
4486
|
-
file,
|
|
4486
|
+
file: file2,
|
|
4487
4487
|
line: 1,
|
|
4488
4488
|
column: 0
|
|
4489
4489
|
},
|
|
@@ -4494,61 +4494,31 @@ function removeBOMAndValidate(buffer, file) {
|
|
|
4494
4494
|
return content;
|
|
4495
4495
|
}
|
|
4496
4496
|
__name(removeBOMAndValidate, "removeBOMAndValidate");
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
function
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4497
|
+
function absolute(input, root) {
|
|
4498
|
+
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
4499
|
+
}
|
|
4500
|
+
__name(absolute, "absolute");
|
|
4501
|
+
function up(base, options) {
|
|
4502
|
+
let { last, cwd } = options || {};
|
|
4503
|
+
let tmp = absolute(base, cwd);
|
|
4504
|
+
let root = absolute(last || "/", cwd);
|
|
4505
|
+
let prev, arr = [];
|
|
4506
|
+
while (prev !== root) {
|
|
4507
|
+
arr.push(tmp);
|
|
4508
|
+
tmp = dirname(prev = tmp);
|
|
4509
|
+
if (tmp === prev) break;
|
|
4510
|
+
}
|
|
4511
|
+
return arr;
|
|
4512
|
+
}
|
|
4513
|
+
__name(up, "up");
|
|
4514
|
+
function file(name, options) {
|
|
4515
|
+
let dir, tmp;
|
|
4516
|
+
for (dir of up(options && options.cwd || "", options)) try {
|
|
4517
|
+
tmp = join(dir, name);
|
|
4518
|
+
if (statSync(tmp).isFile()) return tmp;
|
|
4514
4519
|
} catch {}
|
|
4515
4520
|
}
|
|
4516
|
-
__name(
|
|
4517
|
-
var toPath2 = /* @__PURE__ */ __name((urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath, "toPath");
|
|
4518
|
-
var findUpStop = Symbol("findUpStop");
|
|
4519
|
-
function findUpMultipleSync(name, options = {}) {
|
|
4520
|
-
let directory = path3.resolve(toPath2(options.cwd) || "");
|
|
4521
|
-
const { root } = path3.parse(directory);
|
|
4522
|
-
const stopAt = options.stopAt || root;
|
|
4523
|
-
const limit = options.limit || Number.POSITIVE_INFINITY;
|
|
4524
|
-
const paths = [name].flat();
|
|
4525
|
-
const runMatcher = /* @__PURE__ */ __name((locateOptions) => {
|
|
4526
|
-
if (typeof name !== "function") return locatePathSync(paths, locateOptions);
|
|
4527
|
-
const foundPath = name(locateOptions.cwd);
|
|
4528
|
-
if (typeof foundPath === "string") return locatePathSync([foundPath], locateOptions);
|
|
4529
|
-
return foundPath;
|
|
4530
|
-
}, "runMatcher");
|
|
4531
|
-
const matches = [];
|
|
4532
|
-
while (true) {
|
|
4533
|
-
const foundPath = runMatcher({
|
|
4534
|
-
...options,
|
|
4535
|
-
cwd: directory
|
|
4536
|
-
});
|
|
4537
|
-
if (foundPath === findUpStop) break;
|
|
4538
|
-
if (foundPath) matches.push(path3.resolve(directory, foundPath));
|
|
4539
|
-
if (directory === stopAt || matches.length >= limit) break;
|
|
4540
|
-
directory = path3.dirname(directory);
|
|
4541
|
-
}
|
|
4542
|
-
return matches;
|
|
4543
|
-
}
|
|
4544
|
-
__name(findUpMultipleSync, "findUpMultipleSync");
|
|
4545
|
-
function findUpSync(name, options = {}) {
|
|
4546
|
-
return findUpMultipleSync(name, {
|
|
4547
|
-
...options,
|
|
4548
|
-
limit: 1
|
|
4549
|
-
})[0];
|
|
4550
|
-
}
|
|
4551
|
-
__name(findUpSync, "findUpSync");
|
|
4521
|
+
__name(file, "file");
|
|
4552
4522
|
function dedent(templ) {
|
|
4553
4523
|
var values = [];
|
|
4554
4524
|
for (var _i = 1; _i < arguments.length; _i++) values[_i - 1] = arguments[_i];
|
|
@@ -4594,7 +4564,7 @@ function resolveWranglerConfigPath({ config, script }, options) {
|
|
|
4594
4564
|
}
|
|
4595
4565
|
__name(resolveWranglerConfigPath, "resolveWranglerConfigPath");
|
|
4596
4566
|
function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvailable = false } = {}) {
|
|
4597
|
-
const userConfigPath =
|
|
4567
|
+
const userConfigPath = file(`wrangler.json`, { cwd: referencePath }) ?? file(`wrangler.jsonc`, { cwd: referencePath }) ?? file(`wrangler.toml`, { cwd: referencePath });
|
|
4598
4568
|
if (!useRedirectIfAvailable) return {
|
|
4599
4569
|
userConfigPath,
|
|
4600
4570
|
configPath: userConfigPath,
|
|
@@ -4611,7 +4581,7 @@ function findWranglerConfig$1(referencePath = process.cwd(), { useRedirectIfAvai
|
|
|
4611
4581
|
}
|
|
4612
4582
|
__name(findWranglerConfig$1, "findWranglerConfig");
|
|
4613
4583
|
function findRedirectedWranglerConfig(cwd, userConfigPath) {
|
|
4614
|
-
const deployConfigPath =
|
|
4584
|
+
const deployConfigPath = file(PATH_TO_DEPLOY_CONFIG, { cwd });
|
|
4615
4585
|
if (deployConfigPath === void 0) return {
|
|
4616
4586
|
configPath: userConfigPath,
|
|
4617
4587
|
deployConfigPath,
|
|
@@ -5301,11 +5271,7 @@ var import_mod_cjs = __toESM(require_mod_cjs3(), 1);
|
|
|
5301
5271
|
__reExport(mod_esm_exports, __toESM(require_mod_cjs3(), 1));
|
|
5302
5272
|
var mod_esm_default = import_mod_cjs.default;
|
|
5303
5273
|
function isDirectory(path4) {
|
|
5304
|
-
|
|
5305
|
-
return fs.statSync(path4).isDirectory();
|
|
5306
|
-
} catch {
|
|
5307
|
-
return false;
|
|
5308
|
-
}
|
|
5274
|
+
return fs.statSync(path4, { throwIfNoEntry: false })?.isDirectory() ?? false;
|
|
5309
5275
|
}
|
|
5310
5276
|
__name(isDirectory, "isDirectory");
|
|
5311
5277
|
function getGlobalWranglerConfigPath() {
|
|
@@ -12789,7 +12755,7 @@ const protocolRelative = Symbol.for("ufo:protocolRelative");
|
|
|
12789
12755
|
//#endregion
|
|
12790
12756
|
//#region ../../node_modules/.pnpm/pathe@2.0.1/node_modules/pathe/dist/shared/pathe.BLwDEnA5.mjs
|
|
12791
12757
|
const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
12792
|
-
const isAbsolute = function(p$1) {
|
|
12758
|
+
const isAbsolute$1 = function(p$1) {
|
|
12793
12759
|
return _IS_ABSOLUTE_RE.test(p$1);
|
|
12794
12760
|
};
|
|
12795
12761
|
|
|
@@ -13332,10 +13298,10 @@ const doubleSlashRegEx = /[/\\]{2}/;
|
|
|
13332
13298
|
* @param {boolean} isTarget
|
|
13333
13299
|
*/
|
|
13334
13300
|
function emitInvalidSegmentDeprecation(target$1, request$1, match, packageJsonUrl, internal, base, isTarget) {
|
|
13335
|
-
if (
|
|
13301
|
+
if (process$1.noDeprecation) return;
|
|
13336
13302
|
const pjsonPath = fileURLToPath(packageJsonUrl);
|
|
13337
13303
|
const double = doubleSlashRegEx.exec(isTarget ? target$1 : request$1) !== null;
|
|
13338
|
-
|
|
13304
|
+
process$1.emitWarning(`Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target$1}" for module request "${request$1}" ${request$1 === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ""}.`, "DeprecationWarning", "DEP0166");
|
|
13339
13305
|
}
|
|
13340
13306
|
/**
|
|
13341
13307
|
* @param {URL} url
|
|
@@ -13345,13 +13311,13 @@ function emitInvalidSegmentDeprecation(target$1, request$1, match, packageJsonUr
|
|
|
13345
13311
|
* @returns {void}
|
|
13346
13312
|
*/
|
|
13347
13313
|
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
13348
|
-
if (
|
|
13314
|
+
if (process$1.noDeprecation) return;
|
|
13349
13315
|
if (defaultGetFormatWithoutErrors(url, { parentURL: base.href }) !== "module") return;
|
|
13350
13316
|
const urlPath = fileURLToPath(url.href);
|
|
13351
13317
|
const packagePath = fileURLToPath(new URL$1(".", packageJsonUrl));
|
|
13352
13318
|
const basePath = fileURLToPath(base);
|
|
13353
|
-
if (!main)
|
|
13354
|
-
else if (path3.resolve(packagePath, main) !== urlPath)
|
|
13319
|
+
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");
|
|
13320
|
+
else if (path3.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");
|
|
13355
13321
|
}
|
|
13356
13322
|
/**
|
|
13357
13323
|
* @param {string} path
|
|
@@ -13651,11 +13617,11 @@ function isConditionalExportsMainSugar(exports$1, packageJsonUrl, base) {
|
|
|
13651
13617
|
* @param {URL} base
|
|
13652
13618
|
*/
|
|
13653
13619
|
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
13654
|
-
if (
|
|
13620
|
+
if (process$1.noDeprecation) return;
|
|
13655
13621
|
const pjsonPath = fileURLToPath(pjsonUrl);
|
|
13656
13622
|
if (emittedPackageWarnings.has(pjsonPath + "|" + match)) return;
|
|
13657
13623
|
emittedPackageWarnings.add(pjsonPath + "|" + match);
|
|
13658
|
-
|
|
13624
|
+
process$1.emitWarning(`Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`, "DeprecationWarning", "DEP0155");
|
|
13659
13625
|
}
|
|
13660
13626
|
/**
|
|
13661
13627
|
* @param {URL} packageJsonUrl
|
|
@@ -13917,7 +13883,7 @@ function _resolve(id, options = {}) {
|
|
|
13917
13883
|
if (/(node|data|http|https):/.test(id)) return id;
|
|
13918
13884
|
if (BUILTIN_MODULES.has(id)) return "node:" + id;
|
|
13919
13885
|
if (id.startsWith("file://")) id = fileURLToPath$1(id);
|
|
13920
|
-
if (isAbsolute(id)) try {
|
|
13886
|
+
if (isAbsolute$1(id)) try {
|
|
13921
13887
|
if (statSync(id).isFile()) return pathToFileURL$1(id);
|
|
13922
13888
|
} catch (error) {
|
|
13923
13889
|
if (error?.code !== "ENOENT") throw error;
|
|
@@ -22459,17 +22425,17 @@ const getQueryString = (params) => {
|
|
|
22459
22425
|
const append = (key, value) => {
|
|
22460
22426
|
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
22461
22427
|
};
|
|
22462
|
-
const process$
|
|
22428
|
+
const process$2 = (key, value) => {
|
|
22463
22429
|
if (isDefined(value)) if (Array.isArray(value)) value.forEach((v) => {
|
|
22464
|
-
process$
|
|
22430
|
+
process$2(key, v);
|
|
22465
22431
|
});
|
|
22466
22432
|
else if (typeof value === "object") Object.entries(value).forEach(([k, v]) => {
|
|
22467
|
-
process$
|
|
22433
|
+
process$2(`${key}[${k}]`, v);
|
|
22468
22434
|
});
|
|
22469
22435
|
else append(key, value);
|
|
22470
22436
|
};
|
|
22471
22437
|
Object.entries(params).forEach(([key, value]) => {
|
|
22472
|
-
process$
|
|
22438
|
+
process$2(key, value);
|
|
22473
22439
|
});
|
|
22474
22440
|
if (qs.length > 0) return `?${qs.join("&")}`;
|
|
22475
22441
|
return "";
|
|
@@ -22487,13 +22453,13 @@ const getUrl = (config, options) => {
|
|
|
22487
22453
|
const getFormData = (options) => {
|
|
22488
22454
|
if (options.formData) {
|
|
22489
22455
|
const formData = new FormData();
|
|
22490
|
-
const process$
|
|
22456
|
+
const process$2 = async (key, value) => {
|
|
22491
22457
|
if (isString(value)) formData.append(key, value);
|
|
22492
22458
|
else formData.append(key, JSON.stringify(value));
|
|
22493
22459
|
};
|
|
22494
22460
|
Object.entries(options.formData).filter(([_, value]) => isDefined(value)).forEach(([key, value]) => {
|
|
22495
|
-
if (Array.isArray(value)) value.forEach((v) => process$
|
|
22496
|
-
else process$
|
|
22461
|
+
if (Array.isArray(value)) value.forEach((v) => process$2(key, v));
|
|
22462
|
+
else process$2(key, value);
|
|
22497
22463
|
});
|
|
22498
22464
|
return formData;
|
|
22499
22465
|
}
|
|
@@ -25775,8 +25741,8 @@ function processPatterns({ patterns, ignore: ignore$1 = [], expandDirectories =
|
|
|
25775
25741
|
function getRelativePath(path2, cwd, root) {
|
|
25776
25742
|
return posix.relative(cwd, `${root}/${path2}`) || ".";
|
|
25777
25743
|
}
|
|
25778
|
-
function processPath(path2, cwd, root, isDirectory$1, absolute) {
|
|
25779
|
-
const relativePath = absolute ? path2.slice(root.length + 1) || "." : path2;
|
|
25744
|
+
function processPath(path2, cwd, root, isDirectory$1, absolute$1) {
|
|
25745
|
+
const relativePath = absolute$1 ? path2.slice(root.length + 1) || "." : path2;
|
|
25780
25746
|
if (root === cwd) return isDirectory$1 && relativePath !== "." ? relativePath.slice(0, -1) : relativePath;
|
|
25781
25747
|
return getRelativePath(relativePath, cwd, root);
|
|
25782
25748
|
}
|