From 1647edee702f52cae7ba4775bab2ee3a44f925bf Mon Sep 17 00:00:00 2001 From: George Fu Date: Thu, 4 Jan 2024 15:26:34 +0000 Subject: [PATCH] feat: cjs inline build --- clients/client-dynamodb/package.json | 2 +- clients/client-ec2/package.json | 2 +- clients/client-lambda/package.json | 2 +- clients/client-s3/package.json | 2 +- clients/client-sqs/package.json | 2 +- clients/client-sso/package.json | 2 +- clients/client-sts/package.json | 2 +- packages/body-checksum-browser/package.json | 2 +- packages/body-checksum-node/package.json | 2 +- .../chunked-stream-reader-node/package.json | 2 +- packages/cloudfront-signer/package.json | 2 +- packages/core/package.json | 2 +- .../package.json | 2 +- packages/credential-provider-env/package.json | 2 +- .../credential-provider-http/package.json | 2 +- packages/credential-provider-ini/package.json | 2 +- .../credential-provider-node/package.json | 2 +- .../credential-provider-process/package.json | 2 +- packages/credential-provider-sso/package.json | 2 +- .../package.json | 2 +- packages/credential-providers/package.json | 2 +- packages/endpoint-cache/package.json | 2 +- .../eventstream-handler-node/package.json | 2 +- packages/karma-credential-loader/package.json | 2 +- packages/middleware-api-key/package.json | 2 +- .../middleware-bucket-endpoint/package.json | 2 +- packages/middleware-compression/package.json | 2 +- .../package.json | 2 +- packages/middleware-eventstream/package.json | 2 +- .../middleware-expect-continue/package.json | 2 +- .../package.json | 2 +- packages/middleware-host-header/package.json | 2 +- .../package.json | 2 +- packages/middleware-logger/package.json | 2 +- .../package.json | 2 +- .../middleware-sdk-api-gateway/package.json | 2 +- packages/middleware-sdk-ec2/package.json | 2 +- packages/middleware-sdk-glacier/package.json | 2 +- .../package.json | 2 +- packages/middleware-sdk-rds/package.json | 2 +- packages/middleware-sdk-route53/package.json | 2 +- .../middleware-sdk-s3-control/package.json | 2 +- packages/middleware-sdk-s3/package.json | 2 +- packages/middleware-sdk-sqs/package.json | 2 +- packages/middleware-sdk-sts/package.json | 2 +- .../package.json | 2 +- packages/middleware-signing/package.json | 2 +- packages/middleware-ssec/package.json | 2 +- packages/middleware-token/package.json | 2 +- packages/middleware-user-agent/package.json | 2 +- packages/middleware-websocket/package.json | 2 +- packages/polly-request-presigner/package.json | 2 +- packages/rds-signer/package.json | 2 +- packages/region-config-resolver/package.json | 2 +- packages/s3-presigned-post/package.json | 2 +- packages/s3-request-presigner/package.json | 2 +- packages/sha256-tree-hash/package.json | 2 +- packages/signature-v4-crt/package.json | 2 +- .../signature-v4-multi-region/package.json | 2 +- packages/smithy-client/package.json | 2 +- packages/token-providers/package.json | 2 +- packages/types/package.json | 2 +- packages/util-arn-parser/package.json | 2 +- packages/util-create-request/package.json | 2 +- packages/util-dns/package.json | 2 +- packages/util-dynamodb/package.json | 2 +- packages/util-endpoints/package.json | 2 +- packages/util-format-url/package.json | 2 +- packages/util-locate-window/package.json | 2 +- packages/util-user-agent-browser/package.json | 2 +- packages/util-user-agent-node/package.json | 2 +- packages/xhr-http-handler/package.json | 2 +- packages/xml-builder/package.json | 2 +- scripts/compilation/Inliner.js | 242 ++++++++++++++++++ scripts/compilation/inline.js | 49 ++++ 75 files changed, 364 insertions(+), 73 deletions(-) create mode 100644 scripts/compilation/Inliner.js create mode 100644 scripts/compilation/inline.js diff --git a/clients/client-dynamodb/package.json b/clients/client-dynamodb/package.json index 1ec253f589b8..bdb05a34e82e 100644 --- a/clients/client-dynamodb/package.json +++ b/clients/client-dynamodb/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-dynamodb", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/clients/client-ec2/package.json b/clients/client-ec2/package.json index 74cc1b10eb45..86a04e57c381 100644 --- a/clients/client-ec2/package.json +++ b/clients/client-ec2/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-ec2", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/clients/client-lambda/package.json b/clients/client-lambda/package.json index d5a56a7de00e..11c0382434c7 100644 --- a/clients/client-lambda/package.json +++ b/clients/client-lambda/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-lambda", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/clients/client-s3/package.json b/clients/client-s3/package.json index 06cf029cc358..ca4a1868fb65 100644 --- a/clients/client-s3/package.json +++ b/clients/client-s3/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-s3", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/clients/client-sqs/package.json b/clients/client-sqs/package.json index de861024ad67..fecf5d5b459e 100644 --- a/clients/client-sqs/package.json +++ b/clients/client-sqs/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-sqs", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/clients/client-sso/package.json b/clients/client-sso/package.json index 87fd6b6816d9..1b7bdc5abe33 100644 --- a/clients/client-sso/package.json +++ b/clients/client-sso/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-sso", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/clients/client-sts/package.json b/clients/client-sts/package.json index 36e86b5d7f5d..d32631822cc8 100644 --- a/clients/client-sts/package.json +++ b/clients/client-sts/package.json @@ -4,7 +4,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline client-sts", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/body-checksum-browser/package.json b/packages/body-checksum-browser/package.json index bceded32c642..c007c234cca3 100644 --- a/packages/body-checksum-browser/package.json +++ b/packages/body-checksum-browser/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline body-checksum-browser", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/body-checksum-node/package.json b/packages/body-checksum-node/package.json index 370d7a91affd..fbbf96d99516 100644 --- a/packages/body-checksum-node/package.json +++ b/packages/body-checksum-node/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline body-checksum-node", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/chunked-stream-reader-node/package.json b/packages/chunked-stream-reader-node/package.json index 518e497d1213..ceb6c7547946 100644 --- a/packages/chunked-stream-reader-node/package.json +++ b/packages/chunked-stream-reader-node/package.json @@ -3,7 +3,7 @@ "version": "3.465.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline chunked-stream-reader-node", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/cloudfront-signer/package.json b/packages/cloudfront-signer/package.json index a298a2b33e1d..5daf83783422 100644 --- a/packages/cloudfront-signer/package.json +++ b/packages/cloudfront-signer/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline cloudfront-signer", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/core/package.json b/packages/core/package.json index f77fa9b33fa8..4f00e9be8a1e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -4,7 +4,7 @@ "description": "Core functions & classes shared by multiple AWS SDK clients", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json && yarn lint", + "build:cjs": "node ../../scripts/compilation/inline core", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-cognito-identity/package.json b/packages/credential-provider-cognito-identity/package.json index e2810bd96a8f..6bd6b2633c67 100644 --- a/packages/credential-provider-cognito-identity/package.json +++ b/packages/credential-provider-cognito-identity/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-cognito-identity", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-env/package.json b/packages/credential-provider-env/package.json index cf9207020221..4d69ae4dc39b 100644 --- a/packages/credential-provider-env/package.json +++ b/packages/credential-provider-env/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-env", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-http/package.json b/packages/credential-provider-http/package.json index 91ca0b65154a..a5e80a77a41a 100644 --- a/packages/credential-provider-http/package.json +++ b/packages/credential-provider-http/package.json @@ -8,7 +8,7 @@ "react-native": "./dist-es/index.browser.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-http", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-ini/package.json b/packages/credential-provider-ini/package.json index b917f27e1544..b970a16b48d7 100644 --- a/packages/credential-provider-ini/package.json +++ b/packages/credential-provider-ini/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-ini", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-node/package.json b/packages/credential-provider-node/package.json index e29beb4108e4..410f38046b37 100644 --- a/packages/credential-provider-node/package.json +++ b/packages/credential-provider-node/package.json @@ -9,7 +9,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-node", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-process/package.json b/packages/credential-provider-process/package.json index 9451bfebef6f..97304b1b85bc 100644 --- a/packages/credential-provider-process/package.json +++ b/packages/credential-provider-process/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-process", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-sso/package.json b/packages/credential-provider-sso/package.json index 459d066d01fc..cc06ce5dde9f 100644 --- a/packages/credential-provider-sso/package.json +++ b/packages/credential-provider-sso/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-sso", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-provider-web-identity/package.json b/packages/credential-provider-web-identity/package.json index a7e69a96b2b4..8fccd2bbf0ef 100644 --- a/packages/credential-provider-web-identity/package.json +++ b/packages/credential-provider-web-identity/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-provider-web-identity", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/credential-providers/package.json b/packages/credential-providers/package.json index 1ac394858ae2..f25cbe7c7c49 100644 --- a/packages/credential-providers/package.json +++ b/packages/credential-providers/package.json @@ -9,7 +9,7 @@ "sideEffects": false, "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline credential-providers", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/endpoint-cache/package.json b/packages/endpoint-cache/package.json index 9862a090558b..08aea79ed515 100644 --- a/packages/endpoint-cache/package.json +++ b/packages/endpoint-cache/package.json @@ -3,7 +3,7 @@ "version": "3.465.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline endpoint-cache", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/eventstream-handler-node/package.json b/packages/eventstream-handler-node/package.json index 8d6ef097d769..dcdc308fc05e 100644 --- a/packages/eventstream-handler-node/package.json +++ b/packages/eventstream-handler-node/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline eventstream-handler-node", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/karma-credential-loader/package.json b/packages/karma-credential-loader/package.json index a8736d996395..7b0bb8b967c7 100644 --- a/packages/karma-credential-loader/package.json +++ b/packages/karma-credential-loader/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline karma-credential-loader", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-api-key/package.json b/packages/middleware-api-key/package.json index a454c963e085..b4e6022c73df 100644 --- a/packages/middleware-api-key/package.json +++ b/packages/middleware-api-key/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-api-key", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-bucket-endpoint/package.json b/packages/middleware-bucket-endpoint/package.json index 4bf486a072f0..051a5e0b6e07 100644 --- a/packages/middleware-bucket-endpoint/package.json +++ b/packages/middleware-bucket-endpoint/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-bucket-endpoint", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-compression/package.json b/packages/middleware-compression/package.json index 6b48b6097b0f..a5dce036e6ee 100644 --- a/packages/middleware-compression/package.json +++ b/packages/middleware-compression/package.json @@ -4,7 +4,7 @@ "description": "Middleware and Plugin for request compression.", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-compression", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-endpoint-discovery/package.json b/packages/middleware-endpoint-discovery/package.json index a344e392ded6..a975e201cb58 100644 --- a/packages/middleware-endpoint-discovery/package.json +++ b/packages/middleware-endpoint-discovery/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-endpoint-discovery", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-eventstream/package.json b/packages/middleware-eventstream/package.json index 776ce0597557..32d9bcecd6fa 100644 --- a/packages/middleware-eventstream/package.json +++ b/packages/middleware-eventstream/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-eventstream", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-expect-continue/package.json b/packages/middleware-expect-continue/package.json index c9d82baadcc0..07a78d8afd84 100644 --- a/packages/middleware-expect-continue/package.json +++ b/packages/middleware-expect-continue/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-expect-continue", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-flexible-checksums/package.json b/packages/middleware-flexible-checksums/package.json index 352cfb4a1849..911de2ce0ce5 100644 --- a/packages/middleware-flexible-checksums/package.json +++ b/packages/middleware-flexible-checksums/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-flexible-checksums", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-host-header/package.json b/packages/middleware-host-header/package.json index f31d3b649511..60d3bb869bcf 100644 --- a/packages/middleware-host-header/package.json +++ b/packages/middleware-host-header/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-host-header", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-location-constraint/package.json b/packages/middleware-location-constraint/package.json index 09d0017ba7d4..42c082e7bc66 100644 --- a/packages/middleware-location-constraint/package.json +++ b/packages/middleware-location-constraint/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-location-constraint", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-logger/package.json b/packages/middleware-logger/package.json index 6c5b20ae251b..a88bb3914a6c 100644 --- a/packages/middleware-logger/package.json +++ b/packages/middleware-logger/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-logger", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-recursion-detection/package.json b/packages/middleware-recursion-detection/package.json index 651e728909d0..6cf91207f586 100644 --- a/packages/middleware-recursion-detection/package.json +++ b/packages/middleware-recursion-detection/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-recursion-detection", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-api-gateway/package.json b/packages/middleware-sdk-api-gateway/package.json index 5018ba41858d..8e95d1c08766 100644 --- a/packages/middleware-sdk-api-gateway/package.json +++ b/packages/middleware-sdk-api-gateway/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-api-gateway", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-ec2/package.json b/packages/middleware-sdk-ec2/package.json index 4d1eb048fa22..9a499d0e4f59 100644 --- a/packages/middleware-sdk-ec2/package.json +++ b/packages/middleware-sdk-ec2/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-ec2", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-glacier/package.json b/packages/middleware-sdk-glacier/package.json index cb6348a1d163..633826a80910 100644 --- a/packages/middleware-sdk-glacier/package.json +++ b/packages/middleware-sdk-glacier/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-glacier", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-machinelearning/package.json b/packages/middleware-sdk-machinelearning/package.json index f3558d243fb5..a7b533c0b6fe 100644 --- a/packages/middleware-sdk-machinelearning/package.json +++ b/packages/middleware-sdk-machinelearning/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-machinelearning", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-rds/package.json b/packages/middleware-sdk-rds/package.json index b9e69c9d6ec8..61f99bcdbb97 100644 --- a/packages/middleware-sdk-rds/package.json +++ b/packages/middleware-sdk-rds/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-rds", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-route53/package.json b/packages/middleware-sdk-route53/package.json index bbddedfc3a5f..434eff158170 100644 --- a/packages/middleware-sdk-route53/package.json +++ b/packages/middleware-sdk-route53/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-route53", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-s3-control/package.json b/packages/middleware-sdk-s3-control/package.json index aa7ee29ca323..95722fc36dde 100644 --- a/packages/middleware-sdk-s3-control/package.json +++ b/packages/middleware-sdk-s3-control/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-s3-control", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-s3/package.json b/packages/middleware-sdk-s3/package.json index d89387b54100..2d29b3f2352e 100644 --- a/packages/middleware-sdk-s3/package.json +++ b/packages/middleware-sdk-s3/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-s3", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-sqs/package.json b/packages/middleware-sdk-sqs/package.json index 623bc832b843..509c25ab675a 100644 --- a/packages/middleware-sdk-sqs/package.json +++ b/packages/middleware-sdk-sqs/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-sqs", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-sts/package.json b/packages/middleware-sdk-sts/package.json index 9c3675687c9a..f9fd3865ffb3 100644 --- a/packages/middleware-sdk-sts/package.json +++ b/packages/middleware-sdk-sts/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-sts", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-sdk-transcribe-streaming/package.json b/packages/middleware-sdk-transcribe-streaming/package.json index e0d1d321b15e..64b15037a7db 100644 --- a/packages/middleware-sdk-transcribe-streaming/package.json +++ b/packages/middleware-sdk-transcribe-streaming/package.json @@ -6,7 +6,7 @@ "types": "./dist-types/index.d.ts", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-transcribe-streaming", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-signing/package.json b/packages/middleware-signing/package.json index 76e85a1aa748..b9e41f73af41 100644 --- a/packages/middleware-signing/package.json +++ b/packages/middleware-signing/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-signing", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-ssec/package.json b/packages/middleware-ssec/package.json index 96347b0d5299..4215363ded02 100644 --- a/packages/middleware-ssec/package.json +++ b/packages/middleware-ssec/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-ssec", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-token/package.json b/packages/middleware-token/package.json index d0f8e8bc2975..aa3a7c288023 100644 --- a/packages/middleware-token/package.json +++ b/packages/middleware-token/package.json @@ -7,7 +7,7 @@ "sideEffects": false, "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-token", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-user-agent/package.json b/packages/middleware-user-agent/package.json index c6134c4c5c37..b38045bcacd6 100644 --- a/packages/middleware-user-agent/package.json +++ b/packages/middleware-user-agent/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-user-agent", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/middleware-websocket/package.json b/packages/middleware-websocket/package.json index 0d7217488a68..6ae01f42e622 100644 --- a/packages/middleware-websocket/package.json +++ b/packages/middleware-websocket/package.json @@ -6,7 +6,7 @@ "types": "./dist-types/index.d.ts", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline middleware-websocket", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/polly-request-presigner/package.json b/packages/polly-request-presigner/package.json index dae6db6f5523..eba7075e455c 100644 --- a/packages/polly-request-presigner/package.json +++ b/packages/polly-request-presigner/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline polly-request-presigner", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/rds-signer/package.json b/packages/rds-signer/package.json index 01a473d5e0a7..3f801fd916d9 100644 --- a/packages/rds-signer/package.json +++ b/packages/rds-signer/package.json @@ -7,7 +7,7 @@ "types": "./dist-types/index.d.ts", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline rds-signer", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/region-config-resolver/package.json b/packages/region-config-resolver/package.json index 7653dc66c37e..fe30b9231452 100644 --- a/packages/region-config-resolver/package.json +++ b/packages/region-config-resolver/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline region-config-resolver", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/s3-presigned-post/package.json b/packages/s3-presigned-post/package.json index 587932f4a704..3ce3f2556a3f 100644 --- a/packages/s3-presigned-post/package.json +++ b/packages/s3-presigned-post/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline s3-presigned-post", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/s3-request-presigner/package.json b/packages/s3-request-presigner/package.json index b00c359e6a2f..c2c2d401c55b 100644 --- a/packages/s3-request-presigner/package.json +++ b/packages/s3-request-presigner/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline s3-request-presigner", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/sha256-tree-hash/package.json b/packages/sha256-tree-hash/package.json index 345155ec8bae..635a6e1272ad 100644 --- a/packages/sha256-tree-hash/package.json +++ b/packages/sha256-tree-hash/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline sha256-tree-hash", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/signature-v4-crt/package.json b/packages/signature-v4-crt/package.json index c2866707e05c..cbeca8758316 100644 --- a/packages/signature-v4-crt/package.json +++ b/packages/signature-v4-crt/package.json @@ -7,7 +7,7 @@ "types": "./dist-types/index.d.ts", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline signature-v4-crt", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/signature-v4-multi-region/package.json b/packages/signature-v4-multi-region/package.json index 716c970becfd..930e9fd3b1bd 100644 --- a/packages/signature-v4-multi-region/package.json +++ b/packages/signature-v4-multi-region/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline signature-v4-multi-region", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/smithy-client/package.json b/packages/smithy-client/package.json index 8433e9656045..61bba97e48f6 100644 --- a/packages/smithy-client/package.json +++ b/packages/smithy-client/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline smithy-client", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/token-providers/package.json b/packages/token-providers/package.json index 5b97ec34c7f8..9048b5568813 100644 --- a/packages/token-providers/package.json +++ b/packages/token-providers/package.json @@ -8,7 +8,7 @@ "scripts": { "build:client-bundle": "node ./scripts/esbuild", "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline token-providers", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json && node ./scripts/nocheck", diff --git a/packages/types/package.json b/packages/types/package.json index 63692ac46882..2b4dc924c17c 100755 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -7,7 +7,7 @@ "description": "Types for the AWS SDK", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline types", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-arn-parser/package.json b/packages/util-arn-parser/package.json index 5cd2ed4783df..5f518884bbfa 100644 --- a/packages/util-arn-parser/package.json +++ b/packages/util-arn-parser/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-arn-parser", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-create-request/package.json b/packages/util-create-request/package.json index 70bdd57d03d6..cecea8d53668 100644 --- a/packages/util-create-request/package.json +++ b/packages/util-create-request/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-create-request", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-dns/package.json b/packages/util-dns/package.json index edcbe7caf634..0e74c62decdd 100644 --- a/packages/util-dns/package.json +++ b/packages/util-dns/package.json @@ -6,7 +6,7 @@ "module": "./dist-es/index.js", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-dns", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-dynamodb/package.json b/packages/util-dynamodb/package.json index 16541ad5180d..32ed9bcc73b7 100644 --- a/packages/util-dynamodb/package.json +++ b/packages/util-dynamodb/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-dynamodb", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-endpoints/package.json b/packages/util-endpoints/package.json index 8bb2520558db..6de19f74f3d4 100644 --- a/packages/util-endpoints/package.json +++ b/packages/util-endpoints/package.json @@ -7,7 +7,7 @@ "types": "./dist-types/index.d.ts", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-endpoints", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-format-url/package.json b/packages/util-format-url/package.json index ee6bee757600..5c6015d92200 100644 --- a/packages/util-format-url/package.json +++ b/packages/util-format-url/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-format-url", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-locate-window/package.json b/packages/util-locate-window/package.json index f6d28eaeb5ff..31a0172f8d2d 100644 --- a/packages/util-locate-window/package.json +++ b/packages/util-locate-window/package.json @@ -3,7 +3,7 @@ "version": "3.465.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-locate-window", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-user-agent-browser/package.json b/packages/util-user-agent-browser/package.json index 0ee76c4e1130..db58b18edaec 100644 --- a/packages/util-user-agent-browser/package.json +++ b/packages/util-user-agent-browser/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-user-agent-browser", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/util-user-agent-node/package.json b/packages/util-user-agent-node/package.json index 901d7dcbe218..baeaeb178a35 100644 --- a/packages/util-user-agent-node/package.json +++ b/packages/util-user-agent-node/package.json @@ -3,7 +3,7 @@ "version": "3.485.0", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline util-user-agent-node", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/xhr-http-handler/package.json b/packages/xhr-http-handler/package.json index 29e9312b62df..1c6dfb24f786 100644 --- a/packages/xhr-http-handler/package.json +++ b/packages/xhr-http-handler/package.json @@ -4,7 +4,7 @@ "description": "Provides a way to make requests using XMLHttpRequest", "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline xhr-http-handler", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/packages/xml-builder/package.json b/packages/xml-builder/package.json index a37150847bac..a8623c8bf789 100644 --- a/packages/xml-builder/package.json +++ b/packages/xml-builder/package.json @@ -8,7 +8,7 @@ }, "scripts": { "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", - "build:cjs": "tsc -p tsconfig.cjs.json", + "build:cjs": "node ../../scripts/compilation/inline xml-builder", "build:es": "tsc -p tsconfig.es.json", "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", "build:types": "tsc -p tsconfig.types.json", diff --git a/scripts/compilation/Inliner.js b/scripts/compilation/Inliner.js new file mode 100644 index 000000000000..302b17c5eb33 --- /dev/null +++ b/scripts/compilation/Inliner.js @@ -0,0 +1,242 @@ +const fs = require("fs"); +const path = require("path"); +const { spawnProcess } = require("./../utils/spawn-process"); +const walk = require("./../utils/walk"); +const esbuild = require("esbuild"); + +const root = path.join(__dirname, "..", ".."); + +/** + * + * Inline a package as one dist file, preserves other files as re-export stubs, + * preserves files with react-native variants as externals. + * + */ +module.exports = class Inliner { + constructor(pkg) { + this.package = pkg; + this.platform = "node"; + this.isPackage = fs.existsSync(path.join(root, "packages", pkg)); + this.isLib = fs.existsSync(path.join(root, "lib", pkg)); + this.isClient = !this.isPackage && !this.isLib; + this.subfolder = this.isPackage ? "packages" : this.isLib ? "lib" : "clients"; + + this.packageDirectory = path.join(root, this.subfolder, pkg); + + this.outfile = path.join(root, this.subfolder, pkg, "dist-cjs", "index.js"); + } + + /** + * step 0: delete the dist-cjs folder. + */ + async clean() { + await spawnProcess("yarn", ["rimraf", "./dist-cjs", "tsconfig.cjs.tsbuildinfo"], { cwd: this.packageDirectory }); + console.log("Deleted ./dist-cjs in " + this.package); + return this; + } + + /** + * step 1: build the default tsc dist-cjs output with dispersed files. + * we will need the files to be in place for stubbing. + */ + async tsc() { + await spawnProcess("yarn", ["tsc", "-p", "tsconfig.cjs.json"], { cwd: this.packageDirectory }); + console.log("Finished recompiling ./dist-cjs in " + this.package); + return this; + } + + /** + * step 2: detect all variant files and their transitive local imports. + * these files will not be inlined, in order to preserve the react-native dist-cjs file replacement behavior. + */ + async discoverVariants() { + const pkgJson = require(path.join(root, this.subfolder, this.package, "package.json")); + this.variantEntries = Object.entries(pkgJson["react-native"] ?? {}); + + for await (const file of walk(path.join(this.packageDirectory, "dist-cjs"))) { + if (fs.existsSync(file.replace(/\.js$/, ".native.js"))) { + console.log("detected undeclared auto-variant", file); + const canonical = file.replace(/(.*?)dist-cjs\//, "./dist-cjs/").replace(/\.js$/, ""); + const variant = canonical.replace(/(.*?)(\.js)?$/, "$1.native$2"); + + this.variantEntries.push([canonical, variant]); + } + if (fs.existsSync(file.replace(/\.js$/, ".browser.js"))) { + // not applicable to CJS? + } + } + + this.transitiveVariants = []; + + for (const [k, v] of this.variantEntries) { + for (const variantFile of [k, v]) { + if (!variantFile.includes("dist-cjs/")) { + continue; + } + const keyFile = path.join( + this.packageDirectory, + "dist-cjs", + variantFile.replace(/(.*?)dist-cjs\//, "") + (variantFile.endsWith(".js") ? "" : ".js") + ); + const keyFileContents = fs.readFileSync(keyFile, "utf-8"); + const requireStatements = keyFileContents.matchAll(/require\("(.*?)"\)/g); + for (const requireStatement of requireStatements) { + if (requireStatement[1]?.startsWith(".")) { + // is relative import. + const key = path + .normalize(path.join(path.dirname(keyFile), requireStatement[1])) + .replace(/(.*?)dist-cjs\//, "./dist-cjs/"); + console.log("Transitive variant file:", key); + this.variantEntries.push([key, key]); + this.transitiveVariants.push(key.replace(/(.*?)dist-cjs\//, "").replace(/(\.js)?$/, "")); + } + } + } + } + + this.variantExternals = []; + this.variantMap = {}; + + for (const [k, v] of this.variantEntries) { + const prefix = "dist-cjs/"; + const keyPrefixIndex = k.indexOf(prefix); + if (keyPrefixIndex === -1) { + continue; + } + const valuePrefixIndex = v.indexOf(prefix); + const keyRelativePath = k.slice(keyPrefixIndex + prefix.length); + const valueRelativePath = v.slice(valuePrefixIndex + prefix.length); + this.variantExternals.push( + ...[keyRelativePath, valueRelativePath].map((file) => (file.endsWith(".js") ? file : file + ".js")) + ); + this.variantMap[keyRelativePath] = valueRelativePath; + } + + return this; + } + + /** + * step 3: rewrite all existing dist-cjs files except the index.js file. + * These now become re-exports of the index to preserve deep-import behavior. + */ + async rewriteStubs() { + for await (const file of walk(path.join(this.packageDirectory, "dist-cjs"))) { + const relativePath = file.replace(path.join(this.packageDirectory, "dist-cjs"), "").slice(1); + if (relativePath === "index.js") { + console.log("Skipping index.js"); + continue; + } + + if (this.variantExternals.find((external) => relativePath.endsWith(external))) { + console.log("Not rewriting.", relativePath, "is variant."); + continue; + } + + console.log("Rewriting", relativePath, "as index re-export stub."); + + const depth = relativePath.split("/").length - 1; + const indexRelativePath = + (depth === 0 + ? "." + : Array.from({ length: depth }) + .map(() => "..") + .join("/")) + "/index.js"; + + fs.writeFileSync(file, `module.exports = require("${indexRelativePath}");`); + } + + this.variantExternalsForEsBuild = this.variantExternals.map( + (variant) => "*/" + path.basename(variant).replace(/.js$/, "") + ); + + return this; + } + + /** + * step 4: bundle the package index into dist-cjs/index.js except for node_modules + * and also excluding any local files that have variants for react-native. + */ + async bundle() { + await esbuild.build({ + platform: this.platform, + bundle: true, + format: "cjs", + mainFields: ["main"], + entryPoints: [path.join(root, this.subfolder, this.package, "src", "index.ts")], + outfile: this.outfile, + external: [ + "tslib", + "@aws-crypto/*", + "@smithy/*", + "@aws-sdk/*", + "typescript", + "vscode-oniguruma", + "pnpapi", + "fast-xml-parser", + "node_modules/*", + ...this.variantExternalsForEsBuild, + ], + }); + return this; + } + + /** + * step 5: rewrite variant external imports to correct path. + * these externalized variants use relative imports for transitive variant files + * which need to be rewritten when in the index.js file. + */ + async fixVariantImportPaths() { + this.indexContents = fs.readFileSync(this.outfile, "utf-8"); + for (const variant of Object.keys(this.variantMap)) { + const basename = path.basename(variant).replace(/.js$/, ""); + const dirname = path.dirname(variant); + + const find = new RegExp(`require\\("./(.*?)/${basename}"\\)`); + const replace = `require("./${dirname}/${basename}")`; + + this.indexContents = this.indexContents.replace(find, replace); + + console.log("replacing", find, "with", replace); + } + + fs.writeFileSync(this.outfile, this.indexContents, "utf-8"); + return this; + } + + /** + * step 6: we validate that the index.js file has a require statement + * for any variant files, to ensure they are not in the inlined (bundled) index. + */ + async validate() { + this.indexContents = fs.readFileSync(this.outfile, "utf-8"); + + const externalsToCheck = new Set( + Object.keys(this.variantMap) + .filter((variant) => !this.transitiveVariants.includes(variant)) + .map((variant) => path.basename(variant).replace(/.js$/, "")) + ); + + for (const line of this.indexContents.split("\n")) { + // we expect to see a line with require() and the variant external in it + if (line.includes("require(")) { + const checkOrder = [...externalsToCheck].sort().reverse(); + for (const external of checkOrder) { + if (line.includes(external)) { + console.log("Inline index confirmed require() for variant external:", external); + externalsToCheck.delete(external); + continue; + } + } + } + } + + if (externalsToCheck.size) { + throw new Error( + "require() statements for the following variant externals: " + + [...externalsToCheck].join(", ") + + " were not found in the index." + ); + } + return this; + } +}; diff --git a/scripts/compilation/inline.js b/scripts/compilation/inline.js new file mode 100644 index 000000000000..2fbdb1f0553e --- /dev/null +++ b/scripts/compilation/inline.js @@ -0,0 +1,49 @@ +/** + * + * Inline a package as one dist file. + * + */ + +const fs = require("fs"); +const path = require("path"); +const Inliner = require("./Inliner"); + +const root = path.join(__dirname, "..", ".."); + +const package = process.argv[2]; + +if (!package) { + /** + * If no package is selected, this script sets build:cjs scripts to + * use this inliner script instead of only tsc. + */ + const packages = fs.readdirSync(path.join(root, "packages")).map((pkg) => ({ + pkgJsonFilePath: path.join(root, "packages", pkg, "package.json"), + pkg, + })); + + const sampleClients = ["s3", "dynamodb", "lambda", "sqs", "sts", "ec2", "sso"]; + packages.push( + ...sampleClients.map((c) => ({ + pkgJsonFilePath: path.join(root, "clients", `client-${c}`, "package.json"), + pkg: `client-${c}`, + })) + ); + + for (const { pkg, pkgJsonFilePath } of packages) { + const pkgJson = require(pkgJsonFilePath); + pkgJson.scripts["build:cjs"] = `node ../../scripts/compilation/inline ${pkg}`; + fs.writeFileSync(pkgJsonFilePath, JSON.stringify(pkgJson, null, 2)); + } +} else { + (async () => { + const inliner = new Inliner(package); + await inliner.clean(); + await inliner.tsc(); + await inliner.discoverVariants(); + await inliner.rewriteStubs(); + await inliner.bundle(); + await inliner.fixVariantImportPaths(); + await inliner.validate(); + })(); +}