Skip to content

Commit e22a0e5

Browse files
committed
Move ClientConfiguration to common
Common code must not import Node code as it is imported by the browser.
1 parent 5a28626 commit e22a0e5

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/common/http.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,12 @@ export class HttpError extends Error {
1818
this.name = this.constructor.name
1919
}
2020
}
21+
22+
/**
23+
* Base options included on every page.
24+
*/
25+
export interface ClientConfiguration {
26+
codeServerVersion: string
27+
base: string
28+
csStaticBase: string
29+
}

src/common/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClientConfiguration } from "../node/http"
1+
import { ClientConfiguration } from "./http"
22

33
/**
44
* Split a string up to the delimiter. If the delimiter doesn't exist the first

src/node/http.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,13 @@ import * as express from "express"
33
import * as expressCore from "express-serve-static-core"
44
import path from "path"
55
import qs from "qs"
6-
import { HttpCode, HttpError } from "../common/http"
6+
import { ClientConfiguration, HttpCode, HttpError } from "../common/http"
77
import { normalize } from "../common/util"
88
import { AuthType, DefaultedArgs } from "./cli"
99
import { version as codeServerVersion } from "./constants"
1010
import { Heart } from "./heart"
1111
import { getPasswordMethod, IsCookieValidArgs, isCookieValid, sanitizeString, escapeHtml, escapeJSON } from "./util"
1212

13-
/**
14-
* Base options included on every page.
15-
*/
16-
export interface ClientConfiguration {
17-
codeServerVersion: string
18-
base: string
19-
csStaticBase: string
20-
}
21-
2213
declare global {
2314
// eslint-disable-next-line @typescript-eslint/no-namespace
2415
namespace Express {

0 commit comments

Comments
 (0)