mirror of
https://github.com/ImSingee/hammal.git
synced 2024-12-22 09:49:21 +08:00
upgrade typescript
This commit is contained in:
parent
dfb78f7bbc
commit
1a2d20a2bc
@ -12,8 +12,8 @@
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^4.20240722.0",
|
||||
"prettier": "^2.0.5",
|
||||
"typescript": "^3.9.5",
|
||||
"wrangler": "^3.60.0"
|
||||
"prettier": "^3.3.3",
|
||||
"typescript": "^5.5.4",
|
||||
"wrangler": "^3.66.0"
|
||||
}
|
||||
}
|
||||
|
@ -9,26 +9,26 @@ devDependencies:
|
||||
specifier: ^4.20240722.0
|
||||
version: 4.20240722.0
|
||||
prettier:
|
||||
specifier: ^2.0.5
|
||||
version: 2.0.5
|
||||
specifier: ^3.3.3
|
||||
version: 3.3.3
|
||||
typescript:
|
||||
specifier: ^3.9.5
|
||||
version: 3.9.5
|
||||
specifier: ^5.5.4
|
||||
version: 5.5.4
|
||||
wrangler:
|
||||
specifier: ^3.60.0
|
||||
version: 3.60.0(@cloudflare/workers-types@4.20240722.0)
|
||||
specifier: ^3.66.0
|
||||
version: 3.66.0(@cloudflare/workers-types@4.20240722.0)
|
||||
|
||||
packages:
|
||||
|
||||
/@cloudflare/kv-asset-handler@0.3.2:
|
||||
resolution: {integrity: sha512-EeEjMobfuJrwoctj7FA1y1KEbM0+Q1xSjobIEyie9k4haVEBB7vkDvsasw1pM3rO39mL2akxIAzLMUAtrMHZhA==}
|
||||
/@cloudflare/kv-asset-handler@0.3.4:
|
||||
resolution: {integrity: sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==}
|
||||
engines: {node: '>=16.13'}
|
||||
dependencies:
|
||||
mime: 3.0.0
|
||||
dev: true
|
||||
|
||||
/@cloudflare/workerd-darwin-64@1.20240605.0:
|
||||
resolution: {integrity: sha512-6V4Uze6jEM1mPBdPO6AevPwAOG2s+auEG1vPzZilwbrpn3BbYklEpQqcAZj05uUXaM6rnffnXerW8X8Fc8l4qQ==}
|
||||
/@cloudflare/workerd-darwin-64@1.20240718.0:
|
||||
resolution: {integrity: sha512-BsPZcSCgoGnufog2GIgdPuiKicYTNyO/Dp++HbpLRH+yQdX3x4aWx83M+a0suTl1xv76dO4g9aw7SIB6OSgIyQ==}
|
||||
engines: {node: '>=16'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
@ -36,8 +36,8 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@cloudflare/workerd-darwin-arm64@1.20240605.0:
|
||||
resolution: {integrity: sha512-ZNxjVSeMYUhTfVlrMsVjpN5eHA2kq3+S7ZMsGu5l44ZqFrDygsFDoc9C4anJVUEIHGFUB9LMu4ZTdS5S80hvPQ==}
|
||||
/@cloudflare/workerd-darwin-arm64@1.20240718.0:
|
||||
resolution: {integrity: sha512-nlr4gaOO5gcJerILJQph3+2rnas/nx/lYsuaot1ntHu4LAPBoQo1q/Pucj2cSIav4UiMzTbDmoDwPlls4Kteog==}
|
||||
engines: {node: '>=16'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
@ -45,8 +45,8 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@cloudflare/workerd-linux-64@1.20240605.0:
|
||||
resolution: {integrity: sha512-zqOWDrYEudW5JCcU8lxCFQ96UHJJHrM+uvGaRS4u5nJaEgMr2z7u9I2286+l1R3JWvJdqj9ehGuHQvZkaTADxw==}
|
||||
/@cloudflare/workerd-linux-64@1.20240718.0:
|
||||
resolution: {integrity: sha512-LJ/k3y47pBcjax0ee4K+6ZRrSsqWlfU4lbU8Dn6u5tSC9yzwI4YFNXDrKWInB0vd7RT3w4Yqq1S6ZEbfRrqVUg==}
|
||||
engines: {node: '>=16'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
@ -54,8 +54,8 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@cloudflare/workerd-linux-arm64@1.20240605.0:
|
||||
resolution: {integrity: sha512-qFTVNem7bMsU9P1dXUi+kb8EdU5aag1I9RQq6ZLS/zfiJ0a/UasihwQG8lrzT7k9x80VnpyCekNmd625qsVZjQ==}
|
||||
/@cloudflare/workerd-linux-arm64@1.20240718.0:
|
||||
resolution: {integrity: sha512-zBEZvy88EcAMGRGfuVtS00Yl7lJdUM9sH7i651OoL+q0Plv9kphlCC0REQPwzxrEYT1qibSYtWcD9IxQGgx2/g==}
|
||||
engines: {node: '>=16'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
@ -63,8 +63,8 @@ packages:
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/@cloudflare/workerd-windows-64@1.20240605.0:
|
||||
resolution: {integrity: sha512-s0U7d52ALQtb0enbHJ/AXmy+pyBQVoTIaAdAApy/PWrMiAnb8iJhf7A35pRTYfty5SUf7EX9BAPcKmeh+t3N5g==}
|
||||
/@cloudflare/workerd-windows-64@1.20240718.0:
|
||||
resolution: {integrity: sha512-YpCRvvT47XanFum7C3SedOZKK6BfVhqmwdAAVAQFyc4gsCdegZo0JkUkdloC/jwuWlbCACOG2HTADHOqyeolzQ==}
|
||||
engines: {node: '>=16'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
@ -412,6 +412,10 @@ packages:
|
||||
resolution: {integrity: sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==}
|
||||
dev: true
|
||||
|
||||
/date-fns@3.6.0:
|
||||
resolution: {integrity: sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==}
|
||||
dev: true
|
||||
|
||||
/debug@4.3.5:
|
||||
resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==}
|
||||
engines: {node: '>=6.0'}
|
||||
@ -558,8 +562,8 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/miniflare@3.20240605.0:
|
||||
resolution: {integrity: sha512-wE59RULU5zo6eYhL8j3wYdoOQ5istlkMruEr5pYvykL0LJecjKlFc8/cu4WJ5JdkdhutE1320Awi7WEICcolEw==}
|
||||
/miniflare@3.20240718.0:
|
||||
resolution: {integrity: sha512-TKgSeyqPBeT8TBLxbDJOKPWlq/wydoJRHjAyDdgxbw59N6wbP8JucK6AU1vXCfu21eKhrEin77ssXOpbfekzPA==}
|
||||
engines: {node: '>=16.13'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
@ -571,8 +575,8 @@ packages:
|
||||
glob-to-regexp: 0.4.1
|
||||
stoppable: 1.1.0
|
||||
undici: 5.28.4
|
||||
workerd: 1.20240605.0
|
||||
ws: 8.17.0
|
||||
workerd: 1.20240718.0
|
||||
ws: 8.18.0
|
||||
youch: 3.3.3
|
||||
zod: 3.23.8
|
||||
transitivePeerDependencies:
|
||||
@ -627,9 +631,9 @@ packages:
|
||||
engines: {node: '>=8.6'}
|
||||
dev: true
|
||||
|
||||
/prettier@2.0.5:
|
||||
resolution: {integrity: sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
/prettier@3.3.3:
|
||||
resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==}
|
||||
engines: {node: '>=14'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
@ -726,9 +730,9 @@ packages:
|
||||
resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==}
|
||||
dev: true
|
||||
|
||||
/typescript@3.9.5:
|
||||
resolution: {integrity: sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
/typescript@5.5.4:
|
||||
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
@ -758,37 +762,38 @@ packages:
|
||||
ufo: 1.5.3
|
||||
dev: true
|
||||
|
||||
/workerd@1.20240605.0:
|
||||
resolution: {integrity: sha512-2yhzgaprAOFm7H988xlRFmU4rOLXhSsq24wh6ayucMB3ORfe/nYJ2ysFn1mzjB+UxEJVt5PhixgHkZLv1S8UPQ==}
|
||||
/workerd@1.20240718.0:
|
||||
resolution: {integrity: sha512-w7lOLRy0XecQTg/ujTLWBiJJuoQvzB3CdQ6/8Wgex3QxFhV9Pbnh3UbwIuUfMw3OCCPQc4o7y+1P+mISAgp6yg==}
|
||||
engines: {node: '>=16'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
optionalDependencies:
|
||||
'@cloudflare/workerd-darwin-64': 1.20240605.0
|
||||
'@cloudflare/workerd-darwin-arm64': 1.20240605.0
|
||||
'@cloudflare/workerd-linux-64': 1.20240605.0
|
||||
'@cloudflare/workerd-linux-arm64': 1.20240605.0
|
||||
'@cloudflare/workerd-windows-64': 1.20240605.0
|
||||
'@cloudflare/workerd-darwin-64': 1.20240718.0
|
||||
'@cloudflare/workerd-darwin-arm64': 1.20240718.0
|
||||
'@cloudflare/workerd-linux-64': 1.20240718.0
|
||||
'@cloudflare/workerd-linux-arm64': 1.20240718.0
|
||||
'@cloudflare/workerd-windows-64': 1.20240718.0
|
||||
dev: true
|
||||
|
||||
/wrangler@3.60.0(@cloudflare/workers-types@4.20240722.0):
|
||||
resolution: {integrity: sha512-8lW4E7VAhCVXy7AV7Vom2BsyjekIt15Aa8jnBLsfE2CxalzWQzx49BK25hOYhjHQT4GqBXeoNOZ43FrMQ+SUUA==}
|
||||
/wrangler@3.66.0(@cloudflare/workers-types@4.20240722.0):
|
||||
resolution: {integrity: sha512-5fEyXsP8qvrUeR13kCfA3OG1z/ABx+/a8hzIA55nCUM2/tjI67ZkfeN1VdOmG6cipZDvs4HfN8rp7j+e+21nKA==}
|
||||
engines: {node: '>=16.17.0'}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@cloudflare/workers-types': ^4.20240605.0
|
||||
'@cloudflare/workers-types': ^4.20240718.0
|
||||
peerDependenciesMeta:
|
||||
'@cloudflare/workers-types':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@cloudflare/kv-asset-handler': 0.3.2
|
||||
'@cloudflare/kv-asset-handler': 0.3.4
|
||||
'@cloudflare/workers-types': 4.20240722.0
|
||||
'@esbuild-plugins/node-globals-polyfill': 0.2.3(esbuild@0.17.19)
|
||||
'@esbuild-plugins/node-modules-polyfill': 0.2.2(esbuild@0.17.19)
|
||||
blake3-wasm: 2.1.5
|
||||
chokidar: 3.6.0
|
||||
date-fns: 3.6.0
|
||||
esbuild: 0.17.19
|
||||
miniflare: 3.20240605.0
|
||||
miniflare: 3.20240718.0
|
||||
nanoid: 3.3.7
|
||||
path-to-regexp: 6.2.2
|
||||
resolve: 1.22.8
|
||||
@ -796,6 +801,7 @@ packages:
|
||||
selfsigned: 2.4.1
|
||||
source-map: 0.6.1
|
||||
unenv: /unenv-nightly@1.10.0-1717606461.a117952
|
||||
workerd: 1.20240718.0
|
||||
xxhash-wasm: 1.0.2
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
@ -805,8 +811,8 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/ws@8.17.0:
|
||||
resolution: {integrity: sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==}
|
||||
/ws@8.18.0:
|
||||
resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
peerDependencies:
|
||||
bufferutil: ^4.0.1
|
||||
|
53
src/token.ts
53
src/token.ts
@ -4,57 +4,57 @@ interface WwwAuthenticate {
|
||||
scope: string
|
||||
}
|
||||
|
||||
interface Token {
|
||||
export interface Token {
|
||||
token: string
|
||||
expires_in: number
|
||||
}
|
||||
|
||||
function parseAuthenticateStr(authenticateStr: string): WwwAuthenticate {
|
||||
const bearer = authenticateStr.split(/\s+/, 2)
|
||||
if (bearer.length != 2 && bearer[0].toLowerCase() !== "bearer") {
|
||||
if (bearer.length != 2 && bearer[0].toLowerCase() !== 'bearer') {
|
||||
throw new Error(`Invalid Www-Authenticate ${authenticateStr}`)
|
||||
}
|
||||
const params = bearer[1].split(",")
|
||||
const params = bearer[1].split(',')
|
||||
let get_param = function(name: string): string {
|
||||
for(const param of params) {
|
||||
const kvPair = param.split("=", 2)
|
||||
for (const param of params) {
|
||||
const kvPair = param.split('=', 2)
|
||||
if (kvPair.length !== 2 || kvPair[0] !== name) {
|
||||
continue
|
||||
}
|
||||
return kvPair[1].replace(/['"]+/g, '')
|
||||
}
|
||||
return ""
|
||||
return ''
|
||||
}
|
||||
return {
|
||||
realm: get_param("realm"),
|
||||
service: get_param("service"),
|
||||
scope: get_param("scope"),
|
||||
};
|
||||
realm: get_param('realm'),
|
||||
service: get_param('service'),
|
||||
scope: get_param('scope'),
|
||||
}
|
||||
}
|
||||
|
||||
class TokenProvider {
|
||||
private username: string|undefined;
|
||||
private password: string|undefined;
|
||||
export class TokenProvider {
|
||||
private username: string | undefined
|
||||
private password: string | undefined
|
||||
|
||||
constructor(username?: string, password?: string) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.username = username
|
||||
this.password = password
|
||||
}
|
||||
|
||||
private async authenticateCacheKey(wwwAuthenticate: WwwAuthenticate): Promise<string> {
|
||||
const keyStr = `${this.username}:${this.password}/${wwwAuthenticate.realm}/${wwwAuthenticate.service}/${wwwAuthenticate.scope}`
|
||||
const keyStrText = new TextEncoder().encode(keyStr)
|
||||
const digestArray = await crypto.subtle.digest({name: "SHA-256"}, keyStrText)
|
||||
const digestUint8Array = new Uint8Array(digestArray);
|
||||
const digestArray = await crypto.subtle.digest({ name: 'SHA-256' }, keyStrText)
|
||||
const digestUint8Array = new Uint8Array(digestArray)
|
||||
let hexArray = []
|
||||
for(const num of digestUint8Array) {
|
||||
for (const num of digestUint8Array) {
|
||||
hexArray.push(num.toString(16))
|
||||
}
|
||||
const digestHex = hexArray.join('')
|
||||
return `token/${digestHex}`
|
||||
}
|
||||
|
||||
private async tokenFromCache(cacheKey: string): Promise<Token|null> {
|
||||
private async tokenFromCache(cacheKey: string): Promise<Token | null> {
|
||||
const value = await HAMMAL_CACHE.get(cacheKey)
|
||||
if (value === null) {
|
||||
return null
|
||||
@ -63,30 +63,30 @@ class TokenProvider {
|
||||
}
|
||||
|
||||
private async tokenToCache(cacheKey: string, token: Token) {
|
||||
await HAMMAL_CACHE.put(cacheKey, JSON.stringify(token), {expirationTtl: token.expires_in})
|
||||
await HAMMAL_CACHE.put(cacheKey, JSON.stringify(token), { expirationTtl: token.expires_in })
|
||||
}
|
||||
|
||||
private async fetchToken(wwwAuthenticate: WwwAuthenticate): Promise<Token> {
|
||||
const url = new URL(wwwAuthenticate.realm)
|
||||
if (wwwAuthenticate.service.length) {
|
||||
url.searchParams.set("service", wwwAuthenticate.service)
|
||||
url.searchParams.set('service', wwwAuthenticate.service)
|
||||
}
|
||||
if (wwwAuthenticate.scope.length) {
|
||||
url.searchParams.set("scope", wwwAuthenticate.scope)
|
||||
url.searchParams.set('scope', wwwAuthenticate.scope)
|
||||
}
|
||||
// TODO: support basic auth
|
||||
const response = await fetch(url.toString(), {method: "GET", headers: {}})
|
||||
const response = await fetch(url.toString(), { method: 'GET', headers: {} })
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Unable to fetch token from ${url.toString()} status code ${response.status}`)
|
||||
}
|
||||
const body = await response.json()
|
||||
return {token: body.token, expires_in: body.expires_in}
|
||||
const body = await response.json<any>()
|
||||
return { token: body.token, expires_in: body.expires_in }
|
||||
}
|
||||
|
||||
async token(authenticateStr: string): Promise<Token> {
|
||||
const wwwAuthenticate: WwwAuthenticate = parseAuthenticateStr(authenticateStr)
|
||||
const cacheKey = await this.authenticateCacheKey(wwwAuthenticate)
|
||||
const cachedToken: Token|null = await this.tokenFromCache(cacheKey)
|
||||
const cachedToken: Token | null = await this.tokenFromCache(cacheKey)
|
||||
if (cachedToken !== null) {
|
||||
return cachedToken
|
||||
}
|
||||
@ -96,4 +96,3 @@ class TokenProvider {
|
||||
}
|
||||
}
|
||||
|
||||
export { TokenProvider, Token }
|
||||
|
117
tsconfig.json
117
tsconfig.json
@ -1,23 +1,102 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"module": "commonjs",
|
||||
"target": "esnext",
|
||||
"lib": ["esnext", "webworker"],
|
||||
"alwaysStrict": true,
|
||||
"strict": true,
|
||||
"preserveConstEnums": true,
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"types": ["@cloudflare/workers-types"]
|
||||
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es2021" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
||||
"lib": ["es2021"] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
||||
"jsx": "react-jsx" /* Specify what JSX code is generated. */,
|
||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
||||
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
|
||||
/* Modules */
|
||||
"module": "es2022" /* Specify what module code is generated. */,
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
"moduleResolution": "Bundler" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
||||
"types": ["@cloudflare/workers-types"] /* Specify type package names to be included without being referenced in a source file. */,
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
"resolveJsonModule": true /* Enable importing .json files */,
|
||||
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */,
|
||||
"checkJs": false /* Enable error reporting in type-checked JavaScript files. */,
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
"noEmit": true /* Disable emitting files from a compilation. */,
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||
|
||||
/* Interop Constraints */
|
||||
"isolatedModules": true /* Ensure that each file can be safely transpiled without relying on other imports. */,
|
||||
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
|
||||
// "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true /* Enable all strict type-checking options. */,
|
||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
},
|
||||
"include": [
|
||||
"./src/*.ts",
|
||||
"./test/*.ts",
|
||||
"./src/**/*.ts",
|
||||
"./test/**/*.ts",
|
||||
"./node_modules/@cloudflare/workers-types/index.d.ts"
|
||||
],
|
||||
"exclude": ["node_modules/", "dist/"]
|
||||
"exclude": ["test"]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user