@intlayer/webpack 8.6.4 → 8.6.6
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.
|
@@ -20,16 +20,19 @@ var IntlayerPlugin = class {
|
|
|
20
20
|
const { webpack } = compiler;
|
|
21
21
|
const isBuild = compiler.options.mode !== "development";
|
|
22
22
|
const appLogger = (0, _intlayer_config_logger.getAppLogger)(this.configuration);
|
|
23
|
-
let
|
|
23
|
+
let env = {};
|
|
24
24
|
if (isBuild) {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
|
|
25
|
+
const dictionaries = (0, _intlayer_dictionaries_entry.getDictionaries)(this.configuration);
|
|
26
|
+
if (Object.keys(dictionaries).length === 0) appLogger("No dictionaries found. Please check your configuration.", { isVerbose: true });
|
|
27
|
+
const unusedNodeTypes = await (0, _intlayer_config_utils.getUnusedNodeTypesAsync)(dictionaries);
|
|
28
|
+
if (unusedNodeTypes && unusedNodeTypes.length > 0) appLogger(["Filtering out plugins:", unusedNodeTypes.map((key) => (0, _intlayer_config_logger.colorize)(key, _intlayer_config_colors.BLUE)).join(", ")], { isVerbose: true });
|
|
29
|
+
env = {
|
|
30
|
+
...env,
|
|
31
|
+
...(0, _intlayer_config_envVars.formatNodeTypeToEnvVar)(unusedNodeTypes),
|
|
32
|
+
...(0, _intlayer_config_envVars.getConfigEnvVars)(this.configuration)
|
|
33
|
+
};
|
|
28
34
|
}
|
|
29
|
-
new webpack.DefinePlugin(
|
|
30
|
-
...(0, _intlayer_config_envVars.getConfigEnvVars)(this.configuration, true),
|
|
31
|
-
...dictionaryNodesVars
|
|
32
|
-
}).apply(compiler);
|
|
35
|
+
new webpack.DefinePlugin(env).apply(compiler);
|
|
33
36
|
if (this.configuration.content.watch) (0, _intlayer_chokidar_watcher.watch)({ configuration: this.configuration });
|
|
34
37
|
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
35
38
|
if (!this.isWatching) try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.cjs","names":["BLUE"],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {
|
|
1
|
+
{"version":3,"file":"webpack-plugin.cjs","names":["BLUE"],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n getUnusedNodeTypes,\n getUnusedNodeTypesAsync,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Compiler } from 'webpack';\n\n// Watch mode or on time build\nexport class IntlayerPlugin {\n private isWatching = false; // Flag to ensure we only start the watcher after the first build\n private configuration;\n\n constructor(configuration?: IntlayerConfig) {\n this.configuration = configuration ?? getConfiguration();\n }\n\n async apply(compiler: Compiler): Promise<void> {\n const { webpack } = compiler;\n\n const isBuild = compiler.options.mode !== 'development';\n\n const appLogger = getAppLogger(this.configuration);\n\n let env: Record<string, string> = {};\n\n if (isBuild) {\n const dictionaries = getDictionaries(this.configuration);\n\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n if (unusedNodeTypes && unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out plugins:',\n unusedNodeTypes.map((key) => colorize(key, BLUE)).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n env = {\n ...env,\n\n // Tree shacking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes),\n\n // Tree shacking based on config\n ...getConfigEnvVars(this.configuration),\n };\n }\n\n new webpack.DefinePlugin(env).apply(compiler);\n\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: this.configuration });\n }\n\n compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => {\n if (!this.isWatching) {\n try {\n await prepareIntlayer(this.configuration);\n this.isWatching = true;\n } catch (error) {\n appLogger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,IAAa,iBAAb,MAA4B;CAC1B,AAAQ,aAAa;CACrB,AAAQ;CAER,YAAY,eAAgC;AAC1C,OAAK,gBAAgB,8DAAmC;;CAG1D,MAAM,MAAM,UAAmC;EAC7C,MAAM,EAAE,YAAY;EAEpB,MAAM,UAAU,SAAS,QAAQ,SAAS;EAE1C,MAAM,sDAAyB,KAAK,cAAc;EAElD,IAAI,MAA8B,EAAE;AAEpC,MAAI,SAAS;GACX,MAAM,iEAA+B,KAAK,cAAc;AAExD,OAAI,OAAO,KAAK,aAAa,CAAC,WAAW,EACvC,WAAU,2DAA2D,EACnE,WAAW,MACZ,CAAC;GAGJ,MAAM,kBAAkB,0DAA8B,aAAa;AAEnE,OAAI,mBAAmB,gBAAgB,SAAS,EAC9C,WACE,CACE,0BACA,gBAAgB,KAAK,8CAAiB,KAAKA,6BAAK,CAAC,CAAC,KAAK,KAAK,CAC7D,EACD,EACE,WAAW,MACZ,CACF;AAGH,SAAM;IACJ,GAAG;IAGH,wDAA0B,gBAAgB;IAG1C,kDAAoB,KAAK,cAAc;IACxC;;AAGH,MAAI,QAAQ,aAAa,IAAI,CAAC,MAAM,SAAS;AAE7C,MAAI,KAAK,cAAc,QAAQ,MAE7B,uCAAM,EAAE,eAAe,KAAK,eAAe,CAAC;AAG9C,WAAS,MAAM,cAAc,WAAW,kBAAkB,YAAY;AACpE,OAAI,CAAC,KAAK,WACR,KAAI;AACF,wDAAsB,KAAK,cAAc;AACzC,SAAK,aAAa;YACX,OAAO;AACd,cAAU,4BAA4B,SAAS,EAC7C,OAAO,SACR,CAAC;;IAGN"}
|
|
@@ -18,16 +18,19 @@ var IntlayerPlugin = class {
|
|
|
18
18
|
const { webpack } = compiler;
|
|
19
19
|
const isBuild = compiler.options.mode !== "development";
|
|
20
20
|
const appLogger = getAppLogger(this.configuration);
|
|
21
|
-
let
|
|
21
|
+
let env = {};
|
|
22
22
|
if (isBuild) {
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
|
|
23
|
+
const dictionaries = getDictionaries(this.configuration);
|
|
24
|
+
if (Object.keys(dictionaries).length === 0) appLogger("No dictionaries found. Please check your configuration.", { isVerbose: true });
|
|
25
|
+
const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);
|
|
26
|
+
if (unusedNodeTypes && unusedNodeTypes.length > 0) appLogger(["Filtering out plugins:", unusedNodeTypes.map((key) => colorize(key, BLUE)).join(", ")], { isVerbose: true });
|
|
27
|
+
env = {
|
|
28
|
+
...env,
|
|
29
|
+
...formatNodeTypeToEnvVar(unusedNodeTypes),
|
|
30
|
+
...getConfigEnvVars(this.configuration)
|
|
31
|
+
};
|
|
26
32
|
}
|
|
27
|
-
new webpack.DefinePlugin(
|
|
28
|
-
...getConfigEnvVars(this.configuration, true),
|
|
29
|
-
...dictionaryNodesVars
|
|
30
|
-
}).apply(compiler);
|
|
33
|
+
new webpack.DefinePlugin(env).apply(compiler);
|
|
31
34
|
if (this.configuration.content.watch) watch({ configuration: this.configuration });
|
|
32
35
|
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
33
36
|
if (!this.isWatching) try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {
|
|
1
|
+
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { BLUE } from '@intlayer/config/colors';\nimport {\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n getUnusedNodeTypes,\n getUnusedNodeTypesAsync,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Compiler } from 'webpack';\n\n// Watch mode or on time build\nexport class IntlayerPlugin {\n private isWatching = false; // Flag to ensure we only start the watcher after the first build\n private configuration;\n\n constructor(configuration?: IntlayerConfig) {\n this.configuration = configuration ?? getConfiguration();\n }\n\n async apply(compiler: Compiler): Promise<void> {\n const { webpack } = compiler;\n\n const isBuild = compiler.options.mode !== 'development';\n\n const appLogger = getAppLogger(this.configuration);\n\n let env: Record<string, string> = {};\n\n if (isBuild) {\n const dictionaries = getDictionaries(this.configuration);\n\n if (Object.keys(dictionaries).length === 0) {\n appLogger('No dictionaries found. Please check your configuration.', {\n isVerbose: true,\n });\n }\n\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n if (unusedNodeTypes && unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out plugins:',\n unusedNodeTypes.map((key) => colorize(key, BLUE)).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n env = {\n ...env,\n\n // Tree shacking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes),\n\n // Tree shacking based on config\n ...getConfigEnvVars(this.configuration),\n };\n }\n\n new webpack.DefinePlugin(env).apply(compiler);\n\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: this.configuration });\n }\n\n compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => {\n if (!this.isWatching) {\n try {\n await prepareIntlayer(this.configuration);\n this.isWatching = true;\n } catch (error) {\n appLogger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;AAkBA,IAAa,iBAAb,MAA4B;CAC1B,AAAQ,aAAa;CACrB,AAAQ;CAER,YAAY,eAAgC;AAC1C,OAAK,gBAAgB,iBAAiB,kBAAkB;;CAG1D,MAAM,MAAM,UAAmC;EAC7C,MAAM,EAAE,YAAY;EAEpB,MAAM,UAAU,SAAS,QAAQ,SAAS;EAE1C,MAAM,YAAY,aAAa,KAAK,cAAc;EAElD,IAAI,MAA8B,EAAE;AAEpC,MAAI,SAAS;GACX,MAAM,eAAe,gBAAgB,KAAK,cAAc;AAExD,OAAI,OAAO,KAAK,aAAa,CAAC,WAAW,EACvC,WAAU,2DAA2D,EACnE,WAAW,MACZ,CAAC;GAGJ,MAAM,kBAAkB,MAAM,wBAAwB,aAAa;AAEnE,OAAI,mBAAmB,gBAAgB,SAAS,EAC9C,WACE,CACE,0BACA,gBAAgB,KAAK,QAAQ,SAAS,KAAK,KAAK,CAAC,CAAC,KAAK,KAAK,CAC7D,EACD,EACE,WAAW,MACZ,CACF;AAGH,SAAM;IACJ,GAAG;IAGH,GAAG,uBAAuB,gBAAgB;IAG1C,GAAG,iBAAiB,KAAK,cAAc;IACxC;;AAGH,MAAI,QAAQ,aAAa,IAAI,CAAC,MAAM,SAAS;AAE7C,MAAI,KAAK,cAAc,QAAQ,MAE7B,OAAM,EAAE,eAAe,KAAK,eAAe,CAAC;AAG9C,WAAS,MAAM,cAAc,WAAW,kBAAkB,YAAY;AACpE,OAAI,CAAC,KAAK,WACR,KAAI;AACF,UAAM,gBAAgB,KAAK,cAAc;AACzC,SAAK,aAAa;YACX,OAAO;AACd,cAAU,4BAA4B,SAAS,EAC7C,OAAO,SACR,CAAC;;IAGN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.d.ts","names":[],"sources":["../../src/webpack-plugin.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"webpack-plugin.d.ts","names":[],"sources":["../../src/webpack-plugin.ts"],"mappings":";;;;cAkBa,cAAA;EAAA,QACH,UAAA;EAAA,QACA,aAAA;cAEI,aAAA,GAAgB,cAAA;EAItB,KAAA,CAAM,QAAA,EAAU,QAAA,GAAW,OAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/webpack",
|
|
3
|
-
"version": "8.6.
|
|
3
|
+
"version": "8.6.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Webpack plugin for seamless integration with Intlayer, enhancing JavaScript apps built with React, Next.js and more.",
|
|
6
6
|
"keywords": [
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"watch": "webpack --config ./webpack.config.ts --watch"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@intlayer/chokidar": "8.6.
|
|
81
|
-
"@intlayer/config": "8.6.
|
|
82
|
-
"@intlayer/dictionaries-entry": "8.6.
|
|
83
|
-
"@intlayer/types": "8.6.
|
|
80
|
+
"@intlayer/chokidar": "8.6.6",
|
|
81
|
+
"@intlayer/config": "8.6.6",
|
|
82
|
+
"@intlayer/dictionaries-entry": "8.6.6",
|
|
83
|
+
"@intlayer/types": "8.6.6",
|
|
84
84
|
"fast-glob": "3.3.3",
|
|
85
85
|
"webpack": "5.105.4",
|
|
86
86
|
"webpack-dev-server": "5.2.3"
|