Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 1x 1x 1x | import {checkSubject, type PrimitiveDescriptor} from '../engine.ts';
/** `layer` — a named functional group inside a realm. */
const layer: PrimitiveDescriptor = {
id: 'layer',
title: 'Layer',
skill: 'blong-layer',
summary:
'A named functional group inside a realm. Well-known folders are auto-discovered; ' +
'custom folders need a layer.<platform>.ts activation file.',
kinds: ['server', 'browser', 'custom'],
defaultKind: 'custom',
roots: [],
check(ctx) {
const problems = checkSubject(ctx.subject);
if (ctx.kind === 'custom' && !ctx.layer)
problems.push('layer is required for custom folders');
return problems;
},
files(ctx) {
const platform = ctx.platform;
const dir = ctx.layer ?? ctx.params.folder ?? `${ctx.subject}-${ctx.object}`;
return [
{
path: `${dir}/layer.${platform}.ts`,
content: `import {layer} from '@feasibleone/blong';
export default layer({default: true, integration: true});
`,
},
];
},
};
export default layer;
|