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.js CHANGED
@@ -39,10 +39,10 @@
39
39
  mod
40
40
  ));
41
41
 
42
- // src/runtime.ts
42
+ // src/shares/runtime.ts
43
43
  var runtime, isNode, isBun, isDeno;
44
44
  var init_runtime = __esm({
45
- "src/runtime.ts"() {
45
+ "src/shares/runtime.ts"() {
46
46
  "use strict";
47
47
  runtime = (() => {
48
48
  if (typeof Deno !== "undefined") return "deno";
@@ -55,37 +55,20 @@
55
55
  }
56
56
  });
57
57
 
58
- // src/fs.ts
59
- var fs_exports = {};
60
- __export(fs_exports, {
61
- appendFile: () => appendFile,
62
- appendFileSync: () => appendFileSync,
63
- copyFile: () => copyFile,
64
- copyFileSync: () => copyFileSync,
65
- default: () => fs_default,
66
- exists: () => exists,
67
- existsSync: () => existsSync,
68
- getRuntime: () => getRuntime,
69
- mkdir: () => mkdir,
70
- mkdirSync: () => mkdirSync,
71
- promises: () => promises,
72
- readFile: () => readFile,
73
- readFileSync: () => readFileSync,
74
- readdir: () => readdir,
75
- readdirSync: () => readdirSync,
76
- realpath: () => realpath,
77
- realpathSync: () => realpathSync,
78
- rename: () => rename,
79
- renameSync: () => renameSync,
80
- rmdir: () => rmdir,
81
- rmdirSync: () => rmdirSync,
82
- stat: () => stat,
83
- statSync: () => statSync,
84
- unlink: () => unlink,
85
- unlinkSync: () => unlinkSync,
86
- writeFile: () => writeFile,
87
- writeFileSync: () => writeFileSync
58
+ // src/server/fs/node-modules.ts
59
+ var fs, fsPromises;
60
+ var init_node_modules = __esm({
61
+ "src/server/fs/node-modules.ts"() {
62
+ "use strict";
63
+ init_runtime();
64
+ if (isNode || isBun) {
65
+ fs = __require("fs");
66
+ fsPromises = __require("fs/promises");
67
+ }
68
+ }
88
69
  });
70
+
71
+ // src/server/fs/utils.ts
89
72
  function parseOptions(options, defaultValue) {
90
73
  return typeof options === "string" ? { encoding: options } : options || defaultValue;
91
74
  }
@@ -104,6 +87,18 @@
104
87
  }
105
88
  return data;
106
89
  }
90
+ function createDirentFromDenoEntry(entry) {
91
+ return {
92
+ name: entry.name,
93
+ isFile: () => entry.isFile,
94
+ isDirectory: () => entry.isDirectory,
95
+ isBlockDevice: () => false,
96
+ isCharacterDevice: () => false,
97
+ isSymbolicLink: () => entry.isSymlink || false,
98
+ isFIFO: () => false,
99
+ isSocket: () => false
100
+ };
101
+ }
107
102
  function processDenoEntries(iterator, withFileTypes) {
108
103
  const entries = [];
109
104
  for (const entry of iterator) {
@@ -126,6 +121,42 @@
126
121
  }
127
122
  return entries;
128
123
  }
124
+ function createStatsFromDenoFileInfo(info) {
125
+ return {
126
+ isFile: () => info.isFile,
127
+ isDirectory: () => info.isDirectory,
128
+ isBlockDevice: () => false,
129
+ isCharacterDevice: () => false,
130
+ isSymbolicLink: () => info.isSymlink || false,
131
+ isFIFO: () => false,
132
+ isSocket: () => false,
133
+ dev: info.dev || 0,
134
+ ino: info.ino || 0,
135
+ mode: info.mode || 0,
136
+ nlink: info.nlink || 1,
137
+ uid: info.uid || 0,
138
+ gid: info.gid || 0,
139
+ rdev: 0,
140
+ size: info.size,
141
+ blksize: info.blksize || 4096,
142
+ blocks: info.blocks || Math.ceil(info.size / 512),
143
+ atimeMs: info.atime?.getTime() || Date.now(),
144
+ mtimeMs: info.mtime?.getTime() || Date.now(),
145
+ ctimeMs: info.birthtime?.getTime() || Date.now(),
146
+ birthtimeMs: info.birthtime?.getTime() || Date.now(),
147
+ atime: info.atime || /* @__PURE__ */ new Date(),
148
+ mtime: info.mtime || /* @__PURE__ */ new Date(),
149
+ ctime: info.birthtime || /* @__PURE__ */ new Date(),
150
+ birthtime: info.birthtime || /* @__PURE__ */ new Date()
151
+ };
152
+ }
153
+ var init_utils = __esm({
154
+ "src/server/fs/utils.ts"() {
155
+ "use strict";
156
+ }
157
+ });
158
+
159
+ // src/server/fs/file-ops.ts
129
160
  async function readFile(path, options) {
130
161
  const opts = parseOptions(options, {});
131
162
  if (isNode || isBun) {
@@ -166,28 +197,27 @@
166
197
  const opts = parseOptions(options, {});
167
198
  if (isNode) {
168
199
  return fsPromises.appendFile(path, data, opts);
200
+ }
201
+ if (await exists(path)) {
202
+ const existing = await readFile(path);
203
+ const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
204
+ await writeFile(path, combined, opts);
169
205
  } else {
170
- if (await exists(path)) {
171
- const existing = await readFile(path);
172
- const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
173
- await writeFile(path, combined, opts);
174
- } else {
175
- await writeFile(path, data, opts);
176
- }
206
+ await writeFile(path, data, opts);
177
207
  }
178
208
  }
179
209
  function appendFileSync(path, data, options) {
180
210
  const opts = parseOptions(options, {});
181
211
  if (isNode) {
182
212
  fs.appendFileSync(path, data, opts);
213
+ return;
214
+ }
215
+ if (existsSync(path)) {
216
+ const existing = readFileSync(path);
217
+ const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
218
+ writeFileSync(path, combined, opts);
183
219
  } else {
184
- if (existsSync(path)) {
185
- const existing = readFileSync(path);
186
- const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
187
- writeFileSync(path, combined, opts);
188
- } else {
189
- writeFileSync(path, data, opts);
190
- }
220
+ writeFileSync(path, data, opts);
191
221
  }
192
222
  }
193
223
  async function exists(path) {
@@ -224,6 +254,16 @@
224
254
  }
225
255
  throw new Error("Unsupported runtime");
226
256
  }
257
+ var init_file_ops = __esm({
258
+ "src/server/fs/file-ops.ts"() {
259
+ "use strict";
260
+ init_runtime();
261
+ init_node_modules();
262
+ init_utils();
263
+ }
264
+ });
265
+
266
+ // src/server/fs/directory-ops.ts
227
267
  async function mkdir(path, options) {
228
268
  const opts = typeof options === "number" ? { mode: options } : options || {};
229
269
  if (isNode || isBun) {
@@ -286,6 +326,16 @@
286
326
  Deno.removeSync(path, { recursive: options?.recursive });
287
327
  }
288
328
  }
329
+ var init_directory_ops = __esm({
330
+ "src/server/fs/directory-ops.ts"() {
331
+ "use strict";
332
+ init_runtime();
333
+ init_node_modules();
334
+ init_utils();
335
+ }
336
+ });
337
+
338
+ // src/server/fs/path-ops.ts
289
339
  async function rename(oldPath, newPath) {
290
340
  if (isNode || isBun) {
291
341
  return fsPromises.rename(oldPath, newPath);
@@ -330,59 +380,59 @@
330
380
  }
331
381
  return path;
332
382
  }
333
- function createStatsFromDenoFileInfo(info) {
334
- return {
335
- isFile: () => info.isFile,
336
- isDirectory: () => info.isDirectory,
337
- isBlockDevice: () => false,
338
- isCharacterDevice: () => false,
339
- isSymbolicLink: () => info.isSymlink || false,
340
- isFIFO: () => false,
341
- isSocket: () => false,
342
- dev: info.dev || 0,
343
- ino: info.ino || 0,
344
- mode: info.mode || 0,
345
- nlink: info.nlink || 1,
346
- uid: info.uid || 0,
347
- gid: info.gid || 0,
348
- rdev: 0,
349
- size: info.size,
350
- blksize: info.blksize || 4096,
351
- blocks: info.blocks || Math.ceil(info.size / 512),
352
- atimeMs: info.atime?.getTime() || Date.now(),
353
- mtimeMs: info.mtime?.getTime() || Date.now(),
354
- ctimeMs: info.birthtime?.getTime() || Date.now(),
355
- birthtimeMs: info.birthtime?.getTime() || Date.now(),
356
- atime: info.atime || /* @__PURE__ */ new Date(),
357
- mtime: info.mtime || /* @__PURE__ */ new Date(),
358
- ctime: info.birthtime || /* @__PURE__ */ new Date(),
359
- birthtime: info.birthtime || /* @__PURE__ */ new Date()
360
- };
361
- }
362
- function createDirentFromDenoEntry(entry) {
363
- return {
364
- name: entry.name,
365
- isFile: () => entry.isFile,
366
- isDirectory: () => entry.isDirectory,
367
- isBlockDevice: () => false,
368
- isCharacterDevice: () => false,
369
- isSymbolicLink: () => entry.isSymlink || false,
370
- isFIFO: () => false,
371
- isSocket: () => false
372
- };
373
- }
383
+ var init_path_ops = __esm({
384
+ "src/server/fs/path-ops.ts"() {
385
+ "use strict";
386
+ init_runtime();
387
+ init_node_modules();
388
+ }
389
+ });
390
+
391
+ // src/server/fs/index.ts
392
+ var fs_exports = {};
393
+ __export(fs_exports, {
394
+ appendFile: () => appendFile,
395
+ appendFileSync: () => appendFileSync,
396
+ copyFile: () => copyFile,
397
+ copyFileSync: () => copyFileSync,
398
+ default: () => fs_default,
399
+ exists: () => exists,
400
+ existsSync: () => existsSync,
401
+ getRuntime: () => getRuntime,
402
+ mkdir: () => mkdir,
403
+ mkdirSync: () => mkdirSync,
404
+ promises: () => promises,
405
+ readFile: () => readFile,
406
+ readFileSync: () => readFileSync,
407
+ readdir: () => readdir,
408
+ readdirSync: () => readdirSync,
409
+ realpath: () => realpath,
410
+ realpathSync: () => realpathSync,
411
+ rename: () => rename,
412
+ renameSync: () => renameSync,
413
+ rmdir: () => rmdir,
414
+ rmdirSync: () => rmdirSync,
415
+ stat: () => stat,
416
+ statSync: () => statSync,
417
+ unlink: () => unlink,
418
+ unlinkSync: () => unlinkSync,
419
+ writeFile: () => writeFile,
420
+ writeFileSync: () => writeFileSync
421
+ });
374
422
  function getRuntime() {
375
423
  return runtime;
376
424
  }
377
- var fs, fsPromises, promises, fs_default;
425
+ var promises, fs_default;
378
426
  var init_fs = __esm({
379
- "src/fs.ts"() {
427
+ "src/server/fs/index.ts"() {
380
428
  "use strict";
381
429
  init_runtime();
382
- if (isNode || isBun) {
383
- fs = __require("fs");
384
- fsPromises = __require("fs/promises");
385
- }
430
+ init_file_ops();
431
+ init_directory_ops();
432
+ init_path_ops();
433
+ init_file_ops();
434
+ init_directory_ops();
435
+ init_path_ops();
386
436
  promises = {
387
437
  readFile,
388
438
  writeFile,
@@ -427,330 +477,23 @@
427
477
  }
428
478
  });
429
479
 
430
- // src/path.ts
431
- var path_exports = {};
432
- __export(path_exports, {
433
- basename: () => basename,
434
- default: () => path_default,
435
- delimiter: () => delimiter,
436
- dirname: () => dirname,
437
- extname: () => extname,
438
- format: () => format,
439
- getRuntime: () => getRuntime2,
440
- isAbsolute: () => isAbsolute,
441
- join: () => join,
442
- normalize: () => normalize,
443
- parse: () => parse,
444
- posix: () => posix,
445
- relative: () => relative,
446
- resolve: () => resolve,
447
- sep: () => sep,
448
- toNamespacedPath: () => toNamespacedPath,
449
- win32: () => win32
450
- });
451
- function getSeparator(isWin) {
452
- return isWin ? "\\" : "/";
453
- }
454
- function getCwd() {
455
- if (isNode || isBun) {
456
- return process.cwd();
457
- } else if (isDeno) {
458
- return Deno.cwd();
459
- }
460
- return "/";
461
- }
462
- function findLastSeparator(path) {
463
- return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
464
- }
465
- function createPathOps(isWin) {
466
- return {
467
- sep: getSeparator(isWin),
468
- delimiter: isWin ? ";" : ":",
469
- normalize: (path) => normalizePath(path, isWin),
470
- join: (...paths) => joinPaths(paths, isWin),
471
- resolve: (...paths) => resolvePaths(paths, isWin),
472
- isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
473
- relative: (from, to) => relativePath(from, to, isWin),
474
- dirname: (path) => getDirname(path, isWin),
475
- basename: (path, ext) => getBasename(path, ext, isWin),
476
- extname: (path) => getExtname(path),
477
- parse: (path) => parsePath(path, isWin),
478
- format: (pathObject) => formatPath(pathObject, isWin)
479
- };
480
- }
481
- function isAbsolutePosix(path) {
482
- return path.length > 0 && path[0] === "/";
483
- }
484
- function isAbsoluteWin(path) {
485
- const len = path.length;
486
- if (len === 0) return false;
487
- const code = path.charCodeAt(0);
488
- if (code === 47 || code === 92) {
489
- return true;
490
- }
491
- if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
492
- if (len > 2 && path.charCodeAt(1) === 58) {
493
- const code2 = path.charCodeAt(2);
494
- if (code2 === 47 || code2 === 92) {
495
- return true;
496
- }
497
- }
498
- }
499
- return false;
500
- }
501
- function normalizePath(path, isWin) {
502
- if (path.length === 0) return ".";
503
- const separator = getSeparator(isWin);
504
- const isAbsolute2 = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
505
- const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
506
- let normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
507
- const parts = normalized.split(separator);
508
- const result = [];
509
- for (let i = 0; i < parts.length; i++) {
510
- const part = parts[i];
511
- if (part === "" || part === ".") {
512
- if (i === 0 && isAbsolute2) result.push("");
513
- continue;
514
- }
515
- if (part === "..") {
516
- if (result.length > 0 && result[result.length - 1] !== "..") {
517
- if (!(result.length === 1 && result[0] === "")) {
518
- result.pop();
519
- }
520
- } else if (!isAbsolute2) {
521
- result.push("..");
522
- }
523
- } else {
524
- result.push(part);
525
- }
526
- }
527
- let final = result.join(separator);
528
- if (final.length === 0) {
529
- return isAbsolute2 ? separator : ".";
530
- }
531
- if (trailingSeparator && final[final.length - 1] !== separator) {
532
- final += separator;
533
- }
534
- return final;
535
- }
536
- function joinPaths(paths, isWin) {
537
- if (paths.length === 0) return ".";
538
- const separator = getSeparator(isWin);
539
- let joined = "";
540
- for (let i = 0; i < paths.length; i++) {
541
- const path = paths[i];
542
- if (path && path.length > 0) {
543
- if (joined.length === 0) {
544
- joined = path;
545
- } else {
546
- joined += separator + path;
547
- }
548
- }
549
- }
550
- if (joined.length === 0) return ".";
551
- return normalizePath(joined, isWin);
552
- }
553
- function resolvePaths(paths, isWin) {
554
- const separator = getSeparator(isWin);
555
- let resolved = "";
556
- let isAbsolute2 = false;
557
- for (let i = paths.length - 1; i >= 0 && !isAbsolute2; i--) {
558
- const path = paths[i];
559
- if (path && path.length > 0) {
560
- resolved = path + (resolved.length > 0 ? separator + resolved : "");
561
- isAbsolute2 = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
562
- }
563
- }
564
- if (!isAbsolute2) {
565
- const cwd = getCwd();
566
- resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
567
- }
568
- return normalizePath(resolved, isWin);
569
- }
570
- function relativePath(from, to, isWin) {
571
- from = resolvePaths([from], isWin);
572
- to = resolvePaths([to], isWin);
573
- if (from === to) return "";
574
- const separator = getSeparator(isWin);
575
- const fromParts = from.split(separator).filter((p) => p.length > 0);
576
- const toParts = to.split(separator).filter((p) => p.length > 0);
577
- let commonLength = 0;
578
- const minLength = Math.min(fromParts.length, toParts.length);
579
- for (let i = 0; i < minLength; i++) {
580
- if (fromParts[i] === toParts[i]) {
581
- commonLength++;
582
- } else {
583
- break;
584
- }
585
- }
586
- const upCount = fromParts.length - commonLength;
587
- const result = [];
588
- for (let i = 0; i < upCount; i++) {
589
- result.push("..");
590
- }
591
- for (let i = commonLength; i < toParts.length; i++) {
592
- result.push(toParts[i]);
593
- }
594
- return result.join(separator) || ".";
595
- }
596
- function getDirname(path, isWin) {
597
- if (path.length === 0) return ".";
598
- const separator = getSeparator(isWin);
599
- const normalized = normalizePath(path, isWin);
600
- const lastSepIndex = normalized.lastIndexOf(separator);
601
- if (lastSepIndex === -1) return ".";
602
- if (lastSepIndex === 0) return separator;
603
- return normalized.slice(0, lastSepIndex);
604
- }
605
- function getBasename(path, ext, isWin) {
606
- if (path.length === 0) return "";
607
- const lastSepIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
608
- let base = lastSepIndex === -1 ? path : path.slice(lastSepIndex + 1);
609
- if (ext && base.endsWith(ext)) {
610
- base = base.slice(0, base.length - ext.length);
611
- }
612
- return base;
613
- }
614
- function getExtname(path) {
615
- const lastDotIndex = path.lastIndexOf(".");
616
- const lastSepIndex = findLastSeparator(path);
617
- if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path.length - 1) {
618
- return "";
619
- }
620
- return path.slice(lastDotIndex);
621
- }
622
- function parsePath(path, isWin) {
623
- let root = "";
624
- if (isWin) {
625
- if (path.length >= 2 && path[1] === ":") {
626
- root = path.slice(0, 2);
627
- if (path.length > 2 && (path[2] === "\\" || path[2] === "/")) {
628
- root += "\\";
629
- }
630
- } else if (path[0] === "\\" || path[0] === "/") {
631
- root = "\\";
632
- }
633
- } else {
634
- if (path[0] === "/") {
635
- root = "/";
636
- }
637
- }
638
- const dir = getDirname(path, isWin);
639
- const base = getBasename(path, void 0, isWin);
640
- const ext = getExtname(path);
641
- const name = ext ? base.slice(0, base.length - ext.length) : base;
642
- return { root, dir, base, ext, name };
643
- }
644
- function formatPath(pathObject, isWin) {
645
- const separator = getSeparator(isWin);
646
- const dir = pathObject.dir || pathObject.root || "";
647
- const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
648
- if (!dir) return base;
649
- if (dir === pathObject.root) return dir + base;
650
- return dir + separator + base;
651
- }
652
- function normalize(path) {
653
- return normalizePath(path, isWindows);
654
- }
655
- function join(...paths) {
656
- return joinPaths(paths, isWindows);
657
- }
658
- function resolve(...paths) {
659
- return resolvePaths(paths, isWindows);
660
- }
661
- function isAbsolute(path) {
662
- return isWindows ? win32.isAbsolute(path) : posix.isAbsolute(path);
663
- }
664
- function relative(from, to) {
665
- return relativePath(from, to, isWindows);
666
- }
667
- function dirname(path) {
668
- return getDirname(path, isWindows);
669
- }
670
- function basename(path, ext) {
671
- return getBasename(path, ext, isWindows);
672
- }
673
- function extname(path) {
674
- return getExtname(path);
675
- }
676
- function parse(path) {
677
- return parsePath(path, isWindows);
678
- }
679
- function format(pathObject) {
680
- return formatPath(pathObject, isWindows);
681
- }
682
- function toNamespacedPath(path) {
683
- if (!isWindows || path.length === 0) return path;
684
- const resolved = resolve(path);
685
- if (resolved.length >= 3) {
686
- if (resolved[0] === "\\") {
687
- if (resolved[1] === "\\" && resolved[2] !== "?") {
688
- return "\\\\?\\UNC\\" + resolved.slice(2);
689
- }
690
- } else if (resolved[1] === ":" && resolved[2] === "\\") {
691
- return "\\\\?\\" + resolved;
692
- }
693
- }
694
- return path;
695
- }
696
- function getRuntime2() {
697
- return runtime;
698
- }
699
- var isWindows, sep, delimiter, posix, win32, path_default;
700
- var init_path = __esm({
701
- "src/path.ts"() {
702
- "use strict";
703
- init_runtime();
704
- isWindows = (() => {
705
- if (isNode) {
706
- return process.platform === "win32";
707
- } else if (isDeno) {
708
- return Deno.build.os === "windows";
709
- }
710
- return typeof process !== "undefined" && process.platform === "win32";
711
- })();
712
- sep = isWindows ? "\\" : "/";
713
- delimiter = isWindows ? ";" : ":";
714
- posix = createPathOps(false);
715
- win32 = createPathOps(true);
716
- path_default = {
717
- sep,
718
- delimiter,
719
- normalize,
720
- join,
721
- resolve,
722
- isAbsolute,
723
- relative,
724
- dirname,
725
- basename,
726
- extname,
727
- parse,
728
- format,
729
- toNamespacedPath,
730
- posix,
731
- win32,
732
- getRuntime: getRuntime2
733
- };
734
- }
735
- });
736
-
737
- // node_modules/esbuild/lib/main.js
738
- var require_main = __commonJS({
739
- "node_modules/esbuild/lib/main.js"(exports, module) {
740
- "use strict";
741
- var __defProp2 = Object.defineProperty;
742
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
743
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
744
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
745
- var __export2 = (target, all) => {
746
- for (var name in all)
747
- __defProp2(target, name, { get: all[name], enumerable: true });
748
- };
749
- var __copyProps2 = (to, from, except, desc) => {
750
- if (from && typeof from === "object" || typeof from === "function") {
751
- for (let key of __getOwnPropNames2(from))
752
- if (!__hasOwnProp2.call(to, key) && key !== except)
753
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
480
+ // node_modules/esbuild/lib/main.js
481
+ var require_main = __commonJS({
482
+ "node_modules/esbuild/lib/main.js"(exports, module) {
483
+ "use strict";
484
+ var __defProp2 = Object.defineProperty;
485
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
486
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
487
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
488
+ var __export2 = (target, all) => {
489
+ for (var name in all)
490
+ __defProp2(target, name, { get: all[name], enumerable: true });
491
+ };
492
+ var __copyProps2 = (to, from, except, desc) => {
493
+ if (from && typeof from === "object" || typeof from === "function") {
494
+ for (let key of __getOwnPropNames2(from))
495
+ if (!__hasOwnProp2.call(to, key) && key !== except)
496
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
754
497
  }
755
498
  return to;
756
499
  };
@@ -1309,7 +1052,7 @@ is not a problem with esbuild. You need to fix your environment instead.
1309
1052
  let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString);
1310
1053
  let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean);
1311
1054
  let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings);
1312
- let format2 = getFlag(options, keys, "format", mustBeString);
1055
+ let format = getFlag(options, keys, "format", mustBeString);
1313
1056
  let globalName = getFlag(options, keys, "globalName", mustBeString);
1314
1057
  let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
1315
1058
  let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
@@ -1342,7 +1085,7 @@ is not a problem with esbuild. You need to fix your environment instead.
1342
1085
  if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`);
1343
1086
  if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`);
1344
1087
  if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`);
1345
- if (format2) flags.push(`--format=${format2}`);
1088
+ if (format) flags.push(`--format=${format}`);
1346
1089
  if (globalName) flags.push(`--global-name=${globalName}`);
1347
1090
  if (platform) flags.push(`--platform=${platform}`);
1348
1091
  if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
@@ -3235,87 +2978,254 @@ error: ${text}`);
3235
2978
  }
3236
2979
  });
3237
2980
 
3238
- // src/config.ts
3239
- init_fs();
3240
- init_path();
2981
+ // src/shares/config/constants.ts
2982
+ var ELIT_CONFIG_FILES = [
2983
+ "elit.config.ts",
2984
+ "elit.config.mts",
2985
+ "elit.config.js",
2986
+ "elit.config.mjs",
2987
+ "elit.config.cjs",
2988
+ "elit.config.json"
2989
+ ];
3241
2990
 
3242
- // src/workspace-package.ts
2991
+ // src/shares/config/env.ts
3243
2992
  init_fs();
3244
- init_path();
3245
- function readPackageJson(filePath) {
3246
- try {
3247
- const packageJsonBuffer = readFileSync(filePath, "utf-8");
3248
- const packageJsonText = typeof packageJsonBuffer === "string" ? packageJsonBuffer : packageJsonBuffer.toString("utf-8");
3249
- return JSON.parse(packageJsonText);
3250
- } catch {
3251
- return void 0;
2993
+
2994
+ // src/server/path/platform.ts
2995
+ init_runtime();
2996
+ function getSeparator(isWin) {
2997
+ return isWin ? "\\" : "/";
2998
+ }
2999
+ function getCwd() {
3000
+ if (isNode || isBun) {
3001
+ return process.cwd();
3002
+ }
3003
+ if (isDeno) {
3004
+ return Deno.cwd();
3252
3005
  }
3006
+ return "/";
3253
3007
  }
3254
- function findWorkspacePackageRoot(startDir, packageName) {
3255
- let currentDir = resolve(startDir);
3256
- while (true) {
3257
- const packageJsonPath = join(currentDir, "package.json");
3258
- const packageJson = existsSync(packageJsonPath) ? readPackageJson(packageJsonPath) : void 0;
3259
- if (packageJson?.name === packageName) {
3260
- return currentDir;
3008
+ var isWindows = (() => {
3009
+ if (isNode) {
3010
+ return process.platform === "win32";
3011
+ }
3012
+ if (isDeno) {
3013
+ return Deno.build.os === "windows";
3014
+ }
3015
+ return typeof process !== "undefined" && process.platform === "win32";
3016
+ })();
3017
+
3018
+ // src/server/path/operations.ts
3019
+ function findLastSeparator(path) {
3020
+ return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
3021
+ }
3022
+ function isAbsolutePosix(path) {
3023
+ return path.length > 0 && path[0] === "/";
3024
+ }
3025
+ function isAbsoluteWin(path) {
3026
+ const len = path.length;
3027
+ if (len === 0) return false;
3028
+ const code = path.charCodeAt(0);
3029
+ if (code === 47 || code === 92) {
3030
+ return true;
3031
+ }
3032
+ if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
3033
+ if (len > 2 && path.charCodeAt(1) === 58) {
3034
+ const code2 = path.charCodeAt(2);
3035
+ if (code2 === 47 || code2 === 92) {
3036
+ return true;
3037
+ }
3261
3038
  }
3262
- const parentDir = dirname(currentDir);
3263
- if (parentDir === currentDir) {
3264
- return void 0;
3039
+ }
3040
+ return false;
3041
+ }
3042
+ function normalizePath(path, isWin) {
3043
+ if (path.length === 0) return ".";
3044
+ const separator = getSeparator(isWin);
3045
+ const isAbsolute = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
3046
+ const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
3047
+ const normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
3048
+ const parts = normalized.split(separator);
3049
+ const result = [];
3050
+ for (let index = 0; index < parts.length; index++) {
3051
+ const part = parts[index];
3052
+ if (part === "" || part === ".") {
3053
+ if (index === 0 && isAbsolute) result.push("");
3054
+ continue;
3265
3055
  }
3266
- currentDir = parentDir;
3056
+ if (part === "..") {
3057
+ if (result.length > 0 && result[result.length - 1] !== "..") {
3058
+ if (!(result.length === 1 && result[0] === "")) {
3059
+ result.pop();
3060
+ }
3061
+ } else if (!isAbsolute) {
3062
+ result.push("..");
3063
+ }
3064
+ } else {
3065
+ result.push(part);
3066
+ }
3067
+ }
3068
+ let finalPath = result.join(separator);
3069
+ if (finalPath.length === 0) {
3070
+ return isAbsolute ? separator : ".";
3267
3071
  }
3072
+ if (trailingSeparator && finalPath[finalPath.length - 1] !== separator) {
3073
+ finalPath += separator;
3074
+ }
3075
+ return finalPath;
3268
3076
  }
3269
- function findInstalledPackageRoot(startDir, packageName) {
3270
- let currentDir = resolve(startDir);
3271
- while (true) {
3272
- const candidate = join(currentDir, "node_modules", ...packageName.split("/"));
3273
- if (existsSync(candidate)) {
3274
- return candidate;
3077
+ function joinPaths(paths, isWin) {
3078
+ if (paths.length === 0) return ".";
3079
+ const separator = getSeparator(isWin);
3080
+ let joined = "";
3081
+ for (let index = 0; index < paths.length; index++) {
3082
+ const path = paths[index];
3083
+ if (path && path.length > 0) {
3084
+ if (joined.length === 0) {
3085
+ joined = path;
3086
+ } else {
3087
+ joined += separator + path;
3088
+ }
3275
3089
  }
3276
- const parentDir = dirname(currentDir);
3277
- if (parentDir === currentDir) {
3278
- return void 0;
3090
+ }
3091
+ if (joined.length === 0) return ".";
3092
+ return normalizePath(joined, isWin);
3093
+ }
3094
+ function resolvePaths(paths, isWin) {
3095
+ const separator = getSeparator(isWin);
3096
+ let resolved = "";
3097
+ let absolute = false;
3098
+ for (let index = paths.length - 1; index >= 0 && !absolute; index--) {
3099
+ const path = paths[index];
3100
+ if (path && path.length > 0) {
3101
+ resolved = path + (resolved.length > 0 ? separator + resolved : "");
3102
+ absolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
3279
3103
  }
3280
- currentDir = parentDir;
3281
3104
  }
3105
+ if (!absolute) {
3106
+ const cwd = getCwd();
3107
+ resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
3108
+ }
3109
+ return normalizePath(resolved, isWin);
3282
3110
  }
3283
- function getWorkspacePackageImportCandidates(packageRoot, specifier, options = {}) {
3284
- const subpath = specifier === "elit" ? "index" : specifier.slice("elit/".length);
3285
- const builtCandidates = options.preferredBuiltFormat === "cjs" ? [
3286
- resolve(packageRoot, "dist", `${subpath}.cjs`),
3287
- resolve(packageRoot, "dist", `${subpath}.js`),
3288
- resolve(packageRoot, "dist", `${subpath}.mjs`)
3289
- ] : [
3290
- resolve(packageRoot, "dist", `${subpath}.mjs`),
3291
- resolve(packageRoot, "dist", `${subpath}.js`),
3292
- resolve(packageRoot, "dist", `${subpath}.cjs`)
3293
- ];
3294
- const sourceCandidates = [
3295
- resolve(packageRoot, "src", `${subpath}.ts`),
3296
- resolve(packageRoot, "src", `${subpath}.tsx`)
3297
- ];
3298
- return options.preferBuilt ? [...builtCandidates, ...sourceCandidates] : [...sourceCandidates, ...builtCandidates];
3111
+ function relativePath(from, to, isWin) {
3112
+ const resolvedFrom = resolvePaths([from], isWin);
3113
+ const resolvedTo = resolvePaths([to], isWin);
3114
+ if (resolvedFrom === resolvedTo) return "";
3115
+ const separator = getSeparator(isWin);
3116
+ const fromParts = resolvedFrom.split(separator).filter((part) => part.length > 0);
3117
+ const toParts = resolvedTo.split(separator).filter((part) => part.length > 0);
3118
+ const minLength = Math.min(fromParts.length, toParts.length);
3119
+ let commonLength = 0;
3120
+ for (let index = 0; index < minLength; index++) {
3121
+ if (fromParts[index] === toParts[index]) {
3122
+ commonLength++;
3123
+ } else {
3124
+ break;
3125
+ }
3126
+ }
3127
+ const result = [];
3128
+ const upCount = fromParts.length - commonLength;
3129
+ for (let index = 0; index < upCount; index++) {
3130
+ result.push("..");
3131
+ }
3132
+ for (let index = commonLength; index < toParts.length; index++) {
3133
+ result.push(toParts[index]);
3134
+ }
3135
+ return result.join(separator) || ".";
3299
3136
  }
3300
- function resolveWorkspacePackageImport(specifier, startDir, options = {}) {
3301
- if (specifier !== "elit" && !specifier.startsWith("elit/")) {
3302
- return void 0;
3137
+ function getDirname(path, isWin) {
3138
+ if (path.length === 0) return ".";
3139
+ const separator = getSeparator(isWin);
3140
+ const normalized = normalizePath(path, isWin);
3141
+ const lastSeparatorIndex = normalized.lastIndexOf(separator);
3142
+ if (lastSeparatorIndex === -1) return ".";
3143
+ if (lastSeparatorIndex === 0) return separator;
3144
+ return normalized.slice(0, lastSeparatorIndex);
3145
+ }
3146
+ function getBasename(path, ext, isWin) {
3147
+ if (path.length === 0) return "";
3148
+ const lastSeparatorIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
3149
+ let base = lastSeparatorIndex === -1 ? path : path.slice(lastSeparatorIndex + 1);
3150
+ if (ext && base.endsWith(ext)) {
3151
+ base = base.slice(0, base.length - ext.length);
3303
3152
  }
3304
- const packageRoots = [
3305
- findWorkspacePackageRoot(startDir, "elit"),
3306
- findInstalledPackageRoot(startDir, "elit")
3307
- ].filter((value, index, values) => typeof value === "string" && values.indexOf(value) === index);
3308
- for (const packageRoot of packageRoots) {
3309
- for (const candidate of getWorkspacePackageImportCandidates(packageRoot, specifier, options)) {
3310
- if (existsSync(candidate)) {
3311
- return candidate;
3153
+ return base;
3154
+ }
3155
+ function getExtname(path) {
3156
+ const lastDotIndex = path.lastIndexOf(".");
3157
+ const lastSeparatorIndex = findLastSeparator(path);
3158
+ if (lastDotIndex === -1 || lastDotIndex < lastSeparatorIndex || lastDotIndex === path.length - 1) {
3159
+ return "";
3160
+ }
3161
+ return path.slice(lastDotIndex);
3162
+ }
3163
+ function parsePath(path, isWin) {
3164
+ let root = "";
3165
+ if (isWin) {
3166
+ if (path.length >= 2 && path[1] === ":") {
3167
+ root = path.slice(0, 2);
3168
+ if (path.length > 2 && (path[2] === "\\" || path[2] === "/")) {
3169
+ root += "\\";
3312
3170
  }
3171
+ } else if (path[0] === "\\" || path[0] === "/") {
3172
+ root = "\\";
3313
3173
  }
3174
+ } else if (path[0] === "/") {
3175
+ root = "/";
3314
3176
  }
3315
- return void 0;
3177
+ const dir = getDirname(path, isWin);
3178
+ const base = getBasename(path, void 0, isWin);
3179
+ const ext = getExtname(path);
3180
+ const name = ext ? base.slice(0, base.length - ext.length) : base;
3181
+ return { root, dir, base, ext, name };
3182
+ }
3183
+ function formatPath(pathObject, isWin) {
3184
+ const separator = getSeparator(isWin);
3185
+ const dir = pathObject.dir || pathObject.root || "";
3186
+ const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
3187
+ if (!dir) return base;
3188
+ if (dir === pathObject.root) return dir + base;
3189
+ return dir + separator + base;
3190
+ }
3191
+ function createPathOps(isWin) {
3192
+ return {
3193
+ sep: getSeparator(isWin),
3194
+ delimiter: isWin ? ";" : ":",
3195
+ normalize: (path) => normalizePath(path, isWin),
3196
+ join: (...paths) => joinPaths(paths, isWin),
3197
+ resolve: (...paths) => resolvePaths(paths, isWin),
3198
+ isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
3199
+ relative: (from, to) => relativePath(from, to, isWin),
3200
+ dirname: (path) => getDirname(path, isWin),
3201
+ basename: (path, ext) => getBasename(path, ext, isWin),
3202
+ extname: (path) => getExtname(path),
3203
+ parse: (path) => parsePath(path, isWin),
3204
+ format: (pathObject) => formatPath(pathObject, isWin)
3205
+ };
3206
+ }
3207
+
3208
+ // src/server/path/runtime.ts
3209
+ init_runtime();
3210
+
3211
+ // src/server/path/index.ts
3212
+ var posix = createPathOps(false);
3213
+ var win32 = createPathOps(true);
3214
+ function join(...paths) {
3215
+ return joinPaths(paths, isWindows);
3216
+ }
3217
+ function resolve(...paths) {
3218
+ return resolvePaths(paths, isWindows);
3219
+ }
3220
+ function relative(from, to) {
3221
+ return relativePath(from, to, isWindows);
3222
+ }
3223
+ function dirname(path) {
3224
+ return getDirname(path, isWindows);
3316
3225
  }
3317
3226
 
3318
- // src/config.ts
3227
+ // src/shares/config/utils.ts
3228
+ init_fs();
3319
3229
  function readFileAsString(filePath) {
3320
3230
  const contentBuffer = readFileSync(filePath, "utf-8");
3321
3231
  return typeof contentBuffer === "string" ? contentBuffer : contentBuffer.toString("utf-8");
@@ -3343,33 +3253,15 @@ error: ${text}`);
3343
3253
  } catch {
3344
3254
  }
3345
3255
  }
3346
- function defineConfig(config) {
3347
- return config;
3348
- }
3349
- var ELIT_CONFIG_FILES = [
3350
- "elit.config.ts",
3351
- "elit.config.mts",
3352
- "elit.config.js",
3353
- "elit.config.mjs",
3354
- "elit.config.cjs",
3355
- "elit.config.json"
3356
- ];
3357
- function resolveConfigPath(cwd = process.cwd()) {
3358
- for (const configFile of ELIT_CONFIG_FILES) {
3359
- const configPath = resolve(cwd, configFile);
3360
- if (existsSync(configPath)) {
3361
- return configPath;
3362
- }
3363
- }
3364
- return null;
3365
- }
3256
+
3257
+ // src/shares/config/env.ts
3366
3258
  function loadEnv(mode = "development", cwd = process.cwd()) {
3367
3259
  const env = { MODE: mode };
3368
3260
  const envFiles = [
3369
3261
  `.env.${mode}.local`,
3370
3262
  `.env.${mode}`,
3371
- `.env.local`,
3372
- `.env`
3263
+ ".env.local",
3264
+ ".env"
3373
3265
  ];
3374
3266
  for (const file of envFiles) {
3375
3267
  const filePath = resolve(cwd, file);
@@ -3378,7 +3270,9 @@ error: ${text}`);
3378
3270
  const lines = content.split("\n");
3379
3271
  for (const line of lines) {
3380
3272
  const trimmed = line.trim();
3381
- if (!trimmed || trimmed.startsWith("#")) continue;
3273
+ if (!trimmed || trimmed.startsWith("#")) {
3274
+ continue;
3275
+ }
3382
3276
  const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/);
3383
3277
  if (match) {
3384
3278
  const [, key, value] = match;
@@ -3392,6 +3286,113 @@ error: ${text}`);
3392
3286
  }
3393
3287
  return env;
3394
3288
  }
3289
+
3290
+ // src/shares/config/loader.ts
3291
+ init_fs();
3292
+
3293
+ // src/shares/workspace-package/roots.ts
3294
+ init_fs();
3295
+
3296
+ // src/shares/workspace-package/package-json.ts
3297
+ init_fs();
3298
+ function readPackageJson(filePath) {
3299
+ try {
3300
+ const packageJsonBuffer = readFileSync(filePath, "utf-8");
3301
+ const packageJsonText = typeof packageJsonBuffer === "string" ? packageJsonBuffer : packageJsonBuffer.toString("utf-8");
3302
+ return JSON.parse(packageJsonText);
3303
+ } catch {
3304
+ return void 0;
3305
+ }
3306
+ }
3307
+
3308
+ // src/shares/workspace-package/roots.ts
3309
+ function findPackageDirectory(startDir, resolveMatch) {
3310
+ let currentDir = resolve(startDir);
3311
+ while (true) {
3312
+ const match = resolveMatch(currentDir);
3313
+ if (match) {
3314
+ return match;
3315
+ }
3316
+ const parentDir = dirname(currentDir);
3317
+ if (parentDir === currentDir) {
3318
+ return void 0;
3319
+ }
3320
+ currentDir = parentDir;
3321
+ }
3322
+ }
3323
+ function findWorkspacePackageRoot(startDir, packageName) {
3324
+ return findPackageDirectory(startDir, (currentDir) => {
3325
+ const packageJsonPath = join(currentDir, "package.json");
3326
+ const packageJson = existsSync(packageJsonPath) ? readPackageJson(packageJsonPath) : void 0;
3327
+ return packageJson?.name === packageName ? currentDir : void 0;
3328
+ });
3329
+ }
3330
+ function findInstalledPackageRoot(startDir, packageName) {
3331
+ return findPackageDirectory(startDir, (currentDir) => {
3332
+ const candidate = join(currentDir, "node_modules", ...packageName.split("/"));
3333
+ return existsSync(candidate) ? candidate : void 0;
3334
+ });
3335
+ }
3336
+
3337
+ // src/shares/workspace-package/resolve.ts
3338
+ init_fs();
3339
+
3340
+ // src/shares/workspace-package/candidates.ts
3341
+ function getWorkspacePackageImportCandidates(packageRoot, specifier, options = {}) {
3342
+ const subpath = specifier === "elit" ? "index" : specifier.slice("elit/".length);
3343
+ const builtCandidates = options.preferredBuiltFormat === "cjs" ? [
3344
+ resolve(packageRoot, "dist", `${subpath}.cjs`),
3345
+ resolve(packageRoot, "dist", `${subpath}.js`),
3346
+ resolve(packageRoot, "dist", `${subpath}.mjs`)
3347
+ ] : [
3348
+ resolve(packageRoot, "dist", `${subpath}.mjs`),
3349
+ resolve(packageRoot, "dist", `${subpath}.js`),
3350
+ resolve(packageRoot, "dist", `${subpath}.cjs`)
3351
+ ];
3352
+ const sourceCandidates = [
3353
+ resolve(packageRoot, "src", `${subpath}.ts`),
3354
+ resolve(packageRoot, "src", `${subpath}.tsx`)
3355
+ ];
3356
+ return options.preferBuilt ? [...builtCandidates, ...sourceCandidates] : [...sourceCandidates, ...builtCandidates];
3357
+ }
3358
+
3359
+ // src/shares/workspace-package/resolve.ts
3360
+ function isWorkspacePackageSpecifier(specifier) {
3361
+ return specifier === "elit" || specifier.startsWith("elit/");
3362
+ }
3363
+ function resolveWorkspacePackageImport(specifier, startDir, options = {}) {
3364
+ if (!isWorkspacePackageSpecifier(specifier)) {
3365
+ return void 0;
3366
+ }
3367
+ const packageRoots = /* @__PURE__ */ new Set();
3368
+ const workspacePackageRoot = findWorkspacePackageRoot(startDir, "elit");
3369
+ const installedPackageRoot = findInstalledPackageRoot(startDir, "elit");
3370
+ if (workspacePackageRoot) {
3371
+ packageRoots.add(workspacePackageRoot);
3372
+ }
3373
+ if (installedPackageRoot) {
3374
+ packageRoots.add(installedPackageRoot);
3375
+ }
3376
+ for (const packageRoot of packageRoots) {
3377
+ for (const candidate of getWorkspacePackageImportCandidates(packageRoot, specifier, options)) {
3378
+ if (existsSync(candidate)) {
3379
+ return candidate;
3380
+ }
3381
+ }
3382
+ }
3383
+ return void 0;
3384
+ }
3385
+
3386
+ // src/shares/config/loader.ts
3387
+ function resolveConfigPath(cwd = process.cwd()) {
3388
+ for (const configFile of ELIT_CONFIG_FILES) {
3389
+ const configPath = resolve(cwd, configFile);
3390
+ if (existsSync(configPath)) {
3391
+ return configPath;
3392
+ }
3393
+ }
3394
+ return null;
3395
+ }
3395
3396
  async function loadConfig(cwd = process.cwd()) {
3396
3397
  const configPath = resolveConfigPath(cwd);
3397
3398
  if (configPath) {
@@ -3410,16 +3411,16 @@ error: ${text}`);
3410
3411
  if (ext === "json") {
3411
3412
  const content = readFileAsString(configPath);
3412
3413
  return JSON.parse(content);
3413
- } else if (ext === "ts" || ext === "mts") {
3414
+ }
3415
+ if (ext === "ts" || ext === "mts") {
3414
3416
  try {
3415
3417
  const { build } = await Promise.resolve().then(() => __toESM(require_main()));
3416
- const { join: join2, dirname: dirname2 } = await Promise.resolve().then(() => (init_path(), path_exports));
3417
- const configDir = dirname2(configPath);
3418
- const tempFile = join2(configDir, `.elit-config-${Date.now()}.mjs`);
3418
+ const configDir = dirname(configPath);
3419
+ const tempFile = join(configDir, `.elit-config-${Date.now()}.mjs`);
3419
3420
  const externalAllPlugin = {
3420
3421
  name: "external-all",
3421
- setup(build2) {
3422
- build2.onResolve({ filter: /.*/ }, (args) => {
3422
+ setup(buildContext) {
3423
+ buildContext.onResolve({ filter: /.*/ }, (args) => {
3423
3424
  const workspacePackageImport = resolveWorkspacePackageImport(args.path, args.resolveDir || configDir, {
3424
3425
  preferBuilt: true,
3425
3426
  preferredBuiltFormat: "esm"
@@ -3459,7 +3460,6 @@ error: ${text}`);
3459
3460
  write: true,
3460
3461
  target: "es2020",
3461
3462
  plugins: [externalAllPlugin],
3462
- // External Node.js built-ins and runtime-specific packages
3463
3463
  external: [
3464
3464
  "node:*",
3465
3465
  "fs",
@@ -3474,7 +3474,6 @@ error: ${text}`);
3474
3474
  "deno",
3475
3475
  "deno:*"
3476
3476
  ],
3477
- // Use the config directory as the working directory for resolution
3478
3477
  absWorkingDir: configDir
3479
3478
  });
3480
3479
  const config = await importConfigModule(tempFile);
@@ -3485,10 +3484,11 @@ error: ${text}`);
3485
3484
  console.error("You can use a .js, .mjs, or .json config file instead.");
3486
3485
  throw error;
3487
3486
  }
3488
- } else {
3489
- return await importConfigModule(configPath);
3490
3487
  }
3488
+ return await importConfigModule(configPath);
3491
3489
  }
3490
+
3491
+ // src/shares/config/merge.ts
3492
3492
  function mergeConfig(config, cliArgs) {
3493
3493
  if (!config) {
3494
3494
  return cliArgs;
@@ -3496,8 +3496,13 @@ error: ${text}`);
3496
3496
  return {
3497
3497
  ...config,
3498
3498
  ...Object.fromEntries(
3499
- Object.entries(cliArgs).filter(([_, v]) => v !== void 0)
3499
+ Object.entries(cliArgs).filter(([_, value]) => value !== void 0)
3500
3500
  )
3501
3501
  };
3502
3502
  }
3503
+
3504
+ // src/shares/config/types.ts
3505
+ function defineConfig(config) {
3506
+ return config;
3507
+ }
3503
3508
  })();