@mrgrain/cdk-esbuild 2.0.0-alpha.4 → 2.0.0-alpha.5
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 +298 -139
- package/API.md +241 -105
- package/CHANGELOG.md +7 -0
- package/README.md +46 -5
- package/SECURITY.md +5 -5
- package/lib/asset.d.ts +21 -8
- package/lib/asset.js +17 -6
- package/lib/bundler.d.ts +52 -11
- package/lib/bundler.js +20 -6
- package/lib/code.d.ts +58 -5
- package/lib/code.js +57 -6
- package/lib/inline-code.d.ts +88 -4
- package/lib/inline-code.js +93 -9
- package/lib/source.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
|
|
2
|
+
## [2.0.0-alpha.4](https://github.com/mrgrain/cdk-esbuild/compare/v2.0.0-alpha.2...v2.0.0-alpha.4) (2021-10-22)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* synthesize esbuild types from source ([#117](https://github.com/mrgrain/cdk-esbuild/issues/117)) ([af44d55](https://github.com/mrgrain/cdk-esbuild/commit/af44d55e97db6fd8fbda916eb0f25dae55513cba))
|
|
8
|
+
|
|
2
9
|
## [2.0.0-alpha.2](https://github.com/mrgrain/cdk-esbuild/compare/v1.128.0...v2.0.0-alpha.2) (2021-10-17)
|
|
3
10
|
|
|
4
11
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
_CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_
|
|
4
4
|
|
|
5
|
-
[Getting started](#getting-started) | [
|
|
5
|
+
[Getting started](#getting-started) | [Migrating to v2](#migrating-to-v2) |
|
|
6
6
|
[Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)
|
|
7
7
|
|
|
8
8
|
## Why?
|
|
@@ -14,9 +14,9 @@ AWS CDK [supports _esbuild_ with Lambda Functions](https://docs.aws.amazon.com/c
|
|
|
14
14
|
|
|
15
15
|
This 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.
|
|
16
16
|
|
|
17
|
-
**⚠️
|
|
17
|
+
**⚠️ A note on stability**
|
|
18
18
|
|
|
19
|
-
This package is generally stable. 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).
|
|
19
|
+
This 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).
|
|
20
20
|
|
|
21
21
|
Notably upgrades of the _esbuild_ version requirement will be introduced in **minor versions** of this package and will inherit breaking changes from _esbuild_.
|
|
22
22
|
|
|
@@ -135,9 +135,21 @@ Underlying classes power the other features. You normally won't have to use them
|
|
|
135
135
|
|
|
136
136
|
Auto-generated reference for classes and structs. This information is also available within the code completion of your IDE.
|
|
137
137
|
|
|
138
|
-
##
|
|
138
|
+
## Migrating to v2
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
The main changes in cdk-esbuild v2 are:
|
|
141
|
+
|
|
142
|
+
- 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.
|
|
143
|
+
- 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.
|
|
144
|
+
- `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.
|
|
145
|
+
- 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.
|
|
146
|
+
|
|
147
|
+
### Upgrading
|
|
148
|
+
|
|
149
|
+
- Update the package dependency to v2: `npm install --save @mrgrain/cdk-esbuild@^2.0.0`
|
|
150
|
+
- `esbuild` is now installed as an optional dependency. If your setup does not automatically install optional dependencies, add it as an explicit dependency.
|
|
151
|
+
- Remove any use of `bundlerPriority`.
|
|
152
|
+
- 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.
|
|
141
153
|
|
|
142
154
|
## Versioning
|
|
143
155
|
|
|
@@ -145,6 +157,20 @@ This package _mostly_ follows [Semantic Versioning](https://semver.org/), with t
|
|
|
145
157
|
|
|
146
158
|
Although 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.
|
|
147
159
|
|
|
160
|
+
### Npm Tags
|
|
161
|
+
|
|
162
|
+
Some users prefer to use tags over version ranges. The following stable tags are available for use:
|
|
163
|
+
|
|
164
|
+
- `cdk-v1`, `cdk-v2` are provided for the latest release compatible with each version of the AWS CDK.
|
|
165
|
+
|
|
166
|
+
- `latest` is the most recent stable release.
|
|
167
|
+
|
|
168
|
+
These tags also exist, but usage is strongly not recommended:
|
|
169
|
+
|
|
170
|
+
- `unstable`, `next` are used for pre-release of the current and next major version respectively.
|
|
171
|
+
|
|
172
|
+
- ~~`cdk-1.x.x`~~ tags have been deprecated in favour of `cdk-v1`. Use that one instead.
|
|
173
|
+
|
|
148
174
|
## Future releases
|
|
149
175
|
|
|
150
176
|
### AWS CDK v2
|
|
@@ -154,3 +180,18 @@ The monolithic version 2 of CDK (aka Mono-CDK) is on the horizon. A new major re
|
|
|
154
180
|
### Stable esbuild
|
|
155
181
|
|
|
156
182
|
Once `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.
|
|
183
|
+
|
|
184
|
+
## Library authors
|
|
185
|
+
|
|
186
|
+
When 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):
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
// file: project/src/index.ts
|
|
190
|
+
const props = {
|
|
191
|
+
buildOptions: {
|
|
192
|
+
absWorkingDir: path.resolve(__dirname, ".."), // now: /user/project
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
This will dynamically resolve to the correct path, wherever the package is installed.
|
package/SECURITY.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Supported Versions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
currently being supported with security updates.
|
|
5
|
+
Only the latest release of each major version is supported.
|
|
7
6
|
|
|
8
|
-
| Plugin Version | CDK Version | Supported
|
|
9
|
-
| -------------- | ----------- |
|
|
10
|
-
|
|
|
7
|
+
| Plugin Version | CDK Version | Supported |
|
|
8
|
+
| -------------- | ----------- | --------------------------- |
|
|
9
|
+
| v1 | ^1.99.0 | until release of AWS CDK v2 |
|
|
10
|
+
| v2 | ^1.99.0 | :white_check_mark: |
|
|
11
11
|
|
|
12
12
|
## Reporting a Vulnerability
|
|
13
13
|
|
package/lib/asset.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { Asset as S3Asset } from '@aws-cdk/aws-s3-assets';
|
|
|
2
2
|
import { Construct } from '@aws-cdk/core';
|
|
3
3
|
import { BundlerProps, EntryPoints } from './bundler';
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
5
|
+
* @internal
|
|
6
6
|
*/
|
|
7
7
|
export interface AssetBaseProps extends BundlerProps {
|
|
8
8
|
/**
|
|
9
9
|
* A hash of this asset, which is available at construction time.
|
|
10
10
|
*
|
|
11
|
-
* As this is a plain string, it
|
|
12
|
-
*
|
|
13
|
-
* hash
|
|
11
|
+
* As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to a hash of all files in the resulting bundle.
|
|
14
14
|
*
|
|
15
15
|
* @stability stable
|
|
16
16
|
*/
|
|
@@ -21,7 +21,9 @@ export interface AssetBaseProps extends BundlerProps {
|
|
|
21
21
|
*/
|
|
22
22
|
export interface AssetProps extends AssetBaseProps {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
25
|
+
*
|
|
26
|
+
* E.g. `src/index.ts`.
|
|
25
27
|
*
|
|
26
28
|
* @stability stable
|
|
27
29
|
*/
|
|
@@ -29,19 +31,30 @@ export interface AssetProps extends AssetBaseProps {
|
|
|
29
31
|
}
|
|
30
32
|
declare type JavaScriptAssetProps = AssetProps;
|
|
31
33
|
declare type TypeScriptAssetProps = AssetProps;
|
|
34
|
+
/**
|
|
35
|
+
* @stability stable
|
|
36
|
+
*/
|
|
32
37
|
declare abstract class Asset<Props extends AssetProps> extends S3Asset {
|
|
33
38
|
/**
|
|
34
|
-
* @
|
|
39
|
+
* @stability stable
|
|
35
40
|
*/
|
|
36
41
|
constructor(scope: Construct, id: string, props: Props);
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
|
-
*
|
|
44
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
45
|
+
*
|
|
46
|
+
* The asset can be used by other constructs.
|
|
47
|
+
*
|
|
48
|
+
* @stability stable
|
|
40
49
|
*/
|
|
41
50
|
export declare class JavaScriptAsset extends Asset<JavaScriptAssetProps> {
|
|
42
51
|
}
|
|
43
52
|
/**
|
|
44
|
-
*
|
|
53
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
54
|
+
*
|
|
55
|
+
* The asset can be used by other constructs.
|
|
56
|
+
*
|
|
57
|
+
* @stability stable
|
|
45
58
|
*/
|
|
46
59
|
export declare class TypeScriptAsset extends Asset<TypeScriptAssetProps> {
|
|
47
60
|
}
|
package/lib/asset.js
CHANGED
|
@@ -7,9 +7,12 @@ const path_1 = require("path");
|
|
|
7
7
|
const aws_s3_assets_1 = require("@aws-cdk/aws-s3-assets");
|
|
8
8
|
const core_1 = require("@aws-cdk/core");
|
|
9
9
|
const bundler_1 = require("./bundler");
|
|
10
|
+
/**
|
|
11
|
+
* @stability stable
|
|
12
|
+
*/
|
|
10
13
|
class Asset extends aws_s3_assets_1.Asset {
|
|
11
14
|
/**
|
|
12
|
-
* @
|
|
15
|
+
* @stability stable
|
|
13
16
|
*/
|
|
14
17
|
constructor(scope, id, props) {
|
|
15
18
|
var _c;
|
|
@@ -39,19 +42,27 @@ class Asset extends aws_s3_assets_1.Asset {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
|
-
*
|
|
45
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
46
|
+
*
|
|
47
|
+
* The asset can be used by other constructs.
|
|
48
|
+
*
|
|
49
|
+
* @stability stable
|
|
43
50
|
*/
|
|
44
51
|
class JavaScriptAsset extends Asset {
|
|
45
52
|
}
|
|
46
53
|
exports.JavaScriptAsset = JavaScriptAsset;
|
|
47
54
|
_a = JSII_RTTI_SYMBOL_1;
|
|
48
|
-
JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "2.0.0-alpha.
|
|
55
|
+
JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "2.0.0-alpha.5" };
|
|
49
56
|
/**
|
|
50
|
-
*
|
|
57
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
58
|
+
*
|
|
59
|
+
* The asset can be used by other constructs.
|
|
60
|
+
*
|
|
61
|
+
* @stability stable
|
|
51
62
|
*/
|
|
52
63
|
class TypeScriptAsset extends Asset {
|
|
53
64
|
}
|
|
54
65
|
exports.TypeScriptAsset = TypeScriptAsset;
|
|
55
66
|
_b = JSII_RTTI_SYMBOL_1;
|
|
56
|
-
TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "2.0.0-alpha.
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "2.0.0-alpha.5" };
|
|
68
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXNzZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwrQkFBa0M7QUFDbEMsMERBQTBEO0FBQzFELHdDQUF3RTtBQUN4RSx1Q0FBc0U7QUFrQnRFOztHQUVHO0FBQ0gsTUFBZSxLQUFnQyxTQUFRLHFCQUFPOzs7O0lBRTVELFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLEtBQVk7O1FBRVosTUFBTSxFQUNKLFNBQVMsRUFDVCxPQUFPLEVBQ1AsWUFBWSxFQUFFLE9BQU8sR0FBRyxFQUFFLEdBQzNCLEdBQUcsS0FBSyxDQUFDO1FBQ1YsTUFBTSxXQUFXLEdBQ2YsT0FBTyxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUM7UUFFbEYsTUFBTSxJQUFJLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQyxJQUFJLEdBQUcsb0JBQWEsQ0FBQyxRQUFRLEdBQUcsRUFBRSxDQUFDO1FBRTNELE1BQU0sQ0FBQyxNQUFNLENBQUMsV0FBVyxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsVUFBa0IsRUFBRSxFQUFFO1lBQ3hELElBQUksaUJBQVUsQ0FBQyxVQUFVLENBQUMsRUFBRTtnQkFDMUIsTUFBTSxJQUFJLEtBQUssQ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LCBFbnRyeVBvaW50cyB9IGZyb20gJy4vYnVuZGxlcic7XG5cbi8qKlxuICogQGludGVybmFsXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgQXNzZXRCYXNlUHJvcHMgZXh0ZW5kcyBCdW5kbGVyUHJvcHMge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICByZWFkb25seSBhc3NldEhhc2g/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQXNzZXRQcm9wcyBleHRlbmRzIEFzc2V0QmFzZVByb3BzIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICByZWFkb25seSBlbnRyeVBvaW50czogRW50cnlQb2ludHM7XG59XG5cbnR5cGUgSmF2YVNjcmlwdEFzc2V0UHJvcHMgPSBBc3NldFByb3BzO1xudHlwZSBUeXBlU2NyaXB0QXNzZXRQcm9wcyA9IEFzc2V0UHJvcHM7XG5cbi8qKlxuICogQHN0YWJpbGl0eSBzdGFibGVcbiAqL1xuYWJzdHJhY3QgY2xhc3MgQXNzZXQ8UHJvcHMgZXh0ZW5kcyBBc3NldFByb3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HJvY2Vzcy5jd2QoKTtcblxuICAgIGNvbnN0IGJ1aWxkT3B0aW9ucyA9IHtcbiAgICAgIGJ1bmRsZTogdHJ1ZSxcbiAgICAgIC4uLm9wdGlvbnMsXG4gICAgICBhYnNXb3JraW5nRGlyLFxuICAgIH07XG5cbiAgICBzdXBlcihzY29wZSwgaWQsIHtcbiAgICAgIHBhdGg6IGFic1dvcmtpbmdEaXIsXG4gICAgICBhc3NldEhhc2gsXG4gICAgICBhc3NldEhhc2hUeXBlOiBhc3NldEhhc2ggPyBBc3NldEhhc2hUeXBlLkNVU1RPTSA6IEFzc2V0SGFzaFR5cGUuT1VUUFVULFxuICAgICAgYnVuZGxpbmc6IG5ldyBFc2J1aWxkQnVuZGxlcihcbiAgICAgICAgZW50cnlQb2ludHMsXG4gICAgICAgIHtcbiAgICAgICAgICBidWlsZE9wdGlvbnMsXG4gICAgICAgICAgY29weURpcixcbiAgICAgICAgfSxcbiAgICAgICksXG4gICAgfSk7XG4gIH1cbn1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbmV4cG9ydCBjbGFzcyBKYXZhU2NyaXB0QXNzZXQgZXh0ZW5kcyBBc3NldDxKYXZhU2NyaXB0QXNzZXRQcm9wcz4ge31cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbmV4cG9ydCBjbGFzcyBUeXBlU2NyaXB0QXNzZXQgZXh0ZW5kcyBBc3NldDxUeXBlU2NyaXB0QXNzZXRQcm9wcz4ge31cbiJdfQ==
|
package/lib/bundler.d.ts
CHANGED
|
@@ -1,51 +1,92 @@
|
|
|
1
1
|
import { DockerImage, ILocalBundling } from '@aws-cdk/core';
|
|
2
2
|
import { BuildOptions } from './esbuild-types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project. E.g. `src/index.ts`.
|
|
5
|
+
*
|
|
6
|
+
* @stability stable
|
|
5
7
|
*/
|
|
6
8
|
export declare type EntryPoints = string | string[] | Record<string, string>;
|
|
7
9
|
/**
|
|
8
|
-
* @
|
|
10
|
+
* @stability stable
|
|
9
11
|
*/
|
|
10
12
|
export interface BundlerProps {
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
16
|
+
* - `buildOptions.outdir: string` \
|
|
17
|
+
* The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
18
|
+
* For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
19
|
+
* *Cannot be used together with `outfile`*.
|
|
20
|
+
* - `buildOptions.outfile: string` \
|
|
21
|
+
* Relative path to a file inside the CDK asset output directory. \
|
|
22
|
+
* For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
23
|
+
* *Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
24
|
+
* - `buildOptions.absWorkingDir: string` \
|
|
25
|
+
* Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
26
|
+
* If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
27
|
+
*
|
|
28
|
+
* @see https://esbuild.github.io/api/#build-api
|
|
29
|
+
* @stability stable
|
|
15
30
|
*/
|
|
16
31
|
readonly buildOptions?: BuildOptions;
|
|
17
32
|
/**
|
|
18
|
-
*
|
|
33
|
+
* Copy additional files to the output directory, before the build runs.
|
|
19
34
|
*
|
|
20
|
-
*
|
|
35
|
+
* Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
36
|
+
*
|
|
37
|
+
* @stability stable
|
|
21
38
|
*/
|
|
22
39
|
readonly copyDir?: string;
|
|
23
40
|
}
|
|
24
41
|
/**
|
|
42
|
+
* (experimental) Low-level construct that can be used where `BundlingOptions` are required.
|
|
43
|
+
*
|
|
44
|
+
* This class directly interfaces with esbuild and provides almost no configuration safeguards.
|
|
45
|
+
*
|
|
25
46
|
* @experimental
|
|
26
47
|
*/
|
|
27
48
|
export declare class EsbuildBundler {
|
|
28
49
|
/**
|
|
29
|
-
*
|
|
50
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
51
|
+
* E.g. `src/index.ts`.
|
|
52
|
+
*
|
|
53
|
+
* @stability experimental
|
|
30
54
|
*/
|
|
31
55
|
readonly entryPoints: EntryPoints;
|
|
56
|
+
/**
|
|
57
|
+
* Props to change the behaviour of the bundler.
|
|
58
|
+
*
|
|
59
|
+
* @stability experimental
|
|
60
|
+
*/
|
|
32
61
|
readonly props: BundlerProps;
|
|
33
62
|
/**
|
|
63
|
+
* (experimental) Implementation of `ILocalBundling` interface, responsible for calling esbuild functions.
|
|
64
|
+
*
|
|
34
65
|
* @experimental
|
|
35
66
|
*/
|
|
36
67
|
readonly local: ILocalBundling;
|
|
37
68
|
/**
|
|
38
|
-
* @
|
|
69
|
+
* @deprecated This value is ignored since the bundler is always using a locally installed version of esbuild. However the property is required to comply with the `BundlingOptions` interface.
|
|
39
70
|
*/
|
|
40
71
|
readonly image: DockerImage;
|
|
41
72
|
/**
|
|
42
|
-
* @param entryPoints
|
|
73
|
+
* @param entryPoints A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
74
|
+
* @param props Props to change the behaviour of the bundler.
|
|
43
75
|
* @experimental
|
|
44
76
|
*/
|
|
45
77
|
constructor(
|
|
46
78
|
/**
|
|
47
|
-
*
|
|
79
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
80
|
+
* E.g. `src/index.ts`.
|
|
81
|
+
*
|
|
82
|
+
* @stability experimental
|
|
83
|
+
*/
|
|
84
|
+
entryPoints: EntryPoints,
|
|
85
|
+
/**
|
|
86
|
+
* Props to change the behaviour of the bundler.
|
|
87
|
+
*
|
|
88
|
+
* @stability experimental
|
|
48
89
|
*/
|
|
49
|
-
|
|
90
|
+
props: BundlerProps);
|
|
50
91
|
private getOutputOptions;
|
|
51
92
|
}
|
package/lib/bundler.js
CHANGED
|
@@ -8,23 +8,37 @@ const core_1 = require("@aws-cdk/core");
|
|
|
8
8
|
const esbuild_wrapper_1 = require("./esbuild-wrapper");
|
|
9
9
|
const formatMessages_1 = require("./formatMessages");
|
|
10
10
|
/**
|
|
11
|
+
* (experimental) Low-level construct that can be used where `BundlingOptions` are required.
|
|
12
|
+
*
|
|
13
|
+
* This class directly interfaces with esbuild and provides almost no configuration safeguards.
|
|
14
|
+
*
|
|
11
15
|
* @experimental
|
|
12
16
|
*/
|
|
13
17
|
class EsbuildBundler {
|
|
14
18
|
/**
|
|
15
|
-
* @param entryPoints
|
|
19
|
+
* @param entryPoints A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
20
|
+
* @param props Props to change the behaviour of the bundler.
|
|
16
21
|
* @experimental
|
|
17
22
|
*/
|
|
18
23
|
constructor(
|
|
19
24
|
/**
|
|
20
|
-
*
|
|
25
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
26
|
+
* E.g. `src/index.ts`.
|
|
27
|
+
*
|
|
28
|
+
* @stability experimental
|
|
21
29
|
*/
|
|
22
|
-
entryPoints,
|
|
30
|
+
entryPoints,
|
|
31
|
+
/**
|
|
32
|
+
* Props to change the behaviour of the bundler.
|
|
33
|
+
*
|
|
34
|
+
* @stability experimental
|
|
35
|
+
*/
|
|
36
|
+
props) {
|
|
23
37
|
var _b, _c;
|
|
24
38
|
this.entryPoints = entryPoints;
|
|
25
39
|
this.props = props;
|
|
26
40
|
/**
|
|
27
|
-
* @
|
|
41
|
+
* @deprecated This value is ignored since the bundler is always using a locally installed version of esbuild. However the property is required to comply with the `BundlingOptions` interface.
|
|
28
42
|
*/
|
|
29
43
|
this.image = core_1.DockerImage.fromRegistry('scratch');
|
|
30
44
|
if (((_b = props === null || props === void 0 ? void 0 : props.buildOptions) === null || _b === void 0 ? void 0 : _b.outfile) && ((_c = props === null || props === void 0 ? void 0 : props.buildOptions) === null || _c === void 0 ? void 0 : _c.outdir)) {
|
|
@@ -67,5 +81,5 @@ class EsbuildBundler {
|
|
|
67
81
|
}
|
|
68
82
|
exports.EsbuildBundler = EsbuildBundler;
|
|
69
83
|
_a = JSII_RTTI_SYMBOL_1;
|
|
70
|
-
EsbuildBundler[_a] = { fqn: "@mrgrain/cdk-esbuild.EsbuildBundler", version: "2.0.0-alpha.
|
|
71
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
84
|
+
EsbuildBundler[_a] = { fqn: "@mrgrain/cdk-esbuild.EsbuildBundler", version: "2.0.0-alpha.5" };
|
|
85
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9idW5kbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsK0JBQXFFO0FBQ3JFLHdDQUt1QjtBQUV2Qix1REFBOE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gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHJlYWRvbmx5IGJ1aWxkT3B0aW9ucz86IEJ1aWxkT3B0aW9ucztcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgcmVhZG9ubHkgY29weURpcj86IHN0cmluZztcbn1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuZXhwb3J0IGNsYXNzIEVzYnVpbGRCdW5kbGVyIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgcHVibGljIHJlYWRvbmx5IGxvY2FsOiBJTG9jYWxCdW5kbGluZztcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHB1YmxpYyByZWFkb25seSBpbWFnZSA9IERvY2tlckltYWdlLmZyb21SZWdpc3RyeSgnc2NyYXRjaCcpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHB1YmxpYyBjb25zdHJ1Y3RvcihcbiAgICAvKipcbiAgICAgKiBBIHJlbGF0aXZlIHBhdGggb3IgbGlzdCBvciBtYXAgb2YgcmVsYXRpdmUgcGF0aHMgdG8gdGhlIGVudHJ5IHBvaW50cyBvZiB5b3VyIGNvZGUgZnJvbSB0aGUgcm9vdCBvZiB0aGUgcHJvamVjdC5cbiAgICAgKiBFLmcuIGBzcmMvaW5kZXgudHNgLlxuICAgICAqXG4gICAgICogQHN0YWJpbGl0eSBleHBlcmltZW50YWxcbiAgICAgKi9cbiAgICBwdWJsaWMgcmVhZG9ubHkgZW50cnlQb2ludHM6IEVudHJ5UG9pbnRzLFxuXG4gICAgLyoqXG4gICAgICogUHJvcHMgdG8gY2hhbmdlIHRoZSBiZWhhdmlvdXIgb2YgdGhlIGJ1bmRsZXIuXG4gICAgICpcbiAgICAgKiBAc3RhYmlsaXR5IGV4cGVyaW1lbnRhbFxuICAgICAqL1xuICAgIHB1YmxpYyByZWFkb25seSBwcm9wczogQnVuZGxlclByb3BzLFxuICApIHtcbiAgICBpZiAocHJvcHM/LmJ1aWxkT3B0aW9ucz8ub3V0ZmlsZSAmJiBwcm9wcz8uYnVpbGRPcHRpb25zPy5vdXRkaXIpIHtcbiAgICAgIHRocm93IG5ldyBFcnJvcignQ2Fubm90IHVzZSBib3RoIFwib3V0ZmlsZVwiIGFuZCBcIm91dGRpclwiJyk7XG4gICAgfVxuXG4gICAgdGhpcy5sb2NhbCA9IHtcbiAgICAgIHRyeUJ1bmRsZTogKG91dHB1dERpcjogc3RyaW5nLCBfb3B0aW9uczogQnVuZGxpbmdPcHRpb25zKTogYm9vbGVhbiA9PiB7XG4gICAgICAgIHRyeSB7XG4gICAgICAgICAgaWYgKHRoaXMucHJvcHMuY29weURpcikge1xuICAgICAgICAgICAgRmlsZVN5c3RlbS5jb3B5RGlyZWN0b3J5KFxuICAgICAgICAgICAgICByZXNvbHZlKFxuICAgICAgICAgICAgICAgIHRoaXMucHJvcHM/LmJ1aWxkT3B0aW9ucz8uYWJzV29ya2luZ0RpciA/PyBwcm9jZXNzLmN3ZCgpLFxuICAgICAgICAgICAgICAgIHRoaXMucHJvcHMuY29weURpcixcbiAgICAgICAgICAgICAgKSxcbiAgICAgICAgICAgICAgb3V0cHV0RGlyLFxuICAgICAgICAgICAgKTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBjb25zdCBidWlsZFJlc3VsdDogQnVpbGRSZXN1bHQgPSBidWlsZFN5bmMoe1xuICAgICAgICAgICAgZW50cnlQb2ludHMsXG4gICAgICAgICAgICAuLi4odGhpcy5wcm9wcz8uYnVpbGRPcHRpb25zIHx8IHt9K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qb2luKFxuICAgICAgICAgIC4uLihbY2RrT3V0cHV0RGlyLCB0aGlzLnByb3BzPy5idWlsZE9wdGlvbnM/Lm91dGRpcl0uZmlsdGVyKFxuICAgICAgICAgICAgQm9vbGVhbixcbiAgICAgICAgICApIGFzIHN0cmluZ1tdKSxcbiAgICAgICAgKSxcbiAgICAgICksXG4gICAgICBvdXRmaWxlOiB1bmRlZmluZWQsXG4gICAgfTtcbiAgfVxufVxuIl19
|
package/lib/code.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ import { EntryPoints } from './bundler';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface CodeConfig {
|
|
10
10
|
/**
|
|
11
|
+
* The location of the code in S3.
|
|
12
|
+
*
|
|
11
13
|
* @stability stable
|
|
12
14
|
*/
|
|
13
15
|
readonly s3Location: Location;
|
|
@@ -34,7 +36,9 @@ declare abstract class Code<Props extends JavaScriptCodeProps | TypeScriptCodePr
|
|
|
34
36
|
*/
|
|
35
37
|
protected asset: Asset;
|
|
36
38
|
/**
|
|
37
|
-
*
|
|
39
|
+
* (deprecated) Determines whether this Code is inline code or not.
|
|
40
|
+
*
|
|
41
|
+
* @deprecated this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
|
|
38
42
|
*/
|
|
39
43
|
isInline: boolean;
|
|
40
44
|
/**
|
|
@@ -48,34 +52,83 @@ declare abstract class Code<Props extends JavaScriptCodeProps | TypeScriptCodePr
|
|
|
48
52
|
*/
|
|
49
53
|
bind(scope: Construct): CodeConfig;
|
|
50
54
|
/**
|
|
55
|
+
* Called after the CFN function resource has been created to allow the code class to bind to it.
|
|
56
|
+
*
|
|
57
|
+
* Specifically it's required to allow assets to add
|
|
58
|
+
* metadata for tooling like SAM CLI to be able to find their origins.
|
|
59
|
+
*
|
|
51
60
|
* @stability stable
|
|
52
61
|
*/
|
|
53
62
|
bindToResource(resource: CfnResource, options?: ResourceBindOptions): void;
|
|
54
63
|
}
|
|
55
64
|
/**
|
|
65
|
+
* Represents the deployed JavaScript Code.
|
|
66
|
+
*
|
|
56
67
|
* @stability stable
|
|
57
68
|
*/
|
|
58
69
|
export declare class JavaScriptCode extends Code<JavaScriptCodeProps, JSAsset> {
|
|
59
70
|
/**
|
|
60
71
|
* @stability stable
|
|
61
72
|
*/
|
|
62
|
-
assetClass: typeof JSAsset;
|
|
73
|
+
protected readonly assetClass: typeof JSAsset;
|
|
74
|
+
/**
|
|
75
|
+
* @param entryPoints A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
76
|
+
* @param props Props to change the behavior of the bundler.
|
|
77
|
+
* @stability stable
|
|
78
|
+
*/
|
|
79
|
+
constructor(
|
|
63
80
|
/**
|
|
81
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
82
|
+
* E.g. `src/index.ts`.
|
|
83
|
+
*
|
|
64
84
|
* @stability stable
|
|
65
85
|
*/
|
|
66
|
-
|
|
86
|
+
entryPoints: EntryPoints,
|
|
87
|
+
/**
|
|
88
|
+
* Props to change the behavior of the bundler.
|
|
89
|
+
*
|
|
90
|
+
* Default values for `props.buildOptions`:
|
|
91
|
+
* - `bundle=true`
|
|
92
|
+
* - `platform=node`
|
|
93
|
+
* - `target=nodeX` with X being the major node version running locally
|
|
94
|
+
*
|
|
95
|
+
* @stability stable
|
|
96
|
+
*/
|
|
97
|
+
props?: JavaScriptCodeProps);
|
|
67
98
|
}
|
|
68
99
|
/**
|
|
100
|
+
* Represents the deployed TypeScript Code.
|
|
101
|
+
*
|
|
69
102
|
* @stability stable
|
|
70
103
|
*/
|
|
71
104
|
export declare class TypeScriptCode extends Code<TypeScriptCodeProps, TSAsset> {
|
|
72
105
|
/**
|
|
73
106
|
* @stability stable
|
|
74
107
|
*/
|
|
75
|
-
assetClass: typeof TSAsset;
|
|
108
|
+
protected readonly assetClass: typeof TSAsset;
|
|
109
|
+
/**
|
|
110
|
+
* @param entryPoints A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
111
|
+
* @param props Props to change the behavior of the bundler.
|
|
112
|
+
* @stability stable
|
|
113
|
+
*/
|
|
114
|
+
constructor(
|
|
76
115
|
/**
|
|
116
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
117
|
+
* E.g. `src/index.ts`.
|
|
118
|
+
*
|
|
119
|
+
* @stability stable
|
|
120
|
+
*/
|
|
121
|
+
entryPoints: EntryPoints,
|
|
122
|
+
/**
|
|
123
|
+
* Props to change the behavior of the bundler.
|
|
124
|
+
*
|
|
125
|
+
* Default values for `props.buildOptions`:
|
|
126
|
+
* - `bundle=true`
|
|
127
|
+
* - `platform=node`
|
|
128
|
+
* - `target=nodeX` with X being the major node version running locally
|
|
129
|
+
*
|
|
77
130
|
* @stability stable
|
|
78
131
|
*/
|
|
79
|
-
|
|
132
|
+
props?: TypeScriptCodeProps);
|
|
80
133
|
}
|
|
81
134
|
export {};
|