react-scripts-intlayer 8.9.7 → 8.9.8

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 +1 @@
1
- {"version":3,"file":"react-scripts-intlayer.cjs","names":[],"sources":["../../../src/cli/react-scripts-intlayer.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * To make the setup easier, we are using craco to override the webpack configuration.\n * This script is used to run the craco scripts with the custom configuration.\n *\n * The script is based on the original craco script from create-react-app.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport { logger } from '@intlayer/config/logger';\nimport { getProjectRequire } from '@intlayer/config/utils';\n\nconst args = process.argv.slice(2);\nconst scriptIndex = args.findIndex(\n (index) => index === 'build' || index === 'start' || index === 'test'\n);\nconst script = scriptIndex === -1 ? args[0] : args[scriptIndex];\n\nswitch (script) {\n case 'build':\n case 'start':\n case 'test': {\n const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];\n const scriptPath = getProjectRequire().resolve(\n `@craco/craco/dist/scripts/${script}`\n );\n\n const scriptArgs = args.slice(scriptIndex + 1);\n const processArgs = nodeArgs\n .concat(scriptPath)\n .concat([\n ...scriptArgs,\n '--config',\n './node_modules/react-scripts-intlayer/dist/cjs/craco.config.cjs',\n ]);\n\n const child = spawnSync('node', processArgs, {\n stdio: 'inherit',\n });\n\n if (child.signal) {\n if (child.signal === 'SIGKILL') {\n logger(`\n The build failed because the process exited too early.\n This probably means the system ran out of memory or someone called\n \\`kill -9\\` on the process.\n `);\n } else if (child.signal === 'SIGTERM') {\n logger(`\n The build failed because the process exited too early.\n Someone might have called \\`kill\\` or \\`killall\\`, or the system could\n be shutting down.\n `);\n }\n\n process.exit(1);\n }\n\n process.exit(child.status ?? undefined);\n break;\n }\n default:\n logger(`Unknown script \"${script}\".`);\n logger('Perhaps you need to update craco?');\n break;\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,OAAO,QAAQ,KAAK,MAAM,EAAE;AAClC,MAAM,cAAc,KAAK,WACtB,UAAU,UAAU,WAAW,UAAU,WAAW,UAAU,OAChE;AACD,MAAM,SAAS,gBAAgB,KAAK,KAAK,KAAK,KAAK;AAEnD,QAAQ,QAAR;CACE,KAAK;CACL,KAAK;CACL,KAAK,QAAQ;EACX,MAAM,WAAW,cAAc,IAAI,KAAK,MAAM,GAAG,YAAY,GAAG,EAAE;EAClE,MAAM,4DAAgC,CAAC,QACrC,6BAA6B,SAC9B;EAED,MAAM,aAAa,KAAK,MAAM,cAAc,EAAE;EAS9C,MAAM,0CAAkB,QARJ,SACjB,OAAO,WAAW,CAClB,OAAO;GACN,GAAG;GACH;GACA;GACD,CAEwC,EAAE,EAC3C,OAAO,WACR,CAAC;EAEF,IAAI,MAAM,QAAQ;GAChB,IAAI,MAAM,WAAW,WACnB,oCAAO;;;;cAID;QACD,IAAI,MAAM,WAAW,WAC1B,oCAAO;;;;cAID;GAGR,QAAQ,KAAK,EAAE;;EAGjB,QAAQ,KAAK,MAAM,UAAU,OAAU;EACvC;;CAEF;EACE,oCAAO,mBAAmB,OAAO,IAAI;EACrC,oCAAO,oCAAoC;EAC3C"}
1
+ {"version":3,"file":"react-scripts-intlayer.cjs","names":[],"sources":["../../../src/cli/react-scripts-intlayer.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * To make the setup easier, we are using craco to override the webpack configuration.\n * This script is used to run the craco scripts with the custom configuration.\n *\n * The script is based on the original craco script from create-react-app.\n */\n\nimport { spawnSync } from 'node:child_process';\nimport { logger } from '@intlayer/config/logger';\nimport { getProjectRequire } from '@intlayer/config/utils';\n\nconst args = process.argv.slice(2);\nconst scriptIndex = args.findIndex(\n (index) => index === 'build' || index === 'start' || index === 'test'\n);\nconst script = scriptIndex === -1 ? args[0] : args[scriptIndex];\n\nswitch (script) {\n case 'build':\n case 'start':\n case 'test': {\n const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];\n const scriptPath = getProjectRequire().resolve(\n `@craco/craco/dist/scripts/${script}`\n );\n\n const scriptArgs = args.slice(scriptIndex + 1);\n const processArgs = nodeArgs\n .concat(scriptPath)\n .concat([\n ...scriptArgs,\n '--config',\n './node_modules/react-scripts-intlayer/dist/cjs/craco.config.cjs',\n ]);\n\n const child = spawnSync('node', processArgs, {\n stdio: 'inherit',\n });\n\n if (child.signal) {\n if (child.signal === 'SIGKILL') {\n logger(`\n The build failed because the process exited too early.\n This probably means the system ran out of memory or someone called\n \\`kill -9\\` on the process.\n `);\n } else if (child.signal === 'SIGTERM') {\n logger(`\n The build failed because the process exited too early.\n Someone might have called \\`kill\\` or \\`killall\\`, or the system could\n be shutting down.\n `);\n }\n\n process.exit(1);\n }\n\n process.exit(child.status ?? undefined);\n break;\n }\n default:\n logger(`Unknown script \"${script}\".`);\n logger('Perhaps you need to update craco?');\n break;\n}\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,MAAM,cAAc,KAAK,WACtB,UAAU,UAAU,WAAW,UAAU,WAAW,UAAU,MACjE;AACA,MAAM,SAAS,gBAAgB,KAAK,KAAK,KAAK,KAAK;AAEnD,QAAQ,QAAR;CACE,KAAK;CACL,KAAK;CACL,KAAK,QAAQ;EACX,MAAM,WAAW,cAAc,IAAI,KAAK,MAAM,GAAG,WAAW,IAAI,CAAC;EACjE,MAAM,2DAA+B,EAAE,QACrC,6BAA6B,QAC/B;EAEA,MAAM,aAAa,KAAK,MAAM,cAAc,CAAC;EAS7C,MAAM,0CAAkB,QARJ,SACjB,OAAO,UAAU,EACjB,OAAO;GACN,GAAG;GACH;GACA;EACF,CAEwC,GAAG,EAC3C,OAAO,UACT,CAAC;EAED,IAAI,MAAM,QAAQ;GAChB,IAAI,MAAM,WAAW,WACnB,oCAAO;;;;aAIF;QACA,IAAI,MAAM,WAAW,WAC1B,oCAAO;;;;aAIF;GAGP,QAAQ,KAAK,CAAC;EAChB;EAEA,QAAQ,KAAK,MAAM,UAAU,MAAS;EACtC;CACF;CACA;EACE,oCAAO,mBAAmB,OAAO,GAAG;EACpC,oCAAO,mCAAmC;EAC1C;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"craco.config.cjs","names":["intlayerCracoPlugin"],"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\nexport default cracoConfig;\n"],"mappings":";;;AAIA,MAAM,cAAc,EAClB,SAAS,CACP,EACE,QAAQA,iDACT,CACF,EACF"}
1
+ {"version":3,"file":"craco.config.cjs","names":["intlayerCracoPlugin"],"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\nexport default cracoConfig;\n"],"mappings":";;;AAIA,MAAM,cAAc,EAClB,SAAS,CACP,EACE,QAAQA,gDACV,CACF,EACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerCracoPlugin.cjs","names":["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';\nimport type { Configuration as WebpackConfig } from 'webpack';\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 * We explicitely type the return as WebpackConfig to solve TS2742.\n */\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\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 // We cast here to satisfy the internal function return type if there are minor discrepancies\n return webpackConfig as 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 // We cast to `any` here to bypass the strict version mismatch between\n // the 'webpack' package installed in your node_modules and the one expected by '@craco/types'\n overrideWebpackConfig: overrideWebpackConfig as any,\n};\n"],"mappings":";;;;;;;;AAcA,MAAM,8DAAmC;AAEzC,MAAM,6CAAiB;CACrB,eAAe;CACf,YAAY,8BAAuB,QAAQ,KAAK,EAAE,MAAM;CACzD,CAAC;;;;;AAMF,MAAa,yBAAyB,EACpC,oBAC0C;CAE1C,IAAI,OAAO,cAAc,cAAc,UACrC,cAAc,YAAY;EACxB,GAAG,cAAc;EACjB,SAAS;EACV;CAIH,cAAc,QAAQ,OAAO,KAAK;EAChC,MAAM;EACN,KAAK;EACN,CAAC;CAGF,OAAO;;;;;AAMT,MAAa,uBAAuB,EAClC,iCAGE,EACE,SAAS;CACP,SAAS,EAEP,KAAK,CACH,GAAI,YAAY,SAAS,SAAS,OAAO,EAAE,EAC3C,IAAIA,iCAAe,eAAe,CACnC,EACF;CAED;CACD,EACF,EACD,YACD;;;;;AAMH,MAAa,sBAAmC;CAC9C;CAGuB;CACxB"}
1
+ {"version":3,"file":"intlayerCracoPlugin.cjs","names":["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';\nimport type { Configuration as WebpackConfig } from 'webpack';\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 * We explicitely type the return as WebpackConfig to solve TS2742.\n */\nexport const overrideWebpackConfig = ({\n webpackConfig,\n}: WebpackConfigOverride): WebpackConfig => {\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 // We cast here to satisfy the internal function return type if there are minor discrepancies\n return webpackConfig as 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 // We cast to `any` here to bypass the strict version mismatch between\n // the 'webpack' package installed in your node_modules and the one expected by '@craco/types'\n overrideWebpackConfig: overrideWebpackConfig as any,\n};\n"],"mappings":";;;;;;;;AAcA,MAAM,6DAAkC;AAExC,MAAM,6CAAiB;CACrB,eAAe;CACf,YAAY,8BAAuB,QAAQ,IAAI,GAAG,KAAK;AACzD,CAAC;;;;;AAMD,MAAa,yBAAyB,EACpC,oBAC0C;CAE1C,IAAI,OAAO,cAAc,cAAc,UACrC,cAAc,YAAY;EACxB,GAAG,cAAc;EACjB,SAAS;CACX;CAIF,cAAc,QAAQ,OAAO,KAAK;EAChC,MAAM;EACN,KAAK;CACP,CAAC;CAGD,OAAO;AACT;;;;AAKA,MAAa,uBAAuB,EAClC,iCAGE,EACE,SAAS;CACP,SAAS,EAEP,KAAK,CACH,GAAI,YAAY,SAAS,SAAS,OAAO,CAAC,GAC1C,IAAIA,iCAAe,cAAc,CACnC,EACF;CAEA;AACF,EACF,GACA,WACF;;;;;AAMF,MAAa,sBAAmC;CAC9C;CAGuB;AACzB"}
@@ -1,9 +1,7 @@
1
- import * as _$_craco_types0 from "@craco/types";
2
-
3
1
  //#region src/craco.config.d.ts
4
2
  declare const cracoConfig: {
5
3
  plugins: {
6
- plugin: _$_craco_types0.CracoPlugin;
4
+ plugin: import("@craco/types").CracoPlugin;
7
5
  }[];
8
6
  };
9
7
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"craco.config.d.ts","names":[],"sources":["../../src/craco.config.ts"],"mappings":";;;cAIM,WAAA;;YAMiB,eAAA,CAAA,WAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"craco.config.d.ts","names":[],"sources":["../../src/craco.config.ts"],"mappings":";cAIM,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerCracoPlugin.d.ts","names":[],"sources":["../../src/intlayerCracoPlugin.ts"],"mappings":";;;;;;AAyBA;;cAAa,qBAAA;EAAyB;AAAA,GAEnC,qBAAA,KAAwB,aAAA;;;;cAsBd,mBAAA;EAAuB;AAAA,GAEjC,mBAAA,KAAsB,WAAA;;;;;cAsBZ,mBAAA,EAAqB,WAAA"}
1
+ {"version":3,"file":"intlayerCracoPlugin.d.ts","names":[],"sources":["../../src/intlayerCracoPlugin.ts"],"mappings":";;;;;;AAyBA;;cAAa,qBAAA;EAAyB;AAAA,GAEnC,qBAAA,KAAwB,aAAA;;;;cAsBd,mBAAA;EAAuB;AAAA,GAEjC,mBAAA,KAAsB,WAAA;;;;;cAsBZ,mBAAA,EAAqB,WAKjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-scripts-intlayer",
3
- "version": "8.9.7",
3
+ "version": "8.9.8",
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": [
@@ -79,9 +79,9 @@
79
79
  },
80
80
  "dependencies": {
81
81
  "@craco/craco": "7.1.0",
82
- "@intlayer/config": "8.9.7",
83
- "@intlayer/types": "8.9.7",
84
- "@intlayer/webpack": "8.9.7",
82
+ "@intlayer/config": "8.9.8",
83
+ "@intlayer/types": "8.9.8",
84
+ "@intlayer/webpack": "8.9.8",
85
85
  "defu": "6.1.7",
86
86
  "node-loader": "2.1.0",
87
87
  "process": "0.11.10",