From d029fb25aa62bfdf20935b7b1c8bddd20d120032 Mon Sep 17 00:00:00 2001 From: tanghongyu <505648237@qq.com> Date: Tue, 25 Aug 2020 16:43:22 +0800 Subject: [PATCH] upgrade next --- LICENSE | 0 README.md | 0 app.d.ts | 0 app.js | 0 config.d.ts | 0 config.js | 0 deferred.d.ts | 0 deferred.js | 0 example/index.js | 2 ++ getstate.d.ts | 0 getstate.js | 0 jest.config.js | 0 layout.d.ts | 0 layout.js | 0 package.json | 11 ++++++++--- plugin.js | 0 redirect.d.ts | 0 redirect.js | 0 src/client/.babelrc | 0 src/client/config.ts | 0 src/client/deferred.ts | 0 src/client/delegates.d.ts | 0 src/client/getstate.ts | 0 src/client/layout.tsx | 0 src/client/redirect.ts | 0 src/pages/.babelrc | 0 src/pages/app.tsx | 0 src/server/.babelrc | 0 src/server/index.ts | 0 test/jest-environment.js | 0 test/jest-global-setup.js | 0 test/jest-global-teardown.js | 0 test/jest.babelconfig.js | 0 test/jest.setup.js | 0 test/next-koa-test-utils.ts | 0 test/next-koa/.babelrc | 0 test/next-koa/layout/ItalicLayout.tsx | 0 test/next-koa/layout/Layout.tsx | 0 test/next-koa/layout/LayoutModel.ts | 0 test/next-koa/next-env.d.ts | 0 test/next-koa/next.config.js | 0 test/next-koa/pages/_app.tsx | 0 test/next-koa/pages/about.tsx | 0 test/next-koa/pages/api/hello.ts | 0 test/next-koa/pages/index.tsx | 0 test/next-koa/pages/redirect.tsx | 0 test/next-koa/server/index.ts | 11 ++++++++++- test/next-koa/server/register.js | 4 ++++ test/next-koa/test/index.test.tsx | 0 test/next-koa/tsconfig.json | 0 test/next-test-utils.ts | 0 test/next-webdriver.ts | 0 test/tsconfig.json | 0 tsconfig.json | 0 tslint.json | 0 55 files changed, 24 insertions(+), 4 deletions(-) mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 app.d.ts mode change 100644 => 100755 app.js mode change 100644 => 100755 config.d.ts mode change 100644 => 100755 config.js mode change 100644 => 100755 deferred.d.ts mode change 100644 => 100755 deferred.js create mode 100644 example/index.js mode change 100644 => 100755 getstate.d.ts mode change 100644 => 100755 getstate.js mode change 100644 => 100755 jest.config.js mode change 100644 => 100755 layout.d.ts mode change 100644 => 100755 layout.js mode change 100644 => 100755 package.json mode change 100644 => 100755 plugin.js mode change 100644 => 100755 redirect.d.ts mode change 100644 => 100755 redirect.js mode change 100644 => 100755 src/client/.babelrc mode change 100644 => 100755 src/client/config.ts mode change 100644 => 100755 src/client/deferred.ts mode change 100644 => 100755 src/client/delegates.d.ts mode change 100644 => 100755 src/client/getstate.ts mode change 100644 => 100755 src/client/layout.tsx mode change 100644 => 100755 src/client/redirect.ts mode change 100644 => 100755 src/pages/.babelrc mode change 100644 => 100755 src/pages/app.tsx mode change 100644 => 100755 src/server/.babelrc mode change 100644 => 100755 src/server/index.ts mode change 100644 => 100755 test/jest-environment.js mode change 100644 => 100755 test/jest-global-setup.js mode change 100644 => 100755 test/jest-global-teardown.js mode change 100644 => 100755 test/jest.babelconfig.js mode change 100644 => 100755 test/jest.setup.js mode change 100644 => 100755 test/next-koa-test-utils.ts mode change 100644 => 100755 test/next-koa/.babelrc mode change 100644 => 100755 test/next-koa/layout/ItalicLayout.tsx mode change 100644 => 100755 test/next-koa/layout/Layout.tsx mode change 100644 => 100755 test/next-koa/layout/LayoutModel.ts mode change 100644 => 100755 test/next-koa/next-env.d.ts mode change 100644 => 100755 test/next-koa/next.config.js mode change 100644 => 100755 test/next-koa/pages/_app.tsx mode change 100644 => 100755 test/next-koa/pages/about.tsx mode change 100644 => 100755 test/next-koa/pages/api/hello.ts mode change 100644 => 100755 test/next-koa/pages/index.tsx mode change 100644 => 100755 test/next-koa/pages/redirect.tsx mode change 100644 => 100755 test/next-koa/server/index.ts create mode 100644 test/next-koa/server/register.js mode change 100644 => 100755 test/next-koa/test/index.test.tsx mode change 100644 => 100755 test/next-koa/tsconfig.json mode change 100644 => 100755 test/next-test-utils.ts mode change 100644 => 100755 test/next-webdriver.ts mode change 100644 => 100755 test/tsconfig.json mode change 100644 => 100755 tsconfig.json mode change 100644 => 100755 tslint.json diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/app.d.ts b/app.d.ts old mode 100644 new mode 100755 diff --git a/app.js b/app.js old mode 100644 new mode 100755 diff --git a/config.d.ts b/config.d.ts old mode 100644 new mode 100755 diff --git a/config.js b/config.js old mode 100644 new mode 100755 diff --git a/deferred.d.ts b/deferred.d.ts old mode 100644 new mode 100755 diff --git a/deferred.js b/deferred.js old mode 100644 new mode 100755 diff --git a/example/index.js b/example/index.js new file mode 100644 index 0000000..8a2f478 --- /dev/null +++ b/example/index.js @@ -0,0 +1,2 @@ +var child_process = require('child_process') +child_process.exec('npm run dev') \ No newline at end of file diff --git a/getstate.d.ts b/getstate.d.ts old mode 100644 new mode 100755 diff --git a/getstate.js b/getstate.js old mode 100644 new mode 100755 diff --git a/jest.config.js b/jest.config.js old mode 100644 new mode 100755 diff --git a/layout.d.ts b/layout.d.ts old mode 100644 new mode 100755 diff --git a/layout.js b/layout.js old mode 100644 new mode 100755 diff --git a/package.json b/package.json old mode 100644 new mode 100755 index 6ef787e..e6a2df0 --- a/package.json +++ b/package.json @@ -1,10 +1,11 @@ { "name": "next-koa", - "version": "2.0.3", + "version": "2.1.0", "description": "A koa middleware and some tools for next.js", "main": "dist/server/index.js", "types": "dist/server/index.d.ts", "scripts": { + "dev": "node -r ./test/next-koa/server/register ./node_modules/.bin/micro-dev ./test/next-koa/server/index.ts -p 8008 --silent --watch ./test/next-koa/server", "test": "HEADLESS=true jest", "type-check": "tsc --noEmit", "type-check:watch": "npm run type-check -- --watch", @@ -45,6 +46,10 @@ "layout.js" ], "devDependencies": { + "@babel/runtime-corejs2": "^7.8.7", + "micro": "^9.3.4", + "micro-dev": "^3.0.0", + "@babel/register": "^7.8.6", "@babel/cli": "^7.8.4", "@babel/core": "^7.8.6", "@babel/plugin-proposal-class-properties": "^7.8.3", @@ -91,13 +96,13 @@ }, "dependencies": { "delegates": "^1.0.0", - "next-transpile-modules": "^3.0.2" + "next-transpile-modules": "4.1.0" }, "engines": { "node": ">= 8.0.0" }, "peerDependencies": { "koa": "^2.11.0", - "next": "^9.2.2" + "next": "9.5.2" } } diff --git a/plugin.js b/plugin.js old mode 100644 new mode 100755 diff --git a/redirect.d.ts b/redirect.d.ts old mode 100644 new mode 100755 diff --git a/redirect.js b/redirect.js old mode 100644 new mode 100755 diff --git a/src/client/.babelrc b/src/client/.babelrc old mode 100644 new mode 100755 diff --git a/src/client/config.ts b/src/client/config.ts old mode 100644 new mode 100755 diff --git a/src/client/deferred.ts b/src/client/deferred.ts old mode 100644 new mode 100755 diff --git a/src/client/delegates.d.ts b/src/client/delegates.d.ts old mode 100644 new mode 100755 diff --git a/src/client/getstate.ts b/src/client/getstate.ts old mode 100644 new mode 100755 diff --git a/src/client/layout.tsx b/src/client/layout.tsx old mode 100644 new mode 100755 diff --git a/src/client/redirect.ts b/src/client/redirect.ts old mode 100644 new mode 100755 diff --git a/src/pages/.babelrc b/src/pages/.babelrc old mode 100644 new mode 100755 diff --git a/src/pages/app.tsx b/src/pages/app.tsx old mode 100644 new mode 100755 diff --git a/src/server/.babelrc b/src/server/.babelrc old mode 100644 new mode 100755 diff --git a/src/server/index.ts b/src/server/index.ts old mode 100644 new mode 100755 diff --git a/test/jest-environment.js b/test/jest-environment.js old mode 100644 new mode 100755 diff --git a/test/jest-global-setup.js b/test/jest-global-setup.js old mode 100644 new mode 100755 diff --git a/test/jest-global-teardown.js b/test/jest-global-teardown.js old mode 100644 new mode 100755 diff --git a/test/jest.babelconfig.js b/test/jest.babelconfig.js old mode 100644 new mode 100755 diff --git a/test/jest.setup.js b/test/jest.setup.js old mode 100644 new mode 100755 diff --git a/test/next-koa-test-utils.ts b/test/next-koa-test-utils.ts old mode 100644 new mode 100755 diff --git a/test/next-koa/.babelrc b/test/next-koa/.babelrc old mode 100644 new mode 100755 diff --git a/test/next-koa/layout/ItalicLayout.tsx b/test/next-koa/layout/ItalicLayout.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/layout/Layout.tsx b/test/next-koa/layout/Layout.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/layout/LayoutModel.ts b/test/next-koa/layout/LayoutModel.ts old mode 100644 new mode 100755 diff --git a/test/next-koa/next-env.d.ts b/test/next-koa/next-env.d.ts old mode 100644 new mode 100755 diff --git a/test/next-koa/next.config.js b/test/next-koa/next.config.js old mode 100644 new mode 100755 diff --git a/test/next-koa/pages/_app.tsx b/test/next-koa/pages/_app.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/pages/about.tsx b/test/next-koa/pages/about.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/pages/api/hello.ts b/test/next-koa/pages/api/hello.ts old mode 100644 new mode 100755 diff --git a/test/next-koa/pages/index.tsx b/test/next-koa/pages/index.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/pages/redirect.tsx b/test/next-koa/pages/redirect.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/server/index.ts b/test/next-koa/server/index.ts old mode 100644 new mode 100755 index 1381c78..f26577f --- a/test/next-koa/server/index.ts +++ b/test/next-koa/server/index.ts @@ -4,6 +4,8 @@ import http from 'http' import path from 'path' import Router from 'koa2-router' +import { IncomingMessage, ServerResponse } from 'http' + const dir = path.resolve(__dirname, '..') const app = new Koa() @@ -29,4 +31,11 @@ const server = http.createServer(app.callback()) const port = process.env.PORT || 3000 server.listen(process.env.PORT || 3000, () => { console.info('server is ready on port', port) -}) \ No newline at end of file +}) + + +const callback = app.callback() + +export default async (req: IncomingMessage, res: ServerResponse) => { + callback(req, res) +} \ No newline at end of file diff --git a/test/next-koa/server/register.js b/test/next-koa/server/register.js new file mode 100644 index 0000000..7ecb465 --- /dev/null +++ b/test/next-koa/server/register.js @@ -0,0 +1,4 @@ +require('@babel/register')({ + extensions: ['.ts', '.tsx'], + sourceMaps: true, +}) diff --git a/test/next-koa/test/index.test.tsx b/test/next-koa/test/index.test.tsx old mode 100644 new mode 100755 diff --git a/test/next-koa/tsconfig.json b/test/next-koa/tsconfig.json old mode 100644 new mode 100755 diff --git a/test/next-test-utils.ts b/test/next-test-utils.ts old mode 100644 new mode 100755 diff --git a/test/next-webdriver.ts b/test/next-webdriver.ts old mode 100644 new mode 100755 diff --git a/test/tsconfig.json b/test/tsconfig.json old mode 100644 new mode 100755 diff --git a/tsconfig.json b/tsconfig.json old mode 100644 new mode 100755 diff --git a/tslint.json b/tslint.json old mode 100644 new mode 100755