done connecting coze and youwei

This commit is contained in:
Ebenezer
2026-03-27 17:05:01 +08:00
parent d5c75c9f5c
commit 592c503b5a
1157 changed files with 186944 additions and 31 deletions

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
export {};

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
import { crossEnv } from "../index.js";
crossEnv(process.argv.slice(2), { shell: true });

View File

@@ -0,0 +1,2 @@
#!/usr/bin/env node
export {};

3
backend/node_modules/cross-env/dist/bin/cross-env.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env node
import { crossEnv } from "../index.js";
crossEnv(process.argv.slice(2));

8
backend/node_modules/cross-env/dist/command.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Converts an environment variable usage to be appropriate for the current OS
* @param command Command to convert
* @param env Map of the current environment variable names and their values
* @param normalize If the command should be normalized using `path` after converting
* @returns Converted command
*/
export declare function commandConvert(command: string, env: NodeJS.ProcessEnv, normalize?: boolean): string;

39
backend/node_modules/cross-env/dist/command.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
import path from 'path';
import { isWindows } from "./is-windows.js";
/**
* Converts an environment variable usage to be appropriate for the current OS
* @param command Command to convert
* @param env Map of the current environment variable names and their values
* @param normalize If the command should be normalized using `path` after converting
* @returns Converted command
*/
export function commandConvert(command, env, normalize = false) {
if (!isWindows()) {
return command;
}
// Handle simple variables: $var or ${var}
const simpleEnvRegex = /\$(\w+)|\${(\w+)}/g;
// Handle bash parameter expansion with default values: ${var:-default}
const defaultValueRegex = /\$\{(\w+):-([^}]+)\}/g;
let convertedCmd = command;
// First, handle bash parameter expansion with default values
convertedCmd = convertedCmd.replace(defaultValueRegex, (match, varName, defaultValue) => {
// If the variable exists, use its value; otherwise use the default
const value = env[varName] || defaultValue;
return value;
});
// Then handle simple variable references
convertedCmd = convertedCmd.replace(simpleEnvRegex, (match, $1, $2) => {
const varName = $1 || $2;
// In Windows, non-existent variables are not replaced by the shell,
// so for example "echo %FOO%" will literally print the string "%FOO%", as
// opposed to printing an empty string in UNIX. See kentcdodds/cross-env#145
// If the env variable isn't defined at runtime, just strip it from the command entirely
return env[varName] ? `%${varName}%` : '';
});
// Normalization is required for commands with relative paths
// For example, `./cmd.bat`. See kentcdodds/cross-env#127
// However, it should not be done for command arguments.
// See https://github.com/kentcdodds/cross-env/pull/130#issuecomment-319887970
return normalize === true ? path.normalize(convertedCmd) : convertedCmd;
}

8
backend/node_modules/cross-env/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,8 @@
export type CrossEnvOptions = {
shell?: boolean;
};
export type ProcessResult = {
exitCode: number | null;
signal?: string | null;
};
export declare function crossEnv(args: string[], options?: CrossEnvOptions): ProcessResult | null;

98
backend/node_modules/cross-env/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,98 @@
import { invariant } from '@epic-web/invariant';
import { spawn } from 'cross-spawn';
import { commandConvert } from "./command.js";
import { varValueConvert } from "./variable.js";
const envSetterRegex = /(\w+)=('(.*)'|"(.*)"|(.*))/;
export function crossEnv(args, options = {}) {
const [envSetters, command, commandArgs] = parseCommand(args);
const env = getEnvVars(envSetters);
if (command) {
const spawnOptions = {
stdio: 'inherit',
shell: options.shell,
env,
};
const proc = spawn(
// run `path.normalize` for command(on windows)
commandConvert(command, env, true),
// by default normalize is `false`, so not run for cmd args
commandArgs.map((arg) => commandConvert(arg, env)), spawnOptions);
process.on('SIGTERM', () => proc.kill('SIGTERM'));
process.on('SIGINT', () => proc.kill('SIGINT'));
process.on('SIGBREAK', () => proc.kill('SIGBREAK'));
process.on('SIGHUP', () => proc.kill('SIGHUP'));
proc.on('exit', (code, signal) => {
let crossEnvExitCode = code;
// exit code could be null when OS kills the process(out of memory, etc) or due to node handling it
// but if the signal is SIGINT the user exited the process so we want exit code 0
if (crossEnvExitCode === null) {
crossEnvExitCode = signal === 'SIGINT' ? 0 : 1;
}
process.exit(crossEnvExitCode);
});
return proc;
}
return null;
}
function parseCommand(args) {
const envSetters = {};
let command = null;
let commandArgs = [];
for (let i = 0; i < args.length; i++) {
const arg = args[i];
if (!arg)
continue;
const match = envSetterRegex.exec(arg);
if (match && match[1]) {
let value;
if (typeof match[3] !== 'undefined') {
value = match[3];
}
else if (typeof match[4] === 'undefined') {
value = match[5] || '';
}
else {
value = match[4];
}
envSetters[match[1]] = value;
}
else {
// No more env setters, the rest of the line must be the command and args
const cStart = args
.slice(i)
// Regex:
// match "\'" or "'"
// or match "\" if followed by [$"\] (lookahead)
.map((a) => {
const re = /\\\\|(\\)?'|([\\])(?=[$"\\])/g;
// Eliminate all matches except for "\'" => "'"
return a.replace(re, (m) => {
if (m === '\\\\')
return '\\';
if (m === "\\'")
return "'";
return '';
});
});
const parsedCommand = cStart[0];
invariant(parsedCommand, 'Command is required');
command = parsedCommand;
commandArgs = cStart.slice(1).filter(Boolean);
break;
}
}
return [envSetters, command, commandArgs];
}
function getEnvVars(envSetters) {
const envVars = { ...process.env };
if (process.env.APPDATA) {
envVars.APPDATA = process.env.APPDATA;
}
Object.keys(envSetters).forEach((varName) => {
const value = envSetters[varName];
if (value !== undefined) {
envVars[varName] = varValueConvert(value, varName);
}
});
return envVars;
}

5
backend/node_modules/cross-env/dist/is-windows.d.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
/**
* Determines if the current platform is Windows
* @returns true if running on Windows, false otherwise
*/
export declare function isWindows(): boolean;

8
backend/node_modules/cross-env/dist/is-windows.js generated vendored Normal file
View File

@@ -0,0 +1,8 @@
/**
* Determines if the current platform is Windows
* @returns true if running on Windows, false otherwise
*/
export function isWindows() {
return (process.platform === 'win32' ||
/^(msys|cygwin)$/.test(process.env.OSTYPE || ''));
}

7
backend/node_modules/cross-env/dist/variable.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/**
* Converts an environment variable value to be appropriate for the current OS.
* @param originalValue Original value of the env variable
* @param originalName Original name of the env variable
* @returns Converted value
*/
export declare function varValueConvert(originalValue: string, originalName: string): string;

57
backend/node_modules/cross-env/dist/variable.js generated vendored Normal file
View File

@@ -0,0 +1,57 @@
import { isWindows } from "./is-windows.js";
const pathLikeEnvVarWhitelist = new Set(['PATH', 'NODE_PATH']);
/**
* This will transform UNIX-style list values to Windows-style.
* For example, the value of the $PATH variable "/usr/bin:/usr/local/bin:."
* will become "/usr/bin;/usr/local/bin;." on Windows.
* @param varValue Original value of the env variable
* @param varName Original name of the env variable
* @returns Converted value
*/
function replaceListDelimiters(varValue, varName = '') {
const targetSeparator = isWindows() ? ';' : ':';
if (!pathLikeEnvVarWhitelist.has(varName)) {
return varValue;
}
return varValue.replace(/(\\*):/g, (match, backslashes) => {
if (backslashes.length % 2) {
// Odd number of backslashes preceding it means it's escaped,
// remove 1 backslash and return the rest as-is
return match.substring(1);
}
return backslashes + targetSeparator;
});
}
/**
* This will attempt to resolve the value of any env variables that are inside
* this string. For example, it will transform this:
* cross-env FOO=$NODE_ENV BAR=\\$NODE_ENV echo $FOO $BAR
* Into this:
* FOO=development BAR=$NODE_ENV echo $FOO
* (Or whatever value the variable NODE_ENV has)
* Note that this function is only called with the right-side portion of the
* env var assignment, so in that example, this function would transform
* the string "$NODE_ENV" into "development"
* @param varValue Original value of the env variable
* @returns Converted value
*/
function resolveEnvVars(varValue) {
const envUnixRegex = /(\\*)(\$(\w+)|\${(\w+)})/g; // $my_var or ${my_var} or \$my_var
return varValue.replace(envUnixRegex, (_, escapeChars, varNameWithDollarSign, varName, altVarName) => {
// do not replace things preceded by a odd number of \
if (escapeChars.length % 2 === 1) {
return varNameWithDollarSign;
}
return (escapeChars.substring(0, escapeChars.length / 2) +
(process.env[varName || altVarName] || ''));
});
}
/**
* Converts an environment variable value to be appropriate for the current OS.
* @param originalValue Original value of the env variable
* @param originalName Original name of the env variable
* @returns Converted value
*/
export function varValueConvert(originalValue, originalName) {
return resolveEnvVars(replaceListDelimiters(originalValue, originalName));
}