You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "Xuanwo (via GitHub)" <gi...@apache.org> on 2024/01/01 08:22:15 UTC

[I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Xuanwo opened a new issue, #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887

   As requested by https://github.com/apache/incubator-opendal/issues/3803#issuecomment-1873170368, can we make merge wasm support with `opendal-nodejs` so that we can run on browser or electron?
   
   For example, `aws-crt` is written in C, but also provide browser support: https://www.npmjs.com/package/aws-crt
   
   Maybe via napi's native wasm support? https://github.com/napi-rs/napi-rs/blob/03eb476cef61fb15f1ec071c415cbf6fbfa8e830/crates/napi/Cargo.toml#L78-L87


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/opendal/issues/3887#issuecomment-1951254035

   Hi, @fyears, I'm now using `remotely-save`! Fantastic job! Let's see how we can improve it by using opendal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874217505

   Supporting `wasm32-wasi` is cool, but it seems unrelated to the goal of running in a browser.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1873220837

   Invite @suyanhanx, @fyears, @Brooooooklyn to join in the discussion.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Brooooooklyn (via GitHub)" <gi...@apache.org>.
Brooooooklyn commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874054429

   @Xuanwo you can assign this issue to me :) I'm working on `wasm32-wasi` support in NAPI-RS


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874306718

   > If we just want to make the opendal useable in electron. I think it already be done
   
   It seems more complex while on mobile as described in https://github.com/remotely-save/remotely-save/blob/master/docs/browser_env.md


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/opendal/issues/3887#issuecomment-1951274722

   Following the discussion at https://github.com/napi-rs/napi-rs/issues/1794, it seems we just need to wait for napi 3.0 and add `wasm32` target.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1873226461

   Current progress:
   
   ```shell
   :( NAPI_TARGET=wasm32-unknown-unknown pnpm run build
   
   > opendal@0.44.1 build /home/xuanwo/Code/apache/incubator-opendal/bindings/nodejs
   > napi build --platform --features "${NAPI_FEATURES:-}" --target "${NAPI_TARGET:-}" --release --js generated.js --dts generated.d.ts && node ./scripts/header.js
   
      Compiling napi v2.14.1
   warning: variable does not need to be mutable
     --> core/src/raw/http_util/client.rs:81:18
      |
   81 |     pub fn build(mut builder: reqwest::ClientBuilder) -> Result<Self> {
      |                  ----^^^^^^^
      |                  |
      |                  help: remove this `mut`
      |
      = note: `#[warn(unused_mut)]` on by default
   
   warning: constant `DEFAULT_CONNECT_TIMEOUT` is never used
     --> core/src/raw/http_util/client.rs:36:7
      |
   36 | const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(60);
      |       ^^^^^^^^^^^^^^^^^^^^^^^
      |
      = note: `#[warn(dead_code)]` on by default
   
   warning: missing documentation for a type alias
     --> core/src/raw/futures_util.rs:31:1
      |
   31 | pub type BoxedFuture<T> = futures::future::LocalBoxFuture<'static, T>;
      | ^^^^^^^^^^^^^^^^^^^^^^^
      |
   note: the lint level is defined here
     --> core/src/lib.rs:67:9
      |
   67 | #![warn(missing_docs)]
      |         ^^^^^^^^^^^^
   
   warning: `opendal` (lib) generated 3 warnings (run `cargo fix --lib -p opendal` to apply 1 suggestion)
      Compiling opendal-nodejs v0.44.1 (/home/xuanwo/Code/apache/incubator-opendal/bindings/nodejs)
   error: future cannot be sent between threads safely
      --> bindings/nodejs/src/lib.rs:772:1
       |
   772 | #[napi]
       | ^^^^^^^ future created by async block is not `Send`
       |
       = help: the trait `std::marker::Send` is not implemented for `(dyn futures::Future<Output = (std::string::String, std::result::Result<opendal::Metadata, opendal::Error>)> + 'static)`
   note: captured value is not `Send` because `&mut` references cannot be sent unless their referent is `Send`
      --> bindings/nodejs/src/lib.rs:772:1
       |
   772 | #[napi]
       | ^^^^^^^ has type `&mut Lister` which is not `Send`, because `Lister` is not `Send`
   note: required by a bound in `execute_tokio_future`
      --> /home/xuanwo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/napi-2.14.1/src/tokio_runtime.rs:121:18
       |
   119 | pub fn execute_tokio_future<
       |        -------------------- required by a bound in this function
   120 |   Data: 'static + Send,
   121 |   Fut: 'static + Send + Future<Output = Result<Data>>,
       |                  ^^^^ required by this bound in `execute_tokio_future`
       = note: this error originates in the attribute macro `napi` (in Nightly builds, run with -Z macro-backtrace for more info)
   
   error: could not compile `opendal-nodejs` (lib) due to previous error
   (node:30467) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
   (Use `node --trace-deprecation ...` to show where the warning was created)
   Internal Error: Command failed: cargo build --release --target wasm32-unknown-unknown
       at genericNodeError (node:internal/errors:956:15)
       at wrappedFn (node:internal/errors:510:14)
       at checkExecSyncError (node:child_process:890:11)
       at Object.execSync (node:child_process:962:15)
       at BuildCommand.<anonymous> (/home/xuanwo/Code/apache/incubator-opendal/bindings/nodejs/node_modules/.pnpm/@napi-rs+cli@2.17.0/node_modules/@napi-rs/cli/scripts/index.js:11555:30)
       at Generator.next (<anonymous>)
       at /home/xuanwo/Code/apache/incubator-opendal/bindings/nodejs/node_modules/.pnpm/@napi-rs+cli@2.17.0/node_modules/@napi-rs/cli/scripts/index.js:3552:69
       at new Promise (<anonymous>)
       at __awaiter$1 (/home/xuanwo/Code/apache/incubator-opendal/bindings/nodejs/node_modules/.pnpm/@napi-rs+cli@2.17.0/node_modules/@napi-rs/cli/scripts/index.js:3548:10)
       at BuildCommand.execute (/home/xuanwo/Code/apache/incubator-opendal/bindings/nodejs/node_modules/.pnpm/@napi-rs+cli@2.17.0/node_modules/@napi-rs/cli/scripts/index.js:11325:16)
    ELIFECYCLE  Command failed with exit code 1.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [opendal]

Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo commented on issue #3887:
URL: https://github.com/apache/opendal/issues/3887#issuecomment-1953608983

   cc @suyanhanx, after this implemented, we will need to rename `bindings/nodejs` to `bindings/js`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [opendal]

Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on issue #3887:
URL: https://github.com/apache/opendal/issues/3887#issuecomment-1953654353

   > cc @suyanhanx, after this implemented, we will need to rename `bindings/nodejs` to `bindings/js`?
   
   I think it's okay to rename.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Zheaoli (via GitHub)" <gi...@apache.org>.
Zheaoli commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874093360

   > @Xuanwo you can assign this issue to me :) I'm working on `wasm32-wasi` support in NAPI-RS
   
   FYI, the opendal is not support wasm32-wasi yet, I'm trying to do a min support


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "suyanhanx (via GitHub)" <gi...@apache.org>.
suyanhanx commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874072767

   > @Xuanwo you can assign this issue to me :) I'm working on `wasm32-wasi` support in NAPI-RS
   
   Thank you for participating in this!
   If you need any further assistance or help, feel free to let us know.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Zheaoli (via GitHub)" <gi...@apache.org>.
Zheaoli commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874290629

   > Supporting `wasm32-wasi` is cool, but it seems unrelated to the goal of running in a browser. For example, supporting the use case like [remotely-save](https://github.com/remotely-save/remotely-save)
   
   If we just want to make the opendal useable in electron. I think it already be done
   
   ![image](https://github.com/apache/incubator-opendal/assets/7054676/1af239b9-37b3-480f-bbae-3dff954ca268)
   
   ![image](https://github.com/apache/incubator-opendal/assets/7054676/de82d1ed-5b9a-419c-bf3f-3c934fb7c29d)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "Zheaoli (via GitHub)" <gi...@apache.org>.
Zheaoli commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874326781

   > It seems more complex while on mobile as described in
   
   The mobile is totally different with the desktop. All of the hybrid mobile solutions is depend on the webview which is provided by the platform. Which is means that we need solve issue case by case(It's already not a issue related with the browser or electron)
   
   If we just want to run opendal on the capacitorjs which is used by the plugin you mentioned, I might have some trick to run the workflow as normal.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Can we make opendal-nodejs running on browser or electron? [incubator-opendal]

Posted by "fyears (via GitHub)" <gi...@apache.org>.
fyears commented on issue #3887:
URL: https://github.com/apache/incubator-opendal/issues/3887#issuecomment-1874597015

   electron is just like nodejs and should work by calling nodejs library. browser is different.
   
   > If we just want to run opendal on the capacitorjs 
   
   no need to consider that. let’s focus on the general browser environment firstly


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org