diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 000000000..f16ab3c63 --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,19 @@ +{ + "mode": "pre", + "tag": "next", + "initialVersions": { + "@headstartwp/core": "1.2.0", + "@10up/react-hooks": "1.2.3", + "@headstartwp/next": "1.2.0", + "@10up/next-redis-cache-provider": "0.2.0", + "@10up/headless-docs": "1.0.0", + "@10up/wp-multisite-i18n-nextjs": "0.2.0", + "@10up/wp-multisite-nextjs": "0.2.0", + "@10up/wp-nextjs": "0.2.0", + "@10up/wp-nextjs-ts": "0.2.1-next.2", + "@headstartwp/headstartwp": "1.0.12" + }, + "changesets": [ + "wicked-bats-lay" + ] +} diff --git a/.changeset/serious-feet-kick.md b/.changeset/serious-feet-kick.md new file mode 100644 index 000000000..84d903dab --- /dev/null +++ b/.changeset/serious-feet-kick.md @@ -0,0 +1,5 @@ +--- +"@headstartwp/headstartwp": patch +--- + +Override Yoast head values to fix seo data for search results page. diff --git a/.changeset/sweet-gorillas-admire.md b/.changeset/sweet-gorillas-admire.md deleted file mode 100644 index 70c5f7069..000000000 --- a/.changeset/sweet-gorillas-admire.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@headstartwp/headstartwp": patch ---- - -Added - New filter available tenup_headless_wp_revalidate_isr_for_post diff --git a/.changeset/wicked-bats-lay.md b/.changeset/wicked-bats-lay.md new file mode 100644 index 000000000..f22081fb6 --- /dev/null +++ b/.changeset/wicked-bats-lay.md @@ -0,0 +1,5 @@ +--- +"@10up/next-redis-cache-provider": major +--- + +Suport for >= Next.js 13.5 diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 0fee8fb8b..aac067c22 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 cache: npm - name: Install dependencies run: npm install diff --git a/.github/workflows/eslint.yml b/.github/workflows/eslint.yml index 0f16de5b4..1eaaea5d4 100644 --- a/.github/workflows/eslint.yml +++ b/.github/workflows/eslint.yml @@ -8,14 +8,14 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [20.x] steps: - name: Checkout uses: actions/checkout@v2 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} diff --git a/.github/workflows/nextjs_bundle_analysis.yml b/.github/workflows/nextjs_bundle_analysis.yml index 38c220cba..89df7fa90 100644 --- a/.github/workflows/nextjs_bundle_analysis.yml +++ b/.github/workflows/nextjs_bundle_analysis.yml @@ -19,9 +19,9 @@ jobs: - uses: actions/checkout@v2 - name: Set up node - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: - node-version: '16.x' + node-version: '20.x' - name: Install dependencies uses: bahmutov/npm-install@v1 @@ -86,7 +86,7 @@ jobs: body="${body//'%'/'%25'}" body="${body//$'\n'/'%0A'}" body="${body//$'\r'/'%0D'}" - echo ::set-output name=body::$body + echo "body=$body" >> $GITHUB_OUTPUT - name: Find Comment uses: peter-evans/find-comment@v1 diff --git a/.github/workflows/npm-release-next-version.yml b/.github/workflows/npm-release-next-version.yml index 0f510f27a..f1a7a99ea 100644 --- a/.github/workflows/npm-release-next-version.yml +++ b/.github/workflows/npm-release-next-version.yml @@ -15,10 +15,10 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - - name: Setup Node.js 16.x - uses: actions/setup-node@v2 + - name: Setup Node.js + uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 20.x - name: Install Dependencies run: npm ci diff --git a/.github/workflows/release-latest-version.yml b/.github/workflows/release-latest-version.yml index 6ee339125..e928076b3 100644 --- a/.github/workflows/release-latest-version.yml +++ b/.github/workflows/release-latest-version.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 - - name: Setup Node.js 16.x - uses: actions/setup-node@v2 + - name: Setup Node.js + uses: actions/setup-node@v3 with: - node-version: 16.x + node-version: 20.x - name: Install Dependencies run: npm ci diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index b517dc359..9f620daa9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v2 - name: Setup Node ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile index 8163b6b2e..8c00642d5 100644 --- a/.gitpod.Dockerfile +++ b/.gitpod.Dockerfile @@ -1,5 +1,5 @@ FROM gitpod/workspace-full:latest -RUN bash -c ". .nvm/nvm.sh && nvm install 16 && nvm use 16 && nvm alias default 16" +RUN bash -c ". .nvm/nvm.sh && nvm install 20 && nvm use 20 && nvm alias default 20" RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix \ No newline at end of file diff --git a/.gitpod.yml b/.gitpod.yml index 5ce6be58e..e3987e386 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,6 +1,15 @@ image: file: .gitpod.Dockerfile tasks: + - name: Start Redis Stack + init: | + docker-compose pull + command: | + alias redis-cli="docker exec -it redis-stack redis-cli" + echo "Use redis-cli to interact with Redis here." + docker-compose up -d + gp sync-done finished + openMode: split-left - name: Start dev server init: npm install command: npm run dev \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..0b2ee6ae0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +version: "3.9" +services: + redis: + container_name: redis-stack + image: redis/redis-stack:latest + ports: + - "6379:6379" \ No newline at end of file diff --git a/docs/package-lock.json b/docs/package-lock.json index 404455d76..f43c3bc27 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -6431,9 +6431,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "funding": [ { "type": "individual", @@ -17659,9 +17659,9 @@ } }, "follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==" }, "fork-ts-checker-webpack-plugin": { "version": "6.5.2", diff --git a/package-lock.json b/package-lock.json index e2e890f37..068f17926 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4267,13 +4267,14 @@ } }, "node_modules/@next/env": { - "version": "13.4.4", - "license": "MIT" + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.1.0.tgz", + "integrity": "sha512-Py8zIo+02ht82brwwhTg36iogzFqGLPXlRGKQw5s+qP/kMNc4MAyDeEwBKDijk6zTIbegEgu8Qy7C1LboslQAw==" }, "node_modules/@next/swc-darwin-arm64": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-13.4.4.tgz", - "integrity": "sha512-xfjgXvp4KalNUKZMHmsFxr1Ug+aGmmO6NWP0uoh4G3WFqP/mJ1xxfww0gMOeMeSq/Jyr5k7DvoZ2Pv+XOITTtw==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.1.0.tgz", + "integrity": "sha512-nUDn7TOGcIeyQni6lZHfzNoo9S0euXnu0jhsbMOmMJUBfgsnESdjN97kM7cBqQxZa8L/bM9om/S5/1dzCrW6wQ==", "cpu": [ "arm64" ], @@ -4286,9 +4287,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.4.4.tgz", - "integrity": "sha512-ZY9Ti1hkIwJsxGus3nlubIkvYyB0gNOYxKrfsOrLEqD0I2iCX8D7w8v6QQZ2H+dDl6UT29oeEUdDUNGk4UEpfg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.1.0.tgz", + "integrity": "sha512-1jgudN5haWxiAl3O1ljUS2GfupPmcftu2RYJqZiMJmmbBT5M1XDffjUtRUzP4W3cBHsrvkfOFdQ71hAreNQP6g==", "cpu": [ "x64" ], @@ -4301,9 +4302,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.4.4.tgz", - "integrity": "sha512-+KZnDeMShYkpkqAvGCEDeqYTRADJXc6SY1jWXz+Uo6qWQO/Jd9CoyhTJwRSxvQA16MoYzvILkGaDqirkRNctyA==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.1.0.tgz", + "integrity": "sha512-RHo7Tcj+jllXUbK7xk2NyIDod3YcCPDZxj1WLIYxd709BQ7WuRYl3OWUNG+WUfqeQBds6kvZYlc42NJJTNi4tQ==", "cpu": [ "arm64" ], @@ -4316,9 +4317,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.4.4.tgz", - "integrity": "sha512-evC1twrny2XDT4uOftoubZvW3EG0zs0ZxMwEtu/dDGVRO5n5pT48S8qqEIBGBUZYu/Xx4zzpOkIxx1vpWdE+9A==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.1.0.tgz", + "integrity": "sha512-v6kP8sHYxjO8RwHmWMJSq7VZP2nYCkRVQ0qolh2l6xroe9QjbgV8siTbduED4u0hlk0+tjS6/Tuy4n5XCp+l6g==", "cpu": [ "arm64" ], @@ -4331,11 +4332,12 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "13.4.4", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.1.0.tgz", + "integrity": "sha512-zJ2pnoFYB1F4vmEVlb/eSe+VH679zT1VdXlZKX+pE66grOgjmKJHKacf82g/sWE4MQ4Rk2FMBCRnX+l6/TVYzQ==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -4345,11 +4347,12 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "13.4.4", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.1.0.tgz", + "integrity": "sha512-rbaIYFt2X9YZBSbH/CwGAjbBG2/MrACCVu2X0+kSykHzHnYH5FjHxwXLkcoJ10cX0aWCEynpu+rP76x0914atg==", "cpu": [ "x64" ], - "license": "MIT", "optional": true, "os": [ "linux" @@ -4359,9 +4362,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.4.4.tgz", - "integrity": "sha512-FP8AadgSq4+HPtim7WBkCMGbhr5vh9FePXiWx9+YOdjwdQocwoCK5ZVC3OW8oh3TWth6iJ0AXJ/yQ1q1cwSZ3A==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.1.0.tgz", + "integrity": "sha512-o1N5TsYc8f/HpGt39OUQpQ9AKIGApd3QLueu7hXk//2xq5Z9OxmV6sQfNp8C7qYmiOlHYODOGqNNa0e9jvchGQ==", "cpu": [ "arm64" ], @@ -4374,9 +4377,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.4.4.tgz", - "integrity": "sha512-3WekVmtuA2MCdcAOrgrI+PuFiFURtSyyrN1I3UPtS0ckR2HtLqyqmS334Eulf15g1/bdwMteePdK363X/Y9JMg==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.1.0.tgz", + "integrity": "sha512-XXIuB1DBRCFwNO6EEzCTMHT5pauwaSj4SWs7CYnME57eaReAKBXCnkUE80p/pAZcewm7hs+vGvNqDPacEXHVkw==", "cpu": [ "ia32" ], @@ -4389,9 +4392,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "13.4.4", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.4.tgz", - "integrity": "sha512-AHRITu/CrlQ+qzoqQtEMfaTu7GHaQ6bziQln/pVWpOYC1wU+Mq6VQQFlsDtMCnDztPZtppAXdvvbNS7pcfRzlw==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.1.0.tgz", + "integrity": "sha512-9WEbVRRAqJ3YFVqEZIxUqkiO8l1nool1LmNxygr5HWF8AcSYsEpneUDhmjUVJEzO2A04+oPtZdombzzPPkTtgg==", "cpu": [ "x64" ], @@ -4499,8 +4502,9 @@ } }, "node_modules/@swc/helpers": { - "version": "0.5.1", - "license": "Apache-2.0", + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.2.tgz", + "integrity": "sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==", "dependencies": { "tslib": "^2.4.0" } @@ -7128,7 +7132,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001482", + "version": "1.0.30001579", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001579.tgz", + "integrity": "sha512-u5AUVkixruKHJjw/pj9wISlcMpgFWzSrczLZbrqBSxukQixmg0SJ5sZTpvaFvxU0HoQKd4yoyAogyrAz9pzJnA==", "funding": [ { "type": "opencollective", @@ -7142,8 +7148,7 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ], - "license": "CC-BY-4.0" + ] }, "node_modules/capital-case": { "version": "1.0.4", @@ -15621,14 +15626,15 @@ "license": "ISC" }, "node_modules/nanoid": { - "version": "3.3.6", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "bin": { "nanoid": "bin/nanoid.cjs" }, @@ -15679,37 +15685,37 @@ "license": "MIT" }, "node_modules/next": { - "version": "13.4.4", - "license": "MIT", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/next/-/next-14.1.0.tgz", + "integrity": "sha512-wlzrsbfeSU48YQBjZhDzOwhWhGsy+uQycR8bHAOt1LY1bn3zZEcDyHQOEoN3aWzQ8LHCAJ1nqrWCc9XF2+O45Q==", "dependencies": { - "@next/env": "13.4.4", - "@swc/helpers": "0.5.1", + "@next/env": "14.1.0", + "@swc/helpers": "0.5.2", "busboy": "1.6.0", - "caniuse-lite": "^1.0.30001406", - "postcss": "8.4.14", - "styled-jsx": "5.1.1", - "zod": "3.21.4" + "caniuse-lite": "^1.0.30001579", + "graceful-fs": "^4.2.11", + "postcss": "8.4.31", + "styled-jsx": "5.1.1" }, "bin": { "next": "dist/bin/next" }, "engines": { - "node": ">=16.8.0" + "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "13.4.4", - "@next/swc-darwin-x64": "13.4.4", - "@next/swc-linux-arm64-gnu": "13.4.4", - "@next/swc-linux-arm64-musl": "13.4.4", - "@next/swc-linux-x64-gnu": "13.4.4", - "@next/swc-linux-x64-musl": "13.4.4", - "@next/swc-win32-arm64-msvc": "13.4.4", - "@next/swc-win32-ia32-msvc": "13.4.4", - "@next/swc-win32-x64-msvc": "13.4.4" + "@next/swc-darwin-arm64": "14.1.0", + "@next/swc-darwin-x64": "14.1.0", + "@next/swc-linux-arm64-gnu": "14.1.0", + "@next/swc-linux-arm64-musl": "14.1.0", + "@next/swc-linux-x64-gnu": "14.1.0", + "@next/swc-linux-x64-musl": "14.1.0", + "@next/swc-win32-arm64-msvc": "14.1.0", + "@next/swc-win32-ia32-msvc": "14.1.0", + "@next/swc-win32-x64-msvc": "14.1.0" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", - "fibers": ">= 3.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", "sass": "^1.3.0" @@ -15718,9 +15724,6 @@ "@opentelemetry/api": { "optional": true }, - "fibers": { - "optional": true - }, "sass": { "optional": true } @@ -17078,7 +17081,9 @@ } }, "node_modules/postcss": { - "version": "8.4.14", + "version": "8.4.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz", + "integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==", "funding": [ { "type": "opencollective", @@ -17087,11 +17092,14 @@ { "type": "tidelift", "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" } ], - "license": "MIT", "dependencies": { - "nanoid": "^3.3.4", + "nanoid": "^3.3.6", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -18729,7 +18737,8 @@ }, "node_modules/source-map-js": { "version": "1.0.2", - "license": "BSD-3-Clause", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", "engines": { "node": ">=0.10.0" } @@ -21473,16 +21482,9 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/zod": { - "version": "3.21.4", - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/colinhacks" - } - }, "packages/core": { "name": "@headstartwp/core", - "version": "1.1.2", + "version": "1.2.0", "license": "MIT", "dependencies": { "@justinribeiro/lite-youtube": "^1.3.1", @@ -21873,10 +21875,10 @@ }, "packages/next": { "name": "@headstartwp/next", - "version": "1.1.6", + "version": "1.2.0", "license": "MIT", "dependencies": { - "@headstartwp/core": "^1.1.2", + "@headstartwp/core": "^1.2.0", "deepmerge": "^4.3.1", "loader-utils": "^3.2.0", "schema-utils": "^4.0.0" @@ -21901,7 +21903,7 @@ }, "packages/next-redis-cache-provider": { "name": "@10up/next-redis-cache-provider", - "version": "0.1.5", + "version": "0.2.0", "license": "MIT", "dependencies": { "ioredis": "^5.3.1" @@ -22039,15 +22041,15 @@ "version": "0.2.0", "license": "GPL-2.0-or-later", "dependencies": { - "@headstartwp/core": "^1.1.2", - "@headstartwp/next": "^1.1.6", + "@headstartwp/core": "^1.2.0", + "@headstartwp/next": "^1.2.0", "@linaria/babel-preset": "^4.4.5", "@linaria/core": "^4.2.10", "@linaria/react": "^4.3.8", "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", @@ -22068,15 +22070,15 @@ "version": "0.2.0", "license": "GPL-2.0-or-later", "dependencies": { - "@headstartwp/core": "^1.1.2", - "@headstartwp/next": "^1.1.6", + "@headstartwp/core": "^1.2.0", + "@headstartwp/next": "^1.2.0", "@linaria/babel-preset": "^4.4.5", "@linaria/core": "^4.2.10", "@linaria/react": "^4.3.8", "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", @@ -22097,16 +22099,16 @@ "version": "0.2.0", "license": "GPL-2.0-or-later", "dependencies": { - "@10up/next-redis-cache-provider": "^0.1.5", - "@headstartwp/core": "^1.1.2", - "@headstartwp/next": "^1.1.6", + "@10up/next-redis-cache-provider": "^0.2.0", + "@headstartwp/core": "^1.2.0", + "@headstartwp/next": "^1.2.0", "@linaria/babel-preset": "^4.4.5", "@linaria/core": "^4.2.10", "@linaria/react": "^4.3.8", "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", @@ -22127,15 +22129,15 @@ "version": "0.2.1-next.2", "license": "GPL-2.0-or-later", "dependencies": { - "@headstartwp/core": "^1.1.2", - "@headstartwp/next": "^1.1.6", + "@headstartwp/core": "^1.2.0", + "@headstartwp/next": "^1.2.0", "@linaria/babel-preset": "^4.4.5", "@linaria/core": "^4.2.10", "@linaria/react": "^4.3.8", "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", @@ -22153,7 +22155,7 @@ }, "wp/headless-wp": { "name": "@headstartwp/headstartwp", - "version": "1.0.10", + "version": "1.0.12", "license": "GPL-2.0-or-later", "devDependencies": { "@wordpress/env": "^5.14.0" diff --git a/package.json b/package.json index ad8cad075..c1b5aa9d7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "build:packages": "turbo run build --filter=./packages/*", "build:wpnextjs": "npm run build:packages && turbo run build --filter=./projects/wp-nextjs", "test": "npm run build:packages && turbo run test", - "lint": "eslint .", + "lint": "turbo run lint", "wp-env": "npm run wp-env:start -w=wp/headless-wp", "nextjs:dev": "turbo run dev --parallel --filter=!./projects/wp-multisite-nextjs --filter=!./projects/wp-multisite-i18n-nextjs --filter=!./projects/wp-nextjs-ts", "nextjs:dev-multisite": "turbo run dev --parallel --filter=!./projects/wp-nextjs", diff --git a/packages/core/.lintstagedrc.json b/packages/core/.lintstagedrc.json new file mode 100644 index 000000000..7a9d31767 --- /dev/null +++ b/packages/core/.lintstagedrc.json @@ -0,0 +1,8 @@ +{ + "*.[tj]s": [ + "eslint" + ], + "*.[tj]sx": [ + "eslint" + ] +} \ No newline at end of file diff --git a/packages/hooks/.lintstagedrc.json b/packages/hooks/.lintstagedrc.json new file mode 100644 index 000000000..7a9d31767 --- /dev/null +++ b/packages/hooks/.lintstagedrc.json @@ -0,0 +1,8 @@ +{ + "*.[tj]s": [ + "eslint" + ], + "*.[tj]sx": [ + "eslint" + ] +} \ No newline at end of file diff --git a/packages/next-redis-cache-provider/.lintstagedrc.json b/packages/next-redis-cache-provider/.lintstagedrc.json new file mode 100644 index 000000000..7a9d31767 --- /dev/null +++ b/packages/next-redis-cache-provider/.lintstagedrc.json @@ -0,0 +1,8 @@ +{ + "*.[tj]s": [ + "eslint" + ], + "*.[tj]sx": [ + "eslint" + ] +} \ No newline at end of file diff --git a/packages/next-redis-cache-provider/CHANGELOG.md b/packages/next-redis-cache-provider/CHANGELOG.md index ee42698ca..0169f7e18 100644 --- a/packages/next-redis-cache-provider/CHANGELOG.md +++ b/packages/next-redis-cache-provider/CHANGELOG.md @@ -1,5 +1,11 @@ # @10up/next-redis-cache-provider +## 1.0.0-next.0 + +### Major Changes + +- 6956fbb8: Suport for >= Next.js 13.5 + ## 0.2.0 ### Minor Changes diff --git a/packages/next-redis-cache-provider/package.json b/packages/next-redis-cache-provider/package.json index 3a7e3b840..8e406775e 100644 --- a/packages/next-redis-cache-provider/package.json +++ b/packages/next-redis-cache-provider/package.json @@ -1,6 +1,6 @@ { "name": "@10up/next-redis-cache-provider", - "version": "0.2.0", + "version": "1.0.0-next.0", "description": "Redis cache provider for Next.js", "homepage": "https://github.com/10up/headstartwp/blob/develop/packages/next-redis-cache-provider/README.md", "license": "MIT", diff --git a/packages/next-redis-cache-provider/src/index.ts b/packages/next-redis-cache-provider/src/index.ts index 901c8805a..1a8671fe5 100644 --- a/packages/next-redis-cache-provider/src/index.ts +++ b/packages/next-redis-cache-provider/src/index.ts @@ -2,8 +2,8 @@ import { CacheHandler, CacheHandlerContext, CacheHandlerValue, + IncrementalCache, } from 'next/dist/server/lib/incremental-cache'; -import { IncrementalCacheValue } from 'next/dist/server/response-cache'; import Redis from 'ioredis'; import { CacheFs } from 'next/dist/shared/lib/utils'; import path from 'path'; @@ -87,6 +87,8 @@ export default class RedisCache implements CacheHandler { this.redisClient = this.getRedisClient(); } + resetRequestCache(): void {} + /** * Builds a Redis Client based on the environment variables * @@ -129,8 +131,11 @@ export default class RedisCache implements CacheHandler { } } - public async get(key: string, fetchCache?: boolean): Promise { - if (fetchCache) { + public async get( + ...args: Parameters + ): Promise { + const [key, ctx] = args; + if (ctx?.fetchIdx || ctx?.fetchUrl) { return null; } @@ -152,12 +157,10 @@ export default class RedisCache implements CacheHandler { return JSON.parse(value) as CacheHandlerValue; } - public async set( - key: string, - data: IncrementalCacheValue | null, - fetchCache?: boolean, - ): Promise { - if (!this.flushToDisk || !data || fetchCache) return; + public async set(...args: Parameters): Promise { + const [key, data, ctx] = args; + + if (!this.flushToDisk || !data || ctx.fetchCache) return; // get build id and connect to redis const [BUILD_ID] = await Promise.all([ diff --git a/packages/next/.lintstagedrc.json b/packages/next/.lintstagedrc.json new file mode 100644 index 000000000..7a9d31767 --- /dev/null +++ b/packages/next/.lintstagedrc.json @@ -0,0 +1,8 @@ +{ + "*.[tj]s": [ + "eslint" + ], + "*.[tj]sx": [ + "eslint" + ] +} \ No newline at end of file diff --git a/projects/wp-multisite-i18n-nextjs/package.json b/projects/wp-multisite-i18n-nextjs/package.json index 7aaf6d7ea..26fb6a659 100644 --- a/projects/wp-multisite-i18n-nextjs/package.json +++ b/projects/wp-multisite-i18n-nextjs/package.json @@ -22,7 +22,7 @@ "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", diff --git a/projects/wp-multisite-nextjs/package.json b/projects/wp-multisite-nextjs/package.json index ae24d90ea..ee88038d3 100644 --- a/projects/wp-multisite-nextjs/package.json +++ b/projects/wp-multisite-nextjs/package.json @@ -22,7 +22,7 @@ "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", diff --git a/projects/wp-nextjs-ts/package.json b/projects/wp-nextjs-ts/package.json index 4e791b48a..f289f202a 100644 --- a/projects/wp-nextjs-ts/package.json +++ b/projects/wp-nextjs-ts/package.json @@ -22,7 +22,7 @@ "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", diff --git a/projects/wp-nextjs/next.config.js b/projects/wp-nextjs/next.config.js index 409473160..a1a9f944c 100644 --- a/projects/wp-nextjs/next.config.js +++ b/projects/wp-nextjs/next.config.js @@ -32,8 +32,6 @@ if (process.env.NEXT_REDIS_URL || process.env.VIP_REDIS_PRIMARY) { // eslint-disable-next-line global-require const { initRedisClient } = require('@10up/next-redis-cache-provider'); initRedisClient(); - nextConfig.experimental = { - incrementalCacheHandlerPath: require.resolve('@10up/next-redis-cache-provider'), - }; + nextConfig.cacheHandler = require.resolve('@10up/next-redis-cache-provider'); } module.exports = withBundleAnalyzer(withHeadstartWPConfig(nextConfig)); diff --git a/projects/wp-nextjs/package.json b/projects/wp-nextjs/package.json index 9488b4c85..beb3b7022 100644 --- a/projects/wp-nextjs/package.json +++ b/projects/wp-nextjs/package.json @@ -16,14 +16,14 @@ "dependencies": { "@headstartwp/core": "^1.2.0", "@headstartwp/next": "^1.2.0", - "@10up/next-redis-cache-provider": "^0.2.0", + "@10up/next-redis-cache-provider": "^1.0.0-next.0", "@linaria/babel-preset": "^4.4.5", "@linaria/core": "^4.2.10", "@linaria/react": "^4.3.8", "@linaria/shaker": "^4.2.11", "@linaria/webpack-loader": "^4.1.17", "clsx": "^1.1.1", - "next": "^13.4.4", + "next": "^14.1.0", "nprogress": "^0.2.0", "prop-types": "^15.7.2", "react": "^18.2.0", diff --git a/wp/headless-wp/.wp-env.json b/wp/headless-wp/.wp-env.json index c69a89308..157fcfa70 100644 --- a/wp/headless-wp/.wp-env.json +++ b/wp/headless-wp/.wp-env.json @@ -2,7 +2,7 @@ "plugins": [ ".", "../local-plugin", - "https://downloads.wordpress.org/plugin/wordpress-seo.19.14.zip", - "https://downloads.wordpress.org/plugin/safe-redirect-manager.1.11.1.zip" + "https://downloads.wordpress.org/plugin/wordpress-seo.21.8.1.zip", + "https://downloads.wordpress.org/plugin/safe-redirect-manager.2.1.1.zip" ] } diff --git a/wp/headless-wp/CHANGELOG.md b/wp/headless-wp/CHANGELOG.md index 8893da8e1..1866c96ce 100644 --- a/wp/headless-wp/CHANGELOG.md +++ b/wp/headless-wp/CHANGELOG.md @@ -1,5 +1,17 @@ # @headstartwp/headstartwp +## 1.0.12 + +### Patch Changes + +- f18be490: Ensure htmlspecialchars receives an empty string instead of null to fix deprecation warnings. + +## 1.0.11 + +### Patch Changes + +- 18d09388: Added - New filter available tenup_headless_wp_revalidate_isr_for_post + ## 1.0.10 ### Patch Changes diff --git a/wp/headless-wp/includes/classes/API.php b/wp/headless-wp/includes/classes/API.php index a2ad7dea4..9dbc678b9 100644 --- a/wp/headless-wp/includes/classes/API.php +++ b/wp/headless-wp/includes/classes/API.php @@ -98,7 +98,7 @@ public function modify_rest_params( $args, $request ) { return $args; } - $author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) ); + $author = htmlspecialchars( filter_input( INPUT_GET, 'author' ) ?? '' ); if ( ! empty( $author ) && ! is_numeric( $author ) ) { unset( $args['author__in'] ); @@ -108,10 +108,10 @@ public function modify_rest_params( $args, $request ) { $taxonomies = wp_list_filter( get_object_taxonomies( $args['post_type'], 'objects' ), [ 'show_in_rest' => true ] ); foreach ( $taxonomies as $taxonomy ) { - $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) ); + $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->name ) ?? '' ); if ( ! $term ) { - $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) ); + $term = htmlspecialchars( filter_input( INPUT_GET, $taxonomy->rest_base ) ?? '' ); } if ( ! empty( $term ) && ! is_numeric( $term ) ) { diff --git a/wp/headless-wp/includes/classes/Integrations/YoastSEO.php b/wp/headless-wp/includes/classes/Integrations/YoastSEO.php index 6ba76dd8b..a126a2c3c 100644 --- a/wp/headless-wp/includes/classes/Integrations/YoastSEO.php +++ b/wp/headless-wp/includes/classes/Integrations/YoastSEO.php @@ -27,6 +27,12 @@ public function register() { add_filter( 'wpseo_sitemap_url', array( $this, 'maybe_override_sitemap_url' ), 10, 2 ); add_filter( 'robots_txt', array( $this, 'maybe_override_sitemap_robots_url' ), 999999 ); + + // Override Search results yoast head, get_head endpoint currently does't detect search page. + add_filter( 'wpseo_canonical', array( $this, 'override_search_canonical' ), 10, 1 ); + add_filter( 'wpseo_title', array( $this, 'override_search_title' ), 10, 1 ); + add_filter( 'wpseo_opengraph_title', array( $this, 'override_search_title' ), 10, 1 ); + add_filter( 'wpseo_opengraph_url', array( $this, 'override_search_canonical' ), 10, 1 ); } /** @@ -162,4 +168,118 @@ public function maybe_override_sitemap_robots_url( $output ) { return $output; } + + /** + * Return list of query vars if the request is /yoast/v1/get_head?url and for search URL based on ?s= parameter. + * + * @return boolean|array False if it's not a yoast search rest api request. Search $query_vars if otherwise. + */ + public function get_yoast_search_query_vars() { + + if ( ! ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { + return false; + } + + $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; // phpcs:ignore + + if ( false === strpos( $request_uri, '/yoast/v1/get_head' ) ) { + return false; + } + + $url_param = isset( $_GET['url'] ) ? esc_url( wp_unslash( $_GET['url'] ) ) : ''; // phpcs:ignore + + if ( filter_var( $url_param, FILTER_VALIDATE_URL ) !== false ) { + $query = wp_parse_url( $url_param, PHP_URL_QUERY ); + parse_str( $query, $query_vars ); + + // Return query vars if search request. + if ( isset( $query_vars['s'] ) ) { + // Get page number into the query vars to build the title. + preg_match( '/\/page\/(\d+)/', $url_param, $matches ); + if ( ! empty( $matches ) ) { + $query_vars['page'] = (int) $matches[1]; + } + + return apply_filters( 'tenup_headless_wp_search_request_query_vars', $query_vars ); + } + } + + return false; + } + + /** + * Custom helper to replace Yoast search title placeholders. + * Assuming only some of the basic variables. + * + * @param string $title The search SEO title + * @param array $query_vars The search query vars. + * + * @return string + */ + public function replace_yoast_search_title_placeholders( $title, $query_vars ) { + + $str_replace_mapping = apply_filters( + 'tenup_headless_wp_search_title_variables_replacments', + array( + '%%sitename%%' => get_bloginfo( 'name' ), + '%%searchphrase%%' => $query_vars['s'] ?? '', + ' %%page%%' => ! empty( $query_vars['page'] ) ? sprintf( ' %s %d', __( 'Page', 'headless-wp' ), $query_vars['page'] ) : '', + '%%sep%%' => \YoastSEO()->helpers->options->get_title_separator() ?? ' ', + ) + ); + + return str_replace( array_keys( $str_replace_mapping ), array_values( $str_replace_mapping ), $title ); + } + + /** + * Set the missing Yoast Search title. + * + * @param string $title The title. + * @return string + */ + public function override_search_title( $title ) { + + $search_request_query_vars = $this->get_yoast_search_query_vars(); + + if ( ! $search_request_query_vars ) { + return $title; + } + + $wpseo_titles = get_option( 'wpseo_titles' ); + + $title_search_wpseo = ''; + + // Get user setting for search title, fallback to default search from Yoast SEO. + if ( ! empty( $wpseo_titles ) && ! empty( $wpseo_titles['title-search-wpseo'] ) ) { + $title_search_wpseo = $wpseo_titles['title-search-wpseo']; + } else { + $default_titles = \WPSEO_Option_Titles::get_instance()->get_defaults(); + if ( ! empty( $default_titles['title-search-wpseo'] ) ) { + $title_search_wpseo = $default_titles['title-search-wpseo']; + } + } + + if ( empty( $title_search_wpseo ) ) { + return $title; + } + + return $this->replace_yoast_search_title_placeholders( $title_search_wpseo, $search_request_query_vars ); + } + + /** + * Yoast doesn't have a canonical for search and returns URL as the homepage URL. Generally https://gus.test/?s=test + * But with headstartwp nextjs app usually there is a route for search page. + * Default is 'search'. + * + * @param string $canonical The canonical URL. + * @return string + */ + public function override_search_canonical( $canonical ) { + if ( $this->get_yoast_search_query_vars() ) { + $search_route = apply_filters( 'tenup_headless_wp_search_route', 'search' ); + $canonical = rtrim( $canonical, '/' ) . '/' . $search_route; + } + + return $canonical; + } } diff --git a/wp/headless-wp/package.json b/wp/headless-wp/package.json index f30ab277b..623b309dc 100644 --- a/wp/headless-wp/package.json +++ b/wp/headless-wp/package.json @@ -1,6 +1,6 @@ { "name": "@headstartwp/headstartwp", - "version": "1.0.10", + "version": "1.0.12", "private": true, "description": "10up Headless WordPress Plugin", "homepage": "https://github.com/10up/headstartwp/blob/develop/wp/headless-wp/README.md", diff --git a/wp/headless-wp/plugin.php b/wp/headless-wp/plugin.php index fa67b7544..e17caa302 100644 --- a/wp/headless-wp/plugin.php +++ b/wp/headless-wp/plugin.php @@ -3,7 +3,7 @@ * Plugin Name: HeadstartWP * Plugin URI: https://github.com/10up/headstartwp-plugin * Description: Adds functionality to the WordPress admin and REST API for 10up's headless framework. - * Version: 1.0.10 + * Version: 1.0.12 * Author: 10up * Author URI: https://10up.com * Text Domain: headstartwp @@ -17,7 +17,7 @@ use HeadlessWP\Preview\PreviewToken; // Useful global constants. -define( 'HEADLESS_WP_PLUGIN_VERSION', '1.0.10' ); +define( 'HEADLESS_WP_PLUGIN_VERSION', '1.0.12' ); define( 'HEADLESS_WP_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'HEADLESS_WP_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); define( 'HEADLESS_WP_PLUGIN_INC', HEADLESS_WP_PLUGIN_PATH . 'includes/' );