未验证 提交 b1c5e2f1 编写于 作者: M Matt Bierner 提交者: GitHub

Don't include dom typings in extensions (#89942)

**Problem**
All of our extensions currently are built using the dom typings. This can lead to runtime errors if you mistakenly use `window` or similar

**Fix**
Exclude the dom typings from compile. Then explicitly import the node types for `URL` and `TextEncoder`
上级 a861520a
......@@ -9,6 +9,7 @@ import { fromGitUri, toGitUri } from './uri';
import { Model, ModelChangeEvent, OriginalResourceChangeEvent } from './model';
import { filterEvent, eventToPromise, isDescendant, pathEquals, EmptyDisposable } from './util';
import { Repository } from './repository';
import { TextEncoder } from 'util';
interface CacheRow {
uri: Uri;
......
......@@ -2,6 +2,11 @@
"extends": "../../shared.tsconfig.json",
"compilerOptions": {
"outDir": "./dist/",
"jsx": "react"
"jsx": "react",
"lib": [
"es2018",
"DOM",
"DOM.Iterable"
]
}
}
{
"compilerOptions": {
"target": "es2018",
"lib": [
"es2018"
],
"module": "commonjs",
"strict": true,
"alwaysStrict": true,
......
......@@ -13,10 +13,14 @@
//
import * as vscode from 'vscode';
import { URL } from 'url';
import { TextEncoder, TextDecoder } from 'util';
const textEncoder = new TextEncoder();
const SCHEME = 'memfs';
declare const window: unknown;
export function activate(context: vscode.ExtensionContext) {
if (typeof window !== 'undefined') { // do not run under node.js
const memFs = enableFs(context);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册