Comments (4)
just following up, what are the benefits/costs of an approach like this https://github.com/devongovett/dprint-node @dsherret ?
Thanks
from dprint-plugin-prettier.
Sorry, I have just been making some foundational changes to this plugin and didn't want to add support when it would all be changing. It should be fairly trivial to add this now (hopefully), by updating this folder: https://github.com/dprint/dprint-plugin-prettier/tree/main/js/node
just following up, what are the benefits/costs of an approach like this https://github.com/devongovett/dprint-node
That's a node API version of dprint-plugin-typescript only. I wouldn't recommend using it as it seems out of date. If you need an API in Node instead you can use https://github.com/dprint/js-formatter#nodejs which supports using any version of a dprint wasm plugin and the plugins are kept up to date on npm.
This dprint-plugin-prettier though is only for the dprint CLI and it formats code using Prettier and is much faster than Prettier's CLI (especially with incremental formatting enabled).
from dprint-plugin-prettier.
Sorry, I have just been making some foundational changes to this plugin and didn't want to add support when it would all be changing. It should be fairly trivial to add this now (hopefully), by updating this folder: https://github.com/dprint/dprint-plugin-prettier/tree/main/js/node
just following up, what are the benefits/costs of an approach like this devongovett/dprint-node
That's a node API version of dprint-plugin-typescript only. I wouldn't recommend using it as it seems out of date. If you need an API in Node instead you can use dprint/js-formatter#nodejs which supports using any version of a dprint wasm plugin and the plugins are kept up to date on npm.
This dprint-plugin-prettier though is only for the dprint CLI and it formats code using Prettier and is much faster than Prettier's CLI (especially with incremental formatting enabled).
thank you for the response and for the consideration of potential changes, good to know! Will circle back around this weekend and get back to you, thanks!
from dprint-plugin-prettier.
I looked into this a bit today and gave up after a while. Basically solidity-parser/parser needs to be made to work in a Browser, but right now it uses the "assert" package and "util" node package. I worked around those by patching the package, but then I got this:
error: Uncaught ReferenceError: __dirname is not defined
module2.exports = require_fs().readFileSync(require_path().join(__dirname, "./antlr/Solidity.tokens")).toString();
...and gave up at that point. Probably it could be fixed by manually inlining that file when patching the package, but it's too much work for me. If someone wants to take this on by either patching the package to make it work in this repo (using https://www.npmjs.com/package/patch-package... essentially change this directory https://github.com/dprint/dprint-plugin-prettier/tree/main/js/node then run deno task build
and ensure deno task test
works after adding a test for solidity in https://github.com/dprint/dprint-plugin-prettier/blob/main/js/startup.test.ts) or by ideally updating solidity-parser/parser to work in the browser that would be helpful.
from dprint-plugin-prettier.
Related Issues (20)
- Bug: Doesn't work "overrides" property for vue HOT 2
- Plugin URLs are throwing 404 errors
- Plugin: `prettier-plugin-tailwindcss` HOT 7
- Does dprint-plugin-prettier respect `.prettierrc.json`?
- 404 for plugin HOT 1
- Rewrite to run in Node.js and ability to specify any plugin HOT 1
- file extension specific configuration
- Plugin: prettier-stylelint
- Plugin: @ianvs/prettier-plugin-sort-imports
- New plugin system
- The upgrade path of dprint-plugin-prettier from 0.26.6 to 0.27.0 requires both dprint 0.39.1 and 0.40.0 HOT 3
- Add prettier/plugin-xml as a default plugin
- Document precedence in the README HOT 1
- Parse Error on Astro File HOT 2
- Unsupported CPU architecture: x86_64 (linux-musl) HOT 1
- Fatal JavaScript out of memory: Ineffective mark-compacts near heap limit
- Add mac aarch64 build HOT 2
- Add aarch64-unknown-linux-musl build
- prettier-plugin-svelte is not latest HOT 2
- dprint fails to add the plugin to cache on nixos HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dprint-plugin-prettier.