monaco-css
Advanced tools
Comparing version 3.1.1 to 3.2.0
{ | ||
"name": "monaco-css", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "CSS, LESS and SCSS plugin for the Monaco Editor", | ||
@@ -25,13 +25,13 @@ "scripts": { | ||
"devDependencies": { | ||
"husky": "^4.3.0", | ||
"monaco-editor-core": "0.21.0", | ||
"monaco-languages": "2.1.0", | ||
"husky": "^4.3.8", | ||
"monaco-editor-core": "0.22.0", | ||
"monaco-languages": "2.2.0", | ||
"monaco-plugin-helpers": "^1.0.3", | ||
"prettier": "^2.1.2", | ||
"pretty-quick": "^3.0.2", | ||
"prettier": "^2.2.1", | ||
"pretty-quick": "^3.1.0", | ||
"requirejs": "^2.3.6", | ||
"typescript": "4.0.3", | ||
"terser": "^5.3.2", | ||
"vscode-css-languageservice": "4.3.3", | ||
"vscode-languageserver-types": "3.15.1", | ||
"typescript": "4.1.3", | ||
"terser": "^5.5.1", | ||
"vscode-css-languageservice": "5.0.3", | ||
"vscode-languageserver-types": "3.16.0", | ||
"vscode-languageserver-textdocument": "^1.0.1" | ||
@@ -38,0 +38,0 @@ }, |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
@@ -50,3 +50,2 @@ /*--------------------------------------------------------------------------------------------- | ||
doCodeActions2: codeActions.doCodeActions2.bind(codeActions), | ||
findColorSymbols: function (d, s) { return navigation.findDocumentColors(d, s).map(function (s) { return s.range; }); }, | ||
findDocumentColors: navigation.findDocumentColors.bind(navigation), | ||
@@ -53,0 +52,0 @@ getColorPresentations: navigation.getColorPresentations.bind(navigation), |
@@ -6,5 +6,5 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
import { MarkupKind } from './_deps/vscode-languageserver-types/main'; | ||
export { TextDocument } from '../vscode-languageserver-textdocument/lib/esm/main'; | ||
export * from './_deps/vscode-languageserver-types/main'; | ||
import { MarkupKind } from './../vscode-languageserver-types/main'; | ||
export { TextDocument } from './../vscode-languageserver-textdocument/lib/esm/main'; | ||
export * from './../vscode-languageserver-types/main'; | ||
export var ClientCapabilities; | ||
@@ -11,0 +11,0 @@ (function (ClientCapabilities) { |
@@ -6,3 +6,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import * as nodes from '../parser/cssNodes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -9,0 +9,0 @@ export var colorFunctions = [ |
@@ -26,3 +26,3 @@ /*--------------------------------------------------------------------------------------------- | ||
} | ||
export function getEntryDescription(entry, doesSupportMarkdown) { | ||
export function getEntryDescription(entry, doesSupportMarkdown, settings) { | ||
var result; | ||
@@ -32,3 +32,3 @@ if (doesSupportMarkdown) { | ||
kind: 'markdown', | ||
value: getEntryMarkdownDescription(entry) | ||
value: getEntryMarkdownDescription(entry, settings) | ||
}; | ||
@@ -39,3 +39,3 @@ } | ||
kind: 'plaintext', | ||
value: getEntryStringDescription(entry) | ||
value: getEntryStringDescription(entry, settings) | ||
}; | ||
@@ -52,3 +52,3 @@ } | ||
} | ||
function getEntryStringDescription(entry) { | ||
function getEntryStringDescription(entry, settings) { | ||
if (!entry.description || entry.description === '') { | ||
@@ -61,15 +61,19 @@ return ''; | ||
var result = ''; | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
} | ||
result += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n(' + browserLabel + ')'; | ||
} | ||
if ('syntax' in entry) { | ||
result += "\n\nSyntax: " + entry.syntax; | ||
} | ||
} | ||
result += entry.description; | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n(' + browserLabel + ')'; | ||
} | ||
if ('syntax' in entry) { | ||
result += "\n\nSyntax: " + entry.syntax; | ||
} | ||
if (entry.references && entry.references.length > 0) { | ||
result += '\n\n'; | ||
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { | ||
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += entry.references.map(function (r) { | ||
@@ -81,3 +85,3 @@ return r.name + ": " + r.url; | ||
} | ||
function getEntryMarkdownDescription(entry) { | ||
function getEntryMarkdownDescription(entry, settings) { | ||
if (!entry.description || entry.description === '') { | ||
@@ -87,16 +91,20 @@ return ''; | ||
var result = ''; | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
if ((settings === null || settings === void 0 ? void 0 : settings.documentation) !== false) { | ||
if (entry.status) { | ||
result += getEntryStatus(entry.status); | ||
} | ||
var description = typeof entry.description === 'string' ? entry.description : entry.description.value; | ||
result += textToMarkedString(description); | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n\n(' + textToMarkedString(browserLabel) + ')'; | ||
} | ||
if ('syntax' in entry && entry.syntax) { | ||
result += "\n\nSyntax: " + textToMarkedString(entry.syntax); | ||
} | ||
} | ||
var description = typeof entry.description === 'string' ? entry.description : entry.description.value; | ||
result += textToMarkedString(description); | ||
var browserLabel = getBrowserLabel(entry.browsers); | ||
if (browserLabel) { | ||
result += '\n\n(' + textToMarkedString(browserLabel) + ')'; | ||
} | ||
if ('syntax' in entry && entry.syntax) { | ||
result += "\n\nSyntax: " + textToMarkedString(entry.syntax); | ||
} | ||
if (entry.references && entry.references.length > 0) { | ||
result += '\n\n'; | ||
if (entry.references && entry.references.length > 0 && (settings === null || settings === void 0 ? void 0 : settings.references) !== false) { | ||
if (result.length > 0) { | ||
result += '\n\n'; | ||
} | ||
result += entry.references.map(function (r) { | ||
@@ -103,0 +111,0 @@ return "[" + r.name + "](" + r.url + ")"; |
@@ -6,3 +6,3 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -9,0 +9,0 @@ var CSSIssueType = /** @class */ (function () { |
@@ -6,9 +6,2 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
import { TokenType, Scanner } from './cssScanner'; | ||
@@ -44,2 +37,5 @@ import * as nodes from './cssNodes'; | ||
}; | ||
Parser.prototype.peekOne = function (types) { | ||
return types.indexOf(this.token.type) !== -1; | ||
}; | ||
Parser.prototype.peekRegExp = function (type, regEx) { | ||
@@ -317,4 +313,3 @@ if (type !== this.token.type) { | ||
} | ||
return this._tryParseCustomPropertyDeclaration() | ||
|| this._parseDeclaration(); | ||
return this._parseDeclaration(); | ||
}; | ||
@@ -417,3 +412,7 @@ /** | ||
}; | ||
Parser.prototype._parseDeclaration = function (resyncStopTokens) { | ||
Parser.prototype._parseDeclaration = function (stopTokens) { | ||
var custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens); | ||
if (custonProperty) { | ||
return custonProperty; | ||
} | ||
var node = this.create(nodes.Declaration); | ||
@@ -424,4 +423,3 @@ if (!node.setProperty(this._parseProperty())) { | ||
if (!this.accept(TokenType.Colon)) { | ||
var stopTokens = resyncStopTokens ? __spreadArrays(resyncStopTokens, [TokenType.SemiColon]) : [TokenType.SemiColon]; | ||
return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens); | ||
return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens || [TokenType.SemiColon]); | ||
} | ||
@@ -440,3 +438,3 @@ if (this.prevToken) { | ||
}; | ||
Parser.prototype._tryParseCustomPropertyDeclaration = function () { | ||
Parser.prototype._tryParseCustomPropertyDeclaration = function (stopTokens) { | ||
if (!this.peekRegExp(TokenType.Ident, /^--/)) { | ||
@@ -475,3 +473,3 @@ return null; | ||
this._parsePrio(); | ||
if (this.peek(TokenType.SemiColon)) { | ||
if (this.peekOne(stopTokens || [TokenType.SemiColon])) { | ||
node.setValue(expression); | ||
@@ -483,3 +481,3 @@ node.semicolonPosition = this.token.offset; // not part of the declaration, but useful information for code assist | ||
this.restoreAtMark(mark); | ||
node.addChild(this._parseCustomPropertyValue()); | ||
node.addChild(this._parseCustomPropertyValue(stopTokens)); | ||
node.addChild(this._parsePrio()); | ||
@@ -502,5 +500,8 @@ if (isDefined(node.colonPosition) && this.token.offset === node.colonPosition + 1) { | ||
*/ | ||
Parser.prototype._parseCustomPropertyValue = function () { | ||
Parser.prototype._parseCustomPropertyValue = function (stopTokens) { | ||
var _this = this; | ||
if (stopTokens === void 0) { stopTokens = [TokenType.CurlyR]; } | ||
var node = this.create(nodes.Node); | ||
var isTopLevel = function () { return curlyDepth === 0 && parensDepth === 0 && bracketsDepth === 0; }; | ||
var onStopToken = function () { return stopTokens.indexOf(_this.token.type) !== -1; }; | ||
var curlyDepth = 0; | ||
@@ -531,3 +532,3 @@ var parensDepth = 0; | ||
// this is the last declaration in the ruleset. | ||
if (parensDepth === 0 && bracketsDepth === 0) { | ||
if (onStopToken() && parensDepth === 0 && bracketsDepth === 0) { | ||
break done; | ||
@@ -544,2 +545,5 @@ } | ||
if (parensDepth < 0) { | ||
if (onStopToken() && bracketsDepth === 0 && curlyDepth === 0) { | ||
break done; | ||
} | ||
return this.finish(node, ParseError.LeftParenthesisExpected); | ||
@@ -575,3 +579,3 @@ } | ||
}; | ||
Parser.prototype._tryToParseDeclaration = function () { | ||
Parser.prototype._tryToParseDeclaration = function (stopTokens) { | ||
var mark = this.mark(); | ||
@@ -581,3 +585,3 @@ if (this._parseProperty() && this.accept(TokenType.Colon)) { | ||
this.restoreAtMark(mark); | ||
return this._parseDeclaration(); | ||
return this._parseDeclaration(stopTokens); | ||
} | ||
@@ -769,3 +773,3 @@ this.restoreAtMark(mark); | ||
} | ||
if (!node.addChild(this._tryToParseDeclaration())) { | ||
if (!node.addChild(this._tryToParseDeclaration([TokenType.ParenthesisR]))) { | ||
if (!this._parseSupportsCondition()) { | ||
@@ -1242,9 +1246,7 @@ return this.finish(node, ParseError.ConditionExpected); | ||
// optional, support :: | ||
if (this.accept(TokenType.Colon) && this.hasWhitespace()) { | ||
this.markError(node, ParseError.IdentifierExpected); | ||
this.accept(TokenType.Colon); | ||
if (this.hasWhitespace() || !node.addChild(this._parseIdent())) { | ||
return this.finish(node, ParseError.IdentifierExpected); | ||
} | ||
if (!node.addChild(this._parseIdent())) { | ||
this.markError(node, ParseError.IdentifierExpected); | ||
} | ||
return node; | ||
return this.finish(node); | ||
}; | ||
@@ -1251,0 +1253,0 @@ Parser.prototype._tryParsePrio = function () { |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -13,0 +13,0 @@ }; |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -13,0 +13,0 @@ }; |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -13,0 +13,0 @@ }; |
@@ -6,3 +6,3 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -9,0 +9,0 @@ var SCSSIssueType = /** @class */ (function () { |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -168,3 +168,3 @@ }; | ||
}; | ||
while (this.accept(TokenType.Ident) || node.addChild(indentInterpolation()) || (hasContent && this.acceptRegexp(/[\w-]/))) { | ||
while (this.accept(TokenType.Ident) || node.addChild(indentInterpolation()) || (hasContent && this.acceptRegexp(/^[\w-]/))) { | ||
hasContent = true; | ||
@@ -242,3 +242,7 @@ if (this.hasWhitespace()) { | ||
}; | ||
SCSSParser.prototype._parseDeclaration = function (resyncStopTokens) { | ||
SCSSParser.prototype._parseDeclaration = function (stopTokens) { | ||
var custonProperty = this._tryParseCustomPropertyDeclaration(stopTokens); | ||
if (custonProperty) { | ||
return custonProperty; | ||
} | ||
var node = this.create(nodes.Declaration); | ||
@@ -249,3 +253,3 @@ if (!node.setProperty(this._parseProperty())) { | ||
if (!this.accept(TokenType.Colon)) { | ||
return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], resyncStopTokens); | ||
return this.finish(node, ParseError.ColonExpected, [TokenType.Colon], stopTokens || [TokenType.SemiColon]); | ||
} | ||
@@ -739,2 +743,7 @@ if (this.prevToken) { | ||
} | ||
if (this.accept(TokenType.Exclamation)) { | ||
if (this.hasWhitespace() || !this.acceptIdent('default')) { | ||
return this.finish(node, ParseError.UnknownKeyword); | ||
} | ||
} | ||
return this.finish(node); | ||
@@ -751,2 +760,22 @@ }; | ||
} | ||
if (this.acceptIdent('with')) { | ||
if (!this.accept(TokenType.ParenthesisL)) { | ||
return this.finish(node, ParseError.LeftParenthesisExpected, [TokenType.ParenthesisR]); | ||
} | ||
// First variable statement, no comma. | ||
if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { | ||
return this.finish(node, ParseError.VariableNameExpected); | ||
} | ||
while (this.accept(TokenType.Comma)) { | ||
if (this.peek(TokenType.ParenthesisR)) { | ||
break; | ||
} | ||
if (!node.getParameters().addChild(this._parseModuleConfigDeclaration())) { | ||
return this.finish(node, ParseError.VariableNameExpected); | ||
} | ||
} | ||
if (!this.accept(TokenType.ParenthesisR)) { | ||
return this.finish(node, ParseError.RightParenthesisExpected); | ||
} | ||
} | ||
if (!this.peek(TokenType.SemiColon) && !this.peek(TokenType.EOF)) { | ||
@@ -783,2 +812,3 @@ if (!this.peekRegExp(TokenType.Ident, /as|hide|show/)) { | ||
// Consume all variables and idents ahead. | ||
this.accept(TokenType.Comma); | ||
} | ||
@@ -785,0 +815,0 @@ // More than just identifier |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -13,0 +13,0 @@ }; |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import { Command, TextEdit, CodeAction, CodeActionKind, TextDocumentEdit, VersionedTextDocumentIdentifier } from '../cssLanguageTypes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -13,0 +13,0 @@ var CSSCodeActions = /** @class */ (function () { |
@@ -47,3 +47,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import { Position, CompletionItemKind, Range, TextEdit, InsertTextFormat, MarkupKind, CompletionItemTag } from '../cssLanguageTypes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
import { isDefined } from '../utils/objects'; | ||
@@ -314,3 +314,3 @@ import { PathCompletionParticipant } from './pathCompletion'; | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -327,3 +327,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -736,5 +736,8 @@ }); | ||
var existingNode = this.findInNodePath(nodes.NodeType.PseudoSelector, nodes.NodeType.IdentifierSelector, nodes.NodeType.ClassSelector, nodes.NodeType.ElementNameSelector); | ||
if (!existingNode && this.offset - this.currentWord.length > 0 && this.textDocument.getText()[this.offset - this.currentWord.length - 1] === ':') { | ||
if (!existingNode && this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ':')) { | ||
// after the ':' of a pseudo selector, no node generated for just ':' | ||
this.currentWord = ':' + this.currentWord; | ||
if (this.hasCharacterAtPosition(this.offset - this.currentWord.length - 1, ':')) { | ||
this.currentWord = ':' + this.currentWord; // for '::' | ||
} | ||
this.defaultReplaceRange = Range.create(Position.create(this.position.line, this.position.character - this.currentWord.length), this.position); | ||
@@ -1018,2 +1021,6 @@ } | ||
}; | ||
CSSCompletion.prototype.hasCharacterAtPosition = function (offset, char) { | ||
var text = this.textDocument.getText(); | ||
return (offset >= 0 && offset < text.length) && text.charAt(offset) === char; | ||
}; | ||
CSSCompletion.prototype.doesSupportMarkdown = function () { | ||
@@ -1020,0 +1027,0 @@ var _a, _b, _c; |
@@ -18,3 +18,3 @@ /*--------------------------------------------------------------------------------------------- | ||
} | ||
CSSHover.prototype.doHover = function (document, position, stylesheet) { | ||
CSSHover.prototype.doHover = function (document, position, stylesheet, settings) { | ||
function getRange(node) { | ||
@@ -55,3 +55,3 @@ return Range.create(document.positionAt(node.offset), document.positionAt(node.end)); | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -73,3 +73,3 @@ hover = { | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -93,3 +93,3 @@ hover = { | ||
if (entry) { | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown()); | ||
var contents = languageFacts.getEntryDescription(entry, this.doesSupportMarkdown(), settings); | ||
if (contents) { | ||
@@ -96,0 +96,0 @@ hover = { |
@@ -43,3 +43,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import { DocumentHighlightKind, Location, Range, SymbolKind, TextEdit, FileType } from '../cssLanguageTypes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
import * as nodes from '../parser/cssNodes'; | ||
@@ -46,0 +46,0 @@ import { Symbols } from '../parser/cssSymbolScope'; |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -22,3 +22,3 @@ }; | ||
import { CompletionItemKind, InsertTextFormat, TextEdit } from '../cssLanguageTypes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -25,0 +25,0 @@ var LESSCompletion = /** @class */ (function (_super) { |
@@ -6,8 +6,8 @@ /*--------------------------------------------------------------------------------------------- | ||
'use strict'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
import * as languageFacts from '../languageFacts/facts'; | ||
import * as nodes from '../parser/cssNodes'; | ||
import { union } from '../utils/arrays'; | ||
import { Rules, Settings } from './lintRules'; | ||
import * as nodes from '../parser/cssNodes'; | ||
import calculateBoxModel, { Element } from './lintUtil'; | ||
import { union } from '../utils/arrays'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -149,2 +149,4 @@ var NodesByRootMap = /** @class */ (function () { | ||
return this.visitPrio(node); | ||
case nodes.NodeType.IdentifierSelector: | ||
return this.visitIdentifierSelector(node); | ||
} | ||
@@ -205,15 +207,16 @@ return true; | ||
LintVisitor.prototype.visitSimpleSelector = function (node) { | ||
var firstChar = this.documentText.charAt(node.offset); | ||
///////////////////////////////////////////////////////////// | ||
// Lint - The universal selector (*) is known to be slow. | ||
///////////////////////////////////////////////////////////// | ||
var firstChar = this.documentText.charAt(node.offset); | ||
if (node.length === 1 && firstChar === '*') { | ||
this.addEntry(node, Rules.UniversalSelector); | ||
} | ||
return true; | ||
}; | ||
LintVisitor.prototype.visitIdentifierSelector = function (node) { | ||
///////////////////////////////////////////////////////////// | ||
// Lint - Avoid id selectors | ||
///////////////////////////////////////////////////////////// | ||
if (firstChar === '#') { | ||
this.addEntry(node, Rules.AvoidIdSelector); | ||
} | ||
this.addEntry(node, Rules.AvoidIdSelector); | ||
return true; | ||
@@ -290,27 +293,11 @@ }; | ||
///////////////////////////////////////////////////////////// | ||
// With 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect | ||
var displayElems = this.fetchWithValue(propertyTable, 'display', 'inline'); | ||
if (displayElems.length > 0) { | ||
for (var _d = 0, _e = ['width', 'height', 'margin-top', 'margin-bottom', 'float']; _d < _e.length; _d++) { | ||
var prop = _e[_d]; | ||
var elem = this.fetch(propertyTable, prop); | ||
for (var index = 0; index < elem.length; index++) { | ||
var node_1 = elem[index].node; | ||
var value = node_1.getValue(); | ||
if (prop === 'float' && (!value || value.matches('none'))) { | ||
continue; | ||
} | ||
this.addEntry(node_1, Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInline', "Property is ignored due to the display. With 'display: inline', the width, height, margin-top, margin-bottom, and float properties have no effect.")); | ||
} | ||
} | ||
} | ||
// With 'display: inline-block', 'float' has no effect | ||
displayElems = this.fetchWithValue(propertyTable, 'display', 'inline-block'); | ||
var displayElems = this.fetchWithValue(propertyTable, 'display', 'inline-block'); | ||
if (displayElems.length > 0) { | ||
var elem = this.fetch(propertyTable, 'float'); | ||
for (var index = 0; index < elem.length; index++) { | ||
var node_2 = elem[index].node; | ||
var value = node_2.getValue(); | ||
var node_1 = elem[index].node; | ||
var value = node_1.getValue(); | ||
if (value && !value.matches('none')) { | ||
this.addEntry(node_2, Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInlineBlock', "inline-block is ignored due to the float. If 'float' has a value other than 'none', the box is floated and 'display' is treated as 'block'")); | ||
this.addEntry(node_1, Rules.PropertyIgnoredDueToDisplay, localize('rule.propertyIgnoredDueToDisplayInlineBlock', "inline-block is ignored due to the float. If 'float' has a value other than 'none', the box is floated and 'display' is treated as 'block'")); | ||
} | ||
@@ -364,4 +351,4 @@ } | ||
var containsUnknowns = false; | ||
for (var _f = 0, propertyTable_1 = propertyTable; _f < propertyTable_1.length; _f++) { | ||
var element = propertyTable_1[_f]; | ||
for (var _d = 0, propertyTable_1 = propertyTable; _d < propertyTable_1.length; _d++) { | ||
var element = propertyTable_1[_d]; | ||
var decl = element.node; | ||
@@ -416,11 +403,11 @@ if (this.isCSSDeclaration(decl)) { | ||
if (missingVendorSpecific || needsStandard) { | ||
for (var _g = 0, _h = entry.nodes; _g < _h.length; _g++) { | ||
var node_3 = _h[_g]; | ||
for (var _e = 0, _f = entry.nodes; _e < _f.length; _e++) { | ||
var node_2 = _f[_e]; | ||
if (needsStandard) { | ||
var message = localize('property.standard.missing', "Also define the standard property '{0}' for compatibility", suffix); | ||
this.addEntry(node_3, Rules.IncludeStandardPropertyWhenUsingVendorPrefix, message); | ||
this.addEntry(node_2, Rules.IncludeStandardPropertyWhenUsingVendorPrefix, message); | ||
} | ||
if (missingVendorSpecific) { | ||
var message = localize('property.vendorspecific.missing', "Always include all vendor specific properties: Missing: {0}", missingVendorSpecific); | ||
this.addEntry(node_3, Rules.AllVendorPrefixes, message); | ||
this.addEntry(node_2, Rules.AllVendorPrefixes, message); | ||
} | ||
@@ -473,5 +460,5 @@ } | ||
for (var _i = 0, _a = declarations.getChildren(); _i < _a.length; _i++) { | ||
var node_4 = _a[_i]; | ||
if (this.isCSSDeclaration(node_4)) { | ||
var name = node_4.getProperty().getName().toLowerCase(); | ||
var node_3 = _a[_i]; | ||
if (this.isCSSDeclaration(node_3)) { | ||
var name = node_3.getProperty().getName().toLowerCase(); | ||
if (name === 'src') { | ||
@@ -478,0 +465,0 @@ definesSrc = true; |
@@ -7,3 +7,3 @@ /*--------------------------------------------------------------------------------------------- | ||
import * as nodes from '../parser/cssNodes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -10,0 +10,0 @@ var Warning = nodes.Level.Warning; |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -23,3 +23,3 @@ }; | ||
import { CompletionItemKind, TextEdit, InsertTextFormat } from '../cssLanguageTypes'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -307,3 +307,3 @@ var SCSSCompletion = /** @class */ (function (_super) { | ||
references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/at-rules/use' }], | ||
insertText: "@use '$0';", | ||
insertText: "@use $0;", | ||
insertTextFormat: InsertTextFormat.Snippet, | ||
@@ -316,3 +316,3 @@ kind: CompletionItemKind.Keyword | ||
references: [{ name: 'Sass documentation', url: 'https://sass-lang.com/documentation/at-rules/forward' }], | ||
insertText: "@forward '$0';", | ||
insertText: "@forward $0;", | ||
insertTextFormat: InsertTextFormat.Snippet, | ||
@@ -319,0 +319,0 @@ kind: CompletionItemKind.Keyword |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -58,5 +58,4 @@ }; | ||
import * as nodes from '../parser/cssNodes'; | ||
import { URI } from '../../vscode-uri/index'; | ||
import { URI, Utils } from './../../vscode-uri/index'; | ||
import { startsWith } from '../utils/strings'; | ||
import { extname } from '../utils/resources'; | ||
var SCSSNavigation = /** @class */ (function (_super) { | ||
@@ -124,7 +123,8 @@ __extends(SCSSNavigation, _super); | ||
target = _a.sent(); | ||
if (!(this.fileSystemProvider && target && extname(target).length === 0)) return [3 /*break*/, 8]; | ||
if (!(this.fileSystemProvider && target)) return [3 /*break*/, 8]; | ||
parsedUri = URI.parse(target); | ||
if (!(parsedUri.path && Utils.extname(parsedUri).length === 0)) return [3 /*break*/, 8]; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 7, , 8]); | ||
parsedUri = URI.parse(target); | ||
pathVariations = toPathVariations(parsedUri); | ||
@@ -131,0 +131,0 @@ if (!pathVariations) return [3 /*break*/, 6]; |
@@ -10,3 +10,3 @@ /*--------------------------------------------------------------------------------------------- | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -22,3 +22,3 @@ }; | ||
import { Scanner } from '../parser/cssScanner'; | ||
import * as nls from '../../../fillers/vscode-nls'; | ||
import * as nls from './../../../fillers/vscode-nls'; | ||
var localize = nls.loadMessageBundle(); | ||
@@ -438,3 +438,2 @@ var Element = /** @class */ (function () { | ||
if (this.prev && this.prev.matches('~')) { | ||
this.element.addChild(toElement(selectorChild)); | ||
this.element.addChild(new LabelElement('\u22EE')); | ||
@@ -441,0 +440,0 @@ } |
@@ -5,64 +5,13 @@ /*--------------------------------------------------------------------------------------------- | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { URI } from "../../vscode-uri/index"; | ||
var Slash = '/'.charCodeAt(0); | ||
var Dot = '.'.charCodeAt(0); | ||
export function isAbsolutePath(path) { | ||
return path.charCodeAt(0) === Slash; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
}; | ||
import { URI, Utils } from './../../vscode-uri/index'; | ||
export function dirname(uriString) { | ||
return Utils.dirname(URI.parse(uriString)).toString(); | ||
} | ||
export function dirname(uri) { | ||
var lastIndexOfSlash = uri.lastIndexOf('/'); | ||
return lastIndexOfSlash !== -1 ? uri.substr(0, lastIndexOfSlash) : ''; | ||
} | ||
export function basename(uri) { | ||
var lastIndexOfSlash = uri.lastIndexOf('/'); | ||
return uri.substr(lastIndexOfSlash + 1); | ||
} | ||
export function extname(uri) { | ||
for (var i = uri.length - 1; i >= 0; i--) { | ||
var ch = uri.charCodeAt(i); | ||
if (ch === Dot) { | ||
if (i > 0 && uri.charCodeAt(i - 1) !== Slash) { | ||
return uri.substr(i); | ||
} | ||
else { | ||
break; | ||
} | ||
} | ||
else if (ch === Slash) { | ||
break; | ||
} | ||
} | ||
return ''; | ||
} | ||
export function resolvePath(uriString, path) { | ||
if (isAbsolutePath(path)) { | ||
var uri = URI.parse(uriString); | ||
var parts = path.split('/'); | ||
return uri.with({ path: normalizePath(parts) }).toString(); | ||
} | ||
return joinPath(uriString, path); | ||
} | ||
export function normalizePath(parts) { | ||
var newParts = []; | ||
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) { | ||
var part = parts_1[_i]; | ||
if (part.length === 0 || part.length === 1 && part.charCodeAt(0) === Dot) { | ||
// ignore | ||
} | ||
else if (part.length === 2 && part.charCodeAt(0) === Dot && part.charCodeAt(1) === Dot) { | ||
newParts.pop(); | ||
} | ||
else { | ||
newParts.push(part); | ||
} | ||
} | ||
if (parts.length > 1 && parts[parts.length - 1].length === 0) { | ||
newParts.push(''); | ||
} | ||
var res = newParts.join('/'); | ||
if (parts[0].length === 0) { | ||
res = '/' + res; | ||
} | ||
return res; | ||
} | ||
export function joinPath(uriString) { | ||
@@ -73,9 +22,3 @@ var paths = []; | ||
} | ||
var uri = URI.parse(uriString); | ||
var parts = uri.path.split('/'); | ||
for (var _a = 0, paths_1 = paths; _a < paths_1.length; _a++) { | ||
var path = paths_1[_a]; | ||
parts.push.apply(parts, path.split('/')); | ||
} | ||
return uri.with({ path: normalizePath(parts) }).toString(); | ||
return Utils.joinPath.apply(Utils, __spreadArrays([URI.parse(uriString)], paths)).toString(); | ||
} |
@@ -1,643 +0,2 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
'use strict'; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var _a; | ||
var isWindows; | ||
if (typeof process === 'object') { | ||
isWindows = process.platform === 'win32'; | ||
} | ||
else if (typeof navigator === 'object') { | ||
var userAgent = navigator.userAgent; | ||
isWindows = userAgent.indexOf('Windows') >= 0; | ||
} | ||
function isHighSurrogate(charCode) { | ||
return (0xD800 <= charCode && charCode <= 0xDBFF); | ||
} | ||
function isLowSurrogate(charCode) { | ||
return (0xDC00 <= charCode && charCode <= 0xDFFF); | ||
} | ||
function isLowerAsciiHex(code) { | ||
return code >= 97 /* a */ && code <= 102 /* f */; | ||
} | ||
function isLowerAsciiLetter(code) { | ||
return code >= 97 /* a */ && code <= 122 /* z */; | ||
} | ||
function isUpperAsciiLetter(code) { | ||
return code >= 65 /* A */ && code <= 90 /* Z */; | ||
} | ||
function isAsciiLetter(code) { | ||
return isLowerAsciiLetter(code) || isUpperAsciiLetter(code); | ||
} | ||
//#endregion | ||
var _schemePattern = /^\w[\w\d+.-]*$/; | ||
var _singleSlashStart = /^\//; | ||
var _doubleSlashStart = /^\/\//; | ||
function _validateUri(ret, _strict) { | ||
// scheme, must be set | ||
if (!ret.scheme && _strict) { | ||
throw new Error("[UriError]: Scheme is missing: {scheme: \"\", authority: \"" + ret.authority + "\", path: \"" + ret.path + "\", query: \"" + ret.query + "\", fragment: \"" + ret.fragment + "\"}"); | ||
} | ||
// scheme, https://tools.ietf.org/html/rfc3986#section-3.1 | ||
// ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) | ||
if (ret.scheme && !_schemePattern.test(ret.scheme)) { | ||
throw new Error('[UriError]: Scheme contains illegal characters.'); | ||
} | ||
// path, http://tools.ietf.org/html/rfc3986#section-3.3 | ||
// If a URI contains an authority component, then the path component | ||
// must either be empty or begin with a slash ("/") character. If a URI | ||
// does not contain an authority component, then the path cannot begin | ||
// with two slash characters ("//"). | ||
if (ret.path) { | ||
if (ret.authority) { | ||
if (!_singleSlashStart.test(ret.path)) { | ||
throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character'); | ||
} | ||
} | ||
else { | ||
if (_doubleSlashStart.test(ret.path)) { | ||
throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")'); | ||
} | ||
} | ||
} | ||
} | ||
// for a while we allowed uris *without* schemes and this is the migration | ||
// for them, e.g. an uri without scheme and without strict-mode warns and falls | ||
// back to the file-scheme. that should cause the least carnage and still be a | ||
// clear warning | ||
function _schemeFix(scheme, _strict) { | ||
if (!scheme && !_strict) { | ||
return 'file'; | ||
} | ||
return scheme; | ||
} | ||
// implements a bit of https://tools.ietf.org/html/rfc3986#section-5 | ||
function _referenceResolution(scheme, path) { | ||
// the slash-character is our 'default base' as we don't | ||
// support constructing URIs relative to other URIs. This | ||
// also means that we alter and potentially break paths. | ||
// see https://tools.ietf.org/html/rfc3986#section-5.1.4 | ||
switch (scheme) { | ||
case 'https': | ||
case 'http': | ||
case 'file': | ||
if (!path) { | ||
path = _slash; | ||
} | ||
else if (path[0] !== _slash) { | ||
path = _slash + path; | ||
} | ||
break; | ||
} | ||
return path; | ||
} | ||
var _empty = ''; | ||
var _slash = '/'; | ||
var _regexp = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/; | ||
/** | ||
* Uniform Resource Identifier (URI) http://tools.ietf.org/html/rfc3986. | ||
* This class is a simple parser which creates the basic component parts | ||
* (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation | ||
* and encoding. | ||
* | ||
* ```txt | ||
* foo://example.com:8042/over/there?name=ferret#nose | ||
* \_/ \______________/\_________/ \_________/ \__/ | ||
* | | | | | | ||
* scheme authority path query fragment | ||
* | _____________________|__ | ||
* / \ / \ | ||
* urn:example:animal:ferret:nose | ||
* ``` | ||
*/ | ||
var URI = /** @class */ (function () { | ||
/** | ||
* @internal | ||
*/ | ||
function URI(schemeOrData, authority, path, query, fragment, _strict) { | ||
if (_strict === void 0) { _strict = false; } | ||
if (typeof schemeOrData === 'object') { | ||
this.scheme = schemeOrData.scheme || _empty; | ||
this.authority = schemeOrData.authority || _empty; | ||
this.path = schemeOrData.path || _empty; | ||
this.query = schemeOrData.query || _empty; | ||
this.fragment = schemeOrData.fragment || _empty; | ||
// no validation because it's this URI | ||
// that creates uri components. | ||
// _validateUri(this); | ||
} | ||
else { | ||
this.scheme = _schemeFix(schemeOrData, _strict); | ||
this.authority = authority || _empty; | ||
this.path = _referenceResolution(this.scheme, path || _empty); | ||
this.query = query || _empty; | ||
this.fragment = fragment || _empty; | ||
_validateUri(this, _strict); | ||
} | ||
} | ||
URI.isUri = function (thing) { | ||
if (thing instanceof URI) { | ||
return true; | ||
} | ||
if (!thing) { | ||
return false; | ||
} | ||
return typeof thing.authority === 'string' | ||
&& typeof thing.fragment === 'string' | ||
&& typeof thing.path === 'string' | ||
&& typeof thing.query === 'string' | ||
&& typeof thing.scheme === 'string' | ||
&& typeof thing.fsPath === 'function' | ||
&& typeof thing.with === 'function' | ||
&& typeof thing.toString === 'function'; | ||
}; | ||
Object.defineProperty(URI.prototype, "fsPath", { | ||
// ---- filesystem path ----------------------- | ||
/** | ||
* Returns a string representing the corresponding file system path of this URI. | ||
* Will handle UNC paths, normalizes windows drive letters to lower-case, and uses the | ||
* platform specific path separator. | ||
* | ||
* * Will *not* validate the path for invalid characters and semantics. | ||
* * Will *not* look at the scheme of this URI. | ||
* * The result shall *not* be used for display purposes but for accessing a file on disk. | ||
* | ||
* | ||
* The *difference* to `URI#path` is the use of the platform specific separator and the handling | ||
* of UNC paths. See the below sample of a file-uri with an authority (UNC path). | ||
* | ||
* ```ts | ||
const u = URI.parse('file://server/c$/folder/file.txt') | ||
u.authority === 'server' | ||
u.path === '/shares/c$/file.txt' | ||
u.fsPath === '\\server\c$\folder\file.txt' | ||
``` | ||
* | ||
* Using `URI#path` to read a file (using fs-apis) would not be enough because parts of the path, | ||
* namely the server name, would be missing. Therefore `URI#fsPath` exists - it's sugar to ease working | ||
* with URIs that represent files on disk (`file` scheme). | ||
*/ | ||
get: function () { | ||
// if (this.scheme !== 'file') { | ||
// console.warn(`[UriError] calling fsPath with scheme ${this.scheme}`); | ||
// } | ||
return uriToFsPath(this, false); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
// ---- modify to new ------------------------- | ||
URI.prototype.with = function (change) { | ||
if (!change) { | ||
return this; | ||
} | ||
var scheme = change.scheme, authority = change.authority, path = change.path, query = change.query, fragment = change.fragment; | ||
if (scheme === undefined) { | ||
scheme = this.scheme; | ||
} | ||
else if (scheme === null) { | ||
scheme = _empty; | ||
} | ||
if (authority === undefined) { | ||
authority = this.authority; | ||
} | ||
else if (authority === null) { | ||
authority = _empty; | ||
} | ||
if (path === undefined) { | ||
path = this.path; | ||
} | ||
else if (path === null) { | ||
path = _empty; | ||
} | ||
if (query === undefined) { | ||
query = this.query; | ||
} | ||
else if (query === null) { | ||
query = _empty; | ||
} | ||
if (fragment === undefined) { | ||
fragment = this.fragment; | ||
} | ||
else if (fragment === null) { | ||
fragment = _empty; | ||
} | ||
if (scheme === this.scheme | ||
&& authority === this.authority | ||
&& path === this.path | ||
&& query === this.query | ||
&& fragment === this.fragment) { | ||
return this; | ||
} | ||
return new _URI(scheme, authority, path, query, fragment); | ||
}; | ||
// ---- parse & validate ------------------------ | ||
/** | ||
* Creates a new URI from a string, e.g. `http://www.msft.com/some/path`, | ||
* `file:///usr/home`, or `scheme:with/path`. | ||
* | ||
* @param value A string which represents an URI (see `URI#toString`). | ||
*/ | ||
URI.parse = function (value, _strict) { | ||
if (_strict === void 0) { _strict = false; } | ||
var match = _regexp.exec(value); | ||
if (!match) { | ||
return new _URI(_empty, _empty, _empty, _empty, _empty); | ||
} | ||
return new _URI(match[2] || _empty, percentDecode(match[4] || _empty), percentDecode(match[5] || _empty), percentDecode(match[7] || _empty), percentDecode(match[9] || _empty), _strict); | ||
}; | ||
/** | ||
* Creates a new URI from a file system path, e.g. `c:\my\files`, | ||
* `/usr/home`, or `\\server\share\some\path`. | ||
* | ||
* The *difference* between `URI#parse` and `URI#file` is that the latter treats the argument | ||
* as path, not as stringified-uri. E.g. `URI.file(path)` is **not the same as** | ||
* `URI.parse('file://' + path)` because the path might contain characters that are | ||
* interpreted (# and ?). See the following sample: | ||
* ```ts | ||
const good = URI.file('/coding/c#/project1'); | ||
good.scheme === 'file'; | ||
good.path === '/coding/c#/project1'; | ||
good.fragment === ''; | ||
const bad = URI.parse('file://' + '/coding/c#/project1'); | ||
bad.scheme === 'file'; | ||
bad.path === '/coding/c'; // path is now broken | ||
bad.fragment === '/project1'; | ||
``` | ||
* | ||
* @param path A file system path (see `URI#fsPath`) | ||
*/ | ||
URI.file = function (path) { | ||
var authority = _empty; | ||
// normalize to fwd-slashes on windows, | ||
// on other systems bwd-slashes are valid | ||
// filename character, eg /f\oo/ba\r.txt | ||
if (isWindows) { | ||
path = path.replace(/\\/g, _slash); | ||
} | ||
// check for authority as used in UNC shares | ||
// or use the path as given | ||
if (path[0] === _slash && path[1] === _slash) { | ||
var idx = path.indexOf(_slash, 2); | ||
if (idx === -1) { | ||
authority = path.substring(2); | ||
path = _slash; | ||
} | ||
else { | ||
authority = path.substring(2, idx); | ||
path = path.substring(idx) || _slash; | ||
} | ||
} | ||
return new _URI('file', authority, path, _empty, _empty); | ||
}; | ||
URI.from = function (components) { | ||
return new _URI(components.scheme, components.authority, components.path, components.query, components.fragment); | ||
}; | ||
// /** | ||
// * Join a URI path with path fragments and normalizes the resulting path. | ||
// * | ||
// * @param uri The input URI. | ||
// * @param pathFragment The path fragment to add to the URI path. | ||
// * @returns The resulting URI. | ||
// */ | ||
// static joinPath(uri: URI, ...pathFragment: string[]): URI { | ||
// if (!uri.path) { | ||
// throw new Error(`[UriError]: cannot call joinPaths on URI without path`); | ||
// } | ||
// let newPath: string; | ||
// if (isWindows && uri.scheme === 'file') { | ||
// newPath = URI.file(paths.win32.join(uriToFsPath(uri, true), ...pathFragment)).path; | ||
// } else { | ||
// newPath = paths.posix.join(uri.path, ...pathFragment); | ||
// } | ||
// return uri.with({ path: newPath }); | ||
// } | ||
// ---- printing/externalize --------------------------- | ||
/** | ||
* Creates a string representation for this URI. It's guaranteed that calling | ||
* `URI.parse` with the result of this function creates an URI which is equal | ||
* to this URI. | ||
* | ||
* * The result shall *not* be used for display purposes but for externalization or transport. | ||
* * The result will be encoded using the percentage encoding and encoding happens mostly | ||
* ignore the scheme-specific encoding rules. | ||
* | ||
* @param skipEncoding Do not encode the result, default is `false` | ||
*/ | ||
URI.prototype.toString = function (skipEncoding) { | ||
if (skipEncoding === void 0) { skipEncoding = false; } | ||
return _asFormatted(this, skipEncoding); | ||
}; | ||
URI.prototype.toJSON = function () { | ||
return this; | ||
}; | ||
URI.revive = function (data) { | ||
if (!data) { | ||
return data; | ||
} | ||
else if (data instanceof URI) { | ||
return data; | ||
} | ||
else { | ||
var result = new _URI(data); | ||
result._formatted = data.external; | ||
result._fsPath = data._sep === _pathSepMarker ? data.fsPath : null; | ||
return result; | ||
} | ||
}; | ||
return URI; | ||
}()); | ||
export { URI }; | ||
var _pathSepMarker = isWindows ? 1 : undefined; | ||
// eslint-disable-next-line @typescript-eslint/class-name-casing | ||
var _URI = /** @class */ (function (_super) { | ||
__extends(_URI, _super); | ||
function _URI() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this._formatted = null; | ||
_this._fsPath = null; | ||
return _this; | ||
} | ||
Object.defineProperty(_URI.prototype, "fsPath", { | ||
get: function () { | ||
if (!this._fsPath) { | ||
this._fsPath = uriToFsPath(this, false); | ||
} | ||
return this._fsPath; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
_URI.prototype.toString = function (skipEncoding) { | ||
if (skipEncoding === void 0) { skipEncoding = false; } | ||
if (!skipEncoding) { | ||
if (!this._formatted) { | ||
this._formatted = _asFormatted(this, false); | ||
} | ||
return this._formatted; | ||
} | ||
else { | ||
// we don't cache that | ||
return _asFormatted(this, true); | ||
} | ||
}; | ||
_URI.prototype.toJSON = function () { | ||
var res = { | ||
$mid: 1 | ||
}; | ||
// cached state | ||
if (this._fsPath) { | ||
res.fsPath = this._fsPath; | ||
res._sep = _pathSepMarker; | ||
} | ||
if (this._formatted) { | ||
res.external = this._formatted; | ||
} | ||
// uri components | ||
if (this.path) { | ||
res.path = this.path; | ||
} | ||
if (this.scheme) { | ||
res.scheme = this.scheme; | ||
} | ||
if (this.authority) { | ||
res.authority = this.authority; | ||
} | ||
if (this.query) { | ||
res.query = this.query; | ||
} | ||
if (this.fragment) { | ||
res.fragment = this.fragment; | ||
} | ||
return res; | ||
}; | ||
return _URI; | ||
}(URI)); | ||
// reserved characters: https://tools.ietf.org/html/rfc3986#section-2.2 | ||
var encodeTable = (_a = {}, | ||
_a[58 /* Colon */] = '%3A', | ||
_a[47 /* Slash */] = '%2F', | ||
_a[63 /* QuestionMark */] = '%3F', | ||
_a[35 /* Hash */] = '%23', | ||
_a[91 /* OpenSquareBracket */] = '%5B', | ||
_a[93 /* CloseSquareBracket */] = '%5D', | ||
_a[64 /* AtSign */] = '%40', | ||
_a[33 /* ExclamationMark */] = '%21', | ||
_a[36 /* DollarSign */] = '%24', | ||
_a[38 /* Ampersand */] = '%26', | ||
_a[39 /* SingleQuote */] = '%27', | ||
_a[40 /* OpenParen */] = '%28', | ||
_a[41 /* CloseParen */] = '%29', | ||
_a[42 /* Asterisk */] = '%2A', | ||
_a[43 /* Plus */] = '%2B', | ||
_a[44 /* Comma */] = '%2C', | ||
_a[59 /* Semicolon */] = '%3B', | ||
_a[61 /* Equals */] = '%3D', | ||
_a[32 /* Space */] = '%20', | ||
_a); | ||
function encodeURIComponentFast(uriComponent, allowSlash) { | ||
var res = undefined; | ||
var nativeEncodePos = -1; | ||
for (var pos = 0; pos < uriComponent.length; pos++) { | ||
var code = uriComponent.charCodeAt(pos); | ||
// unreserved characters: https://tools.ietf.org/html/rfc3986#section-2.3 | ||
if ((code >= 97 /* a */ && code <= 122 /* z */) | ||
|| (code >= 65 /* A */ && code <= 90 /* Z */) | ||
|| (code >= 48 /* Digit0 */ && code <= 57 /* Digit9 */) | ||
|| code === 45 /* Dash */ | ||
|| code === 46 /* Period */ | ||
|| code === 95 /* Underline */ | ||
|| code === 126 /* Tilde */ | ||
|| (allowSlash && code === 47 /* Slash */)) { | ||
// check if we are delaying native encode | ||
if (nativeEncodePos !== -1) { | ||
res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); | ||
nativeEncodePos = -1; | ||
} | ||
// check if we write into a new string (by default we try to return the param) | ||
if (res !== undefined) { | ||
res += uriComponent.charAt(pos); | ||
} | ||
} | ||
else { | ||
// encoding needed, we need to allocate a new string | ||
if (res === undefined) { | ||
res = uriComponent.substr(0, pos); | ||
} | ||
// check with default table first | ||
var escaped = encodeTable[code]; | ||
if (escaped !== undefined) { | ||
// check if we are delaying native encode | ||
if (nativeEncodePos !== -1) { | ||
res += encodeURIComponent(uriComponent.substring(nativeEncodePos, pos)); | ||
nativeEncodePos = -1; | ||
} | ||
// append escaped variant to result | ||
res += escaped; | ||
} | ||
else if (nativeEncodePos === -1) { | ||
// use native encode only when needed | ||
nativeEncodePos = pos; | ||
} | ||
} | ||
} | ||
if (nativeEncodePos !== -1) { | ||
res += encodeURIComponent(uriComponent.substring(nativeEncodePos)); | ||
} | ||
return res !== undefined ? res : uriComponent; | ||
} | ||
function encodeURIComponentMinimal(path) { | ||
var res = undefined; | ||
for (var pos = 0; pos < path.length; pos++) { | ||
var code = path.charCodeAt(pos); | ||
if (code === 35 /* Hash */ || code === 63 /* QuestionMark */) { | ||
if (res === undefined) { | ||
res = path.substr(0, pos); | ||
} | ||
res += encodeTable[code]; | ||
} | ||
else { | ||
if (res !== undefined) { | ||
res += path[pos]; | ||
} | ||
} | ||
} | ||
return res !== undefined ? res : path; | ||
} | ||
/** | ||
* Compute `fsPath` for the given uri | ||
*/ | ||
export function uriToFsPath(uri, keepDriveLetterCasing) { | ||
var value; | ||
if (uri.authority && uri.path.length > 1 && uri.scheme === 'file') { | ||
// unc path: file://shares/c$/far/boo | ||
value = "//" + uri.authority + uri.path; | ||
} | ||
else if (uri.path.charCodeAt(0) === 47 /* Slash */ | ||
&& (uri.path.charCodeAt(1) >= 65 /* A */ && uri.path.charCodeAt(1) <= 90 /* Z */ || uri.path.charCodeAt(1) >= 97 /* a */ && uri.path.charCodeAt(1) <= 122 /* z */) | ||
&& uri.path.charCodeAt(2) === 58 /* Colon */) { | ||
if (!keepDriveLetterCasing) { | ||
// windows drive letter: file:///c:/far/boo | ||
value = uri.path[1].toLowerCase() + uri.path.substr(2); | ||
} | ||
else { | ||
value = uri.path.substr(1); | ||
} | ||
} | ||
else { | ||
// other path | ||
value = uri.path; | ||
} | ||
if (isWindows) { | ||
value = value.replace(/\//g, '\\'); | ||
} | ||
return value; | ||
} | ||
/** | ||
* Create the external version of a uri | ||
*/ | ||
function _asFormatted(uri, skipEncoding) { | ||
var encoder = !skipEncoding | ||
? encodeURIComponentFast | ||
: encodeURIComponentMinimal; | ||
var res = ''; | ||
var scheme = uri.scheme, authority = uri.authority, path = uri.path, query = uri.query, fragment = uri.fragment; | ||
if (scheme) { | ||
res += scheme; | ||
res += ':'; | ||
} | ||
if (authority || scheme === 'file') { | ||
res += _slash; | ||
res += _slash; | ||
} | ||
if (authority) { | ||
var idx = authority.indexOf('@'); | ||
if (idx !== -1) { | ||
// <user>@<auth> | ||
var userinfo = authority.substr(0, idx); | ||
authority = authority.substr(idx + 1); | ||
idx = userinfo.indexOf(':'); | ||
if (idx === -1) { | ||
res += encoder(userinfo, false); | ||
} | ||
else { | ||
// <user>:<pass>@<auth> | ||
res += encoder(userinfo.substr(0, idx), false); | ||
res += ':'; | ||
res += encoder(userinfo.substr(idx + 1), false); | ||
} | ||
res += '@'; | ||
} | ||
authority = authority.toLowerCase(); | ||
idx = authority.indexOf(':'); | ||
if (idx === -1) { | ||
res += encoder(authority, false); | ||
} | ||
else { | ||
// <auth>:<port> | ||
res += encoder(authority.substr(0, idx), false); | ||
res += authority.substr(idx); | ||
} | ||
} | ||
if (path) { | ||
// lower-case windows drive letters in /C:/fff or C:/fff | ||
if (path.length >= 3 && path.charCodeAt(0) === 47 /* Slash */ && path.charCodeAt(2) === 58 /* Colon */) { | ||
var code = path.charCodeAt(1); | ||
if (code >= 65 /* A */ && code <= 90 /* Z */) { | ||
path = "/" + String.fromCharCode(code + 32) + ":" + path.substr(3); // "/c:".length === 3 | ||
} | ||
} | ||
else if (path.length >= 2 && path.charCodeAt(1) === 58 /* Colon */) { | ||
var code = path.charCodeAt(0); | ||
if (code >= 65 /* A */ && code <= 90 /* Z */) { | ||
path = String.fromCharCode(code + 32) + ":" + path.substr(2); // "/c:".length === 3 | ||
} | ||
} | ||
// encode the rest of the path | ||
res += encoder(path, true); | ||
} | ||
if (query) { | ||
res += '?'; | ||
res += encoder(query, false); | ||
} | ||
if (fragment) { | ||
res += '#'; | ||
res += !skipEncoding ? encodeURIComponentFast(fragment, false) : fragment; | ||
} | ||
return res; | ||
} | ||
// --- decode | ||
function decodeURIComponentGraceful(str) { | ||
try { | ||
return decodeURIComponent(str); | ||
} | ||
catch (_a) { | ||
if (str.length > 3) { | ||
return str.substr(0, 3) + decodeURIComponentGraceful(str.substr(3)); | ||
} | ||
else { | ||
return str; | ||
} | ||
} | ||
} | ||
var _rEncodedAsHex = /(%[0-9A-Za-z][0-9A-Za-z])+/g; | ||
function percentDecode(str) { | ||
if (!str.match(_rEncodedAsHex)) { | ||
return str; | ||
} | ||
return str.replace(_rEncodedAsHex, function (match) { return decodeURIComponentGraceful(match); }); | ||
} | ||
var LIB;LIB=(()=>{"use strict";var t={470:t=>{function e(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function r(t,e){for(var r,n="",o=0,i=-1,a=0,h=0;h<=t.length;++h){if(h<t.length)r=t.charCodeAt(h);else{if(47===r)break;r=47}if(47===r){if(i===h-1||1===a);else if(i!==h-1&&2===a){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2))if(n.length>2){var s=n.lastIndexOf("/");if(s!==n.length-1){-1===s?(n="",o=0):o=(n=n.slice(0,s)).length-1-n.lastIndexOf("/"),i=h,a=0;continue}}else if(2===n.length||1===n.length){n="",o=0,i=h,a=0;continue}e&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+t.slice(i+1,h):n=t.slice(i+1,h),o=h-i-1;i=h,a=0}else 46===r&&-1!==a?++a:a=-1}return n}var n={resolve:function(){for(var t,n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a;i>=0?a=arguments[i]:(void 0===t&&(t=process.cwd()),a=t),e(a),0!==a.length&&(n=a+"/"+n,o=47===a.charCodeAt(0))}return n=r(n,!o),o?n.length>0?"/"+n:"/":n.length>0?n:"."},normalize:function(t){if(e(t),0===t.length)return".";var n=47===t.charCodeAt(0),o=47===t.charCodeAt(t.length-1);return 0!==(t=r(t,!n)).length||n||(t="."),t.length>0&&o&&(t+="/"),n?"/"+t:t},isAbsolute:function(t){return e(t),t.length>0&&47===t.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var t,r=0;r<arguments.length;++r){var o=arguments[r];e(o),o.length>0&&(void 0===t?t=o:t+="/"+o)}return void 0===t?".":n.normalize(t)},relative:function(t,r){if(e(t),e(r),t===r)return"";if((t=n.resolve(t))===(r=n.resolve(r)))return"";for(var o=1;o<t.length&&47===t.charCodeAt(o);++o);for(var i=t.length,a=i-o,h=1;h<r.length&&47===r.charCodeAt(h);++h);for(var s=r.length-h,f=a<s?a:s,u=-1,c=0;c<=f;++c){if(c===f){if(s>f){if(47===r.charCodeAt(h+c))return r.slice(h+c+1);if(0===c)return r.slice(h+c)}else a>f&&(47===t.charCodeAt(o+c)?u=c:0===c&&(u=0));break}var l=t.charCodeAt(o+c);if(l!==r.charCodeAt(h+c))break;47===l&&(u=c)}var p="";for(c=o+u+1;c<=i;++c)c!==i&&47!==t.charCodeAt(c)||(0===p.length?p+="..":p+="/..");return p.length>0?p+r.slice(h+u):(h+=u,47===r.charCodeAt(h)&&++h,r.slice(h))},_makeLong:function(t){return t},dirname:function(t){if(e(t),0===t.length)return".";for(var r=t.charCodeAt(0),n=47===r,o=-1,i=!0,a=t.length-1;a>=1;--a)if(47===(r=t.charCodeAt(a))){if(!i){o=a;break}}else i=!1;return-1===o?n?"/":".":n&&1===o?"//":t.slice(0,o)},basename:function(t,r){if(void 0!==r&&"string"!=typeof r)throw new TypeError('"ext" argument must be a string');e(t);var n,o=0,i=-1,a=!0;if(void 0!==r&&r.length>0&&r.length<=t.length){if(r.length===t.length&&r===t)return"";var h=r.length-1,s=-1;for(n=t.length-1;n>=0;--n){var f=t.charCodeAt(n);if(47===f){if(!a){o=n+1;break}}else-1===s&&(a=!1,s=n+1),h>=0&&(f===r.charCodeAt(h)?-1==--h&&(i=n):(h=-1,i=s))}return o===i?i=s:-1===i&&(i=t.length),t.slice(o,i)}for(n=t.length-1;n>=0;--n)if(47===t.charCodeAt(n)){if(!a){o=n+1;break}}else-1===i&&(a=!1,i=n+1);return-1===i?"":t.slice(o,i)},extname:function(t){e(t);for(var r=-1,n=0,o=-1,i=!0,a=0,h=t.length-1;h>=0;--h){var s=t.charCodeAt(h);if(47!==s)-1===o&&(i=!1,o=h+1),46===s?-1===r?r=h:1!==a&&(a=1):-1!==r&&(a=-1);else if(!i){n=h+1;break}}return-1===r||-1===o||0===a||1===a&&r===o-1&&r===n+1?"":t.slice(r,o)},format:function(t){if(null===t||"object"!=typeof t)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof t);return function(t,e){var r=e.dir||e.root,n=e.base||(e.name||"")+(e.ext||"");return r?r===e.root?r+n:r+"/"+n:n}(0,t)},parse:function(t){e(t);var r={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return r;var n,o=t.charCodeAt(0),i=47===o;i?(r.root="/",n=1):n=0;for(var a=-1,h=0,s=-1,f=!0,u=t.length-1,c=0;u>=n;--u)if(47!==(o=t.charCodeAt(u)))-1===s&&(f=!1,s=u+1),46===o?-1===a?a=u:1!==c&&(c=1):-1!==a&&(c=-1);else if(!f){h=u+1;break}return-1===a||-1===s||0===c||1===c&&a===s-1&&a===h+1?-1!==s&&(r.base=r.name=0===h&&i?t.slice(1,s):t.slice(h,s)):(0===h&&i?(r.name=t.slice(1,a),r.base=t.slice(1,s)):(r.name=t.slice(h,a),r.base=t.slice(h,s)),r.ext=t.slice(a,s)),h>0?r.dir=t.slice(0,h-1):i&&(r.dir="/"),r},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,t.exports=n},447:(t,e,r)=>{var n;if(r.r(e),r.d(e,{URI:()=>g,Utils:()=>O}),"object"==typeof process)n="win32"===process.platform;else if("object"==typeof navigator){var o=navigator.userAgent;n=o.indexOf("Windows")>=0}var i,a,h=(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),s=/^\w[\w\d+.-]*$/,f=/^\//,u=/^\/\//,c="",l="/",p=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,g=function(){function t(t,e,r,n,o,i){void 0===i&&(i=!1),"object"==typeof t?(this.scheme=t.scheme||c,this.authority=t.authority||c,this.path=t.path||c,this.query=t.query||c,this.fragment=t.fragment||c):(this.scheme=function(t,e){return t||e?t:"file"}(t,i),this.authority=e||c,this.path=function(t,e){switch(t){case"https":case"http":case"file":e?e[0]!==l&&(e=l+e):e=l}return e}(this.scheme,r||c),this.query=n||c,this.fragment=o||c,function(t,e){if(!t.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+t.authority+'", path: "'+t.path+'", query: "'+t.query+'", fragment: "'+t.fragment+'"}');if(t.scheme&&!s.test(t.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(t.path)if(t.authority){if(!f.test(t.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(u.test(t.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}(this,i))}return t.isUri=function(e){return e instanceof t||!!e&&"string"==typeof e.authority&&"string"==typeof e.fragment&&"string"==typeof e.path&&"string"==typeof e.query&&"string"==typeof e.scheme&&"function"==typeof e.fsPath&&"function"==typeof e.with&&"function"==typeof e.toString},Object.defineProperty(t.prototype,"fsPath",{get:function(){return C(this,!1)},enumerable:!1,configurable:!0}),t.prototype.with=function(t){if(!t)return this;var e=t.scheme,r=t.authority,n=t.path,o=t.query,i=t.fragment;return void 0===e?e=this.scheme:null===e&&(e=c),void 0===r?r=this.authority:null===r&&(r=c),void 0===n?n=this.path:null===n&&(n=c),void 0===o?o=this.query:null===o&&(o=c),void 0===i?i=this.fragment:null===i&&(i=c),e===this.scheme&&r===this.authority&&n===this.path&&o===this.query&&i===this.fragment?this:new v(e,r,n,o,i)},t.parse=function(t,e){void 0===e&&(e=!1);var r=p.exec(t);return r?new v(r[2]||c,x(r[4]||c),x(r[5]||c),x(r[7]||c),x(r[9]||c),e):new v(c,c,c,c,c)},t.file=function(t){var e=c;if(n&&(t=t.replace(/\\/g,l)),t[0]===l&&t[1]===l){var r=t.indexOf(l,2);-1===r?(e=t.substring(2),t=l):(e=t.substring(2,r),t=t.substring(r)||l)}return new v("file",e,t,c,c)},t.from=function(t){return new v(t.scheme,t.authority,t.path,t.query,t.fragment)},t.prototype.toString=function(t){return void 0===t&&(t=!1),A(this,t)},t.prototype.toJSON=function(){return this},t.revive=function(e){if(e){if(e instanceof t)return e;var r=new v(e);return r._formatted=e.external,r._fsPath=e._sep===d?e.fsPath:null,r}return e},t}(),d=n?1:void 0,v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._formatted=null,e._fsPath=null,e}return h(e,t),Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=C(this,!1)),this._fsPath},enumerable:!1,configurable:!0}),e.prototype.toString=function(t){return void 0===t&&(t=!1),t?A(this,!0):(this._formatted||(this._formatted=A(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=d),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(g),m=((a={})[58]="%3A",a[47]="%2F",a[63]="%3F",a[35]="%23",a[91]="%5B",a[93]="%5D",a[64]="%40",a[33]="%21",a[36]="%24",a[38]="%26",a[39]="%27",a[40]="%28",a[41]="%29",a[42]="%2A",a[43]="%2B",a[44]="%2C",a[59]="%3B",a[61]="%3D",a[32]="%20",a);function y(t,e){for(var r=void 0,n=-1,o=0;o<t.length;o++){var i=t.charCodeAt(o);if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||45===i||46===i||95===i||126===i||e&&47===i)-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),void 0!==r&&(r+=t.charAt(o));else{void 0===r&&(r=t.substr(0,o));var a=m[i];void 0!==a?(-1!==n&&(r+=encodeURIComponent(t.substring(n,o)),n=-1),r+=a):-1===n&&(n=o)}}return-1!==n&&(r+=encodeURIComponent(t.substring(n))),void 0!==r?r:t}function b(t){for(var e=void 0,r=0;r<t.length;r++){var n=t.charCodeAt(r);35===n||63===n?(void 0===e&&(e=t.substr(0,r)),e+=m[n]):void 0!==e&&(e+=t[r])}return void 0!==e?e:t}function C(t,e){var r;return r=t.authority&&t.path.length>1&&"file"===t.scheme?"//"+t.authority+t.path:47===t.path.charCodeAt(0)&&(t.path.charCodeAt(1)>=65&&t.path.charCodeAt(1)<=90||t.path.charCodeAt(1)>=97&&t.path.charCodeAt(1)<=122)&&58===t.path.charCodeAt(2)?e?t.path.substr(1):t.path[1].toLowerCase()+t.path.substr(2):t.path,n&&(r=r.replace(/\//g,"\\")),r}function A(t,e){var r=e?b:y,n="",o=t.scheme,i=t.authority,a=t.path,h=t.query,s=t.fragment;if(o&&(n+=o,n+=":"),(i||"file"===o)&&(n+=l,n+=l),i){var f=i.indexOf("@");if(-1!==f){var u=i.substr(0,f);i=i.substr(f+1),-1===(f=u.indexOf(":"))?n+=r(u,!1):(n+=r(u.substr(0,f),!1),n+=":",n+=r(u.substr(f+1),!1)),n+="@"}-1===(f=(i=i.toLowerCase()).indexOf(":"))?n+=r(i,!1):(n+=r(i.substr(0,f),!1),n+=i.substr(f))}if(a){if(a.length>=3&&47===a.charCodeAt(0)&&58===a.charCodeAt(2))(c=a.charCodeAt(1))>=65&&c<=90&&(a="/"+String.fromCharCode(c+32)+":"+a.substr(3));else if(a.length>=2&&58===a.charCodeAt(1)){var c;(c=a.charCodeAt(0))>=65&&c<=90&&(a=String.fromCharCode(c+32)+":"+a.substr(2))}n+=r(a,!0)}return h&&(n+="?",n+=r(h,!1)),s&&(n+="#",n+=e?s:y(s,!1)),n}function w(t){try{return decodeURIComponent(t)}catch(e){return t.length>3?t.substr(0,3)+w(t.substr(3)):t}}var _=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function x(t){return t.match(_)?t.replace(_,(function(t){return w(t)})):t}var O,P=r(470),j=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],a=0,h=i.length;a<h;a++,o++)n[o]=i[a];return n},U=P.posix||P;!function(t){t.joinPath=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return t.with({path:U.join.apply(U,j([t.path],e))})},t.resolvePath=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=t.path||"/";return t.with({path:U.resolve.apply(U,j([n],e))})},t.dirname=function(t){var e=U.dirname(t.path);return 1===e.length&&46===e.charCodeAt(0)?t:t.with({path:e})},t.basename=function(t){return U.basename(t.path)},t.extname=function(t){return U.extname(t.path)}}(O||(O={}))}},e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(447)})();export const{URI,Utils}=LIB; | ||
//# sourceMappingURL=index.js.map |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
export * from 'monaco-editor-core'; |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
@@ -71,3 +71,3 @@ /*--------------------------------------------------------------------------------------------- | ||
var model = editor.getModel(resource); | ||
if (model.getModeId() === languageId) { | ||
if (model && model.getModeId() === languageId) { | ||
editor.setModelMarkers(model, languageId, markers); | ||
@@ -74,0 +74,0 @@ } |
@@ -0,0 +0,0 @@ import { IEvent } from './fillers/monaco-editor-core'; |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
@@ -0,0 +0,0 @@ /*--------------------------------------------------------------------------------------------- |
/*!----------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* monaco-css version: 3.1.1(23bd524cc383945cb039c5b552c0b783c450f6d6) | ||
* monaco-css version: 3.2.0(34339c7214de33ed59198877f683e3fd27e168f6) | ||
* Released under the MIT license | ||
@@ -5,0 +5,0 @@ * https://github.com/Microsoft/monaco-css/blob/master/LICENSE.md |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6388555
111165