@vobs/http 1.2.1 → 1.2.2

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/debug.cjs CHANGED
@@ -1,9 +1,33 @@
1
- 'use strict';
2
-
1
+ var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
2
+ "use strict";
3
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
5
21
 
6
22
  // packages/http/src/debug.ts
23
+ var debug_exports = {};
24
+ __export(debug_exports, {
25
+ emitHTTPDebug: () => emitHTTPDebug,
26
+ getHTTPDebugHooks: () => getHTTPDebugHooks,
27
+ setHTTPDebugHooks: () => setHTTPDebugHooks,
28
+ subscribeHTTPDebug: () => subscribeHTTPDebug
29
+ });
30
+ module.exports = __toCommonJS(debug_exports);
7
31
  var activeHTTPDebugHooks = null;
8
32
  var httpDebugListeners = /* @__PURE__ */ new Set();
9
33
  function setHTTPDebugHooks(hooks) {
@@ -34,10 +58,11 @@ function emitHTTPDebug(event) {
34
58
  }
35
59
  }
36
60
  __name(emitHTTPDebug, "emitHTTPDebug");
37
-
38
- exports.emitHTTPDebug = emitHTTPDebug;
39
- exports.getHTTPDebugHooks = getHTTPDebugHooks;
40
- exports.setHTTPDebugHooks = setHTTPDebugHooks;
41
- exports.subscribeHTTPDebug = subscribeHTTPDebug;
42
- //# sourceMappingURL=debug.cjs.map
61
+ // Annotate the CommonJS export names for ESM import in node:
62
+ 0 && (module.exports = {
63
+ emitHTTPDebug,
64
+ getHTTPDebugHooks,
65
+ setHTTPDebugHooks,
66
+ subscribeHTTPDebug
67
+ });
43
68
  //# sourceMappingURL=debug.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/debug.ts"],"names":[],"mappings":";;;;;;AAoCA,IAAI,oBAAA,GAA8C,IAAA;AAClD,IAAM,kBAAA,uBAAyB,GAAA,EAA4C;AAEpE,SAAS,kBAAkB,KAAA,EAAqD;AACrF,EAAA,MAAM,QAAA,GAAW,oBAAA;AACjB,EAAA,oBAAA,GAAuB,KAAA;AACvB,EAAA,OAAO,QAAA;AACT;AAJgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;AAMT,SAAS,iBAAA,GAA2C;AACzD,EAAA,OAAO,oBAAA;AACT;AAFgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;AAIT,SAAS,mBAAmB,QAAA,EAA8D;AAC/F,EAAA,kBAAA,CAAmB,IAAI,QAAQ,CAAA;AAC/B,EAAA,OAAO,MAAM,kBAAA,CAAmB,MAAA,CAAO,QAAQ,CAAA;AACjD;AAHgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA;AAKT,SAAS,cAAc,KAAA,EAA+B;AAC3D,EAAA,IAAI;AACF,IAAA,oBAAA,EAAsB,UAAU,KAAK,CAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,KAAA,MAAW,QAAA,IAAY,CAAC,GAAG,kBAAkB,CAAA,EAAG;AAC9C,IAAA,IAAI;AAAE,MAAA,QAAA,CAAS,KAAK,CAAA;AAAA,IAAE,CAAA,CAAA,MAAQ;AAAA,IAA0D;AAAA,EAC1F;AACF;AATgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"debug.cjs","sourcesContent":["import type { HTTPMethod, HTTPHeaders } from './index'\nimport type { RuntimeDebugContext } from '@vobs/runtime'\n\nexport type HTTPDebugStatus = 'loading' | 'retrying' | 'success' | 'error' | 'cancelled'\n\nexport type HTTPDebugCacheStatus = 'hit' | 'miss' | 'revalidated'\n\nexport interface HTTPDebugContext extends RuntimeDebugContext {\n readonly cacheStatus?: HTTPDebugCacheStatus\n /** Marks a request created from the DevTools request tester. */\n readonly test?: boolean\n}\n\nexport interface HTTPDebugRequest {\n readonly id: number\n readonly phase: 'start' | 'retry' | 'end'\n readonly status: HTTPDebugStatus\n readonly url: string\n readonly method: HTTPMethod\n readonly headers: HTTPHeaders\n readonly requestBody?: unknown\n readonly startedAt: number\n readonly endedAt?: number\n readonly duration?: number\n readonly attempt: number\n readonly retries: number\n readonly responseStatus?: number\n readonly responseBody?: unknown\n readonly error?: { readonly name: string; readonly message: string }\n readonly context?: HTTPDebugContext\n}\n\nexport interface HTTPDebugHooks {\n request?(event: HTTPDebugRequest): void\n}\n\nlet activeHTTPDebugHooks: HTTPDebugHooks | null = null\nconst httpDebugListeners = new Set<NonNullable<HTTPDebugHooks['request']>>()\n\nexport function setHTTPDebugHooks(hooks: HTTPDebugHooks | null): HTTPDebugHooks | null {\n const previous = activeHTTPDebugHooks\n activeHTTPDebugHooks = hooks\n return previous\n}\n\nexport function getHTTPDebugHooks(): HTTPDebugHooks | null {\n return activeHTTPDebugHooks\n}\n\nexport function subscribeHTTPDebug(listener: NonNullable<HTTPDebugHooks['request']>): () => void {\n httpDebugListeners.add(listener)\n return () => httpDebugListeners.delete(listener)\n}\n\nexport function emitHTTPDebug(event: HTTPDebugRequest): void {\n try {\n activeHTTPDebugHooks?.request?.(event)\n } catch {\n // Debug tooling must never change request behavior.\n }\n for (const listener of [...httpDebugListeners]) {\n try { listener(event) } catch { /* Debug tooling must never change request behavior. */ }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/debug.ts"],"sourcesContent":["import type { HTTPMethod, HTTPHeaders } from './index'\nimport type { RuntimeDebugContext } from '@vobs/runtime'\n\nexport type HTTPDebugStatus = 'loading' | 'retrying' | 'success' | 'error' | 'cancelled'\n\nexport type HTTPDebugCacheStatus = 'hit' | 'miss' | 'revalidated'\n\nexport interface HTTPDebugContext extends RuntimeDebugContext {\n readonly cacheStatus?: HTTPDebugCacheStatus\n /** Marks a request created from the DevTools request tester. */\n readonly test?: boolean\n}\n\nexport interface HTTPDebugRequest {\n readonly id: number\n readonly phase: 'start' | 'retry' | 'end'\n readonly status: HTTPDebugStatus\n readonly url: string\n readonly method: HTTPMethod\n readonly headers: HTTPHeaders\n readonly requestBody?: unknown\n readonly startedAt: number\n readonly endedAt?: number\n readonly duration?: number\n readonly attempt: number\n readonly retries: number\n readonly responseStatus?: number\n readonly responseBody?: unknown\n readonly error?: { readonly name: string; readonly message: string }\n readonly context?: HTTPDebugContext\n}\n\nexport interface HTTPDebugHooks {\n request?(event: HTTPDebugRequest): void\n}\n\nlet activeHTTPDebugHooks: HTTPDebugHooks | null = null\nconst httpDebugListeners = new Set<NonNullable<HTTPDebugHooks['request']>>()\n\nexport function setHTTPDebugHooks(hooks: HTTPDebugHooks | null): HTTPDebugHooks | null {\n const previous = activeHTTPDebugHooks\n activeHTTPDebugHooks = hooks\n return previous\n}\n\nexport function getHTTPDebugHooks(): HTTPDebugHooks | null {\n return activeHTTPDebugHooks\n}\n\nexport function subscribeHTTPDebug(listener: NonNullable<HTTPDebugHooks['request']>): () => void {\n httpDebugListeners.add(listener)\n return () => httpDebugListeners.delete(listener)\n}\n\nexport function emitHTTPDebug(event: HTTPDebugRequest): void {\n try {\n activeHTTPDebugHooks?.request?.(event)\n } catch {\n // Debug tooling must never change request behavior.\n }\n for (const listener of [...httpDebugListeners]) {\n try { listener(event) } catch { /* Debug tooling must never change request behavior. */ }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCA,IAAI,uBAA8C;AAClD,IAAM,qBAAqB,oBAAI,IAA4C;AAEpE,SAAS,kBAAkB,OAAqD;AACrF,QAAM,WAAW;AACjB,yBAAuB;AACvB,SAAO;AACT;AAJgB;AAMT,SAAS,oBAA2C;AACzD,SAAO;AACT;AAFgB;AAIT,SAAS,mBAAmB,UAA8D;AAC/F,qBAAmB,IAAI,QAAQ;AAC/B,SAAO,MAAM,mBAAmB,OAAO,QAAQ;AACjD;AAHgB;AAKT,SAAS,cAAc,OAA+B;AAC3D,MAAI;AACF,0BAAsB,UAAU,KAAK;AAAA,EACvC,QAAQ;AAAA,EAER;AACA,aAAW,YAAY,CAAC,GAAG,kBAAkB,GAAG;AAC9C,QAAI;AAAE,eAAS,KAAK;AAAA,IAAE,QAAQ;AAAA,IAA0D;AAAA,EAC1F;AACF;AATgB;","names":[]}
package/dist/debug.js CHANGED
@@ -32,7 +32,10 @@ function emitHTTPDebug(event) {
32
32
  }
33
33
  }
34
34
  __name(emitHTTPDebug, "emitHTTPDebug");
35
-
36
- export { emitHTTPDebug, getHTTPDebugHooks, setHTTPDebugHooks, subscribeHTTPDebug };
37
- //# sourceMappingURL=debug.js.map
35
+ export {
36
+ emitHTTPDebug,
37
+ getHTTPDebugHooks,
38
+ setHTTPDebugHooks,
39
+ subscribeHTTPDebug
40
+ };
38
41
  //# sourceMappingURL=debug.js.map
package/dist/debug.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/debug.ts"],"names":[],"mappings":";;;;AAoCA,IAAI,oBAAA,GAA8C,IAAA;AAClD,IAAM,kBAAA,uBAAyB,GAAA,EAA4C;AAEpE,SAAS,kBAAkB,KAAA,EAAqD;AACrF,EAAA,MAAM,QAAA,GAAW,oBAAA;AACjB,EAAA,oBAAA,GAAuB,KAAA;AACvB,EAAA,OAAO,QAAA;AACT;AAJgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;AAMT,SAAS,iBAAA,GAA2C;AACzD,EAAA,OAAO,oBAAA;AACT;AAFgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;AAIT,SAAS,mBAAmB,QAAA,EAA8D;AAC/F,EAAA,kBAAA,CAAmB,IAAI,QAAQ,CAAA;AAC/B,EAAA,OAAO,MAAM,kBAAA,CAAmB,MAAA,CAAO,QAAQ,CAAA;AACjD;AAHgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA;AAKT,SAAS,cAAc,KAAA,EAA+B;AAC3D,EAAA,IAAI;AACF,IAAA,oBAAA,EAAsB,UAAU,KAAK,CAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,KAAA,MAAW,QAAA,IAAY,CAAC,GAAG,kBAAkB,CAAA,EAAG;AAC9C,IAAA,IAAI;AAAE,MAAA,QAAA,CAAS,KAAK,CAAA;AAAA,IAAE,CAAA,CAAA,MAAQ;AAAA,IAA0D;AAAA,EAC1F;AACF;AATgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"debug.js","sourcesContent":["import type { HTTPMethod, HTTPHeaders } from './index'\nimport type { RuntimeDebugContext } from '@vobs/runtime'\n\nexport type HTTPDebugStatus = 'loading' | 'retrying' | 'success' | 'error' | 'cancelled'\n\nexport type HTTPDebugCacheStatus = 'hit' | 'miss' | 'revalidated'\n\nexport interface HTTPDebugContext extends RuntimeDebugContext {\n readonly cacheStatus?: HTTPDebugCacheStatus\n /** Marks a request created from the DevTools request tester. */\n readonly test?: boolean\n}\n\nexport interface HTTPDebugRequest {\n readonly id: number\n readonly phase: 'start' | 'retry' | 'end'\n readonly status: HTTPDebugStatus\n readonly url: string\n readonly method: HTTPMethod\n readonly headers: HTTPHeaders\n readonly requestBody?: unknown\n readonly startedAt: number\n readonly endedAt?: number\n readonly duration?: number\n readonly attempt: number\n readonly retries: number\n readonly responseStatus?: number\n readonly responseBody?: unknown\n readonly error?: { readonly name: string; readonly message: string }\n readonly context?: HTTPDebugContext\n}\n\nexport interface HTTPDebugHooks {\n request?(event: HTTPDebugRequest): void\n}\n\nlet activeHTTPDebugHooks: HTTPDebugHooks | null = null\nconst httpDebugListeners = new Set<NonNullable<HTTPDebugHooks['request']>>()\n\nexport function setHTTPDebugHooks(hooks: HTTPDebugHooks | null): HTTPDebugHooks | null {\n const previous = activeHTTPDebugHooks\n activeHTTPDebugHooks = hooks\n return previous\n}\n\nexport function getHTTPDebugHooks(): HTTPDebugHooks | null {\n return activeHTTPDebugHooks\n}\n\nexport function subscribeHTTPDebug(listener: NonNullable<HTTPDebugHooks['request']>): () => void {\n httpDebugListeners.add(listener)\n return () => httpDebugListeners.delete(listener)\n}\n\nexport function emitHTTPDebug(event: HTTPDebugRequest): void {\n try {\n activeHTTPDebugHooks?.request?.(event)\n } catch {\n // Debug tooling must never change request behavior.\n }\n for (const listener of [...httpDebugListeners]) {\n try { listener(event) } catch { /* Debug tooling must never change request behavior. */ }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/debug.ts"],"sourcesContent":["import type { HTTPMethod, HTTPHeaders } from './index'\nimport type { RuntimeDebugContext } from '@vobs/runtime'\n\nexport type HTTPDebugStatus = 'loading' | 'retrying' | 'success' | 'error' | 'cancelled'\n\nexport type HTTPDebugCacheStatus = 'hit' | 'miss' | 'revalidated'\n\nexport interface HTTPDebugContext extends RuntimeDebugContext {\n readonly cacheStatus?: HTTPDebugCacheStatus\n /** Marks a request created from the DevTools request tester. */\n readonly test?: boolean\n}\n\nexport interface HTTPDebugRequest {\n readonly id: number\n readonly phase: 'start' | 'retry' | 'end'\n readonly status: HTTPDebugStatus\n readonly url: string\n readonly method: HTTPMethod\n readonly headers: HTTPHeaders\n readonly requestBody?: unknown\n readonly startedAt: number\n readonly endedAt?: number\n readonly duration?: number\n readonly attempt: number\n readonly retries: number\n readonly responseStatus?: number\n readonly responseBody?: unknown\n readonly error?: { readonly name: string; readonly message: string }\n readonly context?: HTTPDebugContext\n}\n\nexport interface HTTPDebugHooks {\n request?(event: HTTPDebugRequest): void\n}\n\nlet activeHTTPDebugHooks: HTTPDebugHooks | null = null\nconst httpDebugListeners = new Set<NonNullable<HTTPDebugHooks['request']>>()\n\nexport function setHTTPDebugHooks(hooks: HTTPDebugHooks | null): HTTPDebugHooks | null {\n const previous = activeHTTPDebugHooks\n activeHTTPDebugHooks = hooks\n return previous\n}\n\nexport function getHTTPDebugHooks(): HTTPDebugHooks | null {\n return activeHTTPDebugHooks\n}\n\nexport function subscribeHTTPDebug(listener: NonNullable<HTTPDebugHooks['request']>): () => void {\n httpDebugListeners.add(listener)\n return () => httpDebugListeners.delete(listener)\n}\n\nexport function emitHTTPDebug(event: HTTPDebugRequest): void {\n try {\n activeHTTPDebugHooks?.request?.(event)\n } catch {\n // Debug tooling must never change request behavior.\n }\n for (const listener of [...httpDebugListeners]) {\n try { listener(event) } catch { /* Debug tooling must never change request behavior. */ }\n }\n}\n"],"mappings":";;;;AAoCA,IAAI,uBAA8C;AAClD,IAAM,qBAAqB,oBAAI,IAA4C;AAEpE,SAAS,kBAAkB,OAAqD;AACrF,QAAM,WAAW;AACjB,yBAAuB;AACvB,SAAO;AACT;AAJgB;AAMT,SAAS,oBAA2C;AACzD,SAAO;AACT;AAFgB;AAIT,SAAS,mBAAmB,UAA8D;AAC/F,qBAAmB,IAAI,QAAQ;AAC/B,SAAO,MAAM,mBAAmB,OAAO,QAAQ;AACjD;AAHgB;AAKT,SAAS,cAAc,OAA+B;AAC3D,MAAI;AACF,0BAAsB,UAAU,KAAK;AAAA,EACvC,QAAQ;AAAA,EAER;AACA,aAAW,YAAY,CAAC,GAAG,kBAAkB,GAAG;AAC9C,QAAI;AAAE,eAAS,KAAK;AAAA,IAAE,QAAQ;AAAA,IAA0D;AAAA,EAC1F;AACF;AATgB;","names":[]}
package/dist/index.cjs CHANGED
@@ -1,151 +1,58 @@
1
- 'use strict';
2
-
3
- var axios = require('axios');
4
-
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
-
7
- var axios__default = /*#__PURE__*/_interopDefault(axios);
8
-
1
+ var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
2
+ "use strict";
3
+ var __create = Object.create;
9
4
  var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
9
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
-
12
- // packages/reactivity/src/debug.ts
13
- var activeDebugHooks = null;
14
- function hasDebugHooks() {
15
- return activeDebugHooks !== null;
16
- }
17
- __name(hasDebugHooks, "hasDebugHooks");
18
- function invokeDebug(name, ...args) {
19
- return;
20
- }
21
- __name(invokeDebug, "invokeDebug");
22
-
23
- // packages/reactivity/src/scheduler.ts
24
- var _Scheduler = class _Scheduler {
25
- constructor() {
26
- this.dirtyEffects = /* @__PURE__ */ new Set();
27
- this.lowPriorityEffects = /* @__PURE__ */ new Set();
28
- // flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
29
- this.normalBuffer = [];
30
- this.lowBuffer = [];
31
- this.flushing = false;
32
- this.scheduled = false;
33
- this.batchDepth = 0;
34
- }
35
- schedule(effect2) {
36
- if (effect2.disposed) return;
37
- this.dirtyEffects.add(effect2);
38
- this.lowPriorityEffects.delete(effect2);
39
- this.ensureScheduled();
40
- }
41
- /** Queue an effect behind normal updates while preserving deterministic order. */
42
- scheduleLow(effect2) {
43
- if (effect2.disposed) return;
44
- if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
45
- this.ensureScheduled();
46
- }
47
- ensureScheduled() {
48
- if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
49
- this.scheduled = true;
50
- queueMicrotask(() => {
51
- this.scheduled = false;
52
- this.flush();
53
- });
54
- }
55
- }
56
- remove(effect2) {
57
- this.dirtyEffects.delete(effect2);
58
- this.lowPriorityEffects.delete(effect2);
59
- }
60
- batch(fn) {
61
- this.batchDepth++;
62
- try {
63
- return fn();
64
- } finally {
65
- this.batchDepth--;
66
- if (this.batchDepth === 0) this.flush();
67
- }
68
- }
69
- flush() {
70
- if (this.flushing || this.batchDepth > 0) return;
71
- this.flushing = true;
72
- let rounds = 0;
73
- let firstError;
74
- let hasError = false;
75
- try {
76
- while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
77
- if (++rounds > 100) {
78
- this.dirtyEffects.clear();
79
- this.lowPriorityEffects.clear();
80
- throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
81
- }
82
- this.collectRunnable(this.dirtyEffects, this.normalBuffer);
83
- this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
84
- sortEffects(this.normalBuffer);
85
- sortEffects(this.lowBuffer);
86
- for (const effect2 of this.normalBuffer) {
87
- try {
88
- effect2.run();
89
- } catch (error) {
90
- if (!hasError) {
91
- firstError = error;
92
- hasError = true;
93
- }
94
- }
95
- }
96
- for (const effect2 of this.lowBuffer) {
97
- try {
98
- effect2.run();
99
- } catch (error) {
100
- if (!hasError) {
101
- firstError = error;
102
- hasError = true;
103
- }
104
- }
105
- }
106
- this.normalBuffer.length = 0;
107
- this.lowBuffer.length = 0;
108
- }
109
- } finally {
110
- this.normalBuffer.length = 0;
111
- this.lowBuffer.length = 0;
112
- this.flushing = false;
113
- }
114
- if (hasError) throw firstError;
115
- }
116
- /** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
117
- collectRunnable(source, target) {
118
- for (const effect2 of source) {
119
- if (!effect2.disposed) target.push(effect2);
120
- }
121
- source.clear();
122
- }
10
+ var __export = (target, all) => {
11
+ for (var name in all)
12
+ __defProp(target, name, { get: all[name], enumerable: true });
123
13
  };
124
- __name(_Scheduler, "Scheduler");
125
- function sortEffects(effects) {
126
- if (effects.length > 1) {
127
- effects.sort((a, b) => b.depth - a.depth || a.order - b.order);
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from))
17
+ if (!__hasOwnProp.call(to, key) && key !== except)
18
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
128
19
  }
129
- }
130
- __name(sortEffects, "sortEffects");
131
-
132
- // packages/runtime/src/debug.ts
133
- var activeRuntimeDebugContext = null;
134
- function getRuntimeDebugContext() {
135
- return activeRuntimeDebugContext;
136
- }
137
- __name(getRuntimeDebugContext, "getRuntimeDebugContext");
138
-
139
- // packages/runtime/src/hmr.ts
140
- var globalTarget = globalThis;
141
- var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
142
- globalTarget.__VOBS_HMR__ = hmrGlobal;
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
30
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
143
31
 
144
- // packages/vobs/src/app.ts
145
- function createInjectionKey(description) {
146
- return Symbol(description);
147
- }
148
- __name(createInjectionKey, "createInjectionKey");
32
+ // packages/http/src/index.ts
33
+ var src_exports = {};
34
+ __export(src_exports, {
35
+ HTTPError: () => HTTPError,
36
+ HTTP_KEY: () => HTTP_KEY,
37
+ TimeoutError: () => TimeoutError,
38
+ createAxiosAdapter: () => createAxiosAdapter,
39
+ createConcurrencyLimiter: () => createConcurrencyLimiter,
40
+ createFetchAdapter: () => createFetchAdapter,
41
+ createHTTPClient: () => createHTTPClient,
42
+ createMockAdapter: () => createMockAdapter,
43
+ createSSE: () => createSSE,
44
+ createWebSocket: () => createWebSocket,
45
+ createXHRAdapter: () => createXHRAdapter,
46
+ emitHTTPDebug: () => emitHTTPDebug,
47
+ getHTTPDebugHooks: () => getHTTPDebugHooks,
48
+ httpPlugin: () => httpPlugin,
49
+ setHTTPDebugHooks: () => setHTTPDebugHooks,
50
+ subscribeHTTPDebug: () => subscribeHTTPDebug,
51
+ toResourceFetcher: () => toResourceFetcher
52
+ });
53
+ module.exports = __toCommonJS(src_exports);
54
+ var import_vobs = require("@vobs/vobs");
55
+ var import_axios = __toESM(require("axios"), 1);
149
56
 
150
57
  // packages/http/src/stream.ts
151
58
  function createSSE(url, options = {}) {
@@ -170,7 +77,7 @@ function createWebSocket(url, options = {}) {
170
77
  }
171
78
  const listeners = /* @__PURE__ */ new Map();
172
79
  let socket = null;
173
- let state2 = "idle";
80
+ let state = "idle";
174
81
  let manuallyClosed = false;
175
82
  let reconnectTimer;
176
83
  const client = {
@@ -178,18 +85,18 @@ function createWebSocket(url, options = {}) {
178
85
  return socket;
179
86
  },
180
87
  get state() {
181
- return state2;
88
+ return state;
182
89
  },
183
90
  connect,
184
91
  send(data) {
185
- if (!socket || state2 !== "open") throw new Error("HTTP: WebSocket \u5C1A\u672A\u8FDE\u63A5");
92
+ if (!socket || state !== "open") throw new Error("HTTP: WebSocket \u5C1A\u672A\u8FDE\u63A5");
186
93
  socket.send(data);
187
94
  },
188
95
  close(code, reason) {
189
96
  manuallyClosed = true;
190
97
  if (reconnectTimer !== void 0) clearTimeout(reconnectTimer);
191
98
  socket?.close(code, reason);
192
- if (!socket) state2 = "closed";
99
+ if (!socket) state = "closed";
193
100
  },
194
101
  on(event, listener) {
195
102
  let eventListeners = listeners.get(event);
@@ -204,19 +111,19 @@ function createWebSocket(url, options = {}) {
204
111
  connect();
205
112
  return client;
206
113
  function connect() {
207
- if (state2 === "connecting" || state2 === "open") return;
114
+ if (state === "connecting" || state === "open") return;
208
115
  manuallyClosed = false;
209
- state2 = "connecting";
116
+ state = "connecting";
210
117
  const protocols = options.protocols === void 0 ? void 0 : typeof options.protocols === "string" ? options.protocols : [...options.protocols];
211
118
  socket = new WebSocketImpl(url, protocols);
212
119
  socket.addEventListener("open", (event) => {
213
- state2 = "open";
120
+ state = "open";
214
121
  notify("open", event);
215
122
  });
216
123
  socket.addEventListener("message", (event) => notify("message", event));
217
124
  socket.addEventListener("error", (event) => notify("error", event));
218
125
  socket.addEventListener("close", (event) => {
219
- state2 = "closed";
126
+ state = "closed";
220
127
  socket = null;
221
128
  notify("close", event);
222
129
  if (options.autoReconnect && !manuallyClosed) {
@@ -227,9 +134,11 @@ function createWebSocket(url, options = {}) {
227
134
  }
228
135
  });
229
136
  }
137
+ __name(connect, "connect");
230
138
  function notify(event, value) {
231
139
  for (const listener of [...listeners.get(event) ?? []]) listener(value);
232
140
  }
141
+ __name(notify, "notify");
233
142
  }
234
143
  __name(createWebSocket, "createWebSocket");
235
144
 
@@ -266,6 +175,7 @@ function emitHTTPDebug(event) {
266
175
  __name(emitHTTPDebug, "emitHTTPDebug");
267
176
 
268
177
  // packages/http/src/index.ts
178
+ var import_runtime3 = require("@vobs/runtime");
269
179
  var PROGRESS_HANDLED = Symbol("vobs.http.progress-handled");
270
180
  var nextHTTPDebugId = 1;
271
181
  function toResourceFetcher(request) {
@@ -384,7 +294,7 @@ var _TimeoutError = class _TimeoutError extends Error {
384
294
  };
385
295
  __name(_TimeoutError, "TimeoutError");
386
296
  var TimeoutError = _TimeoutError;
387
- var HTTP_KEY = createInjectionKey("vobs.http");
297
+ var HTTP_KEY = (0, import_vobs.createInjectionKey)("vobs.http");
388
298
  function createHTTPClient(options = {}) {
389
299
  const defaults = normalizeClientOptions(options);
390
300
  const requestInterceptors = createInterceptors();
@@ -410,7 +320,7 @@ function createHTTPClient(options = {}) {
410
320
  const id = nextHTTPDebugId++;
411
321
  const startedAt = Date.now();
412
322
  const context = {
413
- ...getRuntimeDebugContext(),
323
+ ...(0, import_runtime3.getRuntimeDebugContext)(),
414
324
  ...initial.debugContext
415
325
  };
416
326
  emitHTTPDebug({
@@ -541,7 +451,7 @@ function createHTTPClient(options = {}) {
541
451
  if (!shouldRetry) throw toError(error);
542
452
  attempt = nextAttempt;
543
453
  const retryContext = {
544
- ...getRuntimeDebugContext(),
454
+ ...(0, import_runtime3.getRuntimeDebugContext)(),
545
455
  ...config.debugContext
546
456
  };
547
457
  emitHTTPDebug({
@@ -567,6 +477,7 @@ function createHTTPClient(options = {}) {
567
477
  inputSignal?.removeEventListener("abort", abortFromInput);
568
478
  }
569
479
  }
480
+ __name(executeWithRetry, "executeWithRetry");
570
481
  }
571
482
  __name(createHTTPClient, "createHTTPClient");
572
483
  function debugHeaders(headers) {
@@ -716,7 +627,7 @@ async function parseResponse(response, config) {
716
627
  __name(parseResponse, "parseResponse");
717
628
  var builtInAxiosRequest = /* @__PURE__ */ __name(async (config) => {
718
629
  const responseType = config.responseType === "response" ? "arraybuffer" : toAxiosResponseType(config.responseType);
719
- const response = await axios__default.default.request({
630
+ const response = await import_axios.default.request({
720
631
  url: config.url,
721
632
  method: config.method,
722
633
  headers: config.headers,
@@ -922,23 +833,24 @@ function toProgress(loaded, total) {
922
833
  };
923
834
  }
924
835
  __name(toProgress, "toProgress");
925
-
926
- exports.HTTPError = HTTPError;
927
- exports.HTTP_KEY = HTTP_KEY;
928
- exports.TimeoutError = TimeoutError;
929
- exports.createAxiosAdapter = createAxiosAdapter;
930
- exports.createConcurrencyLimiter = createConcurrencyLimiter;
931
- exports.createFetchAdapter = createFetchAdapter;
932
- exports.createHTTPClient = createHTTPClient;
933
- exports.createMockAdapter = createMockAdapter;
934
- exports.createSSE = createSSE;
935
- exports.createWebSocket = createWebSocket;
936
- exports.createXHRAdapter = createXHRAdapter;
937
- exports.emitHTTPDebug = emitHTTPDebug;
938
- exports.getHTTPDebugHooks = getHTTPDebugHooks;
939
- exports.httpPlugin = httpPlugin;
940
- exports.setHTTPDebugHooks = setHTTPDebugHooks;
941
- exports.subscribeHTTPDebug = subscribeHTTPDebug;
942
- exports.toResourceFetcher = toResourceFetcher;
943
- //# sourceMappingURL=index.cjs.map
836
+ // Annotate the CommonJS export names for ESM import in node:
837
+ 0 && (module.exports = {
838
+ HTTPError,
839
+ HTTP_KEY,
840
+ TimeoutError,
841
+ createAxiosAdapter,
842
+ createConcurrencyLimiter,
843
+ createFetchAdapter,
844
+ createHTTPClient,
845
+ createMockAdapter,
846
+ createSSE,
847
+ createWebSocket,
848
+ createXHRAdapter,
849
+ emitHTTPDebug,
850
+ getHTTPDebugHooks,
851
+ httpPlugin,
852
+ setHTTPDebugHooks,
853
+ subscribeHTTPDebug,
854
+ toResourceFetcher
855
+ });
944
856
  //# sourceMappingURL=index.cjs.map