Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Jan 23, 2025
2 parents 6704130 + 5293db1 commit a040bec
Show file tree
Hide file tree
Showing 26 changed files with 695 additions and 102 deletions.
6 changes: 0 additions & 6 deletions .changeset/nine-maps-exist.md

This file was deleted.

9 changes: 6 additions & 3 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
"app-dir": "0.1.0",
"hack-the-supergraph-ssr": "0.1.0",
"apollo-next-13-demo": "0.1.0",
"@apollo/client-react-streaming": "0.11.7",
"@apollo/experimental-nextjs-app-support": "0.11.7",
"packages-shared": "0.0.0",
"@apollo/client-react-streaming": "0.11.8",
"@apollo/experimental-nextjs-app-support": "0.11.8",
"@apollo/client-integration-react-router": "0.11.8",
"@apollo/client-integration-tanstack-start": "0.11.8",
"@internal/test-utils": "0.0.0"
},
"changesets": ["nine-maps-exist"]
"changesets": []
}
17 changes: 17 additions & 0 deletions .github/workflows/knip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run Knip

on: push

jobs:
lint:
runs-on: ubuntu-latest
name: Ubuntu/Node v20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"
- run: yarn install --immutable --mode=skip-build
- run: yarn build:libs
- run: yarn knip
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
uses: changesets/action@v1
with:
version: yarn changeset-version
publish: yarn changeset publish
publish: yarn changeset-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ yalc.lock
.vercel
.next/
test-results/
temp/
temp/
.built
2 changes: 1 addition & 1 deletion examples/app-dir-experiments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"server-only": "^0.0.1",
"typescript": "5.4.5"
"typescript": "^5.7.3"
}
}
2 changes: 1 addition & 1 deletion examples/hack-the-supergraph-ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"react-dom": "^19.0.0",
"react-icons": "^4.8.0",
"react-rating-stars-component": "^2.2.0",
"typescript": "5.4.5"
"typescript": "^5.7.3"
},
"devDependencies": {
"@types/js-cookie": "3.0.6"
Expand Down
2 changes: 1 addition & 1 deletion examples/polls-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "3.3.2",
"typescript": "5.4.5"
"typescript": "^5.7.3"
},
"devDependencies": {
"@graphql-codegen/cli": "3.3.1",
Expand Down
16 changes: 9 additions & 7 deletions integration-test/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ __metadata:
peerDependencies:
react: ^19
react-router: ^7.0.2
checksum: 10/28afc59f9246f23d8e7f3a4cc622207b0d63a34d456174560043bc086514e75f55844a88ea0f4ea547b5f782b174adeafc62a4017dce72f251f6042056181f73
checksum: 10/e8d6af811d70f120e61f9c6ad3c518a892f75bbb3a84a83ba180c1ca65774660bc01313c053474ae605b0140744ce01f65cd469601180b996702027ddbe8d3c6
languageName: node
linkType: hard

Expand All @@ -59,19 +59,21 @@ __metadata:
peerDependencies:
"@tanstack/react-router": "*"
react: ^19
checksum: 10/7b6ec156bbd2ded3c049cf4d34cdec50fc2111399dd7fc81fe6d5087b27a931f054355b2e817795a8e401e8f73df4d5d61150ea1d28889987462c2c839a3e96a
checksum: 10/925e6f086df1f3d7a3fd0e60265dce1192a7666934b2ee35f545ffdb00f04463d0734649e9320094b195aaa8b327bd8520a38dd7436051413e97564183f83fda
languageName: node
linkType: hard

"@apollo/client-react-streaming@exec:./shared/build-client-react-streaming.cjs::locator=%40integration-test%2Froot%40workspace%3A.":
version: 0.11.8-alpha.1
version: 0.11.8
resolution: "@apollo/client-react-streaming@exec:./shared/build-client-react-streaming.cjs#./shared/build-client-react-streaming.cjs::hash=509995&locator=%40integration-test%2Froot%40workspace%3A."
dependencies:
ts-invariant: "npm:^0.10.3"
peerDependencies:
"@apollo/client": ^3.10.4
graphql: ^16 || >=17.0.0-alpha.2
react: ^18 || >=19.0.0-rc
checksum: 10/8328db2c32b7b940001af3810d49429969abe8cfa035b1f84c56b11a66e34e0f95443368f4acc5a2c3a05c71a6a4dba3cf091538c88dd36c4f13b7986df8e136
react-dom: ^18 || >=19.0.0-rc
checksum: 10/04dbf100bd75132b9ca2b9a00e35e31d89fb9b197339120b5469503a2e4908ec707e145e92cfcb44306b4b9db69c09fe4e10463b228530c7b3a9ac3b7b4500a2
languageName: node
linkType: hard

Expand Down Expand Up @@ -113,15 +115,15 @@ __metadata:
linkType: hard

"@apollo/experimental-nextjs-app-support@exec:./shared/build-experimental-nextjs-app-support.cjs::locator=%40integration-test%2Froot%40workspace%3A.":
version: 0.11.8-alpha.1
version: 0.11.8
resolution: "@apollo/experimental-nextjs-app-support@exec:./shared/build-experimental-nextjs-app-support.cjs#./shared/build-experimental-nextjs-app-support.cjs::hash=21ade4&locator=%40integration-test%2Froot%40workspace%3A."
dependencies:
"@apollo/client-react-streaming": "npm:0.11.8-alpha.1"
"@apollo/client-react-streaming": "npm:0.11.8"
peerDependencies:
"@apollo/client": ^3.10.4
next: ^13.4.1 || ^14.0.0 || ^15.0.0-rc.0
react: ^18 || >=19.0.0-rc
checksum: 10/3fd928dd4dbb08a20691d7642680d6dc3fc1cff98d48f3a027c1d9b1a5445d8a1579ca7e5740b71901c59212931fb8efd7ccc3d01b37c8976ccef1153f78daec
checksum: 10/a866cc1c43ff0358e7c4a7be793c1c73eb0f0078022cd86475fe375902378e1adfcf4ff7d672a6e365daaba812a0e7ca253af2315275146ddf283825ec1cb75e
languageName: node
linkType: hard

Expand Down
30 changes: 30 additions & 0 deletions knip.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// @ts-check

/** @type{import('knip').KnipConfig}*/
const config = {
workspaces: {
".": {
ignoreBinaries: ["jq", "playwright"],
ignoreDependencies: [/@size-limit\/.*/, "prettier"],
},
"packages/*": {
entry: ["**/*.test.{ts,tsx}"],
project: ["**/*.{ts,tsx}"],
},
"packages/client-react-streaming": {
entry: ["**/*.test.{ts,tsx}"],
project: ["**/*.{ts,tsx}"],
ignoreDependencies: ["tsx"],
},
},
ignore: [
"examples/**",
"integration-test/**",
"packages/test-utils/*.d.ts",
"scripts/**",
"packages/client-react-streaming/api-extractor.d.ts",
"packages/experimental-nextjs-app-support/api-extractor.d.ts",
],
};

export default config;
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"docs": "api-documenter markdown --input-folder temp --output-folder docs",
"build:libs": "yarn workspaces foreach --all --include \"@apollo/*\" run build",
"build:docmodel": "yarn workspaces foreach --all --include \"@apollo/*\" exec api-extractor run",
"changeset-publish": "yarn build:libs && changeset publish",
"changeset-version": "changeset version && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install --mode=skip-build && cd integration-test && YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install"
},
"resolutions": {
Expand All @@ -31,7 +32,10 @@
"@size-limit/file": "11.1.2",
"@size-limit/webpack": "11.1.2",
"@size-limit/webpack-why": "11.1.2",
"@types/node": "^22.10.9",
"knip": "^5.43.1",
"size-limit": "11.1.2",
"typescript": "^5.7.3",
"zx": "^8.2.4"
}
}
8 changes: 8 additions & 0 deletions packages/client-react-streaming/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @apollo/client-react-streaming

## 0.11.8

### Patch Changes

- 251bec9: Change package publishing to Changesets
- 2f779cd: Add missing `peerDependencies`: `react-dom` and `graphql`
18 changes: 9 additions & 9 deletions packages/client-react-streaming/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apollo/client-react-streaming",
"version": "0.11.8-alpha.1",
"version": "0.11.8",
"repository": {
"url": "git+https://github.com/apollographql/apollo-client-nextjs.git"
},
Expand Down Expand Up @@ -114,15 +114,14 @@
"README.md"
],
"scripts": {
"build": "rimraf dist; tsup",
"build": "rimraf dist .built; tsup && touch .built",
"test": "concurrently -c auto \"yarn:test:*(!base) $@\"",
"test:base": "TSX_TSCONFIG_PATH=./tsconfig.tests.json node --import tsx/esm --no-warnings --test \"$@\" src/**/*.test.(ts|tsx)",
"test:ssr": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=node\" yarn run test:base",
"test:browser": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=browser\" yarn run test:base",
"test:rsc": "NODE_OPTIONS=\"${NODE_OPTIONS:-} --conditions=react-server\" yarn run test:base",
"prepack": "yarn build",
"prepublishOnly": "yarn pack -o attw.tgz && attw attw.tgz && rm attw.tgz && yarn run test",
"postpublish": "touch .published",
"test-bundle": "yarn test-bundle:attw && yarn test-bundle:package && yarn test-bundle:publint && yarn test-bundle:shape",
"test-bundle:attw": "attw --pack .",
"test-bundle:package": "yarn workspace monorepo verify-package-json $PWD/package.json",
Expand All @@ -140,29 +139,30 @@
"@testing-library/react": "^16.1.0",
"@total-typescript/shoehorn": "0.1.2",
"@tsconfig/recommended": "1.0.6",
"@types/eslint": "^9.6.1",
"@types/node": "20.12.11",
"@types/react": "^19.0.0",
"concurrently": "8.2.2",
"esbuild": "^0.24.2",
"eslint": "8.57.0",
"glob": "10.3.12",
"global-jsdom": "24.0.0",
"globstar": "1.0.0",
"graphql": "16.8.1",
"jsdom": "24.0.0",
"publint": "0.2.7",
"react": "^19.0.0",
"react-error-boundary": "4.0.13",
"react-server-dom-webpack": "^19.0.0",
"rimraf": "5.0.5",
"ts-node": "10.9.2",
"tsup": "8.0.2",
"tsx": "4.7.1",
"typescript": "5.4.5",
"vitest": "1.6.0"
"typescript": "^5.7.3",
"zen-observable-ts": "1.1.0"
},
"peerDependencies": {
"@apollo/client": "^3.10.4",
"react": "^18 || >=19.0.0-rc"
"graphql": "^16 || >=17.0.0-alpha.2",
"react": "^18 || >=19.0.0-rc",
"react-dom": "^18 || >=19.0.0-rc"
},
"dependencies": {
"ts-invariant": "^0.10.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
mergeIncrementalData,
} from "@apollo/client/utilities/index.js";

export interface AccumulateMultipartResponsesConfig {
interface AccumulateMultipartResponsesConfig {
/**
* The maximum delay in milliseconds
* from receiving the first response
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense, use, useMemo } from "rehackt";
import React, { Suspense, use, useMemo } from "react";
import { outsideOf } from "@internal/test-utils/runInConditions.js";
import assert from "node:assert";
import test, { afterEach, describe } from "node:test";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,22 @@ function getQueryManager(
return client["queryManager"];
}

declare class Trie<Data> {
constructor(weakness?: boolean, makeData?: (array: any[]) => Data);
lookup<T extends any[]>(...array: T): Data;
lookupArray<T extends IArguments | any[]>(array: T): Data;
peek<T extends any[]>(...array: T): Data | undefined;
peekArray<T extends IArguments | any[]>(array: T): Data | undefined;
remove(...array: any[]): Data | undefined;
removeArray<T extends IArguments | any[]>(array: T): Data | undefined;
}

/**
* Returns the `Trie` constructor without adding a direct dependency on `@wry/trie`.
*/
function getTrieConstructor(client: OrigApolloClient<unknown>) {
return getQueryManager(client)["inFlightLinkObservables"]
.constructor as typeof import("@wry/trie").Trie;
.constructor as typeof Trie;
}

type SimulatedQueryInfo = {
Expand Down Expand Up @@ -113,7 +123,7 @@ class ApolloClientBase extends OrigApolloClient<NormalizedCacheObject> {
}
}

export class ApolloClientClientBaseImpl extends ApolloClientBase {
class ApolloClientClientBaseImpl extends ApolloClientBase {
constructor(options: WrappedApolloClientOptions) {
super(options);
this.onQueryStarted = this.onQueryStarted.bind(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { registerDataTransport } from "./dataTransport.js";
import { revive, stringify } from "./serialization.js";
import { ApolloHookRehydrationCache } from "./ApolloRehydrateSymbols.js";

export interface ManualDataTransportOptions {
interface ManualDataTransportOptions {
/**
* A hook that allows for insertion into the stream.
* Will only be called during SSR, doesn't need to actiually return something otherwise.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const ESCAPE_LOOKUP: { [match: string]: string } = {
"\u2029": "\\u2029",
};

export const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
const ESCAPE_REGEX = /[&><\u2028\u2029]/g;

export function htmlEscapeJsonString(str: string): string {
return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import type { Cache, WatchQueryOptions } from "@apollo/client/index.js";
import type React from "react";
import type { DataTransport } from "./dataTransport.js";
import type { QueryEvent } from "@apollo/client-react-streaming";

export type RehydrationCache = Record<string, unknown>;
export type ResultsCache = DataTransport<Cache.WriteOptions>;
export type BackgroundQueriesCache = DataTransport<WatchQueryOptions>;

export interface RehydrationContextValue {
/**
Expand Down
1 change: 0 additions & 1 deletion packages/client-react-streaming/src/helperTypes.ts

This file was deleted.

10 changes: 10 additions & 0 deletions packages/experimental-nextjs-app-support/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# @apollo/experimental-nextjs-app-support

## 0.11.8

### Patch Changes

- 251bec9: Change package publishing to Changesets
- Updated dependencies [251bec9]
- Updated dependencies [2f779cd]
- @apollo/client-react-streaming@0.11.8
Loading

0 comments on commit a040bec

Please sign in to comment.