@rexezuge/tooling 1.13.0 → 1.14.0
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 +25 -4
- package/dist/eslint-options.d.ts +54 -0
- package/dist/eslint-options.d.ts.map +1 -0
- package/dist/eslint-options.js +0 -0
- package/dist/eslint-options.js.map +7 -0
- package/dist/eslint.d.ts +2 -53
- package/dist/eslint.d.ts.map +1 -1
- package/dist/eslint.js.map +2 -2
- package/dist/pages-proxy.d.ts +2 -0
- package/dist/pages-proxy.d.ts.map +1 -0
- package/dist/pages-proxy.js +1 -0
- package/dist/pages-proxy.js.map +7 -0
- package/dist/plugin-option.d.ts +15 -0
- package/dist/plugin-option.d.ts.map +1 -0
- package/dist/plugin-option.js +1 -0
- package/dist/plugin-option.js.map +7 -0
- package/dist/scripts/ensure-spa-shell-stub.d.ts +4 -2
- package/dist/scripts/ensure-spa-shell-stub.d.ts.map +1 -1
- package/dist/scripts/ensure-spa-shell-stub.js +1 -2
- package/dist/scripts/ensure-spa-shell-stub.js.map +3 -3
- package/dist/scripts/init-secrets.d.ts +1 -2
- package/dist/scripts/init-secrets.d.ts.map +1 -1
- package/dist/scripts/init-secrets.js +2 -3
- package/dist/scripts/init-secrets.js.map +3 -3
- package/dist/scripts/migrations-lock.d.ts +6 -2
- package/dist/scripts/migrations-lock.d.ts.map +1 -1
- package/dist/scripts/migrations-lock.js +1 -2
- package/dist/scripts/migrations-lock.js.map +3 -3
- package/dist/scripts/prepare-wrangler-config.d.ts +6 -2
- package/dist/scripts/prepare-wrangler-config.d.ts.map +1 -1
- package/dist/scripts/prepare-wrangler-config.js +1 -2
- package/dist/scripts/prepare-wrangler-config.js.map +3 -3
- package/dist/scripts/validate-locales.d.ts +20 -2
- package/dist/scripts/validate-locales.d.ts.map +1 -1
- package/dist/scripts/validate-locales.js +5 -5
- package/dist/scripts/validate-locales.js.map +3 -3
- package/dist/scripts/verify-spa-shell.d.ts +7 -2
- package/dist/scripts/verify-spa-shell.d.ts.map +1 -1
- package/dist/scripts/verify-spa-shell.js +1 -2
- package/dist/scripts/verify-spa-shell.js.map +3 -3
- package/dist/vite.d.ts +2 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -3
- package/dist/vite.js.map +3 -3
- package/dist/vitest-integration.d.ts +3 -2
- package/dist/vitest-integration.d.ts.map +1 -1
- package/dist/vitest-integration.js +1 -1
- package/dist/vitest-integration.js.map +3 -3
- package/dist/vitest-repo.d.ts +3 -2
- package/dist/vitest-repo.d.ts.map +1 -1
- package/dist/vitest-repo.js +1 -1
- package/dist/vitest-repo.js.map +3 -3
- package/dist/vitest-web.d.ts +3 -2
- package/dist/vitest-web.d.ts.map +1 -1
- package/dist/vitest-web.js +1 -1
- package/dist/vitest-web.js.map +3 -3
- package/dist/vitest.d.ts +3 -2
- package/dist/vitest.d.ts.map +1 -1
- package/dist/vitest.js +1 -1
- package/dist/vitest.js.map +3 -3
- package/package.json +3 -3
- package/src/eslint-options.ts +54 -0
- package/src/eslint.ts +2 -53
- package/src/pages-proxy.test.ts +8 -0
- package/src/pages-proxy.ts +13 -0
- package/src/plugin-option.test.ts +13 -0
- package/src/plugin-option.ts +18 -0
- package/src/scripts/ensure-spa-shell-stub.ts +18 -10
- package/src/scripts/entrypoints.test.ts +55 -0
- package/src/scripts/init-secrets.ts +8 -6
- package/src/scripts/migrations-lock.ts +22 -17
- package/src/scripts/prepare-wrangler-config.ts +26 -14
- package/src/scripts/validate-locales.ts +39 -17
- package/src/scripts/verify-spa-shell.ts +21 -20
- package/src/vite.ts +5 -3
- package/src/vitest-integration.ts +5 -3
- package/src/vitest-repo.ts +5 -3
- package/src/vitest-web.ts +5 -3
- package/src/vitest.ts +5 -3
package/README.md
CHANGED
|
@@ -331,6 +331,13 @@ import, so the module typechecks without a generated `worker-configuration.d.ts`
|
|
|
331
331
|
`createPagesProxy({ forwardClientIp: false })` is the Edge-Sonic variant, for a
|
|
332
332
|
worker that refuses `X-Forwarded-For` outright.
|
|
333
333
|
|
|
334
|
+
With the default options the whole file is a re-export (this is what `rexezuge sync` writes):
|
|
335
|
+
|
|
336
|
+
```ts
|
|
337
|
+
// functions/[[path]].ts
|
|
338
|
+
export { onRequest } from '@rexezuge/tooling/pages-proxy';
|
|
339
|
+
```
|
|
340
|
+
|
|
334
341
|
---
|
|
335
342
|
|
|
336
343
|
## 3. Test helpers
|
|
@@ -369,14 +376,28 @@ file and the statement.
|
|
|
369
376
|
|
|
370
377
|
## 4. Scripts
|
|
371
378
|
|
|
372
|
-
|
|
373
|
-
repo (that is the intended use — they resolve paths relative to the repository they
|
|
374
|
-
run in), or run it straight out of the installed package:
|
|
379
|
+
Run them through the [`rexezuge` CLI](../cli/README.md), which imports them as functions and runs compiled JavaScript on Node 24 (no `tsx`):
|
|
375
380
|
|
|
376
381
|
```bash
|
|
377
|
-
pnpm
|
|
382
|
+
pnpm add -D @rexezuge/cli
|
|
383
|
+
pnpm exec rexezuge god-files # check-god-files
|
|
384
|
+
pnpm exec rexezuge spa-shell ensure # ensure-spa-shell-stub
|
|
385
|
+
pnpm exec rexezuge spa-shell verify # verify-spa-shell
|
|
386
|
+
pnpm exec rexezuge locales validate # validate-locales
|
|
387
|
+
pnpm exec rexezuge migrations verify # verify-migrations
|
|
388
|
+
pnpm exec rexezuge migrations lock # migrations-lock
|
|
389
|
+
pnpm exec rexezuge prepare-wrangler # prepare-wrangler-config
|
|
390
|
+
pnpm exec rexezuge init-secrets # init-secrets
|
|
378
391
|
```
|
|
379
392
|
|
|
393
|
+
**Deprecated, still working:** running a script's `.ts` file directly (`pnpm exec tsx node_modules/@rexezuge/tooling/src/scripts/<name>.ts [args]`) or copying
|
|
394
|
+
the `scripts/` tree into a repo. Both keep their command-line behaviour and exit codes, but a vendored copy is exactly what `rexezuge doctor` flags
|
|
395
|
+
(`vendored.*`); switch the `package.json` script and the workflow step to the CLI and delete the copy.
|
|
396
|
+
|
|
397
|
+
Every entrypoint also exports its work as a function, so the CLI (and your own tooling) can call it without a subprocess: `main(args)` in
|
|
398
|
+
`ensure-spa-shell-stub`, `verify-spa-shell`, `migrations-lock`, `prepare-wrangler-config` (reads `process.env` and `process.cwd()` when first imported) and `init-secrets` (async),
|
|
399
|
+
plus the pure rule functions (`checkGodFiles`, `verifyMigrations`, `verifySpaShell`, `collectLocaleProblems`). Each module runs its CLI only when it is the entrypoint.
|
|
400
|
+
|
|
380
401
|
| Script | What it does | Usage |
|
|
381
402
|
| ---------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
382
403
|
| `check-god-files.ts` | 300-line warn / 400-line critical guard, warn-only by default, with an allowlist | `--root <dir>` `--allowlist <file>` `--soft 300` `--hard 400` `--fail-on-hard` |
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LayerBan } from './eslint-boundaries.ts';
|
|
2
|
+
import type { FamilyManifest } from './manifest.ts';
|
|
3
|
+
/**
|
|
4
|
+
* What `defineRepoLintConfig` accepts.
|
|
5
|
+
*/
|
|
6
|
+
export interface RepoLintConfigOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
|
|
9
|
+
* pattern in the boundary rules is derived from it, so the same factory serves
|
|
10
|
+
* all nine repos.
|
|
11
|
+
*/
|
|
12
|
+
readonly scope?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is
|
|
15
|
+
* loaded when it exists. Pass `false` to ignore the file. A manifest supplies
|
|
16
|
+
* `scope` (unless given here), replaces the canonical layer table with its own
|
|
17
|
+
* `layers` (when it declares any), and names the http and browser directories
|
|
18
|
+
* the strict rules exempt.
|
|
19
|
+
*/
|
|
20
|
+
readonly manifest?: FamilyManifest | false;
|
|
21
|
+
/**
|
|
22
|
+
* Extra http-layer directories (may import `hono`/`chanfana`, hand-build the
|
|
23
|
+
* error envelope), beside `apps/api` and the manifest's `http: true` layers.
|
|
24
|
+
*/
|
|
25
|
+
readonly httpDirs?: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* The workspace directories the legacy canonical layer table is scoped to, as
|
|
28
|
+
* repo-relative globs. Only used when no manifest declares `layers`.
|
|
29
|
+
*
|
|
30
|
+
* @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical
|
|
31
|
+
* table encodes consumer package names.
|
|
32
|
+
*/
|
|
33
|
+
readonly projectDirs?: readonly string[];
|
|
34
|
+
/**
|
|
35
|
+
* Extra ignore globs, merged with the canonical set.
|
|
36
|
+
*/
|
|
37
|
+
readonly extraIgnores?: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Where `projectService` resolves the tsconfig from. Defaults to the directory
|
|
40
|
+
* ESLint is invoked in, which is the repo root in every CI job.
|
|
41
|
+
*/
|
|
42
|
+
readonly tsconfigRootDir?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Extra boundary layers, appended to the canonical table.
|
|
45
|
+
*
|
|
46
|
+
* The escape valve for a repo whose layout has a boundary the canonical table
|
|
47
|
+
* does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
|
|
48
|
+
* classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
|
|
49
|
+
* Same {@link LayerBan} form, so `extraLayers` flows through the
|
|
50
|
+
* `no-restricted-imports` and the `no-restricted-syntax` guard alike.
|
|
51
|
+
*/
|
|
52
|
+
readonly extraLayers?: readonly LayerBan[];
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=eslint-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-options.d.ts","sourceRoot":"","sources":["../src/eslint-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,KAAK,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;;;OAQG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC5C"}
|
|
File without changes
|
package/dist/eslint.d.ts
CHANGED
|
@@ -50,59 +50,8 @@
|
|
|
50
50
|
* {@link RepoLintConfigOptions}.
|
|
51
51
|
*/
|
|
52
52
|
import type { FlatConfig } from 'typescript-eslint';
|
|
53
|
-
import type {
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* What `defineRepoLintConfig` accepts.
|
|
57
|
-
*/
|
|
58
|
-
export interface RepoLintConfigOptions {
|
|
59
|
-
/**
|
|
60
|
-
* The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`
|
|
61
|
-
* pattern in the boundary rules is derived from it, so the same factory serves
|
|
62
|
-
* all nine repos.
|
|
63
|
-
*/
|
|
64
|
-
readonly scope?: string;
|
|
65
|
-
/**
|
|
66
|
-
* The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is
|
|
67
|
-
* loaded when it exists. Pass `false` to ignore the file. A manifest supplies
|
|
68
|
-
* `scope` (unless given here), replaces the canonical layer table with its own
|
|
69
|
-
* `layers` (when it declares any), and names the http and browser directories
|
|
70
|
-
* the strict rules exempt.
|
|
71
|
-
*/
|
|
72
|
-
readonly manifest?: FamilyManifest | false;
|
|
73
|
-
/**
|
|
74
|
-
* Extra http-layer directories (may import `hono`/`chanfana`, hand-build the
|
|
75
|
-
* error envelope), beside `apps/api` and the manifest's `http: true` layers.
|
|
76
|
-
*/
|
|
77
|
-
readonly httpDirs?: readonly string[];
|
|
78
|
-
/**
|
|
79
|
-
* The workspace directories the legacy canonical layer table is scoped to, as
|
|
80
|
-
* repo-relative globs. Only used when no manifest declares `layers`.
|
|
81
|
-
*
|
|
82
|
-
* @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical
|
|
83
|
-
* table encodes consumer package names.
|
|
84
|
-
*/
|
|
85
|
-
readonly projectDirs?: readonly string[];
|
|
86
|
-
/**
|
|
87
|
-
* Extra ignore globs, merged with the canonical set.
|
|
88
|
-
*/
|
|
89
|
-
readonly extraIgnores?: readonly string[];
|
|
90
|
-
/**
|
|
91
|
-
* Where `projectService` resolves the tsconfig from. Defaults to the directory
|
|
92
|
-
* ESLint is invoked in, which is the repo root in every CI job.
|
|
93
|
-
*/
|
|
94
|
-
readonly tsconfigRootDir?: string;
|
|
95
|
-
/**
|
|
96
|
-
* Extra boundary layers, appended to the canonical table.
|
|
97
|
-
*
|
|
98
|
-
* The escape valve for a repo whose layout has a boundary the canonical table
|
|
99
|
-
* does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule ("route
|
|
100
|
-
* classes must not import DAOs directly") and its `aws4fetch` ban are the shape.
|
|
101
|
-
* Same {@link LayerBan} form, so `extraLayers` flows through the
|
|
102
|
-
* `no-restricted-imports` and the `no-restricted-syntax` guard alike.
|
|
103
|
-
*/
|
|
104
|
-
readonly extraLayers?: readonly LayerBan[];
|
|
105
|
-
}
|
|
53
|
+
import type { RepoLintConfigOptions } from './eslint-options.ts';
|
|
54
|
+
export type { RepoLintConfigOptions } from './eslint-options.ts';
|
|
106
55
|
/**
|
|
107
56
|
* Build the repo's flat config.
|
|
108
57
|
*
|
package/dist/eslint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"eslint.d.ts","sourceRoot":"","sources":["../src/eslint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AASH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAMjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAsCjE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,UAAU,CAAC,WAAW,CA4I3F"}
|
package/dist/eslint.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/eslint.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * The converged ESLint flat config for a monorepo in the Rexezuge family.\n *\n * Provenance: the base is Durable-DAV's `eslint.config.mjs` (the most\n * elaborate of the nine repos, with the layered `no-restricted-imports` boundary\n * rules). Merged in from the stacks that share the same plugin set:\n *\n * - **Edge-Sonic** — `test/**` is *not* ignored (it is linted like everything else,\n * with a narrow override block for Vitest idioms), and `unicorn/prefer-ternary`\n * is off. Edge-Sonic is also the source for the dynamic-`import()` boundary\n * guard and its `apps/web` layer block.\n * - **Mail-Meow** — `prettier/prettier` is an **error**, not a warning.\n * - **AWS-AccessBridge** — the `apps/api` DAO/service boundary uses\n * `allowTypeImports` where the source repos do not. It is also the source for\n * the anchored skip patterns and the symlink-safe walk that came out of its own\n * backlog.\n * - **CalDAV-Bridge, Mail-Otter, Durable-DAV-Router, Edge-Git, Agent-Router** —\n * the `provider-clients` / `webdav`+`dav-store` / `git-protocol`+`git-service`\n * layers and the per-client `apps/api` alternatives in the boundary table.\n *\n * Canonical decisions, and why each one:\n *\n * 1. **`prettier/prettier: 'error'`.** Three of the four source repos had it at\n * `warn`, which under `eslint --quiet` is unenforceable — a gate nobody can see\n * is a gate that has never run. Formatting drift is therefore a hard failure.\n * 2. **The layered boundary rules are parameterized by `scope`.** Every source\n * repo wrote the same blocks with a different npm scope hardcoded; the\n * factory takes `scope` (`'@myapp'`) and generates the `@myapp/*` patterns.\n * The table itself lives in {@link ./eslint-boundaries.ts} and covers the\n * family superset — a repo without a domain package never triggers its ban,\n * so no repo needs `extraLayers` for a known package.\n * 3. **`test/**` is linted, not ignored.** Durable-DAV/AWS/Mail-Meow ignored it;\n * Edge-Sonic does not, and records why: ~200 KB of test code had accumulated\n * violations that nothing reported.\n * 4. **`apps/web` is a layer in its own right**, banned from every `@scope/*`\n * package. Edge-Sonic is the only source with that block; the others had none,\n * which is how their layer table's \"may import: the browser\" was a convention\n * rather than a gate. A backend package imported by the SPA compiles and then\n * fails at bundle time, with the error pointing at the bundler.\n * 5. **jsdom + node globals for web files.** The sources ran `globals.node` only;\n * `apps/web` needs browser globals as well, and the vitest config for the SPA\n * runs under jsdom, so the lint environment matches the test environment.\n * 6. **`eslint-plugin-react-hooks` is NOT imported here.** The kit stays\n * zero-dependency, and the plugin belongs to the app that has JSX. A consumer\n * appends it — the README shows the four lines.\n *\n * The rule bodies live in {@link ./eslint-rules.ts} and the boundary table in\n * {@link ./eslint-boundaries.ts}; this file is the assembly. A repo that needs a\n * boundary the canonical table does not name passes `extraLayers` — see\n * {@link RepoLintConfigOptions}.\n */\n\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\nimport unicorn from 'eslint-plugin-unicorn';\nimport { configs as sonarjsConfigs } from 'eslint-plugin-sonarjs';\nimport pluginRegexp from 'eslint-plugin-regexp';\nimport eslintConfigPrettier from 'eslint-config-prettier';\nimport prettier from 'eslint-plugin-prettier';\nimport type { FlatConfig } from 'typescript-eslint';\nimport { DEFAULT_PROJECT_DIRS, layerBans, restrictedDynamicImports, restrictedImports } from './eslint-boundaries.ts';\nimport type { LayerBan } from './eslint-boundaries.ts';\nimport { manifestBrowserDirs, manifestHttpDirs, manifestLayerBans } from './eslint-manifest.ts';\nimport { strictConfigs } from './eslint-strict.ts';\nimport { loadManifest } from './manifest.ts';\nimport type { FamilyManifest } from './manifest.ts';\nimport { SONARJS_RULES, TEST_RULES, TYPESCRIPT_RULES, UNICORN_RULES } from './eslint-rules.ts';\n\n/**\n * What `defineRepoLintConfig` accepts.\n */\nexport interface RepoLintConfigOptions {\n /**\n * The consuming repo's npm scope, e.g. `'@myapp'`. Every `no-restricted-imports`\n * pattern in the boundary rules is derived from it, so the same factory serves\n * all nine repos.\n */\n readonly scope?: string;\n /**\n * The family manifest. Omitted: `<tsconfigRootDir or cwd>/.rexezuge.jsonc` is\n * loaded when it exists. Pass `false` to ignore the file. A manifest supplies\n * `scope` (unless given here), replaces the canonical layer table with its own\n * `layers` (when it declares any), and names the http and browser directories\n * the strict rules exempt.\n */\n readonly manifest?: FamilyManifest | false;\n /**\n * Extra http-layer directories (may import `hono`/`chanfana`, hand-build the\n * error envelope), beside `apps/api` and the manifest's `http: true` layers.\n */\n readonly httpDirs?: readonly string[];\n /**\n * The workspace directories the legacy canonical layer table is scoped to, as\n * repo-relative globs. Only used when no manifest declares `layers`.\n *\n * @deprecated Declare `layers` in `.rexezuge.jsonc` instead: the canonical\n * table encodes consumer package names.\n */\n readonly projectDirs?: readonly string[];\n /**\n * Extra ignore globs, merged with the canonical set.\n */\n readonly extraIgnores?: readonly string[];\n /**\n * Where `projectService` resolves the tsconfig from. Defaults to the directory\n * ESLint is invoked in, which is the repo root in every CI job.\n */\n readonly tsconfigRootDir?: string;\n /**\n * Extra boundary layers, appended to the canonical table.\n *\n * The escape valve for a repo whose layout has a boundary the canonical table\n * does not name — AWS-AccessBridge's `apps/api/src/endpoints/**` rule (\"route\n * classes must not import DAOs directly\") and its `aws4fetch` ban are the shape.\n * Same {@link LayerBan} form, so `extraLayers` flows through the\n * `no-restricted-imports` and the `no-restricted-syntax` guard alike.\n */\n readonly extraLayers?: readonly LayerBan[];\n}\n\n/**\n * One argument to `tseslint.config()`.\n */\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\n/**\n * A plugin preset or config object as the source repos pass it.\n */\ntype MaybeConfig = FlatConfig.Config | readonly FlatConfig.Config[];\n\n/**\n * Bridge a third-party preset into `tseslint.config()`.\n *\n * `sonarjs`' `recommended` preset is typed as a union that includes the legacy\n * config shape, which `tseslint.config()` does not accept — but ESLint accepts it\n * at runtime, which is the only thing that matters here. One checked assertion,\n * rather than forking the plugin's own types.\n */\nfunction asConfig(config: MaybeConfig): ConfigInput {\n return config as ConfigInput;\n}\n\n/**\n * Bridge a rule block onto `tseslint.config()`'s `rules` field.\n *\n * The blocks in `eslint-rules.ts` are written as ESLint expects them —\n * `'off' | 'warn' | 'error' | [level, ...options]` — but spelled as data so a\n * rule's reason comment sits beside the rule itself. ESLint's own `RuleEntry`\n * union is narrower than the data shape, and widening every entry to that union\n * would buy nothing; one assertion here, with the reason, is the cheaper and\n * more honest of the two.\n */\nfunction asRules(block: Readonly<Record<string, unknown>>): FlatConfig.Config['rules'] {\n return block as FlatConfig.Config['rules'];\n}\n\n/**\n * Build the repo's flat config.\n *\n * Consumed from the repo root as three lines:\n *\n * ```js\n * // eslint.config.mjs\n * import { defineRepoLintConfig } from '@rexezuge/tooling/eslint';\n * export default defineRepoLintConfig({ scope: '@myapp' });\n * ```\n */\nexport function defineRepoLintConfig(options: RepoLintConfigOptions): FlatConfig.ConfigArray {\n const manifest = options.manifest === false ? null : (options.manifest ?? loadManifest(options.tsconfigRootDir ?? process.cwd()));\n const scope = options.scope ?? manifest?.scope;\n if (scope === undefined) throw new Error('defineRepoLintConfig: pass `scope`, or add a `.rexezuge.jsonc` manifest that declares it.');\n const projectDirs = options.projectDirs ?? DEFAULT_PROJECT_DIRS;\n const layerRows =\n manifest?.layers === undefined\n ? layerBans(scope).filter((layer) => projectDirs.some((dir) => layer.dir.startsWith(dir)))\n : manifestLayerBans(manifest);\n const bans = [...layerRows, ...(options.extraLayers ?? [])];\n const browserDirs = manifestBrowserDirs(manifest);\n\n return tseslint.config(\n {\n ignores: [\n 'eslint.config.mjs',\n 'eslint.config.js',\n 'scripts/**',\n 'worker-configuration.d.ts',\n 'local/**',\n 'app/dist/**',\n 'apps/web/dist/**',\n 'apps/*/dist/**',\n 'src/generated/**',\n 'apps/api/src/generated/**',\n 'coverage/**',\n 'coverage-integration/**',\n 'coverage-web/**',\n 'node_modules/**',\n ...(options.extraIgnores ?? []),\n ],\n },\n\n // Base: globals for all JS/TS source files. Node is the floor because the\n // scripts and the workers both run on it; the web block below adds browser\n // globals rather than replacing them, so a shared file that touches both\n // (there are several in `shared/`) still lints.\n {\n files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'],\n languageOptions: {\n globals: globals.node,\n },\n },\n\n // Type-aware TS rules, scoped to TS files only.\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n extends: tseslint.configs.recommendedTypeChecked,\n languageOptions: {\n parserOptions: {\n projectService: true,\n tsconfigRootDir: options.tsconfigRootDir ?? process.cwd(),\n },\n },\n },\n\n // --- typescript-eslint overrides (identical in all four source stacks) ---\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n rules: asRules(TYPESCRIPT_RULES),\n },\n\n // --- Unicorn + SonarJS presets, then the family's off-block ---\n //\n // Both presets come first on purpose: UNICORN_RULES carries `sonarjs/*`\n // offs as well as `unicorn/*` ones (it is the family's single\n // \"deliberately does not follow\" block), and a preset applied after it\n // would re-enable them. That is exactly what shipped — the sonarjs preset\n // sat between the block and the rules it relaxed, so `void-use`,\n // `different-types-comparison`, `use-type-alias`, `redundant-type-aliases`,\n // `no-nested-assignment` and `no-all-duplicated-branches` linted as errors\n // in every consumer. The two presets do not share rule names, so their\n // relative order decides nothing.\n //\n // The unicorn preset is read from whichever spelling the installed major\n // publishes. v78 dropped the `flat/`-prefixed aliases and exports the flat\n // configs directly, so `configs['flat/recommended']` is `undefined` there —\n // and a config object built around it is `undefined` too, which ESLint\n // rejects outright with \"Unexpected undefined config\". The fallback is\n // what makes the factory work on both majors rather than only the one the\n // kit was written against.\n asConfig(unicorn.configs['flat/recommended'] ?? unicorn.configs.recommended),\n asConfig(sonarjsConfigs.recommended),\n {\n rules: asRules(UNICORN_RULES),\n },\n\n // --- SonarJS advisories ---\n {\n rules: asRules(SONARJS_RULES),\n },\n\n // --- Regexp: static analysis for regular expressions ---\n asConfig(pluginRegexp.configs['flat/recommended']),\n\n // --- Prettier: formatting drift is a hard error ---\n //\n // Mail-Meow's decision, adopted repo-wide because the alternative is\n // unenforceable: `pnpm run lint` is `eslint --fix --quiet` in three of the\n // four source repos, and `--quiet` discards every warning, so a\n // `prettier/prettier` *warning* is a silent no-op. 242 files were in that\n // state in Edge-Sonic: the gate had never run.\n asConfig(eslintConfigPrettier),\n {\n plugins: { prettier },\n rules: {\n 'prettier/prettier': 'error',\n },\n },\n\n // --- Import direction guardrails (parameterized by scope) ---\n ...restrictedImports(bans),\n ...restrictedDynamicImports(bans),\n\n // --- Strict side: family rules a repo waives per file, never wholesale ---\n ...strictConfigs({ httpDirs: [...manifestHttpDirs(manifest), ...(options.httpDirs ?? [])], browserDirs }),\n\n // --- Web: browser globals, matching the jsdom test environment ---\n //\n // The sources linted `apps/web` under `globals.node` only, so `window`,\n // `document` and `localStorage` read as undefined globals. The vitest web\n // config runs those suites under jsdom; the lint environment should agree\n // with the environment the code is executed in, or the rule is reporting\n // something untrue about how the file behaves.\n {\n files: browserDirs.map((dir) => `${dir}/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}`),\n languageOptions: {\n globals: { ...globals.node, ...globals.browser },\n },\n },\n\n // --- Test suite ---\n //\n // `test/**` is deliberately NOT in the ignores list above. See TEST_RULES\n // for the override block and the reasoning behind it.\n {\n files: ['test/**/*.{ts,tsx,mts,cts}', '**/*.test.{ts,tsx,mts,cts}', '**/*.spec.{ts,tsx,mts,cts}'],\n rules: asRules(TEST_RULES),\n },\n );\n}\n"],
|
|
5
|
-
"mappings": "+EAoDA,OAAOA,MAAa,UACpB,OAAOC,MAAc,oBACrB,OAAOC,MAAa,wBACpB,OAAS,WAAWC,MAAsB,wBAC1C,OAAOC,MAAkB,uBACzB,OAAOC,MAA0B,yBACjC,OAAOC,MAAc,yBAErB,OAAS,wBAAAC,EAAsB,aAAAC,EAAW,4BAAAC,EAA0B,qBAAAC,MAAyB,yBAE7F,OAAS,uBAAAC,EAAqB,oBAAAC,EAAkB,qBAAAC,MAAyB,uBACzE,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,gBAAAC,MAAoB,
|
|
4
|
+
"sourcesContent": ["/**\n * The converged ESLint flat config for a monorepo in the Rexezuge family.\n *\n * Provenance: the base is Durable-DAV's `eslint.config.mjs` (the most\n * elaborate of the nine repos, with the layered `no-restricted-imports` boundary\n * rules). Merged in from the stacks that share the same plugin set:\n *\n * - **Edge-Sonic** — `test/**` is *not* ignored (it is linted like everything else,\n * with a narrow override block for Vitest idioms), and `unicorn/prefer-ternary`\n * is off. Edge-Sonic is also the source for the dynamic-`import()` boundary\n * guard and its `apps/web` layer block.\n * - **Mail-Meow** — `prettier/prettier` is an **error**, not a warning.\n * - **AWS-AccessBridge** — the `apps/api` DAO/service boundary uses\n * `allowTypeImports` where the source repos do not. It is also the source for\n * the anchored skip patterns and the symlink-safe walk that came out of its own\n * backlog.\n * - **CalDAV-Bridge, Mail-Otter, Durable-DAV-Router, Edge-Git, Agent-Router** —\n * the `provider-clients` / `webdav`+`dav-store` / `git-protocol`+`git-service`\n * layers and the per-client `apps/api` alternatives in the boundary table.\n *\n * Canonical decisions, and why each one:\n *\n * 1. **`prettier/prettier: 'error'`.** Three of the four source repos had it at\n * `warn`, which under `eslint --quiet` is unenforceable — a gate nobody can see\n * is a gate that has never run. Formatting drift is therefore a hard failure.\n * 2. **The layered boundary rules are parameterized by `scope`.** Every source\n * repo wrote the same blocks with a different npm scope hardcoded; the\n * factory takes `scope` (`'@myapp'`) and generates the `@myapp/*` patterns.\n * The table itself lives in {@link ./eslint-boundaries.ts} and covers the\n * family superset — a repo without a domain package never triggers its ban,\n * so no repo needs `extraLayers` for a known package.\n * 3. **`test/**` is linted, not ignored.** Durable-DAV/AWS/Mail-Meow ignored it;\n * Edge-Sonic does not, and records why: ~200 KB of test code had accumulated\n * violations that nothing reported.\n * 4. **`apps/web` is a layer in its own right**, banned from every `@scope/*`\n * package. Edge-Sonic is the only source with that block; the others had none,\n * which is how their layer table's \"may import: the browser\" was a convention\n * rather than a gate. A backend package imported by the SPA compiles and then\n * fails at bundle time, with the error pointing at the bundler.\n * 5. **jsdom + node globals for web files.** The sources ran `globals.node` only;\n * `apps/web` needs browser globals as well, and the vitest config for the SPA\n * runs under jsdom, so the lint environment matches the test environment.\n * 6. **`eslint-plugin-react-hooks` is NOT imported here.** The kit stays\n * zero-dependency, and the plugin belongs to the app that has JSX. A consumer\n * appends it — the README shows the four lines.\n *\n * The rule bodies live in {@link ./eslint-rules.ts} and the boundary table in\n * {@link ./eslint-boundaries.ts}; this file is the assembly. A repo that needs a\n * boundary the canonical table does not name passes `extraLayers` — see\n * {@link RepoLintConfigOptions}.\n */\n\nimport globals from 'globals';\nimport tseslint from 'typescript-eslint';\nimport unicorn from 'eslint-plugin-unicorn';\nimport { configs as sonarjsConfigs } from 'eslint-plugin-sonarjs';\nimport pluginRegexp from 'eslint-plugin-regexp';\nimport eslintConfigPrettier from 'eslint-config-prettier';\nimport prettier from 'eslint-plugin-prettier';\nimport type { FlatConfig } from 'typescript-eslint';\nimport { DEFAULT_PROJECT_DIRS, layerBans, restrictedDynamicImports, restrictedImports } from './eslint-boundaries.ts';\nimport type { RepoLintConfigOptions } from './eslint-options.ts';\nimport { manifestBrowserDirs, manifestHttpDirs, manifestLayerBans } from './eslint-manifest.ts';\nimport { strictConfigs } from './eslint-strict.ts';\nimport { loadManifest } from './manifest.ts';\nimport { SONARJS_RULES, TEST_RULES, TYPESCRIPT_RULES, UNICORN_RULES } from './eslint-rules.ts';\n\nexport type { RepoLintConfigOptions } from './eslint-options.ts';\n\n/**\n * One argument to `tseslint.config()`.\n */\ntype ConfigInput = Parameters<typeof tseslint.config>[number];\n\n/**\n * A plugin preset or config object as the source repos pass it.\n */\ntype MaybeConfig = FlatConfig.Config | readonly FlatConfig.Config[];\n\n/**\n * Bridge a third-party preset into `tseslint.config()`.\n *\n * `sonarjs`' `recommended` preset is typed as a union that includes the legacy\n * config shape, which `tseslint.config()` does not accept — but ESLint accepts it\n * at runtime, which is the only thing that matters here. One checked assertion,\n * rather than forking the plugin's own types.\n */\nfunction asConfig(config: MaybeConfig): ConfigInput {\n return config as ConfigInput;\n}\n\n/**\n * Bridge a rule block onto `tseslint.config()`'s `rules` field.\n *\n * The blocks in `eslint-rules.ts` are written as ESLint expects them —\n * `'off' | 'warn' | 'error' | [level, ...options]` — but spelled as data so a\n * rule's reason comment sits beside the rule itself. ESLint's own `RuleEntry`\n * union is narrower than the data shape, and widening every entry to that union\n * would buy nothing; one assertion here, with the reason, is the cheaper and\n * more honest of the two.\n */\nfunction asRules(block: Readonly<Record<string, unknown>>): FlatConfig.Config['rules'] {\n return block as FlatConfig.Config['rules'];\n}\n\n/**\n * Build the repo's flat config.\n *\n * Consumed from the repo root as three lines:\n *\n * ```js\n * // eslint.config.mjs\n * import { defineRepoLintConfig } from '@rexezuge/tooling/eslint';\n * export default defineRepoLintConfig({ scope: '@myapp' });\n * ```\n */\nexport function defineRepoLintConfig(options: RepoLintConfigOptions): FlatConfig.ConfigArray {\n const manifest = options.manifest === false ? null : (options.manifest ?? loadManifest(options.tsconfigRootDir ?? process.cwd()));\n const scope = options.scope ?? manifest?.scope;\n if (scope === undefined) throw new Error('defineRepoLintConfig: pass `scope`, or add a `.rexezuge.jsonc` manifest that declares it.');\n const projectDirs = options.projectDirs ?? DEFAULT_PROJECT_DIRS;\n const layerRows =\n manifest?.layers === undefined\n ? layerBans(scope).filter((layer) => projectDirs.some((dir) => layer.dir.startsWith(dir)))\n : manifestLayerBans(manifest);\n const bans = [...layerRows, ...(options.extraLayers ?? [])];\n const browserDirs = manifestBrowserDirs(manifest);\n\n return tseslint.config(\n {\n ignores: [\n 'eslint.config.mjs',\n 'eslint.config.js',\n 'scripts/**',\n 'worker-configuration.d.ts',\n 'local/**',\n 'app/dist/**',\n 'apps/web/dist/**',\n 'apps/*/dist/**',\n 'src/generated/**',\n 'apps/api/src/generated/**',\n 'coverage/**',\n 'coverage-integration/**',\n 'coverage-web/**',\n 'node_modules/**',\n ...(options.extraIgnores ?? []),\n ],\n },\n\n // Base: globals for all JS/TS source files. Node is the floor because the\n // scripts and the workers both run on it; the web block below adds browser\n // globals rather than replacing them, so a shared file that touches both\n // (there are several in `shared/`) still lints.\n {\n files: ['**/*.{js,mjs,cjs,ts,mts,cts,tsx,jsx}'],\n languageOptions: {\n globals: globals.node,\n },\n },\n\n // Type-aware TS rules, scoped to TS files only.\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n extends: tseslint.configs.recommendedTypeChecked,\n languageOptions: {\n parserOptions: {\n projectService: true,\n tsconfigRootDir: options.tsconfigRootDir ?? process.cwd(),\n },\n },\n },\n\n // --- typescript-eslint overrides (identical in all four source stacks) ---\n {\n files: ['**/*.{ts,mts,cts,tsx}'],\n rules: asRules(TYPESCRIPT_RULES),\n },\n\n // --- Unicorn + SonarJS presets, then the family's off-block ---\n //\n // Both presets come first on purpose: UNICORN_RULES carries `sonarjs/*`\n // offs as well as `unicorn/*` ones (it is the family's single\n // \"deliberately does not follow\" block), and a preset applied after it\n // would re-enable them. That is exactly what shipped — the sonarjs preset\n // sat between the block and the rules it relaxed, so `void-use`,\n // `different-types-comparison`, `use-type-alias`, `redundant-type-aliases`,\n // `no-nested-assignment` and `no-all-duplicated-branches` linted as errors\n // in every consumer. The two presets do not share rule names, so their\n // relative order decides nothing.\n //\n // The unicorn preset is read from whichever spelling the installed major\n // publishes. v78 dropped the `flat/`-prefixed aliases and exports the flat\n // configs directly, so `configs['flat/recommended']` is `undefined` there —\n // and a config object built around it is `undefined` too, which ESLint\n // rejects outright with \"Unexpected undefined config\". The fallback is\n // what makes the factory work on both majors rather than only the one the\n // kit was written against.\n asConfig(unicorn.configs['flat/recommended'] ?? unicorn.configs.recommended),\n asConfig(sonarjsConfigs.recommended),\n {\n rules: asRules(UNICORN_RULES),\n },\n\n // --- SonarJS advisories ---\n {\n rules: asRules(SONARJS_RULES),\n },\n\n // --- Regexp: static analysis for regular expressions ---\n asConfig(pluginRegexp.configs['flat/recommended']),\n\n // --- Prettier: formatting drift is a hard error ---\n //\n // Mail-Meow's decision, adopted repo-wide because the alternative is\n // unenforceable: `pnpm run lint` is `eslint --fix --quiet` in three of the\n // four source repos, and `--quiet` discards every warning, so a\n // `prettier/prettier` *warning* is a silent no-op. 242 files were in that\n // state in Edge-Sonic: the gate had never run.\n asConfig(eslintConfigPrettier),\n {\n plugins: { prettier },\n rules: {\n 'prettier/prettier': 'error',\n },\n },\n\n // --- Import direction guardrails (parameterized by scope) ---\n ...restrictedImports(bans),\n ...restrictedDynamicImports(bans),\n\n // --- Strict side: family rules a repo waives per file, never wholesale ---\n ...strictConfigs({ httpDirs: [...manifestHttpDirs(manifest), ...(options.httpDirs ?? [])], browserDirs }),\n\n // --- Web: browser globals, matching the jsdom test environment ---\n //\n // The sources linted `apps/web` under `globals.node` only, so `window`,\n // `document` and `localStorage` read as undefined globals. The vitest web\n // config runs those suites under jsdom; the lint environment should agree\n // with the environment the code is executed in, or the rule is reporting\n // something untrue about how the file behaves.\n {\n files: browserDirs.map((dir) => `${dir}/**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}`),\n languageOptions: {\n globals: { ...globals.node, ...globals.browser },\n },\n },\n\n // --- Test suite ---\n //\n // `test/**` is deliberately NOT in the ignores list above. See TEST_RULES\n // for the override block and the reasoning behind it.\n {\n files: ['test/**/*.{ts,tsx,mts,cts}', '**/*.test.{ts,tsx,mts,cts}', '**/*.spec.{ts,tsx,mts,cts}'],\n rules: asRules(TEST_RULES),\n },\n );\n}\n"],
|
|
5
|
+
"mappings": "+EAoDA,OAAOA,MAAa,UACpB,OAAOC,MAAc,oBACrB,OAAOC,MAAa,wBACpB,OAAS,WAAWC,MAAsB,wBAC1C,OAAOC,MAAkB,uBACzB,OAAOC,MAA0B,yBACjC,OAAOC,MAAc,yBAErB,OAAS,wBAAAC,EAAsB,aAAAC,EAAW,4BAAAC,EAA0B,qBAAAC,MAAyB,yBAE7F,OAAS,uBAAAC,EAAqB,oBAAAC,EAAkB,qBAAAC,MAAyB,uBACzE,OAAS,iBAAAC,MAAqB,qBAC9B,OAAS,gBAAAC,MAAoB,gBAC7B,OAAS,iBAAAC,EAAe,cAAAC,EAAY,oBAAAC,EAAkB,iBAAAC,MAAqB,oBAsB3E,SAASC,EAASC,EAAmB,CACnC,OAAOA,CACT,CAFSC,EAAAF,EAAA,YAcT,SAASG,EAAQC,EAAwC,CACvD,OAAOA,CACT,CAFSF,EAAAC,EAAA,WAeH,SAAUE,EAAqBC,EAA8B,CACjE,MAAMC,EAAWD,EAAQ,WAAa,GAAQ,KAAQA,EAAQ,UAAYX,EAAaW,EAAQ,iBAAmB,QAAQ,IAAG,CAAE,EACzHE,EAAQF,EAAQ,OAASC,GAAU,MACzC,GAAIC,IAAU,OAAW,MAAM,IAAI,MAAM,2FAA2F,EACpI,MAAMC,EAAcH,EAAQ,aAAenB,EAKrCuB,EAAO,CAAC,GAHZH,GAAU,SAAW,OACjBnB,EAAUoB,CAAK,EAAE,OAAQG,GAAUF,EAAY,KAAMG,GAAQD,EAAM,IAAI,WAAWC,CAAG,CAAC,CAAC,EACvFnB,EAAkBc,CAAQ,EACJ,GAAID,EAAQ,aAAe,CAAA,CAAG,EACpDO,EAActB,EAAoBgB,CAAQ,EAEhD,OAAO1B,EAAS,OACd,CACE,QAAS,CACP,oBACA,mBACA,aACA,4BACA,WACA,cACA,mBACA,iBACA,mBACA,4BACA,cACA,0BACA,kBACA,kBACA,GAAIyB,EAAQ,cAAgB,CAAA,IAQhC,CACE,MAAO,CAAC,sCAAsC,EAC9C,gBAAiB,CACf,QAAS1B,EAAQ,OAKrB,CACE,MAAO,CAAC,uBAAuB,EAC/B,QAASC,EAAS,QAAQ,uBAC1B,gBAAiB,CACf,cAAe,CACb,eAAgB,GAChB,gBAAiByB,EAAQ,iBAAmB,QAAQ,IAAG,KAM7D,CACE,MAAO,CAAC,uBAAuB,EAC/B,MAAeR,GAsBRhB,EAAQ,QAAQ,kBAAkB,GAAKA,EAAQ,QAAQ,YACvDC,EAAe,YACxB,CACE,MAAegB,GAIjB,CACE,MAAeH,GAIRZ,EAAa,QAAQ,kBAAkB,EASvCC,EACT,CACE,QAAS,CAAE,SAAAC,CAAQ,EACnB,MAAO,CACL,oBAAqB,UAKzB,GAAGI,EAAkBoB,CAAI,EACzB,GAAGrB,EAAyBqB,CAAI,EAGhC,GAAGhB,EAAc,CAAE,SAAU,CAAC,GAAGF,EAAiBe,CAAQ,EAAG,GAAID,EAAQ,UAAY,CAAA,CAAG,EAAG,YAAAO,CAAW,CAAE,EASxG,CACE,MAAOA,EAAY,IAAKD,GAAQ,GAAGA,CAAG,uCAAuC,EAC7E,gBAAiB,CACf,QAAS,CAAE,GAAGhC,EAAQ,KAAM,GAAGA,EAAQ,OAAO,IAQlD,CACE,MAAO,CAAC,6BAA8B,6BAA8B,4BAA4B,EAChG,MAAeiB,EAChB,CAEL,CA5IgBK,EAAAG,EAAA",
|
|
6
6
|
"names": ["globals", "tseslint", "unicorn", "sonarjsConfigs", "pluginRegexp", "eslintConfigPrettier", "prettier", "DEFAULT_PROJECT_DIRS", "layerBans", "restrictedDynamicImports", "restrictedImports", "manifestBrowserDirs", "manifestHttpDirs", "manifestLayerBans", "strictConfigs", "loadManifest", "SONARJS_RULES", "TEST_RULES", "TYPESCRIPT_RULES", "UNICORN_RULES", "asConfig", "config", "__name", "asRules", "block", "defineRepoLintConfig", "options", "manifest", "scope", "projectDirs", "bans", "layer", "dir", "browserDirs"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages-proxy.d.ts","sourceRoot":"","sources":["../src/pages-proxy.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,SAAS,oCAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createPagesProxy as e}from"./functions/pages-proxy.js";const r=e();export{r as onRequest};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/pages-proxy.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The whole `functions/[[path]].ts` of a Pages project that proxies to `API_WORKER`, as a re-export:\n *\n * ```ts\n * export { onRequest } from '@rexezuge/tooling/pages-proxy';\n * ```\n *\n * The default `createPagesProxy()`. A repo that needs an option (`forwardClientIp: false`) keeps\n * the two-line `createPagesProxy({ ... })` form from `@rexezuge/tooling/functions/pages-proxy`.\n */\nimport { createPagesProxy } from './functions/pages-proxy.ts';\n\nexport const onRequest = createPagesProxy();\n"],
|
|
5
|
+
"mappings": "AAUA,OAAS,oBAAAA,MAAwB,6BAE1B,MAAMC,EAAYD,EAAgB",
|
|
6
|
+
"names": ["createPagesProxy", "onRequest"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ViteUserConfig } from 'vitest/config';
|
|
2
|
+
/**
|
|
3
|
+
* What a `plugins` option accepts: whatever a Vite `plugins` array does (a plugin, a nested array of them as
|
|
4
|
+
* `@vitejs/plugin-react` and `@tailwindcss/vite` return, a promise, a falsy placeholder).
|
|
5
|
+
*
|
|
6
|
+
* Deliberately structural rather than Vite's own `PluginOption`: the app's `vite` and the `vite` that
|
|
7
|
+
* `vitest` brings are separate installs more often than not, and their `Plugin` types are not assignable to
|
|
8
|
+
* each other even at the same version ("Excessive stack depth comparing types"). The kit never inspects a plugin.
|
|
9
|
+
*/
|
|
10
|
+
export type PluginOption = object | false | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Hand the plugins to Vite. One assertion, here, for the reason above.
|
|
13
|
+
*/
|
|
14
|
+
export declare function asVitePlugins(plugins: readonly PluginOption[]): NonNullable<ViteUserConfig['plugins']>;
|
|
15
|
+
//# sourceMappingURL=plugin-option.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-option.d.ts","sourceRoot":"","sources":["../src/plugin-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC;AAE7D;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAEtG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=Object.defineProperty;var t=(n,e)=>i(n,"name",{value:e,configurable:!0});function u(n){return[...n]}t(u,"asVitePlugins");export{u as asVitePlugins};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/plugin-option.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ViteUserConfig } from 'vitest/config';\n\n/**\n * What a `plugins` option accepts: whatever a Vite `plugins` array does (a plugin, a nested array of them as\n * `@vitejs/plugin-react` and `@tailwindcss/vite` return, a promise, a falsy placeholder).\n *\n * Deliberately structural rather than Vite's own `PluginOption`: the app's `vite` and the `vite` that\n * `vitest` brings are separate installs more often than not, and their `Plugin` types are not assignable to\n * each other even at the same version (\"Excessive stack depth comparing types\"). The kit never inspects a plugin.\n */\nexport type PluginOption = object | false | null | undefined;\n\n/**\n * Hand the plugins to Vite. One assertion, here, for the reason above.\n */\nexport function asVitePlugins(plugins: readonly PluginOption[]): NonNullable<ViteUserConfig['plugins']> {\n return [...plugins] as NonNullable<ViteUserConfig['plugins']>;\n}\n"],
|
|
5
|
+
"mappings": "+EAeM,SAAUA,EAAcC,EAAgC,CAC5D,MAAO,CAAC,GAAGA,CAAO,CACpB,CAFgBC,EAAAF,EAAA",
|
|
6
|
+
"names": ["asVitePlugins", "plugins", "__name"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-spa-shell-stub.d.ts","sourceRoot":"","sources":["../../src/scripts/ensure-spa-shell-stub.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ensure-spa-shell-stub.d.ts","sourceRoot":"","sources":["../../src/scripts/ensure-spa-shell-stub.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,MAAM,CAU5E"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import e from"node:path";import{fileURLToPath as t}from"node:url";import{ensureSpaShellStub as s}from"./spa-shell.js";const o=e.resolve(e.dirname(t(import.meta.url)),".."),a=process.argv[2]===void 0?o:e.resolve(process.argv[2]),r=s({root:a});console.log(r.created?`ensure-spa-shell-stub: created stub at ${r.path}`:`ensure-spa-shell-stub: ${r.path} already present, left untouched`);
|
|
1
|
+
var p=Object.defineProperty;var s=(e,t)=>p(e,"name",{value:t,configurable:!0});import o from"node:path";import{fileURLToPath as i}from"node:url";import{isEntrypoint as l}from"./lib/entrypoint.js";import{ensureSpaShellStub as a}from"./spa-shell.js";function u(e=process.argv.slice(2)){const t=o.resolve(o.dirname(i(import.meta.url)),".."),n=e[0]===void 0?t:o.resolve(e[0]),r=a({root:n});return console.log(r.created?`ensure-spa-shell-stub: created stub at ${r.path}`:`ensure-spa-shell-stub: ${r.path} already present, left untouched`),0}s(u,"main"),l(import.meta.url)&&process.exit(u());export{u as main};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/scripts/ensure-spa-shell-stub.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["path", "fileURLToPath", "ensureSpaShellStub", "
|
|
4
|
+
"sourcesContent": ["/**\n * Write a placeholder `apps/api/src/generated/spa-shell.ts` when it is absent.\n *\n * Provenance: Durable-DAV's `scripts/ensure-spa-shell-stub.mjs` and Edge-Sonic's\n * `scripts/build/ensure-spa-shell-stub.ts`. The rule lives in `spa-shell.ts`; this\n * is the entrypoint that runs it from `postinstall`.\n *\n * `pnpm install` runs this before `typegen` so the API worker typechecks in a\n * fresh clone, where the real file has not been produced by the Vite build yet.\n * It exits having done nothing when the file already exists, so a real build\n * output is never overwritten — overwriting would erase the last build with a\n * stub on the next install. The file is gitignored.\n *\n * Usage, from the repo root (typically wired as `postinstall`):\n *\n * ```bash\n * pnpm exec tsx scripts/ensure-spa-shell-stub.ts [repo-root]\n * ```\n */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isEntrypoint } from './lib/entrypoint.ts';\nimport { ensureSpaShellStub } from './spa-shell.ts';\n\n/**\n * Run the stub writer. `args[0]` is the repo root (default: the repo this file sits in).\n */\nexport function main(args: readonly string[] = process.argv.slice(2)): number {\n const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n const root = args[0] === undefined ? repositoryRoot : path.resolve(args[0]);\n const result = ensureSpaShellStub({ root });\n console.log(\n result.created\n ? `ensure-spa-shell-stub: created stub at ${result.path}`\n : `ensure-spa-shell-stub: ${result.path} already present, left untouched`,\n );\n return 0;\n}\n\nif (isEntrypoint(import.meta.url)) {\n process.exit(main());\n}\n"],
|
|
5
|
+
"mappings": "+EAmBA,OAAOA,MAAU,YACjB,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,sBAAAC,MAA0B,iBAK7B,SAAUC,EAAKC,EAA0B,QAAQ,KAAK,MAAM,CAAC,EAAC,CAClE,MAAMC,EAAiBN,EAAK,QAAQA,EAAK,QAAQC,EAAc,YAAY,GAAG,CAAC,EAAG,IAAI,EAChFM,EAAOF,EAAK,CAAC,IAAM,OAAYC,EAAiBN,EAAK,QAAQK,EAAK,CAAC,CAAC,EACpEG,EAASL,EAAmB,CAAE,KAAAI,CAAI,CAAE,EAC1C,eAAQ,IACNC,EAAO,QACH,0CAA0CA,EAAO,IAAI,GACrD,0BAA0BA,EAAO,IAAI,kCAAkC,EAEtE,CACT,CAVgBC,EAAAL,EAAA,QAYZF,EAAa,YAAY,GAAG,GAC9B,QAAQ,KAAKE,EAAI,CAAE",
|
|
6
|
+
"names": ["path", "fileURLToPath", "isEntrypoint", "ensureSpaShellStub", "main", "args", "repositoryRoot", "root", "result", "__name"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
1
|
/**
|
|
3
2
|
* Create the Secrets Store entries declared in `wrangler.jsonc`, generating a fresh
|
|
4
3
|
* value for each one that does not exist yet.
|
|
@@ -43,5 +42,5 @@
|
|
|
43
42
|
* config is missing, because a step reporting "Secret initialization complete"
|
|
44
43
|
* having created nothing is worse than a named error.
|
|
45
44
|
*/
|
|
46
|
-
export
|
|
45
|
+
export declare function main(): Promise<void>;
|
|
47
46
|
//# sourceMappingURL=init-secrets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-secrets.d.ts","sourceRoot":"","sources":["../../src/scripts/init-secrets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init-secrets.d.ts","sourceRoot":"","sources":["../../src/scripts/init-secrets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AA6LH,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA8B1C"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
${o}${i||t.message||""}`)}}s(l,"wrangler");function C(){if(!u(a))throw new Error(`${a} not found. Run scripts/prepare-wrangler-config.ts first \u2014 it is what creates the file this script reads.`);const e=m(p(a,"utf8"));if(e.secrets_store_secrets===void 0&&Object.keys(e).length===0)throw new Error(`${a} is empty or not valid JSONC. Run scripts/prepare-wrangler-config.ts to regenerate it.`);return e}s(C,"parseWranglerConfig");function x(e){const r=[];for(const[n,t]of(e.secrets_store_secrets??[]).entries()){const o=t.binding??`index ${n}`,i=t.store_id,c=t.secret_name;if(i===void 0||i===""||c===void 0||c==="")throw new Error(`secrets_store_secrets[${n}] ("${o}") needs both store_id and secret_name; store_id is normally filled in by scripts/prepare-wrangler-config.ts.`);if(!$(c))throw new Error(`No generator for secret "${c}" (binding "${o}").`);r.push({storeId:i,secretName:c})}return r}s(x,"planSecrets");function N(e){let r;try{r=l(["secrets-store","secret","list",e,"--remote"])}catch(n){if(w(n))return console.log(`Secrets Store ${e} is empty`),new Set;console.warn(`Unable to list secrets in store ${e}:`,n instanceof Error?n.message:"unknown error");return}return h(r)}s(N,"listSecretNames");function k(e,r,n){console.log(`Creating secret: ${r}`),l(["secrets-store","secret","create",e,"--name",r,"--scopes","workers","--remote"],n)}s(k,"createSecret");async function F(){console.log("Initializing Cloudflare secrets...");const e=C(),r=x(e);if(r.length===0)throw new Error("wrangler.jsonc declares no secrets_store_secrets entries, so there is nothing to initialize.");const n=new Map;for(const{storeId:t,secretName:o}of r){n.has(t)||n.set(t,N(t));const i=n.get(t);if(i===void 0)throw new Error(`Could not list secrets in store ${t}; refusing to create ${o} without confirming it is absent.`);if(i.has(o)){console.log(`Secret ${o} already exists; leaving it untouched.`);continue}k(t,o,await f(o)()),i.add(o)}console.log("Secret initialization complete")}s(F,"main");try{await F()}catch(e){y(e instanceof Error?`Secret initialization failed: ${e.message}`:String(e))}
|
|
1
|
+
var d=Object.defineProperty;var s=(e,r)=>d(e,"name",{value:r,configurable:!0});import{execFileSync as g}from"node:child_process";import{existsSync as p,readFileSync as u}from"node:fs";import{parse as m}from"jsonc-parser";import{isEntrypoint as y}from"./lib/entrypoint.js";import{fail as w}from"./lib/github-actions.js";import{isEmptySecretsStoreListing as h,parseWranglerNames as S}from"./lib/wrangler-table.js";import{CONFIG_PATH as a}from"./wrangler-config/types.js";const E="-encryption-key",_="-signing-secret";async function $(){const e=await crypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"]),r=await crypto.subtle.exportKey("raw",e);let n="";for(const t of new Uint8Array(r))n+=String.fromCodePoint(t);return btoa(n)}s($,"generateAESGCMKey");function b(){let e="";for(const r of crypto.getRandomValues(new Uint8Array(32)))e+=r.toString(16).padStart(2,"0");return Promise.resolve(e)}s(b,"generateSigningSecret");function f(e){if(e.endsWith(E))return $;if(e.endsWith(_))return b;throw new Error(`Unknown secret: ${e}. Name it '*-encryption-key' for a generated 32-byte AES-GCM key, or '*-signing-secret' for 32 random bytes, and teach this script the shape if neither fits.`)}s(f,"generatorFor");function C(e){try{return f(e),!0}catch{return!1}}s(C,"canProvisionSecret");function l(e,r){try{return g("pnpm",["exec","wrangler",...e],{encoding:"utf8",stdio:[r===void 0?"ignore":"pipe","pipe","pipe"],...r!==void 0&&{input:r}})}catch(n){const t=n,o=t.stdout?t.stdout.toString():"",i=t.stderr?t.stderr.toString():"";throw new Error(`Command failed: pnpm exec wrangler ${e.join(" ")}
|
|
2
|
+
${o}${i||t.message||""}`)}}s(l,"wrangler");function x(){if(!p(a))throw new Error(`${a} not found. Run scripts/prepare-wrangler-config.ts first \u2014 it is what creates the file this script reads.`);const e=m(u(a,"utf8"));if(e.secrets_store_secrets===void 0&&Object.keys(e).length===0)throw new Error(`${a} is empty or not valid JSONC. Run scripts/prepare-wrangler-config.ts to regenerate it.`);return e}s(x,"parseWranglerConfig");function N(e){const r=[];for(const[n,t]of(e.secrets_store_secrets??[]).entries()){const o=t.binding??`index ${n}`,i=t.store_id,c=t.secret_name;if(i===void 0||i===""||c===void 0||c==="")throw new Error(`secrets_store_secrets[${n}] ("${o}") needs both store_id and secret_name; store_id is normally filled in by scripts/prepare-wrangler-config.ts.`);if(!C(c))throw new Error(`No generator for secret "${c}" (binding "${o}").`);r.push({storeId:i,secretName:c})}return r}s(N,"planSecrets");function k(e){let r;try{r=l(["secrets-store","secret","list",e,"--remote"])}catch(n){if(h(n))return console.log(`Secrets Store ${e} is empty`),new Set;console.warn(`Unable to list secrets in store ${e}:`,n instanceof Error?n.message:"unknown error");return}return S(r)}s(k,"listSecretNames");function F(e,r,n){console.log(`Creating secret: ${r}`),l(["secrets-store","secret","create",e,"--name",r,"--scopes","workers","--remote"],n)}s(F,"createSecret");async function I(){console.log("Initializing Cloudflare secrets...");const e=x(),r=N(e);if(r.length===0)throw new Error("wrangler.jsonc declares no secrets_store_secrets entries, so there is nothing to initialize.");const n=new Map;for(const{storeId:t,secretName:o}of r){n.has(t)||n.set(t,k(t));const i=n.get(t);if(i===void 0)throw new Error(`Could not list secrets in store ${t}; refusing to create ${o} without confirming it is absent.`);if(i.has(o)){console.log(`Secret ${o} already exists; leaving it untouched.`);continue}F(t,o,await f(o)()),i.add(o)}console.log("Secret initialization complete")}if(s(I,"main"),y(import.meta.url))try{await I()}catch(e){w(e instanceof Error?`Secret initialization failed: ${e.message}`:String(e))}export{I as main};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/scripts/init-secrets.ts"],
|
|
4
|
-
"sourcesContent": ["#!/usr/bin/env tsx\n/**\n * Create the Secrets Store entries declared in `wrangler.jsonc`, generating a fresh\n * value for each one that does not exist yet.\n *\n * Provenance: Edge-Sonic's `scripts/deploy/init-secrets.ts` and Durable-DAV's\n * `scripts/init-secrets.ts`, converged. Both record the same two defects that hid\n * a broken deploy for a whole release, and both fixes are carried over.\n *\n * ### Why this script exists at all\n *\n * A `secrets_store_secrets` binding fails the deploy unless the named secret\n * already exists inside the named store. Nothing creates it: Cloudflare will not\n * generate a value, and the template cannot carry one. So this script is the only\n * thing standing between a fresh account and a deploy that cannot succeed.\n *\n * ### The two defects that hid a broken deploy\n *\n * **The generator list was stale.** Durable-DAV's copy carried an allowlist of\n * exact names from the repository it was inherited from, all deleted when the repo\n * was renamed, so the very first iteration threw `Unknown secret` and never created\n * anything. So the rule here is the secret's **name shape**, not a list of names:\n * `*-encryption-key` gets a generated AES-GCM key and `*-signing-secret` gets 32\n * random bytes. Adding a secret to the template is then a one-line change needing\n * no matching edit here, which is the property the exact-name list did not have.\n *\n * **The throw was swallowed.** The original ended in `main().catch(console.error)`.\n * `console.error` returns `undefined` and never sets an exit status, so the process\n * exited **0** and CI marked the step green — the failure only surfaced one step\n * later, as an unexplainable `wrangler deploy` failure. Hence: the whole plan is\n * validated **before** any Cloudflare call, and a rejection reaches the runner as\n * a non-zero exit with a workflow annotation.\n *\n * ### Create-if-absent is a correctness property, not laziness\n *\n * An existing secret is left untouched. A replication encryption key seals every\n * remote target's credential; regenerating it on a redeploy would strand them all\n * as undecryptable. Rotation has to be a deliberate act with a re-encrypt path,\n * not a side effect of deploying.\n *\n * Requires a materialized `wrangler.jsonc` — run\n * `scripts/prepare-wrangler-config.ts` first. Fails rather than skipping when the\n * config is missing, because a step reporting \"Secret initialization complete\"\n * having created nothing is worse than a named error.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { parse } from 'jsonc-parser';\nimport { fail } from './lib/github-actions.ts';\nimport { isEmptySecretsStoreListing, parseWranglerNames } from './lib/wrangler-table.ts';\nimport { CONFIG_PATH, type WranglerConfig } from './wrangler-config/types.ts';\n\n/**\n * The secret names the AES-GCM key generator produces, matched by **shape**.\n *\n * Keyed on the suffix because the alternative is the exact-name map that went\n * stale. See the header: a template naming `*-encryption-key` is then a one-line\n * change with no matching edit here, and a new secret breaks the deploy loudly\n * instead of silently.\n */\nconst ENCRYPTION_KEY_SUFFIX = '-encryption-key';\n\n/**\nThe secret names the random signing secret generator produces.\n*/\nconst SIGNING_SECRET_SUFFIX = '-signing-secret';\n\n/**\nA 256-bit AES-GCM key, base64-encoded — the shape the worker's crypto layer accepts.\n*/\nasync function generateAESGCMKey(): Promise<string> {\n const key = await crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']);\n const exported = await crypto.subtle.exportKey('raw', key);\n // Chunked rather than spread: `String.fromCharCode(...bytes)` passes 32 arguments,\n // which is fine today and is a stack overflow the day the key is longer.\n let binary = '';\n for (const byte of new Uint8Array(exported)) {\n binary += String.fromCodePoint(byte);\n }\n return btoa(binary);\n}\n\n/**\nA 256-bit random signing secret for internal self-calls, hex-encoded.\n*/\nfunction generateSigningSecret(): Promise<string> {\n let hex = '';\n for (const byte of crypto.getRandomValues(new Uint8Array(32))) {\n hex += byte.toString(16).padStart(2, '0');\n }\n return Promise.resolve(hex);\n}\n\n/**\n * The generator for a secret name, chosen by the name's shape.\n *\n * A name matching neither is still refused rather than given a guess: the generator\n * is not the only thing that has to be right, and an unusable value that looks\n * provisioned is worse than a failure.\n */\nfunction generatorFor(secretName: string): () => Promise<string> {\n if (secretName.endsWith(ENCRYPTION_KEY_SUFFIX)) return generateAESGCMKey;\n if (secretName.endsWith(SIGNING_SECRET_SUFFIX)) return generateSigningSecret;\n throw new Error(\n `Unknown secret: ${secretName}. Name it '*-encryption-key' for a generated 32-byte AES-GCM key, ` +\n `or '*-signing-secret' for 32 random bytes, and teach this script the shape if neither fits.`,\n );\n}\n\n/**\nWhether this script can produce a value for `secretName`.\n*/\nfunction canProvisionSecret(secretName: string): boolean {\n try {\n generatorFor(secretName);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Runs a wrangler subcommand, optionally feeding `input` on stdin.\n *\n * Arguments are passed as an argv array rather than interpolated into a shell\n * string, so a value containing shell metacharacters cannot alter the command.\n */\nfunction wrangler(args: readonly string[], input?: string): string {\n try {\n // eslint-disable-next-line sonarjs/no-os-command-from-path\n return execFileSync('pnpm', ['exec', 'wrangler', ...args], {\n encoding: 'utf8',\n stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],\n ...(input !== undefined && { input }),\n });\n } catch (error: unknown) {\n const maybeProcessError = error as { stdout?: string | Buffer; stderr?: string | Buffer; message?: string };\n const stdout: string = maybeProcessError.stdout ? maybeProcessError.stdout.toString() : '';\n const stderr: string = maybeProcessError.stderr ? maybeProcessError.stderr.toString() : '';\n throw new Error(`Command failed: pnpm exec wrangler ${args.join(' ')}\\n${stdout}${stderr || maybeProcessError.message || ''}`);\n }\n}\n\nfunction parseWranglerConfig(): WranglerConfig {\n if (!existsSync(CONFIG_PATH)) {\n throw new Error(\n `${CONFIG_PATH} not found. Run scripts/prepare-wrangler-config.ts first — it is what creates the file this script reads.`,\n );\n }\n // `parse` is error-tolerant and returns a partial object, so an empty result means\n // malformed JSON rather than \"no secrets declared\". Treating that as an empty list\n // would report success having created nothing.\n const config = parse(readFileSync(CONFIG_PATH, 'utf8')) as WranglerConfig;\n if (config.secrets_store_secrets === undefined && Object.keys(config).length === 0) {\n throw new Error(`${CONFIG_PATH} is empty or not valid JSONC. Run scripts/prepare-wrangler-config.ts to regenerate it.`);\n }\n return config;\n}\n\n/**\nOne secret to create, as the plan names it.\n*/\ninterface PlannedSecret {\n storeId: string;\n secretName: string;\n}\n\n/**\n * Turn the config's bindings into a validated work list.\n *\n * Every entry is checked *before* the first Cloudflare call, so an\n * unprovisionable secret fails the step in milliseconds instead of after some other\n * secret has already been created.\n */\nfunction planSecrets(config: WranglerConfig): PlannedSecret[] {\n const plan: PlannedSecret[] = [];\n for (const [index, secret] of (config.secrets_store_secrets ?? []).entries()) {\n const label = secret.binding ?? `index ${index}`;\n const storeId = secret.store_id;\n const secretName = secret.secret_name;\n if (storeId === undefined || storeId === '' || secretName === undefined || secretName === '') {\n throw new Error(\n `secrets_store_secrets[${index}] (\"${label}\") needs both store_id and secret_name; ` +\n 'store_id is normally filled in by scripts/prepare-wrangler-config.ts.',\n );\n }\n if (!canProvisionSecret(secretName)) {\n throw new Error(`No generator for secret \"${secretName}\" (binding \"${label}\").`);\n }\n plan.push({ storeId, secretName });\n }\n return plan;\n}\n\n/**\n * List the secret names present in a store.\n *\n * Returns `undefined` when the listing itself failed, which is deliberately\n * distinct from an empty set: a transient CLI failure must not be read as \"the\n * secret is missing\" and cause a duplicate insert over a live value. An empty store\n * *is* a confirmed absence, so it maps to an empty set rather than `undefined`.\n *\n * The name is taken exactly. `output.includes(secretName)` is not a membership test:\n * `my-replication-encryption-key-2` satisfies a search for\n * `my-replication-encryption-key`, so a store holding only the suffixed entry would\n * report the unsuffixed one as already present and it would never be created.\n */\nfunction listSecretNames(storeId: string): Set<string> | undefined {\n let output: string;\n try {\n output = wrangler(['secrets-store', 'secret', 'list', storeId, '--remote']);\n } catch (error: unknown) {\n if (isEmptySecretsStoreListing(error)) {\n console.log(`Secrets Store ${storeId} is empty`);\n return new Set();\n }\n console.warn(`Unable to list secrets in store ${storeId}:`, error instanceof Error ? error.message : 'unknown error');\n return undefined;\n }\n return parseWranglerNames(output);\n}\n\nfunction createSecret(storeId: string, secretName: string, secretValue: string): void {\n console.log(`Creating secret: ${secretName}`);\n // The value goes in on stdin, never as an argv entry: an argv is visible to every\n // process on the runner through `ps`, and the previous\n // `echo \"${value}\" | wrangler … ${name}` also broke on `\"`, `$`, backticks and\n // newlines.\n wrangler(['secrets-store', 'secret', 'create', storeId, '--name', secretName, '--scopes', 'workers', '--remote'], secretValue);\n}\n\nasync function main(): Promise<void> {\n console.log('Initializing Cloudflare secrets...');\n const config = parseWranglerConfig();\n const plan = planSecrets(config);\n\n if (plan.length === 0) {\n throw new Error('wrangler.jsonc declares no secrets_store_secrets entries, so there is nothing to initialize.');\n }\n\n const listedByStore = new Map<string, Set<string> | undefined>();\n\n for (const { storeId, secretName } of plan) {\n if (!listedByStore.has(storeId)) {\n listedByStore.set(storeId, listSecretNames(storeId));\n }\n const existing = listedByStore.get(storeId);\n if (existing === undefined) {\n // Refuse to guess: creating a secret we could not read back risks overwriting\n // a live value with a freshly generated one.\n throw new Error(`Could not list secrets in store ${storeId}; refusing to create ${secretName} without confirming it is absent.`);\n }\n if (existing.has(secretName)) {\n console.log(`Secret ${secretName} already exists; leaving it untouched.`);\n continue;\n }\n createSecret(storeId, secretName, await generatorFor(secretName)());\n existing.add(secretName);\n }\n\n console.log('Secret initialization complete');\n}\n\n// Top-level await rather than `.catch(console.error)`, so a rejected `main` surfaces\n// as a stack trace with its cause intact and the process exits non-zero. Either way\n// the exit status has to be right: this runs in the deploy pipeline, and swallowing\n// the rejection reported a failed key bootstrap as a green step.\ntry {\n await main();\n} catch (error: unknown) {\n fail(error instanceof Error ? `Secret initialization failed: ${error.message}` : String(error));\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["execFileSync", "existsSync", "readFileSync", "parse", "fail", "isEmptySecretsStoreListing", "parseWranglerNames", "CONFIG_PATH", "ENCRYPTION_KEY_SUFFIX", "SIGNING_SECRET_SUFFIX", "generateAESGCMKey", "key", "exported", "binary", "byte", "__name", "generateSigningSecret", "hex", "generatorFor", "secretName", "canProvisionSecret", "wrangler", "args", "input", "error", "maybeProcessError", "stdout", "stderr", "parseWranglerConfig", "config", "planSecrets", "plan", "index", "secret", "label", "storeId", "listSecretNames", "output", "createSecret", "secretValue", "main", "listedByStore", "existing"]
|
|
4
|
+
"sourcesContent": ["/**\n * Create the Secrets Store entries declared in `wrangler.jsonc`, generating a fresh\n * value for each one that does not exist yet.\n *\n * Provenance: Edge-Sonic's `scripts/deploy/init-secrets.ts` and Durable-DAV's\n * `scripts/init-secrets.ts`, converged. Both record the same two defects that hid\n * a broken deploy for a whole release, and both fixes are carried over.\n *\n * ### Why this script exists at all\n *\n * A `secrets_store_secrets` binding fails the deploy unless the named secret\n * already exists inside the named store. Nothing creates it: Cloudflare will not\n * generate a value, and the template cannot carry one. So this script is the only\n * thing standing between a fresh account and a deploy that cannot succeed.\n *\n * ### The two defects that hid a broken deploy\n *\n * **The generator list was stale.** Durable-DAV's copy carried an allowlist of\n * exact names from the repository it was inherited from, all deleted when the repo\n * was renamed, so the very first iteration threw `Unknown secret` and never created\n * anything. So the rule here is the secret's **name shape**, not a list of names:\n * `*-encryption-key` gets a generated AES-GCM key and `*-signing-secret` gets 32\n * random bytes. Adding a secret to the template is then a one-line change needing\n * no matching edit here, which is the property the exact-name list did not have.\n *\n * **The throw was swallowed.** The original ended in `main().catch(console.error)`.\n * `console.error` returns `undefined` and never sets an exit status, so the process\n * exited **0** and CI marked the step green — the failure only surfaced one step\n * later, as an unexplainable `wrangler deploy` failure. Hence: the whole plan is\n * validated **before** any Cloudflare call, and a rejection reaches the runner as\n * a non-zero exit with a workflow annotation.\n *\n * ### Create-if-absent is a correctness property, not laziness\n *\n * An existing secret is left untouched. A replication encryption key seals every\n * remote target's credential; regenerating it on a redeploy would strand them all\n * as undecryptable. Rotation has to be a deliberate act with a re-encrypt path,\n * not a side effect of deploying.\n *\n * Requires a materialized `wrangler.jsonc` — run\n * `scripts/prepare-wrangler-config.ts` first. Fails rather than skipping when the\n * config is missing, because a step reporting \"Secret initialization complete\"\n * having created nothing is worse than a named error.\n */\n\nimport { execFileSync } from 'node:child_process';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { parse } from 'jsonc-parser';\nimport { isEntrypoint } from './lib/entrypoint.ts';\nimport { fail } from './lib/github-actions.ts';\nimport { isEmptySecretsStoreListing, parseWranglerNames } from './lib/wrangler-table.ts';\nimport { CONFIG_PATH, type WranglerConfig } from './wrangler-config/types.ts';\n\n/**\n * The secret names the AES-GCM key generator produces, matched by **shape**.\n *\n * Keyed on the suffix because the alternative is the exact-name map that went\n * stale. See the header: a template naming `*-encryption-key` is then a one-line\n * change with no matching edit here, and a new secret breaks the deploy loudly\n * instead of silently.\n */\nconst ENCRYPTION_KEY_SUFFIX = '-encryption-key';\n\n/**\nThe secret names the random signing secret generator produces.\n*/\nconst SIGNING_SECRET_SUFFIX = '-signing-secret';\n\n/**\nA 256-bit AES-GCM key, base64-encoded — the shape the worker's crypto layer accepts.\n*/\nasync function generateAESGCMKey(): Promise<string> {\n const key = await crypto.subtle.generateKey({ name: 'AES-GCM', length: 256 }, true, ['encrypt', 'decrypt']);\n const exported = await crypto.subtle.exportKey('raw', key);\n // Chunked rather than spread: `String.fromCharCode(...bytes)` passes 32 arguments,\n // which is fine today and is a stack overflow the day the key is longer.\n let binary = '';\n for (const byte of new Uint8Array(exported)) {\n binary += String.fromCodePoint(byte);\n }\n return btoa(binary);\n}\n\n/**\nA 256-bit random signing secret for internal self-calls, hex-encoded.\n*/\nfunction generateSigningSecret(): Promise<string> {\n let hex = '';\n for (const byte of crypto.getRandomValues(new Uint8Array(32))) {\n hex += byte.toString(16).padStart(2, '0');\n }\n return Promise.resolve(hex);\n}\n\n/**\n * The generator for a secret name, chosen by the name's shape.\n *\n * A name matching neither is still refused rather than given a guess: the generator\n * is not the only thing that has to be right, and an unusable value that looks\n * provisioned is worse than a failure.\n */\nfunction generatorFor(secretName: string): () => Promise<string> {\n if (secretName.endsWith(ENCRYPTION_KEY_SUFFIX)) return generateAESGCMKey;\n if (secretName.endsWith(SIGNING_SECRET_SUFFIX)) return generateSigningSecret;\n throw new Error(\n `Unknown secret: ${secretName}. Name it '*-encryption-key' for a generated 32-byte AES-GCM key, ` +\n `or '*-signing-secret' for 32 random bytes, and teach this script the shape if neither fits.`,\n );\n}\n\n/**\nWhether this script can produce a value for `secretName`.\n*/\nfunction canProvisionSecret(secretName: string): boolean {\n try {\n generatorFor(secretName);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Runs a wrangler subcommand, optionally feeding `input` on stdin.\n *\n * Arguments are passed as an argv array rather than interpolated into a shell\n * string, so a value containing shell metacharacters cannot alter the command.\n */\nfunction wrangler(args: readonly string[], input?: string): string {\n try {\n // eslint-disable-next-line sonarjs/no-os-command-from-path\n return execFileSync('pnpm', ['exec', 'wrangler', ...args], {\n encoding: 'utf8',\n stdio: [input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],\n ...(input !== undefined && { input }),\n });\n } catch (error: unknown) {\n const maybeProcessError = error as { stdout?: string | Buffer; stderr?: string | Buffer; message?: string };\n const stdout: string = maybeProcessError.stdout ? maybeProcessError.stdout.toString() : '';\n const stderr: string = maybeProcessError.stderr ? maybeProcessError.stderr.toString() : '';\n throw new Error(`Command failed: pnpm exec wrangler ${args.join(' ')}\\n${stdout}${stderr || maybeProcessError.message || ''}`);\n }\n}\n\nfunction parseWranglerConfig(): WranglerConfig {\n if (!existsSync(CONFIG_PATH)) {\n throw new Error(\n `${CONFIG_PATH} not found. Run scripts/prepare-wrangler-config.ts first — it is what creates the file this script reads.`,\n );\n }\n // `parse` is error-tolerant and returns a partial object, so an empty result means\n // malformed JSON rather than \"no secrets declared\". Treating that as an empty list\n // would report success having created nothing.\n const config = parse(readFileSync(CONFIG_PATH, 'utf8')) as WranglerConfig;\n if (config.secrets_store_secrets === undefined && Object.keys(config).length === 0) {\n throw new Error(`${CONFIG_PATH} is empty or not valid JSONC. Run scripts/prepare-wrangler-config.ts to regenerate it.`);\n }\n return config;\n}\n\n/**\nOne secret to create, as the plan names it.\n*/\ninterface PlannedSecret {\n storeId: string;\n secretName: string;\n}\n\n/**\n * Turn the config's bindings into a validated work list.\n *\n * Every entry is checked *before* the first Cloudflare call, so an\n * unprovisionable secret fails the step in milliseconds instead of after some other\n * secret has already been created.\n */\nfunction planSecrets(config: WranglerConfig): PlannedSecret[] {\n const plan: PlannedSecret[] = [];\n for (const [index, secret] of (config.secrets_store_secrets ?? []).entries()) {\n const label = secret.binding ?? `index ${index}`;\n const storeId = secret.store_id;\n const secretName = secret.secret_name;\n if (storeId === undefined || storeId === '' || secretName === undefined || secretName === '') {\n throw new Error(\n `secrets_store_secrets[${index}] (\"${label}\") needs both store_id and secret_name; ` +\n 'store_id is normally filled in by scripts/prepare-wrangler-config.ts.',\n );\n }\n if (!canProvisionSecret(secretName)) {\n throw new Error(`No generator for secret \"${secretName}\" (binding \"${label}\").`);\n }\n plan.push({ storeId, secretName });\n }\n return plan;\n}\n\n/**\n * List the secret names present in a store.\n *\n * Returns `undefined` when the listing itself failed, which is deliberately\n * distinct from an empty set: a transient CLI failure must not be read as \"the\n * secret is missing\" and cause a duplicate insert over a live value. An empty store\n * *is* a confirmed absence, so it maps to an empty set rather than `undefined`.\n *\n * The name is taken exactly. `output.includes(secretName)` is not a membership test:\n * `my-replication-encryption-key-2` satisfies a search for\n * `my-replication-encryption-key`, so a store holding only the suffixed entry would\n * report the unsuffixed one as already present and it would never be created.\n */\nfunction listSecretNames(storeId: string): Set<string> | undefined {\n let output: string;\n try {\n output = wrangler(['secrets-store', 'secret', 'list', storeId, '--remote']);\n } catch (error: unknown) {\n if (isEmptySecretsStoreListing(error)) {\n console.log(`Secrets Store ${storeId} is empty`);\n return new Set();\n }\n console.warn(`Unable to list secrets in store ${storeId}:`, error instanceof Error ? error.message : 'unknown error');\n return undefined;\n }\n return parseWranglerNames(output);\n}\n\nfunction createSecret(storeId: string, secretName: string, secretValue: string): void {\n console.log(`Creating secret: ${secretName}`);\n // The value goes in on stdin, never as an argv entry: an argv is visible to every\n // process on the runner through `ps`, and the previous\n // `echo \"${value}\" | wrangler … ${name}` also broke on `\"`, `$`, backticks and\n // newlines.\n wrangler(['secrets-store', 'secret', 'create', storeId, '--name', secretName, '--scopes', 'workers', '--remote'], secretValue);\n}\n\nexport async function main(): Promise<void> {\n console.log('Initializing Cloudflare secrets...');\n const config = parseWranglerConfig();\n const plan = planSecrets(config);\n\n if (plan.length === 0) {\n throw new Error('wrangler.jsonc declares no secrets_store_secrets entries, so there is nothing to initialize.');\n }\n\n const listedByStore = new Map<string, Set<string> | undefined>();\n\n for (const { storeId, secretName } of plan) {\n if (!listedByStore.has(storeId)) {\n listedByStore.set(storeId, listSecretNames(storeId));\n }\n const existing = listedByStore.get(storeId);\n if (existing === undefined) {\n // Refuse to guess: creating a secret we could not read back risks overwriting\n // a live value with a freshly generated one.\n throw new Error(`Could not list secrets in store ${storeId}; refusing to create ${secretName} without confirming it is absent.`);\n }\n if (existing.has(secretName)) {\n console.log(`Secret ${secretName} already exists; leaving it untouched.`);\n continue;\n }\n createSecret(storeId, secretName, await generatorFor(secretName)());\n existing.add(secretName);\n }\n\n console.log('Secret initialization complete');\n}\n\n// Top-level await rather than `.catch(console.error)`, so a rejected `main` surfaces\n// as a stack trace with its cause intact and the process exits non-zero. Either way\n// the exit status has to be right: this runs in the deploy pipeline, and swallowing\n// the rejection reported a failed key bootstrap as a green step.\nif (isEntrypoint(import.meta.url)) {\n try {\n await main();\n } catch (error: unknown) {\n fail(error instanceof Error ? `Secret initialization failed: ${error.message}` : String(error));\n }\n}\n"],
|
|
5
|
+
"mappings": "+EA6CA,OAAS,gBAAAA,MAAoB,qBAC7B,OAAS,cAAAC,EAAY,gBAAAC,MAAoB,UACzC,OAAS,SAAAC,MAAa,eACtB,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,QAAAC,MAAY,0BACrB,OAAS,8BAAAC,EAA4B,sBAAAC,MAA0B,0BAC/D,OAAS,eAAAC,MAAwC,6BAUjD,MAAMC,EAAwB,kBAKxBC,EAAwB,kBAK9B,eAAeC,GAAiB,CAC9B,MAAMC,EAAM,MAAM,OAAO,OAAO,YAAY,CAAE,KAAM,UAAW,OAAQ,GAAG,EAAI,GAAM,CAAC,UAAW,SAAS,CAAC,EACpGC,EAAW,MAAM,OAAO,OAAO,UAAU,MAAOD,CAAG,EAGzD,IAAIE,EAAS,GACb,UAAWC,KAAQ,IAAI,WAAWF,CAAQ,EACxCC,GAAU,OAAO,cAAcC,CAAI,EAErC,OAAO,KAAKD,CAAM,CACpB,CAVeE,EAAAL,EAAA,qBAef,SAASM,GAAqB,CAC5B,IAAIC,EAAM,GACV,UAAWH,KAAQ,OAAO,gBAAgB,IAAI,WAAW,EAAE,CAAC,EAC1DG,GAAOH,EAAK,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,EAE1C,OAAO,QAAQ,QAAQG,CAAG,CAC5B,CANSF,EAAAC,EAAA,yBAeT,SAASE,EAAaC,EAAkB,CACtC,GAAIA,EAAW,SAASX,CAAqB,EAAG,OAAOE,EACvD,GAAIS,EAAW,SAASV,CAAqB,EAAG,OAAOO,EACvD,MAAM,IAAI,MACR,mBAAmBG,CAAU,+JACkE,CAEnG,CAPSJ,EAAAG,EAAA,gBAYT,SAASE,EAAmBD,EAAkB,CAC5C,GAAI,CACF,OAAAD,EAAaC,CAAU,EAChB,EACT,MAAQ,CACN,MAAO,EACT,CACF,CAPSJ,EAAAK,EAAA,sBAeT,SAASC,EAASC,EAAyBC,EAAc,CACvD,GAAI,CAEF,OAAOxB,EAAa,OAAQ,CAAC,OAAQ,WAAY,GAAGuB,CAAI,EAAG,CACzD,SAAU,OACV,MAAO,CAACC,IAAU,OAAY,SAAW,OAAQ,OAAQ,MAAM,EAC/D,GAAIA,IAAU,QAAa,CAAE,MAAAA,CAAK,EACnC,CACH,OAASC,EAAgB,CACvB,MAAMC,EAAoBD,EACpBE,EAAiBD,EAAkB,OAASA,EAAkB,OAAO,SAAQ,EAAK,GAClFE,EAAiBF,EAAkB,OAASA,EAAkB,OAAO,SAAQ,EAAK,GACxF,MAAM,IAAI,MAAM,sCAAsCH,EAAK,KAAK,GAAG,CAAC;EAAKI,CAAM,GAAGC,GAAUF,EAAkB,SAAW,EAAE,EAAE,CAC/H,CACF,CAdSV,EAAAM,EAAA,YAgBT,SAASO,GAAmB,CAC1B,GAAI,CAAC5B,EAAWO,CAAW,EACzB,MAAM,IAAI,MACR,GAAGA,CAAW,gHAA2G,EAM7H,MAAMsB,EAAS3B,EAAMD,EAAaM,EAAa,MAAM,CAAC,EACtD,GAAIsB,EAAO,wBAA0B,QAAa,OAAO,KAAKA,CAAM,EAAE,SAAW,EAC/E,MAAM,IAAI,MAAM,GAAGtB,CAAW,wFAAwF,EAExH,OAAOsB,CACT,CAdSd,EAAAa,EAAA,uBA+BT,SAASE,EAAYD,EAAsB,CACzC,MAAME,EAAwB,CAAA,EAC9B,SAAW,CAACC,EAAOC,CAAM,IAAMJ,EAAO,uBAAyB,CAAA,GAAI,QAAO,EAAI,CAC5E,MAAMK,EAAQD,EAAO,SAAW,SAASD,CAAK,GACxCG,EAAUF,EAAO,SACjBd,EAAac,EAAO,YAC1B,GAAIE,IAAY,QAAaA,IAAY,IAAMhB,IAAe,QAAaA,IAAe,GACxF,MAAM,IAAI,MACR,yBAAyBa,CAAK,OAAOE,CAAK,+GAC+B,EAG7E,GAAI,CAACd,EAAmBD,CAAU,EAChC,MAAM,IAAI,MAAM,4BAA4BA,CAAU,eAAee,CAAK,KAAK,EAEjFH,EAAK,KAAK,CAAE,QAAAI,EAAS,WAAAhB,CAAU,CAAE,CACnC,CACA,OAAOY,CACT,CAlBShB,EAAAe,EAAA,eAiCT,SAASM,EAAgBD,EAAe,CACtC,IAAIE,EACJ,GAAI,CACFA,EAAShB,EAAS,CAAC,gBAAiB,SAAU,OAAQc,EAAS,UAAU,CAAC,CAC5E,OAASX,EAAgB,CACvB,GAAInB,EAA2BmB,CAAK,EAClC,eAAQ,IAAI,iBAAiBW,CAAO,WAAW,EACxC,IAAI,IAEb,QAAQ,KAAK,mCAAmCA,CAAO,IAAKX,aAAiB,MAAQA,EAAM,QAAU,eAAe,EACpH,MACF,CACA,OAAOlB,EAAmB+B,CAAM,CAClC,CAbStB,EAAAqB,EAAA,mBAeT,SAASE,EAAaH,EAAiBhB,EAAoBoB,EAAmB,CAC5E,QAAQ,IAAI,oBAAoBpB,CAAU,EAAE,EAK5CE,EAAS,CAAC,gBAAiB,SAAU,SAAUc,EAAS,SAAUhB,EAAY,WAAY,UAAW,UAAU,EAAGoB,CAAW,CAC/H,CAPSxB,EAAAuB,EAAA,gBAST,eAAsBE,GAAI,CACxB,QAAQ,IAAI,oCAAoC,EAChD,MAAMX,EAASD,EAAmB,EAC5BG,EAAOD,EAAYD,CAAM,EAE/B,GAAIE,EAAK,SAAW,EAClB,MAAM,IAAI,MAAM,8FAA8F,EAGhH,MAAMU,EAAgB,IAAI,IAE1B,SAAW,CAAE,QAAAN,EAAS,WAAAhB,CAAU,IAAMY,EAAM,CACrCU,EAAc,IAAIN,CAAO,GAC5BM,EAAc,IAAIN,EAASC,EAAgBD,CAAO,CAAC,EAErD,MAAMO,EAAWD,EAAc,IAAIN,CAAO,EAC1C,GAAIO,IAAa,OAGf,MAAM,IAAI,MAAM,mCAAmCP,CAAO,wBAAwBhB,CAAU,mCAAmC,EAEjI,GAAIuB,EAAS,IAAIvB,CAAU,EAAG,CAC5B,QAAQ,IAAI,UAAUA,CAAU,wCAAwC,EACxE,QACF,CACAmB,EAAaH,EAAShB,EAAY,MAAMD,EAAaC,CAAU,EAAC,CAAE,EAClEuB,EAAS,IAAIvB,CAAU,CACzB,CAEA,QAAQ,IAAI,gCAAgC,CAC9C,CAMA,GApCsBJ,EAAAyB,EAAA,QAoClBrC,EAAa,YAAY,GAAG,EAC9B,GAAI,CACF,MAAMqC,EAAI,CACZ,OAAShB,EAAgB,CACvBpB,EAAKoB,aAAiB,MAAQ,iCAAiCA,EAAM,OAAO,GAAK,OAAOA,CAAK,CAAC,CAChG",
|
|
6
|
+
"names": ["execFileSync", "existsSync", "readFileSync", "parse", "isEntrypoint", "fail", "isEmptySecretsStoreListing", "parseWranglerNames", "CONFIG_PATH", "ENCRYPTION_KEY_SUFFIX", "SIGNING_SECRET_SUFFIX", "generateAESGCMKey", "key", "exported", "binary", "byte", "__name", "generateSigningSecret", "hex", "generatorFor", "secretName", "canProvisionSecret", "wrangler", "args", "input", "error", "maybeProcessError", "stdout", "stderr", "parseWranglerConfig", "config", "planSecrets", "plan", "index", "secret", "label", "storeId", "listSecretNames", "output", "createSecret", "secretValue", "main", "listedByStore", "existing"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Write the lock. `args[0]` is the migrations directory (default `./migrations`
|
|
3
|
+
* beside the repo this file sits in). Returns the exit code; it is non-zero when a
|
|
4
|
+
* problem the write cannot resolve (an `edited` entry) remains.
|
|
5
|
+
*/
|
|
6
|
+
export declare function main(args?: readonly string[]): number;
|
|
3
7
|
//# sourceMappingURL=migrations-lock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations-lock.d.ts","sourceRoot":"","sources":["../../src/scripts/migrations-lock.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"migrations-lock.d.ts","sourceRoot":"","sources":["../../src/scripts/migrations-lock.ts"],"names":[],"mappings":"AAiCA;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,GAAE,SAAS,MAAM,EAA0B,GAAG,MAAM,CAa5E"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import o from"node:path";import{fileURLToPath as i}from"node:url";import{LOCK_NAME as s,verifyMigrations as n}from"./verify-migrations.js";const l=o.resolve(o.dirname(i(import.meta.url)),".."),e=process.argv[2]===void 0?o.join(l,"migrations"):o.resolve(process.argv[2]),r=n(e,{write:!0});for(const t of r.problems)console.error(`FAIL: ${t.problem}`);console.log(`${r.lock===null?"left":"wrote"} ${o.join(e,s)} (${r.files.length} migration(s) recorded)`),process.exit(r.problems.length===0?0:1);
|
|
1
|
+
var s=Object.defineProperty;var n=(r,t)=>s(r,"name",{value:t,configurable:!0});import o from"node:path";import{fileURLToPath as l}from"node:url";import{isEntrypoint as p}from"./lib/entrypoint.js";import{LOCK_NAME as f,verifyMigrations as c}from"./verify-migrations.js";function a(r=process.argv.slice(2)){const t=o.resolve(o.dirname(l(import.meta.url)),".."),i=r[0]===void 0?o.join(t,"migrations"):o.resolve(r[0]),e=c(i,{write:!0});for(const m of e.problems)console.error(`FAIL: ${m.problem}`);return console.log(`${e.lock===null?"left":"wrote"} ${o.join(i,f)} (${e.files.length} migration(s) recorded)`),e.problems.length===0?0:1}n(a,"main"),p(import.meta.url)&&process.exit(a());export{a as main};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/scripts/migrations-lock.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["path", "fileURLToPath", "LOCK_NAME", "verifyMigrations", "
|
|
4
|
+
"sourcesContent": ["/**\n * Record newly-added migration files in `migrations/migrations.lock.json`.\n *\n * Provenance: Edge-Sonic's `scripts/migrations/verify-migrations.ts --write`,\n * which is the only repo that splits the two operations into two commands. The\n * other repos have one script with a flag; the split is kept here because the two\n * calls have different audiences and different blast radii — `verify-migrations`\n * runs in CI and changes nothing, while this one is an operator action that writes\n * a file into version control.\n *\n * The rules live once, in `verify-migrations.ts`, so the two entrypoints cannot\n * disagree. `--write` is add-only: it records unlocked files, refreshes the\n * baseline's own entry, and drops entries the baseline absorbed. It never touches\n * another existing entry, so an incremental migration that has drifted still\n * fails afterwards — re-baselining one means deleting its entry by hand, which\n * shows up in the diff.\n *\n * There is deliberately no `--force`, because a write that could bless a drift\n * without reading the drift is the operator blessing their own edit, and they are\n * by definition the one making it.\n *\n * Usage, from the repo root:\n *\n * ```bash\n * pnpm exec tsx scripts/migrations-lock.ts # ./migrations\n * pnpm exec tsx scripts/migrations-lock.ts path/to/migrations\n * ```\n */\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isEntrypoint } from './lib/entrypoint.ts';\nimport { LOCK_NAME, verifyMigrations } from './verify-migrations.ts';\n\n/**\n * Write the lock. `args[0]` is the migrations directory (default `./migrations`\n * beside the repo this file sits in). Returns the exit code; it is non-zero when a\n * problem the write cannot resolve (an `edited` entry) remains.\n */\nexport function main(args: readonly string[] = process.argv.slice(2)): number {\n const repositoryRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n const migrationsDir = args[0] === undefined ? path.join(repositoryRoot, 'migrations') : path.resolve(args[0]);\n const report = verifyMigrations(migrationsDir, { write: true });\n for (const problem of report.problems) {\n console.error(`FAIL: ${problem.problem}`);\n }\n console.log(\n `${report.lock === null ? 'left' : 'wrote'} ${path.join(migrationsDir, LOCK_NAME)} (${report.files.length} migration(s) recorded)`,\n );\n // The lock is re-checked by the caller: `verify-migrations.ts` re-reads from disk,\n // so running it after this command reports the same verdict CI will.\n return report.problems.length === 0 ? 0 : 1;\n}\n\nif (isEntrypoint(import.meta.url)) {\n process.exit(main());\n}\n"],
|
|
5
|
+
"mappings": "+EA4BA,OAAOA,MAAU,YACjB,OAAS,iBAAAC,MAAqB,WAC9B,OAAS,gBAAAC,MAAoB,sBAC7B,OAAS,aAAAC,EAAW,oBAAAC,MAAwB,yBAOtC,SAAUC,EAAKC,EAA0B,QAAQ,KAAK,MAAM,CAAC,EAAC,CAClE,MAAMC,EAAiBP,EAAK,QAAQA,EAAK,QAAQC,EAAc,YAAY,GAAG,CAAC,EAAG,IAAI,EAChFO,EAAgBF,EAAK,CAAC,IAAM,OAAYN,EAAK,KAAKO,EAAgB,YAAY,EAAIP,EAAK,QAAQM,EAAK,CAAC,CAAC,EACtGG,EAASL,EAAiBI,EAAe,CAAE,MAAO,EAAI,CAAE,EAC9D,UAAWE,KAAWD,EAAO,SAC3B,QAAQ,MAAM,SAASC,EAAQ,OAAO,EAAE,EAE1C,eAAQ,IACN,GAAGD,EAAO,OAAS,KAAO,OAAS,OAAO,IAAIT,EAAK,KAAKQ,EAAeL,CAAS,CAAC,KAAKM,EAAO,MAAM,MAAM,yBAAyB,EAI7HA,EAAO,SAAS,SAAW,EAAI,EAAI,CAC5C,CAbgBE,EAAAN,EAAA,QAeZH,EAAa,YAAY,GAAG,GAC9B,QAAQ,KAAKG,EAAI,CAAE",
|
|
6
|
+
"names": ["path", "fileURLToPath", "isEntrypoint", "LOCK_NAME", "verifyMigrations", "main", "args", "repositoryRoot", "migrationsDir", "report", "problem", "__name"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Materialize and provision. Reads `process.env` and `process.cwd()` (the config paths
|
|
3
|
+
* resolve when `wrangler-config/types.ts` is first imported, so a caller changing
|
|
4
|
+
* directory must do so before importing this module). Returns the created resources.
|
|
5
|
+
*/
|
|
6
|
+
export declare function main(): string[];
|
|
3
7
|
//# sourceMappingURL=prepare-wrangler-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-wrangler-config.d.ts","sourceRoot":"","sources":["../../src/scripts/prepare-wrangler-config.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"prepare-wrangler-config.d.ts","sourceRoot":"","sources":["../../src/scripts/prepare-wrangler-config.ts"],"names":[],"mappings":"AAqCA;;;;GAIG;AACH,wBAAgB,IAAI,IAAI,MAAM,EAAE,CAgB/B"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import{setOutput as r}from"./lib/github-actions.js";import{applyTopLevelPatch as e,applyVarsPatch as o,ensureMinimumConfigVersion as i,prepareConfigFile as n}from"./wrangler-config/patches.js";import{provisionWranglerResources as t}from"./wrangler-config/resources.js";n(),i(),e(),o();const a=t();r("created",a.join(",")),console.log("Wrangler configuration is ready.");
|
|
1
|
+
var i=Object.defineProperty;var o=(r,e)=>i(r,"name",{value:e,configurable:!0});import{setOutput as t}from"./lib/github-actions.js";import{applyTopLevelPatch as n,applyVarsPatch as p,ensureMinimumConfigVersion as a,prepareConfigFile as m}from"./wrangler-config/patches.js";import{provisionWranglerResources as s}from"./wrangler-config/resources.js";import{isEntrypoint as c}from"./lib/entrypoint.js";function f(){m(),a(),n(),p();const r=s();return t("created",r.join(",")),console.log("Wrangler configuration is ready."),r}o(f,"main"),c(import.meta.url)&&f();export{f as main};
|