elit 3.1.6 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.d.mts +3 -1
- package/dist/cli.js +442 -218
- package/dist/database.d.mts +31 -0
- package/dist/database.d.ts +30 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +440 -0
- package/dist/database.mjs +406 -0
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +4 -5
- package/dist/hmr.mjs +4 -5
- package/dist/http.d.mts +3 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +23 -0
- package/dist/http.mjs +23 -0
- package/dist/https.js +23 -0
- package/dist/https.mjs +23 -0
- package/dist/index.js +4 -5
- package/dist/index.mjs +4 -5
- package/dist/{server-CkRUWELa.d.ts → server-BFOHbYb6.d.ts} +32 -14
- package/dist/{server-D8ktU14v.d.mts → server-BPVoq5Xi.d.mts} +32 -14
- package/dist/server.d.mts +3 -1
- package/dist/server.d.ts +28 -13
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +431 -234
- package/dist/server.mjs +429 -234
- package/dist/types.d.mts +35 -13
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wss.js +23 -0
- package/dist/wss.mjs +23 -0
- package/package.json +8 -2
- package/src/cli.ts +2 -1
- package/src/database.ts +246 -0
- package/src/hmr.ts +7 -6
- package/src/http.ts +26 -0
- package/src/server.ts +90 -65
- package/src/types.ts +7 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import {createRequire as __createRequire} from 'module';const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/database.ts
|
|
4
|
+
import vm from "vm";
|
|
5
|
+
|
|
6
|
+
// src/runtime.ts
|
|
7
|
+
var runtime = (() => {
|
|
8
|
+
if (typeof Deno !== "undefined") return "deno";
|
|
9
|
+
if (typeof Bun !== "undefined") return "bun";
|
|
10
|
+
return "node";
|
|
11
|
+
})();
|
|
12
|
+
var isNode = runtime === "node";
|
|
13
|
+
var isBun = runtime === "bun";
|
|
14
|
+
var isDeno = runtime === "deno";
|
|
15
|
+
|
|
16
|
+
// src/path.ts
|
|
17
|
+
function getSeparator(isWin) {
|
|
18
|
+
return isWin ? "\\" : "/";
|
|
19
|
+
}
|
|
20
|
+
function getCwd() {
|
|
21
|
+
if (isNode || isBun) {
|
|
22
|
+
return process.cwd();
|
|
23
|
+
} else if (isDeno) {
|
|
24
|
+
return Deno.cwd();
|
|
25
|
+
}
|
|
26
|
+
return "/";
|
|
27
|
+
}
|
|
28
|
+
function findLastSeparator(path2) {
|
|
29
|
+
return Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\"));
|
|
30
|
+
}
|
|
31
|
+
function createPathOps(isWin) {
|
|
32
|
+
return {
|
|
33
|
+
sep: getSeparator(isWin),
|
|
34
|
+
delimiter: isWin ? ";" : ":",
|
|
35
|
+
normalize: (path2) => normalizePath(path2, isWin),
|
|
36
|
+
join: (...paths) => joinPaths(paths, isWin),
|
|
37
|
+
resolve: (...paths) => resolvePaths(paths, isWin),
|
|
38
|
+
isAbsolute: (path2) => isWin ? isAbsoluteWin(path2) : isAbsolutePosix(path2),
|
|
39
|
+
relative: (from, to) => relativePath(from, to, isWin),
|
|
40
|
+
dirname: (path2) => getDirname(path2, isWin),
|
|
41
|
+
basename: (path2, ext) => getBasename(path2, ext, isWin),
|
|
42
|
+
extname: (path2) => getExtname(path2),
|
|
43
|
+
parse: (path2) => parsePath(path2, isWin),
|
|
44
|
+
format: (pathObject) => formatPath(pathObject, isWin)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function isAbsolutePosix(path2) {
|
|
48
|
+
return path2.length > 0 && path2[0] === "/";
|
|
49
|
+
}
|
|
50
|
+
function isAbsoluteWin(path2) {
|
|
51
|
+
const len = path2.length;
|
|
52
|
+
if (len === 0) return false;
|
|
53
|
+
const code = path2.charCodeAt(0);
|
|
54
|
+
if (code === 47 || code === 92) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
58
|
+
if (len > 2 && path2.charCodeAt(1) === 58) {
|
|
59
|
+
const code2 = path2.charCodeAt(2);
|
|
60
|
+
if (code2 === 47 || code2 === 92) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
var isWindows = (() => {
|
|
68
|
+
if (isNode) {
|
|
69
|
+
return process.platform === "win32";
|
|
70
|
+
} else if (isDeno) {
|
|
71
|
+
return Deno.build.os === "windows";
|
|
72
|
+
}
|
|
73
|
+
return typeof process !== "undefined" && process.platform === "win32";
|
|
74
|
+
})();
|
|
75
|
+
var posix = createPathOps(false);
|
|
76
|
+
var win32 = createPathOps(true);
|
|
77
|
+
function normalizePath(path2, isWin) {
|
|
78
|
+
if (path2.length === 0) return ".";
|
|
79
|
+
const separator = getSeparator(isWin);
|
|
80
|
+
const isAbsolute = isWin ? isAbsoluteWin(path2) : isAbsolutePosix(path2);
|
|
81
|
+
const trailingSeparator = path2[path2.length - 1] === separator || isWin && path2[path2.length - 1] === "/";
|
|
82
|
+
let normalized = path2.replace(isWin ? /[\/\\]+/g : /\/+/g, separator);
|
|
83
|
+
const parts = normalized.split(separator);
|
|
84
|
+
const result = [];
|
|
85
|
+
for (let i = 0; i < parts.length; i++) {
|
|
86
|
+
const part = parts[i];
|
|
87
|
+
if (part === "" || part === ".") {
|
|
88
|
+
if (i === 0 && isAbsolute) result.push("");
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (part === "..") {
|
|
92
|
+
if (result.length > 0 && result[result.length - 1] !== "..") {
|
|
93
|
+
if (!(result.length === 1 && result[0] === "")) {
|
|
94
|
+
result.pop();
|
|
95
|
+
}
|
|
96
|
+
} else if (!isAbsolute) {
|
|
97
|
+
result.push("..");
|
|
98
|
+
}
|
|
99
|
+
} else {
|
|
100
|
+
result.push(part);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
let final = result.join(separator);
|
|
104
|
+
if (final.length === 0) {
|
|
105
|
+
return isAbsolute ? separator : ".";
|
|
106
|
+
}
|
|
107
|
+
if (trailingSeparator && final[final.length - 1] !== separator) {
|
|
108
|
+
final += separator;
|
|
109
|
+
}
|
|
110
|
+
return final;
|
|
111
|
+
}
|
|
112
|
+
function joinPaths(paths, isWin) {
|
|
113
|
+
if (paths.length === 0) return ".";
|
|
114
|
+
const separator = getSeparator(isWin);
|
|
115
|
+
let joined = "";
|
|
116
|
+
for (let i = 0; i < paths.length; i++) {
|
|
117
|
+
const path2 = paths[i];
|
|
118
|
+
if (path2 && path2.length > 0) {
|
|
119
|
+
if (joined.length === 0) {
|
|
120
|
+
joined = path2;
|
|
121
|
+
} else {
|
|
122
|
+
joined += separator + path2;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (joined.length === 0) return ".";
|
|
127
|
+
return normalizePath(joined, isWin);
|
|
128
|
+
}
|
|
129
|
+
function resolvePaths(paths, isWin) {
|
|
130
|
+
const separator = getSeparator(isWin);
|
|
131
|
+
let resolved = "";
|
|
132
|
+
let isAbsolute = false;
|
|
133
|
+
for (let i = paths.length - 1; i >= 0 && !isAbsolute; i--) {
|
|
134
|
+
const path2 = paths[i];
|
|
135
|
+
if (path2 && path2.length > 0) {
|
|
136
|
+
resolved = path2 + (resolved.length > 0 ? separator + resolved : "");
|
|
137
|
+
isAbsolute = isWin ? isAbsoluteWin(resolved) : isAbsolutePosix(resolved);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (!isAbsolute) {
|
|
141
|
+
const cwd = getCwd();
|
|
142
|
+
resolved = cwd + (resolved.length > 0 ? separator + resolved : "");
|
|
143
|
+
}
|
|
144
|
+
return normalizePath(resolved, isWin);
|
|
145
|
+
}
|
|
146
|
+
function relativePath(from, to, isWin) {
|
|
147
|
+
from = resolvePaths([from], isWin);
|
|
148
|
+
to = resolvePaths([to], isWin);
|
|
149
|
+
if (from === to) return "";
|
|
150
|
+
const separator = getSeparator(isWin);
|
|
151
|
+
const fromParts = from.split(separator).filter((p) => p.length > 0);
|
|
152
|
+
const toParts = to.split(separator).filter((p) => p.length > 0);
|
|
153
|
+
let commonLength = 0;
|
|
154
|
+
const minLength = Math.min(fromParts.length, toParts.length);
|
|
155
|
+
for (let i = 0; i < minLength; i++) {
|
|
156
|
+
if (fromParts[i] === toParts[i]) {
|
|
157
|
+
commonLength++;
|
|
158
|
+
} else {
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const upCount = fromParts.length - commonLength;
|
|
163
|
+
const result = [];
|
|
164
|
+
for (let i = 0; i < upCount; i++) {
|
|
165
|
+
result.push("..");
|
|
166
|
+
}
|
|
167
|
+
for (let i = commonLength; i < toParts.length; i++) {
|
|
168
|
+
result.push(toParts[i]);
|
|
169
|
+
}
|
|
170
|
+
return result.join(separator) || ".";
|
|
171
|
+
}
|
|
172
|
+
function getDirname(path2, isWin) {
|
|
173
|
+
if (path2.length === 0) return ".";
|
|
174
|
+
const separator = getSeparator(isWin);
|
|
175
|
+
const normalized = normalizePath(path2, isWin);
|
|
176
|
+
const lastSepIndex = normalized.lastIndexOf(separator);
|
|
177
|
+
if (lastSepIndex === -1) return ".";
|
|
178
|
+
if (lastSepIndex === 0) return separator;
|
|
179
|
+
return normalized.slice(0, lastSepIndex);
|
|
180
|
+
}
|
|
181
|
+
function getBasename(path2, ext, isWin) {
|
|
182
|
+
if (path2.length === 0) return "";
|
|
183
|
+
const lastSepIndex = isWin ? findLastSeparator(path2) : path2.lastIndexOf("/");
|
|
184
|
+
let base = lastSepIndex === -1 ? path2 : path2.slice(lastSepIndex + 1);
|
|
185
|
+
if (ext && base.endsWith(ext)) {
|
|
186
|
+
base = base.slice(0, base.length - ext.length);
|
|
187
|
+
}
|
|
188
|
+
return base;
|
|
189
|
+
}
|
|
190
|
+
function getExtname(path2) {
|
|
191
|
+
const lastDotIndex = path2.lastIndexOf(".");
|
|
192
|
+
const lastSepIndex = findLastSeparator(path2);
|
|
193
|
+
if (lastDotIndex === -1 || lastDotIndex < lastSepIndex || lastDotIndex === path2.length - 1) {
|
|
194
|
+
return "";
|
|
195
|
+
}
|
|
196
|
+
return path2.slice(lastDotIndex);
|
|
197
|
+
}
|
|
198
|
+
function parsePath(path2, isWin) {
|
|
199
|
+
let root = "";
|
|
200
|
+
if (isWin) {
|
|
201
|
+
if (path2.length >= 2 && path2[1] === ":") {
|
|
202
|
+
root = path2.slice(0, 2);
|
|
203
|
+
if (path2.length > 2 && (path2[2] === "\\" || path2[2] === "/")) {
|
|
204
|
+
root += "\\";
|
|
205
|
+
}
|
|
206
|
+
} else if (path2[0] === "\\" || path2[0] === "/") {
|
|
207
|
+
root = "\\";
|
|
208
|
+
}
|
|
209
|
+
} else {
|
|
210
|
+
if (path2[0] === "/") {
|
|
211
|
+
root = "/";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const dir = getDirname(path2, isWin);
|
|
215
|
+
const base = getBasename(path2, void 0, isWin);
|
|
216
|
+
const ext = getExtname(path2);
|
|
217
|
+
const name = ext ? base.slice(0, base.length - ext.length) : base;
|
|
218
|
+
return { root, dir, base, ext, name };
|
|
219
|
+
}
|
|
220
|
+
function formatPath(pathObject, isWin) {
|
|
221
|
+
const separator = getSeparator(isWin);
|
|
222
|
+
const dir = pathObject.dir || pathObject.root || "";
|
|
223
|
+
const base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
224
|
+
if (!dir) return base;
|
|
225
|
+
if (dir === pathObject.root) return dir + base;
|
|
226
|
+
return dir + separator + base;
|
|
227
|
+
}
|
|
228
|
+
function resolve(...paths) {
|
|
229
|
+
return resolvePaths(paths, isWindows);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// src/database.ts
|
|
233
|
+
import path from "path";
|
|
234
|
+
import fs from "fs";
|
|
235
|
+
import * as esbuild from "esbuild";
|
|
236
|
+
var Database = class {
|
|
237
|
+
constructor(config) {
|
|
238
|
+
this._config = {
|
|
239
|
+
dir: resolve(process.cwd(), "databases")
|
|
240
|
+
};
|
|
241
|
+
this._config = { ...this._config, ...config };
|
|
242
|
+
this._registerModules = config.registerModules || {};
|
|
243
|
+
this._ctx = vm.createContext(this._registerModules);
|
|
244
|
+
}
|
|
245
|
+
set config(config) {
|
|
246
|
+
this._config = { ...this._config, ...config };
|
|
247
|
+
}
|
|
248
|
+
register(context) {
|
|
249
|
+
this._registerModules = { ...this._registerModules, ...context };
|
|
250
|
+
this._ctx = vm.createContext(this._registerModules);
|
|
251
|
+
}
|
|
252
|
+
plugin(moduleName, moduleContent) {
|
|
253
|
+
this.register({ [moduleName]: moduleContent });
|
|
254
|
+
}
|
|
255
|
+
resolvePath(fileList, query) {
|
|
256
|
+
const aliases = { "@db": this._config.dir || resolve(process.cwd(), "databases") };
|
|
257
|
+
let resolvedPath = query;
|
|
258
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
259
|
+
if (resolvedPath.startsWith(alias + "/")) {
|
|
260
|
+
resolvedPath = resolvedPath.replace(alias, target);
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
resolvedPath = path.normalize(resolvedPath);
|
|
265
|
+
return fileList.find((file) => {
|
|
266
|
+
const normalizedFile = path.normalize(file);
|
|
267
|
+
const fileWithoutExt = normalizedFile.replace(/\.[^/.]+$/, "");
|
|
268
|
+
return normalizedFile === resolvedPath || fileWithoutExt === resolvedPath || normalizedFile === resolvedPath + ".ts" || normalizedFile === resolvedPath + ".js";
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
async moduleLinker(specifier, referencingModule) {
|
|
272
|
+
const dbFiles = fs.readdirSync(this._config.dir || resolve(process.cwd(), "databases")).filter((f) => f.endsWith(".ts")).map((f) => path.join(this._config.dir || resolve(process.cwd(), "databases"), f));
|
|
273
|
+
const dbResult = this.resolvePath(dbFiles, specifier);
|
|
274
|
+
if (dbResult) {
|
|
275
|
+
try {
|
|
276
|
+
const actualModule = await import(dbResult);
|
|
277
|
+
const exportNames = Object.keys(actualModule);
|
|
278
|
+
return new vm.SyntheticModule(
|
|
279
|
+
exportNames,
|
|
280
|
+
function() {
|
|
281
|
+
exportNames.forEach((key) => {
|
|
282
|
+
this.setExport(key, actualModule[key]);
|
|
283
|
+
});
|
|
284
|
+
},
|
|
285
|
+
{ identifier: specifier, context: referencingModule.context }
|
|
286
|
+
);
|
|
287
|
+
} catch (err) {
|
|
288
|
+
console.error(`Failed to load database module ${specifier}:`, err);
|
|
289
|
+
throw err;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
throw new Error(`Module ${specifier} is not allowed or not found.`);
|
|
293
|
+
}
|
|
294
|
+
async vmRun(code, _options) {
|
|
295
|
+
const logs = [];
|
|
296
|
+
const customConsole = ["log", "error", "warn", "info", "debug", "trace"].reduce((acc, type) => {
|
|
297
|
+
acc[type] = (...args) => logs.push({ type, args });
|
|
298
|
+
return acc;
|
|
299
|
+
}, {});
|
|
300
|
+
this.register({
|
|
301
|
+
console: customConsole
|
|
302
|
+
});
|
|
303
|
+
let stringCode;
|
|
304
|
+
if (typeof code === "function") {
|
|
305
|
+
const funcStr = code.toString();
|
|
306
|
+
if (funcStr.includes("=>")) {
|
|
307
|
+
const arrowIndex = funcStr.indexOf("=>");
|
|
308
|
+
let start = arrowIndex + 2;
|
|
309
|
+
while (start < funcStr.length && funcStr[start] === " ") start++;
|
|
310
|
+
if (funcStr[start] === "{") start++;
|
|
311
|
+
let end = funcStr.lastIndexOf("}");
|
|
312
|
+
if (start < end) {
|
|
313
|
+
stringCode = funcStr.substring(start, end);
|
|
314
|
+
} else {
|
|
315
|
+
stringCode = funcStr.substring(start);
|
|
316
|
+
}
|
|
317
|
+
} else if (funcStr.includes("function")) {
|
|
318
|
+
const funcIndex = funcStr.indexOf("function");
|
|
319
|
+
let start = funcIndex + 8;
|
|
320
|
+
while (start < funcStr.length && funcStr[start] === " ") start++;
|
|
321
|
+
if (funcStr[start] === "(") start++;
|
|
322
|
+
if (start < funcStr.length && funcStr[start] !== "(") {
|
|
323
|
+
while (start < funcStr.length && funcStr[start] !== " " && funcStr[start] !== "(") start++;
|
|
324
|
+
}
|
|
325
|
+
if (funcStr[start] === "(") start++;
|
|
326
|
+
while (start < funcStr.length && funcStr[start] === " ") start++;
|
|
327
|
+
if (funcStr[start] === "{") start++;
|
|
328
|
+
const end = funcStr.lastIndexOf("}");
|
|
329
|
+
if (start < end) {
|
|
330
|
+
stringCode = funcStr.substring(start, end);
|
|
331
|
+
} else {
|
|
332
|
+
stringCode = funcStr.substring(start);
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
stringCode = funcStr;
|
|
336
|
+
}
|
|
337
|
+
stringCode = stringCode.trim();
|
|
338
|
+
let importPos = 0;
|
|
339
|
+
while ((importPos = stringCode.indexOf("import(", importPos)) !== -1) {
|
|
340
|
+
const fromPos = stringCode.indexOf(".from(", importPos);
|
|
341
|
+
if (fromPos === -1) break;
|
|
342
|
+
const quoteStart = stringCode.indexOf("(", fromPos + 7) + 1;
|
|
343
|
+
if (quoteStart === -1) break;
|
|
344
|
+
const quoteChar = stringCode[quoteStart];
|
|
345
|
+
if (quoteChar !== '"' && quoteChar !== "'") break;
|
|
346
|
+
const quoteEnd = stringCode.indexOf(quoteChar, quoteStart + 1);
|
|
347
|
+
if (quoteEnd === -1) break;
|
|
348
|
+
const modulePath = stringCode.substring(quoteStart + 1, quoteEnd);
|
|
349
|
+
const importArgEnd = fromPos - 1;
|
|
350
|
+
const importArgStart = importPos + 7;
|
|
351
|
+
const trimmed = stringCode.substring(importArgStart, importArgEnd).trim();
|
|
352
|
+
let replacement;
|
|
353
|
+
if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
|
|
354
|
+
const inner = trimmed.slice(1, -1).trim();
|
|
355
|
+
replacement = `import { ${inner} } from "${modulePath}"`;
|
|
356
|
+
} else {
|
|
357
|
+
replacement = `import ${trimmed} from "${modulePath}"`;
|
|
358
|
+
}
|
|
359
|
+
const before = stringCode.substring(0, importPos);
|
|
360
|
+
const after = stringCode.substring(quoteEnd + 2);
|
|
361
|
+
stringCode = before + replacement + after;
|
|
362
|
+
}
|
|
363
|
+
const lines = stringCode.split("\n");
|
|
364
|
+
const trimmedLines = lines.map((line) => line.trim());
|
|
365
|
+
stringCode = trimmedLines.join("\n").trim();
|
|
366
|
+
} else {
|
|
367
|
+
stringCode = code;
|
|
368
|
+
}
|
|
369
|
+
const result = await esbuild.build({
|
|
370
|
+
stdin: {
|
|
371
|
+
contents: stringCode,
|
|
372
|
+
loader: this._config.language || "ts"
|
|
373
|
+
},
|
|
374
|
+
format: "esm",
|
|
375
|
+
target: "es2020",
|
|
376
|
+
write: false,
|
|
377
|
+
bundle: false,
|
|
378
|
+
sourcemap: false
|
|
379
|
+
});
|
|
380
|
+
const js = result.outputFiles[0].text;
|
|
381
|
+
const mod = new vm.SourceTextModule(js, { context: this._ctx, identifier: path.join(this._config.dir || resolve(process.cwd(), "databases"), "virtual-entry.js") });
|
|
382
|
+
await mod.link(this.moduleLinker.bind(this));
|
|
383
|
+
await mod.evaluate();
|
|
384
|
+
return {
|
|
385
|
+
namespace: mod.namespace,
|
|
386
|
+
logs
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Execute database code and return results
|
|
391
|
+
*/
|
|
392
|
+
async execute(code, options) {
|
|
393
|
+
return await this.vmRun(code, options);
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
function database() {
|
|
397
|
+
return new Database({
|
|
398
|
+
dir: resolve(process.cwd(), "databases")
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
var database_default = database;
|
|
402
|
+
export {
|
|
403
|
+
Database,
|
|
404
|
+
database,
|
|
405
|
+
database_default as default
|
|
406
|
+
};
|
package/dist/hmr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACxB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACxC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iDAAiD;IACjD,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACzC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,EAAE,SAAS,CAAC;KACzB;CACF;AAED,cAAM,OAAQ,YAAW,SAAS;IAChC,OAAO,UAAS;IAChB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,QAAQ,CAAS;;IAgBzB,OAAO,CAAC,OAAO;IAgCf,OAAO,CAAC,aAAa;
|
|
1
|
+
{"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,SAAS;IACxB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,4CAA4C;IAC5C,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACxC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iDAAiD;IACjD,OAAO,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;CACzC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,YAAY,EAAE,SAAS,CAAC;KACzB;CACF;AAED,cAAM,OAAQ,YAAW,SAAS;IAChC,OAAO,UAAS;IAChB,OAAO,CAAC,EAAE,CAA0B;IACpC,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,gBAAgB,CAAsB;IAC9C,OAAO,CAAC,QAAQ,CAAS;;IAgBzB,OAAO,CAAC,OAAO;IAgCf,OAAO,CAAC,aAAa;IAsCrB,MAAM;IAIN,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI;IAO5B,OAAO;IAIP,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI;CAG7B;AAGD,QAAA,MAAM,GAAG,SAAgB,CAAC;AAO1B,eAAe,GAAG,CAAC"}
|
package/dist/hmr.js
CHANGED
|
@@ -58,8 +58,7 @@ var ElitHMR = class {
|
|
|
58
58
|
};
|
|
59
59
|
this.ws.onclose = () => {
|
|
60
60
|
this.enabled = false;
|
|
61
|
-
console.log("[Elit HMR] Disconnected -
|
|
62
|
-
setTimeout(() => this.reload(), 1e3);
|
|
61
|
+
console.log("[Elit HMR] Disconnected - HMR disabled until manual refresh");
|
|
63
62
|
};
|
|
64
63
|
this.ws.onerror = (error) => {
|
|
65
64
|
console.error("[Elit HMR] WebSocket error:", error);
|
|
@@ -80,13 +79,13 @@ var ElitHMR = class {
|
|
|
80
79
|
this.disposeCallbacks = [];
|
|
81
80
|
if (this.acceptCallbacks.length > 0) {
|
|
82
81
|
this.acceptCallbacks.forEach((cb) => cb());
|
|
82
|
+
console.log("[Elit HMR] Update accepted via callback");
|
|
83
83
|
} else {
|
|
84
|
-
|
|
84
|
+
console.log("[Elit HMR] Update detected - manually refresh to see changes");
|
|
85
85
|
}
|
|
86
86
|
break;
|
|
87
87
|
case "reload":
|
|
88
|
-
console.log("[Elit HMR] Full reload requested");
|
|
89
|
-
this.reload();
|
|
88
|
+
console.log("[Elit HMR] Full reload requested - manually refresh to see changes");
|
|
90
89
|
break;
|
|
91
90
|
case "error":
|
|
92
91
|
console.error("[Elit HMR] Server error:", data.error);
|
package/dist/hmr.mjs
CHANGED
|
@@ -34,8 +34,7 @@ var ElitHMR = class {
|
|
|
34
34
|
};
|
|
35
35
|
this.ws.onclose = () => {
|
|
36
36
|
this.enabled = false;
|
|
37
|
-
console.log("[Elit HMR] Disconnected -
|
|
38
|
-
setTimeout(() => this.reload(), 1e3);
|
|
37
|
+
console.log("[Elit HMR] Disconnected - HMR disabled until manual refresh");
|
|
39
38
|
};
|
|
40
39
|
this.ws.onerror = (error) => {
|
|
41
40
|
console.error("[Elit HMR] WebSocket error:", error);
|
|
@@ -56,13 +55,13 @@ var ElitHMR = class {
|
|
|
56
55
|
this.disposeCallbacks = [];
|
|
57
56
|
if (this.acceptCallbacks.length > 0) {
|
|
58
57
|
this.acceptCallbacks.forEach((cb) => cb());
|
|
58
|
+
console.log("[Elit HMR] Update accepted via callback");
|
|
59
59
|
} else {
|
|
60
|
-
|
|
60
|
+
console.log("[Elit HMR] Update detected - manually refresh to see changes");
|
|
61
61
|
}
|
|
62
62
|
break;
|
|
63
63
|
case "reload":
|
|
64
|
-
console.log("[Elit HMR] Full reload requested");
|
|
65
|
-
this.reload();
|
|
64
|
+
console.log("[Elit HMR] Full reload requested - manually refresh to see changes");
|
|
66
65
|
break;
|
|
67
66
|
case "error":
|
|
68
67
|
console.error("[Elit HMR] Server error:", data.error);
|
package/dist/http.d.mts
CHANGED
|
@@ -66,6 +66,9 @@ declare class ServerResponse extends EventEmitter {
|
|
|
66
66
|
write(chunk: any, encoding?: BufferEncoding | (() => void), callback?: () => void): boolean;
|
|
67
67
|
end(chunk?: any, encoding?: BufferEncoding | (() => void), callback?: () => void): this;
|
|
68
68
|
_setResolver(resolve: (response: Response) => void): void;
|
|
69
|
+
json(data: any, statusCode?: number): this;
|
|
70
|
+
send(data: any): this;
|
|
71
|
+
status(code: number): this;
|
|
69
72
|
}
|
|
70
73
|
/**
|
|
71
74
|
* Server - Optimized for each runtime
|
package/dist/http.d.ts
CHANGED
|
@@ -64,6 +64,9 @@ export declare class ServerResponse extends EventEmitter {
|
|
|
64
64
|
write(chunk: any, encoding?: BufferEncoding | (() => void), callback?: () => void): boolean;
|
|
65
65
|
end(chunk?: any, encoding?: BufferEncoding | (() => void), callback?: () => void): this;
|
|
66
66
|
_setResolver(resolve: (response: Response) => void): void;
|
|
67
|
+
json(data: any, statusCode?: number): this;
|
|
68
|
+
send(data: any): this;
|
|
69
|
+
status(code: number): this;
|
|
67
70
|
}
|
|
68
71
|
/**
|
|
69
72
|
* Server - Optimized for each runtime
|
package/dist/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA0E3C;;GAEG;AACH,eAAO,MAAM,OAAO,2FAGV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAmB/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;AAChF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;AAE7E;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,mBAAmB,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAS;IAC5B,UAAU,EAAE,MAAM,EAAE,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AAG,MAAM,CAEpD;AAED;;GAEG;;;;;;;;;;;;;;AACH,wBAYE"}
|
package/dist/http.js
CHANGED
|
@@ -327,6 +327,29 @@ var ServerResponse = class extends import_node_events.EventEmitter {
|
|
|
327
327
|
_setResolver(resolve) {
|
|
328
328
|
this._resolve = resolve;
|
|
329
329
|
}
|
|
330
|
+
// Express.js-like methods
|
|
331
|
+
json(data, statusCode = 200) {
|
|
332
|
+
if (!this.headersSent) {
|
|
333
|
+
this.setHeader("Content-Type", "application/json");
|
|
334
|
+
}
|
|
335
|
+
this.statusCode = statusCode;
|
|
336
|
+
this.end(JSON.stringify(data));
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
send(data) {
|
|
340
|
+
if (typeof data === "object") {
|
|
341
|
+
return this.json(data);
|
|
342
|
+
}
|
|
343
|
+
if (!this.headersSent) {
|
|
344
|
+
this.setHeader("Content-Type", "text/plain");
|
|
345
|
+
}
|
|
346
|
+
this.end(String(data));
|
|
347
|
+
return this;
|
|
348
|
+
}
|
|
349
|
+
status(code) {
|
|
350
|
+
this.statusCode = code;
|
|
351
|
+
return this;
|
|
352
|
+
}
|
|
330
353
|
};
|
|
331
354
|
var Server = class extends import_node_events.EventEmitter {
|
|
332
355
|
constructor(requestListener) {
|
package/dist/http.mjs
CHANGED
|
@@ -300,6 +300,29 @@ var ServerResponse = class extends EventEmitter {
|
|
|
300
300
|
_setResolver(resolve) {
|
|
301
301
|
this._resolve = resolve;
|
|
302
302
|
}
|
|
303
|
+
// Express.js-like methods
|
|
304
|
+
json(data, statusCode = 200) {
|
|
305
|
+
if (!this.headersSent) {
|
|
306
|
+
this.setHeader("Content-Type", "application/json");
|
|
307
|
+
}
|
|
308
|
+
this.statusCode = statusCode;
|
|
309
|
+
this.end(JSON.stringify(data));
|
|
310
|
+
return this;
|
|
311
|
+
}
|
|
312
|
+
send(data) {
|
|
313
|
+
if (typeof data === "object") {
|
|
314
|
+
return this.json(data);
|
|
315
|
+
}
|
|
316
|
+
if (!this.headersSent) {
|
|
317
|
+
this.setHeader("Content-Type", "text/plain");
|
|
318
|
+
}
|
|
319
|
+
this.end(String(data));
|
|
320
|
+
return this;
|
|
321
|
+
}
|
|
322
|
+
status(code) {
|
|
323
|
+
this.statusCode = code;
|
|
324
|
+
return this;
|
|
325
|
+
}
|
|
303
326
|
};
|
|
304
327
|
var Server = class extends EventEmitter {
|
|
305
328
|
constructor(requestListener) {
|
package/dist/https.js
CHANGED
|
@@ -384,6 +384,29 @@ var init_http = __esm({
|
|
|
384
384
|
_setResolver(resolve) {
|
|
385
385
|
this._resolve = resolve;
|
|
386
386
|
}
|
|
387
|
+
// Express.js-like methods
|
|
388
|
+
json(data, statusCode = 200) {
|
|
389
|
+
if (!this.headersSent) {
|
|
390
|
+
this.setHeader("Content-Type", "application/json");
|
|
391
|
+
}
|
|
392
|
+
this.statusCode = statusCode;
|
|
393
|
+
this.end(JSON.stringify(data));
|
|
394
|
+
return this;
|
|
395
|
+
}
|
|
396
|
+
send(data) {
|
|
397
|
+
if (typeof data === "object") {
|
|
398
|
+
return this.json(data);
|
|
399
|
+
}
|
|
400
|
+
if (!this.headersSent) {
|
|
401
|
+
this.setHeader("Content-Type", "text/plain");
|
|
402
|
+
}
|
|
403
|
+
this.end(String(data));
|
|
404
|
+
return this;
|
|
405
|
+
}
|
|
406
|
+
status(code) {
|
|
407
|
+
this.statusCode = code;
|
|
408
|
+
return this;
|
|
409
|
+
}
|
|
387
410
|
};
|
|
388
411
|
Server = class extends import_node_events.EventEmitter {
|
|
389
412
|
constructor(requestListener) {
|
package/dist/https.mjs
CHANGED
|
@@ -390,6 +390,29 @@ var init_http = __esm({
|
|
|
390
390
|
_setResolver(resolve) {
|
|
391
391
|
this._resolve = resolve;
|
|
392
392
|
}
|
|
393
|
+
// Express.js-like methods
|
|
394
|
+
json(data, statusCode = 200) {
|
|
395
|
+
if (!this.headersSent) {
|
|
396
|
+
this.setHeader("Content-Type", "application/json");
|
|
397
|
+
}
|
|
398
|
+
this.statusCode = statusCode;
|
|
399
|
+
this.end(JSON.stringify(data));
|
|
400
|
+
return this;
|
|
401
|
+
}
|
|
402
|
+
send(data) {
|
|
403
|
+
if (typeof data === "object") {
|
|
404
|
+
return this.json(data);
|
|
405
|
+
}
|
|
406
|
+
if (!this.headersSent) {
|
|
407
|
+
this.setHeader("Content-Type", "text/plain");
|
|
408
|
+
}
|
|
409
|
+
this.end(String(data));
|
|
410
|
+
return this;
|
|
411
|
+
}
|
|
412
|
+
status(code) {
|
|
413
|
+
this.statusCode = code;
|
|
414
|
+
return this;
|
|
415
|
+
}
|
|
393
416
|
};
|
|
394
417
|
Server = class extends EventEmitter {
|
|
395
418
|
constructor(requestListener) {
|
package/dist/index.js
CHANGED
|
@@ -2280,8 +2280,7 @@ var ElitHMR = class {
|
|
|
2280
2280
|
};
|
|
2281
2281
|
this.ws.onclose = () => {
|
|
2282
2282
|
this.enabled = false;
|
|
2283
|
-
console.log("[Elit HMR] Disconnected -
|
|
2284
|
-
setTimeout(() => this.reload(), 1e3);
|
|
2283
|
+
console.log("[Elit HMR] Disconnected - HMR disabled until manual refresh");
|
|
2285
2284
|
};
|
|
2286
2285
|
this.ws.onerror = (error) => {
|
|
2287
2286
|
console.error("[Elit HMR] WebSocket error:", error);
|
|
@@ -2302,13 +2301,13 @@ var ElitHMR = class {
|
|
|
2302
2301
|
this.disposeCallbacks = [];
|
|
2303
2302
|
if (this.acceptCallbacks.length > 0) {
|
|
2304
2303
|
this.acceptCallbacks.forEach((cb) => cb());
|
|
2304
|
+
console.log("[Elit HMR] Update accepted via callback");
|
|
2305
2305
|
} else {
|
|
2306
|
-
|
|
2306
|
+
console.log("[Elit HMR] Update detected - manually refresh to see changes");
|
|
2307
2307
|
}
|
|
2308
2308
|
break;
|
|
2309
2309
|
case "reload":
|
|
2310
|
-
console.log("[Elit HMR] Full reload requested");
|
|
2311
|
-
this.reload();
|
|
2310
|
+
console.log("[Elit HMR] Full reload requested - manually refresh to see changes");
|
|
2312
2311
|
break;
|
|
2313
2312
|
case "error":
|
|
2314
2313
|
console.error("[Elit HMR] Server error:", data2.error);
|