fix: flatten log-tail/ files into monorepo (no sub-repo)

This commit is contained in:
2026-02-08 02:15:25 -05:00
parent e2bf6c57d1
commit 80d742d2e9
8183 changed files with 1550894 additions and 1 deletions
+100
View File
@@ -0,0 +1,100 @@
/**
* A function that applies styles, typically one of the chalk builder functions
*/
export type StyleFn = (s: string) => string;
/**
* Either one {@link StyleFn} or several
*/
export type Styles = StyleFn | StyleFn[];
/**
* Theme objects can be either a Map or object where the keys are the selectors
* and the values are either a styling function or an array of styling
* functions to be applied in order.
*
* The `_` style rule applies to the block as a whole, and is used
* as the default style. This is where you'd usually port a PrismJS
* theme's `code[class*="language-"]` css rule.
*
* The `lineNumber` style rule will apply to line numbers, if they
* are used.
*
* The semantics are similar to CSS, where a nested property will be
* applied to nodes within that nesting stack with a higher
* priority the more tags that match, and later rules taking
* precedence over earlier ones. It's _not_ a full CSS selector
* syntax though, so things like `.token.italic.bold` aren't
* supported. Just individual token class names, possibly nested.
* Also, chalk is not CSS, and a terminal is not a browser, so
* there are some differences and limitations of course.
*
* Aliases are also not supported, styles have to be applied to the
* actual parsed class names PrismJS provides.
*/
export type Theme = Record<string, Styles> | Map<string, Styles>;
/**
* Options for the highlighting functions
*/
export interface PrismJSTerminalOpts {
/**
* The theme to use. Either a {@link Theme} object, or a
* string identifying one of the built-in themes.
*
* @default 'moria'
*/
theme?: keyof typeof themes | Theme;
/**
* The language of the supplied code to highlight. Defaults to `tsx` if no
* filename is provided, or else tries to infer the language from the
* filename. You must have previously called `loadLanguages([...])` from
* `PrismJS` in order to highlight a given language, if you want something
* that is not automatically included when `tsx` and `typescript` are
* included.
*
* @default 'tsx'
*/
language?: string;
/**
* The minimum width to make the block on the screen.
*
* @default 0
*/
minWidth?: number;
/**
* The maximum width to make the block on the screen.
*
* @default `process.stdout.columns` or `80`.
*/
maxWidth?: number;
/**
* How many spaces to horizontally pad the code block.
*
* @default 1
*/
padding?: number;
/**
* Whether or not to prepend a line number to each line.
*
* @default false
*/
lineNumbers?: boolean;
}
/**
* Highlight the string of code provided, returning the string of highlighted
* code.
*/
export declare const highlight: (code: string, { language, theme, minWidth, maxWidth, padding, lineNumbers, }?: PrismJSTerminalOpts) => string;
/**
* Read the filename provided, and highlight its code. If a language is not
* provided in the opts, it will attempt to infer from the filename.
*/
export declare const highlightFile: (filename: string, opts?: PrismJSTerminalOpts) => Promise<string>;
/**
* Read the filename provided, and highlight its code. If a language is not
* provided in the opts, it will attempt to infer from the filename.
*
* Synchronous {@link highlightFile}
*/
export declare const highlightFileSync: (filename: string, opts?: PrismJSTerminalOpts) => string;
import * as themes from './themes/index.js';
export { themes };
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAmFhE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,MAAM,GAAG,KAAK,CAAA;IAEnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AA6CD;;;GAGG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,MAAM,EACZ,iEAOG,mBAAwB,KAC1B,MAWF,CAAA;AAwBD;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,MAAM,EAChB,OAAM,mBAAwB,KAC7B,OAAO,CAAC,MAAM,CAGhB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,EAChB,OAAM,mBAAwB,KAC7B,MAGF,CAAA;AA2DD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,CAAA"}
+232
View File
@@ -0,0 +1,232 @@
"use strict";
// TODO: start stack with [`language-${lang}`]
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.themes = exports.highlightFileSync = exports.highlightFile = exports.highlight = void 0;
const chalk_1 = __importDefault(require("chalk"));
const fs_1 = require("fs");
const promises_1 = require("fs/promises");
const path_1 = require("path");
const prismjs_1 = __importDefault(require("prismjs"));
const string_length_1 = __importDefault(require("string-length"));
// primary use is to highlight ts/js programs, call
// loadLanguages() to support others.
const index_js_1 = __importDefault(require("prismjs/components/index.js"));
(0, index_js_1.default)(['tsx', 'typescript', 'javascript', 'jsx']);
const parseSelector = (s) => {
const parsed = [];
const selectors = s.split(',').map(s => s.trim());
for (const s of selectors) {
parsed.push(s.split(/\s+/));
}
return parsed;
};
const arraysEq = (a, b) => a.length === b.length && !a.some((aa, i) => aa !== b[i]);
const stackMatch = (
// the stack defined in the rule
ruleStack,
// the actual stack
stack) => {
if (!ruleStack.length)
return true;
let j = 0;
for (const t of ruleStack) {
if (t === stack[j]) {
j++;
if (j === ruleStack.length)
return true;
}
}
return false;
};
const filterRule = (stack, rule) => rule.filter(([ruleStack]) => stackMatch(ruleStack, stack));
// return style functions sorted in *ascending* order of priority
const getStyles = (stack, rule) => {
const f = filterRule(stack, rule)
.sort(([a], [b]) => a.length - b.length)
.map(([_, r]) => r);
return f.reduce((s, r) => {
s.push(...r);
return s;
}, []);
};
const applyStyles = (content, tag, stack, t) => {
const rule = t.get(tag);
if (!rule)
return content;
const styles = getStyles(stack, rule);
for (const style of styles) {
content = style(content);
}
return content;
};
const trimTrailingCR = (c) => c.endsWith('\n') ? c.substring(0, c.length - 1) : c;
const blockStyle = (code, c, { minWidth = 0, maxWidth = process.stdout.columns || 80, padding = 1, lineNumbers = false, }) => {
const lines = trimTrailingCR(code).split('\n');
const lens = [];
let max = minWidth;
const npad = lineNumbers ? String(lines.length).length : 0;
const tpad = npad + padding * 2;
for (const l of lines) {
const len = (0, string_length_1.default)(l);
lens.push(len);
if (len < maxWidth - tpad && len > max)
max = len;
}
for (let i = 0; i < lens.length; i++) {
const len = Number(lens[i]);
const pad = max - len + padding;
const r = pad > 0 ? ' '.repeat(pad) : '';
const l = ' '.repeat(padding) +
(lineNumbers
? applyStyles(String(i + 1).padStart(npad) + ' ', 'lineNumber', [], c)
: '');
lines[i] = l + lines[i] + r;
}
code = lines.join('\n') + '\n';
return applyStyles(code, '_', [], c);
};
/**
* Highlight the string of code provided, returning the string of highlighted
* code.
*/
const highlight = (code, { language = 'tsx', theme = 'moria', minWidth, maxWidth, padding, lineNumbers, } = {}) => {
const t = typeof theme === 'string' ? themes[theme] : theme;
if (!t) {
throw new Error('invalid theme: ' + theme);
}
const c = compileTheme(t);
return blockStyle(stringify(prismjs_1.default.tokenize(code, prismjs_1.default.languages[language]), c), c, { minWidth, maxWidth, padding, lineNumbers });
};
exports.highlight = highlight;
const detectLanguage = (filename) => {
const { ext } = (0, path_1.parse)(filename);
switch (ext) {
case '.ts':
case '.mts':
case '.cts':
return 'typescript';
case '.js':
case '.cjs':
case '.mjs':
return 'javascript';
case '.htm':
return 'html';
case '':
case '.':
throw new Error('could not detect language for file: ' + filename);
default:
// cross our fingers, I guess
return ext.substring(1);
}
};
/**
* Read the filename provided, and highlight its code. If a language is not
* provided in the opts, it will attempt to infer from the filename.
*/
const highlightFile = async (filename, opts = {}) => {
if (!opts.language)
opts.language = detectLanguage(filename);
return (0, exports.highlight)(await (0, promises_1.readFile)(filename, 'utf8'), opts);
};
exports.highlightFile = highlightFile;
/**
* Read the filename provided, and highlight its code. If a language is not
* provided in the opts, it will attempt to infer from the filename.
*
* Synchronous {@link highlightFile}
*/
const highlightFileSync = (filename, opts = {}) => {
if (!opts.language)
opts.language = detectLanguage(filename);
return (0, exports.highlight)((0, fs_1.readFileSync)(filename, 'utf8'), opts);
};
exports.highlightFileSync = highlightFileSync;
const stringify = (tok, theme, stack = []) => {
if (typeof tok === 'string')
return tok;
if (Array.isArray(tok)) {
return tok.map(t => stringify(t, theme, stack)).join('');
}
else {
return applyStyles(stringify(tok.content, theme, [...stack, tok.type]), tok.type, stack, theme);
}
};
const compiledThemes = new Map();
const compileTheme = (t) => {
const pre = compiledThemes.get(t);
if (pre)
return pre;
if (!(t instanceof Map)) {
const c = compileTheme(new Map(Object.entries(t)));
compiledThemes.set(t, c);
return c;
}
const c = new Map();
for (const [s, tr] of t.entries()) {
const selectors = parseSelector(s);
for (const sel of selectors) {
// sel is a stack, so `x y z` becomes `['x', 'y', 'z']`
// add the stack with the rule to the last item,
// so we add [['x', 'y'], tr] to 'z'
const last = sel[sel.length - 1];
sel.pop();
const cr = c.get(last) || [];
let pushed = false;
for (const [stack, rules] of cr) {
if (arraysEq(sel, stack)) {
rules.push(...(Array.isArray(tr) ? tr : [tr]));
pushed = true;
break;
}
}
if (!pushed)
cr.push([sel, Array.isArray(tr) ? tr : [tr]]);
if (!c.has(last))
c.set(last, cr);
}
}
const def = c.get('_');
if (!def)
c.set('_', [[[], [chalk_1.default.reset]]]);
compiledThemes.set(t, c);
return c;
};
const themes = __importStar(require("./themes/index.js"));
exports.themes = themes;
//# sourceMappingURL=index.js.map
File diff suppressed because one or more lines are too long
+3
View File
@@ -0,0 +1,3 @@
{
"type": "commonjs"
}
@@ -0,0 +1,8 @@
import { Theme } from '../index.js';
/**
* This theme just shows which token names are in use The list of tokens is
* everything defined in the tsx PrismJS language grammar, since that is a
* superset of JavaScript, TS, JSX, and HTML.
*/
export declare const theme: Theme;
//# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/themes/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAE,KAkJnB,CAAA"}
+159
View File
@@ -0,0 +1,159 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.theme = void 0;
/**
* This theme just shows which token names are in use The list of tokens is
* everything defined in the tsx PrismJS language grammar, since that is a
* superset of JavaScript, TS, JSX, and HTML.
*/
exports.theme = new Map(`
boolean
builtin
cdata
class-name
class-name boolean
class-name builtin
class-name comment
class-name constant
class-name function
class-name function-variable
class-name hashbang
class-name keyword
class-name number
class-name operator
class-name punctuation
class-name regex
class-name regex regex-delimiter
class-name regex regex-flags
class-name regex regex-source
class-name string
class-name string-property
class-name template-string
class-name template-string interpolation
class-name template-string interpolation interpolation-punctuation
class-name template-string interpolation rest
class-name template-string template-punctuation
comment
constant
decorator
decorator at
decorator function
doctype
doctype doctype-tag
doctype internal-subset
doctype name
doctype punctuation
doctype string
entity
function
function-variable
generic-function
generic-function function
generic-function generic
hashbang
keyword
number
operator
prolog
punctuation
regex
regex regex-delimiter
regex regex-flags
regex regex-source
script
script included-cdata
script included-cdata cdata
script included-cdata language-javascript
script included-cdata language-javascript class-name
script included-cdata language-javascript comment
script included-cdata language-javascript function-variable
script included-cdata language-javascript hashbang
script included-cdata language-javascript keyword
script included-cdata language-javascript literal-property
script included-cdata language-javascript number
script included-cdata language-javascript parameter
script included-cdata language-javascript regex
script included-cdata language-javascript string
script included-cdata language-javascript string-property
script included-cdata language-javascript template-string
script language-javascript
script language-javascript class-name
script language-javascript comment
script language-javascript function-variable
script language-javascript hashbang
script language-javascript keyword
script language-javascript literal-property
script language-javascript number
script language-javascript parameter
script language-javascript regex
script language-javascript regex regex-source
script language-javascript string
script language-javascript string-property
script language-javascript template-string
script language-javascript template-string interpolation
script language-javascript template-string interpolation interpolation-punctuation
script language-javascript template-string interpolation rest
script language-javascript template-string template-punctuation
string
string-property
style
style included-cdata
style included-cdata cdata
style included-cdata language-css
style included-cdata language-css atrule
style included-cdata language-css comment
style included-cdata language-css function
style included-cdata language-css important
style included-cdata language-css property
style included-cdata language-css punctuation
style included-cdata language-css selector
style included-cdata language-css string
style included-cdata language-css url
style language-css
style language-css atrule
style language-css atrule keyword
style language-css atrule rest
style language-css atrule rule
style language-css atrule selector-function-argument
style language-css comment
style language-css function
style language-css important
style language-css property
style language-css punctuation
style language-css selector
style language-css string
style language-css url
style language-css url function
style language-css url punctuation
style language-css url string
tag
tag attr-name
tag attr-name namespace
tag attr-value
tag attr-value punctuation
tag comment
tag punctuation
tag script
tag script rest
tag script script-punctuation
tag special-attr
tag spread
tag tag
tag tag class-name
tag tag namespace
tag tag punctuation
template-string
template-string interpolation
template-string interpolation interpolation-punctuation
template-string string
template-string template-punctuation
`
.trim()
.split('\n')
.map(name => [name, (s) => `<${name}>${s}</${name}>`]));
// add another match just to have a dupe rule that becomes an array
exports.theme.set('a c d e f, f', [s => s]);
exports.theme.set('a b c d e, a c d e f, f', [s => s]);
exports.theme.set('a b c d e, a c d e f, f, g', [s => s]);
exports.theme.set('a b c d e, a c d e f, f, g, h', s => s);
//# sourceMappingURL=debug.js.map
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
import type { Theme } from '../index.js';
/**
* Port of GHColors prismjs theme.
* <https://github.com/PrismJS/prism-themes/blob/057c2a4430d78268528e65ba92860703c9cb56d8/themes/prism-ghcolors.css>
*/
export declare const theme: Theme;
//# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../src/themes/github.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAenB,CAAA"}
+26
View File
@@ -0,0 +1,26 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.theme = void 0;
const chalk_1 = __importDefault(require("chalk"));
/**
* Port of GHColors prismjs theme.
* <https://github.com/PrismJS/prism-themes/blob/057c2a4430d78268528e65ba92860703c9cb56d8/themes/prism-ghcolors.css>
*/
exports.theme = {
_: chalk_1.default.hex('#393A34').bgHex('#fff'),
lineNumber: chalk_1.default.dim,
'comment, prolog, doctype, cdata': chalk_1.default.hex('#999988').italic,
namespace: chalk_1.default.dim,
'string, attr-value': chalk_1.default.hex('#e3116c'),
'punctuation, operator': chalk_1.default.hex('#393A34'),
'entity, url, symbol, number, boolean, variable, constant, property, regex, inserted': chalk_1.default.hex('#36acaa'),
'atrule, keyword, attr-name, language-autohotkey selector': chalk_1.default.hex('#00a4db'),
'function,deleted,language-autohotkey tag': chalk_1.default.hex('#9a050f'),
'tag, selector,language-autohotkey keyword': chalk_1.default.hex('#00009f'),
'important, function, bold': chalk_1.default.bold,
italic: chalk_1.default.italic,
};
//# sourceMappingURL=github.js.map
@@ -0,0 +1 @@
{"version":3,"file":"github.js","sourceRoot":"","sources":["../../../src/themes/github.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAGzB;;;GAGG;AACU,QAAA,KAAK,GAAU;IAC1B,CAAC,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,eAAK,CAAC,GAAG;IACrB,iCAAiC,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM;IAC9D,SAAS,EAAE,eAAK,CAAC,GAAG;IACpB,oBAAoB,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IAC1C,uBAAuB,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IAC7C,qFAAqF,EACnF,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACtB,0DAA0D,EACxD,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACtB,0CAA0C,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IAChE,2CAA2C,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACjE,2BAA2B,EAAE,eAAK,CAAC,IAAI;IACvC,MAAM,EAAE,eAAK,CAAC,MAAM;CACrB,CAAA","sourcesContent":["import chalk from 'chalk'\nimport type { Theme } from '../index.js'\n\n/**\n * Port of GHColors prismjs theme.\n * <https://github.com/PrismJS/prism-themes/blob/057c2a4430d78268528e65ba92860703c9cb56d8/themes/prism-ghcolors.css>\n */\nexport const theme: Theme = {\n _: chalk.hex('#393A34').bgHex('#fff'),\n lineNumber: chalk.dim,\n 'comment, prolog, doctype, cdata': chalk.hex('#999988').italic,\n namespace: chalk.dim,\n 'string, attr-value': chalk.hex('#e3116c'),\n 'punctuation, operator': chalk.hex('#393A34'),\n 'entity, url, symbol, number, boolean, variable, constant, property, regex, inserted':\n chalk.hex('#36acaa'),\n 'atrule, keyword, attr-name, language-autohotkey selector':\n chalk.hex('#00a4db'),\n 'function,deleted,language-autohotkey tag': chalk.hex('#9a050f'),\n 'tag, selector,language-autohotkey keyword': chalk.hex('#00009f'),\n 'important, function, bold': chalk.bold,\n italic: chalk.italic,\n}\n"]}
+39
View File
@@ -0,0 +1,39 @@
/**
* Port of the `xonokai` PrismJS theme.
*/
export { theme as xonokai } from './xonokai.js';
/**
* This theme just shows which token names are in use The list of tokens is
* everything defined in the tsx PrismJS language grammar, since that is a
* superset of JavaScript, TS, JSX, and HTML.
*/
export { theme as debug } from './debug.js';
/**
* Inspired by vim Moria theme
* https://github.com/vim-scripts/moria
*
* It's not *quite* as faithful as I'd like (and I *would* like, since it's the
* color scheme I personally use in Vim, and so most natural for me), because
* Vim and PrismJS make slightly different choices about how they label program
* tokens.
*/
export { theme as moria } from './moria.js';
/**
* Port of GHColors prismjs theme.
* <https://github.com/PrismJS/prism-themes/blob/057c2a4430d78268528e65ba92860703c9cb56d8/themes/prism-ghcolors.css>
*/
export { theme as github } from './github.js';
/**
* Port of the `prism-dark` PrismJS theme.
* <https://github.com/PrismJS/prism/blob/867804573562ef0ac5acf470420b97e43488ccde/themes/prism-dark.css>
*
* Slightly tweaked a few colors so that they are a bit more readable on a
* terminal, some terminals have rendering issues when contrast is too low.
*/
export { theme as prismDark } from './prism-dark.js';
/**
* No styling, just the code as plain text.
* Will add line numbers and padding if requested, of course.
*/
export { theme as plain } from './plain.js';
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/themes/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;GAIG;AACH,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAE3C;;;;;;;;GAQG;AACH,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA;AAE3C;;;GAGG;AACH,OAAO,EAAE,KAAK,IAAI,MAAM,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;GAGG;AACH,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,YAAY,CAAA"}
+48
View File
@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.plain = exports.prismDark = exports.github = exports.moria = exports.debug = exports.xonokai = void 0;
/**
* Port of the `xonokai` PrismJS theme.
*/
var xonokai_js_1 = require("./xonokai.js");
Object.defineProperty(exports, "xonokai", { enumerable: true, get: function () { return xonokai_js_1.theme; } });
/**
* This theme just shows which token names are in use The list of tokens is
* everything defined in the tsx PrismJS language grammar, since that is a
* superset of JavaScript, TS, JSX, and HTML.
*/
var debug_js_1 = require("./debug.js");
Object.defineProperty(exports, "debug", { enumerable: true, get: function () { return debug_js_1.theme; } });
/**
* Inspired by vim Moria theme
* https://github.com/vim-scripts/moria
*
* It's not *quite* as faithful as I'd like (and I *would* like, since it's the
* color scheme I personally use in Vim, and so most natural for me), because
* Vim and PrismJS make slightly different choices about how they label program
* tokens.
*/
var moria_js_1 = require("./moria.js");
Object.defineProperty(exports, "moria", { enumerable: true, get: function () { return moria_js_1.theme; } });
/**
* Port of GHColors prismjs theme.
* <https://github.com/PrismJS/prism-themes/blob/057c2a4430d78268528e65ba92860703c9cb56d8/themes/prism-ghcolors.css>
*/
var github_js_1 = require("./github.js");
Object.defineProperty(exports, "github", { enumerable: true, get: function () { return github_js_1.theme; } });
/**
* Port of the `prism-dark` PrismJS theme.
* <https://github.com/PrismJS/prism/blob/867804573562ef0ac5acf470420b97e43488ccde/themes/prism-dark.css>
*
* Slightly tweaked a few colors so that they are a bit more readable on a
* terminal, some terminals have rendering issues when contrast is too low.
*/
var prism_dark_js_1 = require("./prism-dark.js");
Object.defineProperty(exports, "prismDark", { enumerable: true, get: function () { return prism_dark_js_1.theme; } });
/**
* No styling, just the code as plain text.
* Will add line numbers and padding if requested, of course.
*/
var plain_js_1 = require("./plain.js");
Object.defineProperty(exports, "plain", { enumerable: true, get: function () { return plain_js_1.theme; } });
//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/themes/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,2CAA+C;AAAtC,qGAAA,KAAK,OAAW;AAEzB;;;;GAIG;AACH,uCAA2C;AAAlC,iGAAA,KAAK,OAAS;AAEvB;;;;;;;;GAQG;AACH,uCAA2C;AAAlC,iGAAA,KAAK,OAAS;AAEvB;;;GAGG;AACH,yCAA6C;AAApC,mGAAA,KAAK,OAAU;AAExB;;;;;;GAMG;AACH,iDAAoD;AAA3C,0GAAA,KAAK,OAAa;AAE3B;;;GAGG;AACH,uCAA2C;AAAlC,iGAAA,KAAK,OAAS","sourcesContent":["/**\n * Port of the `xonokai` PrismJS theme.\n */\nexport { theme as xonokai } from './xonokai.js'\n\n/**\n * This theme just shows which token names are in use The list of tokens is\n * everything defined in the tsx PrismJS language grammar, since that is a\n * superset of JavaScript, TS, JSX, and HTML.\n */\nexport { theme as debug } from './debug.js'\n\n/**\n * Inspired by vim Moria theme\n * https://github.com/vim-scripts/moria\n *\n * It's not *quite* as faithful as I'd like (and I *would* like, since it's the\n * color scheme I personally use in Vim, and so most natural for me), because\n * Vim and PrismJS make slightly different choices about how they label program\n * tokens.\n */\nexport { theme as moria } from './moria.js'\n\n/**\n * Port of GHColors prismjs theme.\n * <https://github.com/PrismJS/prism-themes/blob/057c2a4430d78268528e65ba92860703c9cb56d8/themes/prism-ghcolors.css>\n */\nexport { theme as github } from './github.js'\n\n/**\n * Port of the `prism-dark` PrismJS theme.\n * <https://github.com/PrismJS/prism/blob/867804573562ef0ac5acf470420b97e43488ccde/themes/prism-dark.css>\n *\n * Slightly tweaked a few colors so that they are a bit more readable on a\n * terminal, some terminals have rendering issues when contrast is too low.\n */\nexport { theme as prismDark } from './prism-dark.js'\n\n/**\n * No styling, just the code as plain text.\n * Will add line numbers and padding if requested, of course.\n */\nexport { theme as plain } from './plain.js'\n"]}
+12
View File
@@ -0,0 +1,12 @@
import { Theme } from '../index.js';
/**
* Inspired by vim Moria theme
* https://github.com/vim-scripts/moria
*
* It's not *quite* as faithful as I'd like (and I *would* like, since it's
* the color scheme I personally use in Vim, and so most natural for me),
* because Vim and PrismJS make slightly different choices about how they
* label program tokens.
*/
export declare const theme: Theme;
//# sourceMappingURL=moria.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"moria.d.ts","sourceRoot":"","sources":["../../../src/themes/moria.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;;;;;;;GAQG;AACH,eAAO,MAAM,KAAK,EAAE,KAanB,CAAA"}
+30
View File
@@ -0,0 +1,30 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.theme = void 0;
const chalk_1 = __importDefault(require("chalk"));
/**
* Inspired by vim Moria theme
* https://github.com/vim-scripts/moria
*
* It's not *quite* as faithful as I'd like (and I *would* like, since it's
* the color scheme I personally use in Vim, and so most natural for me),
* because Vim and PrismJS make slightly different choices about how they
* label program tokens.
*/
exports.theme = {
_: chalk_1.default.ansi256(252).bgAnsi256(234),
lineNumber: chalk_1.default.hex('#8fa5d1'),
punctuation: chalk_1.default.hex('#93CDFF'),
'prolog, doctype, cdata': chalk_1.default.dim.bold,
'interpolation rest': chalk_1.default.ansi256(252).bgAnsi256(234),
'entity, url, symbol, boolean, number, regex, string, attr-name, template-string': chalk_1.default.ansi256(113).bgAnsi256(234),
'template-string interpolation': chalk_1.default.ansi256(252).bgAnsi256(234),
'template-string interpolation-punctuation': chalk_1.default.hex('#d7af87'),
'builtin, variable': chalk_1.default.hex('#F67C4F'),
comment: chalk_1.default.hex('#d75fff').bgAnsi256(234).italic,
'keyword, string-property': chalk_1.default.hex('#79c0ff'),
};
//# sourceMappingURL=moria.js.map
@@ -0,0 +1 @@
{"version":3,"file":"moria.js","sourceRoot":"","sources":["../../../src/themes/moria.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAGzB;;;;;;;;GAQG;AACU,QAAA,KAAK,GAAU;IAC1B,CAAC,EAAE,eAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;IACpC,UAAU,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IAChC,WAAW,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACjC,wBAAwB,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI;IACxC,oBAAoB,EAAE,eAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;IACvD,iFAAiF,EAC/E,eAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;IACnC,+BAA+B,EAAE,eAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC;IAClE,2CAA2C,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACjE,mBAAmB,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACzC,OAAO,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM;IACnD,0BAA0B,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;CACjD,CAAA","sourcesContent":["import chalk from 'chalk'\nimport { Theme } from '../index.js'\n\n/**\n * Inspired by vim Moria theme\n * https://github.com/vim-scripts/moria\n *\n * It's not *quite* as faithful as I'd like (and I *would* like, since it's\n * the color scheme I personally use in Vim, and so most natural for me),\n * because Vim and PrismJS make slightly different choices about how they\n * label program tokens.\n */\nexport const theme: Theme = {\n _: chalk.ansi256(252).bgAnsi256(234),\n lineNumber: chalk.hex('#8fa5d1'),\n punctuation: chalk.hex('#93CDFF'),\n 'prolog, doctype, cdata': chalk.dim.bold,\n 'interpolation rest': chalk.ansi256(252).bgAnsi256(234),\n 'entity, url, symbol, boolean, number, regex, string, attr-name, template-string':\n chalk.ansi256(113).bgAnsi256(234),\n 'template-string interpolation': chalk.ansi256(252).bgAnsi256(234),\n 'template-string interpolation-punctuation': chalk.hex('#d7af87'),\n 'builtin, variable': chalk.hex('#F67C4F'),\n comment: chalk.hex('#d75fff').bgAnsi256(234).italic,\n 'keyword, string-property': chalk.hex('#79c0ff'),\n}\n"]}
@@ -0,0 +1,7 @@
/**
* No styling, just the code as plain text.
* Will add line numbers and padding if requested, of course.
*/
import { Theme } from '../index.js';
export declare const theme: Theme;
//# sourceMappingURL=plain.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"plain.d.ts","sourceRoot":"","sources":["../../../src/themes/plain.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,eAAO,MAAM,KAAK,EAAE,KAAqB,CAAA"}
+5
View File
@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.theme = void 0;
exports.theme = { _: s => s };
//# sourceMappingURL=plain.js.map
@@ -0,0 +1 @@
{"version":3,"file":"plain.js","sourceRoot":"","sources":["../../../src/themes/plain.ts"],"names":[],"mappings":";;;AAKa,QAAA,KAAK,GAAU,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAA","sourcesContent":["/**\n * No styling, just the code as plain text.\n * Will add line numbers and padding if requested, of course.\n */\nimport { Theme } from '../index.js'\nexport const theme: Theme = { _: s => s }\n"]}
@@ -0,0 +1,10 @@
import type { Theme } from '../index.js';
/**
* Port of the `prism-dark` PrismJS theme.
* <https://github.com/PrismJS/prism/blob/867804573562ef0ac5acf470420b97e43488ccde/themes/prism-dark.css>
*
* Slightly tweaked a few colors so that they are a bit more readable on a
* terminal, some terminals have rendering issues when contrast is too low.
*/
export declare const theme: Theme;
//# sourceMappingURL=prism-dark.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"prism-dark.d.ts","sourceRoot":"","sources":["../../../src/themes/prism-dark.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAAE,KAcnB,CAAA"}
@@ -0,0 +1,29 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.theme = void 0;
const chalk_1 = __importDefault(require("chalk"));
/**
* Port of the `prism-dark` PrismJS theme.
* <https://github.com/PrismJS/prism/blob/867804573562ef0ac5acf470420b97e43488ccde/themes/prism-dark.css>
*
* Slightly tweaked a few colors so that they are a bit more readable on a
* terminal, some terminals have rendering issues when contrast is too low.
*/
exports.theme = {
_: chalk_1.default.white.bgHex('#231E19'),
lineNumber: chalk_1.default.dim,
'comment, prolog, doctype, cdata': chalk_1.default.hex('#997F66'),
'punctuation, namespace': chalk_1.default.dim,
'property,tag,boolean,number,constant,symbol': chalk_1.default.hex('#9E93D1'),
'selector,attr-name,string,char,builtin,inserted': chalk_1.default.hex('#BCE051'),
'operator,entity,url,language-css string,style string,variable': chalk_1.default.hex('#F4B73D'),
'atrule,attr-value,keyword': chalk_1.default.hex('#D1939E'),
'regex,important': chalk_1.default.hex('#e90'),
'important,bold': chalk_1.default.bold,
italic: chalk_1.default.italic,
deleted: chalk_1.default.red,
};
//# sourceMappingURL=prism-dark.js.map
@@ -0,0 +1 @@
{"version":3,"file":"prism-dark.js","sourceRoot":"","sources":["../../../src/themes/prism-dark.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAGzB;;;;;;GAMG;AACU,QAAA,KAAK,GAAU;IAC1B,CAAC,EAAE,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC;IAC/B,UAAU,EAAE,eAAK,CAAC,GAAG;IACrB,iCAAiC,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACvD,wBAAwB,EAAE,eAAK,CAAC,GAAG;IACnC,6CAA6C,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACnE,iDAAiD,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACvE,+DAA+D,EAC7D,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACtB,2BAA2B,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACjD,iBAAiB,EAAE,eAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IACpC,gBAAgB,EAAE,eAAK,CAAC,IAAI;IAC5B,MAAM,EAAE,eAAK,CAAC,MAAM;IACpB,OAAO,EAAE,eAAK,CAAC,GAAG;CACnB,CAAA","sourcesContent":["import chalk from 'chalk'\nimport type { Theme } from '../index.js'\n\n/**\n * Port of the `prism-dark` PrismJS theme.\n * <https://github.com/PrismJS/prism/blob/867804573562ef0ac5acf470420b97e43488ccde/themes/prism-dark.css>\n *\n * Slightly tweaked a few colors so that they are a bit more readable on a\n * terminal, some terminals have rendering issues when contrast is too low.\n */\nexport const theme: Theme = {\n _: chalk.white.bgHex('#231E19'),\n lineNumber: chalk.dim,\n 'comment, prolog, doctype, cdata': chalk.hex('#997F66'),\n 'punctuation, namespace': chalk.dim,\n 'property,tag,boolean,number,constant,symbol': chalk.hex('#9E93D1'),\n 'selector,attr-name,string,char,builtin,inserted': chalk.hex('#BCE051'),\n 'operator,entity,url,language-css string,style string,variable':\n chalk.hex('#F4B73D'),\n 'atrule,attr-value,keyword': chalk.hex('#D1939E'),\n 'regex,important': chalk.hex('#e90'),\n 'important,bold': chalk.bold,\n italic: chalk.italic,\n deleted: chalk.red,\n}\n"]}
@@ -0,0 +1,7 @@
import type { Theme } from '../index.js';
/**
* Port of xonokai PrismJS theme
* <https://github.com/PrismJS/prism-themes/blob/fe8d8fd7b80fb7d6bc0ed1a7b53009e5632701d7/themes/prism-xonokai.css>
*/
export declare const theme: Theme;
//# sourceMappingURL=xonokai.d.ts.map
@@ -0,0 +1 @@
{"version":3,"file":"xonokai.d.ts","sourceRoot":"","sources":["../../../src/themes/xonokai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC;;;GAGG;AACH,eAAO,MAAM,KAAK,EAAE,KAgBnB,CAAA"}
+27
View File
@@ -0,0 +1,27 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.theme = void 0;
const chalk_1 = __importDefault(require("chalk"));
/**
* Port of xonokai PrismJS theme
* <https://github.com/PrismJS/prism-themes/blob/fe8d8fd7b80fb7d6bc0ed1a7b53009e5632701d7/themes/prism-xonokai.css>
*/
exports.theme = {
// default style
_: chalk_1.default.hex('#76d9e6').bgHex('#2a2a2a'),
'namespace, lineNumber': chalk_1.default.dim,
'comment, prolog, doctype, cdata': chalk_1.default.hex('#6f705e'),
'operator, boolean, number': chalk_1.default.hex('#a77afe'),
'attr-name, string, entity, url, language-css string, style string, tag attr-value': chalk_1.default.hex('#e6d06c'),
'selector, inserted, tag attr-name': chalk_1.default.hex('#a6e22d'),
'atrule, attr-value, keyword, important, deleted, tag': chalk_1.default.hex('#ef3b7d'),
'regex, statement, style, script, script keyword': chalk_1.default.hex('#76d9e6'),
'placeholder, variable': chalk_1.default.hex('#fff'),
'important, statement, bold': chalk_1.default.bold,
punctuation: chalk_1.default.hex('#bebec5'),
italic: chalk_1.default.italic,
};
//# sourceMappingURL=xonokai.js.map
@@ -0,0 +1 @@
{"version":3,"file":"xonokai.js","sourceRoot":"","sources":["../../../src/themes/xonokai.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAGzB;;;GAGG;AACU,QAAA,KAAK,GAAU;IAC1B,gBAAgB;IAChB,CAAC,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;IACxC,uBAAuB,EAAE,eAAK,CAAC,GAAG;IAClC,iCAAiC,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACvD,2BAA2B,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACjD,mFAAmF,EACjF,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACtB,mCAAmC,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACzD,sDAAsD,EACpD,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACtB,iDAAiD,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACvE,uBAAuB,EAAE,eAAK,CAAC,GAAG,CAAC,MAAM,CAAC;IAC1C,4BAA4B,EAAE,eAAK,CAAC,IAAI;IACxC,WAAW,EAAE,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC;IACjC,MAAM,EAAE,eAAK,CAAC,MAAM;CACrB,CAAA","sourcesContent":["import chalk from 'chalk'\nimport type { Theme } from '../index.js'\n\n/**\n * Port of xonokai PrismJS theme\n * <https://github.com/PrismJS/prism-themes/blob/fe8d8fd7b80fb7d6bc0ed1a7b53009e5632701d7/themes/prism-xonokai.css>\n */\nexport const theme: Theme = {\n // default style\n _: chalk.hex('#76d9e6').bgHex('#2a2a2a'),\n 'namespace, lineNumber': chalk.dim,\n 'comment, prolog, doctype, cdata': chalk.hex('#6f705e'),\n 'operator, boolean, number': chalk.hex('#a77afe'),\n 'attr-name, string, entity, url, language-css string, style string, tag attr-value':\n chalk.hex('#e6d06c'),\n 'selector, inserted, tag attr-name': chalk.hex('#a6e22d'),\n 'atrule, attr-value, keyword, important, deleted, tag':\n chalk.hex('#ef3b7d'),\n 'regex, statement, style, script, script keyword': chalk.hex('#76d9e6'),\n 'placeholder, variable': chalk.hex('#fff'),\n 'important, statement, bold': chalk.bold,\n punctuation: chalk.hex('#bebec5'),\n italic: chalk.italic,\n}\n"]}