wuchale 0.18.0 → 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.
- package/dist/adapter-vanilla/index.js +3 -0
- package/dist/adapter-vanilla/transformer.js +6 -5
- package/dist/handler.d.ts +1 -1
- package/dist/handler.js +3 -3
- package/package.json +2 -2
- package/src/adapter-vanilla/loaders/bundle.js +2 -4
- package/src/adapter-vanilla/loaders/server.js +1 -3
- package/src/adapter-vanilla/loaders/vite.js +0 -3
- package/src/adapter-vanilla/loaders/vite.ssr.js +0 -3
|
@@ -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
|
-
|
|
400
|
-
if (bodyStart
|
|
401
|
-
|
|
399
|
+
msgs.push(...this.visit(bod));
|
|
400
|
+
if (bodyStart != null) {
|
|
401
|
+
continue;
|
|
402
402
|
}
|
|
403
|
-
|
|
404
|
-
|
|
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/dist/handler.d.ts
CHANGED
|
@@ -84,7 +84,7 @@ export declare class AdapterHandler {
|
|
|
84
84
|
savePO: (loc: string) => Promise<void>;
|
|
85
85
|
savePoAndCompile: (loc: string) => Promise<void>;
|
|
86
86
|
handleMessages: (loc: string, msgs: Message[], filename: string) => Promise<string[]>;
|
|
87
|
-
transform: (content: string, filename: string, hmrVersion?: number, forServer?: boolean) => Promise<TransformOutputCode>;
|
|
87
|
+
transform: (content: string, filename: string, hmrVersion?: number, forServer?: boolean, direct?: boolean) => Promise<TransformOutputCode>;
|
|
88
88
|
directFileHandler(): (filename: string) => Promise<void>;
|
|
89
89
|
directScanFS(clean: boolean, sync: boolean): Promise<void>;
|
|
90
90
|
}
|
package/dist/handler.js
CHANGED
|
@@ -859,7 +859,7 @@ export class AdapterHandler {
|
|
|
859
859
|
await this.#geminiQueue[loc].running;
|
|
860
860
|
return hmrKeys;
|
|
861
861
|
};
|
|
862
|
-
transform = async (content, filename, hmrVersion = -1, forServer = false) => {
|
|
862
|
+
transform = async (content, filename, hmrVersion = -1, forServer = false, direct = false) => {
|
|
863
863
|
if (platform === 'win32') {
|
|
864
864
|
filename = filename.replaceAll('\\', '/');
|
|
865
865
|
}
|
|
@@ -880,7 +880,7 @@ export class AdapterHandler {
|
|
|
880
880
|
matchUrl: this.matchUrl,
|
|
881
881
|
});
|
|
882
882
|
let hmrData = null;
|
|
883
|
-
if (this.#mode !== 'build') {
|
|
883
|
+
if (this.#mode !== 'build' || direct) {
|
|
884
884
|
if (this.#log.checkLevel('verbose')) {
|
|
885
885
|
if (msgs.length) {
|
|
886
886
|
this.#log.verbose(`${this.key}: ${msgs.length} messages from ${filename}:`);
|
|
@@ -918,7 +918,7 @@ export class AdapterHandler {
|
|
|
918
918
|
return async (filename) => {
|
|
919
919
|
console.info(`${adapterName}: Extract from ${color.cyan(filename)}`);
|
|
920
920
|
const contents = await readFile(filename);
|
|
921
|
-
await this.transform(contents.toString(), filename);
|
|
921
|
+
await this.transform(contents.toString(), filename, undefined, undefined, true);
|
|
922
922
|
};
|
|
923
923
|
}
|
|
924
924
|
async directScanFS(clean, sync) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wuchale",
|
|
3
|
-
"version": "0.18.
|
|
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.
|
|
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 =
|
|
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
|