vendor: update cordis / loader
This commit is contained in:
7
vendor/README.md
vendored
7
vendor/README.md
vendored
@@ -14,15 +14,15 @@ Upstream workspace: `cordis-workspace` (local checkout: `~/repos/cordis-workspac
|
||||
|---|---|---|---|---|
|
||||
| `cosmokit/` | `cosmokit` | 1.8.1 | https://github.com/deepseek-harness/cosmokit | `16f6fc058ade66e8ac5da0033d35a8d0f279f544` |
|
||||
| `schemastery/` | `schemastery` | 3.18.0 | https://github.com/deepseek-harness/schemastery (`packages/core`) | `e67cee00ad725bd1534aee930a979ea3eec6f698` |
|
||||
| `cordis/` | `cordis` | 4.0.0-rc.6 | https://github.com/deepseek-harness/cordis (`packages/core`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
| `loader/` | `@cordisjs/plugin-loader` | 1.0.0-rc.4 | https://github.com/deepseek-harness/cordis (`packages/loader`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
| `cordis/` | `cordis` | 4.0.0-rc.7 | https://github.com/cordiverse/cordis (`packages/core`) | `56b3d4f725681cf4556c1a8695a709cc3b6eed74` |
|
||||
| `loader/` | `@cordisjs/plugin-loader` | 1.0.0-rc.5 | https://github.com/cordiverse/cordis (`packages/loader`) | `56b3d4f725681cf4556c1a8695a709cc3b6eed74` |
|
||||
| `include/` | `@cordisjs/plugin-include` | 1.0.4 | https://github.com/deepseek-harness/cordis (`packages/include`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
| `group/` | `@cordisjs/plugin-group` | 1.0.0 | https://github.com/deepseek-harness/cordis (`packages/group`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
| `timer/` | `@cordisjs/plugin-timer` | 1.1.2 | https://github.com/deepseek-harness/cordis (`packages/timer`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
| `hmr/` | `@cordisjs/plugin-hmr` | 1.0.15 | https://github.com/deepseek-harness/cordis (`packages/hmr`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
| `logger-console/` | `@cordisjs/plugin-logger-console` | 1.0.0 | https://github.com/deepseek-harness/cordis (`packages/logger-console`) | `abb0a307cb1d3b0947f455d590cf5ba922d4caa4` |
|
||||
|
||||
Third-party dependencies of the vendored packages stay on npm: `@standard-schema/spec`, `js-yaml`, `chokidar`, `picomatch`, `@babel/code-frame`, `supports-color`.
|
||||
Third-party dependencies of the vendored packages stay on npm: `@standard-schema/spec`, `js-yaml`, `chokidar`, `picomatch`, `@babel/code-frame`, `supports-color`, `node-addon-require-builtin`.
|
||||
|
||||
Intentionally **not** vendored (verified unused by this set): `reggol`, `@cordisjs/utils`, `@cordisjs/element`, `@cordisjs/unyaml` (dev-time YAML import hook only).
|
||||
|
||||
@@ -36,7 +36,6 @@ Keep this log exhaustive — every divergence from upstream must be listed.
|
||||
4. **Vendored TypeScript source internal specifiers**: changed local relative imports/exports from upstream's specifier shape to explicit `.ts` specifiers so TypeScript rewrites emitted JS to `.js` while declarations keep explicit, NodeNext-safe `.ts` specifiers. This includes `loader/src/config/isolate.ts` using `declare module './entry.ts'`.
|
||||
5. **`schemastery/tsdown.config.ts` and `logger-console/tsdown.config.ts`**: ours, not upstream files — per-package build-shape overrides (dual ESM+CJS output; separate node/browser entries) for the repo-root tsdown build. They read the JS emitted under `lib/types` and then write the publish runtime entries under `lib/`. Like the regenerated tsconfigs, they are not part of the upstream sync surface.
|
||||
6. **`cordis/src/fiber.ts` lifecycle hardening**: locally closes three reentrant disposal gaps. An effect's owner-list wrapper is registered before its setup body runs, so an unload begun from inside setup awaits setup and every collected cleanup; synchronous setup failure removes the wrapper and rolls back collected cleanup. Async cleanup stays owner-visible until quiescence, and Cordis's internal effect composition joins an already-running cleanup while repeated public disposer calls retain their upstream single-shot result. Effect creation is rejected while the owner is `UNLOADING` (while `PENDING` and `LOADING` remain legal), preventing cleanup-time registrations from escaping the unload snapshot. Child fibers register and receive their parent-owned disposer before `internal/plugin` publication, resolve dependency declarations added by that notification before activation, drain effects attached while pending, skip plugin execution when reentrant disposal invalidates the load epoch before its first checkpoint, and contain teardown-notification failures per observer so one callback cannot starve peers or interrupt ownership cleanup.
|
||||
7. **`cordis/src/events.ts`**: a `FIXME` documents the upstream `parallel()` bug where a synchronous listener throw aborts callback enumeration and starves later listeners; runtime behavior remains upstream-identical pending an upstream fix.
|
||||
|
||||
## Sync procedure
|
||||
|
||||
|
||||
4
vendor/cordis/package.json
vendored
4
vendor/cordis/package.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cordis",
|
||||
"description": "Meta-Framework for Modern JavaScript Applications",
|
||||
"version": "4.0.0-rc.6",
|
||||
"version": "4.0.0-rc.7",
|
||||
"private": true,
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
@@ -26,7 +26,7 @@
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"@cordisjs/plugin-include": "^1.0.4",
|
||||
"@cordisjs/plugin-loader": "^1.0.0-rc.4"
|
||||
"@cordisjs/plugin-loader": "^1.0.0-rc.5"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@cordisjs/plugin-include": {
|
||||
|
||||
6
vendor/cordis/src/events.ts
vendored
6
vendor/cordis/src/events.ts
vendored
@@ -106,9 +106,9 @@ export class EventsService {
|
||||
|
||||
/** Run listeners concurrently and wait for all of them. */
|
||||
async parallel(...args: any[]) {
|
||||
// FIXME(cordis upstream): A synchronous listener throw aborts callback
|
||||
// enumeration here and starves later parallel listeners. Fix upstream.
|
||||
await Promise.all(this.dispatch('emit', args).map(cb => cb(...args)))
|
||||
const results = await Promise.allSettled(this.dispatch('emit', args).map(async cb => cb(...args)))
|
||||
const errors = results.filter((result): result is PromiseRejectedResult => result.status === 'rejected')
|
||||
if (errors.length) throw new AggregateError(errors.map(error => error.reason))
|
||||
}
|
||||
|
||||
/** Run listeners synchronously without waiting for returned promises. */
|
||||
|
||||
4
vendor/cordis/src/fiber.ts
vendored
4
vendor/cordis/src/fiber.ts
vendored
@@ -189,7 +189,7 @@ export class Fiber {
|
||||
this._runner = {
|
||||
epoch: INACTIVE,
|
||||
getOuterStack,
|
||||
execute: () => {
|
||||
execute: function () {
|
||||
if (isConstructor(runtime.callback)) {
|
||||
// eslint-disable-next-line new-cap
|
||||
const instance = new runtime.callback(this.ctx, this.config)
|
||||
@@ -307,7 +307,7 @@ export class Fiber {
|
||||
throw new TypeError('Invalid effect')
|
||||
}
|
||||
}
|
||||
const effect: Effect = runner.execute()
|
||||
const effect: Effect = runner.execute.call(this)
|
||||
if (typeof effect === 'function') {
|
||||
return runner.collect(effect)
|
||||
} else if (isNullable(effect)) {
|
||||
|
||||
5
vendor/cordis/src/reflect.ts
vendored
5
vendor/cordis/src/reflect.ts
vendored
@@ -229,6 +229,11 @@ export class ReflectService {
|
||||
fibers.push(fiber)
|
||||
}
|
||||
}
|
||||
for (const name of names) {
|
||||
const self: Context = Object.create(this.ctx)
|
||||
self[symbols.filter] = (target: Context) => filter(target, name)
|
||||
this.ctx.events.emit(self, 'internal/service', name, this._getImpl(name, false)?.value)
|
||||
}
|
||||
return fibers
|
||||
}
|
||||
|
||||
|
||||
10
vendor/loader/package.json
vendored
10
vendor/loader/package.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@cordisjs/plugin-loader",
|
||||
"description": "Plugin loader for cordis",
|
||||
"version": "1.0.0-rc.4",
|
||||
"version": "1.0.0-rc.5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "lib/index.js",
|
||||
@@ -23,7 +23,13 @@
|
||||
"author": "Shigma <shigma10826@gmail.com>",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"cordis": "^4.0.0-rc.6"
|
||||
"cordis": "^4.0.0-rc.7",
|
||||
"node-addon-require-builtin": "^0.1.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"node-addon-require-builtin": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"cosmokit": "^1.8.1"
|
||||
|
||||
24
vendor/loader/src/internal.ts
vendored
24
vendor/loader/src/internal.ts
vendored
@@ -105,18 +105,28 @@ export type ModuleLoader = ModuleLoaderV1 | ModuleLoaderV2
|
||||
export namespace ModuleLoader {
|
||||
let _cachedLoader: ModuleLoader | undefined
|
||||
|
||||
export function fromInternal(): ModuleLoader | undefined {
|
||||
if (!process.execArgv.includes('--expose-internals')) return
|
||||
if (_cachedLoader) return _cachedLoader
|
||||
function requireInternal(id: string): any {
|
||||
const require = createRequire(import.meta.url)
|
||||
if (process.execArgv.includes('--expose-internals')) {
|
||||
try {
|
||||
return require(id)
|
||||
} catch {}
|
||||
}
|
||||
try {
|
||||
return require('node-addon-require-builtin').requireBuiltin(id)
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export function fromInternal(): ModuleLoader | undefined {
|
||||
if (_cachedLoader) return _cachedLoader
|
||||
const [major] = process.versions.node.split('.').map(Number)
|
||||
|
||||
if (major >= 24) {
|
||||
const raw = require('internal/modules/esm/loader').getOrInitializeCascadedLoader()
|
||||
return _cachedLoader = Object.assign(raw, { version: 'v2' })
|
||||
const raw = requireInternal('internal/modules/esm/loader')?.getOrInitializeCascadedLoader()
|
||||
if (raw) return _cachedLoader = Object.assign(raw, { version: 'v2' })
|
||||
} else if (major >= 22) {
|
||||
const raw = require('internal/modules/esm/loader').getOrInitializeCascadedLoader()
|
||||
return _cachedLoader = Object.assign(raw, { version: 'v1' })
|
||||
const raw = requireInternal('internal/modules/esm/loader')?.getOrInitializeCascadedLoader()
|
||||
if (raw) return _cachedLoader = Object.assign(raw, { version: 'v1' })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user