Skip to content

Commit cff6a42

Browse files
committed
fix: extract waitForUrl to own module so tests don't pull in @git-glimpse/core
The test was importing from index.ts which transitively imports @git-glimpse/core, causing Vite resolution failures in CI. Moving waitForUrl to a standalone module breaks that dependency chain. https://claude.ai/code/session_0174r6vAgr36hTnDVwhPv8mu
1 parent db15528 commit cff6a42

5 files changed

Lines changed: 63 additions & 70 deletions

File tree

packages/action/dist/index.js

Lines changed: 44 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
3131
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
3232
mod
3333
));
34-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
3534

3635
// ../../node_modules/.pnpm/@actions+core@1.11.1/node_modules/@actions/core/lib/utils.js
3736
var require_utils = __commonJS({
@@ -20136,12 +20135,12 @@ var require_dist_node2 = __commonJS({
2013620135
}
2013720136
return to;
2013820137
};
20139-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20138+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2014020139
var dist_src_exports = {};
2014120140
__export2(dist_src_exports, {
2014220141
endpoint: () => endpoint
2014320142
});
20144-
module2.exports = __toCommonJS2(dist_src_exports);
20143+
module2.exports = __toCommonJS(dist_src_exports);
2014520144
var import_universal_user_agent = require_dist_node();
2014620145
var VERSION2 = "9.0.6";
2014720146
var userAgent = `octokit-endpoint.js/${VERSION2} ${(0, import_universal_user_agent.getUserAgent)()}`;
@@ -20584,12 +20583,12 @@ var require_dist_node4 = __commonJS({
2058420583
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
2058520584
mod
2058620585
));
20587-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20586+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2058820587
var dist_src_exports = {};
2058920588
__export2(dist_src_exports, {
2059020589
RequestError: () => RequestError
2059120590
});
20592-
module2.exports = __toCommonJS2(dist_src_exports);
20591+
module2.exports = __toCommonJS(dist_src_exports);
2059320592
var import_deprecation = require_dist_node3();
2059420593
var import_once = __toESM2(require_once());
2059520594
var logOnceCode = (0, import_once.default)((deprecation) => console.warn(deprecation));
@@ -20666,12 +20665,12 @@ var require_dist_node5 = __commonJS({
2066620665
}
2066720666
return to;
2066820667
};
20669-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20668+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2067020669
var dist_src_exports = {};
2067120670
__export2(dist_src_exports, {
2067220671
request: () => request
2067320672
});
20674-
module2.exports = __toCommonJS2(dist_src_exports);
20673+
module2.exports = __toCommonJS(dist_src_exports);
2067520674
var import_endpoint = require_dist_node2();
2067620675
var import_universal_user_agent = require_dist_node();
2067720676
var VERSION2 = "8.4.1";
@@ -20876,14 +20875,14 @@ var require_dist_node6 = __commonJS({
2087620875
}
2087720876
return to;
2087820877
};
20879-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
20878+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2088020879
var index_exports = {};
2088120880
__export2(index_exports, {
2088220881
GraphqlResponseError: () => GraphqlResponseError,
2088320882
graphql: () => graphql2,
2088420883
withCustomRequest: () => withCustomRequest
2088520884
});
20886-
module2.exports = __toCommonJS2(index_exports);
20885+
module2.exports = __toCommonJS(index_exports);
2088720886
var import_request3 = require_dist_node5();
2088820887
var import_universal_user_agent = require_dist_node();
2088920888
var VERSION2 = "7.1.1";
@@ -21013,12 +21012,12 @@ var require_dist_node7 = __commonJS({
2101321012
}
2101421013
return to;
2101521014
};
21016-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
21015+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2101721016
var dist_src_exports = {};
2101821017
__export2(dist_src_exports, {
2101921018
createTokenAuth: () => createTokenAuth
2102021019
});
21021-
module2.exports = __toCommonJS2(dist_src_exports);
21020+
module2.exports = __toCommonJS(dist_src_exports);
2102221021
var REGEX_IS_INSTALLATION_LEGACY = /^v1\./;
2102321022
var REGEX_IS_INSTALLATION = /^ghs_/;
2102421023
var REGEX_IS_USER_TO_SERVER = /^ghu_/;
@@ -21084,12 +21083,12 @@ var require_dist_node8 = __commonJS({
2108421083
}
2108521084
return to;
2108621085
};
21087-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
21086+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2108821087
var index_exports = {};
2108921088
__export2(index_exports, {
2109021089
Octokit: () => Octokit2
2109121090
});
21092-
module2.exports = __toCommonJS2(index_exports);
21091+
module2.exports = __toCommonJS(index_exports);
2109321092
var import_universal_user_agent = require_dist_node();
2109421093
var import_before_after_hook = require_before_after_hook();
2109521094
var import_request = require_dist_node5();
@@ -21250,13 +21249,13 @@ var require_dist_node9 = __commonJS({
2125021249
}
2125121250
return to;
2125221251
};
21253-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
21252+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2125421253
var dist_src_exports = {};
2125521254
__export2(dist_src_exports, {
2125621255
legacyRestEndpointMethods: () => legacyRestEndpointMethods,
2125721256
restEndpointMethods: () => restEndpointMethods
2125821257
});
21259-
module2.exports = __toCommonJS2(dist_src_exports);
21258+
module2.exports = __toCommonJS(dist_src_exports);
2126021259
var VERSION2 = "10.4.1";
2126121260
var Endpoints = {
2126221261
actions: {
@@ -23406,15 +23405,15 @@ var require_dist_node10 = __commonJS({
2340623405
}
2340723406
return to;
2340823407
};
23409-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
23408+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
2341023409
var dist_src_exports = {};
2341123410
__export2(dist_src_exports, {
2341223411
composePaginateRest: () => composePaginateRest,
2341323412
isPaginatingEndpoint: () => isPaginatingEndpoint,
2341423413
paginateRest: () => paginateRest,
2341523414
paginatingEndpoints: () => paginatingEndpoints
2341623415
});
23417-
module2.exports = __toCommonJS2(dist_src_exports);
23416+
module2.exports = __toCommonJS(dist_src_exports);
2341823417
var VERSION2 = "9.2.2";
2341923418
function normalizePaginatedListResponse(response) {
2342023419
if (!response.data) {
@@ -47251,7 +47250,7 @@ var require_sourcemap_codec_umd = __commonJS({
4725147250
}
4725247251
return to;
4725347252
};
47254-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
47253+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
4725547254
var sourcemap_codec_exports = {};
4725647255
__export2(sourcemap_codec_exports, {
4725747256
decode: () => decode,
@@ -47261,7 +47260,7 @@ var require_sourcemap_codec_umd = __commonJS({
4726147260
encodeGeneratedRanges: () => encodeGeneratedRanges,
4726247261
encodeOriginalScopes: () => encodeOriginalScopes
4726347262
});
47264-
module3.exports = __toCommonJS2(sourcemap_codec_exports);
47263+
module3.exports = __toCommonJS(sourcemap_codec_exports);
4726547264
var comma = ",".charCodeAt(0);
4726647265
var semicolon = ";".charCodeAt(0);
4726747266
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -47898,7 +47897,7 @@ var require_trace_mapping_umd = __commonJS({
4789847897
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
4789947898
mod
4790047899
));
47901-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
47900+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
4790247901
var require_sourcemap_codec = __commonJS2({
4790347902
"umd:@jridgewell/sourcemap-codec"(exports3, module22) {
4790447903
module22.exports = require_sourcemapCodec;
@@ -47929,7 +47928,7 @@ var require_trace_mapping_umd = __commonJS({
4792947928
sourceContentFor: () => sourceContentFor,
4793047929
traceSegment: () => traceSegment
4793147930
});
47932-
module3.exports = __toCommonJS2(trace_mapping_exports);
47931+
module3.exports = __toCommonJS(trace_mapping_exports);
4793347932
var import_sourcemap_codec = __toESM2(require_sourcemap_codec());
4793447933
var import_resolve_uri = __toESM2(require_resolve_uri());
4793547934
function stripFilename(path2) {
@@ -48438,7 +48437,7 @@ var require_gen_mapping_umd = __commonJS({
4843848437
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
4843948438
mod
4844048439
));
48441-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
48440+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
4844248441
var require_sourcemap_codec = __commonJS2({
4844348442
"umd:@jridgewell/sourcemap-codec"(exports3, module22) {
4844448443
module22.exports = require_sourcemapCodec;
@@ -48463,7 +48462,7 @@ var require_gen_mapping_umd = __commonJS({
4846348462
toDecodedMap: () => toDecodedMap,
4846448463
toEncodedMap: () => toEncodedMap
4846548464
});
48466-
module3.exports = __toCommonJS2(gen_mapping_exports);
48465+
module3.exports = __toCommonJS(gen_mapping_exports);
4846748466
var SetArray = class {
4846848467
constructor() {
4846948468
this._indexes = { __proto__: null };
@@ -58134,12 +58133,12 @@ var require_dist_node11 = __commonJS({
5813458133
}
5813558134
return to;
5813658135
};
58137-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
58136+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
5813858137
var dist_src_exports = {};
5813958138
__export2(dist_src_exports, {
5814058139
requestLog: () => requestLog
5814158140
});
58142-
module2.exports = __toCommonJS2(dist_src_exports);
58141+
module2.exports = __toCommonJS(dist_src_exports);
5814358142
var VERSION2 = "4.0.1";
5814458143
function requestLog(octokit) {
5814558144
octokit.hook.wrap("request", (request, options) => {
@@ -58184,15 +58183,15 @@ var require_dist_node12 = __commonJS({
5818458183
}
5818558184
return to;
5818658185
};
58187-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
58186+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
5818858187
var index_exports = {};
5818958188
__export2(index_exports, {
5819058189
composePaginateRest: () => composePaginateRest,
5819158190
isPaginatingEndpoint: () => isPaginatingEndpoint,
5819258191
paginateRest: () => paginateRest,
5819358192
paginatingEndpoints: () => paginatingEndpoints
5819458193
});
58195-
module2.exports = __toCommonJS2(index_exports);
58194+
module2.exports = __toCommonJS(index_exports);
5819658195
var VERSION2 = "11.4.4-cjs.2";
5819758196
function normalizePaginatedListResponse(response) {
5819858197
if (!response.data) {
@@ -58579,13 +58578,13 @@ var require_dist_node13 = __commonJS({
5857958578
}
5858058579
return to;
5858158580
};
58582-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
58581+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
5858358582
var index_exports = {};
5858458583
__export2(index_exports, {
5858558584
legacyRestEndpointMethods: () => legacyRestEndpointMethods,
5858658585
restEndpointMethods: () => restEndpointMethods
5858758586
});
58588-
module2.exports = __toCommonJS2(index_exports);
58587+
module2.exports = __toCommonJS(index_exports);
5858958588
var VERSION2 = "13.3.2-cjs.1";
5859058589
var Endpoints = {
5859158590
actions: {
@@ -60812,12 +60811,12 @@ var require_dist_node14 = __commonJS({
6081260811
}
6081360812
return to;
6081460813
};
60815-
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
60814+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
6081660815
var index_exports = {};
6081760816
__export2(index_exports, {
6081860817
Octokit: () => Octokit2
6081960818
});
60820-
module2.exports = __toCommonJS2(index_exports);
60819+
module2.exports = __toCommonJS(index_exports);
6082160820
var import_core4 = require_dist_node8();
6082260821
var import_plugin_request_log = require_dist_node11();
6082360822
var import_plugin_paginate_rest = require_dist_node12();
@@ -60834,11 +60833,6 @@ var require_dist_node14 = __commonJS({
6083460833
});
6083560834

6083660835
// src/index.ts
60837-
var src_exports = {};
60838-
__export(src_exports, {
60839-
waitForUrl: () => waitForUrl
60840-
});
60841-
module.exports = __toCommonJS(src_exports);
6084260836
var core = __toESM(require_core());
6084360837
var github = __toESM(require_github());
6084460838
var import_node_child_process3 = require("node:child_process");
@@ -70367,6 +70361,20 @@ function checkApiKey(apiKey, shouldRun) {
7036770361
};
7036870362
}
7036970363

70364+
// src/wait-for-url.ts
70365+
async function waitForUrl(url, timeout) {
70366+
const deadline = Date.now() + timeout;
70367+
while (Date.now() < deadline) {
70368+
try {
70369+
const res = await fetch(url);
70370+
if (res.ok) return;
70371+
} catch {
70372+
}
70373+
await new Promise((r2) => setTimeout(r2, 1e3));
70374+
}
70375+
throw new Error(`App did not become ready at ${url} within ${timeout / 1e3}s`);
70376+
}
70377+
7037070378
// src/index.ts
7037170379
function streamCommand(cmd, args) {
7037270380
return new Promise((resolve2, reject) => {
@@ -70563,23 +70571,7 @@ async function startApp(startCommand, readyUrl) {
7056370571
core.info("App is ready");
7056470572
return proc;
7056570573
}
70566-
async function waitForUrl(url, timeout) {
70567-
const deadline = Date.now() + timeout;
70568-
while (Date.now() < deadline) {
70569-
try {
70570-
const res = await fetch(url);
70571-
if (res.ok) return;
70572-
} catch {
70573-
}
70574-
await new Promise((r2) => setTimeout(r2, 1e3));
70575-
}
70576-
throw new Error(`App did not become ready at ${url} within ${timeout / 1e3}s`);
70577-
}
7057870574
run().catch((err) => core.setFailed(err instanceof Error ? err.message : String(err)));
70579-
// Annotate the CommonJS export names for ESM import in node:
70580-
0 && (module.exports = {
70581-
waitForUrl
70582-
});
7058370575
/*! Bundled license information:
7058470576

7058570577
undici/lib/fetch/body.js:

packages/action/dist/index.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/action/src/index.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
} from '@git-glimpse/core';
1616
import { resolveBaseUrl } from './resolve-base-url.js';
1717
import { checkApiKey } from './api-key-check.js';
18+
import { waitForUrl } from './wait-for-url.js';
1819

1920
function streamCommand(cmd: string, args: string[]): Promise<string> {
2021
return new Promise((resolve, reject) => {
@@ -252,18 +253,5 @@ async function startApp(
252253
return proc;
253254
}
254255

255-
export async function waitForUrl(url: string, timeout: number): Promise<void> {
256-
const deadline = Date.now() + timeout;
257-
while (Date.now() < deadline) {
258-
try {
259-
const res = await fetch(url);
260-
if (res.ok) return;
261-
} catch {
262-
// not ready yet
263-
}
264-
await new Promise((r) => setTimeout(r, 1000));
265-
}
266-
throw new Error(`App did not become ready at ${url} within ${timeout / 1000}s`);
267-
}
268256

269257
run().catch((err) => core.setFailed(err instanceof Error ? err.message : String(err)));
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export async function waitForUrl(url: string, timeout: number): Promise<void> {
2+
const deadline = Date.now() + timeout;
3+
while (Date.now() < deadline) {
4+
try {
5+
const res = await fetch(url);
6+
if (res.ok) return;
7+
} catch {
8+
// not ready yet
9+
}
10+
await new Promise((r) => setTimeout(r, 1000));
11+
}
12+
throw new Error(`App did not become ready at ${url} within ${timeout / 1000}s`);
13+
}

tests/unit/wait-for-url.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, vi, afterEach } from 'vitest';
2-
import { waitForUrl } from '../../packages/action/src/index.js';
2+
import { waitForUrl } from '../../packages/action/src/wait-for-url.js';
33

44
afterEach(() => {
55
vi.restoreAllMocks();

0 commit comments

Comments
 (0)