imccyu 6af96785b5 release(vendor): cordis 4.0.2, cosmokit 1.8.3, group 1.0.2, hmr 1.0.17, include 1.0.7, loader 1.0.3, logger-console 1.0.2, schemastery 3.18.2, timer 1.1.4 1 неделя назад
..
src c598989d08 refactor(cmdline): trim the command-line seams to existing interfaces 3 недель назад
LICENSE 72688a3888 Vendor Cordis framework packages as source 2 месяцев назад
README.md 72688a3888 Vendor Cordis framework packages as source 2 месяцев назад
package.json 6af96785b5 release(vendor): cordis 4.0.2, cosmokit 1.8.3, group 1.0.2, hmr 1.0.17, include 1.0.7, loader 1.0.3, logger-console 1.0.2, schemastery 3.18.2, timer 1.1.4 1 неделя назад
tsconfig.json 7f131dd4d8 refactor: rename build typings dir to types 2 месяцев назад

README.md

@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

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:

- 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.