@absolutejs/absolute 0.19.0-beta.1082 → 0.19.0-beta.1083
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/.absolutejs/generated/angular/indexes/angular-example.1g23yr9r.js +167 -0
- package/dist/.absolutejs/generated/react/indexes/ReactExample.e6kzvjqy.js +3 -0
- package/dist/.absolutejs/generated/svelte/client/pages/SvelteExample.5pq2wmw6.js +1 -0
- package/dist/.absolutejs/generated/svelte/indexes/pages/SvelteExample.9zcw5vtg.js +1 -0
- package/dist/.absolutejs/generated/vue/client/pages/VueExample.q47m56s4.js +1 -0
- package/dist/.absolutejs/generated/vue/indexes/VueExample.6bqszcxv.js +1 -0
- package/dist/_prerendered/angular.html +45 -0
- package/dist/_prerendered/angular.meta +1 -0
- package/dist/_prerendered/html.html +70 -0
- package/dist/_prerendered/html.meta +1 -0
- package/dist/_prerendered/htmx.html +239 -0
- package/dist/_prerendered/htmx.meta +1 -0
- package/dist/_prerendered/index.html +70 -0
- package/dist/_prerendered/index.meta +1 -0
- package/dist/_prerendered/react.html +1 -0
- package/dist/_prerendered/react.meta +1 -0
- package/dist/_prerendered/vue.html +41 -0
- package/dist/_prerendered/vue.meta +1 -0
- package/dist/angular/browser.js +18 -18
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/components/defer-slot-templates.directive.js +2 -2
- package/dist/angular/components/defer-slot.component.js +3 -3
- package/dist/angular/components/image.component.js +3 -3
- package/dist/angular/components/stream-slot.component.js +3 -3
- package/dist/angular/example/angular/pages/angular-example.djr1v9hj.js +373 -0
- package/dist/angular/index.js +43 -43
- package/dist/angular/server.js +31 -31
- package/dist/angular/vendor/angular_common.js +310 -0
- package/dist/angular/vendor/angular_common_http.js +129 -0
- package/dist/angular/vendor/angular_core.js +1177 -0
- package/dist/angular/vendor/angular_core_primitives_di.js +36 -0
- package/dist/angular/vendor/angular_core_primitives_signals.js +132 -0
- package/dist/angular/vendor/angular_platform-browser.js +117 -0
- package/dist/angular/vendor/angular_router.js +6410 -0
- package/dist/angular/vendor/chunk-2c9evnn0.js +4764 -0
- package/dist/angular/vendor/chunk-3evcs0sk.js +2567 -0
- package/dist/angular/vendor/chunk-5h3qyvpj.js +729 -0
- package/dist/angular/vendor/chunk-hgg0w52m.js +62 -0
- package/dist/angular/vendor/chunk-n6rt7w2y.js +23 -0
- package/dist/angular/vendor/chunk-t4tc7c8b.js +28013 -0
- package/dist/angular/vendor/chunk-vqd7j0kb.js +1786 -0
- package/dist/angular/vendor/chunk-yqjkhk8j.js +145 -0
- package/dist/angular/vendor/server/angular_common.js +311 -0
- package/dist/angular/vendor/server/angular_common_http.js +130 -0
- package/dist/angular/vendor/server/angular_core.js +1178 -0
- package/dist/angular/vendor/server/angular_core_primitives_di.js +37 -0
- package/dist/angular/vendor/server/angular_core_primitives_signals.js +133 -0
- package/dist/angular/vendor/server/angular_platform-browser.js +118 -0
- package/dist/angular/vendor/server/angular_platform-server.js +59 -0
- package/dist/angular/vendor/server/angular_router.js +261 -0
- package/dist/angular/vendor/server/angular_ssr.js +11669 -0
- package/dist/angular/vendor/server/chunk-2akxms5e.js +2566 -0
- package/dist/angular/vendor/server/chunk-659a9c3p.js +6218 -0
- package/dist/angular/vendor/server/chunk-8eecnjd1.js +16686 -0
- package/dist/angular/vendor/server/chunk-9jz2apvp.js +743 -0
- package/dist/angular/vendor/server/chunk-dhs2bg35.js +48 -0
- package/dist/angular/vendor/server/chunk-hs2gc8sr.js +1787 -0
- package/dist/angular/vendor/server/chunk-k46n34mb.js +63 -0
- package/dist/angular/vendor/server/chunk-p2fdvyh1.js +4767 -0
- package/dist/angular/vendor/server/chunk-r0w9r4bg.js +730 -0
- package/dist/angular/vendor/server/chunk-vthxj7kd.js +146 -0
- package/dist/angular/vendor/server/chunk-xahr7f2f.js +35534 -0
- package/dist/assets/css/tailwind.generated.css +218 -0
- package/dist/assets/css/vue-example-compiled.abzaxheq.css +32 -0
- package/dist/assets/ico/favicon.ico +0 -0
- package/dist/assets/png/absolutejs-temp.png +0 -0
- package/dist/assets/svg/HTML5_Badge.svg +7 -0
- package/dist/assets/svg/angular.svg +18 -0
- package/dist/assets/svg/htmx-logo-black.svg +9 -0
- package/dist/assets/svg/htmx-logo-white.svg +9 -0
- package/dist/assets/svg/react.svg +1 -0
- package/dist/assets/svg/svelte-logo.svg +1 -0
- package/dist/assets/svg/vue-logo.svg +4 -0
- package/dist/build.js +42 -42
- package/dist/chunk-7pp6gkg8.js +2 -0
- package/dist/chunk-ek2qyx2c.js +11 -0
- package/dist/chunk-ysr5ycdt.js +2 -0
- package/dist/cli/config/server.js +11 -11
- package/dist/cli/index.js +12 -1
- package/dist/client/index.js +13 -13
- package/dist/client.tsx +15 -0
- package/dist/example/html/scripts/typescript-example.fqn9zkdh.js +1 -0
- package/dist/html/pages/HTMLExample.html +70 -0
- package/dist/htmx/htmx.min.js +1 -0
- package/dist/htmx/pages/HTMXExample.html +239 -0
- package/dist/htmx.min.js +1 -0
- package/dist/index.js +62 -62
- package/dist/indexes/angular-example.xsx88ph0.css +227 -0
- package/dist/indexes/html-example.s3banzdc.css +221 -0
- package/dist/indexes/htmx-example.5vgssc3f.css +221 -0
- package/dist/indexes/react-example.bz1k8xa2.css +245 -0
- package/dist/indexes/svelte-example.vy3015es.css +221 -0
- package/dist/indexes/vue-example.q4vf2wtq.css +228 -0
- package/dist/islands/index.js +14 -14
- package/dist/manifest.json +26 -0
- package/dist/nested/dynamic-module.txt +1 -0
- package/dist/package-asset.txt +1 -0
- package/dist/react/browser.js +3 -3
- package/dist/react/components/browser/index.js +5 -5
- package/dist/react/components/index.js +7 -7
- package/dist/react/hooks/index.js +2 -2
- package/dist/react/index.js +30 -30
- package/dist/react/jsxDevRuntimeCompat.js +1 -1
- package/dist/react/router/browser.js +2 -2
- package/dist/react/router/index.js +2 -2
- package/dist/react/server.js +13 -13
- package/dist/react/vendor/chunk-2kh60w9b.js +33 -0
- package/dist/react/vendor/chunk-9g12fvrw.js +236 -0
- package/dist/react/vendor/chunk-rejbymp5.js +837 -0
- package/dist/react/vendor/chunk-wwy122hz.js +200 -0
- package/dist/react/vendor/react-dom.js +44 -0
- package/dist/react/vendor/react-dom_client.js +15864 -0
- package/dist/react/vendor/react-refresh_runtime.js +304 -0
- package/dist/react/vendor/react.js +103 -0
- package/dist/react/vendor/react_jsx-dev-runtime.js +17 -0
- package/dist/react/vendor/react_jsx-runtime.js +22 -0
- package/dist/robots.txt +2 -0
- package/dist/runtime/blob.txt +1 -0
- package/dist/runtime/dir-join.txt +1 -0
- package/dist/runtime/nested/binary.bin +1 -0
- package/dist/runtime/nested/readfile.txt +1 -0
- package/dist/runtime/template.html +1 -0
- package/dist/server.js +92156 -0
- package/dist/sitemap.xml +48 -0
- package/dist/svelte/index.js +26 -26
- package/dist/svelte/router/page.js +1 -1
- package/dist/svelte/server/pages/SvelteExample.fxs20w1b.js +290 -0
- package/dist/svelte/server.js +13 -13
- package/dist/svelte/vendor/chunk-5qdxn1p3.js +4586 -0
- package/dist/svelte/vendor/chunk-8qdfbbez.js +12 -0
- package/dist/svelte/vendor/chunk-r2jyyfjt.js +4495 -0
- package/dist/svelte/vendor/svelte.js +49 -0
- package/dist/svelte/vendor/svelte_internal.js +2 -0
- package/dist/svelte/vendor/svelte_internal_client.js +395 -0
- package/dist/svelte/vendor/svelte_internal_disclose-version.js +7 -0
- package/dist/svelte/vendor/svelte_internal_flags_async.js +6 -0
- package/dist/svelte/vendor/svelte_internal_flags_legacy.js +6 -0
- package/dist/svelte/vendor/svelte_store.js +99 -0
- package/dist/vue/browser.js +3 -3
- package/dist/vue/components/Image.js +1 -1
- package/dist/vue/components/index.js +5 -5
- package/dist/vue/index.js +36 -36
- package/dist/vue/server/pages/VueExample.fyhmna2p.css +32 -0
- package/dist/vue/server/pages/VueExample.fyhmna2p.js +75 -0
- package/dist/vue/server.js +13 -13
- package/dist/vue/vendor/vue.js +11011 -0
- package/package.json +1 -1
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require
|
|
5
|
+
} from "./chunk-dhs2bg35.js";
|
|
6
|
+
|
|
7
|
+
// node_modules/xhr2/lib/xhr2.js
|
|
8
|
+
var require_xhr2 = __commonJS((exports, module) => {
|
|
9
|
+
(function() {
|
|
10
|
+
var InvalidStateError, NetworkError, ProgressEvent, SecurityError, SyntaxError, XMLHttpRequest, XMLHttpRequestEventTarget, XMLHttpRequestUpload, http, https, os, url;
|
|
11
|
+
XMLHttpRequestEventTarget = function() {
|
|
12
|
+
|
|
13
|
+
class XMLHttpRequestEventTarget2 {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.onloadstart = null;
|
|
16
|
+
this.onprogress = null;
|
|
17
|
+
this.onabort = null;
|
|
18
|
+
this.onerror = null;
|
|
19
|
+
this.onload = null;
|
|
20
|
+
this.ontimeout = null;
|
|
21
|
+
this.onloadend = null;
|
|
22
|
+
this._listeners = {};
|
|
23
|
+
}
|
|
24
|
+
addEventListener(eventType, listener) {
|
|
25
|
+
var base;
|
|
26
|
+
eventType = eventType.toLowerCase();
|
|
27
|
+
(base = this._listeners)[eventType] || (base[eventType] = []);
|
|
28
|
+
this._listeners[eventType].push(listener);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
removeEventListener(eventType, listener) {
|
|
32
|
+
var index;
|
|
33
|
+
eventType = eventType.toLowerCase();
|
|
34
|
+
if (this._listeners[eventType]) {
|
|
35
|
+
index = this._listeners[eventType].indexOf(listener);
|
|
36
|
+
if (index !== -1) {
|
|
37
|
+
this._listeners[eventType].splice(index, 1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
dispatchEvent(event) {
|
|
43
|
+
var eventType, j, len, listener, listeners;
|
|
44
|
+
event.currentTarget = event.target = this;
|
|
45
|
+
eventType = event.type;
|
|
46
|
+
if (listeners = this._listeners[eventType]) {
|
|
47
|
+
for (j = 0, len = listeners.length;j < len; j++) {
|
|
48
|
+
listener = listeners[j];
|
|
49
|
+
listener.call(this, event);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (listener = this[`on${eventType}`]) {
|
|
53
|
+
listener.call(this, event);
|
|
54
|
+
}
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
XMLHttpRequestEventTarget2.prototype.onloadstart = null;
|
|
59
|
+
XMLHttpRequestEventTarget2.prototype.onprogress = null;
|
|
60
|
+
XMLHttpRequestEventTarget2.prototype.onabort = null;
|
|
61
|
+
XMLHttpRequestEventTarget2.prototype.onerror = null;
|
|
62
|
+
XMLHttpRequestEventTarget2.prototype.onload = null;
|
|
63
|
+
XMLHttpRequestEventTarget2.prototype.ontimeout = null;
|
|
64
|
+
XMLHttpRequestEventTarget2.prototype.onloadend = null;
|
|
65
|
+
return XMLHttpRequestEventTarget2;
|
|
66
|
+
}.call(this);
|
|
67
|
+
http = __require("http");
|
|
68
|
+
https = __require("https");
|
|
69
|
+
os = __require("os");
|
|
70
|
+
url = __require("url");
|
|
71
|
+
XMLHttpRequest = function() {
|
|
72
|
+
|
|
73
|
+
class XMLHttpRequest2 extends XMLHttpRequestEventTarget {
|
|
74
|
+
constructor(options) {
|
|
75
|
+
super();
|
|
76
|
+
this.onreadystatechange = null;
|
|
77
|
+
this._anonymous = options && options.anon;
|
|
78
|
+
this.readyState = XMLHttpRequest2.UNSENT;
|
|
79
|
+
this.response = null;
|
|
80
|
+
this.responseText = "";
|
|
81
|
+
this.responseType = "";
|
|
82
|
+
this.responseURL = "";
|
|
83
|
+
this.status = 0;
|
|
84
|
+
this.statusText = "";
|
|
85
|
+
this.timeout = 0;
|
|
86
|
+
this.upload = new XMLHttpRequestUpload(this);
|
|
87
|
+
this._method = null;
|
|
88
|
+
this._url = null;
|
|
89
|
+
this._sync = false;
|
|
90
|
+
this._headers = null;
|
|
91
|
+
this._loweredHeaders = null;
|
|
92
|
+
this._mimeOverride = null;
|
|
93
|
+
this._request = null;
|
|
94
|
+
this._response = null;
|
|
95
|
+
this._responseParts = null;
|
|
96
|
+
this._responseHeaders = null;
|
|
97
|
+
this._aborting = null;
|
|
98
|
+
this._error = null;
|
|
99
|
+
this._loadedBytes = 0;
|
|
100
|
+
this._totalBytes = 0;
|
|
101
|
+
this._lengthComputable = false;
|
|
102
|
+
}
|
|
103
|
+
open(method, url2, async, user, password) {
|
|
104
|
+
var xhrUrl;
|
|
105
|
+
method = method.toUpperCase();
|
|
106
|
+
if (method in this._restrictedMethods) {
|
|
107
|
+
throw new SecurityError(`HTTP method ${method} is not allowed in XHR`);
|
|
108
|
+
}
|
|
109
|
+
xhrUrl = this._parseUrl(url2);
|
|
110
|
+
if (async === undefined) {
|
|
111
|
+
async = true;
|
|
112
|
+
}
|
|
113
|
+
switch (this.readyState) {
|
|
114
|
+
case XMLHttpRequest2.UNSENT:
|
|
115
|
+
case XMLHttpRequest2.OPENED:
|
|
116
|
+
case XMLHttpRequest2.DONE:
|
|
117
|
+
break;
|
|
118
|
+
case XMLHttpRequest2.HEADERS_RECEIVED:
|
|
119
|
+
case XMLHttpRequest2.LOADING:
|
|
120
|
+
}
|
|
121
|
+
this._method = method;
|
|
122
|
+
this._url = xhrUrl;
|
|
123
|
+
this._sync = !async;
|
|
124
|
+
this._headers = {};
|
|
125
|
+
this._loweredHeaders = {};
|
|
126
|
+
this._mimeOverride = null;
|
|
127
|
+
this._setReadyState(XMLHttpRequest2.OPENED);
|
|
128
|
+
this._request = null;
|
|
129
|
+
this._response = null;
|
|
130
|
+
this.status = 0;
|
|
131
|
+
this.statusText = "";
|
|
132
|
+
this._responseParts = [];
|
|
133
|
+
this._responseHeaders = null;
|
|
134
|
+
this._loadedBytes = 0;
|
|
135
|
+
this._totalBytes = 0;
|
|
136
|
+
this._lengthComputable = false;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
setRequestHeader(name, value) {
|
|
140
|
+
var loweredName;
|
|
141
|
+
if (this.readyState !== XMLHttpRequest2.OPENED) {
|
|
142
|
+
throw new InvalidStateError("XHR readyState must be OPENED");
|
|
143
|
+
}
|
|
144
|
+
loweredName = name.toLowerCase();
|
|
145
|
+
if (this._restrictedHeaders[loweredName] || /^sec\-/.test(loweredName) || /^proxy-/.test(loweredName)) {
|
|
146
|
+
console.warn(`Refused to set unsafe header "${name}"`);
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
value = value.toString();
|
|
150
|
+
if (loweredName in this._loweredHeaders) {
|
|
151
|
+
name = this._loweredHeaders[loweredName];
|
|
152
|
+
this._headers[name] = this._headers[name] + ", " + value;
|
|
153
|
+
} else {
|
|
154
|
+
this._loweredHeaders[loweredName] = name;
|
|
155
|
+
this._headers[name] = value;
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
send(data) {
|
|
160
|
+
if (this.readyState !== XMLHttpRequest2.OPENED) {
|
|
161
|
+
throw new InvalidStateError("XHR readyState must be OPENED");
|
|
162
|
+
}
|
|
163
|
+
if (this._request) {
|
|
164
|
+
throw new InvalidStateError("send() already called");
|
|
165
|
+
}
|
|
166
|
+
switch (this._url.protocol) {
|
|
167
|
+
case "file:":
|
|
168
|
+
this._sendFile(data);
|
|
169
|
+
break;
|
|
170
|
+
case "http:":
|
|
171
|
+
case "https:":
|
|
172
|
+
this._sendHttp(data);
|
|
173
|
+
break;
|
|
174
|
+
default:
|
|
175
|
+
throw new NetworkError(`Unsupported protocol ${this._url.protocol}`);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
abort() {
|
|
180
|
+
if (!this._request) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
this._request.abort();
|
|
184
|
+
this._setError();
|
|
185
|
+
this._dispatchProgress("abort");
|
|
186
|
+
this._dispatchProgress("loadend");
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
getResponseHeader(name) {
|
|
190
|
+
var loweredName;
|
|
191
|
+
if (!this._responseHeaders) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
loweredName = name.toLowerCase();
|
|
195
|
+
if (loweredName in this._responseHeaders) {
|
|
196
|
+
return this._responseHeaders[loweredName];
|
|
197
|
+
} else {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
getAllResponseHeaders() {
|
|
202
|
+
var lines, name, value;
|
|
203
|
+
if (!this._responseHeaders) {
|
|
204
|
+
return "";
|
|
205
|
+
}
|
|
206
|
+
lines = function() {
|
|
207
|
+
var ref, results;
|
|
208
|
+
ref = this._responseHeaders;
|
|
209
|
+
results = [];
|
|
210
|
+
for (name in ref) {
|
|
211
|
+
value = ref[name];
|
|
212
|
+
results.push(`${name}: ${value}`);
|
|
213
|
+
}
|
|
214
|
+
return results;
|
|
215
|
+
}.call(this);
|
|
216
|
+
return lines.join(`\r
|
|
217
|
+
`);
|
|
218
|
+
}
|
|
219
|
+
overrideMimeType(newMimeType) {
|
|
220
|
+
if (this.readyState === XMLHttpRequest2.LOADING || this.readyState === XMLHttpRequest2.DONE) {
|
|
221
|
+
throw new InvalidStateError("overrideMimeType() not allowed in LOADING or DONE");
|
|
222
|
+
}
|
|
223
|
+
this._mimeOverride = newMimeType.toLowerCase();
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
nodejsSet(options) {
|
|
227
|
+
var baseUrl, parsedUrl;
|
|
228
|
+
if ("httpAgent" in options) {
|
|
229
|
+
this.nodejsHttpAgent = options.httpAgent;
|
|
230
|
+
}
|
|
231
|
+
if ("httpsAgent" in options) {
|
|
232
|
+
this.nodejsHttpsAgent = options.httpsAgent;
|
|
233
|
+
}
|
|
234
|
+
if ("baseUrl" in options) {
|
|
235
|
+
baseUrl = options.baseUrl;
|
|
236
|
+
if (baseUrl !== null) {
|
|
237
|
+
parsedUrl = url.parse(baseUrl, false, true);
|
|
238
|
+
if (!parsedUrl.protocol) {
|
|
239
|
+
throw new SyntaxError("baseUrl must be an absolute URL");
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
this.nodejsBaseUrl = baseUrl;
|
|
243
|
+
}
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
static nodejsSet(options) {
|
|
247
|
+
XMLHttpRequest2.prototype.nodejsSet(options);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
_setReadyState(newReadyState) {
|
|
251
|
+
var event;
|
|
252
|
+
this.readyState = newReadyState;
|
|
253
|
+
event = new ProgressEvent("readystatechange");
|
|
254
|
+
this.dispatchEvent(event);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
_sendFile() {
|
|
258
|
+
if (this._url.method !== "GET") {
|
|
259
|
+
throw new NetworkError("The file protocol only supports GET");
|
|
260
|
+
}
|
|
261
|
+
throw new Error("Protocol file: not implemented");
|
|
262
|
+
}
|
|
263
|
+
_sendHttp(data) {
|
|
264
|
+
if (this._sync) {
|
|
265
|
+
throw new Error("Synchronous XHR processing not implemented");
|
|
266
|
+
}
|
|
267
|
+
if (data != null && (this._method === "GET" || this._method === "HEAD")) {
|
|
268
|
+
console.warn(`Discarding entity body for ${this._method} requests`);
|
|
269
|
+
data = null;
|
|
270
|
+
} else {
|
|
271
|
+
data || (data = "");
|
|
272
|
+
}
|
|
273
|
+
this.upload._setData(data);
|
|
274
|
+
this._finalizeHeaders();
|
|
275
|
+
this._sendHxxpRequest();
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
_sendHxxpRequest() {
|
|
279
|
+
var agent, hxxp, request;
|
|
280
|
+
if (this._url.protocol === "http:") {
|
|
281
|
+
hxxp = http;
|
|
282
|
+
agent = this.nodejsHttpAgent;
|
|
283
|
+
} else {
|
|
284
|
+
hxxp = https;
|
|
285
|
+
agent = this.nodejsHttpsAgent;
|
|
286
|
+
}
|
|
287
|
+
request = hxxp.request({
|
|
288
|
+
hostname: this._url.hostname,
|
|
289
|
+
port: this._url.port,
|
|
290
|
+
path: this._url.path,
|
|
291
|
+
auth: this._url.auth,
|
|
292
|
+
method: this._method,
|
|
293
|
+
headers: this._headers,
|
|
294
|
+
agent
|
|
295
|
+
});
|
|
296
|
+
this._request = request;
|
|
297
|
+
if (this.timeout) {
|
|
298
|
+
request.setTimeout(this.timeout, () => {
|
|
299
|
+
return this._onHttpTimeout(request);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
request.on("response", (response) => {
|
|
303
|
+
return this._onHttpResponse(request, response);
|
|
304
|
+
});
|
|
305
|
+
request.on("error", (error) => {
|
|
306
|
+
return this._onHttpRequestError(request, error);
|
|
307
|
+
});
|
|
308
|
+
this.upload._startUpload(request);
|
|
309
|
+
if (this._request === request) {
|
|
310
|
+
this._dispatchProgress("loadstart");
|
|
311
|
+
}
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
_finalizeHeaders() {
|
|
315
|
+
var base;
|
|
316
|
+
this._headers["Connection"] = "keep-alive";
|
|
317
|
+
this._headers["Host"] = this._url.host;
|
|
318
|
+
if (this._anonymous) {
|
|
319
|
+
this._headers["Referer"] = "about:blank";
|
|
320
|
+
}
|
|
321
|
+
(base = this._headers)["User-Agent"] || (base["User-Agent"] = this._userAgent);
|
|
322
|
+
this.upload._finalizeHeaders(this._headers, this._loweredHeaders);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
_onHttpResponse(request, response) {
|
|
326
|
+
var lengthString;
|
|
327
|
+
if (this._request !== request) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
switch (response.statusCode) {
|
|
331
|
+
case 301:
|
|
332
|
+
case 302:
|
|
333
|
+
case 303:
|
|
334
|
+
case 307:
|
|
335
|
+
case 308:
|
|
336
|
+
this._url = this._parseUrl(response.headers["location"]);
|
|
337
|
+
this._method = "GET";
|
|
338
|
+
if ("content-type" in this._loweredHeaders) {
|
|
339
|
+
delete this._headers[this._loweredHeaders["content-type"]];
|
|
340
|
+
delete this._loweredHeaders["content-type"];
|
|
341
|
+
}
|
|
342
|
+
if ("Content-Type" in this._headers) {
|
|
343
|
+
delete this._headers["Content-Type"];
|
|
344
|
+
}
|
|
345
|
+
delete this._headers["Content-Length"];
|
|
346
|
+
this.upload._reset();
|
|
347
|
+
this._finalizeHeaders();
|
|
348
|
+
this._sendHxxpRequest();
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
this._response = response;
|
|
352
|
+
this._response.on("data", (data) => {
|
|
353
|
+
return this._onHttpResponseData(response, data);
|
|
354
|
+
});
|
|
355
|
+
this._response.on("end", () => {
|
|
356
|
+
return this._onHttpResponseEnd(response);
|
|
357
|
+
});
|
|
358
|
+
this._response.on("close", () => {
|
|
359
|
+
return this._onHttpResponseClose(response);
|
|
360
|
+
});
|
|
361
|
+
this.responseURL = this._url.href.split("#")[0];
|
|
362
|
+
this.status = this._response.statusCode;
|
|
363
|
+
this.statusText = http.STATUS_CODES[this.status];
|
|
364
|
+
this._parseResponseHeaders(response);
|
|
365
|
+
if (lengthString = this._responseHeaders["content-length"]) {
|
|
366
|
+
this._totalBytes = parseInt(lengthString);
|
|
367
|
+
this._lengthComputable = true;
|
|
368
|
+
} else {
|
|
369
|
+
this._lengthComputable = false;
|
|
370
|
+
}
|
|
371
|
+
return this._setReadyState(XMLHttpRequest2.HEADERS_RECEIVED);
|
|
372
|
+
}
|
|
373
|
+
_onHttpResponseData(response, data) {
|
|
374
|
+
if (this._response !== response) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
this._responseParts.push(data);
|
|
378
|
+
this._loadedBytes += data.length;
|
|
379
|
+
if (this.readyState !== XMLHttpRequest2.LOADING) {
|
|
380
|
+
this._setReadyState(XMLHttpRequest2.LOADING);
|
|
381
|
+
}
|
|
382
|
+
return this._dispatchProgress("progress");
|
|
383
|
+
}
|
|
384
|
+
_onHttpResponseEnd(response) {
|
|
385
|
+
if (this._response !== response) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
this._parseResponse();
|
|
389
|
+
this._request = null;
|
|
390
|
+
this._response = null;
|
|
391
|
+
this._setReadyState(XMLHttpRequest2.DONE);
|
|
392
|
+
this._dispatchProgress("load");
|
|
393
|
+
return this._dispatchProgress("loadend");
|
|
394
|
+
}
|
|
395
|
+
_onHttpResponseClose(response) {
|
|
396
|
+
var request;
|
|
397
|
+
if (this._response !== response) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
request = this._request;
|
|
401
|
+
this._setError();
|
|
402
|
+
request.abort();
|
|
403
|
+
this._setReadyState(XMLHttpRequest2.DONE);
|
|
404
|
+
this._dispatchProgress("error");
|
|
405
|
+
return this._dispatchProgress("loadend");
|
|
406
|
+
}
|
|
407
|
+
_onHttpTimeout(request) {
|
|
408
|
+
if (this._request !== request) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
this._setError();
|
|
412
|
+
request.abort();
|
|
413
|
+
this._setReadyState(XMLHttpRequest2.DONE);
|
|
414
|
+
this._dispatchProgress("timeout");
|
|
415
|
+
return this._dispatchProgress("loadend");
|
|
416
|
+
}
|
|
417
|
+
_onHttpRequestError(request, error) {
|
|
418
|
+
if (this._request !== request) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
this._setError();
|
|
422
|
+
request.abort();
|
|
423
|
+
this._setReadyState(XMLHttpRequest2.DONE);
|
|
424
|
+
this._dispatchProgress("error");
|
|
425
|
+
return this._dispatchProgress("loadend");
|
|
426
|
+
}
|
|
427
|
+
_dispatchProgress(eventType) {
|
|
428
|
+
var event;
|
|
429
|
+
event = new ProgressEvent(eventType);
|
|
430
|
+
event.lengthComputable = this._lengthComputable;
|
|
431
|
+
event.loaded = this._loadedBytes;
|
|
432
|
+
event.total = this._totalBytes;
|
|
433
|
+
this.dispatchEvent(event);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
_setError() {
|
|
437
|
+
this._request = null;
|
|
438
|
+
this._response = null;
|
|
439
|
+
this._responseHeaders = null;
|
|
440
|
+
this._responseParts = null;
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
_parseUrl(urlString) {
|
|
444
|
+
var absoluteUrlString, index, password, user, xhrUrl;
|
|
445
|
+
if (this.nodejsBaseUrl === null) {
|
|
446
|
+
absoluteUrlString = urlString;
|
|
447
|
+
} else {
|
|
448
|
+
absoluteUrlString = url.resolve(this.nodejsBaseUrl, urlString);
|
|
449
|
+
}
|
|
450
|
+
xhrUrl = url.parse(absoluteUrlString, false, true);
|
|
451
|
+
xhrUrl.hash = null;
|
|
452
|
+
if (xhrUrl.auth && (typeof user !== "undefined" && user !== null || typeof password !== "undefined" && password !== null)) {
|
|
453
|
+
index = xhrUrl.auth.indexOf(":");
|
|
454
|
+
if (index === -1) {
|
|
455
|
+
if (!user) {
|
|
456
|
+
user = xhrUrl.auth;
|
|
457
|
+
}
|
|
458
|
+
} else {
|
|
459
|
+
if (!user) {
|
|
460
|
+
user = xhrUrl.substring(0, index);
|
|
461
|
+
}
|
|
462
|
+
if (!password) {
|
|
463
|
+
password = xhrUrl.substring(index + 1);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
if (user || password) {
|
|
468
|
+
xhrUrl.auth = `${user}:${password}`;
|
|
469
|
+
}
|
|
470
|
+
return xhrUrl;
|
|
471
|
+
}
|
|
472
|
+
_parseResponseHeaders(response) {
|
|
473
|
+
var loweredName, name, ref, value;
|
|
474
|
+
this._responseHeaders = {};
|
|
475
|
+
ref = response.headers;
|
|
476
|
+
for (name in ref) {
|
|
477
|
+
value = ref[name];
|
|
478
|
+
loweredName = name.toLowerCase();
|
|
479
|
+
if (this._privateHeaders[loweredName]) {
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
if (this._mimeOverride !== null && loweredName === "content-type") {
|
|
483
|
+
value = this._mimeOverride;
|
|
484
|
+
}
|
|
485
|
+
this._responseHeaders[loweredName] = value;
|
|
486
|
+
}
|
|
487
|
+
if (this._mimeOverride !== null && !("content-type" in this._responseHeaders)) {
|
|
488
|
+
this._responseHeaders["content-type"] = this._mimeOverride;
|
|
489
|
+
}
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
_parseResponse() {
|
|
493
|
+
var arrayBuffer, buffer, i, j, jsonError, ref, view;
|
|
494
|
+
if (Buffer.concat) {
|
|
495
|
+
buffer = Buffer.concat(this._responseParts);
|
|
496
|
+
} else {
|
|
497
|
+
buffer = this._concatBuffers(this._responseParts);
|
|
498
|
+
}
|
|
499
|
+
this._responseParts = null;
|
|
500
|
+
switch (this.responseType) {
|
|
501
|
+
case "text":
|
|
502
|
+
this._parseTextResponse(buffer);
|
|
503
|
+
break;
|
|
504
|
+
case "json":
|
|
505
|
+
this.responseText = null;
|
|
506
|
+
try {
|
|
507
|
+
this.response = JSON.parse(buffer.toString("utf-8"));
|
|
508
|
+
} catch (error1) {
|
|
509
|
+
jsonError = error1;
|
|
510
|
+
this.response = null;
|
|
511
|
+
}
|
|
512
|
+
break;
|
|
513
|
+
case "buffer":
|
|
514
|
+
this.responseText = null;
|
|
515
|
+
this.response = buffer;
|
|
516
|
+
break;
|
|
517
|
+
case "arraybuffer":
|
|
518
|
+
this.responseText = null;
|
|
519
|
+
arrayBuffer = new ArrayBuffer(buffer.length);
|
|
520
|
+
view = new Uint8Array(arrayBuffer);
|
|
521
|
+
for (i = j = 0, ref = buffer.length;0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
522
|
+
view[i] = buffer[i];
|
|
523
|
+
}
|
|
524
|
+
this.response = arrayBuffer;
|
|
525
|
+
break;
|
|
526
|
+
default:
|
|
527
|
+
this._parseTextResponse(buffer);
|
|
528
|
+
}
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
_parseTextResponse(buffer) {
|
|
532
|
+
var e;
|
|
533
|
+
try {
|
|
534
|
+
this.responseText = buffer.toString(this._parseResponseEncoding());
|
|
535
|
+
} catch (error1) {
|
|
536
|
+
e = error1;
|
|
537
|
+
this.responseText = buffer.toString("binary");
|
|
538
|
+
}
|
|
539
|
+
this.response = this.responseText;
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
_parseResponseEncoding() {
|
|
543
|
+
var contentType, encoding, match;
|
|
544
|
+
encoding = null;
|
|
545
|
+
if (contentType = this._responseHeaders["content-type"]) {
|
|
546
|
+
if (match = /\;\s*charset\=(.*)$/.exec(contentType)) {
|
|
547
|
+
return match[1];
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return "utf-8";
|
|
551
|
+
}
|
|
552
|
+
_concatBuffers(buffers) {
|
|
553
|
+
var buffer, j, k, len, len1, length, target;
|
|
554
|
+
if (buffers.length === 0) {
|
|
555
|
+
return Buffer.alloc(0);
|
|
556
|
+
}
|
|
557
|
+
if (buffers.length === 1) {
|
|
558
|
+
return buffers[0];
|
|
559
|
+
}
|
|
560
|
+
length = 0;
|
|
561
|
+
for (j = 0, len = buffers.length;j < len; j++) {
|
|
562
|
+
buffer = buffers[j];
|
|
563
|
+
length += buffer.length;
|
|
564
|
+
}
|
|
565
|
+
target = Buffer.alloc(length);
|
|
566
|
+
length = 0;
|
|
567
|
+
for (k = 0, len1 = buffers.length;k < len1; k++) {
|
|
568
|
+
buffer = buffers[k];
|
|
569
|
+
buffer.copy(target, length);
|
|
570
|
+
length += buffer.length;
|
|
571
|
+
}
|
|
572
|
+
return target;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
XMLHttpRequest2.prototype.onreadystatechange = null;
|
|
576
|
+
XMLHttpRequest2.prototype.readyState = null;
|
|
577
|
+
XMLHttpRequest2.prototype.response = null;
|
|
578
|
+
XMLHttpRequest2.prototype.responseText = null;
|
|
579
|
+
XMLHttpRequest2.prototype.responseType = null;
|
|
580
|
+
XMLHttpRequest2.prototype.status = null;
|
|
581
|
+
XMLHttpRequest2.prototype.timeout = null;
|
|
582
|
+
XMLHttpRequest2.prototype.upload = null;
|
|
583
|
+
XMLHttpRequest2.prototype.UNSENT = 0;
|
|
584
|
+
XMLHttpRequest2.UNSENT = 0;
|
|
585
|
+
XMLHttpRequest2.prototype.OPENED = 1;
|
|
586
|
+
XMLHttpRequest2.OPENED = 1;
|
|
587
|
+
XMLHttpRequest2.prototype.HEADERS_RECEIVED = 2;
|
|
588
|
+
XMLHttpRequest2.HEADERS_RECEIVED = 2;
|
|
589
|
+
XMLHttpRequest2.prototype.LOADING = 3;
|
|
590
|
+
XMLHttpRequest2.LOADING = 3;
|
|
591
|
+
XMLHttpRequest2.prototype.DONE = 4;
|
|
592
|
+
XMLHttpRequest2.DONE = 4;
|
|
593
|
+
XMLHttpRequest2.prototype.nodejsHttpAgent = http.globalAgent;
|
|
594
|
+
XMLHttpRequest2.prototype.nodejsHttpsAgent = https.globalAgent;
|
|
595
|
+
XMLHttpRequest2.prototype.nodejsBaseUrl = null;
|
|
596
|
+
XMLHttpRequest2.prototype._restrictedMethods = {
|
|
597
|
+
CONNECT: true,
|
|
598
|
+
TRACE: true,
|
|
599
|
+
TRACK: true
|
|
600
|
+
};
|
|
601
|
+
XMLHttpRequest2.prototype._restrictedHeaders = {
|
|
602
|
+
"accept-charset": true,
|
|
603
|
+
"accept-encoding": true,
|
|
604
|
+
"access-control-request-headers": true,
|
|
605
|
+
"access-control-request-method": true,
|
|
606
|
+
connection: true,
|
|
607
|
+
"content-length": true,
|
|
608
|
+
cookie: true,
|
|
609
|
+
cookie2: true,
|
|
610
|
+
date: true,
|
|
611
|
+
dnt: true,
|
|
612
|
+
expect: true,
|
|
613
|
+
host: true,
|
|
614
|
+
"keep-alive": true,
|
|
615
|
+
origin: true,
|
|
616
|
+
referer: true,
|
|
617
|
+
te: true,
|
|
618
|
+
trailer: true,
|
|
619
|
+
"transfer-encoding": true,
|
|
620
|
+
upgrade: true,
|
|
621
|
+
via: true
|
|
622
|
+
};
|
|
623
|
+
XMLHttpRequest2.prototype._privateHeaders = {
|
|
624
|
+
"set-cookie": true,
|
|
625
|
+
"set-cookie2": true
|
|
626
|
+
};
|
|
627
|
+
XMLHttpRequest2.prototype._userAgent = `Mozilla/5.0 (${os.type()} ${os.arch()}) ` + `node.js/${process.versions.node} v8/${process.versions.v8}`;
|
|
628
|
+
return XMLHttpRequest2;
|
|
629
|
+
}.call(this);
|
|
630
|
+
module.exports = XMLHttpRequest;
|
|
631
|
+
XMLHttpRequest.XMLHttpRequest = XMLHttpRequest;
|
|
632
|
+
SecurityError = class SecurityError2 extends Error {
|
|
633
|
+
constructor() {
|
|
634
|
+
super();
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
XMLHttpRequest.SecurityError = SecurityError;
|
|
638
|
+
InvalidStateError = class InvalidStateError2 extends Error {
|
|
639
|
+
constructor() {
|
|
640
|
+
super();
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
InvalidStateError = class InvalidStateError2 extends Error {
|
|
644
|
+
};
|
|
645
|
+
XMLHttpRequest.InvalidStateError = InvalidStateError;
|
|
646
|
+
NetworkError = class NetworkError2 extends Error {
|
|
647
|
+
constructor() {
|
|
648
|
+
super();
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
XMLHttpRequest.SyntaxError = SyntaxError;
|
|
652
|
+
SyntaxError = class SyntaxError2 extends Error {
|
|
653
|
+
constructor() {
|
|
654
|
+
super();
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
ProgressEvent = function() {
|
|
658
|
+
|
|
659
|
+
class ProgressEvent2 {
|
|
660
|
+
constructor(type) {
|
|
661
|
+
this.type = type;
|
|
662
|
+
this.target = null;
|
|
663
|
+
this.currentTarget = null;
|
|
664
|
+
this.lengthComputable = false;
|
|
665
|
+
this.loaded = 0;
|
|
666
|
+
this.total = 0;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
ProgressEvent2.prototype.bubbles = false;
|
|
670
|
+
ProgressEvent2.prototype.cancelable = false;
|
|
671
|
+
ProgressEvent2.prototype.target = null;
|
|
672
|
+
ProgressEvent2.prototype.loaded = null;
|
|
673
|
+
ProgressEvent2.prototype.lengthComputable = null;
|
|
674
|
+
ProgressEvent2.prototype.total = null;
|
|
675
|
+
return ProgressEvent2;
|
|
676
|
+
}.call(this);
|
|
677
|
+
XMLHttpRequest.ProgressEvent = ProgressEvent;
|
|
678
|
+
XMLHttpRequestUpload = class XMLHttpRequestUpload2 extends XMLHttpRequestEventTarget {
|
|
679
|
+
constructor(request) {
|
|
680
|
+
super();
|
|
681
|
+
this._request = request;
|
|
682
|
+
this._reset();
|
|
683
|
+
}
|
|
684
|
+
_reset() {
|
|
685
|
+
this._contentType = null;
|
|
686
|
+
this._body = null;
|
|
687
|
+
return;
|
|
688
|
+
}
|
|
689
|
+
_setData(data) {
|
|
690
|
+
var body, i, j, k, offset, ref, ref1, view;
|
|
691
|
+
if (typeof data === "undefined" || data === null) {
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
if (typeof data === "string") {
|
|
695
|
+
if (data.length !== 0) {
|
|
696
|
+
this._contentType = "text/plain;charset=UTF-8";
|
|
697
|
+
}
|
|
698
|
+
this._body = Buffer.from(data, "utf8");
|
|
699
|
+
} else if (Buffer.isBuffer(data)) {
|
|
700
|
+
this._body = data;
|
|
701
|
+
} else if (data instanceof ArrayBuffer) {
|
|
702
|
+
body = Buffer.alloc(data.byteLength);
|
|
703
|
+
view = new Uint8Array(data);
|
|
704
|
+
for (i = j = 0, ref = data.byteLength;0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
|
|
705
|
+
body[i] = view[i];
|
|
706
|
+
}
|
|
707
|
+
this._body = body;
|
|
708
|
+
} else if (data.buffer && data.buffer instanceof ArrayBuffer) {
|
|
709
|
+
body = Buffer.alloc(data.byteLength);
|
|
710
|
+
offset = data.byteOffset;
|
|
711
|
+
view = new Uint8Array(data.buffer);
|
|
712
|
+
for (i = k = 0, ref1 = data.byteLength;0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) {
|
|
713
|
+
body[i] = view[i + offset];
|
|
714
|
+
}
|
|
715
|
+
this._body = body;
|
|
716
|
+
} else {
|
|
717
|
+
throw new Error(`Unsupported send() data ${data}`);
|
|
718
|
+
}
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
_finalizeHeaders(headers, loweredHeaders) {
|
|
722
|
+
if (this._contentType) {
|
|
723
|
+
if (!("content-type" in loweredHeaders)) {
|
|
724
|
+
headers["Content-Type"] = this._contentType;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
if (this._body) {
|
|
728
|
+
headers["Content-Length"] = this._body.length.toString();
|
|
729
|
+
}
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
_startUpload(request) {
|
|
733
|
+
if (this._body) {
|
|
734
|
+
request.write(this._body);
|
|
735
|
+
}
|
|
736
|
+
request.end();
|
|
737
|
+
return;
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
XMLHttpRequest.XMLHttpRequestUpload = XMLHttpRequestUpload;
|
|
741
|
+
}).call(exports);
|
|
742
|
+
});
|
|
743
|
+
export default require_xhr2();
|