@devframes/nuxt 0.0.0 → 0.1.20

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@devframes/nuxt",
3
3
  "type": "module",
4
- "version": "0.0.0",
4
+ "version": "0.1.20",
5
5
  "description": "Nuxt module for DevFrame — wires a Nuxt-built SPA up as a devframe client",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "peerDependencies": {
31
31
  "@nuxt/kit": "^3.0.0 || ^4.0.0",
32
- "devframe": "0.1.19"
32
+ "devframe": "0.1.20"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@nuxt/kit": "^4.4.4",
package/dist/index.d.mts DELETED
@@ -1,46 +0,0 @@
1
- import * as _$_nuxt_schema0 from "@nuxt/schema";
2
-
3
- //#region src/index.d.ts
4
- interface DevframeNuxtModuleOptions {
5
- /**
6
- * Base URL, relative to the deployed page, where the devframe
7
- * connection meta (`.connection.json`) and dump shards live.
8
- * Defaults to `'./'` — the SPA root — so a single build works at any
9
- * deployment base (the browser resolves relative fetches against
10
- * `document.baseURI`).
11
- */
12
- baseURL?: string;
13
- /**
14
- * Disable the opinionated Nuxt app defaults (`app.baseURL: './'`,
15
- * `vite.base: './'`). Set to `true` if you need to own these yourself.
16
- * Defaults to `false` — devframe sets sensible base-agnostic defaults.
17
- */
18
- skipAppDefaults?: boolean;
19
- }
20
- /**
21
- * Nuxt module that wires a Nuxt-built SPA up as a devframe client:
22
- *
23
- * - Sets `app.baseURL: './'` + `vite.base: './'` so the production
24
- * build is base-agnostic (works at any deployment path without
25
- * build-time rewriting).
26
- * - Injects a client plugin that calls {@link connectDevtool} once on
27
- * page load and exposes the RPC client via `useNuxtApp().$rpc`.
28
- *
29
- * ```ts [nuxt.config.ts]
30
- * export default defineNuxtConfig({
31
- * modules: ['@devframes/nuxt'],
32
- * })
33
- * ```
34
- *
35
- * At the call site:
36
- *
37
- * ```ts [composables/payload.ts]
38
- * export async function fetchPayload() {
39
- * const { $rpc } = useNuxtApp()
40
- * return $rpc.call('my-tool:get-payload')
41
- * }
42
- * ```
43
- */
44
- declare const _default: _$_nuxt_schema0.NuxtModule<DevframeNuxtModuleOptions, DevframeNuxtModuleOptions, false>;
45
- //#endregion
46
- export { DevframeNuxtModuleOptions, _default as default };
package/dist/index.mjs DELETED
@@ -1,58 +0,0 @@
1
- import { addPlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
2
- //#region src/index.ts
3
- /**
4
- * Nuxt module that wires a Nuxt-built SPA up as a devframe client:
5
- *
6
- * - Sets `app.baseURL: './'` + `vite.base: './'` so the production
7
- * build is base-agnostic (works at any deployment path without
8
- * build-time rewriting).
9
- * - Injects a client plugin that calls {@link connectDevtool} once on
10
- * page load and exposes the RPC client via `useNuxtApp().$rpc`.
11
- *
12
- * ```ts [nuxt.config.ts]
13
- * export default defineNuxtConfig({
14
- * modules: ['@devframes/nuxt'],
15
- * })
16
- * ```
17
- *
18
- * At the call site:
19
- *
20
- * ```ts [composables/payload.ts]
21
- * export async function fetchPayload() {
22
- * const { $rpc } = useNuxtApp()
23
- * return $rpc.call('my-tool:get-payload')
24
- * }
25
- * ```
26
- */
27
- var src_default = defineNuxtModule({
28
- meta: {
29
- name: "devframe",
30
- configKey: "devframe"
31
- },
32
- defaults: {
33
- baseURL: "./",
34
- skipAppDefaults: false
35
- },
36
- setup(options, nuxt) {
37
- const { resolve } = createResolver(import.meta.url);
38
- if (!options.skipAppDefaults) {
39
- nuxt.options.app ??= {};
40
- nuxt.options.app.baseURL ??= "./";
41
- nuxt.options.vite ??= {};
42
- nuxt.options.vite.base ??= "./";
43
- }
44
- nuxt.options.runtimeConfig ??= {};
45
- nuxt.options.runtimeConfig.public ??= {};
46
- const publicConfig = nuxt.options.runtimeConfig.public;
47
- publicConfig.devframe = {
48
- ...publicConfig.devframe ?? {},
49
- baseURL: options.baseURL
50
- };
51
- addPlugin({
52
- src: resolve("./runtime/plugin.client"),
53
- mode: "client"
54
- });
55
- }
56
- });
57
- //#endregion
58
- export { src_default as default };
@@ -1,8 +0,0 @@
1
- //#region src/runtime/plugin.client.d.ts
2
- /**
3
- * Nuxt client plugin that calls `connectDevtool()` once on the client
4
- * and provides the RPC client as `$rpc` / `useNuxtApp().$rpc`.
5
- */
6
- declare const _default: any;
7
- //#endregion
8
- export { _default as default };
@@ -1,12 +0,0 @@
1
- import { defineNuxtPlugin, useRuntimeConfig } from "#app";
2
- import { connectDevtool } from "devframe/client";
3
- //#region src/runtime/plugin.client.ts
4
- /**
5
- * Nuxt client plugin that calls `connectDevtool()` once on the client
6
- * and provides the RPC client as `$rpc` / `useNuxtApp().$rpc`.
7
- */
8
- var plugin_client_default = defineNuxtPlugin(async () => {
9
- return { provide: { rpc: await connectDevtool({ baseURL: useRuntimeConfig().public?.devframe?.baseURL ?? "./" }) } };
10
- });
11
- //#endregion
12
- export { plugin_client_default as default };