@xh/hoist-dev-utils 12.0.1 → 12.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,6 @@ const _ = require('lodash'),
15
15
  CopyWebpackPlugin = require('copy-webpack-plugin'),
16
16
  MiniCssExtractPlugin = require('mini-css-extract-plugin'),
17
17
  HtmlWebpackPlugin = require('html-webpack-plugin'),
18
- HtmlWebpackTagsPlugin = require('html-webpack-tags-plugin'),
19
18
  TerserPlugin = require('terser-webpack-plugin'),
20
19
  WebpackBar = require('webpackbar'),
21
20
  parseChangelogMarkdown = require('changelog-parser'),
@@ -77,6 +76,7 @@ try {
77
76
  * adding a mobile app to a device home screen, as well as "installing" an app via Chrome's "create shortcut"
78
77
  * option. See https://developer.mozilla.org/en-US/docs/Web/Manifest for options.
79
78
  * @param {string} [env.preloadBackgroundColor] - background color to use for the preloader spinner. Defaults to white.
79
+ * @param {string} [env.preloadSpinnerColor] - stroke color for the preloader spinner SVG. Defaults to a neutral gray (#888).
80
80
  * @param {string[]} [env.targetBrowsers] - array of browserslist queries specifying target browsers for Babel and CSS
81
81
  * transpiling and processing.
82
82
  * @param {Object} [env.babelPresetEnvOptions] - options to spread onto / override defaults passed here to the Babel
@@ -136,6 +136,7 @@ async function configureWebpack(env) {
136
136
  favicon = env.favicon || null,
137
137
  manifestConfig = env.manifestConfig || {},
138
138
  preloadBackgroundColor = env.preloadBackgroundColor || 'white',
139
+ preloadSpinnerColor = env.preloadSpinnerColor || '#888',
139
140
  stats = env.stats || 'errors-only',
140
141
  infrastructureLoggingLevel = env.infrastructureLoggingLevel || 'error',
141
142
  targetBrowsers = env.targetBrowsers || [
@@ -657,7 +658,11 @@ async function configureWebpack(env) {
657
658
  styleTags,
658
659
  scriptTags,
659
660
  clientAppName,
660
- preloadBackgroundColor
661
+ preloadBackgroundColor,
662
+ preloadSpinnerColor,
663
+ // Compilation hash used to cache-bust the (unbundled) preflight script
664
+ // copied in from hoist-react via CopyWebpackPlugin.
665
+ preflightHash: compilation.hash
661
666
  };
662
667
  },
663
668
  // No need to minify the HTML itself
@@ -684,14 +689,6 @@ async function configureWebpack(env) {
684
689
  });
685
690
  }),
686
691
 
687
- // Insert a script tag for the (unbundled) preflight script, before all other scripts.
688
- new HtmlWebpackTagsPlugin({
689
- // Script available at this path via CopyWebpackPlugin above.
690
- scripts: ['public/preflight.js'],
691
- append: false,
692
- hash: true
693
- }),
694
-
695
692
  // Support an optional post-build/run interactive treemap of output bundles and their sizes / contents.
696
693
  analyzeBundles
697
694
  ? new BundleAnalyzerPlugin({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist-dev-utils",
3
- "version": "12.0.1",
3
+ "version": "12.1.1",
4
4
  "description": "Utilities for configuring builds of Hoist-React client applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,6 @@
33
33
  "css-loader": "~7.1.2",
34
34
  "file-loader": "~6.2.0",
35
35
  "html-webpack-plugin": "~5.6.0",
36
- "html-webpack-tags-plugin": "~3.0.2",
37
36
  "lodash": "4.x",
38
37
  "mini-css-extract-plugin": "~2.10.1",
39
38
  "postcss": "~8.5.3",
@@ -44,7 +43,7 @@
44
43
  "sass-loader": "~16.0.4",
45
44
  "sass-material-colors": "~0.0.5",
46
45
  "style-loader": "~4.0.0",
47
- "terser-webpack-plugin": "~5.4.0",
46
+ "terser-webpack-plugin": "~5.6.0",
48
47
  "type-fest": "5.x",
49
48
  "url-loader": "~4.1.1",
50
49
  "webpack": "~5.106.2",
package/static/index.html CHANGED
@@ -9,15 +9,28 @@
9
9
  <% } %>
10
10
  <title><%= htmlWebpackPlugin.options.title %></title>
11
11
  <%= styleTags %>
12
+ <style>
13
+ @keyframes xh-preload-spin { to { transform: rotate(360deg); } }
14
+ #xh-preload-spinner svg {
15
+ width: 50px;
16
+ height: 50px;
17
+ animation: xh-preload-spin 2s linear infinite;
18
+ transform-origin: center;
19
+ }
20
+ </style>
12
21
  </head>
13
22
  <body class="xh-app" style="margin: 0">
14
23
 
24
+ <script src="<%= webpackConfig.output.publicPath %>public/preflight.js?<%= preflightHash %>"></script>
25
+
15
26
  <noscript>
16
27
  This application requires that JavaScript be enabled for this site in your browser.
17
28
  </noscript>
18
29
 
19
30
  <div id="xh-preload-spinner" style="height: 100vh; width: 100vw; display: flex; align-items: center; justify-content: center; background-color: <%= preloadBackgroundColor %>">
20
- <img src="<%= webpackConfig.output.publicPath %>public/spinner.png" style="width: 50px; height: 50px;">
31
+ <svg viewBox="0 0 24 24" fill="none" stroke="<%= preloadSpinnerColor %>" stroke-width="1.5" stroke-linecap="round" aria-hidden="true">
32
+ <circle cx="12" cy="12" r="9" stroke-dasharray="42 56"/>
33
+ </svg>
21
34
  </div>
22
35
 
23
36
  <div id="xh-root"></div>