react-scripts-intlayer 8.1.2 → 8.1.3-canary.0
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.
- package/dist/cjs/cli/react-scripts-intlayer.cjs +3 -42
- package/dist/cjs/cli/react-scripts-intlayer.cjs.map +1 -1
- package/dist/cjs/craco.config.cjs +1 -7
- package/dist/cjs/craco.config.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -6
- package/dist/cjs/intlayerCracoPlugin.cjs +1 -47
- package/dist/cjs/intlayerCracoPlugin.cjs.map +1 -1
- package/dist/types/intlayerCracoPlugin.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,50 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
let
|
|
3
|
-
let node_child_process = require("node:child_process");
|
|
4
|
-
|
|
5
|
-
//#region src/cli/react-scripts-intlayer.ts
|
|
6
|
-
/**
|
|
7
|
-
* To make the setup easier, we are using craco to override the webpack configuration.
|
|
8
|
-
* This script is used to run the craco scripts with the custom configuration.
|
|
9
|
-
*
|
|
10
|
-
* The script is based on the original craco script from create-react-app.
|
|
11
|
-
*/
|
|
12
|
-
const args = process.argv.slice(2);
|
|
13
|
-
const scriptIndex = args.findIndex((index) => index === "build" || index === "start" || index === "test");
|
|
14
|
-
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
|
|
15
|
-
switch (script) {
|
|
16
|
-
case "build":
|
|
17
|
-
case "start":
|
|
18
|
-
case "test": {
|
|
19
|
-
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
|
|
20
|
-
const scriptPath = (0, _intlayer_config.getProjectRequire)().resolve(`@craco/craco/dist/scripts/${script}`);
|
|
21
|
-
const scriptArgs = args.slice(scriptIndex + 1);
|
|
22
|
-
const child = (0, node_child_process.spawnSync)("node", nodeArgs.concat(scriptPath).concat([
|
|
23
|
-
...scriptArgs,
|
|
24
|
-
"--config",
|
|
25
|
-
"./node_modules/react-scripts-intlayer/dist/cjs/craco.config.cjs"
|
|
26
|
-
]), { stdio: "inherit" });
|
|
27
|
-
if (child.signal) {
|
|
28
|
-
if (child.signal === "SIGKILL") (0, _intlayer_config.logger)(`
|
|
2
|
+
let e=require(`@intlayer/config/utils`),t=require(`node:child_process`),n=require(`@intlayer/config/logger`);const r=process.argv.slice(2),i=r.findIndex(e=>e===`build`||e===`start`||e===`test`),a=i===-1?r[0]:r[i];switch(a){case`build`:case`start`:case`test`:{let o=i>0?r.slice(0,i):[],s=(0,e.getProjectRequire)().resolve(`@craco/craco/dist/scripts/${a}`),c=r.slice(i+1),l=(0,t.spawnSync)(`node`,o.concat(s).concat([...c,`--config`,`./node_modules/react-scripts-intlayer/dist/cjs/craco.config.cjs`]),{stdio:`inherit`});l.signal&&(l.signal===`SIGKILL`?(0,n.logger)(`
|
|
29
3
|
The build failed because the process exited too early.
|
|
30
4
|
This probably means the system ran out of memory or someone called
|
|
31
5
|
\`kill -9\` on the process.
|
|
32
|
-
`)
|
|
33
|
-
else if (child.signal === "SIGTERM") (0, _intlayer_config.logger)(`
|
|
6
|
+
`):l.signal===`SIGTERM`&&(0,n.logger)(`
|
|
34
7
|
The build failed because the process exited too early.
|
|
35
8
|
Someone might have called \`kill\` or \`killall\`, or the system could
|
|
36
9
|
be shutting down.
|
|
37
|
-
`);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
process.exit(child.status ?? void 0);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
default:
|
|
44
|
-
(0, _intlayer_config.logger)(`Unknown script "${script}".`);
|
|
45
|
-
(0, _intlayer_config.logger)("Perhaps you need to update craco?");
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
10
|
+
`),process.exit(1)),process.exit(l.status??void 0);break}default:(0,n.logger)(`Unknown script "${a}".`),(0,n.logger)(`Perhaps you need to update craco?`);break}
|
|
50
11
|
//# sourceMappingURL=react-scripts-intlayer.cjs.map
|
|
@@ -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 {
|
|
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":";6GAaA,MAAM,EAAO,QAAQ,KAAK,MAAM,EAAE,CAC5B,EAAc,EAAK,UACtB,GAAU,IAAU,SAAW,IAAU,SAAW,IAAU,OAChE,CACK,EAAS,IAAgB,GAAK,EAAK,GAAK,EAAK,GAEnD,OAAQ,EAAR,CACE,IAAK,QACL,IAAK,QACL,IAAK,OAAQ,CACX,IAAM,EAAW,EAAc,EAAI,EAAK,MAAM,EAAG,EAAY,CAAG,EAAE,CAC5D,GAAA,EAAA,EAAA,oBAAgC,CAAC,QACrC,6BAA6B,IAC9B,CAEK,EAAa,EAAK,MAAM,EAAc,EAAE,CASxC,GAAA,EAAA,EAAA,WAAkB,OARJ,EACjB,OAAO,EAAW,CAClB,OAAO,CACN,GAAG,EACH,WACA,kEACD,CAAC,CAEyC,CAC3C,MAAO,UACR,CAAC,CAEE,EAAM,SACJ,EAAM,SAAW,WACnB,EAAA,EAAA,QAAO;;;;cAID,CACG,EAAM,SAAW,YAC1B,EAAA,EAAA,QAAO;;;;cAID,CAGR,QAAQ,KAAK,EAAE,EAGjB,QAAQ,KAAK,EAAM,QAAU,IAAA,GAAU,CACvC,MAEF,SACE,EAAA,EAAA,QAAO,mBAAmB,EAAO,IAAI,EACrC,EAAA,EAAA,QAAO,oCAAoC,CAC3C"}
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
//#region src/craco.config.ts
|
|
4
|
-
const cracoConfig = { plugins: [{ plugin: require_intlayerCracoPlugin.intlayerCracoPlugin }] };
|
|
5
|
-
|
|
6
|
-
//#endregion
|
|
7
|
-
module.exports = cracoConfig;
|
|
1
|
+
const e={plugins:[{plugin:require(`./intlayerCracoPlugin.cjs`).intlayerCracoPlugin}]};module.exports=e;
|
|
8
2
|
//# sourceMappingURL=craco.config.cjs.map
|
|
@@ -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":"
|
|
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,EAAc,CAClB,QAAS,CACP,CACE,4CAAQA,oBACT,CACF,CACF"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_intlayerCracoPlugin = require('./intlayerCracoPlugin.cjs');
|
|
3
|
-
|
|
4
|
-
exports.intlayerCracoPlugin = require_intlayerCracoPlugin.intlayerCracoPlugin;
|
|
5
|
-
exports.overrideCracoConfig = require_intlayerCracoPlugin.overrideCracoConfig;
|
|
6
|
-
exports.overrideWebpackConfig = require_intlayerCracoPlugin.overrideWebpackConfig;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./intlayerCracoPlugin.cjs`);exports.intlayerCracoPlugin=e.intlayerCracoPlugin,exports.overrideCracoConfig=e.overrideCracoConfig,exports.overrideWebpackConfig=e.overrideWebpackConfig;
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
let node_path = require("node:path");
|
|
3
|
-
let _intlayer_config = require("@intlayer/config");
|
|
4
|
-
let _intlayer_webpack = require("@intlayer/webpack");
|
|
5
|
-
let defu = require("defu");
|
|
6
|
-
|
|
7
|
-
//#region src/intlayerCracoPlugin.ts
|
|
8
|
-
const intlayerConfig = (0, _intlayer_config.getConfiguration)();
|
|
9
|
-
const alias = (0, _intlayer_config.getAlias)({
|
|
10
|
-
configuration: intlayerConfig,
|
|
11
|
-
formatter: (value) => (0, node_path.join)(process.cwd(), value)
|
|
12
|
-
});
|
|
13
|
-
/**
|
|
14
|
-
* Override the final CRA Webpack config.
|
|
15
|
-
* We explicitely type the return as WebpackConfig to solve TS2742.
|
|
16
|
-
*/
|
|
17
|
-
const overrideWebpackConfig = ({ webpackConfig }) => {
|
|
18
|
-
if (typeof webpackConfig.externals === "object") webpackConfig.externals = {
|
|
19
|
-
...webpackConfig.externals,
|
|
20
|
-
esbuild: "esbuild"
|
|
21
|
-
};
|
|
22
|
-
webpackConfig.module?.rules?.push({
|
|
23
|
-
test: /\.node$/,
|
|
24
|
-
use: "node-loader"
|
|
25
|
-
});
|
|
26
|
-
return webpackConfig;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Override the CRACO config itself to set up aliases, fallbacks, and plugins.
|
|
30
|
-
*/
|
|
31
|
-
const overrideCracoConfig = ({ cracoConfig }) => (0, defu.defu)({ webpack: {
|
|
32
|
-
plugins: { add: [...cracoConfig.webpack?.plugins?.add ?? [], new _intlayer_webpack.IntlayerPlugin(intlayerConfig)] },
|
|
33
|
-
alias
|
|
34
|
-
} }, cracoConfig);
|
|
35
|
-
/**
|
|
36
|
-
* A CRACO plugin that adds the Intlayer configuration to the webpack configuration
|
|
37
|
-
* and sets the environment variables.
|
|
38
|
-
*/
|
|
39
|
-
const intlayerCracoPlugin = {
|
|
40
|
-
overrideCracoConfig,
|
|
41
|
-
overrideWebpackConfig
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.intlayerCracoPlugin = intlayerCracoPlugin;
|
|
46
|
-
exports.overrideCracoConfig = overrideCracoConfig;
|
|
47
|
-
exports.overrideWebpackConfig = overrideWebpackConfig;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`node:path`),t=require(`@intlayer/config/node`),n=require(`@intlayer/config/utils`),r=require(`@intlayer/webpack`),i=require(`defu`);const a=(0,t.getConfiguration)(),o=(0,n.getAlias)({configuration:a,formatter:t=>(0,e.join)(process.cwd(),t)}),s=({webpackConfig:e})=>(typeof e.externals==`object`&&(e.externals={...e.externals,esbuild:`esbuild`}),e.module?.rules?.push({test:/\.node$/,use:`node-loader`}),e),c=({cracoConfig:e})=>(0,i.defu)({webpack:{plugins:{add:[...e.webpack?.plugins?.add??[],new r.IntlayerPlugin(a)]},alias:o}},e),l={overrideCracoConfig:c,overrideWebpackConfig:s};exports.intlayerCracoPlugin=l,exports.overrideCracoConfig=c,exports.overrideWebpackConfig=s;
|
|
48
2
|
//# sourceMappingURL=intlayerCracoPlugin.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerCracoPlugin.cjs","names":["IntlayerWebpackPlugin"],"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 {
|
|
1
|
+
{"version":3,"file":"intlayerCracoPlugin.cjs","names":["IntlayerWebpackPlugin"],"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 as IntlayerWebpackPlugin } 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 IntlayerWebpackPlugin(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":"sNAcA,MAAM,GAAA,EAAA,EAAA,mBAAmC,CAEnC,GAAA,EAAA,EAAA,UAAiB,CACrB,cAAe,EACf,UAAY,IAAA,EAAA,EAAA,MAAuB,QAAQ,KAAK,CAAE,EAAM,CACzD,CAAC,CAMW,GAAyB,CACpC,oBAGI,OAAO,EAAc,WAAc,WACrC,EAAc,UAAY,CACxB,GAAG,EAAc,UACjB,QAAS,UACV,EAIH,EAAc,QAAQ,OAAO,KAAK,CAChC,KAAM,UACN,IAAK,cACN,CAAC,CAGK,GAMI,GAAuB,CAClC,kBAAA,EAAA,EAAA,MAGE,CACE,QAAS,CACP,QAAS,CAEP,IAAK,CACH,GAAI,EAAY,SAAS,SAAS,KAAO,EAAE,CAC3C,IAAIA,EAAAA,eAAsB,EAAe,CAC1C,CACF,CAED,QACD,CACF,CACD,EACD,CAMU,EAAmC,CAC9C,sBAGuB,wBACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerCracoPlugin.d.ts","names":[],"sources":["../../src/intlayerCracoPlugin.ts"],"mappings":";;;;;;
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-scripts-intlayer",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.3-canary.0",
|
|
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,9 +80,9 @@
|
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@craco/craco": "7.1.0",
|
|
83
|
-
"@intlayer/config": "8.1.
|
|
84
|
-
"@intlayer/types": "8.1.
|
|
85
|
-
"@intlayer/webpack": "8.1.
|
|
83
|
+
"@intlayer/config": "8.1.3-canary.0",
|
|
84
|
+
"@intlayer/types": "8.1.3-canary.0",
|
|
85
|
+
"@intlayer/webpack": "8.1.3-canary.0",
|
|
86
86
|
"defu": "6.1.4",
|
|
87
87
|
"node-loader": "2.1.0",
|
|
88
88
|
"process": "0.11.10",
|