🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
55
node_modules/vscode-css-languageservice/lib/umd/utils/arrays.js
generated
vendored
Normal file
55
node_modules/vscode-css-languageservice/lib/umd/utils/arrays.js
generated
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.union = exports.includes = exports.findFirst = void 0;
|
||||
/**
|
||||
* Takes a sorted array and a function p. The array is sorted in such a way that all elements where p(x) is false
|
||||
* are located before all elements where p(x) is true.
|
||||
* @returns the least x for which p(x) is true or array.length if no element fullfills the given function.
|
||||
*/
|
||||
function findFirst(array, p) {
|
||||
let low = 0, high = array.length;
|
||||
if (high === 0) {
|
||||
return 0; // no children
|
||||
}
|
||||
while (low < high) {
|
||||
let mid = Math.floor((low + high) / 2);
|
||||
if (p(array[mid])) {
|
||||
high = mid;
|
||||
}
|
||||
else {
|
||||
low = mid + 1;
|
||||
}
|
||||
}
|
||||
return low;
|
||||
}
|
||||
exports.findFirst = findFirst;
|
||||
function includes(array, item) {
|
||||
return array.indexOf(item) !== -1;
|
||||
}
|
||||
exports.includes = includes;
|
||||
function union(...arrays) {
|
||||
const result = [];
|
||||
for (const array of arrays) {
|
||||
for (const item of array) {
|
||||
if (!includes(result, item)) {
|
||||
result.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.union = union;
|
||||
});
|
||||
25
node_modules/vscode-css-languageservice/lib/umd/utils/objects.js
generated
vendored
Normal file
25
node_modules/vscode-css-languageservice/lib/umd/utils/objects.js
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isDefined = exports.values = void 0;
|
||||
function values(obj) {
|
||||
return Object.keys(obj).map(key => obj[key]);
|
||||
}
|
||||
exports.values = values;
|
||||
function isDefined(obj) {
|
||||
return typeof obj !== 'undefined';
|
||||
}
|
||||
exports.isDefined = isDefined;
|
||||
});
|
||||
26
node_modules/vscode-css-languageservice/lib/umd/utils/resources.js
generated
vendored
Normal file
26
node_modules/vscode-css-languageservice/lib/umd/utils/resources.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports", "vscode-uri"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.joinPath = exports.dirname = void 0;
|
||||
const vscode_uri_1 = require("vscode-uri");
|
||||
function dirname(uriString) {
|
||||
return vscode_uri_1.Utils.dirname(vscode_uri_1.URI.parse(uriString)).toString(true);
|
||||
}
|
||||
exports.dirname = dirname;
|
||||
function joinPath(uriString, ...paths) {
|
||||
return vscode_uri_1.Utils.joinPath(vscode_uri_1.URI.parse(uriString), ...paths).toString(true);
|
||||
}
|
||||
exports.joinPath = joinPath;
|
||||
});
|
||||
120
node_modules/vscode-css-languageservice/lib/umd/utils/strings.js
generated
vendored
Normal file
120
node_modules/vscode-css-languageservice/lib/umd/utils/strings.js
generated
vendored
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
(function (factory) {
|
||||
if (typeof module === "object" && typeof module.exports === "object") {
|
||||
var v = factory(require, exports);
|
||||
if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === "function" && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.repeat = exports.trim = exports.getLimitedString = exports.difference = exports.endsWith = exports.startsWith = void 0;
|
||||
function startsWith(haystack, needle) {
|
||||
if (haystack.length < needle.length) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < needle.length; i++) {
|
||||
if (haystack[i] !== needle[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
exports.startsWith = startsWith;
|
||||
/**
|
||||
* Determines if haystack ends with needle.
|
||||
*/
|
||||
function endsWith(haystack, needle) {
|
||||
let diff = haystack.length - needle.length;
|
||||
if (diff > 0) {
|
||||
return haystack.lastIndexOf(needle) === diff;
|
||||
}
|
||||
else if (diff === 0) {
|
||||
return haystack === needle;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
exports.endsWith = endsWith;
|
||||
/**
|
||||
* Computes the difference score for two strings. More similar strings have a higher score.
|
||||
* We use largest common subsequence dynamic programming approach but penalize in the end for length differences.
|
||||
* Strings that have a large length difference will get a bad default score 0.
|
||||
* Complexity - both time and space O(first.length * second.length)
|
||||
* Dynamic programming LCS computation http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
|
||||
*
|
||||
* @param first a string
|
||||
* @param second a string
|
||||
*/
|
||||
function difference(first, second, maxLenDelta = 4) {
|
||||
let lengthDifference = Math.abs(first.length - second.length);
|
||||
// We only compute score if length of the currentWord and length of entry.name are similar.
|
||||
if (lengthDifference > maxLenDelta) {
|
||||
return 0;
|
||||
}
|
||||
// Initialize LCS (largest common subsequence) matrix.
|
||||
let LCS = [];
|
||||
let zeroArray = [];
|
||||
let i, j;
|
||||
for (i = 0; i < second.length + 1; ++i) {
|
||||
zeroArray.push(0);
|
||||
}
|
||||
for (i = 0; i < first.length + 1; ++i) {
|
||||
LCS.push(zeroArray);
|
||||
}
|
||||
for (i = 1; i < first.length + 1; ++i) {
|
||||
for (j = 1; j < second.length + 1; ++j) {
|
||||
if (first[i - 1] === second[j - 1]) {
|
||||
LCS[i][j] = LCS[i - 1][j - 1] + 1;
|
||||
}
|
||||
else {
|
||||
LCS[i][j] = Math.max(LCS[i - 1][j], LCS[i][j - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return LCS[first.length][second.length] - Math.sqrt(lengthDifference);
|
||||
}
|
||||
exports.difference = difference;
|
||||
/**
|
||||
* Limit of string length.
|
||||
*/
|
||||
function getLimitedString(str, ellipsis = true) {
|
||||
if (!str) {
|
||||
return '';
|
||||
}
|
||||
if (str.length < 140) {
|
||||
return str;
|
||||
}
|
||||
return str.slice(0, 140) + (ellipsis ? '\u2026' : '');
|
||||
}
|
||||
exports.getLimitedString = getLimitedString;
|
||||
/**
|
||||
* Limit of string length.
|
||||
*/
|
||||
function trim(str, regexp) {
|
||||
const m = regexp.exec(str);
|
||||
if (m && m[0].length) {
|
||||
return str.substr(0, str.length - m[0].length);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
exports.trim = trim;
|
||||
function repeat(value, count) {
|
||||
let s = '';
|
||||
while (count > 0) {
|
||||
if ((count & 1) === 1) {
|
||||
s += value;
|
||||
}
|
||||
value += value;
|
||||
count = count >>> 1;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
exports.repeat = repeat;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue