Skip to content

Commit

Permalink
fix: remove temp code for PostCSS AST (#3537)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Sep 23, 2024
1 parent 880d337 commit 0c3188d
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down Expand Up @@ -426,7 +425,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down Expand Up @@ -792,7 +790,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down Expand Up @@ -1105,7 +1102,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down
15 changes: 0 additions & 15 deletions packages/core/prebundle.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -161,21 +161,6 @@ export default {
postcss: '../postcss',
picocolors: '../picocolors',
},
beforeBundle(task) {
// Temp fix for https://github.com/web-infra-dev/rspack/issues/7819
replaceFileContent(join(task.depPath, 'dist/index.js'), (content) =>
content.replaceAll(
'if (meta) {',
'if (meta && !rawOptions._skipReuseAST) {',
),
);
replaceFileContent(join(task.depPath, 'dist/index.js'), (content) =>
content.replaceAll(
'this.getOptions(_options.default)',
'this.getOptions()',
),
);
},
afterBundle: writeEmptySemver,
},
{
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/plugins/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ const getCSSLoaderOptions = ({
localIdentName,
},
sourceMap: config.output.sourceMap.css,
_skipReuseAST: config.tools.lightningcssLoader !== false,
};

const mergedCssLoaderOptions = reduceConfigs({
Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/types/thirdParty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ export interface CSSLoaderOptions {
* @default 'array'
*/
exportType?: 'array' | 'string' | 'css-style-sheet';
/**
* Temp fix for https://github.com/web-infra-dev/rspack/issues/7819
* @private
*/
_skipReuseAST?: boolean;
}

export type StyleLoaderInjectType =
Expand Down
1 change: 0 additions & 1 deletion packages/core/tests/__snapshots__/builder.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": true,
Expand Down
5 changes: 0 additions & 5 deletions packages/core/tests/__snapshots__/css.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ exports[`plugin-css > should use custom cssModules rule when using output.cssMod
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": [Function],
Expand Down Expand Up @@ -69,7 +68,6 @@ exports[`plugin-css injectStyles > should apply ignoreCssLoader when injectStyle
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down Expand Up @@ -110,7 +108,6 @@ exports[`plugin-css injectStyles > should use css-loader + style-loader when inj
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": true,
Expand Down Expand Up @@ -159,7 +156,6 @@ exports[`should ensure isolation of PostCSS config objects between different bui
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down Expand Up @@ -218,7 +214,6 @@ exports[`should ensure isolation of PostCSS config objects between different bui
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down
4 changes: 0 additions & 4 deletions packages/core/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": true,
Expand Down Expand Up @@ -443,7 +442,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": true,
Expand Down Expand Up @@ -905,7 +903,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down Expand Up @@ -1245,7 +1242,6 @@ exports[`tools.rspack > should match snapshot 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": true,
Expand Down
2 changes: 0 additions & 2 deletions packages/core/tests/__snapshots__/environments.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1415,7 +1415,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 1,
"modules": {
"auto": true,
Expand Down Expand Up @@ -1755,7 +1754,6 @@ exports[`environment config > tools.rspack / bundlerChain can be configured in e
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 0,
"modules": {
"auto": true,
Expand Down
4 changes: 0 additions & 4 deletions packages/plugin-less/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ exports[`plugin-less > should add less-loader 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down Expand Up @@ -71,7 +70,6 @@ exports[`plugin-less > should add less-loader and css-loader when injectStyles 1
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down Expand Up @@ -130,7 +128,6 @@ exports[`plugin-less > should add less-loader with excludes 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down Expand Up @@ -186,7 +183,6 @@ exports[`plugin-less > should add less-loader with tools.less 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down
3 changes: 0 additions & 3 deletions packages/plugin-sass/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ exports[`plugin-sass > should add sass-loader 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 3,
"modules": {
"auto": true,
Expand Down Expand Up @@ -73,7 +72,6 @@ exports[`plugin-sass > should add sass-loader and css-loader when injectStyles 1
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 3,
"modules": {
"auto": true,
Expand Down Expand Up @@ -134,7 +132,6 @@ exports[`plugin-sass > should add sass-loader with excludes 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 3,
"modules": {
"auto": true,
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-stylus/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ exports[`plugin-stylus > should add stylus loader config correctly 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down Expand Up @@ -64,7 +63,6 @@ exports[`plugin-stylus > should allow to configure stylus options 1`] = `
{
"loader": "<ROOT>/packages/core/compiled/css-loader/index.js",
"options": {
"_skipReuseAST": true,
"importLoaders": 2,
"modules": {
"auto": true,
Expand Down

0 comments on commit 0c3188d

Please sign in to comment.