UNPKG

@netlify/content-engine

Version:
28 lines 1.28 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.startPluginRunner = void 0; const index_1 = require("./index"); const api_runner_node_1 = __importDefault(require("../utils/api-runner-node")); const startPluginRunner = () => { const plugins = index_1.store.getState().flattenedPlugins; const pluginsImplementingOnCreateNode = plugins.filter((plugin) => plugin.nodeAPIs.includes(`onCreateNode`)); // We make page nodes outside of the normal action for speed so we manually // call onCreateNode here for SitePage nodes. if (pluginsImplementingOnCreateNode.length > 0) { index_1.emitter.on(`CREATE_NODE`, (action) => { const node = action.payload; if (node.internal.type === `SitePage`) { (0, api_runner_node_1.default)(`onCreateNode`, { node, parentSpan: action.parentSpan, traceTags: { nodeId: node.id, nodeType: node.internal.type }, }); } }); } }; exports.startPluginRunner = startPluginRunner; //# sourceMappingURL=plugin-runner.js.map