From 9bc8ee42ecffeb2ba610c975ec1f669141b45f14 Mon Sep 17 00:00:00 2001 From: Mateusz Bocian Date: Tue, 11 Feb 2025 10:23:37 -0500 Subject: [PATCH] fix: remove references to fully rolled out zisi_fix_symlinks feature flag --- .../zip-it-and-ship-it/src/feature_flags.ts | 3 --- .../node/bundlers/esbuild/src_files.ts | 9 +------- .../src/runtimes/node/bundlers/nft/index.ts | 4 +--- .../src/runtimes/node/bundlers/none/index.ts | 3 +-- .../runtimes/node/bundlers/zisi/src_files.ts | 1 - .../src/runtimes/node/utils/included_files.ts | 23 +++++-------------- .../tests/symlinked_included_files.test.ts | 6 ----- 7 files changed, 9 insertions(+), 40 deletions(-) diff --git a/packages/zip-it-and-ship-it/src/feature_flags.ts b/packages/zip-it-and-ship-it/src/feature_flags.ts index 9f1a39ab25..11434c3c34 100644 --- a/packages/zip-it-and-ship-it/src/feature_flags.ts +++ b/packages/zip-it-and-ship-it/src/feature_flags.ts @@ -27,9 +27,6 @@ export const defaultFlags = { // If multiple glob stars are in includedFiles, fail the build instead of warning. zisi_esbuild_fail_double_glob: false, - // fixes symlinks in included files - zisi_fix_symlinks: false, - // Adds the `___netlify-telemetry.mjs` file to the function bundle. zisi_add_instrumentation_loader: true, diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/src_files.ts b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/src_files.ts index 1e64f0962b..e5029ea576 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/src_files.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/esbuild/src_files.ts @@ -4,17 +4,10 @@ import { getNewCache, TraversalCache } from '../../utils/traversal_cache.js' import type { GetSrcFilesFunction } from '../types.js' import { getDependencyPathsForDependency } from '../zisi/traverse.js' -export const getSrcFiles: GetSrcFilesFunction = async ({ - config, - mainFile, - pluginsModulesPath, - srcDir, - featureFlags, -}) => { +export const getSrcFiles: GetSrcFilesFunction = async ({ config, mainFile, pluginsModulesPath, srcDir }) => { const { externalNodeModules = [], includedFiles = [], includedFilesBasePath, nodeVersion } = config const { excludePatterns, paths: includedFilePaths } = await getPathsOfIncludedFiles( includedFiles, - featureFlags, includedFilesBasePath, ) const dependencyPaths = await getSrcFilesForDependencies({ diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/nft/index.ts b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/nft/index.ts index e4f6faf1eb..f65ad3ed29 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/nft/index.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/nft/index.ts @@ -53,7 +53,6 @@ const bundle: BundleFunction = async ({ const { excludePatterns, paths: includedFilePaths } = await getPathsOfIncludedFiles( includedFiles, - featureFlags, includedFilesBasePath || basePath, ) const { @@ -239,11 +238,10 @@ const traceFilesAndTranspile = async function ({ } } -const getSrcFiles: GetSrcFilesFunction = async function ({ basePath, config, mainFile, featureFlags }) { +const getSrcFiles: GetSrcFilesFunction = async function ({ basePath, config, mainFile }) { const { includedFiles = [], includedFilesBasePath } = config const { excludePatterns, paths: includedFilePaths } = await getPathsOfIncludedFiles( includedFiles, - featureFlags, includedFilesBasePath, ) const { fileList: dependencyPaths } = await nodeFileTrace([mainFile], { diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/none/index.ts b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/none/index.ts index 12816da84b..66153c6723 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/none/index.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/none/index.ts @@ -37,11 +37,10 @@ const getModuleFormat = async function (mainFile: string): Promise return MODULE_FORMAT.COMMONJS } -export const getSrcFiles: GetSrcFilesFunction = async function ({ config, mainFile, featureFlags }) { +export const getSrcFiles: GetSrcFilesFunction = async function ({ config, mainFile }) { const { includedFiles = [], includedFilesBasePath } = config const { excludePatterns, paths: includedFilePaths } = await getPathsOfIncludedFiles( includedFiles, - featureFlags, includedFilesBasePath, ) const includedPaths = filterExcludedPaths(includedFilePaths, excludePatterns) diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/src_files.ts b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/src_files.ts index 46f30d537f..fe3e3cd7be 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/src_files.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/bundlers/zisi/src_files.ts @@ -31,7 +31,6 @@ export const getSrcFiles: GetSrcFilesFunction = async function ({ const { includedFiles = [], includedFilesBasePath, nodeVersion } = config const { excludePatterns, paths: includedFilePaths } = await getPathsOfIncludedFiles( includedFiles, - featureFlags, includedFilesBasePath, ) const [treeFiles, depFiles] = await Promise.all([ diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/utils/included_files.ts b/packages/zip-it-and-ship-it/src/runtimes/node/utils/included_files.ts index dab51d1e48..ef4e543da6 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/utils/included_files.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/utils/included_files.ts @@ -2,7 +2,6 @@ import { normalize, resolve } from 'path' import fastGlob from 'fast-glob' -import { type FeatureFlags } from '../../../feature_flags.js' import { minimatch } from '../../../utils/matching.js' // Returns the subset of `paths` that don't match any of the glob expressions @@ -19,7 +18,6 @@ export const filterExcludedPaths = (paths: string[], excludePattern: string[] = export const getPathsOfIncludedFiles = async ( includedFiles: string[], - featureFlags: FeatureFlags, basePath?: string, ): Promise<{ excludePatterns: string[]; paths: string[] }> => { if (basePath === undefined) { @@ -55,23 +53,14 @@ export const getPathsOfIncludedFiles = async ( cwd: basePath, dot: true, ignore: excludePatterns, - ...(featureFlags.zisi_fix_symlinks - ? { - onlyFiles: false, - // get directories as well to get symlinked directories, - // to filter the regular non symlinked directories out mark them with a slash at the end to filter them out. - markDirectories: true, - followSymbolicLinks: false, - } - : { - followSymbolicLinks: true, - throwErrorOnBrokenSymbolicLink: true, - }), + onlyFiles: false, + // get directories as well to get symlinked directories, + // to filter the regular non symlinked directories out mark them with a slash at the end to filter them out. + markDirectories: true, + followSymbolicLinks: false, }) - const paths = featureFlags.zisi_fix_symlinks - ? pathGroups.filter((path) => !path.endsWith('/')).map(normalize) - : pathGroups.map(normalize) + const paths = pathGroups.filter((path) => !path.endsWith('/')).map(normalize) // now filter the non symlinked directories out that got marked with a trailing slash return { excludePatterns, paths } diff --git a/packages/zip-it-and-ship-it/tests/symlinked_included_files.test.ts b/packages/zip-it-and-ship-it/tests/symlinked_included_files.test.ts index c6a8eeec4f..ce176093f0 100644 --- a/packages/zip-it-and-ship-it/tests/symlinked_included_files.test.ts +++ b/packages/zip-it-and-ship-it/tests/symlinked_included_files.test.ts @@ -46,9 +46,6 @@ test.skipIf(platform() === 'win32')('Symlinked directories from `includedFiles` includedFiles: ['**'], }, }, - featureFlags: { - zisi_fix_symlinks: true, - }, repositoryRoot: basePath, systemLog: console.log, debug: true, @@ -101,9 +98,6 @@ test('preserves multiple symlinks that link to the same target', async () => { includedFiles: ['**'], }, }, - featureFlags: { - zisi_fix_symlinks: true, - }, repositoryRoot: basePath, systemLog: console.log, debug: true,