Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chee
committed
Dec 17, 2017
0 parents
commit a3e6354
Showing
6 changed files
with
3,109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = parcel => { | ||
parcel.addAssetType('lsc', require.resolve('./LightScriptAsset')) | ||
parcel.addAssetType('lsx', require.resolve('./LightScriptAsset')) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
Oops, something went wrong.