vite 3.2.0-beta.4 → 3.2.1
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/LICENSE.md +0 -82
- package/dist/client/client.mjs +1 -1
- package/dist/client/client.mjs.map +1 -1
- package/dist/node/chunks/{dep-06c4efef.js → dep-9055f77d.js} +1 -1
- package/dist/node/chunks/{dep-0e9c6c9f.js → dep-d29b4e33.js} +627 -2321
- package/dist/node/cli.js +10 -8
- package/dist/node/constants.js +1 -1
- package/dist/node/index.d.ts +20 -1
- package/dist/node/index.js +2 -4
- package/dist/node-cjs/publicUtils.cjs +8 -9
- package/package.json +6 -7
- package/src/client/overlay.ts +1 -1
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
import fs$l, {
|
|
2
|
-
import path$n, { posix as posix$2, isAbsolute as isAbsolute$2, resolve as resolve$
|
|
3
|
-
import {
|
|
1
|
+
import fs$l, { promises as promises$2 } from 'node:fs';
|
|
2
|
+
import path$n, { posix as posix$2, isAbsolute as isAbsolute$2, resolve as resolve$6, join as join$2, relative as relative$2, dirname as dirname$2, basename as basename$2, extname as extname$1 } from 'node:path';
|
|
3
|
+
import { URL as URL$3, URLSearchParams, parse as parse$k, pathToFileURL as pathToFileURL$1 } from 'node:url';
|
|
4
4
|
import { performance } from 'node:perf_hooks';
|
|
5
|
-
import {
|
|
5
|
+
import { createRequire as createRequire$1, builtinModules } from 'node:module';
|
|
6
6
|
import require$$0$3 from 'tty';
|
|
7
7
|
import { transform as transform$2, build as build$3, formatMessages } from 'esbuild';
|
|
8
|
-
import
|
|
9
|
-
import process$1 from 'node:process';
|
|
10
|
-
import { format as format$2, inspect, promisify as promisify$4 } from 'node:util';
|
|
11
|
-
import require$$0$4, { sep, resolve as resolve$5, posix as posix$1, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, win32 as win32$1, isAbsolute as isAbsolute$1, normalize } from 'path';
|
|
8
|
+
import require$$0$4, { sep, resolve as resolve$4, posix as posix$1, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, win32 as win32$1, isAbsolute as isAbsolute$1, normalize } from 'path';
|
|
12
9
|
import * as require$$0$2 from 'fs';
|
|
13
|
-
import require$$0__default, { existsSync, readFileSync, statSync as statSync$
|
|
10
|
+
import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, promises as promises$1, readdirSync } from 'fs';
|
|
14
11
|
import require$$0$5 from 'events';
|
|
15
|
-
import assert$
|
|
16
|
-
import require$$0$6, { format as format$
|
|
12
|
+
import assert$1 from 'assert';
|
|
13
|
+
import require$$0$6, { format as format$2, inspect } from 'util';
|
|
17
14
|
import require$$3$1 from 'net';
|
|
18
|
-
import require$$0$9, { pathToFileURL
|
|
19
|
-
import require$$1$
|
|
15
|
+
import require$$0$9, { pathToFileURL } from 'url';
|
|
16
|
+
import require$$1$1 from 'http';
|
|
20
17
|
import require$$0$7 from 'stream';
|
|
21
|
-
import require$$
|
|
22
|
-
import require$$2 from 'child_process';
|
|
18
|
+
import require$$2 from 'os';
|
|
19
|
+
import require$$2$1 from 'child_process';
|
|
23
20
|
import os$3 from 'node:os';
|
|
24
21
|
import { createHash as createHash$2 } from 'node:crypto';
|
|
22
|
+
import { promisify as promisify$4 } from 'node:util';
|
|
25
23
|
import { promises } from 'node:dns';
|
|
26
|
-
import resolve$
|
|
27
|
-
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY,
|
|
24
|
+
import resolve$5 from 'resolve';
|
|
25
|
+
import { CLIENT_ENTRY, OPTIMIZABLE_ENTRY_RE, DEFAULT_EXTENSIONS as DEFAULT_EXTENSIONS$1, wildcardHosts, loopbackHosts, VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER, FS_PREFIX, CLIENT_PUBLIC_PATH, ENV_PUBLIC_PATH, ENV_ENTRY, DEFAULT_MAIN_FIELDS, SPECIAL_QUERY_RE, DEP_VERSION_RE, KNOWN_ASSET_TYPES, CLIENT_DIR, JS_TYPES_RE, ESBUILD_MODULES_TARGET, VERSION, VITE_PACKAGE_DIR, DEFAULT_ASSETS_RE, DEFAULT_CONFIG_FILES } from '../constants.js';
|
|
28
26
|
import require$$5 from 'crypto';
|
|
29
27
|
import { Buffer as Buffer$1 } from 'node:buffer';
|
|
30
28
|
import require$$0$8, { createRequire as createRequire$2 } from 'module';
|
|
31
|
-
import require$$1
|
|
29
|
+
import require$$1 from 'worker_threads';
|
|
32
30
|
import require$$0$a from 'zlib';
|
|
33
|
-
import require$$1$
|
|
31
|
+
import require$$1$2 from 'https';
|
|
34
32
|
import require$$4 from 'tls';
|
|
35
33
|
import { STATUS_CODES } from 'node:http';
|
|
36
34
|
import { createServer as createServer$2 } from 'node:https';
|
|
@@ -215,1761 +213,6 @@ function alias$1(options = {}) {
|
|
|
215
213
|
};
|
|
216
214
|
}
|
|
217
215
|
|
|
218
|
-
// Manually “tree shaken” from:
|
|
219
|
-
|
|
220
|
-
const reader$2 = {read: read$5};
|
|
221
|
-
var packageJsonReader = reader$2;
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* @param {string} jsonPath
|
|
225
|
-
* @returns {{string: string|undefined}}
|
|
226
|
-
*/
|
|
227
|
-
function read$5(jsonPath) {
|
|
228
|
-
try {
|
|
229
|
-
const string = fs$l.readFileSync(
|
|
230
|
-
path$n.toNamespacedPath(path$n.join(path$n.dirname(jsonPath), 'package.json')),
|
|
231
|
-
'utf8'
|
|
232
|
-
);
|
|
233
|
-
return {string}
|
|
234
|
-
} catch (error) {
|
|
235
|
-
const exception = /** @type {ErrnoException} */ (error);
|
|
236
|
-
|
|
237
|
-
if (exception.code === 'ENOENT') {
|
|
238
|
-
return {string: undefined}
|
|
239
|
-
// Throw all other errors.
|
|
240
|
-
/* c8 ignore next 4 */
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
throw exception
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* @typedef ErrnoExceptionFields
|
|
249
|
-
* @property {number|undefined} [errnode]
|
|
250
|
-
* @property {string|undefined} [code]
|
|
251
|
-
* @property {string|undefined} [path]
|
|
252
|
-
* @property {string|undefined} [syscall]
|
|
253
|
-
* @property {string|undefined} [url]
|
|
254
|
-
*
|
|
255
|
-
* @typedef {Error & ErrnoExceptionFields} ErrnoException
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
const isWindows$6 = process$1.platform === 'win32';
|
|
259
|
-
|
|
260
|
-
const own$2 = {}.hasOwnProperty;
|
|
261
|
-
|
|
262
|
-
const codes$1 = {};
|
|
263
|
-
|
|
264
|
-
/** @type {Map<string, MessageFunction|string>} */
|
|
265
|
-
const messages$1 = new Map();
|
|
266
|
-
const nodeInternalPrefix$1 = '__node_internal_';
|
|
267
|
-
/** @type {number} */
|
|
268
|
-
let userStackTraceLimit$1;
|
|
269
|
-
|
|
270
|
-
codes$1.ERR_INVALID_MODULE_SPECIFIER = createError$1(
|
|
271
|
-
'ERR_INVALID_MODULE_SPECIFIER',
|
|
272
|
-
/**
|
|
273
|
-
* @param {string} request
|
|
274
|
-
* @param {string} reason
|
|
275
|
-
* @param {string} [base]
|
|
276
|
-
*/
|
|
277
|
-
(request, reason, base = undefined) => {
|
|
278
|
-
return `Invalid module "${request}" ${reason}${
|
|
279
|
-
base ? ` imported from ${base}` : ''
|
|
280
|
-
}`
|
|
281
|
-
},
|
|
282
|
-
TypeError
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
codes$1.ERR_INVALID_PACKAGE_CONFIG = createError$1(
|
|
286
|
-
'ERR_INVALID_PACKAGE_CONFIG',
|
|
287
|
-
/**
|
|
288
|
-
* @param {string} path
|
|
289
|
-
* @param {string} [base]
|
|
290
|
-
* @param {string} [message]
|
|
291
|
-
*/
|
|
292
|
-
(path, base, message) => {
|
|
293
|
-
return `Invalid package config ${path}${
|
|
294
|
-
base ? ` while importing ${base}` : ''
|
|
295
|
-
}${message ? `. ${message}` : ''}`
|
|
296
|
-
},
|
|
297
|
-
Error
|
|
298
|
-
);
|
|
299
|
-
|
|
300
|
-
codes$1.ERR_INVALID_PACKAGE_TARGET = createError$1(
|
|
301
|
-
'ERR_INVALID_PACKAGE_TARGET',
|
|
302
|
-
/**
|
|
303
|
-
* @param {string} pkgPath
|
|
304
|
-
* @param {string} key
|
|
305
|
-
* @param {unknown} target
|
|
306
|
-
* @param {boolean} [isImport=false]
|
|
307
|
-
* @param {string} [base]
|
|
308
|
-
*/
|
|
309
|
-
(pkgPath, key, target, isImport = false, base = undefined) => {
|
|
310
|
-
const relError =
|
|
311
|
-
typeof target === 'string' &&
|
|
312
|
-
!isImport &&
|
|
313
|
-
target.length > 0 &&
|
|
314
|
-
!target.startsWith('./');
|
|
315
|
-
if (key === '.') {
|
|
316
|
-
assert$1(isImport === false);
|
|
317
|
-
return (
|
|
318
|
-
`Invalid "exports" main target ${JSON.stringify(target)} defined ` +
|
|
319
|
-
`in the package config ${pkgPath}package.json${
|
|
320
|
-
base ? ` imported from ${base}` : ''
|
|
321
|
-
}${relError ? '; targets must start with "./"' : ''}`
|
|
322
|
-
)
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
return `Invalid "${
|
|
326
|
-
isImport ? 'imports' : 'exports'
|
|
327
|
-
}" target ${JSON.stringify(
|
|
328
|
-
target
|
|
329
|
-
)} defined for '${key}' in the package config ${pkgPath}package.json${
|
|
330
|
-
base ? ` imported from ${base}` : ''
|
|
331
|
-
}${relError ? '; targets must start with "./"' : ''}`
|
|
332
|
-
},
|
|
333
|
-
Error
|
|
334
|
-
);
|
|
335
|
-
|
|
336
|
-
codes$1.ERR_MODULE_NOT_FOUND = createError$1(
|
|
337
|
-
'ERR_MODULE_NOT_FOUND',
|
|
338
|
-
/**
|
|
339
|
-
* @param {string} path
|
|
340
|
-
* @param {string} base
|
|
341
|
-
* @param {string} [type]
|
|
342
|
-
*/
|
|
343
|
-
(path, base, type = 'package') => {
|
|
344
|
-
return `Cannot find ${type} '${path}' imported from ${base}`
|
|
345
|
-
},
|
|
346
|
-
Error
|
|
347
|
-
);
|
|
348
|
-
|
|
349
|
-
codes$1.ERR_NETWORK_IMPORT_DISALLOWED = createError$1(
|
|
350
|
-
'ERR_NETWORK_IMPORT_DISALLOWED',
|
|
351
|
-
"import of '%s' by %s is not supported: %s",
|
|
352
|
-
Error
|
|
353
|
-
);
|
|
354
|
-
|
|
355
|
-
codes$1.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError$1(
|
|
356
|
-
'ERR_PACKAGE_IMPORT_NOT_DEFINED',
|
|
357
|
-
/**
|
|
358
|
-
* @param {string} specifier
|
|
359
|
-
* @param {string} packagePath
|
|
360
|
-
* @param {string} base
|
|
361
|
-
*/
|
|
362
|
-
(specifier, packagePath, base) => {
|
|
363
|
-
return `Package import specifier "${specifier}" is not defined${
|
|
364
|
-
packagePath ? ` in package ${packagePath}package.json` : ''
|
|
365
|
-
} imported from ${base}`
|
|
366
|
-
},
|
|
367
|
-
TypeError
|
|
368
|
-
);
|
|
369
|
-
|
|
370
|
-
codes$1.ERR_PACKAGE_PATH_NOT_EXPORTED = createError$1(
|
|
371
|
-
'ERR_PACKAGE_PATH_NOT_EXPORTED',
|
|
372
|
-
/**
|
|
373
|
-
* @param {string} pkgPath
|
|
374
|
-
* @param {string} subpath
|
|
375
|
-
* @param {string} [base]
|
|
376
|
-
*/
|
|
377
|
-
(pkgPath, subpath, base = undefined) => {
|
|
378
|
-
if (subpath === '.')
|
|
379
|
-
return `No "exports" main defined in ${pkgPath}package.json${
|
|
380
|
-
base ? ` imported from ${base}` : ''
|
|
381
|
-
}`
|
|
382
|
-
return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${
|
|
383
|
-
base ? ` imported from ${base}` : ''
|
|
384
|
-
}`
|
|
385
|
-
},
|
|
386
|
-
Error
|
|
387
|
-
);
|
|
388
|
-
|
|
389
|
-
codes$1.ERR_UNSUPPORTED_DIR_IMPORT = createError$1(
|
|
390
|
-
'ERR_UNSUPPORTED_DIR_IMPORT',
|
|
391
|
-
"Directory import '%s' is not supported " +
|
|
392
|
-
'resolving ES modules imported from %s',
|
|
393
|
-
Error
|
|
394
|
-
);
|
|
395
|
-
|
|
396
|
-
codes$1.ERR_UNKNOWN_FILE_EXTENSION = createError$1(
|
|
397
|
-
'ERR_UNKNOWN_FILE_EXTENSION',
|
|
398
|
-
/**
|
|
399
|
-
* @param {string} ext
|
|
400
|
-
* @param {string} path
|
|
401
|
-
*/
|
|
402
|
-
(ext, path) => {
|
|
403
|
-
return `Unknown file extension "${ext}" for ${path}`
|
|
404
|
-
},
|
|
405
|
-
TypeError
|
|
406
|
-
);
|
|
407
|
-
|
|
408
|
-
codes$1.ERR_INVALID_ARG_VALUE = createError$1(
|
|
409
|
-
'ERR_INVALID_ARG_VALUE',
|
|
410
|
-
/**
|
|
411
|
-
* @param {string} name
|
|
412
|
-
* @param {unknown} value
|
|
413
|
-
* @param {string} [reason='is invalid']
|
|
414
|
-
*/
|
|
415
|
-
(name, value, reason = 'is invalid') => {
|
|
416
|
-
let inspected = inspect(value);
|
|
417
|
-
|
|
418
|
-
if (inspected.length > 128) {
|
|
419
|
-
inspected = `${inspected.slice(0, 128)}...`;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
const type = name.includes('.') ? 'property' : 'argument';
|
|
423
|
-
|
|
424
|
-
return `The ${type} '${name}' ${reason}. Received ${inspected}`
|
|
425
|
-
},
|
|
426
|
-
TypeError
|
|
427
|
-
// Note: extra classes have been shaken out.
|
|
428
|
-
// , RangeError
|
|
429
|
-
);
|
|
430
|
-
|
|
431
|
-
codes$1.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError$1(
|
|
432
|
-
'ERR_UNSUPPORTED_ESM_URL_SCHEME',
|
|
433
|
-
/**
|
|
434
|
-
* @param {URL} url
|
|
435
|
-
* @param {Array<string>} supported
|
|
436
|
-
*/
|
|
437
|
-
(url, supported) => {
|
|
438
|
-
let message = `Only URLs with a scheme in: ${supported.join(
|
|
439
|
-
', '
|
|
440
|
-
)} are supported by the default ESM loader`;
|
|
441
|
-
// Let message =
|
|
442
|
-
// 'Only file and data URLs are supported by the default ESM loader'
|
|
443
|
-
|
|
444
|
-
if (isWindows$6 && url.protocol.length === 2) {
|
|
445
|
-
message += '. On Windows, absolute paths must be valid file:// URLs';
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
message += `. Received protocol '${url.protocol}'`;
|
|
449
|
-
return message
|
|
450
|
-
},
|
|
451
|
-
Error
|
|
452
|
-
);
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* Utility function for registering the error codes. Only used here. Exported
|
|
456
|
-
* *only* to allow for testing.
|
|
457
|
-
* @param {string} sym
|
|
458
|
-
* @param {MessageFunction|string} value
|
|
459
|
-
* @param {ErrorConstructor} def
|
|
460
|
-
* @returns {new (...args: Array<any>) => Error}
|
|
461
|
-
*/
|
|
462
|
-
function createError$1(sym, value, def) {
|
|
463
|
-
// Special case for SystemError that formats the error message differently
|
|
464
|
-
// The SystemErrors only have SystemError as their base classes.
|
|
465
|
-
messages$1.set(sym, value);
|
|
466
|
-
|
|
467
|
-
return makeNodeErrorWithCode$1(def, sym)
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* @param {ErrorConstructor} Base
|
|
472
|
-
* @param {string} key
|
|
473
|
-
* @returns {ErrorConstructor}
|
|
474
|
-
*/
|
|
475
|
-
function makeNodeErrorWithCode$1(Base, key) {
|
|
476
|
-
// @ts-expect-error It’s a Node error.
|
|
477
|
-
return NodeError
|
|
478
|
-
/**
|
|
479
|
-
* @param {Array<unknown>} args
|
|
480
|
-
*/
|
|
481
|
-
function NodeError(...args) {
|
|
482
|
-
const limit = Error.stackTraceLimit;
|
|
483
|
-
if (isErrorStackTraceLimitWritable$1()) Error.stackTraceLimit = 0;
|
|
484
|
-
const error = new Base();
|
|
485
|
-
// Reset the limit and setting the name property.
|
|
486
|
-
if (isErrorStackTraceLimitWritable$1()) Error.stackTraceLimit = limit;
|
|
487
|
-
const message = getMessage$1(key, args, error);
|
|
488
|
-
Object.defineProperties(error, {
|
|
489
|
-
// Note: no need to implement `kIsNodeError` symbol, would be hard,
|
|
490
|
-
// probably.
|
|
491
|
-
message: {
|
|
492
|
-
value: message,
|
|
493
|
-
enumerable: false,
|
|
494
|
-
writable: true,
|
|
495
|
-
configurable: true
|
|
496
|
-
},
|
|
497
|
-
toString: {
|
|
498
|
-
/** @this {Error} */
|
|
499
|
-
value() {
|
|
500
|
-
return `${this.name} [${key}]: ${this.message}`
|
|
501
|
-
},
|
|
502
|
-
enumerable: false,
|
|
503
|
-
writable: true,
|
|
504
|
-
configurable: true
|
|
505
|
-
}
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
captureLargerStackTrace$1(error);
|
|
509
|
-
// @ts-expect-error It’s a Node error.
|
|
510
|
-
error.code = key;
|
|
511
|
-
return error
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* @returns {boolean}
|
|
517
|
-
*/
|
|
518
|
-
function isErrorStackTraceLimitWritable$1() {
|
|
519
|
-
const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');
|
|
520
|
-
if (desc === undefined) {
|
|
521
|
-
return Object.isExtensible(Error)
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return own$2.call(desc, 'writable') && desc.writable !== undefined
|
|
525
|
-
? desc.writable
|
|
526
|
-
: desc.set !== undefined
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
/**
|
|
530
|
-
* This function removes unnecessary frames from Node.js core errors.
|
|
531
|
-
* @template {(...args: Array<any>) => unknown} T
|
|
532
|
-
* @type {(fn: T) => T}
|
|
533
|
-
*/
|
|
534
|
-
function hideStackFrames$1(fn) {
|
|
535
|
-
// We rename the functions that will be hidden to cut off the stacktrace
|
|
536
|
-
// at the outermost one
|
|
537
|
-
const hidden = nodeInternalPrefix$1 + fn.name;
|
|
538
|
-
Object.defineProperty(fn, 'name', {value: hidden});
|
|
539
|
-
return fn
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
const captureLargerStackTrace$1 = hideStackFrames$1(
|
|
543
|
-
/**
|
|
544
|
-
* @param {Error} error
|
|
545
|
-
* @returns {Error}
|
|
546
|
-
*/
|
|
547
|
-
function (error) {
|
|
548
|
-
const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable$1();
|
|
549
|
-
if (stackTraceLimitIsWritable) {
|
|
550
|
-
userStackTraceLimit$1 = Error.stackTraceLimit;
|
|
551
|
-
Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
Error.captureStackTrace(error);
|
|
555
|
-
|
|
556
|
-
// Reset the limit
|
|
557
|
-
if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit$1;
|
|
558
|
-
|
|
559
|
-
return error
|
|
560
|
-
}
|
|
561
|
-
);
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* @param {string} key
|
|
565
|
-
* @param {Array<unknown>} args
|
|
566
|
-
* @param {Error} self
|
|
567
|
-
* @returns {string}
|
|
568
|
-
*/
|
|
569
|
-
function getMessage$1(key, args, self) {
|
|
570
|
-
const message = messages$1.get(key);
|
|
571
|
-
assert$1(typeof message !== 'undefined', 'expected `message` to be found');
|
|
572
|
-
|
|
573
|
-
if (typeof message === 'function') {
|
|
574
|
-
assert$1(
|
|
575
|
-
message.length <= args.length, // Default options do not count.
|
|
576
|
-
`Code: ${key}; The provided arguments length (${args.length}) does not ` +
|
|
577
|
-
`match the required ones (${message.length}).`
|
|
578
|
-
);
|
|
579
|
-
return Reflect.apply(message, self, args)
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
|
|
583
|
-
assert$1(
|
|
584
|
-
expectedLength === args.length,
|
|
585
|
-
`Code: ${key}; The provided arguments length (${args.length}) does not ` +
|
|
586
|
-
`match the required ones (${expectedLength}).`
|
|
587
|
-
);
|
|
588
|
-
if (args.length === 0) return message
|
|
589
|
-
|
|
590
|
-
args.unshift(message);
|
|
591
|
-
return Reflect.apply(format$2, null, args)
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
// Manually “tree shaken” from:
|
|
595
|
-
|
|
596
|
-
const {ERR_UNKNOWN_FILE_EXTENSION} = codes$1;
|
|
597
|
-
|
|
598
|
-
const hasOwnProperty$2 = {}.hasOwnProperty;
|
|
599
|
-
|
|
600
|
-
/** @type {Record<string, string>} */
|
|
601
|
-
const extensionFormatMap = {
|
|
602
|
-
// @ts-expect-error: hush.
|
|
603
|
-
__proto__: null,
|
|
604
|
-
'.cjs': 'commonjs',
|
|
605
|
-
'.js': 'module',
|
|
606
|
-
'.json': 'json',
|
|
607
|
-
'.mjs': 'module'
|
|
608
|
-
};
|
|
609
|
-
|
|
610
|
-
/**
|
|
611
|
-
* @param {string|null} mime
|
|
612
|
-
* @returns {string | null}
|
|
613
|
-
*/
|
|
614
|
-
function mimeToFormat(mime) {
|
|
615
|
-
if (
|
|
616
|
-
mime &&
|
|
617
|
-
/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime)
|
|
618
|
-
)
|
|
619
|
-
return 'module'
|
|
620
|
-
if (mime === 'application/json') return 'json'
|
|
621
|
-
return null
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* @callback ProtocolHandler
|
|
626
|
-
* @param {URL} parsed
|
|
627
|
-
* @param {{parentURL: string}} context
|
|
628
|
-
* @param {boolean} ignoreErrors
|
|
629
|
-
* @returns {string|null}
|
|
630
|
-
*/
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* @type {Record<string, ProtocolHandler>}
|
|
634
|
-
*/
|
|
635
|
-
const protocolHandlers = Object.assign(Object.create(null), {
|
|
636
|
-
'data:': getDataProtocolModuleFormat,
|
|
637
|
-
'file:': getFileProtocolModuleFormat,
|
|
638
|
-
'http:': getHttpProtocolModuleFormat,
|
|
639
|
-
'https:': getHttpProtocolModuleFormat,
|
|
640
|
-
'node:'() {
|
|
641
|
-
return 'builtin'
|
|
642
|
-
}
|
|
643
|
-
});
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* @param {URL} parsed
|
|
647
|
-
*/
|
|
648
|
-
function getDataProtocolModuleFormat(parsed) {
|
|
649
|
-
const {1: mime} = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(
|
|
650
|
-
parsed.pathname
|
|
651
|
-
) || [null, null, null];
|
|
652
|
-
return mimeToFormat(mime)
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
/**
|
|
656
|
-
* @type {ProtocolHandler}
|
|
657
|
-
*/
|
|
658
|
-
function getFileProtocolModuleFormat(url, _context, ignoreErrors) {
|
|
659
|
-
const filepath = fileURLToPath(url);
|
|
660
|
-
const ext = path$n.extname(filepath);
|
|
661
|
-
if (ext === '.js') {
|
|
662
|
-
return getPackageType(url) === 'module' ? 'module' : 'commonjs'
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
const format = extensionFormatMap[ext];
|
|
666
|
-
if (format) return format
|
|
667
|
-
if (ignoreErrors) return null
|
|
668
|
-
|
|
669
|
-
throw new ERR_UNKNOWN_FILE_EXTENSION(ext, filepath)
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
function getHttpProtocolModuleFormat() {
|
|
673
|
-
// To do: HTTPS imports.
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
/**
|
|
677
|
-
* @param {URL} url
|
|
678
|
-
* @param {{parentURL: string}} context
|
|
679
|
-
* @returns {string|null}
|
|
680
|
-
*/
|
|
681
|
-
function defaultGetFormatWithoutErrors(url, context) {
|
|
682
|
-
if (!hasOwnProperty$2.call(protocolHandlers, url.protocol)) {
|
|
683
|
-
return null
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
return protocolHandlers[url.protocol](url, context, true)
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
// Manually “tree shaken” from:
|
|
690
|
-
|
|
691
|
-
const RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
|
692
|
-
|
|
693
|
-
// To do: potentially enable?
|
|
694
|
-
const experimentalNetworkImports = false;
|
|
695
|
-
|
|
696
|
-
const {
|
|
697
|
-
ERR_NETWORK_IMPORT_DISALLOWED,
|
|
698
|
-
ERR_INVALID_MODULE_SPECIFIER,
|
|
699
|
-
ERR_INVALID_PACKAGE_CONFIG,
|
|
700
|
-
ERR_INVALID_PACKAGE_TARGET,
|
|
701
|
-
ERR_MODULE_NOT_FOUND,
|
|
702
|
-
ERR_PACKAGE_IMPORT_NOT_DEFINED,
|
|
703
|
-
ERR_PACKAGE_PATH_NOT_EXPORTED,
|
|
704
|
-
ERR_UNSUPPORTED_DIR_IMPORT,
|
|
705
|
-
ERR_UNSUPPORTED_ESM_URL_SCHEME,
|
|
706
|
-
ERR_INVALID_ARG_VALUE
|
|
707
|
-
} = codes$1;
|
|
708
|
-
|
|
709
|
-
const own = {}.hasOwnProperty;
|
|
710
|
-
|
|
711
|
-
const DEFAULT_CONDITIONS = Object.freeze(['node', 'import']);
|
|
712
|
-
const DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);
|
|
713
|
-
|
|
714
|
-
const invalidSegmentRegEx =
|
|
715
|
-
/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i;
|
|
716
|
-
const invalidPackageNameRegEx = /^\.|%|\\/;
|
|
717
|
-
const patternRegEx = /\*/g;
|
|
718
|
-
const encodedSepRegEx = /%2f|%5c/i;
|
|
719
|
-
/** @type {Set<string>} */
|
|
720
|
-
const emittedPackageWarnings = new Set();
|
|
721
|
-
/** @type {Map<string, PackageConfig>} */
|
|
722
|
-
const packageJsonCache = new Map();
|
|
723
|
-
|
|
724
|
-
/**
|
|
725
|
-
* @param {URL} url
|
|
726
|
-
* @param {URL} packageJsonUrl
|
|
727
|
-
* @param {URL} base
|
|
728
|
-
* @param {unknown} [main]
|
|
729
|
-
* @returns {void}
|
|
730
|
-
*/
|
|
731
|
-
function emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {
|
|
732
|
-
const format = defaultGetFormatWithoutErrors(url, {parentURL: base.href});
|
|
733
|
-
if (format !== 'module') return
|
|
734
|
-
const path = fileURLToPath(url.href);
|
|
735
|
-
const pkgPath = fileURLToPath(new URL$3('.', packageJsonUrl));
|
|
736
|
-
const basePath = fileURLToPath(base);
|
|
737
|
-
if (main)
|
|
738
|
-
process$1.emitWarning(
|
|
739
|
-
`Package ${pkgPath} has a "main" field set to ${JSON.stringify(main)}, ` +
|
|
740
|
-
`excluding the full filename and extension to the resolved file at "${path.slice(
|
|
741
|
-
pkgPath.length
|
|
742
|
-
)}", imported from ${basePath}.\n Automatic extension resolution of the "main" field is` +
|
|
743
|
-
'deprecated for ES modules.',
|
|
744
|
-
'DeprecationWarning',
|
|
745
|
-
'DEP0151'
|
|
746
|
-
);
|
|
747
|
-
else
|
|
748
|
-
process$1.emitWarning(
|
|
749
|
-
`No "main" or "exports" field defined in the package.json for ${pkgPath} resolving the main entry point "${path.slice(
|
|
750
|
-
pkgPath.length
|
|
751
|
-
)}", imported from ${basePath}.\nDefault "index" lookups for the main are deprecated for ES modules.`,
|
|
752
|
-
'DeprecationWarning',
|
|
753
|
-
'DEP0151'
|
|
754
|
-
);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* @param {Array<string>} [conditions]
|
|
759
|
-
* @returns {Set<string>}
|
|
760
|
-
*/
|
|
761
|
-
function getConditionsSet(conditions) {
|
|
762
|
-
if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) {
|
|
763
|
-
if (!Array.isArray(conditions)) {
|
|
764
|
-
throw new ERR_INVALID_ARG_VALUE(
|
|
765
|
-
'conditions',
|
|
766
|
-
conditions,
|
|
767
|
-
'expected an array'
|
|
768
|
-
)
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
return new Set(conditions)
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
return DEFAULT_CONDITIONS_SET
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
/**
|
|
778
|
-
* @param {string} path
|
|
779
|
-
* @returns {Stats}
|
|
780
|
-
*/
|
|
781
|
-
function tryStatSync(path) {
|
|
782
|
-
// Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead.
|
|
783
|
-
try {
|
|
784
|
-
return statSync$1(path)
|
|
785
|
-
} catch {
|
|
786
|
-
return new Stats$1()
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* @param {string} path
|
|
792
|
-
* @param {string|URL} specifier Note: `specifier` is actually optional, not base.
|
|
793
|
-
* @param {URL} [base]
|
|
794
|
-
* @returns {PackageConfig}
|
|
795
|
-
*/
|
|
796
|
-
function getPackageConfig(path, specifier, base) {
|
|
797
|
-
const existing = packageJsonCache.get(path);
|
|
798
|
-
if (existing !== undefined) {
|
|
799
|
-
return existing
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
const source = packageJsonReader.read(path).string;
|
|
803
|
-
|
|
804
|
-
if (source === undefined) {
|
|
805
|
-
/** @type {PackageConfig} */
|
|
806
|
-
const packageConfig = {
|
|
807
|
-
pjsonPath: path,
|
|
808
|
-
exists: false,
|
|
809
|
-
main: undefined,
|
|
810
|
-
name: undefined,
|
|
811
|
-
type: 'none',
|
|
812
|
-
exports: undefined,
|
|
813
|
-
imports: undefined
|
|
814
|
-
};
|
|
815
|
-
packageJsonCache.set(path, packageConfig);
|
|
816
|
-
return packageConfig
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
/** @type {Record<string, unknown>} */
|
|
820
|
-
let packageJson;
|
|
821
|
-
try {
|
|
822
|
-
packageJson = JSON.parse(source);
|
|
823
|
-
} catch (error) {
|
|
824
|
-
const exception = /** @type {ErrnoException} */ (error);
|
|
825
|
-
|
|
826
|
-
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
827
|
-
path,
|
|
828
|
-
(base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier),
|
|
829
|
-
exception.message
|
|
830
|
-
)
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
const {exports, imports, main, name, type} = packageJson;
|
|
834
|
-
|
|
835
|
-
/** @type {PackageConfig} */
|
|
836
|
-
const packageConfig = {
|
|
837
|
-
pjsonPath: path,
|
|
838
|
-
exists: true,
|
|
839
|
-
main: typeof main === 'string' ? main : undefined,
|
|
840
|
-
name: typeof name === 'string' ? name : undefined,
|
|
841
|
-
type: type === 'module' || type === 'commonjs' ? type : 'none',
|
|
842
|
-
// @ts-expect-error Assume `Record<string, unknown>`.
|
|
843
|
-
exports,
|
|
844
|
-
// @ts-expect-error Assume `Record<string, unknown>`.
|
|
845
|
-
imports: imports && typeof imports === 'object' ? imports : undefined
|
|
846
|
-
};
|
|
847
|
-
packageJsonCache.set(path, packageConfig);
|
|
848
|
-
return packageConfig
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
* @param {URL} resolved
|
|
853
|
-
* @returns {PackageConfig}
|
|
854
|
-
*/
|
|
855
|
-
function getPackageScopeConfig(resolved) {
|
|
856
|
-
let packageJsonUrl = new URL$3('package.json', resolved);
|
|
857
|
-
|
|
858
|
-
while (true) {
|
|
859
|
-
const packageJsonPath = packageJsonUrl.pathname;
|
|
860
|
-
|
|
861
|
-
if (packageJsonPath.endsWith('node_modules/package.json')) break
|
|
862
|
-
|
|
863
|
-
const packageConfig = getPackageConfig(
|
|
864
|
-
fileURLToPath(packageJsonUrl),
|
|
865
|
-
resolved
|
|
866
|
-
);
|
|
867
|
-
if (packageConfig.exists) return packageConfig
|
|
868
|
-
|
|
869
|
-
const lastPackageJsonUrl = packageJsonUrl;
|
|
870
|
-
packageJsonUrl = new URL$3('../package.json', packageJsonUrl);
|
|
871
|
-
|
|
872
|
-
// Terminates at root where ../package.json equals ../../package.json
|
|
873
|
-
// (can't just check "/package.json" for Windows support).
|
|
874
|
-
if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break
|
|
875
|
-
}
|
|
876
|
-
|
|
877
|
-
const packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
878
|
-
/** @type {PackageConfig} */
|
|
879
|
-
const packageConfig = {
|
|
880
|
-
pjsonPath: packageJsonPath,
|
|
881
|
-
exists: false,
|
|
882
|
-
main: undefined,
|
|
883
|
-
name: undefined,
|
|
884
|
-
type: 'none',
|
|
885
|
-
exports: undefined,
|
|
886
|
-
imports: undefined
|
|
887
|
-
};
|
|
888
|
-
packageJsonCache.set(packageJsonPath, packageConfig);
|
|
889
|
-
return packageConfig
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* Legacy CommonJS main resolution:
|
|
894
|
-
* 1. let M = pkg_url + (json main field)
|
|
895
|
-
* 2. TRY(M, M.js, M.json, M.node)
|
|
896
|
-
* 3. TRY(M/index.js, M/index.json, M/index.node)
|
|
897
|
-
* 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)
|
|
898
|
-
* 5. NOT_FOUND
|
|
899
|
-
*
|
|
900
|
-
* @param {URL} url
|
|
901
|
-
* @returns {boolean}
|
|
902
|
-
*/
|
|
903
|
-
function fileExists(url) {
|
|
904
|
-
const stats = statSync$1(url, {throwIfNoEntry: false});
|
|
905
|
-
const isFile = stats ? stats.isFile() : undefined;
|
|
906
|
-
return isFile === null || isFile === undefined ? false : isFile
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* @param {URL} packageJsonUrl
|
|
911
|
-
* @param {PackageConfig} packageConfig
|
|
912
|
-
* @param {URL} base
|
|
913
|
-
* @returns {URL}
|
|
914
|
-
*/
|
|
915
|
-
function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
|
916
|
-
/** @type {URL|undefined} */
|
|
917
|
-
let guess;
|
|
918
|
-
if (packageConfig.main !== undefined) {
|
|
919
|
-
guess = new URL$3(packageConfig.main, packageJsonUrl);
|
|
920
|
-
// Note: fs check redundances will be handled by Descriptor cache here.
|
|
921
|
-
if (fileExists(guess)) return guess
|
|
922
|
-
|
|
923
|
-
const tries = [
|
|
924
|
-
`./${packageConfig.main}.js`,
|
|
925
|
-
`./${packageConfig.main}.json`,
|
|
926
|
-
`./${packageConfig.main}.node`,
|
|
927
|
-
`./${packageConfig.main}/index.js`,
|
|
928
|
-
`./${packageConfig.main}/index.json`,
|
|
929
|
-
`./${packageConfig.main}/index.node`
|
|
930
|
-
];
|
|
931
|
-
let i = -1;
|
|
932
|
-
|
|
933
|
-
while (++i < tries.length) {
|
|
934
|
-
guess = new URL$3(tries[i], packageJsonUrl);
|
|
935
|
-
if (fileExists(guess)) break
|
|
936
|
-
guess = undefined;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
if (guess) {
|
|
940
|
-
emitLegacyIndexDeprecation(
|
|
941
|
-
guess,
|
|
942
|
-
packageJsonUrl,
|
|
943
|
-
base,
|
|
944
|
-
packageConfig.main
|
|
945
|
-
);
|
|
946
|
-
return guess
|
|
947
|
-
}
|
|
948
|
-
// Fallthrough.
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
const tries = ['./index.js', './index.json', './index.node'];
|
|
952
|
-
let i = -1;
|
|
953
|
-
|
|
954
|
-
while (++i < tries.length) {
|
|
955
|
-
guess = new URL$3(tries[i], packageJsonUrl);
|
|
956
|
-
if (fileExists(guess)) break
|
|
957
|
-
guess = undefined;
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
if (guess) {
|
|
961
|
-
emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
|
|
962
|
-
return guess
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
// Not found.
|
|
966
|
-
throw new ERR_MODULE_NOT_FOUND(
|
|
967
|
-
fileURLToPath(new URL$3('.', packageJsonUrl)),
|
|
968
|
-
fileURLToPath(base)
|
|
969
|
-
)
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* @param {URL} resolved
|
|
974
|
-
* @param {URL} base
|
|
975
|
-
* @param {boolean} [preserveSymlinks]
|
|
976
|
-
* @returns {URL}
|
|
977
|
-
*/
|
|
978
|
-
function finalizeResolution(resolved, base, preserveSymlinks) {
|
|
979
|
-
if (encodedSepRegEx.test(resolved.pathname))
|
|
980
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
981
|
-
resolved.pathname,
|
|
982
|
-
'must not include encoded "/" or "\\" characters',
|
|
983
|
-
fileURLToPath(base)
|
|
984
|
-
)
|
|
985
|
-
|
|
986
|
-
const filePath = fileURLToPath(resolved);
|
|
987
|
-
|
|
988
|
-
const stats = tryStatSync(
|
|
989
|
-
filePath.endsWith('/') ? filePath.slice(-1) : filePath
|
|
990
|
-
);
|
|
991
|
-
|
|
992
|
-
if (stats.isDirectory()) {
|
|
993
|
-
const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath(base));
|
|
994
|
-
// @ts-expect-error Add this for `import.meta.resolve`.
|
|
995
|
-
error.url = String(resolved);
|
|
996
|
-
throw error
|
|
997
|
-
}
|
|
998
|
-
|
|
999
|
-
if (!stats.isFile()) {
|
|
1000
|
-
throw new ERR_MODULE_NOT_FOUND(
|
|
1001
|
-
filePath || resolved.pathname,
|
|
1002
|
-
base && fileURLToPath(base),
|
|
1003
|
-
'module'
|
|
1004
|
-
)
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
if (!preserveSymlinks) {
|
|
1008
|
-
const real = realpathSync$1(filePath);
|
|
1009
|
-
const {search, hash} = resolved;
|
|
1010
|
-
resolved = pathToFileURL(real + (filePath.endsWith(path$n.sep) ? '/' : ''));
|
|
1011
|
-
resolved.search = search;
|
|
1012
|
-
resolved.hash = hash;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
return resolved
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
/**
|
|
1019
|
-
* @param {string} specifier
|
|
1020
|
-
* @param {URL|undefined} packageJsonUrl
|
|
1021
|
-
* @param {URL} base
|
|
1022
|
-
* @returns {never}
|
|
1023
|
-
*/
|
|
1024
|
-
function throwImportNotDefined(specifier, packageJsonUrl, base) {
|
|
1025
|
-
throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(
|
|
1026
|
-
specifier,
|
|
1027
|
-
packageJsonUrl && fileURLToPath(new URL$3('.', packageJsonUrl)),
|
|
1028
|
-
fileURLToPath(base)
|
|
1029
|
-
)
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
/**
|
|
1033
|
-
* @param {string} subpath
|
|
1034
|
-
* @param {URL} packageJsonUrl
|
|
1035
|
-
* @param {URL} base
|
|
1036
|
-
* @returns {never}
|
|
1037
|
-
*/
|
|
1038
|
-
function throwExportsNotFound(subpath, packageJsonUrl, base) {
|
|
1039
|
-
throw new ERR_PACKAGE_PATH_NOT_EXPORTED(
|
|
1040
|
-
fileURLToPath(new URL$3('.', packageJsonUrl)),
|
|
1041
|
-
subpath,
|
|
1042
|
-
base && fileURLToPath(base)
|
|
1043
|
-
)
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
/**
|
|
1047
|
-
* @param {string} subpath
|
|
1048
|
-
* @param {URL} packageJsonUrl
|
|
1049
|
-
* @param {boolean} internal
|
|
1050
|
-
* @param {URL} [base]
|
|
1051
|
-
* @returns {never}
|
|
1052
|
-
*/
|
|
1053
|
-
function throwInvalidSubpath(subpath, packageJsonUrl, internal, base) {
|
|
1054
|
-
const reason = `request is not a valid subpath for the "${
|
|
1055
|
-
internal ? 'imports' : 'exports'
|
|
1056
|
-
}" resolution of ${fileURLToPath(packageJsonUrl)}`;
|
|
1057
|
-
|
|
1058
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
1059
|
-
subpath,
|
|
1060
|
-
reason,
|
|
1061
|
-
base && fileURLToPath(base)
|
|
1062
|
-
)
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
/**
|
|
1066
|
-
* @param {string} subpath
|
|
1067
|
-
* @param {unknown} target
|
|
1068
|
-
* @param {URL} packageJsonUrl
|
|
1069
|
-
* @param {boolean} internal
|
|
1070
|
-
* @param {URL} [base]
|
|
1071
|
-
* @returns {never}
|
|
1072
|
-
*/
|
|
1073
|
-
function throwInvalidPackageTarget(
|
|
1074
|
-
subpath,
|
|
1075
|
-
target,
|
|
1076
|
-
packageJsonUrl,
|
|
1077
|
-
internal,
|
|
1078
|
-
base
|
|
1079
|
-
) {
|
|
1080
|
-
target =
|
|
1081
|
-
typeof target === 'object' && target !== null
|
|
1082
|
-
? JSON.stringify(target, null, '')
|
|
1083
|
-
: `${target}`;
|
|
1084
|
-
|
|
1085
|
-
throw new ERR_INVALID_PACKAGE_TARGET(
|
|
1086
|
-
fileURLToPath(new URL$3('.', packageJsonUrl)),
|
|
1087
|
-
subpath,
|
|
1088
|
-
target,
|
|
1089
|
-
internal,
|
|
1090
|
-
base && fileURLToPath(base)
|
|
1091
|
-
)
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
/**
|
|
1095
|
-
* @param {string} target
|
|
1096
|
-
* @param {string} subpath
|
|
1097
|
-
* @param {string} match
|
|
1098
|
-
* @param {URL} packageJsonUrl
|
|
1099
|
-
* @param {URL} base
|
|
1100
|
-
* @param {boolean} pattern
|
|
1101
|
-
* @param {boolean} internal
|
|
1102
|
-
* @param {Set<string>|undefined} conditions
|
|
1103
|
-
* @returns {URL}
|
|
1104
|
-
*/
|
|
1105
|
-
function resolvePackageTargetString(
|
|
1106
|
-
target,
|
|
1107
|
-
subpath,
|
|
1108
|
-
match,
|
|
1109
|
-
packageJsonUrl,
|
|
1110
|
-
base,
|
|
1111
|
-
pattern,
|
|
1112
|
-
internal,
|
|
1113
|
-
conditions
|
|
1114
|
-
) {
|
|
1115
|
-
if (subpath !== '' && !pattern && target[target.length - 1] !== '/')
|
|
1116
|
-
throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
1117
|
-
|
|
1118
|
-
if (!target.startsWith('./')) {
|
|
1119
|
-
if (internal && !target.startsWith('../') && !target.startsWith('/')) {
|
|
1120
|
-
let isURL = false;
|
|
1121
|
-
|
|
1122
|
-
try {
|
|
1123
|
-
new URL$3(target);
|
|
1124
|
-
isURL = true;
|
|
1125
|
-
} catch {
|
|
1126
|
-
// Continue regardless of error.
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
if (!isURL) {
|
|
1130
|
-
const exportTarget = pattern
|
|
1131
|
-
? RegExpPrototypeSymbolReplace.call(
|
|
1132
|
-
patternRegEx,
|
|
1133
|
-
target,
|
|
1134
|
-
() => subpath
|
|
1135
|
-
)
|
|
1136
|
-
: target + subpath;
|
|
1137
|
-
|
|
1138
|
-
return packageResolve(exportTarget, packageJsonUrl, conditions)
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
if (invalidSegmentRegEx.test(target.slice(2)))
|
|
1146
|
-
throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
1147
|
-
|
|
1148
|
-
const resolved = new URL$3(target, packageJsonUrl);
|
|
1149
|
-
const resolvedPath = resolved.pathname;
|
|
1150
|
-
const packagePath = new URL$3('.', packageJsonUrl).pathname;
|
|
1151
|
-
|
|
1152
|
-
if (!resolvedPath.startsWith(packagePath))
|
|
1153
|
-
throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
|
1154
|
-
|
|
1155
|
-
if (subpath === '') return resolved
|
|
1156
|
-
|
|
1157
|
-
if (invalidSegmentRegEx.test(subpath)) {
|
|
1158
|
-
const request = pattern
|
|
1159
|
-
? match.replace('*', () => subpath)
|
|
1160
|
-
: match + subpath;
|
|
1161
|
-
throwInvalidSubpath(request, packageJsonUrl, internal, base);
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
if (pattern) {
|
|
1165
|
-
return new URL$3(
|
|
1166
|
-
RegExpPrototypeSymbolReplace.call(
|
|
1167
|
-
patternRegEx,
|
|
1168
|
-
resolved.href,
|
|
1169
|
-
() => subpath
|
|
1170
|
-
)
|
|
1171
|
-
)
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
return new URL$3(subpath, resolved)
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* @param {string} key
|
|
1179
|
-
* @returns {boolean}
|
|
1180
|
-
*/
|
|
1181
|
-
function isArrayIndex(key) {
|
|
1182
|
-
const keyNumber = Number(key);
|
|
1183
|
-
if (`${keyNumber}` !== key) return false
|
|
1184
|
-
return keyNumber >= 0 && keyNumber < 0xff_ff_ff_ff
|
|
1185
|
-
}
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* @param {URL} packageJsonUrl
|
|
1189
|
-
* @param {unknown} target
|
|
1190
|
-
* @param {string} subpath
|
|
1191
|
-
* @param {string} packageSubpath
|
|
1192
|
-
* @param {URL} base
|
|
1193
|
-
* @param {boolean} pattern
|
|
1194
|
-
* @param {boolean} internal
|
|
1195
|
-
* @param {Set<string>|undefined} conditions
|
|
1196
|
-
* @returns {URL|null}
|
|
1197
|
-
*/
|
|
1198
|
-
function resolvePackageTarget(
|
|
1199
|
-
packageJsonUrl,
|
|
1200
|
-
target,
|
|
1201
|
-
subpath,
|
|
1202
|
-
packageSubpath,
|
|
1203
|
-
base,
|
|
1204
|
-
pattern,
|
|
1205
|
-
internal,
|
|
1206
|
-
conditions
|
|
1207
|
-
) {
|
|
1208
|
-
if (typeof target === 'string') {
|
|
1209
|
-
return resolvePackageTargetString(
|
|
1210
|
-
target,
|
|
1211
|
-
subpath,
|
|
1212
|
-
packageSubpath,
|
|
1213
|
-
packageJsonUrl,
|
|
1214
|
-
base,
|
|
1215
|
-
pattern,
|
|
1216
|
-
internal,
|
|
1217
|
-
conditions
|
|
1218
|
-
)
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
if (Array.isArray(target)) {
|
|
1222
|
-
/** @type {Array<unknown>} */
|
|
1223
|
-
const targetList = target;
|
|
1224
|
-
if (targetList.length === 0) return null
|
|
1225
|
-
|
|
1226
|
-
/** @type {ErrnoException|null|undefined} */
|
|
1227
|
-
let lastException;
|
|
1228
|
-
let i = -1;
|
|
1229
|
-
|
|
1230
|
-
while (++i < targetList.length) {
|
|
1231
|
-
const targetItem = targetList[i];
|
|
1232
|
-
/** @type {URL|null} */
|
|
1233
|
-
let resolveResult;
|
|
1234
|
-
try {
|
|
1235
|
-
resolveResult = resolvePackageTarget(
|
|
1236
|
-
packageJsonUrl,
|
|
1237
|
-
targetItem,
|
|
1238
|
-
subpath,
|
|
1239
|
-
packageSubpath,
|
|
1240
|
-
base,
|
|
1241
|
-
pattern,
|
|
1242
|
-
internal,
|
|
1243
|
-
conditions
|
|
1244
|
-
);
|
|
1245
|
-
} catch (error) {
|
|
1246
|
-
const exception = /** @type {ErrnoException} */ (error);
|
|
1247
|
-
lastException = exception;
|
|
1248
|
-
if (exception.code === 'ERR_INVALID_PACKAGE_TARGET') continue
|
|
1249
|
-
throw error
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
if (resolveResult === undefined) continue
|
|
1253
|
-
|
|
1254
|
-
if (resolveResult === null) {
|
|
1255
|
-
lastException = null;
|
|
1256
|
-
continue
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
return resolveResult
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1262
|
-
if (lastException === undefined || lastException === null) {
|
|
1263
|
-
return null
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
throw lastException
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
if (typeof target === 'object' && target !== null) {
|
|
1270
|
-
const keys = Object.getOwnPropertyNames(target);
|
|
1271
|
-
let i = -1;
|
|
1272
|
-
|
|
1273
|
-
while (++i < keys.length) {
|
|
1274
|
-
const key = keys[i];
|
|
1275
|
-
if (isArrayIndex(key)) {
|
|
1276
|
-
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
1277
|
-
fileURLToPath(packageJsonUrl),
|
|
1278
|
-
base,
|
|
1279
|
-
'"exports" cannot contain numeric property keys.'
|
|
1280
|
-
)
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
i = -1;
|
|
1285
|
-
|
|
1286
|
-
while (++i < keys.length) {
|
|
1287
|
-
const key = keys[i];
|
|
1288
|
-
if (key === 'default' || (conditions && conditions.has(key))) {
|
|
1289
|
-
// @ts-expect-error: indexable.
|
|
1290
|
-
const conditionalTarget = /** @type {unknown} */ (target[key]);
|
|
1291
|
-
const resolveResult = resolvePackageTarget(
|
|
1292
|
-
packageJsonUrl,
|
|
1293
|
-
conditionalTarget,
|
|
1294
|
-
subpath,
|
|
1295
|
-
packageSubpath,
|
|
1296
|
-
base,
|
|
1297
|
-
pattern,
|
|
1298
|
-
internal,
|
|
1299
|
-
conditions
|
|
1300
|
-
);
|
|
1301
|
-
if (resolveResult === undefined) continue
|
|
1302
|
-
return resolveResult
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
return null
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
if (target === null) {
|
|
1310
|
-
return null
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
throwInvalidPackageTarget(
|
|
1314
|
-
packageSubpath,
|
|
1315
|
-
target,
|
|
1316
|
-
packageJsonUrl,
|
|
1317
|
-
internal,
|
|
1318
|
-
base
|
|
1319
|
-
);
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* @param {unknown} exports
|
|
1324
|
-
* @param {URL} packageJsonUrl
|
|
1325
|
-
* @param {URL} base
|
|
1326
|
-
* @returns {boolean}
|
|
1327
|
-
*/
|
|
1328
|
-
function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
|
1329
|
-
if (typeof exports === 'string' || Array.isArray(exports)) return true
|
|
1330
|
-
if (typeof exports !== 'object' || exports === null) return false
|
|
1331
|
-
|
|
1332
|
-
const keys = Object.getOwnPropertyNames(exports);
|
|
1333
|
-
let isConditionalSugar = false;
|
|
1334
|
-
let i = 0;
|
|
1335
|
-
let j = -1;
|
|
1336
|
-
while (++j < keys.length) {
|
|
1337
|
-
const key = keys[j];
|
|
1338
|
-
const curIsConditionalSugar = key === '' || key[0] !== '.';
|
|
1339
|
-
if (i++ === 0) {
|
|
1340
|
-
isConditionalSugar = curIsConditionalSugar;
|
|
1341
|
-
} else if (isConditionalSugar !== curIsConditionalSugar) {
|
|
1342
|
-
throw new ERR_INVALID_PACKAGE_CONFIG(
|
|
1343
|
-
fileURLToPath(packageJsonUrl),
|
|
1344
|
-
base,
|
|
1345
|
-
'"exports" cannot contain some keys starting with \'.\' and some not.' +
|
|
1346
|
-
' The exports object must either be an object of package subpath keys' +
|
|
1347
|
-
' or an object of main entry condition name keys only.'
|
|
1348
|
-
)
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
return isConditionalSugar
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
/**
|
|
1356
|
-
* @param {string} match
|
|
1357
|
-
* @param {URL} pjsonUrl
|
|
1358
|
-
* @param {URL} base
|
|
1359
|
-
*/
|
|
1360
|
-
function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|
1361
|
-
const pjsonPath = fileURLToPath(pjsonUrl);
|
|
1362
|
-
if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return
|
|
1363
|
-
emittedPackageWarnings.add(pjsonPath + '|' + match);
|
|
1364
|
-
process$1.emitWarning(
|
|
1365
|
-
`Use of deprecated trailing slash pattern mapping "${match}" in the ` +
|
|
1366
|
-
`"exports" field module resolution of the package at ${pjsonPath}${
|
|
1367
|
-
base ? ` imported from ${fileURLToPath(base)}` : ''
|
|
1368
|
-
}. Mapping specifiers ending in "/" is no longer supported.`,
|
|
1369
|
-
'DeprecationWarning',
|
|
1370
|
-
'DEP0155'
|
|
1371
|
-
);
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
/**
|
|
1375
|
-
* @param {URL} packageJsonUrl
|
|
1376
|
-
* @param {string} packageSubpath
|
|
1377
|
-
* @param {Record<string, unknown>} packageConfig
|
|
1378
|
-
* @param {URL} base
|
|
1379
|
-
* @param {Set<string>|undefined} conditions
|
|
1380
|
-
* @returns {URL}
|
|
1381
|
-
*/
|
|
1382
|
-
function packageExportsResolve(
|
|
1383
|
-
packageJsonUrl,
|
|
1384
|
-
packageSubpath,
|
|
1385
|
-
packageConfig,
|
|
1386
|
-
base,
|
|
1387
|
-
conditions
|
|
1388
|
-
) {
|
|
1389
|
-
let exports = packageConfig.exports;
|
|
1390
|
-
|
|
1391
|
-
if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) {
|
|
1392
|
-
exports = {'.': exports};
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
if (
|
|
1396
|
-
own.call(exports, packageSubpath) &&
|
|
1397
|
-
!packageSubpath.includes('*') &&
|
|
1398
|
-
!packageSubpath.endsWith('/')
|
|
1399
|
-
) {
|
|
1400
|
-
// @ts-expect-error: indexable.
|
|
1401
|
-
const target = exports[packageSubpath];
|
|
1402
|
-
const resolveResult = resolvePackageTarget(
|
|
1403
|
-
packageJsonUrl,
|
|
1404
|
-
target,
|
|
1405
|
-
'',
|
|
1406
|
-
packageSubpath,
|
|
1407
|
-
base,
|
|
1408
|
-
false,
|
|
1409
|
-
false,
|
|
1410
|
-
conditions
|
|
1411
|
-
);
|
|
1412
|
-
if (resolveResult === null || resolveResult === undefined) {
|
|
1413
|
-
throwExportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
return resolveResult
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
let bestMatch = '';
|
|
1420
|
-
let bestMatchSubpath = '';
|
|
1421
|
-
const keys = Object.getOwnPropertyNames(exports);
|
|
1422
|
-
let i = -1;
|
|
1423
|
-
|
|
1424
|
-
while (++i < keys.length) {
|
|
1425
|
-
const key = keys[i];
|
|
1426
|
-
const patternIndex = key.indexOf('*');
|
|
1427
|
-
|
|
1428
|
-
if (
|
|
1429
|
-
patternIndex !== -1 &&
|
|
1430
|
-
packageSubpath.startsWith(key.slice(0, patternIndex))
|
|
1431
|
-
) {
|
|
1432
|
-
// When this reaches EOL, this can throw at the top of the whole function:
|
|
1433
|
-
//
|
|
1434
|
-
// if (StringPrototypeEndsWith(packageSubpath, '/'))
|
|
1435
|
-
// throwInvalidSubpath(packageSubpath)
|
|
1436
|
-
//
|
|
1437
|
-
// To match "imports" and the spec.
|
|
1438
|
-
if (packageSubpath.endsWith('/')) {
|
|
1439
|
-
emitTrailingSlashPatternDeprecation(
|
|
1440
|
-
packageSubpath,
|
|
1441
|
-
packageJsonUrl,
|
|
1442
|
-
base
|
|
1443
|
-
);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
const patternTrailer = key.slice(patternIndex + 1);
|
|
1447
|
-
|
|
1448
|
-
if (
|
|
1449
|
-
packageSubpath.length >= key.length &&
|
|
1450
|
-
packageSubpath.endsWith(patternTrailer) &&
|
|
1451
|
-
patternKeyCompare(bestMatch, key) === 1 &&
|
|
1452
|
-
key.lastIndexOf('*') === patternIndex
|
|
1453
|
-
) {
|
|
1454
|
-
bestMatch = key;
|
|
1455
|
-
bestMatchSubpath = packageSubpath.slice(
|
|
1456
|
-
patternIndex,
|
|
1457
|
-
packageSubpath.length - patternTrailer.length
|
|
1458
|
-
);
|
|
1459
|
-
}
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
|
-
if (bestMatch) {
|
|
1464
|
-
// @ts-expect-error: indexable.
|
|
1465
|
-
const target = /** @type {unknown} */ (exports[bestMatch]);
|
|
1466
|
-
const resolveResult = resolvePackageTarget(
|
|
1467
|
-
packageJsonUrl,
|
|
1468
|
-
target,
|
|
1469
|
-
bestMatchSubpath,
|
|
1470
|
-
bestMatch,
|
|
1471
|
-
base,
|
|
1472
|
-
true,
|
|
1473
|
-
false,
|
|
1474
|
-
conditions
|
|
1475
|
-
);
|
|
1476
|
-
|
|
1477
|
-
if (resolveResult === null || resolveResult === undefined) {
|
|
1478
|
-
throwExportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
return resolveResult
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
throwExportsNotFound(packageSubpath, packageJsonUrl, base);
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
/**
|
|
1488
|
-
* @param {string} a
|
|
1489
|
-
* @param {string} b
|
|
1490
|
-
*/
|
|
1491
|
-
function patternKeyCompare(a, b) {
|
|
1492
|
-
const aPatternIndex = a.indexOf('*');
|
|
1493
|
-
const bPatternIndex = b.indexOf('*');
|
|
1494
|
-
const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
|
1495
|
-
const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
|
1496
|
-
if (baseLengthA > baseLengthB) return -1
|
|
1497
|
-
if (baseLengthB > baseLengthA) return 1
|
|
1498
|
-
if (aPatternIndex === -1) return 1
|
|
1499
|
-
if (bPatternIndex === -1) return -1
|
|
1500
|
-
if (a.length > b.length) return -1
|
|
1501
|
-
if (b.length > a.length) return 1
|
|
1502
|
-
return 0
|
|
1503
|
-
}
|
|
1504
|
-
|
|
1505
|
-
/**
|
|
1506
|
-
* @param {string} name
|
|
1507
|
-
* @param {URL} base
|
|
1508
|
-
* @param {Set<string>} [conditions]
|
|
1509
|
-
* @returns {URL}
|
|
1510
|
-
*/
|
|
1511
|
-
function packageImportsResolve(name, base, conditions) {
|
|
1512
|
-
if (name === '#' || name.startsWith('#/') || name.endsWith('/')) {
|
|
1513
|
-
const reason = 'is not a valid internal imports specifier name';
|
|
1514
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base))
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
/** @type {URL|undefined} */
|
|
1518
|
-
let packageJsonUrl;
|
|
1519
|
-
|
|
1520
|
-
const packageConfig = getPackageScopeConfig(base);
|
|
1521
|
-
|
|
1522
|
-
if (packageConfig.exists) {
|
|
1523
|
-
packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
|
|
1524
|
-
const imports = packageConfig.imports;
|
|
1525
|
-
if (imports) {
|
|
1526
|
-
if (own.call(imports, name) && !name.includes('*')) {
|
|
1527
|
-
const resolveResult = resolvePackageTarget(
|
|
1528
|
-
packageJsonUrl,
|
|
1529
|
-
imports[name],
|
|
1530
|
-
'',
|
|
1531
|
-
name,
|
|
1532
|
-
base,
|
|
1533
|
-
false,
|
|
1534
|
-
true,
|
|
1535
|
-
conditions
|
|
1536
|
-
);
|
|
1537
|
-
if (resolveResult !== null && resolveResult !== undefined) {
|
|
1538
|
-
return resolveResult
|
|
1539
|
-
}
|
|
1540
|
-
} else {
|
|
1541
|
-
let bestMatch = '';
|
|
1542
|
-
let bestMatchSubpath = '';
|
|
1543
|
-
const keys = Object.getOwnPropertyNames(imports);
|
|
1544
|
-
let i = -1;
|
|
1545
|
-
|
|
1546
|
-
while (++i < keys.length) {
|
|
1547
|
-
const key = keys[i];
|
|
1548
|
-
const patternIndex = key.indexOf('*');
|
|
1549
|
-
|
|
1550
|
-
if (patternIndex !== -1 && name.startsWith(key.slice(0, -1))) {
|
|
1551
|
-
const patternTrailer = key.slice(patternIndex + 1);
|
|
1552
|
-
if (
|
|
1553
|
-
name.length >= key.length &&
|
|
1554
|
-
name.endsWith(patternTrailer) &&
|
|
1555
|
-
patternKeyCompare(bestMatch, key) === 1 &&
|
|
1556
|
-
key.lastIndexOf('*') === patternIndex
|
|
1557
|
-
) {
|
|
1558
|
-
bestMatch = key;
|
|
1559
|
-
bestMatchSubpath = name.slice(
|
|
1560
|
-
patternIndex,
|
|
1561
|
-
name.length - patternTrailer.length
|
|
1562
|
-
);
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
if (bestMatch) {
|
|
1568
|
-
const target = imports[bestMatch];
|
|
1569
|
-
const resolveResult = resolvePackageTarget(
|
|
1570
|
-
packageJsonUrl,
|
|
1571
|
-
target,
|
|
1572
|
-
bestMatchSubpath,
|
|
1573
|
-
bestMatch,
|
|
1574
|
-
base,
|
|
1575
|
-
true,
|
|
1576
|
-
true,
|
|
1577
|
-
conditions
|
|
1578
|
-
);
|
|
1579
|
-
|
|
1580
|
-
if (resolveResult !== null && resolveResult !== undefined) {
|
|
1581
|
-
return resolveResult
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
throwImportNotDefined(name, packageJsonUrl, base);
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
/**
|
|
1592
|
-
* @param {URL} url
|
|
1593
|
-
* @returns {PackageType}
|
|
1594
|
-
*/
|
|
1595
|
-
function getPackageType(url) {
|
|
1596
|
-
const packageConfig = getPackageScopeConfig(url);
|
|
1597
|
-
return packageConfig.type
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
/**
|
|
1601
|
-
* @param {string} specifier
|
|
1602
|
-
* @param {URL} base
|
|
1603
|
-
*/
|
|
1604
|
-
function parsePackageName(specifier, base) {
|
|
1605
|
-
let separatorIndex = specifier.indexOf('/');
|
|
1606
|
-
let validPackageName = true;
|
|
1607
|
-
let isScoped = false;
|
|
1608
|
-
if (specifier[0] === '@') {
|
|
1609
|
-
isScoped = true;
|
|
1610
|
-
if (separatorIndex === -1 || specifier.length === 0) {
|
|
1611
|
-
validPackageName = false;
|
|
1612
|
-
} else {
|
|
1613
|
-
separatorIndex = specifier.indexOf('/', separatorIndex + 1);
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
|
-
const packageName =
|
|
1618
|
-
separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
|
1619
|
-
|
|
1620
|
-
// Package name cannot have leading . and cannot have percent-encoding or
|
|
1621
|
-
// \\ separators.
|
|
1622
|
-
if (invalidPackageNameRegEx.exec(packageName) !== null) {
|
|
1623
|
-
validPackageName = false;
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
if (!validPackageName) {
|
|
1627
|
-
throw new ERR_INVALID_MODULE_SPECIFIER(
|
|
1628
|
-
specifier,
|
|
1629
|
-
'is not a valid package name',
|
|
1630
|
-
fileURLToPath(base)
|
|
1631
|
-
)
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
const packageSubpath =
|
|
1635
|
-
'.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex));
|
|
1636
|
-
|
|
1637
|
-
return {packageName, packageSubpath, isScoped}
|
|
1638
|
-
}
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* @param {string} specifier
|
|
1642
|
-
* @param {URL} base
|
|
1643
|
-
* @param {Set<string>|undefined} conditions
|
|
1644
|
-
* @returns {URL}
|
|
1645
|
-
*/
|
|
1646
|
-
function packageResolve(specifier, base, conditions) {
|
|
1647
|
-
if (builtinModules.includes(specifier)) {
|
|
1648
|
-
return new URL$3('node:' + specifier)
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
const {packageName, packageSubpath, isScoped} = parsePackageName(
|
|
1652
|
-
specifier,
|
|
1653
|
-
base
|
|
1654
|
-
);
|
|
1655
|
-
|
|
1656
|
-
// ResolveSelf
|
|
1657
|
-
const packageConfig = getPackageScopeConfig(base);
|
|
1658
|
-
|
|
1659
|
-
// Can’t test.
|
|
1660
|
-
/* c8 ignore next 16 */
|
|
1661
|
-
if (packageConfig.exists) {
|
|
1662
|
-
const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);
|
|
1663
|
-
if (
|
|
1664
|
-
packageConfig.name === packageName &&
|
|
1665
|
-
packageConfig.exports !== undefined &&
|
|
1666
|
-
packageConfig.exports !== null
|
|
1667
|
-
) {
|
|
1668
|
-
return packageExportsResolve(
|
|
1669
|
-
packageJsonUrl,
|
|
1670
|
-
packageSubpath,
|
|
1671
|
-
packageConfig,
|
|
1672
|
-
base,
|
|
1673
|
-
conditions
|
|
1674
|
-
)
|
|
1675
|
-
}
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
let packageJsonUrl = new URL$3(
|
|
1679
|
-
'./node_modules/' + packageName + '/package.json',
|
|
1680
|
-
base
|
|
1681
|
-
);
|
|
1682
|
-
let packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
1683
|
-
/** @type {string} */
|
|
1684
|
-
let lastPath;
|
|
1685
|
-
do {
|
|
1686
|
-
const stat = tryStatSync(packageJsonPath.slice(0, -13));
|
|
1687
|
-
if (!stat.isDirectory()) {
|
|
1688
|
-
lastPath = packageJsonPath;
|
|
1689
|
-
packageJsonUrl = new URL$3(
|
|
1690
|
-
(isScoped ? '../../../../node_modules/' : '../../../node_modules/') +
|
|
1691
|
-
packageName +
|
|
1692
|
-
'/package.json',
|
|
1693
|
-
packageJsonUrl
|
|
1694
|
-
);
|
|
1695
|
-
packageJsonPath = fileURLToPath(packageJsonUrl);
|
|
1696
|
-
continue
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
// Package match.
|
|
1700
|
-
const packageConfig = getPackageConfig(packageJsonPath, specifier, base);
|
|
1701
|
-
if (packageConfig.exports !== undefined && packageConfig.exports !== null) {
|
|
1702
|
-
return packageExportsResolve(
|
|
1703
|
-
packageJsonUrl,
|
|
1704
|
-
packageSubpath,
|
|
1705
|
-
packageConfig,
|
|
1706
|
-
base,
|
|
1707
|
-
conditions
|
|
1708
|
-
)
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
if (packageSubpath === '.') {
|
|
1712
|
-
return legacyMainResolve(packageJsonUrl, packageConfig, base)
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
return new URL$3(packageSubpath, packageJsonUrl)
|
|
1716
|
-
// Cross-platform root check.
|
|
1717
|
-
} while (packageJsonPath.length !== lastPath.length)
|
|
1718
|
-
|
|
1719
|
-
throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base))
|
|
1720
|
-
}
|
|
1721
|
-
|
|
1722
|
-
/**
|
|
1723
|
-
* @param {string} specifier
|
|
1724
|
-
* @returns {boolean}
|
|
1725
|
-
*/
|
|
1726
|
-
function isRelativeSpecifier(specifier) {
|
|
1727
|
-
if (specifier[0] === '.') {
|
|
1728
|
-
if (specifier.length === 1 || specifier[1] === '/') return true
|
|
1729
|
-
if (
|
|
1730
|
-
specifier[1] === '.' &&
|
|
1731
|
-
(specifier.length === 2 || specifier[2] === '/')
|
|
1732
|
-
) {
|
|
1733
|
-
return true
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
return false
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
/**
|
|
1741
|
-
* @param {string} specifier
|
|
1742
|
-
* @returns {boolean}
|
|
1743
|
-
*/
|
|
1744
|
-
function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
|
1745
|
-
if (specifier === '') return false
|
|
1746
|
-
if (specifier[0] === '/') return true
|
|
1747
|
-
return isRelativeSpecifier(specifier)
|
|
1748
|
-
}
|
|
1749
|
-
|
|
1750
|
-
/**
|
|
1751
|
-
* The “Resolver Algorithm Specification” as detailed in the Node docs (which is
|
|
1752
|
-
* sync and slightly lower-level than `resolve`).
|
|
1753
|
-
*
|
|
1754
|
-
* @param {string} specifier
|
|
1755
|
-
* @param {URL} base
|
|
1756
|
-
* @param {Set<string>} [conditions]
|
|
1757
|
-
* @param {boolean} [preserveSymlinks]
|
|
1758
|
-
* @returns {URL}
|
|
1759
|
-
*/
|
|
1760
|
-
function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
|
1761
|
-
const isRemote = base.protocol === 'http:' || base.protocol === 'https:';
|
|
1762
|
-
// Order swapped from spec for minor perf gain.
|
|
1763
|
-
// Ok since relative URLs cannot parse as URLs.
|
|
1764
|
-
/** @type {URL|undefined} */
|
|
1765
|
-
let resolved;
|
|
1766
|
-
|
|
1767
|
-
if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
|
|
1768
|
-
resolved = new URL$3(specifier, base);
|
|
1769
|
-
} else if (!isRemote && specifier[0] === '#') {
|
|
1770
|
-
resolved = packageImportsResolve(specifier, base, conditions);
|
|
1771
|
-
} else {
|
|
1772
|
-
try {
|
|
1773
|
-
resolved = new URL$3(specifier);
|
|
1774
|
-
} catch {
|
|
1775
|
-
if (!isRemote) {
|
|
1776
|
-
resolved = packageResolve(specifier, base, conditions);
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
|
|
1781
|
-
assert$1(typeof resolved !== 'undefined', 'expected to be defined');
|
|
1782
|
-
|
|
1783
|
-
if (resolved.protocol !== 'file:') {
|
|
1784
|
-
return resolved
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
return finalizeResolution(resolved, base, preserveSymlinks)
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
/**
|
|
1791
|
-
* @param {string} specifier
|
|
1792
|
-
* @param {URL|undefined} parsed
|
|
1793
|
-
* @param {URL|undefined} parsedParentURL
|
|
1794
|
-
*/
|
|
1795
|
-
function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
|
|
1796
|
-
if (
|
|
1797
|
-
parsed &&
|
|
1798
|
-
parsedParentURL &&
|
|
1799
|
-
(parsedParentURL.protocol === 'http:' ||
|
|
1800
|
-
parsedParentURL.protocol === 'https:')
|
|
1801
|
-
) {
|
|
1802
|
-
if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
|
|
1803
|
-
// Data: and blob: disallowed due to allowing file: access via
|
|
1804
|
-
// indirection
|
|
1805
|
-
if (
|
|
1806
|
-
parsed &&
|
|
1807
|
-
parsed.protocol !== 'https:' &&
|
|
1808
|
-
parsed.protocol !== 'http:'
|
|
1809
|
-
) {
|
|
1810
|
-
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
|
1811
|
-
specifier,
|
|
1812
|
-
parsedParentURL,
|
|
1813
|
-
'remote imports cannot import from a local location.'
|
|
1814
|
-
)
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
return {url: parsed.href}
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
if (builtinModules.includes(specifier)) {
|
|
1821
|
-
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
|
1822
|
-
specifier,
|
|
1823
|
-
parsedParentURL,
|
|
1824
|
-
'remote imports cannot import from a local location.'
|
|
1825
|
-
)
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
|
1829
|
-
specifier,
|
|
1830
|
-
parsedParentURL,
|
|
1831
|
-
'only relative and absolute specifiers are supported.'
|
|
1832
|
-
)
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
/**
|
|
1837
|
-
* @param {URL} url
|
|
1838
|
-
*/
|
|
1839
|
-
function throwIfUnsupportedURLProtocol(url) {
|
|
1840
|
-
if (
|
|
1841
|
-
url.protocol !== 'file:' &&
|
|
1842
|
-
url.protocol !== 'data:' &&
|
|
1843
|
-
url.protocol !== 'node:'
|
|
1844
|
-
) {
|
|
1845
|
-
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(url)
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
/**
|
|
1850
|
-
* @param {URL|undefined} parsed
|
|
1851
|
-
* @param {boolean} experimentalNetworkImports
|
|
1852
|
-
*/
|
|
1853
|
-
function throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports) {
|
|
1854
|
-
if (
|
|
1855
|
-
parsed &&
|
|
1856
|
-
parsed.protocol !== 'file:' &&
|
|
1857
|
-
parsed.protocol !== 'data:' &&
|
|
1858
|
-
(!experimentalNetworkImports ||
|
|
1859
|
-
(parsed.protocol !== 'https:' && parsed.protocol !== 'http:'))
|
|
1860
|
-
) {
|
|
1861
|
-
throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(
|
|
1862
|
-
parsed,
|
|
1863
|
-
['file', 'data'].concat(
|
|
1864
|
-
experimentalNetworkImports ? ['https', 'http'] : []
|
|
1865
|
-
)
|
|
1866
|
-
)
|
|
1867
|
-
}
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
/**
|
|
1871
|
-
* @param {string} specifier
|
|
1872
|
-
* @param {{parentURL?: string, conditions?: Array<string>}} context
|
|
1873
|
-
* @returns {{url: string, format?: string|null}}
|
|
1874
|
-
*/
|
|
1875
|
-
function defaultResolve(specifier, context = {}) {
|
|
1876
|
-
const {parentURL} = context;
|
|
1877
|
-
assert$1(typeof parentURL !== 'undefined', 'expected `parentURL` to be defined');
|
|
1878
|
-
|
|
1879
|
-
/** @type {URL|undefined} */
|
|
1880
|
-
let parsedParentURL;
|
|
1881
|
-
if (parentURL) {
|
|
1882
|
-
try {
|
|
1883
|
-
parsedParentURL = new URL$3(parentURL);
|
|
1884
|
-
} catch {
|
|
1885
|
-
// Ignore exception
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
/** @type {URL|undefined} */
|
|
1890
|
-
let parsed;
|
|
1891
|
-
try {
|
|
1892
|
-
parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier)
|
|
1893
|
-
? new URL$3(specifier, parsedParentURL)
|
|
1894
|
-
: new URL$3(specifier);
|
|
1895
|
-
|
|
1896
|
-
if (
|
|
1897
|
-
parsed.protocol === 'data:' ||
|
|
1898
|
-
(experimentalNetworkImports )
|
|
1899
|
-
) {
|
|
1900
|
-
return {url: parsed.href, format: null}
|
|
1901
|
-
}
|
|
1902
|
-
} catch {
|
|
1903
|
-
// Ignore exception
|
|
1904
|
-
}
|
|
1905
|
-
|
|
1906
|
-
// There are multiple deep branches that can either throw or return; instead
|
|
1907
|
-
// of duplicating that deeply nested logic for the possible returns, DRY and
|
|
1908
|
-
// check for a return. This seems the least gnarly.
|
|
1909
|
-
const maybeReturn = checkIfDisallowedImport(
|
|
1910
|
-
specifier,
|
|
1911
|
-
parsed,
|
|
1912
|
-
parsedParentURL
|
|
1913
|
-
);
|
|
1914
|
-
|
|
1915
|
-
if (maybeReturn) return maybeReturn
|
|
1916
|
-
|
|
1917
|
-
// This must come after checkIfDisallowedImport
|
|
1918
|
-
if (parsed && parsed.protocol === 'node:') return {url: specifier}
|
|
1919
|
-
|
|
1920
|
-
throwIfUnsupportedURLScheme(parsed, experimentalNetworkImports);
|
|
1921
|
-
|
|
1922
|
-
const conditions = getConditionsSet(context.conditions);
|
|
1923
|
-
|
|
1924
|
-
const url = moduleResolve(specifier, new URL$3(parentURL), conditions, false);
|
|
1925
|
-
|
|
1926
|
-
throwIfUnsupportedURLProtocol(url);
|
|
1927
|
-
|
|
1928
|
-
return {
|
|
1929
|
-
// Do NOT cast `url` to a string: that will work even when there are real
|
|
1930
|
-
// problems, silencing them
|
|
1931
|
-
url: url.href,
|
|
1932
|
-
format: defaultGetFormatWithoutErrors(url, {parentURL})
|
|
1933
|
-
}
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
/**
|
|
1937
|
-
* @typedef {import('./lib/errors.js').ErrnoException} ErrnoException
|
|
1938
|
-
*/
|
|
1939
|
-
|
|
1940
|
-
/**
|
|
1941
|
-
* Provides a module-relative resolution function scoped to each module,
|
|
1942
|
-
* returning the URL string.
|
|
1943
|
-
* `import.meta.resolve` also accepts a second argument which is the parent
|
|
1944
|
-
* module from which to resolve from.
|
|
1945
|
-
*
|
|
1946
|
-
* This function is asynchronous because the ES module resolver in Node.js is
|
|
1947
|
-
* allowed to be asynchronous.
|
|
1948
|
-
*
|
|
1949
|
-
* @param {string} specifier The module specifier to resolve relative to parent.
|
|
1950
|
-
* @param {string} parent The absolute parent module URL to resolve from.
|
|
1951
|
-
* You should pass `import.meta.url` or something else
|
|
1952
|
-
* @returns {Promise<string>}
|
|
1953
|
-
*/
|
|
1954
|
-
async function resolve$4(specifier, parent) {
|
|
1955
|
-
if (!parent) {
|
|
1956
|
-
throw new Error(
|
|
1957
|
-
'Please pass `parent`: `import-meta-resolve` cannot ponyfill that'
|
|
1958
|
-
)
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
try {
|
|
1962
|
-
return defaultResolve(specifier, {parentURL: parent}).url
|
|
1963
|
-
} catch (error) {
|
|
1964
|
-
const exception = /** @type {ErrnoException} */ (error);
|
|
1965
|
-
|
|
1966
|
-
return exception.code === 'ERR_UNSUPPORTED_DIR_IMPORT' &&
|
|
1967
|
-
typeof exception.url === 'string'
|
|
1968
|
-
? exception.url
|
|
1969
|
-
: Promise.reject(error)
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
216
|
var picomatch$5 = {exports: {}};
|
|
1974
217
|
|
|
1975
218
|
var utils$k = {};
|
|
@@ -4317,7 +2560,7 @@ function getMatcherString$1(id, resolutionBase) {
|
|
|
4317
2560
|
return id;
|
|
4318
2561
|
}
|
|
4319
2562
|
// resolve('') is valid and will default to process.cwd()
|
|
4320
|
-
const basePath = resolve$
|
|
2563
|
+
const basePath = resolve$4(resolutionBase || '')
|
|
4321
2564
|
.split(sep)
|
|
4322
2565
|
.join('/')
|
|
4323
2566
|
// escape all possible (posix + win) path characters that might interfere with regex
|
|
@@ -6322,7 +4565,7 @@ function requireSync () {
|
|
|
6322
4565
|
var minimatch = minimatch_1;
|
|
6323
4566
|
requireGlob().Glob;
|
|
6324
4567
|
var path = require$$0$4;
|
|
6325
|
-
var assert = assert$
|
|
4568
|
+
var assert = assert$1;
|
|
6326
4569
|
var isAbsolute = pathIsAbsolute.exports;
|
|
6327
4570
|
var common = common$c;
|
|
6328
4571
|
var setopts = common.setopts;
|
|
@@ -6982,7 +5225,7 @@ function requireGlob () {
|
|
|
6982
5225
|
var inherits$1 = inherits.exports;
|
|
6983
5226
|
var EE = require$$0$5.EventEmitter;
|
|
6984
5227
|
var path = require$$0$4;
|
|
6985
|
-
var assert = assert$
|
|
5228
|
+
var assert = assert$1;
|
|
6986
5229
|
var isAbsolute = pathIsAbsolute.exports;
|
|
6987
5230
|
var globSync = requireSync();
|
|
6988
5231
|
var common = common$c;
|
|
@@ -9165,7 +7408,7 @@ function getPackageEntryPoint(dirPath) {
|
|
|
9165
7408
|
|
|
9166
7409
|
function isDirectory(path) {
|
|
9167
7410
|
try {
|
|
9168
|
-
if (statSync$
|
|
7411
|
+
if (statSync$1(path).isDirectory()) return true;
|
|
9169
7412
|
} catch (ignored) {
|
|
9170
7413
|
// Nothing to do here
|
|
9171
7414
|
}
|
|
@@ -9182,11 +7425,11 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
|
|
|
9182
7425
|
? dynamicRequireModules.delete(targetPath)
|
|
9183
7426
|
: dynamicRequireModules.set(targetPath, resolvedPath);
|
|
9184
7427
|
for (const path of globExports.sync(isNegated ? pattern.substr(1) : pattern)) {
|
|
9185
|
-
const resolvedPath = resolve$
|
|
7428
|
+
const resolvedPath = resolve$4(path);
|
|
9186
7429
|
const requirePath = normalizePathSlashes(resolvedPath);
|
|
9187
7430
|
if (isDirectory(resolvedPath)) {
|
|
9188
7431
|
dirNames.add(resolvedPath);
|
|
9189
|
-
const modulePath = resolve$
|
|
7432
|
+
const modulePath = resolve$4(join$1(resolvedPath, getPackageEntryPoint(path)));
|
|
9190
7433
|
modifyMap(requirePath, modulePath);
|
|
9191
7434
|
modifyMap(normalizePathSlashes(modulePath), modulePath);
|
|
9192
7435
|
} else {
|
|
@@ -9483,12 +7726,12 @@ function resolveExtensions(importee, importer, extensions) {
|
|
|
9483
7726
|
// not our problem
|
|
9484
7727
|
if (importee[0] !== '.' || !importer) return undefined;
|
|
9485
7728
|
|
|
9486
|
-
const resolved = resolve$
|
|
7729
|
+
const resolved = resolve$4(dirname$1(importer), importee);
|
|
9487
7730
|
const candidates = getCandidates(resolved, extensions);
|
|
9488
7731
|
|
|
9489
7732
|
for (let i = 0; i < candidates.length; i += 1) {
|
|
9490
7733
|
try {
|
|
9491
|
-
const stats = statSync$
|
|
7734
|
+
const stats = statSync$1(candidates[i]);
|
|
9492
7735
|
if (stats.isFile()) return { id: candidates[i] };
|
|
9493
7736
|
} catch (err) {
|
|
9494
7737
|
/* noop */
|
|
@@ -10996,7 +9239,7 @@ function commonjs(options = {}) {
|
|
|
10996
9239
|
|
|
10997
9240
|
const dynamicRequireRoot =
|
|
10998
9241
|
typeof options.dynamicRequireRoot === 'string'
|
|
10999
|
-
? resolve$
|
|
9242
|
+
? resolve$4(options.dynamicRequireRoot)
|
|
11000
9243
|
: process.cwd();
|
|
11001
9244
|
const { commonDir, dynamicRequireModules } = getDynamicRequireModules(
|
|
11002
9245
|
options.dynamicRequireTargets,
|
|
@@ -13286,7 +11529,7 @@ function getMatcherString(id, resolutionBase) {
|
|
|
13286
11529
|
return normalizePath$4(id);
|
|
13287
11530
|
}
|
|
13288
11531
|
// resolve('') is valid and will default to process.cwd()
|
|
13289
|
-
const basePath = normalizePath$4(resolve$
|
|
11532
|
+
const basePath = normalizePath$4(resolve$4(resolutionBase || ''))
|
|
13290
11533
|
// escape all possible (posix + win) path characters that might interfere with regex
|
|
13291
11534
|
.replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
|
|
13292
11535
|
// Note that we use posix.join because:
|
|
@@ -13493,7 +11736,7 @@ try {
|
|
|
13493
11736
|
catch { }
|
|
13494
11737
|
const ssrExtensions = ['.js', '.cjs', '.json', '.node'];
|
|
13495
11738
|
function resolveFrom(id, basedir, preserveSymlinks = false, ssr = false) {
|
|
13496
|
-
return resolve$
|
|
11739
|
+
return resolve$5.sync(id, {
|
|
13497
11740
|
basedir,
|
|
13498
11741
|
paths: [],
|
|
13499
11742
|
extensions: ssr ? ssrExtensions : DEFAULT_EXTENSIONS$1,
|
|
@@ -13585,7 +11828,7 @@ const dataUrlRE = /^\s*data:/i;
|
|
|
13585
11828
|
const isDataUrl = (url) => dataUrlRE.test(url);
|
|
13586
11829
|
const virtualModuleRE = /^virtual-module:.*/;
|
|
13587
11830
|
const virtualModulePrefix = 'virtual-module:';
|
|
13588
|
-
const knownJsSrcRE = /\.((j|t)sx?|m[jt]s|vue|marko|svelte|astro)($|\?)/;
|
|
11831
|
+
const knownJsSrcRE = /\.((j|t)sx?|m[jt]s|vue|marko|svelte|astro|imba)($|\?)/;
|
|
13589
11832
|
const isJSRequest = (url) => {
|
|
13590
11833
|
url = cleanUrl(url);
|
|
13591
11834
|
if (knownJsSrcRE.test(url)) {
|
|
@@ -13629,10 +11872,7 @@ function removeDirectQuery(url) {
|
|
|
13629
11872
|
function injectQuery(url, queryToInject) {
|
|
13630
11873
|
// encode percents for consistent behavior with pathToFileURL
|
|
13631
11874
|
// see #2614 for details
|
|
13632
|
-
|
|
13633
|
-
if (resolvedUrl.protocol !== 'relative:') {
|
|
13634
|
-
resolvedUrl = pathToFileURL(url);
|
|
13635
|
-
}
|
|
11875
|
+
const resolvedUrl = new URL$3(url.replace(/%/g, '%25'), 'relative:///');
|
|
13636
11876
|
const { search, hash } = resolvedUrl;
|
|
13637
11877
|
let pathname = cleanUrl(url);
|
|
13638
11878
|
pathname = isWindows$4 ? slash$1(pathname) : pathname;
|
|
@@ -14302,6 +12542,18 @@ const isNonDriveRelativeAbsolutePath = (p) => {
|
|
|
14302
12542
|
return p.startsWith('/');
|
|
14303
12543
|
return windowsDrivePathPrefixRE.test(p);
|
|
14304
12544
|
};
|
|
12545
|
+
function joinUrlSegments(a, b) {
|
|
12546
|
+
if (!a || !b) {
|
|
12547
|
+
return a || b || '';
|
|
12548
|
+
}
|
|
12549
|
+
if (a.endsWith('/')) {
|
|
12550
|
+
a = a.substring(0, a.length - 1);
|
|
12551
|
+
}
|
|
12552
|
+
if (!b.startsWith('/')) {
|
|
12553
|
+
b = '/' + b;
|
|
12554
|
+
}
|
|
12555
|
+
return a + b;
|
|
12556
|
+
}
|
|
14305
12557
|
|
|
14306
12558
|
/* eslint no-console: 0 */
|
|
14307
12559
|
const LogLevels = {
|
|
@@ -15466,8 +13718,8 @@ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || func
|
|
|
15466
13718
|
};
|
|
15467
13719
|
Object.defineProperty(dist$1, "__esModule", { value: true });
|
|
15468
13720
|
var Worker_1 = dist$1.Worker = void 0;
|
|
15469
|
-
const os_1 = __importDefault(require$$
|
|
15470
|
-
const worker_threads_1 = require$$1
|
|
13721
|
+
const os_1 = __importDefault(require$$2);
|
|
13722
|
+
const worker_threads_1 = require$$1;
|
|
15471
13723
|
class Worker {
|
|
15472
13724
|
constructor(fn, options = {}) {
|
|
15473
13725
|
this.code = genWorkerCode(fn);
|
|
@@ -15888,7 +14140,7 @@ var isGlob$2 = function isGlob(str, options) {
|
|
|
15888
14140
|
|
|
15889
14141
|
var isGlob$1 = isGlob$2;
|
|
15890
14142
|
var pathPosixDirname = require$$0$4.posix.dirname;
|
|
15891
|
-
var isWin32 = require$$
|
|
14143
|
+
var isWin32 = require$$2.platform() === 'win32';
|
|
15892
14144
|
|
|
15893
14145
|
var slash = '/';
|
|
15894
14146
|
var backslash = /\\/g;
|
|
@@ -20023,7 +18275,7 @@ var settings = {};
|
|
|
20023
18275
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20024
18276
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
20025
18277
|
const fs = require$$0__default;
|
|
20026
|
-
const os = require$$
|
|
18278
|
+
const os = require$$2;
|
|
20027
18279
|
/**
|
|
20028
18280
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
20029
18281
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
@@ -20153,7 +18405,7 @@ var dist = {};
|
|
|
20153
18405
|
exports.lilconfigSync = exports.lilconfig = exports.defaultLoaders = void 0;
|
|
20154
18406
|
const path = require$$0$4;
|
|
20155
18407
|
const fs = require$$0__default;
|
|
20156
|
-
const os = require$$
|
|
18408
|
+
const os = require$$2;
|
|
20157
18409
|
const fsReadFileAsync = fs.promises.readFile;
|
|
20158
18410
|
function getDefaultSearchPlaces(name) {
|
|
20159
18411
|
return [
|
|
@@ -34664,7 +32916,7 @@ pp.readWord = function() {
|
|
|
34664
32916
|
|
|
34665
32917
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
34666
32918
|
|
|
34667
|
-
var version = "8.8.
|
|
32919
|
+
var version = "8.8.1";
|
|
34668
32920
|
|
|
34669
32921
|
Parser.acorn = {
|
|
34670
32922
|
Parser: Parser,
|
|
@@ -35381,9 +33633,8 @@ function fileToDevUrl(id, config) {
|
|
|
35381
33633
|
// (this is special handled by the serve static middleware
|
|
35382
33634
|
rtn = path$n.posix.join(FS_PREFIX + id);
|
|
35383
33635
|
}
|
|
35384
|
-
const
|
|
35385
|
-
|
|
35386
|
-
return origin + devBase + rtn.replace(/^\//, '');
|
|
33636
|
+
const base = joinUrlSegments(config.server?.origin ?? '', config.base);
|
|
33637
|
+
return joinUrlSegments(base, rtn.replace(/^\//, ''));
|
|
35387
33638
|
}
|
|
35388
33639
|
function getAssetFilename(hash, config) {
|
|
35389
33640
|
return assetHashToFilenameMap.get(config)?.get(hash);
|
|
@@ -35482,7 +33733,7 @@ const publicAssetUrlRE = /__VITE_PUBLIC_ASSET__([a-z\d]{8})__/g;
|
|
|
35482
33733
|
function publicFileToBuiltUrl(url, config) {
|
|
35483
33734
|
if (config.command !== 'build') {
|
|
35484
33735
|
// We don't need relative base or renderBuiltUrl support during dev
|
|
35485
|
-
return config.base
|
|
33736
|
+
return joinUrlSegments(config.base, url);
|
|
35486
33737
|
}
|
|
35487
33738
|
const hash = getHash(url);
|
|
35488
33739
|
let cache = publicAssetUrlCache.get(config);
|
|
@@ -35584,8 +33835,8 @@ async function urlToBuiltUrl(url, importer, config, pluginContext) {
|
|
|
35584
33835
|
true);
|
|
35585
33836
|
}
|
|
35586
33837
|
|
|
35587
|
-
/* es-module-lexer 1.0
|
|
35588
|
-
const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$b(E,g="@"){if(!C)return init.then((()=>parse$b(E)));const I=E.length+1,o=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;o>0&&C.memory.grow(Math.ceil(o/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const k=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),o=C.se();let K;C.ip()&&(K=w(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),k.push({n:K,s:A,e:Q,ss:I,se:o,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),o=I[0],K=B<0?void 0:E.slice(B,g),k=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===o||"'"===o?w(I):I,ln:'"'===k||"'"===k?w(K):K});}function w(A){try{return (0, eval)(A)}catch(A){}}return [k,D,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMtLAABAQICAgICAgICAgICAgICAgIAAwMDBAQAAAADAAAAAAMDBQYAAAcABgIFBAUBcAEBAQUDAQABBg8CfwFBsPIAC38AQbDyAAsHcBMGbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJhaQAIAmlkAAkCaXAACgJlcwALAmVlAAwDZWxzAA0DZWxlAA4CcmkADwJyZQAQAWYAEQVwYXJzZQASC19faGVhcF9iYXNlAwEK6TosaAEBf0EAIAA2AvgJQQAoAtQJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgL8CUEAIAA2AoAKQQBBADYC2AlBAEEANgLoCUEAQQA2AuAJQQBBADYC3AlBAEEANgLwCUEAQQA2AuQJIAELnwEBA39BACgC6AkhBEEAQQAoAoAKIgU2AugJQQAgBDYC7AlBACAFQSBqNgKACiAEQRxqQdgJIAQbIAU2AgBBACgCzAkhBEEAKALICSEGIAUgATYCACAFIAA2AgggBSACIAJBAmpBACAGIANGGyAEIANGGzYCDCAFIAM2AhQgBUEANgIQIAUgAjYCBCAFQQA2AhwgBUEAKALICSADRjoAGAtWAQF/QQAoAvAJIgRBEGpB3AkgBBtBACgCgAoiBDYCAEEAIAQ2AvAJQQAgBEEUajYCgAogBEEANgIQIAQgAzYCDCAEIAI2AgggBCABNgIEIAQgADYCAAsIAEEAKAKECgsVAEEAKALgCSgCAEEAKALUCWtBAXULHgEBf0EAKALgCSgCBCIAQQAoAtQJa0EBdUF/IAAbCxUAQQAoAuAJKAIIQQAoAtQJa0EBdQseAQF/QQAoAuAJKAIMIgBBACgC1AlrQQF1QX8g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SIBQXdqIgJBF0sNAEEBIAJ0QZ+AgARxDQILIAFBoAFGDQEgACECIAEQJQ0CQQAhAkEAQQAoAqQKIgBBAmo2AqQKIAAvAQIiAA0ADAILCyAAIQILIAJB//8DcQurAQEEfwJAAkBBACgCpAoiAi8BACIDQeEARg0AIAEhBCAAIQUMAQtBACACQQRqNgKkCkEBECYhAkEAKAKkCiEFAkACQCACQSJGDQAgAkEnRg0AIAIQKBpBACgCpAohBAwBCyACEBhBAEEAKAKkCkECaiIENgKkCgtBARAmIQNBACgCpAohAgsCQCACIAVGDQAgBSAEQQAgACAAIAFGIgIbQQAgASACGxACCyADC3IBBH9BACgCpAohAEEAKAKoCiEBAkACQANAIABBAmohAiAAIAFPDQECQAJAIAIvAQAiA0Gkf2oOAgEEAAsgAiEAIANBdmoOBAIBAQIBCyAAQQRqIQAMAAsLQQAgAjYCpAoQIkEADwtBACACNgKkCkHdAAtJAQN/QQAhAwJAIAJFDQACQANAIAAtAAAiBCABLQAAIgVHDQEgAUEBaiEBIABBAWohACACQX9qIgINAAwCCwsgBCAFayEDCyADCwvkAQIAQYAIC8YBAAB4AHAAbwByAHQAbQBwAG8AcgB0AGUAdABhAGYAcgBvAG0AdQBuAGMAdABpAG8AbgBzAHMAZQByAHQAdgBvAHkAaQBlAGQAZQBsAGUAYwBvAG4AdABpAG4AaQBuAHMAdABhAG4AdAB5AGIAcgBlAGEAcgBlAHQAdQByAGQAZQBiAHUAZwBnAGUAYQB3AGEAaQB0AGgAcgB3AGgAaQBsAGUAZgBvAHIAaQBmAGMAYQB0AGMAZgBpAG4AYQBsAGwAZQBsAHMAAEHICQsQAQAAAAIAAAAABAAAMDkAAA==","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),(A=>A.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
|
|
33838
|
+
/* es-module-lexer 1.1.0 */
|
|
33839
|
+
const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse$b(E,g="@"){if(!C)return init.then((()=>parse$b(E)));const I=E.length+1,K=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;K>0&&C.memory.grow(Math.ceil(K/65536));const k=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,k,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.ai(),g=C.id(),I=C.ss(),K=C.se();let k;C.ip()&&(k=w(E.slice(-1===g?A-1:A,-1===g?Q+1:Q))),o.push({n:k,s:A,e:Q,ss:I,se:K,d:g,a:B});}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),K=I[0],k=B<0?void 0:E.slice(B,g),o=k?k[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===K||"'"===K?w(I):I,ln:'"'===o||"'"===o?w(k):k});}function w(A){try{return (0, eval)(A)}catch(A){}}return [o,D,!!C.f()]}function Q(A,Q){const B=A.length;let C=0;for(;C<B;){const B=A.charCodeAt(C);Q[C++]=(255&B)<<8|B>>>8;}}function B(A,Q){const B=A.length;let C=0;for(;C<B;)Q[C]=A.charCodeAt(C++);}let C;const init=WebAssembly.compile((E="AGFzbQEAAAABKghgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gAn9/AAMtLAABAQICAgICAgICAgICAgICAgIAAwMDBAQAAAADAAAAAAMDBQYAAAcABgIFBAUBcAEBAQUDAQABBg8CfwFBsPIAC38AQbDyAAsHcBMGbWVtb3J5AgACc2EAAAFlAAMCaXMABAJpZQAFAnNzAAYCc2UABwJhaQAIAmlkAAkCaXAACgJlcwALAmVlAAwDZWxzAA0DZWxlAA4CcmkADwJyZQAQAWYAEQVwYXJzZQASC19faGVhcF9iYXNlAwEKsjssaAEBf0EAIAA2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QCAAQQJqIQIgACABTw0BAkACQCACLwEAIgNBpH9qDgIBBAALIAIhACADQXZqDgQCAQECAQsgAEEEaiEADAALC0EAIAI2AqQKECJBAA8LQQAgAjYCpApB3QALSQEDf0EAIQMCQCACRQ0AAkADQCAALQAAIgQgAS0AACIFRw0BIAFBAWohASAAQQFqIQAgAkF/aiICDQAMAgsLIAQgBWshAwsgAwsL5AECAEGACAvGAQAAeABwAG8AcgB0AG0AcABvAHIAdABlAHQAYQBmAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGYAbwByAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABByAkLEAEAAAACAAAAAAQAADA5AAA=","undefined"!=typeof Buffer?Buffer.from(E,"base64"):Uint8Array.from(atob(E),(A=>A.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A;}));var E;
|
|
35589
33840
|
|
|
35590
33841
|
/**
|
|
35591
33842
|
* @param {object} exports
|
|
@@ -35774,7 +34025,7 @@ createError(
|
|
|
35774
34025
|
(pkgPath, key, target, isImport = false, base = void 0) => {
|
|
35775
34026
|
const relError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
35776
34027
|
if (key === ".") {
|
|
35777
|
-
assert$
|
|
34028
|
+
assert$1(isImport === false);
|
|
35778
34029
|
return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ""}${relError ? '; targets must start with "./"' : ""}`;
|
|
35779
34030
|
}
|
|
35780
34031
|
return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
|
@@ -35820,7 +34071,7 @@ createError(
|
|
|
35820
34071
|
createError(
|
|
35821
34072
|
"ERR_INVALID_ARG_VALUE",
|
|
35822
34073
|
(name, value, reason = "is invalid") => {
|
|
35823
|
-
let inspected = inspect
|
|
34074
|
+
let inspected = inspect(value);
|
|
35824
34075
|
if (inspected.length > 128) {
|
|
35825
34076
|
inspected = `${inspected.slice(0, 128)}...`;
|
|
35826
34077
|
}
|
|
@@ -35921,14 +34172,14 @@ const captureLargerStackTrace = hideStackFrames(
|
|
|
35921
34172
|
function getMessage(key, args, self) {
|
|
35922
34173
|
const message = messages.get(key);
|
|
35923
34174
|
if (typeof message === "function") {
|
|
35924
|
-
assert$
|
|
34175
|
+
assert$1(
|
|
35925
34176
|
message.length <= args.length,
|
|
35926
34177
|
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${message.length}).`
|
|
35927
34178
|
);
|
|
35928
34179
|
return Reflect.apply(message, self, args);
|
|
35929
34180
|
}
|
|
35930
34181
|
const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;
|
|
35931
|
-
assert$
|
|
34182
|
+
assert$1(
|
|
35932
34183
|
expectedLength === args.length,
|
|
35933
34184
|
`Code: ${key}; The provided arguments length (${args.length}) does not match the required ones (${expectedLength}).`
|
|
35934
34185
|
);
|
|
@@ -35936,10 +34187,10 @@ function getMessage(key, args, self) {
|
|
|
35936
34187
|
return message;
|
|
35937
34188
|
}
|
|
35938
34189
|
args.unshift(message);
|
|
35939
|
-
return Reflect.apply(format$
|
|
34190
|
+
return Reflect.apply(format$2, null, args);
|
|
35940
34191
|
}
|
|
35941
34192
|
Object.freeze(["node", "import"]);
|
|
35942
|
-
pathToFileURL
|
|
34193
|
+
pathToFileURL(process.cwd());
|
|
35943
34194
|
|
|
35944
34195
|
const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;)import\s*(["'\s]*(?<imports>[\w*${}\n\r\t, /]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^"\s](?=\s*")|(?<='\s*)[^']*[^'\s](?=\s*'))\s*["'][\s;]*/gm;
|
|
35945
34196
|
function findStaticImports(code) {
|
|
@@ -37046,12 +35297,28 @@ function packageEntryFailure(id, details) {
|
|
|
37046
35297
|
`The package may have incorrect main/module/exports specified in its package.json` +
|
|
37047
35298
|
(details ? ': ' + details : '.'));
|
|
37048
35299
|
}
|
|
35300
|
+
const conditionalConditions = new Set(['production', 'development', 'module']);
|
|
37049
35301
|
function resolveExports(pkg, key, options, targetWeb) {
|
|
37050
|
-
const
|
|
37051
|
-
|
|
35302
|
+
const overrideConditions = options.overrideConditions
|
|
35303
|
+
? new Set(options.overrideConditions)
|
|
35304
|
+
: undefined;
|
|
35305
|
+
const conditions = [];
|
|
35306
|
+
if ((!overrideConditions || overrideConditions.has('production')) &&
|
|
35307
|
+
options.isProduction) {
|
|
35308
|
+
conditions.push('production');
|
|
35309
|
+
}
|
|
35310
|
+
if ((!overrideConditions || overrideConditions.has('development')) &&
|
|
35311
|
+
!options.isProduction) {
|
|
35312
|
+
conditions.push('development');
|
|
35313
|
+
}
|
|
35314
|
+
if ((!overrideConditions || overrideConditions.has('module')) &&
|
|
35315
|
+
!options.isRequire) {
|
|
37052
35316
|
conditions.push('module');
|
|
37053
35317
|
}
|
|
37054
|
-
if (options.
|
|
35318
|
+
if (options.overrideConditions) {
|
|
35319
|
+
conditions.push(...options.overrideConditions.filter((condition) => conditionalConditions.has(condition)));
|
|
35320
|
+
}
|
|
35321
|
+
else if (options.conditions.length > 0) {
|
|
37055
35322
|
conditions.push(...options.conditions);
|
|
37056
35323
|
}
|
|
37057
35324
|
return resolve(pkg, key, {
|
|
@@ -37214,6 +35481,7 @@ const externalTypes = [
|
|
|
37214
35481
|
'svelte',
|
|
37215
35482
|
'marko',
|
|
37216
35483
|
'astro',
|
|
35484
|
+
'imba',
|
|
37217
35485
|
// JSX/TSX may be configured to be compiled differently from how esbuild
|
|
37218
35486
|
// handles it by default, so exclude them as well
|
|
37219
35487
|
'jsx',
|
|
@@ -38985,12 +37253,12 @@ var convertSourceMap = {};
|
|
|
38985
37253
|
} (convertSourceMap));
|
|
38986
37254
|
|
|
38987
37255
|
function totalist(dir, callback, pre='') {
|
|
38988
|
-
dir = resolve$
|
|
37256
|
+
dir = resolve$4('.', dir);
|
|
38989
37257
|
let arr = readdirSync(dir);
|
|
38990
37258
|
let i=0, abs, stats;
|
|
38991
37259
|
for (; i < arr.length; i++) {
|
|
38992
37260
|
abs = join$1(dir, arr[i]);
|
|
38993
|
-
stats = statSync$
|
|
37261
|
+
stats = statSync$1(abs);
|
|
38994
37262
|
stats.isDirectory()
|
|
38995
37263
|
? totalist(abs, callback, join$1(pre, arr[i]))
|
|
38996
37264
|
: callback(join$1(pre, arr[i]), abs, stats);
|
|
@@ -39144,7 +37412,7 @@ function toHeaders(name, stats, isEtag) {
|
|
|
39144
37412
|
}
|
|
39145
37413
|
|
|
39146
37414
|
function sirv (dir, opts={}) {
|
|
39147
|
-
dir = resolve$
|
|
37415
|
+
dir = resolve$4(dir || '.');
|
|
39148
37416
|
|
|
39149
37417
|
let isNotFound = opts.onNoMatch || is404;
|
|
39150
37418
|
let setHeaders = opts.setHeaders || noop$2;
|
|
@@ -39761,6 +38029,8 @@ function importAnalysisPlugin(config) {
|
|
|
39761
38029
|
if (ssr) {
|
|
39762
38030
|
return [url, url];
|
|
39763
38031
|
}
|
|
38032
|
+
// fix#9534, prevent the importerModuleNode being stopped from propagating updates
|
|
38033
|
+
importerModule.isSelfAccepting = false;
|
|
39764
38034
|
return this.error(`Failed to resolve import "${url}" from "${path$n.relative(process.cwd(), importerFile)}". Does the file exist?`, pos);
|
|
39765
38035
|
}
|
|
39766
38036
|
const isRelative = url.startsWith('.');
|
|
@@ -42755,7 +41025,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
42755
41025
|
// TODO: use import()
|
|
42756
41026
|
const _require = createRequire$1(import.meta.url);
|
|
42757
41027
|
// get rollup version
|
|
42758
|
-
const rollupPkgPath = resolve$
|
|
41028
|
+
const rollupPkgPath = resolve$6(_require.resolve('rollup'), '../../package.json');
|
|
42759
41029
|
const minimalContext = {
|
|
42760
41030
|
meta: {
|
|
42761
41031
|
rollupVersion: JSON.parse(fs$l.readFileSync(rollupPkgPath, 'utf-8'))
|
|
@@ -43190,7 +41460,7 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
43190
41460
|
}
|
|
43191
41461
|
|
|
43192
41462
|
const debug$8 = createDebugger('vite:deps');
|
|
43193
|
-
const htmlTypesRE = /\.(html|vue|svelte|astro)$/;
|
|
41463
|
+
const htmlTypesRE = /\.(html|vue|svelte|astro|imba)$/;
|
|
43194
41464
|
// A simple regex to detect import sources. This is only used on
|
|
43195
41465
|
// <script lang="ts"> blocks in vue (setup only) or svelte files, since
|
|
43196
41466
|
// seemingly unused imports are dropped by esbuild when transpiling TS which
|
|
@@ -46181,7 +44451,6 @@ function cssPlugin(config) {
|
|
|
46181
44451
|
tryIndex: false,
|
|
46182
44452
|
extensions: []
|
|
46183
44453
|
});
|
|
46184
|
-
const atImportResolvers = createCSSResolvers(config);
|
|
46185
44454
|
return {
|
|
46186
44455
|
name: 'vite:css',
|
|
46187
44456
|
configureServer(_server) {
|
|
@@ -46207,16 +44476,20 @@ function cssPlugin(config) {
|
|
|
46207
44476
|
return publicFileToBuiltUrl(url, config);
|
|
46208
44477
|
}
|
|
46209
44478
|
else {
|
|
46210
|
-
return config.base
|
|
44479
|
+
return joinUrlSegments(config.base, url);
|
|
46211
44480
|
}
|
|
46212
44481
|
}
|
|
46213
44482
|
const resolved = await resolveUrl(url, importer);
|
|
46214
44483
|
if (resolved) {
|
|
46215
44484
|
return fileToUrl(resolved, config, this);
|
|
46216
44485
|
}
|
|
44486
|
+
if (config.command === 'build') {
|
|
44487
|
+
// #9800 If we cannot resolve the css url, leave a warning.
|
|
44488
|
+
config.logger.warnOnce(`\n${url} referenced in ${id} didn't resolve at build time, it will remain unchanged to be resolved at runtime`);
|
|
44489
|
+
}
|
|
46217
44490
|
return url;
|
|
46218
44491
|
};
|
|
46219
|
-
const { code: css, modules, deps, map } = await compileCSS(id, raw, config, urlReplacer
|
|
44492
|
+
const { code: css, modules, deps, map } = await compileCSS(id, raw, config, urlReplacer);
|
|
46220
44493
|
if (modules) {
|
|
46221
44494
|
moduleCache.set(id, modules);
|
|
46222
44495
|
}
|
|
@@ -46231,7 +44504,6 @@ function cssPlugin(config) {
|
|
|
46231
44504
|
// server only logic for handling CSS @import dependency hmr
|
|
46232
44505
|
const { moduleGraph } = server;
|
|
46233
44506
|
const thisModule = moduleGraph.getModuleById(id);
|
|
46234
|
-
const devBase = config.base;
|
|
46235
44507
|
if (thisModule) {
|
|
46236
44508
|
// CSS modules cannot self-accept since it exports values
|
|
46237
44509
|
const isSelfAccepting = !modules && !inlineRE.test(id) && !htmlProxyRE.test(id);
|
|
@@ -46239,6 +44511,7 @@ function cssPlugin(config) {
|
|
|
46239
44511
|
// record deps in the module graph so edits to @import css can trigger
|
|
46240
44512
|
// main import to hot update
|
|
46241
44513
|
const depModules = new Set();
|
|
44514
|
+
const devBase = config.base;
|
|
46242
44515
|
for (const file of deps) {
|
|
46243
44516
|
depModules.add(isCSSRequest(file)
|
|
46244
44517
|
? moduleGraph.createFileOnlyEntry(file)
|
|
@@ -46337,9 +44610,8 @@ function cssPostPlugin(config) {
|
|
|
46337
44610
|
return `export default ${JSON.stringify(css)}`;
|
|
46338
44611
|
}
|
|
46339
44612
|
const cssContent = await getContentWithSourcemap(css);
|
|
46340
|
-
const devBase = config.base;
|
|
46341
44613
|
const code = [
|
|
46342
|
-
`import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path$n.posix.join(
|
|
44614
|
+
`import { updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle } from ${JSON.stringify(path$n.posix.join(config.base, CLIENT_PUBLIC_PATH))}`,
|
|
46343
44615
|
`const __vite__id = ${JSON.stringify(id)}`,
|
|
46344
44616
|
`const __vite__css = ${JSON.stringify(cssContent)}`,
|
|
46345
44617
|
`__vite__updateStyle(__vite__id, __vite__css)`,
|
|
@@ -46597,7 +44869,8 @@ function createCSSResolvers(config) {
|
|
|
46597
44869
|
function getCssResolversKeys(resolvers) {
|
|
46598
44870
|
return Object.keys(resolvers);
|
|
46599
44871
|
}
|
|
46600
|
-
|
|
44872
|
+
const configToAtImportResolvers = new WeakMap();
|
|
44873
|
+
async function compileCSS(id, code, config, urlReplacer) {
|
|
46601
44874
|
const { modules: modulesOptions, preprocessorOptions, devSourcemap } = config.css || {};
|
|
46602
44875
|
const isModule = modulesOptions !== false && cssModuleRE.test(id);
|
|
46603
44876
|
// although at serve time it can work without processing, we do need to
|
|
@@ -46617,6 +44890,11 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
46617
44890
|
let preprocessorMap;
|
|
46618
44891
|
let modules;
|
|
46619
44892
|
const deps = new Set();
|
|
44893
|
+
let atImportResolvers = configToAtImportResolvers.get(config);
|
|
44894
|
+
if (!atImportResolvers) {
|
|
44895
|
+
atImportResolvers = createCSSResolvers(config);
|
|
44896
|
+
configToAtImportResolvers.set(config, atImportResolvers);
|
|
44897
|
+
}
|
|
46620
44898
|
// 2. pre-processors: sass etc.
|
|
46621
44899
|
if (isPreProcessor(lang)) {
|
|
46622
44900
|
const preProcessor = preProcessors[lang];
|
|
@@ -46683,12 +44961,14 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
46683
44961
|
}
|
|
46684
44962
|
}));
|
|
46685
44963
|
}
|
|
46686
|
-
|
|
46687
|
-
|
|
46688
|
-
|
|
46689
|
-
|
|
44964
|
+
if (urlReplacer) {
|
|
44965
|
+
postcssPlugins.push(UrlRewritePostcssPlugin({
|
|
44966
|
+
replacer: urlReplacer,
|
|
44967
|
+
logger: config.logger
|
|
44968
|
+
}));
|
|
44969
|
+
}
|
|
46690
44970
|
if (isModule) {
|
|
46691
|
-
postcssPlugins.unshift((await import('./dep-
|
|
44971
|
+
postcssPlugins.unshift((await import('./dep-9055f77d.js').then(function (n) { return n.i; })).default({
|
|
46692
44972
|
...modulesOptions,
|
|
46693
44973
|
getJSON(cssFileName, _modules, outputFileName) {
|
|
46694
44974
|
modules = _modules;
|
|
@@ -46798,6 +45078,12 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
46798
45078
|
deps
|
|
46799
45079
|
};
|
|
46800
45080
|
}
|
|
45081
|
+
/**
|
|
45082
|
+
* @experimental
|
|
45083
|
+
*/
|
|
45084
|
+
async function preprocessCSS(code, filename, config) {
|
|
45085
|
+
return await compileCSS(filename, code, config);
|
|
45086
|
+
}
|
|
46801
45087
|
async function formatPostcssSourceMap(rawMap, file) {
|
|
46802
45088
|
const inputFileDir = path$n.dirname(file);
|
|
46803
45089
|
const sources = rawMap.sources.map((source) => {
|
|
@@ -47543,15 +45829,15 @@ function ssrManifestPlugin(config) {
|
|
|
47543
45829
|
const normalizedId = normalizePath$3(relative$2(config.root, id));
|
|
47544
45830
|
const mappedChunks = ssrManifest[normalizedId] ?? (ssrManifest[normalizedId] = []);
|
|
47545
45831
|
if (!chunk.isEntry) {
|
|
47546
|
-
mappedChunks.push(base
|
|
45832
|
+
mappedChunks.push(joinUrlSegments(base, chunk.fileName));
|
|
47547
45833
|
// <link> tags for entry chunks are already generated in static HTML,
|
|
47548
45834
|
// so we only need to record info for non-entry chunks.
|
|
47549
45835
|
chunk.viteMetadata.importedCss.forEach((file) => {
|
|
47550
|
-
mappedChunks.push(base
|
|
45836
|
+
mappedChunks.push(joinUrlSegments(base, file));
|
|
47551
45837
|
});
|
|
47552
45838
|
}
|
|
47553
45839
|
chunk.viteMetadata.importedAssets.forEach((file) => {
|
|
47554
|
-
mappedChunks.push(base
|
|
45840
|
+
mappedChunks.push(joinUrlSegments(base, file));
|
|
47555
45841
|
});
|
|
47556
45842
|
}
|
|
47557
45843
|
if (chunk.code.includes(preloadMethod)) {
|
|
@@ -47582,7 +45868,7 @@ function ssrManifestPlugin(config) {
|
|
|
47582
45868
|
const chunk = bundle[filename];
|
|
47583
45869
|
if (chunk) {
|
|
47584
45870
|
chunk.viteMetadata.importedCss.forEach((file) => {
|
|
47585
|
-
deps.push(
|
|
45871
|
+
deps.push(joinUrlSegments(base, file)); // TODO:base
|
|
47586
45872
|
});
|
|
47587
45873
|
chunk.imports.forEach(addDeps);
|
|
47588
45874
|
}
|
|
@@ -47658,7 +45944,347 @@ function completeSystemWrapPlugin() {
|
|
|
47658
45944
|
};
|
|
47659
45945
|
}
|
|
47660
45946
|
|
|
47661
|
-
|
|
45947
|
+
const alias = {
|
|
45948
|
+
js: 'application/javascript',
|
|
45949
|
+
css: 'text/css',
|
|
45950
|
+
html: 'text/html',
|
|
45951
|
+
json: 'application/json'
|
|
45952
|
+
};
|
|
45953
|
+
function send$1(req, res, content, type, options) {
|
|
45954
|
+
const { etag = etag_1(content, { weak: true }), cacheControl = 'no-cache', headers, map } = options;
|
|
45955
|
+
if (res.writableEnded) {
|
|
45956
|
+
return;
|
|
45957
|
+
}
|
|
45958
|
+
if (req.headers['if-none-match'] === etag) {
|
|
45959
|
+
res.statusCode = 304;
|
|
45960
|
+
res.end();
|
|
45961
|
+
return;
|
|
45962
|
+
}
|
|
45963
|
+
res.setHeader('Content-Type', alias[type] || type);
|
|
45964
|
+
res.setHeader('Cache-Control', cacheControl);
|
|
45965
|
+
res.setHeader('Etag', etag);
|
|
45966
|
+
if (headers) {
|
|
45967
|
+
for (const name in headers) {
|
|
45968
|
+
res.setHeader(name, headers[name]);
|
|
45969
|
+
}
|
|
45970
|
+
}
|
|
45971
|
+
// inject source map reference
|
|
45972
|
+
if (map && map.mappings) {
|
|
45973
|
+
if (type === 'js' || type === 'css') {
|
|
45974
|
+
content = getCodeWithSourcemap(type, content.toString(), map);
|
|
45975
|
+
}
|
|
45976
|
+
}
|
|
45977
|
+
res.statusCode = 200;
|
|
45978
|
+
res.end(content);
|
|
45979
|
+
return;
|
|
45980
|
+
}
|
|
45981
|
+
|
|
45982
|
+
// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
|
|
45983
|
+
const ROOT_FILES = [
|
|
45984
|
+
// '.git',
|
|
45985
|
+
// https://pnpm.js.org/workspaces/
|
|
45986
|
+
'pnpm-workspace.yaml',
|
|
45987
|
+
// https://rushjs.io/pages/advanced/config_files/
|
|
45988
|
+
// 'rush.json',
|
|
45989
|
+
// https://nx.dev/latest/react/getting-started/nx-setup
|
|
45990
|
+
// 'workspace.json',
|
|
45991
|
+
// 'nx.json',
|
|
45992
|
+
// https://github.com/lerna/lerna#lernajson
|
|
45993
|
+
'lerna.json'
|
|
45994
|
+
];
|
|
45995
|
+
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
|
|
45996
|
+
// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
|
|
45997
|
+
function hasWorkspacePackageJSON(root) {
|
|
45998
|
+
const path = join$2(root, 'package.json');
|
|
45999
|
+
if (!isFileReadable(path)) {
|
|
46000
|
+
return false;
|
|
46001
|
+
}
|
|
46002
|
+
const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
|
|
46003
|
+
return !!content.workspaces;
|
|
46004
|
+
}
|
|
46005
|
+
function hasRootFile(root) {
|
|
46006
|
+
return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
|
|
46007
|
+
}
|
|
46008
|
+
function hasPackageJSON(root) {
|
|
46009
|
+
const path = join$2(root, 'package.json');
|
|
46010
|
+
return fs$l.existsSync(path);
|
|
46011
|
+
}
|
|
46012
|
+
/**
|
|
46013
|
+
* Search up for the nearest `package.json`
|
|
46014
|
+
*/
|
|
46015
|
+
function searchForPackageRoot(current, root = current) {
|
|
46016
|
+
if (hasPackageJSON(current))
|
|
46017
|
+
return current;
|
|
46018
|
+
const dir = dirname$2(current);
|
|
46019
|
+
// reach the fs root
|
|
46020
|
+
if (!dir || dir === current)
|
|
46021
|
+
return root;
|
|
46022
|
+
return searchForPackageRoot(dir, root);
|
|
46023
|
+
}
|
|
46024
|
+
/**
|
|
46025
|
+
* Search up for the nearest workspace root
|
|
46026
|
+
*/
|
|
46027
|
+
function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
46028
|
+
if (hasRootFile(current))
|
|
46029
|
+
return current;
|
|
46030
|
+
if (hasWorkspacePackageJSON(current))
|
|
46031
|
+
return current;
|
|
46032
|
+
const dir = dirname$2(current);
|
|
46033
|
+
// reach the fs root
|
|
46034
|
+
if (!dir || dir === current)
|
|
46035
|
+
return root;
|
|
46036
|
+
return searchForWorkspaceRoot(dir, root);
|
|
46037
|
+
}
|
|
46038
|
+
|
|
46039
|
+
var main$1 = {exports: {}};
|
|
46040
|
+
|
|
46041
|
+
const fs$9 = require$$0__default;
|
|
46042
|
+
const path$9 = require$$0$4;
|
|
46043
|
+
const os$2 = require$$2;
|
|
46044
|
+
|
|
46045
|
+
function log (message) {
|
|
46046
|
+
console.log(`[dotenv][DEBUG] ${message}`);
|
|
46047
|
+
}
|
|
46048
|
+
|
|
46049
|
+
const NEWLINE = '\n';
|
|
46050
|
+
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*("[^"]*"|'[^']*'|.*?)(\s+#.*)?$/;
|
|
46051
|
+
const RE_NEWLINES = /\\n/g;
|
|
46052
|
+
const NEWLINES_MATCH = /\r\n|\n|\r/;
|
|
46053
|
+
|
|
46054
|
+
// Parses src into an Object
|
|
46055
|
+
function parse$8 (src, options) {
|
|
46056
|
+
const debug = Boolean(options && options.debug);
|
|
46057
|
+
const multiline = Boolean(options && options.multiline);
|
|
46058
|
+
const obj = {};
|
|
46059
|
+
|
|
46060
|
+
// convert Buffers before splitting into lines and processing
|
|
46061
|
+
const lines = src.toString().split(NEWLINES_MATCH);
|
|
46062
|
+
|
|
46063
|
+
for (let idx = 0; idx < lines.length; idx++) {
|
|
46064
|
+
let line = lines[idx];
|
|
46065
|
+
|
|
46066
|
+
// matching "KEY' and 'VAL' in 'KEY=VAL'
|
|
46067
|
+
const keyValueArr = line.match(RE_INI_KEY_VAL);
|
|
46068
|
+
// matched?
|
|
46069
|
+
if (keyValueArr != null) {
|
|
46070
|
+
const key = keyValueArr[1];
|
|
46071
|
+
// default undefined or missing values to empty string
|
|
46072
|
+
let val = (keyValueArr[2] || '');
|
|
46073
|
+
let end = val.length - 1;
|
|
46074
|
+
const isDoubleQuoted = val[0] === '"' && val[end] === '"';
|
|
46075
|
+
const isSingleQuoted = val[0] === "'" && val[end] === "'";
|
|
46076
|
+
|
|
46077
|
+
const isMultilineDoubleQuoted = val[0] === '"' && val[end] !== '"';
|
|
46078
|
+
const isMultilineSingleQuoted = val[0] === "'" && val[end] !== "'";
|
|
46079
|
+
|
|
46080
|
+
// if parsing line breaks and the value starts with a quote
|
|
46081
|
+
if (multiline && (isMultilineDoubleQuoted || isMultilineSingleQuoted)) {
|
|
46082
|
+
const quoteChar = isMultilineDoubleQuoted ? '"' : "'";
|
|
46083
|
+
|
|
46084
|
+
val = val.substring(1);
|
|
46085
|
+
|
|
46086
|
+
while (idx++ < lines.length - 1) {
|
|
46087
|
+
line = lines[idx];
|
|
46088
|
+
end = line.length - 1;
|
|
46089
|
+
if (line[end] === quoteChar) {
|
|
46090
|
+
val += NEWLINE + line.substring(0, end);
|
|
46091
|
+
break
|
|
46092
|
+
}
|
|
46093
|
+
val += NEWLINE + line;
|
|
46094
|
+
}
|
|
46095
|
+
// if single or double quoted, remove quotes
|
|
46096
|
+
} else if (isSingleQuoted || isDoubleQuoted) {
|
|
46097
|
+
val = val.substring(1, end);
|
|
46098
|
+
|
|
46099
|
+
// if double quoted, expand newlines
|
|
46100
|
+
if (isDoubleQuoted) {
|
|
46101
|
+
val = val.replace(RE_NEWLINES, NEWLINE);
|
|
46102
|
+
}
|
|
46103
|
+
} else {
|
|
46104
|
+
// remove surrounding whitespace
|
|
46105
|
+
val = val.trim();
|
|
46106
|
+
}
|
|
46107
|
+
|
|
46108
|
+
obj[key] = val;
|
|
46109
|
+
} else if (debug) {
|
|
46110
|
+
const trimmedLine = line.trim();
|
|
46111
|
+
|
|
46112
|
+
// ignore empty and commented lines
|
|
46113
|
+
if (trimmedLine.length && trimmedLine[0] !== '#') {
|
|
46114
|
+
log(`Failed to match key and value when parsing line ${idx + 1}: ${line}`);
|
|
46115
|
+
}
|
|
46116
|
+
}
|
|
46117
|
+
}
|
|
46118
|
+
|
|
46119
|
+
return obj
|
|
46120
|
+
}
|
|
46121
|
+
|
|
46122
|
+
function resolveHome (envPath) {
|
|
46123
|
+
return envPath[0] === '~' ? path$9.join(os$2.homedir(), envPath.slice(1)) : envPath
|
|
46124
|
+
}
|
|
46125
|
+
|
|
46126
|
+
// Populates process.env from .env file
|
|
46127
|
+
function config (options) {
|
|
46128
|
+
let dotenvPath = path$9.resolve(process.cwd(), '.env');
|
|
46129
|
+
let encoding = 'utf8';
|
|
46130
|
+
const debug = Boolean(options && options.debug);
|
|
46131
|
+
const override = Boolean(options && options.override);
|
|
46132
|
+
const multiline = Boolean(options && options.multiline);
|
|
46133
|
+
|
|
46134
|
+
if (options) {
|
|
46135
|
+
if (options.path != null) {
|
|
46136
|
+
dotenvPath = resolveHome(options.path);
|
|
46137
|
+
}
|
|
46138
|
+
if (options.encoding != null) {
|
|
46139
|
+
encoding = options.encoding;
|
|
46140
|
+
}
|
|
46141
|
+
}
|
|
46142
|
+
|
|
46143
|
+
try {
|
|
46144
|
+
// specifying an encoding returns a string instead of a buffer
|
|
46145
|
+
const parsed = DotenvModule.parse(fs$9.readFileSync(dotenvPath, { encoding }), { debug, multiline });
|
|
46146
|
+
|
|
46147
|
+
Object.keys(parsed).forEach(function (key) {
|
|
46148
|
+
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
|
46149
|
+
process.env[key] = parsed[key];
|
|
46150
|
+
} else {
|
|
46151
|
+
if (override === true) {
|
|
46152
|
+
process.env[key] = parsed[key];
|
|
46153
|
+
}
|
|
46154
|
+
|
|
46155
|
+
if (debug) {
|
|
46156
|
+
if (override === true) {
|
|
46157
|
+
log(`"${key}" is already defined in \`process.env\` and WAS overwritten`);
|
|
46158
|
+
} else {
|
|
46159
|
+
log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`);
|
|
46160
|
+
}
|
|
46161
|
+
}
|
|
46162
|
+
}
|
|
46163
|
+
});
|
|
46164
|
+
|
|
46165
|
+
return { parsed }
|
|
46166
|
+
} catch (e) {
|
|
46167
|
+
if (debug) {
|
|
46168
|
+
log(`Failed to load ${dotenvPath} ${e.message}`);
|
|
46169
|
+
}
|
|
46170
|
+
|
|
46171
|
+
return { error: e }
|
|
46172
|
+
}
|
|
46173
|
+
}
|
|
46174
|
+
|
|
46175
|
+
const DotenvModule = {
|
|
46176
|
+
config,
|
|
46177
|
+
parse: parse$8
|
|
46178
|
+
};
|
|
46179
|
+
|
|
46180
|
+
main$1.exports.config = DotenvModule.config;
|
|
46181
|
+
main$1.exports.parse = DotenvModule.parse;
|
|
46182
|
+
main$1.exports = DotenvModule;
|
|
46183
|
+
|
|
46184
|
+
var dotenvExpand = function (config) {
|
|
46185
|
+
// if ignoring process.env, use a blank object
|
|
46186
|
+
var environment = config.ignoreProcessEnv ? {} : process.env;
|
|
46187
|
+
|
|
46188
|
+
var interpolate = function (envValue) {
|
|
46189
|
+
var matches = envValue.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g) || [];
|
|
46190
|
+
|
|
46191
|
+
return matches.reduce(function (newEnv, match) {
|
|
46192
|
+
var parts = /(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(match);
|
|
46193
|
+
var prefix = parts[1];
|
|
46194
|
+
|
|
46195
|
+
var value, replacePart;
|
|
46196
|
+
|
|
46197
|
+
if (prefix === '\\') {
|
|
46198
|
+
replacePart = parts[0];
|
|
46199
|
+
value = replacePart.replace('\\$', '$');
|
|
46200
|
+
} else {
|
|
46201
|
+
var key = parts[2];
|
|
46202
|
+
replacePart = parts[0].substring(prefix.length);
|
|
46203
|
+
// process.env value 'wins' over .env file's value
|
|
46204
|
+
value = environment.hasOwnProperty(key) ? environment[key] : (config.parsed[key] || '');
|
|
46205
|
+
|
|
46206
|
+
// Resolve recursive interpolations
|
|
46207
|
+
value = interpolate(value);
|
|
46208
|
+
}
|
|
46209
|
+
|
|
46210
|
+
return newEnv.replace(replacePart, value)
|
|
46211
|
+
}, envValue)
|
|
46212
|
+
};
|
|
46213
|
+
|
|
46214
|
+
for (var configKey in config.parsed) {
|
|
46215
|
+
var value = environment.hasOwnProperty(configKey) ? environment[configKey] : config.parsed[configKey];
|
|
46216
|
+
|
|
46217
|
+
config.parsed[configKey] = interpolate(value);
|
|
46218
|
+
}
|
|
46219
|
+
|
|
46220
|
+
for (var processKey in config.parsed) {
|
|
46221
|
+
environment[processKey] = config.parsed[processKey];
|
|
46222
|
+
}
|
|
46223
|
+
|
|
46224
|
+
return config
|
|
46225
|
+
};
|
|
46226
|
+
|
|
46227
|
+
var main = dotenvExpand;
|
|
46228
|
+
|
|
46229
|
+
function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
46230
|
+
if (mode === 'local') {
|
|
46231
|
+
throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
|
|
46232
|
+
`the .local postfix for .env files.`);
|
|
46233
|
+
}
|
|
46234
|
+
prefixes = arraify(prefixes);
|
|
46235
|
+
const env = {};
|
|
46236
|
+
const envFiles = [
|
|
46237
|
+
/** default file */ `.env`,
|
|
46238
|
+
/** local file */ `.env.local`,
|
|
46239
|
+
/** mode file */ `.env.${mode}`,
|
|
46240
|
+
/** mode local file */ `.env.${mode}.local`
|
|
46241
|
+
];
|
|
46242
|
+
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
46243
|
+
const path = lookupFile(envDir, [file], {
|
|
46244
|
+
pathOnly: true,
|
|
46245
|
+
rootDir: envDir
|
|
46246
|
+
});
|
|
46247
|
+
if (!path)
|
|
46248
|
+
return [];
|
|
46249
|
+
return Object.entries(main$1.exports.parse(fs$l.readFileSync(path), {
|
|
46250
|
+
debug: process.env.DEBUG?.includes('vite:dotenv')
|
|
46251
|
+
}));
|
|
46252
|
+
}));
|
|
46253
|
+
// let environment variables use each other
|
|
46254
|
+
main({
|
|
46255
|
+
parsed,
|
|
46256
|
+
// prevent process.env mutation
|
|
46257
|
+
ignoreProcessEnv: true
|
|
46258
|
+
});
|
|
46259
|
+
// only keys that start with prefix are exposed to client
|
|
46260
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
46261
|
+
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
46262
|
+
env[key] = value;
|
|
46263
|
+
}
|
|
46264
|
+
else if (key === 'NODE_ENV' &&
|
|
46265
|
+
process.env.VITE_USER_NODE_ENV === undefined) {
|
|
46266
|
+
// NODE_ENV override in .env file
|
|
46267
|
+
process.env.VITE_USER_NODE_ENV = value;
|
|
46268
|
+
}
|
|
46269
|
+
}
|
|
46270
|
+
// check if there are actual env variables starting with VITE_*
|
|
46271
|
+
// these are typically provided inline and should be prioritized
|
|
46272
|
+
for (const key in process.env) {
|
|
46273
|
+
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
46274
|
+
env[key] = process.env[key];
|
|
46275
|
+
}
|
|
46276
|
+
}
|
|
46277
|
+
return env;
|
|
46278
|
+
}
|
|
46279
|
+
function resolveEnvPrefix({ envPrefix = 'VITE_' }) {
|
|
46280
|
+
envPrefix = arraify(envPrefix);
|
|
46281
|
+
if (envPrefix.some((prefix) => prefix === '')) {
|
|
46282
|
+
throw new Error(`envPrefix option contains value '', which could lead unexpected exposure of sensitive information.`);
|
|
46283
|
+
}
|
|
46284
|
+
return envPrefix;
|
|
46285
|
+
}
|
|
46286
|
+
|
|
46287
|
+
function resolveBuildOptions(raw, logger) {
|
|
47662
46288
|
const deprecatedPolyfillModulePreload = raw?.polyfillModulePreload;
|
|
47663
46289
|
if (raw) {
|
|
47664
46290
|
const { polyfillModulePreload, ...rest } = raw;
|
|
@@ -47675,36 +46301,43 @@ function resolveBuildOptions(raw, isBuild, logger) {
|
|
|
47675
46301
|
const defaultModulePreload = {
|
|
47676
46302
|
polyfill: true
|
|
47677
46303
|
};
|
|
47678
|
-
const
|
|
47679
|
-
target: 'modules',
|
|
46304
|
+
const defaultBuildOptions = {
|
|
47680
46305
|
outDir: 'dist',
|
|
47681
46306
|
assetsDir: 'assets',
|
|
47682
46307
|
assetsInlineLimit: 4096,
|
|
47683
46308
|
cssCodeSplit: !raw?.lib,
|
|
47684
|
-
cssTarget: false,
|
|
47685
46309
|
sourcemap: false,
|
|
47686
46310
|
rollupOptions: {},
|
|
47687
46311
|
minify: raw?.ssr ? false : 'esbuild',
|
|
47688
46312
|
terserOptions: {},
|
|
47689
46313
|
write: true,
|
|
47690
46314
|
emptyOutDir: null,
|
|
46315
|
+
copyPublicDir: true,
|
|
47691
46316
|
manifest: false,
|
|
47692
46317
|
lib: false,
|
|
47693
46318
|
ssr: false,
|
|
47694
46319
|
ssrManifest: false,
|
|
47695
46320
|
reportCompressedSize: true,
|
|
47696
46321
|
chunkSizeWarningLimit: 500,
|
|
47697
|
-
watch: null
|
|
47698
|
-
|
|
46322
|
+
watch: null
|
|
46323
|
+
};
|
|
46324
|
+
const userBuildOptions = raw
|
|
46325
|
+
? mergeConfig(defaultBuildOptions, raw)
|
|
46326
|
+
: defaultBuildOptions;
|
|
46327
|
+
// @ts-expect-error Fallback options instead of merging
|
|
46328
|
+
const resolved = {
|
|
46329
|
+
target: 'modules',
|
|
46330
|
+
cssTarget: false,
|
|
46331
|
+
...userBuildOptions,
|
|
47699
46332
|
commonjsOptions: {
|
|
47700
46333
|
include: [/node_modules/],
|
|
47701
46334
|
extensions: ['.js', '.cjs'],
|
|
47702
|
-
...
|
|
46335
|
+
...userBuildOptions.commonjsOptions
|
|
47703
46336
|
},
|
|
47704
46337
|
dynamicImportVarsOptions: {
|
|
47705
46338
|
warnOnError: true,
|
|
47706
46339
|
exclude: [/node_modules/],
|
|
47707
|
-
...
|
|
46340
|
+
...userBuildOptions.dynamicImportVarsOptions
|
|
47708
46341
|
},
|
|
47709
46342
|
// Resolve to false | object
|
|
47710
46343
|
modulePreload: modulePreload === false
|
|
@@ -47990,7 +46623,9 @@ function prepareOutDir(outDirs, emptyOutDir, config) {
|
|
|
47990
46623
|
.filter(Boolean);
|
|
47991
46624
|
emptyDir(outDir, [...skipDirs, '.git']);
|
|
47992
46625
|
}
|
|
47993
|
-
if (config.
|
|
46626
|
+
if (config.build.copyPublicDir &&
|
|
46627
|
+
config.publicDir &&
|
|
46628
|
+
fs$l.existsSync(config.publicDir)) {
|
|
47994
46629
|
copyDir(config.publicDir, outDir);
|
|
47995
46630
|
}
|
|
47996
46631
|
}
|
|
@@ -48247,7 +46882,7 @@ function toOutputFilePathInJS(filename, type, hostId, hostType, config, toRelati
|
|
|
48247
46882
|
if (relative && !config.build.ssr) {
|
|
48248
46883
|
return toRelative(filename, hostId);
|
|
48249
46884
|
}
|
|
48250
|
-
return config.base
|
|
46885
|
+
return joinUrlSegments(config.base, filename);
|
|
48251
46886
|
}
|
|
48252
46887
|
function createToImportMetaURLBasedRelativeRuntime(format) {
|
|
48253
46888
|
const toRelativePath = relativeUrlMechanisms[format];
|
|
@@ -49590,7 +48225,7 @@ var parseurl$1 = {exports: {}};
|
|
|
49590
48225
|
*/
|
|
49591
48226
|
|
|
49592
48227
|
var url$3 = require$$0$9;
|
|
49593
|
-
var parse$
|
|
48228
|
+
var parse$7 = url$3.parse;
|
|
49594
48229
|
var Url = url$3.Url;
|
|
49595
48230
|
|
|
49596
48231
|
/**
|
|
@@ -49669,7 +48304,7 @@ function originalurl (req) {
|
|
|
49669
48304
|
|
|
49670
48305
|
function fastparse (str) {
|
|
49671
48306
|
if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) {
|
|
49672
|
-
return parse$
|
|
48307
|
+
return parse$7(str)
|
|
49673
48308
|
}
|
|
49674
48309
|
|
|
49675
48310
|
var pathname = str;
|
|
@@ -49696,7 +48331,7 @@ function fastparse (str) {
|
|
|
49696
48331
|
case 0x23: /* # */
|
|
49697
48332
|
case 0xa0:
|
|
49698
48333
|
case 0xfeff:
|
|
49699
|
-
return parse$
|
|
48334
|
+
return parse$7(str)
|
|
49700
48335
|
}
|
|
49701
48336
|
}
|
|
49702
48337
|
|
|
@@ -50109,7 +48744,7 @@ function finalhandler$1 (req, res, options) {
|
|
|
50109
48744
|
}
|
|
50110
48745
|
|
|
50111
48746
|
// send response
|
|
50112
|
-
send
|
|
48747
|
+
send(req, res, status, headers, msg);
|
|
50113
48748
|
}
|
|
50114
48749
|
}
|
|
50115
48750
|
|
|
@@ -50248,7 +48883,7 @@ function headersSent (res) {
|
|
|
50248
48883
|
* @private
|
|
50249
48884
|
*/
|
|
50250
48885
|
|
|
50251
|
-
function send
|
|
48886
|
+
function send (req, res, status, headers, message) {
|
|
50252
48887
|
function write () {
|
|
50253
48888
|
// response body
|
|
50254
48889
|
var body = createHtmlDocument(message);
|
|
@@ -50353,7 +48988,7 @@ var utilsMerge = {exports: {}};
|
|
|
50353
48988
|
var debug$4 = src.exports('connect:dispatcher');
|
|
50354
48989
|
var EventEmitter$3 = require$$0$5.EventEmitter;
|
|
50355
48990
|
var finalhandler = finalhandler_1;
|
|
50356
|
-
var http$4 = require$$1$
|
|
48991
|
+
var http$4 = require$$1$1;
|
|
50357
48992
|
var merge = utilsMerge.exports;
|
|
50358
48993
|
var parseUrl = parseurl$1.exports;
|
|
50359
48994
|
|
|
@@ -50754,7 +49389,7 @@ function append (header, field) {
|
|
|
50754
49389
|
|
|
50755
49390
|
// get fields array
|
|
50756
49391
|
var fields = !Array.isArray(field)
|
|
50757
|
-
? parse$
|
|
49392
|
+
? parse$6(String(field))
|
|
50758
49393
|
: field;
|
|
50759
49394
|
|
|
50760
49395
|
// assert on invalid field names
|
|
@@ -50771,7 +49406,7 @@ function append (header, field) {
|
|
|
50771
49406
|
|
|
50772
49407
|
// enumerate current values
|
|
50773
49408
|
var val = header;
|
|
50774
|
-
var vals = parse$
|
|
49409
|
+
var vals = parse$6(header.toLowerCase());
|
|
50775
49410
|
|
|
50776
49411
|
// unspecified vary
|
|
50777
49412
|
if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) {
|
|
@@ -50801,7 +49436,7 @@ function append (header, field) {
|
|
|
50801
49436
|
* @private
|
|
50802
49437
|
*/
|
|
50803
49438
|
|
|
50804
|
-
function parse$
|
|
49439
|
+
function parse$6 (header) {
|
|
50805
49440
|
var end = 0;
|
|
50806
49441
|
var list = [];
|
|
50807
49442
|
var start = 0;
|
|
@@ -51095,16 +49730,16 @@ function vary (res, field) {
|
|
|
51095
49730
|
|
|
51096
49731
|
var chokidar = {};
|
|
51097
49732
|
|
|
51098
|
-
const fs$
|
|
49733
|
+
const fs$8 = require$$0__default;
|
|
51099
49734
|
const { Readable } = require$$0$7;
|
|
51100
49735
|
const sysPath$3 = require$$0$4;
|
|
51101
49736
|
const { promisify: promisify$3 } = require$$0$6;
|
|
51102
49737
|
const picomatch$1 = picomatch$5.exports;
|
|
51103
49738
|
|
|
51104
|
-
const readdir$1 = promisify$3(fs$
|
|
51105
|
-
const stat$3 = promisify$3(fs$
|
|
51106
|
-
const lstat$2 = promisify$3(fs$
|
|
51107
|
-
const realpath$1 = promisify$3(fs$
|
|
49739
|
+
const readdir$1 = promisify$3(fs$8.readdir);
|
|
49740
|
+
const stat$3 = promisify$3(fs$8.stat);
|
|
49741
|
+
const lstat$2 = promisify$3(fs$8.lstat);
|
|
49742
|
+
const realpath$1 = promisify$3(fs$8.realpath);
|
|
51108
49743
|
|
|
51109
49744
|
/**
|
|
51110
49745
|
* @typedef {Object} EntryInfo
|
|
@@ -51200,7 +49835,7 @@ class ReaddirpStream extends Readable {
|
|
|
51200
49835
|
this._wantsFile = [FILE_TYPE, FILE_DIR_TYPE, EVERYTHING_TYPE].includes(type);
|
|
51201
49836
|
this._wantsEverything = type === EVERYTHING_TYPE;
|
|
51202
49837
|
this._root = sysPath$3.resolve(root);
|
|
51203
|
-
this._isDirent = ('Dirent' in fs$
|
|
49838
|
+
this._isDirent = ('Dirent' in fs$8) && !opts.alwaysStat;
|
|
51204
49839
|
this._statsProp = this._isDirent ? 'dirent' : 'stats';
|
|
51205
49840
|
this._rdOptions = { encoding: 'utf8', withFileTypes: this._isDirent };
|
|
51206
49841
|
|
|
@@ -51789,12 +50424,12 @@ var require$$0 = [
|
|
|
51789
50424
|
module.exports = require$$0;
|
|
51790
50425
|
} (binaryExtensions$1));
|
|
51791
50426
|
|
|
51792
|
-
const path$
|
|
50427
|
+
const path$8 = require$$0$4;
|
|
51793
50428
|
const binaryExtensions = binaryExtensions$1.exports;
|
|
51794
50429
|
|
|
51795
50430
|
const extensions = new Set(binaryExtensions);
|
|
51796
50431
|
|
|
51797
|
-
var isBinaryPath$1 = filePath => extensions.has(path$
|
|
50432
|
+
var isBinaryPath$1 = filePath => extensions.has(path$8.extname(filePath).slice(1).toLowerCase());
|
|
51798
50433
|
|
|
51799
50434
|
var constants$1 = {};
|
|
51800
50435
|
|
|
@@ -51802,7 +50437,7 @@ var constants$1 = {};
|
|
|
51802
50437
|
|
|
51803
50438
|
const {sep} = require$$0$4;
|
|
51804
50439
|
const {platform} = process;
|
|
51805
|
-
const os = require$$
|
|
50440
|
+
const os = require$$2;
|
|
51806
50441
|
|
|
51807
50442
|
exports.EV_ALL = 'all';
|
|
51808
50443
|
exports.EV_READY = 'ready';
|
|
@@ -51865,7 +50500,7 @@ var constants$1 = {};
|
|
|
51865
50500
|
exports.isIBMi = os.type() === 'OS400';
|
|
51866
50501
|
} (constants$1));
|
|
51867
50502
|
|
|
51868
|
-
const fs$
|
|
50503
|
+
const fs$7 = require$$0__default;
|
|
51869
50504
|
const sysPath$2 = require$$0$4;
|
|
51870
50505
|
const { promisify: promisify$2 } = require$$0$6;
|
|
51871
50506
|
const isBinaryPath = isBinaryPath$1;
|
|
@@ -51890,11 +50525,11 @@ const {
|
|
|
51890
50525
|
|
|
51891
50526
|
const THROTTLE_MODE_WATCH = 'watch';
|
|
51892
50527
|
|
|
51893
|
-
const open$1 = promisify$2(fs$
|
|
51894
|
-
const stat$2 = promisify$2(fs$
|
|
51895
|
-
const lstat$1 = promisify$2(fs$
|
|
51896
|
-
const close = promisify$2(fs$
|
|
51897
|
-
const fsrealpath = promisify$2(fs$
|
|
50528
|
+
const open$1 = promisify$2(fs$7.open);
|
|
50529
|
+
const stat$2 = promisify$2(fs$7.stat);
|
|
50530
|
+
const lstat$1 = promisify$2(fs$7.lstat);
|
|
50531
|
+
const close = promisify$2(fs$7.close);
|
|
50532
|
+
const fsrealpath = promisify$2(fs$7.realpath);
|
|
51898
50533
|
|
|
51899
50534
|
const statMethods$1 = { lstat: lstat$1, stat: stat$2 };
|
|
51900
50535
|
|
|
@@ -51981,7 +50616,7 @@ function createFsWatchInstance(path, options, listener, errHandler, emitRaw) {
|
|
|
51981
50616
|
}
|
|
51982
50617
|
};
|
|
51983
50618
|
try {
|
|
51984
|
-
return fs$
|
|
50619
|
+
return fs$7.watch(path, options, handleEvent);
|
|
51985
50620
|
} catch (error) {
|
|
51986
50621
|
errHandler(error);
|
|
51987
50622
|
}
|
|
@@ -52100,7 +50735,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers) => {
|
|
|
52100
50735
|
|
|
52101
50736
|
const copts = cont && cont.options;
|
|
52102
50737
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
52103
|
-
fs$
|
|
50738
|
+
fs$7.unwatchFile(fullPath);
|
|
52104
50739
|
cont = undefined;
|
|
52105
50740
|
}
|
|
52106
50741
|
|
|
@@ -52117,7 +50752,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers) => {
|
|
|
52117
50752
|
listeners: listener,
|
|
52118
50753
|
rawEmitters: rawEmitter,
|
|
52119
50754
|
options,
|
|
52120
|
-
watcher: fs$
|
|
50755
|
+
watcher: fs$7.watchFile(fullPath, options, (curr, prev) => {
|
|
52121
50756
|
foreach(cont.rawEmitters, (rawEmitter) => {
|
|
52122
50757
|
rawEmitter(EV_CHANGE$2, fullPath, {curr, prev});
|
|
52123
50758
|
});
|
|
@@ -52138,7 +50773,7 @@ const setFsWatchFileListener = (path, fullPath, options, handlers) => {
|
|
|
52138
50773
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
52139
50774
|
if (isEmptySet(cont.listeners)) {
|
|
52140
50775
|
FsWatchFileInstances.delete(fullPath);
|
|
52141
|
-
fs$
|
|
50776
|
+
fs$7.unwatchFile(fullPath);
|
|
52142
50777
|
cont.options = cont.watcher = undefined;
|
|
52143
50778
|
Object.freeze(cont);
|
|
52144
50779
|
}
|
|
@@ -52510,7 +51145,7 @@ var nodefsHandler = NodeFsHandler$1;
|
|
|
52510
51145
|
|
|
52511
51146
|
var fseventsHandler = {exports: {}};
|
|
52512
51147
|
|
|
52513
|
-
const fs$
|
|
51148
|
+
const fs$6 = require$$0__default;
|
|
52514
51149
|
const sysPath$1 = require$$0$4;
|
|
52515
51150
|
const { promisify: promisify$1 } = require$$0$6;
|
|
52516
51151
|
|
|
@@ -52561,9 +51196,9 @@ const {
|
|
|
52561
51196
|
|
|
52562
51197
|
const Depth = (value) => isNaN(value) ? {} : {depth: value};
|
|
52563
51198
|
|
|
52564
|
-
const stat$1 = promisify$1(fs$
|
|
52565
|
-
const lstat = promisify$1(fs$
|
|
52566
|
-
const realpath = promisify$1(fs$
|
|
51199
|
+
const stat$1 = promisify$1(fs$6.stat);
|
|
51200
|
+
const lstat = promisify$1(fs$6.lstat);
|
|
51201
|
+
const realpath = promisify$1(fs$6.realpath);
|
|
52567
51202
|
|
|
52568
51203
|
const statMethods = { stat: stat$1, lstat };
|
|
52569
51204
|
|
|
@@ -53034,7 +51669,7 @@ fseventsHandler.exports = FsEventsHandler$1;
|
|
|
53034
51669
|
fseventsHandler.exports.canUse = canUse;
|
|
53035
51670
|
|
|
53036
51671
|
const { EventEmitter: EventEmitter$2 } = require$$0$5;
|
|
53037
|
-
const fs$
|
|
51672
|
+
const fs$5 = require$$0__default;
|
|
53038
51673
|
const sysPath = require$$0$4;
|
|
53039
51674
|
const { promisify } = require$$0$6;
|
|
53040
51675
|
const readdirp = readdirp_1;
|
|
@@ -53085,8 +51720,8 @@ const {
|
|
|
53085
51720
|
isIBMi
|
|
53086
51721
|
} = constants$1;
|
|
53087
51722
|
|
|
53088
|
-
const stat = promisify(fs$
|
|
53089
|
-
const readdir = promisify(fs$
|
|
51723
|
+
const stat = promisify(fs$5.stat);
|
|
51724
|
+
const readdir = promisify(fs$5.readdir);
|
|
53090
51725
|
|
|
53091
51726
|
/**
|
|
53092
51727
|
* @typedef {String} Path
|
|
@@ -53742,7 +52377,7 @@ _awaitWriteFinish(path, threshold, event, awfEmit) {
|
|
|
53742
52377
|
const now = new Date();
|
|
53743
52378
|
|
|
53744
52379
|
const awaitWriteFinish = (prevStat) => {
|
|
53745
|
-
fs$
|
|
52380
|
+
fs$5.stat(fullPath, (err, curStat) => {
|
|
53746
52381
|
if (err || !this._pendingWrites.has(path)) {
|
|
53747
52382
|
if (err && err.code !== 'ENOENT') awfEmit(err);
|
|
53748
52383
|
return;
|
|
@@ -54040,7 +52675,7 @@ for (var i = 0; i < 4; i++) {
|
|
|
54040
52675
|
}
|
|
54041
52676
|
|
|
54042
52677
|
shellQuote$1.parse = function (s, env, opts) {
|
|
54043
|
-
var mapped = parse$
|
|
52678
|
+
var mapped = parse$5(s, env, opts);
|
|
54044
52679
|
if (typeof env !== 'function') return mapped;
|
|
54045
52680
|
return mapped.reduce(function (acc, s) {
|
|
54046
52681
|
if (typeof s === 'object') return acc.concat(s);
|
|
@@ -54055,7 +52690,7 @@ shellQuote$1.parse = function (s, env, opts) {
|
|
|
54055
52690
|
}, []);
|
|
54056
52691
|
};
|
|
54057
52692
|
|
|
54058
|
-
function parse$
|
|
52693
|
+
function parse$5 (s, env, opts) {
|
|
54059
52694
|
var chunker = new RegExp([
|
|
54060
52695
|
'(' + CONTROL + ')', // control chars
|
|
54061
52696
|
'(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')*'
|
|
@@ -54293,9 +52928,9 @@ var windows$1 = [
|
|
|
54293
52928
|
'rider64.exe'
|
|
54294
52929
|
];
|
|
54295
52930
|
|
|
54296
|
-
const path$
|
|
52931
|
+
const path$7 = require$$0$4;
|
|
54297
52932
|
const shellQuote = shellQuote$1;
|
|
54298
|
-
const childProcess$2 = require$$2;
|
|
52933
|
+
const childProcess$2 = require$$2$1;
|
|
54299
52934
|
|
|
54300
52935
|
// Map from full process name to binary that starts the process
|
|
54301
52936
|
// We can't just re-use full process name, because it will spawn a new instance
|
|
@@ -54362,7 +52997,7 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
54362
52997
|
const runningProcesses = output.split('\r\n');
|
|
54363
52998
|
for (let i = 0; i < runningProcesses.length; i++) {
|
|
54364
52999
|
const fullProcessPath = runningProcesses[i].trim();
|
|
54365
|
-
const shortProcessName = path$
|
|
53000
|
+
const shortProcessName = path$7.basename(fullProcessPath);
|
|
54366
53001
|
|
|
54367
53002
|
if (COMMON_EDITORS_WIN.indexOf(shortProcessName) !== -1) {
|
|
54368
53003
|
return [fullProcessPath]
|
|
@@ -54399,7 +53034,7 @@ var guess = function guessEditor (specifiedEditor) {
|
|
|
54399
53034
|
return [null]
|
|
54400
53035
|
};
|
|
54401
53036
|
|
|
54402
|
-
const path$
|
|
53037
|
+
const path$6 = require$$0$4;
|
|
54403
53038
|
|
|
54404
53039
|
// normalize file/line numbers into command line args for specific editors
|
|
54405
53040
|
var getArgs = function getArgumentsForPosition (
|
|
@@ -54408,7 +53043,7 @@ var getArgs = function getArgumentsForPosition (
|
|
|
54408
53043
|
lineNumber,
|
|
54409
53044
|
columnNumber = 1
|
|
54410
53045
|
) {
|
|
54411
|
-
const editorBasename = path$
|
|
53046
|
+
const editorBasename = path$6.basename(editor).replace(/\.(exe|cmd|bat)$/i, '');
|
|
54412
53047
|
switch (editorBasename) {
|
|
54413
53048
|
case 'atom':
|
|
54414
53049
|
case 'Atom':
|
|
@@ -54482,11 +53117,11 @@ var getArgs = function getArgumentsForPosition (
|
|
|
54482
53117
|
* Modified by Yuxi Evan You
|
|
54483
53118
|
*/
|
|
54484
53119
|
|
|
54485
|
-
const fs$
|
|
54486
|
-
const os$
|
|
54487
|
-
const path$
|
|
53120
|
+
const fs$4 = require$$0__default;
|
|
53121
|
+
const os$1 = require$$2;
|
|
53122
|
+
const path$5 = require$$0$4;
|
|
54488
53123
|
const colors = picocolors.exports;
|
|
54489
|
-
const childProcess$1 = require$$2;
|
|
53124
|
+
const childProcess$1 = require$$2$1;
|
|
54490
53125
|
|
|
54491
53126
|
const guessEditor = guess;
|
|
54492
53127
|
const getArgumentsForPosition = getArgs;
|
|
@@ -54495,7 +53130,7 @@ function wrapErrorCallback (cb) {
|
|
|
54495
53130
|
return (fileName, errorMessage) => {
|
|
54496
53131
|
console.log();
|
|
54497
53132
|
console.log(
|
|
54498
|
-
colors.red('Could not open ' + path$
|
|
53133
|
+
colors.red('Could not open ' + path$5.basename(fileName) + ' in the editor.')
|
|
54499
53134
|
);
|
|
54500
53135
|
if (errorMessage) {
|
|
54501
53136
|
if (errorMessage[errorMessage.length - 1] !== '.') {
|
|
@@ -54540,7 +53175,7 @@ function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
|
54540
53175
|
let { fileName } = parsed;
|
|
54541
53176
|
const { lineNumber, columnNumber } = parsed;
|
|
54542
53177
|
|
|
54543
|
-
if (!fs$
|
|
53178
|
+
if (!fs$4.existsSync(fileName)) {
|
|
54544
53179
|
return
|
|
54545
53180
|
}
|
|
54546
53181
|
|
|
@@ -54560,7 +53195,7 @@ function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
|
54560
53195
|
if (
|
|
54561
53196
|
process.platform === 'linux' &&
|
|
54562
53197
|
fileName.startsWith('/mnt/') &&
|
|
54563
|
-
/Microsoft/i.test(os$
|
|
53198
|
+
/Microsoft/i.test(os$1.release())
|
|
54564
53199
|
) {
|
|
54565
53200
|
// Assume WSL / "Bash on Ubuntu on Windows" is being used, and
|
|
54566
53201
|
// that the file exists on the Windows file system.
|
|
@@ -54568,7 +53203,7 @@ function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
|
54568
53203
|
// build of WSL, see: https://github.com/Microsoft/BashOnWindows/issues/423#issuecomment-221627364
|
|
54569
53204
|
// When a Windows editor is specified, interop functionality can
|
|
54570
53205
|
// handle the path translation, but only if a relative path is used.
|
|
54571
|
-
fileName = path$
|
|
53206
|
+
fileName = path$5.relative('', fileName);
|
|
54572
53207
|
}
|
|
54573
53208
|
|
|
54574
53209
|
if (lineNumber) {
|
|
@@ -54612,7 +53247,7 @@ function launchEditor (file, specifiedEditor, onErrorCallback) {
|
|
|
54612
53247
|
var launchEditor_1 = launchEditor;
|
|
54613
53248
|
|
|
54614
53249
|
const url$2 = require$$0$9;
|
|
54615
|
-
const path$
|
|
53250
|
+
const path$4 = require$$0$4;
|
|
54616
53251
|
const launch = launchEditor_1;
|
|
54617
53252
|
|
|
54618
53253
|
var launchEditorMiddleware = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
@@ -54634,7 +53269,7 @@ var launchEditorMiddleware = (specifiedEditor, srcRoot, onErrorCallback) => {
|
|
|
54634
53269
|
res.statusCode = 500;
|
|
54635
53270
|
res.end(`launch-editor-middleware: required query param "file" is missing.`);
|
|
54636
53271
|
} else {
|
|
54637
|
-
launch(path$
|
|
53272
|
+
launch(path$4.resolve(srcRoot, file), specifiedEditor, onErrorCallback);
|
|
54638
53273
|
res.end();
|
|
54639
53274
|
}
|
|
54640
53275
|
}
|
|
@@ -55525,7 +54160,7 @@ async function instantiateModule(url, server, context = { global }, urlStack = [
|
|
|
55525
54160
|
mod.ssrModule = ssrModule;
|
|
55526
54161
|
const ssrImportMeta = {
|
|
55527
54162
|
// The filesystem URL, matching native Node.js modules
|
|
55528
|
-
url: pathToFileURL(mod.file).toString()
|
|
54163
|
+
url: pathToFileURL$1(mod.file).toString()
|
|
55529
54164
|
};
|
|
55530
54165
|
urlStack = urlStack.concat(url);
|
|
55531
54166
|
const isCircular = (url) => urlStack.includes(url);
|
|
@@ -55670,7 +54305,7 @@ async function nodeImport(id, importer, resolveOptions) {
|
|
|
55670
54305
|
? { ...resolveOptions, tryEsmOnly: true }
|
|
55671
54306
|
: resolveOptions);
|
|
55672
54307
|
if (usingDynamicImport) {
|
|
55673
|
-
url = pathToFileURL(url).toString();
|
|
54308
|
+
url = pathToFileURL$1(url).toString();
|
|
55674
54309
|
}
|
|
55675
54310
|
}
|
|
55676
54311
|
try {
|
|
@@ -57918,7 +56553,7 @@ function push(dest, name, elem) {
|
|
|
57918
56553
|
* @return {Object} The parsed object
|
|
57919
56554
|
* @public
|
|
57920
56555
|
*/
|
|
57921
|
-
function parse$
|
|
56556
|
+
function parse$4(header) {
|
|
57922
56557
|
const offers = Object.create(null);
|
|
57923
56558
|
let params = Object.create(null);
|
|
57924
56559
|
let mustUnescape = false;
|
|
@@ -58094,13 +56729,13 @@ function format$1(extensions) {
|
|
|
58094
56729
|
.join(', ');
|
|
58095
56730
|
}
|
|
58096
56731
|
|
|
58097
|
-
var extension$1 = { format: format$1, parse: parse$
|
|
56732
|
+
var extension$1 = { format: format$1, parse: parse$4 };
|
|
58098
56733
|
|
|
58099
56734
|
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^Readable$" }] */
|
|
58100
56735
|
|
|
58101
56736
|
const EventEmitter$1 = require$$0$5;
|
|
58102
|
-
const https$2 = require$$1$
|
|
58103
|
-
const http$3 = require$$1$
|
|
56737
|
+
const https$2 = require$$1$2;
|
|
56738
|
+
const http$3 = require$$1$1;
|
|
58104
56739
|
const net = require$$3$1;
|
|
58105
56740
|
const tls = require$$4;
|
|
58106
56741
|
const { randomBytes, createHash: createHash$1 } = require$$5;
|
|
@@ -58122,7 +56757,7 @@ const {
|
|
|
58122
56757
|
const {
|
|
58123
56758
|
EventTarget: { addEventListener, removeEventListener }
|
|
58124
56759
|
} = eventTarget;
|
|
58125
|
-
const { format, parse: parse$
|
|
56760
|
+
const { format, parse: parse$3 } = extension$1;
|
|
58126
56761
|
const { toBuffer } = bufferUtil$1.exports;
|
|
58127
56762
|
|
|
58128
56763
|
const closeTimeout = 30 * 1000;
|
|
@@ -59045,7 +57680,7 @@ function initAsClient(websocket, address, protocols, options) {
|
|
|
59045
57680
|
let extensions;
|
|
59046
57681
|
|
|
59047
57682
|
try {
|
|
59048
|
-
extensions = parse$
|
|
57683
|
+
extensions = parse$3(secWebSocketExtensions);
|
|
59049
57684
|
} catch (err) {
|
|
59050
57685
|
const message = 'Invalid Sec-WebSocket-Extensions header';
|
|
59051
57686
|
abortHandshake$1(websocket, socket, message);
|
|
@@ -59408,7 +58043,7 @@ const { tokenChars } = validation.exports;
|
|
|
59408
58043
|
* @return {Set} The subprotocol names
|
|
59409
58044
|
* @public
|
|
59410
58045
|
*/
|
|
59411
|
-
function parse$
|
|
58046
|
+
function parse$2(header) {
|
|
59412
58047
|
const protocols = new Set();
|
|
59413
58048
|
let start = -1;
|
|
59414
58049
|
let end = -1;
|
|
@@ -59458,12 +58093,12 @@ function parse$3(header) {
|
|
|
59458
58093
|
return protocols;
|
|
59459
58094
|
}
|
|
59460
58095
|
|
|
59461
|
-
var subprotocol$1 = { parse: parse$
|
|
58096
|
+
var subprotocol$1 = { parse: parse$2 };
|
|
59462
58097
|
|
|
59463
58098
|
/* eslint no-unused-vars: ["error", { "varsIgnorePattern": "^net|tls|https$" }] */
|
|
59464
58099
|
|
|
59465
58100
|
const EventEmitter = require$$0$5;
|
|
59466
|
-
const http$2 = require$$1$
|
|
58101
|
+
const http$2 = require$$1$1;
|
|
59467
58102
|
const { createHash } = require$$5;
|
|
59468
58103
|
|
|
59469
58104
|
const extension = extension$1;
|
|
@@ -60189,7 +58824,7 @@ function createWebSocketServer(server, config, httpsOptions) {
|
|
|
60189
58824
|
|
|
60190
58825
|
// this middleware is only active when (config.base !== '/')
|
|
60191
58826
|
function baseMiddleware({ config }) {
|
|
60192
|
-
const devBase = config.base;
|
|
58827
|
+
const devBase = config.base.endsWith('/') ? config.base : config.base + '/';
|
|
60193
58828
|
// Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...`
|
|
60194
58829
|
return function viteBaseMiddleware(req, res, next) {
|
|
60195
58830
|
const url = req.url;
|
|
@@ -60208,18 +58843,18 @@ function baseMiddleware({ config }) {
|
|
|
60208
58843
|
if (path === '/' || path === '/index.html') {
|
|
60209
58844
|
// redirect root visit to based url with search and hash
|
|
60210
58845
|
res.writeHead(302, {
|
|
60211
|
-
Location:
|
|
58846
|
+
Location: config.base + (parsed.search || '') + (parsed.hash || '')
|
|
60212
58847
|
});
|
|
60213
58848
|
res.end();
|
|
60214
58849
|
return;
|
|
60215
58850
|
}
|
|
60216
58851
|
else if (req.headers.accept?.includes('text/html')) {
|
|
60217
58852
|
// non-based page visit
|
|
60218
|
-
const redirectPath =
|
|
58853
|
+
const redirectPath = joinUrlSegments(config.base, url);
|
|
60219
58854
|
res.writeHead(404, {
|
|
60220
58855
|
'Content-Type': 'text/html'
|
|
60221
58856
|
});
|
|
60222
|
-
res.end(`The server is configured with a public base URL of ${
|
|
58857
|
+
res.end(`The server is configured with a public base URL of ${config.base} - ` +
|
|
60223
58858
|
`did you mean to visit <a href="${redirectPath}">${redirectPath}</a> instead?`);
|
|
60224
58859
|
return;
|
|
60225
58860
|
}
|
|
@@ -61016,7 +59651,7 @@ var debug_1 = function () {
|
|
|
61016
59651
|
if (!debug$3) {
|
|
61017
59652
|
try {
|
|
61018
59653
|
/* eslint global-require: off */
|
|
61019
|
-
debug$3 =
|
|
59654
|
+
debug$3 = src$2.exports("follow-redirects");
|
|
61020
59655
|
}
|
|
61021
59656
|
catch (error) { /* */ }
|
|
61022
59657
|
if (typeof debug$3 !== "function") {
|
|
@@ -61028,10 +59663,10 @@ var debug_1 = function () {
|
|
|
61028
59663
|
|
|
61029
59664
|
var url = require$$0$9;
|
|
61030
59665
|
var URL$1 = url.URL;
|
|
61031
|
-
var http$1 = require$$1$
|
|
61032
|
-
var https$1 = require$$1$
|
|
59666
|
+
var http$1 = require$$1$1;
|
|
59667
|
+
var https$1 = require$$1$2;
|
|
61033
59668
|
var Writable = require$$0$7.Writable;
|
|
61034
|
-
var assert = assert$
|
|
59669
|
+
var assert = assert$1;
|
|
61035
59670
|
var debug$2 = debug_1;
|
|
61036
59671
|
|
|
61037
59672
|
// Create handlers that pass events from native requests
|
|
@@ -61620,8 +60255,8 @@ function isSubdomain(subdomain, domain) {
|
|
|
61620
60255
|
followRedirects$1.exports = wrap({ http: http$1, https: https$1 });
|
|
61621
60256
|
followRedirects$1.exports.wrap = wrap;
|
|
61622
60257
|
|
|
61623
|
-
var httpNative = require$$1$
|
|
61624
|
-
httpsNative = require$$1$
|
|
60258
|
+
var httpNative = require$$1$1,
|
|
60259
|
+
httpsNative = require$$1$2,
|
|
61625
60260
|
web_o = webOutgoing,
|
|
61626
60261
|
common$1 = common$3,
|
|
61627
60262
|
followRedirects = followRedirects$1.exports;
|
|
@@ -61815,8 +60450,8 @@ var webIncoming = {
|
|
|
61815
60450
|
|
|
61816
60451
|
};
|
|
61817
60452
|
|
|
61818
|
-
var http = require$$1$
|
|
61819
|
-
https = require$$1$
|
|
60453
|
+
var http = require$$1$1,
|
|
60454
|
+
https = require$$1$2,
|
|
61820
60455
|
common = common$3;
|
|
61821
60456
|
|
|
61822
60457
|
/*!
|
|
@@ -61983,8 +60618,8 @@ var wsIncoming = {
|
|
|
61983
60618
|
extend = require$$0$6._extend,
|
|
61984
60619
|
parse_url = require$$0$9.parse,
|
|
61985
60620
|
EE3 = eventemitter3.exports,
|
|
61986
|
-
http = require$$1$
|
|
61987
|
-
https = require$$1$
|
|
60621
|
+
http = require$$1$1,
|
|
60622
|
+
https = require$$1$2,
|
|
61988
60623
|
web = webIncoming,
|
|
61989
60624
|
ws = wsIncoming;
|
|
61990
60625
|
|
|
@@ -62507,41 +61142,6 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
62507
61142
|
};
|
|
62508
61143
|
}
|
|
62509
61144
|
|
|
62510
|
-
const alias = {
|
|
62511
|
-
js: 'application/javascript',
|
|
62512
|
-
css: 'text/css',
|
|
62513
|
-
html: 'text/html',
|
|
62514
|
-
json: 'application/json'
|
|
62515
|
-
};
|
|
62516
|
-
function send(req, res, content, type, options) {
|
|
62517
|
-
const { etag = etag_1(content, { weak: true }), cacheControl = 'no-cache', headers, map } = options;
|
|
62518
|
-
if (res.writableEnded) {
|
|
62519
|
-
return;
|
|
62520
|
-
}
|
|
62521
|
-
if (req.headers['if-none-match'] === etag) {
|
|
62522
|
-
res.statusCode = 304;
|
|
62523
|
-
res.end();
|
|
62524
|
-
return;
|
|
62525
|
-
}
|
|
62526
|
-
res.setHeader('Content-Type', alias[type] || type);
|
|
62527
|
-
res.setHeader('Cache-Control', cacheControl);
|
|
62528
|
-
res.setHeader('Etag', etag);
|
|
62529
|
-
if (headers) {
|
|
62530
|
-
for (const name in headers) {
|
|
62531
|
-
res.setHeader(name, headers[name]);
|
|
62532
|
-
}
|
|
62533
|
-
}
|
|
62534
|
-
// inject source map reference
|
|
62535
|
-
if (map && map.mappings) {
|
|
62536
|
-
if (type === 'js' || type === 'css') {
|
|
62537
|
-
content = getCodeWithSourcemap(type, content.toString(), map);
|
|
62538
|
-
}
|
|
62539
|
-
}
|
|
62540
|
-
res.statusCode = 200;
|
|
62541
|
-
res.end(content);
|
|
62542
|
-
return;
|
|
62543
|
-
}
|
|
62544
|
-
|
|
62545
61145
|
const debugCache = createDebugger('vite:cache');
|
|
62546
61146
|
const isDebug = !!process.env.DEBUG;
|
|
62547
61147
|
const knownIgnoreList = new Set(['/', '/favicon.ico']);
|
|
@@ -62573,7 +61173,7 @@ function transformMiddleware(server) {
|
|
|
62573
61173
|
: normalizePath$3(ensureVolumeInPath(path$n.resolve(root, url.slice(1))));
|
|
62574
61174
|
try {
|
|
62575
61175
|
const map = await promises$2.readFile(mapFile, 'utf-8');
|
|
62576
|
-
return send(req, res, map, 'json', {
|
|
61176
|
+
return send$1(req, res, map, 'json', {
|
|
62577
61177
|
headers: server.config.server.headers
|
|
62578
61178
|
});
|
|
62579
61179
|
}
|
|
@@ -62589,7 +61189,7 @@ function transformMiddleware(server) {
|
|
|
62589
61189
|
names: [],
|
|
62590
61190
|
mappings: ';;;;;;;;;'
|
|
62591
61191
|
};
|
|
62592
|
-
return send(req, res, JSON.stringify(dummySourceMap), 'json', {
|
|
61192
|
+
return send$1(req, res, JSON.stringify(dummySourceMap), 'json', {
|
|
62593
61193
|
cacheControl: 'no-cache',
|
|
62594
61194
|
headers: server.config.server.headers
|
|
62595
61195
|
});
|
|
@@ -62600,7 +61200,7 @@ function transformMiddleware(server) {
|
|
|
62600
61200
|
const map = (await moduleGraph.getModuleByUrl(originalUrl, false))
|
|
62601
61201
|
?.transformResult?.map;
|
|
62602
61202
|
if (map) {
|
|
62603
|
-
return send(req, res, JSON.stringify(map), 'json', {
|
|
61203
|
+
return send$1(req, res, JSON.stringify(map), 'json', {
|
|
62604
61204
|
headers: server.config.server.headers
|
|
62605
61205
|
});
|
|
62606
61206
|
}
|
|
@@ -62664,7 +61264,7 @@ function transformMiddleware(server) {
|
|
|
62664
61264
|
const depsOptimizer = getDepsOptimizer(server.config, false); // non-ssr
|
|
62665
61265
|
const type = isDirectCSSRequest(url) ? 'css' : 'js';
|
|
62666
61266
|
const isDep = DEP_VERSION_RE.test(url) || depsOptimizer?.isOptimizedDepUrl(url);
|
|
62667
|
-
return send(req, res, result.code, type, {
|
|
61267
|
+
return send$1(req, res, result.code, type, {
|
|
62668
61268
|
etag: result.etag,
|
|
62669
61269
|
// allow browser to cache npm deps!
|
|
62670
61270
|
cacheControl: isDep ? 'max-age=31536000,immutable' : 'no-cache',
|
|
@@ -62742,7 +61342,8 @@ const processNodeUrl = (attr, sourceCodeLocation, s, config, htmlPath, originalU
|
|
|
62742
61342
|
const devBase = config.base;
|
|
62743
61343
|
if (startsWithSingleSlashRE.test(url)) {
|
|
62744
61344
|
// prefix with base (dev only, base is never relative)
|
|
62745
|
-
|
|
61345
|
+
const fullUrl = joinUrlSegments(devBase, url);
|
|
61346
|
+
overwriteAttrValue(s, sourceCodeLocation, fullUrl);
|
|
62746
61347
|
}
|
|
62747
61348
|
else if (url.startsWith('.') &&
|
|
62748
61349
|
originalUrl &&
|
|
@@ -62767,7 +61368,7 @@ const devHtmlHook = async (html, { path: htmlPath, filename, server, originalUrl
|
|
|
62767
61368
|
const trailingSlash = htmlPath.endsWith('/');
|
|
62768
61369
|
if (!trailingSlash && fs$l.existsSync(filename)) {
|
|
62769
61370
|
proxyModulePath = htmlPath;
|
|
62770
|
-
proxyModuleUrl = base
|
|
61371
|
+
proxyModuleUrl = joinUrlSegments(base, htmlPath);
|
|
62771
61372
|
}
|
|
62772
61373
|
else {
|
|
62773
61374
|
// There are users of vite.transformIndexHtml calling it with url '/'
|
|
@@ -62876,7 +61477,7 @@ function indexHtmlMiddleware(server) {
|
|
|
62876
61477
|
try {
|
|
62877
61478
|
let html = fs$l.readFileSync(filename, 'utf-8');
|
|
62878
61479
|
html = await server.transformIndexHtml(url, html, req.originalUrl);
|
|
62879
|
-
return send(req, res, html, 'html', {
|
|
61480
|
+
return send$1(req, res, html, 'html', {
|
|
62880
61481
|
headers: server.config.server.headers
|
|
62881
61482
|
});
|
|
62882
61483
|
}
|
|
@@ -63096,13 +61697,13 @@ class ModuleGraph {
|
|
|
63096
61697
|
|
|
63097
61698
|
var isWsl$2 = {exports: {}};
|
|
63098
61699
|
|
|
63099
|
-
const fs$
|
|
61700
|
+
const fs$3 = require$$0__default;
|
|
63100
61701
|
|
|
63101
61702
|
let isDocker$2;
|
|
63102
61703
|
|
|
63103
61704
|
function hasDockerEnv() {
|
|
63104
61705
|
try {
|
|
63105
|
-
fs$
|
|
61706
|
+
fs$3.statSync('/.dockerenv');
|
|
63106
61707
|
return true;
|
|
63107
61708
|
} catch (_) {
|
|
63108
61709
|
return false;
|
|
@@ -63111,7 +61712,7 @@ function hasDockerEnv() {
|
|
|
63111
61712
|
|
|
63112
61713
|
function hasDockerCGroup() {
|
|
63113
61714
|
try {
|
|
63114
|
-
return fs$
|
|
61715
|
+
return fs$3.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
63115
61716
|
} catch (_) {
|
|
63116
61717
|
return false;
|
|
63117
61718
|
}
|
|
@@ -63125,8 +61726,8 @@ var isDocker_1 = () => {
|
|
|
63125
61726
|
return isDocker$2;
|
|
63126
61727
|
};
|
|
63127
61728
|
|
|
63128
|
-
const os
|
|
63129
|
-
const fs$
|
|
61729
|
+
const os = require$$2;
|
|
61730
|
+
const fs$2 = require$$0__default;
|
|
63130
61731
|
const isDocker$1 = isDocker_1;
|
|
63131
61732
|
|
|
63132
61733
|
const isWsl$1 = () => {
|
|
@@ -63134,7 +61735,7 @@ const isWsl$1 = () => {
|
|
|
63134
61735
|
return false;
|
|
63135
61736
|
}
|
|
63136
61737
|
|
|
63137
|
-
if (os
|
|
61738
|
+
if (os.release().toLowerCase().includes('microsoft')) {
|
|
63138
61739
|
if (isDocker$1()) {
|
|
63139
61740
|
return false;
|
|
63140
61741
|
}
|
|
@@ -63143,7 +61744,7 @@ const isWsl$1 = () => {
|
|
|
63143
61744
|
}
|
|
63144
61745
|
|
|
63145
61746
|
try {
|
|
63146
|
-
return fs$
|
|
61747
|
+
return fs$2.readFileSync('/proc/version', 'utf8').toLowerCase().includes('microsoft') ?
|
|
63147
61748
|
!isDocker$1() : false;
|
|
63148
61749
|
} catch (_) {
|
|
63149
61750
|
return false;
|
|
@@ -63175,15 +61776,15 @@ var defineLazyProp = (object, propertyName, fn) => {
|
|
|
63175
61776
|
return object;
|
|
63176
61777
|
};
|
|
63177
61778
|
|
|
63178
|
-
const path$
|
|
63179
|
-
const childProcess = require$$2;
|
|
63180
|
-
const {promises: fs$
|
|
61779
|
+
const path$3 = require$$0$4;
|
|
61780
|
+
const childProcess = require$$2$1;
|
|
61781
|
+
const {promises: fs$1, constants: fsConstants} = require$$0__default;
|
|
63181
61782
|
const isWsl = isWsl$2.exports;
|
|
63182
61783
|
const isDocker = isDocker_1;
|
|
63183
61784
|
const defineLazyProperty = defineLazyProp;
|
|
63184
61785
|
|
|
63185
61786
|
// Path to included `xdg-open`.
|
|
63186
|
-
const localXdgOpenPath = path$
|
|
61787
|
+
const localXdgOpenPath = path$3.join(__dirname, 'xdg-open');
|
|
63187
61788
|
|
|
63188
61789
|
const {platform, arch} = process;
|
|
63189
61790
|
|
|
@@ -63210,7 +61811,7 @@ const getWslDrivesMountPoint = (() => {
|
|
|
63210
61811
|
|
|
63211
61812
|
let isConfigFileExists = false;
|
|
63212
61813
|
try {
|
|
63213
|
-
await fs$
|
|
61814
|
+
await fs$1.access(configFilePath, fsConstants.F_OK);
|
|
63214
61815
|
isConfigFileExists = true;
|
|
63215
61816
|
} catch {}
|
|
63216
61817
|
|
|
@@ -63218,7 +61819,7 @@ const getWslDrivesMountPoint = (() => {
|
|
|
63218
61819
|
return defaultMountPoint;
|
|
63219
61820
|
}
|
|
63220
61821
|
|
|
63221
|
-
const configContent = await fs$
|
|
61822
|
+
const configContent = await fs$1.readFile(configFilePath, {encoding: 'utf8'});
|
|
63222
61823
|
const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
63223
61824
|
|
|
63224
61825
|
if (!configMountPoint) {
|
|
@@ -63350,7 +61951,7 @@ const baseOpen = async options => {
|
|
|
63350
61951
|
// Check if local `xdg-open` exists and is executable.
|
|
63351
61952
|
let exeLocalXdgOpen = false;
|
|
63352
61953
|
try {
|
|
63353
|
-
await fs$
|
|
61954
|
+
await fs$1.access(localXdgOpenPath, fsConstants.X_OK);
|
|
63354
61955
|
exeLocalXdgOpen = true;
|
|
63355
61956
|
} catch {}
|
|
63356
61957
|
|
|
@@ -63655,7 +62256,7 @@ const isWindows = process.platform === 'win32' ||
|
|
|
63655
62256
|
process.env.OSTYPE === 'cygwin' ||
|
|
63656
62257
|
process.env.OSTYPE === 'msys';
|
|
63657
62258
|
|
|
63658
|
-
const path$
|
|
62259
|
+
const path$2 = require$$0$4;
|
|
63659
62260
|
const COLON = isWindows ? ';' : ':';
|
|
63660
62261
|
const isexe = isexe_1;
|
|
63661
62262
|
|
|
@@ -63712,7 +62313,7 @@ const which$1 = (cmd, opt, cb) => {
|
|
|
63712
62313
|
const ppRaw = pathEnv[i];
|
|
63713
62314
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
63714
62315
|
|
|
63715
|
-
const pCmd = path$
|
|
62316
|
+
const pCmd = path$2.join(pathPart, cmd);
|
|
63716
62317
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
|
|
63717
62318
|
: pCmd;
|
|
63718
62319
|
|
|
@@ -63747,7 +62348,7 @@ const whichSync = (cmd, opt) => {
|
|
|
63747
62348
|
const ppRaw = pathEnv[i];
|
|
63748
62349
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
63749
62350
|
|
|
63750
|
-
const pCmd = path$
|
|
62351
|
+
const pCmd = path$2.join(pathPart, cmd);
|
|
63751
62352
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd
|
|
63752
62353
|
: pCmd;
|
|
63753
62354
|
|
|
@@ -63794,7 +62395,7 @@ pathKey$1.exports = pathKey;
|
|
|
63794
62395
|
// TODO: Remove this for the next major release
|
|
63795
62396
|
pathKey$1.exports.default = pathKey;
|
|
63796
62397
|
|
|
63797
|
-
const path$
|
|
62398
|
+
const path$1 = require$$0$4;
|
|
63798
62399
|
const which = which_1;
|
|
63799
62400
|
const getPathKey = pathKey$1.exports;
|
|
63800
62401
|
|
|
@@ -63820,7 +62421,7 @@ function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
|
63820
62421
|
try {
|
|
63821
62422
|
resolved = which.sync(parsed.command, {
|
|
63822
62423
|
path: env[getPathKey({ env })],
|
|
63823
|
-
pathExt: withoutPathExt ? path$
|
|
62424
|
+
pathExt: withoutPathExt ? path$1.delimiter : undefined,
|
|
63824
62425
|
});
|
|
63825
62426
|
} catch (e) {
|
|
63826
62427
|
/* Empty */
|
|
@@ -63833,7 +62434,7 @@ function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
|
63833
62434
|
// If we successfully resolved, ensure that an absolute path is returned
|
|
63834
62435
|
// Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it
|
|
63835
62436
|
if (resolved) {
|
|
63836
|
-
resolved = path$
|
|
62437
|
+
resolved = path$1.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved);
|
|
63837
62438
|
}
|
|
63838
62439
|
|
|
63839
62440
|
return resolved;
|
|
@@ -63912,7 +62513,7 @@ var shebangCommand$1 = (string = '') => {
|
|
|
63912
62513
|
return argument ? `${binary} ${argument}` : binary;
|
|
63913
62514
|
};
|
|
63914
62515
|
|
|
63915
|
-
const fs
|
|
62516
|
+
const fs = require$$0__default;
|
|
63916
62517
|
const shebangCommand = shebangCommand$1;
|
|
63917
62518
|
|
|
63918
62519
|
function readShebang$1(command) {
|
|
@@ -63923,9 +62524,9 @@ function readShebang$1(command) {
|
|
|
63923
62524
|
let fd;
|
|
63924
62525
|
|
|
63925
62526
|
try {
|
|
63926
|
-
fd = fs
|
|
63927
|
-
fs
|
|
63928
|
-
fs
|
|
62527
|
+
fd = fs.openSync(command, 'r');
|
|
62528
|
+
fs.readSync(fd, buffer, 0, size, 0);
|
|
62529
|
+
fs.closeSync(fd);
|
|
63929
62530
|
} catch (e) { /* Empty */ }
|
|
63930
62531
|
|
|
63931
62532
|
// Attempt to extract shebang (null is returned if not a shebang)
|
|
@@ -63934,7 +62535,7 @@ function readShebang$1(command) {
|
|
|
63934
62535
|
|
|
63935
62536
|
var readShebang_1 = readShebang$1;
|
|
63936
62537
|
|
|
63937
|
-
const path
|
|
62538
|
+
const path = require$$0$4;
|
|
63938
62539
|
const resolveCommand = resolveCommand_1;
|
|
63939
62540
|
const escape$1 = _escape;
|
|
63940
62541
|
const readShebang = readShebang_1;
|
|
@@ -63980,7 +62581,7 @@ function parseNonShell(parsed) {
|
|
|
63980
62581
|
|
|
63981
62582
|
// Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar)
|
|
63982
62583
|
// This is necessary otherwise it will always fail with ENOENT in those cases
|
|
63983
|
-
parsed.command = path
|
|
62584
|
+
parsed.command = path.normalize(parsed.command);
|
|
63984
62585
|
|
|
63985
62586
|
// Escape command & arguments
|
|
63986
62587
|
parsed.command = escape$1.command(parsed.command);
|
|
@@ -63996,7 +62597,7 @@ function parseNonShell(parsed) {
|
|
|
63996
62597
|
return parsed;
|
|
63997
62598
|
}
|
|
63998
62599
|
|
|
63999
|
-
function parse$
|
|
62600
|
+
function parse$1(command, args, options) {
|
|
64000
62601
|
// Normalize arguments, similar to nodejs
|
|
64001
62602
|
if (args && !Array.isArray(args)) {
|
|
64002
62603
|
options = args;
|
|
@@ -64022,7 +62623,7 @@ function parse$2(command, args, options) {
|
|
|
64022
62623
|
return options.shell ? parsed : parseNonShell(parsed);
|
|
64023
62624
|
}
|
|
64024
62625
|
|
|
64025
|
-
var parse_1 = parse$
|
|
62626
|
+
var parse_1 = parse$1;
|
|
64026
62627
|
|
|
64027
62628
|
const isWin = process.platform === 'win32';
|
|
64028
62629
|
|
|
@@ -64082,13 +62683,13 @@ var enoent$1 = {
|
|
|
64082
62683
|
notFoundError,
|
|
64083
62684
|
};
|
|
64084
62685
|
|
|
64085
|
-
const cp = require$$2;
|
|
64086
|
-
const parse
|
|
62686
|
+
const cp = require$$2$1;
|
|
62687
|
+
const parse = parse_1;
|
|
64087
62688
|
const enoent = enoent$1;
|
|
64088
62689
|
|
|
64089
62690
|
function spawn(command, args, options) {
|
|
64090
62691
|
// Parse the arguments
|
|
64091
|
-
const parsed = parse
|
|
62692
|
+
const parsed = parse(command, args, options);
|
|
64092
62693
|
|
|
64093
62694
|
// Spawn the child process
|
|
64094
62695
|
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
|
|
@@ -64102,7 +62703,7 @@ function spawn(command, args, options) {
|
|
|
64102
62703
|
|
|
64103
62704
|
function spawnSync(command, args, options) {
|
|
64104
62705
|
// Parse the arguments
|
|
64105
|
-
const parsed = parse
|
|
62706
|
+
const parsed = parse(command, args, options);
|
|
64106
62707
|
|
|
64107
62708
|
// Spawn the child process
|
|
64108
62709
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
@@ -64117,7 +62718,7 @@ crossSpawn.exports = spawn;
|
|
|
64117
62718
|
crossSpawn.exports.spawn = spawn;
|
|
64118
62719
|
crossSpawn.exports.sync = spawnSync;
|
|
64119
62720
|
|
|
64120
|
-
crossSpawn.exports._parse = parse
|
|
62721
|
+
crossSpawn.exports._parse = parse;
|
|
64121
62722
|
crossSpawn.exports._enoent = enoent;
|
|
64122
62723
|
|
|
64123
62724
|
/**
|
|
@@ -64212,63 +62813,6 @@ function startBrowserProcess(browser, url) {
|
|
|
64212
62813
|
}
|
|
64213
62814
|
}
|
|
64214
62815
|
|
|
64215
|
-
// https://github.com/vitejs/vite/issues/2820#issuecomment-812495079
|
|
64216
|
-
const ROOT_FILES = [
|
|
64217
|
-
// '.git',
|
|
64218
|
-
// https://pnpm.js.org/workspaces/
|
|
64219
|
-
'pnpm-workspace.yaml',
|
|
64220
|
-
// https://rushjs.io/pages/advanced/config_files/
|
|
64221
|
-
// 'rush.json',
|
|
64222
|
-
// https://nx.dev/latest/react/getting-started/nx-setup
|
|
64223
|
-
// 'workspace.json',
|
|
64224
|
-
// 'nx.json',
|
|
64225
|
-
// https://github.com/lerna/lerna#lernajson
|
|
64226
|
-
'lerna.json'
|
|
64227
|
-
];
|
|
64228
|
-
// npm: https://docs.npmjs.com/cli/v7/using-npm/workspaces#installing-workspaces
|
|
64229
|
-
// yarn: https://classic.yarnpkg.com/en/docs/workspaces/#toc-how-to-use-it
|
|
64230
|
-
function hasWorkspacePackageJSON(root) {
|
|
64231
|
-
const path = join$2(root, 'package.json');
|
|
64232
|
-
if (!isFileReadable(path)) {
|
|
64233
|
-
return false;
|
|
64234
|
-
}
|
|
64235
|
-
const content = JSON.parse(fs$l.readFileSync(path, 'utf-8')) || {};
|
|
64236
|
-
return !!content.workspaces;
|
|
64237
|
-
}
|
|
64238
|
-
function hasRootFile(root) {
|
|
64239
|
-
return ROOT_FILES.some((file) => fs$l.existsSync(join$2(root, file)));
|
|
64240
|
-
}
|
|
64241
|
-
function hasPackageJSON(root) {
|
|
64242
|
-
const path = join$2(root, 'package.json');
|
|
64243
|
-
return fs$l.existsSync(path);
|
|
64244
|
-
}
|
|
64245
|
-
/**
|
|
64246
|
-
* Search up for the nearest `package.json`
|
|
64247
|
-
*/
|
|
64248
|
-
function searchForPackageRoot(current, root = current) {
|
|
64249
|
-
if (hasPackageJSON(current))
|
|
64250
|
-
return current;
|
|
64251
|
-
const dir = dirname$2(current);
|
|
64252
|
-
// reach the fs root
|
|
64253
|
-
if (!dir || dir === current)
|
|
64254
|
-
return root;
|
|
64255
|
-
return searchForPackageRoot(dir, root);
|
|
64256
|
-
}
|
|
64257
|
-
/**
|
|
64258
|
-
* Search up for the nearest workspace root
|
|
64259
|
-
*/
|
|
64260
|
-
function searchForWorkspaceRoot(current, root = searchForPackageRoot(current)) {
|
|
64261
|
-
if (hasRootFile(current))
|
|
64262
|
-
return current;
|
|
64263
|
-
if (hasWorkspacePackageJSON(current))
|
|
64264
|
-
return current;
|
|
64265
|
-
const dir = dirname$2(current);
|
|
64266
|
-
// reach the fs root
|
|
64267
|
-
if (!dir || dir === current)
|
|
64268
|
-
return root;
|
|
64269
|
-
return searchForWorkspaceRoot(dir, root);
|
|
64270
|
-
}
|
|
64271
|
-
|
|
64272
62816
|
async function createServer(inlineConfig = {}) {
|
|
64273
62817
|
const config = await resolveConfig(inlineConfig, 'serve', 'development');
|
|
64274
62818
|
const { root, server: serverConfig } = config;
|
|
@@ -64462,8 +63006,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
64462
63006
|
middlewares.use(proxyMiddleware(httpServer, proxy, config));
|
|
64463
63007
|
}
|
|
64464
63008
|
// base
|
|
64465
|
-
|
|
64466
|
-
if (devBase !== '/') {
|
|
63009
|
+
if (config.base !== '/') {
|
|
64467
63010
|
middlewares.use(baseMiddleware(server));
|
|
64468
63011
|
}
|
|
64469
63012
|
// open in editor support
|
|
@@ -64548,7 +63091,6 @@ async function startServer(server, inlinePort, isRestart = false) {
|
|
|
64548
63091
|
const hostname = await resolveHostname(options.host);
|
|
64549
63092
|
const protocol = options.https ? 'https' : 'http';
|
|
64550
63093
|
const info = server.config.logger.info;
|
|
64551
|
-
const devBase = server.config.base;
|
|
64552
63094
|
const serverPort = await httpServerStart(httpServer, {
|
|
64553
63095
|
port,
|
|
64554
63096
|
strictPort: options.strictPort,
|
|
@@ -64571,7 +63113,7 @@ async function startServer(server, inlinePort, isRestart = false) {
|
|
|
64571
63113
|
});
|
|
64572
63114
|
}
|
|
64573
63115
|
if (options.open && !isRestart) {
|
|
64574
|
-
const path = typeof options.open === 'string' ? options.open :
|
|
63116
|
+
const path = typeof options.open === 'string' ? options.open : server.config.base;
|
|
64575
63117
|
openBrowser(path.startsWith('http')
|
|
64576
63118
|
? path
|
|
64577
63119
|
: `${protocol}://${hostname.name}:${serverPort}${path}`, true, server.config.logger);
|
|
@@ -64912,255 +63454,6 @@ var preview$1 = {
|
|
|
64912
63454
|
preview: preview
|
|
64913
63455
|
};
|
|
64914
63456
|
|
|
64915
|
-
var main$1 = {exports: {}};
|
|
64916
|
-
|
|
64917
|
-
const fs = require$$0__default;
|
|
64918
|
-
const path = require$$0$4;
|
|
64919
|
-
const os = require$$1;
|
|
64920
|
-
|
|
64921
|
-
function log (message) {
|
|
64922
|
-
console.log(`[dotenv][DEBUG] ${message}`);
|
|
64923
|
-
}
|
|
64924
|
-
|
|
64925
|
-
const NEWLINE = '\n';
|
|
64926
|
-
const RE_INI_KEY_VAL = /^\s*([\w.-]+)\s*=\s*("[^"]*"|'[^']*'|.*?)(\s+#.*)?$/;
|
|
64927
|
-
const RE_NEWLINES = /\\n/g;
|
|
64928
|
-
const NEWLINES_MATCH = /\r\n|\n|\r/;
|
|
64929
|
-
|
|
64930
|
-
// Parses src into an Object
|
|
64931
|
-
function parse (src, options) {
|
|
64932
|
-
const debug = Boolean(options && options.debug);
|
|
64933
|
-
const multiline = Boolean(options && options.multiline);
|
|
64934
|
-
const obj = {};
|
|
64935
|
-
|
|
64936
|
-
// convert Buffers before splitting into lines and processing
|
|
64937
|
-
const lines = src.toString().split(NEWLINES_MATCH);
|
|
64938
|
-
|
|
64939
|
-
for (let idx = 0; idx < lines.length; idx++) {
|
|
64940
|
-
let line = lines[idx];
|
|
64941
|
-
|
|
64942
|
-
// matching "KEY' and 'VAL' in 'KEY=VAL'
|
|
64943
|
-
const keyValueArr = line.match(RE_INI_KEY_VAL);
|
|
64944
|
-
// matched?
|
|
64945
|
-
if (keyValueArr != null) {
|
|
64946
|
-
const key = keyValueArr[1];
|
|
64947
|
-
// default undefined or missing values to empty string
|
|
64948
|
-
let val = (keyValueArr[2] || '');
|
|
64949
|
-
let end = val.length - 1;
|
|
64950
|
-
const isDoubleQuoted = val[0] === '"' && val[end] === '"';
|
|
64951
|
-
const isSingleQuoted = val[0] === "'" && val[end] === "'";
|
|
64952
|
-
|
|
64953
|
-
const isMultilineDoubleQuoted = val[0] === '"' && val[end] !== '"';
|
|
64954
|
-
const isMultilineSingleQuoted = val[0] === "'" && val[end] !== "'";
|
|
64955
|
-
|
|
64956
|
-
// if parsing line breaks and the value starts with a quote
|
|
64957
|
-
if (multiline && (isMultilineDoubleQuoted || isMultilineSingleQuoted)) {
|
|
64958
|
-
const quoteChar = isMultilineDoubleQuoted ? '"' : "'";
|
|
64959
|
-
|
|
64960
|
-
val = val.substring(1);
|
|
64961
|
-
|
|
64962
|
-
while (idx++ < lines.length - 1) {
|
|
64963
|
-
line = lines[idx];
|
|
64964
|
-
end = line.length - 1;
|
|
64965
|
-
if (line[end] === quoteChar) {
|
|
64966
|
-
val += NEWLINE + line.substring(0, end);
|
|
64967
|
-
break
|
|
64968
|
-
}
|
|
64969
|
-
val += NEWLINE + line;
|
|
64970
|
-
}
|
|
64971
|
-
// if single or double quoted, remove quotes
|
|
64972
|
-
} else if (isSingleQuoted || isDoubleQuoted) {
|
|
64973
|
-
val = val.substring(1, end);
|
|
64974
|
-
|
|
64975
|
-
// if double quoted, expand newlines
|
|
64976
|
-
if (isDoubleQuoted) {
|
|
64977
|
-
val = val.replace(RE_NEWLINES, NEWLINE);
|
|
64978
|
-
}
|
|
64979
|
-
} else {
|
|
64980
|
-
// remove surrounding whitespace
|
|
64981
|
-
val = val.trim();
|
|
64982
|
-
}
|
|
64983
|
-
|
|
64984
|
-
obj[key] = val;
|
|
64985
|
-
} else if (debug) {
|
|
64986
|
-
const trimmedLine = line.trim();
|
|
64987
|
-
|
|
64988
|
-
// ignore empty and commented lines
|
|
64989
|
-
if (trimmedLine.length && trimmedLine[0] !== '#') {
|
|
64990
|
-
log(`Failed to match key and value when parsing line ${idx + 1}: ${line}`);
|
|
64991
|
-
}
|
|
64992
|
-
}
|
|
64993
|
-
}
|
|
64994
|
-
|
|
64995
|
-
return obj
|
|
64996
|
-
}
|
|
64997
|
-
|
|
64998
|
-
function resolveHome (envPath) {
|
|
64999
|
-
return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
|
|
65000
|
-
}
|
|
65001
|
-
|
|
65002
|
-
// Populates process.env from .env file
|
|
65003
|
-
function config (options) {
|
|
65004
|
-
let dotenvPath = path.resolve(process.cwd(), '.env');
|
|
65005
|
-
let encoding = 'utf8';
|
|
65006
|
-
const debug = Boolean(options && options.debug);
|
|
65007
|
-
const override = Boolean(options && options.override);
|
|
65008
|
-
const multiline = Boolean(options && options.multiline);
|
|
65009
|
-
|
|
65010
|
-
if (options) {
|
|
65011
|
-
if (options.path != null) {
|
|
65012
|
-
dotenvPath = resolveHome(options.path);
|
|
65013
|
-
}
|
|
65014
|
-
if (options.encoding != null) {
|
|
65015
|
-
encoding = options.encoding;
|
|
65016
|
-
}
|
|
65017
|
-
}
|
|
65018
|
-
|
|
65019
|
-
try {
|
|
65020
|
-
// specifying an encoding returns a string instead of a buffer
|
|
65021
|
-
const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }), { debug, multiline });
|
|
65022
|
-
|
|
65023
|
-
Object.keys(parsed).forEach(function (key) {
|
|
65024
|
-
if (!Object.prototype.hasOwnProperty.call(process.env, key)) {
|
|
65025
|
-
process.env[key] = parsed[key];
|
|
65026
|
-
} else {
|
|
65027
|
-
if (override === true) {
|
|
65028
|
-
process.env[key] = parsed[key];
|
|
65029
|
-
}
|
|
65030
|
-
|
|
65031
|
-
if (debug) {
|
|
65032
|
-
if (override === true) {
|
|
65033
|
-
log(`"${key}" is already defined in \`process.env\` and WAS overwritten`);
|
|
65034
|
-
} else {
|
|
65035
|
-
log(`"${key}" is already defined in \`process.env\` and was NOT overwritten`);
|
|
65036
|
-
}
|
|
65037
|
-
}
|
|
65038
|
-
}
|
|
65039
|
-
});
|
|
65040
|
-
|
|
65041
|
-
return { parsed }
|
|
65042
|
-
} catch (e) {
|
|
65043
|
-
if (debug) {
|
|
65044
|
-
log(`Failed to load ${dotenvPath} ${e.message}`);
|
|
65045
|
-
}
|
|
65046
|
-
|
|
65047
|
-
return { error: e }
|
|
65048
|
-
}
|
|
65049
|
-
}
|
|
65050
|
-
|
|
65051
|
-
const DotenvModule = {
|
|
65052
|
-
config,
|
|
65053
|
-
parse
|
|
65054
|
-
};
|
|
65055
|
-
|
|
65056
|
-
main$1.exports.config = DotenvModule.config;
|
|
65057
|
-
main$1.exports.parse = DotenvModule.parse;
|
|
65058
|
-
main$1.exports = DotenvModule;
|
|
65059
|
-
|
|
65060
|
-
var dotenvExpand = function (config) {
|
|
65061
|
-
// if ignoring process.env, use a blank object
|
|
65062
|
-
var environment = config.ignoreProcessEnv ? {} : process.env;
|
|
65063
|
-
|
|
65064
|
-
var interpolate = function (envValue) {
|
|
65065
|
-
var matches = envValue.match(/(.?\${?(?:[a-zA-Z0-9_]+)?}?)/g) || [];
|
|
65066
|
-
|
|
65067
|
-
return matches.reduce(function (newEnv, match) {
|
|
65068
|
-
var parts = /(.?)\${?([a-zA-Z0-9_]+)?}?/g.exec(match);
|
|
65069
|
-
var prefix = parts[1];
|
|
65070
|
-
|
|
65071
|
-
var value, replacePart;
|
|
65072
|
-
|
|
65073
|
-
if (prefix === '\\') {
|
|
65074
|
-
replacePart = parts[0];
|
|
65075
|
-
value = replacePart.replace('\\$', '$');
|
|
65076
|
-
} else {
|
|
65077
|
-
var key = parts[2];
|
|
65078
|
-
replacePart = parts[0].substring(prefix.length);
|
|
65079
|
-
// process.env value 'wins' over .env file's value
|
|
65080
|
-
value = environment.hasOwnProperty(key) ? environment[key] : (config.parsed[key] || '');
|
|
65081
|
-
|
|
65082
|
-
// Resolve recursive interpolations
|
|
65083
|
-
value = interpolate(value);
|
|
65084
|
-
}
|
|
65085
|
-
|
|
65086
|
-
return newEnv.replace(replacePart, value)
|
|
65087
|
-
}, envValue)
|
|
65088
|
-
};
|
|
65089
|
-
|
|
65090
|
-
for (var configKey in config.parsed) {
|
|
65091
|
-
var value = environment.hasOwnProperty(configKey) ? environment[configKey] : config.parsed[configKey];
|
|
65092
|
-
|
|
65093
|
-
config.parsed[configKey] = interpolate(value);
|
|
65094
|
-
}
|
|
65095
|
-
|
|
65096
|
-
for (var processKey in config.parsed) {
|
|
65097
|
-
environment[processKey] = config.parsed[processKey];
|
|
65098
|
-
}
|
|
65099
|
-
|
|
65100
|
-
return config
|
|
65101
|
-
};
|
|
65102
|
-
|
|
65103
|
-
var main = dotenvExpand;
|
|
65104
|
-
|
|
65105
|
-
function loadEnv(mode, envDir, prefixes = 'VITE_') {
|
|
65106
|
-
if (mode === 'local') {
|
|
65107
|
-
throw new Error(`"local" cannot be used as a mode name because it conflicts with ` +
|
|
65108
|
-
`the .local postfix for .env files.`);
|
|
65109
|
-
}
|
|
65110
|
-
prefixes = arraify(prefixes);
|
|
65111
|
-
const env = {};
|
|
65112
|
-
const envFiles = [
|
|
65113
|
-
/** default file */ `.env`,
|
|
65114
|
-
/** local file */ `.env.local`,
|
|
65115
|
-
/** mode file */ `.env.${mode}`,
|
|
65116
|
-
/** mode local file */ `.env.${mode}.local`
|
|
65117
|
-
];
|
|
65118
|
-
// check if there are actual env variables starting with VITE_*
|
|
65119
|
-
// these are typically provided inline and should be prioritized
|
|
65120
|
-
for (const key in process.env) {
|
|
65121
|
-
if (prefixes.some((prefix) => key.startsWith(prefix)) &&
|
|
65122
|
-
env[key] === undefined) {
|
|
65123
|
-
env[key] = process.env[key];
|
|
65124
|
-
}
|
|
65125
|
-
}
|
|
65126
|
-
const parsed = Object.fromEntries(envFiles.flatMap((file) => {
|
|
65127
|
-
const path = lookupFile(envDir, [file], {
|
|
65128
|
-
pathOnly: true,
|
|
65129
|
-
rootDir: envDir
|
|
65130
|
-
});
|
|
65131
|
-
if (!path)
|
|
65132
|
-
return [];
|
|
65133
|
-
return Object.entries(main$1.exports.parse(fs$l.readFileSync(path), {
|
|
65134
|
-
debug: process.env.DEBUG?.includes('vite:dotenv')
|
|
65135
|
-
}));
|
|
65136
|
-
}));
|
|
65137
|
-
// let environment variables use each other
|
|
65138
|
-
main({
|
|
65139
|
-
parsed,
|
|
65140
|
-
// prevent process.env mutation
|
|
65141
|
-
ignoreProcessEnv: true
|
|
65142
|
-
});
|
|
65143
|
-
// only keys that start with prefix are exposed to client
|
|
65144
|
-
for (const [key, value] of Object.entries(parsed)) {
|
|
65145
|
-
if (prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
65146
|
-
env[key] = value;
|
|
65147
|
-
}
|
|
65148
|
-
else if (key === 'NODE_ENV' &&
|
|
65149
|
-
process.env.VITE_USER_NODE_ENV === undefined) {
|
|
65150
|
-
// NODE_ENV override in .env file
|
|
65151
|
-
process.env.VITE_USER_NODE_ENV = value;
|
|
65152
|
-
}
|
|
65153
|
-
}
|
|
65154
|
-
return env;
|
|
65155
|
-
}
|
|
65156
|
-
function resolveEnvPrefix({ envPrefix = 'VITE_' }) {
|
|
65157
|
-
envPrefix = arraify(envPrefix);
|
|
65158
|
-
if (envPrefix.some((prefix) => prefix === '')) {
|
|
65159
|
-
throw new Error(`envPrefix option contains value '', which could lead unexpected exposure of sensitive information.`);
|
|
65160
|
-
}
|
|
65161
|
-
return envPrefix;
|
|
65162
|
-
}
|
|
65163
|
-
|
|
65164
63457
|
function resolveSSROptions(ssr, preserveSymlinks, buildSsrCjsExternalHeuristics) {
|
|
65165
63458
|
ssr ?? (ssr = {});
|
|
65166
63459
|
const optimizeDeps = ssr.optimizeDeps ?? {};
|
|
@@ -65314,7 +63607,7 @@ async function resolveConfig(inlineConfig, command, defaultMode = 'development')
|
|
|
65314
63607
|
? '/'
|
|
65315
63608
|
: './'
|
|
65316
63609
|
: resolveBaseUrl(config.base, isBuild, logger) ?? '/';
|
|
65317
|
-
const resolvedBuildOptions = resolveBuildOptions(config.build,
|
|
63610
|
+
const resolvedBuildOptions = resolveBuildOptions(config.build, logger);
|
|
65318
63611
|
// resolve cache directory
|
|
65319
63612
|
const pkgPath = lookupFile(resolvedRoot, [`package.json`], { pathOnly: true });
|
|
65320
63613
|
const cacheDir = config.cacheDir
|
|
@@ -65641,27 +63934,40 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
65641
63934
|
{
|
|
65642
63935
|
name: 'externalize-deps',
|
|
65643
63936
|
setup(build) {
|
|
63937
|
+
const options = {
|
|
63938
|
+
root: path$n.dirname(fileName),
|
|
63939
|
+
isBuild: true,
|
|
63940
|
+
isProduction: true,
|
|
63941
|
+
isRequire: !isESM,
|
|
63942
|
+
preferRelative: false,
|
|
63943
|
+
tryIndex: true,
|
|
63944
|
+
mainFields: [],
|
|
63945
|
+
browserField: false,
|
|
63946
|
+
conditions: [],
|
|
63947
|
+
overrideConditions: ['node'],
|
|
63948
|
+
dedupe: [],
|
|
63949
|
+
extensions: DEFAULT_EXTENSIONS$1,
|
|
63950
|
+
preserveSymlinks: false
|
|
63951
|
+
};
|
|
65644
63952
|
// externalize bare imports
|
|
65645
63953
|
build.onResolve({ filter: /^[^.].*/ }, async ({ path: id, importer, kind }) => {
|
|
65646
|
-
if (kind === 'entry-point' ||
|
|
63954
|
+
if (kind === 'entry-point' ||
|
|
63955
|
+
path$n.isAbsolute(id) ||
|
|
63956
|
+
isBuiltin(id)) {
|
|
65647
63957
|
return;
|
|
65648
63958
|
}
|
|
65649
63959
|
// partial deno support as `npm:` does not work with esbuild
|
|
65650
63960
|
if (id.startsWith('npm:')) {
|
|
65651
63961
|
return { external: true };
|
|
65652
63962
|
}
|
|
65653
|
-
|
|
65654
|
-
|
|
65655
|
-
|
|
65656
|
-
let resolved;
|
|
65657
|
-
if (resolveWithRequire) {
|
|
65658
|
-
const require = createRequire$1(importer);
|
|
65659
|
-
resolved = require.resolve(id);
|
|
63963
|
+
let idFsPath = tryNodeResolve(id, importer, options, false)?.id;
|
|
63964
|
+
if (idFsPath && (isESM || kind === 'dynamic-import')) {
|
|
63965
|
+
idFsPath = pathToFileURL$1(idFsPath).href;
|
|
65660
63966
|
}
|
|
65661
|
-
|
|
65662
|
-
|
|
65663
|
-
|
|
65664
|
-
|
|
63967
|
+
return {
|
|
63968
|
+
path: idFsPath,
|
|
63969
|
+
external: true
|
|
63970
|
+
};
|
|
65665
63971
|
});
|
|
65666
63972
|
}
|
|
65667
63973
|
},
|
|
@@ -65672,7 +63978,7 @@ async function bundleConfigFile(fileName, isESM) {
|
|
|
65672
63978
|
const contents = await fs$l.promises.readFile(args.path, 'utf8');
|
|
65673
63979
|
const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path$n.dirname(args.path))};` +
|
|
65674
63980
|
`const ${filenameVarName} = ${JSON.stringify(args.path)};` +
|
|
65675
|
-
`const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(args.path).href)};`;
|
|
63981
|
+
`const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL$1(args.path).href)};`;
|
|
65676
63982
|
return {
|
|
65677
63983
|
loader: args.path.endsWith('ts') ? 'ts' : 'js',
|
|
65678
63984
|
contents: injectValues + contents
|
|
@@ -65696,7 +64002,7 @@ async function loadConfigFromBundledFile(fileName, bundledCode, isESM) {
|
|
|
65696
64002
|
if (isESM) {
|
|
65697
64003
|
const fileBase = `${fileName}.timestamp-${Date.now()}`;
|
|
65698
64004
|
const fileNameTmp = `${fileBase}.mjs`;
|
|
65699
|
-
const fileUrl = `${pathToFileURL(fileBase)}.mjs`;
|
|
64005
|
+
const fileUrl = `${pathToFileURL$1(fileBase)}.mjs`;
|
|
65700
64006
|
fs$l.writeFileSync(fileNameTmp, bundledCode);
|
|
65701
64007
|
try {
|
|
65702
64008
|
return (await dynamicImport(fileUrl)).default;
|
|
@@ -65756,4 +64062,4 @@ function isDepsOptimizerEnabled(config, ssr) {
|
|
|
65756
64062
|
(command === 'serve' && disabled === 'dev'));
|
|
65757
64063
|
}
|
|
65758
64064
|
|
|
65759
|
-
export { index$1 as
|
|
64065
|
+
export { commonjsGlobal as A, index$1 as B, build$1 as C, index as D, preview$1 as E, preprocessCSS as a, build as b, createServer as c, resolvePackageData as d, defineConfig as e, formatPostcssSourceMap as f, resolveConfig as g, resolveBaseUrl as h, getDepOptimizationConfig as i, isDepsOptimizerEnabled as j, mergeAlias as k, loadConfigFromFile as l, mergeConfig as m, normalizePath$3 as n, optimizeDeps as o, preview as p, createFilter as q, resolvePackageEntry as r, sortUserPlugins as s, transformWithEsbuild as t, send$1 as u, createLogger as v, searchForWorkspaceRoot as w, loadEnv as x, resolveEnvPrefix as y, picocolors as z };
|