How to use the @frctl/fractal.Fractal.isFractal function in @frctl/fractal

To help you get started, we’ve selected a few @frctl/fractal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frctl / fractal / packages / server / src / api-server.js View on Github external
constructor(fractal, opts = {}) {
    if (!Fractal.isFractal(fractal)) {
      throw new TypeError(`Server.constructor - first argument must be an instance of Fractal [fractal-missing]`);
    }

    super(opts);

    const componentOpts = opts.components || {};
    const router = new Router(opts.api);

    router.use(async (ctx, next) => {
      ctx.fractal = fractal;
      try {
        const {components, files} = await fractal.parse();
        ctx.files = files;
        ctx.components = componentOpts.filter ? components.filter(componentOpts.filter) : components;
      } catch (err) {
        ctx.throw(500, err);

@frctl/fractal

A tool to help you build and document website component libraries and then integrate them into your projects.

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis

Similar packages