lambda-live-debugger 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cloudFormation.mjs
CHANGED
|
@@ -51,7 +51,11 @@ async function getCloudFormationClient(awsConfiguration) {
|
|
|
51
51
|
* @returns
|
|
52
52
|
*/
|
|
53
53
|
async function getCloudFormationResources(stackName, awsConfiguration) {
|
|
54
|
+
// temporary disable console.error because SAM framework outputs useless errors
|
|
55
|
+
const originalConsoleError = console.error;
|
|
56
|
+
console.error = function () { };
|
|
54
57
|
const { ListStackResourcesCommand } = await import('@aws-sdk/client-cloudformation');
|
|
58
|
+
console.error = originalConsoleError;
|
|
55
59
|
const cloudFormationClient = await getCloudFormationClient(awsConfiguration);
|
|
56
60
|
try {
|
|
57
61
|
let nextToken = undefined;
|
|
Binary file
|
|
@@ -209,6 +209,7 @@ export class CdkFramework {
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
const compileOutput = path.join(getProjectDirname(), outputFolder, `compiledCdk.${isESM ? 'mjs' : 'cjs'}`);
|
|
212
|
+
const dirname = path.join(...[getProjectDirname(), config.subfolder, 'x'].filter((p) => p));
|
|
212
213
|
try {
|
|
213
214
|
// Build CDK code
|
|
214
215
|
await esbuild.build({
|
|
@@ -227,6 +228,7 @@ export class CdkFramework {
|
|
|
227
228
|
banner: {
|
|
228
229
|
js: [
|
|
229
230
|
`import { createRequire as topLevelCreateRequire } from 'module';`,
|
|
231
|
+
`import.meta.url = 'file:///${dirname}/cdkFrameworkWorker.mjs';`,
|
|
230
232
|
`global.require = global.require ?? topLevelCreateRequire(import.meta.url);`,
|
|
231
233
|
`import { fileURLToPath as topLevelFileUrlToPath, URL as topLevelURL } from "url"`,
|
|
232
234
|
`global.__dirname = global.__dirname ?? topLevelFileUrlToPath(new topLevelURL(".", import.meta.url))`,
|
|
@@ -237,9 +239,7 @@ export class CdkFramework {
|
|
|
237
239
|
format: 'cjs',
|
|
238
240
|
target: 'node18',
|
|
239
241
|
banner: {
|
|
240
|
-
js: [
|
|
241
|
-
`__dirname = '${path.join(...[getProjectDirname(), config.subfolder, 'x'].filter((p) => p))}';`,
|
|
242
|
-
].join('\n'),
|
|
242
|
+
js: [`__dirname = '${dirname}';`].join('\n'),
|
|
243
243
|
},
|
|
244
244
|
}),
|
|
245
245
|
});
|
|
@@ -66,6 +66,24 @@ async function fixCdkPaths(awsCdkLibPath) {
|
|
|
66
66
|
const pathsFix = {
|
|
67
67
|
'custom-resource-handlers/': `${awsCdkLibPath}/custom-resource-handlers/`,
|
|
68
68
|
'aws-custom-resource-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/custom-resources/aws-custom-resource-handler`,
|
|
69
|
+
'auto-delete-objects-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-s3/auto-delete-objects-handler`,
|
|
70
|
+
'notifications-resource-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-s3/notifications-resource-handler`,
|
|
71
|
+
'drop-spam-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-ses/drop-spam-handler`,
|
|
72
|
+
'aws-stepfunctions-tasks/role-policy-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-stepfunctions-tasks/role-policy-handler`,
|
|
73
|
+
'eval-nodejs-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-stepfunctions-tasks/eval-nodejs-handler`,
|
|
74
|
+
'cross-account-zone-delegation-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-route53/cross-account-zone-delegation-handler`,
|
|
75
|
+
'delete-existing-record-set-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-route53/delete-existing-record-set-handler`,
|
|
76
|
+
'aws-api-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-events-targets/aws-api-handler`,
|
|
77
|
+
'log-retention-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-logs/log-retention-handler`,
|
|
78
|
+
'cluster-resource-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-eks/cluster-resource-handler`,
|
|
79
|
+
'auto-delete-images-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-ecr/auto-delete-images-handler`,
|
|
80
|
+
'bucket-deployment-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-s3-deployment/bucket-deployment-handler`,
|
|
81
|
+
'nodejs-entrypoint-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/core/nodejs-entrypoint-handler`,
|
|
82
|
+
'restrict-default-security-group-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-ec2/restrict-default-security-group-handler`,
|
|
83
|
+
'dns-validated-certificate-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-certificatemanager/dns-validated-certificate-handler`,
|
|
84
|
+
'auto-delete-underlying-resources-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-synthetics/auto-delete-underlying-resources-handler`,
|
|
85
|
+
'replica-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-dynamodb/replica-handler`,
|
|
86
|
+
'oidc-handler': `${awsCdkLibPath}/custom-resource-handlers/dist/aws-iam/oidc-handler`,
|
|
69
87
|
};
|
|
70
88
|
|
|
71
89
|
// Create a proxy to intercept calls to the path module so we can fix paths
|
|
@@ -90,6 +108,23 @@ async function fixCdkPaths(awsCdkLibPath) {
|
|
|
90
108
|
|
|
91
109
|
return resolvedPath;
|
|
92
110
|
}
|
|
111
|
+
if (prop === 'join') {
|
|
112
|
+
let resolvedPath = target[prop].apply(target, args);
|
|
113
|
+
|
|
114
|
+
for (const [key, value] of Object.entries(pathsFix)) {
|
|
115
|
+
if (resolvedPath.includes(key)) {
|
|
116
|
+
// replace the beginning of the path with the value
|
|
117
|
+
const i = resolvedPath.indexOf(key);
|
|
118
|
+
const newResolvedPath = `${value}${resolvedPath.substring(i + key.length)}`;
|
|
119
|
+
Logger.verbose(
|
|
120
|
+
`[CDK] [Worker] Fixing path ${resolvedPath} -> ${newResolvedPath}`,
|
|
121
|
+
);
|
|
122
|
+
resolvedPath = newResolvedPath;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return resolvedPath;
|
|
127
|
+
}
|
|
93
128
|
return target[prop].apply(target, args);
|
|
94
129
|
};
|
|
95
130
|
}
|