Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0b59fe2
chore(ci): migrate from pnpm to utoo for dependency management
elrrrrrrr Mar 27, 2026
00b55ad
fix(ci): add unplugin-unused to root devDependencies
elrrrrrrr Mar 27, 2026
32be090
fix(build): force publint to use npm pack instead of pnpm
elrrrrrrr Mar 27, 2026
283568a
chore(ci): migrate e2e-test workflow to utoo
elrrrrrrr Mar 27, 2026
e37062b
fix(ci): replace npm pack --workspaces with pack-all.mjs script
elrrrrrrr Mar 27, 2026
6b2ea6f
fix(e2e): restore execSync import broken by formatter in pack-all.mjs
elrrrrrrr Mar 27, 2026
df1fc6c
fix(e2e): replace npm install/run with ut in e2e test commands
elrrrrrrr Mar 27, 2026
876674a
fix(e2e): resolve catalog: and workspace: in pack-all.mjs before npm …
elrrrrrrr Mar 27, 2026
5badc83
fix(e2e): apply publishConfig overrides in pack-all.mjs before npm pack
elrrrrrrr Mar 27, 2026
96c103d
fix(utils): resolve modules from caller paths instead of package context
elrrrrrrr Mar 30, 2026
d42ce3e
fix(e2e): resolve named pnpm catalogs (e.g. catalog:path-to-regexp1) …
elrrrrrrr Mar 30, 2026
8a5316e
fix(router,ajv-decorator): fix unused Application interface and updat…
elrrrrrrr Mar 30, 2026
d30c8bd
fix(ajv-decorator): update snapshot for typebox new exports
elrrrrrrr Mar 30, 2026
fb25221
fix(router,ajv-decorator): complete Application rename and upgrade ty…
elrrrrrrr Mar 30, 2026
3ab3cc5
fix(ci): export Application interface in tegg types and bump oxlint c…
elrrrrrrr Mar 30, 2026
6c2b11c
fix(ci): pin utoo to v1.0.20 to avoid libssl.so.1.1 regression in v1.…
elrrrrrrr Mar 30, 2026
c3c2a97
fix(ci): resolve three ut-install compatibility issues
elrrrrrrr Mar 30, 2026
90fc55c
fix(utils): fall back to require.resolve before import.meta.resolve o…
elrrrrrrr Mar 30, 2026
60812d9
fix(ci): set NO_COLOR=1 for test job to prevent ANSI codes in child o…
elrrrrrrr Mar 30, 2026
8a92dab
fix(ci): override FORCE_COLOR=0 in cluster forks when NO_COLOR is set
elrrrrrrr Mar 30, 2026
1a24231
fix(ci): fix type error in cluster opt and restructure ORM test
elrrrrrrr Mar 31, 2026
fc20ad1
fix(ci): revert opt type to object and use cast for env access
elrrrrrrr Mar 31, 2026
30d4a8c
fix(test): use beforeEach in ORM raw query tests to survive afterEach…
elrrrrrrr Mar 31, 2026
d26ebab
fix(test): skip multi db ORM tests that lack required table setup
elrrrrrrr Mar 31, 2026
a2b2436
fix(test): update ajv exports snapshot for newer @sinclair/typebox
elrrrrrrr Mar 31, 2026
f6e542e
fix(test): update remaining ajv snapshot diffs
elrrrrrrr Mar 31, 2026
c6463c2
fix(ci): create workspace symlinks for deeply nested tegg packages
elrrrrrrr Mar 31, 2026
9ab28b5
fix(ci): force-recreate workspace symlinks instead of skipping existing
elrrrrrrr Mar 31, 2026
18ea907
fix(test): correct vitest alias paths to src/index.ts for tegg-vitest
elrrrrrrr Mar 31, 2026
17ab2d1
fix(test): resolve tsc via require.resolve instead of hardcoded node_…
elrrrrrrr Mar 31, 2026
3c37669
fix(test): strip FORCE_COLOR from coffee.fork env in logger tests
elrrrrrrr Mar 31, 2026
72eb5ed
fix(ci): skip workspace symlink step on Windows
elrrrrrrr Mar 31, 2026
88fb620
fix(ci): use npm install --force for cnpmcore E2E to bypass peer dep …
elrrrrrrr Mar 31, 2026
e6d942a
fix(ci): drop cnpmcore lint step from E2E test
elrrrrrrr Mar 31, 2026
19bf234
Merge branch 'next' into chore-ut-ci
elrrrrrrr Mar 31, 2026
f4291da
fix(ci): use latest utoo and revert ut-specific source workarounds
elrrrrrrr Mar 31, 2026
0dd9e54
chore: remove accidentally committed files
elrrrrrrr Mar 31, 2026
5b9d9b7
fix(ci): re-apply source fixes confirmed needed with latest utoo
elrrrrrrr Apr 1, 2026
1a5a1a7
fix(ci): revert FORCE_COLOR workarounds (fixed in utoo)
elrrrrrrr Apr 2, 2026
6be4676
chore: gitignore .utoo.toml and .claude/, remove from tracking
elrrrrrrr Apr 2, 2026
7886958
ci: trigger CI with latest utoo release
elrrrrrrr Apr 3, 2026
f844c90
ci: re-trigger CI
elrrrrrrr Apr 3, 2026
fadf12c
ci: trigger CI with latest utoo release
elrrrrrrr Apr 3, 2026
6d481eb
merge: resolve conflict with next branch
elrrrrrrr Apr 3, 2026
5ba7bdc
merge: sync with next (unlock-deps fixes)
elrrrrrrr Apr 7, 2026
a596f51
revert: drop source changes that are not required for ut migration
elrrrrrrr Apr 7, 2026
2382f65
revert: drop npm workspaces field from package.json
elrrrrrrr Apr 7, 2026
8bacbd9
fix: re-remove @ts-expect-error directives that are unused under ut
elrrrrrrr Apr 7, 2026
fd7cf6f
fix: use npm for publint pack to avoid pnpm not found in CI
elrrrrrrr Apr 7, 2026
949e572
fix(ci): pass explicit oxfmtrc path to fmtcheck
elrrrrrrr Apr 7, 2026
1590cda
debug: dump oxfmt diff in CI to investigate package.json format issue
elrrrrrrr Apr 7, 2026
3c85e50
fix(ci): restore package.json after ut install rewrites it
elrrrrrrr Apr 7, 2026
6edd728
fix(ci): revert explicit -c .oxfmtrc.json on fmtcheck
elrrrrrrr Apr 7, 2026
93776ec
fix: ignore root package.json in oxfmt instead of restoring after ut …
elrrrrrrr Apr 7, 2026
3c48bb2
chore(ci): remove temporary workspace symlink hack
elrrrrrrr Apr 7, 2026
86e33e5
test: revert packages/utils/src/import.ts to check if still needed
elrrrrrrr Apr 8, 2026
9eaba93
Revert "test: revert packages/utils/src/import.ts to check if still n…
elrrrrrrr Apr 8, 2026
e1f57cf
test: revert tsdown.config.ts pack: 'npm' to check if still needed
elrrrrrrr Apr 8, 2026
0be5b65
Revert "test: revert tsdown.config.ts pack: 'npm' to check if still n…
elrrrrrrr Apr 8, 2026
8c32970
test: revert cluster options.test.ts flat hoisting path
elrrrrrrr Apr 8, 2026
b59b3b6
revert(e2e): keep pnpm for E2E workflow
elrrrrrrr Apr 8, 2026
208dcc8
fix(utils): probe for file extension when ESM resolver omits it
elrrrrrrr Apr 8, 2026
53a1eae
chore: drop overrides from package.json (already in pnpm-workspace.yaml)
elrrrrrrr Apr 8, 2026
ce4a126
fix(utils): handle both Node 24 throw and Node 25 extensionless ESM b…
elrrrrrrr Apr 8, 2026
4feeba8
refactor(utils): use require.resolve for both CJS and ESM in importRe…
elrrrrrrr Apr 8, 2026
9e0b176
fix(utils): restore nodeMajorVersion (still used by isSupportTypeScript)
elrrrrrrr Apr 8, 2026
7f31d1e
Revert "test: revert cluster options.test.ts flat hoisting path"
elrrrrrrr Apr 8, 2026
6aaf7f2
test(utils): accept both 'package' and 'module' in not-found error me…
elrrrrrrr Apr 8, 2026
c9d25dc
test: revert import.ts to next version to compare cnpmcore E2E
elrrrrrrr Apr 8, 2026
cbd9b26
fix(utils): keep import.meta.resolve, add require.resolve fallback fo…
elrrrrrrr Apr 8, 2026
f170210
refactor(utils): drop unused fallbacks in importResolve
elrrrrrrr Apr 8, 2026
7c2e381
fix(utils): restore require.resolve fallback for Node 24 ESM throw
elrrrrrrr Apr 8, 2026
01a4caa
docs(utils): document Fallback 1 in importResolve
elrrrrrrr Apr 8, 2026
df26d4c
chore(ecosystem-ci): bump cnpmcore hash to v4.32.1 with EdgedriverBin…
elrrrrrrr Apr 8, 2026
1b13d61
fix(ci): scope `Test bin` build to @eggjs/bin only
elrrrrrrr Apr 8, 2026
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
47 changes: 24 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# CI workflow for egg monorepo
name: CI

on:
Expand Down Expand Up @@ -27,31 +28,31 @@ jobs:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6

- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- name: Setup utoo
uses: utooland/setup-utoo@3a51006d0b66afcc32d1b9177a4b200b74f4a8cb # main

- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: '24'

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: ut install --from pnpm

- name: Run lint
run: pnpm run lint
run: ut run lint

- name: Run typecheck
run: pnpm run typecheck
run: ut run typecheck

- name: Run format check
run: pnpm run fmtcheck
run: ut run fmtcheck

- name: Run build
run: pnpm run build
run: ut run build

- name: Run site build
run: pnpm run site:build
run: ut run site:build

test:
strategy:
Expand Down Expand Up @@ -150,24 +151,24 @@ jobs:
# & mysqladmin -u root password root
& mysql -uroot -e "CREATE DATABASE IF NOT EXISTS test;"

- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- name: Setup utoo
uses: utooland/setup-utoo@3a51006d0b66afcc32d1b9177a4b200b74f4a8cb # main

- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: ut install --from pnpm

- name: Run tests
run: pnpm run ci
run: ut run ci

- name: Run example tests
if: ${{ matrix.os != 'windows-latest' }}
run: |
pnpm run example:test:all
ut run example:test:all

- name: Code Coverage
# skip on windows, it will hangup on codecov
Expand All @@ -194,21 +195,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6

- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- name: Setup utoo
uses: utooland/setup-utoo@3a51006d0b66afcc32d1b9177a4b200b74f4a8cb # main

- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: ut install --from pnpm

- name: Run tests
run: |
pnpm build --workspace ./tools/egg-bin
pnpm run --filter ./tools/egg-bin ci
ut run build --workspace @eggjs/bin
ut run ci --workspace @eggjs/bin

- name: Code Coverage
# skip on windows, it will hangup on codecov https://github.com/codecov/codecov-action/issues/1787
Expand All @@ -235,21 +236,21 @@ jobs:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6

- name: Install pnpm
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4
- name: Setup utoo
uses: utooland/setup-utoo@3a51006d0b66afcc32d1b9177a4b200b74f4a8cb # main

- name: Set up Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
node-version: ${{ matrix.node }}

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: ut install --from pnpm

- name: Run tests
run: |
pnpm build
pnpm run --filter=./tools/scripts ci
ut run build
ut run ci --workspace tools/scripts

- name: Code Coverage
if: ${{ matrix.os != 'windows-latest' }}
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,5 @@ tegg/plugin/tegg/test/fixtures/apps/**/*.js
ecosystem-ci/cnpmcore
ecosystem-ci/examples
pnpm-lock.yaml
.utoo.toml
.claude/
3 changes: 2 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"packages/core/test/fixtures/load_dirs/syntax_error/*",
"packages/core/test/fixtures/syntaxerror/*",
"packages/core/test/fixtures/load_context_syntax_error/**/*",
"CHANGELOG.md"
"CHANGELOG.md",
"/package.json"
],
"experimentalSortImports": {
"groups": [
Expand Down
2 changes: 1 addition & 1 deletion ecosystem-ci/repo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cnpmcore": {
"repository": "https://github.com/cnpm/cnpmcore.git",
"branch": "master",
"hash": "e82df3f4093c0ec9fd5354563605e60f7f613035"
"hash": "98463c33188bbd32513a74e6c3a2c4cc559ef5da"
},
"examples": {
"repository": "https://github.com/eggjs/examples.git",
Expand Down
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,25 @@
],
"type": "module",
"scripts": {
"clean-dist": "pnpm -r --parallel exec rimraf dist",
"clean": "pnpm -r --parallel run clean && pnpm clean-dist",
"clean-dist": "ut run clean --workspaces",
"build": "tsdown",
"prelint": "pnpm clean-dist",
"prelint": "ut run clean-dist",
"lint": "oxlint --type-aware --type-check --quiet",
"fmt": "oxfmt",
"typecheck": "pnpm clean && pnpm -r run typecheck",
"typecheck": "ut run clean-dist && ut run typecheck --workspaces",
"fmtcheck": "oxfmt --check .",
"pretest": "pnpm run clean && pnpm -r run pretest",
"pretest": "ut run clean-dist && ut run pretest --workspaces --if-present",
"test": "vitest run --bail 1 --retry 2 --testTimeout 20000 --hookTimeout 20000",
"test:cov": "pnpm run test --coverage",
"preci": "pnpm -r --parallel run pretest",
"ci": "pnpm run test --coverage",
"site:dev": "pnpm --filter=site run dev",
"site:build": "pnpm --filter=site run build",
"test:cov": "ut run test -- --coverage",
"preci": "ut run pretest --workspaces --if-present",
"ci": "ut run test -- --coverage",
"site:dev": "ut run dev --workspace site",
"site:build": "ut run build --workspace site",
"puml": "puml . --dest ./site",
"example:dev:commonjs": "pnpm --filter=helloworld-commonjs run dev",
"example:dev:typescript": "pnpm --filter=helloworld-typescript run dev",
"example:dev:tegg": "pnpm --filter=helloworld-tegg run dev",
"example:test:all": "pnpm --filter=helloworld-* run test",
"example:dev:commonjs": "ut run dev --workspace helloworld-commonjs",
"example:dev:typescript": "ut run dev --workspace helloworld-typescript",
"example:dev:tegg": "ut run dev --workspace helloworld-tegg",
"example:test:all": "ut run test --workspace helloworld-typescript && ut run test --workspace helloworld-tegg",
"prepare": "husky",
"version:patch": "node scripts/version.js patch",
"version:minor": "node scripts/version.js minor",
Expand Down
6 changes: 4 additions & 2 deletions packages/cluster/test/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,12 @@ describe('test/options.test.ts', () => {
baseDir,
});
const expectPaths = [
// run int workspace root
// run in workspace root
path.join(__dirname, '../../egg'),
// run in project root
// run in project root (pnpm nested)
path.join(__dirname, '../node_modules/egg'),
// run with flat/hoisted node_modules (e.g. ut install)
path.join(__dirname, '../../../node_modules/egg'),
];
assert(
expectPaths.includes(options.framework),
Expand Down
5 changes: 4 additions & 1 deletion packages/tsconfig/test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import fs from 'node:fs/promises';
import { createRequire } from 'node:module';
import path from 'node:path';

import coffee from 'coffee';
import { test, expect } from 'vitest';

const require = createRequire(import.meta.url);

test('should tsc build work', async () => {
const tsc = path.join(import.meta.dirname, '..', 'node_modules', 'typescript', 'bin', 'tsc');
const tsc = require.resolve('typescript/bin/tsc');
const fixturePath = path.join(import.meta.dirname, 'fixtures/apps/ts-proj');
const tsconfigPath = path.join(fixturePath, 'tsconfig.json');
console.log('%s -p %s, cwd: %s', tsc, tsconfigPath, fixturePath);
Expand Down
41 changes: 40 additions & 1 deletion packages/utils/src/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,47 @@ export function importResolve(filepath: string, options?: ImportResolveOptions):
try {
moduleFilePath = import.meta.resolve(filepath);
} catch (err) {
// === Fallback 1: require.resolve for legacy CJS subpaths ===
//
// When `import.meta.resolve(filepath)` throws ERR_MODULE_NOT_FOUND,
// fall back to `require.resolve(filepath, { paths })` so callers
// can still resolve "legacy" CJS subpaths.
//
// This is reached for two combined reasons:
//
// 1. Node.js 22+ ESM resolver is strict about packages **without**
// an `exports` field: subpaths must include an explicit file
// extension (e.g. `tsconfig-paths/register.js`). Bare subpaths
// like `tsconfig-paths/register` cause the resolver to throw,
// because ESM does not auto-append `.js`/`.json`/`.node` the
// way the CJS resolver does.
//
// 2. The manual node_modules walk above (`tryToResolve...`)
// only checks `${p}/node_modules/<filepath>` plus two pnpm
// sibling levels — it does **not** walk up the directory
// tree the way Node's CJS resolver does. So a dependency
// hoisted to a workspace-root `node_modules/` (typical for
// pnpm/yarn workspaces) is not found by the manual walk and
// falls through to `import.meta.resolve`.
//
// `require.resolve(..., { paths })` handles both: it auto-appends
// extensions AND walks up the directory tree from each `paths`
// entry until it finds the package. Removing this fallback would
// be a breaking change for `@eggjs/utils` consumers (both internal
// — e.g. `tools/egg-bin/src/baseCommand.ts` resolving
// `tsconfig-paths/register` — and any downstream npm package that
// imports `importResolve`).
//
// If `require.resolve` also fails, throw the original ESM error
// so the user sees the ESM resolver's diagnostic, not the CJS one.
debug('[importResolve:error] import.meta.resolve %o => %o, options: %o', filepath, err, options);
throw new ImportResolveError(filepath, paths, err as Error);
try {
moduleFilePath = getRequire().resolve(filepath, { paths });
debug('[importResolve:requireResolveFallback] %o => %o', filepath, moduleFilePath);
return moduleFilePath;
} catch {
throw new ImportResolveError(filepath, paths, err as Error);
}
}
if (moduleFilePath.startsWith('file://')) {
// resolve will return file:// URL on Linux and MacOS expect on Windows
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/test/import.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ describe('test/import.test.ts', () => {
assert.equal(err.name, 'ImportResolveError');
assert.equal(err.filepath, 'tsconfig-paths-demo-not-exists/register');
assert.deepEqual(err.paths, [getFilepath('cjs/node_modules/inject')]);
assert.match(err.stack ?? '', /Cannot find package/);
assert.match(err.message, /Cannot find package/);
assert.match(err.stack ?? '', /Cannot find (package|module)/);
assert.match(err.message, /Cannot find (package|module)/);
return true;
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { isInitializeRequest, isJSONRPCRequest } from '@modelcontextprotocol/sdk
import type { JSONRPCMessage, MessageExtraInfo } from '@modelcontextprotocol/sdk/types.js';
// @ts-expect-error await-event is not typed
import awaitEvent from 'await-event';
// @ts-expect-error content-type is not typed
import contentType from 'content-type';
import type { Application, Context, Router } from 'egg';
import compose from 'koa-compose';
Expand Down
2 changes: 0 additions & 2 deletions tegg/plugin/mcp-proxy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/
import awaitEvent from 'await-event';
// @ts-expect-error cluster-client is not typed
import { APIClientBase } from 'cluster-client';
// @ts-expect-error content-type is not typed
import contentType from 'content-type';
import type { Application, Context } from 'egg';
import type { EggLogger } from 'egg';
import { EventSourceParserStream } from 'eventsource-parser/stream';
// @ts-expect-error koa-compose is not typed
import compose from 'koa-compose';
import getRawBody from 'raw-body';

Expand Down
4 changes: 2 additions & 2 deletions tools/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"scripts": {
"typecheck": "tsgo --noEmit",
"test": "vitest run --bail 1 --no-file-parallelism",
"cov": "pnpm test --coverage",
"ci": "pnpm run cov"
"cov": "ut run test -- --coverage",
"ci": "ut run cov"
},
"dependencies": {
"@eggjs/utils": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default defineConfig({
publint: {
level: 'suggestion',
strict: true,
pack: 'npm',
},

// Default entry pattern - glob to include all source files
Expand Down
Loading