@stacksjs/router 0.58.68 → 0.58.69
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 +540 -2
- package/package.json +1 -1
- package/src/router.ts +9 -1
- package/src/server.ts +15 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,400 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
|
|
20
|
+
// /home/runner/work/stacks/stacks/node_modules/slugify/slugify.js
|
|
21
|
+
var require_slugify = __commonJS((exports, module) => {
|
|
22
|
+
(function(name, root, factory) {
|
|
23
|
+
if (typeof exports === "object") {
|
|
24
|
+
module.exports = factory();
|
|
25
|
+
module.exports["default"] = factory();
|
|
26
|
+
} else if (typeof define === "function" && define.amd) {
|
|
27
|
+
define(factory);
|
|
28
|
+
} else {
|
|
29
|
+
root[name] = factory();
|
|
30
|
+
}
|
|
31
|
+
})("slugify", exports, function() {
|
|
32
|
+
var charMap = JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\xFF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`);
|
|
33
|
+
var locales = JSON.parse('{"bg":{"\u0419":"Y","\u0426":"Ts","\u0429":"Sht","\u042A":"A","\u042C":"Y","\u0439":"y","\u0446":"ts","\u0449":"sht","\u044A":"a","\u044C":"y"},"de":{"\xC4":"AE","\xE4":"ae","\xD6":"OE","\xF6":"oe","\xDC":"UE","\xFC":"ue","\xDF":"ss","%":"prozent","&":"und","|":"oder","\u2211":"summe","\u221E":"unendlich","\u2665":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","\xA2":"centavos","\xA3":"libras","\xA4":"moneda","\u20A3":"francos","\u2211":"suma","\u221E":"infinito","\u2665":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","\xA2":"centime","\xA3":"livre","\xA4":"devise","\u20A3":"franc","\u2211":"somme","\u221E":"infini","\u2665":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","\xA2":"centavo","\u2211":"soma","\xA3":"libra","\u221E":"infinito","\u2665":"amor"},"uk":{"\u0418":"Y","\u0438":"y","\u0419":"Y","\u0439":"y","\u0426":"Ts","\u0446":"ts","\u0425":"Kh","\u0445":"kh","\u0429":"Shch","\u0449":"shch","\u0413":"H","\u0433":"h"},"vi":{"\u0110":"D","\u0111":"d"},"da":{"\xD8":"OE","\xF8":"oe","\xC5":"AA","\xE5":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"st\xF8rre end"},"nb":{"&":"og","\xC5":"AA","\xC6":"AE","\xD8":"OE","\xE5":"aa","\xE6":"ae","\xF8":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","\xC5":"AA","\xC4":"AE","\xD6":"OE","\xE5":"aa","\xE4":"ae","\xF6":"oe"}}');
|
|
34
|
+
function replace(string, options) {
|
|
35
|
+
if (typeof string !== "string") {
|
|
36
|
+
throw new Error("slugify: string argument expected");
|
|
37
|
+
}
|
|
38
|
+
options = typeof options === "string" ? { replacement: options } : options || {};
|
|
39
|
+
var locale = locales[options.locale] || {};
|
|
40
|
+
var replacement = options.replacement === undefined ? "-" : options.replacement;
|
|
41
|
+
var trim = options.trim === undefined ? true : options.trim;
|
|
42
|
+
var slug = string.normalize().split("").reduce(function(result, ch) {
|
|
43
|
+
var appendChar = locale[ch];
|
|
44
|
+
if (appendChar === undefined)
|
|
45
|
+
appendChar = charMap[ch];
|
|
46
|
+
if (appendChar === undefined)
|
|
47
|
+
appendChar = ch;
|
|
48
|
+
if (appendChar === replacement)
|
|
49
|
+
appendChar = " ";
|
|
50
|
+
return result + appendChar.replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]+/g, "");
|
|
51
|
+
}, "");
|
|
52
|
+
if (options.strict) {
|
|
53
|
+
slug = slug.replace(/[^A-Za-z0-9\s]/g, "");
|
|
54
|
+
}
|
|
55
|
+
if (trim) {
|
|
56
|
+
slug = slug.trim();
|
|
57
|
+
}
|
|
58
|
+
slug = slug.replace(/\s+/g, replacement);
|
|
59
|
+
if (options.lower) {
|
|
60
|
+
slug = slug.toLowerCase();
|
|
61
|
+
}
|
|
62
|
+
return slug;
|
|
63
|
+
}
|
|
64
|
+
replace.extend = function(customMap) {
|
|
65
|
+
Object.assign(charMap, customMap);
|
|
66
|
+
};
|
|
67
|
+
return replace;
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// /home/runner/work/stacks/stacks/node_modules/pluralize/pluralize.js
|
|
72
|
+
var require_pluralize = __commonJS((exports, module) => {
|
|
73
|
+
(function(root, pluralize) {
|
|
74
|
+
if (typeof import.meta.require === "function" && typeof exports === "object" && typeof module === "object") {
|
|
75
|
+
module.exports = pluralize();
|
|
76
|
+
} else if (typeof define === "function" && define.amd) {
|
|
77
|
+
define(function() {
|
|
78
|
+
return pluralize();
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
root.pluralize = pluralize();
|
|
82
|
+
}
|
|
83
|
+
})(exports, function() {
|
|
84
|
+
var pluralRules = [];
|
|
85
|
+
var singularRules = [];
|
|
86
|
+
var uncountables = {};
|
|
87
|
+
var irregularPlurals = {};
|
|
88
|
+
var irregularSingles = {};
|
|
89
|
+
function sanitizeRule(rule) {
|
|
90
|
+
if (typeof rule === "string") {
|
|
91
|
+
return new RegExp("^" + rule + "$", "i");
|
|
92
|
+
}
|
|
93
|
+
return rule;
|
|
94
|
+
}
|
|
95
|
+
function restoreCase(word, token) {
|
|
96
|
+
if (word === token)
|
|
97
|
+
return token;
|
|
98
|
+
if (word === word.toLowerCase())
|
|
99
|
+
return token.toLowerCase();
|
|
100
|
+
if (word === word.toUpperCase())
|
|
101
|
+
return token.toUpperCase();
|
|
102
|
+
if (word[0] === word[0].toUpperCase()) {
|
|
103
|
+
return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();
|
|
104
|
+
}
|
|
105
|
+
return token.toLowerCase();
|
|
106
|
+
}
|
|
107
|
+
function interpolate(str, args) {
|
|
108
|
+
return str.replace(/\$(\d{1,2})/g, function(match, index) {
|
|
109
|
+
return args[index] || "";
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function replace(word, rule) {
|
|
113
|
+
return word.replace(rule[0], function(match, index) {
|
|
114
|
+
var result = interpolate(rule[1], arguments);
|
|
115
|
+
if (match === "") {
|
|
116
|
+
return restoreCase(word[index - 1], result);
|
|
117
|
+
}
|
|
118
|
+
return restoreCase(match, result);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function sanitizeWord(token, word, rules) {
|
|
122
|
+
if (!token.length || uncountables.hasOwnProperty(token)) {
|
|
123
|
+
return word;
|
|
124
|
+
}
|
|
125
|
+
var len = rules.length;
|
|
126
|
+
while (len--) {
|
|
127
|
+
var rule = rules[len];
|
|
128
|
+
if (rule[0].test(word))
|
|
129
|
+
return replace(word, rule);
|
|
130
|
+
}
|
|
131
|
+
return word;
|
|
132
|
+
}
|
|
133
|
+
function replaceWord(replaceMap, keepMap, rules) {
|
|
134
|
+
return function(word) {
|
|
135
|
+
var token = word.toLowerCase();
|
|
136
|
+
if (keepMap.hasOwnProperty(token)) {
|
|
137
|
+
return restoreCase(word, token);
|
|
138
|
+
}
|
|
139
|
+
if (replaceMap.hasOwnProperty(token)) {
|
|
140
|
+
return restoreCase(word, replaceMap[token]);
|
|
141
|
+
}
|
|
142
|
+
return sanitizeWord(token, word, rules);
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function checkWord(replaceMap, keepMap, rules, bool) {
|
|
146
|
+
return function(word) {
|
|
147
|
+
var token = word.toLowerCase();
|
|
148
|
+
if (keepMap.hasOwnProperty(token))
|
|
149
|
+
return true;
|
|
150
|
+
if (replaceMap.hasOwnProperty(token))
|
|
151
|
+
return false;
|
|
152
|
+
return sanitizeWord(token, token, rules) === token;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function pluralize(word, count, inclusive) {
|
|
156
|
+
var pluralized = count === 1 ? pluralize.singular(word) : pluralize.plural(word);
|
|
157
|
+
return (inclusive ? count + " " : "") + pluralized;
|
|
158
|
+
}
|
|
159
|
+
pluralize.plural = replaceWord(irregularSingles, irregularPlurals, pluralRules);
|
|
160
|
+
pluralize.isPlural = checkWord(irregularSingles, irregularPlurals, pluralRules);
|
|
161
|
+
pluralize.singular = replaceWord(irregularPlurals, irregularSingles, singularRules);
|
|
162
|
+
pluralize.isSingular = checkWord(irregularPlurals, irregularSingles, singularRules);
|
|
163
|
+
pluralize.addPluralRule = function(rule, replacement) {
|
|
164
|
+
pluralRules.push([sanitizeRule(rule), replacement]);
|
|
165
|
+
};
|
|
166
|
+
pluralize.addSingularRule = function(rule, replacement) {
|
|
167
|
+
singularRules.push([sanitizeRule(rule), replacement]);
|
|
168
|
+
};
|
|
169
|
+
pluralize.addUncountableRule = function(word) {
|
|
170
|
+
if (typeof word === "string") {
|
|
171
|
+
uncountables[word.toLowerCase()] = true;
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
pluralize.addPluralRule(word, "$0");
|
|
175
|
+
pluralize.addSingularRule(word, "$0");
|
|
176
|
+
};
|
|
177
|
+
pluralize.addIrregularRule = function(single, plural) {
|
|
178
|
+
plural = plural.toLowerCase();
|
|
179
|
+
single = single.toLowerCase();
|
|
180
|
+
irregularSingles[single] = plural;
|
|
181
|
+
irregularPlurals[plural] = single;
|
|
182
|
+
};
|
|
183
|
+
[
|
|
184
|
+
["I", "we"],
|
|
185
|
+
["me", "us"],
|
|
186
|
+
["he", "they"],
|
|
187
|
+
["she", "they"],
|
|
188
|
+
["them", "them"],
|
|
189
|
+
["myself", "ourselves"],
|
|
190
|
+
["yourself", "yourselves"],
|
|
191
|
+
["itself", "themselves"],
|
|
192
|
+
["herself", "themselves"],
|
|
193
|
+
["himself", "themselves"],
|
|
194
|
+
["themself", "themselves"],
|
|
195
|
+
["is", "are"],
|
|
196
|
+
["was", "were"],
|
|
197
|
+
["has", "have"],
|
|
198
|
+
["this", "these"],
|
|
199
|
+
["that", "those"],
|
|
200
|
+
["echo", "echoes"],
|
|
201
|
+
["dingo", "dingoes"],
|
|
202
|
+
["volcano", "volcanoes"],
|
|
203
|
+
["tornado", "tornadoes"],
|
|
204
|
+
["torpedo", "torpedoes"],
|
|
205
|
+
["genus", "genera"],
|
|
206
|
+
["viscus", "viscera"],
|
|
207
|
+
["stigma", "stigmata"],
|
|
208
|
+
["stoma", "stomata"],
|
|
209
|
+
["dogma", "dogmata"],
|
|
210
|
+
["lemma", "lemmata"],
|
|
211
|
+
["schema", "schemata"],
|
|
212
|
+
["anathema", "anathemata"],
|
|
213
|
+
["ox", "oxen"],
|
|
214
|
+
["axe", "axes"],
|
|
215
|
+
["die", "dice"],
|
|
216
|
+
["yes", "yeses"],
|
|
217
|
+
["foot", "feet"],
|
|
218
|
+
["eave", "eaves"],
|
|
219
|
+
["goose", "geese"],
|
|
220
|
+
["tooth", "teeth"],
|
|
221
|
+
["quiz", "quizzes"],
|
|
222
|
+
["human", "humans"],
|
|
223
|
+
["proof", "proofs"],
|
|
224
|
+
["carve", "carves"],
|
|
225
|
+
["valve", "valves"],
|
|
226
|
+
["looey", "looies"],
|
|
227
|
+
["thief", "thieves"],
|
|
228
|
+
["groove", "grooves"],
|
|
229
|
+
["pickaxe", "pickaxes"],
|
|
230
|
+
["passerby", "passersby"]
|
|
231
|
+
].forEach(function(rule) {
|
|
232
|
+
return pluralize.addIrregularRule(rule[0], rule[1]);
|
|
233
|
+
});
|
|
234
|
+
[
|
|
235
|
+
[/s?$/i, "s"],
|
|
236
|
+
[/[^\u0000-\u007F]$/i, "$0"],
|
|
237
|
+
[/([^aeiou]ese)$/i, "$1"],
|
|
238
|
+
[/(ax|test)is$/i, "$1es"],
|
|
239
|
+
[/(alias|[^aou]us|t[lm]as|gas|ris)$/i, "$1es"],
|
|
240
|
+
[/(e[mn]u)s?$/i, "$1s"],
|
|
241
|
+
[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, "$1"],
|
|
242
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1i"],
|
|
243
|
+
[/(alumn|alg|vertebr)(?:a|ae)$/i, "$1ae"],
|
|
244
|
+
[/(seraph|cherub)(?:im)?$/i, "$1im"],
|
|
245
|
+
[/(her|at|gr)o$/i, "$1oes"],
|
|
246
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, "$1a"],
|
|
247
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, "$1a"],
|
|
248
|
+
[/sis$/i, "ses"],
|
|
249
|
+
[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, "$1$2ves"],
|
|
250
|
+
[/([^aeiouy]|qu)y$/i, "$1ies"],
|
|
251
|
+
[/([^ch][ieo][ln])ey$/i, "$1ies"],
|
|
252
|
+
[/(x|ch|ss|sh|zz)$/i, "$1es"],
|
|
253
|
+
[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, "$1ices"],
|
|
254
|
+
[/\b((?:tit)?m|l)(?:ice|ouse)$/i, "$1ice"],
|
|
255
|
+
[/(pe)(?:rson|ople)$/i, "$1ople"],
|
|
256
|
+
[/(child)(?:ren)?$/i, "$1ren"],
|
|
257
|
+
[/eaux$/i, "$0"],
|
|
258
|
+
[/m[ae]n$/i, "men"],
|
|
259
|
+
["thou", "you"]
|
|
260
|
+
].forEach(function(rule) {
|
|
261
|
+
return pluralize.addPluralRule(rule[0], rule[1]);
|
|
262
|
+
});
|
|
263
|
+
[
|
|
264
|
+
[/s$/i, ""],
|
|
265
|
+
[/(ss)$/i, "$1"],
|
|
266
|
+
[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i, "$1fe"],
|
|
267
|
+
[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, "$1f"],
|
|
268
|
+
[/ies$/i, "y"],
|
|
269
|
+
[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, "$1ie"],
|
|
270
|
+
[/\b(mon|smil)ies$/i, "$1ey"],
|
|
271
|
+
[/\b((?:tit)?m|l)ice$/i, "$1ouse"],
|
|
272
|
+
[/(seraph|cherub)im$/i, "$1"],
|
|
273
|
+
[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, "$1"],
|
|
274
|
+
[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, "$1sis"],
|
|
275
|
+
[/(movie|twelve|abuse|e[mn]u)s$/i, "$1"],
|
|
276
|
+
[/(test)(?:is|es)$/i, "$1is"],
|
|
277
|
+
[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, "$1us"],
|
|
278
|
+
[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, "$1um"],
|
|
279
|
+
[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, "$1on"],
|
|
280
|
+
[/(alumn|alg|vertebr)ae$/i, "$1a"],
|
|
281
|
+
[/(cod|mur|sil|vert|ind)ices$/i, "$1ex"],
|
|
282
|
+
[/(matr|append)ices$/i, "$1ix"],
|
|
283
|
+
[/(pe)(rson|ople)$/i, "$1rson"],
|
|
284
|
+
[/(child)ren$/i, "$1"],
|
|
285
|
+
[/(eau)x?$/i, "$1"],
|
|
286
|
+
[/men$/i, "man"]
|
|
287
|
+
].forEach(function(rule) {
|
|
288
|
+
return pluralize.addSingularRule(rule[0], rule[1]);
|
|
289
|
+
});
|
|
290
|
+
[
|
|
291
|
+
"adulthood",
|
|
292
|
+
"advice",
|
|
293
|
+
"agenda",
|
|
294
|
+
"aid",
|
|
295
|
+
"aircraft",
|
|
296
|
+
"alcohol",
|
|
297
|
+
"ammo",
|
|
298
|
+
"analytics",
|
|
299
|
+
"anime",
|
|
300
|
+
"athletics",
|
|
301
|
+
"audio",
|
|
302
|
+
"bison",
|
|
303
|
+
"blood",
|
|
304
|
+
"bream",
|
|
305
|
+
"buffalo",
|
|
306
|
+
"butter",
|
|
307
|
+
"carp",
|
|
308
|
+
"cash",
|
|
309
|
+
"chassis",
|
|
310
|
+
"chess",
|
|
311
|
+
"clothing",
|
|
312
|
+
"cod",
|
|
313
|
+
"commerce",
|
|
314
|
+
"cooperation",
|
|
315
|
+
"corps",
|
|
316
|
+
"debris",
|
|
317
|
+
"diabetes",
|
|
318
|
+
"digestion",
|
|
319
|
+
"elk",
|
|
320
|
+
"energy",
|
|
321
|
+
"equipment",
|
|
322
|
+
"excretion",
|
|
323
|
+
"expertise",
|
|
324
|
+
"firmware",
|
|
325
|
+
"flounder",
|
|
326
|
+
"fun",
|
|
327
|
+
"gallows",
|
|
328
|
+
"garbage",
|
|
329
|
+
"graffiti",
|
|
330
|
+
"hardware",
|
|
331
|
+
"headquarters",
|
|
332
|
+
"health",
|
|
333
|
+
"herpes",
|
|
334
|
+
"highjinks",
|
|
335
|
+
"homework",
|
|
336
|
+
"housework",
|
|
337
|
+
"information",
|
|
338
|
+
"jeans",
|
|
339
|
+
"justice",
|
|
340
|
+
"kudos",
|
|
341
|
+
"labour",
|
|
342
|
+
"literature",
|
|
343
|
+
"machinery",
|
|
344
|
+
"mackerel",
|
|
345
|
+
"mail",
|
|
346
|
+
"media",
|
|
347
|
+
"mews",
|
|
348
|
+
"moose",
|
|
349
|
+
"music",
|
|
350
|
+
"mud",
|
|
351
|
+
"manga",
|
|
352
|
+
"news",
|
|
353
|
+
"only",
|
|
354
|
+
"personnel",
|
|
355
|
+
"pike",
|
|
356
|
+
"plankton",
|
|
357
|
+
"pliers",
|
|
358
|
+
"police",
|
|
359
|
+
"pollution",
|
|
360
|
+
"premises",
|
|
361
|
+
"rain",
|
|
362
|
+
"research",
|
|
363
|
+
"rice",
|
|
364
|
+
"salmon",
|
|
365
|
+
"scissors",
|
|
366
|
+
"series",
|
|
367
|
+
"sewage",
|
|
368
|
+
"shambles",
|
|
369
|
+
"shrimp",
|
|
370
|
+
"software",
|
|
371
|
+
"species",
|
|
372
|
+
"staff",
|
|
373
|
+
"swine",
|
|
374
|
+
"tennis",
|
|
375
|
+
"traffic",
|
|
376
|
+
"transportation",
|
|
377
|
+
"trout",
|
|
378
|
+
"tuna",
|
|
379
|
+
"wealth",
|
|
380
|
+
"welfare",
|
|
381
|
+
"whiting",
|
|
382
|
+
"wildebeest",
|
|
383
|
+
"wildlife",
|
|
384
|
+
"you",
|
|
385
|
+
/pok[e\u00E9]mon$/i,
|
|
386
|
+
/[^aeiou]ese$/i,
|
|
387
|
+
/deer$/i,
|
|
388
|
+
/fish$/i,
|
|
389
|
+
/measles$/i,
|
|
390
|
+
/o[iu]s$/i,
|
|
391
|
+
/pox$/i,
|
|
392
|
+
/sheep$/i
|
|
393
|
+
].forEach(pluralize.addUncountableRule);
|
|
394
|
+
return pluralize;
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
|
|
2
398
|
// /home/runner/work/stacks/stacks/storage/framework/core/path/src/index.ts
|
|
3
399
|
import process2 from "process";
|
|
4
400
|
|
|
@@ -702,7 +1098,13 @@ async function serve(options = {}) {
|
|
|
702
1098
|
});
|
|
703
1099
|
}
|
|
704
1100
|
async function serverResponse(req) {
|
|
705
|
-
|
|
1101
|
+
const timestamp = new Date().toISOString();
|
|
1102
|
+
console.log(`${timestamp} - Incoming request: ${req.method} ${req.url}`);
|
|
1103
|
+
console.log(`${timestamp} - Headers: ${JSON.stringify(req.headers)}`);
|
|
1104
|
+
console.log(`${timestamp} - Body: ${JSON.stringify(req.body)}`);
|
|
1105
|
+
console.log(`${timestamp} - Query: ${JSON.stringify(req.query)}`);
|
|
1106
|
+
console.log(`${timestamp} - Params: ${JSON.stringify(req.params)}`);
|
|
1107
|
+
console.log(`${timestamp} - Cookies: ${JSON.stringify(req.cookies)}`);
|
|
706
1108
|
const routesList = await route.getRoutes();
|
|
707
1109
|
const url = new URL(req.url);
|
|
708
1110
|
const foundRoute = routesList.find((route2) => {
|
|
@@ -786,6 +1188,139 @@ var isFunction = function(val) {
|
|
|
786
1188
|
var isObject = function(val) {
|
|
787
1189
|
return val !== null && typeof val === "object" && !Array.isArray(val);
|
|
788
1190
|
};
|
|
1191
|
+
// /home/runner/work/stacks/stacks/storage/framework/core/strings/src/utils.ts
|
|
1192
|
+
var import_slugify = __toESM(require_slugify(), 1);
|
|
1193
|
+
// /home/runner/work/stacks/stacks/node_modules/change-case/dist/index.js
|
|
1194
|
+
function split(value) {
|
|
1195
|
+
let result = value.trim();
|
|
1196
|
+
result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
|
|
1197
|
+
result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
|
|
1198
|
+
let start = 0;
|
|
1199
|
+
let end = result.length;
|
|
1200
|
+
while (result.charAt(start) === "\0")
|
|
1201
|
+
start++;
|
|
1202
|
+
if (start === end)
|
|
1203
|
+
return [];
|
|
1204
|
+
while (result.charAt(end - 1) === "\0")
|
|
1205
|
+
end--;
|
|
1206
|
+
return result.slice(start, end).split(/\0/g);
|
|
1207
|
+
}
|
|
1208
|
+
function splitSeparateNumbers(value) {
|
|
1209
|
+
const words = split(value);
|
|
1210
|
+
for (let i = 0;i < words.length; i++) {
|
|
1211
|
+
const word = words[i];
|
|
1212
|
+
const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
|
|
1213
|
+
if (match) {
|
|
1214
|
+
const offset = match.index + (match[1] ?? match[2]).length;
|
|
1215
|
+
words.splice(i, 1, word.slice(0, offset), word.slice(offset));
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return words;
|
|
1219
|
+
}
|
|
1220
|
+
function pascalCase(input, options) {
|
|
1221
|
+
const [prefix, words, suffix] = splitPrefixSuffix(input, options);
|
|
1222
|
+
const lower = lowerFactory(options?.locale);
|
|
1223
|
+
const upper = upperFactory(options?.locale);
|
|
1224
|
+
const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
|
|
1225
|
+
return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
|
|
1226
|
+
}
|
|
1227
|
+
var lowerFactory = function(locale) {
|
|
1228
|
+
return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
|
|
1229
|
+
};
|
|
1230
|
+
var upperFactory = function(locale) {
|
|
1231
|
+
return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
|
|
1232
|
+
};
|
|
1233
|
+
var capitalCaseTransformFactory = function(lower, upper) {
|
|
1234
|
+
return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
|
|
1235
|
+
};
|
|
1236
|
+
var pascalCaseTransformFactory = function(lower, upper) {
|
|
1237
|
+
return (word, index) => {
|
|
1238
|
+
const char0 = word[0];
|
|
1239
|
+
const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
|
|
1240
|
+
return initial + lower(word.slice(1));
|
|
1241
|
+
};
|
|
1242
|
+
};
|
|
1243
|
+
var splitPrefixSuffix = function(input, options = {}) {
|
|
1244
|
+
const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
|
|
1245
|
+
const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
1246
|
+
const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
|
|
1247
|
+
let prefixIndex = 0;
|
|
1248
|
+
let suffixIndex = input.length;
|
|
1249
|
+
while (prefixIndex < input.length) {
|
|
1250
|
+
const char = input.charAt(prefixIndex);
|
|
1251
|
+
if (!prefixCharacters.includes(char))
|
|
1252
|
+
break;
|
|
1253
|
+
prefixIndex++;
|
|
1254
|
+
}
|
|
1255
|
+
while (suffixIndex > prefixIndex) {
|
|
1256
|
+
const index = suffixIndex - 1;
|
|
1257
|
+
const char = input.charAt(index);
|
|
1258
|
+
if (!suffixCharacters.includes(char))
|
|
1259
|
+
break;
|
|
1260
|
+
suffixIndex = index;
|
|
1261
|
+
}
|
|
1262
|
+
return [
|
|
1263
|
+
input.slice(0, prefixIndex),
|
|
1264
|
+
splitFn(input.slice(prefixIndex, suffixIndex)),
|
|
1265
|
+
input.slice(suffixIndex)
|
|
1266
|
+
];
|
|
1267
|
+
};
|
|
1268
|
+
var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
1269
|
+
var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
1270
|
+
var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
|
|
1271
|
+
var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
|
|
1272
|
+
var SPLIT_REPLACE_VALUE = "$1\0$2";
|
|
1273
|
+
var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
|
|
1274
|
+
// /home/runner/work/stacks/stacks/node_modules/title-case/dist/index.js
|
|
1275
|
+
var WORD_SEPARATORS = new Set(["\u2014", "\u2013", "-", "\u2015", "/"]);
|
|
1276
|
+
var SENTENCE_TERMINATORS = new Set([".", "!", "?"]);
|
|
1277
|
+
var TITLE_TERMINATORS = new Set([
|
|
1278
|
+
...SENTENCE_TERMINATORS,
|
|
1279
|
+
":",
|
|
1280
|
+
'"',
|
|
1281
|
+
"'",
|
|
1282
|
+
"\u201D"
|
|
1283
|
+
]);
|
|
1284
|
+
var SMALL_WORDS = new Set([
|
|
1285
|
+
"a",
|
|
1286
|
+
"an",
|
|
1287
|
+
"and",
|
|
1288
|
+
"as",
|
|
1289
|
+
"at",
|
|
1290
|
+
"because",
|
|
1291
|
+
"but",
|
|
1292
|
+
"by",
|
|
1293
|
+
"en",
|
|
1294
|
+
"for",
|
|
1295
|
+
"if",
|
|
1296
|
+
"in",
|
|
1297
|
+
"neither",
|
|
1298
|
+
"nor",
|
|
1299
|
+
"of",
|
|
1300
|
+
"on",
|
|
1301
|
+
"only",
|
|
1302
|
+
"or",
|
|
1303
|
+
"over",
|
|
1304
|
+
"per",
|
|
1305
|
+
"so",
|
|
1306
|
+
"some",
|
|
1307
|
+
"than",
|
|
1308
|
+
"that",
|
|
1309
|
+
"the",
|
|
1310
|
+
"to",
|
|
1311
|
+
"up",
|
|
1312
|
+
"upon",
|
|
1313
|
+
"v",
|
|
1314
|
+
"versus",
|
|
1315
|
+
"via",
|
|
1316
|
+
"vs",
|
|
1317
|
+
"when",
|
|
1318
|
+
"with",
|
|
1319
|
+
"without",
|
|
1320
|
+
"yet"
|
|
1321
|
+
]);
|
|
1322
|
+
// /home/runner/work/stacks/stacks/storage/framework/core/strings/src/pluralize.ts
|
|
1323
|
+
var pluralize = __toESM(require_pluralize(), 1);
|
|
789
1324
|
// src/router.ts
|
|
790
1325
|
class Router {
|
|
791
1326
|
routes = [];
|
|
@@ -817,6 +1352,7 @@ class Router {
|
|
|
817
1352
|
callback = actionModule.default;
|
|
818
1353
|
} else if (typeof callback === "string") {
|
|
819
1354
|
const actionModule = await import(path2.userActionsPath(`${callback}.ts`));
|
|
1355
|
+
path5 = actionModule.default.path ?? path5;
|
|
820
1356
|
callback = actionModule.default.handle;
|
|
821
1357
|
}
|
|
822
1358
|
this.addRoute("GET", path5, callback, 200);
|
|
@@ -829,7 +1365,9 @@ class Router {
|
|
|
829
1365
|
return this;
|
|
830
1366
|
}
|
|
831
1367
|
async job(path5) {
|
|
832
|
-
|
|
1368
|
+
if (path5.includes("api/"))
|
|
1369
|
+
pascalCase(path5.replace(/^api\/?|^\//, ""));
|
|
1370
|
+
const jobModule = await import(path2.userJobsPath(`${path5}Job.ts`.replace(/JobJob/, "Job")));
|
|
833
1371
|
const callback = jobModule.default.handle;
|
|
834
1372
|
this.addRoute("GET", path5, callback, 200);
|
|
835
1373
|
return this;
|
package/package.json
CHANGED
package/src/router.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RedirectCode, Route, RouteGroupOptions, StatusCode } from '@stacksjs/types'
|
|
2
2
|
import { path as p, projectPath } from '@stacksjs/path'
|
|
3
|
+
import { pascalCase } from '@stacksjs/strings'
|
|
3
4
|
|
|
4
5
|
export interface RouterInterface {
|
|
5
6
|
get: (url: Route['url'], callback: Route['callback']) => Promise<this>
|
|
@@ -52,9 +53,12 @@ export class Router implements RouterInterface {
|
|
|
52
53
|
const actionModule = await callback
|
|
53
54
|
callback = actionModule.default
|
|
54
55
|
}
|
|
56
|
+
|
|
55
57
|
else if (typeof callback === 'string') {
|
|
56
58
|
// import the module and use the default.handle function as the callback
|
|
57
59
|
const actionModule = await import(p.userActionsPath(`${callback}.ts`))
|
|
60
|
+
|
|
61
|
+
path = actionModule.default.path ?? path // in case a custom path is defined inside the Action, use that instead of the path passed by the router
|
|
58
62
|
callback = actionModule.default.handle
|
|
59
63
|
}
|
|
60
64
|
|
|
@@ -71,7 +75,11 @@ export class Router implements RouterInterface {
|
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
public async job(path: Route['url']): Promise<this> {
|
|
74
|
-
|
|
78
|
+
if (path.includes('api/')) // TODO: once the api prefix is removed from the router/api, remove this
|
|
79
|
+
pascalCase(path.replace(/^api\/?|^\//, ''))
|
|
80
|
+
|
|
81
|
+
// removes the potential `JobJob` suffix in case the user does not choose to use the Job suffix in their file name
|
|
82
|
+
const jobModule = await import(p.userJobsPath(`${path}Job.ts`.replace(/JobJob/, 'Job')))
|
|
75
83
|
const callback = jobModule.default.handle
|
|
76
84
|
|
|
77
85
|
this.addRoute('GET', path, callback, 200)
|
package/src/server.ts
CHANGED
|
@@ -27,8 +27,22 @@ export async function serve(options: ServeOptions = {}) {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export async function serverResponse(req: Request) {
|
|
30
|
+
const timestamp = new Date().toISOString()
|
|
31
|
+
|
|
32
|
+
// log the request in a structured way like Laravel does in the console
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log(`${timestamp} - Incoming request: ${req.method} ${req.url}`)
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.log(`${timestamp} - Headers: ${JSON.stringify(req.headers)}`)
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.log(`${timestamp} - Body: ${JSON.stringify(req.body)}`)
|
|
30
39
|
// eslint-disable-next-line no-console
|
|
31
|
-
console.log(
|
|
40
|
+
console.log(`${timestamp} - Query: ${JSON.stringify(req.query)}`)
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.log(`${timestamp} - Params: ${JSON.stringify(req.params)}`)
|
|
43
|
+
// eslint-disable-next-line no-console
|
|
44
|
+
console.log(`${timestamp} - Cookies: ${JSON.stringify(req.cookies)}`)
|
|
45
|
+
|
|
32
46
|
const routesList: Route[] = await route.getRoutes()
|
|
33
47
|
const url = new URL(req.url)
|
|
34
48
|
|