@jsenv/core 29.1.0 → 29.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js
CHANGED
|
@@ -9075,6 +9075,7 @@ const createResolveUrlError = ({
|
|
|
9075
9075
|
resolveError.name = "RESOLVE_URL_ERROR";
|
|
9076
9076
|
resolveError.code = code;
|
|
9077
9077
|
resolveError.reason = reason;
|
|
9078
|
+
resolveError.asResponse = error.asResponse;
|
|
9078
9079
|
return resolveError;
|
|
9079
9080
|
};
|
|
9080
9081
|
|
|
@@ -9115,6 +9116,7 @@ const createFetchUrlContentError = ({
|
|
|
9115
9116
|
fetchError.traceLine = reference.trace.line;
|
|
9116
9117
|
fetchError.traceColumn = reference.trace.column;
|
|
9117
9118
|
fetchError.traceMessage = reference.trace.message;
|
|
9119
|
+
fetchError.asResponse = error.asResponse;
|
|
9118
9120
|
return fetchError;
|
|
9119
9121
|
};
|
|
9120
9122
|
|
|
@@ -9196,6 +9198,7 @@ const createTransformUrlContentError = ({
|
|
|
9196
9198
|
}
|
|
9197
9199
|
}
|
|
9198
9200
|
|
|
9201
|
+
transformError.asResponse = error.asResponse;
|
|
9199
9202
|
return transformError;
|
|
9200
9203
|
};
|
|
9201
9204
|
|
|
@@ -9222,6 +9225,7 @@ const createFinalizeUrlContentError = ({
|
|
|
9222
9225
|
|
|
9223
9226
|
finalizeError.name = "FINALIZE_URL_CONTENT_ERROR";
|
|
9224
9227
|
finalizeError.reason = `"finalizeUrlContent" error on "${urlInfo.type}"`;
|
|
9228
|
+
finalizeError.asResponse = error.asResponse;
|
|
9225
9229
|
return finalizeError;
|
|
9226
9230
|
};
|
|
9227
9231
|
|
|
@@ -19833,8 +19837,19 @@ const jsenvPluginUrlResolution = ({
|
|
|
19833
19837
|
return new URL(reference.specifier.slice(1), context.rootDirectoryUrl).href;
|
|
19834
19838
|
}
|
|
19835
19839
|
|
|
19836
|
-
|
|
19837
|
-
|
|
19840
|
+
if (reference.type === "sourcemap_comment") {
|
|
19841
|
+
return resolveUrlUsingWebResolution(reference);
|
|
19842
|
+
}
|
|
19843
|
+
|
|
19844
|
+
let urlType;
|
|
19845
|
+
|
|
19846
|
+
if (reference.expectedType) {
|
|
19847
|
+
urlType = reference.expectedType;
|
|
19848
|
+
} else {
|
|
19849
|
+
const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl);
|
|
19850
|
+
urlType = parentUrlInfo ? parentUrlInfo.type : "entry_point";
|
|
19851
|
+
}
|
|
19852
|
+
|
|
19838
19853
|
const resolver = resolvers[urlType] || resolvers["*"];
|
|
19839
19854
|
return resolver(reference, context);
|
|
19840
19855
|
},
|
|
@@ -25598,6 +25613,11 @@ const createFileService = ({
|
|
|
25598
25613
|
} catch (e) {
|
|
25599
25614
|
urlInfo.error = e;
|
|
25600
25615
|
const originalError = e ? e.cause || e : e;
|
|
25616
|
+
|
|
25617
|
+
if (originalError.asResponse) {
|
|
25618
|
+
return originalError.asResponse();
|
|
25619
|
+
}
|
|
25620
|
+
|
|
25601
25621
|
const code = originalError.code;
|
|
25602
25622
|
|
|
25603
25623
|
if (code === "PARSE_ERROR") {
|
package/package.json
CHANGED
package/src/dev/file_service.js
CHANGED
|
@@ -347,6 +347,9 @@ export const createFileService = ({
|
|
|
347
347
|
} catch (e) {
|
|
348
348
|
urlInfo.error = e
|
|
349
349
|
const originalError = e ? e.cause || e : e
|
|
350
|
+
if (originalError.asResponse) {
|
|
351
|
+
return originalError.asResponse()
|
|
352
|
+
}
|
|
350
353
|
const code = originalError.code
|
|
351
354
|
if (code === "PARSE_ERROR") {
|
|
352
355
|
return {
|
package/src/kitchen/errors.js
CHANGED
|
@@ -23,6 +23,7 @@ export const createResolveUrlError = ({
|
|
|
23
23
|
resolveError.name = "RESOLVE_URL_ERROR"
|
|
24
24
|
resolveError.code = code
|
|
25
25
|
resolveError.reason = reason
|
|
26
|
+
resolveError.asResponse = error.asResponse
|
|
26
27
|
return resolveError
|
|
27
28
|
}
|
|
28
29
|
if (error.message === "NO_RESOLVE") {
|
|
@@ -64,6 +65,7 @@ export const createFetchUrlContentError = ({
|
|
|
64
65
|
fetchError.traceLine = reference.trace.line
|
|
65
66
|
fetchError.traceColumn = reference.trace.column
|
|
66
67
|
fetchError.traceMessage = reference.trace.message
|
|
68
|
+
fetchError.asResponse = error.asResponse
|
|
67
69
|
return fetchError
|
|
68
70
|
}
|
|
69
71
|
|
|
@@ -145,6 +147,7 @@ export const createTransformUrlContentError = ({
|
|
|
145
147
|
})
|
|
146
148
|
}
|
|
147
149
|
}
|
|
150
|
+
transformError.asResponse = error.asResponse
|
|
148
151
|
return transformError
|
|
149
152
|
}
|
|
150
153
|
return createFailedToTransformError({
|
|
@@ -172,6 +175,7 @@ export const createFinalizeUrlContentError = ({
|
|
|
172
175
|
}
|
|
173
176
|
finalizeError.name = "FINALIZE_URL_CONTENT_ERROR"
|
|
174
177
|
finalizeError.reason = `"finalizeUrlContent" error on "${urlInfo.type}"`
|
|
178
|
+
finalizeError.asResponse = error.asResponse
|
|
175
179
|
return finalizeError
|
|
176
180
|
}
|
|
177
181
|
|
|
@@ -98,8 +98,16 @@ export const jsenvPluginUrlResolution = ({
|
|
|
98
98
|
return new URL(reference.specifier.slice(1), context.rootDirectoryUrl)
|
|
99
99
|
.href
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
if (reference.type === "sourcemap_comment") {
|
|
102
|
+
return resolveUrlUsingWebResolution(reference, context)
|
|
103
|
+
}
|
|
104
|
+
let urlType
|
|
105
|
+
if (reference.expectedType) {
|
|
106
|
+
urlType = reference.expectedType
|
|
107
|
+
} else {
|
|
108
|
+
const parentUrlInfo = context.urlGraph.getUrlInfo(reference.parentUrl)
|
|
109
|
+
urlType = parentUrlInfo ? parentUrlInfo.type : "entry_point"
|
|
110
|
+
}
|
|
103
111
|
const resolver = resolvers[urlType] || resolvers["*"]
|
|
104
112
|
return resolver(reference, context)
|
|
105
113
|
},
|