@elliemae/pui-cli 7.0.0-alpha.26 → 7.0.0-alpha.29

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 (92) hide show
  1. package/dist/cjs/cli.js +4 -1
  2. package/dist/cjs/commands/build.js +10 -2
  3. package/dist/cjs/commands/codemod.js +4 -1
  4. package/dist/cjs/commands/gendoc.js +4 -1
  5. package/dist/cjs/commands/lint.js +10 -2
  6. package/dist/cjs/commands/pack.js +12 -3
  7. package/dist/cjs/commands/start.js +16 -3
  8. package/dist/cjs/commands/storybook.js +10 -3
  9. package/dist/cjs/commands/test.js +7 -2
  10. package/dist/cjs/commands/tscheck.js +15 -4
  11. package/dist/cjs/commands/utils.js +17 -10
  12. package/dist/cjs/commands/version.js +7 -2
  13. package/dist/cjs/commands/vitest.js +7 -2
  14. package/dist/cjs/lint-config/lint-staged.config.js +4 -1
  15. package/dist/cjs/monorepo/set-registry-version.js +12 -7
  16. package/dist/cjs/monorepo/set-workspace-version.js +19 -8
  17. package/dist/cjs/pui-config.js +4 -1
  18. package/dist/cjs/server/csp.js +24 -19
  19. package/dist/cjs/server/index.js +4 -1
  20. package/dist/cjs/server/logger.js +11 -4
  21. package/dist/cjs/server/middlewares.js +12 -6
  22. package/dist/cjs/server/utils.js +8 -2
  23. package/dist/cjs/testing/mocks/svg.js +4 -1
  24. package/dist/cjs/testing/setup-react-env.js +4 -1
  25. package/dist/cjs/testing/setup-test-env.js +4 -1
  26. package/dist/cjs/testing/setup-tests.js +7 -2
  27. package/dist/cjs/testing/vitest.config.js +4 -1
  28. package/dist/cjs/transpile/esbuild.js +23 -12
  29. package/dist/cjs/transpile/react-shim.js +4 -1
  30. package/dist/cjs/update-notifier.js +4 -1
  31. package/dist/cjs/webpack/helpers.js +68 -33
  32. package/dist/cjs/webpack/webpack.base.babel.js +4 -1
  33. package/dist/cjs/webpack/webpack.dev.babel.js +4 -1
  34. package/dist/cjs/webpack/webpack.lib.base.babel.js +4 -1
  35. package/dist/cjs/webpack/webpack.lib.dev.babel.js +18 -7
  36. package/dist/cjs/webpack/webpack.lib.prod.babel.js +29 -19
  37. package/dist/cjs/webpack/webpack.prod.babel.js +10 -5
  38. package/dist/cjs/webpack/webpack.storybook.js +7 -2
  39. package/dist/esm/cli.js +0 -1
  40. package/dist/esm/commands/build.js +6 -2
  41. package/dist/esm/commands/codemod.js +0 -1
  42. package/dist/esm/commands/gendoc.js +0 -1
  43. package/dist/esm/commands/lint.js +6 -2
  44. package/dist/esm/commands/pack.js +8 -3
  45. package/dist/esm/commands/start.js +12 -3
  46. package/dist/esm/commands/storybook.js +6 -3
  47. package/dist/esm/commands/test.js +3 -2
  48. package/dist/esm/commands/tscheck.js +11 -4
  49. package/dist/esm/commands/utils.js +13 -10
  50. package/dist/esm/commands/version.js +3 -2
  51. package/dist/esm/commands/vitest.js +3 -2
  52. package/dist/esm/docs/assets/main.js +0 -1
  53. package/dist/esm/docs/assets/search.js +0 -1
  54. package/dist/esm/dummy.js +0 -1
  55. package/dist/esm/index.js +0 -1
  56. package/dist/esm/lint-config/lint-staged.config.js +0 -1
  57. package/dist/esm/monorepo/delete-merged-tags.js +0 -1
  58. package/dist/esm/monorepo/set-registry-version.js +8 -7
  59. package/dist/esm/monorepo/set-workspace-version.js +15 -8
  60. package/dist/esm/pui-config.js +0 -1
  61. package/dist/esm/server/csp.js +20 -19
  62. package/dist/esm/server/index.js +0 -1
  63. package/dist/esm/server/logger.js +7 -4
  64. package/dist/esm/server/middlewares.js +8 -6
  65. package/dist/esm/server/utils.js +4 -2
  66. package/dist/esm/testing/mocks/axios.js +0 -1
  67. package/dist/esm/testing/mocks/cssModule.js +0 -1
  68. package/dist/esm/testing/mocks/html.js +0 -1
  69. package/dist/esm/testing/mocks/image.js +0 -1
  70. package/dist/esm/testing/mocks/matchMedia.js +0 -1
  71. package/dist/esm/testing/mocks/pui-app-loader.js +0 -1
  72. package/dist/esm/testing/mocks/pui-diagnostics.js +0 -1
  73. package/dist/esm/testing/mocks/pui-user-monitoring.js +0 -1
  74. package/dist/esm/testing/mocks/retry-axios.js +0 -1
  75. package/dist/esm/testing/mocks/svg.js +0 -1
  76. package/dist/esm/testing/mocks/webpack-hmr.js +0 -1
  77. package/dist/esm/testing/setup-react-env.js +0 -1
  78. package/dist/esm/testing/setup-test-env.js +0 -1
  79. package/dist/esm/testing/setup-tests.js +3 -2
  80. package/dist/esm/testing/vitest.config.js +0 -1
  81. package/dist/esm/transpile/esbuild.js +19 -12
  82. package/dist/esm/transpile/react-shim.js +0 -1
  83. package/dist/esm/update-notifier.js +0 -1
  84. package/dist/esm/webpack/helpers.js +64 -33
  85. package/dist/esm/webpack/webpack.base.babel.js +0 -1
  86. package/dist/esm/webpack/webpack.dev.babel.js +0 -1
  87. package/dist/esm/webpack/webpack.lib.base.babel.js +0 -1
  88. package/dist/esm/webpack/webpack.lib.dev.babel.js +14 -7
  89. package/dist/esm/webpack/webpack.lib.prod.babel.js +25 -19
  90. package/dist/esm/webpack/webpack.prod.babel.js +6 -5
  91. package/dist/esm/webpack/webpack.storybook.js +3 -2
  92. package/package.json +58 -59
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import express from "express";
3
2
  import cors from "cors";
4
3
  import compression from "compression";
@@ -32,11 +31,14 @@ const setupAdditionalMiddlewars = (app, options = {}) => {
32
31
  app.get(basePath, (req, res) => {
33
32
  sendFileWithCSPNonce({ buildPath, res });
34
33
  });
35
- app.use(basePath, expressStaticGzip(buildPath, {
36
- index: false,
37
- enableBrotli: true,
38
- orderPreference: ["br"]
39
- }));
34
+ app.use(
35
+ basePath,
36
+ expressStaticGzip(buildPath, {
37
+ index: false,
38
+ enableBrotli: true,
39
+ orderPreference: ["br"]
40
+ })
41
+ );
40
42
  app.use(expressStaticGzip("cdn"));
41
43
  app.get("*", (req, res) => sendFileWithCSPNonce({ buildPath, res }));
42
44
  return app;
@@ -1,8 +1,10 @@
1
- "use strict";
2
1
  import minimist from "minimist";
3
2
  const argv = minimist(process.argv.slice(2));
4
3
  const getCWD = () => process.cwd();
5
- const port = parseInt(argv.port || process.env.port || process.env.PORT || "3000", 10);
4
+ const port = parseInt(
5
+ argv.port || process.env.port || process.env.PORT || "3000",
6
+ 10
7
+ );
6
8
  const host = argv.host || process.env.HOST;
7
9
  export {
8
10
  getCWD,
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var axios_default = {
3
2
  defaults: {},
4
3
  interceptors: {
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var cssModule_default = "CSS_MODULE";
3
2
  export {
4
3
  cssModule_default as default
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var html_default = "HTML_MODULE";
3
2
  export {
4
3
  html_default as default
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var image_default = "IMAGE_MOCK";
3
2
  export {
4
3
  image_default as default
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const addMatchMedia = () => {
3
2
  Object.defineProperty(window, "matchMedia", {
4
3
  writable: true,
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const load = () => {
3
2
  };
4
3
  export {
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const logger = () => ({
3
2
  setLogLevel() {
4
3
  },
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const setCustomUserData = () => {
3
2
  };
4
3
  const setCustomVirtualPageName = () => {
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const attach = jest.fn();
3
2
  const detach = jest.fn();
4
3
  const getConfig = jest.fn();
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import * as React from "react";
3
2
  var svg_default = "SvgrURL";
4
3
  const ReactComponent = "div";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  const enableHotReloading = () => {
3
2
  };
4
3
  export {
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import * as React from "react";
3
2
  import "jest-styled-components";
4
3
  global.React = React;
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import * as React from "react";
3
2
  import "jest-styled-components";
4
3
  import "@testing-library/jest-dom/extend-expect";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import "core-js/stable";
3
2
  import "regenerator-runtime/runtime";
4
3
  import "@testing-library/jest-dom/extend-expect";
@@ -19,7 +18,9 @@ console.error = (...args) => {
19
18
  "Warning: The tag <%s> is unrecognized in this browser",
20
19
  "Warning: Invalid arguments supplied to oneOf"
21
20
  ];
22
- if (ignoreList.find((ignoreMsg) => !!args.find((arg) => arg?.includes?.(ignoreMsg))))
21
+ if (ignoreList.find(
22
+ (ignoreMsg) => !!args.find((arg) => arg?.includes?.(ignoreMsg))
23
+ ))
23
24
  return false;
24
25
  return originalError(...args);
25
26
  };
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import { fileURLToPath } from "node:url";
4
3
  import { defineConfig, configDefaults } from "vitest/config";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import { fileURLToPath } from "node:url";
4
3
  import fg from "fast-glob";
@@ -33,12 +32,14 @@ const copyFiles = async ({ srcdir, outdir }) => {
33
32
  `${srcdir}/**/.swcrc`,
34
33
  `!${srcdir}/**/*.{js,jsx,ts,tsx,mjs}`
35
34
  ]);
36
- await Promise.all(files.map(async (srcFilePath) => {
37
- const destFilePath = srcFilePath.replace(srcdir, outdir);
38
- const fileDir = path.dirname(destFilePath);
39
- await mkdir(fileDir, { recursive: true });
40
- await copyFile(srcFilePath, destFilePath);
41
- }));
35
+ await Promise.all(
36
+ files.map(async (srcFilePath) => {
37
+ const destFilePath = srcFilePath.replace(srcdir, outdir);
38
+ const fileDir = path.dirname(destFilePath);
39
+ await mkdir(fileDir, { recursive: true });
40
+ await copyFile(srcFilePath, destFilePath);
41
+ })
42
+ );
42
43
  };
43
44
  const getSideEffects = async () => {
44
45
  const data = await readFile(path.join(process.cwd(), "./package.json"));
@@ -47,10 +48,14 @@ const getSideEffects = async () => {
47
48
  };
48
49
  const createPackageJson = async ({ outdir, type = NODE_MODULE_TYPES.ESM }) => {
49
50
  const filePath = path.join(process.cwd(), outdir, "package.json");
50
- const packageJSON = JSON.stringify({
51
- type,
52
- sideEffects: await getSideEffects()
53
- }, null, 2);
51
+ const packageJSON = JSON.stringify(
52
+ {
53
+ type,
54
+ sideEffects: await getSideEffects()
55
+ },
56
+ null,
57
+ 2
58
+ );
54
59
  await writeFile(filePath, packageJSON);
55
60
  };
56
61
  const esBuild = async ({
@@ -82,7 +87,9 @@ const esBuild = async ({
82
87
  await createPackageJson({ outdir: cjsOutdir, type: NODE_MODULE_TYPES.CJS });
83
88
  }
84
89
  const esmOutdir = esmOnly ? outdir : `${outdir}/esm`;
85
- const entryPoints = await fg(inputFiles.concat([`!${srcdir}/**/cjs/**/*.{js,jsx,ts,tsx}`]));
90
+ const entryPoints = await fg(
91
+ inputFiles.concat([`!${srcdir}/**/cjs/**/*.{js,jsx,ts,tsx}`])
92
+ );
86
93
  await build({
87
94
  entryPoints,
88
95
  ...getCommonConfig({ injectReactShim }),
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import * as React from "react";
3
2
  export {
4
3
  React
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import updateNotifier from "update-notifier";
3
2
  import path from "node:path";
4
3
  import fs from "node:fs/promises";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import fs from "node:fs";
4
3
  import _ from "lodash";
@@ -10,7 +9,9 @@ let pathSep = path.sep;
10
9
  if (pathSep === "\\")
11
10
  pathSep = "\\\\";
12
11
  const LATEST_VERSION = "latest";
13
- const getNodeModulesRegEx = (modules) => modules.map((modName) => new RegExp(`node_modules${pathSep}${modName.replace("/", pathSep)}`));
12
+ const getNodeModulesRegEx = (modules) => modules.map(
13
+ (modName) => new RegExp(`node_modules${pathSep}${modName.replace("/", pathSep)}`)
14
+ );
14
15
  const excludeNodeModulesExcept = (modules) => {
15
16
  const moduleRegExps = getNodeModulesRegEx(modules);
16
17
  return function(modulePath) {
@@ -24,34 +25,42 @@ const excludeNodeModulesExcept = (modules) => {
24
25
  };
25
26
  };
26
27
  const getLibraryName = () => {
27
- const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json")));
28
+ const packageJson = JSON.parse(
29
+ fs.readFileSync(path.join(process.cwd(), "package.json"))
30
+ );
28
31
  const libraryName = packageJson ? packageJson.name : process.env.LIBRARY_NAME || "mylibrary";
29
32
  const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
30
33
  return _.camelCase(modifiedLibName);
31
34
  };
32
- const mapToFolder = (dependencies, folder) => dependencies.reduce((acc, dependency) => ({
33
- [dependency]: path.resolve(`${folder}/${dependency.replace("$", "")}`),
34
- ...acc
35
- }), {});
35
+ const mapToFolder = (dependencies, folder) => dependencies.reduce(
36
+ (acc, dependency) => ({
37
+ [dependency]: path.resolve(`${folder}/${dependency.replace("$", "")}`),
38
+ ...acc
39
+ }),
40
+ {}
41
+ );
36
42
  const getAlias = () => {
37
43
  const monorepoRoot = findMonoRepoRoot(process.cwd()) || "";
38
- return mapToFolder([
39
- "@babel/runtime",
40
- "react",
41
- "react-dom",
42
- "react-redux",
43
- "redux",
44
- "redux-saga",
45
- "moment",
46
- "lodash",
47
- "styled-components",
48
- "immer",
49
- "react-dates",
50
- "react-transition-group",
51
- "@elliemae/pui-cli",
52
- "@elliemae/pui-app-sdk$",
53
- "@elliemae/pui-theme$"
54
- ], path.join(monorepoRoot, "./node_modules"));
44
+ return mapToFolder(
45
+ [
46
+ "@babel/runtime",
47
+ "react",
48
+ "react-dom",
49
+ "react-redux",
50
+ "redux",
51
+ "redux-saga",
52
+ "moment",
53
+ "lodash",
54
+ "styled-components",
55
+ "immer",
56
+ "react-dates",
57
+ "react-transition-group",
58
+ "@elliemae/pui-cli",
59
+ "@elliemae/pui-app-sdk$",
60
+ "@elliemae/pui-theme$"
61
+ ],
62
+ path.join(monorepoRoot, "./node_modules")
63
+ );
55
64
  };
56
65
  const modulesToTranspile = [
57
66
  "@elliemae/pui-*",
@@ -61,35 +70,55 @@ const modulesToTranspile = [
61
70
  ];
62
71
  const getUserMonitoringFileName = () => {
63
72
  const libName = "emuiUserMonitoring";
64
- const userMonLibPath = path.join(process.cwd(), "node_modules/@elliemae/pui-user-monitoring/dist/public/js");
73
+ const userMonLibPath = path.join(
74
+ process.cwd(),
75
+ "node_modules/@elliemae/pui-user-monitoring/dist/public/js"
76
+ );
65
77
  if (!fs.existsSync(userMonLibPath))
66
78
  return `${libName}.js`;
67
79
  const distJSFiles = fs.readdirSync(userMonLibPath);
68
- return distJSFiles.filter((fName) => fName.match(/emuiUserMonitoring+((?!chunk).)*\.js$/))[0];
80
+ return distJSFiles.filter(
81
+ (fName) => fName.match(/emuiUserMonitoring+((?!chunk).)*\.js$/)
82
+ )[0];
69
83
  };
70
84
  const getAppLoaderFileName = () => {
71
85
  const libName = "emuiAppLoader";
72
- const appLoaderLibPath = path.join(process.cwd(), "node_modules/@elliemae/pui-app-loader/dist/public/js");
86
+ const appLoaderLibPath = path.join(
87
+ process.cwd(),
88
+ "node_modules/@elliemae/pui-app-loader/dist/public/js"
89
+ );
73
90
  if (!fs.existsSync(appLoaderLibPath))
74
91
  return `${libName}.js`;
75
92
  const distJSFiles = fs.readdirSync(appLoaderLibPath);
76
- return distJSFiles.filter((fName) => fName.match(/emuiAppLoader+((?!chunk).)*\.js$/))[0];
93
+ return distJSFiles.filter(
94
+ (fName) => fName.match(/emuiAppLoader+((?!chunk).)*\.js$/)
95
+ )[0];
77
96
  };
78
97
  const getDiagnosticsFileName = () => {
79
98
  const libName = "emuiDiagnostics";
80
- const libPath = path.join(process.cwd(), "node_modules/@elliemae/pui-diagnostics/dist/public/js");
99
+ const libPath = path.join(
100
+ process.cwd(),
101
+ "node_modules/@elliemae/pui-diagnostics/dist/public/js"
102
+ );
81
103
  if (!fs.existsSync(libPath))
82
104
  return `${libName}.js`;
83
105
  const distJSFiles = fs.readdirSync(libPath);
84
- return distJSFiles.filter((fName) => fName.match(/emuiDiagnostics+((?!chunk).)*\.js$/))[0];
106
+ return distJSFiles.filter(
107
+ (fName) => fName.match(/emuiDiagnostics+((?!chunk).)*\.js$/)
108
+ )[0];
85
109
  };
86
110
  const getENCWLoaderFileName = () => {
87
111
  const libName = "emuiEncwLoader";
88
- const appLoaderLibPath = path.join(process.cwd(), "node_modules/@elliemae/encw-loader/dist/public/js");
112
+ const appLoaderLibPath = path.join(
113
+ process.cwd(),
114
+ "node_modules/@elliemae/encw-loader/dist/public/js"
115
+ );
89
116
  if (!fs.existsSync(appLoaderLibPath))
90
117
  return `${libName}.js`;
91
118
  const distJSFiles = fs.readdirSync(appLoaderLibPath);
92
- return distJSFiles.filter((fName) => fName.match(/emuiEncwLoader+((?!chunk).)*\.js$/))[0];
119
+ return distJSFiles.filter(
120
+ (fName) => fName.match(/emuiEncwLoader+((?!chunk).)*\.js$/)
121
+ )[0];
93
122
  };
94
123
  const getAppVersion = () => {
95
124
  if (!process.env.APP_VERSION)
@@ -150,7 +179,9 @@ const getCompressionPlugins = (isLibrary = false) => {
150
179
  })
151
180
  ];
152
181
  };
153
- const filterByFilePresence = (patterns) => patterns.filter(({ from, noErrorOnMissing }) => !noErrorOnMissing || fs.existsSync(path.resolve(process.cwd(), from)));
182
+ const filterByFilePresence = (patterns) => patterns.filter(
183
+ ({ from, noErrorOnMissing }) => !noErrorOnMissing || fs.existsSync(path.resolve(process.cwd(), from))
184
+ );
154
185
  const resolveExtensions = [
155
186
  ".wasm",
156
187
  ".mjs",
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import webpack from "webpack";
4
3
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import { fileURLToPath } from "node:url";
4
3
  import HtmlWebpackPlugin from "html-webpack-plugin";
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import webpack from "webpack";
4
3
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
@@ -1,10 +1,22 @@
1
- "use strict";
1
+ import path from "node:path";
2
+ import fg from "fast-glob";
2
3
  import CircularDependencyPlugin from "circular-dependency-plugin";
3
4
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
5
  import HtmlWebpackPlugin from "html-webpack-plugin";
5
6
  import { getLibraryName } from "./helpers.js";
6
7
  import { baseConfig } from "./webpack.base.babel.js";
7
8
  const libraryName = getLibraryName();
9
+ const getHtmlWebpackPlugins = () => {
10
+ const htmlTemplateFiles = fg.sync([path.join(process.cwd(), "lib/*.html")]);
11
+ return htmlTemplateFiles.map(
12
+ (htmlTemplateFile) => new HtmlWebpackPlugin({
13
+ template: htmlTemplateFile,
14
+ filename: path.basename(htmlTemplateFile),
15
+ libraryName,
16
+ inject: true
17
+ })
18
+ );
19
+ };
8
20
  var webpack_lib_dev_babel_default = baseConfig({
9
21
  mode: "development",
10
22
  output: {
@@ -21,12 +33,7 @@ var webpack_lib_dev_babel_default = baseConfig({
21
33
  alias: {}
22
34
  },
23
35
  plugins: [
24
- new HtmlWebpackPlugin({
25
- inject: true,
26
- template: "lib/index.pug",
27
- filename: "index.html",
28
- libraryName
29
- }),
36
+ ...getHtmlWebpackPlugins(),
30
37
  new CircularDependencyPlugin({
31
38
  exclude: /a\.(js|ts|jsx|tsx)|node_modules/,
32
39
  failOnError: false
@@ -1,5 +1,5 @@
1
- "use strict";
2
1
  import path from "node:path";
2
+ import fg from "fast-glob";
3
3
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
4
  import HtmlWebpackPlugin from "html-webpack-plugin";
5
5
  import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
@@ -8,6 +8,29 @@ import browserslistToEsbuild from "browserslist-to-esbuild";
8
8
  import { getLibraryName, getCompressionPlugins } from "./helpers.js";
9
9
  import { baseConfig } from "./webpack.lib.base.babel.js";
10
10
  const libraryName = process.env.LIBRARY_FILE_NAME || getLibraryName();
11
+ const getHtmlWebpackPlugins = () => {
12
+ const htmlTemplateFiles = fg.sync([path.join(process.cwd(), "lib/*.html")]);
13
+ return htmlTemplateFiles.map(
14
+ (htmlTemplateFile) => new HtmlWebpackPlugin({
15
+ template: htmlTemplateFile,
16
+ filename: path.basename(htmlTemplateFile),
17
+ libraryName,
18
+ inject: true,
19
+ minify: {
20
+ removeComments: true,
21
+ collapseWhitespace: true,
22
+ removeRedundantAttributes: true,
23
+ useShortDoctype: true,
24
+ removeEmptyAttributes: true,
25
+ removeStyleLinkTypeAttributes: true,
26
+ keepClosingSlash: true,
27
+ minifyJS: true,
28
+ minifyCSS: true,
29
+ minifyURLs: true
30
+ }
31
+ })
32
+ );
33
+ };
11
34
  var webpack_lib_prod_babel_default = baseConfig({
12
35
  mode: "production",
13
36
  output: {
@@ -32,24 +55,7 @@ var webpack_lib_prod_babel_default = baseConfig({
32
55
  }
33
56
  },
34
57
  plugins: [
35
- new HtmlWebpackPlugin({
36
- template: "lib/index.pug",
37
- filename: "index.html",
38
- libraryName,
39
- minify: {
40
- removeComments: true,
41
- collapseWhitespace: true,
42
- removeRedundantAttributes: true,
43
- useShortDoctype: true,
44
- removeEmptyAttributes: true,
45
- removeStyleLinkTypeAttributes: true,
46
- keepClosingSlash: true,
47
- minifyJS: true,
48
- minifyCSS: true,
49
- minifyURLs: true
50
- },
51
- inject: true
52
- }),
58
+ ...getHtmlWebpackPlugins(),
53
59
  new MiniCssExtractPlugin({
54
60
  filename: `css/${libraryName}.[contenthash].css`,
55
61
  chunkFilename: `css/${libraryName}.[contenthash].chunk.css`
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import path from "node:path";
3
2
  import HtmlWebpackPlugin from "html-webpack-plugin";
4
3
  import { GenerateSW } from "workbox-webpack-plugin";
@@ -111,10 +110,12 @@ const addSMPPlugin = (webpackConfig) => {
111
110
  const smpConfig = new SpeedMeasurePlugin({
112
111
  disable: !process.env.MEASURE
113
112
  }).wrap(webpackConfig);
114
- smpConfig.plugins.push(new MiniCssExtractPlugin({
115
- filename: "latest/css/[name].[contenthash].css",
116
- chunkFilename: "latest/css/[name].[contenthash].chunk.css"
117
- }));
113
+ smpConfig.plugins.push(
114
+ new MiniCssExtractPlugin({
115
+ filename: "latest/css/[name].[contenthash].css",
116
+ chunkFilename: "latest/css/[name].[contenthash].chunk.css"
117
+ })
118
+ );
118
119
  return smpConfig;
119
120
  };
120
121
  var webpack_prod_babel_default = addSMPPlugin(config);
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  import webpack from "webpack";
3
2
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
3
  import CopyWebpackPlugin from "copy-webpack-plugin";
@@ -53,7 +52,9 @@ const getModuleRules = () => [
53
52
  ];
54
53
  const webpackFinal = async (config, { configType }) => {
55
54
  const isProd = configType === "PRODUCTION";
56
- const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.(".svg"));
55
+ const fileLoaderRule = config.module.rules.find(
56
+ (rule) => rule.test?.test?.(".svg")
57
+ );
57
58
  fileLoaderRule.exclude = /\.svg$/i;
58
59
  config.module.rules.unshift(...getModuleRules());
59
60
  config.plugins.push(...getAdditionalPlugins());