@oddkin/analyzer 0.0.0-stage → 1.0.0-beta.1
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 +40 -2
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +65 -0
- package/dist/bin.js.map +1 -0
- package/dist/contracts.d.ts +29 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +57 -0
- package/dist/contracts.js.map +1 -0
- package/dist/docs.d.ts +34 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/docs.js +63 -0
- package/dist/docs.js.map +1 -0
- package/dist/emit.d.ts +38 -0
- package/dist/emit.d.ts.map +1 -0
- package/dist/emit.js +406 -0
- package/dist/emit.js.map +1 -0
- package/dist/examples.d.ts +35 -0
- package/dist/examples.d.ts.map +1 -0
- package/dist/examples.js +345 -0
- package/dist/examples.js.map +1 -0
- package/dist/extract.d.ts +208 -0
- package/dist/extract.d.ts.map +1 -0
- package/dist/extract.js +1570 -0
- package/dist/extract.js.map +1 -0
- package/dist/foundations.d.ts +36 -0
- package/dist/foundations.d.ts.map +1 -0
- package/dist/foundations.js +108 -0
- package/dist/foundations.js.map +1 -0
- package/dist/history.d.ts +10 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +62 -0
- package/dist/history.js.map +1 -0
- package/dist/impact-bin.d.ts +3 -0
- package/dist/impact-bin.d.ts.map +1 -0
- package/dist/impact-bin.js +7 -0
- package/dist/impact-bin.js.map +1 -0
- package/dist/impact-cli.d.ts +8 -0
- package/dist/impact-cli.d.ts.map +1 -0
- package/dist/impact-cli.js +121 -0
- package/dist/impact-cli.js.map +1 -0
- package/dist/impact.d.ts +282 -0
- package/dist/impact.d.ts.map +1 -0
- package/dist/impact.js +744 -0
- package/dist/impact.js.map +1 -0
- package/dist/index.d.ts +82 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +228 -0
- package/dist/index.js.map +1 -0
- package/dist/kit/agents-md.d.ts +10 -0
- package/dist/kit/agents-md.d.ts.map +1 -0
- package/dist/kit/agents-md.js +64 -0
- package/dist/kit/agents-md.js.map +1 -0
- package/dist/kit/cli.d.ts +8 -0
- package/dist/kit/cli.d.ts.map +1 -0
- package/dist/kit/cli.js +214 -0
- package/dist/kit/cli.js.map +1 -0
- package/dist/kit/context.d.ts +104 -0
- package/dist/kit/context.d.ts.map +1 -0
- package/dist/kit/context.js +323 -0
- package/dist/kit/context.js.map +1 -0
- package/dist/kit/index.d.ts +12 -0
- package/dist/kit/index.d.ts.map +1 -0
- package/dist/kit/index.js +12 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/kit/kit.d.ts +62 -0
- package/dist/kit/kit.d.ts.map +1 -0
- package/dist/kit/kit.js +626 -0
- package/dist/kit/kit.js.map +1 -0
- package/dist/kit/llms.d.ts +22 -0
- package/dist/kit/llms.d.ts.map +1 -0
- package/dist/kit/llms.js +58 -0
- package/dist/kit/llms.js.map +1 -0
- package/dist/kit/package-kit.d.ts +18 -0
- package/dist/kit/package-kit.d.ts.map +1 -0
- package/dist/kit/package-kit.js +224 -0
- package/dist/kit/package-kit.js.map +1 -0
- package/dist/kit-bin.d.ts +3 -0
- package/dist/kit-bin.d.ts.map +1 -0
- package/dist/kit-bin.js +7 -0
- package/dist/kit-bin.js.map +1 -0
- package/dist/published.d.ts +43 -0
- package/dist/published.d.ts.map +1 -0
- package/dist/published.js +62 -0
- package/dist/published.js.map +1 -0
- package/dist/references.d.ts +70 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +255 -0
- package/dist/references.js.map +1 -0
- package/dist/style-mappings.d.ts +46 -0
- package/dist/style-mappings.d.ts.map +1 -0
- package/dist/style-mappings.js +246 -0
- package/dist/style-mappings.js.map +1 -0
- package/dist/stylesheets.d.ts +56 -0
- package/dist/stylesheets.d.ts.map +1 -0
- package/dist/stylesheets.js +83 -0
- package/dist/stylesheets.js.map +1 -0
- package/dist/verification.d.ts +62 -0
- package/dist/verification.d.ts.map +1 -0
- package/dist/verification.js +115 -0
- package/dist/verification.js.map +1 -0
- package/package.json +45 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Brian Brady
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @oddkin/analyzer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Node-only static analysis for Oddkin component libraries. Produces a standard Custom Elements Manifest (`custom-elements.json`, schema 2.1.0) and the Oddkin enrichment manifest (`oddkin.metadata.json`) **without importing or executing** the analyzed code. Development tooling: it depends on the TypeScript 5.9 compiler and is never part of a browser bundle.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
oddkin-analyze tsconfig.json --out . [--name my-lib --version 1.0.0] [--strict] [--json]
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { analyze, writeOutputs } from '@oddkin/analyzer';
|
|
11
|
+
|
|
12
|
+
const result = analyze({ project: 'tsconfig.json' });
|
|
13
|
+
await writeOutputs(result, '.');
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Module paths in the outputs are the published paths (`rootDir` → `outDir`). Dynamic definitions are reported as `analyzer.dynamic.*` diagnostics with source locations instead of being guessed.
|
|
17
|
+
|
|
18
|
+
Contract and limits: [metadata-and-analyzer.md](../../docs/architecture/metadata-and-analyzer.md) §8; front-end decision: ADR 0018.
|
|
19
|
+
|
|
20
|
+
## Agent kits
|
|
21
|
+
|
|
22
|
+
`oddkin-kit` writes agent kits from the metadata the analyzer publishes ([agent-tooling.md](../../docs/architecture/agent-tooling.md) §4–5): an entry guide (`GUIDE.md`, within 8 KiB), a reference for each component, token category, recipe, stylesheet, and model, `kit.json` with a fingerprint of its inputs, and `llms.txt`. Run it in the workspace root:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
# The kit each component package ships, in <package>/agent/ (list "agent" in the package's "files").
|
|
26
|
+
oddkin-kit package
|
|
27
|
+
# Check every shipped kit against the installed package's metadata: the packages named, or the workspace's own.
|
|
28
|
+
oddkin-kit package --check --package @oddkin/components
|
|
29
|
+
# A kit for the repository itself, in .oddkin/agent-kit/<name>/; --check names the inputs that changed.
|
|
30
|
+
oddkin-kit [--package <name>]... [--out <dir>] [--theme-config <file>] [--check]
|
|
31
|
+
# The managed section of AGENTS.md; text outside its markers is kept.
|
|
32
|
+
oddkin-kit agents-md [--write | --check]
|
|
33
|
+
# A documentation site's llms.txt (llmstxt.org) and the kit files it links, in <dir>/agent/<name>/.
|
|
34
|
+
oddkin-kit llms --base https://docs.example/ --out <dir> [--title <text>] [--summary <text>]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Exit codes: 0 success; 1 a stale, missing, or over-budget kit, or a stale `AGENTS.md` section; 2 usage error. The same functions are exported from `@oddkin/analyzer/kit` (`resolveProjectContext`, `generateKit`, `checkKit`, `packageKit`, `siteLlmsText`, `renderSection`, `updateAgentsMd`, and `main`). A kit a package ships depends only on what the package publishes, so a project that installs it regenerates the same files.
|
|
38
|
+
|
|
39
|
+
## Stability
|
|
40
|
+
|
|
41
|
+
The analyzer is versioned `1.0.0` with the other Oddkin packages, but only its outputs follow candidate v1 contracts: Custom Elements Manifest 2.1.0, `oddkin-metadata.v1`, `diagnostic.v1`, and the agent kits' `agent-kit.v1` and `project-context.v1`. Its own contracts are **not frozen by 1.0.0** ([ADR 0047](../../docs/architecture/decisions/0047-m8-checkpoint-candidate-v1-contracts.md)): the impact snapshot and report (`comparison-snapshot.v1`, `impact-report.v1`) and the `product.v1` input `oddkin-impact` reads. Until they are frozen they can change in a minor release; only frozen contracts wait for a major ([release-process.md](../../docs/release-process.md) §1).
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* oddkin-analyze <tsconfig> [--out dir] [--name n --version v] [--no-history] [--strict] [--json]
|
|
4
|
+
* Exit codes: 0 success, 1 errors (or warnings with --strict), 2 usage error.
|
|
5
|
+
*/
|
|
6
|
+
import { dirname, resolve } from 'node:path';
|
|
7
|
+
import { parseArgs } from 'node:util';
|
|
8
|
+
import { analyze, gitHistory, writeOutputs } from './index.js';
|
|
9
|
+
const USAGE = 'Usage: oddkin-analyze <tsconfig.json> [--out <dir>] [--name <library> --version <version>] [--no-history] [--strict] [--json]\n' +
|
|
10
|
+
' Updated dates come from git history unless --no-history; without full history (no git, a shallow clone) pages carry only authored @updated dates.';
|
|
11
|
+
let parsed;
|
|
12
|
+
try {
|
|
13
|
+
parsed = parseArgs({
|
|
14
|
+
allowPositionals: true,
|
|
15
|
+
allowNegative: true,
|
|
16
|
+
options: {
|
|
17
|
+
out: { type: 'string', default: '.' },
|
|
18
|
+
name: { type: 'string' },
|
|
19
|
+
version: { type: 'string' },
|
|
20
|
+
history: { type: 'boolean', default: true },
|
|
21
|
+
strict: { type: 'boolean', default: false },
|
|
22
|
+
json: { type: 'boolean', default: false },
|
|
23
|
+
help: { type: 'boolean', short: 'h', default: false },
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error(`${error instanceof Error ? error.message : String(error)}\n${USAGE}`);
|
|
29
|
+
process.exit(2);
|
|
30
|
+
}
|
|
31
|
+
const { values, positionals } = parsed;
|
|
32
|
+
if (values.help) {
|
|
33
|
+
console.log(USAGE);
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
const [project] = positionals;
|
|
37
|
+
if (!project || (values.name === undefined) !== (values.version === undefined)) {
|
|
38
|
+
console.error(USAGE);
|
|
39
|
+
process.exit(2);
|
|
40
|
+
}
|
|
41
|
+
const history = values.history ? gitHistory(dirname(resolve(project))) : undefined;
|
|
42
|
+
const result = analyze({
|
|
43
|
+
project,
|
|
44
|
+
...(values.name && values.version
|
|
45
|
+
? { library: { name: values.name, version: values.version } }
|
|
46
|
+
: {}),
|
|
47
|
+
...(history ? { history } : {}),
|
|
48
|
+
});
|
|
49
|
+
const files = await writeOutputs(result, values.out);
|
|
50
|
+
if (values.json)
|
|
51
|
+
console.log(JSON.stringify(result.diagnostics, null, 2));
|
|
52
|
+
else {
|
|
53
|
+
if (values.history && !history)
|
|
54
|
+
console.error('note: no full git history (no repository, or a shallow clone); pages carry only authored @updated dates.');
|
|
55
|
+
for (const d of result.diagnostics) {
|
|
56
|
+
const at = d.source ? ` ${d.source.file}:${d.source.line}:${d.source.column}` : '';
|
|
57
|
+
console.error(`${d.severity} ${d.code}${at}: ${d.message}${d.suggestion ? `\n → ${d.suggestion}` : ''}`);
|
|
58
|
+
}
|
|
59
|
+
for (const file of files)
|
|
60
|
+
console.log(`wrote ${file}`);
|
|
61
|
+
}
|
|
62
|
+
process.exitCode = result.diagnostics.some((d) => d.severity === 'error' || (values.strict && d.severity === 'warning'))
|
|
63
|
+
? 1
|
|
64
|
+
: 0;
|
|
65
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;GAGG;AACH,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,KAAK,GACT,iIAAiI;IACjI,qJAAqJ,CAAC;AAExJ,IAAI,MAAM,CAAC;AACX,IAAI,CAAC;IACH,MAAM,GAAG,SAAS,CAAC;QACjB,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,IAAI;QACnB,OAAO,EAAE;YACP,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;YACrC,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE;YAC3C,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE;YAC3C,IAAI,EAAE,EAAE,IAAI,EAA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C,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAC7E;IACC,CAAC,CAAC,CAAC;IACH,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ContractEntry {
|
|
2
|
+
readonly title: string;
|
|
3
|
+
readonly anchor: string;
|
|
4
|
+
/** SHA-256 of the section text, for change detection. */
|
|
5
|
+
readonly sha256: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ContractIndex {
|
|
8
|
+
readonly package: string;
|
|
9
|
+
/** Version of the installed package the index was read from. */
|
|
10
|
+
readonly version: string;
|
|
11
|
+
/** Absolute path of the installed `CONTRACTS.md`. */
|
|
12
|
+
readonly path: string;
|
|
13
|
+
readonly contracts: Readonly<Record<string, ContractEntry>>;
|
|
14
|
+
}
|
|
15
|
+
export interface ResolvedContract extends ContractEntry {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly package: string;
|
|
18
|
+
readonly version: string;
|
|
19
|
+
readonly path: string;
|
|
20
|
+
/** The section of `CONTRACTS.md`, from its anchor to the next one. */
|
|
21
|
+
readonly text: string;
|
|
22
|
+
}
|
|
23
|
+
/** The package that publishes `id` (`contract:core/scope` → `@oddkin/core`), if `id` is well formed. */
|
|
24
|
+
export declare const contractPackage: (id: string) => string | undefined;
|
|
25
|
+
/** The contract index of `packageName` as installed for code in `from` (default: the working directory). */
|
|
26
|
+
export declare function contractIndex(packageName: string, from?: string): ContractIndex | undefined;
|
|
27
|
+
/** Resolve a contract id to its text in the installed package, or `undefined` when it does not exist. */
|
|
28
|
+
export declare function resolveContract(id: string, from?: string): ResolvedContract | undefined;
|
|
29
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sEAAsE;IACtE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAID,wGAAwG;AACxG,eAAO,MAAM,eAAe,OAAQ,MAAM,KAAG,MAAM,GAAG,SAGrD,CAAC;AAEF,4GAA4G;AAC5G,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,SAAgB,GACnB,aAAa,GAAG,SAAS,CAqB3B;AAED,yGAAyG;AACzG,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,SAAgB,GAAG,gBAAgB,GAAG,SAAS,CAiB9F"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract references (`contract:core/<name>`) resolved offline against the installed package:
|
|
3
|
+
* `@oddkin/core/contracts.json` maps each id to an anchor in the packaged `CONTRACTS.md`, both
|
|
4
|
+
* generated from `docs/architecture/core-contracts.md`.
|
|
5
|
+
*/
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
import { createRequire } from 'node:module';
|
|
8
|
+
import { dirname, join } from 'node:path';
|
|
9
|
+
const ID = /^contract:([a-z][a-z0-9-]*)\/([a-z0-9-]+)$/;
|
|
10
|
+
/** The package that publishes `id` (`contract:core/scope` → `@oddkin/core`), if `id` is well formed. */
|
|
11
|
+
export const contractPackage = (id) => {
|
|
12
|
+
const owner = ID.exec(id)?.[1];
|
|
13
|
+
return owner ? `@oddkin/${owner}` : undefined;
|
|
14
|
+
};
|
|
15
|
+
/** The contract index of `packageName` as installed for code in `from` (default: the working directory). */
|
|
16
|
+
export function contractIndex(packageName, from = process.cwd()) {
|
|
17
|
+
const require = createRequire(join(from, 'package.json'));
|
|
18
|
+
let indexPath;
|
|
19
|
+
let manifestPath;
|
|
20
|
+
try {
|
|
21
|
+
indexPath = require.resolve(`${packageName}/contracts.json`);
|
|
22
|
+
manifestPath = require.resolve(`${packageName}/package.json`);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const index = JSON.parse(readFileSync(indexPath, 'utf8'));
|
|
28
|
+
const manifest = JSON.parse(readFileSync(manifestPath, 'utf8'));
|
|
29
|
+
return {
|
|
30
|
+
package: packageName,
|
|
31
|
+
version: manifest.version,
|
|
32
|
+
path: join(dirname(indexPath), index.file),
|
|
33
|
+
contracts: index.contracts,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Resolve a contract id to its text in the installed package, or `undefined` when it does not exist. */
|
|
37
|
+
export function resolveContract(id, from = process.cwd()) {
|
|
38
|
+
const packageName = contractPackage(id);
|
|
39
|
+
const index = packageName ? contractIndex(packageName, from) : undefined;
|
|
40
|
+
const entry = index?.contracts[id];
|
|
41
|
+
if (!index || !entry)
|
|
42
|
+
return undefined;
|
|
43
|
+
const markdown = readFileSync(index.path, 'utf8');
|
|
44
|
+
const start = markdown.indexOf(`<a id="${entry.anchor}"></a>`);
|
|
45
|
+
if (start < 0)
|
|
46
|
+
return undefined;
|
|
47
|
+
const next = markdown.indexOf('<a id="', start + 1);
|
|
48
|
+
return {
|
|
49
|
+
id,
|
|
50
|
+
...entry,
|
|
51
|
+
package: index.package,
|
|
52
|
+
version: index.version,
|
|
53
|
+
path: index.path,
|
|
54
|
+
text: markdown.slice(start, next < 0 ? undefined : next).trim(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../src/contracts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA2B1C,MAAM,EAAE,GAAG,4CAA4C,CAAC;AAExD,wGAAwG;AACxG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAU,EAAsB,EAAE;IAChE,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC,CAAC;AAEF,4GAA4G;AAC5G,MAAM,UAAU,aAAa,CAC3B,WAAmB,EACnB,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;IAEpB,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;IAC1D,IAAI,SAAiB,CAAC;IACtB,IAAI,YAAoB,CAAC;IACzB,IAAI,CAAC;QACH,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,WAAW,iBAAiB,CAAC,CAAC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E,KAAK,GAAG,CAAC,CAAC,CAAC;IACpD,OAAO;QACL,EAAE;QACF,GAAG,KAAK;QACR,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;KAChE,CAAC;AACJ,CAAC"}
|
package/dist/docs.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `docs[*].updated` (metadata-and-analyzer.md §3, "Updated dates"): an authored `@updated` date,
|
|
3
|
+
* or the last commit touching the page's declared source files. Never build time; pages with
|
|
4
|
+
* neither are omitted. Page ids are shared with the Workbench page registry.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExampleInfo } from './examples.js';
|
|
7
|
+
import type { Extraction, SourceLocation } from './extract.js';
|
|
8
|
+
import type { SourceHistory } from './history.js';
|
|
9
|
+
export interface DatedPage {
|
|
10
|
+
/** Stable page id: `components/<tag>`, `foundations/<id>`. */
|
|
11
|
+
readonly page: string;
|
|
12
|
+
/** Library-relative files the page's facts come from. */
|
|
13
|
+
readonly files: readonly string[];
|
|
14
|
+
readonly authored?: {
|
|
15
|
+
readonly value: string;
|
|
16
|
+
readonly source: SourceLocation;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface UpdatedFact {
|
|
20
|
+
readonly value: string;
|
|
21
|
+
readonly provenance: 'authored' | 'extracted';
|
|
22
|
+
readonly source?: SourceLocation;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Each registered element's page and its declared sources in this library: the class and its base
|
|
26
|
+
* classes, the definition and the definitions it recomposes, template, styles, registration
|
|
27
|
+
* module, explicit metadata, and examples.
|
|
28
|
+
*/
|
|
29
|
+
export declare function componentPages(extraction: Extraction, examples: readonly ExampleInfo[]): DatedPage[];
|
|
30
|
+
/** `docs` entries with an `updated` fact, keyed by page id in sorted order. */
|
|
31
|
+
export declare function updatedDocs(pages: readonly DatedPage[], history: SourceHistory | undefined): Record<string, {
|
|
32
|
+
updated: UpdatedFact;
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=docs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../src/docs.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAiB,UAAU,EAAE,cAAc,EAAa,MAAM,cAAc,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAA;KAAE,CAAC;CACjF;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,WAAW,CAAC;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;CAClC;AAKD;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,SAAS,WAAW,EAAE,GAC/B,SAAS,EAAE,CAoCb;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,OAAO,EAAE,aAAa,GAAG,SAAS,GACjC,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC,CAoB1C"}
|
package/dist/docs.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const local = (ref) => ref && !ref.external && !ref.package ? [ref.file] : [];
|
|
2
|
+
/**
|
|
3
|
+
* Each registered element's page and its declared sources in this library: the class and its base
|
|
4
|
+
* classes, the definition and the definitions it recomposes, template, styles, registration
|
|
5
|
+
* module, explicit metadata, and examples.
|
|
6
|
+
*/
|
|
7
|
+
export function componentPages(extraction, examples) {
|
|
8
|
+
const classes = new Map(extraction.components.map((c) => [`${c.file}#${c.name}`, c]));
|
|
9
|
+
const definitions = new Map(extraction.definitions.map((d) => [d.tag, d]));
|
|
10
|
+
return extraction.registrations.map((registration) => {
|
|
11
|
+
const files = new Set([registration.file]);
|
|
12
|
+
let component = classes.get(`${registration.classFile}#${registration.className}`);
|
|
13
|
+
const authored = component?.tags['updated']?.[0];
|
|
14
|
+
// `classes` holds only this library's classes: the chain ends at another package's base.
|
|
15
|
+
while (component) {
|
|
16
|
+
files.add(component.file);
|
|
17
|
+
if (component.authored)
|
|
18
|
+
files.add(component.authored.file);
|
|
19
|
+
const base = component.superclass;
|
|
20
|
+
component = base.file ? classes.get(`${base.file}#${base.name}`) : undefined;
|
|
21
|
+
}
|
|
22
|
+
for (let definition = registration.definition; definition; definition = definition.extends ? definitions.get(definition.extends) : undefined) {
|
|
23
|
+
for (const file of [
|
|
24
|
+
...local(definition.ref),
|
|
25
|
+
...local(definition.template),
|
|
26
|
+
...definition.styles.flatMap(local),
|
|
27
|
+
])
|
|
28
|
+
files.add(file);
|
|
29
|
+
}
|
|
30
|
+
for (const example of examples)
|
|
31
|
+
if (example.component === registration.tag)
|
|
32
|
+
files.add(example.file);
|
|
33
|
+
return {
|
|
34
|
+
page: `components/${registration.tag}`,
|
|
35
|
+
files: [...files].sort(),
|
|
36
|
+
...(authored ? { authored: { value: authored.value, source: authored.location } } : {}),
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** `docs` entries with an `updated` fact, keyed by page id in sorted order. */
|
|
41
|
+
export function updatedDocs(pages, history) {
|
|
42
|
+
const dates = history?.lastChanged([...new Set(pages.flatMap((p) => p.files))]);
|
|
43
|
+
const docs = {};
|
|
44
|
+
for (const page of [...pages].sort((a, b) => (a.page < b.page ? -1 : 1))) {
|
|
45
|
+
if (page.authored) {
|
|
46
|
+
docs[page.page] = {
|
|
47
|
+
updated: {
|
|
48
|
+
value: page.authored.value,
|
|
49
|
+
provenance: 'authored',
|
|
50
|
+
source: page.authored.source,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const latest = page.files
|
|
56
|
+
.map((file) => dates?.get(file) ?? '')
|
|
57
|
+
.reduce((a, b) => (b > a ? b : a), '');
|
|
58
|
+
if (latest)
|
|
59
|
+
docs[page.page] = { updated: { value: latest, provenance: 'extracted' } };
|
|
60
|
+
}
|
|
61
|
+
return docs;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=docs.js.map
|
package/dist/docs.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs.js","sourceRoot":"","sources":["../src/docs.ts"],"names":[],"mappings":"AAuBA,MAAM,KAAK,GAAG,CAAC,GAA0B,EAAE,EAAE,CAC3C,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAEzD;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,UAAsB,EACtB,QAAgC;IAEhC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;gBAChB,OAAO,EAAE;oBACP,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK;oBAC1B,UAAU,EAAE,UAAU;oBACtB,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;iBAC7B;aACF,CAAC;YACF,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK;aACtB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aACrC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,MAAM;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC;IACxF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/emit.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outputs: a standard Custom Elements Manifest (custom-elements-manifest@2.1.0) and the
|
|
3
|
+
* Oddkin enrichment manifest (`oddkin.metadata.json`, schema v1) that references CEM
|
|
4
|
+
* declarations by module path and name. Deterministic: no timestamps, stable ordering.
|
|
5
|
+
*/
|
|
6
|
+
import type { AnalyzerDiagnostic, Extraction } from './extract.js';
|
|
7
|
+
export interface ModulePaths {
|
|
8
|
+
/** Map a source path (relative to the package root) to its published module path. */
|
|
9
|
+
readonly moduleOf: (sourceFile: string) => string;
|
|
10
|
+
/** Map a published module path to a package export specifier, when one exists. */
|
|
11
|
+
readonly specifierOf: (modulePath: string) => string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface LibraryInfo {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly version: string;
|
|
16
|
+
readonly prefix?: string;
|
|
17
|
+
readonly packages: ReadonlyArray<{
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly version: string;
|
|
20
|
+
readonly customElements?: string;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Category records from the `@category` tags of registered components: the label is the first
|
|
25
|
+
* spelling in tag order, and a different spelling of the same id is reported, not merged.
|
|
26
|
+
*/
|
|
27
|
+
export declare function categoryRecords(extraction: Extraction): {
|
|
28
|
+
readonly categories: Record<string, {
|
|
29
|
+
label: string;
|
|
30
|
+
}>;
|
|
31
|
+
readonly diagnostics: AnalyzerDiagnostic[];
|
|
32
|
+
};
|
|
33
|
+
export declare function buildManifest(extraction: Extraction, paths: ModulePaths): Record<string, unknown>;
|
|
34
|
+
export declare function buildMetadata(extraction: Extraction, paths: ModulePaths, library: LibraryInfo, oddkinVersion: string): Record<string, unknown>;
|
|
35
|
+
export declare function sortDiagnostics(diagnostics: readonly AnalyzerDiagnostic[]): AnalyzerDiagnostic[];
|
|
36
|
+
/** Stable JSON text: two-space indentation and a trailing newline. */
|
|
37
|
+
export declare const stableJson: (value: unknown) => string;
|
|
38
|
+
//# sourceMappingURL=emit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../src/emit.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,kBAAkB,EAIlB,UAAU,EAIX,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,WAAW;IAC1B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAA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