Skip to content

Commit b62a07c

Browse files
committed
Begin Electron rewrite
1 parent dc59f80 commit b62a07c

39 files changed

+17141
-1370
lines changed

.gitignore

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
/target
2-
**/*.rs.bk
1+
# dependencies
2+
/node_modules
3+
/.pnp
4+
.pnp.js
5+
.yarn/*
6+
!.yarn/releases
7+
!.yarn/plugins
8+
!.yarn/sdks
9+
!.yarn/versions
10+
11+
# testing
12+
/coverage
13+
14+
# production
15+
/build
16+
17+
# misc
18+
.DS_Store
19+
.env.local
20+
.env.development.local
21+
.env.test.local
22+
.env.production.local
23+
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"search.exclude": {
3+
"**/.yarn": true,
4+
"**/.pnp.*": true
5+
},
6+
"typescript.tsdk": ".yarn/sdks/typescript/lib",
7+
"typescript.enablePromptUseWorkspaceTsdk": true
8+
}

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 38 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/plugins/@yarnpkg/plugin-typescript.cjs

Lines changed: 8 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-berry.cjs

Lines changed: 55 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/sdks/integrations.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is automatically generated by PnPify.
2+
# Manual changes will be lost!
3+
4+
integrations:
5+
- vscode

.yarn/sdks/typescript/bin/tsc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, createRequireFromPath} = require(`module`);
5+
const {resolve} = require(`path`);
6+
7+
const relPnpApiPath = "../../../../.pnp.js";
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require typescript/bin/tsc
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real typescript/bin/tsc your application uses
20+
module.exports = absRequire(`typescript/bin/tsc`);

.yarn/sdks/typescript/bin/tsserver

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, createRequireFromPath} = require(`module`);
5+
const {resolve} = require(`path`);
6+
7+
const relPnpApiPath = "../../../../.pnp.js";
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require typescript/bin/tsserver
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real typescript/bin/tsserver your application uses
20+
module.exports = absRequire(`typescript/bin/tsserver`);

.yarn/sdks/typescript/lib/tsc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, createRequireFromPath} = require(`module`);
5+
const {resolve} = require(`path`);
6+
7+
const relPnpApiPath = "../../../../.pnp.js";
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
if (existsSync(absPnpApiPath)) {
13+
if (!process.versions.pnp) {
14+
// Setup the environment to be able to require typescript/lib/tsc.js
15+
require(absPnpApiPath).setup();
16+
}
17+
}
18+
19+
// Defer to the real typescript/lib/tsc.js your application uses
20+
module.exports = absRequire(`typescript/lib/tsc.js`);

.yarn/sdks/typescript/lib/tsserver.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env node
2+
3+
const {existsSync} = require(`fs`);
4+
const {createRequire, createRequireFromPath} = require(`module`);
5+
const {resolve} = require(`path`);
6+
7+
const relPnpApiPath = "../../../../.pnp.js";
8+
9+
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
10+
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);
11+
12+
const moduleWrapper = tsserver => {
13+
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
14+
// doesn't understand. This layer makes sure to remove the protocol
15+
// before forwarding it to TS, and to add it back on all returned paths.
16+
17+
const {isAbsolute} = require(`path`);
18+
19+
const Session = tsserver.server.Session;
20+
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
21+
22+
return Object.assign(Session.prototype, {
23+
onMessage(/** @type {string} */ message) {
24+
return originalOnMessage.call(this, JSON.stringify(JSON.parse(message), (key, value) => {
25+
return typeof value === 'string' ? removeZipPrefix(value) : value;
26+
}));
27+
},
28+
29+
send(/** @type {any} */ msg) {
30+
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
31+
return typeof value === 'string' ? addZipPrefix(value) : value;
32+
})));
33+
}
34+
});
35+
36+
function addZipPrefix(str) {
37+
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
38+
if (isAbsolute(str) && !str.match(/^zip:/) && (str.match(/\.zip\//) || str.match(/\$\$virtual\//))) {
39+
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
40+
// VSCode only adds it automatically for supported schemes,
41+
// so we have to do it manually for the `zip` scheme.
42+
return `zip:${str.replace(/^\/?/, `/`)}`;
43+
} else {
44+
return str;
45+
}
46+
}
47+
48+
function removeZipPrefix(str) {
49+
return process.platform === 'win32'
50+
? str.replace(/^zip:\//, ``)
51+
: str.replace(/^zip:/, ``);
52+
}
53+
};
54+
55+
if (existsSync(absPnpApiPath)) {
56+
if (!process.versions.pnp) {
57+
// Setup the environment to be able to require typescript/lib/tsserver.js
58+
require(absPnpApiPath).setup();
59+
}
60+
}
61+
62+
// Defer to the real typescript/lib/tsserver.js your application uses
63+
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));

0 commit comments

Comments
 (0)