@bleedingdev/modern-js-runtime-utils 3.8.3-ultramodern.6 → 3.9.0-ultramodern.10

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/cjs/url.js CHANGED
@@ -31,12 +31,29 @@ function normalizePathname(pathname) {
31
31
  const normalized = '/' + pathname.replace(/^\/+|\/+$/g, '');
32
32
  return normalized;
33
33
  }
34
+ const splitUrlTarget = (target)=>{
35
+ const hashIndex = target.indexOf('#');
36
+ const hash = hashIndex >= 0 ? target.slice(hashIndex) : '';
37
+ const beforeHash = hashIndex >= 0 ? target.slice(0, hashIndex) : target;
38
+ const searchIndex = beforeHash.indexOf('?');
39
+ const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : '';
40
+ const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
41
+ return {
42
+ pathname,
43
+ search,
44
+ hash
45
+ };
46
+ };
34
47
  __webpack_require__.d(__webpack_exports__, {
35
48
  normalizePathname: ()=>normalizePathname
49
+ }, {
50
+ splitUrlTarget: splitUrlTarget
36
51
  });
37
52
  exports.normalizePathname = __webpack_exports__.normalizePathname;
53
+ exports.splitUrlTarget = __webpack_exports__.splitUrlTarget;
38
54
  for(var __rspack_i in __webpack_exports__)if (-1 === [
39
- "normalizePathname"
55
+ "normalizePathname",
56
+ "splitUrlTarget"
40
57
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
41
58
  Object.defineProperty(exports, '__esModule', {
42
59
  value: true
package/dist/esm/url.mjs CHANGED
@@ -2,4 +2,17 @@ function normalizePathname(pathname) {
2
2
  const normalized = '/' + pathname.replace(/^\/+|\/+$/g, '');
3
3
  return normalized;
4
4
  }
5
- export { normalizePathname };
5
+ const splitUrlTarget = (target)=>{
6
+ const hashIndex = target.indexOf('#');
7
+ const hash = hashIndex >= 0 ? target.slice(hashIndex) : '';
8
+ const beforeHash = hashIndex >= 0 ? target.slice(0, hashIndex) : target;
9
+ const searchIndex = beforeHash.indexOf('?');
10
+ const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : '';
11
+ const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
12
+ return {
13
+ pathname,
14
+ search,
15
+ hash
16
+ };
17
+ };
18
+ export { normalizePathname, splitUrlTarget };
@@ -3,4 +3,17 @@ function normalizePathname(pathname) {
3
3
  const normalized = '/' + pathname.replace(/^\/+|\/+$/g, '');
4
4
  return normalized;
5
5
  }
6
- export { normalizePathname };
6
+ const splitUrlTarget = (target)=>{
7
+ const hashIndex = target.indexOf('#');
8
+ const hash = hashIndex >= 0 ? target.slice(hashIndex) : '';
9
+ const beforeHash = hashIndex >= 0 ? target.slice(0, hashIndex) : target;
10
+ const searchIndex = beforeHash.indexOf('?');
11
+ const search = searchIndex >= 0 ? beforeHash.slice(searchIndex) : '';
12
+ const pathname = searchIndex >= 0 ? beforeHash.slice(0, searchIndex) : beforeHash;
13
+ return {
14
+ pathname,
15
+ search,
16
+ hash
17
+ };
18
+ };
19
+ export { normalizePathname, splitUrlTarget };
@@ -1,2 +1,2 @@
1
- export * from './deferreds';
2
- export * from './nestedRoutes';
1
+ export * from './deferreds.js';
2
+ export * from './nestedRoutes.js';
@@ -1,6 +1,6 @@
1
1
  import Fs from '@modern-js/utils/fs-extra';
2
2
  import type { Buffer } from 'buffer';
3
- import type { Storage } from './storer/storage';
3
+ import type { Storage } from './storer/storage.js';
4
4
  export declare class FileReader {
5
5
  private storage;
6
6
  private fs;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ssr helpers
3
3
  */
4
- export { storage } from '../universal/async_storage.server';
5
- export * from './loaderContext';
6
- export { serializeJson } from './serialize';
4
+ export { storage } from '../universal/async_storage.server.js';
5
+ export * from './loaderContext/index.js';
6
+ export { serializeJson } from './serialize.js';
@@ -1,5 +1,5 @@
1
1
  import type { RequestPayload } from '@modern-js/types';
2
- import type { LoaderContext } from './createLoaderCtx';
2
+ import type { LoaderContext } from './createLoaderCtx.js';
3
3
  interface Get<P extends Record<string, unknown>> {
4
4
  <Key extends keyof P>(key: Key): P[Key];
5
5
  <T>(key: LoaderContext<T>): T;
@@ -1,4 +1,4 @@
1
1
  import type { Reporter } from '@modern-js/types';
2
- export type { LoaderContext } from './createLoaderCtx';
3
- export { createRequestContext, type RequestContext, } from './createRequestCtx';
4
- export declare const reporterCtx: import("./createLoaderCtx").LoaderContext<Reporter>;
2
+ export type { LoaderContext } from './createLoaderCtx.js';
3
+ export { createRequestContext, type RequestContext, } from './createRequestCtx.js';
4
+ export declare const reporterCtx: import("./createLoaderCtx.js").LoaderContext<Reporter>;
@@ -1,3 +1,3 @@
1
- import { Storage } from './storage';
2
- export { Storage } from './storage';
1
+ import { Storage } from './storage.js';
2
+ export { Storage } from './storage.js';
3
3
  export declare function createMemoryStorage<V extends {} | null>(namespace: string): Storage<V>;
@@ -1 +1 @@
1
- export * from './nestedRoutes';
1
+ export * from './nestedRoutes.js';
@@ -1,2 +1,2 @@
1
- import type { Storage } from './async_storage.server';
1
+ import type { Storage } from './async_storage.server.js';
2
2
  export declare const getAsyncLocalStorage: () => Promise<Storage | null>;
@@ -9,3 +9,9 @@
9
9
  * pathname3: '/', the nomalizeResult also as '/'
10
10
  */
11
11
  export declare function normalizePathname(pathname: string): string;
12
+ /** Split a relative target without decoding or normalizing its suffix. */
13
+ export declare const splitUrlTarget: (target: string) => {
14
+ pathname: string;
15
+ search: string;
16
+ hash: string;
17
+ };
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.8.3-ultramodern.6",
20
+ "version": "3.9.0-ultramodern.10",
21
21
  "_comment": "Provide ESM and CJS exports, ESM is used by runtime package, for treeshaking",
22
22
  "exports": {
23
23
  "./router": {
@@ -80,7 +80,11 @@
80
80
  },
81
81
  "./url": {
82
82
  "types": "./dist/types/url.d.ts",
83
- "default": "./dist/esm/url.mjs"
83
+ "default": "./dist/esm/url.mjs",
84
+ "node": {
85
+ "import": "./dist/esm-node/url.mjs",
86
+ "require": "./dist/cjs/url.js"
87
+ }
84
88
  },
85
89
  "./merge": {
86
90
  "types": "./dist/types/merge.d.ts",
@@ -143,8 +147,8 @@
143
147
  }
144
148
  },
145
149
  "dependencies": {
146
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.3-ultramodern.6",
147
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.3-ultramodern.6",
150
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.10",
151
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.10",
148
152
  "@swc/helpers": "^0.5.23",
149
153
  "lru-cache": "^11.5.2",
150
154
  "react-router": "7.18.2"
@@ -162,12 +166,12 @@
162
166
  }
163
167
  },
164
168
  "devDependencies": {
165
- "@rslib/core": "0.23.2",
169
+ "@rslib/core": "1.0.0",
166
170
  "@scripts/rstest-config": "2.66.0",
167
- "@types/ioredis-mock": "^8.2.7",
168
- "@types/node": "^26.2.0",
171
+ "@types/ioredis-mock": "^8.2.8",
172
+ "@types/node": "^26.4.1",
169
173
  "@typescript/native-preview": "7.0.0-dev.20260707.2",
170
- "happy-dom": "^20.10.6",
174
+ "happy-dom": "^20.14.0",
171
175
  "ioredis": "^5.11.1",
172
176
  "ioredis-mock": "^8.13.1",
173
177
  "react": "^19.2.8",