@jsenv/core 39.2.17 → 39.2.18

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/js/ribbon.js CHANGED
@@ -35,8 +35,7 @@ const injectRibbon = ({ text }) => {
35
35
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
36
36
  text-align: center;
37
37
  user-select: none;
38
- }
39
- `;
38
+ }`;
40
39
  const html = /* html */ `<div id="jsenv_ribbon_container">
41
40
  <style>${css}</style>
42
41
  <div id="jsenv_ribbon">
@@ -64,7 +63,33 @@ const injectRibbon = ({ text }) => {
64
63
  const jsenvRibbonElement = new JsenvRibbonHtmlElement({
65
64
  hidden: toolbarStateInLocalStorage.ribbonDisplayed === false,
66
65
  });
67
- document.body.appendChild(jsenvRibbonElement);
66
+ appendIntoRespectingLineBreaksAndIndentation(
67
+ jsenvRibbonElement,
68
+ document.body,
69
+ );
70
+ };
71
+
72
+ const appendIntoRespectingLineBreaksAndIndentation = (
73
+ node,
74
+ parentNode,
75
+ { indent = 2 } = {},
76
+ ) => {
77
+ const indentMinusOne = " ".repeat(indent - 1);
78
+ const desiredIndent = " ".repeat(indent);
79
+ const previousSibling =
80
+ parentNode.childNodes[parentNode.childNodes.length - 1];
81
+ if (previousSibling && previousSibling.nodeName === "#text") {
82
+ if (previousSibling.nodeValue === `\n${indentMinusOne}`) {
83
+ previousSibling.nodeValue = `\n${desiredIndent}`;
84
+ }
85
+ if (previousSibling.nodeValue !== `\n${desiredIndent}`) {
86
+ previousSibling.nodeValue = `\n${desiredIndent}`;
87
+ }
88
+ } else {
89
+ parentNode.appendChild(document.createTextNode(`\n${desiredIndent}`));
90
+ }
91
+ parentNode.appendChild(node);
92
+ parentNode.appendChild(document.createTextNode(`\n${indentMinusOne}`));
68
93
  };
69
94
 
70
95
  export { injectRibbon };
@@ -3065,7 +3065,7 @@ const isWindowsPathnameSpecifier = (specifier) => {
3065
3065
  };
3066
3066
  const hasScheme$1 = (specifier) => /^[a-zA-Z]+:/.test(specifier);
3067
3067
 
3068
- const createFilter = (patterns, url) => {
3068
+ const createFilter = (patterns, url, map = (v) => v) => {
3069
3069
  const associations = resolveAssociations(
3070
3070
  {
3071
3071
  yes: patterns,
@@ -3074,7 +3074,7 @@ const createFilter = (patterns, url) => {
3074
3074
  );
3075
3075
  return (url) => {
3076
3076
  const meta = applyAssociations({ url, associations });
3077
- return Boolean(meta.yes);
3077
+ return Boolean(map(meta.yes));
3078
3078
  };
3079
3079
  };
3080
3080
 
@@ -23179,6 +23179,9 @@ ${e.trace?.message}`);
23179
23179
  }
23180
23180
  },
23181
23181
  handleWebsocket: (websocket, { request }) => {
23182
+ // if (true || logLevel === "debug") {
23183
+ // console.log("handleWebsocket", websocket, request.headers);
23184
+ // }
23182
23185
  if (request.headers["sec-websocket-protocol"] === "jsenv") {
23183
23186
  serverEventsDispatcher.addWebsocket(websocket, request);
23184
23187
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "39.2.17",
3
+ "version": "39.2.18",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -61,6 +61,7 @@
61
61
  "test:only_dev_server_errors": "node --conditions=development ./tests/dev_server/errors/dev_errors_snapshots.test.mjs",
62
62
  "workspace:test:ci": "CI=1 npm run workspace:test",
63
63
  "dev": "node --conditions=development ./scripts/dev/dev.mjs",
64
+ "playwright:install": "npx playwright install-deps && npx playwright install",
64
65
  "certificate:install": "node ./scripts/dev/install_certificate_authority.mjs",
65
66
  "prepublishOnly": "npm run build"
66
67
  },
@@ -68,20 +69,20 @@
68
69
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
69
70
  "@jsenv/abort": "4.3.0",
70
71
  "@jsenv/ast": "6.2.14",
71
- "@jsenv/filesystem": "4.9.9",
72
+ "@jsenv/filesystem": "4.9.10",
72
73
  "@jsenv/humanize": "1.2.8",
73
74
  "@jsenv/importmap": "1.2.1",
74
75
  "@jsenv/integrity": "0.0.2",
75
76
  "@jsenv/js-module-fallback": "1.3.35",
76
77
  "@jsenv/node-esm-resolution": "1.0.2",
77
- "@jsenv/plugin-bundling": "2.7.5",
78
+ "@jsenv/plugin-bundling": "2.7.6",
78
79
  "@jsenv/plugin-minification": "1.5.5",
79
80
  "@jsenv/plugin-supervisor": "1.5.15",
80
81
  "@jsenv/plugin-transpilation": "1.4.19",
81
82
  "@jsenv/runtime-compat": "1.3.1",
82
- "@jsenv/server": "15.2.18",
83
+ "@jsenv/server": "15.2.19",
83
84
  "@jsenv/sourcemap": "1.2.22",
84
- "@jsenv/url-meta": "8.5.0",
85
+ "@jsenv/url-meta": "8.5.1",
85
86
  "@jsenv/urls": "2.5.2",
86
87
  "@jsenv/utils": "2.1.2",
87
88
  "anchor-markdown-header": "0.7.0"
@@ -561,6 +561,9 @@ ${e.trace?.message}`);
561
561
  }
562
562
  },
563
563
  handleWebsocket: (websocket, { request }) => {
564
+ // if (true || logLevel === "debug") {
565
+ // console.log("handleWebsocket", websocket, request.headers);
566
+ // }
564
567
  if (request.headers["sec-websocket-protocol"] === "jsenv") {
565
568
  serverEventsDispatcher.addWebsocket(websocket, request);
566
569
  }
@@ -35,8 +35,7 @@ export const injectRibbon = ({ text }) => {
35
35
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
36
36
  text-align: center;
37
37
  user-select: none;
38
- }
39
- `;
38
+ }`;
40
39
  const html = /* html */ `<div id="jsenv_ribbon_container">
41
40
  <style>${css}</style>
42
41
  <div id="jsenv_ribbon">
@@ -64,5 +63,31 @@ export const injectRibbon = ({ text }) => {
64
63
  const jsenvRibbonElement = new JsenvRibbonHtmlElement({
65
64
  hidden: toolbarStateInLocalStorage.ribbonDisplayed === false,
66
65
  });
67
- document.body.appendChild(jsenvRibbonElement);
66
+ appendIntoRespectingLineBreaksAndIndentation(
67
+ jsenvRibbonElement,
68
+ document.body,
69
+ );
70
+ };
71
+
72
+ const appendIntoRespectingLineBreaksAndIndentation = (
73
+ node,
74
+ parentNode,
75
+ { indent = 2 } = {},
76
+ ) => {
77
+ const indentMinusOne = " ".repeat(indent - 1);
78
+ const desiredIndent = " ".repeat(indent);
79
+ const previousSibling =
80
+ parentNode.childNodes[parentNode.childNodes.length - 1];
81
+ if (previousSibling && previousSibling.nodeName === "#text") {
82
+ if (previousSibling.nodeValue === `\n${indentMinusOne}`) {
83
+ previousSibling.nodeValue = `\n${desiredIndent}`;
84
+ }
85
+ if (previousSibling.nodeValue !== `\n${desiredIndent}`) {
86
+ previousSibling.nodeValue = `\n${desiredIndent}`;
87
+ }
88
+ } else {
89
+ parentNode.appendChild(document.createTextNode(`\n${desiredIndent}`));
90
+ }
91
+ parentNode.appendChild(node);
92
+ parentNode.appendChild(document.createTextNode(`\n${indentMinusOne}`));
68
93
  };