- Switched to pnpm - Updated to typescript 4.9.5 - JSX transforms switched to react-jsx - Use swc for typescript transforms - Remove deprecated dependencies - Cleanup unused types - Some ESM fixes - PostCSS config now lives in package.json - Bump support target TODO: - switch to vite or plain esbuild - jest to vitest / uvu - jquery to cash-dom - pure ESM (lodash-es, etc.) - drop prettier & husky (lint-staged is okay) - drop wasm cli & xterm.js - update bootstrap
44 lines
938 B
TypeScript
44 lines
938 B
TypeScript
import * as fs from 'fs'
|
|
import * as matchers from 'jest-extended'
|
|
import '@testing-library/jest-dom'
|
|
import yaml from 'js-yaml'
|
|
|
|
expect.extend(matchers)
|
|
|
|
window.blessing = {
|
|
base_url: '',
|
|
locale: 'en',
|
|
site_name: 'Blessing Skin',
|
|
version: '4.0.0',
|
|
extra: {},
|
|
i18n: yaml.load(
|
|
fs.readFileSync('resources/lang/en/front-end.yml', 'utf8'),
|
|
) as object,
|
|
}
|
|
|
|
class Headers extends Map {
|
|
constructor(headers: object = {}) {
|
|
// @ts-ignore
|
|
super(Object.entries(headers))
|
|
}
|
|
}
|
|
class Request {
|
|
public url: string
|
|
|
|
public headers: Headers
|
|
|
|
constructor(url: string, init: RequestInit) {
|
|
this.url = url
|
|
Object.assign(this, init)
|
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
this.headers = new Headers(Object.entries(init.headers || {}))
|
|
}
|
|
}
|
|
Object.assign(window, { Headers, Request })
|
|
|
|
const noop = () => undefined
|
|
Object.assign(console, {
|
|
warn: noop,
|
|
error: noop,
|
|
})
|