Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference packages to import #107

Open
wst24365888 opened this issue May 17, 2024 · 2 comments
Open

Reference packages to import #107

wst24365888 opened this issue May 17, 2024 · 2 comments

Comments

@wst24365888
Copy link

wst24365888 commented May 17, 2024

First of all, thanks for this awesome project.

I'm wondering if I can reference packages to import like cargo component for ComponentizeJS (and also for componentize-py but not tested yet).

The project structure looks like this. The wit package foo is implemented in another project, and I will combine the implementation component with this component together using wasm-tools later.

$ tree -I node_modules
.
├── package.json
├── pnpm-lock.yaml
├── source.js
└── wit
    ├── cli/
    ├── clocks/
    ├── filesystem/
    ├── foo
    │   ├── bar.wit
    │   └── world.wit
    ├── http/
    ├── io/
    ├── random/
    ├── sockets/
    └── world.wit

But it seems that I can't use jco and ComponentizeJS to accomplish this task..

(jco componentize) ComponentError: package not found
     --> //?/C:/Users/<USER_NAME>/Desktop/componentized-js-test/wit/world.wit:4:10
      |
    4 |   import wasi:foo/[email protected];
      |          ^-------
    at spliceBindings (file:///C:/Users/<USER_NAME>/AppData/Local/pnpm/global/5/.pnpm/@[email protected]/node_modules/@bytecodealliance/componentize-js/lib/spidermonkey-embedding-splicer.js:3800:11)
    at componentize (file:///C:/Users/<USER_NAME>/AppData/Local/pnpm/global/5/.pnpm/@[email protected]/node_modules/@bytecodealliance/componentize-js/src/componentize.js:50:64)
    at async componentize (file:///C:/Users/<USER_NAME>/AppData/Local/pnpm/global/5/.pnpm/@[email protected]/node_modules/@bytecodealliance/jco/src/cmd/componentize.js:15:25)
    at async file:///C:/Users/<USER_NAME>/AppData/Local/pnpm/global/5/.pnpm/@[email protected]/node_modules/@bytecodealliance/jco/src/jco.js:186:9

To reproduce, please head over to this repo.

@guybedford
Copy link
Collaborator

You need to restructure your WIT folder to contain a deps subfolder. Something like:

cd wit
mkdir deps
mv * deps/
mv deps/world.wit .

@cdata
Copy link

cdata commented May 24, 2024

I was clued in to "deps" when I stumbled upon the wit-deps repo. This issue is the sole place I've been able to find a pointer about how to use them. Is there a canonical place to go to read more about how deps are supposed to be resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants