weapp-vite 6.15.10 → 6.15.11

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 { i as getCompilerContext, u as getRouteRuntimeGlobalKeys } from "./createContext-BOcTbMN3.mjs";
1
+ import { i as getCompilerContext, u as getRouteRuntimeGlobalKeys } from "./createContext-BUQCMG_t.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 { S as isPathInside, _ as DEFAULT_MP_PLATFORM, b as resolveMiniPlatform, c as createSharedBuildConfig, d as resolveWeappConfigFile, f as checkRuntime, g as createCjsConfigLoadError, h as parseCommentJson, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as loadViteConfigFile, n as syncProjectSupportFiles, p as getProjectConfigFileName, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as getDefaultIdeProjectRoot, x as shouldPassPlatformArgToIdeOpen, y as normalizeMiniPlatform } from "./createContext-BOcTbMN3.mjs";
1
+ import { S as isPathInside, _ as DEFAULT_MP_PLATFORM, b as resolveMiniPlatform, c as createSharedBuildConfig, d as resolveWeappConfigFile, f as checkRuntime, g as createCjsConfigLoadError, h as parseCommentJson, l as SHARED_CHUNK_VIRTUAL_PREFIX, m as loadViteConfigFile, n as syncProjectSupportFiles, p as getProjectConfigFileName, r as syncManagedTsconfigBootstrapFiles, s as formatBytes, t as createCompilerContext, v as getDefaultIdeProjectRoot, x as shouldPassPlatformArgToIdeOpen, y as normalizeMiniPlatform } from "./createContext-BUQCMG_t.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-CgxdNjvb.mjs";
3
- import { h as VERSION } from "./file-BSDfToRq.mjs";
3
+ import { h as VERSION } from "./file-DDTK6ARt.mjs";
4
4
  import { a as resolveWeappMcpConfig, o as startWeappViteMcpServer } from "./mcp-DRlj32v4.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -2124,7 +2124,7 @@ function registerPrepareCommand(cli) {
2124
2124
  }
2125
2125
  //#endregion
2126
2126
  //#region package.json
2127
- var version = "6.15.10";
2127
+ var version = "6.15.11";
2128
2128
  //#endregion
2129
2129
  //#region src/cli/devHotkeys/format.ts
2130
2130
  const FULLWIDTH_ASCII_START = 65281;
@@ -1,6 +1,6 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost-BzPJL4F-.mjs";
2
2
  import { n as configureLogger, r as logger_default } from "./logger-CgxdNjvb.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-BSDfToRq.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-DDTK6ARt.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";
@@ -688,12 +688,17 @@ const EXPLICIT_NPM_DIR_RE = /^\/(?:miniprogram_npm|node_modules)\//;
688
688
  const LEADING_SLASHES_RE$3 = /^\/+/;
689
689
  const NODE_MODULES_SEGMENT = "/node_modules/";
690
690
  const STRIP_SCRIPT_EXTENSION_RE = /\.[cm]?[jt]sx?$/;
691
+ const INFERRED_MINIPROGRAM_ROOTS = ["miniprogram_dist", "miniprogram"];
691
692
  const miniprogramRootCache = /* @__PURE__ */ new Map();
692
693
  const packageRootCache = /* @__PURE__ */ new Map();
693
694
  const resolveFromCurrentModule = createRequire(import.meta.url);
694
695
  function stripScriptExtension(value) {
695
696
  return value.replace(STRIP_SCRIPT_EXTENSION_RE, "");
696
697
  }
698
+ function stripInferredMiniprogramRoot(subPath) {
699
+ for (const miniprogramRoot of INFERRED_MINIPROGRAM_ROOTS) if (subPath === miniprogramRoot || subPath.startsWith(`${miniprogramRoot}/`)) return subPath.slice(miniprogramRoot.length).replace(LEADING_SLASHES_RE$3, "");
700
+ return subPath;
701
+ }
697
702
  function readMiniprogramRoot(packageRoot) {
698
703
  const cached = miniprogramRootCache.get(packageRoot);
699
704
  if (cached !== void 0 || miniprogramRootCache.has(packageRoot)) return cached;
@@ -740,6 +745,7 @@ function normalizeAbsoluteNodeModulesImport(importee) {
740
745
  let subPath = packageTokens.slice(packageTokenCount).join("/");
741
746
  const miniprogramRoot = readMiniprogramRoot(packageRoot);
742
747
  if (miniprogramRoot && (subPath === miniprogramRoot || subPath.startsWith(`${miniprogramRoot}/`))) subPath = subPath.slice(miniprogramRoot.length).replace(LEADING_SLASHES_RE$3, "");
748
+ else subPath = stripInferredMiniprogramRoot(subPath);
743
749
  const normalizedSubPath = stripScriptExtension(subPath);
744
750
  return normalizedSubPath ? `${packageName}/${normalizedSubPath}` : packageName;
745
751
  }
@@ -33387,18 +33393,6 @@ function composeSourceMaps(transformedMap, originalMap) {
33387
33393
  const APP_ENTRY_RE = /[\\/]app\.(?:vue|jsx|tsx)$/;
33388
33394
  const TEMPLATE_MUSTACHE_HINT = "{{";
33389
33395
  const TEMPLATE_EVENT_HINT_RE = /\b(?:bind|catch)[A-Za-z:_-]+=/;
33390
- const PAGE_FEATURE_HOOK_HINTS = [
33391
- "onPageScroll",
33392
- "onPullDownRefresh",
33393
- "onReachBottom",
33394
- "onRouteDone",
33395
- "onTabItemTap",
33396
- "onResize",
33397
- "onShareAppMessage",
33398
- "onShareTimeline",
33399
- "onAddToFavorites",
33400
- "onSaveExitState"
33401
- ];
33402
33396
  const PAGE_SCROLL_HOOK_HINT = "onPageScroll";
33403
33397
  function resolveScriptlessVueEntryStub(isPage) {
33404
33398
  return isPage ? "Page({})" : "Component({})";
@@ -33415,9 +33409,6 @@ function mayNeedTransformSetDataPick(template, options) {
33415
33409
  if (new RegExp(`${escapeStringRegexp(directivePrefix)}:`).test(template)) return true;
33416
33410
  return TEMPLATE_EVENT_HINT_RE.test(template);
33417
33411
  }
33418
- function mayNeedTransformPageFeatureInjection(script) {
33419
- return PAGE_FEATURE_HOOK_HINTS.some((hint) => script.includes(hint));
33420
- }
33421
33412
  function mayNeedTransformPageScrollDiagnostics(script) {
33422
33413
  return script.includes(PAGE_SCROLL_HOOK_HINT);
33423
33414
  }
@@ -33583,12 +33574,10 @@ async function finalizeTransformEntryScript(options) {
33583
33574
  const { result, filename, pluginCtx, configService, isPage, isApp } = options;
33584
33575
  if (isPage && result.script) {
33585
33576
  if (mayNeedTransformPageScrollDiagnostics(result.script)) for (const warning of collectOnPageScrollPerformanceWarnings(result.script, filename, { engine: resolveAstEngine(configService.weappViteConfig) })) logger_default.warn(warning);
33586
- if (mayNeedTransformPageFeatureInjection(result.script)) {
33587
- const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, result.script, filename, { checkMtime: configService.isDev });
33588
- if (injected.transformed) {
33589
- result.script = injected.code;
33590
- result.scriptMap = composeSourceMaps(injected.map, result.scriptMap);
33591
- }
33577
+ const injected = await injectWevuPageFeaturesInJsWithViteResolver(pluginCtx, result.script, filename, { checkMtime: configService.isDev });
33578
+ if (injected.transformed) {
33579
+ result.script = injected.code;
33580
+ result.scriptMap = composeSourceMaps(injected.map, result.scriptMap);
33592
33581
  }
33593
33582
  }
33594
33583
  if (!isApp && result.script && result.template && isAutoSetDataPickEnabled(configService.weappViteConfig) && mayNeedTransformSetDataPick(result.template, { platform: configService.platform })) {
@@ -35172,7 +35161,7 @@ async function loadAppEntry(ctx, scanState) {
35172
35161
  const vueAppPath = await findVueEntry(appBasename);
35173
35162
  let configFromVue;
35174
35163
  if (!appConfigFile && vueAppPath) {
35175
- const { extractConfigFromVue } = await import("./file-cvdXNNJc.mjs");
35164
+ const { extractConfigFromVue } = await import("./file-Cf2kMTOQ.mjs");
35176
35165
  configFromVue = await extractConfigFromVue(vueAppPath);
35177
35166
  if (configFromVue) appConfigFile = vueAppPath;
35178
35167
  }
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-DDTK6ARt.mjs";
2
+ export { extractConfigFromVue };
@@ -84,7 +84,7 @@ function resolveAutoRoutesMacroImportPath() {
84
84
  }
85
85
  async function resolveAutoRoutesInlineSnapshot() {
86
86
  try {
87
- const { getCompilerContext } = await import("./getInstance-Bl0vmTQo.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-Rhivhw3y.mjs");
88
88
  const compilerContext = getCompilerContext();
89
89
  const service = compilerContext.autoRoutesService;
90
90
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { i as getCompilerContext } from "./createContext-BUQCMG_t.mjs";
2
+ export { getCompilerContext };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCompilerContext } from "./createContext-BOcTbMN3.mjs";
1
+ import { t as createCompilerContext } from "./createContext-BUQCMG_t.mjs";
2
2
  import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-wnfVS9jE.mjs";
3
3
  import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost-BzPJL4F-.mjs";
4
4
  import { t as defineConfig } from "./config-B2xtjEug.mjs";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.15.10",
4
+ "version": "6.15.11",
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.15.10",
125
+ "@weapp-vite/ast": "6.15.11",
126
126
  "@weapp-vite/mcp": "1.2.1",
127
127
  "@weapp-vite/miniprogram-automator": "1.0.3",
128
128
  "@weapp-vite/volar": "2.1.0",
@@ -132,7 +132,7 @@
132
132
  "rolldown-require": "2.0.14",
133
133
  "vite-plugin-performance": "2.0.1",
134
134
  "weapp-ide-cli": "5.2.4",
135
- "wevu": "6.15.10"
135
+ "wevu": "6.15.11"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-BSDfToRq.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { i as getCompilerContext } from "./createContext-BOcTbMN3.mjs";
2
- export { getCompilerContext };