@maverickcer/env-cap 0.2.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/LICENSE +21 -0
- package/README.md +279 -0
- package/dist/.dts/build/assemble-project.d.ts +47 -0
- package/dist/.dts/build/assemble-project.d.ts.map +1 -0
- package/dist/.dts/build/change-model.d.ts +62 -0
- package/dist/.dts/build/change-model.d.ts.map +1 -0
- package/dist/.dts/build/check-artifacts.d.ts +48 -0
- package/dist/.dts/build/check-artifacts.d.ts.map +1 -0
- package/dist/.dts/build/citation-verification.d.ts +62 -0
- package/dist/.dts/build/citation-verification.d.ts.map +1 -0
- package/dist/.dts/build/compatibility.d.ts +76 -0
- package/dist/.dts/build/compatibility.d.ts.map +1 -0
- package/dist/.dts/build/contract-model.d.ts +92 -0
- package/dist/.dts/build/contract-model.d.ts.map +1 -0
- package/dist/.dts/build/deep-equal.d.ts +9 -0
- package/dist/.dts/build/deep-equal.d.ts.map +1 -0
- package/dist/.dts/build/deep-freeze.d.ts +20 -0
- package/dist/.dts/build/deep-freeze.d.ts.map +1 -0
- package/dist/.dts/build/dependency-graph.d.ts +168 -0
- package/dist/.dts/build/dependency-graph.d.ts.map +1 -0
- package/dist/.dts/build/dependency-model.d.ts +79 -0
- package/dist/.dts/build/dependency-model.d.ts.map +1 -0
- package/dist/.dts/build/discover.d.ts +25 -0
- package/dist/.dts/build/discover.d.ts.map +1 -0
- package/dist/.dts/build/display-path.d.ts +24 -0
- package/dist/.dts/build/display-path.d.ts.map +1 -0
- package/dist/.dts/build/docs.d.ts +176 -0
- package/dist/.dts/build/docs.d.ts.map +1 -0
- package/dist/.dts/build/env-example.d.ts +85 -0
- package/dist/.dts/build/env-example.d.ts.map +1 -0
- package/dist/.dts/build/errors.d.ts +78 -0
- package/dist/.dts/build/errors.d.ts.map +1 -0
- package/dist/.dts/build/evidence-cache.d.ts +74 -0
- package/dist/.dts/build/evidence-cache.d.ts.map +1 -0
- package/dist/.dts/build/evidence-model.d.ts +50 -0
- package/dist/.dts/build/evidence-model.d.ts.map +1 -0
- package/dist/.dts/build/evidence-reference.d.ts +67 -0
- package/dist/.dts/build/evidence-reference.d.ts.map +1 -0
- package/dist/.dts/build/evidence-snapshot.d.ts +123 -0
- package/dist/.dts/build/evidence-snapshot.d.ts.map +1 -0
- package/dist/.dts/build/exclusive-group.d.ts +19 -0
- package/dist/.dts/build/exclusive-group.d.ts.map +1 -0
- package/dist/.dts/build/finding-model.d.ts +79 -0
- package/dist/.dts/build/finding-model.d.ts.map +1 -0
- package/dist/.dts/build/generate-documentation.d.ts +176 -0
- package/dist/.dts/build/generate-documentation.d.ts.map +1 -0
- package/dist/.dts/build/generate-env-artifacts.d.ts +176 -0
- package/dist/.dts/build/generate-env-artifacts.d.ts.map +1 -0
- package/dist/.dts/build/generate-evidence.d.ts +77 -0
- package/dist/.dts/build/generate-evidence.d.ts.map +1 -0
- package/dist/.dts/build/generate-manifest.d.ts +101 -0
- package/dist/.dts/build/generate-manifest.d.ts.map +1 -0
- package/dist/.dts/build/generate-usage.d.ts +95 -0
- package/dist/.dts/build/generate-usage.d.ts.map +1 -0
- package/dist/.dts/build/generated-banner.d.ts +52 -0
- package/dist/.dts/build/generated-banner.d.ts.map +1 -0
- package/dist/.dts/build/glob.d.ts +18 -0
- package/dist/.dts/build/glob.d.ts.map +1 -0
- package/dist/.dts/build/governance-fields.d.ts +34 -0
- package/dist/.dts/build/governance-fields.d.ts.map +1 -0
- package/dist/.dts/build/humanize-key.d.ts +14 -0
- package/dist/.dts/build/humanize-key.d.ts.map +1 -0
- package/dist/.dts/build/index.d.ts +107 -0
- package/dist/.dts/build/index.d.ts.map +1 -0
- package/dist/.dts/build/lifecycle-model.d.ts +64 -0
- package/dist/.dts/build/lifecycle-model.d.ts.map +1 -0
- package/dist/.dts/build/link.d.ts +215 -0
- package/dist/.dts/build/link.d.ts.map +1 -0
- package/dist/.dts/build/literal-eval.d.ts +23 -0
- package/dist/.dts/build/literal-eval.d.ts.map +1 -0
- package/dist/.dts/build/live-expirations.d.ts +47 -0
- package/dist/.dts/build/live-expirations.d.ts.map +1 -0
- package/dist/.dts/build/manifest-snapshot.d.ts +229 -0
- package/dist/.dts/build/manifest-snapshot.d.ts.map +1 -0
- package/dist/.dts/build/manifest.d.ts +31 -0
- package/dist/.dts/build/manifest.d.ts.map +1 -0
- package/dist/.dts/build/map-utils.d.ts +8 -0
- package/dist/.dts/build/map-utils.d.ts.map +1 -0
- package/dist/.dts/build/ownership-model.d.ts +57 -0
- package/dist/.dts/build/ownership-model.d.ts.map +1 -0
- package/dist/.dts/build/parse.d.ts +199 -0
- package/dist/.dts/build/parse.d.ts.map +1 -0
- package/dist/.dts/build/reference-projections.d.ts +156 -0
- package/dist/.dts/build/reference-projections.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-import.d.ts +53 -0
- package/dist/.dts/build/resolution/resolve-import.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-package-schema.d.ts +83 -0
- package/dist/.dts/build/resolution/resolve-package-schema.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts +101 -0
- package/dist/.dts/build/resolution/resolve-tsconfig-paths.d.ts.map +1 -0
- package/dist/.dts/build/resolution/resolve-within-root.d.ts +35 -0
- package/dist/.dts/build/resolution/resolve-within-root.d.ts.map +1 -0
- package/dist/.dts/build/resolve-import.d.ts +50 -0
- package/dist/.dts/build/resolve-import.d.ts.map +1 -0
- package/dist/.dts/build/resolve-package-schema.d.ts +99 -0
- package/dist/.dts/build/resolve-package-schema.d.ts.map +1 -0
- package/dist/.dts/build/resolve-tsconfig-paths.d.ts +100 -0
- package/dist/.dts/build/resolve-tsconfig-paths.d.ts.map +1 -0
- package/dist/.dts/build/resolve-within-root.d.ts +35 -0
- package/dist/.dts/build/resolve-within-root.d.ts.map +1 -0
- package/dist/.dts/build/sarif.d.ts +66 -0
- package/dist/.dts/build/sarif.d.ts.map +1 -0
- package/dist/.dts/build/scan-dependencies.d.ts +47 -0
- package/dist/.dts/build/scan-dependencies.d.ts.map +1 -0
- package/dist/.dts/build/sort-by-identity.d.ts +14 -0
- package/dist/.dts/build/sort-by-identity.d.ts.map +1 -0
- package/dist/.dts/build/source-position.d.ts +69 -0
- package/dist/.dts/build/source-position.d.ts.map +1 -0
- package/dist/.dts/build/tool-version.d.ts +8 -0
- package/dist/.dts/build/tool-version.d.ts.map +1 -0
- package/dist/.dts/build/types.d.ts +53 -0
- package/dist/.dts/build/types.d.ts.map +1 -0
- package/dist/.dts/build/usage-report.d.ts +124 -0
- package/dist/.dts/build/usage-report.d.ts.map +1 -0
- package/dist/.dts/cli/filesystem.d.ts +3 -0
- package/dist/.dts/cli/filesystem.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/glob.d.ts +18 -0
- package/dist/.dts/eslint-plugin/glob.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/index.d.ts +27 -0
- package/dist/.dts/eslint-plugin/index.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/no-node-fs.d.ts +25 -0
- package/dist/.dts/eslint-plugin/no-node-fs.d.ts.map +1 -0
- package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts +23 -0
- package/dist/.dts/eslint-plugin/no-raw-process-env.d.ts.map +1 -0
- package/dist/.dts/evidence/define-projection.d.ts +51 -0
- package/dist/.dts/evidence/define-projection.d.ts.map +1 -0
- package/dist/.dts/evidence/index.d.ts +23 -0
- package/dist/.dts/evidence/index.d.ts.map +1 -0
- package/dist/.dts/helpers/index.d.ts +135 -0
- package/dist/.dts/helpers/index.d.ts.map +1 -0
- package/dist/.dts/helpers/processors.d.ts +32 -0
- package/dist/.dts/helpers/processors.d.ts.map +1 -0
- package/dist/.dts/helpers/validators.d.ts +68 -0
- package/dist/.dts/helpers/validators.d.ts.map +1 -0
- package/dist/.dts/node/index.d.ts +2 -0
- package/dist/.dts/node/index.d.ts.map +1 -0
- package/dist/.dts/runtime/cache.d.ts +20 -0
- package/dist/.dts/runtime/cache.d.ts.map +1 -0
- package/dist/.dts/runtime/create.d.ts +20 -0
- package/dist/.dts/runtime/create.d.ts.map +1 -0
- package/dist/.dts/runtime/document.d.ts +181 -0
- package/dist/.dts/runtime/document.d.ts.map +1 -0
- package/dist/.dts/runtime/errors.d.ts +55 -0
- package/dist/.dts/runtime/errors.d.ts.map +1 -0
- package/dist/.dts/runtime/index.d.ts +24 -0
- package/dist/.dts/runtime/index.d.ts.map +1 -0
- package/dist/.dts/runtime/registry.d.ts +12 -0
- package/dist/.dts/runtime/registry.d.ts.map +1 -0
- package/dist/.dts/runtime/reset.d.ts +8 -0
- package/dist/.dts/runtime/reset.d.ts.map +1 -0
- package/dist/.dts/runtime/types.d.ts +175 -0
- package/dist/.dts/runtime/types.d.ts.map +1 -0
- package/dist/.dts/runtime/validate.d.ts +14 -0
- package/dist/.dts/runtime/validate.d.ts.map +1 -0
- package/dist/build.cjs +83 -0
- package/dist/build.cjs.map +1 -0
- package/dist/build.d.cts +1 -0
- package/dist/build.d.ts +1 -0
- package/dist/build.js +19 -0
- package/dist/build.js.map +1 -0
- package/dist/cli/index.js +134 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/eslint-plugin/index.cjs +12 -0
- package/dist/eslint-plugin/index.cjs.map +1 -0
- package/dist/eslint-plugin/index.d.cts +1 -0
- package/dist/eslint-plugin/index.d.ts +1 -0
- package/dist/eslint-plugin/index.js +5 -0
- package/dist/eslint-plugin/index.js.map +1 -0
- package/dist/evidence.cjs +7 -0
- package/dist/evidence.cjs.map +1 -0
- package/dist/evidence.d.cts +1 -0
- package/dist/evidence.d.ts +1 -0
- package/dist/evidence.js +5 -0
- package/dist/evidence.js.map +1 -0
- package/dist/helpers.cjs +8 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +1 -0
- package/dist/helpers.d.ts +1 -0
- package/dist/helpers.js +5 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +15 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/node.cjs +13 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +1 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.js +7 -0
- package/dist/node.js.map +1 -0
- package/package.json +183 -0
- package/schemas/contract-model.schema.json +321 -0
- package/schemas/env-cap-report.schema.json +2369 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ContractRef } from "./evidence-reference.js";
|
|
2
|
+
import type { DiscoveredContract } from "./link.js";
|
|
3
|
+
/**
|
|
4
|
+
* The third of env-cap's seven canonical fact models (ADR 0024) -- every
|
|
5
|
+
* contract and variable's effective owner, plus first-class
|
|
6
|
+
* `unownedContracts`/`unownedVariables` arrays. See ADR 0028.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* "Unowned" previously existed only as a count (`noOwnerCount`) inside
|
|
10
|
+
* `docs.ts`'s `renderSecurityReview()` -- itemized here as real data for the
|
|
11
|
+
* first time, computed via the same `effectiveOwner()` (variable overrides
|
|
12
|
+
* contract) that ADR 0028 also fixed `usage-report.ts`'s ownership findings
|
|
13
|
+
* to use, so this model can never disagree with either of them about who
|
|
14
|
+
* owns a variable.
|
|
15
|
+
*/
|
|
16
|
+
/** Bump only when a reader could misinterpret the new shape -- same discipline every other canonical model's `schemaVersion` follows. */
|
|
17
|
+
export declare const OWNERSHIP_MODEL_SCHEMA_VERSION = 1;
|
|
18
|
+
/**
|
|
19
|
+
* One variable's effective owner (its own, falling back to the contract's).
|
|
20
|
+
*
|
|
21
|
+
* @see {@link ContractModelVariable} -- this same declared variable's canonical starting point.
|
|
22
|
+
*/
|
|
23
|
+
export interface OwnershipModelVariable {
|
|
24
|
+
readonly key: string;
|
|
25
|
+
/** The variable's own `owner`, falling back to the contract's -- see `effectiveOwner()`. */
|
|
26
|
+
readonly owner: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface OwnershipModelContract {
|
|
29
|
+
/** Root-relative, POSIX-separated -- matches `ContractModelContract.file`. */
|
|
30
|
+
readonly file: string;
|
|
31
|
+
readonly exportName: string;
|
|
32
|
+
readonly contractName: string;
|
|
33
|
+
/** The contract's own default owner -- not "effective" the way a variable's is, since there's no level above a contract to fall back to. */
|
|
34
|
+
readonly owner: string | undefined;
|
|
35
|
+
readonly variables: readonly OwnershipModelVariable[];
|
|
36
|
+
}
|
|
37
|
+
/** One contract, referenced by identity only -- see {@link ContractRef} for why no `contractName` is carried here. Resolve one from `ContractModel` when a renderer needs display text. */
|
|
38
|
+
export type OwnershipModelContractRef = ContractRef;
|
|
39
|
+
/** One variable, referenced by its owning contract's identity plus its own key -- see {@link ContractRef}. */
|
|
40
|
+
export interface OwnershipModelVariableRef extends ContractRef {
|
|
41
|
+
readonly key: string;
|
|
42
|
+
}
|
|
43
|
+
export interface OwnershipModel {
|
|
44
|
+
readonly schemaVersion: typeof OWNERSHIP_MODEL_SCHEMA_VERSION;
|
|
45
|
+
readonly contracts: readonly OwnershipModelContract[];
|
|
46
|
+
/** Every contract with no `owner` set at all. */
|
|
47
|
+
readonly unownedContracts: readonly OwnershipModelContractRef[];
|
|
48
|
+
/** Every variable whose effective owner (its own, falling back to the contract's) is still `undefined`. */
|
|
49
|
+
readonly unownedVariables: readonly OwnershipModelVariableRef[];
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Projects every discovered contract (active or not, same scope as
|
|
53
|
+
* `renderSecurityReview()`'s `noOwnerCount` this model itemizes) into the
|
|
54
|
+
* Ownership Model's versioned, JSON-serializable shape.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildOwnershipModel(contracts: readonly DiscoveredContract[], root: string): OwnershipModel;
|
|
57
|
+
//# sourceMappingURL=ownership-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ownership-model.d.ts","sourceRoot":"","sources":["../../../src/build/ownership-model.ts"],"names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GACX,cAAc,CAmChB"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import type { EnvGovernanceFields } from "./governance-fields.js";
|
|
3
|
+
import type { SourcePosition } from "./source-position.js";
|
|
4
|
+
/** A recoverable issue found while statically parsing or linking one schema file -- never fatal, always surfaced to the caller as data. */
|
|
5
|
+
export interface ParseWarning {
|
|
6
|
+
/** Absolute path of the file the warning applies to. */
|
|
7
|
+
readonly file: string;
|
|
8
|
+
/** Human-readable explanation of what was skipped and why. */
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* How a `createEnv`/`documentEnv` call's first argument resolves, before any
|
|
13
|
+
* cross-file linking is attempted (that's `link.ts`'s job, not this file's --
|
|
14
|
+
* this module only ever looks at one file's own AST).
|
|
15
|
+
*/
|
|
16
|
+
export type SchemaRef = {
|
|
17
|
+
/** Discriminant: the schema argument is an inline object literal. */
|
|
18
|
+
readonly kind: "literal";
|
|
19
|
+
/** The object literal AST node itself. */
|
|
20
|
+
readonly node: ts.ObjectLiteralExpression;
|
|
21
|
+
} | {
|
|
22
|
+
/** Discriminant: the schema argument is a bare identifier referencing a local `const`. */
|
|
23
|
+
readonly kind: "identifier";
|
|
24
|
+
/** The referenced identifier's name, not yet resolved to a declaration. */
|
|
25
|
+
readonly name: string;
|
|
26
|
+
} | {
|
|
27
|
+
/** Discriminant: the schema argument isn't statically resolvable (not a literal or identifier). */
|
|
28
|
+
readonly kind: "unresolvable";
|
|
29
|
+
};
|
|
30
|
+
/** One `createEnv(...)` call site, as found by {@link parseSchemaFile}, before cross-file linking. */
|
|
31
|
+
interface RawCreateEnvCall {
|
|
32
|
+
/** The binding name the call result is assigned to (must be exported to be usable -- see {@link parseSchemaFile}). */
|
|
33
|
+
readonly exportName: string;
|
|
34
|
+
/** How the first (schema) argument resolves within this file. */
|
|
35
|
+
readonly schemaRef: SchemaRef;
|
|
36
|
+
/** The second (options) argument expression, if the call passes one. */
|
|
37
|
+
readonly optionsArg: ts.Expression | undefined;
|
|
38
|
+
/** The full call expression AST node. */
|
|
39
|
+
readonly node: ts.CallExpression;
|
|
40
|
+
}
|
|
41
|
+
/** One `documentEnv(...)` call site, as found by {@link parseSchemaFile}, before cross-file linking. */
|
|
42
|
+
interface RawDocumentEnvCall {
|
|
43
|
+
/** How the first (schema) argument resolves within this file. */
|
|
44
|
+
readonly schemaRef: SchemaRef;
|
|
45
|
+
/** The second (docs) argument expression, if the call passes one. */
|
|
46
|
+
readonly docsArg: ts.Expression | undefined;
|
|
47
|
+
/** The full call expression AST node. */
|
|
48
|
+
readonly node: ts.CallExpression;
|
|
49
|
+
}
|
|
50
|
+
/** One named import binding, tracked only for relative specifiers (see {@link FileParseResult.imports}). */
|
|
51
|
+
export interface ImportBinding {
|
|
52
|
+
/** The raw module specifier as written in the import (e.g. `"./payments.schema.js"`). */
|
|
53
|
+
readonly specifier: string;
|
|
54
|
+
/** The name as exported by the source module -- accounts for `import { real as local }`. */
|
|
55
|
+
readonly importedName: string;
|
|
56
|
+
}
|
|
57
|
+
/** The raw, single-file facts extracted by {@link parseSchemaFile}. */
|
|
58
|
+
export interface FileParseResult {
|
|
59
|
+
/** Absolute path of the parsed file. */
|
|
60
|
+
readonly file: string;
|
|
61
|
+
/** The TypeScript AST for this file, reused by callers that need to inspect it further. */
|
|
62
|
+
readonly sourceFile: ts.SourceFile;
|
|
63
|
+
/** Top-level `const NAME = {...}` object-literal declarations, whether exported or not. */
|
|
64
|
+
readonly localConsts: ReadonlyMap<string, ts.ObjectLiteralExpression>;
|
|
65
|
+
/** Names of top-level `const` declarations that are exported (a subset of {@link localConsts}'s keys, plus non-object-literal exports). */
|
|
66
|
+
readonly exportedConstNames: ReadonlySet<string>;
|
|
67
|
+
/** Local binding name -> where it came from. Only named imports of a relative specifier are tracked (namespace/default/bare-package imports are irrelevant to schema linking). */
|
|
68
|
+
readonly imports: ReadonlyMap<string, ImportBinding>;
|
|
69
|
+
/** Every `createEnv(...)` call site found at the top level of this file. */
|
|
70
|
+
readonly createEnvCalls: readonly RawCreateEnvCall[];
|
|
71
|
+
/** Every `documentEnv(...)` call site found at the top level of this file. */
|
|
72
|
+
readonly documentEnvCalls: readonly RawDocumentEnvCall[];
|
|
73
|
+
/** Recoverable issues found while parsing this file. */
|
|
74
|
+
readonly warnings: readonly ParseWarning[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Structurally parses one file's AST for everything the generator needs:
|
|
78
|
+
* `createEnv(...)`/`documentEnv(...)` call sites, the local `const`
|
|
79
|
+
* declarations and imports needed to resolve an identifier passed to either
|
|
80
|
+
* of them.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* Never type-checks or executes the file -- see `link.ts` for how
|
|
84
|
+
* these raw facts get resolved into actual schema/docs data, including
|
|
85
|
+
* across files.
|
|
86
|
+
*/
|
|
87
|
+
export declare function parseSchemaFile(filePath: string, sourceText: string): FileParseResult;
|
|
88
|
+
/**
|
|
89
|
+
* Collects named import bindings from one `import` statement into `imports`, keyed by local name.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* Exported for reuse by `scan-dependencies.ts`, which needs the same
|
|
93
|
+
* alias-aware named-import tracking this file already does for schema
|
|
94
|
+
* linking, just applied to arbitrary application source instead of schema
|
|
95
|
+
* files.
|
|
96
|
+
*
|
|
97
|
+
* @param imports - Mutated in place; a binding re-collected under the same local name overwrites the previous entry.
|
|
98
|
+
*/
|
|
99
|
+
export declare function collectImportBindings(statement: ts.ImportDeclaration, imports: Map<string, ImportBinding>): void;
|
|
100
|
+
/** One schema entry's statically-discoverable shape -- presence facts, never evaluated/executed values. */
|
|
101
|
+
export interface DiscoveredSchemaVariable {
|
|
102
|
+
/** The environment variable name (the schema's object key). */
|
|
103
|
+
readonly key: string;
|
|
104
|
+
/** Whether the entry declares a `default`. */
|
|
105
|
+
readonly hasDefault: boolean;
|
|
106
|
+
/** The default's statically-evaluated literal value, if `hasDefault` and it was a literal we could evaluate -- `{ ok: false }` when present but not statically resolvable, `undefined` when absent. */
|
|
107
|
+
readonly defaultValue: {
|
|
108
|
+
/** Always `true` in this branch. */
|
|
109
|
+
ok: true;
|
|
110
|
+
/** The evaluated literal value. */
|
|
111
|
+
value: unknown;
|
|
112
|
+
} | {
|
|
113
|
+
/** Always `false` in this branch: present but not statically resolvable. */
|
|
114
|
+
ok: false;
|
|
115
|
+
} | undefined;
|
|
116
|
+
/** Whether the entry declares a `processor`. */
|
|
117
|
+
readonly hasProcessor: boolean;
|
|
118
|
+
/** The processor function's source text, normalized to single-line, if `hasProcessor`. */
|
|
119
|
+
readonly processorSource: string | undefined;
|
|
120
|
+
/** Only present when the processor has an explicit `: T` return type annotation -- the one thing we treat as provable. */
|
|
121
|
+
readonly processorReturnType: string | undefined;
|
|
122
|
+
/** Whether the entry declares a `validator`. */
|
|
123
|
+
readonly hasValidator: boolean;
|
|
124
|
+
/** The validator function's source text, normalized to single-line, if `hasValidator`. */
|
|
125
|
+
readonly validatorSource: string | undefined;
|
|
126
|
+
/** The variable's statically-resolved `context`, if set to a non-empty string literal (see ADR 0022). `undefined` when absent, non-literal, or empty. */
|
|
127
|
+
readonly context: string | undefined;
|
|
128
|
+
/** Where this variable's own schema property (e.g. `SESSION_SECRET: z.string()`) is declared -- distinct from the *contract's* `declaration`/`documentation` (`link.ts`); every variable has exactly one of these, always. See ADR 0036. */
|
|
129
|
+
readonly declaration: SourcePosition;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Extracts one schema object literal's variables (processor/validator/default presence); never
|
|
133
|
+
* evaluates or executes the schema.
|
|
134
|
+
*
|
|
135
|
+
* @param contextLabel - Used only to build human-readable warning messages (e.g. the contract's export name).
|
|
136
|
+
* @param warnings - Mutated in place: one entry is pushed per skipped (non-static, invalid-key, or non-literal) property.
|
|
137
|
+
*/
|
|
138
|
+
export declare function extractSchemaVariables(schemaLiteral: ts.ObjectLiteralExpression, filePath: string, contextLabel: string, warnings: ParseWarning[], sourceFile: ts.SourceFile): DiscoveredSchemaVariable[];
|
|
139
|
+
/** One variable's statically-extracted `documentEnv()` documentation, as declared in that call's `variables` entry for this key -- governance fields (`owner` .. `metadata`) are {@link EnvGovernanceFields}, resolved from static literals. */
|
|
140
|
+
export interface DiscoveredVariableDocs extends EnvGovernanceFields {
|
|
141
|
+
/** The environment variable name this documentation applies to. */
|
|
142
|
+
readonly key: string;
|
|
143
|
+
/** Statically-resolved `description`, if set to a string literal. */
|
|
144
|
+
readonly description: string | undefined;
|
|
145
|
+
/** Statically-resolved `refreshInstructions`, if set to a string literal. */
|
|
146
|
+
readonly refreshInstructions: string | undefined;
|
|
147
|
+
/** Statically-resolved `setupInstructions`, if set to a string literal. */
|
|
148
|
+
readonly setupInstructions: string | undefined;
|
|
149
|
+
/** Statically-resolved `required`, if set to a boolean literal. */
|
|
150
|
+
readonly required: boolean | undefined;
|
|
151
|
+
/** Statically-resolved `deprecated`, if set to a boolean literal. */
|
|
152
|
+
readonly deprecated: boolean | undefined;
|
|
153
|
+
/** Statically-resolved `deprecatedReason`, if set to a string literal. */
|
|
154
|
+
readonly deprecatedReason: string | undefined;
|
|
155
|
+
/** Statically-resolved `removeBy`, if set to a string literal. */
|
|
156
|
+
readonly removeBy: string | undefined;
|
|
157
|
+
/** Statically-resolved `renamedFrom`, if set to a string literal. */
|
|
158
|
+
readonly renamedFrom: string | undefined;
|
|
159
|
+
/** Statically-extracted `evidence` sub-object -- the re-verified-every-run half of a variable's documentation, kept structurally apart from the declared-only fields above. `undefined` when the declaration has no `evidence` key at all. See {@link runtime.VariableEvidenceDocs} and ADR 0037. */
|
|
160
|
+
readonly evidence: DiscoveredVariableEvidence | undefined;
|
|
161
|
+
}
|
|
162
|
+
/** The statically-extracted contents of one variable's `evidence` sub-object. See {@link runtime.VariableEvidenceDocs}. */
|
|
163
|
+
export interface DiscoveredVariableEvidence {
|
|
164
|
+
/** Well-formed `"path:line:column"` entries from `evidence.dynamicAccess`, if set to an array of string literals -- a malformed entry warns and is dropped, never included here. See ADR 0037. */
|
|
165
|
+
readonly dynamicAccess: readonly string[] | undefined;
|
|
166
|
+
}
|
|
167
|
+
/** A contract's statically-extracted `documentEnv()` documentation. */
|
|
168
|
+
/** The `documentEnv()` contract-level documentation, resolved from static literals at the parse stage. Its governance fields (`owner` .. `metadata`) are {@link EnvGovernanceFields}. */
|
|
169
|
+
export interface DiscoveredContractDocs extends EnvGovernanceFields {
|
|
170
|
+
/** Statically-resolved `name`, if set to a string literal. */
|
|
171
|
+
readonly name: string | undefined;
|
|
172
|
+
/** Statically-resolved `category`, if set to a string literal. */
|
|
173
|
+
readonly category: string | undefined;
|
|
174
|
+
/** Statically-resolved `exclusiveGroup`, if set to a string literal. */
|
|
175
|
+
readonly exclusiveGroup: string | undefined;
|
|
176
|
+
/** Defaults to `true` when the call's `active` field is absent or not statically resolvable. */
|
|
177
|
+
readonly active: boolean;
|
|
178
|
+
/** Statically-resolved `deprecated`, if set to a boolean literal. */
|
|
179
|
+
readonly deprecated: boolean | undefined;
|
|
180
|
+
/** Statically-resolved `deprecatedReason`, if set to a string literal. */
|
|
181
|
+
readonly deprecatedReason: string | undefined;
|
|
182
|
+
/** Per-variable documentation, keyed by variable name. */
|
|
183
|
+
readonly variables: ReadonlyMap<string, DiscoveredVariableDocs>;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Reads a `documentEnv()` call's second argument (the {@link runtime.ContractDocs} shape).
|
|
187
|
+
*
|
|
188
|
+
* @remarks
|
|
189
|
+
* Anything not a statically-resolvable literal warns and is skipped (falls back to
|
|
190
|
+
* "not set") rather than guessed at, same policy as schema-entry parsing.
|
|
191
|
+
*
|
|
192
|
+
* @param contextLabel - Used only to build human-readable warning messages.
|
|
193
|
+
* @param warnings - Mutated in place: one entry is pushed per unresolvable field.
|
|
194
|
+
*/
|
|
195
|
+
export declare function extractContractDocs(docsArg: ts.Expression | undefined, filePath: string, contextLabel: string, warnings: ParseWarning[]): DiscoveredContractDocs;
|
|
196
|
+
/** Reads `createEnv`'s second argument (the {@link runtime.CreateEnvOptions} shape) for just `name`, if it's a statically-resolvable string literal. Used only for the docs fallback chain (`documentEnv`'s `name` wins if set); `source` is runtime-only and never read here. */
|
|
197
|
+
export declare function extractCreateEnvOptionsName(optionsArg: ts.Expression | undefined): string | undefined;
|
|
198
|
+
export {};
|
|
199
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../src/build/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAA;AAC3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAA;AAGjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAiB1D,2IAA2I;AAC3I,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB;IACE,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,CAAA;CAC1C,GACD;IACE,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB,GACD;IACE,mGAAmG;IACnG,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAC9B,CAAA;AAEL,sGAAsG;AACtG,UAAU,gBAAgB;IACxB,sHAAsH;IACtH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAA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AwE;IACxE,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3C,gGAAgG;IAChG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;IACxC,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7C,0DAA0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAA;CAChE;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,EAClC,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,YAAY,EAAE,GACvB,sBAAsB,CAwLxB;AA8KD,kRAAkR;AAClR,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CASpB"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* env-cap's own built-in reference projections, declared through the exact
|
|
3
|
+
* same public `defineEvidenceProjection()` a consumer would use (ADR
|
|
4
|
+
* 0031/0032) -- no privileged internal path, no second way of reading the
|
|
5
|
+
* Evidence Model.
|
|
6
|
+
*
|
|
7
|
+
* This is deliberate dogfooding, not a convenience layer: `renderDocs()`'s
|
|
8
|
+
* Catalog/ownership/lifecycle sections and `renderUsageReport()`'s ownership
|
|
9
|
+
* table now source their underlying data through these projections, so the
|
|
10
|
+
* extensibility API is exercised by env-cap's own generated output on every
|
|
11
|
+
* single run. If a projector here can't express something, that's a real gap
|
|
12
|
+
* in the public API -- discovered by env-cap itself rather than by a consumer
|
|
13
|
+
* reporting it.
|
|
14
|
+
*
|
|
15
|
+
* Every projection is pure and derives *only* from `EvidenceModel`. None
|
|
16
|
+
* reads the filesystem, and none reaches back into `DiscoveredContract` --
|
|
17
|
+
* that would defeat the point, since a consumer only ever has the model.
|
|
18
|
+
*/
|
|
19
|
+
/** One variable, flattened across Contract/Ownership/Lifecycle Model into the row a Configuration Reference renders. */
|
|
20
|
+
export interface ConfigurationReferenceEntry {
|
|
21
|
+
/** Root-relative, POSIX-separated path of the declaring contract. */
|
|
22
|
+
readonly file: string;
|
|
23
|
+
readonly exportName: string;
|
|
24
|
+
/** The declaring contract's display name, resolved from Contract Model -- the one model that owns it. */
|
|
25
|
+
readonly contractName: string;
|
|
26
|
+
readonly key: string;
|
|
27
|
+
readonly description: string | undefined;
|
|
28
|
+
/** Effective owner: the variable's own, falling back to its contract's. */
|
|
29
|
+
readonly owner: string | undefined;
|
|
30
|
+
/** Effective sensitivity: the variable's own, falling back to its contract's. Any string; see {@link runtime.VariableDocs.sensitivity}. */
|
|
31
|
+
readonly sensitivity: string | undefined;
|
|
32
|
+
readonly required: boolean | undefined;
|
|
33
|
+
readonly hasDefault: boolean;
|
|
34
|
+
readonly hasProcessor: boolean;
|
|
35
|
+
readonly hasValidator: boolean;
|
|
36
|
+
readonly expiresAt: string | undefined;
|
|
37
|
+
/** Whether the declaring contract is active. Inactive contracts are included -- the reference documents everything discovered, same scope the Catalog always had. */
|
|
38
|
+
readonly active: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** The Configuration Reference projection's output shape. */
|
|
41
|
+
export interface ConfigurationReference extends Record<string, unknown> {
|
|
42
|
+
/** The standing "declared, not verified" notice -- see `evidenceDisclaimer()`. Carried in the data, not only in a renderer, so a consumer projecting this to their own format can't accidentally drop it. */
|
|
43
|
+
readonly disclaimer: string;
|
|
44
|
+
/** Every declared variable across every discovered contract, sorted by contract file, then export name, then key. */
|
|
45
|
+
readonly entries: readonly ConfigurationReferenceEntry[];
|
|
46
|
+
}
|
|
47
|
+
/** The minimal shape {@link groupVariablesByOwner} needs -- structural, not pinned to one model, so the exact same grouping serves `OwnershipModel`'s already-resolved owners and `ContractModel`'s raw ones alike. */
|
|
48
|
+
export interface OwnerBearingContract {
|
|
49
|
+
readonly owner: string | undefined;
|
|
50
|
+
readonly variables: readonly unknown[];
|
|
51
|
+
}
|
|
52
|
+
/** The element type of an {@link OwnerBearingContract}'s own `variables`, so callers never have to name it a second time. */
|
|
53
|
+
type VariableOf<C> = C extends {
|
|
54
|
+
readonly variables: readonly (infer V)[];
|
|
55
|
+
} ? V : never;
|
|
56
|
+
/**
|
|
57
|
+
* Groups every variable under its effective owner (its own, falling back to
|
|
58
|
+
* its contract's), preserving input order within each owner.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* The single implementation of "who owns what, rolled up per owner", shared
|
|
62
|
+
* by the {@link ownershipSummary} projection and `docs.ts`'s own rendered
|
|
63
|
+
* ownership matrix. Kept as one function precisely so env-cap's generated
|
|
64
|
+
* Markdown and the projection a consumer reads can never disagree about the
|
|
65
|
+
* grouping -- the same reason `effectiveOwner()` is the single resolution
|
|
66
|
+
* rule (ADR 0028). Variables with no effective owner are omitted entirely
|
|
67
|
+
* rather than bucketed under a synthetic `"unowned"` key, which would read
|
|
68
|
+
* as a real team name; callers that need them ask for them separately.
|
|
69
|
+
*
|
|
70
|
+
* `ownerOf` is supplied by the caller so a model whose owners are already
|
|
71
|
+
* resolved (`OwnershipModel`) and one whose aren't (`ContractModel`) both
|
|
72
|
+
* work without this function guessing which it was handed.
|
|
73
|
+
*/
|
|
74
|
+
export declare function groupVariablesByOwner<C extends OwnerBearingContract>(contracts: readonly C[], ownerOf: (contract: C, variable: VariableOf<C>) => string | undefined): ReadonlyMap<string, readonly {
|
|
75
|
+
contract: C;
|
|
76
|
+
variable: VariableOf<C>;
|
|
77
|
+
}[]>;
|
|
78
|
+
/**
|
|
79
|
+
* Configuration Reference: every declared variable, with its effective owner
|
|
80
|
+
* and sensitivity already resolved, in one flat, sorted list.
|
|
81
|
+
*
|
|
82
|
+
* @remarks
|
|
83
|
+
* Resolution (variable's own value falling back to its contract's) happens
|
|
84
|
+
* here rather than being left to each consumer, so two readers of this
|
|
85
|
+
* projection can never disagree about who owns a variable -- the same reason
|
|
86
|
+
* `effectiveOwner()` exists on the generator side (ADR 0028).
|
|
87
|
+
*/
|
|
88
|
+
export declare const configurationReference: import("../evidence/define-projection.js").EvidenceProjection<ConfigurationReference>;
|
|
89
|
+
/** One owner and everything attributed to them. */
|
|
90
|
+
export interface OwnershipSummaryEntry {
|
|
91
|
+
/** The owner string exactly as declared. */
|
|
92
|
+
readonly owner: string;
|
|
93
|
+
/** Every variable this owner is the effective owner of, as `${contractName}.${key}`, sorted. */
|
|
94
|
+
readonly variables: readonly string[];
|
|
95
|
+
/** Every contract declaring this owner as its contract-level default, by display name, sorted. */
|
|
96
|
+
readonly contracts: readonly string[];
|
|
97
|
+
}
|
|
98
|
+
/** The Ownership summary projection's output shape. */
|
|
99
|
+
export interface OwnershipSummary extends Record<string, unknown> {
|
|
100
|
+
/** See {@link ConfigurationReference.disclaimer}. */
|
|
101
|
+
readonly disclaimer: string;
|
|
102
|
+
/** One entry per distinct owner, sorted by owner. */
|
|
103
|
+
readonly owners: readonly OwnershipSummaryEntry[];
|
|
104
|
+
/** Every variable with no effective owner at all, as `${contractName}.${key}`, sorted. Named separately rather than bucketed under a synthetic `"unowned"` owner, so "nobody owns this" can never be mistaken for a real team name. */
|
|
105
|
+
readonly unowned: readonly string[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Ownership summary: the inverse of Ownership Model's per-contract view --
|
|
109
|
+
* who owns what, rolled up per owner, plus an explicit unowned list.
|
|
110
|
+
*/
|
|
111
|
+
export declare const ownershipSummary: import("../evidence/define-projection.js").EvidenceProjection<OwnershipSummary>;
|
|
112
|
+
/** One contract- or variable-level `expiresAt` inside the configured window. */
|
|
113
|
+
export interface ExpiringSoonEntry {
|
|
114
|
+
/** Root-relative, POSIX-separated path of the declaring contract. */
|
|
115
|
+
readonly file: string;
|
|
116
|
+
readonly exportName: string;
|
|
117
|
+
/** The declaring contract's display name, resolved from Contract Model. */
|
|
118
|
+
readonly contractName: string;
|
|
119
|
+
/** `undefined` for a contract-level expiry, set for a per-variable one. */
|
|
120
|
+
readonly key: string | undefined;
|
|
121
|
+
/** The raw ISO date string, exactly as declared -- never reformatted. */
|
|
122
|
+
readonly expiresAt: string;
|
|
123
|
+
/** Days remaining as of the run that produced this evidence; negative when already expired. */
|
|
124
|
+
readonly daysRemaining: number;
|
|
125
|
+
/** `true` when `daysRemaining` is negative -- the deadline has already passed. */
|
|
126
|
+
readonly expired: boolean;
|
|
127
|
+
/** How to obtain a replacement value, if the declaration says. */
|
|
128
|
+
readonly refreshInstructions: string | undefined;
|
|
129
|
+
/** Effective owner, so a reader knows who to chase without a second lookup. */
|
|
130
|
+
readonly owner: string | undefined;
|
|
131
|
+
}
|
|
132
|
+
/** The Expiring-Soon projection's output shape. */
|
|
133
|
+
export interface ExpiringSoonReport extends Record<string, unknown> {
|
|
134
|
+
/** See {@link ConfigurationReference.disclaimer}. */
|
|
135
|
+
readonly disclaimer: string;
|
|
136
|
+
/** Every entry inside the window, soonest-first (already-expired entries lead, most-overdue first). */
|
|
137
|
+
readonly entries: readonly ExpiringSoonEntry[];
|
|
138
|
+
/** How many of `entries` are already past their `expiresAt`. */
|
|
139
|
+
readonly expiredCount: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Expiring-Soon report: Lifecycle Model's `expiring` view, joined with
|
|
143
|
+
* ownership and refresh instructions so a reader can act on a row without
|
|
144
|
+
* cross-referencing three other models by hand.
|
|
145
|
+
*
|
|
146
|
+
* @remarks
|
|
147
|
+
* The window itself was applied upstream, when Lifecycle Model was built --
|
|
148
|
+
* this projection deliberately does not re-filter by a date of its own.
|
|
149
|
+
* Recomputing "soon" here would make the projection's answer depend on when
|
|
150
|
+
* it happened to be *read* rather than when the evidence was *generated*,
|
|
151
|
+
* which is exactly the reproducibility property the Evidence Model exists to
|
|
152
|
+
* preserve.
|
|
153
|
+
*/
|
|
154
|
+
export declare const expiringSoonReport: import("../evidence/define-projection.js").EvidenceProjection<ExpiringSoonReport>;
|
|
155
|
+
export {};
|
|
156
|
+
//# sourceMappingURL=reference-projections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-projections.d.ts","sourceRoot":"","sources":["../../../src/build/reference-projections.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAOH,wHAAwH;AACxH,MAAM,WAAW,2BAA2B;IAC1C,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,yGAAyG;IACzG,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IAClC,2IAA2I;IAC3I,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,qKAAqK;IACrK,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CACzB;AAED,6DAA6D;AAC7D,MAAM,WAAW,sBAAuB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,6MAA6M;IAC7M,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,qHAAqH;IACrH,QAAQ,CAAC,OAAO,EAAE,SAAS,2BAA2B,EAAE,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AA;IACjD,uOAAuO;IACvO,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AAED;;;GAGG;AAEH,eAAO,MAAM,gBAAgB,iFA6C3B,CAAA;AAEF,gFAAgF;AAChF,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,2EAA2E;IAC3E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,2EAA2E;IAC3E,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,+FAA+F;IAC/F,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,kFAAkF;IAClF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAA;IAChD,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CACnC;AAED,mDAAmD;AACnD,MAAM,WAAW,kBAAmB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACjE,qDAAqD;IACrD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,uGAAuG;IACvG,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAA;IAC9C,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,kBAAkB,mFAkD7B,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BuildFileSystem } from "../types.js";
|
|
2
|
+
import { type PackageSchemaResolutionResult } from "./resolve-package-schema.js";
|
|
3
|
+
import { type AliasResolutionCache, type TsconfigPathsResolution } from "./resolve-tsconfig-paths.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a relative import specifier (as written in source: `"./schema.js"`,
|
|
6
|
+
* matching this codebase's own convention of `.js`-suffixed relative imports
|
|
7
|
+
* pointing at `.ts` source files) to an absolute file path, relative to the
|
|
8
|
+
* file that contains the import.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Deliberately narrow: only handles a direct relative specifier resolving to
|
|
12
|
+
* a real `.ts`/`.tsx` file on disk. Bare/package specifiers, namespace
|
|
13
|
+
* imports, and anything requiring real module resolution (re-export chains,
|
|
14
|
+
* `exports` map lookups, etc.) return `undefined` -- the caller treats that
|
|
15
|
+
* as "couldn't statically link" and warns rather than guesses, the same
|
|
16
|
+
* philosophy `evaluateLiteral` already uses for non-literal expressions.
|
|
17
|
+
*
|
|
18
|
+
* @returns The resolved absolute path, or `undefined` when the specifier isn't relative or doesn't resolve to a real file.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveRelativeImport(importingFile: string, specifier: string, fs: BuildFileSystem): Promise<string | undefined>;
|
|
21
|
+
/** Shared inputs threaded through every call to {@link resolveImportSpecifier} for one discovery/link run. */
|
|
22
|
+
export interface ImportResolutionContext {
|
|
23
|
+
/** The filesystem capability -- `./build` never imports `node:fs` (ADR 0040). */
|
|
24
|
+
readonly fs: BuildFileSystem;
|
|
25
|
+
/** Absolute path of the project root, used to resolve package specifiers. */
|
|
26
|
+
readonly root: string;
|
|
27
|
+
/** Explicit allowlist -- see ADR 0014. Empty/omitted means package resolution never fires, identical to today's behavior. */
|
|
28
|
+
readonly packages: readonly string[];
|
|
29
|
+
/** Memoizes package resolution per specifier across the whole run -- see `resolvePackageImport`'s own doc comment for why. */
|
|
30
|
+
readonly cache: Map<string, Promise<PackageSchemaResolutionResult>>;
|
|
31
|
+
/** Parsed `tsconfig.json` `paths`/`baseUrl`, or `undefined` when alias resolution found nothing to do or was disabled -- see ADR 0023. */
|
|
32
|
+
readonly tsconfigPaths: TsconfigPathsResolution | undefined;
|
|
33
|
+
/** Memoizes alias resolution across the whole run -- see `resolveAliasImport`'s own doc comment for why. Always allocated, even when `tsconfigPaths` is `undefined`, mirroring `cache` above. */
|
|
34
|
+
readonly aliasCache: AliasResolutionCache;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The one specifier-resolution entry point `link.ts` and `dependency-graph.ts`
|
|
38
|
+
* call, instead of each duplicating a
|
|
39
|
+
* `(await resolveRelativeImport(...)) ?? resolveAliasImport(...) ?? (await resolvePackageImport(...))`
|
|
40
|
+
* chain at every call site.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Purely a composition point -- no new resolution logic lives here. Tries, in order: the
|
|
44
|
+
* relative resolver (cheap, no `fs.stat` beyond the local filesystem check it already
|
|
45
|
+
* does); tsconfig path-alias resolution (ADR 0023, on by default) for a bare specifier
|
|
46
|
+
* matching the project's own `tsconfig.json` `paths`/`baseUrl`; then package resolution
|
|
47
|
+
* (ADR 0014) for a bare specifier matching an allow-listed package name. Alias resolution
|
|
48
|
+
* runs before package resolution because it resolves the consuming project's own local
|
|
49
|
+
* source (already-trusted, no versioning boundary), the same precedence relative
|
|
50
|
+
* resolution already has over package resolution.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveImportSpecifier(importingFile: string, specifier: string, context: ImportResolutionContext): Promise<string | undefined>;
|
|
53
|
+
//# sourceMappingURL=resolve-import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-import.d.ts","sourceRoot":"","sources":["../../../../src/build/resolution/resolve-import.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM,6BAA6B,CAAA;AAEpC;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,eAAe,GAClB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B;AA0BD,8GAA8G;AAC9G,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAA;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,6HAA6H;IAC7H,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IACpC,8HAA8H;IAC9H,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,6BAA6B,CAAC,CAAC,CAAA;IACnE,0IAA0I;IAC1I,QAAQ,CAAC,aAAa,EAAE,uBAAuB,GAAG,SAAS,CAAA;IAC3D,iMAAiM;IACjM,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAA;CAC1C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ParseWarning } from "../parse.js";
|
|
2
|
+
import type { BuildFileSystem } from "../types.js";
|
|
3
|
+
/** 1 MiB. New hardening specific to this trust tier -- a package crosses a
|
|
4
|
+
* real versioning/trust boundary that locally-discovered source doesn't,
|
|
5
|
+
* so this caps the cost of parsing an oversized or adversarial file before
|
|
6
|
+
* any of its content is even read into memory. See ADR 0014. */
|
|
7
|
+
export declare const MAX_PACKAGE_SCHEMA_FILE_BYTES = 1048576;
|
|
8
|
+
type PackageResolutionFailureCode = "PACKAGE_NOT_FOUND" | "MALFORMED_PACKAGE_JSON" | "FIELD_MISSING" | "INVALID_EXTENSION" | "OUTSIDE_PACKAGE" | "FILE_TOO_LARGE";
|
|
9
|
+
/** Both the authored and resolved forms are kept -- diagnostics benefit from
|
|
10
|
+
* showing exactly what a package author wrote versus what it resolved to. */
|
|
11
|
+
export interface PackageOrigin {
|
|
12
|
+
/** The allow-listed package name that declared this schema. */
|
|
13
|
+
readonly packageName: string;
|
|
14
|
+
/** The `"envCap.schema"` value exactly as the package author wrote it. */
|
|
15
|
+
readonly declaredField: string;
|
|
16
|
+
/** Absolute, realpath-canonicalized path to the resolved schema file. */
|
|
17
|
+
readonly resolvedFile: string;
|
|
18
|
+
/** Absolute, realpath-canonicalized path to the package's own directory. */
|
|
19
|
+
readonly packageDir: string;
|
|
20
|
+
}
|
|
21
|
+
export type PackageSchemaResolutionResult = {
|
|
22
|
+
readonly ok: true;
|
|
23
|
+
readonly origin: PackageOrigin;
|
|
24
|
+
} | {
|
|
25
|
+
readonly ok: false;
|
|
26
|
+
readonly code: PackageResolutionFailureCode;
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Resolves one allow-listed package name. Memoized in a caller-owned
|
|
31
|
+
* `cache` (one per `generate*()` invocation, shared with linking/dependency-
|
|
32
|
+
* graph resolution) so a name referenced from multiple places -- multiple
|
|
33
|
+
* scanned files bare-importing the same package, or a duplicate entry in
|
|
34
|
+
* `packages` -- is only ever resolved once. The cache is populated with the
|
|
35
|
+
* in-flight promise before it settles, so concurrent callers await the same
|
|
36
|
+
* resolution rather than racing duplicate work.
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolvePackageSchemaFile(packageName: string, root: string, cache: Map<string, Promise<PackageSchemaResolutionResult>>, fs: BuildFileSystem): Promise<PackageSchemaResolutionResult>;
|
|
39
|
+
interface ResolvedPackageFile {
|
|
40
|
+
readonly packageName: string;
|
|
41
|
+
readonly file: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ResolvePackagesResult {
|
|
44
|
+
readonly files: readonly ResolvedPackageFile[];
|
|
45
|
+
/** Keyed by resolved file path, for `DiscoveredContract.packageOrigin` lookups downstream. */
|
|
46
|
+
readonly origins: ReadonlyMap<string, PackageOrigin>;
|
|
47
|
+
readonly warnings: readonly ParseWarning[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolves every allow-listed package name. Input is deduplicated first, so
|
|
51
|
+
* a duplicate entry in `packages` (accidental or defensive) produces exactly
|
|
52
|
+
* one resolution attempt and, on failure, exactly one warning -- never two.
|
|
53
|
+
* Never throws: every failure becomes one `ParseWarning`, consistent with
|
|
54
|
+
* every other static-analysis boundary in this codebase.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveAllowlistedPackages(packages: readonly string[], root: string, cache: Map<string, Promise<PackageSchemaResolutionResult>>, fs: BuildFileSystem): Promise<ResolvePackagesResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Combines local schema-discovery hits with package-resolved files into one
|
|
59
|
+
* deduplicated list, keyed by realpath rather than lexical absolute path --
|
|
60
|
+
* package-resolved files are already realpath-canonicalized (see
|
|
61
|
+
* `resolveUncached` above), but local `discoverSchemaFiles()` hits are plain
|
|
62
|
+
* `readdir`-derived absolute paths that may themselves traverse a symlink (a
|
|
63
|
+
* symlinked `root`, or an included path reached through one). Deduplicating
|
|
64
|
+
* on the lexical path alone would miss the case where the same physical file
|
|
65
|
+
* is reached twice through two different symlinked routes -- one via local
|
|
66
|
+
* glob discovery, one via package resolution -- and silently double-count it
|
|
67
|
+
* into two identical contracts, including the more mundane case of a package
|
|
68
|
+
* that's both locally glob-reachable (e.g. during a monorepo migration) and
|
|
69
|
+
* explicitly allow-listed. On a collision, the local path string identity
|
|
70
|
+
* wins (the package-resolved duplicate is dropped).
|
|
71
|
+
*/
|
|
72
|
+
export declare function mergeLocalAndPackageFiles(localFiles: readonly string[], packageFiles: readonly string[], fs: BuildFileSystem): Promise<string[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Bare-specifier-to-allowlist matching, used by `resolve-import.ts`'s
|
|
75
|
+
* `resolveImportSpecifier()` as its package-resolution fallback. Only ever
|
|
76
|
+
* attempts resolution for a specifier that is (or is a subpath of) an
|
|
77
|
+
* allow-listed package name -- any other bare specifier is not this
|
|
78
|
+
* mechanism's concern and returns `undefined` immediately, identical to
|
|
79
|
+
* `resolveRelativeImport()`'s existing bare-specifier no-op.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolvePackageImport(specifier: string, allowedPackages: readonly string[], root: string, cache: Map<string, Promise<PackageSchemaResolutionResult>>, fs: BuildFileSystem): Promise<string | undefined>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=resolve-package-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-package-schema.d.ts","sourceRoot":"","sources":["../../../../src/build/resolution/resolve-package-schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAuBlD;;;iEAGiE;AACjE,eAAO,MAAM,6BAA6B,UAAY,CAAA;AAItD,KAAK,4BAA4B,GAC7B,mBAAmB,GACnB,wBAAwB,GACxB,eAAe,GACf,mBAAmB,GACnB,iBAAiB,GACjB,gBAAgB,CAAA;AAEpB;8EAC8E;AAC9E,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,0EAA0E;IAC1E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,4EAA4E;IAC5E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,MAAM,6BAA6B,GACrC;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;CAAE,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