Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
debug('Running `go build`...');
const destPath = join(outDir, 'handler');
try {
const src = [
join(entrypointDirname, mainGoFileName),
downloadedFiles[entrypoint].fsPath,
];
await go.build(src, destPath);
} catch (err) {
console.log('failed to `go build`');
throw err;
}
}
const lambda = await createLambda({
files: { ...(await glob('**', outDir)), ...includedFiles },
handler: 'handler',
runtime: 'go1.x',
environment: {},
});
const watch = parsedAnalyzed.watch;
let watchSub: string[] = [];
// if `entrypoint` located in subdirectory
// we will need to concat it with return watch array
if (entrypointArr.length > 1) {
entrypointArr.pop();
watchSub = parsedAnalyzed.watch.map(file => join(...entrypointArr, file));
}
return {
...nodeModules
}
// Extra files to be included in lambda
const serverFiles = [
...(Array.isArray(config.serverFiles) ? config.serverFiles : []),
'package.json'
]
for (const pattern of serverFiles) {
const files = await glob(pattern, rootDir)
Object.assign(launcherFiles, files)
}
// lambdaName will be titled index, unless specified in nuxt.config.js
lambdas[lambdaName] = await createLambda({
handler: 'now__launcher.launcher',
runtime: meta.isDev ? 'nodejs' : nodeVersion.runtime,
files: launcherFiles,
environment: {
NODE_ENV: 'production'
}
})
// await download(launcherFiles, rootDir)
endStep()
return {
output: {
...lambdas,
...clientDistFiles,
if (shouldAddSourcemapSupport) {
launcherFiles[`${SOURCEMAP_SUPPORT_FILENAME}.js`] = new FileFsRef({
fsPath: join(__dirname, 'source-map-support.js'),
});
}
if (shouldAddHelpers) {
launcherFiles[`${HELPERS_FILENAME}.js`] = new FileFsRef({
fsPath: join(__dirname, 'helpers.js'),
});
}
// Use the system-installed version of `node` when running via `now dev`
const runtime = meta.isDev ? 'nodejs' : nodeVersion.runtime;
const lambda = await createLambda({
files: {
...preparedFiles,
...launcherFiles,
},
handler: `${LAUNCHER_FILENAME}.launcher`,
runtime,
});
return { output: lambda, watch };
}
}
console.log("Mountpoint is: " + JSON.stringify(mountpoint));
console.log("Routes are: " + JSON.stringify(routes));
validateDistDir(distPath, meta.isDev, config);
const statics = await build_utils_1.glob("**", distPath, mountpoint);
console.log("Output files are: " + JSON.stringify(statics));
console.log("Server.js is: " + JSON.stringify(statics["server.js"]));
const launcherFiles = {
"now__bridge.js": new build_utils_1.FileFsRef({
fsPath: require("@now/node-bridge")
}),
"now__launcher.js": new build_utils_1.FileFsRef({
fsPath: path_1.default.join(__dirname, "launcher.js")
})
};
const lambda = await build_utils_1.createLambda({
runtime: "nodejs8.10",
handler: "now__launcher.launcher",
files: {
...launcherFiles,
"index.js": new build_utils_1.FileFsRef({
fsPath: statics["server.js"].fsPath
})
}
});
const output = {
...statics,
"main.js": lambda
};
console.log("Finished!");
return { routes, output };
}
validateDistDir(distPath, meta.isDev, config);
const statics = await glob("static/**", distPath);
const server = await glob("server.js", distPath);
const favicon = await glob("favicon.ico", workPath);
const launcherFiles = {
"now__bridge.js": new FileFsRef({
fsPath: require("@now/node-bridge")
}),
"now__launcher.js": new FileFsRef({
fsPath: path.join(__dirname, "launcher.js")
})
};
const lambda = await createLambda({
runtime: "nodejs12.x",
handler: "now__launcher.launcher",
files: {
...launcherFiles,
"index.js": new FileFsRef({
fsPath: server["server.js"].fsPath
})
}
});
const output = {
...statics,
...favicon,
"server.js": lambda
};