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

feat: include resolved included_files in response of zipFunction #1098

Merged
merged 2 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions src/runtimes/node/bundlers/esbuild/src_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ export const getSrcFiles: GetSrcFilesFunction = async ({ config, mainFile, plugi
basedir: srcDir,
pluginsModulesPath,
})
const includedPaths = filterExcludedPaths([...dependencyPaths, ...includedFilePaths], excludedPaths)
const srcFiles = filterExcludedPaths(dependencyPaths, excludedPaths)
const includedPaths = filterExcludedPaths(includedFilePaths, excludedPaths)

return {
srcFiles: [...includedPaths, mainFile],
includedFiles: filterExcludedPaths(includedFilePaths, excludedPaths),
srcFiles: [...srcFiles, ...includedPaths, mainFile],
includedFiles: includedPaths,
Copy link
Contributor Author

@danez danez Jun 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just made some minor adjustments to every bundler, so that we do not iterate over includedFilePaths twice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! That also makes things a bit clearer, IMO.

}
}

Expand Down
7 changes: 4 additions & 3 deletions src/runtimes/node/bundlers/nft/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ const getSrcFiles: GetSrcFilesFunction = async function ({ basePath, config, mai
const normalizedDependencyPaths = [...dependencyPaths].map((path) =>
basePath ? resolve(basePath, path) : resolve(path),
)
const srcFiles = filterExcludedPaths([...normalizedDependencyPaths, ...includedFilePaths], excludedPaths)
const srcFiles = filterExcludedPaths(normalizedDependencyPaths, excludedPaths)
const includedPaths = filterExcludedPaths(includedFilePaths, excludedPaths)

return {
srcFiles,
includedFiles: filterExcludedPaths(includedFilePaths, excludedPaths),
srcFiles: [...srcFiles, ...includedPaths],
includedFiles: includedPaths,
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/runtimes/node/bundlers/zisi/src_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ export const getSrcFiles: GetSrcFilesFunction = async function ({
// We sort so that the archive's checksum is deterministic.
// Mutating is fine since `Array.filter()` returns a shallow copy
const filteredFiles = uniqueFiles.filter(isNotJunk).sort()
const srcFiles = filterExcludedPaths([...filteredFiles, ...includedFilePaths], excludedPaths)
const srcFiles = filterExcludedPaths(filteredFiles, excludedPaths)
const includedPaths = filterExcludedPaths(includedFilePaths, excludedPaths)

return { srcFiles, includedFiles: filterExcludedPaths(includedFilePaths, excludedPaths) }
return { srcFiles: [...srcFiles, ...includedPaths], includedFiles: includedPaths }
}

// Remove temporary files like *~, *.swp, etc.
Expand Down