@forinda/kickjs-cli 8.17.4 → 8.18.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/dist/{agent-docs-sMPVd5vN.mjs → agent-docs-CbVUB2eN.mjs} +2 -2
- package/dist/{agent-docs-BKbdsDUQ.mjs → agent-docs-xZISEduq.mjs} +3 -3
- package/dist/{agent-docs-BKbdsDUQ.mjs.map → agent-docs-xZISEduq.mjs.map} +1 -1
- package/dist/{build-NyFTqWDy.mjs → build-BLQQMQtM.mjs} +3 -3
- package/dist/{build-NyFTqWDy.mjs.map → build-BLQQMQtM.mjs.map} +1 -1
- package/dist/{build-DWbnilcJ.mjs → build-CKmAKaJ1.mjs} +2 -2
- package/dist/{builtins-MVDZcuck.mjs → builtins-4IV5eliu.mjs} +75 -75
- package/dist/{builtins-DaPdtAiN.mjs → builtins-4OFjCWYj.mjs} +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/{config-kPWo_HS4.mjs → config-B3kSZiSh.mjs} +3 -3
- package/dist/{config-kPWo_HS4.mjs.map → config-B3kSZiSh.mjs.map} +1 -1
- package/dist/{config-BVw4TFDJ.mjs → config-v0mtdiYe.mjs} +2 -2
- package/dist/{doctor-Bmm7jTXk.mjs → doctor-DJxEocJ5.mjs} +4 -4
- package/dist/{doctor-Bmm7jTXk.mjs.map → doctor-DJxEocJ5.mjs.map} +1 -1
- package/dist/{fullstack-Dj6nndJI.mjs → fullstack-DM0a3A8G.mjs} +4 -4
- package/dist/{fullstack-Dj6nndJI.mjs.map → fullstack-DM0a3A8G.mjs.map} +1 -1
- package/dist/{fullstack-HXrTvDQS.mjs → fullstack-iWO7BFX6.mjs} +3 -3
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{plugin-DxBBBZKs.mjs → plugin-BCMbxzi5.mjs} +2 -2
- package/dist/{plugin-CEIikRk4.mjs → plugin-P1F0k7kH.mjs} +2 -2
- package/dist/{project-BFGUN5KK.mjs → project-6h_j0VK0.mjs} +12 -12
- package/dist/project-6h_j0VK0.mjs.map +1 -0
- package/dist/{project--dWQ_c8m.mjs → project-9QfIRkON.mjs} +31 -31
- package/dist/{project-root-CKK8LRzQ.mjs → project-root-DcfsBtCw.mjs} +3 -3
- package/dist/{project-root-CKK8LRzQ.mjs.map → project-root-DcfsBtCw.mjs.map} +1 -1
- package/dist/{project-root-tvtMzer4.mjs → project-root-rs5vJCt5.mjs} +2 -2
- package/dist/{rolldown-runtime-BxKUidhj.mjs → rolldown-runtime-CQE1JsWD.mjs} +1 -1
- package/dist/{run-plugins-CisH0EMY.mjs → run-plugins-BONtomzM.mjs} +72 -72
- package/dist/run-plugins-BONtomzM.mjs.map +1 -0
- package/dist/{typegen-_fQVGRr8.mjs → typegen-FLvIFR3i.mjs} +5 -5
- package/dist/{typegen-_fQVGRr8.mjs.map → typegen-FLvIFR3i.mjs.map} +1 -1
- package/dist/{typegen-dZuP30n-.mjs → typegen-ZG4nzOUN.mjs} +4 -4
- package/dist/{types-DNpeagtq.mjs → types-Doudtd8d.mjs} +1 -1
- package/package.json +8 -8
- package/templates/inertia-react/feature.json +13 -0
- package/templates/inertia-svelte/feature.json +13 -0
- package/templates/inertia-svelte/files/src/client/Layout.svelte +19 -0
- package/templates/inertia-svelte/files/src/client/Seo.svelte +47 -0
- package/templates/inertia-svelte/files/src/client/main.ts +16 -0
- package/templates/inertia-svelte/files/src/client/pages/Error.svelte +14 -0
- package/templates/inertia-svelte/files/src/client/pages/Home.svelte +13 -0
- package/templates/inertia-svelte/files/src/client/pages/Posts/Index.svelte +33 -0
- package/templates/inertia-svelte/files/src/client/ssr.ts +16 -0
- package/templates/inertia-svelte/files/src/client/svelte.d.ts +7 -0
- package/templates/inertia-svelte/files/vite.client.config.ts +32 -0
- package/templates/inertia-svelte/files/vite.config.ts +42 -0
- package/templates/inertia-vue/feature.json +13 -0
- package/templates/inertia-vue/files/src/client/Layout.vue +21 -0
- package/templates/inertia-vue/files/src/client/Seo.ts +49 -0
- package/templates/inertia-vue/files/src/client/main.ts +17 -0
- package/templates/inertia-vue/files/src/client/pages/Error.vue +16 -0
- package/templates/inertia-vue/files/src/client/pages/Home.vue +15 -0
- package/templates/inertia-vue/files/src/client/pages/Posts/Index.vue +31 -0
- package/templates/inertia-vue/files/src/client/ssr.ts +21 -0
- package/templates/inertia-vue/files/src/client/vue.d.ts +7 -0
- package/templates/inertia-vue/files/vite.client.config.ts +32 -0
- package/templates/inertia-vue/files/vite.config.ts +42 -0
- package/templates/template-inertia/feature.json +3 -13
- package/templates/template-inertia/files/src/client/app.css +1 -1
- package/templates/template-inertia/files/src/index.ts +4 -4
- package/templates/template-inertia/files/src/modules/pages/pages.controller.ts +1 -1
- package/dist/project-BFGUN5KK.mjs.map +0 -1
- package/dist/run-plugins-CisH0EMY.mjs.map +0 -1
- /package/templates/{template-inertia → inertia-react}/files/src/client/Layout.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/Seo.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/main.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Error.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Home.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/pages/Posts/Index.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/src/client/ssr.tsx +0 -0
- /package/templates/{template-inertia → inertia-react}/files/vite.client.config.ts +0 -0
- /package/templates/{template-inertia → inertia-react}/files/vite.config.ts +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import './app.css'
|
|
2
|
+
import { createInertiaApp } from '@inertiajs/vue3'
|
|
3
|
+
import type { DefineComponent } from 'vue'
|
|
4
|
+
|
|
5
|
+
// Lazy: each page is its own chunk, fetched when it's first visited, so the
|
|
6
|
+
// first load doesn't download every page. ssr.ts keeps `eager: true`; the
|
|
7
|
+
// server pays no download for it.
|
|
8
|
+
const pages = import.meta.glob<DefineComponent>('./pages/**/*.vue')
|
|
9
|
+
|
|
10
|
+
// Server-rendered pages are hydrated; the rest render from scratch.
|
|
11
|
+
createInertiaApp({
|
|
12
|
+
resolve: (name) => {
|
|
13
|
+
const page = pages[`./pages/${name}.vue`]
|
|
14
|
+
if (!page) throw new Error(`No page component at src/client/pages/${name}.vue`)
|
|
15
|
+
return page()
|
|
16
|
+
},
|
|
17
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Link } from '@inertiajs/vue3'
|
|
3
|
+
import Layout from '../Layout.vue'
|
|
4
|
+
|
|
5
|
+
// Rendered for unknown URLs (404) and errors thrown while handling a page.
|
|
6
|
+
// In production a 5xx message is replaced with a generic one.
|
|
7
|
+
defineProps<{ status: number; message: string }>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<Layout>
|
|
12
|
+
<h1>{{ status }}</h1>
|
|
13
|
+
<p>{{ message }}</p>
|
|
14
|
+
<Link href="/">Back home</Link>
|
|
15
|
+
</Layout>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import Layout from '../Layout.vue'
|
|
3
|
+
|
|
4
|
+
defineProps<{ greeting: string }>()
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<Layout>
|
|
9
|
+
<h1>{{ greeting }}</h1>
|
|
10
|
+
<p>
|
|
11
|
+
Pages are Vue components in <code>src/client/pages</code>; their props come from the
|
|
12
|
+
controller in <code>src/modules/pages</code>.
|
|
13
|
+
</p>
|
|
14
|
+
</Layout>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Deferred, useForm } from '@inertiajs/vue3'
|
|
3
|
+
import Layout from '../../Layout.vue'
|
|
4
|
+
|
|
5
|
+
interface Post {
|
|
6
|
+
id: number
|
|
7
|
+
title: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
defineProps<{ posts: Post[]; stats?: { total: number } }>()
|
|
11
|
+
const form = useForm({ title: '' })
|
|
12
|
+
const submit = () => form.post('/posts', { onSuccess: () => form.reset() })
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<Layout>
|
|
17
|
+
<h1>Posts</h1>
|
|
18
|
+
<Deferred data="stats">
|
|
19
|
+
<template #fallback><p>Loading stats…</p></template>
|
|
20
|
+
<p>Total: {{ stats?.total }}</p>
|
|
21
|
+
</Deferred>
|
|
22
|
+
<ul>
|
|
23
|
+
<li v-for="post in posts" :key="post.id">{{ post.title }}</li>
|
|
24
|
+
</ul>
|
|
25
|
+
<form @submit.prevent="submit">
|
|
26
|
+
<input v-model="form.title" aria-label="Title" />
|
|
27
|
+
<button :disabled="form.processing">Add</button>
|
|
28
|
+
<p v-if="form.errors.title" style="color: crimson">{{ form.errors.title }}</p>
|
|
29
|
+
</form>
|
|
30
|
+
</Layout>
|
|
31
|
+
</template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Also imported here, so the dev server can link it in server-rendered HTML.
|
|
2
|
+
import './app.css'
|
|
3
|
+
import { createInertiaApp } from '@inertiajs/vue3'
|
|
4
|
+
import type { Page } from '@inertiajs/core'
|
|
5
|
+
import { createSSRApp, h, type DefineComponent } from 'vue'
|
|
6
|
+
import { renderToString } from 'vue/server-renderer'
|
|
7
|
+
|
|
8
|
+
const pages = import.meta.glob<DefineComponent>('./pages/**/*.vue', {
|
|
9
|
+
eager: true,
|
|
10
|
+
import: 'default',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// Called by InertiaAdapter to render a page on the server: the page object
|
|
14
|
+
// in, `{ head, body }` out.
|
|
15
|
+
export default (page: Page) =>
|
|
16
|
+
createInertiaApp({
|
|
17
|
+
page,
|
|
18
|
+
render: renderToString,
|
|
19
|
+
resolve: (name) => pages[`./pages/${name}.vue`]!,
|
|
20
|
+
setup: ({ App, props, plugin }) => createSSRApp({ render: () => h(App, props) }).use(plugin),
|
|
21
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import { compressAssets } from '@forinda/kickjs-vite/compress'
|
|
4
|
+
|
|
5
|
+
// Production builds of the pages (`{{runBuild}}` runs both):
|
|
6
|
+
// vite build --config vite.client.config.ts → dist/client
|
|
7
|
+
// vite build --config vite.client.config.ts --ssr src/client/ssr.ts → dist/ssr/ssr.js
|
|
8
|
+
// InertiaAdapter reads dist/client/.vite/manifest.json for the script tags
|
|
9
|
+
// and renders pages with dist/ssr/ssr.js.
|
|
10
|
+
// Production builds only. The server's .env sets NODE_ENV=development, and
|
|
11
|
+
// some tools (the Netlify CLI) load it into the environment: these would
|
|
12
|
+
// become development builds of the pages.
|
|
13
|
+
process.env.NODE_ENV = 'production'
|
|
14
|
+
|
|
15
|
+
export default defineConfig(({ isSsrBuild }) => ({
|
|
16
|
+
// Nothing from the server's .env belongs in the browser bundle.
|
|
17
|
+
envDir: false,
|
|
18
|
+
// compressAssets: .br / .gz beside the built pages' files, which the server
|
|
19
|
+
// sends to browsers that accept them. Skips the SSR build.
|
|
20
|
+
plugins: [vue(), compressAssets()],
|
|
21
|
+
// Same aliases as the dev server: tsconfig.json `paths`.
|
|
22
|
+
resolve: { tsconfigPaths: true },
|
|
23
|
+
// The SSR bundle carries its dependencies: a Netlify or Vercel function
|
|
24
|
+
// has no node_modules to resolve Vue from.
|
|
25
|
+
ssr: { noExternal: true },
|
|
26
|
+
// Inlined, Vue would pick its build from NODE_ENV at runtime and carry both.
|
|
27
|
+
define: isSsrBuild ? { 'process.env.NODE_ENV': JSON.stringify('production') } : {},
|
|
28
|
+
build: isSsrBuild
|
|
29
|
+
? // public/ is served from dist/client; the render bundle doesn't need a copy.
|
|
30
|
+
{ outDir: 'dist/ssr', copyPublicDir: false }
|
|
31
|
+
: { outDir: 'dist/client', manifest: true, rollupOptions: { input: 'src/client/main.ts' } },
|
|
32
|
+
}))
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
import swc from 'unplugin-swc'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import { kickjsVitePlugin, envWatchPlugin } from '@forinda/kickjs-vite'
|
|
6
|
+
|
|
7
|
+
// Dev server for the API and the pages. swc compiles the server, which
|
|
8
|
+
// needs decorator metadata; vue() and Vite's oxc compile the pages, which
|
|
9
|
+
// hot-swaps components on save without a reload.
|
|
10
|
+
const client = /src\/client\/.+\.[jt]sx?$/
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
oxc: { include: client },
|
|
14
|
+
plugins: [
|
|
15
|
+
// swc's own config hook switches oxc off for every file; drop it so
|
|
16
|
+
// the pages keep oxc. Globs, not the regex above: unplugin-swc's options
|
|
17
|
+
// type takes swc's `exclude` (strings) for its own filter.
|
|
18
|
+
{ ...swc.vite({ exclude: ['**/node_modules/**', '**/src/client/**'] }), config: undefined },
|
|
19
|
+
vue(),
|
|
20
|
+
kickjsVitePlugin({ entry: 'src/index.ts' }),
|
|
21
|
+
// Watches .env files and triggers a full reload on change so the
|
|
22
|
+
// dev server picks up env tweaks without a manual restart.
|
|
23
|
+
envWatchPlugin(),
|
|
24
|
+
],
|
|
25
|
+
// The server renders the HTML, so Vite has no index.html to scan for the
|
|
26
|
+
// browser's dependencies — name the entry.
|
|
27
|
+
optimizeDeps: { entries: ['src/client/main.ts'] },
|
|
28
|
+
// @kick:vite-option
|
|
29
|
+
// Aliases come from tsconfig.json `paths` — one list for the server,
|
|
30
|
+
// the pages and the editor.
|
|
31
|
+
resolve: { tsconfigPaths: true },
|
|
32
|
+
build: {
|
|
33
|
+
target: 'node20',
|
|
34
|
+
ssr: true,
|
|
35
|
+
outDir: 'dist',
|
|
36
|
+
sourcemap: true,
|
|
37
|
+
rollupOptions: {
|
|
38
|
+
input: fileURLToPath(new URL('./src/index.ts', import.meta.url)),
|
|
39
|
+
output: { format: 'esm' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
})
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"dependencies": [
|
|
3
|
-
"@forinda/kickjs-inertia",
|
|
4
|
-
"@inertiajs/core",
|
|
5
|
-
"@inertiajs/react",
|
|
6
|
-
"react",
|
|
7
|
-
"react-dom"
|
|
8
|
-
],
|
|
9
|
-
"devDependencies": ["@vitejs/plugin-react", "@types/react", "@types/react-dom"],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "kick build && vite build --config vite.client.config.ts && vite build --config vite.client.config.ts --ssr src/client/ssr.tsx"
|
|
12
|
-
},
|
|
2
|
+
"dependencies": ["@forinda/kickjs-inertia", "@inertiajs/core"],
|
|
13
3
|
"integrations": [
|
|
14
4
|
{
|
|
15
5
|
"import": {
|
|
@@ -25,11 +15,11 @@
|
|
|
25
15
|
},
|
|
26
16
|
{
|
|
27
17
|
"slot": "env-zod",
|
|
28
|
-
"code": "// Signs the session cookie. The public dev-only default is accepted only when\n// NODE_ENV is 'development' (kick dev) or 'test' (vitest); anywhere else,\n// including an unset NODE_ENV, a real secret is required.\nSESSION_SECRET: z\n .string()\n .min(32)\n .default('dev-only-session-secret-not-for-production')\n // `: boolean`
|
|
18
|
+
"code": "// Signs the session cookie. The public dev-only default is accepted only when\n// NODE_ENV is 'development' (kick dev) or 'test' (vitest); anywhere else,\n// including an unset NODE_ENV, a real secret is required.\nSESSION_SECRET: z\n .string()\n .min(32)\n .default('dev-only-session-secret-not-for-production')\n // `: boolean` — inferring it would make this schema's type depend on\n // process.env, whose type `kick typegen` derives from this schema.\n .refine(\n (s): boolean =>\n ['development', 'test'].includes(process.env.NODE_ENV ?? '') ||\n !s.startsWith('dev-only-'),\n { error: 'set SESSION_SECRET — the dev-only default is public' },\n )"
|
|
29
19
|
},
|
|
30
20
|
{
|
|
31
21
|
"slot": "env-zod",
|
|
32
|
-
"code": "// The site's public URL
|
|
22
|
+
"code": "// The site's public URL — canonical links, the sitemap and social-card images\n// are built from it, never from the request's Host header. The localhost\n// default is accepted only when NODE_ENV is 'development' or 'test'; anywhere\n// else, including an unset NODE_ENV, APP_URL must be set.\nAPP_URL: z\n .url()\n .default('http://localhost:3000')\n .refine(\n (): boolean =>\n ['development', 'test'].includes(process.env.NODE_ENV ?? '') ||\n process.env.APP_URL !== undefined,\n { error: 'set APP_URL to the public URL of the site' },\n )"
|
|
33
23
|
}
|
|
34
24
|
]
|
|
35
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Global styles, imported by
|
|
1
|
+
/* Global styles, imported by the browser entry (main) and the server-render entry (ssr).
|
|
2
2
|
* Tailwind: {{packageManager}} add -D tailwindcss @tailwindcss/vite, add tailwindcss() to
|
|
3
3
|
* the plugins in vite.config.ts and vite.client.config.ts, then replace this
|
|
4
4
|
* file's contents with: @import "tailwindcss";
|
|
@@ -22,12 +22,13 @@ export const app = await bootstrap({
|
|
|
22
22
|
adapters: [
|
|
23
23
|
InertiaAdapter({
|
|
24
24
|
title: '{{name}}',
|
|
25
|
-
entry
|
|
25
|
+
// The pages' browser entry, and the entry that renders them on the server.
|
|
26
|
+
// @kick:inertia-client
|
|
26
27
|
head: '<link rel="icon" href="/favicon.svg" type="image/svg+xml" />',
|
|
27
28
|
// Canonical URLs and absolute image URLs start here — not at the Host header.
|
|
28
29
|
baseUrl: getEnv('APP_URL'),
|
|
29
30
|
// Every page's meta starts from these; a controller adds its own with
|
|
30
|
-
// inertia(component, props, { meta }), and src/client
|
|
31
|
+
// inertia(component, props, { meta }), and the Seo component in src/client keeps the
|
|
31
32
|
// browser's <head> in sync on client-side visits.
|
|
32
33
|
meta: {
|
|
33
34
|
lang: 'en',
|
|
@@ -42,8 +43,7 @@ export const app = await bootstrap({
|
|
|
42
43
|
},
|
|
43
44
|
// Props every page receives.
|
|
44
45
|
share: () => ({ appName: '{{name}}' }),
|
|
45
|
-
|
|
46
|
-
// Unknown URLs and thrown errors render src/client/pages/Error.tsx
|
|
46
|
+
// Unknown URLs and thrown errors render the Error page in src/client/pages
|
|
47
47
|
// (through inertiaNotFound / inertiaErrorHandler below).
|
|
48
48
|
errorPage: 'Error',
|
|
49
49
|
}),
|