@kardalum/plugin-sdk 0.16.0 → 0.18.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/CHANGELOG.md +105 -0
- package/README.md +4 -3
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- package/dist/assets/asset-picker.d.ts +11 -0
- package/dist/assets/asset-picker.js +109 -0
- package/dist/assets/asset-tree.d.ts +30 -0
- package/dist/assets/asset-tree.js +150 -0
- package/dist/built-in-editor-ids.d.ts +1 -0
- package/dist/built-in-editor-ids.js +20 -0
- package/dist/built-in-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +27 -0
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +10 -1
- package/dist/capabilities.js +5 -3
- package/dist/datatype-validation.js +18 -4
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- package/dist/entitlement-entry.d.ts +3 -2
- package/dist/entitlement-entry.js +13 -1
- package/dist/entitlement-gate.d.ts +18 -0
- package/dist/entitlement-gate.js +95 -21
- package/dist/entitlement-plan.d.ts +21 -0
- package/dist/entitlement-plan.js +26 -0
- package/dist/entitlement-types.d.ts +21 -4
- package/dist/entitlement.d.ts +29 -1
- package/dist/entitlement.js +39 -0
- package/dist/grid-arrow-step.d.ts +7 -0
- package/dist/grid-arrow-step.js +20 -0
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +13 -18
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +4 -7
- package/dist/manifest-entry.d.ts +6 -2
- package/dist/manifest-entry.js +5 -1
- package/dist/manifest-schema.d.ts +56 -63
- package/dist/manifest-schema.js +103 -249
- package/dist/manifest.d.ts +61 -73
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +32 -32
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/plugin-screen-context.d.ts +11 -1
- package/dist/richtext/block-panel.js +19 -20
- package/dist/richtext/extensions.js +10 -1
- package/dist/richtext/insert-menu.js +1 -1
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +4 -4
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/structured-storage-types.d.ts +11 -0
- package/dist/tailwind.js +10 -3
- package/dist/tokens/tailwind-theme.css +176 -0
- package/dist/tokens/tokens.css +2 -0
- package/dist/tokens/tokens.json +4 -2
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- package/dist/vendor-check.d.ts +39 -0
- package/dist/vendor-check.js +79 -0
- package/dist/vendor-entry.d.ts +3 -0
- package/dist/vendor-entry.js +9 -0
- package/dist/vendor-service.d.ts +20 -0
- package/dist/vendor-service.js +20 -0
- package/dist/views/asset-view.d.ts +6 -0
- package/dist/views/asset-view.js +55 -0
- package/dist/views/content-list-settings-view.js +1 -1
- package/dist/views/content-list-view.js +1 -1
- package/dist/views/html-code-editor.js +0 -1
- package/dist/views/html-view.js +1 -1
- package/dist/views/image-view.js +1 -1
- package/dist/views/rich-text-view.js +30 -30
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +43 -10
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +23 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +60 -18
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +22 -6
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +52 -10
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +33 -14
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +25 -5
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +42 -2
- package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +73 -31
- package/node_modules/@kardalum/api-schemas/dist/index.js +47 -17
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +216 -63
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +117 -5
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +8 -18
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +9 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +240 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +164 -32
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +152 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +35 -23
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +6 -6
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +58 -25
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +194 -48
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +18 -6
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +115 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +65 -10
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +37 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +34 -8
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +16 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- package/node_modules/@kardalum/design-tokens/README.md +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +4 -2
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -0
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +5 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +59 -16
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +77 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +137 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +215 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +13 -4
- package/node_modules/@kardalum/plugin-package/dist/index.js +10 -3
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -2
- package/node_modules/@kardalum/ui/README.md +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
- package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
- package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
- package/node_modules/@kardalum/ui/dist/index.js +1 -0
- package/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +19 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginInstallDeclaration, PluginReference } from "@kardalum/api-schemas";
|
|
1
|
+
import type { PluginInstallDeclaration, PluginLabel, PluginReference } from "@kardalum/api-schemas";
|
|
2
2
|
type LabelMap = {
|
|
3
3
|
en: string;
|
|
4
4
|
[locale: string]: string;
|
|
@@ -10,11 +10,11 @@ type LabelMap = {
|
|
|
10
10
|
export interface ReferenceManifestInput {
|
|
11
11
|
actions?: ReadonlyArray<{
|
|
12
12
|
id: string;
|
|
13
|
-
label:
|
|
13
|
+
label: PluginLabel;
|
|
14
14
|
}>;
|
|
15
15
|
roles?: ReadonlyArray<{
|
|
16
16
|
id: string;
|
|
17
|
-
label:
|
|
17
|
+
label: PluginLabel;
|
|
18
18
|
actions: readonly string[];
|
|
19
19
|
}>;
|
|
20
20
|
databaseCompatibility?: {
|
|
@@ -59,11 +59,6 @@ export interface ReferenceManifestInput {
|
|
|
59
59
|
kind: string;
|
|
60
60
|
documentType?: string;
|
|
61
61
|
}>;
|
|
62
|
-
settingsPages?: ReadonlyArray<{
|
|
63
|
-
id: string;
|
|
64
|
-
name: string;
|
|
65
|
-
action: string;
|
|
66
|
-
}>;
|
|
67
62
|
adminSections?: ReadonlyArray<{
|
|
68
63
|
id: string;
|
|
69
64
|
label: LabelMap;
|
|
@@ -82,28 +77,18 @@ export interface ReferenceManifestInput {
|
|
|
82
77
|
}>;
|
|
83
78
|
dashboardWidgets?: ReadonlyArray<{
|
|
84
79
|
id: string;
|
|
85
|
-
name:
|
|
86
|
-
action: string;
|
|
87
|
-
}>;
|
|
88
|
-
editorToolbar?: ReadonlyArray<{
|
|
89
|
-
id: string;
|
|
90
|
-
label: string;
|
|
91
|
-
action: string;
|
|
92
|
-
}>;
|
|
93
|
-
contentTreeActions?: ReadonlyArray<{
|
|
94
|
-
id: string;
|
|
95
|
-
label: string;
|
|
80
|
+
name: PluginLabel;
|
|
96
81
|
action: string;
|
|
97
82
|
}>;
|
|
98
83
|
hooks?: object;
|
|
99
84
|
scheduledTasks?: ReadonlyArray<{
|
|
100
85
|
id: string;
|
|
101
|
-
name:
|
|
86
|
+
name: PluginLabel;
|
|
102
87
|
cron: string;
|
|
103
88
|
}>;
|
|
104
89
|
};
|
|
105
90
|
}
|
|
106
|
-
/** The serialisable facts the
|
|
91
|
+
/** The serialisable facts the six generated Reference pages are rendered
|
|
107
92
|
* from (spec 3.2). Only plain data: never a view, a handler or a hook. The
|
|
108
93
|
* CLI writes it to reference.json; the server builds it live from the
|
|
109
94
|
* attached manifest. */
|
|
@@ -7,15 +7,23 @@ function plain(value) {
|
|
|
7
7
|
function labelMap(label) {
|
|
8
8
|
return Object.fromEntries(Object.entries(label).filter(([, text]) => typeof text === "string"));
|
|
9
9
|
}
|
|
10
|
-
/** The
|
|
10
|
+
/** The English text of a label that may be a language map (S311): the reference
|
|
11
|
+
* carries one string per name, as its pages print it. resolveLabel(label, "en")
|
|
12
|
+
* in @kardalum/api-schemas, written inline because this module may take only
|
|
13
|
+
* types from there (build-reference.test.ts pins the two); a map's only key a
|
|
14
|
+
* language code can read as "en" is "en" itself. */
|
|
15
|
+
function english(label) {
|
|
16
|
+
return typeof label === "object" && label !== null ? label.en : label;
|
|
17
|
+
}
|
|
18
|
+
/** The serialisable facts the six generated Reference pages are rendered
|
|
11
19
|
* from (spec 3.2). Only plain data: never a view, a handler or a hook. The
|
|
12
20
|
* CLI writes it to reference.json; the server builds it live from the
|
|
13
21
|
* attached manifest. */
|
|
14
22
|
export function buildReference(manifest) {
|
|
15
23
|
const c = manifest.contributions;
|
|
16
24
|
return {
|
|
17
|
-
actions: (manifest.actions ?? []).map(({ id, label }) => ({ id, label })),
|
|
18
|
-
roles: (manifest.roles ?? []).map(({ id, label, actions }) => ({ id, label, actions: [...actions] })),
|
|
25
|
+
actions: (manifest.actions ?? []).map(({ id, label }) => ({ id, label: english(label) })),
|
|
26
|
+
roles: (manifest.roles ?? []).map(({ id, label, actions }) => ({ id, label: english(label), actions: [...actions] })),
|
|
19
27
|
apiRoutes: (c.apiRoutes ?? []).map((route) => ({
|
|
20
28
|
method: route.method,
|
|
21
29
|
path: route.path,
|
|
@@ -27,7 +35,6 @@ export function buildReference(manifest) {
|
|
|
27
35
|
documentTypes: plain(c.documentTypes ?? []),
|
|
28
36
|
dataTypes: (c.dataTypes ?? []).map((type) => plain({ id: type.id, name: type.name, icon: type.icon, version: type.version, schema: type.schema, settingsSchema: type.settingsSchema, defaultSettings: type.defaultSettings })),
|
|
29
37
|
templates: (c.templates ?? []).map((t) => ({ name: t.name, alias: t.alias, kind: t.kind, ...(t.documentType ? { documentType: t.documentType } : {}) })),
|
|
30
|
-
settingsPages: (c.settingsPages ?? []).map(({ id, name, action }) => ({ id, name, action })),
|
|
31
38
|
adminSections: (c.adminSections ?? []).map((s) => ({
|
|
32
39
|
id: s.id,
|
|
33
40
|
label: labelMap(s.label),
|
|
@@ -35,11 +42,9 @@ export function buildReference(manifest) {
|
|
|
35
42
|
rail: (s.rail ?? []).map((e) => ({ id: e.id, label: labelMap(e.label), action: e.action })),
|
|
36
43
|
})),
|
|
37
44
|
railEntries: (c.railEntries ?? []).map((e) => ({ id: e.id, label: labelMap(e.label), section: e.section, action: e.action })),
|
|
38
|
-
dashboardWidgets: (c.dashboardWidgets ?? []).map(({ id, name, action }) => ({ id, name, action })),
|
|
39
|
-
editorToolbar: (c.editorToolbar ?? []).map(({ id, label, action }) => ({ id, label, action })),
|
|
40
|
-
contentTreeActions: (c.contentTreeActions ?? []).map(({ id, label, action }) => ({ id, label, action })),
|
|
45
|
+
dashboardWidgets: (c.dashboardWidgets ?? []).map(({ id, name, action }) => ({ id, name: english(name), action })),
|
|
41
46
|
hooks: Object.keys(c.hooks ?? {}),
|
|
42
|
-
scheduledTasks: (c.scheduledTasks ?? []).map(({ id, name, cron }) => ({ id, name, cron })),
|
|
47
|
+
scheduledTasks: (c.scheduledTasks ?? []).map(({ id, name, cron }) => ({ id, name: english(name), cron })),
|
|
43
48
|
migrations: (manifest.migrations ?? []).map(({ id, name }) => ({ id, name })),
|
|
44
49
|
assertions: ASSERTION_KEYS.flatMap((key) => {
|
|
45
50
|
const reason = manifest.assertions?.[key]?.reason;
|
|
@@ -66,11 +66,11 @@ export interface Capability {
|
|
|
66
66
|
* them, and they read as a closing caveat rather than as a feature.
|
|
67
67
|
*
|
|
68
68
|
* This package cannot name the SDK's `PluginContributions` (the SDK depends
|
|
69
|
-
* on it), so the SDK asserts at the type level that these
|
|
70
|
-
* exactly `keyof PluginContributions`:
|
|
69
|
+
* on it), so the SDK asserts at the type level that these 17 keys are
|
|
70
|
+
* exactly `keyof PluginContributions`: an eighteenth contribution added to the
|
|
71
71
|
* contract and not classified here is a compile error in the SDK's build.
|
|
72
72
|
*/
|
|
73
|
-
export declare const CONTRIBUTION_EMISSION_ORDER: readonly ["dataTypes", "documentTypes", "adminSections", "railEntries", "dashboardWidgets", "
|
|
73
|
+
export declare const CONTRIBUTION_EMISSION_ORDER: readonly ["dataTypes", "documentTypes", "adminSections", "railEntries", "dashboardWidgets", "templates", "assets", "themeTokens", "hooks", "scheduledTasks", "mediaProcessors", "serializers", "apiRoutes", "exposedServices", "notifications", "bundledPlugins", "bundledTemplate"];
|
|
74
74
|
export type ContributionKey = (typeof CONTRIBUTION_EMISSION_ORDER)[number];
|
|
75
75
|
/** The assertion kinds, in emission order. The SDK asserts these are
|
|
76
76
|
* exactly `keyof PluginAssertions`, for the reason above. */
|
|
@@ -78,7 +78,7 @@ export declare const ASSERTION_KEYS: readonly ["externalNetwork", "filesystemAcc
|
|
|
78
78
|
export type AssertionKey = (typeof ASSERTION_KEYS)[number];
|
|
79
79
|
/** Whether this contribution kind sits behind a named permission action.
|
|
80
80
|
* Lives on CONTRIBUTION_RULES rather than in a separate list, because that
|
|
81
|
-
* record is compiler-total over the
|
|
81
|
+
* record is compiler-total over the 17 contribution keys: an eighteenth key
|
|
82
82
|
* cannot be added without classifying it here. */
|
|
83
83
|
export declare function isActionGated(key: ContributionKey): boolean;
|
|
84
84
|
/** Every capability id this contract can produce, for the readers that
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
* them, and they read as a closing caveat rather than as a feature.
|
|
31
31
|
*
|
|
32
32
|
* This package cannot name the SDK's `PluginContributions` (the SDK depends
|
|
33
|
-
* on it), so the SDK asserts at the type level that these
|
|
34
|
-
* exactly `keyof PluginContributions`:
|
|
33
|
+
* on it), so the SDK asserts at the type level that these 17 keys are
|
|
34
|
+
* exactly `keyof PluginContributions`: an eighteenth contribution added to the
|
|
35
35
|
* contract and not classified here is a compile error in the SDK's build.
|
|
36
36
|
*/
|
|
37
37
|
export const CONTRIBUTION_EMISSION_ORDER = [
|
|
@@ -40,9 +40,6 @@ export const CONTRIBUTION_EMISSION_ORDER = [
|
|
|
40
40
|
"adminSections",
|
|
41
41
|
"railEntries",
|
|
42
42
|
"dashboardWidgets",
|
|
43
|
-
"settingsPages",
|
|
44
|
-
"contentTreeActions",
|
|
45
|
-
"editorToolbar",
|
|
46
43
|
"templates",
|
|
47
44
|
"assets",
|
|
48
45
|
"themeTokens",
|
|
@@ -52,6 +49,7 @@ export const CONTRIBUTION_EMISSION_ORDER = [
|
|
|
52
49
|
"serializers",
|
|
53
50
|
"apiRoutes",
|
|
54
51
|
"exposedServices",
|
|
52
|
+
"notifications",
|
|
55
53
|
"bundledPlugins",
|
|
56
54
|
"bundledTemplate",
|
|
57
55
|
];
|
|
@@ -67,11 +65,12 @@ export const ASSERTION_KEYS = ["externalNetwork", "filesystemAccess"];
|
|
|
67
65
|
*
|
|
68
66
|
* Classification follows S267 section 6 and its stated principle: a
|
|
69
67
|
* capability is mediated when the platform decides the outcome, and promised
|
|
70
|
-
* when the plugin does. Every contribution below is mediated
|
|
68
|
+
* when the plugin does. Every contribution below is mediated but `notifications`,
|
|
71
69
|
* because every one of them is consumed by the host: it mounts the view,
|
|
72
70
|
* dispatches the hook, runs the task, registers the template. The only
|
|
73
|
-
* contribution that is not wholly mediated is
|
|
74
|
-
* the tiers that let traffic reach a handler
|
|
71
|
+
* contribution besides `notifications` that is not wholly mediated is
|
|
72
|
+
* `apiRoutes`, and only for the tiers that let traffic reach a handler
|
|
73
|
+
* without a signed-in session.
|
|
75
74
|
*
|
|
76
75
|
* `exposedServices`, `bundledPlugins` and `bundledTemplate` are not named
|
|
77
76
|
* in section 6's automatic list, which enumerates a policy rather than the
|
|
@@ -96,9 +95,6 @@ const CONTRIBUTION_RULES = {
|
|
|
96
95
|
// they are disclosed under admin.section rather than counted here.
|
|
97
96
|
railEntries: { derives: "one", id: "admin.railEntry", mediation: "mediated", actionGated: true },
|
|
98
97
|
dashboardWidgets: { derives: "one", id: "admin.dashboardWidget", mediation: "mediated", actionGated: true },
|
|
99
|
-
settingsPages: { derives: "one", id: "admin.settingsPage", mediation: "mediated", actionGated: true },
|
|
100
|
-
contentTreeActions: { derives: "one", id: "admin.contentTreeAction", mediation: "mediated", actionGated: true },
|
|
101
|
-
editorToolbar: { derives: "one", id: "admin.editorToolbarItem", mediation: "mediated", actionGated: true },
|
|
102
98
|
templates: { derives: "one", id: "render.template", mediation: "mediated", actionGated: false },
|
|
103
99
|
assets: { derives: "one", id: "render.asset", mediation: "mediated", actionGated: false },
|
|
104
100
|
themeTokens: { derives: "one", id: "theme.tokens", mediation: "mediated", actionGated: false },
|
|
@@ -107,13 +103,16 @@ const CONTRIBUTION_RULES = {
|
|
|
107
103
|
mediaProcessors: { derives: "one", id: "media.processor", mediation: "mediated", actionGated: false },
|
|
108
104
|
serializers: { derives: "one", id: "api.serializer", mediation: "mediated", actionGated: false },
|
|
109
105
|
exposedServices: { derives: "one", id: "service.exposed", mediation: "mediated", actionGated: false },
|
|
106
|
+
// S314n3 (D1): the one contribution that is promised. The host delivers each send, but
|
|
107
|
+
// what the plugin sends, to whom and how often is the plugin's code, so a reviewer reads it.
|
|
108
|
+
notifications: { derives: "one", id: "admin.notifications", mediation: "promised", actionGated: false },
|
|
110
109
|
bundledPlugins: { derives: "one", id: "bundle.plugin", mediation: "mediated", actionGated: false },
|
|
111
110
|
bundledTemplate: { derives: "one", id: "bundle.template", mediation: "mediated", actionGated: false },
|
|
112
111
|
apiRoutes: { derives: "perApiRouteTier", actionGated: true },
|
|
113
112
|
};
|
|
114
113
|
/** Whether this contribution kind sits behind a named permission action.
|
|
115
114
|
* Lives on CONTRIBUTION_RULES rather than in a separate list, because that
|
|
116
|
-
* record is compiler-total over the
|
|
115
|
+
* record is compiler-total over the 17 contribution keys: an eighteenth key
|
|
117
116
|
* cannot be added without classifying it here. */
|
|
118
117
|
export function isActionGated(key) {
|
|
119
118
|
return CONTRIBUTION_RULES[key].actionGated;
|
|
@@ -122,10 +121,11 @@ export function isActionGated(key) {
|
|
|
122
121
|
* The access tiers, in emission order, with the classification S267
|
|
123
122
|
* section 6 gives each.
|
|
124
123
|
*
|
|
125
|
-
* `admin` is mediated: the host checks the
|
|
126
|
-
* handler runs. `apiKey` and `public` are
|
|
127
|
-
* tier, but a route reachable without
|
|
128
|
-
* whose handling belongs to the
|
|
124
|
+
* `admin` is mediated: the host checks that the session's role holds the
|
|
125
|
+
* route's `action` before the handler runs. `apiKey` and `public` are
|
|
126
|
+
* promised: the host enforces the tier, but a route reachable without a
|
|
127
|
+
* signed-in session is an abuse surface whose handling belongs to the
|
|
128
|
+
* author.
|
|
129
129
|
*/
|
|
130
130
|
const API_ROUTE_TIERS = [
|
|
131
131
|
{ tier: "admin", id: "api.route.admin", mediation: "mediated" },
|
|
@@ -174,6 +174,37 @@ const ASSERTION_ENTRIES = ASSERTION_KEYS.map((key) => [key, ASSERTION_RULES[key]
|
|
|
174
174
|
* has to answer that question without the manifest.
|
|
175
175
|
*/
|
|
176
176
|
const STRUCTURED_STORAGE_ID = "storage.structured";
|
|
177
|
+
/** S320 (plan P7): derived from the top-level `vendorService`, not from a
|
|
178
|
+
* contribution: the host makes the call, so it is mediated. */
|
|
179
|
+
const VENDOR_SERVICE_ID = "network.vendorService";
|
|
180
|
+
const VendorUrlCtor = globalThis.URL;
|
|
181
|
+
const VENDOR_LOCAL_HOSTS = ["localhost", "127.0.0.1", "[::1]"];
|
|
182
|
+
const VENDOR_ORIGIN_MAX = 255;
|
|
183
|
+
/** The declared vendor service's host, or null when the origin is malformed. */
|
|
184
|
+
function vendorServiceHost(declaration) {
|
|
185
|
+
if (declaration === null || typeof declaration !== "object")
|
|
186
|
+
return null;
|
|
187
|
+
const value = declaration.origin;
|
|
188
|
+
if (typeof value !== "string" || value.length === 0 || value.length > VENDOR_ORIGIN_MAX)
|
|
189
|
+
return null;
|
|
190
|
+
let url;
|
|
191
|
+
try {
|
|
192
|
+
url = new VendorUrlCtor(value);
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
if (url.username !== "" || url.password !== "")
|
|
198
|
+
return null;
|
|
199
|
+
if (url.protocol === "http:") {
|
|
200
|
+
if (!VENDOR_LOCAL_HOSTS.includes(url.hostname))
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
else if (url.protocol !== "https:") {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
return url.origin === value ? url.host : null;
|
|
207
|
+
}
|
|
177
208
|
/** Every capability id this contract can produce, for the readers that
|
|
178
209
|
* need to be pinned against it (the marketplace's static mirror) and for
|
|
179
210
|
* the reference page S289 generates. */
|
|
@@ -184,6 +215,7 @@ export const CAPABILITY_IDS = [
|
|
|
184
215
|
return rule.derives === "one" ? [rule.id] : API_ROUTE_TIERS.map((entry) => entry.id);
|
|
185
216
|
}),
|
|
186
217
|
...ASSERTION_ENTRIES.map(([, id]) => id),
|
|
218
|
+
VENDOR_SERVICE_ID,
|
|
187
219
|
];
|
|
188
220
|
// ---------------------------------------------------------------------------
|
|
189
221
|
// Reading a declaration's readable detail
|
|
@@ -332,6 +364,14 @@ export function deriveCapabilities(manifest) {
|
|
|
332
364
|
});
|
|
333
365
|
}
|
|
334
366
|
}
|
|
367
|
+
// S320 (plan P7): the vendor service. Mediated: the host makes the call, to
|
|
368
|
+
// this origin only, and sends a token, never the key. Its detail is the host
|
|
369
|
+
// the install screen names. Declaring one implies outbound network use, so
|
|
370
|
+
// `network.external` is emitted below even without the assertion.
|
|
371
|
+
const vendorHost = vendorServiceHost(source.vendorService);
|
|
372
|
+
if (vendorHost !== null) {
|
|
373
|
+
capabilities.push({ id: VENDOR_SERVICE_ID, payload: { count: 1, details: [vendorHost] }, mediation: "mediated" });
|
|
374
|
+
}
|
|
335
375
|
const assertions = source.assertions !== null && typeof source.assertions === "object"
|
|
336
376
|
? source.assertions
|
|
337
377
|
: {};
|
|
@@ -347,5 +387,8 @@ export function deriveCapabilities(manifest) {
|
|
|
347
387
|
continue;
|
|
348
388
|
capabilities.push({ id, payload: { count: 1, details: [reason] }, mediation: "promised" });
|
|
349
389
|
}
|
|
390
|
+
if (vendorHost !== null && !capabilities.some((c) => c.id === ASSERTION_RULES.externalNetwork)) {
|
|
391
|
+
capabilities.push({ id: ASSERTION_RULES.externalNetwork, payload: { count: 1, details: [] }, mediation: "promised" });
|
|
392
|
+
}
|
|
350
393
|
return capabilities;
|
|
351
394
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const VIEW_BEARING_CONTRIBUTIONS: readonly ["dataTypes", "adminSections", "railEntries", "dashboardWidgets"];
|
|
2
|
+
/** An empty array declares nothing and so buys no bundle. Named for what it
|
|
3
|
+
* answers, not `hasClientBundle`: that name once took a `type` string. */
|
|
4
|
+
export declare function declaresClientBundle(contributions: unknown): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// S311 (S341): whether a manifest's contributions need a client bundle, defined
|
|
2
|
+
// once. It was the SDK's (manifest.ts) and a pinned hand mirror in the
|
|
3
|
+
// marketplace door. It reads a live PluginContributions and the function-stripped
|
|
4
|
+
// summary in manifest.json alike: every contribution key and every array length
|
|
5
|
+
// survives that redaction. Pure data, no node: import, so the browser-safe
|
|
6
|
+
// `./reference` subpath can export it.
|
|
7
|
+
export const VIEW_BEARING_CONTRIBUTIONS = [
|
|
8
|
+
"dataTypes",
|
|
9
|
+
"adminSections",
|
|
10
|
+
"railEntries",
|
|
11
|
+
"dashboardWidgets",
|
|
12
|
+
];
|
|
13
|
+
/** An empty array declares nothing and so buys no bundle. Named for what it
|
|
14
|
+
* answers, not `hasClientBundle`: that name once took a `type` string. */
|
|
15
|
+
export function declaresClientBundle(contributions) {
|
|
16
|
+
if (contributions === null || typeof contributions !== "object")
|
|
17
|
+
return false;
|
|
18
|
+
const declared = contributions;
|
|
19
|
+
return VIEW_BEARING_CONTRIBUTIONS.some((key) => {
|
|
20
|
+
const value = declared[key];
|
|
21
|
+
if (value === null || value === undefined)
|
|
22
|
+
return false;
|
|
23
|
+
return Array.isArray(value) ? value.length > 0 : true;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PlannedEntry } from "../extract.js";
|
|
2
|
+
import { type Plain } from "./support.js";
|
|
3
|
+
import type { DeliveryCheck } from "./types.js";
|
|
4
|
+
/** Every entry the build carries from the plugin's own folders, as the archive
|
|
5
|
+
* will name it: README.md, the cover, sample-content.json, the docs pages and
|
|
6
|
+
* the images they show, the files directly inside locales/, and templates/,
|
|
7
|
+
* public/ and media/ through walkShipped (a folder appears only when nothing
|
|
8
|
+
* inside it ships, as the archive holds it). Each path once. The build's own
|
|
9
|
+
* output (manifest.json, server/, the client bundle) has fixed names or is
|
|
10
|
+
* `pack`'s to judge. */
|
|
11
|
+
export declare function shippedEntries(dir: string, manifest: Plain): PlannedEntry[];
|
|
12
|
+
/** The client bundle as the archive will name it: `remoteEntry.js` and every
|
|
13
|
+
* regular file under `assets/`, at any depth, links never followed (S311
|
|
14
|
+
* third code fix). `root` is the folder the bundle was built into: the
|
|
15
|
+
* federation build `validate` makes for `bundle size`, or the package itself
|
|
16
|
+
* at the marketplace. */
|
|
17
|
+
export declare function bundleEntries(root: string): PlannedEntry[];
|
|
18
|
+
/** Every reason the entry gate would refuse one of `entries`: entryViolation's
|
|
19
|
+
* name and size rules, then createPathKeyGate's (each path once, one kind),
|
|
20
|
+
* each in the gate's own words, and then the archive's own ceilings, which
|
|
21
|
+
* what the build carries from the plugin's folders already breaks when it
|
|
22
|
+
* holds more than MAX_ENTRIES entries or MAX_TOTAL_BYTES once expanded (S311
|
|
23
|
+
* second code fix: the build's own files only add to both). */
|
|
24
|
+
export declare function archiveNameProblems(entries: readonly PlannedEntry[]): string[];
|
|
25
|
+
export declare const archiveNamesCheck: DeliveryCheck;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { lstatSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { FILE_NAME_MAX, effectiveDocsPages } from "@kardalum/api-schemas";
|
|
4
|
+
import { declaresClientBundle } from "../client-bundle.js";
|
|
5
|
+
import { docsFilesToShip } from "../docs-contract.js";
|
|
6
|
+
import { ENTRY_NAME_MAX, ENTRY_SEGMENTS_MAX, MAX_ENTRIES, MAX_ENTRY_BYTES, MAX_TOTAL_BYTES, createPathKeyGate, entryViolation, } from "../extract.js";
|
|
7
|
+
import { COVER_PATH } from "../package-contract.js";
|
|
8
|
+
import { walkShipped } from "../shipped-files.js";
|
|
9
|
+
import { formatBinarySize } from "./limits.js";
|
|
10
|
+
import { failed, passed, plural, warning } from "./support.js";
|
|
11
|
+
// S311 fix wave (W2): the marketplace and every install read a package through
|
|
12
|
+
// one entry gate (createEntryGate in extract.ts), which refuses a name that
|
|
13
|
+
// reads differently on a Linux, Windows or macOS host. `validate` used to apply
|
|
14
|
+
// none of it, so a plugin whose public/ held "café.css" passed validate, build
|
|
15
|
+
// and pack and was then refused at the door. This check applies the same rules
|
|
16
|
+
// (entryViolation and the path rule of createPathKeyGate) to every name the
|
|
17
|
+
// build carries from the plugin's own folders; `kardalum plugin pack` applies
|
|
18
|
+
// the whole gate again to the archive it is about to write, the client bundle
|
|
19
|
+
// included.
|
|
20
|
+
/** The folders the build copies whole, through walkShipped. */
|
|
21
|
+
const COPIED_FOLDERS = ["templates", "public", "media"];
|
|
22
|
+
function regularFileSize(path) {
|
|
23
|
+
try {
|
|
24
|
+
const stats = lstatSync(path);
|
|
25
|
+
return stats.isFile() ? stats.size : null;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function isFolder(path) {
|
|
32
|
+
try {
|
|
33
|
+
return lstatSync(path).isDirectory();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function isLink(path) {
|
|
40
|
+
try {
|
|
41
|
+
return lstatSync(path).isSymbolicLink();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** Every entry the build carries from the plugin's own folders, as the archive
|
|
48
|
+
* will name it: README.md, the cover, sample-content.json, the docs pages and
|
|
49
|
+
* the images they show, the files directly inside locales/, and templates/,
|
|
50
|
+
* public/ and media/ through walkShipped (a folder appears only when nothing
|
|
51
|
+
* inside it ships, as the archive holds it). Each path once. The build's own
|
|
52
|
+
* output (manifest.json, server/, the client bundle) has fixed names or is
|
|
53
|
+
* `pack`'s to judge. */
|
|
54
|
+
export function shippedEntries(dir, manifest) {
|
|
55
|
+
const entries = new Map();
|
|
56
|
+
const addFile = (name, size) => {
|
|
57
|
+
if (size !== null && !entries.has(name))
|
|
58
|
+
entries.set(name, { name, isDirectory: false, size });
|
|
59
|
+
};
|
|
60
|
+
for (const name of ["README.md", COVER_PATH, "sample-content.json"])
|
|
61
|
+
addFile(name, regularFileSize(join(dir, ...name.split("/"))));
|
|
62
|
+
const pages = effectiveDocsPages(manifest.docs, String(manifest.name ?? ""));
|
|
63
|
+
for (const name of docsFilesToShip(dir, pages))
|
|
64
|
+
addFile(name, regularFileSize(join(dir, ...name.split("/"))));
|
|
65
|
+
const locales = join(dir, "locales");
|
|
66
|
+
if (isFolder(locales)) {
|
|
67
|
+
for (const entry of readdirSync(locales, { withFileTypes: true })) {
|
|
68
|
+
if (entry.isFile())
|
|
69
|
+
addFile(`locales/${entry.name}`, regularFileSize(join(locales, entry.name)));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
for (const folder of COPIED_FOLDERS) {
|
|
73
|
+
const root = join(dir, folder);
|
|
74
|
+
const walked = walkShipped(root);
|
|
75
|
+
if (walked.length === 0) {
|
|
76
|
+
if (isFolder(root))
|
|
77
|
+
entries.set(`${folder}/`, { name: folder, isDirectory: true, size: 0 });
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
for (const entry of walked) {
|
|
81
|
+
const name = `${folder}/${entry.path}`;
|
|
82
|
+
if (entry.isDirectory) {
|
|
83
|
+
if (entry.empty)
|
|
84
|
+
entries.set(`${name}/`, { name, isDirectory: true, size: 0 });
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
addFile(name, regularFileSize(join(root, ...entry.path.split("/"))));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return [...entries.values()];
|
|
92
|
+
}
|
|
93
|
+
/** The client bundle as the archive will name it: `remoteEntry.js` and every
|
|
94
|
+
* regular file under `assets/`, at any depth, links never followed (S311
|
|
95
|
+
* third code fix). `root` is the folder the bundle was built into: the
|
|
96
|
+
* federation build `validate` makes for `bundle size`, or the package itself
|
|
97
|
+
* at the marketplace. */
|
|
98
|
+
export function bundleEntries(root) {
|
|
99
|
+
const entries = [];
|
|
100
|
+
const entry = regularFileSize(join(root, "remoteEntry.js"));
|
|
101
|
+
if (entry !== null)
|
|
102
|
+
entries.push({ name: "remoteEntry.js", isDirectory: false, size: entry });
|
|
103
|
+
if (!isFolder(join(root, "assets")))
|
|
104
|
+
return entries;
|
|
105
|
+
// A queue read by index, as walkShipped reads one.
|
|
106
|
+
const pending = ["assets"];
|
|
107
|
+
for (let next = 0; next < pending.length; next++) {
|
|
108
|
+
const folder = pending[next];
|
|
109
|
+
for (const child of readdirSync(join(root, ...folder.split("/")), { withFileTypes: true })) {
|
|
110
|
+
const name = `${folder}/${child.name}`;
|
|
111
|
+
if (child.isDirectory())
|
|
112
|
+
pending.push(name);
|
|
113
|
+
else if (child.isFile())
|
|
114
|
+
entries.push({ name, isDirectory: false, size: regularFileSize(join(root, ...name.split("/"))) ?? 0 });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return entries;
|
|
118
|
+
}
|
|
119
|
+
/** Every reason the entry gate would refuse one of `entries`: entryViolation's
|
|
120
|
+
* name and size rules, then createPathKeyGate's (each path once, one kind),
|
|
121
|
+
* each in the gate's own words, and then the archive's own ceilings, which
|
|
122
|
+
* what the build carries from the plugin's folders already breaks when it
|
|
123
|
+
* holds more than MAX_ENTRIES entries or MAX_TOTAL_BYTES once expanded (S311
|
|
124
|
+
* second code fix: the build's own files only add to both). */
|
|
125
|
+
export function archiveNameProblems(entries) {
|
|
126
|
+
const { names, entriesOver, bytesOver } = findNameProblems(entries);
|
|
127
|
+
return [...names, ...(entriesOver ? [entriesOver] : []), ...(bytesOver ? [bytesOver] : [])];
|
|
128
|
+
}
|
|
129
|
+
function findNameProblems(entries) {
|
|
130
|
+
const admitPath = createPathKeyGate();
|
|
131
|
+
const problems = [];
|
|
132
|
+
let totalBytes = 0;
|
|
133
|
+
for (const entry of entries) {
|
|
134
|
+
totalBytes += entry.size;
|
|
135
|
+
const name = entry.isDirectory ? `${entry.name}/` : entry.name;
|
|
136
|
+
const violation = entryViolation(name, entry.isDirectory ? "Directory" : "File", entry.size);
|
|
137
|
+
if (violation) {
|
|
138
|
+
problems.push(violation);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const refusal = admitPath(name, entry.isDirectory);
|
|
142
|
+
if (refusal)
|
|
143
|
+
problems.push(refusal);
|
|
144
|
+
}
|
|
145
|
+
const entriesOver = entries.length > MAX_ENTRIES ? `the plugin's folders hold ${entries.length} entries, more than the ${MAX_ENTRIES} an archive may hold` : null;
|
|
146
|
+
const bytesOver = totalBytes > MAX_TOTAL_BYTES
|
|
147
|
+
? `the plugin's folders hold ${(totalBytes / 1024 / 1024).toFixed(1)} MiB once expanded, more than the ${formatBinarySize(MAX_TOTAL_BYTES)} an archive may expand to`
|
|
148
|
+
: null;
|
|
149
|
+
return { names: problems, entriesOver, bytesOver };
|
|
150
|
+
}
|
|
151
|
+
/** The check's headline: what kind of problem it found, the names it refuses,
|
|
152
|
+
* the entries or the bytes past the archive's ceilings, or several. */
|
|
153
|
+
function headline({ names, entriesOver, bytesOver }) {
|
|
154
|
+
const parts = [];
|
|
155
|
+
if (names.length > 0)
|
|
156
|
+
parts.push(`${plural(names.length, "name")} in the package the marketplace and every install refuse`);
|
|
157
|
+
if (entriesOver)
|
|
158
|
+
parts.push("more entries than an archive may hold");
|
|
159
|
+
if (bytesOver)
|
|
160
|
+
parts.push("more bytes than an archive may expand to");
|
|
161
|
+
return parts.length < 2 ? parts.join("") : `${parts.slice(0, -1).join(", ")}, and ${parts[parts.length - 1]}`;
|
|
162
|
+
}
|
|
163
|
+
export const archiveNamesCheck = {
|
|
164
|
+
name: "archive names",
|
|
165
|
+
// No vertical bar in the text: the rule is a cell of the page's table, so the
|
|
166
|
+
// character is named in words.
|
|
167
|
+
rule: "Every name the build carries from the plugin's folders, and every name in the client bundle it builds, " +
|
|
168
|
+
"reads the same way on Linux, Windows and macOS, as the marketplace and every install require: " +
|
|
169
|
+
`at most ${ENTRY_NAME_MAX} characters in at most ${ENTRY_SEGMENTS_MAX} segments, each segment at most ${FILE_NAME_MAX}; printable ASCII only, with no backslash, colon, ` +
|
|
170
|
+
"`<`, `>`, `\"`, `?`, `*` or vertical bar; no leading `/`; no `..` segment and no segment ending in a dot or a space; " +
|
|
171
|
+
"no `~` followed by a digit (the shape of a Windows short name) and no Windows device name such as `CON` or `NUL`; " +
|
|
172
|
+
"each path once with case ignored, never a file where another entry needs a folder; " +
|
|
173
|
+
`each file within ${formatBinarySize(MAX_ENTRY_BYTES)}, and at most ${MAX_ENTRIES} entries and ${formatBinarySize(MAX_TOTAL_BYTES)} in all. ` +
|
|
174
|
+
"A link in place of `templates/`, `public/` or `media/` warns, since nothing in it ships.",
|
|
175
|
+
gates: ["cli", "door"],
|
|
176
|
+
needsManifest: false,
|
|
177
|
+
run: ({ dir, manifest, bundle }) => {
|
|
178
|
+
// S311 third code fix: the client bundle too, from the build `bundle size`
|
|
179
|
+
// measures (validate's federation build, or the package at the
|
|
180
|
+
// marketplace), so a chunk name pack would refuse fails here first, in the
|
|
181
|
+
// gate's own words.
|
|
182
|
+
const bundled = declaresClientBundle(manifest.contributions) ? bundleEntries(bundle?.dir ?? dir) : [];
|
|
183
|
+
const entries = [...shippedEntries(dir, manifest), ...bundled];
|
|
184
|
+
const findings = findNameProblems(entries);
|
|
185
|
+
const problems = [...findings.names, ...(findings.entriesOver ? [findings.entriesOver] : []), ...(findings.bytesOver ? [findings.bytesOver] : [])];
|
|
186
|
+
// S311 second code fix: a link where the build copies a folder ships
|
|
187
|
+
// nothing (the walker never follows one), which is quietly not what the
|
|
188
|
+
// author meant, so it is said.
|
|
189
|
+
const linked = COPIED_FOLDERS.filter((folder) => isLink(join(dir, folder))).map((folder) => `${folder}/`);
|
|
190
|
+
const linkNote = linked.length === 0
|
|
191
|
+
? null
|
|
192
|
+
: `${listOf(linked)} ${linked.length === 1 ? "is a link" : "are links"}, and the build copies files and folders, never links: nothing in ${linked.length === 1 ? "it" : "them"} ships`;
|
|
193
|
+
if (problems.length > 0)
|
|
194
|
+
return failed(headline(findings), linkNote ? [...problems, linkNote] : problems);
|
|
195
|
+
if (linkNote)
|
|
196
|
+
return warning(linkNote);
|
|
197
|
+
return passed(`${plural(entries.length, "name")}, each read the same way on every host`);
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
/** "a", "a and b", "a, b and c". */
|
|
201
|
+
function listOf(items) {
|
|
202
|
+
return items.length < 2 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
|
|
203
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { lstatSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { gzipSync } from "node:zlib";
|
|
4
|
+
import { declaresClientBundle } from "../client-bundle.js";
|
|
5
|
+
import { BUNDLE_MAX_GZIP_BYTES, BUNDLE_WARN_SHARE, formatBinarySize } from "./limits.js";
|
|
6
|
+
import { failed, passed, warning } from "./support.js";
|
|
7
|
+
const kb = (bytes) => `${Math.ceil(bytes / 1024)} KiB`;
|
|
8
|
+
/** Every regular file under `dir`, at any depth, never following a link. */
|
|
9
|
+
function filesUnder(dir) {
|
|
10
|
+
const files = [];
|
|
11
|
+
const pending = [dir];
|
|
12
|
+
while (pending.length > 0) {
|
|
13
|
+
const current = pending.pop();
|
|
14
|
+
for (const entry of readdirSync(current, { withFileTypes: true })) {
|
|
15
|
+
const path = join(current, entry.name);
|
|
16
|
+
if (entry.isDirectory())
|
|
17
|
+
pending.push(path);
|
|
18
|
+
else if (entry.isFile())
|
|
19
|
+
files.push(path);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return files;
|
|
23
|
+
}
|
|
24
|
+
/** S311 fix wave: what the admin downloads for a plugin's screens, gzipped:
|
|
25
|
+
* remoteEntry.js and every file under assets/, at any depth, against
|
|
26
|
+
* BUNDLE_MAX_GZIP_BYTES. The door measures the delivered package; the CLI
|
|
27
|
+
* measures the federation build it packs, which it hands over as `bundle`,
|
|
28
|
+
* with the build's error when the build failed. */
|
|
29
|
+
function checkBundleSize(root) {
|
|
30
|
+
const entryPath = join(root, "remoteEntry.js");
|
|
31
|
+
let entryIsFile;
|
|
32
|
+
try {
|
|
33
|
+
entryIsFile = lstatSync(entryPath).isFile();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return failed("no remoteEntry.js to measure: a plugin that declares a view-bearing contribution ships one");
|
|
37
|
+
}
|
|
38
|
+
if (!entryIsFile)
|
|
39
|
+
return failed("remoteEntry.js is not a regular file");
|
|
40
|
+
let assets = [];
|
|
41
|
+
const assetsDir = join(root, "assets");
|
|
42
|
+
try {
|
|
43
|
+
if (lstatSync(assetsDir).isDirectory())
|
|
44
|
+
assets = filesUnder(assetsDir);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// No assets/ folder: remoteEntry.js is the whole bundle.
|
|
48
|
+
}
|
|
49
|
+
let total = 0;
|
|
50
|
+
for (const path of [entryPath, ...assets])
|
|
51
|
+
total += gzipSync(readFileSync(path)).length;
|
|
52
|
+
const counted = assets.length > 0 ? "remoteEntry.js and assets/" : "remoteEntry.js";
|
|
53
|
+
if (total > BUNDLE_MAX_GZIP_BYTES)
|
|
54
|
+
return failed(`${kb(total)} gzipped (${counted}) exceeds the ${kb(BUNDLE_MAX_GZIP_BYTES)} limit`);
|
|
55
|
+
if (total >= BUNDLE_MAX_GZIP_BYTES * BUNDLE_WARN_SHARE) {
|
|
56
|
+
return warning(`${kb(total)} gzipped (${counted}), within ${Math.round((1 - BUNDLE_WARN_SHARE) * 100)}% of the ${kb(BUNDLE_MAX_GZIP_BYTES)} limit`);
|
|
57
|
+
}
|
|
58
|
+
return passed(`${kb(total)} gzipped (limit ${kb(BUNDLE_MAX_GZIP_BYTES)})`);
|
|
59
|
+
}
|
|
60
|
+
export const NOT_VIEW_BEARING = "not applicable: this plugin declares nothing view-bearing, so it ships no client bundle";
|
|
61
|
+
export const bundleSizeCheck = {
|
|
62
|
+
name: "bundle size",
|
|
63
|
+
rule: `The gzipped \`remoteEntry.js\` and every file under \`assets/\` together are within ${formatBinarySize(BUNDLE_MAX_GZIP_BYTES)}, with a warning from ${Math.round(BUNDLE_WARN_SHARE * 100)}%; not applicable when nothing view-bearing is declared.`,
|
|
64
|
+
gates: ["cli", "door"],
|
|
65
|
+
needsManifest: true,
|
|
66
|
+
run: ({ dir, manifest, bundle }) => {
|
|
67
|
+
if (!declaresClientBundle(manifest.contributions))
|
|
68
|
+
return { status: "skipped", message: NOT_VIEW_BEARING };
|
|
69
|
+
if (bundle?.buildError !== undefined)
|
|
70
|
+
return failed(`federation build failed: ${bundle.buildError}`);
|
|
71
|
+
return checkBundleSize(bundle?.dir ?? dir);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DeliveryCheck } from "./types.js";
|
|
2
|
+
export { iconNamesCheck } from "./icons.js";
|
|
3
|
+
export declare const requiredViewsCheck: DeliveryCheck;
|
|
4
|
+
export declare const apiRoutesCheck: DeliveryCheck;
|
|
5
|
+
export declare const databaseCheck: DeliveryCheck;
|
|
6
|
+
/** S320 (spec 3c): a listed plugin's vendor service is https. A manifest may
|
|
7
|
+
* name http://localhost while in development; nothing published may. */
|
|
8
|
+
export declare const vendorServiceCheck: DeliveryCheck;
|