@lambda-kata/cdk 0.1.3-rc.4 → 0.1.3-rc.6
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/out/dist/index.js +44 -44
- package/out/tsc/src/aws-layer-manager.d.ts +34 -6
- package/package.json +1 -1
|
@@ -299,11 +299,15 @@ export declare class AWSLayerManager implements LayerManager {
|
|
|
299
299
|
*/
|
|
300
300
|
private createTempDirectory;
|
|
301
301
|
/**
|
|
302
|
-
* Extracts Node.js binary from AWS Lambda Docker
|
|
302
|
+
* Extracts Node.js binary from AWS Lambda Docker image with resource tracking.
|
|
303
303
|
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
304
|
+
* Uses ONLY AWS Lambda Docker images to extract the Node.js binary from the
|
|
305
|
+
* official Lambda runtime environment. This ensures compatibility with the
|
|
306
|
+
* Lambda execution environment while extracting only the minimal binary needed.
|
|
307
|
+
*
|
|
308
|
+
* CRITICAL: Uses ONLY AWS Lambda Docker images as required by user specifications.
|
|
309
|
+
* Docker image format: public.ecr.aws/lambda/nodejs:{version}-{arch}
|
|
310
|
+
* Extracts ONLY: /var/lang/bin/node
|
|
307
311
|
*
|
|
308
312
|
* @param nodeVersion - The Node.js version (e.g., "20.10.0")
|
|
309
313
|
* @param architecture - The target architecture
|
|
@@ -313,11 +317,35 @@ export declare class AWSLayerManager implements LayerManager {
|
|
|
313
317
|
* @throws NodeRuntimeLayerError if extraction fails
|
|
314
318
|
*/
|
|
315
319
|
private extractNodeBinaryFromDockerWithTracking;
|
|
320
|
+
/**
|
|
321
|
+
* Optimizes Node.js binary to reduce size while preserving functionality.
|
|
322
|
+
*
|
|
323
|
+
* Applies size optimization techniques:
|
|
324
|
+
* 1. Strip debug symbols using 'strip' command (reduces size by 30-50%)
|
|
325
|
+
* 2. Verify binary functionality after optimization
|
|
326
|
+
* 3. Fallback to original binary if optimization fails
|
|
327
|
+
*
|
|
328
|
+
* @param originalBinaryPath - Path to the original Node.js binary
|
|
329
|
+
* @param tempDir - Temporary directory for optimization work
|
|
330
|
+
* @returns Promise resolving to path of optimized binary
|
|
331
|
+
* @throws Error if optimization fails and fallback is not viable
|
|
332
|
+
*/
|
|
333
|
+
private optimizeNodeBinary;
|
|
334
|
+
/**
|
|
335
|
+
* Verifies that a Node.js binary is functional after optimization.
|
|
336
|
+
*
|
|
337
|
+
* Runs basic Node.js commands to ensure the binary works correctly.
|
|
338
|
+
* This prevents shipping broken binaries after optimization.
|
|
339
|
+
*
|
|
340
|
+
* @param binaryPath - Path to the Node.js binary to verify
|
|
341
|
+
* @throws Error if verification fails
|
|
342
|
+
*/
|
|
343
|
+
private verifyNodeBinary;
|
|
316
344
|
/**
|
|
317
345
|
* Creates the proper Lambda Layer directory structure.
|
|
318
346
|
*
|
|
319
|
-
* Lambda Layers
|
|
320
|
-
* - /opt/nodejs/bin/
|
|
347
|
+
* Lambda Layers for Node.js binary should use minimal structure:
|
|
348
|
+
* - bin/node (not /opt/nodejs/bin/node)
|
|
321
349
|
*
|
|
322
350
|
* @param tempDir - Base temporary directory
|
|
323
351
|
* @param nodeBinaryPath - Path to the Node.js binary
|
package/package.json
CHANGED