@singhak/nodeui-express 0.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/README.md +47 -0
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @singhak/nodeui-express
|
|
2
|
+
|
|
3
|
+
Express middleware adapter for the NodeUI developer console. Mounts the core
|
|
4
|
+
middleware, serving the bundled React console and its API under `{path}`
|
|
5
|
+
(default `/nodeui`) and recording app requests in the request-log panel.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @singhak/nodeui-express
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import express from 'express';
|
|
17
|
+
import { nodeui } from '@singhak/nodeui-express';
|
|
18
|
+
|
|
19
|
+
const app = express();
|
|
20
|
+
const { middleware, server } = nodeui();
|
|
21
|
+
|
|
22
|
+
app.use(express.json());
|
|
23
|
+
app.use(middleware);
|
|
24
|
+
|
|
25
|
+
app.get('/hello', (_req, res) => res.json({ hello: 'world' }));
|
|
26
|
+
|
|
27
|
+
app.listen(3000, '127.0.0.1', () => {
|
|
28
|
+
server.mark('listening');
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Open `http://127.0.0.1:3000/nodeui` for the console and
|
|
33
|
+
`http://127.0.0.1:3000/nodeui/api/config` for the API.
|
|
34
|
+
|
|
35
|
+
## Options
|
|
36
|
+
|
|
37
|
+
`nodeui(options?)` accepts any `@singhak/nodeui-core` `NodeUIOptions` (env overrides,
|
|
38
|
+
path, request-log size, poll interval, etc.). See the `@singhak/nodeui-core` README for
|
|
39
|
+
the full configuration table and safety model.
|
|
40
|
+
|
|
41
|
+
## Development
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm run typecheck
|
|
45
|
+
npm test
|
|
46
|
+
npm run build
|
|
47
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
nodeui: () => nodeui
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
var import_nodeui_core = require("@singhak/nodeui-core");
|
|
28
|
+
__reExport(index_exports, require("@singhak/nodeui-core"), module.exports);
|
|
29
|
+
function nodeui(options) {
|
|
30
|
+
const server = (0, import_nodeui_core.createNodeUI)(options);
|
|
31
|
+
return { middleware: server.middleware(), server, addLogSource: server.addLogSource };
|
|
32
|
+
}
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
nodeui,
|
|
36
|
+
...require("@singhak/nodeui-core")
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n createNodeUI,\n type NodeUIMiddleware,\n type NodeUIOptions,\n type NodeUIServer,\n} from '@singhak/nodeui-core';\n\nexport interface NodeUIExpress {\n /** Express middleware that mounts the console; call `app.use(middleware)`. */\n middleware: NodeUIMiddleware;\n /** Handle to the underlying server (mark, shutdown, config). */\n server: NodeUIServer;\n /** Pushes an external log entry into the log viewer (logger adapter). */\n addLogSource: NodeUIServer['addLogSource'];\n}\n\n/**\n * Creates the NodeUI Express middleware plus its server handle.\n *\n * @example\n * const { middleware, server } = nodeui();\n * app.use(middleware);\n * app.listen(3000, \"127.0.0.1\", () => server.mark(\"listening\"));\n */\nexport function nodeui(options?: NodeUIOptions): NodeUIExpress {\n const server = createNodeUI(options);\n return { middleware: server.middleware(), server, addLogSource: server.addLogSource };\n}\n\nexport * from '@singhak/nodeui-core';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAKO;AAwBP,0BAAc,iCA7Bd;AAwBO,SAAS,OAAO,SAAwC;AAC7D,QAAM,aAAS,iCAAa,OAAO;AACnC,SAAO,EAAE,YAAY,OAAO,WAAW,GAAG,QAAQ,cAAc,OAAO,aAAa;AACtF;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeUIMiddleware, NodeUIServer, NodeUIOptions } from '@singhak/nodeui-core';
|
|
2
|
+
export * from '@singhak/nodeui-core';
|
|
3
|
+
|
|
4
|
+
interface NodeUIExpress {
|
|
5
|
+
/** Express middleware that mounts the console; call `app.use(middleware)`. */
|
|
6
|
+
middleware: NodeUIMiddleware;
|
|
7
|
+
/** Handle to the underlying server (mark, shutdown, config). */
|
|
8
|
+
server: NodeUIServer;
|
|
9
|
+
/** Pushes an external log entry into the log viewer (logger adapter). */
|
|
10
|
+
addLogSource: NodeUIServer['addLogSource'];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates the NodeUI Express middleware plus its server handle.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const { middleware, server } = nodeui();
|
|
17
|
+
* app.use(middleware);
|
|
18
|
+
* app.listen(3000, "127.0.0.1", () => server.mark("listening"));
|
|
19
|
+
*/
|
|
20
|
+
declare function nodeui(options?: NodeUIOptions): NodeUIExpress;
|
|
21
|
+
|
|
22
|
+
export { type NodeUIExpress, nodeui };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NodeUIMiddleware, NodeUIServer, NodeUIOptions } from '@singhak/nodeui-core';
|
|
2
|
+
export * from '@singhak/nodeui-core';
|
|
3
|
+
|
|
4
|
+
interface NodeUIExpress {
|
|
5
|
+
/** Express middleware that mounts the console; call `app.use(middleware)`. */
|
|
6
|
+
middleware: NodeUIMiddleware;
|
|
7
|
+
/** Handle to the underlying server (mark, shutdown, config). */
|
|
8
|
+
server: NodeUIServer;
|
|
9
|
+
/** Pushes an external log entry into the log viewer (logger adapter). */
|
|
10
|
+
addLogSource: NodeUIServer['addLogSource'];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates the NodeUI Express middleware plus its server handle.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const { middleware, server } = nodeui();
|
|
17
|
+
* app.use(middleware);
|
|
18
|
+
* app.listen(3000, "127.0.0.1", () => server.mark("listening"));
|
|
19
|
+
*/
|
|
20
|
+
declare function nodeui(options?: NodeUIOptions): NodeUIExpress;
|
|
21
|
+
|
|
22
|
+
export { type NodeUIExpress, nodeui };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import {
|
|
3
|
+
createNodeUI
|
|
4
|
+
} from "@singhak/nodeui-core";
|
|
5
|
+
export * from "@singhak/nodeui-core";
|
|
6
|
+
function nodeui(options) {
|
|
7
|
+
const server = createNodeUI(options);
|
|
8
|
+
return { middleware: server.middleware(), server, addLogSource: server.addLogSource };
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
nodeui
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n createNodeUI,\n type NodeUIMiddleware,\n type NodeUIOptions,\n type NodeUIServer,\n} from '@singhak/nodeui-core';\n\nexport interface NodeUIExpress {\n /** Express middleware that mounts the console; call `app.use(middleware)`. */\n middleware: NodeUIMiddleware;\n /** Handle to the underlying server (mark, shutdown, config). */\n server: NodeUIServer;\n /** Pushes an external log entry into the log viewer (logger adapter). */\n addLogSource: NodeUIServer['addLogSource'];\n}\n\n/**\n * Creates the NodeUI Express middleware plus its server handle.\n *\n * @example\n * const { middleware, server } = nodeui();\n * app.use(middleware);\n * app.listen(3000, \"127.0.0.1\", () => server.mark(\"listening\"));\n */\nexport function nodeui(options?: NodeUIOptions): NodeUIExpress {\n const server = createNodeUI(options);\n return { middleware: server.middleware(), server, addLogSource: server.addLogSource };\n}\n\nexport * from '@singhak/nodeui-core';\n"],"mappings":";AAAA;AAAA,EACE;AAAA,OAIK;AAwBP,cAAc;AALP,SAAS,OAAO,SAAwC;AAC7D,QAAM,SAAS,aAAa,OAAO;AACnC,SAAO,EAAE,YAAY,OAAO,WAAW,GAAG,QAAQ,cAAc,OAAO,aAAa;AACtF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@singhak/nodeui-express",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Express middleware adapter for the NodeUI developer console.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.mjs",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"sideEffects": false,
|
|
21
|
+
"keywords": [
|
|
22
|
+
"express",
|
|
23
|
+
"middleware",
|
|
24
|
+
"console",
|
|
25
|
+
"developer-tools",
|
|
26
|
+
"observability",
|
|
27
|
+
"debugging"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18.0.0"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/Singhak/nodeui.git"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://github.com/Singhak/nodeui#readme",
|
|
40
|
+
"bugs": {
|
|
41
|
+
"url": "https://github.com/Singhak/nodeui/issues"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"prepublishOnly": "npm run build",
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"typecheck": "tsc -p tsconfig.typecheck.json",
|
|
47
|
+
"test": "vitest run"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@singhak/nodeui-core": "^0.1.0"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"express": "^4.0.0 || ^5.0.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@types/express": "^5.0.0",
|
|
57
|
+
"@types/node": "^22.19.0",
|
|
58
|
+
"@types/supertest": "^6.0.2",
|
|
59
|
+
"express": "^5.2.1",
|
|
60
|
+
"supertest": "^7.1.0",
|
|
61
|
+
"tsup": "^8.5.0",
|
|
62
|
+
"typescript": "^5.9.3",
|
|
63
|
+
"vitest": "^3.2.4"
|
|
64
|
+
},
|
|
65
|
+
"author": "Anil Kumar",
|
|
66
|
+
"type": "commonjs"
|
|
67
|
+
}
|