Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

fix(deps): update dependency @vercel/nft to ^0.17.0 #765

Merged
merged 4 commits into from
Oct 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"dependencies": {
"@babel/parser": "^7.15.7",
"@netlify/esbuild": "^0.13.6",
"@vercel/nft": "^0.15.1",
"@vercel/nft": "^0.17.0",
"archiver": "^5.3.0",
"array-flat-polyfill": "^1.0.1",
"common-path-prefix": "^3.0.0",
Expand Down
13 changes: 10 additions & 3 deletions src/runtimes/node/bundlers/nft/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ const bundle: BundleFunction = async ({
const filteredIncludedPaths = filterExcludedPaths([...dependencyPaths, ...includedFilePaths], excludedPaths)
const dirnames = filteredIncludedPaths.map((filePath) => normalize(dirname(filePath))).sort()

// Sorting the array to make the checksum deterministic.
const srcFiles = [...filteredIncludedPaths, ...transpilation.keys()].sort()

return {
aliases: transpilation,
basePath: getBasePath(dirnames),
cleanupFunction,
inputs: dependencyPaths,
mainFile,
srcFiles: [...filteredIncludedPaths, ...transpilation.keys()],
srcFiles,
}
}

Expand Down Expand Up @@ -113,7 +116,9 @@ const traceFilesAndTranspile = async function ({
}
},
})
const normalizedDependencyPaths = dependencyPaths.map((path) => (basePath ? resolve(basePath, path) : resolve(path)))
const normalizedDependencyPaths = [...dependencyPaths].map((path) =>
basePath ? resolve(basePath, path) : resolve(path),
)

// We look at the cache object to find any paths corresponding to ESM files.
const esmPaths = [...(cache.analysisCache?.entries() || [])].filter(([, { isESM }]) => isESM).map(([path]) => path)
Expand Down Expand Up @@ -150,7 +155,9 @@ const getSrcFiles: GetSrcFilesFunction = async function ({ basePath, config, mai
includedFilesBasePath,
)
const { fileList: dependencyPaths } = await nodeFileTrace([mainFile], { base: basePath, ignore: ignoreFunction })
const normalizedDependencyPaths = dependencyPaths.map((path) => (basePath ? resolve(basePath, path) : resolve(path)))
const normalizedDependencyPaths = [...dependencyPaths].map((path) =>
basePath ? resolve(basePath, path) : resolve(path),
)
const includedPaths = filterExcludedPaths([...normalizedDependencyPaths, ...includedFilePaths], excludedPaths)

return includedPaths
Expand Down
75 changes: 37 additions & 38 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,46 +781,45 @@ testMany(
basePath: fixtureDir,
})
const bundler = options.config['*'].nodeBundler
const functions = await listFunctionsFiles(fixtureDir, opts)
const sortedFunctions = sortOn(functions, 'mainFile')
t.deepEqual(
sortedFunctions,
[
{ name: 'five', mainFile: 'five/index.ts', runtime: 'js', extension: '.ts', srcFile: 'five/index.ts' },

bundler === 'nft' && {
name: 'five',
mainFile: 'five/index.ts',
runtime: 'js',
extension: '.ts',
srcFile: 'five/util.ts',
},
const files = await listFunctionsFiles(fixtureDir, opts)
const sortedFiles = sortOn(files, ['mainFile', 'srcFile'])
const expectedFiles = [
{ name: 'five', mainFile: 'five/index.ts', runtime: 'js', extension: '.ts', srcFile: 'five/index.ts' },

bundler === 'nft' && {
name: 'five',
mainFile: 'five/index.ts',
runtime: 'js',
extension: '.ts',
srcFile: 'five/util.ts',
},

{
name: 'four',
mainFile: 'four.js/four.js.js',
runtime: 'js',
extension: '.js',
srcFile: 'four.js/four.js.js',
},
{ name: 'one', mainFile: 'one/index.js', runtime: 'js', extension: '.js', srcFile: 'one/index.js' },
{ name: 'test', mainFile: 'test', runtime: 'go', extension: '', srcFile: 'test' },
{ name: 'test', mainFile: 'test.js', runtime: 'js', extension: '.js', srcFile: 'test.js' },
{ name: 'test', mainFile: 'test.zip', runtime: 'js', extension: '.zip', srcFile: 'test.zip' },

(bundler === undefined || bundler === 'nft') && {
name: 'two',
mainFile: 'two/two.js',
runtime: 'js',
extension: '.json',
srcFile: 'two/three.json',
},
{
name: 'four',
mainFile: 'four.js/four.js.js',
runtime: 'js',
extension: '.js',
srcFile: 'four.js/four.js.js',
},
{ name: 'one', mainFile: 'one/index.js', runtime: 'js', extension: '.js', srcFile: 'one/index.js' },
{ name: 'test', mainFile: 'test', runtime: 'go', extension: '', srcFile: 'test' },
{ name: 'test', mainFile: 'test.js', runtime: 'js', extension: '.js', srcFile: 'test.js' },
{ name: 'test', mainFile: 'test.zip', runtime: 'js', extension: '.zip', srcFile: 'test.zip' },

(bundler === undefined || bundler === 'nft') && {
name: 'two',
mainFile: 'two/two.js',
runtime: 'js',
extension: '.json',
srcFile: 'two/three.json',
},

{ name: 'two', mainFile: 'two/two.js', runtime: 'js', extension: '.js', srcFile: 'two/two.js' },
]
.filter(Boolean)
.map(normalizeFiles.bind(null, fixtureDir)),
)
{ name: 'two', mainFile: 'two/two.js', runtime: 'js', extension: '.js', srcFile: 'two/two.js' },
]
.filter(Boolean)
.map(normalizeFiles.bind(null, fixtureDir))

t.deepEqual(sortedFiles, sortOn(expectedFiles, ['mainFile', 'srcFile']))
},
)

Expand Down