Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 (#15681)

* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898

* Fixes and cleanup

* Distro

* Fix hygiene yarn

* delete no yarn lock changes file

* Fix hygiene

* Fix layer check

* Fix CI

* Skip lib checks

* Remove tests deleted in vs code

* Fix tests

* Distro

* Fix tests and add removed extension point

* Skip failing notebook tests for now

* Disable broken tests and cleanup build folder

* Update yarn.lock and fix smoke tests

* Bump sqlite

* fix contributed actions and file spacing

* Fix user data path

* Update yarn.locks

Co-authored-by: ADS Merger <karlb@microsoft.com>
This commit is contained in:
Charles Gagnon
2021-06-17 08:17:11 -07:00
committed by GitHub
parent fdcb97c7f7
commit 3cb2f552a6
2582 changed files with 124827 additions and 87099 deletions

4
extensions/simple-browser/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore built files
media/*.js
media/codicon.css
media/codicon.ttf

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,210 +0,0 @@
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./preview-src/index.ts");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./preview-src/events.ts":
/*!*******************************!*\
!*** ./preview-src/events.ts ***!
\*******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.onceDocumentLoaded = void 0;
function onceDocumentLoaded(f) {
if (document.readyState === 'loading' || document.readyState === 'uninitialized') {
document.addEventListener('DOMContentLoaded', f);
}
else {
f();
}
}
exports.onceDocumentLoaded = onceDocumentLoaded;
/***/ }),
/***/ "./preview-src/index.ts":
/*!******************************!*\
!*** ./preview-src/index.ts ***!
\******************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const events_1 = __webpack_require__(/*! ./events */ "./preview-src/events.ts");
const vscode = acquireVsCodeApi();
function getSettings() {
const element = document.getElementById('simple-browser-settings');
if (element) {
const data = element.getAttribute('data-settings');
if (data) {
return JSON.parse(data);
}
}
throw new Error(`Could not load settings`);
}
const settings = getSettings();
const iframe = document.querySelector('iframe');
const header = document.querySelector('.header');
const input = header.querySelector('.url-input');
const forwardButton = header.querySelector('.forward-button');
const backButton = header.querySelector('.back-button');
const reloadButton = header.querySelector('.reload-button');
const openExternalButton = header.querySelector('.open-external-button');
window.addEventListener('message', e => {
switch (e.data.type) {
case 'focus':
{
iframe.focus();
break;
}
case 'didChangeFocusLockIndicatorEnabled':
{
toggleFocusLockIndicatorEnabled(e.data.enabled);
break;
}
}
});
events_1.onceDocumentLoaded(() => {
setInterval(() => {
var _a;
const iframeFocused = ((_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.tagName) === 'IFRAME';
document.body.classList.toggle('iframe-focused', iframeFocused);
}, 50);
iframe.addEventListener('load', () => {
// Noop
});
input.addEventListener('change', e => {
const url = e.target.value;
navigateTo(url);
});
forwardButton.addEventListener('click', () => {
history.forward();
});
backButton.addEventListener('click', () => {
history.back();
});
openExternalButton.addEventListener('click', () => {
vscode.postMessage({
type: 'openExternal',
url: input.value
});
});
reloadButton.addEventListener('click', () => {
// This does not seem to trigger what we want
// history.go(0);
// This incorrectly adds entries to the history but does reload
iframe.src = input.value;
});
navigateTo(settings.url);
toggleFocusLockIndicatorEnabled(settings.focusLockIndicatorEnabled);
function navigateTo(url) {
iframe.src = url;
}
});
function toggleFocusLockIndicatorEnabled(enabled) {
document.body.classList.toggle('enable-focus-lock-indicator', enabled);
}
/***/ })
/******/ });
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@@ -52,6 +52,7 @@ button {
button:hover:not(:disabled) {
cursor: pointer;
color: var(--vscode-button-foreground);
background: var(--vscode-button-hoverBackground);
}
@@ -93,6 +94,7 @@ iframe {
width: 100%;
height: 100%;
border: none;
background: white; /* Browsers default to a white background */
}
.iframe-focused-alert {

View File

@@ -4,7 +4,7 @@
"description": "%description%",
"enableProposedApi": true,
"version": "1.0.0",
"icon": "icon.png",
"icon": "media/icon.png",
"publisher": "vscode",
"license": "MIT",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
@@ -16,12 +16,23 @@
"categories": [
"Other"
],
"extensionKind": [
"ui",
"workspace",
"web"
],
"activationEvents": [
"onCommand:simpleBrowser.show",
"onCommand:simpleBrowser.api.open",
"onOpenExternalUri:http",
"onOpenExternalUri:https"
],
"capabilities": {
"virtualWorkspaces": true,
"untrustedWorkspaces": {
"supported": true
}
},
"contributes": {
"commands": [
{
@@ -49,22 +60,18 @@
"watch": "npm run build-preview && gulp watch-extension:markdown-language-features",
"vscode:prepublish": "npm run build-ext && npm run build-preview",
"build-ext": "node ../../node_modules/gulp/bin/gulp.js --gulpfile ../../build/gulpfile.extensions.js compile-extension:markdown-language-features ./tsconfig.json",
"build-preview": "webpack --mode development",
"build-preview-production": "webpack --mode production",
"build-preview": "npx webpack-cli --mode development",
"build-preview-production": "npx webpack-cli --mode production",
"compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none",
"watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose"
},
"dependencies": {
"vscode-codicons": "^0.0.12",
"vscode-extension-telemetry": "0.1.1",
"vscode-extension-telemetry": "0.1.7",
"vscode-nls": "^4.0.0"
},
"devDependencies": {
"@types/node": "^12.11.7",
"ts-loader": "^6.2.1",
"typescript": "^3.7.3",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.0"
"vscode-codicons": "^0.0.14",
"@types/node": "^12.11.7"
},
"repository": {
"type": "git",

View File

@@ -80,14 +80,28 @@ onceDocumentLoaded(() => {
// history.go(0);
// This incorrectly adds entries to the history but does reload
iframe.src = input.value;
// It also always incorrectly always loads the value in the input bar,
// which may not match the current page if the user has navigated
navigateTo(input.value);
});
navigateTo(settings.url);
input.value = settings.url;
toggleFocusLockIndicatorEnabled(settings.focusLockIndicatorEnabled);
function navigateTo(url: string): void {
iframe.src = url;
function navigateTo(rawUrl: string): void {
try {
const url = new URL(rawUrl);
// Try to bust the cache for the iframe
// There does not appear to be any way to reliably do this except modifying the url
url.searchParams.append('vscodeBrowserReqId', Date.now().toString());
iframe.src = url.toString();
} catch {
iframe.src = rawUrl;
}
}
});

View File

@@ -1,5 +1,5 @@
{
"extends": "../../shared.tsconfig.json",
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/",
"jsx": "react",

View File

@@ -16,7 +16,16 @@ const showCommand = 'simpleBrowser.show';
const enabledHosts = new Set<string>([
'localhost',
'127.0.0.1'
// localhost IPv4
'127.0.0.1',
// localhost IPv6
'0:0:0:0:0:0:0:1',
'::1',
// all interfaces IPv4
'0.0.0.0',
// all interfaces IPv6
'0:0:0:0:0:0:0:0',
'::'
]);
const openerId = 'simpleBrowser.open';

View File

@@ -37,6 +37,9 @@ export class SimpleBrowserView extends Disposable {
}, {
enableScripts: true,
retainContextWhenHidden: true,
localResourceRoots: [
vscode.Uri.joinPath(extensionUri, 'media')
]
}));
this._register(this._webviewPanel.webview.onDidReceiveMessage(e => {
@@ -69,7 +72,7 @@ export class SimpleBrowserView extends Disposable {
this.show(url);
}
public dispose() {
public override dispose() {
this._onDidDispose.fire();
super.dispose();
}
@@ -86,8 +89,7 @@ export class SimpleBrowserView extends Disposable {
const mainJs = this.extensionResourceUrl('media', 'index.js');
const mainCss = this.extensionResourceUrl('media', 'main.css');
const codiconsUri = this.extensionResourceUrl('node_modules', 'vscode-codicons', 'dist', 'codicon.css');
const codiconsFontUri = this.extensionResourceUrl('node_modules', 'vscode-codicons', 'dist', 'codicon.ttf');
const codiconsUri = this.extensionResourceUrl('media', 'codicon.css');
return /* html */ `<!DOCTYPE html>
<html>
@@ -96,7 +98,7 @@ export class SimpleBrowserView extends Disposable {
<meta http-equiv="Content-Security-Policy" content="
default-src 'none';
font-src ${codiconsFontUri};
font-src ${this._webviewPanel.webview.cspSource};
style-src ${this._webviewPanel.webview.cspSource};
script-src 'nonce-${nonce}';
frame-src *;
@@ -126,7 +128,7 @@ export class SimpleBrowserView extends Disposable {
class="reload-button icon"><i class="codicon codicon-refresh"></i></button>
</nav>
<input class="url-input" type="text" value=${url}>
<input class="url-input" type="text">
<nav class="controls">
<button

View File

@@ -1,5 +1,5 @@
{
"extends": "../shared.tsconfig.json",
"extends": "../tsconfig.base.json",
"compilerOptions": {
"outDir": "./out",
"experimentalDecorators": true

View File

@@ -3,12 +3,14 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
context: path.resolve(__dirname),
entry: {
index: './preview-src/index.ts',
},
devtool: 'source-map',
mode: 'production',
module: {
rules: [
{
@@ -24,5 +26,20 @@ module.exports = {
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'media')
}
},
plugins: [
// @ts-ignore
new CopyPlugin({
patterns: [
{
from: './node_modules/vscode-codicons/dist/codicon.css',
to: 'codicon.css'
},
{
from: './node_modules/vscode-codicons/dist/codicon.ttf',
to: 'codicon.ttf'
},
],
}),
]
};

File diff suppressed because it is too large Load Diff