@lapis-notes/api 0.2.3 → 0.2.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @lapis-notes/api
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#60](https://github.com/lapismd/lapis-notes/pull/60)
8
+ [`fb2eff2`](https://github.com/lapismd/lapis-notes/commit/fb2eff2b11b4a623ea2780f5e3e0f92a0530844b)
9
+ Thanks [@stevejuma](https://github.com/stevejuma)! - Expose the explicit
10
+ Notebook Design Core/UI host modules and admit Design Core 0.9 compatibility,
11
+ including File Explorer so the host resolves one shared Core installation.
12
+ This changes generated host admission metadata and dependency compatibility,
13
+ not the API runtime interface; retain the 0.2 API peer cohort. Full host
14
+ qualification remains required before release.
15
+
16
+ Add a public Vite renderer adapter that binds plugin compiler imports to the
17
+ admitted versioned Svelte namespace and resolves those entries through the
18
+ shared host runtime. Expose the required Markdown and CodeMirror host modules
19
+ while keeping private imports and renderer version mismatches rejected.
20
+ - Updated dependencies
21
+ [[`fb2eff2`](https://github.com/lapismd/lapis-notes/commit/fb2eff2b11b4a623ea2780f5e3e0f92a0530844b)]:
22
+ - @lapis-notes/ui@0.1.6
23
+
3
24
  ## 0.2.3
4
25
 
5
26
  ### Patch Changes
package/README.md CHANGED
@@ -65,3 +65,27 @@ Explorer uses editor associations and pattern priority to choose the
65
65
  contribution, then resolves artwork through `app.icons`. Pending, missing or
66
66
  failed artwork retains the filename icon. Changes repaint existing rows;
67
67
  rendering an icon never activates a plugin or constructs its file view.
68
+
69
+ ### Versioned renderer builds
70
+
71
+ Use the public build adapter when producing renderer plugins or embedding their
72
+ npm exports in a Vite host. Pass the exact installed Svelte version; the generated
73
+ host catalog rejects unknown modules and incompatible compiler/runtime versions.
74
+
75
+ ```ts
76
+ import { defineConfig } from "vite";
77
+ import { svelte } from "@sveltejs/vite-plugin-svelte";
78
+ import { rendererHostModulePlugin } from "@lapis-notes/api/build/vite";
79
+
80
+ export default defineConfig({
81
+ plugins: [
82
+ rendererHostModulePlugin({ mode: "host", svelteVersion: "5.56.10" }),
83
+ svelte(),
84
+ ],
85
+ });
86
+ ```
87
+
88
+ Plugin producers choose `mode: "plugin"` and let the adapter externalize Svelte
89
+ imports; do not pre-externalize them or copy private host build helpers. The
90
+ versioned providers retain the host's single Svelte runtime. Other imports still
91
+ need explicit host admission and the plugin's normal manifest audit.
@@ -0,0 +1,20 @@
1
+ export interface RendererHostModuleOptions {
2
+ /** Plugin producers externalize imports; npm hosts resolve admitted providers. */
3
+ mode: "plugin" | "host";
4
+ /** The exact installed compiler/runtime version, never a semver range. */
5
+ svelteVersion: string;
6
+ }
7
+ /** Bind compiled plugins to the host's public versioned renderer catalog. */
8
+ export declare function rendererHostModulePlugin(options: RendererHostModuleOptions): {
9
+ name: string;
10
+ enforce: "pre";
11
+ config(this: void): {
12
+ optimizeDeps: {
13
+ exclude: string[];
14
+ };
15
+ };
16
+ resolveId(this: import("rollup").PluginContext, source: string, importer?: string): Promise<{
17
+ id: string;
18
+ external?: boolean | "absolute" | "relative";
19
+ } | null>;
20
+ };
@@ -0,0 +1,49 @@
1
+ import { pluginHostModuleRegistry } from "../generated/plugin-host-modules.schema.generated.js";
2
+ /** Bind compiled plugins to the host's public versioned renderer catalog. */
3
+ export function rendererHostModulePlugin(options) {
4
+ if (!/^[0-9]+\.[0-9]+\.[0-9]+(?:[-+][\w.-]+)?$/.test(options.svelteVersion))
5
+ throw Error("Renderer binding requires an exact Svelte version");
6
+ if (options.mode !== "plugin" && options.mode !== "host")
7
+ throw Error("Renderer mode must be plugin or host");
8
+ const entries = Object.values(pluginHostModuleRegistry).filter((entry) => entry.source === "renderer-abi" &&
9
+ entry.public &&
10
+ entry.version === options.svelteVersion);
11
+ if (!entries.length)
12
+ throw Error(`The host catalog does not admit Svelte ${options.svelteVersion}`);
13
+ const providers = new Map(entries.map((entry) => [entry.specifier, entry.entry]));
14
+ const specifiers = new Map(entries.map((entry) => [entry.entry, entry.specifier]));
15
+ return {
16
+ name: "lapis-renderer-host-modules",
17
+ enforce: "pre",
18
+ config() {
19
+ return {
20
+ optimizeDeps: {
21
+ // These are host ABI identifiers, not exports of the npm Svelte package.
22
+ exclude: options.mode === "host" ? [...providers.keys()] : [],
23
+ },
24
+ };
25
+ },
26
+ async resolveId(source, importer) {
27
+ if (source.startsWith("svelte/renderer/")) {
28
+ const provider = providers.get(source);
29
+ if (!provider)
30
+ throw Error(`Unadmitted renderer module: ${source}`);
31
+ if (options.mode === "plugin")
32
+ return { id: source, external: true };
33
+ const resolved = await this.resolve(provider, importer, {
34
+ skipSelf: true,
35
+ });
36
+ if (!resolved)
37
+ throw Error(`Missing host renderer provider: ${provider}`);
38
+ return resolved;
39
+ }
40
+ if (options.mode !== "plugin" ||
41
+ !(source === "svelte" || source.startsWith("svelte/")))
42
+ return null;
43
+ const specifier = specifiers.get(source);
44
+ if (!specifier)
45
+ throw Error(`Unadmitted compiler renderer module: ${source}`);
46
+ return { id: specifier, external: true };
47
+ },
48
+ };
49
+ }
@@ -13,3 +13,4 @@ export declare function tursoBundleBuildPlugin(): {
13
13
  map: null;
14
14
  } | null;
15
15
  };
16
+ export { rendererHostModulePlugin, type RendererHostModuleOptions, } from "./renderer.js";
@@ -34,3 +34,4 @@ export function tursoBundleBuildPlugin() {
34
34
  },
35
35
  };
36
36
  }
37
+ export { rendererHostModulePlugin, } from "./renderer.js";