@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
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ICON_NAMES } from "./icon-names.generated.js";
|
|
2
|
+
import { contributionsOf, failed, list, passed, record } from "./support.js";
|
|
3
|
+
// Finding 28 and S239: an icon name is a Lucide name, the set the admin's icon
|
|
4
|
+
// picker and the SDK's IconName type are made from. A value Lucide does not
|
|
5
|
+
// have draws the default glyph, a path included (no consumer reads this field
|
|
6
|
+
// as a URL). The list is generated from lucide-react (icon-names.generated.ts),
|
|
7
|
+
// so the door needs no React and no dynamic imports.
|
|
8
|
+
const VALID = new Set(ICON_NAMES);
|
|
9
|
+
// Every contribution kind whose schema carries an `icon`: adminSections (and
|
|
10
|
+
// each entry of its optional `rail`, reported as `adminSections.rail`),
|
|
11
|
+
// railEntries, dataTypes and documentTypes (optional, "" means the default
|
|
12
|
+
// icon). No other contribution has an icon field.
|
|
13
|
+
const ICON_BEARING = ["adminSections", "railEntries", "dataTypes", "documentTypes"];
|
|
14
|
+
/** Every (where, icon) pair the icon-bearing contributions carry, a section's
|
|
15
|
+
* own rail entries included, in declaration order. */
|
|
16
|
+
function declaredIcons(contributions) {
|
|
17
|
+
const found = [];
|
|
18
|
+
for (const kind of ICON_BEARING) {
|
|
19
|
+
for (const entry of list(contributions[kind])) {
|
|
20
|
+
found.push({ where: kind, icon: record(entry)?.icon });
|
|
21
|
+
if (kind !== "adminSections")
|
|
22
|
+
continue;
|
|
23
|
+
for (const railEntry of list(record(entry)?.rail))
|
|
24
|
+
found.push({ where: "adminSections.rail", icon: record(railEntry)?.icon });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return found;
|
|
28
|
+
}
|
|
29
|
+
export const iconNamesCheck = {
|
|
30
|
+
name: "icon names",
|
|
31
|
+
rule: "Every `icon` a contribution declares is a Lucide icon name in kebab-case.",
|
|
32
|
+
gates: ["cli", "door"],
|
|
33
|
+
needsManifest: true,
|
|
34
|
+
run: ({ manifest }) => {
|
|
35
|
+
const unresolved = [];
|
|
36
|
+
// Counted so a plugin that declares no icons says so rather than
|
|
37
|
+
// claiming a pass for something it never inspected.
|
|
38
|
+
let inspected = 0;
|
|
39
|
+
for (const { where, icon } of declaredIcons(contributionsOf(manifest))) {
|
|
40
|
+
if (typeof icon !== "string" || icon === "")
|
|
41
|
+
continue;
|
|
42
|
+
inspected += 1;
|
|
43
|
+
if (!VALID.has(icon))
|
|
44
|
+
unresolved.push(`${where}: ${icon}`);
|
|
45
|
+
}
|
|
46
|
+
if (unresolved.length === 0) {
|
|
47
|
+
return passed(inspected === 0 ? "not applicable: this plugin declares no icons" : "every icon is a Lucide name");
|
|
48
|
+
}
|
|
49
|
+
return failed(unresolved.length === 1 ? "1 icon value is not a Lucide name" : `${unresolved.length} icon values are not Lucide names`, [...unresolved, "Browse the names at https://lucide.dev/icons/ (kebab-case)."]);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./limits.js";
|
|
3
|
+
export { describeError, listCapped } from "./support.js";
|
|
4
|
+
export { DELIVERY_CHECKS, GATE_ONLY_CHECKS, renderDeliveryLimits, renderDeliveryTable, runChecks, runDeliveryChecks } from "./registry.js";
|
|
5
|
+
export { archiveNameProblems, shippedEntries } from "./archive-names.js";
|
|
6
|
+
export { collectLabelLanguages, collectLabelMaps } from "./label-languages.js";
|
|
7
|
+
export type { LabelMapRef } from "./label-languages.js";
|
|
8
|
+
export { ICON_NAMES } from "./icon-names.generated.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./limits.js";
|
|
3
|
+
export { describeError, listCapped } from "./support.js";
|
|
4
|
+
export { DELIVERY_CHECKS, GATE_ONLY_CHECKS, renderDeliveryLimits, renderDeliveryTable, runChecks, runDeliveryChecks } from "./registry.js";
|
|
5
|
+
export { archiveNameProblems, shippedEntries } from "./archive-names.js";
|
|
6
|
+
export { collectLabelLanguages, collectLabelMaps } from "./label-languages.js";
|
|
7
|
+
export { ICON_NAMES } from "./icon-names.generated.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Plain } from "./support.js";
|
|
2
|
+
import type { DeliveryCheck } from "./types.js";
|
|
3
|
+
export interface LabelMapRef {
|
|
4
|
+
where: string;
|
|
5
|
+
codes: string[];
|
|
6
|
+
}
|
|
7
|
+
/** Every label written as a language map, in a fixed order: the manifest's
|
|
8
|
+
* actions and roles, the contributions above (a section's rail entries after
|
|
9
|
+
* the section), and the install steps, options and choices, each label then
|
|
10
|
+
* its description (S311 fix wave: a description is a language map too). A
|
|
11
|
+
* plain string is not listed: it opts that label out of translation. `where`
|
|
12
|
+
* reads as the manifest does, a contribution under `contributions.`, as the
|
|
13
|
+
* SDK's errors name it; a description's ends in `.description`. */
|
|
14
|
+
export declare function collectLabelMaps(manifest: Plain): LabelMapRef[];
|
|
15
|
+
/** Each language code any label map uses, once (first spelling wins), sorted. */
|
|
16
|
+
export declare function collectLabelLanguages(manifest: Plain): string[];
|
|
17
|
+
export declare const labelLanguagesCheck: DeliveryCheck;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { pluginLocaleFileLanguage } from "@kardalum/api-schemas";
|
|
4
|
+
import { LISTED_MAX, contributionsOf, list, listCapped, passed, record, warning } from "./support.js";
|
|
5
|
+
/** The contribution fields whose value is a label (a language map or a plain string). */
|
|
6
|
+
const LABEL_FIELDS = [
|
|
7
|
+
["adminSections", "label"],
|
|
8
|
+
["railEntries", "label"],
|
|
9
|
+
["dashboardWidgets", "name"],
|
|
10
|
+
["scheduledTasks", "name"],
|
|
11
|
+
["mediaProcessors", "name"],
|
|
12
|
+
["exposedServices", "name"],
|
|
13
|
+
];
|
|
14
|
+
function addMap(into, where, value) {
|
|
15
|
+
const map = record(value);
|
|
16
|
+
if (map !== null)
|
|
17
|
+
into.push({ where, codes: Object.keys(map) });
|
|
18
|
+
}
|
|
19
|
+
/** Every label written as a language map, in a fixed order: the manifest's
|
|
20
|
+
* actions and roles, the contributions above (a section's rail entries after
|
|
21
|
+
* the section), and the install steps, options and choices, each label then
|
|
22
|
+
* its description (S311 fix wave: a description is a language map too). A
|
|
23
|
+
* plain string is not listed: it opts that label out of translation. `where`
|
|
24
|
+
* reads as the manifest does, a contribution under `contributions.`, as the
|
|
25
|
+
* SDK's errors name it; a description's ends in `.description`. */
|
|
26
|
+
export function collectLabelMaps(manifest) {
|
|
27
|
+
const found = [];
|
|
28
|
+
list(manifest.actions).forEach((entry, i) => addMap(found, `actions[${i}]`, record(entry)?.label));
|
|
29
|
+
list(manifest.roles).forEach((entry, i) => addMap(found, `roles[${i}]`, record(entry)?.label));
|
|
30
|
+
const contributions = contributionsOf(manifest);
|
|
31
|
+
for (const [contribution, field] of LABEL_FIELDS) {
|
|
32
|
+
list(contributions[contribution]).forEach((entry, i) => {
|
|
33
|
+
addMap(found, `contributions.${contribution}[${i}]`, record(entry)?.[field]);
|
|
34
|
+
if (contribution !== "adminSections")
|
|
35
|
+
return;
|
|
36
|
+
list(record(entry)?.rail).forEach((rail, j) => addMap(found, `contributions.adminSections[${i}].rail[${j}]`, record(rail)?.label));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const addText = (where, entry) => {
|
|
40
|
+
addMap(found, where, record(entry)?.label);
|
|
41
|
+
addMap(found, `${where}.description`, record(entry)?.description);
|
|
42
|
+
};
|
|
43
|
+
list(record(manifest.install)?.steps).forEach((step, i) => {
|
|
44
|
+
addText(`install.steps[${i}]`, step);
|
|
45
|
+
list(record(step)?.options).forEach((option, j) => {
|
|
46
|
+
addText(`install.steps[${i}].options[${j}]`, option);
|
|
47
|
+
list(record(option)?.choices).forEach((choice, k) => addText(`install.steps[${i}].options[${j}].choices[${k}]`, choice));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
return found;
|
|
51
|
+
}
|
|
52
|
+
/** Each language code any label map uses, once (first spelling wins), sorted. */
|
|
53
|
+
export function collectLabelLanguages(manifest) {
|
|
54
|
+
const byLower = new Map();
|
|
55
|
+
for (const { codes } of collectLabelMaps(manifest)) {
|
|
56
|
+
for (const code of codes)
|
|
57
|
+
if (!byLower.has(code.toLowerCase()))
|
|
58
|
+
byLower.set(code.toLowerCase(), code);
|
|
59
|
+
}
|
|
60
|
+
return [...byLower.values()].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
|
|
61
|
+
}
|
|
62
|
+
/** The languages `locales/` has a file for, lower-cased (`en` among them when
|
|
63
|
+
* en.json is there); none when it cannot be read. */
|
|
64
|
+
function localeFileLanguages(dir) {
|
|
65
|
+
try {
|
|
66
|
+
return new Set(readdirSync(join(dir, "locales"))
|
|
67
|
+
.map((name) => pluginLocaleFileLanguage(name))
|
|
68
|
+
.filter((code) => code !== null)
|
|
69
|
+
.map((code) => code.toLowerCase()));
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return new Set();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** What to do about label languages no locale file carries: add the files (and
|
|
76
|
+
* English beside them, read with usePluginTranslate, when the package has no
|
|
77
|
+
* locales yet), or drop the languages from the labels. */
|
|
78
|
+
function missingFiles(codes, hasEnglish) {
|
|
79
|
+
const one = codes.length === 1;
|
|
80
|
+
const named = one ? `the label language ${codes[0]} has` : `the label languages ${listCapped(codes, "names")} have`;
|
|
81
|
+
const drop = one ? `drop ${codes[0]} from the labels` : "drop those languages from the labels";
|
|
82
|
+
const why = "(the screens' words show English)";
|
|
83
|
+
if (hasEnglish) {
|
|
84
|
+
return one
|
|
85
|
+
? `${named} no locales/${codes[0]}.json: add it, or ${drop} ${why}`
|
|
86
|
+
: `${named} no locales/<language>.json: add them, or ${drop} ${why}`;
|
|
87
|
+
}
|
|
88
|
+
const add = one ? `add locales/en.json and locales/${codes[0]}.json and` : "add locales/en.json and a locales/<language>.json for each, and";
|
|
89
|
+
return `${named} no locale file: ${add} read them with usePluginTranslate, or ${drop} ${why}`;
|
|
90
|
+
}
|
|
91
|
+
export const labelLanguagesCheck = {
|
|
92
|
+
name: "label languages",
|
|
93
|
+
rule: "Advisory: every label written as a language map carries the languages the others carry, and each of those languages has a `locales/<language>.json`.",
|
|
94
|
+
gates: ["cli", "door"],
|
|
95
|
+
needsManifest: true,
|
|
96
|
+
run: ({ dir, manifest }) => {
|
|
97
|
+
const maps = collectLabelMaps(manifest);
|
|
98
|
+
if (maps.length === 0)
|
|
99
|
+
return passed("no label is written in more than one language");
|
|
100
|
+
const all = collectLabelLanguages(manifest);
|
|
101
|
+
const problems = [];
|
|
102
|
+
const files = localeFileLanguages(dir);
|
|
103
|
+
const withoutFile = all.filter((code) => code.toLowerCase() !== "en" && !files.has(code.toLowerCase()));
|
|
104
|
+
if (withoutFile.length > 0)
|
|
105
|
+
problems.push(missingFiles(withoutFile, files.has("en")));
|
|
106
|
+
for (const map of maps) {
|
|
107
|
+
// Every code a map holds is one of `all`, so a map with fewer distinct
|
|
108
|
+
// codes lacks one. Only the problems the message prints say which: the
|
|
109
|
+
// rest are counted, so a manifest of many maps costs one pass.
|
|
110
|
+
const has = new Set(map.codes.map((code) => code.toLowerCase()));
|
|
111
|
+
if (has.size >= all.length)
|
|
112
|
+
continue;
|
|
113
|
+
problems.push(problems.length < LISTED_MAX ? `${map.where} lacks ${listCapped(all.filter((code) => !has.has(code.toLowerCase())), "names")}` : map.where);
|
|
114
|
+
}
|
|
115
|
+
if (problems.length === 0)
|
|
116
|
+
return passed(`${listCapped(all, "names")}: every label map carries them all`);
|
|
117
|
+
return warning(listCapped(problems));
|
|
118
|
+
},
|
|
119
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** manifest.json is read whole by the marketplace; a hostile archive could inflate it. */
|
|
2
|
+
export declare const MANIFEST_MAX_BYTES: number;
|
|
3
|
+
/** Gzipped remoteEntry.js plus every file under assets/ together (S80's
|
|
4
|
+
* threshold): the shared "bundle size" check fails above it and warns from
|
|
5
|
+
* BUNDLE_WARN_SHARE of it. */
|
|
6
|
+
export declare const BUNDLE_MAX_GZIP_BYTES: number;
|
|
7
|
+
/** At or above this share of BUNDLE_MAX_GZIP_BYTES the "bundle size" check
|
|
8
|
+
* warns: a bundle that close grows past the limit with its next dependency. */
|
|
9
|
+
export declare const BUNDLE_WARN_SHARE = 0.9;
|
|
10
|
+
/** A byte count as the delivery page and every rule string write it (S311 docs
|
|
11
|
+
* wave): binary units, 1 KiB being 1024 bytes, the largest that divides the
|
|
12
|
+
* count exactly, so a limit is never rounded into a different number. A check's
|
|
13
|
+
* own message prints the same size, with the same units. */
|
|
14
|
+
export declare function formatBinarySize(bytes: number): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// S311: limits two gates and the page quote, defined once.
|
|
2
|
+
/** manifest.json is read whole by the marketplace; a hostile archive could inflate it. */
|
|
3
|
+
export const MANIFEST_MAX_BYTES = 1024 * 1024;
|
|
4
|
+
/** Gzipped remoteEntry.js plus every file under assets/ together (S80's
|
|
5
|
+
* threshold): the shared "bundle size" check fails above it and warns from
|
|
6
|
+
* BUNDLE_WARN_SHARE of it. */
|
|
7
|
+
export const BUNDLE_MAX_GZIP_BYTES = 250 * 1024;
|
|
8
|
+
/** At or above this share of BUNDLE_MAX_GZIP_BYTES the "bundle size" check
|
|
9
|
+
* warns: a bundle that close grows past the limit with its next dependency. */
|
|
10
|
+
export const BUNDLE_WARN_SHARE = 0.9;
|
|
11
|
+
/** A byte count as the delivery page and every rule string write it (S311 docs
|
|
12
|
+
* wave): binary units, 1 KiB being 1024 bytes, the largest that divides the
|
|
13
|
+
* count exactly, so a limit is never rounded into a different number. A check's
|
|
14
|
+
* own message prints the same size, with the same units. */
|
|
15
|
+
export function formatBinarySize(bytes) {
|
|
16
|
+
if (bytes % (1024 * 1024) === 0)
|
|
17
|
+
return `${bytes / 1024 / 1024} MiB`;
|
|
18
|
+
if (bytes % 1024 === 0)
|
|
19
|
+
return `${bytes / 1024} KiB`;
|
|
20
|
+
return `${bytes} bytes`;
|
|
21
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DeliveryCheck, DeliveryOutcome } from "./types.js";
|
|
2
|
+
export declare function checkLocalesFolder(pluginDir: string): DeliveryOutcome;
|
|
3
|
+
export declare function checkLocaleParityFolder(pluginDir: string): DeliveryOutcome;
|
|
4
|
+
export declare const localesCheck: DeliveryCheck;
|
|
5
|
+
export declare const localeParityCheck: DeliveryCheck;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { lstatSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { PLUGIN_LOCALE_MAX_BYTES, compareLocaleFiles, parsePluginLocaleFile, pluginLocaleFileLanguage, } from "@kardalum/api-schemas";
|
|
4
|
+
import { failed, listCapped, passed, warning } from "./support.js";
|
|
5
|
+
// S290: a plugin's own strings ship as locales/<language>.json. The folder
|
|
6
|
+
// is optional (a plugin whose screens hold no words of their own needs
|
|
7
|
+
// none). When it exists, English is what every other language falls back
|
|
8
|
+
// to, so en.json is required, and every file must pass the rules the admin
|
|
9
|
+
// applies when it fetches one (parsePluginLocaleFile in
|
|
10
|
+
// @kardalum/api-schemas). Whether two languages carry the same keys is the
|
|
11
|
+
// parity check below. Both read every file in the folder: the archive's
|
|
12
|
+
// entry ceiling and the per-file cap bound that at the door.
|
|
13
|
+
export function checkLocalesFolder(pluginDir) {
|
|
14
|
+
const dir = join(pluginDir, "locales");
|
|
15
|
+
// lstat, never stat: a symbolic link would pass as the folder or file it
|
|
16
|
+
// points at, the build would carry the link into the package, and the
|
|
17
|
+
// host's extraction refuses a link.
|
|
18
|
+
let folder;
|
|
19
|
+
try {
|
|
20
|
+
folder = lstatSync(dir);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return passed("no locales/ folder: the plugin's screens show the strings in its code");
|
|
24
|
+
}
|
|
25
|
+
if (folder.isSymbolicLink())
|
|
26
|
+
return failed("locales is a symbolic link");
|
|
27
|
+
if (!folder.isDirectory())
|
|
28
|
+
return failed("locales is not a folder");
|
|
29
|
+
const problems = [];
|
|
30
|
+
const languages = [];
|
|
31
|
+
const entries = readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
32
|
+
for (const entry of entries) {
|
|
33
|
+
if (entry.isSymbolicLink()) {
|
|
34
|
+
problems.push(`locales/${entry.name} is a symbolic link`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (!entry.isFile()) {
|
|
38
|
+
problems.push(`locales/${entry.name} is not a file`);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const language = pluginLocaleFileLanguage(entry.name);
|
|
42
|
+
if (language === null) {
|
|
43
|
+
problems.push(`locales/${entry.name} is not named <language>.json (for example de.json)`);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const path = join(dir, entry.name);
|
|
47
|
+
const size = statSync(path).size;
|
|
48
|
+
if (size > PLUGIN_LOCALE_MAX_BYTES) {
|
|
49
|
+
problems.push(`locales/${entry.name}: ${size} bytes, over the ${PLUGIN_LOCALE_MAX_BYTES}-byte limit`);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
const parsed = parsePluginLocaleFile(readFileSync(path, "utf8"));
|
|
53
|
+
if (!parsed.ok) {
|
|
54
|
+
problems.push(`locales/${entry.name}: ${parsed.issue}`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
languages.push(language);
|
|
58
|
+
}
|
|
59
|
+
// By name: an en.json that is a link or a folder is reported as that,
|
|
60
|
+
// not also as missing.
|
|
61
|
+
if (!entries.some((entry) => entry.name === "en.json")) {
|
|
62
|
+
problems.unshift("locales/en.json is missing: English is what every other language falls back to");
|
|
63
|
+
}
|
|
64
|
+
if (problems.length > 0)
|
|
65
|
+
return failed(listCapped(problems));
|
|
66
|
+
return passed(`${languages.length} language${languages.length === 1 ? "" : "s"}: ${languages.join(", ")}`);
|
|
67
|
+
}
|
|
68
|
+
// S291: every locale file but en.json, held to en.json. A key English does
|
|
69
|
+
// not have fails (no screen asks for it; usually a typo), and so does a
|
|
70
|
+
// value whose {{placeholders}} differ from the English value's (the
|
|
71
|
+
// sentence renders with a hole or a stray brace). A key a language lacks
|
|
72
|
+
// only warns, with the count: the admin shows the plugin's English for it.
|
|
73
|
+
// The comparison is compareLocaleFiles from @kardalum/api-schemas, the one
|
|
74
|
+
// the marketplace's language line and the admin's own locale-parity test
|
|
75
|
+
// use. A file the `locales` check refuses is skipped here, so one problem is
|
|
76
|
+
// reported once.
|
|
77
|
+
const listKeys = (keys) => listCapped(keys, "names");
|
|
78
|
+
/** A locale file read the way checkLocalesFolder accepts one (a regular file,
|
|
79
|
+
* not a link, within the size limit, passing the S290 rules), or null. */
|
|
80
|
+
function readBundle(dir, fileName) {
|
|
81
|
+
const path = join(dir, fileName);
|
|
82
|
+
try {
|
|
83
|
+
const stats = lstatSync(path);
|
|
84
|
+
if (!stats.isFile() || stats.size > PLUGIN_LOCALE_MAX_BYTES)
|
|
85
|
+
return null;
|
|
86
|
+
const parsed = parsePluginLocaleFile(readFileSync(path, "utf8"));
|
|
87
|
+
return parsed.ok ? parsed.bundle : null;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export function checkLocaleParityFolder(pluginDir) {
|
|
94
|
+
const dir = join(pluginDir, "locales");
|
|
95
|
+
let fileNames;
|
|
96
|
+
try {
|
|
97
|
+
if (!lstatSync(dir).isDirectory())
|
|
98
|
+
return passed("nothing to compare: locales is not a folder (see locales)");
|
|
99
|
+
fileNames = readdirSync(dir).sort();
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return passed("no locales/ folder: nothing to compare");
|
|
103
|
+
}
|
|
104
|
+
const en = readBundle(dir, "en.json");
|
|
105
|
+
if (en === null)
|
|
106
|
+
return passed("nothing to compare: locales/en.json is missing or refused (see locales)");
|
|
107
|
+
const total = Object.keys(en).length;
|
|
108
|
+
const failures = [];
|
|
109
|
+
const warnings = [];
|
|
110
|
+
const matching = [];
|
|
111
|
+
for (const fileName of fileNames) {
|
|
112
|
+
if (fileName === "en.json" || pluginLocaleFileLanguage(fileName) === null)
|
|
113
|
+
continue;
|
|
114
|
+
const bundle = readBundle(dir, fileName);
|
|
115
|
+
if (bundle === null)
|
|
116
|
+
continue;
|
|
117
|
+
const { extra, missing, mismatched } = compareLocaleFiles(en, bundle);
|
|
118
|
+
if (extra.length > 0)
|
|
119
|
+
failures.push(`${fileName}: ${extra.length} ${extra.length === 1 ? "key" : "keys"} en.json lacks: ${listKeys(extra)}`);
|
|
120
|
+
if (mismatched.length > 0)
|
|
121
|
+
failures.push(`${fileName}: placeholders differ from en.json in ${listKeys(mismatched)}`);
|
|
122
|
+
if (missing.length > 0)
|
|
123
|
+
warnings.push(`${fileName}: ${missing.length} of ${total} keys missing, those show English`);
|
|
124
|
+
if (extra.length === 0 && mismatched.length === 0 && missing.length === 0)
|
|
125
|
+
matching.push(fileName);
|
|
126
|
+
}
|
|
127
|
+
if (failures.length > 0)
|
|
128
|
+
return failed(listCapped([...failures, ...warnings]));
|
|
129
|
+
if (warnings.length > 0)
|
|
130
|
+
return warning(listCapped(warnings));
|
|
131
|
+
if (matching.length === 0)
|
|
132
|
+
return passed("English only: nothing to compare");
|
|
133
|
+
return passed(`${matching.join(", ")}: every one of en.json's ${total} keys, placeholders matching`);
|
|
134
|
+
}
|
|
135
|
+
export const localesCheck = {
|
|
136
|
+
name: "locales",
|
|
137
|
+
rule: "`locales/` holds `en.json` and files named `<language>.json`, each within the size and key limits and the key rules.",
|
|
138
|
+
gates: ["cli", "door"],
|
|
139
|
+
needsManifest: false,
|
|
140
|
+
run: ({ dir }) => checkLocalesFolder(dir),
|
|
141
|
+
};
|
|
142
|
+
export const localeParityCheck = {
|
|
143
|
+
name: "locale parity",
|
|
144
|
+
rule: "A language never has a key English lacks or a different placeholder (both fail); a missing key only warns and shows English.",
|
|
145
|
+
gates: ["cli", "door"],
|
|
146
|
+
needsManifest: false,
|
|
147
|
+
run: ({ dir }) => checkLocaleParityFolder(dir),
|
|
148
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { docsFactsFrom, effectiveDocsPages, referencePageSlugs } from "@kardalum/api-schemas";
|
|
2
|
+
import { buildReference } from "../build-reference.js";
|
|
3
|
+
import { capViolations, checkDocsContract, countRemoteImages } from "../docs-contract.js";
|
|
4
|
+
import { checkCoverContract, checkReadmeContract, COVER_HEIGHT, COVER_PATH, COVER_WIDTH } from "../package-contract.js";
|
|
5
|
+
import { contributionsOf, failed, passed, warning } from "./support.js";
|
|
6
|
+
export const readmeCheck = {
|
|
7
|
+
name: "README present",
|
|
8
|
+
rule: "`README.md` exists and says something: a blank file would render as an empty listing description.",
|
|
9
|
+
gates: ["cli", "door"],
|
|
10
|
+
needsManifest: false,
|
|
11
|
+
run: ({ dir }) => {
|
|
12
|
+
const check = checkReadmeContract(dir);
|
|
13
|
+
return check.ok ? passed("README.md present") : failed(check.reason);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const coverCheck = {
|
|
17
|
+
name: "cover image present",
|
|
18
|
+
rule: `\`${COVER_PATH}\` is a real PNG of exactly ${COVER_WIDTH} by ${COVER_HEIGHT} pixels.`,
|
|
19
|
+
gates: ["cli", "door"],
|
|
20
|
+
needsManifest: false,
|
|
21
|
+
run: ({ dir }) => {
|
|
22
|
+
const check = checkCoverContract(dir);
|
|
23
|
+
return check.ok ? passed(`${COVER_PATH} is ${COVER_WIDTH}x${COVER_HEIGHT}`) : failed(check.reason);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
/** What the docs contract judges: the door passes what it read from manifest.json
|
|
27
|
+
* and reference.json; the CLI leaves it to be derived from the live manifest, so
|
|
28
|
+
* an author meets every requirement here first. */
|
|
29
|
+
function docsInputFor(context) {
|
|
30
|
+
if (context.docsInput)
|
|
31
|
+
return context.docsInput;
|
|
32
|
+
const manifest = context.manifest;
|
|
33
|
+
const pages = effectiveDocsPages(manifest.docs, String(manifest.name ?? ""));
|
|
34
|
+
const referenceInput = { ...manifest, contributions: contributionsOf(manifest) };
|
|
35
|
+
return {
|
|
36
|
+
ok: true,
|
|
37
|
+
input: {
|
|
38
|
+
pages,
|
|
39
|
+
facts: docsFactsFrom(manifest),
|
|
40
|
+
referenceSlugs: referencePageSlugs(buildReference(referenceInput)),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export const docsContractCheck = {
|
|
45
|
+
name: "docs contract",
|
|
46
|
+
rule: "The manifest's `docs` pages exist, carry the roles the contract requires, and keep to its links and image rules.",
|
|
47
|
+
gates: ["cli", "door"],
|
|
48
|
+
needsManifest: true,
|
|
49
|
+
run: (context) => {
|
|
50
|
+
const input = docsInputFor(context);
|
|
51
|
+
if (!input.ok)
|
|
52
|
+
return failed(capViolations(input.reasons).join("; "));
|
|
53
|
+
const { reasons } = checkDocsContract(context.dir, input.input);
|
|
54
|
+
if (reasons.length > 0)
|
|
55
|
+
return failed(capViolations(reasons).join("; "));
|
|
56
|
+
const remote = countRemoteImages(context.dir, input.input.pages);
|
|
57
|
+
const pages = input.input.pages.length;
|
|
58
|
+
const note = remote > 0 ? `, ${remote} remote image${remote === 1 ? "" : "s"} will not be shown` : "";
|
|
59
|
+
return passed(`docs contract satisfied (${pages} page${pages === 1 ? "" : "s"}${note})`);
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const docsLinksCheck = {
|
|
63
|
+
name: "docs-links",
|
|
64
|
+
rule: "Advisory: a docs link target that never renders as a link (`//host`, `ftp:`, `https:/x`) is shown as plain words.",
|
|
65
|
+
gates: ["cli", "door"],
|
|
66
|
+
needsManifest: true,
|
|
67
|
+
run: (context) => {
|
|
68
|
+
const input = docsInputFor(context);
|
|
69
|
+
if (!input.ok)
|
|
70
|
+
return passed("nothing to check: the docs contract could not read its input (see docs contract)");
|
|
71
|
+
const { warnings } = checkDocsContract(context.dir, input.input);
|
|
72
|
+
if (warnings.length === 0)
|
|
73
|
+
return passed("every docs link renders as a link");
|
|
74
|
+
return warning(capViolations(warnings).join("; "));
|
|
75
|
+
},
|
|
76
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DeliveryCheck, DeliveryContext, DeliveryGate, DeliveryResult, GateOnlyCheck } from "./types.js";
|
|
2
|
+
/** Runs the checks of one gate in order. A check that cannot run because the
|
|
3
|
+
* manifest did not parse says so; a check that throws is a failed result, never
|
|
4
|
+
* an exception that escapes the gate (a directory where a file belongs is the
|
|
5
|
+
* author's mistake, not an internal error), and it names the path inside the
|
|
6
|
+
* package. sample-content.json is read once, here, unless the caller already
|
|
7
|
+
* has (readShippedSampleContent never throws). */
|
|
8
|
+
export declare function runChecks(checks: readonly DeliveryCheck[], context: DeliveryContext, gate: DeliveryGate): DeliveryResult[];
|
|
9
|
+
/** Every check both gates run, in report order. */
|
|
10
|
+
export declare const DELIVERY_CHECKS: readonly DeliveryCheck[];
|
|
11
|
+
/** What only one gate can measure, as data, so the page and the tests see every
|
|
12
|
+
* check either gate can emit. Each CLI name is the one its check module in the
|
|
13
|
+
* CLI emits: the name-registration tests fail on a typo. The rules are the
|
|
14
|
+
* page's words, so they say "the marketplace" for the check of an upload and
|
|
15
|
+
* write a size in binary units, as formatBinarySize does. */
|
|
16
|
+
export declare const GATE_ONLY_CHECKS: readonly GateOnlyCheck[];
|
|
17
|
+
export declare function runDeliveryChecks(context: DeliveryContext, gate: DeliveryGate): DeliveryResult[];
|
|
18
|
+
/** The page's check table, generated so it cannot drift from the code. */
|
|
19
|
+
export declare function renderDeliveryTable(): string;
|
|
20
|
+
/** The page's limits table, generated from the constants the gates enforce, so
|
|
21
|
+
* a number the page quotes is the number a check holds a package to. */
|
|
22
|
+
export declare function renderDeliveryLimits(): string;
|