@jsenv/core 25.3.0-alpha.0 → 25.4.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.
- package/dist/browser_runtime/asset-manifest.json +2 -2
- package/dist/browser_runtime/{browser_runtime_91c5a3b8.js → browser_runtime_0e3396a1.js} +15 -16
- package/dist/browser_runtime/{browser_runtime_91c5a3b8.js.map → browser_runtime_0e3396a1.js.map} +13 -13
- package/dist/build_manifest.js +5 -5
- package/dist/compile_proxy/asset-manifest.json +2 -2
- package/dist/compile_proxy/compile_proxy.html__inline__20_f4285042.js.map +343 -0
- package/dist/compile_proxy/{compile_proxy_8dfaee51.html → compile_proxy_ab528227.html} +358 -397
- package/dist/redirector/asset-manifest.json +2 -2
- package/dist/redirector/redirector.html__inline__12_404b8295.js.map +349 -0
- package/dist/redirector/{redirector_3e9a97b9.html → redirector_6df2620a.html} +369 -407
- package/dist/toolbar/asset-manifest.json +2 -2
- package/dist/toolbar/toolbar.main_279b3a68.js.map +764 -0
- package/dist/toolbar/{toolbar_361afb84.html → toolbar_0a91ca3b.html} +1509 -1583
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/{toolbar_injector_fac1e995.js → toolbar_injector_34f6ad8e.js} +18 -15
- package/dist/toolbar_injector/{toolbar_injector_fac1e995.js.map → toolbar_injector_34f6ad8e.js.map} +15 -15
- package/package.json +10 -10
- package/src/buildProject.js +31 -26
- package/src/dev_server.js +111 -92
- package/src/execute.js +3 -8
- package/src/importUsingChildProcess.js +1 -0
- package/src/internal/browser_launcher/{browser_runtime_report.js → browser_runtime_profile.js} +21 -15
- package/src/internal/browser_launcher/executeHtmlFile.js +22 -14
- package/src/internal/browser_launcher/from_playwright.js +6 -4
- package/src/internal/browser_runtime/browser_runtime.js +12 -14
- package/src/internal/browser_runtime/createBrowserRuntime.js +7 -6
- package/src/internal/browser_utils/fetchAndEvalUsingFetch.js +1 -1
- package/src/internal/browser_utils/fetchJson.js +1 -1
- package/src/internal/browser_utils/{fetch-browser.js → fetch_browser.js} +0 -2
- package/src/internal/building/buildUsingRollup.js +41 -57
- package/src/internal/building/rollup_plugin_jsenv.js +28 -8
- package/src/internal/compiling/babel_parse_error.js +9 -0
- package/src/internal/{babel_plugin_transform_import_meta.js → compiling/babel_plugin_transform_import_meta.js} +53 -36
- package/src/internal/compiling/compileFile.js +2 -2
- package/src/internal/compiling/compileHtml.js +1 -1
- package/src/internal/compiling/createCompiledFileService.js +25 -74
- package/src/internal/compiling/js-compilation-service/transformJs.js +151 -23
- package/src/internal/compiling/jsenvCompilerForHtml.js +29 -32
- package/src/internal/compiling/jsenvCompilerForImportmap.js +2 -2
- package/src/internal/compiling/jsenvCompilerForJavaScript.js +2 -4
- package/src/internal/compiling/jsenv_directory/comparison_utils.js +24 -0
- package/src/internal/compiling/{compile-directory/compile-asset.js → jsenv_directory/compile_asset.js} +0 -0
- package/src/internal/compiling/jsenv_directory/compile_context.js +68 -0
- package/src/internal/compiling/jsenv_directory/compile_profile.js +218 -0
- package/src/internal/compiling/{compile-directory/createLockRegistry.js → jsenv_directory/file_lock_registry.js} +0 -0
- package/src/internal/compiling/{compile-directory/createLockRegistry.test.js → jsenv_directory/file_lock_registry.test.js} +2 -1
- package/src/internal/compiling/{compile-directory → jsenv_directory}/fs-optimized-for-cache.js +0 -0
- package/src/internal/compiling/{compile-directory → jsenv_directory}/getOrGenerateCompiledFile.js +2 -2
- package/src/internal/compiling/jsenv_directory/jsenv_directory.js +174 -0
- package/src/internal/compiling/{compile-directory → jsenv_directory}/updateMeta.js +1 -1
- package/src/internal/compiling/{compile-directory → jsenv_directory}/validateCache.js +0 -0
- package/src/internal/compiling/sse_service/sse_service.js +369 -0
- package/src/internal/compiling/startCompileServer.js +157 -804
- package/src/internal/compiling/transformResultToCompilationResult.js +2 -2
- package/src/internal/dev_server/exploring/exploring.js +10 -8
- package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +92 -78
- package/src/internal/dev_server/toolbar/settings/toolbar.settings.js +13 -0
- package/src/internal/dev_server/toolbar/toolbar.html +46 -16
- package/src/internal/dev_server/toolbar/toolbar.injector.js +17 -15
- package/src/internal/dev_server/toolbar/toolbar.main.js +12 -16
- package/src/internal/executing/executeConcurrently.js +1 -1
- package/src/internal/executing/executePlan.js +2 -3
- package/src/internal/{generateGroupMap → features}/babel_plugins_compatibility.js +8 -8
- package/src/internal/features/browser_feature_detection/browser_feature_detect_dynamic_import.js +20 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_css.js +23 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_import_assertions_json.js +25 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_importmap.js +37 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_new_stylesheet.js +9 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detect_top_level_await.js +14 -0
- package/src/internal/features/browser_feature_detection/browser_feature_detection.js +89 -0
- package/src/internal/{browser_feature_detection → features/browser_feature_detection}/compile_proxy.html +1 -1
- package/src/internal/features/browser_feature_detection/execute_with_script_module.js +24 -0
- package/src/internal/features/features_compat_from_runtime.js +38 -0
- package/src/internal/features/features_compat_from_runtime_support.js +31 -0
- package/src/internal/{generateGroupMap → features}/features_compatibility.js +3 -3
- package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_dynamic_import.mjs +0 -0
- package/src/internal/{node_feature_detection → features/node_feature_detection}/feature_detect_top_level_await.mjs +0 -0
- package/src/internal/{node_feature_detection/nodeSupportsDynamicImport.js → features/node_feature_detection/node_feature_detect_dynamic_import.js} +0 -0
- package/src/internal/{node_feature_detection/nodeSupportsTopLevelAwait.js → features/node_feature_detection/node_feature_detect_top_level_await.js} +0 -0
- package/src/internal/features/node_feature_detection/node_feature_detection.js +66 -0
- package/src/internal/node_launcher/createControllableNodeProcess.js +4 -6
- package/src/internal/node_launcher/node_runtime_report.js +15 -9
- package/src/internal/node_runtime/fetchSource.js +2 -4
- package/src/internal/node_runtime/nodeControllableFile.mjs +1 -5
- package/src/internal/node_runtime/node_execution_systemjs.js +2 -5
- package/src/internal/redirector/redirector.html +40 -0
- package/src/internal/{generateGroupMap/jsenvRuntimeSupport.js → runtime_support/jsenv_runtime_support.js} +0 -0
- package/src/internal/{generateGroupMap → runtime_support}/runtime_support.js +0 -0
- package/src/internal/url_conversion.js +12 -17
- package/src/launchNode.js +29 -41
- package/dist/compile_proxy/compile_proxy.html__inline__20_809f35f7.js.map +0 -392
- package/dist/redirector/redirector.html__inline__15_e391410e.js.map +0 -397
- package/dist/toolbar/toolbar.main_6c1b3d82.js.map +0 -802
- package/src/internal/CONSTANTS.js +0 -11
- package/src/internal/browser_feature_detection/browser_feature_detection.js +0 -274
- package/src/internal/compiling/js-compilation-service/jsenvTransform.js +0 -242
- package/src/internal/dev_server/redirector/redirector.html +0 -48
- package/src/internal/generateGroupMap/generateGroupMap.js +0 -65
- package/src/internal/generateGroupMap/one_runtime_compat.js +0 -38
- package/src/internal/generateGroupMap/runtime_compat.js +0 -34
- package/src/internal/generateGroupMap/runtime_compat_composition.js +0 -76
- package/src/internal/generateGroupMap/shake_babel_plugin_map.js +0 -21
- package/src/internal/node_feature_detection/node_feature_detection.js +0 -117
- package/src/internal/node_runtime/detectNode.js +0 -3
- package/src/internal/runtime/computeCompileIdFromGroupId.js +0 -30
- package/src/internal/runtime/resolveGroup.js +0 -13
- package/src/internal/runtime/resolveRuntimeGroup.js +0 -11
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
setCssSourceMappingUrl,
|
|
17
17
|
sourcemapToBase64Url,
|
|
18
18
|
} from "../sourceMappingURLUtils.js"
|
|
19
|
-
import { generateCompilationAssetUrl } from "./
|
|
20
|
-
import { testFilePresence } from "./
|
|
19
|
+
import { generateCompilationAssetUrl } from "./jsenv_directory/compile_asset.js"
|
|
20
|
+
import { testFilePresence } from "./jsenv_directory/fs-optimized-for-cache.js"
|
|
21
21
|
|
|
22
22
|
const isWindows = process.platform === "win32"
|
|
23
23
|
|
|
@@ -12,7 +12,7 @@ const fetchJSON = async (url, options) => {
|
|
|
12
12
|
const groupPreference = createPreference("group")
|
|
13
13
|
|
|
14
14
|
const run = async () => {
|
|
15
|
-
const { projectDirectoryUrl, explorableConfig,
|
|
15
|
+
const { projectDirectoryUrl, explorableConfig, jsenvDirectoryRelativeUrl } =
|
|
16
16
|
await fetchExploringJson()
|
|
17
17
|
|
|
18
18
|
const files = await fetchJSON(`/.jsenv/explorables.json`, {
|
|
@@ -20,16 +20,18 @@ const run = async () => {
|
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
const compileServerOrigin = document.location.origin
|
|
23
|
-
const
|
|
24
|
-
new URL(
|
|
23
|
+
const jsenvDirectoryServerUrl = String(
|
|
24
|
+
new URL(jsenvDirectoryRelativeUrl, compileServerOrigin),
|
|
25
25
|
)
|
|
26
26
|
const documentUrl = document.location.href
|
|
27
27
|
let compileId
|
|
28
28
|
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
|
|
29
|
+
const jsenvDirectoryIndex = documentUrl.indexOf(jsenvDirectoryServerUrl)
|
|
30
|
+
if (jsenvDirectoryIndex === 0) {
|
|
31
|
+
const afterJsenvDirectory = documentUrl.slice(
|
|
32
|
+
jsenvDirectoryServerUrl.length,
|
|
33
|
+
)
|
|
34
|
+
compileId = afterJsenvDirectory.split("/")[0]
|
|
33
35
|
} else {
|
|
34
36
|
compileId = null
|
|
35
37
|
}
|
|
@@ -134,7 +136,7 @@ const run = async () => {
|
|
|
134
136
|
|
|
135
137
|
const urlToVisitFromRelativeUrl = (relativeUrl) => {
|
|
136
138
|
if (compileId) {
|
|
137
|
-
return `${compileServerOrigin}/${
|
|
139
|
+
return `${compileServerOrigin}/${jsenvDirectoryRelativeUrl}${compileId}/${relativeUrl}`
|
|
138
140
|
}
|
|
139
141
|
return `${compileServerOrigin}/${relativeUrl}`
|
|
140
142
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { scanBrowserRuntimeFeatures } from "../../../browser_feature_detection/browser_feature_detection.js"
|
|
1
|
+
import { scanBrowserRuntimeFeatures } from "../../../features/browser_feature_detection/browser_feature_detection.js"
|
|
2
2
|
import { removeForceHideElement } from "../util/dom.js"
|
|
3
3
|
import { enableVariant } from "../variant/variant.js"
|
|
4
|
+
import {
|
|
5
|
+
enableWarningStyle,
|
|
6
|
+
disableWarningStyle,
|
|
7
|
+
} from "../settings/toolbar.settings.js"
|
|
4
8
|
|
|
5
9
|
export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
6
10
|
const browserSupportRootNode = document.querySelector("#browser_support")
|
|
@@ -11,19 +15,17 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
11
15
|
|
|
12
16
|
scanBrowserRuntimeFeatures().then(
|
|
13
17
|
({
|
|
14
|
-
|
|
15
|
-
featuresReport,
|
|
16
|
-
customCompilerPatterns,
|
|
17
|
-
missingFeatureNames,
|
|
18
|
+
jsenvDirectoryRelativeUrl,
|
|
18
19
|
inlineImportMapIntoHTML,
|
|
19
|
-
|
|
20
|
+
compileProfile,
|
|
20
21
|
compileId,
|
|
22
|
+
runtimeReport,
|
|
21
23
|
}) => {
|
|
22
|
-
const browserSupport =
|
|
23
|
-
?
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
: "
|
|
24
|
+
const browserSupport = compileId
|
|
25
|
+
? "no"
|
|
26
|
+
: inlineImportMapIntoHTML
|
|
27
|
+
? "partial"
|
|
28
|
+
: "full"
|
|
27
29
|
enableVariant(browserSupportRootNode, {
|
|
28
30
|
browserSupport,
|
|
29
31
|
})
|
|
@@ -33,13 +35,9 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
33
35
|
).onclick = () => {
|
|
34
36
|
// eslint-disable-next-line no-alert
|
|
35
37
|
window.alert(
|
|
36
|
-
`Source files needs to be compiled to be executable in this browser because: ${
|
|
38
|
+
`Source files needs to be compiled to be executable in this browser because: ${listWhatIsMissing(
|
|
37
39
|
{
|
|
38
|
-
|
|
39
|
-
featuresReport,
|
|
40
|
-
customCompilerPatterns,
|
|
41
|
-
missingFeatureNames,
|
|
42
|
-
inlineImportMapIntoHTML,
|
|
40
|
+
compileProfile,
|
|
43
41
|
},
|
|
44
42
|
)}`,
|
|
45
43
|
)
|
|
@@ -50,11 +48,8 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
50
48
|
).onclick = () => {
|
|
51
49
|
// eslint-disable-next-line no-alert
|
|
52
50
|
window.alert(
|
|
53
|
-
`Source files (except html) can be executed directly in this browser because: ${
|
|
51
|
+
`Source files (except html) can be executed directly in this browser because: ${listWhatIsSupported(
|
|
54
52
|
{
|
|
55
|
-
featuresReport,
|
|
56
|
-
customCompilerPatterns,
|
|
57
|
-
missingFeatureNames,
|
|
58
53
|
inlineImportMapIntoHTML,
|
|
59
54
|
},
|
|
60
55
|
)}`,
|
|
@@ -66,11 +61,8 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
66
61
|
).onclick = () => {
|
|
67
62
|
// eslint-disable-next-line no-alert
|
|
68
63
|
window.alert(
|
|
69
|
-
`Source files can be executed directly in this browser because: ${
|
|
64
|
+
`Source files can be executed directly in this browser because: ${listWhatIsSupported(
|
|
70
65
|
{
|
|
71
|
-
featuresReport,
|
|
72
|
-
customCompilerPatterns,
|
|
73
|
-
missingFeatureNames,
|
|
74
66
|
inlineImportMapIntoHTML,
|
|
75
67
|
},
|
|
76
68
|
)}`,
|
|
@@ -78,28 +70,59 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
78
70
|
}
|
|
79
71
|
}
|
|
80
72
|
|
|
81
|
-
const
|
|
73
|
+
const actualCompileId = compileGroup.compileId
|
|
74
|
+
const expectedCompiledId = compileId
|
|
75
|
+
const shouldSwitchCompileId =
|
|
76
|
+
expectedCompiledId &&
|
|
77
|
+
actualCompileId &&
|
|
78
|
+
actualCompileId !== expectedCompiledId
|
|
79
|
+
const shouldCompile = !actualCompileId && browserSupport === "no"
|
|
80
|
+
const filesCompilation = shouldSwitchCompileId
|
|
81
|
+
? "mismatch"
|
|
82
|
+
: actualCompileId
|
|
82
83
|
? "yes"
|
|
83
84
|
: inlineImportMapIntoHTML
|
|
84
85
|
? "html_only"
|
|
85
86
|
: "no"
|
|
87
|
+
const hasWarning = shouldCompile || shouldSwitchCompileId
|
|
88
|
+
|
|
86
89
|
enableVariant(filesCompilationRootNode, {
|
|
87
90
|
filesCompilation,
|
|
88
|
-
|
|
91
|
+
compilation_link: shouldSwitchCompileId
|
|
92
|
+
? "mismatch"
|
|
93
|
+
: actualCompileId
|
|
94
|
+
? "source"
|
|
95
|
+
: expectedCompiledId
|
|
96
|
+
? "compiled"
|
|
97
|
+
: "force",
|
|
89
98
|
})
|
|
90
|
-
|
|
91
|
-
(
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
99
|
+
if (filesCompilation === "yes") {
|
|
100
|
+
document.querySelector(
|
|
101
|
+
".files_compilation_text",
|
|
102
|
+
).innerHTML = `Files shown are compiled for ${runtimeReport.name}@${runtimeReport.version}`
|
|
103
|
+
}
|
|
104
|
+
filesCompilationRootNode.querySelector("a.link_to_source_files").onclick =
|
|
95
105
|
() => {
|
|
96
|
-
window.parent.location = `/${
|
|
106
|
+
window.parent.location.href = `/${compileGroup.fileRelativeUrl}`
|
|
97
107
|
}
|
|
108
|
+
filesCompilationRootNode.querySelector(
|
|
109
|
+
"a.link_to_compiled_files",
|
|
110
|
+
).onclick = () => {
|
|
111
|
+
window.parent.location.href = `/${jsenvDirectoryRelativeUrl}${expectedCompiledId}/${compileGroup.fileRelativeUrl}`
|
|
112
|
+
}
|
|
113
|
+
filesCompilationRootNode.querySelector(
|
|
114
|
+
"a.link_to_compilation_forced_files",
|
|
115
|
+
).onclick = () => {
|
|
116
|
+
window.parent.location.href = `/${jsenvDirectoryRelativeUrl}force/${compileGroup.fileRelativeUrl}`
|
|
117
|
+
}
|
|
118
|
+
filesCompilationRootNode.querySelector(
|
|
119
|
+
"a.link_to_appropriate_files",
|
|
120
|
+
).onclick = () => {
|
|
121
|
+
window.parent.location.href = `/${jsenvDirectoryRelativeUrl}${expectedCompiledId}/${compileGroup.fileRelativeUrl}`
|
|
122
|
+
}
|
|
98
123
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (shouldCompile) {
|
|
124
|
+
if (hasWarning) {
|
|
125
|
+
enableWarningStyle()
|
|
103
126
|
document
|
|
104
127
|
.querySelector(".files_compilation_text")
|
|
105
128
|
.setAttribute("data-warning", "")
|
|
@@ -110,6 +133,7 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
110
133
|
.querySelector("#settings-button")
|
|
111
134
|
.setAttribute("data-warning", "")
|
|
112
135
|
} else {
|
|
136
|
+
disableWarningStyle()
|
|
113
137
|
document
|
|
114
138
|
.querySelector(".files_compilation_text")
|
|
115
139
|
.removeAttribute("data-warning")
|
|
@@ -124,63 +148,53 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
124
148
|
)
|
|
125
149
|
}
|
|
126
150
|
|
|
127
|
-
const
|
|
128
|
-
missingOnly,
|
|
129
|
-
featuresReport,
|
|
130
|
-
customCompilerPatterns,
|
|
131
|
-
missingFeatureNames,
|
|
132
|
-
inlineImportMapIntoHTML,
|
|
133
|
-
}) => {
|
|
151
|
+
const listWhatIsSupported = ({ inlineImportMapIntoHTML }) => {
|
|
134
152
|
const parts = []
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (!missingOnly) {
|
|
138
|
-
if (inlineImportMapIntoHTML) {
|
|
139
|
-
parts.push(`importmaps are supported (only when inlined in html files)`)
|
|
140
|
-
} else {
|
|
141
|
-
parts.push(`importmaps are supported`)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
153
|
+
if (inlineImportMapIntoHTML) {
|
|
154
|
+
parts.push(`importmaps are supported (only when inlined in html files)`)
|
|
144
155
|
} else {
|
|
145
|
-
parts.push(`importmaps are
|
|
156
|
+
parts.push(`importmaps are supported`)
|
|
146
157
|
}
|
|
158
|
+
parts.push(`dynamic imports are supported`)
|
|
159
|
+
parts.push(`top level await is supported`)
|
|
160
|
+
parts.push(`all features are natively supported`)
|
|
161
|
+
return `
|
|
162
|
+
- ${parts.join(`
|
|
163
|
+
- `)}`
|
|
164
|
+
}
|
|
147
165
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
166
|
+
const listWhatIsMissing = ({ compileProfile }) => {
|
|
167
|
+
const parts = []
|
|
168
|
+
const { missingFeatures } = compileProfile
|
|
169
|
+
if (missingFeatures.importmap) {
|
|
170
|
+
parts.push(`importmaps are not supported`)
|
|
171
|
+
}
|
|
172
|
+
if (missingFeatures.dynamicImport) {
|
|
153
173
|
parts.push(`dynamic imports are not supported`)
|
|
154
174
|
}
|
|
155
|
-
|
|
156
|
-
if (featuresReport.topLevelAwait) {
|
|
157
|
-
if (!missingOnly) {
|
|
158
|
-
parts.push(`top level await is supported`)
|
|
159
|
-
}
|
|
160
|
-
} else {
|
|
175
|
+
if (missingFeatures.topLevelAwait) {
|
|
161
176
|
parts.push(`top level await is not supported`)
|
|
162
177
|
}
|
|
163
|
-
|
|
178
|
+
const missingFeatureNames = Object.keys(missingFeatures).filter((name) => {
|
|
179
|
+
return (
|
|
180
|
+
name !== "importmap" &&
|
|
181
|
+
name !== "dynamicImport" &&
|
|
182
|
+
name !== "topLevelAwait" &&
|
|
183
|
+
name !== "custom_compiler_patterns"
|
|
184
|
+
)
|
|
185
|
+
})
|
|
164
186
|
const missingFeatureCount = missingFeatureNames.length
|
|
165
|
-
if (missingFeatureCount
|
|
166
|
-
if (!missingOnly) {
|
|
167
|
-
parts.push(`all features are natively supported`)
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
187
|
+
if (missingFeatureCount > 0) {
|
|
170
188
|
parts.push(
|
|
171
189
|
`${missingFeatureCount} features are missing: ${missingFeatureNames}`,
|
|
172
190
|
)
|
|
173
191
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (customCompilerCount === 0) {
|
|
177
|
-
// no need to talk about something unused
|
|
178
|
-
} else {
|
|
192
|
+
const { custom_compiler_patterns } = missingFeatures
|
|
193
|
+
if (custom_compiler_patterns) {
|
|
179
194
|
parts.push(
|
|
180
|
-
`${
|
|
195
|
+
`${custom_compiler_patterns.length} custom compilers enabled: ${custom_compiler_patterns}`,
|
|
181
196
|
)
|
|
182
197
|
}
|
|
183
|
-
|
|
184
198
|
return `
|
|
185
199
|
- ${parts.join(`
|
|
186
200
|
- `)}`
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
activateToolbarSection,
|
|
5
5
|
updateIframeOverflowOnParentWindow,
|
|
6
6
|
} from "../util/dom.js"
|
|
7
|
+
import { enableVariant } from "../variant/variant.js"
|
|
7
8
|
|
|
8
9
|
export const renderToolbarSettings = () => {
|
|
9
10
|
document.querySelector("#settings-button").onclick = toggleSettings
|
|
@@ -18,6 +19,18 @@ const toggleSettings = () => {
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
export const enableWarningStyle = () => {
|
|
23
|
+
enableVariant(document.querySelector("#settings-button"), {
|
|
24
|
+
has_warning: "yes",
|
|
25
|
+
})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const disableWarningStyle = () => {
|
|
29
|
+
enableVariant(document.querySelector("#settings-button"), {
|
|
30
|
+
has_warning: "no",
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
21
34
|
export const settingsAreVisible = () => {
|
|
22
35
|
return toolbarSectionIsActive(document.querySelector(`#settings`))
|
|
23
36
|
}
|
|
@@ -436,38 +436,68 @@
|
|
|
436
436
|
>Files shown are source files, except html</span
|
|
437
437
|
>
|
|
438
438
|
<span data-when="filesCompilation:yes"
|
|
439
|
-
>Files shown are compiled</span
|
|
439
|
+
>Files shown are compiled for {runtime}</span
|
|
440
|
+
>
|
|
441
|
+
<span data-when="filesCompilation:mismatch"
|
|
442
|
+
>Files shown are compiled for an other runtime</span
|
|
440
443
|
>
|
|
441
444
|
</div>
|
|
442
445
|
<a
|
|
443
|
-
data-when="
|
|
444
|
-
class="
|
|
446
|
+
data-when="compilation_link:source"
|
|
447
|
+
class="link_to_source_files"
|
|
445
448
|
href="javascript:void(0);"
|
|
446
449
|
>Switch to source files</a
|
|
447
450
|
>
|
|
448
451
|
<a
|
|
449
|
-
data-when="
|
|
450
|
-
class="
|
|
452
|
+
data-when="compilation_link:mismatch"
|
|
453
|
+
class="link_to_appropriate_files"
|
|
454
|
+
href="javascript:void(0);"
|
|
455
|
+
>Switch to appropriate files</a
|
|
456
|
+
>
|
|
457
|
+
<a
|
|
458
|
+
data-when="compilation_link:compiled"
|
|
459
|
+
class="link_to_compiled_files"
|
|
451
460
|
href="javascript:void(0);"
|
|
452
461
|
>Switch to compiled files</a
|
|
453
462
|
>
|
|
463
|
+
<a
|
|
464
|
+
data-when="compilation_link:force"
|
|
465
|
+
class="link_to_compilation_forced_files"
|
|
466
|
+
href="javascript:void(0);"
|
|
467
|
+
>Force compilation</a
|
|
468
|
+
>
|
|
454
469
|
</div>
|
|
455
470
|
</div>
|
|
456
471
|
</div>
|
|
457
472
|
</div>
|
|
458
473
|
</div>
|
|
459
474
|
<button id="settings-button" class="toolbar-icon-wrapper">
|
|
460
|
-
<
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
475
|
+
<div data-when="has_warning:yes">
|
|
476
|
+
<svg
|
|
477
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
478
|
+
viewBox="0 0 511.999 511.999"
|
|
479
|
+
width="24px"
|
|
480
|
+
height="24px"
|
|
481
|
+
class="iconToolbar"
|
|
482
|
+
>
|
|
483
|
+
<path
|
|
484
|
+
d="M506.43 421.536 291.573 49.394c-15.814-27.391-55.327-27.401-71.147 0L5.568 421.536c-15.814 27.391 3.934 61.616 35.574 61.616h429.714c31.629.001 51.394-34.214 35.574-61.616zm-231.609-36.502c0 10.394-8.427 18.821-18.821 18.821s-18.821-8.427-18.821-18.821v-11.239c0-10.394 8.427-18.821 18.821-18.821s18.821 8.427 18.821 18.821v11.239zm0-73.332c0 10.394-8.427 18.821-18.821 18.821s-18.821-8.427-18.821-18.821v-107.89c0-10.394 8.427-18.821 18.821-18.821s18.821 8.427 18.821 18.821v107.89z"
|
|
485
|
+
/>
|
|
486
|
+
</svg>
|
|
487
|
+
</div>
|
|
488
|
+
<div data-when="has_warning:no">
|
|
489
|
+
<svg
|
|
490
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
491
|
+
viewBox="0 0 24 24"
|
|
492
|
+
width="24px"
|
|
493
|
+
height="24px"
|
|
494
|
+
class="iconToolbar"
|
|
495
|
+
>
|
|
496
|
+
<path
|
|
497
|
+
d="M19.14,12.94c0.04-0.3,0.06-0.61,0.06-0.94c0-0.32-0.02-0.64-0.07-0.94l2.03-1.58c0.18-0.14,0.23-0.41,0.12-0.61 l-1.92-3.32c-0.12-0.22-0.37-0.29-0.59-0.22l-2.39,0.96c-0.5-0.38-1.03-0.7-1.62-0.94L14.4,2.81c-0.04-0.24-0.24-0.41-0.48-0.41 h-3.84c-0.24,0-0.43,0.17-0.47,0.41L9.25,5.35C8.66,5.59,8.12,5.92,7.63,6.29L5.24,5.33c-0.22-0.08-0.47,0-0.59,0.22L2.74,8.87 C2.62,9.08,2.66,9.34,2.86,9.48l2.03,1.58C4.84,11.36,4.8,11.69,4.8,12s0.02,0.64,0.07,0.94l-2.03,1.58 c-0.18,0.14-0.23,0.41-0.12,0.61l1.92,3.32c0.12,0.22,0.37,0.29,0.59,0.22l2.39-0.96c0.5,0.38,1.03,0.7,1.62,0.94l0.36,2.54 c0.05,0.24,0.24,0.41,0.48,0.41h3.84c0.24,0,0.44-0.17,0.47-0.41l0.36-2.54c0.59-0.24,1.13-0.56,1.62-0.94l2.39,0.96 c0.22,0.08,0.47,0,0.59-0.22l1.92-3.32c0.12-0.22,0.07-0.47-0.12-0.61L19.14,12.94z M12,15.6c-1.98,0-3.6-1.62-3.6-3.6 s1.62-3.6,3.6-3.6s3.6,1.62,3.6,3.6S13.98,15.6,12,15.6z"
|
|
498
|
+
/>
|
|
499
|
+
</svg>
|
|
500
|
+
</div>
|
|
471
501
|
</button>
|
|
472
502
|
</section>
|
|
473
503
|
|
|
@@ -8,18 +8,12 @@ const jsenvLogoSvgUrl = new URL("./jsenv-logo.svg", import.meta.url)
|
|
|
8
8
|
const injectToolbar = async () => {
|
|
9
9
|
await new Promise((resolve) => {
|
|
10
10
|
if (window.requestIdleCallback) {
|
|
11
|
-
window.requestIdleCallback(resolve)
|
|
11
|
+
window.requestIdleCallback(resolve, { timeout: 400 })
|
|
12
12
|
} else {
|
|
13
13
|
window.requestAnimationFrame(resolve)
|
|
14
14
|
}
|
|
15
15
|
})
|
|
16
|
-
|
|
17
|
-
const { jsenvDirectoryRelativeUrl } = await fetchExploringJson()
|
|
18
|
-
const jsenvDirectoryServerUrl = resolveUrl(
|
|
19
|
-
jsenvDirectoryRelativeUrl,
|
|
20
|
-
document.location.origin,
|
|
21
|
-
)
|
|
22
|
-
|
|
16
|
+
const exploringJSON = await fetchExploringJson()
|
|
23
17
|
const placeholder = getToolbarPlaceholder()
|
|
24
18
|
|
|
25
19
|
const iframe = document.createElement("iframe")
|
|
@@ -43,14 +37,22 @@ const injectToolbar = async () => {
|
|
|
43
37
|
"border": "none",
|
|
44
38
|
})
|
|
45
39
|
const iframeLoadedPromise = iframeToLoadedPromise(iframe)
|
|
46
|
-
const
|
|
40
|
+
const jsenvCoreDirectoryServerUrl = new URL(
|
|
41
|
+
exploringJSON.jsenvCoreDirectoryRelativeUrl,
|
|
42
|
+
document.location.origin,
|
|
43
|
+
).href
|
|
44
|
+
const jsenvToolbarHtmlServerUrl = new URL(
|
|
47
45
|
TOOLBAR_BUILD_RELATIVE_URL,
|
|
48
|
-
|
|
46
|
+
jsenvCoreDirectoryServerUrl,
|
|
49
47
|
)
|
|
50
48
|
// set iframe src BEFORE putting it into the DOM (prevent firefox adding an history entry)
|
|
51
49
|
iframe.setAttribute("src", jsenvToolbarHtmlServerUrl)
|
|
52
50
|
placeholder.parentNode.replaceChild(iframe, placeholder)
|
|
53
51
|
|
|
52
|
+
addToolbarEventCallback(iframe, "toolbar_ready", () => {
|
|
53
|
+
sendCommandToToolbar(iframe, "renderToolbar", { exploringJSON })
|
|
54
|
+
})
|
|
55
|
+
|
|
54
56
|
await iframeLoadedPromise
|
|
55
57
|
iframe.removeAttribute("tabindex")
|
|
56
58
|
|
|
@@ -150,9 +152,6 @@ const injectToolbar = async () => {
|
|
|
150
152
|
showToolbarTrigger()
|
|
151
153
|
}
|
|
152
154
|
})
|
|
153
|
-
addToolbarEventCallback(iframe, "toolbar_ready", () => {
|
|
154
|
-
sendCommandToToolbar(iframe, "renderToolbar")
|
|
155
|
-
})
|
|
156
155
|
|
|
157
156
|
return iframe
|
|
158
157
|
}
|
|
@@ -226,10 +225,13 @@ const iframeToLoadedPromise = (iframe) => {
|
|
|
226
225
|
})
|
|
227
226
|
}
|
|
228
227
|
|
|
229
|
-
const resolveUrl = (url, baseUrl) => String(new URL(url, baseUrl))
|
|
230
|
-
|
|
231
228
|
if (document.readyState === "complete") {
|
|
232
229
|
injectToolbar()
|
|
233
230
|
} else {
|
|
234
231
|
window.addEventListener("load", injectToolbar)
|
|
232
|
+
// document.addEventListener("readystatechange", () => {
|
|
233
|
+
// if (document.readyState === "complete") {
|
|
234
|
+
// injectToolbar()
|
|
235
|
+
// }
|
|
236
|
+
// })
|
|
235
237
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { urlIsInsideOf } from "@jsenv/filesystem/src/urlIsInsideOf.js"
|
|
2
2
|
import { urlToRelativeUrl } from "@jsenv/filesystem/src/urlToRelativeUrl.js"
|
|
3
3
|
|
|
4
|
-
import { fetchExploringJson } from "../exploring/fetchExploringJson.js"
|
|
5
4
|
import { startJavaScriptAnimation } from "../toolbar/util/animation.js"
|
|
6
5
|
import "./focus/toolbar.focus.js"
|
|
7
6
|
import {
|
|
@@ -25,15 +24,14 @@ import { makeToolbarResponsive } from "./responsive/toolbar.responsive.js"
|
|
|
25
24
|
|
|
26
25
|
const toolbarVisibilityPreference = createPreference("toolbar")
|
|
27
26
|
|
|
28
|
-
const renderToolbar = async () => {
|
|
27
|
+
const renderToolbar = async ({ exploringJSON }) => {
|
|
29
28
|
const executedFileCompiledUrl = window.parent.location.href
|
|
30
29
|
const compileServerOrigin = window.parent.location.origin
|
|
31
30
|
// this should not block the whole toolbar rendering + interactivity
|
|
32
|
-
const
|
|
33
|
-
const { outDirectoryRelativeUrl, livereloading } = exploringConfig
|
|
31
|
+
const { jsenvDirectoryRelativeUrl, livereloading } = exploringJSON
|
|
34
32
|
const compileGroup = getCompileGroup({
|
|
35
33
|
executedFileCompiledUrl,
|
|
36
|
-
|
|
34
|
+
jsenvDirectoryRelativeUrl,
|
|
37
35
|
compileServerOrigin,
|
|
38
36
|
})
|
|
39
37
|
const executedFileRelativeUrl = compileGroup.fileRelativeUrl
|
|
@@ -165,28 +163,27 @@ const showToolbar = ({ animate = true } = {}) => {
|
|
|
165
163
|
|
|
166
164
|
const getCompileGroup = ({
|
|
167
165
|
executedFileCompiledUrl,
|
|
168
|
-
|
|
166
|
+
jsenvDirectoryRelativeUrl,
|
|
169
167
|
compileServerOrigin,
|
|
170
168
|
}) => {
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
const jsenvDirectoryServerUrl = new URL(
|
|
170
|
+
jsenvDirectoryRelativeUrl,
|
|
171
|
+
compileServerOrigin,
|
|
172
|
+
).href
|
|
173
|
+
if (urlIsInsideOf(executedFileCompiledUrl, jsenvDirectoryServerUrl)) {
|
|
175
174
|
const afterCompileDirectory = urlToRelativeUrl(
|
|
176
175
|
executedFileCompiledUrl,
|
|
177
|
-
|
|
176
|
+
jsenvDirectoryServerUrl,
|
|
178
177
|
)
|
|
179
178
|
const slashIndex = afterCompileDirectory.indexOf("/")
|
|
180
179
|
const fileRelativeUrl = afterCompileDirectory.slice(slashIndex + 1)
|
|
181
180
|
return {
|
|
182
181
|
fileRelativeUrl,
|
|
183
|
-
outDirectoryRelativeUrl,
|
|
184
182
|
compileId: afterCompileDirectory.slice(0, slashIndex),
|
|
185
183
|
}
|
|
186
184
|
}
|
|
187
185
|
return {
|
|
188
186
|
fileRelativeUrl: new URL(executedFileCompiledUrl).pathname.slice(1),
|
|
189
|
-
outDirectoryRelativeUrl,
|
|
190
187
|
compileId: null,
|
|
191
188
|
}
|
|
192
189
|
}
|
|
@@ -228,13 +225,12 @@ const sendEventToParent = (name, data) => {
|
|
|
228
225
|
}
|
|
229
226
|
|
|
230
227
|
window.toolbar = {
|
|
231
|
-
render: renderToolbar,
|
|
232
228
|
show: showToolbar,
|
|
233
229
|
hide: () => hideToolbar(),
|
|
234
230
|
}
|
|
235
231
|
|
|
236
|
-
addExternalCommandCallback("renderToolbar", () => {
|
|
237
|
-
renderToolbar()
|
|
232
|
+
addExternalCommandCallback("renderToolbar", (data) => {
|
|
233
|
+
renderToolbar(data)
|
|
238
234
|
})
|
|
239
235
|
addExternalCommandCallback("showToolbar", () => {
|
|
240
236
|
showToolbar()
|
|
@@ -215,7 +215,7 @@ export const executeConcurrently = async (
|
|
|
215
215
|
projectDirectoryUrl,
|
|
216
216
|
compileServerOrigin: compileServer.origin,
|
|
217
217
|
compileServerId: compileServer.id,
|
|
218
|
-
|
|
218
|
+
jsenvDirectoryRelativeUrl: compileServer.jsenvDirectoryRelativeUrl,
|
|
219
219
|
|
|
220
220
|
collectCoverage: coverage,
|
|
221
221
|
coverageIgnorePredicate,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Abort, raceProcessTeardownEvents } from "@jsenv/abort"
|
|
2
2
|
import { createDetailedMessage } from "@jsenv/logger"
|
|
3
3
|
|
|
4
|
-
import { mergeRuntimeSupport } from "@jsenv/core/src/internal/
|
|
4
|
+
import { mergeRuntimeSupport } from "@jsenv/core/src/internal/runtime_support/runtime_support.js"
|
|
5
5
|
import { startCompileServer } from "../compiling/startCompileServer.js"
|
|
6
6
|
import { babelPluginInstrument } from "./coverage/babel_plugin_instrument.js"
|
|
7
7
|
import { generateExecutionSteps } from "./generateExecutionSteps.js"
|
|
@@ -112,7 +112,6 @@ export const executePlan = async (
|
|
|
112
112
|
projectDirectoryUrl,
|
|
113
113
|
jsenvDirectoryRelativeUrl,
|
|
114
114
|
jsenvDirectoryClean,
|
|
115
|
-
outDirectoryName: "dev",
|
|
116
115
|
|
|
117
116
|
importResolutionMethod,
|
|
118
117
|
importDefaultExtension,
|
|
@@ -146,7 +145,7 @@ export const executePlan = async (
|
|
|
146
145
|
executionSteps = await generateExecutionSteps(
|
|
147
146
|
{
|
|
148
147
|
...plan,
|
|
149
|
-
[compileServer.
|
|
148
|
+
[compileServer.jsenvDirectoryRelativeUrl]: null,
|
|
150
149
|
},
|
|
151
150
|
{
|
|
152
151
|
signal: multipleExecutionsOperation.signal,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// than importing it from an undocumented location.
|
|
9
9
|
// Ideally it would be documented or a separate module
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const babelPluginCompatMap = {
|
|
12
12
|
"proposal-numeric-separator": {
|
|
13
13
|
chrome: "75",
|
|
14
14
|
opera: "62",
|
|
@@ -425,14 +425,14 @@ export const jsenvBabelPluginCompatMap = {
|
|
|
425
425
|
|
|
426
426
|
// copy of transform-async-to-generator
|
|
427
427
|
// so that async is not transpiled when supported
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
babelPluginCompatMap["transform-async-to-promises"] =
|
|
429
|
+
babelPluginCompatMap["transform-async-to-generator"]
|
|
430
430
|
|
|
431
|
-
|
|
432
|
-
|
|
431
|
+
babelPluginCompatMap["regenerator-transform"] =
|
|
432
|
+
babelPluginCompatMap["transform-regenerator"]
|
|
433
433
|
|
|
434
434
|
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis#browser_compatibility
|
|
435
|
-
|
|
435
|
+
babelPluginCompatMap["global-this-as-jsenv-import"] = {
|
|
436
436
|
edge: "79",
|
|
437
437
|
firefox: "65",
|
|
438
438
|
chrome: "71",
|
|
@@ -444,12 +444,12 @@ jsenvBabelPluginCompatMap["global-this-as-jsenv-import"] = {
|
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
// needs support for both json and css
|
|
447
|
-
|
|
447
|
+
babelPluginCompatMap["transform-import-assertions"] = {
|
|
448
448
|
chrome: "93",
|
|
449
449
|
edge: "93",
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
|
|
452
|
+
babelPluginCompatMap["new-stylesheet-as-jsenv-import"] = {
|
|
453
453
|
chrome: "93",
|
|
454
454
|
edge: "93",
|
|
455
455
|
}
|