@intlayer/webpack 8.6.0 → 8.6.2
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,9 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let
|
|
3
|
+
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
4
4
|
let _intlayer_config_node = require("@intlayer/config/node");
|
|
5
5
|
let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
|
|
6
6
|
let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
|
|
7
|
+
let _intlayer_config_colors = require("@intlayer/config/colors");
|
|
8
|
+
let _intlayer_config_envVars = require("@intlayer/config/envVars");
|
|
7
9
|
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
8
10
|
let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
9
11
|
|
|
@@ -16,10 +18,17 @@ var IntlayerPlugin = class {
|
|
|
16
18
|
}
|
|
17
19
|
async apply(compiler) {
|
|
18
20
|
const { webpack } = compiler;
|
|
19
|
-
const
|
|
21
|
+
const isBuild = compiler.options.mode !== "development";
|
|
22
|
+
const appLogger = (0, _intlayer_config_logger.getAppLogger)(this.configuration);
|
|
23
|
+
let dictionaryNodesVars = {};
|
|
24
|
+
if (isBuild) {
|
|
25
|
+
const unusedNodeTypes = await (0, _intlayer_config_utils.getUnusedNodeTypesAsync)((0, _intlayer_dictionaries_entry.getDictionaries)(this.configuration));
|
|
26
|
+
if (unusedNodeTypes.length > 0) appLogger(["Filtering out unused plugins:", unusedNodeTypes.map((key) => (0, _intlayer_config_logger.colorize)(key, _intlayer_config_colors.BLUE)).join(", ")], { isVerbose: true });
|
|
27
|
+
dictionaryNodesVars = (0, _intlayer_config_envVars.formatNodeTypeToEnvVar)(unusedNodeTypes, true);
|
|
28
|
+
}
|
|
20
29
|
new webpack.DefinePlugin({
|
|
21
|
-
|
|
22
|
-
...
|
|
30
|
+
...(0, _intlayer_config_envVars.getConfigEnvVars)(this.configuration, true),
|
|
31
|
+
...dictionaryNodesVars
|
|
23
32
|
}).apply(compiler);
|
|
24
33
|
if (this.configuration.content.watch) (0, _intlayer_chokidar_watcher.watch)({ configuration: this.configuration });
|
|
25
34
|
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
@@ -27,7 +36,7 @@ var IntlayerPlugin = class {
|
|
|
27
36
|
await (0, _intlayer_chokidar_build.prepareIntlayer)(this.configuration);
|
|
28
37
|
this.isWatching = true;
|
|
29
38
|
} catch (error) {
|
|
30
|
-
(
|
|
39
|
+
appLogger(`Error in IntlayerPlugin: ${error}`, { level: "error" });
|
|
31
40
|
}
|
|
32
41
|
});
|
|
33
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.cjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport {\n
|
|
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 { getUnusedNodeTypesAsync } 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 dictionaryNodesVars = {};\n\n if (isBuild) {\n const dictionaries = getDictionaries(this.configuration);\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n if (unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused plugins:',\n unusedNodeTypes.map((key) => colorize(key, BLUE)).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n dictionaryNodesVars = formatNodeTypeToEnvVar(unusedNodeTypes, true);\n }\n\n new webpack.DefinePlugin({\n ...getConfigEnvVars(this.configuration, true),\n ...dictionaryNodesVars,\n }).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":";;;;;;;;;;;;AAeA,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,sBAAsB,EAAE;AAE5B,MAAI,SAAS;GAEX,MAAM,kBAAkB,4GADa,KAAK,cAAc,CACW;AAEnE,OAAI,gBAAgB,SAAS,EAC3B,WACE,CACE,iCACA,gBAAgB,KAAK,8CAAiB,KAAKA,6BAAK,CAAC,CAAC,KAAK,KAAK,CAC7D,EACD,EACE,WAAW,MACZ,CACF;AAGH,8EAA6C,iBAAiB,KAAK;;AAGrE,MAAI,QAAQ,aAAa;GACvB,kDAAoB,KAAK,eAAe,KAAK;GAC7C,GAAG;GACJ,CAAC,CAAC,MAAM,SAAS;AAElB,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"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getUnusedNodeTypesAsync } from "@intlayer/config/utils";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config/node";
|
|
3
3
|
import { prepareIntlayer } from "@intlayer/chokidar/build";
|
|
4
4
|
import { watch } from "@intlayer/chokidar/watcher";
|
|
5
|
-
import {
|
|
5
|
+
import { BLUE } from "@intlayer/config/colors";
|
|
6
|
+
import { formatNodeTypeToEnvVar, getConfigEnvVars } from "@intlayer/config/envVars";
|
|
7
|
+
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
6
8
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
7
9
|
|
|
8
10
|
//#region src/webpack-plugin.ts
|
|
@@ -14,10 +16,17 @@ var IntlayerPlugin = class {
|
|
|
14
16
|
}
|
|
15
17
|
async apply(compiler) {
|
|
16
18
|
const { webpack } = compiler;
|
|
17
|
-
const
|
|
19
|
+
const isBuild = compiler.options.mode !== "development";
|
|
20
|
+
const appLogger = getAppLogger(this.configuration);
|
|
21
|
+
let dictionaryNodesVars = {};
|
|
22
|
+
if (isBuild) {
|
|
23
|
+
const unusedNodeTypes = await getUnusedNodeTypesAsync(getDictionaries(this.configuration));
|
|
24
|
+
if (unusedNodeTypes.length > 0) appLogger(["Filtering out unused plugins:", unusedNodeTypes.map((key) => colorize(key, BLUE)).join(", ")], { isVerbose: true });
|
|
25
|
+
dictionaryNodesVars = formatNodeTypeToEnvVar(unusedNodeTypes, true);
|
|
26
|
+
}
|
|
18
27
|
new webpack.DefinePlugin({
|
|
19
|
-
|
|
20
|
-
...
|
|
28
|
+
...getConfigEnvVars(this.configuration, true),
|
|
29
|
+
...dictionaryNodesVars
|
|
21
30
|
}).apply(compiler);
|
|
22
31
|
if (this.configuration.content.watch) watch({ configuration: this.configuration });
|
|
23
32
|
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
@@ -25,7 +34,7 @@ var IntlayerPlugin = class {
|
|
|
25
34
|
await prepareIntlayer(this.configuration);
|
|
26
35
|
this.isWatching = true;
|
|
27
36
|
} catch (error) {
|
|
28
|
-
|
|
37
|
+
appLogger(`Error in IntlayerPlugin: ${error}`, { level: "error" });
|
|
29
38
|
}
|
|
30
39
|
});
|
|
31
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport {\n
|
|
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 { getUnusedNodeTypesAsync } 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 dictionaryNodesVars = {};\n\n if (isBuild) {\n const dictionaries = getDictionaries(this.configuration);\n const unusedNodeTypes = await getUnusedNodeTypesAsync(dictionaries);\n\n if (unusedNodeTypes.length > 0) {\n appLogger(\n [\n 'Filtering out unused plugins:',\n unusedNodeTypes.map((key) => colorize(key, BLUE)).join(', '),\n ],\n {\n isVerbose: true,\n }\n );\n }\n\n dictionaryNodesVars = formatNodeTypeToEnvVar(unusedNodeTypes, true);\n }\n\n new webpack.DefinePlugin({\n ...getConfigEnvVars(this.configuration, true),\n ...dictionaryNodesVars,\n }).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":";;;;;;;;;;AAeA,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,sBAAsB,EAAE;AAE5B,MAAI,SAAS;GAEX,MAAM,kBAAkB,MAAM,wBADT,gBAAgB,KAAK,cAAc,CACW;AAEnE,OAAI,gBAAgB,SAAS,EAC3B,WACE,CACE,iCACA,gBAAgB,KAAK,QAAQ,SAAS,KAAK,KAAK,CAAC,CAAC,KAAK,KAAK,CAC7D,EACD,EACE,WAAW,MACZ,CACF;AAGH,yBAAsB,uBAAuB,iBAAiB,KAAK;;AAGrE,MAAI,QAAQ,aAAa;GACvB,GAAG,iBAAiB,KAAK,eAAe,KAAK;GAC7C,GAAG;GACJ,CAAC,CAAC,MAAM,SAAS;AAElB,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":";;;;cAea,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.2",
|
|
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,9 +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/
|
|
80
|
+
"@intlayer/chokidar": "8.6.2",
|
|
81
|
+
"@intlayer/config": "8.6.2",
|
|
82
|
+
"@intlayer/dictionaries-entry": "8.6.2",
|
|
83
|
+
"@intlayer/types": "8.6.2",
|
|
83
84
|
"fast-glob": "3.3.3",
|
|
84
85
|
"webpack": "5.105.4",
|
|
85
86
|
"webpack-dev-server": "5.2.3"
|
|
@@ -95,7 +96,7 @@
|
|
|
95
96
|
"vitest": "4.1.2"
|
|
96
97
|
},
|
|
97
98
|
"peerDependencies": {
|
|
98
|
-
"webpack": "5.
|
|
99
|
+
"webpack": "^5.0.0"
|
|
99
100
|
},
|
|
100
101
|
"engines": {
|
|
101
102
|
"node": ">=14.18"
|