@maligator/cli 0.1.0-alpha.27 → 0.1.0-alpha.29
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 +28 -198
- package/THIRD_PARTY_NOTICES.md +6357 -0
- package/application-api.d.ts +23 -0
- package/index.d.ts +86 -16
- package/package.json +10 -6
- package/platform-api.d.ts +3 -0
- package/process-api.d.ts +28 -25
- package/test-api.d.ts +32 -0
- package/workers-api.d.ts +445 -0
- package/workers-host-api.d.ts +135 -0
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ maligator run -- first-argument "two words"
|
|
|
38
38
|
|
|
39
39
|
`maligator init` creates `maligator.build.ts`. If it cannot find an existing entry
|
|
40
40
|
point, it also creates `src/index.ts`. `doctor` checks the native build toolchain,
|
|
41
|
-
`build` produces a development executable, and `run`
|
|
41
|
+
`build` produces a development executable, and `run` compiles a development image and executes it while
|
|
42
42
|
forwarding everything after `--` to the application.
|
|
43
43
|
|
|
44
44
|
Useful commands:
|
|
@@ -64,206 +64,37 @@ native toolchain. `dev` retains compiler identities between edits and restarts a
|
|
|
64
64
|
application VM after every successful rebuild. Build failures keep the watcher alive
|
|
65
65
|
for recovery on the next edit.
|
|
66
66
|
|
|
67
|
-
##
|
|
67
|
+
## Documentation
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
generate C or invoke the native toolchain. Import the Maligator-owned API from
|
|
72
|
-
`maligator:test`:
|
|
69
|
+
Use the [guides](https://maligator.ddv.tools/guides) for application workflows and
|
|
70
|
+
the [API reference](https://maligator.ddv.tools/api) for exact contracts.
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
- [Getting started](https://maligator.ddv.tools/guides/getting-started)
|
|
73
|
+
- [Development](https://maligator.ddv.tools/guides/development) and
|
|
74
|
+
[TypeScript](https://maligator.ddv.tools/guides/typescript)
|
|
75
|
+
- [Application testing](https://maligator.ddv.tools/guides/testing)
|
|
76
|
+
- [Workers](https://maligator.ddv.tools/guides/workers)
|
|
77
|
+
- [Build configuration](https://maligator.ddv.tools/guides/build-configuration)
|
|
78
|
+
- [Embedded files](https://maligator.ddv.tools/guides/assets) and
|
|
79
|
+
[HTTP](https://maligator.ddv.tools/guides/http)
|
|
80
|
+
- [Production](https://maligator.ddv.tools/guides/production) and
|
|
81
|
+
[profiling](https://maligator.ddv.tools/guides/profiling)
|
|
82
|
+
- [CLI commands and flags](https://maligator.ddv.tools/api/cli)
|
|
77
83
|
|
|
78
|
-
|
|
79
|
-
|
|
84
|
+
The package ships types for configuration, runtime globals, and public `maligator:`
|
|
85
|
+
modules. Include `@maligator/cli` in `compilerOptions.types` when your TypeScript
|
|
86
|
+
project excludes the build file. Declarations do not enable optional runtime surfaces;
|
|
87
|
+
choose those in `maligator.build.ts`.
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
test("matches parameters", async () => {
|
|
86
|
-
await expect(router.match("/users/42")).resolves.toMatchObject({
|
|
87
|
-
id: expect.any(Number),
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("rejects malformed parameters", async () => {
|
|
92
|
-
await expect(router.match("/users/nope")).rejects.toThrow(RouteError);
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
By default, discovery includes `*.test.js`, `*.test.mjs`, `*.test.ts`,
|
|
98
|
-
`*.test.mts`, and the corresponding `*.spec.*` names. Pass files, directories,
|
|
99
|
-
or both:
|
|
100
|
-
|
|
101
|
-
```shell
|
|
102
|
-
maligator test
|
|
103
|
-
maligator test src/router
|
|
104
|
-
maligator test src/router/router.test.ts
|
|
105
|
-
maligator test --run "router > parameters"
|
|
106
|
-
maligator test --shuffle
|
|
107
|
-
maligator test --shuffle 18492
|
|
108
|
-
maligator test --repeat 10
|
|
109
|
-
maligator test --bail
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
`--run` filters hierarchical suite and test names. `--shuffle [seed]` changes
|
|
113
|
-
execution order reproducibly and always prints the seed. `--repeat` executes the
|
|
114
|
-
selected tests again while reusing unchanged compilation artifacts. The default
|
|
115
|
-
policy completes the selected suite; `--bail` stops scheduling after the first
|
|
116
|
-
failure.
|
|
117
|
-
|
|
118
|
-
The authoring API includes nested `describe` suites, `beforeAll`, `afterAll`,
|
|
119
|
-
`beforeEach`, `afterEach`, synchronous and promise-returning callbacks,
|
|
120
|
-
`test.skip`, `test.todo`, `test.only`, and `test.each`. A committed `.only`
|
|
121
|
-
focuses execution and prints a warning. Matchers include identity, structural
|
|
122
|
-
equality, truthiness, containment, length, string/regular-expression matching,
|
|
123
|
-
partial-object matching, throwing, `.not`, `.resolves`, `.rejects`, and the
|
|
124
|
-
`expect.any`, `expect.anything`, `expect.stringMatching`,
|
|
125
|
-
`expect.objectContaining`, and `expect.arrayContaining` asymmetric helpers.
|
|
126
|
-
Maligator owns this API and does not claim Jest, Vitest, or `node:test`
|
|
127
|
-
compatibility.
|
|
128
|
-
|
|
129
|
-
Test files currently execute serially in one Realm. Registration and lifecycle
|
|
130
|
-
state are separated by test file, but globals, prototypes, imported module
|
|
131
|
-
singletons, host state, and asynchronous work left running by a test can be
|
|
132
|
-
shared. Do not rely on process-per-file isolation.
|
|
133
|
-
|
|
134
|
-
Frontend bytecode is content-addressed by source, transitive dependencies,
|
|
135
|
-
resolved module identities, relevant build configuration, and compiler/runtime
|
|
136
|
-
format versions. A warm run restores a shared base plus independently cached
|
|
137
|
-
test-file registration fragments. Test results are never cached: every selected
|
|
138
|
-
test executes on every invocation.
|
|
139
|
-
|
|
140
|
-
The package ships documented declarations for `maligator:test`. Projects whose
|
|
141
|
-
TypeScript configuration does not include `maligator.build.ts` should load the
|
|
142
|
-
package declarations explicitly:
|
|
143
|
-
|
|
144
|
-
```json
|
|
145
|
-
{
|
|
146
|
-
"compilerOptions": {
|
|
147
|
-
"types": ["@maligator/cli"]
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Build cache
|
|
153
|
-
|
|
154
|
-
Normal `maligator build`, `maligator run`, and `maligator test` commands share a
|
|
155
|
-
content-addressed portable VM definition store. On a valid hit, Maligator skips
|
|
156
|
-
parsing, module-graph construction, semantic analysis, optimization, register
|
|
157
|
-
allocation, and VM lowering. For supported Intl-disabled development profiles, `run`
|
|
158
|
-
executes the restored definition with a matching compile-time-specialized runtime
|
|
159
|
-
embedded in the platform CLI; it does not generate C or invoke a native toolchain.
|
|
160
|
-
Normal and production `build` commands emit
|
|
161
|
-
native translation units from the same restored definition. Those units and the native driver are
|
|
162
|
-
compiled into independently content-addressed objects, so unchanged objects can
|
|
163
|
-
be relinked without repeating C compilation. The final link still runs, and
|
|
164
|
-
native runtime and Rust archives remain separately content-addressed. Runtime C
|
|
165
|
-
objects use their preprocessed input as the feature projection, while distinct
|
|
166
|
-
Rust feature archives share Cargo dependency work. Output executables remain
|
|
167
|
-
statically linked and self-contained.
|
|
168
|
-
|
|
169
|
-
Build cache invalidation includes source and transitive dependency content,
|
|
170
|
-
package-resolution metadata, relevant configuration, the TypeScript erasure
|
|
171
|
-
frontend, and compiler/wire versions. Generated-object identity additionally
|
|
172
|
-
includes the exact C source, source identity, native headers/runtime artifact,
|
|
173
|
-
compiler/toolchain, target, flags, and build environment. Compiler diagnostic
|
|
174
|
-
dump flags deliberately recompile the frontend because they require live
|
|
175
|
-
semantic and IR objects.
|
|
176
|
-
|
|
177
|
-
## Production builds
|
|
178
|
-
|
|
179
|
-
Use production mode for a deployable binary:
|
|
180
|
-
|
|
181
|
-
```shell
|
|
182
|
-
maligator build --production
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
Production builds use optimized native compilation, add LTO when the toolchain
|
|
186
|
-
supports it, and strip native symbols when possible. To create a self-contained
|
|
187
|
-
artifact directory with a manifest, license, checksum, and binary:
|
|
188
|
-
|
|
189
|
-
```shell
|
|
190
|
-
maligator build --production --artifact dist/my-application
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
The artifact destination must be absent or empty. Launch the reported binary
|
|
194
|
-
directly; neither Node.js nor the Maligator CLI is needed at runtime.
|
|
195
|
-
|
|
196
|
-
## Configuration
|
|
197
|
-
|
|
198
|
-
`maligator.build.ts` is trusted TypeScript configuration. A small configuration
|
|
199
|
-
looks like this:
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
import { defineBuild } from "@maligator/cli";
|
|
203
|
-
|
|
204
|
-
export default defineBuild({
|
|
205
|
-
entry: "src/index.ts",
|
|
206
|
-
outputName: "my-application",
|
|
207
|
-
engine: {
|
|
208
|
-
eval: false,
|
|
209
|
-
intl: { enabled: false },
|
|
210
|
-
},
|
|
211
|
-
surface: {
|
|
212
|
-
webPlatform: false,
|
|
213
|
-
node: false,
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
All fields are optional. Maligator excludes optional engine and host surfaces unless
|
|
219
|
-
the configuration requests them. See the
|
|
220
|
-
[full configuration reference](https://github.com/dirkdev98/maligator#configuration)
|
|
221
|
-
for assets, Intl features, Node compatibility, web-platform support, and target
|
|
222
|
-
selection.
|
|
223
|
-
|
|
224
|
-
## TypeScript
|
|
225
|
-
|
|
226
|
-
The package includes declarations for `maligator.build.ts` and Maligator's runtime
|
|
227
|
-
globals. Keeping the generated build file inside your TypeScript project makes the
|
|
228
|
-
types available automatically:
|
|
229
|
-
|
|
230
|
-
```typescript
|
|
231
|
-
const path = mal.assets.materialize("templates", {
|
|
232
|
-
baseDirectory: ".cache/my-application",
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
const server = Mal.serve({
|
|
236
|
-
hostname: "127.0.0.1",
|
|
237
|
-
port: 3000,
|
|
238
|
-
async fetch(request) {
|
|
239
|
-
return new Response(`Hello from ${request.url}`);
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
console.log(path, server.port);
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
`mal` is present when `surface.maligator` is enabled. `Mal` and `Mal.serve` are
|
|
247
|
-
present when `surface.webPlatform` is enabled. The declarations describe both
|
|
248
|
-
optional surfaces, while `maligator.build.ts` controls which globals exist in the
|
|
249
|
-
compiled application.
|
|
250
|
-
|
|
251
|
-
If your `tsconfig.json` excludes `maligator.build.ts`, load the declarations
|
|
252
|
-
explicitly:
|
|
253
|
-
|
|
254
|
-
```json
|
|
255
|
-
{
|
|
256
|
-
"compilerOptions": {
|
|
257
|
-
"types": ["@maligator/cli"]
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
```
|
|
89
|
+
Every page has a Markdown counterpart. The
|
|
90
|
+
[public symbol index](https://maligator.ddv.tools/reference.json) provides signatures,
|
|
91
|
+
defaults, availability, and direct links.
|
|
261
92
|
|
|
262
93
|
## Build toolchain
|
|
263
94
|
|
|
264
95
|
`maligator test` and supported `maligator run` profiles use the development runtime
|
|
265
96
|
embedded in the platform CLI and do not require a native toolchain. Native `build`
|
|
266
|
-
commands
|
|
97
|
+
commands and development runs using Intl require:
|
|
267
98
|
|
|
268
99
|
- A C23 compiler and archive tool: Apple clang, clang 19 or newer, or GCC 15 or
|
|
269
100
|
newer
|
|
@@ -273,15 +104,14 @@ commands—and development runs using Intl—require:
|
|
|
273
104
|
On macOS, install Apple command-line tools with `xcode-select --install`. On Linux,
|
|
274
105
|
install a recent compiler and set `CC` and `CXX` when it is not your system default.
|
|
275
106
|
Run `maligator doctor --verbose` for resolved tool paths, versions, capabilities,
|
|
276
|
-
and installation hints.
|
|
277
|
-
[native
|
|
278
|
-
|
|
107
|
+
and installation hints.
|
|
108
|
+
[Set up native builds](https://maligator.ddv.tools/guides/native-toolchain) has the
|
|
109
|
+
full requirements and cross-compilation instructions.
|
|
279
110
|
|
|
280
111
|
## Alpha support
|
|
281
112
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
release notes before upgrading on another host. Windows is not supported.
|
|
113
|
+
Native packages cover macOS and glibc-based Linux on arm64 and x64. Windows is not
|
|
114
|
+
supported.
|
|
285
115
|
|
|
286
116
|
There is no source-build fallback for the CLI package. The alpha binaries are
|
|
287
117
|
unsigned, and macOS binaries are not notarized. APIs, configuration, and supported
|