@wuchale/vite-plugin 0.16.2 → 0.16.3

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -12
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  // $$ cd ../.. && npm run test
2
2
  import { relative, resolve } from 'node:path';
3
- import { platform } from 'node:process';
4
- import { AdapterHandler, getConfig, Logger } from 'wuchale';
3
+ import { AdapterHandler, getConfig, Logger, normalizeSep } from 'wuchale';
5
4
  const pluginName = 'wuchale';
6
5
  const confUpdateName = 'confUpdate.json';
7
6
  class Wuchale {
@@ -45,15 +44,11 @@ class Wuchale {
45
44
  }
46
45
  else {
47
46
  for (const locale of this.#config.locales) {
48
- this.#singleCompiledCatalogs.add(resolve(handler.getCompiledFilePath(locale, null)));
47
+ this.#singleCompiledCatalogs.add(normalizeSep(resolve(handler.getCompiledFilePath(locale, null))));
49
48
  }
50
49
  }
51
50
  for (const path of Object.values(handler.loaderPath)) {
52
- let loaderPath = resolve(path);
53
- if (platform === 'win32') {
54
- // seems vite does this for the importer field in the resolveId hook
55
- loaderPath = loaderPath.replaceAll('\\', '/');
56
- }
51
+ const loaderPath = normalizeSep(resolve(path));
57
52
  if (adaptersByLoaderPath.has(loaderPath)) {
58
53
  const otherKey = adaptersByLoaderPath.get(loaderPath)?.key;
59
54
  if (otherKey === key) {
@@ -77,7 +72,7 @@ class Wuchale {
77
72
  this.#adaptersByCatalogPath.set(fname, [handler]);
78
73
  }
79
74
  }
80
- this.#adaptersByConfUpdate.set(resolve(adapter.localesDir, confUpdateName), handler);
75
+ this.#adaptersByConfUpdate.set(normalizeSep(resolve(adapter.localesDir, confUpdateName)), handler);
81
76
  }
82
77
  };
83
78
  configResolved = async (config) => {
@@ -111,8 +106,8 @@ class Wuchale {
111
106
  // for granular as well
112
107
  for (const adapter of this.#granularLoadAdapters) {
113
108
  for (const loc of this.#config.locales) {
114
- for (const id in adapter.granularStateByID) {
115
- if (resolve(adapter.getCompiledFilePath(loc, id)) === ctx.file) {
109
+ for (const id of adapter.granularStateByID.keys()) {
110
+ if (normalizeSep(resolve(adapter.getCompiledFilePath(loc, id))) === ctx.file) {
116
111
  return [];
117
112
  }
118
113
  }
@@ -130,7 +125,7 @@ class Wuchale {
130
125
  await adapter.loadCatalogNCompile(loc, this.#hmrVersion);
131
126
  }
132
127
  for (const loadID of adapter.getLoadIDs()) {
133
- const fileID = resolve(adapter.getCompiledFilePath(loc, loadID));
128
+ const fileID = normalizeSep(resolve(adapter.getCompiledFilePath(loc, loadID)));
134
129
  for (const module of ctx.server.moduleGraph.getModulesByFile(fileID) ?? []) {
135
130
  ctx.server.moduleGraph.invalidateModule(module, invalidatedModules, ctx.timestamp, false);
136
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wuchale/vite-plugin",
3
- "version": "0.16.2",
3
+ "version": "0.16.3",
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.19.0"
43
+ "wuchale": "^0.19.3"
44
44
  },
45
45
  "devDependencies": {
46
46
  "typescript": "^5.9.3"