Skip to content

Commit

Permalink
Merge pull request #992 from raxjs/hotfix/3.8.15
Browse files Browse the repository at this point in the history
hotfix: v3.8.15
  • Loading branch information
SoloJiang authored Apr 21, 2022
2 parents 9d8d795 + c0dda97 commit b62b547
Show file tree
Hide file tree
Showing 20 changed files with 79 additions and 44 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog

## 3.8.15

- Chore: update @builder/pack to 0.6.x, more detail see https://github.com/ice-lab/builder-deps/pull/20

## 3.8.14

- Feat: add splashViewUrl and splashViewHtml fields
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"chokidar": "^3.5.3"
},
"resolutions": {
"colors": "1.4.0"
"colors": "1.4.0",
"@types/react": "^17.0.0"
},
"dependencies": {
"core-js": "^3.6.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
"dependencies": {
"camelcase": "^3.0.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/create-rax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
"cross-spawn": "7.0.1"
},
"homepage": "https://github.com/raxjs/rax-scripts#readme"
}
}
4 changes: 4 additions & 0 deletions packages/plugin-rax-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 7.0.9

- Fix: the way of options pass into `postcss-loader` because the update of `postcss-loader`

## 7.0.8

- Fix: only inject webpack hot client in webpack4
Expand Down
10 changes: 5 additions & 5 deletions packages/plugin-rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-app",
"version": "7.0.8",
"version": "7.0.9",
"description": "The basic webpack configuration for rax project",
"author": "Rax Team",
"main": "lib/index.js",
Expand All @@ -18,8 +18,8 @@
],
"license": "MIT",
"dependencies": {
"rax-webpack-config": "^3.0.4",
"rax-babel-config": "^2.0.0",
"rax-webpack-config": "^3.0.5",
"rax-babel-config": "^2.0.2",
"rax-jest-config": "^1.1.0",
"rax-platform-loader": "^1.1.1",
"@builder/user-config": "^2.0.0",
Expand All @@ -44,12 +44,12 @@
"process": "^0.11.10",
"events": "^3.3.0",
"node-libs-browser": "^2.2.1",
"@builder/pack": "^0.5.2",
"@builder/pack": "^0.6.0",
"@builder/swc-loader": "^1.0.1"
},
"repository": {
"type": "git",
"url": "[email protected]:raxjs/rax-app.git"
},
"gitHead": "07ac7bb07162aac8c90778dd1de4a2060f8df498"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-rax-app/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module.exports = (api, { target, babelConfigOptions, progressOptions = {} }) =>
});
}

const conditionNames = [target, 'import', 'require', 'node'];
const conditionNames = [target, '...'];

// Add condition names
if (isWebpack4) {
Expand Down
6 changes: 0 additions & 6 deletions packages/plugin-rax-app/src/userConfig/atoms/inlineStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ function configPostCssLoader(configRule, type) {
return configRule
.use('postcss-loader')
.tap((options) => {
if (isWebpack4) {
return {
...options,
plugins: (options.plugins || []).concat(getPostCssPlugin(type)),
};
}
const postcssOptions = options.postcssOptions || {};
return {
...options,
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rax-pha/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-pha",
"version": "2.1.0",
"version": "2.1.1",
"description": "Rax PHA plugins",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand All @@ -15,7 +15,7 @@
"webpack-sources": "^1.4.3",
"@builder/app-helpers": "^2.1.0",
"@builder/compat-webpack4": "^1.0.0",
"@builder/pack": "^0.5.0"
"@builder/pack": "^0.6.0"
},
"devDependencies": {
"webpack": ">=4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-rax-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"html-minifier": "^4.0.0",
"qs": "^6.9.4",
"rax-server-renderer": "^1.2.0",
"rax-app-renderer": "^3.0.2",
"rax-app-renderer": "^3.0.3",
"webpack-sources": "^2.0.0",
"chokidar": "^3.5.1",
"@builder/compat-webpack4": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"react-dev-utils": "^11.0.0",
"cheerio": "1.0.0-rc.3",
"html-minifier": "^4.0.0",
"rax-app-renderer": "^3.0.2",
"rax-app-renderer": "^3.0.3",
"rax-server-renderer": "^1.2.0",
"@builder/html-generator": "^2.0.0",
"chalk": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-plugin-rpx2vw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"dependencies": {
"postcss": "^7.0.36"
}
}
}
2 changes: 1 addition & 1 deletion packages/rax-app-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@
"bugs": {
"url": "https://github.com/raxjs/rax-app/issues"
}
}
}
10 changes: 5 additions & 5 deletions packages/rax-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-app",
"version": "3.8.14",
"version": "3.8.15",
"description": "command line interface and builtin plugin for rax app",
"author": "Rax Team",
"homepage": "https://github.com/raxjs/rax-app#readme",
Expand All @@ -14,14 +14,14 @@
"test": "__tests__"
},
"dependencies": {
"@builder/pack": "^0.5.0",
"@builder/pack": "^0.6.0",
"build-scripts": "^1.1.0",
"build-plugin-app-core": "2.1.0",
"build-plugin-ice-config": "2.0.2",
"build-plugin-rax-app": "7.0.8",
"build-plugin-rax-app": "7.0.9",
"build-plugin-rax-kraken": "2.1.1",
"build-plugin-rax-miniapp": "2.0.2",
"build-plugin-rax-pha": "2.1.0",
"build-plugin-rax-pha": "2.1.1",
"build-plugin-rax-store": "2.0.1",
"build-plugin-rax-web": "2.0.8",
"build-plugin-rax-weex": "2.0.0",
Expand Down Expand Up @@ -56,4 +56,4 @@
"node": ">=12.22.0",
"npm": ">=3.0.0"
}
}
}
8 changes: 4 additions & 4 deletions packages/rax-babel-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-babel-config",
"version": "2.0.1",
"version": "2.0.2",
"description": "rax base babel config",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand All @@ -17,17 +17,17 @@
},
"homepage": "https://github.com/raxjs/rax-scripts/tree/master/packages/rax-babel-config#readme",
"dependencies": {
"@builder/pack": "^0.5.0",
"@builder/pack": "^0.6.0",
"babel-plugin-minify-dead-code-elimination-while-loop-fixed": "^0.3.0",
"babel-plugin-transform-jsx-class": "^0.1.2",
"babel-plugin-transform-jsx-condition": "^0.1.0",
"babel-plugin-transform-jsx-fragment": "^0.1.1",
"babel-plugin-transform-jsx-list": "^0.1.0",
"babel-plugin-transform-jsx-memo": "^0.1.2",
"babel-plugin-transform-jsx-slot": "^0.1.1",
"babel-plugin-transform-jsx-stylesheet": "^1.0.4",
"babel-plugin-transform-jsx-stylesheet": "^1.0.6",
"babel-plugin-transform-jsx-to-html": "^0.2.1",
"babel-plugin-const-enum": "^1.0.0",
"chalk": "^2.4.2"
}
}
}
2 changes: 1 addition & 1 deletion packages/rax-jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"dependencies": {
"babel-jest": "^26.1.0",
"jest-transform-css": "^2.0.0",
"rax-babel-config": "^2.0.0"
"rax-babel-config": "^2.0.2"
}
}
6 changes: 5 additions & 1 deletion packages/rax-webpack-config/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v3.0.5

- Feat: update version of `postcss-loader`

## v3.0.4

- Chore: revert 3.0.3 changed file
Expand Down Expand Up @@ -37,6 +41,7 @@
## v2.0.2

- Chore: upgrade less version

## v2.0.1

- Chore: update sass-loader version
Expand All @@ -45,4 +50,3 @@
## v2.0.0

- Chore: config `MiniCssExtractPlugin` in base config

12 changes: 8 additions & 4 deletions packages/rax-webpack-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-webpack-config",
"version": "3.0.4",
"version": "3.0.5",
"description": "rax base webpack config",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand All @@ -17,12 +17,13 @@
},
"homepage": "https://github.com/raxjs/rax-app/tree/master/packages/rax-webpack-config#readme",
"dependencies": {
"@builder/pack": "^0.5.0",
"@builder/rax-pack": "^0.1.0",
"@builder/pack": "^0.6.0",
"@builder/rax-pack": "^1.0.0",
"@babel/runtime": "^7.2.0",
"babel-runtime-jsx-plus": "^0.1.3",
"less": "^4.0.0",
"sass": "^1.32.0",
"postcss": "^8.4.12",
"typescript": "^4.0.0",
"url-loader": "^2.1.0",
"mini-css-extract-plugin": "^1.0.0",
Expand All @@ -32,7 +33,10 @@
"webpack-chain": "^6.5.1",
"ts-loader": "^8.0.0"
},
"peerDependencies": {
"postcss": "^7.0.0 || ^8.0.0"
},
"devDependencies": {
"webpack": ">=4.0.0"
}
}
}
23 changes: 23 additions & 0 deletions packages/rax-webpack-config/src/getPostcssImplementation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
function resolvePkgPath(pkg, resolvePath?: string): string {
return resolvePath ? require.resolve(pkg, { paths: [resolvePath] }) : require.resolve(pkg);
}

function getDefaultPostcssImplementation(resolvePath?: string) {
let postcssImplPkg = 'postcss';
try {
postcssImplPkg = resolvePkgPath(postcssImplPkg, resolvePath);
// eslint-disable-next-line no-empty
} catch (error) {}
// eslint-disable-next-line import/no-dynamic-require, global-require
return require(postcssImplPkg);
}

export default function getPostcssImplementation(resolvePath?: string) {
try {
return getDefaultPostcssImplementation(resolvePath);
} catch (error) {
console.error('Run `npm install postcss` or `yarn add postcss` inside your workspace.');
// exit process when postcss require is failed
process.exit(1);
}
}
17 changes: 9 additions & 8 deletions packages/rax-webpack-config/src/setWebpackLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@ import { cloneDeep } from '@builder/pack/deps/lodash';
import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
import { IOptions } from './types';
import isWebpack4 from './isWebpack4';
import getPostcssImplementation from './getPostcssImplementation';

const URL_LOADER_LIMIT = 8192;
const EXCLUDE_REGX = /node_modules/;
// config css rules
const configCSSRule = (config, style) => {
const configCSSRule = (config, style, rootDir) => {
const cssModuleReg = new RegExp(`\\.module\\.${style}$`);
const styleReg = new RegExp(`\\.${style}$`);

// add both rule of css and css module
['css', 'module'].forEach((type) => {
if (type === 'module') {
createCSSRule(config, `${style}-module`, cssModuleReg, []);
createCSSRule(config, `${style}-module`, cssModuleReg, [], rootDir);
} else {
createCSSRule(config, style, styleReg, [cssModuleReg]);
createCSSRule(config, style, styleReg, [cssModuleReg], rootDir);
}
});
};

export const createCSSRule = (config, ruleName, reg, excludeRegs = []) => {
export const createCSSRule = (config, ruleName, reg, excludeRegs = [], rootDir) => {
const isCSSModule = /\-module$/.test(ruleName);
const extName = ruleName.replace(/\-(module|global)$/, '');
const rule = config.module.rule(ruleName).test(reg);
Expand All @@ -32,7 +33,7 @@ export const createCSSRule = (config, ruleName, reg, excludeRegs = []) => {

addExtractLoader(rule);
addCssLoader(rule, isCSSModule);
addPostCssLoader(rule);
addPostCssLoader(rule, rootDir);

const sassLoader = isWebpack4 ? require.resolve('@builder/rax-pack/deps/sass-loader') : require.resolve('@builder/pack/deps/sass-loader');
const lessLoader = isWebpack4 ? require.resolve('@builder/rax-pack/deps/less-loader') : require.resolve('@builder/pack/deps/less-loader');
Expand Down Expand Up @@ -81,9 +82,9 @@ const addCssLoader = (rule, isCSSModule) => {
.end();
};

const addPostCssLoader = (rule) => {
const addPostCssLoader = (rule, rootDir) => {
const postcssLoader = isWebpack4 ? require.resolve('@builder/rax-pack/deps/postcss-loader') : require.resolve('@builder/pack/deps/postcss-loader');
return rule.use('postcss-loader').loader(postcssLoader).options({ sourceMap: true }).end();
return rule.use('postcss-loader').loader(postcssLoader).options({ implementation: getPostcssImplementation(rootDir), sourceMap: true }).end();
};

const addCssPreprocessorLoader = (rule, loader) => {
Expand Down Expand Up @@ -145,7 +146,7 @@ export default (config, { rootDir, babelConfig }: IOptions) => {

// css loader
['css', 'scss', 'less'].forEach((style) => {
configCSSRule(config, style);
configCSSRule(config, style, rootDir);
});

[
Expand Down

0 comments on commit b62b547

Please sign in to comment.