Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions deps/undici/src/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "test/web-platform-tests/wpt"]
path = test/web-platform-tests/wpt
url = https://github.com/web-platform-tests/wpt.git
[submodule "test/fixtures/cache-tests"]
path = test/fixtures/cache-tests
url = https://github.com/http-tests/cache-tests
48 changes: 32 additions & 16 deletions deps/undici/src/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,34 +94,50 @@ Create a commit which includes all of the updated files in lib/llhttp.

`undici` runs a subset of the [`web-platform-tests`](https://github.com/web-platform-tests/wpt).

### Requirements:
- [Node core utils](https://github.com/nodejs/node-core-utils) setup with credentials.

To update every test, run the following commands. Typically you would only need to update the tests in a specific directory.
### Steps:

```bash
git node wpt resources
git node wpt interfaces
git node wpt common
git node wpt fetch
git node wpt xhr
git node wpt websockets
git node wpt mimesniff
git node wpt storage
git node wpt service-workers
git node wpt eventsource
git submodule update --init --recursive
```

#### Run the tests
### Run the tests

Run the tests to ensure that any new failures are marked as such.

You can mark tests as failing in their corresponding [status](./test/wpt/status) file.
Before running the tests for the first time, you must setup the testing environment.
```bash
cd test/web-platform-tests
node wpt-runner.mjs setup
```

To run all tests:

```bash
npm run test:wpt
```

To run a subset of tests:
```bash
cd test/web-platform-tests
node wpt-runner.mjs run [filter] [filterb]
```

To run a single file:
```bash
cd test/web-platform-tests
node wpt-runner.mjs run /path/to/test
```

### Debugging

Verbose logging can be enabled by setting the [`NODE_DEBUG`](https://nodejs.org/api/cli.html#node_debugmodule) flag:

```bash
npx cross-env NODE_DEBUG=UNDICI_WPT node --run test:wpt
```

(`npx cross-env` can be omitted on Linux and Mac)

<a id="lint"></a>
### Lint

Expand Down
2 changes: 1 addition & 1 deletion deps/undici/src/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# undici

[![Node CI](https://github.com/nodejs/undici/actions/workflows/nodejs.yml/badge.svg)](https://github.com/nodejs/undici/actions/workflows/nodejs.yml) [![neostandard javascript style](https://img.shields.io/badge/neo-standard-7fffff?style=flat\&labelColor=ff80ff)](https://github.com/neostandard/neostandard) [![npm version](https://badge.fury.io/js/undici.svg)](https://badge.fury.io/js/undici) [![codecov](https://codecov.io/gh/nodejs/undici/branch/main/graph/badge.svg?token=yZL6LtXkOA)](https://codecov.io/gh/nodejs/undici)
[![Node CI](https://github.com/nodejs/undici/actions/workflows/ci.yml/badge.svg)](https://github.com/nodejs/undici/actions/workflows/nodejs.yml) [![neostandard javascript style](https://img.shields.io/badge/neo-standard-7fffff?style=flat\&labelColor=ff80ff)](https://github.com/neostandard/neostandard) [![npm version](https://badge.fury.io/js/undici.svg)](https://badge.fury.io/js/undici) [![codecov](https://codecov.io/gh/nodejs/undici/branch/main/graph/badge.svg?token=yZL6LtXkOA)](https://codecov.io/gh/nodejs/undici)

An HTTP/1.1 client, written from scratch for Node.js.

Expand Down
20 changes: 16 additions & 4 deletions deps/undici/src/build/wasm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

const WASM_BUILDER_CONTAINER = 'ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970' // v0.0.9

const { execSync } = require('node:child_process')
const { execSync, execFileSync } = require('node:child_process')
const { writeFileSync, readFileSync } = require('node:fs')
const { join, resolve } = require('node:path')

Expand Down Expand Up @@ -69,10 +69,10 @@ if (process.argv[2] === '--docker') {
}

const hasApk = (function () {
try { execSync('command -v apk'); return true } catch (error) { return false }
try { execSync('command -v apk'); return true } catch { return false }
})()
const hasOptimizer = (function () {
try { execSync(`${WASM_OPT} --version`); return true } catch (error) { return false }
try { execSync(`${WASM_OPT} --version`); return true } catch { return false }
})()
if (hasApk) {
// Gather information about the tools used for the build
Expand Down Expand Up @@ -104,7 +104,19 @@ ${join(WASM_SRC, 'src')}/*.c \
${WASM_LDLIBS}`, { stdio: 'inherit' })

if (hasOptimizer) {
execSync(`${WASM_OPT} ${WASM_OPT_FLAGS} --enable-simd -o ${join(WASM_OUT, 'llhttp_simd.wasm')} ${join(WASM_OUT, 'llhttp_simd.wasm')}`, { stdio: 'inherit' })
// Split WASM_OPT_FLAGS into an array, if not empty
const wasmOptFlagsArray = WASM_OPT_FLAGS ? WASM_OPT_FLAGS.split(/\s+/).filter(Boolean) : []
execFileSync(
WASM_OPT,
[
...wasmOptFlagsArray,
'--enable-simd',
'-o',
join(WASM_OUT, 'llhttp_simd.wasm'),
join(WASM_OUT, 'llhttp_simd.wasm')
],
{ stdio: 'inherit' }
)
}
writeWasmChunk('llhttp_simd.wasm', 'llhttp_simd-wasm.js')

Expand Down
Loading
Loading