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

Implement the local JS snippets RFC #1295

Merged
merged 18 commits into from
Mar 5, 2019

Commits on Mar 5, 2019

  1. Implement the local JS snippets RFC

    This commit is an implementation of [RFC 6] which enables crates to
    inline local JS snippets into the final output artifact of
    `wasm-bindgen`. This is accompanied with a few minor breaking changes
    which are intended to be relatively minor in practice:
    
    * The `module` attribute disallows paths starting with `./` and `../`.
      It requires paths starting with `/` to actually exist on the filesystem.
    * The `--browser` flag no longer emits bundler-compatible code, but
      rather emits an ES module that can be natively loaded into a browser.
    
    Otherwise be sure to check out [the RFC][RFC 6] for more details, and
    otherwise this should implement at least the MVP version of the RFC!
    Notably at this time JS snippets with `--nodejs` or `--no-modules` are
    not supported and will unconditionally generate an error.
    
    [RFC 6]: rustwasm/rfcs#6
    
    Closes rustwasm#1311
    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    b762948 View commit details
    Browse the repository at this point in the history
  2. Paths are relative to CARGO_MANIFEST_DIR

    The cwd is different for workspaces, so use the manifest env var
    instead.
    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    6283169 View commit details
    Browse the repository at this point in the history
  3. Fix a case where snippet is specified twice

    When importing a file across multiple locations in a module make sure it
    doesn't trip an assert and it works as expected.
    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    7e62aff View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5de3189 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    20f1e50 View commit details
    Browse the repository at this point in the history
  6. Fix import_js example

    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    33494a2 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f1e391e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9063a6b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    bdcfcb4 View commit details
    Browse the repository at this point in the history
  10. Update examples/without-a-bundler-no-modules/README.md

    Co-Authored-By: alexcrichton <alex@alexcrichton.com>
    fitzgen and alexcrichton authored Mar 5, 2019
    Configuration menu
    Copy the full SHA
    6c86d23 View commit details
    Browse the repository at this point in the history
  11. Update examples/without-a-bundler/index.html

    Co-Authored-By: alexcrichton <alex@alexcrichton.com>
    fitzgen and alexcrichton authored Mar 5, 2019
    Configuration menu
    Copy the full SHA
    59e8844 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    95ab24a View commit details
    Browse the repository at this point in the history
  13. Don't explicitly hide _INCLUDED_FILES

    It's already hidden from docs!
    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    93a1301 View commit details
    Browse the repository at this point in the history
  14. Remove unsafe usage in backend/src/encode.rs

    Using `unsafe` was just a little too eager there so let's use an
    off-the-shelf solution for solving the actual problem we have, which is
    to allocate strings with a lifetime of `Interner` rather than
    deduplicating strings.
    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    f3f3ebe View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    bdf98f3 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    f3935cc View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    c463cc9 View commit details
    Browse the repository at this point in the history
  18. Scope snippets within a crate

    Use the same crate identifier for manually included snippets as well as
    inline snippets to help with debugging.
    alexcrichton committed Mar 5, 2019
    Configuration menu
    Copy the full SHA
    d6e3770 View commit details
    Browse the repository at this point in the history