From c7057a0f846d56f65956e82938329d3e1ea385a0 Mon Sep 17 00:00:00 2001 From: jake champion Date: Wed, 6 Aug 2025 16:34:37 +0100 Subject: [PATCH 1/2] chore: remove dynamic import handler flag from feature --- packages/zip-it-and-ship-it/src/feature_flags.ts | 3 --- .../src/runtimes/node/utils/entry_file.ts | 15 ++------------- packages/zip-it-and-ship-it/tests/main.test.ts | 11 +++++------ 3 files changed, 7 insertions(+), 22 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 1110da21bd..3a1694ac5b 100644 --- a/packages/zip-it-and-ship-it/src/feature_flags.ts +++ b/packages/zip-it-and-ship-it/src/feature_flags.ts @@ -26,9 +26,6 @@ export const defaultFlags = { // Adds the `___netlify-telemetry.mjs` file to the function bundle. zisi_add_instrumentation_loader: true, - - // Dynamically import the function handler. - zisi_dynamic_import_function_handler_entry_point: false, } as const export type FeatureFlags = Partial> 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 7987c19ea6..750a2c54ca 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 @@ -45,26 +45,15 @@ export const kebabCase = (input: string): string => const getEntryFileContents = ( mainPath: string, moduleFormat: string, - featureFlags: FeatureFlags, + _featureFlags: FeatureFlags, runtimeAPIVersion: number, ) => { const importPath = `.${mainPath.startsWith('/') ? mainPath : `/${mainPath}`}` if (runtimeAPIVersion === 2) { - if (featureFlags.zisi_dynamic_import_function_handler_entry_point) { - return [ - `import * as bootstrap from './${BOOTSTRAP_FILE_NAME}'`, - `export const handler = bootstrap.getLambdaHandler('${importPath}')`, - ].join(';') - } return [ `import * as bootstrap from './${BOOTSTRAP_FILE_NAME}'`, - `import * as func from '${importPath}'`, - - // See https://esbuild.github.io/content-types/#default-interop. - 'const funcModule = typeof func.default === "function" ? func : func.default', - - `export const handler = bootstrap.getLambdaHandler(funcModule)`, + `export const handler = bootstrap.getLambdaHandler('${importPath}')`, ].join(';') } diff --git a/packages/zip-it-and-ship-it/tests/main.test.ts b/packages/zip-it-and-ship-it/tests/main.test.ts index 035b0c2308..be86b8a87a 100644 --- a/packages/zip-it-and-ship-it/tests/main.test.ts +++ b/packages/zip-it-and-ship-it/tests/main.test.ts @@ -3010,7 +3010,7 @@ test('Supports both files and directories and ignores files that are not functio await tmpDir.cleanup() }) -test('Supports functions inside the plugins modules path', async () => { +test.only('Supports functions inside the plugins modules path', async () => { const tmpDir = await getTmpDir({ // Cleanup the folder even if there are still files in them unsafeCleanup: true, @@ -3050,11 +3050,10 @@ test('Supports functions inside the plugins modules path', async () => { expect(functions['extension-func1'].priority).toBe(0) // extension-func2 should error because module-4 isn't in scope. - await expect(() => - importFunctionFile( - `${tmpDir.path}/${functions['extension-func2'].name}/${functions['extension-func2'].entryFilename}`, - ), - ).rejects.toThrowError(`Cannot find package 'module-4' imported from`) + const extensionFunc2 = await importFunctionFile( + `${tmpDir.path}/${functions['extension-func2'].name}/${functions['extension-func2'].entryFilename}`, + ) + await expect(invokeLambda(extensionFunc2)).rejects.toThrowError() expect(functions['extension-func2'].generator).toBe('internalFunc') expect(functions['extension-func2'].priority).toBe(0) From 39ea4f6d6dbf24f8e95e383eee16126942b05269 Mon Sep 17 00:00:00 2001 From: Jake Champion Date: Mon, 20 Oct 2025 16:33:39 +0100 Subject: [PATCH 2/2] remove .only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Eduardo Bouças --- packages/zip-it-and-ship-it/tests/main.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zip-it-and-ship-it/tests/main.test.ts b/packages/zip-it-and-ship-it/tests/main.test.ts index be86b8a87a..2385667200 100644 --- a/packages/zip-it-and-ship-it/tests/main.test.ts +++ b/packages/zip-it-and-ship-it/tests/main.test.ts @@ -3010,7 +3010,7 @@ test('Supports both files and directories and ignores files that are not functio await tmpDir.cleanup() }) -test.only('Supports functions inside the plugins modules path', async () => { +test('Supports functions inside the plugins modules path', async () => { const tmpDir = await getTmpDir({ // Cleanup the folder even if there are still files in them unsafeCleanup: true,