react-intlayer 2.0.6 → 2.0.7

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.
@@ -22,12 +22,10 @@ __export(ContentEditionLayout_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(ContentEditionLayout_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_module = require("module");
26
- const import_meta = {};
27
25
  const BlankLayout = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
28
26
  const requireFunction = (packagePath) => {
29
27
  try {
30
- return typeof import_meta.url === "undefined" ? require(packagePath) : (0, import_module.createRequire)(import_meta.url)(packagePath);
28
+ return typeof require === "undefined" ? import(packagePath) : require(packagePath);
31
29
  } catch (error) {
32
30
  return void 0;
33
31
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/ContentEditionLayout.tsx"],"sourcesContent":["import { createRequire } from 'module';\nimport type { ContentEditionLayoutProps } from 'intlayer-editor/client';\nimport type { FC } from 'react';\n\nconst BlankLayout: FC<ContentEditionLayoutProps> = ({ children }) => (\n <>{children}</>\n);\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof import.meta.url === 'undefined'\n ? require(packagePath)\n : createRequire(import.meta.url)(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n// intlayer-editor is an optional dependency. If it's not installed, return the blank layout\nexport const ContentEditionLayout: FC<ContentEditionLayoutProps> =\n typeof requireFunction('intlayer-editor/client')?.ContentEditionLayoutBase ===\n 'undefined'\n ? BlankLayout\n : requireFunction('intlayer-editor/client').ContentEditionLayoutBase;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKE;AALF,oBAA8B;AAA9B;AAIA,MAAM,cAA6C,CAAC,EAAE,SAAS,MAC7D,2EAAG,UAAS;AAGd,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,QAAQ,cAC9B,QAAQ,WAAW,QACnB,6BAAc,YAAY,GAAG,EAAE,WAAW;AAAA,EAChD,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEO,MAAM,uBACX,OAAO,gBAAgB,wBAAwB,GAAG,6BAClD,cACI,cACA,gBAAgB,wBAAwB,EAAE;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/ContentEditionLayout.tsx"],"sourcesContent":["import type { ContentEditionLayoutProps } from 'intlayer-editor/client';\nimport type { FC } from 'react';\n\nconst BlankLayout: FC<ContentEditionLayoutProps> = ({ children }) => (\n <>{children}</>\n);\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof require === 'undefined'\n ? import(packagePath)\n : require(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n// intlayer-editor is an optional dependency. If it's not installed, return the blank layout\nexport const ContentEditionLayout: FC<ContentEditionLayoutProps> =\n typeof requireFunction('intlayer-editor/client')?.ContentEditionLayoutBase ===\n 'undefined'\n ? BlankLayout\n : requireFunction('intlayer-editor/client').ContentEditionLayoutBase;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIE;AADF,MAAM,cAA6C,CAAC,EAAE,SAAS,MAC7D,2EAAG,UAAS;AAGd,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,cACtB,OAAO,eACP,QAAQ,WAAW;AAAA,EACzB,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEO,MAAM,uBACX,OAAO,gBAAgB,wBAAwB,GAAG,6BAClD,cACI,cACA,gBAAgB,wBAAwB,EAAE;","names":[]}
@@ -22,11 +22,9 @@ __export(renderIntlayerEditor_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(renderIntlayerEditor_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_module = require("module");
26
- const import_meta = {};
27
25
  const requireFunction = (packagePath) => {
28
26
  try {
29
- return typeof import_meta.url === "undefined" ? require(packagePath) : (0, import_module.createRequire)(import_meta.url)(packagePath);
27
+ return typeof require === "undefined" ? import(packagePath) : require(packagePath);
30
28
  } catch (error) {
31
29
  return void 0;
32
30
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/renderIntlayerEditor.tsx"],"sourcesContent":["import { createRequire } from 'module';\nimport type { IntlayerEditorElementProps } from 'intlayer-editor/client';\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof import.meta.url === 'undefined'\n ? require(packagePath)\n : createRequire(import.meta.url)(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n\nconst IntlayerEditorElement = ({\n content,\n ..._props\n}: IntlayerEditorElementProps) => {\n return content;\n};\n\nIntlayerEditorElement.content = '';\n\nexport const renderIntlayerEditor = (props: IntlayerEditorElementProps) => {\n const _renderIntlayerEditor = requireFunction(\n 'intlayer-editor/client'\n )?.renderIntlayerEditor;\n\n if (typeof _renderIntlayerEditor === 'undefined') {\n const Result = <IntlayerEditorElement {...props} />;\n\n return { ...Result, value: props.content };\n }\n\n return _renderIntlayerEditor(props);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BmB;AA5BnB,oBAA8B;AAA9B;AAGA,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,QAAQ,cAC9B,QAAQ,WAAW,QACnB,6BAAc,YAAY,GAAG,EAAE,WAAW;AAAA,EAChD,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEA,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MAAkC;AAChC,SAAO;AACT;AAEA,sBAAsB,UAAU;AAEzB,MAAM,uBAAuB,CAAC,UAAsC;AACzE,QAAM,wBAAwB;AAAA,IAC5B;AAAA,EACF,GAAG;AAEH,MAAI,OAAO,0BAA0B,aAAa;AAChD,UAAM,SAAS,4CAAC,yBAAuB,GAAG,OAAO;AAEjD,WAAO,EAAE,GAAG,QAAQ,OAAO,MAAM,QAAQ;AAAA,EAC3C;AAEA,SAAO,sBAAsB,KAAK;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../src/renderIntlayerEditor.tsx"],"sourcesContent":["import type { IntlayerEditorElementProps } from 'intlayer-editor/client';\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof require === 'undefined'\n ? import(packagePath)\n : require(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n\nconst IntlayerEditorElement = ({\n content,\n ..._props\n}: IntlayerEditorElementProps) => {\n return content;\n};\n\nIntlayerEditorElement.content = '';\n\nexport const renderIntlayerEditor = (props: IntlayerEditorElementProps) => {\n const _renderIntlayerEditor = requireFunction(\n 'intlayer-editor/client'\n )?.renderIntlayerEditor;\n\n if (typeof _renderIntlayerEditor === 'undefined') {\n const Result = <IntlayerEditorElement {...props} />;\n\n return { ...Result, value: props.content };\n }\n\n return _renderIntlayerEditor(props);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BmB;AAzBnB,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,cACtB,OAAO,eACP,QAAQ,WAAW;AAAA,EACzB,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEA,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MAAkC;AAChC,SAAO;AACT;AAEA,sBAAsB,UAAU;AAEzB,MAAM,uBAAuB,CAAC,UAAsC;AACzE,QAAM,wBAAwB;AAAA,IAC5B;AAAA,EACF,GAAG;AAEH,MAAI,OAAO,0BAA0B,aAAa;AAChD,UAAM,SAAS,4CAAC,yBAAuB,GAAG,OAAO;AAEjD,WAAO,EAAE,GAAG,QAAQ,OAAO,MAAM,QAAQ;AAAA,EAC3C;AAEA,SAAO,sBAAsB,KAAK;AACpC;","names":[]}
@@ -42,6 +42,14 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
42
42
  "@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath)
43
43
  }
44
44
  };
45
+ const externals = config.build?.rollupOptions?.external ?? [];
46
+ config.build = {
47
+ ...config.build,
48
+ rollupOptions: {
49
+ ...config.build?.rollupOptions,
50
+ external: [...externals, "module"]
51
+ }
52
+ };
45
53
  return config;
46
54
  },
47
55
  buildStart: () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates IntLayer configuration into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intLayerPlugin() ],\n * });\n * ```\n * */\nexport const intLayerPlugin = (_pluginOptions: PluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n };\n\n return config;\n },\n\n buildStart: () => {\n // Code to run when Vite build starts\n watch({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n persistent: (import.meta as any).env === 'development',\n });\n },\n configureServer: () => {\n // Custom server configuration, if needed\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AACxC,sBAAsB;AACtB,oBAAoD;AACpD,kBAAqC;AAHrC;AAqBO,MAAM,iBAAiB,CAAC,iBAAgC,CAAC,OAAe;AAAA,EAC7E,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,qBAAiB,gCAAiB;AAGxC,UAAM,UAAM,iCAAkB,MAAM;AAEpC,YAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,OAAG,qBAAQ,MAAM,QAAQ,IAAI,CAAC,GAAG,GAAG,IAAI;AAExE,UAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,UAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,UAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAGnE,WAAO,UAAU;AAAA,MACf,GAAG,OAAO;AAAA,MACV,OAAO;AAAA,QACL,GAAG,OAAO,SAAS;AAAA,QACnB,oCAAgC,qBAAQ,wBAAwB;AAAA,MAClE;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAAM;AAEhB,+BAAM;AAAA;AAAA,MAEJ,YAAa,YAAoB,QAAQ;AAAA,IAC3C,CAAC;AAAA,EACH;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates IntLayer configuration into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intLayerPlugin() ],\n * });\n * ```\n * */\nexport const intLayerPlugin = (_pluginOptions: PluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n };\n\n const externals: string[] = (config.build?.rollupOptions?.external ??\n []) as string[];\n\n config.build = {\n ...config.build,\n rollupOptions: {\n ...config.build?.rollupOptions,\n external: [...externals, 'module'],\n },\n };\n\n return config;\n },\n\n buildStart: () => {\n // Code to run when Vite build starts\n watch({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n persistent: (import.meta as any).env === 'development',\n });\n },\n configureServer: () => {\n // Custom server configuration, if needed\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwC;AACxC,sBAAsB;AACtB,oBAAoD;AACpD,kBAAqC;AAHrC;AAqBO,MAAM,iBAAiB,CAAC,iBAAgC,CAAC,OAAe;AAAA,EAC7E,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,qBAAiB,gCAAiB;AAGxC,UAAM,UAAM,iCAAkB,MAAM;AAEpC,YAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,OAAG,qBAAQ,MAAM,QAAQ,IAAI,CAAC,GAAG,GAAG,IAAI;AAExE,UAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,UAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,UAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAGnE,WAAO,UAAU;AAAA,MACf,GAAG,OAAO;AAAA,MACV,OAAO;AAAA,QACL,GAAG,OAAO,SAAS;AAAA,QACnB,oCAAgC,qBAAQ,wBAAwB;AAAA,MAClE;AAAA,IACF;AAEA,UAAM,YAAuB,OAAO,OAAO,eAAe,YACxD,CAAC;AAEH,WAAO,QAAQ;AAAA,MACb,GAAG,OAAO;AAAA,MACV,eAAe;AAAA,QACb,GAAG,OAAO,OAAO;AAAA,QACjB,UAAU,CAAC,GAAG,WAAW,QAAQ;AAAA,MACnC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAAM;AAEhB,+BAAM;AAAA;AAAA,MAEJ,YAAa,YAAoB,QAAQ;AAAA,IAC3C,CAAC;AAAA,EACH;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":[]}
@@ -1,10 +1,9 @@
1
1
  import "../chunk-ZD7AOCMD.mjs";
2
2
  import { Fragment, jsx } from "react/jsx-runtime";
3
- import { createRequire } from "module";
4
3
  const BlankLayout = ({ children }) => /* @__PURE__ */ jsx(Fragment, { children });
5
4
  const requireFunction = (packagePath) => {
6
5
  try {
7
- return typeof import.meta.url === "undefined" ? require(packagePath) : createRequire(import.meta.url)(packagePath);
6
+ return typeof require === "undefined" ? import(packagePath) : require(packagePath);
8
7
  } catch (error) {
9
8
  return void 0;
10
9
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/ContentEditionLayout.tsx"],"sourcesContent":["import { createRequire } from 'module';\nimport type { ContentEditionLayoutProps } from 'intlayer-editor/client';\nimport type { FC } from 'react';\n\nconst BlankLayout: FC<ContentEditionLayoutProps> = ({ children }) => (\n <>{children}</>\n);\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof import.meta.url === 'undefined'\n ? require(packagePath)\n : createRequire(import.meta.url)(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n// intlayer-editor is an optional dependency. If it's not installed, return the blank layout\nexport const ContentEditionLayout: FC<ContentEditionLayoutProps> =\n typeof requireFunction('intlayer-editor/client')?.ContentEditionLayoutBase ===\n 'undefined'\n ? BlankLayout\n : requireFunction('intlayer-editor/client').ContentEditionLayoutBase;\n"],"mappings":";AAKE;AALF,SAAS,qBAAqB;AAI9B,MAAM,cAA6C,CAAC,EAAE,SAAS,MAC7D,gCAAG,UAAS;AAGd,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,QAAQ,cAC9B,QAAQ,WAAW,IACnB,cAAc,YAAY,GAAG,EAAE,WAAW;AAAA,EAChD,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEO,MAAM,uBACX,OAAO,gBAAgB,wBAAwB,GAAG,6BAClD,cACI,cACA,gBAAgB,wBAAwB,EAAE;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/ContentEditionLayout.tsx"],"sourcesContent":["import type { ContentEditionLayoutProps } from 'intlayer-editor/client';\nimport type { FC } from 'react';\n\nconst BlankLayout: FC<ContentEditionLayoutProps> = ({ children }) => (\n <>{children}</>\n);\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof require === 'undefined'\n ? import(packagePath)\n : require(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n// intlayer-editor is an optional dependency. If it's not installed, return the blank layout\nexport const ContentEditionLayout: FC<ContentEditionLayoutProps> =\n typeof requireFunction('intlayer-editor/client')?.ContentEditionLayoutBase ===\n 'undefined'\n ? BlankLayout\n : requireFunction('intlayer-editor/client').ContentEditionLayoutBase;\n"],"mappings":";AAIE;AADF,MAAM,cAA6C,CAAC,EAAE,SAAS,MAC7D,gCAAG,UAAS;AAGd,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,cACtB,OAAO,eACP,QAAQ,WAAW;AAAA,EACzB,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEO,MAAM,uBACX,OAAO,gBAAgB,wBAAwB,GAAG,6BAClD,cACI,cACA,gBAAgB,wBAAwB,EAAE;","names":[]}
@@ -1,9 +1,8 @@
1
1
  import "./chunk-ZD7AOCMD.mjs";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { createRequire } from "module";
4
3
  const requireFunction = (packagePath) => {
5
4
  try {
6
- return typeof import.meta.url === "undefined" ? require(packagePath) : createRequire(import.meta.url)(packagePath);
5
+ return typeof require === "undefined" ? import(packagePath) : require(packagePath);
7
6
  } catch (error) {
8
7
  return void 0;
9
8
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/renderIntlayerEditor.tsx"],"sourcesContent":["import { createRequire } from 'module';\nimport type { IntlayerEditorElementProps } from 'intlayer-editor/client';\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof import.meta.url === 'undefined'\n ? require(packagePath)\n : createRequire(import.meta.url)(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n\nconst IntlayerEditorElement = ({\n content,\n ..._props\n}: IntlayerEditorElementProps) => {\n return content;\n};\n\nIntlayerEditorElement.content = '';\n\nexport const renderIntlayerEditor = (props: IntlayerEditorElementProps) => {\n const _renderIntlayerEditor = requireFunction(\n 'intlayer-editor/client'\n )?.renderIntlayerEditor;\n\n if (typeof _renderIntlayerEditor === 'undefined') {\n const Result = <IntlayerEditorElement {...props} />;\n\n return { ...Result, value: props.content };\n }\n\n return _renderIntlayerEditor(props);\n};\n"],"mappings":";AA4BmB;AA5BnB,SAAS,qBAAqB;AAG9B,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,QAAQ,cAC9B,QAAQ,WAAW,IACnB,cAAc,YAAY,GAAG,EAAE,WAAW;AAAA,EAChD,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEA,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MAAkC;AAChC,SAAO;AACT;AAEA,sBAAsB,UAAU;AAEzB,MAAM,uBAAuB,CAAC,UAAsC;AACzE,QAAM,wBAAwB;AAAA,IAC5B;AAAA,EACF,GAAG;AAEH,MAAI,OAAO,0BAA0B,aAAa;AAChD,UAAM,SAAS,oBAAC,yBAAuB,GAAG,OAAO;AAEjD,WAAO,EAAE,GAAG,QAAQ,OAAO,MAAM,QAAQ;AAAA,EAC3C;AAEA,SAAO,sBAAsB,KAAK;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../src/renderIntlayerEditor.tsx"],"sourcesContent":["import type { IntlayerEditorElementProps } from 'intlayer-editor/client';\n\nconst requireFunction = (packagePath: string) => {\n try {\n return typeof require === 'undefined'\n ? import(packagePath)\n : require(packagePath);\n } catch (error) {\n return undefined;\n }\n};\n\nconst IntlayerEditorElement = ({\n content,\n ..._props\n}: IntlayerEditorElementProps) => {\n return content;\n};\n\nIntlayerEditorElement.content = '';\n\nexport const renderIntlayerEditor = (props: IntlayerEditorElementProps) => {\n const _renderIntlayerEditor = requireFunction(\n 'intlayer-editor/client'\n )?.renderIntlayerEditor;\n\n if (typeof _renderIntlayerEditor === 'undefined') {\n const Result = <IntlayerEditorElement {...props} />;\n\n return { ...Result, value: props.content };\n }\n\n return _renderIntlayerEditor(props);\n};\n"],"mappings":";AA2BmB;AAzBnB,MAAM,kBAAkB,CAAC,gBAAwB;AAC/C,MAAI;AACF,WAAO,OAAO,YAAY,cACtB,OAAO,eACP,QAAQ,WAAW;AAAA,EACzB,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAEA,MAAM,wBAAwB,CAAC;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,MAAkC;AAChC,SAAO;AACT;AAEA,sBAAsB,UAAU;AAEzB,MAAM,uBAAuB,CAAC,UAAsC;AACzE,QAAM,wBAAwB;AAAA,IAC5B;AAAA,EACF,GAAG;AAEH,MAAI,OAAO,0BAA0B,aAAa;AAChD,UAAM,SAAS,oBAAC,yBAAuB,GAAG,OAAO;AAEjD,WAAO,EAAE,GAAG,QAAQ,OAAO,MAAM,QAAQ;AAAA,EAC3C;AAEA,SAAO,sBAAsB,KAAK;AACpC;","names":[]}
@@ -19,6 +19,14 @@ const intLayerPlugin = (_pluginOptions = {}) => ({
19
19
  "@intlayer/dictionaries-entry": resolve(relativeDictionariesPath)
20
20
  }
21
21
  };
22
+ const externals = config.build?.rollupOptions?.external ?? [];
23
+ config.build = {
24
+ ...config.build,
25
+ rollupOptions: {
26
+ ...config.build?.rollupOptions,
27
+ external: [...externals, "module"]
28
+ }
29
+ };
22
30
  return config;
23
31
  },
24
32
  buildStart: () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates IntLayer configuration into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intLayerPlugin() ],\n * });\n * ```\n * */\nexport const intLayerPlugin = (_pluginOptions: PluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n };\n\n return config;\n },\n\n buildStart: () => {\n // Code to run when Vite build starts\n watch({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n persistent: (import.meta as any).env === 'development',\n });\n },\n configureServer: () => {\n // Custom server configuration, if needed\n },\n});\n"],"mappings":";AAAA,SAAS,MAAM,UAAU,eAAe;AACxC,SAAS,aAAa;AACtB,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,eAA4B;AAkB9B,MAAM,iBAAiB,CAAC,iBAAgC,CAAC,OAAe;AAAA,EAC7E,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,iBAAiB,iBAAiB;AAGxC,UAAM,MAAM,kBAAkB,MAAM;AAEpC,YAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,QAAQ,MAAM,QAAQ,IAAI,CAAC,GAAG,GAAG,IAAI;AAExE,UAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,UAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,UAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAGnE,WAAO,UAAU;AAAA,MACf,GAAG,OAAO;AAAA,MACV,OAAO;AAAA,QACL,GAAG,OAAO,SAAS;AAAA,QACnB,gCAAgC,QAAQ,wBAAwB;AAAA,MAClE;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAAM;AAEhB,UAAM;AAAA;AAAA,MAEJ,YAAa,YAAoB,QAAQ;AAAA,IAC3C,CAAC;AAAA,EACH;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/vite/intlayerPlugin.ts"],"sourcesContent":["import { join, relative, resolve } from 'path';\nimport { watch } from '@intlayer/chokidar';\nimport { getConfiguration, formatEnvVariable } from '@intlayer/config';\nimport { loadEnv, type Plugin } from 'vite';\n\n// Plugin options type definition\ntype PluginOptions = {\n // Custom options for your plugin, if any\n};\n\n/**\n *\n * A Vite plugin that integrates IntLayer configuration into the build process\n *\n * ```ts\n * // Example usage of the plugin in a Vite configuration\n * export default defineConfig({\n * plugins: [ intLayerPlugin() ],\n * });\n * ```\n * */\nexport const intLayerPlugin = (_pluginOptions: PluginOptions = {}): Plugin => ({\n name: 'vite-intlayer-plugin',\n\n config: (config, { mode }) => {\n const intlayerConfig = getConfiguration();\n\n // Set all configuration values as environment variables\n const env = formatEnvVariable('vite');\n\n process.env = { ...process.env, ...loadEnv(mode, process.cwd()), ...env };\n\n const { mainDir, baseDir } = intlayerConfig.content;\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n // Update Vite's resolve alias\n config.resolve = {\n ...config.resolve,\n alias: {\n ...config.resolve?.alias,\n '@intlayer/dictionaries-entry': resolve(relativeDictionariesPath),\n },\n };\n\n const externals: string[] = (config.build?.rollupOptions?.external ??\n []) as string[];\n\n config.build = {\n ...config.build,\n rollupOptions: {\n ...config.build?.rollupOptions,\n external: [...externals, 'module'],\n },\n };\n\n return config;\n },\n\n buildStart: () => {\n // Code to run when Vite build starts\n watch({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n persistent: (import.meta as any).env === 'development',\n });\n },\n configureServer: () => {\n // Custom server configuration, if needed\n },\n});\n"],"mappings":";AAAA,SAAS,MAAM,UAAU,eAAe;AACxC,SAAS,aAAa;AACtB,SAAS,kBAAkB,yBAAyB;AACpD,SAAS,eAA4B;AAkB9B,MAAM,iBAAiB,CAAC,iBAAgC,CAAC,OAAe;AAAA,EAC7E,MAAM;AAAA,EAEN,QAAQ,CAAC,QAAQ,EAAE,KAAK,MAAM;AAC5B,UAAM,iBAAiB,iBAAiB;AAGxC,UAAM,MAAM,kBAAkB,MAAM;AAEpC,YAAQ,MAAM,EAAE,GAAG,QAAQ,KAAK,GAAG,QAAQ,MAAM,QAAQ,IAAI,CAAC,GAAG,GAAG,IAAI;AAExE,UAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAC5C,UAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,UAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAGnE,WAAO,UAAU;AAAA,MACf,GAAG,OAAO;AAAA,MACV,OAAO;AAAA,QACL,GAAG,OAAO,SAAS;AAAA,QACnB,gCAAgC,QAAQ,wBAAwB;AAAA,MAClE;AAAA,IACF;AAEA,UAAM,YAAuB,OAAO,OAAO,eAAe,YACxD,CAAC;AAEH,WAAO,QAAQ;AAAA,MACb,GAAG,OAAO;AAAA,MACV,eAAe;AAAA,QACb,GAAG,OAAO,OAAO;AAAA,QACjB,UAAU,CAAC,GAAG,WAAW,QAAQ;AAAA,MACnC;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,YAAY,MAAM;AAEhB,UAAM;AAAA;AAAA,MAEJ,YAAa,YAAoB,QAAQ;AAAA,IAC3C,CAAC;AAAA,EACH;AAAA,EACA,iBAAiB,MAAM;AAAA,EAEvB;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intlayer",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "private": false,
5
5
  "description": "Internationalization layer for React applications - Layer of abstraction between the business logic and the data access layer. Manage internationalization in a simple way, through TypeScript, JavaScript or JSON declaration file.",
6
6
  "keywords": [
@@ -54,7 +54,6 @@
54
54
  },
55
55
  "./package.json": "./package.json"
56
56
  },
57
- "main": "./src/index.ts",
58
57
  "typesVersions": {
59
58
  "*": {
60
59
  "package.json": [
@@ -76,12 +75,12 @@
76
75
  "react-cookie": "^7.1.4",
77
76
  "vite": "^5.3.1",
78
77
  "webpack": "^5.92.1",
79
- "@intlayer/chokidar": "^2.0.6",
80
- "@intlayer/config": "^2.0.6",
81
- "@intlayer/dictionaries-entry": "^2.0.6",
82
- "@intlayer/webpack": "^2.0.6",
83
- "@intlayer/core": "^2.0.6",
84
- "intlayer": "^2.0.6"
78
+ "@intlayer/chokidar": "^2.0.7",
79
+ "@intlayer/config": "^2.0.7",
80
+ "@intlayer/core": "^2.0.7",
81
+ "@intlayer/dictionaries-entry": "^2.0.7",
82
+ "@intlayer/webpack": "^2.0.7",
83
+ "intlayer": "^2.0.7"
85
84
  },
86
85
  "devDependencies": {
87
86
  "@craco/types": "^7.1.0",
@@ -100,7 +99,7 @@
100
99
  "peerDependencies": {
101
100
  "react": "^18.2.0",
102
101
  "react-dom": "^18.2.0",
103
- "intlayer-editor": "^2.1.5"
102
+ "intlayer-editor": "^2.1.6"
104
103
  },
105
104
  "peerDependenciesMeta": {
106
105
  "intlayer-editor": {
package/src/index.ts DELETED
@@ -1,15 +0,0 @@
1
- export { getTranslation } from './getTranslation';
2
- export {
3
- IntlayerProvider,
4
- type IntlayerProviderProps,
5
- IntlayerClientContext,
6
- useIntlayer,
7
- useLocale,
8
- useTraduction,
9
- useLocaleCookie,
10
- localeCookie,
11
- setLocaleCookie,
12
- getBrowserLocale,
13
- useLocaleBase,
14
- } from './client/index';
15
- export type { IntlayerNode } from './useIntlayerBase';