@s-ui/bundler 8.0.0-beta.12 → 8.0.0-beta.13

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.
@@ -1,7 +1,7 @@
1
1
  // @ts-check
2
2
 
3
- const noopServiceWorkerMiddleware = require('react-dev-utils/noopServiceWorkerMiddleware')
4
- const ignoredFiles = require('react-dev-utils/ignoredFiles')
3
+ const noopServiceWorkerMiddleware = require('../utils/noopServiceWorkerMiddleware.js')
4
+ const ignoredFiles = require('../utils/ignoredFiles.js')
5
5
 
6
6
  const {HOST, HTTPS} = process.env
7
7
  const protocol = HTTPS === 'true' ? 'https' : 'http'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "8.0.0-beta.12",
3
+ "version": "8.0.0-beta.13",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"
@@ -31,11 +31,12 @@
31
31
  "css-loader": "6.5.1",
32
32
  "css-minimizer-webpack-plugin": "3.2.0",
33
33
  "esbuild-loader": "2.16.0",
34
+ "escape-string-regexp": "5.0.0",
34
35
  "fast-glob": "3.2.7",
35
36
  "html-webpack-plugin": "5.5.0",
36
37
  "mini-css-extract-plugin": "2.4.5",
37
38
  "process": "0.11.10",
38
- "postcss": "8.4.3",
39
+ "postcss": "8.4.4",
39
40
  "postcss-loader": "6.2.1",
40
41
  "react-dev-utils": "11.0.4",
41
42
  "rimraf": "3.0.2",
@@ -0,0 +1,22 @@
1
+ // Extracted from: https://github.com/facebook/create-react-app/blob/bb64e31a81eb12d688c14713dce812143688750a/packages/react-dev-utils/ignoredFiles.js
2
+
3
+ /**
4
+ * Copyright (c) 2015-present, Facebook, Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ 'use strict'
11
+
12
+ const path = require('path')
13
+ const escape = require('escape-string-regexp')
14
+
15
+ module.exports = function ignoredFiles(appSrc) {
16
+ return new RegExp(
17
+ `^(?!${escape(
18
+ path.normalize(appSrc + '/').replace(/[\\]+/g, '/')
19
+ )}).+/node_modules/`,
20
+ 'g'
21
+ )
22
+ }
@@ -0,0 +1,40 @@
1
+ // from: https://github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/noopServiceWorkerMiddleware.js
2
+
3
+ /**
4
+ * Copyright (c) 2015-present, Facebook, Inc.
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ 'use strict'
11
+
12
+ const path = require('path')
13
+
14
+ module.exports = function createNoopServiceWorkerMiddleware(servedPath) {
15
+ return function noopServiceWorkerMiddleware(req, res, next) {
16
+ if (req.url === path.join(servedPath, 'service-worker.js')) {
17
+ res.setHeader('Content-Type', 'text/javascript')
18
+ res.send(
19
+ `// This service worker file is effectively a 'no-op' that will reset any
20
+ // previous service worker registered for the same host:port combination.
21
+ // In the production build, this file is replaced with an actual service worker
22
+ // file that will precache your site's local assets.
23
+ // See https://github.com/facebook/create-react-app/issues/2272#issuecomment-302832432
24
+ self.addEventListener('install', () => self.skipWaiting());
25
+ self.addEventListener('activate', () => {
26
+ self.clients.matchAll({ type: 'window' }).then(windowClients => {
27
+ for (let windowClient of windowClients) {
28
+ // Force open pages to refresh, so that they have a chance to load the
29
+ // fresh navigation response from the local dev server.
30
+ windowClient.navigate(windowClient.url);
31
+ }
32
+ });
33
+ });
34
+ `
35
+ )
36
+ } else {
37
+ next()
38
+ }
39
+ }
40
+ }