@interfere/next 0.1.0-alpha.9 → 0.2.0-alpha.3
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 +70 -277
- package/dist/_virtual/_rolldown/runtime.mjs +13 -0
- package/dist/config.d.mts +11 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +107 -0
- package/dist/config.mjs.map +1 -0
- package/dist/instrument-client.d.mts +2 -0
- package/dist/instrument-client.mjs +2 -0
- package/dist/internal/build/configure-build.d.mts +22 -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/injected.d.mts +12 -0
- package/dist/internal/build/injected.d.mts.map +1 -0
- package/dist/internal/build/injected.mjs +9 -0
- package/dist/internal/build/injected.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 +7 -0
- package/dist/internal/build/release/index.d.mts.map +1 -0
- package/dist/internal/build/release/index.mjs +24 -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/release/types.d.mts +11 -0
- package/dist/internal/build/release/types.d.mts.map +1 -0
- package/dist/internal/build/release/types.mjs +1 -0
- package/dist/internal/build/source-maps/discover.d.mts +14 -0
- package/dist/internal/build/source-maps/discover.d.mts.map +1 -0
- package/dist/internal/build/source-maps/discover.mjs +61 -0
- package/dist/internal/build/source-maps/discover.mjs.map +1 -0
- package/dist/internal/build/source-maps/index.d.mts +23 -0
- package/dist/internal/build/source-maps/index.d.mts.map +1 -0
- package/dist/internal/build/source-maps/index.mjs +33 -0
- package/dist/internal/build/source-maps/index.mjs.map +1 -0
- package/dist/internal/build/value-injection-loader.d.mts +10 -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 +8 -0
- package/dist/internal/logger.d.mts.map +1 -0
- package/dist/internal/logger.mjs +44 -0
- package/dist/internal/logger.mjs.map +1 -0
- package/dist/internal/route/cors.d.mts +4 -0
- package/dist/internal/route/cors.d.mts.map +1 -0
- package/dist/internal/route/cors.mjs +15 -0
- package/dist/internal/route/cors.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 +15 -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 +105 -0
- package/dist/internal/route/handle-post.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 +32 -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 +46 -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 +41 -0
- package/dist/internal/server/envelope.mjs.map +1 -0
- package/dist/internal/server/mechanisms.d.mts +7 -0
- package/dist/internal/server/mechanisms.d.mts.map +1 -0
- package/dist/internal/server/mechanisms.mjs +12 -0
- package/dist/internal/server/mechanisms.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/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/session.d.mts +11 -0
- package/dist/internal/server/session.d.mts.map +1 -0
- package/dist/internal/server/session.mjs +15 -0
- package/dist/internal/server/session.mjs.map +1 -0
- package/dist/internal/server/transport.d.mts +14 -0
- package/dist/internal/server/transport.d.mts.map +1 -0
- package/dist/internal/server/transport.mjs +16 -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/provider.d.mts +2 -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 +18 -0
- package/dist/route-handler.mjs.map +1 -0
- package/dist/server.d.mts +8 -0
- package/dist/server.d.mts.map +1 -0
- package/dist/server.mjs +6 -0
- package/dist/server.mjs.map +1 -0
- package/package.json +60 -73
- package/LICENSE +0 -21
- package/dist/build/env-config.d.mts +0 -7
- package/dist/build/env-config.d.mts.map +0 -1
- package/dist/build/env-config.mjs +0 -17
- package/dist/build/env-config.mjs.map +0 -1
- package/dist/build/loaders/value-injection-loader.d.mts +0 -28
- package/dist/build/loaders/value-injection-loader.d.mts.map +0 -1
- package/dist/build/loaders/value-injection-loader.mjs +0 -44
- package/dist/build/loaders/value-injection-loader.mjs.map +0 -1
- package/dist/build/logger.d.mts +0 -11
- package/dist/build/logger.d.mts.map +0 -1
- package/dist/build/logger.mjs +0 -155
- package/dist/build/logger.mjs.map +0 -1
- package/dist/build/release-program.d.mts +0 -19
- package/dist/build/release-program.d.mts.map +0 -1
- package/dist/build/release-program.mjs +0 -92
- package/dist/build/release-program.mjs.map +0 -1
- package/dist/build/secret-key.d.mts +0 -10
- package/dist/build/secret-key.d.mts.map +0 -1
- package/dist/build/secret-key.mjs +0 -16
- package/dist/build/secret-key.mjs.map +0 -1
- package/dist/build/services/config.service.d.mts +0 -9
- package/dist/build/services/config.service.d.mts.map +0 -1
- package/dist/build/services/config.service.mjs +0 -8
- package/dist/build/services/config.service.mjs.map +0 -1
- package/dist/build/services/instrumentation-detection.service.d.mts +0 -22
- package/dist/build/services/instrumentation-detection.service.d.mts.map +0 -1
- package/dist/build/services/instrumentation-detection.service.mjs +0 -60
- package/dist/build/services/instrumentation-detection.service.mjs.map +0 -1
- package/dist/build/services/preflight.service.d.mts +0 -19
- package/dist/build/services/preflight.service.d.mts.map +0 -1
- package/dist/build/services/preflight.service.mjs +0 -76
- package/dist/build/services/preflight.service.mjs.map +0 -1
- package/dist/build/services/release-identity.service.d.mts +0 -22
- package/dist/build/services/release-identity.service.d.mts.map +0 -1
- package/dist/build/services/release-identity.service.mjs +0 -48
- package/dist/build/services/release-identity.service.mjs.map +0 -1
- package/dist/build/services/source-map.service.d.mts +0 -24
- package/dist/build/services/source-map.service.d.mts.map +0 -1
- package/dist/build/services/source-map.service.mjs +0 -58
- package/dist/build/services/source-map.service.mjs.map +0 -1
- package/dist/build/source-maps/api.d.mts +0 -35
- package/dist/build/source-maps/api.d.mts.map +0 -1
- package/dist/build/source-maps/api.mjs +0 -61
- package/dist/build/source-maps/api.mjs.map +0 -1
- package/dist/build/source-maps/client.d.mts +0 -73
- package/dist/build/source-maps/client.d.mts.map +0 -1
- package/dist/build/source-maps/client.mjs +0 -228
- package/dist/build/source-maps/client.mjs.map +0 -1
- package/dist/build/source-maps/errors.d.mts +0 -109
- package/dist/build/source-maps/errors.d.mts.map +0 -1
- package/dist/build/source-maps/errors.mjs +0 -22
- package/dist/build/source-maps/errors.mjs.map +0 -1
- package/dist/build/source-maps/files.d.mts +0 -35
- package/dist/build/source-maps/files.d.mts.map +0 -1
- package/dist/build/source-maps/files.mjs +0 -222
- package/dist/build/source-maps/files.mjs.map +0 -1
- package/dist/build/source-maps/providers/deployment/detector.d.mts +0 -26
- package/dist/build/source-maps/providers/deployment/detector.d.mts.map +0 -1
- package/dist/build/source-maps/providers/deployment/detector.mjs +0 -22
- package/dist/build/source-maps/providers/deployment/detector.mjs.map +0 -1
- package/dist/build/source-maps/providers/deployment/types.d.mts +0 -12
- package/dist/build/source-maps/providers/deployment/types.d.mts.map +0 -1
- package/dist/build/source-maps/providers/deployment/types.mjs +0 -3
- package/dist/build/source-maps/providers/deployment/vercel.d.mts +0 -6
- package/dist/build/source-maps/providers/deployment/vercel.d.mts.map +0 -1
- package/dist/build/source-maps/providers/deployment/vercel.mjs +0 -44
- package/dist/build/source-maps/providers/deployment/vercel.mjs.map +0 -1
- package/dist/build/source-maps/providers/source-control/detector.d.mts +0 -15
- package/dist/build/source-maps/providers/source-control/detector.d.mts.map +0 -1
- package/dist/build/source-maps/providers/source-control/detector.mjs +0 -22
- package/dist/build/source-maps/providers/source-control/detector.mjs.map +0 -1
- package/dist/build/source-maps/providers/source-control/git.d.mts +0 -6
- package/dist/build/source-maps/providers/source-control/git.d.mts.map +0 -1
- package/dist/build/source-maps/providers/source-control/git.mjs +0 -50
- package/dist/build/source-maps/providers/source-control/git.mjs.map +0 -1
- package/dist/build/source-maps/providers/source-control/types.d.mts +0 -12
- package/dist/build/source-maps/providers/source-control/types.d.mts.map +0 -1
- package/dist/build/source-maps/providers/source-control/types.mjs +0 -3
- package/dist/build/with-interfere.d.mts +0 -70
- package/dist/build/with-interfere.d.mts.map +0 -1
- package/dist/build/with-interfere.mjs +0 -154
- package/dist/build/with-interfere.mjs.map +0 -1
- package/dist/client/auto-init.d.mts +0 -92
- package/dist/client/auto-init.d.mts.map +0 -1
- package/dist/client/auto-init.mjs +0 -121
- package/dist/client/auto-init.mjs.map +0 -1
- package/dist/client/client.d.mts +0 -3
- package/dist/client/client.mjs +0 -5
- package/dist/client/provider.d.mts +0 -22
- package/dist/client/provider.d.mts.map +0 -1
- package/dist/client/provider.mjs +0 -50
- package/dist/client/provider.mjs.map +0 -1
- package/dist/lib/env.d.mts +0 -12
- package/dist/lib/env.d.mts.map +0 -1
- package/dist/lib/env.mjs +0 -17
- package/dist/lib/env.mjs.map +0 -1
- package/dist/lib/test-utils/make-next-request.d.mts +0 -6
- package/dist/lib/test-utils/make-next-request.d.mts.map +0 -1
- package/dist/lib/test-utils/make-next-request.mjs +0 -12
- package/dist/lib/test-utils/make-next-request.mjs.map +0 -1
- package/dist/lib/types.d.mts +0 -22
- package/dist/lib/types.d.mts.map +0 -1
- package/dist/lib/types.mjs +0 -7
- package/dist/lib/types.mjs.map +0 -1
- package/dist/server/middleware.d.mts +0 -11
- package/dist/server/middleware.d.mts.map +0 -1
- package/dist/server/middleware.mjs +0 -85
- package/dist/server/middleware.mjs.map +0 -1
- package/dist/server/proxy.d.mts +0 -6
- package/dist/server/proxy.d.mts.map +0 -1
- package/dist/server/proxy.mjs +0 -30
- package/dist/server/proxy.mjs.map +0 -1
- package/dist/server/route-handler.d.mts +0 -9
- package/dist/server/route-handler.d.mts.map +0 -1
- package/dist/server/route-handler.mjs +0 -172
- package/dist/server/route-handler.mjs.map +0 -1
- package/dist/server/services/config.service.d.mts +0 -21
- package/dist/server/services/config.service.d.mts.map +0 -1
- package/dist/server/services/config.service.mjs +0 -43
- package/dist/server/services/config.service.mjs.map +0 -1
- package/dist/server/services/error-tracking.service.d.mts +0 -19
- package/dist/server/services/error-tracking.service.d.mts.map +0 -1
- package/dist/server/services/error-tracking.service.mjs +0 -31
- package/dist/server/services/error-tracking.service.mjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.mts","names":[],"sources":["../../../src/build/source-maps/files.ts"],"sourcesContent":[],"mappings":";;;;iBAqBgB,kBAAA,CAAA,GAAkB,MAAA,CAAA,iBAAA;iBAclB,uBAAA,mBAAuC,MAAA,CAAA;EAdvC,YAAA,EAAA,MAAA;EAcA,OAAA,EAAA,MAAA;;;AAAuC,iBAoCvC,iBAAA,CApCuC,KAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,OAAA,CAAA,EAoCU,MAAA,CAAA,MApCV,CAAA,IAAA,EAAA,KAAA,EAAA,KAAA,CAAA,GAoCU,MAAA,CAAA,MApCV,CAAA,SAAA,EAoCU,eApCV,EAAA,KAAA,CAAA;AAAA,iBAyFvC,wBAAA,CAzFuC,KAAA,EAAA,OAAA,CAAA,EAyFA,MAAA,CAAA,MAzFA,CAAA,IAAA,EAyFA,aAzFA,GAyFA,eAzFA,EAAA,KAAA,CAAA;AAoCvD;;;AAAiE,iBAoEjD,oBAAA,CAAA,CApEiD,EAoE7B,MAAA,CAAA,MApE6B,CAAA,MAAA,EAAA,EAoE7B,aApE6B,EAAA,KAAA,CAAA;;AAqDjE;;;;;AAeA;AA2HgB,iBAAA,gCAAA,CAAgC,KAAA,EAAA,MAAA,EAAA,CAAA,EAAgB,MAAA,CAAA,MAAhB,CAAgB,MAAhB,CAAA,MAAA,EAAA,MAAA,CAAA,EAAgB,aAAhB,EAAA,KAAA,CAAA;;;;;AA+ChC,iBAAA,oBAAA,CAAoB,KAAA,EAAA,MAAA,EAAA,CAAA,EAAgB,MAAA,CAAA,MAAhB,CAAA;;;EAAgB,IAAA,EAAA,MAAA;CAAA,EAAA,eAAA,gBAAA,EAAA,KAAA,CAAA"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { appendBuildLogLine } from "../logger.mjs";
|
|
2
|
-
import { FileDeleteError, FileGlobError, FileHashError, FileReadError } from "./errors.mjs";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
import { readFile, unlink } from "node:fs/promises";
|
|
5
|
-
import path from "node:path";
|
|
6
|
-
import { glob } from "glob";
|
|
7
|
-
|
|
8
|
-
//#region src/build/source-maps/files.ts
|
|
9
|
-
const SOURCE_MAP_GLOB = ".next/**/*.js.map";
|
|
10
|
-
const JS_GLOB = ".next/**/*.js";
|
|
11
|
-
async function hashString(content) {
|
|
12
|
-
return (await import("crypto")).createHash("sha256").update(content).digest("hex");
|
|
13
|
-
}
|
|
14
|
-
function findSourceMapFiles() {
|
|
15
|
-
return Effect.tryPromise({
|
|
16
|
-
try: () => glob(SOURCE_MAP_GLOB, {
|
|
17
|
-
cwd: process.cwd(),
|
|
18
|
-
absolute: true
|
|
19
|
-
}),
|
|
20
|
-
catch: (error) => new FileGlobError({
|
|
21
|
-
message: `Failed to find source map files: ${String(error)}`,
|
|
22
|
-
pattern: SOURCE_MAP_GLOB
|
|
23
|
-
})
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function readSourceMapsFromFiles(paths) {
|
|
27
|
-
return Effect.forEach(paths, (filePath) => Effect.gen(function* () {
|
|
28
|
-
const content = yield* Effect.tryPromise({
|
|
29
|
-
try: () => readFile(filePath, "utf8"),
|
|
30
|
-
catch: (error) => new FileReadError({
|
|
31
|
-
message: `Failed to read file: ${String(error)}`,
|
|
32
|
-
path: filePath
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
const hash = yield* Effect.tryPromise({
|
|
36
|
-
try: () => hashString(content),
|
|
37
|
-
catch: (error) => new FileHashError({
|
|
38
|
-
message: `Failed to hash file: ${String(error)}`,
|
|
39
|
-
path: filePath
|
|
40
|
-
})
|
|
41
|
-
});
|
|
42
|
-
return {
|
|
43
|
-
relativePath: toPublicUrlPath(path.relative(process.cwd(), filePath).replace(/\\/g, "/")),
|
|
44
|
-
content,
|
|
45
|
-
hash
|
|
46
|
-
};
|
|
47
|
-
}), { concurrency: "unbounded" });
|
|
48
|
-
}
|
|
49
|
-
function cleanupSourceMaps(paths, debug) {
|
|
50
|
-
if (paths.length === 0) return Effect.void;
|
|
51
|
-
return Effect.gen(function* () {
|
|
52
|
-
const results = yield* Effect.forEach(paths, (filePath) => Effect.tryPromise({
|
|
53
|
-
try: () => unlink(filePath),
|
|
54
|
-
catch: (error) => new FileDeleteError({
|
|
55
|
-
message: `Failed to delete file: ${String(error)}`,
|
|
56
|
-
path: filePath
|
|
57
|
-
})
|
|
58
|
-
}).pipe(Effect.map(() => ({
|
|
59
|
-
file: filePath,
|
|
60
|
-
success: true
|
|
61
|
-
})), Effect.catchAll((error) => debug ? Effect.gen(function* () {
|
|
62
|
-
yield* appendBuildLogLine(`Failed to delete source map file ${JSON.stringify({
|
|
63
|
-
file: filePath,
|
|
64
|
-
error: error.message
|
|
65
|
-
})}`);
|
|
66
|
-
return {
|
|
67
|
-
file: filePath,
|
|
68
|
-
success: false
|
|
69
|
-
};
|
|
70
|
-
}) : Effect.succeed({
|
|
71
|
-
file: filePath,
|
|
72
|
-
success: false
|
|
73
|
-
}))), { concurrency: "unbounded" });
|
|
74
|
-
const successful = results.filter((result) => result.success).length;
|
|
75
|
-
const failed = results.length - successful;
|
|
76
|
-
if (successful > 0) yield* appendBuildLogLine(`Cleaned ${successful}/${paths.length} source map files`);
|
|
77
|
-
if (failed > 0 && debug) return yield* Effect.fail(new FileDeleteError({
|
|
78
|
-
message: `Failed to clean up ${failed} source map files - Failing the build to avoid leaking source maps to the public`,
|
|
79
|
-
path: "multiple files"
|
|
80
|
-
}));
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function maybeCleanupAfterFailure(debug) {
|
|
84
|
-
return Effect.gen(function* () {
|
|
85
|
-
const files = yield* findSourceMapFiles();
|
|
86
|
-
if (files.length === 0) return;
|
|
87
|
-
yield* cleanupSourceMaps(files, debug);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Find all generated JavaScript files (excluding source maps)
|
|
92
|
-
*/
|
|
93
|
-
function findGeneratedJsFiles() {
|
|
94
|
-
return Effect.tryPromise({
|
|
95
|
-
try: () => glob(JS_GLOB, {
|
|
96
|
-
cwd: process.cwd(),
|
|
97
|
-
absolute: true,
|
|
98
|
-
ignore: ["**/*.map"]
|
|
99
|
-
}),
|
|
100
|
-
catch: (error) => new FileGlobError({
|
|
101
|
-
message: `Failed to find generated JS files: ${String(error)}`,
|
|
102
|
-
pattern: JS_GLOB
|
|
103
|
-
})
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Regex to extract sourceMappingURL from JS files
|
|
108
|
-
* Matches: //# sourceMappingURL = filename.js.map or //@ sourceMappingURL = filename.js.map
|
|
109
|
-
*/
|
|
110
|
-
const SOURCE_MAPPING_URL_REGEX = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/gm;
|
|
111
|
-
const HTTP_PREFIX_REGEX = /^https?:\/\//i;
|
|
112
|
-
function removeQueryString(value) {
|
|
113
|
-
const queryIndex = value.indexOf("?");
|
|
114
|
-
return queryIndex === -1 ? value : value.slice(0, queryIndex);
|
|
115
|
-
}
|
|
116
|
-
function normalizeReferenceSlashes(value) {
|
|
117
|
-
return value.replace(/\\/g, "/");
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Normalize an absolute reference to the public URL path format.
|
|
121
|
-
* Next.js serves .next/ directory as _next/ in URLs, so we store paths
|
|
122
|
-
* in the _next/ format to match what appears in error stack traces.
|
|
123
|
-
*/
|
|
124
|
-
function normalizeAbsoluteReference(value) {
|
|
125
|
-
const trimmed = normalizeReferenceSlashes(value).replace(/^\/+/, "");
|
|
126
|
-
const publicIndex = trimmed.indexOf("_next/");
|
|
127
|
-
if (publicIndex !== -1) return trimmed.slice(publicIndex);
|
|
128
|
-
const buildIndex = trimmed.indexOf(".next/");
|
|
129
|
-
if (buildIndex !== -1) return `_next/${trimmed.slice(buildIndex + 6)}`;
|
|
130
|
-
return trimmed;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Extract sourceMappingURL reference from JS file content
|
|
134
|
-
*/
|
|
135
|
-
function extractSourceMappingReference(content) {
|
|
136
|
-
SOURCE_MAPPING_URL_REGEX.lastIndex = 0;
|
|
137
|
-
const match = SOURCE_MAPPING_URL_REGEX.exec(content);
|
|
138
|
-
if (match && match[1]) return match[1].trim();
|
|
139
|
-
return null;
|
|
140
|
-
}
|
|
141
|
-
function resolveSourceMapRelativePath(jsRelativePath, reference) {
|
|
142
|
-
if (!reference) return null;
|
|
143
|
-
const withoutQuery = removeQueryString(reference);
|
|
144
|
-
if (!withoutQuery) return null;
|
|
145
|
-
const normalizedReference = normalizeReferenceSlashes(withoutQuery);
|
|
146
|
-
if (HTTP_PREFIX_REGEX.test(normalizedReference)) try {
|
|
147
|
-
return normalizeAbsoluteReference(new URL(normalizedReference).pathname);
|
|
148
|
-
} catch {
|
|
149
|
-
return normalizeAbsoluteReference(normalizedReference);
|
|
150
|
-
}
|
|
151
|
-
if (normalizedReference.startsWith("/")) return normalizeAbsoluteReference(normalizedReference);
|
|
152
|
-
const jsDirectory = path.posix.dirname(jsRelativePath);
|
|
153
|
-
return toPublicUrlPath(normalizeReferenceSlashes(path.posix.normalize(path.posix.join(jsDirectory, normalizedReference))));
|
|
154
|
-
}
|
|
155
|
-
const NEXT_BUILD_TO_PUBLIC_REGEX = /^\.next\//;
|
|
156
|
-
/**
|
|
157
|
-
* Convert a build path to a public URL path.
|
|
158
|
-
* Next.js serves .next/ directory as _next/ in URLs.
|
|
159
|
-
* So on our backend we store it as the public URL path since that's what appears in error stack traces.
|
|
160
|
-
*/
|
|
161
|
-
function toPublicUrlPath(buildPath) {
|
|
162
|
-
return buildPath.replace(NEXT_BUILD_TO_PUBLIC_REGEX, "_next/");
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Read generated JS files and extract sourceMappingURL to build a mapping.
|
|
166
|
-
* Returns a map: sourceMapFilename -> generatedJsFilePath
|
|
167
|
-
*
|
|
168
|
-
* Both keys and values are in public URL format (_next/...) to match
|
|
169
|
-
* what appears in error stack traces, making the backend framework-agnostic.
|
|
170
|
-
*/
|
|
171
|
-
function buildSourceMapToGeneratedMapping(paths) {
|
|
172
|
-
return Effect.forEach(paths, (filePath) => Effect.gen(function* () {
|
|
173
|
-
const content = yield* Effect.tryPromise({
|
|
174
|
-
try: () => readFile(filePath, "utf8"),
|
|
175
|
-
catch: (error) => new FileReadError({
|
|
176
|
-
message: `Failed to read file: ${String(error)}`,
|
|
177
|
-
path: filePath
|
|
178
|
-
})
|
|
179
|
-
});
|
|
180
|
-
const relativePath = path.relative(process.cwd(), filePath).replace(/\\/g, "/");
|
|
181
|
-
const sourceMapReference = extractSourceMappingReference(content);
|
|
182
|
-
const sourceMapRelativePath = sourceMapReference ? resolveSourceMapRelativePath(relativePath, sourceMapReference) : null;
|
|
183
|
-
return {
|
|
184
|
-
generatedFilePath: toPublicUrlPath(relativePath),
|
|
185
|
-
sourceMapRelativePath
|
|
186
|
-
};
|
|
187
|
-
}), { concurrency: "unbounded" }).pipe(Effect.map((results) => {
|
|
188
|
-
const mapping = {};
|
|
189
|
-
for (const result of results) if (result.sourceMapRelativePath) mapping[result.sourceMapRelativePath] = result.generatedFilePath;
|
|
190
|
-
return mapping;
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Read generated JS files from disk
|
|
195
|
-
* @deprecated Use buildSourceMapToGeneratedMapping instead - we no longer upload JS files
|
|
196
|
-
*/
|
|
197
|
-
function readGeneratedJsFiles(paths) {
|
|
198
|
-
return Effect.forEach(paths, (filePath) => Effect.gen(function* () {
|
|
199
|
-
const content = yield* Effect.tryPromise({
|
|
200
|
-
try: () => readFile(filePath, "utf8"),
|
|
201
|
-
catch: (error) => new FileReadError({
|
|
202
|
-
message: `Failed to read file: ${String(error)}`,
|
|
203
|
-
path: filePath
|
|
204
|
-
})
|
|
205
|
-
});
|
|
206
|
-
const hash = yield* Effect.tryPromise({
|
|
207
|
-
try: () => hashString(content),
|
|
208
|
-
catch: (error) => new FileHashError({
|
|
209
|
-
message: `Failed to hash file: ${String(error)}`,
|
|
210
|
-
path: filePath
|
|
211
|
-
})
|
|
212
|
-
});
|
|
213
|
-
return {
|
|
214
|
-
relativePath: path.relative(process.cwd(), filePath).replace(/\\/g, "/"),
|
|
215
|
-
content,
|
|
216
|
-
hash
|
|
217
|
-
};
|
|
218
|
-
}), { concurrency: "unbounded" });
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
//#endregion
|
|
222
|
-
export { buildSourceMapToGeneratedMapping, cleanupSourceMaps, findGeneratedJsFiles, findSourceMapFiles, maybeCleanupAfterFailure, readGeneratedJsFiles, readSourceMapsFromFiles };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"files.mjs","names":["mapping: Record<string, string>"],"sources":["../../../src/build/source-maps/files.ts"],"sourcesContent":["import { readFile, unlink } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { Effect } from \"effect\";\nimport { glob } from \"glob\";\nimport { appendBuildLogLine } from \"../logger.js\";\nimport {\n FileDeleteError,\n FileGlobError,\n FileHashError,\n FileReadError,\n} from \"./errors.js\";\n\nconst SOURCE_MAP_GLOB = \".next/**/*.js.map\";\nconst JS_GLOB = \".next/**/*.js\";\n\nasync function hashString(content: string) {\n const crypto = await import(\"crypto\");\n\n return crypto.createHash(\"sha256\").update(content).digest(\"hex\");\n}\n\nexport function findSourceMapFiles() {\n return Effect.tryPromise({\n try: () =>\n glob(SOURCE_MAP_GLOB, {\n cwd: process.cwd(),\n absolute: true,\n }),\n catch: (error) => new FileGlobError({\n message: `Failed to find source map files: ${String(error)}`,\n pattern: SOURCE_MAP_GLOB,\n }),\n });\n}\n\nexport function readSourceMapsFromFiles(paths: string[]) {\n return Effect.forEach(\n paths,\n (filePath) =>\n Effect.gen(function* () {\n const content = yield* Effect.tryPromise({\n try: () => readFile(filePath, \"utf8\"),\n catch: (error) => new FileReadError({\n message: `Failed to read file: ${String(error)}`,\n path: filePath,\n }),\n });\n\n const hash = yield* Effect.tryPromise({\n try: () => hashString(content),\n catch: (error) => new FileHashError({\n message: `Failed to hash file: ${String(error)}`,\n path: filePath,\n }),\n });\n\n const relativePath = path.relative(process.cwd(), filePath).replace(\n /\\\\/g,\n \"/\"\n );\n\n return {\n relativePath: toPublicUrlPath(relativePath),\n content,\n hash,\n };\n }),\n { concurrency: \"unbounded\" }\n );\n}\n\nexport function cleanupSourceMaps(paths: string[], debug: boolean) {\n if (paths.length === 0) {\n return Effect.void;\n }\n\n return Effect.gen(function* () {\n const results = yield* Effect.forEach(\n paths,\n (filePath) =>\n Effect.tryPromise({\n try: () => unlink(filePath),\n catch: (error) => new FileDeleteError({\n message: `Failed to delete file: ${String(error)}`,\n path: filePath,\n }),\n }).pipe(\n Effect.map(() => ({ file: filePath, success: true })),\n Effect.catchAll((error) =>\n debug\n ? Effect.gen(function* () {\n yield* appendBuildLogLine(\n `Failed to delete source map file ${JSON.stringify({\n file: filePath,\n error: error.message,\n })}`\n );\n\n return { file: filePath, success: false };\n })\n : Effect.succeed({ file: filePath, success: false })\n )\n ),\n { concurrency: \"unbounded\" }\n );\n\n const successful = results.filter((result) => result.success).length;\n const failed = results.length - successful;\n\n if (successful > 0) {\n yield* appendBuildLogLine(\n `Cleaned ${successful}/${paths.length} source map files`\n );\n }\n\n if (failed > 0 && debug) {\n return yield* Effect.fail(new FileDeleteError({\n message: `Failed to clean up ${failed} source map files - Failing the build to avoid leaking source maps to the public`,\n path: \"multiple files\",\n }));\n }\n });\n}\n\nexport function maybeCleanupAfterFailure(debug: boolean) {\n return Effect.gen(function* () {\n const files = yield* findSourceMapFiles();\n\n if (files.length === 0) {\n return;\n }\n\n yield* cleanupSourceMaps(files, debug);\n });\n}\n\n/**\n * Find all generated JavaScript files (excluding source maps)\n */\nexport function findGeneratedJsFiles() {\n return Effect.tryPromise({\n try: () =>\n glob(JS_GLOB, {\n cwd: process.cwd(),\n absolute: true,\n ignore: [\"**/*.map\"], // Exclude source map files\n }),\n catch: (error) => new FileGlobError({\n message: `Failed to find generated JS files: ${String(error)}`,\n pattern: JS_GLOB,\n }),\n });\n}\n\n/**\n * Regex to extract sourceMappingURL from JS files\n * Matches: //# sourceMappingURL = filename.js.map or //@ sourceMappingURL = filename.js.map\n */\nconst SOURCE_MAPPING_URL_REGEX = /\\/\\/[#@] ?sourceMappingURL=([^\\s'\"]+)\\s*$/gm;\n\nconst HTTP_PREFIX_REGEX = /^https?:\\/\\//i;\n\nfunction removeQueryString(value: string): string {\n const queryIndex = value.indexOf(\"?\");\n return queryIndex === -1 ? value : value.slice(0, queryIndex);\n}\n\nfunction normalizeReferenceSlashes(value: string): string {\n return value.replace(/\\\\/g, \"/\");\n}\n\n/**\n * Normalize an absolute reference to the public URL path format.\n * Next.js serves .next/ directory as _next/ in URLs, so we store paths\n * in the _next/ format to match what appears in error stack traces.\n */\nfunction normalizeAbsoluteReference(value: string): string {\n const normalized = normalizeReferenceSlashes(value);\n const trimmed = normalized.replace(/^\\/+/, \"\");\n\n // If it already has _next/, extract from there (handles CDN prefixes like /prod/_next/)\n const publicIndex = trimmed.indexOf(\"_next/\");\n if (publicIndex !== -1) {\n return trimmed.slice(publicIndex);\n }\n\n // Convert .next/ build path to _next/ public URL path\n const buildIndex = trimmed.indexOf(\".next/\");\n if (buildIndex !== -1) {\n return `_next/${trimmed.slice(buildIndex + \".next/\".length)}`;\n }\n\n return trimmed;\n}\n\n/**\n * Extract sourceMappingURL reference from JS file content\n */\nfunction extractSourceMappingReference(content: string): string | null {\n SOURCE_MAPPING_URL_REGEX.lastIndex = 0;\n const match = SOURCE_MAPPING_URL_REGEX.exec(content);\n if (match && match[1]) {\n return match[1].trim();\n }\n return null;\n}\n\nfunction resolveSourceMapRelativePath(\n jsRelativePath: string,\n reference: string\n): string | null {\n if (!reference) {\n return null;\n }\n\n const withoutQuery = removeQueryString(reference);\n if (!withoutQuery) {\n return null;\n }\n\n const normalizedReference = normalizeReferenceSlashes(withoutQuery);\n\n if (HTTP_PREFIX_REGEX.test(normalizedReference)) {\n try {\n const url = new URL(normalizedReference);\n return normalizeAbsoluteReference(url.pathname);\n } catch {\n return normalizeAbsoluteReference(normalizedReference);\n }\n }\n\n if (normalizedReference.startsWith(\"/\")) {\n return normalizeAbsoluteReference(normalizedReference);\n }\n\n const jsDirectory = path.posix.dirname(jsRelativePath);\n const resolved = path.posix.normalize(\n path.posix.join(jsDirectory, normalizedReference)\n );\n\n return toPublicUrlPath(normalizeReferenceSlashes(resolved));\n}\n\n// Regex to convert .next/ build paths to _next/ public URL paths\nconst NEXT_BUILD_TO_PUBLIC_REGEX = /^\\.next\\//;\n\n/**\n * Convert a build path to a public URL path.\n * Next.js serves .next/ directory as _next/ in URLs.\n * So on our backend we store it as the public URL path since that's what appears in error stack traces.\n */\nfunction toPublicUrlPath(buildPath: string): string {\n return buildPath.replace(NEXT_BUILD_TO_PUBLIC_REGEX, \"_next/\");\n}\n\n/**\n * Read generated JS files and extract sourceMappingURL to build a mapping.\n * Returns a map: sourceMapFilename -> generatedJsFilePath\n * \n * Both keys and values are in public URL format (_next/...) to match\n * what appears in error stack traces, making the backend framework-agnostic.\n */\nexport function buildSourceMapToGeneratedMapping(paths: string[]) {\n return Effect.forEach(\n paths,\n (filePath) =>\n Effect.gen(function* () {\n const content = yield* Effect.tryPromise({\n try: () => readFile(filePath, \"utf8\"),\n catch: (error) => new FileReadError({\n message: `Failed to read file: ${String(error)}`,\n path: filePath,\n }),\n });\n\n const relativePath = path\n .relative(process.cwd(), filePath)\n .replace(/\\\\/g, \"/\");\n\n const sourceMapReference = extractSourceMappingReference(content);\n const sourceMapRelativePath = sourceMapReference\n ? resolveSourceMapRelativePath(relativePath, sourceMapReference)\n : null;\n\n return {\n // Convert .next/ to _next/ for public URL format\n generatedFilePath: toPublicUrlPath(relativePath),\n sourceMapRelativePath,\n };\n }),\n { concurrency: \"unbounded\" }\n ).pipe(\n Effect.map((results) => {\n // Build reverse mapping: sourceMapRelativePath -> generatedFilePath\n const mapping: Record<string, string> = {};\n for (const result of results) {\n if (result.sourceMapRelativePath) {\n mapping[result.sourceMapRelativePath] = result.generatedFilePath;\n }\n }\n return mapping;\n })\n );\n}\n\n/**\n * Read generated JS files from disk\n * @deprecated Use buildSourceMapToGeneratedMapping instead - we no longer upload JS files\n */\nexport function readGeneratedJsFiles(paths: string[]) {\n return Effect.forEach(\n paths,\n (filePath) =>\n Effect.gen(function* () {\n const content = yield* Effect.tryPromise({\n try: () => readFile(filePath, \"utf8\"),\n catch: (error) => new FileReadError({\n message: `Failed to read file: ${String(error)}`,\n path: filePath,\n }),\n });\n\n const hash = yield* Effect.tryPromise({\n try: () => hashString(content),\n catch: (error) => new FileHashError({\n message: `Failed to hash file: ${String(error)}`,\n path: filePath,\n }),\n });\n\n const relativePath = path\n .relative(process.cwd(), filePath)\n .replace(/\\\\/g, \"/\");\n\n return {\n relativePath,\n content,\n hash,\n };\n }),\n { concurrency: \"unbounded\" }\n );\n}\n\n\n\n\n"],"mappings":"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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { NoDeploymentError } from "../../errors.mjs";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region src/build/source-maps/providers/deployment/detector.d.ts
|
|
5
|
-
declare function detectDeployment(): Effect.Effect<{
|
|
6
|
-
type: "vercel";
|
|
7
|
-
metadata: {
|
|
8
|
-
type: "vercel";
|
|
9
|
-
deployment: {
|
|
10
|
-
id: string | null;
|
|
11
|
-
url: string | null;
|
|
12
|
-
};
|
|
13
|
-
env: {
|
|
14
|
-
name: string | null;
|
|
15
|
-
target: string | null;
|
|
16
|
-
};
|
|
17
|
-
project: {
|
|
18
|
-
id: string | null;
|
|
19
|
-
productionUrl: string | null;
|
|
20
|
-
};
|
|
21
|
-
region: string | null;
|
|
22
|
-
skewProtectionEnabled: boolean | null;
|
|
23
|
-
};
|
|
24
|
-
}, NoDeploymentError, never>;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { detectDeployment };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/deployment/detector.ts"],"sourcesContent":[],"mappings":";;;;iBAQgB,gBAAA,CAAA,GAAgB,MAAA,CAAA;;EAAhB,QAAA,EAAA;;;;;;;;;;;;;;;;;GAAgB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NoDeploymentError } from "../../errors.mjs";
|
|
2
|
-
import { vercelProvider } from "./vercel.mjs";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
|
|
5
|
-
//#region src/build/source-maps/providers/deployment/detector.ts
|
|
6
|
-
const providers = [vercelProvider];
|
|
7
|
-
function detectDeployment() {
|
|
8
|
-
return Effect.gen(function* () {
|
|
9
|
-
for (const provider of providers) {
|
|
10
|
-
if (!(yield* provider.detect)) continue;
|
|
11
|
-
const metadata = yield* provider.getMetadata;
|
|
12
|
-
return {
|
|
13
|
-
type: provider.type,
|
|
14
|
-
metadata
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return yield* Effect.fail(new NoDeploymentError({ message: `No source map deployment provider detected, supported providers: ${providers.map((p) => p.type).join(", ")}` }));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { detectDeployment };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detector.mjs","names":["providers: DeploymentProvider[]"],"sources":["../../../../../src/build/source-maps/providers/deployment/detector.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport { NoDeploymentError } from \"../../errors.js\";\nimport type { DeploymentProvider } from \"./types.js\";\nimport { vercelProvider } from \"./vercel.js\";\n\nconst providers: DeploymentProvider[] = [vercelProvider];\n\nexport function detectDeployment() {\n return Effect.gen(function* () {\n for (const provider of providers) {\n const supported = yield* provider.detect;\n\n if (!supported) {\n continue;\n }\n\n const metadata = yield* provider.getMetadata;\n\n return {\n type: provider.type,\n metadata: metadata,\n };\n }\n\n return yield* Effect.fail(\n new NoDeploymentError({ message: `No source map deployment provider detected, supported providers: ${providers.map((p) => p.type).join(\", \")}` })\n );\n });\n}\n\n\n"],"mappings":";;;;;AAMA,MAAMA,YAAkC,CAAC,eAAe;AAExD,SAAgB,mBAAmB;AACjC,QAAO,OAAO,IAAI,aAAa;AAC7B,OAAK,MAAM,YAAY,WAAW;AAGhC,OAAI,EAFc,OAAO,SAAS,QAGhC;GAGF,MAAM,WAAW,OAAO,SAAS;AAEjC,UAAO;IACL,MAAM,SAAS;IACL;IACX;;AAGH,SAAO,OAAO,OAAO,KACnB,IAAI,kBAAkB,EAAE,SAAS,oEAAoE,UAAU,KAAK,MAAM,EAAE,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAClJ;GACD"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NoDeploymentError } from "../../errors.mjs";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { ReleaseDestinationMetadata, ReleaseDestinationType } from "@interfere/types/releases/definition";
|
|
4
|
-
|
|
5
|
-
//#region src/build/source-maps/providers/deployment/types.d.ts
|
|
6
|
-
type DeploymentProvider = {
|
|
7
|
-
type: ReleaseDestinationType;
|
|
8
|
-
detect: Effect.Effect<boolean>;
|
|
9
|
-
getMetadata: Effect.Effect<ReleaseDestinationMetadata, NoDeploymentError>;
|
|
10
|
-
};
|
|
11
|
-
//#endregion
|
|
12
|
-
export { DeploymentProvider };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/deployment/types.ts"],"sourcesContent":[],"mappings":";;;;;KASY,kBAAA;QACJ;EADI,MAAA,EAEF,MAAA,CAAO,MAFa,CAAA,OAAA,CAAA;EACtB,WAAA,EAEO,MAAA,CAAO,MAFd,CAGJ,0BAHI,EAIJ,iBAJI,CAAA;CACE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/deployment/vercel.ts"],"sourcesContent":[],"mappings":";;;cA+Ca,gBAAgB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { appendBuildLogLine } from "../../../logger.mjs";
|
|
2
|
-
import { NoDeploymentError } from "../../errors.mjs";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
import { cloudPlatformTypeSchema } from "@interfere/types/releases/targets/cloud-platform";
|
|
5
|
-
|
|
6
|
-
//#region src/build/source-maps/providers/deployment/vercel.ts
|
|
7
|
-
const providerType = cloudPlatformTypeSchema.enum.vercel;
|
|
8
|
-
function resolveReleaseId() {
|
|
9
|
-
return process.env.VERCEL_DEPLOYMENT_ID ?? null;
|
|
10
|
-
}
|
|
11
|
-
function buildMetadata() {
|
|
12
|
-
return {
|
|
13
|
-
type: cloudPlatformTypeSchema.enum.vercel,
|
|
14
|
-
deployment: {
|
|
15
|
-
id: process.env.VERCEL_DEPLOYMENT_ID ?? null,
|
|
16
|
-
url: process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}` : null
|
|
17
|
-
},
|
|
18
|
-
env: {
|
|
19
|
-
name: process.env.VERCEL_ENV ?? null,
|
|
20
|
-
target: process.env.VERCEL_TARGET_ENV ?? null
|
|
21
|
-
},
|
|
22
|
-
project: {
|
|
23
|
-
id: process.env.VERCEL_PROJECT_ID ?? null,
|
|
24
|
-
productionUrl: process.env.VERCEL_PROJECT_PRODUCTION_URL ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}` : null
|
|
25
|
-
},
|
|
26
|
-
region: process.env.VERCEL_REGION ?? null,
|
|
27
|
-
skewProtectionEnabled: process.env.VERCEL_SKEW_PROTECTION_ENABLED === "1" ? true : null
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const vercelProvider = {
|
|
31
|
-
type: providerType,
|
|
32
|
-
detect: Effect.sync(() => process.env.VERCEL === "1"),
|
|
33
|
-
getMetadata: Effect.gen(function* () {
|
|
34
|
-
if (!resolveReleaseId()) {
|
|
35
|
-
yield* appendBuildLogLine("Vercel system environment variables not available for deployment metadata");
|
|
36
|
-
yield* appendBuildLogLine("Enable 'Automatically expose System Environment Variables' in your Vercel project settings.");
|
|
37
|
-
return yield* Effect.fail(new NoDeploymentError({ message: "Could not determine Vercel deployment id from system environment variables" }));
|
|
38
|
-
}
|
|
39
|
-
return buildMetadata();
|
|
40
|
-
})
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
export { vercelProvider };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vercel.mjs","names":["providerType: ReleaseDestinationType","vercelProvider: DeploymentProvider"],"sources":["../../../../../src/build/source-maps/providers/deployment/vercel.ts"],"sourcesContent":["import type {\n ReleaseDestinationMetadata,\n ReleaseDestinationType,\n} from \"@interfere/types/releases/definition\";\nimport {\n type CloudPlatformMetadata,\n cloudPlatformTypeSchema,\n} from \"@interfere/types/releases/targets/cloud-platform\";\nimport { Effect } from \"effect\";\nimport { appendBuildLogLine } from \"../../../logger.js\";\nimport { NoDeploymentError } from \"../../errors.js\";\nimport type { DeploymentProvider } from \"./types.js\";\n\nconst providerType: ReleaseDestinationType =\n cloudPlatformTypeSchema.enum.vercel;\n\nfunction resolveReleaseId(): string | null {\n return process.env.VERCEL_DEPLOYMENT_ID ?? null;\n}\n\nfunction buildMetadata(): ReleaseDestinationMetadata {\n const metadata: CloudPlatformMetadata = {\n type: cloudPlatformTypeSchema.enum.vercel,\n deployment: {\n id: process.env.VERCEL_DEPLOYMENT_ID ?? null,\n url: process.env.VERCEL_URL\n ? `https://${process.env.VERCEL_URL}`\n : null,\n },\n env: {\n name: process.env.VERCEL_ENV ?? null,\n target: process.env.VERCEL_TARGET_ENV ?? null,\n },\n project: {\n id: process.env.VERCEL_PROJECT_ID ?? null,\n productionUrl: process.env.VERCEL_PROJECT_PRODUCTION_URL\n ? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`\n : null,\n },\n region: process.env.VERCEL_REGION ?? null,\n skewProtectionEnabled:\n process.env.VERCEL_SKEW_PROTECTION_ENABLED === \"1\" ? true : null,\n };\n\n return metadata;\n}\n\nexport const vercelProvider: DeploymentProvider = {\n type: providerType,\n // Detect Vercel by its ambient env var; this tells us we're running on Vercel\n // even if system env vars are not exposed yet.\n detect: Effect.sync(() => process.env.VERCEL === \"1\"),\n getMetadata: Effect.gen(function* () {\n const releaseId = resolveReleaseId();\n\n if (!releaseId) {\n // We're on Vercel, but the relevant system env vars are missing.\n // This usually means \"Automatically expose System Environment Variables\"\n // is disabled in the project settings.\n yield* appendBuildLogLine(\n \"Vercel system environment variables not available for deployment metadata\"\n );\n\n yield* appendBuildLogLine(\n \"Enable 'Automatically expose System Environment Variables' in your Vercel project settings.\"\n );\n\n return yield* Effect.fail(\n new NoDeploymentError({\n message: \"Could not determine Vercel deployment id from system environment variables\"\n })\n );\n }\n\n return buildMetadata();\n }),\n};\n"],"mappings":";;;;;;AAaA,MAAMA,eACJ,wBAAwB,KAAK;AAE/B,SAAS,mBAAkC;AACzC,QAAO,QAAQ,IAAI,wBAAwB;;AAG7C,SAAS,gBAA4C;AAwBnD,QAvBwC;EACtC,MAAM,wBAAwB,KAAK;EACnC,YAAY;GACV,IAAI,QAAQ,IAAI,wBAAwB;GACxC,KAAK,QAAQ,IAAI,aACb,WAAW,QAAQ,IAAI,eACvB;GACL;EACD,KAAK;GACH,MAAM,QAAQ,IAAI,cAAc;GAChC,QAAQ,QAAQ,IAAI,qBAAqB;GAC1C;EACD,SAAS;GACP,IAAI,QAAQ,IAAI,qBAAqB;GACrC,eAAe,QAAQ,IAAI,gCACvB,WAAW,QAAQ,IAAI,kCACvB;GACL;EACD,QAAQ,QAAQ,IAAI,iBAAiB;EACrC,uBACE,QAAQ,IAAI,mCAAmC,MAAM,OAAO;EAC/D;;AAKH,MAAaC,iBAAqC;CAChD,MAAM;CAGN,QAAQ,OAAO,WAAW,QAAQ,IAAI,WAAW,IAAI;CACrD,aAAa,OAAO,IAAI,aAAa;AAGnC,MAAI,CAFc,kBAAkB,EAEpB;AAId,UAAO,mBACL,4EACD;AAED,UAAO,mBACL,8FACD;AAED,UAAO,OAAO,OAAO,KACnB,IAAI,kBAAkB,EACpB,SAAS,8EACV,CAAC,CACH;;AAGH,SAAO,eAAe;GACtB;CACH"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SourceControlDetectionError } from "../../errors.mjs";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
|
|
4
|
-
//#region src/build/source-maps/providers/source-control/detector.d.ts
|
|
5
|
-
declare function detectSourceControl(): Effect.Effect<{
|
|
6
|
-
type: "git";
|
|
7
|
-
metadata: {
|
|
8
|
-
type: "git";
|
|
9
|
-
gitCommitMessage: string;
|
|
10
|
-
gitBranch: string;
|
|
11
|
-
gitCommitSha: string;
|
|
12
|
-
};
|
|
13
|
-
}, SourceControlDetectionError, never>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { detectSourceControl };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/source-control/detector.ts"],"sourcesContent":[],"mappings":";;;;iBAQgB,mBAAA,CAAA,GAAmB,MAAA,CAAA;;EAAnB,QAAA,EAAA;;;;;;GAAmB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { SourceControlDetectionError } from "../../errors.mjs";
|
|
2
|
-
import { gitProvider } from "./git.mjs";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
|
|
5
|
-
//#region src/build/source-maps/providers/source-control/detector.ts
|
|
6
|
-
const providers = [gitProvider];
|
|
7
|
-
function detectSourceControl() {
|
|
8
|
-
return Effect.gen(function* () {
|
|
9
|
-
for (const provider of providers) {
|
|
10
|
-
if (!(yield* provider.detect)) continue;
|
|
11
|
-
const metadata = yield* provider.getMetadata;
|
|
12
|
-
return {
|
|
13
|
-
type: provider.type,
|
|
14
|
-
metadata
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return yield* Effect.fail(new SourceControlDetectionError({ message: "No source control provider detected" }));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
//#endregion
|
|
22
|
-
export { detectSourceControl };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"detector.mjs","names":["providers: SourceControlProvider[]"],"sources":["../../../../../src/build/source-maps/providers/source-control/detector.ts"],"sourcesContent":["import { Effect } from \"effect\";\n\nimport { SourceControlDetectionError } from \"../../errors.js\";\nimport { gitProvider } from \"./git.js\";\nimport type { SourceControlProvider } from \"./types.js\";\n\nconst providers: SourceControlProvider[] = [gitProvider];\n\nexport function detectSourceControl() {\n return Effect.gen(function* () {\n for (const provider of providers) {\n const supported = yield* provider.detect;\n\n if (!supported) {\n continue;\n }\n\n const metadata = yield* provider.getMetadata;\n\n return {\n type: provider.type,\n metadata: metadata,\n };\n }\n\n return yield* Effect.fail(\n new SourceControlDetectionError({ message: \"No source control provider detected\" })\n );\n });\n}\n\n\n"],"mappings":";;;;;AAMA,MAAMA,YAAqC,CAAC,YAAY;AAExD,SAAgB,sBAAsB;AACpC,QAAO,OAAO,IAAI,aAAa;AAC7B,OAAK,MAAM,YAAY,WAAW;AAGhC,OAAI,EAFc,OAAO,SAAS,QAGhC;GAGF,MAAM,WAAW,OAAO,SAAS;AAEjC,UAAO;IACL,MAAM,SAAS;IACL;IACX;;AAGH,SAAO,OAAO,OAAO,KACnB,IAAI,4BAA4B,EAAE,SAAS,uCAAuC,CAAC,CACpF;GACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/source-control/git.ts"],"sourcesContent":[],"mappings":";;;cA4Da,aAAa"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { SourceControlDetectionError } from "../../errors.mjs";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { versionControlTypeSchema } from "@interfere/types/releases/sources/version-control";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
|
|
6
|
-
//#region src/build/source-maps/providers/source-control/git.ts
|
|
7
|
-
function getGitSha() {
|
|
8
|
-
try {
|
|
9
|
-
return execSync("git rev-parse HEAD", { encoding: "utf8" }).trim();
|
|
10
|
-
} catch {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function getGitBranch() {
|
|
15
|
-
try {
|
|
16
|
-
return execSync("git rev-parse --abbrev-ref HEAD", { encoding: "utf8" }).trim();
|
|
17
|
-
} catch {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function getCommitMessage() {
|
|
22
|
-
try {
|
|
23
|
-
return execSync("git log -1 --pretty=%B", { encoding: "utf8" }).trim();
|
|
24
|
-
} catch {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const providerType = versionControlTypeSchema.enum.git;
|
|
29
|
-
function buildMetadata(sourceId) {
|
|
30
|
-
const branch = getGitBranch();
|
|
31
|
-
const commitMessage = getCommitMessage();
|
|
32
|
-
return {
|
|
33
|
-
type: versionControlTypeSchema.enum.git,
|
|
34
|
-
gitCommitMessage: commitMessage ?? "",
|
|
35
|
-
gitBranch: branch ?? "",
|
|
36
|
-
gitCommitSha: sourceId
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
const gitProvider = {
|
|
40
|
-
type: providerType,
|
|
41
|
-
detect: Effect.sync(() => getGitSha() !== null),
|
|
42
|
-
getMetadata: Effect.gen(function* () {
|
|
43
|
-
const sha = getGitSha();
|
|
44
|
-
if (!sha) return yield* Effect.fail(new SourceControlDetectionError({ message: "Could not determine git SHA" }));
|
|
45
|
-
return buildMetadata(sha);
|
|
46
|
-
})
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
//#endregion
|
|
50
|
-
export { gitProvider };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git.mjs","names":["providerType: ReleaseSourceType","gitProvider: SourceControlProvider"],"sources":["../../../../../src/build/source-maps/providers/source-control/git.ts"],"sourcesContent":["import type {\n ReleaseSourceMetadata,\n ReleaseSourceType,\n} from \"@interfere/types/releases/definition\";\n\nimport {\n type VersionControlMetadata,\n versionControlTypeSchema,\n} from \"@interfere/types/releases/sources/version-control\";\n\nimport { execSync } from \"child_process\";\n\nimport { Effect } from \"effect\";\n\nimport { SourceControlDetectionError } from \"../../errors.js\";\nimport type { SourceControlProvider } from \"./types.js\";\n\n// Git helper functions (only used within this provider)\nfunction getGitSha(): string | null {\n try {\n return execSync(\"git rev-parse HEAD\", { encoding: \"utf8\" }).trim();\n } catch {\n return null;\n }\n}\n\nfunction getGitBranch(): string | null {\n try {\n return execSync(\"git rev-parse --abbrev-ref HEAD\", {\n encoding: \"utf8\",\n }).trim();\n } catch {\n return null;\n }\n}\n\nfunction getCommitMessage(): string | null {\n try {\n return execSync(\"git log -1 --pretty=%B\", { encoding: \"utf8\" }).trim();\n } catch {\n return null;\n }\n}\n\nconst providerType: ReleaseSourceType = versionControlTypeSchema.enum.git;\n\nfunction buildMetadata(sourceId: string): ReleaseSourceMetadata {\n const branch = getGitBranch();\n const commitMessage = getCommitMessage();\n\n const metadata = {\n type: versionControlTypeSchema.enum.git,\n gitCommitMessage: commitMessage ?? \"\",\n gitBranch: branch ?? \"\",\n gitCommitSha: sourceId,\n } satisfies VersionControlMetadata;\n\n return metadata;\n}\n\nexport const gitProvider: SourceControlProvider = {\n type: providerType,\n detect: Effect.sync(() => getGitSha() !== null),\n getMetadata: Effect.gen(function* () {\n const sha = getGitSha();\n\n if (!sha) {\n return yield* Effect.fail(\n new SourceControlDetectionError({ message: \"Could not determine git SHA\" })\n );\n }\n\n return buildMetadata(sha);\n }),\n};\n\n\n"],"mappings":";;;;;;AAkBA,SAAS,YAA2B;AAClC,KAAI;AACF,SAAO,SAAS,sBAAsB,EAAE,UAAU,QAAQ,CAAC,CAAC,MAAM;SAC5D;AACN,SAAO;;;AAIX,SAAS,eAA8B;AACrC,KAAI;AACF,SAAO,SAAS,mCAAmC,EACjD,UAAU,QACX,CAAC,CAAC,MAAM;SACH;AACN,SAAO;;;AAIX,SAAS,mBAAkC;AACzC,KAAI;AACF,SAAO,SAAS,0BAA0B,EAAE,UAAU,QAAQ,CAAC,CAAC,MAAM;SAChE;AACN,SAAO;;;AAIX,MAAMA,eAAkC,yBAAyB,KAAK;AAEtE,SAAS,cAAc,UAAyC;CAC9D,MAAM,SAAS,cAAc;CAC7B,MAAM,gBAAgB,kBAAkB;AASxC,QAPiB;EACf,MAAM,yBAAyB,KAAK;EACpC,kBAAkB,iBAAiB;EACnC,WAAW,UAAU;EACrB,cAAc;EACf;;AAKH,MAAaC,cAAqC;CAChD,MAAM;CACN,QAAQ,OAAO,WAAW,WAAW,KAAK,KAAK;CAC/C,aAAa,OAAO,IAAI,aAAa;EACnC,MAAM,MAAM,WAAW;AAEvB,MAAI,CAAC,IACH,QAAO,OAAO,OAAO,KACnB,IAAI,4BAA4B,EAAE,SAAS,+BAA+B,CAAC,CAC5E;AAGH,SAAO,cAAc,IAAI;GACzB;CACH"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { SourceControlDetectionError } from "../../errors.mjs";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import { ReleaseSourceMetadata, ReleaseSourceType } from "@interfere/types/releases/definition";
|
|
4
|
-
|
|
5
|
-
//#region src/build/source-maps/providers/source-control/types.d.ts
|
|
6
|
-
type SourceControlProvider = {
|
|
7
|
-
type: ReleaseSourceType;
|
|
8
|
-
detect: Effect.Effect<boolean>;
|
|
9
|
-
getMetadata: Effect.Effect<ReleaseSourceMetadata, SourceControlDetectionError>;
|
|
10
|
-
};
|
|
11
|
-
//#endregion
|
|
12
|
-
export { SourceControlProvider };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/source-control/types.ts"],"sourcesContent":[],"mappings":";;;;;KASY,qBAAA;QACJ;EADI,MAAA,EAEF,MAAA,CAAO,MAFL,CAAA,OAAqB,CAAA;EACzB,WAAA,EAEO,MAAA,CAAO,MAFd,CAGJ,qBAHI,EAIJ,2BAJI,CAAA;CACE"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { NextConfig } from "next";
|
|
2
|
-
|
|
3
|
-
//#region src/build/with-interfere.d.ts
|
|
4
|
-
type InterfereFeatures = {
|
|
5
|
-
/**
|
|
6
|
-
* Enable error tracking
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
errorTracking?: boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Enable session replay
|
|
12
|
-
* @default true in production, false in development
|
|
13
|
-
*/
|
|
14
|
-
replay?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Enable performance monitoring
|
|
17
|
-
* @default true
|
|
18
|
-
*/
|
|
19
|
-
performanceMonitoring?: boolean;
|
|
20
|
-
};
|
|
21
|
-
type InterfereOptions = {
|
|
22
|
-
/**
|
|
23
|
-
* Environment name
|
|
24
|
-
* @default "production"
|
|
25
|
-
*/
|
|
26
|
-
environment?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Enable debug logging
|
|
29
|
-
* @default false
|
|
30
|
-
*/
|
|
31
|
-
debug?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Whether to delete source maps after upload to prevent leakage
|
|
34
|
-
* @default true
|
|
35
|
-
*/
|
|
36
|
-
cleanupSourceMaps?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Feature flags for the SDK.
|
|
39
|
-
* These are injected at build time and available to the client SDK.
|
|
40
|
-
*/
|
|
41
|
-
features?: InterfereFeatures;
|
|
42
|
-
};
|
|
43
|
-
type NextConfigWithInterfere = NextConfig & {
|
|
44
|
-
interfere?: InterfereOptions;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Next.js configuration wrapper that automatically uploads source maps in production builds
|
|
48
|
-
*
|
|
49
|
-
* SECURITY: Secret key must be set via INTERFERE_SECRET_KEY env var (without NEXT_PUBLIC_ prefix)
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```js
|
|
53
|
-
* // next.config.js
|
|
54
|
-
* import { withInterfere } from '@interfere/next/config';
|
|
55
|
-
*
|
|
56
|
-
* export default withInterfere({
|
|
57
|
-
* environment: 'staging',
|
|
58
|
-
* debug: true,
|
|
59
|
-
* cleanupSourceMaps: true
|
|
60
|
-
* })({
|
|
61
|
-
* // Your Next.js config
|
|
62
|
-
* });
|
|
63
|
-
* ```
|
|
64
|
-
*/
|
|
65
|
-
declare function withInterfere({
|
|
66
|
-
interfere,
|
|
67
|
-
...nextConfig
|
|
68
|
-
}?: NextConfigWithInterfere): () => NextConfig;
|
|
69
|
-
//#endregion
|
|
70
|
-
export { InterfereFeatures, InterfereOptions, withInterfere };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"with-interfere.d.mts","names":[],"sources":["../../src/build/with-interfere.ts"],"sourcesContent":[],"mappings":";;;KAgBY,iBAAA;;AAAZ;AAoBA;AAwBE;EAyBc,aAAA,CAAA,EAAa,OAAA;EAC3B;;;;;;;;;;;KAlDU,gBAAA;;;;;;;;;;;;;;;;;;;;aAuBC;;KAGR,uBAAA,GAA0B;cACjB;;;;;;;;;;;;;;;;;;;;;iBAsBE,aAAA;;;IAGb,gCAAqC"}
|