@inlang/paraglide-js 2.7.2 → 2.8.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/README.md +42 -47
- package/dist/bundler-plugins/unplugin.d.ts.map +1 -1
- package/dist/bundler-plugins/unplugin.js +30 -36
- package/dist/bundler-plugins/unplugin.js.map +1 -1
- package/dist/cli/commands/compile/command.d.ts.map +1 -1
- package/dist/cli/commands/compile/command.js +160 -17
- package/dist/cli/commands/compile/command.js.map +1 -1
- package/dist/cli/commands/init/command.d.ts.map +1 -1
- package/dist/cli/commands/init/command.js +7 -11
- package/dist/cli/commands/init/command.js.map +1 -1
- package/dist/cli/steps/check-for-uncomitted-changes.d.ts.map +1 -1
- package/dist/cli/steps/check-for-uncomitted-changes.js +2 -2
- package/dist/cli/steps/check-for-uncomitted-changes.js.map +1 -1
- package/dist/cli/steps/maybe-add-sherlock.d.ts.map +1 -1
- package/dist/cli/steps/maybe-add-sherlock.js +9 -3
- package/dist/cli/steps/maybe-add-sherlock.js.map +1 -1
- package/dist/cli/steps/prompt-for-outdir.js +1 -1
- package/dist/cli/steps/prompt-for-outdir.js.map +1 -1
- package/dist/compiler/compile-message.test.js +22 -0
- package/dist/compiler/compile-message.test.js.map +1 -1
- package/dist/compiler/compile-project.d.ts +2 -1
- package/dist/compiler/compile-project.d.ts.map +1 -1
- package/dist/compiler/compile-project.js +5 -1
- package/dist/compiler/compile-project.js.map +1 -1
- package/dist/compiler/compile-project.test.js +53 -0
- package/dist/compiler/compile-project.test.js.map +1 -1
- package/dist/compiler/compile.d.ts.map +1 -1
- package/dist/compiler/compile.js +1 -0
- package/dist/compiler/compile.js.map +1 -1
- package/dist/compiler/compile.test.js +26 -0
- package/dist/compiler/compile.test.js.map +1 -1
- package/dist/compiler/compiler-options.d.ts +18 -0
- package/dist/compiler/compiler-options.d.ts.map +1 -1
- package/dist/compiler/compiler-options.js +1 -0
- package/dist/compiler/compiler-options.js.map +1 -1
- package/dist/compiler/create-readme.d.ts +10 -0
- package/dist/compiler/create-readme.d.ts.map +1 -0
- package/dist/compiler/create-readme.js +104 -0
- package/dist/compiler/create-readme.js.map +1 -0
- package/dist/compiler/runtime/create-runtime.js +7 -1
- package/dist/compiler/runtime/create-runtime.js.map +1 -1
- package/dist/compiler/server/create-server-file.js +7 -1
- package/dist/compiler/server/create-server-file.js.map +1 -1
- package/dist/compiler/server/middleware.d.ts +40 -4
- package/dist/compiler/server/middleware.d.ts.map +1 -1
- package/dist/compiler/server/middleware.js +40 -4
- package/dist/compiler/server/middleware.js.map +1 -1
- package/dist/services/env-variables/index.js +1 -1
- package/dist/services/file-watching/tracked-fs.d.ts +26 -0
- package/dist/services/file-watching/tracked-fs.d.ts.map +1 -0
- package/dist/services/file-watching/tracked-fs.js +92 -0
- package/dist/services/file-watching/tracked-fs.js.map +1 -0
- package/dist/services/file-watching/tracked-fs.test.d.ts +2 -0
- package/dist/services/file-watching/tracked-fs.test.d.ts.map +1 -0
- package/dist/services/file-watching/tracked-fs.test.js +90 -0
- package/dist/services/file-watching/tracked-fs.test.js.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@inlang/paraglide-js)
|
|
2
|
-
[](https://github.com/opral/paraglide-js/issues)
|
|
3
|
+
[](https://github.com/opral/paraglide-js/graphs/contributors)
|
|
3
4
|
[](https://discord.gg/gdMPPWy57R)
|
|
4
|
-
[](https://github.com/opral/inlang-paraglide-js/blob/main/LICENSE)
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
|
-
<img src="https://cdn.jsdelivr.net/gh/opral/
|
|
7
|
+
<img src="https://cdn.jsdelivr.net/gh/opral/paraglide-js@latest/assets/header.png" alt="Paraglide JS" width="600" />
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
10
|
<h1 align="center">🪂 Paraglide JS</h1>
|
|
11
11
|
<p align="center">
|
|
12
|
-
<strong>Compiler-based i18n library
|
|
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.
|
|
12
|
+
<strong>Compiler-based i18n library that emits tree-shakable translations, leading to up to 70% smaller bundle sizes.</strong>
|
|
17
13
|
</p>
|
|
18
14
|
|
|
19
15
|
<p align="center">
|
|
@@ -47,23 +43,23 @@
|
|
|
47
43
|
```
|
|
48
44
|
|
|
49
45
|
```js
|
|
50
|
-
import { m } from "./paraglide/messages.js"
|
|
46
|
+
import { m } from "./paraglide/messages.js";
|
|
51
47
|
|
|
52
|
-
m.greeting({ name: "World" })
|
|
48
|
+
m.greeting({ name: "World" }); // "Hello World!" — fully typesafe
|
|
53
49
|
```
|
|
54
50
|
|
|
55
|
-
The compiler generates typed message functions. Your bundler tree-shakes unused messages. Expect
|
|
51
|
+
The compiler generates typed message functions. Your bundler tree-shakes unused messages. Expect [**up to 70% smaller bundle sizes**](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/benchmark) compared to runtime i18n libraries (e.g. 47 KB vs 205 KB).
|
|
56
52
|
|
|
57
53
|
## Why Paraglide?
|
|
58
54
|
|
|
59
|
-
|
|
|
60
|
-
|
|
61
|
-
| **
|
|
62
|
-
| **Tree-Shakable**
|
|
63
|
-
| **Fully Typesafe**
|
|
64
|
-
| **Framework Agnostic**
|
|
65
|
-
| **Built-in i18n Routing** | URL-based locale detection and localized paths out of the box.
|
|
66
|
-
| **
|
|
55
|
+
| | |
|
|
56
|
+
| ------------------------- | -------------------------------------------------------------------------- |
|
|
57
|
+
| **Smaller Bundle Sizes** | Up to 70% smaller than runtime i18n libraries. |
|
|
58
|
+
| **Tree-Shakable** | Unused messages are eliminated by your bundler. |
|
|
59
|
+
| **Fully Typesafe** | Autocomplete for message keys and parameters. Typos become compile errors. |
|
|
60
|
+
| **Framework Agnostic** | Works with React, Vue, Svelte, Solid, TanStack, or vanilla JS/TS. |
|
|
61
|
+
| **Built-in i18n Routing** | URL-based locale detection and localized paths out of the box. |
|
|
62
|
+
| **Built on inlang** | Integrates with VS Code extension, CLI, and translation editor. |
|
|
67
63
|
|
|
68
64
|
## Works With Your Stack
|
|
69
65
|
|
|
@@ -84,6 +80,7 @@ npx @inlang/paraglide-js init
|
|
|
84
80
|
```
|
|
85
81
|
|
|
86
82
|
The CLI sets up everything:
|
|
83
|
+
|
|
87
84
|
- Creates your message files
|
|
88
85
|
- Configures your bundler (Vite, Webpack, etc.)
|
|
89
86
|
- Generates typesafe message functions
|
|
@@ -91,16 +88,16 @@ The CLI sets up everything:
|
|
|
91
88
|
Then use your messages:
|
|
92
89
|
|
|
93
90
|
```js
|
|
94
|
-
import { m } from "./paraglide/messages.js"
|
|
95
|
-
import { setLocale, getLocale } from "./paraglide/runtime.js"
|
|
91
|
+
import { m } from "./paraglide/messages.js";
|
|
92
|
+
import { setLocale, getLocale } from "./paraglide/runtime.js";
|
|
96
93
|
|
|
97
94
|
// Use messages (typesafe, with autocomplete)
|
|
98
|
-
m.hello_world()
|
|
99
|
-
m.greeting({ name: "Ada" })
|
|
95
|
+
m.hello_world();
|
|
96
|
+
m.greeting({ name: "Ada" });
|
|
100
97
|
|
|
101
98
|
// Get/set locale
|
|
102
|
-
getLocale()
|
|
103
|
-
setLocale("de")
|
|
99
|
+
getLocale(); // "en"
|
|
100
|
+
setLocale("de"); // switches to German
|
|
104
101
|
```
|
|
105
102
|
|
|
106
103
|
**[Full Getting Started Guide →](https://inlang.com/m/gerre34r/library-inlang-paraglideJs)**
|
|
@@ -108,15 +105,13 @@ setLocale("de") // switches to German
|
|
|
108
105
|
## How It Works
|
|
109
106
|
|
|
110
107
|
```
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
┌────────────────┐ ┌────────────────────┐ ┌──────────────────────────┐
|
|
109
|
+
│ Inlang Project │ ───▶ │ Paraglide Compiler │ ───▶ │ ./paraglide/messages.js │
|
|
110
|
+
└────────────────┘ └────────────────────┘ │ ./paraglide/runtime.js │
|
|
111
|
+
└──────────────────────────┘
|
|
114
112
|
```
|
|
115
113
|
|
|
116
|
-
|
|
117
|
-
2. The compiler generates typed functions
|
|
118
|
-
3. Your bundler tree-shakes unused messages
|
|
119
|
-
4. Result: tiny, typesafe, fast
|
|
114
|
+
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.
|
|
120
115
|
|
|
121
116
|
## Message Format
|
|
122
117
|
|
|
@@ -124,8 +119,8 @@ Paraglide uses `Intl.PluralRules` for locale-aware pluralization, supporting all
|
|
|
124
119
|
|
|
125
120
|
```js
|
|
126
121
|
// Pluralization example
|
|
127
|
-
m.items_in_cart({ count: 1 })
|
|
128
|
-
m.items_in_cart({ count: 5 })
|
|
122
|
+
m.items_in_cart({ count: 1 }); // "1 item in cart"
|
|
123
|
+
m.items_in_cart({ count: 5 }); // "5 items in cart"
|
|
129
124
|
|
|
130
125
|
// Works correctly for complex locales (Russian, Arabic, etc.)
|
|
131
126
|
```
|
|
@@ -136,13 +131,13 @@ Message format is **plugin-based** — use the default inlang format, or switch
|
|
|
136
131
|
|
|
137
132
|
## Comparison
|
|
138
133
|
|
|
139
|
-
| Feature
|
|
140
|
-
|
|
141
|
-
| **
|
|
142
|
-
| **Tree-shakable**
|
|
143
|
-
| **Typesafe**
|
|
144
|
-
| **Framework agnostic** | ✅
|
|
145
|
-
| **i18n routing**
|
|
134
|
+
| Feature | Paraglide | i18next | react-intl |
|
|
135
|
+
| ---------------------- | ----------- | --------------- | ---------- |
|
|
136
|
+
| **Bundle size** | Up to 70% smaller via tree-shaking | ❌ Ships all messages | ❌ Ships all messages |
|
|
137
|
+
| **Tree-shakable** | ✅ | ❌ | ❌ |
|
|
138
|
+
| **Typesafe** | ✅ | Partial | ❌ |
|
|
139
|
+
| **Framework agnostic** | ✅ | Wrappers needed | React only |
|
|
140
|
+
| **i18n routing** | ✅ Built-in | ❌ | ❌ |
|
|
146
141
|
|
|
147
142
|
**[Full Comparison →](https://inlang.com/m/gerre34r/library-inlang-paraglideJs/comparison)**
|
|
148
143
|
|
|
@@ -169,12 +164,12 @@ Message format is **plugin-based** — use the default inlang format, or switch
|
|
|
169
164
|
|
|
170
165
|
Paraglide is built on the [open inlang format](https://github.com/opral/inlang-sdk). Works with:
|
|
171
166
|
|
|
172
|
-
| Tool
|
|
173
|
-
|
|
174
|
-
| [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtension)
|
|
175
|
-
| [CLI](https://inlang.com/m/2qj2w8pu/app-inlang-cli)
|
|
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)
|
|
167
|
+
| Tool | Description |
|
|
168
|
+
| ----------------------------------------------------------------------- | ------------------------------------------------ |
|
|
169
|
+
| [Sherlock](https://inlang.com/m/r7kp499g/app-inlang-ideExtension) | VS Code extension for inline translation editing |
|
|
170
|
+
| [CLI](https://inlang.com/m/2qj2w8pu/app-inlang-cli) | Machine translate from the terminal |
|
|
171
|
+
| [Fink](https://inlang.com/m/tdozzpar/app-inlang-finkLocalizationEditor) | Translation editor for non-developers |
|
|
172
|
+
| [Parrot](https://inlang.com/m/gkrpgoir/app-parrot-figmaPlugin) | Manage translations in Figma |
|
|
178
173
|
|
|
179
174
|
**[Explore the inlang ecosystem →](https://inlang.com/c/apps)**
|
|
180
175
|
|
|
@@ -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;
|
|
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,CA6I3D,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { compile } from "../compiler/compile.js";
|
|
2
|
-
import
|
|
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:
|
|
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
|
-
|
|
45
|
-
|
|
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
|
|
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
|
-
|
|
74
|
+
clearReadFiles();
|
|
64
75
|
previousCompilation = await compile({
|
|
65
|
-
fs:
|
|
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
|
-
|
|
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
|
-
|
|
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);
|
|
@@ -106,7 +124,7 @@ export const unpluginFactory = (args) => ({
|
|
|
106
124
|
(isProduction ? "message-modules" : "locale-modules");
|
|
107
125
|
try {
|
|
108
126
|
previousCompilation = await compile({
|
|
109
|
-
fs:
|
|
127
|
+
fs: trackedFs,
|
|
110
128
|
previousCompilation,
|
|
111
129
|
outputStructure,
|
|
112
130
|
// clean dir needs to be false. otherwise webpack get's into a race condition
|
|
@@ -126,28 +144,4 @@ export const unpluginFactory = (args) => ({
|
|
|
126
144
|
});
|
|
127
145
|
},
|
|
128
146
|
});
|
|
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
147
|
//# 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,
|
|
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,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EACN,eAAe,EACf,eAAe,EACf,uBAAuB,GACvB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAE5B;;GAEG;AACH,IAAI,QAA4B,CAAC;AAEjC,IAAI,mBAAkD,CAAC;AACvD,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,eAAe,EAAE,CAAC;AAEvE,MAAM,CAAC,MAAM,eAAe,GAAqC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC3E,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,KAAK;IACd,KAAK,CAAC,UAAU;QACf,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;QAC3D,uEAAuE;QACvE,0DAA0D;QAC1D,MAAM,eAAe,GACpB,IAAI,CAAC,eAAe;YACpB,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC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OAAO,CAAC,yBAAyB,eAAe,GAAG,CAAC,CAAC;YAC7D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;gBACpE,MAAM,CAAC,IAAI,CAAC,wDAAwD,CAAC,CAAC;gBACtE,IAAI,YAAY;oBAAE,MAAM,KAAK,CAAC;YAC/B,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;CACD,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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;
|
|
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,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CA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AAK,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,
|
|
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"}
|
|
@@ -16,10 +16,10 @@ import { compile } from "../../../compiler/compile.js";
|
|
|
16
16
|
import { maybeAddMachineTranslation } from "../../steps/maybe-add-machine-translation.js";
|
|
17
17
|
export const initCommand = new Command()
|
|
18
18
|
.name("init")
|
|
19
|
-
.summary("Initializes
|
|
19
|
+
.summary("Initializes Paraglide-JS.")
|
|
20
20
|
.action(async () => {
|
|
21
21
|
const logger = new Logger({ silent: false, prefix: false });
|
|
22
|
-
logger.box("Welcome to
|
|
22
|
+
logger.box("Welcome to Paraglide JS 🪂");
|
|
23
23
|
const ctx = {
|
|
24
24
|
logger,
|
|
25
25
|
fs: nodeFs.promises,
|
|
@@ -52,14 +52,11 @@ export const initCommand = new Command()
|
|
|
52
52
|
ctx.logger.warn("Failed to compile project automatically. You will need to run the compiler manually");
|
|
53
53
|
}
|
|
54
54
|
const successMessage = [
|
|
55
|
-
`
|
|
55
|
+
"Setup complete! Run `npm install` and then `npm run build`.",
|
|
56
|
+
`Docs: https://inlang.com/m/gerre34r/library-inlang-paraglideJs/basics`,
|
|
56
57
|
"\n",
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
`3. Visit https://inlang.com/m/gerre34r/library-inlang-paraglideJs/basics to get started.`,
|
|
60
|
-
"\n",
|
|
61
|
-
`For questions and feedback, visit`,
|
|
62
|
-
`https://github.com/opral/inlang-paraglide-js/issues`,
|
|
58
|
+
"For questions and feedback, visit",
|
|
59
|
+
"https://github.com/opral/paraglide-js/issues",
|
|
63
60
|
].join("\n");
|
|
64
61
|
ctx.logger.box(successMessage);
|
|
65
62
|
process.exit(0);
|
|
@@ -68,7 +65,7 @@ const addParaglideJsToDevDependencies = async (ctx) => {
|
|
|
68
65
|
const ctx1 = await updatePackageJson({
|
|
69
66
|
devDependencies: async (devDeps) => ({
|
|
70
67
|
...devDeps,
|
|
71
|
-
"@inlang/paraglide-js": ENV_VARIABLES.PARJS_PACKAGE_VERSION
|
|
68
|
+
"@inlang/paraglide-js": `^${ENV_VARIABLES.PARJS_PACKAGE_VERSION}`,
|
|
72
69
|
}),
|
|
73
70
|
})(ctx);
|
|
74
71
|
ctx.logger.success("Added @inlang/paraglide-js to the devDependencies in package.json.");
|
|
@@ -97,7 +94,6 @@ const addCompileStepToPackageJSON = async (ctx) => {
|
|
|
97
94
|
return scripts;
|
|
98
95
|
}
|
|
99
96
|
ctx.logger.success("Added the compile command to the build step in package.json.");
|
|
100
|
-
ctx.logger.info(`If you use a bundler like Vite, Rolldown, or Webpack, you can use a bundler plugin instead and remove the compile command from the build script.`);
|
|
101
97
|
ctx.logger.info(`Visit https://inlang.com/m/gerre34r/library-inlang-paraglideJs/compiling-messages for more information.`);
|
|
102
98
|
return scripts;
|
|
103
99
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/cli/commands/init/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6CAA6C,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,MAAM,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE1F,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,OAAO,EAAE;KACtC,IAAI,CAAC,MAAM,CAAC;KACZ,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../../../../src/cli/commands/init/command.ts"],"names":[],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;QAC7B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC1B,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;gBACjC,OAAO,CAAC,KAAK,GAAG,kCAAkC,WAAW,aAAa,MAAM,EAAE,CAAC;YACpF,CAAC;iBAAM,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,KAAK,KAAK,EAAE,CAAC;gBACrE,OAAO,CAAC,KAAK,GAAG,kCAAkC,WAAW,aAAa,MAAM,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC;YACxG,CAAC;iBAAM,CAAC;gBACP,OAAO,OAAO,CAAC;YAChB,CAAC;YAED,GAAG,CAAC,MAAM,CAAC,OAAO,CACjB,8DAA8D,CAC9D,CAAC;YACF,GAAG,CAAC,MAAM,CAAC,IAAI,CACd,yGAAyG,CACzG,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC;KACD,CAAC,CAAC,GAAG,CAAC,CAAC;IAER,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-for-uncomitted-changes.d.ts","sourceRoot":"","sources":["../../../src/cli/steps/check-for-uncomitted-changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAC/C;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"check-for-uncomitted-changes.d.ts","sourceRoot":"","sources":["../../../src/cli/steps/check-for-uncomitted-changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAC/C;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,EAClB,OAAO,CAuBP,CAAC"}
|
|
@@ -5,8 +5,8 @@ export const checkForUncommittedChanges = async (ctx) => {
|
|
|
5
5
|
if ((await execAsync("git status --porcelain")).toString().length === 0) {
|
|
6
6
|
return ctx;
|
|
7
7
|
}
|
|
8
|
-
ctx.logger.info(`You have uncommitted changes.\n\
|
|
9
|
-
const response = await prompt("
|
|
8
|
+
ctx.logger.info(`You have uncommitted changes.\n\nCommitting outstanding changes ensures that you don't lose any work, and see the changes the paraglide-js init command introduces.`);
|
|
9
|
+
const response = await prompt("Continue without committing?", {
|
|
10
10
|
type: "confirm",
|
|
11
11
|
initial: false,
|
|
12
12
|
});
|