@ampless/runtime 1.0.0-beta.75 → 1.0.0-beta.79
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/README.ja.md +1 -1
- package/README.md +1 -1
- package/dist/{chunk-5BLMLMZU.js → chunk-PK7Q7YJX.js} +1 -2
- package/dist/dispatchers/index.d.ts +0 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +8 -3
- package/dist/routes/index.d.ts +1 -2
- package/dist/routes/index.js +3 -4
- package/package.json +5 -5
package/README.ja.md
CHANGED
|
@@ -121,7 +121,7 @@ CORS(匿名・読み取り専用)、64KB のボディ上限、粗い warm-in
|
|
|
121
121
|
また、`post.metadata.cache`(auto / deep / hot)+ `post.updatedAt` +
|
|
122
122
|
`cms.config.cache.{cooldownMs, freshTtlSeconds, deepTtlSeconds}` から
|
|
123
123
|
`Cache-Control` を算出してレスポンスに付与します。キャッシュ戦略の
|
|
124
|
-
契約については `
|
|
124
|
+
契約については `https://github.com/heavymoons/ampless/wiki/CONTENT` を参照してください。
|
|
125
125
|
|
|
126
126
|
## サブパス
|
|
127
127
|
|
package/README.md
CHANGED
|
@@ -119,7 +119,7 @@ returns `{ POST, OPTIONS }`; the template destructures both (a single
|
|
|
119
119
|
It also computes `Cache-Control` from `post.metadata.cache` (auto /
|
|
120
120
|
deep / hot) + `post.updatedAt` + `cms.config.cache.{cooldownMs,
|
|
121
121
|
freshTtlSeconds, deepTtlSeconds}` and sets the header on the response.
|
|
122
|
-
See `
|
|
122
|
+
See `https://github.com/heavymoons/ampless/wiki/CONTENT` for the cache strategy contract.
|
|
123
123
|
|
|
124
124
|
## Sub-paths
|
|
125
125
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/stream-s3.ts
|
|
2
2
|
import { getProperties } from "aws-amplify/storage/server";
|
|
3
|
-
import { cookies } from "next/headers";
|
|
4
3
|
var DEFAULT_THRESHOLD_BYTES = 6 * 1024 * 1024;
|
|
5
4
|
var META_CACHE_MAX = 1e3;
|
|
6
5
|
var META_CACHE_TTL_MS = 5 * 6e4;
|
|
@@ -111,7 +110,7 @@ async function streamS3Object(amplifyServerContext, key, options) {
|
|
|
111
110
|
}
|
|
112
111
|
async function streamS3ObjectWithRunner(runWithAmplifyServerContext, key, options) {
|
|
113
112
|
return runWithAmplifyServerContext({
|
|
114
|
-
nextServerContext:
|
|
113
|
+
nextServerContext: null,
|
|
115
114
|
operation: (ctx) => streamS3Object(ctx, key, options)
|
|
116
115
|
});
|
|
117
116
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export { Config, Post, ThemeManifest } from 'ampless';
|
|
|
3
3
|
import { Metadata } from 'next';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import { getProperties } from 'aws-amplify/storage/server';
|
|
6
|
-
import { cookies } from 'next/headers';
|
|
7
6
|
|
|
8
7
|
interface StorageOutput {
|
|
9
8
|
bucket_name: string;
|
|
@@ -625,16 +624,17 @@ declare function _resetStreamS3Cache(): void;
|
|
|
625
624
|
*/
|
|
626
625
|
declare function streamS3Object(amplifyServerContext: AmplifyServerContext, key: string, options: StreamS3Options): Promise<Response>;
|
|
627
626
|
/**
|
|
628
|
-
* Convenience wrapper
|
|
629
|
-
* adapter so route handlers don't have to duplicate the
|
|
627
|
+
* Convenience wrapper so route handlers don't have to duplicate the
|
|
630
628
|
* `runWithAmplifyServerContext` plumbing. Pass the runner from
|
|
631
629
|
* `createServerRunner({ config: outputs })` and the rest is the same
|
|
632
630
|
* shape as `streamS3Object`.
|
|
631
|
+
*
|
|
632
|
+
* Runs with `nextServerContext: null` (Amplify's stateless guest path):
|
|
633
|
+
* no cookie read or write, so the public-cacheable response can never
|
|
634
|
+
* carry a Set-Cookie.
|
|
633
635
|
*/
|
|
634
636
|
declare function streamS3ObjectWithRunner(runWithAmplifyServerContext: <T>(args: {
|
|
635
|
-
nextServerContext:
|
|
636
|
-
cookies: typeof cookies;
|
|
637
|
-
};
|
|
637
|
+
nextServerContext: null;
|
|
638
638
|
operation: (ctx: AmplifyServerContext) => Promise<T>;
|
|
639
639
|
}) => Promise<T>, key: string, options: StreamS3Options): Promise<Response>;
|
|
640
640
|
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
_resetStreamS3Cache,
|
|
8
8
|
streamS3Object,
|
|
9
9
|
streamS3ObjectWithRunner
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PK7Q7YJX.js";
|
|
11
11
|
|
|
12
12
|
// src/storage.ts
|
|
13
13
|
import { formatPublicAssetUrl } from "ampless";
|
|
@@ -261,6 +261,7 @@ import {
|
|
|
261
261
|
} from "react";
|
|
262
262
|
import { marked } from "marked";
|
|
263
263
|
import { parseDocument, ElementType } from "htmlparser2";
|
|
264
|
+
import { isValidCustomClassId, tableCustomClassName } from "ampless";
|
|
264
265
|
function escape(s) {
|
|
265
266
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
266
267
|
}
|
|
@@ -327,7 +328,7 @@ function renderTiptapString(node, opts) {
|
|
|
327
328
|
return `<img src="${src}" alt="${alt}"${title}${display} loading="lazy" />`;
|
|
328
329
|
}
|
|
329
330
|
case "table":
|
|
330
|
-
return `<table class="
|
|
331
|
+
return `<table class="${tableClassName(node.attrs)}"><tbody>${children}</tbody></table>`;
|
|
331
332
|
case "tableRow":
|
|
332
333
|
return `<tr>${children}</tr>`;
|
|
333
334
|
case "tableHeader":
|
|
@@ -344,6 +345,10 @@ function renderTiptapString(node, opts) {
|
|
|
344
345
|
return children;
|
|
345
346
|
}
|
|
346
347
|
}
|
|
348
|
+
function tableClassName(attrs) {
|
|
349
|
+
const id = attrs?.customClass;
|
|
350
|
+
return isValidCustomClassId(id) ? `tiptap-table ${tableCustomClassName(id)}` : "tiptap-table";
|
|
351
|
+
}
|
|
347
352
|
function tableCellAttrs(attrs) {
|
|
348
353
|
let out = "";
|
|
349
354
|
const colspan = Number(attrs?.colspan ?? 1);
|
|
@@ -503,7 +508,7 @@ function renderTiptapNode(node, opts, key) {
|
|
|
503
508
|
case "table":
|
|
504
509
|
return createElement(
|
|
505
510
|
"table",
|
|
506
|
-
{ key, className:
|
|
511
|
+
{ key, className: tableClassName(node.attrs) },
|
|
507
512
|
createElement("tbody", null, ...children)
|
|
508
513
|
);
|
|
509
514
|
case "tableRow":
|
package/dist/routes/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import 'ampless';
|
|
|
3
3
|
import 'next';
|
|
4
4
|
import 'react';
|
|
5
5
|
import 'aws-amplify/storage/server';
|
|
6
|
-
import 'next/headers';
|
|
7
6
|
|
|
8
7
|
interface Ctx$6 {
|
|
9
8
|
params: Promise<{
|
|
@@ -55,7 +54,7 @@ type RawRouteHandler = (req: Request, ctx: Ctx$3) => Promise<Response>;
|
|
|
55
54
|
*
|
|
56
55
|
* Trust model: the body is emitted verbatim, same trust shape as
|
|
57
56
|
* regular `format: 'html'` posts on the themed route. See
|
|
58
|
-
*
|
|
57
|
+
* https://github.com/heavymoons/ampless/wiki/architecture-04-access-layer-mcp §"editor の信頼モデル".
|
|
59
58
|
*
|
|
60
59
|
* Cache-Control: deliberately omitted from the response. Middleware
|
|
61
60
|
* computes the strategy from `post.metadata.cache` + `post.updatedAt`
|
package/dist/routes/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
streamS3Object
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PK7Q7YJX.js";
|
|
4
4
|
|
|
5
5
|
// src/routes/og.ts
|
|
6
6
|
import { ImageResponse } from "next/og";
|
|
@@ -92,7 +92,6 @@ function createRawRouteHandler(ampless) {
|
|
|
92
92
|
|
|
93
93
|
// src/routes/static.ts
|
|
94
94
|
import { createServerRunner } from "@aws-amplify/adapter-nextjs";
|
|
95
|
-
import { cookies } from "next/headers";
|
|
96
95
|
import { getUrl } from "aws-amplify/storage/server";
|
|
97
96
|
function createStaticRouteHandler(ampless) {
|
|
98
97
|
const { runWithAmplifyServerContext } = createServerRunner({
|
|
@@ -160,7 +159,7 @@ async function serveStaticAsset({
|
|
|
160
159
|
presignedUrlFor: (k) => signStaticAsset({ runWithAmplifyServerContext, key: k })
|
|
161
160
|
};
|
|
162
161
|
return runWithAmplifyServerContext({
|
|
163
|
-
nextServerContext:
|
|
162
|
+
nextServerContext: null,
|
|
164
163
|
operation: (ctx) => streamS3Object(ctx, key, opts)
|
|
165
164
|
});
|
|
166
165
|
}
|
|
@@ -170,7 +169,7 @@ async function signStaticAsset({
|
|
|
170
169
|
}) {
|
|
171
170
|
try {
|
|
172
171
|
return await runWithAmplifyServerContext({
|
|
173
|
-
nextServerContext:
|
|
172
|
+
nextServerContext: null,
|
|
174
173
|
operation: async (amplifyContext) => {
|
|
175
174
|
const result = await getUrl(amplifyContext, {
|
|
176
175
|
path: key,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ampless/runtime",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.79",
|
|
4
4
|
"description": "Public-side runtime for ampless: post fetching, theme dispatch, middleware, public route handlers",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"htmlparser2": "^10.1.0",
|
|
50
50
|
"lucide-react": "^1.16.0",
|
|
51
51
|
"marked": "^18.0.4",
|
|
52
|
-
"sanitize-html": "^2.
|
|
52
|
+
"sanitize-html": "^2.18.1",
|
|
53
53
|
"tailwind-merge": "^3.6.0",
|
|
54
|
-
"@ampless/mcp-server": "1.0.0-beta.
|
|
55
|
-
"@ampless/plugin-og-image": "0.2.0-beta.
|
|
56
|
-
"ampless": "1.0.0-beta.
|
|
54
|
+
"@ampless/mcp-server": "1.0.0-beta.71",
|
|
55
|
+
"@ampless/plugin-og-image": "0.2.0-beta.64",
|
|
56
|
+
"ampless": "1.0.0-beta.64"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@aws-amplify/adapter-nextjs": "^1",
|