@mrgrain/cdk-esbuild 2.0.0-alpha.0 → 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/.gitattributes +1 -1
- package/.jsii +560 -504
- package/{.projenrc.mjs → .projenrc.ts} +38 -31
- package/API.md +432 -698
- package/CHANGELOG.md +261 -0
- package/README.md +51 -172
- package/SECURITY.md +5 -5
- package/lib/asset.d.ts +29 -28
- package/lib/asset.js +23 -13
- package/lib/bundler.d.ts +92 -0
- package/lib/bundler.js +85 -0
- package/lib/code.d.ts +75 -28
- package/lib/code.js +61 -7
- package/lib/esbuild-types.js +2 -1
- package/lib/index.d.ts +5 -6
- package/lib/index.js +3 -5
- package/lib/inline-code.d.ts +88 -4
- package/lib/inline-code.js +93 -9
- package/lib/source.d.ts +18 -9
- package/lib/source.js +5 -3
- package/package.json +4 -1
- package/projenrc/TypeScriptSourceFile.ts +50 -0
- package/esbuild/Dockerfile +0 -13
- package/esbuild/esbuild-js +0 -22
- package/lib/bundlers.d.ts +0 -42
- package/lib/bundlers.js +0 -62
- package/lib/bundling.d.ts +0 -20
- package/lib/bundling.js +0 -30
- package/lib/esbuild-types-raw.d.ts +0 -304
- package/lib/esbuild-types-raw.js +0 -4
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { ESLint } from 'eslint';
|
|
3
1
|
import {
|
|
4
2
|
AwsCdkConstructLibrary,
|
|
5
3
|
JsonFile,
|
|
6
4
|
NodePackageManager,
|
|
7
|
-
|
|
5
|
+
release,
|
|
8
6
|
vscode,
|
|
9
7
|
} from 'projen';
|
|
8
|
+
import { SourceFile } from 'ts-morph';
|
|
9
|
+
import { TypeScriptSourceFile } from './projenrc/TypeScriptSourceFile';
|
|
10
10
|
|
|
11
11
|
const project = new AwsCdkConstructLibrary({
|
|
12
12
|
projenrcTs: true,
|
|
13
13
|
projenrcTsOptions: {
|
|
14
|
-
filename: '.projenrc.
|
|
14
|
+
filename: '.projenrc.ts',
|
|
15
15
|
},
|
|
16
16
|
eslintOptions: {
|
|
17
17
|
lintProjenRc: false,
|
|
18
|
-
|
|
19
|
-
dirs: ['src', '.projenrc.mjs'],
|
|
18
|
+
dirs: ['src', 'projenrc', '.projenrc.ts'],
|
|
20
19
|
},
|
|
21
20
|
|
|
22
21
|
// Project info
|
|
@@ -49,34 +48,35 @@ const project = new AwsCdkConstructLibrary({
|
|
|
49
48
|
defaultReleaseBranch: 'next',
|
|
50
49
|
majorVersion: 2,
|
|
51
50
|
prerelease: 'alpha',
|
|
52
|
-
|
|
51
|
+
releaseTrigger: release.ReleaseTrigger.manual(),
|
|
53
52
|
catalog: {
|
|
54
53
|
twitter: '@mrgrain',
|
|
55
54
|
},
|
|
56
55
|
workflowContainerImage: 'jsii/superchain:1-buster-slim-node14',
|
|
57
|
-
// release: undefined /* Add release management to this project. */,
|
|
58
56
|
|
|
59
57
|
// Dependencies
|
|
60
58
|
cdkVersion: '1.99.0',
|
|
61
59
|
cdkDependencies: [
|
|
62
|
-
'@aws-cdk/core',
|
|
63
60
|
'@aws-cdk/aws-lambda',
|
|
61
|
+
'@aws-cdk/aws-s3',
|
|
64
62
|
'@aws-cdk/aws-s3-assets',
|
|
65
63
|
'@aws-cdk/aws-s3-deployment',
|
|
66
64
|
'@aws-cdk/aws-synthetics',
|
|
65
|
+
'@aws-cdk/core',
|
|
67
66
|
],
|
|
68
67
|
cdkTestDependencies: [
|
|
69
68
|
'@aws-cdk/assert',
|
|
70
|
-
'@aws-cdk/aws-s3',
|
|
71
|
-
'@aws-cdk/core',
|
|
72
69
|
'@aws-cdk/aws-lambda',
|
|
70
|
+
'@aws-cdk/aws-s3',
|
|
73
71
|
'@aws-cdk/aws-s3-assets',
|
|
74
72
|
'@aws-cdk/aws-s3-deployment',
|
|
75
73
|
'@aws-cdk/aws-synthetics',
|
|
74
|
+
'@aws-cdk/core',
|
|
76
75
|
],
|
|
77
76
|
devDeps: [
|
|
78
77
|
'@types/eslint',
|
|
79
78
|
'esbuild@^0.13.0',
|
|
79
|
+
'ts-morph',
|
|
80
80
|
],
|
|
81
81
|
|
|
82
82
|
// Ignore files
|
|
@@ -87,6 +87,7 @@ const project = new AwsCdkConstructLibrary({
|
|
|
87
87
|
'cdk.out',
|
|
88
88
|
'.cdk.staging',
|
|
89
89
|
'examples/template',
|
|
90
|
+
'!/.github/workflows/manual-release.yml',
|
|
90
91
|
],
|
|
91
92
|
npmignore: [
|
|
92
93
|
'.npmrc',
|
|
@@ -104,37 +105,21 @@ const project = new AwsCdkConstructLibrary({
|
|
|
104
105
|
});
|
|
105
106
|
|
|
106
107
|
const packageJson = project.tryFindObjectFile('package.json');
|
|
107
|
-
packageJson
|
|
108
|
+
packageJson?.addOverride('optionalDependencies', {
|
|
108
109
|
esbuild: '^0.13.0',
|
|
109
110
|
});
|
|
110
|
-
packageJson
|
|
111
|
+
packageJson?.addOverride('jest.testPathIgnorePatterns.1', '/examples/');
|
|
111
112
|
|
|
112
113
|
const eslintRc = project.tryFindObjectFile('.eslintrc.json');
|
|
113
|
-
eslintRc
|
|
114
|
-
eslintRc.addOverride('ignorePatterns', [
|
|
114
|
+
eslintRc?.addOverride('ignorePatterns', [
|
|
115
115
|
'*.js',
|
|
116
116
|
'*.d.ts',
|
|
117
117
|
'node_modules/',
|
|
118
118
|
'*.generated.ts',
|
|
119
119
|
'coverage',
|
|
120
|
-
'!.projenrc.
|
|
120
|
+
'!.projenrc.ts',
|
|
121
121
|
]);
|
|
122
122
|
|
|
123
|
-
const linter = new ESLint({ fix: true });
|
|
124
|
-
const esbuildTypes = (
|
|
125
|
-
await linter.lintText(
|
|
126
|
-
readFileSync('node_modules/esbuild/lib/main.d.ts').toString(),
|
|
127
|
-
{
|
|
128
|
-
filePath: 'src/esbuild-types-raw.ts',
|
|
129
|
-
},
|
|
130
|
-
)
|
|
131
|
-
).pop().output;
|
|
132
|
-
|
|
133
|
-
new TextFile(project, 'src/esbuild-types-raw.ts', {
|
|
134
|
-
editGitignore: false,
|
|
135
|
-
lines: [esbuildTypes],
|
|
136
|
-
});
|
|
137
|
-
|
|
138
123
|
new JsonFile(project, '.vscode/extensions.json', {
|
|
139
124
|
readonly: false,
|
|
140
125
|
marker: false,
|
|
@@ -170,4 +155,26 @@ new vscode.VsCode(project).launchConfiguration.addConfiguration({
|
|
|
170
155
|
args: ['--runInBand', '--watchAll=false'],
|
|
171
156
|
});
|
|
172
157
|
|
|
158
|
+
|
|
159
|
+
new TypeScriptSourceFile(project, 'src/esbuild-types.ts', {
|
|
160
|
+
source: 'node_modules/esbuild/lib/main.d.ts',
|
|
161
|
+
editGitignore: false,
|
|
162
|
+
transformer: (esbuildTypes: SourceFile) => {
|
|
163
|
+
const readonlyInterface = (name: string) => {
|
|
164
|
+
esbuildTypes.getInterface(name)?.getProperties().forEach(property => property.setIsReadonly(true));
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const removeFromInterface = (name: string, properties: string[]) => {
|
|
168
|
+
const interfaceDeclaration = esbuildTypes.getInterface(name);
|
|
169
|
+
|
|
170
|
+
properties.forEach(property => interfaceDeclaration?.getProperty(property)?.remove());
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
['CommonOptions', 'BuildOptions', 'TransformOptions'].forEach(readonlyInterface);
|
|
175
|
+
removeFromInterface('BuildOptions', ['entryPoints', 'stdin', 'plugins', 'watch']);
|
|
176
|
+
esbuildTypes.getInterface('TransformOptions')?.getProperty('tsconfigRaw')?.setType('string');
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
|
|
173
180
|
project.synth();
|