alinea 2.0.0-preview.4 → 2.0.0-preview.5

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 (164) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/.init/src/cms.ts +1 -4
  3. package/dist/LICENSES.md +107 -107
  4. package/dist/adapter/next/cms.js +5 -1
  5. package/dist/adapter/next/handler.js +35 -6
  6. package/dist/adapter/next/previews.js +7 -1
  7. package/dist/adapter/next/syncCheck.d.ts +12 -0
  8. package/dist/adapter/next/syncCheck.js +59 -0
  9. package/dist/adapter/next/with-alinea.d.ts +0 -8
  10. package/dist/adapter/next/with-alinea.js +43 -19
  11. package/dist/adapter/vite/plugin.js +9 -4
  12. package/dist/backend/Handler.js +106 -0
  13. package/dist/backend/api/ProxyMedia.d.ts +3 -0
  14. package/dist/backend/api/ProxyMedia.js +39 -0
  15. package/dist/backend/api/S3Uploads.d.ts +1 -1
  16. package/dist/backend/router/Router.js +2 -0
  17. package/dist/backend/util/Syncable.js +1 -1
  18. package/dist/bundled.d.ts +164 -70
  19. package/dist/chunks/{chunk-XMOVGDFI.js → chunk-A6M3PNJT.js} +1 -1
  20. package/dist/cli/Generate.js +1 -3
  21. package/dist/cli/Serve.js +3 -2
  22. package/dist/cli/bin.js +1 -1
  23. package/dist/cli/generate/GenerateDashboard.js +1 -0
  24. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  25. package/dist/cli/serve/CreateLocalServer.js +42 -34
  26. package/dist/cli/static/init/cms.js +1 -4
  27. package/dist/cli/util/ContentType.d.ts +1 -0
  28. package/dist/cli/util/ContentType.js +36 -0
  29. package/dist/cloud/CloudHandshake.d.ts +6 -0
  30. package/dist/cloud/CloudHandshake.js +67 -10
  31. package/dist/cloud/CloudRemote.js +24 -11
  32. package/dist/components/Calendar.js +4 -4
  33. package/dist/components/Checkbox.js +3 -3
  34. package/dist/components/ColorSwatchPicker.js +2 -2
  35. package/dist/components/ComboBox.js +9 -9
  36. package/dist/components/DateField.js +4 -4
  37. package/dist/components/DatePicker.js +3 -3
  38. package/dist/components/DateRangePicker.js +8 -8
  39. package/dist/components/Disclosure.js +7 -7
  40. package/dist/components/Label.js +4 -4
  41. package/dist/components/List.d.ts +1 -1
  42. package/dist/components/List.js +35 -34
  43. package/dist/components/Menu.js +4 -4
  44. package/dist/components/Modal.js +2 -2
  45. package/dist/components/MultipleSelect.js +23 -23
  46. package/dist/components/NumberField.js +6 -6
  47. package/dist/components/ProgressCircle.js +1 -1
  48. package/dist/components/SearchField.js +7 -7
  49. package/dist/components/Select.js +9 -9
  50. package/dist/components/Surface.js +2 -2
  51. package/dist/components/Table.js +7 -7
  52. package/dist/components/Tabs.js +2 -2
  53. package/dist/components/TagGroup.js +2 -2
  54. package/dist/components/TextField.js +6 -6
  55. package/dist/components/TimeField.js +3 -3
  56. package/dist/components/Toggle.js +2 -2
  57. package/dist/components/Toolbar.js +2 -2
  58. package/dist/components/Tooltip.js +2 -2
  59. package/dist/components/Tree.js +6 -6
  60. package/dist/core/Config.d.ts +10 -3
  61. package/dist/core/Config.js +16 -1
  62. package/dist/core/Graph.d.ts +2 -2
  63. package/dist/core/Role.js +16 -14
  64. package/dist/core/TextDoc.d.ts +2 -0
  65. package/dist/core/TextDoc.js +1 -0
  66. package/dist/core/Workspace.d.ts +6 -5
  67. package/dist/core/db/EntryIndex.d.ts +3 -0
  68. package/dist/core/db/EntryIndex.js +62 -0
  69. package/dist/core/db/EntryTransaction.js +33 -12
  70. package/dist/core/db/EntryUrlConflictError.js +1 -1
  71. package/dist/core/db/LinkResolver.d.ts +8 -2
  72. package/dist/core/db/LinkResolver.js +27 -5
  73. package/dist/core/field/RichTextField.js +16 -10
  74. package/dist/core/media/MediaLocation.d.ts +9 -15
  75. package/dist/core/media/MediaLocation.js +29 -19
  76. package/dist/core/media/MediaTypes.js +1 -2
  77. package/dist/dashboard/App.js +1 -1
  78. package/dist/dashboard/app/AccessDenied.js +2 -2
  79. package/dist/dashboard/app/ActivityStatus.js +14 -13
  80. package/dist/dashboard/app/AppShell.js +1 -1
  81. package/dist/dashboard/app/AuthView.js +9 -9
  82. package/dist/dashboard/app/Badge.js +2 -2
  83. package/dist/dashboard/app/CompactField.js +13 -13
  84. package/dist/dashboard/app/DashboardErrorBoundary.js +4 -4
  85. package/dist/dashboard/app/EntryFields.d.ts +3 -1
  86. package/dist/dashboard/app/EntryFields.js +11 -8
  87. package/dist/dashboard/app/EntryHeader.js +117 -85
  88. package/dist/dashboard/app/EntryHeaderActions.d.ts +21 -4
  89. package/dist/dashboard/app/EntryHeaderActions.js +48 -27
  90. package/dist/dashboard/app/EntryReferences.js +9 -9
  91. package/dist/dashboard/app/EntrySidebar.js +12 -12
  92. package/dist/dashboard/app/EntrySidebarPreview.js +11 -11
  93. package/dist/dashboard/app/EntryTranslationBanner.d.ts +3 -1
  94. package/dist/dashboard/app/EntryTranslationBanner.js +24 -21
  95. package/dist/dashboard/app/Explorer.d.ts +4 -2
  96. package/dist/dashboard/app/Explorer.js +50 -46
  97. package/dist/dashboard/app/ExplorerCards.js +28 -28
  98. package/dist/dashboard/app/ExplorerFileCard.js +19 -19
  99. package/dist/dashboard/app/ExplorerList.js +12 -13
  100. package/dist/dashboard/app/ExplorerModal.js +5 -5
  101. package/dist/dashboard/app/ExplorerTable.js +46 -46
  102. package/dist/dashboard/app/LinkPicker.js +5 -5
  103. package/dist/dashboard/app/LocaleMenu.d.ts +7 -0
  104. package/dist/dashboard/app/LocaleMenu.js +26 -10
  105. package/dist/dashboard/app/ReadOnlyBadge.d.ts +4 -0
  106. package/dist/dashboard/app/ReadOnlyBadge.js +33 -0
  107. package/dist/dashboard/app/SidebarTree.d.ts +3 -6
  108. package/dist/dashboard/app/SidebarTree.js +54 -49
  109. package/dist/dashboard/app/WorkspaceMenu.js +12 -12
  110. package/dist/dashboard/app/WorkspaceRoots.js +24 -24
  111. package/dist/dashboard/app/editor/FileEditor.d.ts +2 -3
  112. package/dist/dashboard/app/editor/FileEditor.js +31 -34
  113. package/dist/dashboard/app/editor/FilePreview.js +6 -6
  114. package/dist/dashboard/app/modals/CreateEntry.js +5 -5
  115. package/dist/dashboard/app/pages/EntryPage.js +73 -30
  116. package/dist/dashboard/app/pages/SplashPage.js +47 -47
  117. package/dist/dashboard/app/pages/UsersPage.js +34 -34
  118. package/dist/dashboard/app/ui/DashboardModal.js +18 -18
  119. package/dist/dashboard/app/ui/Rail.js +3 -3
  120. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  121. package/dist/dashboard/atoms/activity.d.ts +0 -1
  122. package/dist/dashboard/atoms/activity.js +1 -2
  123. package/dist/dashboard/atoms/editor.d.ts +2 -1
  124. package/dist/dashboard/atoms/editor.js +4 -2
  125. package/dist/dashboard/atoms/entry.d.ts +2 -0
  126. package/dist/dashboard/atoms/entry.js +32 -14
  127. package/dist/dashboard/atoms/explorer.d.ts +4 -3
  128. package/dist/dashboard/atoms/explorer.js +61 -22
  129. package/dist/dashboard/atoms/link.d.ts +1 -1
  130. package/dist/dashboard/atoms/link.js +39 -55
  131. package/dist/dashboard/atoms/root.d.ts +7 -2
  132. package/dist/dashboard/atoms/root.js +51 -16
  133. package/dist/dashboard/atoms/upload.d.ts +1 -0
  134. package/dist/dashboard/atoms/upload.js +2 -1
  135. package/dist/dashboard/boot/DashboardWorker.js +1 -0
  136. package/dist/dashboard/fixture/cms.js +1 -4
  137. package/dist/dashboard/hook/UseSaveShortcut.d.ts +1 -0
  138. package/dist/dashboard/hook/UseSaveShortcut.js +24 -0
  139. package/dist/dashboard/hooks.d.ts +1 -1
  140. package/dist/dashboard/hooks.js +12 -3
  141. package/dist/field/code/CodeField.view.js +9 -9
  142. package/dist/field/link/ImageLink.js +1 -3
  143. package/dist/field/link/LinkField.view.js +84 -58
  144. package/dist/field/list/ListField.view.js +13 -13
  145. package/dist/field/metadata/MetadataField.d.ts +3 -3
  146. package/dist/field/metadata/MetadataField.view.js +24 -17
  147. package/dist/field/object/ObjectField.view.js +11 -4
  148. package/dist/field/richtext/PickTextLink.js +5 -2
  149. package/dist/field/richtext/ReferenceLink.d.ts +2 -0
  150. package/dist/field/richtext/ReferenceLink.js +5 -0
  151. package/dist/field/richtext/RichTextBlock.js +2 -2
  152. package/dist/field/richtext/RichTextExtensions.js +22 -22
  153. package/dist/field/richtext/RichTextField.view.js +4 -4
  154. package/dist/field/richtext/extensions/Link.d.ts +1 -0
  155. package/dist/field/richtext/extensions/Link.js +1 -0
  156. package/dist/field/time/TimeField.d.ts +0 -2
  157. package/dist/field/time/TimeField.view.js +1 -1
  158. package/dist/index.css +44 -38
  159. package/dist/next.cjs +96 -19
  160. package/dist/picker/entry/EntryPicker.js +10 -12
  161. package/dist/picker/entry/EntryReference.d.ts +2 -0
  162. package/dist/picker/entry/EntryReference.js +1 -0
  163. package/dist/types.d.ts +0 -1
  164. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  {
2
- "_id": "3JJbJ2F3Dep25BJMlZoVBBFy25h",
2
+ "_id": "3JSRaU6nbvzZquWO5cyuADRWGRm",
3
3
  "_type": "Page",
4
4
  "_index": "a0",
5
5
  "_seeded": "welcome.json",
@@ -17,7 +17,6 @@ export const cms = createCMS({
17
17
  main: Config.workspace('Example', {
18
18
  source: 'content',
19
19
  mediaDir: 'public/media',
20
- mediaUrl: '/media',
21
20
  roots: {
22
21
  pages: Config.root('Example site', {
23
22
  contains: ['Page']
@@ -39,7 +38,5 @@ export const cms = createCMS({
39
38
 
40
39
  // The handler route URL
41
40
  handlerUrl: '/api/cms',
42
-
43
- // The admin dashboard will be bundled in this static file
44
- dashboardFile: 'admin.html'
41
+ adminPath: '/admin'
45
42
  })
package/dist/LICENSES.md CHANGED
@@ -55,7 +55,7 @@ SOFTWARE.
55
55
 
56
56
  ===
57
57
 
58
- # @internationalized/date@3.12.1 (Apache-2.0)
58
+ # react-aria-components@1.17.0 (Apache-2.0)
59
59
 
60
60
  Apache License
61
61
  Version 2.0, January 2004
@@ -262,11 +262,11 @@ SOFTWARE.
262
262
 
263
263
  ===
264
264
 
265
- # jotai-family@1.1.0 (MIT)
265
+ # microcbor@1.2.1 (MIT)
266
266
 
267
267
  MIT License
268
268
 
269
- Copyright (c) 2025 Poimandres
269
+ Copyright (c) 2021 Joel Gustafson
270
270
 
271
271
  Permission is hereby granted, free of charge, to any person obtaining a copy
272
272
  of this software and associated documentation files (the "Software"), to deal
@@ -287,6 +287,33 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
287
287
  SOFTWARE.
288
288
 
289
289
 
290
+ ===
291
+
292
+ # jotai-location@0.6.2 (MIT)
293
+
294
+ The MIT License (MIT)
295
+
296
+ Copyright (c) 2022 Daishi Kato
297
+
298
+ Permission is hereby granted, free of charge, to any person obtaining a copy
299
+ of this software and associated documentation files (the "Software"), to deal
300
+ in the Software without restriction, including without limitation the rights
301
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
302
+ copies of the Software, and to permit persons to whom the Software is
303
+ furnished to do so, subject to the following conditions:
304
+
305
+ The above copyright notice and this permission notice shall be included in
306
+ all copies or substantial portions of the Software.
307
+
308
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
309
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
310
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
311
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
312
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
313
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
314
+ THE SOFTWARE.
315
+
316
+
290
317
  ===
291
318
 
292
319
  # react-stately@3.46.0 (Apache-2.0)
@@ -496,61 +523,7 @@ SOFTWARE.
496
523
 
497
524
  ===
498
525
 
499
- # microcbor@1.2.1 (MIT)
500
-
501
- MIT License
502
-
503
- Copyright (c) 2021 Joel Gustafson
504
-
505
- Permission is hereby granted, free of charge, to any person obtaining a copy
506
- of this software and associated documentation files (the "Software"), to deal
507
- in the Software without restriction, including without limitation the rights
508
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
509
- copies of the Software, and to permit persons to whom the Software is
510
- furnished to do so, subject to the following conditions:
511
-
512
- The above copyright notice and this permission notice shall be included in all
513
- copies or substantial portions of the Software.
514
-
515
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
516
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
517
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
518
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
519
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
520
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
521
- SOFTWARE.
522
-
523
-
524
- ===
525
-
526
- # @tiptap/core@3.30.5 (MIT)
527
-
528
- MIT License
529
-
530
- Copyright (c) 2025, Tiptap GmbH
531
-
532
- Permission is hereby granted, free of charge, to any person obtaining a copy
533
- of this software and associated documentation files (the "Software"), to deal
534
- in the Software without restriction, including without limitation the rights
535
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
536
- copies of the Software, and to permit persons to whom the Software is
537
- furnished to do so, subject to the following conditions:
538
-
539
- The above copyright notice and this permission notice shall be included in all
540
- copies or substantial portions of the Software.
541
-
542
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
543
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
544
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
545
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
546
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
547
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
548
- SOFTWARE.
549
-
550
-
551
- ===
552
-
553
- # react-aria-components@1.17.0 (Apache-2.0)
526
+ # @internationalized/date@3.12.1 (Apache-2.0)
554
527
 
555
528
  Apache License
556
529
  Version 2.0, January 2004
@@ -757,11 +730,11 @@ SOFTWARE.
757
730
 
758
731
  ===
759
732
 
760
- # jotai-location@0.6.2 (MIT)
733
+ # jotai-family@1.1.0 (MIT)
761
734
 
762
- The MIT License (MIT)
735
+ MIT License
763
736
 
764
- Copyright (c) 2022 Daishi Kato
737
+ Copyright (c) 2025 Poimandres
765
738
 
766
739
  Permission is hereby granted, free of charge, to any person obtaining a copy
767
740
  of this software and associated documentation files (the "Software"), to deal
@@ -770,17 +743,67 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
770
743
  copies of the Software, and to permit persons to whom the Software is
771
744
  furnished to do so, subject to the following conditions:
772
745
 
773
- The above copyright notice and this permission notice shall be included in
774
- all copies or substantial portions of the Software.
746
+ The above copyright notice and this permission notice shall be included in all
747
+ copies or substantial portions of the Software.
775
748
 
776
749
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
777
750
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
778
751
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
779
752
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
780
753
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
781
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
782
- THE SOFTWARE.
754
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
755
+ SOFTWARE.
756
+
757
+
758
+ ===
759
+
760
+ # @tiptap/core@3.30.5 (MIT)
761
+
762
+ MIT License
763
+
764
+ Copyright (c) 2025, Tiptap GmbH
765
+
766
+ Permission is hereby granted, free of charge, to any person obtaining a copy
767
+ of this software and associated documentation files (the "Software"), to deal
768
+ in the Software without restriction, including without limitation the rights
769
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
770
+ copies of the Software, and to permit persons to whom the Software is
771
+ furnished to do so, subject to the following conditions:
772
+
773
+ The above copyright notice and this permission notice shall be included in all
774
+ copies or substantial portions of the Software.
775
+
776
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
777
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
778
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
779
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
780
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
781
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
782
+ SOFTWARE.
783
+
784
+
785
+ ===
786
+
787
+ # htmlparser2@9.1.0 (MIT)
783
788
 
789
+ Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
790
+ Permission is hereby granted, free of charge, to any person obtaining a copy
791
+ of this software and associated documentation files (the "Software"), to
792
+ deal in the Software without restriction, including without limitation the
793
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
794
+ sell copies of the Software, and to permit persons to whom the Software is
795
+ furnished to do so, subject to the following conditions:
796
+
797
+ The above copyright notice and this permission notice shall be included in
798
+ all copies or substantial portions of the Software.
799
+
800
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
801
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
802
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
803
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
804
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
805
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
806
+ IN THE SOFTWARE.
784
807
 
785
808
  ===
786
809
 
@@ -991,26 +1014,30 @@ THE SOFTWARE.
991
1014
 
992
1015
  ===
993
1016
 
994
- # htmlparser2@9.1.0 (MIT)
1017
+ # @tiptap/extension-list@3.30.5 (MIT)
1018
+
1019
+ MIT License
1020
+
1021
+ Copyright (c) 2025, Tiptap GmbH
995
1022
 
996
- Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
997
1023
  Permission is hereby granted, free of charge, to any person obtaining a copy
998
- of this software and associated documentation files (the "Software"), to
999
- deal in the Software without restriction, including without limitation the
1000
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1001
- sell copies of the Software, and to permit persons to whom the Software is
1024
+ of this software and associated documentation files (the "Software"), to deal
1025
+ in the Software without restriction, including without limitation the rights
1026
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1027
+ copies of the Software, and to permit persons to whom the Software is
1002
1028
  furnished to do so, subject to the following conditions:
1003
-
1004
- The above copyright notice and this permission notice shall be included in
1005
- all copies or substantial portions of the Software.
1006
-
1029
+
1030
+ The above copyright notice and this permission notice shall be included in all
1031
+ copies or substantial portions of the Software.
1032
+
1007
1033
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1008
1034
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1009
1035
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1010
1036
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1011
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1012
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1013
- IN THE SOFTWARE.
1037
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1038
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1039
+ SOFTWARE.
1040
+
1014
1041
 
1015
1042
  ===
1016
1043
 
@@ -1092,11 +1119,11 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1092
1119
 
1093
1120
  ===
1094
1121
 
1095
- # @tiptap/extension-list@3.30.5 (MIT)
1122
+ # use-sync-external-store@1.6.0 (MIT)
1096
1123
 
1097
1124
  MIT License
1098
1125
 
1099
- Copyright (c) 2025, Tiptap GmbH
1126
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1100
1127
 
1101
1128
  Permission is hereby granted, free of charge, to any person obtaining a copy
1102
1129
  of this software and associated documentation files (the "Software"), to deal
@@ -1144,33 +1171,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1144
1171
  SOFTWARE.
1145
1172
 
1146
1173
 
1147
- ===
1148
-
1149
- # use-sync-external-store@1.6.0 (MIT)
1150
-
1151
- MIT License
1152
-
1153
- Copyright (c) Meta Platforms, Inc. and affiliates.
1154
-
1155
- Permission is hereby granted, free of charge, to any person obtaining a copy
1156
- of this software and associated documentation files (the "Software"), to deal
1157
- in the Software without restriction, including without limitation the rights
1158
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1159
- copies of the Software, and to permit persons to whom the Software is
1160
- furnished to do so, subject to the following conditions:
1161
-
1162
- The above copyright notice and this permission notice shall be included in all
1163
- copies or substantial portions of the Software.
1164
-
1165
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1166
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1167
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1168
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1169
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1170
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1171
- SOFTWARE.
1172
-
1173
-
1174
1174
  ===
1175
1175
 
1176
1176
  # dom-serializer@2.0.0 (MIT)
@@ -19,6 +19,7 @@ import { getPreviewPayloadFromCookies } from "alinea/preview/PreviewCookies";
19
19
  import { Headers } from "@alinea/iso";
20
20
  import { cache } from "react";
21
21
  import { requestContext } from "./context.js";
22
+ import { syncIfStale } from "./syncCheck.js";
22
23
  import { jsx } from "react/jsx-runtime";
23
24
  var NextCMS = class extends CMS {
24
25
  constructor(config) {
@@ -92,7 +93,10 @@ var NextCMS = class extends CMS {
92
93
  const db = await this.bundledDb;
93
94
  const syncInterval = request.disableSync ? Number.POSITIVE_INFINITY : request.syncInterval ?? this.config.syncInterval;
94
95
  if (hasPreview) return db.resolve(request);
95
- if (!isBuild) await this.throttle(() => db.syncWith(client), syncInterval);
96
+ if (!isBuild) {
97
+ const settled = await syncIfStale(db, client, syncInterval);
98
+ if (!settled) await this.throttle(() => db.syncWith(client), syncInterval);
99
+ }
96
100
  return db.resolve(request);
97
101
  }
98
102
  async #authenticatedClient() {
@@ -19,6 +19,7 @@ import { trace } from "alinea/core/Trace";
19
19
  import { NextCMS } from "./cms.js";
20
20
  import { requestContext } from "./context.js";
21
21
  import { createDevRemote } from "./DevRemote.js";
22
+ import { revalidateContentSha } from "./syncCheck.js";
22
23
  function createHandler(input) {
23
24
  const options = input instanceof NextCMS ? { cms: input } : input;
24
25
  const config = options.cms.config;
@@ -36,18 +37,34 @@ function createHandler(input) {
36
37
  const handleBackend = createCoreHandler({
37
38
  ...options,
38
39
  remote,
39
- db
40
+ db,
41
+ // Revalidate the shared content sha before the user-provided hook so
42
+ // page revalidation triggered there already sees the fresh sha when
43
+ // RSC renders resolve. Invalidation never throws (failures are
44
+ // swallowed inside revalidateContentSha).
45
+ afterCommit: async (context) => {
46
+ await revalidateContentSha();
47
+ await options.afterCommit?.(context);
48
+ }
40
49
  });
41
50
  const handle = async (request) => {
42
51
  const url = new URL(request.url);
43
- const { searchParams } = url;
44
52
  const context = await requestContext(config, request);
45
53
  const handlerPath = handlerPathname(config, url);
46
- if (url.pathname !== handlerPath)
47
- return new Response(`Expected handler to be served on ${handlerPath}`, {
48
- status: 400
49
- });
54
+ const rewrittenFile = rewrittenFilePath(config, request);
50
55
  try {
56
+ if (rewrittenFile !== void 0) {
57
+ const backendUrl = new URL(url);
58
+ backendUrl.pathname = handlerPath;
59
+ backendUrl.searchParams.set("file", rewrittenFile);
60
+ backendUrl.searchParams.set("delivery", "proxy");
61
+ return await handleBackend(new Request(backendUrl, request), context);
62
+ }
63
+ if (url.pathname !== handlerPath)
64
+ return new Response(`Expected handler to be served on ${handlerPath}`, {
65
+ status: 400
66
+ });
67
+ const { searchParams } = url;
51
68
  const previews = new JWTPreviews(context.apiKey);
52
69
  const previewToken = searchParams.get("preview");
53
70
  if (previewToken) {
@@ -79,6 +96,18 @@ function createHandler(input) {
79
96
  function handlerPathname(config, requestUrl) {
80
97
  return new URL(Config.handlerUrl(config), requestUrl).pathname;
81
98
  }
99
+ function rewrittenFilePath(config, request) {
100
+ if (request.method !== "GET" && request.method !== "HEAD") return;
101
+ const url = new URL(request.url);
102
+ const fileRoot = new URL(Config.filePathname(config, ""), url).pathname;
103
+ const prefix = `${fileRoot}/`;
104
+ if (!url.pathname.startsWith(prefix)) return;
105
+ try {
106
+ return decodeURIComponent(url.pathname.slice(prefix.length));
107
+ } catch {
108
+ return;
109
+ }
110
+ }
82
111
  export {
83
112
  createHandler,
84
113
  handlerPathname
@@ -19,12 +19,18 @@ function NextPreviews({
19
19
  const [previewDisabled, setPreviewDisabled] = useState(false);
20
20
  const pathname = usePathname();
21
21
  const adminUrl = new URL(dashboardUrl, location.origin);
22
+ const host = window.parent !== window ? window.parent : window.opener;
23
+ let hostOrigin = adminUrl.origin;
24
+ try {
25
+ if (host?.location.origin === location.origin) hostOrigin = location.origin;
26
+ } catch {
27
+ }
22
28
  const entryParams = new URLSearchParams({ url: pathname });
23
29
  if (workspace) entryParams.set("workspace", workspace);
24
30
  if (root) entryParams.set("root", root);
25
31
  const editUrl = new URL(`#/edit?${entryParams}`, adminUrl);
26
32
  const { isPreviewing } = usePreview({
27
- hostOrigin: adminUrl.origin,
33
+ hostOrigin,
28
34
  async preview(update) {
29
35
  if (!update) return;
30
36
  const success = await setPreviewCookies(update.payload);
@@ -0,0 +1,12 @@
1
+ import type { Client } from 'alinea/core/Client';
2
+ import type { LocalDB } from 'alinea/core/db/LocalDB';
3
+ export declare const CONTENT_SHA_TAG = "alinea-content-sha";
4
+ export declare function revalidateContentSha(): Promise<void>;
5
+ /**
6
+ * Sync the isolate-local db only when it is behind the shared content sha.
7
+ * Returns true when the freshness question is settled here (synced, forced,
8
+ * or explicitly disabled) and the caller can skip its throttled sync.
9
+ * Returns false when the sha could not be determined, so the caller falls
10
+ * back to its existing throttle behavior.
11
+ */
12
+ export declare function syncIfStale(db: LocalDB, client: Client, syncInterval?: number): Promise<boolean>;
@@ -0,0 +1,59 @@
1
+ import "../../chunks/chunk-CQ52GEHY.js";
2
+
3
+ // src/adapter/next/syncCheck.ts
4
+ import { ReadonlyTree } from "alinea/core/source/Tree";
5
+ var CONTENT_SHA_TAG = "alinea-content-sha";
6
+ var SHA_REVALIDATE_SECONDS = 60;
7
+ var SENTINEL_SHA = ReadonlyTree.EMPTY.sha;
8
+ var inflight;
9
+ function latestSha(client) {
10
+ if (inflight) return inflight;
11
+ inflight = loadLatestSha(client).finally(() => {
12
+ inflight = void 0;
13
+ });
14
+ return inflight;
15
+ }
16
+ async function loadLatestSha(client) {
17
+ try {
18
+ const { unstable_cache } = await import("next/cache.js");
19
+ const getSha = unstable_cache(
20
+ async () => {
21
+ const tree = await client.getTreeIfDifferent(SENTINEL_SHA);
22
+ return tree?.sha;
23
+ },
24
+ ["alinea-content-sha"],
25
+ { revalidate: SHA_REVALIDATE_SECONDS, tags: [CONTENT_SHA_TAG] }
26
+ );
27
+ return await getSha();
28
+ } catch {
29
+ try {
30
+ const tree = await client.getTreeIfDifferent(SENTINEL_SHA);
31
+ return tree?.sha;
32
+ } catch {
33
+ return void 0;
34
+ }
35
+ }
36
+ }
37
+ async function revalidateContentSha() {
38
+ try {
39
+ const { revalidateTag } = await import("next/cache.js");
40
+ revalidateTag(CONTENT_SHA_TAG, { expire: 0 });
41
+ } catch {
42
+ }
43
+ }
44
+ async function syncIfStale(db, client, syncInterval) {
45
+ if (syncInterval === Number.POSITIVE_INFINITY) return true;
46
+ if (syncInterval === 0) {
47
+ await db.syncWith(client);
48
+ return true;
49
+ }
50
+ const expected = await latestSha(client);
51
+ if (!expected) return false;
52
+ if (expected !== db.sha) await db.syncWith(client);
53
+ return true;
54
+ }
55
+ export {
56
+ CONTENT_SHA_TAG,
57
+ revalidateContentSha,
58
+ syncIfStale
59
+ };
@@ -1,11 +1,3 @@
1
1
  import type { NextConfig } from 'next/dist/types.js';
2
- export interface WithAlineaOptions {
3
- /**
4
- * Base path where the dashboard is mounted.
5
- *
6
- * @default '/admin'
7
- */
8
- adminPath?: string;
9
- }
10
2
  export declare function createCMS(): void;
11
3
  export declare function withAlinea(config?: NextConfig): NextConfig;
@@ -1,6 +1,7 @@
1
1
  import "../../chunks/chunk-CQ52GEHY.js";
2
2
 
3
3
  // src/adapter/next/with-alinea.ts
4
+ import { join } from "alinea/core/util/Paths";
4
5
  import { readFileSync } from "node:fs";
5
6
  import { createRequire } from "node:module";
6
7
  import { resolve } from "node:path";
@@ -26,23 +27,13 @@ function withAlinea(config = {}) {
26
27
  } catch {
27
28
  console.warn("Alinea could not determine Next.js version, assuming 15+");
28
29
  }
29
- const imagesConfig = config.images ?? {};
30
- const remotePatterns = [
31
- ...imagesConfig.remotePatterns ?? [],
32
- {
33
- protocol: "https",
34
- hostname: "uploads.alinea.cloud"
35
- }
36
- ];
37
- const images = {
38
- ...imagesConfig,
39
- remotePatterns
40
- };
41
30
  const redirects = adminPath ? createRedirects(config, adminPath) : config.redirects;
42
- const rewrites = adminPath ? createRewrites(config, adminPath) : config.rewrites;
31
+ const rewrites = adminPath ? createRewrites(config, adminPath, settings.handlerUrl) : config.rewrites;
32
+ const images = adminPath ? createImages(config, adminPath) : config.images;
43
33
  const env = settings ? {
44
34
  ...config.env,
45
- ALINEA_ADMIN_PATH: settings.adminPath
35
+ ALINEA_ADMIN_PATH: settings.adminPath,
36
+ ALINEA_HANDLER_URL: settings.handlerUrl
46
37
  } : config.env;
47
38
  if (nextVersion < 15)
48
39
  return {
@@ -54,9 +45,9 @@ function withAlinea(config = {}) {
54
45
  "@alinea/generated"
55
46
  ]
56
47
  },
57
- images,
58
48
  redirects,
59
49
  rewrites,
50
+ images,
60
51
  env
61
52
  };
62
53
  return {
@@ -65,12 +56,32 @@ function withAlinea(config = {}) {
65
56
  ...config.serverExternalPackages ?? [],
66
57
  "@alinea/generated"
67
58
  ],
68
- images,
69
59
  redirects,
70
60
  rewrites,
61
+ images,
71
62
  env
72
63
  };
73
64
  }
65
+ function createImages(config, adminPath) {
66
+ const filePattern = `${adminPath}/file/**`;
67
+ const localPatterns = config.images?.localPatterns;
68
+ if (!localPatterns)
69
+ return {
70
+ ...config.images,
71
+ localPatterns: [{ pathname: filePattern }, { pathname: "/**" }]
72
+ };
73
+ if (localPatterns.some((pattern) => pattern.pathname === filePattern))
74
+ return config.images;
75
+ return {
76
+ ...config.images,
77
+ localPatterns: [
78
+ ...localPatterns,
79
+ {
80
+ pathname: filePattern
81
+ }
82
+ ]
83
+ };
84
+ }
74
85
  function createRedirects(config, adminPath) {
75
86
  const dev = process.env.ALINEA_DEV_SERVER;
76
87
  if (!dev) return config.redirects;
@@ -91,7 +102,7 @@ var emptyRewrites = {
91
102
  afterFiles: [],
92
103
  fallback: []
93
104
  };
94
- function createRewrites(config, adminPath) {
105
+ function createRewrites(config, adminPath, handlerUrl) {
95
106
  return async () => {
96
107
  const devServer = process.env.ALINEA_DEV_SERVER;
97
108
  const nodeEnv = process.env.NODE_ENV;
@@ -112,6 +123,10 @@ function createRewrites(config, adminPath) {
112
123
  ...rewrites,
113
124
  beforeFiles: [
114
125
  ...rewrites.beforeFiles,
126
+ {
127
+ source: `${adminPath}/file/:file*`,
128
+ destination: `${devServer}/api?file=:file*&delivery=proxy`
129
+ },
115
130
  {
116
131
  source: `${adminPath}/:path*`,
117
132
  destination: `${devServer}${adminPath}/:path*`
@@ -121,6 +136,14 @@ function createRewrites(config, adminPath) {
121
136
  }
122
137
  return {
123
138
  ...rewrites,
139
+ beforeFiles: [
140
+ ...rewrites.beforeFiles,
141
+ {
142
+ source: `${adminPath}/file/:file*`,
143
+ // Next's internal image optimizer does not follow redirects.
144
+ destination: `${handlerUrl}?file=:file*&delivery=proxy`
145
+ }
146
+ ],
124
147
  afterFiles: [
125
148
  ...rewrites.afterFiles,
126
149
  {
@@ -135,11 +158,12 @@ function resolveSettings(config) {
135
158
  const adminPath = config.env?.ALINEA_ADMIN_PATH ?? process.env.ALINEA_ADMIN_PATH;
136
159
  if (!adminPath) return;
137
160
  return {
138
- adminPath: normalizeBasePath(adminPath)
161
+ adminPath: normalizeBasePath(adminPath),
162
+ handlerUrl: config.env?.ALINEA_HANDLER_URL ?? process.env.ALINEA_HANDLER_URL ?? "/api/cms"
139
163
  };
140
164
  }
141
165
  function normalizeBasePath(value) {
142
- return value.startsWith("/") ? value : `/${value}`;
166
+ return join("/", value, ".");
143
167
  }
144
168
  export {
145
169
  createCMS,