Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vscode/test-web

Package Overview
Dependencies
Maintainers
19
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/test-web - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

4

CHANGELOG.md
# Changelog
## 0.0.16
* new option `--sourcesPath`: If provided, runs the server from VS Code sources at the given location.
* option `--version` is deprecated and replaced with `quality`. Supported values: `stable`, `insiders`. Instead of `sources` use `--insiders`
## 0.0.14

@@ -4,0 +8,0 @@ * new option `--extensionPath` : A path pointing to a folder containing additional extensions to include. Argument can be provided multiple times.

8

fs-provider/dist/extension-web.js

@@ -8,3 +8,3 @@ /******/ (() => { // webpackBootstrap

"use strict";
module.exports = require("vscode");
module.exports = require("vscode");;

@@ -46,3 +46,3 @@ /***/ }),

const url = entry.serverUri.with({ query: 'stat' }).toString();
const response = await (0, request_light_1.xhr)({ url });
const response = await request_light_1.xhr({ url: url.toString() });
if (response.status === 200) {

@@ -72,3 +72,3 @@ try {

const url = entry.serverUri.with({ query: 'readdir' }).toString();
const response = await (0, request_light_1.xhr)({ url });
const response = await request_light_1.xhr({ url });
if (response.status === 200) {

@@ -123,3 +123,3 @@ try {

if (serverUri) {
const response = await (0, request_light_1.xhr)({ url: serverUri.toString() });
const response = await request_light_1.xhr({ url: serverUri.toString() });
if (response.status >= 200 && response.status <= 204) {

@@ -126,0 +126,0 @@ content = entry.content = response.body;

@@ -5,9 +5,15 @@ /******/ (() => { // webpackBootstrap

/* 1 */
/***/ ((__unused_webpack_module, exports) => {
(()=>{"use strict";var e={};(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.getErrorStatusDescription=r.xhr=r.configure=void 0,r.configure=(e,r)=>{},r.xhr=async e=>{const r=new Headers;if(e.headers)for(const t in e.headers){const s=e.headers[t];Array.isArray(s)?s.forEach((e=>r.set(t,e))):r.set(t,s)}e.user&&e.password&&r.set("Authorization","Basic "+btoa(e.user+":"+e.password));const t={method:e.type,redirect:e.followRedirects>0?"follow":"manual",mode:"cors",headers:r};e.data&&(t.body=e.data);const s=new Request(e.url,t),o=await fetch(s),a={};o.headers.forEach(((e,r)=>{a[r]=e}));const n=await o.arrayBuffer();return new class{constructor(){this.status=o.status,this.headers=a}get responseText(){return(new TextDecoder).decode(n)}get body(){return new Uint8Array(n)}}},r.getErrorStatusDescription=function(e){return String(e)}})();var r=exports;for(var t in e)r[t]=e[t];e.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
/***/ }),
/* 2 */
/***/ ((module) => {
"use strict";
module.exports = require("vscode");
module.exports = require("vscode");;
/***/ }),
/* 2 */
/* 3 */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {

@@ -22,74 +28,15 @@

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.MountsFileSystemProvider = exports.SCHEME = void 0;
const vscode_1 = __webpack_require__(1);
const vscode_uri_1 = __webpack_require__(3);
const request_light_1 = __webpack_require__(5);
exports.SCHEME = 'vscode-test-web';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isEntry(e) {
return e && (e.type === vscode_1.FileType.Directory || e.type === vscode_1.FileType.File) && typeof e.name === 'string' && e.name.length > 0;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isStat(e) {
return e && (e.type === vscode_1.FileType.Directory || e.type === vscode_1.FileType.File) && typeof e.ctime === 'number' && typeof e.mtime === 'number' && typeof e.size === 'number';
}
exports.MemFileSystemProvider = void 0;
const vscode_1 = __webpack_require__(2);
const vscode_uri_1 = __webpack_require__(4);
function newFileStat(type, size) {
return { type, ctime: Date.now(), mtime: Date.now(), size };
return Promise.resolve({ type, ctime: Date.now(), mtime: Date.now(), size });
}
function modifiedFileStat(stats, size) {
return { type: stats.type, ctime: stats.ctime, mtime: Date.now(), size: size !== null && size !== void 0 ? size : stats.size };
return Promise.resolve({ type: stats.type, ctime: stats.ctime, mtime: Date.now(), size: size !== null && size !== void 0 ? size : stats.size });
}
async function getStats(entry) {
let stats = entry.stats;
if (stats === undefined) {
if (entry.serverUri) {
const url = entry.serverUri.with({ query: 'stat' }).toString();
const response = await (0, request_light_1.xhr)({ url });
if (response.status === 200) {
try {
const res = JSON.parse(response.responseText);
if (isStat(res)) {
stats = res;
}
}
catch {
// ignore
}
}
}
if (!stats) {
stats = newFileStat(entry.type, 0);
}
entry.stats = stats;
}
return stats;
}
async function getEntries(entry) {
if (entry.entries === undefined) {
entry.entries = new Map();
if (entry.serverUri) {
const url = entry.serverUri.with({ query: 'readdir' }).toString();
const response = await (0, request_light_1.xhr)({ url });
if (response.status === 200) {
try {
const res = JSON.parse(response.responseText);
if (Array.isArray(res)) {
for (const r of res) {
if (isEntry(r)) {
const newEntry = { type: r.type, name: r.name, serverUri: vscode_uri_1.Utils.joinPath(entry.serverUri, r.name) };
entry.entries.set(newEntry.name, newEntry);
}
}
}
}
catch {
// ignore
}
}
}
}
return entry.entries;
}
class MountsFileSystemProvider {
constructor(serverUri) {
class MemFileSystemProvider {
constructor(scheme, root) {
this.scheme = scheme;
this.root = root;
// --- manage file events

@@ -99,3 +46,2 @@ this._onDidChangeFile = new vscode_1.EventEmitter();

this._bufferedChanges = [];
this.root = { type: vscode_1.FileType.Directory, name: '', serverUri };
}

@@ -105,7 +51,7 @@ // --- manage file metadata

const entry = await this._lookup(resource, false);
return getStats(entry);
return entry.stats;
}
async readDirectory(resource) {
const entry = await this._lookupAsDirectory(resource, false);
const entries = await getEntries(entry);
const entries = await entry.entries;
const result = [];

@@ -118,17 +64,3 @@ entries.forEach((child, name) => result.push([name, child.type]));

const entry = await this._lookupAsFile(resource, false);
let content = entry.content;
if (content) {
return content;
}
const serverUri = entry.serverUri;
if (serverUri) {
const response = await (0, request_light_1.xhr)({ url: serverUri.toString() });
if (response.status >= 200 && response.status <= 204) {
content = entry.content = response.body;
}
}
if (!content) {
throw vscode_1.FileSystemError.FileNotFound(resource);
}
return content;
return entry.content;
}

@@ -138,3 +70,3 @@ async writeFile(uri, content, opts) {

const parent = await this._lookupParentDirectory(uri);
const entries = await getEntries(parent);
const entries = await parent.entries;
let entry = entries.get(basename);

@@ -152,3 +84,3 @@ if (entry && entry.type === vscode_1.FileType.Directory) {

if (!entry) {
entry = { type: vscode_1.FileType.File, name: basename, stats, content };
entry = { type: vscode_1.FileType.File, name: basename, stats, content: Promise.resolve(content) };
entries.set(basename, entry);

@@ -159,3 +91,3 @@ this._fireSoon({ type: vscode_1.FileChangeType.Created, uri });

entry.stats = stats;
entry.content = content;
entry.content = Promise.resolve(content);
}

@@ -173,13 +105,7 @@ this._fireSoon({ type: vscode_1.FileChangeType.Changed, uri });

const newName = vscode_uri_1.Utils.basename(to);
const oldParentEntries = await getEntries(oldParent);
const oldParentEntries = await oldParent.entries;
oldParentEntries.delete(entry.name);
let newEntry;
if (entry.type === vscode_1.FileType.File) {
newEntry = { type: vscode_1.FileType.File, name: newName, stats: entry.stats, serverUri: entry.serverUri, content: entry.content };
}
else {
newEntry = { type: vscode_1.FileType.Directory, name: newName, stats: entry.stats, serverUri: entry.serverUri, entries: entry.entries };
}
const newParentEntries = await getEntries(newParent);
newParentEntries.set(newName, newEntry);
entry.name = newName;
const newParentEntries = await newParent.entries;
newParentEntries.set(newName, entry);
this._fireSoon({ type: vscode_1.FileChangeType.Deleted, uri: from }, { type: vscode_1.FileChangeType.Created, uri: to });

@@ -191,3 +117,3 @@ }

const parent = await this._lookupAsDirectory(dirname, false);
const parentEntries = await getEntries(parent);
const parentEntries = await parent.entries;
if (parentEntries.has(basename)) {

@@ -203,6 +129,6 @@ parentEntries.delete(basename);

const parent = await this._lookupAsDirectory(dirname, false);
const parentEntries = await getEntries(parent);
const entry = { type: vscode_1.FileType.Directory, name: basename, stats: newFileStat(vscode_1.FileType.Directory, 0) };
const parentEntries = await parent.entries;
const entry = { type: vscode_1.FileType.Directory, name: basename, stats: newFileStat(vscode_1.FileType.Directory, 0), entries: Promise.resolve(new Map()) };
parentEntries.set(entry.name, entry);
const stats = await getStats(parent);
const stats = await parent.stats;
parent.stats = modifiedFileStat(stats, stats.size + 1);

@@ -212,3 +138,3 @@ this._fireSoon({ type: vscode_1.FileChangeType.Changed, uri: dirname }, { type: vscode_1.FileChangeType.Created, uri });

async _lookup(uri, silent) {
if (uri.scheme !== exports.SCHEME) {
if (uri.scheme !== this.scheme) {
if (!silent) {

@@ -229,3 +155,3 @@ throw vscode_1.FileSystemError.FileNotFound(uri);

if (entry.type === vscode_1.FileType.Directory) {
child = (await getEntries(entry)).get(part);
child = (await entry.entries).get(part);
}

@@ -283,7 +209,7 @@ if (!child) {

}
exports.MountsFileSystemProvider = MountsFileSystemProvider;
exports.MemFileSystemProvider = MemFileSystemProvider;
/***/ }),
/* 3 */
/* 4 */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

@@ -297,3 +223,3 @@

/* harmony export */ });
/* provided dependency */ var process = __webpack_require__(4);
/* provided dependency */ var process = __webpack_require__(5);
var LIB;LIB=(()=>{"use strict";var t={470:t=>{function e(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function r(t,e){for(var r,n="",o=0,i=-1,a=0,h=0;h<=t.length;++h){if(h<t.length)r=t.charCodeAt(h);else{if(47===r)break;r=47}if(47===r){if(i===h-1||1===a);else if(i!==h-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var s=n.lastIndexOf("/");if(s!==n.length-1){-1===s?(n="",o=0):o=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),i=h,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=h,a=0;continue}e&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+t.slice(i+1,h):n=t.slice(i+1,h),o=h-i-1;i=h,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var t,n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===t&&(t=process.cwd()),a=t),e(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(t){if(e(t),0===t.length)return".";var n=47===t.charCodeAt(0),o=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!n)).length||n||(t="."),t.length>0&&o&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,r=0;r<arguments.length;++r){var o=arguments[r];e(o),o.length>0&&(void 0===t?t=o:t+="/"+o)}return void 0===t?".":n.normalize(t)},relative:function(t,r){if(e(t),e(r),t===r)return"";if((t=n.resolve(t))===(r=n.resolve(r)))return"";for(var o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var i=t.length,a=i-o,h=1;h<r.length&&47===r.charCodeAt(h);++h);for(var s=r.length-h,f=a<s?a:s,u=-1,c=0;c<=f;++c){if(c===f){if(s>f){if(47===r.charCodeAt(h+c))return r.slice(h+c+1);if(0===c)return r.slice(h+c)}else a>f&&(47===t.charCodeAt(o+c)?u=c:0===c&&(u=0));break}var l=t.charCodeAt(o+c);if(l!==r.charCodeAt(h+c))break;47===l&&(u=c)}var p="";for(c=o+u+1;c<=i;++c)c!==i&&47!==t.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(h+u):(h+=u,47===r.charCodeAt(h)&&++h,r.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,o=-1,i=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":t.slice(0,o)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,o=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var h=r.length-1,s=-1;for(n=t.length-1;n>=0;--n){var f=t.charCodeAt(n);if(47===f){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1),h>=0&&(f===r.charCodeAt(h)?-1==--h&&(i=n):(h=-1,i=s))}return o===i?i=s:-1===i&&(i=t.length),t.slice(o,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":t.slice(o,i)},extname:function(t){e(t);for(var r=-1,n=0,o=-1,i=!0,a=0,h=t.length-1;h>=0;--h){var s=t.charCodeAt(h);if(47!==s)-1===o&&(i=!1,o=h+1),46===s?-1===r?r=h:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=h+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":t.slice(r,o)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,o=t.charCodeAt(0),i=47===o;i?(r.root="/",n=1):n=0;for(var a=-1,h=0,s=-1,f=!0,u=t.length-1,c=0;u>=n;--u)if(47!==(o=t.charCodeAt(u)))-1===s&&(f=!1,s=u+1),46===o?-1===a?a=u:1!==c&&(c=1):-1!==a&&(c=-1);else if(!f){h=u+1;break}return-1===a||-1===s||0===c||1===c&&a===s-1&&a===h+1?-1!==s&&(r.base=r.name=0===h&&i?t.slice(1,s):t.slice(h,s)):(0===h&&i?(r.name=t.slice(1,a),r.base=t.slice(1,s)):(r.name=t.slice(h,a),r.base=t.slice(h,s)),r.ext=t.slice(a,s)),h>0?r.dir=t.slice(0,h-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,t.exports=n},447:(t,e,r)=>{var n;if(r.r(e),r.d(e,{URI:()=>g,Utils:()=>O}),"object"==typeof process)n="win32"===process.platform;else if("object"==typeof navigator){var o=navigator.userAgent;n=o.indexOf("Windows")>=0}var i,a,h=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=/^\w[\w\d+.-]*$/,f=/^\//,u=/^\/\//,c="",l="/",p=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,g=function(){function t(t,e,r,n,o,i){void 0===i&&(i=!1),"object"==typeof t?(this.scheme=t.scheme||c,this.authority=t.authority||c,this.path=t.path||c,this.query=t.query||c,this.fragment=t.fragment||c):(this.scheme=function(t,e){return t||e?t:"file"}(t,i),this.authority=e||c,this.path=function(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==l&&(e=l+e):e=l}return e}(this.scheme,r||c),this.query=n||c,this.fragment=o||c,function(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+t.authority+'", path: "'+t.path+'", query: "'+t.query+'", fragment: "'+t.fragment+'"}');if(t.scheme&&!s.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!f.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(u.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}(this,i))}return t.isUri=function(e){return e instanceof t||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"function"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString},Object.defineProperty(t.prototype,"fsPath",{get:function(){return C(this,!1)},enumerable:!1,configurable:!0}),t.prototype.with=function(t){if(!t)return this;var e=t.scheme,r=t.authority,n=t.path,o=t.query,i=t.fragment;return void 0===e?e=this.scheme:null===e&&(e=c),void 0===r?r=this.authority:null===r&&(r=c),void 0===n?n=this.path:null===n&&(n=c),void 0===o?o=this.query:null===o&&(o=c),void 0===i?i=this.fragment:null===i&&(i=c),e===this.scheme&&r===this.authority&&n===this.path&&o===this.query&&i===this.fragment?this:new v(e,r,n,o,i)},t.parse=function(t,e){void 0===e&&(e=!1);var r=p.exec(t);return r?new v(r[2]||c,x(r[4]||c),x(r[5]||c),x(r[7]||c),x(r[9]||c),e):new v(c,c,c,c,c)},t.file=function(t){var e=c;if(n&&(t=t.replace(/\\/g,l)),t[0]===l&&t[1]===l){var r=t.indexOf(l,2);-1===r?(e=t.substring(2),t=l):(e=t.substring(2,r),t=t.substring(r)||l)}return new v("file",e,t,c,c)},t.from=function(t){return new v(t.scheme,t.authority,t.path,t.query,t.fragment)},t.prototype.toString=function(t){return void 0===t&&(t=!1),A(this,t)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new v(e);return r._formatted=e.external,r._fsPath=e._sep===d?e.fsPath:null,r}return e},t}(),d=n?1:void 0,v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._formatted=null,e._fsPath=null,e}return h(e,t),Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=C(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),e.prototype.toString=function(t){return void 0===t&&(t=!1),t?A(this,!0):(this._formatted||(this._formatted=A(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=d),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(g),m=((a={})[58]="%3A",a[47]="%2F",a[63]="%3F",a[35]="%23",a[91]="%5B",a[93]="%5D",a[64]="%40",a[33]="%21",a[36]="%24",a[38]="%26",a[39]="%27",a[40]="%28",a[41]="%29",a[42]="%2A",a[43]="%2B",a[44]="%2C",a[59]="%3B",a[61]="%3D",a[32]="%20",a);function y(t,e){for(var r=void 0,n=-1,o=0;o<t.length;o++){var i=t.charCodeAt(o);if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||45===i||46===i||95===i||126===i||e&&47===i)-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),void 0!==r&&(r+=t.charAt(o));else{void 0===r&&(r=t.substr(0,o));var a=m[i];void 0!==a?(-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),r+=a):-1===n&&(n=o)}}return-1!==n&&(r+=encodeURIComponent(t.substring(n))),void 0!==r?r:t}function b(t){for(var e=void 0,r=0;r<t.length;r++){var n=t.charCodeAt(r);35===n||63===n?(void 0===e&&(e=t.substr(0,r)),e+=m[n]):void 0!==e&&(e+=t[r])}return void 0!==e?e:t}function C(t,e){var r;return r=t.authority&&t.path.length>1&&"file"===t.scheme?"//"+t.authority+t.path:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?e?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,n&&(r=r.replace(/\//g,"\\")),r}function A(t,e){var r=e?b:y,n="",o=t.scheme,i=t.authority,a=t.path,h=t.query,s=t.fragment;if(o&&(n+=o,n+=":"),(i||"file"===o)&&(n+=l,n+=l),i){var f=i.indexOf("@");if(-1!==f){var u=i.substr(0,f);i=i.substr(f+1),-1===(f=u.indexOf(":"))?n+=r(u,!1):(n+=r(u.substr(0,f),!1),n+=":",n+=r(u.substr(f+1),!1)),n+="@"}-1===(f=(i=i.toLowerCase()).indexOf(":"))?n+=r(i,!1):(n+=r(i.substr(0,f),!1),n+=i.substr(f))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2))(c=a.charCodeAt(1))>=65&&c<=90&&(a="/"+String.fromCharCode(c+32)+":"+a.substr(3));else if(a.length>=2&&58===a.charCodeAt(1)){var c;(c=a.charCodeAt(0))>=65&&c<=90&&(a=String.fromCharCode(c+32)+":"+a.substr(2))}n+=r(a,!0)}return h&&(n+="?",n+=r(h,!1)),s&&(n+="#",n+=e?s:y(s,!1)),n}function w(t){try{return decodeURIComponent(t)}catch(e){return t.length>3?t.substr(0,3)+w(t.substr(3)):t}}var _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function x(t){return t.match(_)?t.replace(_,(function(t){return w(t)})):t}var O,P=r(470),j=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,h=i.length;a<h;a++,o++)n[o]=i[a];return n},U=P.posix||P;!function(t){t.joinPath=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return t.with({path:U.join.apply(U,j([t.path],e))})},t.resolvePath=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=t.path||"/";return t.with({path:U.resolve.apply(U,j([n],e))})},t.dirname=function(t){var e=U.dirname(t.path);return 1===e.length&&46===e.charCodeAt(0)?t:t.with({path:e})},t.basename=function(t){return U.basename(t.path)},t.extname=function(t){return U.extname(t.path)}}(O||(O={}))}},e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(447)})();const{URI,Utils}=LIB;

@@ -303,3 +229,3 @@ //# sourceMappingURL=index.js.map

/***/ }),
/* 4 */
/* 5 */
/***/ ((module) => {

@@ -493,8 +419,2 @@

/***/ }),
/* 5 */
/***/ ((__unused_webpack_module, exports) => {
(()=>{"use strict";var e={};(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.getErrorStatusDescription=r.xhr=r.configure=void 0,r.configure=(e,r)=>{},r.xhr=async e=>{const r=new Headers;if(e.headers)for(const t in e.headers){const s=e.headers[t];Array.isArray(s)?s.forEach((e=>r.set(t,e))):r.set(t,s)}e.user&&e.password&&r.set("Authorization","Basic "+btoa(e.user+":"+e.password));const t={method:e.type,redirect:e.followRedirects>0?"follow":"manual",mode:"cors",headers:r};e.data&&(t.body=e.data);const s=new Request(e.url,t),o=await fetch(s),a={};o.headers.forEach(((e,r)=>{a[r]=e}));const n=await o.arrayBuffer();return new class{constructor(){this.status=o.status,this.headers=a}get responseText(){return(new TextDecoder).decode(n)}get body(){return new Uint8Array(n)}}},r.getErrorStatusDescription=function(e){return String(e)}})();var r=exports;for(var t in e)r[t]=e[t];e.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
/***/ })

@@ -569,11 +489,119 @@ /******/ ]);

exports.activate = void 0;
const vscode = __webpack_require__(1);
const fsProvider_1 = __webpack_require__(2);
const request_light_1 = __webpack_require__(1);
const vscode_1 = __webpack_require__(2);
const fsProvider_1 = __webpack_require__(3);
const SCHEME = 'vscode-test-web';
function activate(context) {
const serverUri = context.extensionUri.with({ path: '/static/mount', query: undefined });
const disposable = vscode.workspace.registerFileSystemProvider(fsProvider_1.SCHEME, new fsProvider_1.MountsFileSystemProvider(serverUri));
const serverBackedRootDirectory = new ServerBackedDirectory(serverUri, '');
const disposable = vscode_1.workspace.registerFileSystemProvider(SCHEME, new fsProvider_1.MemFileSystemProvider(SCHEME, serverBackedRootDirectory));
context.subscriptions.push(disposable);
console.log(`vscode-test-web-support fs provider registers for ${fsProvider_1.SCHEME}, initial content from ${serverUri.toString()}`);
console.log(`vscode-test-web-support fs provider registers for ${SCHEME}, initial content from ${serverUri.toString()}`);
}
exports.activate = activate;
class ServerBackedFile {
constructor(_serverUri, name) {
this._serverUri = _serverUri;
this.name = name;
this.type = vscode_1.FileType.File;
}
get stats() {
if (this._stats === undefined) {
this._stats = getStats(this._serverUri);
}
return this._stats;
}
set stats(stats) {
this._stats = stats;
}
get content() {
if (this._content === undefined) {
this._content = getContent(this._serverUri);
}
return this._content;
}
set content(content) {
this._content = content;
}
}
class ServerBackedDirectory {
constructor(_serverUri, name) {
this._serverUri = _serverUri;
this.name = name;
this.type = vscode_1.FileType.Directory;
}
get stats() {
if (this._stats === undefined) {
this._stats = getStats(this._serverUri);
}
return this._stats;
}
set stats(stats) {
this._stats = stats;
}
get entries() {
if (this._entries === undefined) {
this._entries = getEntries(this._serverUri);
}
return this._entries;
}
set entries(entries) {
this._entries = entries;
}
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isEntry(e) {
return e && (e.type === vscode_1.FileType.Directory || e.type === vscode_1.FileType.File) && typeof e.name === 'string' && e.name.length > 0;
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function isStat(e) {
return e && (e.type === vscode_1.FileType.Directory || e.type === vscode_1.FileType.File) && typeof e.ctime === 'number' && typeof e.mtime === 'number' && typeof e.size === 'number';
}
async function getEntries(serverUri) {
const url = serverUri.with({ query: 'readdir' }).toString();
const response = await request_light_1.xhr({ url });
if (response.status === 200 && response.status <= 204) {
try {
const res = JSON.parse(response.responseText);
if (Array.isArray(res)) {
const entries = new Map();
for (const r of res) {
if (isEntry(r)) {
const childPath = vscode_1.Uri.joinPath(serverUri, r.name);
const newEntry = r.type === vscode_1.FileType.Directory ? new ServerBackedDirectory(childPath, r.name) : new ServerBackedFile(childPath, r.name);
entries.set(newEntry.name, newEntry);
}
}
return entries;
}
}
catch {
// ignore
}
console.log(`Invalid server response format for ${url.toString()}.`);
}
else {
console.log(`Invalid server response for ${url.toString()}. Status ${response.status}`);
}
return new Map();
}
async function getStats(serverUri) {
const url = serverUri.with({ query: 'stat' }).toString();
const response = await request_light_1.xhr({ url });
if (response.status === 200 && response.status <= 204) {
const res = JSON.parse(response.responseText);
if (isStat(res)) {
return res;
}
throw vscode_1.FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString()}.`);
}
throw vscode_1.FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString()}. Status ${response.status}.`);
}
async function getContent(serverUri) {
const response = await request_light_1.xhr({ url: serverUri.toString() });
if (response.status >= 200 && response.status <= 204) {
return response.body;
}
throw vscode_1.FileSystemError.FileNotFound(`Invalid server response for ${serverUri.toString()}. Status ${response.status}.`);
}

@@ -580,0 +608,0 @@ })();

#!/usr/bin/env node
export declare type BrowserType = 'chromium' | 'firefox' | 'webkit';
export declare type VSCodeVersion = 'insiders' | 'stable' | 'sources';
export declare type VSCodeQuality = 'insiders' | 'stable';
export interface Options {

@@ -28,11 +28,16 @@ /**

/**
* The VS Code version to use. Valid versions are:
* - `'stable'` : The latest stable build
* - `'insiders'` : The latest insiders build
* - `'sources'`: From sources, served at localhost:8080 by running `yarn web` in the vscode repo
* The quality of the VS Code to use. Supported qualities are:
* - `'stable'` : The latest stable build will be used
* - `'insiders'` : The latest insiders build will be used
*
* Currently defaults to `insiders`, which is latest stable insiders.
*
* The setting is ignored when a vsCodeDevPath is provided.
*/
version?: VSCodeVersion;
quality?: VSCodeQuality;
/**
* Deprecated. Use `quality` or `vsCodeDevPath` instead.
*/
version?: string;
/**
* Open the dev tools.

@@ -42,3 +47,3 @@ */

/**
* Do not show the browser. Defaults to `true` if a extensionTestsPath is provided, `false` otherwise.
* Do not show the browser. Defaults to `true` if a `extensionTestsPath` is provided, `false` otherwise.
*/

@@ -75,2 +80,7 @@ headless?: boolean;

extensionPaths?: string[];
/**
* Absolute path pointing to VS Code sources to use.
*/
vsCodeDevPath?: string;
verbose?: boolean;
}

@@ -77,0 +87,0 @@ export interface Disposable {

@@ -24,3 +24,3 @@ #!/usr/bin/env node

extensionTestsPath: options.extensionTestsPath,
build: await getBuild(options.version),
build: await getBuild(options),
folderUri: options.folderUri,

@@ -59,7 +59,11 @@ folderMountPath: options.folderPath,

exports.runTests = runTests;
async function getBuild(version) {
if (version === 'sources') {
return { type: 'sources' };
async function getBuild(options) {
if (options.vsCodeDevPath) {
return {
type: 'sources',
location: options.vsCodeDevPath
};
}
return await (0, download_1.downloadAndUnzipVSCode)(version === 'stable' ? 'stable' : 'insider');
const quality = options.quality || options.version;
return await (0, download_1.downloadAndUnzipVSCode)(quality === 'stable' ? 'stable' : 'insider');
}

@@ -70,3 +74,3 @@ async function open(options) {

extensionTestsPath: options.extensionTestsPath,
build: await getBuild(options.version),
build: await getBuild(options),
folderUri: options.folderUri,

@@ -101,3 +105,3 @@ folderMountPath: options.folderPath,

}
const headless = (_a = options.headless) !== null && _a !== void 0 ? _a : options.extensionDevelopmentPath !== undefined;
const headless = (_a = options.headless) !== null && _a !== void 0 ? _a : options.extensionTestsPath !== undefined;
const browser = await playwright[options.browserType].launch({ headless, args, devtools: options.devTools });

@@ -123,2 +127,7 @@ const context = await browser.newContext();

}
if (options.verbose) {
page.on('console', (message) => {
console.log(message.text());
});
}
await page.setViewportSize({ width, height });

@@ -217,7 +226,20 @@ await page.goto(endpoint);

}
function validateVersion(version) {
if (version === undefined || ((typeof version === 'string') && ['insiders', 'stable', 'sources'].includes(version))) {
return version;
function validateQuality(quality, version, vsCodeDevPath) {
if (version) {
console.log(`--version has been replaced by --quality`);
quality = quality || version;
}
console.log(`Invalid version.`);
if (vsCodeDevPath && quality) {
console.log(`Sources folder is provided as input, quality is ignored.`);
return undefined;
}
if (quality === undefined || ((typeof quality === 'string') && ['insiders', 'stable'].includes(quality))) {
return quality;
}
if (version === 'sources') {
console.log(`Instead of version=sources use 'sourcesPath' with the location of the VS Code repository.`);
}
else {
console.log(`Invalid quality.`);
}
showHelp();

@@ -240,3 +262,4 @@ process.exit(-1);

console.log(` --extensionTestsPath path: A path to a test module to run. [Optional]`);
console.log(` --version 'insiders' | 'stable' | 'sources' [Optional, default 'insiders']`);
console.log(` --quality 'insiders' | 'stable' [Optional, default 'insiders', ignored when running from sources]`);
console.log(` --sourcesPath path: If provided, running from VS Code sources at the given location [Optional]`);
console.log(` --open-devtools: If set, opens the dev tools [Optional]`);

@@ -255,4 +278,4 @@ console.log(` --headless: Whether to hide the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. [Optional]`);

const options = {
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath'],
boolean: ['open-devtools', 'headless', 'hideServerLog', 'help'],
string: ['extensionDevelopmentPath', 'extensionTestsPath', 'browserType', 'quality', 'version', 'waitForDebugger', 'folder-uri', 'permission', 'extensionPath', 'sourcesPath'],
boolean: ['open-devtools', 'headless', 'hideServerLog', 'help', 'verbose'],
unknown: arg => {

@@ -262,3 +285,3 @@ if (arg.startsWith('-')) {

showHelp();
return false;
process.exit();
}

@@ -277,3 +300,4 @@ return true;

const extensionPaths = await valdiateExtensionPaths(args.extensionPath);
const version = validateVersion(args.version);
const vsCodeDevPath = await validatePathOrUndefined(args, 'sourcesPath');
const quality = validateQuality(args.quality, args.version, vsCodeDevPath);
const devTools = validateBooleanOrUndefined(args, 'open-devtools');

@@ -283,2 +307,3 @@ const headless = validateBooleanOrUndefined(args, 'headless');

const hideServerLog = validateBooleanOrUndefined(args, 'hideServerLog');
const verbose = validateBooleanOrUndefined(args, 'verbose');
const waitForDebugger = validatePortNumber(args.waitForDebugger);

@@ -303,3 +328,3 @@ let folderUri = validateStringOrUndefined(args, 'folder-uri');

browserType,
version,
quality,
devTools,

@@ -312,3 +337,5 @@ waitForDebugger,

permissions,
extensionPaths
extensionPaths,
vsCodeDevPath,
verbose
});

@@ -320,3 +347,3 @@ }

browserType,
version,
quality,
devTools,

@@ -329,3 +356,5 @@ waitForDebugger,

permissions,
extensionPaths
extensionPaths,
vsCodeDevPath,
verbose
});

@@ -332,0 +361,0 @@ }

@@ -11,5 +11,6 @@ "use strict";

const kmount = require("koa-mount");
const path_1 = require("path");
const workbench_1 = require("./workbench");
const path = require("path");
const mounts_1 = require("./mounts");
const extensions_1 = require("./extensions");
async function createApp(config) {

@@ -25,10 +26,16 @@ const app = new Koa();

});
app.use(kmount('/static', kstatic(path.join(__dirname, '../static'))));
const serveOptions = { hidden: true };
if (config.extensionDevelopmentPath) {
console.log('Serving dev extensions from ' + config.extensionDevelopmentPath);
app.use(kmount('/static/devextensions', kstatic(config.extensionDevelopmentPath, { hidden: true })));
app.use(kmount('/static/devextensions', kstatic(config.extensionDevelopmentPath, serveOptions)));
}
if (config.build.type === 'static') {
app.use(kmount('/static/build', kstatic(config.build.location, { hidden: true })));
app.use(kmount('/static/build', kstatic(config.build.location, serveOptions)));
}
else if (config.build.type === 'sources') {
app.use(kmount('/static/sources', kstatic(config.build.location, serveOptions)));
app.use(kmount('/static/sources', kstatic((0, path_1.join)(config.build.location, 'resources', 'server'), serveOptions))); // for manifest.json, favicon and code icons.
// built-in extension are at 'extensions` as well as prebuilt extensions dowloaded from the marketplace
app.use(kmount(`/static/sources/extensions`, kstatic((0, path_1.join)(config.build.location, extensions_1.prebuiltExtensionsLocation), serveOptions)));
}
(0, mounts_1.configureMounts)(config, app);

@@ -38,3 +45,3 @@ if (config.extensionPaths) {

console.log('Serving additional built-in extensions from ' + extensionPath);
app.use(kmount(`/static/extensions/${index}`, kstatic(extensionPath, { hidden: true })));
app.use(kmount(`/static/extensions/${index}`, kstatic(extensionPath, serveOptions)));
});

@@ -41,0 +48,0 @@ }

@@ -0,0 +0,0 @@ "use strict";

@@ -7,3 +7,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.scanForExtensions = void 0;
exports.getScannedBuiltinExtensions = exports.prebuiltExtensionsLocation = exports.scanForExtensions = void 0;
const fs_1 = require("fs");

@@ -47,1 +47,9 @@ const path = require("path");

exports.scanForExtensions = scanForExtensions;
exports.prebuiltExtensionsLocation = '.build/builtInExtensions';
async function getScannedBuiltinExtensions(vsCodeDevLocation) {
// use the build utility as to not duplicate the code
const extensionsUtil = await Promise.resolve().then(() => require(path.join(vsCodeDevLocation, 'build', 'lib', 'extensions.js')));
return extensionsUtil.scanBuiltinExtensions(path.join(vsCodeDevLocation, 'extensions'))
.concat(extensionsUtil.scanBuiltinExtensions(path.join(vsCodeDevLocation, exports.prebuiltExtensionsLocation)));
}
exports.getScannedBuiltinExtensions = getScannedBuiltinExtensions;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -50,5 +50,2 @@ "use strict";

}
function valueOrFirst(value) {
return Array.isArray(value) ? value[0] : value;
}
async function getWorkbenchOptions(ctx, config) {

@@ -95,11 +92,5 @@ const options = {};

router.use(async (ctx, next) => {
if (ctx.query['dev'] || config.build.type === 'sources') {
try {
const builtInExtensions = await (0, download_1.fetchJSON)('http://localhost:8080/builtin');
ctx.state.workbench = new Workbench('http://localhost:8080/static', true, builtInExtensions);
}
catch (err) {
console.log(err);
ctx.throw('Could not connect to localhost:8080, make sure you start `yarn web`', 400);
}
if (config.build.type === 'sources') {
const builtInExtensions = await (0, extensions_1.getScannedBuiltinExtensions)(config.build.location);
ctx.state.workbench = new Workbench(`${ctx.protocol}://${ctx.host}/static/sources`, true, builtInExtensions);
}

@@ -114,32 +105,5 @@ else if (config.build.type === 'static') {

});
const callbacks = new Map();
router.get('/callback', async (ctx) => {
const { 'vscode-requestId': vscodeRequestId, 'vscode-scheme': vscodeScheme, 'vscode-authority': vscodeAuthority, 'vscode-path': vscodePath, 'vscode-query': vscodeQuery, 'vscode-fragment': vscodeFragment, } = ctx.query;
if (!vscodeRequestId || !vscodeScheme || !vscodeAuthority) {
return ctx.throw(400);
}
const requestId = valueOrFirst(vscodeRequestId);
const uri = vscode_uri_1.URI.from({
scheme: valueOrFirst(vscodeScheme),
authority: valueOrFirst(vscodeAuthority),
path: valueOrFirst(vscodePath),
query: valueOrFirst(vscodeQuery),
fragment: valueOrFirst(vscodeFragment),
});
callbacks.set(requestId, uri);
ctx.body = await ctx.state.workbench.renderCallback();
});
router.get('/fetch-callback', async (ctx) => {
const { 'vscode-requestId': vscodeRequestId } = ctx.query;
if (!vscodeRequestId) {
return ctx.throw(400);
}
const requestId = valueOrFirst(vscodeRequestId);
const uri = callbacks.get(requestId);
if (!uri) {
return ctx.throw(400);
}
callbacks.delete(requestId);
ctx.body = uri.toJSON();
});
router.get('/', async (ctx) => {

@@ -149,5 +113,4 @@ const options = await getWorkbenchOptions(ctx, config);

});
//mountAPI(config, router);
return router.routes();
}
exports.default = default_1;
{
"name": "@vscode/test-web",
"version": "0.0.15",
"version": "0.0.16",
"scripts": {

@@ -14,3 +14,3 @@ "install-extensions": "yarn --cwd=fs-provider && yarn --cwd=sample",

"compile-sample": "yarn --cwd=sample compile-web",
"sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --browserType=chromium sample/test-workspace",
"sample": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --browserType=chromium --verbose sample/test-workspace",
"sample-tests": "npm run compile && npm run compile-sample && node . --extensionDevelopmentPath=sample --extensionTestsPath=sample/dist/web/test/suite/index.js --browserType=chromium --headless=false sample/test-workspace"

@@ -17,0 +17,0 @@ },

@@ -73,3 +73,4 @@ # @vscode/test-web

| --extensionTestsPath | A path to a test module to run. |
| --version | `insiders` (default), `stable` or `sources`.<br>For sources, also run `yarn web` in a vscode repo |
| --quality | `insiders` (default), or `stable`. Ignored when sourcesPath is provided. |
| --sourcesPath | If set, runs from VS Code sources located at the given path. Make sure the sources and extensions are compiled (`yarn compile` and `yarn compile-web`) |
| --open-devtools| If set, opens the dev tools |

@@ -76,0 +77,0 @@ | --headless| If set, hides the browser. Defaults to true when an extensionTestsPath is provided, otherwise false. |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc