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(runtime): refactor function engine #1590

Merged
merged 4 commits into from
Oct 20, 2023
Merged

Conversation

skyoct
Copy link
Contributor

@skyoct skyoct commented Oct 15, 2023

  1. 支持导入模块缓存
  2. 将拦截和函数合并到一起执行, 兼容原拦截器写法 并且支持如下写法:
import cloud from '@lafjs/cloud'

export default async function (ctx: FunctionContext, next) {
  let res = null
  try {
    res = await next(ctx)
  } catch(e) {
    return {
      code: 400,
      message: e.message
    }
  }
  return {
    code: 200,
    data: res
  }
}

  1. 重新梳理代码逻辑,去除重复代码

@sweep-ai
Copy link

sweep-ai bot commented Oct 15, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@skyoct
Copy link
Contributor Author

skyoct commented Oct 19, 2023

@0fatal merge了一下main分支,本pr改动只有runtime

@skyoct skyoct requested a review from 0fatal October 19, 2023 13:31
@skyoct skyoct merged commit 811066b into labring:main Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants