@mrgrain/cdk-esbuild 3.10.0 → 3.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -2777,7 +2777,7 @@
2777
2777
  "stability": "stable"
2778
2778
  },
2779
2779
  "homepage": "https://github.com/mrgrain/cdk-esbuild",
2780
- "jsiiVersion": "1.64.0 (build 4c1eae8)",
2780
+ "jsiiVersion": "1.65.0 (build 7a02b7f)",
2781
2781
  "keywords": [
2782
2782
  "aws-cdk",
2783
2783
  "bundler",
@@ -2800,7 +2800,7 @@
2800
2800
  },
2801
2801
  "name": "@mrgrain/cdk-esbuild",
2802
2802
  "readme": {
2803
- "markdown": "<picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark-dark.svg\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark-light.svg\">\n <img src=\"https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark.svg\" alt=\"cdk-esbuild\">\n</picture>\n\n_CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_\n\n[Getting started](#getting-started) |\n[Documentation](#documentation) | [API Reference](#api-reference) | [Upgrading from AWS CDK v1](#upgrading-from-aws-cdk-v1)\n\n[![View on Construct Hub](https://constructs.dev/badge?package=%40mrgrain%2Fcdk-esbuild)](https://constructs.dev/packages/@mrgrain/cdk-esbuild)\n\n## Why?\n\n_esbuild_ is an extremely fast bundler and minifier for Typescript and JavaScript.\nThis package makes _esbuild_ available to deploy lambda functions, static websites or to publish build artefacts (assets) for further use.\n\nAWS CDK [supports _esbuild_ with Lambda Functions](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html). However the implementation cannot be used with any other Constructs and doesn't expose all of _esbuild_'s build interface.\n\nThis package is running _esbuild_ directly in Node.js and bypasses Docker which the AWS CDK implementation uses. The approach is quicker and easier to use for Node.js users, but incompatible with other languages.\n\n**Production readiness**\n\nThis package is stable and ready to be used in production, as many do. However _esbuild_ has not yet released a version 1.0.0 and its API is still in active development. Please read the guide on [esbuild's production readiness](https://esbuild.github.io/faq/#production-readiness).\n\nNotably upgrades of the _esbuild_ minimum version requirement will be introduced in **minor versions** of this package and will inherit breaking changes from _esbuild_.\n\n## Getting started\n\nInstall `cdk-esbuild`:\n\n```\nnpm install @mrgrain/cdk-esbuild@3\n```\n\nIf _peer_ or _optional dependencies_ are not installed automatically (e.g. when using npm v4-6), please use this command to install all of them:\n\n```\nnpm install @mrgrain/cdk-esbuild@3 esbuild\n```\n\n### AWS Lambda: Serverless function\n\n> 💡 See [Lambda Function](examples/lambda) for a complete working example of a how to deploy a lambda function.\n\nUse `TypeScriptCode` as the `code` of a [lambda function](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html#code):\n\n```ts\nimport * as lambda from \"aws-cdk-lib/aws-lambda\";\nimport { TypeScriptCode } from \"@mrgrain/cdk-esbuild\";\n\nconst bundledCode = new TypeScriptCode(\"src/index.ts\");\n\nconst fn = new lambda.Function(stack, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_16_X,\n handler: \"index.handler\",\n code: bundledCode,\n});\n```\n\n### AWS S3: Static Website\n\n> 💡 See [Static Website with React](examples/website) for a complete working example of a how to deploy a React app to S3.\n\nUse `TypeScriptSource` as one of the `sources` of a [static website deployment](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html#roadmap):\n\n```ts\nimport * as s3 from \"aws-cdk-lib/aws-s3\";\nimport * as s3deploy from \"aws-cdk-lib/aws-s3-deployment\";\nimport { TypeScriptSource } from \"@mrgrain/cdk-esbuild\";\n\nconst websiteBundle = new TypeScriptSource(\"src/index.tsx\");\n\nconst websiteBucket = new s3.Bucket(stack, \"WebsiteBucket\", {\n autoDeleteObjects: true,\n publicReadAccess: true,\n removalPolicy: RemovalPolicy.DESTROY,\n websiteIndexDocument: \"index.html\",\n});\n\nnew s3deploy.BucketDeployment(stack, \"DeployWebsite\", {\n destinationBucket: websiteBucket,\n sources: [websiteBundle],\n});\n```\n\n### Amazon CloudWatch Synthetics: Canary monitoring\n\n> 💡 See [Monitored Website](examples/website) for a complete working example of a deployed and monitored website.\n\nSynthetics runs a canary to produce traffic to an application for monitoring purposes. Use `TypeScriptCode` as the `code` of a Canary test:\n\n> ℹ️ This feature depends on the `@aws-cdk/aws-synthetics-alpha` package which is a developer preview. You may need to update your source code when upgrading to a newer version of this package.\n>\n> ```\n> npm i @aws-cdk/aws-synthetics-alpha\n> ```\n\n```ts\nimport * as synthetics from \"@aws-cdk/aws-synthetics-alpha\";\nimport { TypeScriptCode } from \"@mrgrain/cdk-esbuild\";\n\nconst bundledCode = new TypeScriptCode(\"src/index.ts\", {\n buildOptions: {\n outdir: \"nodejs/node_modules\", // This is required by Synthetics\n },\n});\n\nconst canary = new synthetics.Canary(stack, \"MyCanary\", {\n runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_2,\n test: synthetics.Test.custom({\n code: bundledCode,\n handler: \"index.handler\",\n });\n});\n```\n\n## Documentation\n\nThe package exports various different constructs for use with existing CDK features. A major guiding design principal for this package is to _extend, don't replace_. Expect constructs that you can provide as props, not complete replacements.\n\nFor use in **Lambda Functions** and **Synthetic Canaries**, the following classes implement `lambda.Code` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Code.html)) and `synthetics.Code` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-synthetics-alpha.Code.html)):\n\n- `TypeScriptCode` & `JavaScriptCode`\n\nInline code is only supported by **Lambda**:\n\n- `InlineTypeScriptCode` & `InlineJavaScriptCode`\n- `InlineTsxCode` & `InlineJsxCode`\n\nFor use with **S3 bucket deployments**, classes implementing `s3deploy.ISource` ([reference](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html)):\n\n- `TypeScriptSource` & `JavaScriptSource`\n\n> _Code and Source constructs seamlessly plug-in to other high-level CDK constructs. They share the same set of parameters, props and build options._\n\nThe following classes power the other features. You normally won't have to use them, but they are there if you need them:\n\n- `TypeScriptAsset` & `JavaScriptAsset` implements `s3.Asset` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets.Asset.html)) \\\n creates an asset uploaded to S3 which can be referenced by other constructs\n\n- `EsbuildBundler` implements `core.BundlingOptions` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html)) \\\n provides an interface for a _esbuild_ bundler wherever needed\n\n### [API Reference](API.md)\n\nAuto-generated reference for classes and structs. This information is also available as part of your IDE's code completion.\n\n### Escape hatches\n\nIt's possible that you want to use an implementation of esbuild that's different to the default one. Common reasons are:\n\n- The current version constraints for esbuild are not suitable\n- To use a version of esbuild that is installed by any other means than `npm`, including Docker\n- Plugin support is needed for building\n\nFor these situations, this package offers an escape hatch to bypass regular the implementation and provide a custom build and transform function.\n\n#### Esbuild binary path\n\nIt is possible to override the binary used by esbuild. The usual way to do this is to set the `ESBUILD_BINARY_PATH` environment variable. For convenience this package allows to set the binary path as a prop:\n\n```ts\nnew TypeScriptCode(\"fixtures/handlers/ts-handler.ts\", {\n esbuildBinaryPath: \"path/to/esbuild/binary\"\n});\n```\n\n#### Custom build function\n\n> 💡 See [Using esbuild with plugins](examples/esbuild-with-plugins) for a complete working example of a custom build function using this escape hatch.\n\nConstructs that result in starting a build, take a `buildFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `buildSync` function.\n\n```ts\nnew TypeScriptCode(\"fixtures/handlers/ts-handler.ts\", {\n buildFn: (options: BuildOptions): BuildResult => {\n try {\n // custom implementation returning BuildResult\n } catch (error) {\n // throw BuildFailure exception here\n }\n },\n});\n```\n\nInstead of esbuild, the provided function will be invoked with the calculated build options. The custom build function can amend, change or discard any of these. However integration with CDK relies heavily on the values `outdir`/`outfile` are set to and it's usually required to use them unchanged.\n\nFailures have to cause a `BuildFailure` exception in order to be fully handled.\n\n#### Custom transform function\n\nConstructs that result in starting a transformation, take a `transformFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `transformSync` function.\n\n```ts\nnew InlineTypeScriptCode(\"let x: number = 1\", {\n transformFn: (options: TransformOptions): TransformResult => {\n try {\n // custom implementation returning TransformResult\n } catch (error) {\n // throw TransformFailure exception here\n }\n },,\n});\n```\n\nInstead of esbuild, the provided function will be invoked with the calculated transform options. The custom transform function can amend, change or discard any of these.\n\nFailures have to cause a `TransformFailure` exception in order to be fully handled.\n\n### Upgrading from AWS CDK v1\n\nThis version is compatible with AWS CDK v2. For the previous, AWS CDK v1 compatible release, see [cdk-esbuild@v2](https://github.com/mrgrain/cdk-esbuild/tree/v2).\n\nTo upgrade from AWS CDK v1 and cdk-esbuild@v2, please follow these steps:\n\n- This version requires AWS CDK v2. Follow the [official migration guide](https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-v2.html) to upgrade.\n- Update the package dependency to v3: `npm install --save @mrgrain/cdk-esbuild@^3.0.0`\n- `esbuild` is installed as an optional dependency. If your setup does not automatically install optional dependencies, make sure to add it as an explicit dependency.\n- Any use of `InlineCode` variations has to be updated. Previously the second parameter was either of type `TransformerProps` or `TransformOptions`. Now it must be `TransformerProps`.\\\n If the passed value is of type `TransformOptions`, turn it into the correct type like this:\n\n ```ts\n const oldOptions: TransformOptions = {...}\n\n new InlineTypeScriptCode('// inline code', {\n transformOptions: oldOptions\n });\n ```\n\n## Versioning\n\nThis package follows [Semantic Versioning](https://semver.org/), with the exception of upgrades to `esbuild`. These will be released as **minor versions** and often include breaking changes from `esbuild`.\n\n### Npm Tags\n\nSome users prefer to use tags over version ranges. The following stable tags are available for use:\n\n- `cdk-v1`, `cdk-v2` are provided for the latest release compatible with each version of the AWS CDK.\n\n- `latest` is the most recent stable release.\n\nThese tags also exist, but usage is strongly not recommended:\n\n- `unstable`, `next` are used for pre-release of the current and next major version respectively.\n\n- ~~`cdk-1.x.x`~~ tags have been deprecated in favour of `cdk-v1`. Use that one instead.\n\n## Roadmap & Contributions\n\n[The project's roadmap is available on GitHub.](https://github.com/mrgrain/cdk-esbuild/projects/1) Please submit any feature requests as issues to the repository.\n\nAll contributions are welcome, no matter if they are for already planned or completely new features.\n\n## Library authors\n\nBuilding a library consumed by other packages that relies on `cdk-esbuild` might require you to set `buildOptions.absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the calling file, and traverse the tree upwards to the root of your library package (that's where `package.json` and `tsconfig.json` are):\n\n```ts\n// file: project/src/index.ts\nconst props = {\n buildOptions: {\n absWorkingDir: path.resolve(__dirname, \"..\"), // now: /user/project\n },\n};\n```\n\nThis will dynamically resolve to the correct path, wherever the package is installed.\n\nPlease open an issue if you encounter any difficulties.\n"
2803
+ "markdown": "<img src=\"https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark-light.svg\" alt=\"cdk-esbuild\">\n\n_CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_\n\n[Getting started](#getting-started) |\n[Documentation](#documentation) | [API Reference](#api-reference) | [Upgrading from AWS CDK v1](#upgrading-from-aws-cdk-v1)\n\n[![View on Construct Hub](https://constructs.dev/badge?package=%40mrgrain%2Fcdk-esbuild)](https://constructs.dev/packages/@mrgrain/cdk-esbuild)\n\n## Why?\n\n_esbuild_ is an extremely fast bundler and minifier for Typescript and JavaScript.\nThis package makes _esbuild_ available to deploy lambda functions, static websites or to publish build artefacts (assets) for further use.\n\nAWS CDK [supports _esbuild_ with Lambda Functions](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-nodejs-readme.html). However the implementation cannot be used with any other Constructs and doesn't expose all of _esbuild_'s build interface.\n\nThis package is running _esbuild_ directly in Node.js and bypasses Docker which the AWS CDK implementation uses. The approach is quicker and easier to use for Node.js users, but incompatible with other languages.\n\n**Production readiness**\n\nThis package is stable and ready to be used in production, as many do. However _esbuild_ has not yet released a version 1.0.0 and its API is still in active development. Please read the guide on [esbuild's production readiness](https://esbuild.github.io/faq/#production-readiness).\n\nNotably upgrades of the _esbuild_ minimum version requirement will be introduced in **minor versions** of this package and will inherit breaking changes from _esbuild_.\n\n## Getting started\n\nInstall `cdk-esbuild`:\n\n```\nnpm install @mrgrain/cdk-esbuild@3\n```\n\nIf _peer_ or _optional dependencies_ are not installed automatically (e.g. when using npm v4-6), please use this command to install all of them:\n\n```\nnpm install @mrgrain/cdk-esbuild@3 esbuild\n```\n\n### AWS Lambda: Serverless function\n\n> 💡 See [Lambda Function](examples/typescript/lambda) for a complete working example of a how to deploy a lambda function.\n\nUse `TypeScriptCode` as the `code` of a [lambda function](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html#code):\n\n```ts\nimport * as lambda from \"aws-cdk-lib/aws-lambda\";\nimport { TypeScriptCode } from \"@mrgrain/cdk-esbuild\";\n\nconst bundledCode = new TypeScriptCode(\"src/index.ts\");\n\nconst fn = new lambda.Function(stack, \"MyFunction\", {\n runtime: lambda.Runtime.NODEJS_16_X,\n handler: \"index.handler\",\n code: bundledCode,\n});\n```\n\n### AWS S3: Static Website\n\n> 💡 See [Static Website with React](examples/typescript/website) for a complete working example of a how to deploy a React app to S3.\n\nUse `TypeScriptSource` as one of the `sources` of a [static website deployment](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html#roadmap):\n\n```ts\nimport * as s3 from \"aws-cdk-lib/aws-s3\";\nimport * as s3deploy from \"aws-cdk-lib/aws-s3-deployment\";\nimport { TypeScriptSource } from \"@mrgrain/cdk-esbuild\";\n\nconst websiteBundle = new TypeScriptSource(\"src/index.tsx\");\n\nconst websiteBucket = new s3.Bucket(stack, \"WebsiteBucket\", {\n autoDeleteObjects: true,\n publicReadAccess: true,\n removalPolicy: RemovalPolicy.DESTROY,\n websiteIndexDocument: \"index.html\",\n});\n\nnew s3deploy.BucketDeployment(stack, \"DeployWebsite\", {\n destinationBucket: websiteBucket,\n sources: [websiteBundle],\n});\n```\n\n### Amazon CloudWatch Synthetics: Canary monitoring\n\n> 💡 See [Monitored Website](examples/typescript/website) for a complete working example of a deployed and monitored website.\n\nSynthetics runs a canary to produce traffic to an application for monitoring purposes. Use `TypeScriptCode` as the `code` of a Canary test:\n\n> ℹ️ This feature depends on the `@aws-cdk/aws-synthetics-alpha` package which is a developer preview. You may need to update your source code when upgrading to a newer version of this package.\n>\n> ```\n> npm i @aws-cdk/aws-synthetics-alpha\n> ```\n\n```ts\nimport * as synthetics from \"@aws-cdk/aws-synthetics-alpha\";\nimport { TypeScriptCode } from \"@mrgrain/cdk-esbuild\";\n\nconst bundledCode = new TypeScriptCode(\"src/index.ts\", {\n buildOptions: {\n outdir: \"nodejs/node_modules\", // This is required by Synthetics\n },\n});\n\nconst canary = new synthetics.Canary(stack, \"MyCanary\", {\n runtime: synthetics.Runtime.SYNTHETICS_NODEJS_PUPPETEER_3_2,\n test: synthetics.Test.custom({\n code: bundledCode,\n handler: \"index.handler\",\n });\n});\n```\n\n## Documentation\n\nThe package exports various different constructs for use with existing CDK features. A major guiding design principal for this package is to _extend, don't replace_. Expect constructs that you can provide as props, not complete replacements.\n\nFor use in **Lambda Functions** and **Synthetic Canaries**, the following classes implement `lambda.Code` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Code.html)) and `synthetics.Code` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-synthetics-alpha.Code.html)):\n\n- `TypeScriptCode` & `JavaScriptCode`\n\nInline code is only supported by **Lambda**:\n\n- `InlineTypeScriptCode` & `InlineJavaScriptCode`\n- `InlineTsxCode` & `InlineJsxCode`\n\nFor use with **S3 bucket deployments**, classes implementing `s3deploy.ISource` ([reference](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html)):\n\n- `TypeScriptSource` & `JavaScriptSource`\n\n> _Code and Source constructs seamlessly plug-in to other high-level CDK constructs. They share the same set of parameters, props and build options._\n\nThe following classes power the other features. You normally won't have to use them, but they are there if you need them:\n\n- `TypeScriptAsset` & `JavaScriptAsset` implements `s3.Asset` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets.Asset.html)) \\\n creates an asset uploaded to S3 which can be referenced by other constructs\n\n- `EsbuildBundler` implements `core.BundlingOptions` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html)) \\\n provides an interface for a _esbuild_ bundler wherever needed\n\n### [API Reference](API.md)\n\nAuto-generated reference for classes and structs. This information is also available as part of your IDE's code completion.\n\n### Escape hatches\n\nIt's possible that you want to use an implementation of esbuild that's different to the default one. Common reasons are:\n\n- The current version constraints for esbuild are not suitable\n- To use a version of esbuild that is installed by any other means than `npm`, including Docker\n- Plugin support is needed for building\n\nFor these situations, this package offers an escape hatch to bypass regular the implementation and provide a custom build and transform function.\n\n#### Esbuild binary path\n\nIt is possible to override the binary used by esbuild. The usual way to do this is to set the `ESBUILD_BINARY_PATH` environment variable. For convenience this package allows to set the binary path as a prop:\n\n```ts\nnew TypeScriptCode(\"fixtures/handlers/ts-handler.ts\", {\n esbuildBinaryPath: \"path/to/esbuild/binary\"\n});\n```\n\n#### Custom build function\n\n> 💡 See [Using esbuild with plugins](examples/typescript/esbuild-with-plugins) for a complete working example of a custom build function using this escape hatch.\n\nConstructs that result in starting a build, take a `buildFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `buildSync` function.\n\n```ts\nnew TypeScriptCode(\"fixtures/handlers/ts-handler.ts\", {\n buildFn: (options: BuildOptions): BuildResult => {\n try {\n // custom implementation returning BuildResult\n } catch (error) {\n // throw BuildFailure exception here\n }\n },\n});\n```\n\nInstead of esbuild, the provided function will be invoked with the calculated build options. The custom build function can amend, change or discard any of these. However integration with CDK relies heavily on the values `outdir`/`outfile` are set to and it's usually required to use them unchanged.\n\nFailures have to cause a `BuildFailure` exception in order to be fully handled.\n\n#### Custom transform function\n\nConstructs that result in starting a transformation, take a `transformFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `transformSync` function.\n\n```ts\nnew InlineTypeScriptCode(\"let x: number = 1\", {\n transformFn: (options: TransformOptions): TransformResult => {\n try {\n // custom implementation returning TransformResult\n } catch (error) {\n // throw TransformFailure exception here\n }\n },,\n});\n```\n\nInstead of esbuild, the provided function will be invoked with the calculated transform options. The custom transform function can amend, change or discard any of these.\n\nFailures have to cause a `TransformFailure` exception in order to be fully handled.\n\n### Upgrading from AWS CDK v1\n\nThis version is compatible with AWS CDK v2. For the previous, AWS CDK v1 compatible release, see [cdk-esbuild@v2](https://github.com/mrgrain/cdk-esbuild/tree/v2).\n\nTo upgrade from AWS CDK v1 and cdk-esbuild@v2, please follow these steps:\n\n- This version requires AWS CDK v2. Follow the [official migration guide](https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-v2.html) to upgrade.\n- Update the package dependency to v3: `npm install --save @mrgrain/cdk-esbuild@^3.0.0`\n- `esbuild` is installed as an optional dependency. If your setup does not automatically install optional dependencies, make sure to add it as an explicit dependency.\n- Any use of `InlineCode` variations has to be updated. Previously the second parameter was either of type `TransformerProps` or `TransformOptions`. Now it must be `TransformerProps`.\\\n If the passed value is of type `TransformOptions`, turn it into the correct type like this:\n\n ```ts\n const oldOptions: TransformOptions = {...}\n\n new InlineTypeScriptCode('// inline code', {\n transformOptions: oldOptions\n });\n ```\n\n## Versioning\n\nThis package follows [Semantic Versioning](https://semver.org/), with the exception of upgrades to `esbuild`. These will be released as **minor versions** and often include breaking changes from `esbuild`.\n\n### Npm Tags\n\nSome users prefer to use tags over version ranges. The following stable tags are available for use:\n\n- `cdk-v1`, `cdk-v2` are provided for the latest release compatible with each version of the AWS CDK.\n\n- `latest` is the most recent stable release.\n\nThese tags also exist, but usage is strongly not recommended:\n\n- `unstable`, `next` are used for pre-release of the current and next major version respectively.\n\n- ~~`cdk-1.x.x`~~ tags have been deprecated in favour of `cdk-v1`. Use that one instead.\n\n## Roadmap & Contributions\n\n[The project's roadmap is available on GitHub.](https://github.com/mrgrain/cdk-esbuild/projects/1) Please submit any feature requests as issues to the repository.\n\nAll contributions are welcome, no matter if they are for already planned or completely new features.\n\n## Library authors\n\nBuilding a library consumed by other packages that relies on `cdk-esbuild` might require you to set `buildOptions.absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the calling file, and traverse the tree upwards to the root of your library package (that's where `package.json` and `tsconfig.json` are):\n\n```ts\n// file: project/src/index.ts\nconst props = {\n buildOptions: {\n absWorkingDir: path.resolve(__dirname, \"..\"), // now: /user/project\n },\n};\n```\n\nThis will dynamically resolve to the correct path, wherever the package is installed.\n\nPlease open an issue if you encounter any difficulties.\n"
2804
2804
  },
2805
2805
  "repository": {
2806
2806
  "type": "git",
@@ -2808,6 +2808,11 @@
2808
2808
  },
2809
2809
  "schema": "jsii/0.10.0",
2810
2810
  "targets": {
2811
+ "dotnet": {
2812
+ "iconUrl": "https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/logo.png",
2813
+ "namespace": "Mrgrain.CdkEsbuild",
2814
+ "packageId": "Mrgrain.CdkEsbuild"
2815
+ },
2811
2816
  "js": {
2812
2817
  "npm": "@mrgrain/cdk-esbuild"
2813
2818
  },
@@ -4159,9 +4164,9 @@
4159
4164
  "abstract": true,
4160
4165
  "docs": {
4161
4166
  "default": "- `CDK_ESBUILD_MODULE_PATH` or package resolution (see above)",
4162
- "remarks": "Python, Go, .NET and Java should use an absolute path, because the jsii execution environment uses a temporary working directory.\n\nIf not set, the module path will be determined in the following order:\n\n- Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable\n- In TypeScript, fallback to the default Node.js package resolution mechanism\n- All other languages (Python, Go, .NET, Java) use an automatic \"best effort\" resolution mechanism. \\\n The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.\n If `esbuild` cannot be found, it might be installed dynamically to a temporary location.\n To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.",
4167
+ "remarks": "E.g. \"/home/user/.npm/node_modules/esbuild/lib/main.js\"\n\nIf not set, the module path will be determined in the following order:\n\n- Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable\n- In TypeScript, fallback to the default Node.js package resolution mechanism\n- All other languages (Python, Go, .NET, Java) use an automatic \"best effort\" resolution mechanism. \\\n The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.\n If `esbuild` cannot be found, it might be installed dynamically to a temporary location.\n To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.",
4163
4168
  "stability": "experimental",
4164
- "summary": "Path used to import the esbuild module."
4169
+ "summary": "Absolute path to the esbuild module JS file."
4165
4170
  },
4166
4171
  "immutable": true,
4167
4172
  "locationInModule": {
@@ -4249,6 +4254,103 @@
4249
4254
  ],
4250
4255
  "symbolId": "aws-lambda/lib/code:CodeConfig"
4251
4256
  },
4257
+ "@mrgrain/cdk-esbuild.CompilerOptions": {
4258
+ "assembly": "@mrgrain/cdk-esbuild",
4259
+ "datatype": true,
4260
+ "docs": {
4261
+ "stability": "stable"
4262
+ },
4263
+ "fqn": "@mrgrain/cdk-esbuild.CompilerOptions",
4264
+ "kind": "interface",
4265
+ "locationInModule": {
4266
+ "filename": "src/esbuild-types.ts",
4267
+ "line": 590
4268
+ },
4269
+ "name": "CompilerOptions",
4270
+ "properties": [
4271
+ {
4272
+ "abstract": true,
4273
+ "docs": {
4274
+ "stability": "stable"
4275
+ },
4276
+ "immutable": true,
4277
+ "locationInModule": {
4278
+ "filename": "src/esbuild-types.ts",
4279
+ "line": 594
4280
+ },
4281
+ "name": "importsNotUsedAsValues",
4282
+ "optional": true,
4283
+ "type": {
4284
+ "primitive": "string"
4285
+ }
4286
+ },
4287
+ {
4288
+ "abstract": true,
4289
+ "docs": {
4290
+ "stability": "stable"
4291
+ },
4292
+ "immutable": true,
4293
+ "locationInModule": {
4294
+ "filename": "src/esbuild-types.ts",
4295
+ "line": 591
4296
+ },
4297
+ "name": "jsxFactory",
4298
+ "optional": true,
4299
+ "type": {
4300
+ "primitive": "string"
4301
+ }
4302
+ },
4303
+ {
4304
+ "abstract": true,
4305
+ "docs": {
4306
+ "stability": "stable"
4307
+ },
4308
+ "immutable": true,
4309
+ "locationInModule": {
4310
+ "filename": "src/esbuild-types.ts",
4311
+ "line": 592
4312
+ },
4313
+ "name": "jsxFragmentFactory",
4314
+ "optional": true,
4315
+ "type": {
4316
+ "primitive": "string"
4317
+ }
4318
+ },
4319
+ {
4320
+ "abstract": true,
4321
+ "docs": {
4322
+ "stability": "stable"
4323
+ },
4324
+ "immutable": true,
4325
+ "locationInModule": {
4326
+ "filename": "src/esbuild-types.ts",
4327
+ "line": 595
4328
+ },
4329
+ "name": "preserveValueImports",
4330
+ "optional": true,
4331
+ "type": {
4332
+ "primitive": "boolean"
4333
+ }
4334
+ },
4335
+ {
4336
+ "abstract": true,
4337
+ "docs": {
4338
+ "stability": "stable"
4339
+ },
4340
+ "immutable": true,
4341
+ "locationInModule": {
4342
+ "filename": "src/esbuild-types.ts",
4343
+ "line": 593
4344
+ },
4345
+ "name": "useDefineForClassFields",
4346
+ "optional": true,
4347
+ "type": {
4348
+ "primitive": "boolean"
4349
+ }
4350
+ }
4351
+ ],
4352
+ "symbolId": "src/esbuild-types:CompilerOptions"
4353
+ },
4252
4354
  "@mrgrain/cdk-esbuild.EsbuildAsset": {
4253
4355
  "assembly": "@mrgrain/cdk-esbuild",
4254
4356
  "base": "aws-cdk-lib.aws_s3_assets.Asset",
@@ -4693,6 +4795,141 @@
4693
4795
  ],
4694
4796
  "symbolId": "src/code:EsbuildCode"
4695
4797
  },
4798
+ "@mrgrain/cdk-esbuild.EsbuildSource": {
4799
+ "assembly": "@mrgrain/cdk-esbuild",
4800
+ "docs": {
4801
+ "stability": "stable"
4802
+ },
4803
+ "fqn": "@mrgrain/cdk-esbuild.EsbuildSource",
4804
+ "initializer": {
4805
+ "docs": {
4806
+ "stability": "stable"
4807
+ }
4808
+ },
4809
+ "kind": "class",
4810
+ "locationInModule": {
4811
+ "filename": "src/esbuild-source.ts",
4812
+ "line": 11
4813
+ },
4814
+ "name": "EsbuildSource",
4815
+ "properties": [
4816
+ {
4817
+ "docs": {
4818
+ "stability": "stable",
4819
+ "summary": "First try to find to module, then install it to a temporary location."
4820
+ },
4821
+ "immutable": true,
4822
+ "locationInModule": {
4823
+ "filename": "src/esbuild-source.ts",
4824
+ "line": 71
4825
+ },
4826
+ "name": "auto",
4827
+ "static": true,
4828
+ "type": {
4829
+ "primitive": "string"
4830
+ }
4831
+ },
4832
+ {
4833
+ "docs": {
4834
+ "stability": "stable",
4835
+ "summary": "Install the module to a temporary location."
4836
+ },
4837
+ "immutable": true,
4838
+ "locationInModule": {
4839
+ "filename": "src/esbuild-source.ts",
4840
+ "line": 64
4841
+ },
4842
+ "name": "install",
4843
+ "static": true,
4844
+ "type": {
4845
+ "primitive": "string"
4846
+ }
4847
+ },
4848
+ {
4849
+ "docs": {
4850
+ "stability": "stable",
4851
+ "summary": "Require module by name, do not attempt to find it anywhere else."
4852
+ },
4853
+ "immutable": true,
4854
+ "locationInModule": {
4855
+ "filename": "src/esbuild-source.ts",
4856
+ "line": 57
4857
+ },
4858
+ "name": "nodeJs",
4859
+ "static": true,
4860
+ "type": {
4861
+ "primitive": "string"
4862
+ }
4863
+ },
4864
+ {
4865
+ "docs": {
4866
+ "stability": "stable",
4867
+ "summary": "`EsbuildSource.nodeJs` for NodeJs, `EsbuildSource.auto` for all other languages."
4868
+ },
4869
+ "immutable": true,
4870
+ "locationInModule": {
4871
+ "filename": "src/esbuild-source.ts",
4872
+ "line": 32
4873
+ },
4874
+ "name": "platformDefault",
4875
+ "static": true,
4876
+ "type": {
4877
+ "primitive": "string"
4878
+ }
4879
+ },
4880
+ {
4881
+ "docs": {
4882
+ "stability": "stable",
4883
+ "summary": "Try to find the module in most common paths."
4884
+ },
4885
+ "immutable": true,
4886
+ "locationInModule": {
4887
+ "filename": "src/esbuild-source.ts",
4888
+ "line": 43
4889
+ },
4890
+ "name": "anywhere",
4891
+ "optional": true,
4892
+ "static": true,
4893
+ "type": {
4894
+ "primitive": "string"
4895
+ }
4896
+ },
4897
+ {
4898
+ "docs": {
4899
+ "stability": "stable",
4900
+ "summary": "Try to find the module in common global installation paths."
4901
+ },
4902
+ "immutable": true,
4903
+ "locationInModule": {
4904
+ "filename": "src/esbuild-source.ts",
4905
+ "line": 50
4906
+ },
4907
+ "name": "globalPaths",
4908
+ "optional": true,
4909
+ "static": true,
4910
+ "type": {
4911
+ "primitive": "string"
4912
+ }
4913
+ },
4914
+ {
4915
+ "docs": {
4916
+ "stability": "stable",
4917
+ "summary": "Set the default mechanism to find the module The current default to find the module."
4918
+ },
4919
+ "locationInModule": {
4920
+ "filename": "src/esbuild-source.ts",
4921
+ "line": 18
4922
+ },
4923
+ "name": "default",
4924
+ "optional": true,
4925
+ "static": true,
4926
+ "type": {
4927
+ "primitive": "string"
4928
+ }
4929
+ }
4930
+ ],
4931
+ "symbolId": "src/esbuild-source:EsbuildSource"
4932
+ },
4696
4933
  "@mrgrain/cdk-esbuild.InlineJavaScriptCode": {
4697
4934
  "assembly": "@mrgrain/cdk-esbuild",
4698
4935
  "base": "aws-cdk-lib.aws_lambda.InlineCode",
@@ -4707,7 +4944,7 @@
4707
4944
  },
4708
4945
  "locationInModule": {
4709
4946
  "filename": "src/inline-code.ts",
4710
- "line": 146
4947
+ "line": 143
4711
4948
  },
4712
4949
  "parameters": [
4713
4950
  {
@@ -4747,7 +4984,7 @@
4747
4984
  "kind": "class",
4748
4985
  "locationInModule": {
4749
4986
  "filename": "src/inline-code.ts",
4750
- "line": 145
4987
+ "line": 142
4751
4988
  },
4752
4989
  "methods": [
4753
4990
  {
@@ -4757,7 +4994,7 @@
4757
4994
  },
4758
4995
  "locationInModule": {
4759
4996
  "filename": "src/inline-code.ts",
4760
- "line": 98
4997
+ "line": 95
4761
4998
  },
4762
4999
  "name": "bind",
4763
5000
  "overrides": "aws-cdk-lib.aws_lambda.InlineCode",
@@ -4811,7 +5048,7 @@
4811
5048
  },
4812
5049
  "locationInModule": {
4813
5050
  "filename": "src/inline-code.ts",
4814
- "line": 177
5051
+ "line": 174
4815
5052
  },
4816
5053
  "parameters": [
4817
5054
  {
@@ -4851,7 +5088,7 @@
4851
5088
  "kind": "class",
4852
5089
  "locationInModule": {
4853
5090
  "filename": "src/inline-code.ts",
4854
- "line": 176
5091
+ "line": 173
4855
5092
  },
4856
5093
  "methods": [
4857
5094
  {
@@ -4861,7 +5098,7 @@
4861
5098
  },
4862
5099
  "locationInModule": {
4863
5100
  "filename": "src/inline-code.ts",
4864
- "line": 98
5101
+ "line": 95
4865
5102
  },
4866
5103
  "name": "bind",
4867
5104
  "overrides": "aws-cdk-lib.aws_lambda.InlineCode",
@@ -4915,7 +5152,7 @@
4915
5152
  },
4916
5153
  "locationInModule": {
4917
5154
  "filename": "src/inline-code.ts",
4918
- "line": 237
5155
+ "line": 234
4919
5156
  },
4920
5157
  "parameters": [
4921
5158
  {
@@ -4955,7 +5192,7 @@
4955
5192
  "kind": "class",
4956
5193
  "locationInModule": {
4957
5194
  "filename": "src/inline-code.ts",
4958
- "line": 236
5195
+ "line": 233
4959
5196
  },
4960
5197
  "methods": [
4961
5198
  {
@@ -4965,7 +5202,7 @@
4965
5202
  },
4966
5203
  "locationInModule": {
4967
5204
  "filename": "src/inline-code.ts",
4968
- "line": 98
5205
+ "line": 95
4969
5206
  },
4970
5207
  "name": "bind",
4971
5208
  "overrides": "aws-cdk-lib.aws_lambda.InlineCode",
@@ -5019,7 +5256,7 @@
5019
5256
  },
5020
5257
  "locationInModule": {
5021
5258
  "filename": "src/inline-code.ts",
5022
- "line": 207
5259
+ "line": 204
5023
5260
  },
5024
5261
  "parameters": [
5025
5262
  {
@@ -5059,7 +5296,7 @@
5059
5296
  "kind": "class",
5060
5297
  "locationInModule": {
5061
5298
  "filename": "src/inline-code.ts",
5062
- "line": 206
5299
+ "line": 203
5063
5300
  },
5064
5301
  "methods": [
5065
5302
  {
@@ -5069,7 +5306,7 @@
5069
5306
  },
5070
5307
  "locationInModule": {
5071
5308
  "filename": "src/inline-code.ts",
5072
- "line": 98
5309
+ "line": 95
5073
5310
  },
5074
5311
  "name": "bind",
5075
5312
  "overrides": "aws-cdk-lib.aws_lambda.InlineCode",
@@ -6203,7 +6440,16 @@
6203
6440
  "name": "tsconfigRaw",
6204
6441
  "optional": true,
6205
6442
  "type": {
6206
- "primitive": "string"
6443
+ "union": {
6444
+ "types": [
6445
+ {
6446
+ "primitive": "string"
6447
+ },
6448
+ {
6449
+ "fqn": "@mrgrain/cdk-esbuild.TsconfigOptions"
6450
+ }
6451
+ ]
6452
+ }
6207
6453
  }
6208
6454
  }
6209
6455
  ],
@@ -6245,9 +6491,9 @@
6245
6491
  "abstract": true,
6246
6492
  "docs": {
6247
6493
  "default": "- `CDK_ESBUILD_MODULE_PATH` or package resolution (see above)",
6248
- "remarks": "Python, Go, .NET and Java should use an absolute path, because the jsii execution environment uses a temporary working directory.\n\nIf not set, the module path will be determined in the following order:\n\n- Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable\n- In TypeScript, fallback to the default Node.js package resolution mechanism\n- All other languages (Python, Go, .NET, Java) use an automatic \"best effort\" resolution mechanism. \\\n The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.\n If `esbuild` cannot be found, it might be installed dynamically to a temporary location.\n To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.",
6494
+ "remarks": "E.g. \"/home/user/.npm/node_modules/esbuild/lib/main.js\"\n\nIf not set, the module path will be determined in the following order:\n\n- Use a path from the `CDK_ESBUILD_MODULE_PATH` environment variable\n- In TypeScript, fallback to the default Node.js package resolution mechanism\n- All other languages (Python, Go, .NET, Java) use an automatic \"best effort\" resolution mechanism. \\\n The exact algorithm of this mechanism is considered an implementation detail and should not be relied on.\n If `esbuild` cannot be found, it might be installed dynamically to a temporary location.\n To opt-out of this behavior, set either `esbuildModulePath` or `CDK_ESBUILD_MODULE_PATH` env variable.",
6249
6495
  "stability": "experimental",
6250
- "summary": "Path used to import the esbuild module."
6496
+ "summary": "Absolute path to the esbuild module JS file."
6251
6497
  },
6252
6498
  "immutable": true,
6253
6499
  "locationInModule": {
@@ -6306,6 +6552,39 @@
6306
6552
  ],
6307
6553
  "symbolId": "src/inline-code:TransformerProps"
6308
6554
  },
6555
+ "@mrgrain/cdk-esbuild.TsconfigOptions": {
6556
+ "assembly": "@mrgrain/cdk-esbuild",
6557
+ "datatype": true,
6558
+ "docs": {
6559
+ "stability": "stable"
6560
+ },
6561
+ "fqn": "@mrgrain/cdk-esbuild.TsconfigOptions",
6562
+ "kind": "interface",
6563
+ "locationInModule": {
6564
+ "filename": "src/esbuild-types.ts",
6565
+ "line": 598
6566
+ },
6567
+ "name": "TsconfigOptions",
6568
+ "properties": [
6569
+ {
6570
+ "abstract": true,
6571
+ "docs": {
6572
+ "stability": "stable"
6573
+ },
6574
+ "immutable": true,
6575
+ "locationInModule": {
6576
+ "filename": "src/esbuild-types.ts",
6577
+ "line": 599
6578
+ },
6579
+ "name": "compilerOptions",
6580
+ "optional": true,
6581
+ "type": {
6582
+ "fqn": "@mrgrain/cdk-esbuild.CompilerOptions"
6583
+ }
6584
+ }
6585
+ ],
6586
+ "symbolId": "src/esbuild-types:TsconfigOptions"
6587
+ },
6309
6588
  "@mrgrain/cdk-esbuild.TypeScriptAsset": {
6310
6589
  "assembly": "@mrgrain/cdk-esbuild",
6311
6590
  "base": "@mrgrain/cdk-esbuild.EsbuildAsset",
@@ -6687,6 +6966,6 @@
6687
6966
  "symbolId": "src/source:TypeScriptSourceProps"
6688
6967
  }
6689
6968
  },
6690
- "version": "3.10.0",
6691
- "fingerprint": "miQlSNdmuYw/EzxqZAiWEJLGD3Wurx9S6VsqoiETQ6c="
6969
+ "version": "3.11.2",
6970
+ "fingerprint": "3FUAHt8UQLCzBOczudD3FbsRze/LzjveciB/UWgz/Ac="
6692
6971
  }
package/CHANGELOG.md CHANGED
@@ -1,4 +1,25 @@
1
1
 
2
+ ### [3.11.1](https://github.com/mrgrain/cdk-esbuild/compare/v3.11.0...v3.11.1) (2022-08-22)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * `TransformOptions.tsconfigRaw` cannot receive an object ([#230](https://github.com/mrgrain/cdk-esbuild/issues/230)) ([1584ece](https://github.com/mrgrain/cdk-esbuild/commit/1584ecedaff5251f183f08aa512151010a54df16))
8
+
9
+ ## [3.11.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.10.0...v3.11.0) (2022-08-20)
10
+
11
+
12
+ ### Features
13
+
14
+ * auto install esbuild on jsii platforms ([#226](https://github.com/mrgrain/cdk-esbuild/issues/226)) ([d97688a](https://github.com/mrgrain/cdk-esbuild/commit/d97688a32cf62212b2756b91297c27248363619c))
15
+
16
+ ## [3.10.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.9.0...v3.10.0) (2022-08-14)
17
+
18
+
19
+ ### Features
20
+
21
+ * support custom esbuild module path ([#220](https://github.com/mrgrain/cdk-esbuild/issues/220)) ([9cc071e](https://github.com/mrgrain/cdk-esbuild/commit/9cc071edbb8f173288ec4b68162b1bbd1f0e18c2))
22
+
2
23
  ## [3.9.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.8.1...v3.9.0) (2022-08-14)
3
24
 
4
25
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <picture>
2
2
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark-dark.svg">
3
3
  <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark-light.svg">
4
- <img src="https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark.svg" alt="cdk-esbuild">
4
+ <img src="https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/wordmark-dynamic.svg" alt="cdk-esbuild">
5
5
  </picture>
6
6
 
7
7
  _CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_
@@ -42,7 +42,7 @@ npm install @mrgrain/cdk-esbuild@3 esbuild
42
42
 
43
43
  ### AWS Lambda: Serverless function
44
44
 
45
- > 💡 See [Lambda Function](examples/lambda) for a complete working example of a how to deploy a lambda function.
45
+ > 💡 See [Lambda Function](examples/typescript/lambda) for a complete working example of a how to deploy a lambda function.
46
46
 
47
47
  Use `TypeScriptCode` as the `code` of a [lambda function](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html#code):
48
48
 
@@ -61,7 +61,7 @@ const fn = new lambda.Function(stack, "MyFunction", {
61
61
 
62
62
  ### AWS S3: Static Website
63
63
 
64
- > 💡 See [Static Website with React](examples/website) for a complete working example of a how to deploy a React app to S3.
64
+ > 💡 See [Static Website with React](examples/typescript/website) for a complete working example of a how to deploy a React app to S3.
65
65
 
66
66
  Use `TypeScriptSource` as one of the `sources` of a [static website deployment](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-s3-deployment-readme.html#roadmap):
67
67
 
@@ -87,7 +87,7 @@ new s3deploy.BucketDeployment(stack, "DeployWebsite", {
87
87
 
88
88
  ### Amazon CloudWatch Synthetics: Canary monitoring
89
89
 
90
- > 💡 See [Monitored Website](examples/website) for a complete working example of a deployed and monitored website.
90
+ > 💡 See [Monitored Website](examples/typescript/website) for a complete working example of a deployed and monitored website.
91
91
 
92
92
  Synthetics runs a canary to produce traffic to an application for monitoring purposes. Use `TypeScriptCode` as the `code` of a Canary test:
93
93
 
@@ -169,7 +169,7 @@ new TypeScriptCode("fixtures/handlers/ts-handler.ts", {
169
169
 
170
170
  #### Custom build function
171
171
 
172
- > 💡 See [Using esbuild with plugins](examples/esbuild-with-plugins) for a complete working example of a custom build function using this escape hatch.
172
+ > 💡 See [Using esbuild with plugins](examples/typescript/esbuild-with-plugins) for a complete working example of a custom build function using this escape hatch.
173
173
 
174
174
  Constructs that result in starting a build, take a `buildFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `buildSync` function.
175
175
 
package/lib/asset.js CHANGED
@@ -56,7 +56,7 @@ class EsbuildAsset extends aws_s3_assets_1.Asset {
56
56
  }
57
57
  exports.EsbuildAsset = EsbuildAsset;
58
58
  _a = JSII_RTTI_SYMBOL_1;
59
- EsbuildAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.EsbuildAsset", version: "3.10.0" };
59
+ EsbuildAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.EsbuildAsset", version: "3.11.2" };
60
60
  /**
61
61
  * Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
62
62
  *
@@ -68,7 +68,7 @@ class JavaScriptAsset extends EsbuildAsset {
68
68
  }
69
69
  exports.JavaScriptAsset = JavaScriptAsset;
70
70
  _b = JSII_RTTI_SYMBOL_1;
71
- JavaScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "3.10.0" };
71
+ JavaScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "3.11.2" };
72
72
  /**
73
73
  * Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
74
74
  *
@@ -80,5 +80,5 @@ class TypeScriptAsset extends EsbuildAsset {
80
80
  }
81
81
  exports.TypeScriptAsset = TypeScriptAsset;
82
82
  _c = JSII_RTTI_SYMBOL_1;
83
- TypeScriptAsset[_c] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "3.10.0" };
83
+ TypeScriptAsset[_c] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "3.11.2" };
84
84
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6W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hc3MgVHlwZVNjcmlwdEFzc2V0IGV4dGVuZHMgRXNidWlsZEFzc2V0PFR5cGVTY3JpcHRBc3NldFByb3BzPiB7fVxuIl19
package/lib/bundler.d.ts CHANGED
@@ -83,9 +83,9 @@ export interface BundlerProps {
83
83
  */
84
84
  readonly esbuildBinaryPath?: string;
85
85
  /**
86
- * Path used to import the esbuild module.
86
+ * Absolute path to the esbuild module JS file.
87
87
  *
88
- * Python, Go, .NET and Java should use an absolute path, because the jsii execution environment uses a temporary working directory.
88
+ * E.g. "/home/user/.npm/node_modules/esbuild/lib/main.js"
89
89
  *
90
90
  * If not set, the module path will be determined in the following order:
91
91
  *