🎉 initiate project *astro_rewrite*

This commit is contained in:
sindrekjelsrud 2023-07-19 21:31:30 +02:00
parent ffd4d5e86c
commit 2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions

21
node_modules/@emmetio/scanner/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Sergey Chikuyonok <serge.che@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

49
node_modules/@emmetio/scanner/package.json generated vendored Normal file
View file

@ -0,0 +1,49 @@
{
"name": "@emmetio/scanner",
"version": "1.0.4",
"description": "Scans given text character-by-character",
"main": "./scanner.cjs",
"module": "./scanner.js",
"types": "./scanner.d.ts",
"type": "module",
"exports": {
"import": "./scanner.js",
"require": "./scanner.cjs"
},
"scripts": {
"test": "mocha",
"build": "rollup -c",
"clean": "rimraf ./scanner.* ./*.d.ts",
"prepublishOnly": "npm run clean && npm run build && npm test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emmetio/stream-reader.git"
},
"keywords": [
"emmet",
"stream",
"scanner"
],
"author": "Sergey Chikuyonok <serge.che@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/emmetio/emmet/issues"
},
"homepage": "https://github.com/emmetio/emmet#readme",
"devDependencies": {
"@rollup/plugin-typescript": "^10.0.1",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.18",
"mocha": "^10.2.0",
"rimraf": "^5.0.0",
"rollup": "^3.9.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
},
"mocha": {
"loader": "ts-node/esm",
"spec": "./test/*.ts"
},
"gitHead": "fce2127ece65adbb293a40aa0577e4558658c559"
}

253
node_modules/@emmetio/scanner/scanner.cjs generated vendored Normal file
View file

@ -0,0 +1,253 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const defaultQuotedOptions = {
escape: 92,
throws: false
};
/**
* Check if given code is a number
*/
function isNumber(code) {
return code > 47 && code < 58;
}
/**
* Check if given character code is alpha code (letter through A to Z)
*/
function isAlpha(code, from, to) {
from = from || 65; // A
to = to || 90; // Z
code &= ~32; // quick hack to convert any char code to uppercase char code
return code >= from && code <= to;
}
/**
* Check if given character code is alpha-numeric (letter through A to Z or number)
*/
function isAlphaNumeric(code) {
return isNumber(code) || isAlpha(code);
}
function isAlphaNumericWord(code) {
return isNumber(code) || isAlphaWord(code);
}
function isAlphaWord(code) {
return code === 95 /* _ */ || isAlpha(code);
}
/**
* Check for Umlauts i.e. ä, Ä, ö, Ö, ü and Ü
*/
function isUmlaut(code) {
return code === 196
|| code == 214
|| code === 220
|| code === 228
|| code === 246
|| code === 252;
}
/**
* Check if given character code is a white-space character: a space character
* or line breaks
*/
function isWhiteSpace(code) {
return code === 32 /* space */
|| code === 9 /* tab */
|| code === 160; /* non-breaking space */
}
/**
* Check if given character code is a space character
*/
function isSpace(code) {
return isWhiteSpace(code)
|| code === 10 /* LF */
|| code === 13; /* CR */
}
/**
* Consumes 'single' or "double"-quoted string from given string, if possible
* @return `true` if quoted string was consumed. The contents of quoted string
* will be available as `stream.current()`
*/
function eatQuoted(stream, options) {
options = Object.assign(Object.assign({}, defaultQuotedOptions), options);
const start = stream.pos;
const quote = stream.peek();
if (stream.eat(isQuote)) {
while (!stream.eof()) {
switch (stream.next()) {
case quote:
stream.start = start;
return true;
case options.escape:
stream.next();
break;
}
}
// If were here then stream wasnt properly consumed.
// Revert stream and decide what to do
stream.pos = start;
if (options.throws) {
throw stream.error('Unable to consume quoted string');
}
}
return false;
}
/**
* Check if given character code is a quote character
*/
function isQuote(code) {
return code === 39 /* ' */ || code === 34 /* " */;
}
/**
* Eats paired characters substring, for example `(foo)` or `[bar]`
* @param open Character code of pair opening
* @param close Character code of pair closing
* @return Returns `true` if character pair was successfully consumed, its
* content will be available as `stream.current()`
*/
function eatPair(stream, open, close, options) {
options = Object.assign(Object.assign({}, defaultQuotedOptions), options);
const start = stream.pos;
if (stream.eat(open)) {
let stack = 1;
let ch;
while (!stream.eof()) {
if (eatQuoted(stream, options)) {
continue;
}
ch = stream.next();
if (ch === open) {
stack++;
}
else if (ch === close) {
stack--;
if (!stack) {
stream.start = start;
return true;
}
}
else if (ch === options.escape) {
stream.next();
}
}
// If were here then paired character cant be consumed
stream.pos = start;
if (options.throws) {
throw stream.error(`Unable to find matching pair for ${String.fromCharCode(open)}`);
}
}
return false;
}
/**
* A streaming, character code-based string reader
*/
class Scanner {
constructor(str, start, end) {
if (end == null && typeof str === 'string') {
end = str.length;
}
this.string = str;
this.pos = this.start = start || 0;
this.end = end || 0;
}
/**
* Returns true only if the stream is at the end of the file.
*/
eof() {
return this.pos >= this.end;
}
/**
* Creates a new stream instance which is limited to given `start` and `end`
* range. E.g. its `eof()` method will look at `end` property, not actual
* stream end
*/
limit(start, end) {
return new Scanner(this.string, start, end);
}
/**
* Returns the next character code in the stream without advancing it.
* Will return NaN at the end of the file.
*/
peek() {
return this.string.charCodeAt(this.pos);
}
/**
* Returns the next character in the stream and advances it.
* Also returns <code>undefined</code> when no more characters are available.
*/
next() {
if (this.pos < this.string.length) {
return this.string.charCodeAt(this.pos++);
}
}
/**
* `match` can be a character code or a function that takes a character code
* and returns a boolean. If the next character in the stream 'matches'
* the given argument, it is consumed and returned.
* Otherwise, `false` is returned.
*/
eat(match) {
const ch = this.peek();
const ok = typeof match === 'function' ? match(ch) : ch === match;
if (ok) {
this.next();
}
return ok;
}
/**
* Repeatedly calls <code>eat</code> with the given argument, until it
* fails. Returns <code>true</code> if any characters were eaten.
*/
eatWhile(match) {
const start = this.pos;
while (!this.eof() && this.eat(match)) { /* */ }
return this.pos !== start;
}
/**
* Backs up the stream n characters. Backing it up further than the
* start of the current token will cause things to break, so be careful.
*/
backUp(n) {
this.pos -= (n || 1);
}
/**
* Get the string between the start of the current token and the
* current stream position.
*/
current() {
return this.substring(this.start, this.pos);
}
/**
* Returns substring for given range
*/
substring(start, end) {
return this.string.slice(start, end);
}
/**
* Creates error object with current stream state
*/
error(message, pos = this.pos) {
return new ScannerError(`${message} at ${pos + 1}`, pos, this.string);
}
}
class ScannerError extends Error {
constructor(message, pos, str) {
super(message);
this.pos = pos;
this.string = str;
}
}
exports.ScannerError = ScannerError;
exports.default = Scanner;
exports.eatPair = eatPair;
exports.eatQuoted = eatQuoted;
exports.isAlpha = isAlpha;
exports.isAlphaNumeric = isAlphaNumeric;
exports.isAlphaNumericWord = isAlphaNumericWord;
exports.isAlphaWord = isAlphaWord;
exports.isNumber = isNumber;
exports.isQuote = isQuote;
exports.isSpace = isSpace;
exports.isUmlaut = isUmlaut;
exports.isWhiteSpace = isWhiteSpace;
//# sourceMappingURL=scanner.cjs.map

1
node_modules/@emmetio/scanner/scanner.cjs.map generated vendored Normal file

File diff suppressed because one or more lines are too long

71
node_modules/@emmetio/scanner/scanner.d.ts generated vendored Normal file
View file

@ -0,0 +1,71 @@
export * from './utils.js';
type MatchFn = (ch: number) => boolean;
/**
* A streaming, character code-based string reader
*/
export default class Scanner {
/** Current string */
string: string;
/** Current scanner position */
pos: number;
/** Lower range limit where string reader is available */
start: number;
/** Upper range limit where string reader is available */
end: number;
constructor(str: string, start?: number, end?: number);
/**
* Returns true only if the stream is at the end of the file.
*/
eof(): boolean;
/**
* Creates a new stream instance which is limited to given `start` and `end`
* range. E.g. its `eof()` method will look at `end` property, not actual
* stream end
*/
limit(start?: number, end?: number): Scanner;
/**
* Returns the next character code in the stream without advancing it.
* Will return NaN at the end of the file.
*/
peek(): number;
/**
* Returns the next character in the stream and advances it.
* Also returns <code>undefined</code> when no more characters are available.
*/
next(): number | undefined;
/**
* `match` can be a character code or a function that takes a character code
* and returns a boolean. If the next character in the stream 'matches'
* the given argument, it is consumed and returned.
* Otherwise, `false` is returned.
*/
eat(match: number | MatchFn): boolean;
/**
* Repeatedly calls <code>eat</code> with the given argument, until it
* fails. Returns <code>true</code> if any characters were eaten.
*/
eatWhile(match: number | MatchFn): boolean;
/**
* Backs up the stream n characters. Backing it up further than the
* start of the current token will cause things to break, so be careful.
*/
backUp(n: number): void;
/**
* Get the string between the start of the current token and the
* current stream position.
*/
current(): string;
/**
* Returns substring for given range
*/
substring(start: number, end?: number): string;
/**
* Creates error object with current stream state
*/
error(message: string, pos?: number): ScannerError;
}
export declare class ScannerError extends Error {
pos: number;
string: string;
constructor(message: string, pos: number, str: string);
}

237
node_modules/@emmetio/scanner/scanner.js generated vendored Normal file
View file

@ -0,0 +1,237 @@
const defaultQuotedOptions = {
escape: 92,
throws: false
};
/**
* Check if given code is a number
*/
function isNumber(code) {
return code > 47 && code < 58;
}
/**
* Check if given character code is alpha code (letter through A to Z)
*/
function isAlpha(code, from, to) {
from = from || 65; // A
to = to || 90; // Z
code &= ~32; // quick hack to convert any char code to uppercase char code
return code >= from && code <= to;
}
/**
* Check if given character code is alpha-numeric (letter through A to Z or number)
*/
function isAlphaNumeric(code) {
return isNumber(code) || isAlpha(code);
}
function isAlphaNumericWord(code) {
return isNumber(code) || isAlphaWord(code);
}
function isAlphaWord(code) {
return code === 95 /* _ */ || isAlpha(code);
}
/**
* Check for Umlauts i.e. ä, Ä, ö, Ö, ü and Ü
*/
function isUmlaut(code) {
return code === 196
|| code == 214
|| code === 220
|| code === 228
|| code === 246
|| code === 252;
}
/**
* Check if given character code is a white-space character: a space character
* or line breaks
*/
function isWhiteSpace(code) {
return code === 32 /* space */
|| code === 9 /* tab */
|| code === 160; /* non-breaking space */
}
/**
* Check if given character code is a space character
*/
function isSpace(code) {
return isWhiteSpace(code)
|| code === 10 /* LF */
|| code === 13; /* CR */
}
/**
* Consumes 'single' or "double"-quoted string from given string, if possible
* @return `true` if quoted string was consumed. The contents of quoted string
* will be available as `stream.current()`
*/
function eatQuoted(stream, options) {
options = Object.assign(Object.assign({}, defaultQuotedOptions), options);
const start = stream.pos;
const quote = stream.peek();
if (stream.eat(isQuote)) {
while (!stream.eof()) {
switch (stream.next()) {
case quote:
stream.start = start;
return true;
case options.escape:
stream.next();
break;
}
}
// If were here then stream wasnt properly consumed.
// Revert stream and decide what to do
stream.pos = start;
if (options.throws) {
throw stream.error('Unable to consume quoted string');
}
}
return false;
}
/**
* Check if given character code is a quote character
*/
function isQuote(code) {
return code === 39 /* ' */ || code === 34 /* " */;
}
/**
* Eats paired characters substring, for example `(foo)` or `[bar]`
* @param open Character code of pair opening
* @param close Character code of pair closing
* @return Returns `true` if character pair was successfully consumed, its
* content will be available as `stream.current()`
*/
function eatPair(stream, open, close, options) {
options = Object.assign(Object.assign({}, defaultQuotedOptions), options);
const start = stream.pos;
if (stream.eat(open)) {
let stack = 1;
let ch;
while (!stream.eof()) {
if (eatQuoted(stream, options)) {
continue;
}
ch = stream.next();
if (ch === open) {
stack++;
}
else if (ch === close) {
stack--;
if (!stack) {
stream.start = start;
return true;
}
}
else if (ch === options.escape) {
stream.next();
}
}
// If were here then paired character cant be consumed
stream.pos = start;
if (options.throws) {
throw stream.error(`Unable to find matching pair for ${String.fromCharCode(open)}`);
}
}
return false;
}
/**
* A streaming, character code-based string reader
*/
class Scanner {
constructor(str, start, end) {
if (end == null && typeof str === 'string') {
end = str.length;
}
this.string = str;
this.pos = this.start = start || 0;
this.end = end || 0;
}
/**
* Returns true only if the stream is at the end of the file.
*/
eof() {
return this.pos >= this.end;
}
/**
* Creates a new stream instance which is limited to given `start` and `end`
* range. E.g. its `eof()` method will look at `end` property, not actual
* stream end
*/
limit(start, end) {
return new Scanner(this.string, start, end);
}
/**
* Returns the next character code in the stream without advancing it.
* Will return NaN at the end of the file.
*/
peek() {
return this.string.charCodeAt(this.pos);
}
/**
* Returns the next character in the stream and advances it.
* Also returns <code>undefined</code> when no more characters are available.
*/
next() {
if (this.pos < this.string.length) {
return this.string.charCodeAt(this.pos++);
}
}
/**
* `match` can be a character code or a function that takes a character code
* and returns a boolean. If the next character in the stream 'matches'
* the given argument, it is consumed and returned.
* Otherwise, `false` is returned.
*/
eat(match) {
const ch = this.peek();
const ok = typeof match === 'function' ? match(ch) : ch === match;
if (ok) {
this.next();
}
return ok;
}
/**
* Repeatedly calls <code>eat</code> with the given argument, until it
* fails. Returns <code>true</code> if any characters were eaten.
*/
eatWhile(match) {
const start = this.pos;
while (!this.eof() && this.eat(match)) { /* */ }
return this.pos !== start;
}
/**
* Backs up the stream n characters. Backing it up further than the
* start of the current token will cause things to break, so be careful.
*/
backUp(n) {
this.pos -= (n || 1);
}
/**
* Get the string between the start of the current token and the
* current stream position.
*/
current() {
return this.substring(this.start, this.pos);
}
/**
* Returns substring for given range
*/
substring(start, end) {
return this.string.slice(start, end);
}
/**
* Creates error object with current stream state
*/
error(message, pos = this.pos) {
return new ScannerError(`${message} at ${pos + 1}`, pos, this.string);
}
}
class ScannerError extends Error {
constructor(message, pos, str) {
super(message);
this.pos = pos;
this.string = str;
}
}
export { ScannerError, Scanner as default, eatPair, eatQuoted, isAlpha, isAlphaNumeric, isAlphaNumericWord, isAlphaWord, isNumber, isQuote, isSpace, isUmlaut, isWhiteSpace };
//# sourceMappingURL=scanner.js.map

1
node_modules/@emmetio/scanner/scanner.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

53
node_modules/@emmetio/scanner/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,53 @@
import type Scanner from './scanner.js';
interface QuotedOptions {
/** A character code of quote-escape symbol */
escape?: number;
/** Throw error if quotes string cant be properly consumed */
throws?: boolean;
}
/**
* Check if given code is a number
*/
export declare function isNumber(code: number): boolean;
/**
* Check if given character code is alpha code (letter through A to Z)
*/
export declare function isAlpha(code: number, from?: number, to?: number): boolean;
/**
* Check if given character code is alpha-numeric (letter through A to Z or number)
*/
export declare function isAlphaNumeric(code: number): boolean;
export declare function isAlphaNumericWord(code: number): boolean;
export declare function isAlphaWord(code: number): boolean;
/**
* Check for Umlauts i.e. ä, Ä, ö, Ö, ü and Ü
*/
export declare function isUmlaut(code: number): boolean;
/**
* Check if given character code is a white-space character: a space character
* or line breaks
*/
export declare function isWhiteSpace(code: number): boolean;
/**
* Check if given character code is a space character
*/
export declare function isSpace(code: number): boolean;
/**
* Consumes 'single' or "double"-quoted string from given string, if possible
* @return `true` if quoted string was consumed. The contents of quoted string
* will be available as `stream.current()`
*/
export declare function eatQuoted(stream: Scanner, options?: QuotedOptions): boolean;
/**
* Check if given character code is a quote character
*/
export declare function isQuote(code: number): boolean;
/**
* Eats paired characters substring, for example `(foo)` or `[bar]`
* @param open Character code of pair opening
* @param close Character code of pair closing
* @return Returns `true` if character pair was successfully consumed, its
* content will be available as `stream.current()`
*/
export declare function eatPair(stream: Scanner, open: number, close: number, options?: QuotedOptions): boolean;
export {};