mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Merge VS Code 1.30.1 (#4092)
This commit is contained in:
@@ -5,24 +5,25 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import * as es from 'event-stream';
|
||||
import * as gulp from 'gulp';
|
||||
import * as sourcemaps from 'gulp-sourcemaps';
|
||||
import * as filter from 'gulp-filter';
|
||||
import * as concat from 'gulp-concat';
|
||||
import * as minifyCSS from 'gulp-cssnano';
|
||||
import * as filter from 'gulp-filter';
|
||||
import * as flatmap from 'gulp-flatmap';
|
||||
import * as sourcemaps from 'gulp-sourcemaps';
|
||||
import * as uglify from 'gulp-uglify';
|
||||
import * as composer from 'gulp-uglify/composer';
|
||||
import * as uglifyes from 'uglify-es';
|
||||
import * as es from 'event-stream';
|
||||
import * as concat from 'gulp-concat';
|
||||
import * as VinylFile from 'vinyl';
|
||||
import * as bundle from './bundle';
|
||||
import * as util from './util';
|
||||
import * as gulpUtil from 'gulp-util';
|
||||
import * as flatmap from 'gulp-flatmap';
|
||||
import * as path from 'path';
|
||||
import * as pump from 'pump';
|
||||
import * as sm from 'source-map';
|
||||
import { Language } from './i18n';
|
||||
import * as uglifyes from 'uglify-es';
|
||||
import * as VinylFile from 'vinyl';
|
||||
import * as bundle from './bundle';
|
||||
import { Language, processNlsFiles } from './i18n';
|
||||
import { createStatsStream } from './stats';
|
||||
import * as util from './util';
|
||||
|
||||
const REPO_ROOT_PATH = path.join(__dirname, '../..');
|
||||
|
||||
@@ -32,7 +33,7 @@ function log(prefix: string, message: string): void {
|
||||
|
||||
// {{SQL CARBON EDIT}}
|
||||
export function loaderConfig(emptyPaths?: string[]) {
|
||||
const result = {
|
||||
const result: any = {
|
||||
paths: {
|
||||
'vs': 'out-build/vs',
|
||||
'sql': 'out-build/sql',
|
||||
@@ -72,7 +73,7 @@ function loader(src: string, bundledFileHeader: string, bundleLoader: boolean):
|
||||
isFirst = false;
|
||||
this.emit('data', new VinylFile({
|
||||
path: 'fake',
|
||||
base: '',
|
||||
base: undefined,
|
||||
contents: Buffer.from(bundledFileHeader)
|
||||
}));
|
||||
this.emit('data', data);
|
||||
@@ -112,7 +113,7 @@ function toConcatStream(src: string, bundledFileHeader: string, sources: bundle.
|
||||
|
||||
const treatedSources = sources.map(function (source) {
|
||||
const root = source.path ? REPO_ROOT_PATH.replace(/\\/g, '/') : '';
|
||||
const base = source.path ? root + `/${src}` : '';
|
||||
const base = source.path ? root + `/${src}` : undefined;
|
||||
|
||||
return new VinylFile({
|
||||
path: source.path ? root + '/' + source.path.replace(/\\/g, '/') : 'fake',
|
||||
@@ -123,10 +124,11 @@ function toConcatStream(src: string, bundledFileHeader: string, sources: bundle.
|
||||
|
||||
return es.readArray(treatedSources)
|
||||
.pipe(useSourcemaps ? util.loadSourcemaps() : es.through())
|
||||
.pipe(concat(dest));
|
||||
.pipe(concat(dest))
|
||||
.pipe(createStatsStream(dest));
|
||||
}
|
||||
|
||||
function toBundleStream(src:string, bundledFileHeader: string, bundles: bundle.IConcatFile[]): NodeJS.ReadWriteStream {
|
||||
function toBundleStream(src: string, bundledFileHeader: string, bundles: bundle.IConcatFile[]): NodeJS.ReadWriteStream {
|
||||
return es.merge(bundles.map(function (bundle) {
|
||||
return toConcatStream(src, bundledFileHeader, bundle.sources, bundle.dest);
|
||||
}));
|
||||
@@ -188,7 +190,7 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
||||
const bundleInfoStream = es.through(); // this stream will contain bundleInfo.json
|
||||
|
||||
bundle.bundle(entryPoints, loaderConfig, function (err, result) {
|
||||
if (err) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
||||
if (err || !result) { return bundlesStream.emit('error', JSON.stringify(err)); }
|
||||
|
||||
toBundleStream(src, bundledFileHeader, result.files).pipe(bundlesStream);
|
||||
|
||||
@@ -237,10 +239,14 @@ export function optimizeTask(opts: IOptimizeTaskOpts): () => NodeJS.ReadWriteStr
|
||||
|
||||
return result
|
||||
.pipe(sourcemaps.write('./', {
|
||||
sourceRoot: null,
|
||||
sourceRoot: undefined,
|
||||
addComment: true,
|
||||
includeContent: true
|
||||
}))
|
||||
.pipe(opts.languages && opts.languages.length ? processNlsFiles({
|
||||
fileHeader: bundledFileHeader,
|
||||
languages: opts.languages
|
||||
}) : es.through())
|
||||
.pipe(gulp.dest(out));
|
||||
};
|
||||
}
|
||||
@@ -254,7 +260,7 @@ declare class FileWithCopyright extends VinylFile {
|
||||
*/
|
||||
function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
||||
const preserveComments = (f: FileWithCopyright) => {
|
||||
return (node, comment: { value: string; type: string; }) => {
|
||||
return (_node: any, comment: { value: string; type: string; }) => {
|
||||
const text = comment.value;
|
||||
const type = comment.type;
|
||||
|
||||
@@ -282,7 +288,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
||||
};
|
||||
};
|
||||
|
||||
const minify = composer(uglifyes);
|
||||
const minify = (composer as any)(uglifyes);
|
||||
const input = es.through();
|
||||
const output = input
|
||||
.pipe(flatmap((stream, f) => {
|
||||
@@ -298,7 +304,7 @@ function uglifyWithCopyrights(): NodeJS.ReadWriteStream {
|
||||
}
|
||||
|
||||
export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) => void {
|
||||
const sourceMappingURL = sourceMapBaseUrl && (f => `${sourceMapBaseUrl}/${f.relative}.map`);
|
||||
const sourceMappingURL = sourceMapBaseUrl ? ((f: any) => `${sourceMapBaseUrl}/${f.relative}.map`) : undefined;
|
||||
|
||||
return cb => {
|
||||
const jsFilter = filter('**/*.js', { restore: true });
|
||||
@@ -315,13 +321,13 @@ export function minifyTask(src: string, sourceMapBaseUrl?: string): (cb: any) =>
|
||||
cssFilter.restore,
|
||||
sourcemaps.write('./', {
|
||||
sourceMappingURL,
|
||||
sourceRoot: null,
|
||||
sourceRoot: undefined,
|
||||
includeContent: true,
|
||||
addComment: true
|
||||
}),
|
||||
} as any),
|
||||
gulp.dest(src + '-min')
|
||||
, (err: any) => {
|
||||
if (err instanceof uglify.GulpUglifyError) {
|
||||
if (err instanceof (uglify as any).GulpUglifyError) {
|
||||
console.error(`Uglify error in '${err.cause && err.cause.filename}'`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user