-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scripts: Use fork of
rtlcss-webpack-plugin
to fix issues with deps (#…
…68201) * Scripts: Use fork of `rtlcss-webpack-plugin` to fix issues with dependencies * Update the changelog entry * Fix path in the moved plugin * Fix path to PhpFilePathsPlugin in webpack config Co-authored-by: gziolo <gziolo@git.wordpress.org> Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: stein2nd <stein2nd@git.wordpress.org>
- Loading branch information
1 parent
500883f
commit af0e277
Showing
9 changed files
with
85 additions
and
126 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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 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 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 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 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,66 @@ | ||
/** | ||
* Parts of this source were derived and modified from the package | ||
* rtlcss-webpack-plugin, released under the MIT license. | ||
* | ||
* https://github.com/wix-incubator/rtlcss-webpack-plugin | ||
* | ||
* Copyright (c) 2018 Wix.com | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
const path = require( 'node:path' ); | ||
const rtlcss = require( 'rtlcss' ); | ||
const webpack = require( 'webpack' ); | ||
|
||
const cssOnly = ( filename ) => path.extname( filename ) === '.css'; | ||
|
||
class RtlCssPlugin { | ||
processAssets = ( compilation, callback ) => { | ||
const chunks = Array.from( compilation.chunks ); | ||
|
||
// Explore each chunk (build output): | ||
chunks.forEach( ( chunk ) => { | ||
// Explore each asset filename generated by the chunk: | ||
const files = Array.from( chunk.files ); | ||
|
||
files.filter( cssOnly ).forEach( ( filename ) => { | ||
// Get the asset source for each file generated by the chunk: | ||
const src = compilation.assets[ filename ].source(); | ||
const dst = rtlcss.process( src ); | ||
const dstFileName = compilation.getPath( '[name]-rtl.css', { | ||
chunk, | ||
cssFileName: filename, | ||
} ); | ||
|
||
compilation.assets[ dstFileName ] = | ||
new webpack.sources.RawSource( dst ); | ||
chunk.files.add( dstFileName ); | ||
} ); | ||
} ); | ||
|
||
callback(); | ||
}; | ||
|
||
apply( compiler ) { | ||
compiler.hooks.compilation.tap( 'RtlCssPlugin', ( compilation ) => { | ||
compilation.hooks.processAssets.tapAsync( | ||
{ | ||
name: 'TPAStylePlugin.pluginName', | ||
stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE, | ||
}, | ||
( chunks, callback ) => | ||
this.processAssets( compilation, callback ) | ||
); | ||
} ); | ||
} | ||
} | ||
|
||
module.exports = RtlCssPlugin; |
This file contains 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 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
af0e277
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.
Flaky tests detected in af0e277.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12479871359
📝 Reported issues:
/test/e2e/specs/site-editor/dataviews-list-layout-keyboard.spec.js