From 9eb7c1814345f07489f0628076cdde5773adfdf0 Mon Sep 17 00:00:00 2001 From: Henning Dieterichs Date: Wed, 2 Feb 2022 16:21:57 +0100 Subject: [PATCH] Don't load editor api from global API but use require directly. --- build/fillers/monaco-editor-core-amd.ts | 8 -------- build/utils.js | 5 +++-- src/fillers/editor.api.d.ts | 4 ++++ src/fillers/monaco-editor-core-amd.ts | 7 +++---- 4 files changed, 10 insertions(+), 14 deletions(-) delete mode 100644 build/fillers/monaco-editor-core-amd.ts create mode 100644 src/fillers/editor.api.d.ts diff --git a/build/fillers/monaco-editor-core-amd.ts b/build/fillers/monaco-editor-core-amd.ts deleted file mode 100644 index 94c0b54e..00000000 --- a/build/fillers/monaco-editor-core-amd.ts +++ /dev/null @@ -1,8 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -// Resolves with the global monaco API - -export = (self).monaco; diff --git a/build/utils.js b/build/utils.js index 6700fd09..3c1a9e50 100644 --- a/build/utils.js +++ b/build/utils.js @@ -181,9 +181,10 @@ function buildOneAMD(type, options) { plugins: [ alias({ 'vscode-nls': path.join(__dirname, '../build/fillers/vscode-nls.ts'), - 'monaco-editor-core': path.join(__dirname, '../build/fillers/monaco-editor-core-amd.ts') + 'monaco-editor-core': path.join(__dirname, '../src/fillers/monaco-editor-core-amd.ts') }) - ] + ], + external: ['vs/editor/editor.api'] }; if (type === 'min') { opts.minify = true; diff --git a/src/fillers/editor.api.d.ts b/src/fillers/editor.api.d.ts new file mode 100644 index 00000000..9404b2fc --- /dev/null +++ b/src/fillers/editor.api.d.ts @@ -0,0 +1,4 @@ +declare module 'vs/editor/editor.api' { + const x: any; + export = x; +} diff --git a/src/fillers/monaco-editor-core-amd.ts b/src/fillers/monaco-editor-core-amd.ts index 0e8a7e3f..3580fa0f 100644 --- a/src/fillers/monaco-editor-core-amd.ts +++ b/src/fillers/monaco-editor-core-amd.ts @@ -5,8 +5,7 @@ // Resolves with the global monaco API -declare var define: any; +/// +import * as api from 'vs/editor/editor.api'; -define([], function () { - return (self).monaco; -}); +export = api;