@codingame/monaco-vscode-base-service-override
Advanced tools
Comparing version 7.1.0 to 7.1.1
{ | ||
"name": "@codingame/monaco-vscode-base-service-override", | ||
"version": "7.1.0", | ||
"version": "7.1.1", | ||
"keywords": [], | ||
@@ -29,4 +29,4 @@ "author": { | ||
"dependencies": { | ||
"vscode": "npm:@codingame/monaco-vscode-api@7.1.0" | ||
"vscode": "npm:@codingame/monaco-vscode-api@7.1.1" | ||
} | ||
} |
@@ -5,56 +5,88 @@ import { bufferToStream, VSBuffer } from 'vscode/vscode/vs/base/common/buffer'; | ||
function request(options, token) { | ||
if (options.proxyAuthorization) { | ||
options.headers = { | ||
...(options.headers || {}), | ||
'Proxy-Authorization': options.proxyAuthorization | ||
async function request(options, token) { | ||
if (token.isCancellationRequested) { | ||
throw canceled(); | ||
} | ||
const cancellation = ( new AbortController()); | ||
const disposable = token.onCancellationRequested(() => cancellation.abort()); | ||
const signal = options.timeout ? AbortSignal.any([ | ||
cancellation.signal, | ||
AbortSignal.timeout(options.timeout), | ||
]) : cancellation.signal; | ||
try { | ||
const res = await fetch(options.url || '', { | ||
method: options.type || 'GET', | ||
headers: getRequestHeaders(options), | ||
body: options.data, | ||
signal, | ||
}); | ||
return { | ||
res: { | ||
statusCode: res.status, | ||
headers: getResponseHeaders(res), | ||
}, | ||
stream: bufferToStream(VSBuffer.wrap(( new Uint8Array(await res.arrayBuffer())))), | ||
}; | ||
} | ||
const xhr = ( new XMLHttpRequest()); | ||
return ( new Promise((resolve, reject) => { | ||
xhr.open(options.type || 'GET', options.url || '', true, options.user, options.password); | ||
setRequestHeaders(xhr, options); | ||
xhr.responseType = 'arraybuffer'; | ||
xhr.onerror = e => reject(navigator.onLine ? ( new Error(xhr.statusText && ('XHR failed: ' + xhr.statusText) || 'XHR failed')) : ( new OfflineError())); | ||
xhr.onload = (e) => { | ||
resolve({ | ||
res: { | ||
statusCode: xhr.status, | ||
headers: getResponseHeaders(xhr) | ||
}, | ||
stream: bufferToStream(VSBuffer.wrap(( new Uint8Array(xhr.response)))) | ||
}); | ||
}; | ||
xhr.ontimeout = e => reject(( new Error(`XHR timeout: ${options.timeout}ms`))); | ||
if (options.timeout) { | ||
xhr.timeout = options.timeout; | ||
catch (err) { | ||
if (!navigator.onLine) { | ||
throw ( new OfflineError()); | ||
} | ||
xhr.send(options.data); | ||
token.onCancellationRequested(() => { | ||
xhr.abort(); | ||
reject(canceled()); | ||
}); | ||
})); | ||
if (err?.name === 'AbortError') { | ||
throw canceled(); | ||
} | ||
if (err?.name === 'TimeoutError') { | ||
throw ( new Error(`Fetch timeout: ${options.timeout}ms`)); | ||
} | ||
throw err; | ||
} | ||
finally { | ||
disposable.dispose(); | ||
} | ||
} | ||
function setRequestHeaders(xhr, options) { | ||
if (options.headers) { | ||
function getRequestHeaders(options) { | ||
if (options.headers || options.user || options.password || options.proxyAuthorization) { | ||
const headers = ( new Headers()); | ||
outer: for (const k in options.headers) { | ||
switch (k) { | ||
case 'User-Agent': | ||
case 'Accept-Encoding': | ||
case 'Content-Length': | ||
switch (k.toLowerCase()) { | ||
case 'user-agent': | ||
case 'accept-encoding': | ||
case 'content-length': | ||
continue outer; | ||
} | ||
xhr.setRequestHeader(k, options.headers[k]); | ||
const header = options.headers[k]; | ||
if (typeof header === 'string') { | ||
headers.set(k, header); | ||
} | ||
else if (Array.isArray(header)) { | ||
for (const h of header) { | ||
headers.append(k, h); | ||
} | ||
} | ||
} | ||
if (options.user || options.password) { | ||
headers.set('Authorization', 'Basic ' + btoa(`${options.user || ''}:${options.password || ''}`)); | ||
} | ||
if (options.proxyAuthorization) { | ||
headers.set('Proxy-Authorization', options.proxyAuthorization); | ||
} | ||
return headers; | ||
} | ||
return undefined; | ||
} | ||
function getResponseHeaders(xhr) { | ||
function getResponseHeaders(res) { | ||
const headers = Object.create(null); | ||
for (const line of xhr.getAllResponseHeaders().split(/\r\n|\n|\r/g)) { | ||
if (line) { | ||
const idx = line.indexOf(':'); | ||
headers[line.substr(0, idx).trim().toLowerCase()] = line.substr(idx + 1).trim(); | ||
res.headers.forEach((value, key) => { | ||
if (headers[key]) { | ||
if (Array.isArray(headers[key])) { | ||
headers[key].push(value); | ||
} | ||
else { | ||
headers[key] = [headers[key], value]; | ||
} | ||
} | ||
} | ||
else { | ||
headers[key] = value; | ||
} | ||
}); | ||
return headers; | ||
@@ -61,0 +93,0 @@ } |
@@ -21,2 +21,8 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
} | ||
async lookupAuthorization(authInfo) { | ||
return undefined; | ||
} | ||
async lookupKerberosAuthorization(url) { | ||
return undefined; | ||
} | ||
async loadCertificates() { | ||
@@ -23,0 +29,0 @@ return []; |
@@ -15,2 +15,8 @@ import { bufferToStream } from 'vscode/vscode/vs/base/common/buffer'; | ||
} | ||
async lookupAuthorization(authInfo) { | ||
return this.channel.call('lookupAuthorization', [authInfo]); | ||
} | ||
async lookupKerberosAuthorization(url) { | ||
return this.channel.call('lookupKerberosAuthorization', [url]); | ||
} | ||
async loadCertificates() { | ||
@@ -17,0 +23,0 @@ return this.channel.call('loadCertificates'); |
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { localizeWithPath } from 'vscode/vscode/vs/nls'; | ||
import { localize } from 'vscode/vscode/vs/nls'; | ||
import { parse } from 'vscode/vscode/vs/base/common/json'; | ||
@@ -16,3 +16,2 @@ import { setProperty } from 'vscode/vscode/vs/base/common/jsonEdit'; | ||
const _moduleId = "vs/workbench/services/configuration/common/jsonEditingService"; | ||
let JSONEditingService = class JSONEditingService { | ||
@@ -111,5 +110,4 @@ constructor(fileService, textModelResolverService, textFileService) { | ||
case JSONEditingErrorCode.ERROR_INVALID_FILE: { | ||
return ( localizeWithPath( | ||
_moduleId, | ||
0, | ||
return ( localize( | ||
1139, | ||
"Unable to write into the file. Please open the file to correct errors/warnings in the file and try again." | ||
@@ -116,0 +114,0 @@ )); |
@@ -12,3 +12,3 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { isFalsyOrWhitespace } from 'vscode/vscode/vs/base/common/strings'; | ||
import { localizeWithPath } from 'vscode/vscode/vs/nls'; | ||
import { localize } from 'vscode/vscode/vs/nls'; | ||
import { isCancellationError } from 'vscode/vscode/vs/base/common/errors'; | ||
@@ -33,3 +33,2 @@ import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation'; | ||
const _moduleId = "vs/workbench/services/decorations/browser/decorationsService"; | ||
class DecorationRule { | ||
@@ -165,3 +164,3 @@ static keyOf(data) { | ||
badgeClassName = rule.bubbleBadgeClassName; | ||
tooltip = ( localizeWithPath(_moduleId, 0, "Contains emphasized items")); | ||
tooltip = ( localize(1140, "Contains emphasized items")); | ||
} | ||
@@ -168,0 +167,0 @@ return { |
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js'; | ||
import { localizeWithPath } from 'vscode/vscode/vs/nls'; | ||
import { localize } from 'vscode/vscode/vs/nls'; | ||
import { URI } from 'vscode/vscode/vs/base/common/uri'; | ||
@@ -31,7 +31,6 @@ import { dispose, Disposable } from 'vscode/vscode/vs/base/common/lifecycle'; | ||
const _moduleId = "vs/workbench/services/label/common/labelService"; | ||
const resourceLabelFormattersExtPoint = ExtensionsRegistry.registerExtensionPoint({ | ||
extensionPoint: 'resourceLabelFormatters', | ||
jsonSchema: { | ||
description: ( localizeWithPath(_moduleId, 0, 'Contributes resource label formatting rules.')), | ||
description: ( localize(1141, 'Contributes resource label formatting rules.')), | ||
type: 'array', | ||
@@ -44,5 +43,4 @@ items: { | ||
type: 'string', | ||
description: ( localizeWithPath( | ||
_moduleId, | ||
1, | ||
description: ( localize( | ||
1142, | ||
'URI scheme on which to match the formatter on. For example "file". Simple glob patterns are supported.' | ||
@@ -53,5 +51,4 @@ )), | ||
type: 'string', | ||
description: ( localizeWithPath( | ||
_moduleId, | ||
2, | ||
description: ( localize( | ||
1143, | ||
'URI authority on which to match the formatter on. Simple glob patterns are supported.' | ||
@@ -61,3 +58,3 @@ )), | ||
formatting: { | ||
description: ( localizeWithPath(_moduleId, 3, "Rules for formatting uri resource labels.")), | ||
description: ( localize(1144, "Rules for formatting uri resource labels.")), | ||
type: 'object', | ||
@@ -67,5 +64,4 @@ properties: { | ||
type: 'string', | ||
description: ( localizeWithPath( | ||
_moduleId, | ||
4, | ||
description: ( localize( | ||
1145, | ||
"Label rules to display. For example: myLabel:/${path}. ${path}, ${scheme}, ${authority} and ${authoritySuffix} are supported as variables." | ||
@@ -76,5 +72,4 @@ )) | ||
type: 'string', | ||
description: ( localizeWithPath( | ||
_moduleId, | ||
5, | ||
description: ( localize( | ||
1146, | ||
"Separator to be used in the uri label display. '/' or '\' as an example." | ||
@@ -85,5 +80,4 @@ )) | ||
type: 'boolean', | ||
description: ( localizeWithPath( | ||
_moduleId, | ||
6, | ||
description: ( localize( | ||
1147, | ||
"Controls whether `${path}` substitutions should have starting separator characters stripped." | ||
@@ -94,5 +88,4 @@ )) | ||
type: 'boolean', | ||
description: ( localizeWithPath( | ||
_moduleId, | ||
7, | ||
description: ( localize( | ||
1148, | ||
"Controls if the start of the uri label should be tildified when possible." | ||
@@ -103,3 +96,3 @@ )) | ||
type: 'string', | ||
description: ( localizeWithPath(_moduleId, 8, "Suffix appended to the workspace label.")) | ||
description: ( localize(1149, "Suffix appended to the workspace label.")) | ||
} | ||
@@ -283,6 +276,6 @@ } | ||
if (isUntitledWorkspace(workspaceUri, this.environmentService)) { | ||
return ( localizeWithPath(_moduleId, 9, "Untitled (Workspace)")); | ||
return ( localize(1150, "Untitled (Workspace)")); | ||
} | ||
if (isTemporaryWorkspace(workspaceUri)) { | ||
return ( localizeWithPath(_moduleId, 10, "Workspace")); | ||
return ( localize(1151, "Workspace")); | ||
} | ||
@@ -299,5 +292,4 @@ let filename = basename(workspaceUri); | ||
case Verbosity.LONG: | ||
label = ( localizeWithPath( | ||
_moduleId, | ||
11, | ||
label = ( localize( | ||
1152, | ||
"{0} (Workspace)", | ||
@@ -309,3 +301,3 @@ this.getUriLabel(joinPath(dirname(workspaceUri), filename)) | ||
default: | ||
label = ( localizeWithPath(_moduleId, 12, "{0} (Workspace)", filename)); | ||
label = ( localize(1153, "{0} (Workspace)", filename)); | ||
break; | ||
@@ -312,0 +304,0 @@ } |
78311
1692
2
+ Added@codingame/monaco-vscode-api@7.1.1(transitive)
+ Added@codingame/monaco-vscode-environment-service-override@7.1.1(transitive)
+ Added@codingame/monaco-vscode-extensions-service-override@7.1.1(transitive)
+ Added@codingame/monaco-vscode-files-service-override@7.1.1(transitive)
+ Added@codingame/monaco-vscode-host-service-override@7.1.1(transitive)
+ Added@codingame/monaco-vscode-layout-service-override@7.1.1(transitive)
+ Added@codingame/monaco-vscode-quickaccess-service-override@7.1.1(transitive)
+ Addedjschardet@3.1.3(transitive)
- Removed@codingame/monaco-vscode-api@7.1.0(transitive)
- Removed@codingame/monaco-vscode-environment-service-override@7.1.0(transitive)
- Removed@codingame/monaco-vscode-extensions-service-override@7.1.0(transitive)
- Removed@codingame/monaco-vscode-files-service-override@7.1.0(transitive)
- Removed@codingame/monaco-vscode-host-service-override@7.1.0(transitive)
- Removed@codingame/monaco-vscode-layout-service-override@7.1.0(transitive)
- Removed@codingame/monaco-vscode-quickaccess-service-override@7.1.0(transitive)
- Removedjschardet@3.1.2(transitive)