ImageScript icon indicating copy to clipboard operation
ImageScript copied to clipboard

[FR] Are there any plans to allow custom CDN URLs for WASM files?

Open Vizards opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe. Thank you for your excellent work so far!

As we know, users in some internal or special networks may have difficulty accessing some static files provided by third-party CDNs. All utility functions under the browser branch of ImageScript have hardcoded WASM resource files from unpkg.com. It would be helpful to provide a configuration function to customize the location of the WASM resources.

Another potential issue is that the current WASM version of ImageScript seems to only provide the final JavaScript file for deployment. Is there any plan to release a separate npm package for the browser branch?

Describe the solution you'd like

  • The expected WASM file configuration API might be similar to the way vercel/satori embeds yoga.wasm: Runtime and WASM. The difference is that we seem to need to configure more WASM files. Currently, I can find the following in the code:

    • https://unpkg.com/imagescript@${version}/wasm/any/font.wasm
    • https://unpkg.com/imagescript@${version}/wasm/any/gif.wasm
    • https://unpkg.com/imagescript@${version}/wasm/any/jpeg.wasm
    • https://unpkg.com/imagescript@${version}/wasm/any/svg.wasm
    • https://unpkg.com/imagescript@${version}/wasm/any/tiff.wasm
    • ...(any omissions?)
  • For releasing the browser branch separately to npm, I would like to hear more of your opinions.

Additional context If needed, I am happy to arrange time to develop this feature and submit a Pull Request.

Vizards avatar Aug 09 '24 09:08 Vizards