virastack 1.0.1 → 1.0.3

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": "virastack",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Scaffold new projects and add tools from the ViraStack ecosystem with a single command.",
5
5
  "author": {
6
6
  "name": "Ömer Gülçiçek (ViraStack)",
@@ -33,6 +33,12 @@
33
33
  "templates-i18n",
34
34
  "!src/**/*.test.js"
35
35
  ],
36
+ "scripts": {
37
+ "prepublishOnly": "find templates templates-i18n -type d \\( -name 'node_modules' -o -name '.next' -o -name 'dist' -o -name '.vinxi' -o -name '.output' -o -name '.turbo' \\) -prune -exec rm -rf '{}' +",
38
+ "start": "node ./bin/virastack.js",
39
+ "test": "vitest run",
40
+ "test:watch": "vitest"
41
+ },
36
42
  "keywords": [
37
43
  "virastack",
38
44
  "start",
@@ -53,10 +59,5 @@
53
59
  },
54
60
  "devDependencies": {
55
61
  "vitest": "^3.2.7"
56
- },
57
- "scripts": {
58
- "start": "node ./bin/virastack.js",
59
- "test": "vitest run",
60
- "test:watch": "vitest"
61
62
  }
62
- }
63
+ }
File without changes
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  import type { NextRequest } from "next/server";
2
2
  import { NextResponse } from "next/server";
3
3
 
4
- export function proxy(_request: NextRequest) {
4
+ export default function proxy(_request: NextRequest) {
5
5
  return NextResponse.next();
6
6
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -24,6 +24,10 @@ const inter = Inter({
24
24
 
25
25
  export const metadata: Metadata = defaultMetadata;
26
26
 
27
+ export function generateStaticParams() {
28
+ return routing.locales.map((locale) => ({ locale }));
29
+ }
30
+
27
31
  export default async function RootLayout({
28
32
  children,
29
33
  params,
@@ -5,7 +5,6 @@ export const routing = defineRouting({
5
5
  locales: ["en", "tr"],
6
6
  defaultLocale: "en",
7
7
  localePrefix: "as-needed",
8
- localeDetection: false,
9
8
  });
10
9
 
11
10
  export const { Link, redirect, usePathname, useRouter, getPathname } = createNavigation(routing);
@@ -6,7 +6,7 @@ import { routing } from "./i18n/routing";
6
6
 
7
7
  const handleI18nRouting = createMiddleware(routing);
8
8
 
9
- export function proxy(request: NextRequest) {
9
+ export default async function proxy(request: NextRequest) {
10
10
  return handleI18nRouting(request);
11
11
  }
12
12
 
File without changes
File without changes
File without changes
@@ -1,157 +0,0 @@
1
- ## What is this folder?
2
-
3
- This is an [unpacked (git-friendly)](https://inlang.com/docs/unpacked-project) inlang project.
4
-
5
- ## At a glance
6
-
7
- Purpose:
8
-
9
- - This folder is the Git-friendly representation of an `.inlang` project.
10
- - The canonical `.inlang` format is a single binary file; this directory is the unpacked version for Git.
11
- - This folder stores project configuration and plugin cache data.
12
- - Translation files live outside this folder and are referenced from `settings.json`.
13
-
14
- Safe to edit:
15
-
16
- - `settings.json`
17
-
18
- Do not edit:
19
-
20
- - `cache/`
21
- - `.gitignore`
22
-
23
- Key files:
24
-
25
- - `settings.json` — locales, plugins, file patterns
26
- - `cache/` — plugin caches (safe to delete)
27
- - `.gitignore` — generated
28
- - `README.md` — generated, explains this folder
29
- - `.meta.json` — generated SDK metadata
30
-
31
- ```
32
- *.inlang/
33
- ├── settings.json # Locales, plugins, and file patterns; kept in Git
34
- ├── .gitignore # Ignores everything except settings.json
35
- ├── README.md # Generated, explains this folder
36
- ├── .meta.json # Generated SDK metadata
37
- └── cache/ # Plugin caches, usually cache/plugins/
38
- ```
39
-
40
- Translation files (like `messages/en.json`) live **outside** this folder and are referenced via plugins in `settings.json`.
41
-
42
- ## What is inlang?
43
-
44
- [Inlang](https://inlang.com) is an open project file format for localization. An `.inlang` project is canonically a single binary file: a SQLite database with version control via [lix](https://lix.dev). Like `.sqlite` for relational data, `.inlang` packages localization data into one file that tools can share.
45
-
46
- For Git repositories, that binary file can be unpacked into a directory of plain files. The packed file is the canonical format; this directory is the Git-friendly representation.
47
-
48
- Use inlang when multiple tools, teams, automations, or agents need to use the same localization data. The `@inlang/sdk` is the reference implementation for reading and writing `.inlang` projects.
49
-
50
- `.inlang` is the canonical project format. Plugins import and export external translation files for compatibility with existing runtimes and workflows. Messages, variants, and locale data live in the `.inlang` database; translation files such as `messages/en.json` live outside this folder and are connected through plugins. Version control via lix adds file-level history, merging, and change proposals to `.inlang` projects.
51
-
52
- It provides:
53
-
54
- - **CRUD API** — Read and write translations programmatically via SQL
55
- - **Plugin system** — Import/export external translation files (JSON, XLIFF, etc.)
56
- - **Version control** — Version control via [lix](https://lix.dev)
57
-
58
- Core data model:
59
-
60
- - **Bundle** — one translatable unit across locales
61
- - **Message** — locale-specific translation for a bundle
62
- - **Variant** — text pattern plus selector matches
63
-
64
- ```
65
- ┌──────────┐ ┌───────────┐ ┌────────────┐
66
- │ i18n lib │ │Translation│ │ CI/CD │
67
- │ │ │ Tool │ │ Automation │
68
- └────┬─────┘ └─────┬─────┘ └─────┬──────┘
69
- │ │ │
70
- └─────────┐ │ ┌──────────┘
71
- ▼ ▼ ▼
72
- ┌──────────────────────────────────┐
73
- │ *.inlang file │
74
- └──────────────────────────────────┘
75
- ```
76
-
77
- ## Quick start
78
-
79
- ```bash
80
- npm install @inlang/sdk
81
- ```
82
-
83
- ```ts
84
- import fs from "node:fs";
85
-
86
- import { loadProjectFromDirectory, saveProjectToDirectory } from "@inlang/sdk";
87
-
88
- const project = await loadProjectFromDirectory({
89
- path: "./project.inlang",
90
- fs,
91
- });
92
- // Query messages with the SDK.
93
- const messages = await project.db.selectFrom("message").selectAll().execute();
94
-
95
- // Use project.db to update messages.
96
- await saveProjectToDirectory({
97
- path: "./project.inlang",
98
- fs,
99
- project,
100
- });
101
-
102
- await project.close();
103
- ```
104
-
105
- `loadProjectFromDirectory()` and `saveProjectToDirectory()` both accept `node:fs`. `saveProjectToDirectory()` writes translation files through import/export plugins. If no exporter plugin is configured, save the canonical packed file with `project.toBlob()` instead.
106
-
107
- ## For coding agents and tool builders
108
-
109
- Target `.inlang` instead of inventing a custom JSON schema.
110
-
111
- Why target `.inlang`?
112
-
113
- - One file gives every tool the same data model for bundles, messages, variants, locales, metadata, and settings.
114
- - CRUD operations are available through the SDK instead of custom parsing and rewriting.
115
- - Version control via [lix](https://lix.dev) keeps localization changes reviewable and mergeable.
116
- - Plugins handle JSON, ICU, i18next, XLIFF, and other formats for compatibility.
117
-
118
- Do not:
119
-
120
- - Invent a custom `locales/en.json` schema as the project format.
121
- - Create a new localization config when a `.inlang` project already exists.
122
- - Edit generated or cached files in this directory.
123
- - Bypass `@inlang/sdk` when reading or writing `.inlang`.
124
-
125
- ## Ideas for custom tooling
126
-
127
- - Translation health dashboard (missing/empty/stale messages)
128
- - Locale coverage report in CI
129
- - Auto-PR for new keys with placeholders
130
- - Migration tool between file formats via plugins
131
- - Glossary/term consistency checker
132
-
133
- ## Data model ([docs](https://inlang.com/docs/data-model))
134
-
135
- ```
136
- bundle (a concept, e.g., "welcome_header")
137
- └── message (per locale, e.g., "en", "de")
138
- └── variant (plural forms, gender, etc.)
139
- ```
140
-
141
- - **bundle**: Groups messages by ID (e.g., `welcome_header`)
142
- - **message**: A translation for a specific locale
143
- - **variant**: Handles pluralization/selectors (most messages have one variant)
144
-
145
- ## Common tasks
146
-
147
- - List bundles: `project.db.selectFrom("bundle").selectAll().execute()`
148
- - List messages for locale: `project.db.selectFrom("message").where("locale", "=", "en").selectAll().execute()`
149
- - Find missing translations: compare message counts across locales
150
- - Update a message: `project.db.updateTable("message").set({ ... }).where("id", "=", "...").execute()`
151
-
152
- ## Links
153
-
154
- - [SDK documentation](https://inlang.com/docs)
155
- - [inlang.com](https://inlang.com)
156
- - [List of plugins](https://inlang.com/c/plugins)
157
- - [List of tools](https://inlang.com/c/tools)
@@ -1,162 +0,0 @@
1
- # Paraglide JS Compiled Output
2
-
3
- > Auto-generated i18n message functions. Import `messages.js` to use translated strings.
4
-
5
- Compiled from: `./project.inlang`
6
-
7
-
8
- ## What is this folder?
9
-
10
- This folder contains compiled [Paraglide JS](https://github.com/opral/paraglide-js) output. Paraglide JS compiles your translation messages into tree-shakeable JavaScript functions.
11
-
12
- ## At a glance
13
-
14
- Purpose:
15
- - This folder stores compiled i18n message functions.
16
- - Source translations live outside this folder in your inlang project.
17
-
18
- Safe to import:
19
- - `messages.js` — all message functions
20
- - `runtime.js` — locale utilities
21
- - `server.js` — server-side middleware
22
-
23
- Do not edit:
24
- - All files in this folder are auto-generated.
25
- - Changes will be overwritten on next compilation.
26
-
27
- ```
28
- paraglide/
29
- ├── messages.js # Message exports (import this)
30
- ├── messages/ # Individual message functions
31
- ├── runtime.js # Locale detection & configuration
32
- ├── registry.js # Formatting utilities (plural, number, datetime, relativetime)
33
- ├── server.js # Server-side middleware
34
- └── .gitignore # Marks folder as generated
35
- ```
36
-
37
- ## Usage
38
-
39
- ```js
40
- import * as m from "./paraglide/messages.js";
41
-
42
- // Messages are functions that return localized strings
43
- m.hello_world(); // "Hello, World!" (in current locale)
44
- m.greeting({ name: "Sam" }); // "Hello, Sam!"
45
-
46
- // Override locale per-call
47
- m.hello_world({}, { locale: "de" }); // "Hallo, Welt!"
48
- m.greeting({ name: "Sam" }, { locale: "de" }); // "Hallo, Sam!"
49
- ```
50
-
51
- ## Runtime API
52
-
53
- ```js
54
- import { getLocale, getTextDirection, setLocale, locales, baseLocale } from "./paraglide/runtime.js";
55
-
56
- getLocale(); // Current locale, e.g., "en"
57
- getTextDirection(); // "ltr" | "rtl" for current locale
58
- setLocale("de"); // Set locale
59
- locales; // Available locales, e.g., ["en", "de", "fr"]
60
- baseLocale; // Default locale, e.g., "en"
61
- ```
62
-
63
- ## Strategy
64
-
65
- The strategy determines how the current locale is detected and persisted:
66
-
67
- - **Cookie**: Stores locale preference in a cookie.
68
- - **URL**: Derives locale from URL patterns (e.g., `/en/about`, `en.example.com`).
69
- - **GlobalVariable**: Uses a global variable (client-side only).
70
- - **BaseLocale**: Always returns the base locale.
71
-
72
- Strategies can be combined. The order defines precedence:
73
-
74
- ```js
75
- await compile({
76
- project: "./project.inlang",
77
- outdir: "./src/paraglide",
78
- strategy: ["url", "cookie", "baseLocale"],
79
- });
80
- ```
81
-
82
- See the [strategy documentation](https://paraglidejs.com/strategy) for details.
83
-
84
- ## Markup (Rich Text)
85
-
86
- Messages can contain markup tags for bold, links, and other inline elements. Translators control where tags appear; developers control how they render.
87
-
88
- Important:
89
- - Tag names are app-defined. There is no built-in list of HTML tags.
90
- - `{#b}...{/b}` does not automatically render as `<b>...</b>`.
91
- - Renderers/snippets are looked up by the same tag name used in the message.
92
-
93
- ### Message syntax
94
-
95
- ```json
96
- {
97
- "cta": "{#link to=|/docs| rel=$relationship @track}Read the docs{/link}",
98
- "welcome": "{#b}Hi {name}{/b}{#icon/}"
99
- }
100
- ```
101
-
102
- - `{#tagName}` opens a tag, `{/tagName}` closes it.
103
- - `{#tagName/}` creates a standalone tag.
104
- - Options: `to=|/docs|` or `rel=$relationship` (accessed via `options.*`).
105
- - Attributes: `@track` or `@variant=|hero|` (accessed via `attributes.*`).
106
-
107
- This is the default inlang message syntax. Paraglide's message format is plugin-based — you can use [ICU MessageFormat 1](https://inlang.com/m/p7c8m1d2/plugin-inlang-icu-messageformat-1), [i18next](https://inlang.com/m/3i8bor92/plugin-inlang-i18next), or other [plugins](https://inlang.com/c/plugins) instead.
108
-
109
- ### Rendering markup
110
-
111
- Calling the message function still returns **plain text** (markup stripped):
112
-
113
- ```js
114
- m.cta({ relationship: "noopener" }); // "Read the docs"
115
- ```
116
-
117
- To render markup, use the framework adapter or the low-level `parts()` API:
118
-
119
- ```js
120
- const parts = m.cta.parts({ relationship: "noopener" });
121
- // [
122
- // { type: "markup-start", name: "link", options: { to: "/docs", rel: "noopener" }, attributes: { track: true } },
123
- // { type: "text", value: "Read the docs" },
124
- // { type: "markup-end", name: "link" }
125
- // ]
126
- ```
127
-
128
- Framework adapters provide a `<ParaglideMessage>` component that accepts markup renderers:
129
-
130
- - `@inlang/paraglide-js-react`
131
- - `@inlang/paraglide-js-vue`
132
- - `@inlang/paraglide-js-svelte`
133
- - `@inlang/paraglide-js-solid`
134
-
135
- ```jsx
136
- import { ParaglideMessage } from "@inlang/paraglide-js-react"; // or -vue, -svelte, -solid
137
-
138
- <ParaglideMessage
139
- message={m.welcome}
140
- inputs={{ name: "Ada" }}
141
- markup={{
142
- b: ({ children }) => <b>{children}</b>,
143
- icon: () => <span aria-hidden="true" className="icon-wave" />,
144
- }}
145
- />
146
- ```
147
-
148
- The available renderer/snippet names come from the message itself. You can inspect them through `message.parts()`, and TypeScript uses the same names to type-check your markup renderers.
149
-
150
- See the [markup documentation](https://paraglidejs.com/markup) for details.
151
-
152
- ## Key concepts
153
-
154
- - **Tree-shakeable**: Each message is a function, enabling [up to 70% smaller i18n bundle sizes](https://paraglidejs.com/benchmark) than traditional i18n libraries.
155
- - **Typesafe**: Full TypeScript/JSDoc support with autocomplete.
156
- - **Variants**: Messages can have variants for pluralization, gender, etc.
157
- - **Fallbacks**: Missing translations fall back to the base locale.
158
-
159
- ## Links
160
-
161
- - [Paraglide JS Documentation](https://paraglidejs.com)
162
- - [Source Repository](https://github.com/opral/paraglide-js)