Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support nextjs in v4 #4141

Open
wants to merge 22 commits into
base: v4-next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ site/changelog
**/test/*.txt
.audit
packages/**/test/tmp
.swc
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@types/node": "20.16.10",
"@vercel/ncc": "0.38.2",
"autocannon": "7.15.0",
"fs-extra": "11.2.0",
"jest": "29.7.0",
"lerna": "8.1.2",
"lerna-changelog": "2.2.0",
Expand All @@ -20,8 +21,7 @@
"typedoc": "^0.26.8",
"typescript": "5.3.3",
"why-is-node-running": "2.3.0",
"zx": "7.2.3",
"fs-extra": "11.2.0"
"zx": "8.2.2"
},
"scripts": {
"install_npm": "sh scripts/install_npm.sh",
Expand Down
2 changes: 1 addition & 1 deletion packages-resource/midway-test-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
],
"license": "MIT",
"devDependencies": {
"@midwayjs/core": "^3.18.0"
"@midwayjs/core": "workspace:^"
}
}
2 changes: 1 addition & 1 deletion packages-resource/midway-test-inner-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
],
"license": "MIT",
"devDependencies": {
"@midwayjs/core": "^3.18.0"
"@midwayjs/core": "workspace:^"
}
}
6 changes: 3 additions & 3 deletions packages-serverless/midway-fc-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"main": "dist/index.js",
"typings": "index.d.ts",
"dependencies": {
"@midwayjs/async-hooks-context-manager": "^3.18.0",
"@midwayjs/faas": "^3.18.0",
"@midwayjs/async-hooks-context-manager": "workspace:^",
"@midwayjs/faas": "workspace:^",
"raw-body": "2.5.2"
},
"devDependencies": {
"@midwayjs/core": "^3.18.0"
"@midwayjs/core": "workspace:^"
},
"engines": {
"node": ">=12"
Expand Down
2 changes: 1 addition & 1 deletion packages/async-hooks-context-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"license": "MIT",
"devDependencies": {
"@midwayjs/core": "^3.18.0"
"@midwayjs/core": "workspace:^"
},
"author": "Harry Chen <czy88840616@gmail.com>",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"index.d.ts"
],
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/mock": "^3.18.0",
"@midwayjs/core": "workspace:^",
"@midwayjs/mock": "workspace:^",
"nock": "13.5.5"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
],
"license": "MIT",
"dependencies": {
"@midwayjs/async-hooks-context-manager": "^3.18.0",
"@midwayjs/async-hooks-context-manager": "workspace:^",
"@midwayjs/event-bus": "1.10.0"
},
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/core": "workspace:^",
"@midwayjs/logger": "^3.0.0",
"request": "2.88.2",
"socket.io-client": "4.7.5"
Expand Down
8 changes: 4 additions & 4 deletions packages/bull-board/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
],
"license": "MIT",
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/express": "^3.18.0",
"@midwayjs/koa": "^3.18.0",
"@midwayjs/mock": "^3.18.0"
"@midwayjs/core": "workspace:^",
"@midwayjs/express": "workspace:^",
"@midwayjs/koa": "workspace:^",
"@midwayjs/mock": "workspace:^"
},
"dependencies": {
"@bull-board/api": "5.21.5",
Expand Down
6 changes: 3 additions & 3 deletions packages/bull-board/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createApp, close, createHttpRequest, createLightApp } from '@midwayjs/mock';
import { createLegacyApp, close, createHttpRequest, createLightApp } from '@midwayjs/mock';
import { join } from 'path';
import * as bullboard from '../src';

describe(`/test/index.test.ts`, () => {
it('test ui in koa', async () => {
const app = await createApp(join(__dirname, 'fixtures', 'base-app-koa'));
const app = await createLegacyApp(join(__dirname, 'fixtures', 'base-app-koa'));

// page
let result = await createHttpRequest(app).get('/ui');
Expand All @@ -29,7 +29,7 @@ describe(`/test/index.test.ts`, () => {
});

it('test ui in express', async () => {
const app = await createApp(join(__dirname, 'fixtures', 'base-app-express'));
const app = await createLegacyApp(join(__dirname, 'fixtures', 'base-app-express'));

// page
let result = await createHttpRequest(app).get('/bull-board');
Expand Down
4 changes: 2 additions & 2 deletions packages/bull/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
],
"license": "MIT",
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/mock": "^3.18.0"
"@midwayjs/core": "workspace:^",
"@midwayjs/mock": "workspace:^"
},
"dependencies": {
"bull": "4.16.3"
Expand Down
12 changes: 6 additions & 6 deletions packages/bull/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createApp, close } from '@midwayjs/mock';
import { createLegacyApp, close } from '@midwayjs/mock';
import { join } from 'path';
import { sleep } from '@midwayjs/core';
import * as bull from '../src';
import { readFileSync } from 'fs';

describe(`/test/index.test.ts`, () => {
it('test auto repeat processor', async () => {
const app = await createApp(join(__dirname, 'fixtures', 'base-app'), {}, bull);
const app = await createLegacyApp(join(__dirname, 'fixtures', 'base-app'));

await sleep(5 * 1000);
let res = app.getAttr(`task`);
Expand All @@ -31,7 +31,7 @@ describe(`/test/index.test.ts`, () => {
});

it('test processor with redis', async () => {
const app = await createApp(join(__dirname, 'fixtures', 'base-app-redis'), {}, bull);
const app = await createLegacyApp(join(__dirname, 'fixtures', 'base-app-redis'));

await sleep(5 * 1000);

Expand All @@ -41,7 +41,7 @@ describe(`/test/index.test.ts`, () => {
});

it('should test throw error when create service', async () => {
const app = await createApp(join(__dirname, 'fixtures', 'base-app-error-out-of-job'), {}, bull);
const app = await createLegacyApp(join(__dirname, 'fixtures', 'base-app-error-out-of-job'));
await sleep(5 * 1000);
expect(readFileSync(join(__dirname, 'fixtures', 'base-app-error-out-of-job', 'logs', 'ali-demo', 'midway-bull.log'), 'utf8').includes('MidwayDefinitionNotFoundError')).toBeTruthy();
await close(app);
Expand All @@ -53,7 +53,7 @@ describe(`/test/index.test.ts`, () => {
// it('should throw error when start with duplicate task', async () => {
// let error;
// try {
// await createApp(
// await createLegacyApp(
// join(__dirname, 'fixtures', 'base-app-duplicate-task'),
// {},
// TaskModule
Expand All @@ -67,7 +67,7 @@ describe(`/test/index.test.ts`, () => {
// it('should throw error when start with duplicate local task', async () => {
// let error;
// try {
// await createApp(
// await createLegacyApp(
// join(__dirname, 'fixtures', 'base-app-duplicate-local-task'),
// {},
// TaskModule
Expand Down
14 changes: 7 additions & 7 deletions packages/busboy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
"file-type": "16.5.4"
},
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/express": "^3.18.0",
"@midwayjs/faas": "^3.18.0",
"@midwayjs/koa": "^3.18.0",
"@midwayjs/mock": "^3.18.0",
"@midwayjs/web": "^3.18.0",
"@midwayjs/fc-starter": "^3.18.0",
"@midwayjs/core": "workspace:^",
"@midwayjs/express": "workspace:^",
"@midwayjs/faas": "workspace:^",
"@midwayjs/koa": "workspace:^",
"@midwayjs/mock": "workspace:^",
"@midwayjs/web": "workspace:^",
"@midwayjs/fc-starter": "workspace:^",
"fs-extra": "11.2.0"
}
}
4 changes: 2 additions & 2 deletions packages/busboy/test/clean.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHttpRequest, close, createFunctionApp } from '@midwayjs/mock';
import { createHttpRequest, close, createLegacyFunctionApp } from '@midwayjs/mock';
import { join } from 'path';
import { existsSync, statSync } from 'fs';
import { sleep } from '@midwayjs/core';
Expand All @@ -9,7 +9,7 @@ describe('test/clean.test.ts', function () {
it('upload file auto clean', async () => {
const appDir = join(__dirname, 'fixtures/clean');
const imagePath = join(__dirname, 'fixtures/1.jpg');
const app = await createFunctionApp<Framework>(appDir, {});
const app = await createLegacyFunctionApp<Framework>(appDir, {});
const request = await createHttpRequest(app);
const stat = statSync(imagePath);
const response = await request.post('/upload')
Expand Down
6 changes: 3 additions & 3 deletions packages/busboy/test/express.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHttpRequest, close, createApp } from '@midwayjs/mock';
import { createHttpRequest, close, createLegacyApp } from '@midwayjs/mock';
import { join } from 'path';
import * as assert from 'assert';
import { statSync } from 'fs';
Expand All @@ -8,7 +8,7 @@ describe('test/express.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/express-stream');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('test/express.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/express-file');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/busboy/test/faas.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHttpRequest, close, createFunctionApp } from '@midwayjs/mock';
import { createHttpRequest, close, createLegacyFunctionApp } from '@midwayjs/mock';
import { join } from 'path';
import * as assert from 'assert';
import { existsSync, statSync } from 'fs';
Expand All @@ -8,7 +8,7 @@ describe('test/faas.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/faas');
app = await createFunctionApp<Framework>(appDir, {});
app = await createLegacyFunctionApp<Framework>(appDir, {});
})

afterAll(async () => {
Expand Down
12 changes: 6 additions & 6 deletions packages/busboy/test/koa.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHttpRequest, close, createApp, createLightApp } from "@midwayjs/mock";
import { createHttpRequest, close, createLegacyApp, createLightApp } from "@midwayjs/mock";
import { join } from 'path';
import { createWriteStream, existsSync, statSync } from "fs";
import * as koa from '@midwayjs/koa';
Expand All @@ -15,7 +15,7 @@ describe('test/koa.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/koa-stream');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('test/koa.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/koa-file');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down Expand Up @@ -127,7 +127,7 @@ describe('test/koa.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/koa-file-mime');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('test/koa.test.ts', function () {
describe('test null set', function () {
it('upload test ext set null', async () => {
const appDir = join(__dirname, 'fixtures/koa-ext-null');
const app = await createApp(appDir);
const app = await createLegacyApp(appDir);
const filePath = join(__dirname, 'fixtures/1.test');
const request = createHttpRequest(app);
await request.post('/upload')
Expand All @@ -195,7 +195,7 @@ describe('test/koa.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/koa-function-whitelist');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/busboy/test/web.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHttpRequest, close, createApp } from '@midwayjs/mock';
import { createHttpRequest, close, createLegacyApp } from '@midwayjs/mock';
import { join } from 'path';
import * as assert from 'assert';
import { statSync } from 'fs';
Expand All @@ -9,7 +9,7 @@ describe('test/web.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/web-stream');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down Expand Up @@ -49,7 +49,7 @@ describe('test/web.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/web-file');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/cache-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"node": ">=12"
},
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/mock": "^3.18.0",
"@midwayjs/redis": "^3.18.0",
"@midwayjs/core": "workspace:^",
"@midwayjs/mock": "workspace:^",
"@midwayjs/redis": "workspace:^",
"cache-manager": "6.0.0",
"cache-manager-ioredis-yet": "2.1.2"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/captcha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
},
"license": "MIT",
"dependencies": {
"@midwayjs/cache-manager": "^3.18.1",
"@midwayjs/cache-manager": "workspace:^",
"mini-svg-data-uri": "1.4.4",
"nanoid": "3.3.7",
"svg-captcha": "1.4.0"
},
"devDependencies": {
"@midwayjs/core": "^3.18.0",
"@midwayjs/koa": "^3.18.0",
"@midwayjs/mock": "^3.18.0"
"@midwayjs/core": "workspace:^",
"@midwayjs/koa": "workspace:^",
"@midwayjs/mock": "workspace:^"
}
}
4 changes: 2 additions & 2 deletions packages/captcha/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHttpRequest, close, createApp, createLightApp } from '@midwayjs/mock';
import { createHttpRequest, close, createLegacyApp, createLightApp } from '@midwayjs/mock';
import { join } from 'path';
import * as assert from 'assert';
import * as captcha from '../src';
Expand All @@ -8,7 +8,7 @@ describe('test/index.test.ts', function () {
let app;
beforeAll(async () => {
const appDir = join(__dirname, 'fixtures/koa');
app = await createApp(appDir);
app = await createLegacyApp(appDir);
});

afterAll(async () => {
Expand Down
Loading
Loading