@raisenow/tamaro-cli 1.6.0-dev.1 → 1.6.0-dev.2
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/README.md +84 -0
- package/{.history/dist/chunk-FICM3HUI_20230912201610.js → dist/chunk-FI7KZAG6.js} +141 -45
- package/dist/cli.js +1425 -562
- package/dist/webpack.config.js +441 -310
- package/package.json +16 -4
- package/.history/.eslintignore_20220609190420 +0 -4
- package/.history/.eslintignore_20230911190227 +0 -6
- package/.history/.eslintignore_20230911211247 +0 -7
- package/.history/.eslintignore_20230911211250 +0 -7
- package/.history/.eslintrc_20230911201601.js +0 -49
- package/.history/.eslintrc_20230911201643.js +0 -49
- package/.history/.eslintrc_20230911201735.js +0 -49
- package/.history/.eslintrc_20230911201913.js +0 -64
- package/.history/.eslintrc_20230911202002.js +0 -62
- package/.history/.eslintrc_20230911202138.js +0 -133
- package/.history/.eslintrc_20230911202140.js +0 -133
- package/.history/.eslintrc_20230911202145.js +0 -133
- package/.history/.eslintrc_20230911202147.js +0 -133
- package/.history/.eslintrc_20230911202406.js +0 -133
- package/.history/.eslintrc_20230911202447.js +0 -133
- package/.history/.eslintrc_20230911202453.js +0 -133
- package/.history/.eslintrc_20230911202511.js +0 -133
- package/.history/.eslintrc_20230911202527.js +0 -133
- package/.history/.eslintrc_20230911202639.js +0 -125
- package/.history/.eslintrc_20230911202721.js +0 -149
- package/.history/.eslintrc_20230911202746.js +0 -149
- package/.history/.eslintrc_20240423125702.cjs +0 -148
- package/.history/.gitignore_20220609190420 +0 -14
- package/.history/.gitignore_20230911185959 +0 -4
- package/.history/.gitignore_20230911190006 +0 -4
- package/.history/.gitignore_20230911190007 +0 -4
- package/.history/.nmprc_20241004144025 +0 -0
- package/.history/.nmprc_20241004144041 +0 -1
- package/.history/.npmrc_20241004144040 +0 -1
- package/.history/.npmrc_20241004144152 +0 -1
- package/.history/.npmrc_20241004145639 +0 -2
- package/.history/.npmrc_20241004145649 +0 -1
- package/.history/.nvmrc_20250729181039 +0 -1
- package/.history/.prettierignore_20220609190420 +0 -5
- package/.history/.prettierignore_20230911190242 +0 -7
- package/.history/.prettierignore_20230911190245 +0 -7
- package/.history/.prettierignore_20230911211301 +0 -8
- package/.history/CHANGELOG_20250729195139.md +0 -28
- package/.history/CHANGELOG_20250729195148.md +0 -29
- package/.history/CHANGELOG_20250729195156.md +0 -28
- package/.history/CHANGELOG_20250729195218.md +0 -29
- package/.history/CHANGELOG_20250729195223.md +0 -27
- package/.history/CHANGELOG_20250729195506.md +0 -29
- package/.history/CHANGELOG_20250729224404.md +0 -30
- package/.history/CHANGELOG_20250729224411.md +0 -30
- package/.history/CHANGELOG_20250730124538.md +0 -41
- package/.history/CHANGELOG_20250730124603.md +0 -38
- package/.history/CHANGELOG_20250730124627.md +0 -36
- package/.history/CHANGELOG_20250730124638.md +0 -36
- package/.history/CHANGELOG_20250730124640.md +0 -36
- package/.history/README_20230911145033.md +0 -245
- package/.history/README_20230911151749.md +0 -245
- package/.history/README_20230911151844.md +0 -245
- package/.history/README_20230911153040.md +0 -245
- package/.history/README_20230911202959.md +0 -245
- package/.history/bitbucket-pipelines_20250729111540.yml +0 -46
- package/.history/bitbucket-pipelines_20250729210338.yml +0 -46
- package/.history/bitbucket-pipelines_20250729210340.yml +0 -46
- package/.history/bitbucket-pipelines_20250729210342.yml +0 -46
- package/.history/bitbucket-pipelines_20250729222234.yml +0 -47
- package/.history/bitbucket-pipelines_20250729222554.yml +0 -47
- package/.history/bitbucket-pipelines_20250729222555.yml +0 -47
- package/.history/bitbucket-pipelines_20250729223022.yml +0 -46
- package/.history/bitbucket-pipelines_20250729223024.yml +0 -46
- package/.history/cli_20241005014539 +0 -3
- package/.history/cli_20241005014542 +0 -3
- package/.history/cli_20241005014848 +0 -3
- package/.history/dist/chunk-FICM3HUI_20230912183408.js +0 -302
- package/.history/package_20250729182417.json +0 -111
- package/.history/package_20250729182419.json +0 -111
- package/.history/package_20250729182618.json +0 -110
- package/.history/package_20250729182834.json +0 -110
- package/.history/package_20250729183032.json +0 -110
- package/.history/package_20250729183033.json +0 -110
- package/.history/package_20250729185750.json +0 -110
- package/.history/package_20250729185815.json +0 -110
- package/.history/package_20250729185846.json +0 -110
- package/.history/package_20250729185854.json +0 -110
- package/.history/package_20250729185943.json +0 -110
- package/.history/package_20250729190645.json +0 -110
- package/.history/package_20250729195934.json +0 -110
- package/.history/package_20250729200013.json +0 -110
- package/.history/package_20250729200056.json +0 -110
- package/.history/package_20250729200434.json +0 -110
- package/.history/package_20250729200808.json +0 -110
- package/.history/package_20250729200944.json +0 -110
- package/.history/package_20250729214420.json +0 -114
- package/.history/package_20250729223112.json +0 -110
- package/.history/package_20250729223127.json +0 -110
- package/.history/package_20250729223134.json +0 -110
- package/.history/package_20250730124647.json +0 -114
- package/.history/tsconfig_20241005001442.json +0 -34
- package/.history/tsconfig_20241005001500.json +0 -34
- package/.history/tsconfig_20241005001540.json +0 -34
- package/.history/tsconfig_20241005014429.json +0 -42
- package/.history/tsconfig_20241005014436.json +0 -42
- package/.history/tsconfig_20241005014439.json +0 -38
- package/.history/tsconfig_20241005014455.json +0 -38
- package/.history/tsconfig_20241005014521.json +0 -38
- package/.history/vitest.config_20250729214539.ts +0 -0
- package/.history/vitest.config_20250729214659.ts +0 -24
- package/.history/vitest.config_20250729214748.ts +0 -21
- package/.history/vitest.config_20250729214825.ts +0 -21
- package/.history/vitest.config_20250729214902.ts +0 -21
- package/.history/vitest.config_20250729222125.ts +0 -20
- package/.history/vitest.config_20250729222213.ts +0 -20
- package/.idea/codeStyles/Project.xml +0 -131
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/misc.xml +0 -17
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/tamaro-cli.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/dist/env-Cpc7KHou.js +0 -245
- package/tsdown.config.ts +0 -11
package/dist/webpack.config.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
HTTPS_CRT_FILE,
|
|
3
|
+
HTTPS_KEY_FILE,
|
|
4
|
+
extensions,
|
|
5
|
+
getEnvVars,
|
|
6
|
+
getIfCoreFns,
|
|
7
|
+
getPaths,
|
|
8
|
+
getRelativePaths,
|
|
9
|
+
logDataTable,
|
|
10
|
+
logTitle,
|
|
11
|
+
resolveApp,
|
|
12
|
+
resolveEslintPluginConfig
|
|
13
|
+
} from "./chunk-FI7KZAG6.js";
|
|
14
|
+
|
|
15
|
+
// src/webpack.config.ts
|
|
16
|
+
import { existsSync } from "fs";
|
|
3
17
|
import { createRequire } from "module";
|
|
4
18
|
import { basename, dirname, resolve } from "path";
|
|
5
|
-
import { existsSync } from "fs";
|
|
6
|
-
import { getIfUtils, removeEmpty } from "webpack-config-utils";
|
|
7
19
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
8
20
|
import StatoscopeWebpackPlugin from "@statoscope/webpack-plugin";
|
|
9
21
|
import { CleanWebpackPlugin } from "clean-webpack-plugin";
|
|
@@ -11,319 +23,438 @@ import CopyPlugin from "copy-webpack-plugin";
|
|
|
11
23
|
import CssMinimizerPlugin from "css-minimizer-webpack-plugin";
|
|
12
24
|
import ESLintPlugin from "eslint-webpack-plugin";
|
|
13
25
|
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin";
|
|
14
|
-
import
|
|
26
|
+
import { globSync } from "glob";
|
|
27
|
+
import HtmlWebpackPlugin2 from "html-webpack-plugin";
|
|
15
28
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
16
29
|
import TerserPlugin from "terser-webpack-plugin";
|
|
17
30
|
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
|
|
18
31
|
import webpack from "webpack";
|
|
19
|
-
import "webpack-
|
|
20
|
-
import escapeStringRegexp from "escape-string-regexp";
|
|
32
|
+
import { getIfUtils, removeEmpty } from "webpack-config-utils";
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
// src/lib/InterpolateHtmlPlugin.ts
|
|
35
|
+
import escapeStringRegexp from "escape-string-regexp";
|
|
36
|
+
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
37
|
+
var PLUGIN_NAME = "InterpolateHtmlPlugin";
|
|
24
38
|
var InterpolateHtmlPlugin = class {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
replacements;
|
|
40
|
+
constructor(replacements) {
|
|
41
|
+
this.replacements = { ...replacements };
|
|
42
|
+
}
|
|
43
|
+
apply(compiler) {
|
|
44
|
+
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
45
|
+
const hooks = HtmlWebpackPlugin.getHooks(compilation);
|
|
46
|
+
hooks.alterAssetTagGroups.tap(PLUGIN_NAME, (assets) => {
|
|
47
|
+
const publicUrl = this.replacements.PUBLIC_URL ?? "";
|
|
48
|
+
const entry = assets.headTags[0].attributes.src;
|
|
49
|
+
this.replacements.ENTRY = `${publicUrl}${entry}`;
|
|
50
|
+
return assets;
|
|
51
|
+
});
|
|
52
|
+
hooks.afterTemplateExecution.tap(PLUGIN_NAME, (data) => {
|
|
53
|
+
Object.entries(this.replacements).forEach(([key, value]) => {
|
|
54
|
+
data.html = data.html.replace(
|
|
55
|
+
new RegExp(`%${escapeStringRegexp(key)}%`, "g"),
|
|
56
|
+
value ?? ""
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
return data;
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
46
63
|
};
|
|
47
64
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
65
|
+
// src/webpack.config.ts
|
|
66
|
+
var require2 = createRequire(import.meta.url);
|
|
67
|
+
var imageInlineSizeLimit = 0;
|
|
68
|
+
var getWebpackConfig = (env) => {
|
|
69
|
+
const { ifMin, ifNotMin } = getIfUtils(env, ["min"]);
|
|
70
|
+
const { ifAnalyze } = getIfUtils(env, ["analyze"]);
|
|
71
|
+
const { ifHttps } = getIfUtils(env, ["https"]);
|
|
72
|
+
const { ifLocalCore } = getIfUtils(env, ["localCore"]);
|
|
73
|
+
const { ifCore } = getIfCoreFns();
|
|
74
|
+
const paths = getPaths(ifCore);
|
|
75
|
+
const appHtmlFiles = globSync(paths.appHtml);
|
|
76
|
+
const appEnvFiles = globSync(paths.appEnv);
|
|
77
|
+
const envVars = getEnvVars(appEnvFiles, ifMin, ifCore, ifLocalCore, ifHttps);
|
|
78
|
+
const { ifHmr } = getIfUtils({ hmr: process.env.HMR_ENABLED === "true" }, ["hmr"]);
|
|
79
|
+
const { ifNolint } = getIfUtils(env, ["nolint"]);
|
|
80
|
+
const useTailwind = ifCore() && paths.appTailwindConfig && existsSync(paths.appTailwindConfig);
|
|
81
|
+
const eslintPluginConfig = resolveEslintPluginConfig(paths);
|
|
82
|
+
logTitle("Paths:");
|
|
83
|
+
logDataTable(getRelativePaths(paths));
|
|
84
|
+
logTitle("Environment variables:");
|
|
85
|
+
logDataTable(envVars.raw);
|
|
86
|
+
const getCssLoaders = ({
|
|
87
|
+
styleLoader = true,
|
|
88
|
+
sassLoader = true,
|
|
89
|
+
...cssOptions
|
|
90
|
+
}) => {
|
|
91
|
+
const importLoaders = sassLoader ? 3 : 1;
|
|
92
|
+
return removeEmpty([
|
|
93
|
+
styleLoader ? ifMin({ loader: MiniCssExtractPlugin.loader }) : void 0,
|
|
94
|
+
styleLoader ? ifNotMin({
|
|
95
|
+
loader: require2.resolve("style-loader"),
|
|
96
|
+
options: {
|
|
97
|
+
attributes: {
|
|
98
|
+
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}) : void 0,
|
|
102
|
+
{
|
|
103
|
+
loader: require2.resolve("css-loader"),
|
|
104
|
+
options: {
|
|
105
|
+
sourceMap: ifNotMin(),
|
|
106
|
+
importLoaders,
|
|
107
|
+
...cssOptions
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
loader: require2.resolve("postcss-loader"),
|
|
112
|
+
options: {
|
|
113
|
+
postcssOptions: {
|
|
114
|
+
plugins: removeEmpty([
|
|
115
|
+
!sassLoader ? require2.resolve("postcss-import") : void 0,
|
|
116
|
+
!sassLoader ? require2.resolve("postcss-nested") : void 0,
|
|
117
|
+
useTailwind ? [
|
|
118
|
+
require2.resolve("tailwindcss", {
|
|
119
|
+
paths: [paths.appNodeModules]
|
|
120
|
+
}),
|
|
121
|
+
paths.appTailwindConfig
|
|
122
|
+
] : void 0,
|
|
123
|
+
// require.resolve('postcss-custom-properties'),
|
|
124
|
+
require2.resolve("autoprefixer")
|
|
125
|
+
])
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
sassLoader ? {
|
|
130
|
+
loader: require2.resolve("resolve-url-loader"),
|
|
131
|
+
options: { sourceMap: ifNotMin() }
|
|
132
|
+
} : void 0,
|
|
133
|
+
sassLoader ? {
|
|
134
|
+
loader: require2.resolve("sass-loader"),
|
|
135
|
+
options: { api: "modern-compiler", sourceMap: true }
|
|
136
|
+
} : void 0
|
|
137
|
+
]);
|
|
138
|
+
};
|
|
139
|
+
const config = {
|
|
140
|
+
mode: ifMin("production", "development"),
|
|
141
|
+
resolve: {
|
|
142
|
+
symlinks: false,
|
|
143
|
+
extensions: [...extensions, "..."],
|
|
144
|
+
modules: ["node_modules", paths.appNodeModules],
|
|
145
|
+
plugins: [
|
|
146
|
+
new TsconfigPathsPlugin({
|
|
147
|
+
configFile: paths.appTsConfig,
|
|
148
|
+
extensions
|
|
149
|
+
})
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
entry: paths.appEntry,
|
|
153
|
+
output: {
|
|
154
|
+
publicPath: "auto",
|
|
155
|
+
path: ifMin(paths.appDist, void 0),
|
|
156
|
+
pathinfo: false,
|
|
157
|
+
filename: ifCore("index.js", "widget.js"),
|
|
158
|
+
chunkFilename: ifMin("[name]-[contenthash:16].js", "[name].js"),
|
|
159
|
+
assetModuleFilename: "assets/[name]-[contenthash:16][ext]",
|
|
160
|
+
crossOriginLoading: "anonymous",
|
|
161
|
+
uniqueName: process.env.WEBPACK_UNIQUE_NAME
|
|
162
|
+
},
|
|
163
|
+
stats: ifAnalyze(
|
|
164
|
+
{
|
|
165
|
+
all: void 0
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
modules: false,
|
|
169
|
+
children: false,
|
|
170
|
+
chunks: false,
|
|
171
|
+
env: true,
|
|
172
|
+
entrypoints: true,
|
|
173
|
+
errorDetails: true
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
module: {
|
|
177
|
+
rules: removeEmpty([
|
|
178
|
+
{
|
|
179
|
+
oneOf: [
|
|
180
|
+
/**
|
|
181
|
+
* App Javascript and Typescript (Babel)
|
|
182
|
+
* and some dependencies distributed in a non-es5 formats
|
|
183
|
+
*/
|
|
184
|
+
{
|
|
185
|
+
test: /\.(js|ts)x?$/,
|
|
186
|
+
include: ifCore(
|
|
187
|
+
[
|
|
188
|
+
resolveApp("src"),
|
|
189
|
+
resolveApp("node_modules/micromark"),
|
|
190
|
+
resolveApp("node_modules/decode-named-character-reference")
|
|
191
|
+
],
|
|
192
|
+
[resolveApp("."), resolveApp("../../src")]
|
|
193
|
+
),
|
|
194
|
+
loader: require2.resolve("babel-loader"),
|
|
195
|
+
options: {
|
|
196
|
+
babelrc: false,
|
|
197
|
+
configFile: false,
|
|
198
|
+
sourceMaps: ifNotMin(),
|
|
199
|
+
inputSourceMap: ifNotMin(),
|
|
200
|
+
presets: [
|
|
201
|
+
require2.resolve("@babel/preset-env"),
|
|
202
|
+
[
|
|
203
|
+
require2.resolve("@babel/preset-typescript"),
|
|
204
|
+
{
|
|
205
|
+
allowDeclareFields: true
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
[
|
|
209
|
+
require2.resolve("@babel/preset-react"),
|
|
210
|
+
{
|
|
211
|
+
runtime: "automatic"
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
],
|
|
215
|
+
plugins: removeEmpty([
|
|
216
|
+
[
|
|
217
|
+
require2.resolve("@babel/plugin-transform-runtime"),
|
|
218
|
+
{
|
|
219
|
+
corejs: {
|
|
220
|
+
version: 3,
|
|
221
|
+
proposals: true
|
|
222
|
+
},
|
|
223
|
+
absoluteRuntime: dirname(
|
|
224
|
+
require2.resolve("@babel/runtime-corejs3/package.json")
|
|
225
|
+
)
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
[
|
|
229
|
+
require2.resolve("@babel/plugin-proposal-decorators"),
|
|
230
|
+
{
|
|
231
|
+
legacy: true
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
require2.resolve("@babel/plugin-syntax-dynamic-import"),
|
|
235
|
+
require2.resolve("babel-plugin-lodash"),
|
|
236
|
+
ifHmr(require2.resolve("react-refresh/babel")),
|
|
237
|
+
ifNotMin(require2.resolve("babel-plugin-istanbul"))
|
|
238
|
+
])
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
// Other Javascript (not in app) - no transformation
|
|
242
|
+
{
|
|
243
|
+
test: /\.(js|mjs)$/
|
|
244
|
+
},
|
|
245
|
+
// SCSS Styles (extracted)
|
|
246
|
+
{
|
|
247
|
+
test: /\.scss$/,
|
|
248
|
+
resourceQuery: { not: [/inline/] },
|
|
249
|
+
use: getCssLoaders({
|
|
250
|
+
styleLoader: true,
|
|
251
|
+
sassLoader: true
|
|
252
|
+
})
|
|
253
|
+
},
|
|
254
|
+
// CSS Styles (extracted)
|
|
255
|
+
{
|
|
256
|
+
test: /\.css$/,
|
|
257
|
+
resourceQuery: { not: [/inline/] },
|
|
258
|
+
use: getCssLoaders({
|
|
259
|
+
styleLoader: true,
|
|
260
|
+
sassLoader: false
|
|
261
|
+
})
|
|
262
|
+
},
|
|
263
|
+
// SCSS Styles (as string)
|
|
264
|
+
{
|
|
265
|
+
test: /\.scss$/,
|
|
266
|
+
resourceQuery: /inline/,
|
|
267
|
+
use: getCssLoaders({
|
|
268
|
+
styleLoader: false,
|
|
269
|
+
sassLoader: true,
|
|
270
|
+
exportType: "string",
|
|
271
|
+
sourceMap: false
|
|
272
|
+
})
|
|
273
|
+
},
|
|
274
|
+
// CSS Styles (as string)
|
|
275
|
+
{
|
|
276
|
+
test: /\.css$/,
|
|
277
|
+
resourceQuery: /inline/,
|
|
278
|
+
use: getCssLoaders({
|
|
279
|
+
styleLoader: false,
|
|
280
|
+
sassLoader: false,
|
|
281
|
+
exportType: "string",
|
|
282
|
+
sourceMap: false
|
|
283
|
+
})
|
|
284
|
+
},
|
|
285
|
+
// Images and fonts
|
|
286
|
+
{
|
|
287
|
+
test: /\.(png|jpe?g|svg|webp|gif|ico|ttf|eot|woff2?)$/,
|
|
288
|
+
type: "asset",
|
|
289
|
+
parser: {
|
|
290
|
+
dataUrlCondition: {
|
|
291
|
+
maxSize: imageInlineSizeLimit
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
// YML
|
|
296
|
+
{
|
|
297
|
+
test: /\.ya?ml$/,
|
|
298
|
+
use: [
|
|
299
|
+
{ loader: require2.resolve("json-loader") },
|
|
300
|
+
{
|
|
301
|
+
loader: require2.resolve("yaml-loader"),
|
|
302
|
+
options: { asJSON: true }
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
// HTML
|
|
307
|
+
{
|
|
308
|
+
test: /\.html$/,
|
|
309
|
+
loader: require2.resolve("html-loader"),
|
|
310
|
+
options: {
|
|
311
|
+
minimize: false
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
/**
|
|
315
|
+
* All other files - fallback
|
|
316
|
+
* This must be the latest rule!
|
|
317
|
+
*/
|
|
318
|
+
{
|
|
319
|
+
exclude: [/^$/, /\.(js|jsx|ts|tsx|mjs)$/, /\.html$/, /\.json$/],
|
|
320
|
+
type: "asset/resource"
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
])
|
|
325
|
+
},
|
|
326
|
+
devtool: ifMin(false, "cheap-module-source-map"),
|
|
327
|
+
devServer: {
|
|
328
|
+
static: false,
|
|
329
|
+
historyApiFallback: {
|
|
330
|
+
disableDotRule: true
|
|
331
|
+
},
|
|
332
|
+
hot: ifHmr(),
|
|
333
|
+
headers: {
|
|
334
|
+
"Access-Control-Allow-Origin": "*"
|
|
335
|
+
},
|
|
336
|
+
allowedHosts: "all",
|
|
337
|
+
client: {
|
|
338
|
+
overlay: {
|
|
339
|
+
warnings: false,
|
|
340
|
+
errors: true
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
server: ifHttps({
|
|
344
|
+
type: "https",
|
|
345
|
+
options: {
|
|
346
|
+
cert: resolve(paths.root, HTTPS_CRT_FILE),
|
|
347
|
+
key: resolve(paths.root, HTTPS_KEY_FILE)
|
|
348
|
+
}
|
|
349
|
+
})
|
|
350
|
+
},
|
|
351
|
+
optimization: {
|
|
352
|
+
// minimize: false,
|
|
353
|
+
removeEmptyChunks: true,
|
|
354
|
+
// moduleIds: 'deterministic', // todo: use instead of HashedModuleIdsPlugin
|
|
355
|
+
// chunkIds: 'named',
|
|
356
|
+
minimizer: [
|
|
357
|
+
// Keep class names as they are used in runtime for logging purposes
|
|
358
|
+
new TerserPlugin({
|
|
359
|
+
terserOptions: {
|
|
360
|
+
keep_classnames: true,
|
|
361
|
+
keep_fnames: true,
|
|
362
|
+
compress: {
|
|
363
|
+
passes: 2
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}),
|
|
367
|
+
new CssMinimizerPlugin()
|
|
368
|
+
]
|
|
369
|
+
},
|
|
370
|
+
plugins: removeEmpty([
|
|
371
|
+
new webpack.ProgressPlugin(),
|
|
372
|
+
/**
|
|
373
|
+
* Skip ESLint plugin if either:
|
|
374
|
+
* - It's disabled with "nolint" flag.
|
|
375
|
+
* - No ESLint configuration is resolved.
|
|
376
|
+
*/
|
|
377
|
+
ifNolint() || !eslintPluginConfig ? void 0 : new ESLintPlugin(eslintPluginConfig),
|
|
378
|
+
ifMin(
|
|
379
|
+
new CleanWebpackPlugin({
|
|
380
|
+
// verbose: true,
|
|
381
|
+
})
|
|
382
|
+
),
|
|
383
|
+
...appHtmlFiles.map(
|
|
384
|
+
(file) => new HtmlWebpackPlugin2({
|
|
385
|
+
template: file,
|
|
386
|
+
filename: basename(file),
|
|
387
|
+
inject: false,
|
|
388
|
+
minify: false
|
|
389
|
+
// ...ifMin({
|
|
390
|
+
// minify: {
|
|
391
|
+
// collapseWhitespace: true,
|
|
392
|
+
// removeComments: true,
|
|
393
|
+
// removeRedundantAttributes: true,
|
|
394
|
+
// removeScriptTypeAttributes: true,
|
|
395
|
+
// removeStyleLinkTypeAttributes: true,
|
|
396
|
+
// useShortDoctype: true,
|
|
397
|
+
// quoteCharacter: '"',
|
|
398
|
+
// minifyJS: true,
|
|
399
|
+
// minifyCSS: true,
|
|
400
|
+
// },
|
|
401
|
+
// }),
|
|
402
|
+
})
|
|
403
|
+
),
|
|
404
|
+
new InterpolateHtmlPlugin(envVars.raw),
|
|
405
|
+
new webpack.DefinePlugin(envVars.stringified),
|
|
406
|
+
new ForkTsCheckerWebpackPlugin({
|
|
407
|
+
typescript: {
|
|
408
|
+
typescriptPath: require2.resolve("typescript", {
|
|
409
|
+
paths: [paths.appNodeModules]
|
|
410
|
+
}),
|
|
411
|
+
configFile: paths.appTsConfig,
|
|
412
|
+
mode: "write-references",
|
|
413
|
+
diagnosticOptions: {
|
|
414
|
+
syntactic: true,
|
|
415
|
+
semantic: true,
|
|
416
|
+
declaration: false,
|
|
417
|
+
global: false
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}),
|
|
421
|
+
ifHmr(new ReactRefreshWebpackPlugin()),
|
|
422
|
+
ifMin(
|
|
423
|
+
new MiniCssExtractPlugin({
|
|
424
|
+
filename: "[name]-[contenthash:16].css",
|
|
425
|
+
chunkFilename: "[name]-[contenthash:16].css",
|
|
426
|
+
ignoreOrder: true,
|
|
427
|
+
attributes: {
|
|
428
|
+
"data-widget": process.env.ELEMENT_ATTRIBUTE_DATA_WIDGET
|
|
429
|
+
}
|
|
430
|
+
})
|
|
431
|
+
),
|
|
432
|
+
new webpack.IgnorePlugin({
|
|
433
|
+
resourceRegExp: /^\.\/locale$/,
|
|
434
|
+
contextRegExp: /moment$/
|
|
435
|
+
}),
|
|
436
|
+
// eslint-disable-next-line import/no-named-as-default-member
|
|
437
|
+
ifMin(new webpack.ids.HashedModuleIdsPlugin()),
|
|
438
|
+
// todo: remove?
|
|
439
|
+
ifMin() && ifCore() ? new CopyPlugin({
|
|
440
|
+
patterns: ["*.md", "*.html"]
|
|
441
|
+
}) : void 0,
|
|
442
|
+
ifMin() && ifAnalyze() ? new StatoscopeWebpackPlugin({
|
|
443
|
+
name: ifCore("tamaro-core", "tamaro-customer-config"),
|
|
444
|
+
saveReportTo: "reports/report.html",
|
|
445
|
+
saveStatsTo: "reports/stats-[name]-[hash].json",
|
|
446
|
+
additionalStats: globSync("reports/*.json"),
|
|
447
|
+
open: false
|
|
448
|
+
}) : void 0
|
|
449
|
+
]),
|
|
450
|
+
infrastructureLogging: {
|
|
451
|
+
stream: process.stdout,
|
|
452
|
+
appendOnly: false
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
return removeEmpty(config);
|
|
325
456
|
};
|
|
326
457
|
var webpack_config_default = getWebpackConfig;
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
458
|
+
export {
|
|
459
|
+
webpack_config_default as default
|
|
460
|
+
};
|