weapp-vite 5.9.3 → 5.9.4
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-import-components/resolvers.cjs +5 -5
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.cjs +8 -8
- package/dist/auto-routes.mjs +4 -4
- package/dist/{chunk-QE4CCPIM.cjs → chunk-3OFG76US.cjs} +2 -2
- package/dist/{chunk-BABWFO2J.mjs → chunk-3V77QISZ.mjs} +2 -2
- package/dist/{chunk-ADHMUOMA.mjs → chunk-B4H5W45I.mjs} +1 -1
- package/dist/{chunk-UUINGAX5.cjs → chunk-FUIUGCNV.cjs} +2 -2
- package/dist/{chunk-3RJJLJFL.mjs → chunk-FYXAC53C.mjs} +1 -1
- package/dist/{chunk-X7NDPMSX.cjs → chunk-GSJZUMRD.cjs} +346 -278
- package/dist/{chunk-G2OEXJ54.cjs → chunk-KV5JVZNT.cjs} +2 -2
- package/dist/chunk-MDUAIMDF.cjs +6 -0
- package/dist/{chunk-QJHAB5L4.mjs → chunk-R4NBLERP.mjs} +2 -2
- package/dist/{chunk-6UMXPFUN.mjs → chunk-VNPRE7DQ.mjs} +1 -1
- package/dist/{chunk-MEDNWDUE.mjs → chunk-VTF7DPLC.mjs} +84 -16
- package/dist/{chunk-3ODCXNIM.cjs → chunk-W5OEPQ7S.cjs} +6 -6
- package/dist/cli.cjs +77 -77
- package/dist/cli.mjs +3 -3
- package/dist/config.cjs +4 -4
- package/dist/config.mjs +3 -3
- package/dist/index.cjs +8 -8
- package/dist/index.mjs +6 -6
- package/dist/json.cjs +3 -3
- package/dist/json.mjs +2 -2
- package/dist/types.cjs +9 -9
- package/dist/types.mjs +2 -2
- package/dist/volar.cjs +2 -2
- package/dist/volar.mjs +1 -1
- package/package.json +7 -7
- package/dist/chunk-ROANXT5Q.cjs +0 -6
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkFUIUGCNVcjs = require('./chunk-FUIUGCNV.cjs');
|
|
4
4
|
|
|
5
5
|
// src/config.ts
|
|
6
|
-
|
|
6
|
+
_chunkFUIUGCNVcjs.init_cjs_shims.call(void 0, );
|
|
7
7
|
function defineConfig(config) {
|
|
8
8
|
return config;
|
|
9
9
|
}
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getCompilerContext,
|
|
3
3
|
resetCompilerContext,
|
|
4
4
|
setActiveCompilerContextKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VTF7DPLC.mjs";
|
|
6
6
|
import {
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-3V77QISZ.mjs";
|
|
9
9
|
|
|
10
10
|
// src/createContext.ts
|
|
11
11
|
init_esm_shims();
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__require,
|
|
4
4
|
__toESM,
|
|
5
5
|
init_esm_shims
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3V77QISZ.mjs";
|
|
7
7
|
|
|
8
8
|
// ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
|
|
9
9
|
var require_debug = __commonJS({
|
|
@@ -12391,12 +12391,14 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12391
12391
|
const sourceMapAssetInfo = findSourceMapAsset(bundle, sourceMapKeys);
|
|
12392
12392
|
const resolvedSourceMap = resolveSourceMapSource(originalMap, sourceMapAssetInfo?.asset.source);
|
|
12393
12393
|
const importerMap = /* @__PURE__ */ new Map();
|
|
12394
|
+
const mainImporters = [];
|
|
12394
12395
|
let hasMainImporter = false;
|
|
12395
12396
|
const shouldForceDuplicate = isForceDuplicateSharedChunk(originalSharedFileName);
|
|
12396
12397
|
for (const importerFile of importers) {
|
|
12397
12398
|
const root = resolveSubPackagePrefix(importerFile, subPackageRoots);
|
|
12398
12399
|
if (!root) {
|
|
12399
12400
|
hasMainImporter = true;
|
|
12401
|
+
mainImporters.push(importerFile);
|
|
12400
12402
|
continue;
|
|
12401
12403
|
}
|
|
12402
12404
|
const duplicateBaseName = path10.basename(fileName);
|
|
@@ -12436,6 +12438,13 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12436
12438
|
}
|
|
12437
12439
|
finalFileName = newFileName;
|
|
12438
12440
|
}
|
|
12441
|
+
if (finalFileName !== originalSharedFileName) {
|
|
12442
|
+
const fallbackImporterMap = /* @__PURE__ */ new Map();
|
|
12443
|
+
for (const importerFile of importers) {
|
|
12444
|
+
fallbackImporterMap.set(importerFile, finalFileName);
|
|
12445
|
+
}
|
|
12446
|
+
updateImporters(bundle, fallbackImporterMap, originalSharedFileName);
|
|
12447
|
+
}
|
|
12439
12448
|
options.onFallback?.({
|
|
12440
12449
|
sharedFileName: originalSharedFileName,
|
|
12441
12450
|
finalFileName,
|
|
@@ -12460,6 +12469,13 @@ function applySharedChunkStrategy(bundle, options) {
|
|
|
12460
12469
|
delete bundle[mapKey];
|
|
12461
12470
|
}
|
|
12462
12471
|
}
|
|
12472
|
+
if (mainImporters.length) {
|
|
12473
|
+
const mainImporterMap = /* @__PURE__ */ new Map();
|
|
12474
|
+
for (const importerFile of mainImporters) {
|
|
12475
|
+
mainImporterMap.set(importerFile, newFileName);
|
|
12476
|
+
}
|
|
12477
|
+
updateImporters(bundle, mainImporterMap, originalSharedFileName);
|
|
12478
|
+
}
|
|
12463
12479
|
options.onFallback?.({
|
|
12464
12480
|
sharedFileName: originalSharedFileName,
|
|
12465
12481
|
finalFileName: newFileName,
|
|
@@ -21730,7 +21746,7 @@ function autoRoutes(ctx) {
|
|
|
21730
21746
|
|
|
21731
21747
|
// src/plugins/core.ts
|
|
21732
21748
|
init_esm_shims();
|
|
21733
|
-
import { isEmptyObject as isEmptyObject2, isObject as
|
|
21749
|
+
import { isEmptyObject as isEmptyObject2, isObject as isObject7, removeExtensionDeep as removeExtensionDeep5 } from "@weapp-core/shared";
|
|
21734
21750
|
import fs16 from "fs-extra";
|
|
21735
21751
|
|
|
21736
21752
|
// ../../node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs
|
|
@@ -23120,6 +23136,53 @@ function createChunkEmitter(configService, loadedEntrySet, debug4) {
|
|
|
23120
23136
|
};
|
|
23121
23137
|
}
|
|
23122
23138
|
|
|
23139
|
+
// src/plugins/hooks/useLoadEntry/extendedLib.ts
|
|
23140
|
+
init_esm_shims();
|
|
23141
|
+
import { isObject as isObject4 } from "@weapp-core/shared";
|
|
23142
|
+
var EXTENDED_LIB_DESCRIPTORS = {
|
|
23143
|
+
weui: {
|
|
23144
|
+
componentPrefixes: ["weui-miniprogram/"]
|
|
23145
|
+
}
|
|
23146
|
+
};
|
|
23147
|
+
function isBareSpecifier(value) {
|
|
23148
|
+
return Boolean(value) && !value.startsWith(".") && !value.startsWith("/");
|
|
23149
|
+
}
|
|
23150
|
+
function createExtendedLibManager() {
|
|
23151
|
+
let enabledLibs = /* @__PURE__ */ new Set();
|
|
23152
|
+
return {
|
|
23153
|
+
syncFromAppJson(json) {
|
|
23154
|
+
const nextEnabled = /* @__PURE__ */ new Set();
|
|
23155
|
+
const extendedLib = json?.useExtendedLib;
|
|
23156
|
+
if (isObject4(extendedLib)) {
|
|
23157
|
+
for (const [libName, enabled] of Object.entries(extendedLib)) {
|
|
23158
|
+
if (!enabled) {
|
|
23159
|
+
continue;
|
|
23160
|
+
}
|
|
23161
|
+
if (EXTENDED_LIB_DESCRIPTORS[libName]) {
|
|
23162
|
+
nextEnabled.add(libName);
|
|
23163
|
+
}
|
|
23164
|
+
}
|
|
23165
|
+
}
|
|
23166
|
+
enabledLibs = nextEnabled;
|
|
23167
|
+
},
|
|
23168
|
+
shouldIgnoreEntry(entry) {
|
|
23169
|
+
if (!isBareSpecifier(entry) || entry.includes(":") || enabledLibs.size === 0) {
|
|
23170
|
+
return false;
|
|
23171
|
+
}
|
|
23172
|
+
for (const libName of enabledLibs) {
|
|
23173
|
+
const descriptor = EXTENDED_LIB_DESCRIPTORS[libName];
|
|
23174
|
+
if (!descriptor) {
|
|
23175
|
+
continue;
|
|
23176
|
+
}
|
|
23177
|
+
if (descriptor.componentPrefixes.some((prefix) => entry === prefix || entry.startsWith(prefix))) {
|
|
23178
|
+
return true;
|
|
23179
|
+
}
|
|
23180
|
+
}
|
|
23181
|
+
return false;
|
|
23182
|
+
}
|
|
23183
|
+
};
|
|
23184
|
+
}
|
|
23185
|
+
|
|
23123
23186
|
// src/plugins/hooks/useLoadEntry/jsonEmit.ts
|
|
23124
23187
|
init_esm_shims();
|
|
23125
23188
|
function createJsonEmitManager(configService) {
|
|
@@ -23151,15 +23214,15 @@ import path23 from "pathe";
|
|
|
23151
23214
|
|
|
23152
23215
|
// src/plugins/utils/analyze.ts
|
|
23153
23216
|
init_esm_shims();
|
|
23154
|
-
import { get as get3, isObject as
|
|
23217
|
+
import { get as get3, isObject as isObject5, removeExtension } from "@weapp-core/shared";
|
|
23155
23218
|
import path22 from "pathe";
|
|
23156
23219
|
function collectPluginExportEntries(plugins, root) {
|
|
23157
|
-
if (!
|
|
23220
|
+
if (!isObject5(plugins)) {
|
|
23158
23221
|
return [];
|
|
23159
23222
|
}
|
|
23160
23223
|
const entries = [];
|
|
23161
23224
|
for (const plugin of Object.values(plugins)) {
|
|
23162
|
-
if (!
|
|
23225
|
+
if (!isObject5(plugin)) {
|
|
23163
23226
|
continue;
|
|
23164
23227
|
}
|
|
23165
23228
|
const exportPath = typeof plugin.export === "string" ? plugin.export.trim() : "";
|
|
@@ -23306,6 +23369,7 @@ function createEntryLoader(options) {
|
|
|
23306
23369
|
scanTemplateEntry,
|
|
23307
23370
|
emitEntriesChunks,
|
|
23308
23371
|
applyAutoImports,
|
|
23372
|
+
extendedLibManager,
|
|
23309
23373
|
debug: debug4
|
|
23310
23374
|
} = options;
|
|
23311
23375
|
const { jsonService, configService, scanService } = ctx;
|
|
@@ -23334,6 +23398,7 @@ function createEntryLoader(options) {
|
|
|
23334
23398
|
let pluginJsonPathForRegistration;
|
|
23335
23399
|
let pluginJsonForRegistration;
|
|
23336
23400
|
if (type === "app") {
|
|
23401
|
+
extendedLibManager.syncFromAppJson(json);
|
|
23337
23402
|
entries.push(...analyzeAppJson(json));
|
|
23338
23403
|
await collectAppSideFiles(
|
|
23339
23404
|
this,
|
|
@@ -23376,7 +23441,8 @@ function createEntryLoader(options) {
|
|
|
23376
23441
|
applyAutoImports(baseName, json);
|
|
23377
23442
|
entries.push(...analyzeCommonJson(json));
|
|
23378
23443
|
}
|
|
23379
|
-
const
|
|
23444
|
+
const filteredEntries = entries.filter((entry) => !extendedLibManager.shouldIgnoreEntry(entry));
|
|
23445
|
+
const normalizedEntries = filteredEntries.map((entry) => normalizeEntry(entry, jsonPath));
|
|
23380
23446
|
for (const normalizedEntry of normalizedEntries) {
|
|
23381
23447
|
entriesMap.set(normalizedEntry, {
|
|
23382
23448
|
type: json.component ? "component" : "page",
|
|
@@ -23446,7 +23512,7 @@ function createEntryLoader(options) {
|
|
|
23446
23512
|
|
|
23447
23513
|
// src/plugins/hooks/useLoadEntry/normalizer.ts
|
|
23448
23514
|
init_esm_shims();
|
|
23449
|
-
import { isObject as
|
|
23515
|
+
import { isObject as isObject6 } from "@weapp-core/shared";
|
|
23450
23516
|
import path24 from "pathe";
|
|
23451
23517
|
function resolveImportee2(importee, jsonPath, configService) {
|
|
23452
23518
|
let updated = importee;
|
|
@@ -23476,7 +23542,7 @@ function createEntryNormalizer(configService) {
|
|
|
23476
23542
|
return entry;
|
|
23477
23543
|
}
|
|
23478
23544
|
const tokens = entry.split("/");
|
|
23479
|
-
if (tokens[0] &&
|
|
23545
|
+
if (tokens[0] && isObject6(configService.packageJson.dependencies) && hasDependencyPrefix(configService.packageJson.dependencies, tokens)) {
|
|
23480
23546
|
return `npm:${entry}`;
|
|
23481
23547
|
}
|
|
23482
23548
|
if (tokens[0] === "") {
|
|
@@ -23513,6 +23579,7 @@ function useLoadEntry(ctx) {
|
|
|
23513
23579
|
const scanTemplateEntry = createTemplateScanner(ctx.wxmlService, debug4);
|
|
23514
23580
|
const emitEntriesChunks = createChunkEmitter(ctx.configService, loadedEntrySet, debug4);
|
|
23515
23581
|
const applyAutoImports = createAutoImportAugmenter(ctx.autoImportService, ctx.wxmlService);
|
|
23582
|
+
const extendedLibManager = createExtendedLibManager();
|
|
23516
23583
|
const loadEntry = createEntryLoader({
|
|
23517
23584
|
ctx,
|
|
23518
23585
|
entriesMap,
|
|
@@ -23522,6 +23589,7 @@ function useLoadEntry(ctx) {
|
|
|
23522
23589
|
scanTemplateEntry,
|
|
23523
23590
|
emitEntriesChunks,
|
|
23524
23591
|
applyAutoImports,
|
|
23592
|
+
extendedLibManager,
|
|
23525
23593
|
debug: debug4
|
|
23526
23594
|
});
|
|
23527
23595
|
return {
|
|
@@ -24626,7 +24694,7 @@ function emitJsonAssets(state) {
|
|
|
24626
24694
|
const { ctx } = state;
|
|
24627
24695
|
const { jsonService } = ctx;
|
|
24628
24696
|
for (const jsonEmitFile of state.jsonEmitFilesMap.values()) {
|
|
24629
|
-
if (jsonEmitFile.entry.json &&
|
|
24697
|
+
if (jsonEmitFile.entry.json && isObject7(jsonEmitFile.entry.json) && !isEmptyObject2(jsonEmitFile.entry.json)) {
|
|
24630
24698
|
const source = jsonService.resolve(jsonEmitFile.entry);
|
|
24631
24699
|
if (source && jsonEmitFile.fileName) {
|
|
24632
24700
|
emitJsonAsset(
|
|
@@ -25144,7 +25212,7 @@ function css(ctx) {
|
|
|
25144
25212
|
|
|
25145
25213
|
// src/plugins/preflight.ts
|
|
25146
25214
|
init_esm_shims();
|
|
25147
|
-
import { isObject as
|
|
25215
|
+
import { isObject as isObject8 } from "@weapp-core/shared";
|
|
25148
25216
|
var debug3 = createDebugger("weapp-vite:preflight");
|
|
25149
25217
|
var removePlugins = ["vite:build-import-analysis"];
|
|
25150
25218
|
function createPluginPruner() {
|
|
@@ -25170,7 +25238,7 @@ function createEnvSynchronizer({ configService }) {
|
|
|
25170
25238
|
name: "weapp-vite:set-env",
|
|
25171
25239
|
enforce: "pre",
|
|
25172
25240
|
configResolved(config) {
|
|
25173
|
-
if (!
|
|
25241
|
+
if (!isObject8(config.env)) {
|
|
25174
25242
|
return;
|
|
25175
25243
|
}
|
|
25176
25244
|
for (const [key, value] of Object.entries(config.env)) {
|
|
@@ -25964,7 +26032,7 @@ function createJsonServicePlugin(ctx) {
|
|
|
25964
26032
|
// src/runtime/npmPlugin.ts
|
|
25965
26033
|
init_esm_shims();
|
|
25966
26034
|
import { isBuiltin } from "module";
|
|
25967
|
-
import { defu as defu6, isObject as
|
|
26035
|
+
import { defu as defu6, isObject as isObject9, objectHash } from "@weapp-core/shared";
|
|
25968
26036
|
import fs21 from "fs-extra";
|
|
25969
26037
|
import path33 from "pathe";
|
|
25970
26038
|
import { build as tsdownBuild } from "tsdown";
|
|
@@ -26008,7 +26076,7 @@ function createNpmService(ctx) {
|
|
|
26008
26076
|
async function checkDependenciesCacheOutdate(root) {
|
|
26009
26077
|
if (ctx.configService?.weappViteConfig?.npm?.cache) {
|
|
26010
26078
|
const json = await readDependenciesCache(root);
|
|
26011
|
-
if (
|
|
26079
|
+
if (isObject9(json)) {
|
|
26012
26080
|
return dependenciesCacheHash() !== json.hash;
|
|
26013
26081
|
}
|
|
26014
26082
|
return true;
|
|
@@ -26046,7 +26114,7 @@ function createNpmService(ctx) {
|
|
|
26046
26114
|
let finalOptions;
|
|
26047
26115
|
if (resolvedOptions === void 0) {
|
|
26048
26116
|
finalOptions = mergedOptions;
|
|
26049
|
-
} else if (
|
|
26117
|
+
} else if (isObject9(resolvedOptions)) {
|
|
26050
26118
|
finalOptions = resolvedOptions;
|
|
26051
26119
|
}
|
|
26052
26120
|
if (finalOptions) {
|
|
@@ -27180,7 +27248,7 @@ function createRuntimeState() {
|
|
|
27180
27248
|
|
|
27181
27249
|
// src/runtime/scanPlugin.ts
|
|
27182
27250
|
init_esm_shims();
|
|
27183
|
-
import { isObject as
|
|
27251
|
+
import { isObject as isObject10, removeExtensionDeep as removeExtensionDeep6 } from "@weapp-core/shared";
|
|
27184
27252
|
import fs23 from "fs-extra";
|
|
27185
27253
|
import path34 from "pathe";
|
|
27186
27254
|
var SUPPORTED_SHARED_STYLE_EXTENSIONS = [
|
|
@@ -27519,7 +27587,7 @@ function createScanService(ctx) {
|
|
|
27519
27587
|
}
|
|
27520
27588
|
if (appEntryPath && appConfigFile) {
|
|
27521
27589
|
const config = await ctx.jsonService.read(appConfigFile);
|
|
27522
|
-
if (
|
|
27590
|
+
if (isObject10(config)) {
|
|
27523
27591
|
const resolvedAppEntry = {
|
|
27524
27592
|
path: appEntryPath,
|
|
27525
27593
|
json: config,
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkGSJZUMRDcjs = require('./chunk-GSJZUMRD.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkFUIUGCNVcjs = require('./chunk-FUIUGCNV.cjs');
|
|
9
9
|
|
|
10
10
|
// src/createContext.ts
|
|
11
|
-
|
|
11
|
+
_chunkFUIUGCNVcjs.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
|
+
_chunkGSJZUMRDcjs.resetCompilerContext.call(void 0, key);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
const ctx =
|
|
17
|
+
_chunkGSJZUMRDcjs.setActiveCompilerContextKey.call(void 0, key);
|
|
18
|
+
const ctx = _chunkGSJZUMRDcjs.getCompilerContext.call(void 0, key);
|
|
19
19
|
const { configService, scanService, autoRoutesService } = ctx;
|
|
20
20
|
await configService.load(options);
|
|
21
21
|
if (autoRoutesService) {
|