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