Aktueller Stand

This commit is contained in:
2026-01-23 01:33:35 +01:00
parent 082dc5e110
commit 2766dd12c5
10109 changed files with 1578841 additions and 77685 deletions

7
backend/node_modules/graphmatch/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
import type { Node, Options } from './types.js';
declare const graphmatch: {
(node: Node, input: string, options?: Options): boolean;
compile(node: Node, options?: Options): RegExp;
};
export type { Node, Options };
export default graphmatch;

14
backend/node_modules/graphmatch/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
/* IMPORT */
import { getNodeFlags, getNodeSource } from './utils.js';
/* MAIN */
const graphmatch = (node, input, options) => {
return graphmatch.compile(node, options).test(input);
};
/* UTILITIES */
graphmatch.compile = (node, options) => {
const partial = options?.partial ?? false;
const source = getNodeSource(node, partial);
const flags = getNodeFlags(node);
return new RegExp(`^(?:${source})$`, flags);
};
export default graphmatch;

13
backend/node_modules/graphmatch/dist/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,13 @@
type Node = {
partial?: boolean;
regex: RegExp;
children?: Node[];
} | {
partial?: boolean;
regex?: RegExp;
children: Node[];
};
type Options = {
partial?: boolean;
};
export type { Node, Options };

2
backend/node_modules/graphmatch/dist/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
/* MAIN */
export {};

4
backend/node_modules/graphmatch/dist/utils.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import type { Node } from './types.js';
declare const getNodeFlags: (node: Node) => string;
declare const getNodeSource: (node: Node, partial: boolean) => string;
export { getNodeFlags, getNodeSource };

76
backend/node_modules/graphmatch/dist/utils.js generated vendored Normal file
View File

@@ -0,0 +1,76 @@
/* IMPORT */
/* MAIN */
const getNodes = (node) => {
const nodes = new Set();
const queue = [node];
for (let i = 0; i < queue.length; i++) {
const node = queue[i];
if (nodes.has(node))
continue;
nodes.add(node);
const { children } = node;
if (!children?.length)
continue;
for (let ci = 0, cl = children.length; ci < cl; ci++) {
queue.push(children[ci]);
}
}
return Array.from(nodes);
};
const getNodeFlags = (node) => {
let flags = '';
const nodes = getNodes(node);
for (let i = 0, l = nodes.length; i < l; i++) { // From root to leaves
const node = nodes[i];
if (!node.regex)
continue;
const nodeFlags = node.regex.flags;
flags || (flags = nodeFlags);
if (flags === nodeFlags)
continue;
throw new Error(`Inconsistent RegExp flags used: "${flags}" and "${nodeFlags}"`);
}
return flags;
};
const getNodeSourceWithCache = (node, partial, cache) => {
const cached = cache.get(node);
if (cached !== undefined)
return cached;
const isNodePartial = node.partial ?? partial;
let source = '';
if (node.regex) {
source += isNodePartial ? '(?:$|' : '';
source += node.regex.source;
}
if (node.children?.length) {
const children = uniq(node.children.map(node => getNodeSourceWithCache(node, partial, cache)).filter(Boolean));
if (children?.length) {
const isSomeChildNonPartial = node.children.some(child => !child.regex || !(child.partial ?? partial));
const needsWrapperGroup = (children.length > 1) || (isNodePartial && (!source.length || isSomeChildNonPartial));
source += needsWrapperGroup ? isNodePartial ? '(?:$|' : '(?:' : '';
source += children.join('|');
source += needsWrapperGroup ? ')' : '';
}
}
if (node.regex) {
source += isNodePartial ? ')' : '';
}
cache.set(node, source);
return source;
};
const getNodeSource = (node, partial) => {
const cache = new Map();
const nodes = getNodes(node);
for (let i = nodes.length - 1; i >= 0; i--) { // From leaves to root
const source = getNodeSourceWithCache(nodes[i], partial, cache);
if (i > 0)
continue;
return source;
}
return '';
};
const uniq = (values) => {
return Array.from(new Set(values));
};
/* EXPORT */
export { getNodeFlags, getNodeSource };

21
backend/node_modules/graphmatch/license generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2025-present Fabio Spampinato
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.

33
backend/node_modules/graphmatch/package.json generated vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "graphmatch",
"repository": "github:fabiospampinato/graphmatch",
"description": "A low-level utility for matching a string against a directed acyclic graph of regexes.",
"version": "1.1.0",
"type": "module",
"main": "dist/index.js",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"benchmark": "tsex benchmark",
"benchmark:watch": "tsex benchmark --watch",
"clean": "tsex clean",
"compile": "tsex compile",
"compile:watch": "tsex compile --watch",
"test": "tsex test",
"test:watch": "tsex test --watch",
"prepublishOnly": "tsex prepare"
},
"keywords": [
"regex",
"regexp",
"dag",
"graph",
"match"
],
"devDependencies": {
"benchloop": "^2.1.1",
"fava": "^0.3.5",
"tsex": "^4.0.2",
"typescript": "^5.9.3"
}
}

119
backend/node_modules/graphmatch/readme.md generated vendored Normal file
View File

@@ -0,0 +1,119 @@
# Graphmatch
A low-level utility for matching a string against a directed acyclic graph of regexes.
- It supports matching strings partially too.
- It supports fine-grained control over which nodes in the graph can be matched partially or not.
- It supports compiling the whole graph to a regex, even for partial matches.
- The graph will always be matched against the input string from the very start.
- RegExp flags are supported as long as they are the same for all the regexes in the graph.
## Install
```sh
npm install graphmatch
```
## Usage
```ts
import graphmatch from 'graphmatch';
// Let's say we would like to match against this glob: foo/{bar,baz}/qux
// Let's express that as a graph of regexes that this library can match against
// Whether you reuse the "qux" node or not doesn't matter, both are supported
const GRAPH = {
regex: /foo/,
children: [
{
regex: /\//,
children: [
{
regex: /bar/,
children: [
{
regex: /\//,
children: [
{
regex: /qux/
}
]
}
]
},
{
regex: /baz/,
children: [
{
regex: /\//,
children: [
{
regex: /qux/
}
]
}
]
}
]
}
]
};
// Let's now match against the graph, fully
graphmatch ( GRAPH, 'foo/bar/qux' ); // => true
graphmatch ( GRAPH, 'foo/baz/qux' ); // => true
graphmatch ( GRAPH, 'foo/bar/whoops' ); // => false
graphmatch ( GRAPH, 'foo/baz' ); // => false
// Let's now match against the graph, partially
// A partial match happens when any node in the graph sees the end of the string, either before or after the node's regex is executed
graphmatch ( GRAPH, 'foo/bar/qux', { partial: true } ); // => true
graphmatch ( GRAPH, 'foo/bar/', { partial: true } ); // => true
graphmatch ( GRAPH, 'foo/bar', { partial: true } ); // => true
graphmatch ( GRAPH, 'foo/', { partial: true } ); // => true
graphmatch ( GRAPH, 'foo', { partial: true } ); // => true
graphmatch ( GRAPH, 'foo/bar/whoops', { partial: true } ); // => false
graphmatch ( GRAPH, 'foo/barsomething', { partial: true } ); // => false
graphmatch ( GRAPH, 'bar', { partial: true } ); // => false
// As we just saw partial matching is set to "false" by default, and there is an option to set it to "true" by default
// But you can also decide on a node-by-node basis whether partial matching should be enabled or disabled for that particular node
// A partial node will match if the whole input string has been consumed, right before or after the node's regex is executed
// This has higher priority compared to the global setting
// This is useful for fine-grained control over which nodes can be matched partially
const NODE_NEVER_PARTIAL = { // This node will never match partially
partial: false,
regex: /foo/,
children: [],
};
const NODE_ALWAYS_PARTIAL = { // This node will always match partially
partial: true,
regex: /foo/,
children: [],
};
// Let's now compile the whole graph to a single regex
// This is useful if you expect to match against the graph multiple times
// It's faster to compile the graph once and match against it multiple times
const fullRe = graphmatch.compile ( GRAPH ); // => RegExp
fullRe.test ( 'foo/bar/qux' ); // => true
fullRe.test ( 'foo/bar' ); // => false
const partialRe = graphmatch.compile ( GRAPH, { partial: true } ); // => RegExp
partialRe.test ( 'foo/bar/qux' ); // => true
partialRe.test ( 'foo/bar' ); // => true
```
## License
MIT © Fabio Spampinato