@intlayer/webpack 9.0.0-canary.11 → 9.0.0-canary.12
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/getEntries.cjs +4 -4
- package/dist/cjs/getEntries.cjs.map +1 -1
- package/dist/cjs/webpack-plugin.cjs +4 -4
- package/dist/cjs/webpack-plugin.cjs.map +1 -1
- package/dist/esm/getEntries.mjs +2 -2
- package/dist/esm/getEntries.mjs.map +1 -1
- package/dist/esm/webpack-plugin.mjs +2 -2
- package/dist/esm/webpack-plugin.mjs.map +1 -1
- package/package.json +5 -5
package/dist/cjs/getEntries.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
3
|
+
let _intlayer_engine_listDictionaries = require("@intlayer/engine/listDictionaries");
|
|
4
|
+
let _intlayer_engine_utils = require("@intlayer/engine/utils");
|
|
5
5
|
|
|
6
6
|
//#region src/getEntries.ts
|
|
7
7
|
const getEntries = async (configuration) => {
|
|
8
|
-
return (await (0,
|
|
9
|
-
const hash = (0,
|
|
8
|
+
return (await (0, _intlayer_engine_listDictionaries.listDictionaries)(configuration)).reduce((obj, el) => {
|
|
9
|
+
const hash = (0, _intlayer_engine_utils.getPathHash)(el);
|
|
10
10
|
obj[`intlayer-content/${hash}`] = {
|
|
11
11
|
import: el,
|
|
12
12
|
dependOn: void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntries.cjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"getEntries.cjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/engine/listDictionaries';\nimport { getPathHash } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { EntryObject } from 'webpack';\n\nexport const getEntries = async (\n configuration: IntlayerConfig\n): Promise<EntryObject> => {\n const files = await listDictionaries(configuration);\n\n return files.reduce((obj, el) => {\n const hash = getPathHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n};\n"],"mappings":";;;;;;AAKA,MAAa,aAAa,OACxB,kBACyB;AAGzB,SAAO,8DAF8B,cAAc,EAEtC,QAAQ,KAAK,OAAO;EAC/B,MAAM,+CAAmB,GAAG;AAE5B,MAAI,oBAAoB,UAAU;GAChC,QAAQ;GACR,UAAU;GACX;AAED,SAAO;IACN,EAAE,CAAgB"}
|
|
@@ -2,12 +2,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
4
4
|
let _intlayer_config_node = require("@intlayer/config/node");
|
|
5
|
-
let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
|
|
6
|
-
let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
|
|
7
5
|
let _intlayer_config_colors = require("@intlayer/config/colors");
|
|
8
6
|
let _intlayer_config_envVars = require("@intlayer/config/envVars");
|
|
9
7
|
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
10
8
|
let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
|
|
9
|
+
let _intlayer_engine_build = require("@intlayer/engine/build");
|
|
10
|
+
let _intlayer_engine_watcher = require("@intlayer/engine/watcher");
|
|
11
11
|
|
|
12
12
|
//#region src/webpack-plugin.ts
|
|
13
13
|
var IntlayerPlugin = class {
|
|
@@ -38,10 +38,10 @@ var IntlayerPlugin = class {
|
|
|
38
38
|
"process.env": "({})",
|
|
39
39
|
...env
|
|
40
40
|
}).apply(compiler);
|
|
41
|
-
if (this.configuration.content.watch) await (0,
|
|
41
|
+
if (this.configuration.content.watch) await (0, _intlayer_engine_watcher.watch)({ configuration: this.configuration });
|
|
42
42
|
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
43
43
|
if (!this.isWatching) try {
|
|
44
|
-
await (0,
|
|
44
|
+
await (0, _intlayer_engine_build.prepareIntlayer)(this.configuration);
|
|
45
45
|
this.isWatching = true;
|
|
46
46
|
} catch (error) {
|
|
47
47
|
appLogger(`Error in IntlayerPlugin: ${error}`, { level: "error" });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.cjs","names":["BLUE"],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"webpack-plugin.cjs","names":["BLUE"],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { BLUE } from '@intlayer/config/colors';\nimport {\n formatDictionarySelectorEnvVar,\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n getHasDictionarySelector,\n getUnusedNodeTypesAsync,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { watch } from '@intlayer/engine/watcher';\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 const wrapKey = (key: string) => `process.env.${key}`;\n const wrapValue = (value: string) => `\"${value}\"`;\n\n // Specific `process.env.<KEY>` defines. webpack's DefinePlugin replaces both\n // the dot- and bracket-notation reads of a defined key, and — crucially —\n // folds them at *parse* time, which lets it dead-code-eliminate the guarded\n // dynamic `import()` chunks (e.g. the HTML/markdown renderers) for unused\n // node types. The config flags are emitted in every mode so routing/editor\n // behaviour is correct in dev too; the dictionary scan (used to prune node\n // types) only runs for production builds.\n let env: Record<string, string> = {\n ...getConfigEnvVars(this.configuration, wrapKey, wrapValue),\n };\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 shaking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes, wrapKey, wrapValue),\n\n // Tree shaking the dictionary selector logic\n // (collections / variants)\n ...formatDictionarySelectorEnvVar(\n getHasDictionarySelector(dictionaries),\n wrapKey,\n wrapValue\n ),\n };\n }\n\n new webpack.DefinePlugin({\n // Catch-all so that any `process.env.*` read NOT folded by the specific\n // keys below still resolves to `undefined` instead of dereferencing a\n // bare `process`, which is not defined in browser bundles (e.g. Angular)\n // and throws `process is not defined`. This covers in-use node types\n // (never emitted as \"false\"), the dictionary selector when present, and\n // every read in development where the dictionary scan is skipped. Specific\n // keys (below) and host bundler defines (e.g. `process.env.NODE_ENV`) take\n // precedence over this object, so chunk-level tree shaking is preserved.\n 'process.env': '({})',\n ...env,\n }).apply(compiler);\n\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n await 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":";;;;;;;;;;;;AAmBA,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,MAAM,WAAW,QAAgB,eAAe;EAChD,MAAM,aAAa,UAAkB,IAAI,MAAM;EAS/C,IAAI,MAA8B,EAChC,kDAAoB,KAAK,eAAe,SAAS,UAAU,EAC5D;AAED,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,iBAAiB,SAAS,UAAU;IAI9D,qHAC2B,aAAa,EACtC,SACA,UACD;IACF;;AAGH,MAAI,QAAQ,aAAa;GASvB,eAAe;GACf,GAAG;GACJ,CAAC,CAAC,MAAM,SAAS;AAElB,MAAI,KAAK,cAAc,QAAQ,MAE7B,2CAAY,EAAE,eAAe,KAAK,eAAe,CAAC;AAGpD,WAAS,MAAM,cAAc,WAAW,kBAAkB,YAAY;AACpE,OAAI,CAAC,KAAK,WACR,KAAI;AACF,sDAAsB,KAAK,cAAc;AACzC,SAAK,aAAa;YACX,OAAO;AACd,cAAU,4BAA4B,SAAS,EAC7C,OAAO,SACR,CAAC;;IAGN"}
|
package/dist/esm/getEntries.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listDictionaries } from "@intlayer/
|
|
2
|
-
import { getPathHash } from "@intlayer/
|
|
1
|
+
import { listDictionaries } from "@intlayer/engine/listDictionaries";
|
|
2
|
+
import { getPathHash } from "@intlayer/engine/utils";
|
|
3
3
|
|
|
4
4
|
//#region src/getEntries.ts
|
|
5
5
|
const getEntries = async (configuration) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/engine/listDictionaries';\nimport { getPathHash } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { EntryObject } from 'webpack';\n\nexport const getEntries = async (\n configuration: IntlayerConfig\n): Promise<EntryObject> => {\n const files = await listDictionaries(configuration);\n\n return files.reduce((obj, el) => {\n const hash = getPathHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n};\n"],"mappings":";;;;AAKA,MAAa,aAAa,OACxB,kBACyB;AAGzB,SAAO,MAFa,iBAAiB,cAAc,EAEtC,QAAQ,KAAK,OAAO;EAC/B,MAAM,OAAO,YAAY,GAAG;AAE5B,MAAI,oBAAoB,UAAU;GAChC,QAAQ;GACR,UAAU;GACX;AAED,SAAO;IACN,EAAE,CAAgB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getHasDictionarySelector, getUnusedNodeTypesAsync } from "@intlayer/config/utils";
|
|
2
2
|
import { getConfiguration } from "@intlayer/config/node";
|
|
3
|
-
import { prepareIntlayer } from "@intlayer/chokidar/build";
|
|
4
|
-
import { watch } from "@intlayer/chokidar/watcher";
|
|
5
3
|
import { BLUE } from "@intlayer/config/colors";
|
|
6
4
|
import { formatDictionarySelectorEnvVar, formatNodeTypeToEnvVar, getConfigEnvVars } from "@intlayer/config/envVars";
|
|
7
5
|
import { colorize, getAppLogger } from "@intlayer/config/logger";
|
|
8
6
|
import { getDictionaries } from "@intlayer/dictionaries-entry";
|
|
7
|
+
import { prepareIntlayer } from "@intlayer/engine/build";
|
|
8
|
+
import { watch } from "@intlayer/engine/watcher";
|
|
9
9
|
|
|
10
10
|
//#region src/webpack-plugin.ts
|
|
11
11
|
var IntlayerPlugin = class {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { BLUE } from '@intlayer/config/colors';\nimport {\n formatDictionarySelectorEnvVar,\n formatNodeTypeToEnvVar,\n getConfigEnvVars,\n} from '@intlayer/config/envVars';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n getHasDictionarySelector,\n getUnusedNodeTypesAsync,\n} from '@intlayer/config/utils';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { watch } from '@intlayer/engine/watcher';\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 const wrapKey = (key: string) => `process.env.${key}`;\n const wrapValue = (value: string) => `\"${value}\"`;\n\n // Specific `process.env.<KEY>` defines. webpack's DefinePlugin replaces both\n // the dot- and bracket-notation reads of a defined key, and — crucially —\n // folds them at *parse* time, which lets it dead-code-eliminate the guarded\n // dynamic `import()` chunks (e.g. the HTML/markdown renderers) for unused\n // node types. The config flags are emitted in every mode so routing/editor\n // behaviour is correct in dev too; the dictionary scan (used to prune node\n // types) only runs for production builds.\n let env: Record<string, string> = {\n ...getConfigEnvVars(this.configuration, wrapKey, wrapValue),\n };\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 shaking based on unused node types\n ...formatNodeTypeToEnvVar(unusedNodeTypes, wrapKey, wrapValue),\n\n // Tree shaking the dictionary selector logic\n // (collections / variants)\n ...formatDictionarySelectorEnvVar(\n getHasDictionarySelector(dictionaries),\n wrapKey,\n wrapValue\n ),\n };\n }\n\n new webpack.DefinePlugin({\n // Catch-all so that any `process.env.*` read NOT folded by the specific\n // keys below still resolves to `undefined` instead of dereferencing a\n // bare `process`, which is not defined in browser bundles (e.g. Angular)\n // and throws `process is not defined`. This covers in-use node types\n // (never emitted as \"false\"), the dictionary selector when present, and\n // every read in development where the dictionary scan is skipped. Specific\n // keys (below) and host bundler defines (e.g. `process.env.NODE_ENV`) take\n // precedence over this object, so chunk-level tree shaking is preserved.\n 'process.env': '({})',\n ...env,\n }).apply(compiler);\n\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n await 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":";;;;;;;;;;AAmBA,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,MAAM,WAAW,QAAgB,eAAe;EAChD,MAAM,aAAa,UAAkB,IAAI,MAAM;EAS/C,IAAI,MAA8B,EAChC,GAAG,iBAAiB,KAAK,eAAe,SAAS,UAAU,EAC5D;AAED,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,iBAAiB,SAAS,UAAU;IAI9D,GAAG,+BACD,yBAAyB,aAAa,EACtC,SACA,UACD;IACF;;AAGH,MAAI,QAAQ,aAAa;GASvB,eAAe;GACf,GAAG;GACJ,CAAC,CAAC,MAAM,SAAS;AAElB,MAAI,KAAK,cAAc,QAAQ,MAE7B,OAAM,MAAM,EAAE,eAAe,KAAK,eAAe,CAAC;AAGpD,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/webpack",
|
|
3
|
-
"version": "9.0.0-canary.
|
|
3
|
+
"version": "9.0.0-canary.12",
|
|
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/
|
|
81
|
-
"@intlayer/
|
|
82
|
-
"@intlayer/
|
|
83
|
-
"@intlayer/types": "9.0.0-canary.
|
|
80
|
+
"@intlayer/config": "9.0.0-canary.12",
|
|
81
|
+
"@intlayer/dictionaries-entry": "9.0.0-canary.12",
|
|
82
|
+
"@intlayer/engine": "9.0.0-canary.12",
|
|
83
|
+
"@intlayer/types": "9.0.0-canary.12",
|
|
84
84
|
"fast-glob": "3.3.3",
|
|
85
85
|
"webpack": "5.107.2",
|
|
86
86
|
"webpack-dev-server": "5.2.4"
|