@stacksjs/router 0.58.28 → 0.58.44
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/index.js +15 -496
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/middleware.ts
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import {promisify} from "util";
|
|
5
|
-
|
|
6
2
|
// /home/runner/work/stacks/stacks/storage/framework/core/path/src/index.ts
|
|
7
3
|
import process2 from "process";
|
|
8
4
|
|
|
@@ -81,60 +77,7 @@ var normalizeString = function(path, allowAboveRoot) {
|
|
|
81
77
|
return res;
|
|
82
78
|
};
|
|
83
79
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
84
|
-
var _UNC_REGEX = /^[/\\]{2}/;
|
|
85
80
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
86
|
-
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
87
|
-
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
88
|
-
var sep = "/";
|
|
89
|
-
var delimiter = ":";
|
|
90
|
-
var normalize = function(path) {
|
|
91
|
-
if (path.length === 0) {
|
|
92
|
-
return ".";
|
|
93
|
-
}
|
|
94
|
-
path = normalizeWindowsPath(path);
|
|
95
|
-
const isUNCPath = path.match(_UNC_REGEX);
|
|
96
|
-
const isPathAbsolute = isAbsolute(path);
|
|
97
|
-
const trailingSeparator = path[path.length - 1] === "/";
|
|
98
|
-
path = normalizeString(path, !isPathAbsolute);
|
|
99
|
-
if (path.length === 0) {
|
|
100
|
-
if (isPathAbsolute) {
|
|
101
|
-
return "/";
|
|
102
|
-
}
|
|
103
|
-
return trailingSeparator ? "./" : ".";
|
|
104
|
-
}
|
|
105
|
-
if (trailingSeparator) {
|
|
106
|
-
path += "/";
|
|
107
|
-
}
|
|
108
|
-
if (_DRIVE_LETTER_RE.test(path)) {
|
|
109
|
-
path += "/";
|
|
110
|
-
}
|
|
111
|
-
if (isUNCPath) {
|
|
112
|
-
if (!isPathAbsolute) {
|
|
113
|
-
return `//./${path}`;
|
|
114
|
-
}
|
|
115
|
-
return `//${path}`;
|
|
116
|
-
}
|
|
117
|
-
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
118
|
-
};
|
|
119
|
-
var join = function(...arguments_) {
|
|
120
|
-
if (arguments_.length === 0) {
|
|
121
|
-
return ".";
|
|
122
|
-
}
|
|
123
|
-
let joined;
|
|
124
|
-
for (const argument of arguments_) {
|
|
125
|
-
if (argument && argument.length > 0) {
|
|
126
|
-
if (joined === undefined) {
|
|
127
|
-
joined = argument;
|
|
128
|
-
} else {
|
|
129
|
-
joined += `/${argument}`;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
if (joined === undefined) {
|
|
134
|
-
return ".";
|
|
135
|
-
}
|
|
136
|
-
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
137
|
-
};
|
|
138
81
|
var resolve = function(...arguments_) {
|
|
139
82
|
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
140
83
|
let resolvedPath = "";
|
|
@@ -156,443 +99,20 @@ var resolve = function(...arguments_) {
|
|
|
156
99
|
var isAbsolute = function(p) {
|
|
157
100
|
return _IS_ABSOLUTE_RE.test(p);
|
|
158
101
|
};
|
|
159
|
-
var toNamespacedPath = function(p) {
|
|
160
|
-
return normalizeWindowsPath(p);
|
|
161
|
-
};
|
|
162
|
-
var _EXTNAME_RE = /.(\.[^./]+)$/;
|
|
163
|
-
var extname = function(p) {
|
|
164
|
-
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
165
|
-
return match && match[1] || "";
|
|
166
|
-
};
|
|
167
|
-
var relative = function(from, to) {
|
|
168
|
-
const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
169
|
-
const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
170
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) {
|
|
171
|
-
return _to.join("/");
|
|
172
|
-
}
|
|
173
|
-
const _fromCopy = [..._from];
|
|
174
|
-
for (const segment of _fromCopy) {
|
|
175
|
-
if (_to[0] !== segment) {
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
_from.shift();
|
|
179
|
-
_to.shift();
|
|
180
|
-
}
|
|
181
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
182
|
-
};
|
|
183
|
-
var dirname = function(p) {
|
|
184
|
-
const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
185
|
-
if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) {
|
|
186
|
-
segments[0] += "/";
|
|
187
|
-
}
|
|
188
|
-
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
189
|
-
};
|
|
190
|
-
var format = function(p) {
|
|
191
|
-
const segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
|
|
192
|
-
return normalizeWindowsPath(p.root ? resolve(...segments) : segments.join("/"));
|
|
193
|
-
};
|
|
194
|
-
var basename = function(p, extension) {
|
|
195
|
-
const lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
196
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
197
|
-
};
|
|
198
|
-
var parse = function(p) {
|
|
199
|
-
const root = normalizeWindowsPath(p).split("/").shift() || "/";
|
|
200
|
-
const base = basename(p);
|
|
201
|
-
const extension = extname(base);
|
|
202
|
-
return {
|
|
203
|
-
root,
|
|
204
|
-
dir: dirname(p),
|
|
205
|
-
base,
|
|
206
|
-
ext: extension,
|
|
207
|
-
name: base.slice(0, base.length - extension.length)
|
|
208
|
-
};
|
|
209
|
-
};
|
|
210
102
|
// /home/runner/work/stacks/stacks/storage/framework/core/path/src/index.ts
|
|
211
|
-
function actionsPath(path2) {
|
|
212
|
-
return corePath(`actions/src/${path2 || ""}`);
|
|
213
|
-
}
|
|
214
|
-
function relativeActionsPath(path2) {
|
|
215
|
-
return relative(projectPath(), actionsPath(path2));
|
|
216
|
-
}
|
|
217
|
-
function aiPath(path2) {
|
|
218
|
-
return corePath(`ai/${path2 || ""}`);
|
|
219
|
-
}
|
|
220
|
-
function assetsPath(path2) {
|
|
221
|
-
return resourcesPath(`assets/${path2 || ""}`);
|
|
222
|
-
}
|
|
223
|
-
function aliasPath() {
|
|
224
|
-
return corePath("alias/src/index.ts");
|
|
225
|
-
}
|
|
226
|
-
function analyticsPath(path2) {
|
|
227
|
-
return corePath(`analytics/${path2 || ""}`);
|
|
228
|
-
}
|
|
229
|
-
function arraysPath(path2) {
|
|
230
|
-
return corePath(`arrays/${path2 || ""}`);
|
|
231
|
-
}
|
|
232
103
|
function appPath(path2) {
|
|
233
104
|
return projectPath(`app/${path2 || ""}`);
|
|
234
105
|
}
|
|
235
|
-
function authPath(path2) {
|
|
236
|
-
return corePath(`auth/${path2 || ""}`);
|
|
237
|
-
}
|
|
238
|
-
function buildPath(path2) {
|
|
239
|
-
return corePath(`build/${path2 || ""}`);
|
|
240
|
-
}
|
|
241
|
-
function buildEnginePath(path2) {
|
|
242
|
-
return buildPath(`${path2 || ""}`);
|
|
243
|
-
}
|
|
244
|
-
function libsPath(path2) {
|
|
245
|
-
return frameworkPath(`libs/${path2 || ""}`);
|
|
246
|
-
}
|
|
247
|
-
function libsEntriesPath(path2) {
|
|
248
|
-
return libsPath(`entries/${path2 || ""}`);
|
|
249
|
-
}
|
|
250
|
-
function cachePath(path2) {
|
|
251
|
-
return corePath(`cache/${path2 || ""}`);
|
|
252
|
-
}
|
|
253
|
-
function chatPath(path2) {
|
|
254
|
-
return corePath(`chat/${path2 || ""}`);
|
|
255
|
-
}
|
|
256
|
-
function cliPath(path2) {
|
|
257
|
-
return corePath(`cli/${path2 || ""}`);
|
|
258
|
-
}
|
|
259
|
-
function cloudPath(path2) {
|
|
260
|
-
return corePath(`cloud/${path2 || ""}`);
|
|
261
|
-
}
|
|
262
|
-
function collectionsPath(path2) {
|
|
263
|
-
return corePath(`collections/${path2 || ""}`);
|
|
264
|
-
}
|
|
265
|
-
function componentsPath(path2) {
|
|
266
|
-
return resourcesPath(`components/${path2 || ""}`);
|
|
267
|
-
}
|
|
268
|
-
function configPath(path2) {
|
|
269
|
-
return corePath(`config/${path2 || ""}`);
|
|
270
|
-
}
|
|
271
|
-
function corePath(path2) {
|
|
272
|
-
return frameworkPath(`core/${path2 || ""}`);
|
|
273
|
-
}
|
|
274
|
-
function customElementsDataPath() {
|
|
275
|
-
return frameworkPath("core/custom-elements.json");
|
|
276
|
-
}
|
|
277
|
-
function databasePath(path2) {
|
|
278
|
-
return corePath(`database/${path2 || ""}`);
|
|
279
|
-
}
|
|
280
|
-
function datetimePath(path2) {
|
|
281
|
-
return corePath(`datetime/${path2 || ""}`);
|
|
282
|
-
}
|
|
283
|
-
function developmentPath(path2) {
|
|
284
|
-
return corePath(`development/${path2 || ""}`);
|
|
285
|
-
}
|
|
286
|
-
function desktopPath(path2) {
|
|
287
|
-
return corePath(`desktop/${path2 || ""}`);
|
|
288
|
-
}
|
|
289
|
-
function docsPath(path2) {
|
|
290
|
-
return corePath(`docs/${path2 || ""}`);
|
|
291
|
-
}
|
|
292
|
-
function dnsPath(path2) {
|
|
293
|
-
return corePath(`domains/${path2 || ""}`);
|
|
294
|
-
}
|
|
295
|
-
function emailPath(path2) {
|
|
296
|
-
return notificationsPath(`email/${path2 || ""}`);
|
|
297
|
-
}
|
|
298
|
-
function enumsPath(path2) {
|
|
299
|
-
return corePath(`enums/${path2 || ""}`);
|
|
300
|
-
}
|
|
301
|
-
function errorHandlingPath(path2) {
|
|
302
|
-
return corePath(`error-handling/${path2 || ""}`);
|
|
303
|
-
}
|
|
304
|
-
function eventsPath(path2) {
|
|
305
|
-
return corePath(`events/${path2 || ""}`);
|
|
306
|
-
}
|
|
307
|
-
function coreEnvPath(path2) {
|
|
308
|
-
return corePath(`env/${path2 || ""}`);
|
|
309
|
-
}
|
|
310
|
-
function examplesPath(type) {
|
|
311
|
-
return frameworkPath(`examples/${type || ""}`);
|
|
312
|
-
}
|
|
313
|
-
function fakerPath(path2) {
|
|
314
|
-
return corePath(`faker/${path2 || ""}`);
|
|
315
|
-
}
|
|
316
|
-
function frameworkPath(path2) {
|
|
317
|
-
return projectStoragePath(`framework/${path2 || ""}`);
|
|
318
|
-
}
|
|
319
|
-
function healthPath(path2) {
|
|
320
|
-
return corePath(`health/${path2 || ""}`);
|
|
321
|
-
}
|
|
322
|
-
function functionsPath(path2) {
|
|
323
|
-
return resourcesPath(`functions/${path2 || ""}`);
|
|
324
|
-
}
|
|
325
|
-
function gitPath(path2) {
|
|
326
|
-
return corePath(`git/${path2 || ""}`);
|
|
327
|
-
}
|
|
328
|
-
function langPath(path2) {
|
|
329
|
-
return projectPath(`lang/${path2 || ""}`);
|
|
330
|
-
}
|
|
331
|
-
function layoutsPath(path2) {
|
|
332
|
-
return resourcesPath(`layouts/${path2 || ""}`);
|
|
333
|
-
}
|
|
334
|
-
function libraryEntryPath(type) {
|
|
335
|
-
return libsEntriesPath(`${type}.ts`);
|
|
336
|
-
}
|
|
337
|
-
function lintPath(path2) {
|
|
338
|
-
return corePath(`lint/${path2 || ""}`);
|
|
339
|
-
}
|
|
340
|
-
function loggingPath(path2) {
|
|
341
|
-
return corePath(`logging/${path2 || ""}`);
|
|
342
|
-
}
|
|
343
|
-
function modulesPath(path2) {
|
|
344
|
-
return resourcesPath(`modules/${path2 || ""}`);
|
|
345
|
-
}
|
|
346
|
-
function notificationsPath(path2) {
|
|
347
|
-
return corePath(`notifications/${path2 || ""}`);
|
|
348
|
-
}
|
|
349
|
-
function ormPath(path2) {
|
|
350
|
-
return corePath(`orm/${path2 || ""}`);
|
|
351
|
-
}
|
|
352
|
-
function objectsPath(path2) {
|
|
353
|
-
return corePath(`objects/${path2 || ""}`);
|
|
354
|
-
}
|
|
355
|
-
function onboardingPath(path2) {
|
|
356
|
-
return projectPath(`${path2 || "views/dashboard/onboarding"}`);
|
|
357
|
-
}
|
|
358
|
-
function packageJsonPath(type) {
|
|
359
|
-
if (type === "vue-components")
|
|
360
|
-
return frameworkPath("libs/components/vue/package.json");
|
|
361
|
-
if (type === "web-components")
|
|
362
|
-
return frameworkPath("libs/components/web/package.json");
|
|
363
|
-
return frameworkPath(`libs/${type}/package.json`);
|
|
364
|
-
}
|
|
365
|
-
function viewsPath(path2) {
|
|
366
|
-
return resourcesPath(`views/${path2 || ""}`);
|
|
367
|
-
}
|
|
368
|
-
function pathPath(path2) {
|
|
369
|
-
return corePath(`path/${path2 || ""}`);
|
|
370
|
-
}
|
|
371
|
-
function paymentsPath(path2) {
|
|
372
|
-
return corePath(`payments/${path2 || ""}`);
|
|
373
|
-
}
|
|
374
106
|
function projectPath(filePath = "") {
|
|
375
107
|
let path2 = process2.cwd();
|
|
376
108
|
while (path2.includes("storage"))
|
|
377
109
|
path2 = resolve(path2, "..");
|
|
378
110
|
return resolve(path2, filePath);
|
|
379
111
|
}
|
|
380
|
-
function projectConfigPath(path2) {
|
|
381
|
-
return projectPath(`config/${path2 || ""}`);
|
|
382
|
-
}
|
|
383
|
-
function projectStoragePath(path2) {
|
|
384
|
-
return projectPath(`storage/${path2 || ""}`);
|
|
385
|
-
}
|
|
386
|
-
function publicPath(path2) {
|
|
387
|
-
return projectPath(`public/${path2 || ""}`);
|
|
388
|
-
}
|
|
389
|
-
function pushPath(path2) {
|
|
390
|
-
return notificationsPath(`push/${path2 || ""}`);
|
|
391
|
-
}
|
|
392
|
-
function queryBuilderPath(path2) {
|
|
393
|
-
return corePath(`query-builder/${path2 || ""}`);
|
|
394
|
-
}
|
|
395
|
-
function queuePath(path2) {
|
|
396
|
-
return corePath(`queue/${path2 || ""}`);
|
|
397
|
-
}
|
|
398
|
-
function realtimePath(path2) {
|
|
399
|
-
return corePath(`realtime/${path2 || ""}`);
|
|
400
|
-
}
|
|
401
|
-
function resourcesPath(path2) {
|
|
402
|
-
return projectPath(`resources/${path2 || ""}`);
|
|
403
|
-
}
|
|
404
|
-
function replPath(path2) {
|
|
405
|
-
return corePath(`repl/${path2 || ""}`);
|
|
406
|
-
}
|
|
407
|
-
function routerPath(path2) {
|
|
408
|
-
return corePath(`router/${path2 || ""}`);
|
|
409
|
-
}
|
|
410
|
-
function routesPath(path2) {
|
|
411
|
-
return projectPath(`routes/${path2 || ""}`);
|
|
412
|
-
}
|
|
413
|
-
function searchEnginePath(path2) {
|
|
414
|
-
return corePath(`search-engine/${path2 || ""}`);
|
|
415
|
-
}
|
|
416
|
-
function settingsPath(path2) {
|
|
417
|
-
return projectPath(`${path2 || "views/dashboard/settings"}`);
|
|
418
|
-
}
|
|
419
|
-
function scriptsPath(path2) {
|
|
420
|
-
return frameworkPath(`core/scripts/${path2 || ""}`);
|
|
421
|
-
}
|
|
422
|
-
function schedulerPath(path2) {
|
|
423
|
-
return corePath(`scheduler/${path2 || ""}`);
|
|
424
|
-
}
|
|
425
|
-
function signalsPath(path2) {
|
|
426
|
-
return corePath(`signals/${path2 || ""}`);
|
|
427
|
-
}
|
|
428
|
-
function slugPath(path2) {
|
|
429
|
-
return corePath(`slug/${path2 || ""}`);
|
|
430
|
-
}
|
|
431
|
-
function smsPath(path2) {
|
|
432
|
-
return notificationsPath(`sms/${path2 || ""}`);
|
|
433
|
-
}
|
|
434
|
-
function storagePath(path2) {
|
|
435
|
-
return corePath(`storage/${path2 || ""}`);
|
|
436
|
-
}
|
|
437
|
-
function storesPath(path2) {
|
|
438
|
-
return resourcesPath(`stores/${path2 || ""}`);
|
|
439
|
-
}
|
|
440
|
-
function securityPath(path2) {
|
|
441
|
-
return corePath(`security/${path2 || ""}`);
|
|
442
|
-
}
|
|
443
|
-
function serverPath(path2) {
|
|
444
|
-
return corePath(`server/${path2 || ""}`);
|
|
445
|
-
}
|
|
446
|
-
function serverlessPath(path2) {
|
|
447
|
-
return corePath(`serverless/${path2 || ""}`);
|
|
448
|
-
}
|
|
449
|
-
function stacksPath(path2) {
|
|
450
|
-
return frameworkPath(`src/${path2 || ""}`);
|
|
451
|
-
}
|
|
452
|
-
function stringsPath(path2) {
|
|
453
|
-
return corePath(`strings/${path2 || ""}`);
|
|
454
|
-
}
|
|
455
|
-
function testingPath(path2) {
|
|
456
|
-
return corePath(`testing/${path2 || ""}`);
|
|
457
|
-
}
|
|
458
|
-
function tinkerPath(path2) {
|
|
459
|
-
return corePath(`tinker/${path2 || ""}`);
|
|
460
|
-
}
|
|
461
|
-
function testsPath(path2) {
|
|
462
|
-
return frameworkPath(`tests/${path2 || ""}`);
|
|
463
|
-
}
|
|
464
|
-
function typesPath(path2) {
|
|
465
|
-
return corePath(`types/${path2 || ""}`);
|
|
466
|
-
}
|
|
467
|
-
function uiPath(path2) {
|
|
468
|
-
return corePath(`ui/${path2 || ""}`);
|
|
469
|
-
}
|
|
470
|
-
function utilsPath(path2) {
|
|
471
|
-
return corePath(`utils/${path2 || ""}`);
|
|
472
|
-
}
|
|
473
|
-
function validationPath(path2) {
|
|
474
|
-
return corePath(`validation/${path2 || ""}`);
|
|
475
|
-
}
|
|
476
|
-
function vitePath(path2) {
|
|
477
|
-
return corePath(`vite/${path2 || ""}`);
|
|
478
|
-
}
|
|
479
|
-
function xRayPath(path2) {
|
|
480
|
-
return frameworkPath(`stacks/x-ray/${path2 || ""}`);
|
|
481
|
-
}
|
|
482
|
-
var path2 = {
|
|
483
|
-
actionsPath,
|
|
484
|
-
aiPath,
|
|
485
|
-
assetsPath,
|
|
486
|
-
relativeActionsPath,
|
|
487
|
-
aliasPath,
|
|
488
|
-
analyticsPath,
|
|
489
|
-
arraysPath,
|
|
490
|
-
appPath,
|
|
491
|
-
authPath,
|
|
492
|
-
buildEnginePath,
|
|
493
|
-
libsEntriesPath,
|
|
494
|
-
buildPath,
|
|
495
|
-
cachePath,
|
|
496
|
-
chatPath,
|
|
497
|
-
cliPath,
|
|
498
|
-
cloudPath,
|
|
499
|
-
collectionsPath,
|
|
500
|
-
componentsPath,
|
|
501
|
-
configPath,
|
|
502
|
-
projectConfigPath,
|
|
503
|
-
corePath,
|
|
504
|
-
customElementsDataPath,
|
|
505
|
-
databasePath,
|
|
506
|
-
datetimePath,
|
|
507
|
-
developmentPath,
|
|
508
|
-
desktopPath,
|
|
509
|
-
docsPath,
|
|
510
|
-
dnsPath,
|
|
511
|
-
emailPath,
|
|
512
|
-
enumsPath,
|
|
513
|
-
errorHandlingPath,
|
|
514
|
-
eventsPath,
|
|
515
|
-
coreEnvPath,
|
|
516
|
-
healthPath,
|
|
517
|
-
examplesPath,
|
|
518
|
-
fakerPath,
|
|
519
|
-
frameworkPath,
|
|
520
|
-
storagePath,
|
|
521
|
-
functionsPath,
|
|
522
|
-
gitPath,
|
|
523
|
-
langPath,
|
|
524
|
-
layoutsPath,
|
|
525
|
-
libsPath,
|
|
526
|
-
libraryEntryPath,
|
|
527
|
-
lintPath,
|
|
528
|
-
loggingPath,
|
|
529
|
-
modulesPath,
|
|
530
|
-
ormPath,
|
|
531
|
-
objectsPath,
|
|
532
|
-
onboardingPath,
|
|
533
|
-
notificationsPath,
|
|
534
|
-
packageJsonPath,
|
|
535
|
-
viewsPath,
|
|
536
|
-
pathPath,
|
|
537
|
-
paymentsPath,
|
|
538
|
-
projectPath,
|
|
539
|
-
projectStoragePath,
|
|
540
|
-
publicPath,
|
|
541
|
-
pushPath,
|
|
542
|
-
queryBuilderPath,
|
|
543
|
-
queuePath,
|
|
544
|
-
realtimePath,
|
|
545
|
-
resourcesPath,
|
|
546
|
-
replPath,
|
|
547
|
-
routerPath,
|
|
548
|
-
routesPath,
|
|
549
|
-
searchEnginePath,
|
|
550
|
-
schedulerPath,
|
|
551
|
-
settingsPath,
|
|
552
|
-
smsPath,
|
|
553
|
-
signalsPath,
|
|
554
|
-
slugPath,
|
|
555
|
-
scriptsPath,
|
|
556
|
-
securityPath,
|
|
557
|
-
serverPath,
|
|
558
|
-
serverlessPath,
|
|
559
|
-
stacksPath,
|
|
560
|
-
stringsPath,
|
|
561
|
-
storesPath,
|
|
562
|
-
testingPath,
|
|
563
|
-
testsPath,
|
|
564
|
-
tinkerPath,
|
|
565
|
-
typesPath,
|
|
566
|
-
uiPath,
|
|
567
|
-
utilsPath,
|
|
568
|
-
validationPath,
|
|
569
|
-
vitePath,
|
|
570
|
-
xRayPath,
|
|
571
|
-
basename,
|
|
572
|
-
delimiter,
|
|
573
|
-
dirname,
|
|
574
|
-
extname,
|
|
575
|
-
format,
|
|
576
|
-
isAbsolute,
|
|
577
|
-
join,
|
|
578
|
-
normalize,
|
|
579
|
-
normalizeString,
|
|
580
|
-
parse,
|
|
581
|
-
relative,
|
|
582
|
-
resolve,
|
|
583
|
-
sep,
|
|
584
|
-
toNamespacedPath
|
|
585
|
-
};
|
|
586
112
|
|
|
587
113
|
// src/middleware.ts
|
|
588
114
|
async function importMiddlewares(directory) {
|
|
589
|
-
|
|
590
|
-
const files = await readdir(directory);
|
|
591
|
-
for (const file of files) {
|
|
592
|
-
const imported = await import(path2.join(directory, file));
|
|
593
|
-
middlewares.push(imported.default);
|
|
594
|
-
}
|
|
595
|
-
return middlewares;
|
|
115
|
+
return [directory];
|
|
596
116
|
}
|
|
597
117
|
|
|
598
118
|
class Middleware {
|
|
@@ -605,7 +125,6 @@ class Middleware {
|
|
|
605
125
|
this.handle = data.handle;
|
|
606
126
|
}
|
|
607
127
|
}
|
|
608
|
-
var readdir = promisify(fs.readdir);
|
|
609
128
|
var middlewares = await importMiddlewares(appPath("middleware"));
|
|
610
129
|
// src/request.ts
|
|
611
130
|
class Request {
|
|
@@ -763,32 +282,32 @@ class Router {
|
|
|
763
282
|
paramNames: []
|
|
764
283
|
});
|
|
765
284
|
}
|
|
766
|
-
get(
|
|
767
|
-
this.addRoute("GET",
|
|
285
|
+
get(path4, callback) {
|
|
286
|
+
this.addRoute("GET", path4, callback, 200);
|
|
768
287
|
return this;
|
|
769
288
|
}
|
|
770
|
-
post(
|
|
771
|
-
this.addRoute("POST",
|
|
289
|
+
post(path4, callback) {
|
|
290
|
+
this.addRoute("POST", path4, callback, 201);
|
|
772
291
|
return this;
|
|
773
292
|
}
|
|
774
|
-
view(
|
|
775
|
-
this.addRoute("GET",
|
|
293
|
+
view(path4, callback) {
|
|
294
|
+
this.addRoute("GET", path4, callback, 200);
|
|
776
295
|
return this;
|
|
777
296
|
}
|
|
778
|
-
redirect(
|
|
779
|
-
this.addRoute("GET",
|
|
297
|
+
redirect(path4, callback, _status) {
|
|
298
|
+
this.addRoute("GET", path4, callback, 302);
|
|
780
299
|
return this;
|
|
781
300
|
}
|
|
782
|
-
delete(
|
|
783
|
-
this.addRoute("DELETE",
|
|
301
|
+
delete(path4, callback) {
|
|
302
|
+
this.addRoute("DELETE", path4, callback, 204);
|
|
784
303
|
return this;
|
|
785
304
|
}
|
|
786
|
-
patch(
|
|
787
|
-
this.addRoute("PATCH",
|
|
305
|
+
patch(path4, callback) {
|
|
306
|
+
this.addRoute("PATCH", path4, callback, 202);
|
|
788
307
|
return this;
|
|
789
308
|
}
|
|
790
|
-
put(
|
|
791
|
-
this.addRoute("PUT",
|
|
309
|
+
put(path4, callback) {
|
|
310
|
+
this.addRoute("PUT", path4, callback, 202);
|
|
792
311
|
return this;
|
|
793
312
|
}
|
|
794
313
|
group(options, callback) {
|