@nuxt/devtools-nightly 4.0.0-29889901.a2a4fc6 → 4.0.0-29893186.47ed265

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.
@@ -28,6 +28,7 @@ import 'node:process';
28
28
  import 'node:module';
29
29
  import '@vitejs/devtools-kit/constants';
30
30
  import 'perfect-debounce';
31
+ import 'node:tls';
31
32
 
32
33
  async function getFolderSize(dir) {
33
34
  const dirents = await readdir(dir, {
@@ -22,10 +22,11 @@ import { getDefaultExportOptions, addNuxtModule } from 'magicast/helpers';
22
22
  import process$1 from 'node:process';
23
23
  import { createRequire } from 'node:module';
24
24
  import { getPackageInfo } from 'local-pkg';
25
- import { DEVTOOLS_TERMINALS_DOCK_ID } from '@vitejs/devtools-kit/constants';
25
+ import { DEVTOOLS_TERMINALS_DOCK_ID, DEVTOOLS_MOUNT_PATH } from '@vitejs/devtools-kit/constants';
26
26
  import { debounce } from 'perfect-debounce';
27
+ import { Server } from 'node:tls';
27
28
 
28
- const version = "4.0.0-29889901.a2a4fc6";
29
+ const version = "4.0.0-29893186.47ed265";
29
30
  const peerDependencies = {
30
31
  "@nuxt/kit": "^4.0.0-0 || ^5.0.0-0",
31
32
  nitro: "*",
@@ -1760,6 +1761,37 @@ function setupRPC(nuxt, options) {
1760
1761
  };
1761
1762
  }
1762
1763
 
1764
+ const SKIPS_DEVTOOLS_UPGRADES = /* @__PURE__ */ Symbol.for("nuxt-devtools:skips-devtools-upgrades");
1765
+ function createDevListenerPlugin(nuxt) {
1766
+ return {
1767
+ name: "nuxt:devtools:dev-listener",
1768
+ apply: "serve",
1769
+ configureServer: {
1770
+ order: "pre",
1771
+ handler(server) {
1772
+ if (server.config.build?.ssr || server.httpServer)
1773
+ return;
1774
+ const listener = nuxt._devServerListener;
1775
+ if (!(listener instanceof Server))
1776
+ return;
1777
+ server.httpServer = listener;
1778
+ skipDevToolsUpgrades(nuxt.server);
1779
+ }
1780
+ }
1781
+ };
1782
+ }
1783
+ function skipDevToolsUpgrades(nuxtServer) {
1784
+ const upgrade = nuxtServer?.upgrade;
1785
+ if (!nuxtServer || typeof upgrade !== "function" || nuxtServer[SKIPS_DEVTOOLS_UPGRADES])
1786
+ return;
1787
+ nuxtServer[SKIPS_DEVTOOLS_UPGRADES] = true;
1788
+ nuxtServer.upgrade = (req, socket, head) => {
1789
+ if (req.url?.startsWith(DEVTOOLS_MOUNT_PATH))
1790
+ return;
1791
+ return upgrade.call(nuxtServer, req, socket, head);
1792
+ };
1793
+ }
1794
+
1763
1795
  const MULTIPLE_SLASHES_RE = /\/+/g;
1764
1796
  const ASSETS_PACKAGE = "@nuxt/devtools-assets";
1765
1797
  function resolveClientAssetsSource() {
@@ -1825,9 +1857,12 @@ async function enableModule(options, nuxt) {
1825
1857
  const clientAssetsSource = isSelfClient ? void 0 : resolveClientAssetsSource();
1826
1858
  const clientUrl = clientAssetsSource ? `${ROUTE_CLIENT}/` : `${nuxt.options.app.baseURL || "/"}/`.replace(MULTIPLE_SLASHES_RE, "/");
1827
1859
  let publicDevServerOrigin;
1828
- nuxt.hook("listen", (_server, listener) => {
1860
+ const allowedOrigins = [];
1861
+ nuxt.hook("listen", async (_server, listener) => {
1829
1862
  if (listener?.url)
1830
1863
  publicDevServerOrigin = new URL(listener.url).origin;
1864
+ const urls = await listener?.getURLs?.() ?? [];
1865
+ allowedOrigins.push(...urls.map(({ url }) => new URL(url).origin));
1831
1866
  });
1832
1867
  const branding = {
1833
1868
  productName: "Nuxt DevTools",
@@ -1841,8 +1876,13 @@ async function enableModule(options, nuxt) {
1841
1876
  windowTitle: "Nuxt DevTools"
1842
1877
  };
1843
1878
  viteDevToolsDefaults.branding = branding;
1879
+ viteDevToolsDefaults.allowedOrigins = allowedOrigins;
1844
1880
  if (isGreaterThanOrEqual(version$1, "8.3.0")) {
1845
1881
  extendViteDevToolsConfig((devtools) => {
1882
+ devtools.allowedOrigins = [
1883
+ ...devtools.allowedOrigins ?? [],
1884
+ ...allowedOrigins
1885
+ ];
1846
1886
  for (const [key, value] of Object.entries(viteDevToolsDefaults))
1847
1887
  devtools[key] ??= value;
1848
1888
  });
@@ -1850,6 +1890,7 @@ async function enableModule(options, nuxt) {
1850
1890
  const DevTools = await import('@vitejs/devtools').then((r) => r.DevTools(viteDevToolsDefaults));
1851
1891
  addVitePlugin(DevTools);
1852
1892
  }
1893
+ addVitePlugin(createDevListenerPlugin(nuxt), { server: false });
1853
1894
  let connectDevToolsKit;
1854
1895
  addVitePlugin(defineViteDevToolsPlugin({
1855
1896
  name: "nuxt:devtools",
@@ -27,6 +27,7 @@ import 'node:process';
27
27
  import 'node:module';
28
28
  import '@vitejs/devtools-kit/constants';
29
29
  import 'perfect-debounce';
30
+ import 'node:tls';
30
31
 
31
32
  const VERSION_QUERY_RE = /\?v=\w+$/;
32
33
  const VUE_EXT_RE = /\.vue($|\?v=)/;
@@ -27,6 +27,7 @@ import 'node:module';
27
27
  import 'local-pkg';
28
28
  import '@vitejs/devtools-kit/constants';
29
29
  import 'perfect-debounce';
30
+ import 'node:tls';
30
31
 
31
32
  function setup({ nuxt }) {
32
33
  if (!nuxt.options.dev || nuxt.options.test)
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools",
3
3
  "configKey": "devtools",
4
- "version": "4.0.0-29889901.a2a4fc6",
4
+ "version": "4.0.0-29893186.47ed265",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-nightly",
3
3
  "type": "module",
4
- "version": "4.0.0-29889901.a2a4fc6",
4
+ "version": "4.0.0-29893186.47ed265",
5
5
  "description": "The Nuxt DevTools gives you insights and transparency about your Nuxt App.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://nuxt.com/modules/devtools",
@@ -48,8 +48,8 @@
48
48
  "@devframes/plugin-code-server": "^1.2.6",
49
49
  "@devframes/plugin-data-inspector": "^1.2.6",
50
50
  "@devframes/plugin-og": "^1.2.6",
51
- "@nuxt/devtools-assets": "npm:@nuxt/devtools-assets-nightly@4.0.0-29889901.a2a4fc6",
52
- "@nuxt/devtools-kit": "npm:@nuxt/devtools-kit-nightly@4.0.0-29889901.a2a4fc6",
51
+ "@nuxt/devtools-assets": "npm:@nuxt/devtools-assets-nightly@4.0.0-29893186.47ed265",
52
+ "@nuxt/devtools-kit": "npm:@nuxt/devtools-kit-nightly@4.0.0-29893186.47ed265",
53
53
  "@vitejs/devtools": "^0.8.0",
54
54
  "@vitejs/devtools-kit": "^0.8.0",
55
55
  "consola": "^3.4.2",