@h3ravel/http 11.15.0-alpha.16 → 11.17.0

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.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
2
  import { Command } from "@h3ravel/musket";
3
3
  import { CacheOptions, ClassConstructor, DotNestedKeys, DotNestedValue, GenericObject, IApplication, IHeaderBag, IHttpContext, IHttpResponse, IMiddleware, IParamBag, IRequest, IResponsable, IResponse, IRoute, ISessionManager, IUrl, MessagesForRules, RequestMethod, RequestObject, ResponseObject, RulesForData } from "@h3ravel/contracts";
4
+ import { ResponseCodes } from "@h3ravel/foundation";
4
5
  import { DateTime } from "@h3ravel/support";
5
6
  import { EventHandlerRequest, H3Event, HTTPResponse } from "h3";
6
- import { ResponseCodes } from "@h3ravel/foundation";
7
7
 
8
8
  //#region src/Commands/FireCommand.d.ts
9
9
  declare class FireCommand extends Command {
@@ -1445,9 +1445,6 @@ declare class HttpRequest {
1445
1445
  *
1446
1446
  * The base URL never ends with a /.
1447
1447
  *
1448
- * This is similar to getBasePath(), except that it also includes the
1449
- * script filename (e.g. index.php) if one exists.
1450
- *
1451
1448
  * @return string The raw URL (i.e. not urldecoded)
1452
1449
  */
1453
1450
  getBaseUrl(): string;
package/dist/index.js CHANGED
@@ -8,8 +8,6 @@ import { HTTP_RESPONSE_CACHE_CONTROL_DIRECTIVES, Injectable, ResponseCodes, stat
8
8
  import { Response as Response$1 } from "@h3ravel/support/facades";
9
9
  import { Arr, DateTime, InvalidArgumentException, Obj, RuntimeException, Str, data_get, data_set, safeDot } from "@h3ravel/support";
10
10
  import { H3Event, getQuery, getRequestIP, getRequestProtocol, getRouterParams, parseCookies } from "h3";
11
- import path from "node:path";
12
- import { fileURLToPath } from "node:url";
13
11
  //#region src/Commands/FireCommand.ts
14
12
  var FireCommand = class extends Command {
15
13
  /**
@@ -2337,10 +2335,6 @@ var InputBag = class extends ParamBag {
2337
2335
  }
2338
2336
  };
2339
2337
  //#endregion
2340
- //#region ../../node_modules/.pnpm/tsdown@0.22.2_tsx@4.20.6_typescript@6.0.3_unrun@0.2.15_@emnapi+core@1.11.0_@emnapi+runtime@1.11.0_/node_modules/tsdown/esm-shims.js
2341
- const getFilename = () => fileURLToPath(import.meta.url);
2342
- const __filename = /* @__PURE__ */ getFilename();
2343
- //#endregion
2344
2338
  //#region src/Utilities/FileBag.ts
2345
2339
  /**
2346
2340
  * FileBag is a container for uploaded files
@@ -2898,9 +2892,6 @@ var HttpRequest = class HttpRequest {
2898
2892
  *
2899
2893
  * The base URL never ends with a /.
2900
2894
  *
2901
- * This is similar to getBasePath(), except that it also includes the
2902
- * script filename (e.g. index.php) if one exists.
2903
- *
2904
2895
  * @return string The raw URL (i.e. not urldecoded)
2905
2896
  */
2906
2897
  getBaseUrl() {
@@ -2928,12 +2919,6 @@ var HttpRequest = class HttpRequest {
2928
2919
  * Prepares the base URL.
2929
2920
  */
2930
2921
  prepareBaseUrl() {
2931
- const requestUri = this.getRequestUri() ?? "";
2932
- const baseUrl = "/" + path.basename(__filename);
2933
- const normalizedRequestUri = requestUri.startsWith("/") ? requestUri : "/" + requestUri;
2934
- if (normalizedRequestUri.startsWith(baseUrl)) return baseUrl;
2935
- const dirBase = path.dirname(baseUrl);
2936
- if (normalizedRequestUri.startsWith(dirBase)) return dirBase.replace(/[/\\]+$/, "");
2937
2922
  return "";
2938
2923
  }
2939
2924
  /**
@@ -2963,15 +2948,7 @@ var HttpRequest = class HttpRequest {
2963
2948
  * Prepares the base path.
2964
2949
  */
2965
2950
  prepareBasePath() {
2966
- const baseUrl = this.getBaseUrl();
2967
- if (!baseUrl) return "";
2968
- const scriptFilename = this._server.get("SCRIPT_FILENAME") ?? "";
2969
- const filename = path.basename(scriptFilename);
2970
- let basePath;
2971
- if (path.basename(baseUrl) === filename) basePath = path.dirname(baseUrl);
2972
- else basePath = baseUrl;
2973
- basePath = basePath.replace(/\\/g, "/");
2974
- return basePath.replace(/\/+$/, "");
2951
+ return Str.rtrim(this.getBaseUrl(), "/");
2975
2952
  }
2976
2953
  /**
2977
2954
  * Prepares the path info.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/http",
3
- "version": "11.15.0-alpha.16",
3
+ "version": "11.17.0",
4
4
  "description": "HTTP kernel, middleware pipeline, request/response classes for H3ravel.",
5
5
  "h3ravel": {
6
6
  "providers": [
@@ -8,9 +8,7 @@
8
8
  ]
9
9
  },
10
10
  "type": "module",
11
- "main": "./dist/index.cjs",
12
11
  "types": "./dist/index.d.ts",
13
- "module": "./dist/index.js",
14
12
  "exports": {
15
13
  ".": {
16
14
  "import": "./dist/index.js",
@@ -41,24 +39,24 @@
41
39
  "laravel"
42
40
  ],
43
41
  "dependencies": {
44
- "@h3ravel/contracts": "^1.29.0-alpha.16",
45
- "@h3ravel/support": "^1.29.0-alpha.16",
42
+ "@h3ravel/contracts": "^2.0.0",
43
+ "@h3ravel/support": "^2.0.0",
46
44
  "@h3ravel/musket": "^1.29.0-alpha.15",
47
- "@h3ravel/shared": "^1.29.0-alpha.16",
48
- "@h3ravel/session": "^1.29.0-alpha.16",
45
+ "@h3ravel/shared": "^2.0.0",
46
+ "@h3ravel/session": "^2.0.0",
49
47
  "h3": "2.0.1-rc.5",
50
48
  "srvx": "^0.8.2"
51
49
  },
52
50
  "peerDependencies": {
53
- "@h3ravel/validation": "^1.29.0-alpha.16",
54
- "@h3ravel/foundation": "^1.29.0-alpha.16"
51
+ "@h3ravel/validation": "^2.0.0",
52
+ "@h3ravel/foundation": "^2.0.0"
55
53
  },
56
54
  "devDependencies": {
57
55
  "typescript": "^6.0.0"
58
56
  },
59
57
  "scripts": {
60
58
  "build": "tsdown --config-loader unrun",
61
- "dev": "tsx watch src/index.ts",
59
+ "dev": "tsdown --watch --config-loader unrun",
62
60
  "start": "node dist/index.js",
63
61
  "lint": "eslint . --ext .ts",
64
62
  "test": "jest --passWithNoTests",