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 bcc363b87d..1110da21bd 100644 --- a/packages/zip-it-and-ship-it/src/feature_flags.ts +++ b/packages/zip-it-and-ship-it/src/feature_flags.ts @@ -21,9 +21,6 @@ export const defaultFlags = { // Output CJS file extension. zisi_output_cjs_extension: false, - // Create unique entry file instead of a file that is based on the function name. - zisi_unique_entry_file: false, - // If multiple glob stars are in includedFiles, fail the build instead of warning. zisi_esbuild_fail_double_glob: false, diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/utils/entry_file.ts b/packages/zip-it-and-ship-it/src/runtimes/node/utils/entry_file.ts index 3da62f428c..7987c19ea6 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/utils/entry_file.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/utils/entry_file.ts @@ -68,11 +68,6 @@ const getEntryFileContents = ( ].join(';') } - if (featureFlags.zisi_unique_entry_file) { - // we use dynamic import because we do not know if the user code is cjs or esm - return [`const { handler } = await import('${importPath}')`, 'export { handler }'].join(';') - } - if (moduleFormat === MODULE_FORMAT.COMMONJS) { return `module.exports = require('${importPath}')` } @@ -92,18 +87,16 @@ export const isNamedLikeEntryFile = ( file: string, { basePath, - featureFlags, filename, runtimeAPIVersion, }: { basePath: string - featureFlags: FeatureFlags filename: string runtimeAPIVersion: number }, ) => POSSIBLE_LAMBDA_ENTRY_EXTENSIONS.some((extension) => { - const entryFilename = getEntryFileName({ extension, featureFlags, filename, runtimeAPIVersion }) + const entryFilename = getEntryFileName({ extension, filename, runtimeAPIVersion }) const entryFilePath = resolve(basePath, entryFilename) return entryFilePath === file @@ -115,14 +108,12 @@ export const conflictsWithEntryFile = ( { basePath, extension, - featureFlags, filename, mainFile, runtimeAPIVersion, }: { basePath: string extension: string - featureFlags: FeatureFlags filename: string mainFile: string runtimeAPIVersion: number @@ -143,13 +134,13 @@ export const conflictsWithEntryFile = ( // If we're generating a unique entry file, we know we don't have a conflict // at this point. - if (featureFlags.zisi_unique_entry_file || runtimeAPIVersion === 2) { + if (runtimeAPIVersion === 2) { return } if ( !hasConflict && - isNamedLikeEntryFile(srcFile, { basePath, featureFlags, filename, runtimeAPIVersion }) && + isNamedLikeEntryFile(srcFile, { basePath, filename, runtimeAPIVersion }) && srcFile !== mainFile ) { hasConflict = true @@ -164,16 +155,14 @@ export const conflictsWithEntryFile = ( // this it considers `.(c|m)?js` as possible entry-points const getEntryFileName = ({ extension, - featureFlags, filename, runtimeAPIVersion, }: { extension: ModuleFileExtension - featureFlags: FeatureFlags filename: string runtimeAPIVersion: number }) => { - if (featureFlags.zisi_unique_entry_file || runtimeAPIVersion === 2) { + if (runtimeAPIVersion === 2) { return `${ENTRY_FILE_NAME}.mjs` } @@ -233,7 +222,7 @@ export const getEntryFile = ({ }): EntryFile => { const mainPath = normalizeFilePath({ commonPrefix, path: mainFile, userNamespace }) const extension = getFileExtensionForFormat(moduleFormat, featureFlags, runtimeAPIVersion) - const entryFilename = getEntryFileName({ extension, featureFlags, filename, runtimeAPIVersion }) + const entryFilename = getEntryFileName({ extension, filename, runtimeAPIVersion }) const contents = getEntryFileContents(mainPath, moduleFormat, featureFlags, runtimeAPIVersion) return { diff --git a/packages/zip-it-and-ship-it/src/runtimes/node/utils/zip.ts b/packages/zip-it-and-ship-it/src/runtimes/node/utils/zip.ts index 62d8071e2f..22ada8d7c6 100644 --- a/packages/zip-it-and-ship-it/src/runtimes/node/utils/zip.ts +++ b/packages/zip-it-and-ship-it/src/runtimes/node/utils/zip.ts @@ -93,7 +93,6 @@ const createDirectory = async function ({ const hasEntryFileConflict = conflictsWithEntryFile(srcFiles, { basePath, extension, - featureFlags, filename, mainFile, runtimeAPIVersion, @@ -210,7 +209,6 @@ const createZipArchive = async function ({ const hasEntryFileConflict = conflictsWithEntryFile(srcFiles, { basePath, extension, - featureFlags, filename, mainFile, runtimeAPIVersion, @@ -219,10 +217,9 @@ const createZipArchive = async function ({ // We don't need an entry file if it would end up with the same path as the // function's main file. Unless we have a file conflict and need to move everything into a subfolder const needsEntryFile = - featureFlags.zisi_unique_entry_file || runtimeAPIVersion === 2 || hasEntryFileConflict || - !isNamedLikeEntryFile(mainFile, { basePath, featureFlags, filename, runtimeAPIVersion }) + !isNamedLikeEntryFile(mainFile, { basePath, filename, runtimeAPIVersion }) // If there is a naming conflict, we move all user files (everything other // than the entry file) to its own sub-directory.