carlin 1.33.0 → 1.34.1

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -3
  2. package/package.json +13 -14
package/dist/index.js CHANGED
@@ -19,8 +19,8 @@ import deepmerge from 'deepmerge';
19
19
  import { hideBin } from 'yargs/helpers';
20
20
  import yargs from 'yargs';
21
21
  import * as esbuild from 'esbuild';
22
+ import { builtinModules } from 'module';
22
23
  import { typescriptConfig } from '@ttoss/config';
23
- import builtins from 'builtin-modules';
24
24
  import AdmZip from 'adm-zip';
25
25
  import importSync from 'import-sync';
26
26
  import semver from 'semver';
@@ -2409,9 +2409,13 @@ var buildLambdaCode = async ({
2409
2409
  lambdaEntryPoints,
2410
2410
  lambdaEntryPointsBaseDir = ".",
2411
2411
  lambdaExternal = [],
2412
+ lambdaFormat = "esm",
2412
2413
  lambdaOutdir
2413
2414
  }) => {
2414
2415
  log5.info(logPrefix5, "Building Lambda single file...");
2416
+ if (fs3__default.existsSync(lambdaOutdir)) {
2417
+ fs3__default.rmSync(lambdaOutdir, { recursive: true });
2418
+ }
2415
2419
  const entryPoints = lambdaEntryPoints.map((entryPoint) => {
2416
2420
  return path__default.resolve(process.cwd(), lambdaEntryPointsBaseDir, entryPoint);
2417
2421
  });
@@ -2427,21 +2431,23 @@ var buildLambdaCode = async ({
2427
2431
  * https://aws.amazon.com/blogs/compute/node-js-18-x-runtime-now-available-in-aws-lambda/
2428
2432
  */
2429
2433
  "@aws-sdk/*",
2430
- ...builtins,
2434
+ ...builtinModules,
2431
2435
  ...lambdaExternal
2432
2436
  ],
2433
2437
  /**
2434
2438
  * Some packages as `graphql` are not compatible with ESM yet.
2435
2439
  * https://github.com/graphql/graphql-js/issues/3603
2436
2440
  */
2437
- format: "cjs",
2441
+ format: lambdaFormat,
2438
2442
  /**
2439
2443
  * https://esbuild.github.io/api/#minify
2440
2444
  */
2441
2445
  minifySyntax: true,
2442
2446
  platform: "node",
2447
+ splitting: lambdaFormat === "esm",
2443
2448
  outbase: path__default.join(process.cwd(), lambdaEntryPointsBaseDir),
2444
2449
  outdir: path__default.join(process.cwd(), lambdaOutdir),
2450
+ outExtension: { ".js": lambdaFormat === "esm" ? ".mjs" : ".cjs" },
2445
2451
  target: typescriptConfig.target,
2446
2452
  treeShaking: true
2447
2453
  });
@@ -2664,6 +2670,7 @@ var deployLambdaCode = async ({
2664
2670
  lambdaImage,
2665
2671
  lambdaEntryPoints,
2666
2672
  lambdaEntryPointsBaseDir = "src",
2673
+ lambdaFormat,
2667
2674
  lambdaOutdir = "dist",
2668
2675
  stackName
2669
2676
  }) => {
@@ -2681,6 +2688,7 @@ var deployLambdaCode = async ({
2681
2688
  lambdaExternal,
2682
2689
  lambdaEntryPoints,
2683
2690
  lambdaEntryPointsBaseDir,
2691
+ lambdaFormat,
2684
2692
  lambdaOutdir
2685
2693
  });
2686
2694
  const { bucket, key, versionId } = await uploadCodeToS3({
@@ -4055,6 +4063,12 @@ var options5 = {
4055
4063
  describe: "This is an array of files that each serve as an input to the bundling algorithm for Lambda functions.",
4056
4064
  type: "string"
4057
4065
  },
4066
+ "lambda-format": {
4067
+ choices: ["esm", "cjs"],
4068
+ default: "esm",
4069
+ describe: "Lambda code format.",
4070
+ type: "string"
4071
+ },
4058
4072
  "lambda-outdir": {
4059
4073
  default: "dist",
4060
4074
  describe: "Output directory for built Lambda code.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carlin",
3
- "version": "1.33.0",
3
+ "version": "1.34.1",
4
4
  "description": "",
5
5
  "license": "GPL-3.0",
6
6
  "author": "Pedro Arantes <arantespp@gmail.com> (https://twitter.com/arantespp)",
@@ -22,44 +22,43 @@
22
22
  "dist/"
23
23
  ],
24
24
  "dependencies": {
25
- "@aws-sdk/client-cloudformation": "^3.564.0",
25
+ "@aws-sdk/client-cloudformation": "^3.577.0",
26
26
  "@octokit/webhooks": "^12.0.0",
27
27
  "@slack/webhook": "^7.0.2",
28
28
  "adm-zip": "^0.5.12",
29
- "aws-sdk": "^2.1608.0",
30
- "builtin-modules": "^3.3.0",
29
+ "aws-sdk": "^2.1623.0",
31
30
  "change-case": "^5.4.4",
32
31
  "deep-equal": "^2.2.3",
33
32
  "deepmerge": "^4.3.1",
34
33
  "dotenv": "^16.4.5",
35
- "esbuild": "^0.20.2",
34
+ "esbuild": "^0.21.3",
36
35
  "findup-sync": "^5.0.0",
37
- "glob": "^10.3.12",
36
+ "glob": "^10.3.15",
38
37
  "import-sync": "^2.2.2",
39
38
  "js-yaml": "^4.1.0",
40
39
  "mime-types": "^2.1.35",
41
40
  "npmlog": "^7.0.1",
42
41
  "prettier": "^3.2.5",
43
- "semver": "^7.6.0",
42
+ "semver": "^7.6.2",
44
43
  "simple-git": "^3.24.0",
45
44
  "ts-node": "^10.9.2",
46
45
  "uglify-js": "^3.17.4",
47
- "vercel": "^34.1.3",
46
+ "vercel": "^34.2.0",
48
47
  "yargs": "^17.7.2",
49
- "@ttoss/cloudformation": "^0.9.7",
50
- "@ttoss/config": "^1.32.3",
51
- "@ttoss/read-config-file": "^1.0.2"
48
+ "@ttoss/config": "^1.32.4",
49
+ "@ttoss/cloudformation": "^0.9.8",
50
+ "@ttoss/read-config-file": "^1.0.3"
52
51
  },
53
52
  "devDependencies": {
54
53
  "@types/adm-zip": "^0.5.5",
55
- "@types/aws-lambda": "^8.10.137",
54
+ "@types/aws-lambda": "^8.10.138",
56
55
  "@types/deep-equal": "^1.0.4",
57
56
  "@types/findup-sync": "^4.0.5",
58
57
  "@types/glob": "^8.1.0",
59
58
  "@types/jest": "^29.5.12",
60
59
  "@types/js-yaml": "^4.0.9",
61
60
  "@types/mime-types": "^2.1.4",
62
- "@types/node": "^20.12.7",
61
+ "@types/node": "^20.12.12",
63
62
  "@types/npmlog": "^7.0.0",
64
63
  "@types/semver": "^7.5.8",
65
64
  "@types/uglify-js": "^3.17.5",
@@ -67,7 +66,7 @@
67
66
  "jest": "^29.7.0",
68
67
  "tsup": "^8.0.2",
69
68
  "typescript": "~5.4.5",
70
- "@ttoss/test-utils": "^2.1.6"
69
+ "@ttoss/test-utils": "^2.1.7"
71
70
  },
72
71
  "keywords": [],
73
72
  "publishConfig": {