@spirobel/mininext 0.2.13 → 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/url.d.ts CHANGED
@@ -41,6 +41,7 @@ export declare class Mini<X = undefined> {
41
41
  route: string;
42
42
  params: URLSearchParams;
43
43
  form: Form;
44
+ requrl: Readonly<URL>;
44
45
  constructor(mini: Mini<undefined | any>, data: X);
45
46
  }
46
47
  /**
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 = new URL(req.url).pathname;
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/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 = new URL(req.url).pathname;
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.13",
14
+ "version": "0.2.14",
16
15
  "devDependencies": {
17
16
  "@types/bun": "latest"
18
17
  },