@tokens-studio/tokenscript-interpreter 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3211,6 +3211,21 @@ var _DependencyGraph = class _DependencyGraph {
3211
3211
  __name(_DependencyGraph, "DependencyGraph");
3212
3212
  var DependencyGraph = _DependencyGraph;
3213
3213
 
3214
+ // src/processor/utils/name-validation.ts
3215
+ var INVALID_TOKEN_NAME_CHARS = /[ \t\n\r\f{}[\]]/;
3216
+ function validateTokenName(name) {
3217
+ return name.length > 0 && !INVALID_TOKEN_NAME_CHARS.test(name);
3218
+ }
3219
+ __name(validateTokenName, "validateTokenName");
3220
+ function splitTokenPath(path) {
3221
+ return path.split(".");
3222
+ }
3223
+ __name(splitTokenPath, "splitTokenPath");
3224
+ function validateTokenPath(path) {
3225
+ return splitTokenPath(path).every(validateTokenName);
3226
+ }
3227
+ __name(validateTokenPath, "validateTokenPath");
3228
+
3214
3229
  // src/processor/utils/structured-tokens.ts
3215
3230
  function matchesObjectParser(value, parsers) {
3216
3231
  if (!isObject(value)) return false;
@@ -3648,6 +3663,15 @@ var _PrefixResolver = class _PrefixResolver {
3648
3663
  parseAndBuildGraph() {
3649
3664
  this.earlyResolved = [];
3650
3665
  for (const [tokenName, tokenData] of this.tokens.entries()) {
3666
+ if (!validateTokenPath(tokenName)) {
3667
+ this.addIssue(tokenName, {
3668
+ code: "INVALID_TOKEN_NAME",
3669
+ severity: "error" /* ERROR */,
3670
+ message: `token "${tokenName}" contains invalid characters in name (spaces, braces, or brackets are not allowed)`,
3671
+ tokenName,
3672
+ data: { path: tokenName }
3673
+ });
3674
+ }
3651
3675
  const tokenValue = getTokenValue(tokenData);
3652
3676
  if (isString(tokenValue) && UNINTERPRETED_KEYWORDS.includes(tokenValue)) {
3653
3677
  const symbol = new StringSymbol(tokenValue, this.config);
@@ -6999,6 +7023,6 @@ var ASTNodes = {
6999
7023
  UnaryOpNode
7000
7024
  };
7001
7025
 
7002
- export { ASTNodes, ColorManager, ColorSpecificationSchema, Config, ConstantsSpecificationSchema, DEFAULT_LANGUAGE_OPTIONS, FunctionSpecificationSchema, FunctionsManager, IncompleteType, Interpreter, Lexer, ParseState, Parser, PartialBinOpNode, PartialFunctionCallNode, PartialParenNode, PartialReferenceNode, PartialStringNode, PartialUnaryOpNode, TokenResolver, UnitManager, UnitSpecificationSchema, ValidationSeverity, buildTokens, builders_exports, collectAllReferences, collectReferenceNodes, errorClasses, errorHelpers, evaluateExpression, fetchAndRegisterSchemas, fetchTokenScriptSchema, filterAST, flattenChildrenMap, flattenChildrenObject, getAffectedTokens, getBrokenReferences, getModifiedDependants, getRenamedReferences, hasPartialNodes, parseExpression, parseTolerantly, processTokenSets, processTokens, renameReferences, tokenizeTolerantly, walkAST };
7003
- //# sourceMappingURL=chunk-UYVHWJIC.js.map
7004
- //# sourceMappingURL=chunk-UYVHWJIC.js.map
7026
+ export { ASTNodes, ColorManager, ColorSpecificationSchema, Config, ConstantsSpecificationSchema, DEFAULT_LANGUAGE_OPTIONS, FunctionSpecificationSchema, FunctionsManager, IncompleteType, Interpreter, Lexer, ParseState, Parser, PartialBinOpNode, PartialFunctionCallNode, PartialParenNode, PartialReferenceNode, PartialStringNode, PartialUnaryOpNode, TokenResolver, UnitManager, UnitSpecificationSchema, ValidationSeverity, buildTokens, builders_exports, collectAllReferences, collectReferenceNodes, errorClasses, errorHelpers, evaluateExpression, fetchAndRegisterSchemas, fetchTokenScriptSchema, filterAST, flattenChildrenMap, flattenChildrenObject, getAffectedTokens, getBrokenReferences, getModifiedDependants, getRenamedReferences, hasPartialNodes, parseExpression, parseTolerantly, processTokenSets, processTokens, renameReferences, tokenizeTolerantly, validateTokenName, validateTokenPath, walkAST };
7027
+ //# sourceMappingURL=chunk-DFN353G4.js.map
7028
+ //# sourceMappingURL=chunk-DFN353G4.js.map