resuxjs 0.2.6 → 0.2.9

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": "resuxjs",
3
- "version": "0.2.6",
3
+ "version": "0.2.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "repository": {
@@ -17,6 +17,7 @@
17
17
  "README.md"
18
18
  ],
19
19
  "bin": {
20
+ "resuxjs": "dist/index.js",
20
21
  "resux": "dist/index.js",
21
22
  "create-resux": "dist/create.js"
22
23
  },
@@ -9,6 +9,6 @@ Open `http://localhost:3000`.
9
9
 
10
10
  `npm run dev` starts the Resux dev server with Vite-powered client module serving. `npm run build` creates production `.resux` assets and a Nitro `.output` server, and `npm run start` serves the built app.
11
11
 
12
- This starter includes file-based pages, a default layout, `error.vue`, built-in SEO/security/performance modules, a server API route at `/api/status`, the built-in `/__resux/health` endpoint, TypeScript globals, `ResuxLink to`, async-data plus `v-text` examples, and a Vue runtime island in `islands/vue`.
12
+ This starter includes file-based pages, a default layout, `error.vue`, page-level `useSeoMeta`, built-in security/performance modules, a server API route at `/api/status`, the built-in `/__resux/health` endpoint, TypeScript globals, `ResuxLink to`, async-data plus `v-text` examples, and a Vue runtime island in `islands/vue`.
13
13
 
14
14
  See `DEPLOYMENT.md` for Node, Docker, and Nitro deployment commands.
@@ -2,6 +2,14 @@
2
2
  definePageMeta({
3
3
  title: "About"
4
4
  })
5
+
6
+ useSeoMeta({
7
+ title: "About",
8
+ description: "Learn about this Resux application.",
9
+ ogTitle: "About",
10
+ ogDescription: "Learn about this Resux application.",
11
+ twitterCard: "summary"
12
+ })
5
13
  </script>
6
14
 
7
15
  <template>
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  const count = useState("count", () => 0)
3
3
  const config = useRuntimeConfig()
4
- const { data, pending } = useAsyncData("starter-stats", async () => {
4
+ const { data, pending, error } = await useAsyncData("starter-stats", async () => {
5
5
  await new Promise((resolve) => setTimeout(resolve, 700))
6
6
  return {
7
7
  response: "14 ms",
@@ -10,8 +10,13 @@ const { data, pending } = useAsyncData("starter-stats", async () => {
10
10
  }
11
11
  })
12
12
 
13
- useHead({
14
- title: config.public.appName
13
+ useSeoMeta({
14
+ title: config.public.appName,
15
+ description: "A Resux application.",
16
+ ogTitle: config.public.appName,
17
+ ogDescription: "A Resux application.",
18
+ twitterCard: "summary_large_image",
19
+ themeColor: "#2563eb"
15
20
  })
16
21
 
17
22
  function increment() {
@@ -26,29 +31,34 @@ function increment() {
26
31
  <h1>{{ config.public.appName }}</h1>
27
32
  <p class="lede">Server-rendered Vue-like files with resumable client handlers.</p>
28
33
  <div class="actions">
29
- <button @click="increment">Count: {{ count.value }}</button>
34
+ <button @click="increment">Count: {{ count }}</button>
30
35
  <ResuxLink to="/about">About this app</ResuxLink>
31
36
  </div>
32
37
  </section>
33
38
 
34
39
  <section class="stats-panel">
35
- <div v-if="pending.value" class="stats-grid">
40
+ <div v-if="pending" class="stats-grid">
36
41
  <div class="stat skeleton"></div>
37
42
  <div class="stat skeleton"></div>
38
43
  <div class="stat skeleton"></div>
39
44
  </div>
40
- <div v-if="!pending.value" class="stats-grid">
45
+ <div v-if="error" class="stat error-state">
46
+ <span>Stats unavailable</span>
47
+ <strong>{{ error.message }}</strong>
48
+ <a href="/">Try again</a>
49
+ </div>
50
+ <div v-if="!pending && !error && data" class="stats-grid">
41
51
  <article class="stat">
42
52
  <span>Response</span>
43
- <strong>{{ data.value.response }}</strong>
53
+ <strong>{{ data.response }}</strong>
44
54
  </article>
45
55
  <article class="stat">
46
56
  <span>Routes</span>
47
- <strong>{{ data.value.routes }}</strong>
57
+ <strong>{{ data.routes }}</strong>
48
58
  </article>
49
59
  <article class="stat">
50
60
  <span>Mode</span>
51
- <strong v-text="data.value.mode">Mode</strong>
61
+ <strong v-text="data.mode">Mode</strong>
52
62
  </article>
53
63
  </div>
54
64
  </section>
@@ -173,6 +173,31 @@ h1 {
173
173
  font-size: 1.7rem;
174
174
  }
175
175
 
176
+ .error-state {
177
+ max-width: 520px;
178
+ border-color: #c8553d;
179
+ background: #fff7f4;
180
+ }
181
+
182
+ .error-state strong {
183
+ color: #8f2f1d;
184
+ font-size: 1.05rem;
185
+ line-height: 1.5;
186
+ }
187
+
188
+ .error-state a {
189
+ display: inline-flex;
190
+ align-items: center;
191
+ min-height: 40px;
192
+ margin-top: 18px;
193
+ border: 1px solid #8f2f1d;
194
+ border-radius: 8px;
195
+ padding: 0 14px;
196
+ color: #8f2f1d;
197
+ font-weight: 800;
198
+ text-decoration: none;
199
+ }
200
+
176
201
  .skeleton {
177
202
  position: relative;
178
203
  overflow: hidden;
@@ -1,10 +1,5 @@
1
1
  export default defineResuxConfig({
2
2
  modules: [
3
- ["resux:seo", {
4
- title: "%PROJECT_TITLE%",
5
- description: "A Resux application.",
6
- themeColor: "#2563eb"
7
- }],
8
3
  "resux:security",
9
4
  "resux:performance"
10
5
  ],