@velarscript/cli 0.12.0 → 0.12.1
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/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -7
- package/skill/ai-skill-node.md +17 -3
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velarscript/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "The VelarScript command-line compiler, dev server, test runner, and language server.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"velar": "./dist/cli.js"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@velarscript/compiler": "0.12.
|
|
34
|
-
"@velarscript/core": "0.12.
|
|
35
|
-
"@velarscript/desktop": "0.12.
|
|
36
|
-
"@velarscript/node": "0.12.
|
|
33
|
+
"@velarscript/compiler": "0.12.1",
|
|
34
|
+
"@velarscript/core": "0.12.1",
|
|
35
|
+
"@velarscript/desktop": "0.12.1",
|
|
36
|
+
"@velarscript/node": "0.12.1",
|
|
37
37
|
"@velarscript/script-analysis": "0.10.5",
|
|
38
|
-
"@velarscript/web": "0.12.
|
|
39
|
-
"create-velar": "0.12.
|
|
38
|
+
"@velarscript/web": "0.12.1",
|
|
39
|
+
"create-velar": "0.12.1",
|
|
40
40
|
"esbuild": "^0.28.1",
|
|
41
41
|
"playwright": "^1.58.2"
|
|
42
42
|
}
|
package/skill/ai-skill-node.md
CHANGED
|
@@ -41,7 +41,7 @@ server.
|
|
|
41
41
|
|
|
42
42
|
`@name` keeps its one language-wide role: it qualifies a compiler-owned name
|
|
43
43
|
in the current context. In a `server` block, the available names are `@get`,
|
|
44
|
-
`@post`, `@put`, `@patch`, and `@
|
|
44
|
+
`@post`, `@put`, `@patch`, `@delete`, and `@notFound`. They are not decorators,
|
|
45
45
|
functions, imports, annotations, first-class values, or user extension points.
|
|
46
46
|
|
|
47
47
|
## Routes and checked inputs
|
|
@@ -65,6 +65,7 @@ export server articles:
|
|
|
65
65
|
|
|
66
66
|
@post(p"/articles", input: CreateArticle):
|
|
67
67
|
return created({id: 1, title: input.title})
|
|
68
|
+
|
|
68
69
|
```
|
|
69
70
|
|
|
70
71
|
The path is written once. A capture such as `{id:number}` declares `id`
|
|
@@ -82,6 +83,18 @@ request, including `queryAll` and cooperative `cancellation`. Ambiguous bodies,
|
|
|
82
83
|
duplicate declarations, conflicting path shapes, and unsupported path types are
|
|
83
84
|
compile errors.
|
|
84
85
|
|
|
86
|
+
`@notFound()` is the one application fallback for a path that matches no
|
|
87
|
+
route. It may omit its parameter or accept one explicitly typed `Request`.
|
|
88
|
+
Returning Data keeps status 404; return an explicit response such as
|
|
89
|
+
`json(value, status=410)` to choose another final status. A matched route's
|
|
90
|
+
`HttpError` and framework 405 responses do not enter this fallback. Declare at
|
|
91
|
+
most one on the final application; an app that owns `@notFound` cannot be moved
|
|
92
|
+
under a non-root `prefix`, because a global fallback has no unambiguous prefix
|
|
93
|
+
scope. Compose prefixed route tables first, then declare the fallback on the
|
|
94
|
+
outer `server`. A catch-all route such as `staticFiles("/", ...)` is a matched
|
|
95
|
+
route and therefore owns its own file fallback instead of entering
|
|
96
|
+
`@notFound`.
|
|
97
|
+
|
|
85
98
|
Use ordinary values for the cases that need more than inference:
|
|
86
99
|
|
|
87
100
|
```velar
|
|
@@ -131,7 +144,7 @@ closed. Do not build a controller or container layer around it.
|
|
|
131
144
|
Compose route tables as values:
|
|
132
145
|
|
|
133
146
|
```velar fragment
|
|
134
|
-
import {RouteDocumentation, docs, lifecycle, middleware, prefix, staticFiles, use} from "velar/serve"
|
|
147
|
+
import {Request, RouteDocumentation, docs, lifecycle, middleware, prefix, staticFiles, use} from "velar/serve"
|
|
135
148
|
|
|
136
149
|
const service = lifecycle(
|
|
137
150
|
prefix("/api", articles),
|
|
@@ -154,7 +167,8 @@ const routeDocs: Map<string, RouteDocumentation> = Map([["GET /api/articles/{id:
|
|
|
154
167
|
|
|
155
168
|
export server app:
|
|
156
169
|
...docs(hardened, title="Article API", version="1.0.0", routes=routeDocs)
|
|
157
|
-
...staticFiles("/", root="public"
|
|
170
|
+
...staticFiles("/assets", root="public")
|
|
171
|
+
@notFound(request: Request) => {error: "route_not_found", path: request.path}
|
|
158
172
|
```
|
|
159
173
|
|
|
160
174
|
`prefix` changes a literal route prefix; `bodyLimit` narrows one route
|