elit 3.2.2 → 3.2.4

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/cli.js CHANGED
@@ -1435,7 +1435,7 @@ var require_package = __commonJS({
1435
1435
  "package.json"(exports2, module2) {
1436
1436
  module2.exports = {
1437
1437
  name: "elit",
1438
- version: "3.2.2",
1438
+ version: "3.2.4",
1439
1439
  description: "Optimized lightweight library for creating DOM elements with reactive state",
1440
1440
  main: "dist/index.js",
1441
1441
  module: "dist/index.mjs",
@@ -1711,8 +1711,14 @@ async function loadConfigFile(configPath) {
1711
1711
  write: true,
1712
1712
  target: "es2020",
1713
1713
  // Bundle everything including elit/* so config can use elit modules
1714
- // Only mark Node.js built-ins as external
1715
- external: ["node:*"],
1714
+ // Only mark Node.js built-ins and runtime-specific packages as external
1715
+ external: [
1716
+ "node:*",
1717
+ "bun",
1718
+ "bun:*",
1719
+ "deno",
1720
+ "deno:*"
1721
+ ],
1716
1722
  // Use the config directory as the working directory for resolution
1717
1723
  absWorkingDir: configDir
1718
1724
  });
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA2C9E,MAAM,WAAW,UAAU;IACvB,uCAAuC;IACvC,GAAG,CAAC,EAAE,gBAAgB,CAAC;IACvB,qEAAqE;IACrE,KAAK,CAAC,EAAE,YAAY,GAAG,YAAY,EAAE,CAAC;IACtC,mCAAmC;IACnC,OAAO,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAE3D;AAUD;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,GAAE,MAAsB,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAAC,MAAM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9
  }
10
10
  declare class Database {
11
+ private _transpiler;
11
12
  private _ctx;
12
13
  private _registerModules;
13
14
  private _config;
@@ -7,6 +7,7 @@ export interface DatabaseConfig {
7
7
  };
8
8
  }
9
9
  export declare class Database {
10
+ private _transpiler;
10
11
  private _ctx;
11
12
  private _registerModules;
12
13
  private _config;
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAMzB,MAAM,WAAW,cAAc;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,eAAe,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAC5C;AAED,qBAAa,QAAQ;IACjB,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,gBAAgB,CAAyB;IACjD,OAAO,CAAC,OAAO,CAEb;gBAEU,MAAM,EAAE,cAAc;IAMlC,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,EAEhC;IAED,OAAO,CAAC,QAAQ;IAMhB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG;IAI7C,OAAO,CAAC,WAAW;YAwBL,YAAY;YA6BZ,KAAK;IAkJnB;;OAEG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,kBAAkB,GAAG,MAAM;;;;CAIlF;AAkVD,wBAAgB,QAAQ,aAIvB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC5C,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,MAAM,EAAE,MAAM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AIvB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC5C,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACvD,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;IAC5C,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACjD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,GAAG,GAAG,IAAI,CAAC;IAC1D,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,GAAG,CAAC;CACxE;AAED,eAAO,MAAM,SAAS,EAAE,eAQvB,CAAA;AACD,eAAe,QAAQ,CAAC"}
package/dist/database.js CHANGED
@@ -267,7 +267,7 @@ function resolve(...paths) {
267
267
  // src/database.ts
268
268
  var import_node_path = __toESM(require("path"));
269
269
  var import_node_fs = __toESM(require("fs"));
270
- var esbuild = __toESM(require("esbuild"));
270
+ var import_bun = __toESM(require("bun"));
271
271
  var Database = class {
272
272
  constructor(config) {
273
273
  this._config = {
@@ -276,6 +276,9 @@ var Database = class {
276
276
  this._config = { ...this._config, ...config };
277
277
  this._registerModules = config.registerModules || {};
278
278
  this._ctx = import_node_vm.default.createContext(this._registerModules);
279
+ this._transpiler = new import_bun.default.Transpiler({
280
+ loader: config?.language || "ts"
281
+ });
279
282
  }
280
283
  set config(config) {
281
284
  this._config = { ...this._config, ...config };
@@ -409,18 +412,7 @@ var Database = class {
409
412
  } else {
410
413
  stringCode = code;
411
414
  }
412
- const result = await esbuild.build({
413
- stdin: {
414
- contents: stringCode,
415
- loader: this._config.language || "ts"
416
- },
417
- format: "esm",
418
- target: "es2020",
419
- write: false,
420
- bundle: false,
421
- sourcemap: false
422
- });
423
- const js = result.outputFiles[0].text;
415
+ const js = this._transpiler.transformSync(stringCode);
424
416
  const mod = new import_node_vm.default.SourceTextModule(js, { context: this._ctx, identifier: import_node_path.default.join(this._config.dir || resolve(process.cwd(), "databases"), "virtual-entry.js") });
425
417
  await mod.link(this.moduleLinker.bind(this));
426
418
  await mod.evaluate();
package/dist/database.mjs CHANGED
@@ -232,7 +232,7 @@ function resolve(...paths) {
232
232
  // src/database.ts
233
233
  import path from "path";
234
234
  import fs from "fs";
235
- import * as esbuild from "esbuild";
235
+ import Bun2 from "bun";
236
236
  var Database = class {
237
237
  constructor(config) {
238
238
  this._config = {
@@ -241,6 +241,9 @@ var Database = class {
241
241
  this._config = { ...this._config, ...config };
242
242
  this._registerModules = config.registerModules || {};
243
243
  this._ctx = vm.createContext(this._registerModules);
244
+ this._transpiler = new Bun2.Transpiler({
245
+ loader: config?.language || "ts"
246
+ });
244
247
  }
245
248
  set config(config) {
246
249
  this._config = { ...this._config, ...config };
@@ -374,18 +377,7 @@ var Database = class {
374
377
  } else {
375
378
  stringCode = code;
376
379
  }
377
- const result = await esbuild.build({
378
- stdin: {
379
- contents: stringCode,
380
- loader: this._config.language || "ts"
381
- },
382
- format: "esm",
383
- target: "es2020",
384
- write: false,
385
- bundle: false,
386
- sourcemap: false
387
- });
388
- const js = result.outputFiles[0].text;
380
+ const js = this._transpiler.transformSync(stringCode);
389
381
  const mod = new vm.SourceTextModule(js, { context: this._ctx, identifier: path.join(this._config.dir || resolve(process.cwd(), "databases"), "virtual-entry.js") });
390
382
  await mod.link(this.moduleLinker.bind(this));
391
383
  await mod.evaluate();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elit",
3
- "version": "3.2.2",
3
+ "version": "3.2.4",
4
4
  "description": "Optimized lightweight library for creating DOM elements with reactive state",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/config.ts CHANGED
@@ -161,8 +161,14 @@ async function loadConfigFile(configPath: string): Promise<ElitConfig> {
161
161
  write: true,
162
162
  target: 'es2020',
163
163
  // Bundle everything including elit/* so config can use elit modules
164
- // Only mark Node.js built-ins as external
165
- external: ['node:*'],
164
+ // Only mark Node.js built-ins and runtime-specific packages as external
165
+ external: [
166
+ 'node:*',
167
+ 'bun',
168
+ 'bun:*',
169
+ 'deno',
170
+ 'deno:*'
171
+ ],
166
172
  // Use the config directory as the working directory for resolution
167
173
  absWorkingDir: configDir,
168
174
  });
package/src/database.ts CHANGED
@@ -2,7 +2,7 @@ import vm from "node:vm";
2
2
  import { resolve } from "./path";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs";
5
- import * as esbuild from 'esbuild';
5
+ import Bun from "bun";
6
6
 
7
7
  export interface DatabaseConfig {
8
8
  dir?: string;
@@ -11,6 +11,7 @@ export interface DatabaseConfig {
11
11
  }
12
12
 
13
13
  export class Database {
14
+ private _transpiler: Bun.Transpiler;
14
15
  private _ctx: vm.Context;
15
16
  private _registerModules: { [key: string]: any };
16
17
  private _config: DatabaseConfig = {
@@ -21,6 +22,9 @@ export class Database {
21
22
  this._config = { ...this._config, ...config };
22
23
  this._registerModules = config.registerModules || {};
23
24
  this._ctx = vm.createContext(this._registerModules);
25
+ this._transpiler = new Bun.Transpiler({
26
+ loader: config?.language || 'ts',
27
+ });
24
28
  }
25
29
 
26
30
  set config(config: DatabaseConfig) {
@@ -213,19 +217,7 @@ export class Database {
213
217
  stringCode = code;
214
218
  }
215
219
 
216
- // Transpile using esbuild
217
- const result = await esbuild.build({
218
- stdin: {
219
- contents: stringCode,
220
- loader: this._config.language || 'ts',
221
- },
222
- format: 'esm',
223
- target: 'es2020',
224
- write: false,
225
- bundle: false,
226
- sourcemap: false,
227
- });
228
- const js = result.outputFiles[0].text;
220
+ const js = this._transpiler.transformSync(stringCode);
229
221
 
230
222
  const mod = new vm.SourceTextModule(js, { context: this._ctx, identifier: path.join(this._config.dir || resolve(process.cwd(), 'databases'), 'virtual-entry.js') });
231
223
  await mod.link(this.moduleLinker.bind(this));