@gasket/plugin-nextjs
Version:
Adds Next support to your application
43 lines (42 loc) • 1.35 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
getNextConfig: function() {
return getNextConfig;
},
getNextRoute: function() {
return getNextRoute;
}
});
const _config = require("./utils/config.cjs");
const _nextroute = /*#__PURE__*/ _interop_require_default(require("./utils/next-route.cjs"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
/** @type {import('@gasket/core').ActionHandler<'getNextConfig'>} */ function getNextConfig(gasket, nextConfig) {
return async function setupNextConfig(phase, { defaultConfig }) {
await gasket.isReady;
let baseConfig;
if (nextConfig instanceof Function) {
baseConfig = await nextConfig(phase, {
defaultConfig
});
} else {
baseConfig = nextConfig ?? {};
}
return await (0, _config.createConfig)(gasket, baseConfig);
};
}
/** @type {import('@gasket/core').ActionHandler<'getNextRoute'>} */ async function getNextRoute(gasket, req) {
await gasket.isReady;
return await (0, _nextroute.default)(gasket, req);
}