@mojir/lits 2.0.21 → 2.0.23

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/cli/cli.js CHANGED
@@ -92,7 +92,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
92
92
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
93
93
  };
94
94
 
95
- var version = "2.0.21";
95
+ var version = "2.0.23";
96
96
 
97
97
  var AstNodeType;
98
98
  (function (AstNodeType) {
@@ -6111,13 +6111,15 @@ function analyze(ast, params) {
6111
6111
  };
6112
6112
  }
6113
6113
 
6114
- function minifyTokenStream(tokenStream) {
6115
- var tokens = tokenStream.tokens.filter(function (token) {
6114
+ function minifyTokenStream(tokenStream, _a) {
6115
+ var removeWhiteSpace = _a.removeWhiteSpace;
6116
+ var tokens = tokenStream.tokens
6117
+ .filter(function (token) {
6116
6118
  if (isP_CommentToken(token)
6117
6119
  || isA_CommentToken(token)
6118
6120
  || isA_MultiLineCommentToken(token)
6119
- || isA_WhitespaceToken(token)
6120
- || isP_WhitespaceToken(token)) {
6121
+ || (removeWhiteSpace && isA_WhitespaceToken(token))
6122
+ || (removeWhiteSpace && isP_WhitespaceToken(token))) {
6121
6123
  return false;
6122
6124
  }
6123
6125
  return true;
@@ -7643,7 +7645,7 @@ function parsePolishToken(tokenStream, parseState) {
7643
7645
  }
7644
7646
 
7645
7647
  function parse(tokenStream) {
7646
- tokenStream = minifyTokenStream(tokenStream);
7648
+ tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
7647
7649
  var algebraic = tokenStream.algebraic;
7648
7650
  var ast = {
7649
7651
  b: [],
@@ -8492,7 +8494,7 @@ var Lits = /** @class */ (function () {
8492
8494
  var debug = this.debug;
8493
8495
  var algebraic = this.algebraic;
8494
8496
  var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8495
- return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
8497
+ return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
8496
8498
  };
8497
8499
  Lits.prototype.parse = function (tokenStream) {
8498
8500
  return parse(tokenStream);
@@ -1,2 +1,4 @@
1
1
  import type { TokenStream } from './interface';
2
- export declare function minifyTokenStream(tokenStream: TokenStream): TokenStream;
2
+ export declare function minifyTokenStream(tokenStream: TokenStream, { removeWhiteSpace }: {
3
+ removeWhiteSpace: boolean;
4
+ }): TokenStream;
package/dist/index.esm.js CHANGED
@@ -6141,13 +6141,15 @@ function analyze(ast, params) {
6141
6141
  };
6142
6142
  }
6143
6143
 
6144
- function minifyTokenStream(tokenStream) {
6145
- var tokens = tokenStream.tokens.filter(function (token) {
6144
+ function minifyTokenStream(tokenStream, _a) {
6145
+ var removeWhiteSpace = _a.removeWhiteSpace;
6146
+ var tokens = tokenStream.tokens
6147
+ .filter(function (token) {
6146
6148
  if (isP_CommentToken(token)
6147
6149
  || isA_CommentToken(token)
6148
6150
  || isA_MultiLineCommentToken(token)
6149
- || isA_WhitespaceToken(token)
6150
- || isP_WhitespaceToken(token)) {
6151
+ || (removeWhiteSpace && isA_WhitespaceToken(token))
6152
+ || (removeWhiteSpace && isP_WhitespaceToken(token))) {
6151
6153
  return false;
6152
6154
  }
6153
6155
  return true;
@@ -7673,7 +7675,7 @@ function parsePolishToken(tokenStream, parseState) {
7673
7675
  }
7674
7676
 
7675
7677
  function parse(tokenStream) {
7676
- tokenStream = minifyTokenStream(tokenStream);
7678
+ tokenStream = minifyTokenStream(tokenStream, { removeWhiteSpace: true });
7677
7679
  var algebraic = tokenStream.algebraic;
7678
7680
  var ast = {
7679
7681
  b: [],
@@ -8522,7 +8524,7 @@ var Lits = /** @class */ (function () {
8522
8524
  var debug = this.debug;
8523
8525
  var algebraic = this.algebraic;
8524
8526
  var tokenStream = tokenize(program, __assign(__assign({}, tokenizeParams), { debug: debug, algebraic: algebraic }));
8525
- return tokenizeParams.minify ? minifyTokenStream(tokenStream) : tokenStream;
8527
+ return tokenizeParams.minify ? minifyTokenStream(tokenStream, { removeWhiteSpace: false }) : tokenStream;
8526
8528
  };
8527
8529
  Lits.prototype.parse = function (tokenStream) {
8528
8530
  return parse(tokenStream);