UNPKG

@netlify/content-engine

Version:
17 lines 666 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getEngineContext = getEngineContext; exports.runWithEngineContext = runWithEngineContext; const async_hooks_1 = require("async_hooks"); let asyncLocalStorage; function getAsyncLocalStorage() { return asyncLocalStorage ?? (asyncLocalStorage = new async_hooks_1.AsyncLocalStorage()); } function getEngineContext() { return getAsyncLocalStorage().getStore(); } function runWithEngineContext(context, fn) { // @ts-ignore typings are incorrect, run() returns the result of fn() return getAsyncLocalStorage().run(context, fn); } //# sourceMappingURL=engine-context.js.map