elit 2.0.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +275 -128
- package/dist/build.d.mts +10 -1
- package/dist/build.d.ts +10 -1
- package/dist/build.js +670 -1
- package/dist/build.mjs +641 -1
- package/dist/chokidar.d.mts +134 -0
- package/dist/chokidar.d.ts +134 -0
- package/dist/chokidar.js +240 -0
- package/dist/chokidar.mjs +221 -0
- package/dist/cli.js +2792 -495
- package/dist/dom.d.mts +10 -3
- package/dist/dom.d.ts +10 -3
- package/dist/dom.js +676 -1
- package/dist/dom.mjs +647 -1
- package/dist/el.d.mts +16 -36
- package/dist/el.d.ts +16 -36
- package/dist/el.js +789 -1
- package/dist/el.mjs +583 -1
- package/dist/fs.d.mts +255 -0
- package/dist/fs.d.ts +255 -0
- package/dist/fs.js +513 -0
- package/dist/fs.mjs +469 -0
- package/dist/hmr.js +112 -1
- package/dist/hmr.mjs +91 -1
- package/dist/http.d.mts +163 -0
- package/dist/http.d.ts +163 -0
- package/dist/http.js +632 -0
- package/dist/http.mjs +605 -0
- package/dist/https.d.mts +108 -0
- package/dist/https.d.ts +108 -0
- package/dist/https.js +907 -0
- package/dist/https.mjs +901 -0
- package/dist/index.d.mts +613 -33
- package/dist/index.d.ts +613 -33
- package/dist/index.js +2589 -1
- package/dist/index.mjs +2312 -1
- package/dist/mime-types.d.mts +48 -0
- package/dist/mime-types.d.ts +48 -0
- package/dist/mime-types.js +197 -0
- package/dist/mime-types.mjs +166 -0
- package/dist/path.d.mts +163 -0
- package/dist/path.d.ts +163 -0
- package/dist/path.js +350 -0
- package/dist/path.mjs +310 -0
- package/dist/router.d.mts +3 -1
- package/dist/router.d.ts +3 -1
- package/dist/router.js +830 -1
- package/dist/router.mjs +801 -1
- package/dist/runtime.d.mts +97 -0
- package/dist/runtime.d.ts +97 -0
- package/dist/runtime.js +43 -0
- package/dist/runtime.mjs +15 -0
- package/dist/server.d.mts +5 -1
- package/dist/server.d.ts +5 -1
- package/dist/server.js +3267 -1
- package/dist/server.mjs +3241 -1
- package/dist/state.d.mts +3 -1
- package/dist/state.d.ts +3 -1
- package/dist/state.js +1036 -1
- package/dist/state.mjs +992 -1
- package/dist/style.d.mts +47 -1
- package/dist/style.d.ts +47 -1
- package/dist/style.js +551 -1
- package/dist/style.mjs +483 -1
- package/dist/{types-DOAdFFJB.d.ts → types-C0nGi6MX.d.mts} +29 -13
- package/dist/{types-DOAdFFJB.d.mts → types-Du6kfwTm.d.ts} +29 -13
- package/dist/types.d.mts +452 -3
- package/dist/types.d.ts +452 -3
- package/dist/types.js +18 -1
- package/dist/ws.d.mts +195 -0
- package/dist/ws.d.ts +195 -0
- package/dist/ws.js +380 -0
- package/dist/ws.mjs +358 -0
- package/dist/wss.d.mts +108 -0
- package/dist/wss.d.ts +108 -0
- package/dist/wss.js +1306 -0
- package/dist/wss.mjs +1300 -0
- package/package.json +53 -6
- package/dist/client.d.mts +0 -9
- package/dist/client.d.ts +0 -9
- package/dist/client.js +0 -1
- package/dist/client.mjs +0 -1
package/dist/path.mjs
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import {createRequire as __createRequire} from 'module';const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/runtime.ts
|
|
4
|
+
var runtime = (() => {
|
|
5
|
+
if (typeof Deno !== "undefined") return "deno";
|
|
6
|
+
if (typeof Bun !== "undefined") return "bun";
|
|
7
|
+
return "node";
|
|
8
|
+
})();
|
|
9
|
+
var isNode = runtime === "node";
|
|
10
|
+
var isBun = runtime === "bun";
|
|
11
|
+
var isDeno = runtime === "deno";
|
|
12
|
+
|
|
13
|
+
// src/path.ts
|
|
14
|
+
function getSeparator(isWin) {
|
|
15
|
+
return isWin ? "\\" : "/";
|
|
16
|
+
}
|
|
17
|
+
function getCwd() {
|
|
18
|
+
if (isNode || isBun) {
|
|
19
|
+
return process.cwd();
|
|
20
|
+
} else if (isDeno) {
|
|
21
|
+
return Deno.cwd();
|
|
22
|
+
}
|
|
23
|
+
return "/";
|
|
24
|
+
}
|
|
25
|
+
function findLastSeparator(path) {
|
|
26
|
+
return Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
|
|
27
|
+
}
|
|
28
|
+
function createPathOps(isWin) {
|
|
29
|
+
return {
|
|
30
|
+
sep: getSeparator(isWin),
|
|
31
|
+
delimiter: isWin ? ";" : ":",
|
|
32
|
+
normalize: (path) => normalizePath(path, isWin),
|
|
33
|
+
join: (...paths) => joinPaths(paths, isWin),
|
|
34
|
+
resolve: (...paths) => resolvePaths(paths, isWin),
|
|
35
|
+
isAbsolute: (path) => isWin ? isAbsoluteWin(path) : isAbsolutePosix(path),
|
|
36
|
+
relative: (from, to) => relativePath(from, to, isWin),
|
|
37
|
+
dirname: (path) => getDirname(path, isWin),
|
|
38
|
+
basename: (path, ext) => getBasename(path, ext, isWin),
|
|
39
|
+
extname: (path) => getExtname(path),
|
|
40
|
+
parse: (path) => parsePath(path, isWin),
|
|
41
|
+
format: (pathObject) => formatPath(pathObject, isWin)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function isAbsolutePosix(path) {
|
|
45
|
+
return path.length > 0 && path[0] === "/";
|
|
46
|
+
}
|
|
47
|
+
function isAbsoluteWin(path) {
|
|
48
|
+
const len = path.length;
|
|
49
|
+
if (len === 0) return false;
|
|
50
|
+
const code = path.charCodeAt(0);
|
|
51
|
+
if (code === 47 || code === 92) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
55
|
+
if (len > 2 && path.charCodeAt(1) === 58) {
|
|
56
|
+
const code2 = path.charCodeAt(2);
|
|
57
|
+
if (code2 === 47 || code2 === 92) {
|
|
58
|
+
return true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
var isWindows = (() => {
|
|
65
|
+
if (isNode) {
|
|
66
|
+
return process.platform === "win32";
|
|
67
|
+
} else if (isDeno) {
|
|
68
|
+
return Deno.build.os === "windows";
|
|
69
|
+
}
|
|
70
|
+
return typeof process !== "undefined" && process.platform === "win32";
|
|
71
|
+
})();
|
|
72
|
+
var sep = isWindows ? "\\" : "/";
|
|
73
|
+
var delimiter = isWindows ? ";" : ":";
|
|
74
|
+
var posix = createPathOps(false);
|
|
75
|
+
var win32 = createPathOps(true);
|
|
76
|
+
function normalizePath(path, isWin) {
|
|
77
|
+
if (path.length === 0) return ".";
|
|
78
|
+
const separator = getSeparator(isWin);
|
|
79
|
+
const isAbsolute2 = isWin ? isAbsoluteWin(path) : isAbsolutePosix(path);
|
|
80
|
+
const trailingSeparator = path[path.length - 1] === separator || isWin && path[path.length - 1] === "/";
|
|
81
|
+
let normalized = path.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
|
|
82
|
+
const parts = normalized.split(separator);
|
|
83
|
+
const result = [];
|
|
84
|
+
for (let i = 0; i < parts.length; i++) {
|
|
85
|
+
const part = parts[i];
|
|
86
|
+
if (part === "" || part === ".") {
|
|
87
|
+
if (i === 0 && isAbsolute2) result.push("");
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (part === "..") {
|
|
91
|
+
if (result.length > 0 && result[result.length - 1] !== "..") {
|
|
92
|
+
if (!(result.length === 1 && result[0] === "")) {
|
|
93
|
+
result.pop();
|
|
94
|
+
}
|
|
95
|
+
} else if (!isAbsolute2) {
|
|
96
|
+
result.push("..");
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
result.push(part);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
let final = result.join(separator);
|
|
103
|
+
if (final.length === 0) {
|
|
104
|
+
return isAbsolute2 ? separator : ".";
|
|
105
|
+
}
|
|
106
|
+
if (trailingSeparator && final[final.length - 1] !== separator) {
|
|
107
|
+
final += separator;
|
|
108
|
+
}
|
|
109
|
+
return final;
|
|
110
|
+
}
|
|
111
|
+
function joinPaths(paths, isWin) {
|
|
112
|
+
if (paths.length === 0) return ".";
|
|
113
|
+
const separator = getSeparator(isWin);
|
|
114
|
+
let joined = "";
|
|
115
|
+
for (let i = 0; i < paths.length; i++) {
|
|
116
|
+
const path = paths[i];
|
|
117
|
+
if (path && path.length > 0) {
|
|
118
|
+
if (joined.length === 0) {
|
|
119
|
+
joined = path;
|
|
120
|
+
} else {
|
|
121
|
+
joined += separator + path;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (joined.length === 0) return ".";
|
|
126
|
+
return normalizePath(joined, isWin);
|
|
127
|
+
}
|
|
128
|
+
function resolvePaths(paths, isWin) {
|
|
129
|
+
const separator = getSeparator(isWin);
|
|
130
|
+
let resolved = "";
|
|
131
|
+
let isAbsolute2 = false;
|
|
132
|
+
for (let i = paths.length - 1; i >= 0 && !isAbsolute2; i--) {
|
|
133
|
+
const path = paths[i];
|
|
134
|
+
if (path && path.length > 0) {
|
|
135
|
+
resolved = path + (resolved.length > 0 ? separator + resolved : "");
|
|
136
|
+
isAbsolute2 = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (!isAbsolute2) {
|
|
140
|
+
const cwd = getCwd();
|
|
141
|
+
resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
|
|
142
|
+
}
|
|
143
|
+
return normalizePath(resolved, isWin);
|
|
144
|
+
}
|
|
145
|
+
function relativePath(from, to, isWin) {
|
|
146
|
+
from = resolvePaths([from], isWin);
|
|
147
|
+
to = resolvePaths([to], isWin);
|
|
148
|
+
if (from === to) return "";
|
|
149
|
+
const separator = getSeparator(isWin);
|
|
150
|
+
const fromParts = from.split(separator).filter((p) => p.length > 0);
|
|
151
|
+
const toParts = to.split(separator).filter((p) => p.length > 0);
|
|
152
|
+
let commonLength = 0;
|
|
153
|
+
const minLength = Math.min(fromParts.length, toParts.length);
|
|
154
|
+
for (let i = 0; i < minLength; i++) {
|
|
155
|
+
if (fromParts[i] === toParts[i]) {
|
|
156
|
+
commonLength++;
|
|
157
|
+
} else {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const upCount = fromParts.length - commonLength;
|
|
162
|
+
const result = [];
|
|
163
|
+
for (let i = 0; i < upCount; i++) {
|
|
164
|
+
result.push("..");
|
|
165
|
+
}
|
|
166
|
+
for (let i = commonLength; i < toParts.length; i++) {
|
|
167
|
+
result.push(toParts[i]);
|
|
168
|
+
}
|
|
169
|
+
return result.join(separator) || ".";
|
|
170
|
+
}
|
|
171
|
+
function getDirname(path, isWin) {
|
|
172
|
+
if (path.length === 0) return ".";
|
|
173
|
+
const separator = getSeparator(isWin);
|
|
174
|
+
const normalized = normalizePath(path, isWin);
|
|
175
|
+
const lastSepIndex = normalized.lastIndexOf(separator);
|
|
176
|
+
if (lastSepIndex === -1) return ".";
|
|
177
|
+
if (lastSepIndex === 0) return separator;
|
|
178
|
+
return normalized.slice(0, lastSepIndex);
|
|
179
|
+
}
|
|
180
|
+
function getBasename(path, ext, isWin) {
|
|
181
|
+
if (path.length === 0) return "";
|
|
182
|
+
const lastSepIndex = isWin ? findLastSeparator(path) : path.lastIndexOf("/");
|
|
183
|
+
let base = lastSepIndex === -1 ? path : path.slice(lastSepIndex + 1);
|
|
184
|
+
if (ext && base.endsWith(ext)) {
|
|
185
|
+
base = base.slice(0, base.length - ext.length);
|
|
186
|
+
}
|
|
187
|
+
return base;
|
|
188
|
+
}
|
|
189
|
+
function getExtname(path) {
|
|
190
|
+
const lastDotIndex = path.lastIndexOf(".");
|
|
191
|
+
const lastSepIndex = findLastSeparator(path);
|
|
192
|
+
if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path.length - 1) {
|
|
193
|
+
return "";
|
|
194
|
+
}
|
|
195
|
+
return path.slice(lastDotIndex);
|
|
196
|
+
}
|
|
197
|
+
function parsePath(path, isWin) {
|
|
198
|
+
let root = "";
|
|
199
|
+
if (isWin) {
|
|
200
|
+
if (path.length >= 2 && path[1] === ":") {
|
|
201
|
+
root = path.slice(0, 2);
|
|
202
|
+
if (path.length > 2 && (path[2] === "\\" || path[2] === "/")) {
|
|
203
|
+
root += "\\";
|
|
204
|
+
}
|
|
205
|
+
} else if (path[0] === "\\" || path[0] === "/") {
|
|
206
|
+
root = "\\";
|
|
207
|
+
}
|
|
208
|
+
} else {
|
|
209
|
+
if (path[0] === "/") {
|
|
210
|
+
root = "/";
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const dir = getDirname(path, isWin);
|
|
214
|
+
const base = getBasename(path, void 0, isWin);
|
|
215
|
+
const ext = getExtname(path);
|
|
216
|
+
const name = ext ? base.slice(0, base.length - ext.length) : base;
|
|
217
|
+
return { root, dir, base, ext, name };
|
|
218
|
+
}
|
|
219
|
+
function formatPath(pathObject, isWin) {
|
|
220
|
+
const separator = getSeparator(isWin);
|
|
221
|
+
const dir = pathObject.dir || pathObject.root || "";
|
|
222
|
+
const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
223
|
+
if (!dir) return base;
|
|
224
|
+
if (dir === pathObject.root) return dir + base;
|
|
225
|
+
return dir + separator + base;
|
|
226
|
+
}
|
|
227
|
+
function normalize(path) {
|
|
228
|
+
return normalizePath(path, isWindows);
|
|
229
|
+
}
|
|
230
|
+
function join(...paths) {
|
|
231
|
+
return joinPaths(paths, isWindows);
|
|
232
|
+
}
|
|
233
|
+
function resolve(...paths) {
|
|
234
|
+
return resolvePaths(paths, isWindows);
|
|
235
|
+
}
|
|
236
|
+
function isAbsolute(path) {
|
|
237
|
+
return isWindows ? win32.isAbsolute(path) : posix.isAbsolute(path);
|
|
238
|
+
}
|
|
239
|
+
function relative(from, to) {
|
|
240
|
+
return relativePath(from, to, isWindows);
|
|
241
|
+
}
|
|
242
|
+
function dirname(path) {
|
|
243
|
+
return getDirname(path, isWindows);
|
|
244
|
+
}
|
|
245
|
+
function basename(path, ext) {
|
|
246
|
+
return getBasename(path, ext, isWindows);
|
|
247
|
+
}
|
|
248
|
+
function extname(path) {
|
|
249
|
+
return getExtname(path);
|
|
250
|
+
}
|
|
251
|
+
function parse(path) {
|
|
252
|
+
return parsePath(path, isWindows);
|
|
253
|
+
}
|
|
254
|
+
function format(pathObject) {
|
|
255
|
+
return formatPath(pathObject, isWindows);
|
|
256
|
+
}
|
|
257
|
+
function toNamespacedPath(path) {
|
|
258
|
+
if (!isWindows || path.length === 0) return path;
|
|
259
|
+
const resolved = resolve(path);
|
|
260
|
+
if (resolved.length >= 3) {
|
|
261
|
+
if (resolved[0] === "\\") {
|
|
262
|
+
if (resolved[1] === "\\" && resolved[2] !== "?") {
|
|
263
|
+
return "\\\\?\\UNC\\" + resolved.slice(2);
|
|
264
|
+
}
|
|
265
|
+
} else if (resolved[1] === ":" && resolved[2] === "\\") {
|
|
266
|
+
return "\\\\?\\" + resolved;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return path;
|
|
270
|
+
}
|
|
271
|
+
function getRuntime() {
|
|
272
|
+
return runtime;
|
|
273
|
+
}
|
|
274
|
+
var path_default = {
|
|
275
|
+
sep,
|
|
276
|
+
delimiter,
|
|
277
|
+
normalize,
|
|
278
|
+
join,
|
|
279
|
+
resolve,
|
|
280
|
+
isAbsolute,
|
|
281
|
+
relative,
|
|
282
|
+
dirname,
|
|
283
|
+
basename,
|
|
284
|
+
extname,
|
|
285
|
+
parse,
|
|
286
|
+
format,
|
|
287
|
+
toNamespacedPath,
|
|
288
|
+
posix,
|
|
289
|
+
win32,
|
|
290
|
+
getRuntime
|
|
291
|
+
};
|
|
292
|
+
export {
|
|
293
|
+
basename,
|
|
294
|
+
path_default as default,
|
|
295
|
+
delimiter,
|
|
296
|
+
dirname,
|
|
297
|
+
extname,
|
|
298
|
+
format,
|
|
299
|
+
getRuntime,
|
|
300
|
+
isAbsolute,
|
|
301
|
+
join,
|
|
302
|
+
normalize,
|
|
303
|
+
parse,
|
|
304
|
+
posix,
|
|
305
|
+
relative,
|
|
306
|
+
resolve,
|
|
307
|
+
sep,
|
|
308
|
+
toNamespacedPath,
|
|
309
|
+
win32
|
|
310
|
+
};
|
package/dist/router.d.mts
CHANGED