@jsenv/core 27.5.1 → 27.6.0

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
@@ -152,7 +152,7 @@ const generateInlineContentUrl = ({
152
152
  lineEnd,
153
153
  columnEnd
154
154
  }) => {
155
- const generatedName = line === lineEnd ? `L${line}C${column}-L${lineEnd}C${columnEnd}` : `L${line}-L${lineEnd}`;
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:"
@@ -12035,7 +12035,8 @@ const jsenvPluginHtmlSupervisor = ({
12035
12035
  logs = false,
12036
12036
  measurePerf = false,
12037
12037
  errorOverlay = true,
12038
- openInEditor = true
12038
+ openInEditor = true,
12039
+ errorBaseUrl
12039
12040
  }) => {
12040
12041
  const htmlSupervisorSetupFileUrl = new URL("./js/html_supervisor_setup.js", import.meta.url).href;
12041
12042
  const htmlSupervisorInstallerFileUrl = new URL("./js/html_supervisor_installer.js", import.meta.url).href;
@@ -12045,26 +12046,127 @@ const jsenvPluginHtmlSupervisor = ({
12045
12046
  dev: true,
12046
12047
  test: true
12047
12048
  },
12048
- serve: request => {
12049
- if (!request.ressource.startsWith("/__open_in_editor__/")) {
12050
- return null;
12049
+ serve: (request, context) => {
12050
+ if (request.ressource.startsWith("/__get_code_frame__/")) {
12051
+ const url = request.ressource.slice("/__get_code_frame__/".length);
12052
+ const match = url.match(/:([0-9]+):([0-9]+)$/);
12053
+
12054
+ if (!match) {
12055
+ return {
12056
+ status: 400,
12057
+ body: "Missing line and column in url"
12058
+ };
12059
+ }
12060
+
12061
+ const file = url.slice(0, match.index);
12062
+ const line = parseInt(match[1]);
12063
+ const column = parseInt(match[2]);
12064
+ const urlInfo = context.urlGraph.getUrlInfo(file);
12065
+
12066
+ if (!urlInfo) {
12067
+ return {
12068
+ status: 404
12069
+ };
12070
+ }
12071
+
12072
+ const codeFrame = stringifyUrlSite({
12073
+ url: file,
12074
+ line,
12075
+ column,
12076
+ content: urlInfo.originalContent
12077
+ });
12078
+ return {
12079
+ status: 200,
12080
+ headers: {
12081
+ "content-type": "text/plain",
12082
+ "content-length": Buffer.byteLength(codeFrame)
12083
+ },
12084
+ body: codeFrame
12085
+ };
12051
12086
  }
12052
12087
 
12053
- const file = request.ressource.slice("/__open_in_editor__/".length);
12088
+ if (request.ressource.startsWith("/__get_error_cause__/")) {
12089
+ const file = request.ressource.slice("/__get_error_cause__/".length);
12090
+
12091
+ if (!file) {
12092
+ return {
12093
+ status: 400,
12094
+ body: "Missing file in url"
12095
+ };
12096
+ }
12097
+
12098
+ const getErrorCauseInfo = () => {
12099
+ const urlInfo = context.urlGraph.getUrlInfo(file);
12100
+
12101
+ if (!urlInfo) {
12102
+ return null;
12103
+ }
12104
+
12105
+ const {
12106
+ error
12107
+ } = urlInfo;
12108
+
12109
+ if (error) {
12110
+ return error;
12111
+ } // search in direct dependencies (404 or 500)
12112
+
12113
+
12114
+ const {
12115
+ dependencies
12116
+ } = urlInfo;
12117
+
12118
+ for (const dependencyUrl of dependencies) {
12119
+ const dependencyUrlInfo = context.urlGraph.getUrlInfo(dependencyUrl);
12054
12120
 
12055
- if (!file) {
12121
+ if (dependencyUrlInfo.error) {
12122
+ return dependencyUrlInfo.error;
12123
+ }
12124
+ }
12125
+
12126
+ return null;
12127
+ };
12128
+
12129
+ const causeInfo = getErrorCauseInfo();
12130
+ const body = JSON.stringify(causeInfo ? {
12131
+ code: causeInfo.code,
12132
+ message: causeInfo.message,
12133
+ reason: causeInfo.reason,
12134
+ stack: causeInfo.stack,
12135
+ codeFrame: causeInfo.traceMessage
12136
+ } : null, null, " ");
12056
12137
  return {
12057
- status: 400,
12058
- body: 'Missing "file" in url search params'
12138
+ status: 200,
12139
+ headers: {
12140
+ "cache-control": "no-cache",
12141
+ "content-type": "application/json",
12142
+ "content-length": Buffer.byteLength(body)
12143
+ },
12144
+ body
12059
12145
  };
12060
12146
  }
12061
12147
 
12062
- const launch = requireFromJsenv("launch-editor");
12063
- launch(fileURLToPath(file), () => {// ignore error for now
12064
- });
12065
- return {
12066
- status: 200
12067
- };
12148
+ if (request.ressource.startsWith("/__open_in_editor__/")) {
12149
+ const file = request.ressource.slice("/__open_in_editor__/".length);
12150
+
12151
+ if (!file) {
12152
+ return {
12153
+ status: 400,
12154
+ body: "Missing file in url"
12155
+ };
12156
+ }
12157
+
12158
+ const launch = requireFromJsenv("launch-editor");
12159
+ launch(fileURLToPath(file), () => {// ignore error for now
12160
+ });
12161
+ return {
12162
+ status: 200,
12163
+ headers: {
12164
+ "cache-control": "no-store"
12165
+ }
12166
+ };
12167
+ }
12168
+
12169
+ return null;
12068
12170
  },
12069
12171
  transformUrlContent: {
12070
12172
  html: ({
@@ -12193,6 +12295,7 @@ const jsenvPluginHtmlSupervisor = ({
12193
12295
  import { installHtmlSupervisor } from ${htmlSupervisorInstallerFileReference.generatedSpecifier}
12194
12296
  installHtmlSupervisor(${JSON.stringify({
12195
12297
  rootDirectoryUrl: context.rootDirectoryUrl,
12298
+ errorBaseUrl,
12196
12299
  logs,
12197
12300
  measurePerf,
12198
12301
  errorOverlay,
@@ -20987,6 +21090,7 @@ const createUrlGraph = ({
20987
21090
 
20988
21091
  const createUrlInfo = url => {
20989
21092
  return {
21093
+ error: null,
20990
21094
  modifiedTimestamp: 0,
20991
21095
  contentEtag: null,
20992
21096
  dependsOnPackageJson: false,
@@ -21392,12 +21496,30 @@ const returnValueAssertions = [{
21392
21496
  const createUrlInfoTransformer = ({
21393
21497
  logger,
21394
21498
  sourcemaps,
21499
+ sourcemapsSourcesProtocol,
21395
21500
  sourcemapsSourcesContent,
21396
21501
  sourcemapsRelativeSources,
21397
21502
  urlGraph,
21503
+ clientRuntimeCompat,
21398
21504
  injectSourcemapPlaceholder,
21399
21505
  foundSourcemap
21400
21506
  }) => {
21507
+ const runtimeNames = Object.keys(clientRuntimeCompat);
21508
+ const chromeAsSingleRuntime = runtimeNames.length === 1 && runtimeNames[0] === "chrome";
21509
+
21510
+ if (sourcemapsSourcesProtocol === undefined) {
21511
+ sourcemapsSourcesProtocol = "file:///";
21512
+ }
21513
+
21514
+ if (sourcemapsSourcesContent === undefined) {
21515
+ if (chromeAsSingleRuntime && sourcemapsSourcesProtocol === "file:///") {
21516
+ // chrome is able to fetch source when referenced with "file:"
21517
+ sourcemapsSourcesContent = false;
21518
+ } else {
21519
+ sourcemapsSourcesContent = true;
21520
+ }
21521
+ }
21522
+
21401
21523
  const sourcemapsEnabled = sourcemaps === "inline" || sourcemaps === "file" || sourcemaps === "programmatic";
21402
21524
 
21403
21525
  const normalizeSourcemap = (urlInfo, sourcemap) => {
@@ -21571,6 +21693,16 @@ const createUrlInfoTransformer = ({
21571
21693
  });
21572
21694
  }
21573
21695
 
21696
+ if (sourcemapsSourcesProtocol !== "file:///") {
21697
+ sourcemap.sources = sourcemap.sources.map(source => {
21698
+ if (source.startsWith("file:///")) {
21699
+ return `${sourcemapsSourcesProtocol}${source.slice("file:///".length)}`;
21700
+ }
21701
+
21702
+ return source;
21703
+ });
21704
+ }
21705
+
21574
21706
  sourcemapUrlInfo.content = JSON.stringify(sourcemap, null, " ");
21575
21707
 
21576
21708
  if (!urlInfo.sourcemapIsWrong) {
@@ -21970,6 +22102,9 @@ const createKitchen = ({
21970
22102
  rootDirectoryUrl,
21971
22103
  scenario,
21972
22104
  runtimeCompat,
22105
+ // during dev/test clientRuntimeCompat is a single runtime
22106
+ // during build clientRuntimeCompat is runtimeCompat
22107
+ clientRuntimeCompat = runtimeCompat,
21973
22108
  urlGraph,
21974
22109
  plugins,
21975
22110
  sourcemaps = {
@@ -21978,13 +22113,8 @@ const createKitchen = ({
21978
22113
  test: "inline",
21979
22114
  build: "none"
21980
22115
  }[scenario],
21981
- sourcemapsSourcesContent = {
21982
- // during dev/test, chrome is able to find the sourcemap sources
21983
- // as long as they use file:// protocol in the sourcemap files
21984
- dev: false,
21985
- test: false,
21986
- build: true
21987
- }[scenario],
22116
+ sourcemapsSourcesProtocol,
22117
+ sourcemapsSourcesContent,
21988
22118
  sourcemapsRelativeSources,
21989
22119
  writeGeneratedFiles
21990
22120
  }) => {
@@ -22003,6 +22133,10 @@ const createKitchen = ({
22003
22133
  urlGraph,
22004
22134
  scenario,
22005
22135
  runtimeCompat,
22136
+ clientRuntimeCompat,
22137
+ isSupportedOnCurrentClients: feature => {
22138
+ return RUNTIME_COMPAT.isSupported(clientRuntimeCompat, feature);
22139
+ },
22006
22140
  isSupportedOnFutureClients: feature => {
22007
22141
  return RUNTIME_COMPAT.isSupported(runtimeCompat, feature);
22008
22142
  },
@@ -22151,8 +22285,10 @@ const createKitchen = ({
22151
22285
  logger,
22152
22286
  urlGraph,
22153
22287
  sourcemaps,
22288
+ sourcemapsSourcesProtocol,
22154
22289
  sourcemapsSourcesContent,
22155
22290
  sourcemapsRelativeSources,
22291
+ clientRuntimeCompat,
22156
22292
  injectSourcemapPlaceholder: ({
22157
22293
  urlInfo,
22158
22294
  specifier
@@ -22291,19 +22427,8 @@ const createKitchen = ({
22291
22427
  };
22292
22428
 
22293
22429
  const _cook = async (urlInfo, dishContext) => {
22294
- // during dev/test clientRuntimeCompat is a single runtime
22295
- // during build clientRuntimeCompat is runtimeCompat
22296
- const {
22297
- clientRuntimeCompat = runtimeCompat
22298
- } = dishContext;
22299
-
22300
- kitchenContext.isSupportedOnCurrentClients = feature => {
22301
- return RUNTIME_COMPAT.isSupported(clientRuntimeCompat, feature);
22302
- };
22303
-
22304
22430
  const context = { ...kitchenContext,
22305
- ...dishContext,
22306
- clientRuntimeCompat
22431
+ ...dishContext
22307
22432
  };
22308
22433
  const {
22309
22434
  cookDuringCook = cook
@@ -22711,7 +22836,7 @@ const applyReferenceEffectsOnUrlInfo = (reference, urlInfo, context) => {
22711
22836
  column: reference.specifierColumn
22712
22837
  };
22713
22838
  urlInfo.contentType = reference.contentType;
22714
- urlInfo.originalContent = context === "build" ? urlInfo.originalContent === undefined ? reference.content : urlInfo.originalContent : reference.content;
22839
+ urlInfo.originalContent = context.scenario === "build" ? urlInfo.originalContent === undefined ? reference.content : urlInfo.originalContent : reference.content;
22715
22840
  urlInfo.content = reference.content;
22716
22841
  }
22717
22842
  };
@@ -23074,17 +23199,11 @@ const createFileService = ({
23074
23199
  cooldownBetweenFileEvents,
23075
23200
  explorer,
23076
23201
  sourcemaps,
23202
+ sourcemapsSourcesProtocol,
23203
+ sourcemapsSourcesContent,
23077
23204
  writeGeneratedFiles
23078
23205
  }) => {
23079
23206
  const jsenvDirectoryUrl = new URL(".jsenv/", rootDirectoryUrl).href;
23080
- const onErrorWhileServingFileCallbacks = [];
23081
-
23082
- const onErrorWhileServingFile = data => {
23083
- onErrorWhileServingFileCallbacks.forEach(onErrorWhileServingFileCallback => {
23084
- onErrorWhileServingFileCallback(data);
23085
- });
23086
- };
23087
-
23088
23207
  const clientFileChangeCallbackList = [];
23089
23208
  const clientFilesPruneCallbackList = [];
23090
23209
 
@@ -23177,6 +23296,9 @@ const createFileService = ({
23177
23296
  rootDirectoryUrl,
23178
23297
  scenario,
23179
23298
  runtimeCompat,
23299
+ clientRuntimeCompat: {
23300
+ [runtimeName]: runtimeVersion
23301
+ },
23180
23302
  urlGraph,
23181
23303
  plugins: [...plugins, ...getCorePlugins({
23182
23304
  rootDirectoryUrl,
@@ -23193,6 +23315,8 @@ const createFileService = ({
23193
23315
  explorer
23194
23316
  })],
23195
23317
  sourcemaps,
23318
+ sourcemapsSourcesProtocol,
23319
+ sourcemapsSourcesContent,
23196
23320
  writeGeneratedFiles
23197
23321
  });
23198
23322
  serverStopCallbacks.push(() => {
@@ -23233,20 +23357,6 @@ const createFileService = ({
23233
23357
  });
23234
23358
  }
23235
23359
  });
23236
- });
23237
- onErrorWhileServingFileCallbacks.push(data => {
23238
- serverEventsDispatcher.dispatchToRoomsMatching({
23239
- type: "error_while_serving_file",
23240
- data
23241
- }, room => {
23242
- // send only to page depending on this file
23243
- const errorFileUrl = data.url;
23244
- const roomEntryPointUrl = new URL(room.request.ressource.slice(1), rootDirectoryUrl).href;
23245
- const isErrorRelatedToEntryPoint = Boolean(urlGraph.findDependent(errorFileUrl, dependentUrlInfo => {
23246
- return dependentUrlInfo.url === roomEntryPointUrl;
23247
- }));
23248
- return isErrorRelatedToEntryPoint;
23249
- });
23250
23360
  }); // "unshift" because serve must come first to catch event source client request
23251
23361
 
23252
23362
  kitchen.pluginController.unshiftPlugin({
@@ -23344,6 +23454,7 @@ const createFileService = ({
23344
23454
  try {
23345
23455
  // urlInfo objects are reused, they must be "reset" before cooking them again
23346
23456
  if (urlInfo.contentEtag && !urlInfo.isInline && urlInfo.type !== "sourcemap") {
23457
+ urlInfo.error = null;
23347
23458
  urlInfo.sourcemap = null;
23348
23459
  urlInfo.sourcemapReference = null;
23349
23460
  urlInfo.content = null;
@@ -23357,9 +23468,6 @@ const createFileService = ({
23357
23468
  await kitchen.cook(urlInfo, {
23358
23469
  request,
23359
23470
  reference,
23360
- clientRuntimeCompat: {
23361
- [runtimeName]: runtimeVersion
23362
- },
23363
23471
  outDirectoryUrl: scenario === "dev" ? `${rootDirectoryUrl}.jsenv/${runtimeName}@${runtimeVersion}/` : `${rootDirectoryUrl}.jsenv/${scenario}/${runtimeName}@${runtimeVersion}/`
23364
23472
  });
23365
23473
  let {
@@ -23391,19 +23499,10 @@ const createFileService = ({
23391
23499
  });
23392
23500
  return response;
23393
23501
  } catch (e) {
23502
+ urlInfo.error = e;
23394
23503
  const code = e.code;
23395
23504
 
23396
23505
  if (code === "PARSE_ERROR") {
23397
- onErrorWhileServingFile({
23398
- requestedRessource: request.ressource,
23399
- code: "PARSE_ERROR",
23400
- message: e.reason,
23401
- url: e.url,
23402
- traceUrl: e.traceUrl,
23403
- traceLine: e.traceLine,
23404
- traceColumn: e.traceColumn,
23405
- traceMessage: e.traceMessage
23406
- });
23407
23506
  return {
23408
23507
  url: reference.url,
23409
23508
  status: 200,
@@ -23438,17 +23537,6 @@ const createFileService = ({
23438
23537
  }
23439
23538
 
23440
23539
  if (code === "NOT_FOUND") {
23441
- onErrorWhileServingFile({
23442
- requestedRessource: request.ressource,
23443
- isFaviconAutoRequest: request.ressource === "/favicon.ico" && reference.type === "http_request",
23444
- code: "NOT_FOUND",
23445
- message: e.reason,
23446
- url: e.url,
23447
- traceUrl: e.traceUrl,
23448
- traceLine: e.traceLine,
23449
- traceColumn: e.traceColumn,
23450
- traceMessage: e.traceMessage
23451
- });
23452
23540
  return {
23453
23541
  url: reference.url,
23454
23542
  status: 404,
@@ -23457,16 +23545,6 @@ const createFileService = ({
23457
23545
  };
23458
23546
  }
23459
23547
 
23460
- onErrorWhileServingFile({
23461
- requestedRessource: request.ressource,
23462
- code: "UNEXPECTED",
23463
- stack: e.stack,
23464
- url: e.url,
23465
- traceUrl: e.traceUrl,
23466
- traceLine: e.traceLine,
23467
- traceColumn: e.traceColumn,
23468
- traceMessage: e.traceMessage
23469
- });
23470
23548
  return {
23471
23549
  url: reference.url,
23472
23550
  status: 500,
@@ -23535,6 +23613,8 @@ const startOmegaServer = async ({
23535
23613
  cooldownBetweenFileEvents,
23536
23614
  explorer,
23537
23615
  sourcemaps,
23616
+ sourcemapsSourcesProtocol,
23617
+ sourcemapsSourcesContent,
23538
23618
  writeGeneratedFiles
23539
23619
  }) => {
23540
23620
  const serverStopCallbacks = [];
@@ -23581,6 +23661,8 @@ const startOmegaServer = async ({
23581
23661
  cooldownBetweenFileEvents,
23582
23662
  explorer,
23583
23663
  sourcemaps,
23664
+ sourcemapsSourcesProtocol,
23665
+ sourcemapsSourcesContent,
23584
23666
  writeGeneratedFiles
23585
23667
  })
23586
23668
  }, {
@@ -23693,6 +23775,8 @@ const startDevServer = async ({
23693
23775
  },
23694
23776
  // toolbar = false,
23695
23777
  sourcemaps = "inline",
23778
+ sourcemapsSourcesProtocol,
23779
+ sourcemapsSourcesContent,
23696
23780
  writeGeneratedFiles = true
23697
23781
  }) => {
23698
23782
  const logger = createLogger({
@@ -23808,6 +23892,8 @@ const startDevServer = async ({
23808
23892
  cooldownBetweenFileEvents,
23809
23893
  explorer,
23810
23894
  sourcemaps,
23895
+ sourcemapsSourcesProtocol,
23896
+ sourcemapsSourcesContent,
23811
23897
  writeGeneratedFiles
23812
23898
  });
23813
23899
  startDevServerTask.done();
@@ -25672,7 +25758,7 @@ const executeTestPlan = async ({
25672
25758
  keepRunning = false,
25673
25759
  cooldownBetweenExecutions = 0,
25674
25760
  gcBetweenExecutions = logMemoryHeapUsage,
25675
- coverageEnabled = process.argv.includes("--cover") || process.argv.includes("--coverage"),
25761
+ coverageEnabled = process.argv.includes("--coverage"),
25676
25762
  coverageConfig = {
25677
25763
  "./src/": true
25678
25764
  },
@@ -27423,8 +27509,7 @@ const loadUrlGraph = async ({
27423
27509
  kitchen,
27424
27510
  startLoading,
27425
27511
  writeGeneratedFiles,
27426
- outDirectoryUrl,
27427
- clientRuntimeCompat
27512
+ outDirectoryUrl
27428
27513
  }) => {
27429
27514
  if (writeGeneratedFiles && outDirectoryUrl) {
27430
27515
  await ensureEmptyDirectory(outDirectoryUrl);
@@ -27439,7 +27524,6 @@ const loadUrlGraph = async ({
27439
27524
 
27440
27525
  const promise = _cook(urlInfo, {
27441
27526
  outDirectoryUrl,
27442
- clientRuntimeCompat,
27443
27527
  ...context
27444
27528
  });
27445
27529
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "27.5.1",
3
+ "version": "27.6.0",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -50,6 +50,7 @@
50
50
  "performances": "node --expose-gc ./scripts/performance/generate_performance_report.mjs --log --once",
51
51
  "file-size": "node ./scripts/file_size/file_size.mjs --log",
52
52
  "start_file_server": "node ./scripts/dev/start_file_server.mjs",
53
+ "generate-dev-errors-snapshot-files": "node --conditions=development ./tests/dev_server/errors/generate_snapshot_files.mjs",
53
54
  "prettier": "prettier --write .",
54
55
  "playwright-install": "npx playwright install-deps && npx playwright install",
55
56
  "certificate-install": "node ./scripts/dev/install_certificate_authority.mjs",
@@ -73,7 +74,7 @@
73
74
  "@jsenv/log": "3.1.0",
74
75
  "@jsenv/node-esm-resolution": "0.1.0",
75
76
  "@jsenv/server": "13.0.0",
76
- "@jsenv/sourcemap": "1.0.2",
77
+ "@jsenv/sourcemap": "1.0.3",
77
78
  "@jsenv/uneval": "1.6.0",
78
79
  "@jsenv/url-meta": "7.0.0",
79
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()
@@ -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
- sourcemapsSourcesContent = {
41
- // during dev/test, chrome is able to find the sourcemap sources
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
  },