@vizejs/nuxt 0.656.0 → 0.658.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.
Files changed (2) hide show
  1. package/dist/index.mjs +36 -0
  2. package/package.json +7 -7
package/dist/index.mjs CHANGED
@@ -887,6 +887,8 @@ const NUXT_VUE_TYPE_GATED_TRANSFORMS = new Set([
887
887
  "nuxt:vue-async-context",
888
888
  "nuxt:prehydrate-transform"
889
889
  ]);
890
+ /** The id Vize gives a compiled SFC module (`Foo.vue?vue&vize`). */
891
+ const VIZE_VUE_MODULE_ID_RE = /\.vue\?vue&vize(?:-ssr)?(?:&|$)/;
890
892
  /** Give Nuxt's `isVue(type)` gate a script identity while the plugin runs. */
891
893
  function toNuxtVueTransformId(id) {
892
894
  if (!isVizeGeneratedVueModuleId(id)) return id;
@@ -894,6 +896,39 @@ function toNuxtVueTransformId(id) {
894
896
  const hasVueMarker = /[?&]vue(?:[=&]|$)/.test(id);
895
897
  return id + `${hasQuery ? "&" : "?"}${hasVueMarker ? "" : "vue&"}type=script`;
896
898
  }
899
+ function isFilterPatternList(value) {
900
+ return typeof value === "string" || value instanceof RegExp || Array.isArray(value);
901
+ }
902
+ /**
903
+ * Widen an object hook's `filter.id` include so the host still calls the handler
904
+ * for Vize modules (Nuxt 4+ moved its `isVue` gates into filters). Excludes,
905
+ * code and module type filters stay as the host wrote them. Returns a new
906
+ * filter and leaves the host's objects untouched.
907
+ */
908
+ function admitVizeModulesInHookFilter(filter) {
909
+ if (!filter || typeof filter !== "object" || Array.isArray(filter)) return filter;
910
+ const id = filter.id;
911
+ if (isFilterPatternList(id)) {
912
+ const include = Array.isArray(id) ? id : [id];
913
+ if (include.length === 0) return filter;
914
+ return {
915
+ ...filter,
916
+ id: [...include, VIZE_VUE_MODULE_ID_RE]
917
+ };
918
+ }
919
+ if (!id || typeof id !== "object") return filter;
920
+ const { include } = id;
921
+ if (!isFilterPatternList(include)) return filter;
922
+ const patterns = Array.isArray(include) ? include : [include];
923
+ if (patterns.length === 0) return filter;
924
+ return {
925
+ ...filter,
926
+ id: {
927
+ ...id,
928
+ include: [...patterns, VIZE_VUE_MODULE_ID_RE]
929
+ }
930
+ };
931
+ }
897
932
  /**
898
933
  * Nuxt's core transforms classify Vue submodules by their `type=` query. Vize
899
934
  * owns a single generated JavaScript module for the complete SFC, so expose it
@@ -912,6 +947,7 @@ function patchNuxtVueTypeGatedTransform(plugin) {
912
947
  }
913
948
  const transform = plugin.transform;
914
949
  if (!transform || typeof transform.handler !== "function") return;
950
+ if (transform.filter !== void 0) transform.filter = admitVizeModulesInHookFilter(transform.filter);
915
951
  const original = transform.handler;
916
952
  transform.handler = function(code, id, ...args) {
917
953
  return original.call(this, code, toNuxtVueTransformId(id), ...args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/nuxt",
3
- "version": "0.656.0",
3
+ "version": "0.658.0",
4
4
  "description": "Nuxt module for Vize - compiler, musea gallery, linter, and type checker",
5
5
  "keywords": [
6
6
  "compiler",
@@ -49,15 +49,15 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@nuxt/kit": "3.21.8",
52
- "@vizejs/native": "0.656.0",
53
- "@vizejs/nuxt-lint-config": "0.656.0",
54
- "@vizejs/vite-plugin": "0.656.0",
55
- "@vizejs/vite-plugin-musea": "0.656.0",
56
- "vize": "0.656.0"
52
+ "@vizejs/native": "0.658.0",
53
+ "@vizejs/nuxt-lint-config": "0.658.0",
54
+ "@vizejs/vite-plugin": "0.658.0",
55
+ "@vizejs/vite-plugin-musea": "0.658.0",
56
+ "vize": "0.658.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "jiti-nuxt2": "npm:jiti@1.21.7",
60
- "oxlint-plugin-vize": "0.656.0",
60
+ "oxlint-plugin-vize": "0.658.0",
61
61
  "typescript": "6.0.3",
62
62
  "vite": "npm:@voidzero-dev/vite-plus-core@1.3.0",
63
63
  "vite-plus": "1.3.0",