@interfere/next 3.0.0 → 5.0.0
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/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/config.d.mts +21 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +103 -0
- package/dist/config.mjs.map +1 -0
- package/dist/instrument-client.d.mts +3 -0
- package/dist/instrument-client.mjs +2 -0
- package/dist/internal/build/configure-build.d.mts +25 -0
- package/dist/internal/build/configure-build.d.mts.map +1 -0
- package/dist/internal/build/configure-build.mjs +87 -0
- package/dist/internal/build/configure-build.mjs.map +1 -0
- package/dist/internal/build/pipeline.d.mts +49 -0
- package/dist/internal/build/pipeline.d.mts.map +1 -0
- package/dist/internal/build/pipeline.mjs +67 -0
- package/dist/internal/build/pipeline.mjs.map +1 -0
- package/dist/internal/build/release/destinations/vercel.d.mts +6 -0
- package/dist/internal/build/release/destinations/vercel.d.mts.map +1 -0
- package/dist/internal/build/release/destinations/vercel.mjs +25 -0
- package/dist/internal/build/release/destinations/vercel.mjs.map +1 -0
- package/dist/internal/build/release/git.d.mts +4 -0
- package/dist/internal/build/release/git.d.mts.map +1 -0
- package/dist/internal/build/release/git.mjs +21 -0
- package/dist/internal/build/release/git.mjs.map +1 -0
- package/dist/internal/build/release/index.d.mts +8 -0
- package/dist/internal/build/release/index.d.mts.map +1 -0
- package/dist/internal/build/release/index.mjs +20 -0
- package/dist/internal/build/release/index.mjs.map +1 -0
- package/dist/internal/build/release/sources/github.d.mts +6 -0
- package/dist/internal/build/release/sources/github.d.mts.map +1 -0
- package/dist/internal/build/release/sources/github.mjs +15 -0
- package/dist/internal/build/release/sources/github.mjs.map +1 -0
- package/dist/internal/build/source-maps/discover.d.mts +15 -0
- package/dist/internal/build/source-maps/discover.d.mts.map +1 -0
- package/dist/internal/build/source-maps/discover.mjs +62 -0
- package/dist/internal/build/source-maps/discover.mjs.map +1 -0
- package/dist/internal/build/source-maps/index.d.mts +26 -0
- package/dist/internal/build/source-maps/index.d.mts.map +1 -0
- package/dist/internal/build/source-maps/index.mjs +28 -0
- package/dist/internal/build/source-maps/index.mjs.map +1 -0
- package/dist/internal/build/value-injection-loader.d.mts +13 -0
- package/dist/internal/build/value-injection-loader.d.mts.map +1 -0
- package/dist/internal/build/value-injection-loader.mjs +24 -0
- package/dist/internal/build/value-injection-loader.mjs.map +1 -0
- package/dist/internal/env.d.mts +16 -0
- package/dist/internal/env.d.mts.map +1 -0
- package/dist/internal/env.mjs +19 -0
- package/dist/internal/env.mjs.map +1 -0
- package/dist/internal/logger.d.mts +9 -0
- package/dist/internal/logger.d.mts.map +1 -0
- package/dist/internal/logger.mjs +60 -0
- package/dist/internal/logger.mjs.map +1 -0
- package/dist/internal/route/handle-get.d.mts +4 -0
- package/dist/internal/route/handle-get.d.mts.map +1 -0
- package/dist/internal/route/handle-get.mjs +23 -0
- package/dist/internal/route/handle-get.mjs.map +1 -0
- package/dist/internal/route/handle-post.d.mts +4 -0
- package/dist/internal/route/handle-post.d.mts.map +1 -0
- package/dist/internal/route/handle-post.mjs +65 -0
- package/dist/internal/route/handle-post.mjs.map +1 -0
- package/dist/internal/route/proxy.d.mts +18 -0
- package/dist/internal/route/proxy.d.mts.map +1 -0
- package/dist/internal/route/proxy.mjs +82 -0
- package/dist/internal/route/proxy.mjs.map +1 -0
- package/dist/internal/route/sw-script.d.mts +4 -0
- package/dist/internal/route/sw-script.d.mts.map +1 -0
- package/dist/internal/route/sw-script.mjs +38 -0
- package/dist/internal/route/sw-script.mjs.map +1 -0
- package/dist/internal/server/capture.d.mts +9 -0
- package/dist/internal/server/capture.d.mts.map +1 -0
- package/dist/internal/server/capture.mjs +52 -0
- package/dist/internal/server/capture.mjs.map +1 -0
- package/dist/internal/server/dedupe.d.mts +5 -0
- package/dist/internal/server/dedupe.d.mts.map +1 -0
- package/dist/internal/server/dedupe.mjs +11 -0
- package/dist/internal/server/dedupe.mjs.map +1 -0
- package/dist/internal/server/envelope.d.mts +14 -0
- package/dist/internal/server/envelope.d.mts.map +1 -0
- package/dist/internal/server/envelope.mjs +57 -0
- package/dist/internal/server/envelope.mjs.map +1 -0
- package/dist/internal/server/normalize-request.d.mts +7 -0
- package/dist/internal/server/normalize-request.d.mts.map +1 -0
- package/dist/internal/server/normalize-request.mjs +50 -0
- package/dist/internal/server/normalize-request.mjs.map +1 -0
- package/dist/internal/server/remote-config.d.mts +5 -0
- package/dist/internal/server/remote-config.d.mts.map +1 -0
- package/dist/internal/server/remote-config.mjs +28 -0
- package/dist/internal/server/remote-config.mjs.map +1 -0
- package/dist/internal/server/runtime.d.mts +14 -0
- package/dist/internal/server/runtime.d.mts.map +1 -0
- package/dist/internal/server/runtime.mjs +18 -0
- package/dist/internal/server/runtime.mjs.map +1 -0
- package/dist/internal/server/transport.d.mts +12 -0
- package/dist/internal/server/transport.d.mts.map +1 -0
- package/dist/internal/server/transport.mjs +17 -0
- package/dist/internal/server/transport.mjs.map +1 -0
- package/dist/internal/server/types.d.mts +17 -0
- package/dist/internal/server/types.d.mts.map +1 -0
- package/dist/internal/server/types.mjs +1 -0
- package/dist/internal/version.d.mts +4 -0
- package/dist/internal/version.d.mts.map +1 -0
- package/dist/internal/version.mjs +5 -0
- package/dist/internal/version.mjs.map +1 -0
- package/dist/package.mjs +5 -0
- package/dist/package.mjs.map +1 -0
- package/dist/provider.d.mts +3 -0
- package/dist/provider.mjs +3 -0
- package/dist/route-handler.d.mts +7 -0
- package/dist/route-handler.d.mts.map +1 -0
- package/dist/route-handler.mjs +26 -0
- package/dist/route-handler.mjs.map +1 -0
- package/dist/server.d.mts +4 -0
- package/dist/server.mjs +3 -0
- package/package.json +26 -26
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Envelope } from "@interfere/types/sdk/envelope";
|
|
2
|
+
import { NextConfig } from "next";
|
|
3
|
+
|
|
4
|
+
//#region src/config.d.ts
|
|
5
|
+
interface InterfereConfig extends Partial<Pick<Envelope, "buildId" | "releaseId">> {}
|
|
6
|
+
interface NextConfigWithInterfere extends NextConfig {
|
|
7
|
+
interfere?: InterfereConfig;
|
|
8
|
+
}
|
|
9
|
+
interface ResolvedBuildConfig {
|
|
10
|
+
readonly apiKey: string | null;
|
|
11
|
+
readonly apiUrl: string;
|
|
12
|
+
readonly buildId: string | null;
|
|
13
|
+
readonly releaseId: string | null;
|
|
14
|
+
}
|
|
15
|
+
declare function withInterfere(nextConfig?: NextConfigWithInterfere): NextConfig;
|
|
16
|
+
interface ProductionCompileContext {
|
|
17
|
+
readonly distDir: string;
|
|
18
|
+
readonly projectDir: string;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { InterfereConfig, NextConfigWithInterfere, ProductionCompileContext, ResolvedBuildConfig, withInterfere };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;UAeiB,eAAA,SACP,OAAA,CAAQ,IAAA,CAAK,QAAA;AAAA,UAEN,uBAAA,SAAgC,UAAA;EAC/C,SAAA,GAAY,eAAA;AAAA;AAAA,UAGG,mBAAA;EAAA,SACN,MAAA;EAAA,SACA,MAAA;EAAA,SACA,OAAA;EAAA,SACA,SAAA;AAAA;AAAA,iBAGK,aAAA,CACd,UAAA,GAAY,uBAAA,GACX,UAAA;AAAA,UAqFc,wBAAA;EAAA,SACN,OAAA;EAAA,SACA,UAAA;AAAA"}
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { configureBuild } from "./internal/build/configure-build.mjs";
|
|
2
|
+
import { log } from "./internal/logger.mjs";
|
|
3
|
+
import { runGitCommand } from "./internal/build/release/git.mjs";
|
|
4
|
+
import { readInterfereEnv } from "./internal/env.mjs";
|
|
5
|
+
import { API_URL } from "@interfere/constants/api";
|
|
6
|
+
import { releaseDestinationIdEnvKeys, releaseSourceIdEnvKeys } from "@interfere/types/integrations";
|
|
7
|
+
import { parseEnvValue, readFirstEnvValue } from "@interfere/types/sdk/env";
|
|
8
|
+
//#region src/config.ts
|
|
9
|
+
function withInterfere(nextConfig = {}) {
|
|
10
|
+
const { interfere, env: userEnv, webpack, turbopack, compiler, productionBrowserSourceMaps, ...rest } = nextConfig;
|
|
11
|
+
const config = resolveBuildConfig(interfere);
|
|
12
|
+
const build = configureBuild({
|
|
13
|
+
existingWebpack: webpack,
|
|
14
|
+
existingTurbopack: turbopack,
|
|
15
|
+
projectDir: process.cwd(),
|
|
16
|
+
values: {
|
|
17
|
+
__INTERFERE_BUILD_ID__: config.buildId,
|
|
18
|
+
__INTERFERE_RELEASE_ID__: config.releaseId
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
if (config.apiKey !== null && !build.webpack && !build.turbopack) return log.fatal("Missing instrumentation client", ["INTERFERE_API_KEY is set but no instrumentation-client file was found.", "Create an instrumentation-client.ts file in your project root or src/ directory."]);
|
|
22
|
+
const existingHook = compiler?.runAfterProductionCompile;
|
|
23
|
+
return {
|
|
24
|
+
...rest,
|
|
25
|
+
env: mergeEnvConfig(userEnv, config),
|
|
26
|
+
compiler: {
|
|
27
|
+
...compiler ?? {},
|
|
28
|
+
async runAfterProductionCompile(context) {
|
|
29
|
+
if (existingHook) await existingHook(context);
|
|
30
|
+
await runBuildReleasePipeline(context, config);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
webpack: build.webpack,
|
|
34
|
+
turbopack: build.turbopack,
|
|
35
|
+
productionBrowserSourceMaps: config.apiKey === null ? productionBrowserSourceMaps : true
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function resolveBuildConfig(interfere) {
|
|
39
|
+
const { apiKey, apiUrl } = readInterfereEnv();
|
|
40
|
+
const buildId = parseEnvValue(interfere?.buildId) ?? readFirstEnvValue(process.env, releaseSourceIdEnvKeys) ?? runGitCommand("git rev-parse HEAD");
|
|
41
|
+
const releaseId = parseEnvValue(interfere?.releaseId) ?? readFirstEnvValue(process.env, releaseDestinationIdEnvKeys) ?? buildId;
|
|
42
|
+
return {
|
|
43
|
+
apiKey: apiKey ?? null,
|
|
44
|
+
apiUrl,
|
|
45
|
+
buildId,
|
|
46
|
+
releaseId
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function mergeEnvConfig(userEnv, config) {
|
|
50
|
+
const merged = {};
|
|
51
|
+
if (config.buildId !== null) merged.NEXT_PUBLIC_INTERFERE_BUILD_ID = config.buildId;
|
|
52
|
+
if (config.releaseId !== null) merged.NEXT_PUBLIC_INTERFERE_RELEASE_ID = config.releaseId;
|
|
53
|
+
return {
|
|
54
|
+
...merged,
|
|
55
|
+
...userEnv
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function isNetworkError(error) {
|
|
59
|
+
if (error instanceof TypeError) return true;
|
|
60
|
+
if (error instanceof Error) {
|
|
61
|
+
const msg = error.message.toLowerCase();
|
|
62
|
+
return msg.includes("econnrefused") || msg.includes("enotfound") || msg.includes("fetch failed") || msg.includes("network");
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
async function runBuildReleasePipeline(context, config) {
|
|
67
|
+
const { apiKey, apiUrl, buildId } = config;
|
|
68
|
+
if (!apiKey) return log.fatal("API key not set", [
|
|
69
|
+
"withInterfere() requires an API key to upload source maps during production builds.",
|
|
70
|
+
"Set the INTERFERE_API_KEY environment variable, or remove withInterfere() from your Next.js config.",
|
|
71
|
+
"See: https://interfere.com/docs/nextjs/setup"
|
|
72
|
+
]);
|
|
73
|
+
if (!buildId) return log.fatal("Build ID missing", ["Could not resolve a build ID from config, environment variables, or git.", "Set INTERFERE_BUILD_ID, or ensure git is available in your build environment."]);
|
|
74
|
+
const { runBuildPipeline } = await import("./internal/build/pipeline.mjs");
|
|
75
|
+
try {
|
|
76
|
+
const result = await runBuildPipeline(context, {
|
|
77
|
+
...config,
|
|
78
|
+
apiKey,
|
|
79
|
+
buildId
|
|
80
|
+
});
|
|
81
|
+
if (!result.ready) {
|
|
82
|
+
log.warn("Skipping", ["No source maps found"]);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
log.info("Completed", [
|
|
86
|
+
`https://interfere.com/~/${result.config?.org.slug}/surfaces/${result.config?.surface.slug}`,
|
|
87
|
+
`Release: ${result.release?.destination.slug ?? "Unknown"}`,
|
|
88
|
+
`Build: ${result.buildId}`,
|
|
89
|
+
`Artifacts: ${result.fileCount} source maps`
|
|
90
|
+
]);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
93
|
+
if (apiUrl !== API_URL) {
|
|
94
|
+
const isNetwork = isNetworkError(error);
|
|
95
|
+
log.warn("Skipping release pipeline", [message, isNetwork ? `${apiUrl} is unreachable — this is expected during local development.` : `${apiUrl} returned an error. Ensure the collector is running and configured correctly.`]);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
log.error("Error", [message]);
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { withInterfere };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import { API_URL } from \"@interfere/constants/api\";\nimport {\n releaseDestinationIdEnvKeys,\n releaseSourceIdEnvKeys,\n} from \"@interfere/types/integrations\";\nimport { parseEnvValue, readFirstEnvValue } from \"@interfere/types/sdk/env\";\nimport type { Envelope } from \"@interfere/types/sdk/envelope\";\n\nimport type { NextConfig } from \"next\";\n\nimport { configureBuild } from \"./internal/build/configure-build.js\";\nimport { runGitCommand } from \"./internal/build/release/git.js\";\nimport { readInterfereEnv } from \"./internal/env.js\";\nimport { log } from \"./internal/logger.js\";\n\nexport interface InterfereConfig\n extends Partial<Pick<Envelope, \"buildId\" | \"releaseId\">> {}\n\nexport interface NextConfigWithInterfere extends NextConfig {\n interfere?: InterfereConfig;\n}\n\nexport interface ResolvedBuildConfig {\n readonly apiKey: string | null;\n readonly apiUrl: string;\n readonly buildId: string | null;\n readonly releaseId: string | null;\n}\n\nexport function withInterfere(\n nextConfig: NextConfigWithInterfere = {}\n): NextConfig {\n const {\n interfere,\n env: userEnv,\n webpack,\n turbopack,\n compiler,\n productionBrowserSourceMaps,\n ...rest\n } = nextConfig;\n\n const config = resolveBuildConfig(interfere);\n const build = configureBuild({\n existingWebpack: webpack,\n existingTurbopack: turbopack,\n projectDir: process.cwd(),\n values: {\n __INTERFERE_BUILD_ID__: config.buildId,\n __INTERFERE_RELEASE_ID__: config.releaseId,\n },\n });\n\n if (config.apiKey !== null && !build.webpack && !build.turbopack) {\n return log.fatal(\"Missing instrumentation client\", [\n \"INTERFERE_API_KEY is set but no instrumentation-client file was found.\",\n \"Create an instrumentation-client.ts file in your project root or src/ directory.\",\n ]);\n }\n\n const existingHook = (compiler as NextCompilerWithProductionHook | undefined)\n ?.runAfterProductionCompile;\n\n return {\n ...rest,\n env: mergeEnvConfig(userEnv, config),\n compiler: {\n ...(compiler ?? {}),\n async runAfterProductionCompile(context: ProductionCompileContext) {\n if (existingHook) {\n await existingHook(context);\n }\n\n await runBuildReleasePipeline(context, config);\n },\n } as NextConfig[\"compiler\"],\n webpack: build.webpack,\n turbopack: build.turbopack,\n productionBrowserSourceMaps:\n config.apiKey === null ? productionBrowserSourceMaps : true,\n };\n}\n\nfunction resolveBuildConfig(interfere?: InterfereConfig): ResolvedBuildConfig {\n const { apiKey, apiUrl } = readInterfereEnv();\n\n const buildId =\n parseEnvValue(interfere?.buildId) ??\n readFirstEnvValue(process.env, releaseSourceIdEnvKeys) ??\n runGitCommand(\"git rev-parse HEAD\");\n\n const releaseId =\n parseEnvValue(interfere?.releaseId) ??\n readFirstEnvValue(process.env, releaseDestinationIdEnvKeys) ??\n buildId;\n\n return { apiKey: apiKey ?? null, apiUrl, buildId, releaseId };\n}\n\nfunction mergeEnvConfig(\n userEnv: NextConfig[\"env\"] | undefined,\n config: ResolvedBuildConfig\n): NextConfig[\"env\"] {\n const merged: Record<string, string> = {};\n\n if (config.buildId !== null) {\n merged.NEXT_PUBLIC_INTERFERE_BUILD_ID = config.buildId;\n }\n\n if (config.releaseId !== null) {\n merged.NEXT_PUBLIC_INTERFERE_RELEASE_ID = config.releaseId;\n }\n\n return { ...merged, ...userEnv };\n}\n\nexport interface ProductionCompileContext {\n readonly distDir: string;\n readonly projectDir: string;\n}\n\ntype NextCompilerWithProductionHook = NonNullable<NextConfig[\"compiler\"]> & {\n runAfterProductionCompile?: (\n context: ProductionCompileContext\n ) => void | Promise<void>;\n};\n\nfunction isNetworkError(error: unknown): boolean {\n if (error instanceof TypeError) {\n return true;\n }\n if (error instanceof Error) {\n const msg = error.message.toLowerCase();\n return (\n msg.includes(\"econnrefused\") ||\n msg.includes(\"enotfound\") ||\n msg.includes(\"fetch failed\") ||\n msg.includes(\"network\")\n );\n }\n return false;\n}\n\nasync function runBuildReleasePipeline(\n context: ProductionCompileContext,\n config: ResolvedBuildConfig\n): Promise<void> {\n const { apiKey, apiUrl, buildId } = config;\n\n if (!apiKey) {\n return log.fatal(\"API key not set\", [\n \"withInterfere() requires an API key to upload source maps during production builds.\",\n \"Set the INTERFERE_API_KEY environment variable, or remove withInterfere() from your Next.js config.\",\n \"See: https://interfere.com/docs/nextjs/setup\",\n ]);\n }\n\n if (!buildId) {\n return log.fatal(\"Build ID missing\", [\n \"Could not resolve a build ID from config, environment variables, or git.\",\n \"Set INTERFERE_BUILD_ID, or ensure git is available in your build environment.\",\n ]);\n }\n\n const { runBuildPipeline } = await import(\"./internal/build/pipeline.js\");\n\n try {\n const result = await runBuildPipeline(context, {\n ...config,\n apiKey,\n buildId,\n });\n\n if (!result.ready) {\n log.warn(\"Skipping\", [\"No source maps found\"]);\n return;\n }\n\n log.info(\"Completed\", [\n `https://interfere.com/~/${result.config?.org.slug}/surfaces/${result.config?.surface.slug}`,\n `Release: ${result.release?.destination.slug ?? \"Unknown\"}`,\n `Build: ${result.buildId}`,\n `Artifacts: ${result.fileCount} source maps`,\n ]);\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n\n if (apiUrl !== API_URL) {\n const isNetwork = isNetworkError(error);\n\n log.warn(\"Skipping release pipeline\", [\n message,\n isNetwork\n ? `${apiUrl} is unreachable — this is expected during local development.`\n : `${apiUrl} returned an error. Ensure the collector is running and configured correctly.`,\n ]);\n\n return;\n }\n\n log.error(\"Error\", [message]);\n throw error;\n }\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,cACd,aAAsC,EAAE,EAC5B;CACZ,MAAM,EACJ,WACA,KAAK,SACL,SACA,WACA,UACA,6BACA,GAAG,SACD;CAEJ,MAAM,SAAS,mBAAmB,UAAU;CAC5C,MAAM,QAAQ,eAAe;EAC3B,iBAAiB;EACjB,mBAAmB;EACnB,YAAY,QAAQ,KAAK;EACzB,QAAQ;GACN,wBAAwB,OAAO;GAC/B,0BAA0B,OAAO;GAClC;EACF,CAAC;AAEF,KAAI,OAAO,WAAW,QAAQ,CAAC,MAAM,WAAW,CAAC,MAAM,UACrD,QAAO,IAAI,MAAM,kCAAkC,CACjD,0EACA,mFACD,CAAC;CAGJ,MAAM,eAAgB,UAClB;AAEJ,QAAO;EACL,GAAG;EACH,KAAK,eAAe,SAAS,OAAO;EACpC,UAAU;GACR,GAAI,YAAY,EAAE;GAClB,MAAM,0BAA0B,SAAmC;AACjE,QAAI,aACF,OAAM,aAAa,QAAQ;AAG7B,UAAM,wBAAwB,SAAS,OAAO;;GAEjD;EACD,SAAS,MAAM;EACf,WAAW,MAAM;EACjB,6BACE,OAAO,WAAW,OAAO,8BAA8B;EAC1D;;AAGH,SAAS,mBAAmB,WAAkD;CAC5E,MAAM,EAAE,QAAQ,WAAW,kBAAkB;CAE7C,MAAM,UACJ,cAAc,WAAW,QAAQ,IACjC,kBAAkB,QAAQ,KAAK,uBAAuB,IACtD,cAAc,qBAAqB;CAErC,MAAM,YACJ,cAAc,WAAW,UAAU,IACnC,kBAAkB,QAAQ,KAAK,4BAA4B,IAC3D;AAEF,QAAO;EAAE,QAAQ,UAAU;EAAM;EAAQ;EAAS;EAAW;;AAG/D,SAAS,eACP,SACA,QACmB;CACnB,MAAM,SAAiC,EAAE;AAEzC,KAAI,OAAO,YAAY,KACrB,QAAO,iCAAiC,OAAO;AAGjD,KAAI,OAAO,cAAc,KACvB,QAAO,mCAAmC,OAAO;AAGnD,QAAO;EAAE,GAAG;EAAQ,GAAG;EAAS;;AAclC,SAAS,eAAe,OAAyB;AAC/C,KAAI,iBAAiB,UACnB,QAAO;AAET,KAAI,iBAAiB,OAAO;EAC1B,MAAM,MAAM,MAAM,QAAQ,aAAa;AACvC,SACE,IAAI,SAAS,eAAe,IAC5B,IAAI,SAAS,YAAY,IACzB,IAAI,SAAS,eAAe,IAC5B,IAAI,SAAS,UAAU;;AAG3B,QAAO;;AAGT,eAAe,wBACb,SACA,QACe;CACf,MAAM,EAAE,QAAQ,QAAQ,YAAY;AAEpC,KAAI,CAAC,OACH,QAAO,IAAI,MAAM,mBAAmB;EAClC;EACA;EACA;EACD,CAAC;AAGJ,KAAI,CAAC,QACH,QAAO,IAAI,MAAM,oBAAoB,CACnC,4EACA,gFACD,CAAC;CAGJ,MAAM,EAAE,qBAAqB,MAAM,OAAO;AAE1C,KAAI;EACF,MAAM,SAAS,MAAM,iBAAiB,SAAS;GAC7C,GAAG;GACH;GACA;GACD,CAAC;AAEF,MAAI,CAAC,OAAO,OAAO;AACjB,OAAI,KAAK,YAAY,CAAC,uBAAuB,CAAC;AAC9C;;AAGF,MAAI,KAAK,aAAa;GACpB,2BAA2B,OAAO,QAAQ,IAAI,KAAK,YAAY,OAAO,QAAQ,QAAQ;GACtF,YAAY,OAAO,SAAS,YAAY,QAAQ;GAChD,UAAU,OAAO;GACjB,cAAc,OAAO,UAAU;GAChC,CAAC;UACK,OAAO;EACd,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;AAEtE,MAAI,WAAW,SAAS;GACtB,MAAM,YAAY,eAAe,MAAM;AAEvC,OAAI,KAAK,6BAA6B,CACpC,SACA,YACI,GAAG,OAAO,gEACV,GAAG,OAAO,+EACf,CAAC;AAEF;;AAGF,MAAI,MAAM,SAAS,CAAC,QAAQ,CAAC;AAC7B,QAAM"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { NextConfig } from "next";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/build/configure-build.d.ts
|
|
4
|
+
interface InterfereInjectedValues {
|
|
5
|
+
readonly __INTERFERE_BUILD_ID__: string | null;
|
|
6
|
+
readonly __INTERFERE_RELEASE_ID__: string | null;
|
|
7
|
+
}
|
|
8
|
+
interface ConfigureBuildInput {
|
|
9
|
+
readonly existingWebpack: NextConfig["webpack"] | undefined;
|
|
10
|
+
readonly existingTurbopack: NextConfig["turbopack"] | undefined;
|
|
11
|
+
readonly projectDir: string;
|
|
12
|
+
readonly values: InterfereInjectedValues;
|
|
13
|
+
}
|
|
14
|
+
interface ConfigureBuildOutput {
|
|
15
|
+
readonly webpack: NextConfig["webpack"] | undefined;
|
|
16
|
+
readonly turbopack: NextConfig["turbopack"] | undefined;
|
|
17
|
+
}
|
|
18
|
+
declare function configureBuild({
|
|
19
|
+
existingWebpack,
|
|
20
|
+
existingTurbopack,
|
|
21
|
+
projectDir,
|
|
22
|
+
values
|
|
23
|
+
}: ConfigureBuildInput): ConfigureBuildOutput;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { InterfereInjectedValues, configureBuild };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-build.d.mts","names":[],"sources":["../../../src/internal/build/configure-build.ts"],"mappings":";;;UAKiB,uBAAA;EAAA,SACN,sBAAA;EAAA,SACA,wBAAA;AAAA;AAAA,UAqBD,mBAAA;EAAA,SACC,eAAA,EAAiB,UAAA;EAAA,SACjB,iBAAA,EAAmB,UAAA;EAAA,SACnB,UAAA;EAAA,SACA,MAAA,EAAQ,uBAAA;AAAA;AAAA,UAGT,oBAAA;EAAA,SACC,OAAA,EAAS,UAAA;EAAA,SACT,SAAA,EAAW,UAAA;AAAA;AAAA,iBAGN,cAAA,CAAA;EACd,eAAA;EACA,iBAAA;EACA,UAAA;EACA;AAAA,GACC,mBAAA,GAAsB,oBAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { basename, dirname, join, normalize, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
//#region src/internal/build/configure-build.ts
|
|
5
|
+
const INSTRUMENTATION_CLIENT_FILES = [
|
|
6
|
+
"instrumentation-client.ts",
|
|
7
|
+
"instrumentation-client.tsx",
|
|
8
|
+
"instrumentation-client.js",
|
|
9
|
+
"instrumentation-client.jsx",
|
|
10
|
+
"src/instrumentation-client.ts",
|
|
11
|
+
"src/instrumentation-client.tsx",
|
|
12
|
+
"src/instrumentation-client.js",
|
|
13
|
+
"src/instrumentation-client.jsx"
|
|
14
|
+
];
|
|
15
|
+
const LOADER_FILE_CANDIDATES = [
|
|
16
|
+
"value-injection-loader.ts",
|
|
17
|
+
"value-injection-loader.js",
|
|
18
|
+
"value-injection-loader.mjs",
|
|
19
|
+
"value-injection-loader.cjs"
|
|
20
|
+
];
|
|
21
|
+
function configureBuild({ existingWebpack, existingTurbopack, projectDir, values }) {
|
|
22
|
+
const instrumentationClientPath = resolveInstrumentationClientPath(projectDir);
|
|
23
|
+
return {
|
|
24
|
+
webpack: buildWebpackHook(existingWebpack, instrumentationClientPath, values),
|
|
25
|
+
turbopack: buildTurbopackConfig(existingTurbopack, instrumentationClientPath, values)
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function hasInjectedMetadata(metadata) {
|
|
29
|
+
return metadata.__INTERFERE_BUILD_ID__ !== null || metadata.__INTERFERE_RELEASE_ID__ !== null;
|
|
30
|
+
}
|
|
31
|
+
function buildWebpackHook(existingWebpack, instrumentationClientPath, values) {
|
|
32
|
+
if (!(instrumentationClientPath && hasInjectedMetadata(values))) return existingWebpack;
|
|
33
|
+
const normalizedPath = normalize(instrumentationClientPath);
|
|
34
|
+
const loaderPath = resolveLoaderPath();
|
|
35
|
+
return (webpackConfig, options) => {
|
|
36
|
+
const outputConfig = existingWebpack ? existingWebpack(webpackConfig, options) : webpackConfig;
|
|
37
|
+
const mutableConfig = outputConfig;
|
|
38
|
+
const injectionRule = {
|
|
39
|
+
test: (resource) => Boolean(resource) && normalize(resource) === normalizedPath,
|
|
40
|
+
use: [{
|
|
41
|
+
loader: loaderPath,
|
|
42
|
+
options: { values }
|
|
43
|
+
}]
|
|
44
|
+
};
|
|
45
|
+
mutableConfig.module ??= {};
|
|
46
|
+
mutableConfig.module.rules ??= [];
|
|
47
|
+
mutableConfig.module.rules.push(injectionRule);
|
|
48
|
+
return outputConfig;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function buildTurbopackConfig(existingTurbopack, instrumentationClientPath, values) {
|
|
52
|
+
if (!(instrumentationClientPath && hasInjectedMetadata(values))) return existingTurbopack;
|
|
53
|
+
const baseConfig = existingTurbopack ?? {};
|
|
54
|
+
const ruleKey = `**/${basename(instrumentationClientPath)}`;
|
|
55
|
+
const existingRule = baseConfig.rules?.[ruleKey] ?? {};
|
|
56
|
+
const existingLoaders = Array.isArray(existingRule.loaders) ? existingRule.loaders : [];
|
|
57
|
+
return {
|
|
58
|
+
...baseConfig,
|
|
59
|
+
rules: {
|
|
60
|
+
...baseConfig.rules,
|
|
61
|
+
[ruleKey]: {
|
|
62
|
+
...existingRule,
|
|
63
|
+
loaders: [...existingLoaders, {
|
|
64
|
+
loader: resolveLoaderPath(),
|
|
65
|
+
options: { serializedValues: JSON.stringify(values) }
|
|
66
|
+
}]
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function resolveInstrumentationClientPath(projectDir) {
|
|
72
|
+
for (const candidate of INSTRUMENTATION_CLIENT_FILES) {
|
|
73
|
+
const filePath = resolve(projectDir, candidate);
|
|
74
|
+
if (existsSync(filePath)) return filePath;
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
function resolveLoaderPath() {
|
|
79
|
+
const directory = resolve(dirname(fileURLToPath(import.meta.url)));
|
|
80
|
+
for (const candidate of LOADER_FILE_CANDIDATES) {
|
|
81
|
+
const filePath = join(directory, candidate);
|
|
82
|
+
if (existsSync(filePath)) return filePath;
|
|
83
|
+
}
|
|
84
|
+
return join(directory, "value-injection-loader.js");
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { configureBuild };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-build.mjs","names":[],"sources":["../../../src/internal/build/configure-build.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { basename, dirname, join, normalize, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { NextConfig } from \"next\";\n\nexport interface InterfereInjectedValues {\n readonly __INTERFERE_BUILD_ID__: string | null;\n readonly __INTERFERE_RELEASE_ID__: string | null;\n}\n\nconst INSTRUMENTATION_CLIENT_FILES = [\n \"instrumentation-client.ts\",\n \"instrumentation-client.tsx\",\n \"instrumentation-client.js\",\n \"instrumentation-client.jsx\",\n \"src/instrumentation-client.ts\",\n \"src/instrumentation-client.tsx\",\n \"src/instrumentation-client.js\",\n \"src/instrumentation-client.jsx\",\n] as const;\n\nconst LOADER_FILE_CANDIDATES = [\n \"value-injection-loader.ts\",\n \"value-injection-loader.js\",\n \"value-injection-loader.mjs\",\n \"value-injection-loader.cjs\",\n] as const;\n\ninterface ConfigureBuildInput {\n readonly existingWebpack: NextConfig[\"webpack\"] | undefined;\n readonly existingTurbopack: NextConfig[\"turbopack\"] | undefined;\n readonly projectDir: string;\n readonly values: InterfereInjectedValues;\n}\n\ninterface ConfigureBuildOutput {\n readonly webpack: NextConfig[\"webpack\"] | undefined;\n readonly turbopack: NextConfig[\"turbopack\"] | undefined;\n}\n\nexport function configureBuild({\n existingWebpack,\n existingTurbopack,\n projectDir,\n values,\n}: ConfigureBuildInput): ConfigureBuildOutput {\n const instrumentationClientPath = resolveInstrumentationClientPath(projectDir);\n\n return {\n webpack: buildWebpackHook(existingWebpack, instrumentationClientPath, values),\n turbopack: buildTurbopackConfig(\n existingTurbopack,\n instrumentationClientPath,\n values\n ),\n };\n}\n\nfunction hasInjectedMetadata(metadata: InterfereInjectedValues): boolean {\n return (\n metadata.__INTERFERE_BUILD_ID__ !== null ||\n metadata.__INTERFERE_RELEASE_ID__ !== null\n );\n}\n\nfunction buildWebpackHook(\n existingWebpack: NextConfig[\"webpack\"] | undefined,\n instrumentationClientPath: string | null,\n values: InterfereInjectedValues\n): NextConfig[\"webpack\"] | undefined {\n if (!(instrumentationClientPath && hasInjectedMetadata(values))) {\n return existingWebpack;\n }\n\n const normalizedPath = normalize(instrumentationClientPath);\n const loaderPath = resolveLoaderPath();\n\n return (webpackConfig, options) => {\n const outputConfig = existingWebpack\n ? existingWebpack(webpackConfig, options)\n : webpackConfig;\n const mutableConfig = outputConfig as {\n module?: { rules?: unknown[] };\n };\n\n const injectionRule = {\n test: (resource: string): boolean =>\n Boolean(resource) && normalize(resource) === normalizedPath,\n use: [\n {\n loader: loaderPath,\n options: { values },\n },\n ],\n };\n\n mutableConfig.module ??= {};\n mutableConfig.module.rules ??= [];\n mutableConfig.module.rules.push(injectionRule);\n\n return outputConfig;\n };\n}\n\nfunction buildTurbopackConfig(\n existingTurbopack: NextConfig[\"turbopack\"] | undefined,\n instrumentationClientPath: string | null,\n values: InterfereInjectedValues\n): NextConfig[\"turbopack\"] | undefined {\n if (!(instrumentationClientPath && hasInjectedMetadata(values))) {\n return existingTurbopack;\n }\n\n const baseConfig = (existingTurbopack ?? {}) as {\n rules?: Record<string, unknown>;\n };\n const ruleKey = `**/${basename(instrumentationClientPath)}`;\n const existingRule = (baseConfig.rules?.[ruleKey] ?? {}) as {\n loaders?: unknown[];\n };\n const existingLoaders = Array.isArray(existingRule.loaders)\n ? existingRule.loaders\n : [];\n\n return {\n ...baseConfig,\n rules: {\n ...baseConfig.rules,\n [ruleKey]: {\n ...existingRule,\n loaders: [\n ...existingLoaders,\n {\n loader: resolveLoaderPath(),\n options: {\n serializedValues: JSON.stringify(values),\n },\n },\n ],\n },\n },\n } as NextConfig[\"turbopack\"];\n}\n\nfunction resolveInstrumentationClientPath(projectDir: string): string | null {\n for (const candidate of INSTRUMENTATION_CLIENT_FILES) {\n const filePath = resolve(projectDir, candidate);\n if (existsSync(filePath)) {\n return filePath;\n }\n }\n\n return null;\n}\n\nfunction resolveLoaderPath(): string {\n const directory = resolve(dirname(fileURLToPath(import.meta.url)));\n\n for (const candidate of LOADER_FILE_CANDIDATES) {\n const filePath = join(directory, candidate);\n if (existsSync(filePath)) {\n return filePath;\n }\n }\n\n return join(directory, \"value-injection-loader.js\");\n}\n"],"mappings":";;;;AAUA,MAAM,+BAA+B;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,yBAAyB;CAC7B;CACA;CACA;CACA;CACD;AAcD,SAAgB,eAAe,EAC7B,iBACA,mBACA,YACA,UAC4C;CAC5C,MAAM,4BAA4B,iCAAiC,WAAW;AAE9E,QAAO;EACL,SAAS,iBAAiB,iBAAiB,2BAA2B,OAAO;EAC7E,WAAW,qBACT,mBACA,2BACA,OACD;EACF;;AAGH,SAAS,oBAAoB,UAA4C;AACvE,QACE,SAAS,2BAA2B,QACpC,SAAS,6BAA6B;;AAI1C,SAAS,iBACP,iBACA,2BACA,QACmC;AACnC,KAAI,EAAE,6BAA6B,oBAAoB,OAAO,EAC5D,QAAO;CAGT,MAAM,iBAAiB,UAAU,0BAA0B;CAC3D,MAAM,aAAa,mBAAmB;AAEtC,SAAQ,eAAe,YAAY;EACjC,MAAM,eAAe,kBACjB,gBAAgB,eAAe,QAAQ,GACvC;EACJ,MAAM,gBAAgB;EAItB,MAAM,gBAAgB;GACpB,OAAO,aACL,QAAQ,SAAS,IAAI,UAAU,SAAS,KAAK;GAC/C,KAAK,CACH;IACE,QAAQ;IACR,SAAS,EAAE,QAAQ;IACpB,CACF;GACF;AAED,gBAAc,WAAW,EAAE;AAC3B,gBAAc,OAAO,UAAU,EAAE;AACjC,gBAAc,OAAO,MAAM,KAAK,cAAc;AAE9C,SAAO;;;AAIX,SAAS,qBACP,mBACA,2BACA,QACqC;AACrC,KAAI,EAAE,6BAA6B,oBAAoB,OAAO,EAC5D,QAAO;CAGT,MAAM,aAAc,qBAAqB,EAAE;CAG3C,MAAM,UAAU,MAAM,SAAS,0BAA0B;CACzD,MAAM,eAAgB,WAAW,QAAQ,YAAY,EAAE;CAGvD,MAAM,kBAAkB,MAAM,QAAQ,aAAa,QAAQ,GACvD,aAAa,UACb,EAAE;AAEN,QAAO;EACL,GAAG;EACH,OAAO;GACL,GAAG,WAAW;IACb,UAAU;IACT,GAAG;IACH,SAAS,CACP,GAAG,iBACH;KACE,QAAQ,mBAAmB;KAC3B,SAAS,EACP,kBAAkB,KAAK,UAAU,OAAO,EACzC;KACF,CACF;IACF;GACF;EACF;;AAGH,SAAS,iCAAiC,YAAmC;AAC3E,MAAK,MAAM,aAAa,8BAA8B;EACpD,MAAM,WAAW,QAAQ,YAAY,UAAU;AAC/C,MAAI,WAAW,SAAS,CACtB,QAAO;;AAIX,QAAO;;AAGT,SAAS,oBAA4B;CACnC,MAAM,YAAY,QAAQ,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC,CAAC;AAElE,MAAK,MAAM,aAAa,wBAAwB;EAC9C,MAAM,WAAW,KAAK,WAAW,UAAU;AAC3C,MAAI,WAAW,SAAS,CACtB,QAAO;;AAIX,QAAO,KAAK,WAAW,4BAA4B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ProductionCompileContext, ResolvedBuildConfig } from "../../config.mjs";
|
|
2
|
+
import * as _interfere_sdk_models_releases_create_release_response_js0 from "@interfere/sdk/models/releases-create-release-response.js";
|
|
3
|
+
import { ReleasesConfigResponse } from "@interfere/sdk/models/releases-config-response.js";
|
|
4
|
+
import { CreateReleaseResponse } from "@interfere/types/releases/definition";
|
|
5
|
+
|
|
6
|
+
//#region src/internal/build/pipeline.d.ts
|
|
7
|
+
interface BuildTiming {
|
|
8
|
+
discover: number;
|
|
9
|
+
createRelease: number;
|
|
10
|
+
upload: number;
|
|
11
|
+
cleanup: number;
|
|
12
|
+
total: number;
|
|
13
|
+
fileCount: number;
|
|
14
|
+
totalBytes: number;
|
|
15
|
+
}
|
|
16
|
+
type PipelineResult = {
|
|
17
|
+
ready: false;
|
|
18
|
+
reason: "no_source_maps";
|
|
19
|
+
fileCount: 0;
|
|
20
|
+
} | {
|
|
21
|
+
ready: true;
|
|
22
|
+
fileCount: number;
|
|
23
|
+
release: CreateReleaseResponse;
|
|
24
|
+
config: ReleasesConfigResponse;
|
|
25
|
+
buildId: string;
|
|
26
|
+
timing: BuildTiming;
|
|
27
|
+
};
|
|
28
|
+
declare function runBuildPipeline(context: ProductionCompileContext, metadata: ResolvedBuildConfig & {
|
|
29
|
+
apiKey: string;
|
|
30
|
+
buildId: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
ready: boolean;
|
|
33
|
+
reason: string;
|
|
34
|
+
fileCount: number;
|
|
35
|
+
release?: undefined;
|
|
36
|
+
config?: undefined;
|
|
37
|
+
buildId?: undefined;
|
|
38
|
+
timing?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
ready: true;
|
|
41
|
+
fileCount: number;
|
|
42
|
+
release: _interfere_sdk_models_releases_create_release_response_js0.ReleasesCreateReleaseResponse;
|
|
43
|
+
config: ReleasesConfigResponse;
|
|
44
|
+
buildId: string;
|
|
45
|
+
timing: BuildTiming;
|
|
46
|
+
reason?: undefined;
|
|
47
|
+
}>;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { BuildTiming, PipelineResult, runBuildPipeline };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.d.mts","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"mappings":";;;;;;UAaiB,WAAA;EACf,QAAA;EACA,aAAA;EACA,MAAA;EACA,OAAA;EACA,KAAA;EACA,SAAA;EACA,UAAA;AAAA;AAAA,KAGU,cAAA;EACN,KAAA;EAAc,MAAA;EAA0B,SAAA;AAAA;EACxC,KAAA;EAAa,SAAA;EAAmB,OAAA,EAAS,qBAAA;EAAuB,MAAA,EAAQ,sBAAA;EAAwB,OAAA;EAAiB,MAAA,EAAQ,WAAA;AAAA;AAAA,iBAYzG,gBAAA,CACpB,OAAA,EAAS,wBAAA,EACT,QAAA,EAAU,mBAAA;EAAwB,MAAA;EAAgB,OAAA;AAAA,IAAiB,OAAA;;;;;;;;;;;WAAtC,0DAAA,CAAA,6BAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { resolveReleaseRequest } from "./release/index.mjs";
|
|
2
|
+
import { discover, normalizeDistDir } from "./source-maps/discover.mjs";
|
|
3
|
+
import { buildUploadBody, cleanupSourceMaps } from "./source-maps/index.mjs";
|
|
4
|
+
import { HTTPClient, Interfere } from "@interfere/sdk";
|
|
5
|
+
//#region src/internal/build/pipeline.ts
|
|
6
|
+
async function timed(fn) {
|
|
7
|
+
const start = performance.now();
|
|
8
|
+
return [await fn(), Math.round(performance.now() - start)];
|
|
9
|
+
}
|
|
10
|
+
async function fetchSurfaceConfig(sdk) {
|
|
11
|
+
return await sdk.releases.getConfig();
|
|
12
|
+
}
|
|
13
|
+
async function runBuildPipeline(context, metadata) {
|
|
14
|
+
const { apiUrl, apiKey } = metadata;
|
|
15
|
+
const httpClient = new HTTPClient();
|
|
16
|
+
httpClient.addHook("beforeRequest", (request) => {
|
|
17
|
+
const nextRequest = new Request(request);
|
|
18
|
+
nextRequest.headers.set("x-api-key", apiKey);
|
|
19
|
+
return nextRequest;
|
|
20
|
+
});
|
|
21
|
+
const sdk = new Interfere({
|
|
22
|
+
serverURL: apiUrl,
|
|
23
|
+
httpClient
|
|
24
|
+
});
|
|
25
|
+
const start = performance.now();
|
|
26
|
+
const [{ discovered, config }, discoverMs] = await timed(async () => {
|
|
27
|
+
const [discovered, config] = await Promise.all([discover(context.projectDir, normalizeDistDir(context.distDir)), fetchSurfaceConfig(sdk)]);
|
|
28
|
+
return {
|
|
29
|
+
discovered,
|
|
30
|
+
config
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
if (discovered.files.length === 0) return {
|
|
34
|
+
ready: false,
|
|
35
|
+
reason: "no_source_maps",
|
|
36
|
+
fileCount: 0
|
|
37
|
+
};
|
|
38
|
+
const releaseRequest = resolveReleaseRequest(metadata.buildId, config);
|
|
39
|
+
const [release, createReleaseMs] = await timed(() => sdk.releases.create(releaseRequest));
|
|
40
|
+
const releaseSlug = release.destination.slug;
|
|
41
|
+
const buildId = release.build.hash ?? metadata.buildId;
|
|
42
|
+
const { body, totalBytes } = buildUploadBody(discovered);
|
|
43
|
+
const [, uploadMs] = await timed(() => sdk.sourceMaps.uploadMultipart({
|
|
44
|
+
releaseSlug,
|
|
45
|
+
body
|
|
46
|
+
}));
|
|
47
|
+
const [, cleanupMs] = await timed(() => cleanupSourceMaps(discovered.files));
|
|
48
|
+
const timing = {
|
|
49
|
+
discover: discoverMs,
|
|
50
|
+
createRelease: createReleaseMs,
|
|
51
|
+
upload: uploadMs,
|
|
52
|
+
cleanup: cleanupMs,
|
|
53
|
+
total: Math.round(performance.now() - start),
|
|
54
|
+
fileCount: discovered.files.length,
|
|
55
|
+
totalBytes
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
ready: true,
|
|
59
|
+
fileCount: discovered.files.length,
|
|
60
|
+
release,
|
|
61
|
+
config,
|
|
62
|
+
buildId,
|
|
63
|
+
timing
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { runBuildPipeline };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline.mjs","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"sourcesContent":["import { HTTPClient, Interfere } from \"@interfere/sdk\";\n\nimport { resolveReleaseRequest } from \"./release/index.js\";\nimport {\n buildUploadBody,\n cleanupSourceMaps,\n discover,\n normalizeDistDir,\n} from \"./source-maps/index.js\";\nimport type { ProductionCompileContext, ResolvedBuildConfig } from \"../../config.js\";\nimport type { ReleasesConfigResponse } from \"@interfere/sdk/models/releases-config-response.js\";\nimport type { CreateReleaseResponse } from \"@interfere/types/releases/definition\";\n\nexport interface BuildTiming {\n discover: number;\n createRelease: number;\n upload: number;\n cleanup: number;\n total: number;\n fileCount: number;\n totalBytes: number;\n}\n\nexport type PipelineResult =\n | { ready: false; reason: \"no_source_maps\"; fileCount: 0 }\n | { ready: true; fileCount: number; release: CreateReleaseResponse; config: ReleasesConfigResponse; buildId: string; timing: BuildTiming };\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\nasync function fetchSurfaceConfig(sdk: Interfere) {\n return await sdk.releases.getConfig();\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\nhttpClient.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\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 fetchSurfaceConfig(sdk),\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\n const releaseRequest = resolveReleaseRequest(\n metadata.buildId,\n config,\n );\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 const [, cleanupMs] = await timed(() => cleanupSourceMaps(discovered.files));\n\n const timing: BuildTiming = {\n discover: discoverMs,\n createRelease: createReleaseMs,\n upload: uploadMs,\n cleanup: cleanupMs,\n total: Math.round(performance.now() - start),\n fileCount: discovered.files.length,\n totalBytes,\n };\n\n return { ready: true, fileCount: discovered.files.length, release, config, buildId, timing } satisfies PipelineResult;\n}\n"],"mappings":";;;;;AA2BA,eAAe,MAAS,IAA4C;CAClE,MAAM,QAAQ,YAAY,KAAK;AAE/B,QAAO,CADQ,MAAM,IAAI,EACT,KAAK,MAAM,YAAY,KAAK,GAAG,MAAM,CAAC;;AAGxD,eAAe,mBAAmB,KAAgB;AAChD,QAAO,MAAM,IAAI,SAAS,WAAW;;AAGvC,eAAsB,iBACpB,SACA,UACA;CACA,MAAM,EAAE,QAAQ,WAAW;CAE3B,MAAM,aAAa,IAAI,YAAY;AAErC,YAAW,QAAQ,kBAAkB,YAAY;EAC/C,MAAM,cAAc,IAAI,QAAQ,QAAQ;AAExC,cAAY,QAAQ,IAAI,aAAa,OAAO;AAE5C,SAAO;GACP;CAEA,MAAM,MAAM,IAAI,UAAU;EAAE,WAAW;EAAQ;EAAY,CAAC;CAG5D,MAAM,QAAQ,YAAY,KAAK;CAE/B,MAAM,CAAC,EAAE,YAAY,UAAU,cAAc,MAAM,MAAM,YAAY;EACnE,MAAM,CAAC,YAAY,UAAU,MAAM,QAAQ,IAAI,CAC7C,SAAS,QAAQ,YAAY,iBAAiB,QAAQ,QAAQ,CAAC,EAC/D,mBAAmB,IAAI,CACxB,CAAC;AACF,SAAO;GAAE;GAAY;GAAQ;GAC7B;AAEF,KAAI,WAAW,MAAM,WAAW,EAC9B,QAAO;EAAE,OAAO;EAAO,QAAQ;EAAkB,WAAW;EAAG;CAIjE,MAAM,iBAAiB,sBACrB,SAAS,SACT,OACD;CAED,MAAM,CAAC,SAAS,mBAAmB,MAAM,YACvC,IAAI,SAAS,OAAO,eAAe,CACpC;CAED,MAAM,cAAc,QAAQ,YAAY;CACxC,MAAM,UAAU,QAAQ,MAAM,QAAQ,SAAS;CAE/C,MAAM,EAAE,MAAM,eAAe,gBAAgB,WAAW;CAExD,MAAM,GAAG,YAAY,MAAM,YACzB,IAAI,WAAW,gBAAgB;EAAE;EAAa;EAAM,CAAC,CACtD;CAED,MAAM,GAAG,aAAa,MAAM,YAAY,kBAAkB,WAAW,MAAM,CAAC;CAE5E,MAAM,SAAsB;EAC1B,UAAU;EACV,eAAe;EACf,QAAQ;EACR,SAAS;EACT,OAAO,KAAK,MAAM,YAAY,KAAK,GAAG,MAAM;EAC5C,WAAW,WAAW,MAAM;EAC5B;EACD;AAED,QAAO;EAAE,OAAO;EAAM,WAAW,WAAW,MAAM;EAAQ;EAAS;EAAQ;EAAS;EAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel.d.mts","names":[],"sources":["../../../../../src/internal/build/release/destinations/vercel.ts"],"mappings":";;;iBAGgB,OAAA,CAAA,GAAW,0BAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { __exportAll } from "../../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { parseEnvValue } from "@interfere/types/sdk/env";
|
|
3
|
+
//#region src/internal/build/release/destinations/vercel.ts
|
|
4
|
+
var vercel_exports = /* @__PURE__ */ __exportAll({ resolve: () => resolve });
|
|
5
|
+
function resolve() {
|
|
6
|
+
const environment = parseEnvValue(process.env.VERCEL_ENV ?? process.env.VERCEL_TARGET_ENV);
|
|
7
|
+
const deploymentId = parseEnvValue(process.env.VERCEL_DEPLOYMENT_ID);
|
|
8
|
+
return {
|
|
9
|
+
provider: "vercel",
|
|
10
|
+
destinationReleaseId: deploymentId,
|
|
11
|
+
environment,
|
|
12
|
+
deploymentId,
|
|
13
|
+
deploymentUrl: resolveDeploymentUrl(),
|
|
14
|
+
environmentName: environment,
|
|
15
|
+
environmentTarget: environment
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function resolveDeploymentUrl() {
|
|
19
|
+
const deploymentUrl = parseEnvValue(process.env.VERCEL_URL);
|
|
20
|
+
if (deploymentUrl === null) return null;
|
|
21
|
+
if (deploymentUrl.startsWith("https://") || deploymentUrl.startsWith("http://")) return deploymentUrl;
|
|
22
|
+
return `https://${deploymentUrl}`;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { resolve, vercel_exports };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercel.mjs","names":[],"sources":["../../../../../src/internal/build/release/destinations/vercel.ts"],"sourcesContent":["import type { ReleaseDestinationMetadata } from \"@interfere/types/integrations\";\nimport { parseEnvValue } from \"@interfere/types/sdk/env\";\n\nexport function resolve(): ReleaseDestinationMetadata {\n const environment = parseEnvValue(\n process.env.VERCEL_ENV ?? process.env.VERCEL_TARGET_ENV,\n );\n\n const deploymentId = parseEnvValue(process.env.VERCEL_DEPLOYMENT_ID);\n\n return {\n provider: \"vercel\",\n destinationReleaseId: deploymentId,\n environment,\n deploymentId,\n deploymentUrl: resolveDeploymentUrl(),\n environmentName: environment,\n environmentTarget: environment,\n };\n}\n\nfunction resolveDeploymentUrl(): string | null {\n const deploymentUrl = parseEnvValue(process.env.VERCEL_URL);\n\n if (deploymentUrl === null) {\n return null;\n }\n\n if (\n deploymentUrl.startsWith(\"https://\") ||\n deploymentUrl.startsWith(\"http://\")\n ) {\n return deploymentUrl;\n }\n\n return `https://${deploymentUrl}`;\n}\n"],"mappings":";;;;AAGA,SAAgB,UAAsC;CACpD,MAAM,cAAc,cAClB,QAAQ,IAAI,cAAc,QAAQ,IAAI,kBACvC;CAED,MAAM,eAAe,cAAc,QAAQ,IAAI,qBAAqB;AAEpE,QAAO;EACL,UAAU;EACV,sBAAsB;EACtB;EACA;EACA,eAAe,sBAAsB;EACrC,iBAAiB;EACjB,mBAAmB;EACpB;;AAGH,SAAS,uBAAsC;CAC7C,MAAM,gBAAgB,cAAc,QAAQ,IAAI,WAAW;AAE3D,KAAI,kBAAkB,KACpB,QAAO;AAGT,KACE,cAAc,WAAW,WAAW,IACpC,cAAc,WAAW,UAAU,CAEnC,QAAO;AAGT,QAAO,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.mts","names":[],"sources":["../../../../src/internal/build/release/git.ts"],"mappings":";iBAIgB,aAAA,CAAc,OAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { log } from "../../logger.mjs";
|
|
2
|
+
import { execSync } from "node:child_process";
|
|
3
|
+
//#region src/internal/build/release/git.ts
|
|
4
|
+
function runGitCommand(command) {
|
|
5
|
+
try {
|
|
6
|
+
const output = execSync(command, {
|
|
7
|
+
encoding: "utf8",
|
|
8
|
+
stdio: [
|
|
9
|
+
"ignore",
|
|
10
|
+
"pipe",
|
|
11
|
+
"ignore"
|
|
12
|
+
]
|
|
13
|
+
}).trim();
|
|
14
|
+
return output.length > 0 ? output : null;
|
|
15
|
+
} catch {
|
|
16
|
+
log.warn("Git unavailable", [`Failed: ${command}`]);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { runGitCommand };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.mjs","names":[],"sources":["../../../../src/internal/build/release/git.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\n\nimport { log } from \"../../logger.js\";\n\nexport function runGitCommand(command: string): string | null {\n try {\n const output = execSync(command, {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n }).trim();\n\n return output.length > 0 ? output : null;\n } catch {\n log.warn(\"Git unavailable\", [`Failed: ${command}`]);\n return null;\n }\n}\n"],"mappings":";;;AAIA,SAAgB,cAAc,SAAgC;AAC5D,KAAI;EACF,MAAM,SAAS,SAAS,SAAS;GAC/B,UAAU;GACV,OAAO;IAAC;IAAU;IAAQ;IAAS;GACpC,CAAC,CAAC,MAAM;AAET,SAAO,OAAO,SAAS,IAAI,SAAS;SAC9B;AACN,MAAI,KAAK,mBAAmB,CAAC,WAAW,UAAU,CAAC;AACnD,SAAO"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { runGitCommand } from "./git.mjs";
|
|
2
|
+
import { ReleasesConfigResponse } from "@interfere/sdk/models/releases-config-response.js";
|
|
3
|
+
import { CreateReleaseRequest } from "@interfere/types/releases/definition";
|
|
4
|
+
|
|
5
|
+
//#region src/internal/build/release/index.d.ts
|
|
6
|
+
declare function resolveReleaseRequest(buildId: string, config: ReleasesConfigResponse): CreateReleaseRequest;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { resolveReleaseRequest, runGitCommand };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/internal/build/release/index.ts"],"mappings":";;;;;iBA4BgB,qBAAA,CACd,OAAA,UACA,MAAA,EAAQ,sBAAA,GACP,oBAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { log } from "../../logger.mjs";
|
|
2
|
+
import { runGitCommand } from "./git.mjs";
|
|
3
|
+
import { PRODUCER_VERSION } from "../../version.mjs";
|
|
4
|
+
import { vercel_exports } from "./destinations/vercel.mjs";
|
|
5
|
+
import { github_exports } from "./sources/github.mjs";
|
|
6
|
+
//#region src/internal/build/release/index.ts
|
|
7
|
+
const sources = { github: github_exports };
|
|
8
|
+
const destinations = { vercel: vercel_exports };
|
|
9
|
+
function resolveReleaseRequest(buildId, config) {
|
|
10
|
+
if (!config.surface.sourceProvider) return log.fatal("Missing version control provider", ["This surface does not have a version control provider configured.", `Configure one at https://interfere.com/~/${config.org.slug}/surfaces/${config.surface.slug}`]);
|
|
11
|
+
if (!config.surface.destinationProvider) return log.fatal("Missing deployment target", ["This surface does not have a deployment target integration configured.", `Configure one at https://interfere.com/~/${config.org.slug}/surfaces/${config.surface.slug}`]);
|
|
12
|
+
return {
|
|
13
|
+
source: sources[config.surface.sourceProvider].resolve(),
|
|
14
|
+
destination: destinations[config.surface.destinationProvider].resolve(),
|
|
15
|
+
buildId,
|
|
16
|
+
producerVersion: PRODUCER_VERSION
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { resolveReleaseRequest, runGitCommand };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/internal/build/release/index.ts"],"sourcesContent":["import type {\n DestinationProvider,\n ReleaseDestinationMetadata,\n ReleaseSourceMetadata,\n SourceProvider,\n} from \"@interfere/types/integrations\";\n\nimport * as vercel from \"./destinations/vercel.js\";\nimport * as github from \"./sources/github.js\";\nimport type { CreateReleaseRequest } from \"@interfere/types/releases/definition\";\nimport type { ReleasesConfigResponse } from \"@interfere/sdk/models/releases-config-response.js\";\nimport { log } from \"../../logger.js\";\nimport { PRODUCER_VERSION } from \"../../version.js\";\n\nexport { runGitCommand } from \"./git.js\";\n\ninterface Resolver<T> {\n resolve(): T;\n}\n\nconst sources: Record<SourceProvider, Resolver<ReleaseSourceMetadata>> = {\n github,\n};\n\nconst destinations: Record<DestinationProvider, Resolver<ReleaseDestinationMetadata>> = {\n vercel,\n};\n\nexport function resolveReleaseRequest(\n buildId: string,\n config: ReleasesConfigResponse\n): CreateReleaseRequest {\n if (!config.surface.sourceProvider) {\n return log.fatal(\"Missing version control provider\", [\n \"This surface does not have a version control provider configured.\",\n `Configure one at https://interfere.com/~/${config.org.slug}/surfaces/${config.surface.slug}`,\n ]);\n }\n\n if (!config.surface.destinationProvider) {\n return log.fatal(\"Missing deployment target\", [\n \"This surface does not have a deployment target integration configured.\",\n `Configure one at https://interfere.com/~/${config.org.slug}/surfaces/${config.surface.slug}`,\n ]);\n }\n\n return {\n source: sources[config.surface.sourceProvider].resolve(),\n destination: destinations[config.surface.destinationProvider].resolve(),\n buildId,\n producerVersion: PRODUCER_VERSION,\n };\n}\n"],"mappings":";;;;;;AAoBA,MAAM,UAAmE,EACvE,QAAA,gBACD;AAED,MAAM,eAAkF,EACtF,QAAA,gBACD;AAED,SAAgB,sBACd,SACA,QACsB;AACtB,KAAI,CAAC,OAAO,QAAQ,eAClB,QAAO,IAAI,MAAM,oCAAoC,CACnD,qEACA,4CAA4C,OAAO,IAAI,KAAK,YAAY,OAAO,QAAQ,OACxF,CAAC;AAGJ,KAAI,CAAC,OAAO,QAAQ,oBAClB,QAAO,IAAI,MAAM,6BAA6B,CAC5C,0EACA,4CAA4C,OAAO,IAAI,KAAK,YAAY,OAAO,QAAQ,OACxF,CAAC;AAGJ,QAAO;EACL,QAAQ,QAAQ,OAAO,QAAQ,gBAAgB,SAAS;EACxD,aAAa,aAAa,OAAO,QAAQ,qBAAqB,SAAS;EACvE;EACA,iBAAiB;EAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.d.mts","names":[],"sources":["../../../../../src/internal/build/release/sources/github.ts"],"mappings":";;;iBAKgB,OAAA,CAAA,GAAW,qBAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __exportAll } from "../../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { runGitCommand } from "../git.mjs";
|
|
3
|
+
import { parseEnvValue } from "@interfere/types/sdk/env";
|
|
4
|
+
//#region src/internal/build/release/sources/github.ts
|
|
5
|
+
var github_exports = /* @__PURE__ */ __exportAll({ resolve: () => resolve });
|
|
6
|
+
function resolve() {
|
|
7
|
+
return {
|
|
8
|
+
provider: "github",
|
|
9
|
+
branch: parseEnvValue(process.env.VERCEL_GIT_COMMIT_REF) ?? parseEnvValue(process.env.GITHUB_REF_NAME) ?? parseEnvValue(process.env.GITHUB_HEAD_REF) ?? runGitCommand("git rev-parse --abbrev-ref HEAD") ?? "unknown",
|
|
10
|
+
commitMessage: parseEnvValue(process.env.VERCEL_GIT_COMMIT_MESSAGE) ?? runGitCommand("git log -1 --pretty=%B") ?? "",
|
|
11
|
+
commitSha: parseEnvValue(process.env.VERCEL_GIT_COMMIT_SHA) ?? parseEnvValue(process.env.GITHUB_SHA) ?? runGitCommand("git rev-parse HEAD")
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { github_exports, resolve };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.mjs","names":[],"sources":["../../../../../src/internal/build/release/sources/github.ts"],"sourcesContent":["import type { ReleaseSourceMetadata } from \"@interfere/types/integrations\";\nimport { parseEnvValue } from \"@interfere/types/sdk/env\";\n\nimport { runGitCommand } from \"../git.js\";\n\nexport function resolve(): ReleaseSourceMetadata {\n return {\n provider: \"github\",\n branch:\n parseEnvValue(process.env.VERCEL_GIT_COMMIT_REF) ??\n parseEnvValue(process.env.GITHUB_REF_NAME) ??\n parseEnvValue(process.env.GITHUB_HEAD_REF) ??\n runGitCommand(\"git rev-parse --abbrev-ref HEAD\") ??\n \"unknown\",\n commitMessage:\n parseEnvValue(process.env.VERCEL_GIT_COMMIT_MESSAGE) ??\n runGitCommand(\"git log -1 --pretty=%B\") ??\n \"\",\n commitSha:\n parseEnvValue(process.env.VERCEL_GIT_COMMIT_SHA) ??\n parseEnvValue(process.env.GITHUB_SHA) ??\n runGitCommand(\"git rev-parse HEAD\"),\n };\n}\n"],"mappings":";;;;;AAKA,SAAgB,UAAiC;AAC/C,QAAO;EACL,UAAU;EACV,QACE,cAAc,QAAQ,IAAI,sBAAsB,IAChD,cAAc,QAAQ,IAAI,gBAAgB,IAC1C,cAAc,QAAQ,IAAI,gBAAgB,IAC1C,cAAc,kCAAkC,IAChD;EACF,eACE,cAAc,QAAQ,IAAI,0BAA0B,IACpD,cAAc,yBAAyB,IACvC;EACF,WACE,cAAc,QAAQ,IAAI,sBAAsB,IAChD,cAAc,QAAQ,IAAI,WAAW,IACrC,cAAc,qBAAqB;EACtC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/internal/build/source-maps/discover.d.ts
|
|
2
|
+
type SourceMapFile = {
|
|
3
|
+
readonly absolute: string;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly content: string;
|
|
6
|
+
readonly hash: string;
|
|
7
|
+
};
|
|
8
|
+
declare function discover(projectDir: string, distDir: string): Promise<{
|
|
9
|
+
files: SourceMapFile[];
|
|
10
|
+
mapping: Record<string, string>;
|
|
11
|
+
sourceFileCount: number;
|
|
12
|
+
}>;
|
|
13
|
+
declare function normalizeDistDir(distDir?: string): string;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { SourceMapFile, discover, normalizeDistDir };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.mts","names":[],"sources":["../../../../src/internal/build/source-maps/discover.ts"],"mappings":";KAMY,aAAA;EAAA,SACD,QAAA;EAAA,SACA,IAAA;EAAA,SACA,OAAA;EAAA,SACA,IAAA;AAAA;AAAA,iBAgBW,QAAA,CAAS,UAAA,UAAoB,OAAA,WAAe,OAAA;;;;;iBAsDlD,gBAAA,CAAiB,OAAA"}
|