Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1eed6a7
Add wp-env local environment
kadamwhite Jul 13, 2026
2bd18a1
Modernization plan: Put a stake in the ground to begin work
kadamwhite Jul 13, 2026
e56f285
Add back-compat considerations to migration plan
kadamwhite Jul 13, 2026
67c2afb
Add phased modernization execution plan
kadamwhite Jul 13, 2026
11ab55b
Add deterministic wp-env seeding for integration tests
kadamwhite Jul 13, 2026
9429975
Retarget integration tests at wp-env; refresh expectations for modern WP
kadamwhite Jul 13, 2026
b3a7438
Handle modern WP self-link shape in discover(); skip discover suite
kadamwhite Jul 13, 2026
81a811c
docs: add handoff.md; note block/FSE test-data expansion in backlog
kadamwhite Jul 13, 2026
9480518
Merge phase 0: green test baseline against wp-env
kadamwhite Jul 13, 2026
4113576
plan: make the GitHub Actions migration explicit
kadamwhite Jul 13, 2026
a2b3c43
build: replace webpack + Grunt + Babel with tsdown
kadamwhite Jul 14, 2026
e41ca7b
test: migrate Jest to Vitest
kadamwhite Jul 14, 2026
c67129f
lint: ESLint 4 + .eslintrc.js -> ESLint 9 flat config + Prettier
kadamwhite Jul 14, 2026
3431dc8
lint: apply eslint --fix and fix real eslint:recommended findings
kadamwhite Jul 14, 2026
e51eb98
chore: Node 18+ floor, drop IE11, commit lockfile, retire Travis
kadamwhite Jul 14, 2026
5c0953c
ci: add GitHub Actions ci.yml, scaffold release.yml
kadamwhite Jul 14, 2026
d8f2c37
docs: update handoff.md for Phase 1 completion
kadamwhite Jul 14, 2026
715d5fe
Merge phase 1: modern toolchain (still JS)
kadamwhite Jul 14, 2026
7400033
test: describe the Phase 2 transport contract (currently failing)
kadamwhite Jul 15, 2026
a27add2
fetch: rewrite transport on the platform-native fetch and FormData
kadamwhite Jul 15, 2026
892954d
superagent: remove the transport; stub the subpath with a migration e…
kadamwhite Jul 15, 2026
18e11c2
build: bind the fetch transport into the main export
kadamwhite Jul 15, 2026
4a52b87
php: fix enqueue hook name and __FILE__ constant
kadamwhite Jul 15, 2026
a32b33d
docs: update transport documentation for the fetch-based default
kadamwhite Jul 15, 2026
bdd6594
fetch: restore client-side method guard, reject HEAD errors, browser-…
kadamwhite Jul 15, 2026
7220ab0
wp-request: type-check .file() attachments; carry File names on Node 18
kadamwhite Jul 15, 2026
50906c1
build: alias wpapi/fetch to the main bundle; ship interim typings
kadamwhite Jul 15, 2026
b0070f8
chore: remaining review-pass fixes
kadamwhite Jul 15, 2026
28cfbbe
docs: update handoff.md for Phase 2 completion
kadamwhite Jul 15, 2026
75bda75
Merge phase 2: transport modernization + superagent removal
kadamwhite Jul 15, 2026
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
13 changes: 0 additions & 13 deletions .eslintignore

This file was deleted.

76 changes: 0 additions & 76 deletions .eslintrc.js

This file was deleted.

93 changes: 93 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI

on:
push:
branches: [ main ]
pull_request:

jobs:
# tsdown/rolldown require Node >=22.18 to run; vitest requires >=20. The
# published library itself only requires Node >=18 (see `engines` in
# package.json) — that promise is checked separately by `dist-smoke` below,
# against the pre-built output, without needing the build tooling to run.
test:
name: Lint, typecheck, build & unit test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 22, 24, latest ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm run build
- run: npm run test:unit
- if: matrix.node-version == 'latest'
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
retention-days: 1

dist-smoke:
name: Published dist works on Node ${{ matrix.node-version }}
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
node-version: [ 18, 20 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci --omit=dev
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- run: |
node -e "
const WPAPI = require('./dist/index.cjs');
const wp = new WPAPI({ endpoint: 'http://localhost/wp-json' });
if (typeof wp.posts !== 'function') throw new Error('CJS entry did not bootstrap');
if (typeof WPAPI.transport.get !== 'function') throw new Error('CJS entry has no bound transport');
"
node --input-type=module -e "
import WPAPI from './dist/index.mjs';
const wp = new WPAPI({ endpoint: 'http://localhost/wp-json' });
if (typeof wp.posts !== 'function') throw new Error('ESM entry did not bootstrap');
if (typeof WPAPI.transport.get !== 'function') throw new Error('ESM entry has no bound transport');
"
node -e "
try { require('./dist/superagent.cjs'); }
catch (e) { if (/wpapi.superagent was removed/.test(e.message)) process.exit(0); throw e; }
throw new Error('superagent stub did not throw its migration error');
"

integration:
name: Integration tests (wp-env)
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm run env:start
- run: npm run env:seed
- run: npm run test:integration
# `npm run env:logs` defaults to `--watch`, which never exits; pass
# `--no-watch` directly so this step prints once and completes.
- if: always()
run: npx @wordpress/env logs development --no-watch
- if: always()
run: npm run env:stop
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

# Scaffolded in Phase 1, replacing the local `release-npm` script; not yet
# exercised until publishing resumes (requires an `NPM_TOKEN` secret).
on:
release:
types: [ published ]

jobs:
publish:
name: Build, test & publish to npm
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
# tsdown/rolldown require Node >=22.18 to run the build itself.
node-version: 22
cache: npm
registry-url: https://registry.npmjs.org
- run: npm ci
- run: npm run lint
- run: npm run typecheck
- run: npm run build
- run: npm run test:unit
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,5 @@ documentation/index.html
*.sublime-*
.ruby-version

# Built files (for use in browser)
browser/

# Consuming applications should maintain their own lockfile.
package-lock.json
# Built files (tsdown output: ESM/CJS/UMD + .d.ts)
dist/
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"useTabs": true,
"singleQuote": true,
"semi": true,
"trailingComma": "all",
"printWidth": 90
}
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"port": 2747,
"testsEnvironment": false,
"config": {
"SCRIPT_DEBUG": true,
"WP_DEBUG_DISPLAY": false,
"WP_DEBUG": true,
"WP_DEVELOPMENT_MODE": "plugin"
},
"plugins": [
".",
"https://downloads.wordpress.org/plugin/query-monitor.zip",
"https://github.com/WP-API/Basic-Auth/archive/refs/heads/master.zip"
]
}
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Changelog

## v2.0.0 [**alpha**] _Second Toughest in the Infants_
## v2.0.0 [**unreleased**] _Second Toughest in the Infants_
- **BREAKING**: "Node-style" error-first callbacks (_e.g._ `.get( ( err, data ) => {} )`) are no longer supported. All transport request methods return Promises.
- **BREAKING**: The module exported as `wpapi` no longer includes HTTP methods. Install `superagent` as a peer dependency and `require( 'wpapi/superagent' )` in order to make HTTP requests.
- **BREAKING**: The minimum supported Node.js version is now v18; Internet Explorer is no longer supported.
- **BREAKING**: HTTP requests are made with the native `fetch` API. The superagent transport and the `wpapi/superagent` entrypoint introduced in the v2 alphas are removed; the default `wpapi` export makes HTTP requests out of the box again, with no additional dependencies. `wpapi/fetch` remains as an alias for the default export.
- **BREAKING**: Media uploads use native `FormData`/`Blob`. `.file()` accepts a file path (Node), a `Buffer` or `Blob` plus a file name, or a `File` object; streams are no longer supported. The multipart part's content type is no longer inferred from the file name (WordPress determines the type server-side from the name); pass a `Blob` or `File` with an explicit `type` to control it.
- **BREAKING**: Autodiscovery now either succeeds or fails; a WPAPI instance configured with default routes will no longer be returned.


Expand Down
21 changes: 0 additions & 21 deletions Gruntfile.js

This file was deleted.

Loading
Loading