diff --git a/README.md b/README.md index 4c63caa2..f4a2c961 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ The AST explorer provides following code parsers: - Graphviz: - [redot][] - Handlebars: + - [bigodon][] - [glimmer][] - [handlebars][] - [ember-template-recast][] @@ -137,6 +138,7 @@ are included so you can prototype your own plugins: [babel-eslint]: https://github.com/babel/babel-eslint [babel]: https://babeljs.io/docs/advanced/plugins/ [babylon]: https://babeljs.io/ +[bigodon]: https://github.com/gabriel-pinheiro/bigodon [cssom]: https://github.com/NV/CSSOM [csstree]: https://github.com/csstree/csstree [ember-template-recast]: https://github.com/ember-template-lint/ember-template-recast diff --git a/website/package.json b/website/package.json index 79c8bc2f..5d6b1a1e 100644 --- a/website/package.json +++ b/website/package.json @@ -76,6 +76,7 @@ "babylon5": "npm:babylon@^5", "babylon6": "npm:babylon@^6", "babylon7": "npm:@babel/parser@^7", + "bigodon": "^1.4.0", "cherow": "^1.6.8", "codemirror": "^5.22.0", "codemirror-graphql": "^0.11.6", diff --git a/website/src/parsers/handlebars/bigodon.js b/website/src/parsers/handlebars/bigodon.js new file mode 100644 index 00000000..cfc49299 --- /dev/null +++ b/website/src/parsers/handlebars/bigodon.js @@ -0,0 +1,25 @@ +import defaultParserInterface from './utils/defaultHandlebarsParserInterface'; +import pkg from 'bigodon/package.json'; + +const ID = 'bigodon'; + +export default { + ...defaultParserInterface, + + id: ID, + displayName: ID, + version: pkg.version, + homepage: pkg.homepage, + + loadParser(callback) { + require(['bigodon'], (bigodon) => callback(bigodon.parse)); + }, + + getOffset(position) { + return position; + }, + + opensByDefault(node, key) { + return key === 'params'; + }, +}; diff --git a/website/yarn.lock b/website/yarn.lock index a5d0747e..63bea618 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -3041,6 +3041,14 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== +bigodon@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/bigodon/-/bigodon-1.4.0.tgz#31ebe530970a9f49c8c74c738a14709ea93e771c" + integrity sha512-bDD4AyY0BjkiyONAr8TjbEOVHgGD52164nHsmeOV1s7t8ZSN2FbA1OWHIQa+q7kVcic3IY6SXfi91k1uHnc3qg== + dependencies: + pierrejs "^0.5.0" + uuid "^8.3.2" + binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -8460,6 +8468,11 @@ picomatch@^2.0.5, picomatch@^2.2.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== +pierrejs@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/pierrejs/-/pierrejs-0.5.0.tgz#9f0ffa8583227be6d9f48b338fbbc55f2fc39e6a" + integrity sha512-etm2ZMrdCZh61aks0qRDynlI/fKb9YFqLroHaBrdMvLXdhHUMzxlchndz2fOyDVsfAXwXJS8/zsaRHntg9wFsw== + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -11045,6 +11058,11 @@ utila@^0.4.0, utila@~0.4: resolved "https://registry.yarnpkg.com/utila/-/utila-0.4.0.tgz#8a16a05d445657a3aea5eecc5b12a4fa5379772c" integrity sha1-ihagXURWV6Oupe7MWxKk+lN5dyw= +uuid@^8.3.2: + version "8.3.2" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" + integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== + v8-compile-cache@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.3.tgz#00f7494d2ae2b688cfe2899df6ed2c54bef91dbe"