UNPKG

stackpress

Version:

Incept is a content management framework.

25 lines (24 loc) 766 B
export default function plugin(ctx) { ctx.on('config', async (_req, _res, ctx) => { if (!ctx.config.get('client')) return; const module = ctx.config.path('client.module', '.client'); try { const client = await ctx.loader.import(module); ctx.register('client', client); } catch (e) { } }, 10); ctx.on('idea', async (req) => { const transformer = req.data('transformer'); const schema = await transformer.schema(); if (!schema.plugin) { schema.plugin = {}; } const dirname = typeof __dirname === 'string' ? __dirname : import.meta.dirname; schema.plugin[`${dirname}/transform`] = {}; }); } ;