weapp-vite 5.7.0 → 5.7.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/dist/auto-routes.cjs +2 -2
- package/dist/auto-routes.mjs +1 -1
- package/dist/{chunk-GU7U5762.mjs → chunk-AXUA33LJ.mjs} +1 -1
- package/dist/{chunk-VRKZFXIZ.cjs → chunk-GGLONZVQ.cjs} +4 -4
- package/dist/{chunk-AKJEW44F.mjs → chunk-O4FBXXL3.mjs} +151 -39
- package/dist/{chunk-FUJ4D6IR.cjs → chunk-T4OVF4GP.cjs} +151 -39
- package/dist/cli.cjs +235 -72
- package/dist/cli.mjs +183 -21
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2 -2
- package/modules/analyze-dashboard/assets/echarts.js +31 -0
- package/modules/analyze-dashboard/assets/index.css +2 -0
- package/modules/analyze-dashboard/assets/index.js +1 -0
- package/modules/analyze-dashboard/assets/rolldown-runtime.js +1 -0
- package/modules/analyze-dashboard/assets/vue.js +6 -0
- package/modules/analyze-dashboard/index.html +13 -0
- package/package.json +11 -4
package/dist/auto-routes.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkT4OVF4GPcjs = require('./chunk-T4OVF4GP.cjs');
|
|
4
4
|
require('./chunk-MQBCRXCD.cjs');
|
|
5
5
|
require('./chunk-G6EZVEVT.cjs');
|
|
6
6
|
|
|
@@ -24,7 +24,7 @@ function createGetter(resolver) {
|
|
|
24
24
|
get: resolver
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
var ctx =
|
|
27
|
+
var ctx = _chunkT4OVF4GPcjs.getCompilerContext.call(void 0, );
|
|
28
28
|
var service = ctx.autoRoutesService;
|
|
29
29
|
var routes = {};
|
|
30
30
|
Object.defineProperties(routes, {
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkT4OVF4GPcjs = require('./chunk-T4OVF4GP.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkA5DD7GKXcjs = require('./chunk-A5DD7GKX.cjs');
|
|
@@ -12,10 +12,10 @@ _chunkA5DD7GKXcjs.init_cjs_shims.call(void 0, );
|
|
|
12
12
|
async function createCompilerContext(options) {
|
|
13
13
|
const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.key]), () => ( "default"));
|
|
14
14
|
if (!_optionalChain([options, 'optionalAccess', _2 => _2.key])) {
|
|
15
|
-
|
|
15
|
+
_chunkT4OVF4GPcjs.resetCompilerContext.call(void 0, key);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
const ctx =
|
|
17
|
+
_chunkT4OVF4GPcjs.setActiveCompilerContextKey.call(void 0, key);
|
|
18
|
+
const ctx = _chunkT4OVF4GPcjs.getCompilerContext.call(void 0, key);
|
|
19
19
|
const { configService, scanService, autoRoutesService } = ctx;
|
|
20
20
|
await configService.load(options);
|
|
21
21
|
if (autoRoutesService) {
|
|
@@ -12191,9 +12191,15 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12191
12191
|
}
|
|
12192
12192
|
updateImporters(bundle, importerToChunk, fileName);
|
|
12193
12193
|
delete bundle[fileName];
|
|
12194
|
-
const
|
|
12195
|
-
|
|
12196
|
-
|
|
12194
|
+
const candidateMapKeys = /* @__PURE__ */ new Set();
|
|
12195
|
+
candidateMapKeys.add(`${fileName}.map`);
|
|
12196
|
+
if (typeof chunk.sourcemapFileName === "string" && chunk.sourcemapFileName) {
|
|
12197
|
+
candidateMapKeys.add(chunk.sourcemapFileName);
|
|
12198
|
+
}
|
|
12199
|
+
for (const mapKey of candidateMapKeys) {
|
|
12200
|
+
if (mapKey && bundle[mapKey]) {
|
|
12201
|
+
delete bundle[mapKey];
|
|
12202
|
+
}
|
|
12197
12203
|
}
|
|
12198
12204
|
const chunkBytes = typeof originalCode === "string" ? Buffer2.byteLength(originalCode, "utf8") : void 0;
|
|
12199
12205
|
const redundantBytes = typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicates.length - 1, 0) : void 0;
|
|
@@ -12232,6 +12238,24 @@ function findChunkImporters(bundle, target) {
|
|
|
12232
12238
|
const chunk = output;
|
|
12233
12239
|
if (chunk.imports.includes(target) || chunk.dynamicImports.includes(target)) {
|
|
12234
12240
|
importers.add(fileName);
|
|
12241
|
+
continue;
|
|
12242
|
+
}
|
|
12243
|
+
const metadata = chunk.viteMetadata;
|
|
12244
|
+
if (metadata) {
|
|
12245
|
+
const importedChunks = metadata.importedChunks;
|
|
12246
|
+
if (hasInCollection(importedChunks, target)) {
|
|
12247
|
+
importers.add(fileName);
|
|
12248
|
+
continue;
|
|
12249
|
+
}
|
|
12250
|
+
const importedScripts = metadata.importedScripts ?? metadata.importedScriptsByUrl;
|
|
12251
|
+
if (hasInCollection(importedScripts, target)) {
|
|
12252
|
+
importers.add(fileName);
|
|
12253
|
+
continue;
|
|
12254
|
+
}
|
|
12255
|
+
}
|
|
12256
|
+
const potentialImport = createRelativeImport(fileName, target);
|
|
12257
|
+
if (potentialImport && containsImportSpecifier(chunk.code ?? "", potentialImport)) {
|
|
12258
|
+
importers.add(fileName);
|
|
12235
12259
|
}
|
|
12236
12260
|
}
|
|
12237
12261
|
return Array.from(importers);
|
|
@@ -12259,11 +12283,35 @@ function updateImporters(bundle, importerToChunk, originalFileName) {
|
|
|
12259
12283
|
const importerChunk = importer;
|
|
12260
12284
|
const originalImportPath = createRelativeImport(importerFile, originalFileName);
|
|
12261
12285
|
const newImportPath = createRelativeImport(importerFile, newChunkFile);
|
|
12286
|
+
let codeUpdated = false;
|
|
12262
12287
|
if (originalImportPath !== newImportPath) {
|
|
12263
|
-
|
|
12288
|
+
const updated = replaceAll(importerChunk.code, originalImportPath, newImportPath);
|
|
12289
|
+
if (updated !== importerChunk.code) {
|
|
12290
|
+
importerChunk.code = updated;
|
|
12291
|
+
codeUpdated = true;
|
|
12292
|
+
}
|
|
12293
|
+
}
|
|
12294
|
+
importerChunk.imports = replaceInArray(importerChunk.imports, originalFileName, newChunkFile, codeUpdated);
|
|
12295
|
+
importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile, codeUpdated);
|
|
12296
|
+
const implicitlyLoadedBefore = importerChunk.implicitlyLoadedBefore;
|
|
12297
|
+
if (Array.isArray(implicitlyLoadedBefore)) {
|
|
12298
|
+
importerChunk.implicitlyLoadedBefore = replaceInArray(
|
|
12299
|
+
implicitlyLoadedBefore,
|
|
12300
|
+
originalFileName,
|
|
12301
|
+
newChunkFile,
|
|
12302
|
+
codeUpdated
|
|
12303
|
+
);
|
|
12304
|
+
}
|
|
12305
|
+
const referencedFiles = importerChunk.referencedFiles;
|
|
12306
|
+
if (Array.isArray(referencedFiles)) {
|
|
12307
|
+
importerChunk.referencedFiles = replaceInArray(
|
|
12308
|
+
referencedFiles,
|
|
12309
|
+
originalFileName,
|
|
12310
|
+
newChunkFile,
|
|
12311
|
+
codeUpdated
|
|
12312
|
+
);
|
|
12264
12313
|
}
|
|
12265
|
-
|
|
12266
|
-
importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile);
|
|
12314
|
+
updateViteMetadata(importerChunk, originalFileName, newChunkFile, codeUpdated);
|
|
12267
12315
|
}
|
|
12268
12316
|
}
|
|
12269
12317
|
function replaceAll(source, searchValue, replaceValue) {
|
|
@@ -12282,10 +12330,74 @@ function replaceAll(source, searchValue, replaceValue) {
|
|
|
12282
12330
|
}
|
|
12283
12331
|
return source;
|
|
12284
12332
|
}
|
|
12285
|
-
function
|
|
12286
|
-
|
|
12287
|
-
return
|
|
12288
|
-
}
|
|
12333
|
+
function containsImportSpecifier(source, specifier) {
|
|
12334
|
+
if (!specifier) {
|
|
12335
|
+
return false;
|
|
12336
|
+
}
|
|
12337
|
+
if (source.includes(specifier)) {
|
|
12338
|
+
return true;
|
|
12339
|
+
}
|
|
12340
|
+
if (specifier.startsWith("./")) {
|
|
12341
|
+
const trimmed = specifier.slice(2);
|
|
12342
|
+
if (trimmed && source.includes(trimmed)) {
|
|
12343
|
+
return true;
|
|
12344
|
+
}
|
|
12345
|
+
}
|
|
12346
|
+
return false;
|
|
12347
|
+
}
|
|
12348
|
+
function hasInCollection(collection, value) {
|
|
12349
|
+
if (!collection || !value) {
|
|
12350
|
+
return false;
|
|
12351
|
+
}
|
|
12352
|
+
if (collection instanceof Set) {
|
|
12353
|
+
return collection.has(value);
|
|
12354
|
+
}
|
|
12355
|
+
if (Array.isArray(collection)) {
|
|
12356
|
+
return collection.includes(value);
|
|
12357
|
+
}
|
|
12358
|
+
if (collection instanceof Map) {
|
|
12359
|
+
return collection.has(value);
|
|
12360
|
+
}
|
|
12361
|
+
return false;
|
|
12362
|
+
}
|
|
12363
|
+
function replaceInArray(list, searchValue, replaceValue, shouldInsert) {
|
|
12364
|
+
const values = Array.isArray(list) ? [...list] : [];
|
|
12365
|
+
let replaced = false;
|
|
12366
|
+
for (let index = 0; index < values.length; index++) {
|
|
12367
|
+
const current2 = values[index];
|
|
12368
|
+
if (current2 === searchValue) {
|
|
12369
|
+
values[index] = replaceValue;
|
|
12370
|
+
replaced = true;
|
|
12371
|
+
}
|
|
12372
|
+
}
|
|
12373
|
+
if ((replaced || shouldInsert) && replaceValue && !values.includes(replaceValue)) {
|
|
12374
|
+
values.push(replaceValue);
|
|
12375
|
+
}
|
|
12376
|
+
return values;
|
|
12377
|
+
}
|
|
12378
|
+
function updateViteMetadata(importerChunk, originalFileName, newChunkFile, shouldInsert) {
|
|
12379
|
+
const metadata = importerChunk.viteMetadata;
|
|
12380
|
+
if (!metadata || typeof metadata !== "object") {
|
|
12381
|
+
return;
|
|
12382
|
+
}
|
|
12383
|
+
const candidateKeys = ["importedChunks", "importedScripts"];
|
|
12384
|
+
for (const key of candidateKeys) {
|
|
12385
|
+
const collection = metadata[key];
|
|
12386
|
+
if (collection instanceof Set) {
|
|
12387
|
+
const hadOriginal = collection.delete(originalFileName);
|
|
12388
|
+
if (hadOriginal || shouldInsert) {
|
|
12389
|
+
collection.add(newChunkFile);
|
|
12390
|
+
}
|
|
12391
|
+
} else if (Array.isArray(collection)) {
|
|
12392
|
+
metadata[key] = replaceInArray(collection, originalFileName, newChunkFile, shouldInsert);
|
|
12393
|
+
} else if (collection instanceof Map) {
|
|
12394
|
+
if (collection.has(originalFileName)) {
|
|
12395
|
+
const originalValue = collection.get(originalFileName);
|
|
12396
|
+
collection.delete(originalFileName);
|
|
12397
|
+
collection.set(newChunkFile, originalValue);
|
|
12398
|
+
}
|
|
12399
|
+
}
|
|
12400
|
+
}
|
|
12289
12401
|
}
|
|
12290
12402
|
function createRelativeImport(fromFile, toFile) {
|
|
12291
12403
|
const relative3 = path10.relative(path10.dirname(fromFile), toFile);
|
|
@@ -12334,6 +12446,35 @@ function createAdvancedChunkNameResolver(options) {
|
|
|
12334
12446
|
// src/runtime/sharedBuildConfig.ts
|
|
12335
12447
|
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12336
12448
|
var REG_COMMONJS_HELPERS = /commonjsHelpers\.js$/;
|
|
12449
|
+
function createForceDuplicateTester(patterns) {
|
|
12450
|
+
if (!patterns || patterns.length === 0) {
|
|
12451
|
+
return void 0;
|
|
12452
|
+
}
|
|
12453
|
+
const matchers = patterns.map((pattern) => {
|
|
12454
|
+
if (typeof pattern === "string") {
|
|
12455
|
+
const matcher = picomatch(pattern, { dot: true });
|
|
12456
|
+
return (value) => matcher(value);
|
|
12457
|
+
}
|
|
12458
|
+
if (isRegexp(pattern)) {
|
|
12459
|
+
return (value) => {
|
|
12460
|
+
pattern.lastIndex = 0;
|
|
12461
|
+
return pattern.test(value);
|
|
12462
|
+
};
|
|
12463
|
+
}
|
|
12464
|
+
return void 0;
|
|
12465
|
+
}).filter((matcher) => typeof matcher === "function");
|
|
12466
|
+
if (!matchers.length) {
|
|
12467
|
+
return void 0;
|
|
12468
|
+
}
|
|
12469
|
+
return (relativeId, absoluteId) => {
|
|
12470
|
+
for (const matcher of matchers) {
|
|
12471
|
+
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12472
|
+
return true;
|
|
12473
|
+
}
|
|
12474
|
+
}
|
|
12475
|
+
return false;
|
|
12476
|
+
};
|
|
12477
|
+
}
|
|
12337
12478
|
function createSharedBuildConfig(configService, scanService) {
|
|
12338
12479
|
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12339
12480
|
const commonjsHelpersDeps = [REG_COMMONJS_HELPERS];
|
|
@@ -12364,35 +12505,6 @@ function createSharedBuildConfig(configService, scanService) {
|
|
|
12364
12505
|
}
|
|
12365
12506
|
};
|
|
12366
12507
|
}
|
|
12367
|
-
function createForceDuplicateTester(patterns) {
|
|
12368
|
-
if (!patterns || patterns.length === 0) {
|
|
12369
|
-
return void 0;
|
|
12370
|
-
}
|
|
12371
|
-
const matchers = patterns.map((pattern) => {
|
|
12372
|
-
if (typeof pattern === "string") {
|
|
12373
|
-
const matcher = picomatch(pattern, { dot: true });
|
|
12374
|
-
return (value) => matcher(value);
|
|
12375
|
-
}
|
|
12376
|
-
if (isRegexp(pattern)) {
|
|
12377
|
-
return (value) => {
|
|
12378
|
-
pattern.lastIndex = 0;
|
|
12379
|
-
return pattern.test(value);
|
|
12380
|
-
};
|
|
12381
|
-
}
|
|
12382
|
-
return void 0;
|
|
12383
|
-
}).filter((matcher) => typeof matcher === "function");
|
|
12384
|
-
if (!matchers.length) {
|
|
12385
|
-
return void 0;
|
|
12386
|
-
}
|
|
12387
|
-
return (relativeId, absoluteId) => {
|
|
12388
|
-
for (const matcher of matchers) {
|
|
12389
|
-
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12390
|
-
return true;
|
|
12391
|
-
}
|
|
12392
|
-
}
|
|
12393
|
-
return false;
|
|
12394
|
-
};
|
|
12395
|
-
}
|
|
12396
12508
|
|
|
12397
12509
|
// src/runtime/buildPlugin.ts
|
|
12398
12510
|
function createBuildService(ctx) {
|
|
@@ -12192,9 +12192,15 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12192
12192
|
}
|
|
12193
12193
|
updateImporters(bundle, importerToChunk, fileName);
|
|
12194
12194
|
delete bundle[fileName];
|
|
12195
|
-
const
|
|
12196
|
-
|
|
12197
|
-
|
|
12195
|
+
const candidateMapKeys = /* @__PURE__ */ new Set();
|
|
12196
|
+
candidateMapKeys.add(`${fileName}.map`);
|
|
12197
|
+
if (typeof chunk.sourcemapFileName === "string" && chunk.sourcemapFileName) {
|
|
12198
|
+
candidateMapKeys.add(chunk.sourcemapFileName);
|
|
12199
|
+
}
|
|
12200
|
+
for (const mapKey of candidateMapKeys) {
|
|
12201
|
+
if (mapKey && bundle[mapKey]) {
|
|
12202
|
+
delete bundle[mapKey];
|
|
12203
|
+
}
|
|
12198
12204
|
}
|
|
12199
12205
|
const chunkBytes = typeof originalCode === "string" ? _buffer.Buffer.byteLength(originalCode, "utf8") : void 0;
|
|
12200
12206
|
const redundantBytes = typeof chunkBytes === "number" ? chunkBytes * Math.max(duplicates.length - 1, 0) : void 0;
|
|
@@ -12233,6 +12239,24 @@ function findChunkImporters(bundle, target) {
|
|
|
12233
12239
|
const chunk = output;
|
|
12234
12240
|
if (chunk.imports.includes(target) || chunk.dynamicImports.includes(target)) {
|
|
12235
12241
|
importers.add(fileName);
|
|
12242
|
+
continue;
|
|
12243
|
+
}
|
|
12244
|
+
const metadata = chunk.viteMetadata;
|
|
12245
|
+
if (metadata) {
|
|
12246
|
+
const importedChunks = metadata.importedChunks;
|
|
12247
|
+
if (hasInCollection(importedChunks, target)) {
|
|
12248
|
+
importers.add(fileName);
|
|
12249
|
+
continue;
|
|
12250
|
+
}
|
|
12251
|
+
const importedScripts = _nullishCoalesce(metadata.importedScripts, () => ( metadata.importedScriptsByUrl));
|
|
12252
|
+
if (hasInCollection(importedScripts, target)) {
|
|
12253
|
+
importers.add(fileName);
|
|
12254
|
+
continue;
|
|
12255
|
+
}
|
|
12256
|
+
}
|
|
12257
|
+
const potentialImport = createRelativeImport(fileName, target);
|
|
12258
|
+
if (potentialImport && containsImportSpecifier(_nullishCoalesce(chunk.code, () => ( "")), potentialImport)) {
|
|
12259
|
+
importers.add(fileName);
|
|
12236
12260
|
}
|
|
12237
12261
|
}
|
|
12238
12262
|
return Array.from(importers);
|
|
@@ -12260,11 +12284,35 @@ function updateImporters(bundle, importerToChunk, originalFileName) {
|
|
|
12260
12284
|
const importerChunk = importer;
|
|
12261
12285
|
const originalImportPath = createRelativeImport(importerFile, originalFileName);
|
|
12262
12286
|
const newImportPath = createRelativeImport(importerFile, newChunkFile);
|
|
12287
|
+
let codeUpdated = false;
|
|
12263
12288
|
if (originalImportPath !== newImportPath) {
|
|
12264
|
-
|
|
12289
|
+
const updated = replaceAll(importerChunk.code, originalImportPath, newImportPath);
|
|
12290
|
+
if (updated !== importerChunk.code) {
|
|
12291
|
+
importerChunk.code = updated;
|
|
12292
|
+
codeUpdated = true;
|
|
12293
|
+
}
|
|
12294
|
+
}
|
|
12295
|
+
importerChunk.imports = replaceInArray(importerChunk.imports, originalFileName, newChunkFile, codeUpdated);
|
|
12296
|
+
importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile, codeUpdated);
|
|
12297
|
+
const implicitlyLoadedBefore = importerChunk.implicitlyLoadedBefore;
|
|
12298
|
+
if (Array.isArray(implicitlyLoadedBefore)) {
|
|
12299
|
+
importerChunk.implicitlyLoadedBefore = replaceInArray(
|
|
12300
|
+
implicitlyLoadedBefore,
|
|
12301
|
+
originalFileName,
|
|
12302
|
+
newChunkFile,
|
|
12303
|
+
codeUpdated
|
|
12304
|
+
);
|
|
12305
|
+
}
|
|
12306
|
+
const referencedFiles = importerChunk.referencedFiles;
|
|
12307
|
+
if (Array.isArray(referencedFiles)) {
|
|
12308
|
+
importerChunk.referencedFiles = replaceInArray(
|
|
12309
|
+
referencedFiles,
|
|
12310
|
+
originalFileName,
|
|
12311
|
+
newChunkFile,
|
|
12312
|
+
codeUpdated
|
|
12313
|
+
);
|
|
12265
12314
|
}
|
|
12266
|
-
|
|
12267
|
-
importerChunk.dynamicImports = replaceInArray(importerChunk.dynamicImports, originalFileName, newChunkFile);
|
|
12315
|
+
updateViteMetadata(importerChunk, originalFileName, newChunkFile, codeUpdated);
|
|
12268
12316
|
}
|
|
12269
12317
|
}
|
|
12270
12318
|
function replaceAll(source, searchValue, replaceValue) {
|
|
@@ -12283,10 +12331,74 @@ function replaceAll(source, searchValue, replaceValue) {
|
|
|
12283
12331
|
}
|
|
12284
12332
|
return source;
|
|
12285
12333
|
}
|
|
12286
|
-
function
|
|
12287
|
-
|
|
12288
|
-
return
|
|
12289
|
-
}
|
|
12334
|
+
function containsImportSpecifier(source, specifier) {
|
|
12335
|
+
if (!specifier) {
|
|
12336
|
+
return false;
|
|
12337
|
+
}
|
|
12338
|
+
if (source.includes(specifier)) {
|
|
12339
|
+
return true;
|
|
12340
|
+
}
|
|
12341
|
+
if (specifier.startsWith("./")) {
|
|
12342
|
+
const trimmed = specifier.slice(2);
|
|
12343
|
+
if (trimmed && source.includes(trimmed)) {
|
|
12344
|
+
return true;
|
|
12345
|
+
}
|
|
12346
|
+
}
|
|
12347
|
+
return false;
|
|
12348
|
+
}
|
|
12349
|
+
function hasInCollection(collection, value) {
|
|
12350
|
+
if (!collection || !value) {
|
|
12351
|
+
return false;
|
|
12352
|
+
}
|
|
12353
|
+
if (collection instanceof Set) {
|
|
12354
|
+
return collection.has(value);
|
|
12355
|
+
}
|
|
12356
|
+
if (Array.isArray(collection)) {
|
|
12357
|
+
return collection.includes(value);
|
|
12358
|
+
}
|
|
12359
|
+
if (collection instanceof Map) {
|
|
12360
|
+
return collection.has(value);
|
|
12361
|
+
}
|
|
12362
|
+
return false;
|
|
12363
|
+
}
|
|
12364
|
+
function replaceInArray(list, searchValue, replaceValue, shouldInsert) {
|
|
12365
|
+
const values = Array.isArray(list) ? [...list] : [];
|
|
12366
|
+
let replaced = false;
|
|
12367
|
+
for (let index = 0; index < values.length; index++) {
|
|
12368
|
+
const current2 = values[index];
|
|
12369
|
+
if (current2 === searchValue) {
|
|
12370
|
+
values[index] = replaceValue;
|
|
12371
|
+
replaced = true;
|
|
12372
|
+
}
|
|
12373
|
+
}
|
|
12374
|
+
if ((replaced || shouldInsert) && replaceValue && !values.includes(replaceValue)) {
|
|
12375
|
+
values.push(replaceValue);
|
|
12376
|
+
}
|
|
12377
|
+
return values;
|
|
12378
|
+
}
|
|
12379
|
+
function updateViteMetadata(importerChunk, originalFileName, newChunkFile, shouldInsert) {
|
|
12380
|
+
const metadata = importerChunk.viteMetadata;
|
|
12381
|
+
if (!metadata || typeof metadata !== "object") {
|
|
12382
|
+
return;
|
|
12383
|
+
}
|
|
12384
|
+
const candidateKeys = ["importedChunks", "importedScripts"];
|
|
12385
|
+
for (const key of candidateKeys) {
|
|
12386
|
+
const collection = metadata[key];
|
|
12387
|
+
if (collection instanceof Set) {
|
|
12388
|
+
const hadOriginal = collection.delete(originalFileName);
|
|
12389
|
+
if (hadOriginal || shouldInsert) {
|
|
12390
|
+
collection.add(newChunkFile);
|
|
12391
|
+
}
|
|
12392
|
+
} else if (Array.isArray(collection)) {
|
|
12393
|
+
metadata[key] = replaceInArray(collection, originalFileName, newChunkFile, shouldInsert);
|
|
12394
|
+
} else if (collection instanceof Map) {
|
|
12395
|
+
if (collection.has(originalFileName)) {
|
|
12396
|
+
const originalValue = collection.get(originalFileName);
|
|
12397
|
+
collection.delete(originalFileName);
|
|
12398
|
+
collection.set(newChunkFile, originalValue);
|
|
12399
|
+
}
|
|
12400
|
+
}
|
|
12401
|
+
}
|
|
12290
12402
|
}
|
|
12291
12403
|
function createRelativeImport(fromFile, toFile) {
|
|
12292
12404
|
const relative3 = _pathe.posix.relative(_pathe.posix.dirname(fromFile), toFile);
|
|
@@ -12335,6 +12447,35 @@ function createAdvancedChunkNameResolver(options) {
|
|
|
12335
12447
|
// src/runtime/sharedBuildConfig.ts
|
|
12336
12448
|
var REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
12337
12449
|
var REG_COMMONJS_HELPERS = /commonjsHelpers\.js$/;
|
|
12450
|
+
function createForceDuplicateTester(patterns) {
|
|
12451
|
+
if (!patterns || patterns.length === 0) {
|
|
12452
|
+
return void 0;
|
|
12453
|
+
}
|
|
12454
|
+
const matchers = patterns.map((pattern) => {
|
|
12455
|
+
if (typeof pattern === "string") {
|
|
12456
|
+
const matcher = _picomatch2.default.call(void 0, pattern, { dot: true });
|
|
12457
|
+
return (value) => matcher(value);
|
|
12458
|
+
}
|
|
12459
|
+
if (isRegexp(pattern)) {
|
|
12460
|
+
return (value) => {
|
|
12461
|
+
pattern.lastIndex = 0;
|
|
12462
|
+
return pattern.test(value);
|
|
12463
|
+
};
|
|
12464
|
+
}
|
|
12465
|
+
return void 0;
|
|
12466
|
+
}).filter((matcher) => typeof matcher === "function");
|
|
12467
|
+
if (!matchers.length) {
|
|
12468
|
+
return void 0;
|
|
12469
|
+
}
|
|
12470
|
+
return (relativeId, absoluteId) => {
|
|
12471
|
+
for (const matcher of matchers) {
|
|
12472
|
+
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12473
|
+
return true;
|
|
12474
|
+
}
|
|
12475
|
+
}
|
|
12476
|
+
return false;
|
|
12477
|
+
};
|
|
12478
|
+
}
|
|
12338
12479
|
function createSharedBuildConfig(configService, scanService) {
|
|
12339
12480
|
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
12340
12481
|
const commonjsHelpersDeps = [REG_COMMONJS_HELPERS];
|
|
@@ -12365,35 +12506,6 @@ function createSharedBuildConfig(configService, scanService) {
|
|
|
12365
12506
|
}
|
|
12366
12507
|
};
|
|
12367
12508
|
}
|
|
12368
|
-
function createForceDuplicateTester(patterns) {
|
|
12369
|
-
if (!patterns || patterns.length === 0) {
|
|
12370
|
-
return void 0;
|
|
12371
|
-
}
|
|
12372
|
-
const matchers = patterns.map((pattern) => {
|
|
12373
|
-
if (typeof pattern === "string") {
|
|
12374
|
-
const matcher = _picomatch2.default.call(void 0, pattern, { dot: true });
|
|
12375
|
-
return (value) => matcher(value);
|
|
12376
|
-
}
|
|
12377
|
-
if (isRegexp(pattern)) {
|
|
12378
|
-
return (value) => {
|
|
12379
|
-
pattern.lastIndex = 0;
|
|
12380
|
-
return pattern.test(value);
|
|
12381
|
-
};
|
|
12382
|
-
}
|
|
12383
|
-
return void 0;
|
|
12384
|
-
}).filter((matcher) => typeof matcher === "function");
|
|
12385
|
-
if (!matchers.length) {
|
|
12386
|
-
return void 0;
|
|
12387
|
-
}
|
|
12388
|
-
return (relativeId, absoluteId) => {
|
|
12389
|
-
for (const matcher of matchers) {
|
|
12390
|
-
if (matcher(relativeId) || matcher(absoluteId)) {
|
|
12391
|
-
return true;
|
|
12392
|
-
}
|
|
12393
|
-
}
|
|
12394
|
-
return false;
|
|
12395
|
-
};
|
|
12396
|
-
}
|
|
12397
12509
|
|
|
12398
12510
|
// src/runtime/buildPlugin.ts
|
|
12399
12511
|
function createBuildService(ctx) {
|