@intentius/chant 0.124.85 → 0.124.87

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 (286) hide show
  1. package/dist/bundle-check.d.ts +102 -0
  2. package/dist/bundle-check.d.ts.map +1 -0
  3. package/dist/bundle-check.js +310 -0
  4. package/dist/chant-install.d.ts +100 -0
  5. package/dist/chant-install.d.ts.map +1 -0
  6. package/dist/chant-install.js +158 -0
  7. package/dist/ci-commit.d.ts +19 -6
  8. package/dist/ci-commit.d.ts.map +1 -1
  9. package/dist/ci-commit.js +23 -4
  10. package/dist/ci-evidence-jobs.d.ts +78 -0
  11. package/dist/ci-evidence-jobs.d.ts.map +1 -0
  12. package/dist/ci-evidence-jobs.js +85 -0
  13. package/dist/ci-image.d.ts +274 -0
  14. package/dist/ci-image.d.ts.map +1 -0
  15. package/dist/ci-image.js +635 -0
  16. package/dist/ci-login.d.ts +150 -0
  17. package/dist/ci-login.d.ts.map +1 -0
  18. package/dist/ci-login.js +240 -0
  19. package/dist/ci-product.d.ts +16 -0
  20. package/dist/ci-product.d.ts.map +1 -1
  21. package/dist/ci-product.js +17 -0
  22. package/dist/cli/commands/import-index.js +2 -2
  23. package/dist/cli/handlers/build.d.ts +8 -0
  24. package/dist/cli/handlers/build.d.ts.map +1 -1
  25. package/dist/cli/handlers/build.js +22 -4
  26. package/dist/cli/handlers/ci-check.d.ts.map +1 -1
  27. package/dist/cli/handlers/ci-check.js +61 -2
  28. package/dist/cli/handlers/ci-evidence.d.ts +3 -0
  29. package/dist/cli/handlers/ci-evidence.d.ts.map +1 -0
  30. package/dist/cli/handlers/ci-evidence.js +174 -0
  31. package/dist/cli/handlers/components.js +3 -3
  32. package/dist/cli/handlers/dead-guards.d.ts +3 -0
  33. package/dist/cli/handlers/dead-guards.d.ts.map +1 -0
  34. package/dist/cli/handlers/dead-guards.js +35 -0
  35. package/dist/cli/handlers/graph.js +4 -4
  36. package/dist/cli/handlers/lifecycle.d.ts +2 -1
  37. package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
  38. package/dist/cli/handlers/lifecycle.js +5 -4
  39. package/dist/cli/handlers/local-chant.d.ts +16 -0
  40. package/dist/cli/handlers/local-chant.d.ts.map +1 -0
  41. package/dist/cli/handlers/local-chant.js +109 -0
  42. package/dist/cli/handlers/operator.js +2 -2
  43. package/dist/cli/handlers/search.js +5 -5
  44. package/dist/cli/main.d.ts.map +1 -1
  45. package/dist/cli/main.js +38 -0
  46. package/dist/cli/parse-args.d.ts.map +1 -1
  47. package/dist/cli/parse-args.js +28 -0
  48. package/dist/cli/registry.d.ts +16 -0
  49. package/dist/cli/registry.d.ts.map +1 -1
  50. package/dist/components/check-hooks.d.ts +49 -0
  51. package/dist/components/check-hooks.d.ts.map +1 -1
  52. package/dist/components/check-hooks.js +64 -4
  53. package/dist/components/check-steps.d.ts +17 -0
  54. package/dist/components/check-steps.d.ts.map +1 -1
  55. package/dist/components/check-steps.js +37 -5
  56. package/dist/components/product-pipeline.d.ts +23 -0
  57. package/dist/components/product-pipeline.d.ts.map +1 -1
  58. package/dist/components/product-pipeline.js +6 -2
  59. package/dist/components/product-plan.d.ts +143 -0
  60. package/dist/components/product-plan.d.ts.map +1 -0
  61. package/dist/components/product-plan.js +145 -0
  62. package/dist/components/release-compile.d.ts.map +1 -1
  63. package/dist/components/release-compile.js +2 -2
  64. package/dist/config.d.ts +39 -1
  65. package/dist/config.d.ts.map +1 -1
  66. package/dist/config.js +35 -3
  67. package/dist/dead-guards.d.ts +82 -0
  68. package/dist/dead-guards.d.ts.map +1 -0
  69. package/dist/dead-guards.js +436 -0
  70. package/dist/discovery/files.d.ts +3 -1
  71. package/dist/discovery/files.d.ts.map +1 -1
  72. package/dist/discovery/files.js +5 -3
  73. package/dist/drift-issue.d.ts +152 -0
  74. package/dist/drift-issue.d.ts.map +1 -0
  75. package/dist/drift-issue.js +167 -0
  76. package/dist/floor-table.d.ts +30 -0
  77. package/dist/floor-table.d.ts.map +1 -0
  78. package/dist/floor-table.data.d.ts +3 -0
  79. package/dist/floor-table.data.d.ts.map +1 -0
  80. package/dist/floor-table.data.js +179 -0
  81. package/dist/floor-table.js +56 -0
  82. package/dist/forge-flags.d.ts +90 -0
  83. package/dist/forge-flags.d.ts.map +1 -0
  84. package/dist/forge-flags.js +184 -0
  85. package/dist/lexicon.d.ts +69 -0
  86. package/dist/lexicon.d.ts.map +1 -1
  87. package/dist/lifecycle/gated-op.d.ts +7 -1
  88. package/dist/lifecycle/gated-op.d.ts.map +1 -1
  89. package/dist/lifecycle/gated-op.js +7 -4
  90. package/dist/local-chant.d.ts +98 -0
  91. package/dist/local-chant.d.ts.map +1 -0
  92. package/dist/local-chant.js +307 -0
  93. package/dist/op/activities/predict-behaviour.js +2 -2
  94. package/dist/op/op-waves-evidence-spec.d.ts +13 -0
  95. package/dist/op/op-waves-evidence-spec.d.ts.map +1 -0
  96. package/dist/op/op-waves-evidence-spec.js +21 -0
  97. package/dist/op/op-waves-evidence.d.ts +40 -0
  98. package/dist/op/op-waves-evidence.d.ts.map +1 -0
  99. package/dist/op/op-waves-evidence.js +58 -0
  100. package/dist/op/op-waves-run.d.ts +4 -0
  101. package/dist/op/op-waves-run.d.ts.map +1 -1
  102. package/dist/op/op-waves-run.js +24 -1
  103. package/dist/op/op-waves.d.ts +17 -1
  104. package/dist/op/op-waves.d.ts.map +1 -1
  105. package/dist/op/op-waves.js +23 -0
  106. package/dist/op/schedule-overdue.d.ts +41 -9
  107. package/dist/op/schedule-overdue.d.ts.map +1 -1
  108. package/dist/op/schedule-overdue.js +154 -25
  109. package/dist/plan-summary.d.ts +25 -0
  110. package/dist/plan-summary.d.ts.map +1 -1
  111. package/dist/plan-summary.js +31 -0
  112. package/dist/pr-plan-note.d.ts +35 -0
  113. package/dist/pr-plan-note.d.ts.map +1 -1
  114. package/dist/pr-plan-note.js +10 -0
  115. package/dist/pr-post.d.ts +23 -0
  116. package/dist/pr-post.d.ts.map +1 -1
  117. package/dist/pr-post.js +125 -3
  118. package/dist/release-floors.d.ts +33 -1
  119. package/dist/release-floors.d.ts.map +1 -1
  120. package/dist/release-floors.js +33 -1
  121. package/dist/state-migration.d.ts +24 -0
  122. package/dist/state-migration.d.ts.map +1 -1
  123. package/dist/state-migration.js +100 -5
  124. package/dist/wave-runtime.mjs +309 -302
  125. package/dist/workspace/ci-green.d.ts.map +1 -1
  126. package/dist/workspace/ci-green.js +4 -3
  127. package/dist/workspace/lexicon-outputs.d.ts.map +1 -1
  128. package/dist/workspace/lexicon-outputs.js +21 -7
  129. package/dist/workspace/reason-codes.d.ts +3 -0
  130. package/dist/workspace/reason-codes.d.ts.map +1 -1
  131. package/dist/workspace/reason-codes.js +4 -0
  132. package/dist/workspace/ref-gate.schema.json +85 -0
  133. package/dist/workspace/search-contract.d.ts +1 -1
  134. package/dist/workspace/search-contract.d.ts.map +1 -1
  135. package/dist/workspace/trust/check-evidence-report.d.ts +58 -0
  136. package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -0
  137. package/dist/workspace/trust/check-evidence-report.js +109 -0
  138. package/dist/workspace/trust/check-evidence.d.ts +160 -0
  139. package/dist/workspace/trust/check-evidence.d.ts.map +1 -0
  140. package/dist/workspace/trust/check-evidence.js +309 -0
  141. package/dist/workspace/trust/ci-tag-statement.d.ts +2 -2
  142. package/dist/workspace/trust/ci-tag-statement.d.ts.map +1 -1
  143. package/dist/workspace/trust/dsse.d.ts +40 -2
  144. package/dist/workspace/trust/dsse.d.ts.map +1 -1
  145. package/dist/workspace/trust/dsse.js +34 -2
  146. package/dist/workspace/trust/evidence.d.ts +2 -2
  147. package/dist/workspace/trust/evidence.d.ts.map +1 -1
  148. package/dist/workspace/trust/keyless-fixture.d.ts +41 -0
  149. package/dist/workspace/trust/keyless-fixture.d.ts.map +1 -0
  150. package/dist/workspace/trust/keyless-fixture.js +161 -0
  151. package/dist/workspace/trust/keyless.d.ts +202 -0
  152. package/dist/workspace/trust/keyless.d.ts.map +1 -0
  153. package/dist/workspace/trust/keyless.js +488 -0
  154. package/dist/workspace/trust/local-evidence.d.ts +123 -0
  155. package/dist/workspace/trust/local-evidence.d.ts.map +1 -0
  156. package/dist/workspace/trust/local-evidence.js +259 -0
  157. package/dist/workspace/trust/op-run-statement.d.ts +2 -2
  158. package/dist/workspace/trust/op-run-statement.d.ts.map +1 -1
  159. package/dist/workspace/trust/policy.d.ts +140 -1
  160. package/dist/workspace/trust/policy.d.ts.map +1 -1
  161. package/dist/workspace/trust/policy.js +197 -3
  162. package/dist/workspace/trust/ref-gate-cli.d.ts +33 -0
  163. package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -0
  164. package/dist/workspace/trust/ref-gate-cli.js +234 -0
  165. package/dist/workspace/trust/ref-gate-fixture.d.ts +38 -0
  166. package/dist/workspace/trust/ref-gate-fixture.d.ts.map +1 -0
  167. package/dist/workspace/trust/ref-gate-fixture.js +97 -0
  168. package/dist/workspace/trust/ref-gate.d.ts +187 -0
  169. package/dist/workspace/trust/ref-gate.d.ts.map +1 -0
  170. package/dist/workspace/trust/ref-gate.js +432 -0
  171. package/dist/workspace/trust/run-statement.d.ts +3 -3
  172. package/dist/workspace/trust/run-statement.d.ts.map +1 -1
  173. package/dist/workspace/trust/runner-identity.d.ts +56 -0
  174. package/dist/workspace/trust/runner-identity.d.ts.map +1 -0
  175. package/dist/workspace/trust/runner-identity.js +65 -0
  176. package/dist/workspace/trust/trust-files.d.ts.map +1 -1
  177. package/dist/workspace/trust/trust-files.js +25 -1
  178. package/package.json +1 -1
  179. package/src/bundle-check.test.ts +140 -0
  180. package/src/bundle-check.ts +352 -0
  181. package/src/chant-install.test.ts +112 -0
  182. package/src/chant-install.ts +179 -0
  183. package/src/ci-commit.test.ts +45 -0
  184. package/src/ci-commit.ts +38 -4
  185. package/src/ci-evidence-jobs.ts +105 -0
  186. package/src/ci-image.test.ts +506 -0
  187. package/src/ci-image.ts +822 -0
  188. package/src/ci-login.test.ts +235 -0
  189. package/src/ci-login.ts +307 -0
  190. package/src/ci-product.ts +18 -0
  191. package/src/cli/commands/__fixtures__/source-dir-include/chant.config.json +1 -0
  192. package/src/cli/commands/__fixtures__/source-dir-include/infra.ts +1 -0
  193. package/src/cli/commands/__fixtures__/source-dir-include/scripts/run-on-load.ts +3 -0
  194. package/src/cli/commands/__fixtures__/source-dir-root/chant.config.json +1 -0
  195. package/src/cli/commands/__fixtures__/source-dir-root/infra.test.ts +1 -0
  196. package/src/cli/commands/__fixtures__/source-dir-root/infra.ts +1 -0
  197. package/src/cli/commands/__fixtures__/source-dir-root/scripts/run-on-load.ts +3 -0
  198. package/src/cli/commands/__fixtures__/source-dir-scoped/app.ts +3 -0
  199. package/src/cli/commands/__fixtures__/source-dir-scoped/chant.config.json +1 -0
  200. package/src/cli/commands/__fixtures__/source-dir-scoped/infra/net.ts +1 -0
  201. package/src/cli/commands/__fixtures__/source-dir-scoped/scripts/run-on-load.ts +3 -0
  202. package/src/cli/commands/import-index.ts +2 -2
  203. package/src/cli/handlers/build-source-dir.test.ts +64 -0
  204. package/src/cli/handlers/build.ts +21 -4
  205. package/src/cli/handlers/ci-check.ts +60 -3
  206. package/src/cli/handlers/ci-evidence.ts +167 -0
  207. package/src/cli/handlers/components.ts +3 -3
  208. package/src/cli/handlers/dead-guards.ts +37 -0
  209. package/src/cli/handlers/graph.ts +4 -4
  210. package/src/cli/handlers/lifecycle.ts +5 -4
  211. package/src/cli/handlers/local-chant.ts +106 -0
  212. package/src/cli/handlers/operator.ts +2 -2
  213. package/src/cli/handlers/search.ts +5 -5
  214. package/src/cli/main.test.ts +7 -0
  215. package/src/cli/main.ts +38 -0
  216. package/src/cli/parse-args.ts +21 -0
  217. package/src/cli/registry.ts +16 -0
  218. package/src/components/check-evidence-stage.test.ts +80 -0
  219. package/src/components/check-hooks.ts +84 -4
  220. package/src/components/check-local-evidence-stage.test.ts +141 -0
  221. package/src/components/check-steps.ts +56 -6
  222. package/src/components/product-pipeline.ts +28 -3
  223. package/src/components/product-plan.test.ts +87 -0
  224. package/src/components/product-plan.ts +230 -0
  225. package/src/components/release-compile.ts +2 -2
  226. package/src/config.ts +44 -3
  227. package/src/dead-guards.test.ts +206 -0
  228. package/src/dead-guards.ts +446 -0
  229. package/src/discovery/files.ts +5 -3
  230. package/src/drift-issue-bundle.test.ts +31 -0
  231. package/src/drift-issue.test.ts +206 -0
  232. package/src/drift-issue.ts +274 -0
  233. package/src/fit-note.test.ts +44 -0
  234. package/src/floor-table.data.ts +181 -0
  235. package/src/floor-table.ts +77 -0
  236. package/src/forge-flags.test.ts +110 -0
  237. package/src/forge-flags.ts +208 -0
  238. package/src/gate-decision-bundle.test.ts +1 -0
  239. package/src/lexicon.ts +68 -0
  240. package/src/lifecycle/gated-op.ts +10 -5
  241. package/src/local-chant.e2e.test.ts +94 -0
  242. package/src/local-chant.test.ts +162 -0
  243. package/src/local-chant.ts +341 -0
  244. package/src/op/activities/predict-behaviour.ts +2 -2
  245. package/src/op/op-waves-evidence-spec.ts +24 -0
  246. package/src/op/op-waves-evidence.test.ts +130 -0
  247. package/src/op/op-waves-evidence.ts +58 -0
  248. package/src/op/op-waves-run.ts +25 -1
  249. package/src/op/op-waves.ts +31 -1
  250. package/src/op/schedule-overdue.test.ts +85 -0
  251. package/src/op/schedule-overdue.ts +162 -26
  252. package/src/plan-summary.ts +40 -0
  253. package/src/pr-plan-note.ts +34 -0
  254. package/src/pr-post-plan-note.test.ts +146 -0
  255. package/src/pr-post.ts +127 -3
  256. package/src/release-floors.ts +47 -1
  257. package/src/stage-hooks-bundle.test.ts +1 -0
  258. package/src/state-migration.test.ts +52 -1
  259. package/src/state-migration.ts +107 -5
  260. package/src/workspace/ci-green.ts +4 -3
  261. package/src/workspace/lexicon-outputs.ts +23 -6
  262. package/src/workspace/reason-codes.test.ts +3 -0
  263. package/src/workspace/reason-codes.ts +4 -0
  264. package/src/workspace/ref-gate.schema.json +85 -0
  265. package/src/workspace/trust/check-evidence-report.ts +115 -0
  266. package/src/workspace/trust/check-evidence.test.ts +133 -0
  267. package/src/workspace/trust/check-evidence.ts +327 -0
  268. package/src/workspace/trust/ci-tag-statement.ts +2 -2
  269. package/src/workspace/trust/dsse.ts +48 -4
  270. package/src/workspace/trust/evidence.ts +2 -2
  271. package/src/workspace/trust/keyless-fixture.ts +214 -0
  272. package/src/workspace/trust/keyless.test.ts +220 -0
  273. package/src/workspace/trust/keyless.ts +557 -0
  274. package/src/workspace/trust/local-evidence.test.ts +127 -0
  275. package/src/workspace/trust/local-evidence.ts +268 -0
  276. package/src/workspace/trust/op-run-statement.ts +2 -2
  277. package/src/workspace/trust/policy.ts +263 -3
  278. package/src/workspace/trust/ref-gate-cli.ts +244 -0
  279. package/src/workspace/trust/ref-gate-fixture.ts +125 -0
  280. package/src/workspace/trust/ref-gate.e2e.test.ts +76 -0
  281. package/src/workspace/trust/ref-gate.test.ts +247 -0
  282. package/src/workspace/trust/ref-gate.ts +539 -0
  283. package/src/workspace/trust/run-statement.ts +3 -3
  284. package/src/workspace/trust/runner-identity.ts +92 -0
  285. package/src/workspace/trust/trust-files.test.ts +22 -0
  286. package/src/workspace/trust/trust-files.ts +54 -1
@@ -0,0 +1,102 @@
1
+ /** The directory of `name` as Node finds it from `fromDir`, walking up the node_modules folders, or undefined. */
2
+ export declare function installedPackageDir(name: string, fromDir: string): string | undefined;
3
+ /**
4
+ * The compiled file Node would load for the chant `specifier` (core or a
5
+ * lexicon, with or without a subpath) imported from a file in `fromDir`, or
6
+ * undefined: the specifier is not chant's, the installed package does not
7
+ * export it, exports only TypeScript for it, or is not installed. Plain Node
8
+ * does not load TypeScript from node_modules, so only a compiled target can
9
+ * stay external.
10
+ */
11
+ export declare function chantRuntimeTarget(specifier: string, fromDir: string): string | undefined;
12
+ /** Whether the chant installed for the package at `pkgDir` serves its root as compiled JS (#4591 and later). */
13
+ export declare function chantServesCompiled(pkgDir: string): boolean;
14
+ /** The part of esbuild's plugin API {@link chantExternalPlugin} uses, so this module needs no esbuild types. */
15
+ export interface EsbuildPluginLike {
16
+ name: string;
17
+ setup(build: {
18
+ onResolve(options: {
19
+ filter: RegExp;
20
+ }, callback: (args: {
21
+ path: string;
22
+ }) => {
23
+ path: string;
24
+ external: boolean;
25
+ } | undefined): void;
26
+ }): void;
27
+ }
28
+ /**
29
+ * An esbuild plugin that leaves an `@intentius/chant*` import external when
30
+ * the chant installed for `pkgDir` (where the bin runs) serves it as compiled
31
+ * JS, so the bundle runs the installed, pinned chant. Any other chant import
32
+ * goes on to the next plugin and esbuild, which bundle it. `external`, when
33
+ * given, collects the specifiers left external.
34
+ */
35
+ export declare function chantExternalPlugin(pkgDir: string, external?: Set<string>): EsbuildPluginLike;
36
+ /**
37
+ * The bare specifiers a bundle imports: static `import` and `export ... from`,
38
+ * `import()` and `require()` of a string. Relative imports are left out, and
39
+ * so are strings in minified code that the pattern also matches but that hold
40
+ * spaces, commas, quotes or template braces.
41
+ */
42
+ export declare function bundleImports(text: string): string[];
43
+ /** The package a bare specifier names: `@scope/name` or `name`. */
44
+ export declare function packageOf(specifier: string): string;
45
+ /** An input the bundle must not include: a pattern matched against each metafile input with everything up to its last `node_modules/` removed. */
46
+ export interface DeniedInput {
47
+ pattern: string;
48
+ /** What the input is, in the failure: "the TypeScript compiler". */
49
+ what: string;
50
+ }
51
+ /** A product's bundle check, as `chantBundleCheck` in its package's package.json (#4787). Paths are relative to the package. */
52
+ export interface BundleCheckConfig {
53
+ /** The bundle file, such as `dist/terragucci.mjs`. */
54
+ bundle: string;
55
+ /** The most bytes the bundle file may hold. */
56
+ maxBytes?: number;
57
+ /** The most bytes the package's `npm pack` tarball may hold (`npm pack --dry-run --ignore-scripts`). */
58
+ maxPackBytes?: number;
59
+ /**
60
+ * Packages the code loads at run time that no import in the bundle names,
61
+ * such as `@intentius/chant` for a bin it spawns, or a lexicon chant's
62
+ * generator loads by name. Each must be a runtime dependency.
63
+ */
64
+ needs?: string[];
65
+ /** Packages the bundle may import that are not dependencies: optional ones it loads when present. */
66
+ optional?: string[];
67
+ /** esbuild's metafile for the bundle, to check its inputs against `deny`. */
68
+ metafile?: string;
69
+ deny?: DeniedInput[];
70
+ }
71
+ export interface BundleCheckResult {
72
+ ok: boolean;
73
+ problems: string[];
74
+ /** One line saying what was checked, for a passing check. */
75
+ summary: string;
76
+ bundleBytes: number;
77
+ packBytes?: number;
78
+ /** The chant imports the bundle leaves to the installed chant. */
79
+ chantImports: string[];
80
+ /** The installed chant's version, with the commit when it is a local build (`chantLocal`). */
81
+ chant: string;
82
+ }
83
+ /** The nearest directory from `pkgDir` up whose package.json declares workspaces, else `pkgDir`: where the product pins chant. */
84
+ export declare function productRoot(pkgDir: string): string;
85
+ /** The `chantBundleCheck` field of the package at `pkgDir`, or undefined when it has none. */
86
+ export declare function readBundleCheckConfig(pkgDir: string): BundleCheckConfig | undefined;
87
+ /**
88
+ * Check the package at `pkgDir` against `config` (#4787):
89
+ *
90
+ * - the bundle imports only Node's modules, its runtime dependencies and the
91
+ * `optional` packages, and each chant import is one the installed chant
92
+ * serves as compiled JS ({@link chantRuntimeTarget});
93
+ * - the runtime dependencies are exactly the packages the bundle imports and
94
+ * the `needs`, and every `@intentius/chant*` among them and among the
95
+ * devDependencies is pinned to the root's `@intentius/chant`, an exact version;
96
+ * - each installed chant package is that version, or a local build marked
97
+ * `chantLocal` (`chant dev local`);
98
+ * - the bundle and the tarball stay within `maxBytes` and `maxPackBytes`;
99
+ * - no metafile input matches a `deny` pattern.
100
+ */
101
+ export declare function checkBundle(pkgDir: string, config: BundleCheckConfig): BundleCheckResult;
102
+ //# sourceMappingURL=bundle-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-check.d.ts","sourceRoot":"","sources":["../src/bundle-check.ts"],"names":[],"mappings":"AA4EA,kHAAkH;AAClH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMrF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOzF;AAED,gHAAgH;AAChH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,gHAAgH;AAChH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,KAAK,EAAE;QACX,SAAS,CAAC,OAAO,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAA;SAAE,KAAK;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,GAAG,SAAS,GAAG,IAAI,CAAC;KACrI,GAAG,IAAI,CAAC;CACV;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,iBAAiB,CAW7F;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQpD;AAED,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,kJAAkJ;AAClJ,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gIAAgI;AAChI,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wGAAwG;IACxG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;CACf;AAcD,kIAAkI;AAClI,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAInF;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAwGxF"}
@@ -0,0 +1,310 @@
1
+ /**
2
+ * `@intentius/chant/bundle-check` (#4787): how a product's bundle treats its
3
+ * chant imports, and the check that holds the bundle to that shape.
4
+ *
5
+ * A product (terragucci, plywood, sql-yodeler) bundles its own code into one
6
+ * file and imports chant from the installed, pinned package at run time,
7
+ * wherever that package serves the import as compiled JS under Node's
8
+ * `import` condition (#4591). Each product carried its own copy of this:
9
+ * `chantRuntimeTarget` and an esbuild plugin that leaves such imports
10
+ * external, and a bundle check that the bundle imports nothing else, that the
11
+ * package's runtime dependencies match the root's chant pin, and that the
12
+ * bundle stays under its size ceiling. They live here so a product only
13
+ * names its bundle, its ceiling and its denied inputs (`chantBundleCheck` in
14
+ * the package's package.json, read by `chant dev bundle-check`).
15
+ *
16
+ * This module imports only Node's own modules, so a product's build script
17
+ * can import it from plain Node.
18
+ */
19
+ import { execFileSync } from "node:child_process";
20
+ import { existsSync, readFileSync, statSync } from "node:fs";
21
+ import { builtinModules } from "node:module";
22
+ import { dirname, join, resolve } from "node:path";
23
+ /** Any `@intentius/chant` package, with or without a subpath: core and every lexicon. */
24
+ const CHANT = /^(@intentius\/chant(?:-[a-z0-9-]+)?)(\/.*)?$/;
25
+ const CONDITIONS = ["import", "node", "default"];
26
+ /** The target Node's ESM conditions pick from one exports value, in key order. */
27
+ function pick(value) {
28
+ if (typeof value === "string")
29
+ return value;
30
+ if (Array.isArray(value)) {
31
+ for (const v of value) {
32
+ const t = pick(v);
33
+ if (t !== undefined)
34
+ return t;
35
+ }
36
+ return undefined;
37
+ }
38
+ if (value && typeof value === "object") {
39
+ for (const [key, v] of Object.entries(value)) {
40
+ if (CONDITIONS.includes(key))
41
+ return pick(v);
42
+ }
43
+ }
44
+ return undefined;
45
+ }
46
+ /** The file `subpath` (`.` or `./x`) of the package at `pkgDir` names under Node's ESM conditions, or undefined. */
47
+ function exportsTarget(pkgDir, subpath) {
48
+ const map = JSON.parse(readFileSync(join(pkgDir, "package.json"), "utf8")).exports;
49
+ if (typeof map === "string")
50
+ return subpath === "." ? join(pkgDir, map) : undefined;
51
+ if (!map || typeof map !== "object" || Array.isArray(map))
52
+ return undefined;
53
+ const entries = map;
54
+ // A map of conditions alone is the root's entry.
55
+ if (!Object.keys(entries).some((k) => k.startsWith("."))) {
56
+ const t = subpath === "." ? pick(entries) : undefined;
57
+ return t === undefined ? undefined : join(pkgDir, t);
58
+ }
59
+ if (subpath in entries) {
60
+ const t = pick(entries[subpath]);
61
+ return t === undefined ? undefined : join(pkgDir, t);
62
+ }
63
+ // Node's pattern match: of the keys with one `*` that match, the longest prefix wins.
64
+ let best;
65
+ for (const key of Object.keys(entries)) {
66
+ const at = key.indexOf("*");
67
+ if (at < 0 || key.indexOf("*", at + 1) >= 0)
68
+ continue;
69
+ const prefix = key.slice(0, at);
70
+ const suffix = key.slice(at + 1);
71
+ if (!subpath.startsWith(prefix) || !subpath.endsWith(suffix) || subpath.length < key.length - 1)
72
+ continue;
73
+ if (best && prefix.length <= best.prefix.length)
74
+ continue;
75
+ best = { prefix, star: subpath.slice(prefix.length, subpath.length - suffix.length), value: entries[key] };
76
+ }
77
+ if (!best)
78
+ return undefined;
79
+ const t = pick(best.value);
80
+ return t === undefined ? undefined : join(pkgDir, t.split("*").join(best.star));
81
+ }
82
+ /** The directory of `name` as Node finds it from `fromDir`, walking up the node_modules folders, or undefined. */
83
+ export function installedPackageDir(name, fromDir) {
84
+ for (let dir = resolve(fromDir);; dir = dirname(dir)) {
85
+ const pkgDir = join(dir, "node_modules", name);
86
+ if (existsSync(join(pkgDir, "package.json")))
87
+ return pkgDir;
88
+ if (dirname(dir) === dir)
89
+ return undefined;
90
+ }
91
+ }
92
+ /**
93
+ * The compiled file Node would load for the chant `specifier` (core or a
94
+ * lexicon, with or without a subpath) imported from a file in `fromDir`, or
95
+ * undefined: the specifier is not chant's, the installed package does not
96
+ * export it, exports only TypeScript for it, or is not installed. Plain Node
97
+ * does not load TypeScript from node_modules, so only a compiled target can
98
+ * stay external.
99
+ */
100
+ export function chantRuntimeTarget(specifier, fromDir) {
101
+ const m = CHANT.exec(specifier);
102
+ if (!m)
103
+ return undefined;
104
+ const pkgDir = installedPackageDir(m[1], fromDir);
105
+ if (pkgDir === undefined)
106
+ return undefined;
107
+ const file = exportsTarget(pkgDir, m[2] ? `.${m[2]}` : ".");
108
+ return file !== undefined && /\.(?:m?js|cjs)$/.test(file) && existsSync(file) ? file : undefined;
109
+ }
110
+ /** Whether the chant installed for the package at `pkgDir` serves its root as compiled JS (#4591 and later). */
111
+ export function chantServesCompiled(pkgDir) {
112
+ return chantRuntimeTarget("@intentius/chant", pkgDir) !== undefined;
113
+ }
114
+ /**
115
+ * An esbuild plugin that leaves an `@intentius/chant*` import external when
116
+ * the chant installed for `pkgDir` (where the bin runs) serves it as compiled
117
+ * JS, so the bundle runs the installed, pinned chant. Any other chant import
118
+ * goes on to the next plugin and esbuild, which bundle it. `external`, when
119
+ * given, collects the specifiers left external.
120
+ */
121
+ export function chantExternalPlugin(pkgDir, external) {
122
+ return {
123
+ name: "chant-external",
124
+ setup(b) {
125
+ b.onResolve({ filter: CHANT }, (args) => {
126
+ if (chantRuntimeTarget(args.path, pkgDir) === undefined)
127
+ return undefined;
128
+ external?.add(args.path);
129
+ return { path: args.path, external: true };
130
+ });
131
+ },
132
+ };
133
+ }
134
+ /**
135
+ * The bare specifiers a bundle imports: static `import` and `export ... from`,
136
+ * `import()` and `require()` of a string. Relative imports are left out, and
137
+ * so are strings in minified code that the pattern also matches but that hold
138
+ * spaces, commas, quotes or template braces.
139
+ */
140
+ export function bundleImports(text) {
141
+ const out = new Set();
142
+ const re = /(?:^|[;\s}])(?:import|export)\s*(?:[\w*{}\s,$]+from\s*)?["']([^"']+)["']|import\(\s*["']([^"']+)["']\s*\)|require\(\s*["']([^"']+)["']\s*\)/gm;
143
+ for (const m of text.matchAll(re)) {
144
+ const s = m[1] ?? m[2] ?? m[3];
145
+ if (s !== undefined && /^[\w@][\w@./:-]*$/.test(s))
146
+ out.add(s);
147
+ }
148
+ return [...out];
149
+ }
150
+ /** The package a bare specifier names: `@scope/name` or `name`. */
151
+ export function packageOf(specifier) {
152
+ return specifier.split("/").slice(0, specifier.startsWith("@") ? 2 : 1).join("/");
153
+ }
154
+ const readManifest = (file) => JSON.parse(readFileSync(file, "utf8"));
155
+ /** The nearest directory from `pkgDir` up whose package.json declares workspaces, else `pkgDir`: where the product pins chant. */
156
+ export function productRoot(pkgDir) {
157
+ for (let dir = resolve(pkgDir);; dir = dirname(dir)) {
158
+ const f = join(dir, "package.json");
159
+ if (existsSync(f) && readManifest(f).workspaces !== undefined)
160
+ return dir;
161
+ if (dirname(dir) === dir)
162
+ return resolve(pkgDir);
163
+ }
164
+ }
165
+ /** The `chantBundleCheck` field of the package at `pkgDir`, or undefined when it has none. */
166
+ export function readBundleCheckConfig(pkgDir) {
167
+ const f = join(pkgDir, "package.json");
168
+ if (!existsSync(f))
169
+ return undefined;
170
+ return readManifest(f).chantBundleCheck;
171
+ }
172
+ /** The size of the tarball `npm pack` would write for the package at `pkgDir`, without running its scripts. */
173
+ function packSize(pkgDir) {
174
+ const out = execFileSync("npm", ["pack", "--dry-run", "--json", "--ignore-scripts"], { cwd: pkgDir, stdio: ["ignore", "pipe", "pipe"] }).toString();
175
+ const [packed] = JSON.parse(out);
176
+ return packed.size;
177
+ }
178
+ /**
179
+ * Check the package at `pkgDir` against `config` (#4787):
180
+ *
181
+ * - the bundle imports only Node's modules, its runtime dependencies and the
182
+ * `optional` packages, and each chant import is one the installed chant
183
+ * serves as compiled JS ({@link chantRuntimeTarget});
184
+ * - the runtime dependencies are exactly the packages the bundle imports and
185
+ * the `needs`, and every `@intentius/chant*` among them and among the
186
+ * devDependencies is pinned to the root's `@intentius/chant`, an exact version;
187
+ * - each installed chant package is that version, or a local build marked
188
+ * `chantLocal` (`chant dev local`);
189
+ * - the bundle and the tarball stay within `maxBytes` and `maxPackBytes`;
190
+ * - no metafile input matches a `deny` pattern.
191
+ */
192
+ export function checkBundle(pkgDir, config) {
193
+ const dir = resolve(pkgDir);
194
+ const problems = [];
195
+ const pkg = readManifest(join(dir, "package.json"));
196
+ const root = productRoot(dir);
197
+ const rootPkg = readManifest(join(root, "package.json"));
198
+ const pin = rootPkg.dependencies?.["@intentius/chant"] ?? rootPkg.devDependencies?.["@intentius/chant"];
199
+ if (pin === undefined)
200
+ problems.push(`${join(root, "package.json")} does not name @intentius/chant`);
201
+ else if (!/^\d+\.\d+\.\d+(?:-[\w.]+)?$/.test(pin))
202
+ problems.push(`@intentius/chant is '${pin}' in ${join(root, "package.json")}, not an exact version`);
203
+ const bundleFile = join(dir, config.bundle);
204
+ let text = "";
205
+ let bundleBytes = 0;
206
+ if (!existsSync(bundleFile))
207
+ problems.push(`no bundle at ${config.bundle}; build it first`);
208
+ else {
209
+ text = readFileSync(bundleFile, "utf8");
210
+ bundleBytes = statSync(bundleFile).size;
211
+ if (config.maxBytes !== undefined && bundleBytes > config.maxBytes) {
212
+ problems.push(`the bundle is ${Math.round(bundleBytes / 1024)} KB, over the ${Math.round(config.maxBytes / 1024)} KB ceiling`);
213
+ }
214
+ }
215
+ const deps = pkg.dependencies ?? {};
216
+ const optional = new Set(config.optional ?? []);
217
+ const node = new Set([...builtinModules, ...builtinModules.map((m) => `node:${m}`)]);
218
+ const used = new Map();
219
+ for (const n of config.needs ?? [])
220
+ used.set(n, "chantBundleCheck.needs names it");
221
+ const chantImports = [];
222
+ for (const s of bundleImports(text)) {
223
+ if (node.has(s) || optional.has(s) || optional.has(packageOf(s)))
224
+ continue;
225
+ const name = packageOf(s);
226
+ if (!(name in deps)) {
227
+ problems.push(`the bundle imports '${s}', which is neither a Node module nor a runtime dependency`);
228
+ continue;
229
+ }
230
+ if (!used.has(name))
231
+ used.set(name, `the bundle imports ${s}`);
232
+ if (CHANT.test(s)) {
233
+ if (chantRuntimeTarget(s, dir) === undefined)
234
+ problems.push(`the bundle imports '${s}', which the installed package's exports do not serve as compiled JS under the import condition`);
235
+ else
236
+ chantImports.push(s);
237
+ }
238
+ }
239
+ for (const [name, why] of used) {
240
+ if (!(name in deps))
241
+ problems.push(`${name} is loaded at run time (${why}) but is not in dependencies${name in (pkg.devDependencies ?? {}) ? " (it is a devDependency, which npm install --omit=dev leaves out)" : ""}`);
242
+ }
243
+ for (const name of Object.keys(deps)) {
244
+ if (!used.has(name))
245
+ problems.push(`${name} is a runtime dependency that the bundle does not import and chantBundleCheck.needs does not name`);
246
+ }
247
+ if (pin !== undefined) {
248
+ for (const [kind, list] of [["dependencies", deps], ["devDependencies", pkg.devDependencies ?? {}]]) {
249
+ if (dir === root && kind === "devDependencies")
250
+ continue;
251
+ for (const [name, v] of Object.entries(list)) {
252
+ if (CHANT.test(name) && v !== pin)
253
+ problems.push(`${name} is '${v}' in ${kind}, not the root's chant pin ${pin}`);
254
+ }
255
+ }
256
+ }
257
+ // The installed copies: the pin, or a local build `chant dev local` marked.
258
+ let chant = "not installed";
259
+ const coreDir = installedPackageDir("@intentius/chant", dir);
260
+ if (coreDir === undefined)
261
+ problems.push("@intentius/chant is not installed; run npm ci");
262
+ else {
263
+ const core = readManifest(join(coreDir, "package.json"));
264
+ chant = core.chantLocal ? `local chant ${core.version} (${String(core.chantLocal.commit).slice(0, 12)})` : `chant ${core.version}`;
265
+ }
266
+ for (const name of new Set([...Object.keys(deps), ...Object.keys(pkg.devDependencies ?? {})])) {
267
+ if (!CHANT.test(name) || pin === undefined)
268
+ continue;
269
+ const at = installedPackageDir(name, dir);
270
+ if (at === undefined) {
271
+ if (name in deps)
272
+ problems.push(`${name} is not installed; run npm ci`);
273
+ continue;
274
+ }
275
+ const installed = readManifest(join(at, "package.json"));
276
+ if (!installed.chantLocal && installed.version !== pin)
277
+ problems.push(`the installed ${name} is ${installed.version}, not the pin ${pin}; run npm ci`);
278
+ }
279
+ if (config.deny?.length) {
280
+ const metafile = config.metafile === undefined ? undefined : join(dir, config.metafile);
281
+ if (metafile === undefined || !existsSync(metafile))
282
+ problems.push(`chantBundleCheck.deny needs the build's esbuild metafile${config.metafile ? ` at ${config.metafile}` : " (chantBundleCheck.metafile)"}`);
283
+ else {
284
+ const inputs = Object.keys(JSON.parse(readFileSync(metafile, "utf8")).inputs ?? {});
285
+ const rules = config.deny.map((d) => ({ re: new RegExp(d.pattern), what: d.what }));
286
+ const hits = new Map();
287
+ for (const input of inputs) {
288
+ const rel = input.replace(/^.*node_modules\//, "");
289
+ for (const r of rules)
290
+ if (r.re.test(rel))
291
+ hits.set(r.what, [...(hits.get(r.what) ?? []), rel]);
292
+ }
293
+ for (const [what, list] of hits) {
294
+ problems.push(`the bundle includes ${what} (${list.length} inputs): ${list.slice(0, 3).join(", ")}${list.length > 3 ? `, and ${list.length - 3} more` : ""}`);
295
+ }
296
+ }
297
+ }
298
+ let packBytes;
299
+ if (config.maxPackBytes !== undefined) {
300
+ packBytes = packSize(dir);
301
+ if (packBytes > config.maxPackBytes)
302
+ problems.push(`the tarball is ${Math.round(packBytes / 1024)} KB, over the ${Math.round(config.maxPackBytes / 1024)} KB ceiling`);
303
+ }
304
+ const sizes = [
305
+ `bundle ${Math.round(bundleBytes / 1024)} KB${config.maxBytes !== undefined ? ` (ceiling ${Math.round(config.maxBytes / 1024)} KB)` : ""}`,
306
+ ...(packBytes !== undefined ? [`tarball ${Math.round(packBytes / 1024)} KB (ceiling ${Math.round(config.maxPackBytes / 1024)} KB)`] : []),
307
+ ];
308
+ const summary = `${pkg.name ?? dir}: ${sizes.join(", ")}, ${Object.keys(deps).length} runtime dependencies at chant ${pin}, ${chantImports.length} chant imports served as compiled JS by ${chant}`;
309
+ return { ok: problems.length === 0, problems, summary, bundleBytes, packBytes, chantImports, chant };
310
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * #4800 — the chant a product is installed with, and how to run it.
3
+ *
4
+ * A product runs the `chant` CLI as a child for the commands it does not run
5
+ * in process, and the chant it runs must be the one in its own dependencies,
6
+ * not whatever `chant` is first on the PATH. Each product found it its own
7
+ * way: SQL Yodeler resolved `@intentius/chant` and ran `src/cli/main.ts`
8
+ * under its own tsx, terragucci walked up its directories for
9
+ * `node_modules/@intentius/chant/package.json` and read `bin.chant`, and
10
+ * plywood added a resolve hook so the Op files a repository holds find
11
+ * chant in plywood's install when the repository has none. This module is
12
+ * the one copy.
13
+ *
14
+ * {@link bundledChant} is the package this module belongs to, so a product
15
+ * that imports `@intentius/chant/chant-install` gets its own chant. When a
16
+ * product bundles this module into a file of its own, the module no longer
17
+ * sits in chant's package, and it walks up from where it is instead.
18
+ * {@link chantArgv} runs the package's `bin/chant` with the node running
19
+ * now: the bin picks the compiled CLI in an installed package and the source
20
+ * in a checkout (#3878), so a product never chooses between them.
21
+ */
22
+ /** Where a chant package is installed. */
23
+ export interface ChantInstall {
24
+ /** The `@intentius/chant` package directory. */
25
+ root: string;
26
+ /** Its `chant` bin script, from the manifest's `bin.chant`. */
27
+ bin: string;
28
+ /** The directory holding the bin, to put first on a child's PATH. */
29
+ binDir: string;
30
+ /** The package's version, from its manifest. */
31
+ version?: string;
32
+ }
33
+ /**
34
+ * The chant installed for the first of `from` that has one: each directory
35
+ * and every directory above it, through `node_modules/@intentius/chant`
36
+ * (terragucci's `installedChant`, which looked from its own file and then
37
+ * from the repository). The package exports no `./package.json`, so the
38
+ * manifest is read from disk, not resolved. Undefined when none has it.
39
+ */
40
+ export declare function installedChant(from: readonly string[]): ChantInstall | undefined;
41
+ /**
42
+ * The chant this module is part of: `src/chant-install.ts` or
43
+ * `dist/chant-install.js`, one level under the package root. Bundled into a
44
+ * product's own file, the module is not in chant's package, and this is the
45
+ * chant {@link installedChant} finds from the module's directory. Undefined
46
+ * when neither has one.
47
+ */
48
+ export declare function bundledChant(): ChantInstall | undefined;
49
+ /**
50
+ * The chant executable a product runs: `chant` when the caller names one
51
+ * (a `--chant` flag), else {@link bundledChant}'s bin, else the first of
52
+ * `from` {@link installedChant} finds, else `chant` on the PATH.
53
+ */
54
+ export declare function chantCommand(options?: {
55
+ chant?: string;
56
+ from?: readonly string[];
57
+ }): string;
58
+ /**
59
+ * The argv to spawn `chant <args>` with: the node running now, `nodeArgs`
60
+ * (a product's own `--import` hooks), the install's bin and `args`. Running
61
+ * the bin through `process.execPath` works where a shebang does not
62
+ * (Windows, #4734). Throws when no install is found.
63
+ */
64
+ export declare function chantArgv(args: readonly string[], options?: {
65
+ install?: ChantInstall;
66
+ nodeArgs?: readonly string[];
67
+ }): string[];
68
+ /**
69
+ * `base` with the install's bin directory first on PATH, for a chant child:
70
+ * chant's own Op activities run `chant` themselves (`lifecycleDiff` runs
71
+ * `chant lifecycle diff`), and they must find the same one.
72
+ */
73
+ export declare function chantEnv(base?: NodeJS.ProcessEnv, install?: ChantInstall | undefined): NodeJS.ProcessEnv;
74
+ /** The specifiers {@link chantResolveFallback} covers: chant and its lexicons, with any subpath. */
75
+ export declare const CHANT_SPECIFIER: RegExp;
76
+ interface ResolveResult {
77
+ url: string;
78
+ format?: string | null;
79
+ shortCircuit?: boolean;
80
+ }
81
+ type NextResolve = (specifier: string, context?: Record<string, unknown>) => ResolveResult;
82
+ /**
83
+ * A resolve hook (plywood's `chantResolveHook`): a chant or lexicon import
84
+ * the importing file's own `node_modules` cannot satisfy resolves from
85
+ * `from`, a file URL in the product's install. A repository that runs the
86
+ * product from a global install has no chant of its own, and the Op files
87
+ * it holds import `@intentius/chant/op`. Any other specifier, and any other
88
+ * failure, is left as Node reports it.
89
+ */
90
+ export declare function chantResolveFallback(from: string): (specifier: string, context: Record<string, unknown>, next: NextResolve) => ResolveResult;
91
+ /**
92
+ * Install {@link chantResolveFallback} once in this process. `from` is a
93
+ * file URL in the product's install, by default this module's own, which
94
+ * sits in the chant the product depends on. Returns whether it is
95
+ * installed: false on a Node without `module.registerHooks`, where the
96
+ * repository needs chant in its own `node_modules`.
97
+ */
98
+ export declare function installChantResolveFallback(from?: string): boolean;
99
+ export {};
100
+ //# sourceMappingURL=chant-install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chant-install.d.ts","sourceRoot":"","sources":["../src/chant-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsBD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,GAAG,SAAS,CAWhF;AAID;;;;;;GAMG;AACH,wBAAgB,YAAY,IAAI,YAAY,GAAG,SAAS,CAMvD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,MAAM,CAE/F;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAAG,MAAM,EAAE,CAInI;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,GAAE,MAAM,CAAC,UAAwB,EAAE,OAAO,GAAE,YAAY,GAAG,SAA0B,GAAG,MAAM,CAAC,UAAU,CAGrI;AAED,oGAAoG;AACpG,eAAO,MAAM,eAAe,QAAuD,CAAC;AAIpF,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AACD,KAAK,WAAW,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,aAAa,CAAC;AAG3F;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,eAC5B,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,WAAW,KAAG,aAAa,CAU/F;AAID;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,GAAE,MAAwB,GAAG,OAAO,CAQnF"}