alinea 2.0.0-preview.4 → 2.0.0-preview.6

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 (187) 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 +137 -137
  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/GithubApi.js +16 -7
  14. package/dist/backend/api/ProxyMedia.d.ts +3 -0
  15. package/dist/backend/api/ProxyMedia.js +39 -0
  16. package/dist/backend/api/S3Uploads.d.ts +1 -1
  17. package/dist/backend/router/Router.js +2 -0
  18. package/dist/backend/util/Syncable.js +1 -1
  19. package/dist/bundled.d.ts +166 -73
  20. package/dist/chunks/{chunk-XMOVGDFI.js → chunk-7IOKMUKO.js} +1 -1
  21. package/dist/chunks/{chunk-O7XWTMCB.js → chunk-D6RGFNUW.js} +73 -72
  22. package/dist/chunks/{chunk-VXZM6V4P.js → chunk-OFEKTDRF.js} +41 -41
  23. package/dist/cli/Generate.js +3 -4
  24. package/dist/cli/Serve.js +3 -2
  25. package/dist/cli/bin.js +1 -1
  26. package/dist/cli/generate/FillCache.d.ts +1 -1
  27. package/dist/cli/generate/FillCache.js +20 -9
  28. package/dist/cli/generate/GenerateDashboard.js +1 -0
  29. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  30. package/dist/cli/serve/CreateLocalServer.js +42 -34
  31. package/dist/cli/serve/DevServer.js +1 -0
  32. package/dist/cli/static/init/cms.js +1 -4
  33. package/dist/cli/util/ContentType.d.ts +1 -0
  34. package/dist/cli/util/ContentType.js +36 -0
  35. package/dist/cli/util/Emitter.js +1 -1
  36. package/dist/cloud/CloudHandshake.d.ts +6 -0
  37. package/dist/cloud/CloudHandshake.js +67 -10
  38. package/dist/cloud/CloudRemote.js +24 -11
  39. package/dist/components/Breadcrumbs.js +7 -7
  40. package/dist/components/Button.js +5 -5
  41. package/dist/components/Calendar.js +7 -7
  42. package/dist/components/Checkbox.js +8 -8
  43. package/dist/components/CheckboxGroup.js +5 -5
  44. package/dist/components/ColorSwatch.js +5 -5
  45. package/dist/components/ColorSwatchPicker.js +7 -7
  46. package/dist/components/ComboBox.js +14 -14
  47. package/dist/components/DateField.js +8 -8
  48. package/dist/components/DatePicker.js +10 -10
  49. package/dist/components/DateRangePicker.js +11 -11
  50. package/dist/components/Dialog.js +5 -5
  51. package/dist/components/Disclosure.js +11 -11
  52. package/dist/components/DropZone.js +5 -5
  53. package/dist/components/Label.js +9 -9
  54. package/dist/components/Link.js +5 -5
  55. package/dist/components/List.d.ts +1 -1
  56. package/dist/components/List.js +37 -36
  57. package/dist/components/Menu.js +9 -9
  58. package/dist/components/Modal.js +8 -8
  59. package/dist/components/MultipleSelect.js +33 -33
  60. package/dist/components/NumberField.js +11 -11
  61. package/dist/components/Popover.js +5 -5
  62. package/dist/components/ProgressCircle.js +8 -8
  63. package/dist/components/RadioGroup.js +7 -7
  64. package/dist/components/SearchField.js +10 -10
  65. package/dist/components/Select.js +12 -12
  66. package/dist/components/Surface.js +3 -3
  67. package/dist/components/Switch.js +7 -7
  68. package/dist/components/Table.js +11 -11
  69. package/dist/components/Tabs.js +9 -9
  70. package/dist/components/TagGroup.js +7 -7
  71. package/dist/components/TextField.js +10 -10
  72. package/dist/components/TimeField.js +5 -5
  73. package/dist/components/Toggle.js +5 -5
  74. package/dist/components/Toolbar.js +6 -6
  75. package/dist/components/Tooltip.js +8 -8
  76. package/dist/components/Tree.js +13 -13
  77. package/dist/core/Config.d.ts +10 -3
  78. package/dist/core/Config.js +16 -1
  79. package/dist/core/Graph.d.ts +2 -2
  80. package/dist/core/Role.js +16 -14
  81. package/dist/core/TextDoc.d.ts +2 -0
  82. package/dist/core/TextDoc.js +1 -0
  83. package/dist/core/Workspace.d.ts +6 -5
  84. package/dist/core/db/EntryIndex.d.ts +3 -0
  85. package/dist/core/db/EntryIndex.js +55 -0
  86. package/dist/core/db/EntryTransaction.js +34 -32
  87. package/dist/core/db/EntryUrlConflictError.js +1 -1
  88. package/dist/core/db/LinkResolver.d.ts +8 -2
  89. package/dist/core/db/LinkResolver.js +27 -5
  90. package/dist/core/field/RichTextField.js +16 -10
  91. package/dist/core/media/MediaLocation.d.ts +9 -15
  92. package/dist/core/media/MediaLocation.js +29 -19
  93. package/dist/core/media/MediaTypes.js +1 -2
  94. package/dist/dashboard/App.js +4 -4
  95. package/dist/dashboard/app/ActivityStatus.js +31 -37
  96. package/dist/dashboard/app/AppShell.js +2 -2
  97. package/dist/dashboard/app/AuthView.js +12 -12
  98. package/dist/dashboard/app/Badge.js +2 -2
  99. package/dist/dashboard/app/CompactField.js +9 -9
  100. package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
  101. package/dist/dashboard/app/EntryFields.d.ts +3 -1
  102. package/dist/dashboard/app/EntryFields.js +11 -8
  103. package/dist/dashboard/app/EntryHeader.js +116 -84
  104. package/dist/dashboard/app/EntryHeaderActions.d.ts +21 -4
  105. package/dist/dashboard/app/EntryHeaderActions.js +48 -27
  106. package/dist/dashboard/app/EntryReferences.js +6 -6
  107. package/dist/dashboard/app/EntrySidebar.js +15 -15
  108. package/dist/dashboard/app/EntrySidebarPreview.js +4 -4
  109. package/dist/dashboard/app/EntryTranslationBanner.d.ts +3 -1
  110. package/dist/dashboard/app/EntryTranslationBanner.js +23 -20
  111. package/dist/dashboard/app/Explorer.d.ts +4 -2
  112. package/dist/dashboard/app/Explorer.js +53 -49
  113. package/dist/dashboard/app/ExplorerCards.js +31 -31
  114. package/dist/dashboard/app/ExplorerFileCard.js +16 -16
  115. package/dist/dashboard/app/ExplorerList.js +14 -15
  116. package/dist/dashboard/app/ExplorerModal.js +4 -4
  117. package/dist/dashboard/app/ExplorerTable.js +54 -54
  118. package/dist/dashboard/app/LinkPicker.js +5 -5
  119. package/dist/dashboard/app/LocaleMenu.d.ts +7 -0
  120. package/dist/dashboard/app/LocaleMenu.js +34 -18
  121. package/dist/dashboard/app/ReadOnlyBadge.d.ts +4 -0
  122. package/dist/dashboard/app/ReadOnlyBadge.js +33 -0
  123. package/dist/dashboard/app/SidebarTree.d.ts +3 -6
  124. package/dist/dashboard/app/SidebarTree.js +62 -57
  125. package/dist/dashboard/app/WorkspaceMenu.js +16 -16
  126. package/dist/dashboard/app/WorkspaceRoots.js +21 -21
  127. package/dist/dashboard/app/editor/FileEditor.d.ts +2 -3
  128. package/dist/dashboard/app/editor/FileEditor.js +24 -27
  129. package/dist/dashboard/app/editor/FilePreview.js +4 -4
  130. package/dist/dashboard/app/modals/CreateEntry.js +5 -5
  131. package/dist/dashboard/app/pages/EntryPage.js +72 -29
  132. package/dist/dashboard/app/pages/RootPage.js +3 -3
  133. package/dist/dashboard/app/pages/SplashPage.js +45 -45
  134. package/dist/dashboard/app/pages/UsersPage.js +36 -36
  135. package/dist/dashboard/app/ui/DashboardModal.js +21 -21
  136. package/dist/dashboard/app/ui/Rail.js +5 -5
  137. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  138. package/dist/dashboard/atoms/activity.d.ts +0 -2
  139. package/dist/dashboard/atoms/activity.js +4 -10
  140. package/dist/dashboard/atoms/editor.d.ts +2 -1
  141. package/dist/dashboard/atoms/editor.js +4 -2
  142. package/dist/dashboard/atoms/entry.d.ts +2 -0
  143. package/dist/dashboard/atoms/entry.js +32 -14
  144. package/dist/dashboard/atoms/explorer.d.ts +4 -3
  145. package/dist/dashboard/atoms/explorer.js +61 -22
  146. package/dist/dashboard/atoms/link.d.ts +1 -1
  147. package/dist/dashboard/atoms/link.js +39 -55
  148. package/dist/dashboard/atoms/root.d.ts +7 -2
  149. package/dist/dashboard/atoms/root.js +51 -16
  150. package/dist/dashboard/atoms/upload.d.ts +1 -0
  151. package/dist/dashboard/atoms/upload.js +2 -1
  152. package/dist/dashboard/boot/ActivityEvent.d.ts +1 -1
  153. package/dist/dashboard/boot/DashboardWorker.js +2 -28
  154. package/dist/dashboard/fixture/cms.js +1 -4
  155. package/dist/dashboard/hook/UseSaveShortcut.d.ts +1 -0
  156. package/dist/dashboard/hook/UseSaveShortcut.js +24 -0
  157. package/dist/dashboard/hooks.d.ts +1 -1
  158. package/dist/dashboard/hooks.js +12 -3
  159. package/dist/field/check/CheckField.view.js +2 -2
  160. package/dist/field/code/CodeField.view.js +11 -11
  161. package/dist/field/date/DateField.view.js +5 -5
  162. package/dist/field/link/ImageLink.js +1 -3
  163. package/dist/field/link/LinkField.view.js +88 -62
  164. package/dist/field/list/ListField.view.js +25 -25
  165. package/dist/field/metadata/MetadataField.d.ts +3 -3
  166. package/dist/field/metadata/MetadataField.view.js +27 -20
  167. package/dist/field/object/ObjectField.view.js +11 -4
  168. package/dist/field/richtext/PickTextLink.js +5 -2
  169. package/dist/field/richtext/ReferenceLink.d.ts +2 -0
  170. package/dist/field/richtext/ReferenceLink.js +5 -0
  171. package/dist/field/richtext/RichTextBlock.js +2 -2
  172. package/dist/field/richtext/RichTextExtensions.js +24 -24
  173. package/dist/field/richtext/RichTextField.view.js +2 -2
  174. package/dist/field/richtext/RichTextInsertMenu.js +3 -3
  175. package/dist/field/richtext/extensions/Link.d.ts +1 -0
  176. package/dist/field/richtext/extensions/Link.js +1 -0
  177. package/dist/field/select/SelectField.view.js +1 -1
  178. package/dist/field/time/TimeField.d.ts +0 -2
  179. package/dist/field/time/TimeField.view.js +1 -1
  180. package/dist/index.css +44 -38
  181. package/dist/next.cjs +96 -19
  182. package/dist/picker/entry/EntryPicker.js +10 -12
  183. package/dist/picker/entry/EntryReference.d.ts +2 -0
  184. package/dist/picker/entry/EntryReference.js +1 -0
  185. package/dist/types.d.ts +0 -1
  186. package/package.json +1 -1
  187. package/dist/chunks/{chunk-6V4TAD2N.js → chunk-DNJX6CRV.js} +4 -4
@@ -1,7 +1,7 @@
1
1
  // package.json with { type: 'json' }
2
2
  var package_default = {
3
3
  name: "alinea",
4
- version: "2.0.0-preview.4",
4
+ version: "2.0.0-preview.6",
5
5
  description: "Headless git-based CMS",
6
6
  repository: "github:alineacms/alinea",
7
7
  license: "MIT",
@@ -1135,6 +1135,78 @@ function $42ceafc619f9c3ba$var$CollectionRoot({ children }) {
1135
1135
  }, wrappedChildren) : /* @__PURE__ */ (0, $kT5Ur$createPortal)(wrappedChildren, doc);
1136
1136
  }
1137
1137
 
1138
+ // node_modules/react-aria/dist/private/interactions/useInteractOutside.mjs
1139
+ import { useRef as $a2uwp$useRef, useEffect as $a2uwp$useEffect } from "react";
1140
+ function $e260d131964da0f9$export$872b660ac5a1ff98(props) {
1141
+ let { ref, onInteractOutside, isDisabled, onInteractOutsideStart } = props;
1142
+ let stateRef = (0, $a2uwp$useRef)({
1143
+ isPointerDown: false,
1144
+ ignoreEmulatedMouseEvents: false
1145
+ });
1146
+ let onPointerDown = (0, $fe16bffc7a557bf0$export$7f54fc3180508a52)((e) => {
1147
+ if (onInteractOutside && $e260d131964da0f9$var$isValidEvent(e, ref)) {
1148
+ if (onInteractOutsideStart) onInteractOutsideStart(e);
1149
+ stateRef.current.isPointerDown = true;
1150
+ }
1151
+ });
1152
+ let triggerInteractOutside = (0, $fe16bffc7a557bf0$export$7f54fc3180508a52)((e) => {
1153
+ if (onInteractOutside) onInteractOutside(e);
1154
+ });
1155
+ (0, $a2uwp$useEffect)(() => {
1156
+ let state = stateRef.current;
1157
+ if (isDisabled) return;
1158
+ const element = ref.current;
1159
+ const documentObject = (0, $d447af545b77c9f1$export$b204af158042fbac)(element);
1160
+ if (typeof PointerEvent !== "undefined") {
1161
+ let onClick = (e) => {
1162
+ if (state.isPointerDown && $e260d131964da0f9$var$isValidEvent(e, ref)) triggerInteractOutside(e);
1163
+ state.isPointerDown = false;
1164
+ };
1165
+ documentObject.addEventListener("pointerdown", onPointerDown, true);
1166
+ documentObject.addEventListener("click", onClick, true);
1167
+ return () => {
1168
+ documentObject.removeEventListener("pointerdown", onPointerDown, true);
1169
+ documentObject.removeEventListener("click", onClick, true);
1170
+ };
1171
+ } else if (process.env.NODE_ENV === "test") {
1172
+ let onMouseUp = (e) => {
1173
+ if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
1174
+ else if (state.isPointerDown && $e260d131964da0f9$var$isValidEvent(e, ref)) triggerInteractOutside(e);
1175
+ state.isPointerDown = false;
1176
+ };
1177
+ let onTouchEnd = (e) => {
1178
+ state.ignoreEmulatedMouseEvents = true;
1179
+ if (state.isPointerDown && $e260d131964da0f9$var$isValidEvent(e, ref)) triggerInteractOutside(e);
1180
+ state.isPointerDown = false;
1181
+ };
1182
+ documentObject.addEventListener("mousedown", onPointerDown, true);
1183
+ documentObject.addEventListener("mouseup", onMouseUp, true);
1184
+ documentObject.addEventListener("touchstart", onPointerDown, true);
1185
+ documentObject.addEventListener("touchend", onTouchEnd, true);
1186
+ return () => {
1187
+ documentObject.removeEventListener("mousedown", onPointerDown, true);
1188
+ documentObject.removeEventListener("mouseup", onMouseUp, true);
1189
+ documentObject.removeEventListener("touchstart", onPointerDown, true);
1190
+ documentObject.removeEventListener("touchend", onTouchEnd, true);
1191
+ };
1192
+ }
1193
+ }, [
1194
+ ref,
1195
+ isDisabled
1196
+ ]);
1197
+ }
1198
+ function $e260d131964da0f9$var$isValidEvent(event, ref) {
1199
+ if (event.button > 0) return false;
1200
+ let target = (0, $23f2114a1b82827e$export$e58f029f0fbfdb29)(event);
1201
+ if (target) {
1202
+ const ownerDocument = target.ownerDocument;
1203
+ if (!ownerDocument || !(0, $23f2114a1b82827e$export$4282f70798064fe0)(ownerDocument.documentElement, target)) return false;
1204
+ if (target.closest("[data-react-aria-top-layer]")) return false;
1205
+ }
1206
+ if (!ref.current) return false;
1207
+ return !event.composedPath().includes(ref.current);
1208
+ }
1209
+
1138
1210
  // node_modules/react-aria/dist/private/i18n/useCollator.mjs
1139
1211
  var $673d46fce3e5717d$var$cache = /* @__PURE__ */ new Map();
1140
1212
  function $673d46fce3e5717d$export$a16aca283550c30d(options) {
@@ -10403,78 +10475,6 @@ function $b3526bc71400be8d$var$translateRTL(position, direction) {
10403
10475
  return position.replace("start", "left").replace("end", "right");
10404
10476
  }
10405
10477
 
10406
- // node_modules/react-aria/dist/private/interactions/useInteractOutside.mjs
10407
- import { useRef as $a2uwp$useRef, useEffect as $a2uwp$useEffect } from "react";
10408
- function $e260d131964da0f9$export$872b660ac5a1ff98(props) {
10409
- let { ref, onInteractOutside, isDisabled, onInteractOutsideStart } = props;
10410
- let stateRef = (0, $a2uwp$useRef)({
10411
- isPointerDown: false,
10412
- ignoreEmulatedMouseEvents: false
10413
- });
10414
- let onPointerDown = (0, $fe16bffc7a557bf0$export$7f54fc3180508a52)((e) => {
10415
- if (onInteractOutside && $e260d131964da0f9$var$isValidEvent(e, ref)) {
10416
- if (onInteractOutsideStart) onInteractOutsideStart(e);
10417
- stateRef.current.isPointerDown = true;
10418
- }
10419
- });
10420
- let triggerInteractOutside = (0, $fe16bffc7a557bf0$export$7f54fc3180508a52)((e) => {
10421
- if (onInteractOutside) onInteractOutside(e);
10422
- });
10423
- (0, $a2uwp$useEffect)(() => {
10424
- let state = stateRef.current;
10425
- if (isDisabled) return;
10426
- const element = ref.current;
10427
- const documentObject = (0, $d447af545b77c9f1$export$b204af158042fbac)(element);
10428
- if (typeof PointerEvent !== "undefined") {
10429
- let onClick = (e) => {
10430
- if (state.isPointerDown && $e260d131964da0f9$var$isValidEvent(e, ref)) triggerInteractOutside(e);
10431
- state.isPointerDown = false;
10432
- };
10433
- documentObject.addEventListener("pointerdown", onPointerDown, true);
10434
- documentObject.addEventListener("click", onClick, true);
10435
- return () => {
10436
- documentObject.removeEventListener("pointerdown", onPointerDown, true);
10437
- documentObject.removeEventListener("click", onClick, true);
10438
- };
10439
- } else if (process.env.NODE_ENV === "test") {
10440
- let onMouseUp = (e) => {
10441
- if (state.ignoreEmulatedMouseEvents) state.ignoreEmulatedMouseEvents = false;
10442
- else if (state.isPointerDown && $e260d131964da0f9$var$isValidEvent(e, ref)) triggerInteractOutside(e);
10443
- state.isPointerDown = false;
10444
- };
10445
- let onTouchEnd = (e) => {
10446
- state.ignoreEmulatedMouseEvents = true;
10447
- if (state.isPointerDown && $e260d131964da0f9$var$isValidEvent(e, ref)) triggerInteractOutside(e);
10448
- state.isPointerDown = false;
10449
- };
10450
- documentObject.addEventListener("mousedown", onPointerDown, true);
10451
- documentObject.addEventListener("mouseup", onMouseUp, true);
10452
- documentObject.addEventListener("touchstart", onPointerDown, true);
10453
- documentObject.addEventListener("touchend", onTouchEnd, true);
10454
- return () => {
10455
- documentObject.removeEventListener("mousedown", onPointerDown, true);
10456
- documentObject.removeEventListener("mouseup", onMouseUp, true);
10457
- documentObject.removeEventListener("touchstart", onPointerDown, true);
10458
- documentObject.removeEventListener("touchend", onTouchEnd, true);
10459
- };
10460
- }
10461
- }, [
10462
- ref,
10463
- isDisabled
10464
- ]);
10465
- }
10466
- function $e260d131964da0f9$var$isValidEvent(event, ref) {
10467
- if (event.button > 0) return false;
10468
- let target = (0, $23f2114a1b82827e$export$e58f029f0fbfdb29)(event);
10469
- if (target) {
10470
- const ownerDocument = target.ownerDocument;
10471
- if (!ownerDocument || !(0, $23f2114a1b82827e$export$4282f70798064fe0)(ownerDocument.documentElement, target)) return false;
10472
- if (target.closest("[data-react-aria-top-layer]")) return false;
10473
- }
10474
- if (!ref.current) return false;
10475
- return !event.composedPath().includes(ref.current);
10476
- }
10477
-
10478
10478
  // node_modules/react-aria/dist/private/overlays/useOverlay.mjs
10479
10479
  import { useRef as $eUNmN$useRef, useEffect as $eUNmN$useEffect } from "react";
10480
10480
  var $77844860df94ba23$var$visibleOverlays = [];
@@ -19437,6 +19437,7 @@ export {
19437
19437
  $3d6c959d2ef57b72$export$c3f9f39876e4bc7,
19438
19438
  $970072cf4b13fde3$export$683480f191c0e3ea,
19439
19439
  $b3526bc71400be8d$export$d39e1813b3bdd0e1,
19440
+ $e260d131964da0f9$export$872b660ac5a1ff98,
19440
19441
  $f8a024fbad3a5a2e$export$542a6fd13ac93354,
19441
19442
  $081058010ef8962e$export$2317d149ed6f78c4,
19442
19443
  $0d47b37c475c5231$export$3351871ee4b288b8,
@@ -1,3 +1,43 @@
1
+ import {
2
+ $086b1fd51041276f$export$3fcbf6e4407997e0,
3
+ $120eca7b9c40f820$export$b453a3bfd4a5fa9e,
4
+ $178a7f94e1b4b497$export$31447e17397b15c2,
5
+ $178a7f94e1b4b497$export$907bcc6c48325fd6,
6
+ $28aae683a942e141$export$87194bb378cc3ac2,
7
+ $29256f53a2edafe9$export$5159ec8b34d4ec12,
8
+ $3834487504f4fc00$export$4d40659c25ecb50b,
9
+ $384704861d32dbed$export$bca9d026f8e704eb,
10
+ $3b14a8cc70843920$export$7c127db850d4e81e,
11
+ $3d0ee518c6f3d04f$export$7f629e9dc1ecf37c,
12
+ $3d8ad31c4c1725e9$export$8deac67f4addf270,
13
+ $4a07ac835f260f78$export$6c8a5aaad13c9852,
14
+ $51e619e0f141c3ec$export$1505db82fe357e65,
15
+ $56baeede9f35e022$export$3f8be18b0f41eaf2,
16
+ $5b3242e27644e8f1$export$cfc51cf86138bf98,
17
+ $60f19cefd567a3e4$export$253fe78d46329472,
18
+ $6b915bde6cd300dd$export$728d6ba534403756,
19
+ $6de3e3f1a7663217$export$e50a61c1de9f574,
20
+ $8cd68577ce0207f7$export$daff6da51032a415,
21
+ $8e7461aabf74661f$export$60e84778edff6d26,
22
+ $a0a87fb6fcfb22ec$export$9a987164d97ecc90,
23
+ $af827553fd3cf456$export$c79fc6492f3af13d,
24
+ $b14b6f590b50af39$export$2f645645f7bca764,
25
+ $b14b6f590b50af39$export$ba9d38c0f1bf2b36,
26
+ $b822555cf9fe955c$export$fd53cef0cc796101,
27
+ $b88f793813fc795e$export$baf26146a414f24a,
28
+ $caeb030f09a278a1$export$4ba071daf4e486,
29
+ $cc8e610d5d6e3fe4$export$cb6da89c6af1a8ec,
30
+ $e3403870bfb691da$export$79fefeb1c2091ac3,
31
+ $ea0ea6e62ae0d7ca$export$6d095e787d2b5e1f,
32
+ $f11fb0bcf1b2687a$export$61c6a8c84e605fb6,
33
+ $f229ad6ed8947519$export$dc6b73b623f8645f
34
+ } from "./chunk-NIVGVRDS.js";
35
+ import {
36
+ $f9554a667e4f0374$export$971707d8a129a1f7,
37
+ $f9554a667e4f0374$export$d188a835a7bc5783,
38
+ $f9554a667e4f0374$export$d1e8e3fbb7461f6,
39
+ $f9554a667e4f0374$export$f55761759794cf55
40
+ } from "./chunk-DNJX6CRV.js";
1
41
  import {
2
42
  $03e8ab2d84d7657a$export$4338b53315abf666,
3
43
  $054f71d2330da2e3$export$712718f7aec83d5,
@@ -101,53 +141,13 @@ import {
101
141
  $f282e36c29c025e8$export$f9d5c8beee7d008d,
102
142
  $f8a024fbad3a5a2e$export$542a6fd13ac93354,
103
143
  $fb95af427cd4e876$export$25bceaac3c7e4dc7
104
- } from "./chunk-O7XWTMCB.js";
105
- import {
106
- $086b1fd51041276f$export$3fcbf6e4407997e0,
107
- $120eca7b9c40f820$export$b453a3bfd4a5fa9e,
108
- $178a7f94e1b4b497$export$31447e17397b15c2,
109
- $178a7f94e1b4b497$export$907bcc6c48325fd6,
110
- $28aae683a942e141$export$87194bb378cc3ac2,
111
- $29256f53a2edafe9$export$5159ec8b34d4ec12,
112
- $3834487504f4fc00$export$4d40659c25ecb50b,
113
- $384704861d32dbed$export$bca9d026f8e704eb,
114
- $3b14a8cc70843920$export$7c127db850d4e81e,
115
- $3d0ee518c6f3d04f$export$7f629e9dc1ecf37c,
116
- $3d8ad31c4c1725e9$export$8deac67f4addf270,
117
- $4a07ac835f260f78$export$6c8a5aaad13c9852,
118
- $51e619e0f141c3ec$export$1505db82fe357e65,
119
- $56baeede9f35e022$export$3f8be18b0f41eaf2,
120
- $5b3242e27644e8f1$export$cfc51cf86138bf98,
121
- $60f19cefd567a3e4$export$253fe78d46329472,
122
- $6b915bde6cd300dd$export$728d6ba534403756,
123
- $6de3e3f1a7663217$export$e50a61c1de9f574,
124
- $8cd68577ce0207f7$export$daff6da51032a415,
125
- $8e7461aabf74661f$export$60e84778edff6d26,
126
- $a0a87fb6fcfb22ec$export$9a987164d97ecc90,
127
- $af827553fd3cf456$export$c79fc6492f3af13d,
128
- $b14b6f590b50af39$export$2f645645f7bca764,
129
- $b14b6f590b50af39$export$ba9d38c0f1bf2b36,
130
- $b822555cf9fe955c$export$fd53cef0cc796101,
131
- $b88f793813fc795e$export$baf26146a414f24a,
132
- $caeb030f09a278a1$export$4ba071daf4e486,
133
- $cc8e610d5d6e3fe4$export$cb6da89c6af1a8ec,
134
- $e3403870bfb691da$export$79fefeb1c2091ac3,
135
- $ea0ea6e62ae0d7ca$export$6d095e787d2b5e1f,
136
- $f11fb0bcf1b2687a$export$61c6a8c84e605fb6,
137
- $f229ad6ed8947519$export$dc6b73b623f8645f
138
- } from "./chunk-NIVGVRDS.js";
144
+ } from "./chunk-D6RGFNUW.js";
139
145
  import {
140
146
  $240e9101ba2842f5$export$7d15b64cf5a3a4c4,
141
147
  $3e6197669829fe11$export$40bfa8c7b0832715,
142
148
  $890783418b00a858$export$6e865ea70d7724f,
143
149
  $fd3c5e01e837dc20$export$8042c6c013fd5226
144
150
  } from "./chunk-SJBZFMQ2.js";
145
- import {
146
- $f9554a667e4f0374$export$971707d8a129a1f7,
147
- $f9554a667e4f0374$export$d188a835a7bc5783,
148
- $f9554a667e4f0374$export$d1e8e3fbb7461f6,
149
- $f9554a667e4f0374$export$f55761759794cf55
150
- } from "./chunk-6V4TAD2N.js";
151
151
  import {
152
152
  $23f2114a1b82827e$export$4282f70798064fe0,
153
153
  $23f2114a1b82827e$export$b4f377a2b6254582,
@@ -24,9 +24,7 @@ var require2 = createRequire(import.meta.url);
24
24
  var alineaPackageDir = path.dirname(require2.resolve("alinea/package.json"));
25
25
  async function generatePackage(context, cms) {
26
26
  const { config } = cms;
27
- if (!config.dashboardFile) return;
28
- const staticFile = config.dashboardFile ? join(config.publicDir, config.dashboardFile) : void 0;
29
- if (!staticFile) return;
27
+ const staticFile = join(config.publicDir, Config.dashboardFile(config));
30
28
  await generateDashboard(context, cms, Config.handlerUrl(config), staticFile);
31
29
  return basename(staticFile);
32
30
  }
@@ -38,6 +36,7 @@ async function* generate(options) {
38
36
  configFile,
39
37
  staticDir = path.join(__dirname, "static"),
40
38
  quiet = false,
39
+ watch = cmd === "dev",
41
40
  onAfterGenerate
42
41
  } = options;
43
42
  const now = performance.now();
@@ -107,7 +106,7 @@ async function* generate(options) {
107
106
  dashboardUrl: await options.dashboardUrl
108
107
  });
109
108
  try {
110
- indexing = fillCache(db, context.fix);
109
+ indexing = fillCache(db, context.fix, watch);
111
110
  } catch (error) {
112
111
  reportError(error);
113
112
  if (cmd === "build") process.exit(1);
package/dist/cli/Serve.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  package_default
3
- } from "../chunks/chunk-XMOVGDFI.js";
3
+ } from "../chunks/chunk-7IOKMUKO.js";
4
4
  import "../chunks/chunk-CQ52GEHY.js";
5
5
 
6
6
  // src/cli/Serve.ts
@@ -24,7 +24,7 @@ async function serve(options) {
24
24
  const apiKey = process.env.ALINEA_API_KEY ?? createId();
25
25
  const nodeServer = startServer(preferredPort, 0, cmd === "build");
26
26
  const dashboardUrl = nodeServer.then(
27
- (server) => `http://${server.hostname}:${server.port}`
27
+ (server) => `http://localhost:${server.port}`
28
28
  );
29
29
  let devServer;
30
30
  try {
@@ -60,6 +60,7 @@ async function serve(options) {
60
60
  options.onAfterGenerate?.({
61
61
  ALINEA_DEV_SERVER: url,
62
62
  ALINEA_ADMIN_PATH: Config.adminPath(config),
63
+ ALINEA_HANDLER_URL: Config.handlerUrl(config),
63
64
  ALINEA_API_KEY: apiKey
64
65
  });
65
66
  });
package/dist/cli/bin.js CHANGED
@@ -220,7 +220,7 @@ var lib_default2 = (e, t2) => new o(e, t2);
220
220
  // package.json
221
221
  var package_default = {
222
222
  name: "alinea",
223
- version: "2.0.0-preview.4",
223
+ version: "2.0.0-preview.6",
224
224
  description: "Headless git-based CMS",
225
225
  repository: "github:alineacms/alinea",
226
226
  license: "MIT",
@@ -1,3 +1,3 @@
1
1
  import { type Emitter } from '../util/Emitter.js';
2
2
  import type { DevDB } from './DevDB.js';
3
- export declare function fillCache(db: DevDB, fix?: boolean): Emitter<DevDB>;
3
+ export declare function fillCache(db: DevDB, fix?: boolean, watch?: boolean): Emitter<DevDB>;
@@ -7,7 +7,7 @@ import "../../chunks/chunk-CQ52GEHY.js";
7
7
  import { createEmitter } from "../util/Emitter.js";
8
8
  import { reportError } from "../util/Report.js";
9
9
  import { createWatcher } from "../util/Watcher.js";
10
- function fillCache(db, fix) {
10
+ function fillCache(db, fix, watch = true) {
11
11
  let canceled = false;
12
12
  let stopWatching = () => {
13
13
  canceled = true;
@@ -18,19 +18,30 @@ function fillCache(db, fix) {
18
18
  }
19
19
  });
20
20
  const limit = pLimit(1);
21
- const run = () => limit(cache).then(results.emit, reportError);
21
+ const run = () => limit(cache).then(
22
+ (db2) => {
23
+ results.emit(db2);
24
+ if (!watch) results.return();
25
+ },
26
+ (error) => {
27
+ if (watch) reportError(error);
28
+ else results.throw(error);
29
+ }
30
+ );
22
31
  const cache = async () => {
23
32
  await db.sync();
24
33
  if (fix) await db.fix();
25
34
  return db;
26
35
  };
27
- createWatcher({
28
- watchFiles: db.watchFiles.bind(db),
29
- onChange: run
30
- }).then((cancel) => {
31
- if (canceled) cancel();
32
- else stopWatching = cancel;
33
- });
36
+ if (watch) {
37
+ createWatcher({
38
+ watchFiles: db.watchFiles.bind(db),
39
+ onChange: run
40
+ }).then((cancel) => {
41
+ if (canceled) cancel();
42
+ else stopWatching = cancel;
43
+ });
44
+ }
34
45
  run();
35
46
  return results;
36
47
  }
@@ -95,6 +95,7 @@ async function generateDashboard({ configLocation, rootDir, configDir }, cms, ha
95
95
  define: {
96
96
  "process.env.NODE_ENV": '"production"',
97
97
  "process.env.ALINEA_BUILD_ID": JSON.stringify(buildId),
98
+ "process.env.ALINEA_FORCE_AUTH": "true",
98
99
  ...publicDefines(process.env)
99
100
  },
100
101
  ...buildOptions,
@@ -1,7 +1,7 @@
1
1
  import type { Handler } from 'alinea/backend/Handler';
2
2
  import type { CMS } from 'alinea/core/CMS';
3
3
  import type { User } from 'alinea/core/User';
4
- import { type Request, Response } from '@alinea/iso';
4
+ import { Request, Response } from '@alinea/iso';
5
5
  import type { ServeContext } from './ServeContext.js';
6
6
  export declare function createLocalServer({ cmd, configLocation, rootDir, staticDir, alineaDev, buildOptions, production, liveReload, buildId, apiKey }: ServeContext, cms: CMS, handleApi: Handler, user: User): {
7
7
  close(): void;
@@ -2,46 +2,19 @@ import "../../chunks/chunk-CQ52GEHY.js";
2
2
 
3
3
  // src/cli/serve/CreateLocalServer.ts
4
4
  import { router } from "alinea/backend/router/Router";
5
+ import { Config } from "alinea/core/Config";
5
6
  import { HttpError } from "alinea/core/HttpError";
6
7
  import { trigger } from "alinea/core/Trigger";
7
8
  import { assertUploadSize } from "alinea/core/media/UploadLimits";
8
- import { ReadableStream, Response } from "@alinea/iso";
9
+ import { ReadableStream, Request, Response } from "@alinea/iso";
9
10
  import fs from "node:fs";
10
11
  import path from "node:path";
11
12
  import { buildEmitter } from "../build/BuildEmitter.js";
13
+ import { contentType } from "../util/ContentType.js";
12
14
  import { ignorePlugin } from "../util/IgnorePlugin.js";
13
15
  import { publicDefines } from "../util/PublicDefines.js";
14
16
  import { reportFatal } from "../util/Report.js";
15
17
  import { viewsPlugin } from "../util/ViewsPlugin.js";
16
- var mimeTypes = new Map(
17
- Object.entries({
18
- // Text
19
- ".css": "text/css; charset=utf-8",
20
- ".htm": "text/html; charset=utf-8",
21
- ".html": "text/html; charset=utf-8",
22
- ".js": "text/javascript; charset=utf-8",
23
- ".json": "application/json",
24
- ".mjs": "text/javascript; charset=utf-8",
25
- ".xml": "text/xml; charset=utf-8",
26
- // Images
27
- ".gif": "image/gif",
28
- ".jpeg": "image/jpeg",
29
- ".jpg": "image/jpeg",
30
- ".png": "image/png",
31
- ".svg": "image/svg+xml",
32
- ".webp": "image/webp",
33
- // Fonts
34
- ".eot": "application/vnd.ms-fontobject",
35
- ".otf": "font/otf",
36
- ".sfnt": "font/sfnt",
37
- ".ttf": "font/ttf",
38
- ".woff": "font/woff",
39
- ".woff2": "font/woff2",
40
- // Other
41
- ".pdf": "application/pdf",
42
- ".wasm": "application/wasm"
43
- })
44
- );
45
18
  function buildFiles(outdir, result) {
46
19
  return new Map(
47
20
  result.outputFiles.map((file) => {
@@ -72,9 +45,11 @@ function createLocalServer({
72
45
  });
73
46
  }
74
47
  const devDir = path.join(staticDir, "dev");
48
+ const publicDir = path.join(rootDir, cms.config.publicDir ?? "public");
49
+ const adminPath = Config.adminPath(cms.config);
75
50
  const getPath = (url) => {
76
- if (url.pathname.startsWith("/admin"))
77
- return url.pathname.slice("/admin".length);
51
+ if (url.pathname === adminPath || url.pathname.startsWith(`${adminPath}/`))
52
+ return url.pathname.slice(adminPath.length);
78
53
  return url.pathname;
79
54
  };
80
55
  const matcher = router.matcher(getPath);
@@ -157,11 +132,34 @@ function createLocalServer({
157
132
  const extension = path.extname(fileName);
158
133
  return new Response(file.contents, {
159
134
  headers: {
160
- "content-type": mimeTypes.get(extension) || "application/octet-stream",
135
+ "content-type": contentType(extension),
161
136
  etag
162
137
  }
163
138
  });
164
139
  }
140
+ async function servePublicFile(request) {
141
+ if (request.method !== "GET" && request.method !== "HEAD") return;
142
+ const pathname = decodeURIComponent(new URL(request.url).pathname);
143
+ const location = path.resolve(publicDir, pathname.replace(/^[/\\]+/, ""));
144
+ const relative = path.relative(publicDir, location);
145
+ if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))
146
+ return;
147
+ try {
148
+ const stat = await fs.promises.stat(location);
149
+ if (!stat.isFile()) return;
150
+ const body = request.method === "HEAD" ? void 0 : await fs.promises.readFile(location);
151
+ return new Response(body, {
152
+ headers: {
153
+ "content-length": String(stat.size),
154
+ "content-type": contentType(path.extname(location))
155
+ }
156
+ });
157
+ } catch (error) {
158
+ if (error instanceof Error && "code" in error && error.code === "ENOENT")
159
+ return;
160
+ throw error;
161
+ }
162
+ }
165
163
  const httpRouter = router(
166
164
  matcher.get("/~dev").map(() => {
167
165
  const stream = new ReadableStream({
@@ -224,6 +222,15 @@ function createLocalServer({
224
222
  }
225
223
  }),
226
224
  router.compress(
225
+ matcher.all("/file/*").map(({ request, params }) => {
226
+ if (request.method !== "GET" && request.method !== "HEAD") return;
227
+ const url = new URL(request.url);
228
+ url.pathname = "/api";
229
+ url.search = new URLSearchParams({
230
+ file: String(params.wild)
231
+ }).toString();
232
+ return devHandler(new Request(url, request));
233
+ }),
227
234
  matcher.all("/api").map(async ({ url, request }) => {
228
235
  return devHandler(request);
229
236
  }),
@@ -245,7 +252,8 @@ function createLocalServer({
245
252
  { headers: { "content-type": "text/html" } }
246
253
  );
247
254
  }),
248
- serveBrowserBuild
255
+ serveBrowserBuild,
256
+ servePublicFile
249
257
  )
250
258
  ).notFound(() => new Response("Not found", { status: 404 }));
251
259
  function uploadCorsHeaders(request) {
@@ -124,6 +124,7 @@ async function createDevServer(dir, options) {
124
124
  }
125
125
  }
126
126
  void reloadServer();
127
+ if (cmd === "build") await initialServer;
127
128
  return {
128
129
  close() {
129
130
  currentServer?.close();
@@ -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
  })
@@ -0,0 +1 @@
1
+ export declare function contentType(extension: string): string;
@@ -0,0 +1,36 @@
1
+ import "../../chunks/chunk-CQ52GEHY.js";
2
+
3
+ // src/cli/util/ContentType.ts
4
+ var contentTypes = {
5
+ // Text
6
+ ".css": "text/css; charset=utf-8",
7
+ ".htm": "text/html; charset=utf-8",
8
+ ".html": "text/html; charset=utf-8",
9
+ ".js": "text/javascript; charset=utf-8",
10
+ ".json": "application/json",
11
+ ".mjs": "text/javascript; charset=utf-8",
12
+ ".xml": "text/xml; charset=utf-8",
13
+ // Images
14
+ ".gif": "image/gif",
15
+ ".jpeg": "image/jpeg",
16
+ ".jpg": "image/jpeg",
17
+ ".png": "image/png",
18
+ ".svg": "image/svg+xml",
19
+ ".webp": "image/webp",
20
+ // Fonts
21
+ ".eot": "application/vnd.ms-fontobject",
22
+ ".otf": "font/otf",
23
+ ".sfnt": "font/sfnt",
24
+ ".ttf": "font/ttf",
25
+ ".woff": "font/woff",
26
+ ".woff2": "font/woff2",
27
+ // Other
28
+ ".pdf": "application/pdf",
29
+ ".wasm": "application/wasm"
30
+ };
31
+ function contentType(extension) {
32
+ return contentTypes[extension.toLowerCase()] ?? "application/octet-stream";
33
+ }
34
+ export {
35
+ contentType
36
+ };
@@ -19,7 +19,7 @@ function createEmitter({
19
19
  while (!queue.length) {
20
20
  await new Promise((_) => resolve = _);
21
21
  }
22
- const current = queue.pop();
22
+ const current = queue.shift();
23
23
  switch (current.type) {
24
24
  case "emit":
25
25
  return { value: current.value, done: false };
@@ -3,5 +3,11 @@ interface VerifyCloudHandshakeOptions {
3
3
  handshakeId: string;
4
4
  origin: string;
5
5
  }
6
+ export declare class CloudHandshakeError extends Error {
7
+ name: string;
8
+ }
9
+ export declare class CloudHandshakeServiceError extends Error {
10
+ name: string;
11
+ }
6
12
  export declare function verifyCloudHandshake(token: string, options: VerifyCloudHandshakeOptions): Promise<void>;
7
13
  export {};