Lines 15-55javascript
15import { runPluginMigrations } from './migrate.js';
16import { setProCapabilities } from './contract.js';
17// Boot binding for the optional @pierre/pro plugin. The plugin lives in a PRIVATE
18// git submodule at packages/pro (often absent — a pure-OSS checkout never has it).
19// It is deliberately NOT a declared dependency, so `pnpm install` succeeds without
20// it; we resolve it by FILESYSTEM PATH rather than a bare specifier (no package.json
21// coupling). Submodule absent → no entry file on disk → clean OSS no-op.
22export async function bindProPlugin(app) {
23 if (!config.proEnabled)
24 return; // master gate (Pro is local-only for now)
25 // here = apps/backend/{src|dist}/pro/bind.{ts|js} → repo root is four levels up.
26 const here = fileURLToPath(import.meta.url);
27 const repoRoot = resolve(dirname(here), '../../../..');
29 join(repoRoot, 'packages/pro/dist/index.js'), // built plugin (node)
30 join(repoRoot, 'packages/pro/src/index.ts'), // source (tsx dev)
33 app.log.debug('pro plugin submodule absent — OSS mode');
36 const mod = await import(pathToFileURL(entry).href).catch((err) => {
37 app.log.warn({ err }, 'pro plugin present but failed to load — OSS mode');
MediumDynamic Require
Package source references dynamic require/import behavior.
dist/pro/bind.jsView on unpkg · L35 42 const plugin = (mod.default ?? mod);
43 if (plugin?.apiVersion !== 3 || typeof plugin.register !== 'function') {
44 app.log.warn({ apiVersion: plugin?.apiVersion }, 'pro contract mismatch — skipped');
50 version: process.env.npm_package_version ?? '0.0.0',
51 deploymentMode: config.deploymentMode,
52 isCloud: config.isCloud,