@pinnacle0/webpack-util 0.3.16-beta1 → 0.3.16-beta2
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/package.json +1 -1
- package/src/CanadyarnRunner.d.ts +14 -0
- package/src/CanadyarnRunner.js +38 -0
- package/src/CanadyarnRunner.js.map +1 -0
- package/src/CodeStyleChecker.d.ts +10 -0
- package/src/CodeStyleChecker.js +44 -0
- package/src/CodeStyleChecker.js.map +1 -0
- package/src/Constant.d.ts +21 -0
- package/src/{Constant.ts → Constant.js} +5 -1
- package/src/Constant.js.map +1 -0
- package/src/CoreUtil.d.ts +11 -0
- package/src/CoreUtil.js +26 -0
- package/src/CoreUtil.js.map +1 -0
- package/src/ProjectStructureChecker.d.ts +18 -0
- package/src/ProjectStructureChecker.js +113 -0
- package/src/ProjectStructureChecker.js.map +1 -0
- package/src/TestRunner.d.ts +8 -0
- package/src/TestRunner.js +30 -0
- package/src/TestRunner.js.map +1 -0
- package/src/WebpackBuilder.d.ts +38 -0
- package/src/{WebpackBuilder.ts → WebpackBuilder.js} +49 -69
- package/src/WebpackBuilder.js.map +1 -0
- package/src/WebpackConfigGenerator/ConfigEntryDescriptorsFactory.d.ts +13 -0
- package/src/WebpackConfigGenerator/{ConfigEntryDescriptorsFactory.ts → ConfigEntryDescriptorsFactory.js} +29 -36
- package/src/WebpackConfigGenerator/ConfigEntryDescriptorsFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.d.ts +9 -0
- package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.js +20 -0
- package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/css.plugin.d.ts +16 -0
- package/src/WebpackConfigGenerator/Plugin/css.plugin.js +33 -0
- package/src/WebpackConfigGenerator/Plugin/css.plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/esbuild.plugin.d.ts +2 -0
- package/src/WebpackConfigGenerator/Plugin/esbuild.plugin.js +14 -0
- package/src/WebpackConfigGenerator/Plugin/esbuild.plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/html.plugin.d.ts +16 -0
- package/src/WebpackConfigGenerator/Plugin/html.plugin.js +48 -0
- package/src/WebpackConfigGenerator/Plugin/html.plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/index.d.ts +29 -0
- package/src/WebpackConfigGenerator/Plugin/index.js +34 -0
- package/src/WebpackConfigGenerator/Plugin/index.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/moment.plugin.d.ts +10 -0
- package/src/WebpackConfigGenerator/Plugin/{moment.plugin.ts → moment.plugin.js} +12 -5
- package/src/WebpackConfigGenerator/Plugin/moment.plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.d.ts +4 -0
- package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.js +28 -0
- package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/ts.plugin.d.ts +16 -0
- package/src/WebpackConfigGenerator/Plugin/ts.plugin.js +31 -0
- package/src/WebpackConfigGenerator/Plugin/ts.plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Plugin/webpack.plugin.d.ts +14 -0
- package/src/WebpackConfigGenerator/Plugin/webpack.plugin.js +24 -0
- package/src/WebpackConfigGenerator/Plugin/webpack.plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/RegExpUtil.d.ts +4 -0
- package/src/WebpackConfigGenerator/Rule/{RegExpUtil.ts → RegExpUtil.js} +14 -8
- package/src/WebpackConfigGenerator/Rule/RegExpUtil.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin.d.ts +13 -0
- package/src/WebpackConfigGenerator/Rule/{core-fe-hmr-babel-plugin.ts → core-fe-hmr-babel-plugin.js} +9 -43
- package/src/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/image.rule.d.ts +9 -0
- package/src/WebpackConfigGenerator/Rule/{image.rule.ts → image.rule.js} +8 -5
- package/src/WebpackConfigGenerator/Rule/image.rule.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/index.d.ts +13 -0
- package/src/WebpackConfigGenerator/Rule/index.js +18 -0
- package/src/WebpackConfigGenerator/Rule/index.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/other.rule.d.ts +12 -0
- package/src/WebpackConfigGenerator/Rule/other.rule.js +22 -0
- package/src/WebpackConfigGenerator/Rule/other.rule.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/stylesheet.rule.d.ts +17 -0
- package/src/WebpackConfigGenerator/Rule/{stylesheet.rule.ts → stylesheet.rule.js} +30 -34
- package/src/WebpackConfigGenerator/Rule/stylesheet.rule.js.map +1 -0
- package/src/WebpackConfigGenerator/Rule/ts.rule.d.ts +19 -0
- package/src/WebpackConfigGenerator/Rule/{ts.rule.ts → ts.rule.js} +16 -19
- package/src/WebpackConfigGenerator/Rule/ts.rule.js.map +1 -0
- package/src/WebpackConfigGenerator/WebpackConfigSerializationUtil.d.ts +10 -0
- package/src/WebpackConfigGenerator/{WebpackConfigSerializationUtil.ts → WebpackConfigSerializationUtil.js} +22 -23
- package/src/WebpackConfigGenerator/WebpackConfigSerializationUtil.js.map +1 -0
- package/src/WebpackConfigGenerator/WebpackEntryFactory.d.ts +9 -0
- package/src/WebpackConfigGenerator/WebpackEntryFactory.js +14 -0
- package/src/WebpackConfigGenerator/WebpackEntryFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.d.ts +11 -0
- package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.js +16 -0
- package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/WebpackResolveAliasFactory.d.ts +11 -0
- package/src/WebpackConfigGenerator/{WebpackResolveAliasFactory.ts → WebpackResolveAliasFactory.js} +13 -16
- package/src/WebpackConfigGenerator/WebpackResolveAliasFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.d.ts +7 -0
- package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.js +16 -0
- package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/WebpackResolveModulesFactory.d.ts +7 -0
- package/src/WebpackConfigGenerator/{WebpackResolveModulesFactory.ts → WebpackResolveModulesFactory.js} +7 -9
- package/src/WebpackConfigGenerator/WebpackResolveModulesFactory.js.map +1 -0
- package/src/WebpackConfigGenerator/index.d.ts +31 -0
- package/src/WebpackConfigGenerator/index.js +191 -0
- package/src/WebpackConfigGenerator/index.js.map +1 -0
- package/src/WebpackServerStarter.d.ts +28 -0
- package/src/WebpackServerStarter.js +111 -0
- package/src/WebpackServerStarter.js.map +1 -0
- package/src/index.d.ts +10 -0
- package/src/index.js +8 -0
- package/src/index.js.map +1 -0
- package/src/{type.ts → type.d.ts} +4 -8
- package/src/type.js +3 -0
- package/src/type.js.map +1 -0
- package/config/jest.config.ts +0 -35
- package/config/tsconfig.script.json +0 -11
- package/config/tsconfig.src.json +0 -12
- package/config/tsconfig.test.json +0 -12
- package/script/build.ts +0 -65
- package/script/format.ts +0 -7
- package/src/CanadyarnRunner.ts +0 -35
- package/src/CodeStyleChecker.ts +0 -44
- package/src/CoreUtil.ts +0 -24
- package/src/ProjectStructureChecker.ts +0 -119
- package/src/TestRunner.ts +0 -28
- package/src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.ts +0 -24
- package/src/WebpackConfigGenerator/Plugin/css.plugin.ts +0 -31
- package/src/WebpackConfigGenerator/Plugin/esbuild.plugin.ts +0 -11
- package/src/WebpackConfigGenerator/Plugin/html.plugin.ts +0 -47
- package/src/WebpackConfigGenerator/Plugin/index.ts +0 -35
- package/src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.ts +0 -22
- package/src/WebpackConfigGenerator/Plugin/ts.plugin.ts +0 -29
- package/src/WebpackConfigGenerator/Plugin/webpack.plugin.ts +0 -21
- package/src/WebpackConfigGenerator/Rule/index.ts +0 -17
- package/src/WebpackConfigGenerator/Rule/other.rule.ts +0 -23
- package/src/WebpackConfigGenerator/WebpackEntryFactory.ts +0 -22
- package/src/WebpackConfigGenerator/WebpackOutputPublicURLFactory.ts +0 -22
- package/src/WebpackConfigGenerator/WebpackResolveExtensionsFactory.ts +0 -19
- package/src/WebpackConfigGenerator/index.ts +0 -213
- package/src/WebpackServerStarter.ts +0 -138
- package/src/index.ts +0 -9
- package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/__snapshots__/shouldIgnore.test.ts.snap +0 -21
- package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/__snapshots__/shouldTransform.test.ts.snap +0 -53
- package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/shouldIgnore.test.ts +0 -36
- package/test/WebpackConfigGenerator/Rule/core-fe-hmr-babel-plugin/shouldTransform.test.ts +0 -72
- package/test/WebpackConfigGenerator/plugin/fixture/script.js +0 -2
- package/test/WebpackConfigGenerator/plugin/fixture/script1.js +0 -1
- package/test/WebpackConfigGenerator/plugin/script-tag-crossorigin-plugin.test.ts +0 -58
- package/test/test-project/package.json +0 -5
- package/tsconfig.json +0 -15
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EntryDescriptor } from "../type";
|
|
2
|
+
interface ConfigEntryDescriptorsFactoryOptions {
|
|
3
|
+
indexName: string;
|
|
4
|
+
projectSrcDirectory: string;
|
|
5
|
+
extraEntries: Record<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export declare class ConfigEntryDescriptorsFactory {
|
|
8
|
+
static generate({ indexName, projectSrcDirectory, extraEntries }: ConfigEntryDescriptorsFactoryOptions): EntryDescriptor[];
|
|
9
|
+
private static createEntryDescriptor;
|
|
10
|
+
private static findEntryFilepath;
|
|
11
|
+
private static findEntryHTMLFilepath;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
static generate({indexName, projectSrcDirectory, extraEntries}: ConfigEntryDescriptorsFactoryOptions): EntryDescriptor[] {
|
|
14
|
-
const entryDescriptors: EntryDescriptor[] = [];
|
|
15
|
-
|
|
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.ConfigEntryDescriptorsFactory = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const Constant_1 = require("../Constant");
|
|
10
|
+
class ConfigEntryDescriptorsFactory {
|
|
11
|
+
static generate({ indexName, projectSrcDirectory, extraEntries }) {
|
|
12
|
+
const entryDescriptors = [];
|
|
16
13
|
const mainEntryDescriptor = ConfigEntryDescriptorsFactory.createEntryDescriptor({
|
|
17
14
|
name: indexName,
|
|
18
15
|
directory: projectSrcDirectory,
|
|
19
16
|
});
|
|
20
17
|
entryDescriptors.push(mainEntryDescriptor);
|
|
21
|
-
|
|
22
18
|
for (const [extraEntryName, extraEntryDirectory] of Object.entries(extraEntries)) {
|
|
23
19
|
const extraEntryDescriptor = ConfigEntryDescriptorsFactory.createEntryDescriptor({
|
|
24
20
|
name: extraEntryName,
|
|
@@ -26,55 +22,52 @@ export class ConfigEntryDescriptorsFactory {
|
|
|
26
22
|
});
|
|
27
23
|
entryDescriptors.push(extraEntryDescriptor);
|
|
28
24
|
}
|
|
29
|
-
|
|
30
25
|
return entryDescriptors;
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
private static createEntryDescriptor({name, directory}: {name: string; directory: string}): EntryDescriptor {
|
|
27
|
+
static createEntryDescriptor({ name, directory }) {
|
|
34
28
|
const entryPath = ConfigEntryDescriptorsFactory.findEntryFilepath(directory);
|
|
35
29
|
const htmlPath = ConfigEntryDescriptorsFactory.findEntryHTMLFilepath(directory);
|
|
36
|
-
|
|
37
30
|
if (entryPath === null) {
|
|
38
|
-
throw new Error(`Cannot find entry file for "${name}" in "${directory}", files checked: ${Constant.mainEntryFilenames.join("/")}`);
|
|
31
|
+
throw new Error(`Cannot find entry file for "${name}" in "${directory}", files checked: ${Constant_1.Constant.mainEntryFilenames.join("/")}`);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
if (htmlPath === null) {
|
|
42
34
|
// Output is a pure js entry (without a companion `index.html` template file)
|
|
43
35
|
// Do not include a hash in the output filenames.
|
|
44
36
|
// One particular use case for this is create a "third-party-error-handler" pure js entry,
|
|
45
37
|
// so this static filename can be hard coded at our backend.
|
|
46
38
|
const outputFilename = "static/js/[name].js";
|
|
47
|
-
return {name, entryPath, outputFilename};
|
|
48
|
-
}
|
|
39
|
+
return { name, entryPath, outputFilename };
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
49
42
|
// Output is an html entry (with a companion `index.html` template file)
|
|
50
43
|
// We might want to include a hash to the output filenames
|
|
51
44
|
// (don't set the output filename to contain hash for profiling build).
|
|
52
45
|
const outputFilename = "static/js/[chunkhash:8].js";
|
|
53
|
-
return {name, entryPath, outputFilename, htmlPath};
|
|
46
|
+
return { name, entryPath, outputFilename, htmlPath };
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (!(fs.existsSync(searchDirectory) && fs.statSync(searchDirectory).isDirectory())) {
|
|
49
|
+
static findEntryFilepath(searchDirectory) {
|
|
50
|
+
if (!(fs_1.default.existsSync(searchDirectory) && fs_1.default.statSync(searchDirectory).isDirectory())) {
|
|
59
51
|
return null;
|
|
60
52
|
}
|
|
61
|
-
for (const filename of Constant.mainEntryFilenames) {
|
|
62
|
-
const filepath =
|
|
63
|
-
if (
|
|
53
|
+
for (const filename of Constant_1.Constant.mainEntryFilenames) {
|
|
54
|
+
const filepath = path_1.default.join(searchDirectory, filename);
|
|
55
|
+
if (fs_1.default.existsSync(filepath) && fs_1.default.statSync(filepath).isFile()) {
|
|
64
56
|
return filepath;
|
|
65
57
|
}
|
|
66
58
|
}
|
|
67
59
|
return null;
|
|
68
60
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (!(fs.existsSync(searchDirectory) && fs.statSync(searchDirectory).isDirectory())) {
|
|
61
|
+
static findEntryHTMLFilepath(searchDirectory) {
|
|
62
|
+
if (!(fs_1.default.existsSync(searchDirectory) && fs_1.default.statSync(searchDirectory).isDirectory())) {
|
|
72
63
|
return null;
|
|
73
64
|
}
|
|
74
|
-
const filepath =
|
|
75
|
-
if (
|
|
65
|
+
const filepath = path_1.default.join(searchDirectory, "index.html");
|
|
66
|
+
if (fs_1.default.existsSync(filepath) && fs_1.default.statSync(filepath).isFile()) {
|
|
76
67
|
return filepath;
|
|
77
68
|
}
|
|
78
69
|
return null;
|
|
79
70
|
}
|
|
80
71
|
}
|
|
72
|
+
exports.ConfigEntryDescriptorsFactory = ConfigEntryDescriptorsFactory;
|
|
73
|
+
//# sourceMappingURL=ConfigEntryDescriptorsFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigEntryDescriptorsFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/ConfigEntryDescriptorsFactory.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type webpack from "webpack";
|
|
2
|
+
import type { EntryDescriptor } from "../type";
|
|
3
|
+
interface HTMLWebpackPluginsFactoryOptions {
|
|
4
|
+
configEntryDescriptors: EntryDescriptor[];
|
|
5
|
+
}
|
|
6
|
+
export declare class HTMLWebpackPluginsFactory {
|
|
7
|
+
static generate({ configEntryDescriptors }: HTMLWebpackPluginsFactoryOptions): webpack.Plugin[];
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HTMLWebpackPluginsFactory = void 0;
|
|
4
|
+
const Plugin_1 = require("./Plugin");
|
|
5
|
+
class HTMLWebpackPluginsFactory {
|
|
6
|
+
static generate({ configEntryDescriptors }) {
|
|
7
|
+
const htmlPlugins = [];
|
|
8
|
+
for (const { name, entryPath, htmlPath } of configEntryDescriptors) {
|
|
9
|
+
if (htmlPath !== undefined) {
|
|
10
|
+
const plugin = Plugin_1.Plugin.fileOutput.html({
|
|
11
|
+
entry: { name, entryPath, htmlPath },
|
|
12
|
+
});
|
|
13
|
+
htmlPlugins.push(plugin);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return htmlPlugins;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.HTMLWebpackPluginsFactory = HTMLWebpackPluginsFactory;
|
|
20
|
+
//# sourceMappingURL=HTMLWebpackPluginsFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTMLWebpackPluginsFactory.js","sourceRoot":"","sources":["../../../src/WebpackConfigGenerator/HTMLWebpackPluginsFactory.ts"],"names":[],"mappings":";;;AAEA,qCAAgC;AAMhC,MAAa,yBAAyB;IAClC,MAAM,CAAC,QAAQ,CAAC,EAAC,sBAAsB,EAAmC;QACtE,MAAM,WAAW,GAAqB,EAAE,CAAC;QAEzC,KAAK,MAAM,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,IAAI,sBAAsB,EAAE;YAC9D,IAAI,QAAQ,KAAK,SAAS,EAAE;gBACxB,MAAM,MAAM,GAAG,eAAM,CAAC,UAAU,CAAC,IAAI,CAAC;oBAClC,KAAK,EAAE,EAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC;iBACrC,CAAC,CAAC;gBACH,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aAC5B;SACJ;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AAfD,8DAeC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type webpack from "webpack";
|
|
2
|
+
interface ExtractCssPluginOptions {
|
|
3
|
+
enableProfiling: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Applies CssNano to minimize stylesheets
|
|
7
|
+
* after bundles/chunks are built.
|
|
8
|
+
*/
|
|
9
|
+
export declare function cssMinimizerPlugin(): webpack.WebpackPluginInstance;
|
|
10
|
+
/**
|
|
11
|
+
* Extract output of css transformation pipeline to standalone css files.
|
|
12
|
+
* Must be used with `MiniCssExtractPlugin.loader`, which is included with
|
|
13
|
+
* `Rule.stylesheet({minimize: true})`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function miniCssExtractPlugin({ enableProfiling }: ExtractCssPluginOptions): webpack.WebpackPluginInstance;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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.miniCssExtractPlugin = exports.cssMinimizerPlugin = void 0;
|
|
7
|
+
const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
|
|
8
|
+
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
9
|
+
const WebpackConfigSerializationUtil_1 = require("../WebpackConfigSerializationUtil");
|
|
10
|
+
/**
|
|
11
|
+
* Applies CssNano to minimize stylesheets
|
|
12
|
+
* after bundles/chunks are built.
|
|
13
|
+
*/
|
|
14
|
+
function cssMinimizerPlugin() {
|
|
15
|
+
return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("CssMinimizerWebpackPlugin", css_minimizer_webpack_plugin_1.default);
|
|
16
|
+
}
|
|
17
|
+
exports.cssMinimizerPlugin = cssMinimizerPlugin;
|
|
18
|
+
/**
|
|
19
|
+
* Extract output of css transformation pipeline to standalone css files.
|
|
20
|
+
* Must be used with `MiniCssExtractPlugin.loader`, which is included with
|
|
21
|
+
* `Rule.stylesheet({minimize: true})`.
|
|
22
|
+
*/
|
|
23
|
+
function miniCssExtractPlugin({ enableProfiling }) {
|
|
24
|
+
return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("MiniCssExtractPlugin", mini_css_extract_plugin_1.default, {
|
|
25
|
+
filename: enableProfiling ? "static/css/[name].[contenthash:8].css" : "static/css/[contenthash:8].css",
|
|
26
|
+
// order of css output depends on the order of imports in js,
|
|
27
|
+
// unless all imports in js are sorted (e.g. by alphabetical order),
|
|
28
|
+
// this flag must be set to true to avoid error
|
|
29
|
+
ignoreOrder: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.miniCssExtractPlugin = miniCssExtractPlugin;
|
|
33
|
+
//# sourceMappingURL=css.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"css.plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/css.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,gGAAqE;AACrE,sFAA2D;AAE3D,sFAAiF;AAMjF;;;GAGG;AACH,SAAgB,kBAAkB;IAC9B,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,2BAA2B,EAAE,sCAAyB,CAAC,CAAC;AACrH,CAAC;AAFD,gDAEC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,EAAC,eAAe,EAA0B;IAC3E,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,iCAAoB,EAAE;QACnG,QAAQ,EAAE,eAAe,CAAC,CAAC,CAAC,uCAAuC,CAAC,CAAC,CAAC,gCAAgC;QACtG,6DAA6D;QAC7D,oEAAoE;QACpE,+CAA+C;QAC/C,WAAW,EAAE,IAAI;KACpB,CAAC,CAAC;AACP,CAAC;AARD,oDAQC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.esbuildMinimizer = void 0;
|
|
4
|
+
const esbuild_loader_1 = require("esbuild-loader");
|
|
5
|
+
const WebpackConfigSerializationUtil_1 = require("../WebpackConfigSerializationUtil");
|
|
6
|
+
function esbuildMinimizer() {
|
|
7
|
+
return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("ESBuildMinifyPlugin", esbuild_loader_1.ESBuildMinifyPlugin, {
|
|
8
|
+
// Disable Esbuild minify for JS. it is unstable when targeting es5 minify
|
|
9
|
+
minify: false,
|
|
10
|
+
css: true,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.esbuildMinimizer = esbuildMinimizer;
|
|
14
|
+
//# sourceMappingURL=esbuild.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/esbuild.plugin.ts"],"names":[],"mappings":";;;AACA,mDAAmD;AACnD,sFAAiF;AAEjF,SAAgB,gBAAgB;IAC5B,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,oCAAmB,EAAE;QACjG,0EAA0E;QAC1E,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,IAAI;KACZ,CAAC,CAAC;AACP,CAAC;AAND,4CAMC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type webpack from "webpack";
|
|
2
|
+
import type { HTMLEntryDescriptor } from "../../type";
|
|
3
|
+
interface HTMLPluginOptions {
|
|
4
|
+
entry: HTMLEntryDescriptor;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Creates a html file from a template with <script> and <link> injected
|
|
8
|
+
* with the respective hashed output filenames.
|
|
9
|
+
*/
|
|
10
|
+
export declare function htmlPlugin({ entry }: HTMLPluginOptions): webpack.WebpackPluginInstance;
|
|
11
|
+
/**
|
|
12
|
+
* Adds attributes to `<script>` tag inside html file generated by
|
|
13
|
+
* HTMLWebpackPlugin. Used to add `crossorigin="anonymous"`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function scriptTagCrossOriginPlugin(): webpack.WebpackPluginInstance;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
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.scriptTagCrossOriginPlugin = exports.htmlPlugin = void 0;
|
|
7
|
+
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
8
|
+
const script_tag_crossorigin_plugin_1 = require("./script-tag-crossorigin-plugin");
|
|
9
|
+
const WebpackConfigSerializationUtil_1 = require("../WebpackConfigSerializationUtil");
|
|
10
|
+
/**
|
|
11
|
+
* Creates a html file from a template with <script> and <link> injected
|
|
12
|
+
* with the respective hashed output filenames.
|
|
13
|
+
*/
|
|
14
|
+
function htmlPlugin({ entry }) {
|
|
15
|
+
return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("HTMLWebpackPlugin", html_webpack_plugin_1.default, {
|
|
16
|
+
template: entry.htmlPath,
|
|
17
|
+
filename: `${entry.name}.html`,
|
|
18
|
+
chunks: [entry.name],
|
|
19
|
+
minify: {
|
|
20
|
+
collapseBooleanAttributes: true,
|
|
21
|
+
collapseInlineTagWhitespace: true,
|
|
22
|
+
collapseWhitespace: true,
|
|
23
|
+
includeAutoGeneratedTags: false,
|
|
24
|
+
keepClosingSlash: true,
|
|
25
|
+
minifyCSS: true,
|
|
26
|
+
minifyJS: true,
|
|
27
|
+
minifyURLs: true,
|
|
28
|
+
removeAttributeQuotes: true,
|
|
29
|
+
removeComments: true,
|
|
30
|
+
removeEmptyAttributes: true,
|
|
31
|
+
removeRedundantAttributes: true,
|
|
32
|
+
removeScriptTypeAttributes: true,
|
|
33
|
+
removeStyleLinkTypeAttributes: true,
|
|
34
|
+
removeTagWhitespace: true,
|
|
35
|
+
useShortDoctype: true,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.htmlPlugin = htmlPlugin;
|
|
40
|
+
/**
|
|
41
|
+
* Adds attributes to `<script>` tag inside html file generated by
|
|
42
|
+
* HTMLWebpackPlugin. Used to add `crossorigin="anonymous"`.
|
|
43
|
+
*/
|
|
44
|
+
function scriptTagCrossOriginPlugin() {
|
|
45
|
+
return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("ScriptTagCrossOriginPlugin", script_tag_crossorigin_plugin_1.ScriptTagCrossOriginPlugin);
|
|
46
|
+
}
|
|
47
|
+
exports.scriptTagCrossOriginPlugin = scriptTagCrossOriginPlugin;
|
|
48
|
+
//# sourceMappingURL=html.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/html.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,8EAAoD;AACpD,mFAA2E;AAG3E,sFAAiF;AAMjF;;;GAGG;AACH,SAAgB,UAAU,CAAC,EAAC,KAAK,EAAoB;IACjD,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,6BAAiB,EAAE;QAC7F,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,GAAG,KAAK,CAAC,IAAI,OAAO;QAC9B,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;QACpB,MAAM,EAAE;YACJ,yBAAyB,EAAE,IAAI;YAC/B,2BAA2B,EAAE,IAAI;YACjC,kBAAkB,EAAE,IAAI;YACxB,wBAAwB,EAAE,KAAK;YAC/B,gBAAgB,EAAE,IAAI;YACtB,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,IAAI;YAChB,qBAAqB,EAAE,IAAI;YAC3B,cAAc,EAAE,IAAI;YACpB,qBAAqB,EAAE,IAAI;YAC3B,yBAAyB,EAAE,IAAI;YAC/B,0BAA0B,EAAE,IAAI;YAChC,6BAA6B,EAAE,IAAI;YACnC,mBAAmB,EAAE,IAAI;YACzB,eAAe,EAAE,IAAI;SACxB;KACJ,CAAC,CAAC;AACP,CAAC;AAxBD,gCAwBC;AAED;;;GAGG;AACH,SAAgB,0BAA0B;IACtC,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,4BAA4B,EAAE,0DAA0B,CAAC,CAAC;AACvH,CAAC;AAFD,gEAEC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { cssMinimizerPlugin, miniCssExtractPlugin } from "./css.plugin";
|
|
2
|
+
import { esbuildMinimizer } from "./esbuild.plugin";
|
|
3
|
+
import { scriptTagCrossOriginPlugin, htmlPlugin } from "./html.plugin";
|
|
4
|
+
import { ignoreMomentLocalePlugin } from "./moment.plugin";
|
|
5
|
+
import { reactRefreshPlugin, terserPlugin } from "./ts.plugin";
|
|
6
|
+
import { webpackDefinePlugin, webpackProgressPlugin } from "./webpack.plugin";
|
|
7
|
+
/**
|
|
8
|
+
* Static factories to create \`webpack.config#plugins\` items.
|
|
9
|
+
*
|
|
10
|
+
* Plugins with similar functionality are grouped under a js object (as a namespace).
|
|
11
|
+
*/
|
|
12
|
+
export declare class Plugin {
|
|
13
|
+
static readonly scriptTagCrossOriginPlugin: typeof scriptTagCrossOriginPlugin;
|
|
14
|
+
static readonly ignoreMomentLocale: typeof ignoreMomentLocalePlugin;
|
|
15
|
+
static readonly reactRefresh: typeof reactRefreshPlugin;
|
|
16
|
+
static readonly fileOutput: {
|
|
17
|
+
html: typeof htmlPlugin;
|
|
18
|
+
miniCssExtract: typeof miniCssExtractPlugin;
|
|
19
|
+
};
|
|
20
|
+
static readonly minimizer: {
|
|
21
|
+
cssMinimizer: typeof cssMinimizerPlugin;
|
|
22
|
+
terser: typeof terserPlugin;
|
|
23
|
+
esbuildMinimizer: typeof esbuildMinimizer;
|
|
24
|
+
};
|
|
25
|
+
static readonly webpack: {
|
|
26
|
+
progress: typeof webpackProgressPlugin;
|
|
27
|
+
define: typeof webpackDefinePlugin;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Plugin = void 0;
|
|
4
|
+
const css_plugin_1 = require("./css.plugin");
|
|
5
|
+
const esbuild_plugin_1 = require("./esbuild.plugin");
|
|
6
|
+
const html_plugin_1 = require("./html.plugin");
|
|
7
|
+
const moment_plugin_1 = require("./moment.plugin");
|
|
8
|
+
const ts_plugin_1 = require("./ts.plugin");
|
|
9
|
+
const webpack_plugin_1 = require("./webpack.plugin");
|
|
10
|
+
/**
|
|
11
|
+
* Static factories to create \`webpack.config#plugins\` items.
|
|
12
|
+
*
|
|
13
|
+
* Plugins with similar functionality are grouped under a js object (as a namespace).
|
|
14
|
+
*/
|
|
15
|
+
class Plugin {
|
|
16
|
+
}
|
|
17
|
+
exports.Plugin = Plugin;
|
|
18
|
+
Plugin.scriptTagCrossOriginPlugin = html_plugin_1.scriptTagCrossOriginPlugin;
|
|
19
|
+
Plugin.ignoreMomentLocale = moment_plugin_1.ignoreMomentLocalePlugin;
|
|
20
|
+
Plugin.reactRefresh = ts_plugin_1.reactRefreshPlugin;
|
|
21
|
+
Plugin.fileOutput = {
|
|
22
|
+
html: html_plugin_1.htmlPlugin,
|
|
23
|
+
miniCssExtract: css_plugin_1.miniCssExtractPlugin,
|
|
24
|
+
};
|
|
25
|
+
Plugin.minimizer = {
|
|
26
|
+
cssMinimizer: css_plugin_1.cssMinimizerPlugin,
|
|
27
|
+
terser: ts_plugin_1.terserPlugin,
|
|
28
|
+
esbuildMinimizer: esbuild_plugin_1.esbuildMinimizer,
|
|
29
|
+
};
|
|
30
|
+
Plugin.webpack = {
|
|
31
|
+
progress: webpack_plugin_1.webpackProgressPlugin,
|
|
32
|
+
define: webpack_plugin_1.webpackDefinePlugin,
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/index.ts"],"names":[],"mappings":";;;AAAA,6CAAsE;AACtE,qDAAkD;AAClD,+CAAqE;AACrE,mDAAyD;AACzD,2CAA6D;AAC7D,qDAA4E;AAE5E;;;;GAIG;AACH,MAAa,MAAM;;AAAnB,wBAsBC;AArBmB,iCAA0B,GAAG,wCAA0B,CAAC;AAExD,yBAAkB,GAAG,wCAAwB,CAAC;AAE9C,mBAAY,GAAG,8BAAkB,CAAC;AAElC,iBAAU,GAAG;IACzB,IAAI,EAAE,wBAAU;IAChB,cAAc,EAAE,iCAAoB;CACvC,CAAC;AAEc,gBAAS,GAAG;IACxB,YAAY,EAAE,+BAAkB;IAChC,MAAM,EAAE,wBAAY;IACpB,gBAAgB,EAAhB,iCAAgB;CACnB,CAAC;AAEc,cAAO,GAAG;IACtB,QAAQ,EAAE,sCAAqB;IAC/B,MAAM,EAAE,oCAAmB;CAC9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import webpack from "webpack";
|
|
2
|
+
/**
|
|
3
|
+
* Prevents moment locales from being bundled by importing moment
|
|
4
|
+
* (moment by default imports all locales)
|
|
5
|
+
* and helps reduce the final bundle size.
|
|
6
|
+
*
|
|
7
|
+
* To include a locale, it must be explicitly imported
|
|
8
|
+
* (preferably at the entry file).
|
|
9
|
+
*/
|
|
10
|
+
export declare function ignoreMomentLocalePlugin(): webpack.WebpackPluginInstance;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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.ignoreMomentLocalePlugin = void 0;
|
|
7
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
8
|
+
const WebpackConfigSerializationUtil_1 = require("../WebpackConfigSerializationUtil");
|
|
4
9
|
/**
|
|
5
10
|
* Prevents moment locales from being bundled by importing moment
|
|
6
11
|
* (moment by default imports all locales)
|
|
@@ -9,8 +14,8 @@ import {WebpackConfigSerializationUtil} from "../WebpackConfigSerializationUtil"
|
|
|
9
14
|
* To include a locale, it must be explicitly imported
|
|
10
15
|
* (preferably at the entry file).
|
|
11
16
|
*/
|
|
12
|
-
|
|
13
|
-
return WebpackConfigSerializationUtil.serializablePlugin("webpack.IgnorePlugin",
|
|
17
|
+
function ignoreMomentLocalePlugin() {
|
|
18
|
+
return WebpackConfigSerializationUtil_1.WebpackConfigSerializationUtil.serializablePlugin("webpack.IgnorePlugin", webpack_1.default.IgnorePlugin, {
|
|
14
19
|
// check dependency-request against the provided regex,
|
|
15
20
|
// and exclude resource from final bundle if matched;
|
|
16
21
|
// e.g. `/^\.\/locale$/` matches the dependency-request `require("./locale/" + name)`
|
|
@@ -20,3 +25,5 @@ export function ignoreMomentLocalePlugin(): webpack.WebpackPluginInstance {
|
|
|
20
25
|
contextRegExp: /moment$/,
|
|
21
26
|
});
|
|
22
27
|
}
|
|
28
|
+
exports.ignoreMomentLocalePlugin = ignoreMomentLocalePlugin;
|
|
29
|
+
//# sourceMappingURL=moment.plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moment.plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/moment.plugin.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAC9B,sFAAiF;AAEjF;;;;;;;GAOG;AACH,SAAgB,wBAAwB;IACpC,OAAO,+DAA8B,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,iBAAO,CAAC,YAAY,EAAE;QACnG,uDAAuD;QACvD,qDAAqD;QACrD,qFAAqF;QACrF,cAAc,EAAE,cAAc;QAC9B,wDAAwD;QACxD,0GAA0G;QAC1G,aAAa,EAAE,SAAS;KAC3B,CAAC,CAAC;AACP,CAAC;AAVD,4DAUC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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.ScriptTagCrossOriginPlugin = void 0;
|
|
7
|
+
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
8
|
+
const PLUGIN_NAME = "ScriptTagCrossOriginPlugin";
|
|
9
|
+
// This plugin adds crossorigin="anonymous" to html-webpack-plugin generated <script> tags, only work with html-webpack-plugin@4.0.0+
|
|
10
|
+
class ScriptTagCrossOriginPlugin {
|
|
11
|
+
apply(compiler) {
|
|
12
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, compilation => {
|
|
13
|
+
const hook = html_webpack_plugin_1.default.getHooks(compilation).alterAssetTags;
|
|
14
|
+
hook.tap(PLUGIN_NAME, result => {
|
|
15
|
+
var _a;
|
|
16
|
+
const { assetTags } = result;
|
|
17
|
+
for (const scriptTag of assetTags.scripts) {
|
|
18
|
+
if (((_a = scriptTag.attributes) === null || _a === void 0 ? void 0 : _a.src) && /.js$/.test(scriptTag.attributes.src.toString())) {
|
|
19
|
+
scriptTag.attributes.crossorigin = "anonymous";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.ScriptTagCrossOriginPlugin = ScriptTagCrossOriginPlugin;
|
|
28
|
+
//# sourceMappingURL=script-tag-crossorigin-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script-tag-crossorigin-plugin.js","sourceRoot":"","sources":["../../../../src/WebpackConfigGenerator/Plugin/script-tag-crossorigin-plugin.ts"],"names":[],"mappings":";;;;;;AAAA,8EAAoD;AAGpD,MAAM,WAAW,GAAG,4BAA4B,CAAC;AAEjD,qIAAqI;AACrI,MAAa,0BAA0B;IACnC,KAAK,CAAC,QAA0B;QAC5B,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE;YACtD,MAAM,IAAI,GAAG,6BAAiB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,cAAc,CAAC;YACpE,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE;;gBAC3B,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC;gBAC3B,KAAK,MAAM,SAAS,IAAI,SAAS,CAAC,OAAO,EAAE;oBACvC,IAAI,CAAA,MAAA,SAAS,CAAC,UAAU,0CAAE,GAAG,KAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE;wBAC/E,SAAS,CAAC,UAAU,CAAC,WAAW,GAAG,WAAW,CAAC;qBAClD;iBACJ;gBACD,OAAO,MAAM,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAfD,gEAeC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type webpack from "webpack";
|
|
2
|
+
interface TerserPluginOptions {
|
|
3
|
+
sourceMap: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Applies Terser to minimize javascript
|
|
7
|
+
* after bundles/chunks are built.
|
|
8
|
+
*/
|
|
9
|
+
export declare function terserPlugin({ sourceMap }: TerserPluginOptions): webpack.WebpackPluginInstance;
|
|
10
|
+
/**
|
|
11
|
+
* Adds react fast refresh functionality.
|
|
12
|
+
* Requires babel plugin "react-refresh/babel".
|
|
13
|
+
* Should not be used in production.
|
|
14
|
+
*/
|
|
15
|
+
export declare function reactRefreshPlugin(): webpack.WebpackPluginInstance;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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,20 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RegExpUtil = void 0;
|
|
4
|
+
class RegExpUtil {
|
|
5
|
+
static fileExtension(...extensions) {
|
|
6
|
+
const escapedExtensions = [];
|
|
4
7
|
for (const ext of extensions) {
|
|
5
8
|
RegExpUtil.validateFileExtension(ext);
|
|
6
|
-
escapedExtensions.push(ext.replace(/\./g, String.raw`\.`));
|
|
9
|
+
escapedExtensions.push(ext.replace(/\./g, String.raw `\.`));
|
|
7
10
|
}
|
|
8
11
|
return new RegExp(`(${escapedExtensions.join("|")})$`);
|
|
9
12
|
}
|
|
10
|
-
|
|
11
|
-
private static validateFileExtension(ext: string): void {
|
|
13
|
+
static validateFileExtension(ext) {
|
|
12
14
|
if (ext.trim() === "") {
|
|
13
15
|
throw new Error("Extension cannot be empty.");
|
|
14
|
-
}
|
|
16
|
+
}
|
|
17
|
+
else if (/\s/.test(ext)) {
|
|
15
18
|
throw new Error(`Extension cannot contain whitespace, received: "${ext}".`);
|
|
16
|
-
}
|
|
19
|
+
}
|
|
20
|
+
else if (!/^(\.[a-z0-9]+)+$/.test(ext)) {
|
|
17
21
|
throw new Error(`Extension should begin with dot, and contains lowercase letters and numbers, received: "${ext}".`);
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
}
|
|
25
|
+
exports.RegExpUtil = RegExpUtil;
|
|
26
|
+
//# sourceMappingURL=RegExpUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|