wuchale 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -26,6 +26,10 @@ simplicity in mind.
26
26
  No extra imports or annotations. `wuchale` extracts and compiles everything
27
27
  automatically. In the spirit of Svelte itself.
28
28
 
29
+ > They say "i18n is too costly to add later"
30
+
31
+ ✨ **Not anymore**. wuchale brings i18n to existing Svelte projects — the UX-first way.
32
+
29
33
  ### 🧠 Compiler-Powered
30
34
 
31
35
  Built on the Svelte compiler and powered by AST
@@ -127,7 +131,7 @@ Then finally you write your Svelte files naturally:
127
131
  <script>
128
132
  import WuchaleTrans, { wuchaleTrans } from 'wuchale/runtime.svelte'
129
133
  </script>
130
- <h1>{wuchaleTrans(0)}</h1> <!-- Extracted "Hello" as index 0 -->
134
+ <p>{wuchaleTrans(0)}</p> <!-- Extracted "Hello" as index 0 -->
131
135
  ```
132
136
 
133
137
  Full example below.
@@ -258,7 +262,7 @@ rules can be configured, the default is:
258
262
 
259
263
  ## Where does it look?
260
264
 
261
- All files that can contain reactive logic. This means `*.svelte` and
265
+ All files that can contain reactive logic. This means `*.svelte`, `*.svelte.ts` and
262
266
  `*.svelte.js` files specifically.
263
267
 
264
268
  ## Plurals?
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wuchale",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "i18n for svelte without turning your codebase upside down",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,7 +4,7 @@ import {writeFile} from 'node:fs/promises'
4
4
  import compileTranslation from "./compile.js"
5
5
  import setupGemini from "./gemini.js"
6
6
  import PO from "pofile"
7
- import { relative } from "node:path"
7
+ import { normalize, relative } from "node:path"
8
8
 
9
9
  export const defaultOptions = {
10
10
  sourceLocale: 'en',
@@ -193,10 +193,10 @@ export default async function wuchale(options = defaultOptions) {
193
193
  * @param {string} id
194
194
  */
195
195
  handler: async function(code, id) {
196
- if (!id.startsWith(projectRoot)) {
196
+ if (!id.startsWith(projectRoot) || id.startsWith(normalize(projectRoot + '/node_modules'))) {
197
197
  return
198
198
  }
199
- const isModule = id.endsWith('.svelte.js')
199
+ const isModule = id.endsWith('.svelte.js') || id.endsWith('.svelte.ts')
200
200
  if (!id.endsWith('.svelte') && !isModule) {
201
201
  return
202
202
  }