提交 494395f6 编写于 作者: M Matt Bierner

Adding correct typings for event-stream this values

上级 86fbc62c
......@@ -64,7 +64,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena
filesystem.insertFile(relativePath, shouldUnpack, { stat: stat }, {}, onFileInserted);
};
return es.through(function (this: any, file) {
return es.through(function (file) {
if (file.stat.isDirectory()) {
return;
}
......@@ -88,7 +88,7 @@ export function createAsar(folderPath: string, unpackGlobs: string[], destFilena
// The file goes inside of xx.asar
out.push(file.contents);
}
}, function (this: any) {
}, function () {
let finish = () => {
{
......
......@@ -175,7 +175,7 @@ function monacodtsTask(out: string, isWatch: boolean): NodeJS.ReadWriteStream {
}));
}
resultStream = es.through(function (this: any, data) {
resultStream = es.through(function (data) {
const filePath = path.normalize(path.resolve(basePath, data.relative));
if (neededFiles[filePath]) {
setInputFile(filePath, data.contents.toString());
......
......@@ -150,11 +150,6 @@ function fromLocalNormal(extensionPath) {
.catch(function (err) { return result.emit('error', err); });
return result.pipe(stats_1.createStatsStream(path.basename(extensionPath)));
}
function error(err) {
var result = es.through();
setTimeout(function () { return result.emit('error', err); });
return result;
}
var baseHeaders = {
'X-Market-Client-Id': 'VSCode Build',
'User-Agent': 'VSCode Build',
......
......@@ -110,12 +110,12 @@ function fromLocalWebpack(extensionPath: string, sourceMappingURLBase: string |
let relativeOutputPath = path.relative(extensionPath, webpackConfig.output.path);
return webpackGulp(webpackConfig, webpack, webpackDone)
.pipe(es.through(function (this: any, data) {
.pipe(es.through(function (data) {
data.stat = data.stat || {};
data.base = extensionPath;
this.emit('data', data);
}))
.pipe(es.through(function (this: any, data: File) {
.pipe(es.through(function (data: File) {
// source map handling:
// * rewrite sourceMappingURL
// * save to disk so that upload-task picks this up
......
......@@ -79,20 +79,9 @@ var PackageJsonFormat;
}
PackageJsonFormat.is = is;
})(PackageJsonFormat || (PackageJsonFormat = {}));
var ModuleJsonFormat;
(function (ModuleJsonFormat) {
function is(value) {
var candidate = value;
return Is.defined(candidate)
&& Is.array(candidate.messages) && candidate.messages.every(function (message) { return Is.string(message); })
&& Is.array(candidate.keys) && candidate.keys.every(function (key) { return Is.string(key) || LocalizeInfo.is(key); });
}
ModuleJsonFormat.is = is;
})(ModuleJsonFormat || (ModuleJsonFormat = {}));
var Line = /** @class */ (function () {
function Line(indent) {
if (indent === void 0) { indent = 0; }
this.indent = indent;
this.buffer = [];
if (indent > 0) {
this.buffer.push(new Array(indent + 1).join(' '));
......@@ -375,7 +364,6 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
var messageSection = json.messages;
var bundleSection = json.bundles;
var statistics = Object.create(null);
var total = 0;
var defaultMessages = Object.create(null);
var modules = Object.keys(keysSection);
modules.forEach(function (module) {
......@@ -388,7 +376,6 @@ function processCoreBundleFormat(fileHeader, languages, json, emitter) {
var messageMap = Object.create(null);
defaultMessages[module] = messageMap;
keys.map(function (key, i) {
total++;
if (typeof key === 'string') {
messageMap[key] = messages[i];
}
......
......@@ -1064,7 +1064,7 @@ function pullXlfFiles(apiHostname: string, username: string, password: string, l
called = true;
const stream = this;
resources.map(function (resource) {
retrieveResource(language, resource, apiHostname, credentials).then((file: File) => {
retrieveResource(language, resource, apiHostname, credentials).then((file: File | null) => {
if (file) {
stream.emit('data', file);
}
......
declare module "event-stream" {
import { Stream } from 'stream';
import { ThroughStream as _ThroughStream} from 'through';
import { ThroughStream as _ThroughStream } from 'through';
import * as File from 'vinyl';
export interface ThroughStream extends _ThroughStream {
......@@ -14,14 +14,14 @@ declare module "event-stream" {
function concat(...stream: Stream[]): ThroughStream;
function duplex(istream: Stream, ostream: Stream): ThroughStream;
function through(write?: (data: any) => void, end?: () => void,
opts?: {autoDestroy: boolean; }): ThroughStream;
function through(write?: (this: ThroughStream, data: any) => void, end?: (this: ThroughStream) => void,
opts?: { autoDestroy: boolean; }): ThroughStream;
function readArray<T>(array: T[]): ThroughStream;
function writeArray<T>(cb: (err:Error, array:T[]) => void): ThroughStream;
function writeArray<T>(cb: (err: Error, array: T[]) => void): ThroughStream;
function mapSync<I,O>(cb: (data:I) => O): ThroughStream;
function map<I,O>(cb: (data:I, cb:(err?:Error, data?: O)=>void) => O): ThroughStream;
function mapSync<I, O>(cb: (data: I) => O): ThroughStream;
function map<I, O>(cb: (data: I, cb: (err?: Error, data?: O) => void) => O): ThroughStream;
function readable(asyncFunction: Function): any;
function readable(asyncFunction: (this: ThroughStream, ...args: any[]) => any): any;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册