071faa482c
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
28 lines
803 B
JavaScript
28 lines
803 B
JavaScript
import crypto from 'node:crypto';
|
|
import { createRequire } from 'node:module';
|
|
import { dirname, join } from 'node:path';
|
|
import { pathToFileURL } from 'node:url';
|
|
|
|
if (crypto.webcrypto) {
|
|
if (typeof crypto.getRandomValues !== 'function') {
|
|
crypto.getRandomValues = crypto.webcrypto.getRandomValues.bind(
|
|
crypto.webcrypto,
|
|
);
|
|
}
|
|
|
|
if (
|
|
!globalThis.crypto ||
|
|
typeof globalThis.crypto.getRandomValues !== 'function'
|
|
) {
|
|
Object.defineProperty(globalThis, 'crypto', {
|
|
value: crypto.webcrypto,
|
|
configurable: true,
|
|
});
|
|
}
|
|
}
|
|
|
|
const require = createRequire(import.meta.url);
|
|
const vitePackageJsonPath = require.resolve('vite/package.json');
|
|
const viteBinPath = join(dirname(vitePackageJsonPath), 'bin', 'vite.js');
|
|
await import(pathToFileURL(viteBinPath).href);
|