@fluxiapi/react 0.3.0 → 0.3.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.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -12
- package/dist/index.mjs +39 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -62,9 +62,9 @@ var ScannerBridge = class {
|
|
|
62
62
|
this._listeners = /* @__PURE__ */ new Set();
|
|
63
63
|
this._analyzeTimer = null;
|
|
64
64
|
this._tickTimer = null;
|
|
65
|
-
// Lazy-loaded scan engine classes
|
|
66
65
|
this._scanner = null;
|
|
67
66
|
this._analyzer = null;
|
|
67
|
+
this._detectedStack = null;
|
|
68
68
|
this._config = {
|
|
69
69
|
network: config.network ?? "wifi",
|
|
70
70
|
analysisInterval: config.analysisInterval ?? 3e3,
|
|
@@ -123,13 +123,16 @@ var ScannerBridge = class {
|
|
|
123
123
|
violations: [],
|
|
124
124
|
score: 100
|
|
125
125
|
});
|
|
126
|
-
this._tickTimer = setInterval(() => {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
this._tickTimer = setInterval(async () => {
|
|
127
|
+
try {
|
|
128
|
+
const scanModule2 = await import("@fluxiapi/scan");
|
|
129
|
+
const requests = scanModule2.getAllRequests?.() ?? [];
|
|
130
|
+
this._update({
|
|
131
|
+
elapsed: Math.round((Date.now() - this._state.startTime) / 1e3),
|
|
132
|
+
requests
|
|
133
|
+
});
|
|
134
|
+
} catch {
|
|
135
|
+
}
|
|
133
136
|
}, 500);
|
|
134
137
|
this._analyzeTimer = setInterval(() => {
|
|
135
138
|
this._runAnalysis();
|
|
@@ -186,17 +189,41 @@ var ScannerBridge = class {
|
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
191
|
// ─── Analysis ───────────────────────────────────────────────
|
|
189
|
-
_runAnalysis() {
|
|
192
|
+
async _runAnalysis() {
|
|
190
193
|
if (!this._scanner || !this._analyzer) return;
|
|
191
194
|
try {
|
|
192
|
-
const
|
|
193
|
-
|
|
195
|
+
const scanModule = await import("@fluxiapi/scan");
|
|
196
|
+
const requests = scanModule.getAllRequests?.() ?? [];
|
|
197
|
+
if (requests.length === 0) return;
|
|
198
|
+
const session = {
|
|
199
|
+
id: `live_${Date.now()}`,
|
|
200
|
+
startTime: this._state.startTime,
|
|
201
|
+
endTime: performance.now(),
|
|
202
|
+
requests,
|
|
203
|
+
navigations: [],
|
|
204
|
+
websockets: { connections: [], totalMessages: 0, messagesPerSecond: 0 },
|
|
205
|
+
stack: this._detectedStack ?? null,
|
|
206
|
+
config: { duration: Infinity, network: this._config.network },
|
|
207
|
+
metadata: {
|
|
208
|
+
url: typeof window !== "undefined" ? window.location.href : "unknown",
|
|
209
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "unknown",
|
|
210
|
+
scanDuration: Date.now() - this._state.startTime,
|
|
211
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
if (!this._detectedStack && typeof scanModule.detectFramework === "function") {
|
|
215
|
+
try {
|
|
216
|
+
this._detectedStack = scanModule.detectFramework?.() ?? null;
|
|
217
|
+
if (this._detectedStack) session.stack = this._detectedStack;
|
|
218
|
+
} catch {
|
|
219
|
+
}
|
|
220
|
+
}
|
|
194
221
|
const report = this._analyzer.analyze(session);
|
|
195
222
|
this._update({
|
|
196
223
|
report,
|
|
197
224
|
score: report?.score?.overall ?? 100,
|
|
198
225
|
violations: report?.violations ?? [],
|
|
199
|
-
framework: session
|
|
226
|
+
framework: session.stack?.framework?.name ?? null
|
|
200
227
|
});
|
|
201
228
|
} catch (err) {
|
|
202
229
|
if (this._config.verbose) {
|
package/dist/index.mjs
CHANGED
|
@@ -23,9 +23,9 @@ var ScannerBridge = class {
|
|
|
23
23
|
this._listeners = /* @__PURE__ */ new Set();
|
|
24
24
|
this._analyzeTimer = null;
|
|
25
25
|
this._tickTimer = null;
|
|
26
|
-
// Lazy-loaded scan engine classes
|
|
27
26
|
this._scanner = null;
|
|
28
27
|
this._analyzer = null;
|
|
28
|
+
this._detectedStack = null;
|
|
29
29
|
this._config = {
|
|
30
30
|
network: config.network ?? "wifi",
|
|
31
31
|
analysisInterval: config.analysisInterval ?? 3e3,
|
|
@@ -84,13 +84,16 @@ var ScannerBridge = class {
|
|
|
84
84
|
violations: [],
|
|
85
85
|
score: 100
|
|
86
86
|
});
|
|
87
|
-
this._tickTimer = setInterval(() => {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
this._tickTimer = setInterval(async () => {
|
|
88
|
+
try {
|
|
89
|
+
const scanModule2 = await import("@fluxiapi/scan");
|
|
90
|
+
const requests = scanModule2.getAllRequests?.() ?? [];
|
|
91
|
+
this._update({
|
|
92
|
+
elapsed: Math.round((Date.now() - this._state.startTime) / 1e3),
|
|
93
|
+
requests
|
|
94
|
+
});
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
94
97
|
}, 500);
|
|
95
98
|
this._analyzeTimer = setInterval(() => {
|
|
96
99
|
this._runAnalysis();
|
|
@@ -147,17 +150,41 @@ var ScannerBridge = class {
|
|
|
147
150
|
}
|
|
148
151
|
}
|
|
149
152
|
// ─── Analysis ───────────────────────────────────────────────
|
|
150
|
-
_runAnalysis() {
|
|
153
|
+
async _runAnalysis() {
|
|
151
154
|
if (!this._scanner || !this._analyzer) return;
|
|
152
155
|
try {
|
|
153
|
-
const
|
|
154
|
-
|
|
156
|
+
const scanModule = await import("@fluxiapi/scan");
|
|
157
|
+
const requests = scanModule.getAllRequests?.() ?? [];
|
|
158
|
+
if (requests.length === 0) return;
|
|
159
|
+
const session = {
|
|
160
|
+
id: `live_${Date.now()}`,
|
|
161
|
+
startTime: this._state.startTime,
|
|
162
|
+
endTime: performance.now(),
|
|
163
|
+
requests,
|
|
164
|
+
navigations: [],
|
|
165
|
+
websockets: { connections: [], totalMessages: 0, messagesPerSecond: 0 },
|
|
166
|
+
stack: this._detectedStack ?? null,
|
|
167
|
+
config: { duration: Infinity, network: this._config.network },
|
|
168
|
+
metadata: {
|
|
169
|
+
url: typeof window !== "undefined" ? window.location.href : "unknown",
|
|
170
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : "unknown",
|
|
171
|
+
scanDuration: Date.now() - this._state.startTime,
|
|
172
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
if (!this._detectedStack && typeof scanModule.detectFramework === "function") {
|
|
176
|
+
try {
|
|
177
|
+
this._detectedStack = scanModule.detectFramework?.() ?? null;
|
|
178
|
+
if (this._detectedStack) session.stack = this._detectedStack;
|
|
179
|
+
} catch {
|
|
180
|
+
}
|
|
181
|
+
}
|
|
155
182
|
const report = this._analyzer.analyze(session);
|
|
156
183
|
this._update({
|
|
157
184
|
report,
|
|
158
185
|
score: report?.score?.overall ?? 100,
|
|
159
186
|
violations: report?.violations ?? [],
|
|
160
|
-
framework: session
|
|
187
|
+
framework: session.stack?.framework?.name ?? null
|
|
161
188
|
});
|
|
162
189
|
} catch (err) {
|
|
163
190
|
if (this._config.verbose) {
|
package/package.json
CHANGED