elit 3.6.6 → 3.6.7

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.
Files changed (153) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/dist/build.cjs +421 -331
  4. package/dist/build.d.ts +1 -19
  5. package/dist/build.js +420 -330
  6. package/dist/build.mjs +420 -330
  7. package/dist/chokidar.cjs +219 -182
  8. package/dist/chokidar.d.ts +25 -10
  9. package/dist/chokidar.js +217 -182
  10. package/dist/chokidar.mjs +218 -183
  11. package/dist/cli.cjs +22439 -21563
  12. package/dist/cli.d.ts +19 -37
  13. package/dist/cli.mjs +24113 -23252
  14. package/dist/config.cjs +357 -350
  15. package/dist/config.d.ts +17 -245
  16. package/dist/config.js +520 -515
  17. package/dist/config.mjs +346 -341
  18. package/dist/contracts-BeW9k0yZ.d.ts +54 -0
  19. package/dist/contracts-D7KIS-TK.d.ts +36 -0
  20. package/dist/coverage.cjs +448 -485
  21. package/dist/coverage.d.ts +13 -62
  22. package/dist/coverage.js +447 -484
  23. package/dist/coverage.mjs +447 -484
  24. package/dist/database.cjs +819 -828
  25. package/dist/database.d.ts +8 -24
  26. package/dist/database.js +818 -829
  27. package/dist/database.mjs +818 -829
  28. package/dist/desktop-auto-render.cjs +1700 -1523
  29. package/dist/desktop-auto-render.d.ts +4 -12
  30. package/dist/desktop-auto-render.js +1695 -1518
  31. package/dist/desktop-auto-render.mjs +1696 -1519
  32. package/dist/desktop.cjs +3 -1
  33. package/dist/desktop.d.ts +4 -1
  34. package/dist/desktop.js +1 -1
  35. package/dist/desktop.mjs +1 -1
  36. package/dist/dev-build.cjs +830 -0
  37. package/dist/dev-build.d.ts +53 -0
  38. package/dist/dev-build.js +3318 -0
  39. package/dist/dev-build.mjs +797 -0
  40. package/dist/dom.cjs +717 -591
  41. package/dist/dom.d.ts +2 -17
  42. package/dist/dom.js +714 -588
  43. package/dist/dom.mjs +716 -590
  44. package/dist/el.cjs +62 -52
  45. package/dist/el.d.ts +5 -12
  46. package/dist/el.js +60 -52
  47. package/dist/el.mjs +60 -52
  48. package/dist/fs.cjs +72 -63
  49. package/dist/fs.d.ts +22 -19
  50. package/dist/fs.js +71 -62
  51. package/dist/fs.mjs +71 -62
  52. package/dist/hmr.cjs +40 -14
  53. package/dist/hmr.d.ts +11 -23
  54. package/dist/hmr.js +38 -14
  55. package/dist/hmr.mjs +38 -14
  56. package/dist/http.cjs +251 -99
  57. package/dist/http.d.ts +38 -104
  58. package/dist/http.js +249 -99
  59. package/dist/http.mjs +249 -99
  60. package/dist/https.cjs +524 -228
  61. package/dist/https.d.ts +44 -36
  62. package/dist/https.js +520 -226
  63. package/dist/https.mjs +522 -228
  64. package/dist/index.cjs +7502 -7691
  65. package/dist/index.d.ts +6 -3
  66. package/dist/index.js +7486 -7677
  67. package/dist/index.mjs +7497 -7687
  68. package/dist/mime-types.cjs +10 -4
  69. package/dist/mime-types.d.ts +8 -11
  70. package/dist/mime-types.js +9 -3
  71. package/dist/mime-types.mjs +9 -3
  72. package/dist/native.cjs +8616 -8870
  73. package/dist/native.d.ts +7 -10
  74. package/dist/native.js +8682 -8936
  75. package/dist/native.mjs +8615 -8869
  76. package/dist/path.cjs +83 -77
  77. package/dist/path.d.ts +29 -29
  78. package/dist/path.js +82 -76
  79. package/dist/path.mjs +82 -76
  80. package/dist/pm.cjs +3300 -0
  81. package/dist/pm.d.ts +256 -0
  82. package/dist/pm.js +5638 -0
  83. package/dist/pm.mjs +3196 -0
  84. package/dist/preview-build.cjs +712 -0
  85. package/dist/preview-build.d.ts +59 -0
  86. package/dist/preview-build.js +3194 -0
  87. package/dist/preview-build.mjs +676 -0
  88. package/dist/render-context.cjs +13 -2
  89. package/dist/render-context.d.ts +9 -34
  90. package/dist/render-context.js +11 -2
  91. package/dist/render-context.mjs +11 -2
  92. package/dist/router.cjs +787 -646
  93. package/dist/router.d.ts +8 -14
  94. package/dist/router.js +786 -645
  95. package/dist/router.mjs +786 -645
  96. package/dist/runtime.cjs +1 -1
  97. package/dist/runtime.js +1 -1
  98. package/dist/runtime.mjs +1 -1
  99. package/dist/server.cjs +3254 -2684
  100. package/dist/server.d.ts +47 -5
  101. package/dist/server.js +3427 -2859
  102. package/dist/server.mjs +3397 -2829
  103. package/dist/smtp-server.cjs +16 -3
  104. package/dist/smtp-server.d.ts +12 -26
  105. package/dist/smtp-server.js +18 -5
  106. package/dist/smtp-server.mjs +16 -3
  107. package/dist/state-DvEkDehk.d.ts +195 -0
  108. package/dist/state.cjs +768 -659
  109. package/dist/state.d.ts +11 -71
  110. package/dist/state.js +760 -651
  111. package/dist/state.mjs +767 -658
  112. package/dist/style.cjs +1011 -968
  113. package/dist/style.d.ts +13 -127
  114. package/dist/style.js +1009 -970
  115. package/dist/style.mjs +1011 -971
  116. package/dist/test-reporter.cjs +332 -316
  117. package/dist/test-reporter.d.ts +28 -33
  118. package/dist/test-reporter.js +328 -312
  119. package/dist/test-reporter.mjs +328 -312
  120. package/dist/test-runtime.cjs +927 -968
  121. package/dist/test-runtime.d.ts +24 -99
  122. package/dist/test-runtime.js +922 -965
  123. package/dist/test-runtime.mjs +922 -965
  124. package/dist/test.cjs +4428 -4273
  125. package/dist/test.d.ts +2 -8
  126. package/dist/test.js +4307 -4154
  127. package/dist/test.mjs +4419 -4267
  128. package/dist/types-BONVzPtp.d.ts +59 -0
  129. package/dist/types-BR4wMiVx.d.ts +32 -0
  130. package/dist/types-C4gKykuG.d.ts +23 -0
  131. package/dist/types-CIhpN1-K.d.ts +64 -0
  132. package/dist/types-Ckj8md_j.d.ts +84 -0
  133. package/dist/types-CpjQTAkX.d.ts +24 -0
  134. package/dist/types-D0LjrYjS.d.ts +14 -0
  135. package/dist/types-DAisuVr5.d.ts +75 -0
  136. package/dist/types-tJn88E1N.d.ts +242 -0
  137. package/dist/types.d.ts +50 -237
  138. package/dist/universal.cjs +1 -1
  139. package/dist/universal.d.ts +1 -7
  140. package/dist/universal.js +1 -1
  141. package/dist/universal.mjs +1 -1
  142. package/dist/websocket-XfyK23zD.d.ts +119 -0
  143. package/dist/ws.cjs +129 -108
  144. package/dist/ws.d.ts +21 -131
  145. package/dist/ws.js +128 -109
  146. package/dist/ws.mjs +128 -109
  147. package/dist/wss.cjs +757 -479
  148. package/dist/wss.d.ts +31 -28
  149. package/dist/wss.js +755 -479
  150. package/dist/wss.mjs +758 -482
  151. package/package.json +8 -1
  152. package/vendor/epaint-0.31.1/src/image.rs +418 -0
  153. package/dist/server-uMQvZAll.d.ts +0 -458
package/dist/http.js CHANGED
@@ -7,23 +7,88 @@
7
7
  throw Error('Dynamic require of "' + x + '" is not supported');
8
8
  });
9
9
 
10
- // src/http.ts
11
- var import_node_events = __require("events");
10
+ // src/server/http/agent.ts
11
+ var Agent = class {
12
+ constructor(options) {
13
+ this.options = options;
14
+ }
15
+ };
12
16
 
13
- // src/runtime.ts
14
- var runtime = (() => {
15
- if (typeof Deno !== "undefined") return "deno";
16
- if (typeof Bun !== "undefined") return "bun";
17
- return "node";
18
- })();
19
- var isNode = runtime === "node";
20
- var isBun = runtime === "bun";
21
- var isDeno = runtime === "deno";
17
+ // src/server/http/client-request.ts
18
+ var import_node_events = __require("events");
22
19
 
23
- // src/http.ts
20
+ // src/server/http/utils.ts
24
21
  function queueCallback(callback) {
25
22
  if (callback) queueMicrotask(callback);
26
23
  }
24
+ function getRequestPath(url) {
25
+ if (!url) return "";
26
+ try {
27
+ const urlObj = new URL(url);
28
+ return urlObj.pathname + urlObj.search;
29
+ } catch {
30
+ return url;
31
+ }
32
+ }
33
+ function headersToRecord(headers) {
34
+ const result = /* @__PURE__ */ Object.create(null);
35
+ headers.forEach((value, key) => {
36
+ result[key] = value;
37
+ });
38
+ return result;
39
+ }
40
+ function headersToRawHeaders(headers) {
41
+ const rawHeaders = [];
42
+ headers.forEach((value, key) => {
43
+ rawHeaders.push(key, value);
44
+ });
45
+ return rawHeaders;
46
+ }
47
+ function normalizeRequestBodyChunk(chunk, encoding = "utf8") {
48
+ if (typeof chunk === "string") {
49
+ if (encoding !== "utf8" && typeof Buffer !== "undefined") {
50
+ return Buffer.from(chunk, encoding);
51
+ }
52
+ return chunk;
53
+ }
54
+ if (chunk instanceof Uint8Array) {
55
+ return chunk;
56
+ }
57
+ if (chunk instanceof ArrayBuffer) {
58
+ return new Uint8Array(chunk);
59
+ }
60
+ if (ArrayBuffer.isView(chunk)) {
61
+ return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
62
+ }
63
+ return new TextEncoder().encode(String(chunk));
64
+ }
65
+ function buildRequestBody(chunks) {
66
+ if (chunks.length === 0) {
67
+ return void 0;
68
+ }
69
+ if (chunks.length === 1) {
70
+ return chunks[0];
71
+ }
72
+ if (chunks.every((chunk) => typeof chunk === "string")) {
73
+ return chunks.join("");
74
+ }
75
+ const encoder = new TextEncoder();
76
+ const bodyParts = chunks.map((chunk) => typeof chunk === "string" ? encoder.encode(chunk) : chunk);
77
+ const totalLength = bodyParts.reduce((sum, part) => sum + part.byteLength, 0);
78
+ const body = new Uint8Array(totalLength);
79
+ let offset = 0;
80
+ for (const part of bodyParts) {
81
+ body.set(part, offset);
82
+ offset += part.byteLength;
83
+ }
84
+ return body;
85
+ }
86
+ function isFetchResponse(value) {
87
+ return typeof value?.status === "number" && typeof value?.statusText === "string" && typeof value?.headers?.forEach === "function";
88
+ }
89
+ function isNodeIncomingMessage(value) {
90
+ return typeof value?.on === "function" && typeof value?.headers === "object" && (typeof value?.httpVersion === "string" || value?.socket !== void 0);
91
+ }
27
92
  function headersToInit(headers) {
28
93
  const result = {};
29
94
  for (const key in headers) {
@@ -48,17 +113,73 @@
48
113
  server.emit("close");
49
114
  if (callback) queueMicrotask(() => callback());
50
115
  }
51
- var http;
52
- var https;
53
- if (isNode && typeof process !== "undefined") {
54
- try {
55
- http = __require("http");
56
- https = __require("https");
57
- } catch (e) {
58
- http = __require("http");
59
- https = __require("https");
116
+
117
+ // src/server/http/client-request.ts
118
+ var ClientRequest = class extends import_node_events.EventEmitter {
119
+ constructor(_url, _options = {}) {
120
+ super();
121
+ this._bodyChunks = [];
122
+ this._ended = false;
60
123
  }
61
- }
124
+ _setNativeRequest(nativeRequest) {
125
+ this._nativeRequest = nativeRequest;
126
+ }
127
+ _setExecutor(executor) {
128
+ this._executor = executor;
129
+ }
130
+ write(chunk, encoding, callback) {
131
+ if (this._ended) {
132
+ throw new Error("Cannot write after end");
133
+ }
134
+ if (typeof encoding === "function") {
135
+ callback = encoding;
136
+ encoding = void 0;
137
+ }
138
+ if (this._nativeRequest) {
139
+ const actualEncoding2 = typeof encoding === "string" ? encoding : void 0;
140
+ return this._nativeRequest.write(chunk, actualEncoding2, callback);
141
+ }
142
+ const actualEncoding = typeof encoding === "string" ? encoding : "utf8";
143
+ this._bodyChunks.push(normalizeRequestBodyChunk(chunk, actualEncoding));
144
+ queueCallback(callback);
145
+ return true;
146
+ }
147
+ end(chunk, encoding, callback) {
148
+ if (typeof chunk === "function") {
149
+ callback = chunk;
150
+ chunk = void 0;
151
+ encoding = void 0;
152
+ } else if (typeof encoding === "function") {
153
+ callback = encoding;
154
+ encoding = void 0;
155
+ }
156
+ if (this._ended) {
157
+ queueCallback(callback);
158
+ return;
159
+ }
160
+ this._ended = true;
161
+ if (this._nativeRequest) {
162
+ const actualEncoding = typeof encoding === "string" ? encoding : void 0;
163
+ if (chunk !== void 0) {
164
+ this._nativeRequest.end(chunk, actualEncoding, callback);
165
+ } else {
166
+ this._nativeRequest.end(callback);
167
+ }
168
+ return;
169
+ }
170
+ if (chunk !== void 0) {
171
+ this._bodyChunks.push(normalizeRequestBodyChunk(chunk, typeof encoding === "string" ? encoding : "utf8"));
172
+ }
173
+ const executor = this._executor;
174
+ const body = buildRequestBody(this._bodyChunks);
175
+ if (executor) {
176
+ Promise.resolve().then(() => executor(body)).catch((error) => this.emit("error", error));
177
+ }
178
+ queueCallback(callback);
179
+ }
180
+ };
181
+
182
+ // src/server/http/constants.ts
62
183
  var METHODS = [
63
184
  "GET",
64
185
  "POST",
@@ -126,13 +247,23 @@
126
247
  510: "Not Extended",
127
248
  511: "Network Authentication Required"
128
249
  };
129
- var IncomingMessage = class extends import_node_events.EventEmitter {
130
- constructor(req) {
250
+
251
+ // src/server/http/incoming-message.ts
252
+ var import_node_events2 = __require("events");
253
+ var IncomingMessage = class extends import_node_events2.EventEmitter {
254
+ constructor(req, requestMethod) {
131
255
  super();
132
256
  this.httpVersion = "1.1";
133
257
  this.rawHeaders = [];
134
258
  this._req = req;
135
- if (isNode) {
259
+ if (isFetchResponse(req)) {
260
+ this.method = requestMethod || "GET";
261
+ this.url = getRequestPath(req.url);
262
+ this.headers = headersToRecord(req.headers);
263
+ this.statusCode = req.status;
264
+ this.statusMessage = req.statusText;
265
+ this.rawHeaders = headersToRawHeaders(req.headers);
266
+ } else if (isNodeIncomingMessage(req)) {
136
267
  this.method = req.method;
137
268
  this.url = req.url;
138
269
  this.headers = req.headers;
@@ -143,14 +274,13 @@
143
274
  this.socket = req.socket;
144
275
  } else {
145
276
  this.method = req.method;
146
- const urlObj = new URL(req.url);
147
- this.url = urlObj.pathname + urlObj.search;
148
- this.headers = req.headers;
149
- this.rawHeaders = [];
277
+ this.url = getRequestPath(req.url);
278
+ this.headers = headersToRecord(req.headers);
279
+ this.rawHeaders = headersToRawHeaders(req.headers);
150
280
  }
151
281
  }
152
282
  async text() {
153
- if (isNode) {
283
+ if (isNodeIncomingMessage(this._req)) {
154
284
  return new Promise((resolve, reject) => {
155
285
  const chunks = [];
156
286
  this._req.on("data", (chunk) => chunks.push(chunk));
@@ -161,14 +291,80 @@
161
291
  return this._req.text();
162
292
  }
163
293
  async json() {
164
- if (isNode) {
294
+ if (isNodeIncomingMessage(this._req)) {
165
295
  const text = await this.text();
166
296
  return JSON.parse(text);
167
297
  }
168
298
  return this._req.json();
169
299
  }
170
300
  };
171
- var ServerResponse = class extends import_node_events.EventEmitter {
301
+
302
+ // src/shares/runtime.ts
303
+ var runtime = (() => {
304
+ if (typeof Deno !== "undefined") return "deno";
305
+ if (typeof Bun !== "undefined") return "bun";
306
+ return "node";
307
+ })();
308
+ var isNode = runtime === "node";
309
+ var isBun = runtime === "bun";
310
+ var isDeno = runtime === "deno";
311
+
312
+ // src/server/http/node-modules.ts
313
+ var http;
314
+ var https;
315
+ if (isNode && typeof process !== "undefined") {
316
+ try {
317
+ http = __require("http");
318
+ https = __require("https");
319
+ } catch {
320
+ http = __require("http");
321
+ https = __require("https");
322
+ }
323
+ }
324
+
325
+ // src/server/http/request-api.ts
326
+ function request(url, options, callback) {
327
+ const urlString = typeof url === "string" ? url : url.toString();
328
+ const req = new ClientRequest(urlString, options);
329
+ if (isNode) {
330
+ const urlObj = new URL(urlString);
331
+ const client = urlObj.protocol === "https:" ? https : http;
332
+ const nodeReq = client.request(urlString, {
333
+ method: options?.method || "GET",
334
+ headers: options?.headers,
335
+ timeout: options?.timeout,
336
+ signal: options?.signal
337
+ }, (res) => {
338
+ const incomingMessage = new IncomingMessage(res);
339
+ if (callback) callback(incomingMessage);
340
+ req.emit("response", incomingMessage);
341
+ });
342
+ req._setNativeRequest(nodeReq);
343
+ nodeReq.on("error", (error) => req.emit("error", error));
344
+ } else {
345
+ req._setExecutor(async (body) => {
346
+ const response = await fetch(urlString, {
347
+ method: options?.method || "GET",
348
+ headers: options?.headers,
349
+ body,
350
+ signal: options?.signal
351
+ });
352
+ const incomingMessage = new IncomingMessage(response, options?.method || "GET");
353
+ if (callback) callback(incomingMessage);
354
+ req.emit("response", incomingMessage);
355
+ });
356
+ }
357
+ return req;
358
+ }
359
+ function get(url, options, callback) {
360
+ const req = request(url, { ...options, method: "GET" }, callback);
361
+ req.end();
362
+ return req;
363
+ }
364
+
365
+ // src/server/http/response.ts
366
+ var import_node_events3 = __require("events");
367
+ var ServerResponse = class extends import_node_events3.EventEmitter {
172
368
  constructor(_req, nodeRes) {
173
369
  super();
174
370
  this.statusCode = 200;
@@ -301,7 +497,6 @@
301
497
  _setResolver(resolve) {
302
498
  this._resolve = resolve;
303
499
  }
304
- // Express.js-like methods
305
500
  json(data, statusCode = 200) {
306
501
  if (!this.headersSent) {
307
502
  this.setHeader("Content-Type", "application/json");
@@ -325,7 +520,15 @@
325
520
  return this;
326
521
  }
327
522
  };
328
- var Server = class extends import_node_events.EventEmitter {
523
+
524
+ // src/server/http/runtime.ts
525
+ function getRuntime() {
526
+ return runtime;
527
+ }
528
+
529
+ // src/server/http/server-runtime.ts
530
+ var import_node_events4 = __require("events");
531
+ var Server = class extends import_node_events4.EventEmitter {
329
532
  constructor(requestListener) {
330
533
  super();
331
534
  this._bunWebSocketServers = /* @__PURE__ */ new Set();
@@ -400,6 +603,8 @@
400
603
  const urlObj = new URL(req.url);
401
604
  const pathname = urlObj.pathname;
402
605
  const requestUrl = urlObj.pathname + urlObj.search;
606
+ const incomingHeaders = headersToRecord(req.headers);
607
+ const rawHeaders = headersToRawHeaders(req.headers);
403
608
  const upgradeHeader = req.headers.get("upgrade");
404
609
  if (upgradeHeader && upgradeHeader.toLowerCase() === "websocket") {
405
610
  const matchingWebSocketServer = Array.from(this._bunWebSocketServers).find((wsServer) => {
@@ -436,9 +641,9 @@
436
641
  const incomingMessage = {
437
642
  method: req.method,
438
643
  url: requestUrl,
439
- headers: req.headers,
644
+ headers: incomingHeaders,
440
645
  httpVersion: "1.1",
441
- rawHeaders: [],
646
+ rawHeaders,
442
647
  _req: req,
443
648
  text: () => req.text(),
444
649
  json: () => req.json()
@@ -497,6 +702,8 @@
497
702
  };
498
703
  if (self.requestListener) {
499
704
  self.requestListener(incomingMessage, serverResponse);
705
+ } else {
706
+ self.emit("request", incomingMessage, serverResponse);
500
707
  }
501
708
  if (responseReady) {
502
709
  return new Response(body, {
@@ -571,9 +778,11 @@
571
778
  return createAddress(0, addr, "unix");
572
779
  }
573
780
  return addr;
574
- } else if (isBun) {
781
+ }
782
+ if (isBun) {
575
783
  return createAddress(this.nativeServer.port, this.nativeServer.hostname);
576
- } else if (isDeno) {
784
+ }
785
+ if (isDeno) {
577
786
  const addr = this.nativeServer.addr;
578
787
  return createAddress(addr.port, addr.hostname);
579
788
  }
@@ -583,70 +792,11 @@
583
792
  return this._listening;
584
793
  }
585
794
  };
586
- var ClientRequest = class extends import_node_events.EventEmitter {
587
- constructor(_url, _options = {}) {
588
- super();
589
- }
590
- write(_chunk) {
591
- return true;
592
- }
593
- end(callback) {
594
- queueCallback(callback);
595
- }
596
- };
597
- var Agent = class {
598
- constructor(options) {
599
- this.options = options;
600
- }
601
- };
602
795
  function createServer(optionsOrListener, requestListener) {
603
796
  return new Server(typeof optionsOrListener === "function" ? optionsOrListener : requestListener);
604
797
  }
605
- function request(url, options, callback) {
606
- const urlString = typeof url === "string" ? url : url.toString();
607
- const req = new ClientRequest(urlString, options);
608
- if (isNode) {
609
- const urlObj = new URL(urlString);
610
- const client = urlObj.protocol === "https:" ? https : http;
611
- const nodeReq = client.request(urlString, {
612
- method: options?.method || "GET",
613
- headers: options?.headers,
614
- timeout: options?.timeout,
615
- signal: options?.signal
616
- }, (res) => {
617
- const incomingMessage = new IncomingMessage(res);
618
- if (callback) callback(incomingMessage);
619
- req.emit("response", incomingMessage);
620
- });
621
- nodeReq.on("error", (error) => req.emit("error", error));
622
- nodeReq.end();
623
- } else {
624
- queueMicrotask(async () => {
625
- try {
626
- const response = await fetch(urlString, {
627
- method: options?.method || "GET",
628
- headers: options?.headers,
629
- signal: options?.signal
630
- });
631
- const fetchRequest = new Request(urlString);
632
- const incomingMessage = new IncomingMessage(fetchRequest);
633
- incomingMessage.statusCode = response.status;
634
- incomingMessage.statusMessage = response.statusText;
635
- if (callback) callback(incomingMessage);
636
- req.emit("response", incomingMessage);
637
- } catch (error) {
638
- req.emit("error", error);
639
- }
640
- });
641
- }
642
- return req;
643
- }
644
- function get(url, options, callback) {
645
- return request(url, { ...options, method: "GET" }, callback);
646
- }
647
- function getRuntime() {
648
- return runtime;
649
- }
798
+
799
+ // src/server/http/index.ts
650
800
  var http_default = {
651
801
  createServer,
652
802
  request,