@maligator/cli 0.1.0-alpha.23 → 0.1.0-alpha.25

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference lib="dom" />
2
2
 
3
- import "./test-api.d.ts";
3
+ import "./platform-api.d.ts";
4
4
 
5
5
  export type MaligatorIntlFeature =
6
6
  | "collator"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maligator/cli",
3
- "version": "0.1.0-alpha.23",
3
+ "version": "0.1.0-alpha.25",
4
4
  "description": "Ahead-of-time JavaScript compiler and native runtime",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/dirkdev98/maligator#readme",
@@ -30,6 +30,8 @@
30
30
  "bin/maligator.js",
31
31
  "index.js",
32
32
  "index.d.ts",
33
+ "platform-api.d.ts",
34
+ "process-api.d.ts",
33
35
  "test-api.d.ts",
34
36
  "README.md",
35
37
  "LICENSE"
@@ -45,6 +47,6 @@
45
47
  }
46
48
  },
47
49
  "optionalDependencies": {
48
- "@maligator/cli-darwin-arm64": "0.1.0-alpha.23"
50
+ "@maligator/cli-darwin-arm64": "0.1.0-alpha.25"
49
51
  }
50
52
  }
@@ -0,0 +1,3 @@
1
+ // Generated from src/platform/catalog.ts; edit the catalog and regenerate.
2
+ import "./process-api.d.ts";
3
+ import "./test-api.d.ts";
@@ -0,0 +1,278 @@
1
+ // Generated from src/platform/catalog.ts; edit the catalog and regenerate.
2
+ /**
3
+ * Application execution context. Importing this module has no externally observable
4
+ * effects and requires no configuration switch. Unused exports and native
5
+ * implementation dependencies are eliminated. Process arguments, environment, working
6
+ * directory, and PID are runtime concerns outside execution.
7
+ */
8
+ declare module "maligator:process" {
9
+ /**
10
+ * Profiling instrumentation: none by default; sampling for --profile; compiler for
11
+ * --profile=compiler. Both profiling modes select full optimization without
12
+ * selecting production application behavior.
13
+ */
14
+ export type ExecutionProfile = "none" | "sampling" | "compiler";
15
+
16
+ /**
17
+ * The fixed platform contract of the application image.
18
+ */
19
+ export type ExecutionTarget = {
20
+ /**
21
+ * Application operating-system target, not the compiler host. Native builds use
22
+ * darwin or linux; WebAssembly uses wasi.
23
+ */
24
+ readonly platform: "darwin" | "linux" | "wasi";
25
+ /**
26
+ * Application architecture. Cross builds report the destination architecture.
27
+ */
28
+ readonly arch: "arm64" | "x64" | "wasm32";
29
+ /**
30
+ * Resolved target triple, including when --target was omitted; for example
31
+ * aarch64-apple-darwin.
32
+ */
33
+ readonly triple: string;
34
+ };
35
+
36
+ /**
37
+ * Options shared by build, run, and dev. Output paths, verbosity, and compiler
38
+ * scheduling are tool settings and are not exposed.
39
+ */
40
+ export type ExecutionOptions = {
41
+ /**
42
+ * Selected application profiling instrumentation. Defaults to none; does not imply
43
+ * execution.production.
44
+ */
45
+ readonly profile: ExecutionProfile;
46
+ };
47
+
48
+ /**
49
+ * Normalized test settings, fixed for the application image. Changing these values
50
+ * invalidates specialized test artifacts.
51
+ */
52
+ export type TestExecutionOptions = {
53
+ /**
54
+ * Selected test profiling instrumentation. Defaults to none; profiling preserves
55
+ * command: test.
56
+ */
57
+ readonly profile: ExecutionProfile;
58
+ /**
59
+ * Hierarchical test-name filter from --run, or null when all discovered names are
60
+ * eligible.
61
+ */
62
+ readonly nameFilter: string | null;
63
+ /**
64
+ * Number of requested test repetitions from --repeat; defaults to 1. This is not
65
+ * the currently executing repetition.
66
+ */
67
+ readonly repeat: number;
68
+ /**
69
+ * Whether --bail stops the test run after its first failure. Defaults to false.
70
+ */
71
+ readonly bail: boolean;
72
+ /**
73
+ * Default test timeout in milliseconds from --timeout. Defaults to 5000; individual
74
+ * test APIs can select a different timeout.
75
+ */
76
+ readonly timeoutMs: number;
77
+ /**
78
+ * Resolved positive shuffle seed, or null when shuffling is disabled. --shuffle
79
+ * without a seed chooses it once before compilation; the same seed drives execution
80
+ * and cache identity.
81
+ */
82
+ readonly shuffleSeed: number | null;
83
+ };
84
+
85
+ /**
86
+ * Resolved engine policies. These describe build inputs, never post-DCE native
87
+ * feature inclusion.
88
+ */
89
+ export type ExecutionEngineConfig = {
90
+ /**
91
+ * Requested primordial mutation policy. Defaults to locked. The execution snapshot
92
+ * itself is immutable in either policy.
93
+ */
94
+ readonly primordials: "locked" | "mutable";
95
+ /**
96
+ * Dynamic compilation policy. false (default) rejects eval/Function execution at
97
+ * runtime; true enables the runtime compiler; compile-check additionally rejects
98
+ * statically visible dynamic compilation calls.
99
+ */
100
+ readonly eval: boolean | "compile-check";
101
+ /**
102
+ * Whether additional realms are enabled. Defaults to false.
103
+ */
104
+ readonly realms: boolean;
105
+ /**
106
+ * Whether regular expressions are enabled. Defaults to true.
107
+ */
108
+ readonly regexp: boolean;
109
+ /**
110
+ * Whether Temporal and its required data are enabled. Defaults to false.
111
+ */
112
+ readonly temporal: boolean;
113
+ /**
114
+ * Requested Intl policy after applying configuration defaults.
115
+ */
116
+ readonly intl: {
117
+ /**
118
+ * Whether Intl is enabled. Defaults to false.
119
+ */
120
+ readonly enabled: boolean;
121
+ /**
122
+ * Requested Intl service names. An empty array selects the default complete
123
+ * service set when Intl is enabled; it does not mean every service survived tree
124
+ * shaking.
125
+ */
126
+ readonly features: ReadonlyArray<string>;
127
+ /**
128
+ * Requested locale selection. Defaults to an empty array. Unsupported locale
129
+ * selections are rejected by configuration validation.
130
+ */
131
+ readonly languages: ReadonlyArray<string>;
132
+ };
133
+ };
134
+
135
+ /**
136
+ * Public application policies from the selected build configuration. Excludes
137
+ * build-host paths, asset declarations, output controls, and the obsolete Maligator
138
+ * surface switch.
139
+ */
140
+ export type ExecutionConfig = {
141
+ /**
142
+ * Engine configuration after validation and default resolution.
143
+ */
144
+ readonly engine: ExecutionEngineConfig;
145
+ /**
146
+ * Global and compatibility surface policy. maligator:process requires no enable
147
+ * flag.
148
+ */
149
+ readonly surface: {
150
+ /**
151
+ * Whether Web globals are requested. Defaults to false; native module imports are
152
+ * independent of this global installation policy.
153
+ */
154
+ readonly webPlatform: boolean;
155
+ /**
156
+ * Whether Node compatibility, globals, and node: module resolution are requested.
157
+ * Defaults to false.
158
+ */
159
+ readonly node: boolean;
160
+ };
161
+ /**
162
+ * Resolved module-resolution policy.
163
+ */
164
+ readonly modules: {
165
+ /**
166
+ * Exact module-specifier replacements from configuration. Defaults to an empty
167
+ * object. Alias entries are immutable own data properties.
168
+ */
169
+ readonly aliases: Readonly<Record<string, string>>;
170
+ };
171
+ };
172
+
173
+ /**
174
+ * Fields shared by every execution workflow. All nested objects and arrays are
175
+ * deeply frozen at runtime.
176
+ */
177
+ export type ExecutionCommon = {
178
+ /**
179
+ * Explicit production application intent. True only when production was selected
180
+ * for the application; independent of NODE_ENV, profiling, and optimization.
181
+ * Currently --production is a build option. Defaults to false.
182
+ */
183
+ readonly production: boolean;
184
+ /**
185
+ * Whether the application image executes as native compiled code. A native
186
+ * executable hosting an interpreted image reports false. This is fixed for the
187
+ * image, not a query about the current stack frame or an eval-created function.
188
+ */
189
+ readonly compiled: boolean;
190
+ /**
191
+ * Actual selected frontend optimization policy. Ordinary commands currently use
192
+ * development; production builds and profiling use full. Backend choice is
193
+ * independent.
194
+ */
195
+ readonly optimization: "development" | "full";
196
+ /**
197
+ * Resolved application target. The compiler's host platform is not substituted
198
+ * during a cross build.
199
+ */
200
+ readonly target: ExecutionTarget;
201
+ /**
202
+ * Validated configuration policies with defaults applied, captured before
203
+ * compilation.
204
+ */
205
+ readonly config: ExecutionConfig;
206
+ };
207
+
208
+ /**
209
+ * An immutable application-image description, discriminated by command. The command
210
+ * describes the workflow that prepared the image, not a transient process phase.
211
+ */
212
+ export type Execution = ExecutionCommon &
213
+ (
214
+ | {
215
+ /**
216
+ * Prepared by maligator build. Remains build when the resulting executable runs
217
+ * later; application statements are not executed by the build itself.
218
+ */
219
+ readonly command: "build";
220
+ /**
221
+ * Normalized build options relevant to application execution.
222
+ */
223
+ readonly options: ExecutionOptions;
224
+ }
225
+ | {
226
+ /**
227
+ * Prepared by maligator run or maligator dev. dev denotes the watch/restart
228
+ * workflow even when profiling selects native compilation.
229
+ */
230
+ readonly command: "run" | "dev";
231
+ /**
232
+ * Normalized run/dev options. Arguments after -- remain runtime argv and do not
233
+ * specialize application compilation.
234
+ */
235
+ readonly options: ExecutionOptions;
236
+ }
237
+ | {
238
+ /**
239
+ * Prepared by maligator test. Preserved for interpreted tests, profiled native
240
+ * tests, and every fragment of the test application.
241
+ */
242
+ readonly command: "test";
243
+ /**
244
+ * Normalized test options. Narrow command to test before accessing test-only
245
+ * fields.
246
+ */
247
+ readonly options: TestExecutionOptions;
248
+ }
249
+ );
250
+
251
+ /**
252
+ * The canonical execution description, fixed before application compilation. Reads
253
+ * of known own properties, import aliases and re-exports, immutable aliases and
254
+ * destructuring, primitive comparisons, boolean expressions, and if/switch branches
255
+ * specialize in development and full compilation. Dynamic keys and opaque calls
256
+ * remain ordinary JavaScript and may retain the runtime object. The snapshot has
257
+ * stable identity within an application context and deeply frozen own data
258
+ * properties; reflection sees the complete shape. Static and dynamic imports return
259
+ * the same export. A different command, option, configuration, target, or backend
260
+ * creates a different compilation context. Profiling does not change production
261
+ * intent. Importing the module does not keep unused native code alive.
262
+ *
263
+ * @example
264
+ * import { execution } from "maligator:process";
265
+ *
266
+ * if (execution.compiled && execution.production) {
267
+ * console.log("native production application");
268
+ * }
269
+ *
270
+ * @example
271
+ * import { execution } from "maligator:process";
272
+ *
273
+ * if (execution.command === "test") {
274
+ * console.log(execution.options.repeat);
275
+ * }
276
+ */
277
+ export const execution: Execution;
278
+ }
package/test-api.d.ts CHANGED
@@ -1,25 +1,40 @@
1
+ // Generated from src/platform/catalog.ts; edit the catalog and regenerate.
2
+ /**
3
+ * Test authoring and assertions. Importing this module does not register tests or
4
+ * install runner globals. Registration and assertions are ordinary effectful calls;
5
+ * the test command initializes its internal runner explicitly. Unused imports can be
6
+ * eliminated.
7
+ */
1
8
  declare module "maligator:test" {
2
9
  /**
3
- * A test or hook body. Maligator waits for a returned promise or thenable
4
- * before advancing the lifecycle.
10
+ * A test or hook body. Maligator waits for a returned promise or thenable before
11
+ * advancing the lifecycle.
5
12
  */
6
13
  export type TestCallback = () => unknown;
7
- /** A lifecycle hook body, with the same async completion contract as a test. */
14
+
15
+ /**
16
+ * A lifecycle hook body, with the same async completion contract as a test.
17
+ */
8
18
  export type HookCallback = TestCallback;
9
- /** A constructable value accepted by {@link expect.any}. */
19
+
20
+ /**
21
+ * A constructable value accepted by {@link expect.any}.
22
+ */
10
23
  export type Constructor = abstract new (...args: Array<never>) => unknown;
11
24
 
12
25
  /**
13
- * Opaque partial-match value produced by helpers such as
14
- * {@link expect.objectContaining}. It may be nested inside `toEqual`,
15
- * `toStrictEqual`, and `toMatchObject` expectations.
26
+ * Opaque partial-match value produced by helpers such as {@link
27
+ * expect.objectContaining}. It may be nested inside `toEqual`, `toStrictEqual`, and
28
+ * `toMatchObject` expectations.
16
29
  */
17
- export interface AsymmetricMatcher {
30
+ export type AsymmetricMatcher = {
18
31
  readonly __maligator_asymmetric__: string;
19
- }
32
+ };
20
33
 
21
- /** Matchers for a synchronously received value. */
22
- export interface Matchers {
34
+ /**
35
+ * Matchers for a synchronously received value.
36
+ */
37
+ export type Matchers = {
23
38
  /** Negate the following matcher. */
24
39
  readonly not: Matchers;
25
40
  /** Wait for the received promise to fulfill, then match its value. */
@@ -65,14 +80,14 @@ declare module "maligator:test" {
65
80
  | Error
66
81
  | (abstract new (...args: Array<never>) => Error),
67
82
  ): void;
68
- }
83
+ };
69
84
 
70
85
  /**
71
- * Promise-returning matcher surface exposed by {@link Matchers.resolves} and
72
- * {@link Matchers.rejects}. Await these calls so the test cannot finish before
73
- * the assertion.
86
+ * Promise-returning matcher surface exposed by {@link Matchers.resolves} and {@link
87
+ * Matchers.rejects}. Await these calls so the test cannot finish before the
88
+ * assertion.
74
89
  */
75
- export interface AsyncMatchers {
90
+ export type AsyncMatchers = {
76
91
  /** Negate the following asynchronous matcher. */
77
92
  readonly not: AsyncMatchers;
78
93
  toBe(expected: unknown): Promise<void>;
@@ -94,10 +109,12 @@ declare module "maligator:test" {
94
109
  | Error
95
110
  | (abstract new (...args: Array<never>) => Error),
96
111
  ): Promise<void>;
97
- }
112
+ };
98
113
 
99
- /** Assertion entrypoint and Maligator-owned asymmetric matcher factories. */
100
- export interface ExpectFunction {
114
+ /**
115
+ * Assertion entrypoint and Maligator-owned asymmetric matcher factories.
116
+ */
117
+ export type ExpectFunction = {
101
118
  /** Create matchers for `received`. The assertion position is captured here. */
102
119
  (received: unknown): Matchers;
103
120
  /** Match a primitive of the corresponding built-in kind or an instance. */
@@ -110,10 +127,12 @@ declare module "maligator:test" {
110
127
  objectContaining(value: object): AsymmetricMatcher;
111
128
  /** Match an array containing a match for every element in `value`. */
112
129
  arrayContaining(value: Array<unknown>): AsymmetricMatcher;
113
- }
130
+ };
114
131
 
115
- /** Register tests in the current suite during module evaluation. */
116
- export interface TestFunction {
132
+ /**
133
+ * Register tests in the current suite during module evaluation.
134
+ */
135
+ export type TestFunction = {
117
136
  /** Register a test. Returned promises are awaited by the runner. */
118
137
  (name: string, callback: TestCallback): void;
119
138
  /** Register a skipped test without invoking its callback. */
@@ -132,36 +151,48 @@ declare module "maligator:test" {
132
151
  each<const Row extends ReadonlyArray<unknown>>(
133
152
  rows: ReadonlyArray<Row>,
134
153
  ): (name: string, callback: (...values: [...Row]) => unknown) => void;
135
- }
154
+ };
136
155
 
137
- /** Register nested suites synchronously during module evaluation. */
138
- export interface DescribeFunction {
156
+ /**
157
+ * Register nested suites synchronously during module evaluation.
158
+ */
159
+ export type DescribeFunction = {
139
160
  /** Register a suite. Suite callbacks must not return a promise. */
140
161
  (name: string, callback: () => void): void;
141
162
  /** Register a suite whose descendants are skipped. */
142
163
  skip(name: string, callback: () => void): void;
143
164
  /** Register a focused suite and emit the runner's focused-test warning. */
144
165
  only(name: string, callback: () => void): void;
145
- }
166
+ };
146
167
 
147
- /** Register a test in the current suite. */
168
+ /**
169
+ * Register a test in the current suite.
170
+ */
148
171
  export const test: TestFunction;
149
- /** Register a nested suite in the current suite. */
172
+ /**
173
+ * Register a nested suite in the current suite.
174
+ */
150
175
  export const describe: DescribeFunction;
151
- /** Create fluent matchers for a received value. */
176
+ /**
177
+ * Create fluent matchers for a received value.
178
+ */
152
179
  export const expect: ExpectFunction;
153
- /** Run once before tests in the current suite. */
154
- export function beforeAll(callback: HookCallback): void;
155
- /** Run once after tests in the current suite, including after test failures. */
156
- export function afterAll(callback: HookCallback): void;
180
+ /**
181
+ * Run once before tests in the current suite.
182
+ */
183
+ export const beforeAll: (callback: HookCallback) => void;
184
+ /**
185
+ * Run once after tests in the current suite, including after test failures.
186
+ */
187
+ export const afterAll: (callback: HookCallback) => void;
157
188
  /**
158
189
  * Run before every selected descendant test. Ancestor hooks run before hooks
159
190
  * declared by a nested suite.
160
191
  */
161
- export function beforeEach(callback: HookCallback): void;
192
+ export const beforeEach: (callback: HookCallback) => void;
162
193
  /**
163
- * Run after every selected descendant test. Nested-suite hooks run before
164
- * ancestor hooks.
194
+ * Run after every selected descendant test. Nested-suite hooks run before ancestor
195
+ * hooks.
165
196
  */
166
- export function afterEach(callback: HookCallback): void;
197
+ export const afterEach: (callback: HookCallback) => void;
167
198
  }