brackets-cont / brackets

An open source code editor for the web, written in JavaScript, HTML and CSS.
http://brackets.io
Other
1.35k stars 177 forks source link

Feature request: Support npm in extensions #202

Open idleberg opened 2 years ago

idleberg commented 2 years ago

Among programming languages, JavaScript has the biggest eco-system in the world. Hence, Brackets would benefit from this if extensions could load packages from npm. Right now, developers need to build obscure build-pipelines or make use of workarounds to load "external" code.

abose commented 2 years ago

Hi @idleberg . Thanks for the feature request. We are already working on a new extension manager based on NPM. Ie, ability to publish and load extensions directly from npm.

But to gain more clarity, can you describe the workflow or provide more details of the feature you have in mind.

idleberg commented 2 years ago

Well, I see two ways to handle this:

  1. When a user installs a package, Brackets runs npm install --omit=dev to satisfy dependencies (this is how Atom does it)
  2. When a developer publishes or updates his extension, dependencies are included in the archive. I think this is how VSCode does it, but I wonder how that would work for Node packages with native bindings.

Either way, as a consequence an extension script could import modules as you would do in a standard NodeJS script. IIRC, Bracket exposes require that has no awareness of node_modules.