simplify `_VSCODE_NODE_MODULES` util

pull/166686/head
Johannes 2022-11-17 17:58:51 +01:00
parent e14d874adb
commit d555777b1a
No known key found for this signature in database
GPG Key ID: 6DEF802A22264FCA
6 changed files with 8 additions and 48 deletions

View File

@ -38,14 +38,7 @@ if (process.env['VSCODE_PARENT_PID']) {
}
// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), {
get(target, mod) {
if (!target[mod] && typeof mod === 'string') {
target[mod] = require(mod);
}
return target[mod];
}
});
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => require(String(mod)) });
// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = require('../product.json');

View File

@ -113,14 +113,7 @@
window['MonacoEnvironment'] = {};
// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), {
get(target, mod) {
if (!target[mod] && typeof mod === 'string') {
target[mod] = (require.__$__nodeRequire ?? require)(mod);
}
return target[mod];
}
});
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => (require.__$__nodeRequire ?? require)(String(mod)) });
// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = (require.__$__nodeRequire ?? require)(configuration.appRoot + '/product.json');

View File

@ -142,14 +142,7 @@ function startup(codeCachePath, nlsConfig) {
process.env['VSCODE_CODE_CACHE_PATH'] = codeCachePath || '';
// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), {
get(target, mod) {
if (!target[mod] && typeof mod === 'string') {
target[mod] = require(mod);
}
return target[mod];
}
});
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => require(String(mod)) });
// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = require('../product.json');

View File

@ -260,14 +260,8 @@ function loadCode() {
const path = require('path');
// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), {
get(target, mod) {
if (!target[mod] && typeof mod === 'string') {
target[mod] = require(mod);
}
return target[mod];
}
});
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => require(String(mod)) });
// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = require('../product.json');
globalThis._VSCODE_PACKAGE_JSON = require('../package.json');

View File

@ -73,14 +73,8 @@ if (util.inspect && util.inspect['defaultOptions']) {
}
// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), {
get(target, mod) {
if (!target[mod] && typeof mod === 'string') {
target[mod] = (require.__$__nodeRequire ?? require)(mod);
}
return target[mod];
}
});
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => (require.__$__nodeRequire ?? require)(String(mod)) });
// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = (require.__$__nodeRequire ?? require)('../../../product.json');
globalThis._VSCODE_PACKAGE_JSON = (require.__$__nodeRequire ?? require)('../../../package.json');

View File

@ -58,14 +58,7 @@ if (majorRequiredNodeVersion !== currentMajorNodeVersion) {
function main() {
// VSCODE_GLOBALS: node_modules
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), {
get(target, mod) {
if (!target[mod] && typeof mod === 'string') {
target[mod] = require(mod);
}
return target[mod];
}
});
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => require(String(mod)) });
// VSCODE_GLOBALS: package/product.json
globalThis._VSCODE_PRODUCT_JSON = require(`${REPO_ROOT}/product.json`);