@jsenv/core 23.1.1 → 23.2.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.
Files changed (84) hide show
  1. package/dist/jsenv_browser_system.js +18 -82
  2. package/dist/jsenv_browser_system.js.map +11 -20
  3. package/dist/jsenv_compile_proxy.js +18 -82
  4. package/dist/jsenv_compile_proxy.js.map +11 -21
  5. package/dist/jsenv_exploring_index.js +127 -274
  6. package/dist/jsenv_exploring_index.js.map +76 -90
  7. package/dist/jsenv_exploring_redirector.js +21 -89
  8. package/dist/jsenv_exploring_redirector.js.map +13 -25
  9. package/dist/jsenv_toolbar.js +85 -149
  10. package/dist/jsenv_toolbar.js.map +51 -62
  11. package/dist/jsenv_toolbar_injector.js +185 -231
  12. package/dist/jsenv_toolbar_injector.js.map +30 -42
  13. package/{LICENSE → license} +0 -0
  14. package/package.json +7 -10
  15. package/src/abort/abortable.js +172 -0
  16. package/src/abort/callback_list.js +64 -0
  17. package/src/abort/callback_race.js +34 -0
  18. package/src/abort/cleaner.js +22 -0
  19. package/src/abort/main.js +32 -0
  20. package/src/abort/process_teardown_events.js +59 -0
  21. package/src/buildProject.js +132 -123
  22. package/src/execute.js +108 -107
  23. package/src/executeTestPlan.js +101 -121
  24. package/src/importUsingChildProcess.js +2 -1
  25. package/src/internal/browser-launcher/executeHtmlFile.js +22 -10
  26. package/src/internal/browser-utils/fetch-browser.js +4 -29
  27. package/src/internal/browser-utils/fetchUsingXHR.js +5 -7
  28. package/src/internal/building/buildUsingRollup.js +60 -24
  29. package/src/internal/building/createJsenvRollupPlugin.js +13 -31
  30. package/src/internal/building/ressource_builder.js +3 -6
  31. package/src/internal/building/sourcemap_loader.js +4 -5
  32. package/src/internal/building/url_fetcher.js +2 -5
  33. package/src/internal/building/url_loader.js +3 -6
  34. package/src/internal/compiling/compileFile.js +1 -2
  35. package/src/internal/compiling/createCompiledFileService.js +10 -10
  36. package/src/internal/compiling/jsenvCompilerForHtml.js +21 -7
  37. package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -0
  38. package/src/internal/compiling/startCompileServer.js +82 -134
  39. package/src/internal/executing/coverage/relativeUrlToEmptyCoverage.js +19 -30
  40. package/src/internal/executing/coverage/reportToCoverage.js +44 -24
  41. package/src/internal/executing/coverage/v8CoverageFromNodeV8Directory.js +2 -15
  42. package/src/internal/executing/createSummaryLog.js +47 -34
  43. package/src/internal/executing/executeConcurrently.js +89 -47
  44. package/src/internal/executing/executePlan.js +33 -7
  45. package/src/internal/executing/executionLogs.js +25 -28
  46. package/src/internal/executing/execution_colors.js +15 -0
  47. package/src/internal/executing/generateExecutionSteps.js +3 -2
  48. package/src/internal/executing/launchAndExecute.js +213 -257
  49. package/src/internal/exploring/fetchExploringJson.js +3 -4
  50. package/src/internal/fetchUrl.js +6 -2
  51. package/src/internal/logs/log_style.js +16 -28
  52. package/src/internal/logs/msAsDuration.js +1 -1
  53. package/src/internal/node-launcher/createChildProcessOptions.js +4 -5
  54. package/src/internal/node-launcher/createControllableNodeProcess.js +117 -229
  55. package/src/internal/node-launcher/kill_process_tree.js +76 -0
  56. package/src/internal/node-launcher/nodeControllableFile.mjs +16 -10
  57. package/src/internal/{promise_track_race.js → promise_race.js} +2 -2
  58. package/src/internal/toolbar/execution/toolbar.execution.js +4 -0
  59. package/src/internal/toolbar/toolbar.html +157 -61
  60. package/src/internal/toolbar/toolbar.injector.js +8 -0
  61. package/src/internal/toolbar/util/animation.js +3 -7
  62. package/src/internal/toolbar/util/fetching.js +1 -30
  63. package/src/jsenvServiceWorkerFinalizer.js +1 -2
  64. package/src/launchBrowser.js +127 -127
  65. package/src/launchNode.js +32 -17
  66. package/src/playwright_browser_versions.js +3 -3
  67. package/src/requireUsingChildProcess.js +2 -1
  68. package/src/signal/signal.js +65 -0
  69. package/src/startExploring.js +71 -71
  70. package/src/internal/executeJsenvAsyncFunction.js +0 -34
  71. package/src/internal/toolbar/animation/toolbar-movie-icon.svg +0 -15
  72. package/src/internal/toolbar/compilation/flask.svg +0 -7
  73. package/src/internal/toolbar/compilation/info.svg +0 -9
  74. package/src/internal/toolbar/compilation/loupe.svg +0 -11
  75. package/src/internal/toolbar/compilation/toolbar_compilation.svg +0 -11
  76. package/src/internal/toolbar/eventsource/toolbar-power-icon.svg +0 -10
  77. package/src/internal/toolbar/eventsource/toolbar-power-off-icon.svg +0 -10
  78. package/src/internal/toolbar/responsive/toolbar-dots-icon.svg +0 -10
  79. package/src/internal/toolbar/settings/toolbar-settings-icon.svg +0 -9
  80. package/src/internal/toolbar/theme/toolbar-palette-icon.svg +0 -10
  81. package/src/internal/toolbar/toolbar-cross-icon.svg +0 -10
  82. package/src/internal/toolbar/toolbar-loading-icon.svg +0 -102
  83. package/src/internal/toolbar/toolbar-notif-icon.svg +0 -9
  84. package/src/internal/trackRessources.js +0 -23
@@ -1,12 +1,14 @@
1
- import { createOperation } from "@jsenv/cancellation"
2
1
  import {
3
2
  urlToFileSystemPath,
4
3
  ensureEmptyDirectory,
5
4
  readFile,
6
5
  urlToRelativeUrl,
6
+ writeFile,
7
+ resolveUrl,
7
8
  } from "@jsenv/filesystem"
8
9
  import { createDetailedMessage } from "@jsenv/logger"
9
10
 
11
+ import { Abortable } from "@jsenv/core/src/abort/main.js"
10
12
  import { buildServiceWorker } from "@jsenv/core/src/internal/building/buildServiceWorker.js"
11
13
  import { humanizeUrl } from "@jsenv/core/src/internal/building/url_trace.js"
12
14
  import {
@@ -17,7 +19,7 @@ import { createRuntimeCompat } from "@jsenv/core/src/internal/generateGroupMap/r
17
19
  import { createJsenvRollupPlugin } from "./createJsenvRollupPlugin.js"
18
20
 
19
21
  export const buildUsingRollup = async ({
20
- cancellationToken,
22
+ buildOperation,
21
23
  logger,
22
24
 
23
25
  projectDirectoryUrl,
@@ -101,7 +103,7 @@ export const buildUsingRollup = async ({
101
103
  asOriginalUrl,
102
104
  asProjectUrl,
103
105
  } = await createJsenvRollupPlugin({
104
- cancellationToken,
106
+ buildOperation,
105
107
  logger,
106
108
 
107
109
  projectDirectoryUrl,
@@ -109,9 +111,6 @@ export const buildUsingRollup = async ({
109
111
  compileServerOrigin,
110
112
  compileDirectoryRelativeUrl,
111
113
  buildDirectoryUrl,
112
- assetManifestFile,
113
- assetManifestFileRelativeUrl,
114
- writeOnFileSystem,
115
114
 
116
115
  format,
117
116
  systemJsUrl,
@@ -142,7 +141,7 @@ export const buildUsingRollup = async ({
142
141
 
143
142
  try {
144
143
  await useRollup({
145
- cancellationToken,
144
+ buildOperation,
146
145
  logger,
147
146
 
148
147
  jsenvRollupPlugin,
@@ -189,9 +188,41 @@ export const buildUsingRollup = async ({
189
188
  throw e
190
189
  }
191
190
 
192
- const jsenvBuild = getResult()
191
+ const {
192
+ rollupBuild,
193
+ urlResponseBodyMap,
194
+ buildMappings,
195
+ buildManifest,
196
+ buildImportMap,
197
+ buildFileContents,
198
+ buildInlineFileContents,
199
+ buildStats,
200
+ } = getResult()
193
201
 
194
202
  if (writeOnFileSystem) {
203
+ if (buildDirectoryClean) {
204
+ await ensureEmptyDirectory(buildDirectoryUrl)
205
+ }
206
+
207
+ if (assetManifestFile) {
208
+ const assetManifestFileUrl = resolveUrl(
209
+ assetManifestFileRelativeUrl,
210
+ buildDirectoryUrl,
211
+ )
212
+ await writeFile(
213
+ assetManifestFileUrl,
214
+ JSON.stringify(buildManifest, null, " "),
215
+ )
216
+ }
217
+
218
+ const buildRelativeUrls = Object.keys(buildFileContents)
219
+ await Promise.all(
220
+ buildRelativeUrls.map(async (buildRelativeUrl) => {
221
+ const fileBuildUrl = resolveUrl(buildRelativeUrl, buildDirectoryUrl)
222
+ await writeFile(fileBuildUrl, buildFileContents[buildRelativeUrl])
223
+ }),
224
+ )
225
+
195
226
  await Promise.all(
196
227
  Object.keys(serviceWorkers).map(
197
228
  async (serviceWorkerProjectRelativeUrl) => {
@@ -203,7 +234,9 @@ export const buildUsingRollup = async ({
203
234
  serviceWorkerProjectRelativeUrl,
204
235
  serviceWorkerBuildRelativeUrl,
205
236
  serviceWorkerTransformer: (code) =>
206
- serviceWorkerFinalizer(code, jsenvBuild, {
237
+ serviceWorkerFinalizer(code, {
238
+ buildManifest,
239
+ rollupBuild,
207
240
  lineBreakNormalization,
208
241
  }),
209
242
 
@@ -214,11 +247,20 @@ export const buildUsingRollup = async ({
214
247
  )
215
248
  }
216
249
 
217
- return jsenvBuild
250
+ return {
251
+ rollupBuild,
252
+ urlResponseBodyMap,
253
+ buildMappings,
254
+ buildManifest,
255
+ buildImportMap,
256
+ buildFileContents,
257
+ buildInlineFileContents,
258
+ buildStats,
259
+ }
218
260
  }
219
261
 
220
262
  const useRollup = async ({
221
- cancellationToken,
263
+ buildOperation,
222
264
  logger,
223
265
  jsenvRollupPlugin,
224
266
  format,
@@ -228,9 +270,9 @@ const useRollup = async ({
228
270
  preserveEntrySignatures,
229
271
  // jsConcatenation,
230
272
  buildDirectoryUrl,
231
- buildDirectoryClean,
232
273
  asOriginalUrl,
233
274
  }) => {
275
+ Abortable.throwIfAborted(buildOperation)
234
276
  const { rollup } = await import("rollup")
235
277
  const { importAssertions } = await import("acorn-import-assertions")
236
278
 
@@ -308,19 +350,13 @@ const useRollup = async ({
308
350
  : {}),
309
351
  }
310
352
 
311
- const rollupReturnValue = await createOperation({
312
- cancellationToken,
313
- start: () => rollup(rollupInputOptions),
314
- })
353
+ Abortable.throwIfAborted(buildOperation)
354
+ const rollupReturnValue = await rollup(rollupInputOptions)
315
355
 
316
- if (buildDirectoryClean) {
317
- await ensureEmptyDirectory(buildDirectoryUrl)
318
- }
319
-
320
- const rollupOutputArray = await createOperation({
321
- cancellationToken,
322
- start: () => rollupReturnValue.generate(rollupOutputOptions),
323
- })
356
+ Abortable.throwIfAborted(buildOperation)
357
+ const rollupOutputArray = await rollupReturnValue.generate(
358
+ rollupOutputOptions,
359
+ )
324
360
 
325
361
  return rollupOutputArray
326
362
  }
@@ -9,7 +9,6 @@ import {
9
9
  resolveUrl,
10
10
  urlToRelativeUrl,
11
11
  resolveDirectoryUrl,
12
- writeFile,
13
12
  comparePathnames,
14
13
  urlIsInsideOf,
15
14
  normalizeStructuredMetaMap,
@@ -17,6 +16,7 @@ import {
17
16
  } from "@jsenv/filesystem"
18
17
  import { createWorkersForJavaScriptModules } from "@jsenv/workers"
19
18
 
19
+ import { Abortable } from "@jsenv/core/src/abort/main.js"
20
20
  import { createUrlConverter } from "@jsenv/core/src/internal/url_conversion.js"
21
21
  import { createUrlFetcher } from "@jsenv/core/src/internal/building/url_fetcher.js"
22
22
  import { createUrlLoader } from "@jsenv/core/src/internal/building/url_loader.js"
@@ -50,7 +50,7 @@ import { injectSourcemapInRollupBuild } from "./rollup_build_sourcemap.js"
50
50
  import { createBuildStats } from "./build_stats.js"
51
51
 
52
52
  export const createJsenvRollupPlugin = async ({
53
- cancellationToken,
53
+ buildOperation,
54
54
  logger,
55
55
 
56
56
  projectDirectoryUrl,
@@ -58,9 +58,6 @@ export const createJsenvRollupPlugin = async ({
58
58
  compileServerOrigin,
59
59
  compileDirectoryRelativeUrl,
60
60
  buildDirectoryUrl,
61
- assetManifestFile,
62
- assetManifestFileRelativeUrl,
63
- writeOnFileSystem,
64
61
 
65
62
  urlMappings,
66
63
  importResolutionMethod,
@@ -755,11 +752,17 @@ export const createJsenvRollupPlugin = async ({
755
752
  }
756
753
 
757
754
  let url = asServerUrl(rollupUrl)
758
- const loadResult = await urlLoader.loadUrl(rollupUrl, {
759
- cancellationToken,
760
- logger,
761
- ressourceBuilder,
762
- })
755
+
756
+ const loadResult = await Abortable.asyncCallback(
757
+ buildOperation,
758
+ (signal) => {
759
+ return urlLoader.loadUrl(rollupUrl, {
760
+ signal,
761
+ logger,
762
+ ressourceBuilder,
763
+ })
764
+ },
765
+ )
763
766
 
764
767
  url = loadResult.url
765
768
  const code = loadResult.code
@@ -1266,27 +1269,6 @@ export const createJsenvRollupPlugin = async ({
1266
1269
  buildDuration,
1267
1270
  })
1268
1271
 
1269
- if (assetManifestFile) {
1270
- const assetManifestFileUrl = resolveUrl(
1271
- assetManifestFileRelativeUrl,
1272
- buildDirectoryUrl,
1273
- )
1274
- await writeFile(
1275
- assetManifestFileUrl,
1276
- JSON.stringify(buildManifest, null, " "),
1277
- )
1278
- }
1279
-
1280
- if (writeOnFileSystem) {
1281
- const buildRelativeUrls = Object.keys(buildFileContents)
1282
- await Promise.all(
1283
- buildRelativeUrls.map(async (buildRelativeUrl) => {
1284
- const fileBuildUrl = resolveUrl(buildRelativeUrl, buildDirectoryUrl)
1285
- await writeFile(fileBuildUrl, buildFileContents[buildRelativeUrl])
1286
- }),
1287
- )
1288
- }
1289
-
1290
1272
  logger.info(
1291
1273
  formatBuildDoneInfo({
1292
1274
  buildStats,
@@ -9,7 +9,7 @@ import {
9
9
  import { createLogger } from "@jsenv/logger"
10
10
 
11
11
  import { setJavaScriptSourceMappingUrl } from "@jsenv/core/src/internal/sourceMappingURLUtils.js"
12
- import { promiseTrackRace } from "../promise_track_race.js"
12
+ import { racePromises } from "../promise_race.js"
13
13
  import { parseDataUrl } from "../dataUrl.utils.js"
14
14
 
15
15
  import {
@@ -400,11 +400,8 @@ export const createRessourceBuilder = (
400
400
  // and this asset builder fetching to avoid fetching twice.
401
401
  // This scenario would be reproduced for every js module preloaded
402
402
  const { usedPromise, rollupBuildDonePromise } = ressource
403
- const { winner } = await promiseTrackRace([
404
- usedPromise,
405
- rollupBuildDonePromise,
406
- ])
407
- if (winner === rollupBuildDonePromise) {
403
+ const winner = await racePromises([usedPromise, rollupBuildDonePromise])
404
+ if (winner.promise === rollupBuildDonePromise) {
408
405
  return
409
406
  }
410
407
  }
@@ -1,6 +1,5 @@
1
- import { createCancellationToken } from "@jsenv/cancellation"
2
1
  import { resolveUrl } from "@jsenv/filesystem"
3
- import { createLogger, createDetailedMessage } from "@jsenv/logger"
2
+ import { createDetailedMessage } from "@jsenv/logger"
4
3
 
5
4
  import {
6
5
  dataUrlToRawData,
@@ -10,8 +9,8 @@ import { fetchUrl } from "@jsenv/core/src/internal/fetchUrl.js"
10
9
  import { validateResponse } from "@jsenv/core/src/internal/response_validation.js"
11
10
 
12
11
  export const loadSourcemap = async ({
13
- cancellationToken = createCancellationToken(),
14
- logger = createLogger(),
12
+ signal,
13
+ logger,
15
14
 
16
15
  code,
17
16
  url,
@@ -33,7 +32,7 @@ export const loadSourcemap = async ({
33
32
  }
34
33
 
35
34
  const sourcemapResponse = await fetchUrl(sourcemapUrl, {
36
- cancellationToken,
35
+ signal,
37
36
  ignoreHttpsError: true,
38
37
  })
39
38
  const { isValid, details } = await validateResponse(sourcemapResponse, {
@@ -13,14 +13,11 @@ export const createUrlFetcher = ({
13
13
  }) => {
14
14
  const urlRedirectionMap = {}
15
15
 
16
- const fetchUrl = async (
17
- url,
18
- { cancellationToken, urlTrace, contentTypeExpected },
19
- ) => {
16
+ const fetchUrl = async (url, { signal, urlTrace, contentTypeExpected }) => {
20
17
  const urlToFetch = applyUrlMappings(url)
21
18
 
22
19
  const response = await jsenvFetchUrl(urlToFetch, {
23
- cancellationToken,
20
+ signal,
24
21
  ignoreHttpsError: true,
25
22
  })
26
23
  const responseUrl = response.url
@@ -21,10 +21,7 @@ export const createUrlLoader = ({
21
21
  }) => {
22
22
  const urlResponseBodyMap = {}
23
23
 
24
- const loadUrl = async (
25
- rollupUrl,
26
- { cancellationToken, logger, ressourceBuilder },
27
- ) => {
24
+ const loadUrl = async (rollupUrl, { signal, logger, ressourceBuilder }) => {
28
25
  let url = asServerUrl(rollupUrl)
29
26
  const { importType, urlWithoutImportType } = extractImportTypeFromUrl(url)
30
27
 
@@ -133,7 +130,7 @@ export const createUrlLoader = ({
133
130
  }
134
131
 
135
132
  const response = await urlFetcher.fetchUrl(url, {
136
- cancellationToken,
133
+ signal,
137
134
  contentTypeExpected: [
138
135
  "application/javascript",
139
136
  ...(allowJson ? ["application/json"] : []),
@@ -154,7 +151,7 @@ export const createUrlLoader = ({
154
151
  const jsText = await response.text()
155
152
  saveUrlResponseBody(response.url, jsText)
156
153
  const map = await loadSourcemap({
157
- cancellationToken,
154
+ signal,
158
155
  logger,
159
156
 
160
157
  url,
@@ -1,16 +1,15 @@
1
- import { convertFileSystemErrorToResponseProperties } from "@jsenv/server"
2
1
  import {
3
2
  urlToRelativeUrl,
4
3
  fileSystemPathToUrl,
5
4
  resolveUrl,
6
5
  bufferToEtag,
7
6
  } from "@jsenv/filesystem"
7
+ import { convertFileSystemErrorToResponseProperties } from "@jsenv/server/src/internal/convertFileSystemErrorToResponseProperties.js"
8
8
 
9
9
  import { getOrGenerateCompiledFile } from "./compile-directory/getOrGenerateCompiledFile.js"
10
10
  import { updateMeta } from "./compile-directory/updateMeta.js"
11
11
 
12
12
  export const compileFile = async ({
13
- // cancellatioToken,
14
13
  logger,
15
14
 
16
15
  projectDirectoryUrl,
@@ -1,4 +1,4 @@
1
- import { serveFile } from "@jsenv/server"
1
+ import { serveFile, nextService } from "@jsenv/server"
2
2
  import {
3
3
  resolveUrl,
4
4
  resolveDirectoryUrl,
@@ -31,8 +31,7 @@ const jsenvCompilers = {
31
31
  }
32
32
 
33
33
  export const createCompiledFileService = ({
34
- sourceFileService,
35
- cancellationToken,
34
+ compileServerOperation,
36
35
  logger,
37
36
 
38
37
  projectDirectoryUrl,
@@ -51,6 +50,7 @@ export const createCompiledFileService = ({
51
50
  projectFileRequestedCallback,
52
51
  useFilesystemAsCache,
53
52
  compileCacheStrategy,
53
+ sourcemapMethod,
54
54
  sourcemapExcludeSources,
55
55
  }) => {
56
56
  Object.keys(customCompilers).forEach((key) => {
@@ -80,7 +80,7 @@ export const createCompiledFileService = ({
80
80
 
81
81
  // not inside compile directory -> nothing to compile
82
82
  if (!requestCompileInfo.insideCompileDirectory) {
83
- return sourceFileService(request)
83
+ return null
84
84
  }
85
85
 
86
86
  const { compileId, afterCompileId } = requestCompileInfo
@@ -110,7 +110,7 @@ export const createCompiledFileService = ({
110
110
 
111
111
  // nothing after compileId, we don't know what to compile (not supposed to happen)
112
112
  if (afterCompileId === "") {
113
- return sourceFileService(request)
113
+ return null
114
114
  }
115
115
 
116
116
  const originalFileRelativeUrl = afterCompileId
@@ -132,7 +132,7 @@ export const createCompiledFileService = ({
132
132
  // we don't redirect otherwise it complexify ressource tracking
133
133
  // and url resolution
134
134
  if (!compiler) {
135
- return sourceFileService({
135
+ return nextService({
136
136
  ...request,
137
137
  ressource: `/${originalFileRelativeUrl}`,
138
138
  })
@@ -140,7 +140,7 @@ export const createCompiledFileService = ({
140
140
 
141
141
  // compile this if needed
142
142
  const compileResponsePromise = compileFile({
143
- cancellationToken,
143
+ compileServerOperation,
144
144
  logger,
145
145
 
146
146
  projectDirectoryUrl,
@@ -152,9 +152,9 @@ export const createCompiledFileService = ({
152
152
  compileCacheStrategy,
153
153
  projectFileRequestedCallback,
154
154
  request,
155
- compile: ({ code, map }) => {
155
+ compile: ({ signal, code, map }) => {
156
156
  return compiler({
157
- cancellationToken,
157
+ signal,
158
158
  logger,
159
159
 
160
160
  code,
@@ -175,7 +175,7 @@ export const createCompiledFileService = ({
175
175
  groupMap,
176
176
  }),
177
177
 
178
- sourcemapMethod: "comment", // "inline" is also possible
178
+ sourcemapMethod,
179
179
  sourcemapExcludeSources,
180
180
  jsenvToolbarInjection,
181
181
  })
@@ -6,7 +6,10 @@ import {
6
6
  jsenvToolbarInjectorFileInfo,
7
7
  } from "@jsenv/core/src/internal/jsenvInternalFiles.js"
8
8
  import { getDefaultImportMap } from "@jsenv/core/src/internal/import-resolution/importmap-default.js"
9
- import { setJavaScriptSourceMappingUrl } from "../sourceMappingURLUtils.js"
9
+ import {
10
+ setJavaScriptSourceMappingUrl,
11
+ sourcemapToBase64Url,
12
+ } from "../sourceMappingURLUtils.js"
10
13
  import { transformJs } from "./js-compilation-service/transformJs.js"
11
14
  import {
12
15
  parseHtmlString,
@@ -41,6 +44,7 @@ export const compileHtml = async ({
41
44
  babelPluginMap,
42
45
 
43
46
  jsenvToolbarInjection,
47
+ sourcemapMethod,
44
48
  }) => {
45
49
  const jsenvBrowserBuildUrlRelativeToProject = urlToRelativeUrl(
46
50
  jsenvBrowserSystemFileInfo.jsenvBuildUrl,
@@ -203,12 +207,22 @@ export const compileHtml = async ({
203
207
  sourcemapFileUrl,
204
208
  compiledUrl,
205
209
  )
206
- code = setJavaScriptSourceMappingUrl(
207
- code,
208
- sourcemapFileRelativePathForModule,
209
- )
210
- assets = [...assets, scriptAssetUrl, sourcemapFileUrl]
211
- assetsContent = [...assetsContent, code, JSON.stringify(map, null, " ")]
210
+
211
+ if (sourcemapMethod === "inline") {
212
+ code = setJavaScriptSourceMappingUrl(code, sourcemapToBase64Url(map))
213
+ } else {
214
+ // TODO: respect "sourcemapMethod" parameter
215
+ code = setJavaScriptSourceMappingUrl(
216
+ code,
217
+ sourcemapFileRelativePathForModule,
218
+ )
219
+ assets = [...assets, scriptAssetUrl, sourcemapFileUrl]
220
+ assetsContent = [
221
+ ...assetsContent,
222
+ code,
223
+ JSON.stringify(map, null, " "),
224
+ ]
225
+ }
212
226
  }),
213
227
  )
214
228
 
@@ -14,6 +14,7 @@ export const compileJavascript = async ({
14
14
  importMetaFormat,
15
15
 
16
16
  sourcemapExcludeSources,
17
+ sourcemapMethod,
17
18
  }) => {
18
19
  const transformResult = await transformJs({
19
20
  code,
@@ -42,6 +43,7 @@ export const compileJavascript = async ({
42
43
  compiledFileUrl: compiledUrl,
43
44
  sourcemapFileUrl: `${compiledUrl}.map`,
44
45
  sourcemapExcludeSources,
46
+ sourcemapMethod,
45
47
  },
46
48
  )
47
49
  }