@interfere/next 9.0.2 → 10.0.1-canary.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/README.md +39 -6
- package/dist/config.d.mts +25 -5
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +1 -100
- package/dist/config.mjs.map +1 -1
- package/dist/instrument-client.d.mts +11 -3
- package/dist/instrument-client.d.mts.map +1 -1
- package/dist/instrument-client.mjs +1 -11
- package/dist/instrument-client.mjs.map +1 -1
- package/dist/instrumentation-client.d.mts +1 -0
- package/dist/instrumentation-client.mjs +1 -0
- package/dist/instrumentation-client.mjs.map +1 -0
- package/dist/instrumentation.d.mts +134 -0
- package/dist/instrumentation.d.mts.map +1 -0
- package/dist/instrumentation.edge.d.mts +35 -0
- package/dist/instrumentation.edge.d.mts.map +1 -0
- package/dist/instrumentation.edge.mjs +1 -0
- package/dist/instrumentation.edge.mjs.map +1 -0
- package/dist/instrumentation.mjs +1 -0
- package/dist/instrumentation.mjs.map +1 -0
- package/dist/internal/build/configure-build.d.mts +3 -2
- package/dist/internal/build/configure-build.d.mts.map +1 -1
- package/dist/internal/build/configure-build.mjs +1 -87
- package/dist/internal/build/configure-build.mjs.map +1 -1
- package/dist/internal/build/detect-bundler.d.mts +7 -0
- package/dist/internal/build/detect-bundler.d.mts.map +1 -0
- package/dist/internal/build/detect-bundler.mjs +1 -0
- package/dist/internal/build/detect-bundler.mjs.map +1 -0
- package/dist/internal/build/pipeline.d.mts +13 -2
- package/dist/internal/build/pipeline.d.mts.map +1 -1
- package/dist/internal/build/pipeline.mjs +1 -66
- package/dist/internal/build/pipeline.mjs.map +1 -1
- package/dist/internal/build/release/destinations/index.d.mts +14 -0
- package/dist/internal/build/release/destinations/index.d.mts.map +1 -0
- package/dist/internal/build/release/destinations/index.mjs +1 -0
- package/dist/internal/build/release/destinations/index.mjs.map +1 -0
- package/dist/internal/build/release/destinations/vercel.d.mts.map +1 -1
- package/dist/internal/build/release/destinations/vercel.mjs +1 -23
- package/dist/internal/build/release/destinations/vercel.mjs.map +1 -1
- package/dist/internal/build/release/git.d.mts +13 -0
- package/dist/internal/build/release/git.d.mts.map +1 -1
- package/dist/internal/build/release/git.mjs +1 -21
- package/dist/internal/build/release/git.mjs.map +1 -1
- package/dist/internal/build/release/index.d.mts +2 -1
- package/dist/internal/build/release/index.d.mts.map +1 -1
- package/dist/internal/build/release/index.mjs +1 -19
- package/dist/internal/build/release/index.mjs.map +1 -1
- package/dist/internal/build/release/sources/github.d.mts.map +1 -1
- package/dist/internal/build/release/sources/github.mjs +1 -13
- package/dist/internal/build/release/sources/github.mjs.map +1 -1
- package/dist/internal/build/release/sources/index.d.mts +21 -0
- package/dist/internal/build/release/sources/index.d.mts.map +1 -0
- package/dist/internal/build/release/sources/index.mjs +1 -0
- package/dist/internal/build/release/sources/index.mjs.map +1 -0
- package/dist/internal/build/source-maps/discover-turbopack.d.mts +32 -0
- package/dist/internal/build/source-maps/discover-turbopack.d.mts.map +1 -0
- package/dist/internal/build/source-maps/discover-turbopack.mjs +1 -0
- package/dist/internal/build/source-maps/discover-turbopack.mjs.map +1 -0
- package/dist/internal/build/source-maps/discover-webpack.d.mts +53 -0
- package/dist/internal/build/source-maps/discover-webpack.d.mts.map +1 -0
- package/dist/internal/build/source-maps/discover-webpack.mjs +1 -0
- package/dist/internal/build/source-maps/discover-webpack.mjs.map +1 -0
- package/dist/internal/build/source-maps/discover.d.mts +28 -10
- package/dist/internal/build/source-maps/discover.d.mts.map +1 -1
- package/dist/internal/build/source-maps/discover.mjs +1 -87
- package/dist/internal/build/source-maps/discover.mjs.map +1 -1
- package/dist/internal/build/source-maps/index.d.mts +2 -24
- package/dist/internal/build/source-maps/index.d.mts.map +1 -1
- package/dist/internal/build/source-maps/index.mjs +1 -28
- package/dist/internal/build/source-maps/index.mjs.map +1 -1
- package/dist/internal/build/source-maps/paths.d.mts +28 -0
- package/dist/internal/build/source-maps/paths.d.mts.map +1 -0
- package/dist/internal/build/source-maps/paths.mjs +1 -0
- package/dist/internal/build/source-maps/paths.mjs.map +1 -0
- package/dist/internal/build/source-maps/upload.d.mts +46 -0
- package/dist/internal/build/source-maps/upload.d.mts.map +1 -0
- package/dist/internal/build/source-maps/upload.mjs +1 -0
- package/dist/internal/build/source-maps/upload.mjs.map +1 -0
- package/dist/internal/build/value-injection-loader.d.mts.map +1 -1
- package/dist/internal/build/value-injection-loader.mjs +2 -24
- package/dist/internal/build/value-injection-loader.mjs.map +1 -1
- package/dist/internal/env.d.mts +13 -3
- package/dist/internal/env.d.mts.map +1 -1
- package/dist/internal/env.mjs +1 -23
- package/dist/internal/env.mjs.map +1 -1
- package/dist/internal/logger.d.mts +9 -1
- package/dist/internal/logger.d.mts.map +1 -1
- package/dist/internal/logger.mjs +1 -60
- package/dist/internal/logger.mjs.map +1 -1
- package/dist/internal/release-slug.d.mts +25 -0
- package/dist/internal/release-slug.d.mts.map +1 -0
- package/dist/internal/release-slug.mjs +1 -0
- package/dist/internal/release-slug.mjs.map +1 -0
- package/dist/internal/route/handle-get.d.mts +14 -1
- package/dist/internal/route/handle-get.d.mts.map +1 -1
- package/dist/internal/route/handle-get.mjs +1 -22
- package/dist/internal/route/handle-get.mjs.map +1 -1
- package/dist/internal/route/handle-post.d.mts +11 -0
- package/dist/internal/route/handle-post.d.mts.map +1 -1
- package/dist/internal/route/handle-post.mjs +1 -70
- package/dist/internal/route/handle-post.mjs.map +1 -1
- package/dist/internal/route/proxy.d.mts +26 -4
- package/dist/internal/route/proxy.d.mts.map +1 -1
- package/dist/internal/route/proxy.mjs +1 -89
- package/dist/internal/route/proxy.mjs.map +1 -1
- package/dist/internal/server/capture.d.mts +2 -2
- package/dist/internal/server/capture.d.mts.map +1 -1
- package/dist/internal/server/capture.mjs +1 -55
- package/dist/internal/server/capture.mjs.map +1 -1
- package/dist/internal/server/console-bridge.d.mts +19 -0
- package/dist/internal/server/console-bridge.d.mts.map +1 -0
- package/dist/internal/server/console-bridge.mjs +1 -0
- package/dist/internal/server/console-bridge.mjs.map +1 -0
- package/dist/internal/server/id-generator.d.mts +38 -0
- package/dist/internal/server/id-generator.d.mts.map +1 -0
- package/dist/internal/server/id-generator.mjs +1 -0
- package/dist/internal/server/id-generator.mjs.map +1 -0
- package/dist/internal/server/instrumentation-options.d.mts +86 -0
- package/dist/internal/server/instrumentation-options.d.mts.map +1 -0
- package/dist/internal/server/instrumentation-options.mjs +1 -0
- package/dist/internal/server/remote-config.d.mts.map +1 -1
- package/dist/internal/server/remote-config.mjs +1 -29
- package/dist/internal/server/remote-config.mjs.map +1 -1
- package/dist/internal/server/trace-meta.d.mts +32 -0
- package/dist/internal/server/trace-meta.d.mts.map +1 -0
- package/dist/internal/server/trace-meta.mjs +1 -0
- package/dist/internal/server/trace-meta.mjs.map +1 -0
- package/dist/internal/server/traceparent.d.mts +16 -0
- package/dist/internal/server/traceparent.d.mts.map +1 -0
- package/dist/internal/server/traceparent.mjs +1 -0
- package/dist/internal/server/traceparent.mjs.map +1 -0
- package/dist/internal/server/types.d.mts +1 -7
- package/dist/internal/server/types.d.mts.map +1 -1
- package/dist/internal/server/types.mjs +1 -1
- package/dist/internal/setup-warnings.d.mts +17 -0
- package/dist/internal/setup-warnings.d.mts.map +1 -0
- package/dist/internal/setup-warnings.mjs +1 -0
- package/dist/internal/setup-warnings.mjs.map +1 -0
- package/dist/internal/url.d.mts +4 -0
- package/dist/internal/url.d.mts.map +1 -0
- package/dist/internal/url.mjs +1 -0
- package/dist/internal/url.mjs.map +1 -0
- package/dist/internal/version.mjs +1 -5
- package/dist/internal/version.mjs.map +1 -1
- package/dist/package.mjs +1 -5
- package/dist/provider.d.mts +23 -2
- package/dist/provider.d.mts.map +1 -0
- package/dist/provider.mjs +1 -3
- package/dist/provider.mjs.map +1 -0
- package/dist/route-handler.d.mts +7 -2
- package/dist/route-handler.d.mts.map +1 -1
- package/dist/route-handler.mjs +1 -31
- package/dist/route-handler.mjs.map +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.mjs +1 -3
- package/package.json +78 -26
- package/dist/internal/route/sw-script.d.mts +0 -4
- package/dist/internal/route/sw-script.d.mts.map +0 -1
- package/dist/internal/route/sw-script.mjs +0 -38
- package/dist/internal/route/sw-script.mjs.map +0 -1
- package/dist/internal/server/dedupe.d.mts +0 -5
- package/dist/internal/server/dedupe.d.mts.map +0 -1
- package/dist/internal/server/dedupe.mjs +0 -11
- package/dist/internal/server/dedupe.mjs.map +0 -1
- package/dist/internal/server/envelope.d.mts +0 -14
- package/dist/internal/server/envelope.d.mts.map +0 -1
- package/dist/internal/server/envelope.mjs +0 -59
- package/dist/internal/server/envelope.mjs.map +0 -1
- package/dist/internal/server/normalize-request.d.mts +0 -7
- package/dist/internal/server/normalize-request.d.mts.map +0 -1
- package/dist/internal/server/normalize-request.mjs +0 -50
- package/dist/internal/server/normalize-request.mjs.map +0 -1
- package/dist/internal/server/runtime.d.mts +0 -14
- package/dist/internal/server/runtime.d.mts.map +0 -1
- package/dist/internal/server/runtime.mjs +0 -18
- package/dist/internal/server/runtime.mjs.map +0 -1
- package/dist/internal/server/transport.d.mts +0 -12
- package/dist/internal/server/transport.d.mts.map +0 -1
- package/dist/internal/server/transport.mjs +0 -26
- package/dist/internal/server/transport.mjs.map +0 -1
|
@@ -1,87 +1 @@
|
|
|
1
|
-
import
|
|
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 };
|
|
1
|
+
import{existsSync}from"node:fs";import{basename,dirname,join,normalize,resolve}from"node:path";import{fileURLToPath}from"node:url";const INSTRUMENTATION_CLIENT_FILES=[`instrumentation-client.ts`,`instrumentation-client.tsx`,`instrumentation-client.js`,`instrumentation-client.jsx`,`src/instrumentation-client.ts`,`src/instrumentation-client.tsx`,`src/instrumentation-client.js`,`src/instrumentation-client.jsx`],LOADER_FILE_CANDIDATES=[`value-injection-loader.ts`,`value-injection-loader.js`,`value-injection-loader.mjs`,`value-injection-loader.cjs`];function configureBuild({existingWebpack,existingTurbopack,projectDir,values}){let instrumentationClientPath=resolveInstrumentationClientPath(projectDir);return{webpack:buildWebpackHook(existingWebpack,instrumentationClientPath,values),turbopack:buildTurbopackConfig(existingTurbopack,instrumentationClientPath,values)}}function hasInjectedMetadata(metadata){return metadata.__INTERFERE_RELEASE_SLUG__!==null||metadata.__INTERFERE_PUBLIC_KEY__!==void 0}function buildWebpackHook(existingWebpack,instrumentationClientPath,values){if(!(instrumentationClientPath&&hasInjectedMetadata(values)))return existingWebpack;let normalizedPath=normalize(instrumentationClientPath),loaderPath=resolveLoaderPath();return(webpackConfig,options)=>{let outputConfig=existingWebpack?existingWebpack(webpackConfig,options):webpackConfig,mutableConfig=outputConfig,injectionRule={test:resource=>!!resource&&normalize(resource)===normalizedPath,use:[{loader:loaderPath,options:{values}}]};return mutableConfig.module??={},mutableConfig.module.rules??=[],mutableConfig.module.rules.push(injectionRule),outputConfig}}function buildTurbopackConfig(existingTurbopack,instrumentationClientPath,values){let baseConfig=existingTurbopack??{},debugIds=baseConfig.debugIds??!0;if(!(instrumentationClientPath&&hasInjectedMetadata(values)))return existingTurbopack===void 0&&debugIds===baseConfig.debugIds?existingTurbopack:{...baseConfig,debugIds};let ruleKey=`**/${basename(instrumentationClientPath)}`,existingRule=baseConfig.rules?.[ruleKey]??{},existingLoaders=Array.isArray(existingRule.loaders)?existingRule.loaders:[];return{...baseConfig,debugIds,rules:{...baseConfig.rules,[ruleKey]:{...existingRule,loaders:[...existingLoaders,{loader:resolveLoaderPath(),options:{serializedValues:JSON.stringify(values)}}]}}}}function resolveInstrumentationClientPath(projectDir){for(let candidate of INSTRUMENTATION_CLIENT_FILES){let filePath=resolve(projectDir,candidate);if(existsSync(filePath))return filePath}return null}function resolveLoaderPath(){let directory=resolve(dirname(fileURLToPath(import.meta.url)));for(let candidate of LOADER_FILE_CANDIDATES){let filePath=join(directory,candidate);if(existsSync(filePath))return filePath}return join(directory,`value-injection-loader.js`)}export{configureBuild};
|
|
@@ -1 +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
|
|
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_FORCE_ENABLE__?: boolean;\n readonly __INTERFERE_PROXY_MODE__?: boolean;\n readonly __INTERFERE_PUBLIC_KEY__?: string;\n readonly __INTERFERE_RELEASE_SLUG__: 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 existingTurbopack: NextConfig[\"turbopack\"] | undefined;\n readonly existingWebpack: NextConfig[\"webpack\"] | undefined;\n readonly projectDir: string;\n readonly values: InterfereInjectedValues;\n}\n\ninterface ConfigureBuildOutput {\n readonly turbopack: NextConfig[\"turbopack\"] | undefined;\n readonly webpack: NextConfig[\"webpack\"] | undefined;\n}\n\nexport function configureBuild({\n existingWebpack,\n existingTurbopack,\n projectDir,\n values,\n}: ConfigureBuildInput): ConfigureBuildOutput {\n const instrumentationClientPath =\n resolveInstrumentationClientPath(projectDir);\n\n return {\n webpack: buildWebpackHook(\n existingWebpack,\n instrumentationClientPath,\n values\n ),\n turbopack: buildTurbopackConfig(\n existingTurbopack,\n instrumentationClientPath,\n values\n ),\n };\n}\n\nfunction hasInjectedMetadata(metadata: InterfereInjectedValues): boolean {\n return (\n metadata.__INTERFERE_RELEASE_SLUG__ !== null ||\n metadata.__INTERFERE_PUBLIC_KEY__ !== undefined\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 // Turbopack natively pairs JS chunks to source maps via debug IDs (it\n // injects matching `//# debugId=…` into the chunk and a `\"debugId\"` field\n // into the map). We rely on this in `discoverTurbopack`, because the\n // `//# sourceMappingURL=…` URL in the chunk is the source map's content\n // hash — not the `.js.map` filename on disk — so URL-based pairing always\n // fails for turbopack output.\n //\n // We force `debugIds: true` unless the user opted out explicitly. The\n // user keeps full control: any user-provided value (including `false`)\n // wins via `??`.\n const baseConfig = (existingTurbopack ?? {}) as {\n rules?: Record<string, unknown>;\n debugIds?: boolean;\n };\n const debugIds = baseConfig.debugIds ?? true;\n\n // No instrumentation client → only the debugIds patch is needed, and only\n // if the user hasn't already declared turbopack config (in which case we\n // leave their object untouched but layered with our default).\n if (!(instrumentationClientPath && hasInjectedMetadata(values))) {\n if (existingTurbopack === undefined && debugIds === baseConfig.debugIds) {\n return existingTurbopack;\n }\n \n return { ...baseConfig, debugIds } as NextConfig[\"turbopack\"];\n }\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 debugIds,\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":"mIAYA,MAAM,6BAA+B,CACnC,4BACA,6BACA,4BACA,6BACA,gCACA,iCACA,gCACA,gCACF,EAEM,uBAAyB,CAC7B,4BACA,4BACA,6BACA,4BACF,EAcA,SAAgB,eAAe,CAC7B,gBACA,kBACA,WACA,QAC4C,CAC5C,IAAM,0BACJ,iCAAiC,UAAU,EAE7C,MAAO,CACL,QAAS,iBACP,gBACA,0BACA,MACF,EACA,UAAW,qBACT,kBACA,0BACA,MACF,CACF,CACF,CAEA,SAAS,oBAAoB,SAA4C,CACvE,OACE,SAAS,6BAA+B,MACxC,SAAS,2BAA6B,IAAA,EAE1C,CAEA,SAAS,iBACP,gBACA,0BACA,OACmC,CACnC,GAAI,EAAE,2BAA6B,oBAAoB,MAAM,GAC3D,OAAO,gBAGT,IAAM,eAAiB,UAAU,yBAAyB,EACpD,WAAa,kBAAkB,EAErC,OAAQ,cAAe,UAAY,CACjC,IAAM,aAAe,gBACjB,gBAAgB,cAAe,OAAO,EACtC,cACE,cAAgB,aAIhB,cAAgB,CACpB,KAAO,UACL,EAAQ,UAAa,UAAU,QAAQ,IAAM,eAC/C,IAAK,CACH,CACE,OAAQ,WACR,QAAS,CAAE,MAAO,CACpB,CACF,CACF,EAMA,MAJA,eAAc,SAAW,CAAC,EAC1B,cAAc,OAAO,QAAU,CAAC,EAChC,cAAc,OAAO,MAAM,KAAK,aAAa,EAEtC,YACT,CACF,CAEA,SAAS,qBACP,kBACA,0BACA,OACqC,CAWrC,IAAM,WAAc,mBAAqB,CAAC,EAIpC,SAAW,WAAW,UAAY,GAKxC,GAAI,EAAE,2BAA6B,oBAAoB,MAAM,GAK3D,OAJI,oBAAsB,IAAA,IAAa,WAAa,WAAW,SACtD,kBAGF,CAAE,GAAG,WAAY,QAAS,EAGnC,IAAM,QAAU,MAAM,SAAS,yBAAyB,IAClD,aAAgB,WAAW,QAAQ,UAAY,CAAC,EAGhD,gBAAkB,MAAM,QAAQ,aAAa,OAAO,EACtD,aAAa,QACb,CAAC,EAEL,MAAO,CACL,GAAG,WACH,SACA,MAAO,CACL,GAAG,WAAW,OACb,SAAU,CACT,GAAG,aACH,QAAS,CACP,GAAG,gBACH,CACE,OAAQ,kBAAkB,EAC1B,QAAS,CACP,iBAAkB,KAAK,UAAU,MAAM,CACzC,CACF,CACF,CACF,CACF,CACF,CACF,CAEA,SAAS,iCAAiC,WAAmC,CAC3E,IAAK,IAAM,aAAa,6BAA8B,CACpD,IAAM,SAAW,QAAQ,WAAY,SAAS,EAC9C,GAAI,WAAW,QAAQ,EACrB,OAAO,QAEX,CAEA,OAAO,IACT,CAEA,SAAS,mBAA4B,CACnC,IAAM,UAAY,QAAQ,QAAQ,cAAc,OAAO,KAAK,GAAG,CAAC,CAAC,EAEjE,IAAK,IAAM,aAAa,uBAAwB,CAC9C,IAAM,SAAW,KAAK,UAAW,SAAS,EAC1C,GAAI,WAAW,QAAQ,EACrB,OAAO,QAEX,CAEA,OAAO,KAAK,UAAW,2BAA2B,CACpD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ManifestBundler } from "@interfere/types/data/source-maps";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/build/detect-bundler.d.ts
|
|
4
|
+
type NextBuildBundler = Extract<ManifestBundler, "webpack" | "turbopack">;
|
|
5
|
+
declare function detectActiveBundler(env?: Readonly<Record<string, string | undefined>>, argv?: readonly string[]): NextBuildBundler;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { NextBuildBundler, detectActiveBundler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-bundler.d.mts","names":[],"sources":["../../../src/internal/build/detect-bundler.ts"],"mappings":";;;KAIY,gBAAA,GAAmB,OAAO,CAAC,eAAA;AAAA,iBAEvB,mBAAA,CACd,GAAA,GAAK,QAAA,CAAS,MAAA,+BACd,IAAA,uBACC,gBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const TURBOPACK_FLAGS=[`--turbo`,`--turbopack`];function detectActiveBundler(env=process.env,argv=process.argv){return env.TURBOPACK===`1`||TURBOPACK_FLAGS.some(flag=>argv.includes(flag))?`turbopack`:`webpack`}export{detectActiveBundler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-bundler.mjs","names":[],"sources":["../../../src/internal/build/detect-bundler.ts"],"sourcesContent":["import type { ManifestBundler } from \"@interfere/types/data/source-maps\";\n\nconst TURBOPACK_FLAGS = [\"--turbo\", \"--turbopack\"] as const;\n\nexport type NextBuildBundler = Extract<ManifestBundler, \"webpack\" | \"turbopack\">;\n\nexport function detectActiveBundler(\n env: Readonly<Record<string, string | undefined>> = process.env,\n argv: readonly string[] = process.argv\n): NextBuildBundler {\n if (env[\"TURBOPACK\"] === \"1\") {\n return \"turbopack\";\n }\n if (TURBOPACK_FLAGS.some((flag) => argv.includes(flag))) {\n return \"turbopack\";\n }\n return \"webpack\";\n}\n"],"mappings":"AAEA,MAAM,gBAAkB,CAAC,UAAW,aAAa,EAIjD,SAAgB,oBACd,IAAoD,QAAQ,IAC5D,KAA0B,QAAQ,KAChB,CAOlB,OANI,IAAI,YAAiB,KAGrB,gBAAgB,KAAM,MAAS,KAAK,SAAS,IAAI,CAAC,EAC7C,YAEF,SACT"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProductionCompileContext, ResolvedBuildConfig } from "../../config.mjs";
|
|
2
|
-
import
|
|
2
|
+
import { ReleaseSlug } from "@interfere/types/releases/slug";
|
|
3
3
|
import { ReleasesConfigResponse } from "@interfere/sdk/models/releases-config-response.js";
|
|
4
4
|
import { CreateReleaseResponse } from "@interfere/types/releases/definition";
|
|
5
5
|
|
|
@@ -29,6 +29,7 @@ type PipelineResult = {
|
|
|
29
29
|
declare function runBuildPipeline(context: ProductionCompileContext, metadata: ResolvedBuildConfig & {
|
|
30
30
|
apiKey: string;
|
|
31
31
|
buildId: string;
|
|
32
|
+
releaseSlug: ReleaseSlug;
|
|
32
33
|
}): Promise<{
|
|
33
34
|
ready: boolean;
|
|
34
35
|
reason: string;
|
|
@@ -41,7 +42,17 @@ declare function runBuildPipeline(context: ProductionCompileContext, metadata: R
|
|
|
41
42
|
reason?: never;
|
|
42
43
|
ready: true;
|
|
43
44
|
fileCount: number;
|
|
44
|
-
release:
|
|
45
|
+
release: {
|
|
46
|
+
org: import("@interfere/sdk/models").OrgRef;
|
|
47
|
+
surface: import("@interfere/sdk/models").SurfaceRef;
|
|
48
|
+
source: import("@interfere/sdk/models").ReleaseSourceRef;
|
|
49
|
+
build: import("@interfere/sdk/models").ReleaseBuildRef;
|
|
50
|
+
destination: {
|
|
51
|
+
id: string;
|
|
52
|
+
environment: string | null;
|
|
53
|
+
slug: `rel_${string}` & import("zod").$brand<"ReleaseSlug">;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
45
56
|
config: ReleasesConfigResponse;
|
|
46
57
|
buildId: string;
|
|
47
58
|
timing: BuildTiming;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.mts","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"pipeline.d.mts","names":[],"sources":["../../../src/internal/build/pipeline.ts"],"mappings":";;;;;;UAciB,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,iBASQ,gBAAA,CACpB,OAAA,EAAS,wBAAA,EACT,QAAA,EAAU,mBAAA;EACR,MAAA;EACA,OAAA;EACA,WAAA,EAAa,WAAA;AAAA,IACd,OAAA"}
|
|
@@ -1,66 +1 @@
|
|
|
1
|
-
import
|
|
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 runBuildPipeline(context, metadata) {
|
|
11
|
-
const { apiUrl, apiKey } = metadata;
|
|
12
|
-
const httpClient = new HTTPClient();
|
|
13
|
-
httpClient.addHook("beforeRequest", (request) => {
|
|
14
|
-
const nextRequest = new Request(request);
|
|
15
|
-
nextRequest.headers.set("x-api-key", apiKey);
|
|
16
|
-
return nextRequest;
|
|
17
|
-
});
|
|
18
|
-
const sdk = new Interfere({
|
|
19
|
-
serverURL: apiUrl,
|
|
20
|
-
httpClient
|
|
21
|
-
});
|
|
22
|
-
const start = performance.now();
|
|
23
|
-
const [{ discovered, config }, discoverMs] = await timed(async () => {
|
|
24
|
-
const [discovered, config] = await Promise.all([discover(context.projectDir, normalizeDistDir(context.distDir)), sdk.releases.getConfig()]);
|
|
25
|
-
return {
|
|
26
|
-
discovered,
|
|
27
|
-
config
|
|
28
|
-
};
|
|
29
|
-
});
|
|
30
|
-
if (discovered.files.length === 0) return {
|
|
31
|
-
ready: false,
|
|
32
|
-
reason: "no_source_maps",
|
|
33
|
-
fileCount: 0
|
|
34
|
-
};
|
|
35
|
-
const releaseRequest = resolveReleaseRequest(metadata.buildId, config);
|
|
36
|
-
const [release, createReleaseMs] = await timed(() => sdk.releases.create(releaseRequest));
|
|
37
|
-
const releaseSlug = release.destination.slug;
|
|
38
|
-
const buildId = release.build.hash ?? metadata.buildId;
|
|
39
|
-
const { body, totalBytes } = buildUploadBody(discovered);
|
|
40
|
-
const [, uploadMs] = await timed(() => sdk.sourceMaps.uploadMultipart({
|
|
41
|
-
releaseSlug,
|
|
42
|
-
body
|
|
43
|
-
}));
|
|
44
|
-
const [, preflightMs] = await timed(() => sdk.releases.preflight({ releaseSlug }));
|
|
45
|
-
const [, cleanupMs] = await timed(() => cleanupSourceMaps(discovered.files));
|
|
46
|
-
const timing = {
|
|
47
|
-
discover: discoverMs,
|
|
48
|
-
createRelease: createReleaseMs,
|
|
49
|
-
upload: uploadMs,
|
|
50
|
-
preflight: preflightMs,
|
|
51
|
-
cleanup: cleanupMs,
|
|
52
|
-
total: Math.round(performance.now() - start),
|
|
53
|
-
fileCount: discovered.files.length,
|
|
54
|
-
totalBytes
|
|
55
|
-
};
|
|
56
|
-
return {
|
|
57
|
-
ready: true,
|
|
58
|
-
fileCount: discovered.files.length,
|
|
59
|
-
release,
|
|
60
|
-
config,
|
|
61
|
-
buildId,
|
|
62
|
-
timing
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
export { runBuildPipeline };
|
|
1
|
+
import{detectActiveBundler}from"./detect-bundler.mjs";import{resolveReleaseRequest}from"./release/index.mjs";import{discoverSourceMaps}from"./source-maps/discover.mjs";import{uploadSourceMaps}from"./source-maps/upload.mjs";import{cleanupSourceMaps}from"./source-maps/index.mjs";import{releaseSlugSchema}from"@interfere/types/releases/slug";import{HTTPClient,Interfere}from"@interfere/sdk";async function timed(fn){let start=performance.now();return[await fn(),Math.round(performance.now()-start)]}async function runBuildPipeline(context,metadata){let{apiUrl,apiKey}=metadata,httpClient=new HTTPClient;httpClient.addHook(`beforeRequest`,request=>{let nextRequest=new Request(request);return nextRequest.headers.set(`Authorization`,`Bearer ${apiKey}`),nextRequest});let sdk=new Interfere({serverURL:apiUrl,httpClient}),start=performance.now(),bundler=detectActiveBundler(),[{discovered,config},discoverMs]=await timed(async()=>{let[discovered,config]=await Promise.all([discoverSourceMaps({bundler,projectDir:context.projectDir,distDir:context.distDir}),sdk.releases.getConfig()]);return{discovered,config}});if(discovered.files.length===0)return{ready:!1,reason:`no_source_maps`,fileCount:0};let releaseRequest=resolveReleaseRequest(metadata.buildId,metadata.releaseSlug,config),[release,createReleaseMs]=await timed(()=>sdk.releases.create(releaseRequest)),releaseSlug=releaseSlugSchema.parse(release.destination.slug),buildId=release.build.hash??metadata.buildId,[{totalBytes},uploadMs]=await timed(()=>uploadSourceMaps({apiUrl,bundler,discovered,httpClient,releaseSlug})),[,preflightMs]=await timed(()=>sdk.releases.preflight({releaseSlug})),[,cleanupMs]=await timed(()=>cleanupSourceMaps(discovered.files)),timing={discover:discoverMs,createRelease:createReleaseMs,upload:uploadMs,preflight:preflightMs,cleanup:cleanupMs,total:Math.round(performance.now()-start),fileCount:discovered.files.length,totalBytes};return{ready:!0,fileCount:discovered.files.length,release:{...release,destination:{...release.destination,slug:releaseSlug}},config,buildId,timing}}export{runBuildPipeline};
|
|
@@ -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 {
|
|
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\";\nimport { type ReleaseSlug, releaseSlugSchema } from \"@interfere/types/releases/slug\";\n\nimport type {\n ProductionCompileContext,\n ResolvedBuildConfig,\n} from \"../../config.js\";\nimport { detectActiveBundler } from \"./detect-bundler.js\";\nimport { resolveReleaseRequest } from \"./release/index.js\";\nimport { discoverSourceMaps } from \"./source-maps/discover.js\";\nimport { cleanupSourceMaps, uploadSourceMaps } 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\nexport async function runBuildPipeline(\n context: ProductionCompileContext,\n metadata: ResolvedBuildConfig & {\n apiKey: string;\n buildId: string;\n releaseSlug: ReleaseSlug;\n }\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(\"Authorization\", `Bearer ${apiKey}`);\n\n return nextRequest;\n });\n\n const sdk = new Interfere({ serverURL: apiUrl, httpClient });\n\n const start = performance.now();\n\n const bundler = detectActiveBundler();\n\n const [{ discovered, config }, discoverMs] = await timed(async () => {\n const [discovered, config] = await Promise.all([\n discoverSourceMaps({\n bundler,\n projectDir: context.projectDir,\n distDir: context.distDir,\n }),\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(\n metadata.buildId,\n metadata.releaseSlug,\n config\n );\n\n const [release, createReleaseMs] = await timed(() =>\n sdk.releases.create(releaseRequest)\n );\n\n // The SDK response carries the slug as a plain `string`. Brand it\n // here at the API boundary so every downstream caller (upload,\n // preflight, cleanup) reads a `ReleaseSlug`.\n const releaseSlug = releaseSlugSchema.parse(release.destination.slug);\n const buildId = release.build.hash ?? metadata.buildId;\n\n const [{ totalBytes }, uploadMs] = await timed(() =>\n uploadSourceMaps({ apiUrl, bundler, discovered, httpClient, releaseSlug: releaseSlug })\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: { ...release, destination: { ...release.destination, slug: releaseSlug } },\n config,\n buildId,\n timing,\n } satisfies PipelineResult;\n}\n"],"mappings":"qYAoCA,eAAe,MAAS,GAA4C,CAClE,IAAM,MAAQ,YAAY,IAAI,EAE9B,MAAO,CAAC,MADa,GAAG,EACR,KAAK,MAAM,YAAY,IAAI,EAAI,KAAK,CAAC,CACvD,CAEA,eAAsB,iBACpB,QACA,SAKA,CACA,GAAM,CAAE,OAAQ,QAAW,SAErB,WAAa,IAAI,WAEvB,WAAW,QAAQ,gBAAkB,SAAY,CAC/C,IAAM,YAAc,IAAI,QAAQ,OAAO,EAIvC,OAFA,YAAY,QAAQ,IAAI,gBAAiB,UAAU,QAAQ,EAEpD,WACT,CAAC,EAED,IAAM,IAAM,IAAI,UAAU,CAAE,UAAW,OAAQ,UAAW,CAAC,EAErD,MAAQ,YAAY,IAAI,EAExB,QAAU,oBAAoB,EAE9B,CAAC,CAAE,WAAY,QAAU,YAAc,MAAM,MAAM,SAAY,CACnE,GAAM,CAAC,WAAY,QAAU,MAAM,QAAQ,IAAI,CAC7C,mBAAmB,CACjB,QACA,WAAY,QAAQ,WACpB,QAAS,QAAQ,OACnB,CAAC,EACD,IAAI,SAAS,UAAU,CACzB,CAAC,EACD,MAAO,CAAE,WAAY,MAAO,CAC9B,CAAC,EAED,GAAI,WAAW,MAAM,SAAW,EAC9B,MAAO,CAAE,MAAO,GAAO,OAAQ,iBAAkB,UAAW,CAAE,EAGhE,IAAM,eAAiB,sBACrB,SAAS,QACT,SAAS,YACT,MACF,EAEM,CAAC,QAAS,iBAAmB,MAAM,UACvC,IAAI,SAAS,OAAO,cAAc,CACpC,EAKM,YAAc,kBAAkB,MAAM,QAAQ,YAAY,IAAI,EAC9D,QAAU,QAAQ,MAAM,MAAQ,SAAS,QAEzC,CAAC,CAAE,YAAc,UAAY,MAAM,UACvC,iBAAiB,CAAE,OAAQ,QAAS,WAAY,WAAyB,WAAY,CAAC,CACxF,EAOM,EAAG,aAAe,MAAM,UAC5B,IAAI,SAAS,UAAU,CAAE,WAAY,CAAC,CACxC,EAEM,EAAG,WAAa,MAAM,UAAY,kBAAkB,WAAW,KAAK,CAAC,EAErE,OAAsB,CAC1B,SAAU,WACV,cAAe,gBACf,OAAQ,SACR,UAAW,YACX,QAAS,UACT,MAAO,KAAK,MAAM,YAAY,IAAI,EAAI,KAAK,EAC3C,UAAW,WAAW,MAAM,OAC5B,UACF,EAEA,MAAO,CACL,MAAO,GACP,UAAW,WAAW,MAAM,OAC5B,QAAS,CAAE,GAAG,QAAS,YAAa,CAAE,GAAG,QAAQ,YAAa,KAAM,WAAY,CAAE,EAClF,OACA,QACA,MACF,CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DestinationProvider, ReleaseDestinationMetadata } from "@interfere/types/integrations";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/build/release/destinations/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Per-provider destination metadata resolvers. Mirrors `sources/` —
|
|
6
|
+
* each entry knows how to read its platform's deployment env vars and
|
|
7
|
+
* returns a `ReleaseDestinationMetadata` blob.
|
|
8
|
+
*
|
|
9
|
+
* Adding a new destination (cloudflare-pages, fly, render, …) is one
|
|
10
|
+
* new file under this directory + one entry here.
|
|
11
|
+
*/
|
|
12
|
+
declare const destinations: Record<DestinationProvider, () => ReleaseDestinationMetadata>;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { destinations };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/internal/build/release/destinations/index.ts"],"mappings":";;;;;AAeA;;;;;;cAAa,YAAA,EAAc,MAAA,CACzB,mBAAA,QACM,0BAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve}from"./vercel.mjs";const destinations={vercel:resolve};export{destinations};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["resolveVercel"],"sources":["../../../../../src/internal/build/release/destinations/index.ts"],"sourcesContent":["import type {\n DestinationProvider,\n ReleaseDestinationMetadata,\n} from \"@interfere/types/integrations\";\n\nimport { resolve as resolveVercel } from \"./vercel.js\";\n\n/**\n * Per-provider destination metadata resolvers. Mirrors `sources/` —\n * each entry knows how to read its platform's deployment env vars and\n * returns a `ReleaseDestinationMetadata` blob.\n *\n * Adding a new destination (cloudflare-pages, fly, render, …) is one\n * new file under this directory + one entry here.\n */\nexport const destinations: Record<\n DestinationProvider,\n () => ReleaseDestinationMetadata\n> = {\n vercel: resolveVercel,\n};\n"],"mappings":"kCAeA,MAAa,aAGT,CACF,OAAQA,OACV"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.d.mts","names":[],"sources":["../../../../../src/internal/build/release/destinations/vercel.ts"],"mappings":";;;iBAGgB,OAAA,CAAA,GAAW,
|
|
1
|
+
{"version":3,"file":"vercel.d.mts","names":[],"sources":["../../../../../src/internal/build/release/destinations/vercel.ts"],"mappings":";;;iBAGgB,OAAA,CAAA,GAAW,0BAA0B"}
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
//#region src/internal/build/release/destinations/vercel.ts
|
|
3
|
-
function resolve() {
|
|
4
|
-
const environment = parseEnvValue(process.env["VERCEL_ENV"] ?? process.env["VERCEL_TARGET_ENV"]);
|
|
5
|
-
const deploymentId = parseEnvValue(process.env["VERCEL_DEPLOYMENT_ID"]);
|
|
6
|
-
return {
|
|
7
|
-
provider: "vercel",
|
|
8
|
-
destinationReleaseId: deploymentId,
|
|
9
|
-
environment,
|
|
10
|
-
deploymentId,
|
|
11
|
-
deploymentUrl: resolveDeploymentUrl(),
|
|
12
|
-
environmentName: environment,
|
|
13
|
-
environmentTarget: environment
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function resolveDeploymentUrl() {
|
|
17
|
-
const deploymentUrl = parseEnvValue(process.env["VERCEL_URL"]);
|
|
18
|
-
if (deploymentUrl === null) return null;
|
|
19
|
-
if (deploymentUrl.startsWith("https://") || deploymentUrl.startsWith("http://")) return deploymentUrl;
|
|
20
|
-
return `https://${deploymentUrl}`;
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
export { resolve };
|
|
1
|
+
import{parseEnvValue}from"@interfere/types/sdk/env";function resolve(){let environment=parseEnvValue(process.env.VERCEL_ENV??process.env.VERCEL_TARGET_ENV),deploymentId=parseEnvValue(process.env.VERCEL_DEPLOYMENT_ID);return{provider:`vercel`,destinationReleaseId:deploymentId,environment,deploymentId,deploymentUrl:resolveDeploymentUrl(),environmentName:environment,environmentTarget:environment}}function resolveDeploymentUrl(){let deploymentUrl=parseEnvValue(process.env.VERCEL_URL);return deploymentUrl===null?null:deploymentUrl.startsWith(`https://`)||deploymentUrl.startsWith(`http://`)?deploymentUrl:`https://${deploymentUrl}`}export{resolve};
|
|
@@ -1 +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":"
|
|
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":"oDAGA,SAAgB,SAAsC,CACpD,IAAM,YAAc,cAClB,QAAQ,IAAI,YAAiB,QAAQ,IAAI,iBAC3C,EAEM,aAAe,cAAc,QAAQ,IAAI,oBAAuB,EAEtE,MAAO,CACL,SAAU,SACV,qBAAsB,aACtB,YACA,aACA,cAAe,qBAAqB,EACpC,gBAAiB,YACjB,kBAAmB,WACrB,CACF,CAEA,SAAS,sBAAsC,CAC7C,IAAM,cAAgB,cAAc,QAAQ,IAAI,UAAa,EAa7D,OAXI,gBAAkB,KACb,KAIP,cAAc,WAAW,UAAU,GACnC,cAAc,WAAW,SAAS,EAE3B,cAGF,WAAW,eACpB"}
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
//#region src/internal/build/release/git.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Runs a git command and returns its stdout, or `null` when git isn't
|
|
4
|
+
* available (no `.git` checkout, git binary missing, command errored).
|
|
5
|
+
*
|
|
6
|
+
* The ignore-on-failure shape lets callers compose this with env-var
|
|
7
|
+
* reads as a fallback chain — env vars first (CI environments where
|
|
8
|
+
* git isn't checked out), git as a last resort (local dev).
|
|
9
|
+
*
|
|
10
|
+
* Build-time only. `node:child_process` isn't available in the Edge
|
|
11
|
+
* runtime, so this helper must never end up in `instrumentation.ts`'s
|
|
12
|
+
* import graph (the SDK ships that entrypoint to both Node + Edge
|
|
13
|
+
* runtimes via conditional exports).
|
|
14
|
+
*/
|
|
2
15
|
declare function runGitCommand(command: string): string | null;
|
|
3
16
|
//#endregion
|
|
4
17
|
export { runGitCommand };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.mts","names":[],"sources":["../../../../src/internal/build/release/git.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"git.d.mts","names":[],"sources":["../../../../src/internal/build/release/git.ts"],"mappings":";;AAeA;;;;AAA6C;;;;;;;;iBAA7B,aAAA,CAAc,OAAe"}
|
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import {
|
|
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 };
|
|
1
|
+
import{execSync}from"node:child_process";function runGitCommand(command){try{let output=execSync(command,{encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]}).trim();return output.length>0?output:null}catch{return null}}export{runGitCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.mjs","names":[],"sources":["../../../../src/internal/build/release/git.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\n\
|
|
1
|
+
{"version":3,"file":"git.mjs","names":[],"sources":["../../../../src/internal/build/release/git.ts"],"sourcesContent":["import { execSync } from \"node:child_process\";\n\n/**\n * Runs a git command and returns its stdout, or `null` when git isn't\n * available (no `.git` checkout, git binary missing, command errored).\n *\n * The ignore-on-failure shape lets callers compose this with env-var\n * reads as a fallback chain — env vars first (CI environments where\n * git isn't checked out), git as a last resort (local dev).\n *\n * Build-time only. `node:child_process` isn't available in the Edge\n * runtime, so this helper must never end up in `instrumentation.ts`'s\n * import graph (the SDK ships that entrypoint to both Node + Edge\n * runtimes via conditional exports).\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 return null;\n }\n}\n"],"mappings":"yCAeA,SAAgB,cAAc,QAAgC,CAC5D,GAAI,CACF,IAAM,OAAS,SAAS,QAAS,CAC/B,SAAU,OACV,MAAO,CAAC,SAAU,OAAQ,QAAQ,CACpC,CAAC,EAAE,KAAK,EAER,OAAO,OAAO,OAAS,EAAI,OAAS,IACtC,MAAQ,CACN,OAAO,IACT,CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { ReleaseSlug } from "@interfere/types/releases/slug";
|
|
1
2
|
import { ReleasesConfigResponse } from "@interfere/sdk/models/releases-config-response.js";
|
|
2
3
|
import { CreateReleaseRequest } from "@interfere/types/releases/definition";
|
|
3
4
|
|
|
4
5
|
//#region src/internal/build/release/index.d.ts
|
|
5
|
-
declare function resolveReleaseRequest(buildId: string, config: ReleasesConfigResponse): CreateReleaseRequest;
|
|
6
|
+
declare function resolveReleaseRequest(buildId: string, releaseSlug: ReleaseSlug, config: ReleasesConfigResponse): CreateReleaseRequest;
|
|
6
7
|
//#endregion
|
|
7
8
|
export { resolveReleaseRequest };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/internal/build/release/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/internal/build/release/index.ts"],"mappings":";;;;;iBASgB,qBAAA,CACd,OAAA,UACA,WAAA,EAAa,WAAA,EACb,MAAA,EAAQ,sBAAA,GACP,oBAAA"}
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PRODUCER_VERSION } from "../../version.mjs";
|
|
3
|
-
import { resolve } from "./destinations/vercel.mjs";
|
|
4
|
-
import { resolve as resolve$1 } from "./sources/github.mjs";
|
|
5
|
-
//#region src/internal/build/release/index.ts
|
|
6
|
-
const sources = { github: resolve$1 };
|
|
7
|
-
const destinations = { vercel: resolve };
|
|
8
|
-
function resolveReleaseRequest(buildId, config) {
|
|
9
|
-
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}`]);
|
|
10
|
-
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}`]);
|
|
11
|
-
return {
|
|
12
|
-
source: sources[config.surface.sourceProvider](),
|
|
13
|
-
destination: destinations[config.surface.destinationProvider](),
|
|
14
|
-
buildId,
|
|
15
|
-
producerVersion: PRODUCER_VERSION
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
//#endregion
|
|
19
|
-
export { resolveReleaseRequest };
|
|
1
|
+
import{log}from"../../logger.mjs";import{PRODUCER_VERSION}from"../../version.mjs";import{destinations}from"./destinations/index.mjs";import{sources}from"./sources/index.mjs";function resolveReleaseRequest(buildId,releaseSlug,config){return config.surface.sourceProvider?config.surface.destinationProvider?{source:sources[config.surface.sourceProvider](),destination:destinations[config.surface.destinationProvider](),buildId,slug:releaseSlug,producerVersion:PRODUCER_VERSION}: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}`]):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}`])}export{resolveReleaseRequest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/internal/build/release/index.ts"],"sourcesContent":["import type { ReleaseSlug } from \"@interfere/types/releases/slug\";\nimport type { ReleasesConfigResponse } from \"@interfere/sdk/models/releases-config-response.js\";\nimport type { CreateReleaseRequest } from \"@interfere/types/releases/definition\";\n\nimport { log } from \"../../logger.js\";\nimport { PRODUCER_VERSION } from \"../../version.js\";\nimport { destinations } from \"./destinations/index.js\";\nimport { sources } from \"./sources/index.js\";\n\nexport function resolveReleaseRequest(\n buildId: string,\n releaseSlug: ReleaseSlug,\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](),\n destination: destinations[config.surface.destinationProvider](),\n buildId,\n slug: releaseSlug,\n producerVersion: PRODUCER_VERSION,\n };\n}\n"],"mappings":"8KASA,SAAgB,sBACd,QACA,YACA,OACsB,CAetB,OAdK,OAAO,QAAQ,eAOf,OAAO,QAAQ,oBAOb,CACL,OAAQ,QAAQ,OAAO,QAAQ,gBAAgB,EAC/C,YAAa,aAAa,OAAO,QAAQ,qBAAqB,EAC9D,QACA,KAAM,YACN,gBAAiB,gBACnB,EAZS,IAAI,MAAM,4BAA6B,CAC5C,yEACA,4CAA4C,OAAO,IAAI,KAAK,YAAY,OAAO,QAAQ,MACzF,CAAC,EAVM,IAAI,MAAM,mCAAoC,CACnD,oEACA,4CAA4C,OAAO,IAAI,KAAK,YAAY,OAAO,QAAQ,MACzF,CAAC,CAiBL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.mts","names":[],"sources":["../../../../../src/internal/build/release/sources/github.ts"],"mappings":";;;iBAKgB,OAAA,CAAA,GAAW,
|
|
1
|
+
{"version":3,"file":"github.d.mts","names":[],"sources":["../../../../../src/internal/build/release/sources/github.ts"],"mappings":";;;iBAKgB,OAAA,CAAA,GAAW,qBAAqB"}
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { parseEnvValue } from "@interfere/types/sdk/env";
|
|
3
|
-
//#region src/internal/build/release/sources/github.ts
|
|
4
|
-
function resolve() {
|
|
5
|
-
return {
|
|
6
|
-
provider: "github",
|
|
7
|
-
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",
|
|
8
|
-
commitMessage: parseEnvValue(process.env["VERCEL_GIT_COMMIT_MESSAGE"]) ?? runGitCommand("git log -1 --pretty=%B") ?? "",
|
|
9
|
-
commitSha: parseEnvValue(process.env["VERCEL_GIT_COMMIT_SHA"]) ?? parseEnvValue(process.env["GITHUB_SHA"]) ?? runGitCommand("git rev-parse HEAD")
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { resolve };
|
|
1
|
+
import{runGitCommand}from"../git.mjs";import{parseEnvValue}from"@interfere/types/sdk/env";function resolve(){return{provider:`github`,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`,commitMessage:parseEnvValue(process.env.VERCEL_GIT_COMMIT_MESSAGE)??runGitCommand(`git log -1 --pretty=%B`)??``,commitSha:parseEnvValue(process.env.VERCEL_GIT_COMMIT_SHA)??parseEnvValue(process.env.GITHUB_SHA)??runGitCommand(`git rev-parse HEAD`)}}export{resolve};
|
|
@@ -1 +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":"
|
|
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":"0FAKA,SAAgB,SAAiC,CAC/C,MAAO,CACL,SAAU,SACV,OACE,cAAc,QAAQ,IAAI,qBAAwB,GAClD,cAAc,QAAQ,IAAI,eAAkB,GAC5C,cAAc,QAAQ,IAAI,eAAkB,GAC5C,cAAc,iCAAiC,GAC/C,UACF,cACE,cAAc,QAAQ,IAAI,yBAA4B,GACtD,cAAc,wBAAwB,GACtC,GACF,UACE,cAAc,QAAQ,IAAI,qBAAwB,GAClD,cAAc,QAAQ,IAAI,UAAa,GACvC,cAAc,oBAAoB,CACtC,CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReleaseSourceMetadata, SourceProvider } from "@interfere/types/integrations";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/build/release/sources/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Per-provider source metadata resolvers. Each entry knows how to read
|
|
6
|
+
* its platform's env vars (and falls back to local git where applicable)
|
|
7
|
+
* and returns a `ReleaseSourceMetadata` blob keyed to the provider.
|
|
8
|
+
*
|
|
9
|
+
* Adding a new provider (gitlab, bitbucket, …) is one new file under
|
|
10
|
+
* this directory + one entry here. Every consumer that walks this
|
|
11
|
+
* registry — release-create payload assembly in the build pipeline —
|
|
12
|
+
* picks up the new provider for free.
|
|
13
|
+
*
|
|
14
|
+
* Lives under `internal/build/` because resolvers shell out to git via
|
|
15
|
+
* `runGitCommand`, which depends on `node:child_process` (not Edge-safe).
|
|
16
|
+
* Anything imported from `instrumentation.ts` must stay edge-safe; this
|
|
17
|
+
* tree is build-only.
|
|
18
|
+
*/
|
|
19
|
+
declare const sources: Record<SourceProvider, () => ReleaseSourceMetadata>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { sources };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../../src/internal/build/release/sources/index.ts"],"mappings":";;;;;AAsBA;;;;;;;;;;;;AAAwE;cAA3D,OAAA,EAAS,MAAA,CAAO,cAAA,QAAsB,qBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolve}from"./github.mjs";const sources={github:resolve};export{sources};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["resolveGithub"],"sources":["../../../../../src/internal/build/release/sources/index.ts"],"sourcesContent":["import type {\n ReleaseSourceMetadata,\n SourceProvider,\n} from \"@interfere/types/integrations\";\n\nimport { resolve as resolveGithub } from \"./github.js\";\n\n/**\n * Per-provider source metadata resolvers. Each entry knows how to read\n * its platform's env vars (and falls back to local git where applicable)\n * and returns a `ReleaseSourceMetadata` blob keyed to the provider.\n *\n * Adding a new provider (gitlab, bitbucket, …) is one new file under\n * this directory + one entry here. Every consumer that walks this\n * registry — release-create payload assembly in the build pipeline —\n * picks up the new provider for free.\n *\n * Lives under `internal/build/` because resolvers shell out to git via\n * `runGitCommand`, which depends on `node:child_process` (not Edge-safe).\n * Anything imported from `instrumentation.ts` must stay edge-safe; this\n * tree is build-only.\n */\nexport const sources: Record<SourceProvider, () => ReleaseSourceMetadata> = {\n github: resolveGithub,\n};\n"],"mappings":"kCAsBA,MAAa,QAA+D,CAC1E,OAAQA,OACV"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SourceMapFile } from "./discover.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/internal/build/source-maps/discover-turbopack.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Turbopack-mode discovery.
|
|
6
|
+
*
|
|
7
|
+
* Turbopack hashes the JS chunk and its source map independently, so the
|
|
8
|
+
* `//# sourceMappingURL=…` URL embedded in the chunk never matches the
|
|
9
|
+
* on-disk `.js.map` filename. When `experimental.turbo.debugIds` is on
|
|
10
|
+
* (we set it for the user in `configure-build.ts`), turbopack natively
|
|
11
|
+
* injects matching `debugId` values into both the chunk
|
|
12
|
+
* (`//# debugId=…`) and the source map (`"debugId": "…"`).
|
|
13
|
+
*
|
|
14
|
+
* We pair JS chunks ↔ source maps by `debugId` (turbopack's natural key)
|
|
15
|
+
* and additionally record each chunk's public URL as `chunkUrl` so the
|
|
16
|
+
* server-side suffix-match resolver has a uniform field to look up by
|
|
17
|
+
* `frame.fileName` regardless of bundler. The webpack discoverer
|
|
18
|
+
* populates the same field directly from the chunk's URL; the turbopack
|
|
19
|
+
* discoverer derives it from the JS chunk's on-disk path.
|
|
20
|
+
*
|
|
21
|
+
* Maps without a debugId, or whose debugId never appears in any chunk,
|
|
22
|
+
* are silently skipped — they have no way to resolve at runtime.
|
|
23
|
+
*/
|
|
24
|
+
declare function discoverTurbopack(opts: {
|
|
25
|
+
projectDir: string;
|
|
26
|
+
distDir: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
files: SourceMapFile[];
|
|
29
|
+
sourceFileCount: number;
|
|
30
|
+
}>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { discoverTurbopack };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-turbopack.d.mts","names":[],"sources":["../../../../src/internal/build/source-maps/discover-turbopack.ts"],"mappings":";;;;;AA6BA;;;;;;;;;;;;AAGqD;;;;;;iBAH/B,iBAAA,CAAkB,IAAA;EACtC,UAAA;EACA,OAAA;AAAA,IACE,OAAO;EAAG,KAAA,EAAO,aAAA;EAAiB,eAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{resolveDistDir,toPublicPath,walkDistTrees}from"./paths.mjs";import{relative}from"node:path";import{createHash}from"node:crypto";import{readFile}from"node:fs/promises";const DEBUG_ID_RE=/\/\/[#@]\s*debugId=([0-9a-f-]+)\s*$/m;async function discoverTurbopack(opts){let absDistDir=resolveDistDir(opts.projectDir,opts.distDir),relDistDir=relative(opts.projectDir,absDistDir),[mapPaths,jsPaths]=await Promise.all([walkDistTrees(absDistDir,`.js.map`),walkDistTrees(absDistDir,`.js`)]),debugIdToChunkUrl=new Map;await Promise.all(jsPaths.map(async jsAbs=>{let content=await readFile(jsAbs,`utf8`).catch(()=>null);if(content===null)return;let debugId=DEBUG_ID_RE.exec(content)?.[1];if(!debugId)return;let chunkUrl=toPublicPath(relative(opts.projectDir,jsAbs),relDistDir);debugIdToChunkUrl.has(debugId)||debugIdToChunkUrl.set(debugId,chunkUrl)}));let loaded=(await Promise.all(mapPaths.map(async mapAbs=>{let content=await readFile(mapAbs,`utf8`).catch(()=>null);if(content===null)return null;let debugId;try{let parsed=JSON.parse(content);typeof parsed.debugId==`string`&&parsed.debugId.length>0&&(debugId=parsed.debugId)}catch{return null}if(!debugId)return null;let chunkUrl=debugIdToChunkUrl.get(debugId);return chunkUrl?{absolute:mapAbs,path:toPublicPath(relative(opts.projectDir,mapAbs),relDistDir),content,hash:createHash(`sha256`).update(content).digest(`hex`),debugId,chunkUrl}:null}))).filter(f=>f!==null);return{files:loaded,sourceFileCount:loaded.length}}export{discoverTurbopack};
|