@jimhoyd/urlcode 0.5.6 → 0.5.8
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/.claude/skills/urlcode-authoring/SKILL.md +15 -0
- package/.claude/skills/urlcode-operations/SKILL.md +4 -0
- package/README.md +24 -14
- package/dist/BUILD-MANIFEST.json +50 -49
- package/dist/agents-guide.js +5 -2
- package/dist/assets.js +2 -2
- package/dist/authoring.js +3 -58
- package/dist/aws.js +21 -4
- package/dist/body-schema.js +2 -3
- package/dist/capability-query.js +3 -3
- package/dist/catalog.js +1 -1
- package/dist/cli.js +42 -15
- package/dist/cloudflare.js +26 -1
- package/dist/config.js +1 -1
- package/dist/context.js +6 -6
- package/dist/egress.js +1 -1
- package/dist/examples.js +2 -2
- package/dist/explain.js +4 -6
- package/dist/extension-artifacts.js +8 -8
- package/dist/extension-transport.js +6 -4
- package/dist/function-worker.js +5 -2
- package/dist/functions.js +1 -1
- package/dist/guest-api.js +22 -15
- package/dist/http-policy.js +1 -3
- package/dist/http-response.js +61 -10
- package/dist/init-with.js +8 -8
- package/dist/interchange.js +3 -2
- package/dist/logging.js +4 -4
- package/dist/match.js +1 -1
- package/dist/mcp-authoring.js +1 -2
- package/dist/mcp.js +2 -2
- package/dist/object-guards.js +17 -0
- package/dist/pattern-guard.js +33 -3
- package/dist/policies/cache.js +16 -4
- package/dist/policies/compression.js +1 -1
- package/dist/policies/throttle.js +1 -1
- package/dist/policy.js +3 -3
- package/dist/prerender.js +1 -2
- package/dist/project-dependencies.js +8 -8
- package/dist/proxy.js +1 -1
- package/dist/readiness.js +16 -17
- package/dist/review.js +2 -2
- package/dist/route-diff.js +4 -4
- package/dist/router.js +1 -1
- package/dist/runtime.js +4 -1
- package/dist/scaffold.js +1 -1
- package/dist/schema-query.js +1 -1
- package/dist/server.js +49 -7
- package/dist/signals.js +2 -2
- package/dist/site.js +2 -2
- package/dist/trusted-functions.js +1 -1
- package/dist/types/assets.d.ts +3 -2
- package/dist/types/authoring.d.ts +3 -6
- package/dist/types/body-schema.d.ts +2 -1
- package/dist/types/catalog.d.ts +2 -1
- package/dist/types/config.d.ts +0 -8
- package/dist/types/context.d.ts +3 -1
- package/dist/types/egress.d.ts +1 -1
- package/dist/types/explain.d.ts +4 -4
- package/dist/types/extension-artifacts.d.ts +4 -13
- package/dist/types/extension-transport.d.ts +6 -4
- package/dist/types/functions.d.ts +1 -1
- package/dist/types/http-response.d.ts +7 -3
- package/dist/types/init-with.d.ts +3 -9
- package/dist/types/logging.d.ts +4 -3
- package/dist/types/match.d.ts +2 -1
- package/dist/types/object-guards.d.ts +7 -0
- package/dist/types/pattern-guard.d.ts +0 -1
- package/dist/types/policies/cache.d.ts +4 -3
- package/dist/types/policies/compression.d.ts +1 -1
- package/dist/types/policies/throttle.d.ts +1 -1
- package/dist/types/policy.d.ts +4 -3
- package/dist/types/project-dependencies.d.ts +1 -40
- package/dist/types/proxy.d.ts +2 -1
- package/dist/types/readiness.d.ts +12 -16
- package/dist/types/review.d.ts +0 -2
- package/dist/types/route-diff.d.ts +4 -3
- package/dist/types/router.d.ts +1 -1
- package/dist/types/server.d.ts +22 -0
- package/dist/types/signals.d.ts +3 -2
- package/dist/types/site.d.ts +1 -2
- package/dist/types/trusted-functions.d.ts +1 -1
- package/dist/types/types.d.ts +17 -11
- package/dist/types/vercel.d.ts +1 -0
- package/dist/types/verify-deployment.d.ts +1 -1
- package/dist/types.js +18 -11
- package/dist/vercel.js +12 -3
- package/dist/verify-deployment.js +29 -11
- package/docs/AI-AUTHORING.md +9 -0
- package/docs/FUNCTION-SECURITY.md +4 -0
- package/docs/README.md +2 -2
- package/docs/TOOLING.md +27 -1
- package/examples/assets/Makefile +1 -1
- package/examples/compliance/rules.mjs +2 -2
- package/llms-full.txt +44 -13
- package/llms.txt +9 -2
- package/package.json +4 -3
- package/skills/urlcode/SKILL.md +6 -6
- package/starters/default/.github/workflows/urlcode.yml +2 -1
- package/starters/default/AGENTS.md +3 -3
- package/starters/default/Makefile +1 -1
- package/starters/default/README.md +13 -11
- package/starters/default/tests/requests.json +0 -50
- package/starters/default/urlcode.yaml +1 -4
- package/dist/scripts/operational-drills.js +0 -33
- package/starters/default/functions/hello.mjs +0 -3
- package/starters/default/middleware/headers.mjs +0 -6
- package/starters/default/routes/functions.yaml +0 -20
- package/starters/default/routes/marketing/links.yaml +0 -7
- package/starters/page/README.md +0 -14
- package/starters/page/public/index.html +0 -12
- package/starters/page/tests/requests.json +0 -17
- package/starters/page/urlcode.yaml +0 -6
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
# yaml-language-server: $schema=https://raw.githubusercontent.com/jimhoyd-com/urlcode/669632fb4f188f293a0f622847f87ee019c0627f/schemas/urlcode.schema.json
|
|
2
|
-
#
|
|
2
|
+
# Start with no routes. Add only the files and routes your application needs.
|
|
3
3
|
version: "1"
|
|
4
|
-
includes:
|
|
5
|
-
- routes/functions.yaml
|
|
6
|
-
- routes/marketing/links.yaml
|
|
7
4
|
routes: {}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Disposable local proof, never a claim about the production deployment.
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import {mkdtemp,mkdir,writeFile,rm} from 'node:fs/promises';
|
|
4
|
-
import {tmpdir} from 'node:os';
|
|
5
|
-
import {join} from 'node:path';
|
|
6
|
-
import {startServer} from '../server.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const seconds=Number(process.env.URLCODE_SOAK_SECONDS||5);
|
|
10
|
-
assert(Number.isInteger(seconds)&&seconds>=1&&seconds<=3600,'Soak must be 1–3600 seconds');
|
|
11
|
-
const directory=await mkdtemp(join(tmpdir(),'urlcode-drills-')),project=join(directory,'app');
|
|
12
|
-
let app ;
|
|
13
|
-
try {
|
|
14
|
-
await mkdir(project);
|
|
15
|
-
const config='version: "1"\nroutes:\n /go:\n redirect: {url: "https://example.com/v1"}\n /function:\n function: {source: f.mjs}\n';
|
|
16
|
-
await writeFile(join(project,'urlcode.yaml'),config);
|
|
17
|
-
await writeFile(join(project,'f.mjs'),'export default () => new Response("isolated");');
|
|
18
|
-
app=await startServer({project,port:0,log:()=>{}});
|
|
19
|
-
const server=app;
|
|
20
|
-
const get=async(path )=>{const r=await fetch(`http://127.0.0.1:${server.address.port}${path}`,{redirect:'manual'});const body=await r.text();return {status:r.status,location:r.headers.get('location'),body};};
|
|
21
|
-
const start=performance.now(),samples =[];let requests=0;
|
|
22
|
-
while(performance.now()-start<seconds*1000){
|
|
23
|
-
const before=performance.now();const responses=await Promise.all(['/go','/function'].map(get));
|
|
24
|
-
assert.deepEqual(responses.map(r=>r.status),[302,200]);assert.equal(responses[1]?.body,'isolated');
|
|
25
|
-
samples.push(performance.now()-before);requests+=2;
|
|
26
|
-
}
|
|
27
|
-
await writeFile(join(project,'urlcode.yaml'),'invalid: configuration');assert.equal(await app.reload(),false);assert.equal((await get('/go')).location,'https://example.com/v1');
|
|
28
|
-
await writeFile(join(project,'urlcode.yaml'),config.replace('/v1','/v2'));assert.equal(await app.reload(),true);assert.equal((await get('/go')).location,'https://example.com/v2');
|
|
29
|
-
await writeFile(join(project,'urlcode.yaml'),config);assert.equal(await app.reload(),true);assert.equal((await get('/go')).location,'https://example.com/v1');
|
|
30
|
-
await app.close();app=undefined;
|
|
31
|
-
samples.sort((a,b)=>a-b);
|
|
32
|
-
console.log(JSON.stringify({event:'local-operational-proof',seconds,requests,batchP99Ms:samples[Math.floor(samples.length*.99)],rssBytes:process.memoryUsage().rss,checks:['mixed HTTP load','invalid reload preserves last-good','configuration rollback'],deploymentProof:false}));
|
|
33
|
-
} finally {await app?.close();await rm(directory,{recursive:true,force:true});}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# yaml-language-server: $schema=https://raw.githubusercontent.com/jimhoyd-com/urlcode/669632fb4f188f293a0f622847f87ee019c0627f/schemas/urlcode.schema.json
|
|
2
|
-
# File locations do not change route paths. GET/HEAD are the default methods.
|
|
3
|
-
version: "1"
|
|
4
|
-
routes:
|
|
5
|
-
# Your code runs when this URL is requested.
|
|
6
|
-
/hello/{name}:
|
|
7
|
-
parameters:
|
|
8
|
-
- name: name
|
|
9
|
-
in: path
|
|
10
|
-
required: true
|
|
11
|
-
schema: {type: string, minLength: 1, maxLength: 80}
|
|
12
|
-
middleware:
|
|
13
|
-
- source: middleware/headers.mjs
|
|
14
|
-
function:
|
|
15
|
-
source: functions/hello.mjs
|
|
16
|
-
args:
|
|
17
|
-
name: {from: path, name: name}
|
|
18
|
-
response:
|
|
19
|
-
headers:
|
|
20
|
-
X-Powered-By: URLCode
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# yaml-language-server: $schema=https://raw.githubusercontent.com/jimhoyd-com/urlcode/669632fb4f188f293a0f622847f87ee019c0627f/schemas/urlcode.schema.json
|
|
2
|
-
version: "1"
|
|
3
|
-
routes:
|
|
4
|
-
# A regular redirect needs no custom code.
|
|
5
|
-
/go:
|
|
6
|
-
redirect:
|
|
7
|
-
url: https://example.com
|
package/starters/page/README.md
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Your URLCode page
|
|
2
|
-
|
|
3
|
-
The smallest project: one route that serves `public/index.html`.
|
|
4
|
-
Created with `urlcode init <dir> --template page`.
|
|
5
|
-
|
|
6
|
-
```sh
|
|
7
|
-
urlcode validate --local
|
|
8
|
-
urlcode test
|
|
9
|
-
urlcode dev # http://127.0.0.1:3000/
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
Edit `public/index.html`. Add more pages, a `static` directory, downloads,
|
|
13
|
-
redirects or functions as routes in `urlcode.yaml` (see docs/ASSETS.md in the
|
|
14
|
-
URLCode repository). Keep `tests/requests.json` in step with the routes.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>Hello, URLCode</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1>Hello, URLCode</h1>
|
|
10
|
-
<p>This page is served by a page route in urlcode.yaml.</p>
|
|
11
|
-
</body>
|
|
12
|
-
</html>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"path": "/",
|
|
4
|
-
"status": 200,
|
|
5
|
-
"expectBody": "<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>Hello, URLCode</title>\n</head>\n<body>\n<h1>Hello, URLCode</h1>\n<p>This page is served by a page route in urlcode.yaml.</p>\n</body>\n</html>\n"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"path": "/",
|
|
9
|
-
"method": "HEAD",
|
|
10
|
-
"status": 200,
|
|
11
|
-
"expectBody": ""
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"path": "/missing",
|
|
15
|
-
"status": 404
|
|
16
|
-
}
|
|
17
|
-
]
|