@qwik.dev/devtools 0.0.3 → 0.0.5

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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -30
  3. package/dist/component/_virtual/_commonjsHelpers.qwik.cjs +6 -0
  4. package/dist/component/_virtual/_commonjsHelpers.qwik.mjs +6 -0
  5. package/{lib → dist/component}/devtools.qwik.cjs +19 -20
  6. package/{lib → dist/component}/devtools.qwik.mjs +11 -12
  7. package/{lib → dist/component}/index.qwik.cjs +0 -2
  8. package/dist/component/index.qwik.mjs +4 -0
  9. package/{lib-types → dist/component/lib-types/devtools/src}/index.d.ts +0 -1
  10. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.cjs +60 -0
  11. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.mjs +60 -0
  12. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.cjs +32 -0
  13. package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.mjs +32 -0
  14. package/dist/component/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.qwik.cjs +54 -0
  15. package/dist/component/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.qwik.mjs +54 -0
  16. package/dist/component/node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.cjs +128 -0
  17. package/dist/component/node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.mjs +128 -0
  18. package/dist/component/node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.qwik.cjs +149 -0
  19. package/dist/component/node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.qwik.mjs +150 -0
  20. package/dist/component/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.qwik.cjs +36 -0
  21. package/dist/component/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.qwik.mjs +36 -0
  22. package/dist/component/node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.cjs +12 -0
  23. package/dist/component/node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.mjs +12 -0
  24. package/dist/component/node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.qwik.cjs +17 -0
  25. package/dist/component/node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.qwik.mjs +17 -0
  26. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.qwik.cjs +12 -0
  27. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.qwik.mjs +12 -0
  28. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.qwik.cjs +513 -0
  29. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.qwik.mjs +513 -0
  30. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.qwik.cjs +110 -0
  31. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.qwik.mjs +110 -0
  32. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.qwik.cjs +6 -0
  33. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.qwik.mjs +6 -0
  34. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.qwik.cjs +738 -0
  35. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.qwik.mjs +738 -0
  36. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.qwik.cjs +6 -0
  37. package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.qwik.mjs +6 -0
  38. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.qwik.cjs +120 -0
  39. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.qwik.mjs +120 -0
  40. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.qwik.cjs +23 -0
  41. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.qwik.mjs +23 -0
  42. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.qwik.cjs +18 -0
  43. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.qwik.mjs +18 -0
  44. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.qwik.cjs +23 -0
  45. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.qwik.mjs +23 -0
  46. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.cjs +91 -0
  47. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.mjs +91 -0
  48. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.qwik.cjs +51 -0
  49. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.qwik.mjs +51 -0
  50. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.qwik.cjs +30 -0
  51. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.qwik.mjs +30 -0
  52. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.qwik.cjs +148 -0
  53. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.qwik.mjs +148 -0
  54. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.qwik.cjs +28 -0
  55. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.qwik.mjs +28 -0
  56. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.qwik.cjs +203 -0
  57. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.qwik.mjs +203 -0
  58. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.qwik.cjs +47 -0
  59. package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.qwik.mjs +47 -0
  60. package/dist/component/node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.cjs +35 -0
  61. package/dist/component/node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.mjs +35 -0
  62. package/{lib/kit → dist/component/packages/kit/src}/client.qwik.cjs +5 -5
  63. package/{lib/kit → dist/component/packages/kit/src}/client.qwik.mjs +2 -2
  64. package/{lib/kit → dist/component/packages/kit/src}/context.qwik.cjs +0 -12
  65. package/{lib/kit → dist/component/packages/kit/src}/context.qwik.mjs +2 -14
  66. package/{lib/kit → dist/component/packages/kit/src}/globals.qwik.cjs +0 -4
  67. package/dist/component/packages/kit/src/globals.qwik.mjs +6 -0
  68. package/dist/plugin/index.cjs +10504 -0
  69. package/dist/plugin/index.mjs +10492 -0
  70. package/package.json +34 -41
  71. package/lib/index.qwik.mjs +0 -6
  72. package/lib/kit/globals.qwik.mjs +0 -10
  73. package/lib/kit/server.qwik.cjs +0 -18
  74. package/lib/kit/server.qwik.mjs +0 -18
  75. package/lib/plugin/assets/index.qwik.cjs +0 -67
  76. package/lib/plugin/assets/index.qwik.mjs +0 -67
  77. package/lib/plugin/index.qwik.cjs +0 -49
  78. package/lib/plugin/index.qwik.mjs +0 -49
  79. package/lib/plugin/npm/index.qwik.cjs +0 -19
  80. package/lib/plugin/npm/index.qwik.mjs +0 -19
  81. package/lib/plugin/routes/index.qwik.cjs +0 -17
  82. package/lib/plugin/routes/index.qwik.mjs +0 -17
  83. package/lib/plugin/rpc/index.qwik.cjs +0 -14
  84. package/lib/plugin/rpc/index.qwik.mjs +0 -14
  85. package/lib/utils/location.qwik.cjs +0 -9
  86. package/lib/utils/location.qwik.mjs +0 -9
  87. package/lib-types/plugin/assets/index.d.ts +0 -5
  88. package/lib-types/plugin/components/index.d.ts +0 -0
  89. package/lib-types/plugin/index.d.ts +0 -2
  90. package/lib-types/plugin/npm/index.d.ts +0 -5
  91. package/lib-types/plugin/routes/index.d.ts +0 -5
  92. package/lib-types/plugin/rpc/index.d.ts +0 -3
  93. package/lib-types/plugin/types/index.d.ts +0 -5
  94. package/src/devtools.css +0 -558
  95. package/src/devtools.tsx +0 -404
  96. package/src/entry.dev.tsx +0 -17
  97. package/src/entry.ssr.tsx +0 -25
  98. package/src/index.ts +0 -2
  99. package/src/kit/client.ts +0 -21
  100. package/src/kit/constants.ts +0 -1
  101. package/src/kit/context.ts +0 -42
  102. package/src/kit/globals.ts +0 -22
  103. package/src/kit/index.ts +0 -4
  104. package/src/kit/server.ts +0 -21
  105. package/src/kit/shared.ts +0 -11
  106. package/src/kit/types.ts +0 -48
  107. package/src/plugin/assets/index.ts +0 -126
  108. package/src/plugin/components/index.ts +0 -0
  109. package/src/plugin/index.ts +0 -50
  110. package/src/plugin/npm/index.ts +0 -24
  111. package/src/plugin/routes/index.ts +0 -16
  112. package/src/plugin/rpc/index.ts +0 -14
  113. package/src/plugin/types/index.ts +0 -6
  114. package/src/root.tsx +0 -15
  115. package/src/utils/location.ts +0 -9
  116. /package/{lib → dist/component}/devtools.css.qwik.cjs +0 -0
  117. /package/{lib → dist/component}/devtools.css.qwik.mjs +0 -0
  118. /package/{lib-types → dist/component/lib-types/devtools/src}/devtools.d.ts +0 -0
  119. /package/{lib-types → dist/component/lib-types/devtools/src}/entry.dev.d.ts +0 -0
  120. /package/{lib-types → dist/component/lib-types/devtools/src}/entry.ssr.d.ts +0 -0
  121. /package/{lib-types → dist/component/lib-types/devtools/src}/root.d.ts +0 -0
  122. /package/{lib-types → dist/component/lib-types/devtools/src}/utils/location.d.ts +0 -0
  123. /package/{lib-types/kit → dist/component/lib-types/kit/src}/client.d.ts +0 -0
  124. /package/{lib-types/kit → dist/component/lib-types/kit/src}/constants.d.ts +0 -0
  125. /package/{lib-types/kit → dist/component/lib-types/kit/src}/context.d.ts +0 -0
  126. /package/{lib-types/kit → dist/component/lib-types/kit/src}/globals.d.ts +0 -0
  127. /package/{lib-types/kit → dist/component/lib-types/kit/src}/index.d.ts +0 -0
  128. /package/{lib-types/kit → dist/component/lib-types/kit/src}/server.d.ts +0 -0
  129. /package/{lib-types/kit → dist/component/lib-types/kit/src}/shared.d.ts +0 -0
  130. /package/{lib-types/kit → dist/component/lib-types/kit/src}/types.d.ts +0 -0
  131. /package/{lib/kit → dist/component/packages/kit/src}/constants.qwik.cjs +0 -0
  132. /package/{lib/kit → dist/component/packages/kit/src}/constants.qwik.mjs +0 -0
  133. /package/{lib/kit → dist/component/packages/kit/src}/shared.qwik.cjs +0 -0
  134. /package/{lib/kit → dist/component/packages/kit/src}/shared.qwik.mjs +0 -0
@@ -0,0 +1,203 @@
1
+ import { isUndefined, isBigint, isDate, isError, isRegExp, isSet, isMap, isNaNValue, isInfinite, isURL, isArray, isSymbol, isTypedArray } from "./is.qwik.mjs";
2
+ import { findArr } from "./util.qwik.mjs";
3
+ function simpleTransformation(isApplicable, annotation, transform, untransform) {
4
+ return {
5
+ isApplicable,
6
+ annotation,
7
+ transform,
8
+ untransform
9
+ };
10
+ }
11
+ const simpleRules = [
12
+ simpleTransformation(isUndefined, "undefined", () => null, () => void 0),
13
+ simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
14
+ if (typeof BigInt !== "undefined") {
15
+ return BigInt(v);
16
+ }
17
+ console.error("Please add a BigInt polyfill.");
18
+ return v;
19
+ }),
20
+ simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
21
+ simpleTransformation(isError, "Error", (v, superJson) => {
22
+ const baseError = {
23
+ name: v.name,
24
+ message: v.message
25
+ };
26
+ superJson.allowedErrorProps.forEach((prop) => {
27
+ baseError[prop] = v[prop];
28
+ });
29
+ return baseError;
30
+ }, (v, superJson) => {
31
+ const e = new Error(v.message);
32
+ e.name = v.name;
33
+ e.stack = v.stack;
34
+ superJson.allowedErrorProps.forEach((prop) => {
35
+ e[prop] = v[prop];
36
+ });
37
+ return e;
38
+ }),
39
+ simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
40
+ const body = regex.slice(1, regex.lastIndexOf("/"));
41
+ const flags = regex.slice(regex.lastIndexOf("/") + 1);
42
+ return new RegExp(body, flags);
43
+ }),
44
+ simpleTransformation(
45
+ isSet,
46
+ "set",
47
+ // (sets only exist in es6+)
48
+ // eslint-disable-next-line es5/no-es6-methods
49
+ (v) => [...v.values()],
50
+ (v) => new Set(v)
51
+ ),
52
+ simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
53
+ simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
54
+ if (isNaNValue(v)) {
55
+ return "NaN";
56
+ }
57
+ if (v > 0) {
58
+ return "Infinity";
59
+ } else {
60
+ return "-Infinity";
61
+ }
62
+ }, Number),
63
+ simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
64
+ return "-0";
65
+ }, Number),
66
+ simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
67
+ ];
68
+ function compositeTransformation(isApplicable, annotation, transform, untransform) {
69
+ return {
70
+ isApplicable,
71
+ annotation,
72
+ transform,
73
+ untransform
74
+ };
75
+ }
76
+ const symbolRule = compositeTransformation((s, superJson) => {
77
+ if (isSymbol(s)) {
78
+ const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
79
+ return isRegistered;
80
+ }
81
+ return false;
82
+ }, (s, superJson) => {
83
+ const identifier = superJson.symbolRegistry.getIdentifier(s);
84
+ return ["symbol", identifier];
85
+ }, (v) => v.description, (_, a, superJson) => {
86
+ const value = superJson.symbolRegistry.getValue(a[1]);
87
+ if (!value) {
88
+ throw new Error("Trying to deserialize unknown symbol");
89
+ }
90
+ return value;
91
+ });
92
+ const constructorToName = [
93
+ Int8Array,
94
+ Uint8Array,
95
+ Int16Array,
96
+ Uint16Array,
97
+ Int32Array,
98
+ Uint32Array,
99
+ Float32Array,
100
+ Float64Array,
101
+ Uint8ClampedArray
102
+ ].reduce((obj, ctor) => {
103
+ obj[ctor.name] = ctor;
104
+ return obj;
105
+ }, {});
106
+ const typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
107
+ const ctor = constructorToName[a[1]];
108
+ if (!ctor) {
109
+ throw new Error("Trying to deserialize unknown typed array");
110
+ }
111
+ return new ctor(v);
112
+ });
113
+ function isInstanceOfRegisteredClass(potentialClass, superJson) {
114
+ if (potentialClass?.constructor) {
115
+ const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
116
+ return isRegistered;
117
+ }
118
+ return false;
119
+ }
120
+ const classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
121
+ const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
122
+ return ["class", identifier];
123
+ }, (clazz, superJson) => {
124
+ const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
125
+ if (!allowedProps) {
126
+ return { ...clazz };
127
+ }
128
+ const result = {};
129
+ allowedProps.forEach((prop) => {
130
+ result[prop] = clazz[prop];
131
+ });
132
+ return result;
133
+ }, (v, a, superJson) => {
134
+ const clazz = superJson.classRegistry.getValue(a[1]);
135
+ if (!clazz) {
136
+ throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
137
+ }
138
+ return Object.assign(Object.create(clazz.prototype), v);
139
+ });
140
+ const customRule = compositeTransformation((value, superJson) => {
141
+ return !!superJson.customTransformerRegistry.findApplicable(value);
142
+ }, (value, superJson) => {
143
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
144
+ return ["custom", transformer.name];
145
+ }, (value, superJson) => {
146
+ const transformer = superJson.customTransformerRegistry.findApplicable(value);
147
+ return transformer.serialize(value);
148
+ }, (v, a, superJson) => {
149
+ const transformer = superJson.customTransformerRegistry.findByName(a[1]);
150
+ if (!transformer) {
151
+ throw new Error("Trying to deserialize unknown custom value");
152
+ }
153
+ return transformer.deserialize(v);
154
+ });
155
+ const compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
156
+ const transformValue = (value, superJson) => {
157
+ const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
158
+ if (applicableCompositeRule) {
159
+ return {
160
+ value: applicableCompositeRule.transform(value, superJson),
161
+ type: applicableCompositeRule.annotation(value, superJson)
162
+ };
163
+ }
164
+ const applicableSimpleRule = findArr(simpleRules, (rule) => rule.isApplicable(value, superJson));
165
+ if (applicableSimpleRule) {
166
+ return {
167
+ value: applicableSimpleRule.transform(value, superJson),
168
+ type: applicableSimpleRule.annotation
169
+ };
170
+ }
171
+ return void 0;
172
+ };
173
+ const simpleRulesByAnnotation = {};
174
+ simpleRules.forEach((rule) => {
175
+ simpleRulesByAnnotation[rule.annotation] = rule;
176
+ });
177
+ const untransformValue = (json, type, superJson) => {
178
+ if (isArray(type)) {
179
+ switch (type[0]) {
180
+ case "symbol":
181
+ return symbolRule.untransform(json, type, superJson);
182
+ case "class":
183
+ return classRule.untransform(json, type, superJson);
184
+ case "custom":
185
+ return customRule.untransform(json, type, superJson);
186
+ case "typed-array":
187
+ return typedArrayRule.untransform(json, type, superJson);
188
+ default:
189
+ throw new Error("Unknown transformation: " + type);
190
+ }
191
+ } else {
192
+ const transformation = simpleRulesByAnnotation[type];
193
+ if (!transformation) {
194
+ throw new Error("Unknown transformation: " + type);
195
+ }
196
+ return transformation.untransform(json, superJson);
197
+ }
198
+ };
199
+ export {
200
+ isInstanceOfRegisteredClass,
201
+ transformValue,
202
+ untransformValue
203
+ };
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function valuesOfObj(record) {
4
+ if ("values" in Object) {
5
+ return Object.values(record);
6
+ }
7
+ const values = [];
8
+ for (const key in record) {
9
+ if (record.hasOwnProperty(key)) {
10
+ values.push(record[key]);
11
+ }
12
+ }
13
+ return values;
14
+ }
15
+ function find(record, predicate) {
16
+ const values = valuesOfObj(record);
17
+ if ("find" in values) {
18
+ return values.find(predicate);
19
+ }
20
+ const valuesNotNever = values;
21
+ for (let i = 0; i < valuesNotNever.length; i++) {
22
+ const value = valuesNotNever[i];
23
+ if (predicate(value)) {
24
+ return value;
25
+ }
26
+ }
27
+ return void 0;
28
+ }
29
+ function forEach(record, run) {
30
+ Object.entries(record).forEach(([key, value]) => run(value, key));
31
+ }
32
+ function includes(arr, value) {
33
+ return arr.indexOf(value) !== -1;
34
+ }
35
+ function findArr(record, predicate) {
36
+ for (let i = 0; i < record.length; i++) {
37
+ const value = record[i];
38
+ if (predicate(value)) {
39
+ return value;
40
+ }
41
+ }
42
+ return void 0;
43
+ }
44
+ exports.find = find;
45
+ exports.findArr = findArr;
46
+ exports.forEach = forEach;
47
+ exports.includes = includes;
@@ -0,0 +1,47 @@
1
+ function valuesOfObj(record) {
2
+ if ("values" in Object) {
3
+ return Object.values(record);
4
+ }
5
+ const values = [];
6
+ for (const key in record) {
7
+ if (record.hasOwnProperty(key)) {
8
+ values.push(record[key]);
9
+ }
10
+ }
11
+ return values;
12
+ }
13
+ function find(record, predicate) {
14
+ const values = valuesOfObj(record);
15
+ if ("find" in values) {
16
+ return values.find(predicate);
17
+ }
18
+ const valuesNotNever = values;
19
+ for (let i = 0; i < valuesNotNever.length; i++) {
20
+ const value = valuesNotNever[i];
21
+ if (predicate(value)) {
22
+ return value;
23
+ }
24
+ }
25
+ return void 0;
26
+ }
27
+ function forEach(record, run) {
28
+ Object.entries(record).forEach(([key, value]) => run(value, key));
29
+ }
30
+ function includes(arr, value) {
31
+ return arr.indexOf(value) !== -1;
32
+ }
33
+ function findArr(record, predicate) {
34
+ for (let i = 0; i < record.length; i++) {
35
+ const value = record[i];
36
+ if (predicate(value)) {
37
+ return value;
38
+ }
39
+ }
40
+ return void 0;
41
+ }
42
+ export {
43
+ find,
44
+ findArr,
45
+ forEach,
46
+ includes
47
+ };
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ async function getViteClient(base = "/", warning = true) {
4
+ try {
5
+ const url = `${base}@vite/client`;
6
+ const res = await fetch(url);
7
+ const text = await res.text();
8
+ if (text.startsWith("<") || !res.headers.get("content-type")?.includes("javascript"))
9
+ throw new Error("Not javascript");
10
+ return await import(
11
+ /* @vite-ignore */
12
+ url
13
+ );
14
+ } catch {
15
+ if (warning)
16
+ console.error(`[vite-hot-client] Failed to import "${base}@vite/client"`);
17
+ }
18
+ return void 0;
19
+ }
20
+ function guessBasesFromPathname(pathname = window.location.pathname) {
21
+ return pathname.split("/").map((i, idx, arr) => arr.slice(0, idx + 1).join("/") || "/");
22
+ }
23
+ async function tryCreateHotContext(path = "/___", bases) {
24
+ bases = bases ?? guessBasesFromPathname();
25
+ for (const base of bases) {
26
+ const viteClient = await getViteClient(base, false);
27
+ const hot = viteClient?.createHotContext(path);
28
+ if (hot)
29
+ return hot;
30
+ }
31
+ console.error("[vite-hot-client] Failed to import vite client, tried with:", bases);
32
+ }
33
+ exports.getViteClient = getViteClient;
34
+ exports.guessBasesFromPathname = guessBasesFromPathname;
35
+ exports.tryCreateHotContext = tryCreateHotContext;
@@ -0,0 +1,35 @@
1
+ async function getViteClient(base = "/", warning = true) {
2
+ try {
3
+ const url = `${base}@vite/client`;
4
+ const res = await fetch(url);
5
+ const text = await res.text();
6
+ if (text.startsWith("<") || !res.headers.get("content-type")?.includes("javascript"))
7
+ throw new Error("Not javascript");
8
+ return await import(
9
+ /* @vite-ignore */
10
+ url
11
+ );
12
+ } catch {
13
+ if (warning)
14
+ console.error(`[vite-hot-client] Failed to import "${base}@vite/client"`);
15
+ }
16
+ return void 0;
17
+ }
18
+ function guessBasesFromPathname(pathname = window.location.pathname) {
19
+ return pathname.split("/").map((i, idx, arr) => arr.slice(0, idx + 1).join("/") || "/");
20
+ }
21
+ async function tryCreateHotContext(path = "/___", bases) {
22
+ bases = bases ?? guessBasesFromPathname();
23
+ for (const base of bases) {
24
+ const viteClient = await getViteClient(base, false);
25
+ const hot = viteClient?.createHotContext(path);
26
+ if (hot)
27
+ return hot;
28
+ }
29
+ console.error("[vite-hot-client] Failed to import vite client, tried with:", bases);
30
+ }
31
+ export {
32
+ getViteClient,
33
+ guessBasesFromPathname,
34
+ tryCreateHotContext
35
+ };
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const SuperJSON = require("superjson");
4
- const birpc = require("birpc");
3
+ const index$1 = require("../../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.cjs");
4
+ const index = require("../../../node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.cjs");
5
5
  const constants = require("./constants.qwik.cjs");
6
6
  const context = require("./context.qwik.cjs");
7
7
  function createClientRpc(functions) {
8
8
  const client = context.getViteClientContext();
9
- const rpc = birpc.createBirpc(functions, {
10
- post: (data) => client.send(constants.DEVTOOLS_VITE_MESSAGING_EVENT, SuperJSON.stringify(data)),
9
+ const rpc = index.createBirpc(functions, {
10
+ post: (data) => client.send(constants.DEVTOOLS_VITE_MESSAGING_EVENT, index$1.default.stringify(data)),
11
11
  on: (fn) => client.on(constants.DEVTOOLS_VITE_MESSAGING_EVENT, (data) => {
12
- fn(SuperJSON.parse(data));
12
+ fn(index$1.default.parse(data));
13
13
  }),
14
14
  timeout: 12e4
15
15
  });
@@ -1,5 +1,5 @@
1
- import SuperJSON from "superjson";
2
- import { createBirpc } from "birpc";
1
+ import SuperJSON from "../../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.mjs";
2
+ import { createBirpc } from "../../../node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.mjs";
3
3
  import { DEVTOOLS_VITE_MESSAGING_EVENT } from "./constants.qwik.mjs";
4
4
  import { setViteClientRpc, getViteClientContext } from "./context.qwik.mjs";
5
5
  function createClientRpc(functions) {
@@ -8,15 +8,6 @@ function getViteClientContext() {
8
8
  function setViteClientContext(ctx) {
9
9
  shared.target[globals.CLIENT_CTX] = ctx;
10
10
  }
11
- function getViteServerContext() {
12
- return shared.target[globals.SERVER_CTX];
13
- }
14
- function setViteServerContext(ctx) {
15
- shared.target[globals.SERVER_CTX] = ctx;
16
- }
17
- function setViteServerRpc(rpc) {
18
- shared.target[globals.SERVER_RPC] = rpc;
19
- }
20
11
  function getViteClientRpc() {
21
12
  return shared.target[globals.CLIENT_RPC];
22
13
  }
@@ -25,8 +16,5 @@ function setViteClientRpc(rpc) {
25
16
  }
26
17
  exports.getViteClientContext = getViteClientContext;
27
18
  exports.getViteClientRpc = getViteClientRpc;
28
- exports.getViteServerContext = getViteServerContext;
29
19
  exports.setViteClientContext = setViteClientContext;
30
20
  exports.setViteClientRpc = setViteClientRpc;
31
- exports.setViteServerContext = setViteServerContext;
32
- exports.setViteServerRpc = setViteServerRpc;
@@ -1,20 +1,11 @@
1
1
  import { target } from "./shared.qwik.mjs";
2
- import { CLIENT_CTX, SERVER_CTX, CLIENT_RPC, SERVER_RPC } from "./globals.qwik.mjs";
2
+ import { CLIENT_CTX, CLIENT_RPC } from "./globals.qwik.mjs";
3
3
  function getViteClientContext() {
4
4
  return target[CLIENT_CTX];
5
5
  }
6
6
  function setViteClientContext(ctx) {
7
7
  target[CLIENT_CTX] = ctx;
8
8
  }
9
- function getViteServerContext() {
10
- return target[SERVER_CTX];
11
- }
12
- function setViteServerContext(ctx) {
13
- target[SERVER_CTX] = ctx;
14
- }
15
- function setViteServerRpc(rpc) {
16
- target[SERVER_RPC] = rpc;
17
- }
18
9
  function getViteClientRpc() {
19
10
  return target[CLIENT_RPC];
20
11
  }
@@ -24,9 +15,6 @@ function setViteClientRpc(rpc) {
24
15
  export {
25
16
  getViteClientContext,
26
17
  getViteClientRpc,
27
- getViteServerContext,
28
18
  setViteClientContext,
29
- setViteClientRpc,
30
- setViteServerContext,
31
- setViteServerRpc
19
+ setViteClientRpc
32
20
  };
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const CLIENT_CTX = "__qwik_client_ctx__";
4
- const SERVER_CTX = "__qwik_server_ctx__";
5
- const SERVER_RPC = "__qwik_server_rpc__";
6
4
  const CLIENT_RPC = "__qwik_client_rpc__";
7
5
  exports.CLIENT_CTX = CLIENT_CTX;
8
6
  exports.CLIENT_RPC = CLIENT_RPC;
9
- exports.SERVER_CTX = SERVER_CTX;
10
- exports.SERVER_RPC = SERVER_RPC;
@@ -0,0 +1,6 @@
1
+ const CLIENT_CTX = "__qwik_client_ctx__";
2
+ const CLIENT_RPC = "__qwik_client_rpc__";
3
+ export {
4
+ CLIENT_CTX,
5
+ CLIENT_RPC
6
+ };