Skip to content

Commit

Permalink
release: v3.3.8 (#610)
Browse files Browse the repository at this point in the history
* chore: bump version

* fix: data prefetches do not decamelize (#616)

* [Refactor]: Document (#618)

* chore: bump version

* feat: support mpa spm (#591)

* feat: support global css file in mpa (#592)

* refactor: enhance ssr in SPA mode (#590)

* fix: ssr document mode error

* chore: add test case

* fix: midway plugin ssr

* feat: support getInitialData

* fix: page component getInitial props in spa

* chore: add window fallback

* chore: optimize code

* feat: support no document

* feat: add document builder

* chore: add local build plugin

* chore: add emit

* feat: no document with staticExport

* feat: support hash in ssr

* chore: revert example

* chore: optimize code

* chore: remove useless code

* fix: app json content watch (#612)

* Bump version (#620)

* chore: bump version

* chore: add changelog

* chore: update version

* chore: update version

Co-authored-by: 岭伊 <zhengwang2314@gmail.com>
  • Loading branch information
SoloJiang and boiawang authored Feb 26, 2021
1 parent 6224f5c commit d834e95
Show file tree
Hide file tree
Showing 45 changed files with 610 additions and 592 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
## Changelog

### 3.3.8 (February 26 2021)

- Refactor: document. ([#618](https://github.com/raxjs/rax-app/pull/618))
- Fix: app json content watch. ([#612](https://github.com/raxjs/rax-app/pull/612))
- Fix: data prefetches do not decamelize in PHA. ([#616](https://github.com/raxjs/rax-app/pull/616))

### 3.3.7 (February 20 2021)

- Feat: PHA cross slide. ([#601](https://github.com/raxjs/rax-app/pull/601) [alibaba/ice#4059](https://github.com/alibaba/ice/pull/4059))
- Feat: watch app.json change. ([#601](https://github.com/raxjs/rax-app/pull/601))
- Refactor: SSR without cheerio. ([#607](https://github.com/raxjs/rax-app/pull/607))
Expand All @@ -9,19 +16,23 @@
- Fix: react alias with DEF plugin. ([#605](https://github.com/raxjs/rax-app/pull/605))

### 3.2.5 (January 07 2021)

- Feat: Support PHA template.
- Feat: Wechat Miniprogram support `generator` syntactic suga.
- Chore: `runApp` add type prompt.
- Chore: PHA support without pha-worker.js
- Fix: SSR build error.

### 3.2.2 (December 29 2020)

- Fix: mpa insert all page bundle into html.

### 3.2.1 (December 25 2020)

- Chore: `compileDependencies` default value is `['']`.

### 3.2.0 (December 24 2020)

- Feat: config store runtime automatically. ([alibaba/ice#3932](https://github.com/alibaba/ice/pull/3932))
- Feat: support config hydrate in rax-app. ([alibaba/ice#3918](https://github.com/alibaba/ice/pull/3918) [#548](https://github.com/raxjs/rax-app/pull/548))
- Feat: support set webpackLoaders and webpackPlugins through build.json.([alibaba/ice#3938]((https://github.com/alibaba/ice/pull/3938)))
Expand All @@ -33,13 +44,16 @@
- Fix: kraken mpa error.([#541]((https://github.com/raxjs/rax-app/pull/541)))

### 3.1.2 & 3.1.3 (December 15 2020)

For v3.1.1 patch version.
### 3.1.1 (December 14 2020)

- Feat: support use name specifies MPA page name and output path.([alibaba/ice#3906](https://github.com/alibaba/ice/pull/3906))
- Feat: support set html info by app.json.([#525](https://github.com/raxjs/rax-app/pull/525))
- Feat: support snapshot in Web and optimize build PHA.([#516](https://github.com/raxjs/rax-app/pull/516))

### 3.1.0 (December 04 2020)

- Feat: support build pha app.([#507](https://github.com/raxjs/rax-app/pull/507))
- Feat: support use `--dev-targets` specified build targets in development.([#508](https://github.com/raxjs/rax-app/pull/508))
- Feat: support http request mock.([#506](https://github.com/raxjs/rax-app/pull/506))
Expand All @@ -48,6 +62,7 @@ For v3.1.1 patch version.
- Fix: `withPageLifeCycle` makes `componentWillUnmount` invalid and `runApp({ app: { onShareAppMessage() {} } })` is invalid.([alibaba/ice#3880](https://github.com/alibaba/ice/pull/3880) [alibaba/ice#3890](https://github.com/alibaba/ice/pull/3890))

### 3.0.9 (November 23, 2020)

- Feat: support CSS Modules.([#488](https://github.com/raxjs/rax-app/pull/488))
- Refactor: change mpa entry to `.rax` temp dir.([alibaba/ice#3825](https://github.com/alibaba/ice/pull/3825))
- Fix: user couldn't custom `outputDir`.([#494](https://github.com/raxjs/rax-app/pull/494))
Expand All @@ -57,6 +72,7 @@ For v3.1.1 patch version.
- Fix: compact react plugin targets is undefined.([#490](https://github.com/raxjs/rax-app/pull/490))

### 3.0.8 (November 13, 2020)

- Fix: mpa restart logic.([#3817](https://github.com/alibaba/ice/pull/3817))
- Fix: kraken error.([#3817](https://github.com/alibaba/ice/pull/3817))

Expand Down
29 changes: 0 additions & 29 deletions examples/with-rax-mpa/src/app.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions packages/plugin-rax-app/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v6.2.5

- Fix: app.json watch
- Chore: delete `MiniCssExtractPlugin` when `inlineStyle` mode

4 changes: 2 additions & 2 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": "6.2.4",
"version": "6.2.5",
"description": "The basic webpack configuration for rax project",
"author": "Rax Team",
"main": "lib/index.js",
Expand All @@ -13,7 +13,7 @@
],
"license": "MIT",
"dependencies": {
"rax-webpack-config": "^1.0.0",
"rax-webpack-config": "^2.0.0",
"rax-babel-config": "^1.0.0",
"rax-jest-config": "^1.0.0",
"rax-platform-loader": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-rax-app/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const fs = require('fs-extra');

module.exports = (api, { target, babelConfigOptions, progressOptions = {} }) => {
module.exports = (api, { target, babelConfigOptions, progressOptions = {}, isNode }) => {
const { context, onGetWebpackConfig } = api;
const { rootDir, command, userConfig } = context;

Expand Down Expand Up @@ -41,7 +41,7 @@ module.exports = (api, { target, babelConfigOptions, progressOptions = {} }) =>
.use('platform-loader')
.loader(require.resolve('rax-platform-loader'))
.options({
platform: target === 'ssr' ? 'node' : target,
platform: target === 'ssr' || isNode ? 'node' : target,
});
});

Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-rax-app/src/setDev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const generateTempFile = require('./utils/generateTempFile');

const highlightPrint = chalk.hex('#F4AF3D');

function watchAppJson(log) {
const watcher = chokidar.watch(path.resolve('app.json'), {
function watchAppJson(rootDir, log) {
const watcher = chokidar.watch(path.resolve(rootDir, 'src/app.json'), {
ignoreInitial: true,
});

Expand All @@ -22,7 +22,7 @@ function watchAppJson(log) {
log.info('app.json has been changed');
log.info('restart dev server');
// add process env for mark restart dev process
process.send('RESTART_DEV');
process.send({ type: 'RESTART_DEV' });
});

watcher.on('error', (error) => {
Expand All @@ -43,7 +43,7 @@ module.exports = function (api) {
let krakenMpa = false;
let isFirstCompile = true;
let pha = false;
watchAppJson(log);
watchAppJson(rootDir, log);
const getWebpackInfo = (configs, configName) => {
const taskConfig = configs.find((webpackConfig) => webpackConfig.name === configName);
if (!taskConfig) {
Expand Down
21 changes: 10 additions & 11 deletions packages/plugin-rax-app/src/userConfig/inlineStyle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { resolve } = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { WEB, WEEX, DOCUMENT, SSR, KRAKEN, MINIAPP, WECHAT_MINIPROGRAM } = require('../constants');

const configPath = resolve(__dirname, '../');
Expand All @@ -17,9 +16,13 @@ const miniappStandardList = [
WECHAT_MINIPROGRAM,
];

const nodeStandardList = [
DOCUMENT,
SSR,
];

module.exports = (config, value, context) => {
const { taskName, command } = context;
const isDev = command === 'start';
const { taskName } = context;

const cssRule = config.module.rule('css');
const cssModuleRule = config.module.rule('css-module');
Expand All @@ -35,12 +38,9 @@ module.exports = (config, value, context) => {
const sassModuleRule = config.module.rule('scss-module');
setCSSRule(sassRule, context, value);
setCSSRule(sassModuleRule, context, value);
if ((webStandardList.includes(taskName) || miniappStandardList.includes(taskName)) && !value) {
config.plugin('MiniCssExtractPlugin')
.use(MiniCssExtractPlugin, [{
filename: isDev ? `${taskName}/[name].css` : '[name].css',
ignoreOrder: true,
}]);

if (value || inlineStandardList.includes(taskName) || nodeStandardList.includes(taskName)) {
config.plugins.delete('MiniCssExtractPlugin');
}
};

Expand All @@ -49,8 +49,7 @@ function setCSSRule(configRule, context, value) {
const isInlineStandard = inlineStandardList.includes(taskName);
const isWebStandard = webStandardList.includes(taskName);
const isMiniAppStandard = miniappStandardList.includes(taskName);
const isNodeStandard = taskName === DOCUMENT || taskName === SSR;

const isNodeStandard = nodeStandardList.includes(taskName);
// When taskName is weex or kraken, inlineStyle should be true
if (isInlineStandard) {
value = true;
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-rax-kraken/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## v1.1.1

- Feat: support MPA without `src/app.ts`

4 changes: 2 additions & 2 deletions packages/plugin-rax-kraken/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-kraken",
"version": "1.1.0",
"version": "1.1.1",
"description": "rax kraken app plugin",
"main": "lib/index.js",
"scripts": {
Expand All @@ -22,4 +22,4 @@
"@builder/mpa-config": "^3.0.0",
"@builder/app-helpers": "^2.1.0"
}
}
}
13 changes: 8 additions & 5 deletions packages/plugin-rax-kraken/src/setEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ const fs = require('fs-extra');
const path = require('path');

module.exports = (config, context) => {
const { rootDir } = context;
// SPA
const appEntry = moduleResolve(formatPath(path.join(rootDir, './src/app')));
const entryConfig = config.entry('index');
const { rootDir, userConfig: { kraken = {} } } = context;

entryConfig.add(appEntry);
if (!kraken.mpa) {
// SPA
const appEntry = moduleResolve(formatPath(path.join(rootDir, './src/app')));
const entryConfig = config.entry('index');

entryConfig.add(appEntry);
}
};

function moduleResolve(filePath) {
Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-rax-pha/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## v1.2.3

- Fix: data prefetches do not decamelize

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": "1.2.2",
"version": "1.2.3",
"description": "Rax PHA plugins",
"license": "BSD-3-Clause",
"main": "lib/index.js",
Expand All @@ -14,4 +14,4 @@
"devDependencies": {
"lodash.clonedeep": "^4.5.0"
}
}
}
14 changes: 14 additions & 0 deletions packages/plugin-rax-pha/src/__tests__/manifestHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,26 @@ describe('transformAppConfig', () => {
url: '/a.com',
data: {
id: 123,
taskId: 233,
cId: {
dId: true
}
},
header: {
taskId: 455
}
}],
}, true);
expect(manifestJSON.data_prefetches.length).toBe(1);
expect(manifestJSON.data_prefetches[0].data).toMatchObject({
id: 123,
taskId: 233,
cId: {
dId: true
}
});
expect(manifestJSON.data_prefetches[0].header).toMatchObject({
taskId: 455,
});
});

Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-rax-pha/src/manifestHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const retainKeys = [
];

// transform app config to decamelize
function transformAppConfig(appConfig, isRoot = true) {
function transformAppConfig(appConfig, isRoot = true, parentKey) {
const data = {};

if (isRoot && appConfig.routes) {
Expand All @@ -52,12 +52,12 @@ function transformAppConfig(appConfig, isRoot = true) {
} else if (Array.isArray(value)) {
data[transformKey] = value.map((item) => {
if (typeof item === 'object') {
return transformAppConfig(item, false);
return transformAppConfig(item, false, key);
}
return item;
});
} else if (typeof value === 'object') {
data[transformKey] = transformAppConfig(value, false);
} else if (typeof value === 'object' && !(parentKey === 'dataPrefetches' && (key === 'header' || key === 'data'))) {
data[transformKey] = transformAppConfig(value, false, key);
} else {
data[transformKey] = value;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/plugin-rax-web/CHANELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## v1.3.0

- Refactor: document
- Feat: support config `hash` in build.json

5 changes: 5 additions & 0 deletions packages/plugin-rax-web/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'chalk' {
export const hex: any;
export const underline: any;
export const red: any;
}
16 changes: 8 additions & 8 deletions packages/plugin-rax-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-rax-web",
"version": "1.2.2",
"version": "1.3.0",
"description": "rax web app plugin",
"main": "lib/index.js",
"scripts": {
Expand All @@ -17,18 +17,18 @@
"rax": "^1.0.0"
},
"dependencies": {
"@builder/app-helpers": "^2.1.0",
"@builder/mpa-config": "^3.0.0",
"chalk": "^4.1.0",
"cheerio": "1.0.0-rc.3",
"error-stack-tracey": "^0.1.4",
"fs-extra": "^9.0.1",
"html-minifier": "^4.0.0",
"klaw-sync": "^6.0.0",
"node-hot-loader": "^1.21.0",
"qs": "^6.9.4",
"rax-server-renderer": "^1.2.0",
"webpack-sources": "^2.0.0",
"webpack": "^4.0.0",
"@builder/app-helpers": "^2.1.0",
"react-dev-utils": "^10.0.0",
"chalk": "^4.1.0",
"html-minifier": "^4.0.0",
"cheerio": "1.0.0-rc.3"
"webpack-sources": "^2.0.0"
}
}
}
Loading

0 comments on commit d834e95

Please sign in to comment.