-
Notifications
You must be signed in to change notification settings - Fork 29
[Breaking changes] Bump several major dependencies #2041
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9e7ec37
refactor: migrate to webpack v5
emmenko 02b8e6d
refactor: chore: re-add websites into workspaces
emmenko 39e9715
refactor: migrate webpack-dev-server
emmenko 4e5a920
chore: remove patch file
emmenko 42fdf60
refactor: sync config with CRA
emmenko 757f8c0
fix(mc-scripts): load correct browserslist config based on environment
emmenko e34e0d2
refactor(mc-scripts): small improvements
emmenko 664412e
refactor: simplify and drop old peer dep versions
emmenko 3296b6f
fix: hmr
emmenko 6ab4a15
fix: lockfile
emmenko 2022b06
chore: regenerate types and schema
emmenko 9c85af8
docs: add comment
emmenko 07502ed
docs: add changesets
emmenko 120292d
fix: missing Link component types
emmenko 2c68d95
chore: upgrade docskit to v16
emmenko e5d4032
chore: upgrade ui-kit to v12 (#2131)
adnasa b8777c2
docs: improve changesets
emmenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
packages/mc-scripts/src/patches/react-dev-utils/formatWebpackMessages.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const friendlySyntaxErrorLabel = 'Syntax error:'; | ||
|
||
function isLikelyASyntaxError(message) { | ||
return message.indexOf(friendlySyntaxErrorLabel) !== -1; | ||
} | ||
|
||
// Cleans up webpack error messages. | ||
function formatMessage(message) { | ||
let lines = message.split('\n'); | ||
|
||
// Strip webpack-added headers off errors/warnings | ||
// https://github.com/webpack/webpack/blob/master/lib/ModuleError.js | ||
lines = lines.filter((line) => !/Module [A-z ]+\(from/.test(line)); | ||
|
||
// Transform parsing error into syntax error | ||
// TODO: move this to our ESLint formatter? | ||
lines = lines.map((line) => { | ||
const parsingError = /Line (\d+):(?:(\d+):)?\s*Parsing error: (.+)$/.exec( | ||
line | ||
); | ||
if (!parsingError) { | ||
return line; | ||
} | ||
const [, errorLine, errorColumn, errorMessage] = parsingError; | ||
return `${friendlySyntaxErrorLabel} ${errorMessage} (${errorLine}:${errorColumn})`; | ||
}); | ||
|
||
message = lines.join('\n'); | ||
// Smoosh syntax errors (commonly found in CSS) | ||
message = message.replace( | ||
/SyntaxError\s+\((\d+):(\d+)\)\s*(.+?)\n/g, | ||
`${friendlySyntaxErrorLabel} $3 ($1:$2)\n` | ||
); | ||
// Clean up export errors | ||
message = message.replace( | ||
/^.*export '(.+?)' was not found in '(.+?)'.*$/gm, | ||
`Attempted import error: '$1' is not exported from '$2'.` | ||
); | ||
message = message.replace( | ||
/^.*export 'default' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, | ||
`Attempted import error: '$2' does not contain a default export (imported as '$1').` | ||
); | ||
message = message.replace( | ||
/^.*export '(.+?)' \(imported as '(.+?)'\) was not found in '(.+?)'.*$/gm, | ||
`Attempted import error: '$1' is not exported from '$3' (imported as '$2').` | ||
); | ||
lines = message.split('\n'); | ||
|
||
// Remove leading newline | ||
if (lines.length > 2 && lines[1].trim() === '') { | ||
lines.splice(1, 1); | ||
} | ||
// Clean up file name | ||
lines[0] = lines[0].replace(/^(.*) \d+:\d+-\d+$/, '$1'); | ||
|
||
// Cleans up verbose "module not found" messages for files and packages. | ||
if (lines[1] && lines[1].indexOf('Module not found: ') === 0) { | ||
lines = [ | ||
lines[0], | ||
lines[1] | ||
.replace('Error: ', '') | ||
.replace('Module not found: Cannot find file:', 'Cannot find file:'), | ||
]; | ||
} | ||
|
||
// Add helpful message for users trying to use Sass for the first time | ||
if (lines[1] && lines[1].match(/Cannot find module.+node-sass/)) { | ||
lines[1] = 'To import Sass files, you first need to install node-sass.\n'; | ||
lines[1] += | ||
'Run `npm install node-sass` or `yarn add node-sass` inside your workspace.'; | ||
} | ||
|
||
message = lines.join('\n'); | ||
// Internal stacks are generally useless so we strip them... with the | ||
// exception of stacks containing `webpack:` because they're normally | ||
// from user code generated by webpack. For more information see | ||
// https://github.com/facebook/create-react-app/pull/1050 | ||
message = message.replace( | ||
/^\s*at\s((?!webpack:).)*:\d+:\d+[\s)]*(\n|$)/gm, | ||
'' | ||
); // at ... ...:x:y | ||
message = message.replace(/^\s*at\s<anonymous>(\n|$)/gm, ''); // at <anonymous> | ||
lines = message.split('\n'); | ||
|
||
// Remove duplicated newlines | ||
lines = lines.filter( | ||
(line, index, arr) => | ||
index === 0 || line.trim() !== '' || line.trim() !== arr[index - 1].trim() | ||
); | ||
|
||
// Reassemble the message | ||
message = lines.join('\n'); | ||
return message.trim(); | ||
} | ||
|
||
function formatWebpackMessages(json) { | ||
const formattedErrors = json.errors.map(formatMessage); | ||
const formattedWarnings = json.warnings.map(formatMessage); | ||
const result = { errors: formattedErrors, warnings: formattedWarnings }; | ||
if (result.errors.some(isLikelyASyntaxError)) { | ||
// If there are any syntax errors, show just them. | ||
result.errors = result.errors.filter(isLikelyASyntaxError); | ||
} | ||
return result; | ||
This comment was marked as outdated.
Sorry, something went wrong. |
||
} | ||
|
||
module.exports = formatWebpackMessages; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥