@interfere/next 9.0.1 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/internal/build/pipeline.d.mts +1 -0
- package/dist/internal/build/pipeline.d.mts.map +1 -1
- package/dist/internal/build/pipeline.mjs +3 -4
- package/dist/internal/build/pipeline.mjs.map +1 -1
- package/dist/internal/server/transport.d.mts.map +1 -1
- package/dist/internal/server/transport.mjs +10 -1
- package/dist/internal/server/transport.mjs.map +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.mts","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"mappings":";;;;;;UAYiB,WAAA;EACf,OAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,KAAA;EACA,UAAA;EACA,MAAA;AAAA;AAAA,KAGU,cAAA;EACN,KAAA;EAAc,MAAA;EAA0B,SAAA;AAAA;EAExC,KAAA;EACA,SAAA;EACA,OAAA,EAAS,qBAAA;EACT,MAAA,EAAQ,sBAAA;EACR,OAAA;EACA,MAAA,EAAQ,WAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"pipeline.d.mts","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"mappings":";;;;;;UAYiB,WAAA;EACf,OAAA;EACA,aAAA;EACA,QAAA;EACA,SAAA;EACA,SAAA;EACA,KAAA;EACA,UAAA;EACA,MAAA;AAAA;AAAA,KAGU,cAAA;EACN,KAAA;EAAc,MAAA;EAA0B,SAAA;AAAA;EAExC,KAAA;EACA,SAAA;EACA,OAAA,EAAS,qBAAA;EACT,MAAA,EAAQ,sBAAA;EACR,OAAA;EACA,MAAA,EAAQ,WAAA;AAAA;AAAA,iBAUQ,gBAAA,CACpB,OAAA,EAAS,wBAAA,EACT,QAAA,EAAU,mBAAA;EAAwB,MAAA;EAAgB,OAAA;AAAA,IAAiB,OAAA;;;;;;;;;;;;WAAtC,wBAAA,CAAA,sBAAA"}
|
|
@@ -7,9 +7,6 @@ async function timed(fn) {
|
|
|
7
7
|
const start = performance.now();
|
|
8
8
|
return [await fn(), Math.round(performance.now() - start)];
|
|
9
9
|
}
|
|
10
|
-
async function fetchSurfaceConfig(sdk) {
|
|
11
|
-
return await sdk.releases.getConfig();
|
|
12
|
-
}
|
|
13
10
|
async function runBuildPipeline(context, metadata) {
|
|
14
11
|
const { apiUrl, apiKey } = metadata;
|
|
15
12
|
const httpClient = new HTTPClient();
|
|
@@ -24,7 +21,7 @@ async function runBuildPipeline(context, metadata) {
|
|
|
24
21
|
});
|
|
25
22
|
const start = performance.now();
|
|
26
23
|
const [{ discovered, config }, discoverMs] = await timed(async () => {
|
|
27
|
-
const [discovered, config] = await Promise.all([discover(context.projectDir, normalizeDistDir(context.distDir)),
|
|
24
|
+
const [discovered, config] = await Promise.all([discover(context.projectDir, normalizeDistDir(context.distDir)), sdk.releases.getConfig()]);
|
|
28
25
|
return {
|
|
29
26
|
discovered,
|
|
30
27
|
config
|
|
@@ -44,11 +41,13 @@ async function runBuildPipeline(context, metadata) {
|
|
|
44
41
|
releaseSlug,
|
|
45
42
|
body
|
|
46
43
|
}));
|
|
44
|
+
const [, preflightMs] = await timed(() => sdk.releases.preflight({ releaseSlug }));
|
|
47
45
|
const [, cleanupMs] = await timed(() => cleanupSourceMaps(discovered.files));
|
|
48
46
|
const timing = {
|
|
49
47
|
discover: discoverMs,
|
|
50
48
|
createRelease: createReleaseMs,
|
|
51
49
|
upload: uploadMs,
|
|
50
|
+
preflight: preflightMs,
|
|
52
51
|
cleanup: cleanupMs,
|
|
53
52
|
total: Math.round(performance.now() - start),
|
|
54
53
|
fileCount: discovered.files.length,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.mjs","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"sourcesContent":["import { HTTPClient, Interfere } from \"@interfere/sdk\";\nimport type { ReleasesConfigResponse } from \"@interfere/sdk/models/releases-config-response.js\";\nimport type { CreateReleaseResponse } from \"@interfere/types/releases/definition\";\n\nimport type {\n ProductionCompileContext,\n ResolvedBuildConfig,\n} from \"../../config.js\";\nimport { resolveReleaseRequest } from \"./release/index.js\";\nimport { discover, normalizeDistDir } from \"./source-maps/discover.js\";\nimport { buildUploadBody, cleanupSourceMaps } from \"./source-maps/index.js\";\n\nexport interface BuildTiming {\n cleanup: number;\n createRelease: number;\n discover: number;\n fileCount: number;\n total: number;\n totalBytes: number;\n upload: number;\n}\n\nexport type PipelineResult =\n | { ready: false; reason: \"no_source_maps\"; fileCount: 0 }\n | {\n ready: true;\n fileCount: number;\n release: CreateReleaseResponse;\n config: ReleasesConfigResponse;\n buildId: string;\n timing: BuildTiming;\n };\n\nasync function timed<T>(fn: () => Promise<T>): Promise<[T, number]> {\n const start = performance.now();\n const result = await fn();\n return [result, Math.round(performance.now() - start)];\n}\n\
|
|
1
|
+
{"version":3,"file":"pipeline.mjs","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"sourcesContent":["import { HTTPClient, Interfere } from \"@interfere/sdk\";\nimport type { ReleasesConfigResponse } from \"@interfere/sdk/models/releases-config-response.js\";\nimport type { CreateReleaseResponse } from \"@interfere/types/releases/definition\";\n\nimport type {\n ProductionCompileContext,\n ResolvedBuildConfig,\n} from \"../../config.js\";\nimport { resolveReleaseRequest } from \"./release/index.js\";\nimport { discover, normalizeDistDir } from \"./source-maps/discover.js\";\nimport { buildUploadBody, cleanupSourceMaps } from \"./source-maps/index.js\";\n\nexport interface BuildTiming {\n cleanup: number;\n createRelease: number;\n discover: number;\n fileCount: number;\n preflight: number;\n total: number;\n totalBytes: number;\n upload: number;\n}\n\nexport type PipelineResult =\n | { ready: false; reason: \"no_source_maps\"; fileCount: 0 }\n | {\n ready: true;\n fileCount: number;\n release: CreateReleaseResponse;\n config: ReleasesConfigResponse;\n buildId: string;\n timing: BuildTiming;\n };\n\nasync function timed<T>(fn: () => Promise<T>): Promise<[T, number]> {\n const start = performance.now();\n const result = await fn();\n return [result, Math.round(performance.now() - start)];\n}\n\n\nexport async function runBuildPipeline(\n context: ProductionCompileContext,\n metadata: ResolvedBuildConfig & { apiKey: string; buildId: string }\n) {\n const { apiUrl, apiKey } = metadata;\n\n const httpClient = new HTTPClient();\n\n httpClient.addHook(\"beforeRequest\", (request) => {\n const nextRequest = new Request(request);\n\n nextRequest.headers.set(\"x-api-key\", apiKey);\n\n return nextRequest;\n });\n\n const sdk = new Interfere({ serverURL: apiUrl, httpClient });\n\n const start = performance.now();\n\n const [{ discovered, config }, discoverMs] = await timed(async () => {\n const [discovered, config] = await Promise.all([\n discover(context.projectDir, normalizeDistDir(context.distDir)),\n sdk.releases.getConfig(),\n ]);\n return { discovered, config };\n });\n\n if (discovered.files.length === 0) {\n return { ready: false, reason: \"no_source_maps\", fileCount: 0 };\n }\n\n const releaseRequest = resolveReleaseRequest(metadata.buildId, config);\n\n const [release, createReleaseMs] = await timed(() =>\n sdk.releases.create(releaseRequest)\n );\n\n const releaseSlug = release.destination.slug;\n const buildId = release.build.hash ?? metadata.buildId;\n\n const { body, totalBytes } = buildUploadBody(discovered);\n\n const [, uploadMs] = await timed(() =>\n sdk.sourceMaps.uploadMultipart({ releaseSlug, body })\n );\n\n // Cleanup runs *after* preflight, not before (PRD draft had it inverted).\n // Preflight only depends on the upload having succeeded; if local cleanup\n // fails we still want the release marked confirmed and the build to fail\n // loudly via the cleanup error, rather than leaving a confirmed-but-uncleaned\n // workspace and a release that needs a redeploy to recover.\n const [, preflightMs] = await timed(() =>\n sdk.releases.preflight({ releaseSlug })\n );\n\n const [, cleanupMs] = await timed(() => cleanupSourceMaps(discovered.files));\n\n const timing: BuildTiming = {\n discover: discoverMs,\n createRelease: createReleaseMs,\n upload: uploadMs,\n preflight: preflightMs,\n cleanup: cleanupMs,\n total: Math.round(performance.now() - start),\n fileCount: discovered.files.length,\n totalBytes,\n };\n\n return {\n ready: true,\n fileCount: discovered.files.length,\n release,\n config,\n buildId,\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;CAED,MAAM,GAAG,aAAa,MAAM,YAAY,kBAAkB,WAAW,MAAM,CAAC;CAE5E,MAAM,SAAsB;EAC1B,UAAU;EACV,eAAe;EACf,QAAQ;EACR,WAAW;EACX,SAAS;EACT,OAAO,KAAK,MAAM,YAAY,KAAK,GAAG,MAAM;EAC5C,WAAW,WAAW,MAAM;EAC5B;EACD;AAED,QAAO;EACL,OAAO;EACP,WAAW,WAAW,MAAM;EAC5B;EACA;EACA;EACA;EACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.mts","names":[],"sources":["../../../src/internal/server/transport.ts"],"mappings":";;;;UAIiB,iBAAA;EAAA,SACN,QAAA,EAAU,QAAA;EAAA,SACV,OAAA,EAAS,oBAAA;EAAA,SACT,WAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"transport.d.mts","names":[],"sources":["../../../src/internal/server/transport.ts"],"mappings":";;;;UAIiB,iBAAA;EAAA,SACN,QAAA,EAAU,QAAA;EAAA,SACV,OAAA,EAAS,oBAAA;EAAA,SACT,WAAA;AAAA;AAAA,iBAMW,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAoB,OAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
//#region src/internal/server/transport.ts
|
|
2
|
+
const LOG_DEDUPE_WINDOW_MS = 6e4;
|
|
3
|
+
let last5xxLogAt = 0;
|
|
2
4
|
async function sendEnvelope(input) {
|
|
3
5
|
const { envelope, runtime, traceparent } = input;
|
|
4
6
|
if (runtime.apiKey === null) return;
|
|
5
|
-
await fetch(runtime.ingestUrl, {
|
|
7
|
+
const response = await fetch(runtime.ingestUrl, {
|
|
6
8
|
method: "POST",
|
|
7
9
|
headers: {
|
|
8
10
|
"content-type": "application/json",
|
|
@@ -12,6 +14,13 @@ async function sendEnvelope(input) {
|
|
|
12
14
|
body: JSON.stringify([envelope]),
|
|
13
15
|
keepalive: true
|
|
14
16
|
});
|
|
17
|
+
if (response.ok) return;
|
|
18
|
+
if (response.status >= 400 && response.status < 500) return;
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
if (now - last5xxLogAt > LOG_DEDUPE_WINDOW_MS) {
|
|
21
|
+
last5xxLogAt = now;
|
|
22
|
+
console.warn(`[interfere] collector returned ${response.status}; server-side events for this process may be dropped until recovery.`);
|
|
23
|
+
}
|
|
15
24
|
}
|
|
16
25
|
//#endregion
|
|
17
26
|
export { sendEnvelope };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.mjs","names":[],"sources":["../../../src/internal/server/transport.ts"],"sourcesContent":["import type { Envelope } from \"@interfere/types/sdk/envelope\";\n\nimport type { ServerCaptureRuntime } from \"./runtime.js\";\n\nexport interface SendEnvelopeInput {\n readonly envelope: Envelope<\"error\">;\n readonly runtime: ServerCaptureRuntime;\n readonly traceparent?: string | undefined;\n}\n\nexport async function sendEnvelope(input: SendEnvelopeInput): Promise<void> {\n const { envelope, runtime, traceparent } = input;\n\n if (runtime.apiKey === null) {\n return;\n }\n\n await fetch(runtime.ingestUrl, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n \"x-api-key\": runtime.apiKey,\n ...(traceparent ? { traceparent } : {}),\n },\n body: JSON.stringify([envelope]),\n keepalive: true,\n });\n}\n"],"mappings":";AAUA,eAAsB,aAAa,OAAyC;CAC1E,MAAM,EAAE,UAAU,SAAS,gBAAgB;AAE3C,KAAI,QAAQ,WAAW,KACrB;
|
|
1
|
+
{"version":3,"file":"transport.mjs","names":[],"sources":["../../../src/internal/server/transport.ts"],"sourcesContent":["import type { Envelope } from \"@interfere/types/sdk/envelope\";\n\nimport type { ServerCaptureRuntime } from \"./runtime.js\";\n\nexport interface SendEnvelopeInput {\n readonly envelope: Envelope<\"error\">;\n readonly runtime: ServerCaptureRuntime;\n readonly traceparent?: string | undefined;\n}\n\nconst LOG_DEDUPE_WINDOW_MS = 60_000;\nlet last5xxLogAt = 0;\n\nexport async function sendEnvelope(input: SendEnvelopeInput): Promise<void> {\n const { envelope, runtime, traceparent } = input;\n\n if (runtime.apiKey === null) {\n return;\n }\n\n const response = await fetch(runtime.ingestUrl, {\n method: \"POST\",\n headers: {\n \"content-type\": \"application/json\",\n \"x-api-key\": runtime.apiKey,\n ...(traceparent ? { traceparent } : {}),\n },\n body: JSON.stringify([envelope]),\n keepalive: true,\n });\n\n if (response.ok) {\n return;\n }\n\n if (response.status >= 400 && response.status < 500) {\n return;\n }\n\n // 5xx: log once per window so a collector outage doesn't spam logs.\n const now = Date.now();\n if (now - last5xxLogAt > LOG_DEDUPE_WINDOW_MS) {\n last5xxLogAt = now;\n console.warn(\n `[interfere] collector returned ${response.status}; server-side events for this process may be dropped until recovery.`\n );\n }\n}\n"],"mappings":";AAUA,MAAM,uBAAuB;AAC7B,IAAI,eAAe;AAEnB,eAAsB,aAAa,OAAyC;CAC1E,MAAM,EAAE,UAAU,SAAS,gBAAgB;AAE3C,KAAI,QAAQ,WAAW,KACrB;CAGF,MAAM,WAAW,MAAM,MAAM,QAAQ,WAAW;EAC9C,QAAQ;EACR,SAAS;GACP,gBAAgB;GAChB,aAAa,QAAQ;GACrB,GAAI,cAAc,EAAE,aAAa,GAAG,EAAE;GACvC;EACD,MAAM,KAAK,UAAU,CAAC,SAAS,CAAC;EAChC,WAAW;EACZ,CAAC;AAEF,KAAI,SAAS,GACX;AAGF,KAAI,SAAS,UAAU,OAAO,SAAS,SAAS,IAC9C;CAIF,MAAM,MAAM,KAAK,KAAK;AACtB,KAAI,MAAM,eAAe,sBAAsB;AAC7C,iBAAe;AACf,UAAQ,KACN,kCAAkC,SAAS,OAAO,sEACnD"}
|
package/dist/package.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interfere/next",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Build software that never breaks.",
|
|
6
6
|
"keywords": [
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@interfere/constants": "^9.0.0",
|
|
65
65
|
"@interfere/helpers": "^9.0.0",
|
|
66
|
-
"@interfere/react": "^9.0.
|
|
67
|
-
"@interfere/sdk": "^9.0.
|
|
66
|
+
"@interfere/react": "^9.0.2",
|
|
67
|
+
"@interfere/sdk": "^9.0.2",
|
|
68
68
|
"@interfere/types": "^9.0.0",
|
|
69
69
|
"chalk": "^5.6.2",
|
|
70
70
|
"uuid": "^14.0.0"
|