@codingame/monaco-editor-wrapper 1.13.0 → 1.14.1

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.
Files changed (3) hide show
  1. package/dist/main.js +45 -17
  2. package/package.json +1 -1
  3. package/stats.html +1 -1
package/dist/main.js CHANGED
@@ -132,16 +132,14 @@ const lightCustomColors = {
132
132
  'statusBar.foreground': '#20252a',
133
133
  'statusBar.border': '#dadada'
134
134
  };
135
-
136
- const customColors = _objectSpread2(_objectSpread2({}, lightCustomColors), {}, {
135
+ const customColors = {
137
136
  '[Visual Studio Dark]': darkCustomColors,
138
137
  '[Default Dark+]': darkCustomColors,
139
138
  '[Default High Contrast]': darkCustomColors,
140
139
  '[Visual Studio Light]': lightCustomColors,
141
140
  '[Default Light+]': lightCustomColors,
142
141
  '[Default High Contrast Light]': lightCustomColors
143
- });
144
-
142
+ };
145
143
  const customTokenColors = {};
146
144
  const customTokenColor = {
147
145
  rules: {
@@ -163,8 +161,12 @@ const themes = [];
163
161
  async function defineVSCodeTheme(id, vscodeThemeLoader, themeExtensionPoint, extensionData) {
164
162
  var _themeExtensionPoint$, _themeExtensionPoint$2, _ref, _themeExtensionPoint$3, _themeExtensionPoint$4;
165
163
 
166
- const path = "/theme-".concat(id, ".json");
167
- const rootUri = monaco$2.Uri.file((_themeExtensionPoint$ = themeExtensionPoint === null || themeExtensionPoint === void 0 ? void 0 : (_themeExtensionPoint$2 = themeExtensionPoint.path) === null || _themeExtensionPoint$2 === void 0 ? void 0 : _themeExtensionPoint$2.slice(1)) !== null && _themeExtensionPoint$ !== void 0 ? _themeExtensionPoint$ : path);
164
+ const path = "/theme-".concat(id, ".json"); // Do not use `file` scheme or monaco will replace `/` by `\` on windows
165
+
166
+ const rootUri = monaco$2.Uri.from({
167
+ scheme: 'browser',
168
+ path: (_themeExtensionPoint$ = themeExtensionPoint === null || themeExtensionPoint === void 0 ? void 0 : (_themeExtensionPoint$2 = themeExtensionPoint.path) === null || _themeExtensionPoint$2 === void 0 ? void 0 : _themeExtensionPoint$2.slice(1)) !== null && _themeExtensionPoint$ !== void 0 ? _themeExtensionPoint$ : path
169
+ });
168
170
  const themeData = monaco$2.extra.ColorThemeData.fromExtensionTheme(_objectSpread2({
169
171
  id,
170
172
  path: path,
@@ -213,7 +215,9 @@ const getOnigLib = async binaryUrl => {
213
215
  createOnigString
214
216
  };
215
217
  } catch (error) {
216
- console.error('Unable to load wasm', error);
218
+ monaco$2.errorHandler.onUnexpectedError(new Error('Unable to load vscode-oniguruma wasm', {
219
+ cause: error
220
+ }));
217
221
  throw error;
218
222
  }
219
223
  };
@@ -231,7 +235,11 @@ class CGTMGrammarFactory extends monaco$2.extra.TMGrammarFactory {
231
235
  const grammarFactoryHost = {
232
236
  // eslint-disable-next-line no-console
233
237
  logTrace: console.debug,
234
- logError: console.error,
238
+ logError: (msg, error) => {
239
+ monaco$2.errorHandler.onUnexpectedError(new Error(msg, {
240
+ cause: error
241
+ }));
242
+ },
235
243
 
236
244
  async readFile(resource) {
237
245
  const scopeName = resource.path.slice(resource.path.lastIndexOf('/') + 1, -'.json'.length);
@@ -1501,7 +1509,10 @@ for (const contribution of extensions.semanticTokenScopes) {
1501
1509
  function createGrammarFactory() {
1502
1510
  const languageService = monaco$2.extra.StandaloneServices.get(monaco$2.languages.ILanguageService);
1503
1511
  const parsedGrammars = rawGrammars.map(grammar => _objectSpread2(_objectSpread2({}, monaco$2.extra.parseTextMateGrammar(grammar, languageService)), {}, {
1504
- location: monaco$2.Uri.file(grammar.scopeName + '.json')
1512
+ location: monaco$2.Uri.from({
1513
+ scheme: 'browser',
1514
+ path: grammar.scopeName + '.json'
1515
+ })
1505
1516
  }));
1506
1517
  return new CGTMGrammarFactory(parsedGrammars, loader$3, onigFile);
1507
1518
  }
@@ -3520,14 +3531,25 @@ for (const languageId of languagesIds) {
3520
3531
  });
3521
3532
  monaco$2.languages.setTokenizationSupportFactory(languageId, {
3522
3533
  createTokenizationSupport: async () => {
3523
- return getOrCreateTextMateTokensProvider(languageId).catch(async err => {
3534
+ return getOrCreateTextMateTokensProvider(languageId).catch(async error => {
3524
3535
  const monarchLoader = languageLoader[languageId];
3525
3536
 
3526
3537
  if (monarchLoader != null) {
3527
- console.warn("Failed to load TextMate grammar for language ".concat(languageId, ", fallback to monarch"), err);
3528
- monaco$2.languages.setMonarchTokensProvider(languageId, (await monarchLoader()).language);
3538
+ monaco$2.errorHandler.onUnexpectedError(new Error("Failed to load TextMate grammar for language ".concat(languageId, ", fallback to monarch"), {
3539
+ cause: error
3540
+ }));
3541
+
3542
+ try {
3543
+ monaco$2.languages.setMonarchTokensProvider(languageId, (await monarchLoader()).language);
3544
+ } catch (error) {
3545
+ monaco$2.errorHandler.onUnexpectedError(new Error("Failed to load Monarch grammar for language ".concat(languageId), {
3546
+ cause: error
3547
+ }));
3548
+ }
3529
3549
  } else {
3530
- console.warn("Failed to load TextMate grammar for language ".concat(languageId, " and no fallback monarch"), err);
3550
+ monaco$2.errorHandler.onUnexpectedError(new Error("Failed to load TextMate grammar for language ".concat(languageId, " and no fallback monarch"), {
3551
+ cause: error
3552
+ }));
3531
3553
  }
3532
3554
 
3533
3555
  return null;
@@ -3570,7 +3592,9 @@ languageService.onDidEncounterLanguage(async languageId => {
3570
3592
  }
3571
3593
 
3572
3594
  loadLanguageConfiguration(languageId).catch(error => {
3573
- console.error('Unable to load language configuration', error);
3595
+ monaco$2.errorHandler.onUnexpectedError(new Error("Unable to load language configuration for language ".concat(languageId), {
3596
+ cause: error
3597
+ }));
3574
3598
  });
3575
3599
  });
3576
3600
 
@@ -3718,7 +3742,9 @@ for (const themeExtensionPoint of defaultThemes) {
3718
3742
  extensionName: themeExtensionPoint.extension,
3719
3743
  extensionIsBuiltin: true
3720
3744
  }).catch(error => {
3721
- console.error('Unable to define vscode theme', error);
3745
+ monaco$2.errorHandler.onUnexpectedError(new Error("Unable to define \"".concat(themeExtensionPoint.id, "\" vscode theme"), {
3746
+ cause: error
3747
+ }));
3722
3748
  });
3723
3749
  }
3724
3750
 
@@ -4173,8 +4199,10 @@ monaco$2.extra.StandaloneServices.initialize({
4173
4199
  }); // Force EOL to be '\n' even on Windows
4174
4200
 
4175
4201
  const configurationService = monaco$2.extra.StandaloneServices.get(monaco$2.extra.IConfigurationService);
4176
- configurationService.updateValue('files.eol', '\n').catch(err => {
4177
- console.error('Unable to set file eol', err);
4202
+ configurationService.updateValue('files.eol', '\n').catch(error => {
4203
+ monaco$2.errorHandler.onUnexpectedError(new Error('Unable to set file eol', {
4204
+ cause: error
4205
+ }));
4178
4206
  });
4179
4207
  monaco$2.errorHandler.setUnexpectedErrorHandler(error => {
4180
4208
  console.warn('Unexpected error', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-editor-wrapper",
3
- "version": "1.13.0",
3
+ "version": "1.14.1",
4
4
  "private": false,
5
5
  "description": "Enhanced Monaco editor with TextMate grammars and more",
6
6
  "scripts": {