alp-node 10.0.0 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlpNodeApp-node.mjs +1 -0
- package/dist/AlpNodeApp-node.mjs.map +1 -1
- package/dist/definitions/AlpNodeApp.d.ts.map +1 -1
- package/dist/definitions/errors.d.ts.map +1 -1
- package/dist/definitions/index.d.ts.map +1 -1
- package/dist/definitions/language.d.ts.map +1 -1
- package/dist/definitions/listen.d.ts.map +1 -1
- package/dist/definitions/params/index.d.ts.map +1 -1
- package/dist/definitions/router.d.ts.map +1 -1
- package/dist/definitions/translate/index.d.ts.map +1 -1
- package/dist/definitions/types.d.ts.map +1 -1
- package/dist/index-node.mjs +2 -3
- package/dist/index-node.mjs.map +1 -1
- package/package.json +51 -51
- package/src/AlpNodeApp.ts +7 -11
- package/src/errors.ts +1 -0
- package/src/index.ts +2 -3
- package/src/language.ts +1 -0
- package/src/listen.ts +1 -0
- package/src/params/ParamValidationResult.test.ts +1 -1
- package/src/params/index.ts +1 -0
- package/src/router.ts +1 -0
- package/src/translate/index.ts +1 -0
- package/src/types.ts +1 -2
- package/CHANGELOG.md +0 -947
package/src/AlpNodeApp.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
IncomingMessage,
|
|
3
|
-
RequestListener,
|
|
4
|
-
Server,
|
|
5
|
-
ServerResponse,
|
|
6
|
-
} from "node:http";
|
|
1
|
+
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
7
2
|
import path from "node:path";
|
|
8
3
|
import Koa from "koa";
|
|
9
4
|
import type { DefaultContext, DefaultState, ParameterizedContext } from "koa";
|
|
10
5
|
import compress from "koa-compress";
|
|
11
6
|
import serve from "koa-static";
|
|
7
|
+
// eslint-disable-next-line import-x/no-unresolved
|
|
12
8
|
import { Logger } from "nightingale-logger";
|
|
13
9
|
import type { Router } from "router-segments";
|
|
14
10
|
import type { Config } from "./config";
|
|
@@ -27,7 +23,6 @@ import type { TranslateBaseContext, TranslateContext } from "./translate/index";
|
|
|
27
23
|
import translate from "./translate/index";
|
|
28
24
|
import type {
|
|
29
25
|
Context as AlpContext,
|
|
30
|
-
ContextSanitizedState,
|
|
31
26
|
ContextState,
|
|
32
27
|
NodeApplication,
|
|
33
28
|
NodeConfig,
|
|
@@ -48,7 +43,8 @@ declare module "koa" {
|
|
|
48
43
|
interface DefaultState extends ContextState {}
|
|
49
44
|
|
|
50
45
|
interface DefaultContext
|
|
51
|
-
extends
|
|
46
|
+
extends
|
|
47
|
+
AlpContext,
|
|
52
48
|
AlpParamsContext,
|
|
53
49
|
AlpRouterContext,
|
|
54
50
|
AlpLanguageContext,
|
|
@@ -122,8 +118,7 @@ export class AlpNodeApp
|
|
|
122
118
|
res: ServerResponse,
|
|
123
119
|
): ParameterizedContext<StateT> {
|
|
124
120
|
const ctx = super.createContext<StateT>(req, res);
|
|
125
|
-
|
|
126
|
-
ctx.sanitizedState = {} as ContextSanitizedState;
|
|
121
|
+
ctx.sanitizedState = {};
|
|
127
122
|
return ctx;
|
|
128
123
|
}
|
|
129
124
|
|
|
@@ -154,7 +149,8 @@ export class AlpNodeApp
|
|
|
154
149
|
try {
|
|
155
150
|
const server = await _listen(
|
|
156
151
|
this.config,
|
|
157
|
-
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
153
|
+
this.callback(),
|
|
158
154
|
this.certPath,
|
|
159
155
|
);
|
|
160
156
|
this._server = server;
|
package/src/errors.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { STATUS_CODES } from "node:http";
|
|
2
2
|
import ErrorHtmlRenderer from "error-html";
|
|
3
|
+
// eslint-disable-next-line import-x/no-unresolved
|
|
3
4
|
import { Logger } from "nightingale-logger";
|
|
4
5
|
import type { Context } from "./AlpNodeApp";
|
|
5
6
|
import type { HtmlError } from "./types";
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
// eslint-disable-next-line import-x/no-unresolved
|
|
3
4
|
import { Logger } from "nightingale-logger";
|
|
4
5
|
import type { AlpNodeAppOptions } from "./AlpNodeApp";
|
|
5
6
|
import { AlpNodeApp } from "./AlpNodeApp";
|
|
@@ -20,9 +21,7 @@ export const appDirname = path.resolve("build");
|
|
|
20
21
|
|
|
21
22
|
const packagePath = path.resolve("package.json");
|
|
22
23
|
if (!packagePath) {
|
|
23
|
-
throw new Error(
|
|
24
|
-
`Could not find package.json: "${String(packagePath as unknown)}"`,
|
|
25
|
-
);
|
|
24
|
+
throw new Error(`Could not find package.json: "${packagePath}"`);
|
|
26
25
|
}
|
|
27
26
|
export const packageDirname = path.dirname(packagePath);
|
|
28
27
|
|
package/src/language.ts
CHANGED
package/src/listen.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { chmodSync, readFileSync, unlinkSync } from "node:fs";
|
|
|
2
2
|
import { createServer as createServerHttp } from "node:http";
|
|
3
3
|
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
4
4
|
import { createServer as createServerHttps } from "node:https";
|
|
5
|
+
// eslint-disable-next-line import-x/no-unresolved
|
|
5
6
|
import { Logger } from "nightingale-logger";
|
|
6
7
|
import type { Config } from "./config";
|
|
7
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { test } from "node:test";
|
|
3
|
-
// eslint-disable-next-line import/extensions
|
|
3
|
+
// eslint-disable-next-line import-x/extensions
|
|
4
4
|
import { ParamValidationResult } from "./ParamValidationResult.ts";
|
|
5
5
|
|
|
6
6
|
// const createContextMock = (): Context &
|
package/src/params/index.ts
CHANGED
package/src/router.ts
CHANGED
package/src/translate/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -52,8 +52,7 @@ export interface BrowserApplicationInCreation extends ApplicationInCreation {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export interface NodeApplication
|
|
55
|
-
extends Application,
|
|
56
|
-
NodeApplicationInCreation {
|
|
55
|
+
extends Application, NodeApplicationInCreation {
|
|
57
56
|
config: NodeConfig;
|
|
58
57
|
dirname: string;
|
|
59
58
|
on: (event: "close", callback: () => void) => void;
|