@sdxc/kit 2026.10.16 → 2026.10.17
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/README.md +1 -0
- package/changelog.jsonl +57 -0
- package/dist/author.d.ts +36 -0
- package/dist/author.js +107 -0
- package/dist/commands/create.js +9 -4
- package/dist/commands/run.d.ts +2 -2
- package/dist/commands/run.js +5 -3
- package/dist/contract.js +1 -1
- package/dist/create/templates.d.ts +8 -1
- package/dist/create/templates.js +25 -2
- package/dist/init.d.ts +5 -3
- package/dist/init.js +15 -7
- package/dist/make/declare.d.ts +4 -4
- package/dist/make/declare.js +124 -21
- package/dist/make/generate.js +8 -2
- package/dist/make/index.js +5 -1
- package/dist/make/kinds.d.ts +2 -1
- package/dist/make/kinds.js +3 -2
- package/dist/testing.d.ts +12 -2
- package/dist/testing.js +22 -3
- package/package.json +3 -3
- package/stubs/command.stub +4 -0
- package/stubs/command.test.stub +3 -0
- package/stubs/controller.api.stub +21 -0
- package/stubs/controller.api.test.stub +18 -0
- package/stubs/controller.form.stub +39 -9
- package/stubs/controller.form.test.stub +61 -0
- package/stubs/controller.stub +15 -8
- package/stubs/controller.test.stub +3 -0
- package/stubs/email.stub +12 -30
- package/stubs/email.test.stub +6 -1
- package/stubs/factory.stub +3 -0
- package/stubs/initializer.stub +2 -0
- package/stubs/initializer.test.stub +3 -0
- package/stubs/job.cron.stub +4 -0
- package/stubs/job.stub +4 -0
- package/stubs/job.test.stub +3 -0
- package/stubs/mcp.resource.stub +3 -0
- package/stubs/mcp.stub +3 -0
- package/stubs/mcp.test.stub +3 -0
- package/stubs/middleware.stub +6 -1
- package/stubs/middleware.test.stub +3 -0
- package/stubs/model.stub +10 -1
- package/stubs/model.test.stub +3 -0
- package/stubs/policy.stub +3 -0
- package/stubs/policy.test.stub +3 -0
- package/stubs/service.stub +4 -0
- package/stubs/service.test.stub +3 -0
- package/stubs/validator.stub +3 -0
- package/stubs/validator.test.stub +3 -0
- package/templates/app/.env.example +16 -0
- package/templates/app/README.md +62 -35
- package/templates/app/app/commands/about.test.ts +1 -1
- package/templates/app/app/commands/db/console.ts +6 -0
- package/templates/app/app/commands/db/migrate.test.ts +30 -0
- package/templates/app/app/commands/db/migrate.ts +55 -0
- package/templates/app/app/commands/index.ts +16 -0
- package/templates/app/app/commands/typegen.test.ts +17 -0
- package/templates/app/app/commands/typegen.ts +16 -0
- package/templates/app/app/http/controllers/api/health.tsx +15 -0
- package/templates/app/app/http/controllers/api/not-found.tsx +16 -0
- package/templates/app/app/http/controllers/api/openapi.tsx +17 -0
- package/templates/app/app/http/controllers/home.tsx +21 -13
- package/templates/app/app/http/controllers/mcp.tsx +16 -0
- package/templates/app/app/http/controllers/not-found.tsx +23 -18
- package/templates/app/app/http/controllers/robots.test.ts +18 -0
- package/templates/app/app/http/controllers/robots.ts +24 -0
- package/templates/app/app/http/controllers/sitemap.test.ts +28 -0
- package/templates/app/app/http/controllers/sitemap.ts +25 -0
- package/templates/app/app/http/middleware/api.ts +10 -0
- package/templates/app/app/http/middleware/page.test.ts +40 -0
- package/templates/app/app/http/middleware/page.ts +49 -0
- package/templates/app/app/http/middleware/server-timing.test.ts +15 -0
- package/templates/app/app/http/middleware/server-timing.ts +42 -0
- package/templates/app/app/initializers/assets.ts +1 -1
- package/templates/app/app/initializers/captcha.ts +11 -0
- package/templates/app/app/initializers/cli.ts +42 -2
- package/templates/app/app/initializers/database.test.ts +18 -0
- package/templates/app/app/initializers/database.ts +18 -0
- package/templates/app/app/initializers/dispatcher.ts +18 -0
- package/templates/app/app/initializers/honeypot.ts +11 -0
- package/templates/app/app/initializers/i18n.test.ts +16 -0
- package/templates/app/app/initializers/i18n.ts +28 -0
- package/templates/app/app/initializers/local-database.test.ts +33 -0
- package/templates/app/app/initializers/local-database.ts +53 -0
- package/templates/app/app/initializers/mail.test.ts +27 -0
- package/templates/app/app/initializers/mail.ts +11 -0
- package/templates/app/app/initializers/mcp.ts +1 -1
- package/templates/app/app/initializers/openapi.ts +21 -0
- package/templates/app/app/initializers/router.test.ts +61 -0
- package/templates/app/app/initializers/router.tsx +72 -26
- package/templates/app/app/initializers/seo.ts +15 -0
- package/templates/app/app/initializers/session.test.ts +34 -0
- package/templates/app/app/initializers/session.ts +29 -0
- package/templates/app/app/initializers/spam.ts +10 -0
- package/templates/app/app/models/index.ts +10 -0
- package/templates/app/app/services/migrations.test.ts +45 -0
- package/templates/app/app/services/migrations.ts +60 -0
- package/templates/app/app/test/cloudflare-workers.ts +25 -0
- package/templates/app/bootstrap/cli.ts +1 -1
- package/templates/app/bootstrap/worker.ts +4 -4
- package/templates/app/cloudflare.config.ts +29 -1
- package/templates/app/config/constants.ts +19 -0
- package/templates/app/config/problems.ts +24 -0
- package/templates/app/config/security-policy.ts +34 -0
- package/templates/app/config/security-txt.ts +28 -0
- package/templates/app/database/migrations/.gitkeep +0 -0
- package/templates/app/package.json +35 -5
- package/templates/app/resources/layouts/document.tsx +28 -7
- package/templates/app/resources/locales/en.json +10 -0
- package/templates/app/routes/api.ts +29 -0
- package/templates/app/routes/web.ts +6 -4
- package/templates/app/vite.config.ts +4 -0
- package/templates/app/config/router-context.d.ts +0 -20
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ The package installs a command named `sdxc`. It works on projects that depend on
|
|
|
15
15
|
```sh
|
|
16
16
|
sdxc create my-app # a Remix v3 app, or --template org/repo from GitHub
|
|
17
17
|
sdxc make controller posts/show # a file where the app layout puts it, with its test
|
|
18
|
+
sdxc make controller api/keys --routes api # a JSON endpoint in the API contract
|
|
18
19
|
sdxc ui add dialog # copy a component into the project to edit it
|
|
19
20
|
sdxc upgrade # move to the latest release and print a prompt for the code
|
|
20
21
|
sdxc run users find ada@example.com # run the app's own command line, bootstrap/cli.ts
|
package/changelog.jsonl
CHANGED
|
@@ -486,8 +486,10 @@
|
|
|
486
486
|
{"release":"2026.10.2","package":"@sdxc/epub","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
487
487
|
{"release":"2026.10.2","package":"@sdxc/expression","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
488
488
|
{"release":"2026.10.2","package":"@sdxc/feed","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
489
|
+
{"release":"2026.10.2","package":"@sdxc/file-storage-r2","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
489
490
|
{"release":"2026.10.2","package":"@sdxc/flags","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
490
491
|
{"release":"2026.10.2","package":"@sdxc/flags-engine","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
492
|
+
{"release":"2026.10.2","package":"@sdxc/font","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
491
493
|
{"release":"2026.10.2","package":"@sdxc/get-client-ip","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
492
494
|
{"release":"2026.10.2","package":"@sdxc/highlight","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
493
495
|
{"release":"2026.10.2","package":"@sdxc/honeypot","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
@@ -532,9 +534,11 @@
|
|
|
532
534
|
{"release":"2026.10.2","package":"@sdxc/pagination","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
533
535
|
{"release":"2026.10.2","package":"@sdxc/passkey","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
534
536
|
{"release":"2026.10.2","package":"@sdxc/password-policy","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
537
|
+
{"release":"2026.10.2","package":"@sdxc/png","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
535
538
|
{"release":"2026.10.2","package":"@sdxc/problem","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
536
539
|
{"release":"2026.10.2","package":"@sdxc/qr","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
537
540
|
{"release":"2026.10.2","package":"@sdxc/random","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
541
|
+
{"release":"2026.10.2","package":"@sdxc/raster","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
538
542
|
{"release":"2026.10.2","package":"@sdxc/rate-limit","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
539
543
|
{"release":"2026.10.2","package":"@sdxc/rdap","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
540
544
|
{"release":"2026.10.2","package":"@sdxc/response","type":"chore","breaking":false,"title":"update Remix to 3.0.0","body":"Remix 3 is stable. Every workspace now pins `remix@3.0.0`, and\n`@remix-run/data-schema` moves to `^1.0.0`.\n\nThe component runtime moved from `remix/ui` to `remix/component`, along with\nits subpaths (`remix/component/server`, `remix/component/test`, the JSX\nruntimes), so every import and every `jsxImportSource` now points there.\n\nThe headless primitives (`anchor`, `combobox`, `listbox`, `tabs`) are no\nlonger part of `remix`. They ship in the standalone `@remix-run/ui` package,\npinned at 0.12.1, which `@sdxc/ui` and the sdxc app now depend on directly."}
|
|
@@ -1038,3 +1042,56 @@
|
|
|
1038
1042
|
{"release":"2026.10.16","package":"@sdxc/user-agent","type":"chore","breaking":false,"title":"make remix a peer dependency of every package that imports it","body":"Every @sdxc package whose code imports `remix/*` now lists `remix` under\n`peerDependencies` (pinned to the same exact version as before) instead of\n`dependencies`, so your app's own `remix` is the only copy installed.\n\nBefore, a version mismatch between your app's `remix` and a package's pin\ninstalled a second nested copy, and Remix context keys and `instanceof` checks\nsilently stopped matching between the app and the package. Now the mismatch\nfails at install with a peer conflict.\n\nAction for consumers: list `remix` in your own `package.json` at the version\nthe @sdxc packages pin (currently `3.0.0`); npm 7+, Bun and pnpm install a\nmissing required peer automatically."}
|
|
1039
1043
|
{"release":"2026.10.16","package":"@sdxc/web-push","type":"chore","breaking":false,"title":"make remix a peer dependency of every package that imports it","body":"Every @sdxc package whose code imports `remix/*` now lists `remix` under\n`peerDependencies` (pinned to the same exact version as before) instead of\n`dependencies`, so your app's own `remix` is the only copy installed.\n\nBefore, a version mismatch between your app's `remix` and a package's pin\ninstalled a second nested copy, and Remix context keys and `instanceof` checks\nsilently stopped matching between the app and the package. Now the mismatch\nfails at install with a peer conflict.\n\nAction for consumers: list `remix` in your own `package.json` at the version\nthe @sdxc packages pin (currently `3.0.0`); npm 7+, Bun and pnpm install a\nmissing required peer automatically."}
|
|
1040
1044
|
{"release":"2026.10.16","package":"@sdxc/workers-cache","type":"chore","breaking":false,"title":"make remix a peer dependency of every package that imports it","body":"Every @sdxc package whose code imports `remix/*` now lists `remix` under\n`peerDependencies` (pinned to the same exact version as before) instead of\n`dependencies`, so your app's own `remix` is the only copy installed.\n\nBefore, a version mismatch between your app's `remix` and a package's pin\ninstalled a second nested copy, and Remix context keys and `instanceof` checks\nsilently stopped matching between the app and the package. Now the mismatch\nfails at install with a peer conflict.\n\nAction for consumers: list `remix` in your own `package.json` at the version\nthe @sdxc packages pin (currently `3.0.0`); npm 7+, Bun and pnpm install a\nmissing required peer automatically."}
|
|
1045
|
+
{"release":"2026.10.17","package":"@sdxc/codemod","type":"feat","breaking":false,"title":"add a property to an object passed after other arguments","body":"`addProperty` takes an `argument` option, the zero-based position of the object literal\namong the call's arguments, so it can edit calls that take their object after others:\n\n addProperty(\"sitemap.ts\", source, {\n \tcall: \"fromRoutes\",\n \targument: 2,\n \tpath: [\"admin\"],\n \tkey: \"users\",\n \tvalue: \"{ index: true }\",\n });\n\nIt defaults to `0`, so existing calls behave as before. The first call to `options.call`\nwith an object literal at that position is edited, and when none has one the result is a\n`not-found` failure."}
|
|
1046
|
+
{"release":"2026.10.17","package":"@sdxc/codemod","type":"test","breaking":false,"title":"add the fixture for an object passed after other arguments","body":"No consumer effect: this adds the input and expected output the `argument` option's test reads."}
|
|
1047
|
+
{"release":"2026.10.17","package":"@sdxc/data-model","type":"feat","breaking":false,"title":"generate a model's primary key with `generateId`","body":"`createModel` takes a `generateId` option that creates the primary key of a row `create` or\n`upsert` inserts without one. `create` then types the key as optional, so the model no longer\nneeds `optional: [\"id\"]` plus a `beforeCreate` callback to fill it:\n\n```ts\nimport { createModel } from \"@sdxc/data-model\";\nimport { generateUUID } from \"@sdxc/uuid/v7\";\n\nexport const Users = createModel(users, { generateId: generateUUID });\n\nawait Users.bind({ db }).create({ email, name }); // id filled with a UUIDv7\n```\n\nA key the caller passes is written as given. The generated key is filled before `validate`\nand `beforeCreate` run, so every callback sees it, and a sub-model from `extend()` inherits it.\nThe generator must return the key column's type, and a table with a composite primary key\nrefuses the option. Existing models keep working unchanged."}
|
|
1048
|
+
{"release":"2026.10.17","package":"@sdxc/file-storage-r2","type":"feat","breaking":false,"title":"store remix/file-storage files in a Cloudflare R2 bucket","body":"New package. `R2FileStorage` is a `FileStorage` from `remix/file-storage` over an R2 bucket binding, so code that reads and writes `File`s runs against R2 in a Worker and any other backend in a test.\n\n```ts\nimport { R2FileStorage } from \"@sdxc/file-storage-r2\";\n\nlet storage = new R2FileStorage(env.UPLOADS);\nawait storage.set(\"avatars/ada.png\", file);\nlet avatar = await storage.get(\"avatars/ada.png\"); // File | null\n```\n\n- A file reads back as a native `File` with the name, type and `lastModified` it was stored with: the name and modification time travel as the object's custom metadata, the type as its content type. An object written to the bucket some other way reads back named by its key and dated by its upload time.\n- `has` answers with a `HEAD`; `list` takes `prefix`, `cursor`, `limit` and `includeMetadata`, and returns a `cursor` while more objects remain; `put` resolves the file as read back; `remove` succeeds on a missing key.\n- The bucket parameter is the structural `R2FileBucket` type, which any `R2Bucket` satisfies, whether `wrangler types` or `@cloudflare/workers-types` typed it."}
|
|
1049
|
+
{"release":"2026.10.17","package":"@sdxc/font","type":"feat","breaking":false,"title":"read TrueType fonts for metrics, kerning, outlines and line layout","body":"New package @sdxc/font parses TrueType (.ttf, glyf-outline) fonts in plain JavaScript, with no WebAssembly, so a Worker can measure and draw text with real glyphs.\n\n`parseFont(bytes)` takes a Uint8Array or ArrayBuffer and answers a Result<Font, FontError>. A CFF (OTTO) font, a collection (ttcf) or a font without a Unicode cmap fails with code \"unsupported\"; a missing required table with \"missing-table\"; a corrupt header or table with \"malformed\", naming the table in `error.table`.\n\nA Font answers unitsPerEm, ascender, descender, lineGap (OS/2 typographic metrics when USE_TYPO_METRICS is set), family and subfamily; glyphIndex(codePoint) through cmap formats 4 and 12; advance(glyph); kerning(left, right) from the kern table or, when the font has none, GPOS pair positioning; outline(glyph) as move/line/quad/close commands in font units with composites resolved; path(glyph, size, x, y) in pixel space with y down; layout(text, size, { tracking, kerning }) and measure(text, size).\n\n import { parseFont } from \"@sdxc/font\";\n import { isFailure } from \"@sdxc/result\";"}
|
|
1050
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"fix","breaking":false,"title":"format what make and ui add write in a project from the app template","body":"Before, `sdxc create` wrote `.config/sdxc.jsonc` with `format` commented out, so the\ndeclarations and mappings `sdxc make` inserts into an initializer stayed exactly as written.\nA fresh app's first `bun run check` after `sdxc make controller posts/show` or\n`sdxc make mcp search-posts` then failed with format issues in\n`app/initializers/router.tsx` and `app/initializers/mcp.ts`.\n\nNow a project created from a built-in template ships with the formatter enabled:\n\n \"format\": [\"bunx\", \"vp\", \"fmt\"],\n\nso every file `sdxc make` and `sdxc ui add` write or edit is run through Vite+'s formatter\nand `bun run check` passes straight after them.\n\nProjects created before this release keep their configuration; uncomment the `format` line\nin `.config/sdxc.jsonc` to get the same behavior, and run `bunx vp fmt` once to format the\nfiles `make` already edited. `sdxc init` and remote templates are unchanged."}
|
|
1051
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":true,"title":"give the app template an API contract beside its pages, on one router","body":"`sdxc create` now writes an app whose one router serves two route contracts:\n\n routes/web.ts pages: home, and a 404 page for any other path\n routes/api.ts GET /api/health, GET /api/openapi.json, POST /mcp,\n and a problem+json 404 for any other /api path\n app/http/middleware/page.ts formData(), cop(), assets(...), render(...)\n app/http/middleware/api.ts cors()\n app/http/controllers/api/*.tsx the API's controllers\n app/http/controllers/mcp.tsx the MCP endpoint, now a controller\n app/initializers/openapi.ts the OpenAPI document, from the operations in routes/api.ts\n\nThe router's own middleware is what every route uses: asyncContext(), the logger, and a rate\nlimit of 100 requests a minute per client address on a new `RATE_LIMITER` binding (answering\n429 as a problem document). Each controller declares its contract's chain, so an API request\nskips the form parser, the cross-origin check and the asset lookups. The template now\ndepends on @sdxc/openapi, @sdxc/json-schema, @sdxc/problem, @sdxc/rate-limit and\n@sdxc/get-client-ip.\n\n`sdxc make controller` follows the contract. `--routes api` writes a JSON endpoint from the\nnew `controller.api.stub` (with `controller.api.test.stub`) and maps it on the router:\n\n sdxc make controller api/keys --routes api\n # routes/api.ts: api: { keys: get(\"/api/keys\") }\n # app/http/controllers/api/keys.tsx:\n export default createAction(routes.api.keys, {\n \tmiddleware: api,\n \thandler: () => Response.json({}),\n });\n\nA controller is now mapped on the initializer that imports its contract and calls\n`createRouter`, so another initializer importing the contract no longer captures it.\n\nBREAKING: page controllers written by `sdxc make controller` (and `--method form`) declare\nthe page chain instead of relying on the router's. In a project made from an earlier template:\n\n1. Move the page middleware out of the router into `app/http/middleware/page.ts`:\n\n // before, app/initializers/router.tsx\n middleware: [asyncContext(), log(logger), formData(), cop(), assets(...), render(...)],\n // after, app/initializers/router.tsx\n middleware: [asyncContext(), log(logger)],\n // after, app/http/middleware/page.ts\n export default createMiddleware(formData(), cop(), assets(...), render(...));\n\n2. Declare it in each page controller:\n\n // before\n export default createAction(routes.home, (ctx) => ctx.render(...));\n // after\n export default createAction(routes.home, { middleware: page, handler: (ctx) => ctx.render(...) });\n\nOr keep the old controller shape by copying the previous `controller.stub` into\n`.config/sdxc/stubs/` (`sdxc make stubs controller` writes the current ones to edit)."}
|
|
1052
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"fix","breaking":false,"title":"make a new app pass its own `bun run check`","body":"Before, an app made with `sdxc create` failed `bun run check` straight after\n`bun install` with two type errors in `vite.config.ts`: TS2321 \"Excessive\nstack depth comparing types ... and 'UserConfig'\" at `defineConfig`, and\nTS2769 \"No overload matches this call\" at the `remix()` plugin. The app\ninstalled Vite itself while `vite-plus` checks against its own Vite core, so\nthe plugins were typed against one Vite and the config against another.\n\nNow the template installs `vite` as the core Vite+ ships, and pins every\ntransitive copy to it:\n\n \"devDependencies\": {\n \"vite\": \"npm:@voidzero-dev/vite-plus-core@0.3.3\",\n \"vite-plus\": \"0.3.3\"\n },\n \"overrides\": {\n \"vite\": \"npm:@voidzero-dev/vite-plus-core@0.3.3\"\n }\n\nThe `dev`, `build` and `start` scripts run `vp dev`, `vp build` and\n`vp preview`, since that package has no `vite` binary.\n\nAn existing app made from an earlier template fixes the same errors by making\nthose changes to its `package.json` (with the `vite-plus` version it already\npins) and running `bun install` again."}
|
|
1053
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"give the app template a problem catalog for its API errors","body":"A new app from `sdxc create` declares every problem its API answers with in one catalog,\n`config/problems.ts`, whose base URL comes from `config/constants.ts`:\n\n // config/constants.ts\n export const PROBLEMS_URL = \"https://example.com/problems/\";\n\n // config/problems.ts\n export default defineProblems(PROBLEMS_URL, {\n \tnotFound: { slug: \"not-found\", status: 404, title: \"The resource does not exist\" },\n \ttooManyRequests: { slug: \"too-many-requests\", status: 429, title: \"…\" },\n \tvalidationError: { slug: \"validation-error\", status: 422, title: \"…\", extensions: … },\n });\n\nCode imports it as `problems`. The API's 404 answers `problems.notFound()`, the rate limit\nanswers `problems.tooManyRequests()`, and the OpenAPI document publishes each entry as a\nschema and response, so an operation can list `problems: [\"validationError\"]`. Each problem's\n`type` is now `PROBLEMS_URL` plus its slug, where it was `about:blank`; set `PROBLEMS_URL` to\nthe page that documents them. `controller.api.stub` points new endpoints at the catalog.\n\nProjects created earlier are unaffected; to adopt it, add the two files and replace each\n`problem({ status })` call with the matching `problems.<name>()`."}
|
|
1054
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"send a Content-Security-Policy with the app template's pages","body":"A project from `sdxc create` now sends a Content-Security-Policy and the related security\nheaders (X-Frame-Options, Referrer-Policy, Cross-Origin-Opener-Policy, Permissions-Policy,\nX-Content-Type-Options, and Strict-Transport-Security over HTTPS) with every page. API and MCP\nresponses are unchanged and carry none of them.\n\nThe policy lives in `config/security-policy.ts` as an `@sdxc/security-headers` policy:\n\n export const SECURITY_POLICY: SecurityHeaders.Policy = {\n contentSecurityPolicy: {\n defaultSrc: [\"self\"],\n scriptSrc: [\"self\", \"nonce\"],\n styleSrc: [\"self\", \"unsafe-inline\"],\n imgSrc: [\"self\", \"data:\"],\n fontSrc: [\"self\"],\n connectSrc: [\"self\"],\n formAction: [\"self\"],\n frameAncestors: [\"none\"],\n baseUri: [\"none\"],\n objectSrc: [\"none\"],\n },\n strictTransportSecurity: { maxAge: 31_536_000 },\n referrerPolicy: \"strict-origin-when-cross-origin\",\n crossOriginOpenerPolicy: \"same-origin\",\n permissionsPolicy: { camera: [], microphone: [], geolocation: [], payment: [], usb: [] },\n };\n\nInline `css()` styles and Vite's dev client, HMR included, work under it, and the document's\ninline import map is admitted by the response's nonce. Add an origin to the policy before a\npage loads a script, style, image or font from it.\n\nAn existing project gets the same policy in four steps:\n\n1. Run `bun add @sdxc/security-headers` and save the policy above as\n `config/security-policy.ts`.\n\n2. In `app/http/middleware/page.ts`, add `securityHeaders` before `assets()` and hand its nonce\n to `assets()`.\n\n Before:\n\n export default createMiddleware(\n formData(),\n cop(),\n assets(assetResolver, {\n stylesheets: \"resources/layouts/document.tsx\",\n script: \"bootstrap/browser.ts\",\n }),\n render({ assets: assetResolver }),\n );\n\n After:\n\n import { securityHeaders } from \"@sdxc/security-headers/middleware\";\n import { SECURITY_POLICY } from \"~/config/security-policy\";\n\n export default createMiddleware(\n formData(),\n cop(),\n securityHeaders(SECURITY_POLICY),\n assets(assetResolver, {\n stylesheets: \"resources/layouts/document.tsx\",\n script: \"bootstrap/browser.ts\",\n nonce: (ctx) => ctx.securityHeaders.nonce,\n }),\n render({ assets: assetResolver }),\n );\n\n3. In `resources/layouts/document.tsx`, put the nonce on the import map.\n\n Before: `<ImportMap value={script.importMap} />`\n After: `<ImportMap value={script.importMap} nonce={assets.nonce} />`\n\n Without this, a page that hydrates an island has its import map blocked.\n\n4. Leave `app/http/middleware/api.ts` as it is, so JSON and MCP responses stay without a CSP."}
|
|
1055
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"refuse page form posts without valid honeypot fields","body":"A project from `sdxc create` now verifies `@sdxc/honeypot` fields on every page POST. The page\nmiddleware answers a submission that is missing the fields, filled the hidden trap, or carries a\nforged token with a plain-text 400 before the controller runs. API and MCP routes are not\naffected.\n\n`sdxc make controller <name> --method form` renders the fields and writes a test that submits\nthe form without them and with the trap filled:\n\n async index(ctx) {\n let fields = unwrap(await ctx.honeypot.issue());\n return ctx.render(\n <form method=\"post\" action={routes.contact.action.href()}>\n <HoneypotFields {...fields} />\n <button type=\"submit\">Send</button>\n </form>,\n );\n }\n\nThe fields are signed with a new `HONEYPOT_SECRET` secret. New projects get a development value\nin `.env.example`, and `sdxc create` copies that file to `.dev.vars`, so `bun dev` works right\naway. Before deploying, set a long random value with `cf workers secrets update HONEYPOT_SECRET`.\n`cf deploy` fails until you do.\n\nThe template's tests now resolve `cloudflare:workers` to `app/test/cloudflare-workers.ts`, so a\nmodule that reads `env` when it is imported loads under Vitest.\n\nTo add this to an existing project:\n\n1. Run `bun add @sdxc/honeypot`.\n\n2. Declare the secret in `cloudflare.config.ts` and set it remotely before the next deploy:\n\n HONEYPOT_SECRET: bindings.secret(),\n\n For development, add `HONEYPOT_SECRET=<any value>` to `.dev.vars`.\n\n3. Create `app/initializers/honeypot.ts`:\n\n import { Honeypot } from \"@sdxc/honeypot\";\n import { env } from \"cloudflare:workers\";\n\n export const honeypot = new Honeypot({ secret: env.HONEYPOT_SECRET });\n\n4. In `app/http/middleware/page.ts`, add the middleware after `cop()`.\n\n Before: `formData(), cop(), securityHeaders(SECURITY_POLICY), …`\n After: `formData(), cop(), honeypot(trap), securityHeaders(SECURITY_POLICY), …`\n\n Import it as `import { honeypot } from \"@sdxc/honeypot/middleware\"` and\n `import { honeypot as trap } from \"~/app/initializers/honeypot\"`.\n\n5. Render `<HoneypotFields {...unwrap(await ctx.honeypot.issue())} />` (from\n `@sdxc/honeypot/ui`) inside every page form. Without it, every POST to a page answers 400.\n\n6. If your tests import a module that reads `env`, alias `cloudflare:workers` to a test module\n that exports `env` in the `test` section of `vite.config.ts`."}
|
|
1056
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"ask for Cloudflare Turnstile on generated forms","body":"`sdxc make controller <name> --method form` now renders a Cloudflare Turnstile widget from\n`@sdxc/captcha`, and declares `captcha(turnstile)` on the form's action. A submission with a\nmissing or invalid token is answered with a plain-text 403 before the handler runs. Only the\nPOST pays for the verification call, and API routes are not affected. The generated test now\nalso submits the form without a token.\n\n action: {\n middleware: [captcha(turnstile)],\n handler() {\n return new Response(null, { status: 303, headers: { location: … } });\n },\n },\n\nNew projects from `sdxc create` ship `app/initializers/captcha.ts`, and two secrets declared in\n`cloudflare.config.ts`: `TURNSTILE_SITE_KEY` and `TURNSTILE_SECRET_KEY`. `.env.example` carries\nCloudflare's test keys, which always pass, so `bun dev` works without an account. Before\ndeploying, create a Turnstile widget in the Cloudflare dashboard and set both keys with\n`cf workers secrets update`. `cf deploy` fails until you do.\n\nThe page Content-Security-Policy now admits `https://challenges.cloudflare.com` in `script-src`\nand `frame-src`, which the widget loads from. The widget's script carries the response's nonce.\n\nTo add this to an existing project:\n\n1. Run `bun add @sdxc/captcha`.\n\n2. Declare both secrets in `cloudflare.config.ts`, set them remotely, and add Cloudflare's test\n keys to `.dev.vars` for development:\n\n TURNSTILE_SITE_KEY: bindings.secret(),\n TURNSTILE_SECRET_KEY: bindings.secret(),\n\n TURNSTILE_SITE_KEY=1x00000000000000000000AA\n TURNSTILE_SECRET_KEY=1x0000000000000000000000000000000AA\n\n3. Create `app/initializers/captcha.ts`:\n\n import { Turnstile } from \"@sdxc/captcha/turnstile\";\n import { env } from \"cloudflare:workers\";\n\n export const turnstile = new Turnstile({ secretKey: env.TURNSTILE_SECRET_KEY });\n\n4. In `config/security-policy.ts`, add the Turnstile origin.\n\n Before: `scriptSrc: [\"self\", \"nonce\"]`\n After: `scriptSrc: [\"self\", \"nonce\", \"https://challenges.cloudflare.com\"]`\n Add: `frameSrc: [\"https://challenges.cloudflare.com\"]`\n\n5. In each form, render the widget, and guard its action.\n\n <TurnstileWidget siteKey={env.TURNSTILE_SITE_KEY} nonce={ctx.assets.nonce} />"}
|
|
1057
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"score generated form submissions with a spam filter","body":"`sdxc make controller <name> --method form` now renders a `message` field, and scores it with\n`@sdxc/spam` in the form's action before anything else runs. A `spam` verdict is answered with\na plain-text 422. A `ham` or `unsure` verdict reaches the redirect, where you decide what to do\nwith it. The score takes in the honeypot's signed render time, so a form sent back within\nseconds of rendering counts against the submission.\n\n let message = ctx.formData.get(\"message\");\n let assessment = await spamFilter.check({\n content: typeof message === \"string\" ? message : \"\",\n renderedAt: isSuccess(honeypot) ? honeypot.data.renderedAt : undefined,\n author: { userAgent: ctx.request.headers.get(\"User-Agent\") ?? undefined },\n });\n if (assessment.verdict === \"spam\") {\n return new Response(\"Message refused as spam\", { status: 422 });\n }\n\nNew projects from `sdxc create` ship `app/initializers/spam.ts`, a filter of the local rules\n(links, markup, timing), which needs no account, secret or network call. Add a reputation check\nfrom `@sdxc/spam`, such as `akismet()` or `stopForumSpam()`, to its `checks` when a form needs\none.\n\nTo add this to an existing project:\n\n1. Run `bun add @sdxc/spam`.\n\n2. Create `app/initializers/spam.ts`:\n\n import { createSpamFilter, DEFAULT_RULES } from \"@sdxc/spam\";\n\n export const spamFilter = createSpamFilter({ checks: DEFAULT_RULES });\n\n3. In each form's action, check the fields a visitor writes in, as above, and refuse a `spam`\n verdict."}
|
|
1058
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"give the app template a D1 database published as ctx.db","body":"A project from `sdxc create` now has a database. `app/initializers/database.ts` opens\n`remix/data-table` over a `DB` D1 binding, and the router and the job dispatcher publish it as\n`ctx.db`, so the models and migrations `sdxc make model` and `sdxc make migration` write have a\ndatabase to run against. `bun db:local:migrate` and `bun db:remote:migrate` apply\n`database/migrations/`. Under Vitest, `DB` and `RATE_LIMITER` are in-memory stand-ins from\n`@sdxc/cloudflare-mocks`, and the page and form tests fetch through `createWebRouter()`, so\nthey run every middleware the Worker runs.\n\nBefore the first deploy, run `bunx cf d1 create <name>` and put the id it prints in\n`cloudflare.config.ts` and in both `db:*:migrate` scripts.\n\nAn existing project gets the same setup in five steps:\n\n1. Run `bun add @sdxc/data-table-d1 @sdxc/database-middleware` and\n `bun add -d @sdxc/cloudflare-mocks`.\n\n2. Save `app/initializers/database.ts`:\n\n import { createD1DatabaseAdapter } from \"@sdxc/data-table-d1\";\n import { env } from \"cloudflare:workers\";\n import { Database } from \"remix/data-table\";\n\n export function openDatabase(): Database {\n return new Database(createD1DatabaseAdapter(env.DB), { now: () => Date.now() });\n }\n\n3. In `cloudflare.config.ts`, declare the binding, and add the scripts to `package.json`:\n\n DB: bindings.d1({ name: manifest.name, id: \"<id from cf d1 create>\" }),\n\n \"db:local:migrate\": \"cf d1 migrations apply <id> --dir ./database/migrations --local --persist-to ./.cloudflare/state\",\n \"db:remote:migrate\": \"cf d1 migrations apply <id> --dir ./database/migrations\"\n\n4. Publish it. In `app/initializers/router.tsx`, add `database(openDatabase())` (from\n `@sdxc/database-middleware`) to the end of `createRouter({ middleware: [...] })`. In\n `app/initializers/dispatcher.ts`, pass `middleware: [database(openDatabase)] as const` (from\n `@sdxc/database-middleware/jobs`) and type the handlers with it:\n\n declare module \"@sdxc/jobs\" {\n interface JobTypes {\n context: JobDispatcherContext<typeof dispatcher>;\n }\n }\n\n5. In `app/test/cloudflare-workers.ts`, add `DB: createD1Database()` and\n `RATE_LIMITER: createRateLimit()` from `@sdxc/cloudflare-mocks` to `env`. A test that builds\n its own router with `createRouter({ middleware: [log(logger)] })` no longer type checks\n against a controller once `ctx.db` is in the chain; fetch through `createWebRouter()` instead:"}
|
|
1059
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"trace every request and command in the app template","body":"A project from `sdxc create` now continues the caller's W3C `traceparent` on every request, or\nstarts a trace, through `@sdxc/trace-context`. Its log record carries `trace_id`, `span_id`,\n`trace_flags` and `parent_span_id`, and every job the request enqueues runs under the same\ntrace, so one query by `trace_id` finds a request and the jobs it started. Commands run with\n`bun run cli` do the same from the `TRACEPARENT` environment variable.\n\nAn existing project gets the same in three steps:\n\n1. Run `bun add @sdxc/trace-context`.\n\n2. In `app/initializers/router.tsx`, add `trace()` right after `log(logger)`:\n\n import { trace } from \"@sdxc/trace-context/middleware\";\n\n createRouter({ middleware: [asyncContext(), log(logger), trace(), ...] });\n\n3. In `app/initializers/cli.ts`, do the same on the command line:\n\n import { trace } from \"@sdxc/trace-context/middleware/cli\";\n\n middleware: [log(COMMAND_LOGGER), trace()],\n\nJobs need no change: `@sdxc/jobs` carries the trace in every message it enqueues."}
|
|
1060
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"give the app template's pages a KV-backed session","body":"A project from `sdxc create` now loads the visitor's session on every page as `ctx.session`:\na signed, httpOnly `__session` cookie naming a record in the `SESSIONS` KV store, kept for 30\ndays after its last change. The page middleware saves it after the controller runs, and only\nsends a cookie when the session changed.\n\n handler(ctx) {\n ctx.session.flash(\"notice\", \"Saved\");\n return redirect(routes.home.href());\n }\n\nBefore the first deploy, run `bunx cf kv namespace create <name>`, put the id it prints in the\n`SESSIONS` binding, and set `SESSION_SECRET` with `cf workers secrets update SESSION_SECRET`.\n\nAn existing project gets the same in four steps:\n\n1. Run `bun add @sdxc/session-storage-kv`.\n\n2. Save `app/initializers/session.ts`:\n\n import { KVSessionStorage } from \"@sdxc/session-storage-kv\";\n import { env } from \"cloudflare:workers\";\n import { createCookie } from \"remix/cookie\";\n\n const SESSION_TTL_SECONDS = 60 * 60 * 24 * 30;\n\n export const sessionCookie = createCookie(\"__session\", {\n path: \"/\",\n httpOnly: true,\n sameSite: \"Lax\",\n maxAge: SESSION_TTL_SECONDS,\n secrets: [env.SESSION_SECRET],\n });\n\n export const sessionStorage = new KVSessionStorage(env.SESSIONS, {\n ttlSeconds: SESSION_TTL_SECONDS,\n });\n\n3. In `cloudflare.config.ts`, declare `SESSIONS: bindings.kv({ id: \"<id>\" })` and\n `SESSION_SECRET: bindings.secret()`, and add `SESSION_SECRET=...` to `.env.example` and\n `.dev.vars`.\n\n4. In `app/http/middleware/page.ts`, add the session right after `cop()`:\n\n import { session } from \"remix/middleware/session\";\n import { sessionCookie, sessionStorage } from \"~/app/initializers/session\";\n\n cop(),\n session(sessionCookie, sessionStorage),"}
|
|
1061
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":true,"title":"translate the app template's pages through @sdxc/i18n","body":"A project from `sdxc create` now renders its pages from MessageFormat 2 bundles in\n`resources/locales/`. The page middleware picks the visitor's language from `?lng=`, the\nsession's `lng` value and `Accept-Language`, publishes `ctx.locale` and `ctx.intl`, and falls\nback to English. `app/initializers/i18n.ts` lists the languages and exports `translate`, so a\njob or an email reads the same copy:\n\n ctx.intl.t(\"home.title\"); // in a page\n translate(user.language).t(\"home.title\"); // in a job or an email\n\n`DocumentLayout` now takes the request's translator, sets `<html lang>` from it, and wraps the\npage in `IntlProvider`, so a component reads it with `intl(handle)` from `@sdxc/i18n/ui`. Pages\n`sdxc make controller` writes pass it.\n\nBreaking for an existing project: `DocumentLayout` requires `intl`. To migrate:\n\n1. Run `bun add @sdxc/i18n`, save your copy as `resources/locales/en.json`, and save\n `app/initializers/i18n.ts`:\n\n import { createTranslator } from \"@sdxc/i18n\";\n import en from \"~/resources/locales/en.json\";\n\n export const SUPPORTED_LANGUAGES = [\"en\"];\n export const FALLBACK_LANGUAGE = \"en\";\n export const RESOURCES = { en };\n export const translate = createTranslator({\n resources: RESOURCES,\n supportedLanguages: SUPPORTED_LANGUAGES,\n fallbackLanguage: FALLBACK_LANGUAGE,\n });\n\n2. In `app/http/middleware/page.ts`, add the middleware right after the session:\n\n import i18n from \"@sdxc/i18n/middleware\";\n\n session(sessionCookie, sessionStorage),\n i18n({\n detection: {\n supportedLanguages: SUPPORTED_LANGUAGES,\n fallbackLanguage: FALLBACK_LANGUAGE,\n sessionKey: \"lng\",\n },\n resources: RESOURCES,\n }),\n\n3. In `resources/layouts/document.tsx`, add an `intl: I18n` prop, render\n `<html lang={intl.locale}>`, and wrap the children in `<IntlProvider intl={intl}>` from\n `@sdxc/i18n/ui`.\n\n4. Pass it from every page."}
|
|
1062
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"send the app template's email through Cloudflare's send_email binding","body":"A project from `sdxc create` now has a mailer on every request. The router publishes\n`ctx.email`, an `@sdxc/mail` mailer over the `EMAIL` `send_email` binding, from the\n`MAIL_FROM` address in `config/constants.ts`, so the emails `sdxc make email` writes have\nsomewhere to go:\n\n ctx.email.later(new WelcomeEmail(user.email, copy)); // sent after the response\n await ctx.email.send(new WelcomeEmail(user.email, copy)); // when the response depends on it\n\nA job builds a mailer over the same transport and awaits `send()`:\n\n import { Mailer } from \"@sdxc/mail\";\n import { transport } from \"~/app/initializers/mail\";\n import { MAIL_FROM } from \"~/config/constants\";\n\n await new Mailer({ transport, from: MAIL_FROM }).send(email);\n\n`bun dev` simulates the binding. Cloudflare delivers only from a domain with Email Routing\nenabled, so set `MAIL_FROM` to an address on yours before deploying.\n\nAn existing project gets the same in four steps:\n\n1. Run `bun add @sdxc/mail`, and add\n `export const MAIL_FROM = { email: \"no-reply@your-domain.com\", name: \"App\" };` to\n `config/constants.ts`.\n\n2. Save `app/initializers/mail.ts`:\n\n import { CloudflareTransport } from \"@sdxc/mail/cloudflare\";\n import { env } from \"cloudflare:workers\";\n\n export const transport = new CloudflareTransport(env.EMAIL);\n\n3. In `cloudflare.config.ts`, declare `EMAIL: bindings.sendEmail()`.\n\n4. In `app/initializers/router.tsx`, add the mailer to the end of the router's middleware:\n\n import mail from \"@sdxc/mail/middleware\";\n\n mail({ transport, from: MAIL_FROM }),"}
|
|
1063
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":true,"title":"publish SEO tags, robots.txt, a sitemap and security.txt from the app template","body":"A project from `sdxc create` now publishes what search engines and security researchers look\nfor:\n\n- Every page's head carries its title, description, canonical link and Open Graph tags through\n `@sdxc/seo`, resolved on `SITE_URL` from `config/constants.ts` whichever host served it.\n- `/robots.txt` lets every crawler in and names `/sitemap.xml`, which lists the home page.\n- `/.well-known/security.txt` (RFC 9116) names a security contact, from\n `config/security-txt.ts`; a test fails a month before its `expires` date so it is reviewed.\n- A path ending in `/` redirects with a 308 to the same path without it, the form canonical\n links use.\n\nSet `SITE_URL`, `SITE_NAME` and `SITE_DESCRIPTION` in `config/constants.ts`, and the contact in\n`config/security-txt.ts`, before deploying.\n\nBreaking for an existing project: `DocumentLayout` requires the request's URL. To migrate:\n\n1. Run `bun add @sdxc/seo @sdxc/robots @sdxc/sitemap @sdxc/well-known @sdxc/http\n @sdxc/trailing-slash-middleware`, and add `SITE_URL`, `SITE_NAME` and `SITE_DESCRIPTION` to\n `config/constants.ts`.\n\n2. Save `app/initializers/seo.ts`:\n\n import { createSeo } from \"@sdxc/seo\";\n\n export const seo = createSeo({\n baseUrl: SITE_URL,\n siteName: SITE_NAME,\n defaultDescription: SITE_DESCRIPTION,\n });\n\n3. In `resources/layouts/document.tsx`, add `url: URL` and `description?: string` props and\n replace the `<title>` with the SEO tags:\n\n Before: `<title data-rmx-key=\"title\">{title}</title>`\n After: `<Seo.Meta title={title} description={description} canonical={seo.canonical(url)} site={seo.site} og={{ locale: intl.locale }} />`\n\n and pass the URL from every page:\n\n Before: `<DocumentLayout assets={ctx.assets} intl={ctx.intl} title=\"About\">`\n After: `<DocumentLayout assets={ctx.assets} intl={ctx.intl} url={ctx.url} title=\"About\">`\n\n4. Add `robots: get(\"/robots.txt\")` and `sitemap: get(\"/sitemap.xml\")` to `routes/web.ts`, with\n controllers answering `text(stringify({ groups, sitemaps, records: [] }))` from\n `@sdxc/robots` and `xml(sitemap.toString())` from `@sdxc/sitemap`, and map both before\n `notFound`.\n\n5. Save `config/security-txt.ts` exporting `securityTxtEntry = serve(securityTxt, () => SECURITY_TXT)`\n from `@sdxc/well-known`, and in `app/initializers/router.tsx` add, right after `trace()`:"}
|
|
1064
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"redirect the app template's www. host to the apex domain","body":"A project from `sdxc create` now answers a request to `www.` its domain with a 308 to the\nsame URL on the apex domain, through `@sdxc/no-www-middleware`, so every page has one URL and\nthe canonical links on `SITE_URL` match it.\n\nAn existing project gets the same with `bun add @sdxc/no-www-middleware` and `noWWW()` in\n`app/initializers/router.tsx`, right before `trailingSlash()`:\n\n import { noWWW } from \"@sdxc/no-www-middleware\";"}
|
|
1065
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"report each request's timings in a Server-Timing header","body":"A project from `sdxc create` now sends a `Server-Timing` header with every response, which\nbrowser devtools show in the network panel. The router publishes an `@sdxc/server-timing`\ncollector as `ctx.timing`; a handler measures its own work, and the whole request is\nreported as `app`:\n\n let posts = await ctx.timing.measure(\"db\", \"listPosts\", () => listPosts());\n // Server-Timing: db;desc=\"listPosts\";dur=8.77, app;dur=12.40\n\nAn existing project gets the same in two steps:\n\n1. Run `bun add @sdxc/server-timing` and save `app/http/middleware/server-timing.ts`, a\n middleware that creates a `TimingCollector`, publishes it with\n `ctx.set(Timing, timing, { property: \"timing\" })`, awaits\n `timing.measure(\"app\", \"\", () => next())`, and answers a copy of the response with\n `timing.toHeaders(new Headers(response.headers))`.\n\n2. Add `serverTiming()` to `app/initializers/router.tsx`, right after `trace()`."}
|
|
1066
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"give the app template's command line db commands, mail and translations","body":"A project from `sdxc create` now does its database work through its own command line:\n\n bun run cli db migrate # bun db:local:migrate\n bun run cli db migrate --remote # bun db:remote:migrate\n bun run cli db console # sql> prompt over the local database\n bun run cli db console --execute \"SELECT count(*) FROM posts\"\n\n`db migrate` applies every migration in `database/migrations/` the local database lacks,\ndirectly to the SQLite file `bun dev` serves from, and records it in the same `d1_migrations`\ntable `cf` and Wrangler use. It finishes as soon as it is done. With `--remote` it runs\n`cf d1 migrations apply` against production. Both read the database id from\n`cloudflare.config.ts`, so the id is written once.\n\nEvery command also gets the app's services on its context: the local database as `ctx.db`,\na mailer as `ctx.email` that prints each message to stderr instead of delivering it, and the\napp's translations as `ctx.intl` (in the language `LANG` names) and `ctx.translate(language)`.\n\nAn existing project gets the same in four steps:\n\n1. Run `bun add @sdxc/result`, and save `app/initializers/local-database.ts` (exporting\n `DATABASE_ID`, `PROJECT_ROOT`, `LOCAL_DATABASE_FILE` and `openLocalDatabase()`),\n `app/services/migrations.ts` (`applyMigrations(database, migrations)`),\n `app/commands/db/migrate.ts` and `app/commands/db/console.ts`\n (`export { dbHandler as default } from \"@sdxc/database-middleware/cli\";`) from a new\n project.\n\n2. In `app/commands/index.ts`, declare the group:\n\n db: commands({\n console: DB_COMMAND,\n migrate: command({ flags: { remote: flag.boolean(\"remote\") } }),\n }),\n\n3. In `app/initializers/cli.ts`, add the middleware after `trace()` and map both commands:\n\n database(openLocalDatabase),\n mail({\n transport: (ctx) => new PrintTransport({ write: (text) => ctx.stderr(text) }),\n from: MAIL_FROM,\n }),\n i18n({ resources: RESOURCES, supportedLanguages: SUPPORTED_LANGUAGES, fallbackLanguage: FALLBACK_LANGUAGE }),\n\n4. Point the scripts at it."}
|
|
1067
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"give models from `sdxc make model` a UUIDv7 id on create","body":"A model `sdxc make model` writes now fills in its row's `id` when `create` leaves it out, with\na time-ordered UUIDv7 from `@sdxc/uuid/v7`, so ids sort by creation and never repeat:\n\n let post = await Post.bind({ db: ctx.db }).create({ title: \"Hello\" });\n // post.data.id: \"01927f3c-…\"\n\n`make` adds `@sdxc/uuid` to `package.json` with the model. Models written before keep working;\nto give one the same behavior, add to its `createModel` options:"}
|
|
1068
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"run the app template's own commands through `sdxc run`","body":"A project from `sdxc create` now lists `@sdxc/kit` as a dev dependency, and its\n`db:local:migrate` and `db:remote:migrate` scripts run `sdxc run db migrate` and\n`sdxc run db migrate --remote`. `sdxc run` is how an app's own commands are run, from any folder\nin the project:\n\n sdxc run about\n sdxc run db migrate\n sdxc run db console --execute \"SELECT count(*) FROM posts\"\n\nWith the dev dependency, the scripts and `bunx sdxc` work without a global install.\n\nAn existing project gets the same with `bun add -d @sdxc/kit` and these scripts:\n\n Before: \"db:local:migrate\": \"bun run cli db migrate\"\n After: \"db:local:migrate\": \"sdxc run db migrate\""}
|
|
1069
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"fix","breaking":false,"title":"stamp created_at and updated_at on rows models and commands create","body":"Before, a model `sdxc make model` wrote left its table's `timestamps` unset, so `create` wrote\nno `created_at` or `updated_at`, and a migration declaring them `NOT NULL` refused every row\nwith a `ConstraintViolation`. The app's command line also opened its local database with\n`remix/data-table`'s default clock, whose `Date` SQLite cannot bind. Now the model's table\ndeclares `timestamps: true`, and the command line writes timestamps as epoch milliseconds, the\nway the Worker's database does, so a row created from a request, a job or a command carries\nboth columns.\n\nExisting projects must act:\n\n1. In every model `sdxc make model` wrote, add `timestamps: true` to its `table({ … })`:\n\n export const postTable = table({\n name: \"post\",\n columns: { id: c.text().primaryKey(), created_at: c.integer(), updated_at: c.integer() },\n timestamps: true,\n });\n\n2. In `app/initializers/local-database.ts`, pass the clock to the database:"}
|
|
1070
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"publish the app template's models as ctx.models, registered by `sdxc make model`","body":"A project from `sdxc create` now has a model registry, `app/models/index.ts`, and publishes it\nbound to the run's database as `ctx.models` on every request, job and command, through\n`@sdxc/data-model`'s middleware. `sdxc make model post` registers the new model there, imported\non first use, so it is reachable as soon as the command finishes:\n\n // app/models/index.ts, after `sdxc make model post`\n export default createModels({\n post: () => import(\"./post\"),\n });\n\n // a controller, a job or a command\n let created = await ctx.models.post.create({});\n\nA model `make` writes now default-exports itself, which the registry's import reads. In a\nproject without `app/models/index.ts`, `make model` prints the entry to add.\n\nAn existing project gets the same in three steps:\n\n1. Run `bun add @sdxc/data-model`, and save `app/models/index.ts`:\n\n import { createModels } from \"@sdxc/data-model\";\n\n export default createModels({});\n\n2. Publish it after the database in each chain:\n\n // app/initializers/router.tsx\n import { models } from \"@sdxc/data-model/router\";\n models(registry, (ctx) => ({ db: ctx.db })),\n\n // app/initializers/dispatcher.ts\n import { models } from \"@sdxc/data-model/jobs\";\n models(registry, (ctx) => ({ db: ctx.require(Database) })),\n\n // app/initializers/cli.ts\n import { models } from \"@sdxc/data-model/cli\";\n models(registry, (ctx) => ({ db: ctx.require(Database) })),\n\n3. Register each existing model, and add `export default <Model>;` to its module:"}
|
|
1071
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"docs","breaking":false,"title":"shorten the app template's README to a quick reference","body":"A project from `sdxc create` now starts with a README of about 80 lines instead of 150: how to\nstart, the everyday `sdxc make` and `sdxc run` commands, where each kind of code lives, what a\nhandler reads from `ctx`, and a numbered checklist for the first deploy. Nothing about the\nproject's behavior changed, and existing projects need no action."}
|
|
1072
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":true,"title":"drop the app template's db:*:migrate scripts for `sdxc run db migrate`","body":"A project from `sdxc create` no longer has `db:local:migrate` and `db:remote:migrate` package\nscripts. Migrations run through the app's own command line, the same way as every other\ncommand:\n\n sdxc run db migrate # the local database `bun dev` serves\n sdxc run db migrate --remote # production\n\nBreaking for an existing project only if something calls the scripts: replace\n`bun db:local:migrate` with `sdxc run db migrate`, and `bun db:remote:migrate` with\n`sdxc run db migrate --remote`, in your deploy scripts and CI, then delete both entries from\n`package.json`'s `scripts`."}
|
|
1073
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"put the project's node_modules/.bin on PATH for `sdxc run`","body":"`sdxc run` now starts the app's command line with the project's `node_modules/.bin` first on\n`PATH`, as a package script does. A command that runs a tool the project installs, such as\n`cf` or `vp`, finds the project's copy, without a global install and with no need for a package\nscript around it:\n\n // app/commands/typegen.ts\n await ctx.exec([\"cf\", \"workers\", \"types\"]);\n\nNo action needed; a command that relied on a global tool now runs the project's version when\nthe project installs one."}
|
|
1074
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":true,"title":"generate the app template's Worker types with `sdxc run typegen`","body":"A project from `sdxc create` no longer has a `cf:typegen` package script. The app's command\nline has a `typegen` command instead, which writes the Worker's `env` types from\n`cloudflare.config.ts` through the project's `cf`:\n\n sdxc run typegen\n\nBreaking for an existing project only if something calls the script. To migrate:\n\n1. Save `app/commands/typegen.ts`:\n\n import { createCommand, success } from \"@sdxc/cli\";\n import { isFailure } from \"@sdxc/result\";\n\n import commandset from \"~/app/commands\";\n import { PROJECT_ROOT } from \"~/app/initializers/local-database\";\n\n export default createCommand(commandset.typegen, async (ctx) => {\n let generated = await ctx.exec([\"cf\", \"workers\", \"types\"], { cwd: PROJECT_ROOT });\n return isFailure(generated) ? generated : success();\n });\n\n2. Declare it in `app/commands/index.ts` as\n `typegen: command({ description: \"Write the Worker's env types from cloudflare.config.ts\" })`,\n and map it in `app/initializers/cli.ts` with\n `cli.map(commandset.typegen, lazy(() => import(\"~/app/commands/typegen\")));`.\n\n3. Replace `bun cf:typegen` with `sdxc run typegen` in your docs and CI, and delete the\n `cf:typegen` script from `package.json`."}
|
|
1075
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"refactor","breaking":false,"title":"build the app template's sitemap from the route table","body":"Apps created with `sdxc create` now build `/sitemap.xml` with `fromRoutes` from\n`@sdxc/sitemap/remix`, so every GET route in `routes/web.ts` has to be listed or excluded\nin `app/http/controllers/sitemap.ts`. A route left out is a type error:\n\n let sitemap = fromRoutes(routes, seo.baseUrl, {\n \thome: { priority: 1 },\n \tabout: true,\n \trobots: false,\n \tsitemap: false,\n \tnotFound: false,\n });\n\nThe generated sitemap is unchanged: it lists the home page at `SITE_URL` with priority 1\nand is cached for an hour. A page added with `sdxc make controller` now fails\n`bun check` until you add it to the sitemap, with `true` (or options) to list it or `false`\nto exclude it. Existing apps need no action, but they can adopt the same controller."}
|
|
1076
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"credit the author in the module JSDoc of generated files","body":"Files written by `sdxc make` and by `sdxc create` from the built-in `app` template now end their opening module JSDoc with `@author` and `@copyright` tags:\n\n /**\n * Charge: describe the rule this service carries out across models, …\n *\n * @author [Ada Lovelace](https://ada.dev)\n * @copyright Ada Lovelace 2026\n */\n\nThe author is the `author` field of the nearest package.json, searched from the folder the file is written to up to the repository root. Both npm forms work: `\"Name <email> (url)\"` and `{ \"name\": …, \"url\": … }`. If no package.json names an author, `git config user.name` is used, and the tag has no link. If neither gives a name, no tags are written. The year is the current UTC year.\n\nProject stubs pick this up through a new `{{header}}` placeholder. Place it at the end of the module JSDoc's last description line: `* {{title}}: what this file does.{{header}}`. Run `sdxc make stubs` to see it in the built-in stubs. Project stubs copied earlier keep working unchanged and get no tags until you add `{{header}}`. Templates downloaded from GitHub are written exactly as they are."}
|
|
1077
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"decide a new page in the sitemap with `sdxc make controller`","body":"When a controller builds the sitemap with `fromRoutes` from `@sdxc/sitemap/remix` over the\nsame route contract, `sdxc make controller` now adds the new page's decision beside the route\nand its mapping, so the app keeps type checking:\n\n sdxc make controller sponsors # sponsors: true,\n sdxc make controller posts/show --path /posts/:slug # posts: { show: [] },\n sdxc make controller signup --method form # signup: { index: true },\n\nA page is listed (`true`) by default. A pattern with required params starts as `[]`, for you\nto fill with the pages to list, and a `form` route decides its page under `index`. A page\ninside a group the sitemap already excludes with `false` gets no edit. `post`, `put`, `patch`\nand `delete` routes need no decision and are left out. When the route or its mapping cannot\nbe placed, `make` prints the sitemap decision with the other edits to make by hand.\n\nBefore, a page added with `make` failed the type check until you decided it by hand. Projects\nwithout a `fromRoutes` sitemap see no change."}
|
|
1078
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"link the sdxc.dev docs from the module JSDoc of generated files","body":"Files written by `sdxc make` now open with links to the sdxc.dev guide and API reference for the packages the file is built on, so you know what to read before filling it in:\n\n /**\n * Charge: describe the rule this service carries out across models, …\n *\n * @see {@link https://sdxc.dev/docs/conventions/result-everywhere}\n * @see {@link https://sdxc.dev/api/result}\n *\n * @author [Ada Lovelace](https://ada.dev)\n * @copyright Ada Lovelace 2026\n */\n\nEach kind links its own pages: jobs link the jobs-and-cron guide and `@sdxc/jobs`, models the data-models guide and `@sdxc/data-model`, MCP handlers the MCP server guide and `@sdxc/mcp`, and test files the guide for the kind plus the testing guide. Migrations are SQL and get no links.\n\nProject stubs copied earlier with `sdxc make stubs` keep working unchanged and get no links. To add them, rerun `sdxc make stubs` into an empty folder and copy the `@see` lines into yours, placed before `{{header}}`."}
|
|
1079
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"mark where your code goes in generated files","body":"Files written by `sdxc make` now carry a `// TODO:` comment (or `{/* TODO: … */}` inside JSX) at the spot your code belongs, so a generated file shows what to fill in without reading the whole thing:\n\n export default createJobHandler(jobs.sendDigest, async (ctx) => {\n \tctx.log.set({ job: { name: \"send-digest\" } });\n \t// TODO: do the work, through the services on `ctx`\n });\n\nControllers, form controllers (one for the fields, one for saving the submission), API controllers, jobs, cron jobs, commands, services, middleware, models (where columns go) and emails get one. Replace each marker with your code and delete it; your editor's TODO search lists the ones left.\n\nProject stubs copied earlier with `sdxc make stubs` keep working unchanged and get no markers."}
|
|
1080
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"generate model ids with `generateId` in `sdxc make model`","body":"A model written by `sdxc make model` now reads as its table and one line:\n\n```ts\nexport const Post = createModel(postTable, { generateId: generateUUID });\n```\n\n`@sdxc/data-model`'s `generateId` fills the primary key with a UUIDv7 on create and upsert,\nreplacing the `optional: [\"id\"]` list and the `beforeCreate` callback every generated model\nrepeated. Models generated earlier keep working; to slim one down, drop `optional: [\"id\"]` and\nthe callback and pass `generateId: generateUUID` instead."}
|
|
1081
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"write a `defineEmail()` email with `sdxc make email`","body":"`sdxc make email welcome` now writes the email as the copy it says and one\n`defineEmail()` call from `@sdxc/mail`, instead of a copy interface, a body\ncomponent and a class with a constructor, `to`, `subject` and `body()`:\n\n export const WelcomeEmail = defineEmail<WelcomeCopy>({\n \tsubject: (copy) => copy.heading,\n \tbody: (handle) => () => (\n \t\t<Email.Layout preview={handle.props.heading} title={handle.props.heading}>\n \t\t\t<Email.Heading>{handle.props.heading}</Email.Heading>\n \t\t\t<Email.Text>{handle.props.body}</Email.Text>\n \t\t\t{/* TODO: lay out the rest of the email */}\n \t\t</Email.Layout>\n \t),\n });\n\nIt is sent the same way as before, `ctx.email.later(new WelcomeEmail(to, copy))`,\nand the generated test also renders the body. Emails generated earlier keep\nworking unchanged."}
|
|
1082
|
+
{"release":"2026.10.17","package":"@sdxc/kit","type":"feat","breaking":false,"title":"guard `sdxc make controller --method form` actions with the spam middleware","body":"A generated form controller's action now declares\n`middleware: [captcha(turnstile), spam(spamFilter, { fields: { content: \"message\" } })]`, and its\nhandler only saves and redirects: the 422 for spam comes from `@sdxc/spam/middleware`. Rename\n`\"message\"` to the form field that holds what the visitor wrote, and add `email`, `name` or\n`url` to `fields` when the form collects them.\n\nNew apps from `sdxc create` install `getClientIP()` and `userAgent()` in the router, so every\nrequest reads `ctx.ip` and `ctx.userAgent`, and the address rate limit keys on `ctx.ip`. Apps\ncreated earlier keep working. To get the same in one, add `@sdxc/user-agent`, put\n`getClientIP()` from `@sdxc/get-client-ip/middleware` and `userAgent()` from\n`@sdxc/user-agent/middleware` in `createRouter({ middleware })`, and replace a generated\naction's inline `spamFilter.check(…)` with the middleware above."}
|
|
1083
|
+
{"release":"2026.10.17","package":"@sdxc/mail","type":"feat","breaking":false,"title":"define an email from its props, subject and body with `defineEmail()`","body":"`defineEmail()` builds the class the mailer sends from a subject and a body\ncomponent, so an email is its props and its markup instead of a hand-written\nclass with a constructor, `to`, `subject` and `body()`:\n\n import { defineEmail, Email } from \"@sdxc/mail\";\n\n interface Welcome {\n \tname: string;\n }\n\n export const WelcomeEmail = defineEmail<Welcome>({\n \tsubject: (props) => `Welcome, ${props.name}`,\n \tbody: (handle) => () => (\n \t\t<Email.Layout title=\"Welcome\">\n \t\t\t<Email.Text>Hi {handle.props.name}.</Email.Text>\n \t\t</Email.Layout>\n \t),\n });\n\n await mailer.send(new WelcomeEmail(\"ada@example.com\", { name: \"Ada\" }));\n\nThe class takes the recipient (a string, an `Address` or a list) and the\nprops, and exposes those props as `email.props`. `replyTo`, `headers`,\n`unsubscribe`, `list` and `calendar` are optional functions of the props.\nEach call returns its own class, so `transport.last?.email instanceof\nWelcomeEmail` still finds a sent message. The `Email` contract is unchanged:\nexisting email classes keep working, and nothing needs to migrate."}
|
|
1084
|
+
{"release":"2026.10.17","package":"@sdxc/mail","type":"fix","breaking":false,"title":"include the module behind `defineEmail()`","body":"The previous commit exported `defineEmail()` without adding the file that implements it. Both commits ship in the same release, so consumers see only the new `defineEmail()` and need to do nothing."}
|
|
1085
|
+
{"release":"2026.10.17","package":"@sdxc/openapi","type":"fix","breaking":false,"title":"serve the document on a router whose middleware publishes context","body":"`openapiHandler` was typed for a request context with nothing published on it, so passing\nit to a router whose middleware sets a value (a logger, a session, a tenant) failed to\ncompile:\n\n router.get(routes.openapi, openapiHandler(() => document.build()));\n // TS2345: RequestHandler<RequestContext<{}, []>> is not assignable to …\n\nIt now accepts any request context, since it reads only the request. Runtime behavior is\nunchanged, and no consumer needs to change anything; a cast written to work around the error\ncan be removed."}
|
|
1086
|
+
{"release":"2026.10.17","package":"@sdxc/png","type":"feat","breaking":false,"title":"encode and decode PNG images without WebAssembly","body":"New package @sdxc/png writes a pixel buffer as a PNG and reads any valid PNG back, using the platform's CompressionStream and DecompressionStream, so it runs in Workers, Bun, Node and the browser with no WebAssembly.\n\n```ts\nimport { decode, encode } from \"@sdxc/png\";\nimport { isFailure } from \"@sdxc/result\";\n\nlet bytes = await encode({ width, height, data }); // data: Uint8ClampedArray, straight RGBA\nlet image = await decode(bytes);\nif (isFailure(image)) console.error(image.error.code);\nelse image.data.data; // RGBA, 8 bits per channel\n```\n\nencode writes RGB when every pixel is opaque (pass { alpha: \"keep\" } for RGBA), picks a filter per scanline with libpng's heuristic, and writes tEXt entries from options.text. decode checks the signature and every CRC and expands all color types and bit depths, palettes with tRNS, 16-bit samples and Adam7 interlacing into 8-bit RGBA; failures come back as a PNGError whose code is signature, crc, header, unsupported, truncated or inflate."}
|
|
1087
|
+
{"release":"2026.10.17","package":"@sdxc/png","type":"perf","breaking":false,"title":"encode images faster by scoring filters in one pass","body":"`encode` used to filter every scanline five times, through a generic per-byte predictor, to find the cheapest filter. It now scores all five filters in one pass over the row and writes only the winner, with each filter's loop specialized, and `decode` reverses filters with the same specialized loops. Encoding a 1200×630 image takes roughly half the time it did, and the bytes written are identical. No action is needed."}
|
|
1088
|
+
{"release":"2026.10.17","package":"@sdxc/raster","type":"feat","breaking":false,"title":"draw antialiased paths, gradients, masks and text in a Worker","body":"New package. `Canvas` is a 2D drawing surface in plain TypeScript, with no WebAssembly, that encodes to PNG through `@sdxc/png` and sets text with `@sdxc/font`, so a Worker can render an image such as a social card on demand.\n\n```ts\nimport { Canvas, color, radialGradient, TRANSPARENT } from \"@sdxc/raster\";\n\nlet canvas = new Canvas(1200, 630);\ncanvas.fillRect(0, 0, 1200, 630, color(\"oklch(0.155 0.006 275)\"));\ncanvas.mask(radialGradient({ center: [600, 315], radius: 700, stops: [[0, color(\"#fff\")], [0.75, TRANSPARENT]] }), () => {\n\tfor (let x = 0; x < 1200; x += 48) canvas.fillRect(x, 0, 1, 630, color(\"#2b2d38\"));\n});\ncanvas.text(\"Sign and verify JWTs\", { font, size: 76, minSize: 52, maxLines: 2, maxWidth: 880, x: 600, y: 300, align: \"center\", paint: color(\"#f4f4f6\") });\nlet png = await canvas.toPNG();\n```\n\n- `fillRect` and `fillPath` (nonzero or evenodd) with exact-area antialiasing; `Path` builds lines, quadratic and cubic curves, rectangles and rounded rectangles, and adopts glyph outlines.\n- Solid colours from hex, `rgb()` and `oklch()`, plus linear and elliptical radial gradients interpolated in premultiplied sRGB.\n- `layer({ opacity }, draw)` and `mask(paint, draw)` composite a group of calls once.\n- `text()` wraps at spaces, shrinks to a line limit, and truncates with an ellipsis, returning the metrics to place what follows."}
|
|
1089
|
+
{"release":"2026.10.17","package":"@sdxc/raster","type":"perf","breaking":false,"title":"shade whole spans and composite only what a layer touched","body":"Fills used to sample their paint and blend one pixel at a time through closures, and `layer()`/`mask()` composited the whole canvas. Now `fillRect` and `fillPath` shade a row span at a time with gradient math done incrementally, copy fully covered opaque pixels and skip transparent ones, and layers composite only the box their drawing touched. A full-canvas gradient fill is about four times faster and a 1200×630 card renders in roughly half the time. Output is unchanged and no action is needed."}
|
|
1090
|
+
{"release":"2026.10.17","package":"@sdxc/raster","type":"feat","breaking":false,"title":"draw SVG path data with Path.fromSVG","body":"`Path.fromSVG(d, { transform })` reads an SVG `d` attribute, every command (M L H V C S Q T A Z, absolute and relative) with SVG's number syntax, so a logo or icon exported as SVG fills on a `Canvas`. The optional `transform` is an SVG `matrix(a b c d e f)`, which places and scales a shape drawn in its own `viewBox`. Malformed data throws a `RangeError` naming the position.\n\n```ts\nimport { Canvas, color, Path } from \"@sdxc/raster\";\n\nlet logo = Path.fromSVG(\"M2970 8530c-318-68-583-290-705-592…\", { transform: [0.004, 0, 0, -0.004, 80, 104] });\ncanvas.fillPath(logo, color(\"#f3f4f6\"));\n```"}
|
|
1091
|
+
{"release":"2026.10.17","package":"@sdxc/raster","type":"fix","breaking":false,"title":"parse colour functions in linear time","body":"`color()` from `@sdxc/raster` could take seconds on an unclosed colour function\nfollowed by a long run of whitespace, such as `\"rgb(\"` plus 100,000 tabs: the\npattern it matched against backtracked quadratically. It now rejects such input\nwith the same `RangeError` immediately. Every colour that parsed before parses\nthe same way, including whitespace right after the opening parenthesis. No\naction is needed from consumers."}
|
|
1092
|
+
{"release":"2026.10.17","package":"@sdxc/seo","type":"feat","breaking":false,"title":"state a social card image's width and height","body":"`Seo.OpenGraph` takes `imageWidth` and `imageHeight`, which `Seo.Meta` writes as `og:image:width` and `og:image:height` alongside `og:image`. A platform that knows the size can lay out a large card on the first share instead of waiting to fetch the image. Both are ignored without an `image`.\n\n```tsx\n<Seo.Meta\n\ttitle={title}\n\tcanonical={seo.canonical(url)}\n\tsite={seo.site}\n\tog={{ image: seo.absolute(\"/og/home.png\"), imageAlt: title, imageWidth: 1200, imageHeight: 630 }}\n/>\n```"}
|
|
1093
|
+
{"release":"2026.10.17","package":"@sdxc/sitemap","type":"feat","breaking":false,"title":"build a sitemap from a Remix route table with every GET route decided","body":"New `@sdxc/sitemap/remix` entry point. `fromRoutes(routes, origin, decisions)` walks a `remix/routes` table and requires a decision for every `GET` and `ANY` route in it, so a page added to the table fails typechecking until the sitemap lists or excludes it. A route with params lists its pages, with the params typed from its pattern.\n\n```ts\nimport { fromRoutes } from \"@sdxc/sitemap/remix\";\n\nlet sitemap = fromRoutes(routes, \"https://example.com\", {\n\thome: { priority: 1 },\n\tpost: posts.map((post) => ({ params: { slug: post.slug }, updatedAt: post.updatedAt })),\n\thealthcheck: false,\n\tadmin: false, // a nested map, excluded whole\n});\n```\n\n- A route without required params takes `true`, `false` or the entry's `AppendOptions`; a route with required params takes `false` or a list of `{ params, ...options }`; a nested map takes its own decisions or `false`. Write-only routes (`POST`, `PUT`, `DELETE`, …) take no key.\n- Optional groups such as `(.:ext)` are left out of a URL unless the page passes their param.\n- Pages are listed in the order the table declares its routes, and each URL is resolved against `origin`.\n- `remix` is a peer dependency of this entry point only; `@sdxc/sitemap` itself is unchanged."}
|
|
1094
|
+
{"release":"2026.10.17","package":"@sdxc/spam","type":"feat","breaking":false,"title":"score form submissions in a `spam()` router middleware","body":"`@sdxc/spam/middleware` exports `spam(filter, options)`, which scores every submission before\nthe handler runs. A spam verdict gets a 422 response by default, and every assessment is\npublished as `ctx.spamAssessment`, so the handler only saves what it received:\n\n import { spam } from \"@sdxc/spam/middleware\";\n\n router.post(routes.contact.action, {\n middleware: [spam(filter, { fields: { content: \"message\", email: \"email\" } })],\n handler: (ctx) => saveMessage(ctx.formData, ctx.spamAssessment.verdict === \"unsure\"),\n });\n\nEach entry in `fields` names a form field whose value is read from the submitted form:\n`content` takes one name or several, joined by line breaks, and `name`, `email` and `url`\ndescribe the author. The submission also carries `ctx.ip` from `@sdxc/get-client-ip/middleware`,\n`ctx.userAgent.raw` from `@sdxc/user-agent/middleware`, and the render time `honeypot()` from\n`@sdxc/honeypot/middleware` verified, each one when that middleware runs earlier. Pass\n`onSpam(assessment, ctx)` to answer spam with your own response, or `null` to let the handler\ndecide. `format` and `languages` pass through to the filter."}
|
|
1095
|
+
{"release":"2026.10.17","package":"@sdxc/ui","type":"feat","breaking":false,"title":"add liveFrame and activeDescendantKeys mixins for live results in a frame","body":"Two mixins in @sdxc/ui/mixins for search-as-you-type over server-rendered results.\n\nliveFrame reloads the frame its input sits in once typing pauses, from an address you build from the value, and only lets the newest request settle. It reports progress as a LiveFrameEvent (\"ui:live-frame\") whose state is pending, slow, loading or settled, and reloads at once when the input receives LIVE_FRAME_RELOAD_EVENT:\n\n <input name=\"q\" mix={[\n liveFrame({ src: (q) => `/frames/search?q=${encodeURIComponent(q)}`, debounce: 200, slowAfter: 350 }),\n on(\"ui:live-frame\", (event) => results.toggleAttribute(\"aria-busy\", event.state !== \"settled\")),\n ]} />\n\nactiveDescendantKeys gives a combobox input the arrow-and-Enter pattern over the options of the listbox its aria-controls names, keeping focus in the input through aria-activedescendant. Enter follows the chosen option's link, or the only option when it is not inside an aria-busy region. chooseOption(input, index) and chosenOption(input) set and read the choice, for example after a reload replaced the options:"}
|
|
1096
|
+
{"release":"2026.10.17","package":"@sdxc/user-agent","type":"feat","breaking":false,"title":"keep the parsed string on the result as `raw`","body":"`parse()` and the `userAgent()` middleware now return the string they read as `raw`, beside\n`browser`, `engine`, `os` and `device`, so code that forwards the header verbatim (a spam or\nanalytics provider) reads it from `ctx.userAgent` instead of the request headers.\n\n import { userAgent } from \"@sdxc/user-agent/middleware\";\n\n let router = createRouter({ middleware: [userAgent()] });\n // in a handler\n ctx.userAgent.raw; // \"Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) …\"\n\nA request without the header, and a context the middleware never ran on, read `raw` as `\"\"`.\nCode that builds a `UserAgent` object literal by hand must now add a `raw` string."}
|
|
1097
|
+
{"release":"2026.10.17","package":"@sdxc/zip","type":"perf","breaking":false,"title":"compute CRC-32 with an indexed loop","body":"`crc32` read its input through the typed array's iterator, which spent more time in iteration than in the checksum. It now indexes the bytes directly, so checksumming large entries in `Zip` (and every chunk `@sdxc/png` writes) is faster. Results are unchanged and no action is needed."}
|
package/dist/author.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@author` and `@copyright` tags closing the module JSDoc of every file `make` and `create`
|
|
3
|
+
* write, credited to the project's package.json `author` or else the git user, so a generated
|
|
4
|
+
* file opens with the header the project's documentation rules ask for.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
/** Who a generated file credits; `url` is linked from the `@author` tag when present. */
|
|
10
|
+
export interface Author {
|
|
11
|
+
name: string;
|
|
12
|
+
url: string | null;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reads a package.json `author` in either npm form: `"Name <email> (url)"`, where the email and
|
|
16
|
+
* url are optional, or `{ name, email, url }`. Anything without a name is `null`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseAuthor(field: unknown): Author | null;
|
|
19
|
+
/**
|
|
20
|
+
* The author of files written under `directory`: the `author` of the nearest package.json from
|
|
21
|
+
* `directory` up to the repository root (the first folder holding `.git`), else `git config
|
|
22
|
+
* user.name` there, else `null`, so a file carries no tags rather than a guessed name.
|
|
23
|
+
* `directory` may not exist yet; the search starts from it all the same.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveAuthor(directory: string): Promise<Author | null>;
|
|
26
|
+
/**
|
|
27
|
+
* The lines a module JSDoc ends with to credit `author`: a blank comment line, `@author` (linked
|
|
28
|
+
* when there is a url) and `@copyright` with the UTC `year`, each led by a newline so the result
|
|
29
|
+
* splices in right before the line that closes the block. With no author it is empty.
|
|
30
|
+
*/
|
|
31
|
+
export declare function headerTags(author: Author | null, year?: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* `source` with `tags` added to the module JSDoc it opens with (after a `#!` line, if any). A
|
|
34
|
+
* file that opens with no JSDoc, or whose JSDoc already has an `@author`, is answered as it is.
|
|
35
|
+
*/
|
|
36
|
+
export declare function addHeaderTags(source: string, tags: string): string;
|
package/dist/author.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `@author` and `@copyright` tags closing the module JSDoc of every file `make` and `create`
|
|
3
|
+
* write, credited to the project's package.json `author` or else the git user, so a generated
|
|
4
|
+
* file opens with the header the project's documentation rules ask for.
|
|
5
|
+
*
|
|
6
|
+
* @author [Sergio Xalambrí](https://sergiodxa.com)
|
|
7
|
+
* @copyright Sergio Xalambrí 2026
|
|
8
|
+
*/
|
|
9
|
+
import { execFile } from "node:child_process";
|
|
10
|
+
import { readFile, stat } from "node:fs/promises";
|
|
11
|
+
import { dirname, join } from "node:path";
|
|
12
|
+
import { isFailure, isSuccess, wrap } from "@sdxc/result";
|
|
13
|
+
/**
|
|
14
|
+
* Reads a package.json `author` in either npm form: `"Name <email> (url)"`, where the email and
|
|
15
|
+
* url are optional, or `{ name, email, url }`. Anything without a name is `null`.
|
|
16
|
+
*/
|
|
17
|
+
export function parseAuthor(field) {
|
|
18
|
+
if (typeof field === "string") {
|
|
19
|
+
let match = /^([^<(]*?)\s*(?:<[^>]*>)?\s*(?:\(([^)]*)\))?\s*$/.exec(field.trim());
|
|
20
|
+
let name = match?.[1]?.trim() ?? "";
|
|
21
|
+
if (name === "")
|
|
22
|
+
return null;
|
|
23
|
+
let url = match?.[2]?.trim() ?? "";
|
|
24
|
+
return { name, url: url === "" ? null : url };
|
|
25
|
+
}
|
|
26
|
+
if (typeof field !== "object" || field === null || Array.isArray(field))
|
|
27
|
+
return null;
|
|
28
|
+
let { name, url } = field;
|
|
29
|
+
if (typeof name !== "string" || name.trim() === "")
|
|
30
|
+
return null;
|
|
31
|
+
return {
|
|
32
|
+
name: name.trim(),
|
|
33
|
+
url: typeof url === "string" && url.trim() !== "" ? url.trim() : null,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The author of files written under `directory`: the `author` of the nearest package.json from
|
|
38
|
+
* `directory` up to the repository root (the first folder holding `.git`), else `git config
|
|
39
|
+
* user.name` there, else `null`, so a file carries no tags rather than a guessed name.
|
|
40
|
+
* `directory` may not exist yet; the search starts from it all the same.
|
|
41
|
+
*/
|
|
42
|
+
export async function resolveAuthor(directory) {
|
|
43
|
+
let existing = null;
|
|
44
|
+
for (let current = directory;; current = dirname(current)) {
|
|
45
|
+
let found = await wrap(() => stat(current));
|
|
46
|
+
if (isSuccess(found) && found.data.isDirectory()) {
|
|
47
|
+
existing ??= current;
|
|
48
|
+
let text = await wrap(() => readFile(join(current, "package.json"), "utf8"));
|
|
49
|
+
if (isSuccess(text)) {
|
|
50
|
+
let manifest = wrap(() => JSON.parse(text.data));
|
|
51
|
+
let author = isFailure(manifest) ? null : parseAuthor(manifest.data.author);
|
|
52
|
+
if (author !== null)
|
|
53
|
+
return author;
|
|
54
|
+
}
|
|
55
|
+
if (isSuccess(await wrap(() => stat(join(current, ".git")))))
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
if (dirname(current) === current)
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
if (existing === null)
|
|
62
|
+
return null;
|
|
63
|
+
let name = await gitUserName(existing);
|
|
64
|
+
return name === null ? null : { name, url: null };
|
|
65
|
+
}
|
|
66
|
+
/** `git config user.name` as git resolves it in `cwd`, or `null` when git or the name is missing. */
|
|
67
|
+
function gitUserName(cwd) {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
execFile("git", ["config", "user.name"], { cwd }, (error, stdout) => {
|
|
70
|
+
let name = error === null ? stdout.trim() : "";
|
|
71
|
+
resolve(name === "" ? null : name);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The lines a module JSDoc ends with to credit `author`: a blank comment line, `@author` (linked
|
|
77
|
+
* when there is a url) and `@copyright` with the UTC `year`, each led by a newline so the result
|
|
78
|
+
* splices in right before the line that closes the block. With no author it is empty.
|
|
79
|
+
*/
|
|
80
|
+
export function headerTags(author, year = new Date().getUTCFullYear()) {
|
|
81
|
+
if (author === null)
|
|
82
|
+
return "";
|
|
83
|
+
let credit = author.url === null ? author.name : `[${author.name}](${author.url})`;
|
|
84
|
+
return `\n *\n * @author ${credit}\n * @copyright ${author.name} ${year}`;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* `source` with `tags` added to the module JSDoc it opens with (after a `#!` line, if any). A
|
|
88
|
+
* file that opens with no JSDoc, or whose JSDoc already has an `@author`, is answered as it is.
|
|
89
|
+
*/
|
|
90
|
+
export function addHeaderTags(source, tags) {
|
|
91
|
+
if (tags === "")
|
|
92
|
+
return source;
|
|
93
|
+
let start = source.startsWith("#!") ? source.indexOf("\n") + 1 : 0;
|
|
94
|
+
if (!source.startsWith("/**", start))
|
|
95
|
+
return source;
|
|
96
|
+
let end = source.indexOf("*/", start);
|
|
97
|
+
if (end === -1)
|
|
98
|
+
return source;
|
|
99
|
+
let block = source.slice(start, end);
|
|
100
|
+
if (block.includes("@author"))
|
|
101
|
+
return source;
|
|
102
|
+
let close = block.lastIndexOf("\n");
|
|
103
|
+
if (close === -1)
|
|
104
|
+
return source;
|
|
105
|
+
let at = start + close;
|
|
106
|
+
return `${source.slice(0, at)}${tags}${source.slice(at)}`;
|
|
107
|
+
}
|
package/dist/commands/create.js
CHANGED
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
import { relative } from "node:path";
|
|
10
10
|
import { createCommand, success } from "@sdxc/cli";
|
|
11
11
|
import { failure, isFailure, wrap } from "@sdxc/result";
|
|
12
|
+
import { headerTags, resolveAuthor } from "../author.js";
|
|
12
13
|
import { SDXC_COMMANDS } from "../contract.js";
|
|
13
14
|
import { describe, downloadTemplate, GitHubRefusal, githubToken } from "../create/github.js";
|
|
14
15
|
import { resolveTarget } from "../create/target.js";
|
|
15
|
-
import { completeBuiltin, nameProject, parseTemplate, readBuiltinTemplate, writeTree, } from "../create/templates.js";
|
|
16
|
+
import { completeBuiltin, creditTemplate, nameProject, parseTemplate, readBuiltinTemplate, writeTree, } from "../create/templates.js";
|
|
16
17
|
import { packageRoot } from "../middleware.js";
|
|
17
18
|
import { packageManager, scriptCommand } from "../package-manager.js";
|
|
18
19
|
/** The middleware `create` runs behind; it runs outside any project. */
|
|
@@ -28,7 +29,7 @@ export default createCommand(SDXC_COMMANDS.create, {
|
|
|
28
29
|
let target = await resolveTarget(ctx.cwd, ctx.arguments.directory);
|
|
29
30
|
if (isFailure(target))
|
|
30
31
|
return target;
|
|
31
|
-
let fetched = await fetchTemplate(ctx, source.data, target.data.name);
|
|
32
|
+
let fetched = await fetchTemplate(ctx, source.data, target.data.name, target.data.directory);
|
|
32
33
|
if (isFailure(fetched))
|
|
33
34
|
return fetched;
|
|
34
35
|
let written = await writeTree(target.data.directory, fetched.data.tree);
|
|
@@ -95,8 +96,11 @@ async function initializeGit(ctx, wanted, directory, shown) {
|
|
|
95
96
|
ctx.stdout("Initialized a git repository\n");
|
|
96
97
|
return success(undefined);
|
|
97
98
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Reads the template `source` names and completes it for the project `name`. A built-in
|
|
101
|
+
* template's modules credit the author resolved from `directory`, where the project is written.
|
|
102
|
+
*/
|
|
103
|
+
async function fetchTemplate(ctx, source, name, directory) {
|
|
100
104
|
if (source.kind === "github") {
|
|
101
105
|
let extracted = await download(ctx, source);
|
|
102
106
|
if (isFailure(extracted))
|
|
@@ -113,6 +117,7 @@ async function fetchTemplate(ctx, source, name) {
|
|
|
113
117
|
let completed = await completeBuiltin(tree.data, name, ctx.packageRoot);
|
|
114
118
|
if (isFailure(completed))
|
|
115
119
|
return completed;
|
|
120
|
+
creditTemplate(tree.data, headerTags(await resolveAuthor(directory)));
|
|
116
121
|
return success({ tree: tree.data, description: `the ${source.name} template` });
|
|
117
122
|
}
|
|
118
123
|
/**
|
package/dist/commands/run.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
export declare const CLI_ENTRY = "bootstrap/cli.ts";
|
|
11
11
|
/**
|
|
12
12
|
* Runs `bootstrap/cli.ts` under Bun for a project on Bun and under Node otherwise, with its
|
|
13
|
-
* output on the terminal
|
|
14
|
-
*
|
|
13
|
+
* output on the terminal and the project's `node_modules/.bin` first on `PATH`, as a package
|
|
14
|
+
* script has it; the app's exit code is `sdxc run`'s, and only the app's messages print on failure.
|
|
15
15
|
*/
|
|
16
16
|
declare const _default: import("@sdxc/cli").CommandAction<import("@sdxc/cli").Command<{
|
|
17
17
|
readonly args: import("@sdxc/cli").Argument<string[]>;
|
package/dist/commands/run.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @copyright Sergio Xalambrí 2026
|
|
8
8
|
*/
|
|
9
9
|
import { stat } from "node:fs/promises";
|
|
10
|
-
import { join } from "node:path";
|
|
10
|
+
import { delimiter, join } from "node:path";
|
|
11
11
|
import { createCommand, ExecError, exit, failure, success } from "@sdxc/cli";
|
|
12
12
|
import { isFailure, isSuccess, wrap } from "@sdxc/result";
|
|
13
13
|
import { SDXC_COMMANDS } from "../contract.js";
|
|
@@ -18,8 +18,8 @@ import { readManifest } from "../upgrade/project.js";
|
|
|
18
18
|
export const CLI_ENTRY = "bootstrap/cli.ts";
|
|
19
19
|
/**
|
|
20
20
|
* Runs `bootstrap/cli.ts` under Bun for a project on Bun and under Node otherwise, with its
|
|
21
|
-
* output on the terminal
|
|
22
|
-
*
|
|
21
|
+
* output on the terminal and the project's `node_modules/.bin` first on `PATH`, as a package
|
|
22
|
+
* script has it; the app's exit code is `sdxc run`'s, and only the app's messages print on failure.
|
|
23
23
|
*/
|
|
24
24
|
export default createCommand(SDXC_COMMANDS.run, {
|
|
25
25
|
middleware: [project()],
|
|
@@ -38,9 +38,11 @@ export default createCommand(SDXC_COMMANDS.run, {
|
|
|
38
38
|
findLockFile: lockFileAtOrAbove(root),
|
|
39
39
|
});
|
|
40
40
|
let runtime = manager.name === "bun" ? "bun" : "node";
|
|
41
|
+
let bin = join(root, "node_modules", ".bin");
|
|
41
42
|
let ran = await ctx.exec([runtime, CLI_ENTRY, ...ctx.arguments.args], {
|
|
42
43
|
cwd: root,
|
|
43
44
|
stdio: "inherit",
|
|
45
|
+
env: { PATH: ctx.env.PATH === undefined ? bin : `${bin}${delimiter}${ctx.env.PATH}` },
|
|
44
46
|
});
|
|
45
47
|
if (isSuccess(ran))
|
|
46
48
|
return success();
|
package/dist/contract.js
CHANGED
|
@@ -113,7 +113,7 @@ export const SDXC_COMMANDS = commands({
|
|
|
113
113
|
test: TEST_FLAG,
|
|
114
114
|
dryRun: DRY_RUN_FLAG,
|
|
115
115
|
},
|
|
116
|
-
examples: ["make controller ping --method post
|
|
116
|
+
examples: ["make controller api/keys --routes api", "make controller ping --method post"],
|
|
117
117
|
}),
|
|
118
118
|
middleware: command({
|
|
119
119
|
description: "A middleware in app/http/middleware",
|
|
@@ -50,9 +50,16 @@ export declare function readBuiltinTemplate(packageRoot: string, name: string):
|
|
|
50
50
|
/**
|
|
51
51
|
* Completes a built-in template for the project `name`: names it, pins every `@sdxc/*` package it
|
|
52
52
|
* lists to the version npm calls `latest` and `remix` to the peer the kit declares, and writes
|
|
53
|
-
* `.config/sdxc.jsonc` as `sdxc init` renders it
|
|
53
|
+
* `.config/sdxc.jsonc` as `sdxc init` renders it with the template's formatter, so a new
|
|
54
|
+
* configuration key reaches new projects. It copies `.env.example` to `.dev.vars`, so the
|
|
55
|
+
* development secrets it lists are in place for the project's first `bun dev`.
|
|
54
56
|
*/
|
|
55
57
|
export declare function completeBuiltin(tree: TemplateTree, name: string, packageRoot: string, signal?: AbortSignal): Promise<Result<void, Error>>;
|
|
58
|
+
/**
|
|
59
|
+
* Adds `tags` to the module JSDoc of every TypeScript module in a built-in template, so the new
|
|
60
|
+
* project's files credit its author the way the files `sdxc make` writes do.
|
|
61
|
+
*/
|
|
62
|
+
export declare function creditTemplate(tree: TemplateTree, tags: string): void;
|
|
56
63
|
/** Names the project in a template's `package.json`, when the template has one. */
|
|
57
64
|
export declare function nameProject(tree: TemplateTree, name: string): Result<void, Error>;
|
|
58
65
|
/**
|
package/dist/create/templates.js
CHANGED
|
@@ -10,6 +10,7 @@ import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
|
10
10
|
import { dirname, join, posix } from "node:path";
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
12
|
import { failure, isFailure, success, wrap } from "@sdxc/result";
|
|
13
|
+
import { addHeaderTags } from "../author.js";
|
|
13
14
|
import { renderConfig } from "../init.js";
|
|
14
15
|
import { resolveInside } from "../project.js";
|
|
15
16
|
import { resolveRelease, scopedPackageOf } from "../releases.js";
|
|
@@ -25,6 +26,11 @@ export const BUILTIN_TEMPLATES = ["app"];
|
|
|
25
26
|
* published tarball; each is written under the name it maps to.
|
|
26
27
|
*/
|
|
27
28
|
const RENAMED_FILES = new Map([["gitignore", ".gitignore"]]);
|
|
29
|
+
/**
|
|
30
|
+
* The configuration every built-in template ships beyond `sdxc init`'s defaults: each one checks
|
|
31
|
+
* with Vite+, so the files `make` and `ui add` write are formatted as `vp check` expects.
|
|
32
|
+
*/
|
|
33
|
+
const BUILTIN_CONFIG = { format: ["bunx", "vp", "fmt"] };
|
|
28
34
|
/** The directory of the installed `@sdxc/kit` package, which holds `templates/` and `package.json`. */
|
|
29
35
|
export function defaultPackageRoot() {
|
|
30
36
|
return fileURLToPath(new URL("../../", import.meta.url));
|
|
@@ -108,7 +114,9 @@ async function readInto(directory, prefix, tree) {
|
|
|
108
114
|
/**
|
|
109
115
|
* Completes a built-in template for the project `name`: names it, pins every `@sdxc/*` package it
|
|
110
116
|
* lists to the version npm calls `latest` and `remix` to the peer the kit declares, and writes
|
|
111
|
-
* `.config/sdxc.jsonc` as `sdxc init` renders it
|
|
117
|
+
* `.config/sdxc.jsonc` as `sdxc init` renders it with the template's formatter, so a new
|
|
118
|
+
* configuration key reaches new projects. It copies `.env.example` to `.dev.vars`, so the
|
|
119
|
+
* development secrets it lists are in place for the project's first `bun dev`.
|
|
112
120
|
*/
|
|
113
121
|
export async function completeBuiltin(tree, name, packageRoot, signal) {
|
|
114
122
|
let text = await wrap(() => readFile(join(packageRoot, "package.json"), "utf8"));
|
|
@@ -141,14 +149,29 @@ export async function completeBuiltin(tree, name, packageRoot, signal) {
|
|
|
141
149
|
});
|
|
142
150
|
if (isFailure(renamed))
|
|
143
151
|
return renamed;
|
|
152
|
+
let example = tree.files.get(".env.example");
|
|
153
|
+
if (example !== undefined && !tree.files.has(".dev.vars"))
|
|
154
|
+
tree.files.set(".dev.vars", example);
|
|
144
155
|
if (!tree.files.has(".config/sdxc.jsonc")) {
|
|
145
|
-
let config = renderConfig();
|
|
156
|
+
let config = renderConfig(BUILTIN_CONFIG);
|
|
146
157
|
if (isFailure(config))
|
|
147
158
|
return config;
|
|
148
159
|
tree.files.set(".config/sdxc.jsonc", new TextEncoder().encode(config.data));
|
|
149
160
|
}
|
|
150
161
|
return success(undefined);
|
|
151
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Adds `tags` to the module JSDoc of every TypeScript module in a built-in template, so the new
|
|
165
|
+
* project's files credit its author the way the files `sdxc make` writes do.
|
|
166
|
+
*/
|
|
167
|
+
export function creditTemplate(tree, tags) {
|
|
168
|
+
for (let [path, bytes] of tree.files) {
|
|
169
|
+
if (!/\.tsx?$/.test(path))
|
|
170
|
+
continue;
|
|
171
|
+
let source = new TextDecoder().decode(bytes);
|
|
172
|
+
tree.files.set(path, new TextEncoder().encode(addHeaderTags(source, tags)));
|
|
173
|
+
}
|
|
174
|
+
}
|
|
152
175
|
/** Every package the tree's `package.json` lists under `dependencies` or `devDependencies`. */
|
|
153
176
|
function treeDependencies(tree) {
|
|
154
177
|
let bytes = tree.files.get("package.json");
|