@niksbanna/bot-detector 1.0.0 → 1.0.2
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/README.md +37 -2
- package/dist/bot-detector.cjs.js +3 -3
- package/dist/bot-detector.cjs.js.map +2 -2
- package/dist/bot-detector.esm.js +3 -3
- package/dist/bot-detector.esm.js.map +2 -2
- package/dist/bot-detector.iife.js +3 -3
- package/dist/bot-detector.iife.js.map +2 -2
- package/dist/bot-detector.iife.min.js +1 -1
- package/package.json +5 -4
- package/src/signals/automation/PuppeteerSignal.js +8 -3
package/README.md
CHANGED
|
@@ -50,10 +50,11 @@ const result = await detector.detect();
|
|
|
50
50
|
|
|
51
51
|
### Browser Script Tag
|
|
52
52
|
|
|
53
|
+
**ESM (recommended):**
|
|
53
54
|
```html
|
|
54
55
|
<script type="module">
|
|
55
|
-
import { detect } from '
|
|
56
|
-
|
|
56
|
+
import { detect } from 'https://cdn.jsdelivr.net/npm/@niksbanna/bot-detector/dist/bot-detector.esm.js';
|
|
57
|
+
|
|
57
58
|
const result = await detect();
|
|
58
59
|
if (result.verdict === 'bot') {
|
|
59
60
|
// Handle bot detection
|
|
@@ -61,6 +62,29 @@ const result = await detector.detect();
|
|
|
61
62
|
</script>
|
|
62
63
|
```
|
|
63
64
|
|
|
65
|
+
**Classic script tag (IIFE):**
|
|
66
|
+
```html
|
|
67
|
+
<!-- Full build -->
|
|
68
|
+
<script src="https://cdn.jsdelivr.net/npm/@niksbanna/bot-detector/dist/bot-detector.iife.js"></script>
|
|
69
|
+
<!-- Minified -->
|
|
70
|
+
<script src="https://cdn.jsdelivr.net/npm/@niksbanna/bot-detector/dist/bot-detector.iife.min.js"></script>
|
|
71
|
+
<script>
|
|
72
|
+
BotDetectorLib.detect().then(result => {
|
|
73
|
+
if (result.verdict === 'bot') {
|
|
74
|
+
// Handle bot detection
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
</script>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Named subpath imports (bundlers / Node.js):**
|
|
81
|
+
```javascript
|
|
82
|
+
// Full IIFE source
|
|
83
|
+
import '@niksbanna/bot-detector/iife';
|
|
84
|
+
// Minified IIFE source
|
|
85
|
+
import '@niksbanna/bot-detector/iife.min';
|
|
86
|
+
```
|
|
87
|
+
|
|
64
88
|
## Detection Result
|
|
65
89
|
|
|
66
90
|
```typescript
|
|
@@ -240,6 +264,17 @@ npm test
|
|
|
240
264
|
npm run dev
|
|
241
265
|
```
|
|
242
266
|
|
|
267
|
+
## Changelog
|
|
268
|
+
|
|
269
|
+
### v1.0.2
|
|
270
|
+
- **Fix:** `PuppeteerSignal` no longer false-positives on Angular apps — `__zone_symbol__*` bindings injected by Zone.js are now excluded from the suspicious-bindings check.
|
|
271
|
+
- **Fix:** `PuppeteerSignal` no longer false-positives on normal Chrome pages — `incomplete-chrome-object` now only triggers when `window.chrome.runtime` is absent, not when `runtime.id` is undefined (which is normal outside of extensions).
|
|
272
|
+
- **Fix:** Corrected `package.json` `browser` entry to point to ESM instead of IIFE, fixing import resolution in modern bundlers (Vite, webpack, Rollup, esbuild).
|
|
273
|
+
- **Added:** Named export subpaths `./iife` and `./iife.min` for explicit IIFE access.
|
|
274
|
+
|
|
275
|
+
### v1.0.0
|
|
276
|
+
- Initial release.
|
|
277
|
+
|
|
243
278
|
## License
|
|
244
279
|
|
|
245
280
|
MIT
|
package/dist/bot-detector.cjs.js
CHANGED
|
@@ -2231,14 +2231,14 @@ var PuppeteerSignal = class extends Signal {
|
|
|
2231
2231
|
confidence = Math.max(confidence, 0.9);
|
|
2232
2232
|
}
|
|
2233
2233
|
const suspiciousBindings = Object.keys(window).filter((key) => {
|
|
2234
|
-
return key.startsWith("__") && typeof window[key] === "function";
|
|
2234
|
+
return key.startsWith("__") && !key.startsWith("__zone_symbol__") && typeof window[key] === "function";
|
|
2235
2235
|
});
|
|
2236
|
-
if (suspiciousBindings.length >
|
|
2236
|
+
if (suspiciousBindings.length > 5) {
|
|
2237
2237
|
indicators.push("suspicious-bindings");
|
|
2238
2238
|
confidence = Math.max(confidence, 0.5);
|
|
2239
2239
|
}
|
|
2240
2240
|
if (typeof window.chrome !== "undefined") {
|
|
2241
|
-
if (!window.chrome.runtime
|
|
2241
|
+
if (!window.chrome.runtime) {
|
|
2242
2242
|
indicators.push("incomplete-chrome-object");
|
|
2243
2243
|
confidence = Math.max(confidence, 0.4);
|
|
2244
2244
|
}
|