@mrgrain/cdk-esbuild 4.0.0-alpha.8 → 4.0.0-beta.1
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 +1297 -357
- package/CHANGELOG.md +94 -0
- package/LICENSE +1 -1
- package/README.md +249 -112
- package/lib/asset.d.ts +12 -1
- package/lib/asset.js +21 -13
- package/lib/bundler.d.ts +51 -28
- package/lib/bundler.js +28 -17
- package/lib/code.d.ts +48 -8
- package/lib/code.js +42 -19
- package/lib/esbuild-types.d.ts +43 -15
- package/lib/esbuild-types.js +1 -1
- package/lib/index.d.ts +4 -3
- package/lib/index.js +6 -5
- package/lib/inline-code.d.ts +29 -77
- package/lib/inline-code.js +53 -104
- package/lib/private/dynamic-package.d.ts +41 -0
- package/lib/private/dynamic-package.js +115 -0
- package/lib/private/esbuild-source.d.ts +33 -0
- package/lib/private/esbuild-source.js +59 -0
- package/lib/private/utils.d.ts +7 -0
- package/lib/private/utils.js +23 -0
- package/lib/provider.d.ts +129 -0
- package/lib/provider.js +115 -0
- package/lib/source.d.ts +81 -5
- package/lib/source.js +84 -8
- package/package.json +32 -18
- package/.gitattributes +0 -24
- package/.projenrc.ts +0 -214
- package/API.md +0 -2514
- package/SECURITY.md +0 -19
- package/lib/esbuild-polyfill.js +0 -2300
- package/lib/esbuild-wrapper.d.ts +0 -3
- package/lib/esbuild-wrapper.js +0 -25
- package/lib/formatMessages.d.ts +0 -18
- package/lib/formatMessages.js +0 -34
package/.projenrc.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { copyFileSync } from 'fs';
|
|
2
|
-
import {
|
|
3
|
-
awscdk,
|
|
4
|
-
javascript,
|
|
5
|
-
JsonFile,
|
|
6
|
-
vscode,
|
|
7
|
-
} from 'projen';
|
|
8
|
-
import { ReleaseTrigger } from 'projen/lib/release';
|
|
9
|
-
import { SourceFile } from 'ts-morph';
|
|
10
|
-
import { tagOnNpm } from './projenrc/release';
|
|
11
|
-
import { TypeScriptSourceFile } from './projenrc/TypeScriptSourceFile';
|
|
12
|
-
|
|
13
|
-
const project = new awscdk.AwsCdkConstructLibrary({
|
|
14
|
-
projenrcTs: true,
|
|
15
|
-
projenrcTsOptions: {
|
|
16
|
-
filename: '.projenrc.ts',
|
|
17
|
-
},
|
|
18
|
-
depsUpgradeOptions: {
|
|
19
|
-
workflow: false,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
// Project info
|
|
23
|
-
name: '@mrgrain/cdk-esbuild',
|
|
24
|
-
repositoryUrl: 'https://github.com/mrgrain/cdk-esbuild',
|
|
25
|
-
description:
|
|
26
|
-
'CDK constructs for esbuild, an extremely fast JavaScript bundler',
|
|
27
|
-
homepage: 'https://github.com/mrgrain/cdk-esbuild',
|
|
28
|
-
keywords: [
|
|
29
|
-
'aws-cdk',
|
|
30
|
-
'bundler',
|
|
31
|
-
'cdk',
|
|
32
|
-
'constructs',
|
|
33
|
-
'esbuild',
|
|
34
|
-
'lambda',
|
|
35
|
-
's3',
|
|
36
|
-
's3-deployment',
|
|
37
|
-
'static website',
|
|
38
|
-
],
|
|
39
|
-
author: 'Moritz Kornher',
|
|
40
|
-
authorAddress: '',
|
|
41
|
-
authorEmail: 'mail@moritzkornher.de',
|
|
42
|
-
authorUrl: 'https://moritzkornher.de',
|
|
43
|
-
license: 'MIT',
|
|
44
|
-
copyrightOwner: 'Moritz Kornher',
|
|
45
|
-
|
|
46
|
-
// Testing & Linting
|
|
47
|
-
githubOptions: {
|
|
48
|
-
pullRequestLintOptions: {
|
|
49
|
-
semanticTitleOptions: {
|
|
50
|
-
types: ['feat', 'fix', 'chore', 'docs', 'ci'],
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
jestOptions: {
|
|
55
|
-
jestConfig: {
|
|
56
|
-
testPathIgnorePatterns: ['/node_modules/', '/examples/'],
|
|
57
|
-
coveragePathIgnorePatterns: ['/node_modules/', '/examples/'],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
// Release
|
|
62
|
-
packageManager: javascript.NodePackageManager.NPM,
|
|
63
|
-
npmDistTag: 'next',
|
|
64
|
-
defaultReleaseBranch: 'support-other-langs',
|
|
65
|
-
majorVersion: 4,
|
|
66
|
-
prerelease: 'alpha',
|
|
67
|
-
releaseTrigger: {
|
|
68
|
-
isContinuous: false,
|
|
69
|
-
} as ReleaseTrigger,
|
|
70
|
-
publishToPypi: {
|
|
71
|
-
distName: 'mrgrain.cdk-esbuild',
|
|
72
|
-
module: 'mrgrain.cdk_esbuild',
|
|
73
|
-
},
|
|
74
|
-
catalog: {
|
|
75
|
-
twitter: '@mrgrain',
|
|
76
|
-
},
|
|
77
|
-
workflowContainerImage: 'jsii/superchain:1-buster-slim-node14',
|
|
78
|
-
workflowBootstrapSteps: [{
|
|
79
|
-
name: 'Update npm',
|
|
80
|
-
run: 'sudo npm i -g npm',
|
|
81
|
-
}],
|
|
82
|
-
|
|
83
|
-
// Dependencies
|
|
84
|
-
cdkVersion: '2.0.0',
|
|
85
|
-
devDeps: [
|
|
86
|
-
'@aws-cdk/aws-synthetics-alpha@2.0.0-alpha.11',
|
|
87
|
-
'@types/eslint',
|
|
88
|
-
'esbuild@^0.14.0',
|
|
89
|
-
'jest-mock',
|
|
90
|
-
'ts-morph',
|
|
91
|
-
],
|
|
92
|
-
|
|
93
|
-
// Ignore files
|
|
94
|
-
gitignore: [
|
|
95
|
-
'.npmrc',
|
|
96
|
-
'*.gz',
|
|
97
|
-
'*.zip',
|
|
98
|
-
'cdk.out',
|
|
99
|
-
'.cdk.staging',
|
|
100
|
-
'examples/template',
|
|
101
|
-
'!/examples/**',
|
|
102
|
-
],
|
|
103
|
-
npmignore: [
|
|
104
|
-
'.npmrc',
|
|
105
|
-
'.nvmrc',
|
|
106
|
-
'.versionrc',
|
|
107
|
-
'*.tgz',
|
|
108
|
-
'*.gz',
|
|
109
|
-
'*.zip',
|
|
110
|
-
'cdk.out',
|
|
111
|
-
'.cdk.staging',
|
|
112
|
-
'/examples',
|
|
113
|
-
'PUBLISHING.md',
|
|
114
|
-
'.vscode',
|
|
115
|
-
'projenrc',
|
|
116
|
-
],
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
// release only via manual trigger
|
|
120
|
-
const publishTask = project.release?.publisher?.publishToGit({
|
|
121
|
-
changelogFile: 'dist/changelog.md',
|
|
122
|
-
versionFile: 'dist/version.txt',
|
|
123
|
-
releaseTagFile: 'dist/releasetag.txt',
|
|
124
|
-
projectChangelogFile: 'CHANGELOG.md',
|
|
125
|
-
gitBranch: 'main',
|
|
126
|
-
});
|
|
127
|
-
project.tasks.tryFind('release')?.spawn(publishTask!);
|
|
128
|
-
|
|
129
|
-
// add additional tags on npm
|
|
130
|
-
project.tryFindObjectFile('.github/workflows/release.yml')?.addToArray(
|
|
131
|
-
'jobs.release_npm.steps',
|
|
132
|
-
tagOnNpm(project.package.packageName, ['next']),
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
// eslint
|
|
136
|
-
project.eslint?.addRules({
|
|
137
|
-
'@typescript-eslint/member-ordering': 'off',
|
|
138
|
-
});
|
|
139
|
-
project.eslint?.addIgnorePattern('examples/');
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
// VSCode config
|
|
143
|
-
new JsonFile(project, '.vscode/extensions.json', {
|
|
144
|
-
readonly: false,
|
|
145
|
-
marker: false,
|
|
146
|
-
obj: {
|
|
147
|
-
recommendations: ['dbaeumer.vscode-eslint', 'orta.vscode-jest'],
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
new JsonFile(project, '.vscode/settings.json', {
|
|
152
|
-
readonly: false,
|
|
153
|
-
marker: false,
|
|
154
|
-
obj: {
|
|
155
|
-
'editor.formatOnSave': true,
|
|
156
|
-
'editor.defaultFormatter': 'esbenp.prettier-vscode',
|
|
157
|
-
'eslint.format.enable': true,
|
|
158
|
-
'[javascript]': {
|
|
159
|
-
'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
|
|
160
|
-
},
|
|
161
|
-
'[typescript]': {
|
|
162
|
-
'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
|
|
163
|
-
},
|
|
164
|
-
'jest.autoRun': 'off',
|
|
165
|
-
'jest.jestCommandLine': './node_modules/.bin/jest',
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
new vscode.VsCode(project).launchConfiguration.addConfiguration({
|
|
170
|
-
type: 'node',
|
|
171
|
-
name: 'vscode-jest-tests',
|
|
172
|
-
request: 'launch',
|
|
173
|
-
internalConsoleOptions: vscode.InternalConsoleOptions.NEVER_OPEN,
|
|
174
|
-
program: '${workspaceFolder}/node_modules/.bin/jest',
|
|
175
|
-
args: ['--runInBand', '--watchAll=false'],
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
// esbuild
|
|
180
|
-
project.tryFindObjectFile('package.json')?.addOverride('optionalDependencies', {
|
|
181
|
-
esbuild: '^0.14.0',
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
new TypeScriptSourceFile(project, 'src/esbuild-types.ts', {
|
|
186
|
-
source: 'node_modules/esbuild/lib/main.d.ts',
|
|
187
|
-
editGitignore: false,
|
|
188
|
-
transformer: (esbuildTypes: SourceFile) => {
|
|
189
|
-
const readonlyInterface = (name: string) => {
|
|
190
|
-
esbuildTypes.getInterface(name)?.getProperties().forEach(property => property.setIsReadonly(true));
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
const removeFromInterface = (name: string, properties: string[]) => {
|
|
194
|
-
const interfaceDeclaration = esbuildTypes.getInterface(name);
|
|
195
|
-
|
|
196
|
-
properties.forEach(property => interfaceDeclaration?.getProperty(property)?.remove());
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
['CommonOptions', 'BuildOptions', 'TransformOptions'].forEach(readonlyInterface);
|
|
201
|
-
removeFromInterface('BuildOptions', ['entryPoints', 'stdin', 'plugins', 'watch']);
|
|
202
|
-
esbuildTypes.getInterface('CommonOptions')?.getProperty('mangleProps')?.setType('any');
|
|
203
|
-
esbuildTypes.getInterface('CommonOptions')?.getProperty('reserveProps')?.setType('any');
|
|
204
|
-
esbuildTypes.getInterface('TransformOptions')?.getProperty('tsconfigRaw')?.setType('string');
|
|
205
|
-
esbuildTypes.getInterface('InitializeOptions')?.getProperty('wasmModule')?.setType('any');
|
|
206
|
-
},
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
copyFileSync('node_modules/esbuild/lib/main.js', 'src/esbuild-polyfill.js');
|
|
210
|
-
project.compileTask.exec('cp src/esbuild-polyfill.js lib');
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// Synth project
|
|
214
|
-
project.synth();
|