Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/magento/directive-parser
Parses Magento PWA Studio directives
https://github.com/magento/directive-parser
Last synced: 5 days ago
JSON representation
Parses Magento PWA Studio directives
- Host: GitHub
- URL: https://github.com/magento/directive-parser
- Owner: magento
- License: osl-3.0
- Created: 2018-01-16T18:56:59.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-19T19:13:55.000Z (about 3 years ago)
- Last Synced: 2024-04-24T15:19:33.084Z (7 months ago)
- Language: JavaScript
- Size: 350 KB
- Stars: 3
- Watchers: 9
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PWA Studio Directive Parser
![Node.js CI](https://github.com/magento/directive-parser/workflows/Node.js%20CI/badge.svg)
A _Directive_ in Magento PWA Studio is an inline comment within a source file that signals additional metadata that should be processed by the PWA Studio tooling.
If you're a user of Magento PWA Studio, it's unlikely you're looking to depend on this package directly. The primary use-case for this library is to be consumed by other PWA Studio tools.
## Goals
The primary goals of this project are:
* Parse all JavaScript comments within a source file, and return descriptors for every comment that conforms to the Magento Directive syntax
* Run significantly faster than a parser that parses the entire ECMAScript grammar
* Provide actionable warnings/errors with location info## Install
```sh
npm install @magento/directive-parser
```## Usage
```js
const parseDirectives = require('@magento/directive-parser');
const { directives, errors } = parseDirectives(someSourceFileString);
```## Example Directive (Kitchen Sink)
```js
/**
* @RootComponent
* pageTypes = some_page, some_other_page
* description = "Some description here"
*/
```