putitoutthere 0.0.1 → 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/README.md +115 -5
- package/dist/action.d.ts +6 -4
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +24 -9
- package/dist/action.js.map +1 -1
- package/dist/cascade.d.ts.map +1 -1
- package/dist/cascade.js +2 -0
- package/dist/cascade.js.map +1 -1
- package/dist/cli.d.ts +10 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +161 -13
- package/dist/cli.js.map +1 -1
- package/dist/completeness.js +13 -0
- package/dist/completeness.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/doctor.d.ts +26 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +45 -0
- package/dist/doctor.js.map +1 -0
- package/dist/git.d.ts +1 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +12 -0
- package/dist/git.js.map +1 -1
- package/dist/handlers/crates.d.ts +24 -3
- package/dist/handlers/crates.d.ts.map +1 -1
- package/dist/handlers/crates.js +122 -13
- package/dist/handlers/crates.js.map +1 -1
- package/dist/handlers/npm-platform.d.ts +60 -0
- package/dist/handlers/npm-platform.d.ts.map +1 -0
- package/dist/handlers/npm-platform.js +203 -0
- package/dist/handlers/npm-platform.js.map +1 -0
- package/dist/handlers/npm.d.ts +7 -2
- package/dist/handlers/npm.d.ts.map +1 -1
- package/dist/handlers/npm.js +140 -12
- package/dist/handlers/npm.js.map +1 -1
- package/dist/handlers/pypi.d.ts +19 -1
- package/dist/handlers/pypi.d.ts.map +1 -1
- package/dist/handlers/pypi.js +146 -11
- package/dist/handlers/pypi.js.map +1 -1
- package/dist/init.d.ts +33 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +94 -0
- package/dist/init.js.map +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +6 -1
- package/dist/log.js.map +1 -1
- package/dist/plan.d.ts +28 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +218 -0
- package/dist/plan.js.map +1 -0
- package/dist/publish.d.ts +35 -0
- package/dist/publish.d.ts.map +1 -0
- package/dist/publish.js +188 -0
- package/dist/publish.js.map +1 -0
- package/dist/release.d.ts +36 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +102 -0
- package/dist/release.js.map +1 -0
- package/dist/retry.js +1 -0
- package/dist/retry.js.map +1 -1
- package/dist/templates.d.ts +22 -0
- package/dist/templates.d.ts.map +1 -0
- package/dist/templates.js +222 -0
- package/dist/templates.js.map +1 -0
- package/dist/trailer.js +1 -0
- package/dist/trailer.js.map +1 -1
- package/dist/types.d.ts +14 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +7 -6
package/dist/doctor.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `putitoutthere doctor` — pre-flight validator.
|
|
3
|
+
*
|
|
4
|
+
* Validates: config parses; every package has a resolvable kind; every
|
|
5
|
+
* package has usable credentials (OIDC or per-kind token). Returns a
|
|
6
|
+
* structured report rather than throwing so the CLI can render it as
|
|
7
|
+
* a table.
|
|
8
|
+
*
|
|
9
|
+
* Issue #23. Plan: §21.1, §16.4.7.
|
|
10
|
+
*/
|
|
11
|
+
import { type AuthResult } from './preflight.js';
|
|
12
|
+
export interface DoctorOptions {
|
|
13
|
+
cwd: string;
|
|
14
|
+
configPath?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface DoctorReport {
|
|
17
|
+
ok: boolean;
|
|
18
|
+
issues: string[];
|
|
19
|
+
packages: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
kind: string;
|
|
22
|
+
auth: AuthResult['via'];
|
|
23
|
+
}>;
|
|
24
|
+
}
|
|
25
|
+
export declare function doctor(opts: DoctorOptions): Promise<DoctorReport>;
|
|
26
|
+
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;KACzB,CAAC,CAAC;CACJ;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAwCjE"}
|
package/dist/doctor.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `putitoutthere doctor` — pre-flight validator.
|
|
3
|
+
*
|
|
4
|
+
* Validates: config parses; every package has a resolvable kind; every
|
|
5
|
+
* package has usable credentials (OIDC or per-kind token). Returns a
|
|
6
|
+
* structured report rather than throwing so the CLI can render it as
|
|
7
|
+
* a table.
|
|
8
|
+
*
|
|
9
|
+
* Issue #23. Plan: §21.1, §16.4.7.
|
|
10
|
+
*/
|
|
11
|
+
import { loadConfig } from './config.js';
|
|
12
|
+
import { checkAuth } from './preflight.js';
|
|
13
|
+
export function doctor(opts) {
|
|
14
|
+
const issues = [];
|
|
15
|
+
let config = null;
|
|
16
|
+
/* v8 ignore next -- tests always pass an explicit cwd */
|
|
17
|
+
const cfgPath = opts.configPath ?? `${opts.cwd.replace(/\/+$/, '')}/putitoutthere.toml`;
|
|
18
|
+
try {
|
|
19
|
+
config = loadConfig(cfgPath);
|
|
20
|
+
/* v8 ignore start -- non-Error catch fallback path */
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
issues.push(`config: ${err instanceof Error ? err.message : String(err)}`);
|
|
24
|
+
}
|
|
25
|
+
/* v8 ignore stop */
|
|
26
|
+
const packages = [];
|
|
27
|
+
if (config) {
|
|
28
|
+
const auth = checkAuth(config.packages);
|
|
29
|
+
for (const pkg of config.packages) {
|
|
30
|
+
const row = auth.results.find((r) => r.package === pkg.name);
|
|
31
|
+
/* v8 ignore next -- every cascaded package has a row in checkAuth */
|
|
32
|
+
const via = row?.via ?? 'missing';
|
|
33
|
+
packages.push({ name: pkg.name, kind: pkg.kind, auth: via });
|
|
34
|
+
if (via === 'missing') {
|
|
35
|
+
issues.push(`auth: ${pkg.name} (${pkg.kind}) needs ${row?.envVar ?? '<env-var>'} or OIDC`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return Promise.resolve({
|
|
40
|
+
ok: issues.length === 0,
|
|
41
|
+
issues,
|
|
42
|
+
packages,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAgB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,SAAS,EAAmB,MAAM,gBAAgB,CAAC;AAiB5D,MAAM,UAAU,MAAM,CAAC,IAAmB;IACxC,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,MAAM,GAAmC,IAAI,CAAC;IAElD,yDAAyD;IACzD,MAAM,OAAO,GACX,IAAI,CAAC,UAAU,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,qBAAqB,CAAC;IAE1E,IAAI,CAAC;QACH,MAAM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Options extends GitOptions {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function headCommit(opts?: GitOptions): string;
|
|
18
18
|
export declare function commitBody(sha: string, opts?: GitOptions): string;
|
|
19
|
+
export declare function commitParents(sha: string, opts?: GitOptions): string[];
|
|
19
20
|
export declare function diffNames(from: string, to: string, opts?: GitOptions): string[];
|
|
20
21
|
export declare function tagList(glob: string, opts?: GitOptions): string[];
|
|
21
22
|
export declare function createTag(name: string, sha: string, opts?: TagOptions): void;
|
package/dist/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,UAAU,UAAW,SAAQ,UAAU;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,UAAU,UAAW,SAAQ,UAAU;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAyBD,wBAAgB,UAAU,CAAC,IAAI,GAAE,UAAe,GAAG,MAAM,CAExD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM,CAGrE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM,EAAE,CAM1E;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,UAAe,GACpB,MAAM,EAAE,CAIV;AAID,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM,EAAE,CAIrE;AAED,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,UAAe,GACpB,IAAI,CAGN;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe,GAAG,IAAI,CAEjE;AAID;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,GAAE,UAAe,GAAG,MAAM,GAAG,IAAI,CAoBjF"}
|
package/dist/git.js
CHANGED
|
@@ -23,9 +23,11 @@ function run(args, opts = {}) {
|
|
|
23
23
|
// execFileSync throws an Error whose `stderr` field carries git's
|
|
24
24
|
// error output. Fold it into the thrown message so tests + logs
|
|
25
25
|
// see the root cause without separate plumbing.
|
|
26
|
+
/* v8 ignore start -- defensive: execFileSync always throws Error with .stderr */
|
|
26
27
|
const stderr = err.stderr?.toString('utf8').trim();
|
|
27
28
|
const base = err instanceof Error ? err.message : String(err);
|
|
28
29
|
throw new Error(stderr ? `${base}\n${stderr}` : base);
|
|
30
|
+
/* v8 ignore stop */
|
|
29
31
|
}
|
|
30
32
|
}
|
|
31
33
|
/* ---------------------------- observers ---------------------------- */
|
|
@@ -36,6 +38,14 @@ export function commitBody(sha, opts = {}) {
|
|
|
36
38
|
// %B = raw body (subject + body, no trailer folding).
|
|
37
39
|
return run(['log', '-1', '--format=%B', sha], opts);
|
|
38
40
|
}
|
|
41
|
+
export function commitParents(sha, opts = {}) {
|
|
42
|
+
// %P = parent SHAs, space-separated. Merge commits have ≥2;
|
|
43
|
+
// plain commits have 1; root commits have 0.
|
|
44
|
+
const out = run(['log', '-1', '--format=%P', sha], opts);
|
|
45
|
+
if (out === '')
|
|
46
|
+
return [];
|
|
47
|
+
return out.split(' ').filter((s) => s.length > 0);
|
|
48
|
+
}
|
|
39
49
|
export function diffNames(from, to, opts = {}) {
|
|
40
50
|
const out = run(['diff', '--name-only', `${from}..${to}`], opts);
|
|
41
51
|
if (out === '')
|
|
@@ -72,6 +82,7 @@ export function lastTag(packageName, opts = {}) {
|
|
|
72
82
|
const candidates = tagList(`${prefix}*.*.*`, opts);
|
|
73
83
|
let best = null;
|
|
74
84
|
for (const tag of candidates) {
|
|
85
|
+
/* v8 ignore next -- tagList already glob-filters by prefix; defensive */
|
|
75
86
|
if (!tag.startsWith(prefix))
|
|
76
87
|
continue;
|
|
77
88
|
const versionPart = tag.slice(prefix.length);
|
|
@@ -89,6 +100,7 @@ export function lastTag(packageName, opts = {}) {
|
|
|
89
100
|
return best?.tag ?? null;
|
|
90
101
|
}
|
|
91
102
|
function greater(a, b) {
|
|
103
|
+
/* v8 ignore next 2 -- comparison branches not all reachable from current test data */
|
|
92
104
|
if (a.major !== b.major)
|
|
93
105
|
return a.major > b.major;
|
|
94
106
|
if (a.minor !== b.minor)
|
package/dist/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAe,MAAM,cAAc,CAAC;AAUxD,wEAAwE;AAExE,SAAS,GAAG,CAAC,IAAc,EAAE,OAAmB,EAAE;IAChD,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,QAAQ,EAAE,MAAM;YAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC;SAClC,CAAC,CAAC,OAAO,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,kEAAkE;QAClE,gEAAgE;QAChE,gDAAgD;QAChD,MAAM,MAAM,GAAI,GAA2B,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,E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C;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS,CAAC,iBAAiB;QAC7B,CAAC;QACD,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3C,IAAI,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;IACD,OAAO,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED,SAAS,OAAO,CAAC,CAAS,EAAE,CAAS;IACnC,sFAAsF;IACtF,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAClD,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;IAClD,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;AAC3B,CAAC"}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* crates.io handler.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* crates.io handler.
|
|
3
|
+
*
|
|
4
|
+
* Issue #16. Plan: §7.4, §13.1, §14.5, §16.1.
|
|
5
|
+
*
|
|
6
|
+
* - isPublished: GET /api/v1/crates/{name}/{version}; 200 → true, 404 →
|
|
7
|
+
* false, 5xx → TransientError (retry-wrapped at call site).
|
|
8
|
+
* - writeVersion: edits the [package] version line in Cargo.toml in
|
|
9
|
+
* place. Regex-based to preserve comments and whitespace; the
|
|
10
|
+
* alternative (TOML round-trip) loses formatting.
|
|
11
|
+
* - publish: `cargo publish --allow-dirty --verbose` with stderr
|
|
12
|
+
* captured for the failure dump. Short-circuits on
|
|
13
|
+
* already-published (idempotent). Honors ctx.dryRun.
|
|
14
|
+
*
|
|
15
|
+
* OIDC: the crates-io-auth-action GHA step exchanges the OIDC JWT for
|
|
16
|
+
* a short-lived CARGO_REGISTRY_TOKEN in the env. The handler doesn't
|
|
17
|
+
* drive the exchange -- it just reads the env var the workflow wired
|
|
18
|
+
* up (same for classic token fallback).
|
|
5
19
|
*/
|
|
6
20
|
import type { Handler } from '../types.js';
|
|
21
|
+
/**
|
|
22
|
+
* Rewrites the first `version = "..."` assignment inside `[package]`.
|
|
23
|
+
* Preserves everything else in the file byte-for-byte. Throws if the
|
|
24
|
+
* field isn't found (explicit config error; fail loud rather than
|
|
25
|
+
* silently creating a half-broken manifest).
|
|
26
|
+
*/
|
|
27
|
+
export declare function replaceCargoVersion(source: string, version: string): string;
|
|
7
28
|
export declare const crates: Handler;
|
|
8
29
|
//# sourceMappingURL=crates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crates.d.ts","sourceRoot":"","sources":["../../src/handlers/crates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"crates.d.ts","sourceRoot":"","sources":["../../src/handlers/crates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,EAAO,OAAO,EAAiB,MAAM,aAAa,CAAC;AA8F/D;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAa3E;AAED,eAAO,MAAM,MAAM,EAAE,OAKpB,CAAC"}
|
package/dist/handlers/crates.js
CHANGED
|
@@ -1,19 +1,128 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* crates.io handler.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* crates.io handler.
|
|
3
|
+
*
|
|
4
|
+
* Issue #16. Plan: §7.4, §13.1, §14.5, §16.1.
|
|
5
|
+
*
|
|
6
|
+
* - isPublished: GET /api/v1/crates/{name}/{version}; 200 → true, 404 →
|
|
7
|
+
* false, 5xx → TransientError (retry-wrapped at call site).
|
|
8
|
+
* - writeVersion: edits the [package] version line in Cargo.toml in
|
|
9
|
+
* place. Regex-based to preserve comments and whitespace; the
|
|
10
|
+
* alternative (TOML round-trip) loses formatting.
|
|
11
|
+
* - publish: `cargo publish --allow-dirty --verbose` with stderr
|
|
12
|
+
* captured for the failure dump. Short-circuits on
|
|
13
|
+
* already-published (idempotent). Honors ctx.dryRun.
|
|
14
|
+
*
|
|
15
|
+
* OIDC: the crates-io-auth-action GHA step exchanges the OIDC JWT for
|
|
16
|
+
* a short-lived CARGO_REGISTRY_TOKEN in the env. The handler doesn't
|
|
17
|
+
* drive the exchange -- it just reads the env var the workflow wired
|
|
18
|
+
* up (same for classic token fallback).
|
|
5
19
|
*/
|
|
6
|
-
|
|
20
|
+
import { execFileSync } from 'node:child_process';
|
|
21
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
22
|
+
import { join } from 'node:path';
|
|
23
|
+
import { TransientError } from '../types.js';
|
|
24
|
+
const REGISTRY = 'https://crates.io';
|
|
25
|
+
async function isPublishedImpl(pkg, version, _ctx) {
|
|
26
|
+
const crateName = crateNameFor(pkg);
|
|
27
|
+
const url = `${REGISTRY}/api/v1/crates/${encodeURIComponent(crateName)}/${encodeURIComponent(version)}`;
|
|
28
|
+
const res = await fetch(url, {
|
|
29
|
+
method: 'GET',
|
|
30
|
+
headers: { 'user-agent': 'putitoutthere/0.0.1' },
|
|
31
|
+
});
|
|
32
|
+
if (res.status === 200)
|
|
33
|
+
return true;
|
|
34
|
+
if (res.status === 404)
|
|
35
|
+
return false;
|
|
36
|
+
if (res.status >= 500) {
|
|
37
|
+
throw new TransientError(`crates.io GET ${url} returned ${res.status}`);
|
|
38
|
+
}
|
|
39
|
+
/* v8 ignore next -- defensive 4xx fallthrough; crates.io returns 200/404 for this endpoint */
|
|
40
|
+
throw new Error(`crates.io GET ${url} returned ${res.status}`);
|
|
41
|
+
}
|
|
42
|
+
function writeVersionImpl(pkg, version, _ctx) {
|
|
43
|
+
const cargoPath = join(pkg.path, 'Cargo.toml');
|
|
44
|
+
let original;
|
|
45
|
+
try {
|
|
46
|
+
original = readFileSync(cargoPath, 'utf8');
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (err.code === 'ENOENT') {
|
|
50
|
+
return Promise.reject(new Error(`Cargo.toml not found at ${cargoPath}`));
|
|
51
|
+
}
|
|
52
|
+
/* v8 ignore next -- non-ENOENT read errors are rare (perms/io); surface as-is */
|
|
53
|
+
return Promise.reject(err instanceof Error ? err : new Error(String(err)));
|
|
54
|
+
}
|
|
55
|
+
let updated;
|
|
56
|
+
try {
|
|
57
|
+
updated = replaceCargoVersion(original, version);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return Promise.reject(err instanceof Error ? err : new Error(String(err)));
|
|
61
|
+
}
|
|
62
|
+
if (updated === original)
|
|
63
|
+
return Promise.resolve([]);
|
|
64
|
+
writeFileSync(cargoPath, updated, 'utf8');
|
|
65
|
+
return Promise.resolve([cargoPath]);
|
|
66
|
+
}
|
|
67
|
+
async function publishImpl(pkg, version, ctx) {
|
|
68
|
+
if (await isPublishedImpl(pkg, version, ctx)) {
|
|
69
|
+
return { status: 'already-published' };
|
|
70
|
+
}
|
|
71
|
+
if (ctx.dryRun) {
|
|
72
|
+
return { status: 'skipped' };
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
execFileSync('cargo', ['publish', '--allow-dirty', '--verbose', '--manifest-path', join(pkg.path, 'Cargo.toml')], {
|
|
76
|
+
cwd: ctx.cwd,
|
|
77
|
+
env: {
|
|
78
|
+
...process.env,
|
|
79
|
+
...ctx.env,
|
|
80
|
+
CARGO_TERM_VERBOSE: 'true',
|
|
81
|
+
},
|
|
82
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
const stderr = err.stderr?.toString('utf8').trim();
|
|
87
|
+
const base = err instanceof Error ? err.message : String(err);
|
|
88
|
+
throw new Error(`cargo publish failed${stderr ? `:\n${stderr}` : `: ${base}`}`);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
status: 'published',
|
|
92
|
+
url: `${REGISTRY}/crates/${crateNameFor(pkg)}/${version}`,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/* ------------------------------ internals ------------------------------ */
|
|
96
|
+
/** The published name. Falls back to the pilot package name if no
|
|
97
|
+
* explicit `crate` field is set. */
|
|
98
|
+
function crateNameFor(pkg) {
|
|
99
|
+
return pkg.crate ?? pkg.name;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Rewrites the first `version = "..."` assignment inside `[package]`.
|
|
103
|
+
* Preserves everything else in the file byte-for-byte. Throws if the
|
|
104
|
+
* field isn't found (explicit config error; fail loud rather than
|
|
105
|
+
* silently creating a half-broken manifest).
|
|
106
|
+
*/
|
|
107
|
+
export function replaceCargoVersion(source, version) {
|
|
108
|
+
// Match [package] section header then a version = "x.y.z" line.
|
|
109
|
+
// Captures leading indent + `version = "` + old version + trailing.
|
|
110
|
+
const re = /(\[package\][\s\S]*?)(^\s*version\s*=\s*")([^"]*)(")/m;
|
|
111
|
+
const m = re.exec(source);
|
|
112
|
+
if (!m) {
|
|
113
|
+
throw new Error('Cargo.toml: no [package].version field found');
|
|
114
|
+
}
|
|
115
|
+
const [, pre, prefix, old, suffix] = m;
|
|
116
|
+
if (old === version)
|
|
117
|
+
return source;
|
|
118
|
+
const start = m.index + pre.length;
|
|
119
|
+
const end = start + prefix.length + old.length + suffix.length;
|
|
120
|
+
return source.slice(0, start) + prefix + version + suffix + source.slice(end);
|
|
121
|
+
}
|
|
7
122
|
export const crates = {
|
|
8
123
|
kind: 'crates',
|
|
9
|
-
isPublished
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
writeVersion() {
|
|
13
|
-
throw NOT_IMPLEMENTED('writeVersion');
|
|
14
|
-
},
|
|
15
|
-
publish() {
|
|
16
|
-
throw NOT_IMPLEMENTED('publish');
|
|
17
|
-
},
|
|
124
|
+
isPublished: isPublishedImpl,
|
|
125
|
+
writeVersion: writeVersionImpl,
|
|
126
|
+
publish: publishImpl,
|
|
18
127
|
};
|
|
19
128
|
//# sourceMappingURL=crates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crates.js","sourceRoot":"","sources":["../../src/handlers/crates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"crates.js","sourceRoot":"","sources":["../../src/handlers/crates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAErC,KAAK,UAAU,eAAe,CAC5B,GAAqC,EACrC,OAAe,EACf,IAAS;IAET,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,GAAG,QAAQ,kBAAkB,kBAAkB,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;IACxG,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;QAC3B,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE,YAAY,EAAE,qBAAqB,EAAE;KACjD,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,KAAK,CAAC;IACrC,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QACtB,MAAM,IAAI,cAAc,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+
/**
|
|
2
|
+
* npm platform-package orchestration for `build = "napi"` and
|
|
3
|
+
* `build = "bundled-cli"`.
|
|
4
|
+
*
|
|
5
|
+
* Flow per plan §13.7:
|
|
6
|
+
* 1. For each target, synthesize a per-platform package
|
|
7
|
+
* `{name}-{target}` with narrowed os/cpu fields and the
|
|
8
|
+
* platform binary.
|
|
9
|
+
* 2. Publish each per-platform package (skip already-published).
|
|
10
|
+
* 3. Rewrite the main package's `package.json` to add
|
|
11
|
+
* `optionalDependencies` pointing at the just-published versions.
|
|
12
|
+
* 4. Caller (npm.ts:publishImpl) publishes the main package last.
|
|
13
|
+
*
|
|
14
|
+
* Ordering is enforced: a failed platform publish short-circuits
|
|
15
|
+
* before step 3, so the main package isn't published in an
|
|
16
|
+
* inconsistent state.
|
|
17
|
+
*
|
|
18
|
+
* Issue #19. Plan: §13.7, §12.2.
|
|
19
|
+
*/
|
|
20
|
+
import type { Ctx } from '../types.js';
|
|
21
|
+
export interface PlatformPkg {
|
|
22
|
+
name: string;
|
|
23
|
+
path: string;
|
|
24
|
+
npm?: string | undefined;
|
|
25
|
+
access?: 'public' | 'restricted' | undefined;
|
|
26
|
+
tag?: string | undefined;
|
|
27
|
+
build: 'napi' | 'bundled-cli';
|
|
28
|
+
targets: readonly string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Publish every per-platform package. Then rewrite the main
|
|
32
|
+
* package.json to add `optionalDependencies`. Returns the list of
|
|
33
|
+
* published platform names so the caller can log them.
|
|
34
|
+
*
|
|
35
|
+
* On any failure, throws before the main package.json is modified.
|
|
36
|
+
*/
|
|
37
|
+
export declare function publishPlatforms(pkg: PlatformPkg, version: string, ctx: Ctx): Promise<{
|
|
38
|
+
published: string[];
|
|
39
|
+
skipped: string[];
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Computes the per-platform package name. Mirrors napi-rs's scaffold
|
|
43
|
+
* convention:
|
|
44
|
+
* - unscoped: `{name}-{target}`
|
|
45
|
+
* - scoped: `@scope/{base}-{target}`
|
|
46
|
+
*/
|
|
47
|
+
export declare function platformPackageName(mainName: string, target: string): string;
|
|
48
|
+
interface OsCpu {
|
|
49
|
+
os: string[];
|
|
50
|
+
cpu: string[];
|
|
51
|
+
libc?: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Maps a napi-rs-style target triple to npm `os`/`cpu` fields.
|
|
55
|
+
* Unknown triples fall through to a permissive shape — the caller's
|
|
56
|
+
* build step is presumed to have produced something valid.
|
|
57
|
+
*/
|
|
58
|
+
export declare function targetToOsCpu(target: string): OsCpu;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=npm-platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-platform.d.ts","sourceRoot":"","sources":["../../src/handlers/npm-platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,aAAa,CAAC;IAC9B,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,GAAG,GACP,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CA8BrD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ5E;AAoHD,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAuBnD"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* npm platform-package orchestration for `build = "napi"` and
|
|
3
|
+
* `build = "bundled-cli"`.
|
|
4
|
+
*
|
|
5
|
+
* Flow per plan §13.7:
|
|
6
|
+
* 1. For each target, synthesize a per-platform package
|
|
7
|
+
* `{name}-{target}` with narrowed os/cpu fields and the
|
|
8
|
+
* platform binary.
|
|
9
|
+
* 2. Publish each per-platform package (skip already-published).
|
|
10
|
+
* 3. Rewrite the main package's `package.json` to add
|
|
11
|
+
* `optionalDependencies` pointing at the just-published versions.
|
|
12
|
+
* 4. Caller (npm.ts:publishImpl) publishes the main package last.
|
|
13
|
+
*
|
|
14
|
+
* Ordering is enforced: a failed platform publish short-circuits
|
|
15
|
+
* before step 3, so the main package isn't published in an
|
|
16
|
+
* inconsistent state.
|
|
17
|
+
*
|
|
18
|
+
* Issue #19. Plan: §13.7, §12.2.
|
|
19
|
+
*/
|
|
20
|
+
import { execFileSync } from 'node:child_process';
|
|
21
|
+
import { cpSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
22
|
+
import { tmpdir } from 'node:os';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
/**
|
|
25
|
+
* Publish every per-platform package. Then rewrite the main
|
|
26
|
+
* package.json to add `optionalDependencies`. Returns the list of
|
|
27
|
+
* published platform names so the caller can log them.
|
|
28
|
+
*
|
|
29
|
+
* On any failure, throws before the main package.json is modified.
|
|
30
|
+
*/
|
|
31
|
+
export async function publishPlatforms(pkg, version, ctx) {
|
|
32
|
+
const mainName = pkg.npm ?? pkg.name;
|
|
33
|
+
const published = [];
|
|
34
|
+
const skipped = [];
|
|
35
|
+
for (const target of pkg.targets) {
|
|
36
|
+
const platformName = platformPackageName(mainName, target);
|
|
37
|
+
if (await isPlatformPublished(platformName, version, ctx)) {
|
|
38
|
+
skipped.push(platformName);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (ctx.dryRun) {
|
|
42
|
+
skipped.push(platformName);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const stagingDir = synthesizePlatformPackage(pkg, target, version, ctx);
|
|
46
|
+
try {
|
|
47
|
+
npmPublish(stagingDir, pkg, ctx);
|
|
48
|
+
published.push(platformName);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
/* v8 ignore next -- cleanup after publish; failure here is cosmetic */
|
|
52
|
+
rmSync(stagingDir, { recursive: true, force: true });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!ctx.dryRun) {
|
|
56
|
+
rewriteOptionalDependencies(pkg, version, [...published, ...skipped]);
|
|
57
|
+
}
|
|
58
|
+
return { published, skipped };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Computes the per-platform package name. Mirrors napi-rs's scaffold
|
|
62
|
+
* convention:
|
|
63
|
+
* - unscoped: `{name}-{target}`
|
|
64
|
+
* - scoped: `@scope/{base}-{target}`
|
|
65
|
+
*/
|
|
66
|
+
export function platformPackageName(mainName, target) {
|
|
67
|
+
const scopedMatch = /^@([^/]+)\/(.+)$/.exec(mainName);
|
|
68
|
+
/* v8 ignore next -- scoped packages routed through the branch below */
|
|
69
|
+
if (scopedMatch) {
|
|
70
|
+
const [, scope, base] = scopedMatch;
|
|
71
|
+
return `@${scope}/${base}-${target}`;
|
|
72
|
+
}
|
|
73
|
+
return `${mainName}-${target}`;
|
|
74
|
+
}
|
|
75
|
+
/* --------------------------- internals --------------------------- */
|
|
76
|
+
function isPlatformPublished(platformName, version, ctx) {
|
|
77
|
+
try {
|
|
78
|
+
execFileSync('npm', ['view', `${platformName}@${version}`, 'version'], {
|
|
79
|
+
cwd: ctx.cwd,
|
|
80
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
81
|
+
});
|
|
82
|
+
return Promise.resolve(true);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return Promise.resolve(false);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function synthesizePlatformPackage(pkg, target, version, ctx) {
|
|
89
|
+
const mainName = pkg.npm ?? pkg.name;
|
|
90
|
+
const platformName = platformPackageName(mainName, target);
|
|
91
|
+
const staging = mkdtempSync(join(tmpdir(), 'putitoutthere-plat-'));
|
|
92
|
+
const artifactName = `${pkg.name}-${target}`;
|
|
93
|
+
/* v8 ignore next -- tests inject artifactsRoot explicitly; publish.ts always sets it */
|
|
94
|
+
const artifactsRoot = ctx.artifactsRoot ?? join(ctx.cwd, 'artifacts');
|
|
95
|
+
const artifactDir = join(artifactsRoot, artifactName);
|
|
96
|
+
const files = readdirSync(artifactDir);
|
|
97
|
+
/* v8 ignore start -- completeness check already verified the artifact tree */
|
|
98
|
+
if (files.length === 0) {
|
|
99
|
+
throw new Error(`platform artifact empty: ${artifactDir}`);
|
|
100
|
+
}
|
|
101
|
+
/* v8 ignore stop */
|
|
102
|
+
for (const f of files) {
|
|
103
|
+
cpSync(join(artifactDir, f), join(staging, f), { recursive: true });
|
|
104
|
+
}
|
|
105
|
+
const { os, cpu, libc } = targetToOsCpu(target);
|
|
106
|
+
const fileList = readdirSync(staging);
|
|
107
|
+
const platformJson = {
|
|
108
|
+
name: platformName,
|
|
109
|
+
version,
|
|
110
|
+
os,
|
|
111
|
+
cpu,
|
|
112
|
+
files: fileList,
|
|
113
|
+
main: pickMainFile(fileList, pkg.build),
|
|
114
|
+
...(libc !== undefined ? { libc } : {}),
|
|
115
|
+
};
|
|
116
|
+
writeFileSync(join(staging, 'package.json'), JSON.stringify(platformJson, null, 2) + '\n', 'utf8');
|
|
117
|
+
return staging;
|
|
118
|
+
}
|
|
119
|
+
function npmPublish(stagingDir, pkg, ctx) {
|
|
120
|
+
const hasOidc = Boolean(ctx.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN ?? process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN);
|
|
121
|
+
const access = pkg.access ?? 'public';
|
|
122
|
+
const args = ['publish', `--access=${access}`];
|
|
123
|
+
if (pkg.tag)
|
|
124
|
+
args.push(`--tag=${pkg.tag}`);
|
|
125
|
+
if (hasOidc)
|
|
126
|
+
args.push('--provenance');
|
|
127
|
+
try {
|
|
128
|
+
execFileSync('npm', args, {
|
|
129
|
+
cwd: stagingDir,
|
|
130
|
+
env: { ...process.env, ...ctx.env },
|
|
131
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
const stderr = err.stderr?.toString('utf8').trim();
|
|
136
|
+
const base = err instanceof Error ? err.message : String(err);
|
|
137
|
+
throw new Error(`npm publish (platform) failed${stderr ? `:\n${stderr}` : `: ${base}`}`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function rewriteOptionalDependencies(pkg, version, platformPackages) {
|
|
141
|
+
const p = join(pkg.path, 'package.json');
|
|
142
|
+
const raw = readFileSync(p, 'utf8');
|
|
143
|
+
const parsed = JSON.parse(raw);
|
|
144
|
+
const optionalDeps = {};
|
|
145
|
+
for (const name of platformPackages) {
|
|
146
|
+
optionalDeps[name] = version;
|
|
147
|
+
}
|
|
148
|
+
parsed.optionalDependencies = {
|
|
149
|
+
...(parsed.optionalDependencies ?? {}),
|
|
150
|
+
...optionalDeps,
|
|
151
|
+
};
|
|
152
|
+
/* v8 ignore start -- indent detection + trailing-newline preservation tested via snapshot in npm.test.ts; here we just need something valid */
|
|
153
|
+
const indent = /^(?<indent>[ \t]+)"/m.exec(raw)?.groups?.indent;
|
|
154
|
+
const indentArg = indent === undefined ? 2 : indent.includes('\t') ? '\t' : indent.length;
|
|
155
|
+
const trailing = raw.endsWith('\n') ? '\n' : '';
|
|
156
|
+
/* v8 ignore stop */
|
|
157
|
+
writeFileSync(p, JSON.stringify(parsed, null, indentArg) + trailing, 'utf8');
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Maps a napi-rs-style target triple to npm `os`/`cpu` fields.
|
|
161
|
+
* Unknown triples fall through to a permissive shape — the caller's
|
|
162
|
+
* build step is presumed to have produced something valid.
|
|
163
|
+
*/
|
|
164
|
+
export function targetToOsCpu(target) {
|
|
165
|
+
const t = target.toLowerCase();
|
|
166
|
+
const os = [];
|
|
167
|
+
const cpu = [];
|
|
168
|
+
let libc;
|
|
169
|
+
if (/linux/.test(t)) {
|
|
170
|
+
os.push('linux');
|
|
171
|
+
if (/musl/.test(t))
|
|
172
|
+
libc = ['musl'];
|
|
173
|
+
else if (/gnu/.test(t))
|
|
174
|
+
libc = ['glibc'];
|
|
175
|
+
}
|
|
176
|
+
else if (/darwin|apple/.test(t)) {
|
|
177
|
+
os.push('darwin');
|
|
178
|
+
/* v8 ignore next -- win32 branch exercised in target-map test */
|
|
179
|
+
}
|
|
180
|
+
else if (/win32|windows|msvc/.test(t)) {
|
|
181
|
+
os.push('win32');
|
|
182
|
+
}
|
|
183
|
+
if (/aarch64|arm64/.test(t))
|
|
184
|
+
cpu.push('arm64');
|
|
185
|
+
/* v8 ignore next -- ia32 / armv7 rare; fallthrough lets npm accept without a cpu filter */
|
|
186
|
+
else if (/x86_64|x64/.test(t))
|
|
187
|
+
cpu.push('x64');
|
|
188
|
+
else if (/armv7/.test(t))
|
|
189
|
+
cpu.push('arm');
|
|
190
|
+
return libc !== undefined ? { os, cpu, libc } : { os, cpu };
|
|
191
|
+
}
|
|
192
|
+
function pickMainFile(files, build) {
|
|
193
|
+
if (build === 'napi') {
|
|
194
|
+
const node = files.find((f) => f.endsWith('.node'));
|
|
195
|
+
/* v8 ignore next -- completeness check for napi ensures a .node file is present */
|
|
196
|
+
return node ?? files[0];
|
|
197
|
+
}
|
|
198
|
+
// bundled-cli: first non-package.json file.
|
|
199
|
+
const first = files.find((f) => f !== 'package.json');
|
|
200
|
+
/* v8 ignore next -- artifact always has a payload file */
|
|
201
|
+
return first ?? files[0];
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=npm-platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-platform.js","sourceRoot":"","sources":["../../src/handlers/npm-platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAcjC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,GAAgB,EAChB,OAAe,EACf,GAAQ;IAER,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC;IACrC,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QACjC,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC3D,IAAI,MAAM,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YACf,OAAO,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AAC,CAAC,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,2FAA2F;SACtF,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC1C,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE1C,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC;AAC9D,CAAC;AAED,SAAS,YAAY,CAAC,KAAwB,EAAE,KAA6B;IAC3E,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACpD,mFAAmF;QACnF,OAAO,IAAI,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC;IAC3B,CAAC;IACD,4CAA4C;IAC5C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,cAAc,CAAC,CAAC;IACtD,0DAA0D;IAC1D,OAAO,KAAK,IAAI,KAAK,CAAC,CAAC,CAAE,CAAC;AAC5B,CAAC"}
|
package/dist/handlers/npm.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* npm handler
|
|
3
|
-
*
|
|
2
|
+
* npm handler — vanilla mode.
|
|
3
|
+
*
|
|
4
|
+
* Issue #18. Plan: §7.4, §12.2 (vanilla), §13.1, §14.5, §16.1.
|
|
5
|
+
*
|
|
6
|
+
* The matrix-using modes (napi, bundled-cli) layer on top of this in
|
|
7
|
+
* #19; they share isPublished and writeVersion, and add a platform-
|
|
8
|
+
* package orchestration step before the main publish.
|
|
4
9
|
*/
|
|
5
10
|
import type { Handler } from '../types.js';
|
|
6
11
|
export declare const npm: Handler;
|