@solidjs/start 2.0.0-beta.8 → 2.0.0-rc.1
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/CHANGELOG.md +36 -1
- package/dist/config/boundary-modules.d.ts +14 -0
- package/dist/config/boundary-modules.js +41 -0
- package/dist/config/env.js +11 -8
- package/dist/config/fs-routes/tree-shake.js +175 -32
- package/dist/config/index.js +31 -2
- package/dist/fns/handler.js +13 -2
- package/dist/http/http.d.ts +81 -0
- package/dist/http/http.js +129 -0
- package/dist/http/index.d.ts +2 -81
- package/dist/http/index.js +6 -129
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.js +5 -1
- package/dist/server/StartServer.jsx +1 -1
- package/dist/server/fetchEvent.d.ts +10 -0
- package/dist/server/fetchEvent.js +10 -0
- package/dist/server/handler.js +7 -11
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.jsx +1 -0
- package/dist/server/spa/StartServer.jsx +1 -1
- package/dist/server/strip-path-base.d.ts +1 -0
- package/dist/server/strip-path-base.js +10 -0
- package/dist/server/web-stream.d.ts +9 -0
- package/dist/server/web-stream.js +26 -0
- package/dist/shared/HttpHeader.jsx +1 -1
- package/dist/shared/dev-overlay/createStackFrame.js +46 -12
- package/env.d.ts +12 -0
- package/package.json +1 -1
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { createMemo, createResource } from "solid-js";
|
|
2
2
|
import getSourceMap from "./get-source-map.js";
|
|
3
|
+
const HTTP_URL_REGEX = /^https?:\/\//;
|
|
4
|
+
const LEADING_SLASH_REGEX = /^\/+/;
|
|
5
|
+
// Frames from an SSR error carry filesystem paths (or file:// URLs) rather
|
|
6
|
+
// than the http URL the module is served from. Their positions are already
|
|
7
|
+
// mapped back to the original source by the Vite module runner, unlike
|
|
8
|
+
// client frames whose positions refer to the compiled module.
|
|
9
|
+
function isServerSource(path) {
|
|
10
|
+
return !HTTP_URL_REGEX.test(path);
|
|
11
|
+
}
|
|
3
12
|
function getActualFileSource(path) {
|
|
4
13
|
if (path.startsWith("file://")) {
|
|
5
|
-
return "
|
|
14
|
+
return "/@fs/" + path.substring("file://".length).replace(LEADING_SLASH_REGEX, "");
|
|
15
|
+
}
|
|
16
|
+
if (isServerSource(path)) {
|
|
17
|
+
return "/@fs/" + path.replace(LEADING_SLASH_REGEX, "");
|
|
6
18
|
}
|
|
7
19
|
return path;
|
|
8
20
|
}
|
|
@@ -16,16 +28,18 @@ export function createStackFrame(stackframe, isCompiled) {
|
|
|
16
28
|
if (!source.fileName) {
|
|
17
29
|
return null;
|
|
18
30
|
}
|
|
19
|
-
const
|
|
31
|
+
const url = getActualFileSource(source.fileName);
|
|
32
|
+
const response = await fetch(url);
|
|
20
33
|
if (!response.ok) {
|
|
21
34
|
return null;
|
|
22
35
|
}
|
|
23
36
|
const content = await response.text();
|
|
24
|
-
const sourceMap = await getSourceMap(
|
|
37
|
+
const sourceMap = await getSourceMap(url, content);
|
|
25
38
|
return {
|
|
26
39
|
source,
|
|
27
40
|
content,
|
|
28
41
|
sourceMap,
|
|
42
|
+
isServer: isServerSource(source.fileName),
|
|
29
43
|
};
|
|
30
44
|
});
|
|
31
45
|
const info = createMemo(() => {
|
|
@@ -33,16 +47,36 @@ export function createStackFrame(stackframe, isCompiled) {
|
|
|
33
47
|
if (!current) {
|
|
34
48
|
return undefined;
|
|
35
49
|
}
|
|
36
|
-
const { source, content, sourceMap } = current;
|
|
50
|
+
const { source, content, sourceMap, isServer } = current;
|
|
37
51
|
if (!isCompiled() && source.line && source.column && sourceMap) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
52
|
+
if (isServer) {
|
|
53
|
+
// The position is already original; only the original content needs
|
|
54
|
+
// to be pulled out of the source map.
|
|
55
|
+
const originalContent = sourceMap.sources.length
|
|
56
|
+
? sourceMap.sourceContentFor(sourceMap.sources[0], true)
|
|
57
|
+
: null;
|
|
58
|
+
if (originalContent) {
|
|
59
|
+
return {
|
|
60
|
+
source: source.fileName,
|
|
61
|
+
line: source.line,
|
|
62
|
+
column: source.column,
|
|
63
|
+
name: source.functionName,
|
|
64
|
+
content: originalContent,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const result = sourceMap.originalPositionFor({
|
|
70
|
+
line: source.line,
|
|
71
|
+
column: source.column,
|
|
72
|
+
});
|
|
73
|
+
if (result.source) {
|
|
74
|
+
return {
|
|
75
|
+
...result,
|
|
76
|
+
content: sourceMap.sourceContentFor(result.source, true),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
46
80
|
}
|
|
47
81
|
return {
|
|
48
82
|
source: source.fileName,
|
package/env.d.ts
CHANGED
|
@@ -7,3 +7,15 @@ declare namespace App {
|
|
|
7
7
|
[key: string | symbol]: any;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Import `server-only` to ensure this module is never bundled for the client.
|
|
13
|
+
* Importing it in a client module will throw a build error.
|
|
14
|
+
*/
|
|
15
|
+
declare module "server-only" {}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Import `client-only` to ensure this module is never bundled for the server.
|
|
19
|
+
* Importing it in a server module will throw a build error.
|
|
20
|
+
*/
|
|
21
|
+
declare module "client-only" {}
|