@timber-js/app 0.2.0-alpha.227 → 0.2.0-alpha.229

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.
Files changed (164) hide show
  1. package/agent-skill.md +9 -0
  2. package/dist/_chunks/{actions-B1xSIv32.js → actions-DHum77eH.js} +3 -3
  3. package/dist/_chunks/{actions-B1xSIv32.js.map → actions-DHum77eH.js.map} +1 -1
  4. package/dist/_chunks/{cache-api-DsSXA4Sp.js → cache-api-BZJNt01a.js} +4 -4
  5. package/dist/_chunks/{cache-api-DsSXA4Sp.js.map → cache-api-BZJNt01a.js.map} +1 -1
  6. package/dist/_chunks/{chains-Dgm3PrMe.js → chains-D-RRc7CM.js} +2 -2
  7. package/dist/_chunks/{chains-Dgm3PrMe.js.map → chains-D-RRc7CM.js.map} +1 -1
  8. package/dist/_chunks/chains-KblEfYzm.js +1 -0
  9. package/dist/_chunks/{classify--_kINHQV.js → classify-_W0RWa5w.js} +2 -2
  10. package/dist/_chunks/{classify--_kINHQV.js.map → classify-_W0RWa5w.js.map} +1 -1
  11. package/dist/_chunks/{cli-check-B33yhAPa.js → cli-check-B-JZkpBD.js} +3 -3
  12. package/dist/_chunks/{cli-check-B33yhAPa.js.map → cli-check-B-JZkpBD.js.map} +1 -1
  13. package/dist/_chunks/{cli-schema-sync-DIPurq7X.js → cli-schema-sync-CAllbqRB.js} +2 -2
  14. package/dist/_chunks/{cli-schema-sync-DIPurq7X.js.map → cli-schema-sync-CAllbqRB.js.map} +1 -1
  15. package/dist/_chunks/{cli-schema-sync-uq72EZmD.js → cli-schema-sync-y_8ijmzO.js} +1 -1
  16. package/dist/_chunks/{client-dep-entries-CP7AkMCM.js → client-dep-entries-C9hv-3k9.js} +2 -2
  17. package/dist/_chunks/{client-dep-entries-CP7AkMCM.js.map → client-dep-entries-C9hv-3k9.js.map} +1 -1
  18. package/dist/_chunks/{convention-lint-hZwz5wd4.js → convention-lint-CrDKERHg.js} +4 -13
  19. package/dist/_chunks/convention-lint-CrDKERHg.js.map +1 -0
  20. package/dist/_chunks/dev-server-L8biS7Az.js +1 -0
  21. package/dist/_chunks/{dev-server-B7o4As0l.js → dev-server-Rq659RR1.js} +8 -2
  22. package/dist/_chunks/dev-server-Rq659RR1.js.map +1 -0
  23. package/dist/_chunks/{build-manifest-Y4jl7nwU.js → dev-span-_NzMX-au.js} +25 -2
  24. package/dist/_chunks/dev-span-_NzMX-au.js.map +1 -0
  25. package/dist/_chunks/{error-boundary-D3YyVVuP.js → error-boundary-OHK1mI99.js} +3 -3
  26. package/dist/_chunks/{error-boundary-D3YyVVuP.js.map → error-boundary-OHK1mI99.js.map} +1 -1
  27. package/dist/_chunks/{flight-source-node-0Tp6evlz.js → flight-source-node-BGanuoSS.js} +2 -2
  28. package/dist/_chunks/{flight-source-node-0Tp6evlz.js.map → flight-source-node-BGanuoSS.js.map} +1 -1
  29. package/dist/_chunks/{global-context-DbxNWeBP.js → global-context-CFSSysdJ.js} +32 -2
  30. package/dist/_chunks/global-context-CFSSysdJ.js.map +1 -0
  31. package/dist/_chunks/{json-lossy-check-DVkLUlfC.js → json-lossy-check-BXM45k8p.js} +2 -2
  32. package/dist/_chunks/{json-lossy-check-DVkLUlfC.js.map → json-lossy-check-BXM45k8p.js.map} +1 -1
  33. package/dist/_chunks/{live-graph-BcVjQ1Te.js → live-graph-C7-yA8W9.js} +4 -4
  34. package/dist/_chunks/{live-graph-BcVjQ1Te.js.map → live-graph-C7-yA8W9.js.map} +1 -1
  35. package/dist/_chunks/{logger-CWk44DLp.js → logger-YtMSKfft.js} +103 -60
  36. package/dist/_chunks/logger-YtMSKfft.js.map +1 -0
  37. package/dist/_chunks/navigation-root-CoGHIMiE.js +239 -0
  38. package/dist/_chunks/navigation-root-CoGHIMiE.js.map +1 -0
  39. package/dist/_chunks/{node-response-B9aviPDa.js → node-response-D3hXWb8y.js} +2 -2
  40. package/dist/_chunks/{node-response-B9aviPDa.js.map → node-response-D3hXWb8y.js.map} +1 -1
  41. package/dist/_chunks/{poison-scan-DJYxZc_7.js → poison-scan-CRSP06Es.js} +2 -2
  42. package/dist/_chunks/{poison-scan-DJYxZc_7.js.map → poison-scan-CRSP06Es.js.map} +1 -1
  43. package/dist/_chunks/route-methods-Dk2kZc0n.js +36 -0
  44. package/dist/_chunks/route-methods-Dk2kZc0n.js.map +1 -0
  45. package/dist/_chunks/{scanner-CJC-ScJU.js → scanner-BNQ4qnLX.js} +2 -2
  46. package/dist/_chunks/{scanner-CJC-ScJU.js.map → scanner-BNQ4qnLX.js.map} +1 -1
  47. package/dist/_chunks/segment-context-GAyTjjtS.js +33 -0
  48. package/dist/_chunks/segment-context-GAyTjjtS.js.map +1 -0
  49. package/dist/_chunks/{sizeof-DG4W40lv.js → sizeof-Cmx6Fs-Y.js} +2 -2
  50. package/dist/_chunks/{sizeof-DG4W40lv.js.map → sizeof-Cmx6Fs-Y.js.map} +1 -1
  51. package/dist/_chunks/{status-page-marker-C8POawuF.js → status-page-marker-U6B1aFMb.js} +3 -32
  52. package/dist/_chunks/status-page-marker-U6B1aFMb.js.map +1 -0
  53. package/dist/_chunks/{walkers-DIE203ir.js → walkers-D_QHR_nf.js} +3 -3
  54. package/dist/_chunks/{walkers-DIE203ir.js.map → walkers-D_QHR_nf.js.map} +1 -1
  55. package/dist/adapters/cloudflare-kv-cache.js +1 -1
  56. package/dist/analyze/crawl-entry.js +3 -3
  57. package/dist/analyze/graph-command.js +2 -2
  58. package/dist/cache/index.js +2 -2
  59. package/dist/cache/stores/memory.js +1 -1
  60. package/dist/cli.js +3 -3
  61. package/dist/client/browser-entry/hmr.d.ts +7 -1
  62. package/dist/client/browser-entry/hmr.d.ts.map +1 -1
  63. package/dist/client/dev-pill/index.d.ts +32 -0
  64. package/dist/client/dev-pill/index.d.ts.map +1 -0
  65. package/dist/client/dev-pill/store.d.ts +96 -0
  66. package/dist/client/dev-pill/store.d.ts.map +1 -0
  67. package/dist/client/dev-pill/view.d.ts +9 -0
  68. package/dist/client/dev-pill/view.d.ts.map +1 -0
  69. package/dist/client/error-boundary.js +1 -1
  70. package/dist/client/index.d.ts +1 -0
  71. package/dist/client/index.d.ts.map +1 -1
  72. package/dist/client/index.js +3 -3
  73. package/dist/client/internal.js +16 -7
  74. package/dist/client/internal.js.map +1 -1
  75. package/dist/client/navigation-context.d.ts +20 -0
  76. package/dist/client/navigation-context.d.ts.map +1 -1
  77. package/dist/client/router-lifecycle.d.ts +4 -1
  78. package/dist/client/router-lifecycle.d.ts.map +1 -1
  79. package/dist/client/use-pending-navigation.d.ts +33 -9
  80. package/dist/client/use-pending-navigation.d.ts.map +1 -1
  81. package/dist/config-types.d.ts +10 -0
  82. package/dist/config-types.d.ts.map +1 -1
  83. package/dist/config-validation.d.ts.map +1 -1
  84. package/dist/dev-tools/await-span.d.ts +17 -0
  85. package/dist/dev-tools/await-span.d.ts.map +1 -0
  86. package/dist/dev-tools/instrumentation.d.ts.map +1 -1
  87. package/dist/dev-tools/logger.d.ts.map +1 -1
  88. package/dist/dev-tools/logs.d.ts.map +1 -1
  89. package/dist/dev-tools/span-sink.d.ts +42 -0
  90. package/dist/dev-tools/span-sink.d.ts.map +1 -0
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +282 -9
  93. package/dist/index.js.map +1 -1
  94. package/dist/plugins/dev-await.d.ts +40 -0
  95. package/dist/plugins/dev-await.d.ts.map +1 -0
  96. package/dist/plugins/entries.d.ts.map +1 -1
  97. package/dist/routing/convention-lint.d.ts.map +1 -1
  98. package/dist/routing/index.js +2 -2
  99. package/dist/server/action-handler.d.ts.map +1 -1
  100. package/dist/server/csrf.d.ts +1 -1
  101. package/dist/server/csrf.d.ts.map +1 -1
  102. package/dist/server/index.js +2 -2
  103. package/dist/server/internal.d.ts +2 -1
  104. package/dist/server/internal.d.ts.map +1 -1
  105. package/dist/server/internal.js +26 -27
  106. package/dist/server/internal.js.map +1 -1
  107. package/dist/server/pipeline.d.ts +8 -0
  108. package/dist/server/pipeline.d.ts.map +1 -1
  109. package/dist/server/route-handler.d.ts +1 -2
  110. package/dist/server/route-handler.d.ts.map +1 -1
  111. package/dist/server/route-methods.d.ts +23 -0
  112. package/dist/server/route-methods.d.ts.map +1 -0
  113. package/dist/server/rsc-entry/index.d.ts.map +1 -1
  114. package/dist/server/slot-resolver.d.ts.map +1 -1
  115. package/dist/server/tracing.d.ts +18 -8
  116. package/dist/server/tracing.d.ts.map +1 -1
  117. package/dist/shared/dev-span.d.ts +97 -0
  118. package/dist/shared/dev-span.d.ts.map +1 -0
  119. package/docs/api/31-api-client.mdx +27 -1
  120. package/docs/api/34-api-config.mdx +21 -1
  121. package/docs/learn/09-streaming.mdx +7 -1
  122. package/package.json +3 -3
  123. package/src/client/browser-entry/hmr.ts +13 -1
  124. package/src/client/browser-entry/index.ts +4 -1
  125. package/src/client/dev-pill/index.ts +128 -0
  126. package/src/client/dev-pill/store.ts +231 -0
  127. package/src/client/dev-pill/view.ts +278 -0
  128. package/src/client/index.ts +1 -0
  129. package/src/client/navigation-context.ts +5 -2
  130. package/src/client/router-lifecycle.ts +23 -3
  131. package/src/client/use-pending-navigation.ts +93 -14
  132. package/src/config-types.ts +10 -0
  133. package/src/config-validation.ts +10 -0
  134. package/src/dev-tools/await-span.ts +40 -0
  135. package/src/dev-tools/instrumentation.ts +20 -0
  136. package/src/dev-tools/logger.ts +3 -37
  137. package/src/dev-tools/logs.ts +10 -1
  138. package/src/dev-tools/span-sink.ts +132 -0
  139. package/src/index.ts +2 -0
  140. package/src/plugins/dev-await.ts +268 -0
  141. package/src/plugins/entries.ts +2 -0
  142. package/src/routing/convention-lint.ts +1 -3
  143. package/src/server/action-handler.ts +5 -0
  144. package/src/server/csrf.ts +11 -3
  145. package/src/server/internal.ts +2 -1
  146. package/src/server/pipeline.ts +14 -0
  147. package/src/server/route-handler.ts +8 -19
  148. package/src/server/route-methods.ts +37 -0
  149. package/src/server/rsc-entry/index.ts +7 -1
  150. package/src/server/slot-resolver.ts +45 -5
  151. package/src/server/tracing.ts +124 -90
  152. package/src/shared/dev-span.ts +182 -0
  153. package/dist/_chunks/build-manifest-Y4jl7nwU.js.map +0 -1
  154. package/dist/_chunks/chains-CwOr3Myj.js +0 -1
  155. package/dist/_chunks/convention-lint-hZwz5wd4.js.map +0 -1
  156. package/dist/_chunks/dev-server-B7o4As0l.js.map +0 -1
  157. package/dist/_chunks/dev-server-hZzmbMvK.js +0 -1
  158. package/dist/_chunks/global-context-DbxNWeBP.js.map +0 -1
  159. package/dist/_chunks/logger-CWk44DLp.js.map +0 -1
  160. package/dist/_chunks/navigation-root-M3B2ZrdO.js +0 -122
  161. package/dist/_chunks/navigation-root-M3B2ZrdO.js.map +0 -1
  162. package/dist/_chunks/segment-context-CYiGTi3K.js +0 -131
  163. package/dist/_chunks/segment-context-CYiGTi3K.js.map +0 -1
  164. package/dist/_chunks/status-page-marker-C8POawuF.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { n as INFERRED_RULES, t as EXPLICIT_MARKERS } from "./poison-rules-Bmz-lCPi.js";
2
- import { o as langForFile, t as PARSEABLE_EXTENSIONS } from "./classify--_kINHQV.js";
2
+ import { o as langForFile, t as PARSEABLE_EXTENSIONS } from "./classify-_W0RWa5w.js";
3
3
  import { parseAst } from "vite";
4
4
  // src/analyze/poison-scan.ts
5
5
  /**
@@ -95,4 +95,4 @@ function poisoningsFor(kind, pending, signals) {
95
95
  }
96
96
  export { importSignals as n, poisoningsFor as r, collectImportSpecifiers as t };
97
97
 
98
- //# sourceMappingURL=poison-scan-DJYxZc_7.js.map
98
+ //# sourceMappingURL=poison-scan-CRSP06Es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"poison-scan-DJYxZc_7.js","names":[],"sources":["../../src/analyze/poison-scan.ts"],"sourcesContent":["/**\n * poison-scan — report-only poisoning detection for `timber graph`.\n *\n * Matches a module's static import specifiers against the shared rule\n * lists in poison-rules.ts (the single source of truth — design/47 §3)\n * and reports a poisoning only when the implied exclusivity CONFLICTS\n * with where the module actually runs: a server-only signal in a\n * client-reachable module, or a client-only signal in a server-reachable\n * one. A `node:fs` import in a file only the RSC environment loads is\n * working code, not a finding.\n *\n * Scope: import-specifier signals only (explicit markers + the inferred\n * rules' `matchesImport`). The inferred browser-global identifier rules\n * need shadow-safe allowlisted-position AST matching and are a separate\n * ticket — reporting them from a text scan would flag legitimate code.\n *\n * Design docs: 47-module-environment-tooling.md §3.\n */\n\nimport { parseAst } from 'vite';\nimport { EXPLICIT_MARKERS, INFERRED_RULES } from './poison-rules.ts';\nimport { langForFile, PARSEABLE_EXTENSIONS, type ModuleKind } from './classify.ts';\n\n/** One poisoning finding on a module, in the JSON-contract shape. */\nexport interface Poisoning {\n /** Rule id — an inferred rule's id, or the explicit marker specifier. */\n rule: string;\n /** The import specifier that matched. */\n specifier: string;\n /** Which exclusivity the signal implies for the containing module. */\n implies: 'server-only' | 'client-only';\n /** Human-readable description for reporter output. */\n description: string;\n}\n\n/**\n * A NON-EMPTY specifier list where every entry is type-only. Empty or\n * absent lists return false — a bare `import 'pkg'` is a side-effect\n * import and very much runs.\n */\nfunction isAllSpecifiersTypeOnly(\n specifiers: Array<{ importKind?: string; exportKind?: string }> | undefined\n): boolean {\n if (!specifiers || specifiers.length === 0) return false;\n return specifiers.every((s) => s.importKind === 'type' || s.exportKind === 'type');\n}\n\n/**\n * Collect every static import/export source and string-literal dynamic\n * import from a module's original source. Sources that fail to parse\n * (or are not JS/TS at all) return [] — no specifiers is a safe\n * default for a report-only scan.\n */\nexport function collectImportSpecifiers(code: string, file: string): string[] {\n if (!PARSEABLE_EXTENSIONS.test(file)) return [];\n let program;\n try {\n // Language from the extension, never forced tsx — see langForFile.\n program = parseAst(code, { lang: langForFile(file) });\n } catch {\n return [];\n }\n const specifiers: string[] = [];\n const visit = (node: unknown): void => {\n if (Array.isArray(node)) {\n for (const child of node) visit(child);\n return;\n }\n if (typeof node !== 'object' || node === null) return;\n const record = node as Record<string, unknown> & {\n type?: string;\n importKind?: string;\n exportKind?: string;\n specifiers?: Array<{ importKind?: string; exportKind?: string }>;\n };\n if (\n (record.type === 'ImportDeclaration' ||\n record.type === 'ExportNamedDeclaration' ||\n record.type === 'ExportAllDeclaration') &&\n // Type-only imports/exports are erased at runtime — `import type\n // { Stats } from 'node:fs'` in client code is working code, and\n // flagging it would be a false positive in a report-only scan.\n // Covers both the declaration-level form (`import type {…}`,\n // importKind on the declaration) and the inline form\n // (`import { type Stats }`, where the declaration stays 'value'\n // and each SPECIFIER carries the kind) — a declaration whose\n // specifiers are all type-only is erased just the same.\n record.importKind !== 'type' &&\n record.exportKind !== 'type' &&\n !isAllSpecifiersTypeOnly(record.specifiers) &&\n typeof (record.source as { value?: unknown } | null)?.value === 'string'\n ) {\n specifiers.push((record.source as { value: string }).value);\n } else if (\n record.type === 'ImportExpression' &&\n (record.source as { type?: string; value?: unknown })?.type === 'Literal' &&\n typeof (record.source as { value?: unknown }).value === 'string'\n ) {\n specifiers.push((record.source as { value: string }).value);\n }\n for (const key of Object.keys(record)) {\n if (key === 'type') continue;\n visit(record[key]);\n }\n };\n visit(program.body);\n return specifiers;\n}\n\n/** Exclusivity signals a module's import specifiers carry. */\nexport function importSignals(specifiers: string[]): Poisoning[] {\n const signals: Poisoning[] = [];\n for (const specifier of specifiers) {\n for (const marker of EXPLICIT_MARKERS) {\n if (specifier === marker.specifier) {\n signals.push({\n rule: marker.specifier,\n specifier,\n implies: marker.specifier === 'server-only' ? 'server-only' : 'client-only',\n description: `imports the ${marker.specifier} poison-pill marker`,\n });\n }\n }\n for (const rule of INFERRED_RULES) {\n if (rule.matchesImport?.(specifier)) {\n signals.push({\n rule: rule.id,\n specifier,\n implies: rule.implies,\n description: rule.description,\n });\n }\n }\n }\n return signals;\n}\n\n/**\n * Filter a module's signals down to actual conflicts with its\n * classification. Environment reach follows the taxonomy: boundary /\n * client-internal / shared modules run client-side; server / shared /\n * server-action modules run server-side. Pending (provisional) modules\n * run nowhere confirmed, so nothing conflicts yet.\n */\nexport function poisoningsFor(\n kind: ModuleKind,\n pending: boolean,\n signals: Poisoning[]\n): Poisoning[] {\n if (pending || signals.length === 0) return [];\n const clientReachable =\n kind === 'client-boundary' || kind === 'client-internal' || kind === 'shared';\n const serverReachable = kind === 'server' || kind === 'shared' || kind === 'server-action';\n return signals.filter(\n (signal) =>\n (signal.implies === 'server-only' && clientReachable) ||\n (signal.implies === 'client-only' && serverReachable)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,wBACP,YACS;CACT,IAAI,CAAC,cAAc,WAAW,WAAW,GAAG,OAAO;CACnD,OAAO,WAAW,OAAO,MAAM,EAAE,eAAe,UAAU,EAAE,eAAe,MAAM;AACnF;;;;;;;AAQA,SAAgB,wBAAwB,MAAc,MAAwB;CAC5E,IAAI,CAAC,qBAAqB,KAAK,IAAI,GAAG,OAAO,CAAC;CAC9C,IAAI;CACJ,IAAI;EAEF,UAAU,SAAS,MAAM,EAAE,MAAM,YAAY,IAAI,EAAE,CAAC;CACtD,QAAQ;EACN,OAAO,CAAC;CACV;CACA,MAAM,aAAuB,CAAC;CAC9B,MAAM,SAAS,SAAwB;EACrC,IAAI,MAAM,QAAQ,IAAI,GAAG;GACvB,KAAK,MAAM,SAAS,MAAM,MAAM,KAAK;GACrC;EACF;EACA,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;EAC/C,MAAM,SAAS;EAMf,KACG,OAAO,SAAS,uBACf,OAAO,SAAS,4BAChB,OAAO,SAAS,2BASlB,OAAO,eAAe,UACtB,OAAO,eAAe,UACtB,CAAC,wBAAwB,OAAO,UAAU,KAC1C,OAAQ,OAAO,QAAuC,UAAU,UAEhE,WAAW,KAAM,OAAO,OAA6B,KAAK;OACrD,IACL,OAAO,SAAS,sBACf,OAAO,QAA+C,SAAS,aAChE,OAAQ,OAAO,OAA+B,UAAU,UAExD,WAAW,KAAM,OAAO,OAA6B,KAAK;EAE5D,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG;GACrC,IAAI,QAAQ,QAAQ;GACpB,MAAM,OAAO,IAAI;EACnB;CACF;CACA,MAAM,QAAQ,IAAI;CAClB,OAAO;AACT;;AAGA,SAAgB,cAAc,YAAmC;CAC/D,MAAM,UAAuB,CAAC;CAC9B,KAAK,MAAM,aAAa,YAAY;EAClC,KAAK,MAAM,UAAU,kBACnB,IAAI,cAAc,OAAO,WACvB,QAAQ,KAAK;GACX,MAAM,OAAO;GACb;GACA,SAAS,OAAO,cAAc,gBAAgB,gBAAgB;GAC9D,aAAa,eAAe,OAAO,UAAU;EAC/C,CAAC;EAGL,KAAK,MAAM,QAAQ,gBACjB,IAAI,KAAK,gBAAgB,SAAS,GAChC,QAAQ,KAAK;GACX,MAAM,KAAK;GACX;GACA,SAAS,KAAK;GACd,aAAa,KAAK;EACpB,CAAC;CAGP;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,cACd,MACA,SACA,SACa;CACb,IAAI,WAAW,QAAQ,WAAW,GAAG,OAAO,CAAC;CAC7C,MAAM,kBACJ,SAAS,qBAAqB,SAAS,qBAAqB,SAAS;CACvE,MAAM,kBAAkB,SAAS,YAAY,SAAS,YAAY,SAAS;CAC3E,OAAO,QAAQ,QACZ,WACE,OAAO,YAAY,iBAAiB,mBACpC,OAAO,YAAY,iBAAiB,eACzC;AACF"}
1
+ {"version":3,"file":"poison-scan-CRSP06Es.js","names":[],"sources":["../../src/analyze/poison-scan.ts"],"sourcesContent":["/**\n * poison-scan — report-only poisoning detection for `timber graph`.\n *\n * Matches a module's static import specifiers against the shared rule\n * lists in poison-rules.ts (the single source of truth — design/47 §3)\n * and reports a poisoning only when the implied exclusivity CONFLICTS\n * with where the module actually runs: a server-only signal in a\n * client-reachable module, or a client-only signal in a server-reachable\n * one. A `node:fs` import in a file only the RSC environment loads is\n * working code, not a finding.\n *\n * Scope: import-specifier signals only (explicit markers + the inferred\n * rules' `matchesImport`). The inferred browser-global identifier rules\n * need shadow-safe allowlisted-position AST matching and are a separate\n * ticket — reporting them from a text scan would flag legitimate code.\n *\n * Design docs: 47-module-environment-tooling.md §3.\n */\n\nimport { parseAst } from 'vite';\nimport { EXPLICIT_MARKERS, INFERRED_RULES } from './poison-rules.ts';\nimport { langForFile, PARSEABLE_EXTENSIONS, type ModuleKind } from './classify.ts';\n\n/** One poisoning finding on a module, in the JSON-contract shape. */\nexport interface Poisoning {\n /** Rule id — an inferred rule's id, or the explicit marker specifier. */\n rule: string;\n /** The import specifier that matched. */\n specifier: string;\n /** Which exclusivity the signal implies for the containing module. */\n implies: 'server-only' | 'client-only';\n /** Human-readable description for reporter output. */\n description: string;\n}\n\n/**\n * A NON-EMPTY specifier list where every entry is type-only. Empty or\n * absent lists return false — a bare `import 'pkg'` is a side-effect\n * import and very much runs.\n */\nfunction isAllSpecifiersTypeOnly(\n specifiers: Array<{ importKind?: string; exportKind?: string }> | undefined\n): boolean {\n if (!specifiers || specifiers.length === 0) return false;\n return specifiers.every((s) => s.importKind === 'type' || s.exportKind === 'type');\n}\n\n/**\n * Collect every static import/export source and string-literal dynamic\n * import from a module's original source. Sources that fail to parse\n * (or are not JS/TS at all) return [] — no specifiers is a safe\n * default for a report-only scan.\n */\nexport function collectImportSpecifiers(code: string, file: string): string[] {\n if (!PARSEABLE_EXTENSIONS.test(file)) return [];\n let program;\n try {\n // Language from the extension, never forced tsx — see langForFile.\n program = parseAst(code, { lang: langForFile(file) });\n } catch {\n return [];\n }\n const specifiers: string[] = [];\n const visit = (node: unknown): void => {\n if (Array.isArray(node)) {\n for (const child of node) visit(child);\n return;\n }\n if (typeof node !== 'object' || node === null) return;\n const record = node as Record<string, unknown> & {\n type?: string;\n importKind?: string;\n exportKind?: string;\n specifiers?: Array<{ importKind?: string; exportKind?: string }>;\n };\n if (\n (record.type === 'ImportDeclaration' ||\n record.type === 'ExportNamedDeclaration' ||\n record.type === 'ExportAllDeclaration') &&\n // Type-only imports/exports are erased at runtime — `import type\n // { Stats } from 'node:fs'` in client code is working code, and\n // flagging it would be a false positive in a report-only scan.\n // Covers both the declaration-level form (`import type {…}`,\n // importKind on the declaration) and the inline form\n // (`import { type Stats }`, where the declaration stays 'value'\n // and each SPECIFIER carries the kind) — a declaration whose\n // specifiers are all type-only is erased just the same.\n record.importKind !== 'type' &&\n record.exportKind !== 'type' &&\n !isAllSpecifiersTypeOnly(record.specifiers) &&\n typeof (record.source as { value?: unknown } | null)?.value === 'string'\n ) {\n specifiers.push((record.source as { value: string }).value);\n } else if (\n record.type === 'ImportExpression' &&\n (record.source as { type?: string; value?: unknown })?.type === 'Literal' &&\n typeof (record.source as { value?: unknown }).value === 'string'\n ) {\n specifiers.push((record.source as { value: string }).value);\n }\n for (const key of Object.keys(record)) {\n if (key === 'type') continue;\n visit(record[key]);\n }\n };\n visit(program.body);\n return specifiers;\n}\n\n/** Exclusivity signals a module's import specifiers carry. */\nexport function importSignals(specifiers: string[]): Poisoning[] {\n const signals: Poisoning[] = [];\n for (const specifier of specifiers) {\n for (const marker of EXPLICIT_MARKERS) {\n if (specifier === marker.specifier) {\n signals.push({\n rule: marker.specifier,\n specifier,\n implies: marker.specifier === 'server-only' ? 'server-only' : 'client-only',\n description: `imports the ${marker.specifier} poison-pill marker`,\n });\n }\n }\n for (const rule of INFERRED_RULES) {\n if (rule.matchesImport?.(specifier)) {\n signals.push({\n rule: rule.id,\n specifier,\n implies: rule.implies,\n description: rule.description,\n });\n }\n }\n }\n return signals;\n}\n\n/**\n * Filter a module's signals down to actual conflicts with its\n * classification. Environment reach follows the taxonomy: boundary /\n * client-internal / shared modules run client-side; server / shared /\n * server-action modules run server-side. Pending (provisional) modules\n * run nowhere confirmed, so nothing conflicts yet.\n */\nexport function poisoningsFor(\n kind: ModuleKind,\n pending: boolean,\n signals: Poisoning[]\n): Poisoning[] {\n if (pending || signals.length === 0) return [];\n const clientReachable =\n kind === 'client-boundary' || kind === 'client-internal' || kind === 'shared';\n const serverReachable = kind === 'server' || kind === 'shared' || kind === 'server-action';\n return signals.filter(\n (signal) =>\n (signal.implies === 'server-only' && clientReachable) ||\n (signal.implies === 'client-only' && serverReachable)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAS,wBACP,YACS;CACT,IAAI,CAAC,cAAc,WAAW,WAAW,GAAG,OAAO;CACnD,OAAO,WAAW,OAAO,MAAM,EAAE,eAAe,UAAU,EAAE,eAAe,MAAM;AACnF;;;;;;;AAQA,SAAgB,wBAAwB,MAAc,MAAwB;CAC5E,IAAI,CAAC,qBAAqB,KAAK,IAAI,GAAG,OAAO,CAAC;CAC9C,IAAI;CACJ,IAAI;EAEF,UAAU,SAAS,MAAM,EAAE,MAAM,YAAY,IAAI,EAAE,CAAC;CACtD,QAAQ;EACN,OAAO,CAAC;CACV;CACA,MAAM,aAAuB,CAAC;CAC9B,MAAM,SAAS,SAAwB;EACrC,IAAI,MAAM,QAAQ,IAAI,GAAG;GACvB,KAAK,MAAM,SAAS,MAAM,MAAM,KAAK;GACrC;EACF;EACA,IAAI,OAAO,SAAS,YAAY,SAAS,MAAM;EAC/C,MAAM,SAAS;EAMf,KACG,OAAO,SAAS,uBACf,OAAO,SAAS,4BAChB,OAAO,SAAS,2BASlB,OAAO,eAAe,UACtB,OAAO,eAAe,UACtB,CAAC,wBAAwB,OAAO,UAAU,KAC1C,OAAQ,OAAO,QAAuC,UAAU,UAEhE,WAAW,KAAM,OAAO,OAA6B,KAAK;OACrD,IACL,OAAO,SAAS,sBACf,OAAO,QAA+C,SAAS,aAChE,OAAQ,OAAO,OAA+B,UAAU,UAExD,WAAW,KAAM,OAAO,OAA6B,KAAK;EAE5D,KAAK,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG;GACrC,IAAI,QAAQ,QAAQ;GACpB,MAAM,OAAO,IAAI;EACnB;CACF;CACA,MAAM,QAAQ,IAAI;CAClB,OAAO;AACT;;AAGA,SAAgB,cAAc,YAAmC;CAC/D,MAAM,UAAuB,CAAC;CAC9B,KAAK,MAAM,aAAa,YAAY;EAClC,KAAK,MAAM,UAAU,kBACnB,IAAI,cAAc,OAAO,WACvB,QAAQ,KAAK;GACX,MAAM,OAAO;GACb;GACA,SAAS,OAAO,cAAc,gBAAgB,gBAAgB;GAC9D,aAAa,eAAe,OAAO,UAAU;EAC/C,CAAC;EAGL,KAAK,MAAM,QAAQ,gBACjB,IAAI,KAAK,gBAAgB,SAAS,GAChC,QAAQ,KAAK;GACX,MAAM,KAAK;GACX;GACA,SAAS,KAAK;GACd,aAAa,KAAK;EACpB,CAAC;CAGP;CACA,OAAO;AACT;;;;;;;;AASA,SAAgB,cACd,MACA,SACA,SACa;CACb,IAAI,WAAW,QAAQ,WAAW,GAAG,OAAO,CAAC;CAC7C,MAAM,kBACJ,SAAS,qBAAqB,SAAS,qBAAqB,SAAS;CACvE,MAAM,kBAAkB,SAAS,YAAY,SAAS,YAAY,SAAS;CAC3E,OAAO,QAAQ,QACZ,WACE,OAAO,YAAY,iBAAiB,mBACpC,OAAO,YAAY,iBAAiB,eACzC;AACF"}
@@ -0,0 +1,36 @@
1
+ // src/server/route-methods.ts
2
+ /**
3
+ * The HTTP methods a `route.ts` can export as named handlers.
4
+ *
5
+ * A leaf module with no imports, so the build-time convention lint
6
+ * (`routing/convention-lint.ts`) and the runtime dispatcher
7
+ * (`server/route-handler.ts`) read one list without the lint pulling in
8
+ * the request runtime. Adding a method here updates the `RouteModule` type,
9
+ * the `Allow` header on 405 and automatic `OPTIONS` responses, and the
10
+ * `ROUTE_NO_METHODS` lint together.
11
+ *
12
+ * `QUERY` is RFC 10008's safe, idempotent method with a request body.
13
+ * See design/07-routing.md §"Supported Methods".
14
+ */
15
+ var HTTP_METHODS = [
16
+ "GET",
17
+ "QUERY",
18
+ "POST",
19
+ "PUT",
20
+ "PATCH",
21
+ "DELETE",
22
+ "HEAD",
23
+ "OPTIONS"
24
+ ];
25
+ var METHOD_SET = new Set(HTTP_METHODS);
26
+ /**
27
+ * Whether a request method names a route.ts handler. Exact case: method
28
+ * names are case-sensitive (RFC 9110 §9.1), and the CSRF gate compares them
29
+ * exactly, so `query` is not `QUERY` here either.
30
+ */
31
+ function isHttpMethod(method) {
32
+ return METHOD_SET.has(method);
33
+ }
34
+ export { isHttpMethod as n, HTTP_METHODS as t };
35
+
36
+ //# sourceMappingURL=route-methods-Dk2kZc0n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-methods-Dk2kZc0n.js","names":[],"sources":["../../src/server/route-methods.ts"],"sourcesContent":["/**\n * The HTTP methods a `route.ts` can export as named handlers.\n *\n * A leaf module with no imports, so the build-time convention lint\n * (`routing/convention-lint.ts`) and the runtime dispatcher\n * (`server/route-handler.ts`) read one list without the lint pulling in\n * the request runtime. Adding a method here updates the `RouteModule` type,\n * the `Allow` header on 405 and automatic `OPTIONS` responses, and the\n * `ROUTE_NO_METHODS` lint together.\n *\n * `QUERY` is RFC 10008's safe, idempotent method with a request body.\n * See design/07-routing.md §\"Supported Methods\".\n */\nexport const HTTP_METHODS = [\n 'GET',\n 'QUERY',\n 'POST',\n 'PUT',\n 'PATCH',\n 'DELETE',\n 'HEAD',\n 'OPTIONS',\n] as const;\n\n/** HTTP methods that route.ts can export as named handlers. */\nexport type HttpMethod = (typeof HTTP_METHODS)[number];\n\nconst METHOD_SET: ReadonlySet<string> = new Set(HTTP_METHODS);\n\n/**\n * Whether a request method names a route.ts handler. Exact case: method\n * names are case-sensitive (RFC 9110 §9.1), and the CSRF gate compares them\n * exactly, so `query` is not `QUERY` here either.\n */\nexport function isHttpMethod(method: string): method is HttpMethod {\n return METHOD_SET.has(method);\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,IAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAKA,IAAM,aAAkC,IAAI,IAAI,YAAY;;;;;;AAO5D,SAAgB,aAAa,QAAsC;CACjE,OAAO,WAAW,IAAI,MAAM;AAC9B"}
@@ -3,7 +3,7 @@ import { n as NULL_BYTE_RE, t as ENCODED_SEPARATOR_RE } from "./canonicalize-CqK
3
3
  import { t as matchUrlParts } from "./tree-match-Bqdr9szG.js";
4
4
  import { i as DEFAULT_PAGE_EXTENSIONS, n as classifyUrlSegment, r as effectiveUrlSegment, t as classifySegment } from "./segment-classify-Ho8jXWeC.js";
5
5
  import { n as treePathDepth, t as computeSegmentTreePaths } from "./segment-keys-Y60KNc8C.js";
6
- import { b as swallow } from "./logger-CWk44DLp.js";
6
+ import { b as swallow } from "./logger-YtMSKfft.js";
7
7
  import { parseAst } from "vite";
8
8
  import { basename, extname, join } from "node:path";
9
9
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
@@ -2045,4 +2045,4 @@ function findScriptExtFile(dirPath, name) {
2045
2045
  }
2046
2046
  export { fileHasDefaultExport as a, getCsrfExport as c, collectInterceptionRewrites as d, fileHasAnyExport as i, getPrerenderExport as l, scanRoutes as n, fileHasDirective as o, fileDefaultExportIsLocalValue as r, fileHasStarExport as s, isRouteConventionFile as t, readFileCached as u };
2047
2047
 
2048
- //# sourceMappingURL=scanner-CJC-ScJU.js.map
2048
+ //# sourceMappingURL=scanner-BNQ4qnLX.js.map