Code Monkey home page Code Monkey logo

fly's People

Contributors

dependabot[bot] avatar hfcorriez avatar llleonzhao avatar rrcgat avatar tensor1014 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fly's Issues

支持延迟加载

目的

  • 控制加载的目录和位置
  • 加快运行速度
  • 减少内存占用(不加载全部)

方案

1、开启和定义

需要在fly.yml声明fly文件的位置和开启lazyload

lazyload: true
path: 
  - functions/**.js
  - bss/**.js
ignore: 
  - functions/lib/**

2、编译缓存文件

  • 存储位置 TMP/flycache/<md5 project dir>/cache.js
  • 调用命令 fly compile
  • 编译过程
    1. 遍历所有的fly文件
    2. 和内存加载的如上位置compiled cache做对比,如果md5sum变更则加载文件读取配置
    3. 存储新的md5sumpathconfig
// compiled cache 示例文件
module.exports = {
   functionName: {
     md5sum: "",
     path: "",
     config: {
       http: {
         method: "POST",
         path: "/functions"
       }
     }
  }
}

3、启动过程

  1. 启动进程调用编译过程,等待完成
  2. 运行
  3. 如果监听到变更,重写 compie cache(开发环境)

代码设计

class FlyCache {
  // 加载指定目录的 compied cache,没有就创建空的
   init() {
  }

  // 获取所有的 cache 
  get ()
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.