@vercel/redwood
Advanced tools
Comparing version 1.1.14 to 1.1.15
@@ -14,4 +14,4 @@ "use strict"; | ||
const build = async ({ workPath, files, entrypoint, meta = {}, config = {}, }) => { | ||
await build_utils_1.download(files, workPath, meta); | ||
const prefixedEnvs = build_utils_1.getPrefixedEnvVars({ | ||
await (0, build_utils_1.download)(files, workPath, meta); | ||
const prefixedEnvs = (0, build_utils_1.getPrefixedEnvVars)({ | ||
envPrefix: 'REDWOOD_ENV_', | ||
@@ -24,11 +24,11 @@ envs: process.env, | ||
const { installCommand, buildCommand } = config; | ||
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); | ||
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); | ||
if (!spawnOpts.env) { | ||
spawnOpts.env = {}; | ||
} | ||
const { cliType, lockfileVersion } = await build_utils_1.scanParentDirs(entrypointFsDirname); | ||
spawnOpts.env = build_utils_1.getEnvForPackageManager({ | ||
const { cliType, lockfileVersion } = await (0, build_utils_1.scanParentDirs)(entrypointFsDirname); | ||
spawnOpts.env = (0, build_utils_1.getEnvForPackageManager)({ | ||
cliType, | ||
@@ -42,3 +42,3 @@ lockfileVersion, | ||
console.log(`Running "install" command: \`${installCommand}\`...`); | ||
await build_utils_1.execCommand(installCommand, { | ||
await (0, build_utils_1.execCommand)(installCommand, { | ||
...spawnOpts, | ||
@@ -53,3 +53,3 @@ cwd: entrypointFsDirname, | ||
else { | ||
await build_utils_1.runNpmInstall(entrypointFsDirname, [], spawnOpts, meta, nodeVersion); | ||
await (0, build_utils_1.runNpmInstall)(entrypointFsDirname, [], spawnOpts, meta, nodeVersion); | ||
} | ||
@@ -59,7 +59,7 @@ if (meta.isDev) { | ||
} | ||
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')); | ||
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')); | ||
if (buildCommand) { | ||
build_utils_1.debug(`Executing build command "${buildCommand}"`); | ||
await build_utils_1.execCommand(buildCommand, { | ||
(0, build_utils_1.debug)(`Executing build command "${buildCommand}"`); | ||
await (0, build_utils_1.execCommand)(buildCommand, { | ||
...spawnOpts, | ||
@@ -70,8 +70,8 @@ cwd: workPath, | ||
else if (hasScript('vercel-build', pkg)) { | ||
build_utils_1.debug(`Executing "yarn vercel-build"`); | ||
await build_utils_1.runPackageJsonScript(workPath, 'vercel-build', spawnOpts); | ||
(0, build_utils_1.debug)(`Executing "yarn vercel-build"`); | ||
await (0, build_utils_1.runPackageJsonScript)(workPath, 'vercel-build', spawnOpts); | ||
} | ||
else if (hasScript('build', pkg)) { | ||
build_utils_1.debug(`Executing "yarn build"`); | ||
await build_utils_1.runPackageJsonScript(workPath, 'build', spawnOpts); | ||
(0, build_utils_1.debug)(`Executing "yarn build"`); | ||
await (0, build_utils_1.runPackageJsonScript)(workPath, 'build', spawnOpts); | ||
} | ||
@@ -82,7 +82,7 @@ else { | ||
let cmd; | ||
if (!versionRange || !semver_1.validRange(versionRange)) { | ||
if (!versionRange || !(0, 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 (semver_1.intersects(versionRange, '<0.25.0')) { | ||
else if ((0, semver_1.intersects)(versionRange, '<0.25.0')) { | ||
// older than 0.25.0 | ||
@@ -96,3 +96,3 @@ cmd = | ||
} | ||
await build_utils_1.execCommand(cmd, { | ||
await (0, build_utils_1.execCommand)(cmd, { | ||
...spawnOpts, | ||
@@ -103,11 +103,11 @@ cwd: workPath, | ||
const apiDir = toml?.web?.apiProxyPath?.replace(/^\//, '') ?? 'api'; | ||
const apiDistPath = path_1.join(workPath, 'api', 'dist', 'functions'); | ||
const webDistPath = path_1.join(workPath, 'web', 'dist'); | ||
const apiDistPath = (0, path_1.join)(workPath, 'api', 'dist', 'functions'); | ||
const webDistPath = (0, 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 build_utils_1.glob('**', webDistPath); | ||
const webDistFiles = await (0, build_utils_1.glob)('**', webDistPath); | ||
const staticOutputs = {}; | ||
for (const [fileName, fileFsRef] of Object.entries(webDistFiles)) { | ||
const parsedPath = path_1.parse(fileFsRef.fsPath); | ||
const parsedPath = (0, path_1.parse)(fileFsRef.fsPath); | ||
if (parsedPath.ext !== '.html') { | ||
@@ -118,8 +118,8 @@ // No need to transform non-html files | ||
else { | ||
const fileNameWithoutExtension = path_1.basename(fileName, '.html'); | ||
const pathWithoutHtmlExtension = path_1.join(parsedPath.dir, fileNameWithoutExtension); | ||
const fileNameWithoutExtension = (0, path_1.basename)(fileName, '.html'); | ||
const pathWithoutHtmlExtension = (0, path_1.join)(parsedPath.dir, fileNameWithoutExtension); | ||
fileFsRef.contentType = 'text/html; charset=utf-8'; | ||
// @NOTE: Filename is relative to webDistPath | ||
// e.g. {'./200': fsRef} | ||
staticOutputs[path_1.relative(webDistPath, pathWithoutHtmlExtension)] = | ||
staticOutputs[(0, path_1.relative)(webDistPath, pathWithoutHtmlExtension)] = | ||
fileFsRef; | ||
@@ -135,4 +135,4 @@ } | ||
const functionFiles = { | ||
...(await build_utils_1.glob('*.js', apiDistPath)), | ||
...(await build_utils_1.glob('*/*.js', apiDistPath)), // one-level deep | ||
...(await (0, build_utils_1.glob)('*.js', apiDistPath)), | ||
...(await (0, 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 = path_1.join(apiDir, path_1.parse(funcName).name); // remove `.js` extension | ||
const outputName = (0, path_1.join)(apiDir, (0, path_1.parse)(funcName).name); // remove `.js` extension | ||
const absEntrypoint = fileFsRef.fsPath; | ||
const relativeEntrypoint = path_1.relative(workPath, absEntrypoint); | ||
const relativeEntrypoint = (0, path_1.relative)(workPath, absEntrypoint); | ||
const awsLambdaHandler = getAWSLambdaHandler(relativeEntrypoint, 'handler'); | ||
const sourceFile = relativeEntrypoint.replace('/dist/', '/src/'); | ||
const { fileList, esmFileList, warnings } = await nft_1.nodeFileTrace([absEntrypoint], { | ||
const { fileList, esmFileList, warnings } = await (0, nft_1.nodeFileTrace)([absEntrypoint], { | ||
base: workPath, | ||
@@ -155,3 +155,3 @@ processCwd: workPath, | ||
async readFile(fsPath) { | ||
const relPath = path_1.relative(workPath, fsPath); | ||
const relPath = (0, path_1.relative)(workPath, fsPath); | ||
const cached = sourceCache.get(relPath); | ||
@@ -164,6 +164,6 @@ if (cached) | ||
try { | ||
const source = fs_1.readFileSync(fsPath); | ||
const { mode } = fs_1.lstatSync(fsPath); | ||
const source = (0, fs_1.readFileSync)(fsPath); | ||
const { mode } = (0, fs_1.lstatSync)(fsPath); | ||
let entry; | ||
if (build_utils_1.isSymbolicLink(mode)) { | ||
if ((0, build_utils_1.isSymbolicLink)(mode)) { | ||
entry = new build_utils_1.FileFsRef({ fsPath, mode }); | ||
@@ -188,3 +188,3 @@ } | ||
for (const warning of warnings) { | ||
build_utils_1.debug(`Warning from trace: ${warning.message}`); | ||
(0, build_utils_1.debug)(`Warning from trace: ${warning.message}`); | ||
} | ||
@@ -195,7 +195,7 @@ const lambdaFiles = {}; | ||
lambdaFiles[filePath] = await build_utils_1.FileFsRef.fromFsPath({ | ||
fsPath: path_1.join(workPath, filePath), | ||
fsPath: (0, path_1.join)(workPath, filePath), | ||
}); | ||
} | ||
lambdaFiles[path_1.relative(workPath, fileFsRef.fsPath)] = fileFsRef; | ||
const lambdaOptions = await build_utils_1.getLambdaOptionsFromFunction({ | ||
lambdaFiles[(0, path_1.relative)(workPath, fileFsRef.fsPath)] = fileFsRef; | ||
const lambdaOptions = await (0, build_utils_1.getLambdaOptionsFromFunction)({ | ||
sourceFile, | ||
@@ -218,6 +218,6 @@ config, | ||
// Note that in builder post-processing, we remove the .html extension | ||
const fallbackHtmlPage = fs_1.existsSync(path_1.join(webDistPath, '200.html')) | ||
const fallbackHtmlPage = (0, fs_1.existsSync)((0, path_1.join)(webDistPath, '200.html')) | ||
? '/200' | ||
: '/index'; | ||
const defaultRoutesConfig = routing_utils_1.getTransformedRoutes({ | ||
const defaultRoutesConfig = (0, routing_utils_1.getTransformedRoutes)({ | ||
// this makes sure we send back 200.html for unprerendered pages | ||
@@ -238,3 +238,3 @@ rewrites: [{ source: '/(.*)', destination: fallbackHtmlPage }], | ||
function getAWSLambdaHandler(filePath, handlerName) { | ||
const { dir, name } = path_1.parse(filePath); | ||
const { dir, name } = (0, path_1.parse)(filePath); | ||
return `${dir}${dir ? path_1.sep : ''}${name}.${handlerName}`; | ||
@@ -247,4 +247,4 @@ } | ||
const prepareCache = ({ repoRootPath, workPath }) => { | ||
return build_utils_1.glob('**/node_modules/**', repoRootPath || workPath); | ||
return (0, build_utils_1.glob)('**/node_modules/**', repoRootPath || workPath); | ||
}; | ||
exports.prepareCache = prepareCache; |
{ | ||
"name": "@vercel/redwood", | ||
"version": "1.1.14", | ||
"version": "1.1.15", | ||
"main": "./dist/index.js", | ||
@@ -23,3 +23,3 @@ "license": "Apache-2.0", | ||
"@vercel/nft": "0.22.5", | ||
"@vercel/routing-utils": "2.2.0", | ||
"@vercel/routing-utils": "2.2.1", | ||
"semver": "6.1.1" | ||
@@ -31,8 +31,7 @@ }, | ||
"@types/semver": "6.0.0", | ||
"@vercel/build-utils": "6.7.1", | ||
"@vercel/build-utils": "6.7.2", | ||
"execa": "3.2.0", | ||
"fs-extra": "11.1.0", | ||
"typescript": "4.3.4" | ||
"fs-extra": "11.1.0" | ||
}, | ||
"gitHead": "925c8ba18ceec80174d9440cd2cad0e725ed4f56" | ||
"gitHead": "2de365f9cfea3ce283d2bf855507c71209f1e3d8" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22360
6
+ Added@vercel/routing-utils@2.2.1(transitive)
- Removed@vercel/routing-utils@2.2.0(transitive)
Updated@vercel/routing-utils@2.2.1