weapp-vite 6.16.12 → 6.16.14
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 +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/{createContext-ZO_662XD.mjs → createContext-CzGWJpCw.mjs} +212 -37
- package/dist/file-35pjSeN9.mjs +2 -0
- package/dist/{file-C4fZvkCN.mjs → file-HUd9lLNU.mjs} +1 -1
- package/dist/getInstance-DD6NsV2F.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/package.json +8 -8
- package/dist/file-B0TT5uIp.mjs +0 -2
- package/dist/getInstance-RLgRsNLD.mjs +0 -2
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-
|
|
1
|
+
import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-CzGWJpCw.mjs";
|
|
2
2
|
//#region src/auto-routes.ts
|
|
3
3
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
4
4
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as getDefaultIdeProjectRoot, S as createCjsConfigLoadError, T as isPathInside, _ as resolveWeappConfigFile, b as loadViteConfigFile, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as checkRuntime, w as shouldPassPlatformArgToIdeOpen, x as parseCommentJson, y as getProjectConfigFileName } from "./createContext-
|
|
1
|
+
import { C as getDefaultIdeProjectRoot, S as createCjsConfigLoadError, T as isPathInside, _ as resolveWeappConfigFile, b as loadViteConfigFile, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as checkRuntime, w as shouldPassPlatformArgToIdeOpen, x as parseCommentJson, y as getProjectConfigFileName } from "./createContext-CzGWJpCw.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
|
|
3
|
-
import { h as VERSION } from "./file-
|
|
3
|
+
import { h as VERSION } from "./file-HUd9lLNU.mjs";
|
|
4
4
|
import { o as resolveWeappMcpConfig, s as startWeappViteMcpServer } from "./mcp-DV3K2AVD.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -3704,7 +3704,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
3704
3704
|
}
|
|
3705
3705
|
//#endregion
|
|
3706
3706
|
//#region package.json
|
|
3707
|
-
var version = "6.16.
|
|
3707
|
+
var version = "6.16.14";
|
|
3708
3708
|
//#endregion
|
|
3709
3709
|
//#region src/cli/devHotkeys/format.ts
|
|
3710
3710
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as applyWeappViteHostMeta } from "./pluginHost-BEnGeaSo.mjs";
|
|
2
2
|
import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.mjs";
|
|
3
|
-
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-
|
|
3
|
+
import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-HUd9lLNU.mjs";
|
|
4
4
|
import { createRequire, isBuiltin } from "node:module";
|
|
5
5
|
import path, { posix } from "pathe";
|
|
6
6
|
import path$1, { normalize, relative, win32 } from "node:path";
|
|
@@ -9,7 +9,7 @@ import { fs } from "@weapp-core/shared/fs";
|
|
|
9
9
|
import { collectComponentPropsFromCode, collectRequireTokens, collectScriptSetupImportsFromCode, mayContainPlatformApiAccess, mayContainStaticRequireLiteral, parseJsLikeWithEngine, platformApiIdentifiers } from "@weapp-vite/ast";
|
|
10
10
|
import { collectOnPageScrollPerformanceWarnings } from "@weapp-vite/ast/operations/onPageScroll";
|
|
11
11
|
import { collectSetDataPickKeysFromTemplateCode } from "@weapp-vite/ast/operations/setDataPick";
|
|
12
|
-
import createDebug from "
|
|
12
|
+
import { createDebug } from "obug";
|
|
13
13
|
import fs$1, { existsSync, readFileSync } from "node:fs";
|
|
14
14
|
import { parse } from "vue/compiler-sfc";
|
|
15
15
|
import { BABEL_TS_MODULE_PARSER_OPTIONS, generate, getVisitorKeys, parse as parse$2, parseJsLike, traverse } from "@weapp-vite/ast/babel";
|
|
@@ -34,7 +34,7 @@ import { getPackageInfo, getPackageInfoSync, resolveModule } from "local-pkg";
|
|
|
34
34
|
import { spawn } from "node:child_process";
|
|
35
35
|
import * as t from "@weapp-vite/ast/babelTypes";
|
|
36
36
|
import { objectHash } from "@weapp-core/shared/node";
|
|
37
|
-
import { APP_PRELUDE_CHUNK_MARKER, APP_PRELUDE_GUARD_KEY, APP_PRELUDE_REQUIRE_MARKER, REQUEST_GLOBAL_ACTUALS_KEY, REQUEST_GLOBAL_BUNDLE_HOST_REF, REQUEST_GLOBAL_BUNDLE_MARKER, REQUEST_GLOBAL_CHUNK_HOST_REF, REQUEST_GLOBAL_CHUNK_MODULE_REF, REQUEST_GLOBAL_EXPOSE_HELPER, REQUEST_GLOBAL_INSTALLER_HOST_REF, REQUEST_GLOBAL_LAZY_CONSTRUCTOR_HELPER, REQUEST_GLOBAL_LAZY_FUNCTION_HELPER, REQUEST_GLOBAL_LOCAL_BINDINGS_MARKER, REQUEST_GLOBAL_MARK_PLACEHOLDER_HELPER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER as REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER$1, REQUEST_GLOBAL_PLACEHOLDER_KEY, REQUEST_GLOBAL_PRELUDE_GUARD_KEY, REQUEST_GLOBAL_PRELUDE_MARKER, REQUEST_GLOBAL_SYNTHETIC_EXPORT_NAME, REQUEST_GLOBAL_USABLE_CONSTRUCTOR_HELPER, WEAPP_VITE_IMPORT_META_ENV_KEY, WEAPP_VITE_INJECTED_API_IDENTIFIER, WEVU_APP_SHELL_COMPONENT_BASE, WEVU_APP_SHELL_TAG_NAME, WEVU_EXPRESSION_ERROR_IDENTIFIER, WEVU_INTERNAL_KEY_IDENTIFIER, WEVU_LAYOUT_BIND_PREFIX, WEVU_PAGE_LAYOUT_CURRENT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_CURRENT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_NEXT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_NEXT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NONE, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY,
|
|
37
|
+
import { APP_PRELUDE_CHUNK_MARKER, APP_PRELUDE_GUARD_KEY, APP_PRELUDE_REQUIRE_MARKER, REQUEST_GLOBAL_ACTUALS_KEY, REQUEST_GLOBAL_BUNDLE_HOST_REF, REQUEST_GLOBAL_BUNDLE_MARKER, REQUEST_GLOBAL_CHUNK_HOST_REF, REQUEST_GLOBAL_CHUNK_MODULE_REF, REQUEST_GLOBAL_EXPOSE_HELPER, REQUEST_GLOBAL_INSTALLER_HOST_REF, REQUEST_GLOBAL_LAZY_CONSTRUCTOR_HELPER, REQUEST_GLOBAL_LAZY_FUNCTION_HELPER, REQUEST_GLOBAL_LOCAL_BINDINGS_MARKER, REQUEST_GLOBAL_MARK_PLACEHOLDER_HELPER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER, REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER as REQUEST_GLOBAL_PASSIVE_BINDINGS_MARKER$1, REQUEST_GLOBAL_PLACEHOLDER_KEY, REQUEST_GLOBAL_PRELUDE_GUARD_KEY, REQUEST_GLOBAL_PRELUDE_MARKER, REQUEST_GLOBAL_SYNTHETIC_EXPORT_NAME, REQUEST_GLOBAL_USABLE_CONSTRUCTOR_HELPER, WEAPP_VITE_IMPORT_META_ENV_KEY, WEAPP_VITE_INJECTED_API_IDENTIFIER, WEVU_APP_SHELL_COMPONENT_BASE, WEVU_APP_SHELL_TAG_NAME, WEVU_EXPRESSION_ERROR_IDENTIFIER, WEVU_INTERNAL_KEY_IDENTIFIER, WEVU_LAYOUT_BIND_PREFIX, WEVU_PAGE_LAYOUT_CURRENT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_CURRENT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NAME_KEY, WEVU_PAGE_LAYOUT_NEXT_NAME_IDENTIFIER, WEVU_PAGE_LAYOUT_NEXT_PROPS_IDENTIFIER, WEVU_PAGE_LAYOUT_NONE, WEVU_PAGE_LAYOUT_PROPS_KEY, WEVU_PAGE_LAYOUT_SETTER_KEY, WEVU_SCOPED_SLOT_CREATOR_KEY, WEVU_SLOT_OWNER_ID_ATTR, WEVU_SLOT_OWNER_ID_PROP, WEVU_SLOT_PROPS_ATTR, WEVU_SLOT_SCOPE_ATTR, WEVU_SLOT_SCOPE_KEY } from "@weapp-core/constants";
|
|
38
38
|
import { Buffer } from "node:buffer";
|
|
39
39
|
import { detect } from "package-manager-detector/detect";
|
|
40
40
|
import tsconfigPaths from "vite-tsconfig-paths";
|
|
@@ -8760,11 +8760,11 @@ const sharedChunkDiagnostics = /* @__PURE__ */ new Map();
|
|
|
8760
8760
|
const takeImportersMap = /* @__PURE__ */ new Map();
|
|
8761
8761
|
const forceDuplicateSharedChunks = /* @__PURE__ */ new Set();
|
|
8762
8762
|
const sharedChunkNameCache = /* @__PURE__ */ new Map();
|
|
8763
|
-
function resetTakeImportRegistry() {
|
|
8763
|
+
function resetTakeImportRegistry(options = {}) {
|
|
8764
8764
|
takeImportersMap.clear();
|
|
8765
8765
|
forceDuplicateSharedChunks.clear();
|
|
8766
8766
|
sharedChunkDiagnostics.clear();
|
|
8767
|
-
sharedChunkNameCache.clear();
|
|
8767
|
+
if (!options.preserveSharedChunkNameCache) sharedChunkNameCache.clear();
|
|
8768
8768
|
}
|
|
8769
8769
|
function getTakeImporters(moduleId) {
|
|
8770
8770
|
return takeImportersMap.get(moduleId);
|
|
@@ -9788,6 +9788,7 @@ const REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
|
9788
9788
|
const REG_COMMONJS_HELPERS = /commonjsHelpers\.js$/;
|
|
9789
9789
|
const REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID = /(?:^|[/\\])(?:@wevu[/\\]web-apis|web-apis[/\\]dist[/\\]index\.(?:m?js|cjs)|weapp-vite[/\\](?:dist[/\\]web-apis\.mjs|src[/\\](?:webApis\.ts|runtime[/\\]webApis[/\\]index\.ts)))(?:$|[?#])/;
|
|
9790
9790
|
const REG_HASHED_DIST_CHUNK_ID = /(?:^|[/\\])dist[/\\]([^/\\]+)-(\w{6,})\.(?:m?js|cjs)(?:$|[?#])/;
|
|
9791
|
+
const STABLE_HASHED_DIST_CHUNK_PRIORITY = ["src"];
|
|
9791
9792
|
function resolveSharedPathRoot(configService, sharedPathRoot) {
|
|
9792
9793
|
const absoluteSrcRoot = configService.absoluteSrcRoot;
|
|
9793
9794
|
const configuredRoot = sharedPathRoot ? path.resolve(configService.cwd, sharedPathRoot) : absoluteSrcRoot;
|
|
@@ -9898,6 +9899,7 @@ function isRequestGlobalsRuntimeModuleId(id) {
|
|
|
9898
9899
|
}
|
|
9899
9900
|
function resolveStableHashedDistChunkFileName(chunk) {
|
|
9900
9901
|
const candidateIds = [chunk.facadeModuleId, ...chunk.moduleIds ?? []].filter((id) => typeof id === "string");
|
|
9902
|
+
const matchedChunks = [];
|
|
9901
9903
|
for (const id of candidateIds) {
|
|
9902
9904
|
const cleanedAbsoluteId = normalizeSharedPathCandidate(id);
|
|
9903
9905
|
if (!path.isAbsolute(cleanedAbsoluteId)) continue;
|
|
@@ -9908,8 +9910,22 @@ function resolveStableHashedDistChunkFileName(chunk) {
|
|
|
9908
9910
|
if (!baseName || !packageToken) continue;
|
|
9909
9911
|
REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.lastIndex = 0;
|
|
9910
9912
|
if (REG_REQUEST_GLOBAL_RUNTIME_VENDOR_ID.test(cleanedAbsoluteId) || packageToken.endsWith("web-apis")) return `weapp-vendors/request-globals-${packageToken}-${baseName}.js`;
|
|
9911
|
-
|
|
9913
|
+
matchedChunks.push({
|
|
9914
|
+
baseName,
|
|
9915
|
+
fileName: `weapp-vendors/${packageToken}-${baseName}.js`
|
|
9916
|
+
});
|
|
9912
9917
|
}
|
|
9918
|
+
for (const priorityBaseName of STABLE_HASHED_DIST_CHUNK_PRIORITY) {
|
|
9919
|
+
const matched = matchedChunks.find((chunk) => chunk.baseName === priorityBaseName);
|
|
9920
|
+
if (matched) return matched.fileName;
|
|
9921
|
+
}
|
|
9922
|
+
if (matchedChunks[0]) return matchedChunks[0].fileName;
|
|
9923
|
+
}
|
|
9924
|
+
function resolveStableHashedDistChunkName(chunk) {
|
|
9925
|
+
return resolveStableHashedDistChunkFileName(chunk)?.replace(/\.js$/, "");
|
|
9926
|
+
}
|
|
9927
|
+
function isStableHashedDistChunkModule(id) {
|
|
9928
|
+
return Boolean(resolveStableHashedDistChunkName({ facadeModuleId: id }));
|
|
9913
9929
|
}
|
|
9914
9930
|
function createSharedBuildResolver(configService, getSubPackageRoots) {
|
|
9915
9931
|
const nodeModulesDeps = [REG_NODE_MODULES_DIR];
|
|
@@ -9930,6 +9946,10 @@ function createSharedBuildResolver(configService, getSubPackageRoots) {
|
|
|
9930
9946
|
});
|
|
9931
9947
|
const resolveSharedBuildChunkName = (id, ctx) => {
|
|
9932
9948
|
if (isRequestGlobalsRuntimeModuleId(id)) return REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME.replace(/\.js$/, "");
|
|
9949
|
+
if (configService.isDev) {
|
|
9950
|
+
const stableHashedDistChunkName = resolveStableHashedDistChunkName({ facadeModuleId: id });
|
|
9951
|
+
if (stableHashedDistChunkName) return stableHashedDistChunkName;
|
|
9952
|
+
}
|
|
9933
9953
|
return resolveAdvancedChunkName(id, ctx);
|
|
9934
9954
|
};
|
|
9935
9955
|
return { resolveAdvancedChunkName: resolveSharedBuildChunkName };
|
|
@@ -9937,7 +9957,13 @@ function createSharedBuildResolver(configService, getSubPackageRoots) {
|
|
|
9937
9957
|
function createSharedBuildOutput(configService, getSubPackageRoots) {
|
|
9938
9958
|
const { resolveAdvancedChunkName } = createSharedBuildResolver(configService, getSubPackageRoots);
|
|
9939
9959
|
return {
|
|
9940
|
-
codeSplitting: { groups: [
|
|
9960
|
+
codeSplitting: { groups: [...configService.isDev ? [{
|
|
9961
|
+
test: isStableHashedDistChunkModule,
|
|
9962
|
+
minShareCount: 1,
|
|
9963
|
+
minSize: 0,
|
|
9964
|
+
minModuleSize: 0,
|
|
9965
|
+
name: (id) => resolveStableHashedDistChunkName({ facadeModuleId: id })
|
|
9966
|
+
}] : [], { name: (id, ctx) => resolveAdvancedChunkName(id, ctx) }] },
|
|
9941
9967
|
minifyInternalExports: false,
|
|
9942
9968
|
chunkFileNames: (chunk) => {
|
|
9943
9969
|
if (isRequestGlobalsRuntimeChunk(chunk)) return REQUEST_GLOBAL_RUNTIME_CHUNK_FILE_BASENAME;
|
|
@@ -13143,7 +13169,7 @@ function withScopedSlotComponentGenerics(ctx, fileName, buffer) {
|
|
|
13143
13169
|
return Buffer.from(normalized ?? JSON.stringify(parsed, null, 2));
|
|
13144
13170
|
}
|
|
13145
13171
|
function createScopedSlotGenericTag(key) {
|
|
13146
|
-
return `<${key} wx:if="{{${WEVU_SLOT_OWNER_ID_PROP}}}" ${
|
|
13172
|
+
return `<${key} wx:if="{{${WEVU_SLOT_OWNER_ID_PROP}}}" ${WEVU_SLOT_OWNER_ID_ATTR}="{{${WEVU_SLOT_OWNER_ID_PROP}}}" ${WEVU_SLOT_PROPS_ATTR}="{{[]}}" ${WEVU_SLOT_SCOPE_ATTR}="{{${WEVU_SLOT_SCOPE_KEY}}}" />`;
|
|
13147
13173
|
}
|
|
13148
13174
|
function createSlotPatchPattern(key) {
|
|
13149
13175
|
const slotName = key.replace(/^scoped-slots-/, "");
|
|
@@ -15744,7 +15770,7 @@ function resolvePendingEntryIds(options) {
|
|
|
15744
15770
|
const shouldExpandLayoutSharedChunks = pendingReasonSummary.includes("layout-propagation") || pendingReasonSummary.includes("layout-fallback-full");
|
|
15745
15771
|
if (shouldExpandLayoutSharedChunks) for (const chunkId of options.sharedChunkImporters.keys()) relatedChunkIds.add(chunkId);
|
|
15746
15772
|
for (const entryId of options.dirtyEntrySet) {
|
|
15747
|
-
if (options.dirtyEntryReasons.get(entryId)
|
|
15773
|
+
if (options.dirtyEntryReasons.get(entryId) !== "dependency") continue;
|
|
15748
15774
|
const chunkIds = options.sharedChunksByEntry.get(entryId);
|
|
15749
15775
|
if (!chunkIds?.size) continue;
|
|
15750
15776
|
for (const chunkId of chunkIds) relatedChunkIds.add(chunkId);
|
|
@@ -16147,12 +16173,21 @@ function appendSharedChunkImporters(bundle, state, onlyEntryIds, previousImporte
|
|
|
16147
16173
|
if (current) current.add(chunkId);
|
|
16148
16174
|
else state.hmrSharedChunksByModule.set(moduleId, new Set([chunkId]));
|
|
16149
16175
|
};
|
|
16176
|
+
const pruneSharedChunkModules = (chunkId, nextModuleIds) => {
|
|
16177
|
+
if (!nextModuleIds.size) return;
|
|
16178
|
+
for (const [moduleId, chunkIds] of state.hmrSharedChunksByModule) {
|
|
16179
|
+
if (nextModuleIds.has(moduleId)) continue;
|
|
16180
|
+
chunkIds.delete(chunkId);
|
|
16181
|
+
if (chunkIds.size === 0) state.hmrSharedChunksByModule.delete(moduleId);
|
|
16182
|
+
}
|
|
16183
|
+
};
|
|
16150
16184
|
for (const [bundleKey, output] of Object.entries(bundle)) {
|
|
16151
16185
|
if (output?.type !== "chunk") continue;
|
|
16152
16186
|
const chunk = output;
|
|
16153
16187
|
if (!chunk.fileName) chunk.fileName = bundleKey;
|
|
16154
16188
|
const projectSourceModules = collectProjectSourceModules(chunk);
|
|
16155
16189
|
bundleChunks.set(chunk.fileName, chunk);
|
|
16190
|
+
pruneSharedChunkModules(chunk.fileName, projectSourceModules);
|
|
16156
16191
|
if (projectSourceModules.size > 0) state.hmrSourceSharedChunks.add(chunk.fileName);
|
|
16157
16192
|
for (const moduleId of projectSourceModules) addSharedChunkModule(moduleId, chunk.fileName);
|
|
16158
16193
|
}
|
|
@@ -19016,7 +19051,7 @@ function createBuildStartHook(state) {
|
|
|
19016
19051
|
const { configService } = ctx;
|
|
19017
19052
|
const isPluginBuild = buildTarget === "plugin";
|
|
19018
19053
|
return async function buildStart() {
|
|
19019
|
-
resetTakeImportRegistry();
|
|
19054
|
+
resetTakeImportRegistry({ preserveSharedChunkNameCache: configService.isDev });
|
|
19020
19055
|
if (configService.isDev) if (isPluginBuild) {
|
|
19021
19056
|
if (configService.absolutePluginRoot) ensureSidecarWatcher(ctx, configService.absolutePluginRoot);
|
|
19022
19057
|
} else {
|
|
@@ -20569,17 +20604,101 @@ function injectPickIntoOptionsObject(optionsObject, keys) {
|
|
|
20569
20604
|
}
|
|
20570
20605
|
return false;
|
|
20571
20606
|
}
|
|
20572
|
-
|
|
20573
|
-
|
|
20574
|
-
|
|
20575
|
-
|
|
20576
|
-
|
|
20607
|
+
function createScopedSlotHostPropertyDefinition(typeName, value) {
|
|
20608
|
+
return {
|
|
20609
|
+
type: "ObjectExpression",
|
|
20610
|
+
properties: [{
|
|
20611
|
+
type: "ObjectProperty",
|
|
20612
|
+
key: {
|
|
20613
|
+
type: "Identifier",
|
|
20614
|
+
name: "type"
|
|
20615
|
+
},
|
|
20616
|
+
computed: false,
|
|
20617
|
+
shorthand: false,
|
|
20618
|
+
value: typeName === "String" ? {
|
|
20619
|
+
type: "Identifier",
|
|
20620
|
+
name: "String"
|
|
20621
|
+
} : { type: "NullLiteral" }
|
|
20622
|
+
}, {
|
|
20623
|
+
type: "ObjectProperty",
|
|
20624
|
+
key: {
|
|
20625
|
+
type: "Identifier",
|
|
20626
|
+
name: "value"
|
|
20627
|
+
},
|
|
20628
|
+
computed: false,
|
|
20629
|
+
shorthand: false,
|
|
20630
|
+
value: value === null ? { type: "NullLiteral" } : {
|
|
20631
|
+
type: "StringLiteral",
|
|
20632
|
+
value
|
|
20633
|
+
}
|
|
20634
|
+
}]
|
|
20635
|
+
};
|
|
20577
20636
|
}
|
|
20578
|
-
|
|
20579
|
-
|
|
20580
|
-
|
|
20581
|
-
|
|
20582
|
-
|
|
20637
|
+
function createScopedSlotHostProperties() {
|
|
20638
|
+
return [{
|
|
20639
|
+
type: "ObjectProperty",
|
|
20640
|
+
key: {
|
|
20641
|
+
type: "Identifier",
|
|
20642
|
+
name: WEVU_SLOT_OWNER_ID_PROP
|
|
20643
|
+
},
|
|
20644
|
+
computed: false,
|
|
20645
|
+
shorthand: false,
|
|
20646
|
+
value: createScopedSlotHostPropertyDefinition("String", "")
|
|
20647
|
+
}, {
|
|
20648
|
+
type: "ObjectProperty",
|
|
20649
|
+
key: {
|
|
20650
|
+
type: "Identifier",
|
|
20651
|
+
name: WEVU_SLOT_SCOPE_KEY
|
|
20652
|
+
},
|
|
20653
|
+
computed: false,
|
|
20654
|
+
shorthand: false,
|
|
20655
|
+
value: createScopedSlotHostPropertyDefinition("null", null)
|
|
20656
|
+
}];
|
|
20657
|
+
}
|
|
20658
|
+
function injectScopedSlotHostPropertiesIntoObject(propertiesObject) {
|
|
20659
|
+
let changed = false;
|
|
20660
|
+
for (const prop of createScopedSlotHostProperties().reverse()) {
|
|
20661
|
+
const key = prop.key.type === "Identifier" ? prop.key.name : void 0;
|
|
20662
|
+
if (!key || getObjectPropertyByKey(propertiesObject, key)) continue;
|
|
20663
|
+
propertiesObject.properties.unshift(prop);
|
|
20664
|
+
changed = true;
|
|
20665
|
+
}
|
|
20666
|
+
return changed;
|
|
20667
|
+
}
|
|
20668
|
+
function injectScopedSlotHostPropertiesIntoOptionsObject(optionsObject) {
|
|
20669
|
+
const propertiesProp = getObjectPropertyByKey(optionsObject, "properties");
|
|
20670
|
+
if (!propertiesProp) {
|
|
20671
|
+
optionsObject.properties.unshift({
|
|
20672
|
+
type: "ObjectProperty",
|
|
20673
|
+
key: {
|
|
20674
|
+
type: "Identifier",
|
|
20675
|
+
name: "properties"
|
|
20676
|
+
},
|
|
20677
|
+
computed: false,
|
|
20678
|
+
shorthand: false,
|
|
20679
|
+
value: {
|
|
20680
|
+
type: "ObjectExpression",
|
|
20681
|
+
properties: createScopedSlotHostProperties()
|
|
20682
|
+
}
|
|
20683
|
+
});
|
|
20684
|
+
return true;
|
|
20685
|
+
}
|
|
20686
|
+
const propertiesValue = unwrapExpression(propertiesProp.value);
|
|
20687
|
+
if (propertiesValue.type === "ObjectExpression") return injectScopedSlotHostPropertiesIntoObject(propertiesValue);
|
|
20688
|
+
if (propertiesValue.type === "Identifier" || propertiesValue.type === "MemberExpression" || propertiesValue.type === "CallExpression") {
|
|
20689
|
+
propertiesProp.value = {
|
|
20690
|
+
type: "ObjectExpression",
|
|
20691
|
+
properties: [{
|
|
20692
|
+
type: "SpreadElement",
|
|
20693
|
+
argument: propertiesValue
|
|
20694
|
+
}, ...createScopedSlotHostProperties()]
|
|
20695
|
+
};
|
|
20696
|
+
return true;
|
|
20697
|
+
}
|
|
20698
|
+
return false;
|
|
20699
|
+
}
|
|
20700
|
+
function transformTargetWevuOptionsInJs(source, transformOptions) {
|
|
20701
|
+
if (!mayNeedInjectSetDataPickInJs(source)) return {
|
|
20583
20702
|
code: source,
|
|
20584
20703
|
transformed: false
|
|
20585
20704
|
};
|
|
@@ -20597,7 +20716,7 @@ function injectSetDataPickInJs(source, pickKeys) {
|
|
|
20597
20716
|
transformed: false
|
|
20598
20717
|
};
|
|
20599
20718
|
let changed = false;
|
|
20600
|
-
for (const optionsObject of candidateOptions) changed =
|
|
20719
|
+
for (const optionsObject of candidateOptions) changed = transformOptions(optionsObject) || changed;
|
|
20601
20720
|
if (!changed) return {
|
|
20602
20721
|
code: source,
|
|
20603
20722
|
transformed: false
|
|
@@ -20613,6 +20732,28 @@ function injectSetDataPickInJs(source, pickKeys) {
|
|
|
20613
20732
|
map: generated.map
|
|
20614
20733
|
};
|
|
20615
20734
|
}
|
|
20735
|
+
/**
|
|
20736
|
+
* 从编译后的 WXML 模板提取渲染相关的顶层 key。
|
|
20737
|
+
*/
|
|
20738
|
+
function collectSetDataPickKeysFromTemplate(template, options) {
|
|
20739
|
+
return collectSetDataPickKeysFromTemplateCode(template, options);
|
|
20740
|
+
}
|
|
20741
|
+
/**
|
|
20742
|
+
* 在 wevu 组件脚本中注入 setData.pick。
|
|
20743
|
+
*/
|
|
20744
|
+
function injectSetDataPickInJs(source, pickKeys) {
|
|
20745
|
+
if (!pickKeys.length) return {
|
|
20746
|
+
code: source,
|
|
20747
|
+
transformed: false
|
|
20748
|
+
};
|
|
20749
|
+
return transformTargetWevuOptionsInJs(source, (optionsObject) => injectPickIntoOptionsObject(optionsObject, pickKeys));
|
|
20750
|
+
}
|
|
20751
|
+
/**
|
|
20752
|
+
* 在含有 scoped slot outlet 的 wevu 组件脚本中注入宿主内部属性。
|
|
20753
|
+
*/
|
|
20754
|
+
function injectScopedSlotHostPropertiesInJs(source) {
|
|
20755
|
+
return transformTargetWevuOptionsInJs(source, injectScopedSlotHostPropertiesIntoOptionsObject);
|
|
20756
|
+
}
|
|
20616
20757
|
//#endregion
|
|
20617
20758
|
//#region src/plugins/vue/transform/bundle/shared/types.ts
|
|
20618
20759
|
function getVueBundlePageLayoutPlan(result) {
|
|
@@ -20708,6 +20849,10 @@ async function finalizeCompiledVueLikeResult(options) {
|
|
|
20708
20849
|
const injectedPick = injectSetDataPickInJs(result.script, keys);
|
|
20709
20850
|
if (injectedPick.transformed) result.script = injectedPick.code;
|
|
20710
20851
|
}
|
|
20852
|
+
if (!isPage && !isApp && result.script && result.template?.includes(WEVU_SLOT_OWNER_ID_PROP)) {
|
|
20853
|
+
const injectedProps = injectScopedSlotHostPropertiesInJs(result.script);
|
|
20854
|
+
if (injectedProps.transformed) result.script = injectedProps.code;
|
|
20855
|
+
}
|
|
20711
20856
|
return result;
|
|
20712
20857
|
}
|
|
20713
20858
|
async function compileAndFinalizeVueLikeFile(options) {
|
|
@@ -21553,6 +21698,13 @@ async function finalizeTransformEntryScript(options) {
|
|
|
21553
21698
|
result.scriptMap = composeSourceMaps(injectedPick.map, result.scriptMap);
|
|
21554
21699
|
}
|
|
21555
21700
|
}
|
|
21701
|
+
if (!isPage && !isApp && result.script && result.template?.includes(WEVU_SLOT_OWNER_ID_PROP)) {
|
|
21702
|
+
const injectedProps = injectScopedSlotHostPropertiesInJs(result.script);
|
|
21703
|
+
if (injectedProps.transformed) {
|
|
21704
|
+
result.script = injectedProps.code;
|
|
21705
|
+
result.scriptMap = composeSourceMaps(injectedProps.map, result.scriptMap);
|
|
21706
|
+
}
|
|
21707
|
+
}
|
|
21556
21708
|
return result;
|
|
21557
21709
|
}
|
|
21558
21710
|
function finalizeTransformEntryCode(options) {
|
|
@@ -22208,6 +22360,26 @@ function escapeRegex(value) {
|
|
|
22208
22360
|
function createAbsolutePathPattern(value) {
|
|
22209
22361
|
return value.split(PATH_SEPARATOR_SPLIT_REGEX).map((segment) => escapeRegex(segment)).join("[/\\\\]+");
|
|
22210
22362
|
}
|
|
22363
|
+
function normalizeInlineConfigAfterDefu(inline, options) {
|
|
22364
|
+
const { ctx, platform, rolldownOptions, subPackageMeta } = options;
|
|
22365
|
+
const build = inline.build ?? (inline.build = {});
|
|
22366
|
+
const userRolldownOptions = build.rolldownOptions;
|
|
22367
|
+
build.rolldownOptions = {
|
|
22368
|
+
...userRolldownOptions ?? {},
|
|
22369
|
+
...rolldownOptions,
|
|
22370
|
+
output: {
|
|
22371
|
+
...rolldownOptions.output,
|
|
22372
|
+
...userRolldownOptions?.output ?? {}
|
|
22373
|
+
}
|
|
22374
|
+
};
|
|
22375
|
+
inline.define = {
|
|
22376
|
+
...inline.define ?? {},
|
|
22377
|
+
__VITE_IS_MODERN__: "false"
|
|
22378
|
+
};
|
|
22379
|
+
applyWeappViteHostMeta(inline, "miniprogram", platform);
|
|
22380
|
+
stripRollupOptions(inline);
|
|
22381
|
+
arrangePlugins(inline, ctx, subPackageMeta);
|
|
22382
|
+
}
|
|
22211
22383
|
function resolveMiniprogramWatchInclude(options) {
|
|
22212
22384
|
const watchInclude = [path.join(options.cwd, options.srcRoot, "**")];
|
|
22213
22385
|
if (!options.pluginRoot) return watchInclude;
|
|
@@ -22267,13 +22439,12 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
22267
22439
|
sourcemap: false
|
|
22268
22440
|
}
|
|
22269
22441
|
});
|
|
22270
|
-
inline
|
|
22271
|
-
|
|
22272
|
-
|
|
22273
|
-
|
|
22274
|
-
|
|
22275
|
-
|
|
22276
|
-
arrangePlugins(inline, ctx, subPackageMeta);
|
|
22442
|
+
normalizeInlineConfigAfterDefu(inline, {
|
|
22443
|
+
ctx,
|
|
22444
|
+
platform,
|
|
22445
|
+
rolldownOptions,
|
|
22446
|
+
subPackageMeta
|
|
22447
|
+
});
|
|
22277
22448
|
injectBuiltinAliases(inline);
|
|
22278
22449
|
return inline;
|
|
22279
22450
|
}
|
|
@@ -22288,13 +22459,12 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
22288
22459
|
rolldownOptions: { ...rolldownOptions }
|
|
22289
22460
|
}
|
|
22290
22461
|
});
|
|
22291
|
-
inlineConfig
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
arrangePlugins(inlineConfig, ctx, subPackageMeta);
|
|
22462
|
+
normalizeInlineConfigAfterDefu(inlineConfig, {
|
|
22463
|
+
ctx,
|
|
22464
|
+
platform,
|
|
22465
|
+
rolldownOptions,
|
|
22466
|
+
subPackageMeta
|
|
22467
|
+
});
|
|
22298
22468
|
inlineConfig.logLevel = "warn";
|
|
22299
22469
|
injectBuiltinAliases(inlineConfig);
|
|
22300
22470
|
const currentRoot = subPackageMeta?.subPackage.root;
|
|
@@ -23240,7 +23410,7 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
23240
23410
|
const vueAppPath = await findVueEntry(appBasename);
|
|
23241
23411
|
let configFromVue;
|
|
23242
23412
|
if (!appConfigFile && vueAppPath) {
|
|
23243
|
-
const { extractConfigFromVue } = await import("./file-
|
|
23413
|
+
const { extractConfigFromVue } = await import("./file-35pjSeN9.mjs");
|
|
23244
23414
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
23245
23415
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
23246
23416
|
}
|
|
@@ -24408,9 +24578,14 @@ async function hasManagedTsconfigChanges$1(ctx) {
|
|
|
24408
24578
|
for (const file of files) if (await fs.readFile(file.path, "utf8").catch(() => void 0) !== file.content) return true;
|
|
24409
24579
|
return false;
|
|
24410
24580
|
}
|
|
24581
|
+
async function outputFileIfChanged(file) {
|
|
24582
|
+
if (await fs.readFile(file.path, "utf8").catch(() => void 0) === file.content) return false;
|
|
24583
|
+
await fs.outputFile(file.path, file.content, "utf8");
|
|
24584
|
+
return true;
|
|
24585
|
+
}
|
|
24411
24586
|
async function syncManagedTsconfigFiles(ctx) {
|
|
24412
24587
|
const changed = await hasManagedTsconfigChanges$1(ctx);
|
|
24413
|
-
for (const file of await createManagedTsconfigFiles(ctx)) await
|
|
24588
|
+
for (const file of await createManagedTsconfigFiles(ctx)) await outputFileIfChanged(file);
|
|
24414
24589
|
return changed;
|
|
24415
24590
|
}
|
|
24416
24591
|
async function syncManagedTsconfigBootstrapFiles(cwd) {
|
|
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
84
84
|
}
|
|
85
85
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
86
86
|
try {
|
|
87
|
-
const { getCompilerContext } = await import("./getInstance-
|
|
87
|
+
const { getCompilerContext } = await import("./getInstance-DD6NsV2F.mjs");
|
|
88
88
|
const compilerContext = getCompilerContext();
|
|
89
89
|
const service = compilerContext.autoRoutesService;
|
|
90
90
|
const reference = service?.getReference?.();
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-D0HkutE0.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-BEnGeaSo.mjs";
|
|
3
3
|
import { t as defineConfig } from "./config-DJjSbpNX.mjs";
|
|
4
|
-
import { c as WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-
|
|
4
|
+
import { c as WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-CzGWJpCw.mjs";
|
|
5
5
|
import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-spnjzaP2.mjs";
|
|
6
6
|
export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.16.
|
|
4
|
+
"version": "6.16.14",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -97,13 +97,13 @@
|
|
|
97
97
|
"cac": "^7.0.0",
|
|
98
98
|
"chokidar": "^5.0.0",
|
|
99
99
|
"comment-json": "^5.0.0",
|
|
100
|
-
"debug": "^4.4.3",
|
|
101
100
|
"fdir": "^6.5.0",
|
|
102
101
|
"htmlparser2": "^12.0.0",
|
|
103
102
|
"local-pkg": "^1.1.2",
|
|
104
103
|
"lru-cache": "^11.3.6",
|
|
105
104
|
"magic-string": "^0.30.21",
|
|
106
105
|
"merge": "^2.1.1",
|
|
106
|
+
"obug": "^2.1.1",
|
|
107
107
|
"p-queue": "^9.2.0",
|
|
108
108
|
"package-manager-detector": "^1.6.0",
|
|
109
109
|
"pathe": "^2.0.3",
|
|
@@ -117,22 +117,22 @@
|
|
|
117
117
|
"vite-tsconfig-paths": "^6.1.1",
|
|
118
118
|
"vue": "^3.5.34",
|
|
119
119
|
"vue-tsc": "^3.2.8",
|
|
120
|
-
"@weapp-core/constants": "^0.1.
|
|
120
|
+
"@weapp-core/constants": "^0.1.7",
|
|
121
121
|
"@weapp-core/init": "6.0.8",
|
|
122
122
|
"@weapp-core/logger": "3.1.1",
|
|
123
123
|
"@weapp-core/schematics": "6.0.4",
|
|
124
124
|
"@weapp-core/shared": "3.0.4",
|
|
125
|
-
"@weapp-vite/ast": "6.16.
|
|
126
|
-
"@weapp-vite/mcp": "1.3.
|
|
127
|
-
"@weapp-vite/miniprogram-automator": "1.1.
|
|
125
|
+
"@weapp-vite/ast": "6.16.14",
|
|
126
|
+
"@weapp-vite/mcp": "1.3.3",
|
|
127
|
+
"@weapp-vite/miniprogram-automator": "1.1.1",
|
|
128
128
|
"@weapp-vite/volar": "2.1.0",
|
|
129
129
|
"@weapp-vite/web": "1.3.20",
|
|
130
130
|
"@wevu/api": "0.2.8",
|
|
131
131
|
"@wevu/web-apis": "1.2.12",
|
|
132
132
|
"rolldown-require": "2.0.15",
|
|
133
133
|
"vite-plugin-performance": "2.0.1",
|
|
134
|
-
"weapp-ide-cli": "5.2.
|
|
135
|
-
"wevu": "6.16.
|
|
134
|
+
"weapp-ide-cli": "5.2.10",
|
|
135
|
+
"wevu": "6.16.14"
|
|
136
136
|
},
|
|
137
137
|
"publishConfig": {
|
|
138
138
|
"access": "public",
|
package/dist/file-B0TT5uIp.mjs
DELETED