@mawesome/npm-vm 0.0.0-stage → 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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +51 -2
  3. package/dist/cli.js +4157 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/index-B071ZJDk.d.cts +164 -0
  6. package/dist/index-B071ZJDk.d.ts +164 -0
  7. package/dist/index.cjs +7 -0
  8. package/dist/index.d.cts +2 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +2 -0
  11. package/dist/internal.cjs +2709 -0
  12. package/dist/internal.cjs.map +1 -0
  13. package/dist/internal.d.cts +139 -0
  14. package/dist/internal.d.ts +139 -0
  15. package/dist/internal.js +2706 -0
  16. package/dist/internal.js.map +1 -0
  17. package/dist/provenance--sOYCeF2.js +322 -0
  18. package/dist/provenance--sOYCeF2.js.map +1 -0
  19. package/dist/provenance-DDegWCyS.js +2 -0
  20. package/dist/runtime/atomic-C3shKdH9.cjs +88 -0
  21. package/dist/runtime/bootstrap.cjs +271 -0
  22. package/dist/runtime/commonjs-AANzyd21.cjs +7393 -0
  23. package/dist/runtime/dispatch-B9OSfqsn.cjs +25156 -0
  24. package/dist/runtime/dist-CXwBT6rE.cjs +30766 -0
  25. package/dist/runtime/home-BaoZZSBy.cjs +91 -0
  26. package/dist/runtime/install-C_M5WK98.cjs +13598 -0
  27. package/dist/runtime/journal-_bs-eJRJ.cjs +282 -0
  28. package/dist/runtime/launchers/cmd.tmpl +2 -0
  29. package/dist/runtime/launchers/ps1.tmpl +5 -0
  30. package/dist/runtime/launchers/sh.tmpl +3 -0
  31. package/dist/runtime/lease-HBD4CmBx.cjs +224 -0
  32. package/dist/runtime/lock-DBeYN-Zg.cjs +141 -0
  33. package/dist/runtime/messages-vUDkl1-0.cjs +174 -0
  34. package/dist/runtime/p-map-b8pXdaFZ.cjs +105 -0
  35. package/dist/runtime/proc-hB8N9WjN.cjs +127 -0
  36. package/dist/runtime/provenance-B4bajGXQ.cjs +2 -0
  37. package/dist/runtime/rolldown-runtime-BGT596CS.cjs +64 -0
  38. package/dist/runtime/runtime.cjs +143 -0
  39. package/dist/runtime/src-SpeGbMJx.cjs +314 -0
  40. package/dist/src-Bc9nN1Kl.cjs +2125 -0
  41. package/dist/src-Bc9nN1Kl.cjs.map +1 -0
  42. package/dist/src-NhNG2mnQ.js +1798 -0
  43. package/dist/src-NhNG2mnQ.js.map +1 -0
  44. package/package.json +85 -3
@@ -0,0 +1,139 @@
1
+ import { _ as ParsedSpecs, b as parseVersionSpec, c as NpmVmError, d as RegistrySignature, f as Selection, g as OnFail, h as NpmSpec, i as ResolveSource, l as isNpmVmError, m as sriHex, n as ResolveProviders, o as resolveNpmWith, p as selectCandidate, r as ResolveResult, s as EXIT, t as ResolveOptions, u as Candidate, v as SpecError, x as OwnNpm, y as parseSpecs } from "./index-B071ZJDk.cjs";
2
+ //#region src/state/lease.d.ts
3
+ interface Lease {
4
+ path: string;
5
+ release(): void;
6
+ }
7
+ //#endregion
8
+ //#region src/setup/home.d.ts
9
+ interface MachineId {
10
+ /** sha256 of the platform id, first 16 hex chars (spec DIST-2). */
11
+ id: string;
12
+ /** True when only the hostname was available, which cloned machines can share. */
13
+ fallback: boolean;
14
+ }
15
+ /** Every directory the tool uses (spec DIST-1 and SET-1). */
16
+ interface Dirs {
17
+ home: string;
18
+ cache: string;
19
+ state: string;
20
+ tmp: string;
21
+ journal: string;
22
+ machine: MachineId;
23
+ }
24
+ //#endregion
25
+ //#region src/install/keys.d.ts
26
+ /** A registry signing key as `https://registry.npmjs.org/-/npm/v1/keys` lists it (spec SEC-1). */
27
+ interface RegistryKey {
28
+ keyid: string;
29
+ /** SPKI DER, base64. */
30
+ key: string;
31
+ expires: string | null;
32
+ /** A revoked key never verifies anything, whatever the dates say. */
33
+ revoked?: boolean;
34
+ }
35
+ //#endregion
36
+ //#region src/install/cache.d.ts
37
+ interface PublishedEntry {
38
+ entryPath: string;
39
+ lease: Lease;
40
+ }
41
+ //#endregion
42
+ //#region src/install/fetch.d.ts
43
+ /** One published version as `npm view` reports it. */
44
+ interface RegistryVersion {
45
+ version: string;
46
+ enginesNode: string | null;
47
+ integrity: string;
48
+ tarball: string;
49
+ signatures: RegistrySignature[];
50
+ /** `dist.attestations.url`, present for packages published with provenance. */
51
+ attestationsUrl: string | null;
52
+ }
53
+ //#endregion
54
+ //#region src/install/verify.d.ts
55
+ interface Digests {
56
+ /** `sha512-<base64>`, the SRI form the registry uses. */
57
+ sha512: string;
58
+ sha512hex: string;
59
+ sha256hex: string;
60
+ sha224hex: string;
61
+ }
62
+ //#endregion
63
+ //#region src/install/index.d.ts
64
+ interface InstallContext {
65
+ dirs: Dirs;
66
+ own: OwnNpm | null;
67
+ env: NodeJS.ProcessEnv;
68
+ nodeVersion: string;
69
+ /** The Node that runs the transport and, through the shims, npm itself. */
70
+ nodePath: string;
71
+ keys: readonly RegistryKey[];
72
+ }
73
+ interface ContextNode {
74
+ /** The Node binary the shims resolve through PATH; the Action passes the one setup-node installed. */
75
+ execPath: string;
76
+ version: string;
77
+ }
78
+ export declare function createContext(env?: NodeJS.ProcessEnv, home?: string, node?: ContextNode): InstallContext;
79
+ /** A downloaded tarball plus what the registry said about it, ready for verification. */
80
+ interface PackedSource {
81
+ file: string;
82
+ published: RegistryVersion;
83
+ publishedAt: () => Promise<string | null>;
84
+ registry: string;
85
+ }
86
+ interface EnsureOptions {
87
+ /** Called with the verified tarball before it is extracted, so a caller can keep a copy (the Action's cache). */
88
+ onPacked?: (source: PackedSource, digests: Digests) => Promise<void>;
89
+ /** Never contact the registry; defaults to `NPM_VM_OFFLINE` in the context env. */
90
+ offline?: boolean;
91
+ }
92
+ interface Installer extends ResolveProviders {
93
+ /** Makes the selected npm runnable: validates a cached entry or downloads, verifies and publishes one (spec SEC-4, SEC-5). */
94
+ ensure(selection: Selection, options?: EnsureOptions): Promise<{
95
+ entryPath: string;
96
+ lease: Lease;
97
+ }>;
98
+ /** Verifies and publishes a tarball obtained elsewhere, such as a restored CI cache (spec SEC-1 to SEC-5). */
99
+ installTarball(selection: Selection, source: PackedSource): Promise<PublishedEntry>;
100
+ /** A short stable id of the configured registry, for cache keys that must not mix registries. */
101
+ registryIdentity(): Promise<string>;
102
+ }
103
+ export declare function createInstaller(context: InstallContext): Installer;
104
+ //#endregion
105
+ //#region src/commands/context.d.ts
106
+ interface CommandIo {
107
+ out(text: string): void;
108
+ err(text: string): void;
109
+ /** Asks a yes/no question; a non-interactive session answers no. */
110
+ confirm(question: string): Promise<boolean>;
111
+ interactive: boolean;
112
+ }
113
+ //#endregion
114
+ //#region src/commands/dispatch.d.ts
115
+ interface DispatchOptions {
116
+ /** The home the launcher runs from; the bin entry leaves it to the env and defaults. */
117
+ home?: string;
118
+ io?: CommandIo;
119
+ env?: NodeJS.ProcessEnv;
120
+ }
121
+ declare function run(argv: string[], options: DispatchOptions): Promise<number>;
122
+ //#endregion
123
+ //#region src/project.d.ts
124
+ interface ProjectLocation {
125
+ /** npm's `localPrefix` for this argv and cwd (spec RES-2). */
126
+ root: string;
127
+ /** Global mode, computed as npm does (spec RES-3). */
128
+ global: boolean;
129
+ /** The `--prefix` the command line carries, resolved, when it carries one. */
130
+ cliPrefix: string | null;
131
+ }
132
+ /**
133
+ * Mirrors `@npmcli/config` `loadLocalPrefix` (spec RES-2): a CLI prefix is final.
134
+ * Otherwise the nearest ancestor with `package.json` or `node_modules` wins, promoted to a parent whose `workspaces` include it unless `--no-workspaces` or global mode.
135
+ */
136
+ export declare function findProject(argv: readonly string[], cwd: string, env?: NodeJS.ProcessEnv): ProjectLocation;
137
+ //#endregion
138
+ export { type Candidate, type CommandIo, type DispatchOptions, EXIT, type EnsureOptions, type InstallContext, type Installer, type NpmSpec, NpmVmError, type OnFail, type PackedSource, type ParsedSpecs, type ResolveOptions, type ResolveProviders, type ResolveResult, type ResolveSource, type Selection, SpecError, isNpmVmError, parseSpecs, parseVersionSpec, resolveNpmWith, run as runCommand, selectCandidate, sriHex };
139
+ //# sourceMappingURL=internal.d.cts.map
@@ -0,0 +1,139 @@
1
+ import { _ as ParsedSpecs, b as parseVersionSpec, c as NpmVmError, d as RegistrySignature, f as Selection, g as OnFail, h as NpmSpec, i as ResolveSource, l as isNpmVmError, m as sriHex, n as ResolveProviders, o as resolveNpmWith, p as selectCandidate, r as ResolveResult, s as EXIT, t as ResolveOptions, u as Candidate, v as SpecError, x as OwnNpm, y as parseSpecs } from "./index-B071ZJDk.js";
2
+ //#region src/state/lease.d.ts
3
+ interface Lease {
4
+ path: string;
5
+ release(): void;
6
+ }
7
+ //#endregion
8
+ //#region src/setup/home.d.ts
9
+ interface MachineId {
10
+ /** sha256 of the platform id, first 16 hex chars (spec DIST-2). */
11
+ id: string;
12
+ /** True when only the hostname was available, which cloned machines can share. */
13
+ fallback: boolean;
14
+ }
15
+ /** Every directory the tool uses (spec DIST-1 and SET-1). */
16
+ interface Dirs {
17
+ home: string;
18
+ cache: string;
19
+ state: string;
20
+ tmp: string;
21
+ journal: string;
22
+ machine: MachineId;
23
+ }
24
+ //#endregion
25
+ //#region src/install/keys.d.ts
26
+ /** A registry signing key as `https://registry.npmjs.org/-/npm/v1/keys` lists it (spec SEC-1). */
27
+ interface RegistryKey {
28
+ keyid: string;
29
+ /** SPKI DER, base64. */
30
+ key: string;
31
+ expires: string | null;
32
+ /** A revoked key never verifies anything, whatever the dates say. */
33
+ revoked?: boolean;
34
+ }
35
+ //#endregion
36
+ //#region src/install/cache.d.ts
37
+ interface PublishedEntry {
38
+ entryPath: string;
39
+ lease: Lease;
40
+ }
41
+ //#endregion
42
+ //#region src/install/fetch.d.ts
43
+ /** One published version as `npm view` reports it. */
44
+ interface RegistryVersion {
45
+ version: string;
46
+ enginesNode: string | null;
47
+ integrity: string;
48
+ tarball: string;
49
+ signatures: RegistrySignature[];
50
+ /** `dist.attestations.url`, present for packages published with provenance. */
51
+ attestationsUrl: string | null;
52
+ }
53
+ //#endregion
54
+ //#region src/install/verify.d.ts
55
+ interface Digests {
56
+ /** `sha512-<base64>`, the SRI form the registry uses. */
57
+ sha512: string;
58
+ sha512hex: string;
59
+ sha256hex: string;
60
+ sha224hex: string;
61
+ }
62
+ //#endregion
63
+ //#region src/install/index.d.ts
64
+ interface InstallContext {
65
+ dirs: Dirs;
66
+ own: OwnNpm | null;
67
+ env: NodeJS.ProcessEnv;
68
+ nodeVersion: string;
69
+ /** The Node that runs the transport and, through the shims, npm itself. */
70
+ nodePath: string;
71
+ keys: readonly RegistryKey[];
72
+ }
73
+ interface ContextNode {
74
+ /** The Node binary the shims resolve through PATH; the Action passes the one setup-node installed. */
75
+ execPath: string;
76
+ version: string;
77
+ }
78
+ export declare function createContext(env?: NodeJS.ProcessEnv, home?: string, node?: ContextNode): InstallContext;
79
+ /** A downloaded tarball plus what the registry said about it, ready for verification. */
80
+ interface PackedSource {
81
+ file: string;
82
+ published: RegistryVersion;
83
+ publishedAt: () => Promise<string | null>;
84
+ registry: string;
85
+ }
86
+ interface EnsureOptions {
87
+ /** Called with the verified tarball before it is extracted, so a caller can keep a copy (the Action's cache). */
88
+ onPacked?: (source: PackedSource, digests: Digests) => Promise<void>;
89
+ /** Never contact the registry; defaults to `NPM_VM_OFFLINE` in the context env. */
90
+ offline?: boolean;
91
+ }
92
+ interface Installer extends ResolveProviders {
93
+ /** Makes the selected npm runnable: validates a cached entry or downloads, verifies and publishes one (spec SEC-4, SEC-5). */
94
+ ensure(selection: Selection, options?: EnsureOptions): Promise<{
95
+ entryPath: string;
96
+ lease: Lease;
97
+ }>;
98
+ /** Verifies and publishes a tarball obtained elsewhere, such as a restored CI cache (spec SEC-1 to SEC-5). */
99
+ installTarball(selection: Selection, source: PackedSource): Promise<PublishedEntry>;
100
+ /** A short stable id of the configured registry, for cache keys that must not mix registries. */
101
+ registryIdentity(): Promise<string>;
102
+ }
103
+ export declare function createInstaller(context: InstallContext): Installer;
104
+ //#endregion
105
+ //#region src/commands/context.d.ts
106
+ interface CommandIo {
107
+ out(text: string): void;
108
+ err(text: string): void;
109
+ /** Asks a yes/no question; a non-interactive session answers no. */
110
+ confirm(question: string): Promise<boolean>;
111
+ interactive: boolean;
112
+ }
113
+ //#endregion
114
+ //#region src/commands/dispatch.d.ts
115
+ interface DispatchOptions {
116
+ /** The home the launcher runs from; the bin entry leaves it to the env and defaults. */
117
+ home?: string;
118
+ io?: CommandIo;
119
+ env?: NodeJS.ProcessEnv;
120
+ }
121
+ declare function run(argv: string[], options: DispatchOptions): Promise<number>;
122
+ //#endregion
123
+ //#region src/project.d.ts
124
+ interface ProjectLocation {
125
+ /** npm's `localPrefix` for this argv and cwd (spec RES-2). */
126
+ root: string;
127
+ /** Global mode, computed as npm does (spec RES-3). */
128
+ global: boolean;
129
+ /** The `--prefix` the command line carries, resolved, when it carries one. */
130
+ cliPrefix: string | null;
131
+ }
132
+ /**
133
+ * Mirrors `@npmcli/config` `loadLocalPrefix` (spec RES-2): a CLI prefix is final.
134
+ * Otherwise the nearest ancestor with `package.json` or `node_modules` wins, promoted to a parent whose `workspaces` include it unless `--no-workspaces` or global mode.
135
+ */
136
+ export declare function findProject(argv: readonly string[], cwd: string, env?: NodeJS.ProcessEnv): ProjectLocation;
137
+ //#endregion
138
+ export { type Candidate, type CommandIo, type DispatchOptions, EXIT, type EnsureOptions, type InstallContext, type Installer, type NpmSpec, NpmVmError, type OnFail, type PackedSource, type ParsedSpecs, type ResolveOptions, type ResolveProviders, type ResolveResult, type ResolveSource, type Selection, SpecError, isNpmVmError, parseSpecs, parseVersionSpec, resolveNpmWith, run as runCommand, selectCandidate, sriHex };
139
+ //# sourceMappingURL=internal.d.ts.map