dag-rs 0.1.4
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/LICENSE +21 -0
- package/README.md +90 -0
- package/index.node +0 -0
- package/lib/index.js +3 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Anshul Ekka
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# dag
|
|
2
|
+
|
|
3
|
+
This project was bootstrapped by [create-neon](https://www.npmjs.com/package/create-neon).
|
|
4
|
+
|
|
5
|
+
## Building dag
|
|
6
|
+
|
|
7
|
+
Building dag requires a [supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support).
|
|
8
|
+
|
|
9
|
+
To run the build, run:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
$ npm run build
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This command uses the [@neon-rs/cli](https://www.npmjs.com/package/@neon-rs/cli) utility to assemble the binary Node addon from the output of `cargo`.
|
|
16
|
+
|
|
17
|
+
## Exploring dag
|
|
18
|
+
|
|
19
|
+
After building dag, you can explore its exports at the Node console:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
$ npm i
|
|
23
|
+
$ npm run build
|
|
24
|
+
$ node
|
|
25
|
+
> require('.').hello('node')
|
|
26
|
+
'hello node'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Available Scripts
|
|
30
|
+
|
|
31
|
+
In the project directory, you can run:
|
|
32
|
+
|
|
33
|
+
#### `npm install`
|
|
34
|
+
|
|
35
|
+
Installs the project, including running `npm run build`.
|
|
36
|
+
|
|
37
|
+
#### `npm run build`
|
|
38
|
+
|
|
39
|
+
Builds the Node addon (`index.node`) from source, generating a release build with `cargo --release`.
|
|
40
|
+
|
|
41
|
+
Additional [`cargo build`](https://doc.rust-lang.org/cargo/commands/cargo-build.html) arguments may be passed to `npm run build` and similar commands. For example, to enable a [cargo feature](https://doc.rust-lang.org/cargo/reference/features.html):
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
npm run build -- --feature=beetle
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
#### `npm run debug`
|
|
48
|
+
|
|
49
|
+
Similar to `npm run build` but generates a debug build with `cargo`.
|
|
50
|
+
|
|
51
|
+
#### `npm run cross`
|
|
52
|
+
|
|
53
|
+
Similar to `npm run build` but uses [cross-rs](https://github.com/cross-rs/cross) to cross-compile for another platform. Use the [`CARGO_BUILD_TARGET`](https://doc.rust-lang.org/cargo/reference/config.html#buildtarget) environment variable to select the build target.
|
|
54
|
+
|
|
55
|
+
#### `npm test`
|
|
56
|
+
|
|
57
|
+
Runs the unit tests by calling `cargo test`. You can learn more about [adding tests to your Rust code](https://doc.rust-lang.org/book/ch11-01-writing-tests.html) from the [Rust book](https://doc.rust-lang.org/book/).
|
|
58
|
+
|
|
59
|
+
## Project Layout
|
|
60
|
+
|
|
61
|
+
The directory structure of this project is:
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
dag/
|
|
65
|
+
├── Cargo.toml
|
|
66
|
+
├── README.md
|
|
67
|
+
├── src/
|
|
68
|
+
| └── lib.rs
|
|
69
|
+
├── index.node
|
|
70
|
+
├── package.json
|
|
71
|
+
└── target/
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Entry | Purpose |
|
|
75
|
+
|----------------|------------------------------------------------------------------------------------------------------------------------------------------|
|
|
76
|
+
| `Cargo.toml` | The Cargo [manifest file](https://doc.rust-lang.org/cargo/reference/manifest.html), which informs the `cargo` command. |
|
|
77
|
+
| `README.md` | This file. |
|
|
78
|
+
| `src/` | The directory tree containing the Rust source code for the project. |
|
|
79
|
+
| `lib.rs` | Entry point for the Rust source code. |
|
|
80
|
+
| `index.node` | The main module, a [Node addon](https://nodejs.org/api/addons.html) generated by the build and pointed to by `"main"` in `package.json`. |
|
|
81
|
+
| `package.json` | The npm [manifest file](https://docs.npmjs.com/cli/v7/configuring-npm/package-json), which informs the `npm` command. |
|
|
82
|
+
| `target/` | Binary artifacts generated by the Rust build. |
|
|
83
|
+
|
|
84
|
+
## Learn More
|
|
85
|
+
|
|
86
|
+
Learn more about:
|
|
87
|
+
|
|
88
|
+
- [Neon](https://neon-bindings.com).
|
|
89
|
+
- [Rust](https://www.rust-lang.org).
|
|
90
|
+
- [Node](https://nodejs.org).
|
package/index.node
ADDED
|
Binary file
|
package/lib/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dag-rs",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"lib",
|
|
11
|
+
"*.node"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "cargo test",
|
|
15
|
+
"cargo-build": "cargo build --message-format=json-render-diagnostics > cargo.log",
|
|
16
|
+
"cross-build": "cross build --message-format=json-render-diagnostics > cross.log",
|
|
17
|
+
"postcargo-build": "neon dist < cargo.log",
|
|
18
|
+
"postcross-build": "neon dist -m /target < cross.log",
|
|
19
|
+
"debug": "npm run cargo-build --",
|
|
20
|
+
"build": "npm run cargo-build -- --release",
|
|
21
|
+
"cross": "npm run cross-build -- --release",
|
|
22
|
+
"cs": " changeset && changeset version"
|
|
23
|
+
},
|
|
24
|
+
"author": "Anxhul10",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"homepage": "https://github.com/Anxhul10/DAG#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/Anxhul10/DAG/issues"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/Anxhul10/DAG.git"
|
|
33
|
+
},
|
|
34
|
+
"type": "commonjs",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@changesets/cli": "^2.29.8",
|
|
37
|
+
"@neon-rs/cli": "0.1.82"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=20.0.0"
|
|
41
|
+
}
|
|
42
|
+
}
|