weapp-vite 6.16.7 → 6.16.9
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-BEnghhM9.mjs → createContext-BKbuGSJa.mjs} +185 -23
- package/dist/{file-CR2wVRDX.mjs → file-CKCR-PsP.mjs} +1 -1
- package/dist/file-Cj1AceWV.mjs +2 -0
- package/dist/getInstance-iZ7e_smp.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/package.json +9 -9
- package/dist/file-DcukQfQc.mjs +0 -2
- package/dist/getInstance-BAXgOqBQ.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-BKbuGSJa.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-BKbuGSJa.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-CKCR-PsP.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.9";
|
|
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-CKCR-PsP.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";
|
|
@@ -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_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 } from "@weapp-core/constants";
|
|
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 } 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";
|
|
@@ -13563,6 +13563,23 @@ async function collectNativeLayoutAssets(basePath) {
|
|
|
13563
13563
|
};
|
|
13564
13564
|
}
|
|
13565
13565
|
//#endregion
|
|
13566
|
+
//#region src/plugins/vue/transform/pageLayout/slot.ts
|
|
13567
|
+
const SLOT_OPEN_TAG_RE = /<slot\b([^>]*)>/gi;
|
|
13568
|
+
const DEFAULT_SLOT_NAME_RE = /(?:^|\s)name\s*=/;
|
|
13569
|
+
function hasDefaultSlotTemplate(template) {
|
|
13570
|
+
if (!template) return false;
|
|
13571
|
+
for (const match of template.matchAll(SLOT_OPEN_TAG_RE)) {
|
|
13572
|
+
const attrs = match[1] ?? "";
|
|
13573
|
+
if (!DEFAULT_SLOT_NAME_RE.test(attrs)) return true;
|
|
13574
|
+
}
|
|
13575
|
+
return false;
|
|
13576
|
+
}
|
|
13577
|
+
function assertTemplateHasDefaultSlot(options) {
|
|
13578
|
+
if (hasDefaultSlotTemplate(options.template)) return;
|
|
13579
|
+
if (options.kind === "app-shell") throw new Error(`${options.filename} 中 app.vue <template> 必须包含默认 <slot />,否则页面内容无法渲染到应用外壳内。`);
|
|
13580
|
+
throw new Error(`${options.filename} 对应的 layout template 必须包含默认 <slot />,否则页面内容无法渲染到布局内。`);
|
|
13581
|
+
}
|
|
13582
|
+
//#endregion
|
|
13566
13583
|
//#region src/plugins/utils/layoutEntries.ts
|
|
13567
13584
|
async function registerResolvedPageLayoutEntries(options) {
|
|
13568
13585
|
const { layouts, entries, explicitEntryTypes, nativeScriptEntries, normalizeEntry, jsonPath } = options;
|
|
@@ -18108,6 +18125,46 @@ function createSidecarIgnoredMatcher(ctx, rootDir) {
|
|
|
18108
18125
|
};
|
|
18109
18126
|
}
|
|
18110
18127
|
//#endregion
|
|
18128
|
+
//#region src/plugins/vue/transform/appShell.ts
|
|
18129
|
+
const APP_VUE_FILE_RE = /[\\/]app\.vue$/;
|
|
18130
|
+
function isAppVueFile(filename) {
|
|
18131
|
+
return APP_VUE_FILE_RE.test(filename);
|
|
18132
|
+
}
|
|
18133
|
+
function hasAppShellTemplate(result) {
|
|
18134
|
+
return Boolean(result?.template?.trim());
|
|
18135
|
+
}
|
|
18136
|
+
function resolveAppShellBase(configService) {
|
|
18137
|
+
return path.join(configService.absoluteSrcRoot, WEVU_APP_SHELL_COMPONENT_BASE);
|
|
18138
|
+
}
|
|
18139
|
+
function resolveAppShellRelativeBase(configService) {
|
|
18140
|
+
return configService.relativeOutputPath(resolveAppShellBase(configService));
|
|
18141
|
+
}
|
|
18142
|
+
function resolveAppShellImportPath(configService) {
|
|
18143
|
+
const relativeBase = resolveAppShellRelativeBase(configService);
|
|
18144
|
+
return relativeBase ? `/${toPosixPath(relativeBase)}` : void 0;
|
|
18145
|
+
}
|
|
18146
|
+
function resolveAppShellLayout(configService) {
|
|
18147
|
+
const importPath = resolveAppShellImportPath(configService);
|
|
18148
|
+
if (!importPath) return;
|
|
18149
|
+
return {
|
|
18150
|
+
file: normalizeWatchPath(resolveAppShellBase(configService)),
|
|
18151
|
+
importPath,
|
|
18152
|
+
kind: "vue",
|
|
18153
|
+
layoutName: "app-shell",
|
|
18154
|
+
tagName: WEVU_APP_SHELL_TAG_NAME
|
|
18155
|
+
};
|
|
18156
|
+
}
|
|
18157
|
+
function applyAppShell(result, filename, appShell) {
|
|
18158
|
+
if (!appShell || !result.template) return result;
|
|
18159
|
+
return applyPageLayout(result, filename, {
|
|
18160
|
+
file: appShell.file,
|
|
18161
|
+
importPath: appShell.importPath,
|
|
18162
|
+
kind: "vue",
|
|
18163
|
+
layoutName: "app-shell",
|
|
18164
|
+
tagName: appShell.tagName
|
|
18165
|
+
});
|
|
18166
|
+
}
|
|
18167
|
+
//#endregion
|
|
18111
18168
|
//#region src/plugins/core/lifecycle/watch.ts
|
|
18112
18169
|
const configSuffixes = configExtensions.map((ext) => `.${ext}`);
|
|
18113
18170
|
const styleSuffixes = supportedCssLangs.map((ext) => `.${ext}`);
|
|
@@ -18197,6 +18254,10 @@ async function processChangedFile(state, id, event) {
|
|
|
18197
18254
|
if ((event === "create" || isDeletedMissingSelf) && isAutoRouteFile) {
|
|
18198
18255
|
if (await ctx.autoRoutesService?.handleFileChange(normalizedId, event)) dirtyReasonStats.set("auto-routes-topology", 1);
|
|
18199
18256
|
}
|
|
18257
|
+
if (event === "update" && isAppVueFile(normalizedId) && resolvedEntryMap.size) for (const entryId of resolvedEntryMap.keys()) {
|
|
18258
|
+
if (entryId === normalizedId) continue;
|
|
18259
|
+
markEntryDirtyWithCause(entryId, "dependency", "app-shell-dependent");
|
|
18260
|
+
}
|
|
18200
18261
|
invalidateFileCache(normalizedId);
|
|
18201
18262
|
if (event === "update") {
|
|
18202
18263
|
const isTemplateFile = isTemplate(normalizedId);
|
|
@@ -19854,7 +19915,8 @@ function resolveClassStyleWxsAsset(ctx, relativeBase, wxsExtension, configServic
|
|
|
19854
19915
|
}
|
|
19855
19916
|
function emitSharedVueEntryAssets(options) {
|
|
19856
19917
|
const { bundle, pluginCtx, ctx, filename, relativeBase, result, configService, scriptModuleExtension, outputExtensions, platformAssetOptions, scopedSlotDefaults, scopedSlotMergeStrategy } = options;
|
|
19857
|
-
|
|
19918
|
+
const isAppVue = APP_VUE_LIKE_FILE_RE$1.test(filename);
|
|
19919
|
+
if (result.template && !isAppVue) emitPlatformTemplateAsset(bundle, {
|
|
19858
19920
|
ctx,
|
|
19859
19921
|
pluginCtx,
|
|
19860
19922
|
filename,
|
|
@@ -20627,6 +20689,11 @@ async function emitResolvedNativeLayoutStaticAssets(options) {
|
|
|
20627
20689
|
});
|
|
20628
20690
|
for (const asset of staticAssetEntries) {
|
|
20629
20691
|
if (asset.kind === "template") {
|
|
20692
|
+
assertTemplateHasDefaultSlot({
|
|
20693
|
+
filename: options.assets.template,
|
|
20694
|
+
kind: "page-layout",
|
|
20695
|
+
template: asset.source
|
|
20696
|
+
});
|
|
20630
20697
|
emitSfcTemplateIfMissing(options.pluginCtx, options.bundle, options.resolvedOptions.relativeBase, asset.source, options.resolvedOptions.templateExtension);
|
|
20631
20698
|
continue;
|
|
20632
20699
|
}
|
|
@@ -20681,7 +20748,7 @@ async function emitVueLayoutScriptFallbackIfNeeded(options) {
|
|
|
20681
20748
|
});
|
|
20682
20749
|
if (!fallbackState) return;
|
|
20683
20750
|
const { resolvedOptions } = fallbackState;
|
|
20684
|
-
|
|
20751
|
+
const result = await compileVueLikeFile({
|
|
20685
20752
|
source: await fs.readFile(layoutFilePath, "utf-8"),
|
|
20686
20753
|
filename: layoutFilePath,
|
|
20687
20754
|
ctx,
|
|
@@ -20690,7 +20757,13 @@ async function emitVueLayoutScriptFallbackIfNeeded(options) {
|
|
|
20690
20757
|
isApp: false,
|
|
20691
20758
|
configService,
|
|
20692
20759
|
compileOptionsState
|
|
20693
|
-
})
|
|
20760
|
+
});
|
|
20761
|
+
assertTemplateHasDefaultSlot({
|
|
20762
|
+
filename: layoutFilePath,
|
|
20763
|
+
kind: "page-layout",
|
|
20764
|
+
template: result.template
|
|
20765
|
+
});
|
|
20766
|
+
if (result.script?.trim()) return;
|
|
20694
20767
|
emitScriptlessComponentJsFallbackIfMissing({
|
|
20695
20768
|
pluginCtx,
|
|
20696
20769
|
bundle,
|
|
@@ -20731,6 +20804,62 @@ async function emitBundlePageLayoutsIfNeeded(options) {
|
|
|
20731
20804
|
emitVueLayout: layoutEmitters.emitVueLayout
|
|
20732
20805
|
});
|
|
20733
20806
|
}
|
|
20807
|
+
function resolveAppShellComponentConfig(config) {
|
|
20808
|
+
const shellConfig = { styleIsolation: "apply-shared" };
|
|
20809
|
+
if (!config) return JSON.stringify(shellConfig, null, 2);
|
|
20810
|
+
try {
|
|
20811
|
+
const parsed = JSON.parse(config);
|
|
20812
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return JSON.stringify(shellConfig, null, 2);
|
|
20813
|
+
for (const key of ["usingComponents", "componentGenerics"]) {
|
|
20814
|
+
const value = parsed[key];
|
|
20815
|
+
if (value && typeof value === "object" && !Array.isArray(value)) shellConfig[key] = value;
|
|
20816
|
+
}
|
|
20817
|
+
return Object.keys(shellConfig).length ? JSON.stringify(shellConfig, null, 2) : void 0;
|
|
20818
|
+
} catch {
|
|
20819
|
+
return;
|
|
20820
|
+
}
|
|
20821
|
+
}
|
|
20822
|
+
function emitAppShellAssetsIfNeeded(options) {
|
|
20823
|
+
const { relativeBase, result } = options;
|
|
20824
|
+
if (!relativeBase || !result.template?.trim()) return;
|
|
20825
|
+
assertTemplateHasDefaultSlot({
|
|
20826
|
+
filename: options.filename,
|
|
20827
|
+
kind: "app-shell",
|
|
20828
|
+
template: result.template
|
|
20829
|
+
});
|
|
20830
|
+
emitBundleVueEntryAssets({
|
|
20831
|
+
bundle: options.bundle,
|
|
20832
|
+
pluginCtx: options.pluginCtx,
|
|
20833
|
+
ctx: options.ctx,
|
|
20834
|
+
filename: relativeBase,
|
|
20835
|
+
relativeBase,
|
|
20836
|
+
result,
|
|
20837
|
+
configService: options.configService,
|
|
20838
|
+
templateExtension: options.templateExtension,
|
|
20839
|
+
scriptModuleExtension: options.scriptModuleExtension,
|
|
20840
|
+
outputExtensions: options.outputExtensions,
|
|
20841
|
+
platformAssetOptions: options.platformAssetOptions
|
|
20842
|
+
});
|
|
20843
|
+
emitSharedVueEntryJsonAsset({
|
|
20844
|
+
bundle: options.bundle,
|
|
20845
|
+
pluginCtx: options.pluginCtx,
|
|
20846
|
+
relativeBase,
|
|
20847
|
+
config: resolveAppShellComponentConfig(result.config),
|
|
20848
|
+
outputExtensions: options.outputExtensions,
|
|
20849
|
+
platformAssetOptions: options.platformAssetOptions,
|
|
20850
|
+
jsonOptions: {
|
|
20851
|
+
defaultConfig: { component: true },
|
|
20852
|
+
kind: "component",
|
|
20853
|
+
extension: options.jsonExtension
|
|
20854
|
+
}
|
|
20855
|
+
});
|
|
20856
|
+
emitScriptlessComponentJsFallbackIfMissing({
|
|
20857
|
+
pluginCtx: options.pluginCtx,
|
|
20858
|
+
bundle: options.bundle,
|
|
20859
|
+
relativeBase,
|
|
20860
|
+
scriptExtension: options.scriptExtension
|
|
20861
|
+
});
|
|
20862
|
+
}
|
|
20734
20863
|
//#endregion
|
|
20735
20864
|
//#region src/plugins/vue/transform/bundle/emitCompiledEntry.ts
|
|
20736
20865
|
async function emitResolvedCompiledVueEntryAssets(options) {
|
|
@@ -20738,22 +20867,45 @@ async function emitResolvedCompiledVueEntryAssets(options) {
|
|
|
20738
20867
|
const { ctx, pluginCtx } = state;
|
|
20739
20868
|
const { configService } = ctx;
|
|
20740
20869
|
if (!configService) return;
|
|
20741
|
-
if (
|
|
20742
|
-
|
|
20870
|
+
if (isAppVueFile(filename) && hasAppShellTemplate(result)) emitAppShellAssetsIfNeeded({
|
|
20871
|
+
bundle,
|
|
20872
|
+
pluginCtx,
|
|
20873
|
+
ctx,
|
|
20743
20874
|
filename,
|
|
20875
|
+
relativeBase: resolveAppShellRelativeBase(configService),
|
|
20744
20876
|
result,
|
|
20745
20877
|
configService,
|
|
20746
|
-
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20878
|
+
templateExtension: options.templateExtension,
|
|
20879
|
+
jsonExtension: options.jsonExtension,
|
|
20880
|
+
scriptExtension: options.scriptExtension,
|
|
20881
|
+
scriptModuleExtension: options.scriptModuleExtension,
|
|
20882
|
+
outputExtensions: options.outputExtensions,
|
|
20883
|
+
platformAssetOptions: options.platformAssetOptions
|
|
20884
|
+
});
|
|
20885
|
+
if (cached.isPage && cached.source) {
|
|
20886
|
+
await handleCompiledEntryPageLayouts({
|
|
20887
|
+
source: cached.source,
|
|
20888
|
+
filename,
|
|
20889
|
+
result,
|
|
20890
|
+
configService,
|
|
20891
|
+
emitLayouts: async (layouts) => {
|
|
20892
|
+
await emitBundlePageLayoutsIfNeeded({
|
|
20893
|
+
layouts,
|
|
20894
|
+
pluginCtx,
|
|
20895
|
+
bundle,
|
|
20896
|
+
ctx,
|
|
20897
|
+
configService,
|
|
20898
|
+
compileOptionsState,
|
|
20899
|
+
outputExtensions: options.outputExtensions
|
|
20900
|
+
});
|
|
20901
|
+
}
|
|
20902
|
+
});
|
|
20903
|
+
applyAppShell(result, filename, state.appShell);
|
|
20904
|
+
}
|
|
20905
|
+
if (isLayoutFile(filename, configService)) assertTemplateHasDefaultSlot({
|
|
20906
|
+
filename,
|
|
20907
|
+
kind: "page-layout",
|
|
20908
|
+
template: result.template
|
|
20757
20909
|
});
|
|
20758
20910
|
const { shouldEmitComponentJson } = emitCompiledEntryBundleAssets({
|
|
20759
20911
|
bundle,
|
|
@@ -20872,6 +21024,7 @@ async function emitResolvedFallbackPageEntryAssets(options) {
|
|
|
20872
21024
|
});
|
|
20873
21025
|
}
|
|
20874
21026
|
});
|
|
21027
|
+
applyAppShell(result, options.entryFilePath, options.appShell);
|
|
20875
21028
|
emitFallbackPageBundleAssets({
|
|
20876
21029
|
bundle: options.bundle,
|
|
20877
21030
|
pluginCtx: options.pluginCtx,
|
|
@@ -20925,7 +21078,8 @@ async function emitFallbackPageAssets(bundle, state) {
|
|
|
20925
21078
|
jsonExtension,
|
|
20926
21079
|
scriptModuleExtension,
|
|
20927
21080
|
outputExtensions,
|
|
20928
|
-
platformAssetOptions
|
|
21081
|
+
platformAssetOptions,
|
|
21082
|
+
appShell: state.appShell
|
|
20929
21083
|
});
|
|
20930
21084
|
} catch (error) {
|
|
20931
21085
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -20939,6 +21093,9 @@ function resolveVueBundleEmitState(state) {
|
|
|
20939
21093
|
const { ctx, compilationCache } = state;
|
|
20940
21094
|
const { configService, scanService } = ctx;
|
|
20941
21095
|
if (!configService || !scanService) return;
|
|
21096
|
+
state.appShell = Array.from(compilationCache.entries()).find(([filename, cached]) => {
|
|
21097
|
+
return isAppVueFile(filename) && hasAppShellTemplate(cached.result);
|
|
21098
|
+
}) ? resolveAppShellLayout(configService) : void 0;
|
|
20942
21099
|
const emittedEntryIds = Boolean(configService.isDev && ctx.runtimeState?.build?.hmr?.profile?.event === "update" && !ctx.runtimeState.build.hmr.didEmitAllEntries && ctx.runtimeState.build.hmr.lastEmittedEntryIds.size > 0) ? ctx.runtimeState.build.hmr.lastEmittedEntryIds : void 0;
|
|
20943
21100
|
return { compilationEntries: Array.from(compilationCache.entries()).filter(([id]) => {
|
|
20944
21101
|
return !emittedEntryIds || emittedEntryIds.has(normalizeFsResolvedId(id));
|
|
@@ -21293,7 +21450,7 @@ async function compileTransformEntryResult(options) {
|
|
|
21293
21450
|
return filename.endsWith(".vue") ? await compileVueFile(transformedSource, filename, compileOptions) : await compileJsxFile(transformedSource, filename, compileOptions);
|
|
21294
21451
|
}
|
|
21295
21452
|
async function finalizeTransformCompiledResult(options) {
|
|
21296
|
-
const { ctx, pluginCtx, filename, source, result, compilationCache, configService, isPage, isApp, scopedSlotModules, emittedScopedSlotChunks, addWatchFile, emitScopedSlotChunks } = options;
|
|
21453
|
+
const { ctx, pluginCtx, filename, source, result, compilationCache, setAppShell, configService, isPage, isApp, scopedSlotModules, emittedScopedSlotChunks, addWatchFile, emitScopedSlotChunks } = options;
|
|
21297
21454
|
const transformResult = result;
|
|
21298
21455
|
if (isPage && result.template) await handleTransformEntryPageLayoutFlow({
|
|
21299
21456
|
pluginCtx,
|
|
@@ -21302,7 +21459,8 @@ async function finalizeTransformCompiledResult(options) {
|
|
|
21302
21459
|
source,
|
|
21303
21460
|
result
|
|
21304
21461
|
});
|
|
21305
|
-
|
|
21462
|
+
if (isApp) setAppShell?.(hasAppShellTemplate(result) ? resolveAppShellLayout(configService) : void 0);
|
|
21463
|
+
if (!isApp) registerVueTemplateToken(ctx, filename, result.template);
|
|
21306
21464
|
if (Array.isArray(result.meta?.sfcSrcDeps) && typeof pluginCtx.addWatchFile === "function") for (const dep of result.meta.sfcSrcDeps) addWatchFile(pluginCtx, dep);
|
|
21307
21465
|
await finalizeTransformEntryScript({
|
|
21308
21466
|
result: transformResult,
|
|
@@ -21394,7 +21552,7 @@ const wevu = wevuPlugin;
|
|
|
21394
21552
|
//#endregion
|
|
21395
21553
|
//#region src/plugins/vue/transform/plugin/transformFile.ts
|
|
21396
21554
|
async function transformVueLikeFile(options) {
|
|
21397
|
-
const { ctx, pluginCtx, code, id, compilationCache, pageMatcher, setPageMatcher, scanDirtySynced, setScanDirtySynced, reExportResolutionCache, compileOptionsCache, styleBlocksCache, scopedSlotModules, emittedScopedSlotChunks, classStyleRuntimeWarned, readAndParseSfc, createReadAndParseSfcOptions } = options;
|
|
21555
|
+
const { ctx, pluginCtx, code, id, compilationCache, setAppShell, pageMatcher, setPageMatcher, scanDirtySynced, setScanDirtySynced, reExportResolutionCache, compileOptionsCache, styleBlocksCache, scopedSlotModules, emittedScopedSlotChunks, classStyleRuntimeWarned, readAndParseSfc, createReadAndParseSfcOptions } = options;
|
|
21398
21556
|
const vueTransformTiming = ctx.configService?.weappViteConfig?.debug?.vueTransformTiming;
|
|
21399
21557
|
const { measureStage, reportTiming } = createTransformStageMeasurer(vueTransformTiming);
|
|
21400
21558
|
const configService = ctx.configService;
|
|
@@ -21464,6 +21622,7 @@ async function transformVueLikeFile(options) {
|
|
|
21464
21622
|
source: transformedSource,
|
|
21465
21623
|
result,
|
|
21466
21624
|
compilationCache,
|
|
21625
|
+
setAppShell,
|
|
21467
21626
|
configService,
|
|
21468
21627
|
isPage,
|
|
21469
21628
|
isApp,
|
|
@@ -21495,6 +21654,7 @@ async function transformVueLikeFile(options) {
|
|
|
21495
21654
|
//#region src/plugins/vue/transform/plugin/index.ts
|
|
21496
21655
|
function createVueTransformPlugin(ctx) {
|
|
21497
21656
|
const compilationCache = /* @__PURE__ */ new Map();
|
|
21657
|
+
let appShell;
|
|
21498
21658
|
let pageMatcher = null;
|
|
21499
21659
|
let scanDirtySynced = false;
|
|
21500
21660
|
const reExportResolutionCache = /* @__PURE__ */ new Map();
|
|
@@ -21550,6 +21710,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
21550
21710
|
code,
|
|
21551
21711
|
id,
|
|
21552
21712
|
compilationCache,
|
|
21713
|
+
setAppShell: (shell) => appShell = shell,
|
|
21553
21714
|
pageMatcher,
|
|
21554
21715
|
setPageMatcher: (matcher) => pageMatcher = matcher,
|
|
21555
21716
|
scanDirtySynced,
|
|
@@ -21572,6 +21733,7 @@ function createVueTransformPlugin(ctx) {
|
|
|
21572
21733
|
ctx,
|
|
21573
21734
|
pluginCtx: this,
|
|
21574
21735
|
compilationCache,
|
|
21736
|
+
appShell,
|
|
21575
21737
|
reExportResolutionCache,
|
|
21576
21738
|
compileOptionsCache,
|
|
21577
21739
|
classStyleRuntimeWarned
|
|
@@ -22921,7 +23083,7 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
22921
23083
|
const vueAppPath = await findVueEntry(appBasename);
|
|
22922
23084
|
let configFromVue;
|
|
22923
23085
|
if (!appConfigFile && vueAppPath) {
|
|
22924
|
-
const { extractConfigFromVue } = await import("./file-
|
|
23086
|
+
const { extractConfigFromVue } = await import("./file-Cj1AceWV.mjs");
|
|
22925
23087
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
22926
23088
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
22927
23089
|
}
|
|
@@ -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-iZ7e_smp.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-BKbuGSJa.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.9",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -109,20 +109,20 @@
|
|
|
109
109
|
"pathe": "^2.0.3",
|
|
110
110
|
"picomatch": "^4.0.4",
|
|
111
111
|
"postcss": "^8.5.14",
|
|
112
|
-
"rolldown": "1.0.0
|
|
113
|
-
"rolldown-plugin-dts": "0.
|
|
114
|
-
"semver": "^7.
|
|
112
|
+
"rolldown": "1.0.0",
|
|
113
|
+
"rolldown-plugin-dts": "0.25.0",
|
|
114
|
+
"semver": "^7.8.0",
|
|
115
115
|
"typescript": "^6.0.3",
|
|
116
116
|
"vite": "8.0.11",
|
|
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.6",
|
|
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.
|
|
125
|
+
"@weapp-vite/ast": "6.16.9",
|
|
126
126
|
"@weapp-vite/mcp": "1.3.2",
|
|
127
127
|
"@weapp-vite/miniprogram-automator": "1.1.0",
|
|
128
128
|
"@weapp-vite/volar": "2.1.0",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"rolldown-require": "2.0.15",
|
|
133
133
|
"vite-plugin-performance": "2.0.1",
|
|
134
134
|
"weapp-ide-cli": "5.2.9",
|
|
135
|
-
"wevu": "6.16.
|
|
135
|
+
"wevu": "6.16.9"
|
|
136
136
|
},
|
|
137
137
|
"publishConfig": {
|
|
138
138
|
"access": "public",
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
},
|
|
141
141
|
"devDependencies": {
|
|
142
142
|
"oxc-parser": "^0.129.0",
|
|
143
|
-
"oxc-walker": "^0.
|
|
144
|
-
"tailwindcss": "^4.
|
|
143
|
+
"oxc-walker": "^1.0.0",
|
|
144
|
+
"tailwindcss": "^4.3.0",
|
|
145
145
|
"ts-morph": "^28.0.0"
|
|
146
146
|
},
|
|
147
147
|
"scripts": {
|
package/dist/file-DcukQfQc.mjs
DELETED