* Returns true if an expression can be applied or false otherwise.
(expression)
| 256 | * Returns true if an expression can be applied or false otherwise. |
| 257 | */ |
| 258 | function isValid(expression) { |
| 259 | const expressionTemplate = babelTemplate( |
| 260 | expression.source, |
| 261 | sourceHelpers.BABYLON_REPLACE_VAR_OPTIONS); |
| 262 | |
| 263 | const dependencies = {}; |
| 264 | if (expression.dependencies) { |
| 265 | for (const dependency of expression.dependencies) { |
| 266 | dependencies[dependency] = babelTypes.identifier('__v_0'); |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | try { |
| 271 | expressionTemplate(dependencies); |
| 272 | } catch (e) { |
| 273 | return false; |
| 274 | } |
| 275 | return true; |
| 276 | } |
| 277 | |
| 278 | function writeIndexFile(path, index) { |
| 279 | index.sort((a, b) => a.path.localeCompare(b.path)); |