@skaile/forge-editor 6.1.0 → 6.1.1
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 +6 -0
- package/dist/nuxt/module.d.ts +4 -3
- package/dist/nuxt/module.js +3 -0
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/prebundle.js +41 -0
- package/dist/nuxt/prebundle.js.map +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.1.1 - 2026-10-28
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- The Nuxt module pre-bundles the TipTap/ProseMirror/Yjs entries the editor imports (`vite.optimizeDeps.include`, merged with the host's list). Nuxt transpiles every registered module's package, so Vite served the editor's files unbundled; an entry it had not pre-bundled loaded ProseMirror a second time next to the pre-bundled `@tiptap/*` deps, and the editor failed in `nuxt dev` with `RangeError: Adding different instances of a keyed plugin`. Hosts can drop their own `optimizeDeps` workarounds for these entries.
|
|
8
|
+
|
|
3
9
|
## 6.1.0 - 2026-10-28
|
|
4
10
|
|
|
5
11
|
### Added
|
package/dist/nuxt/module.d.ts
CHANGED
|
@@ -3,9 +3,10 @@ import { EditorConfigInput } from "../config/index.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Module options (`tiptapEditor` in `nuxt.config`): the editor's configuration with every key optional, see `EditorConfig`,
|
|
5
5
|
* plus `server`. `server: false` is for a host without an editor server (a client-only editor, or a host that serves its own
|
|
6
|
-
* `/api/editor/*`): the module then adds only the build wiring (stylesheets, transpile,
|
|
7
|
-
* AI configuration. It mounts no routes, no websocket and no server config, and registers no
|
|
8
|
-
* plugin's backend talks to the module's routes; the host installs the editor context itself.
|
|
6
|
+
* `/api/editor/*`): the module then adds only the build wiring (stylesheets, transpile, Vite pre-bundling, Tailwind
|
|
7
|
+
* `@source`) and the public AI configuration. It mounts no routes, no websocket and no server config, and registers no
|
|
8
|
+
* client plugin, because that plugin's backend talks to the module's routes; the host installs the editor context itself.
|
|
9
|
+
* Default `true`.
|
|
9
10
|
*/
|
|
10
11
|
export type ModuleOptions = EditorConfigInput & {
|
|
11
12
|
server?: boolean;
|
package/dist/nuxt/module.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineEditorConfig, publicConfig, serverConfig } from "../config/index.js";
|
|
2
|
+
import { PREBUNDLED_DEPS } from "./prebundle.js";
|
|
2
3
|
import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from "nuxt/kit";
|
|
3
4
|
//#region src/nuxt/module.ts
|
|
4
5
|
/**
|
|
@@ -16,6 +17,8 @@ var module_default = defineNuxtModule({
|
|
|
16
17
|
const { resolve } = createResolver(import.meta.url);
|
|
17
18
|
const packageSrc = resolve("..");
|
|
18
19
|
nuxt.options.build.transpile.push(packageSrc);
|
|
20
|
+
const optimizeDeps = nuxt.options.vite.optimizeDeps ??= {};
|
|
21
|
+
optimizeDeps.include = [...optimizeDeps.include ?? [], ...PREBUNDLED_DEPS.filter((dep) => !optimizeDeps.include?.includes(dep))];
|
|
19
22
|
nuxt.options.css.push(resolve("../vue/kit/nuxt-ui.css"));
|
|
20
23
|
nuxt.options.css.push(resolve("../styles/core.css"), resolve("../styles/media.css"), resolve("../styles/mentions.css"), resolve("../styles/authors.css"), resolve("../styles/comments.css"), resolve("../styles/transcript.css"), resolve("../styles/composites.css"), resolve("../styles/ai.css"), resolve("../styles/collab.css"), resolve("../styles/block-ui.css"), resolve("../styles/themes.css"));
|
|
21
24
|
if (server) {
|
package/dist/nuxt/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":[],"sources":["../../src/nuxt/module.ts"],"sourcesContent":["import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from 'nuxt/kit'\nimport { defineEditorConfig, type EditorConfigInput, publicConfig, serverConfig } from '../config'\n\n/**\n * Module options (`tiptapEditor` in `nuxt.config`): the editor's configuration with every key optional, see `EditorConfig`,\n * plus `server`. `server: false` is for a host without an editor server (a client-only editor, or a host that serves its own\n * `/api/editor/*`): the module then adds only the build wiring (stylesheets, transpile, Tailwind `@source`) and the public
|
|
1
|
+
{"version":3,"file":"module.js","names":[],"sources":["../../src/nuxt/module.ts"],"sourcesContent":["import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from 'nuxt/kit'\nimport { defineEditorConfig, type EditorConfigInput, publicConfig, serverConfig } from '../config'\nimport { PREBUNDLED_DEPS } from './prebundle'\n\n/**\n * Module options (`tiptapEditor` in `nuxt.config`): the editor's configuration with every key optional, see `EditorConfig`,\n * plus `server`. `server: false` is for a host without an editor server (a client-only editor, or a host that serves its own\n * `/api/editor/*`): the module then adds only the build wiring (stylesheets, transpile, Vite pre-bundling, Tailwind\n * `@source`) and the public AI configuration. It mounts no routes, no websocket and no server config, and registers no\n * client plugin, because that plugin's backend talks to the module's routes; the host installs the editor context itself.\n * Default `true`.\n */\nexport type ModuleOptions = EditorConfigInput & { server?: boolean }\n\n/**\n * Nuxt/Nitro integration of the editor package: the client context plugin (settings persistence, AI configuration),\n * a server plugin that mounts the editor's routes and the collaboration websocket (`installEditorServer`) and the AI configuration with its server-only secrets. The host\n * plugs in through `provideEditorServer()` (`@skaile/forge-editor/server/nitro`) in a Nitro plugin (auth, loading and storing\n * document content). Components are imported explicitly from the package entries; nothing is auto-registered.\n */\nexport default defineNuxtModule<ModuleOptions>({\n meta: { name: 'tiptap-editor', configKey: 'tiptapEditor' },\n setup({ server = true, ...options }, nuxt) {\n const { resolve } = createResolver(import.meta.url)\n // `resolve('..')` is the package root of the built output (`dist`) or of `src` in this repository's app: both\n // hold the stylesheets and the unbundled `nuxt/runtime` files, which Nuxt compiles for the client and Nitro for the server.\n const packageSrc = resolve('..')\n nuxt.options.build.transpile.push(packageSrc)\n // Transpiled (Nuxt does that for every module's package anyway), the editor's files are not pre-bundled: pre-bundle\n // the TipTap/ProseMirror/Yjs entries they import, so they share one ProseMirror with the pre-bundled `@tiptap/*` deps.\n const optimizeDeps = nuxt.options.vite.optimizeDeps ??= {}\n optimizeDeps.include = [...(optimizeDeps.include ?? []), ...PREBUNDLED_DEPS.filter(dep => !optimizeDeps.include?.includes(dep))]\n // The Nuxt UI token map comes first: the feature sheets (and an Obsidian theme, `themes.css`, last) read and may override `--sk-*`.\n nuxt.options.css.push(resolve('../vue/kit/nuxt-ui.css'))\n nuxt.options.css.push(\n resolve('../styles/core.css'),\n resolve('../styles/media.css'),\n resolve('../styles/mentions.css'),\n resolve('../styles/authors.css'),\n resolve('../styles/comments.css'),\n resolve('../styles/transcript.css'),\n resolve('../styles/composites.css'),\n resolve('../styles/ai.css'),\n resolve('../styles/collab.css'),\n resolve('../styles/block-ui.css'),\n resolve('../styles/themes.css'),\n )\n if (server) {\n addPlugin({ src: resolve('./runtime/plugins/editor-context-nuxt-ui.client.ts'), mode: 'client' })\n addServerScanDir(resolve('./runtime/server'))\n }\n // Tailwind only scans the app layers listed in Nuxt UI's generated `ui.css` (`@source \"<layer>/app/**/*\"`), so the\n // utility classes used by the package's components would never be generated. Append its source. `@nuxt/ui` must be\n // registered before this module.\n nuxt.hook('modules:done', () => {\n const uiCss = nuxt.options.build.templates.find(t => t.filename === 'ui.css')\n if (!uiCss?.getContents) throw new Error('tiptap-editor: @nuxt/ui muss vor diesem Modul registriert sein (ui.css-Template fehlt)')\n const getContents = uiCss.getContents\n uiCss.getContents = async data => `@source \"${packageSrc}/**/*\";\\n${await getContents(data)}`\n })\n const config = defineEditorConfig(options)\n if (server) {\n nuxt.options.nitro.experimental = { ...nuxt.options.nitro.experimental, websocket: true }\n // Nitro bundles the package (the runtime files import `h3` and `nitropack/runtime`, which the host's Nitro resolves): never leave it external.\n nuxt.options.nitro.externals = { ...nuxt.options.nitro.externals, inline: [...(nuxt.options.nitro.externals?.inline ?? []), '@skaile/forge-editor', packageSrc] }\n // The server view keeps an empty `apiKey` on the shared key, every preset and the transcription, so their `NUXT_TIPTAP_EDITOR_AI_*` env variables have a key to override.\n nuxt.options.runtimeConfig.tiptapEditor = {\n ...serverConfig(config),\n ...(nuxt.options.runtimeConfig.tiptapEditor as object | undefined),\n }\n }\n // Default role presets for the client before `GET /api/ai/models` has answered; read by the client context plugin (or, with `server: false`, by the host's own).\n nuxt.options.runtimeConfig.public.tiptapEditor = {\n ...publicConfig(config),\n ...(nuxt.options.runtimeConfig.public.tiptapEditor as object | undefined),\n }\n },\n})\n"],"mappings":";;;;;;;;;;AAoBA,IAAA,iBAAe,iBAAgC;CAC7C,MAAM;EAAE,MAAM;EAAiB,WAAW;CAAe;CACzD,MAAM,EAAE,SAAS,MAAM,GAAG,WAAW,MAAM;EACzC,MAAM,EAAE,YAAY,eAAe,YAAY,GAAG;EAGlD,MAAM,aAAa,QAAQ,IAAI;EAC/B,KAAK,QAAQ,MAAM,UAAU,KAAK,UAAU;EAG5C,MAAM,eAAe,KAAK,QAAQ,KAAK,iBAAiB,CAAC;EACzD,aAAa,UAAU,CAAC,GAAI,aAAa,WAAW,CAAC,GAAI,GAAG,gBAAgB,QAAO,QAAO,CAAC,aAAa,SAAS,SAAS,GAAG,CAAC,CAAC;EAE/H,KAAK,QAAQ,IAAI,KAAK,QAAQ,wBAAwB,CAAC;EACvD,KAAK,QAAQ,IAAI,KACf,QAAQ,oBAAoB,GAC5B,QAAQ,qBAAqB,GAC7B,QAAQ,wBAAwB,GAChC,QAAQ,uBAAuB,GAC/B,QAAQ,wBAAwB,GAChC,QAAQ,0BAA0B,GAClC,QAAQ,0BAA0B,GAClC,QAAQ,kBAAkB,GAC1B,QAAQ,sBAAsB,GAC9B,QAAQ,wBAAwB,GAChC,QAAQ,sBAAsB,CAChC;EACA,IAAI,QAAQ;GACV,UAAU;IAAE,KAAK,QAAQ,oDAAoD;IAAG,MAAM;GAAS,CAAC;GAChG,iBAAiB,QAAQ,kBAAkB,CAAC;EAC9C;EAIA,KAAK,KAAK,sBAAsB;GAC9B,MAAM,QAAQ,KAAK,QAAQ,MAAM,UAAU,MAAK,MAAK,EAAE,aAAa,QAAQ;GAC5E,IAAI,CAAC,OAAO,aAAa,MAAM,IAAI,MAAM,wFAAwF;GACjI,MAAM,cAAc,MAAM;GAC1B,MAAM,cAAc,OAAM,SAAQ,YAAY,WAAW,WAAW,MAAM,YAAY,IAAI;EAC5F,CAAC;EACD,MAAM,SAAS,mBAAmB,OAAO;EACzC,IAAI,QAAQ;GACV,KAAK,QAAQ,MAAM,eAAe;IAAE,GAAG,KAAK,QAAQ,MAAM;IAAc,WAAW;GAAK;GAExF,KAAK,QAAQ,MAAM,YAAY;IAAE,GAAG,KAAK,QAAQ,MAAM;IAAW,QAAQ;KAAC,GAAI,KAAK,QAAQ,MAAM,WAAW,UAAU,CAAC;KAAI;KAAwB;IAAU;GAAE;GAEhK,KAAK,QAAQ,cAAc,eAAe;IACxC,GAAG,aAAa,MAAM;IACtB,GAAI,KAAK,QAAQ,cAAc;GACjC;EACF;EAEA,KAAK,QAAQ,cAAc,OAAO,eAAe;GAC/C,GAAG,aAAa,MAAM;GACtB,GAAI,KAAK,QAAQ,cAAc,OAAO;EACxC;CACF;AACF,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region src/nuxt/prebundle.ts
|
|
2
|
+
/**
|
|
3
|
+
* The bare TipTap/ProseMirror/Yjs imports of the Vue side of the package, which the Nuxt module adds to Vite's
|
|
4
|
+
* `optimizeDeps.include`. Nuxt transpiles every registered module's package, so Vite serves the editor's files unbundled
|
|
5
|
+
* and resolves these imports at runtime. An entry Vite has not pre-bundled is then loaded from `node_modules` next to the
|
|
6
|
+
* copy inside the pre-bundled `@tiptap/*` deps: ProseMirror (or Yjs) runs twice and the editor fails with
|
|
7
|
+
* `RangeError: Adding different instances of a keyed plugin`. Every such import must be listed; `test/nuxt-prebundle.test.ts`
|
|
8
|
+
* checks the sources against this list.
|
|
9
|
+
*/
|
|
10
|
+
const PREBUNDLED_DEPS = [
|
|
11
|
+
"@tiptap/core",
|
|
12
|
+
"@tiptap/extension-collaboration",
|
|
13
|
+
"@tiptap/extension-collaboration-caret",
|
|
14
|
+
"@tiptap/extension-drag-handle-vue-3",
|
|
15
|
+
"@tiptap/extension-file-handler",
|
|
16
|
+
"@tiptap/extension-image",
|
|
17
|
+
"@tiptap/extension-list",
|
|
18
|
+
"@tiptap/extension-mention",
|
|
19
|
+
"@tiptap/extension-node-range",
|
|
20
|
+
"@tiptap/extension-strike",
|
|
21
|
+
"@tiptap/extension-table",
|
|
22
|
+
"@tiptap/extension-unique-id",
|
|
23
|
+
"@tiptap/extensions",
|
|
24
|
+
"@tiptap/markdown",
|
|
25
|
+
"@tiptap/pm/history",
|
|
26
|
+
"@tiptap/pm/keymap",
|
|
27
|
+
"@tiptap/pm/model",
|
|
28
|
+
"@tiptap/pm/state",
|
|
29
|
+
"@tiptap/pm/transform",
|
|
30
|
+
"@tiptap/pm/view",
|
|
31
|
+
"@tiptap/starter-kit",
|
|
32
|
+
"@tiptap/suggestion",
|
|
33
|
+
"@tiptap/vue-3",
|
|
34
|
+
"@tiptap/vue-3/menus",
|
|
35
|
+
"@tiptap/y-tiptap",
|
|
36
|
+
"yjs"
|
|
37
|
+
];
|
|
38
|
+
//#endregion
|
|
39
|
+
export { PREBUNDLED_DEPS };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=prebundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prebundle.js","names":[],"sources":["../../src/nuxt/prebundle.ts"],"sourcesContent":["/**\n * The bare TipTap/ProseMirror/Yjs imports of the Vue side of the package, which the Nuxt module adds to Vite's\n * `optimizeDeps.include`. Nuxt transpiles every registered module's package, so Vite serves the editor's files unbundled\n * and resolves these imports at runtime. An entry Vite has not pre-bundled is then loaded from `node_modules` next to the\n * copy inside the pre-bundled `@tiptap/*` deps: ProseMirror (or Yjs) runs twice and the editor fails with\n * `RangeError: Adding different instances of a keyed plugin`. Every such import must be listed; `test/nuxt-prebundle.test.ts`\n * checks the sources against this list.\n */\nexport const PREBUNDLED_DEPS = [\n '@tiptap/core',\n '@tiptap/extension-collaboration',\n '@tiptap/extension-collaboration-caret',\n '@tiptap/extension-drag-handle-vue-3',\n '@tiptap/extension-file-handler',\n '@tiptap/extension-image',\n '@tiptap/extension-list',\n '@tiptap/extension-mention',\n '@tiptap/extension-node-range',\n '@tiptap/extension-strike',\n '@tiptap/extension-table',\n '@tiptap/extension-unique-id',\n '@tiptap/extensions',\n '@tiptap/markdown',\n '@tiptap/pm/history',\n '@tiptap/pm/keymap',\n '@tiptap/pm/model',\n '@tiptap/pm/state',\n '@tiptap/pm/transform',\n '@tiptap/pm/view',\n '@tiptap/starter-kit',\n '@tiptap/suggestion',\n '@tiptap/vue-3',\n '@tiptap/vue-3/menus',\n '@tiptap/y-tiptap',\n 'yjs',\n] as const\n"],"mappings":";;;;;;;;;AAQA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skaile/forge-editor",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue and React editor library on TipTap v3 (Vue: Nuxt UI; React: shadcn/ui): framework-free features with Vue and React bindings, simple and advanced presets, tree-shakeable entries. Built ESM with type declarations.",
|
|
6
6
|
"license": "MIT",
|