@codingame/monaco-vscode-api 16.0.3 → 16.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-api",
3
- "version": "16.0.3",
3
+ "version": "16.0.4",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor",
6
6
  "keywords": [],
@@ -15,13 +15,14 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-base-service-override": "16.0.3",
19
- "@codingame/monaco-vscode-environment-service-override": "16.0.3",
20
- "@codingame/monaco-vscode-extensions-service-override": "16.0.3",
21
- "@codingame/monaco-vscode-files-service-override": "16.0.3",
22
- "@codingame/monaco-vscode-host-service-override": "16.0.3",
23
- "@codingame/monaco-vscode-layout-service-override": "16.0.3",
24
- "@codingame/monaco-vscode-quickaccess-service-override": "16.0.3",
18
+ "@c4312/eventsource-umd": "3.0.5",
19
+ "@codingame/monaco-vscode-base-service-override": "16.0.4",
20
+ "@codingame/monaco-vscode-environment-service-override": "16.0.4",
21
+ "@codingame/monaco-vscode-extensions-service-override": "16.0.4",
22
+ "@codingame/monaco-vscode-files-service-override": "16.0.4",
23
+ "@codingame/monaco-vscode-host-service-override": "16.0.4",
24
+ "@codingame/monaco-vscode-layout-service-override": "16.0.4",
25
+ "@codingame/monaco-vscode-quickaccess-service-override": "16.0.4",
25
26
  "marked": "14.0.0"
26
27
  },
27
28
  "main": "services.js",
package/services.js CHANGED
@@ -181,10 +181,10 @@ export { IKeybindingService } from './vscode/src/vs/platform/keybinding/common/k
181
181
  export { ISecretStorageService } from './vscode/src/vs/platform/secrets/common/secrets.service.js';
182
182
  export { ConfigurationTarget } from './vscode/src/vs/platform/configuration/common/configuration.js';
183
183
 
184
- if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== "1.99.3-6fbbdba3-e1d0-4e7a-a048-11f5a59e49c5") {
185
- throw new Error(`Another version of monaco-vscode-api has already been loaded. Trying to load ${"1.99.3-6fbbdba3-e1d0-4e7a-a048-11f5a59e49c5"}, ${window.monacoVscodeApiBuildId} is already loaded`);
184
+ if (window.monacoVscodeApiBuildId != null && window.monacoVscodeApiBuildId !== "1.99.3-2d334896-16b2-4125-a190-26e53250d84f") {
185
+ throw new Error(`Another version of monaco-vscode-api has already been loaded. Trying to load ${"1.99.3-2d334896-16b2-4125-a190-26e53250d84f"}, ${window.monacoVscodeApiBuildId} is already loaded`);
186
186
  }
187
- window.monacoVscodeApiBuildId = "1.99.3-6fbbdba3-e1d0-4e7a-a048-11f5a59e49c5";
187
+ window.monacoVscodeApiBuildId = "1.99.3-2d334896-16b2-4125-a190-26e53250d84f";
188
188
  async function initialize(overrides, container = document.body, configuration = {}, env) {
189
189
  checkServicesNotInitialized();
190
190
  initialize$1(container, configuration, env);
@@ -1,6 +1,5 @@
1
1
 
2
2
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
3
- import { importAMDNodeModule } from '../../../amdX.js';
4
3
  import { Sequencer, DeferredPromise } from '../../../base/common/async.js';
5
4
  import { CancellationToken } from '../../../base/common/cancellation.js';
6
5
  import { Lazy } from '../../../base/common/lazy.js';
@@ -20,7 +19,7 @@ let ExtHostMcpService = class ExtHostMcpService extends Disposable {
20
19
  this._initialProviderPromises = ( new Set());
21
20
  this._sseEventSources = this._register(( new DisposableMap()));
22
21
  this._eventSource = ( new Lazy(async () => {
23
- const es = await importAMDNodeModule('@c4312/eventsource-umd', 'dist/index.umd.js');
22
+ const es = await import('@c4312/eventsource-umd').then(module => module.default ?? module);
24
23
  return es.EventSource;
25
24
  }));
26
25
  this._proxy = ( extHostRpc.getProxy(MainContext.MainThreadMcp));
@@ -1,3 +0,0 @@
1
- export declare const canASAR = false;
2
- export declare function importAMDNodeModule<T>(nodeModuleName: string, pathInsideNodeModule: string, isBuilt?: boolean): Promise<T>;
3
- export declare function resolveAmdNodeModulePath(nodeModuleName: string, pathInsideNodeModule: string): string;
@@ -1,188 +0,0 @@
1
-
2
- import { Schemas, VSCODE_AUTHORITY, nodeModulesPath, FileAccess } from './base/common/network.js';
3
- import './base/common/platform.js';
4
- import { URI } from './base/common/uri.js';
5
- import { generateUuid } from './base/common/uuid.js';
6
-
7
- class DefineCall {
8
- constructor(id, dependencies, callback) {
9
- this.id = id;
10
- this.dependencies = dependencies;
11
- this.callback = callback;
12
- }
13
- }
14
- var AMDModuleImporterState;
15
- (function (AMDModuleImporterState) {
16
- AMDModuleImporterState[AMDModuleImporterState["Uninitialized"] = 1] = "Uninitialized";
17
- AMDModuleImporterState[AMDModuleImporterState["InitializedInternal"] = 2] = "InitializedInternal";
18
- AMDModuleImporterState[AMDModuleImporterState["InitializedExternal"] = 3] = "InitializedExternal";
19
- })(AMDModuleImporterState || (AMDModuleImporterState = {}));
20
- class AMDModuleImporter {
21
- static { this.INSTANCE = ( new AMDModuleImporter()); }
22
- constructor() {
23
- this._isWebWorker = (typeof self === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope');
24
- this._isRenderer = typeof document === 'object';
25
- this._defineCalls = [];
26
- this._state = AMDModuleImporterState.Uninitialized;
27
- }
28
- _initialize() {
29
- if (this._state === AMDModuleImporterState.Uninitialized) {
30
- if (globalThis.define) {
31
- this._state = AMDModuleImporterState.InitializedExternal;
32
- return;
33
- }
34
- }
35
- else {
36
- return;
37
- }
38
- this._state = AMDModuleImporterState.InitializedInternal;
39
- globalThis.define = (id, dependencies, callback) => {
40
- if (typeof id !== 'string') {
41
- callback = dependencies;
42
- dependencies = id;
43
- id = null;
44
- }
45
- if (typeof dependencies !== 'object' || !Array.isArray(dependencies)) {
46
- callback = dependencies;
47
- dependencies = null;
48
- }
49
- this._defineCalls.push(( new DefineCall(id, dependencies, callback)));
50
- };
51
- globalThis.define.amd = true;
52
- if (this._isRenderer) {
53
- this._amdPolicy = globalThis._VSCODE_WEB_PACKAGE_TTP ?? window.trustedTypes?.createPolicy('amdLoader', {
54
- createScriptURL(value) {
55
- if (value.startsWith(window.location.origin)) {
56
- return value;
57
- }
58
- if (value.startsWith(`${Schemas.vscodeFileResource}://${VSCODE_AUTHORITY}`)) {
59
- return value;
60
- }
61
- throw ( new Error(`[trusted_script_src] Invalid script url: ${value}`));
62
- }
63
- });
64
- }
65
- else if (this._isWebWorker) {
66
- this._amdPolicy = globalThis._VSCODE_WEB_PACKAGE_TTP ?? globalThis.trustedTypes?.createPolicy('amdLoader', {
67
- createScriptURL(value) {
68
- return value;
69
- }
70
- });
71
- }
72
- }
73
- async load(scriptSrc) {
74
- this._initialize();
75
- if (this._state === AMDModuleImporterState.InitializedExternal) {
76
- return ( new Promise(resolve => {
77
- const tmpModuleId = generateUuid();
78
- globalThis.define(tmpModuleId, [scriptSrc], function (moduleResult) {
79
- resolve(moduleResult);
80
- });
81
- }));
82
- }
83
- const defineCall = await (this._isWebWorker ? this._workerLoadScript(scriptSrc) : this._isRenderer ? this._rendererLoadScript(scriptSrc) : this._nodeJSLoadScript(scriptSrc));
84
- if (!defineCall) {
85
- console.warn(`Did not receive a define call from script ${scriptSrc}`);
86
- return undefined;
87
- }
88
- const exports = {};
89
- const dependencyObjs = [];
90
- const dependencyModules = [];
91
- if (Array.isArray(defineCall.dependencies)) {
92
- for (const mod of defineCall.dependencies) {
93
- if (mod === 'exports') {
94
- dependencyObjs.push(exports);
95
- }
96
- else {
97
- dependencyModules.push(mod);
98
- }
99
- }
100
- }
101
- if (dependencyModules.length > 0) {
102
- throw ( new Error(
103
- `Cannot resolve dependencies for script ${scriptSrc}. The dependencies are: ${dependencyModules.join(', ')}`
104
- ));
105
- }
106
- if (typeof defineCall.callback === 'function') {
107
- return defineCall.callback(...dependencyObjs) ?? exports;
108
- }
109
- else {
110
- return defineCall.callback;
111
- }
112
- }
113
- _rendererLoadScript(scriptSrc) {
114
- return ( new Promise((resolve, reject) => {
115
- const scriptElement = document.createElement('script');
116
- scriptElement.setAttribute('async', 'async');
117
- scriptElement.setAttribute('type', 'text/javascript');
118
- const unbind = () => {
119
- scriptElement.removeEventListener('load', loadEventListener);
120
- scriptElement.removeEventListener('error', errorEventListener);
121
- };
122
- const loadEventListener = (e) => {
123
- unbind();
124
- resolve(this._defineCalls.pop());
125
- };
126
- const errorEventListener = (e) => {
127
- unbind();
128
- reject(e);
129
- };
130
- scriptElement.addEventListener('load', loadEventListener);
131
- scriptElement.addEventListener('error', errorEventListener);
132
- if (this._amdPolicy) {
133
- scriptSrc = this._amdPolicy.createScriptURL(scriptSrc);
134
- }
135
- scriptElement.setAttribute('src', scriptSrc);
136
- window.document.getElementsByTagName('head')[0].appendChild(scriptElement);
137
- }));
138
- }
139
- async _workerLoadScript(scriptSrc) {
140
- if (this._amdPolicy) {
141
- scriptSrc = this._amdPolicy.createScriptURL(scriptSrc);
142
- }
143
- await import(scriptSrc).then(module => module.default ?? module);
144
- return this._defineCalls.pop();
145
- }
146
- async _nodeJSLoadScript(scriptSrc) {
147
- try {
148
- const fs = (await import(`${'fs'}`).then(module => module.default ?? module)).default;
149
- const vm = (await import(`${'vm'}`).then(module => module.default ?? module)).default;
150
- const module = (await import(`${'module'}`).then(module => module.default ?? module)).default;
151
- const filePath = ( URI.parse(scriptSrc)).fsPath;
152
- const content = ( fs.readFileSync(filePath).toString());
153
- const scriptSource = module.wrap(content.replace(/^#!.*/, ''));
154
- const script = new vm.Script(scriptSource);
155
- const compileWrapper = script.runInThisContext();
156
- compileWrapper.apply();
157
- return this._defineCalls.pop();
158
- }
159
- catch (error) {
160
- throw error;
161
- }
162
- }
163
- }
164
- const cache = ( new Map());
165
- async function importAMDNodeModule(nodeModuleName, pathInsideNodeModule, isBuilt) {
166
- if (isBuilt === undefined) {
167
- const product = globalThis._VSCODE_PRODUCT_JSON;
168
- isBuilt = Boolean((product ?? globalThis.vscode?.context?.configuration()?.product)?.commit);
169
- }
170
- const nodeModulePath = `${nodeModuleName}/${pathInsideNodeModule}` ;
171
- if (( cache.has(nodeModulePath))) {
172
- return cache.get(nodeModulePath);
173
- }
174
- let scriptSrc;
175
- if (/^\w[\w\d+.-]*:\/\//.test(nodeModulePath)) {
176
- scriptSrc = nodeModulePath;
177
- }
178
- else {
179
- const actualNodeModulesPath = (nodeModulesPath);
180
- const resourcePath = `${actualNodeModulesPath}/${nodeModulePath}`;
181
- scriptSrc = ( ( FileAccess.asBrowserUri(resourcePath)).toString(true));
182
- }
183
- const result = AMDModuleImporter.INSTANCE.load(scriptSrc);
184
- cache.set(nodeModulePath, result);
185
- return result;
186
- }
187
-
188
- export { importAMDNodeModule };