@stacksjs/stx 0.2.164 → 0.2.165

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/render.js CHANGED
@@ -120,6 +120,10 @@ export async function renderTemplateString(content, filePath, renderOptions = {}
120
120
  if (Number.isInteger(status) && status >= 100 && status <= 599)
121
121
  recordOn(renderOptions.context, "__stxResponseStatus", status);
122
122
  },
123
+ notFound: (status = 404) => {
124
+ const code = Number.isInteger(status) && status >= 400 && status <= 599 ? status : 404;
125
+ recordOn(renderOptions.context, "__stxResponseStatus", code);
126
+ },
123
127
  setResponseHeader: (name, value) => {
124
128
  if (!name)
125
129
  return;
@@ -103,7 +103,7 @@ export declare const UNWRAP_HELPER: '__StxTemplateValue';
103
103
  * Mirrors what `serve.ts` puts in scope. Declaring these is what lets the
104
104
  * checker report a genuine typo instead of suppressing every unresolved name.
105
105
  */
106
- export declare const STX_SERVER_CONTEXT: readonly ['params', 'query', 'cookies', 'host', 'ip', 'setResponseStatus', 'setResponseHeader', 'request', 'url', 'definePageMeta'];
106
+ export declare const STX_SERVER_CONTEXT: readonly ['params', 'query', 'cookies', 'host', 'ip', 'setResponseStatus', 'setResponseHeader', 'notFound', 'request', 'url', 'definePageMeta'];
107
107
  /**
108
108
  * Names the template engine puts in scope for every page.
109
109
  *
@@ -226,6 +226,7 @@ export const STX_SERVER_CONTEXT = [
226
226
  "ip",
227
227
  "setResponseStatus",
228
228
  "setResponseHeader",
229
+ "notFound",
229
230
  "request",
230
231
  "url",
231
232
  "definePageMeta"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.164",
4
+ "version": "0.2.165",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -117,12 +117,12 @@
117
117
  "dependencies": {
118
118
  "@cwcss/crosswind": "^0.2.14",
119
119
  "@stacksjs/clapp": "^0.2.0",
120
- "@stacksjs/desktop": "0.2.164",
121
- "@stacksjs/sanitizer": "0.2.164",
120
+ "@stacksjs/desktop": "0.2.165",
121
+ "@stacksjs/sanitizer": "0.2.165",
122
122
  "@stacksjs/ts-i18n": "^0.1.11",
123
- "bun-plugin-stx": "0.2.164",
123
+ "bun-plugin-stx": "0.2.165",
124
124
  "bunfig": "^0.15.17",
125
- "stx-router": "0.2.164",
125
+ "stx-router": "0.2.165",
126
126
  "ts-broadcasting": "^0.0.9",
127
127
  "ts-images": "^0.1.9",
128
128
  "ts-syntax-highlighter": "^0.2.1"