diff --git a/CHANGELOG.md b/CHANGELOG.md index ab473c3caa33..0da2288c63a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.3.2](https://github.com/midwayjs/midway/compare/v1.3.1...v1.3.2) (2019-02-22) + +**Note:** Version bump only for package midway + + + + + ## [1.3.1](https://github.com/midwayjs/midway/compare/v1.3.0...v1.3.1) (2019-02-18) **Note:** Version bump only for package midway diff --git a/lerna.json b/lerna.json index 978e571b6c1f..cd19d44fed5a 100644 --- a/lerna.json +++ b/lerna.json @@ -14,5 +14,5 @@ ] } }, - "version": "1.3.1" + "version": "1.3.2" } diff --git a/packages/midway-core/CHANGELOG.md b/packages/midway-core/CHANGELOG.md index 6f1690064ab6..c689687b9e80 100644 --- a/packages/midway-core/CHANGELOG.md +++ b/packages/midway-core/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.3.2](https://github.com/midwayjs/midway/compare/v1.3.1...v1.3.2) (2019-02-22) + +**Note:** Version bump only for package midway-core + + + + + # [1.3.0](https://github.com/midwayjs/midway/compare/v1.2.4...v1.3.0) (2019-02-12) **Note:** Version bump only for package midway-core diff --git a/packages/midway-core/package.json b/packages/midway-core/package.json index 4ac5418ef6f0..ad6422b50684 100644 --- a/packages/midway-core/package.json +++ b/packages/midway-core/package.json @@ -1,6 +1,6 @@ { "name": "midway-core", - "version": "1.3.0", + "version": "1.3.2", "description": "midway core", "main": "dist/index", "typings": "dist/index.d.ts", diff --git a/packages/midway-core/src/container.ts b/packages/midway-core/src/container.ts index 60e087c00881..debed0c2da70 100644 --- a/packages/midway-core/src/container.ts +++ b/packages/midway-core/src/container.ts @@ -207,7 +207,7 @@ export class MidwayContainer extends Container implements IContainer { const loadDirs = [].concat(opts.loadDir || []); for (const dir of loadDirs) { - const fileResults = globby.sync(['**/**.ts', '**/**.js', '!**/**.d.ts'].concat(opts.pattern || []), { + const fileResults = globby.sync(['**/**.ts', '**/**.tsx', '**/**.js', '!**/**.d.ts'].concat(opts.pattern || []), { cwd: dir, ignore: [ '**/node_modules/**', diff --git a/packages/midway-mock/CHANGELOG.md b/packages/midway-mock/CHANGELOG.md index 25d9ed377af9..43c59ed7de96 100644 --- a/packages/midway-mock/CHANGELOG.md +++ b/packages/midway-mock/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.3.2](https://github.com/midwayjs/midway/compare/v1.3.1...v1.3.2) (2019-02-22) + +**Note:** Version bump only for package midway-mock + + + + + # [1.3.0](https://github.com/midwayjs/midway/compare/v1.2.4...v1.3.0) (2019-02-12) **Note:** Version bump only for package midway-mock diff --git a/packages/midway-mock/package.json b/packages/midway-mock/package.json index c602e42aa304..08992aeac047 100644 --- a/packages/midway-mock/package.json +++ b/packages/midway-mock/package.json @@ -1,6 +1,6 @@ { "name": "midway-mock", - "version": "1.3.0", + "version": "1.3.2", "eggPlugin": { "name": "midway-mock" }, @@ -33,7 +33,7 @@ "devDependencies": { "injection": "^1.1.0", "midway-bin": "^1.3.0", - "midway-core": "^1.3.0" + "midway-core": "^1.3.2" }, "dependencies": { "egg-mock": "^3.21.0", diff --git a/packages/midway-web/CHANGELOG.md b/packages/midway-web/CHANGELOG.md index 31149b6c730a..d9ff3f872e22 100644 --- a/packages/midway-web/CHANGELOG.md +++ b/packages/midway-web/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.3.2](https://github.com/midwayjs/midway/compare/v1.3.1...v1.3.2) (2019-02-22) + +**Note:** Version bump only for package midway-web + + + + + # [1.3.0](https://github.com/midwayjs/midway/compare/v1.2.4...v1.3.0) (2019-02-12) **Note:** Version bump only for package midway-web diff --git a/packages/midway-web/package.json b/packages/midway-web/package.json index f3f7a8e67704..b1febeb3872c 100644 --- a/packages/midway-web/package.json +++ b/packages/midway-web/package.json @@ -1,6 +1,6 @@ { "name": "midway-web", - "version": "1.3.0", + "version": "1.3.2", "description": "Midway Web Scene", "main": "dist/index", "typings": "dist/index.d.ts", @@ -27,9 +27,13 @@ ], "license": "MIT", "devDependencies": { + "@types/react": "^16.0.38", + "@types/react-dom": "^16.0.4", "midway-bin": "^1.3.0", - "midway-mock": "^1.3.0", - "pedding": "^1.1.0" + "midway-mock": "^1.3.2", + "pedding": "^1.1.0", + "react": "^16.2.0", + "react-dom": "^16.2.0" }, "dependencies": { "@eggjs/router": "^1.1.0", @@ -41,7 +45,7 @@ "inflection": "^1.12.0", "injection": "^1.1.0", "is-type-of": "^1.2.1", - "midway-core": "^1.3.0", + "midway-core": "^1.3.2", "midway-schedule": "^1.3.0", "mkdirp": "^0.5.1", "reflect-metadata": "^0.1.12" diff --git a/packages/midway-web/src/loader/webLoader.ts b/packages/midway-web/src/loader/webLoader.ts index 089c058d7e9d..a54139a01cf6 100644 --- a/packages/midway-web/src/loader/webLoader.ts +++ b/packages/midway-web/src/loader/webLoader.ts @@ -159,7 +159,7 @@ export class MidwayWebLoader extends MidwayLoader { let arr = []; names.forEach((name) => { - arr = arr.concat([name + '.ts', name + '.js']); + arr = arr.concat([name + '.ts', name + '.tsx', name + '.js']); }); return arr.concat(['!**/**.d.ts']); } diff --git a/packages/midway-web/test/enhance.test.ts b/packages/midway-web/test/enhance.test.ts index aaa18eab40db..372359dbe4ce 100644 --- a/packages/midway-web/test/enhance.test.ts +++ b/packages/midway-web/test/enhance.test.ts @@ -392,4 +392,24 @@ describe('/test/enhance.test.ts', () => { .expect('root_test', done); }); }); + + describe('load tsx file', () => { + let app; + before(() => { + app = utils.app('enhance/base-app-controller-tsx', { + typescript: true + }); + return app.ready(); + }); + + after(() => app.close()); + + it('should load tsx controller', (done) => { + request(app.callback()) + .get('/') + .expect(200) + .expect(/react/, done); + }); + + }); }); diff --git a/packages/midway-web/test/fixtures/enhance/base-app-controller-tsx/package.json b/packages/midway-web/test/fixtures/enhance/base-app-controller-tsx/package.json new file mode 100644 index 000000000000..621cdc6a4174 --- /dev/null +++ b/packages/midway-web/test/fixtures/enhance/base-app-controller-tsx/package.json @@ -0,0 +1,3 @@ +{ + "name": "ali-demo" +} diff --git a/packages/midway-web/test/fixtures/enhance/base-app-controller-tsx/src/app/controller/my.tsx b/packages/midway-web/test/fixtures/enhance/base-app-controller-tsx/src/app/controller/my.tsx new file mode 100644 index 000000000000..cd530d420cdb --- /dev/null +++ b/packages/midway-web/test/fixtures/enhance/base-app-controller-tsx/src/app/controller/my.tsx @@ -0,0 +1,29 @@ +import { provide } from 'injection'; +import { controller, get } from '../../../../../../../src/'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom/server'; +import App from '../../shared/App'; + +@provide() +@controller('/') +export class My { + @get('/') + async index(ctx) { + ctx.body = ` + + +
+ + + + + +