libsass
libsass copied to clipboard
Prepare library to be used with wasm32-wasi
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.
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
- M Makefile https://github.com/sass/libsass/pull/2907/files#diff-0 (30)
- M src/file.cpp https://github.com/sass/libsass/pull/2907/files#diff-1 (14)
- M src/plugins.cpp https://github.com/sass/libsass/pull/2907/files#diff-2 (6)
- A wasm/.gitignore https://github.com/sass/libsass/pull/2907/files#diff-3 (4)
- A wasm/Makefile https://github.com/sass/libsass/pull/2907/files#diff-4 (29)
- A wasm/README.md https://github.com/sass/libsass/pull/2907/files#diff-5 (26)
- A wasm/cli.js https://github.com/sass/libsass/pull/2907/files#diff-6 (29)
- A wasm/libcxxabi_stubs.c https://github.com/sass/libsass/pull/2907/files#diff-7 (25)
- A wasm/package.json.in https://github.com/sass/libsass/pull/2907/files#diff-8 (19)
- A wasm/wasi_polyfill.js https://github.com/sass/libsass/pull/2907/files#diff-9 (444)
- A wasm/wasi_polyfill.wasm https://github.com/sass/libsass/pull/2907/files#diff-10 (0)
- A wasm/wasi_polyfill.wat https://github.com/sass/libsass/pull/2907/files#diff-11 (67)
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 .
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
I suggest rebasing on master because a large changeset was just merged
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 .
Is there anything needs to be done for acceptance of this PR?