weapp-vite 6.16.45 → 6.16.46

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-Bqsm_duR.mjs";
1
+ import { g as getRouteRuntimeGlobalKeys, n as getCompilerContext } from "./createContext-BJPEU7dU.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-Bqsm_duR.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-BJPEU7dU.mjs";
2
2
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
3
- import { h as VERSION } from "./file-CsF2X7eL.mjs";
3
+ import { h as VERSION } from "./file-_O6M6mJG.mjs";
4
4
  import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-YXCIQr-Z.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import path, { posix } from "pathe";
@@ -15,7 +15,7 @@ import os from "node:os";
15
15
  import { execFile, spawn } from "node:child_process";
16
16
  import { Buffer } from "node:buffer";
17
17
  import { cac } from "cac";
18
- import { RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, bootstrapWechatDevtoolsSettings, buildWechatIdeNpm, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectOpenedAutomator, createSharedInputSession, createWechatIdeLoginRequiredExitError, dispatchWechatCliCommand, formatAutomatorLoginError, getConfig, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, isAutomatorLoginError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, openWechatIdeProjectByHttp, parse, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, refreshWechatIdeTicket, resetWechatIdeFileUtilsByHttp, resolveProjectAutomatorPort, runRetryableCommand, runWechatIdeEngineBuild, runWithSuspendedSharedInput, setWechatIdeTicket, startForwardConsole, takeScreenshot } from "weapp-ide-cli";
18
+ import { RETRY_CANCEL_KEYS, RETRY_CONFIRM_KEYS, bootstrapWechatDevtoolsSettings, buildWechatIdeNpm, clearWechatIdeCache, clearWechatIdeCacheByAutomator, closeSharedMiniProgram, closeWechatIdeProject, compileWechatIdeByAutomator, connectOpenedAutomator, createSharedInputSession, createWechatIdeLoginRequiredExitError, dispatchWechatCliCommand, formatAutomatorLoginError, getConfig, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, isAutomatorLoginError, isWeappIdeTopLevelCommand, isWechatIdeEngineBuildEndpointMissingError, isWechatIdeLoginRequiredError, isWechatIdeLoginRequiredExitError, launchAutomator, parse, promptRetryKeypress, promptWechatIdeLoginRetry, quitWechatIde, refreshWechatIdeTicket, resetWechatIdeFileUtilsByHttp, resolveProjectAutomatorPort, runRetryableCommand, runWechatIdeEngineBuild, runWithSuspendedSharedInput, setWechatIdeTicket, startForwardConsole, takeScreenshot } from "weapp-ide-cli";
19
19
  import { promisify } from "node:util";
20
20
  import { brotliCompressSync, gzipSync } from "node:zlib";
21
21
  import { resolveCommand } from "package-manager-detector/commands";
@@ -94,11 +94,6 @@ async function tryExecuteWechatIdeCliCommandByAutomator(argv, projectPath, optio
94
94
  async function tryExecuteWechatIdeCliCommandByHttp(argv, projectPath, engineBuildFallbackToCli = false) {
95
95
  const command = argv[0];
96
96
  if (!command) return false;
97
- if (command === "compile") {
98
- if (!projectPath) return false;
99
- await openWechatIdeProjectByHttp(projectPath);
100
- return true;
101
- }
102
97
  if (command === "reset-fileutils") {
103
98
  if (!projectPath) return false;
104
99
  await resetWechatIdeFileUtilsByHttp(projectPath);
@@ -261,6 +256,7 @@ function disconnectMiniProgram(miniProgram) {
261
256
  }
262
257
  async function openWechatIdeByAutomator(projectPath) {
263
258
  disconnectMiniProgram(await launchAutomator({
259
+ preserveProjectRoot: true,
264
260
  projectPath,
265
261
  trustProject: true
266
262
  }));
@@ -388,13 +384,6 @@ async function prepareOpenedWechatIdeAutomatorSession(projectPath, options) {
388
384
  async function stabilizeOpenedWechatIdeProject(projectPath, servicePortEnabled, options = {}) {
389
385
  if (servicePortEnabled === false) return;
390
386
  try {
391
- await executeWechatIdeCliCommand(appendLoginRetryArgv(["compile"], options), {
392
- automatorMode: options.useAutomatorOpen === false ? "skip" : "prefer",
393
- httpMode: "prefer",
394
- onNonLoginError: (error) => logger_default.error(error),
395
- preserveProjectRoot: options.useAutomatorOpen === false,
396
- projectPath
397
- });
398
387
  await executeWechatIdeCliCommand(appendLoginRetryArgv([
399
388
  "reset-fileutils",
400
389
  "-p",
@@ -451,22 +440,26 @@ function createIdeOpenArgv(platform, projectPath, options = {}) {
451
440
  }
452
441
  async function openIde(platform, projectPath, options = {}) {
453
442
  let bootstrapResult;
454
- const useAutomatorOpen = options.useAutomatorOpen !== false;
443
+ const useAutomatorOpen = options.useAutomatorOpen === true;
444
+ const normalizedOptions = {
445
+ ...options,
446
+ useAutomatorOpen
447
+ };
455
448
  if (platform === "weapp" && projectPath) try {
456
449
  bootstrapResult = await bootstrapWechatDevtoolsSettings({
457
450
  projectPath,
458
- trustProject: options.trustProject
451
+ trustProject: normalizedOptions.trustProject
459
452
  });
460
453
  } catch (error) {
461
454
  logger_default.warn("检测微信开发者工具服务端口或写入项目信任状态失败,继续执行 open 流程。");
462
455
  logger_default.error(error);
463
456
  }
464
457
  if (platform === "weapp" && projectPath && bootstrapResult?.servicePortEnabled === false) logger_default.warn("检测到微信开发者工具服务端口当前处于关闭状态,已保留用户设置并回退到普通 open 流程。");
465
- if (platform === "weapp" && projectPath && options.trustProject !== false && bootstrapResult?.servicePortEnabled !== false && useAutomatorOpen) try {
466
- const openResult = await tryOpenWechatIdeByAutomator(projectPath, options);
458
+ if (platform === "weapp" && projectPath && normalizedOptions.trustProject !== false && bootstrapResult?.servicePortEnabled !== false && useAutomatorOpen) try {
459
+ const openResult = await tryOpenWechatIdeByAutomator(projectPath, normalizedOptions);
467
460
  if (openResult === "reused") return;
468
461
  if (openResult) {
469
- await stabilizeOpenedWechatIdeProject(projectPath, bootstrapResult?.servicePortEnabled, options);
462
+ await stabilizeOpenedWechatIdeProject(projectPath, bootstrapResult?.servicePortEnabled, normalizedOptions);
470
463
  return;
471
464
  }
472
465
  } catch (error) {
@@ -477,13 +470,13 @@ async function openIde(platform, projectPath, options = {}) {
477
470
  logger_default.warn("通过 automator 启动微信开发者工具并自动信任项目失败,回退到普通 open 流程。");
478
471
  if (shouldLogAutomatorFallbackError()) logger_default.error(error);
479
472
  }
480
- else if (platform === "weapp" && projectPath && options.reuseOpenedProject === false) {
473
+ else if (platform === "weapp" && projectPath && normalizedOptions.reuseOpenedProject === false) {
481
474
  if (!await closeIde()) logger_default.warn("关闭当前微信开发者工具失败,仍继续尝试打开目标项目。");
482
475
  }
483
- await runWechatIdeOpenWithRetry(createIdeOpenArgv(platform, projectPath, options));
476
+ await runWechatIdeOpenWithRetry(createIdeOpenArgv(platform, projectPath, normalizedOptions));
484
477
  if (platform === "weapp" && projectPath) {
485
- await stabilizeOpenedWechatIdeProject(projectPath, bootstrapResult?.servicePortEnabled, options);
486
- if (options.useAutomatorOpen === false && bootstrapResult?.servicePortEnabled !== false) await prepareOpenedWechatIdeAutomatorSession(projectPath, options);
478
+ await stabilizeOpenedWechatIdeProject(projectPath, bootstrapResult?.servicePortEnabled, normalizedOptions);
479
+ if (!useAutomatorOpen && bootstrapResult?.servicePortEnabled !== false) await prepareOpenedWechatIdeAutomatorSession(projectPath, normalizedOptions);
487
480
  }
488
481
  }
489
482
  /**
@@ -3899,7 +3892,7 @@ function resolveRunnableHotkeyDefinition(input) {
3899
3892
  }
3900
3893
  //#endregion
3901
3894
  //#region package.json
3902
- var version = "6.16.45";
3895
+ var version = "6.16.46";
3903
3896
  //#endregion
3904
3897
  //#region src/cli/devHotkeys/format.ts
3905
3898
  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-CsF2X7eL.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-_O6M6mJG.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";
@@ -13,7 +13,7 @@ import { createDebug } from "obug";
13
13
  import fs$1, { existsSync, readFileSync } from "node:fs";
14
14
  import { 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
- import pm from "picomatch";
16
+ import picomatch from "picomatch";
17
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, createJsonMerger, createPageEntryMatcher, createPageEntryMatcher as createPageEntryMatcher$1, getClassStyleWxsSource, getMiniProgramTemplatePlatform, getSfcCheckMtime, injectWevuPageFeaturesInJsWithResolver, invalidateFileCache, isAutoImportCandidateTag, isBuiltinComponent, pathExists, readAndParseSfc, readFile as readFile$1, resolveClassStyleWxsLocation, stripJsonMacroCallsFromCode } from "wevu/compiler";
18
18
  import process from "node:process";
19
19
  import { parse as parse$1, stringify } from "comment-json";
@@ -5366,7 +5366,7 @@ function createRegistryHelpers(state) {
5366
5366
  }
5367
5367
  const nextKey = globs.join("\0");
5368
5368
  if (!state.autoImportState.matcher || state.autoImportState.matcherKey !== nextKey) {
5369
- state.autoImportState.matcher = pm(globs, { windows: true });
5369
+ state.autoImportState.matcher = picomatch(globs, { windows: true });
5370
5370
  state.autoImportState.matcherKey = nextKey;
5371
5371
  }
5372
5372
  return state.autoImportState.matcher;
@@ -5814,7 +5814,7 @@ function createRule(pattern) {
5814
5814
  };
5815
5815
  return {
5816
5816
  pattern,
5817
- match: pm(pattern, { dot: true })
5817
+ match: picomatch(pattern, { dot: true })
5818
5818
  };
5819
5819
  }
5820
5820
  function isDefaultAutoRouteInclude(include) {
@@ -10472,7 +10472,7 @@ function resolveNodeModulesSharedPath(cleanedAbsoluteId) {
10472
10472
  }
10473
10473
  function createStringOrRegExpMatcher(pattern) {
10474
10474
  if (typeof pattern === "string") {
10475
- const matcher = pm(pattern, { dot: true });
10475
+ const matcher = picomatch(pattern, { dot: true });
10476
10476
  return (value) => matcher(value);
10477
10477
  }
10478
10478
  if (isRegexp(pattern)) return (value) => {
@@ -15249,7 +15249,7 @@ function stripQueryAndHash(value) {
15249
15249
  }
15250
15250
  function createPathMatcher(patterns, options) {
15251
15251
  if (!patterns.length) return () => false;
15252
- return pm(patterns.map((pattern) => normalizePath$1(pattern)), options);
15252
+ return picomatch(patterns.map((pattern) => normalizePath$1(pattern)), options);
15253
15253
  }
15254
15254
  function createAssetPathVariants(file, roots) {
15255
15255
  const variants = [file];
@@ -16513,7 +16513,7 @@ function resolveRouteRuleLayoutMeta(filename, configService) {
16513
16513
  const routeCandidates = normalizePageRouteCandidates(filename, configService);
16514
16514
  let matched;
16515
16515
  for (const [pattern, rule] of Object.entries(routeRules)) {
16516
- if (!routeCandidates.some((candidate) => pm(pattern)(candidate))) continue;
16516
+ if (!routeCandidates.some((candidate) => picomatch(pattern)(candidate))) continue;
16517
16517
  const normalizedMeta = normalizeRouteRuleLayoutMeta(rule?.appLayout);
16518
16518
  const patternSegments = pattern.split("/").filter(Boolean);
16519
16519
  const wildcardMatches = pattern.match(ROUTE_RULE_GLOB_TOKEN_RE) ?? [];
@@ -18521,8 +18521,8 @@ function getStyleMatcher(entry) {
18521
18521
  if (cached) return cached;
18522
18522
  const includePatterns = entry.include?.length ? entry.include : ["**/*"];
18523
18523
  const excludePatterns = entry.exclude?.length ? entry.exclude : void 0;
18524
- const matcher = { include: pm(includePatterns, { dot: true }) };
18525
- if (excludePatterns?.length) matcher.exclude = pm(excludePatterns, { dot: true });
18524
+ const matcher = { include: picomatch(includePatterns, { dot: true }) };
18525
+ if (excludePatterns?.length) matcher.exclude = picomatch(excludePatterns, { dot: true });
18526
18526
  styleMatcherCache.set(entry, matcher);
18527
18527
  return matcher;
18528
18528
  }
@@ -25473,7 +25473,7 @@ async function loadAppEntry(ctx, scanState) {
25473
25473
  const vueAppPath = await findVueEntry(appBasename);
25474
25474
  let configFromVue;
25475
25475
  if (!appConfigFile && vueAppPath) {
25476
- const { extractConfigFromVue } = await import("./file-CsjD5DM3.mjs");
25476
+ const { extractConfigFromVue } = await import("./file-BQG0E0sq.mjs");
25477
25477
  configFromVue = await extractConfigFromVue(vueAppPath);
25478
25478
  if (configFromVue) appConfigFile = vueAppPath;
25479
25479
  }
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-_O6M6mJG.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-BNM8-aPJ.mjs");
87
+ const { getCompilerContext } = await import("./getInstance-BwXyeue5.mjs");
88
88
  const compilerContext = getCompilerContext();
89
89
  const service = compilerContext.autoRoutesService;
90
90
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { n as getCompilerContext } from "./createContext-BJPEU7dU.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-Bqsm_duR.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-BJPEU7dU.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.45",
4
+ "version": "6.16.46",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -122,17 +122,17 @@
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.45",
125
+ "@weapp-vite/ast": "6.16.46",
126
126
  "@weapp-vite/mcp": "1.4.4",
127
127
  "@weapp-vite/miniprogram-automator": "1.2.3",
128
128
  "@weapp-vite/volar": "2.1.0",
129
129
  "@weapp-vite/web": "1.3.31",
130
130
  "@wevu/api": "0.2.9",
131
- "@wevu/web-apis": "1.2.21",
131
+ "@wevu/web-apis": "1.2.22",
132
132
  "rolldown-require": "2.0.19",
133
133
  "vite-plugin-performance": "2.0.1",
134
- "weapp-ide-cli": "5.4.5",
135
- "wevu": "6.16.45"
134
+ "weapp-ide-cli": "5.4.6",
135
+ "wevu": "6.16.46"
136
136
  },
137
137
  "publishConfig": {
138
138
  "access": "public",
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-CsF2X7eL.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { n as getCompilerContext } from "./createContext-Bqsm_duR.mjs";
2
- export { getCompilerContext };