Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vercel/redwood

Package Overview
Dependencies
Maintainers
8
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vercel/redwood - npm Package Compare versions

Comparing version 1.0.45 to 1.0.49

90

dist/index.js

@@ -14,4 +14,4 @@ "use strict";

const build = async ({ workPath, files, entrypoint, meta = {}, config = {}, }) => {
await (0, build_utils_1.download)(files, workPath, meta);
const prefixedEnvs = (0, build_utils_1.getPrefixedEnvVars)({
await build_utils_1.download(files, workPath, meta);
const prefixedEnvs = build_utils_1.getPrefixedEnvVars({
envPrefix: 'REDWOOD_ENV_',

@@ -24,11 +24,11 @@ envs: process.env,

const { installCommand, buildCommand } = config;
const mountpoint = (0, path_1.dirname)(entrypoint);
const entrypointFsDirname = (0, path_1.join)(workPath, mountpoint);
const nodeVersion = await (0, build_utils_1.getNodeVersion)(entrypointFsDirname, undefined, config, meta);
const spawnOpts = (0, build_utils_1.getSpawnOptions)(meta, nodeVersion);
const mountpoint = path_1.dirname(entrypoint);
const entrypointFsDirname = path_1.join(workPath, mountpoint);
const nodeVersion = await build_utils_1.getNodeVersion(entrypointFsDirname, undefined, config, meta);
const spawnOpts = build_utils_1.getSpawnOptions(meta, nodeVersion);
if (!spawnOpts.env) {
spawnOpts.env = {};
}
const { cliType, lockfileVersion } = await (0, build_utils_1.scanParentDirs)(entrypointFsDirname);
spawnOpts.env = (0, build_utils_1.getEnvForPackageManager)({
const { cliType, lockfileVersion } = await build_utils_1.scanParentDirs(entrypointFsDirname);
spawnOpts.env = build_utils_1.getEnvForPackageManager({
cliType,

@@ -42,3 +42,3 @@ lockfileVersion,

console.log(`Running "install" command: \`${installCommand}\`...`);
await (0, build_utils_1.execCommand)(installCommand, {
await build_utils_1.execCommand(installCommand, {
...spawnOpts,

@@ -53,3 +53,3 @@ cwd: entrypointFsDirname,

else {
await (0, build_utils_1.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
await build_utils_1.runNpmInstall(entrypointFsDirname, [], spawnOpts, meta, nodeVersion);
}

@@ -59,7 +59,7 @@ if (meta.isDev) {

}
const pkg = await (0, build_utils_1.readConfigFile)((0, path_1.join)(workPath, 'package.json'));
const toml = await (0, build_utils_1.readConfigFile)((0, path_1.join)(workPath, 'redwood.toml'));
const pkg = await build_utils_1.readConfigFile(path_1.join(workPath, 'package.json'));
const toml = await build_utils_1.readConfigFile(path_1.join(workPath, 'redwood.toml'));
if (buildCommand) {
(0, build_utils_1.debug)(`Executing build command "${buildCommand}"`);
await (0, build_utils_1.execCommand)(buildCommand, {
build_utils_1.debug(`Executing build command "${buildCommand}"`);
await build_utils_1.execCommand(buildCommand, {
...spawnOpts,

@@ -70,8 +70,8 @@ cwd: workPath,

else if (hasScript('vercel-build', pkg)) {
(0, build_utils_1.debug)(`Executing "yarn vercel-build"`);
await (0, build_utils_1.runPackageJsonScript)(workPath, 'vercel-build', spawnOpts);
build_utils_1.debug(`Executing "yarn vercel-build"`);
await build_utils_1.runPackageJsonScript(workPath, 'vercel-build', spawnOpts);
}
else if (hasScript('build', pkg)) {
(0, build_utils_1.debug)(`Executing "yarn build"`);
await (0, build_utils_1.runPackageJsonScript)(workPath, 'build', spawnOpts);
build_utils_1.debug(`Executing "yarn build"`);
await build_utils_1.runPackageJsonScript(workPath, 'build', spawnOpts);
}

@@ -82,7 +82,7 @@ else {

let cmd;
if (!versionRange || !(0, semver_1.validRange)(versionRange)) {
if (!versionRange || !semver_1.validRange(versionRange)) {
console.log('WARNING: Unable to detect RedwoodJS version in package.json devDependencies');
cmd = 'yarn rw deploy vercel'; // Assume 0.25.0 and newer
}
else if ((0, semver_1.intersects)(versionRange, '<0.25.0')) {
else if (semver_1.intersects(versionRange, '<0.25.0')) {
// older than 0.25.0

@@ -96,3 +96,3 @@ cmd =

}
await (0, build_utils_1.execCommand)(cmd, {
await build_utils_1.execCommand(cmd, {
...spawnOpts,

@@ -103,11 +103,11 @@ cwd: workPath,

const apiDir = toml?.web?.apiProxyPath?.replace(/^\//, '') ?? 'api';
const apiDistPath = (0, path_1.join)(workPath, 'api', 'dist', 'functions');
const webDistPath = (0, path_1.join)(workPath, 'web', 'dist');
const apiDistPath = path_1.join(workPath, 'api', 'dist', 'functions');
const webDistPath = path_1.join(workPath, 'web', 'dist');
const lambdaOutputs = {};
// Strip out the .html extensions
// And populate staticOutputs map with updated paths and contentType
const webDistFiles = await (0, build_utils_1.glob)('**', webDistPath);
const webDistFiles = await build_utils_1.glob('**', webDistPath);
const staticOutputs = {};
for (const [fileName, fileFsRef] of Object.entries(webDistFiles)) {
const parsedPath = (0, path_1.parse)(fileFsRef.fsPath);
const parsedPath = path_1.parse(fileFsRef.fsPath);
if (parsedPath.ext !== '.html') {

@@ -118,8 +118,8 @@ // No need to transform non-html files

else {
const fileNameWithoutExtension = (0, path_1.basename)(fileName, '.html');
const pathWithoutHtmlExtension = (0, path_1.join)(parsedPath.dir, fileNameWithoutExtension);
const fileNameWithoutExtension = path_1.basename(fileName, '.html');
const pathWithoutHtmlExtension = path_1.join(parsedPath.dir, fileNameWithoutExtension);
fileFsRef.contentType = 'text/html; charset=utf-8';
// @NOTE: Filename is relative to webDistPath
// e.g. {'./200': fsRef}
staticOutputs[(0, path_1.relative)(webDistPath, pathWithoutHtmlExtension)] =
staticOutputs[path_1.relative(webDistPath, pathWithoutHtmlExtension)] =
fileFsRef;

@@ -135,4 +135,4 @@ }

const functionFiles = {
...(await (0, build_utils_1.glob)('*.js', apiDistPath)),
...(await (0, build_utils_1.glob)('*/*.js', apiDistPath)), // one-level deep
...(await build_utils_1.glob('*.js', apiDistPath)),
...(await build_utils_1.glob('*/*.js', apiDistPath)), // one-level deep
};

@@ -142,8 +142,8 @@ const sourceCache = new Map();

for (const [funcName, fileFsRef] of Object.entries(functionFiles)) {
const outputName = (0, path_1.join)(apiDir, (0, path_1.parse)(funcName).name); // remove `.js` extension
const outputName = path_1.join(apiDir, path_1.parse(funcName).name); // remove `.js` extension
const absEntrypoint = fileFsRef.fsPath;
const relativeEntrypoint = (0, path_1.relative)(workPath, absEntrypoint);
const relativeEntrypoint = path_1.relative(workPath, absEntrypoint);
const awsLambdaHandler = getAWSLambdaHandler(relativeEntrypoint, 'handler');
const sourceFile = relativeEntrypoint.replace('/dist/', '/src/');
const { fileList, esmFileList, warnings } = await (0, nft_1.nodeFileTrace)([absEntrypoint], {
const { fileList, esmFileList, warnings } = await nft_1.nodeFileTrace([absEntrypoint], {
base: workPath,

@@ -155,3 +155,3 @@ processCwd: workPath,

async readFile(fsPath) {
const relPath = (0, path_1.relative)(workPath, fsPath);
const relPath = path_1.relative(workPath, fsPath);
const cached = sourceCache.get(relPath);

@@ -164,6 +164,6 @@ if (cached)

try {
const source = (0, fs_1.readFileSync)(fsPath);
const { mode } = (0, fs_1.lstatSync)(fsPath);
const source = fs_1.readFileSync(fsPath);
const { mode } = fs_1.lstatSync(fsPath);
let entry;
if ((0, build_utils_1.isSymbolicLink)(mode)) {
if (build_utils_1.isSymbolicLink(mode)) {
entry = new build_utils_1.FileFsRef({ fsPath, mode });

@@ -188,3 +188,3 @@ }

for (const warning of warnings) {
(0, build_utils_1.debug)(`Warning from trace: ${warning.message}`);
build_utils_1.debug(`Warning from trace: ${warning.message}`);
}

@@ -195,7 +195,7 @@ const lambdaFiles = {};

lambdaFiles[filePath] = await build_utils_1.FileFsRef.fromFsPath({
fsPath: (0, path_1.join)(workPath, filePath),
fsPath: path_1.join(workPath, filePath),
});
}
lambdaFiles[(0, path_1.relative)(workPath, fileFsRef.fsPath)] = fileFsRef;
const { memory, maxDuration } = await (0, build_utils_1.getLambdaOptionsFromFunction)({
lambdaFiles[path_1.relative(workPath, fileFsRef.fsPath)] = fileFsRef;
const { memory, maxDuration } = await build_utils_1.getLambdaOptionsFromFunction({
sourceFile,

@@ -219,6 +219,6 @@ config,

// Note that in builder post-processing, we remove the .html extension
const fallbackHtmlPage = (0, fs_1.existsSync)((0, path_1.join)(webDistPath, '200.html'))
const fallbackHtmlPage = fs_1.existsSync(path_1.join(webDistPath, '200.html'))
? '/200'
: '/index';
const defaultRoutesConfig = (0, routing_utils_1.getTransformedRoutes)({
const defaultRoutesConfig = routing_utils_1.getTransformedRoutes({
// this makes sure we send back 200.html for unprerendered pages

@@ -239,3 +239,3 @@ rewrites: [{ source: '/(.*)', destination: fallbackHtmlPage }],

function getAWSLambdaHandler(filePath, handlerName) {
const { dir, name } = (0, path_1.parse)(filePath);
const { dir, name } = path_1.parse(filePath);
return `${dir}${dir ? path_1.sep : ''}${name}.${handlerName}`;

@@ -248,4 +248,4 @@ }

const prepareCache = ({ repoRootPath, workPath }) => {
return (0, build_utils_1.glob)('**/node_modules/**', repoRootPath || workPath);
return build_utils_1.glob('**/node_modules/**', repoRootPath || workPath);
};
exports.prepareCache = prepareCache;
{
"name": "@vercel/redwood",
"version": "1.0.45",
"version": "1.0.49",
"main": "./dist/index.js",

@@ -17,9 +17,9 @@ "license": "MIT",

"build": "node build.js",
"test-integration-once": "yarn test test/test.js",
"test-integration-once": "pnpm test test/test.js",
"test": "jest --env node --verbose --bail --runInBand",
"test-unit": "yarn test test/prepare-cache.test.js"
"test-unit": "pnpm test test/prepare-cache.test.js"
},
"dependencies": {
"@vercel/nft": "0.22.5",
"@vercel/routing-utils": "2.1.3",
"@vercel/routing-utils": "workspace:2.1.7",
"semver": "6.1.1"

@@ -31,5 +31,8 @@ },

"@types/semver": "6.0.0",
"@vercel/build-utils": "5.7.5"
"@vercel/build-utils": "workspace:5.8.2",
"execa": "3.2.0",
"fs-extra": "11.1.0",
"typescript": "4.3.4"
},
"gitHead": "4c3bc0532216f21f354623ada76b2315ef8ba519"
"gitHead": "e54da8a2e5504987a956e2baaad6d817028b597f"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc