@kungal/editor-nuxt 0.12.0 → 0.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @kungal/editor-nuxt
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8ce8210: The Nuxt layer now preconfigures Vite's dev dependency optimizer, so consumers
8
+ never hit the micromark/`debug` dev error.
9
+
10
+ Under `nuxt dev`, Milkdown's tokenizer (micromark) resolves to its DEV build,
11
+ which does `import debug from 'debug'`. `debug` is CommonJS; unless Vite
12
+ pre-bundles it, its browser build is served raw with no `default` export and the
13
+ editor throws at load — `SyntaxError: 'debug' does not provide an export named
14
+ 'default'` (create-tokenizer.js), which also aborts app init. Whether it fires is
15
+ non-deterministic per app (it depends on whether Vite's dep scan reaches the
16
+ editor before it evaluates).
17
+
18
+ The layer now sets `vite.optimizeDeps.include` for the editor + Milkdown entry
19
+ points, which Nuxt merges into every consuming app — so esbuild pre-bundles that
20
+ subgraph and resolves micromark's CJS `debug` inside the bundle. No app needs to
21
+ configure this itself. Dev-only: the production build strips micromark's debug
22
+ calls, so `nuxt build` is unaffected. (Plain non-Nuxt Vite apps that use
23
+ `@kungal/editor-vue` directly still add the same `optimizeDeps.include` manually —
24
+ a layer can inject Vite config, a plain package cannot.)
25
+
26
+ ### Patch Changes
27
+
28
+ - @kungal/editor-core@0.13.0
29
+ - @kungal/editor-vue@0.13.0
30
+
3
31
  ## 0.12.0
4
32
 
5
33
  ### Minor Changes
package/nuxt.config.ts CHANGED
@@ -26,7 +26,36 @@ export default defineNuxtConfig({
26
26
  })
27
27
  }
28
28
  })
29
- ]
29
+ ],
30
+
31
+ // Under `nuxt dev`, Milkdown's markdown tokenizer (micromark) resolves to its
32
+ // DEV build, which does `import debug from 'debug'`. `debug` is CommonJS, so
33
+ // unless Vite pre-bundles it, its browser.js is served raw with no `default`
34
+ // export and the editor throws at load:
35
+ // SyntaxError: … 'debug' does not provide an export named 'default'
36
+ // (create-tokenizer.js)
37
+ // which also aborts app init. Whether it fires is non-deterministic per app —
38
+ // it depends on whether Vite's dep scan reaches the editor before it evaluates
39
+ // (the docs happens to get auto-scanned; other consumers don't). So pin it
40
+ // HERE, in the layer: force-including the editor/milkdown ENTRY points makes
41
+ // esbuild pre-bundle their whole subgraph and resolve micromark's CJS `debug`
42
+ // INSIDE the bundle. Merged into every consumer that extends this layer, so no
43
+ // app configures it. Dev-only: the prod build strips micromark's debug calls.
44
+ //
45
+ // NB: include the resolvable ENTRY points, not `'debug'` — under pnpm's
46
+ // non-hoisted layout `debug` isn't resolvable from the app root, so Vite would
47
+ // silently skip it. Unresolvable entries below are skipped too (harmless).
48
+ vite: {
49
+ optimizeDeps: {
50
+ include: [
51
+ '@kungal/editor-vue',
52
+ '@kungal/editor-core',
53
+ '@kungal/editor-core/preset',
54
+ '@milkdown/kit/preset/commonmark',
55
+ '@milkdown/kit/preset/gfm'
56
+ ]
57
+ }
58
+ }
30
59
  })
31
60
 
32
61
  // NOTE: this layer does NOT own a Tailwind entry or import editor styles. The
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kungal/editor-nuxt",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "KunEditor Nuxt Layer — wraps @kungal/editor-vue and auto-imports <KunEditor> so an existing Nuxt app keeps its exact DX (no import needed).",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -30,8 +30,8 @@
30
30
  "nuxt.config.ts"
31
31
  ],
32
32
  "dependencies": {
33
- "@kungal/editor-core": "0.12.0",
34
- "@kungal/editor-vue": "0.12.0"
33
+ "@kungal/editor-core": "0.13.0",
34
+ "@kungal/editor-vue": "0.13.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@kungal/ui-vue": "^2.7.0",