@maligator/cli 0.1.0-alpha.3 → 0.1.0-alpha.30

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.
@@ -0,0 +1,23 @@
1
+ // Generated from src/platform/catalog.ts; edit the catalog and regenerate.
2
+ /**
3
+ * Runtime lifecycle notifications for supervised applications. Module evaluation and
4
+ * application readiness are separate events; readiness means the application has
5
+ * finished its own startup work.
6
+ */
7
+ declare module "maligator:application" {
8
+ /**
9
+ * Notify the development supervisor that this application is ready. Repeated calls
10
+ * are harmless. Returns true in a supervised application and false in a standalone
11
+ * application or ordinary worker. Call after resources such as a server listener are
12
+ * accepting work; this does not reserve ports or transfer traffic.
13
+ *
14
+ * @example
15
+ * import { ready } from "maligator:application";
16
+ * import { createServer } from "node:http";
17
+ *
18
+ * createServer((_request, response) => response.end("hello")).listen(3000, () => ready());
19
+ *
20
+ * @see https://maligator.ddv.tools/api/application#ready
21
+ */
22
+ export const ready: () => boolean;
23
+ }
package/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  /// <reference lib="dom" />
2
2
 
3
+ import "./platform-api.d.ts";
4
+
5
+ /** Service selections used when Intl is enabled; an empty list includes every service. */
3
6
  export type MaligatorIntlFeature =
4
7
  | "collator"
5
8
  | "number-format"
@@ -11,48 +14,106 @@ export type MaligatorIntlFeature =
11
14
  | "relative-time-format"
12
15
  | "duration-format";
13
16
 
17
+ /**
18
+ * Capture a regular file or a directory tree at build time. Paths are relative to
19
+ * the project root. Directory patterns support *, ?, and whole-segment **;
20
+ * every pattern must match a regular file. Symlinks are rejected.
21
+ * @see https://maligator.ddv.tools/api/build#AssetInclusion
22
+ */
14
23
  export type AssetInclusion =
15
24
  | { type: "file"; path: string }
16
25
  | { type: "directory"; path: string; include: Array<string> };
17
26
 
27
+ /** Trusted, strictly validated configuration evaluated for each CLI invocation.
28
+ * @see https://maligator.ddv.tools/guides/build-configuration
29
+ */
18
30
  export interface MaligatorBuildConfig {
31
+ /** Project-root-relative entry; an explicit CLI entry takes precedence. */
19
32
  entry?: string;
33
+ /** Binary name; otherwise inferred from the unscoped package name or project directory. */
20
34
  outputName?: string;
35
+ /** Named build-time snapshots. Requires surface.maligator; portable serialized images cannot carry these filesystem resources. */
21
36
  assets?: Record<string, AssetInclusion>;
37
+ modules?: {
38
+ /** Exact specifier replacements applied before module resolution. Defaults to an empty map. */
39
+ aliases?: Record<string, string>;
40
+ };
22
41
  engine?: {
23
- /**
24
- * `true` embeds the runtime compiler. `false` keeps eval/Function present
25
- * but makes dynamic compilation throw at runtime. `"compile-check"` also
26
- * rejects statically visible eval/Function calls during the build.
42
+ /** Lock built-in objects for the entire build. Mutable is intended for compatibility experiments.
43
+ * @default "locked"
44
+ */
45
+ primordials?: "locked" | "mutable";
46
+ /** Control dynamic compilation. false leaves eval/Function present but makes calls throw;
47
+ * true embeds the compiler; compile-check also rejects statically visible calls at build time.
48
+ * @default false
49
+ * @see https://maligator.ddv.tools/api/build#engine.eval
27
50
  */
28
51
  eval?: boolean | "compile-check";
52
+ /** Include Realm support.
53
+ * @default false
54
+ */
29
55
  realms?: boolean;
56
+ /** Include RegExp; disabling it trades compatibility for binary size.
57
+ * @default true
58
+ */
30
59
  regexp?: boolean;
60
+ /** Include Temporal and its calendar/time-zone data.
61
+ * @default false
62
+ */
63
+ temporal?: boolean;
31
64
  intl?: {
65
+ /** Include internationalization services and their native data.
66
+ * @default false
67
+ */
32
68
  enabled?: boolean;
69
+ /** Select services. An empty list includes all services when enabled.
70
+ * @default []
71
+ */
33
72
  features?: Array<MaligatorIntlFeature>;
73
+ /** Locale-data filtering is not implemented; only an empty list is accepted.
74
+ * @default []
75
+ */
34
76
  languages?: Array<string>;
35
77
  };
36
78
  };
37
- host?: {
38
- scheduler?: "single" | "multiprocessing";
39
- };
40
79
  surface?: {
80
+ /** Include Web APIs and Mal.serve. Declarations alone do not enable them.
81
+ * @default false
82
+ */
41
83
  webPlatform?: boolean;
84
+ /** Include supported node: modules; see the compatibility table for coverage.
85
+ * @default false
86
+ */
42
87
  node?: boolean;
88
+ /** Include the mal namespace. Required for configured assets.
89
+ * @default true
90
+ */
43
91
  maligator?: boolean;
44
92
  };
45
93
  }
46
94
 
95
+ /** Preserve the inferred config type. Validation happens when the CLI loads the config.
96
+ * @example
97
+ * import { defineBuild } from "@maligator/cli";
98
+ * export default defineBuild({ entry: "src/index.ts" });
99
+ * @see https://maligator.ddv.tools/api/build#defineBuild
100
+ */
47
101
  export declare function defineBuild<const Config extends MaligatorBuildConfig>(
48
102
  config: Config,
49
103
  ): Config;
50
104
 
51
105
  export interface MaligatorMaterializeOptions {
106
+ /** Parent directory for the content-addressed materialization. Defaults to the OS temporary directory. */
52
107
  baseDirectory?: string;
53
108
  }
54
109
 
55
110
  export interface MaligatorAssets {
111
+ /**
112
+ * Atomically write a named snapshot and return its absolute file/directory path.
113
+ * Completed materializations are reused by content identity. Unknown names,
114
+ * invalid options, and filesystem failures throw synchronously.
115
+ * @see https://maligator.ddv.tools/api/runtime#mal.assets.materialize
116
+ */
56
117
  materialize(name: string, options?: MaligatorMaterializeOptions): string;
57
118
  }
58
119
 
@@ -61,29 +122,48 @@ export interface MaligatorRuntime {
61
122
  }
62
123
 
63
124
  export interface MaligatorServeOptions {
125
+ /** Bind address. Defaults to 0.0.0.0; use 127.0.0.1 for a local-only listener. */
64
126
  hostname?: string;
127
+ /** TCP port, 0 through 65535. Defaults to 0, which asks the OS to choose a port. */
65
128
  port?: number;
129
+ /** Handle a request with a Response or an awaited response. */
66
130
  fetch(request: Request): Response | PromiseLike<Response>;
131
+ /** Header deadline in milliseconds; 0 also selects the default. Integer 0..2147483647.
132
+ * @default 60000 */
133
+ headersTimeout?: number;
134
+ /** Request deadline in milliseconds; 0 also selects the default. Integer 0..2147483647.
135
+ * @default 300000 */
136
+ requestTimeout?: number;
137
+ /** Idle keep-alive deadline in milliseconds; 0 also selects the default. Integer 0..2147483647.
138
+ * @default 5000 */
139
+ keepAliveTimeout?: number;
140
+ /** Concurrent connection limit; 0 also selects the default. Integer 0..2147483647.
141
+ * @default 1024 */
142
+ maxConnections?: number;
67
143
  }
68
144
 
69
145
  export interface MaligatorServer {
146
+ /** Actual bound port, including an OS-selected port when the requested port was 0. */
70
147
  readonly port: number;
71
148
  }
72
149
 
73
150
  export interface MaligatorWebRuntime {
151
+ /**
152
+ * Start an HTTP listener. Requires surface.webPlatform. The current handle exposes
153
+ * its bound port; it has no public stop method. Invalid timeout/connection limits throw,
154
+ * as does a hostname that is not ASCII or is 64 characters or longer.
155
+ * @see https://maligator.ddv.tools/api/runtime#Mal.serve
156
+ */
74
157
  serve(options: MaligatorServeOptions): MaligatorServer;
75
158
  }
76
159
 
77
160
  declare global {
78
- /**
79
- * Maligator's core runtime namespace. Present when
80
- * `surface.maligator` is enabled.
161
+ /** Core namespace, available when surface.maligator is enabled.
162
+ * @see https://maligator.ddv.tools/api/runtime#mal
81
163
  */
82
164
  var mal: MaligatorRuntime;
83
-
84
- /**
85
- * Maligator's web-host extension namespace. Present when
86
- * `surface.webPlatform` is enabled.
165
+ /** Web host namespace, available when surface.webPlatform is enabled.
166
+ * @see https://maligator.ddv.tools/api/runtime#Mal
87
167
  */
88
168
  var Mal: MaligatorWebRuntime;
89
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maligator/cli",
3
- "version": "0.1.0-alpha.3",
3
+ "version": "0.1.0-alpha.30",
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,8 +30,15 @@
30
30
  "bin/maligator.js",
31
31
  "index.js",
32
32
  "index.d.ts",
33
+ "platform-api.d.ts",
34
+ "application-api.d.ts",
35
+ "process-api.d.ts",
36
+ "test-api.d.ts",
37
+ "workers-api.d.ts",
38
+ "workers-host-api.d.ts",
33
39
  "README.md",
34
- "LICENSE"
40
+ "LICENSE",
41
+ "THIRD_PARTY_NOTICES.md"
35
42
  ],
36
43
  "bin": {
37
44
  "maligator": "bin/maligator.js"
@@ -44,6 +51,9 @@
44
51
  }
45
52
  },
46
53
  "optionalDependencies": {
47
- "@maligator/cli-darwin-arm64": "0.1.0-alpha.3"
54
+ "@maligator/cli-darwin-arm64": "0.1.0-alpha.30",
55
+ "@maligator/cli-darwin-x64": "0.1.0-alpha.30",
56
+ "@maligator/cli-linux-arm64": "0.1.0-alpha.30",
57
+ "@maligator/cli-linux-x64": "0.1.0-alpha.30"
48
58
  }
49
59
  }
@@ -0,0 +1,6 @@
1
+ // Generated from src/platform/catalog.ts; edit the catalog and regenerate.
2
+ import "./application-api.d.ts";
3
+ import "./workers-api.d.ts";
4
+ import "./workers-host-api.d.ts";
5
+ import "./process-api.d.ts";
6
+ import "./test-api.d.ts";
@@ -0,0 +1,281 @@
1
+ // Generated from src/platform/catalog.ts; edit the catalog and regenerate.
2
+ /**
3
+ * Read the compile-time command, target, and resolved application configuration. No
4
+ * surface flag is required. Runtime arguments, environment, working directory, and
5
+ * PID are separate process values.
6
+ */
7
+ declare module "maligator:process" {
8
+ /**
9
+ * Profiling instrumentation: none by default; sampling for --profile; compiler for
10
+ * --profile=compiler. Both profiling modes select full optimization without
11
+ * selecting production application behavior.
12
+ *
13
+ * @see https://maligator.ddv.tools/api/process#ExecutionProfile
14
+ */
15
+ export type ExecutionProfile = "none" | "sampling" | "compiler";
16
+
17
+ /**
18
+ * The fixed platform contract of the application image.
19
+ *
20
+ * @see https://maligator.ddv.tools/api/process#ExecutionTarget
21
+ */
22
+ export type ExecutionTarget = {
23
+ /**
24
+ * Application operating-system target, not the compiler host. Native builds use
25
+ * darwin or linux; WebAssembly uses wasi.
26
+ */
27
+ readonly platform: "darwin" | "linux" | "wasi";
28
+ /**
29
+ * Application architecture. Cross builds report the destination architecture.
30
+ */
31
+ readonly arch: "arm64" | "x64" | "wasm32";
32
+ /**
33
+ * Resolved target triple, including when --target was omitted; for example
34
+ * aarch64-apple-darwin.
35
+ */
36
+ readonly triple: string;
37
+ };
38
+
39
+ /**
40
+ * Options shared by build, run, and dev. Output paths, verbosity, and compiler
41
+ * scheduling are tool settings and are not exposed.
42
+ *
43
+ * @see https://maligator.ddv.tools/api/process#ExecutionOptions
44
+ */
45
+ export type ExecutionOptions = {
46
+ /**
47
+ * Selected application profiling instrumentation. Defaults to none; does not imply
48
+ * execution.production.
49
+ */
50
+ readonly profile: ExecutionProfile;
51
+ };
52
+
53
+ /**
54
+ * Normalized test settings, fixed for the application image. Changing these values
55
+ * invalidates specialized test artifacts.
56
+ *
57
+ * @see https://maligator.ddv.tools/api/process#TestExecutionOptions
58
+ */
59
+ export type TestExecutionOptions = {
60
+ /**
61
+ * Selected test profiling instrumentation. Defaults to none; profiling preserves
62
+ * command: test.
63
+ */
64
+ readonly profile: ExecutionProfile;
65
+ /**
66
+ * Hierarchical test-name filter from --run, or null when all discovered names are
67
+ * eligible.
68
+ */
69
+ readonly nameFilter: string | null;
70
+ /**
71
+ * Number of requested test repetitions from --repeat; defaults to 1. This is not
72
+ * the currently executing repetition.
73
+ */
74
+ readonly repeat: number;
75
+ /**
76
+ * Whether --bail stops the test run after its first failure. Defaults to false.
77
+ */
78
+ readonly bail: boolean;
79
+ /**
80
+ * Test callback timeout in milliseconds from --timeout. Defaults to 5000.
81
+ */
82
+ readonly timeoutMs: number;
83
+ /**
84
+ * Resolved positive shuffle seed, or null when shuffling is disabled. --shuffle
85
+ * without a seed chooses it once before compilation; the same seed drives execution
86
+ * and cache identity.
87
+ */
88
+ readonly shuffleSeed: number | null;
89
+ };
90
+
91
+ /**
92
+ * Resolved engine policies. These describe build inputs, never post-DCE native
93
+ * feature inclusion.
94
+ *
95
+ * @see https://maligator.ddv.tools/api/process#ExecutionEngineConfig
96
+ */
97
+ export type ExecutionEngineConfig = {
98
+ /**
99
+ * Requested primordial mutation policy. Defaults to locked. The execution snapshot
100
+ * itself is immutable in either policy.
101
+ */
102
+ readonly primordials: "locked" | "mutable";
103
+ /**
104
+ * Dynamic compilation policy. false (default) rejects eval/Function execution at
105
+ * runtime; true enables the runtime compiler; compile-check additionally rejects
106
+ * statically visible dynamic compilation calls.
107
+ */
108
+ readonly eval: boolean | "compile-check";
109
+ /**
110
+ * Whether additional realms are enabled. Defaults to false.
111
+ */
112
+ readonly realms: boolean;
113
+ /**
114
+ * Whether regular expressions are enabled. Defaults to true.
115
+ */
116
+ readonly regexp: boolean;
117
+ /**
118
+ * Whether Temporal and its required data are enabled. Defaults to false.
119
+ */
120
+ readonly temporal: boolean;
121
+ /**
122
+ * Requested Intl policy after applying configuration defaults.
123
+ */
124
+ readonly intl: {
125
+ /**
126
+ * Whether Intl is enabled. Defaults to false.
127
+ */
128
+ readonly enabled: boolean;
129
+ /**
130
+ * Requested Intl service names. An empty array selects the default complete
131
+ * service set when Intl is enabled; it does not mean every service survived tree
132
+ * shaking.
133
+ */
134
+ readonly features: ReadonlyArray<string>;
135
+ /**
136
+ * Requested locale selection. Defaults to an empty array. Unsupported locale
137
+ * selections are rejected by configuration validation.
138
+ */
139
+ readonly languages: ReadonlyArray<string>;
140
+ };
141
+ };
142
+
143
+ /**
144
+ * Resolved application engine, Web/Node surface, and module policies. Excludes
145
+ * build-host paths, asset declarations, and output controls.
146
+ *
147
+ * @see https://maligator.ddv.tools/api/process#ExecutionConfig
148
+ */
149
+ export type ExecutionConfig = {
150
+ /**
151
+ * Engine configuration after validation and default resolution.
152
+ */
153
+ readonly engine: ExecutionEngineConfig;
154
+ /**
155
+ * Global and compatibility surface policy. maligator:process requires no enable
156
+ * flag.
157
+ */
158
+ readonly surface: {
159
+ /**
160
+ * Whether Web globals are requested. Defaults to false; native module imports are
161
+ * independent of this global installation policy.
162
+ */
163
+ readonly webPlatform: boolean;
164
+ /**
165
+ * Whether Node compatibility, globals, and node: module resolution are requested.
166
+ * Defaults to false.
167
+ */
168
+ readonly node: boolean;
169
+ };
170
+ /**
171
+ * Resolved module-resolution policy.
172
+ */
173
+ readonly modules: {
174
+ /**
175
+ * Exact module-specifier replacements from configuration. Defaults to an empty
176
+ * object. Alias entries are immutable own data properties.
177
+ */
178
+ readonly aliases: Readonly<Record<string, string>>;
179
+ };
180
+ };
181
+
182
+ /**
183
+ * Fields shared by every execution workflow. All nested objects and arrays are
184
+ * deeply frozen at runtime.
185
+ *
186
+ * @see https://maligator.ddv.tools/api/process#ExecutionCommon
187
+ */
188
+ export type ExecutionCommon = {
189
+ /**
190
+ * Explicit production application intent. True only when production was selected
191
+ * for the application; independent of NODE_ENV, profiling, and optimization.
192
+ * Currently --production is a build option. Defaults to false.
193
+ */
194
+ readonly production: boolean;
195
+ /**
196
+ * Whether the application image executes as native compiled code. A native
197
+ * executable hosting an interpreted image reports false. This is fixed for the
198
+ * image, not a query about the current stack frame or an eval-created function.
199
+ */
200
+ readonly compiled: boolean;
201
+ /**
202
+ * Actual selected frontend optimization policy. Ordinary commands currently use
203
+ * development; production builds and profiling use full. Backend choice is
204
+ * independent.
205
+ */
206
+ readonly optimization: "development" | "full";
207
+ /**
208
+ * Resolved application target. The compiler's host platform is not substituted
209
+ * during a cross build.
210
+ */
211
+ readonly target: ExecutionTarget;
212
+ /**
213
+ * Validated configuration policies with defaults applied, captured before
214
+ * compilation.
215
+ */
216
+ readonly config: ExecutionConfig;
217
+ };
218
+
219
+ /**
220
+ * An immutable application-image description, discriminated by command. The command
221
+ * describes the workflow that prepared the image, not a transient process phase.
222
+ *
223
+ * @see https://maligator.ddv.tools/api/process#Execution
224
+ */
225
+ export type Execution = ExecutionCommon &
226
+ (
227
+ | {
228
+ /**
229
+ * Prepared by maligator build. Remains build when the resulting executable runs
230
+ * later; application statements are not executed by the build itself.
231
+ */
232
+ readonly command: "build";
233
+ /**
234
+ * Normalized build options relevant to application execution.
235
+ */
236
+ readonly options: ExecutionOptions;
237
+ }
238
+ | {
239
+ /**
240
+ * Prepared by maligator run or maligator dev. dev denotes the watch/restart
241
+ * workflow even when profiling selects native compilation.
242
+ */
243
+ readonly command: "run" | "dev";
244
+ /**
245
+ * Normalized run/dev options. Arguments after -- remain runtime argv and do not
246
+ * specialize application compilation.
247
+ */
248
+ readonly options: ExecutionOptions;
249
+ }
250
+ | {
251
+ /**
252
+ * Prepared by maligator test. Preserved for interpreted tests, profiled native
253
+ * tests, and every fragment of the test application.
254
+ */
255
+ readonly command: "test";
256
+ /**
257
+ * Normalized test options. Narrow command to test before accessing test-only
258
+ * fields.
259
+ */
260
+ readonly options: TestExecutionOptions;
261
+ }
262
+ );
263
+
264
+ /**
265
+ * An immutable snapshot of the workflow, target, and resolved configuration, fixed
266
+ * before compilation. Known property reads can specialize application branches.
267
+ * Runtime arguments, environment, working directory, and PID are outside this
268
+ * snapshot. Profiling does not change production intent. Static and dynamic imports
269
+ * share its identity, and reflection sees the complete deeply frozen shape.
270
+ *
271
+ * @example
272
+ * import { execution } from "maligator:process";
273
+ *
274
+ * if (execution.compiled && execution.production) {
275
+ * console.log("native production application");
276
+ * }
277
+ *
278
+ * @see https://maligator.ddv.tools/api/process#execution
279
+ */
280
+ export const execution: Execution;
281
+ }