@component-compass/cli 0.1.23 → 0.1.24
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/dist/cli.js +103503 -104
- package/package.json +21 -25
- package/dist/auth/browser.d.ts +0 -13
- package/dist/auth/browser.js +0 -21
- package/dist/auth/browser.js.map +0 -1
- package/dist/auth/client.d.ts +0 -48
- package/dist/auth/client.js +0 -89
- package/dist/auth/client.js.map +0 -1
- package/dist/auth/paths.d.ts +0 -2
- package/dist/auth/paths.js +0 -14
- package/dist/auth/paths.js.map +0 -1
- package/dist/auth/session.d.ts +0 -38
- package/dist/auth/session.js +0 -88
- package/dist/auth/session.js.map +0 -1
- package/dist/auth/store.d.ts +0 -16
- package/dist/auth/store.js +0 -37
- package/dist/auth/store.js.map +0 -1
- package/dist/auth/upload-auth.d.ts +0 -22
- package/dist/auth/upload-auth.js +0 -51
- package/dist/auth/upload-auth.js.map +0 -1
- package/dist/cli/help.d.ts +0 -4
- package/dist/cli/help.js +0 -52
- package/dist/cli/help.js.map +0 -1
- package/dist/cli/parse.d.ts +0 -14
- package/dist/cli/parse.js +0 -75
- package/dist/cli/parse.js.map +0 -1
- package/dist/cli/suggest.d.ts +0 -4
- package/dist/cli/suggest.js +0 -38
- package/dist/cli/suggest.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -33
- package/dist/commands/auth.js +0 -248
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/init.d.ts +0 -11
- package/dist/commands/init.js +0 -112
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/scan.d.ts +0 -33
- package/dist/commands/scan.js +0 -691
- package/dist/commands/scan.js.map +0 -1
- package/dist/composition-rollup.d.ts +0 -23
- package/dist/composition-rollup.js +0 -64
- package/dist/composition-rollup.js.map +0 -1
- package/dist/config/loader.d.ts +0 -6
- package/dist/config/loader.js +0 -71
- package/dist/config/loader.js.map +0 -1
- package/dist/config/schema.d.ts +0 -18
- package/dist/config/schema.js +0 -15
- package/dist/config/schema.js.map +0 -1
- package/dist/dispatcher.d.ts +0 -8
- package/dist/dispatcher.js +0 -22
- package/dist/dispatcher.js.map +0 -1
- package/dist/envelope/git.d.ts +0 -13
- package/dist/envelope/git.js +0 -69
- package/dist/envelope/git.js.map +0 -1
- package/dist/envelope/index.d.ts +0 -1
- package/dist/envelope/index.js +0 -12
- package/dist/envelope/index.js.map +0 -1
- package/dist/envelope/repo-id.d.ts +0 -16
- package/dist/envelope/repo-id.js +0 -40
- package/dist/envelope/repo-id.js.map +0 -1
- package/dist/identity.d.ts +0 -56
- package/dist/identity.js +0 -115
- package/dist/identity.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +0 -1
- package/dist/local-index/declared-props.d.ts +0 -15
- package/dist/local-index/declared-props.js +0 -101
- package/dist/local-index/declared-props.js.map +0 -1
- package/dist/local-index/detect-react.d.ts +0 -3
- package/dist/local-index/detect-react.js +0 -378
- package/dist/local-index/detect-react.js.map +0 -1
- package/dist/local-index/detect-vue.d.ts +0 -16
- package/dist/local-index/detect-vue.js +0 -284
- package/dist/local-index/detect-vue.js.map +0 -1
- package/dist/local-index/detect-wc.d.ts +0 -8
- package/dist/local-index/detect-wc.js +0 -70
- package/dist/local-index/detect-wc.js.map +0 -1
- package/dist/local-index/index.d.ts +0 -14
- package/dist/local-index/index.js +0 -46
- package/dist/local-index/index.js.map +0 -1
- package/dist/local-index/types.d.ts +0 -2
- package/dist/local-index/types.js +0 -2
- package/dist/local-index/types.js.map +0 -1
- package/dist/manifest/barrel-parser.d.ts +0 -35
- package/dist/manifest/barrel-parser.js +0 -76
- package/dist/manifest/barrel-parser.js.map +0 -1
- package/dist/manifest/lazy-resolver.d.ts +0 -123
- package/dist/manifest/lazy-resolver.js +0 -712
- package/dist/manifest/lazy-resolver.js.map +0 -1
- package/dist/occurrences.d.ts +0 -15
- package/dist/occurrences.js +0 -101
- package/dist/occurrences.js.map +0 -1
- package/dist/parse-by-ext.d.ts +0 -21
- package/dist/parse-by-ext.js +0 -53
- package/dist/parse-by-ext.js.map +0 -1
- package/dist/prompts/adapter.d.ts +0 -43
- package/dist/prompts/adapter.js +0 -32
- package/dist/prompts/adapter.js.map +0 -1
- package/dist/reporter/diagnostic-lines.d.ts +0 -7
- package/dist/reporter/diagnostic-lines.js +0 -40
- package/dist/reporter/diagnostic-lines.js.map +0 -1
- package/dist/reporter/index.d.ts +0 -39
- package/dist/reporter/index.js +0 -144
- package/dist/reporter/index.js.map +0 -1
- package/dist/reporter/json.d.ts +0 -6
- package/dist/reporter/json.js +0 -11
- package/dist/reporter/json.js.map +0 -1
- package/dist/reporter/stdout.d.ts +0 -3
- package/dist/reporter/stdout.js +0 -41
- package/dist/reporter/stdout.js.map +0 -1
- package/dist/rollup.d.ts +0 -26
- package/dist/rollup.js +0 -135
- package/dist/rollup.js.map +0 -1
- package/dist/scan/cem-index.d.ts +0 -38
- package/dist/scan/cem-index.js +0 -139
- package/dist/scan/cem-index.js.map +0 -1
- package/dist/scan/entry-packages.d.ts +0 -42
- package/dist/scan/entry-packages.js +0 -87
- package/dist/scan/entry-packages.js.map +0 -1
- package/dist/scan/framework-root.d.ts +0 -1
- package/dist/scan/framework-root.js +0 -22
- package/dist/scan/framework-root.js.map +0 -1
- package/dist/scan/git-mtime.d.ts +0 -2
- package/dist/scan/git-mtime.js +0 -22
- package/dist/scan/git-mtime.js.map +0 -1
- package/dist/scan/global-components.d.ts +0 -37
- package/dist/scan/global-components.js +0 -228
- package/dist/scan/global-components.js.map +0 -1
- package/dist/scan/meta.d.ts +0 -5
- package/dist/scan/meta.js +0 -58
- package/dist/scan/meta.js.map +0 -1
- package/dist/scan/stamp-version.d.ts +0 -18
- package/dist/scan/stamp-version.js +0 -94
- package/dist/scan/stamp-version.js.map +0 -1
- package/dist/scan/stamp-wraps.d.ts +0 -11
- package/dist/scan/stamp-wraps.js +0 -24
- package/dist/scan/stamp-wraps.js.map +0 -1
- package/dist/scan/wrap-relationships.d.ts +0 -12
- package/dist/scan/wrap-relationships.js +0 -38
- package/dist/scan/wrap-relationships.js.map +0 -1
- package/dist/seeds.d.ts +0 -81
- package/dist/seeds.js +0 -258
- package/dist/seeds.js.map +0 -1
- package/dist/types/brand.d.ts +0 -11
- package/dist/types/brand.js +0 -5
- package/dist/types/brand.js.map +0 -1
- package/dist/types/component-id.d.ts +0 -2
- package/dist/types/component-id.js +0 -2
- package/dist/types/component-id.js.map +0 -1
- package/dist/types.d.ts +0 -13
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/upload.d.ts +0 -18
- package/dist/upload.js +0 -34
- package/dist/upload.js.map +0 -1
- package/dist/util/color.d.ts +0 -24
- package/dist/util/color.js +0 -45
- package/dist/util/color.js.map +0 -1
- package/dist/util/git.d.ts +0 -10
- package/dist/util/git.js +0 -95
- package/dist/util/git.js.map +0 -1
- package/dist/util/interactive.d.ts +0 -17
- package/dist/util/interactive.js +0 -19
- package/dist/util/interactive.js.map +0 -1
- package/dist/util/log.d.ts +0 -9
- package/dist/util/log.js +0 -20
- package/dist/util/log.js.map +0 -1
- package/dist/util/pkg.d.ts +0 -1
- package/dist/util/pkg.js +0 -13
- package/dist/util/pkg.js.map +0 -1
- package/dist/util/pnp-check.d.ts +0 -1
- package/dist/util/pnp-check.js +0 -6
- package/dist/util/pnp-check.js.map +0 -1
- package/dist/util/posix.d.ts +0 -2
- package/dist/util/posix.js +0 -15
- package/dist/util/posix.js.map +0 -1
- package/dist/util/progress.d.ts +0 -21
- package/dist/util/progress.js +0 -54
- package/dist/util/progress.js.map +0 -1
- package/dist/util/version.d.ts +0 -7
- package/dist/util/version.js +0 -13
- package/dist/util/version.js.map +0 -1
- package/dist/walker/bounded-definition-resolver.d.ts +0 -9
- package/dist/walker/bounded-definition-resolver.js +0 -125
- package/dist/walker/bounded-definition-resolver.js.map +0 -1
- package/dist/walker/files.d.ts +0 -7
- package/dist/walker/files.js +0 -24
- package/dist/walker/files.js.map +0 -1
- package/dist/walker/package-alias-layers.d.ts +0 -7
- package/dist/walker/package-alias-layers.js +0 -40
- package/dist/walker/package-alias-layers.js.map +0 -1
- package/dist/walker/resolve-import.d.ts +0 -25
- package/dist/walker/resolve-import.js +0 -243
- package/dist/walker/resolve-import.js.map +0 -1
- package/dist/walker/tsconfig-discovery.d.ts +0 -36
- package/dist/walker/tsconfig-discovery.js +0 -52
- package/dist/walker/tsconfig-discovery.js.map +0 -1
- package/dist/walker/tsconfig-loader.d.ts +0 -35
- package/dist/walker/tsconfig-loader.js +0 -138
- package/dist/walker/tsconfig-loader.js.map +0 -1
- package/dist/walker/workspace-exports.d.ts +0 -3
- package/dist/walker/workspace-exports.js +0 -120
- package/dist/walker/workspace-exports.js.map +0 -1
- package/dist/workspace/build-graph.d.ts +0 -15
- package/dist/workspace/build-graph.js +0 -120
- package/dist/workspace/build-graph.js.map +0 -1
- package/dist/workspace/declared-deps.d.ts +0 -5
- package/dist/workspace/declared-deps.js +0 -42
- package/dist/workspace/declared-deps.js.map +0 -1
- package/dist/workspace/find-owning-package.d.ts +0 -8
- package/dist/workspace/find-owning-package.js +0 -69
- package/dist/workspace/find-owning-package.js.map +0 -1
- package/dist/workspace/find-workspace-root.d.ts +0 -1
- package/dist/workspace/find-workspace-root.js +0 -60
- package/dist/workspace/find-workspace-root.js.map +0 -1
- package/dist/workspace/index.d.ts +0 -4
- package/dist/workspace/index.js +0 -4
- package/dist/workspace/index.js.map +0 -1
- package/dist/workspace/types.d.ts +0 -49
- package/dist/workspace/types.js +0 -13
- package/dist/workspace/types.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@component-compass/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Open-source CLI for measuring design-system component usage across multi-framework consumer repos.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
7
|
"bin": {
|
|
10
8
|
"component-compass": "dist/cli.js"
|
|
11
9
|
},
|
|
@@ -16,50 +14,48 @@
|
|
|
16
14
|
"README.md"
|
|
17
15
|
],
|
|
18
16
|
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
|
-
"import": "./dist/index.js"
|
|
22
|
-
},
|
|
23
17
|
"./package.json": "./package.json",
|
|
24
18
|
"./schema/config.schema.json": "./schema/config.schema.json"
|
|
25
19
|
},
|
|
26
20
|
"scripts": {
|
|
27
|
-
"build": "
|
|
21
|
+
"build": "node scripts/build.mjs",
|
|
28
22
|
"test": "vitest run",
|
|
29
23
|
"test:watch": "vitest",
|
|
30
24
|
"typecheck": "tsc --noEmit",
|
|
31
|
-
"lint": "biome lint src tests",
|
|
32
|
-
"clean": "rm -rf dist .turbo"
|
|
25
|
+
"lint": "biome lint src tests scripts",
|
|
26
|
+
"clean": "rm -rf dist .turbo",
|
|
27
|
+
"smoke": "node scripts/smoke.mjs"
|
|
33
28
|
},
|
|
34
29
|
"dependencies": {
|
|
30
|
+
"@component-compass/ast-utils": "0.1.24",
|
|
31
|
+
"@component-compass/plugin-core": "0.1.24",
|
|
32
|
+
"oxc-parser": "0.130.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
35
|
"@babel/parser": "7.29.3",
|
|
36
36
|
"@babel/types": "7.29.0",
|
|
37
37
|
"@clack/prompts": "^1.5.1",
|
|
38
|
-
"@component-compass/
|
|
39
|
-
"@component-compass/parser-
|
|
40
|
-
"@component-compass/parser-
|
|
41
|
-
"@component-compass/parser-
|
|
42
|
-
"@component-compass/
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
38
|
+
"@component-compass/parser-html": "0.1.24",
|
|
39
|
+
"@component-compass/parser-lit": "0.1.24",
|
|
40
|
+
"@component-compass/parser-react": "0.1.24",
|
|
41
|
+
"@component-compass/parser-vue": "0.1.24",
|
|
42
|
+
"@component-compass/reference-graph": "0.1.24",
|
|
43
|
+
"@oxc-project/types": "0.130.0",
|
|
44
|
+
"@types/js-yaml": "4.0.9",
|
|
45
|
+
"@types/node": "24.12.2",
|
|
46
|
+
"@types/picomatch": "4.0.3",
|
|
45
47
|
"@vue/compiler-sfc": "3.5.33",
|
|
46
48
|
"ajv": "8.20.0",
|
|
49
|
+
"esbuild": "0.28.0",
|
|
47
50
|
"glob": "13.0.6",
|
|
48
51
|
"globby": "16.2.0",
|
|
49
52
|
"js-yaml": "4.2.0",
|
|
50
53
|
"jsonc-parser": "^3.3.1",
|
|
51
|
-
"oxc-parser": "0.130.0",
|
|
52
54
|
"oxc-walker": "1.0.0",
|
|
53
55
|
"parse5": "8.0.1",
|
|
54
56
|
"picomatch": "4.0.4",
|
|
55
|
-
"ulid": "3.0.2"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@oxc-project/types": "0.130.0",
|
|
59
|
-
"@types/js-yaml": "4.0.9",
|
|
60
|
-
"@types/node": "24.12.2",
|
|
61
|
-
"@types/picomatch": "4.0.3",
|
|
62
57
|
"typescript": "5.9.3",
|
|
58
|
+
"ulid": "3.0.2",
|
|
63
59
|
"vitest": "4.1.5"
|
|
64
60
|
},
|
|
65
61
|
"engines": {
|
package/dist/auth/browser.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type SpawnLike = (cmd: string, args: string[], opts: {
|
|
2
|
-
stdio: "ignore";
|
|
3
|
-
detached: boolean;
|
|
4
|
-
}) => {
|
|
5
|
-
on(event: "error", listener: () => void): unknown;
|
|
6
|
-
unref(): void;
|
|
7
|
-
};
|
|
8
|
-
/** Best-effort: open `url` in the user's browser. Never throws; returns whether spawn was attempted. */
|
|
9
|
-
export declare function openBrowser(url: string, deps?: {
|
|
10
|
-
platform?: NodeJS.Platform;
|
|
11
|
-
spawnFn?: SpawnLike;
|
|
12
|
-
}): boolean;
|
|
13
|
-
export {};
|
package/dist/auth/browser.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { spawn } from "node:child_process";
|
|
2
|
-
/** Best-effort: open `url` in the user's browser. Never throws; returns whether spawn was attempted. */
|
|
3
|
-
export function openBrowser(url, deps = {}) {
|
|
4
|
-
const platform = deps.platform ?? process.platform;
|
|
5
|
-
const spawnFn = deps.spawnFn ?? spawn;
|
|
6
|
-
const [cmd, args] = platform === "darwin"
|
|
7
|
-
? ["open", [url]]
|
|
8
|
-
: platform === "win32"
|
|
9
|
-
? ["cmd", ["/c", "start", "", url]]
|
|
10
|
-
: ["xdg-open", [url]];
|
|
11
|
-
try {
|
|
12
|
-
const child = spawnFn(cmd, [...args], { stdio: "ignore", detached: true });
|
|
13
|
-
child.on("error", () => { });
|
|
14
|
-
child.unref();
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=browser.js.map
|
package/dist/auth/browser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/auth/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAQ3C,wGAAwG;AACxG,MAAM,UAAU,WAAW,CACzB,GAAW,EACX,OAA4D,EAAE;IAE9D,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAK,KAA8B,CAAC;IAChE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GACf,QAAQ,KAAK,QAAQ;QACnB,CAAC,CAAE,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAW;QAC5B,CAAC,CAAC,QAAQ,KAAK,OAAO;YACpB,CAAC,CAAE,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,CAAW;YAC9C,CAAC,CAAE,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAW,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3E,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAC5B,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/dist/auth/client.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export type DeviceCodeResponse = {
|
|
2
|
-
deviceCode: string;
|
|
3
|
-
userCode: string;
|
|
4
|
-
verificationUri: string;
|
|
5
|
-
verificationUriComplete: string;
|
|
6
|
-
expiresIn: number;
|
|
7
|
-
interval: number;
|
|
8
|
-
};
|
|
9
|
-
export type TokenPair = {
|
|
10
|
-
accessToken: string;
|
|
11
|
-
refreshToken: string;
|
|
12
|
-
expiresIn: number;
|
|
13
|
-
/** Present on login (`token`), absent on `refresh`. */
|
|
14
|
-
email?: string;
|
|
15
|
-
};
|
|
16
|
-
export type PollResult = {
|
|
17
|
-
kind: "tokens";
|
|
18
|
-
tokens: TokenPair;
|
|
19
|
-
} | {
|
|
20
|
-
kind: "pending";
|
|
21
|
-
} | {
|
|
22
|
-
kind: "slow_down";
|
|
23
|
-
} | {
|
|
24
|
-
kind: "expired";
|
|
25
|
-
} | {
|
|
26
|
-
kind: "denied";
|
|
27
|
-
};
|
|
28
|
-
export type RefreshResult = {
|
|
29
|
-
kind: "tokens";
|
|
30
|
-
tokens: TokenPair;
|
|
31
|
-
} | {
|
|
32
|
-
kind: "terminal";
|
|
33
|
-
error: string;
|
|
34
|
-
} | {
|
|
35
|
-
kind: "transient";
|
|
36
|
-
error: string;
|
|
37
|
-
};
|
|
38
|
-
export declare class AuthHttpError extends Error {
|
|
39
|
-
status: number;
|
|
40
|
-
constructor(status: number, message: string);
|
|
41
|
-
}
|
|
42
|
-
export declare function requestDeviceCode(base: string): Promise<DeviceCodeResponse>;
|
|
43
|
-
export declare function pollToken(base: string, deviceCode: string): Promise<PollResult>;
|
|
44
|
-
export declare function refreshTokens(base: string, refreshToken: string): Promise<RefreshResult>;
|
|
45
|
-
export declare function whoami(base: string, accessToken: string): Promise<{
|
|
46
|
-
userId: string;
|
|
47
|
-
email: string | null;
|
|
48
|
-
} | null>;
|
package/dist/auth/client.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
export class AuthHttpError extends Error {
|
|
2
|
-
status;
|
|
3
|
-
constructor(status, message) {
|
|
4
|
-
super(message);
|
|
5
|
-
this.status = status;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
function endpoint(base, path) {
|
|
9
|
-
return `${base.replace(/\/+$/, "")}${path}`;
|
|
10
|
-
}
|
|
11
|
-
async function readError(res) {
|
|
12
|
-
const body = (await res.json().catch(() => ({})));
|
|
13
|
-
return body.error ?? "unknown_error";
|
|
14
|
-
}
|
|
15
|
-
function toTokenPair(body) {
|
|
16
|
-
return {
|
|
17
|
-
accessToken: body.access_token,
|
|
18
|
-
refreshToken: body.refresh_token,
|
|
19
|
-
expiresIn: body.expires_in,
|
|
20
|
-
...(body.email !== undefined ? { email: body.email } : {}),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export async function requestDeviceCode(base) {
|
|
24
|
-
const res = await fetch(endpoint(base, "/api/auth/cli/device-code"), { method: "POST" });
|
|
25
|
-
if (!res.ok)
|
|
26
|
-
throw new AuthHttpError(res.status, `device-code failed: ${await readError(res)}`);
|
|
27
|
-
const b = (await res.json());
|
|
28
|
-
return {
|
|
29
|
-
deviceCode: b.device_code,
|
|
30
|
-
userCode: b.user_code,
|
|
31
|
-
verificationUri: b.verification_uri,
|
|
32
|
-
verificationUriComplete: b.verification_uri_complete,
|
|
33
|
-
expiresIn: b.expires_in,
|
|
34
|
-
interval: b.interval,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export async function pollToken(base, deviceCode) {
|
|
38
|
-
const res = await fetch(endpoint(base, "/api/auth/cli/token"), {
|
|
39
|
-
method: "POST",
|
|
40
|
-
headers: { "Content-Type": "application/json" },
|
|
41
|
-
body: JSON.stringify({ device_code: deviceCode }),
|
|
42
|
-
});
|
|
43
|
-
if (res.ok) {
|
|
44
|
-
return { kind: "tokens", tokens: toTokenPair((await res.json())) };
|
|
45
|
-
}
|
|
46
|
-
const error = await readError(res);
|
|
47
|
-
switch (error) {
|
|
48
|
-
case "authorization_pending":
|
|
49
|
-
return { kind: "pending" };
|
|
50
|
-
case "slow_down":
|
|
51
|
-
return { kind: "slow_down" };
|
|
52
|
-
case "expired_token":
|
|
53
|
-
return { kind: "expired" };
|
|
54
|
-
case "access_denied":
|
|
55
|
-
return { kind: "denied" };
|
|
56
|
-
default:
|
|
57
|
-
throw new AuthHttpError(res.status, `token poll failed: ${error}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export async function refreshTokens(base, refreshToken) {
|
|
61
|
-
let res;
|
|
62
|
-
try {
|
|
63
|
-
res = await fetch(endpoint(base, "/api/auth/cli/refresh"), {
|
|
64
|
-
method: "POST",
|
|
65
|
-
headers: { "Content-Type": "application/json" },
|
|
66
|
-
body: JSON.stringify({ refresh_token: refreshToken }),
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
// Network/DNS failure — treat as transient so we never discard a session.
|
|
71
|
-
return { kind: "transient", error: err instanceof Error ? err.message : "network_error" };
|
|
72
|
-
}
|
|
73
|
-
if (res.ok)
|
|
74
|
-
return { kind: "tokens", tokens: toTokenPair((await res.json())) };
|
|
75
|
-
const error = await readError(res);
|
|
76
|
-
const terminal = res.status === 401 && ["invalid_token", "sso_revoked", "not_authorized"].includes(error);
|
|
77
|
-
return terminal ? { kind: "terminal", error } : { kind: "transient", error };
|
|
78
|
-
}
|
|
79
|
-
export async function whoami(base, accessToken) {
|
|
80
|
-
const res = await fetch(endpoint(base, "/api/auth/cli/whoami"), {
|
|
81
|
-
headers: { Authorization: `Bearer ${accessToken}` },
|
|
82
|
-
});
|
|
83
|
-
if (res.status === 401)
|
|
84
|
-
return null;
|
|
85
|
-
if (!res.ok)
|
|
86
|
-
throw new AuthHttpError(res.status, `whoami failed: ${await readError(res)}`);
|
|
87
|
-
return (await res.json());
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=client.js.map
|
package/dist/auth/client.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/auth/client.ts"],"names":[],"mappings":"AA6BA,MAAM,OAAO,aAAc,SAAQ,KAAK;IAE7B;IADT,YACS,MAAc,EACrB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,WAAM,GAAN,MAAM,CAAQ;IAIvB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,IAAY;IAC1C,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,GAAa;IACpC,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAuB,CAAC;IACxE,OAAO,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC;AACvC,CAAC;AAID,SAAS,WAAW,CAAC,IAAuB;IAC1C,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,Y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G,CAAC,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAsB,CAAC,EAAE,CAAC;IACpG,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,EAAE,gBAAgB,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1G,OAAO,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AAC/E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAAY,EACZ,WAAmB;IAEnB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC,EAAE;QAC9D,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,WAAW,EAAE,EAAE;KACpD,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,kBAAkB,MAAM,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3F,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA6C,CAAC;AACxE,CAAC"}
|
package/dist/auth/paths.d.ts
DELETED
package/dist/auth/paths.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
/** Directory holding the component-compass CLI config (XDG-aware). */
|
|
4
|
-
function configDir(env = process.env) {
|
|
5
|
-
// biome-ignore lint/complexity/useLiteralKeys: env access
|
|
6
|
-
const xdg = env["XDG_CONFIG_HOME"];
|
|
7
|
-
const base = xdg && xdg.trim() !== "" ? xdg : join(homedir(), ".config");
|
|
8
|
-
return join(base, "component-compass");
|
|
9
|
-
}
|
|
10
|
-
/** Absolute path to the hosts.json token store. */
|
|
11
|
-
export function hostsFilePath(env = process.env) {
|
|
12
|
-
return join(configDir(env), "hosts.json");
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=paths.js.map
|
package/dist/auth/paths.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/auth/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,sEAAsE;AACtE,SAAS,SAAS,CAAC,MAAyB,OAAO,CAAC,GAAG;IACrD,0DAA0D;IAC1D,MAAM,GAAG,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;IACzE,OAAO,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;AACzC,CAAC;AAED,mDAAmD;AACnD,MAAM,UAAU,aAAa,CAAC,MAAyB,OAAO,CAAC,GAAG;IAChE,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,CAAC;AAC5C,CAAC"}
|
package/dist/auth/session.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type Store } from "./store.js";
|
|
2
|
-
export declare class NotSignedInError extends Error {
|
|
3
|
-
host: string;
|
|
4
|
-
constructor(host: string);
|
|
5
|
-
}
|
|
6
|
-
export declare class ReloginRequiredError extends Error {
|
|
7
|
-
host: string;
|
|
8
|
-
constructor(host: string);
|
|
9
|
-
}
|
|
10
|
-
export declare class IdpUnavailableError extends Error {
|
|
11
|
-
host: string;
|
|
12
|
-
reason: string;
|
|
13
|
-
constructor(host: string, reason: string);
|
|
14
|
-
}
|
|
15
|
-
/** Host precedence: flag → repo config → COMPONENT_COMPASS_HOST → stored default. Returns a normalized base URL. */
|
|
16
|
-
export declare function resolveHost(opts: {
|
|
17
|
-
flagHost?: string;
|
|
18
|
-
configHost?: string;
|
|
19
|
-
env?: NodeJS.ProcessEnv;
|
|
20
|
-
store: Store;
|
|
21
|
-
}): string;
|
|
22
|
-
/**
|
|
23
|
-
* Return a valid access token for `host`, silently refreshing when near expiry
|
|
24
|
-
* (or when `force` is set). Persists the rotated pair. Throws:
|
|
25
|
-
* - NotSignedInError — no stored entry
|
|
26
|
-
* - ReloginRequiredError — terminal refresh failure (tokens cleared)
|
|
27
|
-
* - IdpUnavailableError — transient refresh failure (tokens kept)
|
|
28
|
-
*/
|
|
29
|
-
export declare function getAccessToken(host: string, deps?: {
|
|
30
|
-
force?: boolean;
|
|
31
|
-
now?: () => number;
|
|
32
|
-
filePath?: string;
|
|
33
|
-
}): Promise<{
|
|
34
|
-
accessToken: string;
|
|
35
|
-
userEmail: string;
|
|
36
|
-
}>;
|
|
37
|
-
/** Map an auth error to friendly copy, or null if it is not an auth error. */
|
|
38
|
-
export declare function formatAuthError(err: unknown): string | null;
|
package/dist/auth/session.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { loadStore, saveStore, normalizeHost } from "./store.js";
|
|
2
|
-
import { refreshTokens } from "./client.js";
|
|
3
|
-
/** Refresh this many ms before the recorded expiry. */
|
|
4
|
-
const EXPIRY_SKEW_MS = 60_000;
|
|
5
|
-
export class NotSignedInError extends Error {
|
|
6
|
-
host;
|
|
7
|
-
constructor(host) {
|
|
8
|
-
super(`Not signed in to ${host}. Run \`component-compass auth login --host ${host}\`.`);
|
|
9
|
-
this.host = host;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export class ReloginRequiredError extends Error {
|
|
13
|
-
host;
|
|
14
|
-
constructor(host) {
|
|
15
|
-
super(`Session for ${host} expired or was revoked. Run \`component-compass auth login --host ${host}\`.`);
|
|
16
|
-
this.host = host;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export class IdpUnavailableError extends Error {
|
|
20
|
-
host;
|
|
21
|
-
reason;
|
|
22
|
-
constructor(host, reason) {
|
|
23
|
-
super(`Could not reach the identity provider to refresh credentials for ${host} (${reason}). Check your network and retry.`);
|
|
24
|
-
this.host = host;
|
|
25
|
-
this.reason = reason;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/** Host precedence: flag → repo config → COMPONENT_COMPASS_HOST → stored default. Returns a normalized base URL. */
|
|
29
|
-
export function resolveHost(opts) {
|
|
30
|
-
const env = opts.env ?? process.env;
|
|
31
|
-
// biome-ignore lint/complexity/useLiteralKeys: env access
|
|
32
|
-
const raw = opts.flagHost ?? opts.configHost ?? env["COMPONENT_COMPASS_HOST"] ?? opts.store.default;
|
|
33
|
-
if (!raw) {
|
|
34
|
-
throw new Error("No upload host configured. Pass --host, set COMPONENT_COMPASS_HOST, add `host` to component-compass.config.json, or run `component-compass auth login --host <url>`.");
|
|
35
|
-
}
|
|
36
|
-
return normalizeHost(raw);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Return a valid access token for `host`, silently refreshing when near expiry
|
|
40
|
-
* (or when `force` is set). Persists the rotated pair. Throws:
|
|
41
|
-
* - NotSignedInError — no stored entry
|
|
42
|
-
* - ReloginRequiredError — terminal refresh failure (tokens cleared)
|
|
43
|
-
* - IdpUnavailableError — transient refresh failure (tokens kept)
|
|
44
|
-
*/
|
|
45
|
-
export async function getAccessToken(host, deps = {}) {
|
|
46
|
-
const now = deps.now ?? Date.now;
|
|
47
|
-
const base = normalizeHost(host);
|
|
48
|
-
const store = await loadStore(deps.filePath);
|
|
49
|
-
const entry = store.hosts[base];
|
|
50
|
-
if (!entry)
|
|
51
|
-
throw new NotSignedInError(base);
|
|
52
|
-
const stillValid = Date.parse(entry.expiresAt) - now() > EXPIRY_SKEW_MS;
|
|
53
|
-
if (stillValid && !deps.force) {
|
|
54
|
-
return { accessToken: entry.accessToken, userEmail: entry.userEmail };
|
|
55
|
-
}
|
|
56
|
-
const result = await refreshTokens(base, entry.refreshToken);
|
|
57
|
-
if (result.kind === "tokens") {
|
|
58
|
-
const updated = {
|
|
59
|
-
accessToken: result.tokens.accessToken,
|
|
60
|
-
refreshToken: result.tokens.refreshToken,
|
|
61
|
-
userEmail: result.tokens.email ?? entry.userEmail,
|
|
62
|
-
expiresAt: new Date(now() + result.tokens.expiresIn * 1000).toISOString(),
|
|
63
|
-
};
|
|
64
|
-
store.hosts[base] = updated;
|
|
65
|
-
await saveStore(store, deps.filePath);
|
|
66
|
-
return { accessToken: updated.accessToken, userEmail: updated.userEmail };
|
|
67
|
-
}
|
|
68
|
-
if (result.kind === "terminal") {
|
|
69
|
-
const { [base]: _removed, ...remainingHosts } = store.hosts;
|
|
70
|
-
const cleared = {
|
|
71
|
-
hosts: remainingHosts,
|
|
72
|
-
...(store.default && store.default !== base ? { default: store.default } : {}),
|
|
73
|
-
};
|
|
74
|
-
await saveStore(cleared, deps.filePath);
|
|
75
|
-
throw new ReloginRequiredError(base);
|
|
76
|
-
}
|
|
77
|
-
throw new IdpUnavailableError(base, result.error);
|
|
78
|
-
}
|
|
79
|
-
/** Map an auth error to friendly copy, or null if it is not an auth error. */
|
|
80
|
-
export function formatAuthError(err) {
|
|
81
|
-
if (err instanceof NotSignedInError ||
|
|
82
|
-
err instanceof ReloginRequiredError ||
|
|
83
|
-
err instanceof IdpUnavailableError) {
|
|
84
|
-
return err.message;
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
//# sourceMappingURL=session.js.map
|
package/dist/au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/** ISO 8601 access-token expiry. */
|
|
6
|
-
expiresAt: string;
|
|
7
|
-
};
|
|
8
|
-
export type Store = {
|
|
9
|
-
/** Normalized base URL of the default host, if any. */
|
|
10
|
-
default?: string;
|
|
11
|
-
hosts: Record<string, HostEntry>;
|
|
12
|
-
};
|
|
13
|
-
/** Canonical base URL: prepend https:// when no scheme, strip trailing slashes. */
|
|
14
|
-
export declare function normalizeHost(input: string): string;
|
|
15
|
-
export declare function loadStore(filePath?: string): Promise<Store>;
|
|
16
|
-
export declare function saveStore(store: Store, filePath?: string): Promise<void>;
|
package/dist/auth/store.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile, chmod } from "node:fs/promises";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
import { hostsFilePath } from "./paths.js";
|
|
4
|
-
/** Canonical base URL: prepend https:// when no scheme, strip trailing slashes. */
|
|
5
|
-
export function normalizeHost(input) {
|
|
6
|
-
const trimmed = input.trim();
|
|
7
|
-
if (trimmed === "")
|
|
8
|
-
throw new Error("Host must not be empty.");
|
|
9
|
-
const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
|
|
10
|
-
return withScheme.replace(/\/+$/, "");
|
|
11
|
-
}
|
|
12
|
-
export async function loadStore(filePath = hostsFilePath()) {
|
|
13
|
-
let raw;
|
|
14
|
-
try {
|
|
15
|
-
raw = await readFile(filePath, "utf8");
|
|
16
|
-
}
|
|
17
|
-
catch (err) {
|
|
18
|
-
if (err.code === "ENOENT")
|
|
19
|
-
return { hosts: {} };
|
|
20
|
-
throw err;
|
|
21
|
-
}
|
|
22
|
-
let parsed;
|
|
23
|
-
try {
|
|
24
|
-
parsed = JSON.parse(raw);
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
throw new Error(`Token store at ${filePath} contains invalid JSON. Delete it and run \`component-compass auth login\` again.`);
|
|
28
|
-
}
|
|
29
|
-
return { ...(parsed.default ? { default: parsed.default } : {}), hosts: parsed.hosts ?? {} };
|
|
30
|
-
}
|
|
31
|
-
export async function saveStore(store, filePath = hostsFilePath()) {
|
|
32
|
-
await mkdir(dirname(filePath), { recursive: true, mode: 0o700 });
|
|
33
|
-
await writeFile(filePath, `${JSON.stringify(store, null, 2)}\n`, { mode: 0o600 });
|
|
34
|
-
// writeFile's mode is ignored when the file already exists; force it.
|
|
35
|
-
await chmod(filePath, 0o600);
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=store.js.map
|
package/dist/auth/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/auth/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAgB3C,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,KAAK,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC/D,MAAM,UAAU,GAAG,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,OAAO,EAAE,CAAC;IAC7F,OAAO,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAQ,GAAG,aAAa,EAAE;IACxD,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;QAC3E,MAAM,GAAG,CAAC;IACZ,CAAC;IACD,IAAI,MAAsB,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAmB,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,mFAAmF,CAAC,CAAC;IACjI,CAAC;IACD,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;AAC/F,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAY,EAAE,QAAQ,GAAG,aAAa,EAAE;IACtE,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACjE,MAAM,SAAS,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,sEAAsE;IACtE,MAAM,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type UploadResult } from "../upload.js";
|
|
2
|
-
export type AuthedUploader = {
|
|
3
|
-
/** Normalized base URL uploads are sent to. */
|
|
4
|
-
base: string;
|
|
5
|
-
/** Upload one artifact. Store-backed path refreshes + retries once on a 401; COMPONENT_COMPASS_TOKEN path sends the token directly with no refresh or retry. */
|
|
6
|
-
upload: (artifactJson: string) => Promise<UploadResult>;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Resolve the host from precedence, obtain an access token, and return an
|
|
10
|
-
* uploader that injects the token. When COMPONENT_COMPASS_TOKEN is set the token is used
|
|
11
|
-
* directly with no refresh or 401-retry. Otherwise the store-backed path
|
|
12
|
-
* silently refreshes a stale token and retries once on 401.
|
|
13
|
-
* Throws NotSignedInError / ReloginRequiredError / IdpUnavailableError up front
|
|
14
|
-
* (store-backed path only).
|
|
15
|
-
*/
|
|
16
|
-
export declare function createAuthedUploader(opts: {
|
|
17
|
-
flagHost?: string;
|
|
18
|
-
configHost?: string;
|
|
19
|
-
store?: {
|
|
20
|
-
filePath?: string;
|
|
21
|
-
};
|
|
22
|
-
}): Promise<AuthedUploader>;
|
package/dist/auth/upload-auth.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { loadStore } from "./store.js";
|
|
2
|
-
import { resolveHost, getAccessToken } from "./session.js";
|
|
3
|
-
import { uploadArtifact, UploadError } from "../upload.js";
|
|
4
|
-
/**
|
|
5
|
-
* Resolve the host from precedence, obtain an access token, and return an
|
|
6
|
-
* uploader that injects the token. When COMPONENT_COMPASS_TOKEN is set the token is used
|
|
7
|
-
* directly with no refresh or 401-retry. Otherwise the store-backed path
|
|
8
|
-
* silently refreshes a stale token and retries once on 401.
|
|
9
|
-
* Throws NotSignedInError / ReloginRequiredError / IdpUnavailableError up front
|
|
10
|
-
* (store-backed path only).
|
|
11
|
-
*/
|
|
12
|
-
export async function createAuthedUploader(opts) {
|
|
13
|
-
const filePath = opts.store?.filePath;
|
|
14
|
-
const store = await loadStore(filePath);
|
|
15
|
-
const base = resolveHost({
|
|
16
|
-
...(opts.flagHost !== undefined ? { flagHost: opts.flagHost } : {}),
|
|
17
|
-
...(opts.configHost !== undefined ? { configHost: opts.configHost } : {}),
|
|
18
|
-
store,
|
|
19
|
-
});
|
|
20
|
-
// Non-interactive path: a CI runner sets COMPONENT_COMPASS_TOKEN to a shared secret
|
|
21
|
-
// (or any pre-obtained bearer). Use it directly and skip the token lookup,
|
|
22
|
-
// refresh, and 401-retry — there is nothing to refresh; a 401 is a hard
|
|
23
|
-
// failure to surface, not a recoverable state.
|
|
24
|
-
// biome-ignore lint/complexity/useLiteralKeys: env access
|
|
25
|
-
const ciToken = process.env["COMPONENT_COMPASS_TOKEN"];
|
|
26
|
-
if (ciToken) {
|
|
27
|
-
return {
|
|
28
|
-
base,
|
|
29
|
-
async upload(artifactJson) {
|
|
30
|
-
return await uploadArtifact({ host: base, token: ciToken, artifactJson });
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
let token = (await getAccessToken(base, filePath !== undefined ? { filePath } : {})).accessToken;
|
|
35
|
-
return {
|
|
36
|
-
base,
|
|
37
|
-
async upload(artifactJson) {
|
|
38
|
-
try {
|
|
39
|
-
return await uploadArtifact({ host: base, token, artifactJson });
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
if (err instanceof UploadError && err.code === 401) {
|
|
43
|
-
token = (await getAccessToken(base, { force: true, ...(filePath !== undefined ? { filePath } : {}) })).accessToken;
|
|
44
|
-
return await uploadArtifact({ host: base, token, artifactJson });
|
|
45
|
-
}
|
|
46
|
-
throw err;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=upload-auth.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload-auth.js","sourceRoot":"","sources":["../../src/auth/upload-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAS9E;;;;;;;GAOG;AACH,MAAM,CAAC,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E,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,WAAW,IAAI,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC;oBACnD,KAAK,GAAG,CAAC,MAAM,cAAc,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;oBACnH,OAAO,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;gBACnE,CAAC;gBACD,MAAM,GAAG,CAAC;YACZ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/cli/help.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** Top-level overview: `component-compass`, `component-compass --help`. */
|
|
2
|
-
export declare function topHelp(): string;
|
|
3
|
-
/** Per-command usage: `component-compass <cmd> --help`. Falls back to the overview. */
|
|
4
|
-
export declare function commandHelp(command: string): string;
|
package/dist/cli/help.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const TOP = `component-compass <command> [options]
|
|
2
|
-
|
|
3
|
-
Commands:
|
|
4
|
-
scan Scan repo and write component-compass.json
|
|
5
|
-
init Scaffold component-compass.config.json
|
|
6
|
-
auth Sign in / out of a Component Compass host (login | logout | status)
|
|
7
|
-
|
|
8
|
-
Run \`component-compass <command> --help\` for command-specific options.
|
|
9
|
-
|
|
10
|
-
Other:
|
|
11
|
-
--help, -h
|
|
12
|
-
--version, -v
|
|
13
|
-
`;
|
|
14
|
-
const SCAN = `component-compass scan [options]
|
|
15
|
-
|
|
16
|
-
Scan the repo and write component-compass.json.
|
|
17
|
-
|
|
18
|
-
Options:
|
|
19
|
-
--config <path> Override config path (default: ./component-compass.config.json)
|
|
20
|
-
--output <path> Override output path
|
|
21
|
-
--quiet Suppress STDOUT summary
|
|
22
|
-
--repo-id <value> Override repo identifier in the artifact
|
|
23
|
-
--repo-root <dir> Directory to treat as the repository root for artefact paths (default: git toplevel)
|
|
24
|
-
--upload Also POST the scan to the configured host
|
|
25
|
-
--host <url> Override host URL (else config.host, else COMPONENT_COMPASS_HOST env)
|
|
26
|
-
`;
|
|
27
|
-
const INIT = `component-compass init [options]
|
|
28
|
-
|
|
29
|
-
Scaffold component-compass.config.json. Interactive when run in a terminal.
|
|
30
|
-
|
|
31
|
-
Options:
|
|
32
|
-
--output <path> Config output path (default: ./component-compass.config.json)
|
|
33
|
-
--framework <name> Pre-select a framework (repeatable): react | vue | lit | html | wc
|
|
34
|
-
--repo-id <value> Repo identifier (default: derived from package.json / dir)
|
|
35
|
-
-y, --yes Accept defaults without prompting (non-interactive)
|
|
36
|
-
`;
|
|
37
|
-
const AUTH = `component-compass auth <login|logout|status> [--host <url>]
|
|
38
|
-
|
|
39
|
-
login Device-flow browser login; stores tokens in ~/.config/component-compass/hosts.json
|
|
40
|
-
logout Remove stored tokens for a host
|
|
41
|
-
status Show the signed-in identity
|
|
42
|
-
`;
|
|
43
|
-
const REGISTRY = { scan: SCAN, init: INIT, auth: AUTH };
|
|
44
|
-
/** Top-level overview: `component-compass`, `component-compass --help`. */
|
|
45
|
-
export function topHelp() {
|
|
46
|
-
return TOP;
|
|
47
|
-
}
|
|
48
|
-
/** Per-command usage: `component-compass <cmd> --help`. Falls back to the overview. */
|
|
49
|
-
export function commandHelp(command) {
|
|
50
|
-
return REGISTRY[command] ?? TOP;
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=help.js.map
|
package/dist/cli/help.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,MAAM,GAAG,GAAG;;;;;;;;;;;;CAYX,CAAC;AAEF,MAAM,IAAI,GAAG;;;;;;;;;;;;CAYZ,CAAC;AAEF,MAAM,IAAI,GAAG;;;;;;;;;CASZ,CAAC;AAEF,MAAM,IAAI,GAAG;;;;;CAKZ,CAAC;AAEF,MAAM,QAAQ,GAA2B,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAEhF,2EAA2E;AAC3E,MAAM,UAAU,OAAO;IACrB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC;AAClC,CAAC"}
|
package/dist/cli/parse.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/** A user-facing CLI error: its message is printed and `exitCode` is returned. */
|
|
2
|
-
export declare class CliError extends Error {
|
|
3
|
-
exitCode: number;
|
|
4
|
-
constructor(message: string, exitCode?: number);
|
|
5
|
-
}
|
|
6
|
-
export declare const KNOWN_COMMANDS: readonly ["scan", "init", "auth"];
|
|
7
|
-
export type ParsedCommand = {
|
|
8
|
-
values: Record<string, string | boolean | string[] | undefined>;
|
|
9
|
-
positionals: string[];
|
|
10
|
-
};
|
|
11
|
-
/** Parse one command's argv in strict mode, mapping failures to a CliError. */
|
|
12
|
-
export declare function parseCommand(command: string, argv: string[]): ParsedCommand;
|
|
13
|
-
/** Message for an unrecognised top-level command, with a nearest-match hint. */
|
|
14
|
-
export declare function unknownCommandMessage(command: string): string;
|