@intlayer/webpack 6.1.6 → 7.0.0-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ //#region rolldown:runtime
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.");
5
+ });
6
+
7
+ //#endregion
8
+ export { __require };
@@ -1,17 +1,20 @@
1
- import { getConfiguration } from "@intlayer/config";
2
- import fg from "fast-glob";
3
1
  import { getFileHash } from "./utils.mjs";
4
- const { content } = getConfiguration();
5
- const { watchedFilesPatternWithPath } = content;
6
- const getEntries = () => fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {
7
- const hash = getFileHash(el);
8
- obj[`intlayer-content/${hash}`] = {
9
- import: el,
10
- dependOn: void 0
11
- };
12
- return obj;
13
- }, {});
14
- export {
15
- getEntries
2
+ import fg from "fast-glob";
3
+
4
+ //#region src/getEntries.ts
5
+ const getEntries = (configuration) => {
6
+ const { content } = configuration;
7
+ const { watchedFilesPatternWithPath } = content;
8
+ return fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {
9
+ const hash = getFileHash(el);
10
+ obj[`intlayer-content/${hash}`] = {
11
+ import: el,
12
+ dependOn: void 0
13
+ };
14
+ return obj;
15
+ }, {});
16
16
  };
17
+
18
+ //#endregion
19
+ export { getEntries };
17
20
  //# sourceMappingURL=getEntries.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport fg from 'fast-glob';\nimport type { EntryObject } from 'webpack';\nimport { getFileHash } from './utils';\n\nconst { content } = getConfiguration();\nconst { watchedFilesPatternWithPath } = content;\n\nexport const getEntries = (): EntryObject =>\n fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {\n const hash = getFileHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,OAAO,QAAQ;AAEf,SAAS,mBAAmB;AAE5B,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,EAAE,4BAA4B,IAAI;AAEjC,MAAM,aAAa,MACxB,GAAG,KAAK,2BAA2B,EAAE,OAAO,CAAC,KAAK,OAAO;AACvD,QAAM,OAAO,YAAY,EAAE;AAE3B,MAAI,oBAAoB,IAAI,EAAE,IAAI;AAAA,IAChC,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAEA,SAAO;AACT,GAAG,CAAC,CAAgB;","names":[]}
1
+ {"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport type { EntryObject } from 'webpack';\nimport { getFileHash } from './utils';\n\nexport const getEntries = (configuration: IntlayerConfig) => {\n const { content } = configuration;\n const { watchedFilesPatternWithPath } = content;\n\n const entries = fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {\n const hash = getFileHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n\n return entries;\n};\n"],"mappings":";;;;AAKA,MAAa,cAAc,kBAAkC;CAC3D,MAAM,EAAE,YAAY;CACpB,MAAM,EAAE,gCAAgC;AAaxC,QAXgB,GAAG,KAAK,4BAA4B,CAAC,QAAQ,KAAK,OAAO;EACvE,MAAM,OAAO,YAAY,GAAG;AAE5B,MAAI,oBAAoB,UAAU;GAChC,QAAQ;GACR,UAAU;GACX;AAED,SAAO;IACN,EAAE,CAAgB"}
@@ -1,8 +1,4 @@
1
1
  import { IntlayerPlugin } from "./webpack-plugin.mjs";
2
- import { devServerConfig, webpackConfig } from "./webpack.config.mjs";
3
- export {
4
- IntlayerPlugin,
5
- devServerConfig,
6
- webpackConfig
7
- };
8
- //# sourceMappingURL=index.mjs.map
2
+ import { devServerConfig, getWebpackConfig } from "./webpack.config.mjs";
3
+
4
+ export { IntlayerPlugin, devServerConfig, getWebpackConfig };
@@ -1,18 +1,22 @@
1
+ import { __require } from "./_virtual/rolldown_runtime.mjs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
1
4
  import { isESModule } from "@intlayer/config";
2
5
  import crypto from "crypto-js";
3
- import path from "path";
4
- import { fileURLToPath } from "url";
6
+
7
+ //#region src/utils.ts
8
+ /**
9
+ * Set the __dirname global variable to make the config work in both ESM and CJS environments
10
+ */
5
11
  const defineDirname = () => {
6
- const filename = isESModule ? fileURLToPath(import.meta.url) : require("url").pathToFileURL(__filename).toString();
7
- globalThis.__filename = globalThis.__filename ?? filename;
8
- globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);
12
+ const filename = isESModule ? fileURLToPath(import.meta.url) : __require("node:url").pathToFileURL(__filename).toString();
13
+ globalThis.__filename = globalThis.__filename ?? filename;
14
+ globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);
9
15
  };
10
16
  const getFileHash = (filePath) => {
11
- const hash = crypto.SHA3(filePath);
12
- return hash.toString(crypto.enc.Base64).replace(/[^A-Z\d]/gi, "").substring(0, 20);
13
- };
14
- export {
15
- defineDirname,
16
- getFileHash
17
+ return crypto.SHA3(filePath).toString(crypto.enc.Base64).replace(/[^A-Z\d]/gi, "").substring(0, 20);
17
18
  };
19
+
20
+ //#endregion
21
+ export { defineDirname, getFileHash };
18
22
  //# sourceMappingURL=utils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["import { isESModule } from '@intlayer/config';\nimport crypto from 'crypto-js';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\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('url').pathToFileURL(__filename).toString();\n\n globalThis.__filename = globalThis.__filename ?? filename;\n globalThis.__dirname = globalThis.__dirname ?? path.dirname(__filename);\n};\n\nexport const getFileHash = (filePath: string) => {\n const hash = crypto.SHA3(filePath);\n\n return hash\n .toString(crypto.enc.Base64)\n .replace(/[^A-Z\\d]/gi, '')\n .substring(0, 20);\n};\n"],"mappings":"AAAA,SAAS,kBAAkB;AAC3B,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAKvB,MAAM,gBAAgB,MAAM;AACjC,QAAM,WAAW,aACb,cAAc,YAAY,GAAG,IAC7B,QAAQ,KAAK,EAAE,cAAc,UAAU,EAAE,SAAS;AAEtD,aAAW,aAAa,WAAW,cAAc;AACjD,aAAW,YAAY,WAAW,aAAa,KAAK,QAAQ,UAAU;AACxE;AAEO,MAAM,cAAc,CAAC,aAAqB;AAC/C,QAAM,OAAO,OAAO,KAAK,QAAQ;AAEjC,SAAO,KACJ,SAAS,OAAO,IAAI,MAAM,EAC1B,QAAQ,cAAc,EAAE,EACxB,UAAU,GAAG,EAAE;AACpB;","names":[]}
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';\nimport crypto from 'crypto-js';\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\nexport const getFileHash = (filePath: string) => {\n const hash = crypto.SHA3(filePath);\n\n return hash\n .toString(crypto.enc.Base64)\n .replace(/[^A-Z\\d]/gi, '')\n .substring(0, 20);\n};\n"],"mappings":";;;;;;;;;;AAQA,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;;AAGzE,MAAa,eAAe,aAAqB;AAG/C,QAFa,OAAO,KAAK,SAAS,CAG/B,SAAS,OAAO,IAAI,OAAO,CAC3B,QAAQ,cAAc,GAAG,CACzB,UAAU,GAAG,GAAG"}
@@ -1,28 +1,26 @@
1
+ import { logger } from "@intlayer/config";
1
2
  import { prepareIntlayer, watch } from "@intlayer/chokidar";
2
- import { getConfiguration, logger } from "@intlayer/config";
3
- class IntlayerPlugin {
4
- isWatching = false;
5
- // Flag to ensure we only start the watcher after the first build
6
- configuration = getConfiguration();
7
- async apply(compiler) {
8
- if (this.configuration.content.watch) {
9
- watch({ configuration: this.configuration });
10
- }
11
- compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
12
- if (!this.isWatching) {
13
- try {
14
- await prepareIntlayer(this.configuration);
15
- this.isWatching = true;
16
- } catch (error) {
17
- logger(`Error in IntlayerPlugin: ${error}`, {
18
- level: "error"
19
- });
20
- }
21
- }
22
- });
23
- }
24
- }
25
- export {
26
- IntlayerPlugin
3
+
4
+ //#region src/webpack-plugin.ts
5
+ var IntlayerPlugin = class {
6
+ isWatching = false;
7
+ configuration;
8
+ constructor(configuration) {
9
+ this.configuration = configuration;
10
+ }
11
+ async apply(compiler) {
12
+ if (this.configuration.content.watch) watch({ configuration: this.configuration });
13
+ compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
14
+ if (!this.isWatching) try {
15
+ await prepareIntlayer(this.configuration);
16
+ this.isWatching = true;
17
+ } catch (error) {
18
+ logger(`Error in IntlayerPlugin: ${error}`, { level: "error" });
19
+ }
20
+ });
21
+ }
27
22
  };
23
+
24
+ //#endregion
25
+ export { IntlayerPlugin };
28
26
  //# sourceMappingURL=webpack-plugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { getConfiguration, logger } from '@intlayer/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 = getConfiguration();\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":"AAAA,SAAS,iBAAiB,aAAa;AACvC,SAAS,kBAAkB,cAAc;AAIlC,MAAM,eAAe;AAAA,EAClB,aAAa;AAAA;AAAA,EACb,gBAAgB,iBAAiB;AAAA,EAEzC,MAAM,MAAM,UAAmC;AAC7C,QAAI,KAAK,cAAc,QAAQ,OAAO;AAEpC,YAAM,EAAE,eAAe,KAAK,cAAc,CAAC;AAAA,IAC7C;AAEA,aAAS,MAAM,cAAc,WAAW,kBAAkB,YAAY;AACpE,UAAI,CAAC,KAAK,YAAY;AACpB,YAAI;AACF,gBAAM,gBAAgB,KAAK,aAAa;AACxC,eAAK,aAAa;AAAA,QACpB,SAAS,OAAO;AACd,iBAAO,4BAA4B,KAAK,IAAI;AAAA,YAC1C,OAAO;AAAA,UACT,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
1
+ {"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport { logger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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":";;;;AAMA,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,143 +1,88 @@
1
- import { getConfiguration } from "@intlayer/config";
2
- import { join } from "path";
3
- import { getEntries } from "./getEntries.mjs";
4
1
  import { defineDirname } from "./utils.mjs";
2
+ import { getEntries } from "./getEntries.mjs";
5
3
  import { IntlayerPlugin } from "./webpack-plugin.mjs";
6
- const { content } = getConfiguration();
7
- const { fileExtensions } = content;
8
- defineDirname();
4
+ import { join } from "node:path";
5
+ import { getConfiguration } from "@intlayer/config";
6
+
7
+ //#region src/webpack.config.ts
9
8
  const devServerConfig = {
10
- // Enable hot module replacement
11
- hot: true,
12
- // Open the browser
13
- open: false,
14
- liveReload: false,
15
- // Enable compression
16
- compress: true,
17
- // History API fallback
18
- historyApiFallback: false,
19
- // Host and port
20
- host: "localhost",
21
- port: 8080,
22
- watchFiles: "./src/",
23
- // watchedFilesPatternWithPath,
24
- devMiddleware: {
25
- // Enable write to disk to reuse the output
26
- writeToDisk: true
27
- },
28
- // Content base
29
- static: {}
30
- };
31
- const webpackConfig = {
32
- // Define the environment mode (development or production)
33
- mode: "production",
34
- // or 'production'
35
- // Entry point of the application
36
- target: "node",
37
- // Specifies the target environment
38
- entry: getEntries,
39
- output: {
40
- clean: true,
41
- // Clean the output directory before emit
42
- library: "IntlLayerContent",
43
- libraryTarget: "umd",
44
- filename: `[name].bundle.js`
45
- },
46
- cache: false,
47
- devtool: "source-map",
48
- // stats: {
49
- // preset: 'errors-only',
50
- // warnings: false,
51
- // },
52
- ignoreWarnings: [/./],
53
- resolve: {
54
- // Resolve TypeScript, JavaScript and JSON files
55
- extensions: [".ts", ".js", ".json", ".wasm", ".ts", ".tsx", ".mjs", ".cjs"],
56
- modules: [
57
- // To find the loader module
58
- join(globalThis.__dirname, "..", "node_modules"),
59
- // In the project node_modules
60
- join(process.cwd(), "node_modules"),
61
- // In the project node_modules
62
- join(process.cwd(), "node_modules", "intlayer-cli", "node_modules"),
63
- // Or via another project by importing intlayer
64
- join(
65
- process.cwd(),
66
- "node_modules",
67
- "intlayer-cli",
68
- "node_modules",
69
- "@intlayer/webpack",
70
- "node_modules"
71
- )
72
- // Or via another project by importing intlayer
73
- ]
74
- },
75
- resolveLoader: {
76
- // Configure how Webpack finds `loader` modules.
77
- modules: [
78
- // To find the loader module
79
- join(process.cwd(), "node_modules"),
80
- // In the project node_modules
81
- join(process.cwd(), "node_modules", "@intlayer/webpack", "node_modules"),
82
- // Or via another project by importing @intlayer/webpack
83
- join(
84
- process.cwd(),
85
- "node_modules",
86
- "intlayer-cli",
87
- "node_modules",
88
- "@intlayer/webpack",
89
- "node_modules"
90
- )
91
- // Or via another project by importing intlayer
92
- ]
93
- },
94
- module: {
95
- rules: [
96
- {
97
- // Rule for .content.ts files
98
- test: new RegExp(`(${fileExtensions.join("|")})$`),
99
- use: [
100
- {
101
- // Transpile with esbuild-loader
102
- loader: "esbuild-loader",
103
- options: {
104
- // JavaScript version to compile to
105
- target: "es2015"
106
- }
107
- }
108
- // {
109
- // // Custom loader to process the transpiled code
110
- // loader: resolve('./intlayer-loader'),
111
- // },
112
- ]
113
- },
114
- {
115
- test: /\.node$/,
116
- loader: "node-loader"
117
- },
118
- // Use esbuild to compile JavaScript & TypeScript
119
- {
120
- // Match `.js`, `.jsx`, `.ts` or `.tsx` files
121
- test: /\.(jsx|js|ts|tsx|mjs|cjs)?$/,
122
- loader: "esbuild-loader",
123
- options: {
124
- // JavaScript version to compile to
125
- target: "es2015"
126
- }
127
- }
128
- // JSON files are supported natively by Webpack 5, no specific loader required
129
- ]
130
- },
131
- devServer: devServerConfig,
132
- plugins: [
133
- new IntlayerPlugin()
134
- // new HotModuleReplacementPlugin()
135
- ]
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: {}
136
19
  };
137
- var webpack_config_default = webpackConfig;
138
- export {
139
- webpack_config_default as default,
140
- devServerConfig,
141
- webpackConfig
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: /* @__PURE__ */ 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
+ };
142
83
  };
84
+ var webpack_config_default = getWebpackConfig;
85
+
86
+ //#endregion
87
+ export { webpack_config_default as default, devServerConfig, getWebpackConfig };
143
88
  //# sourceMappingURL=webpack.config.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { join } from 'path';\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\nconst { content } = getConfiguration();\nconst { fileExtensions } = content;\n\n/**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\ndefineDirname();\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/', // watchedFilesPatternWithPath,\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 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,\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: ['.ts', '.js', '.json', '.wasm', '.ts', '.tsx', '.mjs', '.cjs'],\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(process.cwd(), 'node_modules', '@intlayer/webpack', 'node_modules'), // 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: [\n new IntlayerPlugin(),\n // new HotModuleReplacementPlugin()\n ],\n};\n\nexport default webpackConfig;\n"],"mappings":"AAAA,SAAS,wBAAwB;AACjC,SAAS,YAAY;AAGrB,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,sBAAsB;AAE/B,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,EAAE,eAAe,IAAI;AAK3B,cAAc;AAGP,MAAM,kBAA0C;AAAA;AAAA,EAErD,KAAK;AAAA;AAAA,EAEL,MAAM;AAAA,EACN,YAAY;AAAA;AAAA,EAGZ,UAAU;AAAA;AAAA,EAGV,oBAAoB;AAAA;AAAA,EAGpB,MAAM;AAAA,EACN,MAAM;AAAA,EAEN,YAAY;AAAA;AAAA,EAEZ,eAAe;AAAA;AAAA,IAEb,aAAa;AAAA,EACf;AAAA;AAAA,EAGA,QAAQ,CAAC;AACX;AAEO,MAAM,gBAAsC;AAAA;AAAA,EAEjD,MAAM;AAAA;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,OAAO;AAAA,EACP,QAAQ;AAAA,IACN,OAAO;AAAA;AAAA,IACP,SAAS;AAAA,IACT,eAAe;AAAA,IACf,UAAU;AAAA,EACZ;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A,UAEP,QAAQ;AAAA,QACV;AAAA,MACF;AAAA;AAAA,IAGF;AAAA,EACF;AAAA,EACA,WAAW;AAAA,EAEX,SAAS;AAAA,IACP,IAAI,eAAe;AAAA;AAAA,EAErB;AACF;AAEA,IAAO,yBAAQ;","names":[]}
1
+ {"version":3,"file":"webpack.config.mjs","names":["devServerConfig: DevServerConfiguration"],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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/', // watchedFilesPatternWithPath,\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 entries = getEntries(configuration);\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: entries,\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,MAAaA,kBAA0C;CAErD,KAAK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 'webpack';
2
- export declare const getEntries: () => EntryObject;
1
+ import { IntlayerConfig } from "@intlayer/types";
2
+ import { EntryObject } from "webpack";
3
+
4
+ //#region src/getEntries.d.ts
5
+ declare const getEntries: (configuration: IntlayerConfig) => EntryObject;
6
+ //#endregion
7
+ export { getEntries };
3
8
  //# sourceMappingURL=getEntries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getEntries.d.ts","sourceRoot":"","sources":["../../src/getEntries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C,eAAO,MAAM,UAAU,QAAO,WAUP,CAAC"}
1
+ {"version":3,"file":"getEntries.d.ts","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":[],"mappings":";;;;cAKa,4BAA6B,mBAAc"}
@@ -1,3 +1,3 @@
1
- export { IntlayerPlugin } from './webpack-plugin';
2
- export { devServerConfig, webpackConfig } from './webpack.config';
3
- //# sourceMappingURL=index.d.ts.map
1
+ import getWebpackConfig, { devServerConfig } from "./webpack.config.js";
2
+ import { IntlayerPlugin } from "./webpack-plugin.js";
3
+ export { IntlayerPlugin, devServerConfig, getWebpackConfig };
@@ -1,6 +1,9 @@
1
+ //#region src/utils.d.ts
1
2
  /**
2
3
  * Set the __dirname global variable to make the config work in both ESM and CJS environments
3
4
  */
4
- export declare const defineDirname: () => void;
5
- export declare const getFileHash: (filePath: string) => string;
5
+ declare const defineDirname: () => void;
6
+ declare const getFileHash: (filePath: string) => string;
7
+ //#endregion
8
+ export { defineDirname, getFileHash };
6
9
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,aAAa,YAOzB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,WAO3C,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","names":[],"sources":["../../src/utils.ts"],"sourcesContent":[],"mappings":";;AAQA;AASA;cATa;cASA"}
@@ -1,7 +1,13 @@
1
- import type { Compiler } from 'webpack';
2
- export declare class IntlayerPlugin {
3
- private isWatching;
4
- private configuration;
5
- apply(compiler: Compiler): Promise<void>;
1
+ import { IntlayerConfig } from "@intlayer/types";
2
+ import { Compiler } from "webpack";
3
+
4
+ //#region src/webpack-plugin.d.ts
5
+ declare class IntlayerPlugin {
6
+ private isWatching;
7
+ private configuration;
8
+ constructor(configuration: IntlayerConfig);
9
+ apply(compiler: Compiler): Promise<void>;
6
10
  }
11
+ //#endregion
12
+ export { IntlayerPlugin };
7
13
  //# sourceMappingURL=webpack-plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack-plugin.d.ts","sourceRoot":"","sources":["../../src/webpack-plugin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,aAAa,CAAsB;IAErC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAmB/C"}
1
+ {"version":3,"file":"webpack-plugin.d.ts","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":[],"mappings":";;;;cAMa,cAAA;;EAAA,QAAA,aAAc;EAIE,WAAA,CAAA,aAAA,EAAA,cAAA;EAIL,KAAA,CAAA,QAAA,EAAA,QAAA,CAAA,EAAW,OAAX,CAAA,IAAA,CAAA"}
@@ -1,6 +1,10 @@
1
- import type { Configuration as WebPackConfiguration } from 'webpack';
2
- import type { Configuration as DevServerConfiguration } from 'webpack-dev-server';
3
- export declare const devServerConfig: DevServerConfiguration;
4
- export declare const webpackConfig: WebPackConfiguration;
5
- export default webpackConfig;
1
+ import { IntlayerConfig } from "@intlayer/types";
2
+ import { Configuration } from "webpack";
3
+ import { Configuration as Configuration$1 } from "webpack-dev-server";
4
+
5
+ //#region src/webpack.config.d.ts
6
+ declare const devServerConfig: Configuration$1;
7
+ declare const getWebpackConfig: (configuration?: IntlayerConfig) => Configuration;
8
+ //#endregion
9
+ export { getWebpackConfig as default, getWebpackConfig, devServerConfig };
6
10
  //# sourceMappingURL=webpack.config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.config.d.ts","sourceRoot":"","sources":["../../src/webpack.config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAclF,eAAO,MAAM,eAAe,EAAE,sBA0B7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,oBAuG3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"webpack.config.d.ts","names":[],"sources":["../../src/webpack.config.ts"],"sourcesContent":[],"mappings":";;;;;cAWa,iBAAiB;cA4BjB,mCACI,mBACd"}