oxc/wasm/parser
renovate[bot] 646cd1d1ab
chore(deps): update npm packages (#6164)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [express](http://expressjs.com/)
([source](https://redirect.github.com/expressjs/express)) | [`4.19.2` ->
`4.21.0`](https://renovatebot.com/diffs/npm/express/4.19.2/4.21.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/express/4.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/express/4.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/express/4.19.2/4.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/express/4.19.2/4.21.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [pnpm](https://pnpm.io)
([source](https://redirect.github.com/pnpm/pnpm)) | [`9.9.0` ->
`9.11.0`](https://renovatebot.com/diffs/npm/pnpm/9.9.0/9.11.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/pnpm/9.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/pnpm/9.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/pnpm/9.9.0/9.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/pnpm/9.9.0/9.11.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>expressjs/express (express)</summary>

###
[`v4.21.0`](https://redirect.github.com/expressjs/express/releases/tag/4.21.0)

[Compare
Source](https://redirect.github.com/expressjs/express/compare/4.20.0...4.21.0)

#### What's Changed

- Deprecate `"back"` magic string in redirects by
[@&#8203;blakeembrey](https://redirect.github.com/blakeembrey) in
[https://github.com/expressjs/express/pull/5935](https://redirect.github.com/expressjs/express/pull/5935)
- finalhandler@1.3.1 by
[@&#8203;wesleytodd](https://redirect.github.com/wesleytodd) in
[https://github.com/expressjs/express/pull/5954](https://redirect.github.com/expressjs/express/pull/5954)
- fix(deps): serve-static@1.16.2 by
[@&#8203;wesleytodd](https://redirect.github.com/wesleytodd) in
[https://github.com/expressjs/express/pull/5951](https://redirect.github.com/expressjs/express/pull/5951)
- Upgraded dependency qs to 6.13.0 to match qs in body-parser by
[@&#8203;agadzinski93](https://redirect.github.com/agadzinski93) in
[https://github.com/expressjs/express/pull/5946](https://redirect.github.com/expressjs/express/pull/5946)

#### New Contributors

- [@&#8203;agadzinski93](https://redirect.github.com/agadzinski93) made
their first contribution in
[https://github.com/expressjs/express/pull/5946](https://redirect.github.com/expressjs/express/pull/5946)

**Full Changelog**:
https://github.com/expressjs/express/compare/4.20.0...4.21.0

###
[`v4.20.0`](https://redirect.github.com/expressjs/express/blob/HEAD/History.md#4200--2024-09-10)

[Compare
Source](https://redirect.github.com/expressjs/express/compare/4.19.2...4.20.0)

\==========

-   deps: serve-static@0.16.0
    -   Remove link renderization in html while redirecting
-   deps: send@0.19.0
    -   Remove link renderization in html while redirecting
-   deps: body-parser@0.6.0
    -   add `depth` option to customize the depth level in the parser
- IMPORTANT: The default `depth` level for parsing URL-encoded data is
now `32` (previously was `Infinity`)
-   Remove link renderization in html while using `res.redirect`
-   deps: path-to-regexp@0.1.10
- Adds support for named matching groups in the routes using a regex
- Adds backtracking protection to parameters without regexes defined
-   deps: encodeurl@~2.0.0
- Removes encoding of `\`, `|`, and `^` to align better with URL spec
- Deprecate passing `options.maxAge` and `options.expires` to
`res.clearCookie`
- Will be ignored in v5, clearCookie will set a cookie with an expires
in the past to instruct clients to delete the cookie

</details>

<details>
<summary>pnpm/pnpm (pnpm)</summary>

###
[`v9.11.0`](https://redirect.github.com/pnpm/pnpm/compare/v9.10.0...v9.11.0)

[Compare
Source](https://redirect.github.com/pnpm/pnpm/compare/v9.10.0...v9.11.0)

###
[`v9.10.0`](https://redirect.github.com/pnpm/pnpm/releases/tag/v9.10.0):
pnpm 9.10

[Compare
Source](https://redirect.github.com/pnpm/pnpm/compare/v9.9.0...v9.10.0)

#### Minor Changes

- Support for a new CLI flag, `--exclude-peers`, added to the `list` and
`why` commands. When `--exclude-peers` is used, peer dependencies are
not printed in the results, but dependencies of peer dependencies are
still scanned
[#&#8203;8506](https://redirect.github.com/pnpm/pnpm/pull/8506).
- Added a new setting to `package.json` at
`pnpm.auditConfig.ignoreGhsas` for ignoring vulnerabilities by their
GHSA code
[#&#8203;6838](https://redirect.github.com/pnpm/pnpm/issues/6838).

    For instance:

    ```json
    {
      "pnpm": {
        "auditConfig": {
          "ignoreGhsas": [
            "GHSA-42xw-2xvc-qx8m",
            "GHSA-4w2v-q235-vp99",
            "GHSA-cph5-m8f7-6c5x",
            "GHSA-vh95-rmgr-6w4m"
          ]
        }
      }
    }
    ```

#### Patch Changes

-   Throw an exception if pnpm switches to the same version of itself.
-   Reduce memory usage during peer dependencies resolution.

#### Platinum Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a href="https://bit.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank"><img src="https://pnpm.io/img/users/bit.svg"
width="80"></a>
      </td>
      <td align="center" valign="middle">
<a href="https://figma.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank"><img src="https://pnpm.io/img/users/figma.svg"
width="80"></a>
      </td>
    </tr>
  </tbody>
</table>

#### Gold Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a href="https://discord.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/discord.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/discord_light.svg" />
<img src="https://pnpm.io/img/users/discord.svg" width="220" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://prisma.io/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/prisma.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/prisma_light.svg" />
<img src="https://pnpm.io/img/users/prisma.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://uscreen.de/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/uscreen.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/uscreen_light.svg" />
<img src="https://pnpm.io/img/users/uscreen.svg" width="180" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://www.jetbrains.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/jetbrains.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/jetbrains.svg" />
<img src="https://pnpm.io/img/users/jetbrains.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://nx.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/nx.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/nx_light.svg" />
            <img src="https://pnpm.io/img/users/nx.svg" width="120" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a
href="https://coderabbit.ai/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/coderabbit.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/coderabbit_light.svg" />
<img src="https://pnpm.io/img/users/coderabbit.svg" width="220" />
          </picture>
        </a>
      </td>
    </tr>
  </tbody>
</table>

#### Our Silver Sponsors

<table>
  <tbody>
    <tr>
      <td align="center" valign="middle">
<a
href="https://leniolabs.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <img src="https://pnpm.io/img/users/leniolabs.jpg" width="80">
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://vercel.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/vercel.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/vercel_light.svg" />
<img src="https://pnpm.io/img/users/vercel.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://depot.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/depot.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/depot_light.svg" />
<img src="https://pnpm.io/img/users/depot.svg" width="200" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://moonrepo.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/moonrepo.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/moonrepo_light.svg" />
<img src="https://pnpm.io/img/users/moonrepo.svg" width="200" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://devowl.io/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/devowlio.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/devowlio.svg" />
<img src="https://pnpm.io/img/users/devowlio.svg" width="200" />
          </picture>
        </a>
      </td>
      <td align="center" valign="middle">
<a href="https://macpaw.com/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/macpaw.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/macpaw_light.svg" />
<img src="https://pnpm.io/img/users/macpaw.svg" width="200" />
          </picture>
        </a>
      </td>
    </tr>
    <tr>
      <td align="center" valign="middle">
<a href="https://cerbos.dev/?utm_source=pnpm&utm_medium=release_notes"
target="_blank">
          <picture>
<source media="(prefers-color-scheme: light)"
srcset="https://pnpm.io/img/users/cerbos.svg" />
<source media="(prefers-color-scheme: dark)"
srcset="https://pnpm.io/img/users/cerbos_light.svg" />
<img src="https://pnpm.io/img/users/cerbos.svg" width="180" />
          </picture>
        </a>
      </td>
    </tr>
  </tbody>
</table>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC45Ny4wIiwidXBkYXRlZEluVmVyIjoiMzguOTcuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-09-29 09:48:23 +00:00
..
src refactor(wasm): add source_type for parser, replace class options with plain object (#5217) 2024-08-26 15:08:35 +08:00
.gitignore feat: setup wasm parser for npm (#2221) 2024-01-30 21:40:10 +08:00
Cargo.toml chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
CHANGELOG.md Release crates v0.26.0 (#5418) 2024-09-03 10:36:02 +08:00
package.json chore(deps): update npm packages (#6164) 2024-09-29 09:48:23 +00:00
README.md chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00
test-node.mjs chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00

About

Experimental wasm package for the oxc parser, with full TypeScript typings support.

This package is built with different wasm-pack's target builds:

  • wasm-pack build --target web for bundler (webpack / vite) consumption.
  • wasm-pack build --target nodejs for node.js

And exports the files as

"main": "./node/oxc_parser_wasm.js",
"browser": "./web/oxc_parser_wasm.js",
"types": "./node/oxc_parser_wasm.d.ts",

Checkout oxc-parser for usage in node.js via napi bindings.

Source code: https://github.com/oxc-project/oxc/tree/main/wasm/parser

Usage

import initWasm, { parseSync } from '@oxc-parser/wasm';

async function main() {
  await initWasm();

  const code = 'let foo';
  const result = parseSync(code, { sourceFilename: 'test.ts' });
  console.log(result);
}

main();

Notes

UTF8 vs UTF16 byte offsets

The span value returned from the ASTs and diagnostics is in UTF8 byte offsets. Converting to UTF16 byte offsets:

let sourceTextUtf8 = new TextEncoder().encode(sourceText);

const convertToUtf8 = (sourceTextUtf8, d) => {
  return new TextDecoder().decode(sourceTextUtf8.slice(0, d)).length;
};

const diagnostics = result.errors.map((d) => ({
  from: convertToUtf8(sourceTextUtf8, d.start),
  to: convertToUtf8(sourceTextUtf8, d.end),
  severity: d.severity.toLowerCase(),
  message: d.message,
}));

Vite

wasm-pack build --target web is used for the wasm build.

You may need something like https://github.com/nshen/vite-plugin-wasm-pack to get it working with vite, otherwise vite will load the wasm file as a HTML file causing a CompileError: WebAssembly.instantiate(): expected magic word error.