create-ampless 1.0.0-alpha.64 → 1.0.0-alpha.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1757,7 +1757,9 @@ var AMPLESS_PACKAGES = /* @__PURE__ */ new Set([
1757
1757
  "@ampless/plugin-rss",
1758
1758
  "@ampless/plugin-webhook",
1759
1759
  "@ampless/plugin-og-image",
1760
- "@ampless/plugin-analytics-ga4"
1760
+ "@ampless/plugin-analytics-ga4",
1761
+ "@ampless/plugin-gtm",
1762
+ "@ampless/plugin-plausible"
1761
1763
  ]);
1762
1764
  var AMPLESS_MANAGED_SCRIPTS = /* @__PURE__ */ new Set([
1763
1765
  "sandbox",
@@ -2,6 +2,8 @@ import { defineConfig } from 'ampless'
2
2
  import seoPlugin from '@ampless/plugin-seo'
3
3
  import rssPlugin from '@ampless/plugin-rss'
4
4
  // import analyticsGa4Plugin from '@ampless/plugin-analytics-ga4'
5
+ // import gtmPlugin from '@ampless/plugin-gtm'
6
+ // import plausiblePlugin from '@ampless/plugin-plausible'
5
7
  // import webhookPlugin from '@ampless/plugin-webhook'
6
8
  // import ogImagePlugin, { loadFontFromUrl } from '@ampless/plugin-og-image'
7
9
 
@@ -78,6 +80,21 @@ export default defineConfig({
78
80
  // measurementId: '', // 'G-XXXXXXXX' to enable
79
81
  // }),
80
82
  //
83
+ // Google Tag Manager. Like GA4, the container ID is editable from
84
+ // `/admin/plugins` after deploy. Tags fire via GTM's own trigger model.
85
+ //
86
+ // gtmPlugin({
87
+ // containerId: '', // 'GTM-XXXXXXX' to enable
88
+ // }),
89
+ //
90
+ // Plausible Analytics (privacy-focused, typically no cookie consent
91
+ // required). `domain` matches the registered Plausible site.
92
+ // `scriptUrl` defaults to plausible.io; override for self-hosted.
93
+ //
94
+ // plausiblePlugin({
95
+ // domain: '', // 'example.com' to enable
96
+ // }),
97
+ //
81
98
  // Per-post OG images: SNS crawlers hit `/og/<slug>` and we render
82
99
  // a JSX card → PNG via Next.js `ImageResponse`. Requires at least one
83
100
  // font — ship a .ttf from your CDN or `/public` directory.
@@ -139,7 +139,7 @@ analyticsGa4Plugin({ instanceId: 'product' })
139
139
  | 階層 | IAM | 用途 |
140
140
  |---|---|---|
141
141
  | `untrusted` | なし (SQS consume のみ) | head/body descriptor、webhook 配送、コンテンツ変換 |
142
- | `trusted` | 投稿読み出し、`public/plugins/<name>/...` への書き込み | RSS フィード、sitemap、計算済み JSON インデックス |
142
+ | `trusted` | 投稿読み出し、`public/plugins/<instanceId ?? name>/...` への書き込み | RSS フィード、sitemap、計算済み JSON インデックス |
143
143
  | `privileged` | 予約 | 将来: SES、secret、private S3 |
144
144
 
145
145
  決め方の目安:
@@ -273,6 +273,26 @@ hooks: {
273
273
  }
274
274
  ```
275
275
 
276
+ ### `writePublicAsset`
277
+
278
+ 公開生成ファイルを書き出す trusted plugin は capability を宣言してください:
279
+
280
+ ```ts
281
+ capabilities: ['eventHooks', 'writePublicAsset']
282
+ ```
283
+
284
+ 同じ plugin が `metadata()` または `siteMetadata()` も実装する場合は、`metadata` も宣言します。この capability 名は両方の metadata 関数をまとめて表し、別個の `siteMetadata` capability はありません。
285
+
286
+ trusted processor は次の場所に書き込みます:
287
+
288
+ ```txt
289
+ public/plugins/<instanceId ?? name>/<key>
290
+ ```
291
+
292
+ `key` は相対 asset key である必要があります。空文字、絶対パス、`.` / `..` path segment、backslash、制御文字、256 文字超の key は S3 呼び出し前に拒否されます。`indexes/posts.json` のような nested path は許可されます。戻り値は書き込まれた object の public URL です。
293
+
294
+ 移行期間中、`capabilities` フィールドが無い plugin はそのまま動きます。`capabilities` を宣言しているのに `writePublicAsset` を省いた plugin は、実際に `ctx.writePublicAsset()` を呼んだ時に 1 回だけ warn します。
295
+
276
296
  ### ベストプラクティス
277
297
 
278
298
  - **冪等にする**。SQS は at-least-once 配送 — 同じイベントが 2 回 fire する可能性があります。同じ入力で同じ出力 (決定論的なフィード等) を生成するようにしてください
@@ -467,6 +487,8 @@ it('admin が空文字保存した場合は空配列', () => {
467
487
  参考実装:
468
488
 
469
489
  - [`packages/plugin-analytics-ga4`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-analytics-ga4) — descriptor ベース、Phase 2 settings
490
+ - [`packages/plugin-gtm`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-gtm) — `publicHead`(ローダーインラインスクリプト)+ `publicBodyEnd`(`<noscript>` iframe フォールバック)を両方使用、コンテナ ID は admin 編集可能
491
+ - [`packages/plugin-plausible`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-plausible) — `data-*` attrs 付きの単一 `<script>` descriptor、`required` な URL field(self-hosted Plausible 上書き対応)
470
492
  - [`packages/plugin-rss`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-rss) — trusted、非同期 hooks + `writePublicAsset`
471
493
  - [`packages/plugin-seo`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-seo) — `metadata()` + `siteMetadata()`
472
494
  - [`packages/plugin-webhook`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-webhook) — untrusted hook + 外向き HTTP
@@ -168,7 +168,7 @@ touch IAM):
168
168
  | Tier | IAM | Used by |
169
169
  |---|---|---|
170
170
  | `untrusted` | none (SQS consume only) | head/body descriptors, webhook delivery, content transforms |
171
- | `trusted` | read posts, write `public/plugins/<name>/...` | RSS feed, sitemap, computed JSON indexes |
171
+ | `trusted` | read posts, write `public/plugins/<instanceId ?? name>/...` | RSS feed, sitemap, computed JSON indexes |
172
172
  | `privileged` | reserved | future: SES, secrets, private S3 |
173
173
 
174
174
  Rule of thumb:
@@ -332,6 +332,36 @@ hooks: {
332
332
  }
333
333
  ```
334
334
 
335
+ ### `writePublicAsset`
336
+
337
+ Trusted plugins that write public generated files should declare the
338
+ capability:
339
+
340
+ ```ts
341
+ capabilities: ['eventHooks', 'writePublicAsset']
342
+ ```
343
+
344
+ If the same plugin implements `metadata()` or `siteMetadata()`, also
345
+ declare `metadata`. That capability name covers both metadata
346
+ functions; there is no separate `siteMetadata` capability.
347
+
348
+ The trusted processor writes under:
349
+
350
+ ```txt
351
+ public/plugins/<instanceId ?? name>/<key>
352
+ ```
353
+
354
+ `key` must be a relative asset key. Empty strings, absolute paths,
355
+ `.` / `..` path segments, backslashes, control characters, and keys
356
+ over 256 characters are rejected before S3 is called. Nested paths
357
+ such as `indexes/posts.json` are allowed. The return value is the
358
+ public URL for the written object.
359
+
360
+ During the migration period, plugins with no `capabilities` field
361
+ keep working. Plugins that do declare `capabilities` but omit
362
+ `writePublicAsset` warn once when they actually call
363
+ `ctx.writePublicAsset()`.
364
+
335
365
  ### Best practices
336
366
 
337
367
  - **Be idempotent.** SQS delivery is at-least-once: the same event
@@ -575,6 +605,8 @@ a normal npm package:
575
605
  Worked examples to crib from:
576
606
 
577
607
  - [`packages/plugin-analytics-ga4`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-analytics-ga4) — descriptor-based, Phase 2 settings.
608
+ - [`packages/plugin-gtm`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-gtm) — uses both `publicHead` (loader inline script) and `publicBodyEnd` (`<noscript>` iframe fallback) with the container ID admin-edited.
609
+ - [`packages/plugin-plausible`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-plausible) — single `<script>` descriptor with `data-*` attrs and a required URL field (self-hosted Plausible override).
578
610
  - [`packages/plugin-rss`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-rss) — trusted, async event hooks + `writePublicAsset`.
579
611
  - [`packages/plugin-seo`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-seo) — `metadata()` + `siteMetadata()`.
580
612
  - [`packages/plugin-webhook`](https://github.com/heavymoons/ampless/tree/main/packages/plugin-webhook) — untrusted hook with outbound HTTP.
@@ -25,16 +25,18 @@
25
25
  "@tiptap/pm": "^3.23.6",
26
26
  "@tiptap/react": "^3.23.6",
27
27
  "@tiptap/starter-kit": "^3.23.6",
28
- "@ampless/plugin-analytics-ga4": "^0.2.0-alpha.1",
29
- "@ampless/plugin-og-image": "^0.2.0-alpha.18",
30
- "@ampless/plugin-rss": "^0.2.0-alpha.18",
31
- "@ampless/plugin-seo": "^0.2.0-alpha.18",
32
- "@ampless/plugin-webhook": "^0.2.0-alpha.18",
33
- "@ampless/admin": "^1.0.0-alpha.42",
34
- "@ampless/backend": "^1.0.0-alpha.33",
35
- "@ampless/runtime": "^1.0.0-alpha.24",
28
+ "@ampless/plugin-analytics-ga4": "^0.2.0-alpha.2",
29
+ "@ampless/plugin-gtm": "^0.1.1-alpha.1",
30
+ "@ampless/plugin-og-image": "^0.2.0-alpha.19",
31
+ "@ampless/plugin-plausible": "^0.1.1-alpha.1",
32
+ "@ampless/plugin-rss": "^0.2.0-alpha.19",
33
+ "@ampless/plugin-seo": "^0.2.0-alpha.19",
34
+ "@ampless/plugin-webhook": "^0.2.0-alpha.19",
35
+ "@ampless/admin": "^1.0.0-alpha.43",
36
+ "@ampless/backend": "^1.0.0-alpha.34",
37
+ "@ampless/runtime": "^1.0.0-alpha.25",
36
38
  "@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
37
- "ampless": "^1.0.0-alpha.18",
39
+ "ampless": "^1.0.0-alpha.19",
38
40
  "aws-amplify": "^6.17.0",
39
41
  "class-variance-authority": "^0.7.1",
40
42
  "clsx": "^2.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ampless",
3
- "version": "1.0.0-alpha.64",
3
+ "version": "1.0.0-alpha.68",
4
4
  "description": "Create a new ampless project",
5
5
  "license": "MIT",
6
6
  "type": "module",