weapp-vite 6.16.22 → 6.16.23

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, i as getCompilerContext } from "./createContext-CV93nzgI.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, i as getCompilerContext } from "./createContext-NXrQuj5y.mjs";
2
2
  //#region src/auto-routes.ts
3
3
  const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
4
4
  function createGetter(resolver) {
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, b as getProjectConfigFileName, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-CV93nzgI.mjs";
1
+ import { C as createCjsConfigLoadError, E as isPathInside, S as parseCommentJson, T as shouldPassPlatformArgToIdeOpen, _ as createBuildScopeConfigFromCli, b as getProjectConfigFileName, f as resolveWeappViteTarget, h as resolveHmrProfileJsonPath, m as SHARED_CHUNK_VIRTUAL_PREFIX, n as syncProjectSupportFiles, p as createSharedBuildConfig, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as resolveWeappConfigFile, w as getDefaultIdeProjectRoot, x as loadViteConfigFile, y as checkRuntime } from "./createContext-NXrQuj5y.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-CytHdoV-.mjs";
3
+ import { h as VERSION } from "./file-C-eN8D-v.mjs";
4
4
  import { o as resolveWeappMcpConfig, s as startWeappViteMcpServer } from "./mcp-qmDOTH07.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -3708,7 +3708,7 @@ function resolveRunnableHotkeyDefinition(input) {
3708
3708
  }
3709
3709
  //#endregion
3710
3710
  //#region package.json
3711
- var version = "6.16.22";
3711
+ var version = "6.16.23";
3712
3712
  //#endregion
3713
3713
  //#region src/cli/devHotkeys/format.ts
3714
3714
  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-CytHdoV-.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-C-eN8D-v.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";
@@ -17632,6 +17632,33 @@ function injectRequestGlobalsIntoSfc(source, targets, options) {
17632
17632
  return source;
17633
17633
  }
17634
17634
  //#endregion
17635
+ //#region src/plugins/outputFinalizer.ts
17636
+ const PREPROCESSOR_STYLE_ASSET_RE = /\.(?:less|sass|scss|styl|stylus|pcss|postcss|sss)$/i;
17637
+ function normalizePreprocessorStyleAssets(bundle, styleExtension) {
17638
+ if (!styleExtension) return;
17639
+ for (const [bundleFileName, output] of Object.entries(bundle)) {
17640
+ if (output?.type !== "asset") continue;
17641
+ const fileName = output.fileName || bundleFileName;
17642
+ if (!PREPROCESSOR_STYLE_ASSET_RE.test(fileName)) continue;
17643
+ const outputFileName = changeFileExtension(fileName, styleExtension);
17644
+ if (!outputFileName || outputFileName === fileName) continue;
17645
+ const existingOutput = bundle[outputFileName];
17646
+ delete bundle[bundleFileName];
17647
+ if (existingOutput) continue;
17648
+ output.fileName = outputFileName;
17649
+ bundle[outputFileName] = output;
17650
+ }
17651
+ }
17652
+ function createOutputFinalizerPlugin(ctx) {
17653
+ return {
17654
+ name: "weapp-vite:output-finalizer",
17655
+ enforce: "post",
17656
+ generateBundle(_options, bundle) {
17657
+ normalizePreprocessorStyleAssets(bundle, ctx.configService.outputExtensions?.wxss);
17658
+ }
17659
+ };
17660
+ }
17661
+ //#endregion
17635
17662
  //#region src/plugins/core/lifecycle/transform/importMeta.ts
17636
17663
  function hasOwn$2(source, key) {
17637
17664
  return Object.prototype.hasOwnProperty.call(source, key);
@@ -18779,6 +18806,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
18779
18806
  });
18780
18807
  rewriteJsonNpmImportsToLocalRoot(rolldownBundle, "", void 0, npmBuildCandidateDependencies, configService.cwd);
18781
18808
  }
18809
+ normalizePreprocessorStyleAssets(rolldownBundle, state.ctx.configService.outputExtensions?.wxss);
18782
18810
  return;
18783
18811
  }
18784
18812
  if (!subPackageMeta) {
@@ -18940,6 +18968,7 @@ function createGenerateBundleHook(state, isPluginBuild) {
18940
18968
  stabilizeWevuRuntimeChunkAccess(rolldownBundle);
18941
18969
  syncChunkImportsFromRequireCalls(rolldownBundle);
18942
18970
  prunePartialHmrStableSharedChunks(rolldownBundle, state);
18971
+ normalizePreprocessorStyleAssets(rolldownBundle, state.ctx.configService.outputExtensions?.wxss);
18943
18972
  refreshModuleGraph(this, state);
18944
18973
  if (configService.weappViteConfig?.debug?.watchFiles) {
18945
18974
  const watcherService = ctx.watcherService;
@@ -23019,6 +23048,7 @@ function vitePluginWeapp(ctx, subPackageMeta) {
23019
23048
  groups.push(autoImport(ctx));
23020
23049
  }
23021
23050
  groups.push(weappVite(ctx, subPackageMeta), wxs(ctx), css(ctx));
23051
+ groups.push([createOutputFinalizerPlugin(ctx)]);
23022
23052
  const assembled = attachRuntimePlugins(ctx, flatten(groups));
23023
23053
  if (subPackageMeta) return assembled;
23024
23054
  return applyInspect(ctx, assembled);
@@ -23032,6 +23062,7 @@ function vitePluginWeappWorkers(ctx) {
23032
23062
  }
23033
23063
  //#endregion
23034
23064
  //#region src/runtime/config/internal/merge/plugins.ts
23065
+ const WEAPP_VITE_OUTPUT_FINALIZER_PLUGIN_NAME = "weapp-vite:output-finalizer";
23035
23066
  function normalizePluginOptions(option) {
23036
23067
  const normalized = [];
23037
23068
  if (!option) return normalized;
@@ -23047,21 +23078,31 @@ function isNamedPlugin(option, name) {
23047
23078
  }
23048
23079
  function arrangePlugins(config, ctx, subPackageMeta) {
23049
23080
  const existing = normalizePluginOptions(config.plugins);
23081
+ const internal = normalizePluginOptions(vitePluginWeapp(ctx, subPackageMeta));
23050
23082
  const tsconfigPlugins = [];
23051
23083
  const others = [];
23084
+ const finalizers = [];
23085
+ for (const entry of internal) {
23086
+ if (!entry) continue;
23087
+ if (isNamedPlugin(entry, WEAPP_VITE_OUTPUT_FINALIZER_PLUGIN_NAME)) {
23088
+ finalizers.push(entry);
23089
+ continue;
23090
+ }
23091
+ others.push(entry);
23092
+ }
23052
23093
  for (const entry of existing) {
23053
23094
  if (!entry) continue;
23054
23095
  if (isNamedPlugin(entry, "vite-tsconfig-paths")) {
23055
23096
  tsconfigPlugins.push(entry);
23056
23097
  continue;
23057
23098
  }
23058
- if (isNamedPlugin(entry, "weapp-vite:context")) continue;
23099
+ if (isNamedPlugin(entry, "weapp-vite:context") || isNamedPlugin(entry, WEAPP_VITE_OUTPUT_FINALIZER_PLUGIN_NAME)) continue;
23059
23100
  others.push(entry);
23060
23101
  }
23061
23102
  config.plugins = [
23062
- vitePluginWeapp(ctx, subPackageMeta),
23063
23103
  ...others,
23064
- ...tsconfigPlugins
23104
+ ...tsconfigPlugins,
23105
+ ...finalizers
23065
23106
  ];
23066
23107
  }
23067
23108
  //#endregion
@@ -24148,7 +24189,7 @@ async function loadAppEntry(ctx, scanState) {
24148
24189
  const vueAppPath = await findVueEntry(appBasename);
24149
24190
  let configFromVue;
24150
24191
  if (!appConfigFile && vueAppPath) {
24151
- const { extractConfigFromVue } = await import("./file-O6w4ipMR.mjs");
24192
+ const { extractConfigFromVue } = await import("./file-S0TAbkhK.mjs");
24152
24193
  configFromVue = await extractConfigFromVue(vueAppPath);
24153
24194
  if (configFromVue) appConfigFile = vueAppPath;
24154
24195
  }
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-LxnEzp6v.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-MmgTcalc.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-C-eN8D-v.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { i as getCompilerContext } from "./createContext-NXrQuj5y.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 WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-CV93nzgI.mjs";
4
+ import { c as WEB_PLATFORM_ALIASES, d as isWebPlatform, f as resolveWeappViteTarget, l as getSupportedWeappVitePlatforms, t as createCompilerContext, u as getSupportedWeappViteTargetDescriptors } from "./createContext-NXrQuj5y.mjs";
5
5
  import { i as createWevuComponent, n as defineProps, r as setPageLayout, t as defineEmits } from "./runtime-C3z9pDQB.mjs";
6
6
  export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.16.22",
4
+ "version": "6.16.23",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -122,7 +122,7 @@
122
122
  "@weapp-core/logger": "3.1.1",
123
123
  "@weapp-core/schematics": "6.0.4",
124
124
  "@weapp-core/shared": "3.0.4",
125
- "@weapp-vite/ast": "6.16.22",
125
+ "@weapp-vite/ast": "6.16.23",
126
126
  "@weapp-vite/mcp": "1.3.6",
127
127
  "@weapp-vite/miniprogram-automator": "1.1.3",
128
128
  "@weapp-vite/volar": "2.1.0",
@@ -132,7 +132,7 @@
132
132
  "rolldown-require": "2.0.17",
133
133
  "vite-plugin-performance": "2.0.1",
134
134
  "weapp-ide-cli": "5.3.2",
135
- "wevu": "6.16.22"
135
+ "wevu": "6.16.23"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-CytHdoV-.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-CV93nzgI.mjs";
2
- export { getCompilerContext };