react-scripts-intlayer 9.5.9 → 9.5.11

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.
@@ -15,7 +15,7 @@ const alias = (0, _intlayer_config_utils.getAlias)({
15
15
  * Override the final CRA Webpack config.
16
16
  */
17
17
  const overrideWebpackConfig = ({ webpackConfig }) => {
18
- if (typeof webpackConfig.externals === "object") webpackConfig.externals = {
18
+ if (webpackConfig.externals && typeof webpackConfig.externals === "object" && !Array.isArray(webpackConfig.externals)) webpackConfig.externals = {
19
19
  ...webpackConfig.externals,
20
20
  esbuild: "esbuild"
21
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerCracoPlugin.cjs","names":["getConfiguration","getAlias","join","IntlayerPlugin"],"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["import { join } from 'node:path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport { defu } from 'defu';\n\n/**\n * The webpack `Configuration` type exactly as CRACO hands it to us.\n *\n * Deliberately derived from `@craco/types` rather than imported from `webpack`:\n * the webpack copy CRACO resolves and the one this package resolves are two\n * distinct type identities whenever their versions differ, which makes any\n * conversion between them a compile error. Reusing CRACO's own type keeps a\n * single identity, and — being an indexed access on an imported type — it stays\n * nameable in the emitted declarations, avoiding TS2742.\n */\ntype CracoWebpackConfig = WebpackConfigOverride['webpackConfig'];\n\n// Get Intlayer configuration\nconst intlayerConfig = getConfiguration();\n\nconst alias = getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => join(process.cwd(), value),\n});\n\n/**\n * Override the final CRA Webpack config.\n */\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): CracoWebpackConfig => {\n // 1) Remove `module`, `fs`, `path`, `vm` from externals.\n if (typeof webpackConfig.externals === 'object') {\n webpackConfig.externals = {\n ...webpackConfig.externals,\n esbuild: 'esbuild',\n };\n }\n\n // 2) Properly push node-loader rule\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 defu(\n {\n webpack: {\n plugins: {\n // defu overwrites arrays by default, so we manually preserve existing plugins\n add: [\n ...(cracoConfig.webpack?.plugins?.add ?? []),\n new IntlayerPlugin(intlayerConfig),\n ],\n },\n // Automatically merges deeply with existing aliases\n alias,\n },\n },\n cracoConfig\n ) as CracoConfig;\n\n/**\n * A CRACO plugin that adds the Intlayer configuration to the webpack configuration\n * and sets the environment variables.\n */\nexport const intlayerCracoPlugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";;;;;;;;AAyBA,MAAM,qBAAiBA,wCAAiB;AAExC,MAAM,YAAQC,iCAAS;CACrB,eAAe;CACf,YAAY,cAAkBC,gBAAK,QAAQ,IAAI,GAAG,KAAK;AACzD,CAAC;;;;AAKD,MAAa,yBAAyB,EACpC,oBAC+C;CAE/C,IAAI,OAAO,cAAc,cAAc,UACrC,cAAc,YAAY;EACxB,GAAG,cAAc;EACjB,SAAS;CACX;CAIF,cAAc,QAAQ,OAAO,KAAK;EAChC,MAAM;EACN,KAAK;CACP,CAAC;CAED,OAAO;AACT;;;;AAKA,MAAa,uBAAuB,EAClC,sBAEA,WACE,EACE,SAAS;CACP,SAAS,EAEP,KAAK,CACH,GAAI,YAAY,SAAS,SAAS,OAAO,CAAC,GAC1C,IAAIC,iCAAe,cAAc,CACnC,EACF;CAEA;AACF,EACF,GACA,WACF;;;;;AAMF,MAAa,sBAAmC;CAC9C;CACA;AACF"}
1
+ {"version":3,"file":"intlayerCracoPlugin.cjs","names":["getConfiguration","getAlias","join","IntlayerPlugin"],"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["import { join } from 'node:path';\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getAlias } from '@intlayer/config/utils';\nimport { IntlayerPlugin } from '@intlayer/webpack';\nimport { defu } from 'defu';\n\n/**\n * The webpack `Configuration` type exactly as CRACO hands it to us.\n *\n * Deliberately derived from `@craco/types` rather than imported from `webpack`:\n * the webpack copy CRACO resolves and the one this package resolves are two\n * distinct type identities whenever their versions differ, which makes any\n * conversion between them a compile error. Reusing CRACO's own type keeps a\n * single identity, and — being an indexed access on an imported type — it stays\n * nameable in the emitted declarations, avoiding TS2742.\n */\ntype CracoWebpackConfig = WebpackConfigOverride['webpackConfig'];\n\n// Get Intlayer configuration\nconst intlayerConfig = getConfiguration();\n\nconst alias = getAlias({\n configuration: intlayerConfig,\n formatter: (value: string) => join(process.cwd(), value),\n});\n\n/**\n * Override the final CRA Webpack config.\n */\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): CracoWebpackConfig => {\n // 1) Remove `module`, `fs`, `path`, `vm` from externals.\n if (\n webpackConfig.externals &&\n typeof webpackConfig.externals === 'object' &&\n !Array.isArray(webpackConfig.externals)\n ) {\n webpackConfig.externals = {\n ...(webpackConfig.externals as Record<string, unknown>),\n esbuild: 'esbuild',\n };\n }\n\n // 2) Properly push node-loader rule\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 defu(\n {\n webpack: {\n plugins: {\n // defu overwrites arrays by default, so we manually preserve existing plugins\n add: [\n ...(cracoConfig.webpack?.plugins?.add ?? []),\n new IntlayerPlugin(intlayerConfig),\n ],\n },\n // Automatically merges deeply with existing aliases\n alias,\n },\n },\n cracoConfig\n ) as CracoConfig;\n\n/**\n * A CRACO plugin that adds the Intlayer configuration to the webpack configuration\n * and sets the environment variables.\n */\nexport const intlayerCracoPlugin: CracoPlugin = {\n overrideCracoConfig,\n overrideWebpackConfig,\n};\n"],"mappings":";;;;;;;;AAyBA,MAAM,qBAAiBA,wCAAiB;AAExC,MAAM,YAAQC,iCAAS;CACrB,eAAe;CACf,YAAY,cAAkBC,gBAAK,QAAQ,IAAI,GAAG,KAAK;AACzD,CAAC;;;;AAKD,MAAa,yBAAyB,EACpC,oBAC+C;CAE/C,IACE,cAAc,aACd,OAAO,cAAc,cAAc,YACnC,CAAC,MAAM,QAAQ,cAAc,SAAS,GAEtC,cAAc,YAAY;EACxB,GAAI,cAAc;EAClB,SAAS;CACX;CAIF,cAAc,QAAQ,OAAO,KAAK;EAChC,MAAM;EACN,KAAK;CACP,CAAC;CAED,OAAO;AACT;;;;AAKA,MAAa,uBAAuB,EAClC,sBAEA,WACE,EACE,SAAS;CACP,SAAS,EAEP,KAAK,CACH,GAAI,YAAY,SAAS,SAAS,OAAO,CAAC,GAC1C,IAAIC,iCAAe,cAAc,CACnC,EACF;CAEA;AACF,EACF,GACA,WACF;;;;;AAMF,MAAa,sBAAmC;CAC9C;CACA;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerCracoPlugin.d.ts","names":[],"sources":["../../src/intlayerCracoPlugin.ts"],"mappings":";;;;;;;;;;;;KAsBK,qBAAqB;;;;qBAab,0BAAqB,iBAE/B,0BAAwB;;;;qBAqBd,wBAAmB,eAE7B,wBAAsB;;;;;qBAsBZ,qBAAqB"}
1
+ {"version":3,"file":"intlayerCracoPlugin.d.ts","names":[],"sources":["../../src/intlayerCracoPlugin.ts"],"mappings":";;;;;;;;;;;;KAsBK,qBAAqB;;;;qBAab,0BAAqB,iBAE/B,0BAAwB;;;;qBAyBd,wBAAmB,eAE7B,wBAAsB;;;;;qBAsBZ,qBAAqB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-scripts-intlayer",
3
- "version": "9.5.9",
3
+ "version": "9.5.11",
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": [
@@ -80,10 +80,10 @@
80
80
  },
81
81
  "dependencies": {
82
82
  "@craco/craco": "7.1.0",
83
- "@intlayer/config": "9.5.9",
84
- "@intlayer/engine": "9.5.9",
85
- "@intlayer/types": "9.5.9",
86
- "@intlayer/webpack": "9.5.9",
83
+ "@intlayer/config": "9.5.11",
84
+ "@intlayer/engine": "9.5.11",
85
+ "@intlayer/types": "9.5.11",
86
+ "@intlayer/webpack": "9.5.11",
87
87
  "defu": "6.1.7",
88
88
  "node-loader": "2.1.0",
89
89
  "process": "0.11.10"
@@ -99,7 +99,7 @@
99
99
  "rimraf": "6.1.3",
100
100
  "tsdown": "0.23.0",
101
101
  "typescript": "7.0.2",
102
- "vitest": "5.0.1"
102
+ "vitest": "5.0.2"
103
103
  },
104
104
  "peerDependencies": {
105
105
  "webpack": ">=5.0.0"