@dep-radius/core 0.1.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 +48 -0
- package/dist/analyze/brief.d.ts +18 -0
- package/dist/analyze/brief.d.ts.map +1 -0
- package/dist/analyze/brief.js +89 -0
- package/dist/analyze/verdict.d.ts +16 -0
- package/dist/analyze/verdict.d.ts.map +1 -0
- package/dist/analyze/verdict.js +134 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +36 -0
- package/dist/debug.d.ts +2 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/debug.js +130 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/infra/cache.d.ts +18 -0
- package/dist/infra/cache.d.ts.map +1 -0
- package/dist/infra/cache.js +66 -0
- package/dist/infra/hash.d.ts +4 -0
- package/dist/infra/hash.d.ts.map +1 -0
- package/dist/infra/hash.js +18 -0
- package/dist/infra/http.d.ts +24 -0
- package/dist/infra/http.d.ts.map +1 -0
- package/dist/infra/http.js +44 -0
- package/dist/infra/limit.d.ts +4 -0
- package/dist/infra/limit.d.ts.map +1 -0
- package/dist/infra/limit.js +34 -0
- package/dist/infra/log.d.ts +8 -0
- package/dist/infra/log.d.ts.map +1 -0
- package/dist/infra/log.js +13 -0
- package/dist/inventory/installed.d.ts +15 -0
- package/dist/inventory/installed.d.ts.map +1 -0
- package/dist/inventory/installed.js +241 -0
- package/dist/inventory/lockfiles/bun.d.ts +3 -0
- package/dist/inventory/lockfiles/bun.d.ts.map +1 -0
- package/dist/inventory/lockfiles/bun.js +24 -0
- package/dist/inventory/lockfiles/npm.d.ts +3 -0
- package/dist/inventory/lockfiles/npm.d.ts.map +1 -0
- package/dist/inventory/lockfiles/npm.js +29 -0
- package/dist/inventory/lockfiles/pnpm.d.ts +3 -0
- package/dist/inventory/lockfiles/pnpm.d.ts.map +1 -0
- package/dist/inventory/lockfiles/pnpm.js +84 -0
- package/dist/inventory/lockfiles/types.d.ts +9 -0
- package/dist/inventory/lockfiles/types.d.ts.map +1 -0
- package/dist/inventory/lockfiles/types.js +1 -0
- package/dist/inventory/lockfiles/yarn.d.ts +3 -0
- package/dist/inventory/lockfiles/yarn.d.ts.map +1 -0
- package/dist/inventory/lockfiles/yarn.js +46 -0
- package/dist/inventory/manifests.d.ts +9 -0
- package/dist/inventory/manifests.d.ts.map +1 -0
- package/dist/inventory/manifests.js +135 -0
- package/dist/inventory/specifiers.d.ts +8 -0
- package/dist/inventory/specifiers.d.ts.map +1 -0
- package/dist/inventory/specifiers.js +53 -0
- package/dist/labels.d.ts +2 -0
- package/dist/labels.d.ts.map +1 -0
- package/dist/labels.js +18 -0
- package/dist/model.d.ts +276 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +2 -0
- package/dist/notes/changelog.d.ts +11 -0
- package/dist/notes/changelog.d.ts.map +1 -0
- package/dist/notes/changelog.js +60 -0
- package/dist/notes/collect.d.ts +13 -0
- package/dist/notes/collect.d.ts.map +1 -0
- package/dist/notes/collect.js +225 -0
- package/dist/notes/entries.d.ts +3 -0
- package/dist/notes/entries.d.ts.map +1 -0
- package/dist/notes/entries.js +209 -0
- package/dist/notes/github.d.ts +25 -0
- package/dist/notes/github.d.ts.map +1 -0
- package/dist/notes/github.js +132 -0
- package/dist/notes/match.d.ts +13 -0
- package/dist/notes/match.d.ts.map +1 -0
- package/dist/notes/match.js +75 -0
- package/dist/notes/repo-url.d.ts +9 -0
- package/dist/notes/repo-url.d.ts.map +1 -0
- package/dist/notes/repo-url.js +46 -0
- package/dist/options.d.ts +53 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +27 -0
- package/dist/registry/candidates.d.ts +24 -0
- package/dist/registry/candidates.d.ts.map +1 -0
- package/dist/registry/candidates.js +139 -0
- package/dist/registry/npmrc.d.ts +13 -0
- package/dist/registry/npmrc.d.ts.map +1 -0
- package/dist/registry/npmrc.js +99 -0
- package/dist/registry/packument.d.ts +34 -0
- package/dist/registry/packument.d.ts.map +1 -0
- package/dist/registry/packument.js +85 -0
- package/dist/registry/tar.d.ts +2 -0
- package/dist/registry/tar.d.ts.map +1 -0
- package/dist/registry/tar.js +75 -0
- package/dist/registry/tarball.d.ts +16 -0
- package/dist/registry/tarball.d.ts.map +1 -0
- package/dist/registry/tarball.js +59 -0
- package/dist/render/groups.d.ts +16 -0
- package/dist/render/groups.d.ts.map +1 -0
- package/dist/render/groups.js +105 -0
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +3 -0
- package/dist/render/json.d.ts +119 -0
- package/dist/render/json.d.ts.map +1 -0
- package/dist/render/json.js +130 -0
- package/dist/render/limits.d.ts +3 -0
- package/dist/render/limits.d.ts.map +1 -0
- package/dist/render/limits.js +25 -0
- package/dist/render/markdown.d.ts +3 -0
- package/dist/render/markdown.d.ts.map +1 -0
- package/dist/render/markdown.js +62 -0
- package/dist/run.d.ts +10 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +218 -0
- package/dist/surface/analyze.d.ts +13 -0
- package/dist/surface/analyze.d.ts.map +1 -0
- package/dist/surface/analyze.js +166 -0
- package/dist/surface/delta.d.ts +5 -0
- package/dist/surface/delta.d.ts.map +1 -0
- package/dist/surface/delta.js +173 -0
- package/dist/surface/entries.d.ts +16 -0
- package/dist/surface/entries.d.ts.map +1 -0
- package/dist/surface/entries.js +187 -0
- package/dist/surface/extract.d.ts +15 -0
- package/dist/surface/extract.d.ts.map +1 -0
- package/dist/surface/extract.js +460 -0
- package/dist/surface/signature.d.ts +6 -0
- package/dist/surface/signature.d.ts.map +1 -0
- package/dist/surface/signature.js +229 -0
- package/dist/surface/vfs-host.d.ts +5 -0
- package/dist/surface/vfs-host.d.ts.map +1 -0
- package/dist/surface/vfs-host.js +54 -0
- package/dist/symbol-path.d.ts +28 -0
- package/dist/symbol-path.d.ts.map +1 -0
- package/dist/symbol-path.js +223 -0
- package/dist/usage/files.d.ts +18 -0
- package/dist/usage/files.d.ts.map +1 -0
- package/dist/usage/files.js +83 -0
- package/dist/usage/link.d.ts +23 -0
- package/dist/usage/link.d.ts.map +1 -0
- package/dist/usage/link.js +588 -0
- package/dist/usage/opaque.d.ts +7 -0
- package/dist/usage/opaque.d.ts.map +1 -0
- package/dist/usage/opaque.js +193 -0
- package/dist/usage/parse.d.ts +73 -0
- package/dist/usage/parse.d.ts.map +1 -0
- package/dist/usage/parse.js +608 -0
- package/dist/usage/resolve-local.d.ts +35 -0
- package/dist/usage/resolve-local.d.ts.map +1 -0
- package/dist/usage/resolve-local.js +340 -0
- package/dist/usage/scan.d.ts +4 -0
- package/dist/usage/scan.d.ts.map +1 -0
- package/dist/usage/scan.js +92 -0
- package/package.json +79 -0
- package/schema/brief-v1.schema.json +319 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Manifest } from "../model.ts";
|
|
2
|
+
export declare const SKIP_DIRS: Set<string>;
|
|
3
|
+
export declare function gitFiles(root: string): Promise<string[] | undefined>;
|
|
4
|
+
export declare function walkFiles(root: string, accept: (rel: string) => boolean, limit?: number): Promise<string[]>;
|
|
5
|
+
export declare function listProjectFiles(root: string): Promise<string[]>;
|
|
6
|
+
export declare function findManifests(root: string, files: string[]): Promise<Manifest[]>;
|
|
7
|
+
export declare function toManifest(abs: string, json: Record<string, unknown>): Manifest;
|
|
8
|
+
export declare function relPath(root: string, abs: string): string;
|
|
9
|
+
//# sourceMappingURL=manifests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifests.d.ts","sourceRoot":"","sources":["../../src/inventory/manifests.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKlE,eAAO,MAAM,SAAS,aAkBpB,CAAA;AASF,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CAc1E;AAED,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,EAChC,KAAK,SAAU,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAqBnB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAOtE;AAED,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,GACd,OAAO,CAAC,QAAQ,EAAE,CAAC,CAgBrB;AAED,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,QAAQ,CAsCV;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGzD"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { promisify } from "node:util";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { readdir, readFile } from "node:fs/promises";
|
|
4
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
5
|
+
import { classifySpec } from "./specifiers.js";
|
|
6
|
+
const run = promisify(execFile);
|
|
7
|
+
// Folders that hold output or third party code, never a manifest someone wrote.
|
|
8
|
+
export const SKIP_DIRS = new Set([
|
|
9
|
+
"node_modules",
|
|
10
|
+
".git",
|
|
11
|
+
".next",
|
|
12
|
+
".nuxt",
|
|
13
|
+
".output",
|
|
14
|
+
".svelte-kit",
|
|
15
|
+
".turbo",
|
|
16
|
+
".vercel",
|
|
17
|
+
".cache",
|
|
18
|
+
".parcel-cache",
|
|
19
|
+
".yarn",
|
|
20
|
+
"dist",
|
|
21
|
+
"build",
|
|
22
|
+
"out",
|
|
23
|
+
"coverage",
|
|
24
|
+
"bower_components",
|
|
25
|
+
"jspm_packages",
|
|
26
|
+
]);
|
|
27
|
+
const FIELDS = [
|
|
28
|
+
"dependencies",
|
|
29
|
+
"devDependencies",
|
|
30
|
+
"optionalDependencies",
|
|
31
|
+
"peerDependencies",
|
|
32
|
+
];
|
|
33
|
+
export async function gitFiles(root) {
|
|
34
|
+
try {
|
|
35
|
+
const { stdout } = await run("git", ["ls-files", "-co", "--exclude-standard", "-z"], {
|
|
36
|
+
cwd: root,
|
|
37
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
38
|
+
});
|
|
39
|
+
return stdout.split("\0").filter(Boolean);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export async function walkFiles(root, accept, limit = 200_000) {
|
|
46
|
+
const out = [];
|
|
47
|
+
const stack = [""];
|
|
48
|
+
while (stack.length > 0 && out.length < limit) {
|
|
49
|
+
const rel = stack.pop();
|
|
50
|
+
let entries;
|
|
51
|
+
try {
|
|
52
|
+
entries = await readdir(join(root, rel), { withFileTypes: true });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
for (const e of entries) {
|
|
58
|
+
const childRel = rel ? `${rel}/${e.name}` : e.name;
|
|
59
|
+
if (e.isDirectory()) {
|
|
60
|
+
if (!SKIP_DIRS.has(e.name))
|
|
61
|
+
stack.push(childRel);
|
|
62
|
+
}
|
|
63
|
+
else if (e.isFile() && accept(childRel)) {
|
|
64
|
+
out.push(childRel);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return out.sort();
|
|
69
|
+
}
|
|
70
|
+
export async function listProjectFiles(root) {
|
|
71
|
+
const git = await gitFiles(root);
|
|
72
|
+
if (git)
|
|
73
|
+
return git
|
|
74
|
+
.filter((f) => !f.split("/").some((seg) => seg === "node_modules"))
|
|
75
|
+
.sort();
|
|
76
|
+
return walkFiles(root, () => true);
|
|
77
|
+
}
|
|
78
|
+
export async function findManifests(root, files) {
|
|
79
|
+
const paths = files.filter((f) => f === "package.json" || f.endsWith("/package.json"));
|
|
80
|
+
const manifests = [];
|
|
81
|
+
for (const rel of paths) {
|
|
82
|
+
const abs = join(root, rel);
|
|
83
|
+
let json;
|
|
84
|
+
try {
|
|
85
|
+
json = JSON.parse(await readFile(abs, "utf8"));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
manifests.push(toManifest(abs, json));
|
|
91
|
+
}
|
|
92
|
+
return manifests;
|
|
93
|
+
}
|
|
94
|
+
export function toManifest(abs, json) {
|
|
95
|
+
const deps = [];
|
|
96
|
+
for (const field of FIELDS) {
|
|
97
|
+
const block = json[field];
|
|
98
|
+
if (!block || typeof block !== "object")
|
|
99
|
+
continue;
|
|
100
|
+
for (const [key, spec] of Object.entries(block)) {
|
|
101
|
+
if (typeof spec !== "string")
|
|
102
|
+
continue;
|
|
103
|
+
const c = classifySpec(spec);
|
|
104
|
+
deps.push({
|
|
105
|
+
key,
|
|
106
|
+
spec,
|
|
107
|
+
field,
|
|
108
|
+
specKind: c.kind,
|
|
109
|
+
...(c.aliasOf ? { aliasOf: c.aliasOf } : {}),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
path: abs,
|
|
115
|
+
dir: dirname(abs),
|
|
116
|
+
name: typeof json.name === "string" ? json.name : undefined,
|
|
117
|
+
private: json.private === true,
|
|
118
|
+
deps,
|
|
119
|
+
scripts: (json.scripts && typeof json.scripts === "object"
|
|
120
|
+
? json.scripts
|
|
121
|
+
: {}),
|
|
122
|
+
exports: json.exports,
|
|
123
|
+
main: typeof json.main === "string" ? json.main : undefined,
|
|
124
|
+
module: typeof json.module === "string" ? json.module : undefined,
|
|
125
|
+
types: typeof json.types === "string"
|
|
126
|
+
? json.types
|
|
127
|
+
: typeof json.typings === "string"
|
|
128
|
+
? json.typings
|
|
129
|
+
: undefined,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
export function relPath(root, abs) {
|
|
133
|
+
const r = relative(root, abs);
|
|
134
|
+
return (r || ".").split(sep).join("/");
|
|
135
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpecKind } from "../model.ts";
|
|
2
|
+
export declare function classifySpec(spec: string): {
|
|
3
|
+
kind: SpecKind;
|
|
4
|
+
aliasOf?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function packageNameOf(specifier: string): string | undefined;
|
|
7
|
+
export declare function subpathOf(specifier: string, pkg: string): string;
|
|
8
|
+
//# sourceMappingURL=specifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"specifiers.d.ts","sourceRoot":"","sources":["../../src/inventory/specifiers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAE3C,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAC1C,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CA6BA;AAGD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAenE;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import semver from "semver";
|
|
2
|
+
export function classifySpec(spec) {
|
|
3
|
+
const s = spec.trim();
|
|
4
|
+
if (s.startsWith("workspace:"))
|
|
5
|
+
return { kind: "workspace" };
|
|
6
|
+
if (s.startsWith("catalog:"))
|
|
7
|
+
return { kind: "catalog" };
|
|
8
|
+
if (s.startsWith("link:"))
|
|
9
|
+
return { kind: "link" };
|
|
10
|
+
if (s.startsWith("file:") ||
|
|
11
|
+
s.startsWith("./") ||
|
|
12
|
+
s.startsWith("../") ||
|
|
13
|
+
s.startsWith("/") ||
|
|
14
|
+
s.startsWith("~/"))
|
|
15
|
+
return { kind: "file" };
|
|
16
|
+
if (s.startsWith("npm:")) {
|
|
17
|
+
const rest = s.slice(4);
|
|
18
|
+
const at = rest.lastIndexOf("@");
|
|
19
|
+
return { kind: "alias", aliasOf: at > 0 ? rest.slice(0, at) : rest };
|
|
20
|
+
}
|
|
21
|
+
if (/^(git\+|git:|github:|gitlab:|bitbucket:)/.test(s) ||
|
|
22
|
+
/^[\w-]+\/[\w.-]+(#.*)?$/.test(s))
|
|
23
|
+
return { kind: "git" };
|
|
24
|
+
if (/^https?:/.test(s))
|
|
25
|
+
return { kind: "url" };
|
|
26
|
+
if (s === "" || s === "*" || s === "latest" || semver.validRange(s)) {
|
|
27
|
+
return { kind: s === "latest" ? "tag" : "range" };
|
|
28
|
+
}
|
|
29
|
+
if (/^[a-z][\w.-]*$/i.test(s))
|
|
30
|
+
return { kind: "tag" };
|
|
31
|
+
return { kind: "range" };
|
|
32
|
+
}
|
|
33
|
+
// "lib/locales" -> lib ; "@scope/name/sub" -> @scope/name ; relative or node: -> undefined
|
|
34
|
+
export function packageNameOf(specifier) {
|
|
35
|
+
if (!specifier ||
|
|
36
|
+
specifier.startsWith(".") ||
|
|
37
|
+
specifier.startsWith("/") ||
|
|
38
|
+
specifier.startsWith("#"))
|
|
39
|
+
return undefined;
|
|
40
|
+
if (/^[a-z]+:/i.test(specifier))
|
|
41
|
+
return undefined;
|
|
42
|
+
const parts = specifier.split("/");
|
|
43
|
+
if (specifier.startsWith("@")) {
|
|
44
|
+
if (parts.length < 2 || !parts[1])
|
|
45
|
+
return undefined;
|
|
46
|
+
return `${parts[0]}/${parts[1]}`;
|
|
47
|
+
}
|
|
48
|
+
return parts[0];
|
|
49
|
+
}
|
|
50
|
+
export function subpathOf(specifier, pkg) {
|
|
51
|
+
const rest = specifier.slice(pkg.length);
|
|
52
|
+
return rest ? `.${rest}` : ".";
|
|
53
|
+
}
|
package/dist/labels.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgB/C,CAAA"}
|
package/dist/labels.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Plain words for the kinds of things radius cannot see, shared by the verdict and the renderers.
|
|
2
|
+
export const UNSEEN_LABEL = {
|
|
3
|
+
"side-effect-import": "imported for side effects",
|
|
4
|
+
"config-reference": "named in a config file",
|
|
5
|
+
"script-bin": "run from scripts",
|
|
6
|
+
"css-import": "imported from CSS",
|
|
7
|
+
"convention-framework": "a framework used through file conventions",
|
|
8
|
+
"ambient-types": "ambient types",
|
|
9
|
+
"namespace-escape": "passed around as a whole",
|
|
10
|
+
"computed-member": "read with computed keys",
|
|
11
|
+
"dynamic-import-escape": "loaded with import() and passed on",
|
|
12
|
+
"prefix-dynamic-import": "loaded by a computed subpath",
|
|
13
|
+
"public-reexport": "re-exported to your own consumers",
|
|
14
|
+
"unresolved-local-import": "reached through imports that did not resolve",
|
|
15
|
+
"derived-escape": "values passed through too many files",
|
|
16
|
+
"unparseable-file": "used in files that did not parse",
|
|
17
|
+
"unresolved-against-surface": "names not found in its types",
|
|
18
|
+
};
|
package/dist/model.d.ts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
export type VersionSource = "node_modules" | "lockfile:npm" | "lockfile:pnpm" | "lockfile:yarn" | "lockfile:bun" | "manifest-range";
|
|
2
|
+
export type DepField = "dependencies" | "devDependencies" | "optionalDependencies" | "peerDependencies";
|
|
3
|
+
export type SpecKind = "range" | "tag" | "alias" | "workspace" | "catalog" | "link" | "file" | "git" | "url";
|
|
4
|
+
export interface DeclaredDep {
|
|
5
|
+
key: string;
|
|
6
|
+
spec: string;
|
|
7
|
+
field: DepField;
|
|
8
|
+
specKind: SpecKind;
|
|
9
|
+
aliasOf?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Manifest {
|
|
12
|
+
path: string;
|
|
13
|
+
dir: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
private: boolean;
|
|
16
|
+
deps: DeclaredDep[];
|
|
17
|
+
scripts: Record<string, string>;
|
|
18
|
+
exports?: unknown;
|
|
19
|
+
main?: string;
|
|
20
|
+
module?: string;
|
|
21
|
+
types?: string;
|
|
22
|
+
}
|
|
23
|
+
export type InstalledFlag = "alias" | "patched" | "not-in-registry" | "prerelease-installed" | "range-guess";
|
|
24
|
+
export interface InstalledDep {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
version: string;
|
|
28
|
+
versionSource: VersionSource;
|
|
29
|
+
dir?: string;
|
|
30
|
+
local: boolean;
|
|
31
|
+
declaredBy: {
|
|
32
|
+
manifest: string;
|
|
33
|
+
key: string;
|
|
34
|
+
field: DepField;
|
|
35
|
+
}[];
|
|
36
|
+
flags: InstalledFlag[];
|
|
37
|
+
}
|
|
38
|
+
export interface NotAnalyzed {
|
|
39
|
+
pkg: string;
|
|
40
|
+
reason: string;
|
|
41
|
+
}
|
|
42
|
+
export interface Inventory {
|
|
43
|
+
root: string;
|
|
44
|
+
manifests: Manifest[];
|
|
45
|
+
installed: InstalledDep[];
|
|
46
|
+
local: string[];
|
|
47
|
+
notAnalyzed: NotAnalyzed[];
|
|
48
|
+
}
|
|
49
|
+
export type Bump = "major" | "minor" | "patch";
|
|
50
|
+
export interface Candidate {
|
|
51
|
+
pkg: string;
|
|
52
|
+
from: string;
|
|
53
|
+
to: string;
|
|
54
|
+
bump: Bump;
|
|
55
|
+
publishedAt: string;
|
|
56
|
+
range: string[];
|
|
57
|
+
skippedNewer: {
|
|
58
|
+
version: string;
|
|
59
|
+
reason: "too-new" | "deprecated" | "above-dist-tag";
|
|
60
|
+
publishedAt?: string;
|
|
61
|
+
}[];
|
|
62
|
+
alsoAvailable?: {
|
|
63
|
+
version: string;
|
|
64
|
+
bump: Bump;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface ChainSeg {
|
|
68
|
+
name: string;
|
|
69
|
+
call: boolean;
|
|
70
|
+
construct?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface Site {
|
|
73
|
+
file: string;
|
|
74
|
+
line: number;
|
|
75
|
+
col: number;
|
|
76
|
+
typeOnly: boolean;
|
|
77
|
+
text: string;
|
|
78
|
+
via?: string[];
|
|
79
|
+
}
|
|
80
|
+
export type Binding = {
|
|
81
|
+
kind: "named";
|
|
82
|
+
imported: string;
|
|
83
|
+
} | {
|
|
84
|
+
kind: "namespace";
|
|
85
|
+
} | {
|
|
86
|
+
kind: "default";
|
|
87
|
+
} | {
|
|
88
|
+
kind: "cjs";
|
|
89
|
+
} | {
|
|
90
|
+
kind: "derived";
|
|
91
|
+
};
|
|
92
|
+
export interface RefOrigin {
|
|
93
|
+
binding: Exclude<Binding, {
|
|
94
|
+
kind: "derived";
|
|
95
|
+
}>;
|
|
96
|
+
entry: string;
|
|
97
|
+
chain: ChainSeg[];
|
|
98
|
+
callSelf: boolean;
|
|
99
|
+
}
|
|
100
|
+
export interface RawRef {
|
|
101
|
+
installedId: string;
|
|
102
|
+
pkg: string;
|
|
103
|
+
specifier: string;
|
|
104
|
+
entry: string;
|
|
105
|
+
binding: Binding;
|
|
106
|
+
chain: ChainSeg[];
|
|
107
|
+
callSelf: boolean;
|
|
108
|
+
site: Site;
|
|
109
|
+
origin?: RefOrigin;
|
|
110
|
+
}
|
|
111
|
+
export type OpaqueKind = "side-effect-import" | "config-reference" | "script-bin" | "css-import" | "convention-framework" | "ambient-types";
|
|
112
|
+
export type BlindSpotKind = "namespace-escape" | "computed-member" | "dynamic-import-escape" | "prefix-dynamic-import" | "public-reexport" | "unresolved-local-import" | "derived-escape" | "unparseable-file" | "unresolved-against-surface";
|
|
113
|
+
export type GlobalBlindSpotKind = "dynamic-import-nonliteral" | "require-nonliteral" | "skipped-generated" | "unparseable-file";
|
|
114
|
+
export interface Counted<K extends string> {
|
|
115
|
+
kind: K;
|
|
116
|
+
count: number;
|
|
117
|
+
examples: Site[];
|
|
118
|
+
}
|
|
119
|
+
export interface PackageUsage {
|
|
120
|
+
installedId: string;
|
|
121
|
+
pkg: string;
|
|
122
|
+
refs: RawRef[];
|
|
123
|
+
strongNames: string[];
|
|
124
|
+
weakNames: string[];
|
|
125
|
+
files: number;
|
|
126
|
+
opaque: Counted<OpaqueKind>[];
|
|
127
|
+
blindSpots: Counted<BlindSpotKind>[];
|
|
128
|
+
}
|
|
129
|
+
export interface UsageMap {
|
|
130
|
+
scannedFiles: number;
|
|
131
|
+
packages: Record<string, PackageUsage>;
|
|
132
|
+
global: Counted<GlobalBlindSpotKind>[];
|
|
133
|
+
}
|
|
134
|
+
export type CanonPath = string;
|
|
135
|
+
export type SymbolKind = "function" | "class" | "interface" | "type" | "variable" | "enum" | "enum-member" | "namespace" | "member" | "static-member";
|
|
136
|
+
export interface SurfaceSymbol {
|
|
137
|
+
path: CanonPath;
|
|
138
|
+
kind: SymbolKind;
|
|
139
|
+
sig: string[];
|
|
140
|
+
deprecated: boolean;
|
|
141
|
+
returns?: CanonPath;
|
|
142
|
+
instanceOf?: CanonPath;
|
|
143
|
+
aliasOf?: CanonPath;
|
|
144
|
+
}
|
|
145
|
+
export type SurfaceFlag = "wildcard-truncated" | "symbol-cap" | "external-types-unresolved";
|
|
146
|
+
export interface Surface {
|
|
147
|
+
pkg: string;
|
|
148
|
+
version: string;
|
|
149
|
+
integrity: string;
|
|
150
|
+
ts: string;
|
|
151
|
+
algo: number;
|
|
152
|
+
typesFrom: "package" | "@types";
|
|
153
|
+
entries: Record<string, {
|
|
154
|
+
typesFile: string;
|
|
155
|
+
exportEquals: boolean;
|
|
156
|
+
externalReexports?: string[];
|
|
157
|
+
}>;
|
|
158
|
+
symbols: Record<CanonPath, SurfaceSymbol>;
|
|
159
|
+
flags: SurfaceFlag[];
|
|
160
|
+
}
|
|
161
|
+
export interface SurfaceChange {
|
|
162
|
+
path: CanonPath;
|
|
163
|
+
kind: SymbolKind;
|
|
164
|
+
before?: string[];
|
|
165
|
+
after?: string[];
|
|
166
|
+
alsoAt: CanonPath[];
|
|
167
|
+
}
|
|
168
|
+
export interface SurfaceDelta {
|
|
169
|
+
removed: SurfaceChange[];
|
|
170
|
+
changed: SurfaceChange[];
|
|
171
|
+
deprecated: SurfaceChange[];
|
|
172
|
+
widened: SurfaceChange[];
|
|
173
|
+
added: SurfaceChange[];
|
|
174
|
+
}
|
|
175
|
+
export type NoteSourceKind = "tarball-changelog" | "github-release" | "repo-changelog";
|
|
176
|
+
export interface VersionNotes {
|
|
177
|
+
version: string;
|
|
178
|
+
status: "found" | "not-published" | "unavailable";
|
|
179
|
+
source?: {
|
|
180
|
+
kind: NoteSourceKind;
|
|
181
|
+
url: string;
|
|
182
|
+
};
|
|
183
|
+
reason?: "offline" | "rate-limited" | "no-repo" | "unsupported-host" | "http-error" | "stub-body";
|
|
184
|
+
}
|
|
185
|
+
export type RegionKind = "title" | "prose" | "inline-code" | "code-block";
|
|
186
|
+
export interface NoteEntry {
|
|
187
|
+
id: string;
|
|
188
|
+
version: string;
|
|
189
|
+
title: string;
|
|
190
|
+
headingPath: string[];
|
|
191
|
+
regions: {
|
|
192
|
+
kind: RegionKind;
|
|
193
|
+
text: string;
|
|
194
|
+
}[];
|
|
195
|
+
breakingMarker: boolean;
|
|
196
|
+
noise: boolean;
|
|
197
|
+
refs: string[];
|
|
198
|
+
}
|
|
199
|
+
export interface NoteHit {
|
|
200
|
+
name: string;
|
|
201
|
+
strength: "strong" | "weak";
|
|
202
|
+
region: RegionKind;
|
|
203
|
+
}
|
|
204
|
+
export interface NoteMatch {
|
|
205
|
+
entry: NoteEntry;
|
|
206
|
+
hits: NoteHit[];
|
|
207
|
+
direct: boolean;
|
|
208
|
+
}
|
|
209
|
+
export type NotesCoverage = "complete" | "partial" | "none-published" | "unavailable" | "disabled";
|
|
210
|
+
export type Verdict = "quiet" | "review" | "blocked";
|
|
211
|
+
export type ReasonCode = "removed-touched" | "changed-touched" | "deprecated-touched" | "possibly-touched" | "notes-match" | "unattributed-breaking" | "blind-spots" | "opaque-usage" | "not-referenced" | "flagged-install" | "surface-incomplete" | "no-evidence" | "major-unproven" | "notes-complete-no-match" | "surface-clean" | "caveat-no-types" | "caveat-no-notes";
|
|
212
|
+
export interface VerdictReason {
|
|
213
|
+
code: ReasonCode;
|
|
214
|
+
detail: string;
|
|
215
|
+
}
|
|
216
|
+
export interface Touched {
|
|
217
|
+
change: SurfaceChange;
|
|
218
|
+
bucket: "removed" | "changed" | "deprecated";
|
|
219
|
+
strength: "strong" | "weak";
|
|
220
|
+
sites: Site[];
|
|
221
|
+
}
|
|
222
|
+
export type SurfaceStatus = "computed" | "no-types" | "types-from-@types" | "types-elsewhere" | "failed" | "disabled" | "offline-uncached";
|
|
223
|
+
export interface PackageBrief {
|
|
224
|
+
pkg: string;
|
|
225
|
+
from: string;
|
|
226
|
+
to: string;
|
|
227
|
+
bump: Bump;
|
|
228
|
+
publishedAt: string;
|
|
229
|
+
versionSource: VersionSource;
|
|
230
|
+
manifests: string[];
|
|
231
|
+
level: 0 | 1;
|
|
232
|
+
verdict: Verdict;
|
|
233
|
+
reasons: VerdictReason[];
|
|
234
|
+
surface: {
|
|
235
|
+
status: SurfaceStatus;
|
|
236
|
+
detail?: string;
|
|
237
|
+
changes?: number;
|
|
238
|
+
added?: number;
|
|
239
|
+
touched: Touched[];
|
|
240
|
+
};
|
|
241
|
+
notes: {
|
|
242
|
+
coverage: NotesCoverage;
|
|
243
|
+
perVersion: VersionNotes[];
|
|
244
|
+
total: number;
|
|
245
|
+
matched: NoteMatch[];
|
|
246
|
+
unattributedBreaking: NoteEntry[];
|
|
247
|
+
};
|
|
248
|
+
usage: {
|
|
249
|
+
files: number;
|
|
250
|
+
sites: Site[];
|
|
251
|
+
byName: Record<string, Site[]>;
|
|
252
|
+
strongNames: string[];
|
|
253
|
+
weakNames: string[];
|
|
254
|
+
opaque: Counted<OpaqueKind>[];
|
|
255
|
+
blindSpots: Counted<BlindSpotKind>[];
|
|
256
|
+
};
|
|
257
|
+
skippedNewer: Candidate["skippedNewer"];
|
|
258
|
+
alsoAvailable?: Candidate["alsoAvailable"];
|
|
259
|
+
}
|
|
260
|
+
export interface Brief {
|
|
261
|
+
schemaVersion: 1;
|
|
262
|
+
tool: {
|
|
263
|
+
version: string;
|
|
264
|
+
typescript: string;
|
|
265
|
+
};
|
|
266
|
+
root: string;
|
|
267
|
+
generatedAt: string;
|
|
268
|
+
manifests: number;
|
|
269
|
+
packages: PackageBrief[];
|
|
270
|
+
upToDate: number;
|
|
271
|
+
notAnalyzed: NotAnalyzed[];
|
|
272
|
+
global: Counted<GlobalBlindSpotKind>[];
|
|
273
|
+
limits: string[];
|
|
274
|
+
exitCode: 0 | 1 | 2;
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GACrB,cAAc,GACd,cAAc,GACd,eAAe,GACf,eAAe,GACf,cAAc,GACd,gBAAgB,CAAA;AAEpB,MAAM,MAAM,QAAQ,GAChB,cAAc,GACd,iBAAiB,GACjB,sBAAsB,GACtB,kBAAkB,CAAA;AAEtB,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,KAAK,GACL,OAAO,GACP,WAAW,GACX,SAAS,GACT,MAAM,GACN,MAAM,GACN,KAAK,GACL,KAAK,CAAA;AAET,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,QAAQ,CAAA;IACf,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;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AAE,WAAW,EAAE,CAAA;IAC1B,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAA;IACtC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,QAAQ,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;CACpB"}
|
package/dist/model.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface Heading {
|
|
2
|
+
line: number;
|
|
3
|
+
level: number;
|
|
4
|
+
text: string;
|
|
5
|
+
span: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function headingsOf(lines: string[]): Heading[];
|
|
8
|
+
export declare function versionOfHeading(text: string): string | undefined;
|
|
9
|
+
export declare function changelogSections(text: string): Map<string, string>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=changelog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../src/notes/changelog.ts"],"names":[],"mappings":"AAOA,UAAU,OAAO;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IAEZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CA6BrD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBnE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Splits a changelog file into one body per version. Headings come as ATX (`## 1.2.3`) or setext
|
|
2
|
+
// (`1.2.3 / 2024-11-06` underlined with `===`), and the version sits anywhere in them:
|
|
3
|
+
// `[1.2.3]`, `v1.2.3`, `pkg@1.2.3`, `1.2.3 (2024-01-01)`.
|
|
4
|
+
const VERSION_IN_HEADING = /(?<![\d.])v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?)(?![\d.])/;
|
|
5
|
+
export function headingsOf(lines) {
|
|
6
|
+
const out = [];
|
|
7
|
+
let inFence = false;
|
|
8
|
+
for (let i = 0; i < lines.length; i++) {
|
|
9
|
+
const line = lines[i];
|
|
10
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
11
|
+
inFence = !inFence;
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (inFence)
|
|
15
|
+
continue;
|
|
16
|
+
const atx = /^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(line);
|
|
17
|
+
if (atx?.[1] && atx[2]) {
|
|
18
|
+
out.push({ line: i, level: atx[1].length, text: atx[2], span: 1 });
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const next = lines[i + 1];
|
|
22
|
+
if (next !== undefined &&
|
|
23
|
+
line.trim() &&
|
|
24
|
+
!/^\s*([-*+]|\d+\.)\s/.test(line) &&
|
|
25
|
+
!/^\s{4}/.test(line)) {
|
|
26
|
+
if (/^=+\s*$/.test(next))
|
|
27
|
+
out.push({ line: i, level: 1, text: line.trim(), span: 2 });
|
|
28
|
+
else if (/^-{2,}\s*$/.test(next))
|
|
29
|
+
out.push({ line: i, level: 2, text: line.trim(), span: 2 });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
export function versionOfHeading(text) {
|
|
35
|
+
return VERSION_IN_HEADING.exec(text)?.[1];
|
|
36
|
+
}
|
|
37
|
+
export function changelogSections(text) {
|
|
38
|
+
const lines = text.split(/\r?\n/);
|
|
39
|
+
const headings = headingsOf(lines);
|
|
40
|
+
const sections = new Map();
|
|
41
|
+
for (let h = 0; h < headings.length; h++) {
|
|
42
|
+
const head = headings[h];
|
|
43
|
+
const version = versionOfHeading(head.text);
|
|
44
|
+
if (!version || sections.has(version))
|
|
45
|
+
continue;
|
|
46
|
+
let end = lines.length;
|
|
47
|
+
for (let k = h + 1; k < headings.length; k++) {
|
|
48
|
+
const other = headings[k];
|
|
49
|
+
if (other.level <= head.level || versionOfHeading(other.text)) {
|
|
50
|
+
end = other.line;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
sections.set(version, lines
|
|
55
|
+
.slice(head.line + head.span, end)
|
|
56
|
+
.join("\n")
|
|
57
|
+
.trim());
|
|
58
|
+
}
|
|
59
|
+
return sections;
|
|
60
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Ctx } from "../options.ts";
|
|
2
|
+
import type { Packument } from "../registry/packument.ts";
|
|
3
|
+
import type { RegistryConfig } from "../registry/npmrc.ts";
|
|
4
|
+
import type { Candidate, NoteEntry, NotesCoverage, VersionNotes } from "../model.ts";
|
|
5
|
+
export interface CollectedNotes {
|
|
6
|
+
perVersion: VersionNotes[];
|
|
7
|
+
entries: NoteEntry[];
|
|
8
|
+
coverage: NotesCoverage;
|
|
9
|
+
}
|
|
10
|
+
export declare function collectNotes(ctx: Ctx, cfg: RegistryConfig, p: Packument, c: Candidate): Promise<CollectedNotes>;
|
|
11
|
+
export declare function isPointerOnly(body: string): boolean;
|
|
12
|
+
export declare function prereleasesIn(p: Packument, stable: string[]): string[];
|
|
13
|
+
//# sourceMappingURL=collect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect.d.ts","sourceRoot":"","sources":["../../src/notes/collect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAIxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,aAAa,EAEb,YAAY,EACb,MAAM,aAAa,CAAA;AAUpB,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,OAAO,EAAE,SAAS,EAAE,CAAA;IACpB,QAAQ,EAAE,aAAa,CAAA;CACxB;AAID,wBAAsB,YAAY,CAChC,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,cAAc,EACnB,CAAC,EAAE,SAAS,EACZ,CAAC,EAAE,SAAS,GACX,OAAO,CAAC,cAAc,CAAC,CA4LzB;AAKD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAgBnD;AAMD,wBAAgB,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAYtE"}
|