From 5843fcb3a127bd4ce81b726e5aa993ddbc3eca42 Mon Sep 17 00:00:00 2001 From: Long Tran Date: Wed, 27 Nov 2024 14:25:17 +1100 Subject: [PATCH] inspect only --- dist/index.js | 401 ++++++++++++++++++++++---------------------------- src/main.ts | 24 +-- 2 files changed, 193 insertions(+), 232 deletions(-) diff --git a/dist/index.js b/dist/index.js index a8bf417..776115e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4420,18 +4420,18 @@ var require_webidl = __commonJS({ webidl.errors.exception = function(message) { return new TypeError(`${message.header}: ${message.message}`); }; - webidl.errors.conversionFailed = function(context3) { - const plural = context3.types.length === 1 ? "" : " one of"; - const message = `${context3.argument} could not be converted to${plural}: ${context3.types.join(", ")}.`; + webidl.errors.conversionFailed = function(context2) { + const plural = context2.types.length === 1 ? "" : " one of"; + const message = `${context2.argument} could not be converted to${plural}: ${context2.types.join(", ")}.`; return webidl.errors.exception({ - header: context3.prefix, + header: context2.prefix, message }); }; - webidl.errors.invalidArgument = function(context3) { + webidl.errors.invalidArgument = function(context2) { return webidl.errors.exception({ - header: context3.prefix, - message: `"${context3.value}" is an invalid ${context3.type}.` + header: context2.prefix, + message: `"${context2.value}" is an invalid ${context2.type}.` }); }; webidl.brandCheck = function(V, I, opts = void 0) { @@ -9752,15 +9752,15 @@ var require_api_request = __commonJS({ } addSignal(this, signal); } - onConnect(abort, context3) { + onConnect(abort, context2) { if (!this.callback) { throw new RequestAbortedError(); } this.abort = abort; - this.context = context3; + this.context = context2; } onHeaders(statusCode, rawHeaders, resume, statusMessage) { - const { callback, opaque, abort, context: context3, responseHeaders, highWaterMark } = this; + const { callback, opaque, abort, context: context2, responseHeaders, highWaterMark } = this; const headers = responseHeaders === "raw" ? util2.parseRawHeaders(rawHeaders) : util2.parseHeaders(rawHeaders); if (statusCode < 200) { if (this.onInfo) { @@ -9787,7 +9787,7 @@ var require_api_request = __commonJS({ trailers: this.trailers, opaque, body, - context: context3 + context: context2 }); } } @@ -9907,15 +9907,15 @@ var require_api_stream = __commonJS({ } addSignal(this, signal); } - onConnect(abort, context3) { + onConnect(abort, context2) { if (!this.callback) { throw new RequestAbortedError(); } this.abort = abort; - this.context = context3; + this.context = context2; } onHeaders(statusCode, rawHeaders, resume, statusMessage) { - const { factory, opaque, context: context3, callback, responseHeaders } = this; + const { factory, opaque, context: context2, callback, responseHeaders } = this; const headers = responseHeaders === "raw" ? util2.parseRawHeaders(rawHeaders) : util2.parseHeaders(rawHeaders); if (statusCode < 200) { if (this.onInfo) { @@ -9943,7 +9943,7 @@ var require_api_stream = __commonJS({ statusCode, headers, opaque, - context: context3 + context: context2 }); if (!res || typeof res.write !== "function" || typeof res.end !== "function" || typeof res.on !== "function") { throw new InvalidReturnValueError("expected Writable"); @@ -10135,17 +10135,17 @@ var require_api_pipeline = __commonJS({ this.res = null; addSignal(this, signal); } - onConnect(abort, context3) { + onConnect(abort, context2) { const { ret, res } = this; assert(!res, "pipeline cannot be retried"); if (ret.destroyed) { throw new RequestAbortedError(); } this.abort = abort; - this.context = context3; + this.context = context2; } onHeaders(statusCode, rawHeaders, resume) { - const { opaque, handler, context: context3 } = this; + const { opaque, handler, context: context2 } = this; if (statusCode < 200) { if (this.onInfo) { const headers = this.responseHeaders === "raw" ? util2.parseRawHeaders(rawHeaders) : util2.parseHeaders(rawHeaders); @@ -10163,7 +10163,7 @@ var require_api_pipeline = __commonJS({ headers, opaque, body: this.res, - context: context3 + context: context2 }); } catch (err) { this.res.on("error", util2.nop); @@ -10247,7 +10247,7 @@ var require_api_upgrade = __commonJS({ this.context = null; addSignal(this, signal); } - onConnect(abort, context3) { + onConnect(abort, context2) { if (!this.callback) { throw new RequestAbortedError(); } @@ -10258,7 +10258,7 @@ var require_api_upgrade = __commonJS({ throw new SocketError("bad upgrade", null); } onUpgrade(statusCode, rawHeaders, socket) { - const { callback, opaque, context: context3 } = this; + const { callback, opaque, context: context2 } = this; assert.strictEqual(statusCode, 101); removeSignal(this); this.callback = null; @@ -10267,7 +10267,7 @@ var require_api_upgrade = __commonJS({ headers, socket, opaque, - context: context3 + context: context2 }); } onError(err) { @@ -10335,18 +10335,18 @@ var require_api_connect = __commonJS({ this.abort = null; addSignal(this, signal); } - onConnect(abort, context3) { + onConnect(abort, context2) { if (!this.callback) { throw new RequestAbortedError(); } this.abort = abort; - this.context = context3; + this.context = context2; } onHeaders() { throw new SocketError("bad connect", null); } onUpgrade(statusCode, rawHeaders, socket) { - const { callback, opaque, context: context3 } = this; + const { callback, opaque, context: context2 } = this; removeSignal(this); this.callback = null; let headers = rawHeaders; @@ -10358,7 +10358,7 @@ var require_api_connect = __commonJS({ headers, socket, opaque, - context: context3 + context: context2 }); } onError(err) { @@ -19338,8 +19338,8 @@ var require_dist_node2 = __commonJS({ function isKeyOperator(operator) { return operator === ";" || operator === "&" || operator === "?"; } - function getValues(context3, operator, key, modifier) { - var value = context3[key], result = []; + function getValues(context2, operator, key, modifier) { + var value = context2[key], result = []; if (isDefined(value) && value !== "") { if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") { value = value.toString(); @@ -19403,7 +19403,7 @@ var require_dist_node2 = __commonJS({ expand: expand.bind(null, template) }; } - function expand(template, context3) { + function expand(template, context2) { var operators = ["+", "#", ".", "/", ";", "?", "&"]; template = template.replace( /\{([^\{\}]+)\}|([^\{\}]+)/g, @@ -19417,7 +19417,7 @@ var require_dist_node2 = __commonJS({ } expression.split(/,/g).forEach(function(variable) { var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable); - values.push(getValues(context3, operator, tmp[1], tmp[2] || tmp[3])); + values.push(getValues(context2, operator, tmp[1], tmp[2] || tmp[3])); }); if (operator && operator !== "+") { var separator = ","; @@ -30535,7 +30535,7 @@ var require_compiler = __commonJS({ var valueAssignments = []; var currentPath = ""; var data = /* @__PURE__ */ Object.create(null); - var context3 = data; + var context2 = data; var arrayMode = false; return reduce(nodes); function reduce(nodes2) { @@ -30573,10 +30573,10 @@ var require_compiler = __commonJS({ } else { fullPath = key; } - if (typeof context3[key] !== "undefined") { + if (typeof context2[key] !== "undefined") { genError("Cannot redefine existing key '" + fullPath + "'.", line, column); } - context3[key] = reduceValueNode(value); + context2[key] = reduceValueNode(value); if (!pathAssigned(fullPath)) { assignedPaths.push(fullPath); valueAssignments.push(fullPath); @@ -30615,7 +30615,7 @@ var require_compiler = __commonJS({ genError("Cannot redefine existing key '" + path2 + "'.", line, column); } assignedPaths.push(quotedPath); - context3 = deepRef(data, path2, /* @__PURE__ */ Object.create(null), line, column); + context2 = deepRef(data, path2, /* @__PURE__ */ Object.create(null), line, column); currentPath = path2; } function addTableArray(node2) { @@ -30630,12 +30630,12 @@ var require_compiler = __commonJS({ return p.indexOf(quotedPath) !== 0; }); assignedPaths.push(quotedPath); - context3 = deepRef(data, path2, [], line, column); + context2 = deepRef(data, path2, [], line, column); currentPath = quotedPath; - if (context3 instanceof Array) { + if (context2 instanceof Array) { var newObj = /* @__PURE__ */ Object.create(null); - context3.push(newObj); - context3 = newObj; + context2.push(newObj); + context2 = newObj; } else { genError("Cannot redefine existing key '" + path2 + "'.", line, column); } @@ -30709,11 +30709,10 @@ var require_toml = __commonJS({ // src/index.ts var core4 = __toESM(require_core()); -var github2 = __toESM(require_github()); +var github = __toESM(require_github()); // src/main.ts var core = __toESM(require_core()); -var github = __toESM(require_github()); var import_graphology = __toESM(require_graphology_cjs()); var import_graphology_traversal = __toESM(require_graphology_traversal()); @@ -33318,13 +33317,13 @@ function classifyCharacter(code3) { } // node_modules/micromark-util-resolve-all/index.js -function resolveAll(constructs2, events, context3) { +function resolveAll(constructs2, events, context2) { const called = []; let index2 = -1; while (++index2 < constructs2.length) { const resolve = constructs2[index2].resolveAll; if (resolve && !called.includes(resolve)) { - events = resolve(events, context3); + events = resolve(events, context2); called.push(resolve); } } @@ -33337,7 +33336,7 @@ var attention = { tokenize: tokenizeAttention, resolveAll: resolveAllAttention }; -function resolveAllAttention(events, context3) { +function resolveAllAttention(events, context2) { let index2 = -1; let open; let group; @@ -33352,7 +33351,7 @@ function resolveAllAttention(events, context3) { open = index2; while (open--) { if (events[open][0] === "exit" && events[open][1].type === "attentionSequence" && events[open][1]._open && // If the markers are the same: - context3.sliceSerialize(events[open][1]).charCodeAt(0) === context3.sliceSerialize(events[index2][1]).charCodeAt(0)) { + context2.sliceSerialize(events[open][1]).charCodeAt(0) === context2.sliceSerialize(events[index2][1]).charCodeAt(0)) { if ((events[open][1]._close || events[index2][1]._open) && (events[index2][1].end.offset - events[index2][1].start.offset) % 3 && !((events[open][1].end.offset - events[open][1].start.offset + events[index2][1].end.offset - events[index2][1].start.offset) % 3)) { continue; } @@ -33386,35 +33385,35 @@ function resolveAllAttention(events, context3) { nextEvents = []; if (events[open][1].end.offset - events[open][1].start.offset) { nextEvents = push(nextEvents, [ - ["enter", events[open][1], context3], - ["exit", events[open][1], context3] + ["enter", events[open][1], context2], + ["exit", events[open][1], context2] ]); } nextEvents = push(nextEvents, [ - ["enter", group, context3], - ["enter", openingSequence, context3], - ["exit", openingSequence, context3], - ["enter", text5, context3] + ["enter", group, context2], + ["enter", openingSequence, context2], + ["exit", openingSequence, context2], + ["enter", text5, context2] ]); nextEvents = push( nextEvents, resolveAll( - context3.parser.constructs.insideSpan.null, + context2.parser.constructs.insideSpan.null, events.slice(open + 1, index2), - context3 + context2 ) ); nextEvents = push(nextEvents, [ - ["exit", text5, context3], - ["enter", closingSequence, context3], - ["exit", closingSequence, context3], - ["exit", group, context3] + ["exit", text5, context2], + ["enter", closingSequence, context2], + ["exit", closingSequence, context2], + ["exit", group, context2] ]); if (events[index2][1].end.offset - events[index2][1].start.offset) { offset = 2; nextEvents = push(nextEvents, [ - ["enter", events[index2][1], context3], - ["exit", events[index2][1], context3] + ["enter", events[index2][1], context2], + ["exit", events[index2][1], context2] ]); } else { offset = 0; @@ -34173,10 +34172,10 @@ function subtokenize(events) { } function subcontent(events, eventIndex) { const token = events[eventIndex][1]; - const context3 = events[eventIndex][2]; + const context2 = events[eventIndex][2]; let startPosition = eventIndex - 1; const startPositions = []; - const tokenizer = token._tokenizer || context3.parser[token.contentType](token.start); + const tokenizer = token._tokenizer || context2.parser[token.contentType](token.start); const childEvents = tokenizer.events; const jumps = []; const gaps = {}; @@ -34192,7 +34191,7 @@ function subcontent(events, eventIndex) { } startPositions.push(startPosition); if (!current._tokenizer) { - stream = context3.sliceStream(current); + stream = context2.sliceStream(current); if (!current.next) { stream.push(null); } @@ -34681,7 +34680,7 @@ var headingAtx = { tokenize: tokenizeHeadingAtx, resolve: resolveHeadingAtx }; -function resolveHeadingAtx(events, context3) { +function resolveHeadingAtx(events, context2) { let contentEnd = events.length - 2; let contentStart = 3; let content3; @@ -34708,10 +34707,10 @@ function resolveHeadingAtx(events, context3) { contentType: "text" }; splice(events, contentStart, contentEnd - contentStart + 1, [ - ["enter", content3, context3], - ["enter", text5, context3], - ["exit", text5, context3], - ["exit", content3, context3] + ["enter", content3, context2], + ["enter", text5, context2], + ["exit", text5, context2], + ["exit", content3, context2] ]); } return events; @@ -35564,7 +35563,7 @@ function resolveAllLabelEnd(events) { } return events; } -function resolveToLabelEnd(events, context3) { +function resolveToLabelEnd(events, context2) { let index2 = events.length; let offset = 0; let token; @@ -35608,27 +35607,27 @@ function resolveToLabelEnd(events, context3) { end: Object.assign({}, events[close - 2][1].start) }; media = [ - ["enter", group, context3], - ["enter", label, context3] + ["enter", group, context2], + ["enter", label, context2] ]; media = push(media, events.slice(open + 1, open + offset + 3)); - media = push(media, [["enter", text5, context3]]); + media = push(media, [["enter", text5, context2]]); media = push( media, resolveAll( - context3.parser.constructs.insideSpan.null, + context2.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), - context3 + context2 ) ); media = push(media, [ - ["exit", text5, context3], + ["exit", text5, context2], events[close - 2], events[close - 1], - ["exit", label, context3] + ["exit", label, context2] ]); media = push(media, events.slice(close + 1)); - media = push(media, [["exit", group, context3]]); + media = push(media, [["exit", group, context2]]); splice(events, open, events.length, media); return events; } @@ -36072,7 +36071,7 @@ var setextUnderline = { tokenize: tokenizeSetextUnderline, resolveTo: resolveToSetextUnderline }; -function resolveToSetextUnderline(events, context3) { +function resolveToSetextUnderline(events, context2) { let index2 = events.length; let content3; let text5; @@ -36102,13 +36101,13 @@ function resolveToSetextUnderline(events, context3) { }; events[text5][1].type = "setextHeadingText"; if (definition3) { - events.splice(text5, 0, ["enter", heading2, context3]); - events.splice(definition3 + 1, 0, ["exit", events[content3][1], context3]); + events.splice(text5, 0, ["enter", heading2, context2]); + events.splice(definition3 + 1, 0, ["exit", events[content3][1], context2]); events[content3][1].end = Object.assign({}, events[definition3][1].end); } else { events[content3][1] = heading2; } - events.push(["exit", heading2, context3]); + events.push(["exit", heading2, context2]); return events; } function tokenizeSetextUnderline(effects, ok3, nok) { @@ -36260,7 +36259,7 @@ function initializeFactory(field) { } function createResolver(extraResolver) { return resolveAllText; - function resolveAllText(events, context3) { + function resolveAllText(events, context2) { let index2 = -1; let enter; while (++index2 <= events.length) { @@ -36278,15 +36277,15 @@ function createResolver(extraResolver) { enter = void 0; } } - return extraResolver ? extraResolver(events, context3) : events; + return extraResolver ? extraResolver(events, context2) : events; } } -function resolveAllLineSuffixes(events, context3) { +function resolveAllLineSuffixes(events, context2) { let eventIndex = 0; while (++eventIndex <= events.length) { if ((eventIndex === events.length || events[eventIndex][1].type === "lineEnding") && events[eventIndex - 1][1].type === "data") { const data = events[eventIndex - 1][1]; - const chunks = context3.sliceStream(data); + const chunks = context2.sliceStream(data); let index2 = chunks.length; let bufferIndex = -1; let size = 0; @@ -36330,8 +36329,8 @@ function resolveAllLineSuffixes(events, context3) { events.splice( eventIndex, 0, - ["enter", token, context3], - ["exit", token, context3] + ["enter", token, context2], + ["exit", token, context2] ); eventIndex += 2; } @@ -36370,7 +36369,7 @@ function createTokenizer(parser, initialize, from) { interrupt: true }) }; - const context3 = { + const context2 = { previous: null, code: null, containerState: {}, @@ -36382,12 +36381,12 @@ function createTokenizer(parser, initialize, from) { defineSkip, write }; - let state = initialize.tokenize.call(context3, effects); + let state = initialize.tokenize.call(context2, effects); let expectedCode; if (initialize.resolveAll) { resolveAllConstructs.push(initialize); } - return context3; + return context2; function write(slice) { chunks = push(chunks, slice); main2(); @@ -36395,8 +36394,8 @@ function createTokenizer(parser, initialize, from) { return []; } addResult(initialize, 0); - context3.events = resolveAll(resolveAllConstructs, context3.events, context3); - return context3.events; + context2.events = resolveAll(resolveAllConstructs, context2.events, context2); + return context2.events; } function sliceSerialize(token, expandTabs) { return serializeChunks(sliceStream(token), expandTabs); @@ -36459,21 +36458,21 @@ function createTokenizer(parser, initialize, from) { point3._index++; } } - context3.previous = code3; + context2.previous = code3; consumed = true; } function enter(type, fields) { const token = fields || {}; token.type = type; token.start = now(); - context3.events.push(["enter", token, context3]); + context2.events.push(["enter", token, context2]); stack.push(token); return token; } function exit3(type) { const token = stack.pop(); token.end = now(); - context3.events.push(["exit", token, context3]); + context2.events.push(["exit", token, context2]); return token; } function onsuccessfulconstruct(construct, info4) { @@ -36521,16 +36520,16 @@ function createTokenizer(parser, initialize, from) { info4 = store(); currentConstruct = construct; if (!construct.partial) { - context3.currentConstruct = construct; + context2.currentConstruct = construct; } - if (construct.name && context3.parser.constructs.disable.null.includes(construct.name)) { + if (construct.name && context2.parser.constructs.disable.null.includes(construct.name)) { return nok(code3); } return construct.tokenize.call( // If we do have fields, create an object w/ `context` as its // prototype. // This allows a “live binding”, which is needed for `interrupt`. - fields ? Object.assign(Object.create(context3), fields) : context3, + fields ? Object.assign(Object.create(context2), fields) : context2, effects, ok3, nok @@ -36558,21 +36557,21 @@ function createTokenizer(parser, initialize, from) { } if (construct.resolve) { splice( - context3.events, + context2.events, from2, - context3.events.length - from2, - construct.resolve(context3.events.slice(from2), context3) + context2.events.length - from2, + construct.resolve(context2.events.slice(from2), context2) ); } if (construct.resolveTo) { - context3.events = construct.resolveTo(context3.events, context3); + context2.events = construct.resolveTo(context2.events, context2); } } function store() { const startPoint = now(); - const startPrevious = context3.previous; - const startCurrentConstruct = context3.currentConstruct; - const startEventsIndex = context3.events.length; + const startPrevious = context2.previous; + const startCurrentConstruct = context2.currentConstruct; + const startEventsIndex = context2.events.length; const startStack = Array.from(stack); return { restore, @@ -36580,9 +36579,9 @@ function createTokenizer(parser, initialize, from) { }; function restore() { point3 = startPoint; - context3.previous = startPrevious; - context3.currentConstruct = startCurrentConstruct; - context3.events.length = startEventsIndex; + context2.previous = startPrevious; + context2.currentConstruct = startCurrentConstruct; + context2.events.length = startEventsIndex; stack = startStack; accountForPotentialSkip(); } @@ -37014,7 +37013,7 @@ function compiler(options) { type: "root", children: [] }; - const context3 = { + const context2 = { stack: [tree], tokenStack: [], config: config2, @@ -37045,16 +37044,16 @@ function compiler(options) { { sliceSerialize: events[index2][2].sliceSerialize }, - context3 + context2 ), events[index2][1] ); } } - if (context3.tokenStack.length > 0) { - const tail = context3.tokenStack[context3.tokenStack.length - 1]; + if (context2.tokenStack.length > 0) { + const tail = context2.tokenStack[context2.tokenStack.length - 1]; const handler = tail[1] || defaultOnError; - handler.call(context3, void 0, tail[0]); + handler.call(context2, void 0, tail[0]); } tree.position = { start: point2( @@ -37321,14 +37320,14 @@ function compiler(options) { tail.position.end = point2(token.end); } function onexitlineending(token) { - const context3 = this.stack[this.stack.length - 1]; + const context2 = this.stack[this.stack.length - 1]; if (this.data.atHardBreak) { - const tail = context3.children[context3.children.length - 1]; + const tail = context2.children[context2.children.length - 1]; tail.position.end = point2(token.end); this.data.atHardBreak = void 0; return; } - if (!this.data.setextHeadingSlurpLineEnding && config2.canContainEols.includes(context3.type)) { + if (!this.data.setextHeadingSlurpLineEnding && config2.canContainEols.includes(context2.type)) { onenterdata.call(this, token); onexitdata.call(this, token); } @@ -41868,7 +41867,7 @@ function tokenizePotentialGfmFootnoteCall(effects, ok3, nok) { return ok3(code3); } } -function resolveToPotentialGfmFootnoteCall(events, context3) { +function resolveToPotentialGfmFootnoteCall(events, context2) { let index2 = events.length; let labelStart; while (index2--) { @@ -41907,22 +41906,22 @@ function resolveToPotentialGfmFootnoteCall(events, context3) { // Take the `labelImageMarker` (now `data`, the `!`) events[index2 + 1], events[index2 + 2], - ["enter", call, context3], + ["enter", call, context2], // The `[` events[index2 + 3], events[index2 + 4], // The `^`. - ["enter", marker, context3], - ["exit", marker, context3], + ["enter", marker, context2], + ["exit", marker, context2], // Everything in between. - ["enter", string4, context3], - ["enter", chunk, context3], - ["exit", chunk, context3], - ["exit", string4, context3], + ["enter", string4, context2], + ["enter", chunk, context2], + ["exit", chunk, context2], + ["exit", string4, context2], // The ending (`]`, properly parsed and labelled). events[events.length - 2], events[events.length - 1], - ["exit", call, context3] + ["exit", call, context2] ]; events.splice(index2, events.length - index2 + 1, ...replacement); return events; @@ -42111,7 +42110,7 @@ function gfmStrikethrough(options) { null: [126] } }; - function resolveAllStrikethrough(events, context3) { + function resolveAllStrikethrough(events, context2) { let index2 = -1; while (++index2 < events.length) { if (events[index2][0] === "enter" && events[index2][1].type === "strikethroughSequenceTemporary" && events[index2][1]._close) { @@ -42132,25 +42131,25 @@ function gfmStrikethrough(options) { end: Object.assign({}, events[index2][1].start) }; const nextEvents = [ - ["enter", strikethrough, context3], - ["enter", events[open][1], context3], - ["exit", events[open][1], context3], - ["enter", text5, context3] + ["enter", strikethrough, context2], + ["enter", events[open][1], context2], + ["exit", events[open][1], context2], + ["enter", text5, context2] ]; - const insideSpan2 = context3.parser.constructs.insideSpan.null; + const insideSpan2 = context2.parser.constructs.insideSpan.null; if (insideSpan2) { splice( nextEvents, nextEvents.length, 0, - resolveAll(insideSpan2, events.slice(open + 1, index2), context3) + resolveAll(insideSpan2, events.slice(open + 1, index2), context2) ); } splice(nextEvents, nextEvents.length, 0, [ - ["exit", text5, context3], - ["enter", events[index2][1], context3], - ["exit", events[index2][1], context3], - ["exit", strikethrough, context3] + ["exit", text5, context2], + ["enter", events[index2][1], context2], + ["exit", events[index2][1], context2], + ["exit", strikethrough, context2] ]); splice(events, open - 1, index2 - open + 3, nextEvents); index2 = open + nextEvents.length - 2; @@ -42541,7 +42540,7 @@ function tokenizeTable(effects, ok3, nok) { return bodyRowData(code3); } } -function resolveTable(events, context3) { +function resolveTable(events, context2) { let index2 = -1; let inFirstCellAwaitingPipe = true; let rowKind = 0; @@ -42560,7 +42559,7 @@ function resolveTable(events, context3) { if (token.type === "tableHead") { afterHeadAwaitingFirstBodyRow = false; if (lastTableEnd !== 0) { - flushTableEnd(map5, context3, lastTableEnd, currentTable, currentBody); + flushTableEnd(map5, context2, lastTableEnd, currentTable, currentBody); currentBody = void 0; lastTableEnd = 0; } @@ -42570,7 +42569,7 @@ function resolveTable(events, context3) { // Note: correct end is set later. end: Object.assign({}, token.end) }; - map5.add(index2, 0, [["enter", currentTable, context3]]); + map5.add(index2, 0, [["enter", currentTable, context2]]); } else if (token.type === "tableRow" || token.type === "tableDelimiterRow") { inFirstCellAwaitingPipe = true; currentCell = void 0; @@ -42584,7 +42583,7 @@ function resolveTable(events, context3) { // Note: correct end is set later. end: Object.assign({}, token.end) }; - map5.add(index2, 0, [["enter", currentBody, context3]]); + map5.add(index2, 0, [["enter", currentBody, context2]]); } rowKind = token.type === "tableDelimiterRow" ? 2 : currentBody ? 3 : 1; } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) { @@ -42594,7 +42593,7 @@ function resolveTable(events, context3) { cell[0] = cell[1]; currentCell = flushCell( map5, - context3, + context2, lastCell, rowKind, void 0, @@ -42612,7 +42611,7 @@ function resolveTable(events, context3) { cell[0] = cell[1]; currentCell = flushCell( map5, - context3, + context2, lastCell, rowKind, void 0, @@ -42632,14 +42631,14 @@ function resolveTable(events, context3) { cell[0] = cell[1]; currentCell = flushCell( map5, - context3, + context2, lastCell, rowKind, index2, currentCell ); } else if (cell[1] !== 0) { - currentCell = flushCell(map5, context3, cell, rowKind, index2, currentCell); + currentCell = flushCell(map5, context2, cell, rowKind, index2, currentCell); } rowKind = 0; } else if (rowKind && (token.type === "data" || token.type === "tableDelimiterMarker" || token.type === "tableDelimiterFiller")) { @@ -42647,45 +42646,45 @@ function resolveTable(events, context3) { } } if (lastTableEnd !== 0) { - flushTableEnd(map5, context3, lastTableEnd, currentTable, currentBody); + flushTableEnd(map5, context2, lastTableEnd, currentTable, currentBody); } - map5.consume(context3.events); + map5.consume(context2.events); index2 = -1; - while (++index2 < context3.events.length) { - const event = context3.events[index2]; + while (++index2 < context2.events.length) { + const event = context2.events[index2]; if (event[0] === "enter" && event[1].type === "table") { - event[1]._align = gfmTableAlign(context3.events, index2); + event[1]._align = gfmTableAlign(context2.events, index2); } } return events; } -function flushCell(map5, context3, range, rowKind, rowEnd, previousCell) { +function flushCell(map5, context2, range, rowKind, rowEnd, previousCell) { const groupName = rowKind === 1 ? "tableHeader" : rowKind === 2 ? "tableDelimiter" : "tableData"; const valueName = "tableContent"; if (range[0] !== 0) { - previousCell.end = Object.assign({}, getPoint(context3.events, range[0])); - map5.add(range[0], 0, [["exit", previousCell, context3]]); + previousCell.end = Object.assign({}, getPoint(context2.events, range[0])); + map5.add(range[0], 0, [["exit", previousCell, context2]]); } - const now = getPoint(context3.events, range[1]); + const now = getPoint(context2.events, range[1]); previousCell = { type: groupName, start: Object.assign({}, now), // Note: correct end is set later. end: Object.assign({}, now) }; - map5.add(range[1], 0, [["enter", previousCell, context3]]); + map5.add(range[1], 0, [["enter", previousCell, context2]]); if (range[2] !== 0) { - const relatedStart = getPoint(context3.events, range[2]); - const relatedEnd = getPoint(context3.events, range[3]); + const relatedStart = getPoint(context2.events, range[2]); + const relatedEnd = getPoint(context2.events, range[3]); const valueToken = { type: valueName, start: Object.assign({}, relatedStart), end: Object.assign({}, relatedEnd) }; - map5.add(range[2], 0, [["enter", valueToken, context3]]); + map5.add(range[2], 0, [["enter", valueToken, context2]]); if (rowKind !== 2) { - const start = context3.events[range[2]]; - const end = context3.events[range[3]]; + const start = context2.events[range[2]]; + const end = context2.events[range[3]]; start[1].end = Object.assign({}, end[1].end); start[1].type = "chunkText"; start[1].contentType = "text"; @@ -42695,24 +42694,24 @@ function flushCell(map5, context3, range, rowKind, rowEnd, previousCell) { map5.add(a, b, []); } } - map5.add(range[3] + 1, 0, [["exit", valueToken, context3]]); + map5.add(range[3] + 1, 0, [["exit", valueToken, context2]]); } if (rowEnd !== void 0) { - previousCell.end = Object.assign({}, getPoint(context3.events, rowEnd)); - map5.add(rowEnd, 0, [["exit", previousCell, context3]]); + previousCell.end = Object.assign({}, getPoint(context2.events, rowEnd)); + map5.add(rowEnd, 0, [["exit", previousCell, context2]]); previousCell = void 0; } return previousCell; } -function flushTableEnd(map5, context3, index2, table, tableBody) { +function flushTableEnd(map5, context2, index2, table, tableBody) { const exits = []; - const related = getPoint(context3.events, index2); + const related = getPoint(context2.events, index2); if (tableBody) { tableBody.end = Object.assign({}, related); - exits.push(["exit", tableBody, context3]); + exits.push(["exit", tableBody, context2]); } table.end = Object.assign({}, related); - exits.push(["exit", table, context3]); + exits.push(["exit", table, context2]); map5.add(index2 + 1, 0, exits); } function getPoint(events, index2) { @@ -42913,16 +42912,7 @@ async function main({ core.info(`Updating stack details for PR #${stackNode.number}`); const stackGraph2 = getStackGraph(repoGraph, stackNode); const output = getOutput(stackGraph2); - let description = stackNode.body ?? ""; - description = updateDescription({ - description, - output - }); - await octokit.rest.pulls.update({ - ...github.context.repo, - pull_number: stackNode.number, - body: description - }); + console.log(stackGraph2.inspect()); }); }); await Promise.allSettled(jobs.map((job) => job())); @@ -42951,37 +42941,6 @@ function getStackGraph(repoGraph, pullRequest) { ); return stackGraph; } -function updateDescription({ - description, - output -}) { - const ANCHOR = ""; - const descriptionAst = remark2.parse(description); - const outputAst = remark2.parse(`${ANCHOR} -${output}`); - const anchorIndex = descriptionAst.children.findIndex( - (node2) => node2.type === "html" && node2.value === ANCHOR - ); - const isMissingAnchor = anchorIndex === -1; - if (isMissingAnchor) { - descriptionAst.children.push(...outputAst.children); - return remark2.stringify(descriptionAst); - } - let nearestListIndex = anchorIndex; - for (let i = anchorIndex; i < descriptionAst.children.length; i += 1) { - const node2 = descriptionAst.children[i]; - if (node2?.type === "list") { - nearestListIndex = i; - break; - } - } - descriptionAst.children.splice( - anchorIndex, - nearestListIndex - anchorIndex + 1, - ...outputAst.children - ); - return remark2.stringify(descriptionAst); -} // src/inputs.ts var core2 = __toESM(require_core()); @@ -46850,11 +46809,11 @@ var inputs = { core2.endGroup(); return input; }, - async getMainBranch(octokit, config2, context3) { + async getMainBranch(octokit, config2, context2) { const { data: { default_branch: defaultBranch } } = await octokit.rest.repos.get({ - ...context3.repo + ...context2.repo }); const mainBranchInput = core2.getInput("main-branch", { required: false, @@ -46868,11 +46827,11 @@ var inputs = { mainBranch = mainBranchInput !== "" ? mainBranchInput : mainBranch; return mainBranch; }, - async getRemoteBranches(octokit, context3) { + async getRemoteBranches(octokit, context2) { const remoteBranches = await octokit.paginate( "GET /repos/{owner}/{repo}/branches", { - ...context3.repo, + ...context2.repo, per_page: 100 }, (response) => response.data.map((branch) => branch.name) @@ -46911,9 +46870,9 @@ var inputs = { core2.endGroup(); return [...new Set(perennialBranches)]; }, - getCurrentPullRequest(context3) { + getCurrentPullRequest(context2) { try { - const pullRequest = context3.payload.pull_request; + const pullRequest = context2.payload.pull_request; core2.startGroup("Inputs: Current pull request"); core2.info(JSON.stringify(pullRequest)); core2.endGroup(); @@ -46927,11 +46886,11 @@ var inputs = { throw error; } }, - async getPullRequests(octokit, context3) { + async getPullRequests(octokit, context2) { const openPullRequests = await octokit.paginate( "GET /repos/{owner}/{repo}/pulls", { - ...context3.repo, + ...context2.repo, state: "all", per_page: 100 }, @@ -46987,29 +46946,29 @@ void run(); async function run() { try { const validTriggers = ["pull_request", "pull_request_target"]; - if (!validTriggers.includes(github2.context.eventName)) { + if (!validTriggers.includes(github.context.eventName)) { core4.setFailed( `Action only supports the following triggers: ${validTriggers.map((trigger) => `\`${trigger}\``).join(", ")}` ); return; } - const octokit = github2.getOctokit(inputs.getToken()); + const octokit = github.getOctokit(inputs.getToken()); const [mainBranch, remoteBranches, pullRequests] = await Promise.all([ - inputs.getMainBranch(octokit, config, github2.context), - inputs.getRemoteBranches(octokit, github2.context), - inputs.getPullRequests(octokit, github2.context) + inputs.getMainBranch(octokit, config, github.context), + inputs.getRemoteBranches(octokit, github.context), + inputs.getPullRequests(octokit, github.context) ]); const perennialBranches = await inputs.getPerennialBranches(config, remoteBranches); - const context3 = { + const context2 = { octokit, - currentPullRequest: inputs.getCurrentPullRequest(github2.context), + currentPullRequest: inputs.getCurrentPullRequest(github.context), pullRequests, mainBranch, remoteBranches, perennialBranches, skipSingleStacks: inputs.getSkipSingleStacks() }; - void main(context3); + void main(context2); } catch (error) { if (error instanceof Error) { core4.setFailed(error.message); diff --git a/src/main.ts b/src/main.ts index 5cc2151..5d7dd53 100644 --- a/src/main.ts +++ b/src/main.ts @@ -112,17 +112,19 @@ export async function main({ const stackGraph = getStackGraph(repoGraph, stackNode) const output = getOutput(stackGraph) - let description = stackNode.body ?? '' - description = updateDescription({ - description, - output, - }) - - await octokit.rest.pulls.update({ - ...github.context.repo, - pull_number: stackNode.number, - body: description, - }) + console.log(stackGraph.inspect()) + + // let description = stackNode.body ?? '' + // description = updateDescription({ + // description, + // output, + // }) + + // await octokit.rest.pulls.update({ + // ...github.context.repo, + // pull_number: stackNode.number, + // body: description, + // }) }) })