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