@interfere/next 0.0.15-alpha.8 → 0.1.0-alpha.11
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/LICENSE +1 -1
- package/README.md +36 -8
- package/dist/_virtual/_rolldown/runtime.mjs +7 -0
- package/dist/build/env-config.d.mts +3 -1
- package/dist/build/env-config.d.mts.map +1 -1
- package/dist/build/env-config.mjs +9 -1
- package/dist/build/env-config.mjs.map +1 -1
- package/dist/build/exchange-surface.d.mts +9 -0
- package/dist/build/exchange-surface.d.mts.map +1 -0
- package/dist/build/exchange-surface.mjs +36 -0
- package/dist/build/exchange-surface.mjs.map +1 -0
- package/dist/build/loaders/value-injection-loader.d.mts +22 -0
- package/dist/build/loaders/value-injection-loader.d.mts.map +1 -0
- package/dist/build/loaders/value-injection-loader.mjs +35 -0
- package/dist/build/loaders/value-injection-loader.mjs.map +1 -0
- package/dist/build/logger.d.mts +2 -2
- package/dist/build/logger.d.mts.map +1 -1
- package/dist/build/logger.mjs +10 -12
- package/dist/build/logger.mjs.map +1 -1
- package/dist/build/nextjs-version.d.mts +40 -0
- package/dist/build/nextjs-version.d.mts.map +1 -0
- package/dist/build/nextjs-version.mjs +66 -0
- package/dist/build/nextjs-version.mjs.map +1 -0
- package/dist/build/release-program.d.mts +5 -3
- package/dist/build/release-program.d.mts.map +1 -1
- package/dist/build/release-program.mjs +11 -12
- package/dist/build/release-program.mjs.map +1 -1
- package/dist/build/services/config.service.d.mts.map +1 -1
- package/dist/build/services/config.service.mjs.map +1 -1
- package/dist/build/services/instrumentation-detection.service.d.mts +19 -0
- package/dist/build/services/instrumentation-detection.service.d.mts.map +1 -0
- package/dist/build/services/instrumentation-detection.service.mjs +77 -0
- package/dist/build/services/instrumentation-detection.service.mjs.map +1 -0
- package/dist/build/services/preflight.service.d.mts +2 -3
- package/dist/build/services/preflight.service.d.mts.map +1 -1
- package/dist/build/services/preflight.service.mjs +28 -37
- package/dist/build/services/preflight.service.mjs.map +1 -1
- package/dist/build/services/release-api.service.d.mts +11 -0
- package/dist/build/services/release-api.service.d.mts.map +1 -0
- package/dist/build/services/release-api.service.mjs +9 -0
- package/dist/build/services/release-api.service.mjs.map +1 -0
- package/dist/build/services/release-identity.service.d.mts +4 -3
- package/dist/build/services/release-identity.service.d.mts.map +1 -1
- package/dist/build/services/release-identity.service.mjs +28 -15
- package/dist/build/services/release-identity.service.mjs.map +1 -1
- package/dist/build/services/source-map-failure-cleanup.service.d.mts +11 -0
- package/dist/build/services/source-map-failure-cleanup.service.d.mts.map +1 -0
- package/dist/build/services/source-map-failure-cleanup.service.mjs +9 -0
- package/dist/build/services/source-map-failure-cleanup.service.mjs.map +1 -0
- package/dist/build/services/source-map.service.d.mts +4 -8
- package/dist/build/services/source-map.service.d.mts.map +1 -1
- package/dist/build/services/source-map.service.mjs +2 -4
- package/dist/build/services/source-map.service.mjs.map +1 -1
- package/dist/build/source-maps/api.d.mts +25 -16
- package/dist/build/source-maps/api.d.mts.map +1 -1
- package/dist/build/source-maps/api.mjs +11 -8
- package/dist/build/source-maps/api.mjs.map +1 -1
- package/dist/build/source-maps/client.d.mts +11 -2
- package/dist/build/source-maps/client.d.mts.map +1 -1
- package/dist/build/source-maps/client.mjs +25 -14
- package/dist/build/source-maps/client.mjs.map +1 -1
- package/dist/build/source-maps/errors.d.mts +118 -106
- package/dist/build/source-maps/errors.d.mts.map +1 -1
- package/dist/build/source-maps/errors.mjs +42 -18
- package/dist/build/source-maps/errors.mjs.map +1 -1
- package/dist/build/source-maps/files.d.mts +1 -1
- package/dist/build/source-maps/files.d.mts.map +1 -1
- package/dist/build/source-maps/files.mjs +13 -15
- package/dist/build/source-maps/files.mjs.map +1 -1
- package/dist/build/source-maps/providers/deployment/detector.d.mts +8 -17
- package/dist/build/source-maps/providers/deployment/detector.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/detector.mjs +11 -13
- package/dist/build/source-maps/providers/deployment/detector.mjs.map +1 -1
- package/dist/build/source-maps/providers/deployment/types.d.mts +2 -2
- package/dist/build/source-maps/providers/deployment/types.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/vercel.d.mts.map +1 -1
- package/dist/build/source-maps/providers/deployment/vercel.mjs +8 -19
- package/dist/build/source-maps/providers/deployment/vercel.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/detector.d.mts +6 -5
- package/dist/build/source-maps/providers/source-control/detector.d.mts.map +1 -1
- package/dist/build/source-maps/providers/source-control/detector.mjs +11 -13
- package/dist/build/source-maps/providers/source-control/detector.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/git.d.mts.map +1 -1
- package/dist/build/source-maps/providers/source-control/git.mjs +5 -8
- package/dist/build/source-maps/providers/source-control/git.mjs.map +1 -1
- package/dist/build/source-maps/providers/source-control/types.d.mts +5 -3
- package/dist/build/source-maps/providers/source-control/types.d.mts.map +1 -1
- package/dist/build/with-interfere.d.mts +25 -3
- package/dist/build/with-interfere.d.mts.map +1 -1
- package/dist/build/with-interfere.mjs +131 -24
- package/dist/build/with-interfere.mjs.map +1 -1
- package/dist/client/auto-init.d.mts +91 -0
- package/dist/client/auto-init.d.mts.map +1 -0
- package/dist/client/auto-init.mjs +121 -0
- package/dist/client/auto-init.mjs.map +1 -0
- package/dist/client/provider.d.mts +3 -3
- package/dist/client/provider.d.mts.map +1 -1
- package/dist/client/provider.mjs +21 -8
- package/dist/client/provider.mjs.map +1 -1
- package/dist/lib/env.d.mts.map +1 -1
- package/dist/lib/types.d.mts +6 -6
- package/dist/lib/types.d.mts.map +1 -1
- package/dist/lib/types.mjs.map +1 -1
- package/dist/server/auto-init.d.mts +88 -0
- package/dist/server/auto-init.d.mts.map +1 -0
- package/dist/server/auto-init.mjs +101 -0
- package/dist/server/auto-init.mjs.map +1 -0
- package/dist/server/middleware.d.mts.map +1 -1
- package/dist/server/middleware.mjs +20 -13
- package/dist/server/middleware.mjs.map +1 -1
- package/dist/server/on-request-error.d.mts +27 -0
- package/dist/server/on-request-error.d.mts.map +1 -0
- package/dist/server/on-request-error.mjs +74 -0
- package/dist/server/on-request-error.mjs.map +1 -0
- package/dist/server/proxy.d.mts.map +1 -1
- package/dist/server/proxy.mjs +4 -5
- package/dist/server/proxy.mjs.map +1 -1
- package/dist/server/route-handler.d.mts +31 -1
- package/dist/server/route-handler.d.mts.map +1 -1
- package/dist/server/route-handler.mjs +78 -79
- package/dist/server/route-handler.mjs.map +1 -1
- package/dist/server/sdk.d.mts +96 -0
- package/dist/server/sdk.d.mts.map +1 -0
- package/dist/server/sdk.mjs +152 -0
- package/dist/server/sdk.mjs.map +1 -0
- package/dist/server/services/config.service.d.mts +33 -6
- package/dist/server/services/config.service.d.mts.map +1 -1
- package/dist/server/services/config.service.mjs +54 -30
- package/dist/server/services/config.service.mjs.map +1 -1
- package/dist/server/services/error-tracking.service.d.mts +3 -3
- package/dist/server/services/error-tracking.service.d.mts.map +1 -1
- package/dist/server/services/error-tracking.service.mjs +5 -3
- package/dist/server/services/error-tracking.service.mjs.map +1 -1
- package/dist/server/session-context.d.mts +60 -0
- package/dist/server/session-context.d.mts.map +1 -0
- package/dist/server/session-context.mjs +62 -0
- package/dist/server/session-context.mjs.map +1 -0
- package/package.json +58 -34
- 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/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
|
@@ -1,109 +1,121 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as effect_Cause0 from "effect/Cause";
|
|
1
|
+
import { Schema } from "effect";
|
|
3
2
|
|
|
4
3
|
//#region src/build/source-maps/errors.d.ts
|
|
5
|
-
declare const InvalidApiUrlError_base:
|
|
6
|
-
readonly _tag: "InvalidApiUrlError"
|
|
7
|
-
} &
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
declare const
|
|
12
|
-
readonly _tag: "
|
|
13
|
-
} &
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
declare const
|
|
18
|
-
readonly _tag: "
|
|
19
|
-
} &
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
declare const
|
|
32
|
-
readonly _tag: "
|
|
33
|
-
} &
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
declare const
|
|
45
|
-
readonly _tag: "
|
|
46
|
-
} &
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
declare const
|
|
51
|
-
readonly _tag: "
|
|
52
|
-
} &
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
declare const
|
|
57
|
-
readonly _tag: "
|
|
58
|
-
} &
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
declare const
|
|
63
|
-
readonly _tag: "
|
|
64
|
-
} &
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
declare const
|
|
69
|
-
readonly _tag: "
|
|
70
|
-
} &
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
declare
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
declare const
|
|
82
|
-
readonly _tag: "
|
|
83
|
-
} &
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
4
|
+
declare const InvalidApiUrlError_base: Schema.TaggedErrorClass<InvalidApiUrlError, "InvalidApiUrlError", {
|
|
5
|
+
readonly _tag: Schema.tag<"InvalidApiUrlError">;
|
|
6
|
+
} & {
|
|
7
|
+
message: typeof Schema.String;
|
|
8
|
+
}>;
|
|
9
|
+
declare class InvalidApiUrlError extends InvalidApiUrlError_base {}
|
|
10
|
+
declare const MissingApiKeyError_base: Schema.TaggedErrorClass<MissingApiKeyError, "MissingApiKeyError", {
|
|
11
|
+
readonly _tag: Schema.tag<"MissingApiKeyError">;
|
|
12
|
+
} & {
|
|
13
|
+
message: typeof Schema.String;
|
|
14
|
+
}>;
|
|
15
|
+
declare class MissingApiKeyError extends MissingApiKeyError_base {}
|
|
16
|
+
declare const MissingSurfaceSlugError_base: Schema.TaggedErrorClass<MissingSurfaceSlugError, "MissingSurfaceSlugError", {
|
|
17
|
+
readonly _tag: Schema.tag<"MissingSurfaceSlugError">;
|
|
18
|
+
} & {
|
|
19
|
+
message: typeof Schema.String;
|
|
20
|
+
}>;
|
|
21
|
+
declare class MissingSurfaceSlugError extends MissingSurfaceSlugError_base {}
|
|
22
|
+
declare const UploadError_base: Schema.TaggedErrorClass<UploadError, "UploadError", {
|
|
23
|
+
readonly _tag: Schema.tag<"UploadError">;
|
|
24
|
+
} & {
|
|
25
|
+
message: typeof Schema.String;
|
|
26
|
+
file: Schema.optional<typeof Schema.String>;
|
|
27
|
+
cause: Schema.optional<typeof Schema.Defect>;
|
|
28
|
+
}>;
|
|
29
|
+
declare class UploadError extends UploadError_base {}
|
|
30
|
+
declare const TokenRequestError_base: Schema.TaggedErrorClass<TokenRequestError, "TokenRequestError", {
|
|
31
|
+
readonly _tag: Schema.tag<"TokenRequestError">;
|
|
32
|
+
} & {
|
|
33
|
+
message: typeof Schema.String;
|
|
34
|
+
}>;
|
|
35
|
+
declare class TokenRequestError extends TokenRequestError_base {}
|
|
36
|
+
declare const NotificationError_base: Schema.TaggedErrorClass<NotificationError, "NotificationError", {
|
|
37
|
+
readonly _tag: Schema.tag<"NotificationError">;
|
|
38
|
+
} & {
|
|
39
|
+
message: typeof Schema.String;
|
|
40
|
+
status: Schema.optional<typeof Schema.Number>;
|
|
41
|
+
}>;
|
|
42
|
+
declare class NotificationError extends NotificationError_base {}
|
|
43
|
+
declare const PayloadTooLargeError_base: Schema.TaggedErrorClass<PayloadTooLargeError, "PayloadTooLargeError", {
|
|
44
|
+
readonly _tag: Schema.tag<"PayloadTooLargeError">;
|
|
45
|
+
} & {
|
|
46
|
+
message: typeof Schema.String;
|
|
47
|
+
}>;
|
|
48
|
+
declare class PayloadTooLargeError extends PayloadTooLargeError_base {}
|
|
49
|
+
declare const NoDeploymentError_base: Schema.TaggedErrorClass<NoDeploymentError, "NoDeploymentError", {
|
|
50
|
+
readonly _tag: Schema.tag<"NoDeploymentError">;
|
|
51
|
+
} & {
|
|
52
|
+
message: typeof Schema.String;
|
|
53
|
+
}>;
|
|
54
|
+
declare class NoDeploymentError extends NoDeploymentError_base {}
|
|
55
|
+
declare const NoBuildIdError_base: Schema.TaggedErrorClass<NoBuildIdError, "NoBuildIdError", {
|
|
56
|
+
readonly _tag: Schema.tag<"NoBuildIdError">;
|
|
57
|
+
} & {
|
|
58
|
+
message: typeof Schema.String;
|
|
59
|
+
}>;
|
|
60
|
+
declare class NoBuildIdError extends NoBuildIdError_base {}
|
|
61
|
+
declare const WithInterfereUsageError_base: Schema.TaggedErrorClass<WithInterfereUsageError, "WithInterfereUsageError", {
|
|
62
|
+
readonly _tag: Schema.tag<"WithInterfereUsageError">;
|
|
63
|
+
} & {
|
|
64
|
+
message: typeof Schema.String;
|
|
65
|
+
}>;
|
|
66
|
+
declare class WithInterfereUsageError extends WithInterfereUsageError_base {}
|
|
67
|
+
declare const ExchangeFailedError_base: Schema.TaggedErrorClass<ExchangeFailedError, "ExchangeFailedError", {
|
|
68
|
+
readonly _tag: Schema.tag<"ExchangeFailedError">;
|
|
69
|
+
} & {
|
|
70
|
+
message: typeof Schema.String;
|
|
71
|
+
cause: Schema.optional<typeof Schema.Unknown>;
|
|
72
|
+
}>;
|
|
73
|
+
declare class ExchangeFailedError extends ExchangeFailedError_base {}
|
|
74
|
+
declare const MissingBuildIdError_base: Schema.TaggedErrorClass<MissingBuildIdError, "MissingBuildIdError", {
|
|
75
|
+
readonly _tag: Schema.tag<"MissingBuildIdError">;
|
|
76
|
+
} & {
|
|
77
|
+
message: typeof Schema.String;
|
|
78
|
+
}>;
|
|
79
|
+
declare class MissingBuildIdError extends MissingBuildIdError_base {}
|
|
80
|
+
declare const MissingReleaseIdError_base: Schema.TaggedErrorClass<MissingReleaseIdError, "MissingReleaseIdError", {
|
|
81
|
+
readonly _tag: Schema.tag<"MissingReleaseIdError">;
|
|
82
|
+
} & {
|
|
83
|
+
message: typeof Schema.String;
|
|
84
|
+
}>;
|
|
85
|
+
declare class MissingReleaseIdError extends MissingReleaseIdError_base {}
|
|
86
|
+
declare const FileReadError_base: Schema.TaggedErrorClass<FileReadError, "FileReadError", {
|
|
87
|
+
readonly _tag: Schema.tag<"FileReadError">;
|
|
88
|
+
} & {
|
|
89
|
+
message: typeof Schema.String;
|
|
90
|
+
path: typeof Schema.String;
|
|
91
|
+
}>;
|
|
92
|
+
declare class FileReadError extends FileReadError_base {}
|
|
93
|
+
declare const FileGlobError_base: Schema.TaggedErrorClass<FileGlobError, "FileGlobError", {
|
|
94
|
+
readonly _tag: Schema.tag<"FileGlobError">;
|
|
95
|
+
} & {
|
|
96
|
+
message: typeof Schema.String;
|
|
97
|
+
pattern: typeof Schema.String;
|
|
98
|
+
}>;
|
|
99
|
+
declare class FileGlobError extends FileGlobError_base {}
|
|
100
|
+
declare const FileDeleteError_base: Schema.TaggedErrorClass<FileDeleteError, "FileDeleteError", {
|
|
101
|
+
readonly _tag: Schema.tag<"FileDeleteError">;
|
|
102
|
+
} & {
|
|
103
|
+
message: typeof Schema.String;
|
|
104
|
+
path: typeof Schema.String;
|
|
105
|
+
}>;
|
|
106
|
+
declare class FileDeleteError extends FileDeleteError_base {}
|
|
107
|
+
declare const FileHashError_base: Schema.TaggedErrorClass<FileHashError, "FileHashError", {
|
|
108
|
+
readonly _tag: Schema.tag<"FileHashError">;
|
|
109
|
+
} & {
|
|
110
|
+
message: typeof Schema.String;
|
|
111
|
+
path: typeof Schema.String;
|
|
112
|
+
}>;
|
|
113
|
+
declare class FileHashError extends FileHashError_base {}
|
|
114
|
+
declare const SourceControlDetectionError_base: Schema.TaggedErrorClass<SourceControlDetectionError, "SourceControlDetectionError", {
|
|
115
|
+
readonly _tag: Schema.tag<"SourceControlDetectionError">;
|
|
116
|
+
} & {
|
|
117
|
+
message: typeof Schema.String;
|
|
118
|
+
}>;
|
|
119
|
+
declare class SourceControlDetectionError extends SourceControlDetectionError_base {}
|
|
108
120
|
//#endregion
|
|
109
|
-
export { FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError,
|
|
121
|
+
export { ExchangeFailedError, FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError, MissingApiKeyError, MissingBuildIdError, MissingReleaseIdError, MissingSurfaceSlugError, NoBuildIdError, NoDeploymentError, NotificationError, PayloadTooLargeError, SourceControlDetectionError, TokenRequestError, UploadError, WithInterfereUsageError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.mts","names":[],"sources":["../../../src/build/source-maps/errors.ts"],"
|
|
1
|
+
{"version":3,"file":"errors.d.mts","names":[],"sources":["../../../src/build/source-maps/errors.ts"],"mappings":";;;cAAgC,uBAAA;;;;;cAEnB,kBAAA,SAA2B,uBAAA;AAAA,cAKpC,uBAAA;;;;;cAES,kBAAA,SAA2B,uBAAA;AAAA,cAKpC,4BAAA;;;;;cAES,uBAAA,SAAgC,4BAAA;AAAA,cAKzC,gBAAA;;;;;;;cAES,WAAA,SAAoB,gBAAA;AAAA,cAO7B,sBAAA;;;;;cAES,iBAAA,SAA0B,sBAAA;AAAA,cAKnC,sBAAA;;;;;;cAES,iBAAA,SAA0B,sBAAA;AAAA,cAMnC,yBAAA;;;;;cAES,oBAAA,SAA6B,yBAAA;AAAA,cAKtC,sBAAA;;;;;cAES,iBAAA,SAA0B,sBAAA;AAAA,cAKnC,mBAAA;;;;;cAES,cAAA,SAAuB,mBAAA;AAAA,cAKhC,4BAAA;;;;;cAES,uBAAA,SAAgC,4BAAA;AAAA,cAKzC,wBAAA;;;;;;cAES,mBAAA,SAA4B,wBAAA;AAAA,cAMrC,wBAAA;;;;;cAES,mBAAA,SAA4B,wBAAA;AAAA,cAKrC,0BAAA;;;;;cAES,qBAAA,SAA8B,0BAAA;AAAA,cAKvC,kBAAA;;;;;;cAES,aAAA,SAAsB,kBAAA;AAAA,cAM/B,kBAAA;;;;;;cAES,aAAA,SAAsB,kBAAA;AAAA,cAM/B,oBAAA;;;;;;cAES,eAAA,SAAwB,oBAAA;AAAA,cAMjC,kBAAA;;;;;;cAES,aAAA,SAAsB,kBAAA;AAAA,cAM/B,gCAAA;;;;;cAES,2BAAA,SAAoC,gCAAA"}
|
|
@@ -1,22 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Schema } from "effect";
|
|
2
2
|
|
|
3
3
|
//#region src/build/source-maps/errors.ts
|
|
4
|
-
var InvalidApiUrlError = class extends
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
4
|
+
var InvalidApiUrlError = class extends Schema.TaggedError()("InvalidApiUrlError", { message: Schema.String }) {};
|
|
5
|
+
var MissingApiKeyError = class extends Schema.TaggedError()("MissingApiKeyError", { message: Schema.String }) {};
|
|
6
|
+
var MissingSurfaceSlugError = class extends Schema.TaggedError()("MissingSurfaceSlugError", { message: Schema.String }) {};
|
|
7
|
+
var UploadError = class extends Schema.TaggedError()("UploadError", {
|
|
8
|
+
message: Schema.String,
|
|
9
|
+
file: Schema.optional(Schema.String),
|
|
10
|
+
cause: Schema.optional(Schema.Defect)
|
|
11
|
+
}) {};
|
|
12
|
+
var TokenRequestError = class extends Schema.TaggedError()("TokenRequestError", { message: Schema.String }) {};
|
|
13
|
+
var NotificationError = class extends Schema.TaggedError()("NotificationError", {
|
|
14
|
+
message: Schema.String,
|
|
15
|
+
status: Schema.optional(Schema.Number)
|
|
16
|
+
}) {};
|
|
17
|
+
var PayloadTooLargeError = class extends Schema.TaggedError()("PayloadTooLargeError", { message: Schema.String }) {};
|
|
18
|
+
var NoDeploymentError = class extends Schema.TaggedError()("NoDeploymentError", { message: Schema.String }) {};
|
|
19
|
+
var NoBuildIdError = class extends Schema.TaggedError()("NoBuildIdError", { message: Schema.String }) {};
|
|
20
|
+
var WithInterfereUsageError = class extends Schema.TaggedError()("WithInterfereUsageError", { message: Schema.String }) {};
|
|
21
|
+
var ExchangeFailedError = class extends Schema.TaggedError()("ExchangeFailedError", {
|
|
22
|
+
message: Schema.String,
|
|
23
|
+
cause: Schema.optional(Schema.Unknown)
|
|
24
|
+
}) {};
|
|
25
|
+
var MissingBuildIdError = class extends Schema.TaggedError()("MissingBuildIdError", { message: Schema.String }) {};
|
|
26
|
+
var MissingReleaseIdError = class extends Schema.TaggedError()("MissingReleaseIdError", { message: Schema.String }) {};
|
|
27
|
+
var FileReadError = class extends Schema.TaggedError()("FileReadError", {
|
|
28
|
+
message: Schema.String,
|
|
29
|
+
path: Schema.String
|
|
30
|
+
}) {};
|
|
31
|
+
var FileGlobError = class extends Schema.TaggedError()("FileGlobError", {
|
|
32
|
+
message: Schema.String,
|
|
33
|
+
pattern: Schema.String
|
|
34
|
+
}) {};
|
|
35
|
+
var FileDeleteError = class extends Schema.TaggedError()("FileDeleteError", {
|
|
36
|
+
message: Schema.String,
|
|
37
|
+
path: Schema.String
|
|
38
|
+
}) {};
|
|
39
|
+
var FileHashError = class extends Schema.TaggedError()("FileHashError", {
|
|
40
|
+
message: Schema.String,
|
|
41
|
+
path: Schema.String
|
|
42
|
+
}) {};
|
|
43
|
+
var SourceControlDetectionError = class extends Schema.TaggedError()("SourceControlDetectionError", { message: Schema.String }) {};
|
|
20
44
|
|
|
21
45
|
//#endregion
|
|
22
|
-
export { FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError,
|
|
46
|
+
export { ExchangeFailedError, FileDeleteError, FileGlobError, FileHashError, FileReadError, InvalidApiUrlError, MissingApiKeyError, MissingBuildIdError, MissingReleaseIdError, MissingSurfaceSlugError, NoBuildIdError, NoDeploymentError, NotificationError, PayloadTooLargeError, SourceControlDetectionError, TokenRequestError, UploadError, WithInterfereUsageError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build/source-maps/errors.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../../src/build/source-maps/errors.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class InvalidApiUrlError extends Schema.TaggedError<InvalidApiUrlError>()(\n \"InvalidApiUrlError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class MissingApiKeyError extends Schema.TaggedError<MissingApiKeyError>()(\n \"MissingApiKeyError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class MissingSurfaceSlugError extends Schema.TaggedError<MissingSurfaceSlugError>()(\n \"MissingSurfaceSlugError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class UploadError extends Schema.TaggedError<UploadError>()(\n \"UploadError\",\n {\n message: Schema.String,\n file: Schema.optional(Schema.String),\n cause: Schema.optional(Schema.Defect),\n }\n) {}\n\nexport class TokenRequestError extends Schema.TaggedError<TokenRequestError>()(\n \"TokenRequestError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class NotificationError extends Schema.TaggedError<NotificationError>()(\n \"NotificationError\",\n {\n message: Schema.String,\n status: Schema.optional(Schema.Number),\n }\n) {}\n\nexport class PayloadTooLargeError extends Schema.TaggedError<PayloadTooLargeError>()(\n \"PayloadTooLargeError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class NoDeploymentError extends Schema.TaggedError<NoDeploymentError>()(\n \"NoDeploymentError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class NoBuildIdError extends Schema.TaggedError<NoBuildIdError>()(\n \"NoBuildIdError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class WithInterfereUsageError extends Schema.TaggedError<WithInterfereUsageError>()(\n \"WithInterfereUsageError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class ExchangeFailedError extends Schema.TaggedError<ExchangeFailedError>()(\n \"ExchangeFailedError\",\n {\n message: Schema.String,\n cause: Schema.optional(Schema.Unknown),\n }\n) {}\n\nexport class MissingBuildIdError extends Schema.TaggedError<MissingBuildIdError>()(\n \"MissingBuildIdError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class MissingReleaseIdError extends Schema.TaggedError<MissingReleaseIdError>()(\n \"MissingReleaseIdError\",\n {\n message: Schema.String,\n }\n) {}\n\nexport class FileReadError extends Schema.TaggedError<FileReadError>()(\n \"FileReadError\",\n {\n message: Schema.String,\n path: Schema.String,\n }\n) {}\n\nexport class FileGlobError extends Schema.TaggedError<FileGlobError>()(\n \"FileGlobError\",\n {\n message: Schema.String,\n pattern: Schema.String,\n }\n) {}\n\nexport class FileDeleteError extends Schema.TaggedError<FileDeleteError>()(\n \"FileDeleteError\",\n {\n message: Schema.String,\n path: Schema.String,\n }\n) {}\n\nexport class FileHashError extends Schema.TaggedError<FileHashError>()(\n \"FileHashError\",\n {\n message: Schema.String,\n path: Schema.String,\n }\n) {}\n\nexport class SourceControlDetectionError extends Schema.TaggedError<SourceControlDetectionError>()(\n \"SourceControlDetectionError\",\n {\n message: Schema.String,\n }\n) {}\n"],"mappings":";;;AAEA,IAAa,qBAAb,cAAwC,OAAO,aAAiC,CAC9E,sBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,qBAAb,cAAwC,OAAO,aAAiC,CAC9E,sBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,0BAAb,cAA6C,OAAO,aAAsC,CACxF,2BACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,cAAb,cAAiC,OAAO,aAA0B,CAChE,eACA;CACE,SAAS,OAAO;CAChB,MAAM,OAAO,SAAS,OAAO,OAAO;CACpC,OAAO,OAAO,SAAS,OAAO,OAAO;CACtC,CACF,CAAC;AAEF,IAAa,oBAAb,cAAuC,OAAO,aAAgC,CAC5E,qBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,oBAAb,cAAuC,OAAO,aAAgC,CAC5E,qBACA;CACE,SAAS,OAAO;CAChB,QAAQ,OAAO,SAAS,OAAO,OAAO;CACvC,CACF,CAAC;AAEF,IAAa,uBAAb,cAA0C,OAAO,aAAmC,CAClF,wBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,oBAAb,cAAuC,OAAO,aAAgC,CAC5E,qBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,iBAAb,cAAoC,OAAO,aAA6B,CACtE,kBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,0BAAb,cAA6C,OAAO,aAAsC,CACxF,2BACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,sBAAb,cAAyC,OAAO,aAAkC,CAChF,uBACA;CACE,SAAS,OAAO;CAChB,OAAO,OAAO,SAAS,OAAO,QAAQ;CACvC,CACF,CAAC;AAEF,IAAa,sBAAb,cAAyC,OAAO,aAAkC,CAChF,uBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,wBAAb,cAA2C,OAAO,aAAoC,CACpF,yBACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC;AAEF,IAAa,gBAAb,cAAmC,OAAO,aAA4B,CACpE,iBACA;CACE,SAAS,OAAO;CAChB,MAAM,OAAO;CACd,CACF,CAAC;AAEF,IAAa,gBAAb,cAAmC,OAAO,aAA4B,CACpE,iBACA;CACE,SAAS,OAAO;CAChB,SAAS,OAAO;CACjB,CACF,CAAC;AAEF,IAAa,kBAAb,cAAqC,OAAO,aAA8B,CACxE,mBACA;CACE,SAAS,OAAO;CAChB,MAAM,OAAO;CACd,CACF,CAAC;AAEF,IAAa,gBAAb,cAAmC,OAAO,aAA4B,CACpE,iBACA;CACE,SAAS,OAAO;CAChB,MAAM,OAAO;CACd,CACF,CAAC;AAEF,IAAa,8BAAb,cAAiD,OAAO,aAA0C,CAChG,+BACA,EACE,SAAS,OAAO,QACjB,CACF,CAAC"}
|
|
@@ -9,7 +9,7 @@ declare function readSourceMapsFromFiles(paths: string[]): Effect.Effect<{
|
|
|
9
9
|
hash: string;
|
|
10
10
|
}[], FileReadError | FileHashError, never>;
|
|
11
11
|
declare function cleanupSourceMaps(paths: string[], debug: boolean): Effect.Effect<void, never, never> | Effect.Effect<undefined, FileDeleteError, never>;
|
|
12
|
-
declare
|
|
12
|
+
declare const maybeCleanupAfterFailure: (debug: boolean) => Effect.Effect<void, FileGlobError | FileDeleteError, never>;
|
|
13
13
|
/**
|
|
14
14
|
* Find all generated JavaScript files (excluding source maps)
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.mts","names":[],"sources":["../../../src/build/source-maps/files.ts"],"
|
|
1
|
+
{"version":3,"file":"files.d.mts","names":[],"sources":["../../../src/build/source-maps/files.ts"],"mappings":";;;;iBAqBgB,kBAAA,CAAA,GAAkB,MAAA,CAAA,MAAA,WAAA,aAAA;AAAA,iBAclB,uBAAA,CAAwB,KAAA,aAAe,MAAA,CAAA,MAAA;;;;;iBAmCvC,iBAAA,CAAkB,KAAA,YAAiB,KAAA,YAAc,MAAA,CAAA,MAAA,uBAAA,MAAA,CAAA,MAAA,YAAA,eAAA;AAAA,cAuDpD,wBAAA,GAAwB,KAAA,cAAA,MAAA,CAAA,MAAA,OAAA,aAAA,GAAA,eAAA;;;;iBAarB,oBAAA,CAAA,GAAoB,MAAA,CAAA,MAAA,WAAA,aAAA;;;;;;;;iBA2HpB,gCAAA,CAAiC,KAAA,aAAe,MAAA,CAAA,MAAA,CAAA,MAAA,kBAAA,aAAA;;;;;iBA8ChD,oBAAA,CAAqB,KAAA,aAAe,MAAA,CAAA,MAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { appendBuildLogLine } from "../logger.mjs";
|
|
2
2
|
import { FileDeleteError, FileGlobError, FileHashError, FileReadError } from "./errors.mjs";
|
|
3
|
-
import { Effect } from "effect";
|
|
3
|
+
import { Effect, Schema } from "effect";
|
|
4
4
|
import { readFile, unlink } from "node:fs/promises";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { glob } from "glob";
|
|
@@ -24,7 +24,7 @@ function findSourceMapFiles() {
|
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
function readSourceMapsFromFiles(paths) {
|
|
27
|
-
return Effect.forEach(paths,
|
|
27
|
+
return Effect.forEach(paths, Effect.fn("readSourceMapFile")(function* (filePath) {
|
|
28
28
|
const content = yield* Effect.tryPromise({
|
|
29
29
|
try: () => readFile(filePath, "utf8"),
|
|
30
30
|
catch: (error) => new FileReadError({
|
|
@@ -59,10 +59,10 @@ function cleanupSourceMaps(paths, debug) {
|
|
|
59
59
|
file: filePath,
|
|
60
60
|
success: true
|
|
61
61
|
})), Effect.catchAll((error) => debug ? Effect.gen(function* () {
|
|
62
|
-
yield* appendBuildLogLine(`Failed to delete source map file ${
|
|
62
|
+
yield* appendBuildLogLine(`Failed to delete source map file ${yield* Schema.encode(Schema.parseJson())({
|
|
63
63
|
file: filePath,
|
|
64
64
|
error: error.message
|
|
65
|
-
})}`);
|
|
65
|
+
}).pipe(Effect.orDie)}`);
|
|
66
66
|
return {
|
|
67
67
|
file: filePath,
|
|
68
68
|
success: false
|
|
@@ -74,19 +74,17 @@ function cleanupSourceMaps(paths, debug) {
|
|
|
74
74
|
const successful = results.filter((result) => result.success).length;
|
|
75
75
|
const failed = results.length - successful;
|
|
76
76
|
if (successful > 0) yield* appendBuildLogLine(`Cleaned ${successful}/${paths.length} source map files`);
|
|
77
|
-
if (failed > 0 && debug) return yield*
|
|
77
|
+
if (failed > 0 && debug) return yield* new FileDeleteError({
|
|
78
78
|
message: `Failed to clean up ${failed} source map files - Failing the build to avoid leaking source maps to the public`,
|
|
79
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);
|
|
80
|
+
});
|
|
88
81
|
});
|
|
89
82
|
}
|
|
83
|
+
const maybeCleanupAfterFailure = Effect.fn("maybeCleanupAfterFailure")(function* (debug) {
|
|
84
|
+
const files = yield* findSourceMapFiles();
|
|
85
|
+
if (files.length === 0) return;
|
|
86
|
+
yield* cleanupSourceMaps(files, debug);
|
|
87
|
+
});
|
|
90
88
|
/**
|
|
91
89
|
* Find all generated JavaScript files (excluding source maps)
|
|
92
90
|
*/
|
|
@@ -169,7 +167,7 @@ function toPublicUrlPath(buildPath) {
|
|
|
169
167
|
* what appears in error stack traces, making the backend framework-agnostic.
|
|
170
168
|
*/
|
|
171
169
|
function buildSourceMapToGeneratedMapping(paths) {
|
|
172
|
-
return Effect.forEach(paths,
|
|
170
|
+
return Effect.forEach(paths, Effect.fn("buildSourceMapMapping")(function* (filePath) {
|
|
173
171
|
const content = yield* Effect.tryPromise({
|
|
174
172
|
try: () => readFile(filePath, "utf8"),
|
|
175
173
|
catch: (error) => new FileReadError({
|
|
@@ -195,7 +193,7 @@ function buildSourceMapToGeneratedMapping(paths) {
|
|
|
195
193
|
* @deprecated Use buildSourceMapToGeneratedMapping instead - we no longer upload JS files
|
|
196
194
|
*/
|
|
197
195
|
function readGeneratedJsFiles(paths) {
|
|
198
|
-
return Effect.forEach(paths,
|
|
196
|
+
return Effect.forEach(paths, Effect.fn("readGeneratedJsFile")(function* (filePath) {
|
|
199
197
|
const content = yield* Effect.tryPromise({
|
|
200
198
|
try: () => readFile(filePath, "utf8"),
|
|
201
199
|
catch: (error) => new FileReadError({
|
|
@@ -1 +1 @@
|
|
|
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":";;;;;;;;AAYA,MAAM,kBAAkB;AACxB,MAAM,UAAU;AAEhB,eAAe,WAAW,SAAiB;AAGzC,SAFe,MAAM,OAAO,WAEd,WAAW,SAAS,CAAC,OAAO,QAAQ,CAAC,OAAO,MAAM;;AAGlE,SAAgB,qBAAqB;AACnC,QAAO,OAAO,WAAW;EACvB,WACE,KAAK,iBAAiB;GACpB,KAAK,QAAQ,KAAK;GAClB,UAAU;GACX,CAAC;EACJ,QAAQ,UAAU,IAAI,cAAc;GAClC,SAAS,oCAAoC,OAAO,MAAM;GAC1D,SAAS;GACV,CAAC;EACH,CAAC;;AAGJ,SAAgB,wBAAwB,OAAiB;AACvD,QAAO,OAAO,QACZ,QACC,aACC,OAAO,IAAI,aAAa;EACtB,MAAM,UAAU,OAAO,OAAO,WAAW;GACvC,WAAW,SAAS,UAAU,OAAO;GACrC,QAAQ,UAAU,IAAI,cAAc;IAClC,SAAS,wBAAwB,OAAO,MAAM;IAC9C,MAAM;IACP,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ACC,OAAO,IAAI,aAAa;EACtB,MAAM,UAAU,OAAO,OAAO,WAAW;GACvC,WAAW,SAAS,UAAU,OAAO;GACrC,QAAQ,UAAU,IAAI,cAAc;IAClC,SAAS,wBAAwB,OAAO,MAAM;IAC9C,MAAM;IACP,CAAC;GACH,CAAC;EAEF,MAAM,OAAO,OAAO,OAAO,WAAW;GACpC,WAAW,WAAW,QAAQ;GAC9B,QAAQ,UAAU,IAAI,cAAc;IAClC,SAAS,wBAAwB,OAAO,MAAM;IAC9C,MAAM;IACP,CAAC;GACH,CAAC;AAMF,SAAO;GACL,cALmB,KAClB,SAAS,QAAQ,KAAK,EAAE,SAAS,CACjC,QAAQ,OAAO,IAAI;GAIpB;GACA;GACD;GACD,EACJ,EAAE,aAAa,aAAa,CAC7B"}
|
|
1
|
+
{"version":3,"file":"files.mjs","names":[],"sources":["../../../src/build/source-maps/files.ts"],"sourcesContent":["import { readFile, unlink } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { Effect, Schema } 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 Effect.fn(\"readSourceMapFile\")(function* (filePath: string) {\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 const jsonMsg = yield* Schema.encode(Schema.parseJson())({\n file: filePath,\n error: error.message,\n }).pipe(Effect.orDie);\n\n yield* appendBuildLogLine(\n `Failed to delete source map file ${jsonMsg}`\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* 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 const maybeCleanupAfterFailure = Effect.fn(\"maybeCleanupAfterFailure\")(function* (debug: boolean) {\n const files = yield* findSourceMapFiles();\n\n if (files.length === 0) {\n return;\n }\n\n yield* cleanupSourceMaps(files, debug);\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 Effect.fn(\"buildSourceMapMapping\")(function* (filePath: string) {\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 Effect.fn(\"readGeneratedJsFile\")(function* (filePath: string) {\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":";;;;;;;;AAYA,MAAM,kBAAkB;AACxB,MAAM,UAAU;AAEhB,eAAe,WAAW,SAAiB;AAGzC,SAFe,MAAM,OAAO,WAEd,WAAW,SAAS,CAAC,OAAO,QAAQ,CAAC,OAAO,MAAM;;AAGlE,SAAgB,qBAAqB;AACnC,QAAO,OAAO,WAAW;EACvB,WACE,KAAK,iBAAiB;GACpB,KAAK,QAAQ,KAAK;GAClB,UAAU;GACX,CAAC;EACJ,QAAQ,UAAU,IAAI,cAAc;GAClC,SAAS,oCAAoC,OAAO,MAAM;GAC1D,SAAS;GACV,CAAC;EACH,CAAC;;AAGJ,SAAgB,wBAAwB,OAAiB;AACvD,QAAO,OAAO,QACZ,OACA,OAAO,GAAG,oBAAoB,CAAC,WAAW,UAAkB;EACxD,MAAM,UAAU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MAAM,UAAkC,EAAE;AAC1C,OAAK,MAAM,UAAU,QACnB,KAAI,OAAO,sBACT,SAAQ,OAAO,yBAAyB,OAAO;AAGnD,SAAO;GACP,CACH;;;;;;AAOH,SAAgB,qBAAqB,OAAiB;AACpD,QAAO,OAAO,QACZ,OACA,OAAO,GAAG,sBAAsB,CAAC,WAAW,UAAkB;EAC1D,MAAM,UAAU,OAAO,OAAO,WAAW;GACvC,WAAW,SAAS,UAAU,OAAO;GACrC,QAAQ,UAAU,IAAI,cAAc;IAClC,SAAS,wBAAwB,OAAO,MAAM;IAC9C,MAAM;IACP,CAAC;GACH,CAAC;EAEF,MAAM,OAAO,OAAO,OAAO,WAAW;GACpC,WAAW,WAAW,QAAQ;GAC9B,QAAQ,UAAU,IAAI,cAAc;IAClC,SAAS,wBAAwB,OAAO,MAAM;IAC9C,MAAM;IACP,CAAC;GACH,CAAC;AAMF,SAAO;GACL,cALmB,KAClB,SAAS,QAAQ,KAAK,EAAE,SAAS,CACjC,QAAQ,OAAO,IAAI;GAIpB;GACA;GACD;GACD,EACJ,EAAE,aAAa,aAAa,CAC7B"}
|
|
@@ -2,24 +2,15 @@ import { NoDeploymentError } from "../../errors.mjs";
|
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/build/source-maps/providers/deployment/detector.d.ts
|
|
5
|
-
declare
|
|
6
|
-
|
|
5
|
+
declare const detectDeployment: () => Effect.Effect<{
|
|
6
|
+
name: "vercel";
|
|
7
7
|
metadata: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
8
|
+
environment: string | null;
|
|
9
|
+
deploymentId: string | null;
|
|
10
|
+
deploymentUrl: string | null;
|
|
11
|
+
environmentName: string | null;
|
|
12
|
+
environmentTarget: string | null;
|
|
13
|
+
provider: "vercel";
|
|
23
14
|
};
|
|
24
15
|
}, NoDeploymentError, never>;
|
|
25
16
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/deployment/detector.ts"],"
|
|
1
|
+
{"version":3,"file":"detector.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/deployment/detector.ts"],"mappings":";;;;cAQa,gBAAA,QAAgB,MAAA,CAAA,MAAA;;;;;;;;;;GAmB3B,iBAAA"}
|
|
@@ -4,19 +4,17 @@ import { Effect } from "effect";
|
|
|
4
4
|
|
|
5
5
|
//#region src/build/source-maps/providers/deployment/detector.ts
|
|
6
6
|
const providers = [vercelProvider];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
19
|
-
}
|
|
7
|
+
const detectDeployment = Effect.fn("detectDeployment")(function* () {
|
|
8
|
+
for (const provider of providers) {
|
|
9
|
+
if (!(yield* provider.detect)) continue;
|
|
10
|
+
const metadata = yield* provider.getMetadata;
|
|
11
|
+
return {
|
|
12
|
+
name: provider.name,
|
|
13
|
+
metadata
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return yield* new NoDeploymentError({ message: `No source map deployment provider detected, supported providers: ${providers.map((p) => p.name).join(", ")}` });
|
|
17
|
+
});
|
|
20
18
|
|
|
21
19
|
//#endregion
|
|
22
20
|
export { detectDeployment };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detector.mjs","names":[
|
|
1
|
+
{"version":3,"file":"detector.mjs","names":[],"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 const detectDeployment = Effect.fn(\"detectDeployment\")(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 name: provider.name,\n metadata,\n };\n }\n\n return yield* new NoDeploymentError({\n message: `No source map deployment provider detected, supported providers: ${providers.map((p) => p.name).join(\", \")}`,\n });\n});\n"],"mappings":";;;;;AAMA,MAAM,YAAkC,CAAC,eAAe;AAExD,MAAa,mBAAmB,OAAO,GAAG,mBAAmB,CAAC,aAAa;AACzE,MAAK,MAAM,YAAY,WAAW;AAGhC,MAAI,EAFc,OAAO,SAAS,QAGhC;EAGF,MAAM,WAAW,OAAO,SAAS;AAE/B,SAAO;GACL,MAAM,SAAS;GACf;GACD;;AAGH,QAAO,OAAO,IAAI,kBAAkB,EAClC,SAAS,oEAAoE,UAAU,KAAK,MAAM,EAAE,KAAK,CAAC,KAAK,KAAK,IACvH,CAAC;EACF"}
|