@spintax/core 0.5.2 → 0.5.3

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.
package/dist/index.js CHANGED
@@ -918,7 +918,7 @@ function renderAst(ast, ctx) {
918
918
  locale: ctx.locale,
919
919
  depth: 0,
920
920
  onPluralError: ctx.onPluralError,
921
- budget: { left: MAX_EXPANSION_CHARS }
921
+ budget: ctx.budget
922
922
  };
923
923
  const vars = Object.keys(ast.defDefs).length > 0 ? { ...base, ...rollDefinitions(ast.defDefs, base, ctx.runtimeContext, walkOpts) } : base;
924
924
  const text = renderNodes(ast.nodes, { ...walkOpts, vars });
@@ -1358,7 +1358,10 @@ function renderWith(input, rng, opts = {}) {
1358
1358
  resolver: opts.includeResolver,
1359
1359
  maxDepth: opts.maxDepth ?? DEFAULT_MAX_DEPTH,
1360
1360
  includeStack: [],
1361
- onPluralError: opts.onPluralError
1361
+ onPluralError: opts.onPluralError,
1362
+ // One allowance for the whole call. Created here rather than in renderAst because
1363
+ // includes re-enter renderAst, and a budget made there is a budget per subtree.
1364
+ budget: { left: MAX_EXPANSION_CHARS }
1362
1365
  };
1363
1366
  const ast = resolveAst(input);
1364
1367
  let out = renderAst(ast, ctx);