Aktueller Stand
This commit is contained in:
3
backend/node_modules/zeptomatch/dist/compile/index.d.ts
generated
vendored
Normal file
3
backend/node_modules/zeptomatch/dist/compile/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Node, Options } from '../types.js';
|
||||
declare const compile: (node: Node, options?: Options) => RegExp;
|
||||
export default compile;
|
||||
11
backend/node_modules/zeptomatch/dist/compile/index.js
generated
vendored
Normal file
11
backend/node_modules/zeptomatch/dist/compile/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/* IMPORT */
|
||||
import graphmatch from 'graphmatch';
|
||||
/* MAIN */
|
||||
const compile = (node, options) => {
|
||||
const re = graphmatch.compile(node, options);
|
||||
const source = `${re.source.slice(0, -1)}[\\\\/]?$`; // With optional trailing slash
|
||||
const flags = re.flags;
|
||||
return new RegExp(source, flags);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default compile;
|
||||
7
backend/node_modules/zeptomatch/dist/index.d.ts
generated
vendored
Normal file
7
backend/node_modules/zeptomatch/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import type { Options } from './types.js';
|
||||
declare const zeptomatch: {
|
||||
(glob: string | string[], path: string, options?: Options): boolean;
|
||||
compile: (glob: string | string[], options?: Options) => RegExp;
|
||||
};
|
||||
export default zeptomatch;
|
||||
export type { Options };
|
||||
29
backend/node_modules/zeptomatch/dist/index.js
generated
vendored
Normal file
29
backend/node_modules/zeptomatch/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/* IMPORT */
|
||||
import compile from './compile/index.js';
|
||||
import merge from './merge/index.js';
|
||||
import normalize from './normalize/index.js';
|
||||
import parse from './parse/index.js';
|
||||
import { isString, memoizeByObject, memoizeByPrimitive } from './utils.js';
|
||||
/* MAIN */
|
||||
const zeptomatch = (glob, path, options) => {
|
||||
return zeptomatch.compile(glob, options).test(path);
|
||||
};
|
||||
/* UTILITIES */
|
||||
zeptomatch.compile = (() => {
|
||||
const compileGlob = memoizeByPrimitive((glob, options) => {
|
||||
return compile(parse(normalize(glob)), options);
|
||||
});
|
||||
const compileGlobs = memoizeByObject((globs, options) => {
|
||||
return merge(globs.map(glob => compileGlob(glob, options)));
|
||||
});
|
||||
return (glob, options) => {
|
||||
if (isString(glob)) {
|
||||
return compileGlob(glob, options);
|
||||
}
|
||||
else {
|
||||
return compileGlobs(glob, options);
|
||||
}
|
||||
};
|
||||
})();
|
||||
/* EXPORT */
|
||||
export default zeptomatch;
|
||||
2
backend/node_modules/zeptomatch/dist/merge/index.d.ts
generated
vendored
Normal file
2
backend/node_modules/zeptomatch/dist/merge/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const merge: (res: RegExp[]) => RegExp;
|
||||
export default merge;
|
||||
8
backend/node_modules/zeptomatch/dist/merge/index.js
generated
vendored
Normal file
8
backend/node_modules/zeptomatch/dist/merge/index.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/* MAIN */
|
||||
const merge = (res) => {
|
||||
const source = res.map(re => re.source).join('|') || '$^';
|
||||
const flags = res[0]?.flags;
|
||||
return new RegExp(source, flags);
|
||||
};
|
||||
/* EXPORT */
|
||||
export default merge;
|
||||
2
backend/node_modules/zeptomatch/dist/normalize/grammar.d.ts
generated
vendored
Normal file
2
backend/node_modules/zeptomatch/dist/normalize/grammar.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const Grammar: import("grammex").ExplicitRule<string>;
|
||||
export default Grammar;
|
||||
12
backend/node_modules/zeptomatch/dist/normalize/grammar.js
generated
vendored
Normal file
12
backend/node_modules/zeptomatch/dist/normalize/grammar.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/* IMPORT */
|
||||
import { match, or, star } from 'grammex';
|
||||
import { identity } from '../utils.js';
|
||||
/* MAIN */
|
||||
const Escaped = match(/\\./, identity);
|
||||
const Passthrough = match(/./, identity);
|
||||
const StarStarStar = match(/\*\*\*+/, '*');
|
||||
const StarStarNoLeft = match(/([^/{[(!])\*\*/, (_, $1) => `${$1}*`);
|
||||
const StarStarNoRight = match(/(^|.)\*\*(?=[^*/)\]}])/, (_, $1) => `${$1}*`);
|
||||
const Grammar = star(or([Escaped, StarStarStar, StarStarNoLeft, StarStarNoRight, Passthrough]));
|
||||
/* EXPORT */
|
||||
export default Grammar;
|
||||
2
backend/node_modules/zeptomatch/dist/normalize/index.d.ts
generated
vendored
Normal file
2
backend/node_modules/zeptomatch/dist/normalize/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const normalize: (glob: string) => string;
|
||||
export default normalize;
|
||||
9
backend/node_modules/zeptomatch/dist/normalize/index.js
generated
vendored
Normal file
9
backend/node_modules/zeptomatch/dist/normalize/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/* IMPORT */
|
||||
import { parse } from 'grammex';
|
||||
import Grammar from './grammar.js';
|
||||
/* MAIN */
|
||||
const normalize = (glob) => {
|
||||
return parse(glob, Grammar, { memoization: false }).join('');
|
||||
};
|
||||
/* EXPORT */
|
||||
export default normalize;
|
||||
2
backend/node_modules/zeptomatch/dist/parse/grammar.d.ts
generated
vendored
Normal file
2
backend/node_modules/zeptomatch/dist/parse/grammar.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const Grammar: import("grammex").ExplicitRule<import("../types.js").Node>;
|
||||
export default Grammar;
|
||||
55
backend/node_modules/zeptomatch/dist/parse/grammar.js
generated
vendored
Normal file
55
backend/node_modules/zeptomatch/dist/parse/grammar.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
/* IMPORT */
|
||||
import { match, and, lazy, optional, plus, or, star } from 'grammex';
|
||||
import { makeRangeAlpha, makeRangePaddedInt } from '../range.js';
|
||||
import { identity } from '../utils.js';
|
||||
import zeptomatch from '../index.js';
|
||||
import { regex, alternation, sequence, slash } from './utils.js';
|
||||
/* MAIN */
|
||||
const Escaped = match(/\\./, regex);
|
||||
const Escape = match(/[$.*+?^(){}[\]\|]/, char => regex(`\\${char}`));
|
||||
const Slash = match(/[\\\/]/, slash);
|
||||
const Passthrough = match(/[^$.*+?^(){}[\]\|\\\/]+/, regex);
|
||||
const NegationOdd = match(/^(?:!!)*!(.*)$/, (_, glob) => regex(`(?!^${zeptomatch.compile(glob).source}$).*?`));
|
||||
const NegationEven = match(/^(!!)+/);
|
||||
const Negation = or([NegationOdd, NegationEven]);
|
||||
const StarStarBetween = match(/\/(\*\*\/)+/, () => alternation([sequence([slash(), regex('.+?'), slash()]), slash()]));
|
||||
const StarStarStart = match(/^(\*\*\/)+/, () => alternation([regex('^'), sequence([regex('.*?'), slash()])]));
|
||||
const StarStarEnd = match(/\/(\*\*)$/, () => alternation([sequence([slash(), regex('.*?')]), regex('$')]));
|
||||
const StarStarNone = match(/\*\*/, () => regex('.*?'));
|
||||
const StarStar = or([StarStarBetween, StarStarStart, StarStarEnd, StarStarNone]);
|
||||
const StarDouble = match(/\*\/(?!\*\*\/|\*$)/, () => sequence([regex('[^\\\\/]*?'), slash()]));
|
||||
const StarSingle = match(/\*/, () => regex('[^\\\\/]*'));
|
||||
const Star = or([StarDouble, StarSingle]);
|
||||
const Question = match('?', () => regex('[^\\\\/]'));
|
||||
const ClassOpen = match('[', identity);
|
||||
const ClassClose = match(']', identity);
|
||||
const ClassNegation = match(/[!^]/, '^\\\\/');
|
||||
const ClassRange = match(/[a-z]-[a-z]|[0-9]-[0-9]/i, identity);
|
||||
const ClassEscaped = match(/\\./, identity);
|
||||
const ClassEscape = match(/[$.*+?^(){}[\|]/, char => `\\${char}`);
|
||||
const ClassSlash = match(/[\\\/]/, '\\\\/');
|
||||
const ClassPassthrough = match(/[^$.*+?^(){}[\]\|\\\/]+/, identity);
|
||||
const ClassValue = or([ClassEscaped, ClassEscape, ClassSlash, ClassRange, ClassPassthrough]);
|
||||
const Class = and([ClassOpen, optional(ClassNegation), star(ClassValue), ClassClose], _ => regex(_.join('')));
|
||||
const RangeOpen = match('{', '(?:');
|
||||
const RangeClose = match('}', ')');
|
||||
const RangeNumeric = match(/(\d+)\.\.(\d+)/, (_, $1, $2) => makeRangePaddedInt(+$1, +$2, Math.min($1.length, $2.length)).join('|'));
|
||||
const RangeAlphaLower = match(/([a-z]+)\.\.([a-z]+)/, (_, $1, $2) => makeRangeAlpha($1, $2).join('|'));
|
||||
const RangeAlphaUpper = match(/([A-Z]+)\.\.([A-Z]+)/, (_, $1, $2) => makeRangeAlpha($1.toLowerCase(), $2.toLowerCase()).join('|').toUpperCase());
|
||||
const RangeValue = or([RangeNumeric, RangeAlphaLower, RangeAlphaUpper]);
|
||||
const Range = and([RangeOpen, RangeValue, RangeClose], _ => regex(_.join('')));
|
||||
const BracesOpen = match('{');
|
||||
const BracesClose = match('}');
|
||||
const BracesComma = match(',');
|
||||
const BracesEscaped = match(/\\./, regex);
|
||||
const BracesEscape = match(/[$.*+?^(){[\]\|]/, char => regex(`\\${char}`));
|
||||
const BracesSlash = match(/[\\\/]/, slash);
|
||||
const BracesPassthrough = match(/[^$.*+?^(){}[\]\|\\\/,]+/, regex);
|
||||
const BracesNested = lazy(() => Braces);
|
||||
const BracesEmptyValue = match('', () => regex('(?:)'));
|
||||
const BracesFullValue = plus(or([StarStar, Star, Question, Class, Range, BracesNested, BracesEscaped, BracesEscape, BracesSlash, BracesPassthrough]), sequence);
|
||||
const BracesValue = or([BracesFullValue, BracesEmptyValue]);
|
||||
const Braces = and([BracesOpen, optional(and([BracesValue, star(and([BracesComma, BracesValue]))])), BracesClose], alternation);
|
||||
const Grammar = star(or([Negation, StarStar, Star, Question, Class, Range, Braces, Escaped, Escape, Slash, Passthrough]), sequence);
|
||||
/* EXPORT */
|
||||
export default Grammar;
|
||||
3
backend/node_modules/zeptomatch/dist/parse/index.d.ts
generated
vendored
Normal file
3
backend/node_modules/zeptomatch/dist/parse/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
import type { Node } from '../types.js';
|
||||
declare const _parse: (glob: string) => Node;
|
||||
export default _parse;
|
||||
9
backend/node_modules/zeptomatch/dist/parse/index.js
generated
vendored
Normal file
9
backend/node_modules/zeptomatch/dist/parse/index.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/* IMPORT */
|
||||
import { parse } from 'grammex';
|
||||
import Grammar from './grammar.js';
|
||||
/* MAIN */
|
||||
const _parse = (glob) => {
|
||||
return parse(glob, Grammar, { memoization: false })[0];
|
||||
};
|
||||
/* EXPORT */
|
||||
export default _parse;
|
||||
6
backend/node_modules/zeptomatch/dist/parse/utils.d.ts
generated
vendored
Normal file
6
backend/node_modules/zeptomatch/dist/parse/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Node } from '../types.js';
|
||||
declare const regex: (source: string) => Node;
|
||||
declare const alternation: (children: Node[]) => Node;
|
||||
declare const sequence: (nodes: Node[]) => Node;
|
||||
declare const slash: () => Node;
|
||||
export { regex, alternation, sequence, slash };
|
||||
43
backend/node_modules/zeptomatch/dist/parse/utils.js
generated
vendored
Normal file
43
backend/node_modules/zeptomatch/dist/parse/utils.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
/* IMPORT */
|
||||
/* MAIN */
|
||||
const regex = (source) => {
|
||||
const regex = new RegExp(source, 's');
|
||||
return { partial: false, regex, children: [] };
|
||||
};
|
||||
const alternation = (children) => {
|
||||
return { children };
|
||||
};
|
||||
const sequence = (() => {
|
||||
const pushToLeaves = (parent, child, handled) => {
|
||||
if (handled.has(parent))
|
||||
return;
|
||||
handled.add(parent);
|
||||
const { children } = parent;
|
||||
if (!children.length) { // Leaf node
|
||||
children.push(child);
|
||||
}
|
||||
else { // Internal node
|
||||
for (let i = 0, l = children.length; i < l; i++) {
|
||||
pushToLeaves(children[i], child, handled);
|
||||
}
|
||||
}
|
||||
};
|
||||
return (nodes) => {
|
||||
if (!nodes.length) { // no-op
|
||||
return alternation([]);
|
||||
}
|
||||
for (let i = nodes.length - 1; i >= 1; i--) {
|
||||
const handled = new Set();
|
||||
const parent = nodes[i - 1];
|
||||
const child = nodes[i];
|
||||
pushToLeaves(parent, child, handled);
|
||||
}
|
||||
return nodes[0];
|
||||
};
|
||||
})();
|
||||
const slash = () => {
|
||||
const regex = new RegExp('[\\\\/]', 's');
|
||||
return { regex, children: [] };
|
||||
};
|
||||
/* EXPORT */
|
||||
export { regex, alternation, sequence, slash };
|
||||
4
backend/node_modules/zeptomatch/dist/range.d.ts
generated
vendored
Normal file
4
backend/node_modules/zeptomatch/dist/range.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const makeRangeInt: (start: number, end: number) => number[];
|
||||
declare const makeRangePaddedInt: (start: number, end: number, paddingLength: number) => string[];
|
||||
declare const makeRangeAlpha: (start: string, end: string) => string[];
|
||||
export { makeRangeInt, makeRangePaddedInt, makeRangeAlpha };
|
||||
38
backend/node_modules/zeptomatch/dist/range.js
generated
vendored
Normal file
38
backend/node_modules/zeptomatch/dist/range.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/* CONSTANTS */
|
||||
const ALPHABET = 'abcdefghijklmnopqrstuvwxyz';
|
||||
/* HELPERS */
|
||||
const int2alpha = (int) => {
|
||||
let alpha = '';
|
||||
while (int > 0) {
|
||||
const reminder = (int - 1) % 26;
|
||||
alpha = ALPHABET[reminder] + alpha;
|
||||
int = Math.floor((int - 1) / 26);
|
||||
}
|
||||
return alpha;
|
||||
};
|
||||
const alpha2int = (str) => {
|
||||
let int = 0;
|
||||
for (let i = 0, l = str.length; i < l; i++) {
|
||||
int = (int * 26) + ALPHABET.indexOf(str[i]) + 1;
|
||||
}
|
||||
return int;
|
||||
};
|
||||
/* MAIN */
|
||||
// This isn't the most efficient way to do it, but it's extremely compact and we don't care about the performance of creating the ranges too much
|
||||
const makeRangeInt = (start, end) => {
|
||||
if (end < start)
|
||||
return makeRangeInt(end, start);
|
||||
const range = [];
|
||||
while (start <= end) {
|
||||
range.push(start++);
|
||||
}
|
||||
return range;
|
||||
};
|
||||
const makeRangePaddedInt = (start, end, paddingLength) => {
|
||||
return makeRangeInt(start, end).map(int => String(int).padStart(paddingLength, '0'));
|
||||
};
|
||||
const makeRangeAlpha = (start, end) => {
|
||||
return makeRangeInt(alpha2int(start), alpha2int(end)).map(int2alpha);
|
||||
};
|
||||
/* EXPORT */
|
||||
export { makeRangeInt, makeRangePaddedInt, makeRangeAlpha };
|
||||
9
backend/node_modules/zeptomatch/dist/types.d.ts
generated
vendored
Normal file
9
backend/node_modules/zeptomatch/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
type Node = {
|
||||
partial?: boolean;
|
||||
regex?: RegExp;
|
||||
children: Node[];
|
||||
};
|
||||
type Options = {
|
||||
partial?: boolean;
|
||||
};
|
||||
export type { Node, Options };
|
||||
2
backend/node_modules/zeptomatch/dist/types.js
generated
vendored
Normal file
2
backend/node_modules/zeptomatch/dist/types.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/* MAIN */
|
||||
export {};
|
||||
6
backend/node_modules/zeptomatch/dist/utils.d.ts
generated
vendored
Normal file
6
backend/node_modules/zeptomatch/dist/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import type { Options } from './types.js';
|
||||
declare const identity: <T>(value: T) => T;
|
||||
declare const isString: (value: unknown) => value is string;
|
||||
declare const memoizeByObject: <T>(fn: (globs: string[], options?: Options) => T) => (globs: string[], options?: Options) => T;
|
||||
declare const memoizeByPrimitive: <T>(fn: (glob: string, options?: Options) => T) => (glob: string, options?: Options) => T;
|
||||
export { identity, isString, memoizeByObject, memoizeByPrimitive };
|
||||
31
backend/node_modules/zeptomatch/dist/utils.js
generated
vendored
Normal file
31
backend/node_modules/zeptomatch/dist/utils.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
/* IMPORT */
|
||||
/* MAIN */
|
||||
const identity = (value) => {
|
||||
return value;
|
||||
};
|
||||
const isString = (value) => {
|
||||
return typeof value === 'string';
|
||||
};
|
||||
const memoizeByObject = (fn) => {
|
||||
const cacheFull = new WeakMap();
|
||||
const cachePartial = new WeakMap();
|
||||
return (globs, options) => {
|
||||
const cache = options?.partial ? cachePartial : cacheFull;
|
||||
const cached = cache.get(globs);
|
||||
if (cached !== undefined)
|
||||
return cached;
|
||||
const result = fn(globs, options);
|
||||
cache.set(globs, result);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
const memoizeByPrimitive = (fn) => {
|
||||
const cacheFull = {};
|
||||
const cachePartial = {};
|
||||
return (glob, options) => {
|
||||
const cache = options?.partial ? cachePartial : cacheFull;
|
||||
return cache[glob] ?? (cache[glob] = fn(glob, options));
|
||||
};
|
||||
};
|
||||
/* EXPORT */
|
||||
export { identity, isString, memoizeByObject, memoizeByPrimitive };
|
||||
Reference in New Issue
Block a user