From a3e6354cdcd4a0417fa2860d9e9ffa0f1e635fb2 Mon Sep 17 00:00:00 2001 From: chee Date: Sun, 17 Dec 2017 21:22:02 +0000 Subject: [PATCH] Initial commit --- .gitignore | 1 + LightScriptAsset.js | 15 + README.md | 13 + index.js | 4 + package.json | 10 + yarn.lock | 3066 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 3109 insertions(+) create mode 100644 .gitignore create mode 100644 LightScriptAsset.js create mode 100644 README.md create mode 100644 index.js create mode 100644 package.json create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..07e6e47 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/node_modules diff --git a/LightScriptAsset.js b/LightScriptAsset.js new file mode 100644 index 0000000..21f4a02 --- /dev/null +++ b/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) + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..a0d9e55 --- /dev/null +++ b/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 `