weml-monaco 0.3.3 → 0.4.2

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,64 @@ 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.4.2] — 2026-08-30
12
+
13
+ Synced with VS Code extension `0.7.9`.
14
+
15
+ ### Added
16
+ - Added `w-color` completion, hover, snippets and validation, including the
17
+ requirement for at least one valid foreground/background color.
18
+ - Added color attributes to headings and paragraphs, text-block alignment, and
19
+ the `purchase-link`/`version-id` metadata fields.
20
+ - Metadata-name completion now reflects the fields generated from the docs.
21
+
22
+ ## [0.4.1] — 2026-08-30
23
+
24
+ Synced with VS Code extension `0.7.8`.
25
+
26
+ ### Changed
27
+ - Updated the shared V2 normalizer with deterministic attribute and token-list
28
+ sorting, full Unicode whitespace handling, additional HTML void elements and
29
+ inline custom-element normalization.
30
+
31
+ ### Fixed
32
+ - Added structured validation for missing, duplicate, nested and out-of-order
33
+ root document elements, plus BOM and additional entity-form handling.
34
+ - Preserved browser compatibility by keeping Node's `crypto` dependency lazy and
35
+ retained `node-html-parser`-compatible sibling insertion for inline whitespace.
36
+
37
+ ## [0.4.0] — 2026-08-17
38
+
39
+ Packaging only — the language logic is unchanged.
40
+
41
+ ### Changed
42
+ - **Rebuilt the package with tsup** into `dist/index.mjs` (ESM), `dist/index.cjs`
43
+ (CJS) and `dist/index.global.js` (minified IIFE for `<script>`/CDN use), with an
44
+ `exports` map, per-condition type declarations, `sideEffects: false` and
45
+ `engines: node >= 18`. `main` used to point at the IIFE bundle, so
46
+ `require('weml-monaco')` returned an empty object — it now resolves to real CJS.
47
+ - **The published tarball shrank from ~7 MB to ~2 MB.** The IIFE build is minified
48
+ and ships without a sourcemap; only the ESM/CJS bundles carry maps.
49
+ - `node-html-parser` and `vscode-html-languageservice` moved to `devDependencies`:
50
+ both are bundled into every artefact, so the package now installs with **no
51
+ runtime dependencies**.
52
+ - Publishing runs `publint` + `arethetypeswrong` (`npm run check:package`) in CI.
53
+
54
+ ### Fixed
55
+ - **Sourcemaps no longer reference files that do not exist.** esbuild used to chain
56
+ the maps shipped by `entities`, `domutils`, `css-select` and `nth-check`, which
57
+ point at TypeScript sources those packages never publish; the resulting `sources`
58
+ entries resolved to `<app>/node_modules/node_modules/...` and made every consuming
59
+ dev server log a warning per source on each load (Vite: *"Sourcemap … points to a
60
+ source file outside its package"*). Dependency sourcemap comments are now ignored
61
+ at build time, so every source in the shipped maps has inline content.
62
+
63
+ ### Migration
64
+ Deep imports of `dist/weml-monaco.js` / `dist/weml-monaco.esm.js` no longer exist
65
+ (and the `exports` map blocks deep paths anyway). Import the package by name —
66
+ `import { registerWeml } from 'weml-monaco'` — or, for a `<script>` tag, use
67
+ `weml-monaco/global` (`window.WemlMonaco`).
68
+
11
69
  ## [0.3.2] — 2026-08-13
12
70
 
13
71
  Synced with VS Code extension `0.7.7`.
package/README.md CHANGED
@@ -27,12 +27,29 @@ standalone re-implementation living entirely under `monaco-editor/`.
27
27
 
28
28
  ## Install & build
29
29
 
30
+ ```bash
31
+ npm install weml-monaco
32
+ ```
33
+
34
+ The package has no runtime dependencies (`node-html-parser` and
35
+ `vscode-html-languageservice` are bundled in) and `monaco-editor` is a peer
36
+ dependency you already have.
37
+
38
+ | entry point | file | for |
39
+ | ---------------------- | ----------------------- | -------------------------------------- |
40
+ | `weml-monaco` | `dist/index.mjs` | ESM — bundlers, `import` |
41
+ | `weml-monaco` | `dist/index.cjs` | CJS — `require` |
42
+ | `weml-monaco/global` | `dist/index.global.js` | `<script>` / CDN → `window.WemlMonaco` |
43
+
44
+ Working on the package itself:
45
+
30
46
  ```bash
31
47
  cd monaco-editor
32
48
  npm install
33
- npm run build # → dist/weml-monaco.js (IIFE global), .esm.js (ESM), *.d.ts
34
- npm run typecheck # tsc --noEmit
35
- npm test # build the ESM bundle + run the Node smoke test
49
+ npm run build # tsup → dist/ (ESM + CJS + IIFE + declarations)
50
+ npm run typecheck # tsc --noEmit
51
+ npm test # build + Node smoke test
52
+ npm run check:package # publint + arethetypeswrong on the packed tarball
36
53
  ```
37
54
 
38
55
  ## Usage
@@ -42,7 +59,7 @@ Monaco itself is loaded (AMD/CDN, ESM bundle, or a global):
42
59
 
43
60
  ```ts
44
61
  import * as monaco from 'monaco-editor';
45
- import { registerWeml } from 'weml-monaco'; // or the bundled dist/weml-monaco.esm.js
62
+ import { registerWeml } from 'weml-monaco';
46
63
 
47
64
  const disposable = registerWeml(monaco);
48
65
 
@@ -113,7 +130,7 @@ behave like `editor.insertSnippet` in VS Code.
113
130
  ## Demo
114
131
 
115
132
  ```bash
116
- npm run demo # bundles src/index.ts → demo/weml-monaco.js
133
+ npm run demo # builds dist/ and copies the IIFE bundle → demo/weml-monaco.js
117
134
  # then open demo/index.html in a browser
118
135
  ```
119
136