@ilha/astro 0.1.8 → 0.2.0

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 CHANGED
@@ -49,11 +49,11 @@ import { Counter } from "../islands/counter";
49
49
  ## How it works
50
50
 
51
51
  - **Server-side:** the component is rendered with [`.hydratable()`](https://github.com/ilhajs/ilha), which wraps the island's SSR output in a `[data-ilha]` element carrying serialized props and a state snapshot.
52
- - **Client-side:** on hydration, the renderer finds that `[data-ilha]` element inside Astro's island wrapper and calls the island's own `.mount()` — no re-render, no flicker, `.onMount()` is skipped since the snapshot already matches the DOM.
52
+ - **Client-side:** on hydration, the renderer finds that `[data-ilha]` element inside Astro's island wrapper and calls the island's own `.mount()` — no re-render, no flicker, no post-mount setup needed since the snapshot already matches the DOM.
53
53
 
54
54
  Because hydration is driven entirely by Ilha's own `data-ilha-*` attributes, every [Astro client directive](https://docs.astro.build/en/reference/directives-reference/#client-directives) (`client:load`, `client:idle`, `client:visible`, `client:media`, `client:only`) works as expected.
55
55
 
56
56
  ## Notes
57
57
 
58
- - Ilha islands don't support Astro's `<slot />` / children forwarding — render everything through the island's own `.render()` function and props.
58
+ - Ilha islands don't support Astro's `<slot />` / children forwarding — render everything through the island component and its props (via `Island.toString()` / `.hydratable()` on the server).
59
59
  - `client:only` skips SSR entirely and mounts fresh in the browser, matching Astro's usual behavior for other framework renderers.
package/dist/client.js CHANGED
@@ -1,4 +1,4 @@
1
- import ilha, { raw } from "ilha";
1
+ import { ilha, raw } from "ilha";
2
2
 
3
3
  //#region src/client.ts
4
4
  const RAW = Symbol.for("ilha.raw");
@@ -9,7 +9,7 @@ function isRawHtml(value) {
9
9
  return !!(value && typeof value === "object" && RAW in value);
10
10
  }
11
11
  function wrapPlainAsIsland(Component, merged) {
12
- return ilha.render(() => {
12
+ return ilha(() => {
13
13
  const result = Component(merged);
14
14
  if (result == null) return raw("");
15
15
  if (typeof result === "string") return raw(result);
package/dist/index.js CHANGED
@@ -10,14 +10,15 @@ function globToRegExp(pattern) {
10
10
  let source = "^";
11
11
  for (let i = 0; i < pattern.length; i++) {
12
12
  const char = pattern[i];
13
- if (char === "*") if (pattern[i + 1] === "*") {
14
- i++;
15
- if (pattern[i + 1] === "/") {
13
+ if (char === "*") {
14
+ if (pattern[i + 1] === "*") {
16
15
  i++;
17
- source += "(?:.*/)?";
18
- } else source += ".*";
19
- } else source += "[^/]*";
20
- else if (char === "?") source += "[^/]";
16
+ if (pattern[i + 1] === "/") {
17
+ i++;
18
+ source += "(?:.*/)?";
19
+ } else source += ".*";
20
+ } else source += "[^/]*";
21
+ } else if (char === "?") source += "[^/]";
21
22
  else source += char.replace(/[\\^$.*+?()[\]{}|]/g, "\\$&");
22
23
  }
23
24
  return new RegExp(`${source}$`);
@@ -40,8 +41,8 @@ function optionsPlugin(options) {
40
41
  function getRenderer() {
41
42
  return {
42
43
  name: "@ilha/astro",
43
- clientEntrypoint: "@ilha/astro/client.js",
44
- serverEntrypoint: "@ilha/astro/server.js"
44
+ clientEntrypoint: "@ilha/astro/client",
45
+ serverEntrypoint: "@ilha/astro/server"
45
46
  };
46
47
  }
47
48
  /**
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import ilha, { raw } from "ilha";
1
+ import { ilha, raw } from "ilha";
2
2
 
3
3
  //#region src/server.ts
4
4
  const ISLAND = Symbol.for("ilha.island");
@@ -27,7 +27,7 @@ function hasNestedIslandSlots(html) {
27
27
  * when the shell hydrates on the client.
28
28
  */
29
29
  function wrapPlainAsIsland(Component, merged) {
30
- return ilha.render(() => {
30
+ return ilha(() => {
31
31
  const result = Component(merged);
32
32
  if (result == null) return raw("");
33
33
  if (typeof result === "string") return raw(result);
@@ -36,10 +36,7 @@ function wrapPlainAsIsland(Component, merged) {
36
36
  });
37
37
  }
38
38
  function toRawHtml(value) {
39
- return {
40
- [RAW]: true,
41
- value: String(value)
42
- };
39
+ return raw(String(value));
43
40
  }
44
41
  function isAstroRenderable(value) {
45
42
  return !!value && typeof value === "object" && !isRawHtml(value) && typeof value.render === "function";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilha/astro",
3
- "version": "0.1.8",
3
+ "version": "0.2.0",
4
4
  "description": "Astro integration for Ilha islands",
5
5
  "keywords": [
6
6
  "astro-component",
@@ -34,11 +34,11 @@
34
34
  "types": "./dist/index.d.ts",
35
35
  "import": "./dist/index.js"
36
36
  },
37
- "./client.js": {
37
+ "./client": {
38
38
  "types": "./dist/client.d.ts",
39
39
  "import": "./dist/client.js"
40
40
  },
41
- "./server.js": {
41
+ "./server": {
42
42
  "types": "./dist/server.d.ts",
43
43
  "import": "./dist/server.js"
44
44
  }
@@ -53,10 +53,10 @@
53
53
  },
54
54
  "devDependencies": {
55
55
  "astro": "^7.2.4",
56
- "ilha": "^0.11.0"
56
+ "ilha": "^0.12.0"
57
57
  },
58
58
  "peerDependencies": {
59
59
  "astro": "^7.2.4",
60
- "ilha": ">=0.11.0"
60
+ "ilha": ">=0.12.0"
61
61
  }
62
62
  }