6.3.8 • Published 1 year ago

@jiek/rollup-plugin-dts v6.3.8

Weekly downloads
-
License
LGPL-3.0-only
Repository
github
Last release
1 year ago

@jiek/rollup-plugin-dts

Forked from rollup-plugin-dts and added some features.

  • monorepo
  • sourcemap
  • keep import attributes
    • static
    • dynamic
    • type resolution-mode
  • jsdocExplorer
  • support bundle dependencies dts

jsdocExplorer

You can use jsdocExplorer to customize the output of the jsdoc comments.

const results = {};

export default {
  plugins: [
    dts({
      jsdocExplorer({ comment, tags, parent }, { ts, paths, output }) {
        const resolvedTags = tags.map((tag) => ({
          name: tag.tagName.escapedText,
          comment: typeof tag.comment === "string"
            ? tag.comment
            : tag.comment.map(n => {
              switch (true) {
                case ts.isJSDocLinkLike(n): {
                  /** @type {string} */
                  let type;
                  switch (true) {
                    case ts.isJSDocLinkCode(n): {
                      type = "code";
                      break;
                    }
                    case ts.isJSDocLinkPlain(n): {
                      type = "plain";
                      break;
                    }
                    default:
                      type = "like";
                  }
                  let text = n.name.escapedText;
                  if ("left" in n.name) {
                    text = n.name.left.escapedText;
                  }
                  if ("right" in n.name) {
                    text += ".";
                    text += n.name.right.escapedText;
                  }
                  text += n.text;
                  return {
                    type,
                    text,
                  };
                }
                default:
                  return n.text;
              }
            }),
        }));
        if (!results[output]) {
          results[output] = [];
        }
        results[output].push({
          comment,
          tags: resolvedTags,
          paths,
        });
      },
    }),
    {
      name: "write-results",
      generateBundle() {
        this.emitFile({
          type: "asset",
          fileName: "jsdoc.json",
          source: JSON.stringify(results, null, 2),
        });
        // or generate a markdown file
      },
    },
  ],
};
6.3.0

1 year ago

6.2.1

1 year ago

6.2.0

1 year ago

6.3.2

1 year ago

6.3.1

1 year ago

6.2.2

1 year ago

6.3.4

1 year ago

6.3.3

1 year ago

6.3.6

1 year ago

6.3.5

1 year ago

6.3.8

1 year ago

6.3.7

1 year ago

6.1.2

1 year ago

6.1.1

2 years ago