ampless 1.0.0-alpha.21 → 1.0.0-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +53 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -616,6 +616,39 @@ interface PluginJsonField extends PluginFieldBase<unknown> {
616
616
  rows?: number;
617
617
  }
618
618
  type PluginSettingField = PluginTextField | PluginTextareaField | PluginBooleanField | PluginNumberField | PluginSelectField | PluginUrlField | PluginCodeField | PluginJsonField;
619
+ /**
620
+ * Static manifest declared in a plugin package's `package.json` under
621
+ * the `amplessPlugin` key. The plugin package must also expose
622
+ * `package.json` itself via `exports`:
623
+ *
624
+ * "exports": {
625
+ * ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" },
626
+ * "./package.json": "./package.json"
627
+ * }
628
+ *
629
+ * Without the subpath export, Node's package-exports gating rejects
630
+ * `import.meta.resolve('<pkg>/package.json')` and the runtime cannot
631
+ * load the manifest. Without `amplessPlugin`, the runtime skips
632
+ * cross-check silently and falls back to the existing per-factory
633
+ * capability mismatch checks (backward compatible).
634
+ */
635
+ interface PluginPackageManifest {
636
+ /** Must match `AmplessPlugin.apiVersion`. Mismatch throws at runtime
637
+ * to prevent loading a plugin built against a different ampless API. */
638
+ apiVersion: 1;
639
+ /** Should match `AmplessPlugin.name`. Mismatch warns. */
640
+ name: string;
641
+ /** Should match `AmplessPlugin.trust_level`. Mismatch warns. */
642
+ trustLevel: TrustLevel;
643
+ /** Should match `AmplessPlugin.capabilities`. Disagreement warns. */
644
+ capabilities: readonly PluginCapability[];
645
+ /** Optional admin UI label. */
646
+ displayName?: LocalizedString;
647
+ /** Optional short description (1 line). */
648
+ description?: LocalizedString;
649
+ /** Optional docs / repo URL. */
650
+ homepage?: string;
651
+ }
619
652
  /**
620
653
  * Per-plugin settings declaration. Phase 2 implements `public`;
621
654
  * `secret` is reserved for Phase 6a (admin-only storage; never reaches
@@ -628,6 +661,25 @@ interface AmplessPlugin {
628
661
  name: string;
629
662
  /** Plugin API version. Currently 1; future versions will be additive. */
630
663
  apiVersion: 1;
664
+ /**
665
+ * Optional npm package name (e.g. `'@scope/ampless-plugin-foo'` or
666
+ * `'ampless-plugin-foo'`). When set, the runtime resolves
667
+ * `<packageName>/package.json` at `createPluginHead` construction
668
+ * time and cross-checks the static `amplessPlugin` manifest against
669
+ * the factory return value (`apiVersion` mismatch throws,
670
+ * `name` / `trustLevel` / `capabilities` mismatch warns).
671
+ *
672
+ * Plugins that omit this field — site-local plugins, first-party
673
+ * plugins predating Phase 5, etc. — skip cross-check entirely and
674
+ * fall back to the existing per-factory capability mismatch checks.
675
+ * Backward compatible: existing plugins continue to work unchanged.
676
+ *
677
+ * For external `npm publish` plugins, `packageName` MUST match the
678
+ * package's actual `name` and the package's `exports` MUST expose
679
+ * `./package.json`. The scaffold tool (`npx create-ampless plugin`)
680
+ * handles both automatically.
681
+ */
682
+ packageName?: string;
631
683
  trust_level: TrustLevel;
632
684
  /**
633
685
  * Stable per-install namespace. Defaults to `name` when omitted.
@@ -1259,4 +1311,4 @@ declare function pickDefaultEntrypoint(files: readonly {
1259
1311
 
1260
1312
  declare const VERSION = "0.0.1";
1261
1313
 
1262
- export { type AmplessEvent, type AmplessPlugin, type AuthContext, type BundleExtractResult, type CacheConfig, type CacheStrategy, type Config, type ContentEventPayload, type ContentEventType, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_ENTRYPOINT, type DateFormat, type EventPayloadOf, type EventType, type ExtractedFile, type FieldDefinition, type FieldType, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type LocalizedString, MAX_BUNDLE_BYTES, type Media, type MediaEventPayload, type MediaEventType, type MediaMetadata, type MediaProcessingDefaults, type OgImageConfig, type OgImageFont, type OgImageRenderContext, PLUGIN_KEY_PATTERN, type Page, type PluginBooleanField, type PluginCapability, type PluginCodeField, type PluginEventHandler, type PluginJsonField, type PluginMetadata, type PluginNumberField, type PluginPublicRenderContext, type PluginRuntimeContext, type PluginSelectField, type PluginSettingField, type PluginSettingsManifest, type PluginTextField, type PluginTextareaField, type PluginUrlField, type Post, type PostIndexEventPayload, type PostIndexEventType, type PostMetadata, type PostStatus, type PostsProvider, type PublicBodyDescriptor, type PublicHeadDescriptor, type PublicPostBodyDescriptor, type Role, SITE_CONFIG_PK, type ScriptStrategy, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StaticPostFileMeta, type StreamEventName, TEXT_EXTENSIONS, type ThemeColorField, type ThemeField, type ThemeFieldType, type ThemeFontFamilyField, type ThemeImageField, type ThemeLengthField, type ThemeLinkListField, type ThemeManifest, type ThemeModule, type ThemeRouteContext, type ThemeSelectField, type ThemeTextField, type TrustLevel, VERSION, type ValidationIssue, bundlePrefix, createPost, decodeAwsJson, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, encodeAwsJson, escapeXml, extractFirstImageUrl, findAbsolutePathRefs, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isTagListUrl, isValidPluginKey, listPosts, listSiteSettings, mimeTypeFor, parseColorPair, parseLinkList, pickDefaultEntrypoint, resolveLocalized, resolvePluginSettings, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, stringifyLinkList, stripCommonPrefix, themeSettingKey, unflattenSettings, updatePost, validateBundle, validateBundlePath, validatePluginSettingValue, validatePublicAssetKey, validateThemeValue };
1314
+ export { type AmplessEvent, type AmplessPlugin, type AuthContext, type BundleExtractResult, type CacheConfig, type CacheStrategy, type Config, type ContentEventPayload, type ContentEventType, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_ENTRYPOINT, type DateFormat, type EventPayloadOf, type EventType, type ExtractedFile, type FieldDefinition, type FieldType, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type LocalizedString, MAX_BUNDLE_BYTES, type Media, type MediaEventPayload, type MediaEventType, type MediaMetadata, type MediaProcessingDefaults, type OgImageConfig, type OgImageFont, type OgImageRenderContext, PLUGIN_KEY_PATTERN, type Page, type PluginBooleanField, type PluginCapability, type PluginCodeField, type PluginEventHandler, type PluginJsonField, type PluginMetadata, type PluginNumberField, type PluginPackageManifest, type PluginPublicRenderContext, type PluginRuntimeContext, type PluginSelectField, type PluginSettingField, type PluginSettingsManifest, type PluginTextField, type PluginTextareaField, type PluginUrlField, type Post, type PostIndexEventPayload, type PostIndexEventType, type PostMetadata, type PostStatus, type PostsProvider, type PublicBodyDescriptor, type PublicHeadDescriptor, type PublicPostBodyDescriptor, type Role, SITE_CONFIG_PK, type ScriptStrategy, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StaticPostFileMeta, type StreamEventName, TEXT_EXTENSIONS, type ThemeColorField, type ThemeField, type ThemeFieldType, type ThemeFontFamilyField, type ThemeImageField, type ThemeLengthField, type ThemeLinkListField, type ThemeManifest, type ThemeModule, type ThemeRouteContext, type ThemeSelectField, type ThemeTextField, type TrustLevel, VERSION, type ValidationIssue, bundlePrefix, createPost, decodeAwsJson, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, encodeAwsJson, escapeXml, extractFirstImageUrl, findAbsolutePathRefs, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isTagListUrl, isValidPluginKey, listPosts, listSiteSettings, mimeTypeFor, parseColorPair, parseLinkList, pickDefaultEntrypoint, resolveLocalized, resolvePluginSettings, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, stringifyLinkList, stripCommonPrefix, themeSettingKey, unflattenSettings, updatePost, validateBundle, validateBundlePath, validatePluginSettingValue, validatePublicAssetKey, validateThemeValue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ampless",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.22",
4
4
  "description": "Serverless CMS for AWS Amplify",
5
5
  "license": "MIT",
6
6
  "type": "module",