@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 +10 -10
- package/dist/ai.d.ts +223 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +2 -0
- package/dist/ai.js.map +1 -0
- package/dist/build.d.ts +22 -17
- package/dist/build.d.ts.map +1 -1
- package/dist/build.js +48 -32
- package/dist/build.js.map +1 -1
- package/dist/entry.d.ts +4 -3
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +11 -9
- package/dist/entry.js.map +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -25
- package/dist/index.js.map +1 -1
- package/dist/opennext/context.d.ts +6 -3
- package/dist/opennext/context.d.ts.map +1 -1
- package/dist/opennext/context.js +17 -12
- package/dist/opennext/context.js.map +1 -1
- package/dist/opennext/incremental-cache.d.ts +2 -1
- package/dist/opennext/incremental-cache.d.ts.map +1 -1
- package/dist/opennext/incremental-cache.js +18 -12
- package/dist/opennext/incremental-cache.js.map +1 -1
- package/dist/opennext/tag-cache.d.ts +3 -3
- package/dist/opennext/tag-cache.d.ts.map +1 -1
- package/dist/opennext/tag-cache.js +15 -11
- package/dist/opennext/tag-cache.js.map +1 -1
- package/dist/store.d.ts +14 -9
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +22 -20
- package/dist/store.js.map +1 -1
- package/package.json +5 -5
package/dist/store.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
//
|
|
1
|
+
// The request-context store (docs/nextjs.md §4).
|
|
2
2
|
//
|
|
3
|
-
// `
|
|
4
|
-
// Next
|
|
5
|
-
// `page.tsx`
|
|
6
|
-
//
|
|
3
|
+
// The `env` of `runlot/next` reads the `(request, env, ctx)` the worker entry
|
|
4
|
+
// point received. A Next server component has no place to pass those three down
|
|
5
|
+
// as arguments — `page.tsx` only receives `props` — so the entry wrapper puts
|
|
6
|
+
// them into an AsyncLocalStorage and this module takes them back out.
|
|
7
7
|
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
8
|
+
// **The store is one symbol on `globalThis`.** Because there is no guarantee of
|
|
9
|
+
// a single module instance: the `worker.js` OpenNext emits is an already-bundled
|
|
10
|
+
// bundle that contains a copy of this package inside it, and bundling the
|
|
11
|
+
// `runlot-entry.js` we stand up beside it makes one more copy. Keep the store in
|
|
12
|
+
// a module-local variable and the page cannot see the value the wrapper put in —
|
|
13
|
+
// it quietly becomes "there is no request". OpenNext itself uses
|
|
14
|
+
// `Symbol.for("__cloudflare-context__")` for the same reason.
|
|
14
15
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
15
16
|
const STORE = Symbol.for("runlot.next.store");
|
|
16
17
|
const g = globalThis;
|
|
17
|
-
/**
|
|
18
|
+
/** The request-context store. The entry wrapper puts into it and `env`,
|
|
19
|
+
* `request()` and `waitUntil()` read from it. */
|
|
18
20
|
export const als = (g[STORE] ??= new AsyncLocalStorage());
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* The sentence for being called outside the store.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* The reason it does not quietly hand back `null` or `undefined` is the same as
|
|
25
|
+
* docs/auth.md §4 — when "cannot be done" becomes an empty value, every page
|
|
26
|
+
* looks logged out, and the only place that is noticed is after a deploy.
|
|
25
27
|
*/
|
|
26
|
-
export const OUTSIDE_REQUEST = "runlot/next
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"`next dev
|
|
28
|
+
export const OUTSIDE_REQUEST = "The `env` of runlot/next can only be read inside a request. " +
|
|
29
|
+
"There is no request at module top level or in a build-time static render — " +
|
|
30
|
+
"move it inside a server component, a route handler or middleware. " +
|
|
31
|
+
"Runlot bindings are not available under `next dev`. Deploy with `runlot deploy` and check there.";
|
|
30
32
|
export function store() {
|
|
31
33
|
const s = als.getStore();
|
|
32
34
|
if (!s)
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,sEAAsE;AACtE,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,0EAA0E;AAC1E,iFAAiF;AACjF,iFAAiF;AACjF,iEAAiE;AACjE,8DAA8D;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAsCrD,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAM9C,MAAM,CAAC,GAAG,UAAoB,CAAC;AAE/B;kDACkD;AAClD,MAAM,CAAC,MAAM,GAAG,GAAmC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,IAAI,iBAAiB,EAAe,CAAC,CAAC;AAEvG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAC1B,8DAA8D;IAC9D,6EAA6E;IAC7E,oEAAoE;IACpE,kGAAkG,CAAC;AAErG,MAAM,UAAU,KAAK;IACnB,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;IACzB,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;IACzC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runlot/next",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
4
|
-
"description": "Next.js
|
|
3
|
+
"version": "0.1.0-rc.150",
|
|
4
|
+
"description": "Next.js adapter for Runlot — request-scoped env plus the OpenNext build",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -42,14 +42,14 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@opennextjs/aws": "4.1.4",
|
|
44
44
|
"@opennextjs/cloudflare": "^1.20.6",
|
|
45
|
-
"@runlot/auth": "0.1.0-rc.
|
|
46
|
-
"@runlot/pg": "0.1.0-rc.
|
|
45
|
+
"@runlot/auth": "0.1.0-rc.150",
|
|
46
|
+
"@runlot/pg": "0.1.0-rc.150"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/node": "^22.10.2",
|
|
50
50
|
"esbuild": "^0.24.2",
|
|
51
51
|
"typescript": "^5.7.2",
|
|
52
|
-
"@runlot/config": "0.1.0-rc.
|
|
52
|
+
"@runlot/config": "0.1.0-rc.150"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsc -p tsconfig.build.json",
|