weapp-vite 6.25.0 → 7.0.0

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 { n as getCompilerContext, y as getRouteRuntimeGlobalKeys } from "./createContext-DVzd-0tU.mjs";
1
+ import { n as getCompilerContext, y as getRouteRuntimeGlobalKeys } from "./createContext-CwKw7Ban.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,5 +1,5 @@
1
- import { A as getDefaultIdeProjectRoot, C as collectPreloadPages, D as loadViteConfigFile, E as suggestPreloadRules, M as isPathInside, O as createCjsConfigLoadError, S as getProjectConfigFileName, T as resolvePreloadPackageIdentifier, _ as SHARED_CHUNK_VIRTUAL_PREFIX, a as createGlassEaselAnalyzeResult, b as resolveWeappConfigFile, f as getBackendForCapability, g as createSharedBuildConfig, h as syncManagedTsconfigBootstrapFiles, j as shouldPassPlatformArgToIdeOpen, k as parseCommentJson, m as syncProjectSupportFiles, o as formatBytes, p as resolveBackendExecution, t as createCompilerContext, v as resolveHmrProfileJsonPath, w as findPreloadRuleKey, x as checkRuntime } from "./createContext-DVzd-0tU.mjs";
2
- import { f as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-zQ4br3El.mjs";
1
+ import { A as getDefaultIdeProjectRoot, C as collectPreloadPages, D as loadViteConfigFile, E as suggestPreloadRules, M as isPathInside, O as createCjsConfigLoadError, S as getProjectConfigFileName, T as resolvePreloadPackageIdentifier, _ as SHARED_CHUNK_VIRTUAL_PREFIX, a as createGlassEaselAnalyzeResult, b as resolveWeappConfigFile, f as getBackendForCapability, g as createSharedBuildConfig, h as syncManagedTsconfigBootstrapFiles, j as shouldPassPlatformArgToIdeOpen, k as parseCommentJson, m as syncProjectSupportFiles, o as formatBytes, p as resolveBackendExecution, t as createCompilerContext, v as resolveHmrProfileJsonPath, w as findPreloadRuleKey, x as checkRuntime } from "./createContext-CwKw7Ban.mjs";
2
+ import { f as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-C0rR_V0f.mjs";
3
3
  import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
4
4
  import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
5
5
  import { createRequire } from "node:module";
@@ -5044,7 +5044,7 @@ function resolveRunnableHotkeyDefinition(input) {
5044
5044
  }
5045
5045
  //#endregion
5046
5046
  //#region package.json
5047
- var version = "6.25.0";
5047
+ var version = "7.0.0";
5048
5048
  //#endregion
5049
5049
  //#region src/cli/devHotkeys/format.ts
5050
5050
  const FULLWIDTH_ASCII_START = 65281;
@@ -1,5 +1,5 @@
1
1
  import { n as applyWeappViteHostMeta } from "./pluginHost--CaeyWpA.mjs";
2
- import { C as inlineAutoRoutesImports, T as MINI_PROGRAM_PLATFORM_ADAPTERS, _ as templateExtensions, a as findJsonEntry, b as isNativeTemplateSource, c as isJsOrTs, d as touch, g as supportedCssLangs, h as scriptExtensions, i as findJsEntry, l as isTemplate, m as jsExtensions, n as changeFileExtension, o as findTemplateEntry, p as configExtensions, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as vueExtensions, x as isSourceStyleExtension, y as ALL_NATIVE_STYLE_RESOLVER_EXTENSIONS } from "./file-zQ4br3El.mjs";
2
+ import { C as inlineAutoRoutesImports, T as MINI_PROGRAM_PLATFORM_ADAPTERS, _ as templateExtensions, a as findJsonEntry, b as isNativeTemplateSource, c as isJsOrTs, d as touch, g as supportedCssLangs, h as scriptExtensions, i as findJsEntry, l as isTemplate, m as jsExtensions, n as changeFileExtension, o as findTemplateEntry, p as configExtensions, r as findCssEntry, s as findVueEntry, t as extractConfigFromVue, v as vueExtensions, x as isSourceStyleExtension, y as ALL_NATIVE_STYLE_RESOLVER_EXTENSIONS } from "./file-C0rR_V0f.mjs";
3
3
  import { n as configureLogger, r as logger_default } from "./logger-mt4mSTqV.mjs";
4
4
  import { createRequire, isBuiltin } from "node:module";
5
5
  import { createDebug } from "obug";
@@ -30367,6 +30367,8 @@ function createCoreLifecyclePlugin(state) {
30367
30367
  //#region src/plugins/core/requireAnalysis.ts
30368
30368
  const REQUIRE_ANALYSIS_FILTER_RE = /\.[jt]s$/;
30369
30369
  const URL_SUFFIX_RE = /[?#].*$/;
30370
+ const REQUIRE_ASYNC_TARGET_MARKER_PREFIX = "__weapp_vite_require_async_target__";
30371
+ const REQUIRE_ASYNC_TARGET_MARKER_RE = new RegExp(`\\brequire\\.async\\(\\s*(['"])${REQUIRE_ASYNC_TARGET_MARKER_PREFIX}([\\w-]+)\\1\\s*\\)`, "g");
30370
30372
  function cleanModuleId(id) {
30371
30373
  return id.replace(URL_SUFFIX_RE, "");
30372
30374
  }
@@ -30374,6 +30376,38 @@ function createRelativeModuleSpecifier(importerFileName, targetFileName) {
30374
30376
  const relativePath = path.relative(path.dirname(importerFileName), targetFileName);
30375
30377
  return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
30376
30378
  }
30379
+ function createRequireAsyncTargetMarker(fileName) {
30380
+ return `${REQUIRE_ASYNC_TARGET_MARKER_PREFIX}${Buffer.from(fileName).toString("base64url")}`;
30381
+ }
30382
+ function decodeRequireAsyncTargetMarker(value) {
30383
+ if (!value.startsWith(REQUIRE_ASYNC_TARGET_MARKER_PREFIX)) return null;
30384
+ try {
30385
+ return Buffer.from(value.slice(35), "base64url").toString("utf8");
30386
+ } catch {
30387
+ return null;
30388
+ }
30389
+ }
30390
+ /**
30391
+ * 按最终 chunk 文件名修正异步分包加载路径。
30392
+ */
30393
+ function rewriteRequireAsyncChunkPaths(code, importerFileName) {
30394
+ const source = new MagicString(code);
30395
+ let changed = false;
30396
+ for (const match of code.matchAll(REQUIRE_ASYNC_TARGET_MARKER_RE)) {
30397
+ if (typeof match.index !== "number") continue;
30398
+ const targetFileName = decodeRequireAsyncTargetMarker(`${REQUIRE_ASYNC_TARGET_MARKER_PREFIX}${match[2]}`);
30399
+ if (!targetFileName) continue;
30400
+ const literalStart = match.index + match[0].indexOf(match[1]);
30401
+ const literalEnd = literalStart + 35 + match[2].length + 2;
30402
+ source.overwrite(literalStart, literalEnd, JSON.stringify(createRelativeModuleSpecifier(importerFileName, targetFileName)));
30403
+ changed = true;
30404
+ }
30405
+ if (!changed) return null;
30406
+ return {
30407
+ code: source.toString(),
30408
+ map: source.generateMap({ hires: "boundary" })
30409
+ };
30410
+ }
30377
30411
  function resolveModulePackageRoot(id, relativeAbsoluteSrcRoot, subPackageRoots) {
30378
30412
  return resolveSubPackagePrefix(relativeAbsoluteSrcRoot(cleanModuleId(id)), subPackageRoots);
30379
30413
  }
@@ -30422,7 +30456,6 @@ function createRequireAnalysisPlugin(state) {
30422
30456
  const dependencyRewrites = [];
30423
30457
  const nativeImportTokens = [];
30424
30458
  const resolvedDependencies = [];
30425
- const importerFileName = resolveRelativeOutputFileNameWithExtension(configService, cleanModuleId(id), ".js");
30426
30459
  const subPackageRoots = [...scanService.subPackageMap.keys()].filter(Boolean).sort((left, right) => right.length - left.length);
30427
30460
  const importerPackageRoot = resolveModulePackageRoot(id, configService.relativeAbsoluteSrcRoot, subPackageRoots);
30428
30461
  const resolveDependency = async (token) => {
@@ -30437,7 +30470,7 @@ function createRequireAnalysisPlugin(state) {
30437
30470
  fileName,
30438
30471
  id: resolvedId
30439
30472
  },
30440
- specifier: createRelativeModuleSpecifier(importerFileName, fileName)
30473
+ specifier: createRequireAsyncTargetMarker(fileName)
30441
30474
  };
30442
30475
  };
30443
30476
  for (const token of requireTokens) {
@@ -30486,6 +30519,15 @@ function createRequireAnalysisPlugin(state) {
30486
30519
  }
30487
30520
  }
30488
30521
  },
30522
+ generateBundle(_options, bundle) {
30523
+ for (const output of Object.values(bundle)) {
30524
+ if (output?.type !== "chunk") continue;
30525
+ const chunk = output;
30526
+ const rewritten = rewriteRequireAsyncChunkPaths(chunk.code, chunk.fileName);
30527
+ if (!rewritten) continue;
30528
+ applyOutputChunkTransform(chunk, rewritten.code, rewritten.map);
30529
+ }
30530
+ },
30489
30531
  async moduleParsed(moduleInfo) {
30490
30532
  const dependencies = moduleInfo.meta.requireAsyncDependencies;
30491
30533
  if (!Array.isArray(dependencies)) return;
@@ -30658,9 +30700,11 @@ function unique(values) {
30658
30700
  return [...new Set(values)];
30659
30701
  }
30660
30702
  function resolveCssEntries(ctx, options, basedir) {
30703
+ const nestedTailwindcss = options.tailwindcss?.tailwindcss;
30661
30704
  const entries = unique([
30662
30705
  ...options.cssEntries ?? [],
30663
30706
  ...options.tailwindcss?.v4?.cssEntries ?? [],
30707
+ ...nestedTailwindcss?.v4?.cssEntries ?? [],
30664
30708
  ...options.tailwindcssRuntimeOptions?.tailwindcss?.v4?.cssEntries ?? []
30665
30709
  ]).map((entry) => path.isAbsolute(entry) ? path.normalize(entry) : path.resolve(basedir, entry));
30666
30710
  return entries.length > 0 ? entries : [path.resolve(ctx.configService.absoluteSrcRoot, "app.css")];
@@ -30730,14 +30774,17 @@ function resolveManagedEntryIndex(id, code, entries) {
30730
30774
  } catch {}
30731
30775
  }
30732
30776
  function createTailwindV4SourceOptions(resolved, entry) {
30733
- const tailwindcss = resolved.options.tailwindcss;
30777
+ const configuredTailwindcss = resolved.options.tailwindcss;
30778
+ const tailwindcss = configuredTailwindcss?.tailwindcss ?? configuredTailwindcss;
30734
30779
  const v4 = tailwindcss?.v4;
30780
+ const runtimeV4 = resolved.options.tailwindcssRuntimeOptions?.tailwindcss?.v4;
30735
30781
  return {
30736
30782
  projectRoot: resolved.basedir,
30737
30783
  cwd: tailwindcss?.cwd,
30738
30784
  base: v4?.base,
30739
30785
  cssSources: v4?.cssSources,
30740
30786
  cssEntries: [entry],
30787
+ sources: v4?.sources ?? runtimeV4?.sources,
30741
30788
  packageName: tailwindcss?.packageName ?? "tailwindcss"
30742
30789
  };
30743
30790
  }
@@ -30766,6 +30813,7 @@ function createTailwindcssPlugin(ctx) {
30766
30813
  const compilerRootIds = /* @__PURE__ */ new Map();
30767
30814
  const compilerSourceOptions = /* @__PURE__ */ new Map();
30768
30815
  const compilerSnapshots = /* @__PURE__ */ new Map();
30816
+ const processedStyleOutputs = /* @__PURE__ */ new WeakSet();
30769
30817
  let generatedEntriesPromise;
30770
30818
  let coreModulePromise;
30771
30819
  let compilerPromise;
@@ -30858,6 +30906,10 @@ function createTailwindcssPlugin(ctx) {
30858
30906
  for (const output of Object.values(bundle)) {
30859
30907
  if (!transformStyles) break;
30860
30908
  if (output.type !== "asset") continue;
30909
+ if (processedStyleOutputs.has(output)) {
30910
+ generatedOutputEntries.get(output.fileName)?.forEach((index) => seenEntries.add(index));
30911
+ continue;
30912
+ }
30861
30913
  let source = outputAssetSource(output);
30862
30914
  let hasManagedEntry = false;
30863
30915
  let isMainChunk = output.fileName === `app.${styleExtension}`;
@@ -30890,6 +30942,7 @@ function createTailwindcssPlugin(ctx) {
30890
30942
  }
30891
30943
  if (!hasManagedEntry && !output.fileName.endsWith(`.${styleExtension}`)) continue;
30892
30944
  output.source = stripManagedTailwindcssOutputMarkers(await stripResidualTailwindSourceDirectives((await compiler.transformCss(source, snapshot, { isMainChunk })).css));
30945
+ processedStyleOutputs.add(output);
30893
30946
  }
30894
30947
  if (transformStyles && !ctx.configService.isDev && resolved.options.generator !== false) {
30895
30948
  const stages = resolved.cssEntries.filter((_entry, index) => resolvedEntryIndexes.has(index) || loadedEntryIndexes.has(index)).filter((entry) => !seenEntries.has(resolved.cssEntries.indexOf(entry))).map((entry) => {
@@ -30994,7 +31047,7 @@ function createTailwindcssPlugin(ctx) {
30994
31047
  async handler(_options, bundle) {
30995
31048
  resolved.options.onStart?.();
30996
31049
  try {
30997
- await transformBundle.call(this, bundle, { styles: false });
31050
+ await transformBundle.call(this, bundle);
30998
31051
  } finally {
30999
31052
  resolved.options.onEnd?.();
31000
31053
  }
@@ -35170,7 +35223,7 @@ async function loadAppEntry(ctx, scanState) {
35170
35223
  const { path: appEntryPath } = appEntry;
35171
35224
  let configFromVue;
35172
35225
  if (!appConfigFile && vueAppPath) {
35173
- const { extractConfigFromVue } = await import("./file-XlRiJP3-.mjs");
35226
+ const { extractConfigFromVue } = await import("./file-uhBc0Ffs.mjs");
35174
35227
  configFromVue = await extractConfigFromVue(vueAppPath);
35175
35228
  if (configFromVue) appConfigFile = vueAppPath;
35176
35229
  }
@@ -51,7 +51,7 @@ function resolveAutoRoutesMacroImportPath() {
51
51
  }
52
52
  async function resolveAutoRoutesInlineSnapshot() {
53
53
  try {
54
- const { getCompilerContext } = await import("./getInstance-DZ87aPw-.mjs");
54
+ const { getCompilerContext } = await import("./getInstance-CczmNJ2e.mjs");
55
55
  const compilerContext = getCompilerContext();
56
56
  const service = compilerContext.autoRoutesService;
57
57
  const reference = service?.getReference?.();
@@ -0,0 +1,2 @@
1
+ import { t as extractConfigFromVue } from "./file-C0rR_V0f.mjs";
2
+ export { extractConfigFromVue };
@@ -0,0 +1,2 @@
1
+ import { n as getCompilerContext } from "./createContext-CwKw7Ban.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 getSupportedWeappVitePlatforms, d as resolveWeappViteTarget, l as getSupportedWeappViteTargetDescriptors, s as WEB_PLATFORM_ALIASES, t as createCompilerContext, u as isWebPlatform } from "./createContext-DVzd-0tU.mjs";
4
+ import { c as getSupportedWeappVitePlatforms, d as resolveWeappViteTarget, l as getSupportedWeappViteTargetDescriptors, s as WEB_PLATFORM_ALIASES, t as createCompilerContext, u as isWebPlatform } from "./createContext-CwKw7Ban.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-D6VCNhNY.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/dist/test.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createCompilerContext } from "./createContext-DVzd-0tU.mjs";
1
+ import { t as createCompilerContext } from "./createContext-CwKw7Ban.mjs";
2
2
  import path from "node:path";
3
3
  import process from "node:process";
4
4
  import chokidar from "chokidar";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-vite",
3
3
  "type": "module",
4
- "version": "6.25.0",
4
+ "version": "7.0.0",
5
5
  "description": "weapp-vite 一个现代化的小程序打包工具",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -136,32 +136,32 @@
136
136
  "picomatch": "^4.0.7",
137
137
  "postcss": "^8.5.26",
138
138
  "rolldown": "1.2.6",
139
- "rolldown-plugin-dts": "0.28.2",
139
+ "rolldown-plugin-dts": "0.28.4",
140
140
  "semver": "^7.8.5",
141
141
  "typescript": "^6.0.3",
142
142
  "vite": "8.2.2",
143
143
  "vite-tsconfig-paths": "^6.1.1",
144
144
  "vue": "^3.5.42",
145
145
  "vue-tsc": "^3.3.11",
146
- "weapp-tailwindcss": "^5.4.1",
147
- "@weapp-core/init": "6.0.16",
146
+ "weapp-tailwindcss": "^5.4.2",
148
147
  "@weapp-core/constants": "0.2.0",
149
148
  "@weapp-core/logger": "3.1.1",
149
+ "@weapp-core/init": "6.0.16",
150
150
  "@weapp-core/shared": "3.2.0",
151
- "@weapp-vite/ast": "6.25.0",
152
- "@weapp-core/schematics": "6.2.1",
151
+ "@weapp-core/schematics": "6.2.2",
153
152
  "@weapp-vite/eslint": "0.2.2",
154
- "@weapp-vite/mcp": "1.5.0",
155
153
  "@weapp-vite/i18n": "0.2.0",
154
+ "@weapp-vite/ast": "7.0.0",
156
155
  "@weapp-vite/miniprogram-automator": "1.2.16",
157
- "@weapp-vite/web": "1.4.15",
156
+ "@weapp-vite/mcp": "1.5.1",
157
+ "@weapp-vite/volar": "2.1.6",
158
+ "@weapp-vite/web": "1.4.17",
158
159
  "@wevu/api": "0.3.0",
159
160
  "@wevu/web-apis": "1.2.38",
160
- "@weapp-vite/volar": "2.1.5",
161
- "rolldown-require": "2.0.27",
162
161
  "vite-plugin-performance": "2.0.1",
163
- "weapp-ide-cli": "6.1.0",
164
- "wevu": "6.25.0"
162
+ "rolldown-require": "2.0.27",
163
+ "wevu": "7.0.0",
164
+ "weapp-ide-cli": "6.1.1"
165
165
  },
166
166
  "optionalDependencies": {
167
167
  "@swc/core": "^1.16.1"
@@ -1,2 +0,0 @@
1
- import { t as extractConfigFromVue } from "./file-zQ4br3El.mjs";
2
- export { extractConfigFromVue };
@@ -1,2 +0,0 @@
1
- import { n as getCompilerContext } from "./createContext-DVzd-0tU.mjs";
2
- export { getCompilerContext };