@stonecrop/nuxt 0.45.0 → 0.46.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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stonecrop/nuxt",
3
3
  "configKey": "stonecrop",
4
- "version": "0.45.0",
4
+ "version": "0.46.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { realpathSync, existsSync } from 'node:fs';
2
2
  import { readdir, readFile } from 'node:fs/promises';
3
- import { dirname, extname } from 'node:path';
3
+ import { createRequire } from 'node:module';
4
+ import { dirname, join, extname } from 'node:path';
4
5
  import { createResolver, defineNuxtModule, useLogger, resolvePath, addLayout, extendPages, addServerHandler, addComponent, addPlugin, addImportsDir } from '@nuxt/kit';
5
6
 
6
7
  function declaredRoutePages(doctypes, componentPath) {
@@ -109,6 +110,22 @@ const module$1 = defineNuxtModule({
109
110
  logger.log(`Vite fs.allow updated with ${allowPaths.size} symlinked package path(s)`);
110
111
  }
111
112
  }
113
+ const requireFromModule = createRequire(import.meta.url);
114
+ const monacoPackagePath = requireFromModule.resolve("monaco-editor/package.json");
115
+ const { version: monacoVersion } = requireFromModule(monacoPackagePath);
116
+ const monacoPath = `/stonecrop-monaco/${monacoVersion}`;
117
+ nuxt.options.runtimeConfig.public.stonecrop = {
118
+ ...nuxt.options.runtimeConfig.public.stonecrop ?? {},
119
+ monacoPath
120
+ };
121
+ nuxt.hook("nitro:config", (nitroConfig) => {
122
+ nitroConfig.publicAssets = nitroConfig.publicAssets ?? [];
123
+ nitroConfig.publicAssets.push({
124
+ dir: join(dirname(monacoPackagePath), "min"),
125
+ baseURL: monacoPath,
126
+ maxAge: 60 * 60 * 24 * 365
127
+ });
128
+ });
112
129
  const homepage = resolve("runtime/app/layouts/StonecropHome.vue");
113
130
  if (!nuxtWithHomeLayout.has(nuxt)) {
114
131
  addLayout(homepage, "home");
@@ -215,18 +232,6 @@ const module$1 = defineNuxtModule({
215
232
  if (ctx.file.startsWith(doctypesDir)) return [];
216
233
  }
217
234
  });
218
- const { createRequire } = await import('node:module');
219
- const { resolve: nodeResolve } = await import('node:path');
220
- const req = createRequire(import.meta.url);
221
- const monacoMinPath = nodeResolve(req.resolve("monaco-editor/package.json"), "../min");
222
- nuxt.hook("nitro:config", (nitroConfig) => {
223
- nitroConfig.publicAssets = nitroConfig.publicAssets ?? [];
224
- nitroConfig.publicAssets.push({
225
- dir: monacoMinPath,
226
- baseURL: "/stonecrop-monaco",
227
- maxAge: 60 * 60 * 24 * 365
228
- });
229
- });
230
235
  const docBuilderIndex = resolve("runtime/app/pages/DocBuilderIndex.vue");
231
236
  const docBuilderDetail = resolve("runtime/app/pages/DocBuilderDetail.vue");
232
237
  extendPages((pages) => {
@@ -59,7 +59,6 @@
59
59
  :model-value="(row.__action ?? row.__trigger)?.clientHandler ?? ''"
60
60
  :extra-libs="row.kind === 'trigger' ? TRIGGER_API_STUBS : INJECTED_API_STUBS"
61
61
  :libs="EDITOR_LIBS"
62
- :vs-path="VS_PATH"
63
62
  :options="row.kind === 'trigger' ? TRIGGER_EDITOR_OPTIONS : EDITOR_OPTIONS"
64
63
  language="javascript"
65
64
  height="200px"
@@ -126,7 +125,6 @@ declare const record: Record<string, unknown>
126
125
  declare const value: unknown
127
126
  declare function setError(field: string, message: string): void
128
127
  `;
129
- const VS_PATH = "/stonecrop-monaco/vs";
130
128
  const EDITOR_OPTIONS = {
131
129
  placeholder: "e.g. await runAction('Submit'); router.push(`/issue/${record.id}`)"
132
130
  };
@@ -25,11 +25,11 @@ import type { Doctype, Registry, RouteContext, Stonecrop } from '@stonecrop/ston
25
25
  *
26
26
  * ## RouteContext vs DoctypeContext
27
27
  *
28
- * - **RouteContext** (`{ path, segments }`): Raw URL routing context. Used by the router
29
- * layer to identify "where we are" in the application (e.g., `/plan/123` → segments `['plan', '123']`).
28
+ * - **RouteContext** (`{ path, segments }`): Raw URL routing context, "where we are" in the
29
+ * application (e.g., `/plan/123` → segments `['plan', '123']`).
30
30
  *
31
- * - **DoctypeContext** (`{ doctype, recordId? }`): Semantic doctype context. Used by the
32
- * data layer to identify "what we're working with" (e.g., `{ doctype: 'Plan', recordId: '123' }`).
31
+ * - **DoctypeContext** (`{ doctype, recordId? }`): Semantic doctype context, "what we're working
32
+ * with" (e.g., `{ doctype: 'Plan', recordId: '123' }`).
33
33
  *
34
34
  * Your `setMeta` implementation (configured via `useStonecropSetup()`) bridges these:
35
35
  * extract doctype/recordId from the route segments and pass `DoctypeContext` to your data client.
@@ -121,8 +121,8 @@ export declare function useStonecropRegistry(): {
121
121
  slug?: string;
122
122
  }, action: string, args?: unknown[]): Promise<ActionDispatchResult>;
123
123
  /**
124
- * Set the `getMeta` function on the Registry.
125
- * Called by `useStonecrop({ doctype: 'slug' })` to lazy-load that doctype's metadata.
124
+ * Set the `getMeta` function on the Registry, which loads a doctype's metadata the first
125
+ * time the doctype is asked for by slug.
126
126
  *
127
127
  * You must bridge `RouteContext` → `DoctypeContext`:
128
128
  * - Extract doctype name from `segments` (e.g., `segments[0]`)
@@ -98,8 +98,8 @@ export function useStonecropRegistry() {
98
98
  return stonecrop.dispatchAction(meta, action, args);
99
99
  },
100
100
  /**
101
- * Set the `getMeta` function on the Registry.
102
- * Called by `useStonecrop({ doctype: 'slug' })` to lazy-load that doctype's metadata.
101
+ * Set the `getMeta` function on the Registry, which loads a doctype's metadata the first
102
+ * time the doctype is asked for by slug.
103
103
  *
104
104
  * You must bridge `RouteContext` → `DoctypeContext`:
105
105
  * - Extract doctype name from `segments` (e.g., `segments[0]`)
@@ -71,8 +71,8 @@ export declare function useStonecropSetup(): {
71
71
  */
72
72
  registerClient(client: DataClient): void;
73
73
  /**
74
- * Set the `getMeta` function on the Registry.
75
- * Called by `useStonecrop({ doctype: 'slug' })` to lazy-load that doctype's metadata.
74
+ * Set the `getMeta` function on the Registry, which loads a doctype's metadata the first
75
+ * time the doctype is asked for by slug.
76
76
  *
77
77
  * You must bridge `RouteContext` → `DoctypeContext`:
78
78
  * - Extract doctype name from `segments` (e.g., `segments[0]`)
@@ -46,8 +46,8 @@ export function useStonecropSetup() {
46
46
  stonecrop.setClient(client);
47
47
  },
48
48
  /**
49
- * Set the `getMeta` function on the Registry.
50
- * Called by `useStonecrop({ doctype: 'slug' })` to lazy-load that doctype's metadata.
49
+ * Set the `getMeta` function on the Registry, which loads a doctype's metadata the first
50
+ * time the doctype is asked for by slug.
51
51
  *
52
52
  * You must bridge `RouteContext` → `DoctypeContext`:
53
53
  * - Extract doctype name from `segments` (e.g., `segments[0]`)
@@ -1,4 +1,5 @@
1
1
  import { install as AForm } from "@stonecrop/aform";
2
+ import { install as CodeEditor } from "@stonecrop/code-editor";
2
3
  import { install as NodeEditor } from "@stonecrop/node-editor";
3
4
  import StonecropPlugin from "@stonecrop/stonecrop";
4
5
  import { createPinia } from "pinia";
@@ -13,6 +14,8 @@ export default defineNuxtPlugin({
13
14
  app.use(pinia);
14
15
  }
15
16
  app.use(AForm);
17
+ const { monacoPath } = nuxt.$config.public.stonecrop;
18
+ app.use(CodeEditor, { vsPath: `${nuxt.$config.app.baseURL.replace(/\/+$/, "")}${monacoPath}/vs` });
16
19
  app.use(NodeEditor);
17
20
  app.use(StonecropPlugin, { router });
18
21
  const registry = app.config.globalProperties.$registry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stonecrop/nuxt",
3
- "version": "0.45.0",
3
+ "version": "0.46.0",
4
4
  "description": "Nuxt module for Stonecrop",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -60,18 +60,18 @@
60
60
  "pathe": "^2.0.3",
61
61
  "pinia": "^3.0.4",
62
62
  "prompts": "^2.4.2",
63
- "@stonecrop/aform": "0.45.0",
64
- "@stonecrop/atable": "0.45.0",
65
- "@stonecrop/code-editor": "0.45.0",
66
- "@stonecrop/graphql-client": "0.45.0",
67
- "@stonecrop/graphql-middleware": "0.45.0",
68
- "@stonecrop/desktop": "0.45.0",
69
- "@stonecrop/node-editor": "0.45.0",
70
- "@stonecrop/nuxt-grafserv": "0.45.0",
71
- "@stonecrop/schema": "0.45.0",
72
- "@stonecrop/stonecrop": "0.45.0",
73
- "@stonecrop/themes": "0.45.0",
74
- "@stonecrop/casl-middleware": "0.45.0"
63
+ "@stonecrop/aform": "0.46.0",
64
+ "@stonecrop/atable": "0.46.0",
65
+ "@stonecrop/code-editor": "0.46.0",
66
+ "@stonecrop/graphql-client": "0.46.0",
67
+ "@stonecrop/casl-middleware": "0.46.0",
68
+ "@stonecrop/desktop": "0.46.0",
69
+ "@stonecrop/graphql-middleware": "0.46.0",
70
+ "@stonecrop/node-editor": "0.46.0",
71
+ "@stonecrop/nuxt-grafserv": "0.46.0",
72
+ "@stonecrop/schema": "0.46.0",
73
+ "@stonecrop/stonecrop": "0.46.0",
74
+ "@stonecrop/themes": "0.46.0"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@eslint/js": "^10.0.1",