chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:30:28 +08:00
commit ba73d7ef36
160 changed files with 37714 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import { afterAll, afterEach, beforeAll } from 'vitest';
import nock from 'nock';
beforeAll(() => {
nock.disableNetConnect();
nock.enableNetConnect((host) => host.startsWith('127.0.0.1'));
});
afterEach(() => {
nock.cleanAll();
});
afterAll(() => {
nock.enableNetConnect();
});
+29
View File
@@ -0,0 +1,29 @@
const nodeCrypto = require('crypto');
const { webcrypto } = nodeCrypto;
if (typeof globalThis.crypto?.getRandomValues !== 'function') {
Object.defineProperty(globalThis, 'crypto', {
configurable: true,
value: webcrypto,
});
}
if (typeof nodeCrypto.getRandomValues !== 'function') {
nodeCrypto.getRandomValues = webcrypto.getRandomValues.bind(webcrypto);
}
if (typeof globalThis.ReadableStream !== 'function') {
const webStreams = require('stream/web');
for (const name of ['ReadableStream', 'WritableStream', 'TransformStream']) {
if (
typeof globalThis[name] !== 'function' &&
typeof webStreams[name] === 'function'
) {
Object.defineProperty(globalThis, name, {
configurable: true,
value: webStreams[name],
});
}
}
}