@intlayer/webpack 1.0.1 → 1.2.1
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/{scripts/startServer.cjs → getEntries.cjs} +19 -14
- package/dist/cjs/getEntries.cjs.map +1 -0
- package/dist/cjs/getEntries.d.ts +5 -0
- package/dist/cjs/index.cjs +0 -7
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/utils.cjs +26 -17
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.ts +5 -2
- package/dist/cjs/webpack-plugin.cjs +4 -134
- package/dist/cjs/webpack-plugin.cjs.map +1 -1
- package/dist/cjs/webpack-plugin.d.ts +1 -11
- package/dist/cjs/webpack.config.cjs +28 -25
- package/dist/cjs/webpack.config.cjs.map +1 -1
- package/dist/esm/getEntries.d.mts +5 -0
- package/dist/esm/getEntries.mjs +17 -0
- package/dist/esm/getEntries.mjs.map +1 -0
- package/dist/esm/index.d.mts +0 -2
- package/dist/esm/index.mjs +0 -4
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/utils.d.mts +5 -2
- package/dist/esm/utils.mjs +13 -15
- package/dist/esm/utils.mjs.map +1 -1
- package/dist/esm/webpack-plugin.d.mts +1 -11
- package/dist/esm/webpack-plugin.mjs +4 -134
- package/dist/esm/webpack-plugin.mjs.map +1 -1
- package/dist/esm/webpack.config.mjs +29 -26
- package/dist/esm/webpack.config.mjs.map +1 -1
- package/package.json +11 -15
- package/src/getEntries.ts +19 -0
- package/src/index.ts +2 -12
- package/src/utils.ts +19 -19
- package/src/webpack-plugin.ts +5 -180
- package/src/webpack.config.ts +32 -28
- package/dist/cjs/scripts/bundle.cjs +0 -65
- package/dist/cjs/scripts/bundle.cjs.map +0 -1
- package/dist/cjs/scripts/bundle.d.ts +0 -7
- package/dist/cjs/scripts/index.cjs +0 -25
- package/dist/cjs/scripts/index.cjs.map +0 -1
- package/dist/cjs/scripts/index.d.ts +0 -3
- package/dist/cjs/scripts/startServer.cjs.map +0 -1
- package/dist/cjs/scripts/startServer.d.ts +0 -5
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryList.cjs +0 -76
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryList.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_main/createDictionaryList.d.ts +0 -6
- package/dist/cjs/transpiler/dictionary_to_main/index.cjs +0 -23
- package/dist/cjs/transpiler/dictionary_to_main/index.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_main/index.d.ts +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs +0 -87
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/createModuleAugmentation.d.ts +0 -7
- package/dist/cjs/transpiler/dictionary_to_type/createType.cjs +0 -110
- package/dist/cjs/transpiler/dictionary_to_type/createType.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/createType.d.ts +0 -42
- package/dist/cjs/transpiler/dictionary_to_type/index.cjs +0 -25
- package/dist/cjs/transpiler/dictionary_to_type/index.cjs.map +0 -1
- package/dist/cjs/transpiler/dictionary_to_type/index.d.ts +0 -3
- package/dist/cjs/transpiler/intlater_module_to_dictionary/extractNestedJSON.cjs +0 -45
- package/dist/cjs/transpiler/intlater_module_to_dictionary/extractNestedJSON.cjs.map +0 -1
- package/dist/cjs/transpiler/intlater_module_to_dictionary/extractNestedJSON.d.ts +0 -44
- package/dist/cjs/transpiler/intlater_module_to_dictionary/index.cjs +0 -27
- package/dist/cjs/transpiler/intlater_module_to_dictionary/index.cjs.map +0 -1
- package/dist/cjs/transpiler/intlater_module_to_dictionary/index.d.ts +0 -4
- package/dist/cjs/transpiler/intlater_module_to_dictionary/processModule.cjs +0 -67
- package/dist/cjs/transpiler/intlater_module_to_dictionary/processModule.cjs.map +0 -1
- package/dist/cjs/transpiler/intlater_module_to_dictionary/processModule.d.ts +0 -8
- package/dist/cjs/transpiler/intlater_module_to_dictionary/transpileBundledCode.cjs +0 -96
- package/dist/cjs/transpiler/intlater_module_to_dictionary/transpileBundledCode.cjs.map +0 -1
- package/dist/cjs/transpiler/intlater_module_to_dictionary/transpileBundledCode.d.ts +0 -6
- package/dist/esm/scripts/bundle.d.mts +0 -7
- package/dist/esm/scripts/bundle.mjs +0 -40
- package/dist/esm/scripts/bundle.mjs.map +0 -1
- package/dist/esm/scripts/index.d.mts +0 -3
- package/dist/esm/scripts/index.mjs +0 -3
- package/dist/esm/scripts/index.mjs.map +0 -1
- package/dist/esm/scripts/startServer.d.mts +0 -5
- package/dist/esm/scripts/startServer.mjs +0 -12
- package/dist/esm/scripts/startServer.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryList.d.mts +0 -6
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryList.mjs +0 -52
- package/dist/esm/transpiler/dictionary_to_main/createDictionaryList.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_main/index.d.mts +0 -1
- package/dist/esm/transpiler/dictionary_to_main/index.mjs +0 -2
- package/dist/esm/transpiler/dictionary_to_main/index.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.d.mts +0 -7
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs +0 -62
- package/dist/esm/transpiler/dictionary_to_type/createModuleAugmentation.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_type/createType.d.mts +0 -42
- package/dist/esm/transpiler/dictionary_to_type/createType.mjs +0 -86
- package/dist/esm/transpiler/dictionary_to_type/createType.mjs.map +0 -1
- package/dist/esm/transpiler/dictionary_to_type/index.d.mts +0 -3
- package/dist/esm/transpiler/dictionary_to_type/index.mjs +0 -3
- package/dist/esm/transpiler/dictionary_to_type/index.mjs.map +0 -1
- package/dist/esm/transpiler/intlater_module_to_dictionary/extractNestedJSON.d.mts +0 -44
- package/dist/esm/transpiler/intlater_module_to_dictionary/extractNestedJSON.mjs +0 -21
- package/dist/esm/transpiler/intlater_module_to_dictionary/extractNestedJSON.mjs.map +0 -1
- package/dist/esm/transpiler/intlater_module_to_dictionary/index.d.mts +0 -4
- package/dist/esm/transpiler/intlater_module_to_dictionary/index.mjs +0 -4
- package/dist/esm/transpiler/intlater_module_to_dictionary/index.mjs.map +0 -1
- package/dist/esm/transpiler/intlater_module_to_dictionary/processModule.d.mts +0 -8
- package/dist/esm/transpiler/intlater_module_to_dictionary/processModule.mjs +0 -43
- package/dist/esm/transpiler/intlater_module_to_dictionary/processModule.mjs.map +0 -1
- package/dist/esm/transpiler/intlater_module_to_dictionary/transpileBundledCode.d.mts +0 -6
- package/dist/esm/transpiler/intlater_module_to_dictionary/transpileBundledCode.mjs +0 -72
- package/dist/esm/transpiler/intlater_module_to_dictionary/transpileBundledCode.mjs.map +0 -1
- package/src/scripts/bundle.ts +0 -44
- package/src/scripts/index.ts +0 -2
- package/src/scripts/startServer.ts +0 -14
- package/src/transpiler/dictionary_to_main/createDictionaryList.ts +0 -65
- package/src/transpiler/dictionary_to_main/index.ts +0 -1
- package/src/transpiler/dictionary_to_type/createModuleAugmentation.ts +0 -95
- package/src/transpiler/dictionary_to_type/createType.ts +0 -140
- package/src/transpiler/dictionary_to_type/index.ts +0 -2
- package/src/transpiler/intlater_module_to_dictionary/extractNestedJSON.ts +0 -60
- package/src/transpiler/intlater_module_to_dictionary/index.ts +0 -3
- package/src/transpiler/intlater_module_to_dictionary/processModule.ts +0 -69
- package/src/transpiler/intlater_module_to_dictionary/transpileBundledCode.ts +0 -107
|
@@ -16,21 +16,26 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
21
|
-
|
|
19
|
+
var getEntries_exports = {};
|
|
20
|
+
__export(getEntries_exports, {
|
|
21
|
+
getEntries: () => getEntries
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
23
|
+
module.exports = __toCommonJS(getEntries_exports);
|
|
24
|
+
var import_config = require("@intlayer/config");
|
|
25
|
+
var import_glob = require("glob");
|
|
26
|
+
var import_utils = require('./utils.cjs');
|
|
27
|
+
const { content } = (0, import_config.getConfiguration)();
|
|
28
|
+
const { watchedFilesPatternWithPath } = content;
|
|
29
|
+
const getEntries = () => (0, import_glob.sync)(watchedFilesPatternWithPath).reduce((obj, el) => {
|
|
30
|
+
const hash = (0, import_utils.getFileHash)(el);
|
|
31
|
+
obj[`intlayer-content/${hash}`] = {
|
|
32
|
+
import: el,
|
|
33
|
+
dependOn: void 0
|
|
34
|
+
};
|
|
35
|
+
return obj;
|
|
36
|
+
}, {});
|
|
32
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
38
|
0 && (module.exports = {
|
|
34
|
-
|
|
39
|
+
getEntries
|
|
35
40
|
});
|
|
36
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=getEntries.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { sync } from 'glob';\nimport type { EntryObject } from 'webpack';\nimport { getFileHash } from './utils';\n\nconst { content } = getConfiguration();\nconst { watchedFilesPatternWithPath } = content;\n\nexport const getEntries = (): EntryObject =>\n 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;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AACjC,kBAAqB;AAErB,mBAA4B;AAE5B,MAAM,EAAE,QAAQ,QAAI,gCAAiB;AACrC,MAAM,EAAE,4BAA4B,IAAI;AAEjC,MAAM,aAAa,UACxB,kBAAK,2BAA2B,EAAE,OAAO,CAAC,KAAK,OAAO;AACpD,QAAM,WAAO,0BAAY,EAAE;AAE3B,MAAI,oBAAoB,IAAI,EAAE,IAAI;AAAA,IAChC,QAAQ;AAAA,IACR,UAAU;AAAA,EACZ;AAEA,SAAO;AACT,GAAG,CAAC,CAAgB;","names":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -19,23 +19,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var src_exports = {};
|
|
20
20
|
__export(src_exports, {
|
|
21
21
|
IntLayerPlugin: () => import_webpack_plugin.IntLayerPlugin,
|
|
22
|
-
bundle: () => import_scripts.bundle,
|
|
23
22
|
devServerConfig: () => import_webpack.devServerConfig,
|
|
24
|
-
startServer: () => import_scripts.startServer,
|
|
25
|
-
watch: () => import_scripts.watch,
|
|
26
23
|
webpackConfig: () => import_webpack.webpackConfig
|
|
27
24
|
});
|
|
28
25
|
module.exports = __toCommonJS(src_exports);
|
|
29
|
-
var import_scripts = require('./scripts/index.cjs');
|
|
30
26
|
var import_webpack_plugin = require('./webpack-plugin.cjs');
|
|
31
27
|
var import_webpack = require('./webpack.config.cjs');
|
|
32
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
29
|
0 && (module.exports = {
|
|
34
30
|
IntLayerPlugin,
|
|
35
|
-
bundle,
|
|
36
31
|
devServerConfig,
|
|
37
|
-
startServer,
|
|
38
|
-
watch,
|
|
39
32
|
webpackConfig
|
|
40
33
|
});
|
|
41
34
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { IntLayerPlugin } from './webpack-plugin';\nexport { devServerConfig, webpackConfig } from './webpack.config';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA+B;AAC/B,qBAA+C;","names":[]}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/utils.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,31 +17,38 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var utils_exports = {};
|
|
20
30
|
__export(utils_exports, {
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
defineDirname: () => defineDirname,
|
|
32
|
+
getFileHash: () => getFileHash
|
|
23
33
|
});
|
|
24
34
|
module.exports = __toCommonJS(utils_exports);
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_url = require("url");
|
|
37
|
+
var import_crypto_js = __toESM(require("crypto-js"));
|
|
38
|
+
const import_meta = {};
|
|
39
|
+
const defineDirname = () => {
|
|
40
|
+
const isESModule = typeof import_meta.url === "string";
|
|
41
|
+
const filename = isESModule ? (0, import_url.fileURLToPath)(import_meta.url) : require("url").pathToFileURL(__filename).toString();
|
|
42
|
+
globalThis.__filename = globalThis.__filename ?? filename;
|
|
43
|
+
globalThis.__dirname = globalThis.__dirname ?? import_path.default.dirname(__filename);
|
|
29
44
|
};
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
if (index === 0) {
|
|
34
|
-
return word[0].toUpperCase() + word.slice(1);
|
|
35
|
-
}
|
|
36
|
-
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
37
|
-
});
|
|
38
|
-
return camelCasedWords.join("");
|
|
45
|
+
const getFileHash = (filePath) => {
|
|
46
|
+
const hash = import_crypto_js.default.SHA3(filePath);
|
|
47
|
+
return hash.toString(import_crypto_js.default.enc.Base64).replace(/[^A-Z\d]/gi, "").substring(0, 20);
|
|
39
48
|
};
|
|
40
49
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
50
|
0 && (module.exports = {
|
|
42
|
-
|
|
43
|
-
|
|
51
|
+
defineDirname,
|
|
52
|
+
getFileHash
|
|
44
53
|
});
|
|
45
54
|
//# 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,"sources":["../../src/utils.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\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 isESModule = typeof import.meta.url === 'string';\n\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,iBAA8B;AAC9B,uBAAmB;AAFnB;AAOO,MAAM,gBAAgB,MAAM;AACjC,QAAM,aAAa,OAAO,YAAY,QAAQ;AAE9C,QAAM,WAAW,iBACb,0BAAc,YAAY,GAAG,IAC7B,QAAQ,KAAK,EAAE,cAAc,UAAU,EAAE,SAAS;AAEtD,aAAW,aAAa,WAAW,cAAc;AACjD,aAAW,YAAY,WAAW,aAAa,YAAAA,QAAK,QAAQ,UAAU;AACxE;AAEO,MAAM,cAAc,CAAC,aAAqB;AAC/C,QAAM,OAAO,iBAAAC,QAAO,KAAK,QAAQ;AAEjC,SAAO,KACJ,SAAS,iBAAAA,QAAO,IAAI,MAAM,EAC1B,QAAQ,cAAc,EAAE,EACxB,UAAU,GAAG,EAAE;AACpB;","names":["path","crypto"]}
|
package/dist/cjs/utils.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set the __dirname global variable to make the config work in both ESM and CJS environments
|
|
3
|
+
*/
|
|
4
|
+
declare const defineDirname: () => void;
|
|
1
5
|
declare const getFileHash: (filePath: string) => string;
|
|
2
|
-
declare const transformToCamelCase: (string: string) => string;
|
|
3
6
|
|
|
4
|
-
export {
|
|
7
|
+
export { defineDirname, getFileHash };
|
|
@@ -21,141 +21,11 @@ __export(webpack_plugin_exports, {
|
|
|
21
21
|
IntLayerPlugin: () => IntLayerPlugin
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(webpack_plugin_exports);
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
var import_glob = require("glob");
|
|
27
|
-
var import_webpack = require("webpack");
|
|
28
|
-
var import_createDictionaryList = require('./transpiler/dictionary_to_main/createDictionaryList.cjs');
|
|
29
|
-
var import_createModuleAugmentation = require('./transpiler/dictionary_to_type/createModuleAugmentation.cjs');
|
|
30
|
-
var import_createType = require('./transpiler/dictionary_to_type/createType.cjs');
|
|
31
|
-
var import_transpileBundledCode = require('./transpiler/intlater_module_to_dictionary/transpileBundledCode.cjs');
|
|
32
|
-
var import_utils = require('./utils.cjs');
|
|
33
|
-
const getRelativePath = (filePath) => (0, import_path.relative)(baseDir, filePath);
|
|
34
|
-
const getBundledFilePathFromIntlayerModule = (filePath) => {
|
|
35
|
-
const hash = (0, import_utils.getFileHash)(filePath);
|
|
36
|
-
return `${bundleDir}/${hash}${bundleFileExtension}`;
|
|
37
|
-
};
|
|
38
|
-
const { content } = (0, import_config.getConfiguration)();
|
|
39
|
-
const { bundleDir, baseDir, bundleFileExtension, watchedFilesPatternWithPath } = content;
|
|
24
|
+
var import_chokidar = require("@intlayer/chokidar");
|
|
25
|
+
const persistent = process.env.NODE_ENV === "development";
|
|
40
26
|
class IntLayerPlugin {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
addedFiles;
|
|
44
|
-
constructor() {
|
|
45
|
-
this.managedFiles = /* @__PURE__ */ new Set();
|
|
46
|
-
this.updatedFiles = /* @__PURE__ */ new Set();
|
|
47
|
-
this.addedFiles = /* @__PURE__ */ new Set();
|
|
48
|
-
}
|
|
49
|
-
// function to initialize the dictionaries
|
|
50
|
-
async initDictionaries() {
|
|
51
|
-
const outputFiles = [...this.managedFiles].map(
|
|
52
|
-
(file) => (0, import_path.resolve)(bundleDir, file)
|
|
53
|
-
);
|
|
54
|
-
const dictionaries = await (0, import_transpileBundledCode.transpileBundledCode)(outputFiles) ?? [];
|
|
55
|
-
console.info(
|
|
56
|
-
`Dictionaries:
|
|
57
|
-
${dictionaries.map(getRelativePath).join("\n")}`
|
|
58
|
-
);
|
|
59
|
-
console.info("Building TypeScript types...");
|
|
60
|
-
(0, import_createType.createTypes)(dictionaries);
|
|
61
|
-
console.info("Building type index...");
|
|
62
|
-
(0, import_createModuleAugmentation.createModuleAugmentation)();
|
|
63
|
-
console.info("Building main...");
|
|
64
|
-
(0, import_createDictionaryList.createDictionaryList)();
|
|
65
|
-
}
|
|
66
|
-
// function to process when intlayer module files content are changed
|
|
67
|
-
async processFilesChanges() {
|
|
68
|
-
const dictionaries = await (0, import_transpileBundledCode.transpileBundledCode)([...this.updatedFiles]) ?? [];
|
|
69
|
-
console.info(
|
|
70
|
-
`Updated dictionaries:
|
|
71
|
-
${dictionaries.map(getRelativePath).join("\n")}`
|
|
72
|
-
);
|
|
73
|
-
console.info("Updating TypeScript types...");
|
|
74
|
-
(0, import_createType.createTypes)(dictionaries);
|
|
75
|
-
this.updatedFiles.clear();
|
|
76
|
-
}
|
|
77
|
-
// function to process when new intlayer module is detected
|
|
78
|
-
async processNewFiles() {
|
|
79
|
-
const dictionaries = await (0, import_transpileBundledCode.transpileBundledCode)([...this.addedFiles]) ?? [];
|
|
80
|
-
console.info(
|
|
81
|
-
`New dictionaries:
|
|
82
|
-
${dictionaries.map(getRelativePath).join("\n")}`
|
|
83
|
-
);
|
|
84
|
-
console.info("Building TypeScript types...");
|
|
85
|
-
(0, import_createType.createTypes)(dictionaries);
|
|
86
|
-
console.info("Building type index...");
|
|
87
|
-
(0, import_createModuleAugmentation.createModuleAugmentation)();
|
|
88
|
-
console.info("Building main...");
|
|
89
|
-
(0, import_createDictionaryList.createDictionaryList)();
|
|
90
|
-
this.managedFiles = /* @__PURE__ */ new Set([...this.managedFiles, ...this.addedFiles]);
|
|
91
|
-
this.addedFiles.clear();
|
|
92
|
-
}
|
|
93
|
-
async detectFileAddedOrRemoved() {
|
|
94
|
-
const filesFound = [];
|
|
95
|
-
for (const pattern of watchedFilesPatternWithPath) {
|
|
96
|
-
(0, import_glob.sync)(pattern).map((file) => filesFound.push(file));
|
|
97
|
-
}
|
|
98
|
-
const newFiles = new Set(
|
|
99
|
-
filesFound.filter((x) => !this.managedFiles.has(x))
|
|
100
|
-
);
|
|
101
|
-
const removedFiles = new Set(
|
|
102
|
-
[...this.managedFiles].filter((x) => !filesFound.includes(x))
|
|
103
|
-
);
|
|
104
|
-
if (
|
|
105
|
-
// Check if there is new files
|
|
106
|
-
newFiles.size > 0
|
|
107
|
-
) {
|
|
108
|
-
console.info("New files:", [...newFiles]);
|
|
109
|
-
this.addedFiles = newFiles;
|
|
110
|
-
await this.processNewFiles();
|
|
111
|
-
}
|
|
112
|
-
if (
|
|
113
|
-
// Check if there is removed files
|
|
114
|
-
removedFiles.size > 0
|
|
115
|
-
) {
|
|
116
|
-
console.info("Removed files:", [...removedFiles]);
|
|
117
|
-
this.managedFiles = new Set(
|
|
118
|
-
[...this.managedFiles].filter((x) => !removedFiles.has(x))
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
if (this.updatedFiles.size > 0) {
|
|
122
|
-
await this.processFilesChanges();
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
apply(compiler) {
|
|
126
|
-
compiler.hooks.entryOption.tap("EntryOptionPlugin", (context, entry) => {
|
|
127
|
-
if (typeof entry === "function") {
|
|
128
|
-
new import_webpack.DynamicEntryPlugin(context, entry).apply(compiler);
|
|
129
|
-
}
|
|
130
|
-
return true;
|
|
131
|
-
});
|
|
132
|
-
compiler.hooks.afterEmit.tapAsync(
|
|
133
|
-
"IntLayerPlugin - Process dictionaries",
|
|
134
|
-
async (compilation, callback) => {
|
|
135
|
-
const currentEmitFiles = new Set(Object.keys(compilation.assets));
|
|
136
|
-
if (
|
|
137
|
-
// Check if this first load
|
|
138
|
-
!this.managedFiles.size
|
|
139
|
-
) {
|
|
140
|
-
this.managedFiles = currentEmitFiles;
|
|
141
|
-
await this.initDictionaries();
|
|
142
|
-
}
|
|
143
|
-
await this.detectFileAddedOrRemoved();
|
|
144
|
-
callback();
|
|
145
|
-
}
|
|
146
|
-
);
|
|
147
|
-
compiler.hooks.watchRun.tap(
|
|
148
|
-
"IntLayerPlugin - Change detection",
|
|
149
|
-
(compilation) => {
|
|
150
|
-
if (compilation.modifiedFiles) {
|
|
151
|
-
const updatedFiles = Array.from(compilation.modifiedFiles);
|
|
152
|
-
const outputFileNames = updatedFiles.map(
|
|
153
|
-
getBundledFilePathFromIntlayerModule
|
|
154
|
-
);
|
|
155
|
-
this.updatedFiles = new Set(outputFileNames);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
);
|
|
27
|
+
apply() {
|
|
28
|
+
(0, import_chokidar.watch)({ persistent });
|
|
159
29
|
}
|
|
160
30
|
}
|
|
161
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { watch } from '@intlayer/chokidar';\n\n// Watch mode or on time build\nconst persistent = process.env.NODE_ENV === 'development';\n\nexport class IntLayerPlugin {\n apply(): void {\n watch({ persistent });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAsB;AAGtB,MAAM,aAAa,QAAQ,IAAI,aAAa;AAErC,MAAM,eAAe;AAAA,EAC1B,QAAc;AACZ,+BAAM,EAAE,WAAW,CAAC;AAAA,EACtB;AACF;","names":[]}
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import { Compiler } from 'webpack';
|
|
2
|
-
|
|
3
1
|
declare class IntLayerPlugin {
|
|
4
|
-
|
|
5
|
-
private updatedFiles;
|
|
6
|
-
private addedFiles;
|
|
7
|
-
constructor();
|
|
8
|
-
initDictionaries(): Promise<void>;
|
|
9
|
-
processFilesChanges(): Promise<void>;
|
|
10
|
-
processNewFiles(): Promise<void>;
|
|
11
|
-
detectFileAddedOrRemoved(): Promise<void>;
|
|
12
|
-
apply(compiler: Compiler): void;
|
|
2
|
+
apply(): void;
|
|
13
3
|
}
|
|
14
4
|
|
|
15
5
|
export { IntLayerPlugin };
|
|
@@ -25,21 +25,14 @@ __export(webpack_config_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(webpack_config_exports);
|
|
26
26
|
var import_path = require("path");
|
|
27
27
|
var import_config = require("@intlayer/config");
|
|
28
|
-
var
|
|
28
|
+
var import_getEntries = require('./getEntries.cjs');
|
|
29
29
|
var import_utils = require('./utils.cjs');
|
|
30
30
|
var import_webpack_plugin = require('./webpack-plugin.cjs');
|
|
31
31
|
const { content } = (0, import_config.getConfiguration)({
|
|
32
|
-
verbose:
|
|
32
|
+
verbose: false
|
|
33
33
|
});
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
(obj, el) => {
|
|
37
|
-
const hash = (0, import_utils.getFileHash)(el);
|
|
38
|
-
obj[hash] = el;
|
|
39
|
-
return obj;
|
|
40
|
-
},
|
|
41
|
-
{}
|
|
42
|
-
);
|
|
34
|
+
const { fileExtensions } = content;
|
|
35
|
+
(0, import_utils.defineDirname)();
|
|
43
36
|
const devServerConfig = {
|
|
44
37
|
// Enable hot module replacement
|
|
45
38
|
hot: true,
|
|
@@ -60,9 +53,7 @@ const devServerConfig = {
|
|
|
60
53
|
writeToDisk: true
|
|
61
54
|
},
|
|
62
55
|
// Content base
|
|
63
|
-
static: {
|
|
64
|
-
directory: bundleDir
|
|
65
|
-
}
|
|
56
|
+
static: {}
|
|
66
57
|
};
|
|
67
58
|
const webpackConfig = {
|
|
68
59
|
// Define the environment mode (development or production)
|
|
@@ -71,17 +62,16 @@ const webpackConfig = {
|
|
|
71
62
|
// Entry point of the application
|
|
72
63
|
target: "node",
|
|
73
64
|
// Specifies the target environment
|
|
74
|
-
entry:
|
|
65
|
+
entry: import_getEntries.getEntries,
|
|
75
66
|
output: {
|
|
76
67
|
clean: true,
|
|
77
68
|
// Clean the output directory before emit
|
|
78
69
|
library: "IntlLayerContent",
|
|
79
70
|
libraryTarget: "umd",
|
|
80
|
-
filename: `[name]
|
|
81
|
-
path: bundleDir
|
|
71
|
+
filename: `[name].bundle.js`
|
|
82
72
|
},
|
|
83
73
|
cache: false,
|
|
84
|
-
|
|
74
|
+
devtool: "source-map",
|
|
85
75
|
// stats: {
|
|
86
76
|
// preset: 'errors-only',
|
|
87
77
|
// warnings: false,
|
|
@@ -92,7 +82,7 @@ const webpackConfig = {
|
|
|
92
82
|
extensions: [".ts", ".js", ".json", ".wasm", ".ts", ".tsx", ".mjs", ".cjs"],
|
|
93
83
|
modules: [
|
|
94
84
|
// To find the loader module
|
|
95
|
-
(0, import_path.join)(__dirname, "..", "node_modules"),
|
|
85
|
+
(0, import_path.join)(globalThis.__dirname, "..", "node_modules"),
|
|
96
86
|
// In the project node_modules
|
|
97
87
|
(0, import_path.join)(process.cwd(), "node_modules"),
|
|
98
88
|
// In the project node_modules
|
|
@@ -127,14 +117,27 @@ const webpackConfig = {
|
|
|
127
117
|
)
|
|
128
118
|
// Or via another project by importing intlayer
|
|
129
119
|
]
|
|
130
|
-
// roots: [
|
|
131
|
-
// join(process.cwd()), // Project context
|
|
132
|
-
// join(process.cwd(), '@intlayer/webpack'), // Or via CLI in another project
|
|
133
|
-
// join(process.cwd(), 'intlayer', '@intlayer/webpack'), // Or via CLI in another project
|
|
134
|
-
// ],
|
|
135
120
|
},
|
|
136
121
|
module: {
|
|
137
122
|
rules: [
|
|
123
|
+
{
|
|
124
|
+
// Rule for .content.ts files
|
|
125
|
+
test: new RegExp(`(${fileExtensions.join("|")})$`),
|
|
126
|
+
use: [
|
|
127
|
+
{
|
|
128
|
+
// Transpile with esbuild-loader
|
|
129
|
+
loader: "esbuild-loader",
|
|
130
|
+
options: {
|
|
131
|
+
// JavaScript version to compile to
|
|
132
|
+
target: "es2015"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// {
|
|
136
|
+
// // Custom loader to process the transpiled code
|
|
137
|
+
// loader: resolve('./intlayer-loader'),
|
|
138
|
+
// },
|
|
139
|
+
]
|
|
140
|
+
},
|
|
138
141
|
{
|
|
139
142
|
test: /\.node$/,
|
|
140
143
|
loader: "node-loader"
|
|
@@ -142,7 +145,7 @@ const webpackConfig = {
|
|
|
142
145
|
// Use esbuild to compile JavaScript & TypeScript
|
|
143
146
|
{
|
|
144
147
|
// Match `.js`, `.jsx`, `.ts` or `.tsx` files
|
|
145
|
-
test: /\.
|
|
148
|
+
test: /\.(jsx|js|ts|tsx|mjs|cjs)?$/,
|
|
146
149
|
loader: "esbuild-loader",
|
|
147
150
|
options: {
|
|
148
151
|
// JavaScript version to compile to
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'path';\nimport { getConfiguration } from '@intlayer/config';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'path';\nimport { getConfiguration } from '@intlayer/config';\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({\n verbose: false,\n});\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AACrB,oBAAiC;AAGjC,wBAA2B;AAC3B,mBAA8B;AAC9B,4BAA+B;AAE/B,MAAM,EAAE,QAAQ,QAAI,gCAAiB;AAAA,EACnC,SAAS;AACX,CAAC;AACD,MAAM,EAAE,eAAe,IAAI;AAAA,IAK3B,4BAAc;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;AAAA,EAEA,OAAO;AAAA,EAEP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAMT,gBAAgB,CAAC,GAAG;AAAA,EACpB,SAAS;AAAA;AAAA,IAEP,YAAY,CAAC,OAAO,OAAO,SAAS,SAAS,OAAO,QAAQ,QAAQ,MAAM;AAAA,IAC1E,SAAS;AAAA;AAAA,UAEP,kBAAK,WAAW,WAAW,MAAM,cAAc;AAAA;AAAA,UAC/C,kBAAK,QAAQ,IAAI,GAAG,cAAc;AAAA;AAAA,UAClC,kBAAK,QAAQ,IAAI,GAAG,gBAAgB,gBAAgB,cAAc;AAAA;AAAA,UAClE;AAAA,QACE,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,eAAe;AAAA;AAAA,IAEb,SAAS;AAAA;AAAA,UAEP,kBAAK,QAAQ,IAAI,GAAG,cAAc;AAAA;AAAA,UAClC,kBAAK,QAAQ,IAAI,GAAG,gBAAgB,qBAAqB,cAAc;AAAA;AAAA,UACvE;AAAA,QACE,QAAQ,IAAI;AAAA,QACZ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA;AAAA,IACF;AAAA,EACF;AAAA,EAEA,QAAQ;AAAA,IACN,OAAO;AAAA,MACL;AAAA;AAAA,QAEE,MAAM,IAAI,OAAO,IAAI,eAAe,KAAK,GAAG,CAAC,IAAI;AAAA,QACjD,KAAK;AAAA,UACH;AAAA;AAAA,YAEE,QAAQ;AAAA,YACR,SAAS;AAAA;AAAA,cAEP,QAAQ;AAAA,YACV;AAAA,UACF;AAAA;AAAA;AAAA;AAAA;AAAA,QAKF;AAAA,MACF;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,QAAQ;AAAA,MACV;AAAA;AAAA,MAEA;AAAA;AAAA,QAEE,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,SAAS;AAAA;AAAA,UAEP,QAAQ;AAAA,QACV;AAAA,MACF;AAAA;AAAA,IAGF;AAAA,EACF;AAAA,EACA,WAAW;AAAA,EAEX,SAAS;AAAA,IACP,IAAI,qCAAe;AAAA;AAAA,EAErB;AACF;AAEA,IAAO,yBAAQ;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getConfiguration } from "@intlayer/config";
|
|
2
|
+
import { sync } from "glob";
|
|
3
|
+
import { getFileHash } from './utils.mjs';
|
|
4
|
+
const { content } = getConfiguration();
|
|
5
|
+
const { watchedFilesPatternWithPath } = content;
|
|
6
|
+
const getEntries = () => 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
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=getEntries.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getConfiguration } from '@intlayer/config';\nimport { sync } from 'glob';\nimport type { EntryObject } from 'webpack';\nimport { getFileHash } from './utils';\n\nconst { content } = getConfiguration();\nconst { watchedFilesPatternWithPath } = content;\n\nexport const getEntries = (): EntryObject =>\n 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,SAAS,YAAY;AAErB,SAAS,mBAAmB;AAE5B,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,EAAE,4BAA4B,IAAI;AAEjC,MAAM,aAAa,MACxB,KAAK,2BAA2B,EAAE,OAAO,CAAC,KAAK,OAAO;AACpD,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":[]}
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export { startServer } from './scripts/startServer.mjs';
|
|
2
|
-
export { bundle, watch } from './scripts/bundle.mjs';
|
|
3
1
|
export { IntLayerPlugin } from './webpack-plugin.mjs';
|
|
4
2
|
export { devServerConfig, default as webpackConfig } from './webpack.config.mjs';
|
|
5
3
|
import 'webpack';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { bundle, startServer, watch } from './scripts/index.mjs';
|
|
2
1
|
import { IntLayerPlugin } from './webpack-plugin.mjs';
|
|
3
2
|
import { devServerConfig, webpackConfig } from './webpack.config.mjs';
|
|
4
3
|
export {
|
|
5
4
|
IntLayerPlugin,
|
|
6
|
-
bundle,
|
|
7
5
|
devServerConfig,
|
|
8
|
-
startServer,
|
|
9
|
-
watch,
|
|
10
6
|
webpackConfig
|
|
11
7
|
};
|
|
12
8
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { IntLayerPlugin } from './webpack-plugin';\nexport { devServerConfig, webpackConfig } from './webpack.config';\n"],"mappings":"AAAA,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB,qBAAqB;","names":[]}
|
package/dist/esm/utils.d.mts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set the __dirname global variable to make the config work in both ESM and CJS environments
|
|
3
|
+
*/
|
|
4
|
+
declare const defineDirname: () => void;
|
|
1
5
|
declare const getFileHash: (filePath: string) => string;
|
|
2
|
-
declare const transformToCamelCase: (string: string) => string;
|
|
3
6
|
|
|
4
|
-
export {
|
|
7
|
+
export { defineDirname, getFileHash };
|
package/dist/esm/utils.mjs
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
import crypto from "crypto-js";
|
|
4
|
+
const defineDirname = () => {
|
|
5
|
+
const isESModule = typeof import.meta.url === "string";
|
|
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);
|
|
5
9
|
};
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
if (index === 0) {
|
|
10
|
-
return word[0].toUpperCase() + word.slice(1);
|
|
11
|
-
}
|
|
12
|
-
return word.charAt(0).toUpperCase() + word.slice(1);
|
|
13
|
-
});
|
|
14
|
-
return camelCasedWords.join("");
|
|
10
|
+
const getFileHash = (filePath) => {
|
|
11
|
+
const hash = crypto.SHA3(filePath);
|
|
12
|
+
return hash.toString(crypto.enc.Base64).replace(/[^A-Z\d]/gi, "").substring(0, 20);
|
|
15
13
|
};
|
|
16
14
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
defineDirname,
|
|
16
|
+
getFileHash
|
|
19
17
|
};
|
|
20
18
|
//# sourceMappingURL=utils.mjs.map
|
package/dist/esm/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/utils.ts"],"sourcesContent":["import path from 'path';\nimport { fileURLToPath } from 'url';\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 isESModule = typeof import.meta.url === 'string';\n\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,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAC9B,OAAO,YAAY;AAKZ,MAAM,gBAAgB,MAAM;AACjC,QAAM,aAAa,OAAO,YAAY,QAAQ;AAE9C,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":[]}
|