Skip to content

Commit c981ea2

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/chengluyu/153968
2 parents 8b9f7ad + 442ebb8 commit c981ea2

File tree

55 files changed

+514
-272
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+514
-272
lines changed

build/gulpfile.reh.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,8 @@ function tweakProductForServerWeb(product) {
378378
// TODO: we cannot inline `product.json` because
379379
// it is being changed during build time at a later
380380
// point in time (such as `checksums`)
381-
'../product.json'
381+
'../product.json',
382+
'../package.json'
382383
]
383384
}
384385
}

build/gulpfile.vscode.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ const optimizeVSCodeTask = task.define('optimize-vscode', task.series(
119119
// TODO: we cannot inline `product.json` because
120120
// it is being changed during build time at a later
121121
// point in time (such as `checksums`)
122-
'../product.json'
122+
'../product.json',
123+
'../package.json',
123124
]
124125
},
125126
manual: [

extensions/github-authentication/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@
1717
"ui",
1818
"workspace"
1919
],
20-
"activationEvents": [
21-
"onAuthenticationRequest:github",
22-
"onAuthenticationRequest:github-enterprise"
23-
],
20+
"activationEvents": [],
2421
"capabilities": {
2522
"virtualWorkspaces": true,
2623
"untrustedWorkspaces": {

extensions/microsoft-authentication/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
"categories": [
1313
"Other"
1414
],
15-
"activationEvents": [
16-
"onAuthenticationRequest:microsoft"
17-
],
15+
"activationEvents": [],
1816
"enabledApiProposals": [
1917
"telemetryLogger",
2018
"idToken"

src/bootstrap-amd.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
// when this file is bundled with other files.
1212
const nodeRequire = require;
1313

14+
// VSCODE_GLOBALS: node_modules
15+
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => nodeRequire(String(mod)) });
16+
17+
// VSCODE_GLOBALS: package/product.json
18+
globalThis._VSCODE_PRODUCT_JSON = require('../product.json');
19+
globalThis._VSCODE_PACKAGE_JSON = require('../package.json');
20+
1421
const loader = require('./vs/loader');
1522
const bootstrap = require('./bootstrap');
1623
const performance = require('./vs/base/common/performance');

src/bootstrap-window.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@
112112

113113
window['MonacoEnvironment'] = {};
114114

115+
// VSCODE_GLOBALS: node_modules
116+
globalThis._VSCODE_NODE_MODULES = new Proxy(Object.create(null), { get: (_target, mod) => (require.__$__nodeRequire ?? require)(String(mod)) });
117+
118+
if (!safeProcess.sandboxed) {
119+
// VSCODE_GLOBALS: package/product.json
120+
globalThis._VSCODE_PRODUCT_JSON = (require.__$__nodeRequire ?? require)(configuration.appRoot + '/product.json');
121+
globalThis._VSCODE_PACKAGE_JSON = (require.__$__nodeRequire ?? require)(configuration.appRoot + '/package.json');
122+
}
123+
115124
const loaderConfig = {
116125
baseUrl: `${bootstrapLib.fileUriFromPath(configuration.appRoot, { isWindows: safeProcess.platform === 'win32', scheme: 'vscode-file', fallbackAuthority: 'vscode-app' })}/out`,
117126
'vs/nls': nlsConfig,

src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ function getArgvConfigPath() {
318318
dataFolderName = `${dataFolderName}-dev`;
319319
}
320320

321+
// @ts-ignore
321322
return path.join(os.homedir(), dataFolderName, 'argv.json');
322323
}
323324

src/tsconfig.monaco.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"include": [
1919
"typings/require.d.ts",
2020
"typings/thenable.d.ts",
21+
"typings/vscode-globals-product.d.ts",
2122
"vs/loader.d.ts",
2223
"vs/monaco.d.ts",
2324
"vs/editor/*",

src/typings/require.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ interface NodeRequire {
4545
* @deprecated use `FileAccess.asFileUri()` for node.js contexts or `FileAccess.asBrowserUri` for browser contexts.
4646
*/
4747
toUrl(path: string): string;
48+
49+
/**
50+
* @deprecated MUST not be used anymore
51+
*
52+
* With the move from AMD to ESM we cannot use this anymore. There will be NO MORE node require like this.
53+
*/
54+
__$__nodeRequire<T>(moduleName: string): T;
55+
4856
(dependencies: string[], callback: (...args: any[]) => any, errorback?: (err: any) => void): any;
4957
config(data: any): any;
5058
onError: Function;
51-
__$__nodeRequire<T>(moduleName: string): T;
5259
getStats?(): ReadonlyArray<LoaderEvent>;
5360
hasDependencyCycle?(): boolean;
5461
define(amdModuleId: string, dependencies: string[], callback: (...args: any[]) => any): any;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
// AMD2ESM mirgation relevant
7+
8+
declare global {
9+
10+
/**
11+
* @deprecated node modules that are in used in a context that
12+
* shouldn't have access to node_modules (node-free renderer or
13+
* shared process)
14+
*/
15+
var _VSCODE_NODE_MODULES: {
16+
crypto: typeof import('crypto');
17+
zlib: typeof import('zlib');
18+
net: typeof import('net');
19+
os: typeof import('os');
20+
module: typeof import('module');
21+
['native-watchdog']: typeof import('native-watchdog')
22+
perf_hooks: typeof import('perf_hooks');
23+
24+
['vsda']: any
25+
['vscode-encrypt']: any
26+
}
27+
}
28+
29+
// fake export to make global work
30+
export { }

0 commit comments

Comments
 (0)