From 38fbec9568b21234a259ff2a829171f7f7105082 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Wed, 3 Oct 2018 11:00:38 -0700 Subject: [PATCH] Converting some `require` imports to `import from` imports This ensures we pick up the correct typings for these imports --- build/lib/bundle.ts | 6 +++--- build/lib/i18n.js | 6 +++--- build/lib/i18n.ts | 8 ++++---- build/lib/nls.ts | 4 ++-- build/monaco/api.js | 2 +- build/monaco/api.ts | 9 +++++---- build/tfs/common/installDistro.ts | 6 +++--- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build/lib/bundle.ts b/build/lib/bundle.ts index f5308b36770..3b899ae8656 100644 --- a/build/lib/bundle.ts +++ b/build/lib/bundle.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import fs = require('fs'); -import path = require('path'); -import vm = require('vm'); +import * as fs from 'fs'; +import * as path from 'path'; +import * as vm from 'vm'; interface IPosition { line: number; diff --git a/build/lib/i18n.js b/build/lib/i18n.js index 1bf5d9f7628..85ae97a697a 100644 --- a/build/lib/i18n.js +++ b/build/lib/i18n.js @@ -13,8 +13,8 @@ var xml2js = require("xml2js"); var glob = require("glob"); var https = require("https"); var gulp = require("gulp"); -var util = require('gulp-util'); -var iconv = require('iconv-lite'); +var util = require("gulp-util"); +var iconv = require("iconv-lite"); var NUMBER_OF_CONCURRENT_DOWNLOADS = 4; function log(message) { var rest = []; @@ -1192,7 +1192,7 @@ function createIslFile(originalFilePath, messages, language, innoSetup) { var filePath = basename + "." + language.id + ".isl"; return new File({ path: filePath, - contents: iconv.encode(Buffer.from(content.join('\r\n'), 'utf8'), innoSetup.codePage) + contents: iconv.encode(Buffer.from(content.join('\r\n'), 'utf8').toString(), innoSetup.codePage) }); } function encodeEntities(value) { diff --git a/build/lib/i18n.ts b/build/lib/i18n.ts index ef0487b0b96..7a6e77d8204 100644 --- a/build/lib/i18n.ts +++ b/build/lib/i18n.ts @@ -7,15 +7,15 @@ import * as path from 'path'; import * as fs from 'fs'; import { through, readable, ThroughStream } from 'event-stream'; -import File = require('vinyl'); +import * as File from 'vinyl'; import * as Is from 'is'; import * as xml2js from 'xml2js'; import * as glob from 'glob'; import * as https from 'https'; import * as gulp from 'gulp'; -var util = require('gulp-util'); -var iconv = require('iconv-lite'); +import * as util from 'gulp-util'; +import * as iconv from 'iconv-lite'; const NUMBER_OF_CONCURRENT_DOWNLOADS = 4; @@ -1331,7 +1331,7 @@ function createIslFile(originalFilePath: string, messages: Map, language return new File({ path: filePath, - contents: iconv.encode(Buffer.from(content.join('\r\n'), 'utf8'), innoSetup.codePage) + contents: iconv.encode(Buffer.from(content.join('\r\n'), 'utf8').toString(), innoSetup.codePage) }); } diff --git a/build/lib/nls.ts b/build/lib/nls.ts index 09885b4ad5b..cd5f120b0e2 100644 --- a/build/lib/nls.ts +++ b/build/lib/nls.ts @@ -6,10 +6,10 @@ import * as ts from 'typescript'; import * as lazy from 'lazy.js'; import { duplex, through } from 'event-stream'; -import File = require('vinyl'); +import * as File from 'vinyl'; import * as sm from 'source-map'; import assign = require('object-assign'); -import path = require('path'); +import * as path from 'path'; declare class FileSourceMap extends File { public sourceMap: sm.RawSourceMap; diff --git a/build/monaco/api.js b/build/monaco/api.js index 96581b76dad..3861b914d28 100644 --- a/build/monaco/api.js +++ b/build/monaco/api.js @@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); var fs = require("fs"); var ts = require("typescript"); var path = require("path"); +var util = require("gulp-util"); var tsfmt = require('../../tsfmt.json'); -var util = require('gulp-util'); function log(message) { var rest = []; for (var _i = 1; _i < arguments.length; _i++) { diff --git a/build/monaco/api.ts b/build/monaco/api.ts index 402371af8d4..98489307bac 100644 --- a/build/monaco/api.ts +++ b/build/monaco/api.ts @@ -3,12 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import fs = require('fs'); -import ts = require('typescript'); -import path = require('path'); +import * as fs from 'fs'; +import * as ts from 'typescript'; +import * as path from 'path'; +import * as util from 'gulp-util'; + const tsfmt = require('../../tsfmt.json'); -var util = require('gulp-util'); function log(message: any, ...rest: any[]): void { util.log(util.colors.cyan('[monaco.d.ts]'), message, ...rest); } diff --git a/build/tfs/common/installDistro.ts b/build/tfs/common/installDistro.ts index 7d54a896e5d..3cb97afd273 100644 --- a/build/tfs/common/installDistro.ts +++ b/build/tfs/common/installDistro.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -const cp = require('child_process'); +import * as cp from 'child_process'; -function yarnInstall(package: string): void { - cp.execSync(`yarn add --no-lockfile ${package}`); +function yarnInstall(packageName: string): void { + cp.execSync(`yarn add --no-lockfile ${packageName}`); } const product = require('../../../product.json');