Skip to content

Commit

Permalink
Files open now
Browse files Browse the repository at this point in the history
  • Loading branch information
code-asher authored and kylecarbs committed Feb 5, 2019
1 parent 3f51dcf commit 2dced39
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 19 deletions.
1 change: 1 addition & 0 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"build:bootstrap-fork": "../../node_modules/.bin/webpack --config ./webpack.config.bootstrap.js"
},
"dependencies": {
"iconv-lite": "^0.4.24",
"spdlog": "^0.7.2",
"string-replace-loader": "^2.1.1"
}
Expand Down
65 changes: 65 additions & 0 deletions packages/vscode/src/fill/iconv-lite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import * as iconv from "../../node_modules/iconv-lite";
import { Transform, TransformCallback } from "stream";

class IconvLiteDecoderStream extends Transform {

// tslint:disable-next-line no-any
private conv: any;
private encoding: string;

public constructor(options: { encoding: string }) {
super(options);
// tslint:disable-next-line no-any
this.conv = (iconv as any).getDecoder(options.encoding, undefined);
options.encoding = this.encoding = "utf8";
}

// tslint:disable-next-line no-any
public _transform(chunk: any, _encoding: string, done: TransformCallback): void {
if (!Buffer.isBuffer(chunk)) {
return done(new Error("Iconv decoding stream needs buffers as its input."));
}
try {
const res = this.conv.write(chunk);
if (res && res.length) {
this.push(res, this.encoding);
}
done();
} catch (error) {
done(error);
}
}

public _flush(done: TransformCallback): void {
try {
const res = this.conv.end();
if (res && res.length) {
this.push(res, this.encoding);
}
done();
} catch (error) {
done(error);
}
}

// tslint:disable-next-line no-any
public collect(cb: (error: Error | null, response?: any) => void): this {
let res = "";
this.on("error", cb);
this.on("data", (chunk) => res += chunk);
this.on("end", () => {
cb(null, res);
});

return this;
}
}

const decodeStream = (encoding: string): NodeJS.ReadWriteStream => {
return new IconvLiteDecoderStream({ encoding });
};

// @ts-ignore
iconv.decodeStream = decodeStream;

export = iconv;
20 changes: 4 additions & 16 deletions packages/vscode/webpack.config.bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
const path = require("path");
const webpack = require("webpack");

const root = path.resolve(__dirname, "..", "..");
const fills = path.join(root, "packages", "ide", "src", "fill");
const vscodeFills = path.join(root, "packages", "vscode", "src", "fill");
const root = path.resolve(__dirname, "../..");
const fills = path.join(root, "packages/ide/src/fill");
const vscodeFills = path.join(root, "packages/vscode/src/fill");

const merge = require("webpack-merge");

module.exports = (env) => {
const afterCompileCommand = env && env.afterCompileCommand;
return merge(require(path.join(root, "scripts", "webpack.general.config.js"))({
return merge(require(path.join(root, "scripts/webpack.general.config.js"))({
typescriptCompilerOptions: {
target: "es5",
},
Expand Down Expand Up @@ -77,16 +76,5 @@ module.exports = (env) => {
"vs/css": path.resolve(vscodeFills, "css.js"),
},
},
plugins: [
new webpack.ProgressPlugin((percentage, msg) => {
if (percentage === 1) {
if (afterCompileCommand) {
require("child_process").execSync(afterCompileCommand, {
stdio: "inherit"
});
}
}
}),
],
});
};
12 changes: 12 additions & 0 deletions packages/vscode/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ fast-json-stable-stringify@^2.0.0:
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=

iconv-lite@^0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
dependencies:
safer-buffer ">= 2.1.2 < 3"

json-schema-traverse@^0.4.1:
version "0.4.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
Expand Down Expand Up @@ -90,6 +97,11 @@ punycode@^2.1.0:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

"safer-buffer@>= 2.1.2 < 3":
version "2.1.2"
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

schema-utils@^0.4.5:
version "0.4.7"
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"
Expand Down
7 changes: 4 additions & 3 deletions packages/web/webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const PreloadWebpackPlugin = require("preload-webpack-plugin");
const root = path.resolve(__dirname, "..", "..");
const fills = path.join(root, "packages", "ide", "src", "fill");
const vsFills = path.join(root, "packages", "vscode", "src", "fill");
const root = path.resolve(__dirname, "../..");
const fills = path.join(root, "packages/ide/src/fill");
const vsFills = path.join(root, "packages/vscode/src/fill");

const merge = require("webpack-merge");

Expand Down Expand Up @@ -74,6 +74,7 @@ module.exports = merge({
"node-pty": path.join(vsFills, "node-pty.ts"),
"graceful-fs": path.join(vsFills, "graceful-fs.ts"),
"spdlog": path.join(vsFills, "spdlog.ts"),
"iconv-lite": path.join(vsFills, "iconv-lite.ts"),

"vs/base/node/paths": path.join(vsFills, "paths.ts"),
"vs/base/common/amd": path.join(vsFills, "amd.ts"),
Expand Down

0 comments on commit 2dced39

Please sign in to comment.