forked from gornostay25/svelte-adapter-bun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
polyfills.js
33 lines (31 loc) · 1003 Bytes
/
polyfills.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// node_modules/@sveltejs/kit/src/exports/node/polyfills.js"
// https://github.com/oven-sh/bun/issues/621#issuecomment-1396462734
// class File extends Blob {
// constructor(bytes, filename, options = {}) {
// super(bytes, options);
// Object.defineProperties(this, {
// name: { value: filename },
// lastModified: { value: options.lastModified || null },
// lastModifiedDate: { value: options.lastModified ? new Date(options.lastModified) : null },
// [Symbol.toStringTag]: { value: "File" },
// });
// }
// }
/** @type {Record<string, any>} */
const globals = {
// File,
};
export default function installPolyfills() {
for (const name in globals) {
const descriptor = Object.getOwnPropertyDescriptor(globalThis, name);
if (descriptor && !descriptor.configurable) {
continue;
}
Object.defineProperty(globalThis, name, {
enumerable: true,
configurable: true,
writable: true,
value: globals[name],
});
}
}