1
>
/*---------------------------------------------------------------------------------------------
amdX.ts
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
>
import { AppResourcePath, FileAccess, nodeModulesAsarPath, nodeModulesPath, Schemas, VSCODE_AUTHORITY } from './base/common/network.js';
7
>
import * as platform from './base/common/platform.js';
8
>
import { IProductConfiguration } from './base/common/product.js';
9
>
import { URI } from './base/common/uri.js';
10
>
import { generateUuid } from './base/common/uuid.js';
11
>
12
>
declare const window: any;
13
>
declare const document: any;
14
>
declare const self: any;
15
>
declare const globalThis: any;
16
>
17
>
class DefineCall {
18
>
constructor(
19
public readonly id: string | null | undefined,
20
public readonly dependencies: string[] | null | undefined,
21
public readonly callback: any
22
) { }
24
>
25
>
enum AMDModuleImporterState {
26
>
Uninitialized = 1,
27
>
InitializedInternal,
28
>
InitializedExternal
29
>
}
30
>
31
>
class AMDModuleImporter {
32
>
public static INSTANCE = new AMDModuleImporter();
33
>
34
>
private readonly _isWebWorker = (typeof self === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope');
35
>
private readonly _isRenderer = typeof document === 'object';
36
>
37
>
private readonly _defineCalls: DefineCall[] = [];
38
>
private _state = AMDModuleImporterState.Uninitialized;
39
>
private _amdPolicy: Pick<TrustedTypePolicy, 'name' | 'createScriptURL'> | undefined;
40
>
41
>
constructor() { }
42
>
43
>
private _initialize(): void {
44
if (this._state === AMDModuleImporterState.Uninitialized) {
45
if (globalThis.define) {