@mrgrain/cdk-esbuild 4.0.0-alpha.7 → 4.0.0-beta.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.
Files changed (51) hide show
  1. package/.jsii +1573 -588
  2. package/CHANGELOG.md +104 -0
  3. package/LICENSE +1 -1
  4. package/README.md +223 -102
  5. package/lib/asset.d.ts +20 -5
  6. package/lib/asset.js +31 -19
  7. package/lib/bundler.d.ts +51 -28
  8. package/lib/bundler.js +28 -17
  9. package/lib/code.d.ts +82 -16
  10. package/lib/code.js +71 -25
  11. package/lib/esbuild-types.d.ts +49 -18
  12. package/lib/esbuild-types.js +1 -1
  13. package/lib/index.d.ts +5 -4
  14. package/lib/index.js +8 -7
  15. package/lib/inline-code.d.ts +29 -77
  16. package/lib/inline-code.js +53 -104
  17. package/lib/private/dynamic-package.d.ts +41 -0
  18. package/lib/private/dynamic-package.js +115 -0
  19. package/lib/private/esbuild-source.d.ts +33 -0
  20. package/lib/private/esbuild-source.js +59 -0
  21. package/lib/private/utils.d.ts +7 -0
  22. package/lib/private/utils.js +23 -0
  23. package/lib/provider.d.ts +129 -0
  24. package/lib/provider.js +115 -0
  25. package/lib/source.d.ts +81 -5
  26. package/lib/source.js +84 -8
  27. package/package.json +33 -25
  28. package/rosetta/default.ts-fixture +32 -0
  29. package/.gitattributes +0 -24
  30. package/.projenrc.ts +0 -208
  31. package/API.md +0 -2477
  32. package/SECURITY.md +0 -19
  33. package/lib/esbuild-polyfill.js +0 -2302
  34. package/lib/esbuild-wrapper.d.ts +0 -3
  35. package/lib/esbuild-wrapper.js +0 -31
  36. package/lib/formatMessages.d.ts +0 -18
  37. package/lib/formatMessages.js +0 -34
  38. package/node_modules/isexe/.npmignore +0 -2
  39. package/node_modules/isexe/LICENSE +0 -15
  40. package/node_modules/isexe/README.md +0 -51
  41. package/node_modules/isexe/index.js +0 -57
  42. package/node_modules/isexe/mode.js +0 -41
  43. package/node_modules/isexe/package.json +0 -35
  44. package/node_modules/isexe/test/basic.js +0 -221
  45. package/node_modules/isexe/windows.js +0 -42
  46. package/node_modules/which/CHANGELOG.md +0 -166
  47. package/node_modules/which/LICENSE +0 -15
  48. package/node_modules/which/README.md +0 -54
  49. package/node_modules/which/bin/node-which +0 -52
  50. package/node_modules/which/package.json +0 -47
  51. package/node_modules/which/which.js +0 -125
package/package.json CHANGED
@@ -15,16 +15,21 @@
15
15
  "docgen": "npx projen docgen",
16
16
  "eject": "npx projen eject",
17
17
  "eslint": "npx projen eslint",
18
+ "integ:python": "npx projen integ:python",
18
19
  "package": "npx projen package",
19
20
  "package-all": "npx projen package-all",
21
+ "package:dotnet": "npx projen package:dotnet",
20
22
  "package:js": "npx projen package:js",
21
23
  "package:python": "npx projen package:python",
22
24
  "post-compile": "npx projen post-compile",
23
25
  "post-upgrade": "npx projen post-upgrade",
24
26
  "pre-compile": "npx projen pre-compile",
25
- "release:support-other-langs": "npx projen release:support-other-langs",
27
+ "prepare:readme": "npx projen prepare:readme",
28
+ "publish:git": "npx projen publish:git",
29
+ "release": "npx projen release",
30
+ "release:v3": "npx projen release:v3",
31
+ "rosetta": "npx projen rosetta",
26
32
  "test": "npx projen test",
27
- "test:update": "npx projen test:update",
28
33
  "test:watch": "npx projen test:watch",
29
34
  "unbump": "npx projen unbump",
30
35
  "upgrade": "npx projen upgrade",
@@ -38,16 +43,16 @@
38
43
  "organization": false
39
44
  },
40
45
  "devDependencies": {
41
- "@aws-cdk/aws-synthetics-alpha": "2.0.0-alpha.11",
46
+ "@aws-cdk/aws-synthetics-alpha": "2.12.0-alpha.0",
47
+ "@aws-cdk/integ-runner": "^2",
42
48
  "@types/eslint": "^7.29.0",
43
- "@types/jest": "^27.5.2",
49
+ "@types/jest": "^27",
44
50
  "@types/node": "^14",
45
- "@types/which": "^2.0.1",
46
51
  "@typescript-eslint/eslint-plugin": "^5",
47
52
  "@typescript-eslint/parser": "^5",
48
- "aws-cdk-lib": "2.0.0",
53
+ "aws-cdk-lib": "2.12.0",
49
54
  "constructs": "10.0.5",
50
- "esbuild": "^0.14.0",
55
+ "esbuild": "^0.16.0",
51
56
  "eslint": "^8",
52
57
  "eslint-import-resolver-node": "^0.3.6",
53
58
  "eslint-import-resolver-typescript": "^2.7.1",
@@ -55,29 +60,23 @@
55
60
  "jest": "^27",
56
61
  "jest-junit": "^13",
57
62
  "jest-mock": "^27.5.1",
58
- "jsii": "^1.60.1",
59
- "jsii-diff": "^1.60.1",
63
+ "jsii": "^1.72.0",
64
+ "jsii-diff": "^1.72.0",
60
65
  "jsii-docgen": "^3.8.31",
61
- "jsii-pacmak": "^1.60.1",
66
+ "jsii-pacmak": "^1.72.0",
62
67
  "json-schema": "^0.4.0",
63
- "npm-check-updates": "^12",
64
- "projen": "^0.58.11",
68
+ "npm-check-updates": "^16",
69
+ "projen": "^0.65.79",
65
70
  "standard-version": "^9",
66
71
  "ts-jest": "^27",
67
- "ts-morph": "^15.1.0",
72
+ "ts-morph": "^17.0.1",
68
73
  "ts-node": "^10",
69
- "typescript": "^4.7.3"
74
+ "typescript": "^4.9.4"
70
75
  },
71
76
  "peerDependencies": {
72
- "aws-cdk-lib": "^2.0.0",
77
+ "aws-cdk-lib": "^2.12.0",
73
78
  "constructs": "^10.0.5"
74
79
  },
75
- "dependencies": {
76
- "which": "^2.0.2"
77
- },
78
- "bundledDependencies": [
79
- "which"
80
- ],
81
80
  "keywords": [
82
81
  "aws-cdk",
83
82
  "bundler",
@@ -92,7 +91,7 @@
92
91
  "main": "lib/index.js",
93
92
  "license": "MIT",
94
93
  "homepage": "https://github.com/mrgrain/cdk-esbuild",
95
- "version": "4.0.0-alpha.7",
94
+ "version": "4.0.0-beta.0",
96
95
  "jest": {
97
96
  "testPathIgnorePatterns": [
98
97
  "/node_modules/",
@@ -104,7 +103,7 @@
104
103
  ],
105
104
  "testMatch": [
106
105
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",
107
- "<rootDir>/(test|src)/**/?(*.)+(spec|test).ts?(x)"
106
+ "<rootDir>/(test|src)/**/*(*.)@(spec|test).ts?(x)"
108
107
  ],
109
108
  "clearMocks": true,
110
109
  "collectCoverage": true,
@@ -143,6 +142,11 @@
143
142
  "python": {
144
143
  "distName": "mrgrain.cdk-esbuild",
145
144
  "module": "mrgrain.cdk_esbuild"
145
+ },
146
+ "dotnet": {
147
+ "namespace": "Mrgrain.CdkEsbuild",
148
+ "packageId": "Mrgrain.CdkEsbuild",
149
+ "iconUrl": "https://raw.githubusercontent.com/mrgrain/cdk-esbuild/main/images/logo.png"
146
150
  }
147
151
  },
148
152
  "tsc": {
@@ -153,11 +157,15 @@
153
157
  "awscdkio": {
154
158
  "twitter": "@mrgrain"
155
159
  },
160
+ "jsiiRosetta": {
161
+ "strict": false
162
+ },
156
163
  "overrides": {
157
- "@types/prettier": "2.6.0"
164
+ "@types/prettier": "2.6.0",
165
+ "@types/babel__traverse": "7.18.2"
158
166
  },
159
167
  "optionalDependencies": {
160
- "esbuild": "^0.14.0"
168
+ "esbuild": "^0.16.0"
161
169
  },
162
170
  "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\"."
163
171
  }
@@ -0,0 +1,32 @@
1
+ import * as path from 'path';
2
+ import * as cdk from 'aws-cdk-lib';
3
+ import * as lambda from 'aws-cdk-lib/aws-lambda';
4
+ import * as s3 from "aws-cdk-lib/aws-s3";
5
+ import * as s3deploy from "aws-cdk-lib/aws-s3-deployment";
6
+ import * as synthetics from "@aws-cdk/aws-synthetics-alpha";
7
+ import {
8
+ BuildOptions,
9
+ EsbuildProvider,
10
+ IBuildProvider,
11
+ ITransformProvider,
12
+ InlineTypeScriptCode,
13
+ TypeScriptCode,
14
+ TypeScriptSource,
15
+ TransformOptions
16
+ } from '.';
17
+
18
+ const stack = new cdk.Stack();
19
+
20
+ class MyCustomEsbuildProvider implements IBuildProvider, ITransformProvider {
21
+ buildSync(options: BuildOptions): void {
22
+ // custom implementation goes here
23
+ }
24
+
25
+ transformSync(code: string, options?: TransformOptions): string {
26
+ // custom implementation goes here, return transformed code
27
+ return 'transformed code';
28
+ }
29
+ }
30
+
31
+
32
+ /// here
package/.gitattributes DELETED
@@ -1,24 +0,0 @@
1
- # ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
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/pull-request-lint.yml linguist-generated
9
- /.github/workflows/release.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/files.json linguist-generated
16
- /.projen/tasks.json linguist-generated
17
- /.vscode/extensions.json linguist-generated
18
- /.vscode/launch.json linguist-generated
19
- /.vscode/settings.json linguist-generated
20
- /LICENSE linguist-generated
21
- /package-lock.json linguist-generated
22
- /package.json linguist-generated
23
- /src/esbuild-types.ts linguist-generated
24
- /tsconfig.dev.json linguist-generated
package/.projenrc.ts DELETED
@@ -1,208 +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
- '@types/which',
89
- 'esbuild@^0.14.0',
90
- 'jest-mock',
91
- 'ts-morph',
92
- ],
93
- bundledDeps: [
94
- 'which',
95
- ],
96
-
97
- // Ignore files
98
- gitignore: [
99
- '.npmrc',
100
- '*.gz',
101
- '*.zip',
102
- 'cdk.out',
103
- '.cdk.staging',
104
- 'examples/template',
105
- '!/examples/**',
106
- ],
107
- npmignore: [
108
- '.npmrc',
109
- '.nvmrc',
110
- '.versionrc',
111
- '*.tgz',
112
- '*.gz',
113
- '*.zip',
114
- 'cdk.out',
115
- '.cdk.staging',
116
- '/examples',
117
- 'PUBLISHING.md',
118
- '.vscode',
119
- 'projenrc',
120
- ],
121
- });
122
-
123
- // add additional tags on npm
124
- project.tryFindObjectFile('.github/workflows/release.yml')?.addToArray(
125
- 'jobs.release_npm.steps',
126
- tagOnNpm(project.package.packageName, ['next']),
127
- );
128
-
129
- // eslint
130
- project.eslint?.addRules({
131
- '@typescript-eslint/member-ordering': 'off',
132
- });
133
- project.eslint?.addIgnorePattern('examples/');
134
-
135
-
136
- // VSCode config
137
- new JsonFile(project, '.vscode/extensions.json', {
138
- readonly: false,
139
- marker: false,
140
- obj: {
141
- recommendations: ['dbaeumer.vscode-eslint', 'orta.vscode-jest'],
142
- },
143
- });
144
-
145
- new JsonFile(project, '.vscode/settings.json', {
146
- readonly: false,
147
- marker: false,
148
- obj: {
149
- 'editor.formatOnSave': true,
150
- 'editor.defaultFormatter': 'esbenp.prettier-vscode',
151
- 'eslint.format.enable': true,
152
- '[javascript]': {
153
- 'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
154
- },
155
- '[typescript]': {
156
- 'editor.defaultFormatter': 'dbaeumer.vscode-eslint',
157
- },
158
- 'jest.autoRun': 'off',
159
- 'jest.jestCommandLine': './node_modules/.bin/jest',
160
- },
161
- });
162
-
163
- new vscode.VsCode(project).launchConfiguration.addConfiguration({
164
- type: 'node',
165
- name: 'vscode-jest-tests',
166
- request: 'launch',
167
- internalConsoleOptions: vscode.InternalConsoleOptions.NEVER_OPEN,
168
- program: '${workspaceFolder}/node_modules/.bin/jest',
169
- args: ['--runInBand', '--watchAll=false'],
170
- });
171
-
172
-
173
- // esbuild
174
- project.tryFindObjectFile('package.json')?.addOverride('optionalDependencies', {
175
- esbuild: '^0.14.0',
176
- });
177
-
178
-
179
- new TypeScriptSourceFile(project, 'src/esbuild-types.ts', {
180
- source: 'node_modules/esbuild/lib/main.d.ts',
181
- editGitignore: false,
182
- transformer: (esbuildTypes: SourceFile) => {
183
- const readonlyInterface = (name: string) => {
184
- esbuildTypes.getInterface(name)?.getProperties().forEach(property => property.setIsReadonly(true));
185
- };
186
-
187
- const removeFromInterface = (name: string, properties: string[]) => {
188
- const interfaceDeclaration = esbuildTypes.getInterface(name);
189
-
190
- properties.forEach(property => interfaceDeclaration?.getProperty(property)?.remove());
191
- };
192
-
193
-
194
- ['CommonOptions', 'BuildOptions', 'TransformOptions'].forEach(readonlyInterface);
195
- removeFromInterface('BuildOptions', ['entryPoints', 'stdin', 'plugins', 'watch']);
196
- esbuildTypes.getInterface('CommonOptions')?.getProperty('mangleProps')?.setType('any');
197
- esbuildTypes.getInterface('CommonOptions')?.getProperty('reserveProps')?.setType('any');
198
- esbuildTypes.getInterface('TransformOptions')?.getProperty('tsconfigRaw')?.setType('string');
199
- esbuildTypes.getInterface('InitializeOptions')?.getProperty('wasmModule')?.setType('any');
200
- },
201
- });
202
-
203
- copyFileSync('node_modules/esbuild/lib/main.js', 'src/esbuild-polyfill.js');
204
- project.compileTask.exec('cp src/esbuild-polyfill.js lib');
205
-
206
-
207
- // Synth project
208
- project.synth();