weapp-vite 6.10.0 → 6.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as getCompilerContext } from "./createContext-
|
|
1
|
+
import { n as getCompilerContext } from "./createContext-Dzy3vlIP.mjs";
|
|
2
2
|
import "./logger-gutcwWKE.mjs";
|
|
3
|
-
import "./file-
|
|
3
|
+
import "./file-DLpJ9tlX.mjs";
|
|
4
4
|
//#region src/auto-routes.ts
|
|
5
5
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
6
6
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as DEFAULT_MP_PLATFORM, c as createSharedBuildConfig, d as checkRuntime, f as getProjectConfigFileName, i as formatBytes, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as isPathInside, o as normalizeMiniPlatform, p as createCjsConfigLoadError, s as resolveMiniPlatform, t as createCompilerContext, u as resolveWeappConfigFile } from "./createContext-
|
|
1
|
+
import { a as DEFAULT_MP_PLATFORM, c as createSharedBuildConfig, d as checkRuntime, f as getProjectConfigFileName, i as formatBytes, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as isPathInside, o as normalizeMiniPlatform, p as createCjsConfigLoadError, s as resolveMiniPlatform, t as createCompilerContext, u as resolveWeappConfigFile } from "./createContext-Dzy3vlIP.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-gutcwWKE.mjs";
|
|
3
|
-
import { f as VERSION } from "./file-
|
|
3
|
+
import { f as VERSION } from "./file-DLpJ9tlX.mjs";
|
|
4
4
|
import { resolveWeappMcpConfig, startWeappViteMcpServer } from "./mcp.mjs";
|
|
5
5
|
import { defu } from "@weapp-core/shared";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
|
|
2
2
|
import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
|
|
3
3
|
import { n as configureLogger, r as logger_default } from "./logger-gutcwWKE.mjs";
|
|
4
|
-
import { _ as vueExtensions, a as findJsEntry, c as findVueEntry, d as touch, g as templateExtensions, h as supportedCssLangs, i as findCssEntry, l as isJsOrTs, m as jsExtensions, n as extractConfigFromVue, o as findJsonEntry, p as configExtensions, s as findTemplateEntry, t as changeFileExtension, u as isTemplate } from "./file-
|
|
4
|
+
import { _ as vueExtensions, a as findJsEntry, c as findVueEntry, d as touch, g as templateExtensions, h as supportedCssLangs, i as findCssEntry, l as isJsOrTs, m as jsExtensions, n as extractConfigFromVue, o as findJsonEntry, p as configExtensions, s as findTemplateEntry, t as changeFileExtension, u as isTemplate } from "./file-DLpJ9tlX.mjs";
|
|
5
5
|
import { createRequire, isBuiltin } from "node:module";
|
|
6
6
|
import { addExtension, defu, get, isEmptyObject, isObject, objectHash, removeExtension, removeExtensionDeep, set } from "@weapp-core/shared";
|
|
7
7
|
import { LRUCache } from "lru-cache";
|
|
@@ -9382,9 +9382,9 @@ function prepareNormalizedEntries(options) {
|
|
|
9382
9382
|
return normalizedEntries;
|
|
9383
9383
|
}
|
|
9384
9384
|
async function emitEntryOutput(options) {
|
|
9385
|
-
const { pluginCtx, id, type, json, jsonPath, isPluginBuild, normalizedEntries, pluginResolvedRecords, pluginJsonPathForRegistration, pluginJsonForRegistration, resolveEntriesWithCache, configService, resolvedEntryMap, loadedEntrySet, dirtyEntrySet, emitEntriesChunks, registerJsonAsset, existsCache, pathExistsTtlMs, debug, relativeCwdId, getTime } = options;
|
|
9385
|
+
const { pluginCtx, id, type, json, jsonPath, isPluginBuild, normalizedEntries, pluginResolvedRecords, pluginJsonPathForRegistration, pluginJsonForRegistration, resolveEntriesWithCache, entryResolveRoot, configService, resolvedEntryMap, loadedEntrySet, dirtyEntrySet, emitEntriesChunks, registerJsonAsset, existsCache, pathExistsTtlMs, debug, relativeCwdId, getTime } = options;
|
|
9386
9386
|
const shouldSkipEntries = Boolean(options.skipEntries);
|
|
9387
|
-
const resolvedIds = shouldSkipEntries ? [] : normalizedEntries.length ? await resolveEntriesWithCache(pluginCtx, normalizedEntries,
|
|
9387
|
+
const resolvedIds = shouldSkipEntries ? [] : normalizedEntries.length ? await resolveEntriesWithCache(pluginCtx, normalizedEntries, entryResolveRoot) : [];
|
|
9388
9388
|
debug?.(`resolvedIds ${relativeCwdId} 耗时 ${getTime()}`);
|
|
9389
9389
|
const pendingResolvedIds = [];
|
|
9390
9390
|
const combinedResolved = shouldSkipEntries ? [] : pluginResolvedRecords ? isPluginBuild ? pluginResolvedRecords : [...resolvedIds, ...pluginResolvedRecords] : resolvedIds;
|
|
@@ -9684,6 +9684,7 @@ function createEntryLoader(options) {
|
|
|
9684
9684
|
extendedLibManager,
|
|
9685
9685
|
entryType: entryTypeOverride
|
|
9686
9686
|
});
|
|
9687
|
+
const entryResolveRoot = isPluginBuild && configService.absolutePluginRoot && isPathInside(configService.absolutePluginRoot, id) ? configService.absolutePluginRoot : configService.absoluteSrcRoot;
|
|
9687
9688
|
const result = await emitEntryOutput({
|
|
9688
9689
|
pluginCtx: this,
|
|
9689
9690
|
id,
|
|
@@ -9696,6 +9697,7 @@ function createEntryLoader(options) {
|
|
|
9696
9697
|
pluginJsonPathForRegistration,
|
|
9697
9698
|
pluginJsonForRegistration,
|
|
9698
9699
|
resolveEntriesWithCache: entryResolver.resolveEntriesWithCache,
|
|
9700
|
+
entryResolveRoot,
|
|
9699
9701
|
configService,
|
|
9700
9702
|
resolvedEntryMap,
|
|
9701
9703
|
loadedEntrySet,
|
|
@@ -9773,6 +9775,7 @@ function useLoadEntry(ctx, options) {
|
|
|
9773
9775
|
const entriesMap = /* @__PURE__ */ new Map();
|
|
9774
9776
|
const loadedEntrySet = /* @__PURE__ */ new Set();
|
|
9775
9777
|
const dirtyEntrySet = /* @__PURE__ */ new Set();
|
|
9778
|
+
const dirtyEntryReasons = /* @__PURE__ */ new Map();
|
|
9776
9779
|
const resolvedEntryMap = /* @__PURE__ */ new Map();
|
|
9777
9780
|
const jsonEmitManager = createJsonEmitManager(ctx.configService);
|
|
9778
9781
|
const registerJsonAsset = jsonEmitManager.register.bind(jsonEmitManager);
|
|
@@ -9804,59 +9807,64 @@ function useLoadEntry(ctx, options) {
|
|
|
9804
9807
|
resolvedEntryMap,
|
|
9805
9808
|
jsonEmitFilesMap: jsonEmitManager.map,
|
|
9806
9809
|
normalizeEntry,
|
|
9807
|
-
markEntryDirty(entryId) {
|
|
9810
|
+
markEntryDirty(entryId, reason = "direct") {
|
|
9808
9811
|
dirtyEntrySet.add(entryId);
|
|
9812
|
+
dirtyEntryReasons.set(entryId, reason);
|
|
9809
9813
|
loadedEntrySet.delete(entryId);
|
|
9810
9814
|
},
|
|
9811
9815
|
async emitDirtyEntries() {
|
|
9812
9816
|
if (!dirtyEntrySet.size) {
|
|
9813
9817
|
options?.hmr?.setDidEmitAllEntries?.(false);
|
|
9818
|
+
options?.hmr?.setLastEmittedEntries?.(/* @__PURE__ */ new Set());
|
|
9814
9819
|
return;
|
|
9815
9820
|
}
|
|
9816
9821
|
const dirtyCount = dirtyEntrySet.size;
|
|
9817
|
-
const
|
|
9818
|
-
const shouldEmitAllEntries = resolveShouldEmitAllEntries({
|
|
9822
|
+
const pendingEntryIds = resolvePendingEntryIds({
|
|
9819
9823
|
isDev: Boolean(ctx.configService?.isDev),
|
|
9820
9824
|
mode: hmrSharedChunksMode,
|
|
9821
|
-
dirtyEntrySet,
|
|
9822
9825
|
resolvedEntryMap,
|
|
9826
|
+
dirtyEntrySet,
|
|
9827
|
+
dirtyEntryReasons,
|
|
9823
9828
|
sharedChunkImporters: hmrSharedChunkImporters
|
|
9824
9829
|
});
|
|
9830
|
+
const pending = [];
|
|
9831
|
+
const shouldEmitAllEntries = pendingEntryIds.size > 0 && pendingEntryIds.size === resolvedEntryMap.size;
|
|
9825
9832
|
options?.hmr?.setDidEmitAllEntries?.(shouldEmitAllEntries);
|
|
9826
|
-
|
|
9827
|
-
|
|
9828
|
-
for (const resolvedId of resolvedEntryMap.values()) {
|
|
9829
|
-
if (!resolvedId) continue;
|
|
9830
|
-
const key = resolvedId.id;
|
|
9831
|
-
if (seen.has(key)) continue;
|
|
9832
|
-
seen.add(key);
|
|
9833
|
-
pending.push(resolvedId);
|
|
9834
|
-
}
|
|
9835
|
-
dirtyEntrySet.clear();
|
|
9836
|
-
} else for (const entryId of Array.from(dirtyEntrySet)) {
|
|
9833
|
+
options?.hmr?.setLastEmittedEntries?.(new Set(pendingEntryIds));
|
|
9834
|
+
for (const entryId of pendingEntryIds) {
|
|
9837
9835
|
const resolvedId = resolvedEntryMap.get(entryId);
|
|
9838
9836
|
if (!resolvedId) continue;
|
|
9839
9837
|
pending.push(resolvedId);
|
|
9840
9838
|
dirtyEntrySet.delete(entryId);
|
|
9839
|
+
dirtyEntryReasons.delete(entryId);
|
|
9841
9840
|
}
|
|
9842
9841
|
if (debug) debug(`hmr emit dirty=${dirtyCount} resolved=${resolvedEntryMap.size} emitAll=${shouldEmitAllEntries} pending=${pending.length}`);
|
|
9843
9842
|
if (pending.length) await Promise.all(emitEntriesChunks.call(this, pending));
|
|
9844
9843
|
}
|
|
9845
9844
|
};
|
|
9846
9845
|
}
|
|
9847
|
-
function
|
|
9848
|
-
|
|
9849
|
-
if (options.mode === "full") return
|
|
9850
|
-
if (options.mode === "off") return
|
|
9851
|
-
|
|
9852
|
-
if (options.
|
|
9846
|
+
function resolvePendingEntryIds(options) {
|
|
9847
|
+
const pending = new Set(options.dirtyEntrySet);
|
|
9848
|
+
if (options.mode === "full") return new Set(options.resolvedEntryMap.keys());
|
|
9849
|
+
if (!options.isDev || options.mode === "off") return pending;
|
|
9850
|
+
let hasDependencyDrivenEntry = false;
|
|
9851
|
+
for (const entryId of options.dirtyEntrySet) if (options.dirtyEntryReasons.get(entryId) === "dependency") {
|
|
9852
|
+
hasDependencyDrivenEntry = true;
|
|
9853
|
+
break;
|
|
9854
|
+
}
|
|
9855
|
+
if (!hasDependencyDrivenEntry) return pending;
|
|
9856
|
+
if (!options.sharedChunkImporters?.size) return pending;
|
|
9853
9857
|
for (const importers of options.sharedChunkImporters.values()) {
|
|
9854
9858
|
if (importers.size <= 1) continue;
|
|
9855
|
-
let
|
|
9856
|
-
for (const importer of importers) if (options.dirtyEntrySet.has(importer))
|
|
9857
|
-
|
|
9859
|
+
let hasDependencyDrivenImporter = false;
|
|
9860
|
+
for (const importer of importers) if (options.dirtyEntrySet.has(importer) && options.dirtyEntryReasons.get(importer) === "dependency") {
|
|
9861
|
+
hasDependencyDrivenImporter = true;
|
|
9862
|
+
break;
|
|
9863
|
+
}
|
|
9864
|
+
if (!hasDependencyDrivenImporter) continue;
|
|
9865
|
+
for (const importer of importers) pending.add(importer);
|
|
9858
9866
|
}
|
|
9859
|
-
return
|
|
9867
|
+
return pending;
|
|
9860
9868
|
}
|
|
9861
9869
|
//#endregion
|
|
9862
9870
|
//#region src/utils/wxmlScriptModule.ts
|
|
@@ -10256,6 +10264,17 @@ function refreshModuleGraph(pluginCtx, state) {
|
|
|
10256
10264
|
}
|
|
10257
10265
|
function refreshSharedChunkImporters(bundle, state) {
|
|
10258
10266
|
state.hmrSharedChunkImporters.clear();
|
|
10267
|
+
appendSharedChunkImporters(bundle, state);
|
|
10268
|
+
}
|
|
10269
|
+
function refreshPartialSharedChunkImporters(bundle, state, entryIds) {
|
|
10270
|
+
if (!entryIds.size) return;
|
|
10271
|
+
for (const [chunkId, importers] of state.hmrSharedChunkImporters) {
|
|
10272
|
+
for (const entryId of entryIds) importers.delete(entryId);
|
|
10273
|
+
if (importers.size === 0) state.hmrSharedChunkImporters.delete(chunkId);
|
|
10274
|
+
}
|
|
10275
|
+
appendSharedChunkImporters(bundle, state, entryIds);
|
|
10276
|
+
}
|
|
10277
|
+
function appendSharedChunkImporters(bundle, state, onlyEntryIds) {
|
|
10259
10278
|
const isEntryChunk = (chunk) => {
|
|
10260
10279
|
if (chunk.isEntry) return true;
|
|
10261
10280
|
if (!chunk.facadeModuleId) return false;
|
|
@@ -10269,6 +10288,7 @@ function refreshSharedChunkImporters(bundle, state) {
|
|
|
10269
10288
|
if (!chunk.facadeModuleId) continue;
|
|
10270
10289
|
if (!isEntryChunk(chunk)) continue;
|
|
10271
10290
|
const entryId = normalizeFsResolvedId(chunk.facadeModuleId);
|
|
10291
|
+
if (onlyEntryIds && !onlyEntryIds.has(entryId)) continue;
|
|
10272
10292
|
entryChunks.push({
|
|
10273
10293
|
entryId,
|
|
10274
10294
|
chunk
|
|
@@ -10597,6 +10617,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
10597
10617
|
let redundantBytesTotal = 0;
|
|
10598
10618
|
if (configService.isDev && state.hmrSharedChunksMode === "auto") {
|
|
10599
10619
|
if (state.hmrState.didEmitAllEntries || !state.hmrState.hasBuiltOnce) refreshSharedChunkImporters(rolldownBundle, state);
|
|
10620
|
+
else if (state.hmrState.lastEmittedEntryIds?.size) refreshPartialSharedChunkImporters(rolldownBundle, state, state.hmrState.lastEmittedEntryIds);
|
|
10600
10621
|
state.hmrState.hasBuiltOnce = true;
|
|
10601
10622
|
}
|
|
10602
10623
|
function matchSubPackage(filePath) {
|
|
@@ -11639,13 +11660,13 @@ function createWatchChangeHook(state) {
|
|
|
11639
11660
|
const ext = path.extname(normalizedId);
|
|
11640
11661
|
return ext ? normalizedId.slice(0, -ext.length) : normalizedId;
|
|
11641
11662
|
})());
|
|
11642
|
-
if (primaryScript.path) markEntryDirty(normalizeFsResolvedId(primaryScript.path));
|
|
11663
|
+
if (primaryScript.path) markEntryDirty(normalizeFsResolvedId(primaryScript.path), "direct");
|
|
11643
11664
|
}
|
|
11644
11665
|
}
|
|
11645
|
-
if (loadedEntrySet.has(normalizedId)) markEntryDirty(normalizedId);
|
|
11666
|
+
if (loadedEntrySet.has(normalizedId)) markEntryDirty(normalizedId, "direct");
|
|
11646
11667
|
else if (state.moduleImporters.size && state.entryModuleIds.size) {
|
|
11647
11668
|
const affected = collectAffectedEntries(state, normalizedId);
|
|
11648
|
-
if (affected.size) for (const entryId of affected) markEntryDirty(entryId);
|
|
11669
|
+
if (affected.size) for (const entryId of affected) markEntryDirty(entryId, "dependency");
|
|
11649
11670
|
}
|
|
11650
11671
|
const relativeSrc = configService.relativeAbsoluteSrcRoot(normalizedId);
|
|
11651
11672
|
const relativeCwd = configService.relativeCwd(normalizedId);
|
|
@@ -11769,7 +11790,8 @@ function weappVite(ctx, subPackageMeta) {
|
|
|
11769
11790
|
const hmrSharedChunkImporters = /* @__PURE__ */ new Map();
|
|
11770
11791
|
const hmrState = {
|
|
11771
11792
|
didEmitAllEntries: false,
|
|
11772
|
-
hasBuiltOnce: false
|
|
11793
|
+
hasBuiltOnce: false,
|
|
11794
|
+
lastEmittedEntryIds: /* @__PURE__ */ new Set()
|
|
11773
11795
|
};
|
|
11774
11796
|
const { loadEntry, loadedEntrySet, jsonEmitFilesMap, entriesMap, resolvedEntryMap, markEntryDirty, emitDirtyEntries } = useLoadEntry(ctx, {
|
|
11775
11797
|
buildTarget,
|
|
@@ -11778,6 +11800,9 @@ function weappVite(ctx, subPackageMeta) {
|
|
|
11778
11800
|
sharedChunkImporters: hmrSharedChunkImporters,
|
|
11779
11801
|
setDidEmitAllEntries: (value) => {
|
|
11780
11802
|
hmrState.didEmitAllEntries = value;
|
|
11803
|
+
},
|
|
11804
|
+
setLastEmittedEntries: (entryIds) => {
|
|
11805
|
+
hmrState.lastEmittedEntryIds = new Set(entryIds);
|
|
11781
11806
|
}
|
|
11782
11807
|
}
|
|
11783
11808
|
});
|
|
@@ -15848,7 +15873,7 @@ function createScanService(ctx) {
|
|
|
15848
15873
|
let vueAppPath;
|
|
15849
15874
|
if (!appEntryPath) vueAppPath = await findVueEntry(appBasename);
|
|
15850
15875
|
if (!appConfigFile && vueAppPath) {
|
|
15851
|
-
const { extractConfigFromVue } = await import("./file-
|
|
15876
|
+
const { extractConfigFromVue } = await import("./file-DLpJ9tlX.mjs").then((n) => n.r);
|
|
15852
15877
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
15853
15878
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
15854
15879
|
}
|
|
@@ -78,7 +78,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
78
78
|
}
|
|
79
79
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
80
80
|
try {
|
|
81
|
-
const { getCompilerContext } = await import("./createContext-
|
|
81
|
+
const { getCompilerContext } = await import("./createContext-Dzy3vlIP.mjs").then((n) => n.r);
|
|
82
82
|
const compilerContext = getCompilerContext();
|
|
83
83
|
const service = compilerContext.autoRoutesService;
|
|
84
84
|
const reference = service?.getReference?.();
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson } from "./json.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
|
|
3
3
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import { t as createCompilerContext } from "./createContext-
|
|
4
|
+
import { t as createCompilerContext } from "./createContext-Dzy3vlIP.mjs";
|
|
5
5
|
import "./logger-gutcwWKE.mjs";
|
|
6
|
-
import "./file-
|
|
6
|
+
import "./file-DLpJ9tlX.mjs";
|
|
7
7
|
import { defineEmits, defineProps } from "./runtime.mjs";
|
|
8
8
|
import { createWevuComponent } from "wevu";
|
|
9
9
|
export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.10.
|
|
4
|
+
"version": "6.10.2",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"@weapp-core/logger": "3.1.1",
|
|
118
118
|
"@weapp-core/schematics": "6.0.4",
|
|
119
119
|
"@weapp-core/shared": "3.0.2",
|
|
120
|
-
"@weapp-vite/ast": "6.10.
|
|
120
|
+
"@weapp-vite/ast": "6.10.2",
|
|
121
121
|
"@weapp-vite/mcp": "1.1.1",
|
|
122
122
|
"@weapp-vite/volar": "2.0.7",
|
|
123
123
|
"@weapp-vite/web": "1.3.5",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"rolldown-require": "2.0.8",
|
|
126
126
|
"vite-plugin-performance": "2.0.1",
|
|
127
127
|
"weapp-ide-cli": "5.1.1",
|
|
128
|
-
"wevu": "6.10.
|
|
128
|
+
"wevu": "6.10.2"
|
|
129
129
|
},
|
|
130
130
|
"publishConfig": {
|
|
131
131
|
"access": "public",
|