@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
package/lib/source.js
CHANGED
|
@@ -5,6 +5,8 @@ exports.TypeScriptSource = exports.JavaScriptSource = void 0;
|
|
|
5
5
|
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
6
|
const core_1 = require("@aws-cdk/core");
|
|
7
7
|
const asset_1 = require("./asset");
|
|
8
|
+
;
|
|
9
|
+
;
|
|
8
10
|
class Source {
|
|
9
11
|
/**
|
|
10
12
|
*
|
|
@@ -67,7 +69,7 @@ class JavaScriptSource extends Source {
|
|
|
67
69
|
}
|
|
68
70
|
exports.JavaScriptSource = JavaScriptSource;
|
|
69
71
|
_a = JSII_RTTI_SYMBOL_1;
|
|
70
|
-
JavaScriptSource[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptSource", version: "2.0.0-alpha.
|
|
72
|
+
JavaScriptSource[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptSource", version: "2.0.0-alpha.5" };
|
|
71
73
|
/**
|
|
72
74
|
* @stability stable
|
|
73
75
|
*/
|
|
@@ -85,5 +87,5 @@ class TypeScriptSource extends Source {
|
|
|
85
87
|
}
|
|
86
88
|
exports.TypeScriptSource = TypeScriptSource;
|
|
87
89
|
_b = JSII_RTTI_SYMBOL_1;
|
|
88
|
-
TypeScriptSource[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptSource", version: "2.0.0-alpha.
|
|
89
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
90
|
+
TypeScriptSource[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptSource", version: "2.0.0-alpha.5" };
|
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3NvdXJjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUtBLHdDQUFpRDtBQUNqRCxtQ0FBdUY7QUFJeEIsQ0FBQztBQUNELENBQUM7QUFFaEUsTUFBZSxNQUFNO0lBY25COzs7O09BSUc7SUFDSCxZQUFZLFdBQXdCLEVBQUUsS0FBWTtRQUNoRCxNQUFNLGNBQWMsR0FBMEI7WUFDNUMsUUFBUSxFQUFFLFNBQVM7U0FDcEIsQ0FBQztRQUVGLElBQUksQ0FBQyxLQUFLLEdBQUc7WUFDWCxXQUFXO1lBQ1gsR0FBRyxLQUFLO1lBQ1IsWUFBWSxFQUFFO2dCQUNaLEdBQUcsY0FBYztnQkFDakIsR0FBRyxLQUFLLENBQUMsWUFBWTthQUN0QjtTQUNGLENBQUM7SUFDSixDQUFDOzs7Ozs7SUFFRCxJQUFJLENBQUMsS0FBZ0IsRUFBR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+64,13 @@
|
|
|
64
64
|
"projen": "^0.30.3",
|
|
65
65
|
"standard-version": "^9",
|
|
66
66
|
"ts-jest": "^27.0.7",
|
|
67
|
+
"ts-morph": "^12.0.0",
|
|
67
68
|
"ts-node": "^9",
|
|
68
69
|
"typescript": "^4.4.4"
|
|
69
70
|
},
|
|
70
71
|
"peerDependencies": {
|
|
71
72
|
"@aws-cdk/aws-lambda": "^1.99.0",
|
|
73
|
+
"@aws-cdk/aws-s3": "^1.99.0",
|
|
72
74
|
"@aws-cdk/aws-s3-assets": "^1.99.0",
|
|
73
75
|
"@aws-cdk/aws-s3-deployment": "^1.99.0",
|
|
74
76
|
"@aws-cdk/aws-synthetics": "^1.99.0",
|
|
@@ -77,6 +79,7 @@
|
|
|
77
79
|
},
|
|
78
80
|
"dependencies": {
|
|
79
81
|
"@aws-cdk/aws-lambda": "^1.99.0",
|
|
82
|
+
"@aws-cdk/aws-s3": "^1.99.0",
|
|
80
83
|
"@aws-cdk/aws-s3-assets": "^1.99.0",
|
|
81
84
|
"@aws-cdk/aws-s3-deployment": "^1.99.0",
|
|
82
85
|
"@aws-cdk/aws-synthetics": "^1.99.0",
|
|
@@ -100,7 +103,7 @@
|
|
|
100
103
|
"publishConfig": {
|
|
101
104
|
"tag": "next"
|
|
102
105
|
},
|
|
103
|
-
"version": "2.0.0-alpha.
|
|
106
|
+
"version": "2.0.0-alpha.5",
|
|
104
107
|
"jest": {
|
|
105
108
|
"testMatch": [
|
|
106
109
|
"**/__tests__/**/*.ts?(x)",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FileBase, FileBaseOptions, Project as ProjenProject } from 'projen';
|
|
2
|
+
import { execCapture } from 'projen/lib/util';
|
|
3
|
+
import { Project, SourceFile } from 'ts-morph';
|
|
4
|
+
|
|
5
|
+
interface TypeScriptSourceFileOptions extends Omit<FileBaseOptions, 'readonly'> {
|
|
6
|
+
source: string;
|
|
7
|
+
transformer?: (sourcefile: SourceFile) => void;
|
|
8
|
+
format?: boolean;
|
|
9
|
+
marker?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class TypeScriptSourceFile extends FileBase {
|
|
13
|
+
public readonly options: TypeScriptSourceFileOptions;
|
|
14
|
+
|
|
15
|
+
constructor(project: ProjenProject, filePath: string, options: TypeScriptSourceFileOptions) {
|
|
16
|
+
super(project, filePath, { ...options, readonly: false });
|
|
17
|
+
|
|
18
|
+
this.options = {
|
|
19
|
+
format: true,
|
|
20
|
+
marker: true,
|
|
21
|
+
...options,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected synthesizeContent(): string {
|
|
26
|
+
const tsProject = new Project({
|
|
27
|
+
tsConfigFilePath: 'tsconfig.json',
|
|
28
|
+
skipAddingFilesFromTsConfig: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const sourceFile = tsProject.addSourceFileAtPath(this.options.source);
|
|
32
|
+
|
|
33
|
+
if (this.options.transformer) {
|
|
34
|
+
this.options.transformer(sourceFile);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return [
|
|
38
|
+
...(this.options.marker ? [`// ${TypeScriptSourceFile.PROJEN_MARKER}`] : []),
|
|
39
|
+
'',
|
|
40
|
+
sourceFile.getFullText(),
|
|
41
|
+
].join('\n');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public postSynthesize() {
|
|
45
|
+
super.postSynthesize();
|
|
46
|
+
|
|
47
|
+
const outdir = this.project.outdir;
|
|
48
|
+
execCapture(`npx eslint --ext .ts --fix ${this.absolutePath}`, { cwd: outdir });
|
|
49
|
+
}
|
|
50
|
+
}
|
package/esbuild/Dockerfile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
FROM node:lts-alpine
|
|
2
|
-
|
|
3
|
-
ARG version=latest
|
|
4
|
-
|
|
5
|
-
# Install esbuild as global bin
|
|
6
|
-
RUN npm i -g esbuild@${version} --unsafe-perm
|
|
7
|
-
|
|
8
|
-
# Add Javascript JSON interface script and set as entrypoint
|
|
9
|
-
ENV NODE_PATH /usr/local/lib/node_modules
|
|
10
|
-
COPY ./esbuild-js /usr/local/bin/esbuild-js
|
|
11
|
-
RUN chmod +x /usr/local/bin/esbuild-js
|
|
12
|
-
|
|
13
|
-
ENTRYPOINT [ "esbuild-js" ]
|
package/esbuild/esbuild-js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const { execSync } = require("child_process");
|
|
3
|
-
const { resolve } = require("path");
|
|
4
|
-
const esbuild = require("esbuild");
|
|
5
|
-
|
|
6
|
-
try {
|
|
7
|
-
const { copyDir, outputDirectory, options } = JSON.parse(process.argv[2]);
|
|
8
|
-
|
|
9
|
-
if (copyDir) {
|
|
10
|
-
console.log(`Copy additional files from '${copyDir}'`);
|
|
11
|
-
const srcDir = resolve(copyDir) + '/.';
|
|
12
|
-
const copyCommand = `cp -r ${srcDir} ${outputDirectory}`;
|
|
13
|
-
console.log(copyCommand);
|
|
14
|
-
execSync(copyCommand)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log("Bundling with the following options...", options);
|
|
18
|
-
esbuild.buildSync(options);
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error(error.message);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
package/lib/bundlers.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { BundlingOptions, ILocalBundling } from '@aws-cdk/core';
|
|
2
|
-
import { BuildOptions } from './esbuild-types';
|
|
3
|
-
/**
|
|
4
|
-
* @stability stable
|
|
5
|
-
*/
|
|
6
|
-
export interface EsbuildOptions extends BuildOptions {
|
|
7
|
-
/**
|
|
8
|
-
* @stability stable
|
|
9
|
-
*/
|
|
10
|
-
readonly entryPoints: string[] | Record<string, string>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @stability stable
|
|
14
|
-
*/
|
|
15
|
-
export interface EsbuildBundlingProps {
|
|
16
|
-
/**
|
|
17
|
-
* Relative path to a directory copied to the output before esbuild is run (i.e esbuild will overwrite existing files).
|
|
18
|
-
*
|
|
19
|
-
* @stability stable
|
|
20
|
-
*/
|
|
21
|
-
readonly copyDir?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @stability stable
|
|
25
|
-
*/
|
|
26
|
-
export declare class LocalBundler implements ILocalBundling {
|
|
27
|
-
readonly buildOptions: EsbuildOptions;
|
|
28
|
-
readonly props: EsbuildBundlingProps;
|
|
29
|
-
/**
|
|
30
|
-
* @stability stable
|
|
31
|
-
*/
|
|
32
|
-
constructor(buildOptions: EsbuildOptions, props?: EsbuildBundlingProps);
|
|
33
|
-
/**
|
|
34
|
-
* This method is called before attempting docker bundling to allow the bundler to be executed locally.
|
|
35
|
-
*
|
|
36
|
-
* If the local bundler exists, and bundling
|
|
37
|
-
* was performed locally, return `true`. Otherwise, return `false`.
|
|
38
|
-
*
|
|
39
|
-
* @stability stable
|
|
40
|
-
*/
|
|
41
|
-
tryBundle(outputDir: string, _options: BundlingOptions): boolean;
|
|
42
|
-
}
|
package/lib/bundlers.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.LocalBundler = void 0;
|
|
5
|
-
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const core_1 = require("@aws-cdk/core");
|
|
8
|
-
const esbuild_wrapper_1 = require("./esbuild-wrapper");
|
|
9
|
-
const formatMessages_1 = require("./formatMessages");
|
|
10
|
-
function getOutputOptions(cdkOutputDir, outfile, outdir, path = path_1.posix) {
|
|
11
|
-
if (outfile) {
|
|
12
|
-
return {
|
|
13
|
-
outdir: undefined,
|
|
14
|
-
outfile: path.normalize(path.join(...[cdkOutputDir, outfile].filter(Boolean))),
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return {
|
|
18
|
-
outdir: path_1.posix.normalize(path_1.posix.join(...[cdkOutputDir, outdir].filter(Boolean))),
|
|
19
|
-
outfile: undefined,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @stability stable
|
|
24
|
-
*/
|
|
25
|
-
class LocalBundler {
|
|
26
|
-
/**
|
|
27
|
-
* @stability stable
|
|
28
|
-
*/
|
|
29
|
-
constructor(buildOptions, props = {}) {
|
|
30
|
-
this.buildOptions = buildOptions;
|
|
31
|
-
this.props = props;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* This method is called before attempting docker bundling to allow the bundler to be executed locally.
|
|
35
|
-
*
|
|
36
|
-
* If the local bundler exists, and bundling
|
|
37
|
-
* was performed locally, return `true`. Otherwise, return `false`.
|
|
38
|
-
*
|
|
39
|
-
* @stability stable
|
|
40
|
-
*/
|
|
41
|
-
tryBundle(outputDir, _options) {
|
|
42
|
-
var _b;
|
|
43
|
-
try {
|
|
44
|
-
if (this.props.copyDir) {
|
|
45
|
-
core_1.FileSystem.copyDirectory(path_1.resolve((_b = this.buildOptions.absWorkingDir) !== null && _b !== void 0 ? _b : process.cwd(), this.props.copyDir), outputDir);
|
|
46
|
-
}
|
|
47
|
-
const buildResult = esbuild_wrapper_1.buildSync({
|
|
48
|
-
...this.buildOptions,
|
|
49
|
-
...getOutputOptions(outputDir, this.buildOptions.outfile, this.buildOptions.outdir, { normalize: path_1.normalize, join: path_1.join }),
|
|
50
|
-
});
|
|
51
|
-
formatMessages_1.printBuildMessages(buildResult, { prefix: 'Build ' });
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
formatMessages_1.printBuildMessages(error, { prefix: 'Build ' });
|
|
55
|
-
}
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.LocalBundler = LocalBundler;
|
|
60
|
-
_a = JSII_RTTI_SYMBOL_1;
|
|
61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cbiAgICAgICAgLi4udGhpcy5idWlsZE9wdGlvbnMsXG4gICAgICAgIC4uLmdldE91dHB1dE9wdGlvbnMoXG4gICAgICAgICAgb3V0cHV0RGlyLFxuICAgICAgICAgIHRoaXMuYnVpbGRPcHRpb25zLm91dGZpbGUsXG4gICAgICAgICAgdGhpcy5idWlsZE9wdGlvbnMub3V0ZGlyLFxuICAgICAgICAgIHsgbm9ybWFsaXplLCBqb2luIH0sXG4gICAgICAgICksXG4gICAgICB9KTtcblxuICAgICAgcHJpbnRCdWlsZE1lc3NhZ2VzKGJ1aWxkUmVzdWx0LCB7IHByZWZpeDogJ0J1aWxkICcgfSk7XG4gICAgfSBjYXRjaCAoZXJyb3IpIHtcbiAgICAgIHByaW50QnVpbGRNZXNzYWdlcyhlcnJvciBhcyBCdWlsZEZhaWx1cmUsIHsgcHJlZml4OiAnQnVpbGQgJyB9KTtcbiAgICB9XG5cbiAgICByZXR1cm4gdHJ1ZTtcbiAgfVxufSJdfQ==
|
package/lib/bundling.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { DockerImage } from '@aws-cdk/core';
|
|
2
|
-
import { EsbuildOptions, EsbuildBundlingProps, LocalBundler } from './bundlers';
|
|
3
|
-
/**
|
|
4
|
-
* @experimental
|
|
5
|
-
*/
|
|
6
|
-
export declare class EsbuildBundling {
|
|
7
|
-
readonly buildOptions: EsbuildOptions;
|
|
8
|
-
/**
|
|
9
|
-
* @experimental
|
|
10
|
-
*/
|
|
11
|
-
readonly local: LocalBundler;
|
|
12
|
-
/**
|
|
13
|
-
* @experimental
|
|
14
|
-
*/
|
|
15
|
-
readonly image: DockerImage;
|
|
16
|
-
/**
|
|
17
|
-
* @experimental
|
|
18
|
-
*/
|
|
19
|
-
constructor(buildOptions: EsbuildOptions, bundlerProps?: EsbuildBundlingProps);
|
|
20
|
-
}
|
package/lib/bundling.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.EsbuildBundling = void 0;
|
|
5
|
-
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
|
-
const core_1 = require("@aws-cdk/core");
|
|
7
|
-
const bundlers_1 = require("./bundlers");
|
|
8
|
-
/**
|
|
9
|
-
* @experimental
|
|
10
|
-
*/
|
|
11
|
-
class EsbuildBundling {
|
|
12
|
-
/**
|
|
13
|
-
* @experimental
|
|
14
|
-
*/
|
|
15
|
-
constructor(buildOptions, bundlerProps = {}) {
|
|
16
|
-
this.buildOptions = buildOptions;
|
|
17
|
-
/**
|
|
18
|
-
* @experimental
|
|
19
|
-
*/
|
|
20
|
-
this.image = core_1.DockerImage.fromRegistry('scratch');
|
|
21
|
-
if (buildOptions.outfile && buildOptions.outdir) {
|
|
22
|
-
throw new Error('Cannot use both "outfile" and "outdir"');
|
|
23
|
-
}
|
|
24
|
-
this.local = new bundlers_1.LocalBundler(this.buildOptions, bundlerProps);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.EsbuildBundling = EsbuildBundling;
|
|
28
|
-
_a = JSII_RTTI_SYMBOL_1;
|
|
29
|
-
EsbuildBundling[_a] = { fqn: "@mrgrain/cdk-esbuild.EsbuildBundling", version: "2.0.0-alpha.0" };
|
|
30
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxpbmcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYnVuZGxpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSx3Q0FBNEM7QUFDNUMseUNBSW9COzs7O0FBR3BCLE1BQWEsZUFBZTs7OztJQUsxQixZQUNrQixZQUE0QixFQUM1QyxlQUFxQyxFQUFFO1FBRHZCLGlCQUFZLEdBQVosWUFBWSxDQUFnQjs7OztRQUg5QixVQUFLLEdBQU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m91dGRpclwiJyk7XG4gICAgfVxuXG4gICAgdGhpcy5sb2NhbCA9IG5ldyBMb2NhbEJ1bmRsZXIodGhpcy5idWlsZE9wdGlvbnMsIGJ1bmRsZXJQcm9wcyk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
export declare type Platform = 'browser' | 'node' | 'neutral';
|
|
2
|
-
export declare type Format = 'iife' | 'cjs' | 'esm';
|
|
3
|
-
export declare type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default';
|
|
4
|
-
export declare type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent';
|
|
5
|
-
export declare type Charset = 'ascii' | 'utf8';
|
|
6
|
-
interface CommonOptions {
|
|
7
|
-
sourcemap?: boolean | 'inline' | 'external' | 'both';
|
|
8
|
-
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
|
|
9
|
-
sourceRoot?: string;
|
|
10
|
-
sourcesContent?: boolean;
|
|
11
|
-
format?: Format;
|
|
12
|
-
globalName?: string;
|
|
13
|
-
target?: string | string[];
|
|
14
|
-
minify?: boolean;
|
|
15
|
-
minifyWhitespace?: boolean;
|
|
16
|
-
minifyIdentifiers?: boolean;
|
|
17
|
-
minifySyntax?: boolean;
|
|
18
|
-
charset?: Charset;
|
|
19
|
-
treeShaking?: boolean;
|
|
20
|
-
ignoreAnnotations?: boolean;
|
|
21
|
-
jsx?: 'transform' | 'preserve';
|
|
22
|
-
jsxFactory?: string;
|
|
23
|
-
jsxFragment?: string;
|
|
24
|
-
define?: {
|
|
25
|
-
[key: string]: string;
|
|
26
|
-
};
|
|
27
|
-
pure?: string[];
|
|
28
|
-
keepNames?: boolean;
|
|
29
|
-
color?: boolean;
|
|
30
|
-
logLevel?: LogLevel;
|
|
31
|
-
logLimit?: number;
|
|
32
|
-
}
|
|
33
|
-
export interface BuildOptions extends CommonOptions {
|
|
34
|
-
bundle?: boolean;
|
|
35
|
-
splitting?: boolean;
|
|
36
|
-
preserveSymlinks?: boolean;
|
|
37
|
-
outfile?: string;
|
|
38
|
-
metafile?: boolean;
|
|
39
|
-
outdir?: string;
|
|
40
|
-
outbase?: string;
|
|
41
|
-
platform?: Platform;
|
|
42
|
-
external?: string[];
|
|
43
|
-
loader?: {
|
|
44
|
-
[ext: string]: Loader;
|
|
45
|
-
};
|
|
46
|
-
resolveExtensions?: string[];
|
|
47
|
-
mainFields?: string[];
|
|
48
|
-
conditions?: string[];
|
|
49
|
-
write?: boolean;
|
|
50
|
-
allowOverwrite?: boolean;
|
|
51
|
-
tsconfig?: string;
|
|
52
|
-
outExtension?: {
|
|
53
|
-
[ext: string]: string;
|
|
54
|
-
};
|
|
55
|
-
publicPath?: string;
|
|
56
|
-
entryNames?: string;
|
|
57
|
-
chunkNames?: string;
|
|
58
|
-
assetNames?: string;
|
|
59
|
-
inject?: string[];
|
|
60
|
-
banner?: {
|
|
61
|
-
[type: string]: string;
|
|
62
|
-
};
|
|
63
|
-
footer?: {
|
|
64
|
-
[type: string]: string;
|
|
65
|
-
};
|
|
66
|
-
incremental?: boolean;
|
|
67
|
-
entryPoints?: string[] | Record<string, string>;
|
|
68
|
-
stdin?: StdinOptions;
|
|
69
|
-
plugins?: Plugin[];
|
|
70
|
-
absWorkingDir?: string;
|
|
71
|
-
nodePaths?: string[];
|
|
72
|
-
watch?: boolean | WatchMode;
|
|
73
|
-
}
|
|
74
|
-
export interface WatchMode {
|
|
75
|
-
onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void;
|
|
76
|
-
}
|
|
77
|
-
export interface StdinOptions {
|
|
78
|
-
contents: string;
|
|
79
|
-
resolveDir?: string;
|
|
80
|
-
sourcefile?: string;
|
|
81
|
-
loader?: Loader;
|
|
82
|
-
}
|
|
83
|
-
export interface Message {
|
|
84
|
-
pluginName: string;
|
|
85
|
-
text: string;
|
|
86
|
-
location: Location | null;
|
|
87
|
-
notes: Note[];
|
|
88
|
-
detail: any;
|
|
89
|
-
}
|
|
90
|
-
export interface Note {
|
|
91
|
-
text: string;
|
|
92
|
-
location: Location | null;
|
|
93
|
-
}
|
|
94
|
-
export interface Location {
|
|
95
|
-
file: string;
|
|
96
|
-
namespace: string;
|
|
97
|
-
line: number;
|
|
98
|
-
column: number;
|
|
99
|
-
length: number;
|
|
100
|
-
lineText: string;
|
|
101
|
-
suggestion: string;
|
|
102
|
-
}
|
|
103
|
-
export interface OutputFile {
|
|
104
|
-
path: string;
|
|
105
|
-
contents: Uint8Array;
|
|
106
|
-
text: string;
|
|
107
|
-
}
|
|
108
|
-
export interface BuildInvalidate {
|
|
109
|
-
(): Promise<BuildIncremental>;
|
|
110
|
-
dispose(): void;
|
|
111
|
-
}
|
|
112
|
-
export interface BuildIncremental extends BuildResult {
|
|
113
|
-
rebuild: BuildInvalidate;
|
|
114
|
-
}
|
|
115
|
-
export interface BuildResult {
|
|
116
|
-
errors: Message[];
|
|
117
|
-
warnings: Message[];
|
|
118
|
-
outputFiles?: OutputFile[];
|
|
119
|
-
rebuild?: BuildInvalidate;
|
|
120
|
-
stop?: () => void;
|
|
121
|
-
metafile?: Metafile;
|
|
122
|
-
}
|
|
123
|
-
export interface BuildFailure extends Error {
|
|
124
|
-
errors: Message[];
|
|
125
|
-
warnings: Message[];
|
|
126
|
-
}
|
|
127
|
-
export interface ServeOptions {
|
|
128
|
-
port?: number;
|
|
129
|
-
host?: string;
|
|
130
|
-
servedir?: string;
|
|
131
|
-
onRequest?: (args: ServeOnRequestArgs) => void;
|
|
132
|
-
}
|
|
133
|
-
export interface ServeOnRequestArgs {
|
|
134
|
-
remoteAddress: string;
|
|
135
|
-
method: string;
|
|
136
|
-
path: string;
|
|
137
|
-
status: number;
|
|
138
|
-
timeInMS: number;
|
|
139
|
-
}
|
|
140
|
-
export interface ServeResult {
|
|
141
|
-
port: number;
|
|
142
|
-
host: string;
|
|
143
|
-
wait: Promise<void>;
|
|
144
|
-
stop: () => void;
|
|
145
|
-
}
|
|
146
|
-
export interface TransformOptions extends CommonOptions {
|
|
147
|
-
tsconfigRaw?: string | {
|
|
148
|
-
compilerOptions?: {
|
|
149
|
-
jsxFactory?: string;
|
|
150
|
-
jsxFragmentFactory?: string;
|
|
151
|
-
useDefineForClassFields?: boolean;
|
|
152
|
-
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error';
|
|
153
|
-
};
|
|
154
|
-
};
|
|
155
|
-
sourcefile?: string;
|
|
156
|
-
loader?: Loader;
|
|
157
|
-
banner?: string;
|
|
158
|
-
footer?: string;
|
|
159
|
-
}
|
|
160
|
-
export interface TransformResult {
|
|
161
|
-
code: string;
|
|
162
|
-
map: string;
|
|
163
|
-
warnings: Message[];
|
|
164
|
-
}
|
|
165
|
-
export interface TransformFailure extends Error {
|
|
166
|
-
errors: Message[];
|
|
167
|
-
warnings: Message[];
|
|
168
|
-
}
|
|
169
|
-
export interface Plugin {
|
|
170
|
-
name: string;
|
|
171
|
-
setup: (build: PluginBuild) => (void | Promise<void>);
|
|
172
|
-
}
|
|
173
|
-
export interface PluginBuild {
|
|
174
|
-
initialOptions: BuildOptions;
|
|
175
|
-
onStart(callback: () => (OnStartResult | null | void | Promise<OnStartResult | null | void>)): void;
|
|
176
|
-
onEnd(callback: (result: BuildResult) => (void | Promise<void>)): void;
|
|
177
|
-
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) => (OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void;
|
|
178
|
-
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) => (OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void;
|
|
179
|
-
}
|
|
180
|
-
export interface OnStartResult {
|
|
181
|
-
errors?: PartialMessage[];
|
|
182
|
-
warnings?: PartialMessage[];
|
|
183
|
-
}
|
|
184
|
-
export interface OnResolveOptions {
|
|
185
|
-
filter: RegExp;
|
|
186
|
-
namespace?: string;
|
|
187
|
-
}
|
|
188
|
-
export interface OnResolveArgs {
|
|
189
|
-
path: string;
|
|
190
|
-
importer: string;
|
|
191
|
-
namespace: string;
|
|
192
|
-
resolveDir: string;
|
|
193
|
-
kind: ImportKind;
|
|
194
|
-
pluginData: any;
|
|
195
|
-
}
|
|
196
|
-
export declare type ImportKind = 'entry-point' | 'import-statement' | 'require-call' | 'dynamic-import' | 'require-resolve' | 'import-rule' | 'url-token';
|
|
197
|
-
export interface OnResolveResult {
|
|
198
|
-
pluginName?: string;
|
|
199
|
-
errors?: PartialMessage[];
|
|
200
|
-
warnings?: PartialMessage[];
|
|
201
|
-
path?: string;
|
|
202
|
-
external?: boolean;
|
|
203
|
-
sideEffects?: boolean;
|
|
204
|
-
namespace?: string;
|
|
205
|
-
pluginData?: any;
|
|
206
|
-
watchFiles?: string[];
|
|
207
|
-
watchDirs?: string[];
|
|
208
|
-
}
|
|
209
|
-
export interface OnLoadOptions {
|
|
210
|
-
filter: RegExp;
|
|
211
|
-
namespace?: string;
|
|
212
|
-
}
|
|
213
|
-
export interface OnLoadArgs {
|
|
214
|
-
path: string;
|
|
215
|
-
namespace: string;
|
|
216
|
-
pluginData: any;
|
|
217
|
-
}
|
|
218
|
-
export interface OnLoadResult {
|
|
219
|
-
pluginName?: string;
|
|
220
|
-
errors?: PartialMessage[];
|
|
221
|
-
warnings?: PartialMessage[];
|
|
222
|
-
contents?: string | Uint8Array;
|
|
223
|
-
resolveDir?: string;
|
|
224
|
-
loader?: Loader;
|
|
225
|
-
pluginData?: any;
|
|
226
|
-
watchFiles?: string[];
|
|
227
|
-
watchDirs?: string[];
|
|
228
|
-
}
|
|
229
|
-
export interface PartialMessage {
|
|
230
|
-
pluginName?: string;
|
|
231
|
-
text?: string;
|
|
232
|
-
location?: Partial<Location> | null;
|
|
233
|
-
notes?: PartialNote[];
|
|
234
|
-
detail?: any;
|
|
235
|
-
}
|
|
236
|
-
export interface PartialNote {
|
|
237
|
-
text?: string;
|
|
238
|
-
location?: Partial<Location> | null;
|
|
239
|
-
}
|
|
240
|
-
export interface Metafile {
|
|
241
|
-
inputs: {
|
|
242
|
-
[path: string]: {
|
|
243
|
-
bytes: number;
|
|
244
|
-
imports: {
|
|
245
|
-
path: string;
|
|
246
|
-
kind: ImportKind;
|
|
247
|
-
}[];
|
|
248
|
-
};
|
|
249
|
-
};
|
|
250
|
-
outputs: {
|
|
251
|
-
[path: string]: {
|
|
252
|
-
bytes: number;
|
|
253
|
-
inputs: {
|
|
254
|
-
[path: string]: {
|
|
255
|
-
bytesInOutput: number;
|
|
256
|
-
};
|
|
257
|
-
};
|
|
258
|
-
imports: {
|
|
259
|
-
path: string;
|
|
260
|
-
kind: ImportKind;
|
|
261
|
-
}[];
|
|
262
|
-
exports: string[];
|
|
263
|
-
entryPoint?: string;
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
export interface FormatMessagesOptions {
|
|
268
|
-
kind: 'error' | 'warning';
|
|
269
|
-
color?: boolean;
|
|
270
|
-
terminalWidth?: number;
|
|
271
|
-
}
|
|
272
|
-
export interface AnalyzeMetafileOptions {
|
|
273
|
-
color?: boolean;
|
|
274
|
-
verbose?: boolean;
|
|
275
|
-
}
|
|
276
|
-
export declare function build(options: BuildOptions & {
|
|
277
|
-
write: false;
|
|
278
|
-
}): Promise<BuildResult & {
|
|
279
|
-
outputFiles: OutputFile[];
|
|
280
|
-
}>;
|
|
281
|
-
export declare function build(options: BuildOptions & {
|
|
282
|
-
incremental: true;
|
|
283
|
-
}): Promise<BuildIncremental>;
|
|
284
|
-
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
285
|
-
export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise<ServeResult>;
|
|
286
|
-
export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
|
|
287
|
-
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
|
|
288
|
-
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
|
|
289
|
-
export declare function buildSync(options: BuildOptions & {
|
|
290
|
-
write: false;
|
|
291
|
-
}): BuildResult & {
|
|
292
|
-
outputFiles: OutputFile[];
|
|
293
|
-
};
|
|
294
|
-
export declare function buildSync(options: BuildOptions): BuildResult;
|
|
295
|
-
export declare function transformSync(input: string, options?: TransformOptions): TransformResult;
|
|
296
|
-
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[];
|
|
297
|
-
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string;
|
|
298
|
-
export declare function initialize(options: InitializeOptions): Promise<void>;
|
|
299
|
-
export interface InitializeOptions {
|
|
300
|
-
wasmURL?: string;
|
|
301
|
-
worker?: boolean;
|
|
302
|
-
}
|
|
303
|
-
export declare let version: string;
|
|
304
|
-
export {};
|