@domternal/pm 0.14.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +39 -7
  2. package/package.json +7 -3
package/README.md CHANGED
@@ -6,9 +6,9 @@
6
6
  The ProseMirror dependency layer for the [Domternal](https://domternal.dev) editor. It
7
7
  re-exports the underlying `prosemirror-*` libraries under stable `@domternal/pm/*`
8
8
  subpaths so every Domternal package imports ProseMirror from one place. Because the
9
- `prosemirror-*` packages are pinned here as direct dependencies, your package manager
10
- dedupes them to a single copy across `@domternal/core` and every extension. You rarely
11
- install it yourself: it ships transitively with `@domternal/core`.
9
+ `prosemirror-*` packages are declared here once, as ordinary dependencies of this package,
10
+ your package manager dedupes them to a single copy across `@domternal/core` and every
11
+ extension. You rarely install it yourself: it ships transitively with `@domternal/core`.
12
12
 
13
13
  ## Links
14
14
 
@@ -16,19 +16,51 @@ install it yourself: it ships transitively with `@domternal/core`.
16
16
 
17
17
  ## Install
18
18
 
19
- Install it explicitly only when you import ProseMirror primitives in your own code:
19
+ Install it explicitly when you import ProseMirror primitives in your own code, or when a
20
+ strict peer resolver asks for it: every `@domternal/extension-*` package declares
21
+ `@domternal/pm` as a peer dependency at the same minor floor as `@domternal/core`.
20
22
 
21
23
  ```bash
22
24
  pnpm add @domternal/pm
23
25
  ```
24
26
 
25
- There are no peer dependencies: the `prosemirror-*` libraries are bundled as
26
- dependencies of this package.
27
+ `@domternal/pm` itself has no peer dependencies: the `prosemirror-*` libraries are its own
28
+ dependencies.
29
+
30
+ ## One copy, always
31
+
32
+ ProseMirror compares by identity, not by shape. Two copies of `prosemirror-model` make
33
+ `Fragment.from` reject a fragment the editor itself produced ("Can not convert <> to a
34
+ Fragment"), two copies of `prosemirror-state` collide on a keyed plugin. That is a crash,
35
+ not a few extra kilobytes, and nothing warns at install time.
36
+
37
+ Declaring the libraries here once is what normally prevents it. It stops being enough when
38
+ another library in your app declares the same packages as **peer dependencies** and takes
39
+ whatever your application root offers: `y-prosemirror` is the common case, and the one
40
+ that reaches Domternal Pro's collaboration. The two resolutions can then differ with
41
+ nothing warning at install or build time.
42
+
43
+ Domternal detects it at runtime and names both packages and the fix. The dedupe recipe per
44
+ package manager and bundler:
45
+ https://domternal.dev/v1/guides/single-prosemirror-copy/
46
+
47
+ ### Why these are dependencies and not peers
48
+
49
+ Declaring them as peer dependencies would make a second copy impossible, since there would be
50
+ nothing here to bring. It is not worth what it costs: peers are installed automatically by npm 7
51
+ and later, by pnpm and by Bun, but by neither version of Yarn, so every Yarn user would have to
52
+ install twelve ProseMirror packages by hand. An install that fails outright is a worse first day
53
+ than a duplicate that is rare, loud when it happens, and fixed by one block of JSON.
54
+
55
+ What is done instead: the ranges declared here are checked in CI against those of every library
56
+ that shares ProseMirror with this one, so a release cannot make the two impossible to reconcile,
57
+ and a duplicate that does form is reported by name at runtime.
27
58
 
28
59
  ## Usage
29
60
 
30
61
  Import from a subpath matching the ProseMirror package you need. Each subpath
31
- re-exports the full API of its `prosemirror-*` counterpart.
62
+ re-exports the full API of its `prosemirror-*` counterpart. There is no root export, so
63
+ `import { Plugin } from '@domternal/pm'` does not resolve.
32
64
 
33
65
  ```ts
34
66
  import { Plugin, PluginKey } from '@domternal/pm/state';
package/package.json CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@domternal/pm",
3
- "version": "0.14.0",
3
+ "version": "1.0.0",
4
4
  "description": "ProseMirror package re-exports for Domternal",
5
5
  "author": "https://github.com/ThomasNowHere",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "sideEffects": false,
9
+ "engines": {
10
+ "node": ">=22"
11
+ },
9
12
  "exports": {
10
13
  "./commands": {
11
14
  "import": {
@@ -197,5 +200,6 @@
197
200
  "bugs": {
198
201
  "url": "https://github.com/domternal/domternal/issues"
199
202
  },
200
- "homepage": "https://domternal.dev"
201
- }
203
+ "homepage": "https://domternal.dev",
204
+ "scripts": {}
205
+ }