@jsenv/core 41.0.1 → 41.0.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.
|
@@ -32,7 +32,7 @@ import "node:url";
|
|
|
32
32
|
*/
|
|
33
33
|
const startBuildServer = async ({
|
|
34
34
|
buildDirectoryUrl,
|
|
35
|
-
|
|
35
|
+
buildDirectoryMainFileRelativeUrl = "index.html",
|
|
36
36
|
port = 9779,
|
|
37
37
|
routes,
|
|
38
38
|
serverPlugins = [],
|
|
@@ -62,26 +62,35 @@ const startBuildServer = async ({
|
|
|
62
62
|
"buildDirectoryUrl",
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
if (
|
|
66
|
-
if (typeof
|
|
65
|
+
if (buildDirectoryMainFileRelativeUrl) {
|
|
66
|
+
if (typeof buildDirectoryMainFileRelativeUrl !== "string") {
|
|
67
67
|
throw new TypeError(
|
|
68
|
-
`
|
|
68
|
+
`buildDirectoryMainFileRelativeUrl must be a string, got ${buildDirectoryMainFileRelativeUrl}`,
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
|
-
if (
|
|
72
|
-
|
|
71
|
+
if (buildDirectoryMainFileRelativeUrl[0] === "/") {
|
|
72
|
+
buildDirectoryMainFileRelativeUrl =
|
|
73
|
+
buildDirectoryMainFileRelativeUrl.slice(1);
|
|
73
74
|
} else {
|
|
74
|
-
const buildMainFileUrl = new URL(
|
|
75
|
-
|
|
75
|
+
const buildMainFileUrl = new URL(
|
|
76
|
+
buildDirectoryMainFileRelativeUrl,
|
|
77
|
+
buildDirectoryUrl,
|
|
78
|
+
).href;
|
|
76
79
|
if (!buildMainFileUrl.startsWith(buildDirectoryUrl)) {
|
|
77
80
|
throw new Error(
|
|
78
|
-
`
|
|
81
|
+
`buildDirectoryMainFileRelativeUrl must be relative, got ${buildDirectoryMainFileRelativeUrl}`,
|
|
79
82
|
);
|
|
80
83
|
}
|
|
81
|
-
|
|
84
|
+
buildDirectoryMainFileRelativeUrl = buildMainFileUrl.slice(
|
|
85
|
+
buildDirectoryUrl.length,
|
|
86
|
+
);
|
|
82
87
|
}
|
|
83
|
-
if (
|
|
84
|
-
|
|
88
|
+
if (
|
|
89
|
+
!existsSync(
|
|
90
|
+
new URL(buildDirectoryMainFileRelativeUrl, buildDirectoryUrl),
|
|
91
|
+
)
|
|
92
|
+
) {
|
|
93
|
+
buildDirectoryMainFileRelativeUrl = null;
|
|
85
94
|
}
|
|
86
95
|
}
|
|
87
96
|
}
|
|
@@ -130,8 +139,9 @@ const startBuildServer = async ({
|
|
|
130
139
|
}),
|
|
131
140
|
...serverPlugins,
|
|
132
141
|
serverPluginStaticFiles({
|
|
142
|
+
serverRelativeUrl: "/",
|
|
133
143
|
directoryUrl: buildDirectoryUrl,
|
|
134
|
-
|
|
144
|
+
directoryMainFileRelativeUrl: buildDirectoryMainFileRelativeUrl,
|
|
135
145
|
}),
|
|
136
146
|
serverPluginErrorHandler({
|
|
137
147
|
sendErrorDetails: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "41.0.
|
|
3
|
+
"version": "41.0.2",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@jsenv/plugin-minification": "1.7.3",
|
|
82
82
|
"@jsenv/plugin-supervisor": "1.7.15",
|
|
83
83
|
"@jsenv/plugin-transpilation": "1.5.70",
|
|
84
|
-
"@jsenv/server": "17.0.
|
|
84
|
+
"@jsenv/server": "17.0.1",
|
|
85
85
|
"@jsenv/sourcemap": "1.3.17",
|
|
86
86
|
"react-table": "7.8.0"
|
|
87
87
|
},
|
|
@@ -33,7 +33,7 @@ import { existsSync } from "node:fs";
|
|
|
33
33
|
*/
|
|
34
34
|
export const startBuildServer = async ({
|
|
35
35
|
buildDirectoryUrl,
|
|
36
|
-
|
|
36
|
+
buildDirectoryMainFileRelativeUrl = "index.html",
|
|
37
37
|
port = 9779,
|
|
38
38
|
routes,
|
|
39
39
|
serverPlugins = [],
|
|
@@ -63,26 +63,35 @@ export const startBuildServer = async ({
|
|
|
63
63
|
"buildDirectoryUrl",
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
if (
|
|
67
|
-
if (typeof
|
|
66
|
+
if (buildDirectoryMainFileRelativeUrl) {
|
|
67
|
+
if (typeof buildDirectoryMainFileRelativeUrl !== "string") {
|
|
68
68
|
throw new TypeError(
|
|
69
|
-
`
|
|
69
|
+
`buildDirectoryMainFileRelativeUrl must be a string, got ${buildDirectoryMainFileRelativeUrl}`,
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
73
|
-
|
|
72
|
+
if (buildDirectoryMainFileRelativeUrl[0] === "/") {
|
|
73
|
+
buildDirectoryMainFileRelativeUrl =
|
|
74
|
+
buildDirectoryMainFileRelativeUrl.slice(1);
|
|
74
75
|
} else {
|
|
75
|
-
const buildMainFileUrl = new URL(
|
|
76
|
-
|
|
76
|
+
const buildMainFileUrl = new URL(
|
|
77
|
+
buildDirectoryMainFileRelativeUrl,
|
|
78
|
+
buildDirectoryUrl,
|
|
79
|
+
).href;
|
|
77
80
|
if (!buildMainFileUrl.startsWith(buildDirectoryUrl)) {
|
|
78
81
|
throw new Error(
|
|
79
|
-
`
|
|
82
|
+
`buildDirectoryMainFileRelativeUrl must be relative, got ${buildDirectoryMainFileRelativeUrl}`,
|
|
80
83
|
);
|
|
81
84
|
}
|
|
82
|
-
|
|
85
|
+
buildDirectoryMainFileRelativeUrl = buildMainFileUrl.slice(
|
|
86
|
+
buildDirectoryUrl.length,
|
|
87
|
+
);
|
|
83
88
|
}
|
|
84
|
-
if (
|
|
85
|
-
|
|
89
|
+
if (
|
|
90
|
+
!existsSync(
|
|
91
|
+
new URL(buildDirectoryMainFileRelativeUrl, buildDirectoryUrl),
|
|
92
|
+
)
|
|
93
|
+
) {
|
|
94
|
+
buildDirectoryMainFileRelativeUrl = null;
|
|
86
95
|
}
|
|
87
96
|
}
|
|
88
97
|
}
|
|
@@ -132,8 +141,9 @@ export const startBuildServer = async ({
|
|
|
132
141
|
}),
|
|
133
142
|
...serverPlugins,
|
|
134
143
|
serverPluginStaticFiles({
|
|
144
|
+
serverRelativeUrl: "/",
|
|
135
145
|
directoryUrl: buildDirectoryUrl,
|
|
136
|
-
|
|
146
|
+
directoryMainFileRelativeUrl: buildDirectoryMainFileRelativeUrl,
|
|
137
147
|
}),
|
|
138
148
|
serverPluginErrorHandler({
|
|
139
149
|
sendErrorDetails: false,
|