weapp-vite 6.16.23 → 6.16.25
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/README.md +2 -0
- package/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/{config-DBTZvwxw.d.mts → config-DJ3SOkf9.d.mts} +16 -0
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-NXrQuj5y.mjs → createContext-D64s5KsN.mjs} +129 -45
- package/dist/docs/README.md +2 -0
- package/dist/docs/vue-sfc.md +219 -0
- package/dist/docs/weapp-config.md +197 -0
- package/dist/{file-C-eN8D-v.mjs → file-B8gSIRd0.mjs} +1 -1
- package/dist/file-Cjctfg-V.mjs +2 -0
- package/dist/getInstance-CjO8kDWJ.mjs +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/json.d.mts +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +8 -8
- package/dist/file-S0TAbkhK.mjs +0 -2
- package/dist/getInstance-MmgTcalc.mjs +0 -2
package/README.md
CHANGED
|
@@ -60,6 +60,8 @@ export default defineConfig({
|
|
|
60
60
|
把 `div/span/img/a/h1...` 等常见 HTML 标签映射成小程序内置标签。
|
|
61
61
|
- `weapp.vue.template.htmlTagToWxmlTagClass`
|
|
62
62
|
默认开启。在映射发生时追加原标签名 class,例如 `h3 -> <view class="h3">`、`br -> <view class="br" />`,便于你自己写 CSS 低成本恢复默认外观;不需要时可设为 `false`。
|
|
63
|
+
- `weapp.vue.template.slotFallbackWrapper`
|
|
64
|
+
配置普通具名插槽 fallback 的真实 wrapper,支持全局默认、按模板标签名 `component` / 子组件静态 `defineOptions({ name })` 的 `componentName` / slot 规则,以及组件内 `slot-wrapper` / `slot-wrapper-class` 静态覆盖。单个 slot 的局部策略更推荐写在对应的 `<template #xxx>` 上,例如 `<template #header slot-wrapper="cover-view">`。转发 `<slot />` 时不要使用 `<block slot="...">` 作为 wrapper,真实 DevTools 运行时会丢内容。
|
|
63
65
|
|
|
64
66
|
```vue
|
|
65
67
|
<!-- App.vue -->
|
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-D64s5KsN.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 createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, b as getProjectConfigFileName, 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 resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-
|
|
1
|
+
import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, b as getProjectConfigFileName, 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 resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-D64s5KsN.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
|
|
3
|
-
import { h as VERSION } from "./file-
|
|
3
|
+
import { h as VERSION } from "./file-B8gSIRd0.mjs";
|
|
4
4
|
import { o as resolveWeappMcpConfig, s as startWeappViteMcpServer } from "./mcp-qmDOTH07.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import path, { posix } from "pathe";
|
|
@@ -3708,7 +3708,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
3708
3708
|
}
|
|
3709
3709
|
//#endregion
|
|
3710
3710
|
//#region package.json
|
|
3711
|
-
var version = "6.16.
|
|
3711
|
+
var version = "6.16.25";
|
|
3712
3712
|
//#endregion
|
|
3713
3713
|
//#region src/cli/devHotkeys/format.ts
|
|
3714
3714
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -581,6 +581,19 @@ interface WeappVueTemplateConfig {
|
|
|
581
581
|
scopedSlotsCompiler?: 'auto' | 'augmented' | 'off';
|
|
582
582
|
scopedSlotsRequireProps?: boolean;
|
|
583
583
|
slotSingleRootNoWrapper?: boolean;
|
|
584
|
+
slotFallbackWrapper?: string | {
|
|
585
|
+
tag?: string;
|
|
586
|
+
attrs?: Record<string, string>;
|
|
587
|
+
singleRootNoWrapper?: boolean;
|
|
588
|
+
rules?: Array<{
|
|
589
|
+
component?: string | RegExp | Array<string | RegExp>;
|
|
590
|
+
componentName?: string | RegExp | Array<string | RegExp>;
|
|
591
|
+
slot?: string | RegExp | Array<string | RegExp>;
|
|
592
|
+
tag?: string;
|
|
593
|
+
attrs?: Record<string, string>;
|
|
594
|
+
singleRootNoWrapper?: boolean;
|
|
595
|
+
}>;
|
|
596
|
+
};
|
|
584
597
|
slotMultipleInstance?: boolean;
|
|
585
598
|
classStyleRuntime?: 'auto' | 'wxs' | 'js';
|
|
586
599
|
objectLiteralBindMode?: 'runtime' | 'inline';
|
|
@@ -1259,6 +1272,7 @@ interface LoadConfigResult {
|
|
|
1259
1272
|
srcRoot: string;
|
|
1260
1273
|
pluginOnly?: boolean;
|
|
1261
1274
|
configFilePath?: string;
|
|
1275
|
+
configFileDependencies: string[];
|
|
1262
1276
|
currentSubPackageRoot?: string;
|
|
1263
1277
|
weappWeb?: ResolvedWeappWebConfig;
|
|
1264
1278
|
configMergeInfo?: ResolvedConfigMergeInfo;
|
|
@@ -1325,6 +1339,7 @@ interface ConfigService {
|
|
|
1325
1339
|
readonly aliasEntries: ResolvedAlias[];
|
|
1326
1340
|
readonly platform: MpPlatform$1;
|
|
1327
1341
|
readonly configFilePath?: string;
|
|
1342
|
+
readonly configFileDependencies: string[];
|
|
1328
1343
|
readonly weappWebConfig?: ResolvedWeappWebConfig;
|
|
1329
1344
|
readonly weappLibConfig?: ResolvedWeappLibConfig;
|
|
1330
1345
|
readonly weappLibOutputMap?: Map<string, string>;
|
|
@@ -1509,6 +1524,7 @@ interface RuntimeState {
|
|
|
1509
1524
|
dirtyEntrySet: Set<string>;
|
|
1510
1525
|
dirtyEntryReasons: Map<string, 'direct' | 'dependency' | 'metadata'>;
|
|
1511
1526
|
resolvedEntryMap: Map<string, ResolvedId>;
|
|
1527
|
+
externalComponentEntryMap: Map<string, string>;
|
|
1512
1528
|
entriesMap: Map<string, Entry | undefined>;
|
|
1513
1529
|
layoutEntryDependents: Map<string, Set<string>>;
|
|
1514
1530
|
entryLayoutDependencies: Map<string, Set<string>>;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Bn as WeappViteHostMeta, Hn as createWeappViteHostMeta, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Yn as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as WEAPP_VITE_HOST_NAME } from "./config-
|
|
1
|
+
import { Bn as WeappViteHostMeta, Hn as createWeappViteHostMeta, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Yn as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson, zn as WEAPP_VITE_HOST_NAME } from "./config-DJ3SOkf9.mjs";
|
|
2
2
|
export { type App, type Component, type Page, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, type WeappViteConfig, WeappViteHostMeta, type WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
|
|
2
2
|
import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.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-B8gSIRd0.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";
|
|
@@ -9169,6 +9169,13 @@ function assertModuleScopedToRoot(options) {
|
|
|
9169
9169
|
}
|
|
9170
9170
|
//#endregion
|
|
9171
9171
|
//#region src/runtime/chunkStrategy/sourcemap.ts
|
|
9172
|
+
function isSourceLike(source) {
|
|
9173
|
+
return typeof source === "string" || source instanceof Uint8Array || Buffer.isBuffer(source);
|
|
9174
|
+
}
|
|
9175
|
+
function cloneSourceLike(source) {
|
|
9176
|
+
if (typeof source === "string") return source;
|
|
9177
|
+
return Buffer.from(source);
|
|
9178
|
+
}
|
|
9172
9179
|
function collectSourceMapKeys(fileName, chunk) {
|
|
9173
9180
|
const keys = /* @__PURE__ */ new Set();
|
|
9174
9181
|
if (fileName) keys.add(`${fileName}.map`);
|
|
@@ -9196,11 +9203,12 @@ function resolveSourceMapSource(originalMap, assetSource) {
|
|
|
9196
9203
|
function emitSourceMapAsset(ctx, targetFileName, sourceMapAssetInfo, fallbackSource) {
|
|
9197
9204
|
if (!targetFileName) return;
|
|
9198
9205
|
if (sourceMapAssetInfo?.asset && isSourceLike(sourceMapAssetInfo.asset.source)) {
|
|
9206
|
+
const [name] = sourceMapAssetInfo.asset.names ?? [];
|
|
9199
9207
|
ctx.emitFile({
|
|
9200
9208
|
type: "asset",
|
|
9201
9209
|
fileName: targetFileName,
|
|
9202
9210
|
source: cloneSourceLike(sourceMapAssetInfo.asset.source),
|
|
9203
|
-
name:
|
|
9211
|
+
...name ? { name } : {}
|
|
9204
9212
|
});
|
|
9205
9213
|
return;
|
|
9206
9214
|
}
|
|
@@ -9210,13 +9218,6 @@ function emitSourceMapAsset(ctx, targetFileName, sourceMapAssetInfo, fallbackSou
|
|
|
9210
9218
|
source: cloneSourceLike(fallbackSource)
|
|
9211
9219
|
});
|
|
9212
9220
|
}
|
|
9213
|
-
function isSourceLike(source) {
|
|
9214
|
-
return typeof source === "string" || source instanceof Uint8Array || Buffer.isBuffer(source);
|
|
9215
|
-
}
|
|
9216
|
-
function cloneSourceLike(source) {
|
|
9217
|
-
if (typeof source === "string") return source;
|
|
9218
|
-
return Buffer.from(source);
|
|
9219
|
-
}
|
|
9220
9221
|
//#endregion
|
|
9221
9222
|
//#region src/runtime/chunkStrategy/apply/runtime.ts
|
|
9222
9223
|
const ROLLDOWN_RUNTIME_FILE_NAME$2 = "rolldown-runtime.js";
|
|
@@ -11948,6 +11949,23 @@ function shouldReuseLoadedWeappConfig(weappConfigFilePath, loadedPath) {
|
|
|
11948
11949
|
if (!weappConfigFilePath || !loadedPath) return false;
|
|
11949
11950
|
return path.resolve(loadedPath) === path.resolve(weappConfigFilePath);
|
|
11950
11951
|
}
|
|
11952
|
+
function collectConfigFileDependencies(cwd, ...entries) {
|
|
11953
|
+
const dependencySet = /* @__PURE__ */ new Set();
|
|
11954
|
+
const add = (filePath) => {
|
|
11955
|
+
if (!filePath) return;
|
|
11956
|
+
dependencySet.add(path.isAbsolute(filePath) ? path.normalize(filePath) : path.resolve(cwd, filePath));
|
|
11957
|
+
};
|
|
11958
|
+
for (const entry of entries) {
|
|
11959
|
+
if (!entry) continue;
|
|
11960
|
+
if (typeof entry === "string") {
|
|
11961
|
+
add(entry);
|
|
11962
|
+
continue;
|
|
11963
|
+
}
|
|
11964
|
+
add(entry.path);
|
|
11965
|
+
for (const dependency of entry.dependencies ?? []) add(dependency);
|
|
11966
|
+
}
|
|
11967
|
+
return Array.from(dependencySet);
|
|
11968
|
+
}
|
|
11951
11969
|
function injectDefaultSrcAlias(config, cwd, srcRoot) {
|
|
11952
11970
|
if (!srcRoot) return;
|
|
11953
11971
|
const resolve = config.resolve ?? (config.resolve = {});
|
|
@@ -12192,6 +12210,7 @@ function createLoadConfig(options) {
|
|
|
12192
12210
|
}
|
|
12193
12211
|
}
|
|
12194
12212
|
const configFilePath = weappLoaded?.path ?? loaded?.path ?? resolvedConfigFile;
|
|
12213
|
+
const configFileDependencies = collectConfigFileDependencies(cwd, loaded, weappLoaded, resolvedConfigFile);
|
|
12195
12214
|
const configMergeInfo = loaded?.path && weappLoaded?.path && !shouldReuseLoadedWeappConfig(weappLoaded.path, loaded.path) ? {
|
|
12196
12215
|
merged: true,
|
|
12197
12216
|
viteConfigPath: loaded.path,
|
|
@@ -12227,6 +12246,7 @@ function createLoadConfig(options) {
|
|
|
12227
12246
|
srcRoot,
|
|
12228
12247
|
pluginOnly,
|
|
12229
12248
|
configFilePath,
|
|
12249
|
+
configFileDependencies,
|
|
12230
12250
|
currentSubPackageRoot: void 0,
|
|
12231
12251
|
weappWeb: resolvedWebConfig,
|
|
12232
12252
|
weappLib: resolvedLibConfig,
|
|
@@ -15022,7 +15042,7 @@ function addNormalizedWatchFile(pluginCtx, file) {
|
|
|
15022
15042
|
}
|
|
15023
15043
|
function addNormalizedWatchFiles(pluginCtx, files) {
|
|
15024
15044
|
let count = 0;
|
|
15025
|
-
for (const file of files) if (addNormalizedWatchFile(pluginCtx, file)) count += 1;
|
|
15045
|
+
for (const file of files ?? []) if (addNormalizedWatchFile(pluginCtx, file)) count += 1;
|
|
15026
15046
|
return count;
|
|
15027
15047
|
}
|
|
15028
15048
|
//#endregion
|
|
@@ -15320,7 +15340,7 @@ function prepareNormalizedEntries(options) {
|
|
|
15320
15340
|
return normalizedEntries;
|
|
15321
15341
|
}
|
|
15322
15342
|
async function emitEntryOutput(options) {
|
|
15323
|
-
const { pluginCtx, id, type, json: initialJson, jsonPath, templatePath, isPluginBuild, normalizedEntries, pluginResolvedRecords, pluginJsonPathForRegistration, pluginJsonForRegistration, resolveEntriesWithCache, entryResolveRoot, configService, wxmlService, resolvedEntryMap, loadedEntrySet, dirtyEntrySet, forceEmitEntrySet, replaceLayoutDependencies, emitEntriesChunks, registerJsonAsset, existsCache, pathExistsTtlMs, debug, relativeCwdId, getTime, emittedWxmlCodeCache } = options;
|
|
15343
|
+
const { pluginCtx, id, type, json: initialJson, jsonPath, templatePath, isPluginBuild, normalizedEntries, pluginResolvedRecords, pluginJsonPathForRegistration, pluginJsonForRegistration, resolveEntriesWithCache, resolveMappedEntry, entryResolveRoot, configService, wxmlService, resolvedEntryMap, loadedEntrySet, dirtyEntrySet, forceEmitEntrySet, replaceLayoutDependencies, emitEntriesChunks, registerJsonAsset, existsCache, pathExistsTtlMs, debug, relativeCwdId, getTime, emittedWxmlCodeCache } = options;
|
|
15324
15344
|
let json = initialJson;
|
|
15325
15345
|
async function emitNativeLayoutAssets(layoutBasePath) {
|
|
15326
15346
|
if (typeof pluginCtx.emitFile !== "function") return;
|
|
@@ -15393,7 +15413,10 @@ async function emitEntryOutput(options) {
|
|
|
15393
15413
|
});
|
|
15394
15414
|
}
|
|
15395
15415
|
const shouldSkipEntries = Boolean(options.skipEntries);
|
|
15396
|
-
const resolvedIds = shouldSkipEntries ? [] : normalizedEntries.length ? await resolveEntriesWithCache(pluginCtx, normalizedEntries, entryResolveRoot
|
|
15416
|
+
const resolvedIds = shouldSkipEntries ? [] : normalizedEntries.length ? await resolveEntriesWithCache(pluginCtx, normalizedEntries, entryResolveRoot, {
|
|
15417
|
+
fallbackRoots: [configService.cwd],
|
|
15418
|
+
resolveMappedEntry
|
|
15419
|
+
}) : [];
|
|
15397
15420
|
debug?.(`resolvedIds ${relativeCwdId} 耗时 ${getTime()}`);
|
|
15398
15421
|
const pendingResolvedIds = [];
|
|
15399
15422
|
const combinedResolved = shouldSkipEntries ? [] : pluginResolvedRecords ? isPluginBuild ? pluginResolvedRecords : [...resolvedIds, ...pluginResolvedRecords] : resolvedIds;
|
|
@@ -15491,11 +15514,22 @@ function createEntryResolver(configService) {
|
|
|
15491
15514
|
if (resolvedId || !configService?.isDev) entryResolutionCache.set(normalized, resolvedId);
|
|
15492
15515
|
return resolvedId;
|
|
15493
15516
|
}
|
|
15494
|
-
async function resolveEntriesWithCache(pluginCtx, entries, absoluteRoot) {
|
|
15517
|
+
async function resolveEntriesWithCache(pluginCtx, entries, absoluteRoot, options) {
|
|
15495
15518
|
return Promise.all(entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
|
|
15519
|
+
const cleanedEntry = entry.replace(LEADING_ROOT_SLASH_RE, "");
|
|
15520
|
+
const mappedEntry = options?.resolveMappedEntry?.(cleanedEntry);
|
|
15521
|
+
if (mappedEntry) return {
|
|
15522
|
+
entry,
|
|
15523
|
+
resolvedId: await resolveEntryWithCache(pluginCtx, mappedEntry)
|
|
15524
|
+
};
|
|
15525
|
+
let resolvedId = await resolveEntryWithCache(pluginCtx, path.isAbsolute(entry) && await fs.pathExists(entry) ? entry : path.resolve(absoluteRoot, cleanedEntry));
|
|
15526
|
+
if (!resolvedId) for (const fallbackRoot of options?.fallbackRoots ?? []) {
|
|
15527
|
+
resolvedId = await resolveEntryWithCache(pluginCtx, path.resolve(fallbackRoot, cleanedEntry));
|
|
15528
|
+
if (resolvedId) break;
|
|
15529
|
+
}
|
|
15496
15530
|
return {
|
|
15497
15531
|
entry,
|
|
15498
|
-
resolvedId
|
|
15532
|
+
resolvedId
|
|
15499
15533
|
};
|
|
15500
15534
|
}));
|
|
15501
15535
|
}
|
|
@@ -15604,7 +15638,7 @@ async function scanTemplateEntry(pluginCtx, id, scanTemplateEntryFn, existsCache
|
|
|
15604
15638
|
return ensureTemplateScanned(pluginCtx, id, scanTemplateEntryFn, existsCache, ttlMs);
|
|
15605
15639
|
}
|
|
15606
15640
|
async function applyScriptSetupUsingComponents(options) {
|
|
15607
|
-
const { pluginCtx, vueEntryPath, templatePath, json, configService, wxmlService, reExportResolutionCache } = options;
|
|
15641
|
+
const { pluginCtx, vueEntryPath, templatePath, json, configService, wxmlService, reExportResolutionCache, externalComponentEntryMap } = options;
|
|
15608
15642
|
try {
|
|
15609
15643
|
const { descriptor, errors } = await readAndParseSfc(vueEntryPath, { ...createReadAndParseSfcOptions(pluginCtx, configService) });
|
|
15610
15644
|
if (!errors?.length && descriptor?.template && !templatePath) {
|
|
@@ -15625,16 +15659,18 @@ async function applyScriptSetupUsingComponents(options) {
|
|
|
15625
15659
|
if (imports.length) {
|
|
15626
15660
|
const usingComponents = json && typeof json.usingComponents === "object" && json.usingComponents && !Array.isArray(json.usingComponents) ? json.usingComponents : {};
|
|
15627
15661
|
for (const { localName, importSource, importedName, kind } of imports) {
|
|
15628
|
-
|
|
15662
|
+
const resolved = await resolveUsingComponentReference(pluginCtx, configService, reExportResolutionCache, importSource, vueEntryPath, {
|
|
15629
15663
|
localName,
|
|
15630
15664
|
kind,
|
|
15631
15665
|
importedName,
|
|
15632
15666
|
fallbackRelativeImporterDir: true
|
|
15633
15667
|
});
|
|
15668
|
+
let { from } = resolved;
|
|
15634
15669
|
if (!from && importSource.startsWith("/")) from = removeExtensionDeep(importSource);
|
|
15635
15670
|
if (!from) continue;
|
|
15636
15671
|
if (Reflect.has(usingComponents, localName) && usingComponents[localName] !== from) logger_default.warn(`[自动 usingComponents] 冲突:${vueEntryPath} 中 usingComponents['${localName}']='${usingComponents[localName]}' 将被 <script setup> 导入覆盖为 '${from}'`);
|
|
15637
15672
|
usingComponents[localName] = from;
|
|
15673
|
+
if (resolved.resolvedId) externalComponentEntryMap?.set(removeExtensionDeep(from).replace(/^\/+/, ""), resolved.resolvedId);
|
|
15638
15674
|
}
|
|
15639
15675
|
json.usingComponents = usingComponents;
|
|
15640
15676
|
}
|
|
@@ -15830,7 +15866,8 @@ function createEntryLoader(options) {
|
|
|
15830
15866
|
json,
|
|
15831
15867
|
configService,
|
|
15832
15868
|
wxmlService,
|
|
15833
|
-
reExportResolutionCache
|
|
15869
|
+
reExportResolutionCache,
|
|
15870
|
+
externalComponentEntryMap: ctx.runtimeState.build.hmr.externalComponentEntryMap
|
|
15834
15871
|
});
|
|
15835
15872
|
if (type === "page") {
|
|
15836
15873
|
const vueSource = await readVueSource();
|
|
@@ -15902,6 +15939,7 @@ function createEntryLoader(options) {
|
|
|
15902
15939
|
pluginJsonPathForRegistration,
|
|
15903
15940
|
pluginJsonForRegistration,
|
|
15904
15941
|
resolveEntriesWithCache: entryResolver.resolveEntriesWithCache,
|
|
15942
|
+
resolveMappedEntry: (entry) => ctx.runtimeState.build.hmr.externalComponentEntryMap.get(entry),
|
|
15905
15943
|
entryResolveRoot,
|
|
15906
15944
|
configService,
|
|
15907
15945
|
wxmlService,
|
|
@@ -17634,7 +17672,7 @@ function injectRequestGlobalsIntoSfc(source, targets, options) {
|
|
|
17634
17672
|
//#endregion
|
|
17635
17673
|
//#region src/plugins/outputFinalizer.ts
|
|
17636
17674
|
const PREPROCESSOR_STYLE_ASSET_RE = /\.(?:less|sass|scss|styl|stylus|pcss|postcss|sss)$/i;
|
|
17637
|
-
function normalizePreprocessorStyleAssets(bundle, styleExtension) {
|
|
17675
|
+
function normalizePreprocessorStyleAssets(bundle, styleExtension, emitAsset) {
|
|
17638
17676
|
if (!styleExtension) return;
|
|
17639
17677
|
for (const [bundleFileName, output] of Object.entries(bundle)) {
|
|
17640
17678
|
if (output?.type !== "asset") continue;
|
|
@@ -17646,7 +17684,15 @@ function normalizePreprocessorStyleAssets(bundle, styleExtension) {
|
|
|
17646
17684
|
delete bundle[bundleFileName];
|
|
17647
17685
|
if (existingOutput) continue;
|
|
17648
17686
|
output.fileName = outputFileName;
|
|
17649
|
-
|
|
17687
|
+
const [name] = output.names ?? [];
|
|
17688
|
+
const [originalFileName] = output.originalFileNames ?? [];
|
|
17689
|
+
emitAsset({
|
|
17690
|
+
type: "asset",
|
|
17691
|
+
fileName: outputFileName,
|
|
17692
|
+
...name ? { name } : {},
|
|
17693
|
+
...originalFileName ? { originalFileName } : {},
|
|
17694
|
+
source: output.source
|
|
17695
|
+
});
|
|
17650
17696
|
}
|
|
17651
17697
|
}
|
|
17652
17698
|
function createOutputFinalizerPlugin(ctx) {
|
|
@@ -17654,7 +17700,7 @@ function createOutputFinalizerPlugin(ctx) {
|
|
|
17654
17700
|
name: "weapp-vite:output-finalizer",
|
|
17655
17701
|
enforce: "post",
|
|
17656
17702
|
generateBundle(_options, bundle) {
|
|
17657
|
-
normalizePreprocessorStyleAssets(bundle, ctx.configService.outputExtensions?.wxss);
|
|
17703
|
+
normalizePreprocessorStyleAssets(bundle, ctx.configService.outputExtensions?.wxss, (asset) => this.emitFile(asset));
|
|
17658
17704
|
}
|
|
17659
17705
|
};
|
|
17660
17706
|
}
|
|
@@ -18806,7 +18852,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
18806
18852
|
});
|
|
18807
18853
|
rewriteJsonNpmImportsToLocalRoot(rolldownBundle, "", void 0, npmBuildCandidateDependencies, configService.cwd);
|
|
18808
18854
|
}
|
|
18809
|
-
normalizePreprocessorStyleAssets(rolldownBundle, state.ctx.configService.outputExtensions?.wxss);
|
|
18855
|
+
normalizePreprocessorStyleAssets(rolldownBundle, state.ctx.configService.outputExtensions?.wxss, (asset) => this.emitFile(asset));
|
|
18810
18856
|
return;
|
|
18811
18857
|
}
|
|
18812
18858
|
if (!subPackageMeta) {
|
|
@@ -18968,7 +19014,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
|
|
|
18968
19014
|
stabilizeWevuRuntimeChunkAccess(rolldownBundle);
|
|
18969
19015
|
syncChunkImportsFromRequireCalls(rolldownBundle);
|
|
18970
19016
|
prunePartialHmrStableSharedChunks(rolldownBundle, state);
|
|
18971
|
-
normalizePreprocessorStyleAssets(rolldownBundle, state.ctx.configService.outputExtensions?.wxss);
|
|
19017
|
+
normalizePreprocessorStyleAssets(rolldownBundle, state.ctx.configService.outputExtensions?.wxss, (asset) => this.emitFile(asset));
|
|
18972
19018
|
refreshModuleGraph(this, state);
|
|
18973
19019
|
if (configService.weappViteConfig?.debug?.watchFiles) {
|
|
18974
19020
|
const watcherService = ctx.watcherService;
|
|
@@ -19375,13 +19421,14 @@ function resolveInjectWeapiOptions(configService) {
|
|
|
19375
19421
|
if (!(typeof injectWeapi === "object" ? injectWeapi.enabled === true : injectWeapi === true) || typeof injectWeapi !== "object" || injectWeapi.replaceWx !== true) return null;
|
|
19376
19422
|
return { globalName: injectWeapi.globalName?.trim() || "wpi" };
|
|
19377
19423
|
}
|
|
19378
|
-
function shouldTransformId(id,
|
|
19424
|
+
function shouldTransformId(id, options) {
|
|
19379
19425
|
if (isCSSRequest(id)) return false;
|
|
19380
19426
|
if (parseRequest(id).query.type === "style") return false;
|
|
19381
19427
|
const sourceId = normalizeFsResolvedId(id);
|
|
19382
|
-
if (!sourceId
|
|
19383
|
-
if (sourceId === absoluteSrcRoot) return true;
|
|
19384
|
-
|
|
19428
|
+
if (!sourceId) return false;
|
|
19429
|
+
if (sourceId === options.absoluteSrcRoot) return true;
|
|
19430
|
+
if (sourceId.startsWith(`${options.absoluteSrcRoot}/`)) return true;
|
|
19431
|
+
return options.isEntry?.(sourceId) === true;
|
|
19385
19432
|
}
|
|
19386
19433
|
//#endregion
|
|
19387
19434
|
//#region src/plugins/core/lifecycle/transform/index.ts
|
|
@@ -19419,7 +19466,10 @@ function createTransformHook(state) {
|
|
|
19419
19466
|
}
|
|
19420
19467
|
return async function transform(code, id) {
|
|
19421
19468
|
const injectOptions = resolveInjectWeapiOptions(configService);
|
|
19422
|
-
if (!shouldTransformId(id,
|
|
19469
|
+
if (!shouldTransformId(id, {
|
|
19470
|
+
absoluteSrcRoot: configService.absoluteSrcRoot,
|
|
19471
|
+
isEntry: (sourceId) => state.loadedEntrySet?.has(sourceId) === true || state.resolvedEntryMap?.has(sourceId) === true
|
|
19472
|
+
})) return null;
|
|
19423
19473
|
const startedAt = performance.now();
|
|
19424
19474
|
try {
|
|
19425
19475
|
const sourceId = normalizeFsResolvedId(id);
|
|
@@ -19868,11 +19918,14 @@ function createBuildStartHook(state) {
|
|
|
19868
19918
|
const isPluginBuild = buildTarget === "plugin";
|
|
19869
19919
|
return async function buildStart() {
|
|
19870
19920
|
resetTakeImportRegistry({ preserveSharedChunkNameCache: configService.isDev });
|
|
19871
|
-
if (configService.isDev)
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19921
|
+
if (configService.isDev) {
|
|
19922
|
+
addNormalizedWatchFiles(this, configService.configFileDependencies);
|
|
19923
|
+
if (isPluginBuild) {
|
|
19924
|
+
if (configService.absolutePluginRoot) ensureSidecarWatcher(ctx, configService.absolutePluginRoot);
|
|
19925
|
+
} else {
|
|
19926
|
+
ensureSidecarWatcher(ctx, subPackageMeta ? path.resolve(configService.absoluteSrcRoot, subPackageMeta.subPackage.root) : configService.absoluteSrcRoot);
|
|
19927
|
+
if (!subPackageMeta && configService.absolutePluginRoot) ensureSidecarWatcher(ctx, configService.absolutePluginRoot);
|
|
19928
|
+
}
|
|
19876
19929
|
}
|
|
19877
19930
|
await emitDirtyEntries.call(this);
|
|
19878
19931
|
};
|
|
@@ -20966,6 +21019,7 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
|
|
|
20966
21019
|
const scopedSlotsCompiler = configService.weappViteConfig?.vue?.template?.scopedSlotsCompiler ?? "auto";
|
|
20967
21020
|
const scopedSlotsRequireProps = configService.weappViteConfig?.vue?.template?.scopedSlotsRequireProps ?? false;
|
|
20968
21021
|
const slotSingleRootNoWrapper = configService.weappViteConfig?.vue?.template?.slotSingleRootNoWrapper ?? false;
|
|
21022
|
+
const slotFallbackWrapper = configService.weappViteConfig?.vue?.template?.slotFallbackWrapper;
|
|
20969
21023
|
const slotMultipleInstance = configService.weappViteConfig?.vue?.template?.slotMultipleInstance ?? true;
|
|
20970
21024
|
const htmlTagToWxml = configService.weappViteConfig?.vue?.template?.htmlTagToWxml;
|
|
20971
21025
|
const htmlTagToWxmlTagClass = configService.weappViteConfig?.vue?.template?.htmlTagToWxmlTagClass ?? true;
|
|
@@ -21056,6 +21110,7 @@ function buildCompileVueFileOptions(ctx, pluginCtx, vuePath, isPage, isApp, conf
|
|
|
21056
21110
|
scopedSlotsCompiler,
|
|
21057
21111
|
scopedSlotsRequireProps,
|
|
21058
21112
|
slotSingleRootNoWrapper,
|
|
21113
|
+
slotFallbackWrapper,
|
|
21059
21114
|
slotMultipleInstance,
|
|
21060
21115
|
classStyleRuntime: templatePlatformOptions.classStyleRuntime,
|
|
21061
21116
|
objectLiteralBindMode,
|
|
@@ -23116,10 +23171,10 @@ function createAbsolutePathPattern(value) {
|
|
|
23116
23171
|
return value.split(PATH_SEPARATOR_SPLIT_REGEX).map((segment) => escapeRegex(segment)).join("[/\\\\]+");
|
|
23117
23172
|
}
|
|
23118
23173
|
function normalizeInlineConfigAfterDefu(inline, options) {
|
|
23119
|
-
const { ctx, platform, rolldownOptions, subPackageMeta } = options;
|
|
23174
|
+
const { cwd, ctx, platform, rolldownOptions, subPackageMeta } = options;
|
|
23120
23175
|
const build = inline.build ?? (inline.build = {});
|
|
23121
23176
|
const userRolldownOptions = build.rolldownOptions;
|
|
23122
|
-
|
|
23177
|
+
const mergedRolldownOptions = {
|
|
23123
23178
|
...userRolldownOptions ?? {},
|
|
23124
23179
|
...rolldownOptions,
|
|
23125
23180
|
output: {
|
|
@@ -23127,6 +23182,9 @@ function normalizeInlineConfigAfterDefu(inline, options) {
|
|
|
23127
23182
|
...userRolldownOptions?.output ?? {}
|
|
23128
23183
|
}
|
|
23129
23184
|
};
|
|
23185
|
+
const rootTsconfig = path.resolve(cwd, "tsconfig.json");
|
|
23186
|
+
if (!Object.prototype.hasOwnProperty.call(mergedRolldownOptions, "tsconfig") && !mergedRolldownOptions.resolve?.tsconfigFilename && existsSync(rootTsconfig)) mergedRolldownOptions.tsconfig = rootTsconfig;
|
|
23187
|
+
build.rolldownOptions = mergedRolldownOptions;
|
|
23130
23188
|
inline.define = {
|
|
23131
23189
|
...inline.define ?? {},
|
|
23132
23190
|
__VITE_IS_MODERN__: "false"
|
|
@@ -23137,16 +23195,25 @@ function normalizeInlineConfigAfterDefu(inline, options) {
|
|
|
23137
23195
|
}
|
|
23138
23196
|
function resolveMiniprogramWatchInclude(options) {
|
|
23139
23197
|
const srcRoot = path.join(options.cwd, options.srcRoot);
|
|
23140
|
-
const watchInclude = options.buildScope?.enabled ? [...options.buildScope.includeMainPackage ? [path.join(srcRoot, "pages", "**")] : [], ...options.buildScope.subPackageRoots.map((root) => path.join(srcRoot, root, "**"))] : [path.join(srcRoot, "**")];
|
|
23141
|
-
if (
|
|
23142
|
-
|
|
23143
|
-
|
|
23144
|
-
|
|
23145
|
-
|
|
23146
|
-
|
|
23198
|
+
const watchInclude = ["**", ...options.buildScope?.enabled ? [...options.buildScope.includeMainPackage ? [path.join(srcRoot, "pages", "**")] : [], ...options.buildScope.subPackageRoots.map((root) => path.join(srcRoot, root, "**"))] : [path.join(srcRoot, "**")]];
|
|
23199
|
+
if (options.pluginRoot) {
|
|
23200
|
+
const absolutePluginRoot = path.resolve(options.cwd, options.pluginRoot);
|
|
23201
|
+
const relativeToSrc = path.relative(path.resolve(options.cwd, options.srcRoot), absolutePluginRoot);
|
|
23202
|
+
const pluginPatternBase = relativeToSrc.startsWith("..") ? absolutePluginRoot : path.join(options.cwd, options.srcRoot, relativeToSrc);
|
|
23203
|
+
watchInclude.push(path.join(pluginPatternBase, "**"));
|
|
23204
|
+
}
|
|
23205
|
+
for (const dependency of options.configFileDependencies ?? []) watchInclude.push(dependency);
|
|
23206
|
+
const userInclude = Array.isArray(options.userInclude) ? options.userInclude : options.userInclude ? [options.userInclude] : [];
|
|
23207
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23208
|
+
return [...userInclude, ...watchInclude].filter((item) => {
|
|
23209
|
+
if (typeof item !== "string") return true;
|
|
23210
|
+
if (seen.has(item)) return false;
|
|
23211
|
+
seen.add(item);
|
|
23212
|
+
return true;
|
|
23213
|
+
});
|
|
23147
23214
|
}
|
|
23148
23215
|
function mergeMiniprogram(options, ...configs) {
|
|
23149
|
-
const { ctx, subPackageMeta, config, cwd, srcRoot, mpDistRoot, packageJson, isDev, applyRuntimePlatform, injectBuiltinAliases, getDefineImportMetaEnv, setOptions, oxcRolldownPlugin } = options;
|
|
23216
|
+
const { ctx, subPackageMeta, config, cwd, srcRoot, mpDistRoot, configFileDependencies = [], packageJson, isDev, applyRuntimePlatform, injectBuiltinAliases, getDefineImportMetaEnv, setOptions, oxcRolldownPlugin } = options;
|
|
23150
23217
|
const platform = ctx.configService?.platform;
|
|
23151
23218
|
applyRuntimePlatform("miniprogram");
|
|
23152
23219
|
const createMiniprogramCustomLogger = () => {
|
|
@@ -23181,7 +23248,8 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
23181
23248
|
cwd,
|
|
23182
23249
|
srcRoot,
|
|
23183
23250
|
pluginRoot: config.weapp?.pluginRoot,
|
|
23184
|
-
buildScope: resolveBuildScope(config.weapp?.buildScope)
|
|
23251
|
+
buildScope: resolveBuildScope(config.weapp?.buildScope),
|
|
23252
|
+
configFileDependencies
|
|
23185
23253
|
});
|
|
23186
23254
|
const inline = defu(config, ...configs, {
|
|
23187
23255
|
root: cwd,
|
|
@@ -23202,6 +23270,7 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
23202
23270
|
}
|
|
23203
23271
|
});
|
|
23204
23272
|
normalizeInlineConfigAfterDefu(inline, {
|
|
23273
|
+
cwd,
|
|
23205
23274
|
ctx,
|
|
23206
23275
|
platform,
|
|
23207
23276
|
rolldownOptions,
|
|
@@ -23222,6 +23291,7 @@ function mergeMiniprogram(options, ...configs) {
|
|
|
23222
23291
|
}
|
|
23223
23292
|
});
|
|
23224
23293
|
normalizeInlineConfigAfterDefu(inlineConfig, {
|
|
23294
|
+
cwd,
|
|
23225
23295
|
ctx,
|
|
23226
23296
|
platform,
|
|
23227
23297
|
rolldownOptions,
|
|
@@ -23348,6 +23418,7 @@ function createMergeFactories(options) {
|
|
|
23348
23418
|
cwd: currentOptions.cwd,
|
|
23349
23419
|
srcRoot: currentOptions.srcRoot,
|
|
23350
23420
|
mpDistRoot: currentOptions.mpDistRoot,
|
|
23421
|
+
configFileDependencies: currentOptions.configFileDependencies,
|
|
23351
23422
|
packageJson: currentOptions.packageJson,
|
|
23352
23423
|
isDev: currentOptions.isDev,
|
|
23353
23424
|
applyRuntimePlatform,
|
|
@@ -23466,6 +23537,12 @@ function createConfigService(ctx) {
|
|
|
23466
23537
|
}
|
|
23467
23538
|
return normalizedRelative;
|
|
23468
23539
|
};
|
|
23540
|
+
const resolveExternalOutputPath = (filePath) => {
|
|
23541
|
+
const normalizedPath = normalizeComparablePath(filePath);
|
|
23542
|
+
const normalizedDir = path.dirname(normalizedPath);
|
|
23543
|
+
const dirHash = createHash("sha256").update(normalizedDir).digest("hex").slice(0, 10);
|
|
23544
|
+
return normalizeRelativePath$1(path.join("__weapp_vite_external__", dirHash, path.basename(normalizedPath)));
|
|
23545
|
+
};
|
|
23469
23546
|
function setOptions(value) {
|
|
23470
23547
|
options = value;
|
|
23471
23548
|
configState.options = value;
|
|
@@ -23546,7 +23623,8 @@ function createConfigService(ctx) {
|
|
|
23546
23623
|
multiPlatform: resolveMultiPlatformConfig(false),
|
|
23547
23624
|
configFilePath: void 0,
|
|
23548
23625
|
currentSubPackageRoot: void 0,
|
|
23549
|
-
weappWeb: void 0
|
|
23626
|
+
weappWeb: void 0,
|
|
23627
|
+
configFileDependencies: []
|
|
23550
23628
|
});
|
|
23551
23629
|
setOptions(resolvedConfig);
|
|
23552
23630
|
configureLogger(resolvedConfig.config.weapp?.logger);
|
|
@@ -23682,6 +23760,9 @@ function createConfigService(ctx) {
|
|
|
23682
23760
|
get configFilePath() {
|
|
23683
23761
|
return options.configFilePath;
|
|
23684
23762
|
},
|
|
23763
|
+
get configFileDependencies() {
|
|
23764
|
+
return options.configFileDependencies;
|
|
23765
|
+
},
|
|
23685
23766
|
get weappWebConfig() {
|
|
23686
23767
|
return options.weappWeb;
|
|
23687
23768
|
},
|
|
@@ -23717,6 +23798,7 @@ function createConfigService(ctx) {
|
|
|
23717
23798
|
relativeOutputPath(p) {
|
|
23718
23799
|
const relative = this.relativeAbsoluteSrcRoot(p);
|
|
23719
23800
|
if (!relative) return relative;
|
|
23801
|
+
if (relative.startsWith("..") || relative === "node_modules" || relative.startsWith("node_modules/")) return resolveExternalOutputPath(p);
|
|
23720
23802
|
const libOutputMap = options.weappLibOutputMap;
|
|
23721
23803
|
if (libOutputMap && libOutputMap.size > 0) {
|
|
23722
23804
|
const base = normalizeRelativePath$1(removeExtensionDeep(relative));
|
|
@@ -23943,6 +24025,7 @@ function createDefaultLoadConfigResult() {
|
|
|
23943
24025
|
platform: DEFAULT_MP_PLATFORM,
|
|
23944
24026
|
srcRoot: "",
|
|
23945
24027
|
configFilePath: void 0,
|
|
24028
|
+
configFileDependencies: [],
|
|
23946
24029
|
weappWeb: void 0,
|
|
23947
24030
|
configMergeInfo: void 0
|
|
23948
24031
|
};
|
|
@@ -23995,6 +24078,7 @@ function createRuntimeState() {
|
|
|
23995
24078
|
dirtyEntrySet: /* @__PURE__ */ new Set(),
|
|
23996
24079
|
dirtyEntryReasons: /* @__PURE__ */ new Map(),
|
|
23997
24080
|
resolvedEntryMap: /* @__PURE__ */ new Map(),
|
|
24081
|
+
externalComponentEntryMap: /* @__PURE__ */ new Map(),
|
|
23998
24082
|
entriesMap: /* @__PURE__ */ new Map(),
|
|
23999
24083
|
layoutEntryDependents: /* @__PURE__ */ new Map(),
|
|
24000
24084
|
entryLayoutDependencies: /* @__PURE__ */ new Map(),
|
|
@@ -24189,7 +24273,7 @@ async function loadAppEntry(ctx, scanState) {
|
|
|
24189
24273
|
const vueAppPath = await findVueEntry(appBasename);
|
|
24190
24274
|
let configFromVue;
|
|
24191
24275
|
if (!appConfigFile && vueAppPath) {
|
|
24192
|
-
const { extractConfigFromVue } = await import("./file-
|
|
24276
|
+
const { extractConfigFromVue } = await import("./file-Cjctfg-V.mjs");
|
|
24193
24277
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
24194
24278
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
24195
24279
|
}
|
package/dist/docs/README.md
CHANGED
|
@@ -60,6 +60,8 @@ export default defineConfig({
|
|
|
60
60
|
把 `div/span/img/a/h1...` 等常见 HTML 标签映射成小程序内置标签。
|
|
61
61
|
- `weapp.vue.template.htmlTagToWxmlTagClass`
|
|
62
62
|
默认开启。在映射发生时追加原标签名 class,例如 `h3 -> <view class="h3">`、`br -> <view class="br" />`,便于你自己写 CSS 低成本恢复默认外观;不需要时可设为 `false`。
|
|
63
|
+
- `weapp.vue.template.slotFallbackWrapper`
|
|
64
|
+
配置普通具名插槽 fallback 的真实 wrapper,支持全局默认、按模板标签名 `component` / 子组件静态 `defineOptions({ name })` 的 `componentName` / slot 规则,以及组件内 `slot-wrapper` / `slot-wrapper-class` 静态覆盖。单个 slot 的局部策略更推荐写在对应的 `<template #xxx>` 上,例如 `<template #header slot-wrapper="cover-view">`。转发 `<slot />` 时不要使用 `<block slot="...">` 作为 wrapper,真实 DevTools 运行时会丢内容。
|
|
63
65
|
|
|
64
66
|
```vue
|
|
65
67
|
<!-- App.vue -->
|
package/dist/docs/vue-sfc.md
CHANGED
|
@@ -67,6 +67,225 @@
|
|
|
67
67
|
<view class="br" />
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
+
## 具名插槽透传 wrapper
|
|
71
|
+
|
|
72
|
+
当你把当前组件的 `<slot />` 转发到子组件的具名插槽时:
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<IssueCard>
|
|
76
|
+
<template #header>
|
|
77
|
+
<slot />
|
|
78
|
+
</template>
|
|
79
|
+
</IssueCard>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
编译器会使用真实节点 wrapper,默认类似:
|
|
83
|
+
|
|
84
|
+
```wxml
|
|
85
|
+
<view slot="header">
|
|
86
|
+
<slot />
|
|
87
|
+
</view>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
不要改成 `<block slot="header"><slot /></block>`。真实 WeChat DevTools 运行时里,这种写法会出现宿主 header,但转发内容不会渲染。
|
|
91
|
+
|
|
92
|
+
如果需要自定义 wrapper,可以在组件使用处写静态属性。组件内配置推荐使用普通 kebab-case 静态属性,避免和 Vue 指令参数语法混淆。
|
|
93
|
+
|
|
94
|
+
`slot-wrapper` 是当前组件所有普通具名插槽的默认 wrapper:
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<template>
|
|
98
|
+
<IssueCard slot-wrapper="cover-view">
|
|
99
|
+
<template #header>
|
|
100
|
+
<slot />
|
|
101
|
+
</template>
|
|
102
|
+
<template #footer>
|
|
103
|
+
<slot name="footer" />
|
|
104
|
+
</template>
|
|
105
|
+
</IssueCard>
|
|
106
|
+
</template>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
产物:
|
|
110
|
+
|
|
111
|
+
```wxml
|
|
112
|
+
<IssueCard>
|
|
113
|
+
<cover-view slot="header">
|
|
114
|
+
<slot />
|
|
115
|
+
</cover-view>
|
|
116
|
+
<cover-view slot="footer">
|
|
117
|
+
<slot name="footer" />
|
|
118
|
+
</cover-view>
|
|
119
|
+
</IssueCard>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`slot-wrapper-<slotName>` 只覆盖指定具名插槽;单个 slot 的覆盖更推荐直接写在对应的 `<template #xxx>` 上:
|
|
123
|
+
|
|
124
|
+
```vue
|
|
125
|
+
<template>
|
|
126
|
+
<IssueCard slot-wrapper="cover-view">
|
|
127
|
+
<template #header>
|
|
128
|
+
<slot />
|
|
129
|
+
</template>
|
|
130
|
+
<template #footer slot-wrapper="view">
|
|
131
|
+
<slot name="footer" />
|
|
132
|
+
</template>
|
|
133
|
+
</IssueCard>
|
|
134
|
+
</template>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
产物中 `header` 使用 `slot-wrapper="cover-view"`,`footer` 在对应的 `<template #footer>` 上覆盖:
|
|
138
|
+
|
|
139
|
+
```wxml
|
|
140
|
+
<IssueCard>
|
|
141
|
+
<cover-view slot="header">
|
|
142
|
+
<slot />
|
|
143
|
+
</cover-view>
|
|
144
|
+
<view slot="footer">
|
|
145
|
+
<slot name="footer" />
|
|
146
|
+
</view>
|
|
147
|
+
</IssueCard>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
只覆盖单个 slot 时,更推荐把配置写在对应的 `<template #xxx>` 上。这个写法最靠近 slot 内容,优先级高于父组件标签上的默认值和 `slot-wrapper-<slotName>`:
|
|
151
|
+
|
|
152
|
+
```vue
|
|
153
|
+
<template>
|
|
154
|
+
<IssueCard slot-wrapper="cover-view">
|
|
155
|
+
<template #header slot-wrapper="text" slot-wrapper-class="slot-header">
|
|
156
|
+
<slot />
|
|
157
|
+
</template>
|
|
158
|
+
<template #footer>
|
|
159
|
+
<slot name="footer" />
|
|
160
|
+
</template>
|
|
161
|
+
</IssueCard>
|
|
162
|
+
</template>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
产物:
|
|
166
|
+
|
|
167
|
+
```wxml
|
|
168
|
+
<IssueCard>
|
|
169
|
+
<text slot="header" class="slot-header">
|
|
170
|
+
<slot />
|
|
171
|
+
</text>
|
|
172
|
+
<cover-view slot="footer">
|
|
173
|
+
<slot name="footer" />
|
|
174
|
+
</cover-view>
|
|
175
|
+
</IssueCard>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
在 `<template #header>` 上配置时,属性仍写 `slot-wrapper` / `slot-wrapper-class` / `slot-wrapper-style` / `slot-single-root-no-wrapper`,不需要再带 `header` 后缀。
|
|
179
|
+
|
|
180
|
+
也可以把 class/style 加到生成的 wrapper 上,而不是加到组件本身:
|
|
181
|
+
|
|
182
|
+
```vue
|
|
183
|
+
<template>
|
|
184
|
+
<IssueCard slot-wrapper="cover-view">
|
|
185
|
+
<template #header slot-wrapper="cover-view" slot-wrapper-class="slot-default" slot-wrapper-style="padding: 8px">
|
|
186
|
+
<slot />
|
|
187
|
+
</template>
|
|
188
|
+
<template
|
|
189
|
+
#footer
|
|
190
|
+
slot-wrapper="view"
|
|
191
|
+
slot-wrapper-class="slot-footer"
|
|
192
|
+
slot-wrapper-style="margin-top: 12px"
|
|
193
|
+
>
|
|
194
|
+
<slot name="footer" />
|
|
195
|
+
</template>
|
|
196
|
+
</IssueCard>
|
|
197
|
+
</template>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
产物:
|
|
201
|
+
|
|
202
|
+
```wxml
|
|
203
|
+
<IssueCard>
|
|
204
|
+
<cover-view slot="header" class="slot-default" style="padding: 8px">
|
|
205
|
+
<slot />
|
|
206
|
+
</cover-view>
|
|
207
|
+
<view slot="footer" class="slot-footer" style="margin-top: 12px">
|
|
208
|
+
<slot name="footer" />
|
|
209
|
+
</view>
|
|
210
|
+
</IssueCard>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
动态绑定也支持,例如父组件标签上的 `:slot-wrapper-class="headerClass"` / `:slot-wrapper-style="headerStyle"`,以及 `<template #footer :slot-wrapper-class="footerClass">` 这种单 slot 就近覆盖。
|
|
214
|
+
|
|
215
|
+
`slot-single-root-no-wrapper-<slotName>` 可以让指定插槽在单根真实节点场景下尽量下推 `slot="..."`:
|
|
216
|
+
|
|
217
|
+
```vue
|
|
218
|
+
<template>
|
|
219
|
+
<IssueCard slot-single-root-no-wrapper-icon>
|
|
220
|
+
<template #icon>
|
|
221
|
+
<image src="/assets/icon.png" />
|
|
222
|
+
</template>
|
|
223
|
+
</IssueCard>
|
|
224
|
+
</template>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
产物:
|
|
228
|
+
|
|
229
|
+
```wxml
|
|
230
|
+
<IssueCard>
|
|
231
|
+
<image slot="icon" src="/assets/icon.png" />
|
|
232
|
+
</IssueCard>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
这个下推策略不适用于转发 `<slot />`。转发内容仍会保留真实 wrapper:
|
|
236
|
+
|
|
237
|
+
```vue
|
|
238
|
+
<template>
|
|
239
|
+
<IssueCard slot-single-root-no-wrapper-header>
|
|
240
|
+
<template #header>
|
|
241
|
+
<slot />
|
|
242
|
+
</template>
|
|
243
|
+
</IssueCard>
|
|
244
|
+
</template>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```wxml
|
|
248
|
+
<IssueCard>
|
|
249
|
+
<view slot="header">
|
|
250
|
+
<slot />
|
|
251
|
+
</view>
|
|
252
|
+
</IssueCard>
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
`block` 会被编译器拒绝并回退到 `view`。例如全局配置 `slotFallbackWrapper: 'block'` 后,转发 `<slot />` 的场景仍会生成:
|
|
256
|
+
|
|
257
|
+
```wxml
|
|
258
|
+
<IssueCard>
|
|
259
|
+
<view slot="header">
|
|
260
|
+
<slot />
|
|
261
|
+
</view>
|
|
262
|
+
</IssueCard>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
编译器会输出 warning:`slot fallback wrapper 不支持配置为 block,已回退为 view。`
|
|
266
|
+
|
|
267
|
+
你选择的 wrapper 必须能承载实际内容。比如下面的写法会让 `text` 包裹 `view`,这不适合真实运行时:
|
|
268
|
+
|
|
269
|
+
```vue
|
|
270
|
+
<template>
|
|
271
|
+
<IssueCard>
|
|
272
|
+
<template #header slot-wrapper="text">
|
|
273
|
+
<view>Header</view>
|
|
274
|
+
</template>
|
|
275
|
+
</IssueCard>
|
|
276
|
+
</template>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
```wxml
|
|
280
|
+
<IssueCard>
|
|
281
|
+
<text slot="header">
|
|
282
|
+
<view>Header</view>
|
|
283
|
+
</text>
|
|
284
|
+
</IssueCard>
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
也可以通过 `weapp.vue.template.slotFallbackWrapper` 全局配置,按组件和具名插槽匹配。`rules[].component` 匹配使用处模板标签名;`rules[].componentName` 匹配子组件里的静态 `defineOptions({ name: 'HelloWorld' })`。`componentName` 需要编译器能解析到被引用的 Vue SFC,原生小程序组件继续用 `component`。
|
|
288
|
+
|
|
70
289
|
## 何时继续看其他文档
|
|
71
290
|
|
|
72
291
|
- 需要更完整的编辑器提示说明:[`../volar.md`](../volar.md)
|
|
@@ -72,6 +72,203 @@ export default defineConfig({
|
|
|
72
72
|
|
|
73
73
|
格式化只处理标签层级缩进,含文本内容的元素会保持单行,避免重排文本空白语义。
|
|
74
74
|
|
|
75
|
+
### `vue.template.slotFallbackWrapper`
|
|
76
|
+
|
|
77
|
+
用于配置普通具名插槽 fallback 的真实 wrapper。默认是 `view`。
|
|
78
|
+
|
|
79
|
+
当组件把自己的默认 `<slot />` 继续透传到子组件的具名插槽时,编译器不能生成 `<slot slot="header" />`,也不能稳定使用 `<block slot="header"><slot /></block>`。真实 WeChat DevTools 运行时中,`block` 路径会丢失转发内容。因此默认产物是:
|
|
80
|
+
|
|
81
|
+
```wxml
|
|
82
|
+
<view slot="header">
|
|
83
|
+
<slot />
|
|
84
|
+
</view>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
全局配置示例:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
91
|
+
|
|
92
|
+
export default defineConfig({
|
|
93
|
+
weapp: {
|
|
94
|
+
vue: {
|
|
95
|
+
template: {
|
|
96
|
+
slotFallbackWrapper: {
|
|
97
|
+
tag: 'view',
|
|
98
|
+
attrs: {
|
|
99
|
+
class: 'slot-wrapper',
|
|
100
|
+
},
|
|
101
|
+
rules: [
|
|
102
|
+
{ component: 'IssueCard', slot: 'header', tag: 'cover-view' },
|
|
103
|
+
{ componentName: 'HelloWorld', slot: 'header', tag: 'cover-view' },
|
|
104
|
+
{ component: 'IssueCard', slot: 'footer', attrs: { class: 'slot-footer' } },
|
|
105
|
+
{ component: /^Van/, slot: ['title', 'label'], tag: 'view' },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
})
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
`component` 匹配使用处模板标签名,例如 `<IssueCard>` 对应 `IssueCard`,`<issue-card>` 对应 `issue-card`。如果要按子组件自己的名字匹配,让子组件写静态 `defineOptions({ name: 'HelloWorld' })`,然后使用 `componentName: 'HelloWorld'`。`componentName` 需要编译器能解析到被引用的 Vue SFC;原生小程序组件或第三方小程序组件继续用 `component`。
|
|
115
|
+
|
|
116
|
+
组件内也可以用静态属性覆盖。`slot-wrapper` 是当前组件所有普通具名插槽的默认 wrapper:
|
|
117
|
+
|
|
118
|
+
```vue
|
|
119
|
+
<template>
|
|
120
|
+
<IssueCard slot-wrapper="cover-view">
|
|
121
|
+
<template #header>
|
|
122
|
+
<slot />
|
|
123
|
+
</template>
|
|
124
|
+
<template #footer>
|
|
125
|
+
<slot name="footer" />
|
|
126
|
+
</template>
|
|
127
|
+
</IssueCard>
|
|
128
|
+
</template>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
产物:
|
|
132
|
+
|
|
133
|
+
```wxml
|
|
134
|
+
<IssueCard>
|
|
135
|
+
<cover-view slot="header">
|
|
136
|
+
<slot />
|
|
137
|
+
</cover-view>
|
|
138
|
+
<cover-view slot="footer">
|
|
139
|
+
<slot name="footer" />
|
|
140
|
+
</cover-view>
|
|
141
|
+
</IssueCard>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`slot-wrapper-<slotName>` 覆盖指定具名插槽。单个 slot 的覆盖更推荐直接写在对应的 `<template #xxx>` 上:
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<template>
|
|
148
|
+
<IssueCard slot-wrapper="cover-view">
|
|
149
|
+
<template #header>
|
|
150
|
+
<slot />
|
|
151
|
+
</template>
|
|
152
|
+
<template #footer slot-wrapper="view">
|
|
153
|
+
<slot name="footer" />
|
|
154
|
+
</template>
|
|
155
|
+
</IssueCard>
|
|
156
|
+
</template>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
产物:
|
|
160
|
+
|
|
161
|
+
```wxml
|
|
162
|
+
<IssueCard>
|
|
163
|
+
<cover-view slot="header">
|
|
164
|
+
<slot />
|
|
165
|
+
</cover-view>
|
|
166
|
+
<view slot="footer">
|
|
167
|
+
<slot name="footer" />
|
|
168
|
+
</view>
|
|
169
|
+
</IssueCard>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
也可以把单个 slot 的覆盖配置写在对应的 `<template #xxx>` 上。这个写法最靠近 slot 内容,也更适合单个 slot 的局部策略:
|
|
173
|
+
|
|
174
|
+
```vue
|
|
175
|
+
<template>
|
|
176
|
+
<IssueCard slot-wrapper="cover-view">
|
|
177
|
+
<template #header slot-wrapper="text" slot-wrapper-class="slot-header">
|
|
178
|
+
<slot />
|
|
179
|
+
</template>
|
|
180
|
+
<template #footer>
|
|
181
|
+
<slot name="footer" />
|
|
182
|
+
</template>
|
|
183
|
+
</IssueCard>
|
|
184
|
+
</template>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`<template #header>` 上的 `slot-wrapper` / `slot-wrapper-class` / `slot-wrapper-style` / `slot-single-root-no-wrapper` 是该 slot 的就近覆盖,优先级高于父组件标签上的默认值和 `slot-wrapper-header`。
|
|
188
|
+
|
|
189
|
+
组件内还可以把 class/style 加到生成的 wrapper 上:
|
|
190
|
+
|
|
191
|
+
```vue
|
|
192
|
+
<template>
|
|
193
|
+
<IssueCard slot-wrapper="cover-view">
|
|
194
|
+
<template #header slot-wrapper="cover-view" slot-wrapper-class="slot-default" slot-wrapper-style="padding: 8px">
|
|
195
|
+
<slot />
|
|
196
|
+
</template>
|
|
197
|
+
<template
|
|
198
|
+
#footer
|
|
199
|
+
slot-wrapper="view"
|
|
200
|
+
slot-wrapper-class="slot-footer"
|
|
201
|
+
slot-wrapper-style="margin-top: 12px"
|
|
202
|
+
>
|
|
203
|
+
<slot name="footer" />
|
|
204
|
+
</template>
|
|
205
|
+
</IssueCard>
|
|
206
|
+
</template>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```wxml
|
|
210
|
+
<IssueCard>
|
|
211
|
+
<cover-view slot="header" class="slot-default" style="padding: 8px">
|
|
212
|
+
<slot />
|
|
213
|
+
</cover-view>
|
|
214
|
+
<view slot="footer" class="slot-footer" style="margin-top: 12px">
|
|
215
|
+
<slot name="footer" />
|
|
216
|
+
</view>
|
|
217
|
+
</IssueCard>
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
也支持 `:slot-wrapper-class="headerClass"` / `:slot-wrapper-style="headerStyle"` 这类动态绑定;单个 slot 更推荐写成 `<template #footer :slot-wrapper-class="footerClass">` 这种就近覆盖。参数名必须是静态的。
|
|
221
|
+
|
|
222
|
+
`slot-single-root-no-wrapper-<slotName>` 可以让指定插槽在单根真实节点场景下尽量下推 `slot="..."`:
|
|
223
|
+
|
|
224
|
+
```vue
|
|
225
|
+
<template>
|
|
226
|
+
<IssueCard slot-single-root-no-wrapper-icon>
|
|
227
|
+
<template #icon>
|
|
228
|
+
<image src="/assets/icon.png" />
|
|
229
|
+
</template>
|
|
230
|
+
</IssueCard>
|
|
231
|
+
</template>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
产物:
|
|
235
|
+
|
|
236
|
+
```wxml
|
|
237
|
+
<IssueCard>
|
|
238
|
+
<image slot="icon" src="/assets/icon.png" />
|
|
239
|
+
</IssueCard>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
如果插槽内容是转发 `<slot />`,即使配置了 `slot-single-root-no-wrapper-header`,仍会保留 wrapper:
|
|
243
|
+
|
|
244
|
+
```wxml
|
|
245
|
+
<IssueCard>
|
|
246
|
+
<view slot="header">
|
|
247
|
+
<slot />
|
|
248
|
+
</view>
|
|
249
|
+
</IssueCard>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
`block` 不允许作为 wrapper,会回退到 `view` 并输出 warning。自定义 wrapper 必须是目标小程序运行时可渲染、并且能承载当前 slot 内容的真实节点或组件。例如下面的写法会生成 `text` 包裹 `view`,这不适合真实运行时:
|
|
253
|
+
|
|
254
|
+
```vue
|
|
255
|
+
<template>
|
|
256
|
+
<IssueCard>
|
|
257
|
+
<template #header slot-wrapper="text">
|
|
258
|
+
<view>Header</view>
|
|
259
|
+
</template>
|
|
260
|
+
</IssueCard>
|
|
261
|
+
</template>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
```wxml
|
|
265
|
+
<IssueCard>
|
|
266
|
+
<text slot="header">
|
|
267
|
+
<view>Header</view>
|
|
268
|
+
</text>
|
|
269
|
+
</IssueCard>
|
|
270
|
+
```
|
|
271
|
+
|
|
75
272
|
### `layout`
|
|
76
273
|
|
|
77
274
|
页面 layout 既可能来自项目级规则,也可能来自页面侧 `definePageMeta`。排查时先确认是哪一层生效。
|
|
@@ -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-CjO8kDWJ.mjs");
|
|
88
88
|
const compilerContext = getCompilerContext();
|
|
89
89
|
const service = compilerContext.autoRoutesService;
|
|
90
90
|
const reference = service?.getReference?.();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $n as WebPlatform, A as Ref, Bn as WeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Gn as ResolveWeappViteTargetOptions, Hn as createWeappViteHostMeta, I as RolldownPluginOption, Jn as WeappVitePlatform, Kn as ResolvedWeappViteTarget, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Qn as WeappViteTargetKind, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Xn as WeappViteTargetDescriptor, Yn as WeappViteRuntime, Zn as WeappViteTargetInput, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, er as getSupportedWeappVitePlatforms, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, nr as isWebPlatform, o as UserConfigFnObject, p as Sitemap, qn as WEB_PLATFORM_ALIASES, r as UserConfigFn, rr as resolveWeappViteTarget, s as UserConfigFnObjectPlain, t as UserConfig, tr as getSupportedWeappViteTargetDescriptors, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as WEAPP_VITE_HOST_NAME } from "./config-
|
|
1
|
+
import { $n as WebPlatform, A as Ref, Bn as WeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, Gn as ResolveWeappViteTargetOptions, Hn as createWeappViteHostMeta, I as RolldownPluginOption, Jn as WeappVitePlatform, Kn as ResolvedWeappViteTarget, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Qn as WeappViteTargetKind, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, Un as isWeappViteHost, Vn as applyWeappViteHostMeta, Wn as resolveWeappViteHostMeta, Xn as WeappViteTargetDescriptor, Yn as WeappViteRuntime, Zn as WeappViteTargetInput, _ as definePageJson, a as UserConfigFnNoEnvPlain, at as WeappViteConfig, c as UserConfigFnPromise, d as Component, er as getSupportedWeappVitePlatforms, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, k as PluginOption, l as defineConfig, m as Theme, n as UserConfigExport, nr as isWebPlatform, o as UserConfigFnObject, p as Sitemap, qn as WEB_PLATFORM_ALIASES, r as UserConfigFn, rr as resolveWeappViteTarget, s as UserConfigFnObjectPlain, t as UserConfig, tr as getSupportedWeappViteTargetDescriptors, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer, zn as WEAPP_VITE_HOST_NAME } from "./config-DJ3SOkf9.mjs";
|
|
2
2
|
import { a as createWevuComponent, i as WevuComponentOptions, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-CDNs17Qq.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/createContext.d.ts
|
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-BL8Dhhk6.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost--CaeyWpA.mjs";
|
|
3
3
|
import { t as defineConfig } from "./config-DRGcCi3h.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-D64s5KsN.mjs";
|
|
5
5
|
import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-C3z9pDQB.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/dist/json.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
1
|
+
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-DJ3SOkf9.mjs";
|
|
2
2
|
export { type App, type Component, type Page, type Sitemap, type Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as WeappMcpConfig } from "./config-
|
|
1
|
+
import { Et as WeappMcpConfig } from "./config-DJ3SOkf9.mjs";
|
|
2
2
|
import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, DEFAULT_RUNTIME_REST_ENDPOINT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
|
|
3
3
|
|
|
4
4
|
//#region src/mcp.d.ts
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { c as Resolver } from "./index-Bmclyjw8.mjs";
|
|
2
2
|
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-C7fCmf92.mjs";
|
|
3
|
-
import { $ as WeappAnalyzeBudgetConfig, $t as GenerateTemplateFileSource, A as Ref, An as WeappLibFileName, At as WeappRouteRules, B as BindingErrorLike, Bn as WeappViteHostMeta, Bt as BuildNpmPackageMeta, Cn as SubPackageStyleConfigObject, Ct as WeappInjectWeapiConfig, D as MethodDefinitions, Dn as WeappLibConfig, Dt as WeappNpmConfig, E as InlineConfig, En as WeappLibComponentJson, Et as WeappMcpConfig, F as RolldownPlugin, Fn as WeappManagedServerTsconfigConfig, Ft as WeappWevuConfig, G as EntryJsonFragment, Gt as GenerateExtensionsOptions, H as BaseEntry, Ht as CopyGlobs, I as RolldownPluginOption, In as WeappManagedSharedTsconfigConfig, It as WeappWorkerConfig, J as ScanComponentItem, Jt as GenerateOptions, K as PageEntry, Kt as GenerateFileType, L as RolldownWatchOptions, Ln as WeappManagedTypeScriptConfig, Lt as Alias, M as RolldownBuild, Mn as WeappLibVueTscOptions, Mt as WeappVueConfig, N as RolldownOptions, Nn as WeappManagedAppTsconfigConfig, Nt as WeappVueTemplateConfig, O as Plugin, On as WeappLibDtsOptions, Ot as WeappRequestRuntimeConfig, P as RolldownOutput, Pn as WeappManagedNodeTsconfigConfig, Pt as WeappWebRuntimeConfig, Q as UserConfig, Qt as GenerateTemplateFactory, R as RolldownWatcher, Rn as WeappWebConfig, Rt as AliasOptions, Sn as SubPackageStyleConfigEntry, St as WeappInjectRequestGlobalsTarget, T as ConfigEnv, Tn as SubPackageStyleScope, Tt as WeappInjectWebRuntimeGlobalsTarget, U as ComponentEntry, Ut as CopyOptions, V as AppEntry, Vt as ChunksConfig, W as Entry, Wt as GenerateDirsOptions, X as ProjectConfig, Xt as GenerateTemplateContext, Y as WxmlDep, Yn as WeappViteRuntime, Yt as GenerateTemplate, Z as SubPackageMetaValue, Zt as GenerateTemplateEntry, _n as SharedChunkDynamicImports, _t as WeappAutoRoutesIncludePattern, an as JsonMergeContext, at as WeappViteConfig, b as ChangeEvent, bn as SharedChunkStrategy, bt as WeappHmrConfig, cn as JsonMergeStrategy, ct as EnhanceOptions, dn as NpmDependencyPattern, dt as MultiPlatformConfig, en as GenerateTemplateInlineSource, et as WeappAnalyzeConfig, fn as NpmMainPackageConfig, ft as ScanWxmlOptions, gn as ResolvedAlias, gt as WeappAutoRoutesInclude, hn as NpmSubPackageConfig, ht as WeappAutoRoutesConfig, in as JsonConfig, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as WeappLibInternalDtsOptions, jt as WeappSubPackageConfig, k as PluginOption, kn as WeappLibEntryContext, kt as WeappRouteRule, ln as MpPlatform, lt as EnhanceWxmlOptions, mn as NpmStrategy, mt as WeappAppPreludeMode, nn as GenerateTemplatesConfig, nt as WeappDebugConfig, on as JsonMergeFunction, ot as AutoImportComponents, pn as NpmPluginPackageConfig, pt as WeappAppPreludeConfig, q as ComponentsMap, qt as GenerateFilenamesOptions, rn as JsFormat, rt as WeappForwardConsoleConfig, sn as JsonMergeStage, st as AutoImportComponentsOption, tn as GenerateTemplateScope, tt as WeappAnalyzeHistoryConfig, un as NpmBuildOptions, ut as HandleWxmlOptions, vn as SharedChunkMode, vt as WeappBuildScopeConfig, w as ComputedDefinitions, wn as SubPackageStyleEntry, wt as WeappInjectWebRuntimeGlobalsConfig, x as WeappVitePluginApi, xn as SubPackage, xt as WeappInjectRequestGlobalsConfig, yn as SharedChunkOverride, yt as WeappBuildScopeObjectConfig, z as ViteDevServer, zt as AlipayNpmMode } from "./config-
|
|
3
|
+
import { $ as WeappAnalyzeBudgetConfig, $t as GenerateTemplateFileSource, A as Ref, An as WeappLibFileName, At as WeappRouteRules, B as BindingErrorLike, Bn as WeappViteHostMeta, Bt as BuildNpmPackageMeta, Cn as SubPackageStyleConfigObject, Ct as WeappInjectWeapiConfig, D as MethodDefinitions, Dn as WeappLibConfig, Dt as WeappNpmConfig, E as InlineConfig, En as WeappLibComponentJson, Et as WeappMcpConfig, F as RolldownPlugin, Fn as WeappManagedServerTsconfigConfig, Ft as WeappWevuConfig, G as EntryJsonFragment, Gt as GenerateExtensionsOptions, H as BaseEntry, Ht as CopyGlobs, I as RolldownPluginOption, In as WeappManagedSharedTsconfigConfig, It as WeappWorkerConfig, J as ScanComponentItem, Jt as GenerateOptions, K as PageEntry, Kt as GenerateFileType, L as RolldownWatchOptions, Ln as WeappManagedTypeScriptConfig, Lt as Alias, M as RolldownBuild, Mn as WeappLibVueTscOptions, Mt as WeappVueConfig, N as RolldownOptions, Nn as WeappManagedAppTsconfigConfig, Nt as WeappVueTemplateConfig, O as Plugin, On as WeappLibDtsOptions, Ot as WeappRequestRuntimeConfig, P as RolldownOutput, Pn as WeappManagedNodeTsconfigConfig, Pt as WeappWebRuntimeConfig, Q as UserConfig, Qt as GenerateTemplateFactory, R as RolldownWatcher, Rn as WeappWebConfig, Rt as AliasOptions, Sn as SubPackageStyleConfigEntry, St as WeappInjectRequestGlobalsTarget, T as ConfigEnv, Tn as SubPackageStyleScope, Tt as WeappInjectWebRuntimeGlobalsTarget, U as ComponentEntry, Ut as CopyOptions, V as AppEntry, Vt as ChunksConfig, W as Entry, Wt as GenerateDirsOptions, X as ProjectConfig, Xt as GenerateTemplateContext, Y as WxmlDep, Yn as WeappViteRuntime, Yt as GenerateTemplate, Z as SubPackageMetaValue, Zt as GenerateTemplateEntry, _n as SharedChunkDynamicImports, _t as WeappAutoRoutesIncludePattern, an as JsonMergeContext, at as WeappViteConfig, b as ChangeEvent, bn as SharedChunkStrategy, bt as WeappHmrConfig, cn as JsonMergeStrategy, ct as EnhanceOptions, dn as NpmDependencyPattern, dt as MultiPlatformConfig, en as GenerateTemplateInlineSource, et as WeappAnalyzeConfig, fn as NpmMainPackageConfig, ft as ScanWxmlOptions, gn as ResolvedAlias, gt as WeappAutoRoutesInclude, hn as NpmSubPackageConfig, ht as WeappAutoRoutesConfig, in as JsonConfig, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as WeappLibInternalDtsOptions, jt as WeappSubPackageConfig, k as PluginOption, kn as WeappLibEntryContext, kt as WeappRouteRule, ln as MpPlatform, lt as EnhanceWxmlOptions, mn as NpmStrategy, mt as WeappAppPreludeMode, nn as GenerateTemplatesConfig, nt as WeappDebugConfig, on as JsonMergeFunction, ot as AutoImportComponents, pn as NpmPluginPackageConfig, pt as WeappAppPreludeConfig, q as ComponentsMap, qt as GenerateFilenamesOptions, rn as JsFormat, rt as WeappForwardConsoleConfig, sn as JsonMergeStage, st as AutoImportComponentsOption, tn as GenerateTemplateScope, tt as WeappAnalyzeHistoryConfig, un as NpmBuildOptions, ut as HandleWxmlOptions, vn as SharedChunkMode, vt as WeappBuildScopeConfig, w as ComputedDefinitions, wn as SubPackageStyleEntry, wt as WeappInjectWebRuntimeGlobalsConfig, x as WeappVitePluginApi, xn as SubPackage, xt as WeappInjectRequestGlobalsConfig, yn as SharedChunkOverride, yt as WeappBuildScopeObjectConfig, z as ViteDevServer, zt as AlipayNpmMode } from "./config-DJ3SOkf9.mjs";
|
|
4
4
|
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, type ComputedDefinitions, type ConfigEnv, CopyGlobs, CopyOptions, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, type InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, type MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, type Plugin, type PluginOption, ProjectConfig, type Ref, ResolvedAlias, type ResolvedConfig, type Resolver, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, type ViteDevServer, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappBuildScopeConfig, WeappBuildScopeObjectConfig, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, type WeappViteHostMeta, WeappVitePluginApi, type WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
|
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.25",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"@jridgewell/remapping": "^2.3.5",
|
|
94
94
|
"@vercel/detect-agent": "^1.2.3",
|
|
95
95
|
"@volar/typescript": "^2.4.28",
|
|
96
|
-
"@vue/language-core": "^3.3.
|
|
96
|
+
"@vue/language-core": "^3.3.2",
|
|
97
97
|
"cac": "^7.0.0",
|
|
98
98
|
"chokidar": "^5.0.0",
|
|
99
99
|
"comment-json": "^5.0.0",
|
|
@@ -116,23 +116,23 @@
|
|
|
116
116
|
"vite": "8.0.14",
|
|
117
117
|
"vite-tsconfig-paths": "^6.1.1",
|
|
118
118
|
"vue": "^3.5.34",
|
|
119
|
-
"vue-tsc": "^3.3.
|
|
120
|
-
"@weapp-core/constants": "0.1.
|
|
119
|
+
"vue-tsc": "^3.3.2",
|
|
120
|
+
"@weapp-core/constants": "0.1.10",
|
|
121
121
|
"@weapp-core/init": "6.0.9",
|
|
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.25",
|
|
126
126
|
"@weapp-vite/mcp": "1.3.6",
|
|
127
127
|
"@weapp-vite/miniprogram-automator": "1.1.3",
|
|
128
128
|
"@weapp-vite/volar": "2.1.0",
|
|
129
|
-
"@weapp-vite/web": "1.3.
|
|
129
|
+
"@weapp-vite/web": "1.3.26",
|
|
130
130
|
"@wevu/api": "0.2.9",
|
|
131
|
-
"@wevu/web-apis": "1.2.
|
|
131
|
+
"@wevu/web-apis": "1.2.17",
|
|
132
132
|
"rolldown-require": "2.0.17",
|
|
133
133
|
"vite-plugin-performance": "2.0.1",
|
|
134
134
|
"weapp-ide-cli": "5.3.2",
|
|
135
|
-
"wevu": "6.16.
|
|
135
|
+
"wevu": "6.16.25"
|
|
136
136
|
},
|
|
137
137
|
"publishConfig": {
|
|
138
138
|
"access": "public",
|
package/dist/file-S0TAbkhK.mjs
DELETED