diff --git a/scripts/model-analysis/model-analysis.js b/scripts/model-analysis/model-analysis.js index 67c3e5b7c0a2b..91cc766e1d423 100644 --- a/scripts/model-analysis/model-analysis.js +++ b/scripts/model-analysis/model-analysis.js @@ -9,6 +9,8 @@ const root = path.join(__dirname, "..", ".."); const models = path.join(root, "codegen", "sdk-codegen", "aws-models"); +const protocolCounts = {}; + for (const file of fs.readdirSync(models)) { if (file.endsWith(".json")) { const model = require(path.join(models, file)); @@ -17,7 +19,12 @@ for (const file of fs.readdirSync(models)) { const operations = Object.entries(shapes).filter(([id, s]) => { return s.type === "operation"; }); - const protocol = Object.entries(service[1].traits).find(([id, trait]) => id.startsWith("aws.protocol"))[0]; + const protocol = Object.entries(service[1].traits).find( + ([id, trait]) => id.startsWith("aws.protocol") || id.startsWith("smithy.protocol") + )[0]; + + protocolCounts[protocol] = protocolCounts[protocol] ?? {}; + protocolCounts[protocol][service[0]] = operations.length; if (protocol.includes("rest")) { const inputOutputShapes = Object.entries(shapes).filter(([id, s]) => { @@ -129,3 +136,15 @@ for (const file of fs.readdirSync(models)) { } } } + +for (const [protocol, serviceToOperationCounts] of Object.entries(protocolCounts)) { + const entries = Object.entries(serviceToOperationCounts).sort(([s1, c1], [s2, c2]) => { + return c2 - c1; + }); + for (const [s, c] of entries) { + delete serviceToOperationCounts[s]; + serviceToOperationCounts[s] = c; + } +} + +console.log(protocolCounts); diff --git a/tests/bundlers/Makefile b/tests/bundlers/Makefile index 0427ac745cd73..7e63268e738db 100644 --- a/tests/bundlers/Makefile +++ b/tests/bundlers/Makefile @@ -22,4 +22,7 @@ webpack: esbuild: npx esbuild ./source.ts --bundle --outfile=./dist/esbuild-dist.js --format=esm --tree-shaking=true - npx esbuild ./source.ts --bundle --outfile=./dist-min/esbuild-dist.min.js --format=esm --tree-shaking=true --minify \ No newline at end of file + npx esbuild ./source.ts --bundle --outfile=./dist-min/esbuild-dist.min.js --format=esm --tree-shaking=true --minify + +clean: + rm -rf dist dist-min dist-vite dist-esbuild dist-webpack \ No newline at end of file diff --git a/tests/bundlers/applications/lib-dynamodb-single-command.ts b/tests/bundlers/applications/lib-dynamodb-single-command.ts new file mode 100644 index 0000000000000..f4765c836a9ae --- /dev/null +++ b/tests/bundlers/applications/lib-dynamodb-single-command.ts @@ -0,0 +1,2 @@ +export { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb"; +export { DynamoDBClient } from "@aws-sdk/client-dynamodb"; diff --git a/tests/bundlers/applications/multi-protocols.ts b/tests/bundlers/applications/multi-protocols.ts new file mode 100644 index 0000000000000..d80f50cd6f77d --- /dev/null +++ b/tests/bundlers/applications/multi-protocols.ts @@ -0,0 +1,4 @@ +// group of most used protocols +// excludes CBOR, Query, EC2, and JSON RPC 1.1 + +export { AwsRestJsonProtocol, AwsRestXmlProtocol, AwsJson1_0Protocol } from "@aws-sdk/core/protocols"; diff --git a/tests/bundlers/applications/single-cbor-xml-protocol.ts b/tests/bundlers/applications/protocol-rest-xml.ts similarity index 100% rename from tests/bundlers/applications/single-cbor-xml-protocol.ts rename to tests/bundlers/applications/protocol-rest-xml.ts diff --git a/tests/bundlers/applications/single-xml-protocol.ts b/tests/bundlers/applications/protocol-rpc-cbor.ts similarity index 100% rename from tests/bundlers/applications/single-xml-protocol.ts rename to tests/bundlers/applications/protocol-rpc-cbor.ts diff --git a/tests/bundlers/applications/single-json-protocol.ts b/tests/bundlers/applications/protocol-rpc-json-1-1.ts similarity index 100% rename from tests/bundlers/applications/single-json-protocol.ts rename to tests/bundlers/applications/protocol-rpc-json-1-1.ts diff --git a/tests/bundlers/applications/sdk-connect-aggregate.ts b/tests/bundlers/applications/sdk-connect-aggregate.ts new file mode 100644 index 0000000000000..5cf6e3d0ff27d --- /dev/null +++ b/tests/bundlers/applications/sdk-connect-aggregate.ts @@ -0,0 +1,2 @@ +// rest json +export { Connect } from "@aws-sdk/client-connect"; diff --git a/tests/bundlers/applications/sdk-connect-single-command.ts b/tests/bundlers/applications/sdk-connect-single-command.ts new file mode 100644 index 0000000000000..ac4d1dcd161ed --- /dev/null +++ b/tests/bundlers/applications/sdk-connect-single-command.ts @@ -0,0 +1,2 @@ +// rest json +export { ConnectClient, ListLambdaFunctionsCommand } from "@aws-sdk/client-connect"; diff --git a/tests/bundlers/runner/BundlerSizeBenchmarker.mjs b/tests/bundlers/runner/BundlerSizeBenchmarker.mjs index cb264097082d0..d04433bf07da4 100644 --- a/tests/bundlers/runner/BundlerSizeBenchmarker.mjs +++ b/tests/bundlers/runner/BundlerSizeBenchmarker.mjs @@ -20,7 +20,7 @@ export class BundlerSizeBenchmarker { * @returns {Promise<{app:string,size:string,bundler:string}>} */ async webpack() { - const outfile = path.resolve(__dirname, "..", "dist", `webpack-dist-${this.application}.js`); + const outfile = path.resolve(__dirname, "..", "dist-webpack", `webpack-dist-${this.application}.js`); const config = { mode: "production", @@ -72,14 +72,14 @@ export class BundlerSizeBenchmarker { }, minify: true, emptyOutDir: false, + worker: { + format: "es", + }, rollupOptions: { - input: { - input: inputFile, - }, external: [], output: { + format: "esm", dir: path.dirname(outfile), - inlineDynamicImports: true, }, }, }, @@ -95,7 +95,7 @@ export class BundlerSizeBenchmarker { */ async esbuild() { const entryPoint = path.resolve(__dirname, "..", "applications", this.application); - const outfile = path.resolve(__dirname, "..", "dist", `esbuild-dist-${this.application}.js`); + const outfile = path.resolve(__dirname, "..", "dist-esbuild", `esbuild-dist-${this.application}.js`); await esbuild.build({ entryPoints: [entryPoint],