Redocly / Redocly/redocly-cli

Load plugins in browser environment

Open
#826 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p2 Type: Enhancement
Dominant language
TypeScript
Stars
1.5k
Forks
228
Avg merge
1d 14h
Merged PRs (30d)
48

Description

Describe the bug

Currently plugins don't work in browser env.

To Reproduce
Steps to reproduce the behavior:

import { createConfig, makeDocumentFromString } from '@redocly/openapi-core';

const openapi = `
  openapi: "3.0.0"
  info:
    version: 1.0.0
    title: Swagger Petstore
`;

const document = makeDocumentFromString(openapi, '/some-path');

const config = await createConfig(`
  lint:
    plugins:
      - './local-plugin.js'
  extends:
    - recommended
`);

const problems = await lintDocument({
  document,
  config: config.styleguide,
});
  1. See error
    Cannot load ./local-plugin.js. Plugins aren't supported in browser yet.

Expected behavior

Plugin should be loaded and ran

Redocly Version(s)

v1.0.0-beta.108

Additional context

Browser

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the browser reproduction using createConfig, makeDocumentFromString, and lintDocument from @redocly/openapi-core, then trace the source of the "Plugins aren't supported in browser yet" error. Done means the shown local plugin configuration loads and runs in a browser environment without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.