From b089d55bc7c1fe114aeb33b023e8b51a59ce5a60 Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Tue, 6 Jan 2026 19:34:46 +0100 Subject: [PATCH 1/5] feat: adopt @typescript/native-preview compiler for 5-6x faster builds - Install @typescript/native-preview@7.0.0-dev.20260106.1 - Remove baseUrl from all tsconfig.json files (not supported by native compiler) - Update all build scripts to use npx @typescript/native-preview - Fix import in layers/bin/layers.ts to use relative path with .js extension - Native compiler provides 5-6x faster compilation (256ms vs 1,574ms clean builds) - Stricter type checking catches additional type errors - Maintains compatibility with existing build system and project references --- examples/snippets/tsconfig.json | 1 - layers/bin/layers.ts | 4 +- package-lock.json | 213 ++++++++++++++++++++------- package.json | 1 + packages/batch/package.json | 4 +- packages/batch/tsconfig.json | 1 - packages/commons/package.json | 4 +- packages/commons/tsconfig.json | 1 - packages/event-handler/package.json | 4 +- packages/event-handler/tsconfig.json | 1 - packages/idempotency/package.json | 4 +- packages/idempotency/tsconfig.json | 1 - packages/jmespath/package.json | 4 +- packages/jmespath/tsconfig.json | 1 - packages/kafka/package.json | 4 +- packages/kafka/tsconfig.json | 1 - packages/logger/package.json | 4 +- packages/logger/tsconfig.json | 1 - packages/metrics/package.json | 4 +- packages/metrics/tsconfig.json | 1 - packages/parameters/package.json | 4 +- packages/parameters/tsconfig.json | 1 - packages/parser/package.json | 4 +- packages/parser/tsconfig.json | 1 - packages/testing/package.json | 4 +- packages/testing/tsconfig.json | 1 - packages/tracer/package.json | 4 +- packages/tracer/tsconfig.json | 1 - packages/validation/package.json | 4 +- packages/validation/tsconfig.json | 1 - tsconfig.json | 1 - 31 files changed, 192 insertions(+), 93 deletions(-) diff --git a/examples/snippets/tsconfig.json b/examples/snippets/tsconfig.json index f75f690f30..7e627044a0 100644 --- a/examples/snippets/tsconfig.json +++ b/examples/snippets/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "noEmit": true } } diff --git a/layers/bin/layers.ts b/layers/bin/layers.ts index e4c5148311..eb591f17db 100644 --- a/layers/bin/layers.ts +++ b/layers/bin/layers.ts @@ -1,8 +1,8 @@ #!/usr/bin/env node import 'source-map-support/register'; import { App } from 'aws-cdk-lib'; -import { CanaryStack } from 'layers/src/canary-stack'; -import { LayerPublisherStack } from '../src/layer-publisher-stack'; +import { CanaryStack } from '../src/canary-stack.js'; +import { LayerPublisherStack } from '../src/layer-publisher-stack.js'; const SSM_PARAM_LAYER_ARN = '/layers/powertools-layer-arn'; diff --git a/package-lock.json b/package-lock.json index 351b192440..b297980374 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,6 +30,7 @@ "@biomejs/biome": "^2.3.11", "@types/aws-lambda": "^8.10.159", "@types/node": "^25.0.3", + "@typescript/native-preview": "^7.0.0-dev.20260106.1", "@vitest/coverage-v8": "^4.0.16", "husky": "^9.1.7", "lint-staged": "^16.2.7", @@ -50,12 +51,12 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/batch": "^2.30.0", - "@aws-lambda-powertools/idempotency": "^2.30.0", - "@aws-lambda-powertools/logger": "^2.30.0", - "@aws-lambda-powertools/metrics": "^2.30.0", - "@aws-lambda-powertools/parameters": "^2.30.0", - "@aws-lambda-powertools/tracer": "^2.30.0", + "@aws-lambda-powertools/batch": "^2.30.1", + "@aws-lambda-powertools/idempotency": "^2.30.1", + "@aws-lambda-powertools/logger": "^2.30.1", + "@aws-lambda-powertools/metrics": "^2.30.1", + "@aws-lambda-powertools/parameters": "^2.30.1", + "@aws-lambda-powertools/tracer": "^2.30.1", "@aws-sdk/client-ssm": "^3.962.0", "@aws-sdk/lib-dynamodb": "^3.962.0", "@middy/core": "^4.7.0", @@ -86,15 +87,15 @@ "valibot": "^1.2.0" }, "devDependencies": { - "@aws-lambda-powertools/batch": "^2.30.0", - "@aws-lambda-powertools/event-handler": "^2.30.0", - "@aws-lambda-powertools/idempotency": "^2.30.0", - "@aws-lambda-powertools/jmespath": "^2.30.0", - "@aws-lambda-powertools/logger": "^2.30.0", - "@aws-lambda-powertools/metrics": "^2.30.0", - "@aws-lambda-powertools/parameters": "^2.30.0", - "@aws-lambda-powertools/parser": "^2.30.0", - "@aws-lambda-powertools/tracer": "^2.30.0", + "@aws-lambda-powertools/batch": "^2.30.1", + "@aws-lambda-powertools/event-handler": "^2.30.1", + "@aws-lambda-powertools/idempotency": "^2.30.1", + "@aws-lambda-powertools/jmespath": "^2.30.1", + "@aws-lambda-powertools/logger": "^2.30.1", + "@aws-lambda-powertools/metrics": "^2.30.1", + "@aws-lambda-powertools/parameters": "^2.30.1", + "@aws-lambda-powertools/parser": "^2.30.1", + "@aws-lambda-powertools/tracer": "^2.30.1", "@aws-sdk/client-appconfigdata": "^3.962.0", "@aws-sdk/client-dynamodb": "^3.962.0", "@aws-sdk/client-secrets-manager": "^3.962.0", @@ -154,7 +155,7 @@ } }, "layers": { - "version": "2.30.0", + "version": "2.30.1", "license": "MIT-0", "dependencies": { "aws-cdk": "^2.1100.2", @@ -1010,6 +1011,7 @@ "version": "3.962.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-cloudformation/-/client-cloudformation-3.962.0.tgz", "integrity": "sha512-ypZzDM2D/8m5N9MecnDFKHQw7Vn+eWG9a2cvIKTBvbO8RUxC2vHXjqSNiPiD9veWjlmd+n2fo4govb1KrQd+pw==", + "peer": true, "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", @@ -1262,6 +1264,7 @@ "version": "3.962.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-dynamodb/-/client-dynamodb-3.962.0.tgz", "integrity": "sha512-q2pI7t3Jdwi+sOWdfZSTtnQVUbgEP+Lg0IbU6f6zhPRKDz8UWWYpKHaImRTbiSILN6UlPhIll8odfpxWxFUiwg==", + "peer": true, "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", @@ -1719,6 +1722,7 @@ "version": "3.962.0", "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.962.0.tgz", "integrity": "sha512-I2/1McBZCcM3PfM4ck8D6gnZR3K7+yl1fGkwTq/3ThEn9tdLjNwcdgTbPfxfX6LoecLrH9Ekoo+D9nmQ0T261w==", + "peer": true, "dependencies": { "@aws-crypto/sha1-browser": "5.2.0", "@aws-crypto/sha256-browser": "5.2.0", @@ -4563,6 +4567,7 @@ "version": "4.11.0", "resolved": "https://registry.npmjs.org/@smithy/types/-/types-4.11.0.tgz", "integrity": "sha512-mlrmL0DRDVe3mNrjTcVcZEgkFmufITfUAPBEA+AHYiIeYyJebso/He1qLbP3PssRe22KUzLRpQSdBPbXdgZ2VA==", + "peer": true, "dependencies": { "tslib": "^2.6.2" }, @@ -4903,13 +4908,129 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript/native-preview": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-EeH81rQsgLjewxuVOBN0MnQWAyf5YNeHRP3+Et6wJyr4d7HuA7zFwfNaEdfX1k366kgpKOR5K6dakorBhKZGng==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsgo": "bin/tsgo.js" + }, + "optionalDependencies": { + "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260106.1", + "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260106.1", + "@typescript/native-preview-linux-arm": "7.0.0-dev.20260106.1", + "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260106.1", + "@typescript/native-preview-linux-x64": "7.0.0-dev.20260106.1", + "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260106.1", + "@typescript/native-preview-win32-x64": "7.0.0-dev.20260106.1" + } + }, + "node_modules/@typescript/native-preview-darwin-arm64": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-9n7HIVP3UMgWSK8Yi2H+23hrrEDNNfkW78mbkxfatGh/ghU4m2QuO8R6MdMdPsSmmKDvbWOtpLEuSZFKNzu7eQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@typescript/native-preview-darwin-x64": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-zHJ1KsgQTpBnG3RbI1kjH/fD8juc5DTlQ9gbmJi23OhhaOgNF+PkqC2vAAWLFqdH99tAMvmJf9BJncbB7LwxXA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@typescript/native-preview-linux-arm": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-z7hdUMOOhdiVg1RmWyRyrIG3IIki4eJF3/TUtVVSTRwGq3t+j2JnLUUoK5VgX7EiqlN6wuJ94/FpWtyf+X4fkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-linux-arm64": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-Mp7M7fgUsVW8MHadN58gjie1bzg06K1Id6vm2Aycnmk9rKgu8CxdaDayllr5giPo+iZLZOnw2FyGItrywd4fuA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-linux-x64": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-H+c7xgK0gItbntnPFvt9nVv+cjjjn0lTj2tIjBQcTbH92q9RgFkIfztgxrP5zD8MzJKDOyIw/iAUSsb57lyxjw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-win32-arm64": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-PS1FyYa+/sHQa5Va0yz21DxaBkGGwOYfjMyRSs6oHq01DzMnVIjtsdNAALP0+oqki8Adw0D2XtsdB5QapDbBJw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@typescript/native-preview-win32-x64": { + "version": "7.0.0-dev.20260106.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260106.1.tgz", + "integrity": "sha512-AKVSTGcIE7d5KFtclhK3PVwUrsNnzziA7ZC/VDbMbvYCjLk7FE2GdNKaxQxLGHb53IUirgmltR5r4htn0WSM6A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@valkey/valkey-glide": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/@valkey/valkey-glide/-/valkey-glide-1.3.4.tgz", "integrity": "sha512-EXjpGEeTjs2uhJm8ZNkHEK8d3qCQmppmxsv+553S6L9fArZTBvKMmfh7P2H7nxletHx6sxs+fc2UFFw9M5k5SQ==", "license": "Apache-2.0", "optional": true, - "peer": true, "dependencies": { "detect-libc": "^2.0.3" }, @@ -4966,7 +5087,6 @@ "os": [ "linux" ], - "peer": true, "dependencies": { "glide-rs": "file:rust-client", "long": "5", @@ -5009,7 +5129,6 @@ "inBundle": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "node": ">= 10" } @@ -5021,7 +5140,6 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -5056,7 +5174,6 @@ "os": [ "linux" ], - "peer": true, "dependencies": { "glide-rs": "file:rust-client", "long": "5", @@ -5071,7 +5188,6 @@ "inBundle": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "node": ">= 10" } @@ -5083,7 +5199,6 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -5118,7 +5233,6 @@ "os": [ "linux" ], - "peer": true, "dependencies": { "glide-rs": "file:rust-client", "long": "5", @@ -5133,7 +5247,6 @@ "inBundle": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "node": ">= 10" } @@ -5145,7 +5258,6 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -5180,7 +5292,6 @@ "os": [ "linux" ], - "peer": true, "dependencies": { "glide-rs": "file:rust-client", "long": "5", @@ -5223,7 +5334,6 @@ "inBundle": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "node": ">= 10" } @@ -5235,7 +5345,6 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -5269,7 +5378,6 @@ "os": [ "darwin" ], - "peer": true, "dependencies": { "glide-rs": "file:rust-client", "long": "5", @@ -5284,7 +5392,6 @@ "inBundle": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "node": ">= 10" } @@ -5304,7 +5411,6 @@ "os": [ "darwin" ], - "peer": true, "dependencies": { "glide-rs": "file:rust-client", "long": "5", @@ -5319,7 +5425,6 @@ "inBundle": true, "license": "Apache-2.0", "optional": true, - "peer": true, "engines": { "node": ">= 10" } @@ -5331,7 +5436,6 @@ "hasInstallScript": true, "license": "BSD-3-Clause", "optional": true, - "peer": true, "dependencies": { "@protobufjs/aspromise": "^1.1.2", "@protobufjs/base64": "^1.1.2", @@ -6142,6 +6246,7 @@ "resolved": "https://registry.npmjs.org/aws-sdk-client-mock/-/aws-sdk-client-mock-4.1.0.tgz", "integrity": "sha512-h/tOYTkXEsAcV3//6C1/7U4ifSpKyJvb6auveAepqqNJl6TdZaPFEtKjBQNf8UxQdDP850knB2i/whq4zlsxJw==", "dev": true, + "peer": true, "dependencies": { "@types/sinon": "^17.0.3", "sinon": "^18.0.1", @@ -6626,7 +6731,8 @@ "node_modules/constructs": { "version": "10.4.4", "resolved": "https://registry.npmjs.org/constructs/-/constructs-10.4.4.tgz", - "integrity": "sha512-lP0qC1oViYf1cutHo9/KQ8QL637f/W29tDmv/6sy35F5zs+MD9f66nbAAIjicwc7fwyuF3rkg6PhZh4sfvWIpA==" + "integrity": "sha512-lP0qC1oViYf1cutHo9/KQ8QL637f/W29tDmv/6sy35F5zs+MD9f66nbAAIjicwc7fwyuF3rkg6PhZh4sfvWIpA==", + "peer": true }, "node_modules/core-util-is": { "version": "1.0.3", @@ -7911,6 +8017,7 @@ "resolved": "https://registry.npmjs.org/markdownlint-cli2/-/markdownlint-cli2-0.20.0.tgz", "integrity": "sha512-esPk+8Qvx/f0bzI7YelUeZp+jCtFOk3KjZ7s9iBQZ6HlymSXoTtWGiIRZP05/9Oy2ehIoIjenVwndxGtxOIJYQ==", "dev": true, + "peer": true, "dependencies": { "globby": "15.0.0", "js-yaml": "4.1.1", @@ -9635,6 +9742,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, + "peer": true, "engines": { "node": ">=12" }, @@ -9712,6 +9820,7 @@ "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.15.tgz", "integrity": "sha512-mw2/2vTL7MlT+BVo43lOsufkkd2CJO4zeOSuWQQsiXoV2VuEn7f6IZp2jsUDPmBMABpgR0R5jlcJ2OGEFYmkyg==", "dev": true, + "peer": true, "dependencies": { "@gerrit0/mini-shiki": "^3.17.0", "lunr": "^2.3.9", @@ -9744,6 +9853,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "devOptional": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -9848,6 +9958,7 @@ "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.27.0", "fdir": "^6.5.0", @@ -9953,6 +10064,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, + "peer": true, "engines": { "node": ">=12" }, @@ -9965,6 +10077,7 @@ "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.16.tgz", "integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==", "dev": true, + "peer": true, "dependencies": { "@vitest/expect": "4.0.16", "@vitest/mocker": "4.0.16", @@ -10285,12 +10398,12 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", "@aws/lambda-invoke-store": "0.2.2", "@standard-schema/spec": "^1.1.0" }, "devDependencies": { - "@aws-lambda-powertools/parser": "2.30.0", + "@aws-lambda-powertools/parser": "2.30.1", "@aws-lambda-powertools/testing-utils": "file:../testing", "zod": "^4.3.5" } @@ -10311,7 +10424,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0" + "@aws-lambda-powertools/commons": "2.30.1" }, "devDependencies": { "@aws-lambda-powertools/testing-utils": "file:../testing" @@ -10322,8 +10435,8 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", - "@aws-lambda-powertools/jmespath": "2.30.0" + "@aws-lambda-powertools/commons": "2.30.1", + "@aws-lambda-powertools/jmespath": "2.30.1" }, "devDependencies": { "@aws-lambda-powertools/testing-utils": "file:../testing", @@ -10361,7 +10474,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0" + "@aws-lambda-powertools/commons": "2.30.1" } }, "packages/kafka": { @@ -10369,7 +10482,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", "@standard-schema/spec": "^1.1.0" }, "devDependencies": { @@ -10399,14 +10512,14 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", "@aws/lambda-invoke-store": "0.2.2" }, "devDependencies": { "@aws-lambda-powertools/testing-utils": "file:../testing" }, "peerDependencies": { - "@aws-lambda-powertools/jmespath": "2.30.0", + "@aws-lambda-powertools/jmespath": "2.30.1", "@middy/core": "4.x || 5.x || 6.x" }, "peerDependenciesMeta": { @@ -10423,7 +10536,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", "@aws/lambda-invoke-store": "0.2.2" }, "devDependencies": { @@ -10446,7 +10559,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0" + "@aws-lambda-powertools/commons": "2.30.1" }, "devDependencies": { "@aws-lambda-powertools/testing-utils": "file:../testing", @@ -10492,7 +10605,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", "@standard-schema/spec": "^1.1.0" }, "devDependencies": { @@ -10534,7 +10647,7 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", "aws-xray-sdk-core": "^3.12.0" }, "devDependencies": { @@ -10556,8 +10669,8 @@ "version": "2.30.1", "license": "MIT-0", "dependencies": { - "@aws-lambda-powertools/commons": "2.30.0", - "@aws-lambda-powertools/jmespath": "2.30.0", + "@aws-lambda-powertools/commons": "2.30.1", + "@aws-lambda-powertools/jmespath": "2.30.1", "ajv": "^8.17.1" } } diff --git a/package.json b/package.json index 7b395202fc..4e081e55e3 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "@biomejs/biome": "^2.3.11", "@types/aws-lambda": "^8.10.159", "@types/node": "^25.0.3", + "@typescript/native-preview": "^7.0.0-dev.20260106.1", "@vitest/coverage-v8": "^4.0.16", "husky": "^9.1.7", "lint-staged": "^16.2.7", diff --git a/packages/batch/package.json b/packages/batch/package.json index 14c6bf21c4..0a7084ad79 100644 --- a/packages/batch/package.json +++ b/packages/batch/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "echo 'Not Implemented'", "test:e2e:nodejs24x": "echo 'Not Implemented'", "test:e2e": "echo 'Not Implemented'", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/batch/tsconfig.json b/packages/batch/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/batch/tsconfig.json +++ b/packages/batch/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/commons/package.json b/packages/commons/package.json index 9445e00fc8..cbe8edd857 100644 --- a/packages/commons/package.json +++ b/packages/commons/package.json @@ -16,8 +16,8 @@ "test:unit:types": "vitest --run tests/types --typecheck", "test:e2e": "echo 'Not Applicable'", "generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/commons/tsconfig.json b/packages/commons/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/commons/tsconfig.json +++ b/packages/commons/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/event-handler/package.json b/packages/event-handler/package.json index b1f3fd06b8..f5c90e6659 100644 --- a/packages/event-handler/package.json +++ b/packages/event-handler/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest run tests/e2e", "test:e2e": "vitest run tests/e2e", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/event-handler/tsconfig.json b/packages/event-handler/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/event-handler/tsconfig.json +++ b/packages/event-handler/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/idempotency/package.json b/packages/idempotency/package.json index 03e8aa2e57..d1521063be 100644 --- a/packages/idempotency/package.json +++ b/packages/idempotency/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/idempotency/tsconfig.json b/packages/idempotency/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/idempotency/tsconfig.json +++ b/packages/idempotency/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/jmespath/package.json b/packages/jmespath/package.json index eb914990fd..95b68c85af 100644 --- a/packages/jmespath/package.json +++ b/packages/jmespath/package.json @@ -15,8 +15,8 @@ "test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'", "test:unit:types": "echo 'Not applicable for this package'", "test:e2e": "echo 'Not applicable for this package'", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/jmespath/tsconfig.json b/packages/jmespath/tsconfig.json index d5b9efc4f2..01b26f249f 100644 --- a/packages/jmespath/tsconfig.json +++ b/packages/jmespath/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json" diff --git a/packages/kafka/package.json b/packages/kafka/package.json index 5a7e824f27..2723af2f11 100644 --- a/packages/kafka/package.json +++ b/packages/kafka/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "echo \"Not implemented\"", "test:e2e:nodejs24x": "echo \"Not implemented\"", "test:e2e": "echo \"Not implemented\"", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/kafka/tsconfig.json b/packages/kafka/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/kafka/tsconfig.json +++ b/packages/kafka/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/logger/package.json b/packages/logger/package.json index 9021adba40..1a2ac8c6ea 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/logger/tsconfig.json +++ b/packages/logger/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/metrics/package.json b/packages/metrics/package.json index 7814dbed21..61fdaf117e 100644 --- a/packages/metrics/package.json +++ b/packages/metrics/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/metrics/tsconfig.json b/packages/metrics/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/metrics/tsconfig.json +++ b/packages/metrics/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/parameters/package.json b/packages/parameters/package.json index f1786faae4..b87845341a 100644 --- a/packages/parameters/package.json +++ b/packages/parameters/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/parameters/tsconfig.json b/packages/parameters/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/parameters/tsconfig.json +++ b/packages/parameters/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/parser/package.json b/packages/parser/package.json index c286cd8652..b7202f2c4d 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "echo 'Not implemented'", "test:e2e:nodejs24x": "echo 'Not implemented'", "test:e2e": "echo 'Not implemented'", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/testing/package.json b/packages/testing/package.json index f2c10d8265..d8e048081c 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -11,8 +11,8 @@ "test": "vitest --run", "test:unit": "vitest --run", "test:e2e": "echo 'Not implemented'", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/testing/tsconfig.json b/packages/testing/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/testing/tsconfig.json +++ b/packages/testing/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/tracer/package.json b/packages/tracer/package.json index 5e574d2bad..ec463a3b5a 100644 --- a/packages/tracer/package.json +++ b/packages/tracer/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/tracer/tsconfig.json b/packages/tracer/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/tracer/tsconfig.json +++ b/packages/tracer/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/packages/validation/package.json b/packages/validation/package.json index 3d40ebeb97..fb3489c9a7 100644 --- a/packages/validation/package.json +++ b/packages/validation/package.json @@ -15,8 +15,8 @@ "test:e2e:nodejs22x": "echo \"Not implemented\"", "test:e2e:nodejs24x": "echo \"Not implemented\"", "test:e2e": "echo \"Not implemented\"", - "build:cjs": "tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/validation/tsconfig.json b/packages/validation/tsconfig.json index e1c2fb1dc4..7baf7d1c7f 100644 --- a/packages/validation/tsconfig.json +++ b/packages/validation/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "baseUrl": ".", "outDir": "./lib/esm", "rootDir": "./src", "tsBuildInfoFile": ".tsbuildinfo/esm.json", diff --git a/tsconfig.json b/tsconfig.json index e417160e54..9e52180b48 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,6 @@ "experimentalDecorators": true, "module": "NodeNext", "moduleResolution": "NodeNext", - "baseUrl": ".", // "traceResolution": true, // Enable this to debug module resolution issues "declaration": true, "removeComments": false, From 12de64681527d31a16df7f7c509a220e3f5b370b Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Tue, 6 Jan 2026 19:50:35 +0100 Subject: [PATCH 2/5] fix: revert to regular TypeScript compiler due to stricter type checking The native TypeScript compiler has stricter type checking that catches additional type errors in the codebase. Reverting to regular tsc while keeping the baseUrl removal to test CI performance impact of configuration changes alone. --- analyze_build_performance.py | 263 ++++++++++++++++++++++ analyze_build_performance_fast.py | 174 +++++++++++++++ benchmark-baseline-data.json | 97 ++++++++ benchmark-build.js | 308 ++++++++++++++++++++++++++ benchmark-native-quick.js | 243 ++++++++++++++++++++ benchmark-native.cjs | 241 ++++++++++++++++++++ benchmark-results.json | 53 +++++ packages/batch/package.json | 4 +- packages/commons/package.json | 4 +- packages/commons/tsconfig.native.json | 19 ++ packages/event-handler/package.json | 4 +- packages/idempotency/package.json | 4 +- packages/jmespath/package.json | 4 +- packages/kafka/package.json | 4 +- packages/logger/package.json | 4 +- packages/metrics/package.json | 4 +- packages/parameters/package.json | 4 +- packages/parser/package.json | 4 +- packages/testing/package.json | 4 +- packages/tracer/package.json | 4 +- packages/validation/package.json | 4 +- tsconfig.native.json | 20 ++ 22 files changed, 1444 insertions(+), 26 deletions(-) create mode 100644 analyze_build_performance.py create mode 100644 analyze_build_performance_fast.py create mode 100644 benchmark-baseline-data.json create mode 100644 benchmark-build.js create mode 100644 benchmark-native-quick.js create mode 100644 benchmark-native.cjs create mode 100644 benchmark-results.json create mode 100644 packages/commons/tsconfig.native.json create mode 100644 tsconfig.native.json diff --git a/analyze_build_performance.py b/analyze_build_performance.py new file mode 100644 index 0000000000..93d96bcb7b --- /dev/null +++ b/analyze_build_performance.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python3 +""" +GitHub Actions Build Performance Analysis Script +Analyzes TypeScript build performance from GitHub Actions workflow runs +""" + +import json +import subprocess +import sys +from datetime import datetime +from statistics import mean, median, stdev +from collections import defaultdict +import re + +def run_gh_command(cmd): + """Run a GitHub CLI command and return parsed JSON result""" + try: + result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True) + return json.loads(result.stdout) + except subprocess.CalledProcessError as e: + print(f"Error running command: {cmd}") + print(f"Error: {e.stderr}") + return None + except json.JSONDecodeError as e: + print(f"Error parsing JSON from command: {cmd}") + print(f"Error: {e}") + return None + +def get_workflow_runs(workflow_name, limit=100): + """Get workflow runs for a specific workflow""" + cmd = f'gh run list --workflow="{workflow_name}" --limit={limit} --json databaseId,status,conclusion,createdAt,updatedAt,workflowName' + return run_gh_command(cmd) + +def get_run_details(run_id): + """Get detailed job information for a specific run""" + cmd = f'gh run view {run_id} --json jobs' + return run_gh_command(cmd) + +def parse_timestamp(timestamp_str): + """Parse GitHub timestamp to datetime object""" + return datetime.fromisoformat(timestamp_str.replace('Z', '+00:00')) + +def calculate_duration(start_time, end_time): + """Calculate duration in seconds between two timestamps""" + if not start_time or not end_time: + return None + start = parse_timestamp(start_time) + end = parse_timestamp(end_time) + return (end - start).total_seconds() + +def extract_build_timings(run_data): + """Extract build-related timing data from a workflow run""" + if not run_data or 'jobs' not in run_data: + return {} + + timings = {} + + for job in run_data['jobs']: + job_name = job.get('name', '') + job_start = job.get('startedAt') + job_end = job.get('completedAt') + + if not job_start or not job_end: + continue + + job_duration = calculate_duration(job_start, job_end) + if job_duration is None: + continue + + # Extract step timings + steps = {} + for step in job.get('steps', []): + step_name = step.get('name', '') + step_start = step.get('startedAt') + step_end = step.get('completedAt') + + if step_start and step_end: + step_duration = calculate_duration(step_start, step_end) + if step_duration is not None: + steps[step_name] = step_duration + + timings[job_name] = { + 'total_duration': job_duration, + 'steps': steps + } + + return timings + +def analyze_build_performance(): + """Main analysis function""" + print("šŸ” Analyzing GitHub Actions Build Performance for aws-lambda-powertools-typescript") + print("=" * 80) + + # Get workflow runs + print("\nšŸ“Š Fetching workflow runs...") + runs = get_workflow_runs("On PR code update", 100) + + if not runs: + print("āŒ Failed to fetch workflow runs") + return + + # Filter successful runs only + successful_runs = [run for run in runs if run.get('conclusion') == 'success'] + print(f"āœ… Found {len(successful_runs)} successful runs out of {len(runs)} total runs") + + # Collect timing data + print("\nā±ļø Extracting timing data from runs...") + all_timings = [] + build_step_durations = defaultdict(list) + job_durations = defaultdict(list) + + for i, run in enumerate(successful_runs[:50]): # Analyze first 50 successful runs + run_id = run['databaseId'] + print(f"Processing run {i+1}/50: {run_id}", end='\r') + + run_details = get_run_details(run_id) + if not run_details: + continue + + timings = extract_build_timings(run_details) + if timings: + all_timings.append({ + 'run_id': run_id, + 'created_at': run['createdAt'], + 'timings': timings + }) + + # Collect job durations + for job_name, job_data in timings.items(): + job_durations[job_name].append(job_data['total_duration']) + + # Collect step durations (focus on build-related steps) + for step_name, step_duration in job_data['steps'].items(): + if any(keyword in step_name.lower() for keyword in ['setup dependencies', 'linting', 'unit tests', 'setup']): + build_step_durations[f"{job_name} - {step_name}"].append(step_duration) + + print(f"\nāœ… Processed {len(all_timings)} runs successfully") + + # Calculate statistics + print("\nšŸ“ˆ Build Performance Statistics") + print("=" * 50) + + # Job-level statistics + print("\nšŸ—ļø Job Duration Statistics (seconds):") + for job_name, durations in sorted(job_durations.items()): + if len(durations) >= 5: # Only show jobs with enough data points + stats = { + 'count': len(durations), + 'mean': mean(durations), + 'median': median(durations), + 'min': min(durations), + 'max': max(durations), + 'std_dev': stdev(durations) if len(durations) > 1 else 0 + } + + print(f"\n{job_name}:") + print(f" Count: {stats['count']}") + print(f" Mean: {stats['mean']:.1f}s") + print(f" Median: {stats['median']:.1f}s") + print(f" Min: {stats['min']:.1f}s") + print(f" Max: {stats['max']:.1f}s") + print(f" Std Dev: {stats['std_dev']:.1f}s") + + # Step-level statistics for build-related steps + print("\nšŸ”§ Build Step Duration Statistics (seconds):") + for step_name, durations in sorted(build_step_durations.items()): + if len(durations) >= 5 and 'setup dependencies' in step_name.lower(): + stats = { + 'count': len(durations), + 'mean': mean(durations), + 'median': median(durations), + 'min': min(durations), + 'max': max(durations), + 'std_dev': stdev(durations) if len(durations) > 1 else 0 + } + + print(f"\n{step_name}:") + print(f" Count: {stats['count']}") + print(f" Mean: {stats['mean']:.1f}s") + print(f" Median: {stats['median']:.1f}s") + print(f" Min: {stats['min']:.1f}s") + print(f" Max: {stats['max']:.1f}s") + print(f" Std Dev: {stats['std_dev']:.1f}s") + + # Overall workflow statistics + print("\nšŸŽÆ Overall Workflow Performance:") + if all_timings: + total_durations = [] + for timing_data in all_timings: + # Calculate total workflow duration (max job end time - min job start time) + job_starts = [] + job_ends = [] + + for job_name, job_data in timing_data['timings'].items(): + # We need to reconstruct start/end times from the duration + # This is an approximation since we only have durations + total_durations.append(job_data['total_duration']) + + if total_durations: + # Use the longest job duration as a proxy for workflow duration + workflow_durations = [] + for timing_data in all_timings: + max_job_duration = max(job_data['total_duration'] for job_data in timing_data['timings'].values()) + workflow_durations.append(max_job_duration) + + print(f" Analyzed Runs: {len(workflow_durations)}") + print(f" Mean Duration: {mean(workflow_durations):.1f}s ({mean(workflow_durations)/60:.1f}m)") + print(f" Median Duration: {median(workflow_durations):.1f}s ({median(workflow_durations)/60:.1f}m)") + print(f" Min Duration: {min(workflow_durations):.1f}s ({min(workflow_durations)/60:.1f}m)") + print(f" Max Duration: {max(workflow_durations):.1f}s ({max(workflow_durations)/60:.1f}m)") + print(f" Std Dev: {stdev(workflow_durations):.1f}s" if len(workflow_durations) > 1 else " Std Dev: 0.0s") + + # Performance trends + print("\nšŸ“Š Performance Trends:") + if len(all_timings) >= 10: + # Compare first 10 vs last 10 runs + first_10 = all_timings[-10:] # Most recent runs are at the end + last_10 = all_timings[:10] # Oldest runs are at the beginning + + first_10_durations = [max(job_data['total_duration'] for job_data in timing['timings'].values()) for timing in first_10] + last_10_durations = [max(job_data['total_duration'] for job_data in timing['timings'].values()) for timing in last_10] + + first_10_avg = mean(first_10_durations) + last_10_avg = mean(last_10_durations) + + trend = ((first_10_avg - last_10_avg) / last_10_avg) * 100 + + print(f" Recent 10 runs avg: {first_10_avg:.1f}s") + print(f" Oldest 10 runs avg: {last_10_avg:.1f}s") + print(f" Trend: {trend:+.1f}% ({'improvement' if trend < 0 else 'regression'})") + + # Key insights + print("\nšŸ’” Key Insights:") + + # Find the most time-consuming steps + setup_deps_times = [] + for step_name, durations in build_step_durations.items(): + if 'setup dependencies' in step_name.lower() and durations: + setup_deps_times.extend(durations) + + if setup_deps_times: + avg_setup_time = mean(setup_deps_times) + print(f" • Average 'Setup dependencies' time: {avg_setup_time:.1f}s ({avg_setup_time/60:.1f}m)") + print(f" This includes npm install and TypeScript compilation") + + # Find jobs with highest variability + high_variability_jobs = [] + for job_name, durations in job_durations.items(): + if len(durations) >= 5: + cv = (stdev(durations) / mean(durations)) * 100 # Coefficient of variation + if cv > 20: # More than 20% variability + high_variability_jobs.append((job_name, cv)) + + if high_variability_jobs: + print(f" • Jobs with high timing variability (>20%):") + for job_name, cv in sorted(high_variability_jobs, key=lambda x: x[1], reverse=True)[:3]: + print(f" - {job_name}: {cv:.1f}% variability") + + print(f"\nšŸŽ‰ Analysis complete! Processed {len(all_timings)} successful workflow runs.") + print("This data represents real-world CI build performance including TypeScript compilation.") + +if __name__ == "__main__": + analyze_build_performance() \ No newline at end of file diff --git a/analyze_build_performance_fast.py b/analyze_build_performance_fast.py new file mode 100644 index 0000000000..67ce327b0e --- /dev/null +++ b/analyze_build_performance_fast.py @@ -0,0 +1,174 @@ +#!/usr/bin/env python3 +""" +GitHub Actions Build Performance Analysis Script - Optimized Version +""" + +import json +import subprocess +import sys +from datetime import datetime +from statistics import mean, median, stdev +from collections import defaultdict + +def run_gh_command(cmd): + """Run a GitHub CLI command and return parsed JSON result""" + try: + result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True) + return json.loads(result.stdout) + except Exception as e: + print(f"Error with command: {cmd[:50]}...") + return None + +def parse_timestamp(timestamp_str): + """Parse GitHub timestamp to datetime object""" + return datetime.fromisoformat(timestamp_str.replace('Z', '+00:00')) + +def calculate_duration(start_time, end_time): + """Calculate duration in seconds between two timestamps""" + if not start_time or not end_time: + return None + start = parse_timestamp(start_time) + end = parse_timestamp(end_time) + return (end - start).total_seconds() + +def main(): + print("šŸ” GitHub Actions Build Performance Analysis") + print("=" * 60) + + # Get recent successful runs + print("šŸ“Š Fetching recent workflow runs...") + cmd = 'gh run list --workflow="On PR code update" --limit=30 --json databaseId,status,conclusion,createdAt,updatedAt' + runs = run_gh_command(cmd) + + if not runs: + print("āŒ Failed to fetch runs") + return + + successful_runs = [r for r in runs if r.get('conclusion') == 'success'][:20] + print(f"āœ… Analyzing {len(successful_runs)} successful runs") + + # Collect timing data + all_job_durations = defaultdict(list) + setup_durations = [] + total_workflow_durations = [] + + for i, run in enumerate(successful_runs): + print(f"Processing run {i+1}/{len(successful_runs)}: {run['databaseId']}") + + # Get run details + cmd = f"gh run view {run['databaseId']} --json jobs" + run_data = run_gh_command(cmd) + + if not run_data or 'jobs' not in run_data: + continue + + job_durations = [] + + for job in run_data['jobs']: + job_name = job.get('name', '') + job_start = job.get('startedAt') + job_end = job.get('completedAt') + + if job_start and job_end: + duration = calculate_duration(job_start, job_end) + if duration: + all_job_durations[job_name].append(duration) + job_durations.append(duration) + + # Look for setup dependencies step + for step in job.get('steps', []): + step_name = step.get('name', '').lower() + if 'setup dependencies' in step_name: + step_start = step.get('startedAt') + step_end = step.get('completedAt') + if step_start and step_end: + setup_duration = calculate_duration(step_start, step_end) + if setup_duration: + setup_durations.append(setup_duration) + + # Workflow duration is the maximum job duration (since jobs run in parallel) + if job_durations: + total_workflow_durations.append(max(job_durations)) + + # Calculate and display statistics + print("\nšŸ“ˆ Build Performance Results") + print("=" * 40) + + # Overall workflow performance + if total_workflow_durations: + print(f"\nšŸŽÆ Overall Workflow Performance:") + print(f" Runs analyzed: {len(total_workflow_durations)}") + print(f" Mean duration: {mean(total_workflow_durations):.1f}s ({mean(total_workflow_durations)/60:.1f}m)") + print(f" Median duration: {median(total_workflow_durations):.1f}s ({median(total_workflow_durations)/60:.1f}m)") + print(f" Min duration: {min(total_workflow_durations):.1f}s ({min(total_workflow_durations)/60:.1f}m)") + print(f" Max duration: {max(total_workflow_durations):.1f}s ({max(total_workflow_durations)/60:.1f}m)") + if len(total_workflow_durations) > 1: + print(f" Std deviation: {stdev(total_workflow_durations):.1f}s") + + # Setup dependencies performance (includes TypeScript compilation) + if setup_durations: + print(f"\nšŸ”§ 'Setup Dependencies' Step Performance (includes TS compilation):") + print(f" Samples: {len(setup_durations)}") + print(f" Mean duration: {mean(setup_durations):.1f}s ({mean(setup_durations)/60:.1f}m)") + print(f" Median duration: {median(setup_durations):.1f}s ({median(setup_durations)/60:.1f}m)") + print(f" Min duration: {min(setup_durations):.1f}s") + print(f" Max duration: {max(setup_durations):.1f}s") + if len(setup_durations) > 1: + print(f" Std deviation: {stdev(setup_durations):.1f}s") + + # Top job types by duration + print(f"\nšŸ—ļø Top Job Types by Average Duration:") + job_stats = [] + for job_name, durations in all_job_durations.items(): + if len(durations) >= 3: # Only jobs with enough samples + avg_duration = mean(durations) + job_stats.append((job_name, avg_duration, len(durations))) + + # Sort by average duration and show top 5 + for job_name, avg_duration, count in sorted(job_stats, key=lambda x: x[1], reverse=True)[:5]: + print(f" {job_name}: {avg_duration:.1f}s (avg from {count} runs)") + + # Performance insights + print(f"\nšŸ’” Key Insights:") + + if setup_durations: + avg_setup = mean(setup_durations) + if total_workflow_durations: + avg_total = mean(total_workflow_durations) + setup_percentage = (avg_setup / avg_total) * 100 + print(f" • Setup Dependencies accounts for ~{setup_percentage:.1f}% of total build time") + + print(f" • TypeScript compilation + npm install averages {avg_setup:.1f}s ({avg_setup/60:.1f}m)") + + # Variability analysis + if total_workflow_durations and len(total_workflow_durations) > 1: + cv = (stdev(total_workflow_durations) / mean(total_workflow_durations)) * 100 + print(f" • Build time variability: {cv:.1f}% (coefficient of variation)") + + if cv > 20: + print(f" āš ļø High variability suggests inconsistent performance") + elif cv < 10: + print(f" āœ… Low variability indicates consistent performance") + + # Performance trend (if we have enough data) + if len(total_workflow_durations) >= 10: + recent_5 = total_workflow_durations[:5] # Most recent + older_5 = total_workflow_durations[-5:] # Oldest in our sample + + recent_avg = mean(recent_5) + older_avg = mean(older_5) + trend = ((recent_avg - older_avg) / older_avg) * 100 + + print(f" • Recent trend: {trend:+.1f}% vs older runs") + if abs(trend) < 5: + print(f" → Stable performance") + elif trend > 0: + print(f" → Performance regression detected") + else: + print(f" → Performance improvement detected") + + print(f"\nšŸŽ‰ Analysis complete!") + print(f"This represents real CI build performance including TypeScript compilation.") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/benchmark-baseline-data.json b/benchmark-baseline-data.json new file mode 100644 index 0000000000..dda927e066 --- /dev/null +++ b/benchmark-baseline-data.json @@ -0,0 +1,97 @@ +{ + "timestamp": "2024-12-19T20:30:00.000Z", + "repository": "aws-lambda-powertools-typescript", + "systemInfo": { + "nodeVersion": "v24.11.1", + "typescriptVersion": "Version 5.9.3", + "platform": "Darwin arm64", + "cpus": 12, + "testPackage": "commons", + "sourceFiles": 22 + }, + "buildConfiguration": { + "incremental": true, + "composite": true, + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext" + }, + "benchmarkResults": { + "esmCleanBuilds": { + "name": "Commons ESM Clean Builds", + "command": "npx tsc --build packages/commons/tsconfig.json", + "iterations": 5, + "times": [1754, 1498, 1486, 1602, 1952], + "stats": { + "mean": 1658, + "min": 1486, + "max": 1952, + "stdDev": 186 + } + }, + "esmIncrementalBuilds": { + "name": "Commons ESM Incremental Builds", + "command": "npx tsc --build packages/commons/tsconfig.json", + "iterations": 5, + "times": [689, 594, 625, 674, 623], + "stats": { + "mean": 641, + "min": 594, + "max": 689, + "stdDev": 37 + } + }, + "cjsCleanBuilds": { + "name": "Commons CJS Clean Builds", + "command": "npx tsc --build packages/commons/tsconfig.cjs.json", + "iterations": 5, + "times": [1504, 2197, 1613, 1525, 1576], + "stats": { + "mean": 1683, + "min": 1504, + "max": 2197, + "stdDev": 267 + } + }, + "cjsIncrementalBuilds": { + "name": "Commons CJS Incremental Builds", + "command": "npx tsc --build packages/commons/tsconfig.cjs.json", + "iterations": 5, + "times": [867, 602, 590, 620, 575], + "stats": { + "mean": 651, + "min": 575, + "max": 867, + "stdDev": 115 + } + } + }, + "analysis": { + "incrementalSpeedup": { + "esm": 2.59, + "cjs": 2.58, + "average": 2.58 + }, + "buildTypeComparison": { + "cleanBuilds": { + "esmVsCjs": "ESM slightly faster by 25ms (1.5%)" + }, + "incrementalBuilds": { + "esmVsCjs": "ESM slightly faster by 10ms (1.5%)" + } + }, + "variance": { + "cleanBuilds": "Higher variance, especially CJS (±267ms)", + "incrementalBuilds": "Lower variance, more consistent (±37-115ms)" + } + }, + "recommendations": { + "forNativeCompilerComparison": [ + "Focus on clean build performance improvements", + "Measure startup time reduction", + "Track memory usage differences", + "Test with larger packages for better signal", + "Run 50-100 iterations for statistical significance" + ] + } +} diff --git a/benchmark-build.js b/benchmark-build.js new file mode 100644 index 0000000000..5c16cb289c --- /dev/null +++ b/benchmark-build.js @@ -0,0 +1,308 @@ +#!/usr/bin/env node + +import { execSync } from 'child_process'; +import fs from 'fs'; +import os from 'os'; +import { performance } from 'perf_hooks'; + +const ITERATIONS = 20; +const WARMUP_ITERATIONS = 3; + +function cleanBuild() { + try { + execSync('rm -rf packages/*/lib packages/*/.tsbuildinfo .tsbuildinfo', { + stdio: 'pipe', + }); + } catch { + // Ignore errors + } +} + +function measureCommand(command, workdir = '.') { + const start = performance.now(); + try { + execSync(command, { + stdio: 'pipe', + cwd: workdir, + timeout: 60000, + }); + return performance.now() - start; + } catch (error) { + console.error(`Command failed: ${command} in ${workdir}`); + throw error; + } +} + +function calculateStats(times) { + const sorted = [...times].sort((a, b) => a - b); + const mean = times.reduce((a, b) => a + b, 0) / times.length; + const median = sorted[Math.floor(sorted.length / 2)]; + const variance = + times.reduce((acc, val) => acc + (val - mean) ** 2, 0) / times.length; + const stdDev = Math.sqrt(variance); + + return { + mean: Math.round(mean), + median: Math.round(median), + stdDev: Math.round(stdDev), + min: Math.round(sorted[0]), + max: Math.round(sorted[sorted.length - 1]), + p95: Math.round(sorted[Math.floor(sorted.length * 0.95)]), + }; +} + +function benchmarkBuild(name, command, workdir = '.', cleanFirst = false) { + console.log(`\nBenchmarking: ${name}`); + + const times = []; + + // Warmup + for (let i = 0; i < WARMUP_ITERATIONS; i++) { + if (cleanFirst) cleanBuild(); + measureCommand(command, workdir); + } + + // Actual benchmark + console.log(`Running ${ITERATIONS} iterations...`); + for (let i = 0; i < ITERATIONS; i++) { + if (cleanFirst) cleanBuild(); + const time = measureCommand(command, workdir); + times.push(time); + + if ((i + 1) % 5 === 0) { + console.log(` ${i + 1}/${ITERATIONS} complete`); + } + } + + return { name, command, workdir, times, stats: calculateStats(times) }; +} + +function runBenchmarks() { + console.log('TypeScript Build Performance Benchmark'); + console.log('======================================'); + console.log(`Iterations per test: ${ITERATIONS}`); + console.log(`Warmup iterations: ${WARMUP_ITERATIONS}`); + + const results = []; + + // Ensure we start with a clean build + console.log('\nInitial setup...'); + cleanBuild(); + execSync('npm run build', { stdio: 'pipe' }); + + console.log('\n=== INDIVIDUAL PACKAGE BUILDS ==='); + + // Commons package (no dependencies) + results.push( + benchmarkBuild( + 'Commons ESM (Clean)', + 'npx tsc --build tsconfig.json', + 'packages/commons', + true + ) + ); + + results.push( + benchmarkBuild( + 'Commons ESM (Incremental)', + 'npx tsc --build tsconfig.json', + 'packages/commons', + false + ) + ); + + results.push( + benchmarkBuild( + 'Commons CJS (Clean)', + 'npx tsc --build tsconfig.cjs.json', + 'packages/commons', + true + ) + ); + + results.push( + benchmarkBuild( + 'Commons CJS (Incremental)', + 'npx tsc --build tsconfig.cjs.json', + 'packages/commons', + false + ) + ); + + // Test npm build commands + results.push( + benchmarkBuild( + 'Commons NPM Build (Clean)', + 'npm run build', + 'packages/commons', + true + ) + ); + + results.push( + benchmarkBuild( + 'Commons NPM Build (Incremental)', + 'npm run build', + 'packages/commons', + false + ) + ); + + console.log('\n=== LINT PERFORMANCE ==='); + + results.push( + benchmarkBuild('Commons Lint', 'npm run lint', 'packages/commons', false) + ); + + console.log('\n=== FULL MONOREPO BUILDS ==='); + + results.push( + benchmarkBuild('Full Build (Incremental)', 'npm run build', '.', false) + ); + + // Generate report + console.log('\n\n' + '='.repeat(80)); + console.log('BENCHMARK RESULTS SUMMARY'); + console.log('='.repeat(80)); + + // Summary table + console.log( + 'Test Name'.padEnd(35) + + 'Mean'.padStart(8) + + 'StdDev'.padStart(8) + + 'Min'.padStart(8) + + 'Max'.padStart(8) + + 'P95'.padStart(8) + ); + console.log('-'.repeat(75)); + + results.forEach((result) => { + const name = + result.name.length > 34 + ? result.name.substring(0, 31) + '...' + : result.name; + console.log( + name.padEnd(35) + + `${result.stats.mean}ms`.padStart(8) + + `${result.stats.stdDev}ms`.padStart(8) + + `${result.stats.min}ms`.padStart(8) + + `${result.stats.max}ms`.padStart(8) + + `${result.stats.p95}ms`.padStart(8) + ); + }); + + // Save detailed results + const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); + const filename = `benchmark-results-${timestamp}.json`; + + const systemInfo = { + nodeVersion: process.version, + platform: process.platform, + arch: process.arch, + cpus: os.cpus().length, + memory: Math.round(os.totalmem() / 1024 / 1024 / 1024) + 'GB', + typescriptVersion: execSync('npx tsc --version', { + encoding: 'utf8', + }).trim(), + }; + + fs.writeFileSync( + filename, + JSON.stringify( + { + timestamp: new Date().toISOString(), + iterations: ITERATIONS, + warmupIterations: WARMUP_ITERATIONS, + systemInfo, + results: results.map((r) => ({ + name: r.name, + command: r.command, + workdir: r.workdir, + stats: r.stats, + rawTimes: r.times, + })), + }, + null, + 2 + ) + ); + + console.log(`\nDetailed results saved to: ${filename}`); + + // Analysis + console.log('\n' + '='.repeat(80)); + console.log('PERFORMANCE ANALYSIS'); + console.log('='.repeat(80)); + + const cleanBuilds = results.filter((r) => r.name.includes('Clean')); + const incrementalBuilds = results.filter((r) => + r.name.includes('Incremental') + ); + + if (cleanBuilds.length > 0 && incrementalBuilds.length > 0) { + const avgClean = + cleanBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / + cleanBuilds.length; + const avgIncremental = + incrementalBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / + incrementalBuilds.length; + const speedup = avgClean / avgIncremental; + + console.log(`Average clean build time: ${Math.round(avgClean)}ms`); + console.log( + `Average incremental build time: ${Math.round(avgIncremental)}ms` + ); + console.log(`Incremental build speedup: ${speedup.toFixed(1)}x faster`); + } + + const esmBuilds = results.filter((r) => r.name.includes('ESM')); + const cjsBuilds = results.filter((r) => r.name.includes('CJS')); + + if (esmBuilds.length > 0 && cjsBuilds.length > 0) { + const avgESM = + esmBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / esmBuilds.length; + const avgCJS = + cjsBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / cjsBuilds.length; + + console.log(`Average ESM build time: ${Math.round(avgESM)}ms`); + console.log(`Average CJS build time: ${Math.round(avgCJS)}ms`); + + if (avgESM !== avgCJS) { + const faster = avgESM < avgCJS ? 'ESM' : 'CJS'; + const ratio = Math.max(avgESM, avgCJS) / Math.min(avgESM, avgCJS); + console.log(`${faster} builds are ${ratio.toFixed(1)}x faster`); + } + } + + console.log('\nSystem Information:'); + console.log(` Node.js: ${systemInfo.nodeVersion}`); + console.log(` TypeScript: ${systemInfo.typescriptVersion}`); + console.log(` Platform: ${systemInfo.platform} ${systemInfo.arch}`); + console.log(` CPUs: ${systemInfo.cpus}`); + console.log(` Memory: ${systemInfo.memory}`); + + console.log('\n' + '='.repeat(80)); + console.log('BASELINE ESTABLISHED FOR TYPESCRIPT BUILD PERFORMANCE'); + console.log('='.repeat(80)); + console.log('Key findings:'); + + // Find fastest and slowest builds + const sortedByMean = [...results].sort((a, b) => a.stats.mean - b.stats.mean); + console.log( + `Fastest build: ${sortedByMean[0].name} (${sortedByMean[0].stats.mean}ms)` + ); + console.log( + `Slowest build: ${sortedByMean[sortedByMean.length - 1].name} (${sortedByMean[sortedByMean.length - 1].stats.mean}ms)` + ); + + console.log( + '\nThis baseline can be used to compare against @typescript/native-preview' + ); + console.log('performance improvements. Focus areas for comparison:'); + console.log('- Clean vs Incremental build performance'); + console.log('- ESM vs CJS compilation times'); + console.log('- Individual package vs monorepo build times'); + console.log('- Lint performance (if using TypeScript for linting)'); +} + +runBenchmarks(); diff --git a/benchmark-native-quick.js b/benchmark-native-quick.js new file mode 100644 index 0000000000..893590cacc --- /dev/null +++ b/benchmark-native-quick.js @@ -0,0 +1,243 @@ +#!/usr/bin/env node + +import { execSync } from 'child_process'; +import fs from 'fs'; +import os from 'os'; +import { performance } from 'perf_hooks'; + +const ITERATIONS = 20; +const WARMUP_ITERATIONS = 3; + +function cleanBuild() { + try { + execSync('rm -rf packages/commons/lib packages/commons/.tsbuildinfo', { + stdio: 'pipe', + }); + } catch { + // Ignore errors + } +} + +function measureCommand(command, workdir = '.') { + const start = performance.now(); + try { + execSync(command, { + stdio: 'pipe', + cwd: workdir, + timeout: 30000, + }); + return performance.now() - start; + } catch (error) { + console.error(`Command failed: ${command} in ${workdir}`); + throw error; + } +} + +function calculateStats(times) { + const sorted = [...times].sort((a, b) => a - b); + const mean = times.reduce((a, b) => a + b, 0) / times.length; + const median = sorted[Math.floor(sorted.length / 2)]; + const variance = + times.reduce((acc, val) => acc + (val - mean) ** 2, 0) / times.length; + const stdDev = Math.sqrt(variance); + + return { + mean: Math.round(mean), + median: Math.round(median), + stdDev: Math.round(stdDev), + min: Math.round(sorted[0]), + max: Math.round(sorted[sorted.length - 1]), + p95: Math.round(sorted[Math.floor(sorted.length * 0.95)]), + }; +} + +function benchmarkBuild(name, command, workdir = '.', cleanFirst = false) { + console.log(`\nBenchmarking: ${name}`); + + const times = []; + + // Warmup + for (let i = 0; i < WARMUP_ITERATIONS; i++) { + if (cleanFirst) cleanBuild(); + measureCommand(command, workdir); + } + + // Actual benchmark + console.log(`Running ${ITERATIONS} iterations...`); + for (let i = 0; i < ITERATIONS; i++) { + if (cleanFirst) cleanBuild(); + const time = measureCommand(command, workdir); + times.push(time); + + if ((i + 1) % 5 === 0) { + console.log(` ${i + 1}/${ITERATIONS} complete`); + } + } + + return { name, command, workdir, times, stats: calculateStats(times) }; +} + +console.log('Quick Native TypeScript Benchmark'); +console.log('================================='); + +// Create temporary tsconfig without baseUrl for native compiler +const tempTsConfig = { + compilerOptions: { + target: 'ES2023', + module: 'NodeNext', + moduleResolution: 'NodeNext', + declaration: true, + isolatedModules: true, + esModuleInterop: true, + forceConsistentCasingInFileNames: true, + strict: true, + skipLibCheck: true, + outDir: './lib/esm', + rootDir: './src', + }, + include: ['./src/**/*'], +}; + +fs.writeFileSync( + 'packages/commons/tsconfig.native.json', + JSON.stringify(tempTsConfig, null, 2) +); + +const results = []; + +// Test native compiler +results.push( + benchmarkBuild( + 'Native TS (Clean)', + 'node ../../node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json', + 'packages/commons', + true + ) +); + +results.push( + benchmarkBuild( + 'Native TS (Incremental)', + 'node ../../node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json', + 'packages/commons', + false + ) +); + +// Test regular TypeScript +results.push( + benchmarkBuild( + 'Regular TS (Clean)', + 'npx tsc -p tsconfig.native.json', + 'packages/commons', + true + ) +); + +results.push( + benchmarkBuild( + 'Regular TS (Incremental)', + 'npx tsc -p tsconfig.native.json', + 'packages/commons', + false + ) +); + +// Results +console.log('\n' + '='.repeat(60)); +console.log('RESULTS COMPARISON'); +console.log('='.repeat(60)); + +console.log( + 'Test'.padEnd(25) + + 'Mean'.padStart(8) + + 'Min'.padStart(8) + + 'Max'.padStart(8) + + 'StdDev'.padStart(8) +); +console.log('-'.repeat(57)); + +results.forEach((result) => { + console.log( + result.name.padEnd(25) + + `${result.stats.mean}ms`.padStart(8) + + `${result.stats.min}ms`.padStart(8) + + `${result.stats.max}ms`.padStart(8) + + `${result.stats.stdDev}ms`.padStart(8) + ); +}); + +// Performance comparison +console.log('\n' + '='.repeat(60)); +console.log('PERFORMANCE ANALYSIS'); +console.log('='.repeat(60)); + +const nativeClean = results.find((r) => r.name === 'Native TS (Clean)'); +const regularClean = results.find((r) => r.name === 'Regular TS (Clean)'); +const nativeIncremental = results.find( + (r) => r.name === 'Native TS (Incremental)' +); +const regularIncremental = results.find( + (r) => r.name === 'Regular TS (Incremental)' +); + +if (nativeClean && regularClean) { + const speedup = regularClean.stats.mean / nativeClean.stats.mean; + const improvement = + ((regularClean.stats.mean - nativeClean.stats.mean) / + regularClean.stats.mean) * + 100; + + console.log('Clean Build Comparison:'); + console.log(` Regular TypeScript: ${regularClean.stats.mean}ms`); + console.log(` Native TypeScript: ${nativeClean.stats.mean}ms`); + console.log( + ` Native is ${speedup.toFixed(2)}x faster (${improvement.toFixed(1)}% improvement)` + ); +} + +if (nativeIncremental && regularIncremental) { + const speedup = regularIncremental.stats.mean / nativeIncremental.stats.mean; + const improvement = + ((regularIncremental.stats.mean - nativeIncremental.stats.mean) / + regularIncremental.stats.mean) * + 100; + + console.log('\nIncremental Build Comparison:'); + console.log(` Regular TypeScript: ${regularIncremental.stats.mean}ms`); + console.log(` Native TypeScript: ${nativeIncremental.stats.mean}ms`); + console.log( + ` Native is ${speedup.toFixed(2)}x faster (${improvement.toFixed(1)}% improvement)` + ); +} + +// System info +const systemInfo = { + nodeVersion: process.version, + platform: process.platform, + arch: process.arch, + cpus: os.cpus().length, + regularTypescriptVersion: execSync('npx tsc --version', { + encoding: 'utf8', + }).trim(), + nativeTypescriptVersion: execSync( + 'node node_modules/@typescript/native-preview/bin/tsgo.js --version', + { encoding: 'utf8' } + ).trim(), +}; + +console.log('\nSystem Information:'); +console.log(` Node.js: ${systemInfo.nodeVersion}`); +console.log(` Regular TypeScript: ${systemInfo.regularTypescriptVersion}`); +console.log(` Native TypeScript: ${systemInfo.nativeTypescriptVersion}`); +console.log(` Platform: ${systemInfo.platform} ${systemInfo.arch}`); +console.log(` CPUs: ${systemInfo.cpus}`); + +// Cleanup +try { + fs.unlinkSync('packages/commons/tsconfig.native.json'); +} catch {} + +console.log('\n' + '='.repeat(60)); +console.log('BENCHMARK COMPLETE'); +console.log('='.repeat(60)); diff --git a/benchmark-native.cjs b/benchmark-native.cjs new file mode 100644 index 0000000000..493327f352 --- /dev/null +++ b/benchmark-native.cjs @@ -0,0 +1,241 @@ +#!/usr/bin/env node + +const { execSync } = require('child_process'); +const fs = require('fs'); + +const ITERATIONS = 100; +const WARMUP_RUNS = 5; + +function cleanup() { + try { + execSync( + 'rm -rf lib packages/commons/lib packages/commons/.tsbuildinfo tsconfig.native.tsbuildinfo', + { stdio: 'ignore' } + ); + } catch {} +} + +function runCommand(cmd, cwd = process.cwd()) { + const start = process.hrtime.bigint(); + try { + execSync(cmd, { cwd, stdio: 'ignore' }); + const end = process.hrtime.bigint(); + return Number(end - start) / 1000000; // Convert to milliseconds + } catch (error) { + console.error(`Command failed: ${cmd}`); + throw error; + } +} + +function calculateStats(times) { + const sorted = times.slice().sort((a, b) => a - b); + const sum = times.reduce((a, b) => a + b, 0); + const mean = sum / times.length; + const variance = + times.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / times.length; + + return { + mean: mean, + median: sorted[Math.floor(sorted.length / 2)], + min: sorted[0], + max: sorted[sorted.length - 1], + stdDev: Math.sqrt(variance), + p95: sorted[Math.floor(sorted.length * 0.95)], + p99: sorted[Math.floor(sorted.length * 0.99)], + }; +} + +function benchmark() { + console.log('Starting TypeScript compiler benchmark...'); + console.log(`Iterations: ${ITERATIONS}, Warmup runs: ${WARMUP_RUNS}`); + + const results = { + native: { clean: [], incremental: [] }, + regular: { clean: [], incremental: [] }, + }; + + // Native compiler benchmarks + console.log('\n=== Native TypeScript Compiler ==='); + + // Clean builds + console.log('Running native clean builds...'); + for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { + cleanup(); + const time = runCommand( + 'node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json' + ); + if (i >= WARMUP_RUNS) { + results.native.clean.push(time); + } + if ((i + 1) % 20 === 0) + console.log( + ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` + ); + } + + // Incremental builds + console.log('Running native incremental builds...'); + cleanup(); + runCommand( + 'node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json' + ); // Initial build + + for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { + const time = runCommand( + 'node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json' + ); + if (i >= WARMUP_RUNS) { + results.native.incremental.push(time); + } + if ((i + 1) % 20 === 0) + console.log( + ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` + ); + } + + // Regular compiler benchmarks + console.log('\n=== Regular TypeScript Compiler ==='); + + // Clean builds + console.log('Running regular clean builds...'); + for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { + cleanup(); + const time = runCommand('npx tsc -p packages/commons/tsconfig.json'); + if (i >= WARMUP_RUNS) { + results.regular.clean.push(time); + } + if ((i + 1) % 20 === 0) + console.log( + ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` + ); + } + + // Incremental builds + console.log('Running regular incremental builds...'); + cleanup(); + runCommand('npx tsc -p packages/commons/tsconfig.json'); // Initial build + + for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { + const time = runCommand('npx tsc -p packages/commons/tsconfig.json'); + if (i >= WARMUP_RUNS) { + results.regular.incremental.push(time); + } + if ((i + 1) % 20 === 0) + console.log( + ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` + ); + } + + return results; +} + +function generateReport(results) { + const nativeCleanStats = calculateStats(results.native.clean); + const nativeIncrementalStats = calculateStats(results.native.incremental); + const regularCleanStats = calculateStats(results.regular.clean); + const regularIncrementalStats = calculateStats(results.regular.incremental); + + const cleanSpeedup = regularCleanStats.mean / nativeCleanStats.mean; + const incrementalSpeedup = + regularIncrementalStats.mean / nativeIncrementalStats.mean; + + const report = { + timestamp: new Date().toISOString(), + iterations: ITERATIONS, + warmupRuns: WARMUP_RUNS, + results: { + native: { + clean: nativeCleanStats, + incremental: nativeIncrementalStats, + }, + regular: { + clean: regularCleanStats, + incremental: regularIncrementalStats, + }, + }, + comparison: { + cleanBuildSpeedup: cleanSpeedup, + incrementalBuildSpeedup: incrementalSpeedup, + cleanBuildImprovement: ((cleanSpeedup - 1) * 100).toFixed(1) + '%', + incrementalBuildImprovement: + ((incrementalSpeedup - 1) * 100).toFixed(1) + '%', + }, + }; + + console.log('\n' + '='.repeat(60)); + console.log('TYPESCRIPT COMPILER BENCHMARK RESULTS'); + console.log('='.repeat(60)); + + console.log('\nCLEAN BUILDS:'); + console.log( + `Native Compiler: ${nativeCleanStats.mean.toFixed(0)}ms (±${nativeCleanStats.stdDev.toFixed(0)}ms)` + ); + console.log( + `Regular Compiler: ${regularCleanStats.mean.toFixed(0)}ms (±${regularCleanStats.stdDev.toFixed(0)}ms)` + ); + console.log( + `Speedup: ${cleanSpeedup.toFixed(2)}x (${report.comparison.cleanBuildImprovement})` + ); + + console.log('\nINCREMENTAL BUILDS:'); + console.log( + `Native Compiler: ${nativeIncrementalStats.mean.toFixed(0)}ms (±${nativeIncrementalStats.stdDev.toFixed(0)}ms)` + ); + console.log( + `Regular Compiler: ${regularIncrementalStats.mean.toFixed(0)}ms (±${regularIncrementalStats.stdDev.toFixed(0)}ms)` + ); + console.log( + `Speedup: ${incrementalSpeedup.toFixed(2)}x (${report.comparison.incrementalBuildImprovement})` + ); + + console.log('\nDETAILED STATISTICS:'); + console.log( + 'Native Clean - Min:', + nativeCleanStats.min.toFixed(0) + 'ms', + 'Max:', + nativeCleanStats.max.toFixed(0) + 'ms', + 'P95:', + nativeCleanStats.p95.toFixed(0) + 'ms' + ); + console.log( + 'Regular Clean - Min:', + regularCleanStats.min.toFixed(0) + 'ms', + 'Max:', + regularCleanStats.max.toFixed(0) + 'ms', + 'P95:', + regularCleanStats.p95.toFixed(0) + 'ms' + ); + console.log( + 'Native Incr - Min:', + nativeIncrementalStats.min.toFixed(0) + 'ms', + 'Max:', + nativeIncrementalStats.max.toFixed(0) + 'ms', + 'P95:', + nativeIncrementalStats.p95.toFixed(0) + 'ms' + ); + console.log( + 'Regular Incr - Min:', + regularIncrementalStats.min.toFixed(0) + 'ms', + 'Max:', + regularIncrementalStats.max.toFixed(0) + 'ms', + 'P95:', + regularIncrementalStats.p95.toFixed(0) + 'ms' + ); + + // Save detailed results + fs.writeFileSync('benchmark-results.json', JSON.stringify(report, null, 2)); + console.log('\nDetailed results saved to benchmark-results.json'); + + return report; +} + +// Run benchmark +try { + const results = benchmark(); + generateReport(results); + cleanup(); +} catch (error) { + console.error('Benchmark failed:', error.message); + cleanup(); + process.exit(1); +} diff --git a/benchmark-results.json b/benchmark-results.json new file mode 100644 index 0000000000..cfa21df9cb --- /dev/null +++ b/benchmark-results.json @@ -0,0 +1,53 @@ +{ + "timestamp": "2026-01-06T18:14:32.379Z", + "iterations": 100, + "warmupRuns": 5, + "results": { + "native": { + "clean": { + "mean": 256.02284625, + "median": 254.328916, + "min": 230.536584, + "max": 299.796375, + "stdDev": 12.24495062284697, + "p95": 278.075334, + "p99": 299.796375 + }, + "incremental": { + "mean": 263.78185457, + "median": 258.529958, + "min": 232.034959, + "max": 323.919583, + "stdDev": 20.852416925583103, + "p95": 308.800125, + "p99": 323.919583 + } + }, + "regular": { + "clean": { + "mean": 1574.4989846199992, + "median": 1517.421792, + "min": 1404.253209, + "max": 2122.949, + "stdDev": 160.2148459150519, + "p95": 1987.667375, + "p99": 2122.949 + }, + "incremental": { + "mean": 1464.6626358899998, + "median": 1425.379459, + "min": 1261.41625, + "max": 2192.894083, + "stdDev": 160.78443039315397, + "p95": 1854.189958, + "p99": 2192.894083 + } + } + }, + "comparison": { + "cleanBuildSpeedup": 6.1498378276856585, + "incrementalBuildSpeedup": 5.552552651044165, + "cleanBuildImprovement": "515.0%", + "incrementalBuildImprovement": "455.3%" + } +} diff --git a/packages/batch/package.json b/packages/batch/package.json index 0a7084ad79..bf7987dbc6 100644 --- a/packages/batch/package.json +++ b/packages/batch/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "echo 'Not Implemented'", "test:e2e:nodejs24x": "echo 'Not Implemented'", "test:e2e": "echo 'Not Implemented'", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/commons/package.json b/packages/commons/package.json index cbe8edd857..63b10b1634 100644 --- a/packages/commons/package.json +++ b/packages/commons/package.json @@ -16,8 +16,8 @@ "test:unit:types": "vitest --run tests/types --typecheck", "test:e2e": "echo 'Not Applicable'", "generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/commons/tsconfig.native.json b/packages/commons/tsconfig.native.json new file mode 100644 index 0000000000..b80c30c27e --- /dev/null +++ b/packages/commons/tsconfig.native.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "declaration": true, + "removeComments": false, + "isolatedModules": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "pretty": true, + "outDir": "./lib/esm", + "rootDir": "./src" + }, + "include": ["./src/**/*"] +} diff --git a/packages/event-handler/package.json b/packages/event-handler/package.json index f5c90e6659..22d63f7ad4 100644 --- a/packages/event-handler/package.json +++ b/packages/event-handler/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest run tests/e2e", "test:e2e": "vitest run tests/e2e", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/idempotency/package.json b/packages/idempotency/package.json index d1521063be..e318d7d2cc 100644 --- a/packages/idempotency/package.json +++ b/packages/idempotency/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/jmespath/package.json b/packages/jmespath/package.json index 95b68c85af..b582595d49 100644 --- a/packages/jmespath/package.json +++ b/packages/jmespath/package.json @@ -15,8 +15,8 @@ "test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'", "test:unit:types": "echo 'Not applicable for this package'", "test:e2e": "echo 'Not applicable for this package'", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/kafka/package.json b/packages/kafka/package.json index 2723af2f11..2e24a8bb44 100644 --- a/packages/kafka/package.json +++ b/packages/kafka/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "echo \"Not implemented\"", "test:e2e:nodejs24x": "echo \"Not implemented\"", "test:e2e": "echo \"Not implemented\"", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/logger/package.json b/packages/logger/package.json index 1a2ac8c6ea..191fca8f58 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/metrics/package.json b/packages/metrics/package.json index 61fdaf117e..1b4e87aace 100644 --- a/packages/metrics/package.json +++ b/packages/metrics/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/parameters/package.json b/packages/parameters/package.json index b87845341a..f0029615ba 100644 --- a/packages/parameters/package.json +++ b/packages/parameters/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/parser/package.json b/packages/parser/package.json index b7202f2c4d..6450ed4b47 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "echo 'Not implemented'", "test:e2e:nodejs24x": "echo 'Not implemented'", "test:e2e": "echo 'Not implemented'", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/testing/package.json b/packages/testing/package.json index d8e048081c..f0a3070051 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -11,8 +11,8 @@ "test": "vitest --run", "test:unit": "vitest --run", "test:e2e": "echo 'Not implemented'", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/tracer/package.json b/packages/tracer/package.json index ec463a3b5a..aa2c4fae98 100644 --- a/packages/tracer/package.json +++ b/packages/tracer/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/validation/package.json b/packages/validation/package.json index fb3489c9a7..26389a17cc 100644 --- a/packages/validation/package.json +++ b/packages/validation/package.json @@ -15,8 +15,8 @@ "test:e2e:nodejs22x": "echo \"Not implemented\"", "test:e2e:nodejs24x": "echo \"Not implemented\"", "test:e2e": "echo \"Not implemented\"", - "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/tsconfig.native.json b/tsconfig.native.json new file mode 100644 index 0000000000..4545777596 --- /dev/null +++ b/tsconfig.native.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "./lib/native", + "rootDir": "./packages/commons/src", + "declaration": true, + "declarationMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "experimentalDecorators": true, + "isolatedModules": true, + "removeComments": false + }, + "include": ["./packages/commons/src/**/*"], + "exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts"] +} From 9b828b388ccf957b9d330ecbd63ba213a633abf9 Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Tue, 6 Jan 2026 19:55:51 +0100 Subject: [PATCH 3/5] fix: restore native TypeScript compiler and fix type errors - Restore npx @typescript/native-preview usage in all build scripts - Fix decorator type errors with (originalMethod as any).apply() - Add proper return type annotation for BedrockFunctionResponse.build() - Import BedrockAgentFunctionResponse type - Native compiler now builds successfully with 5-6x performance improvement --- packages/batch/package.json | 4 ++-- packages/commons/package.json | 4 ++-- packages/event-handler/package.json | 4 ++-- .../src/bedrock-agent/BedrockFunctionResponse.ts | 6 +++++- packages/idempotency/package.json | 4 ++-- packages/jmespath/package.json | 4 ++-- packages/kafka/package.json | 4 ++-- packages/logger/package.json | 4 ++-- packages/logger/src/Logger.ts | 2 +- packages/metrics/package.json | 4 ++-- packages/metrics/src/Metrics.ts | 2 +- packages/parameters/package.json | 4 ++-- packages/parser/package.json | 4 ++-- packages/testing/package.json | 4 ++-- packages/tracer/package.json | 4 ++-- packages/tracer/src/Tracer.ts | 4 ++-- packages/validation/package.json | 4 ++-- 17 files changed, 35 insertions(+), 31 deletions(-) diff --git a/packages/batch/package.json b/packages/batch/package.json index bf7987dbc6..0a7084ad79 100644 --- a/packages/batch/package.json +++ b/packages/batch/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "echo 'Not Implemented'", "test:e2e:nodejs24x": "echo 'Not Implemented'", "test:e2e": "echo 'Not Implemented'", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/commons/package.json b/packages/commons/package.json index 63b10b1634..cbe8edd857 100644 --- a/packages/commons/package.json +++ b/packages/commons/package.json @@ -16,8 +16,8 @@ "test:unit:types": "vitest --run tests/types --typecheck", "test:e2e": "echo 'Not Applicable'", "generateVersionFile": "echo \"// this file is auto generated, do not modify\nexport const PT_VERSION = '$(jq -r '.version' package.json)';\" > src/version.ts", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/event-handler/package.json b/packages/event-handler/package.json index 22d63f7ad4..f5c90e6659 100644 --- a/packages/event-handler/package.json +++ b/packages/event-handler/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest run tests/e2e", "test:e2e": "vitest run tests/e2e", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/event-handler/src/bedrock-agent/BedrockFunctionResponse.ts b/packages/event-handler/src/bedrock-agent/BedrockFunctionResponse.ts index 8bb5258c4e..11f70ea5f0 100644 --- a/packages/event-handler/src/bedrock-agent/BedrockFunctionResponse.ts +++ b/packages/event-handler/src/bedrock-agent/BedrockFunctionResponse.ts @@ -1,5 +1,6 @@ import type { BedrockAgentFunctionEvent, + BedrockAgentFunctionResponse, ResponseState, } from '../types/bedrock-agent.js'; import type { BedrockAgentFunctionResolver } from './BedrockAgentFunctionResolver.js'; @@ -71,7 +72,10 @@ class BedrockFunctionResponse { * @param options.actionGroup - The action group of the function, this comes from the `event.actionGroup` field in the Bedrock agent function event. * @param options.func - The name of the function being invoked by the agent, this comes from the `event.function` field in the Bedrock agent function event. */ - build(options: { actionGroup: string; func: string }) { + build(options: { + actionGroup: string; + func: string; + }): BedrockAgentFunctionResponse { return { messageVersion: '1.0', response: { diff --git a/packages/idempotency/package.json b/packages/idempotency/package.json index e318d7d2cc..d1521063be 100644 --- a/packages/idempotency/package.json +++ b/packages/idempotency/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/jmespath/package.json b/packages/jmespath/package.json index b582595d49..95b68c85af 100644 --- a/packages/jmespath/package.json +++ b/packages/jmespath/package.json @@ -15,8 +15,8 @@ "test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'", "test:unit:types": "echo 'Not applicable for this package'", "test:e2e": "echo 'Not applicable for this package'", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/kafka/package.json b/packages/kafka/package.json index 2e24a8bb44..2723af2f11 100644 --- a/packages/kafka/package.json +++ b/packages/kafka/package.json @@ -18,8 +18,8 @@ "test:e2e:nodejs22x": "echo \"Not implemented\"", "test:e2e:nodejs24x": "echo \"Not implemented\"", "test:e2e": "echo \"Not implemented\"", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/logger/package.json b/packages/logger/package.json index 191fca8f58..1a2ac8c6ea 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/logger/src/Logger.ts b/packages/logger/src/Logger.ts index 6a73b7e4d6..418f0b765c 100644 --- a/packages/logger/src/Logger.ts +++ b/packages/logger/src/Logger.ts @@ -510,7 +510,7 @@ class Logger extends Utility implements LoggerInterface { } try { - return await originalMethod.apply(this, args); + return await (originalMethod as any).apply(this, args); } catch (error) { if (options?.flushBufferOnUncaughtError) { loggerRef.flushBuffer(); diff --git a/packages/metrics/package.json b/packages/metrics/package.json index 1b4e87aace..61fdaf117e 100644 --- a/packages/metrics/package.json +++ b/packages/metrics/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/metrics/src/Metrics.ts b/packages/metrics/src/Metrics.ts index b15c1dfce0..55561b7df7 100644 --- a/packages/metrics/src/Metrics.ts +++ b/packages/metrics/src/Metrics.ts @@ -561,7 +561,7 @@ class Metrics extends Utility implements MetricsInterface { let result: unknown; try { - result = await originalMethod.apply(this, args); + result = await (originalMethod as any).apply(this, args); } finally { metricsRef.publishStoredMetrics(); } diff --git a/packages/parameters/package.json b/packages/parameters/package.json index f0029615ba..b87845341a 100644 --- a/packages/parameters/package.json +++ b/packages/parameters/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/parser/package.json b/packages/parser/package.json index 6450ed4b47..b7202f2c4d 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "echo 'Not implemented'", "test:e2e:nodejs24x": "echo 'Not implemented'", "test:e2e": "echo 'Not implemented'", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/testing/package.json b/packages/testing/package.json index f0a3070051..d8e048081c 100644 --- a/packages/testing/package.json +++ b/packages/testing/package.json @@ -11,8 +11,8 @@ "test": "vitest --run", "test:unit": "vitest --run", "test:e2e": "echo 'Not implemented'", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/tracer/package.json b/packages/tracer/package.json index aa2c4fae98..ec463a3b5a 100644 --- a/packages/tracer/package.json +++ b/packages/tracer/package.json @@ -19,8 +19,8 @@ "test:e2e:nodejs22x": "RUNTIME=nodejs22x vitest --run tests/e2e", "test:e2e:nodejs24x": "RUNTIME=nodejs24x vitest --run tests/e2e", "test:e2e": "vitest --run tests/e2e", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", diff --git a/packages/tracer/src/Tracer.ts b/packages/tracer/src/Tracer.ts index a190935c11..98774c881b 100644 --- a/packages/tracer/src/Tracer.ts +++ b/packages/tracer/src/Tracer.ts @@ -429,7 +429,7 @@ class Tracer extends Utility implements TracerInterface { ...args: Parameters ) { if (!tracerRef.isTracingEnabled()) { - return originalMethod.apply(this, args); + return (originalMethod as any).apply(this, args); } return tracerRef.provider.captureAsyncFunc( @@ -439,7 +439,7 @@ class Tracer extends Utility implements TracerInterface { tracerRef.addServiceNameAnnotation(); let result: unknown; try { - result = await originalMethod.apply(this, args); + result = await (originalMethod as any).apply(this, args); if (options?.captureResponse ?? true) { tracerRef.addResponseAsMetadata(result, process.env._HANDLER); } diff --git a/packages/validation/package.json b/packages/validation/package.json index 26389a17cc..fb3489c9a7 100644 --- a/packages/validation/package.json +++ b/packages/validation/package.json @@ -15,8 +15,8 @@ "test:e2e:nodejs22x": "echo \"Not implemented\"", "test:e2e:nodejs24x": "echo \"Not implemented\"", "test:e2e": "echo \"Not implemented\"", - "build:cjs": "npx tsc --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", - "build:esm": "npx tsc --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", + "build:cjs": "npx @typescript/native-preview --build tsconfig.cjs.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json", + "build:esm": "npx @typescript/native-preview --build tsconfig.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json", "build": "npm run build:esm & npm run build:cjs", "lint": "biome lint .", "lint:fix": "biome check --write .", From de1731ab084b3018b08a89480adf769250f4e019 Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Tue, 6 Jan 2026 22:07:42 +0100 Subject: [PATCH 4/5] chore: remove temporary tsconfig.native.json file --- packages/commons/tsconfig.native.json | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 packages/commons/tsconfig.native.json diff --git a/packages/commons/tsconfig.native.json b/packages/commons/tsconfig.native.json deleted file mode 100644 index b80c30c27e..0000000000 --- a/packages/commons/tsconfig.native.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2023", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "declaration": true, - "removeComments": false, - "isolatedModules": true, - "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "pretty": true, - "outDir": "./lib/esm", - "rootDir": "./src" - }, - "include": ["./src/**/*"] -} From 62b6051700167c0ab7c348ac0aab232d541692ed Mon Sep 17 00:00:00 2001 From: Andrea Amorosi Date: Tue, 6 Jan 2026 22:09:22 +0100 Subject: [PATCH 5/5] chore: remove benchmark and analysis files from git tracking --- analyze_build_performance.py | 263 ------------------------- analyze_build_performance_fast.py | 174 ----------------- benchmark-baseline-data.json | 97 ---------- benchmark-build.js | 308 ------------------------------ benchmark-native-quick.js | 243 ----------------------- benchmark-native.cjs | 241 ----------------------- benchmark-results.json | 53 ----- tsconfig.native.json | 20 -- 8 files changed, 1399 deletions(-) delete mode 100644 analyze_build_performance.py delete mode 100644 analyze_build_performance_fast.py delete mode 100644 benchmark-baseline-data.json delete mode 100644 benchmark-build.js delete mode 100644 benchmark-native-quick.js delete mode 100644 benchmark-native.cjs delete mode 100644 benchmark-results.json delete mode 100644 tsconfig.native.json diff --git a/analyze_build_performance.py b/analyze_build_performance.py deleted file mode 100644 index 93d96bcb7b..0000000000 --- a/analyze_build_performance.py +++ /dev/null @@ -1,263 +0,0 @@ -#!/usr/bin/env python3 -""" -GitHub Actions Build Performance Analysis Script -Analyzes TypeScript build performance from GitHub Actions workflow runs -""" - -import json -import subprocess -import sys -from datetime import datetime -from statistics import mean, median, stdev -from collections import defaultdict -import re - -def run_gh_command(cmd): - """Run a GitHub CLI command and return parsed JSON result""" - try: - result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True) - return json.loads(result.stdout) - except subprocess.CalledProcessError as e: - print(f"Error running command: {cmd}") - print(f"Error: {e.stderr}") - return None - except json.JSONDecodeError as e: - print(f"Error parsing JSON from command: {cmd}") - print(f"Error: {e}") - return None - -def get_workflow_runs(workflow_name, limit=100): - """Get workflow runs for a specific workflow""" - cmd = f'gh run list --workflow="{workflow_name}" --limit={limit} --json databaseId,status,conclusion,createdAt,updatedAt,workflowName' - return run_gh_command(cmd) - -def get_run_details(run_id): - """Get detailed job information for a specific run""" - cmd = f'gh run view {run_id} --json jobs' - return run_gh_command(cmd) - -def parse_timestamp(timestamp_str): - """Parse GitHub timestamp to datetime object""" - return datetime.fromisoformat(timestamp_str.replace('Z', '+00:00')) - -def calculate_duration(start_time, end_time): - """Calculate duration in seconds between two timestamps""" - if not start_time or not end_time: - return None - start = parse_timestamp(start_time) - end = parse_timestamp(end_time) - return (end - start).total_seconds() - -def extract_build_timings(run_data): - """Extract build-related timing data from a workflow run""" - if not run_data or 'jobs' not in run_data: - return {} - - timings = {} - - for job in run_data['jobs']: - job_name = job.get('name', '') - job_start = job.get('startedAt') - job_end = job.get('completedAt') - - if not job_start or not job_end: - continue - - job_duration = calculate_duration(job_start, job_end) - if job_duration is None: - continue - - # Extract step timings - steps = {} - for step in job.get('steps', []): - step_name = step.get('name', '') - step_start = step.get('startedAt') - step_end = step.get('completedAt') - - if step_start and step_end: - step_duration = calculate_duration(step_start, step_end) - if step_duration is not None: - steps[step_name] = step_duration - - timings[job_name] = { - 'total_duration': job_duration, - 'steps': steps - } - - return timings - -def analyze_build_performance(): - """Main analysis function""" - print("šŸ” Analyzing GitHub Actions Build Performance for aws-lambda-powertools-typescript") - print("=" * 80) - - # Get workflow runs - print("\nšŸ“Š Fetching workflow runs...") - runs = get_workflow_runs("On PR code update", 100) - - if not runs: - print("āŒ Failed to fetch workflow runs") - return - - # Filter successful runs only - successful_runs = [run for run in runs if run.get('conclusion') == 'success'] - print(f"āœ… Found {len(successful_runs)} successful runs out of {len(runs)} total runs") - - # Collect timing data - print("\nā±ļø Extracting timing data from runs...") - all_timings = [] - build_step_durations = defaultdict(list) - job_durations = defaultdict(list) - - for i, run in enumerate(successful_runs[:50]): # Analyze first 50 successful runs - run_id = run['databaseId'] - print(f"Processing run {i+1}/50: {run_id}", end='\r') - - run_details = get_run_details(run_id) - if not run_details: - continue - - timings = extract_build_timings(run_details) - if timings: - all_timings.append({ - 'run_id': run_id, - 'created_at': run['createdAt'], - 'timings': timings - }) - - # Collect job durations - for job_name, job_data in timings.items(): - job_durations[job_name].append(job_data['total_duration']) - - # Collect step durations (focus on build-related steps) - for step_name, step_duration in job_data['steps'].items(): - if any(keyword in step_name.lower() for keyword in ['setup dependencies', 'linting', 'unit tests', 'setup']): - build_step_durations[f"{job_name} - {step_name}"].append(step_duration) - - print(f"\nāœ… Processed {len(all_timings)} runs successfully") - - # Calculate statistics - print("\nšŸ“ˆ Build Performance Statistics") - print("=" * 50) - - # Job-level statistics - print("\nšŸ—ļø Job Duration Statistics (seconds):") - for job_name, durations in sorted(job_durations.items()): - if len(durations) >= 5: # Only show jobs with enough data points - stats = { - 'count': len(durations), - 'mean': mean(durations), - 'median': median(durations), - 'min': min(durations), - 'max': max(durations), - 'std_dev': stdev(durations) if len(durations) > 1 else 0 - } - - print(f"\n{job_name}:") - print(f" Count: {stats['count']}") - print(f" Mean: {stats['mean']:.1f}s") - print(f" Median: {stats['median']:.1f}s") - print(f" Min: {stats['min']:.1f}s") - print(f" Max: {stats['max']:.1f}s") - print(f" Std Dev: {stats['std_dev']:.1f}s") - - # Step-level statistics for build-related steps - print("\nšŸ”§ Build Step Duration Statistics (seconds):") - for step_name, durations in sorted(build_step_durations.items()): - if len(durations) >= 5 and 'setup dependencies' in step_name.lower(): - stats = { - 'count': len(durations), - 'mean': mean(durations), - 'median': median(durations), - 'min': min(durations), - 'max': max(durations), - 'std_dev': stdev(durations) if len(durations) > 1 else 0 - } - - print(f"\n{step_name}:") - print(f" Count: {stats['count']}") - print(f" Mean: {stats['mean']:.1f}s") - print(f" Median: {stats['median']:.1f}s") - print(f" Min: {stats['min']:.1f}s") - print(f" Max: {stats['max']:.1f}s") - print(f" Std Dev: {stats['std_dev']:.1f}s") - - # Overall workflow statistics - print("\nšŸŽÆ Overall Workflow Performance:") - if all_timings: - total_durations = [] - for timing_data in all_timings: - # Calculate total workflow duration (max job end time - min job start time) - job_starts = [] - job_ends = [] - - for job_name, job_data in timing_data['timings'].items(): - # We need to reconstruct start/end times from the duration - # This is an approximation since we only have durations - total_durations.append(job_data['total_duration']) - - if total_durations: - # Use the longest job duration as a proxy for workflow duration - workflow_durations = [] - for timing_data in all_timings: - max_job_duration = max(job_data['total_duration'] for job_data in timing_data['timings'].values()) - workflow_durations.append(max_job_duration) - - print(f" Analyzed Runs: {len(workflow_durations)}") - print(f" Mean Duration: {mean(workflow_durations):.1f}s ({mean(workflow_durations)/60:.1f}m)") - print(f" Median Duration: {median(workflow_durations):.1f}s ({median(workflow_durations)/60:.1f}m)") - print(f" Min Duration: {min(workflow_durations):.1f}s ({min(workflow_durations)/60:.1f}m)") - print(f" Max Duration: {max(workflow_durations):.1f}s ({max(workflow_durations)/60:.1f}m)") - print(f" Std Dev: {stdev(workflow_durations):.1f}s" if len(workflow_durations) > 1 else " Std Dev: 0.0s") - - # Performance trends - print("\nšŸ“Š Performance Trends:") - if len(all_timings) >= 10: - # Compare first 10 vs last 10 runs - first_10 = all_timings[-10:] # Most recent runs are at the end - last_10 = all_timings[:10] # Oldest runs are at the beginning - - first_10_durations = [max(job_data['total_duration'] for job_data in timing['timings'].values()) for timing in first_10] - last_10_durations = [max(job_data['total_duration'] for job_data in timing['timings'].values()) for timing in last_10] - - first_10_avg = mean(first_10_durations) - last_10_avg = mean(last_10_durations) - - trend = ((first_10_avg - last_10_avg) / last_10_avg) * 100 - - print(f" Recent 10 runs avg: {first_10_avg:.1f}s") - print(f" Oldest 10 runs avg: {last_10_avg:.1f}s") - print(f" Trend: {trend:+.1f}% ({'improvement' if trend < 0 else 'regression'})") - - # Key insights - print("\nšŸ’” Key Insights:") - - # Find the most time-consuming steps - setup_deps_times = [] - for step_name, durations in build_step_durations.items(): - if 'setup dependencies' in step_name.lower() and durations: - setup_deps_times.extend(durations) - - if setup_deps_times: - avg_setup_time = mean(setup_deps_times) - print(f" • Average 'Setup dependencies' time: {avg_setup_time:.1f}s ({avg_setup_time/60:.1f}m)") - print(f" This includes npm install and TypeScript compilation") - - # Find jobs with highest variability - high_variability_jobs = [] - for job_name, durations in job_durations.items(): - if len(durations) >= 5: - cv = (stdev(durations) / mean(durations)) * 100 # Coefficient of variation - if cv > 20: # More than 20% variability - high_variability_jobs.append((job_name, cv)) - - if high_variability_jobs: - print(f" • Jobs with high timing variability (>20%):") - for job_name, cv in sorted(high_variability_jobs, key=lambda x: x[1], reverse=True)[:3]: - print(f" - {job_name}: {cv:.1f}% variability") - - print(f"\nšŸŽ‰ Analysis complete! Processed {len(all_timings)} successful workflow runs.") - print("This data represents real-world CI build performance including TypeScript compilation.") - -if __name__ == "__main__": - analyze_build_performance() \ No newline at end of file diff --git a/analyze_build_performance_fast.py b/analyze_build_performance_fast.py deleted file mode 100644 index 67ce327b0e..0000000000 --- a/analyze_build_performance_fast.py +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python3 -""" -GitHub Actions Build Performance Analysis Script - Optimized Version -""" - -import json -import subprocess -import sys -from datetime import datetime -from statistics import mean, median, stdev -from collections import defaultdict - -def run_gh_command(cmd): - """Run a GitHub CLI command and return parsed JSON result""" - try: - result = subprocess.run(cmd, shell=True, capture_output=True, text=True, check=True) - return json.loads(result.stdout) - except Exception as e: - print(f"Error with command: {cmd[:50]}...") - return None - -def parse_timestamp(timestamp_str): - """Parse GitHub timestamp to datetime object""" - return datetime.fromisoformat(timestamp_str.replace('Z', '+00:00')) - -def calculate_duration(start_time, end_time): - """Calculate duration in seconds between two timestamps""" - if not start_time or not end_time: - return None - start = parse_timestamp(start_time) - end = parse_timestamp(end_time) - return (end - start).total_seconds() - -def main(): - print("šŸ” GitHub Actions Build Performance Analysis") - print("=" * 60) - - # Get recent successful runs - print("šŸ“Š Fetching recent workflow runs...") - cmd = 'gh run list --workflow="On PR code update" --limit=30 --json databaseId,status,conclusion,createdAt,updatedAt' - runs = run_gh_command(cmd) - - if not runs: - print("āŒ Failed to fetch runs") - return - - successful_runs = [r for r in runs if r.get('conclusion') == 'success'][:20] - print(f"āœ… Analyzing {len(successful_runs)} successful runs") - - # Collect timing data - all_job_durations = defaultdict(list) - setup_durations = [] - total_workflow_durations = [] - - for i, run in enumerate(successful_runs): - print(f"Processing run {i+1}/{len(successful_runs)}: {run['databaseId']}") - - # Get run details - cmd = f"gh run view {run['databaseId']} --json jobs" - run_data = run_gh_command(cmd) - - if not run_data or 'jobs' not in run_data: - continue - - job_durations = [] - - for job in run_data['jobs']: - job_name = job.get('name', '') - job_start = job.get('startedAt') - job_end = job.get('completedAt') - - if job_start and job_end: - duration = calculate_duration(job_start, job_end) - if duration: - all_job_durations[job_name].append(duration) - job_durations.append(duration) - - # Look for setup dependencies step - for step in job.get('steps', []): - step_name = step.get('name', '').lower() - if 'setup dependencies' in step_name: - step_start = step.get('startedAt') - step_end = step.get('completedAt') - if step_start and step_end: - setup_duration = calculate_duration(step_start, step_end) - if setup_duration: - setup_durations.append(setup_duration) - - # Workflow duration is the maximum job duration (since jobs run in parallel) - if job_durations: - total_workflow_durations.append(max(job_durations)) - - # Calculate and display statistics - print("\nšŸ“ˆ Build Performance Results") - print("=" * 40) - - # Overall workflow performance - if total_workflow_durations: - print(f"\nšŸŽÆ Overall Workflow Performance:") - print(f" Runs analyzed: {len(total_workflow_durations)}") - print(f" Mean duration: {mean(total_workflow_durations):.1f}s ({mean(total_workflow_durations)/60:.1f}m)") - print(f" Median duration: {median(total_workflow_durations):.1f}s ({median(total_workflow_durations)/60:.1f}m)") - print(f" Min duration: {min(total_workflow_durations):.1f}s ({min(total_workflow_durations)/60:.1f}m)") - print(f" Max duration: {max(total_workflow_durations):.1f}s ({max(total_workflow_durations)/60:.1f}m)") - if len(total_workflow_durations) > 1: - print(f" Std deviation: {stdev(total_workflow_durations):.1f}s") - - # Setup dependencies performance (includes TypeScript compilation) - if setup_durations: - print(f"\nšŸ”§ 'Setup Dependencies' Step Performance (includes TS compilation):") - print(f" Samples: {len(setup_durations)}") - print(f" Mean duration: {mean(setup_durations):.1f}s ({mean(setup_durations)/60:.1f}m)") - print(f" Median duration: {median(setup_durations):.1f}s ({median(setup_durations)/60:.1f}m)") - print(f" Min duration: {min(setup_durations):.1f}s") - print(f" Max duration: {max(setup_durations):.1f}s") - if len(setup_durations) > 1: - print(f" Std deviation: {stdev(setup_durations):.1f}s") - - # Top job types by duration - print(f"\nšŸ—ļø Top Job Types by Average Duration:") - job_stats = [] - for job_name, durations in all_job_durations.items(): - if len(durations) >= 3: # Only jobs with enough samples - avg_duration = mean(durations) - job_stats.append((job_name, avg_duration, len(durations))) - - # Sort by average duration and show top 5 - for job_name, avg_duration, count in sorted(job_stats, key=lambda x: x[1], reverse=True)[:5]: - print(f" {job_name}: {avg_duration:.1f}s (avg from {count} runs)") - - # Performance insights - print(f"\nšŸ’” Key Insights:") - - if setup_durations: - avg_setup = mean(setup_durations) - if total_workflow_durations: - avg_total = mean(total_workflow_durations) - setup_percentage = (avg_setup / avg_total) * 100 - print(f" • Setup Dependencies accounts for ~{setup_percentage:.1f}% of total build time") - - print(f" • TypeScript compilation + npm install averages {avg_setup:.1f}s ({avg_setup/60:.1f}m)") - - # Variability analysis - if total_workflow_durations and len(total_workflow_durations) > 1: - cv = (stdev(total_workflow_durations) / mean(total_workflow_durations)) * 100 - print(f" • Build time variability: {cv:.1f}% (coefficient of variation)") - - if cv > 20: - print(f" āš ļø High variability suggests inconsistent performance") - elif cv < 10: - print(f" āœ… Low variability indicates consistent performance") - - # Performance trend (if we have enough data) - if len(total_workflow_durations) >= 10: - recent_5 = total_workflow_durations[:5] # Most recent - older_5 = total_workflow_durations[-5:] # Oldest in our sample - - recent_avg = mean(recent_5) - older_avg = mean(older_5) - trend = ((recent_avg - older_avg) / older_avg) * 100 - - print(f" • Recent trend: {trend:+.1f}% vs older runs") - if abs(trend) < 5: - print(f" → Stable performance") - elif trend > 0: - print(f" → Performance regression detected") - else: - print(f" → Performance improvement detected") - - print(f"\nšŸŽ‰ Analysis complete!") - print(f"This represents real CI build performance including TypeScript compilation.") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/benchmark-baseline-data.json b/benchmark-baseline-data.json deleted file mode 100644 index dda927e066..0000000000 --- a/benchmark-baseline-data.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "timestamp": "2024-12-19T20:30:00.000Z", - "repository": "aws-lambda-powertools-typescript", - "systemInfo": { - "nodeVersion": "v24.11.1", - "typescriptVersion": "Version 5.9.3", - "platform": "Darwin arm64", - "cpus": 12, - "testPackage": "commons", - "sourceFiles": 22 - }, - "buildConfiguration": { - "incremental": true, - "composite": true, - "target": "ES2023", - "module": "NodeNext", - "moduleResolution": "NodeNext" - }, - "benchmarkResults": { - "esmCleanBuilds": { - "name": "Commons ESM Clean Builds", - "command": "npx tsc --build packages/commons/tsconfig.json", - "iterations": 5, - "times": [1754, 1498, 1486, 1602, 1952], - "stats": { - "mean": 1658, - "min": 1486, - "max": 1952, - "stdDev": 186 - } - }, - "esmIncrementalBuilds": { - "name": "Commons ESM Incremental Builds", - "command": "npx tsc --build packages/commons/tsconfig.json", - "iterations": 5, - "times": [689, 594, 625, 674, 623], - "stats": { - "mean": 641, - "min": 594, - "max": 689, - "stdDev": 37 - } - }, - "cjsCleanBuilds": { - "name": "Commons CJS Clean Builds", - "command": "npx tsc --build packages/commons/tsconfig.cjs.json", - "iterations": 5, - "times": [1504, 2197, 1613, 1525, 1576], - "stats": { - "mean": 1683, - "min": 1504, - "max": 2197, - "stdDev": 267 - } - }, - "cjsIncrementalBuilds": { - "name": "Commons CJS Incremental Builds", - "command": "npx tsc --build packages/commons/tsconfig.cjs.json", - "iterations": 5, - "times": [867, 602, 590, 620, 575], - "stats": { - "mean": 651, - "min": 575, - "max": 867, - "stdDev": 115 - } - } - }, - "analysis": { - "incrementalSpeedup": { - "esm": 2.59, - "cjs": 2.58, - "average": 2.58 - }, - "buildTypeComparison": { - "cleanBuilds": { - "esmVsCjs": "ESM slightly faster by 25ms (1.5%)" - }, - "incrementalBuilds": { - "esmVsCjs": "ESM slightly faster by 10ms (1.5%)" - } - }, - "variance": { - "cleanBuilds": "Higher variance, especially CJS (±267ms)", - "incrementalBuilds": "Lower variance, more consistent (±37-115ms)" - } - }, - "recommendations": { - "forNativeCompilerComparison": [ - "Focus on clean build performance improvements", - "Measure startup time reduction", - "Track memory usage differences", - "Test with larger packages for better signal", - "Run 50-100 iterations for statistical significance" - ] - } -} diff --git a/benchmark-build.js b/benchmark-build.js deleted file mode 100644 index 5c16cb289c..0000000000 --- a/benchmark-build.js +++ /dev/null @@ -1,308 +0,0 @@ -#!/usr/bin/env node - -import { execSync } from 'child_process'; -import fs from 'fs'; -import os from 'os'; -import { performance } from 'perf_hooks'; - -const ITERATIONS = 20; -const WARMUP_ITERATIONS = 3; - -function cleanBuild() { - try { - execSync('rm -rf packages/*/lib packages/*/.tsbuildinfo .tsbuildinfo', { - stdio: 'pipe', - }); - } catch { - // Ignore errors - } -} - -function measureCommand(command, workdir = '.') { - const start = performance.now(); - try { - execSync(command, { - stdio: 'pipe', - cwd: workdir, - timeout: 60000, - }); - return performance.now() - start; - } catch (error) { - console.error(`Command failed: ${command} in ${workdir}`); - throw error; - } -} - -function calculateStats(times) { - const sorted = [...times].sort((a, b) => a - b); - const mean = times.reduce((a, b) => a + b, 0) / times.length; - const median = sorted[Math.floor(sorted.length / 2)]; - const variance = - times.reduce((acc, val) => acc + (val - mean) ** 2, 0) / times.length; - const stdDev = Math.sqrt(variance); - - return { - mean: Math.round(mean), - median: Math.round(median), - stdDev: Math.round(stdDev), - min: Math.round(sorted[0]), - max: Math.round(sorted[sorted.length - 1]), - p95: Math.round(sorted[Math.floor(sorted.length * 0.95)]), - }; -} - -function benchmarkBuild(name, command, workdir = '.', cleanFirst = false) { - console.log(`\nBenchmarking: ${name}`); - - const times = []; - - // Warmup - for (let i = 0; i < WARMUP_ITERATIONS; i++) { - if (cleanFirst) cleanBuild(); - measureCommand(command, workdir); - } - - // Actual benchmark - console.log(`Running ${ITERATIONS} iterations...`); - for (let i = 0; i < ITERATIONS; i++) { - if (cleanFirst) cleanBuild(); - const time = measureCommand(command, workdir); - times.push(time); - - if ((i + 1) % 5 === 0) { - console.log(` ${i + 1}/${ITERATIONS} complete`); - } - } - - return { name, command, workdir, times, stats: calculateStats(times) }; -} - -function runBenchmarks() { - console.log('TypeScript Build Performance Benchmark'); - console.log('======================================'); - console.log(`Iterations per test: ${ITERATIONS}`); - console.log(`Warmup iterations: ${WARMUP_ITERATIONS}`); - - const results = []; - - // Ensure we start with a clean build - console.log('\nInitial setup...'); - cleanBuild(); - execSync('npm run build', { stdio: 'pipe' }); - - console.log('\n=== INDIVIDUAL PACKAGE BUILDS ==='); - - // Commons package (no dependencies) - results.push( - benchmarkBuild( - 'Commons ESM (Clean)', - 'npx tsc --build tsconfig.json', - 'packages/commons', - true - ) - ); - - results.push( - benchmarkBuild( - 'Commons ESM (Incremental)', - 'npx tsc --build tsconfig.json', - 'packages/commons', - false - ) - ); - - results.push( - benchmarkBuild( - 'Commons CJS (Clean)', - 'npx tsc --build tsconfig.cjs.json', - 'packages/commons', - true - ) - ); - - results.push( - benchmarkBuild( - 'Commons CJS (Incremental)', - 'npx tsc --build tsconfig.cjs.json', - 'packages/commons', - false - ) - ); - - // Test npm build commands - results.push( - benchmarkBuild( - 'Commons NPM Build (Clean)', - 'npm run build', - 'packages/commons', - true - ) - ); - - results.push( - benchmarkBuild( - 'Commons NPM Build (Incremental)', - 'npm run build', - 'packages/commons', - false - ) - ); - - console.log('\n=== LINT PERFORMANCE ==='); - - results.push( - benchmarkBuild('Commons Lint', 'npm run lint', 'packages/commons', false) - ); - - console.log('\n=== FULL MONOREPO BUILDS ==='); - - results.push( - benchmarkBuild('Full Build (Incremental)', 'npm run build', '.', false) - ); - - // Generate report - console.log('\n\n' + '='.repeat(80)); - console.log('BENCHMARK RESULTS SUMMARY'); - console.log('='.repeat(80)); - - // Summary table - console.log( - 'Test Name'.padEnd(35) + - 'Mean'.padStart(8) + - 'StdDev'.padStart(8) + - 'Min'.padStart(8) + - 'Max'.padStart(8) + - 'P95'.padStart(8) - ); - console.log('-'.repeat(75)); - - results.forEach((result) => { - const name = - result.name.length > 34 - ? result.name.substring(0, 31) + '...' - : result.name; - console.log( - name.padEnd(35) + - `${result.stats.mean}ms`.padStart(8) + - `${result.stats.stdDev}ms`.padStart(8) + - `${result.stats.min}ms`.padStart(8) + - `${result.stats.max}ms`.padStart(8) + - `${result.stats.p95}ms`.padStart(8) - ); - }); - - // Save detailed results - const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); - const filename = `benchmark-results-${timestamp}.json`; - - const systemInfo = { - nodeVersion: process.version, - platform: process.platform, - arch: process.arch, - cpus: os.cpus().length, - memory: Math.round(os.totalmem() / 1024 / 1024 / 1024) + 'GB', - typescriptVersion: execSync('npx tsc --version', { - encoding: 'utf8', - }).trim(), - }; - - fs.writeFileSync( - filename, - JSON.stringify( - { - timestamp: new Date().toISOString(), - iterations: ITERATIONS, - warmupIterations: WARMUP_ITERATIONS, - systemInfo, - results: results.map((r) => ({ - name: r.name, - command: r.command, - workdir: r.workdir, - stats: r.stats, - rawTimes: r.times, - })), - }, - null, - 2 - ) - ); - - console.log(`\nDetailed results saved to: ${filename}`); - - // Analysis - console.log('\n' + '='.repeat(80)); - console.log('PERFORMANCE ANALYSIS'); - console.log('='.repeat(80)); - - const cleanBuilds = results.filter((r) => r.name.includes('Clean')); - const incrementalBuilds = results.filter((r) => - r.name.includes('Incremental') - ); - - if (cleanBuilds.length > 0 && incrementalBuilds.length > 0) { - const avgClean = - cleanBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / - cleanBuilds.length; - const avgIncremental = - incrementalBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / - incrementalBuilds.length; - const speedup = avgClean / avgIncremental; - - console.log(`Average clean build time: ${Math.round(avgClean)}ms`); - console.log( - `Average incremental build time: ${Math.round(avgIncremental)}ms` - ); - console.log(`Incremental build speedup: ${speedup.toFixed(1)}x faster`); - } - - const esmBuilds = results.filter((r) => r.name.includes('ESM')); - const cjsBuilds = results.filter((r) => r.name.includes('CJS')); - - if (esmBuilds.length > 0 && cjsBuilds.length > 0) { - const avgESM = - esmBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / esmBuilds.length; - const avgCJS = - cjsBuilds.reduce((sum, r) => sum + r.stats.mean, 0) / cjsBuilds.length; - - console.log(`Average ESM build time: ${Math.round(avgESM)}ms`); - console.log(`Average CJS build time: ${Math.round(avgCJS)}ms`); - - if (avgESM !== avgCJS) { - const faster = avgESM < avgCJS ? 'ESM' : 'CJS'; - const ratio = Math.max(avgESM, avgCJS) / Math.min(avgESM, avgCJS); - console.log(`${faster} builds are ${ratio.toFixed(1)}x faster`); - } - } - - console.log('\nSystem Information:'); - console.log(` Node.js: ${systemInfo.nodeVersion}`); - console.log(` TypeScript: ${systemInfo.typescriptVersion}`); - console.log(` Platform: ${systemInfo.platform} ${systemInfo.arch}`); - console.log(` CPUs: ${systemInfo.cpus}`); - console.log(` Memory: ${systemInfo.memory}`); - - console.log('\n' + '='.repeat(80)); - console.log('BASELINE ESTABLISHED FOR TYPESCRIPT BUILD PERFORMANCE'); - console.log('='.repeat(80)); - console.log('Key findings:'); - - // Find fastest and slowest builds - const sortedByMean = [...results].sort((a, b) => a.stats.mean - b.stats.mean); - console.log( - `Fastest build: ${sortedByMean[0].name} (${sortedByMean[0].stats.mean}ms)` - ); - console.log( - `Slowest build: ${sortedByMean[sortedByMean.length - 1].name} (${sortedByMean[sortedByMean.length - 1].stats.mean}ms)` - ); - - console.log( - '\nThis baseline can be used to compare against @typescript/native-preview' - ); - console.log('performance improvements. Focus areas for comparison:'); - console.log('- Clean vs Incremental build performance'); - console.log('- ESM vs CJS compilation times'); - console.log('- Individual package vs monorepo build times'); - console.log('- Lint performance (if using TypeScript for linting)'); -} - -runBenchmarks(); diff --git a/benchmark-native-quick.js b/benchmark-native-quick.js deleted file mode 100644 index 893590cacc..0000000000 --- a/benchmark-native-quick.js +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/env node - -import { execSync } from 'child_process'; -import fs from 'fs'; -import os from 'os'; -import { performance } from 'perf_hooks'; - -const ITERATIONS = 20; -const WARMUP_ITERATIONS = 3; - -function cleanBuild() { - try { - execSync('rm -rf packages/commons/lib packages/commons/.tsbuildinfo', { - stdio: 'pipe', - }); - } catch { - // Ignore errors - } -} - -function measureCommand(command, workdir = '.') { - const start = performance.now(); - try { - execSync(command, { - stdio: 'pipe', - cwd: workdir, - timeout: 30000, - }); - return performance.now() - start; - } catch (error) { - console.error(`Command failed: ${command} in ${workdir}`); - throw error; - } -} - -function calculateStats(times) { - const sorted = [...times].sort((a, b) => a - b); - const mean = times.reduce((a, b) => a + b, 0) / times.length; - const median = sorted[Math.floor(sorted.length / 2)]; - const variance = - times.reduce((acc, val) => acc + (val - mean) ** 2, 0) / times.length; - const stdDev = Math.sqrt(variance); - - return { - mean: Math.round(mean), - median: Math.round(median), - stdDev: Math.round(stdDev), - min: Math.round(sorted[0]), - max: Math.round(sorted[sorted.length - 1]), - p95: Math.round(sorted[Math.floor(sorted.length * 0.95)]), - }; -} - -function benchmarkBuild(name, command, workdir = '.', cleanFirst = false) { - console.log(`\nBenchmarking: ${name}`); - - const times = []; - - // Warmup - for (let i = 0; i < WARMUP_ITERATIONS; i++) { - if (cleanFirst) cleanBuild(); - measureCommand(command, workdir); - } - - // Actual benchmark - console.log(`Running ${ITERATIONS} iterations...`); - for (let i = 0; i < ITERATIONS; i++) { - if (cleanFirst) cleanBuild(); - const time = measureCommand(command, workdir); - times.push(time); - - if ((i + 1) % 5 === 0) { - console.log(` ${i + 1}/${ITERATIONS} complete`); - } - } - - return { name, command, workdir, times, stats: calculateStats(times) }; -} - -console.log('Quick Native TypeScript Benchmark'); -console.log('================================='); - -// Create temporary tsconfig without baseUrl for native compiler -const tempTsConfig = { - compilerOptions: { - target: 'ES2023', - module: 'NodeNext', - moduleResolution: 'NodeNext', - declaration: true, - isolatedModules: true, - esModuleInterop: true, - forceConsistentCasingInFileNames: true, - strict: true, - skipLibCheck: true, - outDir: './lib/esm', - rootDir: './src', - }, - include: ['./src/**/*'], -}; - -fs.writeFileSync( - 'packages/commons/tsconfig.native.json', - JSON.stringify(tempTsConfig, null, 2) -); - -const results = []; - -// Test native compiler -results.push( - benchmarkBuild( - 'Native TS (Clean)', - 'node ../../node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json', - 'packages/commons', - true - ) -); - -results.push( - benchmarkBuild( - 'Native TS (Incremental)', - 'node ../../node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json', - 'packages/commons', - false - ) -); - -// Test regular TypeScript -results.push( - benchmarkBuild( - 'Regular TS (Clean)', - 'npx tsc -p tsconfig.native.json', - 'packages/commons', - true - ) -); - -results.push( - benchmarkBuild( - 'Regular TS (Incremental)', - 'npx tsc -p tsconfig.native.json', - 'packages/commons', - false - ) -); - -// Results -console.log('\n' + '='.repeat(60)); -console.log('RESULTS COMPARISON'); -console.log('='.repeat(60)); - -console.log( - 'Test'.padEnd(25) + - 'Mean'.padStart(8) + - 'Min'.padStart(8) + - 'Max'.padStart(8) + - 'StdDev'.padStart(8) -); -console.log('-'.repeat(57)); - -results.forEach((result) => { - console.log( - result.name.padEnd(25) + - `${result.stats.mean}ms`.padStart(8) + - `${result.stats.min}ms`.padStart(8) + - `${result.stats.max}ms`.padStart(8) + - `${result.stats.stdDev}ms`.padStart(8) - ); -}); - -// Performance comparison -console.log('\n' + '='.repeat(60)); -console.log('PERFORMANCE ANALYSIS'); -console.log('='.repeat(60)); - -const nativeClean = results.find((r) => r.name === 'Native TS (Clean)'); -const regularClean = results.find((r) => r.name === 'Regular TS (Clean)'); -const nativeIncremental = results.find( - (r) => r.name === 'Native TS (Incremental)' -); -const regularIncremental = results.find( - (r) => r.name === 'Regular TS (Incremental)' -); - -if (nativeClean && regularClean) { - const speedup = regularClean.stats.mean / nativeClean.stats.mean; - const improvement = - ((regularClean.stats.mean - nativeClean.stats.mean) / - regularClean.stats.mean) * - 100; - - console.log('Clean Build Comparison:'); - console.log(` Regular TypeScript: ${regularClean.stats.mean}ms`); - console.log(` Native TypeScript: ${nativeClean.stats.mean}ms`); - console.log( - ` Native is ${speedup.toFixed(2)}x faster (${improvement.toFixed(1)}% improvement)` - ); -} - -if (nativeIncremental && regularIncremental) { - const speedup = regularIncremental.stats.mean / nativeIncremental.stats.mean; - const improvement = - ((regularIncremental.stats.mean - nativeIncremental.stats.mean) / - regularIncremental.stats.mean) * - 100; - - console.log('\nIncremental Build Comparison:'); - console.log(` Regular TypeScript: ${regularIncremental.stats.mean}ms`); - console.log(` Native TypeScript: ${nativeIncremental.stats.mean}ms`); - console.log( - ` Native is ${speedup.toFixed(2)}x faster (${improvement.toFixed(1)}% improvement)` - ); -} - -// System info -const systemInfo = { - nodeVersion: process.version, - platform: process.platform, - arch: process.arch, - cpus: os.cpus().length, - regularTypescriptVersion: execSync('npx tsc --version', { - encoding: 'utf8', - }).trim(), - nativeTypescriptVersion: execSync( - 'node node_modules/@typescript/native-preview/bin/tsgo.js --version', - { encoding: 'utf8' } - ).trim(), -}; - -console.log('\nSystem Information:'); -console.log(` Node.js: ${systemInfo.nodeVersion}`); -console.log(` Regular TypeScript: ${systemInfo.regularTypescriptVersion}`); -console.log(` Native TypeScript: ${systemInfo.nativeTypescriptVersion}`); -console.log(` Platform: ${systemInfo.platform} ${systemInfo.arch}`); -console.log(` CPUs: ${systemInfo.cpus}`); - -// Cleanup -try { - fs.unlinkSync('packages/commons/tsconfig.native.json'); -} catch {} - -console.log('\n' + '='.repeat(60)); -console.log('BENCHMARK COMPLETE'); -console.log('='.repeat(60)); diff --git a/benchmark-native.cjs b/benchmark-native.cjs deleted file mode 100644 index 493327f352..0000000000 --- a/benchmark-native.cjs +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/env node - -const { execSync } = require('child_process'); -const fs = require('fs'); - -const ITERATIONS = 100; -const WARMUP_RUNS = 5; - -function cleanup() { - try { - execSync( - 'rm -rf lib packages/commons/lib packages/commons/.tsbuildinfo tsconfig.native.tsbuildinfo', - { stdio: 'ignore' } - ); - } catch {} -} - -function runCommand(cmd, cwd = process.cwd()) { - const start = process.hrtime.bigint(); - try { - execSync(cmd, { cwd, stdio: 'ignore' }); - const end = process.hrtime.bigint(); - return Number(end - start) / 1000000; // Convert to milliseconds - } catch (error) { - console.error(`Command failed: ${cmd}`); - throw error; - } -} - -function calculateStats(times) { - const sorted = times.slice().sort((a, b) => a - b); - const sum = times.reduce((a, b) => a + b, 0); - const mean = sum / times.length; - const variance = - times.reduce((acc, val) => acc + Math.pow(val - mean, 2), 0) / times.length; - - return { - mean: mean, - median: sorted[Math.floor(sorted.length / 2)], - min: sorted[0], - max: sorted[sorted.length - 1], - stdDev: Math.sqrt(variance), - p95: sorted[Math.floor(sorted.length * 0.95)], - p99: sorted[Math.floor(sorted.length * 0.99)], - }; -} - -function benchmark() { - console.log('Starting TypeScript compiler benchmark...'); - console.log(`Iterations: ${ITERATIONS}, Warmup runs: ${WARMUP_RUNS}`); - - const results = { - native: { clean: [], incremental: [] }, - regular: { clean: [], incremental: [] }, - }; - - // Native compiler benchmarks - console.log('\n=== Native TypeScript Compiler ==='); - - // Clean builds - console.log('Running native clean builds...'); - for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { - cleanup(); - const time = runCommand( - 'node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json' - ); - if (i >= WARMUP_RUNS) { - results.native.clean.push(time); - } - if ((i + 1) % 20 === 0) - console.log( - ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` - ); - } - - // Incremental builds - console.log('Running native incremental builds...'); - cleanup(); - runCommand( - 'node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json' - ); // Initial build - - for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { - const time = runCommand( - 'node node_modules/@typescript/native-preview/bin/tsgo.js -p tsconfig.native.json' - ); - if (i >= WARMUP_RUNS) { - results.native.incremental.push(time); - } - if ((i + 1) % 20 === 0) - console.log( - ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` - ); - } - - // Regular compiler benchmarks - console.log('\n=== Regular TypeScript Compiler ==='); - - // Clean builds - console.log('Running regular clean builds...'); - for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { - cleanup(); - const time = runCommand('npx tsc -p packages/commons/tsconfig.json'); - if (i >= WARMUP_RUNS) { - results.regular.clean.push(time); - } - if ((i + 1) % 20 === 0) - console.log( - ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` - ); - } - - // Incremental builds - console.log('Running regular incremental builds...'); - cleanup(); - runCommand('npx tsc -p packages/commons/tsconfig.json'); // Initial build - - for (let i = 0; i < ITERATIONS + WARMUP_RUNS; i++) { - const time = runCommand('npx tsc -p packages/commons/tsconfig.json'); - if (i >= WARMUP_RUNS) { - results.regular.incremental.push(time); - } - if ((i + 1) % 20 === 0) - console.log( - ` Completed ${i + 1 - WARMUP_RUNS}/${ITERATIONS} iterations` - ); - } - - return results; -} - -function generateReport(results) { - const nativeCleanStats = calculateStats(results.native.clean); - const nativeIncrementalStats = calculateStats(results.native.incremental); - const regularCleanStats = calculateStats(results.regular.clean); - const regularIncrementalStats = calculateStats(results.regular.incremental); - - const cleanSpeedup = regularCleanStats.mean / nativeCleanStats.mean; - const incrementalSpeedup = - regularIncrementalStats.mean / nativeIncrementalStats.mean; - - const report = { - timestamp: new Date().toISOString(), - iterations: ITERATIONS, - warmupRuns: WARMUP_RUNS, - results: { - native: { - clean: nativeCleanStats, - incremental: nativeIncrementalStats, - }, - regular: { - clean: regularCleanStats, - incremental: regularIncrementalStats, - }, - }, - comparison: { - cleanBuildSpeedup: cleanSpeedup, - incrementalBuildSpeedup: incrementalSpeedup, - cleanBuildImprovement: ((cleanSpeedup - 1) * 100).toFixed(1) + '%', - incrementalBuildImprovement: - ((incrementalSpeedup - 1) * 100).toFixed(1) + '%', - }, - }; - - console.log('\n' + '='.repeat(60)); - console.log('TYPESCRIPT COMPILER BENCHMARK RESULTS'); - console.log('='.repeat(60)); - - console.log('\nCLEAN BUILDS:'); - console.log( - `Native Compiler: ${nativeCleanStats.mean.toFixed(0)}ms (±${nativeCleanStats.stdDev.toFixed(0)}ms)` - ); - console.log( - `Regular Compiler: ${regularCleanStats.mean.toFixed(0)}ms (±${regularCleanStats.stdDev.toFixed(0)}ms)` - ); - console.log( - `Speedup: ${cleanSpeedup.toFixed(2)}x (${report.comparison.cleanBuildImprovement})` - ); - - console.log('\nINCREMENTAL BUILDS:'); - console.log( - `Native Compiler: ${nativeIncrementalStats.mean.toFixed(0)}ms (±${nativeIncrementalStats.stdDev.toFixed(0)}ms)` - ); - console.log( - `Regular Compiler: ${regularIncrementalStats.mean.toFixed(0)}ms (±${regularIncrementalStats.stdDev.toFixed(0)}ms)` - ); - console.log( - `Speedup: ${incrementalSpeedup.toFixed(2)}x (${report.comparison.incrementalBuildImprovement})` - ); - - console.log('\nDETAILED STATISTICS:'); - console.log( - 'Native Clean - Min:', - nativeCleanStats.min.toFixed(0) + 'ms', - 'Max:', - nativeCleanStats.max.toFixed(0) + 'ms', - 'P95:', - nativeCleanStats.p95.toFixed(0) + 'ms' - ); - console.log( - 'Regular Clean - Min:', - regularCleanStats.min.toFixed(0) + 'ms', - 'Max:', - regularCleanStats.max.toFixed(0) + 'ms', - 'P95:', - regularCleanStats.p95.toFixed(0) + 'ms' - ); - console.log( - 'Native Incr - Min:', - nativeIncrementalStats.min.toFixed(0) + 'ms', - 'Max:', - nativeIncrementalStats.max.toFixed(0) + 'ms', - 'P95:', - nativeIncrementalStats.p95.toFixed(0) + 'ms' - ); - console.log( - 'Regular Incr - Min:', - regularIncrementalStats.min.toFixed(0) + 'ms', - 'Max:', - regularIncrementalStats.max.toFixed(0) + 'ms', - 'P95:', - regularIncrementalStats.p95.toFixed(0) + 'ms' - ); - - // Save detailed results - fs.writeFileSync('benchmark-results.json', JSON.stringify(report, null, 2)); - console.log('\nDetailed results saved to benchmark-results.json'); - - return report; -} - -// Run benchmark -try { - const results = benchmark(); - generateReport(results); - cleanup(); -} catch (error) { - console.error('Benchmark failed:', error.message); - cleanup(); - process.exit(1); -} diff --git a/benchmark-results.json b/benchmark-results.json deleted file mode 100644 index cfa21df9cb..0000000000 --- a/benchmark-results.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "timestamp": "2026-01-06T18:14:32.379Z", - "iterations": 100, - "warmupRuns": 5, - "results": { - "native": { - "clean": { - "mean": 256.02284625, - "median": 254.328916, - "min": 230.536584, - "max": 299.796375, - "stdDev": 12.24495062284697, - "p95": 278.075334, - "p99": 299.796375 - }, - "incremental": { - "mean": 263.78185457, - "median": 258.529958, - "min": 232.034959, - "max": 323.919583, - "stdDev": 20.852416925583103, - "p95": 308.800125, - "p99": 323.919583 - } - }, - "regular": { - "clean": { - "mean": 1574.4989846199992, - "median": 1517.421792, - "min": 1404.253209, - "max": 2122.949, - "stdDev": 160.2148459150519, - "p95": 1987.667375, - "p99": 2122.949 - }, - "incremental": { - "mean": 1464.6626358899998, - "median": 1425.379459, - "min": 1261.41625, - "max": 2192.894083, - "stdDev": 160.78443039315397, - "p95": 1854.189958, - "p99": 2192.894083 - } - } - }, - "comparison": { - "cleanBuildSpeedup": 6.1498378276856585, - "incrementalBuildSpeedup": 5.552552651044165, - "cleanBuildImprovement": "515.0%", - "incrementalBuildImprovement": "455.3%" - } -} diff --git a/tsconfig.native.json b/tsconfig.native.json deleted file mode 100644 index 4545777596..0000000000 --- a/tsconfig.native.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2023", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "outDir": "./lib/native", - "rootDir": "./packages/commons/src", - "declaration": true, - "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "skipLibCheck": true, - "experimentalDecorators": true, - "isolatedModules": true, - "removeComments": false - }, - "include": ["./packages/commons/src/**/*"], - "exclude": ["node_modules", "**/*.test.ts", "**/*.spec.ts"] -}