@vscode/test-web 0.0.13 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarnrc +1 -0
- package/CHANGELOG.md +19 -0
- package/README.md +45 -28
- package/fs-provider/dist/extension-web.js +273 -273
- package/fs-provider/dist/fsExtensionMain.js +311 -283
- package/fs-provider/package.json +4 -4
- package/out/index.d.ts +106 -68
- package/out/index.js +365 -233
- package/out/server/app.js +49 -38
- package/out/server/download.js +171 -171
- package/out/server/extensions.js +53 -45
- package/out/server/main.js +15 -15
- package/out/server/mounts.js +78 -78
- package/out/server/workbench.js +112 -147
- package/package.json +3 -3
- package/views/workbench.html +6 -0
package/out/server/app.js
CHANGED
|
@@ -1,38 +1,49 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const Koa = require("koa");
|
|
8
|
-
const morgan = require("koa-morgan");
|
|
9
|
-
const kstatic = require("koa-static");
|
|
10
|
-
const kmount = require("koa-mount");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const mounts_1 = require("./mounts");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
app
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const Koa = require("koa");
|
|
8
|
+
const morgan = require("koa-morgan");
|
|
9
|
+
const kstatic = require("koa-static");
|
|
10
|
+
const kmount = require("koa-mount");
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const workbench_1 = require("./workbench");
|
|
13
|
+
const mounts_1 = require("./mounts");
|
|
14
|
+
const extensions_1 = require("./extensions");
|
|
15
|
+
async function createApp(config) {
|
|
16
|
+
const app = new Koa();
|
|
17
|
+
if (!config.hideServerLog) {
|
|
18
|
+
app.use(morgan('dev'));
|
|
19
|
+
}
|
|
20
|
+
// this is here such that the iframe worker can fetch the extension files
|
|
21
|
+
app.use((ctx, next) => {
|
|
22
|
+
ctx.set('Access-Control-Allow-Origin', '*');
|
|
23
|
+
return next();
|
|
24
|
+
});
|
|
25
|
+
const serveOptions = { hidden: true };
|
|
26
|
+
if (config.extensionDevelopmentPath) {
|
|
27
|
+
console.log('Serving dev extensions from ' + config.extensionDevelopmentPath);
|
|
28
|
+
app.use(kmount('/static/devextensions', kstatic(config.extensionDevelopmentPath, serveOptions)));
|
|
29
|
+
}
|
|
30
|
+
if (config.build.type === 'static') {
|
|
31
|
+
app.use(kmount('/static/build', kstatic(config.build.location, serveOptions)));
|
|
32
|
+
}
|
|
33
|
+
else if (config.build.type === 'sources') {
|
|
34
|
+
app.use(kmount('/static/sources', kstatic(config.build.location, serveOptions)));
|
|
35
|
+
app.use(kmount('/static/sources', kstatic((0, path_1.join)(config.build.location, 'resources', 'server'), serveOptions))); // for manifest.json, favicon and code icons.
|
|
36
|
+
// built-in extension are at 'extensions` as well as prebuilt extensions dowloaded from the marketplace
|
|
37
|
+
app.use(kmount(`/static/sources/extensions`, kstatic((0, path_1.join)(config.build.location, extensions_1.prebuiltExtensionsLocation), serveOptions)));
|
|
38
|
+
}
|
|
39
|
+
(0, mounts_1.configureMounts)(config, app);
|
|
40
|
+
if (config.extensionPaths) {
|
|
41
|
+
config.extensionPaths.forEach((extensionPath, index) => {
|
|
42
|
+
console.log('Serving additional built-in extensions from ' + extensionPath);
|
|
43
|
+
app.use(kmount(`/static/extensions/${index}`, kstatic(extensionPath, serveOptions)));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
app.use((0, workbench_1.default)(config));
|
|
47
|
+
return app;
|
|
48
|
+
}
|
|
49
|
+
exports.default = createApp;
|
package/out/server/download.js
CHANGED
|
@@ -1,171 +1,171 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.fileExists = exports.directoryExists = exports.fetchJSON = exports.fetch = exports.downloadAndUnzipVSCode = void 0;
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const path = require("path");
|
|
10
|
-
const https = require("https");
|
|
11
|
-
const http = require("http");
|
|
12
|
-
const createHttpsProxyAgent = require("https-proxy-agent");
|
|
13
|
-
const createHttpProxyAgent = require("http-proxy-agent");
|
|
14
|
-
const url_1 = require("url");
|
|
15
|
-
const decompress = require("decompress");
|
|
16
|
-
const decompressTargz = require("decompress-targz");
|
|
17
|
-
const extensionRoot = process.cwd();
|
|
18
|
-
const vscodeTestDir = path.resolve(extensionRoot, '.vscode-test-web');
|
|
19
|
-
async function getLatestVersion(quality) {
|
|
20
|
-
const update = await fetchJSON(`https://update.code.visualstudio.com/api/update/web-standalone/${quality}/latest`);
|
|
21
|
-
return update;
|
|
22
|
-
}
|
|
23
|
-
const reset = '\x1b[G\x1b[0K';
|
|
24
|
-
async function download(downloadUrl, destination, message) {
|
|
25
|
-
process.stdout.write(message);
|
|
26
|
-
return new Promise((resolve, reject) => {
|
|
27
|
-
const httpLibrary = downloadUrl.startsWith('https') ? https : http;
|
|
28
|
-
httpLibrary.get(downloadUrl, getAgent(downloadUrl), res => {
|
|
29
|
-
const total = Number(res.headers['content-length']);
|
|
30
|
-
let received = 0;
|
|
31
|
-
let timeout;
|
|
32
|
-
const outStream = (0, fs_1.createWriteStream)(destination);
|
|
33
|
-
outStream.on('close', () => resolve(destination));
|
|
34
|
-
outStream.on('error', reject);
|
|
35
|
-
res.on('data', chunk => {
|
|
36
|
-
if (!timeout) {
|
|
37
|
-
timeout = setTimeout(() => {
|
|
38
|
-
process.stdout.write(`${reset}${message}: ${received}/${total} (${(received / total * 100).toFixed()}%)`);
|
|
39
|
-
timeout = undefined;
|
|
40
|
-
}, 100);
|
|
41
|
-
}
|
|
42
|
-
received += chunk.length;
|
|
43
|
-
});
|
|
44
|
-
res.on('end', () => {
|
|
45
|
-
if (timeout) {
|
|
46
|
-
clearTimeout(timeout);
|
|
47
|
-
}
|
|
48
|
-
process.stdout.write(`${reset}${message}: complete\n`);
|
|
49
|
-
});
|
|
50
|
-
res.on('error', reject);
|
|
51
|
-
res.pipe(outStream);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
async function unzip(source, destination, message) {
|
|
56
|
-
process.stdout.write(message);
|
|
57
|
-
if (!(0, fs_1.existsSync)(destination)) {
|
|
58
|
-
await fs_1.promises.mkdir(destination, { recursive: true });
|
|
59
|
-
}
|
|
60
|
-
await decompress(source, destination, {
|
|
61
|
-
plugins: [
|
|
62
|
-
decompressTargz()
|
|
63
|
-
],
|
|
64
|
-
strip: 1
|
|
65
|
-
});
|
|
66
|
-
process.stdout.write(`${reset}${message}: complete\n`);
|
|
67
|
-
}
|
|
68
|
-
async function downloadAndUnzipVSCode(quality) {
|
|
69
|
-
const info = await getLatestVersion(quality);
|
|
70
|
-
const folderName = `vscode-web-${quality}-${info.version}`;
|
|
71
|
-
const downloadedPath = path.resolve(vscodeTestDir, folderName);
|
|
72
|
-
if ((0, fs_1.existsSync)(downloadedPath) && (0, fs_1.existsSync)(path.join(downloadedPath, 'version'))) {
|
|
73
|
-
return { type: 'static', location: downloadedPath };
|
|
74
|
-
}
|
|
75
|
-
if ((0, fs_1.existsSync)(vscodeTestDir)) {
|
|
76
|
-
await fs_1.promises.rmdir(vscodeTestDir, { recursive: true, maxRetries: 5 });
|
|
77
|
-
}
|
|
78
|
-
await fs_1.promises.mkdir(vscodeTestDir, { recursive: true });
|
|
79
|
-
const productName = `VS Code ${quality === 'stable' ? 'Stable' : 'Insiders'}`;
|
|
80
|
-
const tmpArchiveName = `vscode-web-${quality}-${info.version}-tmp`;
|
|
81
|
-
try {
|
|
82
|
-
await download(info.url, tmpArchiveName, `Downloading ${productName}`);
|
|
83
|
-
await unzip(tmpArchiveName, downloadedPath, `Unpacking ${productName}`);
|
|
84
|
-
await fs_1.promises.writeFile(path.join(downloadedPath, 'version'), folderName);
|
|
85
|
-
}
|
|
86
|
-
catch (err) {
|
|
87
|
-
console.error(err);
|
|
88
|
-
throw Error(`Failed to download and unpack ${productName}`);
|
|
89
|
-
}
|
|
90
|
-
finally {
|
|
91
|
-
try {
|
|
92
|
-
fs_1.promises.unlink(tmpArchiveName);
|
|
93
|
-
}
|
|
94
|
-
catch (e) {
|
|
95
|
-
// ignore
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return { type: 'static', location: downloadedPath };
|
|
99
|
-
}
|
|
100
|
-
exports.downloadAndUnzipVSCode = downloadAndUnzipVSCode;
|
|
101
|
-
async function fetch(api) {
|
|
102
|
-
return new Promise((resolve, reject) => {
|
|
103
|
-
const httpLibrary = api.startsWith('https') ? https : http;
|
|
104
|
-
httpLibrary.get(api, getAgent(api), res => {
|
|
105
|
-
if (res.statusCode !== 200) {
|
|
106
|
-
reject('Failed to get content from ');
|
|
107
|
-
}
|
|
108
|
-
let data = '';
|
|
109
|
-
res.on('data', chunk => {
|
|
110
|
-
data += chunk;
|
|
111
|
-
});
|
|
112
|
-
res.on('end', () => {
|
|
113
|
-
resolve(data);
|
|
114
|
-
});
|
|
115
|
-
res.on('error', err => {
|
|
116
|
-
reject(err);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
exports.fetch = fetch;
|
|
122
|
-
async function fetchJSON(api) {
|
|
123
|
-
const data = await fetch(api);
|
|
124
|
-
try {
|
|
125
|
-
return JSON.parse(data);
|
|
126
|
-
}
|
|
127
|
-
catch (err) {
|
|
128
|
-
throw new Error(`Failed to parse response from ${api}`);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.fetchJSON = fetchJSON;
|
|
132
|
-
let PROXY_AGENT = undefined;
|
|
133
|
-
let HTTPS_PROXY_AGENT = undefined;
|
|
134
|
-
if (process.env.npm_config_proxy) {
|
|
135
|
-
PROXY_AGENT = createHttpProxyAgent(process.env.npm_config_proxy);
|
|
136
|
-
HTTPS_PROXY_AGENT = createHttpsProxyAgent(process.env.npm_config_proxy);
|
|
137
|
-
}
|
|
138
|
-
if (process.env.npm_config_https_proxy) {
|
|
139
|
-
HTTPS_PROXY_AGENT = createHttpsProxyAgent(process.env.npm_config_https_proxy);
|
|
140
|
-
}
|
|
141
|
-
function getAgent(url) {
|
|
142
|
-
const parsed = new url_1.URL(url);
|
|
143
|
-
const options = {};
|
|
144
|
-
if (PROXY_AGENT && parsed.protocol.startsWith('http:')) {
|
|
145
|
-
options.agent = PROXY_AGENT;
|
|
146
|
-
}
|
|
147
|
-
if (HTTPS_PROXY_AGENT && parsed.protocol.startsWith('https:')) {
|
|
148
|
-
options.agent = HTTPS_PROXY_AGENT;
|
|
149
|
-
}
|
|
150
|
-
return options;
|
|
151
|
-
}
|
|
152
|
-
async function directoryExists(path) {
|
|
153
|
-
try {
|
|
154
|
-
const stats = await fs_1.promises.stat(path);
|
|
155
|
-
return stats.isDirectory();
|
|
156
|
-
}
|
|
157
|
-
catch {
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
exports.directoryExists = directoryExists;
|
|
162
|
-
async function fileExists(path) {
|
|
163
|
-
try {
|
|
164
|
-
const stats = await fs_1.promises.stat(path);
|
|
165
|
-
return stats.isFile();
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
exports.fileExists = fileExists;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.fileExists = exports.directoryExists = exports.fetchJSON = exports.fetch = exports.downloadAndUnzipVSCode = void 0;
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const https = require("https");
|
|
11
|
+
const http = require("http");
|
|
12
|
+
const createHttpsProxyAgent = require("https-proxy-agent");
|
|
13
|
+
const createHttpProxyAgent = require("http-proxy-agent");
|
|
14
|
+
const url_1 = require("url");
|
|
15
|
+
const decompress = require("decompress");
|
|
16
|
+
const decompressTargz = require("decompress-targz");
|
|
17
|
+
const extensionRoot = process.cwd();
|
|
18
|
+
const vscodeTestDir = path.resolve(extensionRoot, '.vscode-test-web');
|
|
19
|
+
async function getLatestVersion(quality) {
|
|
20
|
+
const update = await fetchJSON(`https://update.code.visualstudio.com/api/update/web-standalone/${quality}/latest`);
|
|
21
|
+
return update;
|
|
22
|
+
}
|
|
23
|
+
const reset = '\x1b[G\x1b[0K';
|
|
24
|
+
async function download(downloadUrl, destination, message) {
|
|
25
|
+
process.stdout.write(message);
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const httpLibrary = downloadUrl.startsWith('https') ? https : http;
|
|
28
|
+
httpLibrary.get(downloadUrl, getAgent(downloadUrl), res => {
|
|
29
|
+
const total = Number(res.headers['content-length']);
|
|
30
|
+
let received = 0;
|
|
31
|
+
let timeout;
|
|
32
|
+
const outStream = (0, fs_1.createWriteStream)(destination);
|
|
33
|
+
outStream.on('close', () => resolve(destination));
|
|
34
|
+
outStream.on('error', reject);
|
|
35
|
+
res.on('data', chunk => {
|
|
36
|
+
if (!timeout) {
|
|
37
|
+
timeout = setTimeout(() => {
|
|
38
|
+
process.stdout.write(`${reset}${message}: ${received}/${total} (${(received / total * 100).toFixed()}%)`);
|
|
39
|
+
timeout = undefined;
|
|
40
|
+
}, 100);
|
|
41
|
+
}
|
|
42
|
+
received += chunk.length;
|
|
43
|
+
});
|
|
44
|
+
res.on('end', () => {
|
|
45
|
+
if (timeout) {
|
|
46
|
+
clearTimeout(timeout);
|
|
47
|
+
}
|
|
48
|
+
process.stdout.write(`${reset}${message}: complete\n`);
|
|
49
|
+
});
|
|
50
|
+
res.on('error', reject);
|
|
51
|
+
res.pipe(outStream);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async function unzip(source, destination, message) {
|
|
56
|
+
process.stdout.write(message);
|
|
57
|
+
if (!(0, fs_1.existsSync)(destination)) {
|
|
58
|
+
await fs_1.promises.mkdir(destination, { recursive: true });
|
|
59
|
+
}
|
|
60
|
+
await decompress(source, destination, {
|
|
61
|
+
plugins: [
|
|
62
|
+
decompressTargz()
|
|
63
|
+
],
|
|
64
|
+
strip: 1
|
|
65
|
+
});
|
|
66
|
+
process.stdout.write(`${reset}${message}: complete\n`);
|
|
67
|
+
}
|
|
68
|
+
async function downloadAndUnzipVSCode(quality) {
|
|
69
|
+
const info = await getLatestVersion(quality);
|
|
70
|
+
const folderName = `vscode-web-${quality}-${info.version}`;
|
|
71
|
+
const downloadedPath = path.resolve(vscodeTestDir, folderName);
|
|
72
|
+
if ((0, fs_1.existsSync)(downloadedPath) && (0, fs_1.existsSync)(path.join(downloadedPath, 'version'))) {
|
|
73
|
+
return { type: 'static', location: downloadedPath, quality, version: info.version };
|
|
74
|
+
}
|
|
75
|
+
if ((0, fs_1.existsSync)(vscodeTestDir)) {
|
|
76
|
+
await fs_1.promises.rmdir(vscodeTestDir, { recursive: true, maxRetries: 5 });
|
|
77
|
+
}
|
|
78
|
+
await fs_1.promises.mkdir(vscodeTestDir, { recursive: true });
|
|
79
|
+
const productName = `VS Code ${quality === 'stable' ? 'Stable' : 'Insiders'}`;
|
|
80
|
+
const tmpArchiveName = `vscode-web-${quality}-${info.version}-tmp`;
|
|
81
|
+
try {
|
|
82
|
+
await download(info.url, tmpArchiveName, `Downloading ${productName}`);
|
|
83
|
+
await unzip(tmpArchiveName, downloadedPath, `Unpacking ${productName}`);
|
|
84
|
+
await fs_1.promises.writeFile(path.join(downloadedPath, 'version'), folderName);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
console.error(err);
|
|
88
|
+
throw Error(`Failed to download and unpack ${productName}`);
|
|
89
|
+
}
|
|
90
|
+
finally {
|
|
91
|
+
try {
|
|
92
|
+
fs_1.promises.unlink(tmpArchiveName);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
// ignore
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { type: 'static', location: downloadedPath, quality, version: info.version };
|
|
99
|
+
}
|
|
100
|
+
exports.downloadAndUnzipVSCode = downloadAndUnzipVSCode;
|
|
101
|
+
async function fetch(api) {
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
const httpLibrary = api.startsWith('https') ? https : http;
|
|
104
|
+
httpLibrary.get(api, getAgent(api), res => {
|
|
105
|
+
if (res.statusCode !== 200) {
|
|
106
|
+
reject('Failed to get content from ');
|
|
107
|
+
}
|
|
108
|
+
let data = '';
|
|
109
|
+
res.on('data', chunk => {
|
|
110
|
+
data += chunk;
|
|
111
|
+
});
|
|
112
|
+
res.on('end', () => {
|
|
113
|
+
resolve(data);
|
|
114
|
+
});
|
|
115
|
+
res.on('error', err => {
|
|
116
|
+
reject(err);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
exports.fetch = fetch;
|
|
122
|
+
async function fetchJSON(api) {
|
|
123
|
+
const data = await fetch(api);
|
|
124
|
+
try {
|
|
125
|
+
return JSON.parse(data);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
throw new Error(`Failed to parse response from ${api}`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.fetchJSON = fetchJSON;
|
|
132
|
+
let PROXY_AGENT = undefined;
|
|
133
|
+
let HTTPS_PROXY_AGENT = undefined;
|
|
134
|
+
if (process.env.npm_config_proxy) {
|
|
135
|
+
PROXY_AGENT = createHttpProxyAgent(process.env.npm_config_proxy);
|
|
136
|
+
HTTPS_PROXY_AGENT = createHttpsProxyAgent(process.env.npm_config_proxy);
|
|
137
|
+
}
|
|
138
|
+
if (process.env.npm_config_https_proxy) {
|
|
139
|
+
HTTPS_PROXY_AGENT = createHttpsProxyAgent(process.env.npm_config_https_proxy);
|
|
140
|
+
}
|
|
141
|
+
function getAgent(url) {
|
|
142
|
+
const parsed = new url_1.URL(url);
|
|
143
|
+
const options = {};
|
|
144
|
+
if (PROXY_AGENT && parsed.protocol.startsWith('http:')) {
|
|
145
|
+
options.agent = PROXY_AGENT;
|
|
146
|
+
}
|
|
147
|
+
if (HTTPS_PROXY_AGENT && parsed.protocol.startsWith('https:')) {
|
|
148
|
+
options.agent = HTTPS_PROXY_AGENT;
|
|
149
|
+
}
|
|
150
|
+
return options;
|
|
151
|
+
}
|
|
152
|
+
async function directoryExists(path) {
|
|
153
|
+
try {
|
|
154
|
+
const stats = await fs_1.promises.stat(path);
|
|
155
|
+
return stats.isDirectory();
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
exports.directoryExists = directoryExists;
|
|
162
|
+
async function fileExists(path) {
|
|
163
|
+
try {
|
|
164
|
+
const stats = await fs_1.promises.stat(path);
|
|
165
|
+
return stats.isFile();
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
exports.fileExists = fileExists;
|
package/out/server/extensions.js
CHANGED
|
@@ -1,45 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.scanForExtensions = void 0;
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const path = require("path");
|
|
10
|
-
async function scanForExtensions(rootPath, serverURI) {
|
|
11
|
-
const result = [];
|
|
12
|
-
async function getExtension(relativePosixFolderPath) {
|
|
13
|
-
try {
|
|
14
|
-
const packageJSONPath = path.join(rootPath, relativePosixFolderPath, 'package.json');
|
|
15
|
-
if ((await fs_1.promises.stat(packageJSONPath)).isFile()) {
|
|
16
|
-
return {
|
|
17
|
-
scheme: serverURI.scheme,
|
|
18
|
-
authority: serverURI.authority,
|
|
19
|
-
path: path.posix.join(serverURI.path, relativePosixFolderPath),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function processFolder(relativePosixFolderPath) {
|
|
28
|
-
const extension = await getExtension(relativePosixFolderPath);
|
|
29
|
-
if (extension) {
|
|
30
|
-
result.push(extension);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
const folderPath = path.join(rootPath, relativePosixFolderPath);
|
|
34
|
-
const entries = await fs_1.promises.readdir(folderPath, { withFileTypes: true });
|
|
35
|
-
for (const entry of entries) {
|
|
36
|
-
if (entry.isDirectory() && entry.name.charAt(0) !== '.') {
|
|
37
|
-
await processFolder(path.posix.join(relativePosixFolderPath, entry.name));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
await processFolder('');
|
|
43
|
-
return result;
|
|
44
|
-
}
|
|
45
|
-
exports.scanForExtensions = scanForExtensions;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getScannedBuiltinExtensions = exports.prebuiltExtensionsLocation = exports.scanForExtensions = void 0;
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
async function scanForExtensions(rootPath, serverURI) {
|
|
11
|
+
const result = [];
|
|
12
|
+
async function getExtension(relativePosixFolderPath) {
|
|
13
|
+
try {
|
|
14
|
+
const packageJSONPath = path.join(rootPath, relativePosixFolderPath, 'package.json');
|
|
15
|
+
if ((await fs_1.promises.stat(packageJSONPath)).isFile()) {
|
|
16
|
+
return {
|
|
17
|
+
scheme: serverURI.scheme,
|
|
18
|
+
authority: serverURI.authority,
|
|
19
|
+
path: path.posix.join(serverURI.path, relativePosixFolderPath),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async function processFolder(relativePosixFolderPath) {
|
|
28
|
+
const extension = await getExtension(relativePosixFolderPath);
|
|
29
|
+
if (extension) {
|
|
30
|
+
result.push(extension);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
const folderPath = path.join(rootPath, relativePosixFolderPath);
|
|
34
|
+
const entries = await fs_1.promises.readdir(folderPath, { withFileTypes: true });
|
|
35
|
+
for (const entry of entries) {
|
|
36
|
+
if (entry.isDirectory() && entry.name.charAt(0) !== '.') {
|
|
37
|
+
await processFolder(path.posix.join(relativePosixFolderPath, entry.name));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
await processFolder('');
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
exports.scanForExtensions = scanForExtensions;
|
|
46
|
+
exports.prebuiltExtensionsLocation = '.build/builtInExtensions';
|
|
47
|
+
async function getScannedBuiltinExtensions(vsCodeDevLocation) {
|
|
48
|
+
// use the build utility as to not duplicate the code
|
|
49
|
+
const extensionsUtil = await Promise.resolve().then(() => require(path.join(vsCodeDevLocation, 'build', 'lib', 'extensions.js')));
|
|
50
|
+
return extensionsUtil.scanBuiltinExtensions(path.join(vsCodeDevLocation, 'extensions'))
|
|
51
|
+
.concat(extensionsUtil.scanBuiltinExtensions(path.join(vsCodeDevLocation, exports.prebuiltExtensionsLocation)));
|
|
52
|
+
}
|
|
53
|
+
exports.getScannedBuiltinExtensions = getScannedBuiltinExtensions;
|
package/out/server/main.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.runServer = void 0;
|
|
8
|
-
const app_1 = require("./app");
|
|
9
|
-
async function runServer(port, config) {
|
|
10
|
-
const app = await (0, app_1.default)(config);
|
|
11
|
-
const server = app.listen(port);
|
|
12
|
-
console.log(`Listening on http
|
|
13
|
-
return server;
|
|
14
|
-
}
|
|
15
|
-
exports.runServer = runServer;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.runServer = void 0;
|
|
8
|
+
const app_1 = require("./app");
|
|
9
|
+
async function runServer(host, port, config) {
|
|
10
|
+
const app = await (0, app_1.default)(config);
|
|
11
|
+
const server = app.listen(port, host);
|
|
12
|
+
console.log(`Listening on http://${host}:${port}`);
|
|
13
|
+
return server;
|
|
14
|
+
}
|
|
15
|
+
exports.runServer = runServer;
|