@antelopejs/core 1.21.1 → 1.21.3
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 +39 -33
- package/dist/cli/commands/config/reset-action.js +24 -5
- package/dist/cli/commands/config/reset-action.js.map +1 -1
- package/dist/cli/commands/module/create-module.js +5 -9
- package/dist/cli/commands/module/create-module.js.map +1 -1
- package/dist/cli/commands/module/init-action.d.ts +1 -1
- package/dist/cli/commands/module/init-action.js +14 -10
- package/dist/cli/commands/module/init-action.js.map +1 -1
- package/dist/cli/commands/project/modules/add-action.js +1 -2
- package/dist/cli/commands/project/modules/add-action.js.map +1 -1
- package/dist/cli/commands/project/modules/install-action.d.ts +1 -0
- package/dist/cli/commands/project/modules/install-action.js +8 -24
- package/dist/cli/commands/project/modules/install-action.js.map +1 -1
- package/dist/cli/commands/project/modules/install.js +1 -0
- package/dist/cli/commands/project/modules/install.js.map +1 -1
- package/dist/cli/commands/project/modules/interface-check.d.ts +11 -0
- package/dist/cli/commands/project/modules/interface-check.js +167 -0
- package/dist/cli/commands/project/modules/interface-check.js.map +1 -0
- package/dist/cli/commands/project/modules/update-action.d.ts +1 -0
- package/dist/cli/commands/project/modules/update-action.js +12 -0
- package/dist/cli/commands/project/modules/update-action.js.map +1 -1
- package/dist/cli/commands/project/modules/update.js +1 -0
- package/dist/cli/commands/project/modules/update.js.map +1 -1
- package/dist/cli/config-source-edits.js +27 -2
- package/dist/cli/config-source-edits.js.map +1 -1
- package/dist/cli/lazy-action.d.ts +1 -1
- package/dist/core/build/index.d.ts +1 -0
- package/dist/core/build/index.js.map +1 -1
- package/dist/core/build/interface-ranges.d.ts +7 -1
- package/dist/core/build/interface-ranges.js +5 -4
- package/dist/core/build/interface-ranges.js.map +1 -1
- package/dist/core/cli/index.js +2 -0
- package/dist/core/cli/index.js.map +1 -1
- package/dist/core/config/config-fields.d.ts +2 -1
- package/dist/core/config/config-fields.js +71 -0
- package/dist/core/config/config-fields.js.map +1 -1
- package/dist/core/config/config-loader.js.map +1 -1
- package/dist/core/config/config-var-store.js +20 -3
- package/dist/core/config/config-var-store.js.map +1 -1
- package/dist/core/config/ts-config-file.js +6 -5
- package/dist/core/config/ts-config-file.js.map +1 -1
- package/dist/core/downloaders/local-folder.d.ts +1 -0
- package/dist/core/downloaders/local-folder.js +4 -1
- package/dist/core/downloaders/local-folder.js.map +1 -1
- package/dist/core/downloaders/local.d.ts +1 -0
- package/dist/core/downloaders/local.js +4 -1
- package/dist/core/downloaders/local.js.map +1 -1
- package/dist/core/downloaders/package.js +19 -7
- package/dist/core/downloaders/package.js.map +1 -1
- package/dist/core/downloaders/registry.d.ts +10 -4
- package/dist/core/downloaders/registry.js +4 -1
- package/dist/core/downloaders/registry.js.map +1 -1
- package/dist/core/embedded/runtime.js.map +1 -1
- package/dist/core/modules/index.d.ts +1 -0
- package/dist/core/modules/index.js +1 -0
- package/dist/core/modules/index.js.map +1 -1
- package/dist/core/modules/interface-bumps.d.ts +26 -0
- package/dist/core/modules/interface-bumps.js +128 -0
- package/dist/core/modules/interface-bumps.js.map +1 -0
- package/dist/core/modules/lifecycle-signals.d.ts +1 -1
- package/dist/core/modules/lifecycle-signals.js +14 -7
- package/dist/core/modules/lifecycle-signals.js.map +1 -1
- package/dist/core/modules/module-manager-construction.js +23 -1
- package/dist/core/modules/module-manager-construction.js.map +1 -1
- package/dist/core/modules/module-manager-context.d.ts +5 -0
- package/dist/core/modules/module-manager-context.js +9 -0
- package/dist/core/modules/module-manager-context.js.map +1 -1
- package/dist/core/modules/module-manager-lifecycle.js +8 -1
- package/dist/core/modules/module-manager-lifecycle.js.map +1 -1
- package/dist/core/modules/module-manager-operations.js +2 -0
- package/dist/core/modules/module-manager-operations.js.map +1 -1
- package/dist/core/modules/module-manager-packages.d.ts +2 -0
- package/dist/core/modules/module-manager-packages.js +28 -5
- package/dist/core/modules/module-manager-packages.js.map +1 -1
- package/dist/core/modules/module-manager.d.ts +4 -2
- package/dist/core/modules/module-manager.js +10 -0
- package/dist/core/modules/module-manager.js.map +1 -1
- package/dist/core/output/command.js +4 -1
- package/dist/core/output/command.js.map +1 -1
- package/dist/core/output/index.d.ts +1 -0
- package/dist/core/output/index.js +1 -0
- package/dist/core/output/index.js.map +1 -1
- package/dist/core/output/logging-utils.d.ts +2 -2
- package/dist/core/output/logging-utils.js +12 -14
- package/dist/core/output/logging-utils.js.map +1 -1
- package/dist/core/output/package-json-layout.d.ts +5 -0
- package/dist/core/output/package-json-layout.js +171 -0
- package/dist/core/output/package-json-layout.js.map +1 -0
- package/dist/core/output/package-manager.js +2 -2
- package/dist/core/output/package-manager.js.map +1 -1
- package/dist/core/repl/index.d.ts +0 -1
- package/dist/core/repl/index.js +0 -1
- package/dist/core/repl/index.js.map +1 -1
- package/dist/core/repl/project-launch.js +16 -9
- package/dist/core/repl/project-launch.js.map +1 -1
- package/dist/core/{repl/repl-session.js → repl-session/index.js} +1 -1
- package/dist/core/repl-session/index.js.map +1 -0
- package/dist/core/resolution/instance-copies.js +4 -1
- package/dist/core/resolution/instance-copies.js.map +1 -1
- package/dist/core/runtime/build-runtime.js +5 -1
- package/dist/core/runtime/build-runtime.js.map +1 -1
- package/dist/core/runtime/dev-server-registry.js +4 -1
- package/dist/core/runtime/dev-server-registry.js.map +1 -1
- package/dist/core/runtime/launch-sequence.js +18 -1
- package/dist/core/runtime/launch-sequence.js.map +1 -1
- package/dist/core/runtime/launch-steps.d.ts +1 -0
- package/dist/core/runtime/launch-steps.js +17 -4
- package/dist/core/runtime/launch-steps.js.map +1 -1
- package/dist/core/runtime/module-loading.js +3 -2
- package/dist/core/runtime/module-loading.js.map +1 -1
- package/dist/core/runtime/runtime-types.d.ts +3 -0
- package/dist/core/runtime/watch/file-hasher.d.ts +2 -0
- package/dist/core/runtime/watch/file-hasher.js +18 -0
- package/dist/core/runtime/watch/file-hasher.js.map +1 -1
- package/dist/core/runtime/watch/file-watcher.d.ts +5 -1
- package/dist/core/runtime/watch/file-watcher.js +25 -14
- package/dist/core/runtime/watch/file-watcher.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/utils/package-resolution.js +19 -1
- package/dist/utils/package-resolution.js.map +1 -1
- package/package.json +5 -5
- package/skills/ajs-cli/SKILL.md +19 -6
- package/skills/antelopejs/SKILL.md +1 -1
- package/dist/core/repl/repl-session.js.map +0 -1
- /package/dist/core/{repl/repl-session.d.ts → repl-session/index.d.ts} +0 -0
package/skills/ajs-cli/SKILL.md
CHANGED
|
@@ -31,17 +31,17 @@ ajs project logging show|set # view/change logging settings
|
|
|
31
31
|
ajs project modules list # configured modules + their sources (alias: ls; -j for JSON)
|
|
32
32
|
ajs project modules add <modules...> # add & download modules you name (-m, --mode package|git|local|dir; default package = npm)
|
|
33
33
|
ajs project modules remove <modules...> # remove from config (alias: rm; -f, --force)
|
|
34
|
-
ajs project modules update [modules...] # bump npm modules to their latest versions
|
|
35
|
-
ajs project modules install # add a provider module for every unresolved interface (-y: never ask)
|
|
34
|
+
ajs project modules update [modules...] # bump npm modules to their latest versions, resolve their locks again, check interface versions (--dry-run, --fix)
|
|
35
|
+
ajs project modules install # add a provider module for every unresolved interface, then check interface versions (-y: never ask, --fix)
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
`add` in package mode accepts `<name>@<exact|range|dist-tag>`; without a spec it writes a caret range of the latest version. `add` does no interface resolution.
|
|
39
39
|
|
|
40
40
|
`modules add|remove|update|install` and `logging set` edit only the values they change in `antelope.config.ts` and keep the rest of the source. They change a value only when it is a plain literal. On an expression (`version: CORE_VERSION`, `process.env.X ?? "1.0.0"`) they fail, name the value to edit by hand, and leave the file unchanged: make that edit, do not inline the expression to silence the error.
|
|
41
41
|
|
|
42
|
-
`modules install` (not `add`) fixes **unresolved imports**, and despite its name it installs no npm dependencies: it finds the interfaces no loaded module implements, looks up their implementing modules in the interface repository, and writes the chosen one into `antelope.config.ts`. A single implementer is added without a question; with several it asks, or takes the first with `-y`. It then
|
|
42
|
+
`modules install` (not `add`) fixes **unresolved imports**, and despite its name it installs no npm dependencies: it finds the interfaces no loaded module implements, looks up their implementing modules in the interface repository, and writes the chosen one into `antelope.config.ts`. A single implementer is added without a question; with several it asks, or takes the first with `-y`. It then runs the interface version check, which `modules update` also runs.
|
|
43
43
|
|
|
44
|
-
`
|
|
44
|
+
`modules install` and `modules update` find, for each interface package, the highest installed copy every module's range accepts. When the copy a launch would share is older, they fail (exit `1`) with `Interface packages need a newer copy` and the exact change: a raised floor in a local module's `package.json` (`^0.1.8 → ^0.1.9`), or an npm module whose dependencies must be resolved again (`modules update <module>`). `--fix` applies the changes, reinstalls and checks again. A local module that only compiles against an older copy gets a warning. For an interface nothing implements, the shared copy is that highest accepted copy, whatever the module order. `build`, `start` and `dev` fail with `Incompatible interface package resolution` when a module's declared range excludes the shared copy; run `modules install` to get the exact change, or update the module. Do not skip the build check. A module marked `optional: true` that would conflict only produces a warning, as `start` runs without it.
|
|
45
45
|
|
|
46
46
|
Modules declared in `antelope.config.ts` are downloaded into `.antelope/cache` by `dev`, `build`, and `modules add`; a module's own npm dependencies install inside its cache folder.
|
|
47
47
|
|
|
@@ -49,12 +49,25 @@ Modules declared in `antelope.config.ts` are downloaded into `.antelope/cache` b
|
|
|
49
49
|
|
|
50
50
|
## Embedded mode: no `ajs project`
|
|
51
51
|
|
|
52
|
-
In **embedded** mode the host application (AdonisJS, Express, Fastify…) owns the process and starts the runtime itself with `createRuntime({ projectFolder, modules, uses })` from `@antelopejs/core`, calling `start()` and `stop()` from its own lifecycle (in AdonisJS, a service provider). Recognize it before running any `ajs project` command: **no `antelope.config.*`**, and a host file calls `createRuntime`.
|
|
52
|
+
In **embedded** mode the host application (AdonisJS, Express, Fastify…) owns the process and starts the runtime itself with `createRuntime({ projectFolder, modules, uses, provides })` from `@antelopejs/core`, calling `start()` and `stop()` from its own lifecycle (in AdonisJS, a service provider). Recognize it before running any `ajs project` command: **no `antelope.config.*`**, and a host file calls `createRuntime`.
|
|
53
53
|
|
|
54
54
|
- **No `ajs project …`**: `dev`, `build`, `start`, `modules add|remove|install` and `logging` need `antelope.config.ts` and do not apply. `envOverrides` and `environments` do not exist; configure modules in host code.
|
|
55
55
|
- **Modules are listed in code**, as keys of the `modules` map (`'@antelopejs/mongodb': { config: { ... } }`). To add one, `pnpm add` it (modules resolve from the host's `node_modules` or a local path, never `.antelope/cache`), add its key to the map, and restart the host.
|
|
56
56
|
- **No hot reload**: the runtime forces `dev: false`, so modules apply their production behaviour (e.g. `@antelopejs/api` needs `publicBaseUrl` and listens on its own port). In a DMS app, `ajs dms dev` does not work either: build and start the dashboard (the **dms-project** skill).
|
|
57
|
-
- Host code reaches an interface through `runtime.use("<interface package>")`, never a plain `import` of `@antelopejs/interface-*`.
|
|
57
|
+
- Host code reaches an interface through `runtime.use("<interface package>[/subpath]")`, never a plain `import` of `@antelopejs/interface-*`. Declare each request in the `EmbeddedInterfaces` map of `@antelopejs/core` first; a request missing from the map fails with TS2345. `use()` takes no type argument: it returns the declared type, so replace an old `runtime.use<T>("<request>")` with a map entry `"<request>": T`.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
declare module "@antelopejs/core" {
|
|
61
|
+
interface EmbeddedInterfaces {
|
|
62
|
+
"@antelopejs/interface-database": typeof import("@antelopejs/interface-database");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const database = runtime.use("@antelopejs/interface-database");
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Type-only imports (`import type`, `typeof import(...)`) are safe in host code; a value import loads a second copy with no provider.
|
|
70
|
+
- For modules to call into the host, `runtime.provide(packageName, implementation)` after `start()`: the package must be listed in `provides` and declared in the same `EmbeddedInterfaces` map, which types `implementation`. Call `detach()` on the returned handle to remove it.
|
|
58
71
|
- `ajs module init` and `ajs module test` still work on module folders.
|
|
59
72
|
|
|
60
73
|
Guide: <https://framework.antelopejs.com/docs/guides/embedded-runtime>.
|
|
@@ -9,7 +9,7 @@ AntelopeJS is a modular Node.js framework. Read this overview first, then jump t
|
|
|
9
9
|
|
|
10
10
|
## The model in one screen
|
|
11
11
|
|
|
12
|
-
- **Core + CLI (`ajs`)** — a small runtime that loads modules, wires their interfaces together, and manages the dev/build/start lifecycle. Users rarely edit the core; they run it via `ajs` (modules declared in `antelope.config.ts`). It can also run **embedded** as a guest inside a host app that owns the process (`createRuntime` from `@antelopejs/core`, e.g. the AdonisJS DMS template): no `antelope.config.ts`, modules are plain npm dependencies, and host code reaches interfaces through `runtime.use("<interface package>[/subpath]")`, never by importing them.
|
|
12
|
+
- **Core + CLI (`ajs`)** — a small runtime that loads modules, wires their interfaces together, and manages the dev/build/start lifecycle. Users rarely edit the core; they run it via `ajs` (modules declared in `antelope.config.ts`). It can also run **embedded** as a guest inside a host app that owns the process (`createRuntime` from `@antelopejs/core`, e.g. the AdonisJS DMS template): no `antelope.config.ts`, modules are plain npm dependencies, and host code reaches interfaces through `runtime.use("<interface package>[/subpath]")`, never by importing them, after declaring each request in the `EmbeddedInterfaces` map of `@antelopejs/core` (see **ajs-cli**, Embedded mode).
|
|
13
13
|
- **Modules** — independent units of functionality. A module may import **interfaces**, never another module's files. Its *only* links to the rest of the project are the interface proxy points it attaches to — nothing else crosses the boundary.
|
|
14
14
|
- **Interfaces** — **versioned contracts**, usually published as standalone `@<scope>/interface-<name>` packages (a module may also start with an *embedded* interface it exports itself, e.g. `@acme/broker/interface`, and extract it once a second implementation appears). An interface package contains the **proxy points** (`InterfaceFunction`, `EventProxy`, `RegisteringProxy`, …) that actually cross to the provider, the **types** that pass across — and often substantial **client-side code** built over those proxies. It is not just empty slots: the `database` interface is mostly chainable `Table`/`Query`/`Datum` classes that assemble a query *in the caller's process*, crossing the boundary only when `.run()` invokes the underlying `RunQuery` proxy. The contract is the package's whole TypeScript surface (`exports` subpaths + `.d.ts`), versioned with semver git tags. **Interfaces may depend on other interfaces** (e.g. `data-api` builds on `api`, `api-util`, `core`, `database`, and `database-decorators`) — that composition is allowed and normal. What's forbidden is modules reaching into each other.
|
|
15
15
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repl-session.js","sourceRoot":"","sources":["../../../src/core/repl/repl-session.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkD;AAWlD,MAAa,WAAW;IAIZ;IACA;IAJF,MAAM,CAAc;IAE5B,YACU,OAAoB,EACpB,aAA0B,mBAAI,CAAC,KAAK;QADpC,YAAO,GAAP,OAAO,CAAa;QACpB,eAAU,GAAV,UAAU,CAA0B;IAC3C,CAAC;IAEJ,KAAK,CAAC,SAAiB,IAAI;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC;IACvB,CAAC;CACF;AAjBD,kCAiBC"}
|
|
File without changes
|