wuchale 0.18.1 → 0.18.2

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.
@@ -31,6 +31,9 @@ const defaultArgs = {
31
31
  };
32
32
  const resolveLoaderPath = loaderPathResolver(import.meta.url, '../../src/adapter-vanilla/loaders', 'js');
33
33
  export function getDefaultLoaderPath(loader, bundle) {
34
+ if (loader === 'custom') {
35
+ return null;
36
+ }
34
37
  if (bundle) {
35
38
  return resolveLoaderPath('bundle');
36
39
  }
@@ -396,12 +396,13 @@ export class Transformer {
396
396
  if (bodyStart == null) {
397
397
  currentContent = this.mstr.toString();
398
398
  }
399
- const msgsBod = this.visit(bod);
400
- if (bodyStart == null && this.mstr.toString() !== currentContent) {
401
- bodyStart = bod.start;
399
+ msgs.push(...this.visit(bod));
400
+ if (bodyStart != null) {
401
+ continue;
402
402
  }
403
- if (msgsBod.length) {
404
- msgs.push(...msgsBod);
403
+ // TODO: use deep return checks after using state passing to visitors
404
+ if (this.mstr.toString() !== currentContent || bod.type === 'IfStatement' && bod.consequent.type === 'BlockStatement' && bod.consequent.body.some(n => n.type === 'ReturnStatement')) {
405
+ bodyStart = bod.start;
405
406
  }
406
407
  }
407
408
  if (bodyStart) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wuchale",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Protobuf-like i18n from plain code",
5
5
  "scripts": {
6
6
  "dev": "tsc --watch",
@@ -87,7 +87,7 @@
87
87
  "tinyglobby": "^0.2.15"
88
88
  },
89
89
  "devDependencies": {
90
- "@types/node": "^24.9.1",
90
+ "@types/node": "^24.10.0",
91
91
  "@types/picomatch": "^4.0.1",
92
92
  "typescript": "^5.9.3"
93
93
  },
@@ -1,9 +1,7 @@
1
- // This is just the default loader.
2
- // You can customize it however you want, it will not be overwritten once it exists and is not empty.
3
-
4
1
  import toRuntime from "wuchale/runtime"
2
+ import { locales } from '${DATA}'
5
3
 
6
- let locale = 'en'
4
+ let locale = locales[0]
7
5
 
8
6
  /**
9
7
  * @param {string} newLocale
@@ -1,10 +1,8 @@
1
- // This is just the default loader.
2
- // You can customize it however you want, it will not be overwritten once it exists and is not empty.
3
-
4
1
  import { loadCatalog, loadIDs } from '${PROXY_SYNC}'
5
2
  import { locales } from '${DATA}'
6
3
  import { loadLocales } from 'wuchale/load-utils/server'
7
4
 
5
+ export { loadIDs, loadCatalog }
8
6
  export const key = '${KEY}'
9
7
 
10
8
  // two exports
@@ -1,6 +1,3 @@
1
- // This is just the default loader.
2
- // You can customize it however you want, it will not be overwritten once it exists and is not empty.
3
-
4
1
  import { loadCatalog, loadIDs } from '${PROXY}'
5
2
  import { registerLoaders } from 'wuchale/load-utils'
6
3
 
@@ -1,6 +1,3 @@
1
- // This is just the default loader.
2
- // You can customize it however you want, it will not be overwritten once it exists and is not empty.
3
-
4
1
  import { loadCatalog, loadIDs } from '${PROXY_SYNC}'
5
2
  import { currentRuntime } from 'wuchale/load-utils/server'
6
3