MCPcopy Index your code
hub / github.com/developit/preact-cli-plugin-async

github.com/developit/preact-cli-plugin-async @2.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.0.0 ↗ · + Follow
6 symbols 9 edges 3 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

preact-cli-plugin-async

npm travis greenkeeper

Preact CLI plugin that adds optimized support for async/await via fast-async.

Note: this is now just a copy of preact-cli-plugin-fast-async by @plusCubed.

Why do I want this?

ormally, transpiling async/await produces a large amount of code and depends on a runtime like regenerator-runtime. While that is optimal from a compatibility standpoint, it's not so great for bundle size. Using fast-async, this plugin transforms your async functions into Promises just like you would write by hand!

It transforms this:

async () => await (await fetch('/')).text()

... to something that roughly looks like this:

function () {
    return Promise.resolve().then(function() {
        return fetch("/")
    }).then(function(e) {
        return e.text()
    })
}

Pretty great, right?

Installation

npm i -D preact-cli-plugin-async

... then include it in your project by creating a preact.config.js:

import asyncPlugin from 'preact-cli-plugin-async';

export default (config) => {
    asyncPlugin(config);
}

License

MIT
Original version © developit
Current fast-async version © Daniel Ciao

Core symbols most depended-on inside this repo

asyncPlugin
called by 1
async-plugin.js
update
called by 1
test/index.js
componentDidMount
called by 0
test/index.js
render
called by 0
test/index.js

Shape

Method 3
Class 2
Function 1

Languages

TypeScript100%

Modules by API surface

test/index.js5 symbols
async-plugin.js1 symbols

For agents

$ claude mcp add preact-cli-plugin-async \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact