libsass icon indicating copy to clipboard operation
libsass copied to clipboard

Prepare library to be used with wasm32-wasi

Open yurydelendik opened this issue 5 years ago • 5 comments

There is ongoing efforts to support WASI for different runtimes/hosts such as node.js. Here is the changes I made to make compilation work for clang with "wasm32-wasi" target and the wasi-sdk. The "wasi_polyfill.*" code will be removed in final PR.

There is also minor change in the sassc: https://github.com/yurydelendik/sassc/tree/wasi . The build version of sassc on node: https://www.npmjs.com/package/sassc-wasi .

Please provide any feedback and TODO items to make the patch landable. Thanks.

yurydelendik avatar Jun 13 '19 15:06 yurydelendik

Thank you for the effort. I was talking to some wasi folks in Berlin recently about this. Happy to see it progressing.

On Thu., 13 Jun. 2019, 5:25 pm Yury Delendik, [email protected] wrote:

There is ongoing efforts to support WASI https://wasi.dev/ for different runtimes/hosts such as node.js https://github.com/nodejs/node/pull/27850. Here is the changes I made to make compilation work for clang with "wasm32-wasi" target and the wasi-sdk. The "wasi_polyfill.*" code will be removed in final PR.

There is also minor change in the sassc: https://github.com/yurydelendik/sassc/tree/wasi

Please provide any feedback and TODO items to make the patch landable. Thanks.

You can view, comment on, or merge this pull request online at:

https://github.com/sass/libsass/pull/2907 Commit Summary

  • WebAssembly: node polyfill code and build script
  • Add npm packaging
  • WebAssembly: read cwd from environment vars
  • Refactor wasi_polyfill

File Changes

Patch Links:

  • https://github.com/sass/libsass/pull/2907.patch
  • https://github.com/sass/libsass/pull/2907.diff

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sass/libsass/pull/2907?email_source=notifications&email_token=AAENSWDMIJ7YVIYTOFNUGUTP2JRHHA5CNFSM4HX2X66KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4GZLB64Q, or mute the thread https://github.com/notifications/unsubscribe-auth/AAENSWASPDK3EXU4CSFYK3TP2JRHHANCNFSM4HX2X66A .

xzyfer avatar Jun 13 '19 15:06 xzyfer

There is also the autotools build. Any plans to add wasm target also there?

I have near 0 experience with autotools. I had no plans to touch that portion. Let me know what needs to be done there.

The example files were removed from this repo and placed at https://github.com/yurydelendik/sassc/tree/wasi/wasm

yurydelendik avatar Jun 13 '19 21:06 yurydelendik

I suggest rebasing on master because a large changeset was just merged

xzyfer avatar Jun 17 '19 16:06 xzyfer

I'm on vacation until next week. I'll take a look when I'm back.

On Wed., 19 Jun. 2019, 6:21 pm Yury Delendik, [email protected] wrote:

@yurydelendik commented on this pull request.

In src/file.cpp https://github.com/sass/libsass/pull/2907#discussion_r295388956:

@@ -49,6 +50,15 @@ inline static std::string wstring_to_string(const std::wstring &wstr)

endif

#endif

+#ifdef _WASM +inline static std::string get_cwd_from_env() +{

  • char* value = getenv("PWD");

Added option to avoid removal "./" for the _WASM in the make_canonical_path() -- "./" shall work now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sass/libsass/pull/2907?email_source=notifications&email_token=AAENSWHMWUPIQOPCATLGIT3P3JMHNA5CNFSM4HX2X66KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB4BG5QQ#discussion_r295388956, or mute the thread https://github.com/notifications/unsubscribe-auth/AAENSWGJOC2JSL7GF5TLO4TP3JMHNANCNFSM4HX2X66A .

xzyfer avatar Jun 20 '19 12:06 xzyfer

Is there anything needs to be done for acceptance of this PR?

yurydelendik avatar Oct 16 '19 12:10 yurydelendik