@webinex/vite 0.0.1-beta1 → 0.0.1-beta3

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.
@@ -1,4 +1,4 @@
1
- declare module '@webinex/vite/i18next-resources/client' {
1
+ declare module 'virtual:i18next-resources' {
2
2
  interface LocalizationResourceMap {
3
3
  [key: string]: () => Promise<Record<string, any>>;
4
4
  }
@@ -5,7 +5,7 @@ const yaml = require('yaml');
5
5
  const lodash = require('lodash');
6
6
  const promises = require('fs/promises');
7
7
 
8
- const MODULE_ID = "virtual:resources";
8
+ const MODULE_ID = "virtual:i18next-resources";
9
9
  const RESOLVED_MODULE_ID = "\0" + MODULE_ID;
10
10
  function i18nextPlugin(options) {
11
11
  const { resources } = options;
@@ -34,7 +34,7 @@ function i18nextPlugin(options) {
34
34
  return result;
35
35
  };
36
36
  const plugin = {
37
- name: "@custom/i18next-plugin",
37
+ name: "@webinex/vite/i18next-resources-plugin",
38
38
  enforce: "pre",
39
39
  resolveId: (id) => {
40
40
  if (id === MODULE_ID) {
@@ -56,7 +56,7 @@ function i18nextPlugin(options) {
56
56
  if (id === RESOLVED_MODULE_ID) {
57
57
  return {
58
58
  code: `export const RESOURCES = {
59
- ${Object.entries(resources).map(([locale]) => `'${locale}': () => import('virtual:resources/${locale}')`).join("\n,")}
59
+ ${Object.entries(resources).map(([locale]) => `'${locale}': () => import('${MODULE_ID}/${locale}')`).join("\n,")}
60
60
  }`,
61
61
  map: null
62
62
  };
@@ -3,7 +3,7 @@ import { parse } from 'yaml';
3
3
  import { merge } from 'lodash';
4
4
  import { readFile } from 'fs/promises';
5
5
 
6
- const MODULE_ID = "virtual:resources";
6
+ const MODULE_ID = "virtual:i18next-resources";
7
7
  const RESOLVED_MODULE_ID = "\0" + MODULE_ID;
8
8
  function i18nextPlugin(options) {
9
9
  const { resources } = options;
@@ -32,7 +32,7 @@ function i18nextPlugin(options) {
32
32
  return result;
33
33
  };
34
34
  const plugin = {
35
- name: "@custom/i18next-plugin",
35
+ name: "@webinex/vite/i18next-resources-plugin",
36
36
  enforce: "pre",
37
37
  resolveId: (id) => {
38
38
  if (id === MODULE_ID) {
@@ -54,7 +54,7 @@ function i18nextPlugin(options) {
54
54
  if (id === RESOLVED_MODULE_ID) {
55
55
  return {
56
56
  code: `export const RESOURCES = {
57
- ${Object.entries(resources).map(([locale]) => `'${locale}': () => import('virtual:resources/${locale}')`).join("\n,")}
57
+ ${Object.entries(resources).map(([locale]) => `'${locale}': () => import('${MODULE_ID}/${locale}')`).join("\n,")}
58
58
  }`,
59
59
  map: null
60
60
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webinex/vite",
3
3
  "private": false,
4
- "version": "0.0.1-beta1",
4
+ "version": "0.0.1-beta3",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./external-plugin": {
@@ -1,4 +1,4 @@
1
- declare module '@webinex/vite/i18next-resources/client' {
1
+ declare module 'virtual:i18next-resources' {
2
2
  interface LocalizationResourceMap {
3
3
  [key: string]: () => Promise<Record<string, any>>;
4
4
  }
@@ -8,7 +8,7 @@ export interface I18nextPluginOptions {
8
8
  resources: Record<string, string[]>;
9
9
  }
10
10
 
11
- const MODULE_ID = 'virtual:resources';
11
+ const MODULE_ID = 'virtual:i18next-resources';
12
12
  const RESOLVED_MODULE_ID = '\0' + MODULE_ID;
13
13
 
14
14
  export function i18nextPlugin(options: I18nextPluginOptions) {
@@ -46,7 +46,7 @@ export function i18nextPlugin(options: I18nextPluginOptions) {
46
46
  };
47
47
 
48
48
  const plugin: Plugin = {
49
- name: '@custom/i18next-plugin',
49
+ name: '@webinex/vite/i18next-resources-plugin',
50
50
  enforce: 'pre',
51
51
 
52
52
  resolveId: (id) => {
@@ -75,7 +75,7 @@ export function i18nextPlugin(options: I18nextPluginOptions) {
75
75
  return {
76
76
  code: `export const RESOURCES = {
77
77
  ${Object.entries(resources)
78
- .map(([locale]) => `'${locale}': () => import('virtual:resources/${locale}')`)
78
+ .map(([locale]) => `'${locale}': () => import('${MODULE_ID}/${locale}')`)
79
79
  .join('\n,')}
80
80
  }`,
81
81
  map: null,