@putout/bundle 1.5.3 → 1.6.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.
@@ -4700,358 +4700,348 @@
4700
4700
 
4701
4701
  var lib$i = {};
4702
4702
 
4703
- var hasRequiredLib$b;
4703
+ Object.defineProperty(lib$i, "__esModule", {
4704
+ value: true
4705
+ });
4706
+ lib$i.readCodePoint = readCodePoint$1;
4707
+ lib$i.readInt = readInt$1;
4708
+ lib$i.readStringContents = readStringContents$1;
4704
4709
 
4705
- function requireLib$b () {
4706
- if (hasRequiredLib$b) return lib$i;
4707
- hasRequiredLib$b = 1;
4710
+ var _isDigit$1 = function isDigit(code) {
4711
+ return code >= 48 && code <= 57;
4712
+ };
4708
4713
 
4709
- Object.defineProperty(lib$i, "__esModule", {
4710
- value: true
4711
- });
4712
- lib$i.readCodePoint = readCodePoint;
4713
- lib$i.readInt = readInt;
4714
- lib$i.readStringContents = readStringContents;
4714
+ const forbiddenNumericSeparatorSiblings$1 = {
4715
+ decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
4716
+ hex: new Set([46, 88, 95, 120])
4717
+ };
4718
+ const isAllowedNumericSeparatorSibling$1 = {
4719
+ bin: ch => ch === 48 || ch === 49,
4720
+ oct: ch => ch >= 48 && ch <= 55,
4721
+ dec: ch => ch >= 48 && ch <= 57,
4722
+ hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
4723
+ };
4715
4724
 
4716
- var _isDigit = function isDigit(code) {
4717
- return code >= 48 && code <= 57;
4718
- };
4725
+ function readStringContents$1(type, input, pos, lineStart, curLine, errors) {
4726
+ const initialPos = pos;
4727
+ const initialLineStart = lineStart;
4728
+ const initialCurLine = curLine;
4729
+ let out = "";
4730
+ let firstInvalidLoc = null;
4731
+ let chunkStart = pos;
4732
+ const {
4733
+ length
4734
+ } = input;
4719
4735
 
4720
- const forbiddenNumericSeparatorSiblings = {
4721
- decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
4722
- hex: new Set([46, 88, 95, 120])
4723
- };
4724
- const isAllowedNumericSeparatorSibling = {
4725
- bin: ch => ch === 48 || ch === 49,
4726
- oct: ch => ch >= 48 && ch <= 55,
4727
- dec: ch => ch >= 48 && ch <= 57,
4728
- hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
4729
- };
4736
+ for (;;) {
4737
+ if (pos >= length) {
4738
+ errors.unterminated(initialPos, initialLineStart, initialCurLine);
4739
+ out += input.slice(chunkStart, pos);
4740
+ break;
4741
+ }
4730
4742
 
4731
- function readStringContents(type, input, pos, lineStart, curLine, errors) {
4732
- const initialPos = pos;
4733
- const initialLineStart = lineStart;
4734
- const initialCurLine = curLine;
4735
- let out = "";
4736
- let firstInvalidLoc = null;
4737
- let chunkStart = pos;
4738
- const {
4739
- length
4740
- } = input;
4743
+ const ch = input.charCodeAt(pos);
4741
4744
 
4742
- for (;;) {
4743
- if (pos >= length) {
4744
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
4745
- out += input.slice(chunkStart, pos);
4746
- break;
4747
- }
4745
+ if (isStringEnd$1(type, ch, input, pos)) {
4746
+ out += input.slice(chunkStart, pos);
4747
+ break;
4748
+ }
4748
4749
 
4749
- const ch = input.charCodeAt(pos);
4750
+ if (ch === 92) {
4751
+ out += input.slice(chunkStart, pos);
4752
+ const res = readEscapedChar$1(input, pos, lineStart, curLine, type === "template", errors);
4750
4753
 
4751
- if (isStringEnd(type, ch, input, pos)) {
4752
- out += input.slice(chunkStart, pos);
4753
- break;
4754
- }
4754
+ if (res.ch === null && !firstInvalidLoc) {
4755
+ firstInvalidLoc = {
4756
+ pos,
4757
+ lineStart,
4758
+ curLine
4759
+ };
4760
+ } else {
4761
+ out += res.ch;
4762
+ }
4755
4763
 
4756
- if (ch === 92) {
4757
- out += input.slice(chunkStart, pos);
4758
- const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
4764
+ ({
4765
+ pos,
4766
+ lineStart,
4767
+ curLine
4768
+ } = res);
4769
+ chunkStart = pos;
4770
+ } else if (ch === 8232 || ch === 8233) {
4771
+ ++pos;
4772
+ ++curLine;
4773
+ lineStart = pos;
4774
+ } else if (ch === 10 || ch === 13) {
4775
+ if (type === "template") {
4776
+ out += input.slice(chunkStart, pos) + "\n";
4777
+ ++pos;
4759
4778
 
4760
- if (res.ch === null && !firstInvalidLoc) {
4761
- firstInvalidLoc = {
4762
- pos,
4763
- lineStart,
4764
- curLine
4765
- };
4766
- } else {
4767
- out += res.ch;
4768
- }
4779
+ if (ch === 13 && input.charCodeAt(pos) === 10) {
4780
+ ++pos;
4781
+ }
4769
4782
 
4770
- ({
4771
- pos,
4772
- lineStart,
4773
- curLine
4774
- } = res);
4775
- chunkStart = pos;
4776
- } else if (ch === 8232 || ch === 8233) {
4777
- ++pos;
4778
- ++curLine;
4779
- lineStart = pos;
4780
- } else if (ch === 10 || ch === 13) {
4781
- if (type === "template") {
4782
- out += input.slice(chunkStart, pos) + "\n";
4783
- ++pos;
4784
-
4785
- if (ch === 13 && input.charCodeAt(pos) === 10) {
4786
- ++pos;
4787
- }
4783
+ ++curLine;
4784
+ chunkStart = lineStart = pos;
4785
+ } else {
4786
+ errors.unterminated(initialPos, initialLineStart, initialCurLine);
4787
+ }
4788
+ } else {
4789
+ ++pos;
4790
+ }
4791
+ }
4788
4792
 
4789
- ++curLine;
4790
- chunkStart = lineStart = pos;
4791
- } else {
4792
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
4793
- }
4794
- } else {
4795
- ++pos;
4796
- }
4797
- }
4793
+ return {
4794
+ pos,
4795
+ str: out,
4796
+ firstInvalidLoc,
4797
+ lineStart,
4798
+ curLine,
4799
+ containsInvalid: !!firstInvalidLoc
4800
+ };
4801
+ }
4798
4802
 
4799
- return {
4800
- pos,
4801
- str: out,
4802
- firstInvalidLoc,
4803
- lineStart,
4804
- curLine,
4805
- containsInvalid: !!firstInvalidLoc
4806
- };
4807
- }
4803
+ function isStringEnd$1(type, ch, input, pos) {
4804
+ if (type === "template") {
4805
+ return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
4806
+ }
4808
4807
 
4809
- function isStringEnd(type, ch, input, pos) {
4810
- if (type === "template") {
4811
- return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
4812
- }
4808
+ return ch === (type === "double" ? 34 : 39);
4809
+ }
4813
4810
 
4814
- return ch === (type === "double" ? 34 : 39);
4815
- }
4811
+ function readEscapedChar$1(input, pos, lineStart, curLine, inTemplate, errors) {
4812
+ const throwOnInvalid = !inTemplate;
4813
+ pos++;
4816
4814
 
4817
- function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
4818
- const throwOnInvalid = !inTemplate;
4819
- pos++;
4815
+ const res = ch => ({
4816
+ pos,
4817
+ ch,
4818
+ lineStart,
4819
+ curLine
4820
+ });
4820
4821
 
4821
- const res = ch => ({
4822
- pos,
4823
- ch,
4824
- lineStart,
4825
- curLine
4826
- });
4822
+ const ch = input.charCodeAt(pos++);
4827
4823
 
4828
- const ch = input.charCodeAt(pos++);
4824
+ switch (ch) {
4825
+ case 110:
4826
+ return res("\n");
4829
4827
 
4830
- switch (ch) {
4831
- case 110:
4832
- return res("\n");
4828
+ case 114:
4829
+ return res("\r");
4833
4830
 
4834
- case 114:
4835
- return res("\r");
4831
+ case 120:
4832
+ {
4833
+ let code;
4834
+ ({
4835
+ code,
4836
+ pos
4837
+ } = readHexChar$1(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
4838
+ return res(code === null ? null : String.fromCharCode(code));
4839
+ }
4836
4840
 
4837
- case 120:
4838
- {
4839
- let code;
4840
- ({
4841
- code,
4842
- pos
4843
- } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
4844
- return res(code === null ? null : String.fromCharCode(code));
4845
- }
4841
+ case 117:
4842
+ {
4843
+ let code;
4844
+ ({
4845
+ code,
4846
+ pos
4847
+ } = readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors));
4848
+ return res(code === null ? null : String.fromCodePoint(code));
4849
+ }
4846
4850
 
4847
- case 117:
4848
- {
4849
- let code;
4850
- ({
4851
- code,
4852
- pos
4853
- } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
4854
- return res(code === null ? null : String.fromCodePoint(code));
4855
- }
4851
+ case 116:
4852
+ return res("\t");
4856
4853
 
4857
- case 116:
4858
- return res("\t");
4854
+ case 98:
4855
+ return res("\b");
4859
4856
 
4860
- case 98:
4861
- return res("\b");
4857
+ case 118:
4858
+ return res("\u000b");
4862
4859
 
4863
- case 118:
4864
- return res("\u000b");
4860
+ case 102:
4861
+ return res("\f");
4865
4862
 
4866
- case 102:
4867
- return res("\f");
4863
+ case 13:
4864
+ if (input.charCodeAt(pos) === 10) {
4865
+ ++pos;
4866
+ }
4868
4867
 
4869
- case 13:
4870
- if (input.charCodeAt(pos) === 10) {
4871
- ++pos;
4872
- }
4868
+ case 10:
4869
+ lineStart = pos;
4870
+ ++curLine;
4873
4871
 
4874
- case 10:
4875
- lineStart = pos;
4876
- ++curLine;
4872
+ case 8232:
4873
+ case 8233:
4874
+ return res("");
4877
4875
 
4878
- case 8232:
4879
- case 8233:
4880
- return res("");
4876
+ case 56:
4877
+ case 57:
4878
+ if (inTemplate) {
4879
+ return res(null);
4880
+ } else {
4881
+ errors.strictNumericEscape(pos - 1, lineStart, curLine);
4882
+ }
4881
4883
 
4882
- case 56:
4883
- case 57:
4884
- if (inTemplate) {
4885
- return res(null);
4886
- } else {
4887
- errors.strictNumericEscape(pos - 1, lineStart, curLine);
4888
- }
4884
+ default:
4885
+ if (ch >= 48 && ch <= 55) {
4886
+ const startPos = pos - 1;
4887
+ const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
4888
+ let octalStr = match[0];
4889
+ let octal = parseInt(octalStr, 8);
4889
4890
 
4890
- default:
4891
- if (ch >= 48 && ch <= 55) {
4892
- const startPos = pos - 1;
4893
- const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
4894
- let octalStr = match[0];
4895
- let octal = parseInt(octalStr, 8);
4896
-
4897
- if (octal > 255) {
4898
- octalStr = octalStr.slice(0, -1);
4899
- octal = parseInt(octalStr, 8);
4900
- }
4891
+ if (octal > 255) {
4892
+ octalStr = octalStr.slice(0, -1);
4893
+ octal = parseInt(octalStr, 8);
4894
+ }
4901
4895
 
4902
- pos += octalStr.length - 1;
4903
- const next = input.charCodeAt(pos);
4896
+ pos += octalStr.length - 1;
4897
+ const next = input.charCodeAt(pos);
4904
4898
 
4905
- if (octalStr !== "0" || next === 56 || next === 57) {
4906
- if (inTemplate) {
4907
- return res(null);
4908
- } else {
4909
- errors.strictNumericEscape(startPos, lineStart, curLine);
4910
- }
4911
- }
4899
+ if (octalStr !== "0" || next === 56 || next === 57) {
4900
+ if (inTemplate) {
4901
+ return res(null);
4902
+ } else {
4903
+ errors.strictNumericEscape(startPos, lineStart, curLine);
4904
+ }
4905
+ }
4912
4906
 
4913
- return res(String.fromCharCode(octal));
4914
- }
4907
+ return res(String.fromCharCode(octal));
4908
+ }
4915
4909
 
4916
- return res(String.fromCharCode(ch));
4917
- }
4918
- }
4910
+ return res(String.fromCharCode(ch));
4911
+ }
4912
+ }
4919
4913
 
4920
- function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
4921
- const initialPos = pos;
4922
- let n;
4923
- ({
4924
- n,
4925
- pos
4926
- } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
4914
+ function readHexChar$1(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
4915
+ const initialPos = pos;
4916
+ let n;
4917
+ ({
4918
+ n,
4919
+ pos
4920
+ } = readInt$1(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
4927
4921
 
4928
- if (n === null) {
4929
- if (throwOnInvalid) {
4930
- errors.invalidEscapeSequence(initialPos, lineStart, curLine);
4931
- } else {
4932
- pos = initialPos - 1;
4933
- }
4934
- }
4922
+ if (n === null) {
4923
+ if (throwOnInvalid) {
4924
+ errors.invalidEscapeSequence(initialPos, lineStart, curLine);
4925
+ } else {
4926
+ pos = initialPos - 1;
4927
+ }
4928
+ }
4935
4929
 
4936
- return {
4937
- code: n,
4938
- pos
4939
- };
4940
- }
4930
+ return {
4931
+ code: n,
4932
+ pos
4933
+ };
4934
+ }
4941
4935
 
4942
- function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
4943
- const start = pos;
4944
- const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
4945
- const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
4946
- let invalid = false;
4947
- let total = 0;
4936
+ function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
4937
+ const start = pos;
4938
+ const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings$1.hex : forbiddenNumericSeparatorSiblings$1.decBinOct;
4939
+ const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling$1.hex : radix === 10 ? isAllowedNumericSeparatorSibling$1.dec : radix === 8 ? isAllowedNumericSeparatorSibling$1.oct : isAllowedNumericSeparatorSibling$1.bin;
4940
+ let invalid = false;
4941
+ let total = 0;
4948
4942
 
4949
- for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
4950
- const code = input.charCodeAt(pos);
4951
- let val;
4943
+ for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
4944
+ const code = input.charCodeAt(pos);
4945
+ let val;
4952
4946
 
4953
- if (code === 95 && allowNumSeparator !== "bail") {
4954
- const prev = input.charCodeAt(pos - 1);
4955
- const next = input.charCodeAt(pos + 1);
4947
+ if (code === 95 && allowNumSeparator !== "bail") {
4948
+ const prev = input.charCodeAt(pos - 1);
4949
+ const next = input.charCodeAt(pos + 1);
4956
4950
 
4957
- if (!allowNumSeparator) {
4958
- if (bailOnError) return {
4959
- n: null,
4960
- pos
4961
- };
4962
- errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
4963
- } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
4964
- if (bailOnError) return {
4965
- n: null,
4966
- pos
4967
- };
4968
- errors.unexpectedNumericSeparator(pos, lineStart, curLine);
4969
- }
4951
+ if (!allowNumSeparator) {
4952
+ if (bailOnError) return {
4953
+ n: null,
4954
+ pos
4955
+ };
4956
+ errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
4957
+ } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
4958
+ if (bailOnError) return {
4959
+ n: null,
4960
+ pos
4961
+ };
4962
+ errors.unexpectedNumericSeparator(pos, lineStart, curLine);
4963
+ }
4970
4964
 
4971
- ++pos;
4972
- continue;
4973
- }
4965
+ ++pos;
4966
+ continue;
4967
+ }
4974
4968
 
4975
- if (code >= 97) {
4976
- val = code - 97 + 10;
4977
- } else if (code >= 65) {
4978
- val = code - 65 + 10;
4979
- } else if (_isDigit(code)) {
4980
- val = code - 48;
4981
- } else {
4982
- val = Infinity;
4983
- }
4969
+ if (code >= 97) {
4970
+ val = code - 97 + 10;
4971
+ } else if (code >= 65) {
4972
+ val = code - 65 + 10;
4973
+ } else if (_isDigit$1(code)) {
4974
+ val = code - 48;
4975
+ } else {
4976
+ val = Infinity;
4977
+ }
4984
4978
 
4985
- if (val >= radix) {
4986
- if (val <= 9 && bailOnError) {
4987
- return {
4988
- n: null,
4989
- pos
4990
- };
4991
- } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
4992
- val = 0;
4993
- } else if (forceLen) {
4994
- val = 0;
4995
- invalid = true;
4996
- } else {
4997
- break;
4998
- }
4999
- }
4979
+ if (val >= radix) {
4980
+ if (val <= 9 && bailOnError) {
4981
+ return {
4982
+ n: null,
4983
+ pos
4984
+ };
4985
+ } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
4986
+ val = 0;
4987
+ } else if (forceLen) {
4988
+ val = 0;
4989
+ invalid = true;
4990
+ } else {
4991
+ break;
4992
+ }
4993
+ }
5000
4994
 
5001
- ++pos;
5002
- total = total * radix + val;
5003
- }
4995
+ ++pos;
4996
+ total = total * radix + val;
4997
+ }
5004
4998
 
5005
- if (pos === start || len != null && pos - start !== len || invalid) {
5006
- return {
5007
- n: null,
5008
- pos
5009
- };
5010
- }
4999
+ if (pos === start || len != null && pos - start !== len || invalid) {
5000
+ return {
5001
+ n: null,
5002
+ pos
5003
+ };
5004
+ }
5011
5005
 
5012
- return {
5013
- n: total,
5014
- pos
5015
- };
5016
- }
5006
+ return {
5007
+ n: total,
5008
+ pos
5009
+ };
5010
+ }
5017
5011
 
5018
- function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
5019
- const ch = input.charCodeAt(pos);
5020
- let code;
5012
+ function readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors) {
5013
+ const ch = input.charCodeAt(pos);
5014
+ let code;
5021
5015
 
5022
- if (ch === 123) {
5023
- ++pos;
5024
- ({
5025
- code,
5026
- pos
5027
- } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
5028
- ++pos;
5029
-
5030
- if (code !== null && code > 0x10ffff) {
5031
- if (throwOnInvalid) {
5032
- errors.invalidCodePoint(pos, lineStart, curLine);
5033
- } else {
5034
- return {
5035
- code: null,
5036
- pos
5037
- };
5038
- }
5039
- }
5040
- } else {
5041
- ({
5042
- code,
5043
- pos
5044
- } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
5045
- }
5016
+ if (ch === 123) {
5017
+ ++pos;
5018
+ ({
5019
+ code,
5020
+ pos
5021
+ } = readHexChar$1(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
5022
+ ++pos;
5046
5023
 
5047
- return {
5048
- code,
5049
- pos
5050
- };
5051
- }
5024
+ if (code !== null && code > 0x10ffff) {
5025
+ if (throwOnInvalid) {
5026
+ errors.invalidCodePoint(pos, lineStart, curLine);
5027
+ } else {
5028
+ return {
5029
+ code: null,
5030
+ pos
5031
+ };
5032
+ }
5033
+ }
5034
+ } else {
5035
+ ({
5036
+ code,
5037
+ pos
5038
+ } = readHexChar$1(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
5039
+ }
5052
5040
 
5053
-
5054
- return lib$i;
5041
+ return {
5042
+ code,
5043
+ pos
5044
+ };
5055
5045
  }
5056
5046
 
5057
5047
  var constants = {};
@@ -5405,7 +5395,7 @@
5405
5395
  var _is = requireIs$1();
5406
5396
  var _isValidIdentifier = isValidIdentifier$1;
5407
5397
  var _helperValidatorIdentifier = lib$j;
5408
- var _helperStringParser = requireLib$b();
5398
+ var _helperStringParser = lib$i;
5409
5399
  var _constants = constants;
5410
5400
  var _utils = requireUtils$2();
5411
5401
  const defineType = (0, _utils.defineAliasedType)("Standardized");
package/bundle/putout.js CHANGED
@@ -4694,348 +4694,358 @@ function isValidIdentifier(name, reserved = true) {
4694
4694
 
4695
4695
  var lib$i = {};
4696
4696
 
4697
- Object.defineProperty(lib$i, "__esModule", {
4698
- value: true
4699
- });
4700
- lib$i.readCodePoint = readCodePoint$1;
4701
- lib$i.readInt = readInt$1;
4702
- lib$i.readStringContents = readStringContents$1;
4697
+ var hasRequiredLib$b;
4703
4698
 
4704
- var _isDigit$1 = function isDigit(code) {
4705
- return code >= 48 && code <= 57;
4706
- };
4699
+ function requireLib$b () {
4700
+ if (hasRequiredLib$b) return lib$i;
4701
+ hasRequiredLib$b = 1;
4707
4702
 
4708
- const forbiddenNumericSeparatorSiblings$1 = {
4709
- decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
4710
- hex: new Set([46, 88, 95, 120])
4711
- };
4712
- const isAllowedNumericSeparatorSibling$1 = {
4713
- bin: ch => ch === 48 || ch === 49,
4714
- oct: ch => ch >= 48 && ch <= 55,
4715
- dec: ch => ch >= 48 && ch <= 57,
4716
- hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
4717
- };
4703
+ Object.defineProperty(lib$i, "__esModule", {
4704
+ value: true
4705
+ });
4706
+ lib$i.readCodePoint = readCodePoint;
4707
+ lib$i.readInt = readInt;
4708
+ lib$i.readStringContents = readStringContents;
4718
4709
 
4719
- function readStringContents$1(type, input, pos, lineStart, curLine, errors) {
4720
- const initialPos = pos;
4721
- const initialLineStart = lineStart;
4722
- const initialCurLine = curLine;
4723
- let out = "";
4724
- let firstInvalidLoc = null;
4725
- let chunkStart = pos;
4726
- const {
4727
- length
4728
- } = input;
4710
+ var _isDigit = function isDigit(code) {
4711
+ return code >= 48 && code <= 57;
4712
+ };
4729
4713
 
4730
- for (;;) {
4731
- if (pos >= length) {
4732
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
4733
- out += input.slice(chunkStart, pos);
4734
- break;
4735
- }
4714
+ const forbiddenNumericSeparatorSiblings = {
4715
+ decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]),
4716
+ hex: new Set([46, 88, 95, 120])
4717
+ };
4718
+ const isAllowedNumericSeparatorSibling = {
4719
+ bin: ch => ch === 48 || ch === 49,
4720
+ oct: ch => ch >= 48 && ch <= 55,
4721
+ dec: ch => ch >= 48 && ch <= 57,
4722
+ hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102
4723
+ };
4736
4724
 
4737
- const ch = input.charCodeAt(pos);
4725
+ function readStringContents(type, input, pos, lineStart, curLine, errors) {
4726
+ const initialPos = pos;
4727
+ const initialLineStart = lineStart;
4728
+ const initialCurLine = curLine;
4729
+ let out = "";
4730
+ let firstInvalidLoc = null;
4731
+ let chunkStart = pos;
4732
+ const {
4733
+ length
4734
+ } = input;
4738
4735
 
4739
- if (isStringEnd$1(type, ch, input, pos)) {
4740
- out += input.slice(chunkStart, pos);
4741
- break;
4742
- }
4736
+ for (;;) {
4737
+ if (pos >= length) {
4738
+ errors.unterminated(initialPos, initialLineStart, initialCurLine);
4739
+ out += input.slice(chunkStart, pos);
4740
+ break;
4741
+ }
4743
4742
 
4744
- if (ch === 92) {
4745
- out += input.slice(chunkStart, pos);
4746
- const res = readEscapedChar$1(input, pos, lineStart, curLine, type === "template", errors);
4743
+ const ch = input.charCodeAt(pos);
4747
4744
 
4748
- if (res.ch === null && !firstInvalidLoc) {
4749
- firstInvalidLoc = {
4750
- pos,
4751
- lineStart,
4752
- curLine
4753
- };
4754
- } else {
4755
- out += res.ch;
4756
- }
4745
+ if (isStringEnd(type, ch, input, pos)) {
4746
+ out += input.slice(chunkStart, pos);
4747
+ break;
4748
+ }
4757
4749
 
4758
- ({
4759
- pos,
4760
- lineStart,
4761
- curLine
4762
- } = res);
4763
- chunkStart = pos;
4764
- } else if (ch === 8232 || ch === 8233) {
4765
- ++pos;
4766
- ++curLine;
4767
- lineStart = pos;
4768
- } else if (ch === 10 || ch === 13) {
4769
- if (type === "template") {
4770
- out += input.slice(chunkStart, pos) + "\n";
4771
- ++pos;
4750
+ if (ch === 92) {
4751
+ out += input.slice(chunkStart, pos);
4752
+ const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors);
4772
4753
 
4773
- if (ch === 13 && input.charCodeAt(pos) === 10) {
4774
- ++pos;
4775
- }
4754
+ if (res.ch === null && !firstInvalidLoc) {
4755
+ firstInvalidLoc = {
4756
+ pos,
4757
+ lineStart,
4758
+ curLine
4759
+ };
4760
+ } else {
4761
+ out += res.ch;
4762
+ }
4776
4763
 
4777
- ++curLine;
4778
- chunkStart = lineStart = pos;
4779
- } else {
4780
- errors.unterminated(initialPos, initialLineStart, initialCurLine);
4781
- }
4782
- } else {
4783
- ++pos;
4784
- }
4785
- }
4764
+ ({
4765
+ pos,
4766
+ lineStart,
4767
+ curLine
4768
+ } = res);
4769
+ chunkStart = pos;
4770
+ } else if (ch === 8232 || ch === 8233) {
4771
+ ++pos;
4772
+ ++curLine;
4773
+ lineStart = pos;
4774
+ } else if (ch === 10 || ch === 13) {
4775
+ if (type === "template") {
4776
+ out += input.slice(chunkStart, pos) + "\n";
4777
+ ++pos;
4778
+
4779
+ if (ch === 13 && input.charCodeAt(pos) === 10) {
4780
+ ++pos;
4781
+ }
4786
4782
 
4787
- return {
4788
- pos,
4789
- str: out,
4790
- firstInvalidLoc,
4791
- lineStart,
4792
- curLine,
4793
- containsInvalid: !!firstInvalidLoc
4794
- };
4795
- }
4783
+ ++curLine;
4784
+ chunkStart = lineStart = pos;
4785
+ } else {
4786
+ errors.unterminated(initialPos, initialLineStart, initialCurLine);
4787
+ }
4788
+ } else {
4789
+ ++pos;
4790
+ }
4791
+ }
4796
4792
 
4797
- function isStringEnd$1(type, ch, input, pos) {
4798
- if (type === "template") {
4799
- return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
4800
- }
4793
+ return {
4794
+ pos,
4795
+ str: out,
4796
+ firstInvalidLoc,
4797
+ lineStart,
4798
+ curLine,
4799
+ containsInvalid: !!firstInvalidLoc
4800
+ };
4801
+ }
4801
4802
 
4802
- return ch === (type === "double" ? 34 : 39);
4803
- }
4803
+ function isStringEnd(type, ch, input, pos) {
4804
+ if (type === "template") {
4805
+ return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123;
4806
+ }
4804
4807
 
4805
- function readEscapedChar$1(input, pos, lineStart, curLine, inTemplate, errors) {
4806
- const throwOnInvalid = !inTemplate;
4807
- pos++;
4808
+ return ch === (type === "double" ? 34 : 39);
4809
+ }
4808
4810
 
4809
- const res = ch => ({
4810
- pos,
4811
- ch,
4812
- lineStart,
4813
- curLine
4814
- });
4811
+ function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) {
4812
+ const throwOnInvalid = !inTemplate;
4813
+ pos++;
4815
4814
 
4816
- const ch = input.charCodeAt(pos++);
4815
+ const res = ch => ({
4816
+ pos,
4817
+ ch,
4818
+ lineStart,
4819
+ curLine
4820
+ });
4817
4821
 
4818
- switch (ch) {
4819
- case 110:
4820
- return res("\n");
4822
+ const ch = input.charCodeAt(pos++);
4821
4823
 
4822
- case 114:
4823
- return res("\r");
4824
+ switch (ch) {
4825
+ case 110:
4826
+ return res("\n");
4824
4827
 
4825
- case 120:
4826
- {
4827
- let code;
4828
- ({
4829
- code,
4830
- pos
4831
- } = readHexChar$1(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
4832
- return res(code === null ? null : String.fromCharCode(code));
4833
- }
4828
+ case 114:
4829
+ return res("\r");
4834
4830
 
4835
- case 117:
4836
- {
4837
- let code;
4838
- ({
4839
- code,
4840
- pos
4841
- } = readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors));
4842
- return res(code === null ? null : String.fromCodePoint(code));
4843
- }
4831
+ case 120:
4832
+ {
4833
+ let code;
4834
+ ({
4835
+ code,
4836
+ pos
4837
+ } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors));
4838
+ return res(code === null ? null : String.fromCharCode(code));
4839
+ }
4844
4840
 
4845
- case 116:
4846
- return res("\t");
4841
+ case 117:
4842
+ {
4843
+ let code;
4844
+ ({
4845
+ code,
4846
+ pos
4847
+ } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors));
4848
+ return res(code === null ? null : String.fromCodePoint(code));
4849
+ }
4847
4850
 
4848
- case 98:
4849
- return res("\b");
4851
+ case 116:
4852
+ return res("\t");
4850
4853
 
4851
- case 118:
4852
- return res("\u000b");
4854
+ case 98:
4855
+ return res("\b");
4853
4856
 
4854
- case 102:
4855
- return res("\f");
4857
+ case 118:
4858
+ return res("\u000b");
4856
4859
 
4857
- case 13:
4858
- if (input.charCodeAt(pos) === 10) {
4859
- ++pos;
4860
- }
4860
+ case 102:
4861
+ return res("\f");
4861
4862
 
4862
- case 10:
4863
- lineStart = pos;
4864
- ++curLine;
4863
+ case 13:
4864
+ if (input.charCodeAt(pos) === 10) {
4865
+ ++pos;
4866
+ }
4865
4867
 
4866
- case 8232:
4867
- case 8233:
4868
- return res("");
4868
+ case 10:
4869
+ lineStart = pos;
4870
+ ++curLine;
4869
4871
 
4870
- case 56:
4871
- case 57:
4872
- if (inTemplate) {
4873
- return res(null);
4874
- } else {
4875
- errors.strictNumericEscape(pos - 1, lineStart, curLine);
4876
- }
4872
+ case 8232:
4873
+ case 8233:
4874
+ return res("");
4877
4875
 
4878
- default:
4879
- if (ch >= 48 && ch <= 55) {
4880
- const startPos = pos - 1;
4881
- const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
4882
- let octalStr = match[0];
4883
- let octal = parseInt(octalStr, 8);
4876
+ case 56:
4877
+ case 57:
4878
+ if (inTemplate) {
4879
+ return res(null);
4880
+ } else {
4881
+ errors.strictNumericEscape(pos - 1, lineStart, curLine);
4882
+ }
4884
4883
 
4885
- if (octal > 255) {
4886
- octalStr = octalStr.slice(0, -1);
4887
- octal = parseInt(octalStr, 8);
4888
- }
4884
+ default:
4885
+ if (ch >= 48 && ch <= 55) {
4886
+ const startPos = pos - 1;
4887
+ const match = input.slice(startPos, pos + 2).match(/^[0-7]+/);
4888
+ let octalStr = match[0];
4889
+ let octal = parseInt(octalStr, 8);
4890
+
4891
+ if (octal > 255) {
4892
+ octalStr = octalStr.slice(0, -1);
4893
+ octal = parseInt(octalStr, 8);
4894
+ }
4889
4895
 
4890
- pos += octalStr.length - 1;
4891
- const next = input.charCodeAt(pos);
4896
+ pos += octalStr.length - 1;
4897
+ const next = input.charCodeAt(pos);
4892
4898
 
4893
- if (octalStr !== "0" || next === 56 || next === 57) {
4894
- if (inTemplate) {
4895
- return res(null);
4896
- } else {
4897
- errors.strictNumericEscape(startPos, lineStart, curLine);
4898
- }
4899
- }
4899
+ if (octalStr !== "0" || next === 56 || next === 57) {
4900
+ if (inTemplate) {
4901
+ return res(null);
4902
+ } else {
4903
+ errors.strictNumericEscape(startPos, lineStart, curLine);
4904
+ }
4905
+ }
4900
4906
 
4901
- return res(String.fromCharCode(octal));
4902
- }
4907
+ return res(String.fromCharCode(octal));
4908
+ }
4903
4909
 
4904
- return res(String.fromCharCode(ch));
4905
- }
4906
- }
4910
+ return res(String.fromCharCode(ch));
4911
+ }
4912
+ }
4907
4913
 
4908
- function readHexChar$1(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
4909
- const initialPos = pos;
4910
- let n;
4911
- ({
4912
- n,
4913
- pos
4914
- } = readInt$1(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
4914
+ function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) {
4915
+ const initialPos = pos;
4916
+ let n;
4917
+ ({
4918
+ n,
4919
+ pos
4920
+ } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid));
4915
4921
 
4916
- if (n === null) {
4917
- if (throwOnInvalid) {
4918
- errors.invalidEscapeSequence(initialPos, lineStart, curLine);
4919
- } else {
4920
- pos = initialPos - 1;
4921
- }
4922
- }
4922
+ if (n === null) {
4923
+ if (throwOnInvalid) {
4924
+ errors.invalidEscapeSequence(initialPos, lineStart, curLine);
4925
+ } else {
4926
+ pos = initialPos - 1;
4927
+ }
4928
+ }
4923
4929
 
4924
- return {
4925
- code: n,
4926
- pos
4927
- };
4928
- }
4930
+ return {
4931
+ code: n,
4932
+ pos
4933
+ };
4934
+ }
4929
4935
 
4930
- function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
4931
- const start = pos;
4932
- const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings$1.hex : forbiddenNumericSeparatorSiblings$1.decBinOct;
4933
- const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling$1.hex : radix === 10 ? isAllowedNumericSeparatorSibling$1.dec : radix === 8 ? isAllowedNumericSeparatorSibling$1.oct : isAllowedNumericSeparatorSibling$1.bin;
4934
- let invalid = false;
4935
- let total = 0;
4936
+ function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) {
4937
+ const start = pos;
4938
+ const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct;
4939
+ const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin;
4940
+ let invalid = false;
4941
+ let total = 0;
4936
4942
 
4937
- for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
4938
- const code = input.charCodeAt(pos);
4939
- let val;
4943
+ for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) {
4944
+ const code = input.charCodeAt(pos);
4945
+ let val;
4940
4946
 
4941
- if (code === 95 && allowNumSeparator !== "bail") {
4942
- const prev = input.charCodeAt(pos - 1);
4943
- const next = input.charCodeAt(pos + 1);
4947
+ if (code === 95 && allowNumSeparator !== "bail") {
4948
+ const prev = input.charCodeAt(pos - 1);
4949
+ const next = input.charCodeAt(pos + 1);
4944
4950
 
4945
- if (!allowNumSeparator) {
4946
- if (bailOnError) return {
4947
- n: null,
4948
- pos
4949
- };
4950
- errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
4951
- } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
4952
- if (bailOnError) return {
4953
- n: null,
4954
- pos
4955
- };
4956
- errors.unexpectedNumericSeparator(pos, lineStart, curLine);
4957
- }
4951
+ if (!allowNumSeparator) {
4952
+ if (bailOnError) return {
4953
+ n: null,
4954
+ pos
4955
+ };
4956
+ errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine);
4957
+ } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) {
4958
+ if (bailOnError) return {
4959
+ n: null,
4960
+ pos
4961
+ };
4962
+ errors.unexpectedNumericSeparator(pos, lineStart, curLine);
4963
+ }
4958
4964
 
4959
- ++pos;
4960
- continue;
4961
- }
4965
+ ++pos;
4966
+ continue;
4967
+ }
4962
4968
 
4963
- if (code >= 97) {
4964
- val = code - 97 + 10;
4965
- } else if (code >= 65) {
4966
- val = code - 65 + 10;
4967
- } else if (_isDigit$1(code)) {
4968
- val = code - 48;
4969
- } else {
4970
- val = Infinity;
4971
- }
4969
+ if (code >= 97) {
4970
+ val = code - 97 + 10;
4971
+ } else if (code >= 65) {
4972
+ val = code - 65 + 10;
4973
+ } else if (_isDigit(code)) {
4974
+ val = code - 48;
4975
+ } else {
4976
+ val = Infinity;
4977
+ }
4972
4978
 
4973
- if (val >= radix) {
4974
- if (val <= 9 && bailOnError) {
4975
- return {
4976
- n: null,
4977
- pos
4978
- };
4979
- } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
4980
- val = 0;
4981
- } else if (forceLen) {
4982
- val = 0;
4983
- invalid = true;
4984
- } else {
4985
- break;
4986
- }
4987
- }
4979
+ if (val >= radix) {
4980
+ if (val <= 9 && bailOnError) {
4981
+ return {
4982
+ n: null,
4983
+ pos
4984
+ };
4985
+ } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) {
4986
+ val = 0;
4987
+ } else if (forceLen) {
4988
+ val = 0;
4989
+ invalid = true;
4990
+ } else {
4991
+ break;
4992
+ }
4993
+ }
4988
4994
 
4989
- ++pos;
4990
- total = total * radix + val;
4991
- }
4995
+ ++pos;
4996
+ total = total * radix + val;
4997
+ }
4992
4998
 
4993
- if (pos === start || len != null && pos - start !== len || invalid) {
4994
- return {
4995
- n: null,
4996
- pos
4997
- };
4998
- }
4999
+ if (pos === start || len != null && pos - start !== len || invalid) {
5000
+ return {
5001
+ n: null,
5002
+ pos
5003
+ };
5004
+ }
4999
5005
 
5000
- return {
5001
- n: total,
5002
- pos
5003
- };
5004
- }
5006
+ return {
5007
+ n: total,
5008
+ pos
5009
+ };
5010
+ }
5005
5011
 
5006
- function readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors) {
5007
- const ch = input.charCodeAt(pos);
5008
- let code;
5012
+ function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) {
5013
+ const ch = input.charCodeAt(pos);
5014
+ let code;
5009
5015
 
5010
- if (ch === 123) {
5011
- ++pos;
5012
- ({
5013
- code,
5014
- pos
5015
- } = readHexChar$1(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
5016
- ++pos;
5016
+ if (ch === 123) {
5017
+ ++pos;
5018
+ ({
5019
+ code,
5020
+ pos
5021
+ } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors));
5022
+ ++pos;
5023
+
5024
+ if (code !== null && code > 0x10ffff) {
5025
+ if (throwOnInvalid) {
5026
+ errors.invalidCodePoint(pos, lineStart, curLine);
5027
+ } else {
5028
+ return {
5029
+ code: null,
5030
+ pos
5031
+ };
5032
+ }
5033
+ }
5034
+ } else {
5035
+ ({
5036
+ code,
5037
+ pos
5038
+ } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
5039
+ }
5017
5040
 
5018
- if (code !== null && code > 0x10ffff) {
5019
- if (throwOnInvalid) {
5020
- errors.invalidCodePoint(pos, lineStart, curLine);
5021
- } else {
5022
- return {
5023
- code: null,
5024
- pos
5025
- };
5026
- }
5027
- }
5028
- } else {
5029
- ({
5030
- code,
5031
- pos
5032
- } = readHexChar$1(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors));
5033
- }
5041
+ return {
5042
+ code,
5043
+ pos
5044
+ };
5045
+ }
5034
5046
 
5035
- return {
5036
- code,
5037
- pos
5038
- };
5047
+
5048
+ return lib$i;
5039
5049
  }
5040
5050
 
5041
5051
  var constants = {};
@@ -5389,7 +5399,7 @@ function requireCore$2 () {
5389
5399
  var _is = requireIs$1();
5390
5400
  var _isValidIdentifier = isValidIdentifier$1;
5391
5401
  var _helperValidatorIdentifier = lib$j;
5392
- var _helperStringParser = lib$i;
5402
+ var _helperStringParser = requireLib$b();
5393
5403
  var _constants = constants;
5394
5404
  var _utils = requireUtils$2();
5395
5405
  const defineType = (0, _utils.defineAliasedType)("Standardized");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/bundle",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "commitType": "colon",
6
6
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",