@bepalo/router 1.11.32 → 1.12.34

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.
Files changed (72) hide show
  1. package/dist/cjs/framework.d.ts +2 -4
  2. package/dist/cjs/framework.d.ts.map +1 -1
  3. package/dist/cjs/framework.js +4 -6
  4. package/dist/cjs/framework.js.map +1 -1
  5. package/dist/cjs/helpers.d.ts +2 -2
  6. package/dist/cjs/helpers.d.ts.map +1 -1
  7. package/dist/cjs/helpers.js +1 -1
  8. package/dist/cjs/helpers.js.map +1 -1
  9. package/dist/cjs/index.d.ts +5 -5
  10. package/dist/cjs/index.d.ts.map +1 -1
  11. package/dist/cjs/index.js +5 -5
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/middlewares.d.ts +2 -2
  14. package/dist/cjs/middlewares.d.ts.map +1 -1
  15. package/dist/cjs/middlewares.js +24 -24
  16. package/dist/cjs/middlewares.js.map +1 -1
  17. package/dist/cjs/router.d.ts +2 -2
  18. package/dist/cjs/router.d.ts.map +1 -1
  19. package/dist/cjs/router.js +8 -8
  20. package/dist/cjs/router.js.map +1 -1
  21. package/dist/cjs/types.d.ts +1 -1
  22. package/dist/cjs/types.d.ts.map +1 -1
  23. package/dist/cjs/upload-stream.d.ts +1 -1
  24. package/dist/cjs/upload-stream.d.ts.map +1 -1
  25. package/dist/cjs/upload-stream.js +7 -7
  26. package/dist/cjs/upload-stream.js.map +1 -1
  27. package/dist/framework.d.ts +2 -4
  28. package/dist/framework.d.ts.map +1 -1
  29. package/dist/framework.js +4 -6
  30. package/dist/framework.js.map +1 -1
  31. package/dist/helpers.d.ts +2 -2
  32. package/dist/helpers.d.ts.map +1 -1
  33. package/dist/helpers.js +1 -1
  34. package/dist/helpers.js.map +1 -1
  35. package/dist/index.d.ts +5 -5
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +5 -5
  38. package/dist/index.js.map +1 -1
  39. package/dist/middlewares.d.ts +2 -2
  40. package/dist/middlewares.d.ts.map +1 -1
  41. package/dist/middlewares.js +24 -24
  42. package/dist/middlewares.js.map +1 -1
  43. package/dist/router.d.ts +2 -2
  44. package/dist/router.d.ts.map +1 -1
  45. package/dist/router.js +8 -8
  46. package/dist/router.js.map +1 -1
  47. package/dist/types.d.ts +1 -1
  48. package/dist/types.d.ts.map +1 -1
  49. package/dist/upload-stream.d.ts +1 -1
  50. package/dist/upload-stream.d.ts.map +1 -1
  51. package/dist/upload-stream.js +7 -7
  52. package/dist/upload-stream.js.map +1 -1
  53. package/package.json +8 -1
  54. package/src/framework.deno.ts +194 -0
  55. package/src/framework.ts +197 -0
  56. package/src/helpers.ts +829 -0
  57. package/src/index.ts +5 -0
  58. package/src/list.ts +462 -0
  59. package/src/middlewares.deno.ts +855 -0
  60. package/src/middlewares.ts +851 -0
  61. package/src/router.ts +993 -0
  62. package/src/tree.ts +139 -0
  63. package/src/types.ts +197 -0
  64. package/src/upload-stream.ts +661 -0
  65. package/dist/cjs/framework.deno.d.ts +0 -31
  66. package/dist/cjs/framework.deno.d.ts.map +0 -1
  67. package/dist/cjs/framework.deno.js +0 -245
  68. package/dist/cjs/framework.deno.js.map +0 -1
  69. package/dist/framework.deno.d.ts +0 -31
  70. package/dist/framework.deno.d.ts.map +0 -1
  71. package/dist/framework.deno.js +0 -245
  72. package/dist/framework.deno.js.map +0 -1
@@ -1,245 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
45
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
46
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
47
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
48
- };
49
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
50
- if (kind === "m") throw new TypeError("Private method is not writable");
51
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
52
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
53
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
54
- };
55
- var __rest = (this && this.__rest) || function (s, e) {
56
- var t = {};
57
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
58
- t[p] = s[p];
59
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
60
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
62
- t[p[i]] = s[p[i]];
63
- }
64
- return t;
65
- };
66
- var __asyncValues = (this && this.__asyncValues) || function (o) {
67
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
68
- var m = o[Symbol.asyncIterator], i;
69
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
70
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
71
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
72
- };
73
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
74
- var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
75
- var i, p;
76
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
77
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
78
- };
79
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
80
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
81
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
82
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
83
- function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
84
- function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
85
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
86
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
87
- function fulfill(value) { resume("next", value); }
88
- function reject(value) { resume("throw", value); }
89
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
90
- };
91
- var _RouterFramework_rootPath, _RouterFramework_filterNode, _RouterFramework_processNode, _RouterFramework_onDir, _RouterFramework_loading, _RouterFramework_loaded;
92
- Object.defineProperty(exports, "__esModule", { value: true });
93
- exports.RouterFramework = void 0;
94
- exports.walk = walk;
95
- const router_1 = __importStar(require("./router"));
96
- const defaultValidExtensions = [".ts", ".js", ".tsx", ".jsx"];
97
- const defaultNodeFilter = (node) => defaultValidExtensions.some((ext) => node.name.endsWith(ext));
98
- const defaultNodeProcessor = (node) => {
99
- const extensionIndex = node.name.lastIndexOf(".");
100
- if (extensionIndex !== -1)
101
- node.name = node.name.slice(0, extensionIndex);
102
- };
103
- class RouterFramework extends router_1.default {
104
- get loading() {
105
- return __classPrivateFieldGet(this, _RouterFramework_loading, "f");
106
- }
107
- get loaded() {
108
- return __classPrivateFieldGet(this, _RouterFramework_loaded, "f");
109
- }
110
- constructor(config) {
111
- const _a = config !== null && config !== void 0 ? config : {}, { rootPath, filterNode, processNode, onDir } = _a, baseConfig = __rest(_a, ["rootPath", "filterNode", "processNode", "onDir"]);
112
- super(baseConfig);
113
- _RouterFramework_rootPath.set(this, void 0);
114
- _RouterFramework_filterNode.set(this, void 0);
115
- _RouterFramework_processNode.set(this, void 0);
116
- _RouterFramework_onDir.set(this, void 0);
117
- _RouterFramework_loading.set(this, false);
118
- _RouterFramework_loaded.set(this, false);
119
- __classPrivateFieldSet(this, _RouterFramework_rootPath, rootPath || "./routes", "f");
120
- __classPrivateFieldSet(this, _RouterFramework_filterNode, filterNode !== null && filterNode !== void 0 ? filterNode : defaultNodeFilter, "f");
121
- __classPrivateFieldSet(this, _RouterFramework_processNode, processNode !== null && processNode !== void 0 ? processNode : defaultNodeProcessor, "f");
122
- __classPrivateFieldSet(this, _RouterFramework_onDir, onDir, "f");
123
- }
124
- load() {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- var _a, e_1, _b, _c;
127
- if (__classPrivateFieldGet(this, _RouterFramework_loading, "f") || __classPrivateFieldGet(this, _RouterFramework_loaded, "f")) {
128
- throw new Error("RouterFramework already loading or loaded");
129
- }
130
- __classPrivateFieldSet(this, _RouterFramework_loading, true, "f");
131
- try {
132
- for (var _d = true, _e = __asyncValues(walk(__classPrivateFieldGet(this, _RouterFramework_rootPath, "f"))), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
133
- _c = _f.value;
134
- _d = false;
135
- let node = _c;
136
- if (node.type !== "dir") {
137
- let handlersImp;
138
- let handlers;
139
- try {
140
- handlersImp = yield Promise.resolve(`${`file://${node.fullPath}`}`).then(s => __importStar(require(s)));
141
- handlers = handlersImp === null || handlersImp === void 0 ? void 0 : handlersImp.default;
142
- }
143
- catch (error) {
144
- console.error(`Failed to import route at ${node.fullPath}:`, error);
145
- }
146
- // filter the node
147
- if (!handlers || !(__classPrivateFieldGet(this, _RouterFramework_filterNode, "f") && __classPrivateFieldGet(this, _RouterFramework_filterNode, "f").call(this, node))) {
148
- continue;
149
- }
150
- // process the node
151
- if (__classPrivateFieldGet(this, _RouterFramework_processNode, "f"))
152
- __classPrivateFieldGet(this, _RouterFramework_processNode, "f").call(this, node);
153
- const name = node.name;
154
- let path;
155
- switch (name) {
156
- case "[$$]":
157
- path = `${node.parent ? "/" + node.parent + "/" : "/"}.**`;
158
- break;
159
- case "($$)":
160
- path = `${node.parent ? "/" + node.parent + "/" : "/"}**`;
161
- break;
162
- case "[$]":
163
- path = `${node.parent ? "/" + node.parent + "/" : "/"}.*`;
164
- break;
165
- case "($)":
166
- path = `${node.parent ? "/" + node.parent + "/" : "/"}*`;
167
- break;
168
- case "index":
169
- path = "/" + node.parent;
170
- break;
171
- default:
172
- path = `${node.parent ? "/" + node.parent + "/" : "/"}${name}`;
173
- break;
174
- }
175
- // replace (param) with :param
176
- path = path.replace(/\[([^\/]+?)\]/g, ":$1");
177
- // set handlers
178
- for (const [method, methodHandlers] of Object.entries(handlers)) {
179
- for (const [uchandlerType, pipeline] of Object.entries(methodHandlers)) {
180
- const handlerType = uchandlerType.toLowerCase();
181
- if ((0, router_1.isValidHttpMethod)(method) ||
182
- method === "ALL" ||
183
- method === "CRUD") {
184
- this.setRoutes(handlerType, `${method} ${path}`, pipeline);
185
- }
186
- else {
187
- throw new Error(`Invalid http method '${method}'`);
188
- }
189
- }
190
- }
191
- }
192
- else if (__classPrivateFieldGet(this, _RouterFramework_onDir, "f")) {
193
- __classPrivateFieldGet(this, _RouterFramework_onDir, "f").call(this, node);
194
- }
195
- }
196
- }
197
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
198
- finally {
199
- try {
200
- if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
201
- }
202
- finally { if (e_1) throw e_1.error; }
203
- }
204
- __classPrivateFieldSet(this, _RouterFramework_loading, false, "f");
205
- __classPrivateFieldSet(this, _RouterFramework_loaded, true, "f");
206
- return this;
207
- });
208
- }
209
- }
210
- exports.RouterFramework = RouterFramework;
211
- _RouterFramework_rootPath = new WeakMap(), _RouterFramework_filterNode = new WeakMap(), _RouterFramework_processNode = new WeakMap(), _RouterFramework_onDir = new WeakMap(), _RouterFramework_loading = new WeakMap(), _RouterFramework_loaded = new WeakMap();
212
- function walk(dir, rootPath) {
213
- return __asyncGenerator(this, arguments, function* walk_1() {
214
- var _a, e_2, _b, _c;
215
- rootPath = rootPath || dir;
216
- const { join, resolve, relative } = yield __await(Promise.resolve().then(() => __importStar(require("jsr:@std/path@1"))));
217
- try {
218
- for (var _d = true, _e = __asyncValues(Deno.readDir(dir)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
219
- _c = _f.value;
220
- _d = false;
221
- const entry = _c;
222
- const name = entry.name;
223
- const parent = relative(rootPath, dir).replace(/\\/g, "/");
224
- const path = join(dir, name).replace(/\\/g, "/");
225
- const fullPath = resolve(dir, name).replace(/\\/g, "/");
226
- const relativePath = relative(rootPath, path).replace(/\\/g, "/");
227
- if (entry.isDirectory) {
228
- yield yield __await({ type: "dir", name, path, parent, fullPath, relativePath });
229
- yield __await(yield* __asyncDelegator(__asyncValues(walk(path, rootPath))));
230
- }
231
- else {
232
- yield yield __await({ type: "file", name, path, parent, fullPath, relativePath });
233
- }
234
- }
235
- }
236
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
237
- finally {
238
- try {
239
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
240
- }
241
- finally { if (e_2) throw e_2.error; }
242
- }
243
- });
244
- }
245
- //# sourceMappingURL=framework.deno.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"framework.deno.js","sourceRoot":"","sources":["../../src/framework.deno.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KA,oBAmBC;AAjMD,mDAIkB;AAUlB,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9D,MAAM,iBAAiB,GAAG,CAAC,IAAiB,EAAE,EAAE,CAC9C,sBAAsB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAChE,MAAM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AAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBAClE,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;oBACtB,oBAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA,CAAC;oBAClE,cAAA,KAAK,CAAC,CAAC,iBAAA,cAAA,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA,CAAA,CAAA,CAAC;gBAC9B,CAAC;qBAAM,CAAC;oBACN,oBAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAA,CAAC;gBACrE,CAAC;YACH,CAAC;;;;;;;;;IACH,CAAC;CAAA"}
@@ -1,31 +0,0 @@
1
- import Router, { RouterConfig, RouterContext } from "./router";
2
- import type { Handler, HttpMethod, Pipeline, CTXError } from "./types";
3
- export type UCHandlerType = "FILTER" | "HOOK" | "HANDLER" | "FALLBACK" | "CATCHER" | "AFTER";
4
- export type RouterHandlers<CommonXContext = {}, MethodContexts extends Partial<Record<HttpMethod | "ALL" | "CRUD", Record<string, any>>> = {}> = {
5
- [K in HttpMethod | "ALL" | "CRUD" as K]?: {
6
- [H in UCHandlerType as H]?: H extends "CATCHER" ? Handler<CommonXContext & CTXError & MethodContexts[K]> | Pipeline<CommonXContext & CTXError & MethodContexts[K]> : Handler<CommonXContext & MethodContexts[K]> | Pipeline<CommonXContext & MethodContexts[K]>;
7
- };
8
- };
9
- export interface RouterFrameworkConfig<Context extends RouterContext = RouterContext> extends RouterConfig<Context> {
10
- rootPath?: string;
11
- filterNode?: (node: DirWalkNode) => boolean;
12
- processNode?: (node: DirWalkNode) => void;
13
- onDir?: (node: DirWalkNode) => void;
14
- }
15
- export declare class RouterFramework<EXTContext = {}, Context extends RouterContext<EXTContext> = RouterContext<EXTContext>> extends Router<Context> {
16
- #private;
17
- get loading(): boolean;
18
- get loaded(): boolean;
19
- constructor(config?: RouterFrameworkConfig<Context>);
20
- load(): Promise<RouterFramework<Context>>;
21
- }
22
- export interface DirWalkNode {
23
- type: string;
24
- name: string;
25
- path: string;
26
- parent: string;
27
- fullPath: string;
28
- relativePath: string;
29
- }
30
- export declare function walk(dir: string, rootPath?: string): AsyncGenerator<DirWalkNode>;
31
- //# sourceMappingURL=framework.deno.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"framework.deno.d.ts","sourceRoot":"","sources":["../src/framework.deno.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAEb,YAAY,EACZ,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,OAAO,EAEP,UAAU,EAEV,QAAQ,EACR,QAAQ,EACT,MAAM,SAAS,CAAC;AAUjB,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,MAAM,GACN,SAAS,GACT,UAAU,GACV,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,MAAM,cAAc,CACxB,cAAc,GAAG,EAAE,EACnB,cAAc,SAAS,OAAO,CAC5B,MAAM,CAAC,UAAU,GAAG,KAAK,GAAG,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CACzD,GAAG,EAAE,IACJ;KACD,CAAC,IAAI,UAAU,GAAG,KAAK,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE;SACvC,CAAC,IAAI,aAAa,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,SAAS,GAEvC,OAAO,CAAC,cAAc,GAAG,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GACtD,QAAQ,CAAC,cAAc,GAAG,QAAQ,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GAEvD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,GAC3C,QAAQ,CAAC,cAAc,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;KACrD;CACF,CAAC;AAEF,MAAM,WAAW,qBAAqB,CACpC,OAAO,SAAS,aAAa,GAAG,aAAa,CAC7C,SAAQ,YAAY,CAAC,OAAO,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,OAAO,CAAC;IAC5C,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC1C,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;CACrC;AAED,qBAAa,eAAe,CAC1B,UAAU,GAAG,EAAE,EACf,OAAO,SAAS,aAAa,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,CACrE,SAAQ,MAAM,CAAC,OAAO,CAAC;;IAQvB,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,MAAM,IAAI,OAAO,CAEpB;gBAEW,MAAM,CAAC,EAAE,qBAAqB,CAAC,OAAO,CAAC;IAU7C,IAAI,IAAI,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;CA8EhD;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAuB,IAAI,CACzB,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,GAChB,cAAc,CAAC,WAAW,CAAC,CAgB7B"}
@@ -1,245 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
45
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
46
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
47
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
48
- };
49
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
50
- if (kind === "m") throw new TypeError("Private method is not writable");
51
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
52
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
53
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
54
- };
55
- var __rest = (this && this.__rest) || function (s, e) {
56
- var t = {};
57
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
58
- t[p] = s[p];
59
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
60
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
62
- t[p[i]] = s[p[i]];
63
- }
64
- return t;
65
- };
66
- var __asyncValues = (this && this.__asyncValues) || function (o) {
67
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
68
- var m = o[Symbol.asyncIterator], i;
69
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
70
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
71
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
72
- };
73
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
74
- var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
75
- var i, p;
76
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
77
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
78
- };
79
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
80
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
81
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
82
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
83
- function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
84
- function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
85
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
86
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
87
- function fulfill(value) { resume("next", value); }
88
- function reject(value) { resume("throw", value); }
89
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
90
- };
91
- var _RouterFramework_rootPath, _RouterFramework_filterNode, _RouterFramework_processNode, _RouterFramework_onDir, _RouterFramework_loading, _RouterFramework_loaded;
92
- Object.defineProperty(exports, "__esModule", { value: true });
93
- exports.RouterFramework = void 0;
94
- exports.walk = walk;
95
- const router_1 = __importStar(require("./router"));
96
- const defaultValidExtensions = [".ts", ".js", ".tsx", ".jsx"];
97
- const defaultNodeFilter = (node) => defaultValidExtensions.some((ext) => node.name.endsWith(ext));
98
- const defaultNodeProcessor = (node) => {
99
- const extensionIndex = node.name.lastIndexOf(".");
100
- if (extensionIndex !== -1)
101
- node.name = node.name.slice(0, extensionIndex);
102
- };
103
- class RouterFramework extends router_1.default {
104
- get loading() {
105
- return __classPrivateFieldGet(this, _RouterFramework_loading, "f");
106
- }
107
- get loaded() {
108
- return __classPrivateFieldGet(this, _RouterFramework_loaded, "f");
109
- }
110
- constructor(config) {
111
- const _a = config !== null && config !== void 0 ? config : {}, { rootPath, filterNode, processNode, onDir } = _a, baseConfig = __rest(_a, ["rootPath", "filterNode", "processNode", "onDir"]);
112
- super(baseConfig);
113
- _RouterFramework_rootPath.set(this, void 0);
114
- _RouterFramework_filterNode.set(this, void 0);
115
- _RouterFramework_processNode.set(this, void 0);
116
- _RouterFramework_onDir.set(this, void 0);
117
- _RouterFramework_loading.set(this, false);
118
- _RouterFramework_loaded.set(this, false);
119
- __classPrivateFieldSet(this, _RouterFramework_rootPath, rootPath || "./routes", "f");
120
- __classPrivateFieldSet(this, _RouterFramework_filterNode, filterNode !== null && filterNode !== void 0 ? filterNode : defaultNodeFilter, "f");
121
- __classPrivateFieldSet(this, _RouterFramework_processNode, processNode !== null && processNode !== void 0 ? processNode : defaultNodeProcessor, "f");
122
- __classPrivateFieldSet(this, _RouterFramework_onDir, onDir, "f");
123
- }
124
- load() {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- var _a, e_1, _b, _c;
127
- if (__classPrivateFieldGet(this, _RouterFramework_loading, "f") || __classPrivateFieldGet(this, _RouterFramework_loaded, "f")) {
128
- throw new Error("RouterFramework already loading or loaded");
129
- }
130
- __classPrivateFieldSet(this, _RouterFramework_loading, true, "f");
131
- try {
132
- for (var _d = true, _e = __asyncValues(walk(__classPrivateFieldGet(this, _RouterFramework_rootPath, "f"))), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
133
- _c = _f.value;
134
- _d = false;
135
- let node = _c;
136
- if (node.type !== "dir") {
137
- let handlersImp;
138
- let handlers;
139
- try {
140
- handlersImp = yield import(`file://${node.fullPath}`);
141
- handlers = handlersImp === null || handlersImp === void 0 ? void 0 : handlersImp.default;
142
- }
143
- catch (error) {
144
- console.error(`Failed to import route at ${node.fullPath}:`, error);
145
- }
146
- // filter the node
147
- if (!handlers || !(__classPrivateFieldGet(this, _RouterFramework_filterNode, "f") && __classPrivateFieldGet(this, _RouterFramework_filterNode, "f").call(this, node))) {
148
- continue;
149
- }
150
- // process the node
151
- if (__classPrivateFieldGet(this, _RouterFramework_processNode, "f"))
152
- __classPrivateFieldGet(this, _RouterFramework_processNode, "f").call(this, node);
153
- const name = node.name;
154
- let path;
155
- switch (name) {
156
- case "[$$]":
157
- path = `${node.parent ? "/" + node.parent + "/" : "/"}.**`;
158
- break;
159
- case "($$)":
160
- path = `${node.parent ? "/" + node.parent + "/" : "/"}**`;
161
- break;
162
- case "[$]":
163
- path = `${node.parent ? "/" + node.parent + "/" : "/"}.*`;
164
- break;
165
- case "($)":
166
- path = `${node.parent ? "/" + node.parent + "/" : "/"}*`;
167
- break;
168
- case "index":
169
- path = "/" + node.parent;
170
- break;
171
- default:
172
- path = `${node.parent ? "/" + node.parent + "/" : "/"}${name}`;
173
- break;
174
- }
175
- // replace (param) with :param
176
- path = path.replace(/\[([^\/]+?)\]/g, ":$1");
177
- // set handlers
178
- for (const [method, methodHandlers] of Object.entries(handlers)) {
179
- for (const [uchandlerType, pipeline] of Object.entries(methodHandlers)) {
180
- const handlerType = uchandlerType.toLowerCase();
181
- if ((0, router_1.isValidHttpMethod)(method) ||
182
- method === "ALL" ||
183
- method === "CRUD") {
184
- this.setRoutes(handlerType, `${method} ${path}`, pipeline);
185
- }
186
- else {
187
- throw new Error(`Invalid http method '${method}'`);
188
- }
189
- }
190
- }
191
- }
192
- else if (__classPrivateFieldGet(this, _RouterFramework_onDir, "f")) {
193
- __classPrivateFieldGet(this, _RouterFramework_onDir, "f").call(this, node);
194
- }
195
- }
196
- }
197
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
198
- finally {
199
- try {
200
- if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
201
- }
202
- finally { if (e_1) throw e_1.error; }
203
- }
204
- __classPrivateFieldSet(this, _RouterFramework_loading, false, "f");
205
- __classPrivateFieldSet(this, _RouterFramework_loaded, true, "f");
206
- return this;
207
- });
208
- }
209
- }
210
- exports.RouterFramework = RouterFramework;
211
- _RouterFramework_rootPath = new WeakMap(), _RouterFramework_filterNode = new WeakMap(), _RouterFramework_processNode = new WeakMap(), _RouterFramework_onDir = new WeakMap(), _RouterFramework_loading = new WeakMap(), _RouterFramework_loaded = new WeakMap();
212
- function walk(dir, rootPath) {
213
- return __asyncGenerator(this, arguments, function* walk_1() {
214
- var _a, e_2, _b, _c;
215
- rootPath = rootPath || dir;
216
- const { join, resolve, relative } = yield __await(import("jsr:@std/path@1"));
217
- try {
218
- for (var _d = true, _e = __asyncValues(Deno.readDir(dir)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
219
- _c = _f.value;
220
- _d = false;
221
- const entry = _c;
222
- const name = entry.name;
223
- const parent = relative(rootPath, dir).replace(/\\/g, "/");
224
- const path = join(dir, name).replace(/\\/g, "/");
225
- const fullPath = resolve(dir, name).replace(/\\/g, "/");
226
- const relativePath = relative(rootPath, path).replace(/\\/g, "/");
227
- if (entry.isDirectory) {
228
- yield yield __await({ type: "dir", name, path, parent, fullPath, relativePath });
229
- yield __await(yield* __asyncDelegator(__asyncValues(walk(path, rootPath))));
230
- }
231
- else {
232
- yield yield __await({ type: "file", name, path, parent, fullPath, relativePath });
233
- }
234
- }
235
- }
236
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
237
- finally {
238
- try {
239
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
240
- }
241
- finally { if (e_2) throw e_2.error; }
242
- }
243
- });
244
- }
245
- //# sourceMappingURL=framework.deno.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"framework.deno.js","sourceRoot":"","sources":["../src/framework.deno.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8KA,oBAmBC;AAjMD,mDAIkB;AAUlB,MAAM,sBAAsB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC9D,MAAM,iBAAiB,GAA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