Skip to content

Micro 6.0.0

Compare
Choose a tag to compare
@rauchg rauchg released this 13 Aug 01:06
· 379 commits to main since this release

Micro 6.0.0 is the most exciting release yet! Smaller, faster and easier to use.

  • We no longer transpile import and export. The following examples are valid with Micro 6.0.0:
// lambda style
module.exports = () => 'Hello world'  

// req, res
module.exports = (req, res) => {
  res.end('Hello world');
}

// promises
const request = require('request-promise');
module.exports = () => request('https://google.com');

// async / await
const sleep = require('then-sleep');
module.exports = async () => {
  await sleep(500);
  return 'I waited 500ms with no callbacks!';
}
# listen on localhost:3000
$ micro index.js
  • We're ditching support for versions of Node older than 6.0.0. You can continue to use older versions of micro for Node 4 and 5.
  • We're ditching babel in favor of async-to-gen by @leebyron. You can continue to use your own transpilation workflows with babel if you want, and micro should handle them just fine! In fact, you could also run async-to-gen yourself, and micro won't need any special flags to run your code.
  • We no longer need to add the babel-runtime after transpilation, and async-to-gen's runtime is only 2 lines of extra code per file.
  • The runtime and CLI live in a single package micro again, since all our dependencies are now tiny and fast. No need for micro-cli and micro-core. Just micro.
  • The entire dependency tree for the framework is now drastically smaller:
└─┬ micro@6.0.0 
  ├─┬ async-to-gen@1.0.1 
  │ ├─┬ babylon@6.8.4 
  │ │ └─┬ babel-runtime@6.11.6 
  │ │   ├── core-js@2.4.1 
  │ │   └── regenerator-runtime@0.9.5 
  │ └─┬ magic-string@0.15.2 
  │   └── vlq@0.2.1 
  ├── isstream@0.1.2 
  ├── media-typer@0.3.0 
  ├── minimist@1.2.0 
  └─┬ raw-body@2.1.7 
    ├── bytes@2.4.0 
    ├── iconv-lite@0.4.13 
    └── unpipe@1.0.0 
  • It takes only 2 seconds to install with a fresh npm cache
/Users/rauchg
└── micro@6.0.0 
real    0m2.397s
user    0m1.669s
sys     0m0.244s