@stacksjs/config 0.75.538 → 0.75.541
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/request-context.d.ts +22 -0
- package/dist/runtime.d.ts +12 -0
- package/package.json +8 -8
|
@@ -20,6 +20,28 @@ export declare function createRequestContext(read: () => RequestContextSnapshot
|
|
|
20
20
|
* object by accident.
|
|
21
21
|
*/
|
|
22
22
|
export declare function installRequestContext(read: () => RequestContextSnapshot | undefined): StacksRequestContext;
|
|
23
|
+
/**
|
|
24
|
+
* Open a scope for `request` and return its snapshot, for the server to add
|
|
25
|
+
* the site or a locale to once it has resolved them.
|
|
26
|
+
*
|
|
27
|
+
* Call it FIRST in stx serve's `onRequest` hook, before the hook's first
|
|
28
|
+
* `await`. stx calls the hook from the request's own async context and awaits
|
|
29
|
+
* it before rendering, so a scope entered in the hook's synchronous prefix is
|
|
30
|
+
* the one every `<script server>` of that render runs in: the page's, the
|
|
31
|
+
* layout's and the components'. core/buddy/tests/request-context-concurrency
|
|
32
|
+
* .test.ts sends 400 storefront requests, sixteen in flight, to each view
|
|
33
|
+
* server and checks the page and the layout both read their own.
|
|
34
|
+
*
|
|
35
|
+
* Entered after an `await` in the hook, the scope reaches no script. The rest
|
|
36
|
+
* of an async function runs in a context of its own, and stx resumes in the
|
|
37
|
+
* one it called the hook from. The dev server entered its scope there, and
|
|
38
|
+
* production-server.ts said it had tried the dev server's approach before
|
|
39
|
+
* settling on globals, which is where "AsyncLocalStorage does not survive
|
|
40
|
+
* into stx-serve's render" came from. request-scope.test.ts pins both
|
|
41
|
+
* placements, and that a request that entered no scope reads none rather
|
|
42
|
+
* than a neighbour's.
|
|
43
|
+
*/
|
|
44
|
+
export declare function enterRequestScope(request: Request): RequestContextSnapshot;
|
|
23
45
|
/**
|
|
24
46
|
* The request the caller is running inside, or undefined outside any scope.
|
|
25
47
|
*
|
package/dist/runtime.d.ts
CHANGED
|
@@ -23,6 +23,18 @@ import type { StacksOptions } from '@stacksjs/types';
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
export declare function awaitConfig(): Promise<StacksOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves once `database` config has been read by `@stacksjs/database`'s
|
|
28
|
+
* lazy initializer. Use it from boot scripts that need a live `db` handle
|
|
29
|
+
* before the request loop starts.
|
|
30
|
+
*
|
|
31
|
+
* Why a separate signal: `overridesReady` only signals that `~/config/database.ts`
|
|
32
|
+
* was *imported*, not that `@stacksjs/database` has actually wired up the
|
|
33
|
+
* connection. Calling `db.selectFrom(...)` immediately after `overridesReady`
|
|
34
|
+
* resolves can still race the connection setup. The database driver flips
|
|
35
|
+
* this signal to `true` once it has a working connection.
|
|
36
|
+
*/
|
|
37
|
+
export declare function awaitDatabaseConfig(): Promise<StacksOptions>;
|
|
26
38
|
/**
|
|
27
39
|
* Called by `@stacksjs/database` once the connection is live. Internal —
|
|
28
40
|
* users shouldn't need to invoke this directly.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/config",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.541",
|
|
6
6
|
"description": "The Stacks config helper methods.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -55,16 +55,16 @@
|
|
|
55
55
|
"prepublishOnly": "bun run build"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@stacksjs/events": "0.75.
|
|
59
|
-
"@stacksjs/features": "0.75.
|
|
60
|
-
"@stacksjs/path": "0.75.
|
|
61
|
-
"@stacksjs/tunnel": "0.75.
|
|
58
|
+
"@stacksjs/events": "0.75.541",
|
|
59
|
+
"@stacksjs/features": "0.75.541",
|
|
60
|
+
"@stacksjs/path": "0.75.541",
|
|
61
|
+
"@stacksjs/tunnel": "0.75.541",
|
|
62
62
|
"ts-pantry": "^0.11.184"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@stacksjs/alias": "0.75.
|
|
66
|
-
"@stacksjs/env": "0.75.
|
|
67
|
-
"@stacksjs/types": "0.75.
|
|
65
|
+
"@stacksjs/alias": "0.75.541",
|
|
66
|
+
"@stacksjs/env": "0.75.541",
|
|
67
|
+
"@stacksjs/types": "0.75.541",
|
|
68
68
|
"better-dx": "^0.2.24"
|
|
69
69
|
}
|
|
70
70
|
}
|