Fix esbuild warnings

This commit is contained in:
Alexandru Dima 2021-11-12 14:22:44 +01:00
parent aa5bb2cfa7
commit 84e25e9b41
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
4 changed files with 18 additions and 9 deletions

View file

@ -12,7 +12,7 @@ const generatedNote = `//
// //
`; `;
const REPO_ROOT = path.join(__dirname, '../../'); const REPO_ROOT = path.join(__dirname, '../');
const TYPESCRIPT_LIB_SOURCE = path.join(REPO_ROOT, 'node_modules/typescript/lib'); const TYPESCRIPT_LIB_SOURCE = path.join(REPO_ROOT, 'node_modules/typescript/lib');
const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'monaco-typescript/src/lib'); const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'monaco-typescript/src/lib');
@ -109,6 +109,15 @@ define("vs/language/typescript/lib/typescriptServices", [], function() { return
stripSourceMaps(tsServices_amd) stripSourceMaps(tsServices_amd)
); );
// Remove pattern that creates warnings with esbuild
// e.g.
// > monaco-typescript/src/lib/typescriptServices.js:20:21: warning: Top-level "this" will be replaced with undefined since this file is an ECMAScript module
// 20 │ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
// ╵ ~~~~
//
tsServices = tsServices.replace(/\nvar ([^ ]+) = \(this && this\.([^)]+)\) \|\|/gm, '\nvar $1 =')
const tsServices_esm = const tsServices_esm =
generatedNote + generatedNote +
tsServices + tsServices +

View file

@ -1,6 +1,5 @@
{ {
"scripts": { "scripts": {
"watch": "../node_modules/.bin/tsc -p ./src --watch", "watch": "../node_modules/.bin/tsc -p ./src --watch"
"import-typescript": "node ./scripts/importTypescript"
} }
} }

View file

@ -17,7 +17,7 @@ and limitations under the License.
***************************************************************************** */ ***************************************************************************** */
"use strict"; "use strict";
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { var __spreadArray = function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) { if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i); if (!ar) ar = Array.prototype.slice.call(from, 0, i);
@ -26,7 +26,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
} }
return to.concat(ar || Array.prototype.slice.call(from)); return to.concat(ar || Array.prototype.slice.call(from));
}; };
var __assign = (this && this.__assign) || function () { var __assign = function () {
__assign = Object.assign || function(t) { __assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) { for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i]; s = arguments[i];
@ -37,11 +37,11 @@ var __assign = (this && this.__assign) || function () {
}; };
return __assign.apply(this, arguments); return __assign.apply(this, arguments);
}; };
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { var __makeTemplateObject = function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked; return cooked;
}; };
var __generator = (this && this.__generator) || function (thisArg, body) { var __generator = function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; } function verb(n) { return function (v) { return step([n, v]); }; }
@ -68,7 +68,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
} }
}; };
var __rest = (this && this.__rest) || function (s, e) { var __rest = function (s, e) {
var t = {}; var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p]; t[p] = s[p];
@ -79,7 +79,7 @@ var __rest = (this && this.__rest) || function (s, e) {
} }
return t; return t;
}; };
var __extends = (this && this.__extends) || (function () { var __extends = (function () {
var extendStatics = function (d, b) { var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf || extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||

View file

@ -7,6 +7,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"simpleserver": "gulp simpleserver", "simpleserver": "gulp simpleserver",
"import-typescript": "node ./monaco-typescript/importTypescript",
"release-css": "node ./monaco-css/build", "release-css": "node ./monaco-css/build",
"release-html": "node ./monaco-html/build", "release-html": "node ./monaco-html/build",
"release-json": "node ./monaco-json/build", "release-json": "node ./monaco-json/build",