@pinnacle0/webpack-util 0.3.25 → 0.3.26

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.
Files changed (139) hide show
  1. package/config/jest.config.ts +35 -0
  2. package/config/tsconfig.script.json +10 -0
  3. package/config/tsconfig.src.json +12 -0
  4. package/config/tsconfig.test.json +11 -0
  5. package/package.json +2 -2
  6. package/script/build.ts +65 -0
  7. package/script/format.ts +7 -0
  8. package/src/CanadyarnRunner.ts +35 -0
  9. package/src/CodeStyleChecker.ts +44 -0
  10. package/src/{Constant.js → Constant.ts} +1 -5
  11. package/src/CoreUtil.ts +24 -0
  12. package/src/ProjectStructureChecker.ts +119 -0
  13. package/src/TestRunner.ts +28 -0
  14. package/src/TypescriptTypeChecker.ts +29 -0
  15. package/src/{WebpackBuilder.js → WebpackBuilder.ts} +71 -51
  16. package/src/WebpackConfigGenerator/{ConfigEntryDescriptorsFactory.js → ConfigEntryDescriptorsFactory.ts} +36 -29
  17. package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.ts +24 -0
  18. package/src/WebpackConfigGenerator/Plugin/css.plugin.ts +31 -0
  19. package/src/WebpackConfigGenerator/Plugin/html.plugin.ts +47 -0
  20. package/src/WebpackConfigGenerator/Plugin/index.ts +33 -0
  21. package/src/WebpackConfigGenerator/Plugin/{moment.plugin.js → moment.plugin.ts} +5 -12
  22. package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.ts +22 -0
  23. package/src/WebpackConfigGenerator/Plugin/ts.plugin.ts +29 -0
  24. package/src/WebpackConfigGenerator/Plugin/webpack.plugin.ts +21 -0
  25. package/src/WebpackConfigGenerator/Rule/{RegExpUtil.js → RegExpUtil.ts} +8 -14
  26. package/src/WebpackConfigGenerator/Rule/{core-fe-hmr-babel-plugin.js → core-fe-hmr-babel-plugin.ts} +43 -9
  27. package/src/WebpackConfigGenerator/Rule/{image.rule.js → image.rule.ts} +5 -8
  28. package/src/WebpackConfigGenerator/Rule/index.ts +17 -0
  29. package/src/WebpackConfigGenerator/Rule/other.rule.ts +23 -0
  30. package/src/WebpackConfigGenerator/Rule/{stylesheet.rule.js → stylesheet.rule.ts} +34 -30
  31. package/src/WebpackConfigGenerator/Rule/{ts.rule.js → ts.rule.ts} +18 -16
  32. package/src/WebpackConfigGenerator/{WebpackConfigSerializationUtil.js → WebpackConfigSerializationUtil.ts} +23 -22
  33. package/src/WebpackConfigGenerator/WebpackEntryFactory.ts +22 -0
  34. package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.ts +22 -0
  35. package/src/WebpackConfigGenerator/{WebpackResolveAliasFactory.js → WebpackResolveAliasFactory.ts} +16 -13
  36. package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.ts +19 -0
  37. package/src/WebpackConfigGenerator/{WebpackResolveModulesFactory.js → WebpackResolveModulesFactory.ts} +9 -7
  38. package/src/WebpackConfigGenerator/index.ts +213 -0
  39. package/src/WebpackServerStarter.ts +138 -0
  40. package/src/index.ts +9 -0
  41. package/src/{type.d.ts → type.ts} +8 -4
  42. package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/__snapshots__/shouldIgnore.test.ts.snap +21 -0
  43. package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/__snapshots__/shouldTransform.test.ts.snap +53 -0
  44. package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/shouldIgnore.test.ts +36 -0
  45. package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/shouldTransform.test.ts +72 -0
  46. package/test/WebpackConfigGenerator/plugin/fixture/script.js +2 -0
  47. package/test/WebpackConfigGenerator/plugin/fixture/script1.js +1 -0
  48. package/test/WebpackConfigGenerator/plugin/script-tag-crossorigin-plugin.test.ts +58 -0
  49. package/test/test-project/package.json +5 -0
  50. package/tsconfig.json +15 -0
  51. package/src/CanadyarnRunner.d.ts +0 -14
  52. package/src/CanadyarnRunner.js +0 -38
  53. package/src/CanadyarnRunner.js.map +0 -1
  54. package/src/CodeStyleChecker.d.ts +0 -10
  55. package/src/CodeStyleChecker.js +0 -44
  56. package/src/CodeStyleChecker.js.map +0 -1
  57. package/src/Constant.d.ts +0 -21
  58. package/src/Constant.js.map +0 -1
  59. package/src/CoreUtil.d.ts +0 -11
  60. package/src/CoreUtil.js +0 -26
  61. package/src/CoreUtil.js.map +0 -1
  62. package/src/ProjectStructureChecker.d.ts +0 -18
  63. package/src/ProjectStructureChecker.js +0 -113
  64. package/src/ProjectStructureChecker.js.map +0 -1
  65. package/src/TestRunner.d.ts +0 -8
  66. package/src/TestRunner.js +0 -30
  67. package/src/TestRunner.js.map +0 -1
  68. package/src/TypescriptTypeChecker.d.ts +0 -11
  69. package/src/TypescriptTypeChecker.js +0 -32
  70. package/src/TypescriptTypeChecker.js.map +0 -1
  71. package/src/WebpackBuilder.d.ts +0 -38
  72. package/src/WebpackBuilder.js.map +0 -1
  73. package/src/WebpackConfigGenerator/ConfigEntryDescriptorsFactory.d.ts +0 -13
  74. package/src/WebpackConfigGenerator/ConfigEntryDescriptorsFactory.js.map +0 -1
  75. package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.d.ts +0 -9
  76. package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.js +0 -20
  77. package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.js.map +0 -1
  78. package/src/WebpackConfigGenerator/Plugin/css.plugin.d.ts +0 -16
  79. package/src/WebpackConfigGenerator/Plugin/css.plugin.js +0 -33
  80. package/src/WebpackConfigGenerator/Plugin/css.plugin.js.map +0 -1
  81. package/src/WebpackConfigGenerator/Plugin/html.plugin.d.ts +0 -16
  82. package/src/WebpackConfigGenerator/Plugin/html.plugin.js +0 -48
  83. package/src/WebpackConfigGenerator/Plugin/html.plugin.js.map +0 -1
  84. package/src/WebpackConfigGenerator/Plugin/index.d.ts +0 -27
  85. package/src/WebpackConfigGenerator/Plugin/index.js +0 -32
  86. package/src/WebpackConfigGenerator/Plugin/index.js.map +0 -1
  87. package/src/WebpackConfigGenerator/Plugin/moment.plugin.d.ts +0 -10
  88. package/src/WebpackConfigGenerator/Plugin/moment.plugin.js.map +0 -1
  89. package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.d.ts +0 -4
  90. package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.js +0 -28
  91. package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.js.map +0 -1
  92. package/src/WebpackConfigGenerator/Plugin/ts.plugin.d.ts +0 -16
  93. package/src/WebpackConfigGenerator/Plugin/ts.plugin.js +0 -31
  94. package/src/WebpackConfigGenerator/Plugin/ts.plugin.js.map +0 -1
  95. package/src/WebpackConfigGenerator/Plugin/webpack.plugin.d.ts +0 -14
  96. package/src/WebpackConfigGenerator/Plugin/webpack.plugin.js +0 -24
  97. package/src/WebpackConfigGenerator/Plugin/webpack.plugin.js.map +0 -1
  98. package/src/WebpackConfigGenerator/Rule/RegExpUtil.d.ts +0 -4
  99. package/src/WebpackConfigGenerator/Rule/RegExpUtil.js.map +0 -1
  100. package/src/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin.d.ts +0 -13
  101. package/src/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin.js.map +0 -1
  102. package/src/WebpackConfigGenerator/Rule/image.rule.d.ts +0 -9
  103. package/src/WebpackConfigGenerator/Rule/image.rule.js.map +0 -1
  104. package/src/WebpackConfigGenerator/Rule/index.d.ts +0 -13
  105. package/src/WebpackConfigGenerator/Rule/index.js +0 -18
  106. package/src/WebpackConfigGenerator/Rule/index.js.map +0 -1
  107. package/src/WebpackConfigGenerator/Rule/other.rule.d.ts +0 -12
  108. package/src/WebpackConfigGenerator/Rule/other.rule.js +0 -22
  109. package/src/WebpackConfigGenerator/Rule/other.rule.js.map +0 -1
  110. package/src/WebpackConfigGenerator/Rule/stylesheet.rule.d.ts +0 -17
  111. package/src/WebpackConfigGenerator/Rule/stylesheet.rule.js.map +0 -1
  112. package/src/WebpackConfigGenerator/Rule/ts.rule.d.ts +0 -18
  113. package/src/WebpackConfigGenerator/Rule/ts.rule.js.map +0 -1
  114. package/src/WebpackConfigGenerator/WebpackConfigSerializationUtil.d.ts +0 -10
  115. package/src/WebpackConfigGenerator/WebpackConfigSerializationUtil.js.map +0 -1
  116. package/src/WebpackConfigGenerator/WebpackEntryFactory.d.ts +0 -9
  117. package/src/WebpackConfigGenerator/WebpackEntryFactory.js +0 -14
  118. package/src/WebpackConfigGenerator/WebpackEntryFactory.js.map +0 -1
  119. package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.d.ts +0 -11
  120. package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.js +0 -16
  121. package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.js.map +0 -1
  122. package/src/WebpackConfigGenerator/WebpackResolveAliasFactory.d.ts +0 -11
  123. package/src/WebpackConfigGenerator/WebpackResolveAliasFactory.js.map +0 -1
  124. package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.d.ts +0 -7
  125. package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.js +0 -16
  126. package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.js.map +0 -1
  127. package/src/WebpackConfigGenerator/WebpackResolveModulesFactory.d.ts +0 -7
  128. package/src/WebpackConfigGenerator/WebpackResolveModulesFactory.js.map +0 -1
  129. package/src/WebpackConfigGenerator/index.d.ts +0 -31
  130. package/src/WebpackConfigGenerator/index.js +0 -191
  131. package/src/WebpackConfigGenerator/index.js.map +0 -1
  132. package/src/WebpackServerStarter.d.ts +0 -28
  133. package/src/WebpackServerStarter.js +0 -111
  134. package/src/WebpackServerStarter.js.map +0 -1
  135. package/src/index.d.ts +0 -10
  136. package/src/index.js +0 -8
  137. package/src/index.js.map +0 -1
  138. package/src/type.js +0 -3
  139. package/src/type.js.map +0 -1
@@ -1,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.reactRefreshPlugin = exports.terserPlugin = void 0;
7
- const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
8
- const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
9
- const WebpackConfigSerializationUtil_1 = require("../WebpackConfigSerializationUtil");
10
- /**
11
- * Applies Terser to minimize javascript
12
- * after bundles/chunks are built.
13
- */
14
- function terserPlugin({ sourceMap }) {
15
- return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("TerserWebpackPlugin", terser_webpack_plugin_1.default, {
16
- terserOptions: {
17
- sourceMap,
18
- },
19
- });
20
- }
21
- exports.terserPlugin = terserPlugin;
22
- /**
23
- * Adds react fast refresh functionality.
24
- * Requires babel plugin "react-refresh/babel".
25
- * Should not be used in production.
26
- */
27
- function reactRefreshPlugin() {
28
- return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("ReactRefreshPlugin", react_refresh_webpack_plugin_1.default);
29
- }
30
- exports.reactRefreshPlugin = reactRefreshPlugin;
31
- //# sourceMappingURL=ts.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ts.plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/ts.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,wGAA6E;AAC7E,kFAAwD;AAExD,sFAAiF;AAMjF;;;GAGG;AACH,SAAgB,YAAY,CAAC,EAAC,SAAS,EAAsB;IACzD,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,+BAAmB,EAAE;QACjG,aAAa,EAAE;YACX,SAAS;SACZ;KACJ,CAAC,CAAC;AACP,CAAC;AAND,oCAMC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB;IAC9B,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,oBAAoB,EAAE,sCAAyB,CAAC,CAAC;AAC9G,CAAC;AAFD,gDAEC"}
@@ -1,14 +0,0 @@
1
- import webpack from "webpack";
2
- interface WebpackProgressPluginOptions {
3
- enableProfiling: boolean;
4
- }
5
- /**
6
- * Reports progress during compilation.
7
- * Basically the same behavior as running webpack-cli with:
8
- * `$ webpack --progress`
9
- */
10
- export declare function webpackProgressPlugin({ enableProfiling }: WebpackProgressPluginOptions): webpack.WebpackPluginInstance;
11
- export declare function webpackDefinePlugin(map: {
12
- [key: string]: string;
13
- }): webpack.WebpackPluginInstance;
14
- export {};
@@ -1,24 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.webpackDefinePlugin = exports.webpackProgressPlugin = void 0;
7
- const webpack_1 = __importDefault(require("webpack"));
8
- const WebpackConfigSerializationUtil_1 = require("../WebpackConfigSerializationUtil");
9
- /**
10
- * Reports progress during compilation.
11
- * Basically the same behavior as running webpack-cli with:
12
- * `$ webpack --progress`
13
- */
14
- function webpackProgressPlugin({ enableProfiling }) {
15
- return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("webpack.ProgressPlugin", webpack_1.default.ProgressPlugin, {
16
- profile: enableProfiling,
17
- });
18
- }
19
- exports.webpackProgressPlugin = webpackProgressPlugin;
20
- function webpackDefinePlugin(map) {
21
- return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("webpack.DefinePlugin", webpack_1.default.DefinePlugin, map);
22
- }
23
- exports.webpackDefinePlugin = webpackDefinePlugin;
24
- //# sourceMappingURL=webpack.plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack.plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/webpack.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,sFAAiF;AAMjF;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,EAAC,eAAe,EAA+B;IACjF,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,wBAAwB,EAAE,iBAAO,CAAC,cAAc,EAAE;QACvG,OAAO,EAAE,eAAe;KAC3B,CAAC,CAAC;AACP,CAAC;AAJD,sDAIC;AAED,SAAgB,mBAAmB,CAAC,GAA4B;IAC5D,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,iBAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;AAChH,CAAC;AAFD,kDAEC"}
@@ -1,4 +0,0 @@
1
- export declare class RegExpUtil {
2
- static fileExtension(...extensions: [string, ...string[]]): RegExp;
3
- private static validateFileExtension;
4
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"RegExpUtil.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/RegExpUtil.ts"],"names":[],"mappings":";;;AAAA,MAAa,UAAU;IACnB,MAAM,CAAC,aAAa,CAAC,GAAG,UAAiC;QACrD,MAAM,iBAAiB,GAAa,EAAE,CAAC;QACvC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC1B,UAAU,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC;YACtC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAA,IAAI,CAAC,CAAC,CAAC;SAC9D;QACD,OAAO,IAAI,MAAM,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3D,CAAC;IAEO,MAAM,CAAC,qBAAqB,CAAC,GAAW;QAC5C,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;SACjD;aAAM,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,mDAAmD,GAAG,IAAI,CAAC,CAAC;SAC/E;aAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtC,MAAM,IAAI,KAAK,CAAC,2FAA2F,GAAG,IAAI,CAAC,CAAC;SACvH;IACL,CAAC;CACJ;AAnBD,gCAmBC"}
@@ -1,13 +0,0 @@
1
- import type * as babel from "@babel/core";
2
- interface State extends Pick<babel.PluginPass, "file" | "key" | "opts" | "cwd" | "filename"> {
3
- hasInjectedDeclineWebpackHMRNode: boolean;
4
- }
5
- /**
6
- * Injects `if (module.hot) module.hot.decline()` code snippet in files that contains "core-fe" Module classes.
7
- *
8
- * This tells webpack HMR to force refresh the browser when a file containing "core-fe" Module classes is changed,
9
- * otherwise react loses refrence of the MainComponent created by `ModuleProxy` in "core-fe"
10
- * and throws a runtime error during development (which is bad for developer experience).
11
- */
12
- export default function ({ types: t }: typeof babel): babel.PluginObj<State>;
13
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"core-fe-hmr-babel-plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin.ts"],"names":[],"mappings":";;AAMA;;;;;;GAMG;AACH,mBAAyB,EAAC,KAAK,EAAE,CAAC,EAAe;IAC7C,OAAO;QACH,OAAO,EAAE;YACL,iBAAiB,CAAC,IAAI,EAAE,KAAK;gBACzB,IAAI,KAAK,CAAC,gCAAgC,EAAE;oBACxC,OAAO;iBACV;gBAED,MAAM,EACF,IAAI,EAAE,EACF,MAAM,EAAE,EAAC,KAAK,EAAE,YAAY,EAAC,EAC7B,UAAU,EAAE,gBAAgB,GAC/B,GACJ,GAAG,IAAI,CAAC;gBAET,IAAI,YAAY,KAAK,SAAS,EAAE;oBAC5B,OAAO;iBACV;gBAED,IAAI,CAAC,oCAAoC,CAAC,CAAC,EAAE,gBAAgB,CAAC,EAAE;oBAC5D,OAAO;iBACV;gBAED,4EAA4E;gBAC5E,MAAM,WAAW,GAAG,IAAI,CAAC,UAA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ACpF,uFAAuF;YACvF,OAAO,IAAI,CAAC;SACf;QAED,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,KAAK,SAAS,CAAC;AACnC,CAAC"}
@@ -1,9 +0,0 @@
1
- import type webpack from "webpack";
2
- /**
3
- * Handles dependency requests to image assets (".png", ".jpeg", ".jpg", ".gif", ".svg")
4
- * by inlining as images as DataURL,
5
- * or emitting as separate files if file size is too large.
6
- *
7
- * @see https://webpack.js.org/guides/asset-modules/
8
- */
9
- export declare function imageRule(): webpack.RuleSetRule;
@@ -1 +0,0 @@
1
- {"version":3,"file":"image.rule.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/image.rule.ts"],"names":[],"mappings":";;;AACA,6CAAwC;AAExC;;;;;;GAMG;AACH,SAAgB,SAAS;IACrB,OAAO;QACH,IAAI,EAAE,uBAAU,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACvE,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACP,QAAQ,EAAE,wCAAwC;SACrD;QACD,MAAM,EAAE;YACJ,gBAAgB,EAAE;gBACd,OAAO,EAAE,IAAI;aAChB;SACJ;KACJ,CAAC;AACN,CAAC;AAbD,8BAaC"}
@@ -1,13 +0,0 @@
1
- import { imageRule } from "./image.rule";
2
- import { otherRule } from "./other.rule";
3
- import { stylesheetRule } from "./stylesheet.rule";
4
- import { tsRule } from "./ts.rule";
5
- /**
6
- * Static factories to create `webpack.config#modules.rules` items.
7
- */
8
- export declare class Rule {
9
- static readonly image: typeof imageRule;
10
- static readonly other: typeof otherRule;
11
- static readonly ts: typeof tsRule;
12
- static readonly stylesheet: typeof stylesheetRule;
13
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Rule = void 0;
4
- const image_rule_1 = require("./image.rule");
5
- const other_rule_1 = require("./other.rule");
6
- const stylesheet_rule_1 = require("./stylesheet.rule");
7
- const ts_rule_1 = require("./ts.rule");
8
- /**
9
- * Static factories to create `webpack.config#modules.rules` items.
10
- */
11
- class Rule {
12
- }
13
- exports.Rule = Rule;
14
- Rule.image = image_rule_1.imageRule;
15
- Rule.other = other_rule_1.otherRule;
16
- Rule.ts = ts_rule_1.tsRule;
17
- Rule.stylesheet = stylesheet_rule_1.stylesheetRule;
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/index.ts"],"names":[],"mappings":";;;AAAA,6CAAuC;AACvC,6CAAuC;AACvC,uDAAiD;AACjD,uCAAiC;AAEjC;;GAEG;AACH,MAAa,IAAI;;AAAjB,oBAQC;AAPmB,UAAK,GAAG,sBAAS,CAAC;AAElB,UAAK,GAAG,sBAAS,CAAC;AAElB,OAAE,GAAG,gBAAM,CAAC;AAEZ,eAAU,GAAG,gCAAc,CAAC"}
@@ -1,12 +0,0 @@
1
- import type webpack from "webpack";
2
- interface OtherRuleDeps {
3
- extraExtensionsForOtherRule: string[];
4
- }
5
- /**
6
- * Handles dependency requests to file assets
7
- * by emitting as separate files.
8
- *
9
- * @see https://webpack.js.org/guides/asset-modules/
10
- */
11
- export declare function otherRule({ extraExtensionsForOtherRule }: OtherRuleDeps): webpack.RuleSetRule;
12
- export {};
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.otherRule = void 0;
4
- const Constant_1 = require("../../Constant");
5
- const RegExpUtil_1 = require("./RegExpUtil");
6
- /**
7
- * Handles dependency requests to file assets
8
- * by emitting as separate files.
9
- *
10
- * @see https://webpack.js.org/guides/asset-modules/
11
- */
12
- function otherRule({ extraExtensionsForOtherRule }) {
13
- return {
14
- test: RegExpUtil_1.RegExpUtil.fileExtension(".ico", ...Constant_1.Constant.mediaExtensions, ...Constant_1.Constant.fontExtensions, ...extraExtensionsForOtherRule),
15
- type: "asset",
16
- generator: {
17
- filename: "static/other/[name].[hash:8][ext][query]",
18
- },
19
- };
20
- }
21
- exports.otherRule = otherRule;
22
- //# sourceMappingURL=other.rule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"other.rule.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/other.rule.ts"],"names":[],"mappings":";;;AACA,6CAAwC;AACxC,6CAAwC;AAMxC;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,EAAC,2BAA2B,EAAgB;IAClE,OAAO;QACH,IAAI,EAAE,uBAAU,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,mBAAQ,CAAC,eAAe,EAAE,GAAG,mBAAQ,CAAC,cAAc,EAAE,GAAG,2BAA2B,CAAC;QAC/H,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACP,QAAQ,EAAE,0CAA0C;SACvD;KACJ,CAAC;AACN,CAAC;AARD,8BAQC"}
@@ -1,17 +0,0 @@
1
- import type webpack from "webpack";
2
- interface StylesheetRuleDeps {
3
- minimize: boolean;
4
- }
5
- /**
6
- * Handles dependency requests to stylesheet assets (".css", ".less")
7
- * with `minimize: true` by `lessc` -> transform to js module -> inject to DOM as <style> tag,
8
- * or with `minimize: false` by `lessc` -> `autoprefixer` with `postcss` -> transform to js module -> extract to stylesheet
9
- *
10
- * @see https://webpack.js.org/loaders/css-loader/
11
- * @see https://webpack.js.org/loaders/less-loader/
12
- * @see https://webpack.js.org/plugins/mini-css-extract-plugin/
13
- * @see https://webpack.js.org/loaders/postcss-loader/
14
- * @see https://webpack.js.org/loaders/style-loader/
15
- */
16
- export declare function stylesheetRule({ minimize }: StylesheetRuleDeps): webpack.RuleSetRule;
17
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"stylesheet.rule.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/stylesheet.rule.ts"],"names":[],"mappings":";;;;;;AAAA,sFAA2D;AAE3D,6CAAwC;AAMxC,SAAS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AAqE;QACrE,mEAAmE;QACnE,uDAAuD;QACvD,sEAAsE;QACtE,sDAAsD;QACtD,WAAW,EAAE,IAAI;KACpB,CAAC;AACN,CAAC;AA1BD,wCA0BC"}
@@ -1,18 +0,0 @@
1
- import type webpack from "webpack";
2
- interface Deps {
3
- tsconfigFilepath: string;
4
- fastRefresh: boolean;
5
- }
6
- /**
7
- * Handles dependency requests to typescript files
8
- * by compiling with `tsc`.
9
- *
10
- * To enable react fast refresh, set `withReactFastRefreshBabelPlugin` to true,
11
- * this requires "@pmmmwh/react-refresh-webpack-plugin" webpack plugin to work,
12
- * and should not be used in production.
13
- *
14
- * @see https://github.com/TypeStrong/ts-loader
15
- * @see https://github.com/pmmmwh/react-refresh-webpack-plugin
16
- */
17
- export declare function tsRule({ tsconfigFilepath, fastRefresh }: Deps): webpack.RuleSetRule;
18
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"ts.rule.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Rule/ts.rule.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,6CAAwC;AAOxC;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,EAAC,gBAAgB,EAAE,WAAW,EAAO;IACxD,MAAM,WAAW,GAA2B;QACxC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC;QACvC,OAAO,EAAE;YACL,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,4BAA4B,CAAC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;SACzH;KACJ,CAAC;IAEF,sEAAsE;IACtE,MAAM,QAAQ,GAA2B;QACrC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;QACpC,OAAO,EAAE;YACL,MAAM,EAAE,KAAK;YACb,UAAU,EAAE,gBAAgB;YAC5B,eAAe,EAAE;gBACb,MAAM,EAAE,QAAQ;gBAChB,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE,KAAK;aAChB;YACD,aAAa,EAAE,IAAI;SACtB;KACJ,CAAC;IAEF,MAAM,SAAS,GAA2B;QACtC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;QACrC,OAAO,EAAE;YACL,GAAG,EAAE;gBACD,MAAM,EAAE,KAAK;gBACb,MAAM,EAAE;oBACJ,MAAM,EAAE,YAAY;oBACpB,UAAU,EAAE,IAAI;iBACnB;gBACD,SAAS,EAAE;oBACP,KAAK,EAAE;wBACH,OAAO,EAAE,SAAS;qBACrB;oBACD,eAAe,EAAE,IAAI;oBACrB,iBAAiB,EAAE,IAAI;iBAC1B;aACJ;SACJ;KACJ,CAAC;IAEF,OAAO;QACH,IAAI,EAAE,uBAAU,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC;QAC7C,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;KAC3D,CAAC;AACN,CAAC;AA/CD,wBA+CC"}
@@ -1,10 +0,0 @@
1
- import type webpack from "webpack";
2
- export declare class WebpackConfigSerializationUtil {
3
- static serializablePlugin<OptType, T extends {
4
- apply(..._: any[]): void;
5
- }>(name: string, PluginConstructor: new () => T): webpack.WebpackPluginInstance;
6
- static serializablePlugin<OptType, T extends {
7
- apply(..._: any[]): void;
8
- }>(name: string, PluginConstructor: new (_: OptType) => T, options: OptType): webpack.WebpackPluginInstance;
9
- static configToString(config: webpack.Configuration): string;
10
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebpackConfigSerializationUtil.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/WebpackConfigSerializationUtil.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAyC;AASzC,MAAa,8BAA8B;IAGvC,MAAM,CAAC,kBAAkB,CAAgD,IAAY,EAAE,iBAAyC,EAAE,OAAiB;QAC/I,MA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ACX,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE,mBAAmB;aAChC,CAAC,CAAC;SACN;QAAC,WAAM;YACJ,uGAAuG;YACvG,OAAO,YAAY,CAAC;SACvB;IACL,CAAC;CACJ;AAtDD,wEAsDC"}
@@ -1,9 +0,0 @@
1
- import type webpack from "webpack";
2
- import type { EntryDescriptor } from "../type";
3
- interface WebpackEntryFactoryOptions {
4
- configEntryDescriptors: EntryDescriptor[];
5
- }
6
- export declare class WebpackEntryFactory {
7
- static generate({ configEntryDescriptors }: WebpackEntryFactoryOptions): NonNullable<webpack.Configuration["entry"]>;
8
- }
9
- export {};
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebpackEntryFactory = void 0;
4
- class WebpackEntryFactory {
5
- static generate({ configEntryDescriptors }) {
6
- const entry = {};
7
- for (const { name, entryPath } of configEntryDescriptors) {
8
- entry[name] = [entryPath];
9
- }
10
- return entry;
11
- }
12
- }
13
- exports.WebpackEntryFactory = WebpackEntryFactory;
14
- //# sourceMappingURL=WebpackEntryFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebpackEntryFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/WebpackEntryFactory.ts"],"names":[],"mappings":";;;AAWA,MAAa,mBAAmB;IAC5B,MAAM,CAAC,QAAQ,CAAC,EAAC,sBAAsB,EAA6B;QAChE,MAAM,KAAK,GAAuB,EAAE,CAAC;QAErC,KAAK,MAAM,EAAC,IAAI,EAAE,SAAS,EAAC,IAAI,sBAAsB,EAAE;YACpD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SAC7B;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAVD,kDAUC"}
@@ -1,11 +0,0 @@
1
- export interface WebpackOutputPublicURLFactoryOptions {
2
- env: string | null;
3
- /**
4
- * Function to dynamically compute additional webpack config from `env`.
5
- * Should validates if the config contains `publicUrl` field.
6
- */
7
- webpackPublicPath: string | ((env: string) => string) | undefined;
8
- }
9
- export declare class WebpackOutputPublicURLFactory {
10
- static generate({ env, webpackPublicPath }: WebpackOutputPublicURLFactoryOptions): string;
11
- }
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebpackOutputPublicURLFactory = void 0;
4
- class WebpackOutputPublicURLFactory {
5
- static generate({ env, webpackPublicPath }) {
6
- if (!env || !webpackPublicPath) {
7
- return "/";
8
- }
9
- if (typeof webpackPublicPath === "string") {
10
- return webpackPublicPath;
11
- }
12
- return webpackPublicPath(env);
13
- }
14
- }
15
- exports.WebpackOutputPublicURLFactory = WebpackOutputPublicURLFactory;
16
- //# sourceMappingURL=WebpackOutputPublicURLFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebpackOutputPublicURLFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.ts"],"names":[],"mappings":";;;AASA,MAAa,6BAA6B;IACtC,MAAM,CAAC,QAAQ,CAAC,EAAC,GAAG,EAAE,iBAAiB,EAAuC;QAC1E,IAAI,CAAC,GAAG,IAAI,CAAC,iBAAiB,EAAE;YAC5B,OAAO,GAAG,CAAC;SACd;QAED,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE;YACvC,OAAO,iBAAiB,CAAC;SAC5B;QAED,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;CACJ;AAZD,sEAYC"}
@@ -1,11 +0,0 @@
1
- import type { DynamicPathResolver } from "../type";
2
- interface WebpackResolveAliasMapOptions {
3
- env: string | null;
4
- resolvers: DynamicPathResolver[];
5
- }
6
- export declare class WebpackResolveAliasFactory {
7
- static generate({ env, resolvers }: WebpackResolveAliasMapOptions): {
8
- [moduleAlias: string]: string;
9
- };
10
- }
11
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebpackResolveAliasFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/WebpackResolveAliasFactory.ts"],"names":[],"mappings":";;;AAOA,MAAa,0BAA0B;IACnC,MAAM,CAAC,QAAQ,CAAC,EAAC,GAAG,EAAE,SAAS,EAAgC;QAC3D,MAAM,cAAc,GAAoC,EAAE,CAAC;QAE3D,KAAK,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAC,IAAI,SAAS,EAAE;YACxC,IAAI,MAAM,IAAI,cAAc,EAAE;gBAC1B,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;aAC5D;iBAAM,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;gBAC7B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;aACtD;iBAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBAC1B,MAAM,IAAI,KAAK,CAAC,wDAAwD,MAAM,EAAE,CAAC,CAAC;aACrF;YAED,IAAI,QAAQ,EAAE;gBACV,MAAM,gBAAgB,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBACjF,IAAI,gBAAgB,EAAE;oBAClB,cAAc,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC;iBAC7C;aACJ;SACJ;QAED,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AAvBD,gEAuBC"}
@@ -1,7 +0,0 @@
1
- interface WebpackResolveExtensionsFactoryOptions {
2
- prioritizedExtensionPrefixes?: string[] | undefined;
3
- }
4
- export declare class WebpackResolveExtensionsFactory {
5
- static generate({ prioritizedExtensionPrefixes }: WebpackResolveExtensionsFactoryOptions): string[];
6
- }
7
- export {};
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WebpackResolveExtensionsFactory = void 0;
4
- const Constant_1 = require("../Constant");
5
- class WebpackResolveExtensionsFactory {
6
- static generate({ prioritizedExtensionPrefixes = [] }) {
7
- const resolveExtensions = [];
8
- for (const prefix of prioritizedExtensionPrefixes) {
9
- resolveExtensions.push(...Constant_1.Constant.resolveExtensions.map(_ => `.${prefix}${_}`));
10
- }
11
- resolveExtensions.push(...Constant_1.Constant.resolveExtensions);
12
- return resolveExtensions;
13
- }
14
- }
15
- exports.WebpackResolveExtensionsFactory = WebpackResolveExtensionsFactory;
16
- //# sourceMappingURL=WebpackResolveExtensionsFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebpackResolveExtensionsFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.ts"],"names":[],"mappings":";;;AAAA,0CAAqC;AAMrC,MAAa,+BAA+B;IACxC,MAAM,CAAC,QAAQ,CAAC,EAAC,4BAA4B,GAAG,EAAE,EAAyC;QACvF,MAAM,iBAAiB,GAAG,EAAE,CAAC;QAE7B,KAAK,MAAM,MAAM,IAAI,4BAA4B,EAAE;YAC/C,iBAAiB,CAAC,IAAI,CAAC,GAAG,mBAAQ,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;SACpF;QAED,iBAAiB,CAAC,IAAI,CAAC,GAAG,mBAAQ,CAAC,iBAAiB,CAAC,CAAC;QAEtD,OAAO,iBAAiB,CAAC;IAC7B,CAAC;CACJ;AAZD,0EAYC"}
@@ -1,7 +0,0 @@
1
- interface WebpackResolveModulesFactoryOptions {
2
- projectSrcDirectory: string;
3
- }
4
- export declare class WebpackResolveModulesFactory {
5
- static generate({ projectSrcDirectory }: WebpackResolveModulesFactoryOptions): string[];
6
- }
7
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebpackResolveModulesFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/WebpackResolveModulesFactory.ts"],"names":[],"mappings":";;;AAIA,MAAa,4BAA4B;IACrC,MAAM,CAAC,QAAQ,CAAC,EAAC,mBAAmB,EAAsC;QACtE,MAAM,cAAc,GAAG,EAAE,CAAC;QAE1B;;;;;;;;;;;;;;;;;;WAkBG;QACH,cAAc,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAEzC;;;WAGG;QACH,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEpC,OAAO,cAAc,CAAC;IAC1B,CAAC;CACJ;AAjCD,oEAiCC"}
@@ -1,31 +0,0 @@
1
- import type webpack from "webpack";
2
- import type { WebpackConfigGeneratorOptions } from "../type";
3
- /**
4
- * Generates a webpack config with sane defaults.
5
- */
6
- export declare class WebpackConfigGenerator {
7
- private readonly options;
8
- private readonly env;
9
- private readonly projectDirectory;
10
- private readonly projectSrcDirectory;
11
- private readonly tsconfigFilepath;
12
- private readonly enableProfiling;
13
- private readonly maxEntryPointKiloByte;
14
- private readonly maxAssetKiloByte;
15
- private readonly isFastMode;
16
- private readonly verbose;
17
- private readonly defineVars;
18
- private readonly extraExtensionsForOtherRule;
19
- private readonly configEntryDescriptors;
20
- private readonly entry;
21
- private readonly htmlWebpackPluginInstances;
22
- private readonly resolveExtensions;
23
- private readonly resolveModules;
24
- private readonly resolveAliases;
25
- private readonly outputPublicPath;
26
- private readonly logger;
27
- constructor(options: WebpackConfigGeneratorOptions);
28
- development(): webpack.Configuration;
29
- production(outputDirectory: string): webpack.Configuration;
30
- }
31
- export type { WebpackConfigGeneratorOptions };
@@ -1,191 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WebpackConfigGenerator = void 0;
7
- const devtool_util_1 = require("@pinnacle0/devtool-util");
8
- const path_1 = __importDefault(require("path"));
9
- const Constant_1 = require("../Constant");
10
- const CoreUtil_1 = require("../CoreUtil");
11
- const ConfigEntryDescriptorsFactory_1 = require("./ConfigEntryDescriptorsFactory");
12
- const HTMLWebpackPluginsFactory_1 = require("./HTMLWebpackPluginsFactory");
13
- const WebpackConfigSerializationUtil_1 = require("./WebpackConfigSerializationUtil");
14
- const WebpackEntryFactory_1 = require("./WebpackEntryFactory");
15
- const WebpackOutputPublicURLFactory_1 = require("./WebpackOutputPublicURLFactory");
16
- const WebpackResolveAliasFactory_1 = require("./WebpackResolveAliasFactory");
17
- const WebpackResolveExtensionsFactory_1 = require("./WebpackResolveExtensionsFactory");
18
- const WebpackResolveModulesFactory_1 = require("./WebpackResolveModulesFactory");
19
- const Plugin_1 = require("./Plugin");
20
- const Rule_1 = require("./Rule");
21
- /**
22
- * Generates a webpack config with sane defaults.
23
- */
24
- class WebpackConfigGenerator {
25
- constructor(options) {
26
- var _a, _b, _c;
27
- this.options = options;
28
- this.logger = devtool_util_1.Utility.createConsoleLogger("WebpackConfigGenerator");
29
- this.env = CoreUtil_1.CoreUtil.currentEnv();
30
- this.projectDirectory = options.projectDirectory;
31
- this.projectSrcDirectory = path_1.default.join(options.projectDirectory, "src");
32
- this.tsconfigFilepath = path_1.default.join(options.projectDirectory, "tsconfig.json");
33
- this.enableProfiling = CoreUtil_1.CoreUtil.profilingEnabled();
34
- this.isFastMode = CoreUtil_1.CoreUtil.isFastMode();
35
- this.maxEntryPointKiloByte = (_a = options.maxEntryPointKiloByte) !== null && _a !== void 0 ? _a : Constant_1.Constant.maxEntryPointKiloByte;
36
- this.maxAssetKiloByte = (_b = options.maxAssetKiloByte) !== null && _b !== void 0 ? _b : Constant_1.Constant.maxAssetKiloByte;
37
- this.verbose = options.verbose || false;
38
- this.defineVars = options.defineVars || {};
39
- this.extraExtensionsForOtherRule = options.extraExtensionsForOtherRule || [];
40
- this.configEntryDescriptors = ConfigEntryDescriptorsFactory_1.ConfigEntryDescriptorsFactory.generate({
41
- indexName: options.indexName || "index",
42
- projectSrcDirectory: this.projectSrcDirectory,
43
- extraEntries: options.extraEntries || {},
44
- });
45
- this.entry = WebpackEntryFactory_1.WebpackEntryFactory.generate({
46
- configEntryDescriptors: this.configEntryDescriptors,
47
- });
48
- this.htmlWebpackPluginInstances = HTMLWebpackPluginsFactory_1.HTMLWebpackPluginsFactory.generate({
49
- configEntryDescriptors: this.configEntryDescriptors,
50
- });
51
- this.outputPublicPath = WebpackOutputPublicURLFactory_1.WebpackOutputPublicURLFactory.generate({
52
- env: this.env,
53
- webpackPublicPath: options.webpackPublicPath,
54
- });
55
- this.resolveExtensions = WebpackResolveExtensionsFactory_1.WebpackResolveExtensionsFactory.generate({
56
- prioritizedExtensionPrefixes: options.prioritizedExtensionPrefixes,
57
- });
58
- this.resolveModules = WebpackResolveModulesFactory_1.WebpackResolveModulesFactory.generate({
59
- projectSrcDirectory: this.projectSrcDirectory,
60
- });
61
- this.resolveAliases = WebpackResolveAliasFactory_1.WebpackResolveAliasFactory.generate({
62
- env: this.env,
63
- resolvers: (_c = options.dynamicPathResolvers) !== null && _c !== void 0 ? _c : [],
64
- });
65
- this.logger.info("Config constructed:");
66
- for (const info of [
67
- `-- Code Checking: ${this.isFastMode ? "Minimal Check" : "Default"}`,
68
- `-- Env: ${this.env || "[N/A]"}`,
69
- `-- Src Directory: ${this.projectSrcDirectory}`,
70
- `-- HTML Entries: ${Object.keys(this.entry).join(" / ")}`,
71
- `-- Webpack Public URL: ${this.outputPublicPath}`,
72
- `-- Dynamic Aliases: ${JSON.stringify(this.resolveAliases, null, 4)}`,
73
- `-- Use Cache: ${this.env === null}`,
74
- ]) {
75
- console.info(info);
76
- }
77
- }
78
- development() {
79
- const config = {
80
- mode: "development",
81
- entry: this.entry,
82
- target: "web",
83
- output: {
84
- filename: "static/js/[name].js",
85
- publicPath: "/",
86
- },
87
- resolve: {
88
- extensions: this.resolveExtensions,
89
- modules: this.resolveModules,
90
- alias: this.resolveAliases,
91
- },
92
- devtool: "inline-cheap-module-source-map",
93
- optimization: {
94
- usedExports: true,
95
- splitChunks: {
96
- automaticNameDelimiter: "-",
97
- maxAsyncRequests: 30,
98
- },
99
- },
100
- module: {
101
- rules: [
102
- Rule_1.Rule.ts({ tsconfigFilepath: this.tsconfigFilepath, fastRefresh: true }),
103
- Rule_1.Rule.stylesheet({ minimize: false }),
104
- Rule_1.Rule.image(),
105
- Rule_1.Rule.other({ extraExtensionsForOtherRule: this.extraExtensionsForOtherRule }),
106
- // prettier-format-preserve
107
- ],
108
- },
109
- plugins: [
110
- ...this.htmlWebpackPluginInstances,
111
- Plugin_1.Plugin.ignoreMomentLocale(),
112
- Plugin_1.Plugin.reactRefresh(),
113
- Plugin_1.Plugin.webpack.progress({ enableProfiling: false }),
114
- Plugin_1.Plugin.webpack.define(this.defineVars),
115
- // prettier-format-preserve
116
- ],
117
- cache: this.env === null
118
- ? {
119
- type: "filesystem",
120
- cacheDirectory: path_1.default.join(this.projectDirectory, ".webpack-cache"),
121
- }
122
- : false,
123
- };
124
- if (this.verbose || CoreUtil_1.CoreUtil.verbose()) {
125
- this.logger.info("Full webpack config:");
126
- console.info(WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.configToString(config));
127
- }
128
- return config;
129
- }
130
- production(outputDirectory) {
131
- const config = {
132
- mode: "production",
133
- entry: this.entry,
134
- target: ["web", "es5"],
135
- output: {
136
- path: outputDirectory,
137
- filename: this.enableProfiling ? "static/js/[name].js" : pathInfo => this.configEntryDescriptors.find(_ => _.name === pathInfo.chunk.name).outputFilename,
138
- chunkFilename: this.enableProfiling ? "static/js/[id].[name].js" : "static/js/[id].[chunkhash:8].js",
139
- publicPath: this.outputPublicPath,
140
- crossOriginLoading: "anonymous",
141
- },
142
- resolve: {
143
- extensions: this.resolveExtensions,
144
- modules: this.resolveModules,
145
- alias: this.resolveAliases,
146
- },
147
- bail: true,
148
- optimization: {
149
- splitChunks: {
150
- automaticNameDelimiter: "-",
151
- maxAsyncRequests: 30,
152
- },
153
- minimizer: [
154
- Plugin_1.Plugin.minimizer.terser({ sourceMap: true }),
155
- Plugin_1.Plugin.minimizer.css(),
156
- // prettier-format-preserve
157
- ],
158
- },
159
- performance: {
160
- maxEntrypointSize: this.enableProfiling ? Number.MAX_SAFE_INTEGER : this.maxEntryPointKiloByte * 1000,
161
- maxAssetSize: this.maxAssetKiloByte * 1000,
162
- assetFilter: (filename) => Constant_1.Constant.mediaExtensions.concat(this.extraExtensionsForOtherRule).every(_ => !filename.endsWith(_)),
163
- },
164
- module: {
165
- rules: [
166
- Rule_1.Rule.ts({ tsconfigFilepath: this.tsconfigFilepath, fastRefresh: false }),
167
- Rule_1.Rule.stylesheet({ minimize: true }),
168
- Rule_1.Rule.image(),
169
- Rule_1.Rule.other({ extraExtensionsForOtherRule: this.extraExtensionsForOtherRule }),
170
- // prettier-format-preserve
171
- ],
172
- },
173
- plugins: [
174
- ...this.htmlWebpackPluginInstances,
175
- Plugin_1.Plugin.scriptTagCrossOriginPlugin(),
176
- Plugin_1.Plugin.ignoreMomentLocale(),
177
- Plugin_1.Plugin.fileOutput.miniCssExtract({ enableProfiling: this.enableProfiling }),
178
- ...(this.enableProfiling ? [Plugin_1.Plugin.webpack.progress({ enableProfiling: true })] : []),
179
- Plugin_1.Plugin.webpack.define(this.defineVars),
180
- // prettier-format-preserve
181
- ],
182
- };
183
- if (this.verbose || CoreUtil_1.CoreUtil.verbose()) {
184
- this.logger.info("Full webpack config:");
185
- console.info(WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.configToString(config));
186
- }
187
- return config;
188
- }
189
- }
190
- exports.WebpackConfigGenerator = WebpackConfigGenerator;
191
- //# sourceMappingURL=index.js.map