@intlayer/webpack 8.4.4 → 8.4.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.
@@ -0,0 +1,29 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
@@ -1,2 +1,20 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./utils-DLoAEeUK.cjs`);let e=require(`@intlayer/chokidar/listDictionaries`),t=require(`@intlayer/chokidar/utils`);const n=async n=>(await(0,e.listDictionaries)(n)).reduce((e,n)=>{let r=(0,t.getPathHash)(n);return e[`intlayer-content/${r}`]={import:n,dependOn:void 0},e},{});exports.getEntries=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ let _intlayer_chokidar_listDictionaries = require("@intlayer/chokidar/listDictionaries");
4
+ let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
5
+
6
+ //#region src/getEntries.ts
7
+ const getEntries = async (configuration) => {
8
+ return (await (0, _intlayer_chokidar_listDictionaries.listDictionaries)(configuration)).reduce((obj, el) => {
9
+ const hash = (0, _intlayer_chokidar_utils.getPathHash)(el);
10
+ obj[`intlayer-content/${hash}`] = {
11
+ import: el,
12
+ dependOn: void 0
13
+ };
14
+ return obj;
15
+ }, {});
16
+ };
17
+
18
+ //#endregion
19
+ exports.getEntries = getEntries;
2
20
  //# sourceMappingURL=getEntries.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getEntries.cjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/chokidar/listDictionaries';\nimport { getPathHash } from '@intlayer/chokidar/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":"8LAKA,MAAa,EAAa,KACxB,KAEc,MAAA,EAAA,EAAA,kBAAuB,EAAc,EAEtC,QAAQ,EAAK,IAAO,CAC/B,IAAM,GAAA,EAAA,EAAA,aAAmB,EAAG,CAO5B,MALA,GAAI,oBAAoB,KAAU,CAChC,OAAQ,EACR,SAAU,IAAA,GACX,CAEM,GACN,EAAE,CAAgB"}
1
+ {"version":3,"file":"getEntries.cjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/chokidar/listDictionaries';\nimport { getPathHash } from '@intlayer/chokidar/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,SAFc,gEAAuB,cAAc,EAEtC,QAAQ,KAAK,OAAO;EAC/B,MAAM,iDAAmB,GAAG;AAE5B,MAAI,oBAAoB,UAAU;GAChC,QAAQ;GACR,UAAU;GACX;AAED,SAAO;IACN,EAAE,CAAgB"}
@@ -1 +1,7 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./webpack-plugin.cjs`),t=require(`./webpack.config.cjs`);exports.IntlayerPlugin=e.IntlayerPlugin,exports.devServerConfig=t.devServerConfig,exports.getWebpackConfig=t;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_webpack_plugin = require('./webpack-plugin.cjs');
3
+ const require_webpack_config = require('./webpack.config.cjs');
4
+
5
+ exports.IntlayerPlugin = require_webpack_plugin.IntlayerPlugin;
6
+ exports.devServerConfig = require_webpack_config.devServerConfig;
7
+ exports.getWebpackConfig = require_webpack_config;
@@ -1 +1,20 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./utils-DLoAEeUK.cjs`);exports.defineDirname=e.t;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ let node_path = require("node:path");
4
+ node_path = require_runtime.__toESM(node_path);
5
+ let node_url = require("node:url");
6
+ let _intlayer_config_utils = require("@intlayer/config/utils");
7
+
8
+ //#region src/utils.ts
9
+ /**
10
+ * Set the __dirname global variable to make the config work in both ESM and CJS environments
11
+ */
12
+ const defineDirname = () => {
13
+ const filename = _intlayer_config_utils.isESModule ? (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href) : require("node:url").pathToFileURL(__filename).toString();
14
+ globalThis.__filename = globalThis.__filename ?? filename;
15
+ globalThis.__dirname = globalThis.__dirname ?? node_path.default.dirname(__filename);
16
+ };
17
+
18
+ //#endregion
19
+ exports.defineDirname = defineDirname;
20
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","names":["isESModule","path"],"sources":["../../src/utils.ts"],"sourcesContent":["import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\n\n/**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\nexport const defineDirname = () => {\n const filename = isESModule\n ? fileURLToPath(import.meta.url)\n : require('node:url').pathToFileURL(__filename).toString();\n\n globalThis.__filename = globalThis.__filename ?? filename;\n globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);\n};\n"],"mappings":";;;;;;;;;;;AAOA,MAAa,sBAAsB;CACjC,MAAM,WAAWA,8GACiB,GAC9B,QAAQ,WAAW,CAAC,cAAc,WAAW,CAAC,UAAU;AAE5D,YAAW,aAAa,WAAW,cAAc;AACjD,YAAW,YAAY,WAAW,aAAaC,kBAAK,QAAQ,WAAW"}
@@ -1,2 +1,29 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./utils-DLoAEeUK.cjs`);let e=require(`@intlayer/chokidar/build`),t=require(`@intlayer/chokidar/watcher`),n=require(`@intlayer/config/logger`);var r=class{isWatching=!1;configuration;constructor(e){this.configuration=e}async apply(r){this.configuration.content.watch&&(0,t.watch)({configuration:this.configuration}),r.hooks.beforeCompile.tapPromise(`IntlayerPlugin`,async()=>{if(!this.isWatching)try{await(0,e.prepareIntlayer)(this.configuration),this.isWatching=!0}catch(e){(0,n.logger)(`Error in IntlayerPlugin: ${e}`,{level:`error`})}})}};exports.IntlayerPlugin=r;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
4
+ let _intlayer_chokidar_watcher = require("@intlayer/chokidar/watcher");
5
+ let _intlayer_config_logger = require("@intlayer/config/logger");
6
+
7
+ //#region src/webpack-plugin.ts
8
+ var IntlayerPlugin = class {
9
+ isWatching = false;
10
+ configuration;
11
+ constructor(configuration) {
12
+ this.configuration = configuration;
13
+ }
14
+ async apply(compiler) {
15
+ if (this.configuration.content.watch) (0, _intlayer_chokidar_watcher.watch)({ configuration: this.configuration });
16
+ compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
17
+ if (!this.isWatching) try {
18
+ await (0, _intlayer_chokidar_build.prepareIntlayer)(this.configuration);
19
+ this.isWatching = true;
20
+ } catch (error) {
21
+ (0, _intlayer_config_logger.logger)(`Error in IntlayerPlugin: ${error}`, { level: "error" });
22
+ }
23
+ });
24
+ }
25
+ };
26
+
27
+ //#endregion
28
+ exports.IntlayerPlugin = IntlayerPlugin;
2
29
  //# sourceMappingURL=webpack-plugin.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack-plugin.cjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { logger } from '@intlayer/config/logger';\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;\n }\n\n async apply(compiler: Compiler): Promise<void> {\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 logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":"0NAOA,IAAa,EAAb,KAA4B,CAC1B,WAAqB,GACrB,cAEA,YAAY,EAA+B,CACzC,KAAK,cAAgB,EAGvB,MAAM,MAAM,EAAmC,CACzC,KAAK,cAAc,QAAQ,QAE7B,EAAA,EAAA,OAAM,CAAE,cAAe,KAAK,cAAe,CAAC,CAG9C,EAAS,MAAM,cAAc,WAAW,iBAAkB,SAAY,CACpE,GAAI,CAAC,KAAK,WACR,GAAI,CACF,MAAA,EAAA,EAAA,iBAAsB,KAAK,cAAc,CACzC,KAAK,WAAa,SACX,EAAO,EACd,EAAA,EAAA,QAAO,4BAA4B,IAAS,CAC1C,MAAO,QACR,CAAC,GAGN"}
1
+ {"version":3,"file":"webpack-plugin.cjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { logger } from '@intlayer/config/logger';\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;\n }\n\n async apply(compiler: Compiler): Promise<void> {\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 logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":";;;;;;;AAOA,IAAa,iBAAb,MAA4B;CAC1B,AAAQ,aAAa;CACrB,AAAQ;CAER,YAAY,eAA+B;AACzC,OAAK,gBAAgB;;CAGvB,MAAM,MAAM,UAAmC;AAC7C,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,wCAAO,4BAA4B,SAAS,EAC1C,OAAO,SACR,CAAC;;IAGN"}
@@ -1,2 +1,91 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./utils-DLoAEeUK.cjs`),t=require(`./getEntries.cjs`),n=require(`./webpack-plugin.cjs`);let r=require(`node:path`),i=require(`@intlayer/config/node`);const a={hot:!0,open:!1,liveReload:!1,compress:!0,historyApiFallback:!1,host:`localhost`,port:8080,watchFiles:`./src/`,devMiddleware:{writeToDisk:!0},static:{}},o=(o=(0,i.getConfiguration)())=>{let{fileExtensions:s}=o.content;return e.t(),{mode:`production`,target:`node`,entry:()=>t.getEntries(o),output:{clean:!0,library:`IntlLayerContent`,libraryTarget:`umd`,filename:`[name].bundle.js`},cache:!1,devtool:`source-map`,ignoreWarnings:[/./],resolve:{extensions:[`.ts`,`.js`,`.json`,`.wasm`,`.ts`,`.tsx`,`.mjs`,`.cjs`],modules:[(0,r.join)(globalThis.__dirname,`..`,`node_modules`),(0,r.join)(process.cwd(),`node_modules`),(0,r.join)(process.cwd(),`node_modules`,`intlayer-cli`,`node_modules`),(0,r.join)(process.cwd(),`node_modules`,`intlayer-cli`,`node_modules`,`@intlayer/webpack`,`node_modules`)]},resolveLoader:{modules:[(0,r.join)(process.cwd(),`node_modules`),(0,r.join)(process.cwd(),`node_modules`,`@intlayer/webpack`,`node_modules`),(0,r.join)(process.cwd(),`node_modules`,`intlayer-cli`,`node_modules`,`@intlayer/webpack`,`node_modules`)]},module:{rules:[{test:RegExp(`(${s.join(`|`)})$`),use:[{loader:`esbuild-loader`,options:{target:`es2015`}}]},{test:/\.node$/,loader:`node-loader`},{test:/\.(jsx|js|ts|tsx|mjs|cjs)?$/,loader:`esbuild-loader`,options:{target:`es2015`}}]},devServer:a,plugins:[new n.IntlayerPlugin(o)]}};exports.default=o,exports.getWebpackConfig=o,exports.devServerConfig=a;
1
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_getEntries = require('./getEntries.cjs');
4
+ const require_utils = require('./utils.cjs');
5
+ const require_webpack_plugin = require('./webpack-plugin.cjs');
6
+ let node_path = require("node:path");
7
+ let _intlayer_config_node = require("@intlayer/config/node");
8
+
9
+ //#region src/webpack.config.ts
10
+ const devServerConfig = {
11
+ hot: true,
12
+ open: false,
13
+ liveReload: false,
14
+ compress: true,
15
+ historyApiFallback: false,
16
+ host: "localhost",
17
+ port: 8080,
18
+ watchFiles: "./src/",
19
+ devMiddleware: { writeToDisk: true },
20
+ static: {}
21
+ };
22
+ const getWebpackConfig = (configuration = (0, _intlayer_config_node.getConfiguration)()) => {
23
+ const { fileExtensions } = configuration.content;
24
+ /**
25
+ * Set the __dirname global variable to make the config work in both ESM and CJS environments
26
+ */
27
+ require_utils.defineDirname();
28
+ return {
29
+ mode: "production",
30
+ target: "node",
31
+ entry: () => require_getEntries.getEntries(configuration),
32
+ output: {
33
+ clean: true,
34
+ library: "IntlLayerContent",
35
+ libraryTarget: "umd",
36
+ filename: `[name].bundle.js`
37
+ },
38
+ cache: false,
39
+ devtool: "source-map",
40
+ ignoreWarnings: [/./],
41
+ resolve: {
42
+ extensions: [
43
+ ".ts",
44
+ ".js",
45
+ ".json",
46
+ ".wasm",
47
+ ".ts",
48
+ ".tsx",
49
+ ".mjs",
50
+ ".cjs"
51
+ ],
52
+ modules: [
53
+ (0, node_path.join)(globalThis.__dirname, "..", "node_modules"),
54
+ (0, node_path.join)(process.cwd(), "node_modules"),
55
+ (0, node_path.join)(process.cwd(), "node_modules", "intlayer-cli", "node_modules"),
56
+ (0, node_path.join)(process.cwd(), "node_modules", "intlayer-cli", "node_modules", "@intlayer/webpack", "node_modules")
57
+ ]
58
+ },
59
+ resolveLoader: { modules: [
60
+ (0, node_path.join)(process.cwd(), "node_modules"),
61
+ (0, node_path.join)(process.cwd(), "node_modules", "@intlayer/webpack", "node_modules"),
62
+ (0, node_path.join)(process.cwd(), "node_modules", "intlayer-cli", "node_modules", "@intlayer/webpack", "node_modules")
63
+ ] },
64
+ module: { rules: [
65
+ {
66
+ test: new RegExp(`(${fileExtensions.join("|")})$`),
67
+ use: [{
68
+ loader: "esbuild-loader",
69
+ options: { target: "es2015" }
70
+ }]
71
+ },
72
+ {
73
+ test: /\.node$/,
74
+ loader: "node-loader"
75
+ },
76
+ {
77
+ test: /\.(jsx|js|ts|tsx|mjs|cjs)?$/,
78
+ loader: "esbuild-loader",
79
+ options: { target: "es2015" }
80
+ }
81
+ ] },
82
+ devServer: devServerConfig,
83
+ plugins: [new require_webpack_plugin.IntlayerPlugin(configuration)]
84
+ };
85
+ };
86
+
87
+ //#endregion
88
+ exports.default = getWebpackConfig;
89
+ exports.getWebpackConfig = getWebpackConfig;
90
+ exports.devServerConfig = devServerConfig;
2
91
  //# sourceMappingURL=webpack.config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.config.cjs","names":["getEntries","IntlayerPlugin"],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // derived from content.fileExtensions + content.contentDir\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: () => getEntries(configuration),\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":"qQAWA,MAAa,EAA0C,CAErD,IAAK,GAEL,KAAM,GACN,WAAY,GAGZ,SAAU,GAGV,mBAAoB,GAGpB,KAAM,YACN,KAAM,KAEN,WAAY,SAEZ,cAAe,CAEb,YAAa,GACd,CAGD,OAAQ,EAAE,CACX,CAEY,GACX,GAAA,EAAA,EAAA,mBAAkD,GACzB,CACzB,GAAM,CAAE,kBAAmB,EAAc,QA2HzC,OAtHA,EAAA,GAAe,CAE6B,CAE1C,KAAM,aAEN,OAAQ,OAER,UAAaA,EAAAA,WAAW,EAAc,CACtC,OAAQ,CACN,MAAO,GACP,QAAS,mBACT,cAAe,MACf,SAAU,mBACX,CAED,MAAO,GAEP,QAAS,aAMT,eAAgB,CAAC,IAAI,CACrB,QAAS,CAEP,WAAY,CACV,MACA,MACA,QACA,QACA,MACA,OACA,OACA,OACD,CACD,QAAS,YAEF,WAAW,UAAW,KAAM,eAAe,YAC3C,QAAQ,KAAK,CAAE,eAAe,YAC9B,QAAQ,KAAK,CAAE,eAAgB,eAAgB,eAAe,YAEjE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,cAAe,CAEb,QAAS,YAEF,QAAQ,KAAK,CAAE,eAAe,YAEjC,QAAQ,KAAK,CACb,eACA,oBACA,eACD,YAEC,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,OAAQ,CACN,MAAO,CACL,CAEE,KAAU,OAAO,IAAI,EAAe,KAAK,IAAI,CAAC,IAAI,CAClD,IAAK,CACH,CAEE,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAKF,CACF,CACD,CACE,KAAM,UACN,OAAQ,cACT,CAED,CAEE,KAAM,8BACN,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAGF,CACF,CACD,UAAW,EAEX,QAAS,CAAC,IAAIC,EAAAA,eAAe,EAAc,CAAC,CAC7C"}
1
+ {"version":3,"file":"webpack.config.cjs","names":["getEntries","IntlayerPlugin"],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // derived from content.fileExtensions + content.contentDir\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: () => getEntries(configuration),\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":";;;;;;;;;AAWA,MAAa,kBAA0C;CAErD,KAAK;CAEL,MAAM;CACN,YAAY;CAGZ,UAAU;CAGV,oBAAoB;CAGpB,MAAM;CACN,MAAM;CAEN,YAAY;CAEZ,eAAe,EAEb,aAAa,MACd;CAGD,QAAQ,EAAE;CACX;AAED,MAAa,oBACX,6DAAkD,KACzB;CACzB,MAAM,EAAE,mBAAmB,cAAc;;;;AAKzC,8BAAe;AAsHf,QApH4C;EAE1C,MAAM;EAEN,QAAQ;EAER,aAAaA,8BAAW,cAAc;EACtC,QAAQ;GACN,OAAO;GACP,SAAS;GACT,eAAe;GACf,UAAU;GACX;EAED,OAAO;EAEP,SAAS;EAMT,gBAAgB,CAAC,IAAI;EACrB,SAAS;GAEP,YAAY;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACD,SAAS;wBAEF,WAAW,WAAW,MAAM,eAAe;wBAC3C,QAAQ,KAAK,EAAE,eAAe;wBAC9B,QAAQ,KAAK,EAAE,gBAAgB,gBAAgB,eAAe;wBAEjE,QAAQ,KAAK,EACb,gBACA,gBACA,gBACA,qBACA,eACD;IACF;GACF;EAED,eAAe,EAEb,SAAS;uBAEF,QAAQ,KAAK,EAAE,eAAe;uBAEjC,QAAQ,KAAK,EACb,gBACA,qBACA,eACD;uBAEC,QAAQ,KAAK,EACb,gBACA,gBACA,gBACA,qBACA,eACD;GACF,EACF;EAED,QAAQ,EACN,OAAO;GACL;IAEE,MAAM,IAAI,OAAO,IAAI,eAAe,KAAK,IAAI,CAAC,IAAI;IAClD,KAAK,CACH;KAEE,QAAQ;KACR,SAAS,EAEP,QAAQ,UACT;KACF,CAKF;IACF;GACD;IACE,MAAM;IACN,QAAQ;IACT;GAED;IAEE,MAAM;IACN,QAAQ;IACR,SAAS,EAEP,QAAQ,UACT;IACF;GAGF,EACF;EACD,WAAW;EAEX,SAAS,CAAC,IAAIC,sCAAe,cAAc,CAAC;EAC7C"}
@@ -0,0 +1,8 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
3
+ if (typeof require !== "undefined") return require.apply(this, arguments);
4
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
+ });
6
+
7
+ //#endregion
8
+ export { __require };
@@ -1,2 +1,18 @@
1
- import{listDictionaries as e}from"@intlayer/chokidar/listDictionaries";import{getPathHash as t}from"@intlayer/chokidar/utils";const n=async n=>(await e(n)).reduce((e,n)=>{let r=t(n);return e[`intlayer-content/${r}`]={import:n,dependOn:void 0},e},{});export{n as getEntries};
1
+ import { listDictionaries } from "@intlayer/chokidar/listDictionaries";
2
+ import { getPathHash } from "@intlayer/chokidar/utils";
3
+
4
+ //#region src/getEntries.ts
5
+ const getEntries = async (configuration) => {
6
+ return (await listDictionaries(configuration)).reduce((obj, el) => {
7
+ const hash = getPathHash(el);
8
+ obj[`intlayer-content/${hash}`] = {
9
+ import: el,
10
+ dependOn: void 0
11
+ };
12
+ return obj;
13
+ }, {});
14
+ };
15
+
16
+ //#endregion
17
+ export { getEntries };
2
18
  //# sourceMappingURL=getEntries.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/chokidar/listDictionaries';\nimport { getPathHash } from '@intlayer/chokidar/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":"8HAKA,MAAa,EAAa,KACxB,KAEc,MAAM,EAAiB,EAAc,EAEtC,QAAQ,EAAK,IAAO,CAC/B,IAAM,EAAO,EAAY,EAAG,CAO5B,MALA,GAAI,oBAAoB,KAAU,CAChC,OAAQ,EACR,SAAU,IAAA,GACX,CAEM,GACN,EAAE,CAAgB"}
1
+ {"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { listDictionaries } from '@intlayer/chokidar/listDictionaries';\nimport { getPathHash } from '@intlayer/chokidar/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,SAFc,MAAM,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 +1,4 @@
1
- import{IntlayerPlugin as e}from"./webpack-plugin.mjs";import t,{devServerConfig as n}from"./webpack.config.mjs";export{e as IntlayerPlugin,n as devServerConfig,t as getWebpackConfig};
1
+ import { IntlayerPlugin } from "./webpack-plugin.mjs";
2
+ import getWebpackConfig, { devServerConfig } from "./webpack.config.mjs";
3
+
4
+ export { IntlayerPlugin, devServerConfig, getWebpackConfig };
@@ -1 +1,18 @@
1
- import{t as e}from"./utils-BDXyibK-.mjs";export{e as defineDirname};
1
+ import { __require } from "./_virtual/_rolldown/runtime.mjs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { isESModule } from "@intlayer/config/utils";
5
+
6
+ //#region src/utils.ts
7
+ /**
8
+ * Set the __dirname global variable to make the config work in both ESM and CJS environments
9
+ */
10
+ const defineDirname = () => {
11
+ const filename = isESModule ? fileURLToPath(import.meta.url) : __require("node:url").pathToFileURL(__filename).toString();
12
+ globalThis.__filename = globalThis.__filename ?? filename;
13
+ globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);
14
+ };
15
+
16
+ //#endregion
17
+ export { defineDirname };
18
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\n\n/**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\nexport const defineDirname = () => {\n const filename = isESModule\n ? fileURLToPath(import.meta.url)\n : require('node:url').pathToFileURL(__filename).toString();\n\n globalThis.__filename = globalThis.__filename ?? filename;\n globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,sBAAsB;CACjC,MAAM,WAAW,aACb,cAAc,OAAO,KAAK,IAAI,aACtB,WAAW,CAAC,cAAc,WAAW,CAAC,UAAU;AAE5D,YAAW,aAAa,WAAW,cAAc;AACjD,YAAW,YAAY,WAAW,aAAa,KAAK,QAAQ,WAAW"}
@@ -1,2 +1,27 @@
1
- import{prepareIntlayer as e}from"@intlayer/chokidar/build";import{watch as t}from"@intlayer/chokidar/watcher";import{logger as n}from"@intlayer/config/logger";var r=class{isWatching=!1;configuration;constructor(e){this.configuration=e}async apply(r){this.configuration.content.watch&&t({configuration:this.configuration}),r.hooks.beforeCompile.tapPromise(`IntlayerPlugin`,async()=>{if(!this.isWatching)try{await e(this.configuration),this.isWatching=!0}catch(e){n(`Error in IntlayerPlugin: ${e}`,{level:`error`})}})}};export{r as IntlayerPlugin};
1
+ import { prepareIntlayer } from "@intlayer/chokidar/build";
2
+ import { watch } from "@intlayer/chokidar/watcher";
3
+ import { logger } from "@intlayer/config/logger";
4
+
5
+ //#region src/webpack-plugin.ts
6
+ var IntlayerPlugin = class {
7
+ isWatching = false;
8
+ configuration;
9
+ constructor(configuration) {
10
+ this.configuration = configuration;
11
+ }
12
+ async apply(compiler) {
13
+ if (this.configuration.content.watch) watch({ configuration: this.configuration });
14
+ compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
15
+ if (!this.isWatching) try {
16
+ await prepareIntlayer(this.configuration);
17
+ this.isWatching = true;
18
+ } catch (error) {
19
+ logger(`Error in IntlayerPlugin: ${error}`, { level: "error" });
20
+ }
21
+ });
22
+ }
23
+ };
24
+
25
+ //#endregion
26
+ export { IntlayerPlugin };
2
27
  //# sourceMappingURL=webpack-plugin.mjs.map
@@ -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 { logger } from '@intlayer/config/logger';\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;\n }\n\n async apply(compiler: Compiler): Promise<void> {\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 logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":"+JAOA,IAAa,EAAb,KAA4B,CAC1B,WAAqB,GACrB,cAEA,YAAY,EAA+B,CACzC,KAAK,cAAgB,EAGvB,MAAM,MAAM,EAAmC,CACzC,KAAK,cAAc,QAAQ,OAE7B,EAAM,CAAE,cAAe,KAAK,cAAe,CAAC,CAG9C,EAAS,MAAM,cAAc,WAAW,iBAAkB,SAAY,CACpE,GAAI,CAAC,KAAK,WACR,GAAI,CACF,MAAM,EAAgB,KAAK,cAAc,CACzC,KAAK,WAAa,SACX,EAAO,CACd,EAAO,4BAA4B,IAAS,CAC1C,MAAO,QACR,CAAC,GAGN"}
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 { logger } from '@intlayer/config/logger';\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;\n }\n\n async apply(compiler: Compiler): Promise<void> {\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 logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":";;;;;AAOA,IAAa,iBAAb,MAA4B;CAC1B,AAAQ,aAAa;CACrB,AAAQ;CAER,YAAY,eAA+B;AACzC,OAAK,gBAAgB;;CAGvB,MAAM,MAAM,UAAmC;AAC7C,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,WAAO,4BAA4B,SAAS,EAC1C,OAAO,SACR,CAAC;;IAGN"}
@@ -1,2 +1,87 @@
1
- import{t as e}from"./utils-BDXyibK-.mjs";import{getEntries as t}from"./getEntries.mjs";import{IntlayerPlugin as n}from"./webpack-plugin.mjs";import{join as r}from"node:path";import{getConfiguration as i}from"@intlayer/config/node";const a={hot:!0,open:!1,liveReload:!1,compress:!0,historyApiFallback:!1,host:`localhost`,port:8080,watchFiles:`./src/`,devMiddleware:{writeToDisk:!0},static:{}},o=(o=i())=>{let{fileExtensions:s}=o.content;return e(),{mode:`production`,target:`node`,entry:()=>t(o),output:{clean:!0,library:`IntlLayerContent`,libraryTarget:`umd`,filename:`[name].bundle.js`},cache:!1,devtool:`source-map`,ignoreWarnings:[/./],resolve:{extensions:[`.ts`,`.js`,`.json`,`.wasm`,`.ts`,`.tsx`,`.mjs`,`.cjs`],modules:[r(globalThis.__dirname,`..`,`node_modules`),r(process.cwd(),`node_modules`),r(process.cwd(),`node_modules`,`intlayer-cli`,`node_modules`),r(process.cwd(),`node_modules`,`intlayer-cli`,`node_modules`,`@intlayer/webpack`,`node_modules`)]},resolveLoader:{modules:[r(process.cwd(),`node_modules`),r(process.cwd(),`node_modules`,`@intlayer/webpack`,`node_modules`),r(process.cwd(),`node_modules`,`intlayer-cli`,`node_modules`,`@intlayer/webpack`,`node_modules`)]},module:{rules:[{test:RegExp(`(${s.join(`|`)})$`),use:[{loader:`esbuild-loader`,options:{target:`es2015`}}]},{test:/\.node$/,loader:`node-loader`},{test:/\.(jsx|js|ts|tsx|mjs|cjs)?$/,loader:`esbuild-loader`,options:{target:`es2015`}}]},devServer:a,plugins:[new n(o)]}};export{o as default,o as getWebpackConfig,a as devServerConfig};
1
+ import { getEntries } from "./getEntries.mjs";
2
+ import { defineDirname } from "./utils.mjs";
3
+ import { IntlayerPlugin } from "./webpack-plugin.mjs";
4
+ import { join } from "node:path";
5
+ import { getConfiguration } from "@intlayer/config/node";
6
+
7
+ //#region src/webpack.config.ts
8
+ const devServerConfig = {
9
+ hot: true,
10
+ open: false,
11
+ liveReload: false,
12
+ compress: true,
13
+ historyApiFallback: false,
14
+ host: "localhost",
15
+ port: 8080,
16
+ watchFiles: "./src/",
17
+ devMiddleware: { writeToDisk: true },
18
+ static: {}
19
+ };
20
+ const getWebpackConfig = (configuration = getConfiguration()) => {
21
+ const { fileExtensions } = configuration.content;
22
+ /**
23
+ * Set the __dirname global variable to make the config work in both ESM and CJS environments
24
+ */
25
+ defineDirname();
26
+ return {
27
+ mode: "production",
28
+ target: "node",
29
+ entry: () => getEntries(configuration),
30
+ output: {
31
+ clean: true,
32
+ library: "IntlLayerContent",
33
+ libraryTarget: "umd",
34
+ filename: `[name].bundle.js`
35
+ },
36
+ cache: false,
37
+ devtool: "source-map",
38
+ ignoreWarnings: [/./],
39
+ resolve: {
40
+ extensions: [
41
+ ".ts",
42
+ ".js",
43
+ ".json",
44
+ ".wasm",
45
+ ".ts",
46
+ ".tsx",
47
+ ".mjs",
48
+ ".cjs"
49
+ ],
50
+ modules: [
51
+ join(globalThis.__dirname, "..", "node_modules"),
52
+ join(process.cwd(), "node_modules"),
53
+ join(process.cwd(), "node_modules", "intlayer-cli", "node_modules"),
54
+ join(process.cwd(), "node_modules", "intlayer-cli", "node_modules", "@intlayer/webpack", "node_modules")
55
+ ]
56
+ },
57
+ resolveLoader: { modules: [
58
+ join(process.cwd(), "node_modules"),
59
+ join(process.cwd(), "node_modules", "@intlayer/webpack", "node_modules"),
60
+ join(process.cwd(), "node_modules", "intlayer-cli", "node_modules", "@intlayer/webpack", "node_modules")
61
+ ] },
62
+ module: { rules: [
63
+ {
64
+ test: new RegExp(`(${fileExtensions.join("|")})$`),
65
+ use: [{
66
+ loader: "esbuild-loader",
67
+ options: { target: "es2015" }
68
+ }]
69
+ },
70
+ {
71
+ test: /\.node$/,
72
+ loader: "node-loader"
73
+ },
74
+ {
75
+ test: /\.(jsx|js|ts|tsx|mjs|cjs)?$/,
76
+ loader: "esbuild-loader",
77
+ options: { target: "es2015" }
78
+ }
79
+ ] },
80
+ devServer: devServerConfig,
81
+ plugins: [new IntlayerPlugin(configuration)]
82
+ };
83
+ };
84
+
85
+ //#endregion
86
+ export { getWebpackConfig as default, getWebpackConfig, devServerConfig };
2
87
  //# sourceMappingURL=webpack.config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.config.mjs","names":[],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // derived from content.fileExtensions + content.contentDir\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: () => getEntries(configuration),\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":"uOAWA,MAAa,EAA0C,CAErD,IAAK,GAEL,KAAM,GACN,WAAY,GAGZ,SAAU,GAGV,mBAAoB,GAGpB,KAAM,YACN,KAAM,KAEN,WAAY,SAEZ,cAAe,CAEb,YAAa,GACd,CAGD,OAAQ,EAAE,CACX,CAEY,GACX,EAAgC,GAAkB,GACzB,CACzB,GAAM,CAAE,kBAAmB,EAAc,QA2HzC,OAtHA,GAAe,CAE6B,CAE1C,KAAM,aAEN,OAAQ,OAER,UAAa,EAAW,EAAc,CACtC,OAAQ,CACN,MAAO,GACP,QAAS,mBACT,cAAe,MACf,SAAU,mBACX,CAED,MAAO,GAEP,QAAS,aAMT,eAAgB,CAAC,IAAI,CACrB,QAAS,CAEP,WAAY,CACV,MACA,MACA,QACA,QACA,MACA,OACA,OACA,OACD,CACD,QAAS,CAEP,EAAK,WAAW,UAAW,KAAM,eAAe,CAChD,EAAK,QAAQ,KAAK,CAAE,eAAe,CACnC,EAAK,QAAQ,KAAK,CAAE,eAAgB,eAAgB,eAAe,CACnE,EACE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,cAAe,CAEb,QAAS,CAEP,EAAK,QAAQ,KAAK,CAAE,eAAe,CACnC,EACE,QAAQ,KAAK,CACb,eACA,oBACA,eACD,CACD,EACE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,OAAQ,CACN,MAAO,CACL,CAEE,KAAU,OAAO,IAAI,EAAe,KAAK,IAAI,CAAC,IAAI,CAClD,IAAK,CACH,CAEE,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAKF,CACF,CACD,CACE,KAAM,UACN,OAAQ,cACT,CAED,CAEE,KAAM,8BACN,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAGF,CACF,CACD,UAAW,EAEX,QAAS,CAAC,IAAI,EAAe,EAAc,CAAC,CAC7C"}
1
+ {"version":3,"file":"webpack.config.mjs","names":[],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // derived from content.fileExtensions + content.contentDir\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: () => getEntries(configuration),\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":";;;;;;;AAWA,MAAa,kBAA0C;CAErD,KAAK;CAEL,MAAM;CACN,YAAY;CAGZ,UAAU;CAGV,oBAAoB;CAGpB,MAAM;CACN,MAAM;CAEN,YAAY;CAEZ,eAAe,EAEb,aAAa,MACd;CAGD,QAAQ,EAAE;CACX;AAED,MAAa,oBACX,gBAAgC,kBAAkB,KACzB;CACzB,MAAM,EAAE,mBAAmB,cAAc;;;;AAKzC,gBAAe;AAsHf,QApH4C;EAE1C,MAAM;EAEN,QAAQ;EAER,aAAa,WAAW,cAAc;EACtC,QAAQ;GACN,OAAO;GACP,SAAS;GACT,eAAe;GACf,UAAU;GACX;EAED,OAAO;EAEP,SAAS;EAMT,gBAAgB,CAAC,IAAI;EACrB,SAAS;GAEP,YAAY;IACV;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACD,SAAS;IAEP,KAAK,WAAW,WAAW,MAAM,eAAe;IAChD,KAAK,QAAQ,KAAK,EAAE,eAAe;IACnC,KAAK,QAAQ,KAAK,EAAE,gBAAgB,gBAAgB,eAAe;IACnE,KACE,QAAQ,KAAK,EACb,gBACA,gBACA,gBACA,qBACA,eACD;IACF;GACF;EAED,eAAe,EAEb,SAAS;GAEP,KAAK,QAAQ,KAAK,EAAE,eAAe;GACnC,KACE,QAAQ,KAAK,EACb,gBACA,qBACA,eACD;GACD,KACE,QAAQ,KAAK,EACb,gBACA,gBACA,gBACA,qBACA,eACD;GACF,EACF;EAED,QAAQ,EACN,OAAO;GACL;IAEE,MAAM,IAAI,OAAO,IAAI,eAAe,KAAK,IAAI,CAAC,IAAI;IAClD,KAAK,CACH;KAEE,QAAQ;KACR,SAAS,EAEP,QAAQ,UACT;KACF,CAKF;IACF;GACD;IACE,MAAM;IACN,QAAQ;IACT;GAED;IAEE,MAAM;IACN,QAAQ;IACR,SAAS,EAEP,QAAQ,UACT;IACF;GAGF,EACF;EACD,WAAW;EAEX,SAAS,CAAC,IAAI,eAAe,cAAc,CAAC;EAC7C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/webpack",
3
- "version": "8.4.4",
3
+ "version": "8.4.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,9 +77,9 @@
77
77
  "watch": "webpack --config ./webpack.config.ts --watch"
78
78
  },
79
79
  "dependencies": {
80
- "@intlayer/chokidar": "8.4.4",
81
- "@intlayer/config": "8.4.4",
82
- "@intlayer/types": "8.4.4",
80
+ "@intlayer/chokidar": "8.4.6",
81
+ "@intlayer/config": "8.4.6",
82
+ "@intlayer/types": "8.4.6",
83
83
  "fast-glob": "3.3.3",
84
84
  "webpack": "5.105.4",
85
85
  "webpack-dev-server": "5.2.3"
@@ -1,2 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`node:path`);c=s(c);let l=require(`node:url`),u=require(`@intlayer/config/utils`);const d=()=>{let e=u.isESModule?(0,l.fileURLToPath)(require(`url`).pathToFileURL(__filename).href):require(`node:url`).pathToFileURL(__filename).toString();globalThis.__filename=globalThis.__filename??e,globalThis.__dirname=globalThis.__dirname??c.default.dirname(__filename)};Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return d}});
2
- //# sourceMappingURL=utils-DLoAEeUK.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-DLoAEeUK.cjs","names":["isESModule","path"],"sources":["../../src/utils.ts"],"sourcesContent":["import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\n\n/**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\nexport const defineDirname = () => {\n const filename = isESModule\n ? fileURLToPath(import.meta.url)\n : require('node:url').pathToFileURL(__filename).toString();\n\n globalThis.__filename = globalThis.__filename ?? filename;\n globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);\n};\n"],"mappings":"8jBAOA,MAAa,MAAsB,CACjC,IAAM,EAAWA,EAAAA,YAAAA,EAAAA,EAAAA,eAAAA,QAAAA,MAAAA,CAAAA,cAAAA,WAAAA,CAAAA,KACiB,CAC9B,QAAQ,WAAW,CAAC,cAAc,WAAW,CAAC,UAAU,CAE5D,WAAW,WAAa,WAAW,YAAc,EACjD,WAAW,UAAY,WAAW,WAAaC,EAAAA,QAAK,QAAQ,WAAW"}
@@ -1,2 +0,0 @@
1
- import e from"node:path";import{fileURLToPath as t}from"node:url";import{isESModule as n}from"@intlayer/config/utils";var r=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")});const i=()=>{let i=n?t(import.meta.url):r(`node:url`).pathToFileURL(__filename).toString();globalThis.__filename=globalThis.__filename??i,globalThis.__dirname=globalThis.__dirname??e.dirname(__filename)};export{i as t};
2
- //# sourceMappingURL=utils-BDXyibK-.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-BDXyibK-.mjs","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["import path from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\n\n/**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\nexport const defineDirname = () => {\n const filename = isESModule\n ? fileURLToPath(import.meta.url)\n : require('node:url').pathToFileURL(__filename).toString();\n\n globalThis.__filename = globalThis.__filename ?? filename;\n globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);\n};\n"],"mappings":"yfAOA,MAAa,MAAsB,CACjC,IAAM,EAAW,EACb,EAAc,OAAO,KAAK,IAAI,CAAA,EACtB,WAAW,CAAC,cAAc,WAAW,CAAC,UAAU,CAE5D,WAAW,WAAa,WAAW,YAAc,EACjD,WAAW,UAAY,WAAW,WAAa,EAAK,QAAQ,WAAW"}