cem-plugin-async-function
TypeScript icon, indicating that this package has built-in type declarations

0.0.5 • Public • Published

cem-plugin-async-function

Adds (non-standard) "async" flag to functions and class methods

Example

custom-elements-manifest.config.js

import { asyncFunctionPlugin } from 'cem-plugin-async-function';

export default {
  plugins: [
    asyncFunctionPlugin(),
  ]
}

async-function.ts

/** @element async-method */
export class Async {
  async a() {}
}

export async function b() {}

Output

{
  "schemaVersion": "1.0.0",
  "readme": "",
  "modules": [
    {
      "kind": "javascript-module",
      "path": "async-function.js",
      "declarations": [
        {
          "kind": "class",
          "description": "",
          "name": "Async",
          "members": [
            {
              "kind": "method",
              "name": "a",
              "async": true
            }
          ],
          "tagName": "async-method",
          "customElement": true
        },
        {
          "kind": "function",
          "name": "b",
          "async": true
        }
      ],
      "exports": [
        {
          "kind": "js",
          "name": "Async",
          "declaration": {
            "name": "Async",
            "module": "async-function.js"
          }
        },
        {
          "kind": "js",
          "name": "b",
          "declaration": {
            "name": "b",
            "module": "async-function.js"
          }
        }
      ]
    }
  ]
}

Package Sidebar

Install

npm i cem-plugin-async-function

Weekly Downloads

147

Version

0.0.5

License

MIT

Unpacked Size

4.1 kB

Total Files

4

Last publish

Collaborators

  • bennyp