Permalink
Browse files

Merge pull request #22 from paulcuth/dev

v0.1.7
  • Loading branch information...
paulcuth committed Mar 27, 2016
2 parents 4c09ddb + efcef59 commit 49a19c47b34649edf99eaf06cb92fd33d1de15ad
Showing with 24 additions and 7 deletions.
  1. +1 −1 package.json
  2. +8 −1 src/DOMAPI/DOMAPI.js
  3. +5 −2 src/build-tools/grunt/package.json
  4. +10 −3 src/parser/index.js
View
@@ -1,7 +1,7 @@
{
"name": "starlight",
"description": "A Lua -> ES6 transpiler",
"version": "0.1.6",
"version": "0.1.7",
"author": {
"name": "Paul Cuthbertson"
},
View
@@ -153,7 +153,14 @@
var val, i;
for (i in window) {
if (i !== 'print' && i !== 'window' && win[i] !== null) {
val = _G.get('window').get(i);
try {
val = _G.get('window').get(i);
} catch(e) {
val = function () {
throw new starlight.runtime.LuaError('error accessing property: ' + e.message);
}
}
_G.set(i, typeof val == 'function' ? val.bind(void 0, window) : val);
}
}
@@ -33,5 +33,8 @@
},
"keywords": [
"gruntplugin"
]
}
],
"dependencies": {
"luaparse": "^0.2.0"
}
}
View
@@ -5,6 +5,12 @@ if (typeof global === undefined) {
global = window;
}
const SUPPORTED_MIME_TYPES = [
'text/lua',
'text/x-lua',
'application/lua',
'application/x-lua',
];
function parseToString (input) {
let ast = parser.parse(input);
@@ -26,9 +32,10 @@ function parse (input) {
}
function runScriptTags() {
var scripts = document.querySelectorAll('script[type="application/x-lua"]');
var script, i, modname, scriptBody;
var lua = '';
const selectors = SUPPORTED_MIME_TYPES.map(t => `script[type="${t}"]`);
const scripts = document.querySelectorAll(selectors.join());
let script, i, modname, scriptBody;
let lua = '';
for (i = 0; script = scripts[i]; i++) {
modname = script.dataset.modname;

0 comments on commit 49a19c4

Please sign in to comment.