Fix the shape of insane.js to make it ESM compatible (microsoft/monaco-editor#1574)

This commit is contained in:
Alex Dima 2019-09-18 16:05:59 +02:00 committed by Alexandru Dima
parent fe9e05d8d7
commit 3ff057ce33
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
3 changed files with 9 additions and 19 deletions

View file

@ -9,7 +9,7 @@ import { onUnexpectedError } from 'vs/base/common/errors';
import { IMarkdownString, parseHrefAndDimensions, removeMarkdownEscapes } from 'vs/base/common/htmlContent';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import * as marked from 'vs/base/common/marked/marked';
import * as insane from 'vs/base/common/insane/insane';
import { insane } from 'vs/base/common/insane/insane';
import { parse } from 'vs/base/common/marshalling';
import { cloneAndChange } from 'vs/base/common/objects';
import { escape } from 'vs/base/common/strings';

View file

@ -3,11 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export as namespace insane;
export = insane;
declare function insane(
export function insane(
html: string,
options?: {
readonly allowedSchemes?: readonly string[],
@ -16,5 +12,3 @@ declare function insane(
},
strict?: boolean,
): string;
declare namespace insane { }

View file

@ -21,11 +21,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// ESM-comment-begin
let __insane_exports;
// ESM-comment-end
let __insane_func;
(function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({
1: [function (require, module, exports) {
@ -92,7 +88,7 @@ let __insane_exports;
insane.defaults = defaults;
module.exports = insane;
__insane_exports = insane;
__insane_func = insane;
}, { "./defaults": 2, "./parser": 7, "./sanitizer": 8, "assignment": 6, "he": 9 }], 5: [function (require, module, exports) {
'use strict';
@ -469,10 +465,10 @@ let __insane_exports;
}, {}]
}, {}, [4]);
// BEGIN MONACOCHANGE
// __marked_exports = marked;
// }).call(this);
// ESM-comment-begin
define(function() { return __insane_exports; });
define(function() { return { insane: __insane_func }; });
// ESM-comment-end
// ESM-uncomment-begin
// export var insane = __insane_func;
// ESM-uncomment-end