adobe / htlengine

An HTL (Sightly) Interpreter/Compiler for Node.js
Apache License 2.0
47 stars 20 forks source link

Error when runtime global name contains special characters #289

Closed benoit-adobe closed 3 years ago

benoit-adobe commented 3 years ago

If the compiler is created with a global name using <compiler instance>.withRuntimeGlobalName(<name>) and that the name contains special characters (or a hyphen for instance), it breaks the compiler.

The global name is not formatted or rejected if invalid and then set in the generated JS here.

tripodsan commented 3 years ago

but the runtime globals are user defined and should be valid variable names. it would be weird if the htlengine would to any transformation to it.

is there a requirement?

benoit-adobe commented 3 years ago

It is not a requirement, but I discover that the hard way as I did not know it was supposed to be a valid variable name and though instead that it was a namespace type of variable.

tripodsan commented 3 years ago

well, you can't even use it in HTL, eg ${foo-bar} is not a valid identifier.

benoit-adobe commented 3 years ago

Fair enough then...