@qwik.dev/devtools 0.0.6 → 0.1.1

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.
Files changed (51) hide show
  1. package/README.md +66 -0
  2. package/dist/plugin/index.cjs +39 -0
  3. package/dist/plugin/index.mjs +39 -0
  4. package/dist/ui/components/DevtoolsButton/DevtoolsButton.qwik.cjs +21 -0
  5. package/dist/ui/components/DevtoolsButton/DevtoolsButton.qwik.mjs +21 -0
  6. package/dist/ui/components/DevtoolsContainer/DevtoolsContainer.qwik.cjs +12 -0
  7. package/dist/ui/components/DevtoolsContainer/DevtoolsContainer.qwik.mjs +12 -0
  8. package/dist/ui/components/DevtoolsPanel/DevtoolsPanel.qwik.cjs +34 -0
  9. package/dist/ui/components/DevtoolsPanel/DevtoolsPanel.qwik.mjs +34 -0
  10. package/dist/ui/components/Tab/Tab.qwik.cjs +17 -0
  11. package/dist/ui/components/Tab/Tab.qwik.mjs +17 -0
  12. package/dist/ui/components/TabContent/TabContent.qwik.cjs +21 -0
  13. package/dist/ui/components/TabContent/TabContent.qwik.mjs +21 -0
  14. package/dist/ui/components/TabTitle/TabTitle.qwik.cjs +11 -0
  15. package/dist/ui/components/TabTitle/TabTitle.qwik.mjs +11 -0
  16. package/dist/ui/devtools.qwik.cjs +87 -415
  17. package/dist/ui/devtools.qwik.mjs +88 -416
  18. package/dist/ui/features/Assets/Assets.qwik.cjs +60 -0
  19. package/dist/ui/features/Assets/Assets.qwik.mjs +60 -0
  20. package/dist/ui/features/Overview/Overview.qwik.cjs +165 -0
  21. package/dist/ui/features/Overview/Overview.qwik.mjs +165 -0
  22. package/dist/ui/features/Packages/Packages.qwik.cjs +95 -0
  23. package/dist/ui/features/Packages/Packages.qwik.mjs +95 -0
  24. package/dist/ui/features/Packages/components/InstallButton/InstallButton.qwik.cjs +36 -0
  25. package/dist/ui/features/Packages/components/InstallButton/InstallButton.qwik.mjs +36 -0
  26. package/dist/ui/features/Routes/Routes.qwik.cjs +65 -0
  27. package/dist/ui/features/Routes/Routes.qwik.mjs +65 -0
  28. package/dist/ui/global.css.qwik.cjs +3 -0
  29. package/dist/ui/global.css.qwik.mjs +4 -0
  30. package/dist/ui/hooks/useDebouncer.qwik.cjs +13 -0
  31. package/dist/ui/hooks/useDebouncer.qwik.mjs +13 -0
  32. package/dist/ui/lib-types/kit/src/types.d.ts +4 -0
  33. package/dist/ui/lib-types/ui/src/components/DevtoolsButton/DevtoolsButton.d.ts +6 -0
  34. package/dist/ui/lib-types/ui/src/components/DevtoolsContainer/DevtoolsContainer.d.ts +1 -0
  35. package/dist/ui/lib-types/ui/src/components/DevtoolsPanel/DevtoolsPanel.d.ts +6 -0
  36. package/dist/ui/lib-types/ui/src/components/Tab/Tab.d.ts +8 -0
  37. package/dist/ui/lib-types/ui/src/components/TabContent/TabContent.d.ts +1 -0
  38. package/dist/ui/lib-types/ui/src/components/TabTitle/TabTitle.d.ts +5 -0
  39. package/dist/ui/lib-types/ui/src/features/Assets/Assets.d.ts +6 -0
  40. package/dist/ui/lib-types/ui/src/features/Components/Components.d.ts +1 -0
  41. package/dist/ui/lib-types/ui/src/features/Overview/Overview.d.ts +6 -0
  42. package/dist/ui/lib-types/ui/src/features/Packages/Packages.d.ts +1 -0
  43. package/dist/ui/lib-types/ui/src/features/Packages/components/InstallButton/InstallButton.d.ts +6 -0
  44. package/dist/ui/lib-types/ui/src/features/Packages/types.d.ts +5 -0
  45. package/dist/ui/lib-types/ui/src/features/Routes/Routes.d.ts +6 -0
  46. package/dist/ui/lib-types/ui/src/hooks/useDebouncer.d.ts +2 -0
  47. package/dist/ui/lib-types/ui/src/index.d.ts +1 -1
  48. package/dist/ui/lib-types/ui/src/types/state.d.ts +10 -0
  49. package/package.json +3 -2
  50. package/dist/ui/devtools.css.qwik.cjs +0 -3
  51. package/dist/ui/devtools.css.qwik.mjs +0 -4
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Qwik DevTools
2
+
3
+ ![Qwik DevTools](https://raw.github.com/QwikDev/devtools/main/assets/screenshot.png)
4
+
5
+ Enhance your Qwik development experience with DevTools that provide real-time insights into your application, dependencies, and setup.
6
+
7
+ ## Installation
8
+
9
+ > Qwik DevTools requires **Qwik v2.0.0-alpha.4 or higher**.
10
+
11
+ ```shell copy
12
+ npm install @qwik.dev/devtools -D
13
+ ```
14
+
15
+ ```shell copy
16
+ pnpm add @qwik.dev/devtools -D
17
+ ```
18
+
19
+ ```shell copy
20
+ yarn add @qwik.dev/devtools -D
21
+ ```
22
+
23
+ ## Setup
24
+
25
+ Add the plugin to your `vite.config.(m)ts`:
26
+
27
+ ```ts copy
28
+ import { qwikDevtools } from '@qwik.dev/devtools';
29
+
30
+ export default defineConfig({
31
+ plugins: [
32
+ qwikRouter(),
33
+ qwikVite(),
34
+ tsconfigPaths(),
35
+ qwikDevtools(), // 👈 Add the plugin here
36
+ ],
37
+ });
38
+ ```
39
+
40
+ ## Features
41
+
42
+ - 🔍 Route Explorer
43
+ - ⚡️ Dependency Explorer
44
+ - 📊 Asset Explorer
45
+ - 🐞 Debug Tools
46
+
47
+ ## Contribution Guide
48
+
49
+ Please refer to the [Contribution Guide](./CONTRIBUTING.md). Sharing feedback and feature request with GitHub issues is welcome.
50
+
51
+ ## Community
52
+
53
+ Join our vibrant community:
54
+
55
+ - 🐦 Follow [@QwikDev](https://twitter.com/QwikDev) on Twitter
56
+ - 💬 Join our [Discord](https://qwik.dev/chat) community
57
+ - 🌐 Check out [other community groups](https://qwik.dev/ecosystem/#community)
58
+
59
+ ## Related Links
60
+
61
+ - [📚 Qwik Documentation](https://qwik.dev/)
62
+ - [💬 Discord Chat](https://qwik.dev/chat)
63
+ - [⭐️ Qwik GitHub](https://github.com/QwikDev/qwik)
64
+ - [🐦 @QwikDev](https://twitter.com/QwikDev)
65
+ - [⚡️ Vite](https://vitejs.dev/)
66
+
@@ -12,6 +12,7 @@ const node_path = require('node:path');
12
12
  const node_os = require('node:os');
13
13
  const node_crypto = require('node:crypto');
14
14
  require('node:fs');
15
+ const child_process = require('child_process');
15
16
 
16
17
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
17
18
 
@@ -9464,6 +9465,22 @@ function getRouteFunctions({ config }) {
9464
9465
  };
9465
9466
  }
9466
9467
 
9468
+ async function detectPackageManager(projectRoot) {
9469
+ try {
9470
+ if (await fsp__default.access(require$$0__default$1.join(projectRoot, "pnpm-lock.yaml")).then(() => true).catch(() => false)) {
9471
+ return "pnpm";
9472
+ }
9473
+ if (await fsp__default.access(require$$0__default$1.join(projectRoot, "yarn.lock")).then(() => true).catch(() => false)) {
9474
+ return "yarn";
9475
+ }
9476
+ if (await fsp__default.access(require$$0__default$1.join(projectRoot, "package-lock.json")).then(() => true).catch(() => false)) {
9477
+ return "npm";
9478
+ }
9479
+ return "pnpm";
9480
+ } catch {
9481
+ return "pnpm";
9482
+ }
9483
+ }
9467
9484
  function getNpmFunctions({ config }) {
9468
9485
  return {
9469
9486
  async getQwikPackages() {
@@ -9480,6 +9497,28 @@ function getNpmFunctions({ config }) {
9480
9497
  } catch (error) {
9481
9498
  return [];
9482
9499
  }
9500
+ },
9501
+ async installPackage(packageName, isDev = true) {
9502
+ try {
9503
+ const projectRoot = require$$0__default$1.dirname(config.configFileDependencies[0]);
9504
+ const pm = await detectPackageManager(projectRoot);
9505
+ const devFlag = isDev ? pm === "npm" ? "--save-dev" : "-D" : "";
9506
+ const command = {
9507
+ npm: `npm install ${devFlag} ${packageName}`,
9508
+ pnpm: `pnpm add ${devFlag} ${packageName}`,
9509
+ yarn: `yarn add ${devFlag} ${packageName}`
9510
+ }[pm];
9511
+ child_process.execSync(command, {
9512
+ cwd: projectRoot,
9513
+ stdio: "pipe"
9514
+ });
9515
+ return { success: true };
9516
+ } catch (error) {
9517
+ return {
9518
+ success: false,
9519
+ error: error instanceof Error ? error.message : "Unknown error occurred"
9520
+ };
9521
+ }
9483
9522
  }
9484
9523
  };
9485
9524
  }
@@ -10,6 +10,7 @@ import { resolve as resolve$1, relative as relative$1, basename, extname } from
10
10
  import { homedir } from 'node:os';
11
11
  import { createHash } from 'node:crypto';
12
12
  import 'node:fs';
13
+ import { execSync } from 'child_process';
13
14
 
14
15
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
15
16
 
@@ -9452,6 +9453,22 @@ function getRouteFunctions({ config }) {
9452
9453
  };
9453
9454
  }
9454
9455
 
9456
+ async function detectPackageManager(projectRoot) {
9457
+ try {
9458
+ if (await fsp.access(require$$0$1.join(projectRoot, "pnpm-lock.yaml")).then(() => true).catch(() => false)) {
9459
+ return "pnpm";
9460
+ }
9461
+ if (await fsp.access(require$$0$1.join(projectRoot, "yarn.lock")).then(() => true).catch(() => false)) {
9462
+ return "yarn";
9463
+ }
9464
+ if (await fsp.access(require$$0$1.join(projectRoot, "package-lock.json")).then(() => true).catch(() => false)) {
9465
+ return "npm";
9466
+ }
9467
+ return "pnpm";
9468
+ } catch {
9469
+ return "pnpm";
9470
+ }
9471
+ }
9455
9472
  function getNpmFunctions({ config }) {
9456
9473
  return {
9457
9474
  async getQwikPackages() {
@@ -9468,6 +9485,28 @@ function getNpmFunctions({ config }) {
9468
9485
  } catch (error) {
9469
9486
  return [];
9470
9487
  }
9488
+ },
9489
+ async installPackage(packageName, isDev = true) {
9490
+ try {
9491
+ const projectRoot = require$$0$1.dirname(config.configFileDependencies[0]);
9492
+ const pm = await detectPackageManager(projectRoot);
9493
+ const devFlag = isDev ? pm === "npm" ? "--save-dev" : "-D" : "";
9494
+ const command = {
9495
+ npm: `npm install ${devFlag} ${packageName}`,
9496
+ pnpm: `pnpm add ${devFlag} ${packageName}`,
9497
+ yarn: `yarn add ${devFlag} ${packageName}`
9498
+ }[pm];
9499
+ execSync(command, {
9500
+ cwd: projectRoot,
9501
+ stdio: "pipe"
9502
+ });
9503
+ return { success: true };
9504
+ } catch (error) {
9505
+ return {
9506
+ success: false,
9507
+ error: error instanceof Error ? error.message : "Unknown error occurred"
9508
+ };
9509
+ }
9471
9510
  }
9472
9511
  };
9473
9512
  }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const DevtoolsButton = core.component$(({ state }) => {
6
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
7
+ class: {
8
+ "fixed bottom-4 right-4 flex h-9 w-9 origin-center cursor-pointer items-center justify-center rounded-lg border border-white/10 bg-zinc-900 backdrop-blur-md transition-all duration-300 ease-in-out": true,
9
+ "rotate-90 border-emerald-500/50 bg-zinc-900/95 shadow-lg shadow-emerald-500/35": state.isOpen
10
+ },
11
+ onClick$: () => state.isOpen = !state.isOpen,
12
+ children: /* @__PURE__ */ jsxRuntime.jsx("img", {
13
+ width: 20,
14
+ height: 20,
15
+ src: "https://qwik.dev/logos/qwik-logo.svg",
16
+ alt: "Qwik Logo",
17
+ class: "h-5 w-5 opacity-90 drop-shadow-md transition-all duration-300 ease-in-out hover:scale-110 hover:opacity-100"
18
+ })
19
+ });
20
+ });
21
+ exports.DevtoolsButton = DevtoolsButton;
@@ -0,0 +1,21 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$ } from "@qwik.dev/core";
3
+ const DevtoolsButton = component$(({ state }) => {
4
+ return /* @__PURE__ */ jsx("div", {
5
+ class: {
6
+ "fixed bottom-4 right-4 flex h-9 w-9 origin-center cursor-pointer items-center justify-center rounded-lg border border-white/10 bg-zinc-900 backdrop-blur-md transition-all duration-300 ease-in-out": true,
7
+ "rotate-90 border-emerald-500/50 bg-zinc-900/95 shadow-lg shadow-emerald-500/35": state.isOpen
8
+ },
9
+ onClick$: () => state.isOpen = !state.isOpen,
10
+ children: /* @__PURE__ */ jsx("img", {
11
+ width: 20,
12
+ height: 20,
13
+ src: "https://qwik.dev/logos/qwik-logo.svg",
14
+ alt: "Qwik Logo",
15
+ class: "h-5 w-5 opacity-90 drop-shadow-md transition-all duration-300 ease-in-out hover:scale-110 hover:opacity-100"
16
+ })
17
+ });
18
+ });
19
+ export {
20
+ DevtoolsButton
21
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const DevtoolsContainer = core.component$(() => {
6
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
7
+ class: "fixed bottom-0 right-0 z-[9999] font-sans",
8
+ "q:slot": "content",
9
+ children: /* @__PURE__ */ jsxRuntime.jsx(core.Slot, {})
10
+ });
11
+ });
12
+ exports.DevtoolsContainer = DevtoolsContainer;
@@ -0,0 +1,12 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, Slot } from "@qwik.dev/core";
3
+ const DevtoolsContainer = component$(() => {
4
+ return /* @__PURE__ */ jsx("div", {
5
+ class: "fixed bottom-0 right-0 z-[9999] font-sans",
6
+ "q:slot": "content",
7
+ children: /* @__PURE__ */ jsx(Slot, {})
8
+ });
9
+ });
10
+ export {
11
+ DevtoolsContainer
12
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const DevtoolsPanel = core.component$(({ state }) => {
6
+ const panelRef = core.useSignal();
7
+ core.useTask$(({ cleanup }) => {
8
+ const handleKeyPress = (e) => {
9
+ if (e.key === "`" && e.metaKey) {
10
+ state.isOpen = !state.isOpen;
11
+ }
12
+ if (e.key === "Escape" && state.isOpen) {
13
+ state.isOpen = false;
14
+ }
15
+ };
16
+ const handleClickOutside = (e) => {
17
+ if (state.isOpen && panelRef.value && !panelRef.value.contains(e.target)) {
18
+ state.isOpen = false;
19
+ }
20
+ };
21
+ window.addEventListener("keydown", handleKeyPress);
22
+ window.addEventListener("mousedown", handleClickOutside);
23
+ cleanup(() => {
24
+ window.removeEventListener("keydown", handleKeyPress);
25
+ window.removeEventListener("mousedown", handleClickOutside);
26
+ });
27
+ });
28
+ return /* @__PURE__ */ jsxRuntime.jsx("div", {
29
+ ref: panelRef,
30
+ class: "fixed bottom-8 right-6 flex h-[50vh] w-full translate-y-0 transform overflow-hidden rounded-lg border-2 border-white/10 bg-zinc-900 text-white backdrop-blur-lg transition-transform duration-300 ease-in-out md:w-3/5",
31
+ children: /* @__PURE__ */ jsxRuntime.jsx(core.Slot, {})
32
+ });
33
+ });
34
+ exports.DevtoolsPanel = DevtoolsPanel;
@@ -0,0 +1,34 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, useSignal, useTask$, Slot } from "@qwik.dev/core";
3
+ const DevtoolsPanel = component$(({ state }) => {
4
+ const panelRef = useSignal();
5
+ useTask$(({ cleanup }) => {
6
+ const handleKeyPress = (e) => {
7
+ if (e.key === "`" && e.metaKey) {
8
+ state.isOpen = !state.isOpen;
9
+ }
10
+ if (e.key === "Escape" && state.isOpen) {
11
+ state.isOpen = false;
12
+ }
13
+ };
14
+ const handleClickOutside = (e) => {
15
+ if (state.isOpen && panelRef.value && !panelRef.value.contains(e.target)) {
16
+ state.isOpen = false;
17
+ }
18
+ };
19
+ window.addEventListener("keydown", handleKeyPress);
20
+ window.addEventListener("mousedown", handleClickOutside);
21
+ cleanup(() => {
22
+ window.removeEventListener("keydown", handleKeyPress);
23
+ window.removeEventListener("mousedown", handleClickOutside);
24
+ });
25
+ });
26
+ return /* @__PURE__ */ jsx("div", {
27
+ ref: panelRef,
28
+ class: "fixed bottom-8 right-6 flex h-[50vh] w-full translate-y-0 transform overflow-hidden rounded-lg border-2 border-white/10 bg-zinc-900 text-white backdrop-blur-lg transition-transform duration-300 ease-in-out md:w-3/5",
29
+ children: /* @__PURE__ */ jsx(Slot, {})
30
+ });
31
+ });
32
+ export {
33
+ DevtoolsPanel
34
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const Tab = core.component$(({ state, id, title }) => {
6
+ return /* @__PURE__ */ jsxRuntime.jsx("button", {
7
+ onClick$: () => state.activeTab = id,
8
+ title,
9
+ class: {
10
+ "flex h-10 w-10 items-center justify-center rounded-lg p-2.5 transition-all duration-200": true,
11
+ "bg-white/5 text-zinc-400 hover:bg-white/10 hover:text-white": state.activeTab !== id,
12
+ "bg-emerald-500 text-white shadow-lg shadow-emerald-500/35": state.activeTab === id
13
+ },
14
+ children: /* @__PURE__ */ jsxRuntime.jsx(core.Slot, {})
15
+ });
16
+ });
17
+ exports.Tab = Tab;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, Slot } from "@qwik.dev/core";
3
+ const Tab = component$(({ state, id, title }) => {
4
+ return /* @__PURE__ */ jsx("button", {
5
+ onClick$: () => state.activeTab = id,
6
+ title,
7
+ class: {
8
+ "flex h-10 w-10 items-center justify-center rounded-lg p-2.5 transition-all duration-200": true,
9
+ "bg-white/5 text-zinc-400 hover:bg-white/10 hover:text-white": state.activeTab !== id,
10
+ "bg-emerald-500 text-white shadow-lg shadow-emerald-500/35": state.activeTab === id
11
+ },
12
+ children: /* @__PURE__ */ jsx(Slot, {})
13
+ });
14
+ });
15
+ export {
16
+ Tab
17
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const TabContent = core.component$(() => {
6
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
7
+ class: "space-y-6",
8
+ children: [
9
+ /* @__PURE__ */ jsxRuntime.jsx("div", {
10
+ class: "flex items-center justify-between border-b border-zinc-700 pb-4",
11
+ children: /* @__PURE__ */ jsxRuntime.jsx(core.Slot, {
12
+ name: "title"
13
+ })
14
+ }),
15
+ /* @__PURE__ */ jsxRuntime.jsx(core.Slot, {
16
+ name: "content"
17
+ })
18
+ ]
19
+ });
20
+ });
21
+ exports.TabContent = TabContent;
@@ -0,0 +1,21 @@
1
+ import { jsxs, jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$, Slot } from "@qwik.dev/core";
3
+ const TabContent = component$(() => {
4
+ return /* @__PURE__ */ jsxs("div", {
5
+ class: "space-y-6",
6
+ children: [
7
+ /* @__PURE__ */ jsx("div", {
8
+ class: "flex items-center justify-between border-b border-zinc-700 pb-4",
9
+ children: /* @__PURE__ */ jsx(Slot, {
10
+ name: "title"
11
+ })
12
+ }),
13
+ /* @__PURE__ */ jsx(Slot, {
14
+ name: "content"
15
+ })
16
+ ]
17
+ });
18
+ });
19
+ export {
20
+ TabContent
21
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
4
+ const core = require("@qwik.dev/core");
5
+ const TabTitle = core.component$(({ title }) => {
6
+ return /* @__PURE__ */ jsxRuntime.jsx("h3", {
7
+ class: "text-xl font-semibold",
8
+ children: title
9
+ });
10
+ });
11
+ exports.TabTitle = TabTitle;
@@ -0,0 +1,11 @@
1
+ import { jsx } from "@qwik.dev/core/jsx-runtime";
2
+ import { component$ } from "@qwik.dev/core";
3
+ const TabTitle = component$(({ title }) => {
4
+ return /* @__PURE__ */ jsx("h3", {
5
+ class: "text-xl font-semibold",
6
+ children: title
7
+ });
8
+ });
9
+ export {
10
+ TabTitle
11
+ };