@mrgrain/cdk-esbuild 2.0.0 → 2.1.0

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/.gitattributes CHANGED
@@ -1,23 +1,23 @@
1
1
  # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
2
2
 
3
- *.snap linguist-generated
4
- /.eslintrc.json linguist-generated
5
- /.gitattributes linguist-generated
6
- /.github/pull_request_template.md linguist-generated
7
- /.github/workflows/build.yml linguist-generated
8
- /.github/workflows/stale.yml linguist-generated
9
- /.github/workflows/upgrade-main.yml linguist-generated
10
- /.gitignore linguist-generated
11
- /.mergify.yml linguist-generated
12
- /.npmignore linguist-generated
13
- /.projen/** linguist-generated
14
- /.projen/deps.json linguist-generated
15
- /.projen/tasks.json linguist-generated
16
- /.vscode/extensions.json linguist-generated
17
- /.vscode/launch.json linguist-generated
18
- /.vscode/settings.json linguist-generated
19
- /LICENSE linguist-generated
20
- /package-lock.json linguist-generated
21
- /package.json linguist-generated
22
- /src/esbuild-types.ts linguist-generated
23
- /tsconfig.dev.json linguist-generated
3
+ *.snap linguist-generated
4
+ /.eslintrc.json linguist-generated
5
+ /.gitattributes linguist-generated
6
+ /.github/pull_request_template.md linguist-generated
7
+ /.github/workflows/build.yml linguist-generated
8
+ /.github/workflows/pull-request-lint.yml linguist-generated
9
+ /.github/workflows/stale.yml linguist-generated
10
+ /.gitignore linguist-generated
11
+ /.mergify.yml linguist-generated
12
+ /.npmignore linguist-generated
13
+ /.projen/** linguist-generated
14
+ /.projen/deps.json linguist-generated
15
+ /.projen/tasks.json linguist-generated
16
+ /.vscode/extensions.json linguist-generated
17
+ /.vscode/launch.json linguist-generated
18
+ /.vscode/settings.json linguist-generated
19
+ /LICENSE linguist-generated
20
+ /package-lock.json linguist-generated
21
+ /package.json linguist-generated
22
+ /src/esbuild-types.ts linguist-generated
23
+ /tsconfig.dev.json linguist-generated
package/.jsii CHANGED
@@ -44,6 +44,33 @@
44
44
  }
45
45
  }
46
46
  },
47
+ "@aws-cdk/aws-acmpca": {
48
+ "targets": {
49
+ "dotnet": {
50
+ "iconUrl": "https://raw.githubusercontent.com/aws/aws-cdk/master/logo/default-256-dark.png",
51
+ "namespace": "Amazon.CDK.AWS.ACMPCA",
52
+ "packageId": "Amazon.CDK.AWS.ACMPCA"
53
+ },
54
+ "java": {
55
+ "maven": {
56
+ "artifactId": "acmpca",
57
+ "groupId": "software.amazon.awscdk"
58
+ },
59
+ "package": "software.amazon.awscdk.services.acmpca"
60
+ },
61
+ "js": {
62
+ "npm": "@aws-cdk/aws-acmpca"
63
+ },
64
+ "python": {
65
+ "classifiers": [
66
+ "Framework :: AWS CDK",
67
+ "Framework :: AWS CDK :: 1"
68
+ ],
69
+ "distName": "aws-cdk.aws-acmpca",
70
+ "module": "aws_cdk.aws_acmpca"
71
+ }
72
+ }
73
+ },
47
74
  "@aws-cdk/aws-applicationautoscaling": {
48
75
  "targets": {
49
76
  "dotnet": {
@@ -154,12 +181,7 @@
154
181
  },
155
182
  "@aws-cdk/aws-cloudfront": {
156
183
  "submodules": {
157
- "@aws-cdk/aws-cloudfront.experimental": {
158
- "locationInModule": {
159
- "filename": "lib/index.ts",
160
- "line": 12
161
- }
162
- }
184
+ "@aws-cdk/aws-cloudfront.experimental": {}
163
185
  },
164
186
  "targets": {
165
187
  "dotnet": {
@@ -947,7 +969,7 @@
947
969
  "stability": "stable"
948
970
  },
949
971
  "homepage": "https://github.com/mrgrain/cdk-esbuild",
950
- "jsiiVersion": "1.41.0 (build a274beb)",
972
+ "jsiiVersion": "1.45.0 (build 61747b6)",
951
973
  "keywords": [
952
974
  "aws-cdk",
953
975
  "bundler",
@@ -969,7 +991,7 @@
969
991
  },
970
992
  "name": "@mrgrain/cdk-esbuild",
971
993
  "readme": {
972
- "markdown": "# cdk-esbuild\n\n_CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_\n\n[Getting started](#getting-started) | [Migrating to v2](#migrating-to-v2) |\n[Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)\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**⚠️ A note on stability**\n\nThis package is generally stable and ready to be used in production as many do. However _esbuild_ is still on major version zero, which you should consider. Please check their guide on [production readiness](https://esbuild.github.io/faq/#production-readiness).\n\nNotably upgrades of the _esbuild_ 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\n```\n\nIf _peer_ and _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 esbuild @aws-cdk/core @aws-cdk/aws-lambda @aws-cdk/aws-s3-assets @aws-cdk/aws-s3-deployment @aws-cdk/aws-synthetics\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/latest/docs/@aws-cdk_aws-lambda.Function.html#code):\n\n```ts\nimport * as lambda from \"@aws-cdk/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_14_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/aws-s3\";\nimport * as s3deploy from \"@aws-cdk/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```ts\nimport * as synthetics from \"@aws-cdk/aws-synthetics\";\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/latest/docs/@aws-cdk_aws-lambda.Code.html)) and `synthetics.Code` ([reference](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-synthetics.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 plugin to high-level CDK features. They share the same set of parameters, props and build options._\n\nUnderlying 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/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_core.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 within the code completion of your IDE.\n\n## Migrating to v2\n\nThe main changes in cdk-esbuild v2 are:\n\n- The package is now `jsii` compliant and published in the [Construct Hub](https://constructs.dev/). This will also enable a possible feature release for other languages.\n- Deprecated properties and classes have been removed, most notably the previous support for bundling via a Docker container. The implementation had a few issues that cannot be easily resolved. However more generic support for custom executables might arrive in later versions.\n- `esbuild` is now installed as an optional dependency. It's not optional at all, but this is a ramification of using `jsii`. In practice this will have no impact on most people.\n- Interfaces have been streamlined and the names and setup of internal types have been changed. In the unlikely case that someone was relying on these, upgrading will be straight forward.\n\n### Upgrading\n\n- Update the package dependency to v2: `npm install --save @mrgrain/cdk-esbuild@^2.0.0`\n- `esbuild` is now installed as an optional dependency. If your setup does not automatically install optional dependencies, add it as an explicit dependency.\n- Remove any use of `bundlerPriority`.\n- Unstable construct `EsbuildBundling` has been renamed to `EsbuildBundler` and its interface has slightly changed. Like most other constructs, it now takes `entryPoints` as first parameter, with an optional `props` object as the second.\n\n## Versioning\n\nThis package _mostly_ 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\nAlthough great care is taken to avoid this, all features marked as `@unstable` may change with minor versions. Please note that the unstable flag is applied to all new or experimental features and internal classes.\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## Future releases\n\n### AWS CDK v2\n\nThe monolithic version 2 of CDK (aka Mono-CDK) is on the horizon. A new major release of this package will be marked alongside CDK. Support for AWS CDK v1.x.x will be continued, however no new features will be added.\n\n### Stable esbuild\n\nOnce `esbuild` has reached a stable version 1.0, a new major version will be released for _all_ breaking changes, including updates to minimum (peer) dependencies.\n\n## Library authors\n\nWhen developing a library consumed by other packages, you'll most likely have to set `buildOptions.absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the 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"
994
+ "markdown": "# cdk-esbuild\n\n_CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_\n\n[Getting started](#getting-started) | [Migrating to v2](#migrating-to-v2) |\n[Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)\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 generally stable and ready to be used in production, as many do. However _esbuild_ not yet released a version 1.0.0 yet and its API is still in active development. Please check their guide on [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\n```\n\nIf _peer_ and _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 esbuild @aws-cdk/core @aws-cdk/aws-lambda @aws-cdk/aws-s3-assets @aws-cdk/aws-s3-deployment @aws-cdk/aws-synthetics\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/latest/docs/@aws-cdk_aws-lambda.Function.html#code):\n\n```ts\nimport * as lambda from \"@aws-cdk/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_14_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/aws-s3\";\nimport * as s3deploy from \"@aws-cdk/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```ts\nimport * as synthetics from \"@aws-cdk/aws-synthetics\";\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/latest/docs/@aws-cdk_aws-lambda.Code.html)) and `synthetics.Code` ([reference](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-synthetics.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 plugin to high-level CDK features. They share the same set of parameters, props and build options._\n\nUnderlying 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/latest/docs/@aws-cdk_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/latest/docs/@aws-cdk_core.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 within the code completion of your IDE.\n\n## Escape hatches\n\nIt's possible that you want to use a 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 version of esbuild that is installed by any other means than `npm`, including Docker\n- Plugin support is needed for the 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### Custom build function\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## Migrating to v2\n\nThe main changes in cdk-esbuild v2 are:\n\n- The package is now `jsii` compliant and published in the [Construct Hub](https://constructs.dev/). This will also enable a possible feature release for other languages.\n- Deprecated properties and classes have been removed, most notably the previous support for bundling via a Docker container. The implementation had a few issues that cannot be easily resolved. However more generic support for custom executables might arrive in later versions.\n- `esbuild` is now installed as an optional dependency. It's not optional at all, but this is a ramification of using `jsii`. In practice this will have no impact on most people.\n- Interfaces have been streamlined and the names and setup of internal types have been changed. In the unlikely case that someone was relying on these, upgrading will be straight forward.\n\n### Upgrading\n\n- Update the package dependency to v2: `npm install --save @mrgrain/cdk-esbuild@^2.0.0`\n- `esbuild` is now installed as an optional dependency. If your setup does not automatically install optional dependencies, add it as an explicit dependency.\n- Remove any use of `bundlerPriority`.\n- Experimental construct `EsbuildBundling` has been renamed to `EsbuildBundler` and its interface has slightly changed. Like most other constructs, it now takes `entryPoints` as first parameter, with an optional `props` object as the second.\n\n## Versioning\n\nThis package _mostly_ 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\nAlthough great care is taken to avoid this, all features marked with `@stability experimental` may change with minor versions. The flag is only applied to new and experimental features and internal classes.\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## Future releases\n\n### AWS CDK v2\n\nThe monolithic version 2 of CDK (aka Mono-CDK) is on the horizon. A new major release of this package will be marked alongside CDK. Support for AWS CDK v1.x.x will be continued, however no new features will be added.\n\n### Stable esbuild\n\nOnce `esbuild` has reached a stable version 1.0, a new major version will be released for _all_ breaking changes, including updates to minimum (peer) dependencies.\n\n## Library authors\n\nWhen developing a library consumed by other packages, you'll most likely have to set `buildOptions.absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the 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"
973
995
  },
974
996
  "repository": {
975
997
  "type": "git",
@@ -2023,6 +2045,30 @@
2023
2045
  },
2024
2046
  "name": "BundlerProps",
2025
2047
  "properties": [
2048
+ {
2049
+ "abstract": true,
2050
+ "docs": {
2051
+ "custom": {
2052
+ "throws": "esbuild.BuildFailure",
2053
+ "type": "esbuild.buildSync"
2054
+ },
2055
+ "default": "esbuild.buildSync",
2056
+ "remarks": "The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.\nMust throw a `BuildFailure` on failure to correctly inform the bundler.",
2057
+ "returns": "esbuild.BuildResult",
2058
+ "stability": "experimental",
2059
+ "summary": "Escape hatch to provide the bundler with a custom build function."
2060
+ },
2061
+ "immutable": true,
2062
+ "locationInModule": {
2063
+ "filename": "src/bundler.ts",
2064
+ "line": 63
2065
+ },
2066
+ "name": "buildFn",
2067
+ "optional": true,
2068
+ "type": {
2069
+ "primitive": "any"
2070
+ }
2071
+ },
2026
2072
  {
2027
2073
  "abstract": true,
2028
2074
  "docs": {
@@ -2110,7 +2156,7 @@
2110
2156
  },
2111
2157
  "locationInModule": {
2112
2158
  "filename": "src/bundler.ts",
2113
- "line": 76
2159
+ "line": 90
2114
2160
  },
2115
2161
  "parameters": [
2116
2162
  {
@@ -2161,7 +2207,7 @@
2161
2207
  "kind": "class",
2162
2208
  "locationInModule": {
2163
2209
  "filename": "src/bundler.ts",
2164
- "line": 58
2210
+ "line": 72
2165
2211
  },
2166
2212
  "name": "EsbuildBundler",
2167
2213
  "properties": [
@@ -2174,7 +2220,7 @@
2174
2220
  "immutable": true,
2175
2221
  "locationInModule": {
2176
2222
  "filename": "src/bundler.ts",
2177
- "line": 83
2223
+ "line": 97
2178
2224
  },
2179
2225
  "name": "entryPoints",
2180
2226
  "type": {
@@ -2211,7 +2257,7 @@
2211
2257
  "immutable": true,
2212
2258
  "locationInModule": {
2213
2259
  "filename": "src/bundler.ts",
2214
- "line": 71
2260
+ "line": 85
2215
2261
  },
2216
2262
  "name": "image",
2217
2263
  "type": {
@@ -2226,7 +2272,7 @@
2226
2272
  "immutable": true,
2227
2273
  "locationInModule": {
2228
2274
  "filename": "src/bundler.ts",
2229
- "line": 64
2275
+ "line": 78
2230
2276
  },
2231
2277
  "name": "local",
2232
2278
  "type": {
@@ -2241,7 +2287,7 @@
2241
2287
  "immutable": true,
2242
2288
  "locationInModule": {
2243
2289
  "filename": "src/bundler.ts",
2244
- "line": 90
2290
+ "line": 104
2245
2291
  },
2246
2292
  "name": "props",
2247
2293
  "type": {
@@ -2265,7 +2311,7 @@
2265
2311
  },
2266
2312
  "locationInModule": {
2267
2313
  "filename": "src/inline-code.ts",
2268
- "line": 34
2314
+ "line": 84
2269
2315
  },
2270
2316
  "parameters": [
2271
2317
  {
@@ -2280,15 +2326,24 @@
2280
2326
  },
2281
2327
  {
2282
2328
  "docs": {
2283
- "remarks": "Please refer to the esbuild Transform API docs for details. \\\nDefault values for `transformOptions`:\n- `loader='js'`",
2329
+ "remarks": "Props to change the behaviour of the transformer.\n\nDefault values for `props.transformOptions`:\n- `loader='js'`",
2284
2330
  "see": "https://esbuild.github.io/api/#transform-api",
2285
2331
  "stability": "experimental",
2286
- "summary": "Transform options passed on to esbuild."
2332
+ "summary": "Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!"
2287
2333
  },
2288
- "name": "transformOptions",
2334
+ "name": "props",
2289
2335
  "optional": true,
2290
2336
  "type": {
2291
- "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2337
+ "union": {
2338
+ "types": [
2339
+ {
2340
+ "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2341
+ },
2342
+ {
2343
+ "fqn": "@mrgrain/cdk-esbuild.TransformerProps"
2344
+ }
2345
+ ]
2346
+ }
2292
2347
  }
2293
2348
  }
2294
2349
  ]
@@ -2296,7 +2351,7 @@
2296
2351
  "kind": "class",
2297
2352
  "locationInModule": {
2298
2353
  "filename": "src/inline-code.ts",
2299
- "line": 33
2354
+ "line": 83
2300
2355
  },
2301
2356
  "name": "InlineJavaScriptCode",
2302
2357
  "symbolId": "src/inline-code:InlineJavaScriptCode"
@@ -2315,7 +2370,7 @@
2315
2370
  },
2316
2371
  "locationInModule": {
2317
2372
  "filename": "src/inline-code.ts",
2318
- "line": 63
2373
+ "line": 115
2319
2374
  },
2320
2375
  "parameters": [
2321
2376
  {
@@ -2330,15 +2385,24 @@
2330
2385
  },
2331
2386
  {
2332
2387
  "docs": {
2333
- "remarks": "Please refer to the esbuild Transform API docs for details. \\\nDefault values for `transformOptions`:\n- `loader='jsx'`",
2388
+ "remarks": "Props to change the behaviour of the transformer.\n\nDefault values for `transformOptions`:\n- `loader='jsx'`",
2334
2389
  "see": "https://esbuild.github.io/api/#transform-api",
2335
2390
  "stability": "experimental",
2336
- "summary": "Transform options passed on to esbuild."
2391
+ "summary": "Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!"
2337
2392
  },
2338
- "name": "transformOptions",
2393
+ "name": "props",
2339
2394
  "optional": true,
2340
2395
  "type": {
2341
- "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2396
+ "union": {
2397
+ "types": [
2398
+ {
2399
+ "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2400
+ },
2401
+ {
2402
+ "fqn": "@mrgrain/cdk-esbuild.TransformerProps"
2403
+ }
2404
+ ]
2405
+ }
2342
2406
  }
2343
2407
  }
2344
2408
  ]
@@ -2346,7 +2410,7 @@
2346
2410
  "kind": "class",
2347
2411
  "locationInModule": {
2348
2412
  "filename": "src/inline-code.ts",
2349
- "line": 62
2413
+ "line": 114
2350
2414
  },
2351
2415
  "name": "InlineJsxCode",
2352
2416
  "symbolId": "src/inline-code:InlineJsxCode"
@@ -2365,7 +2429,7 @@
2365
2429
  },
2366
2430
  "locationInModule": {
2367
2431
  "filename": "src/inline-code.ts",
2368
- "line": 121
2432
+ "line": 175
2369
2433
  },
2370
2434
  "parameters": [
2371
2435
  {
@@ -2380,15 +2444,24 @@
2380
2444
  },
2381
2445
  {
2382
2446
  "docs": {
2383
- "remarks": "Please refer to the esbuild Transform API docs for details. \\\nDefault values for `transformOptions`:\n- `loader='tsx'`",
2447
+ "remarks": "Props to change the behaviour of the transformer.\n\nDefault values for `transformOptions`:\n- `loader='tsx'`",
2384
2448
  "see": "https://esbuild.github.io/api/#transform-api",
2385
2449
  "stability": "experimental",
2386
- "summary": "Transform options passed on to esbuild."
2450
+ "summary": "Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!"
2387
2451
  },
2388
- "name": "transformOptions",
2452
+ "name": "props",
2389
2453
  "optional": true,
2390
2454
  "type": {
2391
- "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2455
+ "union": {
2456
+ "types": [
2457
+ {
2458
+ "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2459
+ },
2460
+ {
2461
+ "fqn": "@mrgrain/cdk-esbuild.TransformerProps"
2462
+ }
2463
+ ]
2464
+ }
2392
2465
  }
2393
2466
  }
2394
2467
  ]
@@ -2396,7 +2469,7 @@
2396
2469
  "kind": "class",
2397
2470
  "locationInModule": {
2398
2471
  "filename": "src/inline-code.ts",
2399
- "line": 120
2472
+ "line": 174
2400
2473
  },
2401
2474
  "name": "InlineTsxCode",
2402
2475
  "symbolId": "src/inline-code:InlineTsxCode"
@@ -2415,7 +2488,7 @@
2415
2488
  },
2416
2489
  "locationInModule": {
2417
2490
  "filename": "src/inline-code.ts",
2418
- "line": 92
2491
+ "line": 145
2419
2492
  },
2420
2493
  "parameters": [
2421
2494
  {
@@ -2430,15 +2503,24 @@
2430
2503
  },
2431
2504
  {
2432
2505
  "docs": {
2433
- "remarks": "Please refer to the esbuild Transform API docs for details. \\\nDefault values for `transformOptions`:\n- `loader='ts'`",
2506
+ "remarks": "Props to change the behaviour of the transformer.\n\nDefault values for `transformOptions`:\n- `loader='ts'`",
2434
2507
  "see": "https://esbuild.github.io/api/#transform-api",
2435
2508
  "stability": "experimental",
2436
- "summary": "Transform options passed on to esbuild."
2509
+ "summary": "Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!"
2437
2510
  },
2438
- "name": "transformOptions",
2511
+ "name": "props",
2439
2512
  "optional": true,
2440
2513
  "type": {
2441
- "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2514
+ "union": {
2515
+ "types": [
2516
+ {
2517
+ "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
2518
+ },
2519
+ {
2520
+ "fqn": "@mrgrain/cdk-esbuild.TransformerProps"
2521
+ }
2522
+ ]
2523
+ }
2442
2524
  }
2443
2525
  }
2444
2526
  ]
@@ -2446,7 +2528,7 @@
2446
2528
  "kind": "class",
2447
2529
  "locationInModule": {
2448
2530
  "filename": "src/inline-code.ts",
2449
- "line": 91
2531
+ "line": 144
2450
2532
  },
2451
2533
  "name": "InlineTypeScriptCode",
2452
2534
  "symbolId": "src/inline-code:InlineTypeScriptCode"
@@ -2491,7 +2573,7 @@
2491
2573
  "kind": "class",
2492
2574
  "locationInModule": {
2493
2575
  "filename": "src/asset.ts",
2494
- "line": 94
2576
+ "line": 96
2495
2577
  },
2496
2578
  "name": "JavaScriptAsset",
2497
2579
  "symbolId": "src/asset:JavaScriptAsset"
@@ -3434,6 +3516,66 @@
3434
3516
  ],
3435
3517
  "symbolId": "src/esbuild-types:TransformOptions"
3436
3518
  },
3519
+ "@mrgrain/cdk-esbuild.TransformerProps": {
3520
+ "assembly": "@mrgrain/cdk-esbuild",
3521
+ "datatype": true,
3522
+ "docs": {
3523
+ "stability": "experimental"
3524
+ },
3525
+ "fqn": "@mrgrain/cdk-esbuild.TransformerProps",
3526
+ "kind": "interface",
3527
+ "locationInModule": {
3528
+ "filename": "src/inline-code.ts",
3529
+ "line": 9
3530
+ },
3531
+ "name": "TransformerProps",
3532
+ "properties": [
3533
+ {
3534
+ "abstract": true,
3535
+ "docs": {
3536
+ "custom": {
3537
+ "throws": "esbuild.TransformFailure",
3538
+ "type": "esbuild.transformSync"
3539
+ },
3540
+ "default": "esbuild.transformSync",
3541
+ "remarks": "The function will receive the computed options from the bundler. It can use with these options as it wishes, however a TransformResult must be returned to integrate with CDK.\nMust throw a `TransformFailure` on failure to correctly inform the bundler.",
3542
+ "returns": "esbuild.TransformResult",
3543
+ "stability": "experimental",
3544
+ "summary": "Escape hatch to provide the bundler with a custom transform function."
3545
+ },
3546
+ "immutable": true,
3547
+ "locationInModule": {
3548
+ "filename": "src/inline-code.ts",
3549
+ "line": 29
3550
+ },
3551
+ "name": "transformFn",
3552
+ "optional": true,
3553
+ "type": {
3554
+ "primitive": "any"
3555
+ }
3556
+ },
3557
+ {
3558
+ "abstract": true,
3559
+ "docs": {
3560
+ "remarks": "Please refer to the esbuild Transform API docs for details.",
3561
+ "see": "https://esbuild.github.io/api/#transform-api",
3562
+ "stability": "stable",
3563
+ "summary": "Transform options passed on to esbuild."
3564
+ },
3565
+ "immutable": true,
3566
+ "locationInModule": {
3567
+ "filename": "src/inline-code.ts",
3568
+ "line": 16
3569
+ },
3570
+ "name": "transformOptions",
3571
+ "optional": true,
3572
+ "type": {
3573
+ "fqn": "@mrgrain/cdk-esbuild.TransformOptions"
3574
+ }
3575
+ }
3576
+ ],
3577
+ "symbolId": "src/inline-code:TransformerProps"
3578
+ },
3437
3579
  "@mrgrain/cdk-esbuild.TypeScriptAsset": {
3438
3580
  "assembly": "@mrgrain/cdk-esbuild",
3439
3581
  "docs": {
@@ -3474,7 +3616,7 @@
3474
3616
  "kind": "class",
3475
3617
  "locationInModule": {
3476
3618
  "filename": "src/asset.ts",
3477
- "line": 103
3619
+ "line": 105
3478
3620
  },
3479
3621
  "name": "TypeScriptAsset",
3480
3622
  "symbolId": "src/asset:TypeScriptAsset"
@@ -3897,6 +4039,6 @@
3897
4039
  "symbolId": "src/source:TypeScriptSourceProps"
3898
4040
  }
3899
4041
  },
3900
- "version": "2.0.0",
3901
- "fingerprint": "qYFeZI9jIpUpewjohRM1j7JDViBQkFa/+IEAbJfMxcM="
4042
+ "version": "2.1.0",
4043
+ "fingerprint": "iV/SCNYR0a26MqdqlTBpTB0j5TLb4ZU62TMY2r6v+WQ="
3902
4044
  }
package/.projenrc.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  AwsCdkConstructLibrary,
3
+ IgnoreFile,
3
4
  JsonFile,
4
5
  NodePackageManager,
5
6
  release,
@@ -17,6 +18,9 @@ const project = new AwsCdkConstructLibrary({
17
18
  lintProjenRc: false,
18
19
  dirs: ['src', 'projenrc', '.projenrc.ts'],
19
20
  },
21
+ depsUpgradeOptions: {
22
+ workflow: false,
23
+ },
20
24
 
21
25
  // Project info
22
26
  name: '@mrgrain/cdk-esbuild',
@@ -42,6 +46,15 @@ const project = new AwsCdkConstructLibrary({
42
46
  license: 'MIT',
43
47
  copyrightOwner: 'Moritz Kornher',
44
48
 
49
+ // Testing & Linting
50
+ githubOptions: {
51
+ pullRequestLintOptions: {
52
+ semanticTitleOptions: {
53
+ types: ['feat', 'fix', 'chore', 'docs', 'ci'],
54
+ },
55
+ },
56
+ },
57
+
45
58
  // Release
46
59
  packageManager: NodePackageManager.NPM,
47
60
  npmDistTag: 'latest',
@@ -114,11 +127,16 @@ eslintRc?.addOverride('ignorePatterns', [
114
127
  '*.js',
115
128
  '*.d.ts',
116
129
  'node_modules/',
130
+ 'examples/',
117
131
  '*.generated.ts',
118
132
  'coverage',
119
133
  '!.projenrc.ts',
120
134
  ]);
121
135
 
136
+ (project.tryFindFile('.gitignore') as IgnoreFile).addPatterns(
137
+ '!/examples/**',
138
+ );
139
+
122
140
  new JsonFile(project, '.vscode/extensions.json', {
123
141
  readonly: false,
124
142
  marker: false,