alinea 1.6.2 → 1.6.4
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/dist/.init/content/pages/welcome.json +1 -1
- package/dist/LICENSES.md +104 -104
- package/dist/backend/api/OAuth2.js +1 -1
- package/dist/backend/resolver/ParsePreview.d.ts +1 -1
- package/dist/backend/resolver/ParsePreview.js +35 -22
- package/dist/bundled.d.ts +57 -3
- package/dist/chunks/{chunk-APLOCHCC.js → chunk-3B5ZGDWF.js} +1 -1
- package/dist/chunks/{chunk-HELH3PKC.js → chunk-NWJMNYVI.js} +2 -2
- package/dist/chunks/crypto-HZTUU327.js +11 -0
- package/dist/cli/Serve.js +1 -1
- package/dist/cli/bin.js +1 -1
- package/dist/cloud/CloudRemote.js +1 -1
- package/dist/core/Preview.d.ts +1 -1
- package/dist/core/db/LinkResolver.d.ts +1 -1
- package/dist/core/shape/RichTextShape.js +7 -2
- package/dist/core/source/FilePatch.d.ts +12 -0
- package/dist/core/source/FilePatch.js +47 -0
- package/dist/core/source/FilePatch.test.d.ts +1 -0
- package/dist/core/source/GitDelta.d.ts +10 -0
- package/dist/core/source/GitDelta.js +196 -0
- package/dist/core/source/GitDelta.test.d.ts +1 -0
- package/dist/core/source/Utils.d.ts +4 -0
- package/dist/core/source/Utils.js +6 -3
- package/dist/dashboard/atoms/EntryEditorAtoms.js +19 -2
- package/dist/preview/PreviewPayload.js +2 -2
- package/dist/preview/PreviewPayload.test.d.ts +1 -0
- package/package.json +2 -2
package/dist/LICENSES.md
CHANGED
|
@@ -2,11 +2,11 @@ This file contains the licenses of the bundled modules in this distribution.
|
|
|
2
2
|
|
|
3
3
|
===
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# rado@1.0.15 (MIT)
|
|
6
6
|
|
|
7
7
|
MIT License
|
|
8
8
|
|
|
9
|
-
Copyright (c)
|
|
9
|
+
Copyright (c) 2024 Ben Merckx
|
|
10
10
|
|
|
11
11
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
12
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -26,14 +26,36 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
26
26
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
27
|
SOFTWARE.
|
|
28
28
|
|
|
29
|
+
===
|
|
30
|
+
|
|
31
|
+
# htmlparser2@9.1.0 (MIT)
|
|
32
|
+
|
|
33
|
+
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
34
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
35
|
+
of this software and associated documentation files (the "Software"), to
|
|
36
|
+
deal in the Software without restriction, including without limitation the
|
|
37
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
38
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
39
|
+
furnished to do so, subject to the following conditions:
|
|
40
|
+
|
|
41
|
+
The above copyright notice and this permission notice shall be included in
|
|
42
|
+
all copies or substantial portions of the Software.
|
|
43
|
+
|
|
44
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
45
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
46
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
47
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
48
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
49
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
50
|
+
IN THE SOFTWARE.
|
|
29
51
|
|
|
30
52
|
===
|
|
31
53
|
|
|
32
|
-
#
|
|
54
|
+
# react-query@3.39.3 (MIT)
|
|
33
55
|
|
|
34
56
|
MIT License
|
|
35
57
|
|
|
36
|
-
Copyright (c)
|
|
58
|
+
Copyright (c) 2019 Tanner Linsley
|
|
37
59
|
|
|
38
60
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
39
61
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -53,6 +75,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
53
75
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
54
76
|
SOFTWARE.
|
|
55
77
|
|
|
78
|
+
|
|
56
79
|
===
|
|
57
80
|
|
|
58
81
|
# @headlessui/react@2.2.0 (MIT)
|
|
@@ -108,30 +131,24 @@ SOFTWARE.
|
|
|
108
131
|
|
|
109
132
|
===
|
|
110
133
|
|
|
111
|
-
#
|
|
134
|
+
# domutils@3.1.0 (BSD-2-Clause)
|
|
135
|
+
|
|
136
|
+
Copyright (c) Felix Böhm
|
|
137
|
+
All rights reserved.
|
|
138
|
+
|
|
139
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
140
|
+
|
|
141
|
+
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
142
|
+
|
|
143
|
+
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
144
|
+
|
|
145
|
+
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
|
|
146
|
+
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
112
147
|
|
|
113
|
-
Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
|
|
114
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
115
|
-
of this software and associated documentation files (the "Software"), to
|
|
116
|
-
deal in the Software without restriction, including without limitation the
|
|
117
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
118
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
|
119
|
-
furnished to do so, subject to the following conditions:
|
|
120
|
-
|
|
121
|
-
The above copyright notice and this permission notice shall be included in
|
|
122
|
-
all copies or substantial portions of the Software.
|
|
123
|
-
|
|
124
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
125
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
126
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
127
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
128
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
129
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
130
|
-
IN THE SOFTWARE.
|
|
131
148
|
|
|
132
149
|
===
|
|
133
150
|
|
|
134
|
-
#
|
|
151
|
+
# domhandler@5.0.3 (BSD-2-Clause)
|
|
135
152
|
|
|
136
153
|
Copyright (c) Felix Böhm
|
|
137
154
|
All rights reserved.
|
|
@@ -148,7 +165,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
148
165
|
|
|
149
166
|
===
|
|
150
167
|
|
|
151
|
-
#
|
|
168
|
+
# entities@4.5.0 (BSD-2-Clause)
|
|
152
169
|
|
|
153
170
|
Copyright (c) Felix Böhm
|
|
154
171
|
All rights reserved.
|
|
@@ -163,6 +180,33 @@ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRE
|
|
|
163
180
|
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
164
181
|
|
|
165
182
|
|
|
183
|
+
===
|
|
184
|
+
|
|
185
|
+
# @badgateway/oauth2-client@3.2.0 (MIT)
|
|
186
|
+
|
|
187
|
+
MIT License
|
|
188
|
+
|
|
189
|
+
Copyright (c) 2019-2023 Evert Pot
|
|
190
|
+
|
|
191
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
192
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
193
|
+
in the Software without restriction, including without limitation the rights
|
|
194
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
195
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
196
|
+
furnished to do so, subject to the following conditions:
|
|
197
|
+
|
|
198
|
+
The above copyright notice and this permission notice shall be included in all
|
|
199
|
+
copies or substantial portions of the Software.
|
|
200
|
+
|
|
201
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
202
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
203
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
204
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
205
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
206
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
207
|
+
SOFTWARE.
|
|
208
|
+
|
|
209
|
+
|
|
166
210
|
===
|
|
167
211
|
|
|
168
212
|
# @popperjs/core@2.11.8 (MIT)
|
|
@@ -189,23 +233,6 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
189
233
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
190
234
|
|
|
191
235
|
|
|
192
|
-
===
|
|
193
|
-
|
|
194
|
-
# entities@4.5.0 (BSD-2-Clause)
|
|
195
|
-
|
|
196
|
-
Copyright (c) Felix Böhm
|
|
197
|
-
All rights reserved.
|
|
198
|
-
|
|
199
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
200
|
-
|
|
201
|
-
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
202
|
-
|
|
203
|
-
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
204
|
-
|
|
205
|
-
THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
|
|
206
|
-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
207
|
-
|
|
208
|
-
|
|
209
236
|
===
|
|
210
237
|
|
|
211
238
|
# prop-types@15.8.1 (MIT)
|
|
@@ -442,29 +469,19 @@ SOFTWARE.
|
|
|
442
469
|
|
|
443
470
|
===
|
|
444
471
|
|
|
445
|
-
#
|
|
472
|
+
# dom-serializer@2.0.0 (MIT)
|
|
446
473
|
|
|
447
|
-
|
|
474
|
+
License
|
|
448
475
|
|
|
449
|
-
|
|
476
|
+
(The MIT License)
|
|
450
477
|
|
|
451
|
-
|
|
452
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
453
|
-
in the Software without restriction, including without limitation the rights
|
|
454
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
455
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
456
|
-
furnished to do so, subject to the following conditions:
|
|
478
|
+
Copyright (c) 2014 The cheeriojs contributors
|
|
457
479
|
|
|
458
|
-
|
|
459
|
-
copies or substantial portions of the Software.
|
|
480
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
460
481
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
464
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
465
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
466
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
467
|
-
SOFTWARE.
|
|
482
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
483
|
+
|
|
484
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
468
485
|
|
|
469
486
|
|
|
470
487
|
===
|
|
@@ -494,23 +511,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
494
511
|
SOFTWARE.
|
|
495
512
|
|
|
496
513
|
|
|
497
|
-
===
|
|
498
|
-
|
|
499
|
-
# dom-serializer@2.0.0 (MIT)
|
|
500
|
-
|
|
501
|
-
License
|
|
502
|
-
|
|
503
|
-
(The MIT License)
|
|
504
|
-
|
|
505
|
-
Copyright (c) 2014 The cheeriojs contributors
|
|
506
|
-
|
|
507
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
508
|
-
|
|
509
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
510
|
-
|
|
511
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
512
|
-
|
|
513
|
-
|
|
514
514
|
===
|
|
515
515
|
|
|
516
516
|
# @headless-tree/core@0.0.15 (MIT)
|
|
@@ -1612,6 +1612,33 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
1612
1612
|
See the License for the specific language governing permissions and
|
|
1613
1613
|
limitations under the License.
|
|
1614
1614
|
|
|
1615
|
+
===
|
|
1616
|
+
|
|
1617
|
+
# @tanstack/virtual-core@3.10.6 (MIT)
|
|
1618
|
+
|
|
1619
|
+
MIT License
|
|
1620
|
+
|
|
1621
|
+
Copyright (c) 2021-present Tanner Linsley
|
|
1622
|
+
|
|
1623
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1624
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1625
|
+
in the Software without restriction, including without limitation the rights
|
|
1626
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1627
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1628
|
+
furnished to do so, subject to the following conditions:
|
|
1629
|
+
|
|
1630
|
+
The above copyright notice and this permission notice shall be included in all
|
|
1631
|
+
copies or substantial portions of the Software.
|
|
1632
|
+
|
|
1633
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1634
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1635
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1636
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1637
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1638
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1639
|
+
SOFTWARE.
|
|
1640
|
+
|
|
1641
|
+
|
|
1615
1642
|
===
|
|
1616
1643
|
|
|
1617
1644
|
# @react-stately/utils@3.10.5 (Apache-2.0)
|
|
@@ -1817,30 +1844,3 @@ limitations under the License.
|
|
|
1817
1844
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1818
1845
|
See the License for the specific language governing permissions and
|
|
1819
1846
|
limitations under the License.
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
===
|
|
1823
|
-
|
|
1824
|
-
# @tanstack/virtual-core@3.10.6 (MIT)
|
|
1825
|
-
|
|
1826
|
-
MIT License
|
|
1827
|
-
|
|
1828
|
-
Copyright (c) 2021-present Tanner Linsley
|
|
1829
|
-
|
|
1830
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1831
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1832
|
-
in the Software without restriction, including without limitation the rights
|
|
1833
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1834
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1835
|
-
furnished to do so, subject to the following conditions:
|
|
1836
|
-
|
|
1837
|
-
The above copyright notice and this permission notice shall be included in all
|
|
1838
|
-
copies or substantial portions of the Software.
|
|
1839
|
-
|
|
1840
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1841
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1842
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1843
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1844
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1845
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1846
|
-
SOFTWARE.
|
|
@@ -141,7 +141,7 @@ async function getWebCrypto() {
|
|
|
141
141
|
if (typeof self !== "undefined" && self.crypto) {
|
|
142
142
|
return self.crypto;
|
|
143
143
|
}
|
|
144
|
-
const crypto = await import("crypto");
|
|
144
|
+
const crypto = await import("../../chunks/crypto-HZTUU327.js");
|
|
145
145
|
return crypto.webcrypto;
|
|
146
146
|
}
|
|
147
147
|
function stringToBuffer(input) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PreviewRequest } from 'alinea/core/Preview';
|
|
2
1
|
import type { LocalDB } from 'alinea/core/db/LocalDB';
|
|
2
|
+
import type { PreviewRequest } from 'alinea/core/Preview';
|
|
3
3
|
export declare function createPreviewParser(local: LocalDB): {
|
|
4
4
|
parse(preview: PreviewRequest, sync: () => Promise<unknown>): Promise<PreviewRequest | undefined>;
|
|
5
5
|
};
|
|
@@ -1,41 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Doc,
|
|
3
|
-
applyUpdate
|
|
4
|
-
} from "../../chunks/chunk-QUIANN6B.js";
|
|
5
|
-
import "../../chunks/chunk-AJJSW27C.js";
|
|
6
1
|
import "../../chunks/chunk-NZLE2WMY.js";
|
|
7
2
|
|
|
8
3
|
// src/backend/resolver/ParsePreview.ts
|
|
4
|
+
import { JsonLoader } from "alinea/backend/loader/JsonLoader";
|
|
9
5
|
import { Entry } from "alinea/core";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
6
|
+
import { createRecord, parseRecord } from "alinea/core/EntryRecord";
|
|
7
|
+
import { applyFilePatch } from "alinea/core/source/FilePatch";
|
|
8
|
+
import { createEntryRow } from "alinea/core/util/EntryRows";
|
|
12
9
|
import { decodePreviewPayload } from "alinea/preview/PreviewPayload";
|
|
10
|
+
var decoder = new TextDecoder();
|
|
13
11
|
function createPreviewParser(local) {
|
|
14
12
|
return {
|
|
15
13
|
async parse(preview, sync) {
|
|
16
14
|
if (!(preview && "payload" in preview)) return preview;
|
|
17
|
-
const
|
|
18
|
-
if (local.sha !==
|
|
15
|
+
const payload = await decodePreviewPayload(preview.payload);
|
|
16
|
+
if (local.sha !== payload.contentHash) {
|
|
19
17
|
await sync();
|
|
20
|
-
if (local.sha !==
|
|
18
|
+
if (local.sha !== payload.contentHash) return;
|
|
21
19
|
}
|
|
22
20
|
const entry = await local.first({
|
|
23
21
|
select: Entry,
|
|
24
|
-
id:
|
|
25
|
-
locale:
|
|
22
|
+
id: payload.entryId,
|
|
23
|
+
locale: payload.locale,
|
|
26
24
|
status: "preferDraft"
|
|
27
25
|
});
|
|
28
26
|
if (!entry) return;
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
const baseText = decoder.decode(
|
|
28
|
+
JsonLoader.format(
|
|
29
|
+
local.config.schema,
|
|
30
|
+
createRecord(entry, entry.status)
|
|
31
|
+
)
|
|
32
|
+
);
|
|
33
|
+
let updatedText;
|
|
34
|
+
try {
|
|
35
|
+
updatedText = await applyFilePatch(baseText, payload.patch);
|
|
36
|
+
} catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const { data } = parseRecord(JSON.parse(updatedText));
|
|
40
|
+
const { rowHash: _rowHash, fileHash: _fileHash, ...withoutHashes } = entry;
|
|
41
|
+
const patched = await createEntryRow(
|
|
42
|
+
local.config,
|
|
43
|
+
{
|
|
44
|
+
...withoutHashes,
|
|
45
|
+
title: data.title,
|
|
46
|
+
data,
|
|
47
|
+
path: entry.path
|
|
48
|
+
},
|
|
49
|
+
entry.status
|
|
50
|
+
);
|
|
51
|
+
return { entry: patched };
|
|
39
52
|
}
|
|
40
53
|
};
|
|
41
54
|
}
|
package/dist/bundled.d.ts
CHANGED
|
@@ -358,8 +358,8 @@ declare module 'alinea/backend/Previews' {
|
|
|
358
358
|
|
|
359
359
|
declare module 'alinea/backend/resolver/ParsePreview' {
|
|
360
360
|
|
|
361
|
-
import type { PreviewRequest } from 'alinea/core/Preview';
|
|
362
361
|
import type { LocalDB } from 'alinea/core/db/LocalDB';
|
|
362
|
+
import type { PreviewRequest } from 'alinea/core/Preview';
|
|
363
363
|
export function createPreviewParser(local: LocalDB): {
|
|
364
364
|
parse(preview: PreviewRequest, sync: () => Promise<unknown>): Promise<PreviewRequest | undefined>;
|
|
365
365
|
};
|
|
@@ -1686,7 +1686,7 @@ declare module 'alinea/core/db/LinkResolver' {
|
|
|
1686
1686
|
private locale;
|
|
1687
1687
|
constructor(resolver: EntryResolver, ctx: ResolveContext, locale: string | null);
|
|
1688
1688
|
includedAtBuild(filePath: string): boolean;
|
|
1689
|
-
resolveLinks<P extends Projection>(projection: P, entryIds: ReadonlyArray<string>): Promise<Array<InferProjection<P
|
|
1689
|
+
resolveLinks<P extends Projection>(projection: P, entryIds: ReadonlyArray<string>): Promise<Array<InferProjection<P>>>;
|
|
1690
1690
|
}
|
|
1691
1691
|
|
|
1692
1692
|
}
|
|
@@ -2997,7 +2997,7 @@ declare module 'alinea/core/Preview' {
|
|
|
2997
2997
|
entryId: string;
|
|
2998
2998
|
contentHash: string;
|
|
2999
2999
|
status: string;
|
|
3000
|
-
|
|
3000
|
+
patch: Uint8Array;
|
|
3001
3001
|
}
|
|
3002
3002
|
export interface PreviewMetadata {
|
|
3003
3003
|
title: string;
|
|
@@ -3534,6 +3534,29 @@ declare module 'alinea/core/source/CombinedSource.test' {
|
|
|
3534
3534
|
|
|
3535
3535
|
}
|
|
3536
3536
|
|
|
3537
|
+
declare module 'alinea/core/source/FilePatch' {
|
|
3538
|
+
|
|
3539
|
+
/**
|
|
3540
|
+
* Creates a Git-delta based patch for transforming `base` into `updated`.
|
|
3541
|
+
* Format:
|
|
3542
|
+
* - 20 bytes: SHA-1(base)
|
|
3543
|
+
* - N bytes: Git delta payload
|
|
3544
|
+
* - 20 bytes: SHA-1(updated)
|
|
3545
|
+
*/
|
|
3546
|
+
export function createFilePatch(base: string, updated: string): Promise<Uint8Array>;
|
|
3547
|
+
/**
|
|
3548
|
+
* Applies a patch created by `createFilePatch` and returns the updated string.
|
|
3549
|
+
*/
|
|
3550
|
+
export function applyFilePatch(base: string, patch: Uint8Array): Promise<string>;
|
|
3551
|
+
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
declare module 'alinea/core/source/FilePatch.test' {
|
|
3555
|
+
|
|
3556
|
+
export {};
|
|
3557
|
+
|
|
3558
|
+
}
|
|
3559
|
+
|
|
3537
3560
|
declare module 'alinea/core/source/FSSource' {
|
|
3538
3561
|
|
|
3539
3562
|
import type { ChangesBatch } from 'alinea/core/source/Change';
|
|
@@ -3565,6 +3588,27 @@ declare module 'alinea/core/source/FSSource.test' {
|
|
|
3565
3588
|
|
|
3566
3589
|
}
|
|
3567
3590
|
|
|
3591
|
+
declare module 'alinea/core/source/GitDelta' {
|
|
3592
|
+
|
|
3593
|
+
/**
|
|
3594
|
+
* Creates Git-compatible delta data (the payload format used by OBJ_REF_DELTA
|
|
3595
|
+
* and OBJ_OFS_DELTA entries in pack files).
|
|
3596
|
+
*/
|
|
3597
|
+
export function createGitDelta(base: Uint8Array, target: Uint8Array): Uint8Array;
|
|
3598
|
+
/**
|
|
3599
|
+
* Applies Git delta data onto a base object and returns the reconstructed
|
|
3600
|
+
* target object bytes.
|
|
3601
|
+
*/
|
|
3602
|
+
export function applyGitDelta(base: Uint8Array, delta: Uint8Array): Uint8Array;
|
|
3603
|
+
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
declare module 'alinea/core/source/GitDelta.test' {
|
|
3607
|
+
|
|
3608
|
+
export {};
|
|
3609
|
+
|
|
3610
|
+
}
|
|
3611
|
+
|
|
3568
3612
|
declare module 'alinea/core/source/GithubSource' {
|
|
3569
3613
|
|
|
3570
3614
|
import type { ChangesBatch } from 'alinea/core/source/Change';
|
|
@@ -3836,6 +3880,10 @@ declare module 'alinea/core/source/Tree.test' {
|
|
|
3836
3880
|
|
|
3837
3881
|
declare module 'alinea/core/source/Utils' {
|
|
3838
3882
|
|
|
3883
|
+
/**
|
|
3884
|
+
* Computes the SHA-1 hash bytes of the input data.
|
|
3885
|
+
*/
|
|
3886
|
+
export function sha1Bytes(data: Uint8Array): Promise<Uint8Array>;
|
|
3839
3887
|
/**
|
|
3840
3888
|
* Computes the SHA-1 hash of the input data.
|
|
3841
3889
|
*/
|
|
@@ -8233,6 +8281,12 @@ declare module 'alinea/preview/PreviewPayload' {
|
|
|
8233
8281
|
|
|
8234
8282
|
}
|
|
8235
8283
|
|
|
8284
|
+
declare module 'alinea/preview/PreviewPayload.test' {
|
|
8285
|
+
|
|
8286
|
+
export {};
|
|
8287
|
+
|
|
8288
|
+
}
|
|
8289
|
+
|
|
8236
8290
|
declare module 'alinea/preview/react' {
|
|
8237
8291
|
|
|
8238
8292
|
import { type PreviewApi } from 'alinea/preview/RegisterPreview';
|
|
@@ -21,7 +21,7 @@ var package_default = {
|
|
|
21
21
|
"cycles:browser": "CHECK_CYCLES=browser bun build.ts && bunx --bun madge --warning --circular dist/index.js dist/ui.js dist/dashboard/App.js",
|
|
22
22
|
type: "tsc --diagnostics",
|
|
23
23
|
"dev:check": "tsc -w",
|
|
24
|
-
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev",
|
|
24
|
+
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev -- bun run --cwd apps/dev dev",
|
|
25
25
|
"web:run": "bun build.ts --watch -- node dev.js -- bun run --cwd apps/web dev",
|
|
26
26
|
trace: "tsc --diagnostics --generateTrace private/trace && analyze-trace private/trace & speedscope private/trace/trace.json",
|
|
27
27
|
prepublishOnly: "bun run build"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var package_default = {
|
|
3
3
|
bin: "./dist/cli.js",
|
|
4
4
|
name: "alinea",
|
|
5
|
-
version: "1.6.
|
|
5
|
+
version: "1.6.4",
|
|
6
6
|
description: "Headless git-based CMS",
|
|
7
7
|
repository: {
|
|
8
8
|
type: "git",
|
|
@@ -21,7 +21,7 @@ var package_default = {
|
|
|
21
21
|
"cycles:browser": "CHECK_CYCLES=browser bun build.ts && bunx --bun madge --warning --circular dist/index.js dist/ui.js dist/dashboard/App.js",
|
|
22
22
|
type: "tsc --diagnostics",
|
|
23
23
|
"dev:check": "tsc -w",
|
|
24
|
-
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev",
|
|
24
|
+
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev -- bun run --cwd apps/dev dev",
|
|
25
25
|
"web:run": "bun build.ts --watch -- node dev.js -- bun run --cwd apps/web dev",
|
|
26
26
|
trace: "tsc --diagnostics --generateTrace private/trace && analyze-trace private/trace & speedscope private/trace/trace.json",
|
|
27
27
|
prepublishOnly: "bun run build"
|
package/dist/cli/Serve.js
CHANGED
package/dist/cli/bin.js
CHANGED
package/dist/core/Preview.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export declare class LinkResolver {
|
|
|
6
6
|
private locale;
|
|
7
7
|
constructor(resolver: EntryResolver, ctx: ResolveContext, locale: string | null);
|
|
8
8
|
includedAtBuild(filePath: string): boolean;
|
|
9
|
-
resolveLinks<P extends Projection>(projection: P, entryIds: ReadonlyArray<string>): Promise<Array<InferProjection<P
|
|
9
|
+
resolveLinks<P extends Projection>(projection: P, entryIds: ReadonlyArray<string>): Promise<Array<InferProjection<P>>>;
|
|
10
10
|
}
|
|
@@ -11,6 +11,7 @@ import "../../chunks/chunk-NZLE2WMY.js";
|
|
|
11
11
|
|
|
12
12
|
// src/core/shape/RichTextShape.ts
|
|
13
13
|
import { Entry } from "../Entry.js";
|
|
14
|
+
import { MediaFile } from "../media/MediaTypes.js";
|
|
14
15
|
import {
|
|
15
16
|
BlockNode,
|
|
16
17
|
ElementNode,
|
|
@@ -19,7 +20,6 @@ import {
|
|
|
19
20
|
Node,
|
|
20
21
|
TextNode
|
|
21
22
|
} from "../TextDoc.js";
|
|
22
|
-
import { MediaFile } from "../media/MediaTypes.js";
|
|
23
23
|
import { entries, fromEntries, keys } from "../util/Objects.js";
|
|
24
24
|
import { RecordShape } from "./RecordShape.js";
|
|
25
25
|
import { ScalarShape } from "./ScalarShape.js";
|
|
@@ -129,6 +129,7 @@ function unserialize(nodes) {
|
|
|
129
129
|
return result;
|
|
130
130
|
}
|
|
131
131
|
var linkInfoFields = {
|
|
132
|
+
id: Entry.id,
|
|
132
133
|
url: Entry.url,
|
|
133
134
|
location: MediaFile.location
|
|
134
135
|
};
|
|
@@ -375,7 +376,11 @@ var RichTextShape = class {
|
|
|
375
376
|
async function loadLinks() {
|
|
376
377
|
const linkIds = Array.from(new Set(links.values()));
|
|
377
378
|
const entries2 = await loader.resolveLinks(linkInfoFields, linkIds);
|
|
378
|
-
const info = new Map(
|
|
379
|
+
const info = new Map(
|
|
380
|
+
entries2.map((entry) => {
|
|
381
|
+
return [entry.id, entry];
|
|
382
|
+
})
|
|
383
|
+
);
|
|
379
384
|
for (const [mark, entryId] of links) {
|
|
380
385
|
const type = mark[LinkMark.link];
|
|
381
386
|
const data = info.get(entryId);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a Git-delta based patch for transforming `base` into `updated`.
|
|
3
|
+
* Format:
|
|
4
|
+
* - 20 bytes: SHA-1(base)
|
|
5
|
+
* - N bytes: Git delta payload
|
|
6
|
+
* - 20 bytes: SHA-1(updated)
|
|
7
|
+
*/
|
|
8
|
+
export declare function createFilePatch(base: string, updated: string): Promise<Uint8Array>;
|
|
9
|
+
/**
|
|
10
|
+
* Applies a patch created by `createFilePatch` and returns the updated string.
|
|
11
|
+
*/
|
|
12
|
+
export declare function applyFilePatch(base: string, patch: Uint8Array): Promise<string>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "../../chunks/chunk-NZLE2WMY.js";
|
|
2
|
+
|
|
3
|
+
// src/core/source/FilePatch.ts
|
|
4
|
+
import { assert } from "../util/Assert.js";
|
|
5
|
+
import { applyGitDelta, createGitDelta } from "./GitDelta.js";
|
|
6
|
+
import { sha1Bytes as computeSha1Bytes } from "./Utils.js";
|
|
7
|
+
var encoder = new TextEncoder();
|
|
8
|
+
var decoder = new TextDecoder();
|
|
9
|
+
var HASH_BYTES = 20;
|
|
10
|
+
async function createFilePatch(base, updated) {
|
|
11
|
+
const baseBytes = encoder.encode(base);
|
|
12
|
+
const updatedBytes = encoder.encode(updated);
|
|
13
|
+
const delta = createGitDelta(baseBytes, updatedBytes);
|
|
14
|
+
const [baseHash, updatedHash] = await Promise.all([
|
|
15
|
+
computeSha1Bytes(baseBytes),
|
|
16
|
+
computeSha1Bytes(updatedBytes)
|
|
17
|
+
]);
|
|
18
|
+
const out = new Uint8Array(HASH_BYTES + delta.length + HASH_BYTES);
|
|
19
|
+
out.set(baseHash, 0);
|
|
20
|
+
out.set(delta, HASH_BYTES);
|
|
21
|
+
out.set(updatedHash, HASH_BYTES + delta.length);
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
async function applyFilePatch(base, patch) {
|
|
25
|
+
assert(patch.length >= HASH_BYTES * 2, "Invalid patch: too small");
|
|
26
|
+
const baseBytes = encoder.encode(base);
|
|
27
|
+
const expectedBaseHash = patch.subarray(0, HASH_BYTES);
|
|
28
|
+
const actualBaseHash = await computeSha1Bytes(baseBytes);
|
|
29
|
+
assert(bytesEqual(expectedBaseHash, actualBaseHash), "Patch does not match base");
|
|
30
|
+
const delta = patch.subarray(HASH_BYTES, patch.length - HASH_BYTES);
|
|
31
|
+
const result = applyGitDelta(baseBytes, delta);
|
|
32
|
+
const expectedHash = patch.subarray(patch.length - HASH_BYTES);
|
|
33
|
+
const actualHash = await computeSha1Bytes(result);
|
|
34
|
+
assert(bytesEqual(actualHash, expectedHash), "Patched content hash mismatch");
|
|
35
|
+
return decoder.decode(result);
|
|
36
|
+
}
|
|
37
|
+
function bytesEqual(a, b) {
|
|
38
|
+
if (a.length !== b.length) return false;
|
|
39
|
+
for (let i = 0; i < a.length; i++) {
|
|
40
|
+
if (a[i] !== b[i]) return false;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
applyFilePatch,
|
|
46
|
+
createFilePatch
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates Git-compatible delta data (the payload format used by OBJ_REF_DELTA
|
|
3
|
+
* and OBJ_OFS_DELTA entries in pack files).
|
|
4
|
+
*/
|
|
5
|
+
export declare function createGitDelta(base: Uint8Array, target: Uint8Array): Uint8Array;
|
|
6
|
+
/**
|
|
7
|
+
* Applies Git delta data onto a base object and returns the reconstructed
|
|
8
|
+
* target object bytes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyGitDelta(base: Uint8Array, delta: Uint8Array): Uint8Array;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import "../../chunks/chunk-NZLE2WMY.js";
|
|
2
|
+
|
|
3
|
+
// src/core/source/GitDelta.ts
|
|
4
|
+
import { assert } from "../util/Assert.js";
|
|
5
|
+
var MIN_MATCH = 4;
|
|
6
|
+
var MAX_LITERAL = 127;
|
|
7
|
+
var MAX_COPY_SIZE = 16777215;
|
|
8
|
+
function createGitDelta(base, target) {
|
|
9
|
+
const out = [];
|
|
10
|
+
writeVarInt(base.length, out);
|
|
11
|
+
writeVarInt(target.length, out);
|
|
12
|
+
const index = buildBaseIndex(base);
|
|
13
|
+
const literals = [];
|
|
14
|
+
let i = 0;
|
|
15
|
+
while (i < target.length) {
|
|
16
|
+
const best = findBestMatch(base, target, i, index);
|
|
17
|
+
if (!best || best.length < MIN_MATCH) {
|
|
18
|
+
literals.push(target[i]);
|
|
19
|
+
i++;
|
|
20
|
+
if (literals.length === MAX_LITERAL) flushLiterals(literals, out);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
flushLiterals(literals, out);
|
|
24
|
+
let remaining = best.length;
|
|
25
|
+
let copyOffset = best.offset;
|
|
26
|
+
while (remaining > 0) {
|
|
27
|
+
const chunkSize = Math.min(remaining, MAX_COPY_SIZE);
|
|
28
|
+
writeCopyInstruction(copyOffset, chunkSize, out);
|
|
29
|
+
copyOffset += chunkSize;
|
|
30
|
+
remaining -= chunkSize;
|
|
31
|
+
}
|
|
32
|
+
i += best.length;
|
|
33
|
+
}
|
|
34
|
+
flushLiterals(literals, out);
|
|
35
|
+
return Uint8Array.from(out);
|
|
36
|
+
}
|
|
37
|
+
function applyGitDelta(base, delta) {
|
|
38
|
+
let pos = 0;
|
|
39
|
+
const [baseSize, baseSizePos] = readVarInt(delta, pos);
|
|
40
|
+
pos = baseSizePos;
|
|
41
|
+
const [resultSize, resultSizePos] = readVarInt(delta, pos);
|
|
42
|
+
pos = resultSizePos;
|
|
43
|
+
assert(baseSize === base.length, "Git delta base size mismatch");
|
|
44
|
+
const result = new Uint8Array(resultSize);
|
|
45
|
+
let outPos = 0;
|
|
46
|
+
while (pos < delta.length) {
|
|
47
|
+
const opcode = delta[pos++];
|
|
48
|
+
if (opcode & 128) {
|
|
49
|
+
let offset = 0;
|
|
50
|
+
let size = 0;
|
|
51
|
+
if (opcode & 1) offset |= delta[pos++];
|
|
52
|
+
if (opcode & 2) offset |= delta[pos++] << 8;
|
|
53
|
+
if (opcode & 4) offset |= delta[pos++] << 16;
|
|
54
|
+
if (opcode & 8) offset |= delta[pos++] << 24;
|
|
55
|
+
if (opcode & 16) size |= delta[pos++];
|
|
56
|
+
if (opcode & 32) size |= delta[pos++] << 8;
|
|
57
|
+
if (opcode & 64) size |= delta[pos++] << 16;
|
|
58
|
+
if (size === 0) size = 65536;
|
|
59
|
+
assert(offset >= 0 && offset + size <= base.length, "Invalid delta copy");
|
|
60
|
+
assert(outPos + size <= result.length, "Delta expands beyond target size");
|
|
61
|
+
result.set(base.subarray(offset, offset + size), outPos);
|
|
62
|
+
outPos += size;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
assert(opcode !== 0, "Invalid delta opcode 0");
|
|
66
|
+
assert(pos + opcode <= delta.length, "Invalid delta insert");
|
|
67
|
+
assert(outPos + opcode <= result.length, "Delta expands beyond target size");
|
|
68
|
+
result.set(delta.subarray(pos, pos + opcode), outPos);
|
|
69
|
+
pos += opcode;
|
|
70
|
+
outPos += opcode;
|
|
71
|
+
}
|
|
72
|
+
assert(outPos === result.length, "Delta result size mismatch");
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
function writeVarInt(value, out) {
|
|
76
|
+
let n = value >>> 0;
|
|
77
|
+
while (true) {
|
|
78
|
+
let byte = n & 127;
|
|
79
|
+
n >>>= 7;
|
|
80
|
+
if (n !== 0) byte |= 128;
|
|
81
|
+
out.push(byte);
|
|
82
|
+
if (n === 0) break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function readVarInt(data, start) {
|
|
86
|
+
let shift = 0;
|
|
87
|
+
let value = 0;
|
|
88
|
+
let pos = start;
|
|
89
|
+
while (true) {
|
|
90
|
+
assert(pos < data.length, "Invalid varint");
|
|
91
|
+
const byte = data[pos++];
|
|
92
|
+
value |= (byte & 127) << shift;
|
|
93
|
+
if ((byte & 128) === 0) break;
|
|
94
|
+
shift += 7;
|
|
95
|
+
assert(shift <= 28, "Varint too large");
|
|
96
|
+
}
|
|
97
|
+
return [value >>> 0, pos];
|
|
98
|
+
}
|
|
99
|
+
function flushLiterals(literals, out) {
|
|
100
|
+
if (literals.length === 0) return;
|
|
101
|
+
let pos = 0;
|
|
102
|
+
while (pos < literals.length) {
|
|
103
|
+
const chunk = Math.min(MAX_LITERAL, literals.length - pos);
|
|
104
|
+
out.push(chunk);
|
|
105
|
+
for (let i = 0; i < chunk; i++) out.push(literals[pos + i]);
|
|
106
|
+
pos += chunk;
|
|
107
|
+
}
|
|
108
|
+
literals.length = 0;
|
|
109
|
+
}
|
|
110
|
+
function writeCopyInstruction(offset, size, out) {
|
|
111
|
+
assert(size > 0, "Invalid copy size");
|
|
112
|
+
let opcode = 128;
|
|
113
|
+
const params = [];
|
|
114
|
+
const offset0 = offset & 255;
|
|
115
|
+
const offset1 = offset >>> 8 & 255;
|
|
116
|
+
const offset2 = offset >>> 16 & 255;
|
|
117
|
+
const offset3 = offset >>> 24 & 255;
|
|
118
|
+
if (offset0 !== 0) {
|
|
119
|
+
opcode |= 1;
|
|
120
|
+
params.push(offset0);
|
|
121
|
+
}
|
|
122
|
+
if (offset1 !== 0) {
|
|
123
|
+
opcode |= 2;
|
|
124
|
+
params.push(offset1);
|
|
125
|
+
}
|
|
126
|
+
if (offset2 !== 0) {
|
|
127
|
+
opcode |= 4;
|
|
128
|
+
params.push(offset2);
|
|
129
|
+
}
|
|
130
|
+
if (offset3 !== 0) {
|
|
131
|
+
opcode |= 8;
|
|
132
|
+
params.push(offset3);
|
|
133
|
+
}
|
|
134
|
+
const size0 = size & 255;
|
|
135
|
+
const size1 = size >>> 8 & 255;
|
|
136
|
+
const size2 = size >>> 16 & 255;
|
|
137
|
+
if (size !== 65536) {
|
|
138
|
+
if (size0 !== 0) {
|
|
139
|
+
opcode |= 16;
|
|
140
|
+
params.push(size0);
|
|
141
|
+
}
|
|
142
|
+
if (size1 !== 0) {
|
|
143
|
+
opcode |= 32;
|
|
144
|
+
params.push(size1);
|
|
145
|
+
}
|
|
146
|
+
if (size2 !== 0) {
|
|
147
|
+
opcode |= 64;
|
|
148
|
+
params.push(size2);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
out.push(opcode);
|
|
152
|
+
for (const byte of params) out.push(byte);
|
|
153
|
+
}
|
|
154
|
+
function buildBaseIndex(base) {
|
|
155
|
+
const index = /* @__PURE__ */ new Map();
|
|
156
|
+
for (let i = 0; i + MIN_MATCH <= base.length; i++) {
|
|
157
|
+
const key = key4(base, i);
|
|
158
|
+
const list = index.get(key);
|
|
159
|
+
if (list) {
|
|
160
|
+
if (list.length >= 64) list.shift();
|
|
161
|
+
list.push(i);
|
|
162
|
+
} else {
|
|
163
|
+
index.set(key, [i]);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return index;
|
|
167
|
+
}
|
|
168
|
+
function findBestMatch(base, target, targetPos, index) {
|
|
169
|
+
if (targetPos + MIN_MATCH > target.length) return void 0;
|
|
170
|
+
const key = key4(target, targetPos);
|
|
171
|
+
const candidates = index.get(key);
|
|
172
|
+
if (!candidates || candidates.length === 0) return void 0;
|
|
173
|
+
let bestOffset = 0;
|
|
174
|
+
let bestLength = 0;
|
|
175
|
+
for (let i = candidates.length - 1; i >= 0; i--) {
|
|
176
|
+
const basePos = candidates[i];
|
|
177
|
+
let length = 0;
|
|
178
|
+
while (basePos + length < base.length && targetPos + length < target.length && base[basePos + length] === target[targetPos + length]) {
|
|
179
|
+
length++;
|
|
180
|
+
}
|
|
181
|
+
if (length > bestLength) {
|
|
182
|
+
bestLength = length;
|
|
183
|
+
bestOffset = basePos;
|
|
184
|
+
if (bestLength >= MAX_COPY_SIZE) break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (bestLength < MIN_MATCH) return void 0;
|
|
188
|
+
return { offset: bestOffset, length: bestLength };
|
|
189
|
+
}
|
|
190
|
+
function key4(data, pos) {
|
|
191
|
+
return data[pos] << 24 | data[pos + 1] << 16 | data[pos + 2] << 8 | data[pos + 3];
|
|
192
|
+
}
|
|
193
|
+
export {
|
|
194
|
+
applyGitDelta,
|
|
195
|
+
createGitDelta
|
|
196
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,10 +2,12 @@ import "../../chunks/chunk-NZLE2WMY.js";
|
|
|
2
2
|
|
|
3
3
|
// src/core/source/Utils.ts
|
|
4
4
|
import { crypto } from "@alinea/iso";
|
|
5
|
-
async function
|
|
5
|
+
async function sha1Bytes(data) {
|
|
6
6
|
const hashBuffer = await crypto.subtle.digest("SHA-1", data);
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
return new Uint8Array(hashBuffer);
|
|
8
|
+
}
|
|
9
|
+
async function sha1Hash(data) {
|
|
10
|
+
return bytesToHex(await sha1Bytes(data));
|
|
9
11
|
}
|
|
10
12
|
function concatUint8Arrays(arrays) {
|
|
11
13
|
const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
|
|
@@ -49,6 +51,7 @@ export {
|
|
|
49
51
|
compareStrings,
|
|
50
52
|
concatUint8Arrays,
|
|
51
53
|
hexToBytes,
|
|
54
|
+
sha1Bytes,
|
|
52
55
|
sha1Hash,
|
|
53
56
|
splitPath
|
|
54
57
|
};
|
|
@@ -10,9 +10,11 @@ import "../../chunks/chunk-NZLE2WMY.js";
|
|
|
10
10
|
// src/dashboard/atoms/EntryEditorAtoms.ts
|
|
11
11
|
import { createYDoc, DOC_KEY, parseYDoc } from "alinea/core/Doc";
|
|
12
12
|
import { Entry } from "alinea/core/Entry";
|
|
13
|
+
import { createRecord } from "alinea/core/EntryRecord";
|
|
13
14
|
import { Field } from "alinea/core/Field";
|
|
14
15
|
import { createId } from "alinea/core/Id";
|
|
15
16
|
import { getType } from "alinea/core/Internal";
|
|
17
|
+
import { createFilePatch } from "alinea/core/source/FilePatch";
|
|
16
18
|
import { Root } from "alinea/core/Root";
|
|
17
19
|
import { Type } from "alinea/core/Type";
|
|
18
20
|
import {
|
|
@@ -25,6 +27,7 @@ import { createEntryRow } from "alinea/core/util/EntryRows";
|
|
|
25
27
|
import { entries, fromEntries } from "alinea/core/util/Objects";
|
|
26
28
|
import * as paths from "alinea/core/util/Paths";
|
|
27
29
|
import { Workspace } from "alinea/core/Workspace";
|
|
30
|
+
import { JsonLoader } from "alinea/backend/loader/JsonLoader";
|
|
28
31
|
import { FormAtoms } from "alinea/dashboard/atoms/FormAtoms";
|
|
29
32
|
import { keepPreviousData } from "alinea/dashboard/util/KeepPreviousData";
|
|
30
33
|
import { encodePreviewPayload } from "alinea/preview/PreviewPayload";
|
|
@@ -35,6 +38,7 @@ import { entryEditsAtoms } from "./Edits.js";
|
|
|
35
38
|
import { errorAtom } from "./ErrorAtoms.js";
|
|
36
39
|
import { locationAtom } from "./LocationAtoms.js";
|
|
37
40
|
import { yAtom } from "./YAtom.js";
|
|
41
|
+
var decoder = new TextDecoder();
|
|
38
42
|
var EditMode = /* @__PURE__ */ ((EditMode2) => {
|
|
39
43
|
EditMode2["Editing"] = "editing";
|
|
40
44
|
EditMode2["Diff"] = "diff";
|
|
@@ -542,14 +546,27 @@ function createEntryEditor(entryData) {
|
|
|
542
546
|
const yUpdate = debounceAtom(edits.yUpdate, 250);
|
|
543
547
|
const previewPayload = atom(async (get) => {
|
|
544
548
|
const sha = await get(dbMetaAtom);
|
|
545
|
-
|
|
549
|
+
get(yUpdate);
|
|
546
550
|
const status = get(selectedStatus);
|
|
551
|
+
const baseText = decoder.decode(
|
|
552
|
+
JsonLoader.format(
|
|
553
|
+
config.schema,
|
|
554
|
+
createRecord(activeVersion, activeVersion.status)
|
|
555
|
+
)
|
|
556
|
+
);
|
|
557
|
+
const updated = await getDraftEntry({ status });
|
|
558
|
+
const patch = await createFilePatch(
|
|
559
|
+
baseText,
|
|
560
|
+
decoder.decode(
|
|
561
|
+
JsonLoader.format(config.schema, createRecord(updated, status))
|
|
562
|
+
)
|
|
563
|
+
);
|
|
547
564
|
return encodePreviewPayload({
|
|
548
565
|
locale: activeVersion.locale,
|
|
549
566
|
entryId: activeVersion.id,
|
|
550
567
|
contentHash: sha,
|
|
551
568
|
status,
|
|
552
|
-
|
|
569
|
+
patch
|
|
553
570
|
});
|
|
554
571
|
});
|
|
555
572
|
const discardEdits = edits.resetChanges;
|
|
@@ -17,7 +17,7 @@ function encodePreviewPayload(update) {
|
|
|
17
17
|
writeVarString(encoder, update.entryId);
|
|
18
18
|
writeVarString(encoder, update.contentHash);
|
|
19
19
|
writeVarString(encoder, update.status);
|
|
20
|
-
writeVarUint8Array(encoder, update.
|
|
20
|
+
writeVarUint8Array(encoder, update.patch);
|
|
21
21
|
return encode(toUint8Array(encoder));
|
|
22
22
|
}
|
|
23
23
|
async function decodePreviewPayload(payload) {
|
|
@@ -27,7 +27,7 @@ async function decodePreviewPayload(payload) {
|
|
|
27
27
|
entryId: readVarString(decoder),
|
|
28
28
|
contentHash: readVarString(decoder),
|
|
29
29
|
status: readVarString(decoder),
|
|
30
|
-
|
|
30
|
+
patch: readVarUint8Array(decoder)
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bin": "./dist/cli.js",
|
|
3
3
|
"name": "alinea",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.4",
|
|
5
5
|
"description": "Headless git-based CMS",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"cycles:browser": "CHECK_CYCLES=browser bun build.ts && bunx --bun madge --warning --circular dist/index.js dist/ui.js dist/dashboard/App.js",
|
|
21
21
|
"type": "tsc --diagnostics",
|
|
22
22
|
"dev:check": "tsc -w",
|
|
23
|
-
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev",
|
|
23
|
+
"dev:run": "bun build.ts --watch -- node dev.js --dir apps/dev -- bun run --cwd apps/dev dev",
|
|
24
24
|
"web:run": "bun build.ts --watch -- node dev.js -- bun run --cwd apps/web dev",
|
|
25
25
|
"trace": "tsc --diagnostics --generateTrace private/trace && analyze-trace private/trace & speedscope private/trace/trace.json",
|
|
26
26
|
"prepublishOnly": "bun run build"
|