@qwik.dev/devtools 0.0.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 (65) hide show
  1. package/README.md +47 -0
  2. package/lib/index.qwik.cjs +4 -0
  3. package/lib/index.qwik.mjs +4 -0
  4. package/lib/kit/constants.qwik.cjs +4 -0
  5. package/lib/kit/constants.qwik.mjs +4 -0
  6. package/lib/kit/context.qwik.cjs +16 -0
  7. package/lib/kit/context.qwik.mjs +16 -0
  8. package/lib/kit/globals.qwik.cjs +6 -0
  9. package/lib/kit/globals.qwik.mjs +6 -0
  10. package/lib/kit/server.qwik.cjs +18 -0
  11. package/lib/kit/server.qwik.mjs +18 -0
  12. package/lib/kit/shared.qwik.cjs +4 -0
  13. package/lib/kit/shared.qwik.mjs +4 -0
  14. package/lib/plugin/assets/index.qwik.cjs +67 -0
  15. package/lib/plugin/assets/index.qwik.mjs +67 -0
  16. package/lib/plugin/index.qwik.cjs +49 -0
  17. package/lib/plugin/index.qwik.mjs +49 -0
  18. package/lib/plugin/npm/index.qwik.cjs +19 -0
  19. package/lib/plugin/npm/index.qwik.mjs +19 -0
  20. package/lib/plugin/routes/index.qwik.cjs +17 -0
  21. package/lib/plugin/routes/index.qwik.mjs +17 -0
  22. package/lib/plugin/rpc/index.qwik.cjs +14 -0
  23. package/lib/plugin/rpc/index.qwik.mjs +14 -0
  24. package/lib-types/devtools.d.ts +1 -0
  25. package/lib-types/entry.dev.d.ts +2 -0
  26. package/lib-types/entry.ssr.d.ts +2 -0
  27. package/lib-types/index.d.ts +1 -0
  28. package/lib-types/kit/client.d.ts +2 -0
  29. package/lib-types/kit/constants.d.ts +1 -0
  30. package/lib-types/kit/context.d.ts +10 -0
  31. package/lib-types/kit/globals.d.ts +20 -0
  32. package/lib-types/kit/index.d.ts +4 -0
  33. package/lib-types/kit/server.d.ts +2 -0
  34. package/lib-types/kit/shared.d.ts +1 -0
  35. package/lib-types/kit/types.d.ts +33 -0
  36. package/lib-types/plugin/assets/index.d.ts +5 -0
  37. package/lib-types/plugin/components/index.d.ts +0 -0
  38. package/lib-types/plugin/index.d.ts +2 -0
  39. package/lib-types/plugin/npm/index.d.ts +5 -0
  40. package/lib-types/plugin/routes/index.d.ts +5 -0
  41. package/lib-types/plugin/rpc/index.d.ts +3 -0
  42. package/lib-types/plugin/types/index.d.ts +5 -0
  43. package/lib-types/root.d.ts +2 -0
  44. package/package.json +70 -0
  45. package/src/devtools.css +558 -0
  46. package/src/devtools.tsx +411 -0
  47. package/src/entry.dev.tsx +17 -0
  48. package/src/entry.ssr.tsx +25 -0
  49. package/src/index.ts +1 -0
  50. package/src/kit/client.ts +21 -0
  51. package/src/kit/constants.ts +1 -0
  52. package/src/kit/context.ts +42 -0
  53. package/src/kit/globals.ts +22 -0
  54. package/src/kit/index.ts +4 -0
  55. package/src/kit/server.ts +21 -0
  56. package/src/kit/shared.ts +11 -0
  57. package/src/kit/types.ts +48 -0
  58. package/src/plugin/assets/index.ts +126 -0
  59. package/src/plugin/components/index.ts +0 -0
  60. package/src/plugin/index.ts +50 -0
  61. package/src/plugin/npm/index.ts +24 -0
  62. package/src/plugin/routes/index.ts +16 -0
  63. package/src/plugin/rpc/index.ts +14 -0
  64. package/src/plugin/types/index.ts +6 -0
  65. package/src/root.tsx +15 -0
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Qwik Library ⚡️
2
+
3
+ - [Qwik Docs](https://qwik.dev/)
4
+ - [Discord](https://qwik.dev/chat)
5
+ - [Qwik on GitHub](https://github.com/QwikDev/qwik)
6
+ - [@QwikDev](https://twitter.com/QwikDev)
7
+ - [Vite](https://vitejs.dev/)
8
+ - [Partytown](https://partytown.builder.io/)
9
+ - [Mitosis](https://github.com/BuilderIO/mitosis)
10
+ - [Builder.io](https://www.builder.io/)
11
+
12
+ ---
13
+
14
+ ## Project Structure
15
+
16
+ Inside your project, you'll see the following directories and files:
17
+
18
+ ```
19
+ ├── public/
20
+ │ └── ...
21
+ └── src/
22
+ ├── components/
23
+ │ └── ...
24
+ └── index.ts
25
+ ```
26
+
27
+ - `src/components`: Recommended directory for components.
28
+
29
+ - `index.ts`: The entry point of your component library, make sure all the public components are exported from this file.
30
+
31
+ ## Development
32
+
33
+ Development mode uses [Vite's development server](https://vitejs.dev/). For Qwik during development, the `dev` command will also server-side render (SSR) the output. The client-side development modules are loaded by the browser.
34
+
35
+ ```
36
+ pnpm dev
37
+ ```
38
+
39
+ > Note: during dev mode, Vite will request many JS files, which does not represent a Qwik production build.
40
+
41
+ ## Production
42
+
43
+ The production build should generate the production build of your component library in (./lib) and the typescript type definitions in (./lib-types).
44
+
45
+ ```
46
+ pnpm build
47
+ ```
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("./plugin/index.qwik.cjs");
4
+ exports.qwikDevtools = index.qwikDevtools;
@@ -0,0 +1,4 @@
1
+ import { qwikDevtools } from "./plugin/index.qwik.mjs";
2
+ export {
3
+ qwikDevtools
4
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const DEVTOOLS_VITE_MESSAGING_EVENT = "qwik_tools:vite_messaging_event";
4
+ exports.DEVTOOLS_VITE_MESSAGING_EVENT = DEVTOOLS_VITE_MESSAGING_EVENT;
@@ -0,0 +1,4 @@
1
+ const DEVTOOLS_VITE_MESSAGING_EVENT = "qwik_tools:vite_messaging_event";
2
+ export {
3
+ DEVTOOLS_VITE_MESSAGING_EVENT
4
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const shared = require("./shared.qwik.cjs");
4
+ const globals = require("./globals.qwik.cjs");
5
+ function getViteServerContext() {
6
+ return shared.target[globals.SERVER_CTX];
7
+ }
8
+ function setViteServerContext(ctx) {
9
+ shared.target[globals.SERVER_CTX] = ctx;
10
+ }
11
+ function setViteServerRpc(rpc) {
12
+ shared.target[globals.SERVER_RPC] = rpc;
13
+ }
14
+ exports.getViteServerContext = getViteServerContext;
15
+ exports.setViteServerContext = setViteServerContext;
16
+ exports.setViteServerRpc = setViteServerRpc;
@@ -0,0 +1,16 @@
1
+ import { target } from "./shared.qwik.mjs";
2
+ import { SERVER_CTX, SERVER_RPC } from "./globals.qwik.mjs";
3
+ function getViteServerContext() {
4
+ return target[SERVER_CTX];
5
+ }
6
+ function setViteServerContext(ctx) {
7
+ target[SERVER_CTX] = ctx;
8
+ }
9
+ function setViteServerRpc(rpc) {
10
+ target[SERVER_RPC] = rpc;
11
+ }
12
+ export {
13
+ getViteServerContext,
14
+ setViteServerContext,
15
+ setViteServerRpc
16
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const SERVER_CTX = "__qwik_server_ctx__";
4
+ const SERVER_RPC = "__qwik_server_rpc__";
5
+ exports.SERVER_CTX = SERVER_CTX;
6
+ exports.SERVER_RPC = SERVER_RPC;
@@ -0,0 +1,6 @@
1
+ const SERVER_CTX = "__qwik_server_ctx__";
2
+ const SERVER_RPC = "__qwik_server_rpc__";
3
+ export {
4
+ SERVER_CTX,
5
+ SERVER_RPC
6
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const SuperJSON = require("superjson");
4
+ const birpc = require("birpc");
5
+ const constants = require("./constants.qwik.cjs");
6
+ const context = require("./context.qwik.cjs");
7
+ function createServerRpc(functions) {
8
+ const server = context.getViteServerContext();
9
+ const rpc = birpc.createBirpc(functions, {
10
+ post: (data) => server.ws.send(constants.DEVTOOLS_VITE_MESSAGING_EVENT, SuperJSON.stringify(data)),
11
+ on: (fn) => server.ws.on(constants.DEVTOOLS_VITE_MESSAGING_EVENT, (data) => {
12
+ fn(SuperJSON.parse(data));
13
+ }),
14
+ timeout: 12e4
15
+ });
16
+ context.setViteServerRpc(rpc);
17
+ }
18
+ exports.createServerRpc = createServerRpc;
@@ -0,0 +1,18 @@
1
+ import SuperJSON from "superjson";
2
+ import { createBirpc } from "birpc";
3
+ import { DEVTOOLS_VITE_MESSAGING_EVENT } from "./constants.qwik.mjs";
4
+ import { setViteServerRpc, getViteServerContext } from "./context.qwik.mjs";
5
+ function createServerRpc(functions) {
6
+ const server = getViteServerContext();
7
+ const rpc = createBirpc(functions, {
8
+ post: (data) => server.ws.send(DEVTOOLS_VITE_MESSAGING_EVENT, SuperJSON.stringify(data)),
9
+ on: (fn) => server.ws.on(DEVTOOLS_VITE_MESSAGING_EVENT, (data) => {
10
+ fn(SuperJSON.parse(data));
11
+ }),
12
+ timeout: 12e4
13
+ });
14
+ setViteServerRpc(rpc);
15
+ }
16
+ export {
17
+ createServerRpc
18
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const target = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : {};
4
+ exports.target = target;
@@ -0,0 +1,4 @@
1
+ const target = typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : {};
2
+ export {
3
+ target
4
+ };
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fsp = require("node:fs/promises");
4
+ const fg = require("fast-glob");
5
+ const posix = require("node:path/posix");
6
+ function getAssetsFunctions({ config }) {
7
+ let cache = null;
8
+ async function getAssetsFromPublicDir() {
9
+ const dir = posix.resolve(config.root);
10
+ const baseURL = config.base;
11
+ const publicDir = config.publicDir;
12
+ const relativePublicDir = publicDir === "" ? "" : `${posix.relative(dir, publicDir)}/`;
13
+ const files = await fg([
14
+ // image
15
+ "**/*.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff)",
16
+ // video
17
+ "**/*.(mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)",
18
+ // audio
19
+ "**/*.(mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)",
20
+ // font
21
+ "**/*.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)",
22
+ // text
23
+ "**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown|yaml|yml|toml)",
24
+ // wasm
25
+ "**/*.wasm"
26
+ ], {
27
+ cwd: publicDir,
28
+ onlyFiles: true,
29
+ caseSensitiveMatch: false,
30
+ ignore: [
31
+ "**/node_modules/**",
32
+ "**/dist/**",
33
+ "**/package-lock.*",
34
+ "**/pnpm-lock.*",
35
+ "**/pnpm-workspace.*"
36
+ ]
37
+ });
38
+ cache = await Promise.all(files.map(async (relativePath) => {
39
+ const filePath = posix.resolve(publicDir, relativePath);
40
+ const stat = await fsp.lstat(filePath);
41
+ const path = relativePath.replace(relativePublicDir, "");
42
+ return {
43
+ path,
44
+ relativePath,
45
+ publicPath: posix.join(baseURL, path),
46
+ filePath,
47
+ type: guessType(relativePath),
48
+ size: stat.size,
49
+ mtime: stat.mtimeMs
50
+ };
51
+ }));
52
+ return cache;
53
+ }
54
+ return {
55
+ getAssetsFromPublicDir
56
+ };
57
+ }
58
+ function guessType(path) {
59
+ if (/\.(?:png|jpe?g|jxl|gif|svg|webp|avif|ico|bmp|tiff?)$/i.test(path)) return "image";
60
+ if (/\.(?:mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|ts|mts|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)$/i.test(path)) return "video";
61
+ if (/\.(?:mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)$/i.test(path)) return "audio";
62
+ if (/\.(?:woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)/i.test(path)) return "font";
63
+ if (/\.(?:json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown|ya?ml|toml)/i.test(path)) return "text";
64
+ if (/\.wasm/i.test(path)) return "wasm";
65
+ return "other";
66
+ }
67
+ exports.getAssetsFunctions = getAssetsFunctions;
@@ -0,0 +1,67 @@
1
+ import fsp from "node:fs/promises";
2
+ import fg from "fast-glob";
3
+ import { resolve, relative, join } from "node:path/posix";
4
+ function getAssetsFunctions({ config }) {
5
+ let cache = null;
6
+ async function getAssetsFromPublicDir() {
7
+ const dir = resolve(config.root);
8
+ const baseURL = config.base;
9
+ const publicDir = config.publicDir;
10
+ const relativePublicDir = publicDir === "" ? "" : `${relative(dir, publicDir)}/`;
11
+ const files = await fg([
12
+ // image
13
+ "**/*.(png|jpg|jpeg|gif|svg|webp|avif|ico|bmp|tiff)",
14
+ // video
15
+ "**/*.(mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)",
16
+ // audio
17
+ "**/*.(mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)",
18
+ // font
19
+ "**/*.(woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)",
20
+ // text
21
+ "**/*.(json|json5|jsonc|txt|text|tsx|jsx|md|mdx|mdc|markdown|yaml|yml|toml)",
22
+ // wasm
23
+ "**/*.wasm"
24
+ ], {
25
+ cwd: publicDir,
26
+ onlyFiles: true,
27
+ caseSensitiveMatch: false,
28
+ ignore: [
29
+ "**/node_modules/**",
30
+ "**/dist/**",
31
+ "**/package-lock.*",
32
+ "**/pnpm-lock.*",
33
+ "**/pnpm-workspace.*"
34
+ ]
35
+ });
36
+ cache = await Promise.all(files.map(async (relativePath) => {
37
+ const filePath = resolve(publicDir, relativePath);
38
+ const stat = await fsp.lstat(filePath);
39
+ const path = relativePath.replace(relativePublicDir, "");
40
+ return {
41
+ path,
42
+ relativePath,
43
+ publicPath: join(baseURL, path),
44
+ filePath,
45
+ type: guessType(relativePath),
46
+ size: stat.size,
47
+ mtime: stat.mtimeMs
48
+ };
49
+ }));
50
+ return cache;
51
+ }
52
+ return {
53
+ getAssetsFromPublicDir
54
+ };
55
+ }
56
+ function guessType(path) {
57
+ if (/\.(?:png|jpe?g|jxl|gif|svg|webp|avif|ico|bmp|tiff?)$/i.test(path)) return "image";
58
+ if (/\.(?:mp4|webm|ogv|mov|avi|flv|wmv|mpg|mpeg|mkv|3gp|3g2|ts|mts|m2ts|vob|ogm|ogx|rm|rmvb|asf|amv|divx|m4v|svi|viv|f4v|f4p|f4a|f4b)$/i.test(path)) return "video";
59
+ if (/\.(?:mp3|wav|ogg|flac|aac|wma|alac|ape|ac3|dts|tta|opus|amr|aiff|au|mid|midi|ra|rm|wv|weba|dss|spx|vox|tak|dsf|dff|dsd|cda)$/i.test(path)) return "audio";
60
+ if (/\.(?:woff2?|eot|ttf|otf|ttc|pfa|pfb|pfm|afm)/i.test(path)) return "font";
61
+ if (/\.(?:json[5c]?|te?xt|[mc]?[jt]sx?|md[cx]?|markdown|ya?ml|toml)/i.test(path)) return "text";
62
+ if (/\.wasm/i.test(path)) return "wasm";
63
+ return "other";
64
+ }
65
+ export {
66
+ getAssetsFunctions
67
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("./rpc/index.qwik.cjs");
4
+ require("superjson");
5
+ require("birpc");
6
+ const context = require("../kit/context.qwik.cjs");
7
+ const server = require("../kit/server.qwik.cjs");
8
+ require("dree");
9
+ function qwikDevtools() {
10
+ let _config;
11
+ return {
12
+ name: "vite-plugin-qwik-devtools",
13
+ apply: "serve",
14
+ configResolved(viteConfig) {
15
+ _config = viteConfig;
16
+ },
17
+ transform: {
18
+ order: "pre",
19
+ handler(code, id) {
20
+ if (id.endsWith("root.tsx")) {
21
+ if (!code.includes("@qwik.dev/devtools/component")) {
22
+ code = `import { QwikDevtools } from '@qwik.dev/devtools/component';
23
+ ${code}`;
24
+ }
25
+ const match = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
26
+ if (match) {
27
+ const bodyContent = match[1];
28
+ const newBodyContent = bodyContent.replace(/{!isDev && <ServiceWorkerRegister \/>}/, `{!isDev && <ServiceWorkerRegister />}
29
+ {isDev && <QwikDevtools />}`);
30
+ code = code.replace(bodyContent, newBodyContent);
31
+ }
32
+ return {
33
+ code,
34
+ map: null
35
+ };
36
+ }
37
+ }
38
+ },
39
+ configureServer(server$1) {
40
+ context.setViteServerContext(server$1);
41
+ const rpcFunctions = index.getServerFunctions({
42
+ server: server$1,
43
+ config: _config
44
+ });
45
+ server.createServerRpc(rpcFunctions);
46
+ }
47
+ };
48
+ }
49
+ exports.qwikDevtools = qwikDevtools;
@@ -0,0 +1,49 @@
1
+ import { getServerFunctions } from "./rpc/index.qwik.mjs";
2
+ import "superjson";
3
+ import "birpc";
4
+ import { setViteServerContext } from "../kit/context.qwik.mjs";
5
+ import { createServerRpc } from "../kit/server.qwik.mjs";
6
+ import "dree";
7
+ function qwikDevtools() {
8
+ let _config;
9
+ return {
10
+ name: "vite-plugin-qwik-devtools",
11
+ apply: "serve",
12
+ configResolved(viteConfig) {
13
+ _config = viteConfig;
14
+ },
15
+ transform: {
16
+ order: "pre",
17
+ handler(code, id) {
18
+ if (id.endsWith("root.tsx")) {
19
+ if (!code.includes("@qwik.dev/devtools/component")) {
20
+ code = `import { QwikDevtools } from '@qwik.dev/devtools/component';
21
+ ${code}`;
22
+ }
23
+ const match = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
24
+ if (match) {
25
+ const bodyContent = match[1];
26
+ const newBodyContent = bodyContent.replace(/{!isDev && <ServiceWorkerRegister \/>}/, `{!isDev && <ServiceWorkerRegister />}
27
+ {isDev && <QwikDevtools />}`);
28
+ code = code.replace(bodyContent, newBodyContent);
29
+ }
30
+ return {
31
+ code,
32
+ map: null
33
+ };
34
+ }
35
+ }
36
+ },
37
+ configureServer(server) {
38
+ setViteServerContext(server);
39
+ const rpcFunctions = getServerFunctions({
40
+ server,
41
+ config: _config
42
+ });
43
+ createServerRpc(rpcFunctions);
44
+ }
45
+ };
46
+ }
47
+ export {
48
+ qwikDevtools
49
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const fsp = require("node:fs/promises");
4
+ function getNpmFunctions({ config }) {
5
+ return {
6
+ async getQwikPackages() {
7
+ const pathToPackageJson = config.configFileDependencies.find((file) => file.endsWith("package.json"));
8
+ if (!pathToPackageJson) return [];
9
+ try {
10
+ const pkgJson = await fsp.readFile(pathToPackageJson, "utf-8");
11
+ const pkg = JSON.parse(pkgJson);
12
+ return Object.entries(pkg.devDependencies).filter(([key]) => /@qwik/i.test(key));
13
+ } catch (error) {
14
+ return [];
15
+ }
16
+ }
17
+ };
18
+ }
19
+ exports.getNpmFunctions = getNpmFunctions;
@@ -0,0 +1,19 @@
1
+ import fsp from "node:fs/promises";
2
+ function getNpmFunctions({ config }) {
3
+ return {
4
+ async getQwikPackages() {
5
+ const pathToPackageJson = config.configFileDependencies.find((file) => file.endsWith("package.json"));
6
+ if (!pathToPackageJson) return [];
7
+ try {
8
+ const pkgJson = await fsp.readFile(pathToPackageJson, "utf-8");
9
+ const pkg = JSON.parse(pkgJson);
10
+ return Object.entries(pkg.devDependencies).filter(([key]) => /@qwik/i.test(key));
11
+ } catch (error) {
12
+ return [];
13
+ }
14
+ }
15
+ };
16
+ }
17
+ export {
18
+ getNpmFunctions
19
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const dree = require("dree");
4
+ function getRouteFunctions({ config }) {
5
+ const routesDir = `${config.root}/src/routes`;
6
+ return {
7
+ getRoutes: async () => {
8
+ const routes = await dree.scanAsync(routesDir, {
9
+ extensions: [
10
+ "tsx"
11
+ ]
12
+ });
13
+ return routes;
14
+ }
15
+ };
16
+ }
17
+ exports.getRouteFunctions = getRouteFunctions;
@@ -0,0 +1,17 @@
1
+ import { scanAsync } from "dree";
2
+ function getRouteFunctions({ config }) {
3
+ const routesDir = `${config.root}/src/routes`;
4
+ return {
5
+ getRoutes: async () => {
6
+ const routes = await scanAsync(routesDir, {
7
+ extensions: [
8
+ "tsx"
9
+ ]
10
+ });
11
+ return routes;
12
+ }
13
+ };
14
+ }
15
+ export {
16
+ getRouteFunctions
17
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("../assets/index.qwik.cjs");
4
+ const index$1 = require("../routes/index.qwik.cjs");
5
+ const index$2 = require("../npm/index.qwik.cjs");
6
+ function getServerFunctions(ctx) {
7
+ return {
8
+ healthCheck: () => true,
9
+ ...index.getAssetsFunctions(ctx),
10
+ ...index$1.getRouteFunctions(ctx),
11
+ ...index$2.getNpmFunctions(ctx)
12
+ };
13
+ }
14
+ exports.getServerFunctions = getServerFunctions;
@@ -0,0 +1,14 @@
1
+ import { getAssetsFunctions } from "../assets/index.qwik.mjs";
2
+ import { getRouteFunctions } from "../routes/index.qwik.mjs";
3
+ import { getNpmFunctions } from "../npm/index.qwik.mjs";
4
+ function getServerFunctions(ctx) {
5
+ return {
6
+ healthCheck: () => true,
7
+ ...getAssetsFunctions(ctx),
8
+ ...getRouteFunctions(ctx),
9
+ ...getNpmFunctions(ctx)
10
+ };
11
+ }
12
+ export {
13
+ getServerFunctions
14
+ };
@@ -0,0 +1 @@
1
+ export declare const QwikDevtools: import("@qwik.dev/core").Component<unknown>;
@@ -0,0 +1,2 @@
1
+ import { type RenderOptions } from "@qwik.dev/core";
2
+ export default function (opts: RenderOptions): any;
@@ -0,0 +1,2 @@
1
+ import { type RenderToStreamOptions } from "@qwik.dev/core/server";
2
+ export default function (opts: RenderToStreamOptions): Promise<import("@qwik.dev/core/server").RenderToStreamResult>;
@@ -0,0 +1 @@
1
+ export { qwikDevtools } from './plugin';
@@ -0,0 +1,2 @@
1
+ import { ClientFunctions } from './types';
2
+ export declare function createClientRpc(functions: ClientFunctions): void;
@@ -0,0 +1 @@
1
+ export declare const DEVTOOLS_VITE_MESSAGING_EVENT = "qwik_tools:vite_messaging_event";
@@ -0,0 +1,10 @@
1
+ import { ViteClientContext, ViteServerContext } from './globals';
2
+ import { ServerRpc, ClientRpc } from './types';
3
+ export declare function getViteClientContext(): ViteClientContext;
4
+ export declare function setViteClientContext(ctx: ViteClientContext): void;
5
+ export declare function getViteServerContext(): import("vite").ViteDevServer;
6
+ export declare function setViteServerContext(ctx: ViteServerContext): void;
7
+ export declare function getViteServerRpc(): ServerRpc;
8
+ export declare function setViteServerRpc(rpc: ServerRpc): void;
9
+ export declare function getViteClientRpc(): ClientRpc;
10
+ export declare function setViteClientRpc(rpc: ClientRpc): void;
@@ -0,0 +1,20 @@
1
+ import { ViteDevServer } from 'vite';
2
+ import { ClientRpc, ServerRpc } from './types';
3
+ interface EventEmitter {
4
+ on: (name: string, handler: (data: any) => void) => void;
5
+ send: (name: string, ...args: any[]) => void;
6
+ }
7
+ export interface ViteClientContext extends EventEmitter {
8
+ }
9
+ export type ViteServerContext = ViteDevServer;
10
+ export declare const CLIENT_CTX = "__qwik_client_ctx__";
11
+ export declare const SERVER_CTX = "__qwik_server_ctx__";
12
+ export declare const SERVER_RPC = "__qwik_server_rpc__";
13
+ export declare const CLIENT_RPC = "__qwik_client_rpc__";
14
+ declare global {
15
+ var __qwik_client_ctx__: ViteClientContext;
16
+ var __qwik_server_ctx__: ViteServerContext;
17
+ var __qwik_server_rpc__: ServerRpc;
18
+ var __qwik_client_rpc__: ClientRpc;
19
+ }
20
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './client';
2
+ export * from './server';
3
+ export * from './context';
4
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ import { ServerFunctions } from './types';
2
+ export declare function createServerRpc(functions: ServerFunctions): void;
@@ -0,0 +1 @@
1
+ export declare const target: typeof globalThis;
@@ -0,0 +1,33 @@
1
+ import { BirpcReturn } from 'birpc';
2
+ import { type Dree } from 'dree';
3
+ export { Type as RouteType } from 'dree';
4
+ export interface ClientFunctions {
5
+ healthCheck(): boolean;
6
+ }
7
+ export interface ServerFunctions {
8
+ healthCheck(): boolean;
9
+ getAssetsFromPublicDir: () => Promise<AssetInfo[]>;
10
+ getRoutes: () => any;
11
+ getQwikPackages: () => Promise<[string, string][]>;
12
+ }
13
+ export type ServerRpc = BirpcReturn<ClientFunctions, ServerFunctions>;
14
+ export type ClientRpc = BirpcReturn<ServerFunctions, ClientFunctions>;
15
+ export type AssetType = 'image' | 'font' | 'video' | 'audio' | 'text' | 'json' | 'wasm' | 'other';
16
+ export interface AssetInfo {
17
+ path: string;
18
+ type: AssetType;
19
+ publicPath: string;
20
+ relativePath: string;
21
+ filePath: string;
22
+ size: number;
23
+ mtime: number;
24
+ }
25
+ export interface ImageMeta {
26
+ width: number;
27
+ height: number;
28
+ orientation?: number;
29
+ type?: string;
30
+ mimeType?: string;
31
+ }
32
+ export type RoutesInfo = Dree;
33
+ export type NpmInfo = [string, string][];
@@ -0,0 +1,5 @@
1
+ import { ServerContext } from '../types';
2
+ import { AssetInfo } from '../../kit/types';
3
+ export declare function getAssetsFunctions({ config }: ServerContext): {
4
+ getAssetsFromPublicDir: () => Promise<AssetInfo[]>;
5
+ };
File without changes
@@ -0,0 +1,2 @@
1
+ import { type Plugin } from 'vite';
2
+ export declare function qwikDevtools(): Plugin;
@@ -0,0 +1,5 @@
1
+ import { ServerContext } from '../types';
2
+ import { NpmInfo } from '../../kit/types';
3
+ export declare function getNpmFunctions({ config }: ServerContext): {
4
+ getQwikPackages(): Promise<NpmInfo>;
5
+ };
@@ -0,0 +1,5 @@
1
+ import { RoutesInfo } from '../../kit/types';
2
+ import { ServerContext } from '../types';
3
+ export declare function getRouteFunctions({ config }: ServerContext): {
4
+ getRoutes: () => Promise<RoutesInfo>;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { ServerFunctions } from '../../kit/types';
2
+ import { ServerContext } from '../types';
3
+ export declare function getServerFunctions(ctx: ServerContext): ServerFunctions;