@jsenv/core 27.0.0-alpha.63 → 27.0.0-alpha.64

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 (39) hide show
  1. package/dist/html_supervisor_installer.js +1 -1
  2. package/dist/html_supervisor_installer.js.map +2 -2
  3. package/dist/s.js +626 -0
  4. package/dist/s.js.map +207 -0
  5. package/main.js +1 -0
  6. package/package.json +6 -6
  7. package/src/build/build.js +23 -8
  8. package/src/build/inject_global_version_mappings.js +18 -5
  9. package/src/build/start_build_server.js +38 -29
  10. package/src/dev/start_dev_server.js +1 -1
  11. package/src/execute/runtimes/browsers/from_playwright.js +10 -0
  12. package/src/execute/runtimes/node/node_process.js +8 -0
  13. package/src/omega/kitchen.js +52 -134
  14. package/src/omega/server/file_service.js +34 -17
  15. package/src/omega/url_graph/url_graph_load.js +10 -17
  16. package/src/omega/url_graph/url_info_transformations.js +1 -4
  17. package/src/omega/url_graph.js +6 -2
  18. package/src/omega/url_specifier_encoding.js +59 -0
  19. package/src/plugins/html_supervisor/client/html_supervisor_installer.js +1 -1
  20. package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -4
  21. package/src/plugins/inject_globals/jsenv_plugin_inject_globals.js +51 -42
  22. package/src/plugins/inline/jsenv_plugin_data_urls.js +1 -4
  23. package/src/plugins/inline/jsenv_plugin_html_inline_content.js +3 -5
  24. package/src/plugins/inline/jsenv_plugin_inline_query_param.js +1 -4
  25. package/src/plugins/inline/jsenv_plugin_js_inline_content.js +1 -4
  26. package/src/plugins/node_esm_resolution/jsenv_plugin_node_esm_resolution.js +4 -0
  27. package/src/plugins/plugins.js +4 -1
  28. package/src/plugins/transpilation/as_js_classic/client/s.js +362 -807
  29. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic.js +28 -12
  30. package/src/plugins/transpilation/as_js_classic/{jsenv_plugin_workers_type_module_as_classic.js → jsenv_plugin_as_js_classic_workers.js} +2 -2
  31. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_script_type_module_as_classic.js +165 -133
  32. package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +5 -2
  33. package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +1 -2
  34. package/src/plugins/transpilation/jsenv_plugin_transpilation.js +4 -1
  35. package/src/test/execute_plan.js +32 -13
  36. package/src/test/execute_test_plan.js +2 -0
  37. package/src/test/logs_file_execution.js +47 -38
  38. package/src/plugins/transpilation/as_js_classic/client/s.js.md +0 -1
  39. package/src/plugins/transpilation/fetch_original_url_info.js +0 -30
@@ -1,29 +1,14 @@
1
- import { ANSI, UNICODE, msAsDuration, byteAsMemoryUsage } from "@jsenv/log"
1
+ import {
2
+ ANSI,
3
+ UNICODE,
4
+ msAsEllapsedTime,
5
+ msAsDuration,
6
+ byteAsMemoryUsage,
7
+ } from "@jsenv/log"
2
8
 
3
9
  import { EXECUTION_COLORS } from "./execution_colors.js"
4
10
 
5
- export const formatExecuting = (
6
- { executionIndex },
7
- { counters, memoryHeap },
8
- ) => {
9
- const description = ANSI.color(
10
- `executing ${executionIndex + 1} of ${counters.total}`,
11
- EXECUTION_COLORS.executing,
12
- )
13
- const summary =
14
- executionIndex === 0
15
- ? ""
16
- : `(${createIntermediateSummary({
17
- executionIndex,
18
- counters,
19
- memoryHeap,
20
- })})`
21
- return formatExecution({
22
- label: `${description} ${summary}`,
23
- })
24
- }
25
-
26
- export const formatExecutionResult = (
11
+ export const createExecutionLog = (
27
12
  {
28
13
  executionIndex,
29
14
  fileRelativeUrl,
@@ -31,8 +16,10 @@ export const formatExecutionResult = (
31
16
  runtimeVersion,
32
17
  executionParams,
33
18
  executionResult,
19
+ startMs,
20
+ endMs,
34
21
  },
35
- { completedExecutionLogAbbreviation, counters, memoryHeap },
22
+ { completedExecutionLogAbbreviation, counters, timeEllapsed, memoryHeap },
36
23
  ) => {
37
24
  const { status } = executionResult
38
25
  const descriptionFormatter = descriptionFormatters[status]
@@ -41,22 +28,26 @@ export const formatExecutionResult = (
41
28
  total: counters.total,
42
29
  executionParams,
43
30
  })
44
- const summary = `(${createIntermediateSummary({
31
+ const summary = createIntermediateSummary({
45
32
  executionIndex,
46
33
  counters,
34
+ timeEllapsed,
47
35
  memoryHeap,
48
- })})`
36
+ })
49
37
  if (completedExecutionLogAbbreviation && status === "completed") {
50
- return `${description} ${summary}`
38
+ return `${description}${summary}`
51
39
  }
52
- const { consoleCalls = [], error, duration } = executionResult
40
+ const { consoleCalls = [], error } = executionResult
53
41
  const consoleOutput = formatConsoleCalls(consoleCalls)
54
42
  return formatExecution({
55
- label: `${description} ${summary}`,
43
+ label: `${description}${summary}`,
56
44
  details: {
57
45
  file: fileRelativeUrl,
58
46
  runtime: `${runtimeName}/${runtimeVersion}`,
59
- duration: msAsDuration(duration),
47
+ duration:
48
+ status === "executing"
49
+ ? msAsEllapsedTime(Date.now() - startMs)
50
+ : msAsDuration(endMs - startMs),
60
51
  ...(error ? { error: error.stack || error.message || error } : {}),
61
52
  },
62
53
  consoleOutput,
@@ -85,17 +76,29 @@ const createIntermediateSummary = ({
85
76
  executionIndex,
86
77
  counters,
87
78
  memoryHeap,
79
+ timeEllapsed,
88
80
  }) => {
89
- let intermediateSummary = createStatusSummary({
90
- counters: {
91
- ...counters,
92
- total: executionIndex + 1,
93
- },
94
- })
81
+ const parts = []
82
+ if (executionIndex > 0 || counters.done > 0) {
83
+ parts.push(
84
+ createStatusSummary({
85
+ counters: {
86
+ ...counters,
87
+ total: executionIndex + 1,
88
+ },
89
+ }),
90
+ )
91
+ }
92
+ if (timeEllapsed) {
93
+ parts.push(`duration: ${msAsEllapsedTime(timeEllapsed)}`)
94
+ }
95
95
  if (memoryHeap) {
96
- intermediateSummary += ` / memory heap: ${byteAsMemoryUsage(memoryHeap)}`
96
+ parts.push(`memory heap: ${byteAsMemoryUsage(memoryHeap)}`)
97
97
  }
98
- return intermediateSummary
98
+ if (parts.length === 0) {
99
+ return ""
100
+ }
101
+ return ` (${parts.join(` / `)})`
99
102
  }
100
103
 
101
104
  const createStatusSummary = ({ counters }) => {
@@ -159,6 +162,12 @@ const createMixedDetails = ({ counters }) => {
159
162
  }
160
163
 
161
164
  const descriptionFormatters = {
165
+ executing: ({ index, total }) => {
166
+ return ANSI.color(
167
+ `executing ${index + 1} of ${total}`,
168
+ EXECUTION_COLORS.executing,
169
+ )
170
+ },
162
171
  aborted: ({ index, total }) => {
163
172
  return ANSI.color(
164
173
  `${UNICODE.FAILURE_RAW} execution ${index + 1} of ${total} aborted`,
@@ -1 +0,0 @@
1
- s.js exists to ease jsenv ability to find the file.
@@ -1,30 +0,0 @@
1
- export const fetchOriginalUrlInfo = async ({
2
- urlInfo,
3
- context,
4
- searchParam,
5
- expectedType,
6
- }) => {
7
- const urlObject = new URL(urlInfo.url)
8
- const { searchParams } = urlObject
9
- if (!searchParams.has(searchParam)) {
10
- return null
11
- }
12
- searchParams.delete(searchParam)
13
- const originalUrl = urlObject.href
14
- const originalReference = {
15
- ...(context.reference.original || context.reference),
16
- expectedType,
17
- }
18
- originalReference.url = originalUrl
19
- const originalUrlInfo = context.urlGraph.reuseOrCreateUrlInfo(
20
- originalReference.url,
21
- )
22
- await context.fetchUrlContent({
23
- reference: originalReference,
24
- urlInfo: originalUrlInfo,
25
- })
26
- if (originalUrlInfo.dependents.size === 0) {
27
- context.urlGraph.deleteUrlInfo(originalUrlInfo.url)
28
- }
29
- return originalUrlInfo
30
- }