@yh-ui/request 1.0.25 → 1.0.30

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.
@@ -8,6 +8,7 @@ exports.detectPlatform = detectPlatform;
8
8
  exports.getAdapter = getAdapter;
9
9
  exports.getBestAdapter = getBestAdapter;
10
10
  exports.platform = void 0;
11
+ var _fetch = require("./fetch.cjs");
11
12
  function detectPlatform() {
12
13
  const globalObj = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : {};
13
14
  if (typeof Deno !== "undefined") {
@@ -374,7 +375,7 @@ function getBestAdapter() {
374
375
  return new NodeHttpAdapter();
375
376
  case "browser":
376
377
  default:
377
- return new (require("./fetch.cjs").FetchAdapter)();
378
+ return new _fetch.FetchAdapter();
378
379
  }
379
380
  }
380
381
  function getAdapter(environment) {
@@ -389,6 +390,6 @@ function getAdapter(environment) {
389
390
  return new NodeHttpAdapter();
390
391
  case "browser":
391
392
  default:
392
- return new (require("./fetch.cjs").FetchAdapter)();
393
+ return new _fetch.FetchAdapter();
393
394
  }
394
395
  }
@@ -1,3 +1,4 @@
1
+ import { FetchAdapter } from "./fetch.mjs";
1
2
  export function detectPlatform() {
2
3
  const globalObj = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : {};
3
4
  if (typeof Deno !== "undefined") {
@@ -349,7 +350,7 @@ export function getBestAdapter() {
349
350
  return new NodeHttpAdapter();
350
351
  case "browser":
351
352
  default:
352
- return new (require("./fetch")).FetchAdapter();
353
+ return new FetchAdapter();
353
354
  }
354
355
  }
355
356
  export function getAdapter(environment) {
@@ -364,6 +365,6 @@ export function getAdapter(environment) {
364
365
  return new NodeHttpAdapter();
365
366
  case "browser":
366
367
  default:
367
- return new (require("./fetch")).FetchAdapter();
368
+ return new FetchAdapter();
368
369
  }
369
370
  }
@@ -46,11 +46,11 @@ Object.keys(_indexedDB).forEach(function (key) {
46
46
  function createCache(type = "memory", options) {
47
47
  switch (type) {
48
48
  case "localStorage":
49
- return new (require("./localStorage.cjs").LocalStorageCache)(options);
49
+ return new _localStorage.LocalStorageCache(options);
50
50
  case "indexedDB":
51
- return new (require("./indexedDB.cjs").IndexedDBCache)(options);
51
+ return new _indexedDB.IndexedDBCache(options);
52
52
  case "memory":
53
53
  default:
54
- return new (require("./memory.cjs").MemoryCache)();
54
+ return new _memory.MemoryCache();
55
55
  }
56
56
  }
@@ -4,18 +4,21 @@
4
4
  export * from './memory';
5
5
  export * from './localStorage';
6
6
  export * from './indexedDB';
7
- import { type CacheOptions } from './memory';
7
+ import { MemoryCache, type CacheOptions } from './memory';
8
+ import { LocalStorageCache, type LocalStorageCacheOptions } from './localStorage';
9
+ import { IndexedDBCache, type IndexedDBCacheOptions } from './indexedDB';
8
10
  /**
9
11
  * 创建缓存实例的工厂函数
10
12
  */
11
13
  export type CacheType = 'memory' | 'localStorage' | 'indexedDB';
14
+ export type CacheInstanceOptions = CacheOptions | LocalStorageCacheOptions | IndexedDBCacheOptions;
12
15
  export interface CacheFactoryOptions {
13
16
  /** 缓存类型 */
14
17
  type?: CacheType;
15
18
  /** 缓存选项 */
16
- options?: CacheOptions;
19
+ options?: CacheInstanceOptions;
17
20
  }
18
21
  /**
19
22
  * 根据类型创建缓存实例
20
23
  */
21
- export declare function createCache(type?: CacheType, options?: CacheOptions): any;
24
+ export declare function createCache(type?: CacheType, options?: CacheInstanceOptions): MemoryCache | LocalStorageCache | IndexedDBCache;
@@ -1,14 +1,17 @@
1
1
  export * from "./memory.mjs";
2
2
  export * from "./localStorage.mjs";
3
3
  export * from "./indexedDB.mjs";
4
+ import { MemoryCache } from "./memory.mjs";
5
+ import { LocalStorageCache } from "./localStorage.mjs";
6
+ import { IndexedDBCache } from "./indexedDB.mjs";
4
7
  export function createCache(type = "memory", options) {
5
8
  switch (type) {
6
9
  case "localStorage":
7
- return new (require("./localStorage")).LocalStorageCache(options);
10
+ return new LocalStorageCache(options);
8
11
  case "indexedDB":
9
- return new (require("./indexedDB")).IndexedDBCache(options);
12
+ return new IndexedDBCache(options);
10
13
  case "memory":
11
14
  default:
12
- return new (require("./memory")).MemoryCache();
15
+ return new MemoryCache();
13
16
  }
14
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yh-ui/request",
3
- "version": "1.0.25",
3
+ "version": "1.0.30",
4
4
  "description": "YH-UI HTTP request hooks - Enterprise-grade request management",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -23,8 +23,16 @@
23
23
  "files": [
24
24
  "dist"
25
25
  ],
26
+ "scripts": {
27
+ "build": "unbuild",
28
+ "dev": "unbuild --stub",
29
+ "typecheck": "vue-tsc --noEmit",
30
+ "lint": "eslint .",
31
+ "prepack": "node ../../scripts/prepare-package-manifest.mjs prepare",
32
+ "postpack": "node ../../scripts/prepare-package-manifest.mjs restore"
33
+ },
26
34
  "dependencies": {
27
- "@yh-ui/utils": "^1.0.25"
35
+ "@yh-ui/utils": "^1.0.30"
28
36
  },
29
37
  "devDependencies": {
30
38
  "vue": "^3.5.27",
@@ -52,11 +60,5 @@
52
60
  ],
53
61
  "homepage": "https://1079161148.github.io/yh-ui/",
54
62
  "author": "YH-UI Team",
55
- "license": "MIT",
56
- "scripts": {
57
- "build": "unbuild",
58
- "dev": "unbuild --stub",
59
- "typecheck": "vue-tsc --noEmit",
60
- "lint": "eslint ."
61
- }
62
- }
63
+ "license": "MIT"
64
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 YH-UI Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.