UNPKG

@serverless-stack/nextjs-lambda

Version:

Provides handlers that can be used in CloudFront Lambda@Edge to deploy next.js applications to the edge

24 lines (23 loc) 963 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ThirdPartyIntegrationBase = void 0; const path_1 = require("path"); const fs_extra_1 = __importDefault(require("fs-extra")); class ThirdPartyIntegrationBase { constructor(nextConfigDir, outputHandlerDir) { this.nextConfigDir = nextConfigDir; this.outputHandlerDir = outputHandlerDir; } async isPackagePresent(name) { const packageJsonPath = (0, path_1.join)(this.nextConfigDir, "package.json"); if (await fs_extra_1.default.pathExists(packageJsonPath)) { const packageJson = await fs_extra_1.default.readJSON(packageJsonPath); return !!packageJson.dependencies[name]; } return false; } } exports.ThirdPartyIntegrationBase = ThirdPartyIntegrationBase;