From d05de3a116c18cec887d2f3ac38508add73fd62d Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 08:53:08 -0600 Subject: [PATCH 01/31] Allow either Mobile-Expensify or App CPs --- .github/workflows/cherryPick.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index d6f71d91c51ce..af528cec7031b 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -32,8 +32,8 @@ jobs: - name: Verify repository run: | - if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ]; then - echo "::error::❌ Cherry picks are only supported for the Expensify/App repository. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" + if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ] && [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]; then + echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" exit 1 fi From 82544f30331bb4ed070448bd2c3f963830f1d928 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 08:58:58 -0600 Subject: [PATCH 02/31] Update getPullRequestDetails --- .../javascript/getPullRequestDetails/action.yml | 3 +++ .../getPullRequestDetails/getPullRequestDetails.ts | 10 +++++++--- .github/workflows/cherryPick.yml | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/javascript/getPullRequestDetails/action.yml b/.github/actions/javascript/getPullRequestDetails/action.yml index d931d101b5da6..e019a849fcec2 100644 --- a/.github/actions/javascript/getPullRequestDetails/action.yml +++ b/.github/actions/javascript/getPullRequestDetails/action.yml @@ -10,6 +10,9 @@ inputs: USER: description: The creator of the pull request required: true + REPO_FULL_NAME: + description: The full repository name in the format owner/repo + required: true outputs: MERGE_COMMIT_SHA: description: 'The merge_commit_sha of the given pull request' diff --git a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts index 8e285389e3f7e..bf9a6cbe6b35e 100644 --- a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts +++ b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts @@ -6,9 +6,12 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; type PullRequest = Awaited>['data']; +const repoFullName = core.getInput('REPO_FULL_NAME', {required: true}); +const [owner, repo] = repoFullName.split('/'); + const DEFAULT_PAYLOAD = { - owner: CONST.GITHUB_OWNER, - repo: CONST.APP_REPO, + owner, + repo, }; const pullRequestNumber = getJSONInput('PULL_REQUEST_NUMBER', {required: false}, null); @@ -38,7 +41,8 @@ function outputMergeActor(PR: PullRequest) { * Output forked repo URL if PR includes changes from a fork. */ function outputForkedRepoUrl(PR: PullRequest) { - if (PR.head?.repo?.html_url === CONST.APP_REPO_URL) { + const repoUrl = `https://github.com/${repoFullName}`; + if (PR.head?.repo?.html_url === repoUrl) { core.setOutput('FORKED_REPO_URL', ''); } else { core.setOutput('FORKED_REPO_URL', `${PR.head?.repo?.html_url}.git`); diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index af528cec7031b..56651fa45f6ff 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -115,6 +115,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} USER: ${{ github.actor }} PULL_REQUEST_NUMBER: ${{ steps.getPRInfo.outputs.PR_NUMBER }} + REPO_FULL_NAME: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }} - name: Cherry-pick the Mobile-Expensify version bump to Mobile-Expensify staging working-directory: Mobile-Expensify From f28fd711c78c6c9e7790137959ddb85aca105615 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 09:07:35 -0600 Subject: [PATCH 03/31] Rebuild actions, clean up code --- .../javascript/authorChecklist/index.js | 452 +++++++----------- .../getPullRequestDetails/action.yml | 2 +- .../javascript/getPullRequestDetails/index.js | 9 +- .github/workflows/cherryPick.yml | 2 +- 4 files changed, 185 insertions(+), 280 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 7d6bfa1e45843..617fcb7203f05 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -18590,7 +18590,6 @@ function ExportNamespaceSpecifier(node) { } let warningShown = false; function _printAttributes(node, hasPreviousBrace) { - var _node$extra; const { importAttributesKeyword } = this.format; @@ -18598,7 +18597,7 @@ function _printAttributes(node, hasPreviousBrace) { attributes, assertions } = node; - if (attributes && !importAttributesKeyword && node.extra && (node.extra.deprecatedAssertSyntax || node.extra.deprecatedWithLegacySyntax) && !warningShown) { + if (attributes && !importAttributesKeyword && !warningShown) { warningShown = true; console.warn(`\ You are using import attributes, without specifying the desired output syntax. @@ -18611,7 +18610,7 @@ Please specify the "importAttributesKeyword" generator option, whose value can b const useAssertKeyword = importAttributesKeyword === "assert" || !importAttributesKeyword && assertions; this.word(useAssertKeyword ? "assert" : "with"); this.space(); - if (!useAssertKeyword && (importAttributesKeyword === "with-legacy" || !importAttributesKeyword && (_node$extra = node.extra) != null && _node$extra.deprecatedWithLegacySyntax)) { + if (!useAssertKeyword && importAttributesKeyword !== "with") { this.printList(attributes || assertions); return; } @@ -20082,7 +20081,7 @@ function tsPrintClassMemberModifiers(node) { this.word("static"); this.space(); } - printModifiersList(this, node, [!isPrivateField && node.abstract && "abstract", !isPrivateField && node.override && "override", (isPublicField || isPrivateField) && node.readonly && "readonly"]); + printModifiersList(this, node, [!isPrivateField && node.override && "override", !isPrivateField && node.abstract && "abstract", (isPublicField || isPrivateField) && node.readonly && "readonly"]); } function printBraced(printer, node, cb) { printer.token("{"); @@ -20125,8 +20124,7 @@ function printModifiersList(printer, node, modifiers) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports["default"] = void 0; -exports.generate = generate; +exports["default"] = generate; var _sourceMap = __nccwpck_require__(6280); var _printer = __nccwpck_require__(5637); function normalizeOptions(code, opts, ast) { @@ -20229,7 +20227,6 @@ function generate(ast, opts = {}, code) { const printer = new _printer.default(format, map, ast.tokens, typeof code === "string" ? code : null); return printer.generate(ast); } -var _default = exports["default"] = generate; //# sourceMappingURL=index.js.map @@ -22725,7 +22722,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { - if (-1 !== e.indexOf(n)) continue; + if (e.includes(n)) continue; t[n] = r[n]; } return t; @@ -22806,6 +22803,7 @@ var StandardErrors = { AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.", AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.", AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.", + AwaitNotInAsyncFunction: "'await' is only allowed within async functions.", BadGetterArity: "A 'get' accessor must not have any formal parameters.", BadSetterArity: "A 'set' accessor must have exactly one formal parameter.", BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.", @@ -23008,7 +23006,6 @@ var StandardErrors = { }) => `Identifier '${identifierName}' has already been declared.`, YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.", YieldInParameter: "Yield expression is not allowed in formal parameters.", - YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.", ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0." }; var StrictModeErrors = { @@ -23152,7 +23149,6 @@ function createDefaultOptions() { allowImportExportEverywhere: false, allowSuperOutsideMethod: false, allowUndeclaredExports: false, - allowYieldOutsideFunction: false, plugins: [], strictMode: null, ranges: false, @@ -23207,7 +23203,7 @@ function toESTreeLocation(node) { var estree = superClass => class ESTreeParserMixin extends superClass { parse() { const file = toESTreeLocation(super.parse()); - if (this.optionFlags & 256) { + if (this.optionFlags & 128) { file.tokens = file.tokens.map(toESTreeLocation); } return file; @@ -23388,16 +23384,6 @@ var estree = superClass => class ESTreeParserMixin extends superClass { propertyNode.computed = false; return propertyNode; } - parseClassAccessorProperty(node) { - const accessorPropertyNode = super.parseClassAccessorProperty(node); - { - if (!this.getPluginOption("estree", "classFeatures")) { - return accessorPropertyNode; - } - } - accessorPropertyNode.type = "AccessorProperty"; - return accessorPropertyNode; - } parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) { const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor); if (node) { @@ -25103,7 +25089,7 @@ class Tokenizer extends CommentsParser { this.tokens = []; this.errorHandlers_readInt = { invalidDigit: (pos, lineStart, curLine, radix) => { - if (!(this.optionFlags & 2048)) return false; + if (!(this.optionFlags & 1024)) return false; this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), { radix }); @@ -25144,7 +25130,7 @@ class Tokenizer extends CommentsParser { } next() { this.checkKeywordEscapes(); - if (this.optionFlags & 256) { + if (this.optionFlags & 128) { this.pushToken(new Token(this.state)); } this.state.lastTokEndLoc = this.state.endLoc; @@ -25260,7 +25246,7 @@ class Tokenizer extends CommentsParser { end: this.sourceToOffsetPos(end + commentEnd.length), loc: new SourceLocation(startLoc, this.state.curPosition()) }; - if (this.optionFlags & 256) this.pushToken(comment); + if (this.optionFlags & 128) this.pushToken(comment); return comment; } skipLineComment(startSkip) { @@ -25283,12 +25269,12 @@ class Tokenizer extends CommentsParser { end: this.sourceToOffsetPos(end), loc: new SourceLocation(startLoc, this.state.curPosition()) }; - if (this.optionFlags & 256) this.pushToken(comment); + if (this.optionFlags & 128) this.pushToken(comment); return comment; } skipSpace() { const spaceStart = this.state.pos; - const comments = this.optionFlags & 4096 ? [] : null; + const comments = this.optionFlags & 2048 ? [] : null; loop: while (this.state.pos < this.length) { const ch = this.input.charCodeAt(this.state.pos); switch (ch) { @@ -25335,7 +25321,7 @@ class Tokenizer extends CommentsParser { default: if (isWhitespace(ch)) { ++this.state.pos; - } else if (ch === 45 && !this.inModule && this.optionFlags & 8192) { + } else if (ch === 45 && !this.inModule && this.optionFlags & 4096) { const pos = this.state.pos; if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) { const comment = this.skipLineComment(3); @@ -25346,7 +25332,7 @@ class Tokenizer extends CommentsParser { } else { break loop; } - } else if (ch === 60 && !this.inModule && this.optionFlags & 8192) { + } else if (ch === 60 && !this.inModule && this.optionFlags & 4096) { const pos = this.state.pos; if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) { const comment = this.skipLineComment(4); @@ -26054,7 +26040,7 @@ class Tokenizer extends CommentsParser { raise(toParseError, at, details = {}) { const loc = at instanceof Position ? at : at.loc.start; const error = toParseError(loc, details); - if (!(this.optionFlags & 2048)) throw error; + if (!(this.optionFlags & 1024)) throw error; if (!this.isLookahead) this.state.errors.push(error); return error; } @@ -26512,9 +26498,6 @@ class UtilParser extends Tokenizer { if (this.inModule) { paramFlags |= 2; } - if (this.optionFlags & 32) { - paramFlags |= 1; - } this.scope.enter(1); this.prodParam.enter(paramFlags); } @@ -26541,7 +26524,7 @@ class Node { this.start = pos; this.end = 0; this.loc = new SourceLocation(loc); - if ((parser == null ? void 0 : parser.optionFlags) & 128) this.range = [pos, 0]; + if ((parser == null ? void 0 : parser.optionFlags) & 64) this.range = [pos, 0]; if (parser != null && parser.filename) this.loc.filename = parser.filename; } } @@ -26629,8 +26612,8 @@ class NodeUtils extends UtilParser { node.type = type; node.end = endLoc.index; node.loc.end = endLoc; - if (this.optionFlags & 128) node.range[1] = endLoc.index; - if (this.optionFlags & 4096) { + if (this.optionFlags & 64) node.range[1] = endLoc.index; + if (this.optionFlags & 2048) { this.processComment(node); } return node; @@ -26638,12 +26621,12 @@ class NodeUtils extends UtilParser { resetStartLocation(node, startLoc) { node.start = startLoc.index; node.loc.start = startLoc; - if (this.optionFlags & 128) node.range[0] = startLoc.index; + if (this.optionFlags & 64) node.range[0] = startLoc.index; } resetEndLocation(node, endLoc = this.state.lastTokEndLoc) { node.end = endLoc.index; node.loc.end = endLoc; - if (this.optionFlags & 128) node.range[1] = endLoc.index; + if (this.optionFlags & 64) node.range[1] = endLoc.index; } resetStartLocationFromNode(node, locationNode) { this.resetStartLocation(node, locationNode.loc.start); @@ -27473,7 +27456,8 @@ var flow = superClass => class FlowParserMixin extends superClass { } } flowParseQualifiedTypeIdentifier(startLoc, id) { - startLoc != null ? startLoc : startLoc = this.state.startLoc; + var _startLoc; + (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc; let node = id || this.flowParseRestrictedIdentifier(true); while (this.eat(16)) { const node2 = this.startNodeAt(startLoc); @@ -29929,7 +29913,14 @@ class LValParser extends NodeUtils { for (let i = 0; i <= end; i++) { const elt = exprList[i]; if (!elt) continue; - this.toAssignableListItem(exprList, i, isLHS); + if (elt.type === "SpreadElement") { + elt.type = "RestElement"; + const arg = elt.argument; + this.checkToRestConversion(arg, true); + this.toAssignable(arg, isLHS); + } else { + this.toAssignable(elt, isLHS); + } if (elt.type === "RestElement") { if (i < end) { this.raise(Errors.RestTrailingComma, elt); @@ -29939,17 +29930,6 @@ class LValParser extends NodeUtils { } } } - toAssignableListItem(exprList, index, isLHS) { - const node = exprList[index]; - if (node.type === "SpreadElement") { - node.type = "RestElement"; - const arg = node.argument; - this.checkToRestConversion(arg, true); - this.toAssignable(arg, isLHS); - } else { - this.toAssignable(node, isLHS); - } - } isAssignable(node, isBinding) { switch (node.type) { case "Identifier": @@ -30045,15 +30025,13 @@ class LValParser extends NodeUtils { } } else { const decorators = []; - if (flags & 2) { - if (this.match(26) && this.hasPlugin("decorators")) { - this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc); - } - while (this.match(26)) { - decorators.push(this.parseDecorator()); - } + if (this.match(26) && this.hasPlugin("decorators")) { + this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc); } - elts.push(this.parseBindingElement(flags, decorators)); + while (this.match(26)) { + decorators.push(this.parseDecorator()); + } + elts.push(this.parseAssignableListItem(flags, decorators)); } } return elts; @@ -30083,7 +30061,7 @@ class LValParser extends NodeUtils { prop.method = false; return this.parseObjPropValue(prop, startLoc, false, false, true, false); } - parseBindingElement(flags, decorators) { + parseAssignableListItem(flags, decorators) { const left = this.parseMaybeDefault(); if (this.hasPlugin("flow") || flags & 2) { this.parseFunctionParamType(left); @@ -30098,8 +30076,9 @@ class LValParser extends NodeUtils { return param; } parseMaybeDefault(startLoc, left) { - startLoc != null ? startLoc : startLoc = this.state.startLoc; - left = left != null ? left : this.parseBindingAtom(); + var _startLoc, _left; + (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc; + left = (_left = left) != null ? _left : this.parseBindingAtom(); if (!this.eat(29)) return left; const node = this.startNodeAt(startLoc); node.left = left; @@ -30289,9 +30268,6 @@ const TSErrors = ParseErrorEnum`typescript`({ IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.", IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.", InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.", - InvalidHeritageClauseType: ({ - token - }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`, InvalidModifierOnTypeMember: ({ modifier }) => `'${modifier}' modifier cannot appear on a type member.`, @@ -31344,8 +31320,8 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { tsParseHeritageClause(token) { const originalStartLoc = this.state.startLoc; const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => { + const node = this.startNode(); { - const node = this.startNode(); node.expression = this.tsParseEntityName(1 | 2); if (this.match(47)) { node.typeParameters = this.tsParseTypeArguments(); @@ -31745,7 +31721,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { if (this.tsIsDeclarationStart()) return false; return super.isExportDefaultSpecifier(); } - parseBindingElement(flags, decorators) { + parseAssignableListItem(flags, decorators) { const startLoc = this.state.startLoc; const modified = {}; this.tsParseModifiers({ @@ -32171,15 +32147,18 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { return super.shouldParseExportDeclaration(); } parseConditional(expr, startLoc, refExpressionErrors) { - if (!this.match(17)) return expr; - if (this.state.maybeInArrowParameters) { - const nextCh = this.lookaheadCharCode(); - if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) { - this.setOptionalParametersError(refExpressionErrors); - return expr; + if (!this.state.maybeInArrowParameters || !this.match(17)) { + return super.parseConditional(expr, startLoc, refExpressionErrors); + } + const result = this.tryParse(() => super.parseConditional(expr, startLoc)); + if (!result.node) { + if (result.error) { + super.setOptionalParametersError(refExpressionErrors, result.error); } + return expr; } - return super.parseConditional(expr, startLoc, refExpressionErrors); + if (result.error) this.state = result.failState; + return result.node; } parseParenItem(node, startLoc) { const newNode = super.parseParenItem(node, startLoc); @@ -32396,8 +32375,8 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { throw ((_jsx3 = jsx) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error); } reportReservedArrowTypeParam(node) { - var _node$extra2; - if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra2 = node.extra) != null && _node$extra2.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { + var _node$extra; + if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { this.raise(TSErrors.ReservedArrowTypeParam, node); } } @@ -32497,6 +32476,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { case "TSParameterProperty": return "parameter"; case "TSNonNullExpression": + case "TSInstantiationExpression": return "expression"; case "TSAsExpression": case "TSSatisfiesExpression": @@ -32582,12 +32562,14 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { } return type; } - toAssignableListItem(exprList, index, isLHS) { - const node = exprList[index]; - if (node.type === "TSTypeCastExpression") { - exprList[index] = this.typeCastToParameter(node); + toAssignableList(exprList, trailingCommaLoc, isLHS) { + for (let i = 0; i < exprList.length; i++) { + const expr = exprList[i]; + if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") { + exprList[i] = this.typeCastToParameter(expr); + } } - super.toAssignableListItem(exprList, index, isLHS); + super.toAssignableList(exprList, trailingCommaLoc, isLHS); } typeCastToParameter(node) { node.expression.typeAnnotation = node.typeAnnotation; @@ -33156,18 +33138,18 @@ const mixinPlugins = { }; const mixinPluginNames = Object.keys(mixinPlugins); class ExpressionParser extends LValParser { - checkProto(prop, isRecord, sawProto, refExpressionErrors) { + checkProto(prop, isRecord, protoRef, refExpressionErrors) { if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) { - return sawProto; + return; } const key = prop.key; const name = key.type === "Identifier" ? key.name : key.value; if (name === "__proto__") { if (isRecord) { this.raise(Errors.RecordNoProto, key); - return true; + return; } - if (sawProto) { + if (protoRef.used) { if (refExpressionErrors) { if (refExpressionErrors.doubleProtoLoc === null) { refExpressionErrors.doubleProtoLoc = key.loc.start; @@ -33176,9 +33158,8 @@ class ExpressionParser extends LValParser { this.raise(Errors.DuplicateProto, key); } } - return true; + protoRef.used = true; } - return sawProto; } shouldExitDescending(expr, potentialArrowAt) { return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt; @@ -33193,7 +33174,7 @@ class ExpressionParser extends LValParser { this.finalizeRemainingComments(); expr.comments = this.comments; expr.errors = this.state.errors; - if (this.optionFlags & 256) { + if (this.optionFlags & 128) { expr.tokens = this.tokens; } return expr; @@ -33224,16 +33205,15 @@ class ExpressionParser extends LValParser { parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) { return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse)); } - setOptionalParametersError(refExpressionErrors) { - refExpressionErrors.optionalParametersLoc = this.state.startLoc; + setOptionalParametersError(refExpressionErrors, resultError) { + var _resultError$loc; + refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc; } parseMaybeAssign(refExpressionErrors, afterLeftParse) { const startLoc = this.state.startLoc; - const isYield = this.isContextual(108); - if (isYield) { + if (this.isContextual(108)) { if (this.prodParam.hasYield) { - this.next(); - let left = this.parseYield(startLoc); + let left = this.parseYield(); if (afterLeftParse) { left = afterLeftParse.call(this, left, startLoc); } @@ -33285,16 +33265,6 @@ class ExpressionParser extends LValParser { } else if (ownExpressionErrors) { this.checkExpressionErrors(refExpressionErrors, true); } - if (isYield) { - const { - type - } = this.state; - const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54); - if (startsExpr && !this.isAmbiguousPrefixOrIdentifier()) { - this.raiseOverwrite(Errors.YieldNotInGeneratorFunction, startLoc); - return this.parseYield(startLoc); - } - } return left; } parseMaybeConditional(refExpressionErrors) { @@ -33471,7 +33441,7 @@ class ExpressionParser extends LValParser { type } = this.state; const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54); - if (startsExpr && !this.isAmbiguousPrefixOrIdentifier()) { + if (startsExpr && !this.isAmbiguousAwait()) { this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc); return this.parseAwait(startLoc); } @@ -33710,7 +33680,7 @@ class ExpressionParser extends LValParser { return this.parseImportMetaProperty(node); } if (this.match(10)) { - if (this.optionFlags & 512) { + if (this.optionFlags & 256) { return this.parseImportCall(node); } else { return this.finishNode(node, "Import"); @@ -34015,7 +33985,7 @@ class ExpressionParser extends LValParser { } else if (this.isContextual(105) || this.isContextual(97)) { const isSource = this.isContextual(105); this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation"); - if (!(this.optionFlags & 512)) { + if (!(this.optionFlags & 256)) { throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, { phase: this.state.value }); @@ -34135,7 +34105,7 @@ class ExpressionParser extends LValParser { return this.wrapParenthesis(startLoc, val); } wrapParenthesis(startLoc, expression) { - if (!(this.optionFlags & 1024)) { + if (!(this.optionFlags & 512)) { this.addExtra(expression, "parenthesized", true); this.addExtra(expression, "parenStart", startLoc.index); this.takeSurroundingComments(expression, startLoc.index, this.state.lastTokEndLoc.index); @@ -34239,7 +34209,7 @@ class ExpressionParser extends LValParser { } const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; - let sawProto = false; + const propHash = Object.create(null); let first = true; const node = this.startNode(); node.properties = []; @@ -34259,7 +34229,7 @@ class ExpressionParser extends LValParser { prop = this.parseBindingProperty(); } else { prop = this.parsePropertyDefinition(refExpressionErrors); - sawProto = this.checkProto(prop, isRecord, sawProto, refExpressionErrors); + this.checkProto(prop, isRecord, propHash, refExpressionErrors); } if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") { this.raise(Errors.InvalidRecordProperty, prop); @@ -34691,7 +34661,7 @@ class ExpressionParser extends LValParser { this.raise(Errors.ObsoleteAwaitStar, node); } if (!this.scope.inFunction && !(this.optionFlags & 1)) { - if (this.isAmbiguousPrefixOrIdentifier()) { + if (this.isAmbiguousAwait()) { this.ambiguousScriptDifferentAst = true; } else { this.sawUnambiguousESM = true; @@ -34702,16 +34672,17 @@ class ExpressionParser extends LValParser { } return this.finishNode(node, "AwaitExpression"); } - isAmbiguousPrefixOrIdentifier() { + isAmbiguousAwait() { if (this.hasPrecedingLineBreak()) return true; const { type } = this.state; return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 138 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54; } - parseYield(startLoc) { - const node = this.startNodeAt(startLoc); + parseYield() { + const node = this.startNode(); this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node); + this.next(); let delegating = false; let argument = null; if (!this.hasPrecedingLineBreak()) { @@ -35013,7 +34984,7 @@ class StatementParser extends ExpressionParser { parseTopLevel(file, program) { file.program = this.parseProgram(program); file.comments = this.comments; - if (this.optionFlags & 256) { + if (this.optionFlags & 128) { file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex); } return this.finishNode(file, "File"); @@ -35023,7 +34994,7 @@ class StatementParser extends ExpressionParser { program.interpreter = this.parseInterpreterDirective(); this.parseBlockBody(program, true, true, end); if (this.inModule) { - if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0) { + if (!(this.optionFlags & 32) && this.scope.undefinedExports.size > 0) { for (const [localName, at] of Array.from(this.scope.undefinedExports)) { this.raise(Errors.ModuleExportUndefined, at, { localName @@ -35256,8 +35227,14 @@ class StatementParser extends ExpressionParser { let result; if (startType === 83) { result = this.parseImport(node); + if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) { + this.sawUnambiguousESM = true; + } } else { result = this.parseExport(node, decorators); + if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") { + this.sawUnambiguousESM = true; + } } this.assertModuleNodeAllowed(result); return result; @@ -36168,7 +36145,6 @@ class StatementParser extends ExpressionParser { throw this.raise(Errors.UnsupportedDecoratorExport, node); } this.parseExportFrom(node, true); - this.sawUnambiguousESM = true; return this.finishNode(node, "ExportAllDeclaration"); } const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node); @@ -36197,7 +36173,6 @@ class StatementParser extends ExpressionParser { } else if (decorators) { throw this.raise(Errors.UnsupportedDecoratorExport, node); } - this.sawUnambiguousESM = true; return this.finishNode(node2, "ExportNamedDeclaration"); } if (this.eat(65)) { @@ -36210,7 +36185,6 @@ class StatementParser extends ExpressionParser { throw this.raise(Errors.UnsupportedDecoratorExport, node); } this.checkExport(node2, true, true); - this.sawUnambiguousESM = true; return this.finishNode(node2, "ExportDefaultDeclaration"); } this.unexpected(null, 5); @@ -36248,12 +36222,10 @@ class StatementParser extends ExpressionParser { const isTypeExport = node2.exportKind === "type"; node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport)); node2.source = null; + node2.declaration = null; if (this.hasPlugin("importAssertions")) { node2.assertions = []; - } else { - node2.attributes = []; } - node2.declaration = null; return true; } return false; @@ -36264,8 +36236,6 @@ class StatementParser extends ExpressionParser { node.source = null; if (this.hasPlugin("importAssertions")) { node.assertions = []; - } else { - node.attributes = []; } node.declaration = this.parseExportDeclaration(node); return true; @@ -36629,7 +36599,6 @@ class StatementParser extends ExpressionParser { this.checkImportReflection(node); this.checkJSONModuleImport(node); this.semicolon(); - this.sawUnambiguousESM = true; return this.finishNode(node, "ImportDeclaration"); } parseImportSource() { @@ -36713,7 +36682,6 @@ class StatementParser extends ExpressionParser { this.next(); if (this.hasPlugin("moduleAttributes")) { attributes = this.parseModuleAttributes(); - this.addExtra(node, "deprecatedWithLegacySyntax", true); } else { attributes = this.parseImportAttributes(); } @@ -36827,34 +36795,31 @@ class Parser extends StatementParser { optionFlags |= 16; } if (options.allowUndeclaredExports) { - optionFlags |= 64; + optionFlags |= 32; } if (options.allowNewTargetOutsideFunction) { optionFlags |= 4; } - if (options.allowYieldOutsideFunction) { - optionFlags |= 32; - } if (options.ranges) { - optionFlags |= 128; + optionFlags |= 64; } if (options.tokens) { - optionFlags |= 256; + optionFlags |= 128; } if (options.createImportExpressions) { - optionFlags |= 512; + optionFlags |= 256; } if (options.createParenthesizedExpressions) { - optionFlags |= 1024; + optionFlags |= 512; } if (options.errorRecovery) { - optionFlags |= 2048; + optionFlags |= 1024; } if (options.attachComment) { - optionFlags |= 4096; + optionFlags |= 2048; } if (options.annexB) { - optionFlags |= 8192; + optionFlags |= 4096; } this.optionFlags = optionFlags; } @@ -37233,7 +37198,7 @@ exports.merge = merge; exports.normalizeReplacements = normalizeReplacements; exports.validate = validate; const _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"]; -function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } +function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; } function merge(a, b) { const { placeholderWhitelist = a.placeholderWhitelist, @@ -37444,11 +37409,8 @@ function parseWithCodeFrame(code, parserOpts, syntacticPlaceholders) { plugins.push("placeholders"); } parserOpts = Object.assign({ - allowAwaitOutsideFunction: true, allowReturnOutsideFunction: true, - allowNewTargetOutsideFunction: true, allowSuperOutsideMethod: true, - allowYieldOutsideFunction: true, sourceType: "module" }, parserOpts, { plugins @@ -43672,9 +43634,6 @@ function assertPrivateName(node, opts) { function assertStaticBlock(node, opts) { assert("StaticBlock", node, opts); } -function assertImportAttribute(node, opts) { - assert("ImportAttribute", node, opts); -} function assertAnyTypeAnnotation(node, opts) { assert("AnyTypeAnnotation", node, opts); } @@ -43930,6 +43889,9 @@ function assertArgumentPlaceholder(node, opts) { function assertBindExpression(node, opts) { assert("BindExpression", node, opts); } +function assertImportAttribute(node, opts) { + assert("ImportAttribute", node, opts); +} function assertDecorator(node, opts) { assert("Decorator", node, opts); } @@ -45706,17 +45668,6 @@ function staticBlock(body) { validate(defs.body, node, "body", body, 1); return node; } -function importAttribute(key, value) { - const node = { - type: "ImportAttribute", - key, - value - }; - const defs = NODE_FIELDS.ImportAttribute; - validate(defs.key, node, "key", key, 1); - validate(defs.value, node, "value", value, 1); - return node; -} function anyTypeAnnotation() { return { type: "AnyTypeAnnotation" @@ -46563,6 +46514,17 @@ function bindExpression(object, callee) { validate(defs.callee, node, "callee", callee, 1); return node; } +function importAttribute(key, value) { + const node = { + type: "ImportAttribute", + key, + value + }; + const defs = NODE_FIELDS.ImportAttribute; + validate(defs.key, node, "key", key, 1); + validate(defs.value, node, "value", value, 1); + return node; +} function decorator(expression) { const node = { type: "Decorator", @@ -49399,7 +49361,7 @@ const MODULEDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = IMPORTOREXPORT Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.UPDATE_OPERATORS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.STATEMENT_OR_BLOCK_KEYS = exports.NUMBER_UNARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.LOGICAL_OPERATORS = exports.INHERIT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.EQUALITY_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.COMMENT_KEYS = exports.BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.BINARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = void 0; +exports.UPDATE_OPERATORS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.STATEMENT_OR_BLOCK_KEYS = exports.NUMBER_UNARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.NOT_LOCAL_BINDING = exports.LOGICAL_OPERATORS = exports.INHERIT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.EQUALITY_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.COMMENT_KEYS = exports.BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.BLOCK_SCOPED_SYMBOL = exports.BINARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = void 0; const STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; const FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"]; const FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"]; @@ -49421,10 +49383,8 @@ const INHERIT_KEYS = exports.INHERIT_KEYS = { optional: ["typeAnnotation", "typeParameters", "returnType"], force: ["start", "loc", "end"] }; -{ - exports.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); - exports.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); -} +const BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); +const NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); //# sourceMappingURL=index.js.map @@ -49852,9 +49812,6 @@ function valueToNode(value) { } return result; } - if (typeof value === "bigint") { - return (0, _index.bigIntLiteral)(value.toString()); - } if (isRegExp(value)) { const pattern = value.source; const flags = /\/([a-z]*)$/.exec(value.toString())[1]; @@ -49866,19 +49823,13 @@ function valueToNode(value) { if (isPlainObject(value)) { const props = []; for (const key of Object.keys(value)) { - let nodeKey, - computed = false; + let nodeKey; if ((0, _isValidIdentifier.default)(key)) { - if (key === "__proto__") { - computed = true; - nodeKey = (0, _index.stringLiteral)(key); - } else { - nodeKey = (0, _index.identifier)(key); - } + nodeKey = (0, _index.identifier)(key); } else { nodeKey = (0, _index.stringLiteral)(key); } - props.push((0, _index.objectProperty)(nodeKey, valueToNode(value[key]), computed)); + props.push((0, _index.objectProperty)(nodeKey, valueToNode(value[key]))); } return (0, _index.objectExpression)(props); } @@ -50270,7 +50221,7 @@ defineType("Identifier", { } }), validate: process.env.BABEL_TYPES_8_BREAKING ? function (parent, key, node) { - const match = /\.(\w+)$/.exec(key.toString()); + const match = /\.(\w+)$/.exec(key); if (!match) return; const [, parentKey] = match; const nonComp = { @@ -50559,7 +50510,7 @@ defineType("RestElement", { } }), validate: process.env.BABEL_TYPES_8_BREAKING ? function (parent, key) { - const match = /(\w+)\[(\d+)\]/.exec(key.toString()); + const match = /(\w+)\[(\d+)\]/.exec(key); if (!match) throw new Error("Internal Babel error: malformed key."); const [, listKey, index] = match; if (parent[listKey].length > +index + 1) { @@ -51531,17 +51482,6 @@ defineType("StaticBlock", { }, aliases: ["Scopable", "BlockParent", "FunctionParent"] }); -defineType("ImportAttribute", { - visitor: ["key", "value"], - fields: { - key: { - validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") - }, - value: { - validate: (0, _utils.assertNodeType)("StringLiteral") - } - } -}); //# sourceMappingURL=core.js.map @@ -51598,6 +51538,17 @@ var _utils = __nccwpck_require__(4106); } } }); +(0, _utils.default)("ImportAttribute", { + visitor: ["key", "value"], + fields: { + key: { + validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") + }, + value: { + validate: (0, _utils.assertNodeType)("StringLiteral") + } + } +}); (0, _utils.default)("Decorator", { visitor: ["expression"], fields: { @@ -52289,19 +52240,6 @@ var _deprecatedAliases = __nccwpck_require__(9563); Object.keys(_deprecatedAliases.DEPRECATED_ALIASES).forEach(deprecatedAlias => { _utils.FLIPPED_ALIAS_KEYS[deprecatedAlias] = _utils.FLIPPED_ALIAS_KEYS[_deprecatedAliases.DEPRECATED_ALIASES[deprecatedAlias]]; }); -for (const { - types, - set -} of _utils.allExpandedTypes) { - for (const type of types) { - const aliases = _utils.FLIPPED_ALIAS_KEYS[type]; - if (aliases) { - aliases.forEach(set.add, set); - } else { - set.add(type); - } - } -} const TYPES = exports.TYPES = [].concat(Object.keys(_utils.VISITOR_KEYS), Object.keys(_utils.FLIPPED_ALIAS_KEYS), Object.keys(_utils.DEPRECATED_KEYS)); //# sourceMappingURL=index.js.map @@ -53091,7 +53029,7 @@ defineType("TSTypeParameter", { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.allExpandedTypes = exports.VISITOR_KEYS = exports.NODE_PARENT_VALIDATIONS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.ALIAS_KEYS = void 0; +exports.VISITOR_KEYS = exports.NODE_PARENT_VALIDATIONS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.ALIAS_KEYS = void 0; exports.arrayOf = arrayOf; exports.arrayOfType = arrayOfType; exports.assertEach = assertEach; @@ -53160,16 +53098,11 @@ function assertEach(callback) { const childValidator = process.env.BABEL_TYPES_8_BREAKING ? _validate.validateChild : () => {}; function validator(node, key, val) { if (!Array.isArray(val)) return; - let i = 0; - const subKey = { - toString() { - return `${key}[${i}]`; - } - }; - for (; i < val.length; i++) { + for (let i = 0; i < val.length; i++) { + const subkey = `${key}[${i}]`; const v = val[i]; - callback(node, subKey, v); - childValidator(node, subKey, v); + callback(node, subkey, v); + childValidator(node, subkey, v); } } validator.each = callback; @@ -53184,39 +53117,23 @@ function assertOneOf(...values) { validate.oneOf = values; return validate; } -const allExpandedTypes = exports.allExpandedTypes = []; function assertNodeType(...types) { - const expandedTypes = new Set(); - allExpandedTypes.push({ - types, - set: expandedTypes - }); function validate(node, key, val) { - const valType = val == null ? void 0 : val.type; - if (valType != null) { - if (expandedTypes.has(valType)) { + for (const type of types) { + if ((0, _is.default)(type, val)) { (0, _validate.validateChild)(node, key, val); return; } - if (valType === "Placeholder") { - for (const type of types) { - if ((0, _is.default)(type, val)) { - (0, _validate.validateChild)(node, key, val); - return; - } - } - } } - throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(valType)}`); + throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`); } validate.oneOfNodeTypes = types; return validate; } function assertNodeOrValueType(...types) { function validate(node, key, val) { - const primitiveType = getType(val); for (const type of types) { - if (primitiveType === type || (0, _is.default)(type, val)) { + if (getType(val) === type || (0, _is.default)(type, val)) { (0, _validate.validateChild)(node, key, val); return; } @@ -53228,19 +53145,18 @@ function assertNodeOrValueType(...types) { } function assertValueType(type) { function validate(node, key, val) { - if (getType(val) === type) { - return; + const valid = getType(val) === type; + if (!valid) { + throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); } - throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); } validate.type = type; return validate; } function assertShape(shape) { - const keys = Object.keys(shape); function validate(node, key, val) { const errors = []; - for (const property of keys) { + for (const property of Object.keys(shape)) { try { (0, _validate.validateField)(node, property, val[property], shape[property]); } catch (error) { @@ -53301,9 +53217,9 @@ function defineAliasedType(...aliases) { return (type, opts = {}) => { let defined = opts.aliases; if (!defined) { - var _store$opts$inherits$; + var _store$opts$inherits$, _defined; if (opts.inherits) defined = (_store$opts$inherits$ = store[opts.inherits].aliases) == null ? void 0 : _store$opts$inherits$.slice(); - defined != null ? defined : defined = []; + (_defined = defined) != null ? _defined : defined = []; opts.aliases = defined; } const additional = aliases.filter(a => !defined.includes(a)); @@ -54586,37 +54502,23 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = traverseFast; var _index = __nccwpck_require__(5078); -const _skip = Symbol(); -const _stop = Symbol(); function traverseFast(node, enter, opts) { - if (!node) return false; + if (!node) return; const keys = _index.VISITOR_KEYS[node.type]; - if (!keys) return false; + if (!keys) return; opts = opts || {}; - const ret = enter(node, opts); - if (ret !== undefined) { - switch (ret) { - case _skip: - return false; - case _stop: - return true; - } - } + enter(node, opts); for (const key of keys) { const subNode = node[key]; - if (!subNode) continue; if (Array.isArray(subNode)) { for (const node of subNode) { - if (traverseFast(node, enter, opts)) return true; + traverseFast(node, enter, opts); } } else { - if (traverseFast(subNode, enter, opts)) return true; + traverseFast(subNode, enter, opts); } } - return false; } -traverseFast.skip = _skip; -traverseFast.stop = _stop; //# sourceMappingURL=traverseFast.js.map @@ -55547,11 +55449,6 @@ function isStaticBlock(node, opts) { if (node.type !== "StaticBlock") return false; return opts == null || (0, _shallowEqual.default)(node, opts); } -function isImportAttribute(node, opts) { - if (!node) return false; - if (node.type !== "ImportAttribute") return false; - return opts == null || (0, _shallowEqual.default)(node, opts); -} function isAnyTypeAnnotation(node, opts) { if (!node) return false; if (node.type !== "AnyTypeAnnotation") return false; @@ -55977,6 +55874,11 @@ function isBindExpression(node, opts) { if (node.type !== "BindExpression") return false; return opts == null || (0, _shallowEqual.default)(node, opts); } +function isImportAttribute(node, opts) { + if (!node) return false; + if (node.type !== "ImportAttribute") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} function isDecorator(node, opts) { if (!node) return false; if (node.type !== "Decorator") return false; @@ -56458,7 +56360,6 @@ function isStandardized(node, opts) { case "ClassPrivateMethod": case "PrivateName": case "StaticBlock": - case "ImportAttribute": break; case "Placeholder": switch (node.expectedNode) { @@ -57699,13 +57600,9 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = isLet; var _index = __nccwpck_require__(2605); -{ - var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); -} +var _index2 = __nccwpck_require__(9743); function isLet(node) { - { - return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]); - } + return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[_index2.BLOCK_SCOPED_SYMBOL]); } //# sourceMappingURL=isLet.js.map @@ -57812,7 +57709,11 @@ var _index = __nccwpck_require__(5078); function isPlaceholderType(placeholderType, targetType) { if (placeholderType === targetType) return true; const aliases = _index.PLACEHOLDERS_ALIAS[placeholderType]; - if (aliases != null && aliases.includes(targetType)) return true; + if (aliases) { + for (const alias of aliases) { + if (targetType === alias) return true; + } + } return false; } @@ -57989,7 +57890,12 @@ function isType(nodeType, targetType) { if (nodeType == null) return false; if (_index.ALIAS_KEYS[targetType]) return false; const aliases = _index.FLIPPED_ALIAS_KEYS[targetType]; - if (aliases != null && aliases.includes(nodeType)) return true; + if (aliases) { + if (aliases[0] === nodeType) return true; + for (const alias of aliases) { + if (nodeType === alias) return true; + } + } return false; } @@ -58056,15 +57962,11 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = isVar; var _index = __nccwpck_require__(2605); -{ - var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); -} +var _index2 = __nccwpck_require__(9743); function isVar(node) { - { - return (0, _index.isVariableDeclaration)(node, { - kind: "var" - }) && !node[BLOCK_SCOPED_SYMBOL]; - } + return (0, _index.isVariableDeclaration)(node, { + kind: "var" + }) && !node[_index2.BLOCK_SCOPED_SYMBOL]; } //# sourceMappingURL=isVar.js.map diff --git a/.github/actions/javascript/getPullRequestDetails/action.yml b/.github/actions/javascript/getPullRequestDetails/action.yml index e019a849fcec2..a634ce14daeb0 100644 --- a/.github/actions/javascript/getPullRequestDetails/action.yml +++ b/.github/actions/javascript/getPullRequestDetails/action.yml @@ -11,7 +11,7 @@ inputs: description: The creator of the pull request required: true REPO_FULL_NAME: - description: The full repository name in the format owner/repo + description: The full repository name in the 'owner/repo' format required: true outputs: MERGE_COMMIT_SHA: diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 015c0f9898440..26678ddac3b84 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -11458,9 +11458,11 @@ const ActionUtils_1 = __nccwpck_require__(6981); const CONST_1 = __importDefault(__nccwpck_require__(9873)); const GithubUtils_1 = __importDefault(__nccwpck_require__(9296)); const EmptyObject_1 = __nccwpck_require__(8227); +const repoFullName = core.getInput('REPO_FULL_NAME', { required: true }); +const [owner, repo] = repoFullName.split('/'); const DEFAULT_PAYLOAD = { - owner: CONST_1.default.GITHUB_OWNER, - repo: CONST_1.default.APP_REPO, + owner, + repo, }; const pullRequestNumber = (0, ActionUtils_1.getJSONInput)('PULL_REQUEST_NUMBER', { required: false }, null); const user = core.getInput('USER', { required: true }); @@ -11486,7 +11488,8 @@ function outputMergeActor(PR) { * Output forked repo URL if PR includes changes from a fork. */ function outputForkedRepoUrl(PR) { - if (PR.head?.repo?.html_url === CONST_1.default.APP_REPO_URL) { + const repoUrl = `https://github.com/${repoFullName}`; + if (PR.head?.repo?.html_url === repoUrl) { core.setOutput('FORKED_REPO_URL', ''); } else { diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 56651fa45f6ff..6b8eda9d78cdf 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -108,7 +108,7 @@ jobs: fi echo "VERSION_BUMP_SHA=$VERSION_BUMP_COMMIT" >> "$GITHUB_OUTPUT" - - name: Get merge commit for E/App pull request to CP + - name: Get merge commit for pull request to CP id: getCPMergeCommit uses: ./.github/actions/javascript/getPullRequestDetails with: From 24780f63b6797a0bcb695d13eca8aa504d8705ce Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 09:29:43 -0600 Subject: [PATCH 04/31] Add happy case (no conflicts) --- .github/workflows/cherryPick.yml | 33 ++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 6b8eda9d78cdf..c030e32b3a40f 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -110,12 +110,13 @@ jobs: - name: Get merge commit for pull request to CP id: getCPMergeCommit - uses: ./.github/actions/javascript/getPullRequestDetails - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - USER: ${{ github.actor }} - PULL_REQUEST_NUMBER: ${{ steps.getPRInfo.outputs.PR_NUMBER }} - REPO_FULL_NAME: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }} + run: | + MERGE_COMMIT_SHA="$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json mergeCommit --jq '.mergeCommit.oid')" + MERGE_ACTOR="$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json author --jq '.author.login')" + echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> "$GITHUB_OUTPUT" + echo "MERGE_ACTOR=$MERGE_ACTOR" >> "$GITHUB_OUTPUT" + env: + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - name: Cherry-pick the Mobile-Expensify version bump to Mobile-Expensify staging working-directory: Mobile-Expensify @@ -138,6 +139,10 @@ jobs: id: cherryPick run: | echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}" + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + cd Mobile-Expensify + fi + if git cherry-pick -S -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then echo "🎉 No conflicts! CP was a success, PR can be automerged 🎉" echo "HAS_CONFLICTS=false" >> "$GITHUB_OUTPUT" @@ -149,12 +154,28 @@ jobs: echo "HAS_CONFLICTS=true" >> "$GITHUB_OUTPUT" fi + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + cd .. + fi + - name: Push changes run: | if [[ ${{steps.cherryPick.outputs.HAS_CONFLICTS}} == 'true' ]]; then git checkout -b ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} git push --set-upstream origin ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} else + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + # Push Mobile-Expensify changes first + cd Mobile-Expensify + git push origin staging + cd .. + + # Update and commit the submodule reference in E/App + git add Mobile-Expensify + git commit -m "Update Mobile-Expensify submodule to include cherry-picked PR #${{ steps.getPRInfo.outputs.PR_NUMBER }}" + fi + + # Push E/App changes git push origin staging fi From e81194bb0adbbf61f830d73478d43fb4ac4fcbec Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 10:03:45 -0600 Subject: [PATCH 05/31] Temporary test --- .github/workflows/cherryPick.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index c030e32b3a40f..49c821f82553b 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -66,20 +66,23 @@ jobs: - name: Fetch history of relevant refs run: | - # Temporary hack during transition when -staging suffix is being added to tags - if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} - else - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging - fi - - cd Mobile-Expensify - # Temporary hack during transition when -staging suffix is being added to tags - if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} - else - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging - fi + # # Temporary hack during transition when -staging suffix is being added to tags + # if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then + # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} + # else + # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging + # fi + + # cd Mobile-Expensify + # # Temporary hack during transition when -staging suffix is being added to tags + # if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then + # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} + # else + # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging + # fi + + # Temporary hack to fetch the latest staging branch + git fetch origin main staging - name: Get E/App version bump commit id: getVersionBumpCommit From c07f4764388aad4d3b40f8ab415753bea688bd53 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 10:15:07 -0600 Subject: [PATCH 06/31] Use Mobile-Expensify-Test-Fork for valid repo as a test --- .github/workflows/cherryPick.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 49c821f82553b..493332d2a0173 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -32,7 +32,7 @@ jobs: - name: Verify repository run: | - if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ] && [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]; then + if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ] && [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify-Test-Fork" ]; then echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" exit 1 fi @@ -142,7 +142,7 @@ jobs: id: cherryPick run: | echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}" - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then cd Mobile-Expensify fi @@ -157,7 +157,7 @@ jobs: echo "HAS_CONFLICTS=true" >> "$GITHUB_OUTPUT" fi - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then cd .. fi @@ -167,7 +167,7 @@ jobs: git checkout -b ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} git push --set-upstream origin ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} else - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then # Push Mobile-Expensify changes first cd Mobile-Expensify git push origin staging From 4ca15d96e3e41f9ffc3cd5c39e2265b22673405e Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 10:28:29 -0600 Subject: [PATCH 07/31] Handle http and https --- .github/workflows/cherryPick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 493332d2a0173..b06d432f3244d 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -27,7 +27,7 @@ jobs: - name: Extract PR information id: getPRInfo run: | - echo "REPO_FULL_NAME=$(echo '${{ github.event.inputs.PULL_REQUEST_URL }}' | sed -E 's|https://github.com/([^/]+/[^/]+)/pull/.*|\1|')" >> "$GITHUB_OUTPUT" + echo "REPO_FULL_NAME=$(echo '${{ github.event.inputs.PULL_REQUEST_URL }}' | sed -E 's|https?://github.com/([^/]+/[^/]+)/pull/.*|\1|')" >> "$GITHUB_OUTPUT" echo "PR_NUMBER=$(echo '${{ github.event.inputs.PULL_REQUEST_URL }}' | sed -E 's|.*/pull/([0-9]+).*|\1|')" >> "$GITHUB_OUTPUT" - name: Verify repository From 8dc5625720db334a8fd37cc4ebde909c64e0ab72 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 11:03:00 -0600 Subject: [PATCH 08/31] Update actios --- .../javascript/authorChecklist/index.js | 452 +++++++++++------- 1 file changed, 275 insertions(+), 177 deletions(-) diff --git a/.github/actions/javascript/authorChecklist/index.js b/.github/actions/javascript/authorChecklist/index.js index 617fcb7203f05..7d6bfa1e45843 100644 --- a/.github/actions/javascript/authorChecklist/index.js +++ b/.github/actions/javascript/authorChecklist/index.js @@ -18590,6 +18590,7 @@ function ExportNamespaceSpecifier(node) { } let warningShown = false; function _printAttributes(node, hasPreviousBrace) { + var _node$extra; const { importAttributesKeyword } = this.format; @@ -18597,7 +18598,7 @@ function _printAttributes(node, hasPreviousBrace) { attributes, assertions } = node; - if (attributes && !importAttributesKeyword && !warningShown) { + if (attributes && !importAttributesKeyword && node.extra && (node.extra.deprecatedAssertSyntax || node.extra.deprecatedWithLegacySyntax) && !warningShown) { warningShown = true; console.warn(`\ You are using import attributes, without specifying the desired output syntax. @@ -18610,7 +18611,7 @@ Please specify the "importAttributesKeyword" generator option, whose value can b const useAssertKeyword = importAttributesKeyword === "assert" || !importAttributesKeyword && assertions; this.word(useAssertKeyword ? "assert" : "with"); this.space(); - if (!useAssertKeyword && importAttributesKeyword !== "with") { + if (!useAssertKeyword && (importAttributesKeyword === "with-legacy" || !importAttributesKeyword && (_node$extra = node.extra) != null && _node$extra.deprecatedWithLegacySyntax)) { this.printList(attributes || assertions); return; } @@ -20081,7 +20082,7 @@ function tsPrintClassMemberModifiers(node) { this.word("static"); this.space(); } - printModifiersList(this, node, [!isPrivateField && node.override && "override", !isPrivateField && node.abstract && "abstract", (isPublicField || isPrivateField) && node.readonly && "readonly"]); + printModifiersList(this, node, [!isPrivateField && node.abstract && "abstract", !isPrivateField && node.override && "override", (isPublicField || isPrivateField) && node.readonly && "readonly"]); } function printBraced(printer, node, cb) { printer.token("{"); @@ -20124,7 +20125,8 @@ function printModifiersList(printer, node, modifiers) { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports["default"] = generate; +exports["default"] = void 0; +exports.generate = generate; var _sourceMap = __nccwpck_require__(6280); var _printer = __nccwpck_require__(5637); function normalizeOptions(code, opts, ast) { @@ -20227,6 +20229,7 @@ function generate(ast, opts = {}, code) { const printer = new _printer.default(format, map, ast.tokens, typeof code === "string" ? code : null); return printer.generate(ast); } +var _default = exports["default"] = generate; //# sourceMappingURL=index.js.map @@ -22722,7 +22725,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { - if (e.includes(n)) continue; + if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; @@ -22803,7 +22806,6 @@ var StandardErrors = { AwaitExpressionFormalParameter: "'await' is not allowed in async function parameters.", AwaitUsingNotInAsyncContext: "'await using' is only allowed within async functions and at the top levels of modules.", AwaitNotInAsyncContext: "'await' is only allowed within async functions and at the top levels of modules.", - AwaitNotInAsyncFunction: "'await' is only allowed within async functions.", BadGetterArity: "A 'get' accessor must not have any formal parameters.", BadSetterArity: "A 'set' accessor must have exactly one formal parameter.", BadSetterRestParameter: "A 'set' accessor function argument must not be a rest parameter.", @@ -23006,6 +23008,7 @@ var StandardErrors = { }) => `Identifier '${identifierName}' has already been declared.`, YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.", YieldInParameter: "Yield expression is not allowed in formal parameters.", + YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.", ZeroDigitNumericSeparator: "Numeric separator can not be used after leading 0." }; var StrictModeErrors = { @@ -23149,6 +23152,7 @@ function createDefaultOptions() { allowImportExportEverywhere: false, allowSuperOutsideMethod: false, allowUndeclaredExports: false, + allowYieldOutsideFunction: false, plugins: [], strictMode: null, ranges: false, @@ -23203,7 +23207,7 @@ function toESTreeLocation(node) { var estree = superClass => class ESTreeParserMixin extends superClass { parse() { const file = toESTreeLocation(super.parse()); - if (this.optionFlags & 128) { + if (this.optionFlags & 256) { file.tokens = file.tokens.map(toESTreeLocation); } return file; @@ -23384,6 +23388,16 @@ var estree = superClass => class ESTreeParserMixin extends superClass { propertyNode.computed = false; return propertyNode; } + parseClassAccessorProperty(node) { + const accessorPropertyNode = super.parseClassAccessorProperty(node); + { + if (!this.getPluginOption("estree", "classFeatures")) { + return accessorPropertyNode; + } + } + accessorPropertyNode.type = "AccessorProperty"; + return accessorPropertyNode; + } parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor) { const node = super.parseObjectMethod(prop, isGenerator, isAsync, isPattern, isAccessor); if (node) { @@ -25089,7 +25103,7 @@ class Tokenizer extends CommentsParser { this.tokens = []; this.errorHandlers_readInt = { invalidDigit: (pos, lineStart, curLine, radix) => { - if (!(this.optionFlags & 1024)) return false; + if (!(this.optionFlags & 2048)) return false; this.raise(Errors.InvalidDigit, buildPosition(pos, lineStart, curLine), { radix }); @@ -25130,7 +25144,7 @@ class Tokenizer extends CommentsParser { } next() { this.checkKeywordEscapes(); - if (this.optionFlags & 128) { + if (this.optionFlags & 256) { this.pushToken(new Token(this.state)); } this.state.lastTokEndLoc = this.state.endLoc; @@ -25246,7 +25260,7 @@ class Tokenizer extends CommentsParser { end: this.sourceToOffsetPos(end + commentEnd.length), loc: new SourceLocation(startLoc, this.state.curPosition()) }; - if (this.optionFlags & 128) this.pushToken(comment); + if (this.optionFlags & 256) this.pushToken(comment); return comment; } skipLineComment(startSkip) { @@ -25269,12 +25283,12 @@ class Tokenizer extends CommentsParser { end: this.sourceToOffsetPos(end), loc: new SourceLocation(startLoc, this.state.curPosition()) }; - if (this.optionFlags & 128) this.pushToken(comment); + if (this.optionFlags & 256) this.pushToken(comment); return comment; } skipSpace() { const spaceStart = this.state.pos; - const comments = this.optionFlags & 2048 ? [] : null; + const comments = this.optionFlags & 4096 ? [] : null; loop: while (this.state.pos < this.length) { const ch = this.input.charCodeAt(this.state.pos); switch (ch) { @@ -25321,7 +25335,7 @@ class Tokenizer extends CommentsParser { default: if (isWhitespace(ch)) { ++this.state.pos; - } else if (ch === 45 && !this.inModule && this.optionFlags & 4096) { + } else if (ch === 45 && !this.inModule && this.optionFlags & 8192) { const pos = this.state.pos; if (this.input.charCodeAt(pos + 1) === 45 && this.input.charCodeAt(pos + 2) === 62 && (spaceStart === 0 || this.state.lineStart > spaceStart)) { const comment = this.skipLineComment(3); @@ -25332,7 +25346,7 @@ class Tokenizer extends CommentsParser { } else { break loop; } - } else if (ch === 60 && !this.inModule && this.optionFlags & 4096) { + } else if (ch === 60 && !this.inModule && this.optionFlags & 8192) { const pos = this.state.pos; if (this.input.charCodeAt(pos + 1) === 33 && this.input.charCodeAt(pos + 2) === 45 && this.input.charCodeAt(pos + 3) === 45) { const comment = this.skipLineComment(4); @@ -26040,7 +26054,7 @@ class Tokenizer extends CommentsParser { raise(toParseError, at, details = {}) { const loc = at instanceof Position ? at : at.loc.start; const error = toParseError(loc, details); - if (!(this.optionFlags & 1024)) throw error; + if (!(this.optionFlags & 2048)) throw error; if (!this.isLookahead) this.state.errors.push(error); return error; } @@ -26498,6 +26512,9 @@ class UtilParser extends Tokenizer { if (this.inModule) { paramFlags |= 2; } + if (this.optionFlags & 32) { + paramFlags |= 1; + } this.scope.enter(1); this.prodParam.enter(paramFlags); } @@ -26524,7 +26541,7 @@ class Node { this.start = pos; this.end = 0; this.loc = new SourceLocation(loc); - if ((parser == null ? void 0 : parser.optionFlags) & 64) this.range = [pos, 0]; + if ((parser == null ? void 0 : parser.optionFlags) & 128) this.range = [pos, 0]; if (parser != null && parser.filename) this.loc.filename = parser.filename; } } @@ -26612,8 +26629,8 @@ class NodeUtils extends UtilParser { node.type = type; node.end = endLoc.index; node.loc.end = endLoc; - if (this.optionFlags & 64) node.range[1] = endLoc.index; - if (this.optionFlags & 2048) { + if (this.optionFlags & 128) node.range[1] = endLoc.index; + if (this.optionFlags & 4096) { this.processComment(node); } return node; @@ -26621,12 +26638,12 @@ class NodeUtils extends UtilParser { resetStartLocation(node, startLoc) { node.start = startLoc.index; node.loc.start = startLoc; - if (this.optionFlags & 64) node.range[0] = startLoc.index; + if (this.optionFlags & 128) node.range[0] = startLoc.index; } resetEndLocation(node, endLoc = this.state.lastTokEndLoc) { node.end = endLoc.index; node.loc.end = endLoc; - if (this.optionFlags & 64) node.range[1] = endLoc.index; + if (this.optionFlags & 128) node.range[1] = endLoc.index; } resetStartLocationFromNode(node, locationNode) { this.resetStartLocation(node, locationNode.loc.start); @@ -27456,8 +27473,7 @@ var flow = superClass => class FlowParserMixin extends superClass { } } flowParseQualifiedTypeIdentifier(startLoc, id) { - var _startLoc; - (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc; + startLoc != null ? startLoc : startLoc = this.state.startLoc; let node = id || this.flowParseRestrictedIdentifier(true); while (this.eat(16)) { const node2 = this.startNodeAt(startLoc); @@ -29913,14 +29929,7 @@ class LValParser extends NodeUtils { for (let i = 0; i <= end; i++) { const elt = exprList[i]; if (!elt) continue; - if (elt.type === "SpreadElement") { - elt.type = "RestElement"; - const arg = elt.argument; - this.checkToRestConversion(arg, true); - this.toAssignable(arg, isLHS); - } else { - this.toAssignable(elt, isLHS); - } + this.toAssignableListItem(exprList, i, isLHS); if (elt.type === "RestElement") { if (i < end) { this.raise(Errors.RestTrailingComma, elt); @@ -29930,6 +29939,17 @@ class LValParser extends NodeUtils { } } } + toAssignableListItem(exprList, index, isLHS) { + const node = exprList[index]; + if (node.type === "SpreadElement") { + node.type = "RestElement"; + const arg = node.argument; + this.checkToRestConversion(arg, true); + this.toAssignable(arg, isLHS); + } else { + this.toAssignable(node, isLHS); + } + } isAssignable(node, isBinding) { switch (node.type) { case "Identifier": @@ -30025,13 +30045,15 @@ class LValParser extends NodeUtils { } } else { const decorators = []; - if (this.match(26) && this.hasPlugin("decorators")) { - this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc); - } - while (this.match(26)) { - decorators.push(this.parseDecorator()); + if (flags & 2) { + if (this.match(26) && this.hasPlugin("decorators")) { + this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc); + } + while (this.match(26)) { + decorators.push(this.parseDecorator()); + } } - elts.push(this.parseAssignableListItem(flags, decorators)); + elts.push(this.parseBindingElement(flags, decorators)); } } return elts; @@ -30061,7 +30083,7 @@ class LValParser extends NodeUtils { prop.method = false; return this.parseObjPropValue(prop, startLoc, false, false, true, false); } - parseAssignableListItem(flags, decorators) { + parseBindingElement(flags, decorators) { const left = this.parseMaybeDefault(); if (this.hasPlugin("flow") || flags & 2) { this.parseFunctionParamType(left); @@ -30076,9 +30098,8 @@ class LValParser extends NodeUtils { return param; } parseMaybeDefault(startLoc, left) { - var _startLoc, _left; - (_startLoc = startLoc) != null ? _startLoc : startLoc = this.state.startLoc; - left = (_left = left) != null ? _left : this.parseBindingAtom(); + startLoc != null ? startLoc : startLoc = this.state.startLoc; + left = left != null ? left : this.parseBindingAtom(); if (!this.eat(29)) return left; const node = this.startNodeAt(startLoc); node.left = left; @@ -30268,6 +30289,9 @@ const TSErrors = ParseErrorEnum`typescript`({ IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.", IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.", InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.", + InvalidHeritageClauseType: ({ + token + }) => `'${token}' list can only include identifiers or qualified-names with optional type arguments.`, InvalidModifierOnTypeMember: ({ modifier }) => `'${modifier}' modifier cannot appear on a type member.`, @@ -31320,8 +31344,8 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { tsParseHeritageClause(token) { const originalStartLoc = this.state.startLoc; const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => { - const node = this.startNode(); { + const node = this.startNode(); node.expression = this.tsParseEntityName(1 | 2); if (this.match(47)) { node.typeParameters = this.tsParseTypeArguments(); @@ -31721,7 +31745,7 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { if (this.tsIsDeclarationStart()) return false; return super.isExportDefaultSpecifier(); } - parseAssignableListItem(flags, decorators) { + parseBindingElement(flags, decorators) { const startLoc = this.state.startLoc; const modified = {}; this.tsParseModifiers({ @@ -32147,18 +32171,15 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { return super.shouldParseExportDeclaration(); } parseConditional(expr, startLoc, refExpressionErrors) { - if (!this.state.maybeInArrowParameters || !this.match(17)) { - return super.parseConditional(expr, startLoc, refExpressionErrors); - } - const result = this.tryParse(() => super.parseConditional(expr, startLoc)); - if (!result.node) { - if (result.error) { - super.setOptionalParametersError(refExpressionErrors, result.error); + if (!this.match(17)) return expr; + if (this.state.maybeInArrowParameters) { + const nextCh = this.lookaheadCharCode(); + if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41) { + this.setOptionalParametersError(refExpressionErrors); + return expr; } - return expr; } - if (result.error) this.state = result.failState; - return result.node; + return super.parseConditional(expr, startLoc, refExpressionErrors); } parseParenItem(node, startLoc) { const newNode = super.parseParenItem(node, startLoc); @@ -32375,8 +32396,8 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { throw ((_jsx3 = jsx) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error); } reportReservedArrowTypeParam(node) { - var _node$extra; - if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra = node.extra) != null && _node$extra.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { + var _node$extra2; + if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra2 = node.extra) != null && _node$extra2.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) { this.raise(TSErrors.ReservedArrowTypeParam, node); } } @@ -32476,7 +32497,6 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { case "TSParameterProperty": return "parameter"; case "TSNonNullExpression": - case "TSInstantiationExpression": return "expression"; case "TSAsExpression": case "TSSatisfiesExpression": @@ -32562,14 +32582,12 @@ var typescript = superClass => class TypeScriptParserMixin extends superClass { } return type; } - toAssignableList(exprList, trailingCommaLoc, isLHS) { - for (let i = 0; i < exprList.length; i++) { - const expr = exprList[i]; - if ((expr == null ? void 0 : expr.type) === "TSTypeCastExpression") { - exprList[i] = this.typeCastToParameter(expr); - } + toAssignableListItem(exprList, index, isLHS) { + const node = exprList[index]; + if (node.type === "TSTypeCastExpression") { + exprList[index] = this.typeCastToParameter(node); } - super.toAssignableList(exprList, trailingCommaLoc, isLHS); + super.toAssignableListItem(exprList, index, isLHS); } typeCastToParameter(node) { node.expression.typeAnnotation = node.typeAnnotation; @@ -33138,18 +33156,18 @@ const mixinPlugins = { }; const mixinPluginNames = Object.keys(mixinPlugins); class ExpressionParser extends LValParser { - checkProto(prop, isRecord, protoRef, refExpressionErrors) { + checkProto(prop, isRecord, sawProto, refExpressionErrors) { if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand) { - return; + return sawProto; } const key = prop.key; const name = key.type === "Identifier" ? key.name : key.value; if (name === "__proto__") { if (isRecord) { this.raise(Errors.RecordNoProto, key); - return; + return true; } - if (protoRef.used) { + if (sawProto) { if (refExpressionErrors) { if (refExpressionErrors.doubleProtoLoc === null) { refExpressionErrors.doubleProtoLoc = key.loc.start; @@ -33158,8 +33176,9 @@ class ExpressionParser extends LValParser { this.raise(Errors.DuplicateProto, key); } } - protoRef.used = true; + return true; } + return sawProto; } shouldExitDescending(expr, potentialArrowAt) { return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt; @@ -33174,7 +33193,7 @@ class ExpressionParser extends LValParser { this.finalizeRemainingComments(); expr.comments = this.comments; expr.errors = this.state.errors; - if (this.optionFlags & 128) { + if (this.optionFlags & 256) { expr.tokens = this.tokens; } return expr; @@ -33205,15 +33224,16 @@ class ExpressionParser extends LValParser { parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) { return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse)); } - setOptionalParametersError(refExpressionErrors, resultError) { - var _resultError$loc; - refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError == null ? void 0 : resultError.loc) != null ? _resultError$loc : this.state.startLoc; + setOptionalParametersError(refExpressionErrors) { + refExpressionErrors.optionalParametersLoc = this.state.startLoc; } parseMaybeAssign(refExpressionErrors, afterLeftParse) { const startLoc = this.state.startLoc; - if (this.isContextual(108)) { + const isYield = this.isContextual(108); + if (isYield) { if (this.prodParam.hasYield) { - let left = this.parseYield(); + this.next(); + let left = this.parseYield(startLoc); if (afterLeftParse) { left = afterLeftParse.call(this, left, startLoc); } @@ -33265,6 +33285,16 @@ class ExpressionParser extends LValParser { } else if (ownExpressionErrors) { this.checkExpressionErrors(refExpressionErrors, true); } + if (isYield) { + const { + type + } = this.state; + const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54); + if (startsExpr && !this.isAmbiguousPrefixOrIdentifier()) { + this.raiseOverwrite(Errors.YieldNotInGeneratorFunction, startLoc); + return this.parseYield(startLoc); + } + } return left; } parseMaybeConditional(refExpressionErrors) { @@ -33441,7 +33471,7 @@ class ExpressionParser extends LValParser { type } = this.state; const startsExpr = this.hasPlugin("v8intrinsic") ? tokenCanStartExpression(type) : tokenCanStartExpression(type) && !this.match(54); - if (startsExpr && !this.isAmbiguousAwait()) { + if (startsExpr && !this.isAmbiguousPrefixOrIdentifier()) { this.raiseOverwrite(Errors.AwaitNotInAsyncContext, startLoc); return this.parseAwait(startLoc); } @@ -33680,7 +33710,7 @@ class ExpressionParser extends LValParser { return this.parseImportMetaProperty(node); } if (this.match(10)) { - if (this.optionFlags & 256) { + if (this.optionFlags & 512) { return this.parseImportCall(node); } else { return this.finishNode(node, "Import"); @@ -33985,7 +34015,7 @@ class ExpressionParser extends LValParser { } else if (this.isContextual(105) || this.isContextual(97)) { const isSource = this.isContextual(105); this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation"); - if (!(this.optionFlags & 256)) { + if (!(this.optionFlags & 512)) { throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, { phase: this.state.value }); @@ -34105,7 +34135,7 @@ class ExpressionParser extends LValParser { return this.wrapParenthesis(startLoc, val); } wrapParenthesis(startLoc, expression) { - if (!(this.optionFlags & 512)) { + if (!(this.optionFlags & 1024)) { this.addExtra(expression, "parenthesized", true); this.addExtra(expression, "parenStart", startLoc.index); this.takeSurroundingComments(expression, startLoc.index, this.state.lastTokEndLoc.index); @@ -34209,7 +34239,7 @@ class ExpressionParser extends LValParser { } const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody; this.state.inFSharpPipelineDirectBody = false; - const propHash = Object.create(null); + let sawProto = false; let first = true; const node = this.startNode(); node.properties = []; @@ -34229,7 +34259,7 @@ class ExpressionParser extends LValParser { prop = this.parseBindingProperty(); } else { prop = this.parsePropertyDefinition(refExpressionErrors); - this.checkProto(prop, isRecord, propHash, refExpressionErrors); + sawProto = this.checkProto(prop, isRecord, sawProto, refExpressionErrors); } if (isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement") { this.raise(Errors.InvalidRecordProperty, prop); @@ -34661,7 +34691,7 @@ class ExpressionParser extends LValParser { this.raise(Errors.ObsoleteAwaitStar, node); } if (!this.scope.inFunction && !(this.optionFlags & 1)) { - if (this.isAmbiguousAwait()) { + if (this.isAmbiguousPrefixOrIdentifier()) { this.ambiguousScriptDifferentAst = true; } else { this.sawUnambiguousESM = true; @@ -34672,17 +34702,16 @@ class ExpressionParser extends LValParser { } return this.finishNode(node, "AwaitExpression"); } - isAmbiguousAwait() { + isAmbiguousPrefixOrIdentifier() { if (this.hasPrecedingLineBreak()) return true; const { type } = this.state; return type === 53 || type === 10 || type === 0 || tokenIsTemplate(type) || type === 102 && !this.state.containsEsc || type === 138 || type === 56 || this.hasPlugin("v8intrinsic") && type === 54; } - parseYield() { - const node = this.startNode(); + parseYield(startLoc) { + const node = this.startNodeAt(startLoc); this.expressionScope.recordParameterInitializerError(Errors.YieldInParameter, node); - this.next(); let delegating = false; let argument = null; if (!this.hasPrecedingLineBreak()) { @@ -34984,7 +35013,7 @@ class StatementParser extends ExpressionParser { parseTopLevel(file, program) { file.program = this.parseProgram(program); file.comments = this.comments; - if (this.optionFlags & 128) { + if (this.optionFlags & 256) { file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex); } return this.finishNode(file, "File"); @@ -34994,7 +35023,7 @@ class StatementParser extends ExpressionParser { program.interpreter = this.parseInterpreterDirective(); this.parseBlockBody(program, true, true, end); if (this.inModule) { - if (!(this.optionFlags & 32) && this.scope.undefinedExports.size > 0) { + if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0) { for (const [localName, at] of Array.from(this.scope.undefinedExports)) { this.raise(Errors.ModuleExportUndefined, at, { localName @@ -35227,14 +35256,8 @@ class StatementParser extends ExpressionParser { let result; if (startType === 83) { result = this.parseImport(node); - if (result.type === "ImportDeclaration" && (!result.importKind || result.importKind === "value")) { - this.sawUnambiguousESM = true; - } } else { result = this.parseExport(node, decorators); - if (result.type === "ExportNamedDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportAllDeclaration" && (!result.exportKind || result.exportKind === "value") || result.type === "ExportDefaultDeclaration") { - this.sawUnambiguousESM = true; - } } this.assertModuleNodeAllowed(result); return result; @@ -36145,6 +36168,7 @@ class StatementParser extends ExpressionParser { throw this.raise(Errors.UnsupportedDecoratorExport, node); } this.parseExportFrom(node, true); + this.sawUnambiguousESM = true; return this.finishNode(node, "ExportAllDeclaration"); } const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node); @@ -36173,6 +36197,7 @@ class StatementParser extends ExpressionParser { } else if (decorators) { throw this.raise(Errors.UnsupportedDecoratorExport, node); } + this.sawUnambiguousESM = true; return this.finishNode(node2, "ExportNamedDeclaration"); } if (this.eat(65)) { @@ -36185,6 +36210,7 @@ class StatementParser extends ExpressionParser { throw this.raise(Errors.UnsupportedDecoratorExport, node); } this.checkExport(node2, true, true); + this.sawUnambiguousESM = true; return this.finishNode(node2, "ExportDefaultDeclaration"); } this.unexpected(null, 5); @@ -36222,10 +36248,12 @@ class StatementParser extends ExpressionParser { const isTypeExport = node2.exportKind === "type"; node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport)); node2.source = null; - node2.declaration = null; if (this.hasPlugin("importAssertions")) { node2.assertions = []; + } else { + node2.attributes = []; } + node2.declaration = null; return true; } return false; @@ -36236,6 +36264,8 @@ class StatementParser extends ExpressionParser { node.source = null; if (this.hasPlugin("importAssertions")) { node.assertions = []; + } else { + node.attributes = []; } node.declaration = this.parseExportDeclaration(node); return true; @@ -36599,6 +36629,7 @@ class StatementParser extends ExpressionParser { this.checkImportReflection(node); this.checkJSONModuleImport(node); this.semicolon(); + this.sawUnambiguousESM = true; return this.finishNode(node, "ImportDeclaration"); } parseImportSource() { @@ -36682,6 +36713,7 @@ class StatementParser extends ExpressionParser { this.next(); if (this.hasPlugin("moduleAttributes")) { attributes = this.parseModuleAttributes(); + this.addExtra(node, "deprecatedWithLegacySyntax", true); } else { attributes = this.parseImportAttributes(); } @@ -36795,31 +36827,34 @@ class Parser extends StatementParser { optionFlags |= 16; } if (options.allowUndeclaredExports) { - optionFlags |= 32; + optionFlags |= 64; } if (options.allowNewTargetOutsideFunction) { optionFlags |= 4; } + if (options.allowYieldOutsideFunction) { + optionFlags |= 32; + } if (options.ranges) { - optionFlags |= 64; + optionFlags |= 128; } if (options.tokens) { - optionFlags |= 128; + optionFlags |= 256; } if (options.createImportExpressions) { - optionFlags |= 256; + optionFlags |= 512; } if (options.createParenthesizedExpressions) { - optionFlags |= 512; + optionFlags |= 1024; } if (options.errorRecovery) { - optionFlags |= 1024; + optionFlags |= 2048; } if (options.attachComment) { - optionFlags |= 2048; + optionFlags |= 4096; } if (options.annexB) { - optionFlags |= 4096; + optionFlags |= 8192; } this.optionFlags = optionFlags; } @@ -37198,7 +37233,7 @@ exports.merge = merge; exports.normalizeReplacements = normalizeReplacements; exports.validate = validate; const _excluded = ["placeholderWhitelist", "placeholderPattern", "preserveComments", "syntacticPlaceholders"]; -function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; } +function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; } function merge(a, b) { const { placeholderWhitelist = a.placeholderWhitelist, @@ -37409,8 +37444,11 @@ function parseWithCodeFrame(code, parserOpts, syntacticPlaceholders) { plugins.push("placeholders"); } parserOpts = Object.assign({ + allowAwaitOutsideFunction: true, allowReturnOutsideFunction: true, + allowNewTargetOutsideFunction: true, allowSuperOutsideMethod: true, + allowYieldOutsideFunction: true, sourceType: "module" }, parserOpts, { plugins @@ -43634,6 +43672,9 @@ function assertPrivateName(node, opts) { function assertStaticBlock(node, opts) { assert("StaticBlock", node, opts); } +function assertImportAttribute(node, opts) { + assert("ImportAttribute", node, opts); +} function assertAnyTypeAnnotation(node, opts) { assert("AnyTypeAnnotation", node, opts); } @@ -43889,9 +43930,6 @@ function assertArgumentPlaceholder(node, opts) { function assertBindExpression(node, opts) { assert("BindExpression", node, opts); } -function assertImportAttribute(node, opts) { - assert("ImportAttribute", node, opts); -} function assertDecorator(node, opts) { assert("Decorator", node, opts); } @@ -45668,6 +45706,17 @@ function staticBlock(body) { validate(defs.body, node, "body", body, 1); return node; } +function importAttribute(key, value) { + const node = { + type: "ImportAttribute", + key, + value + }; + const defs = NODE_FIELDS.ImportAttribute; + validate(defs.key, node, "key", key, 1); + validate(defs.value, node, "value", value, 1); + return node; +} function anyTypeAnnotation() { return { type: "AnyTypeAnnotation" @@ -46514,17 +46563,6 @@ function bindExpression(object, callee) { validate(defs.callee, node, "callee", callee, 1); return node; } -function importAttribute(key, value) { - const node = { - type: "ImportAttribute", - key, - value - }; - const defs = NODE_FIELDS.ImportAttribute; - validate(defs.key, node, "key", key, 1); - validate(defs.value, node, "value", value, 1); - return node; -} function decorator(expression) { const node = { type: "Decorator", @@ -49361,7 +49399,7 @@ const MODULEDECLARATION_TYPES = exports.MODULEDECLARATION_TYPES = IMPORTOREXPORT Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.UPDATE_OPERATORS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.STATEMENT_OR_BLOCK_KEYS = exports.NUMBER_UNARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.NOT_LOCAL_BINDING = exports.LOGICAL_OPERATORS = exports.INHERIT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.EQUALITY_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.COMMENT_KEYS = exports.BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.BLOCK_SCOPED_SYMBOL = exports.BINARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = void 0; +exports.UPDATE_OPERATORS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.STATEMENT_OR_BLOCK_KEYS = exports.NUMBER_UNARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.LOGICAL_OPERATORS = exports.INHERIT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.EQUALITY_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.COMMENT_KEYS = exports.BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.BINARY_OPERATORS = exports.ASSIGNMENT_OPERATORS = void 0; const STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"]; const FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"]; const FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"]; @@ -49383,8 +49421,10 @@ const INHERIT_KEYS = exports.INHERIT_KEYS = { optional: ["typeAnnotation", "typeParameters", "returnType"], force: ["start", "loc", "end"] }; -const BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); -const NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); +{ + exports.BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); + exports.NOT_LOCAL_BINDING = Symbol.for("should not be considered a local binding"); +} //# sourceMappingURL=index.js.map @@ -49812,6 +49852,9 @@ function valueToNode(value) { } return result; } + if (typeof value === "bigint") { + return (0, _index.bigIntLiteral)(value.toString()); + } if (isRegExp(value)) { const pattern = value.source; const flags = /\/([a-z]*)$/.exec(value.toString())[1]; @@ -49823,13 +49866,19 @@ function valueToNode(value) { if (isPlainObject(value)) { const props = []; for (const key of Object.keys(value)) { - let nodeKey; + let nodeKey, + computed = false; if ((0, _isValidIdentifier.default)(key)) { - nodeKey = (0, _index.identifier)(key); + if (key === "__proto__") { + computed = true; + nodeKey = (0, _index.stringLiteral)(key); + } else { + nodeKey = (0, _index.identifier)(key); + } } else { nodeKey = (0, _index.stringLiteral)(key); } - props.push((0, _index.objectProperty)(nodeKey, valueToNode(value[key]))); + props.push((0, _index.objectProperty)(nodeKey, valueToNode(value[key]), computed)); } return (0, _index.objectExpression)(props); } @@ -50221,7 +50270,7 @@ defineType("Identifier", { } }), validate: process.env.BABEL_TYPES_8_BREAKING ? function (parent, key, node) { - const match = /\.(\w+)$/.exec(key); + const match = /\.(\w+)$/.exec(key.toString()); if (!match) return; const [, parentKey] = match; const nonComp = { @@ -50510,7 +50559,7 @@ defineType("RestElement", { } }), validate: process.env.BABEL_TYPES_8_BREAKING ? function (parent, key) { - const match = /(\w+)\[(\d+)\]/.exec(key); + const match = /(\w+)\[(\d+)\]/.exec(key.toString()); if (!match) throw new Error("Internal Babel error: malformed key."); const [, listKey, index] = match; if (parent[listKey].length > +index + 1) { @@ -51482,6 +51531,17 @@ defineType("StaticBlock", { }, aliases: ["Scopable", "BlockParent", "FunctionParent"] }); +defineType("ImportAttribute", { + visitor: ["key", "value"], + fields: { + key: { + validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") + }, + value: { + validate: (0, _utils.assertNodeType)("StringLiteral") + } + } +}); //# sourceMappingURL=core.js.map @@ -51538,17 +51598,6 @@ var _utils = __nccwpck_require__(4106); } } }); -(0, _utils.default)("ImportAttribute", { - visitor: ["key", "value"], - fields: { - key: { - validate: (0, _utils.assertNodeType)("Identifier", "StringLiteral") - }, - value: { - validate: (0, _utils.assertNodeType)("StringLiteral") - } - } -}); (0, _utils.default)("Decorator", { visitor: ["expression"], fields: { @@ -52240,6 +52289,19 @@ var _deprecatedAliases = __nccwpck_require__(9563); Object.keys(_deprecatedAliases.DEPRECATED_ALIASES).forEach(deprecatedAlias => { _utils.FLIPPED_ALIAS_KEYS[deprecatedAlias] = _utils.FLIPPED_ALIAS_KEYS[_deprecatedAliases.DEPRECATED_ALIASES[deprecatedAlias]]; }); +for (const { + types, + set +} of _utils.allExpandedTypes) { + for (const type of types) { + const aliases = _utils.FLIPPED_ALIAS_KEYS[type]; + if (aliases) { + aliases.forEach(set.add, set); + } else { + set.add(type); + } + } +} const TYPES = exports.TYPES = [].concat(Object.keys(_utils.VISITOR_KEYS), Object.keys(_utils.FLIPPED_ALIAS_KEYS), Object.keys(_utils.DEPRECATED_KEYS)); //# sourceMappingURL=index.js.map @@ -53029,7 +53091,7 @@ defineType("TSTypeParameter", { Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.VISITOR_KEYS = exports.NODE_PARENT_VALIDATIONS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.ALIAS_KEYS = void 0; +exports.allExpandedTypes = exports.VISITOR_KEYS = exports.NODE_PARENT_VALIDATIONS = exports.NODE_FIELDS = exports.FLIPPED_ALIAS_KEYS = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.ALIAS_KEYS = void 0; exports.arrayOf = arrayOf; exports.arrayOfType = arrayOfType; exports.assertEach = assertEach; @@ -53098,11 +53160,16 @@ function assertEach(callback) { const childValidator = process.env.BABEL_TYPES_8_BREAKING ? _validate.validateChild : () => {}; function validator(node, key, val) { if (!Array.isArray(val)) return; - for (let i = 0; i < val.length; i++) { - const subkey = `${key}[${i}]`; + let i = 0; + const subKey = { + toString() { + return `${key}[${i}]`; + } + }; + for (; i < val.length; i++) { const v = val[i]; - callback(node, subkey, v); - childValidator(node, subkey, v); + callback(node, subKey, v); + childValidator(node, subKey, v); } } validator.each = callback; @@ -53117,23 +53184,39 @@ function assertOneOf(...values) { validate.oneOf = values; return validate; } +const allExpandedTypes = exports.allExpandedTypes = []; function assertNodeType(...types) { + const expandedTypes = new Set(); + allExpandedTypes.push({ + types, + set: expandedTypes + }); function validate(node, key, val) { - for (const type of types) { - if ((0, _is.default)(type, val)) { + const valType = val == null ? void 0 : val.type; + if (valType != null) { + if (expandedTypes.has(valType)) { (0, _validate.validateChild)(node, key, val); return; } + if (valType === "Placeholder") { + for (const type of types) { + if ((0, _is.default)(type, val)) { + (0, _validate.validateChild)(node, key, val); + return; + } + } + } } - throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`); + throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(valType)}`); } validate.oneOfNodeTypes = types; return validate; } function assertNodeOrValueType(...types) { function validate(node, key, val) { + const primitiveType = getType(val); for (const type of types) { - if (getType(val) === type || (0, _is.default)(type, val)) { + if (primitiveType === type || (0, _is.default)(type, val)) { (0, _validate.validateChild)(node, key, val); return; } @@ -53145,18 +53228,19 @@ function assertNodeOrValueType(...types) { } function assertValueType(type) { function validate(node, key, val) { - const valid = getType(val) === type; - if (!valid) { - throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); + if (getType(val) === type) { + return; } + throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); } validate.type = type; return validate; } function assertShape(shape) { + const keys = Object.keys(shape); function validate(node, key, val) { const errors = []; - for (const property of Object.keys(shape)) { + for (const property of keys) { try { (0, _validate.validateField)(node, property, val[property], shape[property]); } catch (error) { @@ -53217,9 +53301,9 @@ function defineAliasedType(...aliases) { return (type, opts = {}) => { let defined = opts.aliases; if (!defined) { - var _store$opts$inherits$, _defined; + var _store$opts$inherits$; if (opts.inherits) defined = (_store$opts$inherits$ = store[opts.inherits].aliases) == null ? void 0 : _store$opts$inherits$.slice(); - (_defined = defined) != null ? _defined : defined = []; + defined != null ? defined : defined = []; opts.aliases = defined; } const additional = aliases.filter(a => !defined.includes(a)); @@ -54502,23 +54586,37 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = traverseFast; var _index = __nccwpck_require__(5078); +const _skip = Symbol(); +const _stop = Symbol(); function traverseFast(node, enter, opts) { - if (!node) return; + if (!node) return false; const keys = _index.VISITOR_KEYS[node.type]; - if (!keys) return; + if (!keys) return false; opts = opts || {}; - enter(node, opts); + const ret = enter(node, opts); + if (ret !== undefined) { + switch (ret) { + case _skip: + return false; + case _stop: + return true; + } + } for (const key of keys) { const subNode = node[key]; + if (!subNode) continue; if (Array.isArray(subNode)) { for (const node of subNode) { - traverseFast(node, enter, opts); + if (traverseFast(node, enter, opts)) return true; } } else { - traverseFast(subNode, enter, opts); + if (traverseFast(subNode, enter, opts)) return true; } } + return false; } +traverseFast.skip = _skip; +traverseFast.stop = _stop; //# sourceMappingURL=traverseFast.js.map @@ -55449,6 +55547,11 @@ function isStaticBlock(node, opts) { if (node.type !== "StaticBlock") return false; return opts == null || (0, _shallowEqual.default)(node, opts); } +function isImportAttribute(node, opts) { + if (!node) return false; + if (node.type !== "ImportAttribute") return false; + return opts == null || (0, _shallowEqual.default)(node, opts); +} function isAnyTypeAnnotation(node, opts) { if (!node) return false; if (node.type !== "AnyTypeAnnotation") return false; @@ -55874,11 +55977,6 @@ function isBindExpression(node, opts) { if (node.type !== "BindExpression") return false; return opts == null || (0, _shallowEqual.default)(node, opts); } -function isImportAttribute(node, opts) { - if (!node) return false; - if (node.type !== "ImportAttribute") return false; - return opts == null || (0, _shallowEqual.default)(node, opts); -} function isDecorator(node, opts) { if (!node) return false; if (node.type !== "Decorator") return false; @@ -56360,6 +56458,7 @@ function isStandardized(node, opts) { case "ClassPrivateMethod": case "PrivateName": case "StaticBlock": + case "ImportAttribute": break; case "Placeholder": switch (node.expectedNode) { @@ -57600,9 +57699,13 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = isLet; var _index = __nccwpck_require__(2605); -var _index2 = __nccwpck_require__(9743); +{ + var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); +} function isLet(node) { - return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[_index2.BLOCK_SCOPED_SYMBOL]); + { + return (0, _index.isVariableDeclaration)(node) && (node.kind !== "var" || node[BLOCK_SCOPED_SYMBOL]); + } } //# sourceMappingURL=isLet.js.map @@ -57709,11 +57812,7 @@ var _index = __nccwpck_require__(5078); function isPlaceholderType(placeholderType, targetType) { if (placeholderType === targetType) return true; const aliases = _index.PLACEHOLDERS_ALIAS[placeholderType]; - if (aliases) { - for (const alias of aliases) { - if (targetType === alias) return true; - } - } + if (aliases != null && aliases.includes(targetType)) return true; return false; } @@ -57890,12 +57989,7 @@ function isType(nodeType, targetType) { if (nodeType == null) return false; if (_index.ALIAS_KEYS[targetType]) return false; const aliases = _index.FLIPPED_ALIAS_KEYS[targetType]; - if (aliases) { - if (aliases[0] === nodeType) return true; - for (const alias of aliases) { - if (nodeType === alias) return true; - } - } + if (aliases != null && aliases.includes(nodeType)) return true; return false; } @@ -57962,11 +58056,15 @@ Object.defineProperty(exports, "__esModule", ({ })); exports["default"] = isVar; var _index = __nccwpck_require__(2605); -var _index2 = __nccwpck_require__(9743); +{ + var BLOCK_SCOPED_SYMBOL = Symbol.for("var used to be block scoped"); +} function isVar(node) { - return (0, _index.isVariableDeclaration)(node, { - kind: "var" - }) && !node[_index2.BLOCK_SCOPED_SYMBOL]; + { + return (0, _index.isVariableDeclaration)(node, { + kind: "var" + }) && !node[BLOCK_SCOPED_SYMBOL]; + } } //# sourceMappingURL=isVar.js.map From feb8b443dd0db369b2ac1201b34fa4e467ecd5fa Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 12:30:42 -0600 Subject: [PATCH 09/31] Revert changes --- .../javascript/getPullRequestDetails/getPullRequestDetails.ts | 4 ++-- .github/workflows/cherryPick.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts index bf9a6cbe6b35e..fa6f05bf5cac4 100644 --- a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts +++ b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts @@ -10,8 +10,8 @@ const repoFullName = core.getInput('REPO_FULL_NAME', {required: true}); const [owner, repo] = repoFullName.split('/'); const DEFAULT_PAYLOAD = { - owner, - repo, + owner: CONST.GITHUB_OWNER, + repo: CONST.APP_REPO, }; const pullRequestNumber = getJSONInput('PULL_REQUEST_NUMBER', {required: false}, null); diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index b06d432f3244d..8649b6f8f4b4d 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -225,7 +225,7 @@ jobs: env: GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }} - - name: Add assignees to conflict PRs + if: fromJSON(steps.cherryPick.outputs.HAS_CONFLICTS) run: | gh pr edit --add-assignee "${{ github.actor }},${{ steps.getCPMergeCommit.outputs.MERGE_ACTOR }}" From 0ffce5cde64adc44a03e7f33993ee8ba4b703afa Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 12:34:14 -0600 Subject: [PATCH 10/31] Rebuild gh actions --- .github/actions/javascript/getPullRequestDetails/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 26678ddac3b84..51c7cac97bf7c 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -11461,8 +11461,8 @@ const EmptyObject_1 = __nccwpck_require__(8227); const repoFullName = core.getInput('REPO_FULL_NAME', { required: true }); const [owner, repo] = repoFullName.split('/'); const DEFAULT_PAYLOAD = { - owner, - repo, + owner: CONST_1.default.GITHUB_OWNER, + repo: CONST_1.default.APP_REPO, }; const pullRequestNumber = (0, ActionUtils_1.getJSONInput)('PULL_REQUEST_NUMBER', { required: false }, null); const user = core.getInput('USER', { required: true }); From 77c4a982507162615cc388a4fa9035caa5fa0150 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 12:37:15 -0600 Subject: [PATCH 11/31] Revert all changes to js action --- .github/actions/javascript/getPullRequestDetails/action.yml | 3 --- .../getPullRequestDetails/getPullRequestDetails.ts | 6 +----- .github/actions/javascript/getPullRequestDetails/index.js | 5 +---- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/actions/javascript/getPullRequestDetails/action.yml b/.github/actions/javascript/getPullRequestDetails/action.yml index a634ce14daeb0..d931d101b5da6 100644 --- a/.github/actions/javascript/getPullRequestDetails/action.yml +++ b/.github/actions/javascript/getPullRequestDetails/action.yml @@ -10,9 +10,6 @@ inputs: USER: description: The creator of the pull request required: true - REPO_FULL_NAME: - description: The full repository name in the 'owner/repo' format - required: true outputs: MERGE_COMMIT_SHA: description: 'The merge_commit_sha of the given pull request' diff --git a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts index fa6f05bf5cac4..8e285389e3f7e 100644 --- a/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts +++ b/.github/actions/javascript/getPullRequestDetails/getPullRequestDetails.ts @@ -6,9 +6,6 @@ import {isEmptyObject} from '@src/types/utils/EmptyObject'; type PullRequest = Awaited>['data']; -const repoFullName = core.getInput('REPO_FULL_NAME', {required: true}); -const [owner, repo] = repoFullName.split('/'); - const DEFAULT_PAYLOAD = { owner: CONST.GITHUB_OWNER, repo: CONST.APP_REPO, @@ -41,8 +38,7 @@ function outputMergeActor(PR: PullRequest) { * Output forked repo URL if PR includes changes from a fork. */ function outputForkedRepoUrl(PR: PullRequest) { - const repoUrl = `https://github.com/${repoFullName}`; - if (PR.head?.repo?.html_url === repoUrl) { + if (PR.head?.repo?.html_url === CONST.APP_REPO_URL) { core.setOutput('FORKED_REPO_URL', ''); } else { core.setOutput('FORKED_REPO_URL', `${PR.head?.repo?.html_url}.git`); diff --git a/.github/actions/javascript/getPullRequestDetails/index.js b/.github/actions/javascript/getPullRequestDetails/index.js index 51c7cac97bf7c..015c0f9898440 100644 --- a/.github/actions/javascript/getPullRequestDetails/index.js +++ b/.github/actions/javascript/getPullRequestDetails/index.js @@ -11458,8 +11458,6 @@ const ActionUtils_1 = __nccwpck_require__(6981); const CONST_1 = __importDefault(__nccwpck_require__(9873)); const GithubUtils_1 = __importDefault(__nccwpck_require__(9296)); const EmptyObject_1 = __nccwpck_require__(8227); -const repoFullName = core.getInput('REPO_FULL_NAME', { required: true }); -const [owner, repo] = repoFullName.split('/'); const DEFAULT_PAYLOAD = { owner: CONST_1.default.GITHUB_OWNER, repo: CONST_1.default.APP_REPO, @@ -11488,8 +11486,7 @@ function outputMergeActor(PR) { * Output forked repo URL if PR includes changes from a fork. */ function outputForkedRepoUrl(PR) { - const repoUrl = `https://github.com/${repoFullName}`; - if (PR.head?.repo?.html_url === repoUrl) { + if (PR.head?.repo?.html_url === CONST_1.default.APP_REPO_URL) { core.setOutput('FORKED_REPO_URL', ''); } else { From 19edd704f743316820c24fab4e583b4d18fb9542 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 12:39:06 -0600 Subject: [PATCH 12/31] Fix bad delete --- .github/workflows/cherryPick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 8649b6f8f4b4d..b06d432f3244d 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -225,7 +225,7 @@ jobs: env: GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }} - + - name: Add assignees to conflict PRs if: fromJSON(steps.cherryPick.outputs.HAS_CONFLICTS) run: | gh pr edit --add-assignee "${{ github.actor }},${{ steps.getCPMergeCommit.outputs.MERGE_ACTOR }}" From ceb62f1011197e7883460b9c35607f82f0cda711 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Thu, 17 Apr 2025 13:19:47 -0600 Subject: [PATCH 13/31] Use OS Botify for the labeling due to permissions error --- .github/workflows/cherryPick.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index b06d432f3244d..37f1326c4772a 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -237,9 +237,9 @@ jobs: continue-on-error: true - name: Label original PR with CP Staging - run: gh pr edit ${{ github.event.inputs.PULL_REQUEST_URL }} --add-label 'CP Staging' + run: gh pr edit ${{ github.event.inputs.PULL_REQUEST_URL }} --add-label 'CP Staging' env: - GITHUB_TOKEN: ${{ github.token }} + GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - name: "Announces a CP failure in the #announce Slack room" # v3 From 8ed6aff17c86a24fe2199cd050d83a5a4bf39ed6 Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 17 Apr 2025 13:16:22 -0700 Subject: [PATCH 14/31] Save draft state --- tests/unit/CIGitLogicTest.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index be6a10f2466c0..d4d7e477fb08e 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -20,6 +20,7 @@ import * as Log from '../../scripts/utils/Logger'; const DUMMY_DIR = path.resolve(os.homedir(), 'DumDumRepo'); const GIT_REMOTE = path.resolve(os.homedir(), 'dummyGitRemotes/DumDumRepo'); +const SUBMOD_REMOTE = path.resolve(os.homedir(), 'dummyGitRemotes/SubMod'); const mockGetInput = jest.fn(); @@ -62,6 +63,23 @@ function getVersion(): string { } function initGitServer() { + Log.info('Initializing git server for submodule...'); + if (fs.existsSync(SUBMOD_REMOTE)) { + Log.info(`${SUBMOD_REMOTE} exists, removing it now...`); + fs.rmSync(SUBMOD_REMOTE, {recursive: true}); + } + fs.mkdirSync(SUBMOD_REMOTE, {recursive: true}); + process.chdir(SUBMOD_REMOTE); + exec('git init -b main'); + setupGitAsHuman(); + exec('npm init -y'); + exec('npm version --no-git-tag-version 1.0.0-0'); + fs.appendFileSync('.gitignore', 'node_modules/\n'); + exec('git add -A'); + exec('git commit -m "Initial commit"'); + exec('git switch -c staging'); + exec('git switch -c production'); + Log.info('Initializing git server...'); if (fs.existsSync(GIT_REMOTE)) { Log.info(`${GIT_REMOTE} exists, removing it now...`); @@ -71,6 +89,7 @@ function initGitServer() { process.chdir(GIT_REMOTE); exec('git init -b main'); setupGitAsHuman(); + exec(`git submodule add ${SUBMOD_REMOTE} SubMod`); exec('npm init -y'); exec('npm version --no-git-tag-version 1.0.0-0'); fs.appendFileSync('.gitignore', 'node_modules/\n'); From f863cc3500e2339781129b66a8399025a1472a30 Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 17 Apr 2025 13:20:06 -0700 Subject: [PATCH 15/31] Fix submodule creation --- tests/unit/CIGitLogicTest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index d4d7e477fb08e..bd6fa9301ef1e 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -89,7 +89,7 @@ function initGitServer() { process.chdir(GIT_REMOTE); exec('git init -b main'); setupGitAsHuman(); - exec(`git submodule add ${SUBMOD_REMOTE} SubMod`); + exec(`git -c protocol.file.allow=always submodule add ${SUBMOD_REMOTE} SubMod`); exec('npm init -y'); exec('npm version --no-git-tag-version 1.0.0-0'); fs.appendFileSync('.gitignore', 'node_modules/\n'); From 67369c492d73272439b0b0b81043cfe5bdf5540e Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 18 Apr 2025 11:10:52 -0600 Subject: [PATCH 16/31] Remove the specific flags causing issues --- .github/workflows/cherryPick.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 37f1326c4772a..215864391bc23 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -125,13 +125,13 @@ jobs: working-directory: Mobile-Expensify run: | git switch staging - git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getMobileExpensifyVersionBumpCommit.outputs.VERSION_BUMP_SHA }} + git cherry-pick -S -x --mainline 1 ${{ steps.getMobileExpensifyVersionBumpCommit.outputs.VERSION_BUMP_SHA }} git push origin staging - name: Cherry-pick the E/App version-bump to staging run: | git switch staging - git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }} + git cherry-pick -S -x --mainline 1 ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }} - name: Update the Mobile-Expensify submodule on E/App staging run: | From 902ddc6d487f82b502c7ba9d064ca043dd7bab06 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 18 Apr 2025 11:40:35 -0600 Subject: [PATCH 17/31] Fetch for submodule --- .github/workflows/cherryPick.yml | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 215864391bc23..c18ab5244d0e7 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -66,23 +66,10 @@ jobs: - name: Fetch history of relevant refs run: | - # # Temporary hack during transition when -staging suffix is being added to tags - # if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then - # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} - # else - # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging - # fi - - # cd Mobile-Expensify - # # Temporary hack during transition when -staging suffix is being added to tags - # if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then - # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} - # else - # git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging - # fi - - # Temporary hack to fetch the latest staging branch + echo "Fetching main and staging for the main repository..." git fetch origin main staging + echo "Fetching main and staging for submodules..." + cd Mobile-Expensify && git fetch origin main staging - name: Get E/App version bump commit id: getVersionBumpCommit From 25205fbbe9c1bdf1266d5a144d61738fba4ace5d Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 18 Apr 2025 11:41:15 -0600 Subject: [PATCH 18/31] Add back the flags --- .github/workflows/cherryPick.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index c18ab5244d0e7..f89953a4a4268 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -112,13 +112,13 @@ jobs: working-directory: Mobile-Expensify run: | git switch staging - git cherry-pick -S -x --mainline 1 ${{ steps.getMobileExpensifyVersionBumpCommit.outputs.VERSION_BUMP_SHA }} + git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getMobileExpensifyVersionBumpCommit.outputs.VERSION_BUMP_SHA }} git push origin staging - name: Cherry-pick the E/App version-bump to staging run: | git switch staging - git cherry-pick -S -x --mainline 1 ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }} + git cherry-pick -S -x --mainline 1 --strategy=recursive -Xtheirs ${{ steps.getVersionBumpCommit.outputs.VERSION_BUMP_SHA }} - name: Update the Mobile-Expensify submodule on E/App staging run: | From af8295885cae6870fd20c0ebedde4a9fbdabd883 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 18 Apr 2025 11:55:32 -0600 Subject: [PATCH 19/31] Try fetch-depth 0 hack --- .github/workflows/cherryPick.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index f89953a4a4268..2b3ed4c193339 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -16,13 +16,14 @@ jobs: needs: createNewVersion runs-on: ubuntu-latest steps: - - name: Checkout staging branch + - name: Checkout staging branch with full history # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: ref: staging token: ${{ secrets.OS_BOTIFY_TOKEN }} submodules: true + fetch-depth: 0 # Fetch all history for the main repository and submodules - name: Extract PR information id: getPRInfo From 81fc64fd7c0dfafeddba8edd910e1893984d0581 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Fri, 18 Apr 2025 14:08:43 -0600 Subject: [PATCH 20/31] Try a different fetching method --- .github/workflows/cherryPick.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 2b3ed4c193339..55215b7a222e1 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -23,7 +23,6 @@ jobs: ref: staging token: ${{ secrets.OS_BOTIFY_TOKEN }} submodules: true - fetch-depth: 0 # Fetch all history for the main repository and submodules - name: Extract PR information id: getPRInfo @@ -65,12 +64,26 @@ jobs: with: SEMVER_LEVEL: "PATCH" - - name: Fetch history of relevant refs + - name: Fetch necessary history run: | - echo "Fetching main and staging for the main repository..." + # Unshallow the main repository to get full history needed for merge-base calculation + # This converts the shallow clone from checkout into a full one. + echo "Unshallowing the main repository..." + # Add || true in case the repo is already unshallow or the command fails unexpectedly + git fetch --unshallow origin || true + + # Unshallow the submodule(s) + echo "Unshallowing submodules..." + # Use submodule foreach to apply to all submodules (Mobile-Expensify) + # Add || true here as well for robustness + git submodule foreach 'git fetch --unshallow origin || true' + + # Explicitly fetch the latest main and staging refs (good practice after unshallow) + echo "Fetching latest main and staging refs for the main repository..." git fetch origin main staging - echo "Fetching main and staging for submodules..." - cd Mobile-Expensify && git fetch origin main staging + + echo "Fetching latest main and staging refs for submodules..." + git submodule foreach 'git fetch origin main staging' - name: Get E/App version bump commit id: getVersionBumpCommit From b5d7c7057a60e8c2b8f7cb6fdfdf6f5ca14db282 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 15:33:43 -0600 Subject: [PATCH 21/31] Reset much of the code back to main --- .github/workflows/cherryPick.yml | 38 ++++++++++++++------------------ tests/unit/CIGitLogicTest.ts | 19 ---------------- 2 files changed, 17 insertions(+), 40 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 55215b7a222e1..5c4addfda2476 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -16,13 +16,14 @@ jobs: needs: createNewVersion runs-on: ubuntu-latest steps: - - name: Checkout staging branch with full history + - name: Checkout staging branch # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: ref: staging token: ${{ secrets.OS_BOTIFY_TOKEN }} submodules: true + fetch-depth: 0 - name: Extract PR information id: getPRInfo @@ -64,26 +65,21 @@ jobs: with: SEMVER_LEVEL: "PATCH" - - name: Fetch necessary history - run: | - # Unshallow the main repository to get full history needed for merge-base calculation - # This converts the shallow clone from checkout into a full one. - echo "Unshallowing the main repository..." - # Add || true in case the repo is already unshallow or the command fails unexpectedly - git fetch --unshallow origin || true - - # Unshallow the submodule(s) - echo "Unshallowing submodules..." - # Use submodule foreach to apply to all submodules (Mobile-Expensify) - # Add || true here as well for robustness - git submodule foreach 'git fetch --unshallow origin || true' - - # Explicitly fetch the latest main and staging refs (good practice after unshallow) - echo "Fetching latest main and staging refs for the main repository..." - git fetch origin main staging - - echo "Fetching latest main and staging refs for submodules..." - git submodule foreach 'git fetch origin main staging' + - name: Fetch history of relevant refs + run: | + # Temporary hack during transition when -staging suffix is being added to tags + if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} + else + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging + fi + cd Mobile-Expensify + # Temporary hack during transition when -staging suffix is being added to tags + if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} + else + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging + fi - name: Get E/App version bump commit id: getVersionBumpCommit diff --git a/tests/unit/CIGitLogicTest.ts b/tests/unit/CIGitLogicTest.ts index bd6fa9301ef1e..be6a10f2466c0 100644 --- a/tests/unit/CIGitLogicTest.ts +++ b/tests/unit/CIGitLogicTest.ts @@ -20,7 +20,6 @@ import * as Log from '../../scripts/utils/Logger'; const DUMMY_DIR = path.resolve(os.homedir(), 'DumDumRepo'); const GIT_REMOTE = path.resolve(os.homedir(), 'dummyGitRemotes/DumDumRepo'); -const SUBMOD_REMOTE = path.resolve(os.homedir(), 'dummyGitRemotes/SubMod'); const mockGetInput = jest.fn(); @@ -63,23 +62,6 @@ function getVersion(): string { } function initGitServer() { - Log.info('Initializing git server for submodule...'); - if (fs.existsSync(SUBMOD_REMOTE)) { - Log.info(`${SUBMOD_REMOTE} exists, removing it now...`); - fs.rmSync(SUBMOD_REMOTE, {recursive: true}); - } - fs.mkdirSync(SUBMOD_REMOTE, {recursive: true}); - process.chdir(SUBMOD_REMOTE); - exec('git init -b main'); - setupGitAsHuman(); - exec('npm init -y'); - exec('npm version --no-git-tag-version 1.0.0-0'); - fs.appendFileSync('.gitignore', 'node_modules/\n'); - exec('git add -A'); - exec('git commit -m "Initial commit"'); - exec('git switch -c staging'); - exec('git switch -c production'); - Log.info('Initializing git server...'); if (fs.existsSync(GIT_REMOTE)) { Log.info(`${GIT_REMOTE} exists, removing it now...`); @@ -89,7 +71,6 @@ function initGitServer() { process.chdir(GIT_REMOTE); exec('git init -b main'); setupGitAsHuman(); - exec(`git -c protocol.file.allow=always submodule add ${SUBMOD_REMOTE} SubMod`); exec('npm init -y'); exec('npm version --no-git-tag-version 1.0.0-0'); fs.appendFileSync('.gitignore', 'node_modules/\n'); From 256a7936f5a9f2570eef25b39d9e9a12e7517ba8 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 15:34:58 -0600 Subject: [PATCH 22/31] Fix spacing --- .github/workflows/cherryPick.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 5c4addfda2476..fe62be9f754b3 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -66,20 +66,20 @@ jobs: SEMVER_LEVEL: "PATCH" - name: Fetch history of relevant refs - run: | - # Temporary hack during transition when -staging suffix is being added to tags - if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} - else - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging - fi - cd Mobile-Expensify - # Temporary hack during transition when -staging suffix is being added to tags - if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} - else - git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging - fi + run: | + # Temporary hack during transition when -staging suffix is being added to tags + if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} + else + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging + fi + cd Mobile-Expensify + # Temporary hack during transition when -staging suffix is being added to tags + if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} + else + git fetch origin main staging --no-recurse-submodules --no-tags --shallow-exclude ${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }}-staging + fi - name: Get E/App version bump commit id: getVersionBumpCommit From b90c45a9c8b3d8ed58cc9b9fb60ea497a26e3ca8 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 15:37:19 -0600 Subject: [PATCH 23/31] Move code around to get PR info first --- .github/workflows/cherryPick.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index fe62be9f754b3..5ebd48a2c5888 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -16,15 +16,6 @@ jobs: needs: createNewVersion runs-on: ubuntu-latest steps: - - name: Checkout staging branch - # v4 - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 - with: - ref: staging - token: ${{ secrets.OS_BOTIFY_TOKEN }} - submodules: true - fetch-depth: 0 - - name: Extract PR information id: getPRInfo run: | @@ -42,6 +33,15 @@ jobs: id: getBranchName run: echo "CONFLICT_BRANCH_NAME=cherry-pick-staging-${{ steps.getPRInfo.outputs.PR_NUMBER }}-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" + - name: Checkout staging branch + # v4 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + with: + ref: staging + token: ${{ secrets.OS_BOTIFY_TOKEN }} + submodules: true + fetch-depth: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' && 0 || '' }} + # This command is necessary to fetch any branch other than main in the submodule. # See https://github.com/actions/checkout/issues/1815#issuecomment-2777836442 for further context. - name: Enable branch-switching in submodules From 12a6570f55d13efcc477ac2f6ad46af74ecd3f99 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 15:38:08 -0600 Subject: [PATCH 24/31] Add comment for why --- .github/workflows/cherryPick.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 5ebd48a2c5888..8480ec7e1cbd2 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -40,6 +40,7 @@ jobs: ref: staging token: ${{ secrets.OS_BOTIFY_TOKEN }} submodules: true + # Only fetch depth 0 for Mobile-Expensify, because it's a submodule and we need more history to cherry pick successfully fetch-depth: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' && 0 || '' }} # This command is necessary to fetch any branch other than main in the submodule. From 6f8c474ede4437efcc0f3282844cc6a2f0bb0bdf Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 16:05:33 -0600 Subject: [PATCH 25/31] Change how to determine when to fetch-depth:0 --- .github/workflows/cherryPick.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 8480ec7e1cbd2..96b80e0ee2017 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -33,7 +33,8 @@ jobs: id: getBranchName run: echo "CONFLICT_BRANCH_NAME=cherry-pick-staging-${{ steps.getPRInfo.outputs.PR_NUMBER }}-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" - - name: Checkout staging branch + - name: Checkout staging branch with full history if cherry picking Mobile-Expensify + if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' }} # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: @@ -41,7 +42,16 @@ jobs: token: ${{ secrets.OS_BOTIFY_TOKEN }} submodules: true # Only fetch depth 0 for Mobile-Expensify, because it's a submodule and we need more history to cherry pick successfully - fetch-depth: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' && 0 || '' }} + fetch-depth: 0 + + - name: Checkout staging branch without full history if cherry picking App + if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/App' }} + # v4 + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 + with: + ref: staging + token: ${{ secrets.OS_BOTIFY_TOKEN }} + submodules: true # This command is necessary to fetch any branch other than main in the submodule. # See https://github.com/actions/checkout/issues/1815#issuecomment-2777836442 for further context. @@ -66,7 +76,8 @@ jobs: with: SEMVER_LEVEL: "PATCH" - - name: Fetch history of relevant refs + - name: Fetch history of relevant refs if cherry picking an App change + if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/App' }} run: | # Temporary hack during transition when -staging suffix is being added to tags if git ls-remote origin refs/tags/${{ steps.getPreviousVersion.outputs.PREVIOUS_VERSION }} | grep -q . ; then From b440734f3957329dc3b7292f2f2db8b283750a7f Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 16:14:50 -0600 Subject: [PATCH 26/31] Adjust git modules to match test --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 59abf2448f1db..6357e2d0d9671 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Mobile-Expensify"] path = Mobile-Expensify - url = git@github.com:Expensify/Mobile-Expensify.git + url = git@github.com:Expensify/Mobile-Expensify-Test-Fork.git From 3b40955d93a4665681c1c7aaa6b824c48166e28e Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Tue, 22 Apr 2025 16:27:13 -0600 Subject: [PATCH 27/31] Remove all `Mobile-Expensify-Test-Fork` and use `Mobile-Expensify` --- .github/workflows/cherryPick.yml | 10 +++++----- .gitmodules | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 96b80e0ee2017..623d159f7e44b 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -24,7 +24,7 @@ jobs: - name: Verify repository run: | - if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ] && [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify-Test-Fork" ]; then + if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ] && [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]; then echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" exit 1 fi @@ -34,7 +34,7 @@ jobs: run: echo "CONFLICT_BRANCH_NAME=cherry-pick-staging-${{ steps.getPRInfo.outputs.PR_NUMBER }}-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" - name: Checkout staging branch with full history if cherry picking Mobile-Expensify - if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' }} + if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' }} # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: @@ -151,7 +151,7 @@ jobs: id: cherryPick run: | echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}" - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then cd Mobile-Expensify fi @@ -166,7 +166,7 @@ jobs: echo "HAS_CONFLICTS=true" >> "$GITHUB_OUTPUT" fi - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then cd .. fi @@ -176,7 +176,7 @@ jobs: git checkout -b ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} git push --set-upstream origin ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} else - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then # Push Mobile-Expensify changes first cd Mobile-Expensify git push origin staging diff --git a/.gitmodules b/.gitmodules index 6357e2d0d9671..59abf2448f1db 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "Mobile-Expensify"] path = Mobile-Expensify - url = git@github.com:Expensify/Mobile-Expensify-Test-Fork.git + url = git@github.com:Expensify/Mobile-Expensify.git From b90285aea603d425b4564c61c62a5b930a339f0f Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 23 Apr 2025 10:08:13 -0600 Subject: [PATCH 28/31] Update from review comments --- .github/workflows/cherryPick.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 623d159f7e44b..3549d58f2de91 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -24,7 +24,7 @@ jobs: - name: Verify repository run: | - if [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/App" ] && [ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != ${{ github.repository }} ]] && [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]]; then echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" exit 1 fi @@ -123,8 +123,7 @@ jobs: - name: Get merge commit for pull request to CP id: getCPMergeCommit run: | - MERGE_COMMIT_SHA="$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json mergeCommit --jq '.mergeCommit.oid')" - MERGE_ACTOR="$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json author --jq '.author.login')" + read MERGE_COMMIT_SHA MERGE_ACTOR <<< "$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json mergeCommit,author --jq '"\(.mergeCommit.oid) \(.author.login)"')" echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> "$GITHUB_OUTPUT" echo "MERGE_ACTOR=$MERGE_ACTOR" >> "$GITHUB_OUTPUT" env: @@ -149,12 +148,10 @@ jobs: - name: Cherry-pick the merge commit of target PR id: cherryPick + # If cherry picking a Mobile-Expensify change, we need to run the cherry pick in the Mobile-Expensify directory + working-directory: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' && 'Mobile-Expensify' || '.' }} run: | echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}" - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then - cd Mobile-Expensify - fi - if git cherry-pick -S -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then echo "🎉 No conflicts! CP was a success, PR can be automerged 🎉" echo "HAS_CONFLICTS=false" >> "$GITHUB_OUTPUT" @@ -166,10 +163,6 @@ jobs: echo "HAS_CONFLICTS=true" >> "$GITHUB_OUTPUT" fi - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then - cd .. - fi - - name: Push changes run: | if [[ ${{steps.cherryPick.outputs.HAS_CONFLICTS}} == 'true' ]]; then From 112ffcdfd9a9d7e04382a5925c4638904cd8bde3 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 23 Apr 2025 10:14:30 -0600 Subject: [PATCH 29/31] Set test repo for CP test --- .github/workflows/cherryPick.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 3549d58f2de91..88d598a19dc5c 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -24,7 +24,7 @@ jobs: - name: Verify repository run: | - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != ${{ github.repository }} ]] && [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != ${{ github.repository }} ]] && [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify-Test-Fork" ]]; then echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" exit 1 fi @@ -34,7 +34,7 @@ jobs: run: echo "CONFLICT_BRANCH_NAME=cherry-pick-staging-${{ steps.getPRInfo.outputs.PR_NUMBER }}-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" - name: Checkout staging branch with full history if cherry picking Mobile-Expensify - if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' }} + if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' }} # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: @@ -149,7 +149,7 @@ jobs: - name: Cherry-pick the merge commit of target PR id: cherryPick # If cherry picking a Mobile-Expensify change, we need to run the cherry pick in the Mobile-Expensify directory - working-directory: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' && 'Mobile-Expensify' || '.' }} + working-directory: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' && 'Mobile-Expensify' || '.' }} run: | echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}" if git cherry-pick -S -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then @@ -169,7 +169,7 @@ jobs: git checkout -b ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} git push --set-upstream origin ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} else - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then # Push Mobile-Expensify changes first cd Mobile-Expensify git push origin staging From 18592b4ddb5ca5b77db2c4c048e5679d7492b011 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 23 Apr 2025 10:23:07 -0600 Subject: [PATCH 30/31] Fix lint --- .github/workflows/cherryPick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index 88d598a19dc5c..ab5ecfdb21039 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -123,7 +123,7 @@ jobs: - name: Get merge commit for pull request to CP id: getCPMergeCommit run: | - read MERGE_COMMIT_SHA MERGE_ACTOR <<< "$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json mergeCommit,author --jq '"\(.mergeCommit.oid) \(.author.login)"')" + read -r MERGE_COMMIT_SHA MERGE_ACTOR <<< "$(gh pr view ${{ github.event.inputs.PULL_REQUEST_URL }} --json mergeCommit,author --jq '"\(.mergeCommit.oid) \(.author.login)"')" echo "MERGE_COMMIT_SHA=$MERGE_COMMIT_SHA" >> "$GITHUB_OUTPUT" echo "MERGE_ACTOR=$MERGE_ACTOR" >> "$GITHUB_OUTPUT" env: From 11ef1c3c2ceec7cdb56181dfe3e58f029df70807 Mon Sep 17 00:00:00 2001 From: Andrew Gable Date: Wed, 23 Apr 2025 10:23:41 -0600 Subject: [PATCH 31/31] Remove testing --- .github/workflows/cherryPick.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cherryPick.yml b/.github/workflows/cherryPick.yml index ab5ecfdb21039..f4ae843836bc0 100644 --- a/.github/workflows/cherryPick.yml +++ b/.github/workflows/cherryPick.yml @@ -24,7 +24,7 @@ jobs: - name: Verify repository run: | - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != ${{ github.repository }} ]] && [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify-Test-Fork" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != ${{ github.repository }} ]] && [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" != "Expensify/Mobile-Expensify" ]]; then echo "::error::❌ Cherry picks are only supported for the Expensify/App and Expensify/Mobile-Expensify repositories. Found: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" exit 1 fi @@ -34,7 +34,7 @@ jobs: run: echo "CONFLICT_BRANCH_NAME=cherry-pick-staging-${{ steps.getPRInfo.outputs.PR_NUMBER }}-${{ github.run_id }}-${{ github.run_attempt }}" >> "$GITHUB_OUTPUT" - name: Checkout staging branch with full history if cherry picking Mobile-Expensify - if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' }} + if: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' }} # v4 uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 with: @@ -149,7 +149,7 @@ jobs: - name: Cherry-pick the merge commit of target PR id: cherryPick # If cherry picking a Mobile-Expensify change, we need to run the cherry pick in the Mobile-Expensify directory - working-directory: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify-Test-Fork' && 'Mobile-Expensify' || '.' }} + working-directory: ${{ steps.getPRInfo.outputs.REPO_FULL_NAME == 'Expensify/Mobile-Expensify' && 'Mobile-Expensify' || '.' }} run: | echo "Attempting to cherry-pick ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}" if git cherry-pick -S -x --mainline 1 ${{ steps.getCPMergeCommit.outputs.MERGE_COMMIT_SHA }}; then @@ -169,7 +169,7 @@ jobs: git checkout -b ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} git push --set-upstream origin ${{ steps.getBranchName.outputs.CONFLICT_BRANCH_NAME }} else - if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify-Test-Fork" ]]; then + if [[ "${{ steps.getPRInfo.outputs.REPO_FULL_NAME }}" == "Expensify/Mobile-Expensify" ]]; then # Push Mobile-Expensify changes first cd Mobile-Expensify git push origin staging