@inlang/paraglide-js 2.0.6 → 2.0.7

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.
@@ -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,CAmG3D,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;AAMhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAavE,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,eAAe,CAyH3D,CAAC"}
@@ -14,11 +14,16 @@ export const unpluginFactory = (args) => ({
14
14
  name: PLUGIN_NAME,
15
15
  enforce: "pre",
16
16
  async buildStart() {
17
- logger.info("Compiling inlang project...");
17
+ const isProduction = process.env.NODE_ENV === "production";
18
+ // default to locale-modules for development to speed up the dev server
19
+ // https://github.com/opral/inlang-paraglide-js/issues/486
20
+ const outputStructure = args.outputStructure ??
21
+ (isProduction ? "message-modules" : "locale-modules");
18
22
  try {
19
23
  previousCompilation = await compile({
20
24
  fs: wrappedFs,
21
25
  previousCompilation,
26
+ outputStructure,
22
27
  // webpack invokes the `buildStart` api in watch mode,
23
28
  // to avoid cleaning the output directory in watch mode,
24
29
  // we only clean the output directory if there was no previous compilation
@@ -26,7 +31,7 @@ export const unpluginFactory = (args) => ({
26
31
  isServer,
27
32
  ...args,
28
33
  });
29
- logger.success("Compilation complete");
34
+ logger.success(`Compilation complete (${outputStructure})`);
30
35
  }
31
36
  catch (error) {
32
37
  logger.error("Failed to compile project:", error.message);
@@ -44,6 +49,11 @@ export const unpluginFactory = (args) => ({
44
49
  if (shouldCompile === false) {
45
50
  return;
46
51
  }
52
+ const isProduction = process.env.NODE_ENV === "production";
53
+ // default to locale-modules for development to speed up the dev server
54
+ // https://github.com/opral/inlang-paraglide-js/issues/486
55
+ const outputStructure = args.outputStructure ??
56
+ (isProduction ? "message-modules" : "locale-modules");
47
57
  const previouslyReadFiles = new Set(readFiles);
48
58
  try {
49
59
  logger.info(`Re-compiling inlang project... File "${relative(process.cwd(), path)}" has changed.`);
@@ -52,11 +62,12 @@ export const unpluginFactory = (args) => ({
52
62
  previousCompilation = await compile({
53
63
  fs: wrappedFs,
54
64
  previousCompilation,
65
+ outputStructure,
55
66
  cleanOutdir: false,
56
67
  isServer,
57
68
  ...args,
58
69
  });
59
- logger.success("Re-compilation complete");
70
+ logger.success(`Re-compilation complete (${outputStructure})`);
60
71
  // Add any new files to watch
61
72
  for (const filePath of Array.from(readFiles)) {
62
73
  this.addWatchFile(filePath);
@@ -86,17 +97,23 @@ export const unpluginFactory = (args) => ({
86
97
  },
87
98
  };
88
99
  compiler.hooks.beforeRun.tapPromise(PLUGIN_NAME, async () => {
100
+ const isProduction = process.env.NODE_ENV === "production";
101
+ // default to locale-modules for development to speed up the dev server
102
+ // https://github.com/opral/inlang-paraglide-js/issues/486
103
+ const outputStructure = args.outputStructure ??
104
+ (isProduction ? "message-modules" : "locale-modules");
89
105
  try {
90
106
  previousCompilation = await compile({
91
107
  fs: wrappedFs,
92
108
  previousCompilation,
109
+ outputStructure,
93
110
  // clean dir needs to be false. otherwise webpack get's into a race condition
94
111
  // of deleting the output directory and writing files at the same time for
95
112
  // multi environment builds
96
113
  cleanOutdir: false,
97
114
  ...args,
98
115
  });
99
- logger.success("Compilation complete");
116
+ logger.success(`Compilation complete (${outputStructure})`);
100
117
  }
101
118
  catch (error) {
102
119
  logger.warn("Failed to compile project:", error.message);
@@ -182,6 +182,10 @@ export type CompilerOptions = {
182
182
  * - `message-modules` - Each module is a message. This is the default.
183
183
  * - `locale-modules` - Each module is a locale.
184
184
  *
185
+ * It is recommended to use `locale-modules` for development and `message-modules` for production.
186
+ * Bundlers speed up the dev mode by bypassing bundling which can lead to many http requests
187
+ * during the dev mode with `message-modules`. See https://github.com/opral/inlang-paraglide-js/issues/486.
188
+ *
185
189
  * **`message-modules`**
186
190
  *
187
191
  * Messages have their own module which eases tree-shaking for bundlers.
@@ -1 +1 @@
1
- {"version":3,"file":"compiler-options.d.ts","sourceRoot":"","sources":["../../src/compiler/compiler-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;CAaU,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC7B;;;;;;;;;;OAUG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;OAUG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC/B;;;;;;;;;;;;;;OAcG;IACH,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC;;;;;;;;;;;;OAYG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC;;;;OAI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,OAAO,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACrC;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,eAAe,CAAC,EAAE,gBAAgB,GAAG,iBAAiB,CAAC;IACvD;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,EAAE,CAAC,EAAE,GAAG,CAAC;CACT,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export const ENV_VARIABLES = {
2
2
  PARJS_APP_ID: "library.inlang.paraglideJs",
3
3
  PARJS_POSTHOG_TOKEN: "phc_m5yJZCxjOGxF8CJvP5sQ3H0d76xpnLrsmiZHduT4jDz",
4
- PARJS_PACKAGE_VERSION: "2.0.6",
4
+ PARJS_PACKAGE_VERSION: "2.0.7",
5
5
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@inlang/paraglide-js",
3
3
  "type": "module",
4
- "version": "2.0.6",
4
+ "version": "2.0.7",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -32,7 +32,7 @@
32
32
  "unplugin": "^2.1.2",
33
33
  "urlpattern-polyfill": "^10.0.0",
34
34
  "@inlang/recommend-sherlock": "0.2.1",
35
- "@inlang/sdk": "2.4.5"
35
+ "@inlang/sdk": "2.4.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@eslint/js": "^9.18.0",
@@ -51,8 +51,8 @@
51
51
  "typescript-eslint": "^8.20.0",
52
52
  "vitest": "2.1.8",
53
53
  "@inlang/plugin-message-format": "4.0.0",
54
- "@inlang/paraglide-js": "2.0.6",
55
- "@opral/tsconfig": "1.1.0"
54
+ "@opral/tsconfig": "1.1.0",
55
+ "@inlang/paraglide-js": "2.0.7"
56
56
  },
57
57
  "keywords": [
58
58
  "inlang",