@holo-js/adapter-nuxt 0.3.11 → 0.3.14

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.
package/dist/module.d.mts CHANGED
@@ -98,6 +98,7 @@ interface NuxtOptionsWithNitro {
98
98
  build: {
99
99
  transpile: string[];
100
100
  };
101
+ css?: string[];
101
102
  vite?: NuxtViteOptions;
102
103
  srcDir: string;
103
104
  rootDir?: string;
@@ -106,6 +107,7 @@ interface NuxtOptionsWithNitro {
106
107
  _holoStorageRuntimeRegistered?: boolean;
107
108
  _holoBroadcastAuthRouteRegistered?: boolean;
108
109
  _holoRealtimeRouteRegistered?: boolean;
110
+ _holoClientTransformsRegistered?: boolean;
109
111
  _holoCoreRuntimeRegistered?: boolean;
110
112
  _holoTypesRegistered?: boolean;
111
113
  }
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@holo-js/adapter-nuxt",
3
3
  "configKey": "@holo-js/adapter-nuxt",
4
- "version": "0.3.11",
4
+ "version": "0.3.14",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,11 +1,11 @@
1
+ import { createRealtimeClientDefinitionTransform as createRealtimeClientDefinitionTransform$1, createRealtimeClientDefinitionModule as createRealtimeClientDefinitionModule$1, compileBrowserValidation } from '@holo-js/adapter-shared/build';
1
2
  import { lstatSync, readFileSync } from 'node:fs';
2
- import { readdir, mkdir, writeFile, access } from 'node:fs/promises';
3
+ import { readdir, readFile, mkdir, writeFile, access } from 'node:fs/promises';
3
4
  import { createRequire } from 'node:module';
4
- import { resolve, extname, relative, basename, dirname } from 'node:path';
5
+ import { resolve, extname, relative, basename, dirname, isAbsolute } from 'node:path';
5
6
  import { defineNuxtModule, createResolver, addServerPlugin, addServerImportsDir, addServerHandler, addPlugin } from '@nuxt/kit';
6
7
  import { loadConfigDirectory } from '@holo-js/config';
7
8
  import '@holo-js/db/config';
8
- import { createRealtimeClientDefinitionTransform as createRealtimeClientDefinitionTransform$1, createRealtimeClientDefinitionModule as createRealtimeClientDefinitionModule$1 } from '@holo-js/adapter-shared';
9
9
 
10
10
  function createRealtimeClientDefinitionModule(source) {
11
11
  return createRealtimeClientDefinitionModule$1(source, "@holo-js/adapter-nuxt/realtime");
@@ -119,6 +119,35 @@ function isModuleResolutionFailure(error) {
119
119
  }
120
120
  return "code" in error && (error.code === "MODULE_NOT_FOUND" || error.code === "ERR_MODULE_NOT_FOUND");
121
121
  }
122
+ function isRecord(value) {
123
+ return typeof value === "object" && value !== null && !Array.isArray(value);
124
+ }
125
+ function safeGeneratedArtifactPath(value) {
126
+ return !isAbsolute(value) && value.length > 0 && value.split(/[\\/]/u).every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
127
+ }
128
+ async function pluginGeneratedTypePaths(rootDir) {
129
+ const generatedRoot = resolve(rootDir, ".holo-js/generated");
130
+ const manifestsRoot = resolve(generatedRoot, ".plugins");
131
+ const entries = await readdir(manifestsRoot, { withFileTypes: true }).catch((error) => {
132
+ if (isRecord(error) && error.code === "ENOENT") return [];
133
+ throw error;
134
+ });
135
+ const paths = [];
136
+ for (const entry of entries) {
137
+ if (!entry.isFile() || !entry.name.endsWith(".json")) continue;
138
+ const value = JSON.parse(await readFile(resolve(manifestsRoot, entry.name), "utf8"));
139
+ if (!isRecord(value) || typeof value.pluginId !== "string" || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(value.pluginId) || !Array.isArray(value.generatedArtifacts)) {
140
+ throw new Error(`Invalid Holo plugin preparation manifest: ${entry.name}`);
141
+ }
142
+ for (const artifact of value.generatedArtifacts) {
143
+ if (!isRecord(artifact) || typeof artifact.path !== "string" || !safeGeneratedArtifactPath(artifact.path)) {
144
+ throw new Error(`Invalid Holo plugin generated artifact in manifest: ${entry.name}`);
145
+ }
146
+ if (artifact.path.endsWith(".d.ts")) paths.push(resolve(generatedRoot, value.pluginId, artifact.path));
147
+ }
148
+ }
149
+ return Object.freeze([...new Set(paths)].sort());
150
+ }
122
151
  function hasProjectPackage(rootDir, packageName, resolvePackage = createRequire(resolve(rootDir, "package.json")).resolve) {
123
152
  return typeof resolveProjectPackageEntry(rootDir, packageName, resolvePackage) === "string";
124
153
  }
@@ -250,6 +279,10 @@ function createRealtimeDefinitionVitePlugin(rootDir) {
250
279
  return createRealtimeClientDefinitionModule(readFileSync(sourcePath, "utf8"));
251
280
  },
252
281
  transform(code, id, options) {
282
+ if (!options?.ssr && !id.includes("node_modules") && /\.[cm]?[jt]sx?$/.test(id)) {
283
+ const compiled = compileBrowserValidation(code, id);
284
+ if (compiled) return { code: compiled, map: null };
285
+ }
253
286
  if (options?.ssr || !isRealtimeDefinitionModule(rootDir, id)) {
254
287
  return null;
255
288
  }
@@ -397,12 +430,19 @@ const module$1 = defineNuxtModule({
397
430
  const authTypesPath = resolve(rootDir, ".holo-js/generated/auth.d.ts");
398
431
  const authorizationTypesPath = resolve(rootDir, ".holo-js/generated/authorization/types.d.ts");
399
432
  const modelRegistryTypesPath = resolve(rootDir, ".holo-js/generated/model-registry.d.ts");
433
+ const pluginTypesPaths = await pluginGeneratedTypePaths(rootDir);
400
434
  addViteOptimizeDeps(opts, resolveClientOptimizeDeps(rootDir));
401
435
  const storageModule = await importOptionalStorageModule();
402
436
  const loaded = await loadConfigDirectory(rootDir, {
403
437
  preferCache: process.env.NODE_ENV === "production",
404
438
  processEnv: process.env
405
439
  });
440
+ if ((loaded.app.plugins ?? []).includes("@holo-js/panels")) {
441
+ opts.css = opts.css ?? [];
442
+ if (!opts.css.includes("@holo-js/panels-vue/style.css")) {
443
+ opts.css.push("@holo-js/panels-vue/style.css");
444
+ }
445
+ }
406
446
  const storageSetup = resolveStorageSetup(storageModule, loaded);
407
447
  const s3Driver = resolver.resolve("./runtime/drivers/s3.js");
408
448
  opts.nitro = opts.nitro || { storage: {} };
@@ -471,7 +511,7 @@ const module$1 = defineNuxtModule({
471
511
  });
472
512
  opts._holoBroadcastAuthRouteRegistered = true;
473
513
  }
474
- if (hasProjectPackage(rootDir, "@holo-js/realtime") && !opts._holoRealtimeRouteRegistered) {
514
+ if (!opts._holoClientTransformsRegistered) {
475
515
  const realtimeDefinitionPlugin = createRealtimeDefinitionVitePlugin(rootDir);
476
516
  opts.vite = opts.vite || {};
477
517
  addVitePlugin(opts.vite, realtimeDefinitionPlugin);
@@ -481,6 +521,9 @@ const module$1 = defineNuxtModule({
481
521
  }
482
522
  addVitePlugin(config, realtimeDefinitionPlugin);
483
523
  });
524
+ opts._holoClientTransformsRegistered = true;
525
+ }
526
+ if (hasProjectPackage(rootDir, "@holo-js/realtime") && !opts._holoRealtimeRouteRegistered) {
484
527
  addPlugin({
485
528
  src: resolver.resolve("./runtime/plugins/realtime"),
486
529
  mode: "all"
@@ -520,6 +563,7 @@ const module$1 = defineNuxtModule({
520
563
  references.push({ path: authTypesPath });
521
564
  references.push({ path: authorizationTypesPath });
522
565
  references.push({ path: modelRegistryTypesPath });
566
+ for (const path of pluginTypesPaths) references.push({ path });
523
567
  });
524
568
  }
525
569
  }
@@ -1,6 +1,6 @@
1
1
  import { onScopeDispose, reactive, shallowRef, watchEffect } from "vue";
2
2
  import { useCookie } from "#app";
3
- import { normalizeHoloHttpError } from "@holo-js/adapter-shared";
3
+ import { normalizeHoloHttpError } from "@holo-js/adapter-shared/client";
4
4
  import { DEFAULT_VALIDATION_BAG, createErrorBag } from "@holo-js/validation";
5
5
  import {
6
6
  createFormClient
@@ -1,5 +1,5 @@
1
1
  import { onScopeDispose, reactive } from "vue";
2
- import { normalizeHoloHttpError } from "@holo-js/adapter-shared";
2
+ import { normalizeHoloHttpError } from "@holo-js/adapter-shared/client";
3
3
  import {
4
4
  configureRealtimeClientRuntime,
5
5
  configureRealtimeClientTransport,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/adapter-nuxt",
3
- "version": "0.3.11",
3
+ "version": "0.3.14",
4
4
  "description": "Holo-JS Framework - Nuxt adapter",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -38,21 +38,21 @@
38
38
  "test": "vitest --run"
39
39
  },
40
40
  "dependencies": {
41
- "@holo-js/adapter-shared": "^0.3.11",
41
+ "@holo-js/adapter-shared": "^0.3.14",
42
42
  "@nuxt/kit": "^4.4.4",
43
- "@holo-js/config": "^0.3.11",
44
- "@holo-js/core": "^0.3.11",
45
- "@holo-js/db": "^0.3.11",
46
- "@holo-js/validation": "^0.3.11",
43
+ "@holo-js/config": "^0.3.14",
44
+ "@holo-js/core": "^0.3.14",
45
+ "@holo-js/db": "^0.3.14",
46
+ "@holo-js/validation": "^0.3.14",
47
47
  "h3": "^1.15.11",
48
48
  "nitropack": "^2.13.4"
49
49
  },
50
50
  "peerDependencies": {
51
- "@holo-js/broadcast": "^0.3.11",
52
- "@holo-js/forms": "^0.3.11",
53
- "@holo-js/realtime": "^0.3.11",
54
- "@holo-js/storage": "^0.3.11",
55
- "@holo-js/storage-s3": "^0.3.11"
51
+ "@holo-js/broadcast": "^0.3.14",
52
+ "@holo-js/forms": "^0.3.14",
53
+ "@holo-js/realtime": "^0.3.14",
54
+ "@holo-js/storage": "^0.3.14",
55
+ "@holo-js/storage-s3": "^0.3.14"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "@holo-js/broadcast": {
@@ -72,9 +72,9 @@
72
72
  }
73
73
  },
74
74
  "devDependencies": {
75
- "@holo-js/broadcast": "^0.3.11",
76
- "@holo-js/realtime": "^0.3.11",
77
- "@holo-js/storage-s3": "^0.3.11",
75
+ "@holo-js/broadcast": "^0.3.14",
76
+ "@holo-js/realtime": "^0.3.14",
77
+ "@holo-js/storage-s3": "^0.3.14",
78
78
  "@nuxt/module-builder": "^1.0.2",
79
79
  "@types/node": "^22.10.2",
80
80
  "nuxt": "^4.4.4",