Skip to content

Commit

Permalink
use dedicated js dir
Browse files Browse the repository at this point in the history
  • Loading branch information
lherman-cs committed Jan 3, 2025
1 parent 96001e1 commit e42908f
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 197 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -203,5 +203,4 @@ Cargo.lock
**/*.rs.bk
Cargo.lock
bin/
pkg*/
wasm-pack.log
19 changes: 5 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
TARGET := bundler

all:
make build
make build TARGET=deno
JS := js

build:
wasm-pack build --target $(TARGET) --out-dir pkg-$(TARGET) --release --no-pack --weak-refs && cp js-assets/* pkg-$(TARGET)/
$(MAKE) -C $(JS) build

publish: all
cp js-assets/README.md . && npx jsr publish --allow-slow-types --allow-dirty && rm README.md
test: build
$(MAKE) -C $(JS) test

install:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

test:
deno test -A app.test.ts
echo "https://github.com/rustwasm/wasm-pack/pull/1061"
node --experimental-vm-modules --trace-warnings --experimental-wasm-modules app.test.js
$(MAKE) -C $(JS) install
155 changes: 0 additions & 155 deletions js-assets/index.ts

This file was deleted.

2 changes: 2 additions & 0 deletions js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pkg*/
docs
23 changes: 23 additions & 0 deletions js/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
TARGET := bundler

build:
$(MAKE) build-target
$(MAKE) build-target TARGET=deno

build-target:
wasm-pack build --target $(TARGET) --out-dir $(PWD)/pkg-$(TARGET) --release --no-pack --weak-refs

test:
deno test -A app.test.ts
echo "https://github.com/rustwasm/wasm-pack/pull/1061"
node --experimental-vm-modules --trace-warnings --experimental-wasm-modules app.test.js

doc: build
deno doc --html ./pkg-bundler/pulsebeam_core.js
python3 -m http.server -d docs

publish: all
npx jsr publish --allow-slow-types

install:
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions js/jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@pulsebeam/server",
"version": "0.0.8",
"nodeModulesDir": "auto",
"exports": {
"./node": "./pkg-bundler/pulsebeam_core.js",
"./deno": "./pkg-deno/pulsebeam_core.js"
},
"exclude": [
"!pkg-bundler/",
"!pkg-deno/",
"src",
"tests",
"examples"
]
}
19 changes: 0 additions & 19 deletions jsr.json

This file was deleted.

16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl From<anyhow::Error> for AppError {
}
}

/// Represents peer claims for controlling access.
/// Represents peer claims for controlling access. Hello
/// To learn about claims see JWT RFC {@link https://datatracker.ietf.org/doc/html/rfc7519}
/// free() - internal method do not use
#[wasm_bindgen]
Expand Down Expand Up @@ -82,17 +82,17 @@ impl PeerClaims {
..Self::default()
}
}
/// Configure allowlist for incoming traffic

/// Configure allowlist for incoming traffic
/// @param {FirewallClaims} claims - FirewallClaims instance representing
/// the incoming rule.
/// @example myClaims.setAllowIncoming0(myRule);
#[wasm_bindgen(js_name = "setAllowIncoming0")]
pub fn set_allow_incoming_0(&mut self, claims: &FirewallClaims) {
self.allow_incoming_0 = Some(claims.clone());
}
/// Configure allowlist for outgoing traffic

/// Configure allowlist for outgoing traffic
/// @param {FirewallClaims} claims - FirewallClaims instance representing
/// the outgoing rule.
/// @example myClaims.setAllowOutgoing0(myRule);
Expand Down Expand Up @@ -121,9 +121,9 @@ impl FirewallClaims {
/// - Is a valid UTF-8 string
/// - length(string) >= 1 character
/// - Contains no more than 1 wildcard (*)
///
///
/// Regex: /^(?:[^*]*\*[^*]*|[^*]+)$/g
///
///
/// Examples: ["*", "myGroup", "*bob", "my*"]
///
/// @param {Rule} group_id_rule - Desired rule for allowed groupIds
Expand Down Expand Up @@ -180,7 +180,7 @@ impl App {
app_secret: app_secret.to_owned(),
}
}

/// Create a JWT. The JWT should be used by your client-side application.
/// To learn about JWTs and claims see JWT RFC {@link https://datatracker.ietf.org/doc/html/rfc7519}
/// @param {PeerClaims} claims - The peer claims to include in the token.
Expand Down

0 comments on commit e42908f

Please sign in to comment.