- 
        Couldn't load subscription status. 
- Fork 119
          feat(moc.js): add blob: import placeholder setting
          #5607
        
          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
base: master
Are you sure you want to change the base?
Conversation
blob: import placeholder flag for moc.jsblob: import placeholder flag for moc.js
      blob: import placeholder flag for moc.jsblob: import placeholder setting
      There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One could also use https://ocsigen.org/js_of_ocaml/latest/api/js_of_ocaml/Js_of_ocaml/Sys_js/index.html#val-create_file
to just male the file and then let the rest of the mechanism import it.
And there is the mount function too, which would actually allow importing the exact content.
Edit: Oh, I see, having that module conditionally included may be tricky.
| assert T.(t = Prim Blob); | ||
| blobE contents | ||
| if !Mo_config.Flags.blob_import_placeholders then | ||
| raise (Invalid_argument ("blob import placeholder")) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, block the desugaring!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Possible (hacky) solution for dfinity/vscode-motoko#394. Tested in VS Code and works as expected.
Adds a
setBlobImportPlaceholders(boolean)function tomoc.jswhich ignores unresolvedblob:imports (trapping at runtime) when enabled. This is a workaround for the virtual file system currently only including Motoko and Candid files from the VS Code workspace.