@stacksjs/config 0.75.529 → 0.75.535
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 +0 -22
- package/dist/runtime.d.ts +0 -12
- package/dist/views.d.ts +8 -6
- package/dist/views.js +1 -1
- package/package.json +8 -8
|
@@ -20,28 +20,6 @@ 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;
|
|
45
23
|
/**
|
|
46
24
|
* The request the caller is running inside, or undefined outside any scope.
|
|
47
25
|
*
|
package/dist/runtime.d.ts
CHANGED
|
@@ -23,18 +23,6 @@ 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>;
|
|
38
26
|
/**
|
|
39
27
|
* Called by `@stacksjs/database` once the connection is live. Internal —
|
|
40
28
|
* users shouldn't need to invoke this directly.
|
package/dist/views.d.ts
CHANGED
|
@@ -27,12 +27,14 @@ export declare function resolveViewPatterns(userViewsPath: string, defaultViewsP
|
|
|
27
27
|
* `POST /password/forgot`, `/password/reset/{token}` to `POST /password/reset`,
|
|
28
28
|
* `/auth/magic/{token}` to `POST /auth/magic-link/consume`.
|
|
29
29
|
*
|
|
30
|
-
* `dashboard` - the
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
30
|
+
* `dashboard` - `dashboard/index.stx` is the stub `/dashboard` renders on the
|
|
31
|
+
* views server, meaningless without the bundle, and `feedback/{token}` posts to
|
|
32
|
+
* `/api/feedback/{token}` in `defaults/routes/dashboard.ts`.
|
|
33
|
+
*
|
|
34
|
+
* `storefront` - `/cart` posts to `/api/cart/update`, the three checkout steps
|
|
35
|
+
* to `/api/checkout/{contact,shipping,place}`, and `/orders/{id}` is where
|
|
36
|
+
* `place` lands, all in `defaults/routes/storefront.ts`. The bundle follows the
|
|
37
|
+
* `commerce` feature, so an app without commerce does not serve these pages.
|
|
36
38
|
*
|
|
37
39
|
* Served with every bundle mounted, withheld without it: an app answering 200
|
|
38
40
|
* on `/login` whose form posts into a 404 is worse than an app answering 404.
|
package/dist/views.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{existsSync}from"node:fs";import{join}from"node:path";import{packageViewRoots}from"./discovered-resources";export const DEFAULT_VIEW_ROUTE_BUNDLES={auth:["login.stx","register.stx","forgot-password.stx","password","auth"],dashboard:["
|
|
1
|
+
import{existsSync}from"node:fs";import{join}from"node:path";import{packageViewRoots}from"./discovered-resources";export const DEFAULT_VIEW_ROUTE_BUNDLES={auth:["login.stx","register.stx","forgot-password.stx","password","auth"],dashboard:["dashboard","feedback"],storefront:["cart.stx","checkout","orders"]};export const DEFAULT_VIEW_TEMPLATES=["cms"];export const DEFAULT_VIEWS_ALWAYS=["index.stx","coming-soon.stx","errors","emails"];export function withheldDefaultViews(mountedBundles){const withheld=[];for(const[bundle,views]of Object.entries(DEFAULT_VIEW_ROUTE_BUNDLES)){if(!mountedBundles.has(bundle))withheld.push(...views)}withheld.push(...DEFAULT_VIEW_TEMPLATES);return withheld}export function resolveViewPatterns(userViewsPath,defaultViewsPath,setting,exists=existsSync,packageViews=packageViewRoots({exists}),mountedBundles=new Set){const fromPackages=packageViews.map((root)=>root.dir);if(setting===undefined){const withheld=withheldDefaultViews(mountedBundles);return{patterns:[userViewsPath,defaultViewsPath,...fromPackages],missing:[],exclude:withheld.map((name)=>join(defaultViewsPath,name)),withheld}}if(setting===true)return{patterns:[userViewsPath,defaultViewsPath,...fromPackages],missing:[],exclude:[],withheld:[]};if(setting===false)return{patterns:[userViewsPath,...fromPackages],missing:[],exclude:[],withheld:[]};if(!Array.isArray(setting))return{patterns:[userViewsPath,defaultViewsPath,...fromPackages],missing:[],exclude:[],withheld:[]};const patterns=[userViewsPath];const missing=[];for(const name of setting){const cleaned=String(name).replace(/^[/\\]+/,"");if(!cleaned||cleaned.split(/[/\\]/).includes(".."))continue;const candidate=join(defaultViewsPath,cleaned);if(exists(candidate))patterns.push(candidate);else missing.push(cleaned)}patterns.push(...fromPackages);return{patterns,missing,exclude:[],withheld:[]}}
|
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.535",
|
|
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.535",
|
|
59
|
+
"@stacksjs/features": "0.75.535",
|
|
60
|
+
"@stacksjs/path": "0.75.535",
|
|
61
|
+
"@stacksjs/tunnel": "0.75.535",
|
|
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.535",
|
|
66
|
+
"@stacksjs/env": "0.75.535",
|
|
67
|
+
"@stacksjs/types": "0.75.535",
|
|
68
68
|
"better-dx": "^0.2.24"
|
|
69
69
|
}
|
|
70
70
|
}
|