Skip to content
This repository was archived by the owner on Sep 2, 2023. It is now read-only.
This repository was archived by the owner on Sep 2, 2023. It is now read-only.

Tooling: Brainstorming ideas that can lead to efficient loader-oriented designs #203

Closed
@SMotaal

Description

@SMotaal

Having both ecmascript-modules and @jkrems hackable loader has opened up tremendous scope for experimentation.

Note: This thread does not make claims for or against existing tooling, some of which have stood the test of time, evolved, and are fixtures of the ecosystem. The intent is simply to consider different perspectives being explored in experimental efforts.

As far as things go, the broad range of tooling that applies to loaders basically iterates over productions in each source, irrespective of the specifics of implementation or operations.

Most tools are designed to be used for much more complex applications than merely loading. To that effect, they often avoid the use of new language features that would prevent them from working on older platforms. They can also avoid new features which may have been prematurely associated with inefficiencies in early stages. Some are also built with infrastructures or features that are not ideal or not optimized specifically for loading, like using workers, verbose error checking (ie as a language service)... etc.

I would like to dedicate this thread to brainstorming experimental or just different ideas to implement related patterns for loader-first designs.

Brainstorming: A safe place to discuss ideas and provide constructive feedback

How to contribute

Please avoid emoting that can be confusing (especially if it can construed as passively aggressive)

😄 Indication
👍 To indicate a "Yes" response
👎 To indicate a "No" response
🎉 To indicate a "Aha" moment

Read the Digest

The following is a set of ideas or conclusions curated from the discussions:

Syntax Detection (CJS vs ESM)

  • Safely using RegExp — @SMotaal

    • requires guarding against string hijacking — @devsnek
    • recommend using acorn instead — @devsnek
  • Fallback for ESM without import and export@targos

    • shouldn't use import(…) to resolve ambiguity — @bmeck
    • can use import.meta@bmeck
  • Dual parsing a module was deemed inefficient — @MylesBorins

Syntax Identification (CJS vs ESM)

  • Mime type meta data via something like webpackage — @jkrems

  • Magic bytes — @jkrems

Wrapping CJS in an ESM module system

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions