@qwik.dev/devtools 0.0.2 → 0.0.3
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/lib/devtools.css.qwik.cjs +3 -0
- package/lib/devtools.css.qwik.mjs +4 -0
- package/lib/devtools.qwik.cjs +538 -0
- package/lib/devtools.qwik.mjs +538 -0
- package/lib/index.qwik.cjs +2 -0
- package/lib/index.qwik.mjs +2 -0
- package/lib/kit/client.qwik.cjs +18 -0
- package/lib/kit/client.qwik.mjs +18 -0
- package/lib/kit/context.qwik.cjs +16 -0
- package/lib/kit/context.qwik.mjs +17 -1
- package/lib/kit/globals.qwik.cjs +4 -0
- package/lib/kit/globals.qwik.mjs +4 -0
- package/lib/plugin/index.qwik.cjs +2 -2
- package/lib/plugin/index.qwik.mjs +2 -2
- package/lib/utils/location.qwik.cjs +9 -0
- package/lib/utils/location.qwik.mjs +9 -0
- package/lib-types/index.d.ts +1 -0
- package/lib-types/utils/location.d.ts +1 -0
- package/package.json +1 -5
- package/src/devtools.tsx +3 -10
- package/src/index.ts +1 -0
- package/src/plugin/index.ts +2 -2
- package/src/utils/location.ts +9 -0
|
@@ -18,8 +18,8 @@ function qwikDevtools() {
|
|
|
18
18
|
order: "pre",
|
|
19
19
|
handler(code, id) {
|
|
20
20
|
if (id.endsWith("root.tsx")) {
|
|
21
|
-
if (!code.includes("@qwik.dev/devtools
|
|
22
|
-
code = `import { QwikDevtools } from '@qwik.dev/devtools
|
|
21
|
+
if (!code.includes("@qwik.dev/devtools")) {
|
|
22
|
+
code = `import { QwikDevtools } from '@qwik.dev/devtools';
|
|
23
23
|
${code}`;
|
|
24
24
|
}
|
|
25
25
|
const match = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
|
|
@@ -16,8 +16,8 @@ function qwikDevtools() {
|
|
|
16
16
|
order: "pre",
|
|
17
17
|
handler(code, id) {
|
|
18
18
|
if (id.endsWith("root.tsx")) {
|
|
19
|
-
if (!code.includes("@qwik.dev/devtools
|
|
20
|
-
code = `import { QwikDevtools } from '@qwik.dev/devtools
|
|
19
|
+
if (!code.includes("@qwik.dev/devtools")) {
|
|
20
|
+
code = `import { QwikDevtools } from '@qwik.dev/devtools';
|
|
21
21
|
${code}`;
|
|
22
22
|
}
|
|
23
23
|
const match = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@qwik.dev/core");
|
|
4
|
+
function getCurrentLocation() {
|
|
5
|
+
if (!core.isBrowser) return "";
|
|
6
|
+
if (window.location.pathname === "/") return "/";
|
|
7
|
+
return window.location.pathname.slice(0, -1);
|
|
8
|
+
}
|
|
9
|
+
exports.getCurrentLocation = getCurrentLocation;
|
package/lib-types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCurrentLocation(): string;
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwik.dev/devtools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Qwik devtools package",
|
|
5
5
|
"main": "./lib/index.qwik.mjs",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"import": "./lib/index.qwik.mjs"
|
|
9
|
-
},
|
|
10
|
-
"./component": {
|
|
11
|
-
"import": "./src/devtools.tsx"
|
|
12
9
|
}
|
|
13
10
|
},
|
|
14
11
|
"files": [
|
|
@@ -38,7 +35,6 @@
|
|
|
38
35
|
},
|
|
39
36
|
"peerDependencies": {
|
|
40
37
|
"@qwik.dev/core": "^2.0.0-alpha.4",
|
|
41
|
-
"@qwik.dev/router": "^2.0.0-alpha.4",
|
|
42
38
|
"vite": "^6.0.0"
|
|
43
39
|
},
|
|
44
40
|
"dependencies": {
|
package/src/devtools.tsx
CHANGED
|
@@ -23,8 +23,8 @@ import {
|
|
|
23
23
|
type RoutesInfo,
|
|
24
24
|
RouteType,
|
|
25
25
|
} from './kit';
|
|
26
|
-
// import { useLocation } from '@qwik.dev/router';
|
|
27
26
|
import styles from './devtools.css?inline';
|
|
27
|
+
import { getCurrentLocation } from './utils/location';
|
|
28
28
|
function getClientRpcFunctions() {
|
|
29
29
|
return {
|
|
30
30
|
healthCheck: () => true,
|
|
@@ -49,11 +49,7 @@ export const QwikDevtools = component$(() => {
|
|
|
49
49
|
routes: undefined,
|
|
50
50
|
});
|
|
51
51
|
const panelRef = useSignal<HTMLDivElement>();
|
|
52
|
-
const location =
|
|
53
|
-
url: {
|
|
54
|
-
pathname: '/',
|
|
55
|
-
},
|
|
56
|
-
};
|
|
52
|
+
const location = getCurrentLocation();
|
|
57
53
|
|
|
58
54
|
// eslint-disable-next-line qwik/no-use-visible-task
|
|
59
55
|
useVisibleTask$(async ({ cleanup, track }) => {
|
|
@@ -90,8 +86,6 @@ export const QwikDevtools = component$(() => {
|
|
|
90
86
|
...directories,
|
|
91
87
|
];
|
|
92
88
|
|
|
93
|
-
console.log(values, noSerialize(values));
|
|
94
|
-
|
|
95
89
|
state.routes = noSerialize(values);
|
|
96
90
|
});
|
|
97
91
|
|
|
@@ -377,8 +371,7 @@ export const QwikDevtools = component$(() => {
|
|
|
377
371
|
<div class="col-route">
|
|
378
372
|
<span
|
|
379
373
|
class={
|
|
380
|
-
location
|
|
381
|
-
`/${route.relativePath}/`
|
|
374
|
+
location === `/${route.relativePath}`
|
|
382
375
|
? 'active-route'
|
|
383
376
|
: ''
|
|
384
377
|
}
|
package/src/index.ts
CHANGED
package/src/plugin/index.ts
CHANGED
|
@@ -16,9 +16,9 @@ export function qwikDevtools(): Plugin {
|
|
|
16
16
|
// Only transform the root component file
|
|
17
17
|
if (id.endsWith('root.tsx')) {
|
|
18
18
|
// Check if QwikDevtools import already exists
|
|
19
|
-
if (!code.includes('@qwik.dev/devtools
|
|
19
|
+
if (!code.includes('@qwik.dev/devtools')) {
|
|
20
20
|
// Add import for QwikDevtools using the correct package name
|
|
21
|
-
code = `import { QwikDevtools } from '@qwik.dev/devtools
|
|
21
|
+
code = `import { QwikDevtools } from '@qwik.dev/devtools';\n${code}`;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// Find the closing body tag and inject the QwikDevtools component before it
|