@patternfly/documentation-framework 2.0.0-alpha.12 → 2.0.0-alpha.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 2.0.0-alpha.13 (2023-03-31)
7
+
8
+ **Note:** Version bump only for package @patternfly/documentation-framework
9
+
10
+
11
+
12
+
13
+
6
14
  # 2.0.0-alpha.12 (2023-03-30)
7
15
 
8
16
  **Note:** Version bump only for package @patternfly/documentation-framework
package/app.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import ReactDOM from 'react-dom';
2
+ import { createRoot, hydrateRoot } from 'react-dom/client';
3
3
  import { Router, useLocation } from '@reach/router';
4
4
  import 'client-styles'; // Webpack replaces this import: patternfly-docs.css.js
5
5
  import { SideNavLayout } from '@patternfly/documentation-framework/layouts';
@@ -107,8 +107,12 @@ const isPrerender = process.env.PRERENDER;
107
107
  // Don't use ReactDOM in SSR
108
108
  if (!isPrerender) {
109
109
  function render() {
110
- const renderFn = isProd ? ReactDOM.hydrate : ReactDOM.render;
111
- renderFn(<App />, document.getElementById('root'));
110
+ const container = document.getElementById('root');
111
+ if (isProd) {
112
+ hydrateRoot(container, <App />);
113
+ } else {
114
+ createRoot(container).render(<App />);
115
+ }
112
116
  }
113
117
  // On first load, await promise for the current page to avoid flashing a "Loading..." state
114
118
  const Component = getAsyncComponent(null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@patternfly/documentation-framework",
3
3
  "description": "A framework to build documentation for PatternFly.",
4
- "version": "2.0.0-alpha.12",
4
+ "version": "2.0.0-alpha.13",
5
5
  "author": "Red Hat",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -22,19 +22,19 @@
22
22
  "@babel/preset-env": "7.18.2",
23
23
  "@mdx-js/util": "1.6.16",
24
24
  "@patternfly/ast-helpers": "^0.4.57",
25
- "@reach/router": "1.3.4",
25
+ "@reach/router": "npm:@gatsbyjs/reach-router@1.3.9",
26
26
  "autoprefixer": "9.8.6",
27
- "babel-loader": "8.2.5",
27
+ "babel-loader": "9.1.2",
28
28
  "camelcase-css": "2.0.1",
29
29
  "chokidar": "3.5.3",
30
- "clean-webpack-plugin": "3.0.0",
30
+ "clean-webpack-plugin": "4.0.0",
31
31
  "codesandbox": "2.2.0",
32
32
  "commander": "4.1.1",
33
- "copy-webpack-plugin": "6.1.0",
34
- "css-loader": "4.3.0",
33
+ "copy-webpack-plugin": "11.0.0",
34
+ "css-loader": "6.7.3",
35
35
  "detab": "2.0.3",
36
36
  "express": "4.18.1",
37
- "file-loader": "6.1.0",
37
+ "file-loader": "6.2.0",
38
38
  "file-saver": "1.3.8",
39
39
  "fs-extra": "9.0.1",
40
40
  "glob": "8.0.3",
@@ -42,29 +42,30 @@
42
42
  "hast-to-hyperscript": "9.0.0",
43
43
  "hast-util-to-text": "2.0.0",
44
44
  "html-formatter": "0.1.9",
45
- "html-webpack-plugin": "4.4.1",
45
+ "html-webpack-plugin": "5.5.0",
46
46
  "js-yaml": "3.14.0",
47
47
  "mdast-util-to-hast": "9.1.1",
48
48
  "mdurl": "1.0.1",
49
- "mini-css-extract-plugin": "1.3.9",
50
- "monaco-editor": "0.21.3",
51
- "monaco-editor-webpack-plugin": "2.1.0",
52
- "null-loader": "4.0.0",
49
+ "mini-css-extract-plugin": "2.7.5",
50
+ "monaco-editor": "0.34.1",
51
+ "monaco-editor-webpack-plugin": "7.0.1",
53
52
  "parse-entities": "2.0.0",
53
+ "path-browserify": "1.0.1",
54
54
  "postcss": "7.0.32",
55
- "postcss-loader": "4.2.0",
55
+ "postcss-loader": "7.1.0",
56
+ "process": "^0.11.10",
56
57
  "puppeteer": "14.3.0",
57
58
  "puppeteer-cluster": "0.23.0",
58
59
  "react-docgen": "5.3.1",
59
- "react-monaco-editor": "0.48.0",
60
- "react-ssr-prepass": "1.2.1",
60
+ "react-monaco-editor": "^0.51.0",
61
+ "react-ssr-prepass": "1.5.0",
61
62
  "remark-footnotes": "1.0.0",
62
63
  "remark-frontmatter": "2.0.0",
63
64
  "remark-mdx": "2.0.0-next.8",
64
65
  "remark-mdxjs": "2.0.0-next.8",
65
66
  "remark-parse": "8.0.3",
66
67
  "remark-squeeze-paragraphs": "4.0.0",
67
- "responsive-loader": "2.1.1",
68
+ "responsive-loader": "3.1.2",
68
69
  "sharp": "0.30.6",
69
70
  "style-to-object": "0.3.0",
70
71
  "to-vfile": "6.1.0",
@@ -74,10 +75,10 @@
74
75
  "unist-util-visit": "2.0.3",
75
76
  "url-loader": "4.1.0",
76
77
  "vfile-reporter": "6.0.1",
77
- "webpack": "4.44.1",
78
- "webpack-bundle-analyzer": "3.8.0",
79
- "webpack-cli": "3.3.12",
80
- "webpack-dev-server": "3.11.0",
78
+ "webpack": "5.76.3",
79
+ "webpack-bundle-analyzer": "4.8.0",
80
+ "webpack-cli": "5.0.1",
81
+ "webpack-dev-server": "4.13.1",
81
82
  "webpack-merge": "5.8.0"
82
83
  },
83
84
  "peerDependencies": {
@@ -88,5 +89,5 @@
88
89
  "react": "^17.0.0 || ^18.0.0",
89
90
  "react-dom": "^17.0.0 || ^18.0.0"
90
91
  },
91
- "gitHead": "bdb2e30d994778f9e042f8c938ce03dd48f3556b"
92
+ "gitHead": "44bd489ef529f71007184514107ed93122ec2161"
92
93
  }
@@ -6,17 +6,15 @@ const { getConfig } = require('./helpers');
6
6
  const { watchMD } = require('../md/parseMD');
7
7
 
8
8
  function startWebpackDevServer(webpackConfig) {
9
- webpackConfig.devServer.filename = webpackConfig.output.filename;
10
- webpackConfig.devServer.publicPath = webpackConfig.output.publicPath;
9
+ webpackConfig.devServer.static.publicPath = webpackConfig.output.publicPath;
11
10
  const { port } = webpackConfig.devServer;
12
11
  const compiler = webpack(webpackConfig);
13
- const server = new WebpackDevServer(compiler, webpackConfig.devServer);
12
+ const server = new WebpackDevServer(webpackConfig.devServer, compiler);
14
13
 
15
- server.listen(port, 'localhost', err => {
16
- if (err) {
17
- console.log(err);
18
- }
19
- });
14
+ (async () => {
15
+ await server.start();
16
+ console.log(`Dev server is listening on port ${port}`);
17
+ })();
20
18
  }
21
19
 
22
20
  async function start(options) {
@@ -27,7 +27,8 @@ module.exports = (_env, argv) => {
27
27
  output: {
28
28
  publicPath: isProd ? `${pathPrefix}/` : '/',
29
29
  pathinfo: false, // https://webpack.js.org/guides/build-performance/#output-without-path-info,
30
- hashDigestLength: 8
30
+ hashDigestLength: 8,
31
+ clean: true, // Clean the output directory before emit.
31
32
  },
32
33
  amd: false, // We don't use any AMD modules, helps performance
33
34
  mode: isProd ? 'production' : 'development',
@@ -82,35 +83,28 @@ module.exports = (_env, argv) => {
82
83
  },
83
84
  {
84
85
  test: /\.(gif|svg)$/,
85
- use: {
86
- loader: 'file-loader',
87
- options: {
88
- name: '[name].[contenthash].[ext]',
89
- outputPath: 'images/'
90
- },
86
+ type: 'asset/resource',
87
+ dependency: { not: ['url'] },
88
+ generator: {
89
+ filename: 'images/[hash][ext][query]'
91
90
  }
92
91
  },
93
92
  {
94
93
  test: /\.(pdf)$/,
95
- use: {
96
- loader: 'file-loader',
97
- options: {
98
- name: '[name].[contenthash].[ext]',
99
- }
94
+ type: 'asset/resource',
95
+ dependency: { not: ['url'] },
96
+ generator: {
97
+ filename: '[hash][ext][query]'
100
98
  }
101
99
  },
102
100
  {
103
101
  test: /.(woff(2)?|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
104
- use: [
105
- {
106
- loader: 'file-loader',
107
- options: {
108
- name: '[name].[ext]',
109
- outputPath: 'fonts/'
110
- }
111
- }
112
- ]
113
- }
102
+ type: 'asset/resource',
103
+ dependency: { not: ['url'] },
104
+ generator: {
105
+ filename: 'fonts/[name][ext][query]'
106
+ }
107
+ },
114
108
  ]
115
109
  },
116
110
  resolve: {
@@ -118,18 +112,25 @@ module.exports = (_env, argv) => {
118
112
  alias: {
119
113
  'client-styles': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.css.js'),
120
114
  './routes-client': path.resolve(process.cwd(), 'patternfly-docs/patternfly-docs.routes.js'),
121
- './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js')
115
+ './routes-generated': path.resolve(process.cwd(), 'patternfly-docs/generated/index.js'),
116
+ process: "process/browser"
122
117
  },
123
118
  modules: [
124
119
  'node_modules',
125
120
  ...module.paths,
126
- ]
121
+ ],
122
+ fallback: {
123
+ "path": require.resolve("path-browserify")
124
+ },
127
125
  },
128
126
  // Use this module's node_modules first (for use in Core/React workspaces)
129
127
  resolveLoader: {
130
128
  modules: module.paths,
131
129
  },
132
130
  plugins: [
131
+ new webpack.ProvidePlugin({
132
+ process: 'process/browser',
133
+ }),
133
134
  new webpack.DefinePlugin({
134
135
  'process.env.NODE_ENV': JSON.stringify(mode),
135
136
  'process.env.pathPrefix': JSON.stringify(isProd ? pathPrefix : ''),
@@ -150,13 +151,9 @@ module.exports = (_env, argv) => {
150
151
  { from: path.join(__dirname, '../../assets'), to: 'assets' }
151
152
  ]
152
153
  }),
153
- new MonacoWebpackPlugin(),
154
- ...(isProd
155
- ? [
156
- new CleanWebpackPlugin()
157
- ]
158
- : []
159
- )
154
+ new MonacoWebpackPlugin({
155
+ globalAPI: true,
156
+ })
160
157
  ],
161
158
  stats: 'minimal'
162
159
  };
@@ -5,6 +5,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
5
5
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
6
  const TerserPlugin = require('terser-webpack-plugin');
7
7
  const CopyPlugin = require('copy-webpack-plugin');
8
+ const webpack = require('webpack');
8
9
  const baseConfig = require('./webpack.base.config');
9
10
  const { getHtmlWebpackPlugins } = require('./getHtmlWebpackPlugins');
10
11
 
@@ -23,18 +24,20 @@ const reactJSRegex = /react-([^\\/]*)[\\/]dist[\\/].*\.js$/
23
24
 
24
25
  const clientConfig = async (env, argv) => {
25
26
  const isProd = argv.mode === 'production';
26
-
27
27
  return {
28
28
  output: {
29
29
  path: argv.output ? path.resolve(argv.output) : path.resolve('public'),
30
- filename: '[name].[hash].bundle.js'
30
+ filename: '[name].[contenthash].bundle.js'
31
31
  },
32
32
  devServer: {
33
33
  hot: true,
34
34
  historyApiFallback: true,
35
+ compress: true,
35
36
  port: argv.port,
36
- clientLogLevel: 'info',
37
- stats: 'minimal'
37
+ client: {
38
+ logging: 'info',
39
+ },
40
+ static: {}
38
41
  },
39
42
  optimization: {
40
43
  splitChunks: {
@@ -71,10 +74,7 @@ const clientConfig = async (env, argv) => {
71
74
  },
72
75
  minimize: isProd ? true : false,
73
76
  minimizer: [
74
- new TerserPlugin({
75
- cache: path.join(process.cwd(), '.cache/terser'),
76
- ...(process.env.CI ? { parallel: 2 } : {})
77
- }),
77
+ new TerserPlugin(),
78
78
  ],
79
79
  runtimeChunk: 'single',
80
80
  },
@@ -82,7 +82,6 @@ const clientConfig = async (env, argv) => {
82
82
  rules: [
83
83
  {
84
84
  test: /\.css$/,
85
- exclude: reactCSSRegex,
86
85
  use: [
87
86
  {
88
87
  loader: MiniCssExtractPlugin.loader,
@@ -106,13 +105,12 @@ const clientConfig = async (env, argv) => {
106
105
  }
107
106
  ]
108
107
  },
109
- {
110
- test: reactCSSRegex,
111
- use: 'null-loader'
112
- },
113
108
  ]
114
109
  },
115
110
  plugins: [
111
+ new webpack.DefinePlugin({
112
+ 'process.env.PRERENDER': false,
113
+ }),
116
114
  new MiniCssExtractPlugin(!isProd ? {} : {
117
115
  filename: '[name].[contenthash].css',
118
116
  chunkFilename: '[name].[contenthash].css',
@@ -2,8 +2,11 @@ const path = require('path');
2
2
  const webpack = require('webpack');
3
3
  const { merge } = require('webpack-merge');
4
4
  const baseConfig = require('./webpack.base.config');
5
+ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
6
+ const reactCSSRegex = /(react-[\w-]+\/dist|react-styles\/css)\/.*\.css$/;
5
7
 
6
- const serverConfig = () => {
8
+ const serverConfig = async (env, argv) => {
9
+ const isProd = argv.mode === 'production';
7
10
  return {
8
11
  output: {
9
12
  path: path.resolve('.cache/ssr-build'), // Don't bloat `public` dir
@@ -25,13 +28,26 @@ const serverConfig = () => {
25
28
  rules: [
26
29
  {
27
30
  test: /\.css$/,
28
- use: 'null-loader'
31
+ use: [
32
+ {
33
+ loader: 'css-loader'
34
+ },
35
+ {
36
+ loader: 'postcss-loader',
37
+ options: {
38
+ postcssOptions: {
39
+ plugins: [
40
+ require('autoprefixer')({
41
+ env: '>0.25%, not ie 11, not op_mini all',
42
+ flexbox: false,
43
+ grid: false
44
+ })
45
+ ]
46
+ }
47
+ }
48
+ }
49
+ ]
29
50
  },
30
- // This does weird things to document
31
- {
32
- test: /(novnc-core|@novnc\/novnc)\/.*\.js/,
33
- use: 'null-loader'
34
- }
35
51
  ]
36
52
  },
37
53
  resolve: {
@@ -41,7 +57,7 @@ const serverConfig = () => {
41
57
  // The maintainer will not allow his bundle to be required from a node context
42
58
  // https://github.com/xtermjs/xterm.js/pull/3134
43
59
  'xterm': '@patternfly/documentation-framework/helpers/xterm',
44
- 'xterm-addon-fit': '@patternfly/documentation-framework/helpers/xterm-addon-fit'
60
+ 'xterm-addon-fit': '@patternfly/documentation-framework/helpers/xterm-addon-fit',
45
61
  },
46
62
  },
47
63
  // Load in prerender.js instead
@@ -49,7 +65,7 @@ const serverConfig = () => {
49
65
  };
50
66
  }
51
67
 
52
- module.exports = (env = {}, argv) => merge(
68
+ module.exports = async (env = {}, argv) => merge(
53
69
  baseConfig(env, argv),
54
- serverConfig(env, argv)
70
+ await serverConfig(env, argv)
55
71
  );
@@ -16,9 +16,7 @@
16
16
  <%= htmlWebpackPlugin.tags.headTags %>
17
17
  </head>
18
18
  <body class="pf-m-redhat-updated-font pf-m-redhatmono-font">
19
- <div id="root">
20
- <%= prerendering %>
21
- </div>
19
+ <div id="root"><%= prerendering %></div>
22
20
  <%= htmlWebpackPlugin.tags.bodyTags %>
23
21
  <% if (algolia) { %>
24
22
  <script