@vscode/test-web 0.0.26 → 0.0.27

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.
Files changed (2) hide show
  1. package/out/server/app.js +10 -0
  2. package/package.json +3 -2
package/out/server/app.js CHANGED
@@ -4,11 +4,13 @@
4
4
  * Licensed under the MIT License. See License.txt in the project root for license information.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
+ const fs_1 = require("fs");
7
8
  const Koa = require("koa");
8
9
  const morgan = require("koa-morgan");
9
10
  const kstatic = require("koa-static");
10
11
  const kmount = require("koa-mount");
11
12
  const cors = require("@koa/cors");
13
+ const getstream = require("get-stream");
12
14
  const path_1 = require("path");
13
15
  const workbench_1 = require("./workbench");
14
16
  const mounts_1 = require("./mounts");
@@ -32,6 +34,14 @@ async function createApp(config) {
32
34
  ctx.set('Access-Control-Allow-Origin', '*');
33
35
  return next();
34
36
  });
37
+ // shift the line numbers of source maps in extensions by 2 as the content is wrapped by an anonymous function
38
+ app.use(async (ctx, next) => {
39
+ await next();
40
+ if (ctx.status === 200 && ctx.path.match(/\/(dev)?extensions\/.*\.js\.map$/) && ctx.body instanceof fs_1.ReadStream) {
41
+ // we know it's a ReadStream as that's what kstatic uses
42
+ ctx.response.body = `{"version":3,"file":"${(0, path_1.basename)(ctx.path)}","sections":[{"offset":{"line":2,"column":0},"map":${await getstream(ctx.body)} }]}`;
43
+ }
44
+ });
35
45
  const serveOptions = { hidden: true };
36
46
  if (config.extensionDevelopmentPath) {
37
47
  console.log('Serving dev extensions from ' + config.extensionDevelopmentPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/test-web",
3
- "version": "0.0.26",
3
+ "version": "0.0.27",
4
4
  "scripts": {
5
5
  "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",
6
6
  "compile": "tsc -p ./ && yarn compile-fs-provider",
@@ -35,7 +35,8 @@
35
35
  "http-proxy-agent": "^5.0.0",
36
36
  "https-proxy-agent": "^5.0.1",
37
37
  "decompress": "^4.2.1",
38
- "decompress-targz": "^4.1.1"
38
+ "decompress-targz": "^4.1.1",
39
+ "get-stream": "6.0.1"
39
40
  },
40
41
  "devDependencies": {
41
42
  "@types/koa": "^2.13.4",