🎉 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

5
node_modules/suf-log/dist/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,5 @@
export { SetLoggerEnvironment as SetEnvironment, ANSICodes, removeNodeStyles } from './utils';
export { styler } from './styler';
export * from './loggers';
export * from './interfaces';
export * from './transformStyles';

21
node_modules/suf-log/dist/index.js generated vendored Normal file
View file

@ -0,0 +1,21 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./utils");
Object.defineProperty(exports, "SetEnvironment", { enumerable: true, get: function () { return utils_1.SetLoggerEnvironment; } });
Object.defineProperty(exports, "ANSICodes", { enumerable: true, get: function () { return utils_1.ANSICodes; } });
Object.defineProperty(exports, "removeNodeStyles", { enumerable: true, get: function () { return utils_1.removeNodeStyles; } });
var styler_1 = require("./styler");
Object.defineProperty(exports, "styler", { enumerable: true, get: function () { return styler_1.styler; } });
__exportStar(require("./loggers"), exports);
__exportStar(require("./interfaces"), exports);
__exportStar(require("./transformStyles"), exports);

33
node_modules/suf-log/dist/interfaces.d.ts generated vendored Normal file
View file

@ -0,0 +1,33 @@
/**
* color/background/font-weight work in node and the browser, the other properties only work in the browser.
*/
export declare type LogStyle = string | {
/**node and browser support */
background?: string;
/**node and browser support */
color?: string;
/**browser only */
padding?: string;
/**browser only */
margin?: string;
/**browser only, set to inline-block by default. */
display?: string;
/**browser only */
border?: string;
/**browser only */
'border-radius'?: string;
/**browser only */
'text-align'?: string;
/**browser only */
'text-shadow'?: string;
/**browser only */
'font-size'?: string;
/** for bold text in node add the value 'bold' */
'font-weight'?: 'bold' | 'normal' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
[key: string]: string | undefined;
};
export declare type LogMessage = {
message: string;
style?: LogStyle;
};
export declare type LogTableInput = (number | string | LogMessage)[][];

2
node_modules/suf-log/dist/interfaces.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

13
node_modules/suf-log/dist/loggers.d.ts generated vendored Normal file
View file

@ -0,0 +1,13 @@
import { LogMessage, LogStyle, LogTableInput } from './interfaces';
/**works in node and the browser.*/
export declare function Log(...messages: (string | LogMessage)[]): void;
export interface LogTableOptions {
padding?: number;
spacing?: number;
}
/**node only*/
export declare function LogTable(table: LogTableInput, options?: LogTableOptions): void;
/**works in the browser and node. */
export declare function LogS(styles: LogStyle[], ...messages: string[]): void;
/**Log a single message with an optional style, works in the browser and node. */
export declare function LogSingle(message: string, style?: LogStyle): void;

126
node_modules/suf-log/dist/loggers.js generated vendored Normal file
View file

@ -0,0 +1,126 @@
"use strict";
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogSingle = exports.LogS = exports.LogTable = exports.Log = void 0;
var utils_1 = require("./utils");
var _1 = require(".");
var transformStyles_1 = require("./transformStyles");
/**works in node and the browser.*/
function Log() {
var messages = [];
for (var _i = 0; _i < arguments.length; _i++) {
messages[_i] = arguments[_i];
}
var output = '';
var browserStyles = [];
for (var i = 0; i < messages.length; i++) {
var msg = messages[i];
if (typeof msg === 'object') {
if (utils_1.isBrowser) {
var style = transformStyles_1.transformToBrowserStyle(msg.style);
if (style)
browserStyles.push(style);
}
output += _1.styler(msg.message, msg.style);
}
else {
output += msg;
}
if (i < messages.length - 1) {
output += ' ';
}
}
console.log.apply(console, __spreadArrays([output], browserStyles));
}
exports.Log = Log;
/**node only*/
function LogTable(table, options) {
if (options === void 0) { options = utils_1.defaultLogTableOptions; }
if (table[0] === undefined)
return;
var _a = __assign(__assign({}, utils_1.defaultLogTableOptions), options), padding = _a.padding, spacing = _a.spacing;
var output = '';
var maxLengths = [];
for (var i = 0; i < table[0].length; i++) {
var column = utils_1.getColumn(table, i);
maxLengths.push(utils_1.maxTableColumnLength(column));
}
for (var i = 0; i < table.length; i++) {
var row = table[i];
for (var j = 0; j < row.length; j++) {
var field = row[j];
var text = '';
var style = void 0;
if (typeof field === 'object') {
style = field.style;
text = field.message;
}
else {
text = field.toString();
}
var startPadding = j === 0 ? padding : 0;
var endPadding = maxLengths[j] + (j === row.length - 1 ? padding : spacing);
var textLength = utils_1.removeNodeStyles(text).length;
var paddedText = utils_1.pad(text, startPadding, endPadding - textLength);
if (style) {
output += _1.styler(paddedText, style);
}
else {
output += paddedText;
}
}
output += '\n';
}
console.log(output.replace(/\n$/, ''));
}
exports.LogTable = LogTable;
/**works in the browser and node. */
function LogS(styles) {
var messages = [];
for (var _i = 1; _i < arguments.length; _i++) {
messages[_i - 1] = arguments[_i];
}
var browserStyles = [];
var output = '';
for (var i = 0; i < messages.length; i++) {
var msg = messages[i];
if (utils_1.isBrowser) {
var style = transformStyles_1.transformToBrowserStyle(styles[i]);
if (style)
browserStyles.push(style);
}
output += _1.styler(msg, styles[i]);
if (i < messages.length - 1) {
output += ' ';
}
}
console.log.apply(console, __spreadArrays([output], browserStyles));
}
exports.LogS = LogS;
/**Log a single message with an optional style, works in the browser and node. */
function LogSingle(message, style) {
var output = _1.styler(message, style);
if (utils_1.isBrowser) {
console.log(output, transformStyles_1.transformToBrowserStyle(style) || '');
return;
}
console.log(output);
}
exports.LogSingle = LogSingle;

10
node_modules/suf-log/dist/styler.d.ts generated vendored Normal file
View file

@ -0,0 +1,10 @@
import { LogStyle } from './interfaces';
/**
* this function is not browser compatible*.
* @example ```ts
* console.log(styler('test', 'red'))
* ```
*
* *you have to add the styles manually, use the Log function for browser compatibly.
*/
export declare function styler(input: string, style?: LogStyle): string;

23
node_modules/suf-log/dist/styler.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.styler = void 0;
var transformStyles_1 = require("./transformStyles");
var utils_1 = require("./utils");
/**
* this function is not browser compatible*.
* @example ```ts
* console.log(styler('test', 'red'))
* ```
*
* *you have to add the styles manually, use the Log function for browser compatibly.
*/
function styler(input, style) {
if (utils_1.isBrowser) {
return "%c" + input;
}
if (style) {
return utils_1.addReset("" + transformStyles_1.transformToNodeStyle(style) + input);
}
return input;
}
exports.styler = styler;

3
node_modules/suf-log/dist/transformStyles.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import { LogStyle } from './interfaces';
export declare function transformToNodeStyle(style: LogStyle): string;
export declare function transformToBrowserStyle(style?: LogStyle): string;

38
node_modules/suf-log/dist/transformStyles.js generated vendored Normal file
View file

@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformToBrowserStyle = exports.transformToNodeStyle = void 0;
var utils_1 = require("./utils");
function transformToNodeStyle(style) {
if (typeof style === 'string') {
return "\u001B[" + handleUndefined(utils_1.stringColorToAnsiColor('color', style)).replace(/;$/, '') + "m";
}
else {
var codes = "" + addBoldStyle(style) + handleUndefined(utils_1.stringColorToAnsiColor('color', style.color)) + handleUndefined(utils_1.stringColorToAnsiColor('background', style.background));
return "\u001B[" + codes.replace(/;$/, '') + "m";
}
}
exports.transformToNodeStyle = transformToNodeStyle;
function addBoldStyle(style) {
return style['font-weight'] === 'bold' ? utils_1.ANSICodes('bold') + ";" : '';
}
function handleUndefined(input) {
return input ? input : '';
}
function transformToBrowserStyle(style) {
if (style == undefined)
return '';
if (typeof style === 'string') {
return "color: " + style + ";";
}
var out = '';
if (!('display' in style)) {
out += "display: inline-block; ";
}
for (var key in style) {
if (Object.prototype.hasOwnProperty.call(style, key)) {
out += key + ": " + style[key] + "; ";
}
}
return out;
}
exports.transformToBrowserStyle = transformToBrowserStyle;

17
node_modules/suf-log/dist/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
import { LogTableInput } from './interfaces';
export declare let isBrowser: boolean;
export declare const defaultLogTableOptions: {
padding: number;
spacing: number;
};
/**
* Can be used to change the assumed environment
*/
export declare function SetLoggerEnvironment(env: 'node' | 'browser'): void;
export declare function stringColorToAnsiColor(type: 'background' | 'color', color?: string): string | undefined;
export declare function ANSICodes(type: 'background' | 'color' | 'bold' | 'reset'): "0" | "1" | "38" | "48";
export declare function maxTableColumnLength(column: LogTableInput[0]): number;
export declare function removeNodeStyles(item: string | number): string;
export declare function pad(text: string, start: number, end: number): string;
export declare function getColumn(matrix: LogTableInput, col: number): (string | number | import("./interfaces").LogMessage)[];
export declare function addReset(input: number | string): string;

63
node_modules/suf-log/dist/utils.js generated vendored Normal file
View file

@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addReset = exports.getColumn = exports.pad = exports.removeNodeStyles = exports.maxTableColumnLength = exports.ANSICodes = exports.stringColorToAnsiColor = exports.SetLoggerEnvironment = exports.defaultLogTableOptions = exports.isBrowser = void 0;
var s_color_1 = require("s.color");
exports.isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';
exports.defaultLogTableOptions = { padding: 0, spacing: 1 };
/**
* Can be used to change the assumed environment
*/
function SetLoggerEnvironment(env) {
exports.isBrowser = env === 'browser';
}
exports.SetLoggerEnvironment = SetLoggerEnvironment;
function stringColorToAnsiColor(type, color) {
if (!color) {
return undefined;
}
var _a = s_color_1.StringToRGB(color, true), r = _a.r, g = _a.g, b = _a.b;
return ANSICodes(type) + ";2;" + r + ";" + g + ";" + b + ";";
}
exports.stringColorToAnsiColor = stringColorToAnsiColor;
function ANSICodes(type) {
switch (type) {
case 'reset':
return '0';
case 'bold':
return '1';
case 'color':
return '38';
case 'background':
return '48';
}
}
exports.ANSICodes = ANSICodes;
function maxTableColumnLength(column) {
var max = 0;
for (var i = 0; i < column.length; i++) {
var field = column[i];
if (field) {
var length_1 = removeNodeStyles(typeof field === 'object' ? field.message : field).length;
max = length_1 > max ? length_1 : max;
}
}
return max;
}
exports.maxTableColumnLength = maxTableColumnLength;
function removeNodeStyles(item) {
return item.toString().replace(/[\033\x1b\u001b]\[.*?m/g, '');
}
exports.removeNodeStyles = removeNodeStyles;
function pad(text, start, end) {
var space = function (amount) { return ' '.repeat(amount); };
return "" + space(start) + text + space(end);
}
exports.pad = pad;
function getColumn(matrix, col) {
return matrix.map(function (row) { return row[col]; });
}
exports.getColumn = getColumn;
function addReset(input) {
return input + "\u001B[0m";
}
exports.addReset = addReset;