@tuqulore-inc/create-eleventy 4.1.0 → 5.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tuqulore-inc/create-eleventy",
3
- "version": "4.1.0",
3
+ "version": "5.0.0",
4
4
  "description": "Create a new Eleventy project with Preact and TailwindCSS",
5
5
  "keywords": [
6
6
  "create",
@@ -17,17 +17,18 @@
17
17
  "author": "tuqulore inc.",
18
18
  "type": "module",
19
19
  "bin": {
20
- "create-eleventy": "./index.mjs"
20
+ "create-eleventy": "./index.js"
21
21
  },
22
22
  "files": [
23
- "index.mjs",
23
+ "index.js",
24
24
  "templates"
25
25
  ],
26
26
  "scripts": {
27
- "lint": "eslint --fix ."
27
+ "lint": "eslint --fix .",
28
+ "test": "node --test"
28
29
  },
29
30
  "devDependencies": {
30
- "@tuqulore-inc/eslint-config": "4.1.0",
31
+ "@tuqulore-inc/eslint-config": "5.0.0",
31
32
  "eslint": "^10.0.0"
32
33
  },
33
34
  "engines": {
@@ -36,5 +37,5 @@
36
37
  "publishConfig": {
37
38
  "access": "public"
38
39
  },
39
- "gitHead": "52c4aa703d30931de4df10e515ea8890a341e984"
40
+ "gitHead": "155e0c2ad43c00e4611d5069362af07db71bf5f9"
40
41
  }
@@ -1,24 +1,24 @@
1
- FROM node:24-slim@sha256:24dc26ef1e3c3690f27ebc4136c9c186c3133b25563ae4d7f0692e4d1fe5db0e as build
1
+ FROM node:24-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 as build
2
2
  WORKDIR /app
3
3
  COPY package.json pnpm-lock.yaml ./
4
4
  RUN corepack enable
5
5
  RUN pnpm install --frozen-lockfile
6
- COPY postcss.config.mjs eleventy.config.mjs .env* ./
6
+ COPY postcss.config.js eleventy.config.js .env* ./
7
7
  COPY src/ ./src
8
8
  COPY lib/ ./lib
9
9
  RUN pnpm build
10
10
 
11
- FROM node:24-slim@sha256:24dc26ef1e3c3690f27ebc4136c9c186c3133b25563ae4d7f0692e4d1fe5db0e as install
11
+ FROM node:24-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 as install
12
12
  WORKDIR /app
13
13
  COPY package.json pnpm-lock.yaml ./
14
14
  RUN corepack enable
15
15
  RUN pnpm install --frozen-lockfile
16
16
 
17
- FROM gcr.io/distroless/nodejs:18@sha256:b534f9b5528e69baa7e8caf7bcc1d93ecf59faa15d289221decf5889a2ed3877
17
+ FROM gcr.io/distroless/nodejs24-debian13@sha256:ac0daf5d207757b275f3df0de9b296675500e773cc447c65afd66a948d5bf013
18
18
  WORKDIR /app
19
19
  ENV NODE_ENV=production
20
- COPY serve.mjs ./
20
+ COPY serve.js ./
21
21
  COPY --from=build /app/dist ./dist
22
22
  COPY --from=install /app/node_modules ./node_modules
23
23
 
24
- CMD ["serve.mjs"]
24
+ CMD ["serve.js"]
@@ -112,37 +112,49 @@ Eleventyテンプレートの参照先です。
112
112
 
113
113
  ## Partial Hydration
114
114
 
115
- JSXテンプレートの拡張子を `.hydrate.jsx` にすると、`dist/**/*.hydrate.jsx` にハイドレーション用のスクリプトが生成されます。
115
+ `.client.{js,jsx,ts,tsx}` という拡張子のファイルを `src` 配下に置くだけで、設定不要でパーシャルハイドレーションが有効になります。そのファイルは esbuild でバンドルされて `dist/**/*.client.js` に出力され、`<Island>` コンポーネントを通じて \<is-land> のクライアント側スクリプトとして読み込まれます。
116
116
 
117
- 次の例では、Componentコンポーネントをハイドレーションしています。
117
+ `clientComponent()` でマークしたコンポーネントを `<Island>` に渡すと、SSR 側の描画と、クライアント側のハイドレーションの両方に同じ props が流れます。
118
118
 
119
- ```mdx
120
- import Component from "./component.hydrate.jsx"; // ./component.hydrate.jsxはJSXテンプレートとして使用できます
119
+ ```jsx
120
+ // src/counter.client.jsx
121
+ import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
122
+ import { useState } from "preact/hooks";
121
123
 
122
- {/* ./component.hydrate.jsxはブラウザーでの読み込み時に描画されます */}
123
- <is-land land-on:visible type="preact" import="./component.hydrate.js" props='{ "someProp": "somePropValue" }'>
124
+ function Counter(props) {
125
+ const [n, setN] = useState(props.initial ?? 0);
126
+ return <button onClick={() => setN(n + 1)}>{n}</button>;
127
+ }
124
128
 
125
- <Component someProp="somePropValue" />{/* <Component />はビルド時に描画されます */}
126
- </is-land>
129
+ export default clientComponent(Counter, import.meta.url);
127
130
  ```
128
131
 
129
- > [!NOTE]
130
- >
131
- > [\<is-land>](https://github.com/11ty/is-land?tab=readme-ov-file#usage)の初期化条件を指定する属性は、デフォルトでは`on:*`の書式で指定する必要がありますが、JSXの書式と競合するので`land-on:*`に変更しています。
132
-
133
- \<is-land>Webコンポーネントは`land-on:*`属性のほか、次の属性を受け付けます。
134
-
135
- ### `type`属性
132
+ ```mdx
133
+ // src/index.mdx
134
+ import { Island } from "@tuqulore-inc/eleventy-preset/island";
135
+ import Counter from "./counter.client.jsx";
136
136
 
137
- ハイドレーションに使用するランタイム。`"preact"`を指定します。
137
+ <Island component={Counter} on="interaction" initial={5} />
138
+ ```
138
139
 
139
- ### `import`属性
140
+ 上の例では、`<Island>` が次のような \<is-land> 要素を SSR 出力します。
140
141
 
141
- ハイドレーションに使用する`dist/**/*.hydrate.js`のパス。
142
+ ```html
143
+ <is-land
144
+ land-on:interaction
145
+ type="preact"
146
+ import="/counter.client.js"
147
+ props='{"initial":5}'
148
+ >
149
+ <button>5</button>
150
+ </is-land>
151
+ ```
142
152
 
143
- ### `props`属性
153
+ `on` prop は \<is-land> の初期化トリガー (`interaction` / `visible` / `idle`) に対応します。
144
154
 
145
- `dist/**/*.hydrate.js`に渡すプロパティ。オブジェクトを文字列化した値を指定します。通常、オブジェクトの文字列化にJSON.stringifyを使用することができます。
155
+ > [!NOTE]
156
+ >
157
+ > [\<is-land>](https://github.com/11ty/is-land?tab=readme-ov-file#usage)の初期化条件を指定する属性は、デフォルトでは `on:*` の書式で指定する必要がありますが、JSX の書式と競合するので `land-on:*` に変更しています。パラメータ付きトリガー (例: `on:media("(min-width: ...)")`) を使う場合は `<Island>` ではなく素の \<is-land> を直接書いてください。
146
158
 
147
159
  ## Docker
148
160
 
@@ -7,7 +7,7 @@ import globals from "globals";
7
7
 
8
8
  export default defineConfig([
9
9
  {
10
- files: ["**/*.{cjs,mjs,js,jsx}"],
10
+ files: ["**/*.{cjs,js,jsx}"],
11
11
  plugins: { js },
12
12
  extends: ["js/recommended"],
13
13
  },
@@ -16,11 +16,11 @@ export default defineConfig([
16
16
  languageOptions: { sourceType: "commonjs" },
17
17
  },
18
18
  {
19
- files: ["**/*.{mjs,js,jsx}"],
19
+ files: ["**/*.{js,jsx}"],
20
20
  languageOptions: { sourceType: "module" },
21
21
  },
22
22
  {
23
- files: ["**/*.cjs", "*.mjs", "src/_data/**/*.{mjs,js}"],
23
+ files: ["**/*.cjs", "*.js", "src/_data/**/*.js"],
24
24
  languageOptions: { globals: globals.node },
25
25
  },
26
26
  react.configs.flat.recommended,
@@ -18,17 +18,17 @@
18
18
  "@eslint/js": "^10.0.0",
19
19
  "@iconify/json": "^2.2.90",
20
20
  "@iconify/tailwind4": "^1.0.6",
21
- "@jumpu-ui/tailwindcss": "2.0.1",
21
+ "@jumpu-ui/tailwindcss": "3.0.1",
22
22
  "@tailwindcss/postcss": "^4.0.14",
23
- "@tailwindcss/typography": "0.5.19",
24
- "@tuqulore-inc/eleventy-preset": "^4.1.0",
23
+ "@tailwindcss/typography": "0.5.20",
24
+ "@tuqulore-inc/eleventy-preset": "^5.0.0",
25
25
  "dotenv-cli": "^11.0.0",
26
26
  "eslint": "^10.0.0",
27
27
  "eslint-config-prettier": "^10.1.8",
28
28
  "eslint-plugin-mdx": "^3.2.0",
29
29
  "eslint-plugin-react": "^7.37.4",
30
30
  "globals": "^17.0.0",
31
- "npm-run-all2": "^8.0.4",
31
+ "npm-run-all2": "^9.0.0",
32
32
  "postcss": "^8.5.6",
33
33
  "preact": "^10.26.4",
34
34
  "prettier": "^3.8.1",
@@ -1,3 +1,4 @@
1
+ import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
1
2
  import { useState, useRef, useEffect } from "preact/hooks";
2
3
  import slugify from "slugify";
3
4
  import { twMerge } from "tailwind-merge";
@@ -47,7 +48,7 @@ function MenuList(props) {
47
48
  );
48
49
  }
49
50
 
50
- export default function Desktop(props) {
51
+ function Desktop(props) {
51
52
  return (
52
53
  <nav class={props.class}>
53
54
  <ul class="flex items-center">
@@ -79,3 +80,5 @@ export default function Desktop(props) {
79
80
  </nav>
80
81
  );
81
82
  }
83
+
84
+ export default clientComponent(Desktop, import.meta.url);
@@ -1,7 +1,8 @@
1
+ import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
1
2
  import { useState } from "preact/hooks";
2
3
  import { twMerge } from "tailwind-merge";
3
4
 
4
- export default function Mobile(props) {
5
+ function Mobile(props) {
5
6
  const [open, setOpen] = useState(false);
6
7
  return (
7
8
  <div class={props.class}>
@@ -74,3 +75,5 @@ export default function Mobile(props) {
74
75
  </div>
75
76
  );
76
77
  }
78
+
79
+ export default clientComponent(Mobile, import.meta.url);
@@ -1,30 +1,24 @@
1
+ import { Island } from "@tuqulore-inc/eleventy-preset/island";
1
2
  import { eleventy } from "@tuqulore-inc/eleventy-preset/eleventy";
2
- import Desktop from "./header/desktop.hydrate.jsx";
3
- import Mobile from "./header/mobile.hydrate.jsx";
3
+ import Desktop from "./header/desktop.client.jsx";
4
+ import Mobile from "./header/mobile.client.jsx";
4
5
 
5
6
  <header class="sticky top-0 mb-8 bg-white shadow">
6
7
  <div class="mx-auto flex h-16 max-w-6xl items-center justify-between gap-4 px-4 md:justify-start">
7
8
  <a class="flex-shrink-0" href="/">
8
9
  {eleventy.site.name}
9
10
  </a>
10
- <is-land
11
- land-on:interaction
12
- type="preact"
13
- import="/_includes/partials/header/desktop.hydrate.js"
14
- props={JSON.stringify({ class: "hidden md:block", nav: eleventy.nav })}
15
- >
16
- <Desktop class="hidden md:block" nav={eleventy.nav} />
17
- </is-land>
18
- <is-land
19
- land-on:interaction
20
- type="preact"
21
- import="/_includes/partials/header/mobile.hydrate.js"
22
- props={JSON.stringify({
23
- class: "ml-auto flex items-center md:hidden",
24
- nav: eleventy.nav,
25
- })}
26
- >
27
- <Mobile class="ml-auto flex items-center md:hidden" nav={eleventy.nav} />
28
- </is-land>
11
+ <Island
12
+ component={Desktop}
13
+ on="interaction"
14
+ class="hidden md:block"
15
+ nav={eleventy.nav}
16
+ />
17
+ <Island
18
+ component={Mobile}
19
+ on="interaction"
20
+ class="ml-auto flex items-center md:hidden"
21
+ nav={eleventy.nav}
22
+ />
29
23
  </div>
30
24
  </header>
@@ -1,6 +1,7 @@
1
+ import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
1
2
  import { useState } from "preact/hooks";
2
3
 
3
- export default function Clicker() {
4
+ function Clicker() {
4
5
  const [counter, setCounter] = useState(0);
5
6
 
6
7
  return (
@@ -12,3 +13,5 @@ export default function Clicker() {
12
13
  </div>
13
14
  );
14
15
  }
16
+
17
+ export default clientComponent(Clicker, import.meta.url);
@@ -1,4 +1,5 @@
1
- import Clicker from "./clicker.hydrate.jsx";
1
+ import { Island } from "@tuqulore-inc/eleventy-preset/island";
2
+ import Clicker from "./clicker.client.jsx";
2
3
 
3
4
  export const data = {
4
5
  layout: "post",
@@ -15,6 +16,4 @@ export const data = {
15
16
 
16
17
  Hello World
17
18
 
18
- <is-land land-on:interaction type="preact" import="./clicker.hydrate.js">
19
- <Clicker />
20
- </is-land>
19
+ <Island component={Clicker} on="interaction" />
File without changes
File without changes