@arcjet/analyze-wasm 1.0.0-beta.1 → 1.0.0-beta.10
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 +45 -22
- package/_virtual/arcjet_analyze_js_req.component.core.js +1 -1
- package/_virtual/arcjet_analyze_js_req.component.core2.js +1 -1
- package/_virtual/arcjet_analyze_js_req.component.core3.js +1 -1
- package/index.js +1 -0
- package/package.json +29 -18
- package/wasm/arcjet_analyze_js_req.component.core.wasm +0 -0
- package/wasm/arcjet_analyze_js_req.component.core2.wasm +0 -0
- package/wasm/arcjet_analyze_js_req.component.core3.wasm +0 -0
- package/wasm/arcjet_analyze_js_req.component.d.ts +4 -1
- package/wasm/arcjet_analyze_js_req.component.js +40 -15
- package/wasm/arcjet_analyze_js_req.component.wasm +0 -0
- package/wasm/interfaces/arcjet-js-req-bot-identifier.d.ts +4 -0
- package/edge-light.ts +0 -55
- package/index.ts +0 -60
- package/wasm.d.ts +0 -28
- package/workerd.ts +0 -56
package/README.md
CHANGED
|
@@ -22,41 +22,64 @@ against common attacks.
|
|
|
22
22
|
|
|
23
23
|
This package provides WebAssembly bindings to [Arcjet's][arcjet] local analysis engine.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
- [npm package (`@arcjet/analyze-wasm`)](https://www.npmjs.com/package/@arcjet/analyze-wasm)
|
|
26
|
+
- [GitHub source code (`analyze-wasm/` in `arcjet/arcjet-js`)](https://github.com/arcjet/arcjet-js/tree/main/analyze-wasm)
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
## What is this?
|
|
29
|
+
|
|
30
|
+
This package provides logic in WebAssembly to locally analyze requests.
|
|
31
|
+
|
|
32
|
+
To load these binary files everywhere until something like
|
|
33
|
+
[_Import Bytes_][tc39-proposal-import-bytes] is available,
|
|
34
|
+
we settled on a technique that seems to work well everywhere.
|
|
35
|
+
This technique gives us compatibility with for example Next.js which right now
|
|
36
|
+
requires a special experimental `asyncWebAssembly` webpack configuration,
|
|
37
|
+
|
|
38
|
+
The file `_virtual/arcjet_analyze_js_req.component.core.js` contains the
|
|
39
|
+
WebAssembly inlined as a [`data:` URL][mdn-data-url].
|
|
40
|
+
This is about 3 times smaller than using a `Uint8Array` (see
|
|
41
|
+
[_Better Binary Batter: Mixing Base64 and Uint8Array_][wasm-base64-blog] for more
|
|
42
|
+
info).
|
|
43
|
+
That URL is then turned into an `ArrayBuffer` and passed to
|
|
44
|
+
`WebAssembly.compile`.
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
The files here are generated.
|
|
47
|
+
They are wrapped up into [`@arcjet/analyze`][github-arcjet-analyze] for use in
|
|
48
|
+
JavaScript,
|
|
49
|
+
in turn exposed in our core package
|
|
50
|
+
([`arcjet`][github-arcjet-arcjet])
|
|
51
|
+
and our adapters (such as `@arcjet/next`).
|
|
32
52
|
|
|
33
|
-
|
|
34
|
-
will run local analysis on request details.
|
|
53
|
+
<!-- TODO(@wooorm-arcjet): link `adapters` above when the main repo is up to date. -->
|
|
35
54
|
|
|
36
|
-
|
|
37
|
-
a base64 [Data URL][mdn-data-url] with the `application/wasm` MIME type.
|
|
55
|
+
## When should I use this?
|
|
38
56
|
|
|
39
|
-
This
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
details.
|
|
57
|
+
This is an internal Arcjet package not designed for public use.
|
|
58
|
+
See our [_Get started_ guide][arcjet-get-started] for how to use Arcjet in your
|
|
59
|
+
application.
|
|
43
60
|
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
This package is ESM only.
|
|
64
|
+
Install with npm in Node.js:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npm install @arcjet/analyze-wasm
|
|
68
|
+
```
|
|
46
69
|
|
|
47
|
-
|
|
48
|
-
ways based on the platform or bundler a user is targeting. One example being
|
|
49
|
-
that Next.js requires special `asyncWebAssembly` webpack config to load our
|
|
50
|
-
Wasm file if we don't do this.
|
|
70
|
+
## Use
|
|
51
71
|
|
|
52
|
-
|
|
53
|
-
properly support consistent asset bundling techniques.
|
|
72
|
+
Use [`@arcjet/analyze`][file-analyze] instead.
|
|
54
73
|
|
|
55
74
|
## License
|
|
56
75
|
|
|
57
|
-
|
|
76
|
+
[Apache License, Version 2.0][apache-license] © [Arcjet Labs, Inc.][arcjet]
|
|
58
77
|
|
|
59
78
|
[arcjet]: https://arcjet.com
|
|
79
|
+
[arcjet-get-started]: https://docs.arcjet.com/get-started
|
|
80
|
+
[file-analyze]: ../analyze/
|
|
60
81
|
[mdn-data-url]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
|
|
61
82
|
[wasm-base64-blog]: https://blobfolio.com/2019/better-binary-batter-mixing-base64-and-uint8array/
|
|
62
83
|
[apache-license]: http://www.apache.org/licenses/LICENSE-2.0
|
|
84
|
+
[github-arcjet-analyze]: https://github.com/arcjet/arcjet-js/tree/main/analyze
|
|
85
|
+
[tc39-proposal-import-bytes]: https://github.com/tc39/proposal-import-bytes
|