@jsenv/core 27.5.2 → 27.6.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/dist/js/autoreload.js +7 -0
- package/dist/js/html_supervisor_installer.js +275 -154
- package/dist/main.js +171 -109
- package/package.json +2 -2
- package/src/dev/start_dev_server.js +4 -0
- package/src/omega/kitchen.js +13 -15
- package/src/omega/omega_server.js +4 -0
- package/src/omega/server/file_service.js +9 -66
- package/src/omega/url_graph/url_graph_load.js +0 -2
- package/src/omega/url_graph/url_info_transformations.js +27 -0
- package/src/omega/url_graph.js +1 -0
- package/src/plugins/autoreload/client/autoreload.js +7 -0
- package/src/plugins/html_supervisor/client/error_formatter.js +187 -67
- package/src/plugins/html_supervisor/client/error_overlay.js +29 -10
- package/src/plugins/html_supervisor/client/html_supervisor_installer.js +25 -73
- package/src/plugins/html_supervisor/jsenv_plugin_html_supervisor.js +94 -25
- package/src/test/execute_test_plan.js +1 -2
package/dist/main.js
CHANGED
|
@@ -16,7 +16,7 @@ import { Readable, Stream, Writable } from "node:stream";
|
|
|
16
16
|
import { Http2ServerResponse } from "node:http2";
|
|
17
17
|
import { lookup } from "node:dns";
|
|
18
18
|
import { parseHtmlString, stringifyHtmlAst, visitHtmlNodes, getHtmlNodeAttribute, analyzeScriptNode, setHtmlNodeAttributes, parseSrcSet, getHtmlNodePosition, getHtmlNodeAttributePosition, applyPostCss, postCssPluginUrlVisitor, parseJsUrls, findHtmlNode, getHtmlNodeText, removeHtmlNode, setHtmlNodeText, applyBabelPlugins, injectScriptNodeAsEarlyAsPossible, createHtmlNode, removeHtmlNodeText, transpileWithParcel, injectJsImport, minifyWithParcel, analyzeLinkNode } from "@jsenv/ast";
|
|
19
|
-
import { createMagicSource, composeTwoSourcemaps, sourcemapConverter, SOURCEMAP, generateSourcemapFileUrl, generateSourcemapDataUrl } from "@jsenv/sourcemap";
|
|
19
|
+
import { createMagicSource, getOriginalPosition, composeTwoSourcemaps, sourcemapConverter, SOURCEMAP, generateSourcemapFileUrl, generateSourcemapDataUrl } from "@jsenv/sourcemap";
|
|
20
20
|
import { createRequire } from "node:module";
|
|
21
21
|
import babelParser from "@babel/parser";
|
|
22
22
|
import v8, { takeCoverage } from "node:v8";
|
|
@@ -152,7 +152,7 @@ const generateInlineContentUrl = ({
|
|
|
152
152
|
lineEnd,
|
|
153
153
|
columnEnd
|
|
154
154
|
}) => {
|
|
155
|
-
const generatedName =
|
|
155
|
+
const generatedName = `L${line}C${column}-L${lineEnd}C${columnEnd}`;
|
|
156
156
|
const filenameRaw = urlToFilename$1(url);
|
|
157
157
|
const filename = `${filenameRaw}@${generatedName}${extension}`; // ideally we should keep query params from url
|
|
158
158
|
// maybe we could use a custom scheme like "inline:"
|
|
@@ -12046,31 +12046,14 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
12046
12046
|
dev: true,
|
|
12047
12047
|
test: true
|
|
12048
12048
|
},
|
|
12049
|
-
serve: (request, context) => {
|
|
12050
|
-
if (request.ressource.startsWith("/__open_in_editor__/")) {
|
|
12051
|
-
const file = request.ressource.slice("/__open_in_editor__/".length);
|
|
12052
|
-
|
|
12053
|
-
if (!file) {
|
|
12054
|
-
return {
|
|
12055
|
-
status: 400,
|
|
12056
|
-
body: "Missing file in url"
|
|
12057
|
-
};
|
|
12058
|
-
}
|
|
12059
|
-
|
|
12060
|
-
const launch = requireFromJsenv("launch-editor");
|
|
12061
|
-
launch(fileURLToPath(file), () => {// ignore error for now
|
|
12062
|
-
});
|
|
12063
|
-
return {
|
|
12064
|
-
status: 200,
|
|
12065
|
-
headers: {
|
|
12066
|
-
"cache-control": "no-store"
|
|
12067
|
-
}
|
|
12068
|
-
};
|
|
12069
|
-
}
|
|
12070
|
-
|
|
12049
|
+
serve: async (request, context) => {
|
|
12071
12050
|
if (request.ressource.startsWith("/__get_code_frame__/")) {
|
|
12072
|
-
const
|
|
12073
|
-
|
|
12051
|
+
const {
|
|
12052
|
+
pathname,
|
|
12053
|
+
searchParams
|
|
12054
|
+
} = new URL(request.url);
|
|
12055
|
+
const urlWithLineAndColumn = pathname.slice("/__get_code_frame__/".length);
|
|
12056
|
+
const match = urlWithLineAndColumn.match(/:([0-9]+):([0-9]+)$/);
|
|
12074
12057
|
|
|
12075
12058
|
if (!match) {
|
|
12076
12059
|
return {
|
|
@@ -12079,9 +12062,9 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
12079
12062
|
};
|
|
12080
12063
|
}
|
|
12081
12064
|
|
|
12082
|
-
const file =
|
|
12083
|
-
|
|
12084
|
-
|
|
12065
|
+
const file = urlWithLineAndColumn.slice(0, match.index);
|
|
12066
|
+
let line = parseInt(match[1]);
|
|
12067
|
+
let column = parseInt(match[2]);
|
|
12085
12068
|
const urlInfo = context.urlGraph.getUrlInfo(file);
|
|
12086
12069
|
|
|
12087
12070
|
if (!urlInfo) {
|
|
@@ -12090,6 +12073,23 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
12090
12073
|
};
|
|
12091
12074
|
}
|
|
12092
12075
|
|
|
12076
|
+
const remap = searchParams.has("remap");
|
|
12077
|
+
|
|
12078
|
+
if (remap) {
|
|
12079
|
+
const sourcemap = urlInfo.sourcemap;
|
|
12080
|
+
|
|
12081
|
+
if (sourcemap) {
|
|
12082
|
+
const original = await getOriginalPosition({
|
|
12083
|
+
sourcemap,
|
|
12084
|
+
url: file,
|
|
12085
|
+
line,
|
|
12086
|
+
column
|
|
12087
|
+
});
|
|
12088
|
+
line = original.line;
|
|
12089
|
+
column = original.column;
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
|
|
12093
12093
|
const codeFrame = stringifyUrlSite({
|
|
12094
12094
|
url: file,
|
|
12095
12095
|
line,
|
|
@@ -12106,6 +12106,87 @@ const jsenvPluginHtmlSupervisor = ({
|
|
|
12106
12106
|
};
|
|
12107
12107
|
}
|
|
12108
12108
|
|
|
12109
|
+
if (request.ressource.startsWith("/__get_error_cause__/")) {
|
|
12110
|
+
const file = request.ressource.slice("/__get_error_cause__/".length);
|
|
12111
|
+
|
|
12112
|
+
if (!file) {
|
|
12113
|
+
return {
|
|
12114
|
+
status: 400,
|
|
12115
|
+
body: "Missing file in url"
|
|
12116
|
+
};
|
|
12117
|
+
}
|
|
12118
|
+
|
|
12119
|
+
const getErrorCauseInfo = () => {
|
|
12120
|
+
const urlInfo = context.urlGraph.getUrlInfo(file);
|
|
12121
|
+
|
|
12122
|
+
if (!urlInfo) {
|
|
12123
|
+
return null;
|
|
12124
|
+
}
|
|
12125
|
+
|
|
12126
|
+
const {
|
|
12127
|
+
error
|
|
12128
|
+
} = urlInfo;
|
|
12129
|
+
|
|
12130
|
+
if (error) {
|
|
12131
|
+
return error;
|
|
12132
|
+
} // search in direct dependencies (404 or 500)
|
|
12133
|
+
|
|
12134
|
+
|
|
12135
|
+
const {
|
|
12136
|
+
dependencies
|
|
12137
|
+
} = urlInfo;
|
|
12138
|
+
|
|
12139
|
+
for (const dependencyUrl of dependencies) {
|
|
12140
|
+
const dependencyUrlInfo = context.urlGraph.getUrlInfo(dependencyUrl);
|
|
12141
|
+
|
|
12142
|
+
if (dependencyUrlInfo.error) {
|
|
12143
|
+
return dependencyUrlInfo.error;
|
|
12144
|
+
}
|
|
12145
|
+
}
|
|
12146
|
+
|
|
12147
|
+
return null;
|
|
12148
|
+
};
|
|
12149
|
+
|
|
12150
|
+
const causeInfo = getErrorCauseInfo();
|
|
12151
|
+
const body = JSON.stringify(causeInfo ? {
|
|
12152
|
+
code: causeInfo.code,
|
|
12153
|
+
message: causeInfo.message,
|
|
12154
|
+
reason: causeInfo.reason,
|
|
12155
|
+
stack: causeInfo.stack,
|
|
12156
|
+
codeFrame: causeInfo.traceMessage
|
|
12157
|
+
} : null, null, " ");
|
|
12158
|
+
return {
|
|
12159
|
+
status: 200,
|
|
12160
|
+
headers: {
|
|
12161
|
+
"cache-control": "no-cache",
|
|
12162
|
+
"content-type": "application/json",
|
|
12163
|
+
"content-length": Buffer.byteLength(body)
|
|
12164
|
+
},
|
|
12165
|
+
body
|
|
12166
|
+
};
|
|
12167
|
+
}
|
|
12168
|
+
|
|
12169
|
+
if (request.ressource.startsWith("/__open_in_editor__/")) {
|
|
12170
|
+
const file = request.ressource.slice("/__open_in_editor__/".length);
|
|
12171
|
+
|
|
12172
|
+
if (!file) {
|
|
12173
|
+
return {
|
|
12174
|
+
status: 400,
|
|
12175
|
+
body: "Missing file in url"
|
|
12176
|
+
};
|
|
12177
|
+
}
|
|
12178
|
+
|
|
12179
|
+
const launch = requireFromJsenv("launch-editor");
|
|
12180
|
+
launch(fileURLToPath(file), () => {// ignore error for now
|
|
12181
|
+
});
|
|
12182
|
+
return {
|
|
12183
|
+
status: 200,
|
|
12184
|
+
headers: {
|
|
12185
|
+
"cache-control": "no-store"
|
|
12186
|
+
}
|
|
12187
|
+
};
|
|
12188
|
+
}
|
|
12189
|
+
|
|
12109
12190
|
return null;
|
|
12110
12191
|
},
|
|
12111
12192
|
transformUrlContent: {
|
|
@@ -21030,6 +21111,7 @@ const createUrlGraph = ({
|
|
|
21030
21111
|
|
|
21031
21112
|
const createUrlInfo = url => {
|
|
21032
21113
|
return {
|
|
21114
|
+
error: null,
|
|
21033
21115
|
modifiedTimestamp: 0,
|
|
21034
21116
|
contentEtag: null,
|
|
21035
21117
|
dependsOnPackageJson: false,
|
|
@@ -21435,12 +21517,30 @@ const returnValueAssertions = [{
|
|
|
21435
21517
|
const createUrlInfoTransformer = ({
|
|
21436
21518
|
logger,
|
|
21437
21519
|
sourcemaps,
|
|
21520
|
+
sourcemapsSourcesProtocol,
|
|
21438
21521
|
sourcemapsSourcesContent,
|
|
21439
21522
|
sourcemapsRelativeSources,
|
|
21440
21523
|
urlGraph,
|
|
21524
|
+
clientRuntimeCompat,
|
|
21441
21525
|
injectSourcemapPlaceholder,
|
|
21442
21526
|
foundSourcemap
|
|
21443
21527
|
}) => {
|
|
21528
|
+
const runtimeNames = Object.keys(clientRuntimeCompat);
|
|
21529
|
+
const chromeAsSingleRuntime = runtimeNames.length === 1 && runtimeNames[0] === "chrome";
|
|
21530
|
+
|
|
21531
|
+
if (sourcemapsSourcesProtocol === undefined) {
|
|
21532
|
+
sourcemapsSourcesProtocol = "file:///";
|
|
21533
|
+
}
|
|
21534
|
+
|
|
21535
|
+
if (sourcemapsSourcesContent === undefined) {
|
|
21536
|
+
if (chromeAsSingleRuntime && sourcemapsSourcesProtocol === "file:///") {
|
|
21537
|
+
// chrome is able to fetch source when referenced with "file:"
|
|
21538
|
+
sourcemapsSourcesContent = false;
|
|
21539
|
+
} else {
|
|
21540
|
+
sourcemapsSourcesContent = true;
|
|
21541
|
+
}
|
|
21542
|
+
}
|
|
21543
|
+
|
|
21444
21544
|
const sourcemapsEnabled = sourcemaps === "inline" || sourcemaps === "file" || sourcemaps === "programmatic";
|
|
21445
21545
|
|
|
21446
21546
|
const normalizeSourcemap = (urlInfo, sourcemap) => {
|
|
@@ -21614,6 +21714,16 @@ const createUrlInfoTransformer = ({
|
|
|
21614
21714
|
});
|
|
21615
21715
|
}
|
|
21616
21716
|
|
|
21717
|
+
if (sourcemapsSourcesProtocol !== "file:///") {
|
|
21718
|
+
sourcemap.sources = sourcemap.sources.map(source => {
|
|
21719
|
+
if (source.startsWith("file:///")) {
|
|
21720
|
+
return `${sourcemapsSourcesProtocol}${source.slice("file:///".length)}`;
|
|
21721
|
+
}
|
|
21722
|
+
|
|
21723
|
+
return source;
|
|
21724
|
+
});
|
|
21725
|
+
}
|
|
21726
|
+
|
|
21617
21727
|
sourcemapUrlInfo.content = JSON.stringify(sourcemap, null, " ");
|
|
21618
21728
|
|
|
21619
21729
|
if (!urlInfo.sourcemapIsWrong) {
|
|
@@ -22013,6 +22123,9 @@ const createKitchen = ({
|
|
|
22013
22123
|
rootDirectoryUrl,
|
|
22014
22124
|
scenario,
|
|
22015
22125
|
runtimeCompat,
|
|
22126
|
+
// during dev/test clientRuntimeCompat is a single runtime
|
|
22127
|
+
// during build clientRuntimeCompat is runtimeCompat
|
|
22128
|
+
clientRuntimeCompat = runtimeCompat,
|
|
22016
22129
|
urlGraph,
|
|
22017
22130
|
plugins,
|
|
22018
22131
|
sourcemaps = {
|
|
@@ -22021,13 +22134,8 @@ const createKitchen = ({
|
|
|
22021
22134
|
test: "inline",
|
|
22022
22135
|
build: "none"
|
|
22023
22136
|
}[scenario],
|
|
22024
|
-
|
|
22025
|
-
|
|
22026
|
-
// as long as they use file:// protocol in the sourcemap files
|
|
22027
|
-
dev: false,
|
|
22028
|
-
test: false,
|
|
22029
|
-
build: true
|
|
22030
|
-
}[scenario],
|
|
22137
|
+
sourcemapsSourcesProtocol,
|
|
22138
|
+
sourcemapsSourcesContent,
|
|
22031
22139
|
sourcemapsRelativeSources,
|
|
22032
22140
|
writeGeneratedFiles
|
|
22033
22141
|
}) => {
|
|
@@ -22046,6 +22154,10 @@ const createKitchen = ({
|
|
|
22046
22154
|
urlGraph,
|
|
22047
22155
|
scenario,
|
|
22048
22156
|
runtimeCompat,
|
|
22157
|
+
clientRuntimeCompat,
|
|
22158
|
+
isSupportedOnCurrentClients: feature => {
|
|
22159
|
+
return RUNTIME_COMPAT.isSupported(clientRuntimeCompat, feature);
|
|
22160
|
+
},
|
|
22049
22161
|
isSupportedOnFutureClients: feature => {
|
|
22050
22162
|
return RUNTIME_COMPAT.isSupported(runtimeCompat, feature);
|
|
22051
22163
|
},
|
|
@@ -22194,8 +22306,10 @@ const createKitchen = ({
|
|
|
22194
22306
|
logger,
|
|
22195
22307
|
urlGraph,
|
|
22196
22308
|
sourcemaps,
|
|
22309
|
+
sourcemapsSourcesProtocol,
|
|
22197
22310
|
sourcemapsSourcesContent,
|
|
22198
22311
|
sourcemapsRelativeSources,
|
|
22312
|
+
clientRuntimeCompat,
|
|
22199
22313
|
injectSourcemapPlaceholder: ({
|
|
22200
22314
|
urlInfo,
|
|
22201
22315
|
specifier
|
|
@@ -22334,19 +22448,8 @@ const createKitchen = ({
|
|
|
22334
22448
|
};
|
|
22335
22449
|
|
|
22336
22450
|
const _cook = async (urlInfo, dishContext) => {
|
|
22337
|
-
// during dev/test clientRuntimeCompat is a single runtime
|
|
22338
|
-
// during build clientRuntimeCompat is runtimeCompat
|
|
22339
|
-
const {
|
|
22340
|
-
clientRuntimeCompat = runtimeCompat
|
|
22341
|
-
} = dishContext;
|
|
22342
|
-
|
|
22343
|
-
kitchenContext.isSupportedOnCurrentClients = feature => {
|
|
22344
|
-
return RUNTIME_COMPAT.isSupported(clientRuntimeCompat, feature);
|
|
22345
|
-
};
|
|
22346
|
-
|
|
22347
22451
|
const context = { ...kitchenContext,
|
|
22348
|
-
...dishContext
|
|
22349
|
-
clientRuntimeCompat
|
|
22452
|
+
...dishContext
|
|
22350
22453
|
};
|
|
22351
22454
|
const {
|
|
22352
22455
|
cookDuringCook = cook
|
|
@@ -22754,7 +22857,7 @@ const applyReferenceEffectsOnUrlInfo = (reference, urlInfo, context) => {
|
|
|
22754
22857
|
column: reference.specifierColumn
|
|
22755
22858
|
};
|
|
22756
22859
|
urlInfo.contentType = reference.contentType;
|
|
22757
|
-
urlInfo.originalContent = context === "build" ? urlInfo.originalContent === undefined ? reference.content : urlInfo.originalContent : reference.content;
|
|
22860
|
+
urlInfo.originalContent = context.scenario === "build" ? urlInfo.originalContent === undefined ? reference.content : urlInfo.originalContent : reference.content;
|
|
22758
22861
|
urlInfo.content = reference.content;
|
|
22759
22862
|
}
|
|
22760
22863
|
};
|
|
@@ -23117,17 +23220,11 @@ const createFileService = ({
|
|
|
23117
23220
|
cooldownBetweenFileEvents,
|
|
23118
23221
|
explorer,
|
|
23119
23222
|
sourcemaps,
|
|
23223
|
+
sourcemapsSourcesProtocol,
|
|
23224
|
+
sourcemapsSourcesContent,
|
|
23120
23225
|
writeGeneratedFiles
|
|
23121
23226
|
}) => {
|
|
23122
23227
|
const jsenvDirectoryUrl = new URL(".jsenv/", rootDirectoryUrl).href;
|
|
23123
|
-
const onErrorWhileServingFileCallbacks = [];
|
|
23124
|
-
|
|
23125
|
-
const onErrorWhileServingFile = data => {
|
|
23126
|
-
onErrorWhileServingFileCallbacks.forEach(onErrorWhileServingFileCallback => {
|
|
23127
|
-
onErrorWhileServingFileCallback(data);
|
|
23128
|
-
});
|
|
23129
|
-
};
|
|
23130
|
-
|
|
23131
23228
|
const clientFileChangeCallbackList = [];
|
|
23132
23229
|
const clientFilesPruneCallbackList = [];
|
|
23133
23230
|
|
|
@@ -23220,6 +23317,9 @@ const createFileService = ({
|
|
|
23220
23317
|
rootDirectoryUrl,
|
|
23221
23318
|
scenario,
|
|
23222
23319
|
runtimeCompat,
|
|
23320
|
+
clientRuntimeCompat: {
|
|
23321
|
+
[runtimeName]: runtimeVersion
|
|
23322
|
+
},
|
|
23223
23323
|
urlGraph,
|
|
23224
23324
|
plugins: [...plugins, ...getCorePlugins({
|
|
23225
23325
|
rootDirectoryUrl,
|
|
@@ -23236,6 +23336,8 @@ const createFileService = ({
|
|
|
23236
23336
|
explorer
|
|
23237
23337
|
})],
|
|
23238
23338
|
sourcemaps,
|
|
23339
|
+
sourcemapsSourcesProtocol,
|
|
23340
|
+
sourcemapsSourcesContent,
|
|
23239
23341
|
writeGeneratedFiles
|
|
23240
23342
|
});
|
|
23241
23343
|
serverStopCallbacks.push(() => {
|
|
@@ -23276,20 +23378,6 @@ const createFileService = ({
|
|
|
23276
23378
|
});
|
|
23277
23379
|
}
|
|
23278
23380
|
});
|
|
23279
|
-
});
|
|
23280
|
-
onErrorWhileServingFileCallbacks.push(data => {
|
|
23281
|
-
serverEventsDispatcher.dispatchToRoomsMatching({
|
|
23282
|
-
type: "error_while_serving_file",
|
|
23283
|
-
data
|
|
23284
|
-
}, room => {
|
|
23285
|
-
// send only to page depending on this file
|
|
23286
|
-
const errorFileUrl = data.url;
|
|
23287
|
-
const roomEntryPointUrl = new URL(room.request.ressource.slice(1), rootDirectoryUrl).href;
|
|
23288
|
-
const isErrorRelatedToEntryPoint = Boolean(urlGraph.findDependent(errorFileUrl, dependentUrlInfo => {
|
|
23289
|
-
return dependentUrlInfo.url === roomEntryPointUrl;
|
|
23290
|
-
}));
|
|
23291
|
-
return isErrorRelatedToEntryPoint;
|
|
23292
|
-
});
|
|
23293
23381
|
}); // "unshift" because serve must come first to catch event source client request
|
|
23294
23382
|
|
|
23295
23383
|
kitchen.pluginController.unshiftPlugin({
|
|
@@ -23387,6 +23475,7 @@ const createFileService = ({
|
|
|
23387
23475
|
try {
|
|
23388
23476
|
// urlInfo objects are reused, they must be "reset" before cooking them again
|
|
23389
23477
|
if (urlInfo.contentEtag && !urlInfo.isInline && urlInfo.type !== "sourcemap") {
|
|
23478
|
+
urlInfo.error = null;
|
|
23390
23479
|
urlInfo.sourcemap = null;
|
|
23391
23480
|
urlInfo.sourcemapReference = null;
|
|
23392
23481
|
urlInfo.content = null;
|
|
@@ -23400,9 +23489,6 @@ const createFileService = ({
|
|
|
23400
23489
|
await kitchen.cook(urlInfo, {
|
|
23401
23490
|
request,
|
|
23402
23491
|
reference,
|
|
23403
|
-
clientRuntimeCompat: {
|
|
23404
|
-
[runtimeName]: runtimeVersion
|
|
23405
|
-
},
|
|
23406
23492
|
outDirectoryUrl: scenario === "dev" ? `${rootDirectoryUrl}.jsenv/${runtimeName}@${runtimeVersion}/` : `${rootDirectoryUrl}.jsenv/${scenario}/${runtimeName}@${runtimeVersion}/`
|
|
23407
23493
|
});
|
|
23408
23494
|
let {
|
|
@@ -23434,19 +23520,10 @@ const createFileService = ({
|
|
|
23434
23520
|
});
|
|
23435
23521
|
return response;
|
|
23436
23522
|
} catch (e) {
|
|
23523
|
+
urlInfo.error = e;
|
|
23437
23524
|
const code = e.code;
|
|
23438
23525
|
|
|
23439
23526
|
if (code === "PARSE_ERROR") {
|
|
23440
|
-
onErrorWhileServingFile({
|
|
23441
|
-
requestedRessource: request.ressource,
|
|
23442
|
-
code: "PARSE_ERROR",
|
|
23443
|
-
message: e.reason,
|
|
23444
|
-
url: e.url,
|
|
23445
|
-
traceUrl: e.traceUrl,
|
|
23446
|
-
traceLine: e.traceLine,
|
|
23447
|
-
traceColumn: e.traceColumn,
|
|
23448
|
-
traceMessage: e.traceMessage
|
|
23449
|
-
});
|
|
23450
23527
|
return {
|
|
23451
23528
|
url: reference.url,
|
|
23452
23529
|
status: 200,
|
|
@@ -23481,17 +23558,6 @@ const createFileService = ({
|
|
|
23481
23558
|
}
|
|
23482
23559
|
|
|
23483
23560
|
if (code === "NOT_FOUND") {
|
|
23484
|
-
onErrorWhileServingFile({
|
|
23485
|
-
requestedRessource: request.ressource,
|
|
23486
|
-
isFaviconAutoRequest: request.ressource === "/favicon.ico" && reference.type === "http_request",
|
|
23487
|
-
code: "NOT_FOUND",
|
|
23488
|
-
message: e.reason,
|
|
23489
|
-
url: e.url,
|
|
23490
|
-
traceUrl: e.traceUrl,
|
|
23491
|
-
traceLine: e.traceLine,
|
|
23492
|
-
traceColumn: e.traceColumn,
|
|
23493
|
-
traceMessage: e.traceMessage
|
|
23494
|
-
});
|
|
23495
23561
|
return {
|
|
23496
23562
|
url: reference.url,
|
|
23497
23563
|
status: 404,
|
|
@@ -23500,16 +23566,6 @@ const createFileService = ({
|
|
|
23500
23566
|
};
|
|
23501
23567
|
}
|
|
23502
23568
|
|
|
23503
|
-
onErrorWhileServingFile({
|
|
23504
|
-
requestedRessource: request.ressource,
|
|
23505
|
-
code: "UNEXPECTED",
|
|
23506
|
-
stack: e.stack,
|
|
23507
|
-
url: e.url,
|
|
23508
|
-
traceUrl: e.traceUrl,
|
|
23509
|
-
traceLine: e.traceLine,
|
|
23510
|
-
traceColumn: e.traceColumn,
|
|
23511
|
-
traceMessage: e.traceMessage
|
|
23512
|
-
});
|
|
23513
23569
|
return {
|
|
23514
23570
|
url: reference.url,
|
|
23515
23571
|
status: 500,
|
|
@@ -23578,6 +23634,8 @@ const startOmegaServer = async ({
|
|
|
23578
23634
|
cooldownBetweenFileEvents,
|
|
23579
23635
|
explorer,
|
|
23580
23636
|
sourcemaps,
|
|
23637
|
+
sourcemapsSourcesProtocol,
|
|
23638
|
+
sourcemapsSourcesContent,
|
|
23581
23639
|
writeGeneratedFiles
|
|
23582
23640
|
}) => {
|
|
23583
23641
|
const serverStopCallbacks = [];
|
|
@@ -23624,6 +23682,8 @@ const startOmegaServer = async ({
|
|
|
23624
23682
|
cooldownBetweenFileEvents,
|
|
23625
23683
|
explorer,
|
|
23626
23684
|
sourcemaps,
|
|
23685
|
+
sourcemapsSourcesProtocol,
|
|
23686
|
+
sourcemapsSourcesContent,
|
|
23627
23687
|
writeGeneratedFiles
|
|
23628
23688
|
})
|
|
23629
23689
|
}, {
|
|
@@ -23736,6 +23796,8 @@ const startDevServer = async ({
|
|
|
23736
23796
|
},
|
|
23737
23797
|
// toolbar = false,
|
|
23738
23798
|
sourcemaps = "inline",
|
|
23799
|
+
sourcemapsSourcesProtocol,
|
|
23800
|
+
sourcemapsSourcesContent,
|
|
23739
23801
|
writeGeneratedFiles = true
|
|
23740
23802
|
}) => {
|
|
23741
23803
|
const logger = createLogger({
|
|
@@ -23851,6 +23913,8 @@ const startDevServer = async ({
|
|
|
23851
23913
|
cooldownBetweenFileEvents,
|
|
23852
23914
|
explorer,
|
|
23853
23915
|
sourcemaps,
|
|
23916
|
+
sourcemapsSourcesProtocol,
|
|
23917
|
+
sourcemapsSourcesContent,
|
|
23854
23918
|
writeGeneratedFiles
|
|
23855
23919
|
});
|
|
23856
23920
|
startDevServerTask.done();
|
|
@@ -25715,7 +25779,7 @@ const executeTestPlan = async ({
|
|
|
25715
25779
|
keepRunning = false,
|
|
25716
25780
|
cooldownBetweenExecutions = 0,
|
|
25717
25781
|
gcBetweenExecutions = logMemoryHeapUsage,
|
|
25718
|
-
coverageEnabled = process.argv.includes("--
|
|
25782
|
+
coverageEnabled = process.argv.includes("--coverage"),
|
|
25719
25783
|
coverageConfig = {
|
|
25720
25784
|
"./src/": true
|
|
25721
25785
|
},
|
|
@@ -27466,8 +27530,7 @@ const loadUrlGraph = async ({
|
|
|
27466
27530
|
kitchen,
|
|
27467
27531
|
startLoading,
|
|
27468
27532
|
writeGeneratedFiles,
|
|
27469
|
-
outDirectoryUrl
|
|
27470
|
-
clientRuntimeCompat
|
|
27533
|
+
outDirectoryUrl
|
|
27471
27534
|
}) => {
|
|
27472
27535
|
if (writeGeneratedFiles && outDirectoryUrl) {
|
|
27473
27536
|
await ensureEmptyDirectory(outDirectoryUrl);
|
|
@@ -27482,7 +27545,6 @@ const loadUrlGraph = async ({
|
|
|
27482
27545
|
|
|
27483
27546
|
const promise = _cook(urlInfo, {
|
|
27484
27547
|
outDirectoryUrl,
|
|
27485
|
-
clientRuntimeCompat,
|
|
27486
27548
|
...context
|
|
27487
27549
|
});
|
|
27488
27550
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.6.1",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@jsenv/log": "3.1.0",
|
|
75
75
|
"@jsenv/node-esm-resolution": "0.1.0",
|
|
76
76
|
"@jsenv/server": "13.0.0",
|
|
77
|
-
"@jsenv/sourcemap": "1.0.
|
|
77
|
+
"@jsenv/sourcemap": "1.0.4",
|
|
78
78
|
"@jsenv/uneval": "1.6.0",
|
|
79
79
|
"@jsenv/url-meta": "7.0.0",
|
|
80
80
|
"@jsenv/urls": "1.2.7",
|
|
@@ -70,6 +70,8 @@ export const startDevServer = async ({
|
|
|
70
70
|
// toolbar = false,
|
|
71
71
|
|
|
72
72
|
sourcemaps = "inline",
|
|
73
|
+
sourcemapsSourcesProtocol,
|
|
74
|
+
sourcemapsSourcesContent,
|
|
73
75
|
writeGeneratedFiles = true,
|
|
74
76
|
}) => {
|
|
75
77
|
const logger = createLogger({ logLevel })
|
|
@@ -171,6 +173,8 @@ export const startDevServer = async ({
|
|
|
171
173
|
cooldownBetweenFileEvents,
|
|
172
174
|
explorer,
|
|
173
175
|
sourcemaps,
|
|
176
|
+
sourcemapsSourcesProtocol,
|
|
177
|
+
sourcemapsSourcesContent,
|
|
174
178
|
writeGeneratedFiles,
|
|
175
179
|
})
|
|
176
180
|
startDevServerTask.done()
|
package/src/omega/kitchen.js
CHANGED
|
@@ -30,6 +30,9 @@ export const createKitchen = ({
|
|
|
30
30
|
rootDirectoryUrl,
|
|
31
31
|
scenario,
|
|
32
32
|
runtimeCompat,
|
|
33
|
+
// during dev/test clientRuntimeCompat is a single runtime
|
|
34
|
+
// during build clientRuntimeCompat is runtimeCompat
|
|
35
|
+
clientRuntimeCompat = runtimeCompat,
|
|
33
36
|
urlGraph,
|
|
34
37
|
plugins,
|
|
35
38
|
sourcemaps = {
|
|
@@ -37,13 +40,8 @@ export const createKitchen = ({
|
|
|
37
40
|
test: "inline",
|
|
38
41
|
build: "none",
|
|
39
42
|
}[scenario],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// as long as they use file:// protocol in the sourcemap files
|
|
43
|
-
dev: false,
|
|
44
|
-
test: false,
|
|
45
|
-
build: true,
|
|
46
|
-
}[scenario],
|
|
43
|
+
sourcemapsSourcesProtocol,
|
|
44
|
+
sourcemapsSourcesContent,
|
|
47
45
|
sourcemapsRelativeSources,
|
|
48
46
|
writeGeneratedFiles,
|
|
49
47
|
}) => {
|
|
@@ -60,6 +58,10 @@ export const createKitchen = ({
|
|
|
60
58
|
urlGraph,
|
|
61
59
|
scenario,
|
|
62
60
|
runtimeCompat,
|
|
61
|
+
clientRuntimeCompat,
|
|
62
|
+
isSupportedOnCurrentClients: (feature) => {
|
|
63
|
+
return RUNTIME_COMPAT.isSupported(clientRuntimeCompat, feature)
|
|
64
|
+
},
|
|
63
65
|
isSupportedOnFutureClients: (feature) => {
|
|
64
66
|
return RUNTIME_COMPAT.isSupported(runtimeCompat, feature)
|
|
65
67
|
},
|
|
@@ -214,12 +216,15 @@ export const createKitchen = ({
|
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
kitchenContext.resolveReference = resolveReference
|
|
219
|
+
|
|
217
220
|
const urlInfoTransformer = createUrlInfoTransformer({
|
|
218
221
|
logger,
|
|
219
222
|
urlGraph,
|
|
220
223
|
sourcemaps,
|
|
224
|
+
sourcemapsSourcesProtocol,
|
|
221
225
|
sourcemapsSourcesContent,
|
|
222
226
|
sourcemapsRelativeSources,
|
|
227
|
+
clientRuntimeCompat,
|
|
223
228
|
injectSourcemapPlaceholder: ({ urlInfo, specifier }) => {
|
|
224
229
|
const sourcemapReference = createReference({
|
|
225
230
|
trace: {
|
|
@@ -356,16 +361,9 @@ export const createKitchen = ({
|
|
|
356
361
|
}
|
|
357
362
|
|
|
358
363
|
const _cook = async (urlInfo, dishContext) => {
|
|
359
|
-
// during dev/test clientRuntimeCompat is a single runtime
|
|
360
|
-
// during build clientRuntimeCompat is runtimeCompat
|
|
361
|
-
const { clientRuntimeCompat = runtimeCompat } = dishContext
|
|
362
|
-
kitchenContext.isSupportedOnCurrentClients = (feature) => {
|
|
363
|
-
return RUNTIME_COMPAT.isSupported(clientRuntimeCompat, feature)
|
|
364
|
-
}
|
|
365
364
|
const context = {
|
|
366
365
|
...kitchenContext,
|
|
367
366
|
...dishContext,
|
|
368
|
-
clientRuntimeCompat,
|
|
369
367
|
}
|
|
370
368
|
const { cookDuringCook = cook } = dishContext
|
|
371
369
|
context.cook = (urlInfo, nestedDishContext) => {
|
|
@@ -772,7 +770,7 @@ const applyReferenceEffectsOnUrlInfo = (reference, urlInfo, context) => {
|
|
|
772
770
|
}
|
|
773
771
|
urlInfo.contentType = reference.contentType
|
|
774
772
|
urlInfo.originalContent =
|
|
775
|
-
context === "build"
|
|
773
|
+
context.scenario === "build"
|
|
776
774
|
? urlInfo.originalContent === undefined
|
|
777
775
|
? reference.content
|
|
778
776
|
: urlInfo.originalContent
|
|
@@ -38,6 +38,8 @@ export const startOmegaServer = async ({
|
|
|
38
38
|
cooldownBetweenFileEvents,
|
|
39
39
|
explorer,
|
|
40
40
|
sourcemaps,
|
|
41
|
+
sourcemapsSourcesProtocol,
|
|
42
|
+
sourcemapsSourcesContent,
|
|
41
43
|
writeGeneratedFiles,
|
|
42
44
|
}) => {
|
|
43
45
|
const serverStopCallbacks = []
|
|
@@ -93,6 +95,8 @@ export const startOmegaServer = async ({
|
|
|
93
95
|
cooldownBetweenFileEvents,
|
|
94
96
|
explorer,
|
|
95
97
|
sourcemaps,
|
|
98
|
+
sourcemapsSourcesProtocol,
|
|
99
|
+
sourcemapsSourcesContent,
|
|
96
100
|
writeGeneratedFiles,
|
|
97
101
|
}),
|
|
98
102
|
},
|