Skip to content

Proposal: dependency system based on await import #1587

@FurryR

Description

@FurryR

Extensions are now able to require external libraries via await import. When the gallery starts, it downloads all dependencies (via acorn parser) and replace their URLs with downloaded data URLs.

Example code:

(async function (Scratch) {
  // Dynamic URLs are not supported.
  const editor = await import('https://cdn.jsdelivr.com/...');
})(Scratch);

After processing:

(async function (Scratch) {
  const editor = await import('data:text/javascript;base64,...');
})(Scratch);

There will be a cache directory to store downloaded dependencies so that you do not need to download them twice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions