@xxxaz/json-rpc-schema-typing 0.10.27 → 0.10.29
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/cjs/router/FileSystemRouter.js +15 -2
- package/cjs/router/FileSystemRouter.js.map +1 -1
- package/esm/router/FileSystemRouter.js +15 -2
- package/esm/router/FileSystemRouter.js.map +1 -1
- package/package.json +1 -1
- package/src/router/FileSystemRouter.ts +19 -2
- package/types/router/FileSystemRouter.d.ts +5 -1
|
@@ -36,9 +36,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.FileSystemRouter = void 0;
|
|
37
37
|
const fs_1 = require("fs");
|
|
38
38
|
const JsonRpcRouter_js_1 = require("./JsonRpcRouter.js");
|
|
39
|
+
function parsePathFilter(filter) {
|
|
40
|
+
if (!filter)
|
|
41
|
+
return () => true;
|
|
42
|
+
if (filter instanceof RegExp) {
|
|
43
|
+
return (path) => filter.test(path);
|
|
44
|
+
}
|
|
45
|
+
return filter;
|
|
46
|
+
}
|
|
39
47
|
class FileSystemRouter extends JsonRpcRouter_js_1.JsonRpcRouter {
|
|
40
48
|
rootDir;
|
|
41
|
-
constructor(rootDir) {
|
|
49
|
+
constructor(rootDir, options = {}) {
|
|
42
50
|
super();
|
|
43
51
|
this.rootDir = rootDir;
|
|
44
52
|
if (!(0, fs_1.existsSync)(rootDir))
|
|
@@ -46,7 +54,9 @@ class FileSystemRouter extends JsonRpcRouter_js_1.JsonRpcRouter {
|
|
|
46
54
|
const stat = (0, fs_1.lstatSync)(rootDir);
|
|
47
55
|
if (!stat.isDirectory())
|
|
48
56
|
throw new Error(`Not a directory: ${rootDir}`);
|
|
57
|
+
this.#pathFilter = parsePathFilter(options.pathFilter);
|
|
49
58
|
}
|
|
59
|
+
#pathFilter;
|
|
50
60
|
// instanceof JsonRpcMethodDefinition だと参照先モジュールが複数存在した際に一致しなくなる
|
|
51
61
|
static #isDefinition(obj) {
|
|
52
62
|
const key = obj?.constructor?.method;
|
|
@@ -67,8 +77,9 @@ class FileSystemRouter extends JsonRpcRouter_js_1.JsonRpcRouter {
|
|
|
67
77
|
: (0, fs_1.existsSync)(`${path}.ts`)
|
|
68
78
|
? `${path}.ts`
|
|
69
79
|
: null;
|
|
70
|
-
if (!filePath)
|
|
80
|
+
if (!filePath || !this.#pathFilter(filePath)) {
|
|
71
81
|
return this.#cache[methodPath] = null;
|
|
82
|
+
}
|
|
72
83
|
try {
|
|
73
84
|
const module = await Promise.resolve(`${filePath}`).then(s => __importStar(require(s)));
|
|
74
85
|
if (FileSystemRouter.#isDefinition(module.default)) {
|
|
@@ -101,6 +112,8 @@ class FileSystemRouter extends JsonRpcRouter_js_1.JsonRpcRouter {
|
|
|
101
112
|
}
|
|
102
113
|
async *enumerate() {
|
|
103
114
|
for (const name of (0, fs_1.readdirSync)(this.rootDir)) {
|
|
115
|
+
if (!this.#pathFilter(name))
|
|
116
|
+
continue;
|
|
104
117
|
yield name.replace(/\.(js|ts)$/, '');
|
|
105
118
|
}
|
|
106
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystemRouter.js","sourceRoot":"","sources":["../../src/router/FileSystemRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAwD;AAExD,yDAAmD;
|
|
1
|
+
{"version":3,"file":"FileSystemRouter.js","sourceRoot":"","sources":["../../src/router/FileSystemRouter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAwD;AAExD,yDAAmD;AAUnD,SAAS,eAAe,CAAC,MAA2C;IAChE,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IAC/B,IAAI,MAAM,YAAY,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,IAAY,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;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K,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,mCAAmC,IAAI,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,CAAE,SAAS;QACb,KAAI,MAAM,IAAI,IAAI,IAAA,gBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBAAE,SAAS;YACtC,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;CACJ;AA1ED,4CA0EC"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { lstatSync, readdirSync, existsSync } from 'fs';
|
|
2
2
|
import { JsonRpcRouter } from "./JsonRpcRouter.js";
|
|
3
|
+
function parsePathFilter(filter) {
|
|
4
|
+
if (!filter)
|
|
5
|
+
return () => true;
|
|
6
|
+
if (filter instanceof RegExp) {
|
|
7
|
+
return (path) => filter.test(path);
|
|
8
|
+
}
|
|
9
|
+
return filter;
|
|
10
|
+
}
|
|
3
11
|
export class FileSystemRouter extends JsonRpcRouter {
|
|
4
12
|
rootDir;
|
|
5
|
-
constructor(rootDir) {
|
|
13
|
+
constructor(rootDir, options = {}) {
|
|
6
14
|
super();
|
|
7
15
|
this.rootDir = rootDir;
|
|
8
16
|
if (!existsSync(rootDir))
|
|
@@ -10,7 +18,9 @@ export class FileSystemRouter extends JsonRpcRouter {
|
|
|
10
18
|
const stat = lstatSync(rootDir);
|
|
11
19
|
if (!stat.isDirectory())
|
|
12
20
|
throw new Error(`Not a directory: ${rootDir}`);
|
|
21
|
+
this.#pathFilter = parsePathFilter(options.pathFilter);
|
|
13
22
|
}
|
|
23
|
+
#pathFilter;
|
|
14
24
|
// instanceof JsonRpcMethodDefinition だと参照先モジュールが複数存在した際に一致しなくなる
|
|
15
25
|
static #isDefinition(obj) {
|
|
16
26
|
const key = obj?.constructor?.method;
|
|
@@ -31,8 +41,9 @@ export class FileSystemRouter extends JsonRpcRouter {
|
|
|
31
41
|
: existsSync(`${path}.ts`)
|
|
32
42
|
? `${path}.ts`
|
|
33
43
|
: null;
|
|
34
|
-
if (!filePath)
|
|
44
|
+
if (!filePath || !this.#pathFilter(filePath)) {
|
|
35
45
|
return this.#cache[methodPath] = null;
|
|
46
|
+
}
|
|
36
47
|
try {
|
|
37
48
|
const module = await import(filePath);
|
|
38
49
|
if (FileSystemRouter.#isDefinition(module.default)) {
|
|
@@ -65,6 +76,8 @@ export class FileSystemRouter extends JsonRpcRouter {
|
|
|
65
76
|
}
|
|
66
77
|
async *enumerate() {
|
|
67
78
|
for (const name of readdirSync(this.rootDir)) {
|
|
79
|
+
if (!this.#pathFilter(name))
|
|
80
|
+
continue;
|
|
68
81
|
yield name.replace(/\.(js|ts)$/, '');
|
|
69
82
|
}
|
|
70
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileSystemRouter.js","sourceRoot":"","sources":["../../src/router/FileSystemRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"FileSystemRouter.js","sourceRoot":"","sources":["../../src/router/FileSystemRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAExD,OAAO,EA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,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACvE,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC;QAEnC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACpC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,OAAO,CAAC,IAAI,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,mCAAmC,IAAI,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,CAAE,SAAS;QACb,KAAI,MAAM,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;gBAAE,SAAS;YACtC,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACzC,CAAC;IACL,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -6,13 +6,27 @@ type RouteCache<Ctx> = {
|
|
|
6
6
|
[path: string]: FileSystemRouter<Ctx>|JsonRpcMethodDefinition<Ctx, any, any>|null;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
type FileSystemRouterOptions = {
|
|
10
|
+
pathFilter?: (RegExp|((path: string) => boolean));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function parsePathFilter(filter?: RegExp|((path: string) => boolean)): (path: string) => boolean {
|
|
14
|
+
if (!filter) return () => true;
|
|
15
|
+
if (filter instanceof RegExp) {
|
|
16
|
+
return (path: string) => filter.test(path);
|
|
17
|
+
}
|
|
18
|
+
return filter;
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
export class FileSystemRouter<Ctx> extends JsonRpcRouter<Ctx> {
|
|
10
|
-
constructor(private readonly rootDir: string) {
|
|
22
|
+
constructor(private readonly rootDir: string, options: FileSystemRouterOptions = {}) {
|
|
11
23
|
super();
|
|
12
24
|
if (!existsSync(rootDir)) throw new Error(`Not found: ${rootDir}`);
|
|
13
25
|
const stat = lstatSync(rootDir);
|
|
14
26
|
if (!stat.isDirectory()) throw new Error(`Not a directory: ${rootDir}`);
|
|
27
|
+
this.#pathFilter = parsePathFilter(options.pathFilter);
|
|
15
28
|
}
|
|
29
|
+
readonly #pathFilter: (path: string) => boolean;
|
|
16
30
|
|
|
17
31
|
// instanceof JsonRpcMethodDefinition だと参照先モジュールが複数存在した際に一致しなくなる
|
|
18
32
|
static #isDefinition(obj: any): obj is JsonRpcMethodDefinition<any, any, any> {
|
|
@@ -36,7 +50,9 @@ export class FileSystemRouter<Ctx> extends JsonRpcRouter<Ctx> {
|
|
|
36
50
|
: existsSync(`${path}.ts`)
|
|
37
51
|
? `${path}.ts`
|
|
38
52
|
: null;
|
|
39
|
-
if (!filePath
|
|
53
|
+
if (!filePath || !this.#pathFilter(filePath)) {
|
|
54
|
+
return this.#cache[methodPath] = null;
|
|
55
|
+
}
|
|
40
56
|
|
|
41
57
|
try {
|
|
42
58
|
const module = await import(filePath);
|
|
@@ -72,6 +88,7 @@ export class FileSystemRouter<Ctx> extends JsonRpcRouter<Ctx> {
|
|
|
72
88
|
|
|
73
89
|
async * enumerate(): AsyncIterable<string> {
|
|
74
90
|
for(const name of readdirSync(this.rootDir)) {
|
|
91
|
+
if (!this.#pathFilter(name)) continue;
|
|
75
92
|
yield name.replace(/\.(js|ts)$/, '');
|
|
76
93
|
}
|
|
77
94
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { JsonRpcMethodDefinition } from "../JsonRpcMethod.js";
|
|
2
2
|
import { JsonRpcRouter } from "./JsonRpcRouter.js";
|
|
3
|
+
type FileSystemRouterOptions = {
|
|
4
|
+
pathFilter?: (RegExp | ((path: string) => boolean));
|
|
5
|
+
};
|
|
3
6
|
export declare class FileSystemRouter<Ctx> extends JsonRpcRouter<Ctx> {
|
|
4
7
|
#private;
|
|
5
8
|
private readonly rootDir;
|
|
6
|
-
constructor(rootDir: string);
|
|
9
|
+
constructor(rootDir: string, options?: FileSystemRouterOptions);
|
|
7
10
|
resolveChild(methodPath: string): Promise<any>;
|
|
8
11
|
resolve(methodPath: string | string[]): Promise<JsonRpcRouter<Ctx> | JsonRpcMethodDefinition<Ctx, any, any> | null>;
|
|
9
12
|
enumerate(): AsyncIterable<string>;
|
|
10
13
|
}
|
|
14
|
+
export {};
|