@runlot/next 0.1.0-rc.15 → 0.1.0-rc.150

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.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @runlot/next
2
2
 
3
- Next.js 어댑터. 설계는 `docs/nextjs.md` 에 있고, 이 문서는 표면만 적는다.
3
+ Next.js 어댑터입니다. 이 문서는 패키지 사용법을 설명합니다.
4
4
 
5
- > **npm 이름은 `runlot/next` 다.** 워크스페이스 안에서만 `@runlot/next` 이고,
5
+ > **npm 패키지 이름은 `@runlot/next` 입니다.** 예제와 템플릿의 import 지정자도 같습니다.
6
6
  > 랜딩의 코드 예시와 템플릿이 쓰는 지정자는 `runlot/next` 다 (`import { env }
7
7
  > from "runlot/next"`). 게시할 때 이름을 바꾸는 자리가 여기 하나뿐이도록,
8
8
  > 이 패키지 안에서는 자기 이름을 문자열로 쓰지 않는다 — 예외는 빌드가 만드는
@@ -11,9 +11,9 @@ Next.js 어댑터. 설계는 `docs/nextjs.md` 에 있고, 이 문서는 표면
11
11
  ## 표면
12
12
 
13
13
  ```ts
14
- import { env, request, waitUntil } from "runlot/next";
14
+ import { env, request, waitUntil } from "@runlot/next";
15
15
 
16
- const user = await env.auth.user(); // 요청은 어댑터가 숨긴다
16
+ const user = await env.auth.user(); // 요청은 어댑터가 알아서 넘깁니다
17
17
  const rows = await env.db.exec("select 1");
18
18
  const url = await env.storage.presign("covers/a.png");
19
19
  const token = env.MY_SECRET; // 나머지는 문자열이다
@@ -21,15 +21,15 @@ const token = env.MY_SECRET; // 나머지는 문자열이다
21
21
 
22
22
  | 이름 | 무엇 |
23
23
  |---|---|
24
- | `env` | 이 요청의 바인딩. **요청 밖에서 읽으면 던진다** |
24
+ | `env` | 이 요청의 바인딩. **요청 밖에서 읽으면 오류를 냅니다** |
25
25
  | `env.auth.user(request?)` | 인자가 없으면 이 요청. `signOut` 도 같다 |
26
26
  | `request()` | 이 요청의 `Request` |
27
27
  | `waitUntil(p)` | 응답 뒤에도 끝까지 도는 일 |
28
28
  | `inRequest()` | 지금 요청 안인가. 라이브러리가 갈래를 나눌 때만 |
29
- | `wrap(worker)` (`runlot/next/entry`) | 빌드가 세우는 진입 wrapper |
30
- | `buildNext(opts)` (`runlot/next/build`) | `runlot deploy` 가 부른다 |
29
+ | `wrap(worker)` (`@runlot/next/entry`) | 빌드가 세우는 진입 wrapper |
30
+ | `buildNext(opts)` (`@runlot/next/build`) | `runlot deploy` 가 부릅니다 |
31
31
 
32
- `env` 가 요청 밖에서 던지는 것은 설계다. 모듈 최상단과 빌드 시점 정적 렌더가
32
+ `env` 가 요청 밖에서 오류를 내는 것은 의도된 설계입니다. 모듈 최상단과 빌드 시점 정적 렌더가
33
33
  그 자리이고, 거기서 조용히 빈 값을 주면 **모든 페이지가 로그아웃 상태로**
34
34
  보인다 (`docs/auth.md §4` 의 같은 문장).
35
35
 
@@ -55,7 +55,7 @@ const token = env.MY_SECRET; // 나머지는 문자열이다
55
55
  | queue | OpenNext 의 `memory-queue` (`WORKER_SELF_REFERENCE` 를 쓴다) | — |
56
56
  | enableCacheInterception | `true` | — |
57
57
 
58
- ## wrangler 는 의존이 아니다
58
+ ## wrangler 는 의존이 아닙니다
59
59
 
60
60
  `@opennextjs/cloudflare` 의 `peerDependencies` 에 `wrangler` 가 있지만, 런타임에
61
61
  그것을 import 하는 것은 `dist/cli/commands/*` 뿐이다. 우리가 부르는
@@ -63,7 +63,7 @@ const token = env.MY_SECRET; // 나머지는 문자열이다
63
63
  `dependencies` 에 두지 않는다 — pnpm 이 peer 를 자동 설치하는 워크스페이스에서는
64
64
  스토어에 내려와 있을 수 있지만, 우리 코드 경로는 그것을 부르지 않는다.
65
65
 
66
- ## 저장소는 globalThis 의 심볼이다
66
+ ## 요청 상태는 globalThis 의 심볼에 둡니다
67
67
 
68
68
  `Symbol.for("runlot.next.store")`. 모듈 인스턴스가 하나라는 보장이 없어서다:
69
69
  OpenNext 의 `worker.js` 는 이미 묶인 번들이라 그 안에 이 패키지의 사본이 있고,
package/dist/ai.d.ts ADDED
@@ -0,0 +1,223 @@
1
+ /** A JSON Schema object accepted by `responseFormat` and `inputJsonSchema`. */
2
+ export type AIJsonSchema = Record<string, unknown>;
3
+ /** One conversational message. System instructions belong in `AIRunOptions.system`. */
4
+ export interface AIMessage {
5
+ role: "user" | "assistant";
6
+ content: string;
7
+ }
8
+ /** Token usage returned by a chat run and accumulated across tool rounds. */
9
+ export interface AIUsage {
10
+ inputTokens: number;
11
+ outputTokens: number;
12
+ cachedInputTokens: number;
13
+ }
14
+ /** Every reasoning-effort value currently advertised by the model catalog. */
15
+ export type AIReasoningEffort = "none" | "low" | "medium" | "high" | "xhigh" | "max";
16
+ export interface AIReasoning {
17
+ effort: AIReasoningEffort;
18
+ }
19
+ /** Ask a supported model for JSON conforming to `schema`. */
20
+ export interface AIResponseFormat {
21
+ type: "json_schema";
22
+ /** Optional provider-facing schema name. The runtime defaults it to `response`. */
23
+ name?: string;
24
+ schema: AIJsonSchema;
25
+ }
26
+ export interface AIToolContext {
27
+ /** Aborted when the caller aborts the run or the remote tool session ends. */
28
+ signal: AbortSignal;
29
+ /** The id that correlates this callback with the model's tool call. */
30
+ callId: string;
31
+ model: string;
32
+ }
33
+ /** A normal tool result. A thrown error is converted to `{ text, isError: true }`. */
34
+ export interface AIToolResult<Data = unknown> {
35
+ text?: string;
36
+ data?: Data;
37
+ isError?: boolean;
38
+ stop?: false;
39
+ }
40
+ /**
41
+ * A terminal tool result. The facade acknowledges remote cancellation instead
42
+ * of submitting it to the model, then returns without another model round.
43
+ */
44
+ export interface AITerminalToolResult<Data = unknown> {
45
+ stop: true;
46
+ text?: string;
47
+ data?: Data;
48
+ }
49
+ /** A non-object return is wrapped as the tool result's `data` field. */
50
+ export type AIToolRawResult = string | number | boolean | null | undefined | readonly unknown[];
51
+ export type AIToolExecuteResult<Data = unknown> = AIToolResult<Data> | AITerminalToolResult<Data> | AIToolRawResult;
52
+ /** A callback tool whose closure remains in the originating app worker. */
53
+ export interface AITool<Args extends Record<string, unknown> = Record<string, unknown>, Data = unknown> {
54
+ name: string;
55
+ description: string;
56
+ inputJsonSchema: AIJsonSchema;
57
+ execute(args: Args, context: AIToolContext): AIToolExecuteResult<Data> | Promise<AIToolExecuteResult<Data>>;
58
+ }
59
+ export interface AIFinalTool<Args extends Record<string, unknown> = Record<string, unknown>, Data = unknown> {
60
+ id: string;
61
+ name: string;
62
+ args: Args;
63
+ result: AITerminalToolResult<Data>;
64
+ }
65
+ /** Provider stop reasons are open-ended; `tool_stop` is added by Runlot. */
66
+ export type AIStopReason = "tool_stop" | (string & {});
67
+ export interface AIRunResult {
68
+ text: string;
69
+ model: string;
70
+ stopReason: AIStopReason;
71
+ usage: AIUsage;
72
+ /** False means `usage` is the amount observed before termination, not an exact final total. */
73
+ usageComplete: boolean;
74
+ /** Present when a callback returned `{ stop: true }`. */
75
+ finalTool?: AIFinalTool;
76
+ }
77
+ export interface AIToolStopResult extends AIRunResult {
78
+ stopReason: "tool_stop";
79
+ finalTool: AIFinalTool;
80
+ }
81
+ type AIRunInput = {
82
+ prompt: string;
83
+ messages?: string | readonly AIMessage[];
84
+ } | {
85
+ messages: string | readonly AIMessage[];
86
+ prompt?: string;
87
+ };
88
+ interface AIRunSettings {
89
+ system?: string;
90
+ maxTokens?: number;
91
+ temperature?: number;
92
+ reasoning?: AIReasoning;
93
+ responseFormat?: AIResponseFormat;
94
+ tools?: readonly AITool[];
95
+ /** Defaults to 8 and is bounded by the runtime. */
96
+ maxToolRounds?: number;
97
+ /** Used by the app-worker tool loop. */
98
+ signal?: AbortSignal;
99
+ }
100
+ /** Options shared by streaming and non-streaming model runs. */
101
+ export type AIRunOptions = AIRunInput & AIRunSettings & {
102
+ stream?: boolean;
103
+ };
104
+ export type AIStream = ReadableStream<Uint8Array>;
105
+ /** A text frame in the public SSE stream. */
106
+ export interface AIStreamDelta {
107
+ delta: string;
108
+ }
109
+ /** A usage frame emitted by a tool-bearing stream after a completed round. */
110
+ export interface AIStreamUsage extends AIUsage {
111
+ /** True for a provider's cumulative total, absent for per-round usage. */
112
+ cumulative?: boolean;
113
+ round?: number;
114
+ }
115
+ /**
116
+ * The `done` payload. Plain model streams guarantee `model`; tool-bearing
117
+ * streams also include the accumulated result fields.
118
+ */
119
+ export interface AIStreamDone {
120
+ model: string;
121
+ text?: string;
122
+ stopReason?: AIStopReason;
123
+ usage?: AIUsage;
124
+ /** False means `usage` is only what was observable before the stream stopped. */
125
+ usageComplete?: boolean;
126
+ finalTool?: AIFinalTool;
127
+ }
128
+ /** A mid-stream failure payload. Rich context is present on tool-bearing runs. */
129
+ export interface AIStreamError {
130
+ message: string;
131
+ code?: string;
132
+ text?: string;
133
+ model?: string;
134
+ usage?: AIUsage;
135
+ /** Tool errors report partial observed usage; plain streams may omit this. */
136
+ usageComplete?: false;
137
+ /** Present when the terminal callback completed but remote cancellation failed. */
138
+ finalTool?: AIFinalTool;
139
+ }
140
+ /** Fields attached to errors returned before an HTTP stream starts. */
141
+ export interface AIHTTPError extends Error {
142
+ status: number;
143
+ code: string;
144
+ text?: string;
145
+ usage?: AIUsage;
146
+ model?: string;
147
+ /** Pre-stream failures have no final usage; when present this is false. */
148
+ usageComplete?: false;
149
+ }
150
+ /** Fields attached when a tool loop fails after producing partial work. */
151
+ export interface AIToolRunError extends Error {
152
+ code?: string;
153
+ text: string;
154
+ usage: AIUsage;
155
+ /** Errors report partial observed usage, so this is false. */
156
+ usageComplete: boolean;
157
+ model: string;
158
+ /** Present when the terminal callback completed but remote cancellation failed. */
159
+ finalTool?: AIFinalTool;
160
+ status?: number;
161
+ }
162
+ /** The union useful when narrowing an unknown `env.ai` failure. */
163
+ export type AIError = AIHTTPError | AIToolRunError;
164
+ /** Every task type currently accepted by the task-aware embedding model. */
165
+ export type AIEmbeddingTaskType = "RETRIEVAL_QUERY" | "RETRIEVAL_DOCUMENT" | "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY";
166
+ export interface AIEmbedOptions {
167
+ dimensions?: number;
168
+ /** Omit this to retain the model's own default embedding space. */
169
+ taskType?: AIEmbeddingTaskType;
170
+ }
171
+ export interface AIEmbedUsage {
172
+ inputTokens: number;
173
+ }
174
+ export interface AIEmbedResult {
175
+ /** `vectors[i]` belongs to `input[i]`. */
176
+ vectors: number[][];
177
+ dimensions: number;
178
+ model: string;
179
+ usage: AIEmbedUsage;
180
+ /** Echoed only when the request supplied a task type. */
181
+ taskType?: AIEmbeddingTaskType;
182
+ }
183
+ export type AIModelLane = "frontier" | "value";
184
+ interface AIModelBase {
185
+ id: string;
186
+ lane: AIModelLane;
187
+ display: string;
188
+ vendor: string;
189
+ contextTokens: number;
190
+ maxInputTokens: number;
191
+ maxOutputTokens: number;
192
+ frontier: boolean;
193
+ }
194
+ export interface AIChatModel extends AIModelBase {
195
+ kind: "chat";
196
+ effortLevels?: AIReasoningEffort[];
197
+ /** Present as `true` only when this model accepts `responseFormat`. */
198
+ structuredOutput?: true;
199
+ dimensions?: never;
200
+ dimensionOptions?: never;
201
+ }
202
+ export interface AIEmbeddingModel extends AIModelBase {
203
+ kind: "embedding";
204
+ dimensions: number;
205
+ dimensionOptions?: number[];
206
+ effortLevels?: never;
207
+ structuredOutput?: never;
208
+ }
209
+ export type AIModel = AIChatModel | AIEmbeddingModel;
210
+ /** The public `env.ai` binding. */
211
+ export interface RunlotAI {
212
+ run(model: string, options: AIRunOptions & {
213
+ stream: true;
214
+ }): Promise<AIStream>;
215
+ run(model: string, options: AIRunOptions & {
216
+ stream?: false;
217
+ }): Promise<AIRunResult>;
218
+ run(model: string, options: AIRunOptions): Promise<AIRunResult | AIStream>;
219
+ embed(model: string, input: string | readonly string[], options?: AIEmbedOptions): Promise<AIEmbedResult>;
220
+ models(): Promise<AIModel[]>;
221
+ }
222
+ export {};
223
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,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CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC;CAC1B;AAED,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAErD,mCAAmC;AACnC,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG;QAAE,MAAM,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAChF,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG;QAAE,MAAM,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACrF,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,GAAG,QAAQ,CAAC,CAAC;IAE3E,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1G,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;CAC9B"}
package/dist/ai.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ai.js.map
package/dist/ai.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":""}
package/dist/build.d.ts CHANGED
@@ -1,38 +1,43 @@
1
- /** 생성한 OpenNext 설정이 사는 곳. `.open-next` 는 빌드가 매번 지우므로 밖에 둔다. */
1
+ /** Where the generated OpenNext config lives. It is kept outside `.open-next`
2
+ * because the build erases that every time. */
2
3
  export declare const WORK_DIR = ".runlot-next";
3
4
  export declare const ENTRY_NAME = "runlot-entry.js";
4
5
  export interface BuildNextOptions {
5
- /** Next 프로젝트 루트 (`runlot.json` 이 있는 곳). */
6
+ /** The Next project root (where `runlot.json` is). */
6
7
  dir: string;
7
- /** `runlot.json` 의 `compatibilityDate`. OpenNext 는 경고 한 줄에만 쓴다. */
8
+ /** The `compatibilityDate` from `runlot.json`. OpenNext uses it only for one
9
+ * warning line. */
8
10
  compatibilityDate?: string;
9
11
  log?: (line: string) => void;
10
12
  }
11
13
  export interface BuildNextResult {
12
- /** 우리 번들러에게 줄 진입점 (절대 경로). */
14
+ /** The entry point to hand to our bundler (an absolute path). */
13
15
  worker: string;
14
- /** 정적 자산 디렉토리 (절대 경로). */
16
+ /** The static asset directory (an absolute path). */
15
17
  assets: string;
16
- /** OpenNext 출력 디렉토리 (절대 경로). 번들러의 `absWorkingDir` 이다. */
18
+ /** The OpenNext output directory (an absolute path). It is the bundler's
19
+ * `absWorkingDir`. */
17
20
  outputDir: string;
18
21
  }
19
22
  /**
20
- * 우리가 세우는 진입점.
23
+ * The entry point we stand up.
21
24
  *
22
- * OpenNext 의 `worker.js` 기본 export 를 감싸고 나머지 export(Durable Object
23
- * 클래스 등)는 그대로 통과시킨다. `export *` 는 default 를 다시 내보내지 않으므로
24
- * 두 줄이 겹치지 않는다.
25
+ * It wraps the default export of OpenNext's `worker.js` and lets the other
26
+ * exports (Durable Object classes and so on) pass straight through. `export *`
27
+ * does not re-export the default, so the two lines do not collide.
25
28
  */
26
- export declare const ENTRY_SOURCE = "// runlot \uC774 \uB9CC\uB4E0 \uD30C\uC77C\uC785\uB2C8\uB2E4. \uACE0\uCCD0\uB3C4 \uB2E4\uC74C \uBC30\uD3EC\uC5D0\uC11C \uB2E4\uC2DC \uC4F0\uC785\uB2C8\uB2E4.\nimport worker from \"./worker.js\";\nimport { wrap } from \"@runlot/next/entry\";\n\nexport * from \"./worker.js\";\nexport default wrap(worker);\n";
27
- /** 사용자가 자기 것을 두지 않았을 때 우리가 쓰는 OpenNext 설정 (docs/nextjs.md §2 의 표). */
28
- export declare const OPEN_NEXT_CONFIG_SOURCE = "// runlot \uC774 \uB9CC\uB4E0 \uD30C\uC77C\uC785\uB2C8\uB2E4. \uACE0\uCCD0\uB3C4 \uB2E4\uC74C \uBC30\uD3EC\uC5D0\uC11C \uB2E4\uC2DC \uC4F0\uC785\uB2C8\uB2E4.\n// \uC9C1\uC811 \uB2E4\uB8E8\uB824\uBA74 \uD504\uB85C\uC81D\uD2B8 \uB8E8\uD2B8\uC5D0 open-next.config.ts \uB97C \uB450\uC138\uC694 \u2014 \uC788\uC73C\uBA74 \uADF8\uCABD\uC744 \uC501\uB2C8\uB2E4.\nimport { defineCloudflareConfig } from \"@opennextjs/cloudflare\";\nimport queue from \"@opennextjs/cloudflare/overrides/queue/memory-queue\";\nimport incrementalCache from \"@runlot/next/opennext/incremental-cache\";\nimport tagCache from \"@runlot/next/opennext/tag-cache\";\n\nexport default defineCloudflareConfig({\n incrementalCache,\n tagCache,\n queue,\n enableCacheInterception: true,\n});\n";
29
- /** 프로젝트가 자기 OpenNext 설정을 두었으면 그것을, 아니면 우리 것을 만들어 그 경로를 준다. */
29
+ export declare const ENTRY_SOURCE = "// This file was made by runlot. Edits are overwritten on the next deploy.\nimport worker from \"./worker.js\";\nimport { wrap } from \"@runlot/next/entry\";\n\nexport * from \"./worker.js\";\nexport default wrap(worker);\n";
30
+ /** The OpenNext config we use when the user has not put down one of their own
31
+ * (the table in docs/nextjs.md §2). */
32
+ export declare const OPEN_NEXT_CONFIG_SOURCE = "// This file was made by runlot. Edits are overwritten on the next deploy.\n// To handle it yourself, put an open-next.config.ts in the project root \u2014 if one\n// is there, that is the one we use.\nimport { defineCloudflareConfig } from \"@opennextjs/cloudflare\";\nimport queue from \"@opennextjs/cloudflare/overrides/queue/memory-queue\";\nimport incrementalCache from \"@runlot/next/opennext/incremental-cache\";\nimport tagCache from \"@runlot/next/opennext/tag-cache\";\n\nexport default defineCloudflareConfig({\n incrementalCache,\n tagCache,\n queue,\n enableCacheInterception: true,\n});\n";
33
+ /** Gives the path of the project's own OpenNext config when it has one, and
34
+ * otherwise creates ours and gives that path. */
30
35
  export declare function openNextConfigPath(dir: string, log: (line: string) => void): string;
31
36
  /**
32
- * `next build` → OpenNext → 우리 진입점.
37
+ * `next build` → OpenNext → our entry point.
33
38
  *
34
- * `process.cwd()` 를 프로젝트로 옮긴다: OpenNext 의 `normalizeOptions` 가 앱 경로와
35
- * 출력 경로를 cwd 에서 만든다. 끝나면 되돌린다.
39
+ * It moves `process.cwd()` to the project: OpenNext's `normalizeOptions` builds
40
+ * the app path and the output path out of the cwd. It is moved back at the end.
36
41
  */
37
42
  export declare function buildNext(opts: BuildNextOptions): Promise<BuildNextResult>;
38
43
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAcA,+DAA+D;AAC/D,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AACvC,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,uTAMxB,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,uBAAuB,6vBAanC,CAAC;AAIF,8DAA8D;AAC9D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAanF;AAUD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CA2EhF"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAgBA;gDACgD;AAChD,eAAO,MAAM,QAAQ,iBAAiB,CAAC;AACvC,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAC;IACZ;wBACoB;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf;2BACuB;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,oOAMxB,CAAC;AAEF;wCACwC;AACxC,eAAO,MAAM,uBAAuB,mmBAcnC,CAAC;AAIF;kDACkD;AAClD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAanF;AAWD;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAqFhF"}
package/dist/build.js CHANGED
@@ -1,36 +1,41 @@
1
- // `@runlot/next/build` — `runlot deploy` 가 Next 프로젝트에서 부르는 한 함수
2
- // (docs/nextjs.md §2).
1
+ // `@runlot/next/build` — the one function `runlot deploy` calls in a Next
2
+ // project (docs/nextjs.md §2).
3
3
  //
4
- // OpenNext 의 **CLI 가 아니라 빌드 함수를 직접** 부른다. CLI 는 yargs 와
5
- // wrangler 의 `unstable_readConfig` 를 지고 있고, 그 설정에서 실제로 읽는 값은
6
- // `compatibility_date` 와 `assets.run_worker_first` 둘뿐이다. 우리는 그 둘을
7
- // `runlot.json` 에서 준다 — `wrangler.toml` 은 생기지 않는다.
4
+ // It calls OpenNext's **build function directly, not its CLI**. The CLI carries
5
+ // yargs and wrangler's `unstable_readConfig`, and the only values it actually
6
+ // reads out of that config are `compatibility_date` and
7
+ // `assets.run_worker_first`. We supply those two from `runlot.json` — no
8
+ // `wrangler.toml` is created.
8
9
  //
9
- // 이 파일은 node 에서 돈다(워커가 아니다). 그래서 `node:fs` 를 그냥 쓴다.
10
+ // This file runs in node (not in a worker). That is why it uses `node:fs`
11
+ // directly.
10
12
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
11
13
  import { createRequire } from "node:module";
12
14
  import { dirname, join, resolve } from "node:path";
13
15
  import { pathToFileURL } from "node:url";
14
- /** 생성한 OpenNext 설정이 사는 곳. `.open-next` 는 빌드가 매번 지우므로 밖에 둔다. */
16
+ /** Where the generated OpenNext config lives. It is kept outside `.open-next`
17
+ * because the build erases that every time. */
15
18
  export const WORK_DIR = ".runlot-next";
16
19
  export const ENTRY_NAME = "runlot-entry.js";
17
20
  /**
18
- * 우리가 세우는 진입점.
21
+ * The entry point we stand up.
19
22
  *
20
- * OpenNext 의 `worker.js` 기본 export 를 감싸고 나머지 export(Durable Object
21
- * 클래스 등)는 그대로 통과시킨다. `export *` 는 default 를 다시 내보내지 않으므로
22
- * 두 줄이 겹치지 않는다.
23
+ * It wraps the default export of OpenNext's `worker.js` and lets the other
24
+ * exports (Durable Object classes and so on) pass straight through. `export *`
25
+ * does not re-export the default, so the two lines do not collide.
23
26
  */
24
- export const ENTRY_SOURCE = `// runlot 이 만든 파일입니다. 고쳐도 다음 배포에서 다시 쓰입니다.
27
+ export const ENTRY_SOURCE = `// This file was made by runlot. Edits are overwritten on the next deploy.
25
28
  import worker from "./worker.js";
26
29
  import { wrap } from "@runlot/next/entry";
27
30
 
28
31
  export * from "./worker.js";
29
32
  export default wrap(worker);
30
33
  `;
31
- /** 사용자가 자기 것을 두지 않았을 때 우리가 쓰는 OpenNext 설정 (docs/nextjs.md §2 의 표). */
32
- export const OPEN_NEXT_CONFIG_SOURCE = `// runlot 이 만든 파일입니다. 고쳐도 다음 배포에서 다시 쓰입니다.
33
- // 직접 다루려면 프로젝트 루트에 open-next.config.ts 를 두세요 — 있으면 그쪽을 씁니다.
34
+ /** The OpenNext config we use when the user has not put down one of their own
35
+ * (the table in docs/nextjs.md §2). */
36
+ export const OPEN_NEXT_CONFIG_SOURCE = `// This file was made by runlot. Edits are overwritten on the next deploy.
37
+ // To handle it yourself, put an open-next.config.ts in the project root — if one
38
+ // is there, that is the one we use.
34
39
  import { defineCloudflareConfig } from "@opennextjs/cloudflare";
35
40
  import queue from "@opennextjs/cloudflare/overrides/queue/memory-queue";
36
41
  import incrementalCache from "@runlot/next/opennext/incremental-cache";
@@ -44,12 +49,13 @@ export default defineCloudflareConfig({
44
49
  });
45
50
  `;
46
51
  const USER_CONFIG_NAMES = ["open-next.config.ts", "open-next.config.mjs", "open-next.config.js"];
47
- /** 프로젝트가 자기 OpenNext 설정을 두었으면 그것을, 아니면 우리 것을 만들어 그 경로를 준다. */
52
+ /** Gives the path of the project's own OpenNext config when it has one, and
53
+ * otherwise creates ours and gives that path. */
48
54
  export function openNextConfigPath(dir, log) {
49
55
  for (const name of USER_CONFIG_NAMES) {
50
56
  const path = join(dir, name);
51
57
  if (existsSync(path)) {
52
- log(`${name} 을 찾았습니다 — 그 설정으로 빌드합니다.`);
58
+ log(`Found ${name}. Building with this configuration.`);
53
59
  return path;
54
60
  }
55
61
  }
@@ -63,10 +69,10 @@ async function load(path) {
63
69
  return (await import(pathToFileURL(path).href));
64
70
  }
65
71
  /**
66
- * `next build` → OpenNext → 우리 진입점.
72
+ * `next build` → OpenNext → our entry point.
67
73
  *
68
- * `process.cwd()` 를 프로젝트로 옮긴다: OpenNext 의 `normalizeOptions` 가 앱 경로와
69
- * 출력 경로를 cwd 에서 만든다. 끝나면 되돌린다.
74
+ * It moves `process.cwd()` to the project: OpenNext's `normalizeOptions` builds
75
+ * the app path and the output path out of the cwd. It is moved back at the end.
70
76
  */
71
77
  export async function buildNext(opts) {
72
78
  const dir = resolve(opts.dir);
@@ -77,10 +83,11 @@ export async function buildNext(opts) {
77
83
  apiIndex = here.resolve("@opennextjs/cloudflare");
78
84
  }
79
85
  catch {
80
- throw new Error("@opennextjs/cloudflare 를 찾지 못했습니다. @runlot/next 를 다시 설치하세요.");
86
+ throw new Error("Could not find @opennextjs/cloudflare. Reinstall @runlot/next.");
81
87
  }
82
- // 패키지의 exports 는 `dist/api/*` 만 연다. 빌드 함수는 `dist/cli/` 아래라
83
- // 지정자로는 못 부르고, 해석된 경로에서 옆으로 간다.
88
+ // The package's exports only open `dist/api/*`. The build function is under
89
+ // `dist/cli/`, so it cannot be reached by specifier; we walk sideways from
90
+ // the resolved path.
84
91
  const distDir = resolve(dirname(apiIndex), "..");
85
92
  const fromCloudflare = createRequire(apiIndex);
86
93
  const awsIndex = fromCloudflare.resolve("@opennextjs/aws/index.js");
@@ -88,14 +95,15 @@ export async function buildNext(opts) {
88
95
  const { ensureCloudflareConfig } = await load(join(distDir, "cli", "build", "utils", "ensure-cf-config.js"));
89
96
  const { compileOpenNextConfig } = await load(fromCloudflare.resolve("@opennextjs/aws/build/compileConfig.js"));
90
97
  const { normalizeOptions } = await load(fromCloudflare.resolve("@opennextjs/aws/build/helper.js"));
91
- // Next 자체는 사용자 프로젝트의 것이다. 우리 것을 쓰면 버전이 갈라진다.
98
+ // Next itself belongs to the user's project. Using ours would split the
99
+ // versions.
92
100
  const fromProject = createRequire(join(dir, "package.json"));
93
101
  let nextBin;
94
102
  try {
95
103
  nextBin = fromProject.resolve("next/dist/bin/next");
96
104
  }
97
105
  catch {
98
- throw new Error(`${dir} 에서 next 를 찾지 못했습니다. \`npm i next\` 뒤에 다시 배포하세요.`);
106
+ throw new Error(`Could not find next in ${dir}. Run \`npm i next\`, then deploy again.`);
99
107
  }
100
108
  const configPath = openNextConfigPath(dir, log);
101
109
  const previousCwd = process.cwd();
@@ -103,22 +111,30 @@ export async function buildNext(opts) {
103
111
  try {
104
112
  const { config, buildDir } = await compileOpenNextConfig(configPath, { compileEdge: true });
105
113
  ensureCloudflareConfig(config);
106
- // 사용자의 `package.json` scripts 가 아니라 next 바이너리를 직접 부른다.
107
- // `npm run build`가 배포·린트·타입검사를 겸하는 프로젝트가 흔한데, 배포가
108
- // 그것들을 다시 도는 것은 우리가 약속한 일이 아니다.
114
+ // Call the next binary directly rather than the user's `package.json`
115
+ // scripts. It is common for `npm run build` to also do deployment, linting
116
+ // and type checking, and running those again is not something our deploy
117
+ // promised to do.
109
118
  config.buildCommand = [JSON.stringify(process.execPath), JSON.stringify(nextBin), "build"].join(" ");
110
119
  const options = normalizeOptions(config, dirname(awsIndex), buildDir);
111
- log("Next.js 빌드 중…");
120
+ log("Building Next.js…");
112
121
  await openNextBuild(options, config, { sourceDir: dir, skipNextBuild: false, skipWranglerConfigCheck: true, minify: true }, {
113
122
  ...(opts.compatibilityDate !== undefined
114
123
  ? { compatibility_date: opts.compatibilityDate }
115
124
  : {}),
116
- assets: { run_worker_first: false },
125
+ // **The worker is first here.** On Cloudflare the platform answers
126
+ // static paths before the worker sees them, and OpenNext's asset
127
+ // resolver reads this flag to decide whether it has to look at ASSETS
128
+ // itself. runlot's socket hands every request to `main`
129
+ // (node/internal/workerd/config.go), so with `false` the resolver
130
+ // returned early and Next answered its own 404 for a file that was
131
+ // sitting right there in the bundle (docs/nextjs.md §8).
132
+ assets: { run_worker_first: true },
117
133
  }, false);
118
134
  const outputDir = join(dir, ".open-next");
119
135
  const worker = join(outputDir, ENTRY_NAME);
120
136
  if (!existsSync(join(outputDir, "worker.js"))) {
121
- throw new Error(`${outputDir}/worker.js 가 없습니다. OpenNext 빌드가 끝나지 않았습니다.`);
137
+ throw new Error(`Could not find ${outputDir}/worker.js. The OpenNext build did not complete.`);
122
138
  }
123
139
  writeFileSync(worker, ENTRY_SOURCE);
124
140
  return { worker, assets: join(outputDir, "assets"), outputDir };
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,uBAAuB;AACvB,EAAE;AACF,wDAAwD;AACxD,6DAA6D;AAC7D,kEAAkE;AAClE,mDAAmD;AACnD,EAAE;AACF,oDAAoD;AACpD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,+DAA+D;AAC/D,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC;AACvC,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAmB5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;;;;;;CAM3B,CAAC;AAEF,sEAAsE;AACtE,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;CAatC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,qBAAqB,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;AAEjG,8DAA8D;AAC9D,MAAM,UAAU,kBAAkB,CAAC,GAAW,EAAE,GAA2B;IACzE,KAAK,MAAM,IAAI,IAAI,iBAAiB,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC7B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,GAAG,CAAC,GAAG,IAAI,0BAA0B,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CA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package/dist/entry.d.ts CHANGED
@@ -5,9 +5,10 @@ export interface FetchHandler {
5
5
  fetch(request: Request, env: RunlotEnv, ctx: RunlotContext): Response | Promise<Response>;
6
6
  }
7
7
  /**
8
- * OpenNext 의 워커를 감싼다. `fetch` 밖의 export(Durable Object 클래스 등)는
9
- * 이 함수가 아니라 생성된 `runlot-entry.js` 가 그대로 다시 내보낸다 — 감쌀 것이
10
- * 요청 경로뿐이라서다.
8
+ * Wraps OpenNext's worker. The exports other than `fetch` (Durable Object
9
+ * classes and so on) are re-exported as they are by the generated
10
+ * `runlot-entry.js`, not by this function — because the only thing that needs
11
+ * wrapping is the request path.
11
12
  */
12
13
  export declare function wrap(handler: FetchHandler): FetchHandler;
13
14
  //# sourceMappingURL=entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAYA,OAAO,EAAO,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3F;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAMxD"}
1
+ {"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../src/entry.ts"],"names":[],"mappings":"AAaA,OAAO,EAAO,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3F;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAMxD"}
package/dist/entry.js CHANGED
@@ -1,21 +1,23 @@
1
- // 진입 wrapper (docs/nextjs.md §4).
1
+ // The entry wrapper (docs/nextjs.md §4).
2
2
  //
3
- // 빌드가 `.open-next/runlot-entry.js` 를 내고, 그 파일이 OpenNext 의 `worker.js`
4
- // 기본 export 를 이것으로 감싼다:
3
+ // The build emits `.open-next/runlot-entry.js`, and that file wraps the default
4
+ // export of OpenNext's `worker.js` with this:
5
5
  //
6
6
  // import worker from "./worker.js";
7
7
  // import { wrap } from "@runlot/next/entry";
8
8
  // export default wrap(worker);
9
9
  //
10
- // 하는 일은 하나다 — 요청 하나의 `(request, env, ctx)` 를 저장소에 넣고 그 안에서
11
- // OpenNext 의 fetch 를 부른다. 그래야 서버 컴포넌트 안의 `env.auth.user()` 가
12
- // 인자 없이 자기 요청을 찾는다.
10
+ // It does one thing — it puts one request's `(request, env, ctx)` into the
11
+ // store and calls OpenNext's fetch inside it. That is what lets
12
+ // `env.auth.user()` inside a server component find its own request without an
13
+ // argument.
13
14
  import { als } from "./store.js";
14
15
  export { als } from "./store.js";
15
16
  /**
16
- * OpenNext 의 워커를 감싼다. `fetch` 밖의 export(Durable Object 클래스 등)는
17
- * 이 함수가 아니라 생성된 `runlot-entry.js` 가 그대로 다시 내보낸다 — 감쌀 것이
18
- * 요청 경로뿐이라서다.
17
+ * Wraps OpenNext's worker. The exports other than `fetch` (Durable Object
18
+ * classes and so on) are re-exported as they are by the generated
19
+ * `runlot-entry.js`, not by this function — because the only thing that needs
20
+ * wrapping is the request path.
19
21
  */
20
22
  export function wrap(handler) {
21
23
  return {