react-scripts-intlayer 5.2.5 → 5.2.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.
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
8
10
  var __copyProps = (to, from, except, desc) => {
9
11
  if (from && typeof from === "object" || typeof from === "function") {
10
12
  for (let key of __getOwnPropNames(from))
@@ -13,20 +15,19 @@ var __copyProps = (to, from, except, desc) => {
13
15
  }
14
16
  return to;
15
17
  };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- var intlayerPlugin = __toESM(require('./intlayerCracoPlugin.cjs'));
25
- module.exports = {
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var craco_config_exports = {};
20
+ __export(craco_config_exports, {
21
+ default: () => craco_config_default
22
+ });
23
+ module.exports = __toCommonJS(craco_config_exports);
24
+ var import_intlayerCracoPlugin = require('./intlayerCracoPlugin.cjs');
25
+ const cracoConfig = {
26
26
  plugins: [
27
27
  {
28
- plugin: intlayerPlugin
28
+ plugin: import_intlayerCracoPlugin.intlayerCracoPlugin
29
29
  }
30
30
  ]
31
31
  };
32
+ var craco_config_default = cracoConfig;
32
33
  //# sourceMappingURL=craco.config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/craco.config.ts"],"sourcesContent":["import type { CracoConfig, CracoPlugin } from '@craco/types';\nimport * as intlayerPlugin from './intlayerCracoPlugin';\n\n// Usage Example\nmodule.exports = {\n plugins: [\n {\n plugin: intlayerPlugin as CracoPlugin,\n },\n ],\n} satisfies CracoConfig;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,qBAAgC;AAGhC,OAAO,UAAU;AAAA,EACf,SAAS;AAAA,IACP;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/craco.config.ts"],"sourcesContent":["import type { CracoConfig } from '@craco/types';\nimport { intlayerCracoPlugin } from './intlayerCracoPlugin';\n\n// Usage Example\nconst cracoConfig = {\n plugins: [\n {\n plugin: intlayerCracoPlugin,\n },\n ],\n} satisfies CracoConfig;\n\nexport default cracoConfig;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAoC;AAGpC,MAAM,cAAc;AAAA,EAClB,SAAS;AAAA,IACP;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,IAAO,uBAAQ;","names":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var index_exports = {};
17
+ module.exports = __toCommonJS(index_exports);
18
+ __reExport(index_exports, require('./intlayerCracoPlugin.cjs'), module.exports);
19
+ __reExport(index_exports, require('./craco.config.cjs'), module.exports);
20
+ // Annotate the CommonJS export names for ESM import in node:
21
+ 0 && (module.exports = {
22
+ ...require('./intlayerCracoPlugin.cjs'),
23
+ ...require('./craco.config.cjs')
24
+ });
25
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './intlayerCracoPlugin';\nexport * from './craco.config';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,kCAAd;AACA,0BAAc,2BADd;","names":[]}
@@ -18,17 +18,15 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var intlayerCracoPlugin_exports = {};
20
20
  __export(intlayerCracoPlugin_exports, {
21
+ intlayerCracoPlugin: () => intlayerCracoPlugin,
21
22
  overrideCracoConfig: () => overrideCracoConfig,
22
- overrideWebpackConfig: () => overrideWebpackConfig,
23
- plugin: () => plugin
23
+ overrideWebpackConfig: () => overrideWebpackConfig
24
24
  });
25
25
  module.exports = __toCommonJS(intlayerCracoPlugin_exports);
26
26
  var import_path = require("path");
27
27
  var import_config = require("@intlayer/config");
28
28
  var import_webpack = require("@intlayer/webpack");
29
- var import_webpack2 = require("webpack");
30
29
  const intlayerConfig = (0, import_config.getConfiguration)();
31
- const env = (0, import_config.formatEnvVariable)("react_app");
32
30
  const overrideWebpackConfig = ({
33
31
  webpackConfig
34
32
  }) => {
@@ -48,7 +46,7 @@ const overrideWebpackConfig = ({
48
46
  const overrideCracoConfig = ({
49
47
  cracoConfig
50
48
  }) => {
51
- const { mainDir, baseDir } = intlayerConfig.content;
49
+ const { mainDir, baseDir, configDir } = intlayerConfig.content;
52
50
  const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.mjs");
53
51
  const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
54
52
  const configurationPath = (0, import_path.join)(configDir, "configuration.json");
@@ -59,7 +57,7 @@ const overrideCracoConfig = ({
59
57
  ...cracoConfig.webpack,
60
58
  plugins: {
61
59
  ...cracoConfig.webpack?.plugins,
62
- add: [new import_webpack2.EnvironmentPlugin(env), new import_webpack.IntlayerPlugin()]
60
+ add: [new import_webpack.IntlayerPlugin()]
63
61
  },
64
62
  configure: {
65
63
  ...cracoConfig.webpack?.configure ?? {},
@@ -79,14 +77,14 @@ const overrideCracoConfig = ({
79
77
  }
80
78
  };
81
79
  };
82
- const plugin = {
80
+ const intlayerCracoPlugin = {
83
81
  overrideCracoConfig,
84
82
  overrideWebpackConfig
85
83
  };
86
84
  // Annotate the CommonJS export names for ESM import in node:
87
85
  0 && (module.exports = {
86
+ intlayerCracoPlugin,
88
87
  overrideCracoConfig,
89
- overrideWebpackConfig,
90
- plugin
88
+ overrideWebpackConfig
91
89
  });
92
90
  //# sourceMappingURL=intlayerCracoPlugin.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// @ts-nocheck\n\nimport { resolve, relative, join } from 'path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport {\n getConfiguration,\n formatEnvVariable,\n ESMxCJSRequire,\n} from '@intlayer/config';\nimport { IntlayerPlugin as IntlayerWebpackPlugin } from '@intlayer/webpack';\nimport {\n type Configuration as WebpackConfig,\n EnvironmentPlugin,\n} from 'webpack';\n\n// Get Intlayer configuration\nconst intlayerConfig = getConfiguration();\n\n// Format environment variables\nconst env: Record<string, string> = formatEnvVariable('react_app');\n\n// Custom CRACO plugin function to override webpack configuration\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\n webpackConfig.externals = {\n ...(typeof webpackConfig.externals === 'object'\n ? webpackConfig.externals\n : {}),\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n vm: 'vm',\n };\n\n (webpackConfig.module?.rules ?? []).push({\n test: /\\.node$/,\n use: 'node-loader',\n });\n\n // You can add any custom CRACO plugins here if needed\n // config.plugins.push(new CustomCracoPlugin());\n\n return webpackConfig;\n};\n\n// Return a CRACO configuration object\nexport const overrideCracoConfig = ({\n cracoConfig,\n}: CracoConfigOverride): CracoConfig => {\n const { mainDir, baseDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n return {\n ...cracoConfig,\n webpack: {\n ...cracoConfig.webpack,\n plugins: {\n ...cracoConfig.webpack?.plugins,\n add: [new EnvironmentPlugin(env), new IntlayerWebpackPlugin()],\n },\n configure: {\n ...(cracoConfig.webpack?.configure ?? {}),\n resolve: {\n ...(cracoConfig.webpack?.configure?.resolve ?? {}),\n fallback: {\n ...(cracoConfig.webpack?.configure?.resolve?.fallback ?? {}),\n process: ESMxCJSRequire.resolve('process/browser'),\n },\n },\n },\n\n alias: {\n ...cracoConfig.webpack?.alias,\n '@intlayer/dictionaries-entry': resolve('./', relativeDictionariesPath),\n '@intlayer/config/built': resolve('./', relativeConfigurationPath),\n },\n },\n };\n};\n\n/**\n * A CRACO plugin that adds the Intlayer configuration to the webpack configuration and sets the environment variables.\n *\n * Usage:\n *\n * ```ts\n * const cracoConfig: CracoConfig = {\n * plugins: [\n * {\n * plugin: intlayerCracoPlugin(),\n * },\n * ],\n * };\n *\n * export default cracoConfig;\n * ```\n *\n */\nexport const plugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwC;AAOxC,oBAIO;AACP,qBAAwD;AACxD,IAAAA,kBAGO;AAGP,MAAM,qBAAiB,gCAAiB;AAGxC,MAAM,UAA8B,iCAAkB,WAAW;AAG1D,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAA4C;AAC1C,gBAAc,YAAY;AAAA,IACxB,GAAI,OAAO,cAAc,cAAc,WACnC,cAAc,YACd,CAAC;AAAA,IACL,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAEA,GAAC,cAAc,QAAQ,SAAS,CAAC,GAAG,KAAK;AAAA,IACvC,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC;AAKD,SAAO;AACT;AAGO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,MAAwC;AACtC,QAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAE5C,QAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,QAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,QAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAC9D,QAAM,gCAA4B,sBAAS,SAAS,iBAAiB;AAErE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,YAAY;AAAA,MACf,SAAS;AAAA,QACP,GAAG,YAAY,SAAS;AAAA,QACxB,KAAK,CAAC,IAAI,kCAAkB,GAAG,GAAG,IAAI,eAAAC,eAAsB,CAAC;AAAA,MAC/D;AAAA,MACA,WAAW;AAAA,QACT,GAAI,YAAY,SAAS,aAAa,CAAC;AAAA,QACvC,SAAS;AAAA,UACP,GAAI,YAAY,SAAS,WAAW,WAAW,CAAC;AAAA,UAChD,UAAU;AAAA,YACR,GAAI,YAAY,SAAS,WAAW,SAAS,YAAY,CAAC;AAAA,YAC1D,SAAS,6BAAe,QAAQ,iBAAiB;AAAA,UACnD;AAAA,QACF;AAAA,MACF;AAAA,MAEA,OAAO;AAAA,QACL,GAAG,YAAY,SAAS;AAAA,QACxB,oCAAgC,qBAAQ,MAAM,wBAAwB;AAAA,QACtE,8BAA0B,qBAAQ,MAAM,yBAAyB;AAAA,MACnE;AAAA,IACF;AAAA,EACF;AACF;AAoBO,MAAM,SAAsB;AAAA,EACjC;AAAA,EACA;AACF;","names":["import_webpack","IntlayerWebpackPlugin"]}
1
+ {"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// @ts-nocheck\n\nimport { resolve, relative, join } from 'path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport {\n getConfiguration,\n formatEnvVariable,\n ESMxCJSRequire,\n} from '@intlayer/config';\nimport { IntlayerPlugin as IntlayerWebpackPlugin } from '@intlayer/webpack';\nimport { type Configuration as WebpackConfig } from 'webpack';\n\n// Get Intlayer configuration\nconst intlayerConfig = getConfiguration();\n\n// Custom CRACO plugin function to override webpack configuration\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\n webpackConfig.externals = {\n ...(typeof webpackConfig.externals === 'object'\n ? webpackConfig.externals\n : {}),\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n vm: 'vm',\n };\n\n (webpackConfig.module?.rules ?? []).push({\n test: /\\.node$/,\n use: 'node-loader',\n });\n\n // You can add any custom CRACO plugins here if needed\n // config.plugins.push(new CustomCracoPlugin());\n\n return webpackConfig;\n};\n\n// Return a CRACO configuration object\nexport const overrideCracoConfig = ({\n cracoConfig,\n}: CracoConfigOverride): CracoConfig => {\n const { mainDir, baseDir, configDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n return {\n ...cracoConfig,\n webpack: {\n ...cracoConfig.webpack,\n plugins: {\n ...cracoConfig.webpack?.plugins,\n add: [new IntlayerWebpackPlugin()],\n },\n configure: {\n ...(cracoConfig.webpack?.configure ?? {}),\n resolve: {\n ...(cracoConfig.webpack?.configure?.resolve ?? {}),\n fallback: {\n ...(cracoConfig.webpack?.configure?.resolve?.fallback ?? {}),\n process: ESMxCJSRequire.resolve('process/browser'),\n },\n },\n },\n\n alias: {\n ...cracoConfig.webpack?.alias,\n '@intlayer/dictionaries-entry': resolve('./', relativeDictionariesPath),\n '@intlayer/config/built': resolve('./', relativeConfigurationPath),\n },\n },\n };\n};\n\n/**\n * A CRACO plugin that adds the Intlayer configuration to the webpack configuration and sets the environment variables.\n *\n * Usage:\n *\n * ```ts\n * const cracoConfig: CracoConfig = {\n * plugins: [\n * {\n * plugin: intlayerCracoPlugin(),\n * },\n * ],\n * };\n *\n * export default cracoConfig;\n * ```\n *\n */\nexport const intlayerCracoPlugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,kBAAwC;AAOxC,oBAIO;AACP,qBAAwD;AAIxD,MAAM,qBAAiB,gCAAiB;AAGjC,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAA4C;AAC1C,gBAAc,YAAY;AAAA,IACxB,GAAI,OAAO,cAAc,cAAc,WACnC,cAAc,YACd,CAAC;AAAA,IACL,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAEA,GAAC,cAAc,QAAQ,SAAS,CAAC,GAAG,KAAK;AAAA,IACvC,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC;AAKD,SAAO;AACT;AAGO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,MAAwC;AACtC,QAAM,EAAE,SAAS,SAAS,UAAU,IAAI,eAAe;AAEvD,QAAM,uBAAmB,kBAAK,SAAS,kBAAkB;AACzD,QAAM,+BAA2B,sBAAS,SAAS,gBAAgB;AAEnE,QAAM,wBAAoB,kBAAK,WAAW,oBAAoB;AAC9D,QAAM,gCAA4B,sBAAS,SAAS,iBAAiB;AAErE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,YAAY;AAAA,MACf,SAAS;AAAA,QACP,GAAG,YAAY,SAAS;AAAA,QACxB,KAAK,CAAC,IAAI,eAAAA,eAAsB,CAAC;AAAA,MACnC;AAAA,MACA,WAAW;AAAA,QACT,GAAI,YAAY,SAAS,aAAa,CAAC;AAAA,QACvC,SAAS;AAAA,UACP,GAAI,YAAY,SAAS,WAAW,WAAW,CAAC;AAAA,UAChD,UAAU;AAAA,YACR,GAAI,YAAY,SAAS,WAAW,SAAS,YAAY,CAAC;AAAA,YAC1D,SAAS,6BAAe,QAAQ,iBAAiB;AAAA,UACnD;AAAA,QACF;AAAA,MACF;AAAA,MAEA,OAAO;AAAA,QACL,GAAG,YAAY,SAAS;AAAA,QACxB,oCAAgC,qBAAQ,MAAM,wBAAwB;AAAA,QACtE,8BAA0B,qBAAQ,MAAM,yBAAyB;AAAA,MACnE;AAAA,IACF;AAAA,EACF;AACF;AAoBO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":["IntlayerWebpackPlugin"]}
@@ -1,17 +1,13 @@
1
- import {
2
- __commonJS
3
- } from "./chunk-ZD7AOCMD.mjs";
4
- import * as intlayerPlugin from "./intlayerCracoPlugin.mjs";
5
- var require_craco_config = __commonJS({
6
- "src/craco.config.ts"(exports, module) {
7
- module.exports = {
8
- plugins: [
9
- {
10
- plugin: intlayerPlugin
11
- }
12
- ]
13
- };
14
- }
15
- });
16
- export default require_craco_config();
1
+ import { intlayerCracoPlugin } from "./intlayerCracoPlugin.mjs";
2
+ const cracoConfig = {
3
+ plugins: [
4
+ {
5
+ plugin: intlayerCracoPlugin
6
+ }
7
+ ]
8
+ };
9
+ var craco_config_default = cracoConfig;
10
+ export {
11
+ craco_config_default as default
12
+ };
17
13
  //# sourceMappingURL=craco.config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/craco.config.ts"],"sourcesContent":["import type { CracoConfig, CracoPlugin } from '@craco/types';\nimport * as intlayerPlugin from './intlayerCracoPlugin';\n\n// Usage Example\nmodule.exports = {\n plugins: [\n {\n plugin: intlayerPlugin as CracoPlugin,\n },\n ],\n} satisfies CracoConfig;\n"],"mappings":";;;AACA,YAAY,oBAAoB;AADhC;AAAA;AAIA,WAAO,UAAU;AAAA,MACf,SAAS;AAAA,QACP;AAAA,UACE,QAAQ;AAAA,QACV;AAAA,MACF;AAAA,IACF;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/craco.config.ts"],"sourcesContent":["import type { CracoConfig } from '@craco/types';\nimport { intlayerCracoPlugin } from './intlayerCracoPlugin';\n\n// Usage Example\nconst cracoConfig = {\n plugins: [\n {\n plugin: intlayerCracoPlugin,\n },\n ],\n} satisfies CracoConfig;\n\nexport default cracoConfig;\n"],"mappings":"AACA,SAAS,2BAA2B;AAGpC,MAAM,cAAc;AAAA,EAClB,SAAS;AAAA,IACP;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAEA,IAAO,uBAAQ;","names":[]}
@@ -0,0 +1,3 @@
1
+ export * from "./intlayerCracoPlugin.mjs";
2
+ export * from "./craco.config.mjs";
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './intlayerCracoPlugin';\nexport * from './craco.config';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -1,16 +1,10 @@
1
- import "./chunk-ZD7AOCMD.mjs";
2
1
  import { resolve, relative, join } from "path";
3
2
  import {
4
3
  getConfiguration,
5
- formatEnvVariable,
6
4
  ESMxCJSRequire
7
5
  } from "@intlayer/config";
8
6
  import { IntlayerPlugin as IntlayerWebpackPlugin } from "@intlayer/webpack";
9
- import {
10
- EnvironmentPlugin
11
- } from "webpack";
12
7
  const intlayerConfig = getConfiguration();
13
- const env = formatEnvVariable("react_app");
14
8
  const overrideWebpackConfig = ({
15
9
  webpackConfig
16
10
  }) => {
@@ -30,7 +24,7 @@ const overrideWebpackConfig = ({
30
24
  const overrideCracoConfig = ({
31
25
  cracoConfig
32
26
  }) => {
33
- const { mainDir, baseDir } = intlayerConfig.content;
27
+ const { mainDir, baseDir, configDir } = intlayerConfig.content;
34
28
  const dictionariesPath = join(mainDir, "dictionaries.mjs");
35
29
  const relativeDictionariesPath = relative(baseDir, dictionariesPath);
36
30
  const configurationPath = join(configDir, "configuration.json");
@@ -41,7 +35,7 @@ const overrideCracoConfig = ({
41
35
  ...cracoConfig.webpack,
42
36
  plugins: {
43
37
  ...cracoConfig.webpack?.plugins,
44
- add: [new EnvironmentPlugin(env), new IntlayerWebpackPlugin()]
38
+ add: [new IntlayerWebpackPlugin()]
45
39
  },
46
40
  configure: {
47
41
  ...cracoConfig.webpack?.configure ?? {},
@@ -61,13 +55,13 @@ const overrideCracoConfig = ({
61
55
  }
62
56
  };
63
57
  };
64
- const plugin = {
58
+ const intlayerCracoPlugin = {
65
59
  overrideCracoConfig,
66
60
  overrideWebpackConfig
67
61
  };
68
62
  export {
63
+ intlayerCracoPlugin,
69
64
  overrideCracoConfig,
70
- overrideWebpackConfig,
71
- plugin
65
+ overrideWebpackConfig
72
66
  };
73
67
  //# sourceMappingURL=intlayerCracoPlugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// @ts-nocheck\n\nimport { resolve, relative, join } from 'path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport {\n getConfiguration,\n formatEnvVariable,\n ESMxCJSRequire,\n} from '@intlayer/config';\nimport { IntlayerPlugin as IntlayerWebpackPlugin } from '@intlayer/webpack';\nimport {\n type Configuration as WebpackConfig,\n EnvironmentPlugin,\n} from 'webpack';\n\n// Get Intlayer configuration\nconst intlayerConfig = getConfiguration();\n\n// Format environment variables\nconst env: Record<string, string> = formatEnvVariable('react_app');\n\n// Custom CRACO plugin function to override webpack configuration\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\n webpackConfig.externals = {\n ...(typeof webpackConfig.externals === 'object'\n ? webpackConfig.externals\n : {}),\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n vm: 'vm',\n };\n\n (webpackConfig.module?.rules ?? []).push({\n test: /\\.node$/,\n use: 'node-loader',\n });\n\n // You can add any custom CRACO plugins here if needed\n // config.plugins.push(new CustomCracoPlugin());\n\n return webpackConfig;\n};\n\n// Return a CRACO configuration object\nexport const overrideCracoConfig = ({\n cracoConfig,\n}: CracoConfigOverride): CracoConfig => {\n const { mainDir, baseDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n return {\n ...cracoConfig,\n webpack: {\n ...cracoConfig.webpack,\n plugins: {\n ...cracoConfig.webpack?.plugins,\n add: [new EnvironmentPlugin(env), new IntlayerWebpackPlugin()],\n },\n configure: {\n ...(cracoConfig.webpack?.configure ?? {}),\n resolve: {\n ...(cracoConfig.webpack?.configure?.resolve ?? {}),\n fallback: {\n ...(cracoConfig.webpack?.configure?.resolve?.fallback ?? {}),\n process: ESMxCJSRequire.resolve('process/browser'),\n },\n },\n },\n\n alias: {\n ...cracoConfig.webpack?.alias,\n '@intlayer/dictionaries-entry': resolve('./', relativeDictionariesPath),\n '@intlayer/config/built': resolve('./', relativeConfigurationPath),\n },\n },\n };\n};\n\n/**\n * A CRACO plugin that adds the Intlayer configuration to the webpack configuration and sets the environment variables.\n *\n * Usage:\n *\n * ```ts\n * const cracoConfig: CracoConfig = {\n * plugins: [\n * {\n * plugin: intlayerCracoPlugin(),\n * },\n * ],\n * };\n *\n * export default cracoConfig;\n * ```\n *\n */\nexport const plugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";AAEA,SAAS,SAAS,UAAU,YAAY;AAOxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,6BAA6B;AACxD;AAAA,EAEE;AAAA,OACK;AAGP,MAAM,iBAAiB,iBAAiB;AAGxC,MAAM,MAA8B,kBAAkB,WAAW;AAG1D,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAA4C;AAC1C,gBAAc,YAAY;AAAA,IACxB,GAAI,OAAO,cAAc,cAAc,WACnC,cAAc,YACd,CAAC;AAAA,IACL,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAEA,GAAC,cAAc,QAAQ,SAAS,CAAC,GAAG,KAAK;AAAA,IACvC,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC;AAKD,SAAO;AACT;AAGO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,MAAwC;AACtC,QAAM,EAAE,SAAS,QAAQ,IAAI,eAAe;AAE5C,QAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,QAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,QAAM,oBAAoB,KAAK,WAAW,oBAAoB;AAC9D,QAAM,4BAA4B,SAAS,SAAS,iBAAiB;AAErE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,YAAY;AAAA,MACf,SAAS;AAAA,QACP,GAAG,YAAY,SAAS;AAAA,QACxB,KAAK,CAAC,IAAI,kBAAkB,GAAG,GAAG,IAAI,sBAAsB,CAAC;AAAA,MAC/D;AAAA,MACA,WAAW;AAAA,QACT,GAAI,YAAY,SAAS,aAAa,CAAC;AAAA,QACvC,SAAS;AAAA,UACP,GAAI,YAAY,SAAS,WAAW,WAAW,CAAC;AAAA,UAChD,UAAU;AAAA,YACR,GAAI,YAAY,SAAS,WAAW,SAAS,YAAY,CAAC;AAAA,YAC1D,SAAS,eAAe,QAAQ,iBAAiB;AAAA,UACnD;AAAA,QACF;AAAA,MACF;AAAA,MAEA,OAAO;AAAA,QACL,GAAG,YAAY,SAAS;AAAA,QACxB,gCAAgC,QAAQ,MAAM,wBAAwB;AAAA,QACtE,0BAA0B,QAAQ,MAAM,yBAAyB;AAAA,MACnE;AAAA,IACF;AAAA,EACF;AACF;AAoBO,MAAM,SAAsB;AAAA,EACjC;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// @ts-nocheck\n\nimport { resolve, relative, join } from 'path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport {\n getConfiguration,\n formatEnvVariable,\n ESMxCJSRequire,\n} from '@intlayer/config';\nimport { IntlayerPlugin as IntlayerWebpackPlugin } from '@intlayer/webpack';\nimport { type Configuration as WebpackConfig } from 'webpack';\n\n// Get Intlayer configuration\nconst intlayerConfig = getConfiguration();\n\n// Custom CRACO plugin function to override webpack configuration\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\n webpackConfig.externals = {\n ...(typeof webpackConfig.externals === 'object'\n ? webpackConfig.externals\n : {}),\n esbuild: 'esbuild',\n module: 'module',\n fs: 'fs',\n vm: 'vm',\n };\n\n (webpackConfig.module?.rules ?? []).push({\n test: /\\.node$/,\n use: 'node-loader',\n });\n\n // You can add any custom CRACO plugins here if needed\n // config.plugins.push(new CustomCracoPlugin());\n\n return webpackConfig;\n};\n\n// Return a CRACO configuration object\nexport const overrideCracoConfig = ({\n cracoConfig,\n}: CracoConfigOverride): CracoConfig => {\n const { mainDir, baseDir, configDir } = intlayerConfig.content;\n\n const dictionariesPath = join(mainDir, 'dictionaries.mjs');\n const relativeDictionariesPath = relative(baseDir, dictionariesPath);\n\n const configurationPath = join(configDir, 'configuration.json');\n const relativeConfigurationPath = relative(baseDir, configurationPath);\n\n return {\n ...cracoConfig,\n webpack: {\n ...cracoConfig.webpack,\n plugins: {\n ...cracoConfig.webpack?.plugins,\n add: [new IntlayerWebpackPlugin()],\n },\n configure: {\n ...(cracoConfig.webpack?.configure ?? {}),\n resolve: {\n ...(cracoConfig.webpack?.configure?.resolve ?? {}),\n fallback: {\n ...(cracoConfig.webpack?.configure?.resolve?.fallback ?? {}),\n process: ESMxCJSRequire.resolve('process/browser'),\n },\n },\n },\n\n alias: {\n ...cracoConfig.webpack?.alias,\n '@intlayer/dictionaries-entry': resolve('./', relativeDictionariesPath),\n '@intlayer/config/built': resolve('./', relativeConfigurationPath),\n },\n },\n };\n};\n\n/**\n * A CRACO plugin that adds the Intlayer configuration to the webpack configuration and sets the environment variables.\n *\n * Usage:\n *\n * ```ts\n * const cracoConfig: CracoConfig = {\n * plugins: [\n * {\n * plugin: intlayerCracoPlugin(),\n * },\n * ],\n * };\n *\n * export default cracoConfig;\n * ```\n *\n */\nexport const intlayerCracoPlugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":"AAEA,SAAS,SAAS,UAAU,YAAY;AAOxC;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AACP,SAAS,kBAAkB,6BAA6B;AAIxD,MAAM,iBAAiB,iBAAiB;AAGjC,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAA4C;AAC1C,gBAAc,YAAY;AAAA,IACxB,GAAI,OAAO,cAAc,cAAc,WACnC,cAAc,YACd,CAAC;AAAA,IACL,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAEA,GAAC,cAAc,QAAQ,SAAS,CAAC,GAAG,KAAK;AAAA,IACvC,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC;AAKD,SAAO;AACT;AAGO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AACF,MAAwC;AACtC,QAAM,EAAE,SAAS,SAAS,UAAU,IAAI,eAAe;AAEvD,QAAM,mBAAmB,KAAK,SAAS,kBAAkB;AACzD,QAAM,2BAA2B,SAAS,SAAS,gBAAgB;AAEnE,QAAM,oBAAoB,KAAK,WAAW,oBAAoB;AAC9D,QAAM,4BAA4B,SAAS,SAAS,iBAAiB;AAErE,SAAO;AAAA,IACL,GAAG;AAAA,IACH,SAAS;AAAA,MACP,GAAG,YAAY;AAAA,MACf,SAAS;AAAA,QACP,GAAG,YAAY,SAAS;AAAA,QACxB,KAAK,CAAC,IAAI,sBAAsB,CAAC;AAAA,MACnC;AAAA,MACA,WAAW;AAAA,QACT,GAAI,YAAY,SAAS,aAAa,CAAC;AAAA,QACvC,SAAS;AAAA,UACP,GAAI,YAAY,SAAS,WAAW,WAAW,CAAC;AAAA,UAChD,UAAU;AAAA,YACR,GAAI,YAAY,SAAS,WAAW,SAAS,YAAY,CAAC;AAAA,YAC1D,SAAS,eAAe,QAAQ,iBAAiB;AAAA,UACnD;AAAA,QACF;AAAA,MACF;AAAA,MAEA,OAAO;AAAA,QACL,GAAG,YAAY,SAAS;AAAA,QACxB,gCAAgC,QAAQ,MAAM,wBAAwB;AAAA,QACtE,0BAA0B,QAAQ,MAAM,yBAAyB;AAAA,MACnE;AAAA,IACF;AAAA,EACF;AACF;AAoBO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":[]}
@@ -1,2 +1,7 @@
1
- export {};
1
+ declare const cracoConfig: {
2
+ plugins: {
3
+ plugin: import("@craco/types").CracoPlugin;
4
+ }[];
5
+ };
6
+ export default cracoConfig;
2
7
  //# sourceMappingURL=craco.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"craco.config.d.ts","sourceRoot":"","sources":["../../src/craco.config.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"craco.config.d.ts","sourceRoot":"","sources":["../../src/craco.config.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,WAAW;;;;CAMM,CAAC;AAExB,eAAe,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './intlayerCracoPlugin';
2
+ export * from './craco.config';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC"}
@@ -20,5 +20,5 @@ export declare const overrideCracoConfig: ({ cracoConfig, }: CracoConfigOverride
20
20
  * ```
21
21
  *
22
22
  */
23
- export declare const plugin: CracoPlugin;
23
+ export declare const intlayerCracoPlugin: CracoPlugin;
24
24
  //# sourceMappingURL=intlayerCracoPlugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerCracoPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerCracoPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACtB,MAAM,cAAc,CAAC;AAOtB,OAAO,EACL,KAAK,aAAa,IAAI,aAAa,EAEpC,MAAM,SAAS,CAAC;AASjB,eAAO,MAAM,qBAAqB,GAAI,oBAEnC,qBAAqB,KAAG,aAoB1B,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAAI,kBAEjC,mBAAmB,KAAG,WAmCxB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,MAAM,EAAE,WAGpB,CAAC"}
1
+ {"version":3,"file":"intlayerCracoPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerCracoPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACtB,MAAM,cAAc,CAAC;AAOtB,OAAO,EAAE,KAAK,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAM9D,eAAO,MAAM,qBAAqB,GAAI,oBAEnC,qBAAqB,KAAG,aAoB1B,CAAC;AAGF,eAAO,MAAM,mBAAmB,GAAI,kBAEjC,mBAAmB,KAAG,WAmCxB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAGjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-scripts-intlayer",
3
- "version": "5.2.5",
3
+ "version": "5.2.7",
4
4
  "private": false,
5
5
  "description": "Integrate Intlayer with Create React App using custom React scripts for internationalization i18n and advanced Webpack configurations",
6
6
  "keywords": [
@@ -64,8 +64,8 @@
64
64
  "node-loader": "^2.1.0",
65
65
  "process": "^0.11.10",
66
66
  "webpack": "^5.97.1",
67
- "@intlayer/webpack": "5.2.5",
68
- "@intlayer/config": "5.2.5"
67
+ "@intlayer/config": "5.2.7",
68
+ "@intlayer/webpack": "5.2.7"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@craco/types": "^7.1.0",
@@ -80,7 +80,7 @@
80
80
  "tsc-alias": "^1.8.10",
81
81
  "tsup": "^8.3.5",
82
82
  "typescript": "^5.7.3",
83
- "@intlayer/backend": "5.2.5",
83
+ "@intlayer/backend": "5.2.7",
84
84
  "@utils/eslint-config": "1.0.4",
85
85
  "@utils/ts-config": "1.0.4",
86
86
  "@utils/ts-config-types": "1.0.4",
@@ -88,8 +88,8 @@
88
88
  },
89
89
  "peerDependencies": {
90
90
  "webpack": ">=5.0.0",
91
- "@intlayer/config": "5.2.5",
92
- "@intlayer/webpack": "5.2.5"
91
+ "@intlayer/config": "5.2.7",
92
+ "@intlayer/webpack": "5.2.7"
93
93
  },
94
94
  "engines": {
95
95
  "node": ">=14.18"
@@ -1,9 +0,0 @@
1
- var __getOwnPropNames = Object.getOwnPropertyNames;
2
- var __commonJS = (cb, mod) => function __require() {
3
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
4
- };
5
-
6
- export {
7
- __commonJS
8
- };
9
- //# sourceMappingURL=chunk-ZD7AOCMD.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}