Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Dec 17, 2017
0 parents commit a3e6354
Show file tree
Hide file tree
Showing 6 changed files with 3,109 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/node_modules
15 changes: 15 additions & 0 deletions LightScriptAsset.js
@@ -0,0 +1,15 @@
const JSAsset = require('parcel-bundler/src/assets/JSAsset')
const babylon = require('babylon-lightscript')

module.exports = class LightScriptAsset extends JSAsset {
async parse (code) {
const options = await super.getParserOptions()
options.plugins = options.plugins
? options.plugins.concat('lightscript')
: ['lightscript']

this.contents = babylon.parse(code, options);

return super.parse(this.contents)
}
}
13 changes: 13 additions & 0 deletions README.md
@@ -0,0 +1,13 @@
# parcel plugin lightscript

an example parcel plugin for loading lightscript


## usage

```
$ yarn add parcel-plugin-lightscript babel-plugin-lightscript
```

then import an `lsc` file, or `<script src=` it in your index.html
4 changes: 4 additions & 0 deletions index.js
@@ -0,0 +1,4 @@
module.exports = parcel => {
parcel.addAssetType('lsc', require.resolve('./LightScriptAsset'))
parcel.addAssetType('lsx', require.resolve('./LightScriptAsset'))
}
10 changes: 10 additions & 0 deletions package.json
@@ -0,0 +1,10 @@
{
"name": "parcel-plugin-lightscript",
"version": "0.0.5",
"main": "index.js",
"license": "MIT",
"dependencies": {
"babylon-lightscript": "^0.5.9",
"parcel-bundler": "^1.2.0"
}
}

0 comments on commit a3e6354

Please sign in to comment.