weml-monaco 0.4.3 → 0.5.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
@@ -8,6 +8,44 @@ This package mirrors the language logic of the VS Code extension; entries below
8
8
  track the port catching up with the VS Code provider changes (see the root
9
9
  `CHANGELOG.md` for the extension).
10
10
 
11
+ ## [0.5.0] — 2026-09-09
12
+
13
+ ### Changed
14
+ - **Breaking:** the Monaco type surface is imported from
15
+ `monaco-editor/editor/editor.api.js` instead of the `monaco-editor` root.
16
+ The root re-exports the TypeScript, CSS, JSON and HTML language
17
+ contributions, so its type forced every consumer to import Monaco whole and
18
+ ship all four language workers — around 11 MB of bundle nobody used. The
19
+ editor core carries everything this package actually touches. Passing the
20
+ full `monaco-editor` namespace still type-checks, since it is a superset.
21
+ - **Breaking:** `peerDependencies.monaco-editor` raised from `>=0.34.0` to
22
+ `>=0.56.0`. The subpath resolves through the `exports` map introduced in
23
+ 0.56 (`"./*": "./esm/vs/*.js"`) and needs `moduleResolution` `node16` or
24
+ `bundler`; on 0.55 and older the equivalent path was
25
+ `monaco-editor/esm/vs/editor/editor.api`.
26
+ - Development and the CDN demo build against monaco-editor 0.56.
27
+
28
+ ### Fixed
29
+ - The bundles no longer register themselves with an AMD loader. `he` (via
30
+ node-html-parser) ends in a UMD footer whose `define()` call is anonymous, so
31
+ loading `dist/index.global.js` from a `<script>` tag on a page that also runs
32
+ Monaco's AMD loader made the loader attribute that module to whatever it was
33
+ resolving, warning `Duplicate definition of module 'vs/editor/editor.main'`.
34
+ The build now folds `define.amd` to `false`, dropping the branch.
35
+
36
+ The type-path change itself does not touch the runtime output: every Monaco
37
+ import in `src/` is an `import type`, and only the first line of the emitted
38
+ declarations changes. `dist/index.mjs`, `index.cjs` and `index.global.js`
39
+ differ solely by the removed AMD footer above.
40
+
41
+ ## [0.4.4] — 2026-09-07
42
+
43
+ Synced with VS Code extension `0.7.12`.
44
+
45
+ ### Fixed
46
+ - Preserve surrounding word separators in nested inline wrappers containing
47
+ sentence elements when applying canonical formatting.
48
+
11
49
  ## [0.4.3] — 2026-09-07
12
50
 
13
51
  Synced with VS Code extension `0.7.11`.
package/README.md CHANGED
@@ -58,7 +58,7 @@ Monaco is **passed in** at registration time, so this works no matter how
58
58
  Monaco itself is loaded (AMD/CDN, ESM bundle, or a global):
59
59
 
60
60
  ```ts
61
- import * as monaco from 'monaco-editor';
61
+ import * as monaco from 'monaco-editor/editor/editor.api.js';
62
62
  import { registerWeml } from 'weml-monaco';
63
63
 
64
64
  const disposable = registerWeml(monaco);
@@ -69,6 +69,20 @@ monaco.editor.create(document.getElementById('container'), { model });
69
69
  // disposable.dispose(); // tears down every provider + diagnostics listener
70
70
  ```
71
71
 
72
+ The import path is the editor core rather than the `monaco-editor` root on
73
+ purpose. The root re-exports the TypeScript, CSS, JSON and HTML language
74
+ contributions, so importing it pulls all four — and their workers — into the
75
+ application bundle. `weml-monaco` never touches them: it only needs
76
+ `editor`, `languages`, `Position`, `MarkerSeverity` and a handful of
77
+ interfaces, all of which live in `editor/editor.api.js`. Passing the full
78
+ `monaco-editor` namespace still type-checks (it is a superset), so this is a
79
+ choice the consumer makes, not a restriction.
80
+
81
+ The subpath resolves through the package's `exports` map, which requires
82
+ **monaco-editor 0.56 or newer** and `moduleResolution` `node16`/`bundler`.
83
+ On 0.55 and older the equivalent path was
84
+ `monaco-editor/esm/vs/editor/editor.api`.
85
+
72
86
  `registerWeml(monaco, options?)` accepts:
73
87
 
74
88
  | option | default | meaning |
package/dist/index.cjs CHANGED
@@ -267,7 +267,7 @@ var require_he = __commonJS({
267
267
  "escape": escape,
268
268
  "unescape": decode
269
269
  };
270
- if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
270
+ if (typeof define == "function" && false) {
271
271
  define(function() {
272
272
  return he;
273
273
  });
@@ -6356,15 +6356,15 @@ var require_wemlContentNormalizeV2 = __commonJS({
6356
6356
  }
6357
6357
  }
6358
6358
  function processInlineContainer(node) {
6359
- if (hasDirectSentChildren(node)) processSentContainer(node);
6359
+ if (hasDirectSentChildren(node)) processSentContainer(node, true);
6360
6360
  else processInlineContent(node, true);
6361
6361
  }
6362
- function processSentContainer(node) {
6362
+ function processSentContainer(node, trimEdges) {
6363
6363
  for (const child of [...node.childNodes]) {
6364
6364
  if (child.nodeType !== 1) continue;
6365
6365
  const name = child.rawTagName.toLowerCase();
6366
6366
  if (isInlineTextElement(child)) {
6367
- if (hasDirectSentChildren(child)) processSentContainer(child);
6367
+ if (hasDirectSentChildren(child)) processSentContainer(child, false);
6368
6368
  else processInlineContent(child, false);
6369
6369
  } else if (BLOCK_ELEMENTS.has(name)) {
6370
6370
  processBlockElement(child);
@@ -6388,7 +6388,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6388
6388
  if (next && next.nodeType === 3) next.rawText = trimStartWhitespace(next.rawText);
6389
6389
  }
6390
6390
  }
6391
- trimContainerEdges(node);
6391
+ if (trimEdges) trimContainerEdges(node);
6392
6392
  for (const child of [...node.childNodes]) {
6393
6393
  if (child.nodeType === 3 && child.rawText === "") child.remove();
6394
6394
  }
@@ -6410,7 +6410,7 @@ var require_wemlContentNormalizeV2 = __commonJS({
6410
6410
  if (child.nodeType !== 1) continue;
6411
6411
  const name = child.rawTagName.toLowerCase();
6412
6412
  if (isInlineTextElement(child)) {
6413
- if (hasDirectSentChildren(child)) processSentContainer(child);
6413
+ if (hasDirectSentChildren(child)) processSentContainer(child, false);
6414
6414
  else processInlineContent(child, false);
6415
6415
  } else if (BLOCK_ELEMENTS.has(name)) {
6416
6416
  processBlockElement(child);