Giter Site home page Giter Site logo

Comments (6)

devongovett avatar devongovett commented on August 13, 2024

With the WASM version, yes, delete is necessary. With the node version it is not.

from source-map.

cspotcode avatar cspotcode commented on August 13, 2024

I'm trying to understand the WASM version better, and I can't find the WASM artifact in the npm package.
https://unpkg.com/browse/@parcel/[email protected]/parcel_sourcemap_wasm/

Am I looking in the wrong place, or doing something unsupported?

> require('@parcel/source-map/dist/wasm-bindings')
Uncaught:
Error: Cannot find module '../parcel_sourcemap_wasm/dist-node/parcel_sourcemap_wasm.js'

from source-map.

mischnic avatar mischnic commented on August 13, 2024

Huh, they are missing from 2.0.1 and newer...

https://unpkg.com/browse/@parcel/[email protected]/parcel_sourcemap_wasm/
https://unpkg.com/browse/@parcel/[email protected]/parcel_sourcemap_wasm/
https://unpkg.com/browse/@parcel/[email protected]/parcel_sourcemap_wasm/

from source-map.

mischnic avatar mischnic commented on August 13, 2024

Are you trying to use the Wasm version from Node or in the browser? Looks like we only build the browser version anyway (which works fine with version 2.0.0 and a bundler that uses the browser field in package.json)

To give more background to the delete question: the SourceMap wrapped object will be GCed, but not associated memory in the Wasm memory block. At some point in the future, we could use FinalizationRegistry to run delete automatically.

Another thing you need to do in the wasm version is await the init export

export const init: Promise<void> = typeof bindings.init === 'function' ? bindings.init() : Promise.resolve();

so that all other operations don't have to wait for the Wasm instance to be loaded and can be synchronous (= what top-level-await was built to solve).

from source-map.

cspotcode avatar cspotcode commented on August 13, 2024

Ok thanks. Yeah I was trying to use the wasm version from node. For my use-case, it's important that I automatically and silently fallback to a non-native binary in case the native binary fails in a target environment, so I was testing if that would work. I think the async bootstrapping might also be a deal-breaker, due to legacy constraints in my project, though I do understand why WASM often necessitates it in browsers.

I appreciate your taking the time to share this information, thank you.

from source-map.

mischnic avatar mischnic commented on August 13, 2024

The Wasm-in-Node usecase wasn't needed by anyone so far. But in Node, this could be implement without async as well (readFileSync + new WebAssembly.Module(buffer)).

from source-map.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.