|
1 | 1 | import * as esbuild from 'esbuild';
|
2 | 2 | import * as fs from 'fs/promises';
|
3 | 3 | import * as path from 'path';
|
| 4 | +import { pathToFileURL } from 'url'; |
4 | 5 | import { BundlingType, LambdaResource } from '../types/resourcesDiscovery.js';
|
5 | 6 | import { outputFolder } from '../constants.js';
|
6 | 7 | import { findPackageJson } from '../utils/findPackageJson.js';
|
@@ -287,7 +288,11 @@ export class CdkFramework implements IFramework {
|
287 | 288 | ? 'js'
|
288 | 289 | : (fileExtension as esbuild.Loader);
|
289 | 290 | // Inject code to get the file path of the Lambda function and CDK hierarchy
|
290 |
| - if (args.path.includes('aws-cdk-lib/aws-lambda/lib/function.')) { |
| 291 | + if ( |
| 292 | + args.path.includes( |
| 293 | + path.join('aws-cdk-lib', 'aws-lambda', 'lib', 'function.'), |
| 294 | + ) |
| 295 | + ) { |
291 | 296 | const codeToFind =
|
292 | 297 | 'try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_FunctionProps(props)}';
|
293 | 298 |
|
@@ -487,20 +492,21 @@ export class CdkFramework implements IFramework {
|
487 | 492 | compileCodeFile: string;
|
488 | 493 | }) {
|
489 | 494 | const lambdas: any[] = await new Promise((resolve, reject) => {
|
490 |
| - const worker = new Worker( |
| 495 | + const workerPath = pathToFileURL( |
491 | 496 | path.resolve(
|
492 | 497 | path.join(getModuleDirname(), 'frameworks/cdkFrameworkWorker.mjs'),
|
493 | 498 | ),
|
494 |
| - { |
495 |
| - workerData: { |
496 |
| - verbose: config.verbose, |
497 |
| - awsCdkLibPath, |
498 |
| - projectDirname: getProjectDirname(), |
499 |
| - moduleDirname: getModuleDirname(), |
500 |
| - subfolder: config.subfolder, |
501 |
| - }, |
| 499 | + ).href; |
| 500 | + |
| 501 | + const worker = new Worker(new URL(workerPath), { |
| 502 | + workerData: { |
| 503 | + verbose: config.verbose, |
| 504 | + awsCdkLibPath, |
| 505 | + projectDirname: getProjectDirname(), |
| 506 | + moduleDirname: getModuleDirname(), |
| 507 | + subfolder: config.subfolder, |
502 | 508 | },
|
503 |
| - ); |
| 509 | + }); |
504 | 510 |
|
505 | 511 | worker.on('message', async (message) => {
|
506 | 512 | resolve(message);
|
|
0 commit comments