From 5ef416fab08ac755063e0141cf15587e50dc1295 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 26 Feb 2023 13:02:34 +0200 Subject: [PATCH] chore: package: v1.6.0 --- ChangeLog | 5 + bundle/putout-iife.js | 592 +++++++++++++++++++++--------------------- bundle/putout.js | 592 +++++++++++++++++++++--------------------- package.json | 2 +- 4 files changed, 598 insertions(+), 593 deletions(-) diff --git a/ChangeLog b/ChangeLog index be78726..f367419 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2023.02.26, v1.6.0 + +feature: +- @putout/bundle: add index.html to npmignore + 2023.02.26, v1.5.3 feature: diff --git a/bundle/putout-iife.js b/bundle/putout-iife.js index 52dd155..0beb201 100644 --- a/bundle/putout-iife.js +++ b/bundle/putout-iife.js @@ -4700,358 +4700,348 @@ var lib$i = {}; - var hasRequiredLib$b; + Object.defineProperty(lib$i, "__esModule", { + value: true + }); + lib$i.readCodePoint = readCodePoint$1; + lib$i.readInt = readInt$1; + lib$i.readStringContents = readStringContents$1; - function requireLib$b () { - if (hasRequiredLib$b) return lib$i; - hasRequiredLib$b = 1; + var _isDigit$1 = function isDigit(code) { + return code >= 48 && code <= 57; + }; - Object.defineProperty(lib$i, "__esModule", { - value: true - }); - lib$i.readCodePoint = readCodePoint; - lib$i.readInt = readInt; - lib$i.readStringContents = readStringContents; + const forbiddenNumericSeparatorSiblings$1 = { + decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), + hex: new Set([46, 88, 95, 120]) + }; + const isAllowedNumericSeparatorSibling$1 = { + bin: ch => ch === 48 || ch === 49, + oct: ch => ch >= 48 && ch <= 55, + dec: ch => ch >= 48 && ch <= 57, + hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102 + }; - var _isDigit = function isDigit(code) { - return code >= 48 && code <= 57; - }; + function readStringContents$1(type, input, pos, lineStart, curLine, errors) { + const initialPos = pos; + const initialLineStart = lineStart; + const initialCurLine = curLine; + let out = ""; + let firstInvalidLoc = null; + let chunkStart = pos; + const { + length + } = input; - const forbiddenNumericSeparatorSiblings = { - decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), - hex: new Set([46, 88, 95, 120]) - }; - const isAllowedNumericSeparatorSibling = { - bin: ch => ch === 48 || ch === 49, - oct: ch => ch >= 48 && ch <= 55, - dec: ch => ch >= 48 && ch <= 57, - hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102 - }; + for (;;) { + if (pos >= length) { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + out += input.slice(chunkStart, pos); + break; + } - function readStringContents(type, input, pos, lineStart, curLine, errors) { - const initialPos = pos; - const initialLineStart = lineStart; - const initialCurLine = curLine; - let out = ""; - let firstInvalidLoc = null; - let chunkStart = pos; - const { - length - } = input; + const ch = input.charCodeAt(pos); - for (;;) { - if (pos >= length) { - errors.unterminated(initialPos, initialLineStart, initialCurLine); - out += input.slice(chunkStart, pos); - break; - } + if (isStringEnd$1(type, ch, input, pos)) { + out += input.slice(chunkStart, pos); + break; + } - const ch = input.charCodeAt(pos); + if (ch === 92) { + out += input.slice(chunkStart, pos); + const res = readEscapedChar$1(input, pos, lineStart, curLine, type === "template", errors); - if (isStringEnd(type, ch, input, pos)) { - out += input.slice(chunkStart, pos); - break; - } + if (res.ch === null && !firstInvalidLoc) { + firstInvalidLoc = { + pos, + lineStart, + curLine + }; + } else { + out += res.ch; + } - if (ch === 92) { - out += input.slice(chunkStart, pos); - const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors); + ({ + pos, + lineStart, + curLine + } = res); + chunkStart = pos; + } else if (ch === 8232 || ch === 8233) { + ++pos; + ++curLine; + lineStart = pos; + } else if (ch === 10 || ch === 13) { + if (type === "template") { + out += input.slice(chunkStart, pos) + "\n"; + ++pos; - if (res.ch === null && !firstInvalidLoc) { - firstInvalidLoc = { - pos, - lineStart, - curLine - }; - } else { - out += res.ch; - } + if (ch === 13 && input.charCodeAt(pos) === 10) { + ++pos; + } - ({ - pos, - lineStart, - curLine - } = res); - chunkStart = pos; - } else if (ch === 8232 || ch === 8233) { - ++pos; - ++curLine; - lineStart = pos; - } else if (ch === 10 || ch === 13) { - if (type === "template") { - out += input.slice(chunkStart, pos) + "\n"; - ++pos; - - if (ch === 13 && input.charCodeAt(pos) === 10) { - ++pos; - } + ++curLine; + chunkStart = lineStart = pos; + } else { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + } + } else { + ++pos; + } + } - ++curLine; - chunkStart = lineStart = pos; - } else { - errors.unterminated(initialPos, initialLineStart, initialCurLine); - } - } else { - ++pos; - } - } + return { + pos, + str: out, + firstInvalidLoc, + lineStart, + curLine, + containsInvalid: !!firstInvalidLoc + }; + } - return { - pos, - str: out, - firstInvalidLoc, - lineStart, - curLine, - containsInvalid: !!firstInvalidLoc - }; - } + function isStringEnd$1(type, ch, input, pos) { + if (type === "template") { + return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; + } - function isStringEnd(type, ch, input, pos) { - if (type === "template") { - return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; - } + return ch === (type === "double" ? 34 : 39); + } - return ch === (type === "double" ? 34 : 39); - } + function readEscapedChar$1(input, pos, lineStart, curLine, inTemplate, errors) { + const throwOnInvalid = !inTemplate; + pos++; - function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) { - const throwOnInvalid = !inTemplate; - pos++; + const res = ch => ({ + pos, + ch, + lineStart, + curLine + }); - const res = ch => ({ - pos, - ch, - lineStart, - curLine - }); + const ch = input.charCodeAt(pos++); - const ch = input.charCodeAt(pos++); + switch (ch) { + case 110: + return res("\n"); - switch (ch) { - case 110: - return res("\n"); + case 114: + return res("\r"); - case 114: - return res("\r"); + case 120: + { + let code; + ({ + code, + pos + } = readHexChar$1(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCharCode(code)); + } - case 120: - { - let code; - ({ - code, - pos - } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors)); - return res(code === null ? null : String.fromCharCode(code)); - } + case 117: + { + let code; + ({ + code, + pos + } = readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCodePoint(code)); + } - case 117: - { - let code; - ({ - code, - pos - } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors)); - return res(code === null ? null : String.fromCodePoint(code)); - } + case 116: + return res("\t"); - case 116: - return res("\t"); + case 98: + return res("\b"); - case 98: - return res("\b"); + case 118: + return res("\u000b"); - case 118: - return res("\u000b"); + case 102: + return res("\f"); - case 102: - return res("\f"); + case 13: + if (input.charCodeAt(pos) === 10) { + ++pos; + } - case 13: - if (input.charCodeAt(pos) === 10) { - ++pos; - } + case 10: + lineStart = pos; + ++curLine; - case 10: - lineStart = pos; - ++curLine; + case 8232: + case 8233: + return res(""); - case 8232: - case 8233: - return res(""); + case 56: + case 57: + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(pos - 1, lineStart, curLine); + } - case 56: - case 57: - if (inTemplate) { - return res(null); - } else { - errors.strictNumericEscape(pos - 1, lineStart, curLine); - } + default: + if (ch >= 48 && ch <= 55) { + const startPos = pos - 1; + const match = input.slice(startPos, pos + 2).match(/^[0-7]+/); + let octalStr = match[0]; + let octal = parseInt(octalStr, 8); - default: - if (ch >= 48 && ch <= 55) { - const startPos = pos - 1; - const match = input.slice(startPos, pos + 2).match(/^[0-7]+/); - let octalStr = match[0]; - let octal = parseInt(octalStr, 8); - - if (octal > 255) { - octalStr = octalStr.slice(0, -1); - octal = parseInt(octalStr, 8); - } + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } - pos += octalStr.length - 1; - const next = input.charCodeAt(pos); + pos += octalStr.length - 1; + const next = input.charCodeAt(pos); - if (octalStr !== "0" || next === 56 || next === 57) { - if (inTemplate) { - return res(null); - } else { - errors.strictNumericEscape(startPos, lineStart, curLine); - } - } + if (octalStr !== "0" || next === 56 || next === 57) { + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(startPos, lineStart, curLine); + } + } - return res(String.fromCharCode(octal)); - } + return res(String.fromCharCode(octal)); + } - return res(String.fromCharCode(ch)); - } - } + return res(String.fromCharCode(ch)); + } + } - function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { - const initialPos = pos; - let n; - ({ - n, - pos - } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid)); + function readHexChar$1(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { + const initialPos = pos; + let n; + ({ + n, + pos + } = readInt$1(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid)); - if (n === null) { - if (throwOnInvalid) { - errors.invalidEscapeSequence(initialPos, lineStart, curLine); - } else { - pos = initialPos - 1; - } - } + if (n === null) { + if (throwOnInvalid) { + errors.invalidEscapeSequence(initialPos, lineStart, curLine); + } else { + pos = initialPos - 1; + } + } - return { - code: n, - pos - }; - } + return { + code: n, + pos + }; + } - function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { - const start = pos; - const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct; - const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin; - let invalid = false; - let total = 0; + function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { + const start = pos; + const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings$1.hex : forbiddenNumericSeparatorSiblings$1.decBinOct; + const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling$1.hex : radix === 10 ? isAllowedNumericSeparatorSibling$1.dec : radix === 8 ? isAllowedNumericSeparatorSibling$1.oct : isAllowedNumericSeparatorSibling$1.bin; + let invalid = false; + let total = 0; - for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { - const code = input.charCodeAt(pos); - let val; + for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { + const code = input.charCodeAt(pos); + let val; - if (code === 95 && allowNumSeparator !== "bail") { - const prev = input.charCodeAt(pos - 1); - const next = input.charCodeAt(pos + 1); + if (code === 95 && allowNumSeparator !== "bail") { + const prev = input.charCodeAt(pos - 1); + const next = input.charCodeAt(pos + 1); - if (!allowNumSeparator) { - if (bailOnError) return { - n: null, - pos - }; - errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); - } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { - if (bailOnError) return { - n: null, - pos - }; - errors.unexpectedNumericSeparator(pos, lineStart, curLine); - } + if (!allowNumSeparator) { + if (bailOnError) return { + n: null, + pos + }; + errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); + } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { + if (bailOnError) return { + n: null, + pos + }; + errors.unexpectedNumericSeparator(pos, lineStart, curLine); + } - ++pos; - continue; - } + ++pos; + continue; + } - if (code >= 97) { - val = code - 97 + 10; - } else if (code >= 65) { - val = code - 65 + 10; - } else if (_isDigit(code)) { - val = code - 48; - } else { - val = Infinity; - } + if (code >= 97) { + val = code - 97 + 10; + } else if (code >= 65) { + val = code - 65 + 10; + } else if (_isDigit$1(code)) { + val = code - 48; + } else { + val = Infinity; + } - if (val >= radix) { - if (val <= 9 && bailOnError) { - return { - n: null, - pos - }; - } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { - val = 0; - } else if (forceLen) { - val = 0; - invalid = true; - } else { - break; - } - } + if (val >= radix) { + if (val <= 9 && bailOnError) { + return { + n: null, + pos + }; + } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { + val = 0; + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } - ++pos; - total = total * radix + val; - } + ++pos; + total = total * radix + val; + } - if (pos === start || len != null && pos - start !== len || invalid) { - return { - n: null, - pos - }; - } + if (pos === start || len != null && pos - start !== len || invalid) { + return { + n: null, + pos + }; + } - return { - n: total, - pos - }; - } + return { + n: total, + pos + }; + } - function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) { - const ch = input.charCodeAt(pos); - let code; + function readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors) { + const ch = input.charCodeAt(pos); + let code; - if (ch === 123) { - ++pos; - ({ - code, - pos - } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors)); - ++pos; - - if (code !== null && code > 0x10ffff) { - if (throwOnInvalid) { - errors.invalidCodePoint(pos, lineStart, curLine); - } else { - return { - code: null, - pos - }; - } - } - } else { - ({ - code, - pos - } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors)); - } + if (ch === 123) { + ++pos; + ({ + code, + pos + } = readHexChar$1(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors)); + ++pos; - return { - code, - pos - }; - } + if (code !== null && code > 0x10ffff) { + if (throwOnInvalid) { + errors.invalidCodePoint(pos, lineStart, curLine); + } else { + return { + code: null, + pos + }; + } + } + } else { + ({ + code, + pos + } = readHexChar$1(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors)); + } - - return lib$i; + return { + code, + pos + }; } var constants = {}; @@ -5405,7 +5395,7 @@ var _is = requireIs$1(); var _isValidIdentifier = isValidIdentifier$1; var _helperValidatorIdentifier = lib$j; - var _helperStringParser = requireLib$b(); + var _helperStringParser = lib$i; var _constants = constants; var _utils = requireUtils$2(); const defineType = (0, _utils.defineAliasedType)("Standardized"); diff --git a/bundle/putout.js b/bundle/putout.js index de4b10f..cb8e781 100644 --- a/bundle/putout.js +++ b/bundle/putout.js @@ -4694,348 +4694,358 @@ function isValidIdentifier(name, reserved = true) { var lib$i = {}; -Object.defineProperty(lib$i, "__esModule", { - value: true -}); -lib$i.readCodePoint = readCodePoint$1; -lib$i.readInt = readInt$1; -lib$i.readStringContents = readStringContents$1; +var hasRequiredLib$b; -var _isDigit$1 = function isDigit(code) { - return code >= 48 && code <= 57; -}; +function requireLib$b () { + if (hasRequiredLib$b) return lib$i; + hasRequiredLib$b = 1; -const forbiddenNumericSeparatorSiblings$1 = { - decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), - hex: new Set([46, 88, 95, 120]) -}; -const isAllowedNumericSeparatorSibling$1 = { - bin: ch => ch === 48 || ch === 49, - oct: ch => ch >= 48 && ch <= 55, - dec: ch => ch >= 48 && ch <= 57, - hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102 -}; + Object.defineProperty(lib$i, "__esModule", { + value: true + }); + lib$i.readCodePoint = readCodePoint; + lib$i.readInt = readInt; + lib$i.readStringContents = readStringContents; -function readStringContents$1(type, input, pos, lineStart, curLine, errors) { - const initialPos = pos; - const initialLineStart = lineStart; - const initialCurLine = curLine; - let out = ""; - let firstInvalidLoc = null; - let chunkStart = pos; - const { - length - } = input; + var _isDigit = function isDigit(code) { + return code >= 48 && code <= 57; + }; - for (;;) { - if (pos >= length) { - errors.unterminated(initialPos, initialLineStart, initialCurLine); - out += input.slice(chunkStart, pos); - break; - } + const forbiddenNumericSeparatorSiblings = { + decBinOct: new Set([46, 66, 69, 79, 95, 98, 101, 111]), + hex: new Set([46, 88, 95, 120]) + }; + const isAllowedNumericSeparatorSibling = { + bin: ch => ch === 48 || ch === 49, + oct: ch => ch >= 48 && ch <= 55, + dec: ch => ch >= 48 && ch <= 57, + hex: ch => ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102 + }; - const ch = input.charCodeAt(pos); + function readStringContents(type, input, pos, lineStart, curLine, errors) { + const initialPos = pos; + const initialLineStart = lineStart; + const initialCurLine = curLine; + let out = ""; + let firstInvalidLoc = null; + let chunkStart = pos; + const { + length + } = input; - if (isStringEnd$1(type, ch, input, pos)) { - out += input.slice(chunkStart, pos); - break; - } + for (;;) { + if (pos >= length) { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + out += input.slice(chunkStart, pos); + break; + } - if (ch === 92) { - out += input.slice(chunkStart, pos); - const res = readEscapedChar$1(input, pos, lineStart, curLine, type === "template", errors); + const ch = input.charCodeAt(pos); - if (res.ch === null && !firstInvalidLoc) { - firstInvalidLoc = { - pos, - lineStart, - curLine - }; - } else { - out += res.ch; - } + if (isStringEnd(type, ch, input, pos)) { + out += input.slice(chunkStart, pos); + break; + } - ({ - pos, - lineStart, - curLine - } = res); - chunkStart = pos; - } else if (ch === 8232 || ch === 8233) { - ++pos; - ++curLine; - lineStart = pos; - } else if (ch === 10 || ch === 13) { - if (type === "template") { - out += input.slice(chunkStart, pos) + "\n"; - ++pos; + if (ch === 92) { + out += input.slice(chunkStart, pos); + const res = readEscapedChar(input, pos, lineStart, curLine, type === "template", errors); - if (ch === 13 && input.charCodeAt(pos) === 10) { - ++pos; - } + if (res.ch === null && !firstInvalidLoc) { + firstInvalidLoc = { + pos, + lineStart, + curLine + }; + } else { + out += res.ch; + } - ++curLine; - chunkStart = lineStart = pos; - } else { - errors.unterminated(initialPos, initialLineStart, initialCurLine); - } - } else { - ++pos; - } - } + ({ + pos, + lineStart, + curLine + } = res); + chunkStart = pos; + } else if (ch === 8232 || ch === 8233) { + ++pos; + ++curLine; + lineStart = pos; + } else if (ch === 10 || ch === 13) { + if (type === "template") { + out += input.slice(chunkStart, pos) + "\n"; + ++pos; + + if (ch === 13 && input.charCodeAt(pos) === 10) { + ++pos; + } - return { - pos, - str: out, - firstInvalidLoc, - lineStart, - curLine, - containsInvalid: !!firstInvalidLoc - }; -} + ++curLine; + chunkStart = lineStart = pos; + } else { + errors.unterminated(initialPos, initialLineStart, initialCurLine); + } + } else { + ++pos; + } + } -function isStringEnd$1(type, ch, input, pos) { - if (type === "template") { - return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; - } + return { + pos, + str: out, + firstInvalidLoc, + lineStart, + curLine, + containsInvalid: !!firstInvalidLoc + }; + } - return ch === (type === "double" ? 34 : 39); -} + function isStringEnd(type, ch, input, pos) { + if (type === "template") { + return ch === 96 || ch === 36 && input.charCodeAt(pos + 1) === 123; + } -function readEscapedChar$1(input, pos, lineStart, curLine, inTemplate, errors) { - const throwOnInvalid = !inTemplate; - pos++; + return ch === (type === "double" ? 34 : 39); + } - const res = ch => ({ - pos, - ch, - lineStart, - curLine - }); + function readEscapedChar(input, pos, lineStart, curLine, inTemplate, errors) { + const throwOnInvalid = !inTemplate; + pos++; - const ch = input.charCodeAt(pos++); + const res = ch => ({ + pos, + ch, + lineStart, + curLine + }); - switch (ch) { - case 110: - return res("\n"); + const ch = input.charCodeAt(pos++); - case 114: - return res("\r"); + switch (ch) { + case 110: + return res("\n"); - case 120: - { - let code; - ({ - code, - pos - } = readHexChar$1(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors)); - return res(code === null ? null : String.fromCharCode(code)); - } + case 114: + return res("\r"); - case 117: - { - let code; - ({ - code, - pos - } = readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors)); - return res(code === null ? null : String.fromCodePoint(code)); - } + case 120: + { + let code; + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, 2, false, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCharCode(code)); + } - case 116: - return res("\t"); + case 117: + { + let code; + ({ + code, + pos + } = readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors)); + return res(code === null ? null : String.fromCodePoint(code)); + } - case 98: - return res("\b"); + case 116: + return res("\t"); - case 118: - return res("\u000b"); + case 98: + return res("\b"); - case 102: - return res("\f"); + case 118: + return res("\u000b"); - case 13: - if (input.charCodeAt(pos) === 10) { - ++pos; - } + case 102: + return res("\f"); - case 10: - lineStart = pos; - ++curLine; + case 13: + if (input.charCodeAt(pos) === 10) { + ++pos; + } - case 8232: - case 8233: - return res(""); + case 10: + lineStart = pos; + ++curLine; - case 56: - case 57: - if (inTemplate) { - return res(null); - } else { - errors.strictNumericEscape(pos - 1, lineStart, curLine); - } + case 8232: + case 8233: + return res(""); - default: - if (ch >= 48 && ch <= 55) { - const startPos = pos - 1; - const match = input.slice(startPos, pos + 2).match(/^[0-7]+/); - let octalStr = match[0]; - let octal = parseInt(octalStr, 8); + case 56: + case 57: + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(pos - 1, lineStart, curLine); + } - if (octal > 255) { - octalStr = octalStr.slice(0, -1); - octal = parseInt(octalStr, 8); - } + default: + if (ch >= 48 && ch <= 55) { + const startPos = pos - 1; + const match = input.slice(startPos, pos + 2).match(/^[0-7]+/); + let octalStr = match[0]; + let octal = parseInt(octalStr, 8); + + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } - pos += octalStr.length - 1; - const next = input.charCodeAt(pos); + pos += octalStr.length - 1; + const next = input.charCodeAt(pos); - if (octalStr !== "0" || next === 56 || next === 57) { - if (inTemplate) { - return res(null); - } else { - errors.strictNumericEscape(startPos, lineStart, curLine); - } - } + if (octalStr !== "0" || next === 56 || next === 57) { + if (inTemplate) { + return res(null); + } else { + errors.strictNumericEscape(startPos, lineStart, curLine); + } + } - return res(String.fromCharCode(octal)); - } + return res(String.fromCharCode(octal)); + } - return res(String.fromCharCode(ch)); - } -} + return res(String.fromCharCode(ch)); + } + } -function readHexChar$1(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { - const initialPos = pos; - let n; - ({ - n, - pos - } = readInt$1(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid)); + function readHexChar(input, pos, lineStart, curLine, len, forceLen, throwOnInvalid, errors) { + const initialPos = pos; + let n; + ({ + n, + pos + } = readInt(input, pos, lineStart, curLine, 16, len, forceLen, false, errors, !throwOnInvalid)); - if (n === null) { - if (throwOnInvalid) { - errors.invalidEscapeSequence(initialPos, lineStart, curLine); - } else { - pos = initialPos - 1; - } - } + if (n === null) { + if (throwOnInvalid) { + errors.invalidEscapeSequence(initialPos, lineStart, curLine); + } else { + pos = initialPos - 1; + } + } - return { - code: n, - pos - }; -} + return { + code: n, + pos + }; + } -function readInt$1(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { - const start = pos; - const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings$1.hex : forbiddenNumericSeparatorSiblings$1.decBinOct; - const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling$1.hex : radix === 10 ? isAllowedNumericSeparatorSibling$1.dec : radix === 8 ? isAllowedNumericSeparatorSibling$1.oct : isAllowedNumericSeparatorSibling$1.bin; - let invalid = false; - let total = 0; + function readInt(input, pos, lineStart, curLine, radix, len, forceLen, allowNumSeparator, errors, bailOnError) { + const start = pos; + const forbiddenSiblings = radix === 16 ? forbiddenNumericSeparatorSiblings.hex : forbiddenNumericSeparatorSiblings.decBinOct; + const isAllowedSibling = radix === 16 ? isAllowedNumericSeparatorSibling.hex : radix === 10 ? isAllowedNumericSeparatorSibling.dec : radix === 8 ? isAllowedNumericSeparatorSibling.oct : isAllowedNumericSeparatorSibling.bin; + let invalid = false; + let total = 0; - for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { - const code = input.charCodeAt(pos); - let val; + for (let i = 0, e = len == null ? Infinity : len; i < e; ++i) { + const code = input.charCodeAt(pos); + let val; - if (code === 95 && allowNumSeparator !== "bail") { - const prev = input.charCodeAt(pos - 1); - const next = input.charCodeAt(pos + 1); + if (code === 95 && allowNumSeparator !== "bail") { + const prev = input.charCodeAt(pos - 1); + const next = input.charCodeAt(pos + 1); - if (!allowNumSeparator) { - if (bailOnError) return { - n: null, - pos - }; - errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); - } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { - if (bailOnError) return { - n: null, - pos - }; - errors.unexpectedNumericSeparator(pos, lineStart, curLine); - } + if (!allowNumSeparator) { + if (bailOnError) return { + n: null, + pos + }; + errors.numericSeparatorInEscapeSequence(pos, lineStart, curLine); + } else if (Number.isNaN(next) || !isAllowedSibling(next) || forbiddenSiblings.has(prev) || forbiddenSiblings.has(next)) { + if (bailOnError) return { + n: null, + pos + }; + errors.unexpectedNumericSeparator(pos, lineStart, curLine); + } - ++pos; - continue; - } + ++pos; + continue; + } - if (code >= 97) { - val = code - 97 + 10; - } else if (code >= 65) { - val = code - 65 + 10; - } else if (_isDigit$1(code)) { - val = code - 48; - } else { - val = Infinity; - } + if (code >= 97) { + val = code - 97 + 10; + } else if (code >= 65) { + val = code - 65 + 10; + } else if (_isDigit(code)) { + val = code - 48; + } else { + val = Infinity; + } - if (val >= radix) { - if (val <= 9 && bailOnError) { - return { - n: null, - pos - }; - } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { - val = 0; - } else if (forceLen) { - val = 0; - invalid = true; - } else { - break; - } - } + if (val >= radix) { + if (val <= 9 && bailOnError) { + return { + n: null, + pos + }; + } else if (val <= 9 && errors.invalidDigit(pos, lineStart, curLine, radix)) { + val = 0; + } else if (forceLen) { + val = 0; + invalid = true; + } else { + break; + } + } - ++pos; - total = total * radix + val; - } + ++pos; + total = total * radix + val; + } - if (pos === start || len != null && pos - start !== len || invalid) { - return { - n: null, - pos - }; - } + if (pos === start || len != null && pos - start !== len || invalid) { + return { + n: null, + pos + }; + } - return { - n: total, - pos - }; -} + return { + n: total, + pos + }; + } -function readCodePoint$1(input, pos, lineStart, curLine, throwOnInvalid, errors) { - const ch = input.charCodeAt(pos); - let code; + function readCodePoint(input, pos, lineStart, curLine, throwOnInvalid, errors) { + const ch = input.charCodeAt(pos); + let code; - if (ch === 123) { - ++pos; - ({ - code, - pos - } = readHexChar$1(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors)); - ++pos; + if (ch === 123) { + ++pos; + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, input.indexOf("}", pos) - pos, true, throwOnInvalid, errors)); + ++pos; + + if (code !== null && code > 0x10ffff) { + if (throwOnInvalid) { + errors.invalidCodePoint(pos, lineStart, curLine); + } else { + return { + code: null, + pos + }; + } + } + } else { + ({ + code, + pos + } = readHexChar(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors)); + } - if (code !== null && code > 0x10ffff) { - if (throwOnInvalid) { - errors.invalidCodePoint(pos, lineStart, curLine); - } else { - return { - code: null, - pos - }; - } - } - } else { - ({ - code, - pos - } = readHexChar$1(input, pos, lineStart, curLine, 4, false, throwOnInvalid, errors)); - } + return { + code, + pos + }; + } - return { - code, - pos - }; + + return lib$i; } var constants = {}; @@ -5389,7 +5399,7 @@ function requireCore$2 () { var _is = requireIs$1(); var _isValidIdentifier = isValidIdentifier$1; var _helperValidatorIdentifier = lib$j; - var _helperStringParser = lib$i; + var _helperStringParser = requireLib$b(); var _constants = constants; var _utils = requireUtils$2(); const defineType = (0, _utils.defineAliasedType)("Standardized"); diff --git a/package.json b/package.json index f3cd4fa..e64d5e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@putout/bundle", - "version": "1.5.3", + "version": "1.6.0", "type": "module", "commitType": "colon", "author": "coderaiser (https://github.com/coderaiser)",