Skip to content

Commit

Permalink
Merge pull request #4964 from alibaba/release-next
Browse files Browse the repository at this point in the history
release/2.2.3
  • Loading branch information
ClarkXia authored Nov 25, 2021
2 parents f9ab033 + a013829 commit 6e979ba
Show file tree
Hide file tree
Showing 26 changed files with 77 additions and 38 deletions.
5 changes: 5 additions & 0 deletions packages/build-mpa-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 4.0.5

- fix: `TabBar` resolve path
- chore: remove `x-if` in `TabBar`

## 4.0.4

- fix: every mpa page should redirect runApp file path
Expand Down
4 changes: 2 additions & 2 deletions packages/build-mpa-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@builder/mpa-config",
"version": "4.0.4",
"version": "4.0.5",
"description": "enable mpa project for framework",
"author": "[email protected]",
"homepage": "",
Expand Down Expand Up @@ -30,4 +30,4 @@
"devDependencies": {
"build-scripts": "^1.1.0"
}
}
}
2 changes: 1 addition & 1 deletion packages/build-mpa-config/src/generate/RaxGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class RaxGenerator extends Base {
if (content.tabBar) {
this.runAppRenderData.tabBarPath = content.tabBar.custom ?
relative(this.entryFolder, path.join(this.rootDir, 'src/components/CustomTabBar/index'))
: relative(this.entryFolder, path.join(this.targetDir, 'plugins/rax-app/TabBar'));
: relative(this.entryFolder, path.join(this.targetDir, 'plugins/app/TabBar'));
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/build-mpa-config/src/template/rax/TabBar.tsx.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export default class TabBarWrapper extends Component {
(window as any).location.href = `./${pageName}.html`;
}
}

render() {
return <Fragment x-if={shouldRenderTabBar}>
if (!shouldRenderTabBar) return null;
return <Fragment>
<% if (tabBarPath.indexOf('src') > -1) {%>
<div style={{ position: "fixed", bottom: 0, width: "750rpx", zIndex: 999 }}>
<TabBar config={<%- JSON.stringify(tabBarConfig) %>} currentPageName={currentPageName} />
Expand Down
4 changes: 4 additions & 0 deletions packages/build-user-config/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.1.8

- [fix] re-calculate webpack cache id when config `disableRuntime`

## 1.1.7

- [fix] undefined `postcssOptions.plugins`
Expand Down
3 changes: 2 additions & 1 deletion packages/build-user-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@builder/user-config",
"version": "1.1.7",
"version": "1.1.8",
"description": "Includes methods which are releated to set base user config for framework",
"homepage": "",
"license": "MIT",
Expand All @@ -15,6 +15,7 @@
"fs-extra": "^8.1.0",
"fork-ts-checker-webpack-plugin": "^5.0.5",
"loader-utils": "^2.0.0",
"object-hash": "^2.2.0",
"regenerator-runtime": "^0.13.3",
"react-dev-utils": "^11.0.4",
"webpack-dev-mock": "^1.0.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/build-user-config/src/webpack5.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const path = require('path');
const hash = require('object-hash');

// built-in webpack 5 abilities
module.exports = (config, api) => {
const { context, getValue } = api;
const { userConfig, rootDir, webpack } = context;
// filesystem cache
if (!process.env.DISABLE_FS_CACHE) {
const version = getValue('WEBPACK_CACHE_ID');
const version = getValue('WEBPACK_CACHE_ID') || hash(userConfig);
const cacheConfig = {
cache: {
type: 'filesystem',
Expand Down
8 changes: 4 additions & 4 deletions packages/icejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice.js",
"version": "2.2.2",
"version": "2.2.3",
"description": "command line interface and builtin plugin for icejs",
"author": "[email protected]",
"homepage": "",
Expand Down Expand Up @@ -29,10 +29,10 @@
"build-plugin-ice-auth": "2.0.0",
"build-plugin-ice-config": "2.0.1",
"build-plugin-ice-logger": "2.0.0",
"build-plugin-ice-mpa": "2.0.1",
"build-plugin-ice-mpa": "2.0.2",
"build-plugin-ice-request": "2.0.0",
"build-plugin-ice-router": "2.0.3",
"build-plugin-ice-ssr": "3.0.3",
"build-plugin-ice-router": "2.0.4",
"build-plugin-ice-ssr": "3.0.4",
"build-plugin-ice-store": "2.0.5",
"build-plugin-react-app": "2.0.4",
"build-plugin-pwa": "1.0.1",
Expand Down
4 changes: 4 additions & 0 deletions packages/miniapp-renderer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.2.1

- [Refactor] miniapp page component

## 0.1.15

- [Chore] use `pageSource` as the render unique path when `route.pageSource` existed
Expand Down
2 changes: 1 addition & 1 deletion packages/miniapp-renderer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "miniapp-renderer",
"version": "0.2.0",
"version": "0.2.1",
"description": "",
"author": "[email protected]",
"homepage": "https://github.com/alibaba/ice#readme",
Expand Down
10 changes: 6 additions & 4 deletions packages/miniapp-renderer/src/miniappRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { createElement, ComponentType, Component, RaxElement } from 'rax';

interface IRoute {
source: string;
component: ComponentType,
component: () => ComponentType & {
__pageConfig: IRoute;
},
pageSource: string;
}

Expand Down Expand Up @@ -33,9 +35,9 @@ function miniappRenderer(
path: pageSource || source,
render() {
// Add page config to page component
// @ts-ignore
component.__pageConfig = route;
const appInstance = mount(getRenderApp(component, runtime, {
const Page = component();
Page.__pageConfig = route;
const appInstance = mount(getRenderApp(Page, runtime, {
ErrorBoundary,
ErrorBoundaryFallback,
onError,
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-ice-ssr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.0.4

- [fix] compatible with special charts in html content

## 3.0.3

- [fix] route path value may be undefined
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ice-ssr/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-ssr",
"version": "3.0.3",
"version": "3.0.4",
"description": "ssr plugin",
"author": "[email protected]",
"homepage": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-ice-ssr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ const plugin = async (api): Promise<void> => {
const htmlFilePath = path.join(buildDir, 'index.html');
const bundle = fse.readFileSync(serverFilePath, 'utf-8');
const html = fse.readFileSync(htmlFilePath, 'utf-8');
const minifiedHtml = minify(html, { collapseWhitespace: true, quoteCharacter: '\'' });
const newBundle = bundle.replace(/__ICE_SERVER_HTML_TEMPLATE__/, minifiedHtml);
const minifiedHtml = minify(html, { collapseWhitespace: true, quoteCharacter: '\'' }).replace(/`/g, '&#x60;');
const newBundle = bundle.replace(/'global.__ICE_SERVER_HTML_TEMPLATE__'/, `\`${minifiedHtml}\``);
fse.writeFileSync(serverFilePath, newBundle, 'utf-8');

// @deprecated
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ice-ssr/src/renderPages.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default async function ssgRender(options) {
const { htmlTemplate } = options;
const loadableStatsPath = join(process.cwd(), '<%- outputDir %>', 'loadable-stats.json');
const buildConfig = { loadableStatsPath };
const htmlTemplateContent = htmlTemplate || `__ICE_SERVER_HTML_TEMPLATE__`;
const htmlTemplateContent = htmlTemplate || 'global.__ICE_SERVER_HTML_TEMPLATE__';
const pagesData = [];
const flatRoutes = await getFlatRoutes(routes || []);

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-ice-ssr/src/server.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const serverRender = async (context: ServerContext, opts = {}) => {
}
const buildConfig = { loadableStatsPath, publicPath };

const htmlTemplateContent = htmlTemplate || `__ICE_SERVER_HTML_TEMPLATE__`;
const htmlTemplateContent = htmlTemplate || 'global.__ICE_SERVER_HTML_TEMPLATE__';

// load module to run before createApp ready
loadStaticModules(appConfig);
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-mpa/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# changelog

## 2.0.2

- [fix] compatible with the situation when config both `disableRuntime` and `mpa`

## 2.0.1

- [feat] support disable rewrite rules for FaaS render
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-mpa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-mpa",
"version": "2.0.1",
"version": "2.0.2",
"description": "enable mpa project for icejs framework",
"author": "[email protected]",
"homepage": "",
Expand Down
20 changes: 11 additions & 9 deletions packages/plugin-mpa/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,17 @@ const plugin: IPlugin = (api) => {
}
// modify entry
modifyUserConfig('entry', finalMPAEntries);
applyMethod('addImportDeclaration', {
multipleSource: {
runApp: redirectEntries.map(({ entryPath, runAppPath }) => ({
filename: entryPath,
value: runAppPath,
type: 'normal',
})),
},
});
if (redirectEntries.length > 0) {
applyMethod('addImportDeclaration', {
multipleSource: {
runApp: redirectEntries.map(({ entryPath, runAppPath }) => ({
filename: entryPath,
value: runAppPath,
type: 'normal',
})),
},
});
}
// set page template
onGetWebpackConfig(config => {
setPageTemplate(rootDir, entries, (mpa as any).template || {}, config, setValue);
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-router/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.4

- [fix] support config `devSever.historyApiFallback`

## 2.0.3

- [fix] nested router config
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-router",
"version": "2.0.3",
"version": "2.0.4",
"description": "build-plugin-ice-router",
"author": "[email protected]",
"homepage": "",
Expand Down
4 changes: 3 additions & 1 deletion packages/plugin-router/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ const plugin = ({ context, onGetWebpackConfig, modifyUserConfig, getValue, apply
config.resolve.alias.set(routerName, path.dirname(packagePath));

// config historyApiFallback for router type browser
config.devServer.set('historyApiFallback', true);
if (!config.devServer.get('historyApiFallback')) {
config.devServer.set('historyApiFallback', true);
}
});

// copy types
Expand Down
4 changes: 4 additions & 0 deletions packages/webpack-dev-mock/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 1.3.2

- [fix] match the correct pathname of request

## 1.3.1

- [fix] update dependencies
Expand Down
4 changes: 2 additions & 2 deletions packages/webpack-dev-mock/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpack-dev-mock",
"version": "1.3.1",
"version": "1.3.2",
"description": "Webpack devserver middleware mock server",
"main": "lib/index.js",
"scripts": {
Expand Down Expand Up @@ -35,4 +35,4 @@
"lib",
"!lib/**/*.map"
]
}
}
2 changes: 1 addition & 1 deletion packages/webpack-dev-mock/src/matchPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function decodeParam(val) {
function matchPath(req, mockConfig) {
const { method: reqMethod } = req;
// compatible with http server
const reqPath = req.path || req.url;
const reqPath = req?._parsedUrl?.pathname || req.path || req.url;
for (let m = 0; m < mockConfig.length; m += 1) {
const mock = mockConfig[m];
const { path: mockPath, method: mockMethod } = mock;
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5044,9 +5044,9 @@ build-scripts-config@^3.0.0:
webpack-simple-progress-plugin "0.0.4"

build-scripts@^1.0.0, build-scripts@^1.0.1, build-scripts@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/build-scripts/-/build-scripts-1.2.0.tgz#9be18aa73d6a5f5111fe81043038aa75e52006a8"
integrity sha512-OkSCr4iIre4KcN8WOO46uY+mvZjmNUuonim3niMDY8jf4L117h23JATm/m0xLFxe3LJ2KXCscAKK6VKbU4I/ow==
version "1.2.1"
resolved "https://registry.yarnpkg.com/build-scripts/-/build-scripts-1.2.1.tgz#626bf4343c425124320bea0189bfdafa6501280e"
integrity sha512-qumrwcAO1SwhN23Nn98gkHCmZw+PZ4nGjQdBp2vfQSq8/rElqXBP4SlgfbX7RP0ZfRZdUXeUgfRegco48XnJ6g==
dependencies:
address "^1.1.0"
camelcase "^5.3.1"
Expand Down

0 comments on commit 6e979ba

Please sign in to comment.