Continues to use esbuild for development mode and building. Also includes a `yarn lint` script that uses tsc to do full type checking. Fixes #5138 Signed-off-by: Mihai Parparita <mihai@tailscale.com>main
parent
0a6aa75a2d
commit
389629258b
@ -0,0 +1,15 @@ |
||||
// Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/** |
||||
* @fileoverview Type definitions for types generated by the esbuild build |
||||
* process. |
||||
*/ |
||||
|
||||
declare module "*.wasm" { |
||||
const path: string |
||||
export default path |
||||
} |
||||
|
||||
declare const DEBUG: boolean |
||||
@ -0,0 +1,82 @@ |
||||
// Copyright (c) 2022 Tailscale Inc & AUTHORS All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
/** |
||||
* @fileoverview Type definitions for types exported by the wasm_js.go Go |
||||
* module. Not actually a .d.ts file so that we can use enums from it in |
||||
* esbuild's simplified TypeScript compiler (see https://github.com/evanw/esbuild/issues/2298#issuecomment-1146378367)
|
||||
*/ |
||||
|
||||
declare global { |
||||
function newIPN(config: IPNConfig): IPN |
||||
|
||||
interface IPN { |
||||
run(callbacks: IPNCallbacks): void |
||||
login(): void |
||||
logout(): void |
||||
ssh( |
||||
host: string, |
||||
writeFn: (data: string) => void, |
||||
setReadFn: (readFn: (data: string) => void) => void, |
||||
rows: number, |
||||
cols: number, |
||||
onDone: () => void |
||||
): void |
||||
} |
||||
|
||||
interface IPNStateStorage { |
||||
setState(id: string, value: string): void |
||||
getState(id: string): string |
||||
} |
||||
|
||||
type IPNConfig = { |
||||
stateStorage?: IPNStateStorage |
||||
} |
||||
|
||||
type IPNCallbacks = { |
||||
notifyState: (state: IPNState) => void |
||||
notifyNetMap: (netMapStr: string) => void |
||||
notifyBrowseToURL: (url: string) => void |
||||
} |
||||
|
||||
type IPNNetMap = { |
||||
self: IPNNetMapSelfNode |
||||
peers: IPNNetMapPeerNode[] |
||||
} |
||||
|
||||
type IPNNetMapNode = { |
||||
name: string |
||||
addresses: string[] |
||||
machineKey: string |
||||
nodeKey: string |
||||
} |
||||
|
||||
type IPNNetMapSelfNode = IPNNetMapNode & { |
||||
machineStatus: IPNMachineStatus |
||||
} |
||||
|
||||
type IPNNetMapPeerNode = IPNNetMapNode & { |
||||
online: boolean |
||||
tailscaleSSHEnabled: boolean |
||||
} |
||||
} |
||||
|
||||
/** Mirrors values from ipn/backend.go */ |
||||
export const enum IPNState { |
||||
NoState = 0, |
||||
InUseOtherUser = 1, |
||||
NeedsLogin = 2, |
||||
NeedsMachineAuth = 3, |
||||
Stopped = 4, |
||||
Starting = 5, |
||||
Running = 6, |
||||
} |
||||
|
||||
/** Mirrors values from MachineStatus in tailcfg.go */ |
||||
export const enum IPNMachineStatus { |
||||
MachineUnknown = 0, |
||||
MachineUnauthorized = 1, |
||||
MachineAuthorized = 2, |
||||
MachineInvalid = 3, |
||||
} |
||||
@ -0,0 +1,13 @@ |
||||
{ |
||||
"compilerOptions": { |
||||
"target": "ES2017", |
||||
"module": "ES2020", |
||||
"moduleResolution": "node", |
||||
"isolatedModules": true, |
||||
"strict": true, |
||||
"forceConsistentCasingInFileNames": true, |
||||
"sourceMap": true |
||||
}, |
||||
"include": ["src/**/*"], |
||||
"exclude": ["node_modules"] |
||||
} |
||||
Loading…
Reference in new issue