rimecms 0.33.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter-sqlite/auth.server.d.ts +2 -2
- package/dist/adapter-sqlite/columns.server.js +2 -2
- package/dist/adapter-sqlite/connect.server.d.ts +12 -0
- package/dist/adapter-sqlite/connect.server.js +31 -0
- package/dist/adapter-sqlite/generate-schema/index.server.js +11 -3
- package/dist/adapter-sqlite/generate-schema/root.server.d.ts +13 -4
- package/dist/adapter-sqlite/generate-schema/root.server.js +75 -131
- package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +27 -6
- package/dist/adapter-sqlite/generate-schema/templates.server.js +52 -10
- package/dist/adapter-sqlite/index.server.d.ts +13 -5
- package/dist/adapter-sqlite/index.server.js +9 -6
- package/dist/adapter-sqlite/naming.server.d.ts +6 -8
- package/dist/adapter-sqlite/naming.server.js +22 -4
- package/dist/adapter-sqlite/paths.server.d.ts +10 -0
- package/dist/adapter-sqlite/paths.server.js +122 -0
- package/dist/adapter-sqlite/read.server.d.ts +10 -1
- package/dist/adapter-sqlite/read.server.js +22 -10
- package/dist/adapter-sqlite/select.server.d.ts +19 -0
- package/dist/adapter-sqlite/select.server.js +71 -63
- package/dist/adapter-sqlite/table.server.d.ts +2 -2
- package/dist/adapter-sqlite/transform.server.js +33 -3
- package/dist/adapter-sqlite/types.server.d.ts +10 -3
- package/dist/adapter-sqlite/where.server.d.ts +2 -3
- package/dist/adapter-sqlite/where.server.js +19 -1
- package/dist/core/adapter.d.ts +94 -0
- package/dist/core/auth/better-auth/config.server.d.ts +3 -3
- package/dist/core/auth/better-auth/instance.server.d.ts +6 -6
- package/dist/core/auth/handler/index.server.js +1 -1
- package/dist/core/auth/staff/derive.js +1 -1
- package/dist/core/auth/validate-config.js +3 -5
- package/dist/core/boot.server.d.ts +6 -6
- package/dist/core/config/types.d.ts +43 -5
- package/dist/core/config/validate.server.js +34 -51
- package/dist/core/dev/cli/commands/build.js +21 -6
- package/dist/core/dev/cli/commands/init.server.d.ts +2 -1
- package/dist/core/dev/cli/commands/init.server.js +32 -6
- package/dist/core/dev/cli/index.js +1 -0
- package/dist/core/dev/cli/templates/init.d.ts +6 -1
- package/dist/core/dev/cli/templates/init.js +30 -2
- package/dist/core/dev/cli/util/package-manager.server.d.ts +1 -0
- package/dist/core/dev/cli/util/package-manager.server.js +11 -8
- package/dist/core/dev/cli/util/package.server.d.ts +9 -0
- package/dist/core/dev/cli/util/package.server.js +43 -0
- package/dist/core/dev/codegen/types/contributions.server.d.ts +3 -2
- package/dist/core/dev/codegen/types/contributions.server.js +10 -3
- package/dist/core/dev/vite.server.js +4 -3
- package/dist/core/fields/blank.d.ts +21 -0
- package/dist/core/fields/blank.js +37 -0
- package/dist/core/fields/builders/field-builder.d.ts +53 -0
- package/dist/core/fields/builders/field-builder.js +14 -1
- package/dist/core/fields/builders/form-field-builder.d.ts +8 -0
- package/dist/core/fields/builders/form-field-builder.js +14 -1
- package/dist/core/fields/util.d.ts +9 -2
- package/dist/core/fields/util.js +123 -135
- package/dist/core/fields/walk.d.ts +44 -0
- package/dist/core/fields/walk.js +55 -0
- package/dist/core/handler.server.js +4 -0
- package/dist/core/i18n/context.d.ts +5 -0
- package/dist/core/i18n/context.js +6 -0
- package/dist/core/i18n/en/common.d.ts +71 -0
- package/dist/core/i18n/en/common.js +72 -1
- package/dist/core/i18n/en/fields.d.ts +68 -0
- package/dist/core/i18n/en/fields.js +69 -1
- package/dist/core/i18n/fr/common.d.ts +71 -0
- package/dist/core/i18n/fr/common.js +72 -1
- package/dist/core/i18n/fr/fields.d.ts +68 -0
- package/dist/core/i18n/fr/fields.js +69 -1
- package/dist/core/i18n/index.d.ts +29 -3
- package/dist/core/i18n/index.js +55 -29
- package/dist/core/locale/copy.server.js +3 -3
- package/dist/core/logger.server.js +15 -6
- package/dist/core/pipeline/build-document.server.d.ts +3 -0
- package/dist/core/pipeline/build-document.server.js +10 -7
- package/dist/core/pipeline/config-map/index.d.ts +9 -0
- package/dist/core/pipeline/config-map/index.js +16 -50
- package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +3 -0
- package/dist/core/pipeline/hooks/process-document-fields.server.js +48 -12
- package/dist/core/pipeline/hooks/set-default-values.server.d.ts +1 -0
- package/dist/core/pipeline/hooks/set-default-values.server.js +1 -0
- package/dist/core/pipeline/persist/blocks/extract.server.js +1 -1
- package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
- package/dist/core/pipeline/populate-relations.server.d.ts +27 -0
- package/dist/core/pipeline/populate-relations.server.js +42 -0
- package/dist/core/pipeline/run.server.d.ts +17 -6
- package/dist/core/pipeline/run.server.js +44 -30
- package/dist/core/plugins/cache/module.server.d.ts +1 -1
- package/dist/core/plugins/cache/module.server.js +5 -5
- package/dist/core/prototype/area/api.server.js +1 -2
- package/dist/core/prototype/area/definition.js +1 -10
- package/dist/core/prototype/area/definition.server.js +4 -5
- package/dist/core/prototype/area/hooks.server.js +3 -2
- package/dist/core/prototype/area/operations/find.js +2 -0
- package/dist/core/prototype/blank.d.ts +26 -0
- package/dist/core/prototype/blank.js +22 -0
- package/dist/core/prototype/collection/api.server.d.ts +29 -3
- package/dist/core/prototype/collection/api.server.js +47 -4
- package/dist/core/prototype/collection/definition.js +0 -3
- package/dist/core/prototype/collection/hooks/merge-with-blank.server.d.ts +5 -1
- package/dist/core/prototype/collection/hooks/merge-with-blank.server.js +8 -22
- package/dist/core/prototype/collection/hooks.server.js +11 -5
- package/dist/core/prototype/collection/nested/module.server.js +3 -1
- package/dist/core/prototype/collection/nested/tree.d.ts +12 -0
- package/dist/core/prototype/collection/nested/tree.js +42 -0
- package/dist/core/prototype/collection/operations/find-by-id.js +2 -0
- package/dist/core/prototype/collection/operations/find-by-ids.d.ts +19 -0
- package/dist/core/prototype/collection/operations/find-by-ids.js +54 -0
- package/dist/core/prototype/collection/operations/find.js +21 -27
- package/dist/core/prototype/collection/operations/update-slug-by-id.d.ts +20 -0
- package/dist/core/prototype/collection/operations/update-slug-by-id.js +53 -0
- package/dist/core/prototype/collection/rest/index.server.js +3 -1
- package/dist/core/prototype/collection/rest/update-slug-by-id.server.d.ts +2 -0
- package/dist/core/prototype/collection/rest/update-slug-by-id.server.js +20 -0
- package/dist/core/prototype/collection/thumbnail/find-thumbnail.d.ts +2 -1
- package/dist/core/prototype/collection/thumbnail/find-thumbnail.js +4 -27
- package/dist/core/prototype/collection/upload/directories/derive.js +3 -1
- package/dist/core/prototype/collection/upload/disk/delete.server.js +1 -2
- package/dist/core/prototype/define.js +2 -0
- package/dist/core/prototype/shared/metas/fields.js +2 -1
- package/dist/core/prototype/shared/title/find-title.d.ts +2 -1
- package/dist/core/prototype/shared/title/find-title.js +5 -28
- package/dist/core/prototype/shared/url/addresses.server.d.ts +26 -0
- package/dist/core/prototype/shared/url/addresses.server.js +119 -0
- package/dist/core/prototype/shared/url/doc-type.d.ts +6 -0
- package/dist/core/prototype/shared/url/doc-type.js +9 -0
- package/dist/core/prototype/shared/url/format.server.d.ts +27 -0
- package/dist/core/prototype/shared/url/format.server.js +38 -0
- package/dist/core/prototype/shared/url/hooks/create-paths.server.d.ts +2 -0
- package/dist/core/prototype/shared/url/hooks/create-paths.server.js +9 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.d.ts +5 -0
- package/dist/core/prototype/shared/url/hooks/detach-paths.server.js +18 -0
- package/dist/core/prototype/shared/url/hooks/index.server.d.ts +5 -1
- package/dist/core/prototype/shared/url/hooks/index.server.js +5 -1
- package/dist/core/prototype/shared/url/hooks/set-area-url.server.d.ts +2 -0
- package/dist/core/prototype/shared/url/hooks/set-area-url.server.js +8 -0
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.d.ts +5 -0
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +19 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.d.ts +7 -0
- package/dist/core/prototype/shared/url/hooks/sync-paths.server.js +37 -0
- package/dist/core/prototype/shared/url/refresh.server.d.ts +36 -0
- package/dist/core/prototype/shared/url/refresh.server.js +58 -0
- package/dist/core/prototype/shared/versions/configure.server.js +3 -0
- package/dist/core/routes/context.server.d.ts +2 -1
- package/dist/fields/blocks/component/AddBlockButton.svelte +48 -137
- package/dist/fields/blocks/component/Block.svelte +153 -117
- package/dist/fields/blocks/component/Block.svelte.d.ts +11 -5
- package/dist/fields/blocks/component/BlockActions.svelte +76 -26
- package/dist/fields/blocks/component/BlockActions.svelte.d.ts +3 -0
- package/dist/fields/blocks/component/Blocks.svelte +248 -91
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte +680 -0
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte.d.ts +7 -0
- package/dist/fields/blocks/component/focus/Layers.svelte +145 -0
- package/dist/fields/blocks/component/focus/Layers.svelte.d.ts +9 -0
- package/dist/fields/blocks/component/focus/LayersList.svelte +304 -0
- package/dist/fields/blocks/component/focus/LayersList.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/focus/Palette.svelte +135 -0
- package/dist/fields/blocks/component/focus/Palette.svelte.d.ts +9 -0
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte +77 -0
- package/dist/fields/blocks/component/focus/RenderPlaceholder.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/focus/Renders.svelte +302 -0
- package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +11 -0
- package/dist/fields/blocks/component/focus/Stage.svelte +190 -0
- package/dist/fields/blocks/component/focus/Stage.svelte.d.ts +8 -0
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte +69 -0
- package/dist/fields/blocks/component/focus/StagePlaceholder.svelte.d.ts +3 -0
- package/dist/fields/blocks/component/focus/focus.svelte.d.ts +140 -0
- package/dist/fields/blocks/component/focus/focus.svelte.js +424 -0
- package/dist/fields/blocks/component/picker/BlockPicker.svelte +88 -0
- package/dist/fields/blocks/component/picker/BlockPicker.svelte.d.ts +10 -0
- package/dist/fields/blocks/component/picker/BlockTile.svelte +121 -0
- package/dist/fields/blocks/component/picker/BlockTile.svelte.d.ts +12 -0
- package/dist/fields/blocks/index.d.ts +49 -7
- package/dist/fields/blocks/index.js +61 -12
- package/dist/fields/checkbox/component/Checkbox.svelte +11 -37
- package/dist/fields/checkbox/component/Checkbox.svelte.d.ts +1 -0
- package/dist/fields/combobox/component/ComboBox.svelte +37 -7
- package/dist/fields/combobox/component/combobox.css +26 -10
- package/dist/fields/date/component/Date.svelte +43 -12
- package/dist/fields/group/component/Group.svelte +110 -41
- package/dist/fields/group/index.d.ts +5 -1
- package/dist/fields/group/index.js +10 -2
- package/dist/fields/link/component/Link.svelte +184 -143
- package/dist/fields/link/component/RessourceInput.svelte +26 -24
- package/dist/fields/link/index.d.ts +1 -0
- package/dist/fields/link/module.server.js +2 -4
- package/dist/fields/number/component/Number.svelte +38 -20
- package/dist/fields/number/component/number.css +22 -20
- package/dist/fields/number/index.d.ts +1 -0
- package/dist/fields/radio/component/Radio.svelte +12 -0
- package/dist/fields/radio/index.js +1 -1
- package/dist/fields/relation/component/Relation.svelte +169 -40
- package/dist/fields/relation/component/RelationInline.svelte +258 -0
- package/dist/fields/relation/component/RelationInline.svelte.d.ts +26 -0
- package/dist/fields/relation/component/default/Default.svelte +210 -100
- package/dist/fields/relation/component/default/Default.svelte.d.ts +14 -1
- package/dist/fields/relation/component/types.d.ts +4 -0
- package/dist/fields/relation/component/upload/Browse.svelte +619 -88
- package/dist/fields/relation/component/upload/Browse.svelte.d.ts +10 -2
- package/dist/fields/relation/component/upload/Create.svelte +41 -0
- package/dist/fields/relation/component/upload/Create.svelte.d.ts +13 -0
- package/dist/fields/relation/component/upload/Upload.svelte +287 -101
- package/dist/fields/relation/component/upload/Upload.svelte.d.ts +6 -1
- package/dist/fields/relation/component/upload/upload.css +5 -81
- package/dist/fields/relation/module.server.js +7 -1
- package/dist/fields/relation/value.d.ts +25 -0
- package/dist/fields/relation/value.js +27 -0
- package/dist/fields/rich-text/component/RichText.svelte +12 -80
- package/dist/fields/rich-text/component/RichText.svelte.d.ts +1 -1
- package/dist/fields/rich-text/component/RichTextInline.svelte +28 -0
- package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +11 -0
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.css +4 -3
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +3 -1
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +2 -2
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +7 -10
- package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -2
- package/dist/fields/rich-text/component/styles/editor.css +111 -0
- package/dist/fields/rich-text/component/styles/field.css +71 -0
- package/dist/fields/rich-text/component/suggestion/suggestion.svelte +41 -56
- package/dist/fields/rich-text/core/build-editor-config.js +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +29 -3
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +2 -1
- package/dist/fields/rich-text/core/features/fields/fields.css +2 -3
- package/dist/fields/rich-text/core/features/hr/hr.css +4 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +24 -8
- package/dist/fields/rich-text/core/features/resource/resource.svelte +20 -6
- package/dist/fields/rich-text/core/features/upload/upload.svelte +20 -8
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte +103 -0
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +15 -0
- package/dist/fields/select/component/Select.svelte +67 -28
- package/dist/fields/slug/component/Slug.svelte +26 -53
- package/dist/fields/slug/index.d.ts +1 -0
- package/dist/fields/slug/index.js +1 -1
- package/dist/fields/tabs/component/Tabs.svelte +28 -22
- package/dist/fields/tabs/index.d.ts +4 -1
- package/dist/fields/tabs/index.js +17 -5
- package/dist/fields/text/index.d.ts +1 -0
- package/dist/fields/textarea/component/TextArea.svelte +28 -13
- package/dist/fields/textarea/index.d.ts +1 -0
- package/dist/fields/time/component/Time.svelte +9 -2
- package/dist/fields/toggle/component/Toggle.svelte +8 -25
- package/dist/fields/toggle/component/Toggle.svelte.d.ts +1 -0
- package/dist/fields/toggle/index.d.ts +1 -0
- package/dist/fields/tree/component/AddItemButton.svelte +18 -5
- package/dist/fields/tree/component/Tree.svelte +48 -19
- package/dist/fields/tree/component/TreeBlock.svelte +318 -104
- package/dist/fields/tree/component/TreeBlockActions.svelte +71 -7
- package/dist/fields/tree/component/TreeBlockActions.svelte.d.ts +4 -0
- package/dist/fields/tree/component/props.d.ts +2 -1
- package/dist/fields/tree/index.d.ts +13 -1
- package/dist/fields/tree/index.js +35 -9
- package/dist/fields/types.d.ts +3 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +3 -2
- package/dist/panel/components/Root.svelte +16 -44
- package/dist/panel/components/Root.svelte.d.ts +1 -1
- package/dist/panel/components/fields/Error.svelte +18 -3
- package/dist/panel/components/fields/FieldsPreview.svelte +30 -17
- package/dist/panel/components/fields/FieldsPreviewTrigger.svelte +25 -3
- package/dist/panel/components/fields/Hint.svelte +51 -8
- package/dist/panel/components/fields/Hint.svelte.d.ts +11 -0
- package/dist/panel/components/fields/Label.svelte +2 -0
- package/dist/panel/components/fields/LabelFor.svelte +7 -2
- package/dist/panel/components/fields/RenderFields.svelte +10 -3
- package/dist/panel/components/fields/fieldset.svelte.d.ts +4 -1
- package/dist/panel/components/fields/fieldset.svelte.js +9 -2
- package/dist/panel/components/fields/index.d.ts +1 -0
- package/dist/panel/components/fields/setting.css +82 -0
- package/dist/panel/components/sections/auth/AuthForm.svelte +25 -26
- package/dist/panel/components/sections/collection/Avatar.svelte +61 -0
- package/dist/panel/components/sections/collection/Avatar.svelte.d.ts +9 -0
- package/dist/panel/components/sections/collection/DocStatus.svelte +28 -0
- package/dist/panel/components/sections/collection/DocStatus.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/Empty.svelte +3 -3
- package/dist/panel/components/sections/collection/StatusDot.svelte +7 -5
- package/dist/panel/components/sections/collection/When.svelte +33 -0
- package/dist/panel/components/sections/collection/When.svelte.d.ts +8 -0
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte +65 -21
- package/dist/panel/components/sections/collection/bulk-upload/BulkUploadDialog.svelte.d.ts +3 -2
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte +45 -162
- package/dist/panel/components/sections/collection/bulk-upload/DropZone.svelte.d.ts +3 -2
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +151 -0
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte.d.ts +17 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +177 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte.d.ts +12 -0
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte +75 -0
- package/dist/panel/components/sections/collection/bulk-upload/UploadProgress.svelte.d.ts +8 -0
- package/dist/panel/components/sections/collection/folder/Folder.svelte +18 -3
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +26 -18
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +98 -58
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte.d.ts +0 -1
- package/dist/panel/components/sections/collection/folder/Folders.svelte +60 -0
- package/dist/panel/components/sections/collection/folder/Folders.svelte.d.ts +7 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +31 -71
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +1 -0
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +5 -3
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +250 -37
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte.d.ts +2 -0
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +43 -18
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte.d.ts +6 -4
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte +69 -58
- package/dist/panel/components/sections/collection/header/DisplayMode.svelte.d.ts +0 -1
- package/dist/panel/components/sections/collection/header/FilterMenu.svelte +60 -0
- package/dist/panel/components/sections/collection/header/FilterMenu.svelte.d.ts +14 -0
- package/dist/panel/components/sections/collection/header/SearchInput.svelte +17 -26
- package/dist/panel/components/sections/collection/header/SelectUI.svelte +19 -34
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +99 -68
- package/dist/panel/components/sections/collection/list/columns.d.ts +21 -0
- package/dist/panel/components/sections/collection/list/columns.js +23 -0
- package/dist/panel/components/sections/collection/list/header/Header.svelte +99 -51
- package/dist/panel/components/sections/collection/list/row/Row.svelte +165 -82
- package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -0
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +92 -44
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte.d.ts +1 -0
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +139 -43
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte.d.ts +2 -0
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +1 -1
- package/dist/panel/components/sections/commands/CommandButton.svelte +99 -0
- package/dist/panel/components/sections/commands/CommandButton.svelte.d.ts +10 -0
- package/dist/panel/components/sections/commands/CommandPalette.svelte +275 -0
- package/dist/panel/components/sections/commands/CommandPalette.svelte.d.ts +8 -0
- package/dist/panel/components/sections/commands/Commands.svelte +18 -0
- package/dist/panel/components/sections/commands/Commands.svelte.d.ts +9 -0
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +23 -7
- package/dist/panel/components/sections/document/AuthFooter.svelte +31 -12
- package/dist/panel/components/sections/document/AutoSaveBanner.svelte +24 -7
- package/dist/panel/components/sections/document/ButtonSave.svelte +32 -21
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +5 -5
- package/dist/panel/components/sections/document/ButtonStatus.svelte +68 -20
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +199 -0
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte.d.ts +10 -0
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte +2 -2
- package/dist/panel/components/sections/document/Document.svelte +96 -65
- package/dist/panel/components/sections/document/DocumentChildren.svelte +175 -0
- package/dist/panel/components/sections/document/DocumentChildren.svelte.d.ts +8 -0
- package/dist/panel/components/sections/document/DocumentUrl.svelte +119 -0
- package/dist/panel/components/sections/document/DocumentUrl.svelte.d.ts +9 -0
- package/dist/panel/components/sections/document/Header.svelte +171 -94
- package/dist/panel/components/sections/document/Settings.svelte +255 -110
- package/dist/panel/components/sections/document/Settings.svelte.d.ts +0 -1
- package/dist/panel/components/sections/document/Versions.svelte +5 -3
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +112 -53
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -2
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +74 -41
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +1 -1
- package/dist/panel/components/sections/live/LiveEdit.svelte +2 -2
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte +30 -11
- package/dist/panel/components/sections/live/live-edit-panel.css +2 -2
- package/dist/panel/components/sections/page-layout/Page.svelte +13 -1
- package/dist/panel/components/ui/breadcrumb/BreadCrumb.svelte +55 -27
- package/dist/panel/components/ui/button/button.svelte +81 -54
- package/dist/panel/components/ui/button/index.d.ts +7 -3
- package/dist/panel/components/ui/button/index.js +2 -2
- package/dist/panel/components/ui/calendar/calendar.css +27 -27
- package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/card/card-description.svelte +1 -1
- package/dist/panel/components/ui/card/card.svelte +21 -4
- package/dist/panel/components/ui/card-document/card-document.svelte +24 -12
- package/dist/panel/components/ui/card-resource/card-resource.svelte +26 -8
- package/dist/panel/components/ui/checkbox/checkbox.css +8 -10
- package/dist/panel/components/ui/command/command-dialog.css +28 -4
- package/dist/panel/components/ui/command/command-dialog.svelte +4 -1
- package/dist/panel/components/ui/command/command-dialog.svelte.d.ts +2 -0
- package/dist/panel/components/ui/command/command-empty.css +1 -1
- package/dist/panel/components/ui/command/command-group.css +3 -3
- package/dist/panel/components/ui/command/command-input-select.svelte +3 -3
- package/dist/panel/components/ui/command/command-input.svelte +38 -14
- package/dist/panel/components/ui/command/command-input.svelte.d.ts +6 -1
- package/dist/panel/components/ui/command/command-item.css +2 -2
- package/dist/panel/components/ui/command/command-list.css +1 -1
- package/dist/panel/components/ui/command/command-separator.css +1 -1
- package/dist/panel/components/ui/context-menu/context-menu-item.css +2 -2
- package/dist/panel/components/ui/context-menu/context-menu.css +6 -7
- package/dist/panel/components/ui/dialog/dialog-content.css +8 -10
- package/dist/panel/components/ui/dialog/dialog-content.svelte +19 -0
- package/dist/panel/components/ui/dialog/dialog-description.css +1 -1
- package/dist/panel/components/ui/dialog/dialog-footer.svelte +5 -1
- package/dist/panel/components/ui/dialog/dialog-overlay.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +19 -5
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +6 -4
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-item.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-radio-item.css +1 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-separator.css +1 -1
- package/dist/panel/components/ui/input/input.svelte +57 -31
- package/dist/panel/components/ui/kbd/Kbd.svelte +90 -0
- package/dist/panel/components/ui/kbd/Kbd.svelte.d.ts +11 -0
- package/dist/panel/components/ui/kbd/index.d.ts +1 -0
- package/dist/panel/components/ui/kbd/index.js +1 -0
- package/dist/panel/components/ui/label/label.css +5 -3
- package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +27 -15
- package/dist/panel/components/ui/nav/Nav.svelte +180 -110
- package/dist/panel/components/ui/nav/Nav.svelte.d.ts +0 -2
- package/dist/panel/components/ui/nav/NavGroup.svelte +87 -73
- package/dist/panel/components/ui/nav/NavItemButton.svelte +69 -29
- package/dist/panel/components/ui/nav/UserButton.svelte +132 -71
- package/dist/panel/components/ui/page-header/PageHeader.svelte +140 -42
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +8 -1
- package/dist/panel/components/ui/popover/popover-content.css +4 -3
- package/dist/panel/components/ui/radio-group/radio-group.css +4 -6
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +19 -7
- package/dist/panel/components/ui/scroll-area/scroll-area.css +2 -2
- package/dist/panel/components/ui/separator/separator.svelte +1 -1
- package/dist/panel/components/ui/sheet/index.d.ts +4 -4
- package/dist/panel/components/ui/sheet/index.js +5 -5
- package/dist/panel/components/ui/sheet/sheet.css +50 -11
- package/dist/panel/components/ui/sonner/sonner.css +11 -8
- package/dist/panel/components/ui/switch/switch.css +13 -18
- package/dist/panel/components/ui/tabs/tabs.css +44 -35
- package/dist/panel/components/ui/tag/tag.svelte +20 -6
- package/dist/panel/components/ui/tooltip/tooltip-content.svelte +14 -4
- package/dist/panel/components/ui/tree/tree-rows.css +146 -0
- package/dist/panel/context/blocks-ops.d.ts +78 -0
- package/dist/panel/context/blocks-ops.js +170 -0
- package/dist/panel/context/collection.svelte.d.ts +28 -0
- package/dist/panel/context/collection.svelte.js +120 -65
- package/dist/panel/context/commands.svelte.d.ts +80 -0
- package/dist/panel/context/commands.svelte.js +108 -0
- package/dist/panel/context/documentForm.svelte.d.ts +34 -2
- package/dist/panel/context/documentForm.svelte.js +105 -102
- package/dist/panel/context/live.svelte.js +2 -73
- package/dist/panel/context/nav.svelte.d.ts +23 -0
- package/dist/panel/context/nav.svelte.js +56 -0
- package/dist/panel/fonts/Geist-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/GeistMono-VariableFont_wght.ttf +0 -0
- package/dist/panel/index.d.ts +7 -1
- package/dist/panel/index.js +10 -1
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +16 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +236 -61
- package/dist/panel/pages/collection/load.server.js +1 -1
- package/dist/panel/pages/dashboard/Dashboard.svelte +135 -90
- package/dist/panel/pages/dashboard/DashboardCard.svelte +109 -0
- package/dist/panel/pages/dashboard/DashboardCard.svelte.d.ts +14 -0
- package/dist/panel/pages/dashboard/DashboardCollection.svelte +180 -57
- package/dist/panel/pages/dashboard/DashboardCollection.svelte.d.ts +1 -0
- package/dist/panel/pages/dashboard/DashboardRow.svelte +93 -0
- package/dist/panel/pages/dashboard/DashboardRow.svelte.d.ts +16 -0
- package/dist/panel/pages/dashboard/load.server.js +49 -25
- package/dist/panel/pages/dashboard/time.d.ts +19 -0
- package/dist/panel/pages/dashboard/time.js +29 -0
- package/dist/panel/pages/dashboard/types.d.ts +9 -2
- package/dist/panel/pages/live/Live.svelte +53 -50
- package/dist/panel/style/font.css +21 -32
- package/dist/panel/style/index.css +191 -122
- package/dist/panel/style/mixins/index.css +14 -0
- package/dist/panel/style/palette.css +35 -26
- package/dist/panel/style/postcss/size-function.d.ts +4 -0
- package/dist/panel/style/postcss/size-function.js +24 -0
- package/dist/panel/style/radius.css +4 -5
- package/dist/panel/style/scheme.css +111 -0
- package/dist/panel/style/size.css +3 -0
- package/dist/panel/util/Sortable.js +9 -4
- package/dist/panel/util/keys.d.ts +24 -0
- package/dist/panel/util/keys.js +63 -0
- package/dist/panel/util/populate.d.ts +8 -0
- package/dist/panel/util/populate.js +49 -0
- package/dist/panel/util/time.d.ts +12 -0
- package/dist/panel/util/time.js +35 -0
- package/dist/panel/util/upload-file.d.ts +106 -0
- package/dist/panel/util/upload-file.js +165 -0
- package/dist/util/index.d.ts +7 -10
- package/dist/util/index.js +7 -8
- package/dist/util/object.d.ts +10 -0
- package/dist/util/object.js +22 -1
- package/dist/util/string.d.ts +17 -0
- package/dist/util/string.js +23 -0
- package/package.json +1 -3
- package/dist/core/pipeline/config-map/build-tree-map.d.ts +0 -4
- package/dist/core/pipeline/config-map/build-tree-map.js +0 -30
- package/dist/core/prototype/doc.d.ts +0 -31
- package/dist/core/prototype/doc.js +0 -118
- package/dist/core/prototype/shared/url/augment.d.ts +0 -13
- package/dist/core/prototype/shared/url/augment.js +0 -11
- package/dist/core/prototype/shared/url/hooks/populate-url.server.d.ts +0 -4
- package/dist/core/prototype/shared/url/hooks/populate-url.server.js +0 -120
- package/dist/fields/rich-text/component/styles/rich-text.css +0 -183
- package/dist/panel/components/sections/collection/header/Header.svelte +0 -17
- package/dist/panel/components/sections/collection/header/Header.svelte.d.ts +0 -3
- package/dist/panel/components/sections/collection/header/Separator.svelte +0 -8
- package/dist/panel/components/sections/collection/header/Separator.svelte.d.ts +0 -26
- package/dist/panel/components/sections/collection/tree/util.d.ts +0 -12
- package/dist/panel/components/sections/collection/tree/util.js +0 -22
- package/dist/panel/fonts/ChivoMono-Italic-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/ChivoMono-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/dist/panel/fonts/Lora-Italic-VariableFont_wght.ttf +0 -0
- package/dist/panel/fonts/Lora-VariableFont_wght.ttf +0 -0
- package/dist/panel/style/shadow.css +0 -10
- package/dist/util/path.d.ts +0 -16
- package/dist/util/path.js +0 -19
|
@@ -1286,7 +1286,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
1286
1286
|
$Infer: {
|
|
1287
1287
|
body: {
|
|
1288
1288
|
userId: string;
|
|
1289
|
-
role: "user" | "
|
|
1289
|
+
role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
|
|
1290
1290
|
};
|
|
1291
1291
|
};
|
|
1292
1292
|
};
|
|
@@ -1375,7 +1375,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
1375
1375
|
email: string;
|
|
1376
1376
|
password?: string | undefined;
|
|
1377
1377
|
name: string;
|
|
1378
|
-
role?: "user" | "
|
|
1378
|
+
role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
|
|
1379
1379
|
data?: Record<string, any> | undefined;
|
|
1380
1380
|
};
|
|
1381
1381
|
};
|
|
@@ -1999,7 +1999,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
1999
1999
|
};
|
|
2000
2000
|
} & {
|
|
2001
2001
|
userId?: string | undefined;
|
|
2002
|
-
role?: "user" | "
|
|
2002
|
+
role?: "user" | "staff" | "admin" | undefined;
|
|
2003
2003
|
};
|
|
2004
2004
|
};
|
|
2005
2005
|
};
|
|
@@ -3357,7 +3357,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
3357
3357
|
$Infer: {
|
|
3358
3358
|
body: {
|
|
3359
3359
|
userId: string;
|
|
3360
|
-
role: "user" | "
|
|
3360
|
+
role: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[];
|
|
3361
3361
|
};
|
|
3362
3362
|
};
|
|
3363
3363
|
};
|
|
@@ -3446,7 +3446,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
3446
3446
|
email: string;
|
|
3447
3447
|
password?: string | undefined;
|
|
3448
3448
|
name: string;
|
|
3449
|
-
role?: "user" | "
|
|
3449
|
+
role?: "user" | "staff" | "admin" | ("user" | "staff" | "admin")[] | undefined;
|
|
3450
3450
|
data?: Record<string, any> | undefined;
|
|
3451
3451
|
};
|
|
3452
3452
|
};
|
|
@@ -4070,7 +4070,7 @@ export declare const bootRime: <const C extends Config>(config: BuildConfig<C>)
|
|
|
4070
4070
|
};
|
|
4071
4071
|
} & {
|
|
4072
4072
|
userId?: string | undefined;
|
|
4073
|
-
role?: "user" | "
|
|
4073
|
+
role?: "user" | "staff" | "admin" | undefined;
|
|
4074
4074
|
};
|
|
4075
4075
|
};
|
|
4076
4076
|
};
|
|
@@ -20,7 +20,7 @@ import type { IconProps } from '@lucide/svelte';
|
|
|
20
20
|
import type { RequestEvent, RequestHandler } from '@sveltejs/kit';
|
|
21
21
|
import type { Component } from 'svelte';
|
|
22
22
|
import type { FieldBuilder } from '../fields/builders/index.js';
|
|
23
|
-
import type { DocType } from '../prototype/types.js';
|
|
23
|
+
import type { DocType, GenericDoc } from '../prototype/types.js';
|
|
24
24
|
/**
|
|
25
25
|
* What an author writes.
|
|
26
26
|
*
|
|
@@ -38,6 +38,8 @@ export interface Config {
|
|
|
38
38
|
/** If config.siteUrl is defined, a preview button is added
|
|
39
39
|
on the panel dahsboard, pointing to this url */
|
|
40
40
|
siteUrl?: string;
|
|
41
|
+
/** The name at the top of the panel's sidebar. Without it, the host of `siteUrl`, then "rime". */
|
|
42
|
+
siteName?: string;
|
|
41
43
|
/**
|
|
42
44
|
* Database adapter
|
|
43
45
|
* @example
|
|
@@ -141,6 +143,27 @@ type PrototypeConfig<S extends string = string> = {
|
|
|
141
143
|
/** If the document can be edited live, if enabled the url prop must be set also. */
|
|
142
144
|
live?: boolean;
|
|
143
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* What `$url` is given to format a document's url.
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
150
|
+
* $url: ({ path, locale, doc }) => `/${locale}/${path.join('/')}`
|
|
151
|
+
* // path ['services', 'web'], slug 'web', locale 'en' -> '/en/services/web'
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* A pure, synchronous function of these: the url is stored when a page is saved or moved, and
|
|
155
|
+
* found by, so it has to come from nothing else. A relative url is made absolute against
|
|
156
|
+
* `PUBLIC_RIME_URL`.
|
|
157
|
+
*/
|
|
158
|
+
export type UrlArgs<Doc> = {
|
|
159
|
+
/** The slugs from the top page down to this one; empty for an area. */
|
|
160
|
+
path: string[];
|
|
161
|
+
/** This page's own slug; empty for an area. */
|
|
162
|
+
slug: string;
|
|
163
|
+
/** The locale the url is for; empty when the config has no localization. */
|
|
164
|
+
locale: string;
|
|
165
|
+
doc: Doc;
|
|
166
|
+
};
|
|
144
167
|
export type Collection<S> = {
|
|
145
168
|
slug: S;
|
|
146
169
|
/** The collection label */
|
|
@@ -149,8 +172,11 @@ export type Collection<S> = {
|
|
|
149
172
|
auth?: boolean | CollectionAuthConfig;
|
|
150
173
|
/** Operation hooks */
|
|
151
174
|
$hooks?: CollectionHooks<S extends keyof RegisterCollection ? S : any>;
|
|
152
|
-
/**
|
|
153
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Formats a document's url from its address. With it, each page gets a built-in slug, an address
|
|
177
|
+
* per locale, and `url`, `_urlPath`, `_slug` on its documents. See `UrlArgs`.
|
|
178
|
+
*/
|
|
179
|
+
$url?: (args: UrlArgs<S extends keyof RegisterCollection ? RegisterCollection[S] : any>) => string;
|
|
154
180
|
/** Whether a document can have children/parent */
|
|
155
181
|
nested?: boolean;
|
|
156
182
|
/** Whether the collection support file upload */
|
|
@@ -160,8 +186,8 @@ export type Collection<S> = {
|
|
|
160
186
|
} & PrototypeConfig;
|
|
161
187
|
export type Area<S> = PrototypeConfig & {
|
|
162
188
|
slug: S;
|
|
163
|
-
/**
|
|
164
|
-
$url?: (
|
|
189
|
+
/** Formats the area's url, on read: `path` and `slug` are empty. See `UrlArgs`. */
|
|
190
|
+
$url?: (args: UrlArgs<S extends keyof RegisterArea ? RegisterArea[S] : any>) => string;
|
|
165
191
|
$hooks?: AreaHooks<S extends keyof RegisterArea ? S : any>;
|
|
166
192
|
/** The area label */
|
|
167
193
|
label?: string;
|
|
@@ -176,6 +202,11 @@ export type Area<S> = PrototypeConfig & {
|
|
|
176
202
|
export type BuiltCollection = Omit<Collection<string>, 'icon' | 'versions' | 'upload' | 'auth'> & {
|
|
177
203
|
slug: CollectionSlug;
|
|
178
204
|
type: 'collection';
|
|
205
|
+
/**
|
|
206
|
+
* A document of this config's shape with every default applied, and no id — see
|
|
207
|
+
* `prototype/blank.ts`, which every config carries as this method.
|
|
208
|
+
*/
|
|
209
|
+
blank(event?: RequestEvent): GenericDoc;
|
|
179
210
|
/** Make fields mandatory */
|
|
180
211
|
fields: FieldBuilder<Field>[];
|
|
181
212
|
/** The kebab-case version of the slug for urls */
|
|
@@ -230,6 +261,11 @@ export type BuiltAreaClient = BuiltArea;
|
|
|
230
261
|
export type BuiltArea = Omit<Area<string>, 'versions'> & {
|
|
231
262
|
slug: AreaSlug;
|
|
232
263
|
type: 'area';
|
|
264
|
+
/**
|
|
265
|
+
* A document of this config's shape with every default applied, and no id — see
|
|
266
|
+
* `prototype/blank.ts`, which every config carries as this method.
|
|
267
|
+
*/
|
|
268
|
+
blank(event?: RequestEvent): GenericDoc;
|
|
233
269
|
/** Make fields mandatory */
|
|
234
270
|
fields: FieldBuilder<Field>[];
|
|
235
271
|
/** The kebab-case version of the slug for urls */
|
|
@@ -266,6 +302,8 @@ export type BuiltConfig = {
|
|
|
266
302
|
$database: string;
|
|
267
303
|
/** The database location */
|
|
268
304
|
siteUrl?: string;
|
|
305
|
+
/** The name at the top of the panel's sidebar. */
|
|
306
|
+
siteName?: string;
|
|
269
307
|
/** Define wich language the cms support */
|
|
270
308
|
localization?: LocalizationConfig;
|
|
271
309
|
icons: Record<string, any>;
|
|
@@ -4,10 +4,8 @@ import cache from '../dev/cache.server.js';
|
|
|
4
4
|
import { isFormField } from '../fields/util.js';
|
|
5
5
|
import { logger } from '../logger.server.js';
|
|
6
6
|
import { BlocksBuilder } from '../../fields/blocks/index.js';
|
|
7
|
-
import { GroupFieldBuilder } from '../../fields/group/index.js';
|
|
8
7
|
import { RelationFieldBuilder } from '../../fields/relation/index.js';
|
|
9
8
|
import { TabsBuilder } from '../../fields/tabs/index.js';
|
|
10
|
-
import { TreeBuilder } from '../../fields/tree/index.js';
|
|
11
9
|
import { prototypeKebab } from '../prototype/naming.js';
|
|
12
10
|
import { isCamelCase } from '../../util/string.js';
|
|
13
11
|
function hasDuplicates(arr) {
|
|
@@ -92,10 +90,7 @@ const validateDocumentFields = (documentConfig, config) => {
|
|
|
92
90
|
const validateBlockField = (fields, blockType) => {
|
|
93
91
|
const reserved = ['path', 'type', 'ownerId', 'position', 'locale'];
|
|
94
92
|
for (const key of reserved) {
|
|
95
|
-
if (fields
|
|
96
|
-
.filter(isFormField)
|
|
97
|
-
.map((f) => f.name)
|
|
98
|
-
.filter((name) => name === key).length > 1) {
|
|
93
|
+
if (fields.filter((field) => field.name === key).length > 1) {
|
|
99
94
|
errors.push(`${key} is a reserved field in blocks (block ${blockType})`);
|
|
100
95
|
}
|
|
101
96
|
}
|
|
@@ -133,57 +128,45 @@ const validateDocumentFields = (documentConfig, config) => {
|
|
|
133
128
|
}
|
|
134
129
|
}
|
|
135
130
|
for (const field of fields) {
|
|
136
|
-
//
|
|
137
|
-
if (field instanceof TabsBuilder)
|
|
131
|
+
// Tabs are not form fields, so their own rule runs before the form-field checks.
|
|
132
|
+
if (field instanceof TabsBuilder)
|
|
138
133
|
validateTabs(field);
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
if (isFormField(field)) {
|
|
135
|
+
// A `$root()` field sits on the base row, which has no locales branch.
|
|
136
|
+
if (field.get.root && field.get.localized) {
|
|
137
|
+
errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} with $root(), can't be localized`);
|
|
141
138
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
// Recursive check into Blocks
|
|
161
|
-
if (field instanceof BlocksBuilder) {
|
|
162
|
-
for (const block of field.get.blocks) {
|
|
163
|
-
if (block.name in registeredBlocks) {
|
|
164
|
-
const blockDefinedButDiffer = JSON.stringify(registeredBlocks[block.name]) !== JSON.stringify(block);
|
|
165
|
-
if (blockDefinedButDiffer) {
|
|
166
|
-
errors.push(`Each block with same name should be identique (block ${block.name})`);
|
|
139
|
+
// A resolved reference is joined from a column of the row; a localized column is on the
|
|
140
|
+
// locales branch, where no join reaches it.
|
|
141
|
+
if (field._references?.resolve && field.get.localized) {
|
|
142
|
+
errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} with a resolved reference, can't be localized`);
|
|
143
|
+
}
|
|
144
|
+
// Check for malformed field.name
|
|
145
|
+
if (!validateFieldName(field.name)) {
|
|
146
|
+
errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} should be camelCase`);
|
|
147
|
+
}
|
|
148
|
+
// A blocks rule, not a walk: it compares whole block builders, which a node does not carry.
|
|
149
|
+
if (field instanceof BlocksBuilder) {
|
|
150
|
+
for (const block of field.get.blocks) {
|
|
151
|
+
if (block.name in registeredBlocks) {
|
|
152
|
+
const blockDefinedButDiffer = JSON.stringify(registeredBlocks[block.name]) !== JSON.stringify(block);
|
|
153
|
+
if (blockDefinedButDiffer) {
|
|
154
|
+
errors.push(`Each block with same name should be identique (block ${block.name})`);
|
|
155
|
+
}
|
|
167
156
|
}
|
|
157
|
+
else {
|
|
158
|
+
registeredBlocks[block.name] = block;
|
|
159
|
+
}
|
|
160
|
+
validateBlockField(block.get.fields, block.name);
|
|
168
161
|
}
|
|
169
|
-
else {
|
|
170
|
-
registeredBlocks[block.name] = block;
|
|
171
|
-
}
|
|
172
|
-
validateFields(block.get.fields.filter(isFormField));
|
|
173
|
-
validateBlockField(block.get.fields.filter(isFormField), block.name);
|
|
174
162
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
validateFields(field.get.fields.filter(isFormField));
|
|
179
|
-
// Recursive check into Tabs
|
|
180
|
-
}
|
|
181
|
-
else if (field instanceof GroupFieldBuilder) {
|
|
182
|
-
validateFields(field.get.fields.filter(isFormField));
|
|
183
|
-
// Check relation field
|
|
163
|
+
else if (field instanceof RelationFieldBuilder) {
|
|
164
|
+
validateRelationField(field);
|
|
165
|
+
}
|
|
184
166
|
}
|
|
185
|
-
|
|
186
|
-
|
|
167
|
+
// Every block type, every tab, a group's and a tree row's fields: one level each.
|
|
168
|
+
for (const node of field.use.nodes()) {
|
|
169
|
+
validateFields(node.fields);
|
|
187
170
|
}
|
|
188
171
|
}
|
|
189
172
|
};
|
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { spawnSync } from 'child_process';
|
|
5
5
|
import { copyFileSync, cpSync, existsSync, mkdirSync, renameSync, rmSync, writeFileSync } from 'fs';
|
|
6
6
|
import { getInvokingPackageManager } from '../util/package-manager.server.js';
|
|
7
|
+
import { usesBunScripts } from '../util/package.server.js';
|
|
7
8
|
import { envProduction, nodeServer } from '../templates/build.js';
|
|
8
9
|
const installCommands = {
|
|
9
10
|
pnpm: {
|
|
@@ -15,15 +16,28 @@ const installCommands = {
|
|
|
15
16
|
addDeps: 'npm install sharp serve-static',
|
|
16
17
|
prodInstall: 'npm install --omit=dev',
|
|
17
18
|
runEnv: 'npx rime env'
|
|
19
|
+
},
|
|
20
|
+
bun: {
|
|
21
|
+
addDeps: 'bun add sharp serve-static',
|
|
22
|
+
prodInstall: 'bun install --production',
|
|
23
|
+
runEnv: 'bunx rime env'
|
|
18
24
|
}
|
|
19
25
|
};
|
|
20
26
|
export const build = (args) => {
|
|
27
|
+
const bun = usesBunScripts();
|
|
21
28
|
// Delete app folder if it exists
|
|
22
29
|
if (existsSync('./app')) {
|
|
23
30
|
rmSync('./app', { recursive: true, force: true });
|
|
24
31
|
}
|
|
25
32
|
// Build
|
|
26
|
-
|
|
33
|
+
// A Bun app builds on Bun: `bun --bun` runs vite, and anything the build imports, on Bun
|
|
34
|
+
// rather than on its bin's Node shebang
|
|
35
|
+
if (bun) {
|
|
36
|
+
spawnSync('bun', ['--bun', './node_modules/.bin/vite', 'build'], { stdio: 'inherit' });
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
spawnSync('./node_modules/.bin/vite', ['build'], { stdio: 'inherit' });
|
|
40
|
+
}
|
|
27
41
|
console.log('');
|
|
28
42
|
// Create app directory
|
|
29
43
|
mkdirSync('./app', { recursive: true });
|
|
@@ -56,15 +70,16 @@ export const build = (args) => {
|
|
|
56
70
|
console.log('## Next steps :');
|
|
57
71
|
console.log('');
|
|
58
72
|
console.log(' cd ./app');
|
|
59
|
-
const pm = getInvokingPackageManager() === 'pnpm' ? 'pnpm' : 'npm';
|
|
73
|
+
const pm = bun ? 'bun' : getInvokingPackageManager() === 'pnpm' ? 'pnpm' : 'npm';
|
|
74
|
+
console.log(' ' + installCommands[pm].addDeps);
|
|
75
|
+
console.log(' ' + installCommands[pm].prodInstall);
|
|
76
|
+
// After the install: before it, `npx rime`/`bunx rime` fetch the unrelated `rime` package
|
|
60
77
|
if (!args.withEnv) {
|
|
61
78
|
console.log(' ' +
|
|
62
79
|
installCommands[pm].runEnv +
|
|
63
80
|
' ' +
|
|
64
|
-
chalk.dim(`# next time run \`${
|
|
81
|
+
chalk.dim(`# next time run \`${{ pnpm: 'pnpm', npm: 'npx', bun: 'bunx' }[pm]} rime build -e\` to generate the .env file automatically`));
|
|
65
82
|
}
|
|
66
|
-
console.log(' ' + installCommands[pm].addDeps);
|
|
67
|
-
console.log(' ' + installCommands[pm].prodInstall);
|
|
68
83
|
console.log('');
|
|
69
|
-
console.log(' node --env-file=.env index.js');
|
|
84
|
+
console.log(bun ? ' bun index.js' : ' node --env-file=.env index.js');
|
|
70
85
|
};
|
|
@@ -2,6 +2,7 @@ type Args = {
|
|
|
2
2
|
force?: boolean;
|
|
3
3
|
skipInstall?: boolean;
|
|
4
4
|
name?: string;
|
|
5
|
+
bun?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare const init: ({ force, name: incomingName, skipInstall }: Args) => Promise<void>;
|
|
7
|
+
export declare const init: ({ force, name: incomingName, skipInstall, bun }: Args) => Promise<void>;
|
|
7
8
|
export {};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { logger } from '../../../logger.server.js';
|
|
2
2
|
import { PANEL_ROUTE } from '../../../routes/constants.server.js';
|
|
3
|
+
import { trycatchSync } from '../../../../util/function.js';
|
|
3
4
|
import { randomId } from '../../../../util/random.js';
|
|
4
5
|
import { isValidSlug, slugify } from '../../../../util/string.js';
|
|
5
6
|
import { generate as generateCode } from '@babel/generator';
|
|
6
7
|
import * as t from '@babel/types';
|
|
7
8
|
import { babelParse, getLang } from 'ast-kit';
|
|
9
|
+
import { execSync } from 'child_process';
|
|
8
10
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
9
11
|
import { cp, mkdir } from 'fs/promises';
|
|
10
12
|
import fs from 'node:fs';
|
|
@@ -12,14 +14,15 @@ import path from 'path';
|
|
|
12
14
|
import { fileURLToPath } from 'url';
|
|
13
15
|
import { CONFIG_DIR, OUTPUT_DIR } from '../../constants.server.js';
|
|
14
16
|
import * as templates from '../templates/init.js';
|
|
15
|
-
import { installDependencies } from '../util/package-manager.server.js';
|
|
16
|
-
import { getPackageInfoByKey } from '../util/package.server.js';
|
|
17
|
+
import { installDependencies, SVELTEKIT_ADAPTER } from '../util/package-manager.server.js';
|
|
18
|
+
import { getPackageInfoByKey, MIN_BUN, setBunScripts } from '../util/package.server.js';
|
|
17
19
|
import { prompt } from '../util/prompt.server.js';
|
|
18
20
|
import { generate } from './generate.server.js';
|
|
19
21
|
const PACKAGE = 'rimecms';
|
|
20
22
|
const root = process.cwd();
|
|
21
|
-
export const init = async ({ force, name: incomingName, skipInstall }) => {
|
|
23
|
+
export const init = async ({ force, name: incomingName, skipInstall, bun }) => {
|
|
22
24
|
const packageName = getPackageInfoByKey('name');
|
|
25
|
+
const driver = bun ? 'bun' : 'libsql';
|
|
23
26
|
function setEnv() {
|
|
24
27
|
const envPath = path.resolve(root, '.env');
|
|
25
28
|
// Define variables with their update behavior
|
|
@@ -62,7 +65,7 @@ export const init = async ({ force, name: incomingName, skipInstall }) => {
|
|
|
62
65
|
if (!existsSync(configDirPath)) {
|
|
63
66
|
mkdirSync(configDirPath);
|
|
64
67
|
}
|
|
65
|
-
writeFileSync(configPath, templates.defaultConfig(name.toString()));
|
|
68
|
+
writeFileSync(configPath, templates.defaultConfig(name.toString(), driver));
|
|
66
69
|
logger.info(`[✓] Config created at ${configDirPath}/rime.config.server.ts`);
|
|
67
70
|
}
|
|
68
71
|
else {
|
|
@@ -120,13 +123,32 @@ export const init = async ({ force, name: incomingName, skipInstall }) => {
|
|
|
120
123
|
? '[✓] Drizzle config schema path updated'
|
|
121
124
|
: '[✓] Drizzle config already exists (skip)');
|
|
122
125
|
}
|
|
126
|
+
function setBun() {
|
|
127
|
+
if (!bun)
|
|
128
|
+
return;
|
|
129
|
+
// init itself runs on Node (the bin's shebang): ask the bun on PATH
|
|
130
|
+
const version = trycatchSync(() => execSync('bun --version', { encoding: 'utf-8' }).trim())[1];
|
|
131
|
+
const [major, minor] = (version ?? '0.0').split('.').map(Number);
|
|
132
|
+
const [minMajor, minMinor] = MIN_BUN.split('.').map(Number);
|
|
133
|
+
if (major < minMajor || (major === minMajor && minor < minMinor)) {
|
|
134
|
+
logger.warn(`Bun ${version ?? 'not found'}: the Bun pack needs >= ${MIN_BUN} (older versions boot dev ~2x slower). Run \`bun upgrade\`.`);
|
|
135
|
+
}
|
|
136
|
+
logger.info(setBunScripts()
|
|
137
|
+
? '[✓] package.json scripts run vite with bun --bun'
|
|
138
|
+
: '[✓] package.json scripts already set (skip)');
|
|
139
|
+
}
|
|
140
|
+
function setAdapter() {
|
|
141
|
+
const patched = templates.setSvelteKitAdapter(root);
|
|
142
|
+
logger.info(patched.length
|
|
143
|
+
? `[✓] SvelteKit adapter set to ${SVELTEKIT_ADAPTER} in ${patched.join(', ')}`
|
|
144
|
+
: `[✓] SvelteKit adapter already set (skip)`);
|
|
145
|
+
}
|
|
123
146
|
function configureVite() {
|
|
124
147
|
const configPath = path.resolve(root, 'vite.config.ts');
|
|
125
148
|
if (!fs.existsSync(configPath)) {
|
|
126
149
|
throw new Error("Can't find vite configuration file");
|
|
127
150
|
}
|
|
128
|
-
|
|
129
|
-
content = content.replace("from '@sveltejs/adapter-auto'", "from '@sveltejs/adapter-node'");
|
|
151
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
130
152
|
const program = babelParse(content, getLang(configPath));
|
|
131
153
|
const programBody = program.body;
|
|
132
154
|
const configObject = findSvelteConfigObject(programBody);
|
|
@@ -209,6 +231,8 @@ export const init = async ({ force, name: incomingName, skipInstall }) => {
|
|
|
209
231
|
setConfig(name);
|
|
210
232
|
setDatabase();
|
|
211
233
|
setDrizzle(name);
|
|
234
|
+
setBun();
|
|
235
|
+
setAdapter();
|
|
212
236
|
configureVite();
|
|
213
237
|
await copyAssets();
|
|
214
238
|
!skipInstall && installDependencies();
|
|
@@ -233,6 +257,8 @@ export const init = async ({ force, name: incomingName, skipInstall }) => {
|
|
|
233
257
|
setConfig(name);
|
|
234
258
|
setDatabase();
|
|
235
259
|
setDrizzle(name);
|
|
260
|
+
setBun();
|
|
261
|
+
setAdapter();
|
|
236
262
|
configureVite();
|
|
237
263
|
await copyAssets();
|
|
238
264
|
!skipInstall && installDependencies();
|
|
@@ -11,6 +11,7 @@ program
|
|
|
11
11
|
.option('-n, --name <name>', 'Will be the database name')
|
|
12
12
|
.option('-f, --force', 'Force init with default package name', false)
|
|
13
13
|
.option('-s, --skip-install', 'Do not install dependencies', false)
|
|
14
|
+
.option('-b, --bun', 'Bun pack: bun:sqlite driver, bun --bun scripts', false)
|
|
14
15
|
.action(async (args) => {
|
|
15
16
|
const init = await import('./commands/init.server.js').then((m) => m.init);
|
|
16
17
|
init(args);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const env: () => string;
|
|
2
|
-
export declare const defaultConfig: (name: string) => string;
|
|
2
|
+
export declare const defaultConfig: (name: string, driver?: "libsql" | "bun") => string;
|
|
3
3
|
export declare const drizzleConfig: (name: string) => string;
|
|
4
4
|
export declare const hooks: () => string;
|
|
5
5
|
/** Writes src/hooks.server.ts if missing. If it already exists, patches only the config
|
|
@@ -16,3 +16,8 @@ export declare function regenerateHooks(root?: string): boolean;
|
|
|
16
16
|
* exist — creating it from scratch needs a project name, which is `rime init`'s job
|
|
17
17
|
* (setDrizzle() in init/index.server.ts). Returns whether it patched anything. */
|
|
18
18
|
export declare function regenerateDrizzleConfig(root?: string): boolean;
|
|
19
|
+
/** Swaps adapter-auto for adapter-node, wherever the app declares it: `vite.config.ts` in
|
|
20
|
+
* current sv templates, `svelte.config.js` in older ones. adapter-auto produces nothing for a
|
|
21
|
+
* plain Node or Bun server. Any other adapter is the app's choice and left alone. Returns the
|
|
22
|
+
* files it patched. */
|
|
23
|
+
export declare function setSvelteKitAdapter(root: string): string[];
|
|
@@ -3,6 +3,7 @@ import { randomId } from '../../../../util/random.js';
|
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { CONFIG_DIR, GENERATED_DIR, configImportPaths } from '../../constants.server.js';
|
|
6
|
+
import { SVELTEKIT_ADAPTER } from '../util/package-manager.server.js';
|
|
6
7
|
const PACKAGE = 'rimecms';
|
|
7
8
|
export const env = () => `BETTER_AUTH_SECRET=${randomId(32)}
|
|
8
9
|
PUBLIC_RIME_URL=http://localhost:5173
|
|
@@ -26,7 +27,7 @@ RIME_LOG_LEVEL=TRACE
|
|
|
26
27
|
RIME_LOG_TO_FILE=true
|
|
27
28
|
RIME_LOG_TO_FILE_MAX_DAYS=1
|
|
28
29
|
`;
|
|
29
|
-
export const defaultConfig = (name) => `
|
|
30
|
+
export const defaultConfig = (name, driver = 'libsql') => `
|
|
30
31
|
import { Collection, rime } from '$rime/config';
|
|
31
32
|
import { text } from '${PACKAGE}/fields';
|
|
32
33
|
import { adapterSqlite } from '${PACKAGE}/adapter-sqlite';
|
|
@@ -43,7 +44,7 @@ const Medias = Collection.create('medias', {
|
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
export default rime({
|
|
46
|
-
$adapter: adapterSqlite('${name}.sqlite'),
|
|
47
|
+
$adapter: adapterSqlite('${name}.sqlite'${driver === 'bun' ? ", { driver: 'bun' }" : ''}),
|
|
47
48
|
collections: [Pages, Medias]
|
|
48
49
|
});
|
|
49
50
|
`;
|
|
@@ -115,3 +116,30 @@ export function regenerateDrizzleConfig(root = process.cwd()) {
|
|
|
115
116
|
}
|
|
116
117
|
return false;
|
|
117
118
|
}
|
|
119
|
+
const ADAPTER_CONFIG_FILES = [
|
|
120
|
+
'vite.config.ts',
|
|
121
|
+
'vite.config.js',
|
|
122
|
+
'svelte.config.js',
|
|
123
|
+
'svelte.config.ts',
|
|
124
|
+
'svelte.config.mjs'
|
|
125
|
+
];
|
|
126
|
+
/** Swaps adapter-auto for adapter-node, wherever the app declares it: `vite.config.ts` in
|
|
127
|
+
* current sv templates, `svelte.config.js` in older ones. adapter-auto produces nothing for a
|
|
128
|
+
* plain Node or Bun server. Any other adapter is the app's choice and left alone. Returns the
|
|
129
|
+
* files it patched. */
|
|
130
|
+
export function setSvelteKitAdapter(root) {
|
|
131
|
+
const pattern = /from\s*(['"])@sveltejs\/adapter-auto\1/g;
|
|
132
|
+
const patched = [];
|
|
133
|
+
for (const file of ADAPTER_CONFIG_FILES) {
|
|
134
|
+
const configPath = path.join(root, file);
|
|
135
|
+
if (!existsSync(configPath))
|
|
136
|
+
continue;
|
|
137
|
+
const content = readFileSync(configPath, 'utf-8');
|
|
138
|
+
const next = content.replace(pattern, (_, quote) => `from ${quote}${SVELTEKIT_ADAPTER}${quote}`);
|
|
139
|
+
if (next !== content) {
|
|
140
|
+
writeFileSync(configPath, next);
|
|
141
|
+
patched.push(file);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return patched;
|
|
145
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type PackageManagerName = 'yarn' | 'pnpm' | 'bun' | 'npm' | 'deno';
|
|
2
|
+
export declare const SVELTEKIT_ADAPTER = "@sveltejs/adapter-node";
|
|
2
3
|
export declare function getPackageManager(): PackageManagerName;
|
|
3
4
|
/**
|
|
4
5
|
* Detects the package manager used to invoke the currently running command
|
|
@@ -14,26 +14,28 @@ const packageManagersMap = {
|
|
|
14
14
|
// installed is the split that made every sign-in fail when better-auth did the same thing.
|
|
15
15
|
const DRIZZLE = '1.0.0-rc.4';
|
|
16
16
|
const deps = [`drizzle-orm@${DRIZZLE}`, '@libsql/client', '@lucide/svelte', 'sharp'];
|
|
17
|
-
|
|
17
|
+
// Both packs build with adapter-node: the Bun pack runs the same server on Bun
|
|
18
|
+
export const SVELTEKIT_ADAPTER = '@sveltejs/adapter-node';
|
|
19
|
+
const devDeps = [SVELTEKIT_ADAPTER, `drizzle-kit@${DRIZZLE}`];
|
|
18
20
|
const packageManagerConfigs = {
|
|
19
21
|
yarn: {
|
|
20
|
-
command: 'echo "yarn is not supported, please use pnpm or npm" && exit 1'
|
|
22
|
+
command: () => 'echo "yarn is not supported, please use pnpm or npm" && exit 1'
|
|
21
23
|
},
|
|
22
24
|
pnpm: {
|
|
23
|
-
command: `pnpm add -D ${devDeps.join(' ')} && pnpm add ${deps.join(' ')}`,
|
|
25
|
+
command: (devDeps) => `pnpm add -D ${devDeps.join(' ')} && pnpm add ${deps.join(' ')}`,
|
|
24
26
|
preInstall: configurePnpm,
|
|
25
27
|
postInstall: () => {
|
|
26
28
|
execSync('pnpm rebuild');
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
31
|
bun: {
|
|
30
|
-
command: `bun add -D ${devDeps.join(' ')} && bun add ${deps.join(' ')}`
|
|
32
|
+
command: (devDeps) => `bun add -D ${devDeps.join(' ')} && bun add ${deps.join(' ')}`
|
|
31
33
|
},
|
|
32
34
|
npm: {
|
|
33
|
-
command: `npm install -D ${devDeps.join(' ')} && npm install ${deps.join(' ')}`
|
|
35
|
+
command: (devDeps) => `npm install -D ${devDeps.join(' ')} && npm install ${deps.join(' ')}`
|
|
34
36
|
},
|
|
35
37
|
deno: {
|
|
36
|
-
command: 'echo "deno is not supported, please use pnpm or npm" && exit 1'
|
|
38
|
+
command: () => 'echo "deno is not supported, please use pnpm or npm" && exit 1'
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
export function getPackageManager() {
|
|
@@ -69,8 +71,9 @@ export function installDependencies() {
|
|
|
69
71
|
// Pre installation hooks
|
|
70
72
|
config.preInstall?.();
|
|
71
73
|
// Main installation
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
const command = config.command(devDeps);
|
|
75
|
+
logger.info('exec : ' + command);
|
|
76
|
+
execSync(command);
|
|
74
77
|
// Post installation hooks
|
|
75
78
|
config.postInstall?.();
|
|
76
79
|
}
|
|
@@ -1 +1,10 @@
|
|
|
1
1
|
export declare function getPackageInfoByKey(key: string): string;
|
|
2
|
+
/** Below it, JavaScriptCore's slow lookbehind regexes (Vite's wasm filters) double dev boot. */
|
|
3
|
+
export declare const MIN_BUN = "1.4";
|
|
4
|
+
/**
|
|
5
|
+
* Prefixes the app's vite scripts with `bun --bun`, so vite (and `bun:sqlite`) run on Bun
|
|
6
|
+
* rather than on the Node its bin's shebang asks for. Returns whether it wrote anything.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setBunScripts(): boolean;
|
|
9
|
+
/** Whether `rime init --bun` set this app up — its vite scripts are what `rime build` reads back. */
|
|
10
|
+
export declare function usesBunScripts(): boolean;
|
|
@@ -15,3 +15,46 @@ export function getPackageInfoByKey(key) {
|
|
|
15
15
|
return '';
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
const BUN_PREFIX = 'bun --bun ';
|
|
19
|
+
/** Below it, JavaScriptCore's slow lookbehind regexes (Vite's wasm filters) double dev boot. */
|
|
20
|
+
export const MIN_BUN = '1.4';
|
|
21
|
+
const VITE_SCRIPTS = ['dev', 'build', 'preview'];
|
|
22
|
+
function readPackageJson() {
|
|
23
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
24
|
+
const raw = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
25
|
+
// Keep the file's own indentation (sv writes tabs)
|
|
26
|
+
const indent = raw.match(/^[ \t]+/m)?.[0] ?? ' ';
|
|
27
|
+
return { path: packageJsonPath, json: JSON.parse(raw), indent };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Prefixes the app's vite scripts with `bun --bun`, so vite (and `bun:sqlite`) run on Bun
|
|
31
|
+
* rather than on the Node its bin's shebang asks for. Returns whether it wrote anything.
|
|
32
|
+
*/
|
|
33
|
+
export function setBunScripts() {
|
|
34
|
+
const { path: packageJsonPath, json, indent } = readPackageJson();
|
|
35
|
+
let changed = false;
|
|
36
|
+
for (const key of VITE_SCRIPTS) {
|
|
37
|
+
const script = json.scripts?.[key];
|
|
38
|
+
if (typeof script === 'string' && script.startsWith('vite ')) {
|
|
39
|
+
json.scripts[key] = BUN_PREFIX + script;
|
|
40
|
+
changed = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!json.engines?.bun) {
|
|
44
|
+
json.engines = { ...json.engines, bun: `>=${MIN_BUN}` };
|
|
45
|
+
changed = true;
|
|
46
|
+
}
|
|
47
|
+
if (changed)
|
|
48
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(json, null, indent) + '\n');
|
|
49
|
+
return changed;
|
|
50
|
+
}
|
|
51
|
+
/** Whether `rime init --bun` set this app up — its vite scripts are what `rime build` reads back. */
|
|
52
|
+
export function usesBunScripts() {
|
|
53
|
+
try {
|
|
54
|
+
const { json } = readPackageJson();
|
|
55
|
+
return VITE_SCRIPTS.some((key) => json.scripts?.[key]?.startsWith(BUN_PREFIX));
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -3,8 +3,9 @@ import type { BuiltArea, BuiltCollection } from '../../../config/types.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* What each config's generated doc type gains beyond its own fields.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
* `UploadDoc`, adds its `sizes` member and filters out the fields its image sizes collide with
|
|
6
|
+
* Three contributors and they are the whole list: `versions` adds `versionId`, `upload` extends
|
|
7
|
+
* `UploadDoc`, adds its `sizes` member and filters out the fields its image sizes collide with,
|
|
8
|
+
* `url` adds the address.
|
|
8
9
|
* The `fields` predicates are **ANDed** — each says which fields it still wants generated, and
|
|
9
10
|
* a field has to survive both.
|
|
10
11
|
*
|