包详细信息

@eggjs/utils

eggjs39kMIT4.4.1

Utils for all egg projects

egg, utils

自述文件

@eggjs/utils

NPM version CI Test coverage npm download Node.js Version PRs Welcome

Utils for all egg projects.

Installation

npm i @eggjs/utils

API

getPlugins(options)

  • {String} baseDir - the current directory of application
  • {String} framework - the directory of framework
  • {String} env - egg environment

getLoadUnits(options)

  • {String} baseDir - the current directory of application
  • {String} framework - the directory of framework
  • {String} env - egg environment

getConfig(options)

  • {String} baseDir - the current directory of application
  • {String} framework - the directory of framework
  • {String} env - egg environment

getFrameworkPath(options)

  • {String} baseDir - the current directory of application
  • {String} framework - the directory of framework

License

MIT

Contributors

Contributors

Made with contributors-img.

更新日志

Changelog

4.4.1 (2025-03-05)

Bug Fixes

4.4.0 (2025-03-04)

Features

  • enable ts support by process.env.EGG_TS_ENABLE = true (#43) (4908ffc)

4.3.0 (2025-02-21)

Features

  • detect typescript enable on env.VITEST === 'true' (#42) (12af5f9)

4.2.5 (2025-01-08)

Bug Fixes

  • compatible with old version egg-core package name (#38) (c8b5dcc)

4.2.4 (2025-01-03)

Bug Fixes

4.2.3 (2025-01-03)

Bug Fixes

  • support resolve from scoped package parent node_modules (#36) (7c9cc42)

4.2.2 (2024-12-30)

Bug Fixes

  • import resolve find in paths's node_modules (#35) (bd772af)

4.2.1 (2024-12-30)

Bug Fixes

  • import resolve support relative path (#34) (42afd2a)

4.2.0 (2024-12-29)

Features

4.1.6 (2024-12-28)

Bug Fixes

  • try to use index.* when package.json not exists (#32) (b4b2e0c)

4.1.5 (2024-12-27)

Bug Fixes

  • use importResolve to get framework path (#31) (7caad4d)

4.1.4 (2024-12-25)

Bug Fixes

  • try resolve by file no matter dir exists or not (#30) (4605e3a)

4.1.3 (2024-12-24)

Bug Fixes

  • debug dont print full import object (#29) (daa5edf)

4.1.2 (2024-12-24)

Bug Fixes

  • should try to use esm module first (#28) (88b08cf)

4.1.1 (2024-12-24)

Bug Fixes

  • try to read build dist file first (#27) (7a89153)

4.1.0 (2024-12-23)

Features

  • support import typescript files first at dev env (#26) (349c0c3)

4.0.3 (2024-12-17)

Bug Fixes

  • set default require.resolve paths to cwd (#25) (84e16ed)

4.0.2 (2024-06-17)

Bug Fixes

4.0.1 (2024-06-17)

Bug Fixes

4.0.0 (2024-06-17)

⚠ BREAKING CHANGES

  • drop Node.js < 18.19.0 support

https://github.com/eggjs/egg/issues/5257

Summary by CodeRabbit

  • New Features
  • Introduced new utility functions for resolving and importing modules with support for CommonJS and ESM formats.
  • Added new test fixtures for CommonJS and ESM modules to validate module import functionality.

  • Refactor

  • Updated import statements to include file extensions (.js) for consistency and compatibility.

    • Refactored code to use async/await for asynchronous operations.
    • Improved path handling in tests with helper functions.
  • Documentation

  • Updated package.json with new scripts, dependencies, and module management configurations.

  • Chores

  • Enhanced .gitignore to exclude .tshy* files and dist/ directory.

    • Modified GitHub Actions workflows for Node.js and release processes.
  • Tests

    • Added tests for new module import functions.
    • Updated existing tests to reflect new import paths and async changes.
  • Configuration

  • Updated tsconfig.json for stricter TypeScript settings and modern module resolution.

Features

  • support @eggjs/core next version (#21) (a37968c)

3.0.1 (2024-01-12)

Bug Fixes

  • scope package resolve logic in monorepo (#20) (f4a47b9)

3.0.0 (2023-05-29)

⚠ BREAKING CHANGES

  • drop Node.js 14 support

closes https://github.com/eggjs/egg-utils/issues/18

Features

2.5.0 (2023-04-26)

Features

  • getFrameworkPath support monorepo (#16) (47ffc89)

2.4.1 / 2018-08-07

fixes

  • [413d47b] - fix: not loading plugins config while getting configs (#12) (Khaidi Chu <i@2333.moe>)

2.4.0 / 2018-04-15

features

others

2.3.0 / 2017-10-26

others

2.2.0 / 2017-06-02

  • feat: check baseDir and framework (#7)
  • feat: add getPlugins and getLoadUnits (#6)

2.1.0 / 2017-03-02

  • feat: lookup framework from process.cwd() (#4)

2.0.0 / 2017-03-01

  • feat: move getFrameworkPath from egg-cluster (#2)
  • deps: only support node >= 6.0.0

1.1.0 / 2017-01-13

  • feat: support read framework from package.json (#1)

1.0.0 / 2016-06-20

  • init version