@drfed/web 0.0.0-stage → 0.1.0-dev.561
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/.output/nitro.json +17 -0
- package/.output/public/.vite/manifest.json +483 -0
- package/.output/public/_build/assets/ActorDetailQuery.graphql-D96mwq1k.js +60 -0
- package/.output/public/_build/assets/ActorDetailQuery.graphql-DrxSNh1X.js +60 -0
- package/.output/public/_build/assets/CompleteLoginChallenge.graphql-C5Zq3wNh.js +10 -0
- package/.output/public/_build/assets/CopyButton-B2l484wE.js +1 -0
- package/.output/public/_build/assets/CopyButton-Bi-ZR8x9.css +1 -0
- package/.output/public/_build/assets/CreateInstanceMutation.graphql-B4CRy6cl.js +19 -0
- package/.output/public/_build/assets/CreateObjectMutation.graphql-B4A01dgV.js +23 -0
- package/.output/public/_build/assets/GenerateActorsMutation.graphql-mlHJNIbe.js +23 -0
- package/.output/public/_build/assets/GetHostQuery.graphql-CuzDdOdW.js +17 -0
- package/.output/public/_build/assets/GetHostQuery.graphql-o9K0Qkg0.js +17 -0
- package/.output/public/_build/assets/HomeViewerQuery.graphql-B903WWKs.js +8 -0
- package/.output/public/_build/assets/HttpStatusCode-bgaVzuLy.js +1 -0
- package/.output/public/_build/assets/InstanceActorListQuery.graphql-DmNwiEhM.js +24 -0
- package/.output/public/_build/assets/InstanceActorListQuery.graphql-paa7teUO.js +24 -0
- package/.output/public/_build/assets/InstanceDetailQuery.graphql-B52nR132.js +66 -0
- package/.output/public/_build/assets/InstanceDetailQuery.graphql-DSA2BcAV.js +66 -0
- package/.output/public/_build/assets/JNCCF6MP-CNMywyiC.js +1 -0
- package/.output/public/_build/assets/LP6E37CW-Cwv6G3n1.js +1 -0
- package/.output/public/_build/assets/SignInMutation.graphql-BalZYNFu.js +9 -0
- package/.output/public/_build/assets/TSB6MOZK-CpiH97G1.js +1 -0
- package/.output/public/_build/assets/Toast-3-eXCAKc.css +1 -0
- package/.output/public/_build/assets/Toast-C1zr9crB.js +1 -0
- package/.output/public/_build/assets/WorkspaceQuery.graphql-UoI7QDs4.js +23 -0
- package/.output/public/_build/assets/_...404_-WZ8kAljY.js +1 -0
- package/.output/public/_build/assets/_challengeId_-Dk-0l7zl.js +1 -0
- package/.output/public/_build/assets/_id_-YcZZShAv.css +1 -0
- package/.output/public/_build/assets/_id_-bpxdclBj.js +1 -0
- package/.output/public/_build/assets/_slug_-CyTA2aW7.css +1 -0
- package/.output/public/_build/assets/_slug_-DXfRknzJ.js +200 -0
- package/.output/public/_build/assets/about-DIrbzRsi.js +1 -0
- package/.output/public/_build/assets/actors-HfZh_afh.js +24 -0
- package/.output/public/_build/assets/client-CGFoRcqH.js +3 -0
- package/.output/public/_build/assets/components-5MVu7IcD.js +1 -0
- package/.output/public/_build/assets/dist-BrJ_B8nU.js +1 -0
- package/.output/public/_build/assets/dist-DVo0HS5G.js +1 -0
- package/.output/public/_build/assets/dist-WrlGlK67.js +1 -0
- package/.output/public/_build/assets/entry-client-BurSTYr9.css +1 -0
- package/.output/public/_build/assets/entry-client-Do7ocrsL.js +8 -0
- package/.output/public/_build/assets/form-BxigYd7J.css +1 -0
- package/.output/public/_build/assets/form.module-BecmEfV_.js +1 -0
- package/.output/public/_build/assets/index-BHn6sAgH.js +23 -0
- package/.output/public/_build/assets/index-BSLqnqN7.js +8 -0
- package/.output/public/_build/assets/index-B_xLBDOo.css +1 -0
- package/.output/public/_build/assets/instance-tpMrvJNZ.js +35 -0
- package/.output/public/_build/assets/label-Mv8GZ4jc.js +1 -0
- package/.output/public/_build/assets/objects-DPb8DI8A.css +1 -0
- package/.output/public/_build/assets/objects-DR9TfL-V.js +25 -0
- package/.output/public/_build/assets/relay-runtime-BX3uubtA.js +7 -0
- package/.output/public/_build/assets/routing-DMN2NHu6.js +1 -0
- package/.output/public/_build/assets/sign-in-B67sv7z8.js +10 -0
- package/.output/public/_build/assets/web-DB_Nkq2D.js +1 -0
- package/.output/public/apple-touch-icon.png +0 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/icon-192.png +0 -0
- package/.output/public/icon-512.png +0 -0
- package/.output/public/icon-mask.png +0 -0
- package/.output/public/icon.svg +395 -0
- package/.output/public/manifest.webmanifest +13 -0
- package/.output/server/_...404_-DDEH5apf.mjs +16 -0
- package/.output/server/_challengeId_-C_n_Bww9.mjs +100 -0
- package/.output/server/_chunks/ssr-renderer.mjs +26 -0
- package/.output/server/_id_-DqytvZEf.mjs +505 -0
- package/.output/server/_libs/@shikijs/core+[...].mjs +7173 -0
- package/.output/server/_libs/@shikijs/engine-javascript+[...].mjs +3110 -0
- package/.output/server/_libs/babel__runtime.mjs +243 -0
- package/.output/server/_libs/dequal.mjs +25 -0
- package/.output/server/_libs/faker-js__faker.mjs +13150 -0
- package/.output/server/_libs/fbjs.mjs +115 -0
- package/.output/server/_libs/h3+rou3+srvx.mjs +650 -0
- package/.output/server/_libs/hookable.mjs +41 -0
- package/.output/server/_libs/invariant.mjs +36 -0
- package/.output/server/_libs/relay-runtime.mjs +9704 -0
- package/.output/server/_libs/seroval-plugins.mjs +563 -0
- package/.output/server/_libs/seroval.mjs +2956 -0
- package/.output/server/_libs/shikijs__langs.mjs +3 -0
- package/.output/server/_libs/shikijs__themes.mjs +7 -0
- package/.output/server/_libs/solid-js.mjs +1248 -0
- package/.output/server/_libs/solid-relay+tiny-invariant.mjs +1029 -0
- package/.output/server/_libs/ufo.mjs +64 -0
- package/.output/server/_libs/valibot.mjs +711 -0
- package/.output/server/_runtime.mjs +33 -0
- package/.output/server/_slug_-CBOaSqoF.mjs +978 -0
- package/.output/server/_ssr/ActorDetailQuery.graphql-C1mWRP1B.mjs +283 -0
- package/.output/server/_ssr/CompleteLoginChallenge.graphql-CM7o_Md1.mjs +78 -0
- package/.output/server/_ssr/CopyButton-CQNR5D1y.mjs +43 -0
- package/.output/server/_ssr/CreateInstanceMutation.graphql-C-h2lGxz.mjs +116 -0
- package/.output/server/_ssr/CreateObjectMutation.graphql-C393Hp7q.mjs +166 -0
- package/.output/server/_ssr/GenerateActorsMutation.graphql-D2ADtn1j.mjs +163 -0
- package/.output/server/_ssr/GetHostQuery.graphql-C45XQo1i.mjs +127 -0
- package/.output/server/_ssr/HomeViewerQuery.graphql-Dote4Pkz.mjs +81 -0
- package/.output/server/_ssr/InstanceActorListQuery.graphql-DgItgN5t.mjs +167 -0
- package/.output/server/_ssr/InstanceDetailQuery.graphql-DP5wWWjX.mjs +367 -0
- package/.output/server/_ssr/JNCCF6MP-BAZlBnvx.mjs +419 -0
- package/.output/server/_ssr/LP6E37CW-D2Ih_b_K.mjs +163 -0
- package/.output/server/_ssr/SignInMutation.graphql-BBXmiay6.mjs +72 -0
- package/.output/server/_ssr/TSB6MOZK-D06WZb6o.mjs +166 -0
- package/.output/server/_ssr/Toast-Bb1gcxED.mjs +947 -0
- package/.output/server/_ssr/WorkspaceQuery.graphql-DnCO8t-4.mjs +153 -0
- package/.output/server/_ssr/about-CD3QIgf_.mjs +14 -0
- package/.output/server/_ssr/actors-CMWf-xQU.mjs +1160 -0
- package/.output/server/_ssr/dist-D6rgyh-L.mjs +81 -0
- package/.output/server/_ssr/dist-I7KRMRbA.mjs +432 -0
- package/.output/server/_ssr/form.module-CTvIl1lm.mjs +192 -0
- package/.output/server/_ssr/index-C4crD6q-.mjs +347 -0
- package/.output/server/_ssr/index-yuhuc6-X.mjs +111 -0
- package/.output/server/_ssr/instance-ZYWGeWd3.mjs +280 -0
- package/.output/server/_ssr/label-DAXzanI9.mjs +9 -0
- package/.output/server/_ssr/objects-D5MVukzB.mjs +4316 -0
- package/.output/server/_ssr/routing-DKTLkkbY.mjs +620 -0
- package/.output/server/_ssr/sign-in-CNHZb_zL.mjs +264 -0
- package/.output/server/_ssr/ssr.mjs +6121 -0
- package/.output/server/index.mjs +684 -0
- package/LICENSE +661 -0
- package/README.md +143 -2
- package/dist/bridge.d.mts +39 -0
- package/dist/bridge.mjs +104 -0
- package/dist/bridge.mjs.map +1 -0
- package/dist/request-policy.d.mts +8 -0
- package/dist/request-policy.mjs +94 -0
- package/dist/request-policy.mjs.map +1 -0
- package/dist/runtime.d.mts +14 -0
- package/dist/runtime.mjs +44 -0
- package/dist/runtime.mjs.map +1 -0
- package/package.json +123 -3
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import { PassThrough, Readable } from "node:stream";
|
|
2
|
+
//#region ../../node_modules/.pnpm/rou3@0.8.1/node_modules/rou3/dist/index.mjs
|
|
3
|
+
var NullProtoObj = /* @__PURE__ */ (() => {
|
|
4
|
+
const e = function() {};
|
|
5
|
+
return e.prototype = Object.create(null), Object.freeze(e.prototype), e;
|
|
6
|
+
})();
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../../node_modules/.pnpm/srvx@0.11.16/node_modules/srvx/dist/_chunks/_url.mjs
|
|
9
|
+
function lazyInherit(target, source, sourceKey) {
|
|
10
|
+
for (const key of [...Object.getOwnPropertyNames(source), ...Object.getOwnPropertySymbols(source)]) {
|
|
11
|
+
if (key === "constructor") continue;
|
|
12
|
+
const targetDesc = Object.getOwnPropertyDescriptor(target, key);
|
|
13
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
14
|
+
let modified = false;
|
|
15
|
+
if (desc.get) {
|
|
16
|
+
modified = true;
|
|
17
|
+
desc.get = targetDesc?.get || function() {
|
|
18
|
+
return this[sourceKey][key];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (desc.set) {
|
|
22
|
+
modified = true;
|
|
23
|
+
desc.set = targetDesc?.set || function(value) {
|
|
24
|
+
this[sourceKey][key] = value;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (!targetDesc?.value && typeof desc.value === "function") {
|
|
28
|
+
modified = true;
|
|
29
|
+
desc.value = function(...args) {
|
|
30
|
+
return this[sourceKey][key](...args);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
if (modified) Object.defineProperty(target, key, desc);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
var _needsNormRE = /(?:(?:^|\/)(?:\.|\.\.|%2e|%2e\.|\.%2e|%2e%2e)(?:\/|$))|[\\^\x80-\uffff]/i;
|
|
37
|
+
var FastURL = /* @__PURE__ */ (() => {
|
|
38
|
+
const NativeURL = globalThis.URL;
|
|
39
|
+
const FastURL = class URL {
|
|
40
|
+
#url;
|
|
41
|
+
#href;
|
|
42
|
+
#protocol;
|
|
43
|
+
#host;
|
|
44
|
+
#pathname;
|
|
45
|
+
#search;
|
|
46
|
+
#searchParams;
|
|
47
|
+
#pos;
|
|
48
|
+
constructor(url) {
|
|
49
|
+
if (typeof url === "string") if (url[0] === "/") this.#href = url;
|
|
50
|
+
else this.#url = new NativeURL(url);
|
|
51
|
+
else if (_needsNormRE.test(url.pathname)) this.#url = new NativeURL(`${url.protocol || "http:"}//${url.host || "localhost"}${url.pathname}${url.search || ""}`);
|
|
52
|
+
else {
|
|
53
|
+
this.#protocol = url.protocol;
|
|
54
|
+
this.#host = url.host;
|
|
55
|
+
this.#pathname = url.pathname;
|
|
56
|
+
this.#search = url.search;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
static [Symbol.hasInstance](val) {
|
|
60
|
+
return val instanceof NativeURL;
|
|
61
|
+
}
|
|
62
|
+
get _url() {
|
|
63
|
+
if (this.#url) return this.#url;
|
|
64
|
+
this.#url = new NativeURL(this.href);
|
|
65
|
+
this.#href = void 0;
|
|
66
|
+
this.#protocol = void 0;
|
|
67
|
+
this.#host = void 0;
|
|
68
|
+
this.#pathname = void 0;
|
|
69
|
+
this.#search = void 0;
|
|
70
|
+
this.#searchParams = void 0;
|
|
71
|
+
this.#pos = void 0;
|
|
72
|
+
return this.#url;
|
|
73
|
+
}
|
|
74
|
+
get href() {
|
|
75
|
+
if (this.#url) return this.#url.href;
|
|
76
|
+
if (!this.#href) this.#href = `${this.#protocol || "http:"}//${this.#host || "localhost"}${this.#pathname || "/"}${this.#search || ""}`;
|
|
77
|
+
return this.#href;
|
|
78
|
+
}
|
|
79
|
+
#getPos() {
|
|
80
|
+
if (!this.#pos) {
|
|
81
|
+
const url = this.href;
|
|
82
|
+
const protoIndex = url.indexOf("://");
|
|
83
|
+
const pathnameIndex = protoIndex === -1 ? -1 : url.indexOf("/", protoIndex + 4);
|
|
84
|
+
const qIndex = pathnameIndex === -1 ? -1 : url.indexOf("?", pathnameIndex);
|
|
85
|
+
this.#pos = [
|
|
86
|
+
protoIndex,
|
|
87
|
+
pathnameIndex,
|
|
88
|
+
qIndex
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
return this.#pos;
|
|
92
|
+
}
|
|
93
|
+
get pathname() {
|
|
94
|
+
if (this.#url) return this.#url.pathname;
|
|
95
|
+
if (this.#pathname === void 0) {
|
|
96
|
+
const [, pathnameIndex, queryIndex] = this.#getPos();
|
|
97
|
+
if (pathnameIndex === -1) return this._url.pathname;
|
|
98
|
+
this.#pathname = this.href.slice(pathnameIndex, queryIndex === -1 ? void 0 : queryIndex);
|
|
99
|
+
}
|
|
100
|
+
return this.#pathname;
|
|
101
|
+
}
|
|
102
|
+
get search() {
|
|
103
|
+
if (this.#url) return this.#url.search;
|
|
104
|
+
if (this.#search === void 0) {
|
|
105
|
+
const [, pathnameIndex, queryIndex] = this.#getPos();
|
|
106
|
+
if (pathnameIndex === -1) return this._url.search;
|
|
107
|
+
const url = this.href;
|
|
108
|
+
this.#search = queryIndex === -1 || queryIndex === url.length - 1 ? "" : url.slice(queryIndex);
|
|
109
|
+
}
|
|
110
|
+
return this.#search;
|
|
111
|
+
}
|
|
112
|
+
get searchParams() {
|
|
113
|
+
if (this.#url) return this.#url.searchParams;
|
|
114
|
+
if (!this.#searchParams) this.#searchParams = new URLSearchParams(this.search);
|
|
115
|
+
return this.#searchParams;
|
|
116
|
+
}
|
|
117
|
+
get protocol() {
|
|
118
|
+
if (this.#url) return this.#url.protocol;
|
|
119
|
+
if (this.#protocol === void 0) {
|
|
120
|
+
const [protocolIndex] = this.#getPos();
|
|
121
|
+
if (protocolIndex === -1) return this._url.protocol;
|
|
122
|
+
const url = this.href;
|
|
123
|
+
this.#protocol = url.slice(0, protocolIndex + 1);
|
|
124
|
+
}
|
|
125
|
+
return this.#protocol;
|
|
126
|
+
}
|
|
127
|
+
toString() {
|
|
128
|
+
return this.href;
|
|
129
|
+
}
|
|
130
|
+
toJSON() {
|
|
131
|
+
return this.href;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
lazyInherit(FastURL.prototype, NativeURL.prototype, "_url");
|
|
135
|
+
Object.setPrototypeOf(FastURL.prototype, NativeURL.prototype);
|
|
136
|
+
Object.setPrototypeOf(FastURL, NativeURL);
|
|
137
|
+
return FastURL;
|
|
138
|
+
})();
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region ../../node_modules/.pnpm/srvx@0.11.16/node_modules/srvx/dist/adapters/node.mjs
|
|
141
|
+
var NodeResponse = /* @__PURE__ */ (() => {
|
|
142
|
+
const NativeResponse = globalThis.Response;
|
|
143
|
+
const STATUS_CODES = globalThis.process?.getBuiltinModule?.("node:http")?.STATUS_CODES || {};
|
|
144
|
+
class NodeResponse {
|
|
145
|
+
#body;
|
|
146
|
+
#init;
|
|
147
|
+
#headers;
|
|
148
|
+
#response;
|
|
149
|
+
constructor(body, init) {
|
|
150
|
+
this.#body = body;
|
|
151
|
+
this.#init = init;
|
|
152
|
+
}
|
|
153
|
+
static [Symbol.hasInstance](val) {
|
|
154
|
+
return val instanceof NativeResponse;
|
|
155
|
+
}
|
|
156
|
+
get status() {
|
|
157
|
+
return this.#response?.status || this.#init?.status || 200;
|
|
158
|
+
}
|
|
159
|
+
get statusText() {
|
|
160
|
+
return this.#response?.statusText || this.#init?.statusText || STATUS_CODES[this.status] || "";
|
|
161
|
+
}
|
|
162
|
+
get headers() {
|
|
163
|
+
if (this.#response) return this.#response.headers;
|
|
164
|
+
if (this.#headers) return this.#headers;
|
|
165
|
+
const initHeaders = this.#init?.headers;
|
|
166
|
+
return this.#headers = initHeaders instanceof Headers ? initHeaders : new Headers(initHeaders);
|
|
167
|
+
}
|
|
168
|
+
get ok() {
|
|
169
|
+
if (this.#response) return this.#response.ok;
|
|
170
|
+
const status = this.status;
|
|
171
|
+
return status >= 200 && status < 300;
|
|
172
|
+
}
|
|
173
|
+
get _response() {
|
|
174
|
+
if (this.#response) return this.#response;
|
|
175
|
+
let body = this.#body;
|
|
176
|
+
if (body && typeof body.pipe === "function" && !(body instanceof Readable)) {
|
|
177
|
+
const stream = new PassThrough();
|
|
178
|
+
body.pipe(stream);
|
|
179
|
+
const abort = body.abort;
|
|
180
|
+
if (abort) stream.once("close", () => abort());
|
|
181
|
+
body = stream;
|
|
182
|
+
}
|
|
183
|
+
this.#response = new NativeResponse(body, this.#headers ? {
|
|
184
|
+
...this.#init,
|
|
185
|
+
headers: this.#headers
|
|
186
|
+
} : this.#init);
|
|
187
|
+
this.#init = void 0;
|
|
188
|
+
this.#headers = void 0;
|
|
189
|
+
this.#body = void 0;
|
|
190
|
+
return this.#response;
|
|
191
|
+
}
|
|
192
|
+
_toNodeResponse() {
|
|
193
|
+
const status = this.status;
|
|
194
|
+
const statusText = this.statusText;
|
|
195
|
+
let body;
|
|
196
|
+
let contentType;
|
|
197
|
+
let contentLength;
|
|
198
|
+
if (this.#response) body = this.#response.body;
|
|
199
|
+
else if (this.#body) if (this.#body instanceof ReadableStream) body = this.#body;
|
|
200
|
+
else if (typeof this.#body === "string") {
|
|
201
|
+
body = this.#body;
|
|
202
|
+
contentType = "text/plain; charset=UTF-8";
|
|
203
|
+
contentLength = Buffer.byteLength(this.#body);
|
|
204
|
+
} else if (this.#body instanceof ArrayBuffer) {
|
|
205
|
+
body = Buffer.from(this.#body);
|
|
206
|
+
contentLength = this.#body.byteLength;
|
|
207
|
+
} else if (this.#body instanceof Uint8Array) {
|
|
208
|
+
body = this.#body;
|
|
209
|
+
contentLength = this.#body.byteLength;
|
|
210
|
+
} else if (this.#body instanceof DataView) {
|
|
211
|
+
body = Buffer.from(this.#body.buffer);
|
|
212
|
+
contentLength = this.#body.byteLength;
|
|
213
|
+
} else if (this.#body instanceof Blob) {
|
|
214
|
+
body = this.#body.stream();
|
|
215
|
+
contentType = this.#body.type;
|
|
216
|
+
contentLength = this.#body.size;
|
|
217
|
+
} else if (typeof this.#body.pipe === "function") body = this.#body;
|
|
218
|
+
else body = this._response.body;
|
|
219
|
+
const headers = [];
|
|
220
|
+
const initHeaders = this.#init?.headers;
|
|
221
|
+
const headerEntries = this.#response?.headers || this.#headers || (initHeaders ? Array.isArray(initHeaders) ? initHeaders : initHeaders?.entries ? initHeaders.entries() : Object.entries(initHeaders).map(([k, v]) => [k.toLowerCase(), v]) : void 0);
|
|
222
|
+
let hasContentTypeHeader;
|
|
223
|
+
let hasContentLength;
|
|
224
|
+
if (headerEntries) for (const [key, value] of headerEntries) {
|
|
225
|
+
if (Array.isArray(value)) for (const v of value) headers.push([key, v]);
|
|
226
|
+
else headers.push([key, value]);
|
|
227
|
+
if (key === "content-type") hasContentTypeHeader = true;
|
|
228
|
+
else if (key === "content-length") hasContentLength = true;
|
|
229
|
+
}
|
|
230
|
+
if (contentType && !hasContentTypeHeader) headers.push(["content-type", contentType]);
|
|
231
|
+
if (contentLength && !hasContentLength) headers.push(["content-length", String(contentLength)]);
|
|
232
|
+
this.#init = void 0;
|
|
233
|
+
this.#headers = void 0;
|
|
234
|
+
this.#response = void 0;
|
|
235
|
+
this.#body = void 0;
|
|
236
|
+
return {
|
|
237
|
+
status,
|
|
238
|
+
statusText,
|
|
239
|
+
headers,
|
|
240
|
+
body
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
lazyInherit(NodeResponse.prototype, NativeResponse.prototype, "_response");
|
|
245
|
+
Object.setPrototypeOf(NodeResponse, NativeResponse);
|
|
246
|
+
Object.setPrototypeOf(NodeResponse.prototype, NativeResponse.prototype);
|
|
247
|
+
return NodeResponse;
|
|
248
|
+
})();
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region ../../node_modules/.pnpm/h3@2.0.1-rc.22_crossws@0.4.10_srvx@0.11.16_/node_modules/h3/dist/h3.mjs
|
|
251
|
+
function decodePathname(pathname) {
|
|
252
|
+
return decodeURI(pathname.includes("%25") ? pathname.replace(/%25/g, "%2525") : pathname);
|
|
253
|
+
}
|
|
254
|
+
var kEventNS = "h3.internal.event.";
|
|
255
|
+
var kEventRes = /* @__PURE__ */ Symbol.for(`${kEventNS}res`);
|
|
256
|
+
var kEventResHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.headers`);
|
|
257
|
+
var kEventResErrHeaders = /* @__PURE__ */ Symbol.for(`${kEventNS}res.err.headers`);
|
|
258
|
+
var H3Event = class {
|
|
259
|
+
app;
|
|
260
|
+
req;
|
|
261
|
+
url;
|
|
262
|
+
context;
|
|
263
|
+
static __is_event__ = true;
|
|
264
|
+
constructor(req, context, app) {
|
|
265
|
+
this.context = context || req.context || new NullProtoObj();
|
|
266
|
+
this.req = req;
|
|
267
|
+
this.app = app;
|
|
268
|
+
const _url = req._url;
|
|
269
|
+
const url = _url && _url instanceof URL ? _url : new FastURL(req.url);
|
|
270
|
+
if (url.pathname.includes("%")) url.pathname = decodePathname(url.pathname);
|
|
271
|
+
this.url = url;
|
|
272
|
+
}
|
|
273
|
+
get res() {
|
|
274
|
+
return this[kEventRes] ||= new H3EventResponse();
|
|
275
|
+
}
|
|
276
|
+
get runtime() {
|
|
277
|
+
return this.req.runtime;
|
|
278
|
+
}
|
|
279
|
+
waitUntil(promise) {
|
|
280
|
+
this.req.waitUntil?.(promise);
|
|
281
|
+
}
|
|
282
|
+
toString() {
|
|
283
|
+
return `[${this.req.method}] ${this.req.url}`;
|
|
284
|
+
}
|
|
285
|
+
toJSON() {
|
|
286
|
+
return this.toString();
|
|
287
|
+
}
|
|
288
|
+
get node() {
|
|
289
|
+
return this.req.runtime?.node;
|
|
290
|
+
}
|
|
291
|
+
get headers() {
|
|
292
|
+
return this.req.headers;
|
|
293
|
+
}
|
|
294
|
+
get path() {
|
|
295
|
+
return this.url.pathname + this.url.search;
|
|
296
|
+
}
|
|
297
|
+
get method() {
|
|
298
|
+
return this.req.method;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
var H3EventResponse = class {
|
|
302
|
+
status;
|
|
303
|
+
statusText;
|
|
304
|
+
get headers() {
|
|
305
|
+
return this[kEventResHeaders] ||= new Headers();
|
|
306
|
+
}
|
|
307
|
+
get errHeaders() {
|
|
308
|
+
return this[kEventResErrHeaders] ||= new Headers();
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
var DISALLOWED_STATUS_CHARS = /[^\u0009\u0020-\u007E]/g;
|
|
312
|
+
function sanitizeStatusMessage(statusMessage = "") {
|
|
313
|
+
return statusMessage.replace(DISALLOWED_STATUS_CHARS, "");
|
|
314
|
+
}
|
|
315
|
+
function sanitizeStatusCode(statusCode, defaultStatusCode = 200) {
|
|
316
|
+
if (!statusCode) return defaultStatusCode;
|
|
317
|
+
if (typeof statusCode === "string") statusCode = +statusCode;
|
|
318
|
+
if (statusCode < 100 || statusCode > 599) return defaultStatusCode;
|
|
319
|
+
return statusCode;
|
|
320
|
+
}
|
|
321
|
+
var HTTPError = class HTTPError extends Error {
|
|
322
|
+
get name() {
|
|
323
|
+
return "HTTPError";
|
|
324
|
+
}
|
|
325
|
+
status;
|
|
326
|
+
statusText;
|
|
327
|
+
headers;
|
|
328
|
+
cause;
|
|
329
|
+
data;
|
|
330
|
+
body;
|
|
331
|
+
unhandled;
|
|
332
|
+
static isError(input) {
|
|
333
|
+
return input instanceof Error && input?.name === "HTTPError";
|
|
334
|
+
}
|
|
335
|
+
static status(status, statusText, details) {
|
|
336
|
+
return new HTTPError({
|
|
337
|
+
...details,
|
|
338
|
+
statusText,
|
|
339
|
+
status
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
constructor(arg1, arg2) {
|
|
343
|
+
let messageInput;
|
|
344
|
+
let details;
|
|
345
|
+
if (typeof arg1 === "string") {
|
|
346
|
+
messageInput = arg1;
|
|
347
|
+
details = arg2;
|
|
348
|
+
} else details = arg1;
|
|
349
|
+
const status = sanitizeStatusCode(details?.status || details?.statusCode || (details?.cause)?.status || (details?.cause)?.statusCode, 500);
|
|
350
|
+
const statusText = sanitizeStatusMessage(details?.statusText || details?.statusMessage || (details?.cause)?.statusText || (details?.cause)?.statusMessage);
|
|
351
|
+
const message = messageInput || details?.message || (details?.cause)?.message || details?.statusText || details?.statusMessage || [
|
|
352
|
+
"HTTPError",
|
|
353
|
+
status,
|
|
354
|
+
statusText
|
|
355
|
+
].filter(Boolean).join(" ");
|
|
356
|
+
super(message, { cause: details });
|
|
357
|
+
this.cause = details;
|
|
358
|
+
this.status = status;
|
|
359
|
+
this.statusText = statusText || void 0;
|
|
360
|
+
const rawHeaders = details?.headers || (details?.cause)?.headers;
|
|
361
|
+
this.headers = rawHeaders ? new Headers(rawHeaders) : void 0;
|
|
362
|
+
this.unhandled = details?.unhandled ?? (details?.cause)?.unhandled ?? void 0;
|
|
363
|
+
this.data = details?.data;
|
|
364
|
+
this.body = details?.body;
|
|
365
|
+
}
|
|
366
|
+
get statusCode() {
|
|
367
|
+
return this.status;
|
|
368
|
+
}
|
|
369
|
+
get statusMessage() {
|
|
370
|
+
return this.statusText;
|
|
371
|
+
}
|
|
372
|
+
toJSON() {
|
|
373
|
+
const unhandled = this.unhandled;
|
|
374
|
+
return {
|
|
375
|
+
status: this.status,
|
|
376
|
+
statusText: this.statusText,
|
|
377
|
+
unhandled,
|
|
378
|
+
message: unhandled ? "HTTPError" : this.message,
|
|
379
|
+
data: unhandled ? void 0 : this.data,
|
|
380
|
+
...unhandled ? void 0 : this.body
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
function isJSONSerializable(value, _type) {
|
|
385
|
+
if (value === null || value === void 0) return true;
|
|
386
|
+
if (_type !== "object") return _type === "boolean" || _type === "number" || _type === "string";
|
|
387
|
+
if (typeof value.toJSON === "function") return true;
|
|
388
|
+
if (Array.isArray(value)) return true;
|
|
389
|
+
if (typeof value.pipe === "function" || typeof value.pipeTo === "function") return false;
|
|
390
|
+
if (value instanceof NullProtoObj) return true;
|
|
391
|
+
const proto = Object.getPrototypeOf(value);
|
|
392
|
+
return proto === Object.prototype || proto === null;
|
|
393
|
+
}
|
|
394
|
+
var kNotFound = /* @__PURE__ */ Symbol.for("h3.notFound");
|
|
395
|
+
var kHandled = /* @__PURE__ */ Symbol.for("h3.handled");
|
|
396
|
+
function toResponse(val, event, config = {}) {
|
|
397
|
+
if (typeof val?.then === "function") return val.then((resolvedVal) => toResponse(resolvedVal, event, config), (r) => toResponse(typeof r === "number" ? new HTTPError({ status: r }) : r, event, config));
|
|
398
|
+
const response = prepareResponse(val, event, config);
|
|
399
|
+
if (typeof response?.then === "function") return toResponse(response, event, config);
|
|
400
|
+
const { onResponse } = config;
|
|
401
|
+
return onResponse ? Promise.resolve(onResponse(response, event)).then(() => response) : response;
|
|
402
|
+
}
|
|
403
|
+
var HTTPResponse = class {
|
|
404
|
+
#headers;
|
|
405
|
+
#init;
|
|
406
|
+
body;
|
|
407
|
+
constructor(body, init) {
|
|
408
|
+
this.body = body;
|
|
409
|
+
this.#init = init;
|
|
410
|
+
}
|
|
411
|
+
get status() {
|
|
412
|
+
return this.#init?.status || 200;
|
|
413
|
+
}
|
|
414
|
+
get statusText() {
|
|
415
|
+
return this.#init?.statusText || "OK";
|
|
416
|
+
}
|
|
417
|
+
get headers() {
|
|
418
|
+
return this.#headers ||= new Headers(this.#init?.headers);
|
|
419
|
+
}
|
|
420
|
+
};
|
|
421
|
+
function prepareResponse(val, event, config, nested) {
|
|
422
|
+
if (val === kHandled) return new NodeResponse(null);
|
|
423
|
+
if (val === kNotFound) val = new HTTPError({
|
|
424
|
+
status: 404,
|
|
425
|
+
message: `Cannot find any route matching [${event.req.method}] ${event.url}`
|
|
426
|
+
});
|
|
427
|
+
if (val && val instanceof Error) {
|
|
428
|
+
const isHTTPError = HTTPError.isError(val);
|
|
429
|
+
const error = isHTTPError ? val : new HTTPError(val);
|
|
430
|
+
if (!isHTTPError) {
|
|
431
|
+
error.unhandled = true;
|
|
432
|
+
if (val?.stack) error.stack = val.stack;
|
|
433
|
+
}
|
|
434
|
+
if (error.unhandled && !config.silent) console.error(error);
|
|
435
|
+
const { onError } = config;
|
|
436
|
+
const errHeaders = event[kEventRes]?.[kEventResErrHeaders];
|
|
437
|
+
return onError && !nested ? Promise.resolve(onError(error, event)).catch((error) => error).then((newVal) => prepareResponse(newVal ?? val, event, config, true)) : errorResponse(error, config.debug, errHeaders);
|
|
438
|
+
}
|
|
439
|
+
const preparedRes = event[kEventRes];
|
|
440
|
+
const preparedHeaders = preparedRes?.[kEventResHeaders];
|
|
441
|
+
event[kEventRes] = void 0;
|
|
442
|
+
if (!(val instanceof Response)) {
|
|
443
|
+
const res = prepareResponseBody(val, event, config);
|
|
444
|
+
const status = res.status || preparedRes?.status;
|
|
445
|
+
return new NodeResponse(nullBody(event.req.method, status) ? null : res.body, {
|
|
446
|
+
status,
|
|
447
|
+
statusText: res.statusText || preparedRes?.statusText,
|
|
448
|
+
headers: res.headers && preparedHeaders ? mergeHeaders$1(res.headers, preparedHeaders) : res.headers || preparedHeaders
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
if (!preparedHeaders || nested || !val.ok) return val;
|
|
452
|
+
try {
|
|
453
|
+
mergeHeaders$1(val.headers, preparedHeaders, val.headers);
|
|
454
|
+
return val;
|
|
455
|
+
} catch {
|
|
456
|
+
return new NodeResponse(nullBody(event.req.method, val.status) ? null : val.body, {
|
|
457
|
+
status: val.status,
|
|
458
|
+
statusText: val.statusText,
|
|
459
|
+
headers: mergeHeaders$1(val.headers, preparedHeaders)
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
function mergeHeaders$1(base, overrides, target = new Headers(base)) {
|
|
464
|
+
for (const [name, value] of overrides) if (name === "set-cookie") target.append(name, value);
|
|
465
|
+
else target.set(name, value);
|
|
466
|
+
return target;
|
|
467
|
+
}
|
|
468
|
+
var frozen = (name) => (...args) => {
|
|
469
|
+
throw new Error(`Headers are frozen (${name} ${args.join(", ")})`);
|
|
470
|
+
};
|
|
471
|
+
var FrozenHeaders = class extends Headers {
|
|
472
|
+
set = frozen("set");
|
|
473
|
+
append = frozen("append");
|
|
474
|
+
delete = frozen("delete");
|
|
475
|
+
};
|
|
476
|
+
var emptyHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-length": "0" });
|
|
477
|
+
var jsonHeaders = /* @__PURE__ */ new FrozenHeaders({ "content-type": "application/json;charset=UTF-8" });
|
|
478
|
+
function prepareResponseBody(val, event, config) {
|
|
479
|
+
if (val === null || val === void 0) return {
|
|
480
|
+
body: "",
|
|
481
|
+
headers: emptyHeaders
|
|
482
|
+
};
|
|
483
|
+
const valType = typeof val;
|
|
484
|
+
if (valType === "string") return { body: val };
|
|
485
|
+
if (val instanceof Uint8Array) {
|
|
486
|
+
event.res.headers.set("content-length", val.byteLength.toString());
|
|
487
|
+
return { body: val };
|
|
488
|
+
}
|
|
489
|
+
if (val instanceof HTTPResponse || val?.constructor?.name === "HTTPResponse") return val;
|
|
490
|
+
if (isJSONSerializable(val, valType)) return {
|
|
491
|
+
body: JSON.stringify(val, void 0, config.debug ? 2 : void 0),
|
|
492
|
+
headers: jsonHeaders
|
|
493
|
+
};
|
|
494
|
+
if (valType === "bigint") return {
|
|
495
|
+
body: val.toString(),
|
|
496
|
+
headers: jsonHeaders
|
|
497
|
+
};
|
|
498
|
+
if (val instanceof Blob) {
|
|
499
|
+
const headers = new Headers({
|
|
500
|
+
"content-type": val.type,
|
|
501
|
+
"content-length": val.size.toString()
|
|
502
|
+
});
|
|
503
|
+
let filename = val.name;
|
|
504
|
+
if (filename) {
|
|
505
|
+
filename = encodeURIComponent(filename);
|
|
506
|
+
headers.set("content-disposition", `filename="${filename}"; filename*=UTF-8''${filename}`);
|
|
507
|
+
}
|
|
508
|
+
return {
|
|
509
|
+
body: val.stream(),
|
|
510
|
+
headers
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
if (valType === "symbol") return { body: val.toString() };
|
|
514
|
+
if (valType === "function") return { body: `${val.name}()` };
|
|
515
|
+
return { body: val };
|
|
516
|
+
}
|
|
517
|
+
function nullBody(method, status) {
|
|
518
|
+
return method === "HEAD" || status === 100 || status === 101 || status === 102 || status === 204 || status === 205 || status === 304;
|
|
519
|
+
}
|
|
520
|
+
function errorResponse(error, debug, errHeaders) {
|
|
521
|
+
let headers = error.headers ? mergeHeaders$1(jsonHeaders, error.headers) : new Headers(jsonHeaders);
|
|
522
|
+
if (errHeaders) headers = mergeHeaders$1(headers, errHeaders);
|
|
523
|
+
return new NodeResponse(JSON.stringify({
|
|
524
|
+
...error.toJSON(),
|
|
525
|
+
stack: debug && error.stack ? error.stack.split("\n").map((l) => l.trim()) : void 0
|
|
526
|
+
}, void 0, debug ? 2 : void 0), {
|
|
527
|
+
status: error.status,
|
|
528
|
+
statusText: error.statusText,
|
|
529
|
+
headers
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
function callMiddleware(event, middleware, handler, index = 0) {
|
|
533
|
+
if (index === middleware.length) return handler(event);
|
|
534
|
+
const fn = middleware[index];
|
|
535
|
+
let nextCalled;
|
|
536
|
+
let nextResult;
|
|
537
|
+
const next = () => {
|
|
538
|
+
if (nextCalled) return nextResult;
|
|
539
|
+
nextCalled = true;
|
|
540
|
+
nextResult = callMiddleware(event, middleware, handler, index + 1);
|
|
541
|
+
return nextResult;
|
|
542
|
+
};
|
|
543
|
+
const ret = fn(event, next);
|
|
544
|
+
return isUnhandledResponse(ret) ? next() : typeof ret?.then === "function" ? ret.then((resolved) => isUnhandledResponse(resolved) ? next() : resolved) : ret;
|
|
545
|
+
}
|
|
546
|
+
function isUnhandledResponse(val) {
|
|
547
|
+
return val === void 0 || val === kNotFound;
|
|
548
|
+
}
|
|
549
|
+
function toRequest(input, options) {
|
|
550
|
+
if (typeof input === "string") {
|
|
551
|
+
let url = input;
|
|
552
|
+
if (url[0] === "/") {
|
|
553
|
+
const headers = options?.headers ? new Headers(options.headers) : void 0;
|
|
554
|
+
const host = headers?.get("host") || "localhost";
|
|
555
|
+
url = `${headers?.get("x-forwarded-proto") === "https" ? "https" : "http"}://${host}${url}`;
|
|
556
|
+
}
|
|
557
|
+
return new Request(url, options);
|
|
558
|
+
} else if (options || input instanceof URL) return new Request(input, options);
|
|
559
|
+
return input;
|
|
560
|
+
}
|
|
561
|
+
function defineHandler(input) {
|
|
562
|
+
if (typeof input === "function") return handlerWithFetch(input);
|
|
563
|
+
const handler = input.handler || (input.fetch ? function _fetchHandler(event) {
|
|
564
|
+
return input.fetch(event.req);
|
|
565
|
+
} : NoHandler);
|
|
566
|
+
return Object.assign(handlerWithFetch(input.middleware?.length ? function _handlerMiddleware(event) {
|
|
567
|
+
return callMiddleware(event, input.middleware, handler);
|
|
568
|
+
} : handler), input);
|
|
569
|
+
}
|
|
570
|
+
function handlerWithFetch(handler) {
|
|
571
|
+
if ("fetch" in handler) return handler;
|
|
572
|
+
return Object.assign(handler, { fetch: (req) => {
|
|
573
|
+
if (typeof req === "string") req = new URL(req, "http://_");
|
|
574
|
+
if (req instanceof URL) req = new Request(req);
|
|
575
|
+
const event = new H3Event(req);
|
|
576
|
+
try {
|
|
577
|
+
return Promise.resolve(toResponse(handler(event), event));
|
|
578
|
+
} catch (error) {
|
|
579
|
+
return Promise.resolve(toResponse(error, event));
|
|
580
|
+
}
|
|
581
|
+
} });
|
|
582
|
+
}
|
|
583
|
+
function defineLazyEventHandler(loader) {
|
|
584
|
+
let handler;
|
|
585
|
+
let promise;
|
|
586
|
+
return defineHandler(function lazyHandler(event) {
|
|
587
|
+
return handler ? handler(event) : (promise ??= Promise.resolve(loader()).then(function resolveLazyHandler(r) {
|
|
588
|
+
handler = toEventHandler(r) || toEventHandler(r.default);
|
|
589
|
+
if (typeof handler !== "function") throw new TypeError("Invalid lazy handler", { cause: { resolved: r } });
|
|
590
|
+
return handler;
|
|
591
|
+
})).then((r) => r(event));
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
function toEventHandler(handler) {
|
|
595
|
+
if (typeof handler === "function") return handler;
|
|
596
|
+
if (typeof handler?.handler === "function" && handler.constructor?.["~h3"]) return handler.handler;
|
|
597
|
+
if (typeof handler?.fetch === "function") return function _fetchHandler(event) {
|
|
598
|
+
return handler.fetch(event.req);
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
var NoHandler = () => kNotFound;
|
|
602
|
+
var H3Core = class {
|
|
603
|
+
static "~h3" = true;
|
|
604
|
+
config;
|
|
605
|
+
"~middleware";
|
|
606
|
+
"~routes" = [];
|
|
607
|
+
constructor(config = {}) {
|
|
608
|
+
this["~middleware"] = [];
|
|
609
|
+
this.config = config;
|
|
610
|
+
this.fetch = this.fetch.bind(this);
|
|
611
|
+
this.handler = this.handler.bind(this);
|
|
612
|
+
}
|
|
613
|
+
fetch(request) {
|
|
614
|
+
return this["~request"](request);
|
|
615
|
+
}
|
|
616
|
+
handler(event) {
|
|
617
|
+
const route = this["~findRoute"](event);
|
|
618
|
+
if (route) {
|
|
619
|
+
event.context.params = route.params;
|
|
620
|
+
event.context.matchedRoute = route.data;
|
|
621
|
+
}
|
|
622
|
+
const routeHandler = route?.data.handler || NoHandler;
|
|
623
|
+
const middleware = this["~getMiddleware"](event, route);
|
|
624
|
+
return middleware.length > 0 ? callMiddleware(event, middleware, routeHandler) : routeHandler(event);
|
|
625
|
+
}
|
|
626
|
+
"~request"(request, context) {
|
|
627
|
+
const event = new H3Event(request, context, this);
|
|
628
|
+
let handlerRes;
|
|
629
|
+
try {
|
|
630
|
+
if (this.config.onRequest) {
|
|
631
|
+
const hookRes = this.config.onRequest(event);
|
|
632
|
+
handlerRes = typeof hookRes?.then === "function" ? hookRes.then(() => this.handler(event)) : this.handler(event);
|
|
633
|
+
} else handlerRes = this.handler(event);
|
|
634
|
+
} catch (error) {
|
|
635
|
+
handlerRes = Promise.reject(error);
|
|
636
|
+
}
|
|
637
|
+
return toResponse(handlerRes, event, this.config);
|
|
638
|
+
}
|
|
639
|
+
"~findRoute"(_event) {}
|
|
640
|
+
"~addRoute"(_route) {
|
|
641
|
+
this["~routes"].push(_route);
|
|
642
|
+
}
|
|
643
|
+
"~getMiddleware"(_event, route) {
|
|
644
|
+
const routeMiddleware = route?.data.middleware;
|
|
645
|
+
const globalMiddleware = this["~middleware"];
|
|
646
|
+
return routeMiddleware ? [...globalMiddleware, ...routeMiddleware] : globalMiddleware;
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
//#endregion
|
|
650
|
+
export { toEventHandler as a, defineLazyEventHandler as i, HTTPError as n, toRequest as o, defineHandler as r, NodeResponse as s, H3Core as t };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/hookable@6.1.1/node_modules/hookable/dist/index.mjs
|
|
2
|
+
function callHooks(hooks, args, startIndex, task) {
|
|
3
|
+
for (let i = startIndex; i < hooks.length; i += 1) try {
|
|
4
|
+
const result = task ? task.run(() => hooks[i](...args)) : hooks[i](...args);
|
|
5
|
+
if (result && typeof result.then === "function") return Promise.resolve(result).then(() => callHooks(hooks, args, i + 1, task));
|
|
6
|
+
} catch (error) {
|
|
7
|
+
return Promise.reject(error);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
var HookableCore = class {
|
|
11
|
+
_hooks;
|
|
12
|
+
constructor() {
|
|
13
|
+
this._hooks = {};
|
|
14
|
+
}
|
|
15
|
+
hook(name, fn) {
|
|
16
|
+
if (!name || typeof fn !== "function") return () => {};
|
|
17
|
+
this._hooks[name] = this._hooks[name] || [];
|
|
18
|
+
this._hooks[name].push(fn);
|
|
19
|
+
return () => {
|
|
20
|
+
if (fn) {
|
|
21
|
+
this.removeHook(name, fn);
|
|
22
|
+
fn = void 0;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
removeHook(name, function_) {
|
|
27
|
+
const hooks = this._hooks[name];
|
|
28
|
+
if (hooks) {
|
|
29
|
+
const index = hooks.indexOf(function_);
|
|
30
|
+
if (index !== -1) hooks.splice(index, 1);
|
|
31
|
+
if (hooks.length === 0) this._hooks[name] = void 0;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
callHook(name, ...args) {
|
|
35
|
+
const hooks = this._hooks[name];
|
|
36
|
+
if (!hooks || hooks.length === 0) return;
|
|
37
|
+
return callHooks(hooks, args, 0);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { HookableCore as t };
|