Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getFiles() {
// Provide FCGCI client files manually
return {
'fastcgi/connection.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/connection.js'),
}),
'fastcgi/consts.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/consts.js'),
}),
'fastcgi/stringifykv.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/stringifykv.js'),
}),
'fastcgi/index.js': new FileFsRef({
fsPath: path.join(__dirname, 'fastcgi/index.js'),
}),
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
})
};
}
function getFiles() {
// Provide FCGCI client files manually
return {
'fastcgi/connection.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/connection.js'),
}),
'fastcgi/consts.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/consts.js'),
}),
'fastcgi/stringifykv.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/stringifykv.js'),
}),
'fastcgi/index.js': new FileFsRef({
fsPath: path.join(__dirname, 'fastcgi/index.js'),
}),
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
})
};
}
function getFiles() {
// Provide FCGCI client files manually
return {
'fastcgi/connection.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/connection.js'),
}),
'fastcgi/consts.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/consts.js'),
}),
'fastcgi/stringifykv.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/stringifykv.js'),
}),
'fastcgi/index.js': new FileFsRef({
fsPath: path.join(__dirname, 'fastcgi/index.js'),
}),
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
})
};
}
function getFiles() {
// Provide FCGCI client files manually
return {
'fastcgi/connection.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/connection.js'),
}),
'fastcgi/consts.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/consts.js'),
}),
'fastcgi/stringifykv.js': new FileFsRef({
fsPath: require.resolve('fastcgi-client/lib/stringifykv.js'),
}),
'fastcgi/index.js': new FileFsRef({
fsPath: path.join(__dirname, 'fastcgi/index.js'),
}),
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
})
};
}
const includedFiles = await getIncludedFiles({ files, workPath, config, meta });
const userFiles = rename(includedFiles, name => path.join('user', name));
const bridgeConfig = { ...config, ...{ 'mode': 'fpm' } };
const bridgeFiles = {
...await getPhpFiles({ workPath, config: bridgeConfig }),
...{
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
}),
'caddy': new FileFsRef({
mode: 0o755,
fsPath: path.join(__dirname, 'caddy/caddy'),
}),
'Caddyfile': new FileFsRef({
fsPath: path.join(__dirname, 'caddy/Caddyfile'),
}),
}
};
console.log('Entrypoint:', entrypoint);
console.log('Config:', bridgeConfig);
console.log('Work path:', workPath);
console.log('Meta:', meta);
console.log('User files:', Object.keys(userFiles));
console.log('Bridge files:', Object.keys(bridgeFiles));
const lambda = await createLambda({
files: { ...userFiles, ...bridgeFiles },
handler: 'launcher.launcher',
runtime: 'nodejs10.x',
exports.build = async ({
files, entrypoint, workPath, config, meta,
}) => {
const downloadedFiles = await download(files, workPath, meta);
const userFiles = rename(downloadedFiles, name => path.join('user', name));
const bridgeFiles = {
...await getFiles(),
...{
'bootstrap': new FileFsRef({
mode: 0o755,
fsPath: path.join(__dirname, 'bootstrap'),
}),
}
};
console.log('Entrypoint:', entrypoint);
console.log('Config:', config);
console.log('Work path:', workPath);
console.log('Meta:', meta);
console.log('User files:', Object.keys(userFiles));
console.log('Bridge files:', Object.keys(bridgeFiles));
const lambda = await createLambda({
files: { ...userFiles, ...bridgeFiles },
handler: entrypoint,
function getFiles() {
return {
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
}),
};
}
function getFiles() {
return {
'launcher.js': new FileFsRef({
fsPath: path.join(__dirname, 'launcher.js'),
}),
};
}