Skip to content

Conversation

@43081j
Copy link
Contributor

@43081j 43081j commented Dec 10, 2025

This is a first attempt at the new version of the schema.

The major change here is that we'd go from having an array of many
replacements, to one entry per source module with many replacements.

For example:

{
  "type": "module",
  "moduleName": "chalk",
  "replacements": [
    {
      "type": "native",
      "engines": [
        { "engine": "node", "minVersion": "X.Y.Z" }
      ],
      "url": { "type": "node", "id": "styleText" },
      "description": "The `styleText` built-in provides [...]"
    }
  ]
}

This is a first attempt at the new version of the schema.

The major change here is that we'd go from having an array of many
replacements, to one entry per source module with many replacements.

For example:

```ts
{
  "type": "module",
  "moduleName": "chalk",
  "replacements": [
    {
      "type": "native",
      "engines": [
        { "engine": "node", "minVersion": "X.Y.Z" }
      ],
      "url": { "type": "node", "id": "styleText" },
      "description": "The `styleText` built-in provides [...]"
    }
  ]
}
```
@43081j
Copy link
Contributor Author

43081j commented Dec 12, 2025

i now added sync scripts to use runtime compat data, and web feature data

so we have this engines populated from the web features data:

        {
          "type": "native",
          "webFeatureId": "fetch",
          "engines": [
            {
              "engine": "chrome",
              "minVersion": "42"
            },
            {
              "engine": "chrome_android",
              "minVersion": "42"
            },
            {
              "engine": "edge",
              "minVersion": "14"
            },
            {
              "engine": "firefox",
              "minVersion": "39"
            },
            {
              "engine": "firefox_android",
              "minVersion": "39"
            },
            {
              "engine": "safari",
              "minVersion": "10.1"
            },
            {
              "engine": "safari_ios",
              "minVersion": "10.3"
            }
          ],
          "url": {
            "type": "mdn",
            "id": "Web/API/Fetch_API"
          },
          "description": "Use native fetch"
        },

and this from the runtime data:

        {
          "type": "native",
          "nodeFeatureId": {
            "moduleName": "node:buffer",
            "exportName": "Buffer"
          },
          "engines": [
            {
              "engine": "cloudflare",
              "minVersion": "24.9.0"
            },
            {
              "engine": "deno",
              "minVersion": "24.9.0"
            },
            {
              "engine": "vercel",
              "minVersion": "24.9.0"
            },
            {
              "engine": "netlify",
              "minVersion": "24.9.0"
            }
          ],
          "url": {
            "type": "e18e",
            "id": "buf-compare"
          },
          "description": "Use native Buffer.compare"
        }

@43081j
Copy link
Contributor Author

43081j commented Jan 15, 2026

so i dont forget:

  • we should have two top-level collections
    • one is the replacements (mappings of module to its replacements)
    • one is the targets (things we replace those modules with, i.e. what we mapped to)
  • a replacement mapping's modules are just a set of IDs we later lookup from the targets list
  • we need some representation of which replacements are "preferred"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants