@agoric/babel-generator
Advanced tools
Comparing version 7.17.5 to 7.17.6
@@ -7,9 +7,2 @@ "use strict"; | ||
exports.default = void 0; | ||
var charcodes = _interopRequireWildcard(require("charcodes"), true); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const SPACES_RE = /^[ \t]+$/; | ||
@@ -170,3 +163,3 @@ | ||
const lastCp = last.charCodeAt(0); | ||
if (lastCp !== charcodes.lineFeed) return; | ||
if (lastCp !== 10) return; | ||
@@ -173,0 +166,0 @@ if (queue.length > 1) { |
@@ -14,8 +14,2 @@ "use strict"; | ||
var charCodes = _interopRequireWildcard(require("charcodes"), true); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function File(node) { | ||
@@ -52,3 +46,3 @@ if (node.program) { | ||
this.source("end", node.loc); | ||
if (!this.endsWith(charCodes.lineFeed)) this.newline(); | ||
if (!this.endsWith(10)) this.newline(); | ||
this.rightBrace(); | ||
@@ -55,0 +49,0 @@ } else { |
@@ -18,8 +18,2 @@ "use strict"; | ||
var charCodes = _interopRequireWildcard(require("charcodes"), true); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const { | ||
@@ -85,3 +79,3 @@ isExportDefaultDeclaration, | ||
this.dedent(); | ||
if (!this.endsWith(charCodes.lineFeed)) this.newline(); | ||
if (!this.endsWith(10)) this.newline(); | ||
this.rightBrace(); | ||
@@ -88,0 +82,0 @@ } |
@@ -27,8 +27,2 @@ "use strict"; | ||
var charCodes = _interopRequireWildcard(require("charcodes"), true); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const { | ||
@@ -74,3 +68,3 @@ isFor, | ||
if (node.alternate) { | ||
if (this.endsWith(charCodes.rightCurlyBrace)) this.space(); | ||
if (this.endsWith(125)) this.space(); | ||
this.word("else"); | ||
@@ -275,3 +269,3 @@ this.space(); | ||
if (this.endsWith(charCodes.lineFeed)) { | ||
if (this.endsWith(10)) { | ||
for (let i = 0; i < 4; i++) this.space(true); | ||
@@ -285,3 +279,3 @@ } | ||
if (this.endsWith(charCodes.lineFeed)) { | ||
if (this.endsWith(10)) { | ||
for (let i = 0; i < 6; i++) this.space(true); | ||
@@ -288,0 +282,0 @@ } |
@@ -16,8 +16,2 @@ "use strict"; | ||
var charCodes = _interopRequireWildcard(require("charcodes"), true); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
const { | ||
@@ -95,3 +89,3 @@ isProgram, | ||
if (lastCp !== charCodes.space && lastCp !== charCodes.lineFeed) { | ||
if (lastCp !== 32 && lastCp !== 10) { | ||
this._space(); | ||
@@ -103,3 +97,3 @@ } | ||
word(str) { | ||
if (this._endsWithWord || this.endsWith(charCodes.slash) && str.charCodeAt(0) === charCodes.slash) { | ||
if (this._endsWithWord || this.endsWith(47) && str.charCodeAt(0) === 47) { | ||
this._space(); | ||
@@ -117,3 +111,3 @@ } | ||
this.word(str); | ||
this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== charCodes.dot; | ||
this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46; | ||
} | ||
@@ -125,3 +119,3 @@ | ||
if (str === "--" && lastChar === charCodes.exclamationMark || strFirst === charCodes.plusSign && lastChar === charCodes.plusSign || strFirst === charCodes.dash && lastChar === charCodes.dash || strFirst === charCodes.dot && this._endsWithInteger) { | ||
if (str === "--" && lastChar === 33 || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) { | ||
this._space(); | ||
@@ -144,5 +138,5 @@ } | ||
const charBeforeNewline = this.endsWithCharAndNewline(); | ||
if (charBeforeNewline === charCodes.lineFeed) return; | ||
if (charBeforeNewline === 10) return; | ||
if (charBeforeNewline === charCodes.leftCurlyBrace || charBeforeNewline === charCodes.colon) { | ||
if (charBeforeNewline === 123 || charBeforeNewline === 58) { | ||
i--; | ||
@@ -211,3 +205,3 @@ } | ||
_maybeIndent(str) { | ||
if (this._indent && this.endsWith(charCodes.lineFeed) && str.charCodeAt(0) !== charCodes.lineFeed) { | ||
if (this._indent && this.endsWith(10) && str.charCodeAt(0) !== 10) { | ||
this._buf.queue(this._getIndent()); | ||
@@ -497,3 +491,3 @@ } | ||
if (lastCharCode !== charCodes.leftSquareBracket && lastCharCode !== charCodes.leftCurlyBrace) { | ||
if (lastCharCode !== 91 && lastCharCode !== 123) { | ||
this.space(); | ||
@@ -516,3 +510,3 @@ } | ||
if (this.endsWith(charCodes.slash)) this._space(); | ||
if (this.endsWith(47)) this._space(); | ||
this.withSource("start", comment.loc, () => { | ||
@@ -528,3 +522,3 @@ this._append(val); | ||
if (inlinePureAnnotation && comments.length === 1 && PURE_ANNOTATION_RE.test(comments[0].value)) { | ||
this._printComment(comments[0], this._buf.hasContent() && !this.endsWith(charCodes.lineFeed)); | ||
this._printComment(comments[0], this._buf.hasContent() && !this.endsWith(10)); | ||
} else { | ||
@@ -531,0 +525,0 @@ for (const comment of comments) { |
{ | ||
"name": "@agoric/babel-generator", | ||
"version": "7.17.5", | ||
"version": "7.17.6", | ||
"description": "Turns an AST into code.", | ||
@@ -5,0 +5,0 @@ "author": "The Babel Team (https://babel.dev/team)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
117302
4246