| 546 | } |
| 547 | |
| 548 | async function buildLibrary() { |
| 549 | const defaultLibEsBuildOption = { |
| 550 | chunkNames: "llrt-[name]-runtime-[hash]", |
| 551 | ...ES_BUILD_OPTIONS, |
| 552 | splitting: false, |
| 553 | keepNames: true, |
| 554 | nodePaths: ["."], |
| 555 | }; |
| 556 | |
| 557 | // Build lib |
| 558 | const entryPoints = {}; |
| 559 | ENTRYPOINTS.forEach((entry) => { |
| 560 | entryPoints[entry] = path.join(SRC_DIR, entry); |
| 561 | }); |
| 562 | await esbuild.build({ |
| 563 | ...defaultLibEsBuildOption, |
| 564 | entryPoints, |
| 565 | plugins: [requireProcessPlugin], |
| 566 | }); |
| 567 | |
| 568 | // Build tests |
| 569 | const testEntryPoints = TEST_FILES.reduce((acc, entry) => { |
| 570 | const { name, dir } = path.parse(entry); |
| 571 | const parentDir = path.basename(dir); |
| 572 | acc[path.join("__tests__", parentDir, name)] = entry; |
| 573 | return acc; |
| 574 | }, {}); |
| 575 | |
| 576 | await esbuild.build({ |
| 577 | ...defaultLibEsBuildOption, |
| 578 | entryPoints: testEntryPoints, |
| 579 | external: [...ES_BUILD_OPTIONS.external, "@aws-sdk", "@smithy"], |
| 580 | }); |
| 581 | } |
| 582 | |
| 583 | async function buildSdks() { |
| 584 | const sdkEntryList = await Promise.all( |