@jsenv/core 25.4.3 → 25.4.9
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/build_manifest.js +2 -2
- package/dist/toolbar/asset-manifest.json +5 -5
- package/dist/toolbar/assets/{compilation.css_e37c747b.map → compilation.css_7421bd55.map} +3 -3
- package/dist/toolbar/assets/settings.css_942b5a9e.map +12 -0
- package/dist/toolbar/assets/{toolbar.main.css_269d7ce2.map → toolbar.main.css_b7d8bec1.map} +4 -4
- package/dist/toolbar/{toolbar.main_279b3a68.js.map → toolbar.main_2c56a4e0.js.map} +24 -12
- package/dist/toolbar/{toolbar_0a91ca3b.html → toolbar_9a52325b.html} +97 -63
- package/dist/toolbar_injector/asset-manifest.json +2 -2
- package/dist/toolbar_injector/{toolbar_injector_34f6ad8e.js → toolbar_injector_1e193101.js} +2 -2
- package/dist/toolbar_injector/{toolbar_injector_34f6ad8e.js.map → toolbar_injector_1e193101.js.map} +2 -2
- package/package.json +4 -3
- package/src/buildProject.js +9 -6
- package/src/executeTestPlan.js +12 -8
- package/src/internal/compiling/jsenv_directory/comparison_utils.js +4 -1
- package/src/internal/compiling/jsenv_directory/compile_context.js +4 -3
- package/src/internal/compiling/jsenv_directory/jsenv_directory.js +1 -1
- package/src/internal/dev_server/toolbar/compilation/compilation.css +3 -2
- package/src/internal/dev_server/toolbar/compilation/toolbar.compilation.js +19 -19
- package/src/internal/dev_server/toolbar/notification/toolbar.notification.js +66 -37
- package/src/internal/dev_server/toolbar/settings/settings.css +1 -2
- package/src/internal/dev_server/toolbar/toolbar.html +9 -5
- package/src/internal/dev_server/toolbar/toolbar.main.js +5 -3
- package/src/internal/dev_server/toolbar/util/iframe_to_parent_href.js +10 -0
- package/dist/toolbar/assets/settings.css_61548139.map +0 -12
|
@@ -96,8 +96,9 @@
|
|
|
96
96
|
}
|
|
97
97
|
.browser_support_text[data-warning],
|
|
98
98
|
.files_compilation_text[data-warning] {
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
color: #cb5909;
|
|
100
|
+
margin-bottom: 5px;
|
|
101
|
+
display: block;
|
|
101
102
|
}
|
|
102
103
|
button:focus,
|
|
103
104
|
a:focus,
|
|
@@ -283,8 +284,7 @@ Because for some element we set the focus outline on a div which would not match
|
|
|
283
284
|
position: relative;
|
|
284
285
|
}
|
|
285
286
|
#settings-button[data-warning] svg {
|
|
286
|
-
fill:
|
|
287
|
-
stroke: darkorange;
|
|
287
|
+
fill: #cb5909;
|
|
288
288
|
}
|
|
289
289
|
#settings-button[data-warning] svg:hover {
|
|
290
290
|
fill: darkorange !important;
|
|
@@ -790,7 +790,7 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
790
790
|
color: inherit;
|
|
791
791
|
}
|
|
792
792
|
|
|
793
|
-
/*# sourceMappingURL=assets/toolbar.main.
|
|
793
|
+
/*# sourceMappingURL=assets/toolbar.main.css_b7d8bec1.map */</style>
|
|
794
794
|
<script id="jsenv_inject_systemjs">/*
|
|
795
795
|
* SJS 6.11.0
|
|
796
796
|
* Minimal SystemJS Build
|
|
@@ -1821,7 +1821,7 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
1821
1821
|
<div class="category-subtitle">
|
|
1822
1822
|
Send system notification when execution fails or is fixed.
|
|
1823
1823
|
<div class="notification-text">
|
|
1824
|
-
<a data-when="
|
|
1824
|
+
<a data-when="notif_granted:no" class="request_notification_permission" href="javascript:void(0);">Enable notification</a>
|
|
1825
1825
|
</div>
|
|
1826
1826
|
</div>
|
|
1827
1827
|
</div>
|
|
@@ -1929,8 +1929,11 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
1929
1929
|
</div>
|
|
1930
1930
|
<button id="settings-button" class="toolbar-icon-wrapper">
|
|
1931
1931
|
<div data-when="has_warning:yes">
|
|
1932
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0
|
|
1933
|
-
<path d="
|
|
1932
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 45.818 45.818" width="20px" height="20px" class="iconToolbar" style="transform: rotate(180deg)">
|
|
1933
|
+
<path d="M22.909,0C10.258,0,0,10.257,0,22.908c0,12.652,10.258,22.91,22.909,22.91s22.909-10.258,22.909-22.91
|
|
1934
|
+
C45.818,10.257,35.561,0,22.909,0z M26.411,35.417c0,1.921-1.573,3.478-3.492,3.478c-1.92,0-3.492-1.557-3.492-3.478V20.201
|
|
1935
|
+
c0-1.92,1.572-3.477,3.492-3.477c1.919,0,3.492,1.556,3.492,3.477V35.417z M22.909,13.851c-2.119,0-3.837-1.718-3.837-3.836
|
|
1936
|
+
c0-2.12,1.718-3.836,3.837-3.836c2.118,0,3.837,1.716,3.837,3.836C26.746,12.133,25.027,13.851,22.909,13.851z"></path>
|
|
1934
1937
|
</svg>
|
|
1935
1938
|
</div>
|
|
1936
1939
|
<div data-when="has_warning:no">
|
|
@@ -2426,6 +2429,19 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
2426
2429
|
document.documentElement.setAttribute("data-last-interaction", "keyboard");
|
|
2427
2430
|
});
|
|
2428
2431
|
|
|
2432
|
+
var setLinkHrefForParentWindow = function setLinkHrefForParentWindow(a, href) {
|
|
2433
|
+
a.href = href;
|
|
2434
|
+
|
|
2435
|
+
a.onclick = function (e) {
|
|
2436
|
+
if (e.ctrlKey || e.metaKey) {
|
|
2437
|
+
return;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
e.preventDefault();
|
|
2441
|
+
window.parent.location.href = href;
|
|
2442
|
+
};
|
|
2443
|
+
};
|
|
2444
|
+
|
|
2429
2445
|
var createPreference = function createPreference(name) {
|
|
2430
2446
|
return {
|
|
2431
2447
|
has: function has() {
|
|
@@ -2671,56 +2687,88 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
2671
2687
|
var arrayOfOpenedNotifications = [];
|
|
2672
2688
|
|
|
2673
2689
|
var renderToolbarNotification = function renderToolbarNotification() {
|
|
2674
|
-
var notifCheckbox = document.querySelector("#toggle-notifs");
|
|
2675
|
-
|
|
2676
2690
|
if (!notificationAvailable) {
|
|
2677
|
-
|
|
2678
|
-
notifSetting.setAttribute("data-disabled", "true");
|
|
2679
|
-
notifSetting.setAttribute("title", "Notification not available in the browser");
|
|
2680
|
-
notifCheckbox.disabled = true;
|
|
2691
|
+
applyNotificationNotAvailableEffects();
|
|
2681
2692
|
return;
|
|
2682
2693
|
}
|
|
2683
2694
|
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
var _notifSetting = document.querySelector(".settings-notification");
|
|
2695
|
+
updatePermission();
|
|
2696
|
+
};
|
|
2687
2697
|
|
|
2688
|
-
|
|
2698
|
+
var updatePermission = function updatePermission() {
|
|
2699
|
+
var notifPermission = Notification.permission;
|
|
2689
2700
|
|
|
2690
|
-
|
|
2701
|
+
if (notifPermission === "default") {
|
|
2702
|
+
applyNotificationDefaultEffects();
|
|
2703
|
+
return;
|
|
2704
|
+
}
|
|
2691
2705
|
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2706
|
+
if (notifPermission === "denied") {
|
|
2707
|
+
applyNotificationDeniedEffects();
|
|
2708
|
+
return;
|
|
2709
|
+
}
|
|
2695
2710
|
|
|
2696
|
-
|
|
2711
|
+
if (notifPermission === "granted") {
|
|
2712
|
+
applyNotificationGrantedEffects();
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
};
|
|
2697
2716
|
|
|
2698
|
-
|
|
2699
|
-
setNotificationPreference(notifCheckbox.checked);
|
|
2717
|
+
var notifCheckbox = document.querySelector("#toggle-notifs");
|
|
2700
2718
|
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
};
|
|
2719
|
+
var applyNotificationNotAvailableEffects = function applyNotificationNotAvailableEffects() {
|
|
2720
|
+
var notifSetting = document.querySelector(".settings-notification");
|
|
2721
|
+
notifSetting.setAttribute("data-disabled", "true");
|
|
2722
|
+
notifSetting.setAttribute("title", "Notification not available in the browser");
|
|
2723
|
+
notifCheckbox.disabled = true;
|
|
2724
|
+
};
|
|
2708
2725
|
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2726
|
+
var applyNotificationDefaultEffects = function applyNotificationDefaultEffects() {
|
|
2727
|
+
applyNotificationNOTGrantedEffects();
|
|
2728
|
+
var notifSetting = document.querySelector(".settings-notification");
|
|
2729
|
+
notifSetting.removeAttribute("data-disabled");
|
|
2730
|
+
notifSetting.removeAttribute("title");
|
|
2731
|
+
};
|
|
2713
2732
|
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2733
|
+
var applyNotificationDeniedEffects = function applyNotificationDeniedEffects() {
|
|
2734
|
+
applyNotificationNOTGrantedEffects();
|
|
2735
|
+
var notifSetting = document.querySelector(".settings-notification");
|
|
2736
|
+
notifSetting.setAttribute("data-disabled", "true");
|
|
2737
|
+
notifSetting.setAttribute("title", "Notification denied");
|
|
2738
|
+
};
|
|
2739
|
+
|
|
2740
|
+
var applyNotificationGrantedEffects = function applyNotificationGrantedEffects() {
|
|
2741
|
+
enableVariant(document.querySelector(".notification-text"), {
|
|
2742
|
+
notif_granted: "yes"
|
|
2743
|
+
});
|
|
2744
|
+
notifCheckbox.disabled = false;
|
|
2745
|
+
notifCheckbox.checked = getNotificationPreference();
|
|
2746
|
+
|
|
2747
|
+
notifCheckbox.onchange = function () {
|
|
2748
|
+
setNotificationPreference(notifCheckbox.checked);
|
|
2749
|
+
|
|
2750
|
+
if (!notifCheckbox.checked) {
|
|
2751
|
+
// slice because arrayOfOpenedNotifications can be mutated while looping
|
|
2752
|
+
arrayOfOpenedNotifications.slice().forEach(function (notification) {
|
|
2753
|
+
notification.close();
|
|
2754
|
+
});
|
|
2720
2755
|
}
|
|
2721
2756
|
};
|
|
2757
|
+
};
|
|
2722
2758
|
|
|
2723
|
-
|
|
2759
|
+
var applyNotificationNOTGrantedEffects = function applyNotificationNOTGrantedEffects() {
|
|
2760
|
+
enableVariant(document.querySelector(".notification-text"), {
|
|
2761
|
+
notif_granted: "no"
|
|
2762
|
+
});
|
|
2763
|
+
notifCheckbox.disabled = true;
|
|
2764
|
+
notifCheckbox.checked = false;
|
|
2765
|
+
|
|
2766
|
+
document.querySelector("a.request_notification_permission").onclick = function () {
|
|
2767
|
+
requestPermission().then(function () {
|
|
2768
|
+
setNotificationPreference(true);
|
|
2769
|
+
updatePermission();
|
|
2770
|
+
});
|
|
2771
|
+
};
|
|
2724
2772
|
};
|
|
2725
2773
|
|
|
2726
2774
|
var notifyExecutionResult = function notifyExecutionResult(executedFileRelativeUrl, execution, previousExecution) {
|
|
@@ -4426,21 +4474,10 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
4426
4474
|
document.querySelector(".files_compilation_text").innerHTML = "Files shown are compiled for ".concat(runtimeReport.name, "@").concat(runtimeReport.version);
|
|
4427
4475
|
}
|
|
4428
4476
|
|
|
4429
|
-
filesCompilationRootNode.querySelector("a.link_to_source_files").
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
filesCompilationRootNode.querySelector("a.link_to_compiled_files").onclick = function () {
|
|
4434
|
-
window.parent.location.href = "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl);
|
|
4435
|
-
};
|
|
4436
|
-
|
|
4437
|
-
filesCompilationRootNode.querySelector("a.link_to_compilation_forced_files").onclick = function () {
|
|
4438
|
-
window.parent.location.href = "/".concat(jsenvDirectoryRelativeUrl, "force/").concat(compileGroup.fileRelativeUrl);
|
|
4439
|
-
};
|
|
4440
|
-
|
|
4441
|
-
filesCompilationRootNode.querySelector("a.link_to_appropriate_files").onclick = function () {
|
|
4442
|
-
window.parent.location.href = "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl);
|
|
4443
|
-
};
|
|
4477
|
+
setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_source_files"), "/".concat(compileGroup.fileRelativeUrl));
|
|
4478
|
+
setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_compiled_files"), "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl));
|
|
4479
|
+
setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_compilation_forced_files"), "/".concat(jsenvDirectoryRelativeUrl, "force/").concat(compileGroup.fileRelativeUrl));
|
|
4480
|
+
setLinkHrefForParentWindow(filesCompilationRootNode.querySelector("a.link_to_appropriate_files"), "/".concat(jsenvDirectoryRelativeUrl).concat(expectedCompiledId, "/").concat(compileGroup.fileRelativeUrl));
|
|
4444
4481
|
|
|
4445
4482
|
if (hasWarning) {
|
|
4446
4483
|
enableWarningStyle();
|
|
@@ -4739,10 +4776,7 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
4739
4776
|
});
|
|
4740
4777
|
}
|
|
4741
4778
|
|
|
4742
|
-
document.querySelector(".toolbar-icon-wrapper")
|
|
4743
|
-
window.parent.location.href = "/";
|
|
4744
|
-
};
|
|
4745
|
-
|
|
4779
|
+
setLinkHrefForParentWindow(document.querySelector(".toolbar-icon-wrapper"), "/");
|
|
4746
4780
|
renderToolbarNotification();
|
|
4747
4781
|
makeToolbarResponsive();
|
|
4748
4782
|
renderToolbarSettings();
|
|
@@ -4935,7 +4969,7 @@ html[data-toolbar-visible] #toolbar-trigger {
|
|
|
4935
4969
|
};
|
|
4936
4970
|
});
|
|
4937
4971
|
|
|
4938
|
-
//# sourceMappingURL=toolbar.
|
|
4972
|
+
//# sourceMappingURL=toolbar.main_2c56a4e0.js.map</script>
|
|
4939
4973
|
|
|
4940
4974
|
|
|
4941
4975
|
</body></html>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"assets/jsenv-logo.svg": "assets/jsenv-logo_188b9ca6.svg",
|
|
3
|
-
"toolbar_injector.js": "
|
|
4
|
-
"toolbar_injector.js.map": "
|
|
3
|
+
"toolbar_injector.js": "toolbar_injector_1e193101.js",
|
|
4
|
+
"toolbar_injector.js.map": "toolbar_injector_1e193101.js.map"
|
|
5
5
|
}
|
|
@@ -746,7 +746,7 @@
|
|
|
746
746
|
return then ? value.then(then) : value;
|
|
747
747
|
}
|
|
748
748
|
|
|
749
|
-
var TOOLBAR_BUILD_RELATIVE_URL = "dist/toolbar/
|
|
749
|
+
var TOOLBAR_BUILD_RELATIVE_URL = "dist/toolbar/toolbar_9a52325b.html";
|
|
750
750
|
|
|
751
751
|
function _call(body, then, direct) {
|
|
752
752
|
if (direct) {
|
|
@@ -973,4 +973,4 @@
|
|
|
973
973
|
|
|
974
974
|
})();
|
|
975
975
|
|
|
976
|
-
//# sourceMappingURL=
|
|
976
|
+
//# sourceMappingURL=toolbar_injector_1e193101.js.map
|
package/dist/toolbar_injector/{toolbar_injector_34f6ad8e.js.map → toolbar_injector_1e193101.js.map}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"file": "
|
|
3
|
+
"file": "toolbar_injector_1e193101.js",
|
|
4
4
|
"sources": [
|
|
5
5
|
"../../helpers/babel/typeof/typeof.js",
|
|
6
6
|
"../../helpers/babel/defineProperty/defineProperty.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"import { fetchUrl } from \"./fetch_browser.js\"\n\nexport const fetchJson = async (url, options = {}) => {\n const response = await fetchUrl(url, options)\n const object = await response.json()\n return object\n}\n",
|
|
26
26
|
"import { fetchJson } from \"../../browser_utils/fetchJson.js\"\n\nexport const fetchExploringJson = async ({ signal } = {}) => {\n try {\n const exploringInfo = await fetchJson(\"/.jsenv/exploring.json\", {\n signal,\n })\n return exploringInfo\n } catch (e) {\n if (signal && signal.aborted && e.name === \"AbortError\") {\n throw e\n }\n throw new Error(\n `Cannot communicate with exploring server due to a network error\n--- error stack ---\n${e.stack}`,\n )\n }\n}\n",
|
|
27
27
|
"export const updateIframeOverflowOnParentWindow = () => {\n if (!window.parent) {\n // can happen while parent iframe reloads\n return\n }\n\n const aTooltipIsOpened =\n document.querySelector(\"[data-tooltip-visible]\") ||\n document.querySelector(\"[data-tooltip-auto-visible]\")\n const settingsAreOpened = document.querySelector(\"#settings[data-active]\")\n\n if (aTooltipIsOpened || settingsAreOpened) {\n enableIframeOverflowOnParentWindow()\n } else {\n disableIframeOverflowOnParentWindow()\n }\n}\n\nlet iframeOverflowEnabled = false\nconst enableIframeOverflowOnParentWindow = () => {\n if (iframeOverflowEnabled) return\n iframeOverflowEnabled = true\n\n const iframe = getToolbarIframe()\n const transitionDuration = iframe.style.transitionDuration\n setStyles(iframe, { \"height\": \"100%\", \"transition-duration\": \"0ms\" })\n if (transitionDuration) {\n setTimeout(() => {\n setStyles(iframe, { \"transition-duration\": transitionDuration })\n })\n }\n}\n\nconst disableIframeOverflowOnParentWindow = () => {\n if (!iframeOverflowEnabled) return\n iframeOverflowEnabled = false\n\n const iframe = getToolbarIframe()\n const transitionDuration = iframe.style.transitionDuration\n setStyles(iframe, { \"height\": \"40px\", \"transition-duration\": \"0ms\" })\n if (transitionDuration) {\n setTimeout(() => {\n setStyles(iframe, { \"transition-duration\": transitionDuration })\n })\n }\n}\n\nexport const getToolbarIframe = () => {\n const iframes = Array.from(window.parent.document.querySelectorAll(\"iframe\"))\n return iframes.find((iframe) => iframe.contentWindow === window)\n}\n\nexport const forceHideElement = (element) => {\n element.setAttribute(\"data-force-hide\", \"\")\n}\n\nexport const removeForceHideElement = (element) => {\n element.removeAttribute(\"data-force-hide\")\n}\n\nexport const setStyles = (element, styles) => {\n const elementStyle = element.style\n const restoreStyles = Object.keys(styles).map((styleName) => {\n let restore\n if (styleName in elementStyle) {\n const currentStyle = elementStyle[styleName]\n restore = () => {\n elementStyle[styleName] = currentStyle\n }\n } else {\n restore = () => {\n delete elementStyle[styleName]\n }\n }\n\n elementStyle[styleName] = styles[styleName]\n\n return restore\n })\n return () => {\n restoreStyles.forEach((restore) => restore())\n }\n}\n\nexport const setAttributes = (element, attributes) => {\n Object.keys(attributes).forEach((name) => {\n element.setAttribute(name, attributes[name])\n })\n}\n\nexport const getDocumentScroll = () => {\n return {\n x: document.documentElement.scrollLeft,\n y: document.documentElement.scrollTop,\n }\n}\n\nexport const toolbarSectionIsActive = (element) => {\n return element.hasAttribute(\"data-active\")\n}\n\nexport const activateToolbarSection = (element) => {\n element.setAttribute(\"data-active\", \"\")\n}\n\nexport const deactivateToolbarSection = (element) => {\n element.removeAttribute(\"data-active\")\n}\n",
|
|
28
|
-
"import { fetchExploringJson } from \"@jsenv/core/src/internal/dev_server/exploring/fetchExploringJson.js\"\nimport { setAttributes, setStyles } from \"./util/dom.js\"\n\n// eslint-disable-next-line no-undef\nconst TOOLBAR_BUILD_RELATIVE_URL = \"dist/toolbar/
|
|
28
|
+
"import { fetchExploringJson } from \"@jsenv/core/src/internal/dev_server/exploring/fetchExploringJson.js\"\nimport { setAttributes, setStyles } from \"./util/dom.js\"\n\n// eslint-disable-next-line no-undef\nconst TOOLBAR_BUILD_RELATIVE_URL = \"dist/toolbar/toolbar_9a52325b.html\"\nconst jsenvLogoSvgUrl = new URL(\"./jsenv-logo.svg\", import.meta.url)\n\nconst injectToolbar = async () => {\n await new Promise((resolve) => {\n if (window.requestIdleCallback) {\n window.requestIdleCallback(resolve, { timeout: 400 })\n } else {\n window.requestAnimationFrame(resolve)\n }\n })\n const exploringJSON = await fetchExploringJson()\n const placeholder = getToolbarPlaceholder()\n\n const iframe = document.createElement(\"iframe\")\n setAttributes(iframe, {\n tabindex: -1,\n // sandbox: \"allow-forms allow-modals allow-pointer-lock allow-popups allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation\",\n // allow: \"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; microphone; midi; payment; vr\",\n allowtransparency: true,\n })\n setStyles(iframe, {\n \"position\": \"fixed\",\n \"zIndex\": 1000,\n \"bottom\": 0,\n \"left\": 0,\n \"width\": \"100%\",\n \"height\": 0,\n /* ensure toolbar children are not focusable when hidden */\n \"visibility\": \"hidden\",\n \"transition-duration\": \"300ms\",\n \"transition-property\": \"height, visibility\",\n \"border\": \"none\",\n })\n const iframeLoadedPromise = iframeToLoadedPromise(iframe)\n const jsenvCoreDirectoryServerUrl = new URL(\n exploringJSON.jsenvCoreDirectoryRelativeUrl,\n document.location.origin,\n ).href\n const jsenvToolbarHtmlServerUrl = new URL(\n TOOLBAR_BUILD_RELATIVE_URL,\n jsenvCoreDirectoryServerUrl,\n )\n // set iframe src BEFORE putting it into the DOM (prevent firefox adding an history entry)\n iframe.setAttribute(\"src\", jsenvToolbarHtmlServerUrl)\n placeholder.parentNode.replaceChild(iframe, placeholder)\n\n addToolbarEventCallback(iframe, \"toolbar_ready\", () => {\n sendCommandToToolbar(iframe, \"renderToolbar\", { exploringJSON })\n })\n\n await iframeLoadedPromise\n iframe.removeAttribute(\"tabindex\")\n\n const div = document.createElement(\"div\")\n div.innerHTML = `\n<div id=\"jsenv-toolbar-trigger\">\n <svg id=\"jsenv-toolbar-trigger-icon\">\n <use xlink:href=\"${jsenvLogoSvgUrl}#jsenv-logo\"></use>\n </svg>\n <style>\n #jsenv-toolbar-trigger {\n display: block;\n overflow: hidden;\n position: fixed;\n z-index: 1000;\n bottom: -32px;\n right: 20px;\n height: 40px;\n width: 40px;\n padding: 0;\n margin: 0;\n border-radius: 5px 5px 0 0;\n border: 1px solid rgba(0, 0, 0, 0.33);\n border-bottom: none;\n box-shadow: 0px 0px 6px 2px rgba(0, 0, 0, 0.46);\n background: transparent;\n text-align: center;\n transition: 600ms;\n }\n\n #jsenv-toolbar-trigger:hover {\n cursor: pointer;\n }\n\n #jsenv-toolbar-trigger[data-expanded] {\n bottom: 0;\n }\n\n #jsenv-toolbar-trigger-icon {\n width: 35px;\n height: 35px;\n opacity: 0;\n transition: 600ms;\n }\n\n #jsenv-toolbar-trigger[data-expanded] #jsenv-toolbar-trigger-icon {\n opacity: 1;\n }\n </style>\n</div>`\n const toolbarTrigger = div.firstElementChild\n iframe.parentNode.appendChild(toolbarTrigger)\n\n let timer\n toolbarTrigger.onmouseenter = () => {\n toolbarTrigger.setAttribute(\"data-animate\", \"\")\n timer = setTimeout(expandToolbarTrigger, 500)\n }\n toolbarTrigger.onmouseleave = () => {\n clearTimeout(timer)\n collapseToolbarTrigger()\n }\n toolbarTrigger.onfocus = () => {\n toolbarTrigger.removeAttribute(\"data-animate\")\n expandToolbarTrigger()\n }\n toolbarTrigger.onblur = () => {\n toolbarTrigger.removeAttribute(\"data-animate\")\n clearTimeout(timer)\n collapseToolbarTrigger()\n }\n toolbarTrigger.onclick = () => {\n sendCommandToToolbar(iframe, \"showToolbar\")\n }\n\n const showToolbarTrigger = () => {\n toolbarTrigger.style.display = \"block\"\n }\n\n const hideToolbarTrigger = () => {\n toolbarTrigger.style.display = \"none\"\n }\n\n const expandToolbarTrigger = () => {\n toolbarTrigger.setAttribute(\"data-expanded\", \"\")\n }\n\n const collapseToolbarTrigger = () => {\n toolbarTrigger.removeAttribute(\"data-expanded\", \"\")\n }\n\n hideToolbarTrigger()\n addToolbarEventCallback(iframe, \"toolbar-visibility-change\", (visible) => {\n if (visible) {\n hideToolbarTrigger()\n } else {\n showToolbarTrigger()\n }\n })\n\n return iframe\n}\n\nconst addToolbarEventCallback = (iframe, eventName, callback) => {\n const messageEventCallback = (messageEvent) => {\n const { data } = messageEvent\n if (typeof data !== \"object\") {\n return\n }\n const { __jsenv__ } = data\n if (!__jsenv__) {\n return\n }\n if (__jsenv__.event !== eventName) {\n return\n }\n callback(__jsenv__.data)\n }\n\n window.addEventListener(\"message\", messageEventCallback, false)\n return () => {\n window.removeEventListener(\"message\", messageEventCallback, false)\n }\n}\n\nconst sendCommandToToolbar = (iframe, command, ...args) => {\n iframe.contentWindow.postMessage(\n {\n __jsenv__: {\n command,\n args,\n },\n },\n window.origin,\n )\n}\n\nconst getToolbarPlaceholder = () => {\n const placeholder = queryPlaceholder()\n if (placeholder) {\n if (document.body.contains(placeholder)) {\n return placeholder\n }\n // otherwise iframe would not be visible because in <head>\n console.warn(\n \"element with [data-jsenv-toolbar-placeholder] must be inside document.body\",\n )\n return createTooolbarPlaceholder()\n }\n return createTooolbarPlaceholder()\n}\n\nconst queryPlaceholder = () => {\n return document.querySelector(\"[data-jsenv-toolbar-placeholder]\")\n}\n\nconst createTooolbarPlaceholder = () => {\n const placeholder = document.createElement(\"span\")\n document.body.appendChild(placeholder)\n return placeholder\n}\n\nconst iframeToLoadedPromise = (iframe) => {\n return new Promise((resolve) => {\n const onload = () => {\n iframe.removeEventListener(\"load\", onload, true)\n resolve()\n }\n iframe.addEventListener(\"load\", onload, true)\n })\n}\n\nif (document.readyState === \"complete\") {\n injectToolbar()\n} else {\n window.addEventListener(\"load\", injectToolbar)\n // document.addEventListener(\"readystatechange\", () => {\n // if (document.readyState === \"complete\") {\n // injectToolbar()\n // }\n // })\n}\n"
|
|
29
29
|
],
|
|
30
30
|
"names": [
|
|
31
31
|
"nativeTypeOf",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "25.4.
|
|
3
|
+
"version": "25.4.9",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"node": ">=16.13.0"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org"
|
|
15
16
|
},
|
|
16
17
|
"type": "module",
|
|
17
18
|
"exports": {
|
|
@@ -141,4 +142,4 @@
|
|
|
141
142
|
"redux": "4.1.2",
|
|
142
143
|
"rollup-plugin-import-assert": "1.1.1"
|
|
143
144
|
}
|
|
144
|
-
}
|
|
145
|
+
}
|
package/src/buildProject.js
CHANGED
|
@@ -19,13 +19,16 @@ import {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Generate optimized version of source files into a directory
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {string|url}
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
22
|
+
* @param {Object} buildProjectParameters
|
|
23
|
+
* @param {string|url} buildProjectParameters.projectDirectoryUrl Root directory of the project
|
|
24
|
+
* @param {string|url} buildProjectParameters.buildDirectoryRelativeUrl Directory where optimized files are written
|
|
25
|
+
* @param {object} buildProjectParameters.entryPoints Describe entry point paths and control their names in the build directory
|
|
26
|
+
* @param {"esmodule" | "systemjs" | "commonjs" | "global"} buildProjectParameters.format Code generated will use this module format
|
|
27
|
+
* @param {object} buildProjectParameters.runtimeSupport Code generated will be compatible with these runtimes
|
|
28
|
+
* @param {boolean} [buildProjectParameters.minify=false] Minify file content in the build directory (HTML, CSS, JS, JSON, SVG)
|
|
29
|
+
* @return {Object} An object containing the result of building files
|
|
28
30
|
*/
|
|
31
|
+
|
|
29
32
|
export const buildProject = async ({
|
|
30
33
|
signal = new AbortController().signal,
|
|
31
34
|
handleSIGINT = true,
|
package/src/executeTestPlan.js
CHANGED
|
@@ -21,14 +21,18 @@ import { jsenvCoverageConfig } from "./jsenvCoverageConfig.js"
|
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Execute a list of files and log how it goes
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {string|url} projectDirectoryUrl Root directory of the project
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
24
|
+
* @param {Object} testPlanParameters
|
|
25
|
+
* @param {string|url} testPlanParameters.projectDirectoryUrl Root directory of the project
|
|
26
|
+
* @param {Object} testPlanParameters.testPlan Object associating patterns leading to files to runtimes where they should be executed
|
|
27
|
+
* @param {boolean} [testPlanParameters.completedExecutionLogAbbreviation=false] Abbreviate completed execution information to shorten terminal output
|
|
28
|
+
* @param {boolean} [testPlanParameters.completedExecutionLogMerging=false] Merge completed execution logs to shorten terminal output
|
|
29
|
+
* @param {number} [testPlanParameters.maxExecutionsInParallel=1] Maximum amount of execution in parallel
|
|
30
|
+
* @param {number} [testPlanParameters.defaultMsAllocatedPerExecution=30000] Milliseconds after which execution is aborted and considered as failed by timeout
|
|
31
|
+
* @param {number} [testPlanParameters.cooldownBetweenExecutions=0] Millisecond to wait between each execution
|
|
32
|
+
* @param {boolean} [testPlanParameters.logMemoryHeapUsage=false] Add memory heap usage during logs
|
|
33
|
+
* @param {boolean} [testPlanParameters.coverage=false] Controls if coverage is collected during files executions
|
|
34
|
+
* @param {boolean} [testPlanParameters.coverageV8ConflictWarning=true] Warn when coverage from 2 executions cannot be merged
|
|
35
|
+
* @return {Object} An object containing the result of all file executions
|
|
32
36
|
*/
|
|
33
37
|
export const executeTestPlan = async ({
|
|
34
38
|
signal = new AbortController().signal,
|
|
@@ -20,5 +20,8 @@ export const sameValueInTwoObjects = (object, secondObject) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const sameValuesInTwoArrays = (array, secondArray) => {
|
|
23
|
-
return
|
|
23
|
+
return (
|
|
24
|
+
array.length === secondArray.length &&
|
|
25
|
+
array.every((value) => secondArray.includes(value))
|
|
26
|
+
)
|
|
24
27
|
}
|
|
@@ -61,8 +61,9 @@ const readJsenvCoreVersionFromPackageFile = async () => {
|
|
|
61
61
|
"./package.json",
|
|
62
62
|
jsenvCoreDirectoryUrl,
|
|
63
63
|
)
|
|
64
|
-
const
|
|
64
|
+
const jsenvCorePackage = await readFile(jsenvCorePackageFileUrl, {
|
|
65
65
|
as: "json",
|
|
66
|
-
})
|
|
67
|
-
|
|
66
|
+
})
|
|
67
|
+
const version = jsenvCorePackage.version
|
|
68
|
+
return version
|
|
68
69
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { scanBrowserRuntimeFeatures } from "../../../features/browser_feature_detection/browser_feature_detection.js"
|
|
2
|
+
import { setLinkHrefForParentWindow } from "../util/iframe_to_parent_href.js"
|
|
2
3
|
import { removeForceHideElement } from "../util/dom.js"
|
|
3
4
|
import { enableVariant } from "../variant/variant.js"
|
|
4
5
|
import {
|
|
@@ -101,25 +102,24 @@ export const renderCompilationInToolbar = ({ compileGroup }) => {
|
|
|
101
102
|
".files_compilation_text",
|
|
102
103
|
).innerHTML = `Files shown are compiled for ${runtimeReport.name}@${runtimeReport.version}`
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
-
()
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"a.link_to_compiled_files",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"a.link_to_appropriate_files",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
105
|
+
setLinkHrefForParentWindow(
|
|
106
|
+
filesCompilationRootNode.querySelector("a.link_to_source_files"),
|
|
107
|
+
`/${compileGroup.fileRelativeUrl}`,
|
|
108
|
+
)
|
|
109
|
+
setLinkHrefForParentWindow(
|
|
110
|
+
filesCompilationRootNode.querySelector("a.link_to_compiled_files"),
|
|
111
|
+
`/${jsenvDirectoryRelativeUrl}${expectedCompiledId}/${compileGroup.fileRelativeUrl}`,
|
|
112
|
+
)
|
|
113
|
+
setLinkHrefForParentWindow(
|
|
114
|
+
filesCompilationRootNode.querySelector(
|
|
115
|
+
"a.link_to_compilation_forced_files",
|
|
116
|
+
),
|
|
117
|
+
`/${jsenvDirectoryRelativeUrl}force/${compileGroup.fileRelativeUrl}`,
|
|
118
|
+
)
|
|
119
|
+
setLinkHrefForParentWindow(
|
|
120
|
+
filesCompilationRootNode.querySelector("a.link_to_appropriate_files"),
|
|
121
|
+
`/${jsenvDirectoryRelativeUrl}${expectedCompiledId}/${compileGroup.fileRelativeUrl}`,
|
|
122
|
+
)
|
|
123
123
|
|
|
124
124
|
if (hasWarning) {
|
|
125
125
|
enableWarningStyle()
|
|
@@ -6,51 +6,80 @@ const notificationPreference = createPreference("notification")
|
|
|
6
6
|
|
|
7
7
|
const arrayOfOpenedNotifications = []
|
|
8
8
|
export const renderToolbarNotification = () => {
|
|
9
|
-
const notifCheckbox = document.querySelector("#toggle-notifs")
|
|
10
9
|
if (!notificationAvailable) {
|
|
11
|
-
|
|
12
|
-
notifSetting.setAttribute("data-disabled", "true")
|
|
13
|
-
notifSetting.setAttribute(
|
|
14
|
-
"title",
|
|
15
|
-
`Notification not available in the browser`,
|
|
16
|
-
)
|
|
17
|
-
notifCheckbox.disabled = true
|
|
10
|
+
applyNotificationNotAvailableEffects()
|
|
18
11
|
return
|
|
19
12
|
}
|
|
13
|
+
updatePermission()
|
|
14
|
+
}
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
const updatePermission = () => {
|
|
17
|
+
const notifPermission = Notification.permission
|
|
18
|
+
if (notifPermission === "default") {
|
|
19
|
+
applyNotificationDefaultEffects()
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
if (notifPermission === "denied") {
|
|
23
|
+
applyNotificationDeniedEffects()
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
if (notifPermission === "granted") {
|
|
27
|
+
applyNotificationGrantedEffects()
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
}
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
const notifCheckbox = document.querySelector("#toggle-notifs")
|
|
33
|
+
|
|
34
|
+
const applyNotificationNotAvailableEffects = () => {
|
|
35
|
+
const notifSetting = document.querySelector(".settings-notification")
|
|
36
|
+
notifSetting.setAttribute("data-disabled", "true")
|
|
37
|
+
notifSetting.setAttribute(
|
|
38
|
+
"title",
|
|
39
|
+
`Notification not available in the browser`,
|
|
40
|
+
)
|
|
41
|
+
notifCheckbox.disabled = true
|
|
42
|
+
}
|
|
43
|
+
const applyNotificationDefaultEffects = () => {
|
|
44
|
+
applyNotificationNOTGrantedEffects()
|
|
45
|
+
const notifSetting = document.querySelector(".settings-notification")
|
|
46
|
+
notifSetting.removeAttribute("data-disabled")
|
|
47
|
+
notifSetting.removeAttribute("title")
|
|
48
|
+
}
|
|
49
|
+
const applyNotificationDeniedEffects = () => {
|
|
50
|
+
applyNotificationNOTGrantedEffects()
|
|
51
|
+
const notifSetting = document.querySelector(".settings-notification")
|
|
52
|
+
notifSetting.setAttribute("data-disabled", "true")
|
|
53
|
+
notifSetting.setAttribute("title", `Notification denied`)
|
|
54
|
+
}
|
|
55
|
+
const applyNotificationGrantedEffects = () => {
|
|
56
|
+
enableVariant(document.querySelector(".notification-text"), {
|
|
57
|
+
notif_granted: "yes",
|
|
58
|
+
})
|
|
59
|
+
notifCheckbox.disabled = false
|
|
60
|
+
notifCheckbox.checked = getNotificationPreference()
|
|
61
|
+
notifCheckbox.onchange = () => {
|
|
62
|
+
setNotificationPreference(notifCheckbox.checked)
|
|
63
|
+
if (!notifCheckbox.checked) {
|
|
64
|
+
// slice because arrayOfOpenedNotifications can be mutated while looping
|
|
65
|
+
arrayOfOpenedNotifications.slice().forEach((notification) => {
|
|
66
|
+
notification.close()
|
|
67
|
+
})
|
|
39
68
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const applyNotificationNOTGrantedEffects = () => {
|
|
72
|
+
enableVariant(document.querySelector(".notification-text"), {
|
|
73
|
+
notif_granted: "no",
|
|
74
|
+
})
|
|
75
|
+
notifCheckbox.disabled = true
|
|
76
|
+
notifCheckbox.checked = false
|
|
77
|
+
document.querySelector("a.request_notification_permission").onclick = () => {
|
|
78
|
+
requestPermission().then(() => {
|
|
79
|
+
setNotificationPreference(true)
|
|
80
|
+
updatePermission()
|
|
43
81
|
})
|
|
44
|
-
if (notifPermission === "default") {
|
|
45
|
-
document.querySelector("a.request_notification_permission").onclick =
|
|
46
|
-
() => {
|
|
47
|
-
requestPermission().then(() => {
|
|
48
|
-
updatePermission()
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
82
|
}
|
|
53
|
-
updatePermission()
|
|
54
83
|
}
|
|
55
84
|
|
|
56
85
|
export const notifyExecutionResult = (
|