stacks 0.58.50 → 0.58.52
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/core/actions/dist/src/deploy/index.js +2 -2
- package/core/actions/dist/src/upgrade.js +1 -1
- package/core/actions/package.json +1 -1
- package/core/actions/src/build/cli.ts +1 -1
- package/core/actions/src/build/server.ts +9 -0
- package/core/actions/src/deploy/index.ts +2 -2
- package/core/actions/tsconfig.json +3 -0
- package/core/ai/package.json +1 -1
- package/core/ai/tsconfig.json +3 -0
- package/core/alias/package.json +1 -1
- package/core/alias/tsconfig.json +3 -0
- package/core/analytics/package.json +1 -1
- package/core/analytics/tsconfig.json +3 -0
- package/core/api/package.json +1 -1
- package/core/api/tsconfig.json +3 -0
- package/core/arrays/package.json +1 -1
- package/core/arrays/tsconfig.json +3 -0
- package/core/auth/package.json +1 -1
- package/core/auth/tsconfig.json +3 -0
- package/core/buddy/dist/{chunk-91084836e95161e8.js → chunk-d52e40a990b45728.js} +152 -84
- package/core/buddy/dist/cli.js +4 -1
- package/core/buddy/dist/index.js +3 -1
- package/core/buddy/package.json +1 -1
- package/core/buddy/src/cli.ts +2 -0
- package/core/buddy/src/commands/build.ts +17 -1
- package/core/buddy/src/commands/deploy.ts +2 -2
- package/core/buddy/src/commands/index.ts +1 -0
- package/core/buddy/src/commands/list.ts +39 -0
- package/core/buddy/src/commands/setup.ts +57 -1
- package/core/buddy/tsconfig.json +3 -0
- package/core/build/package.json +1 -1
- package/core/build/tsconfig.json +3 -0
- package/core/bun-create/bud/package.json +1 -1
- package/core/bun-create/buddy/package.json +1 -1
- package/core/bun-create/stack/package.json +1 -1
- package/core/bun-create/stacks/package.json +1 -1
- package/core/bun-create/stx/package.json +2 -1
- package/core/bun-plugin-yaml/package.json +1 -1
- package/core/bun-plugin-yaml/tsconfig.json +3 -0
- package/core/cache/package.json +1 -1
- package/core/cache/tsconfig.json +3 -0
- package/core/chat/package.json +8 -8
- package/core/chat/tsconfig.json +3 -0
- package/core/cli/dist/index.js +1 -1
- package/core/cli/package.json +1 -1
- package/core/cli/tsconfig.json +3 -0
- package/core/cloud/build.ts +1 -1
- package/core/cloud/deploy.ts +10 -1
- package/core/cloud/dist/index.js +167 -807
- package/core/cloud/package.json +2 -3
- package/core/cloud/src/cloud/aws-sdk-layer/nodejs/package.json +1 -1
- package/core/cloud/src/cloud/cdn.ts +59 -6
- package/core/cloud/src/cloud/compute.ts +29 -19
- package/core/cloud/src/cloud/dns.ts +8 -0
- package/core/cloud/src/cloud/index.ts +8 -2
- package/core/cloud/src/cloud/queue.ts +46 -0
- package/core/cloud/src/cloud/router-layer/nodejs/package.json +2 -2
- package/core/cloud/src/cloud/security.ts +1 -1
- package/core/cloud/src/helpers.ts +13 -1
- package/core/cloud/tsconfig.json +3 -0
- package/core/collections/package.json +1 -1
- package/core/collections/tsconfig.json +3 -0
- package/core/config/dist/index.js +154 -83
- package/core/config/package.json +2 -2
- package/core/config/tsconfig.json +3 -0
- package/core/database/package.json +1 -1
- package/core/database/src/kysely-bun-worker/mitt.ts +1 -1
- package/core/database/tsconfig.json +3 -0
- package/core/datetime/package.json +1 -1
- package/core/datetime/tsconfig.json +3 -0
- package/core/desktop/package.json +1 -1
- package/core/desktop/tsconfig.json +3 -0
- package/core/development/package.json +1 -1
- package/core/development/tsconfig.json +3 -0
- package/core/dns/package.json +1 -1
- package/core/dns/tsconfig.json +3 -0
- package/core/docs/package.json +1 -1
- package/core/docs/tsconfig.json +3 -0
- package/core/email/package.json +12 -12
- package/core/email/tsconfig.json +3 -0
- package/core/enums/dist/index.js +1 -0
- package/core/enums/package.json +1 -1
- package/core/enums/src/index.ts +1 -0
- package/core/enums/tsconfig.json +3 -0
- package/core/env/package.json +1 -1
- package/core/env/tsconfig.json +3 -0
- package/core/error-handling/package.json +1 -1
- package/core/error-handling/tsconfig.json +3 -0
- package/core/eslint-config/package.json +3 -3
- package/core/eslint-config/src/configs/typescript.ts +1 -0
- package/core/eslint-config/src/factory.ts +1 -0
- package/core/events/package.json +1 -1
- package/core/events/src/index.ts +3 -6
- package/core/events/tsconfig.json +3 -0
- package/core/faker/package.json +1 -1
- package/core/faker/tsconfig.json +3 -0
- package/core/git/package.json +1 -1
- package/core/git/tsconfig.json +3 -0
- package/core/health/package.json +1 -1
- package/core/health/tsconfig.json +3 -0
- package/core/http/package.json +1 -1
- package/core/http/tsconfig.json +3 -0
- package/core/lint/package.json +1 -1
- package/core/lint/tsconfig.json +3 -0
- package/core/logging/package.json +1 -1
- package/core/logging/tsconfig.json +3 -0
- package/core/notifications/package.json +22 -22
- package/core/notifications/tsconfig.json +3 -0
- package/core/objects/package.json +1 -1
- package/core/objects/tsconfig.json +3 -0
- package/core/orm/package.json +1 -1
- package/core/orm/tsconfig.json +3 -0
- package/core/path/package.json +1 -1
- package/core/path/tsconfig.json +3 -0
- package/core/payments/dist/index.js +21 -3
- package/core/payments/package.json +1 -1
- package/core/payments/tsconfig.json +3 -0
- package/core/push/package.json +5 -5
- package/core/push/tsconfig.json +3 -0
- package/core/query-builder/package.json +1 -1
- package/core/query-builder/tsconfig.json +3 -0
- package/core/queue/package.json +1 -1
- package/core/queue/tsconfig.json +3 -0
- package/core/raycast/package.json +1 -1
- package/core/realtime/package.json +1 -1
- package/core/realtime/tsconfig.json +3 -0
- package/core/repl/package.json +1 -1
- package/core/repl/tsconfig.json +3 -0
- package/core/router/dist/index.js +3 -4
- package/core/router/package.json +1 -1
- package/core/router/src/router.ts +11 -11
- package/core/router/src/server.ts +4 -4
- package/core/router/tsconfig.json +3 -0
- package/core/scheduler/build.ts +1 -1
- package/core/scheduler/dist/index.js +682 -152
- package/core/scheduler/package.json +7 -4
- package/core/scheduler/src/constants.ts +81 -0
- package/core/scheduler/src/errors.ts +7 -0
- package/core/scheduler/src/index.ts +15 -317
- package/core/scheduler/src/job.ts +315 -0
- package/core/scheduler/src/schedule.ts +111 -0
- package/core/scheduler/src/time.ts +823 -0
- package/core/scheduler/src/types/cron.ts +98 -0
- package/core/scheduler/src/types/utils.ts +14 -0
- package/core/scheduler/src/utils.ts +19 -0
- package/core/scheduler/tests/cron.fuzz.ts +120 -0
- package/core/scheduler/tests/cron.test.ts +1241 -0
- package/core/scheduler/tests/crontime.test.ts +778 -0
- package/core/scheduler/tsconfig.json +3 -0
- package/core/search-engine/package.json +1 -1
- package/core/search-engine/tsconfig.json +3 -0
- package/core/security/package.json +1 -1
- package/core/security/tsconfig.json +3 -0
- package/core/server/package.json +1 -1
- package/core/server/tsconfig.json +3 -0
- package/core/signals/package.json +1 -1
- package/core/signals/tsconfig.json +3 -0
- package/core/slug/package.json +1 -1
- package/core/slug/tsconfig.json +3 -0
- package/core/sms/package.json +11 -11
- package/core/sms/tsconfig.json +3 -0
- package/core/storage/package.json +1 -1
- package/core/storage/tsconfig.json +3 -0
- package/core/strings/package.json +1 -1
- package/core/strings/tsconfig.json +3 -0
- package/core/tables/package.json +1 -1
- package/core/tables/tsconfig.json +3 -0
- package/core/testing/package.json +1 -1
- package/core/testing/tsconfig.json +3 -0
- package/core/tinker/package.json +1 -1
- package/core/tinker/tsconfig.json +3 -0
- package/core/tunnel/package.json +1 -1
- package/core/tunnel/tsconfig.json +3 -0
- package/core/types/package.json +3 -3
- package/core/types/src/app.ts +2 -2
- package/core/types/src/cli.ts +1 -1
- package/core/types/src/cloud.ts +5 -1
- package/core/types/src/cron-jobs.ts +1 -0
- package/core/types/src/queue.ts +3 -1
- package/core/types/tsconfig.json +3 -0
- package/core/ui/package.json +4 -4
- package/core/ui/tsconfig.json +3 -0
- package/core/utils/dist/index.js +1 -1
- package/core/utils/package.json +1 -1
- package/core/utils/src/promise.ts +2 -2
- package/core/utils/tsconfig.json +3 -0
- package/core/validation/package.json +1 -1
- package/core/validation/src/rules.ts +3 -3
- package/core/validation/tsconfig.json +3 -0
- package/core/vite/dist/index.js +1 -1
- package/core/vite/package.json +1 -1
- package/core/vite/tsconfig.json +3 -0
- package/core/whois/package.json +1 -1
- package/core/whois/tsconfig.json +3 -0
- package/core/x-ray/package.json +1 -1
- package/core/x-ray/tsconfig.json +3 -0
- package/core/zsh-buddy/README.md +6 -2
- package/core/zsh-buddy/buddy.plugin.zsh +109 -0
- package/core/zsh-buddy/package.json +1 -1
- package/ide/dictionary.txt +2 -0
- package/ide/vscode/package.json +1 -1
- package/package.json +1 -1
- package/buddy +0 -2
- package/core/actions/src/zip/api.ts +0 -22
- package/core/bud +0 -2
- package/core/cloud/buddy +0 -2
- package/core/cloud/src/cloud/package/README.md +0 -59
- package/core/cloud/src/cloud/package/package.json +0 -63
- package/core/scheduler/tests/example.test.ts +0 -5
package/core/events/src/index.ts
CHANGED
|
@@ -23,14 +23,11 @@ export type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<
|
|
|
23
23
|
export interface Emitter<Events extends Record<EventType, unknown>> {
|
|
24
24
|
all: EventHandlerMap<Events>
|
|
25
25
|
|
|
26
|
-
on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void
|
|
27
|
-
on(type: '*', handler: WildcardHandler<Events>): void
|
|
26
|
+
on: (<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>) => void) & ((type: '*', handler: WildcardHandler<Events>) => void)
|
|
28
27
|
|
|
29
|
-
off<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void
|
|
30
|
-
off(type: '*', handler: WildcardHandler<Events>): void
|
|
28
|
+
off: (<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>) => void) & ((type: '*', handler: WildcardHandler<Events>) => void)
|
|
31
29
|
|
|
32
|
-
emit<Key extends keyof Events>(type: Key, event: Events[Key]): void
|
|
33
|
-
emit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void
|
|
30
|
+
emit: (<Key extends keyof Events>(type: Key, event: Events[Key]) => void) & (<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never) => void)
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
/**
|
package/core/faker/package.json
CHANGED
package/core/git/package.json
CHANGED
package/core/health/package.json
CHANGED
package/core/http/package.json
CHANGED
package/core/lint/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/notifications",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.52",
|
|
5
5
|
"description": "The Stacks notifications integration.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -76,27 +76,27 @@
|
|
|
76
76
|
"@stacksjs/types": "workspace:*"
|
|
77
77
|
},
|
|
78
78
|
"optionalDependencies": {
|
|
79
|
-
"@novu/discord": "^0.
|
|
80
|
-
"@novu/emailjs": "^0.
|
|
81
|
-
"@novu/gupshup": "^0.
|
|
82
|
-
"@novu/mailgun": "^0.
|
|
83
|
-
"@novu/mailjet": "^0.
|
|
84
|
-
"@novu/mandrill": "^0.
|
|
85
|
-
"@novu/netcore": "^0.
|
|
86
|
-
"@novu/nexmo": "^0.
|
|
87
|
-
"@novu/node": "^0.
|
|
88
|
-
"@novu/nodemailer": "^0.
|
|
89
|
-
"@novu/plivo": "^0.
|
|
90
|
-
"@novu/postmark": "^0.
|
|
91
|
-
"@novu/sendgrid": "^0.
|
|
92
|
-
"@novu/ses": "^0.
|
|
93
|
-
"@novu/slack": "^0.
|
|
94
|
-
"@novu/sms77": "^0.
|
|
95
|
-
"@novu/sns": "^0.
|
|
96
|
-
"@novu/stateless": "^0.
|
|
97
|
-
"@novu/telnyx": "^0.
|
|
98
|
-
"@novu/termii": "^0.
|
|
99
|
-
"@novu/twilio": "^0.
|
|
79
|
+
"@novu/discord": "^0.23.0",
|
|
80
|
+
"@novu/emailjs": "^0.23.0",
|
|
81
|
+
"@novu/gupshup": "^0.23.0",
|
|
82
|
+
"@novu/mailgun": "^0.23.0",
|
|
83
|
+
"@novu/mailjet": "^0.23.0",
|
|
84
|
+
"@novu/mandrill": "^0.23.0",
|
|
85
|
+
"@novu/netcore": "^0.23.0",
|
|
86
|
+
"@novu/nexmo": "^0.23.0",
|
|
87
|
+
"@novu/node": "^0.23.0",
|
|
88
|
+
"@novu/nodemailer": "^0.23.0",
|
|
89
|
+
"@novu/plivo": "^0.23.0",
|
|
90
|
+
"@novu/postmark": "^0.23.0",
|
|
91
|
+
"@novu/sendgrid": "^0.23.0",
|
|
92
|
+
"@novu/ses": "^0.23.0",
|
|
93
|
+
"@novu/slack": "^0.23.0",
|
|
94
|
+
"@novu/sms77": "^0.23.0",
|
|
95
|
+
"@novu/sns": "^0.23.0",
|
|
96
|
+
"@novu/stateless": "^0.23.0",
|
|
97
|
+
"@novu/telnyx": "^0.23.0",
|
|
98
|
+
"@novu/termii": "^0.23.0",
|
|
99
|
+
"@novu/twilio": "^0.23.0"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@stacksjs/development": "workspace:*"
|
package/core/orm/package.json
CHANGED
package/core/path/package.json
CHANGED
|
@@ -26,6 +26,21 @@ var __export = (target, all) => {
|
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
// /home/runner/work/stacks/stacks/node_modules/es-errors/range.js
|
|
30
|
+
var require_range = __commonJS((exports, module) => {
|
|
31
|
+
module.exports = RangeError;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// /home/runner/work/stacks/stacks/node_modules/es-errors/syntax.js
|
|
35
|
+
var require_syntax = __commonJS((exports, module) => {
|
|
36
|
+
module.exports = SyntaxError;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// /home/runner/work/stacks/stacks/node_modules/es-errors/type.js
|
|
40
|
+
var require_type = __commonJS((exports, module) => {
|
|
41
|
+
module.exports = TypeError;
|
|
42
|
+
});
|
|
43
|
+
|
|
29
44
|
// /home/runner/work/stacks/stacks/node_modules/has-symbols/shams.js
|
|
30
45
|
var require_shams = __commonJS((exports, module) => {
|
|
31
46
|
module.exports = function hasSymbols() {
|
|
@@ -191,9 +206,10 @@ var require_hasown = __commonJS((exports, module) => {
|
|
|
191
206
|
// /home/runner/work/stacks/stacks/node_modules/get-intrinsic/index.js
|
|
192
207
|
var require_get_intrinsic = __commonJS((exports, module) => {
|
|
193
208
|
var undefined2;
|
|
194
|
-
var $
|
|
209
|
+
var $RangeError = require_range();
|
|
210
|
+
var $SyntaxError = require_syntax();
|
|
211
|
+
var $TypeError = require_type();
|
|
195
212
|
var $Function = Function;
|
|
196
|
-
var $TypeError = TypeError;
|
|
197
213
|
var getEvalledConstructor = function(expressionSyntax) {
|
|
198
214
|
try {
|
|
199
215
|
return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
|
|
@@ -231,6 +247,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
231
247
|
var needsEval = {};
|
|
232
248
|
var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array);
|
|
233
249
|
var INTRINSICS = {
|
|
250
|
+
__proto__: null,
|
|
234
251
|
"%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
|
|
235
252
|
"%Array%": Array,
|
|
236
253
|
"%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
|
|
@@ -275,7 +292,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
275
292
|
"%parseInt%": parseInt,
|
|
276
293
|
"%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
|
|
277
294
|
"%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
|
|
278
|
-
"%RangeError%": RangeError,
|
|
295
|
+
"%RangeError%": $RangeError,
|
|
279
296
|
"%ReferenceError%": ReferenceError,
|
|
280
297
|
"%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
|
|
281
298
|
"%RegExp%": RegExp,
|
|
@@ -330,6 +347,7 @@ var require_get_intrinsic = __commonJS((exports, module) => {
|
|
|
330
347
|
return value;
|
|
331
348
|
};
|
|
332
349
|
var LEGACY_ALIASES = {
|
|
350
|
+
__proto__: null,
|
|
333
351
|
"%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
|
|
334
352
|
"%ArrayPrototype%": ["Array", "prototype"],
|
|
335
353
|
"%ArrayProto_entries%": ["Array", "prototype", "entries"],
|
package/core/push/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/push",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.58.
|
|
4
|
+
"version": "0.58.52",
|
|
5
5
|
"description": "The Stacks Push integration",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"prepublishOnly": "bun --bun run build"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@novu/node": "^0.
|
|
50
|
-
"@novu/stateless": "^0.
|
|
49
|
+
"@novu/node": "^0.23.0",
|
|
50
|
+
"@novu/stateless": "^0.23.0",
|
|
51
51
|
"@stacksjs/cli": "workspace:*",
|
|
52
52
|
"@stacksjs/config": "workspace:*",
|
|
53
53
|
"@stacksjs/error-handling": "workspace:*"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@novu/node": "^0.
|
|
57
|
-
"@novu/stateless": "^0.
|
|
56
|
+
"@novu/node": "^0.23.0",
|
|
57
|
+
"@novu/stateless": "^0.23.0",
|
|
58
58
|
"@stacksjs/cli": "workspace:*",
|
|
59
59
|
"@stacksjs/config": "workspace:*",
|
|
60
60
|
"@stacksjs/error-handling": "workspace:*"
|
package/core/queue/package.json
CHANGED
package/core/repl/package.json
CHANGED
|
@@ -159,9 +159,8 @@ var request = new Request;
|
|
|
159
159
|
// src/server.ts
|
|
160
160
|
import {extname as extname2} from "path";
|
|
161
161
|
import {URL} from "url";
|
|
162
|
-
import {localUrl} from "@stacksjs/config";
|
|
163
162
|
async function serve(options = {}) {
|
|
164
|
-
const hostname = options.host ||
|
|
163
|
+
const hostname = options.host || "localhost";
|
|
165
164
|
const port = options.port || 3000;
|
|
166
165
|
Bun.serve({
|
|
167
166
|
hostname,
|
|
@@ -173,7 +172,7 @@ async function serve(options = {}) {
|
|
|
173
172
|
});
|
|
174
173
|
}
|
|
175
174
|
async function serverResponse(req) {
|
|
176
|
-
console.log("serverResponse", req);
|
|
175
|
+
console.log("serverResponse", JSON.stringify(req));
|
|
177
176
|
const routesList = await route.getRoutes();
|
|
178
177
|
const url = new URL(req.url);
|
|
179
178
|
const foundRoute = routesList.find((route2) => {
|
|
@@ -181,7 +180,7 @@ async function serverResponse(req) {
|
|
|
181
180
|
return pattern.test(url.pathname);
|
|
182
181
|
});
|
|
183
182
|
if (!foundRoute)
|
|
184
|
-
return new Response("
|
|
183
|
+
return new Response("Pretty 404 page coming soon", { status: 404 });
|
|
185
184
|
addRouteParamsAndQuery(url, foundRoute);
|
|
186
185
|
executeMiddleware(foundRoute);
|
|
187
186
|
return execute(foundRoute, req, { statusCode: foundRoute?.statusCode });
|
package/core/router/package.json
CHANGED
|
@@ -2,17 +2,17 @@ import type { RedirectCode, Route, RouteGroupOptions, StatusCode } from '@stacks
|
|
|
2
2
|
import { projectPath } from '@stacksjs/path'
|
|
3
3
|
|
|
4
4
|
export interface RouterInterface {
|
|
5
|
-
get(url: Route['url'], callback: Route['callback'])
|
|
6
|
-
post(url: Route['url'], callback: Route['callback'])
|
|
7
|
-
view(url: Route['url'], callback: Route['callback'])
|
|
8
|
-
redirect(url: Route['url'], callback: Route['callback'], status?: RedirectCode)
|
|
9
|
-
delete(url: Route['url'], callback: Route['callback'])
|
|
10
|
-
patch(url: Route['url'], callback: Route['callback'])
|
|
11
|
-
put(url: Route['url'], callback: Route['callback'])
|
|
12
|
-
group(options: RouteGroupOptions, callback: () => void)
|
|
13
|
-
name(name: string)
|
|
14
|
-
middleware(middleware: Route['middleware'])
|
|
15
|
-
getRoutes()
|
|
5
|
+
get: (url: Route['url'], callback: Route['callback']) => this
|
|
6
|
+
post: (url: Route['url'], callback: Route['callback']) => this
|
|
7
|
+
view: (url: Route['url'], callback: Route['callback']) => this
|
|
8
|
+
redirect: (url: Route['url'], callback: Route['callback'], status?: RedirectCode) => this
|
|
9
|
+
delete: (url: Route['url'], callback: Route['callback']) => this
|
|
10
|
+
patch: (url: Route['url'], callback: Route['callback']) => this
|
|
11
|
+
put: (url: Route['url'], callback: Route['callback']) => this
|
|
12
|
+
group: (options: RouteGroupOptions, callback: () => void) => this
|
|
13
|
+
name: (name: string) => this
|
|
14
|
+
middleware: (middleware: Route['middleware']) => this
|
|
15
|
+
getRoutes: () => Promise<Route[]>
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export class Router implements RouterInterface {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { extname } from 'node:path'
|
|
2
2
|
import { URL } from 'node:url'
|
|
3
3
|
import type { MiddlewareType, Route, StatusCode } from '@stacksjs/types'
|
|
4
|
-
import { localUrl } from '@stacksjs/config'
|
|
5
4
|
import { middlewares } from './middleware'
|
|
6
5
|
import { request } from './request'
|
|
7
6
|
import { route } from '.'
|
|
@@ -13,7 +12,8 @@ interface ServeOptions {
|
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export async function serve(options: ServeOptions = {}) {
|
|
16
|
-
|
|
15
|
+
// maybe make use of localUrl({ type: 'backend' }) here & options.tunnel
|
|
16
|
+
const hostname = options.host || 'localhost'
|
|
17
17
|
const port = options.port || 3000
|
|
18
18
|
|
|
19
19
|
Bun.serve({
|
|
@@ -30,7 +30,7 @@ export async function serve(options: ServeOptions = {}) {
|
|
|
30
30
|
|
|
31
31
|
export async function serverResponse(req: Request) {
|
|
32
32
|
// eslint-disable-next-line no-console
|
|
33
|
-
console.log('serverResponse', req)
|
|
33
|
+
console.log('serverResponse', JSON.stringify(req))
|
|
34
34
|
const routesList: Route[] = await route.getRoutes()
|
|
35
35
|
const url = new URL(req.url)
|
|
36
36
|
|
|
@@ -44,7 +44,7 @@ export async function serverResponse(req: Request) {
|
|
|
44
44
|
// return new Response('')
|
|
45
45
|
|
|
46
46
|
if (!foundRoute)
|
|
47
|
-
return new Response('
|
|
47
|
+
return new Response('Pretty 404 page coming soon', { status: 404 }) // TODO: create a pretty 404 page
|
|
48
48
|
|
|
49
49
|
addRouteParamsAndQuery(url, foundRoute)
|
|
50
50
|
executeMiddleware(foundRoute)
|
package/core/scheduler/build.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { log, runCommand } from '@stacksjs/cli'
|
|
2
2
|
|
|
3
|
-
const result = await runCommand('bun build ./src/index.ts --outdir dist --format esm --external
|
|
3
|
+
const result = await runCommand('bun build ./src/index.ts --outdir dist --format esm --external luxon --external @stacksjs/cli --target bun', {
|
|
4
4
|
cwd: import.meta.dir,
|
|
5
5
|
})
|
|
6
6
|
|