weapp-vite 6.13.1 → 6.13.3
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-import-components/resolvers.d.mts +2 -2
- package/dist/auto-import-components/resolvers.mjs +9 -3
- package/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +2 -18
- package/dist/{config-WBWY_UlE.d.mts → config-Dec415jY.d.mts} +5 -1
- package/dist/config.d.mts +1 -1
- package/dist/{createContext-CwnO-Jw3.mjs → createContext-3UhoQl2A.mjs} +215 -52
- package/dist/{file-WyRp0uK0.mjs → file-BAUXs16l.mjs} +1 -1
- package/dist/{index-B5wBsuYI.d.mts → index-CUFOUU8V.d.mts} +9 -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 +2 -2
- package/package.json +5 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ExternalMetadataFileCandidates, c as Resolver, d as ResolverObject, i as CreateResolver, l as ResolverFn, n as VantResolver, o as Options, r as TDesignResolver, s as ResolvedValue, t as WeuiResolver, u as ResolverMeta } from "../index-
|
|
2
|
-
export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, TDesignResolver, VantResolver, WeuiResolver };
|
|
1
|
+
import { a as ExternalMetadataFileCandidates, c as Resolver, d as ResolverObject, f as ResolverSupportFilesStrategy, i as CreateResolver, l as ResolverFn, n as VantResolver, o as Options, r as TDesignResolver, s as ResolvedValue, t as WeuiResolver, u as ResolverMeta } from "../index-CUFOUU8V.mjs";
|
|
2
|
+
export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, ResolverSupportFilesStrategy, TDesignResolver, VantResolver, WeuiResolver };
|
|
@@ -89,8 +89,9 @@ var tdesign_default = [
|
|
|
89
89
|
//#region src/auto-import-components/resolvers/tdesign.ts
|
|
90
90
|
const defaultPrefix$2 = "t-";
|
|
91
91
|
const TDesignResolver = (opts) => {
|
|
92
|
-
const { prefix, resolve } = defu(opts, {
|
|
92
|
+
const { prefix, resolve, supportFilesStrategy } = defu(opts, {
|
|
93
93
|
prefix: defaultPrefix$2,
|
|
94
|
+
supportFilesStrategy: "full",
|
|
94
95
|
resolve({ name, prefix }) {
|
|
95
96
|
return {
|
|
96
97
|
key: `${prefix}${name}`,
|
|
@@ -108,6 +109,7 @@ const TDesignResolver = (opts) => {
|
|
|
108
109
|
}, {});
|
|
109
110
|
return {
|
|
110
111
|
components: Object.freeze({ ...map }),
|
|
112
|
+
supportFilesStrategy,
|
|
111
113
|
resolve(componentName) {
|
|
112
114
|
const from = map[componentName];
|
|
113
115
|
if (!from) return;
|
|
@@ -219,8 +221,9 @@ var vant_default = [
|
|
|
219
221
|
//#region src/auto-import-components/resolvers/vant.ts
|
|
220
222
|
const defaultPrefix$1 = "van-";
|
|
221
223
|
const VantResolver = (opts) => {
|
|
222
|
-
const { prefix, resolve } = defu(opts, {
|
|
224
|
+
const { prefix, resolve, supportFilesStrategy } = defu(opts, {
|
|
223
225
|
prefix: defaultPrefix$1,
|
|
226
|
+
supportFilesStrategy: "full",
|
|
224
227
|
resolve({ name, prefix }) {
|
|
225
228
|
return {
|
|
226
229
|
key: `${prefix}${name}`,
|
|
@@ -238,6 +241,7 @@ const VantResolver = (opts) => {
|
|
|
238
241
|
}, {});
|
|
239
242
|
return {
|
|
240
243
|
components: Object.freeze({ ...map }),
|
|
244
|
+
supportFilesStrategy,
|
|
241
245
|
resolve(componentName) {
|
|
242
246
|
const from = map[componentName];
|
|
243
247
|
if (!from) return;
|
|
@@ -287,8 +291,9 @@ var weui_default = [
|
|
|
287
291
|
//#region src/auto-import-components/resolvers/weui.ts
|
|
288
292
|
const defaultPrefix = "mp-";
|
|
289
293
|
const WeuiResolver = (opts) => {
|
|
290
|
-
const { prefix, resolve } = defu(opts, {
|
|
294
|
+
const { prefix, resolve, supportFilesStrategy } = defu(opts, {
|
|
291
295
|
prefix: defaultPrefix,
|
|
296
|
+
supportFilesStrategy: "full",
|
|
292
297
|
resolve({ name, prefix }) {
|
|
293
298
|
return {
|
|
294
299
|
key: `${prefix}${name}`,
|
|
@@ -306,6 +311,7 @@ const WeuiResolver = (opts) => {
|
|
|
306
311
|
}, {});
|
|
307
312
|
return {
|
|
308
313
|
components: Object.freeze({ ...map }),
|
|
314
|
+
supportFilesStrategy,
|
|
309
315
|
resolve(componentName) {
|
|
310
316
|
const from = map[componentName];
|
|
311
317
|
if (!from) return;
|
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-3UhoQl2A.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-3UhoQl2A.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-BAUXs16l.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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as Resolver, s as ResolvedValue } from "./index-
|
|
1
|
+
import { c as Resolver, s as ResolvedValue } from "./index-CUFOUU8V.mjs";
|
|
2
2
|
import { t as AutoRoutes } from "./routes-o20IHwXa.mjs";
|
|
3
3
|
import { LRUCache } from "lru-cache";
|
|
4
4
|
import { LoggerConfig } from "@weapp-core/logger";
|
|
@@ -1266,6 +1266,7 @@ interface RuntimeState {
|
|
|
1266
1266
|
};
|
|
1267
1267
|
autoImport: {
|
|
1268
1268
|
registry: Map<string, LocalAutoImportMatch>;
|
|
1269
|
+
resolvedResolverComponents: Map<string, string>;
|
|
1269
1270
|
matcher?: (input: string) => boolean;
|
|
1270
1271
|
matcherKey: string;
|
|
1271
1272
|
};
|
|
@@ -1375,6 +1376,9 @@ interface AutoImportService {
|
|
|
1375
1376
|
registerPotentialComponent: (filePath: string) => Promise<void>;
|
|
1376
1377
|
removePotentialComponent: (filePath: string) => void;
|
|
1377
1378
|
resolve: (componentName: string, importerBaseName?: string) => AutoImportMatch | undefined;
|
|
1379
|
+
setSupportFileResolverComponents: (components: Record<string, string>) => void;
|
|
1380
|
+
clearSupportFileResolverComponents: () => void;
|
|
1381
|
+
collectStaticResolverComponentsForSupportFiles: () => Record<string, string>;
|
|
1378
1382
|
filter: (id: string, meta?: SubPackageMetaValue) => boolean;
|
|
1379
1383
|
getRegisteredLocalComponents: () => LocalAutoImportMatch[];
|
|
1380
1384
|
awaitPendingRegistrations?: () => Promise<void>;
|
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-Dec415jY.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-BAUXs16l.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";
|
|
@@ -237,8 +237,9 @@ function getAutoImportConfig(configService) {
|
|
|
237
237
|
const weappConfig = configService.weappViteConfig;
|
|
238
238
|
if (!weappConfig) return;
|
|
239
239
|
const userConfigured = weappConfig.autoImportComponents ?? weappConfig.enhance?.autoImportComponents;
|
|
240
|
+
const enabledDefaults = createEnabledAutoImportComponents(configService);
|
|
240
241
|
if (userConfigured === false) return;
|
|
241
|
-
const normalizedConfig = userConfigured === true ?
|
|
242
|
+
const normalizedConfig = userConfigured === true ? enabledDefaults : userConfigured ? mergeAutoImportComponents(enabledDefaults, cloneAutoImportComponents(userConfigured), true) : void 0;
|
|
242
243
|
const fallbackConfig = normalizedConfig === void 0 ? createDefaultAutoImportComponents(configService) : void 0;
|
|
243
244
|
const baseConfig = cloneAutoImportComponents(normalizedConfig ?? fallbackConfig);
|
|
244
245
|
const subPackageConfigs = weappConfig.subPackages;
|
|
@@ -1315,6 +1316,7 @@ function createScheduleHelpers(options) {
|
|
|
1315
1316
|
const configChanged = settings.enabled !== outputsState.lastHtmlCustomDataEnabled || settings.outputPath !== outputsState.lastHtmlCustomDataOutput;
|
|
1316
1317
|
if (!shouldWrite && !configChanged && !outputsState.lastHtmlCustomDataOutputPath) return;
|
|
1317
1318
|
outputsState.htmlCustomDataWriteRequested = true;
|
|
1319
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1318
1320
|
if (outputsState.pendingHtmlCustomDataWrite) return;
|
|
1319
1321
|
outputsState.pendingHtmlCustomDataWrite = Promise.resolve().then(async () => {
|
|
1320
1322
|
while (outputsState.htmlCustomDataWriteRequested) {
|
|
@@ -1333,6 +1335,7 @@ function createScheduleHelpers(options) {
|
|
|
1333
1335
|
const configService = ctx.configService;
|
|
1334
1336
|
if (!getAutoImportConfig(configService)) return;
|
|
1335
1337
|
outputsState.writeRequested = true;
|
|
1338
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1336
1339
|
if (outputsState.pendingWrite) return;
|
|
1337
1340
|
outputsState.pendingWrite = Promise.resolve().then(async () => {
|
|
1338
1341
|
while (outputsState.writeRequested) {
|
|
@@ -1355,6 +1358,7 @@ function createScheduleHelpers(options) {
|
|
|
1355
1358
|
const configChanged = settings.enabled !== outputsState.lastTypedComponentsEnabled || settings.outputPath !== outputsState.lastTypedComponentsOutput;
|
|
1356
1359
|
if (!shouldWrite && !configChanged && !outputsState.lastTypedDefinitionOutputPath) return;
|
|
1357
1360
|
outputsState.typedWriteRequested = true;
|
|
1361
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1358
1362
|
if (outputsState.pendingTypedWrite) return;
|
|
1359
1363
|
outputsState.pendingTypedWrite = Promise.resolve().then(async () => {
|
|
1360
1364
|
while (outputsState.typedWriteRequested) {
|
|
@@ -1373,6 +1377,7 @@ function createScheduleHelpers(options) {
|
|
|
1373
1377
|
const configChanged = settings.enabled !== outputsState.lastVueComponentsEnabled || settings.outputPath !== outputsState.lastVueComponentsOutput;
|
|
1374
1378
|
if (!shouldWrite && !configChanged && !outputsState.lastVueComponentsOutputPath) return;
|
|
1375
1379
|
outputsState.vueComponentsWriteRequested = true;
|
|
1380
|
+
outputsState.preparedSyncStatePromise = void 0;
|
|
1376
1381
|
if (outputsState.pendingVueComponentsWrite) return;
|
|
1377
1382
|
outputsState.pendingVueComponentsWrite = Promise.resolve().then(async () => {
|
|
1378
1383
|
while (outputsState.vueComponentsWriteRequested) {
|
|
@@ -4256,6 +4261,19 @@ const VUE_LIKE_EXTENSIONS$2 = [
|
|
|
4256
4261
|
];
|
|
4257
4262
|
const CAMEL_TO_KEBAB_RE$2 = /([a-z0-9])([A-Z])/g;
|
|
4258
4263
|
const TRAILING_INDEX_SEGMENT_RE = /\/index$/;
|
|
4264
|
+
async function getPreparedSyncState(options) {
|
|
4265
|
+
const { outputsState } = options;
|
|
4266
|
+
if (!outputsState.preparedSyncStatePromise) outputsState.preparedSyncStatePromise = Promise.resolve().then(() => {
|
|
4267
|
+
options.syncResolverComponentProps();
|
|
4268
|
+
options.preloadResolverComponentMetadata();
|
|
4269
|
+
const componentNames = collectAllComponentNames(options);
|
|
4270
|
+
return {
|
|
4271
|
+
componentNames,
|
|
4272
|
+
componentMetadataMap: new Map(componentNames.map((name) => [name, options.getComponentMetadata(name)]))
|
|
4273
|
+
};
|
|
4274
|
+
});
|
|
4275
|
+
return await outputsState.preparedSyncStatePromise;
|
|
4276
|
+
}
|
|
4259
4277
|
function toRelativeImportSpecifier(outputPath, sourcePath) {
|
|
4260
4278
|
const relative = path.relative(path.dirname(outputPath), sourcePath).replaceAll("\\", "/");
|
|
4261
4279
|
if (!relative || relative === ".") return "./";
|
|
@@ -4360,9 +4378,11 @@ async function syncTypedComponentsDefinition(settings, options) {
|
|
|
4360
4378
|
outputsState.lastWrittenTypedDefinition = void 0;
|
|
4361
4379
|
return;
|
|
4362
4380
|
}
|
|
4363
|
-
options
|
|
4364
|
-
|
|
4365
|
-
|
|
4381
|
+
const prepared = await getPreparedSyncState(options);
|
|
4382
|
+
const nextDefinition = createTypedComponentsDefinition(prepared.componentNames, (name) => prepared.componentMetadataMap.get(name) ?? {
|
|
4383
|
+
types: /* @__PURE__ */ new Map(),
|
|
4384
|
+
docs: /* @__PURE__ */ new Map()
|
|
4385
|
+
});
|
|
4366
4386
|
if (nextDefinition === outputsState.lastWrittenTypedDefinition && settings.outputPath === outputsState.lastTypedDefinitionOutputPath) return;
|
|
4367
4387
|
try {
|
|
4368
4388
|
if (outputsState.lastTypedDefinitionOutputPath && outputsState.lastTypedDefinitionOutputPath !== settings.outputPath) try {
|
|
@@ -4392,15 +4412,16 @@ async function syncVueComponentsDefinition(settings, options) {
|
|
|
4392
4412
|
outputsState.lastWrittenLayoutTypesDefinition = void 0;
|
|
4393
4413
|
return;
|
|
4394
4414
|
}
|
|
4395
|
-
options
|
|
4396
|
-
options.preloadResolverComponentMetadata();
|
|
4415
|
+
const prepared = await getPreparedSyncState(options);
|
|
4397
4416
|
const outputPath = settings.outputPath;
|
|
4398
|
-
const componentNames = collectAllComponentNames(options);
|
|
4399
4417
|
const layoutNames = await collectLayoutNames(configService.absoluteSrcRoot);
|
|
4400
4418
|
const layoutPropsMap = await collectLayoutPropsMap(ctx);
|
|
4401
4419
|
const layoutTypesOutputPath = resolveLayoutTypesDefaultPath(configService);
|
|
4402
4420
|
const layoutTypesDefinition = createLayoutTypesDefinition(layoutNames, layoutPropsMap);
|
|
4403
|
-
const nextDefinition = createVueComponentsDefinition(componentNames,
|
|
4421
|
+
const nextDefinition = createVueComponentsDefinition(prepared.componentNames, (name) => prepared.componentMetadataMap.get(name) ?? {
|
|
4422
|
+
types: /* @__PURE__ */ new Map(),
|
|
4423
|
+
docs: /* @__PURE__ */ new Map()
|
|
4424
|
+
}, {
|
|
4404
4425
|
useTypedComponents: getTypedComponentsSettings({ configService }).enabled,
|
|
4405
4426
|
moduleName: settings.moduleName,
|
|
4406
4427
|
layoutNames,
|
|
@@ -4444,11 +4465,12 @@ async function syncHtmlCustomData(settings, options) {
|
|
|
4444
4465
|
outputsState.lastWrittenHtmlCustomData = void 0;
|
|
4445
4466
|
return;
|
|
4446
4467
|
}
|
|
4447
|
-
options
|
|
4448
|
-
options.preloadResolverComponentMetadata();
|
|
4449
|
-
const componentNames = collectAllComponentNames(options);
|
|
4468
|
+
const prepared = await getPreparedSyncState(options);
|
|
4450
4469
|
const builtinTags = loadWeappBuiltinHtmlTags();
|
|
4451
|
-
const nextDefinition = createHtmlCustomDataDefinition(componentNames,
|
|
4470
|
+
const nextDefinition = createHtmlCustomDataDefinition(prepared.componentNames, (name) => prepared.componentMetadataMap.get(name) ?? {
|
|
4471
|
+
types: /* @__PURE__ */ new Map(),
|
|
4472
|
+
docs: /* @__PURE__ */ new Map()
|
|
4473
|
+
}, builtinTags);
|
|
4452
4474
|
if (nextDefinition === outputsState.lastWrittenHtmlCustomData && settings.outputPath === outputsState.lastHtmlCustomDataOutputPath) return;
|
|
4453
4475
|
try {
|
|
4454
4476
|
if (outputsState.lastHtmlCustomDataOutputPath && outputsState.lastHtmlCustomDataOutputPath !== settings.outputPath) try {
|
|
@@ -5054,6 +5076,12 @@ async function resolveWeappConfigFile(options) {
|
|
|
5054
5076
|
//#region src/runtime/autoImport/service/registry.ts
|
|
5055
5077
|
const JSON_LIKE_FILE_RE = /\.(?:json|jsonc|json5)$/i;
|
|
5056
5078
|
function createRegistryHelpers(state) {
|
|
5079
|
+
function scheduleOutputs(shouldWrite, vueEnabled) {
|
|
5080
|
+
state.scheduleManifestWrite(shouldWrite);
|
|
5081
|
+
state.scheduleTypedComponentsWrite(shouldWrite);
|
|
5082
|
+
state.scheduleHtmlCustomDataWrite(shouldWrite);
|
|
5083
|
+
state.scheduleVueComponentsWrite(vueEnabled || shouldWrite);
|
|
5084
|
+
}
|
|
5057
5085
|
async function extractComponentPropsFromVue(vuePath) {
|
|
5058
5086
|
const source = await fs.readFile(vuePath, "utf8");
|
|
5059
5087
|
const astEngine = resolveAstEngine(state.ctx.configService?.weappViteConfig);
|
|
@@ -5087,12 +5115,13 @@ function createRegistryHelpers(state) {
|
|
|
5087
5115
|
async function registerLocalComponent(filePath) {
|
|
5088
5116
|
if (!state.ctx.configService || !state.ctx.jsonService) throw new Error("扫描组件前必须初始化 configService/jsonService。");
|
|
5089
5117
|
const baseName = removeExtensionDeep(filePath);
|
|
5090
|
-
const [{ path: jsEntry }, { path: jsonPath }, { path: templatePath }
|
|
5118
|
+
const [{ path: jsEntry }, { path: jsonPath }, { path: templatePath }] = await Promise.all([
|
|
5091
5119
|
findJsEntry(baseName),
|
|
5092
5120
|
findJsonEntry(baseName),
|
|
5093
|
-
findTemplateEntry(baseName)
|
|
5094
|
-
filePath.endsWith(".vue") ? Promise.resolve(filePath) : findVueEntry(baseName)
|
|
5121
|
+
findTemplateEntry(baseName)
|
|
5095
5122
|
]);
|
|
5123
|
+
let vueEntry = filePath.endsWith(".vue") ? filePath : void 0;
|
|
5124
|
+
if ((!jsEntry || !jsonPath || !templatePath) && !vueEntry) vueEntry = await findVueEntry(baseName);
|
|
5096
5125
|
const { removed, removedNames } = removeRegisteredComponent({
|
|
5097
5126
|
baseName,
|
|
5098
5127
|
templatePath,
|
|
@@ -5108,6 +5137,7 @@ function createRegistryHelpers(state) {
|
|
|
5108
5137
|
let resolvedJsonPath = jsonPath;
|
|
5109
5138
|
let resolvedTemplatePath = templatePath;
|
|
5110
5139
|
let json = jsonPath ? await state.ctx.jsonService.read(jsonPath) : void 0;
|
|
5140
|
+
const vueSettings = getVueComponentsSettings(state.ctx);
|
|
5111
5141
|
if ((!resolvedJsEntry || !resolvedJsonPath || !resolvedTemplatePath) && vueEntry) {
|
|
5112
5142
|
const vueConfig = await extractConfigFromVue(vueEntry);
|
|
5113
5143
|
const vueJson = vueConfig && typeof vueConfig === "object" && !Array.isArray(vueConfig) ? { ...vueConfig } : {};
|
|
@@ -5120,34 +5150,22 @@ function createRegistryHelpers(state) {
|
|
|
5120
5150
|
}
|
|
5121
5151
|
}
|
|
5122
5152
|
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);
|
|
5153
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5127
5154
|
return;
|
|
5128
5155
|
}
|
|
5129
5156
|
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);
|
|
5157
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5134
5158
|
return;
|
|
5135
5159
|
}
|
|
5136
5160
|
const { componentName, base } = resolvedComponentName(baseName);
|
|
5137
5161
|
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);
|
|
5162
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5142
5163
|
return;
|
|
5143
5164
|
}
|
|
5144
5165
|
if (state.registry.has(componentName) && base !== "index") {
|
|
5145
5166
|
const message = `发现 \`${componentName}\` 组件重名! 跳过组件 \`${state.ctx.configService.relativeCwd(baseName)}\` 的自动引入`;
|
|
5146
5167
|
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);
|
|
5168
|
+
scheduleOutputs(removed || removedNames.length > 0, vueSettings.enabled);
|
|
5151
5169
|
return;
|
|
5152
5170
|
}
|
|
5153
5171
|
const sourceWithoutExt = removeExtensionDeep(resolvedJsonPath);
|
|
@@ -5169,12 +5187,11 @@ function createRegistryHelpers(state) {
|
|
|
5169
5187
|
state.scheduleManifestWrite(true);
|
|
5170
5188
|
const typedSettings = getTypedComponentsSettings(state.ctx);
|
|
5171
5189
|
const htmlSettings = getHtmlCustomDataSettings(state.ctx);
|
|
5172
|
-
const vueSettings = getVueComponentsSettings(state.ctx);
|
|
5173
5190
|
if (typedSettings.enabled || htmlSettings.enabled) {
|
|
5174
5191
|
const astEngine = resolveAstEngine(state.ctx.configService.weappViteConfig);
|
|
5175
5192
|
let metadataSource = json;
|
|
5176
5193
|
try {
|
|
5177
|
-
if (JSON_LIKE_FILE_RE.test(resolvedJsonPath)) metadataSource = await fs.readJson(resolvedJsonPath);
|
|
5194
|
+
if (!metadataSource && JSON_LIKE_FILE_RE.test(resolvedJsonPath)) metadataSource = await fs.readJson(resolvedJsonPath);
|
|
5178
5195
|
} catch {}
|
|
5179
5196
|
const metadata = extractJsonPropMetadata(metadataSource);
|
|
5180
5197
|
const baseProps = metadata.props;
|
|
@@ -5231,6 +5248,14 @@ const TRAILING_SLASH_RE$1 = /\/+$/;
|
|
|
5231
5248
|
const SCRIPT_OR_DTS_EXTENSION_RE = /\.(?:[cm]?js|tsx?|jsx|d\.ts)$/;
|
|
5232
5249
|
function createResolverHelpers(state) {
|
|
5233
5250
|
const miniprogramDirCache = /* @__PURE__ */ new Map();
|
|
5251
|
+
const resolveCache = /* @__PURE__ */ new Map();
|
|
5252
|
+
const supportFileResolverComponents = /* @__PURE__ */ new Map();
|
|
5253
|
+
function getResolveCacheKey(componentName, importerBaseName) {
|
|
5254
|
+
return `${importerBaseName ?? ""}\0${componentName}`;
|
|
5255
|
+
}
|
|
5256
|
+
function getSupportFilesStrategy(resolver) {
|
|
5257
|
+
return resolver && typeof resolver.supportFilesStrategy === "string" ? resolver.supportFilesStrategy : "used";
|
|
5258
|
+
}
|
|
5234
5259
|
function resolveWithResolver(resolver, componentName, baseName) {
|
|
5235
5260
|
if (!resolver) return;
|
|
5236
5261
|
const candidates = [componentName];
|
|
@@ -5306,15 +5331,27 @@ function createResolverHelpers(state) {
|
|
|
5306
5331
|
} catch {}
|
|
5307
5332
|
}
|
|
5308
5333
|
function collectResolverComponents() {
|
|
5334
|
+
return Object.fromEntries([...state.resolvedResolverComponents, ...supportFileResolverComponents]);
|
|
5335
|
+
}
|
|
5336
|
+
function clearResolveCache() {
|
|
5337
|
+
resolveCache.clear();
|
|
5338
|
+
}
|
|
5339
|
+
function setSupportFileResolverComponents(components) {
|
|
5340
|
+
supportFileResolverComponents.clear();
|
|
5341
|
+
for (const [name, from] of Object.entries(components)) supportFileResolverComponents.set(name, from);
|
|
5342
|
+
}
|
|
5343
|
+
function clearSupportFileResolverComponents() {
|
|
5344
|
+
supportFileResolverComponents.clear();
|
|
5345
|
+
}
|
|
5346
|
+
function collectStaticResolverComponentsForSupportFiles() {
|
|
5309
5347
|
const resolvers = getAutoImportConfig(state.ctx.configService)?.resolvers;
|
|
5310
5348
|
if (!Array.isArray(resolvers)) return {};
|
|
5311
|
-
const
|
|
5349
|
+
const allComponents = /* @__PURE__ */ new Map();
|
|
5312
5350
|
for (const resolver of resolvers) {
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
for (const [name, from] of Object.entries(map)) entries.push([name, from]);
|
|
5351
|
+
if (getSupportFilesStrategy(resolver) !== "full") continue;
|
|
5352
|
+
for (const [name, from] of Object.entries(resolver?.components ?? {})) allComponents.set(name, from);
|
|
5316
5353
|
}
|
|
5317
|
-
return Object.fromEntries(
|
|
5354
|
+
return Object.fromEntries(allComponents);
|
|
5318
5355
|
}
|
|
5319
5356
|
function syncResolverComponentProps() {
|
|
5320
5357
|
const resolverEntries = collectResolverComponents();
|
|
@@ -5334,16 +5371,29 @@ function createResolverHelpers(state) {
|
|
|
5334
5371
|
}
|
|
5335
5372
|
}
|
|
5336
5373
|
function resolveWithResolvers(componentName, importerBaseName) {
|
|
5374
|
+
const cacheKey = getResolveCacheKey(componentName, importerBaseName);
|
|
5375
|
+
if (resolveCache.has(cacheKey)) return resolveCache.get(cacheKey) ?? void 0;
|
|
5337
5376
|
const resolvers = getAutoImportConfig(state.ctx.configService)?.resolvers;
|
|
5338
|
-
if (!Array.isArray(resolvers))
|
|
5377
|
+
if (!Array.isArray(resolvers)) {
|
|
5378
|
+
resolveCache.set(cacheKey, null);
|
|
5379
|
+
return;
|
|
5380
|
+
}
|
|
5339
5381
|
for (const resolver of resolvers) {
|
|
5340
5382
|
const value = resolveWithResolver(resolver, componentName, importerBaseName ?? "");
|
|
5341
|
-
if (value)
|
|
5383
|
+
if (value) {
|
|
5384
|
+
resolveCache.set(cacheKey, value);
|
|
5385
|
+
return value;
|
|
5386
|
+
}
|
|
5342
5387
|
}
|
|
5388
|
+
resolveCache.set(cacheKey, null);
|
|
5343
5389
|
}
|
|
5344
5390
|
return {
|
|
5345
5391
|
collectResolverComponents,
|
|
5392
|
+
clearResolveCache,
|
|
5346
5393
|
syncResolverComponentProps,
|
|
5394
|
+
setSupportFileResolverComponents,
|
|
5395
|
+
clearSupportFileResolverComponents,
|
|
5396
|
+
collectStaticResolverComponentsForSupportFiles,
|
|
5347
5397
|
resolveWithResolvers,
|
|
5348
5398
|
resolveNavigationImport
|
|
5349
5399
|
};
|
|
@@ -5362,6 +5412,7 @@ function logWarnOnce(message) {
|
|
|
5362
5412
|
function createAutoImportService(ctx) {
|
|
5363
5413
|
const autoImportState = ctx.runtimeState.autoImport;
|
|
5364
5414
|
const registry = autoImportState.registry;
|
|
5415
|
+
const resolvedResolverComponents = autoImportState.resolvedResolverComponents;
|
|
5365
5416
|
const manifestFileName = DEFAULT_AUTO_IMPORT_MANIFEST_FILENAME;
|
|
5366
5417
|
const manifestCache = /* @__PURE__ */ new Map();
|
|
5367
5418
|
const componentMetadataMap = /* @__PURE__ */ new Map();
|
|
@@ -5388,11 +5439,13 @@ function createAutoImportService(ctx) {
|
|
|
5388
5439
|
lastTypedComponentsEnabled: false,
|
|
5389
5440
|
lastTypedComponentsOutput: void 0,
|
|
5390
5441
|
lastVueComponentsEnabled: false,
|
|
5391
|
-
lastVueComponentsOutput: void 0
|
|
5442
|
+
lastVueComponentsOutput: void 0,
|
|
5443
|
+
preparedSyncStatePromise: void 0
|
|
5392
5444
|
};
|
|
5393
5445
|
const resolverHelpers = createResolverHelpers({
|
|
5394
5446
|
ctx,
|
|
5395
5447
|
registry,
|
|
5448
|
+
resolvedResolverComponents,
|
|
5396
5449
|
componentMetadataMap,
|
|
5397
5450
|
resolverComponentNames,
|
|
5398
5451
|
resolverComponentsMapRef
|
|
@@ -5437,6 +5490,8 @@ function createAutoImportService(ctx) {
|
|
|
5437
5490
|
registry.clear();
|
|
5438
5491
|
autoImportState.matcher = void 0;
|
|
5439
5492
|
autoImportState.matcherKey = "";
|
|
5493
|
+
resolvedResolverComponents.clear();
|
|
5494
|
+
resolverHelpers.clearResolveCache();
|
|
5440
5495
|
outputsHelpers.scheduleManifestWrite(true);
|
|
5441
5496
|
componentMetadataMap.clear();
|
|
5442
5497
|
resolverComponentNames.clear();
|
|
@@ -5473,11 +5528,34 @@ function createAutoImportService(ctx) {
|
|
|
5473
5528
|
outputsHelpers.scheduleHtmlCustomDataWrite(removed || removedNames.length > 0);
|
|
5474
5529
|
outputsHelpers.scheduleVueComponentsWrite(removed || removedNames.length > 0);
|
|
5475
5530
|
},
|
|
5531
|
+
setSupportFileResolverComponents(components) {
|
|
5532
|
+
resolverHelpers.setSupportFileResolverComponents(components);
|
|
5533
|
+
outputsHelpers.scheduleManifestWrite(true);
|
|
5534
|
+
const typedSettings = getTypedComponentsSettings(ctx);
|
|
5535
|
+
const htmlSettings = getHtmlCustomDataSettings(ctx);
|
|
5536
|
+
const vueSettings = getVueComponentsSettings(ctx);
|
|
5537
|
+
if (typedSettings.enabled || htmlSettings.enabled) resolverHelpers.syncResolverComponentProps();
|
|
5538
|
+
if (typedSettings.enabled) outputsHelpers.scheduleTypedComponentsWrite(true);
|
|
5539
|
+
if (htmlSettings.enabled) outputsHelpers.scheduleHtmlCustomDataWrite(true);
|
|
5540
|
+
if (vueSettings.enabled) {
|
|
5541
|
+
resolverHelpers.syncResolverComponentProps();
|
|
5542
|
+
outputsHelpers.scheduleVueComponentsWrite(true);
|
|
5543
|
+
}
|
|
5544
|
+
},
|
|
5545
|
+
clearSupportFileResolverComponents() {
|
|
5546
|
+
resolverHelpers.clearSupportFileResolverComponents();
|
|
5547
|
+
resolverHelpers.syncResolverComponentProps();
|
|
5548
|
+
},
|
|
5549
|
+
collectStaticResolverComponentsForSupportFiles() {
|
|
5550
|
+
return resolverHelpers.collectStaticResolverComponentsForSupportFiles();
|
|
5551
|
+
},
|
|
5476
5552
|
resolve(componentName, importerBaseName) {
|
|
5477
5553
|
const local = registry.get(componentName);
|
|
5478
5554
|
if (local) return local;
|
|
5479
5555
|
const resolvedValue = resolverHelpers.resolveWithResolvers(componentName, importerBaseName);
|
|
5480
5556
|
if (resolvedValue) {
|
|
5557
|
+
const resolverChanged = resolvedResolverComponents.get(resolvedValue.name) !== resolvedValue.from;
|
|
5558
|
+
resolvedResolverComponents.set(resolvedValue.name, resolvedValue.from);
|
|
5481
5559
|
const resolved = {
|
|
5482
5560
|
kind: "resolver",
|
|
5483
5561
|
value: resolvedValue
|
|
@@ -5486,14 +5564,16 @@ function createAutoImportService(ctx) {
|
|
|
5486
5564
|
const htmlSettings = getHtmlCustomDataSettings(ctx);
|
|
5487
5565
|
const vueSettings = getVueComponentsSettings(ctx);
|
|
5488
5566
|
if (typedSettings.enabled || htmlSettings.enabled) {
|
|
5489
|
-
|
|
5567
|
+
const metadataMissing = !componentMetadataMap.has(resolved.value.name);
|
|
5568
|
+
if (metadataMissing) componentMetadataMap.set(resolved.value.name, {
|
|
5490
5569
|
types: /* @__PURE__ */ new Map(),
|
|
5491
5570
|
docs: /* @__PURE__ */ new Map()
|
|
5492
5571
|
});
|
|
5493
|
-
if (typedSettings.enabled) outputsHelpers.scheduleTypedComponentsWrite(true);
|
|
5494
|
-
if (htmlSettings.enabled) outputsHelpers.scheduleHtmlCustomDataWrite(true);
|
|
5572
|
+
if (typedSettings.enabled && (resolverChanged || metadataMissing)) outputsHelpers.scheduleTypedComponentsWrite(true);
|
|
5573
|
+
if (htmlSettings.enabled && (resolverChanged || metadataMissing)) outputsHelpers.scheduleHtmlCustomDataWrite(true);
|
|
5495
5574
|
} else componentMetadataMap.delete(resolved.value.name);
|
|
5496
|
-
if (vueSettings.enabled) outputsHelpers.scheduleVueComponentsWrite(true);
|
|
5575
|
+
if (vueSettings.enabled && resolverChanged) outputsHelpers.scheduleVueComponentsWrite(true);
|
|
5576
|
+
if (resolverChanged) outputsHelpers.scheduleManifestWrite(true);
|
|
5497
5577
|
return resolved;
|
|
5498
5578
|
}
|
|
5499
5579
|
},
|
|
@@ -6211,9 +6291,14 @@ function ensureSubPackage(map, root) {
|
|
|
6211
6291
|
}
|
|
6212
6292
|
return set;
|
|
6213
6293
|
}
|
|
6214
|
-
function shouldIncludeScanCandidate(candidate, json) {
|
|
6294
|
+
function shouldIncludeScanCandidate(candidate, json, route) {
|
|
6215
6295
|
if (candidate.jsonPath && json === void 0) return false;
|
|
6216
6296
|
if (json && typeof json === "object" && json.component === true) return false;
|
|
6297
|
+
if (route?.root && !route.pagePath.startsWith("pages/") && candidate.hasScript && !candidate.hasTemplate && !candidate.jsonPath) {
|
|
6298
|
+
const hasVueEntry = [...candidate.files].some((file) => file.endsWith(".vue"));
|
|
6299
|
+
const isIndexEntry = path.basename(route.pagePath) === "index";
|
|
6300
|
+
if (!hasVueEntry && !isIndexEntry) return false;
|
|
6301
|
+
}
|
|
6217
6302
|
return candidate.hasScript || candidate.hasTemplate || Boolean(candidate.jsonPath);
|
|
6218
6303
|
}
|
|
6219
6304
|
async function scanRoutes(ctx, candidatesMap) {
|
|
@@ -6247,7 +6332,7 @@ async function scanRoutes(ctx, candidatesMap) {
|
|
|
6247
6332
|
const route = resolveRoute(normalizedBase, subPackageRoots);
|
|
6248
6333
|
if (!route) continue;
|
|
6249
6334
|
watchDirs.add(path.dirname(candidate.base));
|
|
6250
|
-
if (!shouldIncludeScanCandidate(candidate, jsonMap.get(candidate))) continue;
|
|
6335
|
+
if (!shouldIncludeScanCandidate(candidate, jsonMap.get(candidate), route)) continue;
|
|
6251
6336
|
entriesSet.add(route.entry);
|
|
6252
6337
|
if (route.root) ensureSubPackage(subPackages, route.root).add(route.pagePath);
|
|
6253
6338
|
else pagesSet.add(route.pagePath);
|
|
@@ -9881,6 +9966,10 @@ const LEADING_SLASHES_RE$2 = /^\/+/;
|
|
|
9881
9966
|
const GLOB_WILDCARD_RE = /[*?[{]/;
|
|
9882
9967
|
const TRAILING_SLASHES_RE$1 = /\/+$/;
|
|
9883
9968
|
const AUTO_IMPORT_WATCHER_KEY = "__auto-import-vue-watcher__";
|
|
9969
|
+
const AUTO_IMPORT_CONFIG_SUFFIXES = configExtensions.map((ext) => `.${ext}`);
|
|
9970
|
+
const AUTO_IMPORT_JS_SUFFIXES = new Set(jsExtensions.map((ext) => `.${ext}`));
|
|
9971
|
+
const AUTO_IMPORT_TEMPLATE_SUFFIXES = new Set(templateExtensions.map((ext) => `.${ext}`));
|
|
9972
|
+
const AUTO_IMPORT_VUE_SUFFIXES = new Set(vueExtensions.map((ext) => `.${ext}`));
|
|
9884
9973
|
function isEnabledOutputOption(option) {
|
|
9885
9974
|
if (option === true) return true;
|
|
9886
9975
|
if (typeof option === "string") return option.trim().length > 0;
|
|
@@ -9901,6 +9990,44 @@ function normalizeChangedPath(id) {
|
|
|
9901
9990
|
const [pathWithoutQuery] = id.split("?");
|
|
9902
9991
|
return pathWithoutQuery;
|
|
9903
9992
|
}
|
|
9993
|
+
function getAutoImportCandidateKind(filePath) {
|
|
9994
|
+
if (AUTO_IMPORT_VUE_SUFFIXES.has(path.extname(filePath))) return "vue";
|
|
9995
|
+
if (AUTO_IMPORT_TEMPLATE_SUFFIXES.has(path.extname(filePath))) return "template";
|
|
9996
|
+
if (AUTO_IMPORT_JS_SUFFIXES.has(path.extname(filePath))) return "script";
|
|
9997
|
+
if (AUTO_IMPORT_CONFIG_SUFFIXES.some((suffix) => filePath.endsWith(suffix))) return "config";
|
|
9998
|
+
}
|
|
9999
|
+
function getAutoImportCandidateBase(filePath, kind) {
|
|
10000
|
+
if (!kind) return;
|
|
10001
|
+
if (kind === "config") {
|
|
10002
|
+
const suffix = AUTO_IMPORT_CONFIG_SUFFIXES.find((item) => filePath.endsWith(item));
|
|
10003
|
+
return suffix ? filePath.slice(0, -suffix.length) : void 0;
|
|
10004
|
+
}
|
|
10005
|
+
return filePath.slice(0, -path.extname(filePath).length);
|
|
10006
|
+
}
|
|
10007
|
+
function rankAutoImportCandidate(kind) {
|
|
10008
|
+
switch (kind) {
|
|
10009
|
+
case "vue": return 4;
|
|
10010
|
+
case "template": return 3;
|
|
10011
|
+
case "script": return 2;
|
|
10012
|
+
case "config": return 1;
|
|
10013
|
+
default: return 0;
|
|
10014
|
+
}
|
|
10015
|
+
}
|
|
10016
|
+
function collectDistinctAutoImportCandidates(files) {
|
|
10017
|
+
const bestByBase = /* @__PURE__ */ new Map();
|
|
10018
|
+
for (const filePath of files) {
|
|
10019
|
+
const kind = getAutoImportCandidateKind(filePath);
|
|
10020
|
+
const base = getAutoImportCandidateBase(filePath, kind);
|
|
10021
|
+
if (!kind || !base) continue;
|
|
10022
|
+
const rank = rankAutoImportCandidate(kind);
|
|
10023
|
+
const existing = bestByBase.get(base);
|
|
10024
|
+
if (!existing || rank > existing.rank || rank === existing.rank && filePath < existing.filePath) bestByBase.set(base, {
|
|
10025
|
+
filePath,
|
|
10026
|
+
rank
|
|
10027
|
+
});
|
|
10028
|
+
}
|
|
10029
|
+
return Array.from(bestByBase.values(), (entry) => entry.filePath).sort((a, b) => a.localeCompare(b));
|
|
10030
|
+
}
|
|
9904
10031
|
function resolveAbsolutePath(ctx, candidate) {
|
|
9905
10032
|
const { configService } = ctx;
|
|
9906
10033
|
if (!configService) return;
|
|
@@ -9930,10 +10057,10 @@ async function findAutoImportCandidates(state, globs) {
|
|
|
9930
10057
|
const { configService } = ctx;
|
|
9931
10058
|
if (!resolvedConfig) return [];
|
|
9932
10059
|
const ignore = [...defaultExcluded, `${resolvedConfig.build.outDir}/**`];
|
|
9933
|
-
return await new fdir({
|
|
10060
|
+
return collectDistinctAutoImportCandidates(await new fdir({
|
|
9934
10061
|
includeDirs: false,
|
|
9935
10062
|
pathSeparator: "/"
|
|
9936
|
-
}).withFullPaths().globWithOptions(globs.map((pattern) => path.resolve(configService.absoluteSrcRoot, pattern)), { ignore }).crawl(configService.absoluteSrcRoot).withPromise();
|
|
10063
|
+
}).withFullPaths().globWithOptions(globs.map((pattern) => path.resolve(configService.absoluteSrcRoot, pattern)), { ignore }).crawl(configService.absoluteSrcRoot).withPromise());
|
|
9937
10064
|
}
|
|
9938
10065
|
function registerAutoImportWatchTargets(state, globs, registrar, options = {}) {
|
|
9939
10066
|
const { configService } = state.ctx;
|
|
@@ -9968,11 +10095,13 @@ function createAutoImportPlugin(state) {
|
|
|
9968
10095
|
}
|
|
9969
10096
|
}));
|
|
9970
10097
|
watcher.on("add", (filePath) => {
|
|
10098
|
+
if (!getAutoImportCandidateKind(filePath)) return;
|
|
9971
10099
|
if (!matchesAutoImportGlobs(ctx, filePath)) return;
|
|
9972
10100
|
logger_default.info(`[auto-import:watch] 新增组件文件 ${configService.relativeCwd(filePath)}`);
|
|
9973
10101
|
autoImportService.registerPotentialComponent(filePath);
|
|
9974
10102
|
});
|
|
9975
10103
|
watcher.on("unlink", (filePath) => {
|
|
10104
|
+
if (!getAutoImportCandidateKind(filePath)) return;
|
|
9976
10105
|
if (!matchesAutoImportGlobs(ctx, filePath)) return;
|
|
9977
10106
|
logger_default.info(`[auto-import:watch] 删除组件文件 ${configService.relativeCwd(filePath)}`);
|
|
9978
10107
|
autoImportService.removePotentialComponent(filePath);
|
|
@@ -10022,6 +10151,7 @@ function createAutoImportPlugin(state) {
|
|
|
10022
10151
|
const absolutePath = resolveAbsolutePath(ctx, filePath);
|
|
10023
10152
|
if (!absolutePath) return;
|
|
10024
10153
|
if (!matchesAutoImportGlobs(ctx, absolutePath)) return;
|
|
10154
|
+
if (!getAutoImportCandidateKind(absolutePath)) return;
|
|
10025
10155
|
if (change.event === "delete") {
|
|
10026
10156
|
autoImportService.removePotentialComponent(absolutePath);
|
|
10027
10157
|
return;
|
|
@@ -19084,6 +19214,7 @@ function createRuntimeState() {
|
|
|
19084
19214
|
},
|
|
19085
19215
|
autoImport: {
|
|
19086
19216
|
registry: /* @__PURE__ */ new Map(),
|
|
19217
|
+
resolvedResolverComponents: /* @__PURE__ */ new Map(),
|
|
19087
19218
|
matcherKey: ""
|
|
19088
19219
|
},
|
|
19089
19220
|
build: {
|
|
@@ -19487,7 +19618,7 @@ function createScanService(ctx) {
|
|
|
19487
19618
|
const vueAppPath = await findVueEntry(appBasename);
|
|
19488
19619
|
let configFromVue;
|
|
19489
19620
|
if (!appConfigFile && vueAppPath) {
|
|
19490
|
-
const { extractConfigFromVue } = await import("./file-
|
|
19621
|
+
const { extractConfigFromVue } = await import("./file-BAUXs16l.mjs").then((n) => n.r);
|
|
19491
19622
|
configFromVue = await extractConfigFromVue(vueAppPath);
|
|
19492
19623
|
if (configFromVue) appConfigFile = vueAppPath;
|
|
19493
19624
|
}
|
|
@@ -20208,6 +20339,31 @@ async function hasManagedTsconfigChanges(ctx) {
|
|
|
20208
20339
|
for (const file of files) if (await readFile(file.path, "utf8").catch(() => void 0) !== file.content) return true;
|
|
20209
20340
|
return false;
|
|
20210
20341
|
}
|
|
20342
|
+
async function collectAutoImportTemplateTags(ctx) {
|
|
20343
|
+
const srcRoot = ctx.configService?.absoluteSrcRoot;
|
|
20344
|
+
if (!srcRoot) return [];
|
|
20345
|
+
const files = await new fdir({
|
|
20346
|
+
includeDirs: false,
|
|
20347
|
+
pathSeparator: "/"
|
|
20348
|
+
}).withFullPaths().filter((filePath) => filePath.endsWith(".vue") || filePath.endsWith(".wxml")).crawl(srcRoot).withPromise();
|
|
20349
|
+
const tags = /* @__PURE__ */ new Map();
|
|
20350
|
+
const platform = ctx.configService?.platform ?? "weapp";
|
|
20351
|
+
for (const filePath of files) {
|
|
20352
|
+
const source = await readFile(filePath, "utf8").catch(() => void 0);
|
|
20353
|
+
if (!source) continue;
|
|
20354
|
+
if (filePath.endsWith(".vue")) {
|
|
20355
|
+
const { descriptor, errors } = parse(source, { filename: filePath });
|
|
20356
|
+
if (errors.length > 0 || !descriptor.template?.content) continue;
|
|
20357
|
+
for (const tag of collectVueTemplateAutoImportTags(descriptor.template.content, filePath)) tags.set(tag, removeExtensionDeep(filePath));
|
|
20358
|
+
continue;
|
|
20359
|
+
}
|
|
20360
|
+
for (const tag of Object.keys(scanWxml(source, { platform }).components)) tags.set(tag, removeExtensionDeep(filePath));
|
|
20361
|
+
}
|
|
20362
|
+
return Array.from(tags.entries(), ([tag, importerBaseName]) => ({
|
|
20363
|
+
tag,
|
|
20364
|
+
importerBaseName
|
|
20365
|
+
}));
|
|
20366
|
+
}
|
|
20211
20367
|
async function syncProjectSupportFiles(ctx) {
|
|
20212
20368
|
const managedTsconfigChanged = await hasManagedTsconfigChanges(ctx);
|
|
20213
20369
|
await syncManagedTsconfigFiles(ctx);
|
|
@@ -20223,7 +20379,14 @@ async function syncProjectSupportFiles(ctx) {
|
|
|
20223
20379
|
}, globs);
|
|
20224
20380
|
await Promise.all(files.map((file) => ctx.autoImportService.registerPotentialComponent(file)));
|
|
20225
20381
|
} else if (!shouldBootstrapAutoImportWithoutGlobs(autoImportConfig)) {}
|
|
20226
|
-
await ctx
|
|
20382
|
+
const templateTags = await collectAutoImportTemplateTags(ctx);
|
|
20383
|
+
for (const { tag, importerBaseName } of templateTags) ctx.autoImportService.resolve(tag, importerBaseName);
|
|
20384
|
+
ctx.autoImportService.setSupportFileResolverComponents(ctx.autoImportService.collectStaticResolverComponentsForSupportFiles());
|
|
20385
|
+
try {
|
|
20386
|
+
await ctx.autoImportService.awaitManifestWrites();
|
|
20387
|
+
} finally {
|
|
20388
|
+
ctx.autoImportService.clearSupportFileResolverComponents();
|
|
20389
|
+
}
|
|
20227
20390
|
}
|
|
20228
20391
|
return { managedTsconfigChanged };
|
|
20229
20392
|
}
|
|
@@ -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-3UhoQl2A.mjs").then((n) => n.a);
|
|
106
106
|
const compilerContext = getCompilerContext();
|
|
107
107
|
const service = compilerContext.autoRoutesService;
|
|
108
108
|
const reference = service?.getReference?.();
|
|
@@ -3,6 +3,7 @@ interface ResolvedValue {
|
|
|
3
3
|
name: string;
|
|
4
4
|
from: string;
|
|
5
5
|
}
|
|
6
|
+
type ResolverSupportFilesStrategy = 'used' | 'full';
|
|
6
7
|
interface ExternalMetadataFileCandidates {
|
|
7
8
|
packageName: string;
|
|
8
9
|
/**
|
|
@@ -19,6 +20,12 @@ interface ResolverMeta {
|
|
|
19
20
|
* 解析器静态可用的组件映射
|
|
20
21
|
*/
|
|
21
22
|
components?: Record<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* `.weapp-vite` 支持文件生成策略。
|
|
25
|
+
* - `used`: 仅为模板/源码实际命中的组件生成支持文件
|
|
26
|
+
* - `full`: 为 resolver 静态可枚举的全部组件生成支持文件
|
|
27
|
+
*/
|
|
28
|
+
supportFilesStrategy?: ResolverSupportFilesStrategy;
|
|
22
29
|
/**
|
|
23
30
|
* 当 `from` 命中该解析器管理的外部依赖时,返回该依赖在包内可能的 metadata 文件候选路径。
|
|
24
31
|
*
|
|
@@ -37,6 +44,7 @@ interface ResolveOptions {
|
|
|
37
44
|
}
|
|
38
45
|
interface Options {
|
|
39
46
|
prefix?: string;
|
|
47
|
+
supportFilesStrategy?: ResolverSupportFilesStrategy;
|
|
40
48
|
resolve?: (options: ResolveOptions) => {
|
|
41
49
|
key: string;
|
|
42
50
|
value: string;
|
|
@@ -53,4 +61,4 @@ declare const VantResolver: CreateResolver;
|
|
|
53
61
|
//#region src/auto-import-components/resolvers/weui.d.ts
|
|
54
62
|
declare const WeuiResolver: CreateResolver;
|
|
55
63
|
//#endregion
|
|
56
|
-
export { ExternalMetadataFileCandidates as a, Resolver as c, ResolverObject as d, CreateResolver as i, ResolverFn as l, VantResolver as n, Options as o, TDesignResolver as r, ResolvedValue as s, WeuiResolver as t, ResolverMeta as u };
|
|
64
|
+
export { ExternalMetadataFileCandidates as a, Resolver as c, ResolverObject as d, ResolverSupportFilesStrategy as f, CreateResolver as i, ResolverFn as l, VantResolver as n, Options as o, TDesignResolver as r, ResolvedValue as s, WeuiResolver as t, ResolverMeta as u };
|
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-Dec415jY.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-3UhoQl2A.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-Dec415jY.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-Dec415jY.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
|
-
import { c as Resolver } from "./index-
|
|
1
|
+
import { c as Resolver } from "./index-CUFOUU8V.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-Dec415jY.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.3",
|
|
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.3",
|
|
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.3"
|
|
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",
|