Skip to content

Commit 4b03030

Browse files
authored
Merge pull request microsoft#230238 from microsoft/joh/super-monkey
add esbuild transpiler for fast CI
2 parents 1c7c331 + 6e4221f commit 4b03030

File tree

13 files changed

+112
-356
lines changed

13 files changed

+112
-356
lines changed

build/azure-pipelines/darwin/product-build-darwin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ steps:
161161
displayName: Build server (web)
162162
163163
- ${{ else }}:
164-
- script: npm run gulp transpile-client-swc transpile-extensions
164+
- script: npm run gulp transpile-client-esbuild transpile-extensions
165165
env:
166166
GITHUB_TOKEN: "$(github-distro-mixin-password)"
167167
displayName: Transpile

build/azure-pipelines/linux/product-build-linux.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ steps:
275275
displayName: Check GLIBC and GLIBCXX dependencies in server archive
276276
277277
- ${{ else }}:
278-
- script: npm run gulp "transpile-client-swc" "transpile-extensions"
278+
- script: npm run gulp "transpile-client-esbuild" "transpile-extensions"
279279
env:
280280
GITHUB_TOKEN: "$(github-distro-mixin-password)"
281281
displayName: Transpile client and extensions

build/azure-pipelines/win32/product-build-win32.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ steps:
129129
retryCountOnTaskFailure: 3
130130

131131
- ${{ if eq(parameters.VSCODE_QUALITY, 'oss') }}:
132-
- powershell: npm run gulp "transpile-client-swc" "transpile-extensions"
132+
- powershell: npm run gulp "transpile-client-esbuild" "transpile-extensions"
133133
env:
134134
GITHUB_TOKEN: "$(github-distro-mixin-password)"
135135
displayName: Transpile client and extensions

build/gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ gulp.task(compileApiProposalNamesTask);
2020
gulp.task(watchApiProposalNamesTask);
2121

2222
// SWC Client Transpile
23-
const transpileClientSWCTask = task.define('transpile-client-swc', task.series(util.rimraf('out'), transpileTask('src', 'out', true)));
23+
const transpileClientSWCTask = task.define('transpile-client-esbuild', task.series(util.rimraf('out'), transpileTask('src', 'out', true)));
2424
gulp.task(transpileClientSWCTask);
2525

2626
// Transpile only

build/lib/compilation.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/compilation.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import * as util from './util';
1414
import * as fancyLog from 'fancy-log';
1515
import * as ansiColors from 'ansi-colors';
1616
import * as os from 'os';
17-
import ts = require('typescript');
1817
import * as File from 'vinyl';
1918
import * as task from './task';
2019
import { Mangler } from './mangle/index';
2120
import { RawSourceMap } from 'source-map';
2221
import { gulpPostcss } from './postcss';
22+
import ts = require('typescript');
2323
const watch = require('./watch');
2424

2525

@@ -45,7 +45,7 @@ function getTypeScriptCompilerOptions(src: string): ts.CompilerOptions {
4545
interface ICompileTaskOptions {
4646
readonly build: boolean;
4747
readonly emitError: boolean;
48-
readonly transpileOnly: boolean | { swc: boolean };
48+
readonly transpileOnly: boolean | { esbuild: boolean };
4949
readonly preserveEnglish: boolean;
5050
}
5151

@@ -63,7 +63,7 @@ function createCompile(src: string, { build, emitError, transpileOnly, preserveE
6363
const compilation = tsb.create(projectPath, overrideOptions, {
6464
verbose: false,
6565
transpileOnly: Boolean(transpileOnly),
66-
transpileWithSwc: typeof transpileOnly !== 'boolean' && transpileOnly.swc
66+
transpileWithSwc: typeof transpileOnly !== 'boolean' && transpileOnly.esbuild
6767
}, err => reporter(err));
6868

6969
function pipeline(token?: util.ICancellationToken) {
@@ -105,11 +105,11 @@ function createCompile(src: string, { build, emitError, transpileOnly, preserveE
105105
return pipeline;
106106
}
107107

108-
export function transpileTask(src: string, out: string, swc: boolean): task.StreamTask {
108+
export function transpileTask(src: string, out: string, esbuild: boolean): task.StreamTask {
109109

110110
const task = () => {
111111

112-
const transpile = createCompile(src, { build: false, emitError: true, transpileOnly: { swc }, preserveEnglish: false });
112+
const transpile = createCompile(src, { build: false, emitError: true, transpileOnly: { esbuild }, preserveEnglish: false });
113113
const srcPipe = gulp.src(`${src}/**`, { base: `${src}` });
114114

115115
return srcPipe

build/lib/tsb/index.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/lib/tsb/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { dirname } from 'path';
1212
import { strings } from './utils';
1313
import { readFileSync, statSync } from 'fs';
1414
import * as log from 'fancy-log';
15+
import { ESBuildTranspiler, ITranspiler, TscTranspiler } from './transpiler';
1516
import colors = require('ansi-colors');
16-
import { ITranspiler, SwcTranspiler, TscTranspiler } from './transpiler';
1717

1818
export interface IncrementalCompiler {
1919
(token?: any): Readable & Writable;
@@ -130,7 +130,7 @@ export function create(
130130
if (config.transpileOnly) {
131131
const transpiler = !config.transpileWithSwc
132132
? new TscTranspiler(logFn, printDiagnostic, projectPath, cmdLine)
133-
: new SwcTranspiler(logFn, printDiagnostic, projectPath, cmdLine);
133+
: new ESBuildTranspiler(logFn, printDiagnostic, projectPath, cmdLine);
134134
result = <any>(() => createTranspileStream(transpiler));
135135
} else {
136136
const _builder = builder.createTypeScriptBuilder({ logFn }, projectPath, cmdLine);

build/lib/tsb/transpiler.js

+44-68
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)