elit 3.2.5 → 3.2.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.
package/dist/build.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as BuildOptions, a as BuildResult } from './server-SjfPJEWf.mjs';
1
+ import { B as BuildOptions, a as BuildResult } from './server-U0JYnJFs.mjs';
2
2
  import './http.mjs';
3
3
  import 'node:events';
4
4
  import './ws.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA2EzD,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CA0PvE;AAUD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA2EzD,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAuPvE;AAUD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
package/dist/build.js CHANGED
@@ -503,12 +503,9 @@ async function build(options) {
503
503
  build2.onResolve({ filter: /^(chokidar|esbuild|mime-types|open|ws|fs\/promises)$/ }, () => {
504
504
  return { path: "server-dep", external: true, sideEffects: false };
505
505
  });
506
- build2.onLoad({ filter: /[\\/](server|config|cli)\.ts$/ }, () => {
507
- return {
508
- contents: "export {}",
509
- loader: "js"
510
- };
511
- });
506
+ build2.onLoad({ filter: /server|config|cli/ }, () => ({
507
+ contents: "export default {};"
508
+ }));
512
509
  }
513
510
  };
514
511
  try {
package/dist/build.mjs CHANGED
@@ -475,12 +475,9 @@ async function build(options) {
475
475
  build2.onResolve({ filter: /^(chokidar|esbuild|mime-types|open|ws|fs\/promises)$/ }, () => {
476
476
  return { path: "server-dep", external: true, sideEffects: false };
477
477
  });
478
- build2.onLoad({ filter: /[\\/](server|config|cli)\.ts$/ }, () => {
479
- return {
480
- contents: "export {}",
481
- loader: "js"
482
- };
483
- });
478
+ build2.onLoad({ filter: /server|config|cli/ }, () => ({
479
+ contents: "export default {};"
480
+ }));
484
481
  }
485
482
  };
486
483
  try {
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.5",
1438
+ version: "3.2.7",
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",
@@ -1698,10 +1698,30 @@ async function loadConfigFile(configPath) {
1698
1698
  } else if (ext === "ts") {
1699
1699
  try {
1700
1700
  const { build: build2 } = await import("esbuild");
1701
- const { tmpdir } = await import("os");
1702
1701
  const { join: join2, dirname: dirname2 } = await Promise.resolve().then(() => (init_path(), path_exports));
1703
- const tempFile = join2(tmpdir(), `elit-config-${Date.now()}.mjs`);
1704
1702
  const configDir = dirname2(configPath);
1703
+ const tempFile = join2(configDir, `.elit-config-${Date.now()}.mjs`);
1704
+ const externalAllPlugin = {
1705
+ name: "external-all",
1706
+ setup(build3) {
1707
+ build3.onResolve({ filter: /.*/ }, (args) => {
1708
+ if (args.path.startsWith("./") || args.path.startsWith("../")) {
1709
+ return void 0;
1710
+ }
1711
+ if (args.path.includes("node_modules") || args.resolveDir?.includes("node_modules")) {
1712
+ return { path: args.path, external: true };
1713
+ }
1714
+ const knownPackages = ["esbuild", "elit", "fs", "path", "os", "vm", "crypto", "http", "https", "url", "bun"];
1715
+ if (knownPackages.some((pkg) => args.path === pkg || args.path.startsWith(pkg + "/"))) {
1716
+ return { path: args.path, external: true };
1717
+ }
1718
+ if (args.resolveDir?.includes("elit/dist") || args.path.includes("elit/dist")) {
1719
+ return { path: args.path, external: true };
1720
+ }
1721
+ return void 0;
1722
+ });
1723
+ }
1724
+ };
1705
1725
  await build2({
1706
1726
  entryPoints: [configPath],
1707
1727
  bundle: true,
@@ -1710,10 +1730,17 @@ async function loadConfigFile(configPath) {
1710
1730
  outfile: tempFile,
1711
1731
  write: true,
1712
1732
  target: "es2020",
1713
- // Bundle everything including elit/* so config can use elit modules
1714
- // Only mark Node.js built-ins and runtime-specific packages as external
1733
+ plugins: [externalAllPlugin],
1734
+ // External Node.js built-ins and runtime-specific packages
1715
1735
  external: [
1716
1736
  "node:*",
1737
+ "fs",
1738
+ "path",
1739
+ "os",
1740
+ "vm",
1741
+ "crypto",
1742
+ "http",
1743
+ "https",
1717
1744
  "bun",
1718
1745
  "bun:*",
1719
1746
  "deno",
@@ -3804,21 +3831,15 @@ export default css;
3804
3831
  });
3805
3832
  transpiled = transpiler.transformSync(content.toString());
3806
3833
  } else {
3807
- const { build: build2 } = await import("esbuild");
3808
- const result = await build2({
3809
- stdin: {
3810
- contents: content.toString(),
3811
- loader: ext === ".tsx" ? "tsx" : "ts",
3812
- resolveDir: resolve(resolvedPath, ".."),
3813
- sourcefile: resolvedPath
3814
- },
3834
+ const { transformSync } = await import("esbuild");
3835
+ const loader = ext === ".tsx" ? "tsx" : "ts";
3836
+ const result = transformSync(content.toString(), {
3837
+ loader,
3815
3838
  format: "esm",
3816
3839
  target: "es2020",
3817
- write: false,
3818
- bundle: false,
3819
3840
  sourcemap: "inline"
3820
3841
  });
3821
- transpiled = result.outputFiles[0].text;
3842
+ transpiled = result.code;
3822
3843
  }
3823
3844
  transpiled = transpiled.replace(
3824
3845
  /from\s+["']([^"']+)\.ts(x?)["']/g,
@@ -4148,12 +4169,9 @@ async function build(options) {
4148
4169
  build2.onResolve({ filter: /^(chokidar|esbuild|mime-types|open|ws|fs\/promises)$/ }, () => {
4149
4170
  return { path: "server-dep", external: true, sideEffects: false };
4150
4171
  });
4151
- build2.onLoad({ filter: /[\\/](server|config|cli)\.ts$/ }, () => {
4152
- return {
4153
- contents: "export {}",
4154
- loader: "js"
4155
- };
4156
- });
4172
+ build2.onLoad({ filter: /server|config|cli/ }, () => ({
4173
+ contents: "export default {};"
4174
+ }));
4157
4175
  }
4158
4176
  };
4159
4177
  try {
@@ -0,0 +1,38 @@
1
+ import { D as DevServerOptions, B as BuildOptions, P as PreviewOptions } from './server-U0JYnJFs.mjs';
2
+ import './http.mjs';
3
+ import 'node:events';
4
+ import './ws.mjs';
5
+ import 'events';
6
+ import 'http';
7
+ import 'ws';
8
+
9
+ /**
10
+ * Config loader for elit.config.{ts,js,json}
11
+ */
12
+
13
+ interface ElitConfig {
14
+ /** Development server configuration */
15
+ dev?: DevServerOptions;
16
+ /** Build configuration - supports single build or multiple builds */
17
+ build?: BuildOptions | BuildOptions[];
18
+ /** Preview server configuration */
19
+ preview?: PreviewOptions;
20
+ }
21
+ /**
22
+ * Helper function for type-safe config definition
23
+ */
24
+ declare function defineConfig(config: ElitConfig): ElitConfig;
25
+ /**
26
+ * Load environment variables from .env files
27
+ */
28
+ declare function loadEnv(mode?: string, cwd?: string): Record<string, string>;
29
+ /**
30
+ * Load elit config from current directory
31
+ */
32
+ declare function loadConfig(cwd?: string): Promise<ElitConfig | null>;
33
+ /**
34
+ * Merge CLI args with config file
35
+ */
36
+ declare function mergeConfig<T extends Record<string, any>>(config: T | undefined, cliArgs: Partial<T>): T;
37
+
38
+ export { type ElitConfig, defineConfig, loadConfig, loadEnv, mergeConfig };
@@ -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,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