elit 3.6.5 → 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 (154) hide show
  1. package/Cargo.lock +1 -1
  2. package/Cargo.toml +1 -1
  3. package/README.md +6 -0
  4. package/dist/build.cjs +421 -331
  5. package/dist/build.d.ts +1 -16
  6. package/dist/build.js +420 -330
  7. package/dist/build.mjs +420 -330
  8. package/dist/chokidar.cjs +219 -182
  9. package/dist/chokidar.d.ts +25 -10
  10. package/dist/chokidar.js +217 -182
  11. package/dist/chokidar.mjs +218 -183
  12. package/dist/cli.cjs +21608 -20241
  13. package/dist/cli.d.ts +19 -37
  14. package/dist/cli.mjs +21262 -19910
  15. package/dist/config.cjs +357 -350
  16. package/dist/config.d.ts +19 -240
  17. package/dist/config.js +520 -515
  18. package/dist/config.mjs +346 -341
  19. package/dist/contracts-BeW9k0yZ.d.ts +54 -0
  20. package/dist/contracts-D7KIS-TK.d.ts +36 -0
  21. package/dist/coverage.cjs +448 -485
  22. package/dist/coverage.d.ts +13 -59
  23. package/dist/coverage.js +447 -484
  24. package/dist/coverage.mjs +447 -484
  25. package/dist/database.cjs +819 -828
  26. package/dist/database.d.ts +8 -24
  27. package/dist/database.js +818 -829
  28. package/dist/database.mjs +818 -829
  29. package/dist/desktop-auto-render.cjs +1700 -1522
  30. package/dist/desktop-auto-render.d.ts +4 -9
  31. package/dist/desktop-auto-render.js +1695 -1517
  32. package/dist/desktop-auto-render.mjs +1696 -1518
  33. package/dist/desktop.cjs +3 -1
  34. package/dist/desktop.d.ts +4 -1
  35. package/dist/desktop.js +1 -1
  36. package/dist/desktop.mjs +1 -1
  37. package/dist/dev-build.cjs +830 -0
  38. package/dist/dev-build.d.ts +53 -0
  39. package/dist/dev-build.js +3318 -0
  40. package/dist/dev-build.mjs +797 -0
  41. package/dist/dom.cjs +717 -590
  42. package/dist/dom.d.ts +2 -15
  43. package/dist/dom.js +714 -587
  44. package/dist/dom.mjs +716 -589
  45. package/dist/el.cjs +62 -52
  46. package/dist/el.d.ts +5 -10
  47. package/dist/el.js +60 -52
  48. package/dist/el.mjs +60 -52
  49. package/dist/fs.cjs +72 -63
  50. package/dist/fs.d.ts +22 -19
  51. package/dist/fs.js +71 -62
  52. package/dist/fs.mjs +71 -62
  53. package/dist/hmr.cjs +40 -14
  54. package/dist/hmr.d.ts +11 -23
  55. package/dist/hmr.js +38 -14
  56. package/dist/hmr.mjs +38 -14
  57. package/dist/http.cjs +251 -99
  58. package/dist/http.d.ts +38 -104
  59. package/dist/http.js +249 -99
  60. package/dist/http.mjs +249 -99
  61. package/dist/https.cjs +524 -228
  62. package/dist/https.d.ts +44 -36
  63. package/dist/https.js +520 -226
  64. package/dist/https.mjs +522 -228
  65. package/dist/index.cjs +7502 -7690
  66. package/dist/index.d.ts +8 -3
  67. package/dist/index.js +7486 -7676
  68. package/dist/index.mjs +7497 -7686
  69. package/dist/mime-types.cjs +10 -4
  70. package/dist/mime-types.d.ts +8 -11
  71. package/dist/mime-types.js +9 -3
  72. package/dist/mime-types.mjs +9 -3
  73. package/dist/native.cjs +8616 -8869
  74. package/dist/native.d.ts +7 -8
  75. package/dist/native.js +8682 -8935
  76. package/dist/native.mjs +8615 -8868
  77. package/dist/path.cjs +83 -77
  78. package/dist/path.d.ts +29 -29
  79. package/dist/path.js +82 -76
  80. package/dist/path.mjs +82 -76
  81. package/dist/pm.cjs +3300 -0
  82. package/dist/pm.d.ts +256 -0
  83. package/dist/pm.js +5638 -0
  84. package/dist/pm.mjs +3196 -0
  85. package/dist/preview-build.cjs +712 -0
  86. package/dist/preview-build.d.ts +59 -0
  87. package/dist/preview-build.js +3194 -0
  88. package/dist/preview-build.mjs +676 -0
  89. package/dist/render-context.cjs +13 -2
  90. package/dist/render-context.d.ts +9 -31
  91. package/dist/render-context.js +11 -2
  92. package/dist/render-context.mjs +11 -2
  93. package/dist/router.cjs +787 -645
  94. package/dist/router.d.ts +8 -12
  95. package/dist/router.js +786 -644
  96. package/dist/router.mjs +786 -644
  97. package/dist/runtime.cjs +1 -1
  98. package/dist/runtime.js +1 -1
  99. package/dist/runtime.mjs +1 -1
  100. package/dist/server.cjs +3315 -2603
  101. package/dist/server.d.ts +49 -4
  102. package/dist/server.js +7611 -2834
  103. package/dist/server.mjs +3317 -2607
  104. package/dist/smtp-server.cjs +128 -0
  105. package/dist/smtp-server.d.ts +27 -0
  106. package/dist/smtp-server.js +4199 -0
  107. package/dist/smtp-server.mjs +100 -0
  108. package/dist/state-DvEkDehk.d.ts +195 -0
  109. package/dist/state.cjs +768 -658
  110. package/dist/state.d.ts +11 -69
  111. package/dist/state.js +760 -650
  112. package/dist/state.mjs +767 -657
  113. package/dist/style.cjs +1011 -968
  114. package/dist/style.d.ts +13 -127
  115. package/dist/style.js +1009 -970
  116. package/dist/style.mjs +1011 -971
  117. package/dist/test-reporter.cjs +332 -316
  118. package/dist/test-reporter.d.ts +28 -33
  119. package/dist/test-reporter.js +328 -312
  120. package/dist/test-reporter.mjs +328 -312
  121. package/dist/test-runtime.cjs +927 -968
  122. package/dist/test-runtime.d.ts +24 -99
  123. package/dist/test-runtime.js +922 -965
  124. package/dist/test-runtime.mjs +922 -965
  125. package/dist/test.cjs +4428 -4273
  126. package/dist/test.d.ts +2 -8
  127. package/dist/test.js +4307 -4154
  128. package/dist/test.mjs +4419 -4267
  129. package/dist/types-BONVzPtp.d.ts +59 -0
  130. package/dist/types-BR4wMiVx.d.ts +32 -0
  131. package/dist/types-C4gKykuG.d.ts +23 -0
  132. package/dist/types-CIhpN1-K.d.ts +64 -0
  133. package/dist/types-Ckj8md_j.d.ts +84 -0
  134. package/dist/types-CpjQTAkX.d.ts +24 -0
  135. package/dist/types-D0LjrYjS.d.ts +14 -0
  136. package/dist/types-DAisuVr5.d.ts +75 -0
  137. package/dist/types-tJn88E1N.d.ts +242 -0
  138. package/dist/types.d.ts +71 -226
  139. package/dist/universal.cjs +1 -1
  140. package/dist/universal.d.ts +1 -5
  141. package/dist/universal.js +1 -1
  142. package/dist/universal.mjs +1 -1
  143. package/dist/websocket-XfyK23zD.d.ts +119 -0
  144. package/dist/ws.cjs +129 -108
  145. package/dist/ws.d.ts +21 -131
  146. package/dist/ws.js +128 -109
  147. package/dist/ws.mjs +128 -109
  148. package/dist/wss.cjs +757 -479
  149. package/dist/wss.d.ts +31 -28
  150. package/dist/wss.js +755 -479
  151. package/dist/wss.mjs +758 -482
  152. package/package.json +16 -1
  153. package/vendor/epaint-0.31.1/src/image.rs +418 -0
  154. package/dist/server-CcBFc2F5.d.ts +0 -449
package/dist/config.mjs CHANGED
@@ -15,10 +15,10 @@ var __export = (target, all) => {
15
15
  __defProp(target, name, { get: all[name], enumerable: true });
16
16
  };
17
17
 
18
- // src/runtime.ts
18
+ // src/shares/runtime.ts
19
19
  var runtime, isNode, isBun, isDeno;
20
20
  var init_runtime = __esm({
21
- "src/runtime.ts"() {
21
+ "src/shares/runtime.ts"() {
22
22
  "use strict";
23
23
  runtime = (() => {
24
24
  if (typeof Deno !== "undefined") return "deno";
@@ -31,37 +31,20 @@ var init_runtime = __esm({
31
31
  }
32
32
  });
33
33
 
34
- // src/fs.ts
35
- var fs_exports = {};
36
- __export(fs_exports, {
37
- appendFile: () => appendFile,
38
- appendFileSync: () => appendFileSync,
39
- copyFile: () => copyFile,
40
- copyFileSync: () => copyFileSync,
41
- default: () => fs_default,
42
- exists: () => exists,
43
- existsSync: () => existsSync,
44
- getRuntime: () => getRuntime,
45
- mkdir: () => mkdir,
46
- mkdirSync: () => mkdirSync,
47
- promises: () => promises,
48
- readFile: () => readFile,
49
- readFileSync: () => readFileSync,
50
- readdir: () => readdir,
51
- readdirSync: () => readdirSync,
52
- realpath: () => realpath,
53
- realpathSync: () => realpathSync,
54
- rename: () => rename,
55
- renameSync: () => renameSync,
56
- rmdir: () => rmdir,
57
- rmdirSync: () => rmdirSync,
58
- stat: () => stat,
59
- statSync: () => statSync,
60
- unlink: () => unlink,
61
- unlinkSync: () => unlinkSync,
62
- writeFile: () => writeFile,
63
- writeFileSync: () => writeFileSync
34
+ // src/server/fs/node-modules.ts
35
+ var fs, fsPromises;
36
+ var init_node_modules = __esm({
37
+ "src/server/fs/node-modules.ts"() {
38
+ "use strict";
39
+ init_runtime();
40
+ if (isNode || isBun) {
41
+ fs = __require("fs");
42
+ fsPromises = __require("fs/promises");
43
+ }
44
+ }
64
45
  });
46
+
47
+ // src/server/fs/utils.ts
65
48
  function parseOptions(options, defaultValue) {
66
49
  return typeof options === "string" ? { encoding: options } : options || defaultValue;
67
50
  }
@@ -80,6 +63,18 @@ function dataToUint8Array(data) {
80
63
  }
81
64
  return data;
82
65
  }
66
+ function createDirentFromDenoEntry(entry) {
67
+ return {
68
+ name: entry.name,
69
+ isFile: () => entry.isFile,
70
+ isDirectory: () => entry.isDirectory,
71
+ isBlockDevice: () => false,
72
+ isCharacterDevice: () => false,
73
+ isSymbolicLink: () => entry.isSymlink || false,
74
+ isFIFO: () => false,
75
+ isSocket: () => false
76
+ };
77
+ }
83
78
  function processDenoEntries(iterator, withFileTypes) {
84
79
  const entries = [];
85
80
  for (const entry of iterator) {
@@ -102,6 +97,42 @@ async function processDenoEntriesAsync(iterator, withFileTypes) {
102
97
  }
103
98
  return entries;
104
99
  }
100
+ function createStatsFromDenoFileInfo(info) {
101
+ return {
102
+ isFile: () => info.isFile,
103
+ isDirectory: () => info.isDirectory,
104
+ isBlockDevice: () => false,
105
+ isCharacterDevice: () => false,
106
+ isSymbolicLink: () => info.isSymlink || false,
107
+ isFIFO: () => false,
108
+ isSocket: () => false,
109
+ dev: info.dev || 0,
110
+ ino: info.ino || 0,
111
+ mode: info.mode || 0,
112
+ nlink: info.nlink || 1,
113
+ uid: info.uid || 0,
114
+ gid: info.gid || 0,
115
+ rdev: 0,
116
+ size: info.size,
117
+ blksize: info.blksize || 4096,
118
+ blocks: info.blocks || Math.ceil(info.size / 512),
119
+ atimeMs: info.atime?.getTime() || Date.now(),
120
+ mtimeMs: info.mtime?.getTime() || Date.now(),
121
+ ctimeMs: info.birthtime?.getTime() || Date.now(),
122
+ birthtimeMs: info.birthtime?.getTime() || Date.now(),
123
+ atime: info.atime || /* @__PURE__ */ new Date(),
124
+ mtime: info.mtime || /* @__PURE__ */ new Date(),
125
+ ctime: info.birthtime || /* @__PURE__ */ new Date(),
126
+ birthtime: info.birthtime || /* @__PURE__ */ new Date()
127
+ };
128
+ }
129
+ var init_utils = __esm({
130
+ "src/server/fs/utils.ts"() {
131
+ "use strict";
132
+ }
133
+ });
134
+
135
+ // src/server/fs/file-ops.ts
105
136
  async function readFile(path, options) {
106
137
  const opts = parseOptions(options, {});
107
138
  if (isNode || isBun) {
@@ -142,28 +173,27 @@ async function appendFile(path, data, options) {
142
173
  const opts = parseOptions(options, {});
143
174
  if (isNode) {
144
175
  return fsPromises.appendFile(path, data, opts);
176
+ }
177
+ if (await exists(path)) {
178
+ const existing = await readFile(path);
179
+ const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
180
+ await writeFile(path, combined, opts);
145
181
  } else {
146
- if (await exists(path)) {
147
- const existing = await readFile(path);
148
- const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
149
- await writeFile(path, combined, opts);
150
- } else {
151
- await writeFile(path, data, opts);
152
- }
182
+ await writeFile(path, data, opts);
153
183
  }
154
184
  }
155
185
  function appendFileSync(path, data, options) {
156
186
  const opts = parseOptions(options, {});
157
187
  if (isNode) {
158
188
  fs.appendFileSync(path, data, opts);
189
+ return;
190
+ }
191
+ if (existsSync(path)) {
192
+ const existing = readFileSync(path);
193
+ const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
194
+ writeFileSync(path, combined, opts);
159
195
  } else {
160
- if (existsSync(path)) {
161
- const existing = readFileSync(path);
162
- const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
163
- writeFileSync(path, combined, opts);
164
- } else {
165
- writeFileSync(path, data, opts);
166
- }
196
+ writeFileSync(path, data, opts);
167
197
  }
168
198
  }
169
199
  async function exists(path) {
@@ -200,6 +230,16 @@ function statSync(path) {
200
230
  }
201
231
  throw new Error("Unsupported runtime");
202
232
  }
233
+ var init_file_ops = __esm({
234
+ "src/server/fs/file-ops.ts"() {
235
+ "use strict";
236
+ init_runtime();
237
+ init_node_modules();
238
+ init_utils();
239
+ }
240
+ });
241
+
242
+ // src/server/fs/directory-ops.ts
203
243
  async function mkdir(path, options) {
204
244
  const opts = typeof options === "number" ? { mode: options } : options || {};
205
245
  if (isNode || isBun) {
@@ -262,6 +302,16 @@ function rmdirSync(path, options) {
262
302
  Deno.removeSync(path, { recursive: options?.recursive });
263
303
  }
264
304
  }
305
+ var init_directory_ops = __esm({
306
+ "src/server/fs/directory-ops.ts"() {
307
+ "use strict";
308
+ init_runtime();
309
+ init_node_modules();
310
+ init_utils();
311
+ }
312
+ });
313
+
314
+ // src/server/fs/path-ops.ts
265
315
  async function rename(oldPath, newPath) {
266
316
  if (isNode || isBun) {
267
317
  return fsPromises.rename(oldPath, newPath);
@@ -306,59 +356,59 @@ function realpathSync(path, options) {
306
356
  }
307
357
  return path;
308
358
  }
309
- function createStatsFromDenoFileInfo(info) {
310
- return {
311
- isFile: () => info.isFile,
312
- isDirectory: () => info.isDirectory,
313
- isBlockDevice: () => false,
314
- isCharacterDevice: () => false,
315
- isSymbolicLink: () => info.isSymlink || false,
316
- isFIFO: () => false,
317
- isSocket: () => false,
318
- dev: info.dev || 0,
319
- ino: info.ino || 0,
320
- mode: info.mode || 0,
321
- nlink: info.nlink || 1,
322
- uid: info.uid || 0,
323
- gid: info.gid || 0,
324
- rdev: 0,
325
- size: info.size,
326
- blksize: info.blksize || 4096,
327
- blocks: info.blocks || Math.ceil(info.size / 512),
328
- atimeMs: info.atime?.getTime() || Date.now(),
329
- mtimeMs: info.mtime?.getTime() || Date.now(),
330
- ctimeMs: info.birthtime?.getTime() || Date.now(),
331
- birthtimeMs: info.birthtime?.getTime() || Date.now(),
332
- atime: info.atime || /* @__PURE__ */ new Date(),
333
- mtime: info.mtime || /* @__PURE__ */ new Date(),
334
- ctime: info.birthtime || /* @__PURE__ */ new Date(),
335
- birthtime: info.birthtime || /* @__PURE__ */ new Date()
336
- };
337
- }
338
- function createDirentFromDenoEntry(entry) {
339
- return {
340
- name: entry.name,
341
- isFile: () => entry.isFile,
342
- isDirectory: () => entry.isDirectory,
343
- isBlockDevice: () => false,
344
- isCharacterDevice: () => false,
345
- isSymbolicLink: () => entry.isSymlink || false,
346
- isFIFO: () => false,
347
- isSocket: () => false
348
- };
349
- }
359
+ var init_path_ops = __esm({
360
+ "src/server/fs/path-ops.ts"() {
361
+ "use strict";
362
+ init_runtime();
363
+ init_node_modules();
364
+ }
365
+ });
366
+
367
+ // src/server/fs/index.ts
368
+ var fs_exports = {};
369
+ __export(fs_exports, {
370
+ appendFile: () => appendFile,
371
+ appendFileSync: () => appendFileSync,
372
+ copyFile: () => copyFile,
373
+ copyFileSync: () => copyFileSync,
374
+ default: () => fs_default,
375
+ exists: () => exists,
376
+ existsSync: () => existsSync,
377
+ getRuntime: () => getRuntime,
378
+ mkdir: () => mkdir,
379
+ mkdirSync: () => mkdirSync,
380
+ promises: () => promises,
381
+ readFile: () => readFile,
382
+ readFileSync: () => readFileSync,
383
+ readdir: () => readdir,
384
+ readdirSync: () => readdirSync,
385
+ realpath: () => realpath,
386
+ realpathSync: () => realpathSync,
387
+ rename: () => rename,
388
+ renameSync: () => renameSync,
389
+ rmdir: () => rmdir,
390
+ rmdirSync: () => rmdirSync,
391
+ stat: () => stat,
392
+ statSync: () => statSync,
393
+ unlink: () => unlink,
394
+ unlinkSync: () => unlinkSync,
395
+ writeFile: () => writeFile,
396
+ writeFileSync: () => writeFileSync
397
+ });
350
398
  function getRuntime() {
351
399
  return runtime;
352
400
  }
353
- var fs, fsPromises, promises, fs_default;
401
+ var promises, fs_default;
354
402
  var init_fs = __esm({
355
- "src/fs.ts"() {
403
+ "src/server/fs/index.ts"() {
356
404
  "use strict";
357
405
  init_runtime();
358
- if (isNode || isBun) {
359
- fs = __require("fs");
360
- fsPromises = __require("fs/promises");
361
- }
406
+ init_file_ops();
407
+ init_directory_ops();
408
+ init_path_ops();
409
+ init_file_ops();
410
+ init_directory_ops();
411
+ init_path_ops();
362
412
  promises = {
363
413
  readFile,
364
414
  writeFile,
@@ -403,57 +453,47 @@ var init_fs = __esm({
403
453
  }
404
454
  });
405
455
 
406
- // src/path.ts
407
- var path_exports = {};
408
- __export(path_exports, {
409
- basename: () => basename,
410
- default: () => path_default,
411
- delimiter: () => delimiter,
412
- dirname: () => dirname,
413
- extname: () => extname,
414
- format: () => format,
415
- getRuntime: () => getRuntime2,
416
- isAbsolute: () => isAbsolute,
417
- join: () => join,
418
- normalize: () => normalize,
419
- parse: () => parse,
420
- posix: () => posix,
421
- relative: () => relative,
422
- resolve: () => resolve,
423
- sep: () => sep,
424
- toNamespacedPath: () => toNamespacedPath,
425
- win32: () => win32
426
- });
456
+ // src/shares/config/constants.ts
457
+ var ELIT_CONFIG_FILES = [
458
+ "elit.config.ts",
459
+ "elit.config.mts",
460
+ "elit.config.js",
461
+ "elit.config.mjs",
462
+ "elit.config.cjs",
463
+ "elit.config.json"
464
+ ];
465
+
466
+ // src/shares/config/env.ts
467
+ init_fs();
468
+
469
+ // src/server/path/platform.ts
470
+ init_runtime();
427
471
  function getSeparator(isWin) {
428
472
  return isWin ? "\\" : "/";
429
473
  }
430
474
  function getCwd() {
431
475
  if (isNode || isBun) {
432
476
  return process.cwd();
433
- } else if (isDeno) {
477
+ }
478
+ if (isDeno) {
434
479
  return Deno.cwd();
435
480
  }
436
481
  return "/";
437
482
  }
483
+ var isWindows = (() => {
484
+ if (isNode) {
485
+ return process.platform === "win32";
486
+ }
487
+ if (isDeno) {
488
+ return Deno.build.os === "windows";
489
+ }
490
+ return typeof process !== "undefined" && process.platform === "win32";
491
+ })();
492
+
493
+ // src/server/path/operations.ts
438
494
  function findLastSeparator(path) {
439
495
  return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
440
496
  }
441
- function createPathOps(isWin) {
442
- return {
443
- sep: getSeparator(isWin),
444
- delimiter: isWin ? ";" : ":",
445
- normalize: (path) => normalizePath(path, isWin),
446
- join: (...paths) => joinPaths(paths, isWin),
447
- resolve: (...paths) => resolvePaths(paths, isWin),
448
- isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
449
- relative: (from, to) => relativePath(from, to, isWin),
450
- dirname: (path) => getDirname(path, isWin),
451
- basename: (path, ext) => getBasename(path, ext, isWin),
452
- extname: (path) => getExtname(path),
453
- parse: (path) => parsePath(path, isWin),
454
- format: (pathObject) => formatPath(pathObject, isWin)
455
- };
456
- }
457
497
  function isAbsolutePosix(path) {
458
498
  return path.length > 0 && path[0] === "/";
459
499
  }
@@ -477,15 +517,15 @@ function isAbsoluteWin(path) {
477
517
  function normalizePath(path, isWin) {
478
518
  if (path.length === 0) return ".";
479
519
  const separator = getSeparator(isWin);
480
- const isAbsolute2 = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
520
+ const isAbsolute = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
481
521
  const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
482
- let normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
522
+ const normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
483
523
  const parts = normalized.split(separator);
484
524
  const result = [];
485
- for (let i = 0; i < parts.length; i++) {
486
- const part = parts[i];
525
+ for (let index = 0; index < parts.length; index++) {
526
+ const part = parts[index];
487
527
  if (part === "" || part === ".") {
488
- if (i === 0 && isAbsolute2) result.push("");
528
+ if (index === 0 && isAbsolute) result.push("");
489
529
  continue;
490
530
  }
491
531
  if (part === "..") {
@@ -493,28 +533,28 @@ function normalizePath(path, isWin) {
493
533
  if (!(result.length === 1 && result[0] === "")) {
494
534
  result.pop();
495
535
  }
496
- } else if (!isAbsolute2) {
536
+ } else if (!isAbsolute) {
497
537
  result.push("..");
498
538
  }
499
539
  } else {
500
540
  result.push(part);
501
541
  }
502
542
  }
503
- let final = result.join(separator);
504
- if (final.length === 0) {
505
- return isAbsolute2 ? separator : ".";
543
+ let finalPath = result.join(separator);
544
+ if (finalPath.length === 0) {
545
+ return isAbsolute ? separator : ".";
506
546
  }
507
- if (trailingSeparator && final[final.length - 1] !== separator) {
508
- final += separator;
547
+ if (trailingSeparator && finalPath[finalPath.length - 1] !== separator) {
548
+ finalPath += separator;
509
549
  }
510
- return final;
550
+ return finalPath;
511
551
  }
512
552
  function joinPaths(paths, isWin) {
513
553
  if (paths.length === 0) return ".";
514
554
  const separator = getSeparator(isWin);
515
555
  let joined = "";
516
- for (let i = 0; i < paths.length; i++) {
517
- const path = paths[i];
556
+ for (let index = 0; index < paths.length; index++) {
557
+ const path = paths[index];
518
558
  if (path && path.length > 0) {
519
559
  if (joined.length === 0) {
520
560
  joined = path;
@@ -529,43 +569,43 @@ function joinPaths(paths, isWin) {
529
569
  function resolvePaths(paths, isWin) {
530
570
  const separator = getSeparator(isWin);
531
571
  let resolved = "";
532
- let isAbsolute2 = false;
533
- for (let i = paths.length - 1; i >= 0 && !isAbsolute2; i--) {
534
- const path = paths[i];
572
+ let absolute = false;
573
+ for (let index = paths.length - 1; index >= 0 && !absolute; index--) {
574
+ const path = paths[index];
535
575
  if (path && path.length > 0) {
536
576
  resolved = path + (resolved.length > 0 ? separator + resolved : "");
537
- isAbsolute2 = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
577
+ absolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
538
578
  }
539
579
  }
540
- if (!isAbsolute2) {
580
+ if (!absolute) {
541
581
  const cwd = getCwd();
542
582
  resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
543
583
  }
544
584
  return normalizePath(resolved, isWin);
545
585
  }
546
586
  function relativePath(from, to, isWin) {
547
- from = resolvePaths([from], isWin);
548
- to = resolvePaths([to], isWin);
549
- if (from === to) return "";
587
+ const resolvedFrom = resolvePaths([from], isWin);
588
+ const resolvedTo = resolvePaths([to], isWin);
589
+ if (resolvedFrom === resolvedTo) return "";
550
590
  const separator = getSeparator(isWin);
551
- const fromParts = from.split(separator).filter((p) => p.length > 0);
552
- const toParts = to.split(separator).filter((p) => p.length > 0);
553
- let commonLength = 0;
591
+ const fromParts = resolvedFrom.split(separator).filter((part) => part.length > 0);
592
+ const toParts = resolvedTo.split(separator).filter((part) => part.length > 0);
554
593
  const minLength = Math.min(fromParts.length, toParts.length);
555
- for (let i = 0; i < minLength; i++) {
556
- if (fromParts[i] === toParts[i]) {
594
+ let commonLength = 0;
595
+ for (let index = 0; index < minLength; index++) {
596
+ if (fromParts[index] === toParts[index]) {
557
597
  commonLength++;
558
598
  } else {
559
599
  break;
560
600
  }
561
601
  }
562
- const upCount = fromParts.length - commonLength;
563
602
  const result = [];
564
- for (let i = 0; i < upCount; i++) {
603
+ const upCount = fromParts.length - commonLength;
604
+ for (let index = 0; index < upCount; index++) {
565
605
  result.push("..");
566
606
  }
567
- for (let i = commonLength; i < toParts.length; i++) {
568
- result.push(toParts[i]);
607
+ for (let index = commonLength; index < toParts.length; index++) {
608
+ result.push(toParts[index]);
569
609
  }
570
610
  return result.join(separator) || ".";
571
611
  }
@@ -573,15 +613,15 @@ function getDirname(path, isWin) {
573
613
  if (path.length === 0) return ".";
574
614
  const separator = getSeparator(isWin);
575
615
  const normalized = normalizePath(path, isWin);
576
- const lastSepIndex = normalized.lastIndexOf(separator);
577
- if (lastSepIndex === -1) return ".";
578
- if (lastSepIndex === 0) return separator;
579
- return normalized.slice(0, lastSepIndex);
616
+ const lastSeparatorIndex = normalized.lastIndexOf(separator);
617
+ if (lastSeparatorIndex === -1) return ".";
618
+ if (lastSeparatorIndex === 0) return separator;
619
+ return normalized.slice(0, lastSeparatorIndex);
580
620
  }
581
621
  function getBasename(path, ext, isWin) {
582
622
  if (path.length === 0) return "";
583
- const lastSepIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
584
- let base = lastSepIndex === -1 ? path : path.slice(lastSepIndex + 1);
623
+ const lastSeparatorIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
624
+ let base = lastSeparatorIndex === -1 ? path : path.slice(lastSeparatorIndex + 1);
585
625
  if (ext && base.endsWith(ext)) {
586
626
  base = base.slice(0, base.length - ext.length);
587
627
  }
@@ -589,8 +629,8 @@ function getBasename(path, ext, isWin) {
589
629
  }
590
630
  function getExtname(path) {
591
631
  const lastDotIndex = path.lastIndexOf(".");
592
- const lastSepIndex = findLastSeparator(path);
593
- if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path.length - 1) {
632
+ const lastSeparatorIndex = findLastSeparator(path);
633
+ if (lastDotIndex === -1 || lastDotIndex < lastSeparatorIndex || lastDotIndex === path.length - 1) {
594
634
  return "";
595
635
  }
596
636
  return path.slice(lastDotIndex);
@@ -606,10 +646,8 @@ function parsePath(path, isWin) {
606
646
  } else if (path[0] === "\\" || path[0] === "/") {
607
647
  root = "\\";
608
648
  }
609
- } else {
610
- if (path[0] === "/") {
611
- root = "/";
612
- }
649
+ } else if (path[0] === "/") {
650
+ root = "/";
613
651
  }
614
652
  const dir = getDirname(path, isWin);
615
653
  const base = getBasename(path, void 0, isWin);
@@ -625,98 +663,113 @@ function formatPath(pathObject, isWin) {
625
663
  if (dir === pathObject.root) return dir + base;
626
664
  return dir + separator + base;
627
665
  }
628
- function normalize(path) {
629
- return normalizePath(path, isWindows);
666
+ function createPathOps(isWin) {
667
+ return {
668
+ sep: getSeparator(isWin),
669
+ delimiter: isWin ? ";" : ":",
670
+ normalize: (path) => normalizePath(path, isWin),
671
+ join: (...paths) => joinPaths(paths, isWin),
672
+ resolve: (...paths) => resolvePaths(paths, isWin),
673
+ isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
674
+ relative: (from, to) => relativePath(from, to, isWin),
675
+ dirname: (path) => getDirname(path, isWin),
676
+ basename: (path, ext) => getBasename(path, ext, isWin),
677
+ extname: (path) => getExtname(path),
678
+ parse: (path) => parsePath(path, isWin),
679
+ format: (pathObject) => formatPath(pathObject, isWin)
680
+ };
630
681
  }
682
+
683
+ // src/server/path/runtime.ts
684
+ init_runtime();
685
+
686
+ // src/server/path/index.ts
687
+ var posix = createPathOps(false);
688
+ var win32 = createPathOps(true);
631
689
  function join(...paths) {
632
690
  return joinPaths(paths, isWindows);
633
691
  }
634
692
  function resolve(...paths) {
635
693
  return resolvePaths(paths, isWindows);
636
694
  }
637
- function isAbsolute(path) {
638
- return isWindows ? win32.isAbsolute(path) : posix.isAbsolute(path);
639
- }
640
695
  function relative(from, to) {
641
696
  return relativePath(from, to, isWindows);
642
697
  }
643
698
  function dirname(path) {
644
699
  return getDirname(path, isWindows);
645
700
  }
646
- function basename(path, ext) {
647
- return getBasename(path, ext, isWindows);
701
+
702
+ // src/shares/config/utils.ts
703
+ init_fs();
704
+ function readFileAsString(filePath) {
705
+ const contentBuffer = readFileSync(filePath, "utf-8");
706
+ return typeof contentBuffer === "string" ? contentBuffer : contentBuffer.toString("utf-8");
648
707
  }
649
- function extname(path) {
650
- return getExtname(path);
708
+ function removeQuotes(value) {
709
+ const trimmed = value.trim();
710
+ if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
711
+ return trimmed.slice(1, -1);
712
+ }
713
+ return trimmed;
651
714
  }
652
- function parse(path) {
653
- return parsePath(path, isWindows);
715
+ function normalizeRelativeImportPath(fromDirectory, targetPath) {
716
+ const relativePath2 = relative(fromDirectory, targetPath).replace(/\\/g, "/");
717
+ return relativePath2.startsWith(".") ? relativePath2 : `./${relativePath2}`;
654
718
  }
655
- function format(pathObject) {
656
- return formatPath(pathObject, isWindows);
719
+ async function importConfigModule(configPath) {
720
+ const { pathToFileURL } = await import("url");
721
+ const configModule = await import(pathToFileURL(configPath).href);
722
+ return configModule.default || configModule;
657
723
  }
658
- function toNamespacedPath(path) {
659
- if (!isWindows || path.length === 0) return path;
660
- const resolved = resolve(path);
661
- if (resolved.length >= 3) {
662
- if (resolved[0] === "\\") {
663
- if (resolved[1] === "\\" && resolved[2] !== "?") {
664
- return "\\\\?\\UNC\\" + resolved.slice(2);
665
- }
666
- } else if (resolved[1] === ":" && resolved[2] === "\\") {
667
- return "\\\\?\\" + resolved;
668
- }
724
+ async function safeCleanup(filePath) {
725
+ try {
726
+ const { unlinkSync: unlinkSync2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
727
+ unlinkSync2(filePath);
728
+ } catch {
669
729
  }
670
- return path;
671
- }
672
- function getRuntime2() {
673
- return runtime;
674
730
  }
675
- var isWindows, sep, delimiter, posix, win32, path_default;
676
- var init_path = __esm({
677
- "src/path.ts"() {
678
- "use strict";
679
- init_runtime();
680
- isWindows = (() => {
681
- if (isNode) {
682
- return process.platform === "win32";
683
- } else if (isDeno) {
684
- return Deno.build.os === "windows";
731
+
732
+ // src/shares/config/env.ts
733
+ function loadEnv(mode = "development", cwd = process.cwd()) {
734
+ const env = { MODE: mode };
735
+ const envFiles = [
736
+ `.env.${mode}.local`,
737
+ `.env.${mode}`,
738
+ ".env.local",
739
+ ".env"
740
+ ];
741
+ for (const file of envFiles) {
742
+ const filePath = resolve(cwd, file);
743
+ if (existsSync(filePath)) {
744
+ const content = readFileAsString(filePath);
745
+ const lines = content.split("\n");
746
+ for (const line of lines) {
747
+ const trimmed = line.trim();
748
+ if (!trimmed || trimmed.startsWith("#")) {
749
+ continue;
750
+ }
751
+ const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);
752
+ if (match) {
753
+ const [, key, value] = match;
754
+ const cleanValue = removeQuotes(value);
755
+ if (!(key in env)) {
756
+ env[key] = cleanValue;
757
+ }
758
+ }
685
759
  }
686
- return typeof process !== "undefined" && process.platform === "win32";
687
- })();
688
- sep = isWindows ? "\\" : "/";
689
- delimiter = isWindows ? ";" : ":";
690
- posix = createPathOps(false);
691
- win32 = createPathOps(true);
692
- path_default = {
693
- sep,
694
- delimiter,
695
- normalize,
696
- join,
697
- resolve,
698
- isAbsolute,
699
- relative,
700
- dirname,
701
- basename,
702
- extname,
703
- parse,
704
- format,
705
- toNamespacedPath,
706
- posix,
707
- win32,
708
- getRuntime: getRuntime2
709
- };
760
+ }
710
761
  }
711
- });
762
+ return env;
763
+ }
764
+
765
+ // src/shares/config/loader.ts
766
+ init_fs();
712
767
 
713
- // src/config.ts
768
+ // src/shares/workspace-package/roots.ts
714
769
  init_fs();
715
- init_path();
716
770
 
717
- // src/workspace-package.ts
771
+ // src/shares/workspace-package/package-json.ts
718
772
  init_fs();
719
- init_path();
720
773
  function readPackageJson(filePath) {
721
774
  try {
722
775
  const packageJsonBuffer = readFileSync(filePath, "utf-8");
@@ -726,13 +779,14 @@ function readPackageJson(filePath) {
726
779
  return void 0;
727
780
  }
728
781
  }
729
- function findWorkspacePackageRoot(startDir, packageName) {
782
+
783
+ // src/shares/workspace-package/roots.ts
784
+ function findPackageDirectory(startDir, resolveMatch) {
730
785
  let currentDir = resolve(startDir);
731
786
  while (true) {
732
- const packageJsonPath = join(currentDir, "package.json");
733
- const packageJson = existsSync(packageJsonPath) ? readPackageJson(packageJsonPath) : void 0;
734
- if (packageJson?.name === packageName) {
735
- return currentDir;
787
+ const match = resolveMatch(currentDir);
788
+ if (match) {
789
+ return match;
736
790
  }
737
791
  const parentDir = dirname(currentDir);
738
792
  if (parentDir === currentDir) {
@@ -741,20 +795,24 @@ function findWorkspacePackageRoot(startDir, packageName) {
741
795
  currentDir = parentDir;
742
796
  }
743
797
  }
798
+ function findWorkspacePackageRoot(startDir, packageName) {
799
+ return findPackageDirectory(startDir, (currentDir) => {
800
+ const packageJsonPath = join(currentDir, "package.json");
801
+ const packageJson = existsSync(packageJsonPath) ? readPackageJson(packageJsonPath) : void 0;
802
+ return packageJson?.name === packageName ? currentDir : void 0;
803
+ });
804
+ }
744
805
  function findInstalledPackageRoot(startDir, packageName) {
745
- let currentDir = resolve(startDir);
746
- while (true) {
806
+ return findPackageDirectory(startDir, (currentDir) => {
747
807
  const candidate = join(currentDir, "node_modules", ...packageName.split("/"));
748
- if (existsSync(candidate)) {
749
- return candidate;
750
- }
751
- const parentDir = dirname(currentDir);
752
- if (parentDir === currentDir) {
753
- return void 0;
754
- }
755
- currentDir = parentDir;
756
- }
808
+ return existsSync(candidate) ? candidate : void 0;
809
+ });
757
810
  }
811
+
812
+ // src/shares/workspace-package/resolve.ts
813
+ init_fs();
814
+
815
+ // src/shares/workspace-package/candidates.ts
758
816
  function getWorkspacePackageImportCandidates(packageRoot, specifier, options = {}) {
759
817
  const subpath = specifier === "elit" ? "index" : specifier.slice("elit/".length);
760
818
  const builtCandidates = options.preferredBuiltFormat === "cjs" ? [
@@ -772,14 +830,24 @@ function getWorkspacePackageImportCandidates(packageRoot, specifier, options = {
772
830
  ];
773
831
  return options.preferBuilt ? [...builtCandidates, ...sourceCandidates] : [...sourceCandidates, ...builtCandidates];
774
832
  }
833
+
834
+ // src/shares/workspace-package/resolve.ts
835
+ function isWorkspacePackageSpecifier(specifier) {
836
+ return specifier === "elit" || specifier.startsWith("elit/");
837
+ }
775
838
  function resolveWorkspacePackageImport(specifier, startDir, options = {}) {
776
- if (specifier !== "elit" && !specifier.startsWith("elit/")) {
839
+ if (!isWorkspacePackageSpecifier(specifier)) {
777
840
  return void 0;
778
841
  }
779
- const packageRoots = [
780
- findWorkspacePackageRoot(startDir, "elit"),
781
- findInstalledPackageRoot(startDir, "elit")
782
- ].filter((value, index, values) => typeof value === "string" && values.indexOf(value) === index);
842
+ const packageRoots = /* @__PURE__ */ new Set();
843
+ const workspacePackageRoot = findWorkspacePackageRoot(startDir, "elit");
844
+ const installedPackageRoot = findInstalledPackageRoot(startDir, "elit");
845
+ if (workspacePackageRoot) {
846
+ packageRoots.add(workspacePackageRoot);
847
+ }
848
+ if (installedPackageRoot) {
849
+ packageRoots.add(installedPackageRoot);
850
+ }
783
851
  for (const packageRoot of packageRoots) {
784
852
  for (const candidate of getWorkspacePackageImportCandidates(packageRoot, specifier, options)) {
785
853
  if (existsSync(candidate)) {
@@ -790,45 +858,7 @@ function resolveWorkspacePackageImport(specifier, startDir, options = {}) {
790
858
  return void 0;
791
859
  }
792
860
 
793
- // src/config.ts
794
- function readFileAsString(filePath) {
795
- const contentBuffer = readFileSync(filePath, "utf-8");
796
- return typeof contentBuffer === "string" ? contentBuffer : contentBuffer.toString("utf-8");
797
- }
798
- function removeQuotes(value) {
799
- const trimmed = value.trim();
800
- if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
801
- return trimmed.slice(1, -1);
802
- }
803
- return trimmed;
804
- }
805
- function normalizeRelativeImportPath(fromDirectory, targetPath) {
806
- const relativePath2 = relative(fromDirectory, targetPath).replace(/\\/g, "/");
807
- return relativePath2.startsWith(".") ? relativePath2 : `./${relativePath2}`;
808
- }
809
- async function importConfigModule(configPath) {
810
- const { pathToFileURL } = await import("url");
811
- const configModule = await import(pathToFileURL(configPath).href);
812
- return configModule.default || configModule;
813
- }
814
- async function safeCleanup(filePath) {
815
- try {
816
- const { unlinkSync: unlinkSync2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
817
- unlinkSync2(filePath);
818
- } catch {
819
- }
820
- }
821
- function defineConfig(config) {
822
- return config;
823
- }
824
- var ELIT_CONFIG_FILES = [
825
- "elit.config.ts",
826
- "elit.config.mts",
827
- "elit.config.js",
828
- "elit.config.mjs",
829
- "elit.config.cjs",
830
- "elit.config.json"
831
- ];
861
+ // src/shares/config/loader.ts
832
862
  function resolveConfigPath(cwd = process.cwd()) {
833
863
  for (const configFile of ELIT_CONFIG_FILES) {
834
864
  const configPath = resolve(cwd, configFile);
@@ -838,35 +868,6 @@ function resolveConfigPath(cwd = process.cwd()) {
838
868
  }
839
869
  return null;
840
870
  }
841
- function loadEnv(mode = "development", cwd = process.cwd()) {
842
- const env = { MODE: mode };
843
- const envFiles = [
844
- `.env.${mode}.local`,
845
- `.env.${mode}`,
846
- `.env.local`,
847
- `.env`
848
- ];
849
- for (const file of envFiles) {
850
- const filePath = resolve(cwd, file);
851
- if (existsSync(filePath)) {
852
- const content = readFileAsString(filePath);
853
- const lines = content.split("\n");
854
- for (const line of lines) {
855
- const trimmed = line.trim();
856
- if (!trimmed || trimmed.startsWith("#")) continue;
857
- const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);
858
- if (match) {
859
- const [, key, value] = match;
860
- const cleanValue = removeQuotes(value);
861
- if (!(key in env)) {
862
- env[key] = cleanValue;
863
- }
864
- }
865
- }
866
- }
867
- }
868
- return env;
869
- }
870
871
  async function loadConfig(cwd = process.cwd()) {
871
872
  const configPath = resolveConfigPath(cwd);
872
873
  if (configPath) {
@@ -885,16 +886,16 @@ async function loadConfigFile(configPath) {
885
886
  if (ext === "json") {
886
887
  const content = readFileAsString(configPath);
887
888
  return JSON.parse(content);
888
- } else if (ext === "ts" || ext === "mts") {
889
+ }
890
+ if (ext === "ts" || ext === "mts") {
889
891
  try {
890
892
  const { build } = await import("esbuild");
891
- const { join: join2, dirname: dirname2 } = await Promise.resolve().then(() => (init_path(), path_exports));
892
- const configDir = dirname2(configPath);
893
- const tempFile = join2(configDir, `.elit-config-${Date.now()}.mjs`);
893
+ const configDir = dirname(configPath);
894
+ const tempFile = join(configDir, `.elit-config-${Date.now()}.mjs`);
894
895
  const externalAllPlugin = {
895
896
  name: "external-all",
896
- setup(build2) {
897
- build2.onResolve({ filter: /.*/ }, (args) => {
897
+ setup(buildContext) {
898
+ buildContext.onResolve({ filter: /.*/ }, (args) => {
898
899
  const workspacePackageImport = resolveWorkspacePackageImport(args.path, args.resolveDir || configDir, {
899
900
  preferBuilt: true,
900
901
  preferredBuiltFormat: "esm"
@@ -934,7 +935,6 @@ async function loadConfigFile(configPath) {
934
935
  write: true,
935
936
  target: "es2020",
936
937
  plugins: [externalAllPlugin],
937
- // External Node.js built-ins and runtime-specific packages
938
938
  external: [
939
939
  "node:*",
940
940
  "fs",
@@ -949,7 +949,6 @@ async function loadConfigFile(configPath) {
949
949
  "deno",
950
950
  "deno:*"
951
951
  ],
952
- // Use the config directory as the working directory for resolution
953
952
  absWorkingDir: configDir
954
953
  });
955
954
  const config = await importConfigModule(tempFile);
@@ -960,10 +959,11 @@ async function loadConfigFile(configPath) {
960
959
  console.error("You can use a .js, .mjs, or .json config file instead.");
961
960
  throw error;
962
961
  }
963
- } else {
964
- return await importConfigModule(configPath);
965
962
  }
963
+ return await importConfigModule(configPath);
966
964
  }
965
+
966
+ // src/shares/config/merge.ts
967
967
  function mergeConfig(config, cliArgs) {
968
968
  if (!config) {
969
969
  return cliArgs;
@@ -971,10 +971,15 @@ function mergeConfig(config, cliArgs) {
971
971
  return {
972
972
  ...config,
973
973
  ...Object.fromEntries(
974
- Object.entries(cliArgs).filter(([_, v]) => v !== void 0)
974
+ Object.entries(cliArgs).filter(([_, value]) => value !== void 0)
975
975
  )
976
976
  };
977
977
  }
978
+
979
+ // src/shares/config/types.ts
980
+ function defineConfig(config) {
981
+ return config;
982
+ }
978
983
  export {
979
984
  ELIT_CONFIG_FILES,
980
985
  defineConfig,