weapp-vite 6.18.2 → 6.18.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.
@@ -1,4 +1,4 @@
1
- import { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-DC-ADEdC.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-D0jhm5Nj.mjs";
2
2
  //#region src/auto-routes.ts
3
3
  const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
4
4
  function createGetter(resolver) {
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, a as formatBytes, b as getProjectConfigFileName, d as syncProjectSupportFiles, f as syncManagedTsconfigBootstrapFiles, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, p as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappViteTarget, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-DC-ADEdC.mjs";
1
+ import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, a as formatBytes, b as getProjectConfigFileName, d as syncProjectSupportFiles, f as syncManagedTsconfigBootstrapFiles, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, p as createSharedBuildConfig, t as createCompilerContext, u as resolveWeappViteTarget, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-D0jhm5Nj.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-DLA_2D0c.mjs";
3
+ import { h as VERSION } from "./file-BFzjMcYM.mjs";
4
4
  import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -4496,7 +4496,7 @@ function resolveRunnableHotkeyDefinition(input) {
4496
4496
  }
4497
4497
  //#endregion
4498
4498
  //#region package.json
4499
- var version = "6.18.2";
4499
+ var version = "6.18.3";
4500
4500
  //#endregion
4501
4501
  //#region src/cli/devHotkeys/format.ts
4502
4502
  const FULLWIDTH_ASCII_START = 65281;
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.mjs";
3
- import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-DLA_2D0c.mjs";
3
+ import { _ as jsExtensions, a as findJsonEntry, b as vueExtensions, c as isJsOrTs, d as touch, g as configExtensions, i as findJsEntry, l as isTemplate, n as changeFileExtension, o as findTemplateEntry, p as inlineAutoRoutesImports, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as supportedCssLangs, y as templateExtensions } from "./file-BFzjMcYM.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import path, { posix } from "pathe";
6
6
  import path$1, { normalize, relative, win32 } from "node:path";
@@ -14,7 +14,7 @@ import fs$1, { existsSync, readFileSync } from "node:fs";
14
14
  import { compileScript, parse } from "vue/compiler-sfc";
15
15
  import { BABEL_TS_MODULE_PARSER_OPTIONS, generate, getVisitorKeys, parse as parse$2, parseJsLike, traverse } from "@weapp-vite/ast/babel";
16
16
  import pm from "picomatch";
17
- import { VUE_COMPONENT_TAG_RE, WE_VU_INTERNAL_REACTIVITY_MODULE_ID, WE_VU_INTERNAL_RUNTIME_MODULE_ID, WE_VU_INTERNAL_TEMPLATE_MODULE_ID, WE_VU_RUNTIME_APIS, buildClassStyleComputedCode, collectVueTemplateTags, compileJsxFile, compileVueFile, compileVueStyleToWxss, createJsonMerger, createPageEntryMatcher, createPageEntryMatcher as createPageEntryMatcher$1, generateScopedId, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, pathExists, readAndParseSfc, readFile as readFile$1, resolveClassStyleWxsLocation, stripJsonMacroCallsFromCode } from "wevu/compiler";
17
+ import { VUE_COMPONENT_TAG_RE, WE_VU_INTERNAL_REACTIVITY_MODULE_ID, WE_VU_INTERNAL_RUNTIME_MODULE_ID, WE_VU_INTERNAL_TEMPLATE_MODULE_ID, WE_VU_RUNTIME_APIS, buildClassStyleComputedCode, collectVueTemplateTags, compileJsxFile, compileVueFile, compileVueStyleToWxss, createJsonMerger, createPageEntryMatcher, createPageEntryMatcher as createPageEntryMatcher$1, generateScopedId, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, pathExists, readAndParseSfc, readFile as readFile$1, refreshVueFileJsonConfig, resolveClassStyleWxsLocation, stripJsonMacroCallsFromCode } from "wevu/compiler";
18
18
  import process from "node:process";
19
19
  import { parse as parse$1, stringify } from "comment-json";
20
20
  import fs$2, { appendFile, copyFile, mkdir, readFile, readdir, rm } from "node:fs/promises";
@@ -28795,6 +28795,168 @@ function parseUsingComponents(config) {
28795
28795
  }
28796
28796
  }
28797
28797
  //#endregion
28798
+ //#region src/plugins/vue/transform/plugin/transformFile/finalize.ts
28799
+ async function finalizeVueTransform(options) {
28800
+ const { ctx, pluginCtx, filename, source, autoRoutesSignature, result, compilationCache, currentStyleIndependentSignature, previousStyleSignature, dirtyEntryId, dirtyVueEntryIds, isCssImporterDirty, isPage, isApp, sourceMap, styleBlocksCache, styleRefreshTokens, scopedSlotModules, emittedScopedSlotChunks, setAppShell, readAndParseSfc, createReadAndParseSfcOptions, measureStage, measureVueHmrStage, reportTiming } = options;
28801
+ const configService = ctx.configService;
28802
+ let currentStyleBlocks = Array.isArray(result.meta?.styleBlocks) ? result.meta.styleBlocks : styleBlocksCache.get(filename);
28803
+ if (!currentStyleBlocks) currentStyleBlocks = await measureStage("preloadSfcStyles", async () => await loadStyleBlocksForStyleOnlyRefresh({
28804
+ filename,
28805
+ source,
28806
+ styleBlocksCache,
28807
+ readAndParseSfc,
28808
+ createReadAndParseSfcOptions,
28809
+ pluginCtx,
28810
+ configService
28811
+ }));
28812
+ if (currentStyleBlocks) styleBlocksCache.set(filename, currentStyleBlocks);
28813
+ if (configService.isDev && dirtyEntryId) {
28814
+ const currentStyleSignature = createSfcStyleBlocksSignature(currentStyleBlocks);
28815
+ const hmrEventId = ctx.runtimeState.build?.hmr?.profile?.eventId;
28816
+ if (hmrEventId != null && (isCssImporterDirty || currentStyleSignature && currentStyleSignature !== previousStyleSignature)) styleRefreshTokens.set(filename, hmrEventId);
28817
+ else styleRefreshTokens.delete(filename);
28818
+ dirtyVueEntryIds?.delete(dirtyEntryId);
28819
+ }
28820
+ const sfcStyleDependencies = syncVueSfcStyleDependencies(ctx, filename, currentStyleBlocks);
28821
+ for (const dependency of sfcStyleDependencies) addNormalizedWatchFile(pluginCtx, dependency);
28822
+ registerScopedSlotHostGenerics(ctx, result.scopedSlotComponents, parseUsingComponents(result.config));
28823
+ await measureVueHmrStage("finalizeCompiledResult", "vueFinalizeCompiledMs", async () => {
28824
+ await finalizeTransformCompiledResult({
28825
+ ctx,
28826
+ pluginCtx,
28827
+ filename,
28828
+ source,
28829
+ autoRoutesSignature,
28830
+ result,
28831
+ compilationCache,
28832
+ styleIndependentSignature: filename.endsWith(".vue") ? currentStyleIndependentSignature ?? resolveVueSfcStyleIndependentSignature(source, filename) : void 0,
28833
+ setAppShell,
28834
+ configService,
28835
+ isPage,
28836
+ isApp,
28837
+ sourceMap,
28838
+ scopedSlotModules,
28839
+ emittedScopedSlotChunks,
28840
+ addWatchFile: addNormalizedWatchFile,
28841
+ emitScopedSlotChunks
28842
+ });
28843
+ });
28844
+ const returnedCode = await measureVueHmrStage("finalizeCode", "vueFinalizeCodeMs", async () => finalizeTransformEntryCode({
28845
+ result,
28846
+ filename,
28847
+ styleBlocks: result.meta?.styleBlocks ?? styleBlocksCache.get(filename),
28848
+ isPage,
28849
+ isApp,
28850
+ isDev: configService.isDev,
28851
+ sourceMap,
28852
+ hmrStyleToken: configService.isDev ? styleRefreshTokens.get(filename) : void 0
28853
+ }));
28854
+ reportTiming(filename, isPage);
28855
+ return returnedCode;
28856
+ }
28857
+ //#endregion
28858
+ //#region src/plugins/vue/transform/plugin/transformFile/jsonOnly.ts
28859
+ function isVueJsonOnlyDirtyReasonSummary(dirtyReasonSummary) {
28860
+ return Boolean(dirtyReasonSummary?.length && dirtyReasonSummary.every((item) => item.startsWith("entry-json-only:")));
28861
+ }
28862
+ async function tryRefreshJsonOnlyVueCompilation(options) {
28863
+ const { cachedResult, compileOptions, dirtyEntryId, dirtyReasonSummary, filename, isDev, scanDirty, source, autoRoutesSignature, cachedAutoRoutesSignature } = options;
28864
+ if (!isDev || scanDirty || !dirtyEntryId || !cachedResult || !filename.endsWith(".vue") || cachedAutoRoutesSignature !== autoRoutesSignature || !isVueJsonOnlyDirtyReasonSummary(dirtyReasonSummary)) return;
28865
+ const refreshed = await refreshVueFileJsonConfig(source, filename, cachedResult, compileOptions);
28866
+ return refreshed ? normalizeVueTransformResult(refreshed) : void 0;
28867
+ }
28868
+ //#endregion
28869
+ //#region src/plugins/vue/transform/plugin/transformFile/reuse.ts
28870
+ async function tryReuseVueCompilation(options) {
28871
+ const { ctx, pluginCtx, filename, source, cachedCompilation, previousStyleSignature, autoRoutesSignature, dirtyEntryId, dirtyVueEntryIds, isCssImporterDirty, canAttemptStyleOnlyReuse, sourceMap, isApp, styleBlocksCache, styleRefreshTokens, readAndParseSfc, createReadAndParseSfcOptions, measureStage, measureVueHmrStage, reportTiming } = options;
28872
+ const configService = ctx.configService;
28873
+ if (configService.isDev && cachedCompilation && !ctx.runtimeState.scan.isDirty && cachedCompilation.source === source && cachedCompilation.autoRoutesSignature === autoRoutesSignature) {
28874
+ cachedCompilation.refreshToken = 0;
28875
+ const cachedResult = normalizeVueTransformResult(cachedCompilation.result);
28876
+ let cachedStyleBlocks = cachedResult.meta?.styleBlocks ?? styleBlocksCache.get(filename);
28877
+ let canReturnCachedCompilation = true;
28878
+ if (dirtyEntryId && canAttemptStyleOnlyReuse && filename.endsWith(".vue")) {
28879
+ const refreshedStyleBlocks = await measureStage("loadStyleOnlySfcStyles", async () => await loadStyleBlocksForStyleOnlyRefresh({
28880
+ filename,
28881
+ source,
28882
+ styleBlocksCache,
28883
+ force: true,
28884
+ readAndParseSfc,
28885
+ createReadAndParseSfcOptions,
28886
+ pluginCtx,
28887
+ configService
28888
+ }));
28889
+ if (!refreshStyleOnlyVueTransformResult(cachedResult, filename, refreshedStyleBlocks)) {
28890
+ cachedCompilation.styleIndependentSignature = void 0;
28891
+ canReturnCachedCompilation = false;
28892
+ } else {
28893
+ cachedStyleBlocks = refreshedStyleBlocks;
28894
+ cachedCompilation.result = cachedResult;
28895
+ const currentStyleSignature = createSfcStyleBlocksSignature(cachedStyleBlocks);
28896
+ const hmrEventId = ctx.runtimeState.build?.hmr?.profile?.eventId;
28897
+ if (hmrEventId != null && (isCssImporterDirty || currentStyleSignature && currentStyleSignature !== previousStyleSignature)) styleRefreshTokens.set(filename, hmrEventId);
28898
+ else styleRefreshTokens.delete(filename);
28899
+ }
28900
+ }
28901
+ if (!canReturnCachedCompilation) cachedCompilation.refreshToken = 1;
28902
+ else {
28903
+ const returnedCode = await measureVueHmrStage("finalizeCode", "vueFinalizeCodeMs", async () => finalizeTransformEntryCode({
28904
+ result: cachedResult,
28905
+ filename,
28906
+ styleBlocks: cachedStyleBlocks,
28907
+ isPage: cachedCompilation.isPage,
28908
+ isApp,
28909
+ isDev: configService.isDev,
28910
+ sourceMap,
28911
+ hmrStyleToken: styleRefreshTokens.get(filename)
28912
+ }));
28913
+ if (dirtyEntryId) dirtyVueEntryIds?.delete(dirtyEntryId);
28914
+ reportTiming(filename, cachedCompilation.isPage);
28915
+ return { returnedCode };
28916
+ }
28917
+ }
28918
+ const currentStyleIndependentSignature = configService.isDev && dirtyEntryId && canAttemptStyleOnlyReuse && filename.endsWith(".vue") ? resolveVueSfcStyleIndependentSignature(source, filename) : void 0;
28919
+ if (Boolean(configService.isDev && cachedCompilation && dirtyEntryId && canAttemptStyleOnlyReuse && filename.endsWith(".vue") && !ctx.runtimeState.scan.isDirty && cachedCompilation.autoRoutesSignature === autoRoutesSignature && cachedCompilation.styleIndependentSignature && currentStyleIndependentSignature && cachedCompilation.styleIndependentSignature === currentStyleIndependentSignature && cachedCompilation.source !== source) && cachedCompilation) {
28920
+ const cachedResult = normalizeVueTransformResult(cachedCompilation.result);
28921
+ const styleBlocks = await measureStage("loadStyleOnlySfcStyles", async () => await loadStyleBlocksForStyleOnlyRefresh({
28922
+ filename,
28923
+ source,
28924
+ styleBlocksCache,
28925
+ force: true,
28926
+ readAndParseSfc,
28927
+ createReadAndParseSfcOptions,
28928
+ pluginCtx,
28929
+ configService
28930
+ }));
28931
+ if (!refreshStyleOnlyVueTransformResult(cachedResult, filename, styleBlocks)) cachedCompilation.styleIndependentSignature = void 0;
28932
+ else {
28933
+ cachedCompilation.source = source;
28934
+ cachedCompilation.result = cachedResult;
28935
+ cachedCompilation.styleIndependentSignature = currentStyleIndependentSignature;
28936
+ cachedCompilation.refreshToken = 0;
28937
+ const hmrEventId = ctx.runtimeState.build?.hmr?.profile?.eventId;
28938
+ if (hmrEventId != null && (isCssImporterDirty || styleBlocks?.length)) styleRefreshTokens.set(filename, hmrEventId);
28939
+ const returnedCode = await measureVueHmrStage("finalizeCode", "vueFinalizeCodeMs", async () => finalizeTransformEntryCode({
28940
+ result: cachedResult,
28941
+ filename,
28942
+ styleBlocks,
28943
+ isPage: cachedCompilation.isPage,
28944
+ isApp,
28945
+ isDev: configService.isDev,
28946
+ sourceMap,
28947
+ hmrStyleToken: styleRefreshTokens.get(filename)
28948
+ }));
28949
+ if (dirtyEntryId) dirtyVueEntryIds?.delete(dirtyEntryId);
28950
+ reportTiming(filename, cachedCompilation.isPage);
28951
+ return {
28952
+ currentStyleIndependentSignature,
28953
+ returnedCode
28954
+ };
28955
+ }
28956
+ }
28957
+ return { currentStyleIndependentSignature };
28958
+ }
28959
+ //#endregion
28798
28960
  //#region src/plugins/vue/transform/plugin/transformFile.ts
28799
28961
  async function transformVueLikeFile(options) {
28800
28962
  const { ctx, pluginCtx, code, id, compilationCache, setAppShell, pageMatcher, setPageMatcher, scanDirtySynced, setScanDirtySynced, reExportResolutionCache, compileOptionsCache, componentMetaCache, styleBlocksCache, styleRefreshTokens, scopedSlotModules, emittedScopedSlotChunks, classStyleRuntimeWarned, readAndParseSfc, createReadAndParseSfcOptions } = options;
@@ -28853,159 +29015,120 @@ async function transformVueLikeFile(options) {
28853
29015
  const dirtyEntryId = resolveDirtyVueEntryId(dirtyVueEntryIds, filename);
28854
29016
  const isCssImporterDirty = isVueCssImporterDirtyReasonSummary(ctx.runtimeState?.build?.hmr?.profile?.dirtyReasonSummary);
28855
29017
  const canAttemptStyleOnlyReuse = isVueStyleOnlyDirtyReasonSummary(ctx.runtimeState?.build?.hmr?.profile?.dirtyReasonSummary);
28856
- if (configService.isDev && cachedCompilation && !ctx.runtimeState.scan.isDirty && cachedCompilation.source === transformedSource && cachedCompilation.autoRoutesSignature === autoRoutesSignature) {
28857
- cachedCompilation.refreshToken = 0;
28858
- const cachedResult = normalizeVueTransformResult(cachedCompilation.result);
28859
- let cachedStyleBlocks = cachedResult.meta?.styleBlocks ?? styleBlocksCache.get(filename);
28860
- let canReturnCachedCompilation = true;
28861
- if (dirtyEntryId && canAttemptStyleOnlyReuse && filename.endsWith(".vue")) {
28862
- const refreshedStyleBlocks = await measureStage("loadStyleOnlySfcStyles", async () => await loadStyleBlocksForStyleOnlyRefresh({
28863
- filename,
28864
- source: transformedSource,
28865
- styleBlocksCache,
28866
- force: true,
28867
- readAndParseSfc,
28868
- createReadAndParseSfcOptions,
28869
- pluginCtx,
28870
- configService
28871
- }));
28872
- if (!refreshStyleOnlyVueTransformResult(cachedResult, filename, refreshedStyleBlocks)) {
28873
- cachedCompilation.styleIndependentSignature = void 0;
28874
- canReturnCachedCompilation = false;
28875
- } else {
28876
- cachedStyleBlocks = refreshedStyleBlocks;
28877
- cachedCompilation.result = cachedResult;
28878
- const currentStyleSignature = createSfcStyleBlocksSignature(cachedStyleBlocks);
28879
- const hmrEventId = ctx.runtimeState.build?.hmr?.profile?.eventId;
28880
- if (hmrEventId != null && (isCssImporterDirty || currentStyleSignature && currentStyleSignature !== previousStyleSignature)) styleRefreshTokens.set(filename, hmrEventId);
28881
- else styleRefreshTokens.delete(filename);
28882
- }
28883
- }
28884
- if (!canReturnCachedCompilation) cachedCompilation.refreshToken = 1;
28885
- else {
28886
- const returnedCode = await measureVueHmrStage("finalizeCode", "vueFinalizeCodeMs", async () => finalizeTransformEntryCode({
28887
- result: cachedResult,
28888
- filename,
28889
- styleBlocks: cachedStyleBlocks,
28890
- isPage: cachedCompilation.isPage,
28891
- isApp,
28892
- isDev: configService.isDev,
28893
- sourceMap,
28894
- hmrStyleToken: styleRefreshTokens.get(filename)
28895
- }));
28896
- if (dirtyEntryId) dirtyVueEntryIds?.delete(dirtyEntryId);
28897
- reportTiming(filename, cachedCompilation.isPage);
28898
- return {
28899
- code: returnedCode.code,
28900
- map: returnedCode.map
28901
- };
28902
- }
28903
- }
28904
- const currentStyleIndependentSignature = configService.isDev && dirtyEntryId && canAttemptStyleOnlyReuse && filename.endsWith(".vue") ? resolveVueSfcStyleIndependentSignature(transformedSource, filename) : void 0;
28905
- if (Boolean(configService.isDev && cachedCompilation && dirtyEntryId && canAttemptStyleOnlyReuse && filename.endsWith(".vue") && !ctx.runtimeState.scan.isDirty && cachedCompilation.autoRoutesSignature === autoRoutesSignature && cachedCompilation.styleIndependentSignature && currentStyleIndependentSignature && cachedCompilation.styleIndependentSignature === currentStyleIndependentSignature && cachedCompilation.source !== transformedSource) && cachedCompilation) {
28906
- const cachedResult = normalizeVueTransformResult(cachedCompilation.result);
28907
- const styleBlocks = await measureStage("loadStyleOnlySfcStyles", async () => await loadStyleBlocksForStyleOnlyRefresh({
28908
- filename,
28909
- source: transformedSource,
28910
- styleBlocksCache,
28911
- force: true,
28912
- readAndParseSfc,
28913
- createReadAndParseSfcOptions,
28914
- pluginCtx,
28915
- configService
28916
- }));
28917
- if (!refreshStyleOnlyVueTransformResult(cachedResult, filename, styleBlocks)) cachedCompilation.styleIndependentSignature = void 0;
28918
- else {
28919
- cachedCompilation.source = transformedSource;
28920
- cachedCompilation.result = cachedResult;
28921
- cachedCompilation.styleIndependentSignature = currentStyleIndependentSignature;
28922
- cachedCompilation.refreshToken = 0;
28923
- const hmrEventId = ctx.runtimeState.build?.hmr?.profile?.eventId;
28924
- if (hmrEventId != null && (isCssImporterDirty || styleBlocks?.length)) styleRefreshTokens.set(filename, hmrEventId);
28925
- const returnedCode = await measureVueHmrStage("finalizeCode", "vueFinalizeCodeMs", async () => finalizeTransformEntryCode({
28926
- result: cachedResult,
28927
- filename,
28928
- styleBlocks,
28929
- isPage: cachedCompilation.isPage,
28930
- isApp,
28931
- isDev: configService.isDev,
28932
- sourceMap,
28933
- hmrStyleToken: styleRefreshTokens.get(filename)
28934
- }));
28935
- if (dirtyEntryId) dirtyVueEntryIds?.delete(dirtyEntryId);
28936
- reportTiming(filename, cachedCompilation.isPage);
28937
- return {
28938
- code: returnedCode.code,
28939
- map: returnedCode.map
28940
- };
28941
- }
28942
- }
29018
+ const reuseResult = await tryReuseVueCompilation({
29019
+ ctx,
29020
+ pluginCtx,
29021
+ filename,
29022
+ source: transformedSource,
29023
+ cachedCompilation,
29024
+ previousStyleSignature,
29025
+ autoRoutesSignature,
29026
+ dirtyEntryId,
29027
+ dirtyVueEntryIds,
29028
+ isCssImporterDirty,
29029
+ canAttemptStyleOnlyReuse,
29030
+ sourceMap,
29031
+ isApp,
29032
+ styleBlocksCache,
29033
+ styleRefreshTokens,
29034
+ readAndParseSfc,
29035
+ createReadAndParseSfcOptions,
29036
+ measureStage,
29037
+ measureVueHmrStage,
29038
+ reportTiming
29039
+ });
29040
+ if (reuseResult.returnedCode) return {
29041
+ code: reuseResult.returnedCode.code,
29042
+ map: reuseResult.returnedCode.map
29043
+ };
29044
+ const { currentStyleIndependentSignature } = reuseResult;
28943
29045
  const compileOptions = createCompileVueFileOptions(ctx, pluginCtx, filename, isPage, isApp, configService, {
28944
29046
  reExportResolutionCache,
28945
29047
  classStyleRuntimeWarned,
28946
29048
  compileOptionsCache,
28947
29049
  componentMetaCache
28948
29050
  });
28949
- const result = normalizeVueTransformResult(await measureVueHmrStage("compile", "vueCompileMs", async () => await compileTransformEntryResult({
28950
- transformedSource,
28951
- filename,
28952
- compileOptions,
28953
- compileVueFile,
28954
- compileJsxFile
28955
- })));
28956
- let currentStyleBlocks = Array.isArray(result.meta?.styleBlocks) ? result.meta.styleBlocks : styleBlocksCache.get(filename);
28957
- if (!currentStyleBlocks) currentStyleBlocks = await measureStage("preloadSfcStyles", async () => await loadStyleBlocksForStyleOnlyRefresh({
28958
- filename,
28959
- source: transformedSource,
28960
- styleBlocksCache,
28961
- readAndParseSfc,
28962
- createReadAndParseSfcOptions,
28963
- pluginCtx,
28964
- configService
28965
- }));
28966
- if (currentStyleBlocks) styleBlocksCache.set(filename, currentStyleBlocks);
28967
- if (configService.isDev && dirtyEntryId) {
28968
- const currentStyleSignature = createSfcStyleBlocksSignature(currentStyleBlocks);
28969
- const hmrEventId = ctx.runtimeState.build?.hmr?.profile?.eventId;
28970
- if (hmrEventId != null && (isCssImporterDirty || currentStyleSignature && currentStyleSignature !== previousStyleSignature)) styleRefreshTokens.set(filename, hmrEventId);
28971
- else styleRefreshTokens.delete(filename);
28972
- dirtyVueEntryIds?.delete(dirtyEntryId);
28973
- }
28974
- const sfcStyleDependencies = syncVueSfcStyleDependencies(ctx, filename, currentStyleBlocks);
28975
- for (const dependency of sfcStyleDependencies) addNormalizedWatchFile(pluginCtx, dependency);
28976
- registerScopedSlotHostGenerics(ctx, result.scopedSlotComponents, parseUsingComponents(result.config));
28977
- await measureVueHmrStage("finalizeCompiledResult", "vueFinalizeCompiledMs", async () => {
28978
- await finalizeTransformCompiledResult({
29051
+ const jsonOnlyResult = await measureVueHmrStage("refreshJsonConfig", "vueCompileMs", async () => {
29052
+ return await tryRefreshJsonOnlyVueCompilation({
29053
+ cachedResult: cachedCompilation?.result,
29054
+ compileOptions,
29055
+ dirtyEntryId,
29056
+ dirtyReasonSummary: ctx.runtimeState?.build?.hmr?.profile?.dirtyReasonSummary,
29057
+ filename,
29058
+ isDev: configService.isDev,
29059
+ scanDirty: ctx.runtimeState.scan.isDirty,
29060
+ source: transformedSource,
29061
+ autoRoutesSignature,
29062
+ cachedAutoRoutesSignature: cachedCompilation?.autoRoutesSignature
29063
+ });
29064
+ });
29065
+ if (jsonOnlyResult) {
29066
+ const returnedCode = await finalizeVueTransform({
28979
29067
  ctx,
28980
29068
  pluginCtx,
28981
29069
  filename,
28982
29070
  source: transformedSource,
28983
29071
  autoRoutesSignature,
28984
- result,
29072
+ result: jsonOnlyResult,
28985
29073
  compilationCache,
28986
- styleIndependentSignature: filename.endsWith(".vue") ? currentStyleIndependentSignature ?? resolveVueSfcStyleIndependentSignature(transformedSource, filename) : void 0,
28987
- setAppShell,
28988
- configService,
29074
+ currentStyleIndependentSignature: cachedCompilation?.styleIndependentSignature,
29075
+ previousStyleSignature,
29076
+ dirtyEntryId,
29077
+ dirtyVueEntryIds,
29078
+ isCssImporterDirty,
28989
29079
  isPage,
28990
29080
  isApp,
28991
29081
  sourceMap,
29082
+ styleBlocksCache,
29083
+ styleRefreshTokens,
28992
29084
  scopedSlotModules,
28993
29085
  emittedScopedSlotChunks,
28994
- addWatchFile: addNormalizedWatchFile,
28995
- emitScopedSlotChunks
29086
+ setAppShell,
29087
+ readAndParseSfc,
29088
+ createReadAndParseSfcOptions,
29089
+ measureStage,
29090
+ measureVueHmrStage,
29091
+ reportTiming
28996
29092
  });
28997
- });
28998
- const returnedCode = await measureVueHmrStage("finalizeCode", "vueFinalizeCodeMs", async () => finalizeTransformEntryCode({
28999
- result,
29093
+ return {
29094
+ code: returnedCode.code,
29095
+ map: returnedCode.map
29096
+ };
29097
+ }
29098
+ const result = normalizeVueTransformResult(await measureVueHmrStage("compile", "vueCompileMs", async () => await compileTransformEntryResult({
29099
+ transformedSource,
29000
29100
  filename,
29001
- styleBlocks: result.meta?.styleBlocks ?? styleBlocksCache.get(filename),
29101
+ compileOptions,
29102
+ compileVueFile,
29103
+ compileJsxFile
29104
+ })));
29105
+ const returnedCode = await finalizeVueTransform({
29106
+ ctx,
29107
+ pluginCtx,
29108
+ filename,
29109
+ source: transformedSource,
29110
+ autoRoutesSignature,
29111
+ result,
29112
+ compilationCache,
29113
+ currentStyleIndependentSignature,
29114
+ previousStyleSignature,
29115
+ dirtyEntryId,
29116
+ dirtyVueEntryIds,
29117
+ isCssImporterDirty,
29002
29118
  isPage,
29003
29119
  isApp,
29004
- isDev: configService.isDev,
29005
29120
  sourceMap,
29006
- hmrStyleToken: configService.isDev ? styleRefreshTokens.get(filename) : void 0
29007
- }));
29008
- reportTiming(filename, isPage);
29121
+ styleBlocksCache,
29122
+ styleRefreshTokens,
29123
+ scopedSlotModules,
29124
+ emittedScopedSlotChunks,
29125
+ setAppShell,
29126
+ readAndParseSfc,
29127
+ createReadAndParseSfcOptions,
29128
+ measureStage,
29129
+ measureVueHmrStage,
29130
+ reportTiming
29131
+ });
29009
29132
  return {
29010
29133
  code: returnedCode.code,
29011
29134
  map: returnedCode.map
@@ -30440,7 +30563,7 @@ async function loadAppEntry(ctx, scanState) {
30440
30563
  const { path: appEntryPath } = appEntry;
30441
30564
  let configFromVue;
30442
30565
  if (!appConfigFile && vueAppPath) {
30443
- const { extractConfigFromVue } = await import("./file-vNYQ5su0.mjs");
30566
+ const { extractConfigFromVue } = await import("./file-DYC-Rc4v.mjs");
30444
30567
  configFromVue = await extractConfigFromVue(vueAppPath);
30445
30568
  if (configFromVue) appConfigFile = vueAppPath;
30446
30569
  }
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-DX_9zvvA.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-CnWLlG_P.mjs");
88
88
  const compilerContext = getCompilerContext();
89
89
  const service = compilerContext.autoRoutesService;
90
90
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-BFzjMcYM.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { n as getCompilerContext } from "./createContext-D0jhm5Nj.mjs";
2
+ export { getCompilerContext };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-BL8Dhhk6.mjs";
2
2
  import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost--CaeyWpA.mjs";
3
3
  import { t as defineConfig } from "./config-DRGcCi3h.mjs";
4
- import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-DC-ADEdC.mjs";
4
+ import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-D0jhm5Nj.mjs";
5
5
  import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-CRoKWQZn.mjs";
6
6
  export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, registerLayoutHosts, resolveLayoutHost, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.18.2",
4
+ "version": "6.18.3",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -110,9 +110,9 @@
110
110
  "package-manager-detector": "^1.7.0",
111
111
  "pathe": "^2.0.3",
112
112
  "picomatch": "^4.0.5",
113
- "postcss": "^8.5.17",
113
+ "postcss": "^8.5.19",
114
114
  "rolldown": "1.1.5",
115
- "rolldown-plugin-dts": "0.27.6",
115
+ "rolldown-plugin-dts": "0.27.9",
116
116
  "semver": "^7.8.5",
117
117
  "typescript": "^6.0.3",
118
118
  "vite": "8.1.4",
@@ -124,17 +124,17 @@
124
124
  "@weapp-core/logger": "3.1.1",
125
125
  "@weapp-core/schematics": "6.0.4",
126
126
  "@weapp-core/shared": "3.0.5",
127
- "@weapp-vite/ast": "6.18.2",
127
+ "@weapp-vite/ast": "6.18.3",
128
128
  "@weapp-vite/mcp": "1.4.8",
129
129
  "@weapp-vite/miniprogram-automator": "1.2.7",
130
- "@weapp-vite/volar": "2.1.1",
131
130
  "@weapp-vite/web": "1.3.35",
132
131
  "@wevu/api": "0.2.11",
132
+ "@weapp-vite/volar": "2.1.1",
133
133
  "@wevu/web-apis": "1.2.27",
134
134
  "rolldown-require": "2.0.20",
135
135
  "vite-plugin-performance": "2.0.1",
136
136
  "weapp-ide-cli": "5.4.12",
137
- "wevu": "6.18.2"
137
+ "wevu": "6.18.3"
138
138
  },
139
139
  "publishConfig": {
140
140
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-DLA_2D0c.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { n as getCompilerContext } from "./createContext-DC-ADEdC.mjs";
2
- export { getCompilerContext };