mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-24 07:47:13 +00:00
chore: update frontend build for v1.1.81 [skip ci]
This commit is contained in:
88
web/admin-spa/node_modules/strip-literal/dist/index.cjs
generated
vendored
Normal file
88
web/admin-spa/node_modules/strip-literal/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
'use strict';
|
||||
|
||||
const jsTokens = require('js-tokens');
|
||||
|
||||
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
||||
|
||||
const jsTokens__default = /*#__PURE__*/_interopDefaultCompat(jsTokens);
|
||||
|
||||
function stripLiteralJsTokens(code, options) {
|
||||
const FILL = options?.fillChar ?? " ";
|
||||
const FILL_COMMENT = " ";
|
||||
let result = "";
|
||||
const filter = options?.filter ?? (() => true);
|
||||
const tokens = [];
|
||||
for (const token of jsTokens__default(code, { jsx: false })) {
|
||||
tokens.push(token);
|
||||
if (token.type === "SingleLineComment") {
|
||||
result += FILL_COMMENT.repeat(token.value.length);
|
||||
continue;
|
||||
}
|
||||
if (token.type === "MultiLineComment") {
|
||||
result += token.value.replace(/[^\n]/g, FILL_COMMENT);
|
||||
continue;
|
||||
}
|
||||
if (token.type === "StringLiteral") {
|
||||
if (!token.closed) {
|
||||
result += token.value;
|
||||
continue;
|
||||
}
|
||||
const body = token.value.slice(1, -1);
|
||||
if (filter(body)) {
|
||||
result += token.value[0] + FILL.repeat(body.length) + token.value[token.value.length - 1];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "NoSubstitutionTemplate") {
|
||||
const body = token.value.slice(1, -1);
|
||||
if (filter(body)) {
|
||||
result += `\`${body.replace(/[^\n]/g, FILL)}\``;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "RegularExpressionLiteral") {
|
||||
const body = token.value;
|
||||
if (filter(body)) {
|
||||
result += body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${FILL.repeat($1.length)}/${$2}`);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "TemplateHead") {
|
||||
const body = token.value.slice(1, -2);
|
||||
if (filter(body)) {
|
||||
result += `\`${body.replace(/[^\n]/g, FILL)}\${`;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "TemplateTail") {
|
||||
const body = token.value.slice(0, -2);
|
||||
if (filter(body)) {
|
||||
result += `}${body.replace(/[^\n]/g, FILL)}\``;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "TemplateMiddle") {
|
||||
const body = token.value.slice(1, -2);
|
||||
if (filter(body)) {
|
||||
result += `}${body.replace(/[^\n]/g, FILL)}\${`;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
result += token.value;
|
||||
}
|
||||
return {
|
||||
result,
|
||||
tokens
|
||||
};
|
||||
}
|
||||
|
||||
function stripLiteral(code, options) {
|
||||
return stripLiteralDetailed(code, options).result;
|
||||
}
|
||||
function stripLiteralDetailed(code, options) {
|
||||
return stripLiteralJsTokens(code, options);
|
||||
}
|
||||
|
||||
exports.stripLiteral = stripLiteral;
|
||||
exports.stripLiteralDetailed = stripLiteralDetailed;
|
||||
exports.stripLiteralJsTokens = stripLiteralJsTokens;
|
||||
35
web/admin-spa/node_modules/strip-literal/dist/index.d.cts
generated
vendored
Normal file
35
web/admin-spa/node_modules/strip-literal/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import * as js_tokens from 'js-tokens';
|
||||
import { Token } from 'js-tokens';
|
||||
|
||||
interface StripLiteralOptions {
|
||||
/**
|
||||
* Will be called for each string literal. Return false to skip stripping.
|
||||
*/
|
||||
filter?: (s: string) => boolean;
|
||||
/**
|
||||
* Fill the stripped literal with this character.
|
||||
* It must be a single character.
|
||||
*
|
||||
* @default ' '
|
||||
*/
|
||||
fillChar?: string;
|
||||
}
|
||||
|
||||
declare function stripLiteralJsTokens(code: string, options?: StripLiteralOptions): {
|
||||
result: string;
|
||||
tokens: Token[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip literal from code.
|
||||
*/
|
||||
declare function stripLiteral(code: string, options?: StripLiteralOptions): string;
|
||||
/**
|
||||
* Strip literal from code, return more detailed information.
|
||||
*/
|
||||
declare function stripLiteralDetailed(code: string, options?: StripLiteralOptions): {
|
||||
result: string;
|
||||
tokens: js_tokens.Token[];
|
||||
};
|
||||
|
||||
export { type StripLiteralOptions, stripLiteral, stripLiteralDetailed, stripLiteralJsTokens };
|
||||
35
web/admin-spa/node_modules/strip-literal/dist/index.d.mts
generated
vendored
Normal file
35
web/admin-spa/node_modules/strip-literal/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import * as js_tokens from 'js-tokens';
|
||||
import { Token } from 'js-tokens';
|
||||
|
||||
interface StripLiteralOptions {
|
||||
/**
|
||||
* Will be called for each string literal. Return false to skip stripping.
|
||||
*/
|
||||
filter?: (s: string) => boolean;
|
||||
/**
|
||||
* Fill the stripped literal with this character.
|
||||
* It must be a single character.
|
||||
*
|
||||
* @default ' '
|
||||
*/
|
||||
fillChar?: string;
|
||||
}
|
||||
|
||||
declare function stripLiteralJsTokens(code: string, options?: StripLiteralOptions): {
|
||||
result: string;
|
||||
tokens: Token[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip literal from code.
|
||||
*/
|
||||
declare function stripLiteral(code: string, options?: StripLiteralOptions): string;
|
||||
/**
|
||||
* Strip literal from code, return more detailed information.
|
||||
*/
|
||||
declare function stripLiteralDetailed(code: string, options?: StripLiteralOptions): {
|
||||
result: string;
|
||||
tokens: js_tokens.Token[];
|
||||
};
|
||||
|
||||
export { type StripLiteralOptions, stripLiteral, stripLiteralDetailed, stripLiteralJsTokens };
|
||||
35
web/admin-spa/node_modules/strip-literal/dist/index.d.ts
generated
vendored
Normal file
35
web/admin-spa/node_modules/strip-literal/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import * as js_tokens from 'js-tokens';
|
||||
import { Token } from 'js-tokens';
|
||||
|
||||
interface StripLiteralOptions {
|
||||
/**
|
||||
* Will be called for each string literal. Return false to skip stripping.
|
||||
*/
|
||||
filter?: (s: string) => boolean;
|
||||
/**
|
||||
* Fill the stripped literal with this character.
|
||||
* It must be a single character.
|
||||
*
|
||||
* @default ' '
|
||||
*/
|
||||
fillChar?: string;
|
||||
}
|
||||
|
||||
declare function stripLiteralJsTokens(code: string, options?: StripLiteralOptions): {
|
||||
result: string;
|
||||
tokens: Token[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Strip literal from code.
|
||||
*/
|
||||
declare function stripLiteral(code: string, options?: StripLiteralOptions): string;
|
||||
/**
|
||||
* Strip literal from code, return more detailed information.
|
||||
*/
|
||||
declare function stripLiteralDetailed(code: string, options?: StripLiteralOptions): {
|
||||
result: string;
|
||||
tokens: js_tokens.Token[];
|
||||
};
|
||||
|
||||
export { type StripLiteralOptions, stripLiteral, stripLiteralDetailed, stripLiteralJsTokens };
|
||||
80
web/admin-spa/node_modules/strip-literal/dist/index.mjs
generated
vendored
Normal file
80
web/admin-spa/node_modules/strip-literal/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
import jsTokens from 'js-tokens';
|
||||
|
||||
function stripLiteralJsTokens(code, options) {
|
||||
const FILL = options?.fillChar ?? " ";
|
||||
const FILL_COMMENT = " ";
|
||||
let result = "";
|
||||
const filter = options?.filter ?? (() => true);
|
||||
const tokens = [];
|
||||
for (const token of jsTokens(code, { jsx: false })) {
|
||||
tokens.push(token);
|
||||
if (token.type === "SingleLineComment") {
|
||||
result += FILL_COMMENT.repeat(token.value.length);
|
||||
continue;
|
||||
}
|
||||
if (token.type === "MultiLineComment") {
|
||||
result += token.value.replace(/[^\n]/g, FILL_COMMENT);
|
||||
continue;
|
||||
}
|
||||
if (token.type === "StringLiteral") {
|
||||
if (!token.closed) {
|
||||
result += token.value;
|
||||
continue;
|
||||
}
|
||||
const body = token.value.slice(1, -1);
|
||||
if (filter(body)) {
|
||||
result += token.value[0] + FILL.repeat(body.length) + token.value[token.value.length - 1];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "NoSubstitutionTemplate") {
|
||||
const body = token.value.slice(1, -1);
|
||||
if (filter(body)) {
|
||||
result += `\`${body.replace(/[^\n]/g, FILL)}\``;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "RegularExpressionLiteral") {
|
||||
const body = token.value;
|
||||
if (filter(body)) {
|
||||
result += body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${FILL.repeat($1.length)}/${$2}`);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "TemplateHead") {
|
||||
const body = token.value.slice(1, -2);
|
||||
if (filter(body)) {
|
||||
result += `\`${body.replace(/[^\n]/g, FILL)}\${`;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "TemplateTail") {
|
||||
const body = token.value.slice(0, -2);
|
||||
if (filter(body)) {
|
||||
result += `}${body.replace(/[^\n]/g, FILL)}\``;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (token.type === "TemplateMiddle") {
|
||||
const body = token.value.slice(1, -2);
|
||||
if (filter(body)) {
|
||||
result += `}${body.replace(/[^\n]/g, FILL)}\${`;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
result += token.value;
|
||||
}
|
||||
return {
|
||||
result,
|
||||
tokens
|
||||
};
|
||||
}
|
||||
|
||||
function stripLiteral(code, options) {
|
||||
return stripLiteralDetailed(code, options).result;
|
||||
}
|
||||
function stripLiteralDetailed(code, options) {
|
||||
return stripLiteralJsTokens(code, options);
|
||||
}
|
||||
|
||||
export { stripLiteral, stripLiteralDetailed, stripLiteralJsTokens };
|
||||
Reference in New Issue
Block a user