@vscode/test-web 0.0.55 → 0.0.56
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/out/server/workbench.js +11 -4
- package/package.json +11 -10
- package/views/workbench-esm.html +22 -0
package/out/server/workbench.js
CHANGED
|
@@ -15,10 +15,11 @@ function asJSON(value) {
|
|
|
15
15
|
return JSON.stringify(value).replace(/"/g, '"');
|
|
16
16
|
}
|
|
17
17
|
class Workbench {
|
|
18
|
-
constructor(baseUrl, dev, esm, builtInExtensions = [], productOverrides) {
|
|
18
|
+
constructor(baseUrl, dev, esm, devCSSModules, builtInExtensions = [], productOverrides) {
|
|
19
19
|
this.baseUrl = baseUrl;
|
|
20
20
|
this.dev = dev;
|
|
21
21
|
this.esm = esm;
|
|
22
|
+
this.devCSSModules = devCSSModules;
|
|
22
23
|
this.builtInExtensions = builtInExtensions;
|
|
23
24
|
this.productOverrides = productOverrides;
|
|
24
25
|
}
|
|
@@ -32,6 +33,7 @@ class Workbench {
|
|
|
32
33
|
WORKBENCH_WEB_BASE_URL: this.baseUrl,
|
|
33
34
|
WORKBENCH_BUILTIN_EXTENSIONS: asJSON(this.builtInExtensions),
|
|
34
35
|
WORKBENCH_MAIN: this.getMain(),
|
|
36
|
+
WORKBENCH_DEV_CSS_MODULES: JSON.stringify(this.devCSSModules)
|
|
35
37
|
};
|
|
36
38
|
try {
|
|
37
39
|
const workbenchTemplate = (await fs_1.promises.readFile(path.resolve(__dirname, `../../views/workbench${this.esm ? '-esm' : ''}.html`))).toString();
|
|
@@ -112,7 +114,8 @@ function default_1(config) {
|
|
|
112
114
|
if (config.build.type === 'sources') {
|
|
113
115
|
const builtInExtensions = await (0, extensions_1.getScannedBuiltinExtensions)(config.build.location);
|
|
114
116
|
const productOverrides = await getProductOverrides(config.build.location);
|
|
115
|
-
|
|
117
|
+
const devCSSModules = config.esm ? await getDevCssModules(config.build.location) : [];
|
|
118
|
+
ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/sources`, true, config.esm, devCSSModules, builtInExtensions, {
|
|
116
119
|
...productOverrides,
|
|
117
120
|
webEndpointUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/sources`,
|
|
118
121
|
webviewContentExternalBaseUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/sources/out/vs/workbench/contrib/webview/browser/pre/`
|
|
@@ -120,13 +123,13 @@ function default_1(config) {
|
|
|
120
123
|
}
|
|
121
124
|
else if (config.build.type === 'static') {
|
|
122
125
|
const baseUrl = `${ctx.protocol}://${ctx.host}/static/build`;
|
|
123
|
-
ctx.state.workbench = new Workbench(baseUrl, false, config.esm, [], {
|
|
126
|
+
ctx.state.workbench = new Workbench(baseUrl, false, config.esm, [], [], {
|
|
124
127
|
webEndpointUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/build`,
|
|
125
128
|
webviewContentExternalBaseUrlTemplate: `${ctx.protocol}://{{uuid}}.${ctx.host}/static/build/out/vs/workbench/contrib/webview/browser/pre/`
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
else if (config.build.type === 'cdn') {
|
|
129
|
-
ctx.state.workbench = new Workbench(config.build.uri, false, config.esm);
|
|
132
|
+
ctx.state.workbench = new Workbench(config.build.uri, false, config.esm, []);
|
|
130
133
|
}
|
|
131
134
|
await next();
|
|
132
135
|
});
|
|
@@ -152,3 +155,7 @@ async function getProductOverrides(vsCodeDevLocation) {
|
|
|
152
155
|
return undefined;
|
|
153
156
|
}
|
|
154
157
|
}
|
|
158
|
+
async function getDevCssModules(vsCodeDevLocation) {
|
|
159
|
+
const glob = await Promise.resolve().then(() => require('glob'));
|
|
160
|
+
return glob.glob('**/*.css', { cwd: path.join(vsCodeDevLocation, 'out') });
|
|
161
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/test-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"install-extensions": "npm i --prefix=fs-provider && npm i --prefix=sample",
|
|
6
6
|
"compile": "tsc -p ./ && npm run compile-fs-provider",
|
|
@@ -23,30 +23,31 @@
|
|
|
23
23
|
"node": ">=16"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@koa/router": "^12.0.1",
|
|
27
26
|
"@koa/cors": "^5.0.0",
|
|
27
|
+
"@koa/router": "^12.0.1",
|
|
28
|
+
"@playwright/browser-chromium": "^1.45.0",
|
|
29
|
+
"glob": "^10.4.2",
|
|
30
|
+
"gunzip-maybe": "^1.4.2",
|
|
31
|
+
"http-proxy-agent": "^7.0.2",
|
|
32
|
+
"https-proxy-agent": "^7.0.4",
|
|
28
33
|
"koa": "^2.15.3",
|
|
29
34
|
"koa-morgan": "^1.0.1",
|
|
30
35
|
"koa-mount": "^4.0.0",
|
|
31
36
|
"koa-static": "^5.0.0",
|
|
32
37
|
"minimist": "^1.2.8",
|
|
33
38
|
"playwright": "^1.45.0",
|
|
34
|
-
"@playwright/browser-chromium": "^1.45.0",
|
|
35
|
-
"vscode-uri": "^3.0.8",
|
|
36
|
-
"http-proxy-agent": "^7.0.2",
|
|
37
|
-
"https-proxy-agent": "^7.0.4",
|
|
38
39
|
"tar-fs": "^3.0.6",
|
|
39
|
-
"
|
|
40
|
+
"vscode-uri": "^3.0.8"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
43
|
+
"@types/gunzip-maybe": "^1.4.2",
|
|
42
44
|
"@types/koa": "^2.15.0",
|
|
45
|
+
"@types/koa__router": "^12.0.4",
|
|
43
46
|
"@types/koa-morgan": "^1.0.8",
|
|
44
47
|
"@types/koa-mount": "^4.0.5",
|
|
45
48
|
"@types/koa-static": "^4.0.4",
|
|
46
|
-
"@types/koa__router": "^12.0.4",
|
|
47
49
|
"@types/minimist": "^1.2.5",
|
|
48
50
|
"@types/node": "^20.14.9",
|
|
49
|
-
"@types/gunzip-maybe": "^1.4.2",
|
|
50
51
|
"@types/tar-fs": "^2.0.4",
|
|
51
52
|
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
52
53
|
"@typescript-eslint/parser": "^7.14.1",
|
|
@@ -63,4 +64,4 @@
|
|
|
63
64
|
"bugs": {
|
|
64
65
|
"url": "https://github.com/microsoft/vscode-test-web/issues"
|
|
65
66
|
}
|
|
66
|
-
}
|
|
67
|
+
}
|
package/views/workbench-esm.html
CHANGED
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
<!-- Workbench Icon/Manifest/CSS -->
|
|
29
29
|
<link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/favicon.ico" type="image/x-icon" />
|
|
30
30
|
<link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/manifest.json">
|
|
31
|
+
|
|
32
|
+
<style id="vscode-css-modules" type="text/css" media="screen"></style>
|
|
31
33
|
</head>
|
|
32
34
|
|
|
33
35
|
<body aria-label="">
|
|
@@ -39,6 +41,26 @@
|
|
|
39
41
|
const baseUrl = new URL('{{WORKBENCH_WEB_BASE_URL}}', window.location.origin).toString();
|
|
40
42
|
globalThis._VSCODE_FILE_ROOT = baseUrl + '/out/';
|
|
41
43
|
</script>
|
|
44
|
+
<script>
|
|
45
|
+
const sheet = document.getElementById('vscode-css-modules').sheet;
|
|
46
|
+
globalThis._VSCODE_CSS_LOAD = function (url) {
|
|
47
|
+
sheet.insertRule(`@import url(${url});`);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const importMap = { imports: {} };
|
|
51
|
+
const cssModules = JSON.parse('{{WORKBENCH_DEV_CSS_MODULES}}');
|
|
52
|
+
for (const cssModule of cssModules) {
|
|
53
|
+
const cssUrl = new URL(cssModule, globalThis._VSCODE_FILE_ROOT).href;
|
|
54
|
+
const jsSrc = `globalThis._VSCODE_CSS_LOAD('${cssUrl}');\n`;
|
|
55
|
+
const blob = new Blob([jsSrc], { type: 'application/javascript' });
|
|
56
|
+
importMap.imports[cssUrl] = URL.createObjectURL(blob);
|
|
57
|
+
}
|
|
58
|
+
const importMapElement = document.createElement('script');
|
|
59
|
+
importMapElement.type = 'importmap';
|
|
60
|
+
importMapElement.setAttribute('nonce', '1nline-m4p')
|
|
61
|
+
importMapElement.textContent = JSON.stringify(importMap, undefined, 2);
|
|
62
|
+
document.head.appendChild(importMapElement);
|
|
63
|
+
</script>
|
|
42
64
|
<script>
|
|
43
65
|
performance.mark('code/willLoadWorkbenchMain');
|
|
44
66
|
</script>
|