babel-plugin-glsl
Advanced tools
Comparing version 0.0.1-alpha.2 to 0.0.1
@@ -1,3 +0,1 @@ | ||
/* eslint-disable no-redeclare */ | ||
/** | ||
@@ -4,0 +2,0 @@ * Mostly taken from https://github.com/glslify/glslify-bundle |
@@ -14,6 +14,6 @@ function resolveImport(identifier, declaration) { | ||
if (declaration.type === 'VariableDeclaration') { | ||
var children = declaration.declarations; | ||
for (var i = 0; i < children.length; ++i) { | ||
const children = declaration.declarations; | ||
for (let i = 0; i < children.length; ++i) { | ||
if (children[i].id === identifier) { | ||
var rhs = children[i].init; | ||
const rhs = children[i].init; | ||
if ( | ||
@@ -37,3 +37,3 @@ rhs && | ||
function resolveModule(path, name) { | ||
var binding = path.scope.getBinding(name); | ||
const binding = path.scope.getBinding(name); | ||
if (!binding) { | ||
@@ -84,11 +84,15 @@ return ''; | ||
case 'Identifier': | ||
// TODO: handle other constants here | ||
const binding = path.scope.getBinding(expression.name); | ||
if (!binding) { | ||
if (expression.name === '__dirname') { | ||
return env.cwd; | ||
if (binding) { | ||
const initPath = binding.path.get('init'); | ||
if (initPath.node) { | ||
return evalConstant(env, initPath, initPath.node); | ||
} | ||
} else if (expression.name === '__dirname') { | ||
return env.cwd; | ||
} | ||
throw new Error( | ||
`glslify-babel: cannot resolve glslify(), unknown reference "${ | ||
`glslify-babel: cannot resolve glslify() call, unknown or non-initialized identifier "${ | ||
expression.name | ||
@@ -95,0 +99,0 @@ }"` |
{ | ||
"name": "babel-plugin-glsl", | ||
"description": "Process GLSL code with glslify", | ||
"version": "0.0.1-alpha.2", | ||
"version": "0.0.1", | ||
"author": "Onno Visser <visser.onno@gmail.com>", | ||
@@ -27,3 +27,3 @@ "bugs": { | ||
"index.js", | ||
"lib/*" | ||
"lib" | ||
], | ||
@@ -30,0 +30,0 @@ "homepage": "https://github.com/onnovisser/babel-plugin-glsl#readme", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16194
456