@wuchale/vite-plugin 0.14.2 → 0.14.4

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.d.ts CHANGED
@@ -1,15 +1,34 @@
1
- import type { HmrContext, ResolvedConfig, TransformOptions, Plugin } from 'vite';
2
- declare class Wuchale implements Plugin {
1
+ type HotUpdateCtx = {
2
+ file: string;
3
+ server: {
4
+ ws: {
5
+ send: Function;
6
+ };
7
+ moduleGraph: {
8
+ getModulesByFile: Function;
9
+ invalidateModule: Function;
10
+ };
11
+ };
12
+ timestamp: number;
13
+ };
14
+ declare class Wuchale {
3
15
  #private;
4
16
  name: string;
5
17
  constructor(configPath: string);
6
- configResolved: (config: ResolvedConfig) => Promise<void>;
7
- handleHotUpdate: (ctx: HmrContext) => Promise<any[]>;
18
+ configResolved: (config: {
19
+ env: {
20
+ DEV?: boolean;
21
+ };
22
+ root: string;
23
+ }) => Promise<void>;
24
+ handleHotUpdate: (ctx: HotUpdateCtx) => Promise<any[]>;
8
25
  resolveId: (source: string, importer?: string) => string;
9
26
  load: (id: string) => string;
10
27
  transform: {
11
28
  order: "pre";
12
- handler: (code: string, id: string, options: TransformOptions) => Promise<{
29
+ handler: (code: string, id: string, options?: {
30
+ ssr?: boolean;
31
+ }) => Promise<{
13
32
  code?: string;
14
33
  map?: any;
15
34
  }>;
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // $$ cd ../.. && npm run test
2
2
  import { relative, resolve } from "node:path";
3
+ import { platform } from "node:process";
3
4
  import { getConfig as getConfig, Logger, AdapterHandler } from "wuchale";
4
5
  const pluginName = 'wuchale';
5
6
  const virtualPrefix = `virtual:${pluginName}/`;
@@ -32,7 +33,11 @@ class Wuchale {
32
33
  await handler.init(sharedState);
33
34
  this.#adapters[key] = handler;
34
35
  for (const path of Object.values(handler.loaderPath)) {
35
- const loaderPath = resolve(path);
36
+ let loaderPath = resolve(path);
37
+ if (platform === 'win32') {
38
+ // seems vite does this for the importer field in the resolveId hook
39
+ loaderPath = loaderPath.replaceAll('\\', '/');
40
+ }
36
41
  if (loaderPath in this.#adaptersByLoaderPath) {
37
42
  const otherKey = this.#adaptersByLoaderPath[loaderPath].key;
38
43
  if (otherKey === key) {
@@ -121,6 +126,7 @@ class Wuchale {
121
126
  // loader proxy
122
127
  const adapter = this.#adaptersByLoaderPath[importer];
123
128
  if (adapter == null) {
129
+ console.log(Object.keys(this.#adaptersByLoaderPath), 'ee');
124
130
  this.#log.error(`Adapter not found for filename: ${importer}`);
125
131
  return;
126
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wuchale/vite-plugin",
3
- "version": "0.14.2",
3
+ "version": "0.14.4",
4
4
  "description": "Protobuf-like i18n from plain code: Vite plugin",
5
5
  "scripts": {
6
6
  "dev": "tsc --watch",
@@ -43,8 +43,7 @@
43
43
  "wuchale": "^0.15.4"
44
44
  },
45
45
  "devDependencies": {
46
- "typescript": "^5.8.3",
47
- "vite": "^7.1.3"
46
+ "typescript": "^5.8.3"
48
47
  },
49
48
  "type": "module"
50
49
  }