@putout/babel 1.2.1 → 1.3.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.
Files changed (2) hide show
  1. package/bundle/babel.cjs +36 -50
  2. package/package.json +8 -8
package/bundle/babel.cjs CHANGED
@@ -101,22 +101,22 @@ function isIdentifierName(name) {
101
101
  return !isFirst;
102
102
  }
103
103
 
104
- const reservedWords$2 = {
104
+ const reservedWords$1 = {
105
105
  keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
106
106
  strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
107
107
  strictBind: ["eval", "arguments"]
108
108
  };
109
- const keywords$3 = new Set(reservedWords$2.keyword);
110
- const reservedWordsStrictSet$2 = new Set(reservedWords$2.strict);
111
- new Set(reservedWords$2.strictBind);
112
- function isReservedWord$2(word, inModule) {
109
+ const keywords$2 = new Set(reservedWords$1.keyword);
110
+ const reservedWordsStrictSet$1 = new Set(reservedWords$1.strict);
111
+ new Set(reservedWords$1.strictBind);
112
+ function isReservedWord$1(word, inModule) {
113
113
  return inModule && word === "await" || word === "enum";
114
114
  }
115
- function isStrictReservedWord$2(word, inModule) {
116
- return isReservedWord$2(word, inModule) || reservedWordsStrictSet$2.has(word);
115
+ function isStrictReservedWord$1(word, inModule) {
116
+ return isReservedWord$1(word, inModule) || reservedWordsStrictSet$1.has(word);
117
117
  }
118
- function isKeyword$2(word) {
119
- return keywords$3.has(word);
118
+ function isKeyword$1(word) {
119
+ return keywords$2.has(word);
120
120
  }
121
121
 
122
122
  var _isDigit$1 = function isDigit(code) {
@@ -2947,7 +2947,7 @@ function is$1(type, node, opts) {
2947
2947
  function isValidIdentifier(name, reserved = true) {
2948
2948
  if (typeof name !== "string") return false;
2949
2949
  if (reserved) {
2950
- if (isKeyword$2(name) || isStrictReservedWord$2(name, true)) {
2950
+ if (isKeyword$1(name) || isStrictReservedWord$1(name, true)) {
2951
2951
  return false;
2952
2952
  }
2953
2953
  }
@@ -3610,7 +3610,7 @@ defineType$4("Identifier", {
3610
3610
  meta: node
3611
3611
  })) return;
3612
3612
  }
3613
- if ((isKeyword$2(node.name) || isReservedWord$2(node.name, false)) && node.name !== "this") {
3613
+ if ((isKeyword$1(node.name) || isReservedWord$1(node.name, false)) && node.name !== "this") {
3614
3614
  throw new TypeError(`"${node.name}" is not a valid identifier`);
3615
3615
  }
3616
3616
  }
@@ -12633,28 +12633,28 @@ function isIdentifierChar(code) {
12633
12633
  }
12634
12634
  return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
12635
12635
  }
12636
- const reservedWords$1 = {
12636
+ const reservedWords = {
12637
12637
  keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
12638
12638
  strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
12639
12639
  strictBind: ["eval", "arguments"]
12640
12640
  };
12641
- const keywords$2 = new Set(reservedWords$1.keyword);
12642
- const reservedWordsStrictSet$1 = new Set(reservedWords$1.strict);
12643
- const reservedWordsStrictBindSet = new Set(reservedWords$1.strictBind);
12644
- function isReservedWord$1(word, inModule) {
12641
+ const keywords = new Set(reservedWords.keyword);
12642
+ const reservedWordsStrictSet = new Set(reservedWords.strict);
12643
+ const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
12644
+ function isReservedWord(word, inModule) {
12645
12645
  return inModule && word === "await" || word === "enum";
12646
12646
  }
12647
- function isStrictReservedWord$1(word, inModule) {
12648
- return isReservedWord$1(word, inModule) || reservedWordsStrictSet$1.has(word);
12647
+ function isStrictReservedWord(word, inModule) {
12648
+ return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
12649
12649
  }
12650
12650
  function isStrictBindOnlyReservedWord(word) {
12651
12651
  return reservedWordsStrictBindSet.has(word);
12652
12652
  }
12653
12653
  function isStrictBindReservedWord(word, inModule) {
12654
- return isStrictReservedWord$1(word, inModule) || isStrictBindOnlyReservedWord(word);
12654
+ return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
12655
12655
  }
12656
- function isKeyword$1(word) {
12657
- return keywords$2.has(word);
12656
+ function isKeyword(word) {
12657
+ return keywords.has(word);
12658
12658
  }
12659
12659
  function isIteratorStart(current, next, next2) {
12660
12660
  return current === 64 && next === 64 && isIdentifierStart(next2);
@@ -23299,14 +23299,14 @@ class ExpressionParser extends LValParser {
23299
23299
  if (!canBeReservedWord(word)) {
23300
23300
  return;
23301
23301
  }
23302
- if (checkKeywords && isKeyword$1(word)) {
23302
+ if (checkKeywords && isKeyword(word)) {
23303
23303
  this.raise(Errors.UnexpectedKeyword, {
23304
23304
  at: startLoc,
23305
23305
  keyword: word
23306
23306
  });
23307
23307
  return;
23308
23308
  }
23309
- const reservedTest = !this.state.strict ? isReservedWord$1 : isBinding ? isStrictBindReservedWord : isStrictReservedWord$1;
23309
+ const reservedTest = !this.state.strict ? isReservedWord : isBinding ? isStrictBindReservedWord : isStrictReservedWord;
23310
23310
  if (reservedTest(word, this.inModule)) {
23311
23311
  this.raise(Errors.UnexpectedReservedWord, {
23312
23312
  at: startLoc,
@@ -25975,24 +25975,6 @@ var jsTokens_1 = function*(input, {jsx = false} = {}) {
25975
25975
 
25976
25976
  var jsTokens = /*@__PURE__*/getDefaultExportFromCjs(jsTokens_1);
25977
25977
 
25978
- const reservedWords = {
25979
- keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
25980
- strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
25981
- strictBind: ["eval", "arguments"]
25982
- };
25983
- const keywords = new Set(reservedWords.keyword);
25984
- const reservedWordsStrictSet = new Set(reservedWords.strict);
25985
- new Set(reservedWords.strictBind);
25986
- function isReservedWord(word, inModule) {
25987
- return inModule && word === "await" || word === "enum";
25988
- }
25989
- function isStrictReservedWord(word, inModule) {
25990
- return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
25991
- }
25992
- function isKeyword(word) {
25993
- return keywords.has(word);
25994
- }
25995
-
25996
25978
  const ANSI_BACKGROUND_OFFSET$1 = 10;
25997
25979
 
25998
25980
  const wrapAnsi16$1 = (offset = 0) => code => `\u001B[${code + offset}m`;
@@ -26218,14 +26200,14 @@ const ansiStyles$1 = assembleStyles$1();
26218
26200
  /* eslint-env browser */
26219
26201
 
26220
26202
  const level$1 = (() => {
26221
- if (navigator.userAgentData) {
26203
+ if (globalThis?.navigator?.userAgentData) {
26222
26204
  const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
26223
26205
  if (brand && brand.version > 93) {
26224
26206
  return 3;
26225
26207
  }
26226
26208
  }
26227
26209
 
26228
- if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
26210
+ if (/\b(Chrome|Chromium)\//.test(globalThis?.navigator?.userAgent)) {
26229
26211
  return 1;
26230
26212
  }
26231
26213
 
@@ -26499,7 +26481,7 @@ let tokenize;
26499
26481
  {
26500
26482
  const getTokenType = function (token) {
26501
26483
  if (token.type === "IdentifierName") {
26502
- if (isKeyword(token.value) || isStrictReservedWord(token.value, true) || sometimesKeywords.has(token.value)) {
26484
+ if (isKeyword$1(token.value) || isStrictReservedWord$1(token.value, true) || sometimesKeywords.has(token.value)) {
26503
26485
  return "keyword";
26504
26486
  }
26505
26487
  if (token.value[0] !== token.value[0].toLowerCase()) {
@@ -26846,14 +26828,14 @@ const ansiStyles = assembleStyles();
26846
26828
  /* eslint-env browser */
26847
26829
 
26848
26830
  const level = (() => {
26849
- if (navigator.userAgentData) {
26831
+ if (globalThis?.navigator?.userAgentData) {
26850
26832
  const brand = navigator.userAgentData.brands.find(({brand}) => brand === 'Chromium');
26851
26833
  if (brand && brand.version > 93) {
26852
26834
  return 3;
26853
26835
  }
26854
26836
  }
26855
26837
 
26856
- if (/\b(Chrome|Chromium)\//.test(navigator.userAgent)) {
26838
+ if (/\b(Chrome|Chromium)\//.test(globalThis?.navigator?.userAgent)) {
26857
26839
  return 1;
26858
26840
  }
26859
26841
 
@@ -34499,7 +34481,7 @@ var common = setup$1;
34499
34481
  }
34500
34482
 
34501
34483
  // Internet Explorer and Edge do not support colors.
34502
- if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
34484
+ if (typeof navigator !== 'undefined' && globalThis?.navigator?.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
34503
34485
  return false;
34504
34486
  }
34505
34487
 
@@ -34510,9 +34492,9 @@ var common = setup$1;
34510
34492
  (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
34511
34493
  // Is firefox >= v31?
34512
34494
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
34513
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
34495
+ (typeof navigator !== 'undefined' && globalThis?.navigator?.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
34514
34496
  // Double check webkit in userAgent just in case we are in a worker
34515
- (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
34497
+ (typeof navigator !== 'undefined' && globalThis?.navigator?.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
34516
34498
  }
34517
34499
 
34518
34500
  /**
@@ -35782,6 +35764,7 @@ var browser = {
35782
35764
  TextTrackCueList: false,
35783
35765
  TextTrackList: false,
35784
35766
  TimeRanges: false,
35767
+ ToggleEvent: false,
35785
35768
  toolbar: false,
35786
35769
  top: false,
35787
35770
  Touch: false,
@@ -39402,7 +39385,10 @@ function _evaluate(path, state) {
39402
39385
  const property = callee.get("property");
39403
39386
  if (object.isIdentifier() && property.isIdentifier() && isValidObjectCallee(object.node.name) && !isInvalidMethod(property.node.name)) {
39404
39387
  context = global[object.node.name];
39405
- func = context[property.node.name];
39388
+ const key = property.node.name;
39389
+ if (Object.hasOwnProperty.call(context, key)) {
39390
+ func = context[key];
39391
+ }
39406
39392
  }
39407
39393
  if (object.isLiteral() && property.isIdentifier()) {
39408
39394
  const type = typeof object.node.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@putout/babel",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
6
6
  "description": "Babel 8 in CommonJS",
@@ -38,12 +38,12 @@
38
38
  "commonjs"
39
39
  ],
40
40
  "devDependencies": {
41
- "@babel/code-frame": "^8.0.0-alpha.3",
42
- "@babel/generator": "^8.0.0-alpha.3",
43
- "@babel/parser": "^8.0.0-alpha.3",
44
- "@babel/template": "^8.0.0-alpha.3",
45
- "@babel/traverse": "^8.0.0-alpha.3",
46
- "@babel/types": "^8.0.0-alpha.3",
41
+ "@babel/code-frame": "^8.0.0-alpha.4",
42
+ "@babel/generator": "^8.0.0-alpha.4",
43
+ "@babel/parser": "^8.0.0-alpha.4",
44
+ "@babel/template": "^8.0.0-alpha.4",
45
+ "@babel/traverse": "^8.0.0-alpha.4",
46
+ "@babel/types": "^8.0.0-alpha.4",
47
47
  "@rollup/plugin-alias": "^5.0.0",
48
48
  "@rollup/plugin-commonjs": "^25.0.2",
49
49
  "@rollup/plugin-json": "^6.0.0",
@@ -53,7 +53,7 @@
53
53
  "c8": "^8.0.0",
54
54
  "eslint": "^8.0.1",
55
55
  "eslint-plugin-n": "^16.0.1",
56
- "eslint-plugin-putout": "^18.1.0",
56
+ "eslint-plugin-putout": "^20.0.0",
57
57
  "globals": "^13.22.0",
58
58
  "madrun": "^9.0.0",
59
59
  "nodemon": "^3.0.1",