@wuchale/vite-plugin 0.14.4 → 0.14.6
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/index.js +5 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ class Wuchale {
|
|
|
16
16
|
#log;
|
|
17
17
|
#configPath;
|
|
18
18
|
#hmrVersion = -1;
|
|
19
|
-
#
|
|
19
|
+
#lastSourceTriggeredPOWrite = 0;
|
|
20
20
|
constructor(configPath) {
|
|
21
21
|
this.#configPath = configPath;
|
|
22
22
|
}
|
|
@@ -31,6 +31,9 @@ class Wuchale {
|
|
|
31
31
|
for (const [key, adapter] of Object.entries(this.#config.adapters)) {
|
|
32
32
|
const handler = new AdapterHandler(adapter, key, this.#config, mode, virtualPrefix, this.#projectRoot, this.#log);
|
|
33
33
|
await handler.init(sharedState);
|
|
34
|
+
handler.onBeforeWritePO = () => {
|
|
35
|
+
this.#lastSourceTriggeredPOWrite = performance.now();
|
|
36
|
+
};
|
|
34
37
|
this.#adapters[key] = handler;
|
|
35
38
|
for (const path of Object.values(handler.loaderPath)) {
|
|
36
39
|
let loaderPath = resolve(path);
|
|
@@ -72,10 +75,9 @@ class Wuchale {
|
|
|
72
75
|
handleHotUpdate = async (ctx) => {
|
|
73
76
|
if (!(ctx.file in this.#adaptersByCatalogPath)) {
|
|
74
77
|
this.#hmrVersion++;
|
|
75
|
-
this.#hmrLastTime = performance.now();
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
const sourceTriggered = performance.now() - this.#
|
|
80
|
+
const sourceTriggered = performance.now() - this.#lastSourceTriggeredPOWrite < 1000; // long enough threshold
|
|
79
81
|
const invalidatedModules = new Set();
|
|
80
82
|
for (const adapter of this.#adaptersByCatalogPath[ctx.file]) {
|
|
81
83
|
const loc = adapter.catalogPathsToLocales[ctx.file];
|
|
@@ -126,7 +128,6 @@ class Wuchale {
|
|
|
126
128
|
// loader proxy
|
|
127
129
|
const adapter = this.#adaptersByLoaderPath[importer];
|
|
128
130
|
if (adapter == null) {
|
|
129
|
-
console.log(Object.keys(this.#adaptersByLoaderPath), 'ee');
|
|
130
131
|
this.#log.error(`Adapter not found for filename: ${importer}`);
|
|
131
132
|
return;
|
|
132
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wuchale/vite-plugin",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6",
|
|
4
4
|
"description": "Protobuf-like i18n from plain code: Vite plugin",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "tsc --watch",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"author": "K1DV5",
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"wuchale": "^0.
|
|
43
|
+
"wuchale": "^0.16.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.8.3"
|