@spirobel/mininext 0.2.12 → 0.2.14
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/mininext.js +3 -2
- package/dist/url.d.ts +1 -0
- package/dist/url.js +4 -1
- package/mininext/mininext.ts +3 -3
- package/mininext/url.ts +4 -1
- package/package.json +1 -2
package/dist/mininext.js
CHANGED
|
@@ -146,14 +146,15 @@ const standardDevReloader = html `
|
|
|
146
146
|
`;
|
|
147
147
|
async function makeEntrypoint() {
|
|
148
148
|
let module;
|
|
149
|
+
const backendImportPath = projectRoot() + "/dist/backend.js";
|
|
149
150
|
try {
|
|
150
151
|
// @ts-ignore
|
|
151
|
-
module = await import(
|
|
152
|
+
module = await import(backendImportPath);
|
|
152
153
|
}
|
|
153
154
|
catch (error) {
|
|
154
155
|
await build();
|
|
155
156
|
// @ts-ignore
|
|
156
|
-
module = await import(
|
|
157
|
+
module = await import(backendImportPath);
|
|
157
158
|
}
|
|
158
159
|
return module.default;
|
|
159
160
|
}
|
package/dist/url.d.ts
CHANGED
package/dist/url.js
CHANGED
|
@@ -20,6 +20,7 @@ export class Mini {
|
|
|
20
20
|
route;
|
|
21
21
|
params;
|
|
22
22
|
form;
|
|
23
|
+
requrl;
|
|
23
24
|
constructor(mini, data) {
|
|
24
25
|
Object.assign(this, mini);
|
|
25
26
|
this.html = (html);
|
|
@@ -307,8 +308,9 @@ export class url {
|
|
|
307
308
|
return Url;
|
|
308
309
|
}
|
|
309
310
|
static async match(req, reqPath) {
|
|
311
|
+
const miniurl = Object.freeze(new URL(req.url));
|
|
310
312
|
if (typeof reqPath === "undefined") {
|
|
311
|
-
reqPath =
|
|
313
|
+
reqPath = miniurl.pathname;
|
|
312
314
|
}
|
|
313
315
|
const handler = url.direct_handlers_html.get(reqPath);
|
|
314
316
|
if (handler) {
|
|
@@ -331,6 +333,7 @@ export class url {
|
|
|
331
333
|
formData = await req.formData();
|
|
332
334
|
}
|
|
333
335
|
const mini = new Mini({
|
|
336
|
+
requrl: miniurl,
|
|
334
337
|
data: undefined,
|
|
335
338
|
req,
|
|
336
339
|
html,
|
package/mininext/mininext.ts
CHANGED
|
@@ -159,14 +159,14 @@ const standardDevReloader = html`
|
|
|
159
159
|
`;
|
|
160
160
|
async function makeEntrypoint() {
|
|
161
161
|
let module;
|
|
162
|
-
|
|
162
|
+
const backendImportPath = projectRoot() + "/dist/backend.js";
|
|
163
163
|
try {
|
|
164
164
|
// @ts-ignore
|
|
165
|
-
module = await import(
|
|
165
|
+
module = await import(backendImportPath);
|
|
166
166
|
} catch (error) {
|
|
167
167
|
await build();
|
|
168
168
|
// @ts-ignore
|
|
169
|
-
module = await import(
|
|
169
|
+
module = await import(backendImportPath);
|
|
170
170
|
}
|
|
171
171
|
return module.default as (w: any) => Promise<Response>;
|
|
172
172
|
}
|
package/mininext/url.ts
CHANGED
|
@@ -61,6 +61,7 @@ export class Mini<X = undefined> {
|
|
|
61
61
|
route!: string;
|
|
62
62
|
params!: URLSearchParams;
|
|
63
63
|
form!: Form;
|
|
64
|
+
requrl!: Readonly<URL>;
|
|
64
65
|
|
|
65
66
|
constructor(mini: Mini<undefined | any>, data: X) {
|
|
66
67
|
Object.assign(this, mini);
|
|
@@ -401,8 +402,9 @@ export class url {
|
|
|
401
402
|
return Url;
|
|
402
403
|
}
|
|
403
404
|
static async match(req: Request, reqPath?: string) {
|
|
405
|
+
const miniurl: Readonly<URL> = Object.freeze(new URL(req.url));
|
|
404
406
|
if (typeof reqPath === "undefined") {
|
|
405
|
-
reqPath =
|
|
407
|
+
reqPath = miniurl.pathname;
|
|
406
408
|
}
|
|
407
409
|
const handler = url.direct_handlers_html.get(reqPath);
|
|
408
410
|
if (handler) {
|
|
@@ -431,6 +433,7 @@ export class url {
|
|
|
431
433
|
|
|
432
434
|
const mini = new Mini(
|
|
433
435
|
{
|
|
436
|
+
requrl: miniurl,
|
|
434
437
|
data: undefined,
|
|
435
438
|
req,
|
|
436
439
|
html,
|
package/package.json
CHANGED
|
@@ -7,12 +7,11 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"publish": "bun run build && npm publish",
|
|
9
9
|
"build": "tsc",
|
|
10
|
-
"postversion": "git push --follow-tags",
|
|
11
10
|
"preversion": "bun run build"
|
|
12
11
|
|
|
13
12
|
},
|
|
14
13
|
"files": ["dist", "mininext"],
|
|
15
|
-
"version": "0.2.
|
|
14
|
+
"version": "0.2.14",
|
|
16
15
|
"devDependencies": {
|
|
17
16
|
"@types/bun": "latest"
|
|
18
17
|
},
|