weapp-vite 6.13.1 → 6.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +2 -18
- package/dist/{config-WBWY_UlE.d.mts → config-CeCx5qMh.d.mts} +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-CwnO-Jw3.mjs → createContext-Dja7tL2g.mjs} +166 -54
- package/dist/{file-WyRp0uK0.mjs → file-MiE605t6.mjs} +1 -1
- 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 +5 -3
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getCompilerContext, l as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { i as getCompilerContext, l as getRouteRuntimeGlobalKeys } from "./createContext-Dja7tL2g.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 { _ as getDefaultIdeProjectRoot, b as shouldPassPlatformArgToIdeOpen, c as SHARED_CHUNK_VIRTUAL_PREFIX, d as checkRuntime, f as getProjectConfigFileName, g as DEFAULT_MP_PLATFORM, h as createCjsConfigLoadError, m as parseCommentJson, n as syncProjectSupportFiles, o as formatBytes, p as loadViteConfigFile, r as syncManagedTsconfigBootstrapFiles, s as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappConfigFile, v as normalizeMiniPlatform, x as isPathInside, y as resolveMiniPlatform } from "./createContext-
|
|
1
|
+
import { _ as getDefaultIdeProjectRoot, b as shouldPassPlatformArgToIdeOpen, c as SHARED_CHUNK_VIRTUAL_PREFIX, d as checkRuntime, f as getProjectConfigFileName, g as DEFAULT_MP_PLATFORM, h as createCjsConfigLoadError, m as parseCommentJson, n as syncProjectSupportFiles, o as formatBytes, p as loadViteConfigFile, r as syncManagedTsconfigBootstrapFiles, s as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappConfigFile, v as normalizeMiniPlatform, x as isPathInside, y as resolveMiniPlatform } from "./createContext-Dja7tL2g.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-gutcwWKE.mjs";
|
|
3
|
-
import { p as VERSION } from "./file-
|
|
3
|
+
import { p as VERSION } from "./file-MiE605t6.mjs";
|
|
4
4
|
import { resolveWeappMcpConfig, startWeappViteMcpServer } from "./mcp.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { defu } from "@weapp-core/shared";
|
|
@@ -353,18 +353,6 @@ function readDashboardManifest(packageJsonPath) {
|
|
|
353
353
|
return;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function resolveDashboardSourceRoot(packageRoot, manifest) {
|
|
357
|
-
const devRoot = manifest?.weappViteDashboard?.devRoot ?? ".";
|
|
358
|
-
const devConfigFile = manifest?.weappViteDashboard?.devConfigFile ?? "vite.config.ts";
|
|
359
|
-
const resolvedRoot = path.resolve(packageRoot, devRoot);
|
|
360
|
-
const viteConfigPath = path.resolve(packageRoot, devConfigFile);
|
|
361
|
-
const srcRoot = path.join(resolvedRoot, "src");
|
|
362
|
-
if (!fs$2.existsSync(viteConfigPath) || !fs$2.existsSync(srcRoot)) return;
|
|
363
|
-
return {
|
|
364
|
-
root: resolvedRoot,
|
|
365
|
-
configFile: viteConfigPath
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
356
|
function resolveDashboardDistRoot(packageRoot, manifest) {
|
|
369
357
|
const distDir = manifest?.weappViteDashboard?.distDir ?? "dist";
|
|
370
358
|
const distRoot = path.resolve(packageRoot, distDir);
|
|
@@ -384,10 +372,6 @@ function resolveDashboardRoot(options) {
|
|
|
384
372
|
dashboardManifest = void 0;
|
|
385
373
|
}
|
|
386
374
|
if (dashboardPackageRoot) {
|
|
387
|
-
if (options?.watch) {
|
|
388
|
-
const sourceResolved = resolveDashboardSourceRoot(dashboardPackageRoot, dashboardManifest);
|
|
389
|
-
if (sourceResolved) return sourceResolved;
|
|
390
|
-
}
|
|
391
375
|
const distResolved = resolveDashboardDistRoot(dashboardPackageRoot, dashboardManifest);
|
|
392
376
|
if (distResolved) return distResolved;
|
|
393
377
|
}
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as createWeappViteHostMeta, Dn as WeappViteHostMeta, En as WEAPP_VITE_HOST_NAME, Mn as resolveWeappViteHostMeta, On as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, jn as isWeappViteHost, kn as applyWeappViteHostMeta, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
1
|
+
import { An as createWeappViteHostMeta, Dn as WeappViteHostMeta, En as WEAPP_VITE_HOST_NAME, Mn as resolveWeappViteHostMeta, On as WeappViteRuntime, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, jn as isWeappViteHost, kn as applyWeappViteHostMeta, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-CeCx5qMh.mjs";
|
|
2
2
|
export { App, Component, Page, Sitemap, Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, WeappViteConfig, WeappViteHostMeta, WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-twds-ZHy.mjs";
|
|
2
2
|
import { n as applyWeappViteHostMeta } from "./pluginHost-SJdl15d3.mjs";
|
|
3
3
|
import { n as configureLogger, r as logger_default } from "./logger-gutcwWKE.mjs";
|
|
4
|
-
import { _ as templateExtensions, a as findJsEntry, c as findVueEntry, d as isTemplate, f as touch, g as supportedCssLangs, h as jsExtensions, i as findCssEntry, l as inlineAutoRoutesImports, m as configExtensions, n as extractConfigFromVue, o as findJsonEntry, s as findTemplateEntry, t as changeFileExtension, u as isJsOrTs, v as vueExtensions } from "./file-
|
|
4
|
+
import { _ as templateExtensions, a as findJsEntry, c as findVueEntry, d as isTemplate, f as touch, g as supportedCssLangs, h as jsExtensions, i as findCssEntry, l as inlineAutoRoutesImports, m as configExtensions, n as extractConfigFromVue, o as findJsonEntry, s as findTemplateEntry, t as changeFileExtension, u as isJsOrTs, v as vueExtensions } from "./file-MiE605t6.mjs";
|
|
5
5
|
import { createRequire, isBuiltin } from "node:module";
|
|
6
6
|
import { addExtension, defu, get, isEmptyObject, isObject, objectHash, removeExtension, removeExtensionDeep, set } from "@weapp-core/shared";
|
|
7
7
|
import { LRUCache } from "lru-cache";
|
|
@@ -1315,6 +1315,7 @@ function createScheduleHelpers(options) {
|
|
|
1315
1315
|
const configChanged = settings.enabled !== outputsState.lastHtmlCustomDataEnabled || settings.outputPath !== outputsState.lastHtmlCustomDataOutput;
|
|
1316
1316
|
if (!shouldWrite && !configChanged && !outputsState.lastHtmlCustomDataOutputPath) return;
|
|
1317
1317
|
outputsState.htmlCustomDataWriteRequested = true;
|
|
1318
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1318
1319
|
if (outputsState.pendingHtmlCustomDataWrite) return;
|
|
1319
1320
|
outputsState.pendingHtmlCustomDataWrite = Promise.resolve().then(async () => {
|
|
1320
1321
|
while (outputsState.htmlCustomDataWriteRequested) {
|
|
@@ -1333,6 +1334,7 @@ function createScheduleHelpers(options) {
|
|
|
1333
1334
|
const configService = ctx.configService;
|
|
1334
1335
|
if (!getAutoImportConfig(configService)) return;
|
|
1335
1336
|
outputsState.writeRequested = true;
|
|
1337
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1336
1338
|
if (outputsState.pendingWrite) return;
|
|
1337
1339
|
outputsState.pendingWrite = Promise.resolve().then(async () => {
|
|
1338
1340
|
while (outputsState.writeRequested) {
|
|
@@ -1355,6 +1357,7 @@ function createScheduleHelpers(options) {
|
|
|
1355
1357
|
const configChanged = settings.enabled !== outputsState.lastTypedComponentsEnabled || settings.outputPath !== outputsState.lastTypedComponentsOutput;
|
|
1356
1358
|
if (!shouldWrite && !configChanged && !outputsState.lastTypedDefinitionOutputPath) return;
|
|
1357
1359
|
outputsState.typedWriteRequested = true;
|
|
1360
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1358
1361
|
if (outputsState.pendingTypedWrite) return;
|
|
1359
1362
|
outputsState.pendingTypedWrite = Promise.resolve().then(async () => {
|
|
1360
1363
|
while (outputsState.typedWriteRequested) {
|
|
@@ -1373,6 +1376,7 @@ function createScheduleHelpers(options) {
|
|
|
1373
1376
|
const configChanged = settings.enabled !== outputsState.lastVueComponentsEnabled || settings.outputPath !== outputsState.lastVueComponentsOutput;
|
|
1374
1377
|
if (!shouldWrite && !configChanged && !outputsState.lastVueComponentsOutputPath) return;
|
|
1375
1378
|
outputsState.vueComponentsWriteRequested = true;
|
|
1379
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1376
1380
|
if (outputsState.pendingVueComponentsWrite) return;
|
|
1377
1381
|
outputsState.pendingVueComponentsWrite = Promise.resolve().then(async () => {
|
|
1378
1382
|
while (outputsState.vueComponentsWriteRequested) {
|
|
@@ -4256,6 +4260,19 @@ const VUE_LIKE_EXTENSIONS$2 = [
|
|
|
4256
4260
|
];
|
|
4257
4261
|
const CAMEL_TO_KEBAB_RE$2 = /([a-z0-9])([A-Z])/g;
|
|
4258
4262
|
const TRAILING_INDEX_SEGMENT_RE = /\/index$/;
|
|
4263
|
+
async function getPreparedSyncState(options) {
|
|
4264
|
+
const { outputsState } = options;
|
|
4265
|
+
if (!outputsState.preparedSyncStatePromise) outputsState.preparedSyncStatePromise = Promise.resolve().then(() => {
|
|
4266
|
+
options.syncResolverComponentProps();
|
|
4267
|
+
options.preloadResolverComponentMetadata();
|
|
4268
|
+
const componentNames = collectAllComponentNames(options);
|
|
4269
|
+
return {
|
|
4270
|
+
componentNames,
|
|
4271
|
+
componentMetadataMap: new Map(componentNames.map((name) => [name, options.getComponentMetadata(name)]))
|
|
4272
|
+
};
|
|
4273
|
+
});
|
|
4274
|
+
return await outputsState.preparedSyncStatePromise;
|
|
4275
|
+
}
|
|
4259
4276
|
function toRelativeImportSpecifier(outputPath, sourcePath) {
|
|
4260
4277
|
const relative = path.relative(path.dirname(outputPath), sourcePath).replaceAll("\\", "/");
|
|
4261
4278
|
if (!relative || relative === ".") return "./";
|
|
@@ -4360,9 +4377,11 @@ async function syncTypedComponentsDefinition(settings, options) {
|
|
|
4360
4377
|
outputsState.lastWrittenTypedDefinition = void 0;
|
|
4361
4378
|
return;
|
|
4362
4379
|
}
|
|
4363
|
-
options
|
|
4364
|
-
|
|
4365
|
-
|
|
4380
|
+
const prepared = await getPreparedSyncState(options);
|
|
4381
|
+
const nextDefinition = createTypedComponentsDefinition(prepared.componentNames, (name) => prepared.componentMetadataMap.get(name) ?? {
|
|
4382
|
+
types: /* @__PURE__ */ new Map(),
|
|
4383
|
+
docs: /* @__PURE__ */ new Map()
|
|
4384
|
+
});
|
|
4366
4385
|
if (nextDefinition === outputsState.lastWrittenTypedDefinition && settings.outputPath === outputsState.lastTypedDefinitionOutputPath) return;
|
|
4367
4386
|
try {
|
|
4368
4387
|
if (outputsState.lastTypedDefinitionOutputPath && outputsState.lastTypedDefinitionOutputPath !== settings.outputPath) try {
|
|
@@ -4392,15 +4411,16 @@ async function syncVueComponentsDefinition(settings, options) {
|
|
|
4392
4411
|
outputsState.lastWrittenLayoutTypesDefinition = void 0;
|
|
4393
4412
|
return;
|
|
4394
4413
|
}
|
|
4395
|
-
options
|
|
4396
|
-
options.preloadResolverComponentMetadata();
|
|
4414
|
+
const prepared = await getPreparedSyncState(options);
|
|
4397
4415
|
const outputPath = settings.outputPath;
|
|
4398
|
-
const componentNames = collectAllComponentNames(options);
|
|
4399
4416
|
const layoutNames = await collectLayoutNames(configService.absoluteSrcRoot);
|
|
4400
4417
|
const layoutPropsMap = await collectLayoutPropsMap(ctx);
|
|
4401
4418
|
const layoutTypesOutputPath = resolveLayoutTypesDefaultPath(configService);
|
|
4402
4419
|
const layoutTypesDefinition = createLayoutTypesDefinition(layoutNames, layoutPropsMap);
|
|
4403
|
-
const nextDefinition = createVueComponentsDefinition(componentNames,
|
|
4420
|
+
const nextDefinition = createVueComponentsDefinition(prepared.componentNames, (name) => prepared.componentMetadataMap.get(name) ?? {
|
|
4421
|
+
types: /* @__PURE__ */ new Map(),
|
|
4422
|
+
docs: /* @__PURE__ */ new Map()
|
|
4423
|
+
}, {
|
|
4404
4424
|
useTypedComponents: getTypedComponentsSettings({ configService }).enabled,
|
|
4405
4425
|
moduleName: settings.moduleName,
|
|
4406
4426
|
layoutNames,
|
|
@@ -4444,11 +4464,12 @@ async function syncHtmlCustomData(settings, options) {
|
|
|
4444
4464
|
outputsState.lastWrittenHtmlCustomData = void 0;
|
|
4445
4465
|
return;
|
|
4446
4466
|
}
|
|
4447
|
-
options
|
|
4448
|
-
options.preloadResolverComponentMetadata();
|
|
4449
|
-
const componentNames = collectAllComponentNames(options);
|
|
4467
|
+
const prepared = await getPreparedSyncState(options);
|
|
4450
4468
|
const builtinTags = loadWeappBuiltinHtmlTags();
|
|
4451
|
-
const nextDefinition = createHtmlCustomDataDefinition(componentNames,
|
|
4469
|
+
const nextDefinition = createHtmlCustomDataDefinition(prepared.componentNames, (name) => prepared.componentMetadataMap.get(name) ?? {
|
|
4470
|
+
types: /* @__PURE__ */ new Map(),
|
|
4471
|
+
docs: /* @__PURE__ */ new Map()
|
|
4472
|
+
}, builtinTags);
|
|
4452
4473
|
if (nextDefinition === outputsState.lastWrittenHtmlCustomData && settings.outputPath === outputsState.lastHtmlCustomDataOutputPath) return;
|
|
4453
4474
|
try {
|
|
4454
4475
|
if (outputsState.lastHtmlCustomDataOutputPath && outputsState.lastHtmlCustomDataOutputPath !== settings.outputPath) try {
|
|
@@ -5054,6 +5075,12 @@ async function resolveWeappConfigFile(options) {
|
|
|
5054
5075
|
//#region src/runtime/autoImport/service/registry.ts
|
|
5055
5076
|
const JSON_LIKE_FILE_RE = /\.(?:json|jsonc|json5)$/i;
|
|
5056
5077
|
function createRegistryHelpers(state) {
|
|
5078
|
+
function scheduleOutputs(shouldWrite, vueEnabled) {
|
|
5079
|
+
state.scheduleManifestWrite(shouldWrite);
|
|
5080
|
+
state.scheduleTypedComponentsWrite(shouldWrite);
|
|
5081
|
+
state.scheduleHtmlCustomDataWrite(shouldWrite);
|
|
5082
|
+
state.scheduleVueComponentsWrite(vueEnabled || shouldWrite);
|
|
5083
|
+
}
|
|
5057
5084
|
async function extractComponentPropsFromVue(vuePath) {
|
|
5058
5085
|
const source = await fs.readFile(vuePath, "utf8");
|
|
5059
5086
|
const astEngine = resolveAstEngine(state.ctx.configService?.weappViteConfig);
|
|
@@ -5087,12 +5114,13 @@ function createRegistryHelpers(state) {
|
|
|
5087
5114
|
async function registerLocalComponent(filePath) {
|
|
5088
5115
|
if (!state.ctx.configService || !state.ctx.jsonService) throw new Error("扫描组件前必须初始化 configService/jsonService。");
|
|
5089
5116
|
const baseName = removeExtensionDeep(filePath);
|
|
5090
|
-
const [{ path: jsEntry }, { path: jsonPath }, { path: templatePath }
|
|
5117
|
+
const [{ path: jsEntry }, { path: jsonPath }, { path: templatePath }] = await Promise.all([
|
|
5091
5118
|
findJsEntry(baseName),
|
|
5092
5119
|
findJsonEntry(baseName),
|
|
5093
|
-
findTemplateEntry(baseName)
|
|
5094
|
-
filePath.endsWith(".vue") ? Promise.resolve(filePath) : findVueEntry(baseName)
|
|
5120
|
+
findTemplateEntry(baseName)
|
|
5095
5121
|
]);
|
|
5122
|
+
let vueEntry = filePath.endsWith(".vue") ? filePath : void 0;
|
|
5123
|
+
if ((!jsEntry || !jsonPath || !templatePath) && !vueEntry) vueEntry = await findVueEntry(baseName);
|
|
5096
5124
|
const { removed, removedNames } = removeRegisteredComponent({
|
|
5097
5125
|
baseName,
|
|
5098
5126
|
templatePath,
|
|
@@ -5108,6 +5136,7 @@ function createRegistryHelpers(state) {
|
|
|
5108
5136
|
let resolvedJsonPath = jsonPath;
|
|
5109
5137
|
let resolvedTemplatePath = templatePath;
|
|
5110
5138
|
let json = jsonPath ? await state.ctx.jsonService.read(jsonPath) : void 0;
|
|
5139
|
+
const vueSettings = getVueComponentsSettings(state.ctx);
|
|
5111
5140
|
if ((!resolvedJsEntry || !resolvedJsonPath || !resolvedTemplatePath) && vueEntry) {
|
|
5112
5141
|
const vueConfig = await extractConfigFromVue(vueEntry);
|
|
5113
5142
|
const vueJson = vueConfig && typeof vueConfig === "object" && !Array.isArray(vueConfig) ? { ...vueConfig } : {};
|
|
@@ -5120,34 +5149,22 @@ function createRegistryHelpers(state) {
|
|
|
5120
5149
|
}
|
|
5121
5150
|
}
|
|
5122
5151
|
if (!resolvedJsEntry || !resolvedJsonPath || !resolvedTemplatePath) {
|
|
5123
|
-
|
|
5124
|
-
state.scheduleTypedComponentsWrite(removed || removedNames.length > 0);
|
|
5125
|
-
state.scheduleHtmlCustomDataWrite(removed || removedNames.length > 0);
|
|
5126
|
-
state.scheduleVueComponentsWrite(getVueComponentsSettings(state.ctx).enabled || removed || removedNames.length > 0);
|
|
5152
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5127
5153
|
return;
|
|
5128
5154
|
}
|
|
5129
5155
|
if (!json?.component) {
|
|
5130
|
-
|
|
5131
|
-
state.scheduleTypedComponentsWrite(removed || removedNames.length > 0);
|
|
5132
|
-
state.scheduleHtmlCustomDataWrite(removed || removedNames.length > 0);
|
|
5133
|
-
state.scheduleVueComponentsWrite(getVueComponentsSettings(state.ctx).enabled || removed || removedNames.length > 0);
|
|
5156
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5134
5157
|
return;
|
|
5135
5158
|
}
|
|
5136
5159
|
const { componentName, base } = resolvedComponentName(baseName);
|
|
5137
5160
|
if (!componentName) {
|
|
5138
|
-
|
|
5139
|
-
state.scheduleTypedComponentsWrite(removed || removedNames.length > 0);
|
|
5140
|
-
state.scheduleHtmlCustomDataWrite(removed || removedNames.length > 0);
|
|
5141
|
-
state.scheduleVueComponentsWrite(getVueComponentsSettings(state.ctx).enabled || removed || removedNames.length > 0);
|
|
5161
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5142
5162
|
return;
|
|
5143
5163
|
}
|
|
5144
5164
|
if (state.registry.has(componentName) && base !== "index") {
|
|
5145
5165
|
const message = `发现 \`${componentName}\` 组件重名! 跳过组件 \`${state.ctx.configService.relativeCwd(baseName)}\` 的自动引入`;
|
|
5146
5166
|
state.logWarnOnce(message);
|
|
5147
|
-
|
|
5148
|
-
state.scheduleTypedComponentsWrite(removed || removedNames.length > 0);
|
|
5149
|
-
state.scheduleHtmlCustomDataWrite(removed || removedNames.length > 0);
|
|
5150
|
-
state.scheduleVueComponentsWrite(getVueComponentsSettings(state.ctx).enabled || removed || removedNames.length > 0);
|
|
5167
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5151
5168
|
return;
|
|
5152
5169
|
}
|
|
5153
5170
|
const sourceWithoutExt = removeExtensionDeep(resolvedJsonPath);
|
|
@@ -5169,12 +5186,11 @@ function createRegistryHelpers(state) {
|
|
|
5169
5186
|
state.scheduleManifestWrite(true);
|
|
5170
5187
|
const typedSettings = getTypedComponentsSettings(state.ctx);
|
|
5171
5188
|
const htmlSettings = getHtmlCustomDataSettings(state.ctx);
|
|
5172
|
-
const vueSettings = getVueComponentsSettings(state.ctx);
|
|
5173
5189
|
if (typedSettings.enabled || htmlSettings.enabled) {
|
|
5174
5190
|
const astEngine = resolveAstEngine(state.ctx.configService.weappViteConfig);
|
|
5175
5191
|
let metadataSource = json;
|
|
5176
5192
|
try {
|
|
5177
|
-
if (JSON_LIKE_FILE_RE.test(resolvedJsonPath)) metadataSource = await fs.readJson(resolvedJsonPath);
|
|
5193
|
+
if (!metadataSource && JSON_LIKE_FILE_RE.test(resolvedJsonPath)) metadataSource = await fs.readJson(resolvedJsonPath);
|
|
5178
5194
|
} catch {}
|
|
5179
5195
|
const metadata = extractJsonPropMetadata(metadataSource);
|
|
5180
5196
|
const baseProps = metadata.props;
|
|
@@ -5231,6 +5247,10 @@ const TRAILING_SLASH_RE$1 = /\/+$/;
|
|
|
5231
5247
|
const SCRIPT_OR_DTS_EXTENSION_RE = /\.(?:[cm]?js|tsx?|jsx|d\.ts)$/;
|
|
5232
5248
|
function createResolverHelpers(state) {
|
|
5233
5249
|
const miniprogramDirCache = /* @__PURE__ */ new Map();
|
|
5250
|
+
const resolveCache = /* @__PURE__ */ new Map();
|
|
5251
|
+
function getResolveCacheKey(componentName, importerBaseName) {
|
|
5252
|
+
return `${importerBaseName ?? ""}\0${componentName}`;
|
|
5253
|
+
}
|
|
5234
5254
|
function resolveWithResolver(resolver, componentName, baseName) {
|
|
5235
5255
|
if (!resolver) return;
|
|
5236
5256
|
const candidates = [componentName];
|
|
@@ -5306,15 +5326,10 @@ function createResolverHelpers(state) {
|
|
|
5306
5326
|
} catch {}
|
|
5307
5327
|
}
|
|
5308
5328
|
function collectResolverComponents() {
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
const map = resolver?.components;
|
|
5314
|
-
if (!map) continue;
|
|
5315
|
-
for (const [name, from] of Object.entries(map)) entries.push([name, from]);
|
|
5316
|
-
}
|
|
5317
|
-
return Object.fromEntries(entries);
|
|
5329
|
+
return Object.fromEntries(state.resolvedResolverComponents);
|
|
5330
|
+
}
|
|
5331
|
+
function clearResolveCache() {
|
|
5332
|
+
resolveCache.clear();
|
|
5318
5333
|
}
|
|
5319
5334
|
function syncResolverComponentProps() {
|
|
5320
5335
|
const resolverEntries = collectResolverComponents();
|
|
@@ -5334,15 +5349,25 @@ function createResolverHelpers(state) {
|
|
|
5334
5349
|
}
|
|
5335
5350
|
}
|
|
5336
5351
|
function resolveWithResolvers(componentName, importerBaseName) {
|
|
5352
|
+
const cacheKey = getResolveCacheKey(componentName, importerBaseName);
|
|
5353
|
+
if (resolveCache.has(cacheKey)) return resolveCache.get(cacheKey) ?? void 0;
|
|
5337
5354
|
const resolvers = getAutoImportConfig(state.ctx.configService)?.resolvers;
|
|
5338
|
-
if (!Array.isArray(resolvers))
|
|
5355
|
+
if (!Array.isArray(resolvers)) {
|
|
5356
|
+
resolveCache.set(cacheKey, null);
|
|
5357
|
+
return;
|
|
5358
|
+
}
|
|
5339
5359
|
for (const resolver of resolvers) {
|
|
5340
5360
|
const value = resolveWithResolver(resolver, componentName, importerBaseName ?? "");
|
|
5341
|
-
if (value)
|
|
5361
|
+
if (value) {
|
|
5362
|
+
resolveCache.set(cacheKey, value);
|
|
5363
|
+
return value;
|
|
5364
|
+
}
|
|
5342
5365
|
}
|
|
5366
|
+
resolveCache.set(cacheKey, null);
|
|
5343
5367
|
}
|
|
5344
5368
|
return {
|
|
5345
5369
|
collectResolverComponents,
|
|
5370
|
+
clearResolveCache,
|
|
5346
5371
|
syncResolverComponentProps,
|
|
5347
5372
|
resolveWithResolvers,
|
|
5348
5373
|
resolveNavigationImport
|
|
@@ -5362,6 +5387,7 @@ function logWarnOnce(message) {
|
|
|
5362
5387
|
function createAutoImportService(ctx) {
|
|
5363
5388
|
const autoImportState = ctx.runtimeState.autoImport;
|
|
5364
5389
|
const registry = autoImportState.registry;
|
|
5390
|
+
const resolvedResolverComponents = autoImportState.resolvedResolverComponents;
|
|
5365
5391
|
const manifestFileName = DEFAULT_AUTO_IMPORT_MANIFEST_FILENAME;
|
|
5366
5392
|
const manifestCache = /* @__PURE__ */ new Map();
|
|
5367
5393
|
const componentMetadataMap = /* @__PURE__ */ new Map();
|
|
@@ -5388,11 +5414,13 @@ function createAutoImportService(ctx) {
|
|
|
5388
5414
|
lastTypedComponentsEnabled: false,
|
|
5389
5415
|
lastTypedComponentsOutput: void 0,
|
|
5390
5416
|
lastVueComponentsEnabled: false,
|
|
5391
|
-
lastVueComponentsOutput: void 0
|
|
5417
|
+
lastVueComponentsOutput: void 0,
|
|
5418
|
+
preparedSyncStatePromise: void 0
|
|
5392
5419
|
};
|
|
5393
5420
|
const resolverHelpers = createResolverHelpers({
|
|
5394
5421
|
ctx,
|
|
5395
5422
|
registry,
|
|
5423
|
+
resolvedResolverComponents,
|
|
5396
5424
|
componentMetadataMap,
|
|
5397
5425
|
resolverComponentNames,
|
|
5398
5426
|
resolverComponentsMapRef
|
|
@@ -5437,6 +5465,8 @@ function createAutoImportService(ctx) {
|
|
|
5437
5465
|
registry.clear();
|
|
5438
5466
|
autoImportState.matcher = void 0;
|
|
5439
5467
|
autoImportState.matcherKey = "";
|
|
5468
|
+
resolvedResolverComponents.clear();
|
|
5469
|
+
resolverHelpers.clearResolveCache();
|
|
5440
5470
|
outputsHelpers.scheduleManifestWrite(true);
|
|
5441
5471
|
componentMetadataMap.clear();
|
|
5442
5472
|
resolverComponentNames.clear();
|
|
@@ -5478,6 +5508,8 @@ function createAutoImportService(ctx) {
|
|
|
5478
5508
|
if (local) return local;
|
|
5479
5509
|
const resolvedValue = resolverHelpers.resolveWithResolvers(componentName, importerBaseName);
|
|
5480
5510
|
if (resolvedValue) {
|
|
5511
|
+
const resolverChanged = resolvedResolverComponents.get(resolvedValue.name) !== resolvedValue.from;
|
|
5512
|
+
resolvedResolverComponents.set(resolvedValue.name, resolvedValue.from);
|
|
5481
5513
|
const resolved = {
|
|
5482
5514
|
kind: "resolver",
|
|
5483
5515
|
value: resolvedValue
|
|
@@ -5486,14 +5518,16 @@ function createAutoImportService(ctx) {
|
|
|
5486
5518
|
const htmlSettings = getHtmlCustomDataSettings(ctx);
|
|
5487
5519
|
const vueSettings = getVueComponentsSettings(ctx);
|
|
5488
5520
|
if (typedSettings.enabled || htmlSettings.enabled) {
|
|
5489
|
-
|
|
5521
|
+
const metadataMissing = !componentMetadataMap.has(resolved.value.name);
|
|
5522
|
+
if (metadataMissing) componentMetadataMap.set(resolved.value.name, {
|
|
5490
5523
|
types: /* @__PURE__ */ new Map(),
|
|
5491
5524
|
docs: /* @__PURE__ */ new Map()
|
|
5492
5525
|
});
|
|
5493
|
-
if (typedSettings.enabled) outputsHelpers.scheduleTypedComponentsWrite(true);
|
|
5494
|
-
if (htmlSettings.enabled) outputsHelpers.scheduleHtmlCustomDataWrite(true);
|
|
5526
|
+
if (typedSettings.enabled && (resolverChanged || metadataMissing)) outputsHelpers.scheduleTypedComponentsWrite(true);
|
|
5527
|
+
if (htmlSettings.enabled && (resolverChanged || metadataMissing)) outputsHelpers.scheduleHtmlCustomDataWrite(true);
|
|
5495
5528
|
} else componentMetadataMap.delete(resolved.value.name);
|
|
5496
|
-
if (vueSettings.enabled) outputsHelpers.scheduleVueComponentsWrite(true);
|
|
5529
|
+
if (vueSettings.enabled && resolverChanged) outputsHelpers.scheduleVueComponentsWrite(true);
|
|
5530
|
+
if (resolverChanged) outputsHelpers.scheduleManifestWrite(true);
|
|
5497
5531
|
return resolved;
|
|
5498
5532
|
}
|
|
5499
5533
|
},
|
|
@@ -6211,9 +6245,14 @@ function ensureSubPackage(map, root) {
|
|
|
6211
6245
|
}
|
|
6212
6246
|
return set;
|
|
6213
6247
|
}
|
|
6214
|
-
function shouldIncludeScanCandidate(candidate, json) {
|
|
6248
|
+
function shouldIncludeScanCandidate(candidate, json, route) {
|
|
6215
6249
|
if (candidate.jsonPath && json === void 0) return false;
|
|
6216
6250
|
if (json && typeof json === "object" && json.component === true) return false;
|
|
6251
|
+
if (route?.root && !route.pagePath.startsWith("pages/") && candidate.hasScript && !candidate.hasTemplate && !candidate.jsonPath) {
|
|
6252
|
+
const hasVueEntry = [...candidate.files].some((file) => file.endsWith(".vue"));
|
|
6253
|
+
const isIndexEntry = path.basename(route.pagePath) === "index";
|
|
6254
|
+
if (!hasVueEntry && !isIndexEntry) return false;
|
|
6255
|
+
}
|
|
6217
6256
|
return candidate.hasScript || candidate.hasTemplate || Boolean(candidate.jsonPath);
|
|
6218
6257
|
}
|
|
6219
6258
|
async function scanRoutes(ctx, candidatesMap) {
|
|
@@ -6247,7 +6286,7 @@ async function scanRoutes(ctx, candidatesMap) {
|
|
|
6247
6286
|
const route = resolveRoute(normalizedBase, subPackageRoots);
|
|
6248
6287
|
if (!route) continue;
|
|
6249
6288
|
watchDirs.add(path.dirname(candidate.base));
|
|
6250
|
-
if (!shouldIncludeScanCandidate(candidate, jsonMap.get(candidate))) continue;
|
|
6289
|
+
if (!shouldIncludeScanCandidate(candidate, jsonMap.get(candidate), route)) continue;
|
|
6251
6290
|
entriesSet.add(route.entry);
|
|
6252
6291
|
if (route.root) ensureSubPackage(subPackages, route.root).add(route.pagePath);
|
|
6253
6292
|
else pagesSet.add(route.pagePath);
|
|
@@ -9881,6 +9920,10 @@ const LEADING_SLASHES_RE$2 = /^\/+/;
|
|
|
9881
9920
|
const GLOB_WILDCARD_RE = /[*?[{]/;
|
|
9882
9921
|
const TRAILING_SLASHES_RE$1 = /\/+$/;
|
|
9883
9922
|
const AUTO_IMPORT_WATCHER_KEY = "__auto-import-vue-watcher__";
|
|
9923
|
+
const AUTO_IMPORT_CONFIG_SUFFIXES = configExtensions.map((ext) => `.${ext}`);
|
|
9924
|
+
const AUTO_IMPORT_JS_SUFFIXES = new Set(jsExtensions.map((ext) => `.${ext}`));
|
|
9925
|
+
const AUTO_IMPORT_TEMPLATE_SUFFIXES = new Set(templateExtensions.map((ext) => `.${ext}`));
|
|
9926
|
+
const AUTO_IMPORT_VUE_SUFFIXES = new Set(vueExtensions.map((ext) => `.${ext}`));
|
|
9884
9927
|
function isEnabledOutputOption(option) {
|
|
9885
9928
|
if (option === true) return true;
|
|
9886
9929
|
if (typeof option === "string") return option.trim().length > 0;
|
|
@@ -9901,6 +9944,44 @@ function normalizeChangedPath(id) {
|
|
|
9901
9944
|
const [pathWithoutQuery] = id.split("?");
|
|
9902
9945
|
return pathWithoutQuery;
|
|
9903
9946
|
}
|
|
9947
|
+
function getAutoImportCandidateKind(filePath) {
|
|
9948
|
+
if (AUTO_IMPORT_VUE_SUFFIXES.has(path.extname(filePath))) return "vue";
|
|
9949
|
+
if (AUTO_IMPORT_TEMPLATE_SUFFIXES.has(path.extname(filePath))) return "template";
|
|
9950
|
+
if (AUTO_IMPORT_JS_SUFFIXES.has(path.extname(filePath))) return "script";
|
|
9951
|
+
if (AUTO_IMPORT_CONFIG_SUFFIXES.some((suffix) => filePath.endsWith(suffix))) return "config";
|
|
9952
|
+
}
|
|
9953
|
+
function getAutoImportCandidateBase(filePath, kind) {
|
|
9954
|
+
if (!kind) return;
|
|
9955
|
+
if (kind === "config") {
|
|
9956
|
+
const suffix = AUTO_IMPORT_CONFIG_SUFFIXES.find((item) => filePath.endsWith(item));
|
|
9957
|
+
return suffix ? filePath.slice(0, -suffix.length) : void 0;
|
|
9958
|
+
}
|
|
9959
|
+
return filePath.slice(0, -path.extname(filePath).length);
|
|
9960
|
+
}
|
|
9961
|
+
function rankAutoImportCandidate(kind) {
|
|
9962
|
+
switch (kind) {
|
|
9963
|
+
case "vue": return 4;
|
|
9964
|
+
case "template": return 3;
|
|
9965
|
+
case "script": return 2;
|
|
9966
|
+
case "config": return 1;
|
|
9967
|
+
default: return 0;
|
|
9968
|
+
}
|
|
9969
|
+
}
|
|
9970
|
+
function collectDistinctAutoImportCandidates(files) {
|
|
9971
|
+
const bestByBase = /* @__PURE__ */ new Map();
|
|
9972
|
+
for (const filePath of files) {
|
|
9973
|
+
const kind = getAutoImportCandidateKind(filePath);
|
|
9974
|
+
const base = getAutoImportCandidateBase(filePath, kind);
|
|
9975
|
+
if (!kind || !base) continue;
|
|
9976
|
+
const rank = rankAutoImportCandidate(kind);
|
|
9977
|
+
const existing = bestByBase.get(base);
|
|
9978
|
+
if (!existing || rank > existing.rank || rank === existing.rank && filePath < existing.filePath) bestByBase.set(base, {
|
|
9979
|
+
filePath,
|
|
9980
|
+
rank
|
|
9981
|
+
});
|
|
9982
|
+
}
|
|
9983
|
+
return Array.from(bestByBase.values(), (entry) => entry.filePath).sort((a, b) => a.localeCompare(b));
|
|
9984
|
+
}
|
|
9904
9985
|
function resolveAbsolutePath(ctx, candidate) {
|
|
9905
9986
|
const { configService } = ctx;
|
|
9906
9987
|
if (!configService) return;
|
|
@@ -9930,10 +10011,10 @@ async function findAutoImportCandidates(state, globs) {
|
|
|
9930
10011
|
const { configService } = ctx;
|
|
9931
10012
|
if (!resolvedConfig) return [];
|
|
9932
10013
|
const ignore = [...defaultExcluded, `${resolvedConfig.build.outDir}/**`];
|
|
9933
|
-
return await new fdir({
|
|
10014
|
+
return collectDistinctAutoImportCandidates(await new fdir({
|
|
9934
10015
|
includeDirs: false,
|
|
9935
10016
|
pathSeparator: "/"
|
|
9936
|
-
}).withFullPaths().globWithOptions(globs.map((pattern) => path.resolve(configService.absoluteSrcRoot, pattern)), { ignore }).crawl(configService.absoluteSrcRoot).withPromise();
|
|
10017
|
+
}).withFullPaths().globWithOptions(globs.map((pattern) => path.resolve(configService.absoluteSrcRoot, pattern)), { ignore }).crawl(configService.absoluteSrcRoot).withPromise());
|
|
9937
10018
|
}
|
|
9938
10019
|
function registerAutoImportWatchTargets(state, globs, registrar, options = {}) {
|
|
9939
10020
|
const { configService } = state.ctx;
|
|
@@ -9968,11 +10049,13 @@ function createAutoImportPlugin(state) {
|
|
|
9968
10049
|
}
|
|
9969
10050
|
}));
|
|
9970
10051
|
watcher.on("add", (filePath) => {
|
|
10052
|
+
if (!getAutoImportCandidateKind(filePath)) return;
|
|
9971
10053
|
if (!matchesAutoImportGlobs(ctx, filePath)) return;
|
|
9972
10054
|
logger_default.info(`[auto-import:watch] 新增组件文件 ${configService.relativeCwd(filePath)}`);
|
|
9973
10055
|
autoImportService.registerPotentialComponent(filePath);
|
|
9974
10056
|
});
|
|
9975
10057
|
watcher.on("unlink", (filePath) => {
|
|
10058
|
+
if (!getAutoImportCandidateKind(filePath)) return;
|
|
9976
10059
|
if (!matchesAutoImportGlobs(ctx, filePath)) return;
|
|
9977
10060
|
logger_default.info(`[auto-import:watch] 删除组件文件 ${configService.relativeCwd(filePath)}`);
|
|
9978
10061
|
autoImportService.removePotentialComponent(filePath);
|
|
@@ -10022,6 +10105,7 @@ function createAutoImportPlugin(state) {
|
|
|
10022
10105
|
const absolutePath = resolveAbsolutePath(ctx, filePath);
|
|
10023
10106
|
if (!absolutePath) return;
|
|
10024
10107
|
if (!matchesAutoImportGlobs(ctx, absolutePath)) return;
|
|
10108
|
+
if (!getAutoImportCandidateKind(absolutePath)) return;
|
|
10025
10109
|
if (change.event === "delete") {
|
|
10026
10110
|
autoImportService.removePotentialComponent(absolutePath);
|
|
10027
10111
|
return;
|
|
@@ -19084,6 +19168,7 @@ function createRuntimeState() {
|
|
|
19084
19168
|
},
|
|
19085
19169
|
autoImport: {
|
|
19086
19170
|
registry: /* @__PURE__ */ new Map(),
|
|
19171
|
+
resolvedResolverComponents: /* @__PURE__ */ new Map(),
|
|
19087
19172
|
matcherKey: ""
|
|
19088
19173
|
},
|
|
19089
19174
|
build: {
|
|
@@ -19487,7 +19572,7 @@ function createScanService(ctx) {
|
|
|
19487
19572
|
const vueAppPath = await findVueEntry(appBasename);
|
|
19488
19573
|
let configFromVue;
|
|
19489
19574
|
if (!appConfigFile && vueAppPath) {
|
|
19490
|
-
const { extractConfigFromVue } = await import("./file-
|
|
19575
|
+
const { extractConfigFromVue } = await import("./file-MiE605t6.mjs").then((n) => n.r);
|
|
19491
19576
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
19492
19577
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
19493
19578
|
}
|
|
@@ -20208,6 +20293,31 @@ async function hasManagedTsconfigChanges(ctx) {
|
|
|
20208
20293
|
for (const file of files) if (await readFile(file.path, "utf8").catch(() => void 0) !== file.content) return true;
|
|
20209
20294
|
return false;
|
|
20210
20295
|
}
|
|
20296
|
+
async function collectAutoImportTemplateTags(ctx) {
|
|
20297
|
+
const srcRoot = ctx.configService?.absoluteSrcRoot;
|
|
20298
|
+
if (!srcRoot) return [];
|
|
20299
|
+
const files = await new fdir({
|
|
20300
|
+
includeDirs: false,
|
|
20301
|
+
pathSeparator: "/"
|
|
20302
|
+
}).withFullPaths().filter((filePath) => filePath.endsWith(".vue") || filePath.endsWith(".wxml")).crawl(srcRoot).withPromise();
|
|
20303
|
+
const tags = /* @__PURE__ */ new Map();
|
|
20304
|
+
const platform = ctx.configService?.platform ?? "weapp";
|
|
20305
|
+
for (const filePath of files) {
|
|
20306
|
+
const source = await readFile(filePath, "utf8").catch(() => void 0);
|
|
20307
|
+
if (!source) continue;
|
|
20308
|
+
if (filePath.endsWith(".vue")) {
|
|
20309
|
+
const { descriptor, errors } = parse(source, { filename: filePath });
|
|
20310
|
+
if (errors.length > 0 || !descriptor.template?.content) continue;
|
|
20311
|
+
for (const tag of collectVueTemplateAutoImportTags(descriptor.template.content, filePath)) tags.set(tag, removeExtensionDeep(filePath));
|
|
20312
|
+
continue;
|
|
20313
|
+
}
|
|
20314
|
+
for (const tag of Object.keys(scanWxml(source, { platform }).components)) tags.set(tag, removeExtensionDeep(filePath));
|
|
20315
|
+
}
|
|
20316
|
+
return Array.from(tags.entries(), ([tag, importerBaseName]) => ({
|
|
20317
|
+
tag,
|
|
20318
|
+
importerBaseName
|
|
20319
|
+
}));
|
|
20320
|
+
}
|
|
20211
20321
|
async function syncProjectSupportFiles(ctx) {
|
|
20212
20322
|
const managedTsconfigChanged = await hasManagedTsconfigChanges(ctx);
|
|
20213
20323
|
await syncManagedTsconfigFiles(ctx);
|
|
@@ -20223,6 +20333,8 @@ async function syncProjectSupportFiles(ctx) {
|
|
|
20223
20333
|
}, globs);
|
|
20224
20334
|
await Promise.all(files.map((file) => ctx.autoImportService.registerPotentialComponent(file)));
|
|
20225
20335
|
} else if (!shouldBootstrapAutoImportWithoutGlobs(autoImportConfig)) {}
|
|
20336
|
+
const templateTags = await collectAutoImportTemplateTags(ctx);
|
|
20337
|
+
for (const { tag, importerBaseName } of templateTags) ctx.autoImportService.resolve(tag, importerBaseName);
|
|
20226
20338
|
await ctx.autoImportService.awaitManifestWrites();
|
|
20227
20339
|
}
|
|
20228
20340
|
return { managedTsconfigChanged };
|
|
@@ -102,7 +102,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
102
102
|
}
|
|
103
103
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
104
104
|
try {
|
|
105
|
-
const { getCompilerContext } = await import("./createContext-
|
|
105
|
+
const { getCompilerContext } = await import("./createContext-Dja7tL2g.mjs").then((n) => n.a);
|
|
106
106
|
const compilerContext = getCompilerContext();
|
|
107
107
|
const service = compilerContext.autoRoutesService;
|
|
108
108
|
const reference = service?.getReference?.();
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Ref, An as createWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, Dn as WeappViteHostMeta, E as InlineConfig, En as WEAPP_VITE_HOST_NAME, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, Mn as resolveWeappViteHostMeta, N as RolldownOptions, O as Plugin, On as WeappViteRuntime, P as RolldownOutput, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, jn as isWeappViteHost, k as PluginOption, kn as applyWeappViteHostMeta, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer } from "./config-
|
|
1
|
+
import { A as Ref, An as createWeappViteHostMeta, C as LoadConfigOptions, D as MethodDefinitions, Dn as WeappViteHostMeta, E as InlineConfig, En as WEAPP_VITE_HOST_NAME, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, Mn as resolveWeappViteHostMeta, N as RolldownOptions, O as Plugin, On as WeappViteRuntime, P as RolldownOutput, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, _ as definePageJson, a as UserConfigFnNoEnvPlain, c as UserConfigFnPromise, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, j as ResolvedConfig, jn as isWeappViteHost, k as PluginOption, kn as applyWeappViteHostMeta, l as defineConfig, m as Theme, n as UserConfigExport, nt as WeappViteConfig, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer } from "./config-CeCx5qMh.mjs";
|
|
2
2
|
import { a as createWevuComponent, i as WevuComponentOptions, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-CpQutkhu.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/createContext.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson } from "./json.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-SJdl15d3.mjs";
|
|
3
3
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import { t as createCompilerContext } from "./createContext-
|
|
4
|
+
import { t as createCompilerContext } from "./createContext-Dja7tL2g.mjs";
|
|
5
5
|
import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-gyZnAGCZ.mjs";
|
|
6
6
|
export { WEAPP_VITE_HOST_NAME, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta, 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-CeCx5qMh.mjs";
|
|
2
2
|
export { App, Component, Page, Sitemap, Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as WeappMcpConfig } from "./config-
|
|
1
|
+
import { _t as WeappMcpConfig } from "./config-CeCx5qMh.mjs";
|
|
2
2
|
import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, 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-B5wBsuYI.mjs";
|
|
2
2
|
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-o20IHwXa.mjs";
|
|
3
|
-
import { $ as WeappDebugConfig, $t as NpmBuildOptions, A as Ref, At as ChunksConfig, B as BindingErrorLike, Bt as GenerateTemplateEntry, Cn as WeappManagedSharedTsconfigConfig, Ct as WeappVueTemplateConfig, D as MethodDefinitions, Dn as WeappViteHostMeta, Dt as AliasOptions, E as InlineConfig, Et as Alias, F as RolldownPlugin, Ft as GenerateFileType, G as EntryJsonFragment, Gt as GenerateTemplatesConfig, H as BaseEntry, Ht as GenerateTemplateFileSource, I as RolldownPluginOption, It as GenerateFilenamesOptions, J as ScanComponentItem, Jt as JsonMergeContext, K as PageEntry, Kt as JsFormat, L as RolldownWatchOptions, Lt as GenerateOptions, M as RolldownBuild, Mt as CopyOptions, N as RolldownOptions, Nt as GenerateDirsOptions, O as Plugin, On as WeappViteRuntime, Ot as AlipayNpmMode, P as RolldownOutput, Pt as GenerateExtensionsOptions, Q as UserConfig, Qt as MpPlatform, R as RolldownWatcher, Rt as GenerateTemplate, Sn as WeappManagedServerTsconfigConfig, St as WeappVueConfig, T as ConfigEnv, Tn as WeappWebConfig, Tt as WeappWorkerConfig, U as ComponentEntry, Ut as GenerateTemplateInlineSource, V as AppEntry, Vt as GenerateTemplateFactory, W as Entry, Wt as GenerateTemplateScope, X as ProjectConfig, Xt as JsonMergeStage, Y as WxmlDep, Yt as JsonMergeFunction, Z as SubPackageMetaValue, Zt as JsonMergeStrategy, _n as WeappLibFileName, _t as WeappMcpConfig, an as SharedChunkMode, at as EnhanceOptions, b as ChangeEvent, bn as WeappManagedAppTsconfigConfig, bt as WeappRouteRules, cn as SubPackage, ct as MultiPlatformConfig, dn as SubPackageStyleEntry, dt as WeappAutoRoutesInclude, en as NpmMainPackageConfig, et as WeappForwardConsoleConfig, fn as SubPackageStyleScope, ft as WeappAutoRoutesIncludePattern, gn as WeappLibEntryContext, gt as WeappInjectWeapiConfig, hn as WeappLibDtsOptions, ht as WeappInjectRequestGlobalsTarget, in as SharedChunkDynamicImports, it as AutoImportComponentsOption, j as ResolvedConfig, jt as CopyGlobs, k as PluginOption, kt as BuildNpmPackageMeta, ln as SubPackageStyleConfigEntry, lt as ScanWxmlOptions, mn as WeappLibConfig, mt as WeappInjectRequestGlobalsConfig, nn as NpmSubPackageConfig, nt as WeappViteConfig, on as SharedChunkOverride, ot as EnhanceWxmlOptions, pn as WeappLibComponentJson, pt as WeappHmrConfig, q as ComponentsMap, qt as JsonConfig, rn as ResolvedAlias, rt as AutoImportComponents, sn as SharedChunkStrategy, st as HandleWxmlOptions, tn as NpmPluginPackageConfig, tt as WeappForwardConsoleLogLevel, un as SubPackageStyleConfigObject, ut as WeappAutoRoutesConfig, vn as WeappLibInternalDtsOptions, vt as WeappNpmConfig, w as ComputedDefinitions, wn as WeappManagedTypeScriptConfig, wt as WeappWevuConfig, x as WeappVitePluginApi, xn as WeappManagedNodeTsconfigConfig, xt as WeappSubPackageConfig, yn as WeappLibVueTscOptions, yt as WeappRouteRule, z as ViteDevServer, zt as GenerateTemplateContext } from "./config-
|
|
3
|
+
import { $ as WeappDebugConfig, $t as NpmBuildOptions, A as Ref, At as ChunksConfig, B as BindingErrorLike, Bt as GenerateTemplateEntry, Cn as WeappManagedSharedTsconfigConfig, Ct as WeappVueTemplateConfig, D as MethodDefinitions, Dn as WeappViteHostMeta, Dt as AliasOptions, E as InlineConfig, Et as Alias, F as RolldownPlugin, Ft as GenerateFileType, G as EntryJsonFragment, Gt as GenerateTemplatesConfig, H as BaseEntry, Ht as GenerateTemplateFileSource, I as RolldownPluginOption, It as GenerateFilenamesOptions, J as ScanComponentItem, Jt as JsonMergeContext, K as PageEntry, Kt as JsFormat, L as RolldownWatchOptions, Lt as GenerateOptions, M as RolldownBuild, Mt as CopyOptions, N as RolldownOptions, Nt as GenerateDirsOptions, O as Plugin, On as WeappViteRuntime, Ot as AlipayNpmMode, P as RolldownOutput, Pt as GenerateExtensionsOptions, Q as UserConfig, Qt as MpPlatform, R as RolldownWatcher, Rt as GenerateTemplate, Sn as WeappManagedServerTsconfigConfig, St as WeappVueConfig, T as ConfigEnv, Tn as WeappWebConfig, Tt as WeappWorkerConfig, U as ComponentEntry, Ut as GenerateTemplateInlineSource, V as AppEntry, Vt as GenerateTemplateFactory, W as Entry, Wt as GenerateTemplateScope, X as ProjectConfig, Xt as JsonMergeStage, Y as WxmlDep, Yt as JsonMergeFunction, Z as SubPackageMetaValue, Zt as JsonMergeStrategy, _n as WeappLibFileName, _t as WeappMcpConfig, an as SharedChunkMode, at as EnhanceOptions, b as ChangeEvent, bn as WeappManagedAppTsconfigConfig, bt as WeappRouteRules, cn as SubPackage, ct as MultiPlatformConfig, dn as SubPackageStyleEntry, dt as WeappAutoRoutesInclude, en as NpmMainPackageConfig, et as WeappForwardConsoleConfig, fn as SubPackageStyleScope, ft as WeappAutoRoutesIncludePattern, gn as WeappLibEntryContext, gt as WeappInjectWeapiConfig, hn as WeappLibDtsOptions, ht as WeappInjectRequestGlobalsTarget, in as SharedChunkDynamicImports, it as AutoImportComponentsOption, j as ResolvedConfig, jt as CopyGlobs, k as PluginOption, kt as BuildNpmPackageMeta, ln as SubPackageStyleConfigEntry, lt as ScanWxmlOptions, mn as WeappLibConfig, mt as WeappInjectRequestGlobalsConfig, nn as NpmSubPackageConfig, nt as WeappViteConfig, on as SharedChunkOverride, ot as EnhanceWxmlOptions, pn as WeappLibComponentJson, pt as WeappHmrConfig, q as ComponentsMap, qt as JsonConfig, rn as ResolvedAlias, rt as AutoImportComponents, sn as SharedChunkStrategy, st as HandleWxmlOptions, tn as NpmPluginPackageConfig, tt as WeappForwardConsoleLogLevel, un as SubPackageStyleConfigObject, ut as WeappAutoRoutesConfig, vn as WeappLibInternalDtsOptions, vt as WeappNpmConfig, w as ComputedDefinitions, wn as WeappManagedTypeScriptConfig, wt as WeappWevuConfig, x as WeappVitePluginApi, xn as WeappManagedNodeTsconfigConfig, xt as WeappSubPackageConfig, yn as WeappLibVueTscOptions, yt as WeappRouteRule, z as ViteDevServer, zt as GenerateTemplateContext } from "./config-CeCx5qMh.mjs";
|
|
4
4
|
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, ComputedDefinitions, ConfigEnv, CopyGlobs, CopyOptions, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmMainPackageConfig, NpmPluginPackageConfig, NpmSubPackageConfig, PageEntry, Plugin, PluginOption, ProjectConfig, Ref, ResolvedAlias, ResolvedConfig, Resolver, RolldownBuild, RolldownOptions, RolldownOutput, RolldownPlugin, RolldownPluginOption, RolldownWatchOptions, RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, ViteDevServer, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappViteConfig, WeappViteHostMeta, WeappVitePluginApi, WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, 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.13.
|
|
4
|
+
"version": "6.13.2",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@weapp-core/logger": "3.1.1",
|
|
122
122
|
"@weapp-core/schematics": "6.0.4",
|
|
123
123
|
"@weapp-core/shared": "3.0.2",
|
|
124
|
-
"@weapp-vite/ast": "6.13.
|
|
124
|
+
"@weapp-vite/ast": "6.13.2",
|
|
125
125
|
"@weapp-vite/mcp": "1.1.2",
|
|
126
126
|
"@weapp-vite/volar": "2.0.8",
|
|
127
127
|
"@weapp-vite/web": "1.3.10",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"rolldown-require": "2.0.12",
|
|
131
131
|
"vite-plugin-performance": "2.0.1",
|
|
132
132
|
"weapp-ide-cli": "5.1.5",
|
|
133
|
-
"wevu": "6.13.
|
|
133
|
+
"wevu": "6.13.2"
|
|
134
134
|
},
|
|
135
135
|
"publishConfig": {
|
|
136
136
|
"access": "public",
|
|
@@ -148,6 +148,8 @@
|
|
|
148
148
|
"build": "tsdown",
|
|
149
149
|
"release": "tsx scripts/release.ts",
|
|
150
150
|
"bench": "vitest bench -c vitest.bench.config.ts",
|
|
151
|
+
"benchmark:auto-import": "node --import tsx scripts/benchmark-auto-import-resolver.ts",
|
|
152
|
+
"benchmark:auto-import:build": "node --import tsx scripts/benchmark-auto-import-build.ts",
|
|
151
153
|
"test:dev": "vitest",
|
|
152
154
|
"test": "vitest run",
|
|
153
155
|
"test:types": "cd test-d/auto-routes-define-app-json && tsd && cd ../config-define-config && tsd",
|