react-scripts-intlayer 5.3.0 → 5.3.2

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,26 +1,4 @@
1
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 __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
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
2
  var import_intlayerCracoPlugin = require('./intlayerCracoPlugin.cjs');
25
3
  const cracoConfig = {
26
4
  plugins: [
@@ -29,5 +7,5 @@ const cracoConfig = {
29
7
  }
30
8
  ]
31
9
  };
32
- var craco_config_default = cracoConfig;
10
+ module.exports = cracoConfig;
33
11
  //# sourceMappingURL=craco.config.cjs.map
@@ -1 +1 @@
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":[]}
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\n// Necessary Exporting as CJS for CRACO to work\nmodule.exports = cracoConfig;\n"],"mappings":";AACA,iCAAoC;AAGpC,MAAM,cAAc;AAAA,EAClB,SAAS;AAAA,IACP;AAAA,MACE,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AAGA,OAAO,UAAU;","names":[]}
@@ -32,12 +32,14 @@ const overrideWebpackConfig = ({
32
32
  }) => {
33
33
  webpackConfig.externals = {
34
34
  ...typeof webpackConfig.externals === "object" ? webpackConfig.externals : {},
35
- esbuild: "esbuild",
36
- module: "module",
37
- fs: "fs",
38
- vm: "vm"
35
+ esbuild: "esbuild"
36
+ // keep only esbuild external
39
37
  };
40
- (webpackConfig.module?.rules ?? []).push({
38
+ delete webpackConfig.externals.module;
39
+ delete webpackConfig.externals.fs;
40
+ delete webpackConfig.externals.path;
41
+ delete webpackConfig.externals.vm;
42
+ webpackConfig.module.rules.push({
41
43
  test: /\.node$/,
42
44
  use: "node-loader"
43
45
  });
@@ -57,22 +59,32 @@ const overrideCracoConfig = ({
57
59
  ...cracoConfig.webpack,
58
60
  plugins: {
59
61
  ...cracoConfig.webpack?.plugins,
60
- add: [new import_webpack.IntlayerPlugin()]
62
+ // Ensure we actually add IntlayerWebpackPlugin
63
+ add: [
64
+ ...cracoConfig.webpack?.plugins?.add ?? [],
65
+ new import_webpack.IntlayerPlugin()
66
+ ]
61
67
  },
62
68
  configure: {
63
69
  ...cracoConfig.webpack?.configure ?? {},
64
70
  resolve: {
65
71
  ...cracoConfig.webpack?.configure?.resolve ?? {},
72
+ // 3) Provide browser fallbacks so these modules won’t error out in the browser.
66
73
  fallback: {
67
74
  ...cracoConfig.webpack?.configure?.resolve?.fallback ?? {},
68
- process: import_config.ESMxCJSRequire.resolve("process/browser")
75
+ process: import_config.ESMxCJSRequire.resolve("process/browser"),
76
+ fs: false,
77
+ module: false,
78
+ path: false,
79
+ vm: false
69
80
  }
70
81
  }
71
82
  },
83
+ // 4) Alias @intlayer/dictionaries-entry so it no longer tries to use the ESM that depends on `fs`, etc.
72
84
  alias: {
73
85
  ...cracoConfig.webpack?.alias,
74
- "@intlayer/dictionaries-entry": (0, import_path.resolve)("./", relativeDictionariesPath),
75
- "@intlayer/config/built": (0, import_path.resolve)("./", relativeConfigurationPath)
86
+ "@intlayer/dictionaries-entry": (0, import_path.resolve)(relativeDictionariesPath),
87
+ "@intlayer/config/built": (0, import_path.resolve)(relativeConfigurationPath)
76
88
  }
77
89
  }
78
90
  };
@@ -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 { 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
+ {"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// craco-intlayer-plugin.ts\n\n// @ts-nocheck\n\nimport { resolve, relative, join } from 'path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { getConfiguration, ESMxCJSRequire } 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/**\n * Override the final CRA Webpack config.\n */\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\n // 1) Remove `module`, `fs`, `path`, `vm` from externals. In CRA, you usually\n // want these to be bundled (or set to fallbacks).\n webpackConfig.externals = {\n ...(typeof webpackConfig.externals === 'object'\n ? webpackConfig.externals\n : {}),\n esbuild: 'esbuild', // keep only esbuild external\n };\n delete webpackConfig.externals.module;\n delete webpackConfig.externals.fs;\n delete webpackConfig.externals.path;\n delete webpackConfig.externals.vm;\n\n // 2) Properly push node-loader rule instead of overwriting.\n webpackConfig.module.rules.push({\n test: /\\.node$/,\n use: 'node-loader',\n });\n\n return webpackConfig;\n};\n\n/**\n * Override the CRACO config itself to set up aliases, fallbacks, and plugins.\n */\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 // Ensure we actually add IntlayerWebpackPlugin\n add: [\n ...(cracoConfig.webpack?.plugins?.add ?? []),\n new IntlayerWebpackPlugin(),\n ],\n },\n configure: {\n ...(cracoConfig.webpack?.configure ?? {}),\n resolve: {\n ...(cracoConfig.webpack?.configure?.resolve ?? {}),\n // 3) Provide browser fallbacks so these modules won’t error out in the browser.\n fallback: {\n ...(cracoConfig.webpack?.configure?.resolve?.fallback ?? {}),\n process: ESMxCJSRequire.resolve('process/browser'),\n fs: false,\n module: false,\n path: false,\n vm: false,\n },\n },\n },\n // 4) Alias @intlayer/dictionaries-entry so it no longer tries to use the ESM that depends on `fs`, etc.\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 */\nexport const intlayerCracoPlugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,kBAAwC;AAOxC,oBAAiD;AACjD,qBAAwD;AAIxD,MAAM,qBAAiB,gCAAiB;AAKjC,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAA4C;AAG1C,gBAAc,YAAY;AAAA,IACxB,GAAI,OAAO,cAAc,cAAc,WACnC,cAAc,YACd,CAAC;AAAA,IACL,SAAS;AAAA;AAAA,EACX;AACA,SAAO,cAAc,UAAU;AAC/B,SAAO,cAAc,UAAU;AAC/B,SAAO,cAAc,UAAU;AAC/B,SAAO,cAAc,UAAU;AAG/B,gBAAc,OAAO,MAAM,KAAK;AAAA,IAC9B,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC;AAED,SAAO;AACT;AAKO,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;AAAA,QAExB,KAAK;AAAA,UACH,GAAI,YAAY,SAAS,SAAS,OAAO,CAAC;AAAA,UAC1C,IAAI,eAAAA,eAAsB;AAAA,QAC5B;AAAA,MACF;AAAA,MACA,WAAW;AAAA,QACT,GAAI,YAAY,SAAS,aAAa,CAAC;AAAA,QACvC,SAAS;AAAA,UACP,GAAI,YAAY,SAAS,WAAW,WAAW,CAAC;AAAA;AAAA,UAEhD,UAAU;AAAA,YACR,GAAI,YAAY,SAAS,WAAW,SAAS,YAAY,CAAC;AAAA,YAC1D,SAAS,6BAAe,QAAQ,iBAAiB;AAAA,YACjD,IAAI;AAAA,YACJ,QAAQ;AAAA,YACR,MAAM;AAAA,YACN,IAAI;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA;AAAA,MAEA,OAAO;AAAA,QACL,GAAG,YAAY,SAAS;AAAA,QACxB,oCAAgC,qBAAQ,wBAAwB;AAAA,QAChE,8BAA0B,qBAAQ,yBAAyB;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAmBO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":["IntlayerWebpackPlugin"]}
@@ -0,0 +1,9 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,13 +1,18 @@
1
+ import {
2
+ __commonJS
3
+ } from "./chunk-ZD7AOCMD.mjs";
1
4
  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
- };
5
+ var require_craco_config = __commonJS({
6
+ "src/craco.config.ts"(exports, module) {
7
+ const cracoConfig = {
8
+ plugins: [
9
+ {
10
+ plugin: intlayerCracoPlugin
11
+ }
12
+ ]
13
+ };
14
+ module.exports = cracoConfig;
15
+ }
16
+ });
17
+ export default require_craco_config();
13
18
  //# sourceMappingURL=craco.config.mjs.map
@@ -1 +1 @@
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":[]}
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\n// Necessary Exporting as CJS for CRACO to work\nmodule.exports = cracoConfig;\n"],"mappings":";;;AACA,SAAS,2BAA2B;AADpC;AAAA;AAIA,UAAM,cAAc;AAAA,MAClB,SAAS;AAAA,QACP;AAAA,UACE,QAAQ;AAAA,QACV;AAAA,MACF;AAAA,IACF;AAGA,WAAO,UAAU;AAAA;AAAA;","names":[]}
@@ -1,8 +1,6 @@
1
+ import "./chunk-ZD7AOCMD.mjs";
1
2
  import { resolve, relative, join } from "path";
2
- import {
3
- getConfiguration,
4
- ESMxCJSRequire
5
- } from "@intlayer/config";
3
+ import { getConfiguration, ESMxCJSRequire } from "@intlayer/config";
6
4
  import { IntlayerPlugin as IntlayerWebpackPlugin } from "@intlayer/webpack";
7
5
  const intlayerConfig = getConfiguration();
8
6
  const overrideWebpackConfig = ({
@@ -10,12 +8,14 @@ const overrideWebpackConfig = ({
10
8
  }) => {
11
9
  webpackConfig.externals = {
12
10
  ...typeof webpackConfig.externals === "object" ? webpackConfig.externals : {},
13
- esbuild: "esbuild",
14
- module: "module",
15
- fs: "fs",
16
- vm: "vm"
11
+ esbuild: "esbuild"
12
+ // keep only esbuild external
17
13
  };
18
- (webpackConfig.module?.rules ?? []).push({
14
+ delete webpackConfig.externals.module;
15
+ delete webpackConfig.externals.fs;
16
+ delete webpackConfig.externals.path;
17
+ delete webpackConfig.externals.vm;
18
+ webpackConfig.module.rules.push({
19
19
  test: /\.node$/,
20
20
  use: "node-loader"
21
21
  });
@@ -35,22 +35,32 @@ const overrideCracoConfig = ({
35
35
  ...cracoConfig.webpack,
36
36
  plugins: {
37
37
  ...cracoConfig.webpack?.plugins,
38
- add: [new IntlayerWebpackPlugin()]
38
+ // Ensure we actually add IntlayerWebpackPlugin
39
+ add: [
40
+ ...cracoConfig.webpack?.plugins?.add ?? [],
41
+ new IntlayerWebpackPlugin()
42
+ ]
39
43
  },
40
44
  configure: {
41
45
  ...cracoConfig.webpack?.configure ?? {},
42
46
  resolve: {
43
47
  ...cracoConfig.webpack?.configure?.resolve ?? {},
48
+ // 3) Provide browser fallbacks so these modules won’t error out in the browser.
44
49
  fallback: {
45
50
  ...cracoConfig.webpack?.configure?.resolve?.fallback ?? {},
46
- process: ESMxCJSRequire.resolve("process/browser")
51
+ process: ESMxCJSRequire.resolve("process/browser"),
52
+ fs: false,
53
+ module: false,
54
+ path: false,
55
+ vm: false
47
56
  }
48
57
  }
49
58
  },
59
+ // 4) Alias @intlayer/dictionaries-entry so it no longer tries to use the ESM that depends on `fs`, etc.
50
60
  alias: {
51
61
  ...cracoConfig.webpack?.alias,
52
- "@intlayer/dictionaries-entry": resolve("./", relativeDictionariesPath),
53
- "@intlayer/config/built": resolve("./", relativeConfigurationPath)
62
+ "@intlayer/dictionaries-entry": resolve(relativeDictionariesPath),
63
+ "@intlayer/config/built": resolve(relativeConfigurationPath)
54
64
  }
55
65
  }
56
66
  };
@@ -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 { 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
+ {"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// craco-intlayer-plugin.ts\n\n// @ts-nocheck\n\nimport { resolve, relative, join } from 'path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { getConfiguration, ESMxCJSRequire } 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/**\n * Override the final CRA Webpack config.\n */\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\n // 1) Remove `module`, `fs`, `path`, `vm` from externals. In CRA, you usually\n // want these to be bundled (or set to fallbacks).\n webpackConfig.externals = {\n ...(typeof webpackConfig.externals === 'object'\n ? webpackConfig.externals\n : {}),\n esbuild: 'esbuild', // keep only esbuild external\n };\n delete webpackConfig.externals.module;\n delete webpackConfig.externals.fs;\n delete webpackConfig.externals.path;\n delete webpackConfig.externals.vm;\n\n // 2) Properly push node-loader rule instead of overwriting.\n webpackConfig.module.rules.push({\n test: /\\.node$/,\n use: 'node-loader',\n });\n\n return webpackConfig;\n};\n\n/**\n * Override the CRACO config itself to set up aliases, fallbacks, and plugins.\n */\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 // Ensure we actually add IntlayerWebpackPlugin\n add: [\n ...(cracoConfig.webpack?.plugins?.add ?? []),\n new IntlayerWebpackPlugin(),\n ],\n },\n configure: {\n ...(cracoConfig.webpack?.configure ?? {}),\n resolve: {\n ...(cracoConfig.webpack?.configure?.resolve ?? {}),\n // 3) Provide browser fallbacks so these modules won’t error out in the browser.\n fallback: {\n ...(cracoConfig.webpack?.configure?.resolve?.fallback ?? {}),\n process: ESMxCJSRequire.resolve('process/browser'),\n fs: false,\n module: false,\n path: false,\n vm: false,\n },\n },\n },\n // 4) Alias @intlayer/dictionaries-entry so it no longer tries to use the ESM that depends on `fs`, etc.\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 */\nexport const intlayerCracoPlugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";AAIA,SAAS,SAAS,UAAU,YAAY;AAOxC,SAAS,kBAAkB,sBAAsB;AACjD,SAAS,kBAAkB,6BAA6B;AAIxD,MAAM,iBAAiB,iBAAiB;AAKjC,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAA4C;AAG1C,gBAAc,YAAY;AAAA,IACxB,GAAI,OAAO,cAAc,cAAc,WACnC,cAAc,YACd,CAAC;AAAA,IACL,SAAS;AAAA;AAAA,EACX;AACA,SAAO,cAAc,UAAU;AAC/B,SAAO,cAAc,UAAU;AAC/B,SAAO,cAAc,UAAU;AAC/B,SAAO,cAAc,UAAU;AAG/B,gBAAc,OAAO,MAAM,KAAK;AAAA,IAC9B,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC;AAED,SAAO;AACT;AAKO,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;AAAA,QAExB,KAAK;AAAA,UACH,GAAI,YAAY,SAAS,SAAS,OAAO,CAAC;AAAA,UAC1C,IAAI,sBAAsB;AAAA,QAC5B;AAAA,MACF;AAAA,MACA,WAAW;AAAA,QACT,GAAI,YAAY,SAAS,aAAa,CAAC;AAAA,QACvC,SAAS;AAAA,UACP,GAAI,YAAY,SAAS,WAAW,WAAW,CAAC;AAAA;AAAA,UAEhD,UAAU;AAAA,YACR,GAAI,YAAY,SAAS,WAAW,SAAS,YAAY,CAAC;AAAA,YAC1D,SAAS,eAAe,QAAQ,iBAAiB;AAAA,YACjD,IAAI;AAAA,YACJ,QAAQ;AAAA,YACR,MAAM;AAAA,YACN,IAAI;AAAA,UACN;AAAA,QACF;AAAA,MACF;AAAA;AAAA,MAEA,OAAO;AAAA,QACL,GAAG,YAAY,SAAS;AAAA,QACxB,gCAAgC,QAAQ,wBAAwB;AAAA,QAChE,0BAA0B,QAAQ,yBAAyB;AAAA,MAC7D;AAAA,IACF;AAAA,EACF;AACF;AAmBO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":[]}
@@ -1,7 +1,2 @@
1
- declare const cracoConfig: {
2
- plugins: {
3
- plugin: import("@craco/types").CracoPlugin;
4
- }[];
5
- };
6
- export default cracoConfig;
1
+ export {};
7
2
  //# sourceMappingURL=craco.config.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"craco.config.d.ts","sourceRoot":"","sources":["../../src/craco.config.ts"],"names":[],"mappings":""}
@@ -1,6 +1,12 @@
1
1
  import type { CracoConfig, CracoConfigOverride, CracoPlugin, WebpackConfigOverride } from '@craco/types';
2
- import { type Configuration as WebpackConfig } from 'webpack';
2
+ import type { Configuration as WebpackConfig } from 'webpack';
3
+ /**
4
+ * Override the final CRA Webpack config.
5
+ */
3
6
  export declare const overrideWebpackConfig: ({ webpackConfig, }: WebpackConfigOverride) => WebpackConfig;
7
+ /**
8
+ * Override the CRACO config itself to set up aliases, fallbacks, and plugins.
9
+ */
4
10
  export declare const overrideCracoConfig: ({ cracoConfig, }: CracoConfigOverride) => CracoConfig;
5
11
  /**
6
12
  * A CRACO plugin that adds the Intlayer configuration to the webpack configuration and sets the environment variables.
@@ -11,14 +17,13 @@ export declare const overrideCracoConfig: ({ cracoConfig, }: CracoConfigOverride
11
17
  * const cracoConfig: CracoConfig = {
12
18
  * plugins: [
13
19
  * {
14
- * plugin: intlayerCracoPlugin(),
20
+ * plugin: intlayerCracoPlugin,
15
21
  * },
16
22
  * ],
17
23
  * };
18
24
  *
19
25
  * export default cracoConfig;
20
26
  * ```
21
- *
22
27
  */
23
28
  export declare const intlayerCracoPlugin: CracoPlugin;
24
29
  //# 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,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"}
1
+ {"version":3,"file":"intlayerCracoPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerCracoPlugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACtB,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAK9D;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,oBAEnC,qBAAqB,KAAG,aAqB1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,kBAEjC,mBAAmB,KAAG,WA4CxB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;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.3.0",
3
+ "version": "5.3.2",
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": [
@@ -65,8 +65,8 @@
65
65
  "node-loader": "^2.1.0",
66
66
  "process": "^0.11.10",
67
67
  "webpack": "^5.97.1",
68
- "@intlayer/config": "5.3.0",
69
- "@intlayer/webpack": "5.3.0"
68
+ "@intlayer/config": "5.3.2",
69
+ "@intlayer/webpack": "5.3.2"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@craco/types": "^7.1.0",
@@ -81,16 +81,16 @@
81
81
  "tsc-alias": "^1.8.10",
82
82
  "tsup": "^8.3.5",
83
83
  "typescript": "^5.7.3",
84
+ "@intlayer/backend": "5.3.2",
84
85
  "@utils/ts-config": "1.0.4",
85
- "@intlayer/backend": "5.3.0",
86
86
  "@utils/ts-config-types": "1.0.4",
87
- "@utils/eslint-config": "1.0.4",
88
- "@utils/tsup-config": "1.0.4"
87
+ "@utils/tsup-config": "1.0.4",
88
+ "@utils/eslint-config": "1.0.4"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "webpack": ">=5.0.0",
92
- "@intlayer/config": "5.3.0",
93
- "@intlayer/webpack": "5.3.0"
92
+ "@intlayer/config": "5.3.2",
93
+ "@intlayer/webpack": "5.3.2"
94
94
  },
95
95
  "engines": {
96
96
  "node": ">=14.18"