Fix actions/tour

This commit is contained in:
2025-02-13 23:19:32 +01:00
parent 47dd1adb30
commit fa21d30994
4543 changed files with 680810 additions and 0 deletions

109
node_modules/comment-parser/src/transforms/align.ts generated vendored Normal file
View File

@@ -0,0 +1,109 @@
import { Transform } from './index.js';
import { BlockMarkers, Block, Line, Markers } from '../primitives.js';
import { rewireSource } from '../util.js';
interface Width {
start: number;
tag: number;
type: number;
name: number;
}
const zeroWidth = {
start: 0,
tag: 0,
type: 0,
name: 0,
};
const getWidth =
(markers = Markers) =>
(w: Width, { tokens: t }: Line) => ({
start: t.delimiter === markers.start ? t.start.length : w.start,
tag: Math.max(w.tag, t.tag.length),
type: Math.max(w.type, t.type.length),
name: Math.max(w.name, t.name.length),
});
const space = (len: number) => ''.padStart(len, ' ');
export default function align(markers = Markers): Transform {
let intoTags = false;
let w: Width;
function update(line: Line): Line {
const tokens = { ...line.tokens };
if (tokens.tag !== '') intoTags = true;
const isEmpty =
tokens.tag === '' &&
tokens.name === '' &&
tokens.type === '' &&
tokens.description === '';
// dangling '*/'
if (tokens.end === markers.end && isEmpty) {
tokens.start = space(w.start + 1);
return { ...line, tokens };
}
switch (tokens.delimiter) {
case markers.start:
tokens.start = space(w.start);
break;
case markers.delim:
tokens.start = space(w.start + 1);
break;
default:
tokens.delimiter = '';
tokens.start = space(w.start + 2); // compensate delimiter
}
if (!intoTags) {
tokens.postDelimiter = tokens.description === '' ? '' : ' ';
return { ...line, tokens };
}
const nothingAfter = {
delim: false,
tag: false,
type: false,
name: false,
};
if (tokens.description === '') {
nothingAfter.name = true;
tokens.postName = '';
if (tokens.name === '') {
nothingAfter.type = true;
tokens.postType = '';
if (tokens.type === '') {
nothingAfter.tag = true;
tokens.postTag = '';
if (tokens.tag === '') {
nothingAfter.delim = true;
}
}
}
}
tokens.postDelimiter = nothingAfter.delim ? '' : ' ';
if (!nothingAfter.tag)
tokens.postTag = space(w.tag - tokens.tag.length + 1);
if (!nothingAfter.type)
tokens.postType = space(w.type - tokens.type.length + 1);
if (!nothingAfter.name)
tokens.postName = space(w.name - tokens.name.length + 1);
return { ...line, tokens };
}
return ({ source, ...fields }: Block): Block => {
w = source.reduce(getWidth(markers), { ...zeroWidth });
return rewireSource({ ...fields, source: source.map(update) });
};
}

31
node_modules/comment-parser/src/transforms/crlf.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
import { Transform } from './index.js';
import { Block, Line } from '../primitives.js';
import { rewireSource } from '../util.js';
const order = [
'end',
'description',
'postType',
'type',
'postName',
'name',
'postTag',
'tag',
'postDelimiter',
'delimiter',
'start',
];
export type Ending = 'LF' | 'CRLF';
export default function crlf(ending: Ending): Transform {
function update(line: Line): Line {
return {
...line,
tokens: { ...line.tokens, lineEnd: ending === 'LF' ? '' : '\r' },
};
}
return ({ source, ...fields }: Block): Block =>
rewireSource({ ...fields, source: source.map(update) });
}

28
node_modules/comment-parser/src/transforms/indent.ts generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import { Transform } from './index.js';
import { Block, Line } from '../primitives.js';
import { rewireSource } from '../util.js';
const pull = (offset: number) => (str) => str.slice(offset);
const push = (offset: number) => {
const space = ''.padStart(offset, ' ');
return (str) => str + space;
};
export default function indent(pos: number): Transform {
let shift: (string: string) => string;
const pad = (start: string) => {
if (shift === undefined) {
const offset = pos - start.length;
shift = offset > 0 ? push(offset) : pull(-offset);
}
return shift(start);
};
const update = (line: Line): Line => ({
...line,
tokens: { ...line.tokens, start: pad(line.tokens.start) },
});
return ({ source, ...fields }: Block): Block =>
rewireSource({ ...fields, source: source.map(update) });
}

8
node_modules/comment-parser/src/transforms/index.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
import { Block } from '../primitives.js';
export type Transform = (Block: Block) => Block;
export function flow(...transforms: Transform[]): Transform {
return (block: Block): Block =>
transforms.reduce((block, t) => t(block), block);
}