@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.
- package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
- package/dist/cjs/getEntries.cjs +20 -49
- package/dist/cjs/getEntries.cjs.map +1 -1
- package/dist/cjs/index.cjs +6 -34
- package/dist/cjs/utils.cjs +22 -49
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/webpack-plugin.cjs +27 -50
- package/dist/cjs/webpack-plugin.cjs.map +1 -1
- package/dist/cjs/webpack.config.cjs +90 -164
- package/dist/cjs/webpack.config.cjs.map +1 -1
- package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
- package/dist/esm/getEntries.mjs +17 -14
- package/dist/esm/getEntries.mjs.map +1 -1
- package/dist/esm/index.mjs +3 -7
- package/dist/esm/utils.mjs +15 -11
- package/dist/esm/utils.mjs.map +1 -1
- package/dist/esm/webpack-plugin.mjs +23 -25
- package/dist/esm/webpack-plugin.mjs.map +1 -1
- package/dist/esm/webpack.config.mjs +82 -137
- package/dist/esm/webpack.config.mjs.map +1 -1
- package/dist/types/getEntries.d.ts +7 -2
- package/dist/types/getEntries.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utils.d.ts +5 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/webpack-plugin.d.ts +11 -5
- package/dist/types/webpack-plugin.d.ts.map +1 -1
- package/dist/types/webpack.config.d.ts +9 -5
- package/dist/types/webpack.config.d.ts.map +1 -1
- package/package.json +40 -47
- package/LICENSE +0 -202
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
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") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
exports.__toESM = __toESM;
|
package/dist/cjs/getEntries.cjs
CHANGED
|
@@ -1,51 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_utils = require('./utils.cjs');
|
|
3
|
+
let fast_glob = require("fast-glob");
|
|
4
|
+
fast_glob = require_rolldown_runtime.__toESM(fast_glob);
|
|
5
|
+
|
|
6
|
+
//#region src/getEntries.ts
|
|
7
|
+
const getEntries = (configuration) => {
|
|
8
|
+
const { content } = configuration;
|
|
9
|
+
const { watchedFilesPatternWithPath } = content;
|
|
10
|
+
return fast_glob.default.sync(watchedFilesPatternWithPath).reduce((obj, el) => {
|
|
11
|
+
const hash = require_utils.getFileHash(el);
|
|
12
|
+
obj[`intlayer-content/${hash}`] = {
|
|
13
|
+
import: el,
|
|
14
|
+
dependOn: void 0
|
|
15
|
+
};
|
|
16
|
+
return obj;
|
|
17
|
+
}, {});
|
|
11
18
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var getEntries_exports = {};
|
|
30
|
-
__export(getEntries_exports, {
|
|
31
|
-
getEntries: () => getEntries
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(getEntries_exports);
|
|
34
|
-
var import_config = require("@intlayer/config");
|
|
35
|
-
var import_fast_glob = __toESM(require("fast-glob"));
|
|
36
|
-
var import_utils = require('./utils.cjs');
|
|
37
|
-
const { content } = (0, import_config.getConfiguration)();
|
|
38
|
-
const { watchedFilesPatternWithPath } = content;
|
|
39
|
-
const getEntries = () => import_fast_glob.default.sync(watchedFilesPatternWithPath).reduce((obj, el) => {
|
|
40
|
-
const hash = (0, import_utils.getFileHash)(el);
|
|
41
|
-
obj[`intlayer-content/${hash}`] = {
|
|
42
|
-
import: el,
|
|
43
|
-
dependOn: void 0
|
|
44
|
-
};
|
|
45
|
-
return obj;
|
|
46
|
-
}, {});
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
getEntries
|
|
50
|
-
});
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.getEntries = getEntries;
|
|
51
22
|
//# sourceMappingURL=getEntries.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getEntries.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"getEntries.cjs","names":["fg","getFileHash"],"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,QAXgBA,kBAAG,KAAK,4BAA4B,CAAC,QAAQ,KAAK,OAAO;EACvE,MAAM,OAAOC,0BAAY,GAAG;AAE5B,MAAI,oBAAoB,UAAU;GAChC,QAAQ;GACR,UAAU;GACX;AAED,SAAO;IACN,EAAE,CAAgB"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var index_exports = {};
|
|
20
|
-
__export(index_exports, {
|
|
21
|
-
IntlayerPlugin: () => import_webpack_plugin.IntlayerPlugin,
|
|
22
|
-
devServerConfig: () => import_webpack.devServerConfig,
|
|
23
|
-
webpackConfig: () => import_webpack.webpackConfig
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(index_exports);
|
|
26
|
-
var import_webpack_plugin = require('./webpack-plugin.cjs');
|
|
27
|
-
var import_webpack = require('./webpack.config.cjs');
|
|
28
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
-
0 && (module.exports = {
|
|
30
|
-
IntlayerPlugin,
|
|
31
|
-
devServerConfig,
|
|
32
|
-
webpackConfig
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
const require_webpack_plugin = require('./webpack-plugin.cjs');
|
|
2
|
+
const require_webpack_config = require('./webpack.config.cjs');
|
|
3
|
+
|
|
4
|
+
exports.IntlayerPlugin = require_webpack_plugin.IntlayerPlugin;
|
|
5
|
+
exports.devServerConfig = require_webpack_config.devServerConfig;
|
|
6
|
+
exports.getWebpackConfig = require_webpack_config.getWebpackConfig;
|
package/dist/cjs/utils.cjs
CHANGED
|
@@ -1,54 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var utils_exports = {};
|
|
30
|
-
__export(utils_exports, {
|
|
31
|
-
defineDirname: () => defineDirname,
|
|
32
|
-
getFileHash: () => getFileHash
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(utils_exports);
|
|
35
|
-
var import_config = require("@intlayer/config");
|
|
36
|
-
var import_crypto_js = __toESM(require("crypto-js"));
|
|
37
|
-
var import_path = __toESM(require("path"));
|
|
38
|
-
var import_url = require("url");
|
|
39
|
-
const import_meta = {};
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
4
|
+
let node_url = require("node:url");
|
|
5
|
+
node_url = require_rolldown_runtime.__toESM(node_url);
|
|
6
|
+
let __intlayer_config = require("@intlayer/config");
|
|
7
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
8
|
+
let crypto_js = require("crypto-js");
|
|
9
|
+
crypto_js = require_rolldown_runtime.__toESM(crypto_js);
|
|
10
|
+
|
|
11
|
+
//#region src/utils.ts
|
|
12
|
+
/**
|
|
13
|
+
* Set the __dirname global variable to make the config work in both ESM and CJS environments
|
|
14
|
+
*/
|
|
40
15
|
const defineDirname = () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
16
|
+
const filename = __intlayer_config.isESModule ? (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href) : require("node:url").pathToFileURL(__filename).toString();
|
|
17
|
+
globalThis.__filename = globalThis.__filename ?? filename;
|
|
18
|
+
globalThis.__dirname = globalThis.__dirname ?? node_path.default.dirname(__filename);
|
|
44
19
|
};
|
|
45
20
|
const getFileHash = (filePath) => {
|
|
46
|
-
|
|
47
|
-
return hash.toString(import_crypto_js.default.enc.Base64).replace(/[^A-Z\d]/gi, "").substring(0, 20);
|
|
21
|
+
return crypto_js.default.SHA3(filePath).toString(crypto_js.default.enc.Base64).replace(/[^A-Z\d]/gi, "").substring(0, 20);
|
|
48
22
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.defineDirname = defineDirname;
|
|
26
|
+
exports.getFileHash = getFileHash;
|
|
54
27
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/cjs/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["isESModule","path","crypto"],"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,WAAWA,yGACiB,GAC9B,QAAQ,WAAW,CAAC,cAAc,WAAW,CAAC,UAAU;AAE5D,YAAW,aAAa,WAAW,cAAc;AACjD,YAAW,YAAY,WAAW,aAAaC,kBAAK,QAAQ,WAAW;;AAGzE,MAAa,eAAe,aAAqB;AAG/C,QAFaC,kBAAO,KAAK,SAAS,CAG/B,SAASA,kBAAO,IAAI,OAAO,CAC3B,QAAQ,cAAc,GAAG,CACzB,UAAU,GAAG,GAAG"}
|
|
@@ -1,52 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __intlayer_config = require("@intlayer/config");
|
|
3
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
4
|
+
let __intlayer_chokidar = require("@intlayer/chokidar");
|
|
5
|
+
__intlayer_chokidar = require_rolldown_runtime.__toESM(__intlayer_chokidar);
|
|
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.watch)({ configuration: this.configuration });
|
|
16
|
+
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
17
|
+
if (!this.isWatching) try {
|
|
18
|
+
await (0, __intlayer_chokidar.prepareIntlayer)(this.configuration);
|
|
19
|
+
this.isWatching = true;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
(0, __intlayer_config.logger)(`Error in IntlayerPlugin: ${error}`, { level: "error" });
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
9
25
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var webpack_plugin_exports = {};
|
|
20
|
-
__export(webpack_plugin_exports, {
|
|
21
|
-
IntlayerPlugin: () => IntlayerPlugin
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(webpack_plugin_exports);
|
|
24
|
-
var import_chokidar = require("@intlayer/chokidar");
|
|
25
|
-
var import_config = require("@intlayer/config");
|
|
26
|
-
class IntlayerPlugin {
|
|
27
|
-
isWatching = false;
|
|
28
|
-
// Flag to ensure we only start the watcher after the first build
|
|
29
|
-
configuration = (0, import_config.getConfiguration)();
|
|
30
|
-
async apply(compiler) {
|
|
31
|
-
if (this.configuration.content.watch) {
|
|
32
|
-
(0, import_chokidar.watch)({ configuration: this.configuration });
|
|
33
|
-
}
|
|
34
|
-
compiler.hooks.beforeCompile.tapPromise("IntlayerPlugin", async () => {
|
|
35
|
-
if (!this.isWatching) {
|
|
36
|
-
try {
|
|
37
|
-
await (0, import_chokidar.prepareIntlayer)(this.configuration);
|
|
38
|
-
this.isWatching = true;
|
|
39
|
-
} catch (error) {
|
|
40
|
-
(0, import_config.logger)(`Error in IntlayerPlugin: ${error}`, {
|
|
41
|
-
level: "error"
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
IntlayerPlugin
|
|
51
|
-
});
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.IntlayerPlugin = IntlayerPlugin;
|
|
52
29
|
//# sourceMappingURL=webpack-plugin.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer, watch } from '@intlayer/chokidar';\nimport {
|
|
1
|
+
{"version":3,"file":"webpack-plugin.cjs","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,gCAAM,EAAE,eAAe,KAAK,eAAe,CAAC;AAG9C,WAAS,MAAM,cAAc,WAAW,kBAAkB,YAAY;AACpE,OAAI,CAAC,KAAK,WACR,KAAI;AACF,mDAAsB,KAAK,cAAc;AACzC,SAAK,aAAa;YACX,OAAO;AACd,kCAAO,4BAA4B,SAAS,EAC1C,OAAO,SACR,CAAC;;IAGN"}
|
|
@@ -1,168 +1,94 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var webpack_config_exports = {};
|
|
20
|
-
__export(webpack_config_exports, {
|
|
21
|
-
default: () => webpack_config_default,
|
|
22
|
-
devServerConfig: () => devServerConfig,
|
|
23
|
-
webpackConfig: () => webpackConfig
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(webpack_config_exports);
|
|
26
|
-
var import_config = require("@intlayer/config");
|
|
27
|
-
var import_path = require("path");
|
|
28
|
-
var import_getEntries = require('./getEntries.cjs');
|
|
29
|
-
var import_utils = require('./utils.cjs');
|
|
30
|
-
var import_webpack_plugin = require('./webpack-plugin.cjs');
|
|
31
|
-
const { content } = (0, import_config.getConfiguration)();
|
|
32
|
-
const { fileExtensions } = content;
|
|
33
|
-
(0, import_utils.defineDirname)();
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
+
const require_utils = require('./utils.cjs');
|
|
4
|
+
const require_getEntries = require('./getEntries.cjs');
|
|
5
|
+
const require_webpack_plugin = require('./webpack-plugin.cjs');
|
|
6
|
+
let node_path = require("node:path");
|
|
7
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
8
|
+
let __intlayer_config = require("@intlayer/config");
|
|
9
|
+
__intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
|
|
10
|
+
|
|
11
|
+
//#region src/webpack.config.ts
|
|
34
12
|
const devServerConfig = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
host: "localhost",
|
|
46
|
-
port: 8080,
|
|
47
|
-
watchFiles: "./src/",
|
|
48
|
-
// watchedFilesPatternWithPath,
|
|
49
|
-
devMiddleware: {
|
|
50
|
-
// Enable write to disk to reuse the output
|
|
51
|
-
writeToDisk: true
|
|
52
|
-
},
|
|
53
|
-
// Content base
|
|
54
|
-
static: {}
|
|
13
|
+
hot: true,
|
|
14
|
+
open: false,
|
|
15
|
+
liveReload: false,
|
|
16
|
+
compress: true,
|
|
17
|
+
historyApiFallback: false,
|
|
18
|
+
host: "localhost",
|
|
19
|
+
port: 8080,
|
|
20
|
+
watchFiles: "./src/",
|
|
21
|
+
devMiddleware: { writeToDisk: true },
|
|
22
|
+
static: {}
|
|
55
23
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
module: {
|
|
120
|
-
rules: [
|
|
121
|
-
{
|
|
122
|
-
// Rule for .content.ts files
|
|
123
|
-
test: new RegExp(`(${fileExtensions.join("|")})$`),
|
|
124
|
-
use: [
|
|
125
|
-
{
|
|
126
|
-
// Transpile with esbuild-loader
|
|
127
|
-
loader: "esbuild-loader",
|
|
128
|
-
options: {
|
|
129
|
-
// JavaScript version to compile to
|
|
130
|
-
target: "es2015"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
// {
|
|
134
|
-
// // Custom loader to process the transpiled code
|
|
135
|
-
// loader: resolve('./intlayer-loader'),
|
|
136
|
-
// },
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
test: /\.node$/,
|
|
141
|
-
loader: "node-loader"
|
|
142
|
-
},
|
|
143
|
-
// Use esbuild to compile JavaScript & TypeScript
|
|
144
|
-
{
|
|
145
|
-
// Match `.js`, `.jsx`, `.ts` or `.tsx` files
|
|
146
|
-
test: /\.(jsx|js|ts|tsx|mjs|cjs)?$/,
|
|
147
|
-
loader: "esbuild-loader",
|
|
148
|
-
options: {
|
|
149
|
-
// JavaScript version to compile to
|
|
150
|
-
target: "es2015"
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
// JSON files are supported natively by Webpack 5, no specific loader required
|
|
154
|
-
]
|
|
155
|
-
},
|
|
156
|
-
devServer: devServerConfig,
|
|
157
|
-
plugins: [
|
|
158
|
-
new import_webpack_plugin.IntlayerPlugin()
|
|
159
|
-
// new HotModuleReplacementPlugin()
|
|
160
|
-
]
|
|
24
|
+
const getWebpackConfig = (configuration = (0, __intlayer_config.getConfiguration)()) => {
|
|
25
|
+
const { fileExtensions } = configuration.content;
|
|
26
|
+
/**
|
|
27
|
+
* Set the __dirname global variable to make the config work in both ESM and CJS environments
|
|
28
|
+
*/
|
|
29
|
+
require_utils.defineDirname();
|
|
30
|
+
return {
|
|
31
|
+
mode: "production",
|
|
32
|
+
target: "node",
|
|
33
|
+
entry: require_getEntries.getEntries(configuration),
|
|
34
|
+
output: {
|
|
35
|
+
clean: true,
|
|
36
|
+
library: "IntlLayerContent",
|
|
37
|
+
libraryTarget: "umd",
|
|
38
|
+
filename: `[name].bundle.js`
|
|
39
|
+
},
|
|
40
|
+
cache: false,
|
|
41
|
+
devtool: "source-map",
|
|
42
|
+
ignoreWarnings: [/./],
|
|
43
|
+
resolve: {
|
|
44
|
+
extensions: [
|
|
45
|
+
".ts",
|
|
46
|
+
".js",
|
|
47
|
+
".json",
|
|
48
|
+
".wasm",
|
|
49
|
+
".ts",
|
|
50
|
+
".tsx",
|
|
51
|
+
".mjs",
|
|
52
|
+
".cjs"
|
|
53
|
+
],
|
|
54
|
+
modules: [
|
|
55
|
+
(0, node_path.join)(globalThis.__dirname, "..", "node_modules"),
|
|
56
|
+
(0, node_path.join)(process.cwd(), "node_modules"),
|
|
57
|
+
(0, node_path.join)(process.cwd(), "node_modules", "intlayer-cli", "node_modules"),
|
|
58
|
+
(0, node_path.join)(process.cwd(), "node_modules", "intlayer-cli", "node_modules", "@intlayer/webpack", "node_modules")
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
resolveLoader: { modules: [
|
|
62
|
+
(0, node_path.join)(process.cwd(), "node_modules"),
|
|
63
|
+
(0, node_path.join)(process.cwd(), "node_modules", "@intlayer/webpack", "node_modules"),
|
|
64
|
+
(0, node_path.join)(process.cwd(), "node_modules", "intlayer-cli", "node_modules", "@intlayer/webpack", "node_modules")
|
|
65
|
+
] },
|
|
66
|
+
module: { rules: [
|
|
67
|
+
{
|
|
68
|
+
test: /* @__PURE__ */ new RegExp(`(${fileExtensions.join("|")})$`),
|
|
69
|
+
use: [{
|
|
70
|
+
loader: "esbuild-loader",
|
|
71
|
+
options: { target: "es2015" }
|
|
72
|
+
}]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
test: /\.node$/,
|
|
76
|
+
loader: "node-loader"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
test: /\.(jsx|js|ts|tsx|mjs|cjs)?$/,
|
|
80
|
+
loader: "esbuild-loader",
|
|
81
|
+
options: { target: "es2015" }
|
|
82
|
+
}
|
|
83
|
+
] },
|
|
84
|
+
devServer: devServerConfig,
|
|
85
|
+
plugins: [new require_webpack_plugin.IntlayerPlugin(configuration)]
|
|
86
|
+
};
|
|
161
87
|
};
|
|
162
|
-
var webpack_config_default =
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
88
|
+
var webpack_config_default = getWebpackConfig;
|
|
89
|
+
|
|
90
|
+
//#endregion
|
|
91
|
+
exports.default = webpack_config_default;
|
|
92
|
+
exports.devServerConfig = devServerConfig;
|
|
93
|
+
exports.getWebpackConfig = getWebpackConfig;
|
|
168
94
|
//# sourceMappingURL=webpack.config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport {
|
|
1
|
+
{"version":3,"file":"webpack.config.cjs","names":["devServerConfig: DevServerConfiguration","getEntries","IntlayerPlugin"],"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;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,yDAAkD,KACzB;CACzB,MAAM,EAAE,mBAAmB,cAAc;;;;AAKzC,8BAAe;AAwHf,QApH4C;EAE1C,MAAM;EAEN,QAAQ;EAER,OARcC,8BAAW,cAAc;EASvC,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,sBAAM,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;;AAKH,6BAAe"}
|