weapp-vite 5.8.0 → 5.9.1

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.
Files changed (42) hide show
  1. package/dist/auto-import-components/resolvers.cjs +5 -5
  2. package/dist/auto-import-components/resolvers.mjs +1 -1
  3. package/dist/auto-routes.cjs +8 -8
  4. package/dist/auto-routes.mjs +4 -4
  5. package/dist/{chunk-RMHCFT5Q.cjs → chunk-2B6AVWBB.cjs} +2 -2
  6. package/dist/{chunk-ED4S52HS.mjs → chunk-54OZ5FIQ.mjs} +1 -1
  7. package/dist/{chunk-QKFYCWOC.cjs → chunk-77N2IGMC.cjs} +2 -2
  8. package/dist/{chunk-3AGZHFSV.cjs → chunk-DZ52O2XJ.cjs} +6 -6
  9. package/dist/{chunk-RJVVY5EI.mjs → chunk-KODYLWCP.mjs} +1 -1
  10. package/dist/{chunk-R7M4HN7H.mjs → chunk-KTYTJDVO.mjs} +2 -2
  11. package/dist/chunk-MVIEQXCD.cjs +6 -0
  12. package/dist/{chunk-JKNSNXOE.cjs → chunk-P7EZJV5N.cjs} +2 -2
  13. package/dist/{chunk-LZJAPKF7.cjs → chunk-PVJ4XJWX.cjs} +567 -423
  14. package/dist/{chunk-DHQDH7RC.mjs → chunk-R4SL5LL2.mjs} +149 -5
  15. package/dist/{chunk-SSYIWHY2.mjs → chunk-U52F47CT.mjs} +1 -1
  16. package/dist/{chunk-TZWATIK3.mjs → chunk-YNQOGMVA.mjs} +2 -2
  17. package/dist/cli.cjs +77 -77
  18. package/dist/cli.mjs +3 -3
  19. package/dist/{config-07wfK_aU.d.cts → config-C8y2cWbg.d.cts} +6 -4
  20. package/dist/{config-DVxKePlL.d.ts → config-CRwMOjkF.d.ts} +6 -4
  21. package/dist/config.cjs +4 -4
  22. package/dist/config.d.cts +1 -1
  23. package/dist/config.d.ts +1 -1
  24. package/dist/config.mjs +3 -3
  25. package/dist/index.cjs +8 -8
  26. package/dist/index.d.cts +2 -2
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.mjs +6 -6
  29. package/dist/json.cjs +3 -3
  30. package/dist/json.d.cts +1 -1
  31. package/dist/json.d.ts +1 -1
  32. package/dist/json.mjs +2 -2
  33. package/dist/types.cjs +9 -9
  34. package/dist/types.d.cts +1 -1
  35. package/dist/types.d.ts +1 -1
  36. package/dist/types.mjs +2 -2
  37. package/dist/volar.cjs +2 -2
  38. package/dist/volar.mjs +1 -1
  39. package/modules/analyze-dashboard/assets/index.css +1 -1
  40. package/modules/analyze-dashboard/assets/vue.js +1 -12
  41. package/package.json +8 -8
  42. package/dist/chunk-O3YXI56P.cjs +0 -6
@@ -3,7 +3,7 @@ import {
3
3
  __require,
4
4
  __toESM,
5
5
  init_esm_shims
6
- } from "./chunk-TZWATIK3.mjs";
6
+ } from "./chunk-YNQOGMVA.mjs";
7
7
 
8
8
  // ../../node_modules/.pnpm/semver@7.7.3/node_modules/semver/internal/debug.js
9
9
  var require_debug = __commonJS({
@@ -2677,9 +2677,152 @@ function resolveBaseDir(configService) {
2677
2677
  }
2678
2678
  return configService.cwd;
2679
2679
  }
2680
+ function cloneAutoImportComponents(config) {
2681
+ if (config === false || !config) {
2682
+ return void 0;
2683
+ }
2684
+ const cloned = {};
2685
+ if (config.globs?.length) {
2686
+ cloned.globs = [...config.globs];
2687
+ }
2688
+ if (config.resolvers?.length) {
2689
+ cloned.resolvers = [...config.resolvers];
2690
+ }
2691
+ if (config.output !== void 0) {
2692
+ cloned.output = config.output;
2693
+ }
2694
+ if (config.typedComponents !== void 0) {
2695
+ cloned.typedComponents = config.typedComponents;
2696
+ }
2697
+ if (config.htmlCustomData !== void 0) {
2698
+ cloned.htmlCustomData = config.htmlCustomData;
2699
+ }
2700
+ return cloned;
2701
+ }
2702
+ function mergeGlobs(base, extra) {
2703
+ const values = [
2704
+ ...base ?? [],
2705
+ ...extra ?? []
2706
+ ].map((entry) => entry?.trim()).filter((entry) => Boolean(entry));
2707
+ if (!values.length) {
2708
+ return void 0;
2709
+ }
2710
+ const deduped = [];
2711
+ const seen = /* @__PURE__ */ new Set();
2712
+ for (const entry of values) {
2713
+ if (seen.has(entry)) {
2714
+ continue;
2715
+ }
2716
+ seen.add(entry);
2717
+ deduped.push(entry);
2718
+ }
2719
+ return deduped;
2720
+ }
2721
+ function mergeResolvers(base, extra) {
2722
+ const merged = [
2723
+ ...base ?? [],
2724
+ ...extra ?? []
2725
+ ].filter(Boolean);
2726
+ return merged.length ? merged : void 0;
2727
+ }
2728
+ function mergeAutoImportComponents(lower, upper, preferUpperScalars = false) {
2729
+ if (!lower && !upper) {
2730
+ return void 0;
2731
+ }
2732
+ if (!lower) {
2733
+ return cloneAutoImportComponents(upper);
2734
+ }
2735
+ if (!upper) {
2736
+ return cloneAutoImportComponents(lower);
2737
+ }
2738
+ const merged = {};
2739
+ const globs = mergeGlobs(lower.globs, upper.globs);
2740
+ if (globs) {
2741
+ merged.globs = globs;
2742
+ }
2743
+ const resolvers = mergeResolvers(lower.resolvers, upper.resolvers);
2744
+ if (resolvers) {
2745
+ merged.resolvers = resolvers;
2746
+ }
2747
+ const pickScalar = (baseline, candidate) => {
2748
+ return preferUpperScalars ? candidate ?? baseline : baseline ?? candidate;
2749
+ };
2750
+ const output = pickScalar(lower.output, upper.output);
2751
+ if (output !== void 0) {
2752
+ merged.output = output;
2753
+ }
2754
+ const typedComponents = pickScalar(lower.typedComponents, upper.typedComponents);
2755
+ if (typedComponents !== void 0) {
2756
+ merged.typedComponents = typedComponents;
2757
+ }
2758
+ const htmlCustomData = pickScalar(lower.htmlCustomData, upper.htmlCustomData);
2759
+ if (htmlCustomData !== void 0) {
2760
+ merged.htmlCustomData = htmlCustomData;
2761
+ }
2762
+ return merged;
2763
+ }
2764
+ function normalizeGlobRoot(root) {
2765
+ return root.replace(/\\/g, "/").replace(/^\/+|\/+$/g, "");
2766
+ }
2767
+ function createDefaultAutoImportComponents(configService) {
2768
+ const globs = /* @__PURE__ */ new Set();
2769
+ globs.add("components/**/*.wxml");
2770
+ const subPackages = configService.weappViteConfig?.subPackages;
2771
+ if (subPackages) {
2772
+ for (const [root, subConfig] of Object.entries(subPackages)) {
2773
+ if (!root) {
2774
+ continue;
2775
+ }
2776
+ if (subConfig?.autoImportComponents === false) {
2777
+ continue;
2778
+ }
2779
+ const normalized = normalizeGlobRoot(root);
2780
+ if (!normalized) {
2781
+ continue;
2782
+ }
2783
+ globs.add(`${normalized}/components/**/*.wxml`);
2784
+ }
2785
+ }
2786
+ return globs.size ? { globs: Array.from(globs) } : void 0;
2787
+ }
2680
2788
  function getAutoImportConfig(configService) {
2681
- const weappConfig = configService?.weappViteConfig;
2682
- return weappConfig?.autoImportComponents ?? weappConfig?.enhance?.autoImportComponents;
2789
+ if (!configService) {
2790
+ return void 0;
2791
+ }
2792
+ const weappConfig = configService.weappViteConfig;
2793
+ if (!weappConfig) {
2794
+ return void 0;
2795
+ }
2796
+ const userConfigured = weappConfig.autoImportComponents ?? weappConfig.enhance?.autoImportComponents;
2797
+ if (userConfigured === false) {
2798
+ return void 0;
2799
+ }
2800
+ const fallbackConfig = userConfigured === void 0 ? createDefaultAutoImportComponents(configService) : void 0;
2801
+ const baseConfig = cloneAutoImportComponents(userConfigured ?? fallbackConfig);
2802
+ const subPackageConfigs = weappConfig.subPackages;
2803
+ const currentRoot = configService.currentSubPackageRoot;
2804
+ if (currentRoot) {
2805
+ const scopedRaw = subPackageConfigs?.[currentRoot]?.autoImportComponents;
2806
+ if (scopedRaw === false) {
2807
+ return void 0;
2808
+ }
2809
+ const scoped = cloneAutoImportComponents(scopedRaw);
2810
+ return mergeAutoImportComponents(baseConfig, scoped, true) ?? baseConfig ?? scoped;
2811
+ }
2812
+ let merged = baseConfig;
2813
+ if (subPackageConfigs) {
2814
+ for (const root of Object.keys(subPackageConfigs)) {
2815
+ const scopedRaw = subPackageConfigs[root]?.autoImportComponents;
2816
+ if (scopedRaw === false || !scopedRaw) {
2817
+ continue;
2818
+ }
2819
+ const scoped = cloneAutoImportComponents(scopedRaw);
2820
+ if (scoped) {
2821
+ merged = mergeAutoImportComponents(merged, scoped, false);
2822
+ }
2823
+ }
2824
+ }
2825
+ return merged;
2683
2826
  }
2684
2827
  function resolveManifestOutputPath(configService, manifestFileName = DEFAULT_AUTO_IMPORT_MANIFEST_FILENAME) {
2685
2828
  if (!configService) {
@@ -21465,8 +21608,8 @@ function createAutoImportPlugin(state) {
21465
21608
  if (!state.resolvedConfig) {
21466
21609
  return;
21467
21610
  }
21468
- const weappConfig = configService.weappViteConfig;
21469
- const globs = weappConfig?.autoImportComponents?.globs ?? weappConfig?.enhance?.autoImportComponents?.globs;
21611
+ const autoImportConfig = getAutoImportConfig(configService);
21612
+ const globs = autoImportConfig?.globs;
21470
21613
  const globsKey = globs?.join("\0") ?? "";
21471
21614
  if (globsKey !== state.lastGlobsKey) {
21472
21615
  state.initialScanDone = false;
@@ -27333,6 +27476,7 @@ function createScanService(ctx) {
27333
27476
  const subPackageConfig = ctx.configService.weappViteConfig?.subPackages?.[subPackage.root];
27334
27477
  meta.subPackage.dependencies = subPackageConfig?.dependencies;
27335
27478
  meta.subPackage.inlineConfig = subPackageConfig?.inlineConfig;
27479
+ meta.autoImportComponents = subPackageConfig?.autoImportComponents;
27336
27480
  meta.styleEntries = normalizeSubPackageStyleEntries(
27337
27481
  subPackageConfig?.styles,
27338
27482
  subPackage,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  init_esm_shims
3
- } from "./chunk-TZWATIK3.mjs";
3
+ } from "./chunk-YNQOGMVA.mjs";
4
4
 
5
5
  // src/json.ts
6
6
  init_esm_shims();
@@ -33,11 +33,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  mod
34
34
  ));
35
35
 
36
- // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.15.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
36
+ // ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.15.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js
37
37
  import path from "path";
38
38
  import { fileURLToPath } from "url";
39
39
  var init_esm_shims = __esm({
40
- "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.15.0_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
40
+ "../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.15.1_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/esm_shims.js"() {
41
41
  "use strict";
42
42
  }
43
43
  });