@inlang/paraglide-js 2.7.2 → 2.9.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.
Files changed (134) hide show
  1. package/README.md +64 -54
  2. package/dist/bundler-plugins/rollup.d.ts +1 -1
  3. package/dist/bundler-plugins/rollup.d.ts.map +1 -1
  4. package/dist/bundler-plugins/unplugin.d.ts.map +1 -1
  5. package/dist/bundler-plugins/unplugin.js +35 -36
  6. package/dist/bundler-plugins/unplugin.js.map +1 -1
  7. package/dist/cli/commands/compile/command.d.ts.map +1 -1
  8. package/dist/cli/commands/compile/command.js +160 -17
  9. package/dist/cli/commands/compile/command.js.map +1 -1
  10. package/dist/cli/commands/init/command.d.ts.map +1 -1
  11. package/dist/cli/commands/init/command.js +7 -11
  12. package/dist/cli/commands/init/command.js.map +1 -1
  13. package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -1
  14. package/dist/cli/steps/check-for-uncomitted-changes.js +2 -2
  15. package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -1
  16. package/dist/cli/steps/maybe-add-sherlock.d.ts.map +1 -1
  17. package/dist/cli/steps/maybe-add-sherlock.js +9 -3
  18. package/dist/cli/steps/maybe-add-sherlock.js.map +1 -1
  19. package/dist/cli/steps/prompt-for-outdir.js +1 -1
  20. package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
  21. package/dist/compiler/compile-bundle.js +1 -1
  22. package/dist/compiler/compile-bundle.js.map +1 -1
  23. package/dist/compiler/compile-bundle.test.js +2 -2
  24. package/dist/compiler/compile-local-variable.d.ts.map +1 -1
  25. package/dist/compiler/compile-local-variable.js +2 -1
  26. package/dist/compiler/compile-local-variable.js.map +1 -1
  27. package/dist/compiler/compile-local-variable.test.js +14 -0
  28. package/dist/compiler/compile-local-variable.test.js.map +1 -1
  29. package/dist/compiler/compile-message.d.ts.map +1 -1
  30. package/dist/compiler/compile-message.js +2 -1
  31. package/dist/compiler/compile-message.js.map +1 -1
  32. package/dist/compiler/compile-message.test.js +58 -0
  33. package/dist/compiler/compile-message.test.js.map +1 -1
  34. package/dist/compiler/compile-pattern.d.ts.map +1 -1
  35. package/dist/compiler/compile-pattern.js +2 -1
  36. package/dist/compiler/compile-pattern.js.map +1 -1
  37. package/dist/compiler/compile-pattern.test.js +17 -0
  38. package/dist/compiler/compile-pattern.test.js.map +1 -1
  39. package/dist/compiler/compile-project.d.ts +2 -1
  40. package/dist/compiler/compile-project.d.ts.map +1 -1
  41. package/dist/compiler/compile-project.js +7 -1
  42. package/dist/compiler/compile-project.js.map +1 -1
  43. package/dist/compiler/compile-project.test.js +89 -1
  44. package/dist/compiler/compile-project.test.js.map +1 -1
  45. package/dist/compiler/compile.d.ts.map +1 -1
  46. package/dist/compiler/compile.js +1 -0
  47. package/dist/compiler/compile.js.map +1 -1
  48. package/dist/compiler/compile.test.js +26 -0
  49. package/dist/compiler/compile.test.js.map +1 -1
  50. package/dist/compiler/compiler-options.d.ts +52 -0
  51. package/dist/compiler/compiler-options.d.ts.map +1 -1
  52. package/dist/compiler/compiler-options.js +1 -0
  53. package/dist/compiler/compiler-options.js.map +1 -1
  54. package/dist/compiler/create-paraglide.d.ts.map +1 -1
  55. package/dist/compiler/create-paraglide.js +2 -0
  56. package/dist/compiler/create-paraglide.js.map +1 -1
  57. package/dist/compiler/create-readme.d.ts +10 -0
  58. package/dist/compiler/create-readme.d.ts.map +1 -0
  59. package/dist/compiler/create-readme.js +104 -0
  60. package/dist/compiler/create-readme.js.map +1 -0
  61. package/dist/compiler/jsdoc-types.d.ts.map +1 -1
  62. package/dist/compiler/jsdoc-types.js +5 -1
  63. package/dist/compiler/jsdoc-types.js.map +1 -1
  64. package/dist/compiler/jsdoc-types.test.js +7 -0
  65. package/dist/compiler/jsdoc-types.test.js.map +1 -1
  66. package/dist/compiler/output-structure/locale-modules.d.ts.map +1 -1
  67. package/dist/compiler/output-structure/locale-modules.js +4 -3
  68. package/dist/compiler/output-structure/locale-modules.js.map +1 -1
  69. package/dist/compiler/output-structure/locale-modules.test.js +28 -1
  70. package/dist/compiler/output-structure/locale-modules.test.js.map +1 -1
  71. package/dist/compiler/output-structure/message-modules.js +1 -1
  72. package/dist/compiler/output-structure/message-modules.js.map +1 -1
  73. package/dist/compiler/runtime/create-runtime.d.ts +1 -0
  74. package/dist/compiler/runtime/create-runtime.d.ts.map +1 -1
  75. package/dist/compiler/runtime/create-runtime.js +8 -1
  76. package/dist/compiler/runtime/create-runtime.js.map +1 -1
  77. package/dist/compiler/runtime/generate-static-localized-urls.d.ts +36 -15
  78. package/dist/compiler/runtime/generate-static-localized-urls.d.ts.map +1 -1
  79. package/dist/compiler/runtime/generate-static-localized-urls.js +36 -15
  80. package/dist/compiler/runtime/generate-static-localized-urls.js.map +1 -1
  81. package/dist/compiler/runtime/get-locale.d.ts +12 -6
  82. package/dist/compiler/runtime/get-locale.d.ts.map +1 -1
  83. package/dist/compiler/runtime/get-locale.js +16 -7
  84. package/dist/compiler/runtime/get-locale.js.map +1 -1
  85. package/dist/compiler/runtime/get-locale.test.js +13 -0
  86. package/dist/compiler/runtime/get-locale.test.js.map +1 -1
  87. package/dist/compiler/runtime/localize-href.d.ts +4 -1
  88. package/dist/compiler/runtime/localize-href.d.ts.map +1 -1
  89. package/dist/compiler/runtime/localize-href.js +4 -1
  90. package/dist/compiler/runtime/localize-href.js.map +1 -1
  91. package/dist/compiler/runtime/localize-url.d.ts +4 -0
  92. package/dist/compiler/runtime/localize-url.d.ts.map +1 -1
  93. package/dist/compiler/runtime/localize-url.js +4 -0
  94. package/dist/compiler/runtime/localize-url.js.map +1 -1
  95. package/dist/compiler/runtime/set-locale.d.ts +8 -6
  96. package/dist/compiler/runtime/set-locale.d.ts.map +1 -1
  97. package/dist/compiler/runtime/set-locale.js +8 -6
  98. package/dist/compiler/runtime/set-locale.js.map +1 -1
  99. package/dist/compiler/runtime/should-redirect.d.ts +2 -0
  100. package/dist/compiler/runtime/should-redirect.d.ts.map +1 -1
  101. package/dist/compiler/runtime/should-redirect.js +2 -0
  102. package/dist/compiler/runtime/should-redirect.js.map +1 -1
  103. package/dist/compiler/runtime/strategy.d.ts +4 -0
  104. package/dist/compiler/runtime/strategy.d.ts.map +1 -1
  105. package/dist/compiler/runtime/strategy.js +4 -0
  106. package/dist/compiler/runtime/strategy.js.map +1 -1
  107. package/dist/compiler/runtime/type.d.ts +1 -0
  108. package/dist/compiler/runtime/type.d.ts.map +1 -1
  109. package/dist/compiler/runtime/variables.d.ts +2 -0
  110. package/dist/compiler/runtime/variables.d.ts.map +1 -1
  111. package/dist/compiler/runtime/variables.js +3 -0
  112. package/dist/compiler/runtime/variables.js.map +1 -1
  113. package/dist/compiler/server/create-server-file.d.ts +1 -0
  114. package/dist/compiler/server/create-server-file.d.ts.map +1 -1
  115. package/dist/compiler/server/create-server-file.js +36 -2
  116. package/dist/compiler/server/create-server-file.js.map +1 -1
  117. package/dist/compiler/server/middleware.d.ts +42 -4
  118. package/dist/compiler/server/middleware.d.ts.map +1 -1
  119. package/dist/compiler/server/middleware.js +45 -11
  120. package/dist/compiler/server/middleware.js.map +1 -1
  121. package/dist/compiler/variable-access.d.ts +4 -0
  122. package/dist/compiler/variable-access.d.ts.map +1 -0
  123. package/dist/compiler/variable-access.js +15 -0
  124. package/dist/compiler/variable-access.js.map +1 -0
  125. package/dist/services/env-variables/index.js +1 -1
  126. package/dist/services/file-watching/tracked-fs.d.ts +26 -0
  127. package/dist/services/file-watching/tracked-fs.d.ts.map +1 -0
  128. package/dist/services/file-watching/tracked-fs.js +92 -0
  129. package/dist/services/file-watching/tracked-fs.js.map +1 -0
  130. package/dist/services/file-watching/tracked-fs.test.d.ts +2 -0
  131. package/dist/services/file-watching/tracked-fs.test.d.ts.map +1 -0
  132. package/dist/services/file-watching/tracked-fs.test.js +90 -0
  133. package/dist/services/file-watching/tracked-fs.test.js.map +1 -0
  134. package/package.json +3 -3
package/README.md CHANGED
@@ -1,19 +1,11 @@
1
1
  [![NPM Downloads](https://img.shields.io/npm/dw/%40inlang%2Fparaglide-js?logo=npm&logoColor=red&label=npm%20downloads)](https://www.npmjs.com/package/@inlang/paraglide-js)
2
- [![GitHub Issues](https://img.shields.io/github/issues-closed/opral/inlang-paraglide-js?logo=github&color=purple)](https://github.com/opral/inlang-paraglide-js/issues)
2
+ [![GitHub Issues](https://img.shields.io/github/issues-closed/opral/paraglide-js?logo=github&color=purple)](https://github.com/opral/paraglide-js/issues)
3
+ [![Contributors](https://img.shields.io/github/contributors/opral/paraglide-js?logo=github)](https://github.com/opral/paraglide-js/graphs/contributors)
3
4
  [![Discord](https://img.shields.io/discord/897438559458430986?logo=discord&logoColor=white&label=discord)](https://discord.gg/gdMPPWy57R)
4
- [![License](https://img.shields.io/github/license/opral/inlang-paraglide-js)](https://github.com/opral/inlang-paraglide-js/blob/main/LICENSE)
5
-
6
- <p align="center">
7
- <img src="https://cdn.jsdelivr.net/gh/opral/monorepo@latest/inlang/packages/paraglide/paraglide-js/assets/header.png" alt="Paraglide JS" width="600" />
8
- </p>
9
5
 
10
6
  <h1 align="center">🪂 Paraglide JS</h1>
11
7
  <p align="center">
12
- <strong>Compiler-based i18n library with tree-shaking, full typesafety, and near zero runtime</strong>
13
- </p>
14
- <p align="center">
15
- Paraglide JS compiles your translations into tree-shakable message functions.<br/>
16
- Unused translations are eliminated, and what remains is a fully typesafe API with autocomplete.
8
+ <strong>Compiler-based i18n library that emits tree-shakable translations, leading to up to 70% smaller i18n bundle sizes.</strong>
17
9
  </p>
18
10
 
19
11
  <p align="center">
@@ -33,8 +25,8 @@
33
25
 
34
26
  <p align="center">
35
27
  <sub>Trusted by framework authors</sub><br/><br/>
36
- <a href="https://svelte.dev/docs/cli/paraglide"><img src="https://cdn.simpleicons.org/svelte/FF3E00" alt="Svelte" height="14" /> Svelte's official i18n recommendation</a><br/>
37
- <a href="https://github.com/TanStack/router/tree/main/e2e/react-router/i18n-paraglide"><img src="https://tanstack.com/images/logos/logo-color-100.png" alt="TanStack" height="14" /> Part of TanStack's CI pipeline</a>
28
+ <a href="https://svelte.dev/docs/cli/paraglide"><img src="https://cdn.simpleicons.org/svelte/FF3E00" alt="Svelte" height="14" /> SvelteKit's official i18n integration</a><br/>
29
+ <a href="https://inlang.com/blog/tanstack-ci"><img src="https://tanstack.com/images/logos/logo-color-100.png" alt="TanStack" height="14" /> Part of TanStack's CI pipeline</a>
38
30
  </p>
39
31
 
40
32
  ## Code Preview
@@ -47,23 +39,23 @@
47
39
  ```
48
40
 
49
41
  ```js
50
- import { m } from "./paraglide/messages.js"
42
+ import { m } from "./paraglide/messages.js";
51
43
 
52
- m.greeting({ name: "World" }) // "Hello World!" — fully typesafe
44
+ m.greeting({ name: "World" }); // "Hello World!" — fully typesafe
53
45
  ```
54
46
 
55
- The compiler generates typed message functions. Your bundler tree-shakes unused messages. Expect **~75% smaller bundles** (47 KB vs 205 KB) compared to runtime i18n libraries. [See benchmarks →](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/benchmark)
47
+ The compiler generates typed message functions. Your bundler tree-shakes unused messages. Expect [**up to 70% smaller i18n bundle sizes**](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/benchmark) compared to runtime i18n libraries (e.g. 47 KB vs 205 KB).
56
48
 
57
49
  ## Why Paraglide?
58
50
 
59
- | | |
60
- |---|---|
61
- | **Tiny Runtime** | ~300 bytes. No async loading. No waterfalls. |
62
- | **Tree-Shakable** | Unused messages are eliminated by your bundler. |
63
- | **Fully Typesafe** | Autocomplete for message keys and parameters. Typos become compile errors. |
64
- | **Framework Agnostic** | Works with React, Vue, Svelte, Solid, TanStack, or vanilla JS/TS. |
65
- | **Built-in i18n Routing** | URL-based locale detection and localized paths out of the box. |
66
- | **Inlang Ecosystem** | VS Code extension, CLI, translation editor all work out of the box. |
51
+ | | |
52
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
53
+ | **Smaller i18n Bundle** | Up to 70% smaller i18n bundle size than runtime i18n libraries. |
54
+ | **Tree-Shakable** | Unused messages are eliminated by your bundler. |
55
+ | **Fully Typesafe** | Autocomplete for message keys and parameters. Typos become compile errors. |
56
+ | **Framework Agnostic** | Works with React, Vue, Svelte, Solid, TanStack, or vanilla JS/TS. |
57
+ | **Built-in i18n Routing** | URL-based locale detection and localized paths out of the box. |
58
+ | **Built on inlang** | Integrates with [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtension) (VS Code extension), [Fink](https://inlang.com/m/tdozzpar/app-inlang-finkLocalizationEditor) (translation editor), and more. |
67
59
 
68
60
  ## Works With Your Stack
69
61
 
@@ -72,11 +64,14 @@ The compiler generates typed message functions. Your bundler tree-shakes unused
72
64
  <a href="https://inlang.com/m/gerre34r/library-inlang-paraglideJs/vite"><img src="https://cdn.simpleicons.org/vuedotjs/4FC08D" alt="Vue" width="18" height="18" /> Vue</a> ·
73
65
  <a href="https://github.com/TanStack/router/tree/main/examples/react/start-i18n-paraglide"><img src="https://tanstack.com/images/logos/logo-color-100.png" alt="TanStack" width="18" height="18" /> TanStack Start</a> ·
74
66
  <a href="https://inlang.com/m/gerre34r/library-inlang-paraglideJs/sveltekit"><img src="https://cdn.simpleicons.org/svelte/FF3E00" alt="Svelte" width="18" height="18" /> SvelteKit</a> ·
75
- <a href="https://inlang.com/m/gerre34r/library-inlang-paraglideJs/next-js"><img src="https://cdn.simpleicons.org/nextdotjs" alt="Next.js" width="18" height="18" /> Next.js</a> ·
67
+ <a href="https://inlang.com/m/gerre34r/library-inlang-paraglideJs/react-router"><img src="https://cdn.simpleicons.org/reactrouter/CA4245" alt="React Router" width="18" height="18" /> React Router</a> ·
76
68
  <a href="https://inlang.com/m/gerre34r/library-inlang-paraglideJs/astro"><img src="https://cdn.simpleicons.org/astro/FF5D01" alt="Astro" width="18" height="18" /> Astro</a> ·
77
69
  <a href="https://inlang.com/m/gerre34r/library-inlang-paraglideJs/vanilla-js-ts"><img src="https://cdn.simpleicons.org/javascript/F7DF1E" alt="JavaScript" width="18" height="18" /> Vanilla JS/TS</a>
78
70
  </p>
79
71
 
72
+ > [!TIP]
73
+ > <img src="https://vitejs.dev/logo.svg" alt="Vite" width="16" height="16" /> **Paraglide is ideal for any Vite based app.** Setup is just one plugin and Vite's tree-shaking eliminates unused messages automatically. [Get started →](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/vite)
74
+
80
75
  ## Quick Start
81
76
 
82
77
  ```bash
@@ -84,6 +79,7 @@ npx @inlang/paraglide-js init
84
79
  ```
85
80
 
86
81
  The CLI sets up everything:
82
+
87
83
  - Creates your message files
88
84
  - Configures your bundler (Vite, Webpack, etc.)
89
85
  - Generates typesafe message functions
@@ -91,32 +87,42 @@ The CLI sets up everything:
91
87
  Then use your messages:
92
88
 
93
89
  ```js
94
- import { m } from "./paraglide/messages.js"
95
- import { setLocale, getLocale } from "./paraglide/runtime.js"
90
+ import { m } from "./paraglide/messages.js";
91
+ import { setLocale, getLocale } from "./paraglide/runtime.js";
96
92
 
97
93
  // Use messages (typesafe, with autocomplete)
98
- m.hello_world()
99
- m.greeting({ name: "Ada" })
94
+ m.hello_world();
95
+ m.greeting({ name: "Ada" });
100
96
 
101
97
  // Get/set locale
102
- getLocale() // "en"
103
- setLocale("de") // switches to German
98
+ getLocale(); // "en"
99
+ setLocale("de"); // switches to German
104
100
  ```
105
101
 
106
102
  **[Full Getting Started Guide →](https://inlang.com/m/gerre34r/library-inlang-paraglideJs)**
107
103
 
108
104
  ## How It Works
109
105
 
106
+ Paraglide compiles an [inlang project](https://inlang.com/docs/introduction#how-it-works) into tree-shakable message functions. Your bundler eliminates unused messages at build time.
107
+
110
108
  ```
111
- messages/en.json ──┐
112
- messages/de.json ──┼──→ Compiler ──→ ./paraglide/messages.js
113
- messages/fr.json ──┘ ./paraglide/runtime.js
109
+ ┌────────────────┐
110
+ │ Inlang Project │
111
+ └───────┬────────┘
112
+
113
+
114
+ ┌────────────────────────┐
115
+ │ Paraglide Compiler │
116
+ └───────────┬────────────┘
117
+
118
+
119
+ ┌──────────────────────────┐
120
+ │ ./paraglide/messages.js │
121
+ │ ./paraglide/runtime.js │
122
+ └──────────────────────────┘
114
123
  ```
115
124
 
116
- 1. You write messages in JSON (or any supported format)
117
- 2. The compiler generates typed functions
118
- 3. Your bundler tree-shakes unused messages
119
- 4. Result: tiny, typesafe, fast
125
+ [Watch: How Paraglide JS works in 6 minutes →](https://www.youtube.com/watch?v=PBhdb5AS0mk)
120
126
 
121
127
  ## Message Format
122
128
 
@@ -124,8 +130,8 @@ Paraglide uses `Intl.PluralRules` for locale-aware pluralization, supporting all
124
130
 
125
131
  ```js
126
132
  // Pluralization example
127
- m.items_in_cart({ count: 1 }) // "1 item in cart"
128
- m.items_in_cart({ count: 5 }) // "5 items in cart"
133
+ m.items_in_cart({ count: 1 }); // "1 item in cart"
134
+ m.items_in_cart({ count: 5 }); // "5 items in cart"
129
135
 
130
136
  // Works correctly for complex locales (Russian, Arabic, etc.)
131
137
  ```
@@ -136,13 +142,13 @@ Message format is **plugin-based** — use the default inlang format, or switch
136
142
 
137
143
  ## Comparison
138
144
 
139
- | Feature | Paraglide | i18next | react-intl |
140
- |---------|-----------|---------|------------|
141
- | **Runtime size** | ~300B | 10kB+ | 8kB+ |
142
- | **Tree-shakable** | ✅ | ❌ | ❌ |
143
- | **Typesafe** | ✅ | Partial | ❌ |
144
- | **Framework agnostic** | ✅ | Wrappers needed | React only |
145
- | **i18n routing** | ✅ Built-in | ❌ | ❌ |
145
+ | Feature | Paraglide | i18next | react-intl |
146
+ | ---------------------- | ---------------------------------- | --------------------- | --------------------- |
147
+ | **i18n bundle size** | Up to 70% smaller via tree-shaking | Ships all messages | Ships all messages |
148
+ | **Tree-shakable** | ✅ | ❌ | ❌ |
149
+ | **Typesafe** | ✅ | Partial | ❌ |
150
+ | **Framework agnostic** | ✅ | Wrappers needed | React only |
151
+ | **i18n routing** | ✅ Built-in | ❌ | ❌ |
146
152
 
147
153
  **[Full Comparison →](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/comparison)**
148
154
 
@@ -160,6 +166,10 @@ Message format is **plugin-based** — use the default inlang format, or switch
160
166
  >
161
167
  > Dalibor Hon · Discord
162
168
 
169
+ > **"I migrated from i18next. Paraglide reduced my i18n bundle from 40KB to ~2KB."**
170
+ >
171
+ > Daniel · [Why I Replaced i18next with Paraglide JS](https://dropanote.de/en/blog/20250726-why-i-replaced-i18next-with-paraglide-js/)
172
+
163
173
  ## Talks
164
174
 
165
175
  - [Paraglide JS 1.0 announcement](https://www.youtube.com/watch?v=-YES3CCAG90)
@@ -169,19 +179,19 @@ Message format is **plugin-based** — use the default inlang format, or switch
169
179
 
170
180
  Paraglide is built on the [open inlang format](https://github.com/opral/inlang-sdk). Works with:
171
181
 
172
- | Tool | Description |
173
- |------|-------------|
174
- | [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtension) | VS Code extension for inline translation editing |
175
- | [CLI](https://inlang.com/m/2qj2w8pu/app-inlang-cli) | Machine translate from the terminal |
176
- | [Fink](https://inlang.com/m/tdozzpar/app-inlang-finkLocalizationEditor) | Translation editor for non-developers |
177
- | [Parrot](https://inlang.com/m/gkrpgoir/app-parrot-figmaPlugin) | Manage translations in Figma |
182
+ | Tool | Description |
183
+ | ----------------------------------------------------------------------- | ------------------------------------------------ |
184
+ | [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtension) | VS Code extension for inline translation editing |
185
+ | [CLI](https://inlang.com/m/2qj2w8pu/app-inlang-cli) | Machine translate from the terminal |
186
+ | [Fink](https://inlang.com/m/tdozzpar/app-inlang-finkLocalizationEditor) | Translation editor for non-developers |
187
+ | [Parrot](https://inlang.com/m/gkrpgoir/app-parrot-figmaPlugin) | Manage translations in Figma |
178
188
 
179
189
  **[Explore the inlang ecosystem →](https://inlang.com/c/apps)**
180
190
 
181
191
  ## Documentation
182
192
 
183
193
  - [Getting Started](https://inlang.com/m/gerre34r/library-inlang-paraglideJs)
184
- - [Framework Guides](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/next-js) (Next.js, SvelteKit, Astro, etc.)
194
+ - [Framework Guides](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/react-router) (React Router, SvelteKit, Astro, etc.)
185
195
  - [Message Syntax & Pluralization](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/variants)
186
196
  - [Routing & SSR](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/server-side-rendering)
187
197
  - [API Reference](https://inlang.com/m/gerre34r/library-inlang-paraglideJs)
@@ -1,2 +1,2 @@
1
- export declare const paraglideRollupPlugin: (options: import("../index.js").CompilerOptions) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
1
+ export declare const paraglideRollupPlugin: (options: import("../index.js").CompilerOptions) => import("unplugin").RollupPlugin<any> | import("unplugin").RollupPlugin<any>[];
2
2
  //# sourceMappingURL=rollup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/rollup.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,mHAAsC,CAAC"}
1
+ {"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/rollup.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,mIAAsC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/unplugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAMhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAavE,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,eAAe,CA2H3D,CAAC"}
1
+ {"version":3,"file":"unplugin.d.ts","sourceRoot":"","sources":["../../src/bundler-plugins/unplugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAoBvE,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,eAAe,CAkJ3D,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { compile } from "../compiler/compile.js";
2
- import fs from "node:fs";
3
- import { resolve, relative } from "node:path";
4
- import { nodeNormalizePath } from "../utilities/node-normalize-path.js";
2
+ import { relative } from "node:path";
5
3
  import { Logger } from "../services/logger/index.js";
4
+ import { createTrackedFs, getWatchTargets, isPathWithinDirectories, } from "../services/file-watching/tracked-fs.js";
5
+ import { nodeNormalizePath } from "../utilities/node-normalize-path.js";
6
6
  const PLUGIN_NAME = "unplugin-paraglide-js";
7
7
  const logger = new Logger();
8
8
  /**
@@ -10,6 +10,7 @@ const logger = new Logger();
10
10
  */
11
11
  let isServer;
12
12
  let previousCompilation;
13
+ const { fs: trackedFs, readFiles, clearReadFiles } = createTrackedFs();
13
14
  export const unpluginFactory = (args) => ({
14
15
  name: PLUGIN_NAME,
15
16
  enforce: "pre",
@@ -21,7 +22,7 @@ export const unpluginFactory = (args) => ({
21
22
  (isProduction ? "message-modules" : "locale-modules");
22
23
  try {
23
24
  previousCompilation = await compile({
24
- fs: wrappedFs,
25
+ fs: trackedFs,
25
26
  previousCompilation,
26
27
  outputStructure,
27
28
  // webpack invokes the `buildStart` api in watch mode,
@@ -41,13 +42,23 @@ export const unpluginFactory = (args) => ({
41
42
  }
42
43
  finally {
43
44
  // in any case add the files to watch
44
- for (const path of Array.from(readFiles)) {
45
- this.addWatchFile(path);
45
+ const targets = getWatchTargets(readFiles, { outdir: args.outdir });
46
+ for (const filePath of targets.files) {
47
+ this.addWatchFile(filePath);
48
+ }
49
+ for (const directoryPath of targets.directories) {
50
+ this.addWatchFile(directoryPath);
46
51
  }
47
52
  }
48
53
  },
49
54
  async watchChange(path) {
50
- const shouldCompile = readFiles.has(path) && !path.includes("cache");
55
+ const normalizedPath = nodeNormalizePath(path);
56
+ const targets = getWatchTargets(readFiles, { outdir: args.outdir });
57
+ if (targets.isIgnoredPath(normalizedPath)) {
58
+ return;
59
+ }
60
+ const shouldCompile = targets.files.has(normalizedPath) ||
61
+ isPathWithinDirectories(normalizedPath, targets.directories);
51
62
  if (shouldCompile === false) {
52
63
  return;
53
64
  }
@@ -60,9 +71,9 @@ export const unpluginFactory = (args) => ({
60
71
  try {
61
72
  logger.info(`Re-compiling inlang project... File "${relative(process.cwd(), path)}" has changed.`);
62
73
  // Clear readFiles to track fresh file reads
63
- readFiles.clear();
74
+ clearReadFiles();
64
75
  previousCompilation = await compile({
65
- fs: wrappedFs,
76
+ fs: trackedFs,
66
77
  previousCompilation,
67
78
  outputStructure,
68
79
  cleanOutdir: false,
@@ -71,12 +82,19 @@ export const unpluginFactory = (args) => ({
71
82
  });
72
83
  logger.success(`Re-compilation complete (${outputStructure})`);
73
84
  // Add any new files to watch
74
- for (const filePath of Array.from(readFiles)) {
85
+ const nextTargets = getWatchTargets(readFiles, { outdir: args.outdir });
86
+ for (const filePath of nextTargets.files) {
75
87
  this.addWatchFile(filePath);
76
88
  }
89
+ for (const directoryPath of nextTargets.directories) {
90
+ this.addWatchFile(directoryPath);
91
+ }
77
92
  }
78
93
  catch (e) {
79
- readFiles = previouslyReadFiles;
94
+ clearReadFiles();
95
+ for (const filePath of previouslyReadFiles) {
96
+ readFiles.add(filePath);
97
+ }
80
98
  // Reset compilation result on error
81
99
  previousCompilation = undefined;
82
100
  logger.warn("Failed to re-compile project:", e.message);
@@ -88,6 +106,11 @@ export const unpluginFactory = (args) => ({
88
106
  isServer = "import.meta.env?.SSR ?? typeof window === 'undefined'";
89
107
  },
90
108
  },
109
+ configEnvironment: {
110
+ handler: () => {
111
+ isServer = "import.meta.env?.SSR ?? typeof window === 'undefined'";
112
+ },
113
+ },
91
114
  },
92
115
  webpack(compiler) {
93
116
  compiler.options.resolve = {
@@ -106,7 +129,7 @@ export const unpluginFactory = (args) => ({
106
129
  (isProduction ? "message-modules" : "locale-modules");
107
130
  try {
108
131
  previousCompilation = await compile({
109
- fs: wrappedFs,
132
+ fs: trackedFs,
110
133
  previousCompilation,
111
134
  outputStructure,
112
135
  // clean dir needs to be false. otherwise webpack get's into a race condition
@@ -126,28 +149,4 @@ export const unpluginFactory = (args) => ({
126
149
  });
127
150
  },
128
151
  });
129
- let readFiles = new Set();
130
- // Create a wrapper around the fs object to intercept and store read files
131
- const wrappedFs = {
132
- ...fs,
133
- // @ts-expect-error - Node's fs has too many overloads
134
- readFile: (path, options, callback) => {
135
- readFiles.add(nodeNormalizePath(resolve(process.cwd(), path.toString())));
136
- return fs.readFile(path, options, callback);
137
- },
138
- // @ts-expect-error - Node's fs has too many overloads
139
- readFileSync: (path, options) => {
140
- readFiles.add(nodeNormalizePath(resolve(process.cwd(), path.toString())));
141
- return fs.readFileSync(path, options);
142
- },
143
- promises: {
144
- ...fs.promises,
145
- // @ts-expect-error - Node's fs.promises has too many overloads
146
- readFile: async (path, options) => {
147
- readFiles.add(nodeNormalizePath(resolve(process.cwd(), path.toString())));
148
- return fs.promises.readFile(path, options);
149
- },
150
- },
151
- // Add other fs methods as needed
152
- };
153
152
  //# sourceMappingURL=unplugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"unplugin.js","sourceRoot":"","sources":["../../src/bundler-plugins/unplugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAA0B,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAGrD,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAE5B;;GAEG;AACH,IAAI,QAA4B,CAAC;AAEjC,IAAI,mBAAkD,CAAC;AAEvD,MAAM,CAAC,MAAM,eAAe,GAAqC,CAAC,IAAI,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ources":["../../../../src/cli/commands/compile/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,eAAO,MAAM,cAAc,SA4DzB,CAAC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/compile/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,cAAc,SAoOzB,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import { Command } from "commander";
2
- import { resolve } from "node:path";
2
+ import fs from "node:fs";
3
+ import { resolve, relative } from "node:path";
3
4
  import { Logger } from "../../../services/logger/index.js";
4
5
  import { DEFAULT_OUTDIR, DEFAULT_PROJECT_PATH } from "../../defaults.js";
5
6
  import { compile } from "../../../compiler/compile.js";
6
7
  import { defaultCompilerOptions, } from "../../../compiler/compiler-options.js";
8
+ import { createTrackedFs, getWatchTargets, } from "../../../services/file-watching/tracked-fs.js";
7
9
  export const compileCommand = new Command()
8
10
  .name("compile")
9
11
  .summary("Compiles inlang Paraglide-JS")
@@ -17,25 +19,166 @@ export const compileCommand = new Command()
17
19
  ].join("\n"))
18
20
  .requiredOption("--silent", "Only log errors to the console", false)
19
21
  .option("--emit-ts-declarations", "Emit .d.ts files for the generated output (requires the typescript package)", defaultCompilerOptions.emitTsDeclarations)
22
+ .option("--watch", "Watch project files and recompile on change", false)
20
23
  .action(async (options) => {
21
24
  const logger = new Logger({ silent: options.silent, prefix: true });
22
25
  const path = resolve(process.cwd(), options.project);
23
- logger.info(`Compiling inlang project ...`);
24
- try {
25
- await compile({
26
- project: path,
27
- outdir: options.outdir,
28
- strategy: options.strategy ?? defaultCompilerOptions.strategy,
29
- emitTsDeclarations: options.emitTsDeclarations ??
30
- defaultCompilerOptions.emitTsDeclarations,
31
- });
26
+ const compileOptions = {
27
+ project: path,
28
+ outdir: options.outdir,
29
+ strategy: options.strategy ?? defaultCompilerOptions.strategy,
30
+ emitTsDeclarations: options.emitTsDeclarations ??
31
+ defaultCompilerOptions.emitTsDeclarations,
32
+ };
33
+ if (!options.watch) {
34
+ logger.info(`Compiling inlang project ...`);
35
+ try {
36
+ await compile(compileOptions);
37
+ }
38
+ catch (e) {
39
+ logger.error("Error while compiling inlang project.");
40
+ logger.error(e);
41
+ process.exit(1);
42
+ }
43
+ logger.success(`Successfully compiled inlang project.`);
44
+ process.exit(0);
32
45
  }
33
- catch (e) {
34
- logger.error("Error while compiling inlang project.");
35
- logger.error(e);
36
- process.exit(1);
37
- }
38
- logger.success(`Successfully compiled inlang project.`);
39
- process.exit(0);
46
+ const { fs: trackedFs, readFiles, clearReadFiles } = createTrackedFs();
47
+ const fileWatchers = new Map();
48
+ const directoryWatchers = new Map();
49
+ let previousCompilation;
50
+ let compileTimer;
51
+ let compileInProgress = false;
52
+ let compileRequested = false;
53
+ const updateWatchers = (files) => {
54
+ const { files: nextFiles, directories: nextDirectories, isIgnoredPath, } = getWatchTargets(files, { outdir: options.outdir });
55
+ for (const [filePath, watcher] of fileWatchers) {
56
+ if (!nextFiles.has(filePath)) {
57
+ watcher.close();
58
+ fileWatchers.delete(filePath);
59
+ }
60
+ }
61
+ for (const [directoryPath, watcher] of directoryWatchers) {
62
+ if (!nextDirectories.has(directoryPath)) {
63
+ watcher.close();
64
+ directoryWatchers.delete(directoryPath);
65
+ }
66
+ }
67
+ const attachWatcherErrorHandler = (watcher, targetPath, targetType) => {
68
+ watcher.on("error", (error) => {
69
+ logger.warn(`Watch ${targetType} error for ${targetPath}: ${error.message}`);
70
+ });
71
+ };
72
+ for (const filePath of nextFiles) {
73
+ if (fileWatchers.has(filePath)) {
74
+ continue;
75
+ }
76
+ try {
77
+ const watcher = fs.watch(filePath, () => {
78
+ scheduleCompile(filePath);
79
+ });
80
+ attachWatcherErrorHandler(watcher, filePath, "file");
81
+ fileWatchers.set(filePath, watcher);
82
+ }
83
+ catch (error) {
84
+ logger.warn(`Failed to watch file: ${filePath}`);
85
+ }
86
+ }
87
+ for (const directoryPath of nextDirectories) {
88
+ if (directoryWatchers.has(directoryPath)) {
89
+ continue;
90
+ }
91
+ try {
92
+ const watcher = fs.watch(directoryPath, (eventType, filename) => {
93
+ if (!filename) {
94
+ scheduleCompile(directoryPath);
95
+ return;
96
+ }
97
+ const changedPath = resolve(directoryPath, filename.toString());
98
+ if (isIgnoredPath(changedPath)) {
99
+ return;
100
+ }
101
+ scheduleCompile(changedPath);
102
+ });
103
+ attachWatcherErrorHandler(watcher, directoryPath, "directory");
104
+ directoryWatchers.set(directoryPath, watcher);
105
+ }
106
+ catch (error) {
107
+ logger.warn(`Failed to watch directory: ${directoryPath}`);
108
+ }
109
+ }
110
+ };
111
+ const runCompile = async (changedPath) => {
112
+ if (compileInProgress) {
113
+ compileRequested = true;
114
+ return;
115
+ }
116
+ compileInProgress = true;
117
+ const previouslyReadFiles = new Set(readFiles);
118
+ clearReadFiles();
119
+ if (changedPath) {
120
+ logger.info(`Re-compiling inlang project... File "${relative(process.cwd(), changedPath)}" has changed.`);
121
+ }
122
+ else {
123
+ logger.info("Compiling inlang project ...");
124
+ }
125
+ try {
126
+ previousCompilation = await compile({
127
+ ...compileOptions,
128
+ fs: trackedFs,
129
+ previousCompilation,
130
+ cleanOutdir: previousCompilation === undefined,
131
+ });
132
+ if (changedPath) {
133
+ logger.success("Re-compilation complete.");
134
+ }
135
+ else {
136
+ logger.success("Successfully compiled inlang project.");
137
+ }
138
+ }
139
+ catch (e) {
140
+ if (previouslyReadFiles.size > 0) {
141
+ clearReadFiles();
142
+ for (const filePath of previouslyReadFiles) {
143
+ readFiles.add(filePath);
144
+ }
145
+ }
146
+ previousCompilation = undefined;
147
+ logger.error("Error while compiling inlang project.");
148
+ logger.error(e);
149
+ }
150
+ finally {
151
+ updateWatchers(readFiles);
152
+ compileInProgress = false;
153
+ if (compileRequested) {
154
+ compileRequested = false;
155
+ runCompile();
156
+ }
157
+ }
158
+ };
159
+ const scheduleCompile = (changedPath) => {
160
+ if (compileTimer) {
161
+ clearTimeout(compileTimer);
162
+ }
163
+ compileTimer = setTimeout(() => {
164
+ runCompile(changedPath);
165
+ }, 100);
166
+ };
167
+ const closeWatchers = () => {
168
+ for (const watcher of fileWatchers.values()) {
169
+ watcher.close();
170
+ }
171
+ for (const watcher of directoryWatchers.values()) {
172
+ watcher.close();
173
+ }
174
+ fileWatchers.clear();
175
+ directoryWatchers.clear();
176
+ };
177
+ process.on("SIGINT", () => {
178
+ closeWatchers();
179
+ process.exit(0);
180
+ });
181
+ await runCompile();
182
+ logger.info("Watching for changes...");
40
183
  });
41
184
  //# sourceMappingURL=command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/cli/commands/compile/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EACN,sBAAsB,GAEtB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,EAAE;KACzC,IAAI,CAAC,SAAS,CAAC;KACf,OAAO,CAAC,8BAA8B,CAAC;KACvC,cAAc,CACd,kBAAkB,EAClB,6DAA6D,EAC7D,oBAAoB,CACpB;KACA,cAAc,CACd,iBAAiB,EACjB,8DAA8D,EAC9D,cAAc,CACd;KACA,MAAM,CACN,uBAAuB,EACvB;IACC,0BAA0B;IAC1B,EAAE;IACF,sDAAsD;IACtD,gFAAgF;CAChF,CAAC,IAAI,CAAC,IAAI,CAAC,CACZ;KACA,cAAc,CAAC,UAAU,EAAE,gCAAgC,EAAE,KAAK,CAAC;KACnE,MAAM,CACN,wBA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AAC,CAAC;IAEF,MAAM,aAAa,GAAG,GAAG,EAAE;QAC1B,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;YAC7C,OAAO,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,iBAAiB,CAAC,MAAM,EAAE,EAAE,CAAC;YAClD,OAAO,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;QACD,YAAY,CAAC,KAAK,EAAE,CAAC;QACrB,iBAAiB,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;QACzB,aAAa,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,EAAE,CAAC;IACnB,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AACxC,CAAC,CACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,WAAW,SAwDrB,CAAC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC,eAAO,MAAM,WAAW,SAqDrB,CAAC"}