@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.
@@ -3213,6 +3213,21 @@ var _DependencyGraph = class _DependencyGraph {
3213
3213
  chunkQYRJ6NSL_cjs.__name(_DependencyGraph, "DependencyGraph");
3214
3214
  var DependencyGraph = _DependencyGraph;
3215
3215
 
3216
+ // src/processor/utils/name-validation.ts
3217
+ var INVALID_TOKEN_NAME_CHARS = /[ \t\n\r\f{}[\]]/;
3218
+ function validateTokenName(name) {
3219
+ return name.length > 0 && !INVALID_TOKEN_NAME_CHARS.test(name);
3220
+ }
3221
+ chunkQYRJ6NSL_cjs.__name(validateTokenName, "validateTokenName");
3222
+ function splitTokenPath(path) {
3223
+ return path.split(".");
3224
+ }
3225
+ chunkQYRJ6NSL_cjs.__name(splitTokenPath, "splitTokenPath");
3226
+ function validateTokenPath(path) {
3227
+ return splitTokenPath(path).every(validateTokenName);
3228
+ }
3229
+ chunkQYRJ6NSL_cjs.__name(validateTokenPath, "validateTokenPath");
3230
+
3216
3231
  // src/processor/utils/structured-tokens.ts
3217
3232
  function matchesObjectParser(value, parsers) {
3218
3233
  if (!chunkGKSWF7FF_cjs.isObject(value)) return false;
@@ -3650,6 +3665,15 @@ var _PrefixResolver = class _PrefixResolver {
3650
3665
  parseAndBuildGraph() {
3651
3666
  this.earlyResolved = [];
3652
3667
  for (const [tokenName, tokenData] of this.tokens.entries()) {
3668
+ if (!validateTokenPath(tokenName)) {
3669
+ this.addIssue(tokenName, {
3670
+ code: "INVALID_TOKEN_NAME",
3671
+ severity: "error" /* ERROR */,
3672
+ message: `token "${tokenName}" contains invalid characters in name (spaces, braces, or brackets are not allowed)`,
3673
+ tokenName,
3674
+ data: { path: tokenName }
3675
+ });
3676
+ }
3653
3677
  const tokenValue = getTokenValue(tokenData);
3654
3678
  if (chunkGKSWF7FF_cjs.isString(tokenValue) && chunkQYRJ6NSL_cjs.UNINTERPRETED_KEYWORDS.includes(tokenValue)) {
3655
3679
  const symbol = new chunkGKSWF7FF_cjs.StringSymbol(tokenValue, this.config);
@@ -7047,6 +7071,8 @@ exports.processTokenSets = processTokenSets;
7047
7071
  exports.processTokens = processTokens;
7048
7072
  exports.renameReferences = renameReferences;
7049
7073
  exports.tokenizeTolerantly = tokenizeTolerantly;
7074
+ exports.validateTokenName = validateTokenName;
7075
+ exports.validateTokenPath = validateTokenPath;
7050
7076
  exports.walkAST = walkAST;
7051
- //# sourceMappingURL=chunk-QGOGK2VP.cjs.map
7052
- //# sourceMappingURL=chunk-QGOGK2VP.cjs.map
7077
+ //# sourceMappingURL=chunk-AQEJB7EO.cjs.map
7078
+ //# sourceMappingURL=chunk-AQEJB7EO.cjs.map