The data half of the extraction: 8 model directories, 13 utils, the shard
stream catalog and the 27-table schema fragment with its purge.
server/core.js is what makes the port a one-line import change per file rather
than a signature change per function. Ported code requires its dependencies at
file scope -- `const { query } = require('../../core')` -- which runs before
register() has been called and before any ctx exists. So every member is a
stable function that resolves ctx when CALLED, and nothing may be destructured
off ctx at init either, because core is free to hand over a getter.
Two helpers are vendored rather than taken from ctx, and the line between them
is the point. utils/excerpt.js is core's deriveExcerpt -- nine lines of pure
text handling. Core's sanitiser next to it was NOT copied: a second copy of a
security control diverges silently the moment either is fixed. announceLinks.js
vendors legError and articleUrl the same way, but baseUrl could not be: core's
reads APP_BASE_URL, and §2.7 forbids a module reading core's environment, so it
comes off ctx.site.baseUrl.
The schema fragment is core's 27 shard_*/uo_link_* statements, verbs CREATE,
ALTER and UPDATE only, every CREATE TABLE guarded. Two of its tables carry a
foreign key INTO users, which is allowed and is why the replay order matters --
core's schema is in place before this runs. The reverse never occurs and must
not: it would make core unable to boot without a module installed.
One real port bug caught by the integration run, not by tests: the atlas art
map resolved `../../../db/data`, which pointed at core's tree when this file
lived there and points outside server/ now. A path that happens to resolve is
exactly what survives a green suite, because the absent-file branch returns {}
and looks like the normal case.
Co-Authored-By: Claude <noreply@anthropic.com>
25 lines
1.1 KiB
JSON
25 lines
1.1 KiB
JSON
{
|
|
"name": "module-uo-server",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "Server half of module-uo — routers, models and the schema fragment core loads at boot",
|
|
"license": "GPL-3.0-or-later",
|
|
"main": "index.js",
|
|
"scripts": {
|
|
"test": "node --test --require ./test/_setup.js",
|
|
"check:imports": "node scripts/checkImports.js"
|
|
},
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"//dependencies": "The ONE runtime dependency, and it ships inside the release tarball: CI runs npm ci --omit=dev and packs server/node_modules, because an operator never builds (MODULE_SYSTEM.md 1.14). Node resolves it by walking up from modules/uo/server/. Everything else the shipped half needs arrives on ctx (MODULE_API.md 2.3) - express, express-validator, the database, the logger, the middleware and the rate-limit factory are all core-owned and handed over.",
|
|
"devDependencies": {
|
|
"express": "^4.19.2",
|
|
"express-validator": "^7.2.0"
|
|
},
|
|
"dependencies": {
|
|
"ws": "^8.21.0"
|
|
},
|
|
"//devDependencies": "Test-only. test/_fakes.js builds a REAL express router - a fake Router would test the fake."
|
|
}
|