cordis 4.0.0-rc.6, plugin-loader, -include, -group, -timer, -hmr, -logger-console, cosmokit 1.8.1, schemastery 3.18.0 — copied from the cordis-workspace checkout, flattened under vendor/, original npm names, private: true. vendor/README.md is the manifest: upstream repos + commit SHAs, local-modification log, sync procedure. Local modification: hmr's locale YAML imports and .i18n() call removed (avoids a runtime YAML import hook we don't vendor).
44 lines
1.0 KiB
Markdown
44 lines
1.0 KiB
Markdown
# @cordisjs/plugin-include
|
|
|
|
File-backed loader tree for Cordis. The include plugin reads a YAML or JSON
|
|
file, turns it into loader entries, and writes updates back when the file is
|
|
writable.
|
|
|
|
## Usage
|
|
|
|
```ts
|
|
import { Context } from 'cordis'
|
|
import Loader from '@cordisjs/plugin-loader'
|
|
import Include from '@cordisjs/plugin-include'
|
|
|
|
const root = new Context()
|
|
await root.plugin(Loader, { baseUrl: import.meta.url })
|
|
await root.plugin(Include, {
|
|
path: './cordis.yml',
|
|
initial: [],
|
|
enableLogs: true,
|
|
})
|
|
```
|
|
|
|
Example `cordis.yml`:
|
|
|
|
```yaml
|
|
- id: timer
|
|
name: '@cordisjs/plugin-timer'
|
|
- id: app
|
|
name: ./plugins/app
|
|
config:
|
|
message: hello
|
|
```
|
|
|
|
## Config
|
|
|
|
| Field | Description |
|
|
| --- | --- |
|
|
| `path` | YAML or JSON file path resolved from `ctx.baseUrl`. |
|
|
| `initial` | Entry list written when the file is missing. |
|
|
| `patches` | Runtime patches applied after reading the file. |
|
|
| `enableLogs` | Enables loader apply, reload, and unload logs. |
|
|
|
|
Patches can insert entries or override fields on entries with a matching `id`.
|