Skip to content

Commit 2dced39

Browse files
code-asherkylecarbs
authored andcommitted
Files open now
1 parent 3f51dcf commit 2dced39

File tree

5 files changed

+86
-19
lines changed

5 files changed

+86
-19
lines changed

packages/vscode/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"build:bootstrap-fork": "../../node_modules/.bin/webpack --config ./webpack.config.bootstrap.js"
77
},
88
"dependencies": {
9+
"iconv-lite": "^0.4.24",
910
"spdlog": "^0.7.2",
1011
"string-replace-loader": "^2.1.1"
1112
}
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import * as iconv from "../../node_modules/iconv-lite";
2+
import { Transform, TransformCallback } from "stream";
3+
4+
class IconvLiteDecoderStream extends Transform {
5+
6+
// tslint:disable-next-line no-any
7+
private conv: any;
8+
private encoding: string;
9+
10+
public constructor(options: { encoding: string }) {
11+
super(options);
12+
// tslint:disable-next-line no-any
13+
this.conv = (iconv as any).getDecoder(options.encoding, undefined);
14+
options.encoding = this.encoding = "utf8";
15+
}
16+
17+
// tslint:disable-next-line no-any
18+
public _transform(chunk: any, _encoding: string, done: TransformCallback): void {
19+
if (!Buffer.isBuffer(chunk)) {
20+
return done(new Error("Iconv decoding stream needs buffers as its input."));
21+
}
22+
try {
23+
const res = this.conv.write(chunk);
24+
if (res && res.length) {
25+
this.push(res, this.encoding);
26+
}
27+
done();
28+
} catch (error) {
29+
done(error);
30+
}
31+
}
32+
33+
public _flush(done: TransformCallback): void {
34+
try {
35+
const res = this.conv.end();
36+
if (res && res.length) {
37+
this.push(res, this.encoding);
38+
}
39+
done();
40+
} catch (error) {
41+
done(error);
42+
}
43+
}
44+
45+
// tslint:disable-next-line no-any
46+
public collect(cb: (error: Error | null, response?: any) => void): this {
47+
let res = "";
48+
this.on("error", cb);
49+
this.on("data", (chunk) => res += chunk);
50+
this.on("end", () => {
51+
cb(null, res);
52+
});
53+
54+
return this;
55+
}
56+
}
57+
58+
const decodeStream = (encoding: string): NodeJS.ReadWriteStream => {
59+
return new IconvLiteDecoderStream({ encoding });
60+
};
61+
62+
// @ts-ignore
63+
iconv.decodeStream = decodeStream;
64+
65+
export = iconv;

packages/vscode/webpack.config.bootstrap.js

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
const path = require("path");
22
const webpack = require("webpack");
33

4-
const root = path.resolve(__dirname, "..", "..");
5-
const fills = path.join(root, "packages", "ide", "src", "fill");
6-
const vscodeFills = path.join(root, "packages", "vscode", "src", "fill");
4+
const root = path.resolve(__dirname, "../..");
5+
const fills = path.join(root, "packages/ide/src/fill");
6+
const vscodeFills = path.join(root, "packages/vscode/src/fill");
77

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

1010
module.exports = (env) => {
11-
const afterCompileCommand = env && env.afterCompileCommand;
12-
return merge(require(path.join(root, "scripts", "webpack.general.config.js"))({
11+
return merge(require(path.join(root, "scripts/webpack.general.config.js"))({
1312
typescriptCompilerOptions: {
1413
target: "es5",
1514
},
@@ -77,16 +76,5 @@ module.exports = (env) => {
7776
"vs/css": path.resolve(vscodeFills, "css.js"),
7877
},
7978
},
80-
plugins: [
81-
new webpack.ProgressPlugin((percentage, msg) => {
82-
if (percentage === 1) {
83-
if (afterCompileCommand) {
84-
require("child_process").execSync(afterCompileCommand, {
85-
stdio: "inherit"
86-
});
87-
}
88-
}
89-
}),
90-
],
9179
});
9280
};

packages/vscode/yarn.lock

+12
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ fast-json-stable-stringify@^2.0.0:
4242
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
4343
integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I=
4444

45+
iconv-lite@^0.4.24:
46+
version "0.4.24"
47+
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
48+
integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==
49+
dependencies:
50+
safer-buffer ">= 2.1.2 < 3"
51+
4552
json-schema-traverse@^0.4.1:
4653
version "0.4.1"
4754
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660"
@@ -90,6 +97,11 @@ punycode@^2.1.0:
9097
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
9198
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==
9299

100+
"safer-buffer@>= 2.1.2 < 3":
101+
version "2.1.2"
102+
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
103+
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
104+
93105
schema-utils@^0.4.5:
94106
version "0.4.7"
95107
resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187"

packages/web/webpack.common.config.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ const path = require("path");
22
const HtmlWebpackPlugin = require("html-webpack-plugin");
33
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
44
const PreloadWebpackPlugin = require("preload-webpack-plugin");
5-
const root = path.resolve(__dirname, "..", "..");
6-
const fills = path.join(root, "packages", "ide", "src", "fill");
7-
const vsFills = path.join(root, "packages", "vscode", "src", "fill");
5+
const root = path.resolve(__dirname, "../..");
6+
const fills = path.join(root, "packages/ide/src/fill");
7+
const vsFills = path.join(root, "packages/vscode/src/fill");
88

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

@@ -74,6 +74,7 @@ module.exports = merge({
7474
"node-pty": path.join(vsFills, "node-pty.ts"),
7575
"graceful-fs": path.join(vsFills, "graceful-fs.ts"),
7676
"spdlog": path.join(vsFills, "spdlog.ts"),
77+
"iconv-lite": path.join(vsFills, "iconv-lite.ts"),
7778

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

0 commit comments

Comments
 (0)