@jsenv/core 40.1.5 → 40.1.6

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.
@@ -7,7 +7,7 @@ import { generateSourcemapFileUrl, createMagicSource, composeTwoSourcemaps, gene
7
7
  import { performance } from "node:perf_hooks";
8
8
  import { jsenvPluginSupervisor } from "@jsenv/plugin-supervisor";
9
9
  import { WebSocketResponse, pickContentType } from "@jsenv/server";
10
- import { createHash } from "node:crypto";
10
+ import { randomUUID, createHash } from "node:crypto";
11
11
  import "strip-ansi";
12
12
  import "../jsenv_core_node_modules.js";
13
13
  import "node:os";
@@ -8097,6 +8097,46 @@ const jsenvPluginCleanHTML = () => {
8097
8097
  };
8098
8098
  };
8099
8099
 
8100
+ /**
8101
+ * https://docs.google.com/document/d/1rfKPnxsNuXhnF7AiQZhu9kIwdiMS5hnAI05HBwFuBSM/edit?tab=t.0#heading=h.7nki9mck5t64
8102
+ * https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md
8103
+ * https://github.com/ChromeDevTools/vite-plugin-devtools-json
8104
+ */
8105
+
8106
+
8107
+ const jsenvPluginChromeDevtoolsJson = () => {
8108
+ const getOrCreateUUID = (kitchen) => {
8109
+ const { outDirectoryUrl } = kitchen.context;
8110
+ const uuidFileUrl = new URL("./uuid.json", outDirectoryUrl);
8111
+ if (existsSync(uuidFileUrl)) {
8112
+ const { uuid } = JSON.parse(readFileSync(uuidFileUrl, "utf8"));
8113
+ return uuid;
8114
+ }
8115
+ const uuid = randomUUID();
8116
+ writeFileSync(uuidFileUrl, JSON.stringify({ uuid }), { });
8117
+ return uuid;
8118
+ };
8119
+
8120
+ return {
8121
+ name: "jsenv_plugin_chrome_devtools_json",
8122
+ appliesDuring: "dev",
8123
+ devServerRoutes: [
8124
+ {
8125
+ route: "GET /.well-known/appspecific/com.chrome.devtools.json",
8126
+ fetch: (request, { kitchen }) => {
8127
+ const { rootDirectoryUrl } = kitchen.context;
8128
+ return Response.json({
8129
+ workspace: {
8130
+ root: urlToFileSystemPath(rootDirectoryUrl),
8131
+ uuid: getOrCreateUUID(kitchen),
8132
+ },
8133
+ });
8134
+ },
8135
+ },
8136
+ ],
8137
+ };
8138
+ };
8139
+
8100
8140
  // tslint:disable:ordered-imports
8101
8141
 
8102
8142
 
@@ -8202,6 +8242,7 @@ const getCorePlugins = ({
8202
8242
  ...(cacheControl ? [jsenvPluginCacheControl(cacheControl)] : []),
8203
8243
  ...(ribbon ? [jsenvPluginRibbon({ rootDirectoryUrl, ...ribbon })] : []),
8204
8244
  jsenvPluginCleanHTML(),
8245
+ jsenvPluginChromeDevtoolsJson(),
8205
8246
  ];
8206
8247
  };
8207
8248
 
@@ -10618,7 +10659,6 @@ const build = async ({
10618
10659
  };
10619
10660
  },
10620
10661
  onBuildEnd: ({ buildFileContents, duration }) => {
10621
- logger.info("");
10622
10662
  logger.info(renderBuildEndLog({ duration, buildFileContents }));
10623
10663
  },
10624
10664
  };
@@ -7,6 +7,7 @@ import { generateSourcemapFileUrl, createMagicSource, composeTwoSourcemaps, gene
7
7
  import { parseHtml, injectHtmlNodeAsEarlyAsPossible, createHtmlNode, stringifyHtmlAst, applyBabelPlugins, generateUrlForInlineContent, parseJsWithAcorn, parseCssUrls, getHtmlNodeAttribute, getHtmlNodePosition, getHtmlNodeAttributePosition, setHtmlNodeAttributes, parseSrcSet, getUrlForContentInsideHtml, removeHtmlNodeText, setHtmlNodeText, getHtmlNodeText, analyzeScriptNode, visitHtmlNodes, parseJsUrls, getUrlForContentInsideJs, analyzeLinkNode, injectJsenvScript } from "@jsenv/ast";
8
8
  import { performance } from "node:perf_hooks";
9
9
  import { jsenvPluginSupervisor } from "@jsenv/plugin-supervisor";
10
+ import { randomUUID } from "node:crypto";
10
11
  import { createRequire } from "node:module";
11
12
  import "strip-ansi";
12
13
  import "../jsenv_core_node_modules.js";
@@ -15,7 +16,6 @@ import "node:os";
15
16
  import "node:tty";
16
17
  import "node:util";
17
18
  import "node:path";
18
- import "node:crypto";
19
19
  import "@jsenv/js-module-fallback";
20
20
 
21
21
  // default runtimeCompat corresponds to
@@ -8138,6 +8138,46 @@ const jsenvPluginCleanHTML = () => {
8138
8138
  };
8139
8139
  };
8140
8140
 
8141
+ /**
8142
+ * https://docs.google.com/document/d/1rfKPnxsNuXhnF7AiQZhu9kIwdiMS5hnAI05HBwFuBSM/edit?tab=t.0#heading=h.7nki9mck5t64
8143
+ * https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md
8144
+ * https://github.com/ChromeDevTools/vite-plugin-devtools-json
8145
+ */
8146
+
8147
+
8148
+ const jsenvPluginChromeDevtoolsJson = () => {
8149
+ const getOrCreateUUID = (kitchen) => {
8150
+ const { outDirectoryUrl } = kitchen.context;
8151
+ const uuidFileUrl = new URL("./uuid.json", outDirectoryUrl);
8152
+ if (existsSync(uuidFileUrl)) {
8153
+ const { uuid } = JSON.parse(readFileSync(uuidFileUrl, "utf8"));
8154
+ return uuid;
8155
+ }
8156
+ const uuid = randomUUID();
8157
+ writeFileSync(uuidFileUrl, JSON.stringify({ uuid }), { });
8158
+ return uuid;
8159
+ };
8160
+
8161
+ return {
8162
+ name: "jsenv_plugin_chrome_devtools_json",
8163
+ appliesDuring: "dev",
8164
+ devServerRoutes: [
8165
+ {
8166
+ route: "GET /.well-known/appspecific/com.chrome.devtools.json",
8167
+ fetch: (request, { kitchen }) => {
8168
+ const { rootDirectoryUrl } = kitchen.context;
8169
+ return Response.json({
8170
+ workspace: {
8171
+ root: urlToFileSystemPath(rootDirectoryUrl),
8172
+ uuid: getOrCreateUUID(kitchen),
8173
+ },
8174
+ });
8175
+ },
8176
+ },
8177
+ ],
8178
+ };
8179
+ };
8180
+
8141
8181
  // tslint:disable:ordered-imports
8142
8182
 
8143
8183
 
@@ -8243,6 +8283,7 @@ const getCorePlugins = ({
8243
8283
  ...(cacheControl ? [jsenvPluginCacheControl(cacheControl)] : []),
8244
8284
  ...(ribbon ? [jsenvPluginRibbon({ rootDirectoryUrl, ...ribbon })] : []),
8245
8285
  jsenvPluginCleanHTML(),
8286
+ jsenvPluginChromeDevtoolsJson(),
8246
8287
  ];
8247
8288
  };
8248
8289
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "40.1.5",
3
+ "version": "40.1.6",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -34,9 +34,9 @@
34
34
  "/src/"
35
35
  ],
36
36
  "volta": {
37
- "node": "22.13.1"
37
+ "node": "23.11.0"
38
38
  },
39
- "packageManager": "npm@10.9.2",
39
+ "packageManager": "npm@11.2.0",
40
40
  "workspaces": [
41
41
  "./packages/independent/*",
42
42
  "./packages/independent/backend/*",
@@ -476,7 +476,6 @@ export const build = async ({
476
476
  };
477
477
  },
478
478
  onBuildEnd: ({ buildFileContents, duration }) => {
479
- logger.info("");
480
479
  logger.info(renderBuildEndLog({ duration, buildFileContents }));
481
480
  },
482
481
  };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * https://docs.google.com/document/d/1rfKPnxsNuXhnF7AiQZhu9kIwdiMS5hnAI05HBwFuBSM/edit?tab=t.0#heading=h.7nki9mck5t64
3
+ * https://chromium.googlesource.com/devtools/devtools-frontend/+/main/docs/ecosystem/automatic_workspace_folders.md
4
+ * https://github.com/ChromeDevTools/vite-plugin-devtools-json
5
+ */
6
+
7
+ import { writeFileSync } from "@jsenv/filesystem";
8
+ import { urlToFileSystemPath } from "@jsenv/urls";
9
+ import { randomUUID } from "node:crypto";
10
+ import { existsSync, readFileSync } from "node:fs";
11
+
12
+ export const jsenvPluginChromeDevtoolsJson = () => {
13
+ const getOrCreateUUID = (kitchen) => {
14
+ const { outDirectoryUrl } = kitchen.context;
15
+ const uuidFileUrl = new URL("./uuid.json", outDirectoryUrl);
16
+ if (existsSync(uuidFileUrl)) {
17
+ const { uuid } = JSON.parse(readFileSync(uuidFileUrl, "utf8"));
18
+ return uuid;
19
+ }
20
+ const uuid = randomUUID();
21
+ writeFileSync(uuidFileUrl, JSON.stringify({ uuid }), { encoding: "utf8" });
22
+ return uuid;
23
+ };
24
+
25
+ return {
26
+ name: "jsenv_plugin_chrome_devtools_json",
27
+ appliesDuring: "dev",
28
+ devServerRoutes: [
29
+ {
30
+ route: "GET /.well-known/appspecific/com.chrome.devtools.json",
31
+ fetch: (request, { kitchen }) => {
32
+ const { rootDirectoryUrl } = kitchen.context;
33
+ return Response.json({
34
+ workspace: {
35
+ root: urlToFileSystemPath(rootDirectoryUrl),
36
+ uuid: getOrCreateUUID(kitchen),
37
+ },
38
+ });
39
+ },
40
+ },
41
+ ],
42
+ };
43
+ };
@@ -23,6 +23,7 @@ import { jsenvPluginCacheControl } from "./cache_control/jsenv_plugin_cache_cont
23
23
  // other
24
24
  import { jsenvPluginRibbon } from "./ribbon/jsenv_plugin_ribbon.js";
25
25
  import { jsenvPluginCleanHTML } from "./clean_html/jsenv_plugin_clean_html.js";
26
+ import { jsenvPluginChromeDevtoolsJson } from "./chrome_devtools_json/jsenv_plugin_chrome_devtools_json.js";
26
27
 
27
28
  export const getCorePlugins = ({
28
29
  rootDirectoryUrl,
@@ -126,5 +127,6 @@ export const getCorePlugins = ({
126
127
  ...(cacheControl ? [jsenvPluginCacheControl(cacheControl)] : []),
127
128
  ...(ribbon ? [jsenvPluginRibbon({ rootDirectoryUrl, ...ribbon })] : []),
128
129
  jsenvPluginCleanHTML(),
130
+ jsenvPluginChromeDevtoolsJson(),
129
131
  ];
130
132
  };