react-scripts-intlayer 6.1.5 → 6.1.6-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.
|
@@ -25,7 +25,6 @@ __export(intlayerCracoPlugin_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(intlayerCracoPlugin_exports);
|
|
26
26
|
var import_config = require("@intlayer/config");
|
|
27
27
|
var import_webpack = require("@intlayer/webpack");
|
|
28
|
-
var import_path = require("path");
|
|
29
28
|
const intlayerConfig = (0, import_config.getConfiguration)();
|
|
30
29
|
const overrideWebpackConfig = ({
|
|
31
30
|
webpackConfig
|
|
@@ -48,11 +47,6 @@ const overrideWebpackConfig = ({
|
|
|
48
47
|
const overrideCracoConfig = ({
|
|
49
48
|
cracoConfig
|
|
50
49
|
}) => {
|
|
51
|
-
const { mainDir, baseDir, configDir } = intlayerConfig.content;
|
|
52
|
-
const dictionariesPath = (0, import_path.join)(mainDir, "dictionaries.mjs");
|
|
53
|
-
const relativeDictionariesPath = (0, import_path.relative)(baseDir, dictionariesPath);
|
|
54
|
-
const configurationPath = (0, import_path.join)(configDir, "configuration.json");
|
|
55
|
-
const relativeConfigurationPath = (0, import_path.relative)(baseDir, configurationPath);
|
|
56
50
|
return {
|
|
57
51
|
...cracoConfig,
|
|
58
52
|
webpack: {
|
|
@@ -84,8 +78,7 @@ const overrideCracoConfig = ({
|
|
|
84
78
|
alias: {
|
|
85
79
|
...cracoConfig.webpack?.alias,
|
|
86
80
|
...(0, import_config.getAlias)({
|
|
87
|
-
configuration: intlayerConfig
|
|
88
|
-
formatter: (value) => resolve(value)
|
|
81
|
+
configuration: intlayerConfig
|
|
89
82
|
})
|
|
90
83
|
}
|
|
91
84
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// craco-intlayer-plugin.ts\n\n// @ts-nocheck\n\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { ESMxCJSRequire, getAlias, getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin as IntlayerWebpackPlugin } from '@intlayer/webpack';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// craco-intlayer-plugin.ts\n\n// @ts-nocheck\n\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { ESMxCJSRequire, getAlias, getConfiguration } 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 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 ...getAlias({\n configuration: intlayerConfig,\n }),\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;AAUA,oBAA2D;AAC3D,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,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,OAAG,wBAAS;AAAA,UACV,eAAe;AAAA,QACjB,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACF;AAmBO,MAAM,sBAAmC;AAAA,EAC9C;AAAA,EACA;AACF;","names":["IntlayerWebpackPlugin"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import "./chunk-ZD7AOCMD.mjs";
|
|
2
2
|
import { ESMxCJSRequire, getAlias, getConfiguration } from "@intlayer/config";
|
|
3
3
|
import { IntlayerPlugin as IntlayerWebpackPlugin } from "@intlayer/webpack";
|
|
4
|
-
import { join, relative } from "path";
|
|
5
4
|
const intlayerConfig = getConfiguration();
|
|
6
5
|
const overrideWebpackConfig = ({
|
|
7
6
|
webpackConfig
|
|
@@ -24,11 +23,6 @@ const overrideWebpackConfig = ({
|
|
|
24
23
|
const overrideCracoConfig = ({
|
|
25
24
|
cracoConfig
|
|
26
25
|
}) => {
|
|
27
|
-
const { mainDir, baseDir, configDir } = intlayerConfig.content;
|
|
28
|
-
const dictionariesPath = join(mainDir, "dictionaries.mjs");
|
|
29
|
-
const relativeDictionariesPath = relative(baseDir, dictionariesPath);
|
|
30
|
-
const configurationPath = join(configDir, "configuration.json");
|
|
31
|
-
const relativeConfigurationPath = relative(baseDir, configurationPath);
|
|
32
26
|
return {
|
|
33
27
|
...cracoConfig,
|
|
34
28
|
webpack: {
|
|
@@ -60,8 +54,7 @@ const overrideCracoConfig = ({
|
|
|
60
54
|
alias: {
|
|
61
55
|
...cracoConfig.webpack?.alias,
|
|
62
56
|
...getAlias({
|
|
63
|
-
configuration: intlayerConfig
|
|
64
|
-
formatter: (value) => resolve(value)
|
|
57
|
+
configuration: intlayerConfig
|
|
65
58
|
})
|
|
66
59
|
}
|
|
67
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// craco-intlayer-plugin.ts\n\n// @ts-nocheck\n\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { ESMxCJSRequire, getAlias, getConfiguration } from '@intlayer/config';\nimport { IntlayerPlugin as IntlayerWebpackPlugin } from '@intlayer/webpack';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/intlayerCracoPlugin.ts"],"sourcesContent":["// craco-intlayer-plugin.ts\n\n// @ts-nocheck\n\nimport type {\n CracoConfig,\n CracoConfigOverride,\n CracoPlugin,\n WebpackConfigOverride,\n} from '@craco/types';\nimport { ESMxCJSRequire, getAlias, getConfiguration } 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 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 ...getAlias({\n configuration: intlayerConfig,\n }),\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":";AAUA,SAAS,gBAAgB,UAAU,wBAAwB;AAC3D,SAAS,kBAAkB,6BAA6B;AAIxD,MAAM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-1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intlayerCracoPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerCracoPlugin.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACtB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"intlayerCracoPlugin.d.ts","sourceRoot":"","sources":["../../src/intlayerCracoPlugin.ts"],"names":[],"mappings":"AAIA,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,WAqCxB,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": "6.1.
|
|
3
|
+
"version": "6.1.6-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": [
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"node-loader": "^2.1.0",
|
|
66
66
|
"process": "^0.11.10",
|
|
67
67
|
"webpack": "^5.98.0",
|
|
68
|
-
"@intlayer/config": "6.1.
|
|
69
|
-
"@intlayer/webpack": "6.1.
|
|
68
|
+
"@intlayer/config": "6.1.6-canary.0",
|
|
69
|
+
"@intlayer/webpack": "6.1.6-canary.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@craco/types": "^7.1.0",
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
"typescript": "^5.9.2",
|
|
84
84
|
"vitest": "^3.2.4",
|
|
85
85
|
"@utils/eslint-config": "1.0.4",
|
|
86
|
-
"@utils/ts-config
|
|
86
|
+
"@utils/ts-config": "1.0.4",
|
|
87
87
|
"@utils/tsup-config": "1.0.4",
|
|
88
|
-
"@utils/ts-config": "1.0.4"
|
|
88
|
+
"@utils/ts-config-types": "1.0.4"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"webpack": ">=5.0.0",
|
|
92
|
-
"@intlayer/config": "6.1.
|
|
93
|
-
"@intlayer/webpack": "6.1.
|
|
92
|
+
"@intlayer/config": "6.1.6-canary.0",
|
|
93
|
+
"@intlayer/webpack": "6.1.6-canary.0"
|
|
94
94
|
},
|
|
95
95
|
"engines": {
|
|
96
96
|
"node": ">=14.18"
|