@lexical/internal 0.45.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/LICENSE +21 -0
- package/README.md +14 -0
- package/dist/LexicalInternalDevInvariant.dev.js +38 -0
- package/dist/LexicalInternalDevInvariant.dev.mjs +36 -0
- package/dist/LexicalInternalDevInvariant.js +11 -0
- package/dist/LexicalInternalDevInvariant.js.flow +14 -0
- package/dist/LexicalInternalDevInvariant.mjs +12 -0
- package/dist/LexicalInternalDevInvariant.node.mjs +10 -0
- package/dist/LexicalInternalDevInvariant.prod.js +9 -0
- package/dist/LexicalInternalDevInvariant.prod.mjs +9 -0
- package/dist/LexicalInternalFormatDevErrorMessage.dev.js +25 -0
- package/dist/LexicalInternalFormatDevErrorMessage.dev.mjs +23 -0
- package/dist/LexicalInternalFormatDevErrorMessage.js +11 -0
- package/dist/LexicalInternalFormatDevErrorMessage.js.flow +10 -0
- package/dist/LexicalInternalFormatDevErrorMessage.mjs +12 -0
- package/dist/LexicalInternalFormatDevErrorMessage.node.mjs +10 -0
- package/dist/LexicalInternalFormatDevErrorMessage.prod.js +9 -0
- package/dist/LexicalInternalFormatDevErrorMessage.prod.mjs +9 -0
- package/dist/LexicalInternalFormatDevWarningMessage.dev.js +25 -0
- package/dist/LexicalInternalFormatDevWarningMessage.dev.mjs +23 -0
- package/dist/LexicalInternalFormatDevWarningMessage.js +11 -0
- package/dist/LexicalInternalFormatDevWarningMessage.js.flow +10 -0
- package/dist/LexicalInternalFormatDevWarningMessage.mjs +12 -0
- package/dist/LexicalInternalFormatDevWarningMessage.node.mjs +10 -0
- package/dist/LexicalInternalFormatDevWarningMessage.prod.js +9 -0
- package/dist/LexicalInternalFormatDevWarningMessage.prod.mjs +9 -0
- package/dist/LexicalInternalFormatProdErrorMessage.dev.js +34 -0
- package/dist/LexicalInternalFormatProdErrorMessage.dev.mjs +32 -0
- package/dist/LexicalInternalFormatProdErrorMessage.js +11 -0
- package/dist/LexicalInternalFormatProdErrorMessage.js.flow +13 -0
- package/dist/LexicalInternalFormatProdErrorMessage.mjs +12 -0
- package/dist/LexicalInternalFormatProdErrorMessage.node.mjs +10 -0
- package/dist/LexicalInternalFormatProdErrorMessage.prod.js +9 -0
- package/dist/LexicalInternalFormatProdErrorMessage.prod.mjs +9 -0
- package/dist/LexicalInternalFormatProdWarningMessage.dev.js +30 -0
- package/dist/LexicalInternalFormatProdWarningMessage.dev.mjs +28 -0
- package/dist/LexicalInternalFormatProdWarningMessage.js +11 -0
- package/dist/LexicalInternalFormatProdWarningMessage.js.flow +13 -0
- package/dist/LexicalInternalFormatProdWarningMessage.mjs +12 -0
- package/dist/LexicalInternalFormatProdWarningMessage.node.mjs +10 -0
- package/dist/LexicalInternalFormatProdWarningMessage.prod.js +9 -0
- package/dist/LexicalInternalFormatProdWarningMessage.prod.mjs +9 -0
- package/dist/LexicalInternalInvariant.dev.js +36 -0
- package/dist/LexicalInternalInvariant.dev.mjs +34 -0
- package/dist/LexicalInternalInvariant.js +11 -0
- package/dist/LexicalInternalInvariant.js.flow +14 -0
- package/dist/LexicalInternalInvariant.mjs +12 -0
- package/dist/LexicalInternalInvariant.node.mjs +10 -0
- package/dist/LexicalInternalInvariant.prod.js +9 -0
- package/dist/LexicalInternalInvariant.prod.mjs +9 -0
- package/dist/LexicalInternalVersion.dev.js +36 -0
- package/dist/LexicalInternalVersion.dev.mjs +34 -0
- package/dist/LexicalInternalVersion.js +11 -0
- package/dist/LexicalInternalVersion.js.flow +10 -0
- package/dist/LexicalInternalVersion.mjs +12 -0
- package/dist/LexicalInternalVersion.node.mjs +10 -0
- package/dist/LexicalInternalVersion.prod.js +9 -0
- package/dist/LexicalInternalVersion.prod.mjs +9 -0
- package/dist/LexicalInternalWarnOnlyOnce.dev.js +33 -0
- package/dist/LexicalInternalWarnOnlyOnce.dev.mjs +31 -0
- package/dist/LexicalInternalWarnOnlyOnce.js +11 -0
- package/dist/LexicalInternalWarnOnlyOnce.js.flow +10 -0
- package/dist/LexicalInternalWarnOnlyOnce.mjs +12 -0
- package/dist/LexicalInternalWarnOnlyOnce.node.mjs +10 -0
- package/dist/LexicalInternalWarnOnlyOnce.prod.js +9 -0
- package/dist/LexicalInternalWarnOnlyOnce.prod.mjs +9 -0
- package/dist/devInvariant.d.ts +16 -0
- package/dist/formatDevErrorMessage.d.ts +8 -0
- package/dist/formatDevWarningMessage.d.ts +8 -0
- package/dist/formatProdErrorMessage.d.ts +8 -0
- package/dist/formatProdWarningMessage.d.ts +8 -0
- package/dist/invariant.d.ts +8 -0
- package/dist/version.d.ts +8 -0
- package/dist/warnOnlyOnce.d.ts +8 -0
- package/package.json +289 -0
- package/src/devInvariant.ts +37 -0
- package/src/formatDevErrorMessage.ts +13 -0
- package/src/formatDevWarningMessage.ts +13 -0
- package/src/formatProdErrorMessage.ts +28 -0
- package/src/formatProdWarningMessage.ts +24 -0
- package/src/invariant.ts +31 -0
- package/src/version.ts +24 -0
- package/src/warnOnlyOnce.ts +24 -0
package/package.json
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lexical/internal",
|
|
3
|
+
"description": "Internal Lexical utilities shared across packages. Do not import directly; no semver guarantees apply to its API.",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"lexical",
|
|
6
|
+
"editor",
|
|
7
|
+
"rich-text",
|
|
8
|
+
"internal"
|
|
9
|
+
],
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"version": "0.45.0",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/facebook/lexical.git",
|
|
15
|
+
"directory": "packages/lexical-internal"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
"./devInvariant": {
|
|
20
|
+
"source": "./src/devInvariant.ts",
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/devInvariant.d.ts",
|
|
23
|
+
"development": "./dist/LexicalInternalDevInvariant.dev.mjs",
|
|
24
|
+
"production": "./dist/LexicalInternalDevInvariant.prod.mjs",
|
|
25
|
+
"node": "./dist/LexicalInternalDevInvariant.node.mjs",
|
|
26
|
+
"default": "./dist/LexicalInternalDevInvariant.mjs"
|
|
27
|
+
},
|
|
28
|
+
"require": {
|
|
29
|
+
"types": "./dist/devInvariant.d.ts",
|
|
30
|
+
"development": "./dist/LexicalInternalDevInvariant.dev.js",
|
|
31
|
+
"production": "./dist/LexicalInternalDevInvariant.prod.js",
|
|
32
|
+
"default": "./dist/LexicalInternalDevInvariant.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"./devInvariant.js": {
|
|
36
|
+
"source": "./src/devInvariant.ts",
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/devInvariant.d.ts",
|
|
39
|
+
"development": "./dist/LexicalInternalDevInvariant.dev.mjs",
|
|
40
|
+
"production": "./dist/LexicalInternalDevInvariant.prod.mjs",
|
|
41
|
+
"node": "./dist/LexicalInternalDevInvariant.node.mjs",
|
|
42
|
+
"default": "./dist/LexicalInternalDevInvariant.mjs"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/devInvariant.d.ts",
|
|
46
|
+
"development": "./dist/LexicalInternalDevInvariant.dev.js",
|
|
47
|
+
"production": "./dist/LexicalInternalDevInvariant.prod.js",
|
|
48
|
+
"default": "./dist/LexicalInternalDevInvariant.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./formatDevErrorMessage": {
|
|
52
|
+
"source": "./src/formatDevErrorMessage.ts",
|
|
53
|
+
"import": {
|
|
54
|
+
"types": "./dist/formatDevErrorMessage.d.ts",
|
|
55
|
+
"development": "./dist/LexicalInternalFormatDevErrorMessage.dev.mjs",
|
|
56
|
+
"production": "./dist/LexicalInternalFormatDevErrorMessage.prod.mjs",
|
|
57
|
+
"node": "./dist/LexicalInternalFormatDevErrorMessage.node.mjs",
|
|
58
|
+
"default": "./dist/LexicalInternalFormatDevErrorMessage.mjs"
|
|
59
|
+
},
|
|
60
|
+
"require": {
|
|
61
|
+
"types": "./dist/formatDevErrorMessage.d.ts",
|
|
62
|
+
"development": "./dist/LexicalInternalFormatDevErrorMessage.dev.js",
|
|
63
|
+
"production": "./dist/LexicalInternalFormatDevErrorMessage.prod.js",
|
|
64
|
+
"default": "./dist/LexicalInternalFormatDevErrorMessage.js"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"./formatDevErrorMessage.js": {
|
|
68
|
+
"source": "./src/formatDevErrorMessage.ts",
|
|
69
|
+
"import": {
|
|
70
|
+
"types": "./dist/formatDevErrorMessage.d.ts",
|
|
71
|
+
"development": "./dist/LexicalInternalFormatDevErrorMessage.dev.mjs",
|
|
72
|
+
"production": "./dist/LexicalInternalFormatDevErrorMessage.prod.mjs",
|
|
73
|
+
"node": "./dist/LexicalInternalFormatDevErrorMessage.node.mjs",
|
|
74
|
+
"default": "./dist/LexicalInternalFormatDevErrorMessage.mjs"
|
|
75
|
+
},
|
|
76
|
+
"require": {
|
|
77
|
+
"types": "./dist/formatDevErrorMessage.d.ts",
|
|
78
|
+
"development": "./dist/LexicalInternalFormatDevErrorMessage.dev.js",
|
|
79
|
+
"production": "./dist/LexicalInternalFormatDevErrorMessage.prod.js",
|
|
80
|
+
"default": "./dist/LexicalInternalFormatDevErrorMessage.js"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"./formatDevWarningMessage": {
|
|
84
|
+
"source": "./src/formatDevWarningMessage.ts",
|
|
85
|
+
"import": {
|
|
86
|
+
"types": "./dist/formatDevWarningMessage.d.ts",
|
|
87
|
+
"development": "./dist/LexicalInternalFormatDevWarningMessage.dev.mjs",
|
|
88
|
+
"production": "./dist/LexicalInternalFormatDevWarningMessage.prod.mjs",
|
|
89
|
+
"node": "./dist/LexicalInternalFormatDevWarningMessage.node.mjs",
|
|
90
|
+
"default": "./dist/LexicalInternalFormatDevWarningMessage.mjs"
|
|
91
|
+
},
|
|
92
|
+
"require": {
|
|
93
|
+
"types": "./dist/formatDevWarningMessage.d.ts",
|
|
94
|
+
"development": "./dist/LexicalInternalFormatDevWarningMessage.dev.js",
|
|
95
|
+
"production": "./dist/LexicalInternalFormatDevWarningMessage.prod.js",
|
|
96
|
+
"default": "./dist/LexicalInternalFormatDevWarningMessage.js"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"./formatDevWarningMessage.js": {
|
|
100
|
+
"source": "./src/formatDevWarningMessage.ts",
|
|
101
|
+
"import": {
|
|
102
|
+
"types": "./dist/formatDevWarningMessage.d.ts",
|
|
103
|
+
"development": "./dist/LexicalInternalFormatDevWarningMessage.dev.mjs",
|
|
104
|
+
"production": "./dist/LexicalInternalFormatDevWarningMessage.prod.mjs",
|
|
105
|
+
"node": "./dist/LexicalInternalFormatDevWarningMessage.node.mjs",
|
|
106
|
+
"default": "./dist/LexicalInternalFormatDevWarningMessage.mjs"
|
|
107
|
+
},
|
|
108
|
+
"require": {
|
|
109
|
+
"types": "./dist/formatDevWarningMessage.d.ts",
|
|
110
|
+
"development": "./dist/LexicalInternalFormatDevWarningMessage.dev.js",
|
|
111
|
+
"production": "./dist/LexicalInternalFormatDevWarningMessage.prod.js",
|
|
112
|
+
"default": "./dist/LexicalInternalFormatDevWarningMessage.js"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"./formatProdErrorMessage": {
|
|
116
|
+
"source": "./src/formatProdErrorMessage.ts",
|
|
117
|
+
"import": {
|
|
118
|
+
"types": "./dist/formatProdErrorMessage.d.ts",
|
|
119
|
+
"development": "./dist/LexicalInternalFormatProdErrorMessage.dev.mjs",
|
|
120
|
+
"production": "./dist/LexicalInternalFormatProdErrorMessage.prod.mjs",
|
|
121
|
+
"node": "./dist/LexicalInternalFormatProdErrorMessage.node.mjs",
|
|
122
|
+
"default": "./dist/LexicalInternalFormatProdErrorMessage.mjs"
|
|
123
|
+
},
|
|
124
|
+
"require": {
|
|
125
|
+
"types": "./dist/formatProdErrorMessage.d.ts",
|
|
126
|
+
"development": "./dist/LexicalInternalFormatProdErrorMessage.dev.js",
|
|
127
|
+
"production": "./dist/LexicalInternalFormatProdErrorMessage.prod.js",
|
|
128
|
+
"default": "./dist/LexicalInternalFormatProdErrorMessage.js"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"./formatProdErrorMessage.js": {
|
|
132
|
+
"source": "./src/formatProdErrorMessage.ts",
|
|
133
|
+
"import": {
|
|
134
|
+
"types": "./dist/formatProdErrorMessage.d.ts",
|
|
135
|
+
"development": "./dist/LexicalInternalFormatProdErrorMessage.dev.mjs",
|
|
136
|
+
"production": "./dist/LexicalInternalFormatProdErrorMessage.prod.mjs",
|
|
137
|
+
"node": "./dist/LexicalInternalFormatProdErrorMessage.node.mjs",
|
|
138
|
+
"default": "./dist/LexicalInternalFormatProdErrorMessage.mjs"
|
|
139
|
+
},
|
|
140
|
+
"require": {
|
|
141
|
+
"types": "./dist/formatProdErrorMessage.d.ts",
|
|
142
|
+
"development": "./dist/LexicalInternalFormatProdErrorMessage.dev.js",
|
|
143
|
+
"production": "./dist/LexicalInternalFormatProdErrorMessage.prod.js",
|
|
144
|
+
"default": "./dist/LexicalInternalFormatProdErrorMessage.js"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"./formatProdWarningMessage": {
|
|
148
|
+
"source": "./src/formatProdWarningMessage.ts",
|
|
149
|
+
"import": {
|
|
150
|
+
"types": "./dist/formatProdWarningMessage.d.ts",
|
|
151
|
+
"development": "./dist/LexicalInternalFormatProdWarningMessage.dev.mjs",
|
|
152
|
+
"production": "./dist/LexicalInternalFormatProdWarningMessage.prod.mjs",
|
|
153
|
+
"node": "./dist/LexicalInternalFormatProdWarningMessage.node.mjs",
|
|
154
|
+
"default": "./dist/LexicalInternalFormatProdWarningMessage.mjs"
|
|
155
|
+
},
|
|
156
|
+
"require": {
|
|
157
|
+
"types": "./dist/formatProdWarningMessage.d.ts",
|
|
158
|
+
"development": "./dist/LexicalInternalFormatProdWarningMessage.dev.js",
|
|
159
|
+
"production": "./dist/LexicalInternalFormatProdWarningMessage.prod.js",
|
|
160
|
+
"default": "./dist/LexicalInternalFormatProdWarningMessage.js"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"./formatProdWarningMessage.js": {
|
|
164
|
+
"source": "./src/formatProdWarningMessage.ts",
|
|
165
|
+
"import": {
|
|
166
|
+
"types": "./dist/formatProdWarningMessage.d.ts",
|
|
167
|
+
"development": "./dist/LexicalInternalFormatProdWarningMessage.dev.mjs",
|
|
168
|
+
"production": "./dist/LexicalInternalFormatProdWarningMessage.prod.mjs",
|
|
169
|
+
"node": "./dist/LexicalInternalFormatProdWarningMessage.node.mjs",
|
|
170
|
+
"default": "./dist/LexicalInternalFormatProdWarningMessage.mjs"
|
|
171
|
+
},
|
|
172
|
+
"require": {
|
|
173
|
+
"types": "./dist/formatProdWarningMessage.d.ts",
|
|
174
|
+
"development": "./dist/LexicalInternalFormatProdWarningMessage.dev.js",
|
|
175
|
+
"production": "./dist/LexicalInternalFormatProdWarningMessage.prod.js",
|
|
176
|
+
"default": "./dist/LexicalInternalFormatProdWarningMessage.js"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"./invariant": {
|
|
180
|
+
"source": "./src/invariant.ts",
|
|
181
|
+
"import": {
|
|
182
|
+
"types": "./dist/invariant.d.ts",
|
|
183
|
+
"development": "./dist/LexicalInternalInvariant.dev.mjs",
|
|
184
|
+
"production": "./dist/LexicalInternalInvariant.prod.mjs",
|
|
185
|
+
"node": "./dist/LexicalInternalInvariant.node.mjs",
|
|
186
|
+
"default": "./dist/LexicalInternalInvariant.mjs"
|
|
187
|
+
},
|
|
188
|
+
"require": {
|
|
189
|
+
"types": "./dist/invariant.d.ts",
|
|
190
|
+
"development": "./dist/LexicalInternalInvariant.dev.js",
|
|
191
|
+
"production": "./dist/LexicalInternalInvariant.prod.js",
|
|
192
|
+
"default": "./dist/LexicalInternalInvariant.js"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"./invariant.js": {
|
|
196
|
+
"source": "./src/invariant.ts",
|
|
197
|
+
"import": {
|
|
198
|
+
"types": "./dist/invariant.d.ts",
|
|
199
|
+
"development": "./dist/LexicalInternalInvariant.dev.mjs",
|
|
200
|
+
"production": "./dist/LexicalInternalInvariant.prod.mjs",
|
|
201
|
+
"node": "./dist/LexicalInternalInvariant.node.mjs",
|
|
202
|
+
"default": "./dist/LexicalInternalInvariant.mjs"
|
|
203
|
+
},
|
|
204
|
+
"require": {
|
|
205
|
+
"types": "./dist/invariant.d.ts",
|
|
206
|
+
"development": "./dist/LexicalInternalInvariant.dev.js",
|
|
207
|
+
"production": "./dist/LexicalInternalInvariant.prod.js",
|
|
208
|
+
"default": "./dist/LexicalInternalInvariant.js"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"./version": {
|
|
212
|
+
"source": "./src/version.ts",
|
|
213
|
+
"import": {
|
|
214
|
+
"types": "./dist/version.d.ts",
|
|
215
|
+
"development": "./dist/LexicalInternalVersion.dev.mjs",
|
|
216
|
+
"production": "./dist/LexicalInternalVersion.prod.mjs",
|
|
217
|
+
"node": "./dist/LexicalInternalVersion.node.mjs",
|
|
218
|
+
"default": "./dist/LexicalInternalVersion.mjs"
|
|
219
|
+
},
|
|
220
|
+
"require": {
|
|
221
|
+
"types": "./dist/version.d.ts",
|
|
222
|
+
"development": "./dist/LexicalInternalVersion.dev.js",
|
|
223
|
+
"production": "./dist/LexicalInternalVersion.prod.js",
|
|
224
|
+
"default": "./dist/LexicalInternalVersion.js"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"./version.js": {
|
|
228
|
+
"source": "./src/version.ts",
|
|
229
|
+
"import": {
|
|
230
|
+
"types": "./dist/version.d.ts",
|
|
231
|
+
"development": "./dist/LexicalInternalVersion.dev.mjs",
|
|
232
|
+
"production": "./dist/LexicalInternalVersion.prod.mjs",
|
|
233
|
+
"node": "./dist/LexicalInternalVersion.node.mjs",
|
|
234
|
+
"default": "./dist/LexicalInternalVersion.mjs"
|
|
235
|
+
},
|
|
236
|
+
"require": {
|
|
237
|
+
"types": "./dist/version.d.ts",
|
|
238
|
+
"development": "./dist/LexicalInternalVersion.dev.js",
|
|
239
|
+
"production": "./dist/LexicalInternalVersion.prod.js",
|
|
240
|
+
"default": "./dist/LexicalInternalVersion.js"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"./warnOnlyOnce": {
|
|
244
|
+
"source": "./src/warnOnlyOnce.ts",
|
|
245
|
+
"import": {
|
|
246
|
+
"types": "./dist/warnOnlyOnce.d.ts",
|
|
247
|
+
"development": "./dist/LexicalInternalWarnOnlyOnce.dev.mjs",
|
|
248
|
+
"production": "./dist/LexicalInternalWarnOnlyOnce.prod.mjs",
|
|
249
|
+
"node": "./dist/LexicalInternalWarnOnlyOnce.node.mjs",
|
|
250
|
+
"default": "./dist/LexicalInternalWarnOnlyOnce.mjs"
|
|
251
|
+
},
|
|
252
|
+
"require": {
|
|
253
|
+
"types": "./dist/warnOnlyOnce.d.ts",
|
|
254
|
+
"development": "./dist/LexicalInternalWarnOnlyOnce.dev.js",
|
|
255
|
+
"production": "./dist/LexicalInternalWarnOnlyOnce.prod.js",
|
|
256
|
+
"default": "./dist/LexicalInternalWarnOnlyOnce.js"
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"./warnOnlyOnce.js": {
|
|
260
|
+
"source": "./src/warnOnlyOnce.ts",
|
|
261
|
+
"import": {
|
|
262
|
+
"types": "./dist/warnOnlyOnce.d.ts",
|
|
263
|
+
"development": "./dist/LexicalInternalWarnOnlyOnce.dev.mjs",
|
|
264
|
+
"production": "./dist/LexicalInternalWarnOnlyOnce.prod.mjs",
|
|
265
|
+
"node": "./dist/LexicalInternalWarnOnlyOnce.node.mjs",
|
|
266
|
+
"default": "./dist/LexicalInternalWarnOnlyOnce.mjs"
|
|
267
|
+
},
|
|
268
|
+
"require": {
|
|
269
|
+
"types": "./dist/warnOnlyOnce.d.ts",
|
|
270
|
+
"development": "./dist/LexicalInternalWarnOnlyOnce.dev.js",
|
|
271
|
+
"production": "./dist/LexicalInternalWarnOnlyOnce.prod.js",
|
|
272
|
+
"default": "./dist/LexicalInternalWarnOnlyOnce.js"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
"files": [
|
|
277
|
+
"dist",
|
|
278
|
+
"src",
|
|
279
|
+
"!src/__tests__",
|
|
280
|
+
"!src/__bench__",
|
|
281
|
+
"!src/__mocks__",
|
|
282
|
+
"!src/**/*.test.ts",
|
|
283
|
+
"!src/**/*.test.tsx",
|
|
284
|
+
"!src/**/*.bench.ts",
|
|
285
|
+
"!src/**/*.bench.tsx",
|
|
286
|
+
"README.md",
|
|
287
|
+
"LICENSE"
|
|
288
|
+
]
|
|
289
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const __DEV__ = process.env.NODE_ENV !== 'production';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* If `!cond`, throw in `__DEV__` like an invariant and warn in prod.
|
|
13
|
+
*
|
|
14
|
+
* A production build rewrites call sites via `transformErrorMessages`
|
|
15
|
+
* (throwing dev message in dev, `formatProdWarningMessage` in prod), so this
|
|
16
|
+
* body is only reached when consumed as untransformed source. It interpolates
|
|
17
|
+
* `%s` placeholders and throws outside production, otherwise warns.
|
|
18
|
+
*/
|
|
19
|
+
export default function devInvariant(
|
|
20
|
+
cond?: boolean,
|
|
21
|
+
message = 'Internal Lexical error: devInvariant() called without a message',
|
|
22
|
+
...args: string[]
|
|
23
|
+
): void {
|
|
24
|
+
if (cond) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const formatted = args.reduce(
|
|
29
|
+
(msg, arg) => msg.replace('%s', String(arg)),
|
|
30
|
+
message,
|
|
31
|
+
);
|
|
32
|
+
if (__DEV__) {
|
|
33
|
+
throw new Error(formatted);
|
|
34
|
+
} else {
|
|
35
|
+
console.warn(formatted);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Do not require this module directly! Use normal `invariant` calls.
|
|
10
|
+
|
|
11
|
+
export default function formatDevErrorMessage(message: string): never {
|
|
12
|
+
throw new Error(message);
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Do not require this module directly! Use normal `invariant` calls.
|
|
10
|
+
|
|
11
|
+
export default function formatDevWarningMessage(message: string): void {
|
|
12
|
+
console.warn(message);
|
|
13
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
10
|
+
// template literal strings. The messages will be replaced with error codes
|
|
11
|
+
// during build.
|
|
12
|
+
|
|
13
|
+
export default function formatProdErrorMessage(
|
|
14
|
+
code: string,
|
|
15
|
+
...args: string[]
|
|
16
|
+
): never {
|
|
17
|
+
const url = new URL('https://lexical.dev/docs/error');
|
|
18
|
+
const params = new URLSearchParams();
|
|
19
|
+
params.append('code', code);
|
|
20
|
+
for (const arg of args) {
|
|
21
|
+
params.append('v', arg);
|
|
22
|
+
}
|
|
23
|
+
url.search = params.toString();
|
|
24
|
+
|
|
25
|
+
throw Error(
|
|
26
|
+
`Minified Lexical error #${code}; visit ${url.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export default function formatProdWarningMessage(
|
|
10
|
+
code: string,
|
|
11
|
+
...args: string[]
|
|
12
|
+
): void {
|
|
13
|
+
const url = new URL('https://lexical.dev/docs/error');
|
|
14
|
+
const params = new URLSearchParams();
|
|
15
|
+
params.append('code', code);
|
|
16
|
+
for (const arg of args) {
|
|
17
|
+
params.append('v', arg);
|
|
18
|
+
}
|
|
19
|
+
url.search = params.toString();
|
|
20
|
+
|
|
21
|
+
console.warn(
|
|
22
|
+
`Minified Lexical warning #${code}; visit ${url.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`,
|
|
23
|
+
);
|
|
24
|
+
}
|
package/src/invariant.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// invariant(condition, message) will refine types based on "condition", and
|
|
10
|
+
// if "condition" is false will throw an error. This function is special-cased
|
|
11
|
+
// in flow itself, so we can't name it anything else.
|
|
12
|
+
//
|
|
13
|
+
// In a production build the `transformErrorMessages` Babel plugin replaces
|
|
14
|
+
// every call site with a hoisted `if (!cond)` check plus a
|
|
15
|
+
// `formatProdErrorMessage(code, ...args)` call, so this body is only reached
|
|
16
|
+
// when the source is consumed without that transform (the `source` export
|
|
17
|
+
// condition or an untransformed dev build). It must therefore stand on its
|
|
18
|
+
// own: interpolate `%s` placeholders against args and throw.
|
|
19
|
+
export default function invariant(
|
|
20
|
+
cond?: boolean,
|
|
21
|
+
message = 'Internal Lexical error: invariant() called without a message',
|
|
22
|
+
...args: string[]
|
|
23
|
+
): asserts cond {
|
|
24
|
+
if (cond) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
throw new Error(
|
|
29
|
+
args.reduce((msg, arg) => msg.replace('%s', String(arg)), message),
|
|
30
|
+
);
|
|
31
|
+
}
|
package/src/version.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// `process.env.LEXICAL_VERSION` is statically replaced with the build-specific
|
|
10
|
+
// version string in a Rollup build, and a consumer's bundler `define` can
|
|
11
|
+
// inject it the same way — so the exact `process.env.LEXICAL_VERSION` member
|
|
12
|
+
// expression must be preserved for that substitution to match. Reading it
|
|
13
|
+
// inside a try/catch lets the source be consumed directly (via the `source`
|
|
14
|
+
// export condition) in a browser bundle, where `process` is undefined and
|
|
15
|
+
// nothing replaced the reference, without throwing a ReferenceError; it falls
|
|
16
|
+
// back to the literal below instead. The literal is regenerated by
|
|
17
|
+
// `pnpm run update-version`.
|
|
18
|
+
let envLexicalVersion: string | undefined;
|
|
19
|
+
try {
|
|
20
|
+
envLexicalVersion = process.env.LEXICAL_VERSION;
|
|
21
|
+
} catch {
|
|
22
|
+
// `process` is not defined in some browser bundles; use the fallback.
|
|
23
|
+
}
|
|
24
|
+
export const LEXICAL_VERSION: string = envLexicalVersion ?? '0.45.0+source';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const __DEV__ = process.env.NODE_ENV !== 'production';
|
|
10
|
+
|
|
11
|
+
/*@__INLINE__*/
|
|
12
|
+
export default function warnOnlyOnce(message: string): () => void {
|
|
13
|
+
if (__DEV__) {
|
|
14
|
+
let run = false;
|
|
15
|
+
return () => {
|
|
16
|
+
if (!run) {
|
|
17
|
+
console.warn(message);
|
|
18
|
+
}
|
|
19
|
+
run = true;
|
|
20
|
+
};
|
|
21
|
+
} else {
|
|
22
|
+
return () => {};
|
|
23
|
+
}
|
|
24
|
+
}
|