elements-kit 0.27.13 → 0.27.14

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.
@@ -1,3 +1,4 @@
1
+ import "node:module";
1
2
  //#region \0rolldown/runtime.js
2
3
  var __defProp = Object.defineProperty;
3
4
  var __exportAll = (all, no_symbols) => {
@@ -7,6 +7,7 @@ interface AstroRendererConfig {
7
7
  interface AstroConfigSetupApi {
8
8
  addRenderer(renderer: AstroRendererConfig): void;
9
9
  updateConfig(config: Record<string, unknown>): unknown;
10
+ config?: unknown;
10
11
  }
11
12
  interface ElementsKitAstroIntegration {
12
13
  name: string;
@@ -1,6 +1,32 @@
1
1
  import elementsKitHmr from "./vite.mjs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
2
5
  //#region src/integrations/astro.ts
3
6
  /**
7
+ * The JSX transform config, under the key the installed Vite actually reads.
8
+ *
9
+ * Vite 8 (and rolldown-vite) transform with Oxc: `esbuild` options are ignored
10
+ * there, and setting both keys warns. Older Vite only understands `esbuild`.
11
+ * Vite is resolved from the project root — under isolated installs it is not
12
+ * reachable from this package's own directory.
13
+ */
14
+ function jsxTransformConfig(root) {
15
+ const from = root instanceof URL ? fileURLToPath(root) : typeof root === "string" ? root : process.cwd();
16
+ let oxc = false;
17
+ try {
18
+ const vite = createRequire(path.join(from, "noop.js"))("vite/package.json");
19
+ oxc = vite.name === "rolldown-vite" || Number.parseInt(vite.version ?? "", 10) >= 8;
20
+ } catch {}
21
+ return oxc ? { oxc: { jsx: {
22
+ runtime: "automatic",
23
+ importSource: "elements-kit"
24
+ } } } : { esbuild: {
25
+ jsx: "automatic",
26
+ jsxImportSource: "elements-kit"
27
+ } };
28
+ }
29
+ /**
4
30
  * Astro integration: use elements-kit components as Astro islands.
5
31
  *
6
32
  * Registers the elements-kit renderer pair — server rendering via
@@ -35,17 +61,14 @@ import elementsKitHmr from "./vite.mjs";
35
61
  function elementsKit() {
36
62
  return {
37
63
  name: "elements-kit",
38
- hooks: { "astro:config:setup": ({ addRenderer, updateConfig }) => {
64
+ hooks: { "astro:config:setup": ({ addRenderer, updateConfig, config }) => {
39
65
  addRenderer({
40
66
  name: "elements-kit",
41
67
  clientEntrypoint: "elements-kit/integrations/astro-client",
42
68
  serverEntrypoint: "elements-kit/integrations/astro-server"
43
69
  });
44
70
  updateConfig({ vite: {
45
- esbuild: {
46
- jsx: "automatic",
47
- jsxImportSource: "elements-kit"
48
- },
71
+ ...jsxTransformConfig(config?.root),
49
72
  optimizeDeps: { include: [
50
73
  "elements-kit",
51
74
  "elements-kit/jsx-runtime",
@@ -1,4 +1,4 @@
1
- import { t as __exportAll } from "../../chunk-CfYAbeIz.mjs";
1
+ import { t as __exportAll } from "../../chunk-BpYLSNr0.mjs";
2
2
  import { c as batch, l as computed, u as effect, x as signal } from "../../lib-Dw0g-vex.mjs";
3
3
  import { reactive, resolve } from "../../signals/index.mjs";
4
4
  import { t as scope } from "../../scope-B1kDu4YX.mjs";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "elements-kit",
3
3
  "type": "module",
4
- "version": "0.27.13",
4
+ "version": "0.27.14",
5
5
  "description": "A lightweight reactive UI library that transforms native HTMLElements into reactive components with signals. Ideal for framework-agnostic applications and web components.",
6
6
  "keywords": [
7
7
  "webcomponents",