diff --git a/.changeset/brown-doors-tan.md b/.changeset/brown-doors-tan.md new file mode 100644 index 0000000000..c263bc0b0b --- /dev/null +++ b/.changeset/brown-doors-tan.md @@ -0,0 +1,10 @@ +--- +'@urql/exchange-graphcache': patch +'@urql/exchange-execute': patch +'@urql/core': patch +'next-urql': patch +'@urql/svelte': patch +'@urql/vue': patch +--- + +Fix type-generation, with a change in TS/Rollup the type generation took the paths as src and resolved them into the types dir diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18e6ea11a9..fcc572fbe5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,7 +94,7 @@ jobs: run: pnpm install --frozen-lockfile --prefer-offline - name: Build - run: pnpm -F urql build + run: pnpm -F @urql/core build && pnpm -F urql build - name: e2e tests 🧪 uses: cypress-io/github-action@v4 diff --git a/exchanges/auth/package.json b/exchanges/auth/package.json index 30dcc2b7d7..a31053793f 100644 --- a/exchanges/auth/package.json +++ b/exchanges/auth/package.json @@ -55,6 +55,7 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "publishConfig": { diff --git a/exchanges/auth/tsconfig.json b/exchanges/auth/tsconfig.json index c850fbab08..596e2cf729 100644 --- a/exchanges/auth/tsconfig.json +++ b/exchanges/auth/tsconfig.json @@ -1,15 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "target": "es2019", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/context/package.json b/exchanges/context/package.json index c3349aef65..abb57c6e61 100644 --- a/exchanges/context/package.json +++ b/exchanges/context/package.json @@ -54,6 +54,7 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "publishConfig": { diff --git a/exchanges/context/tsconfig.json b/exchanges/context/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/context/tsconfig.json +++ b/exchanges/context/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/execute/package.json b/exchanges/execute/package.json index 06e78d01d8..7e3e0600e1 100644 --- a/exchanges/execute/package.json +++ b/exchanges/execute/package.json @@ -55,6 +55,7 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "publishConfig": { diff --git a/exchanges/execute/tsconfig.json b/exchanges/execute/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/execute/tsconfig.json +++ b/exchanges/execute/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/graphcache/default-storage/package.json b/exchanges/graphcache/default-storage/package.json index 912f77a329..14d9a46c04 100644 --- a/exchanges/graphcache/default-storage/package.json +++ b/exchanges/graphcache/default-storage/package.json @@ -16,7 +16,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@urql/core": ">=3.0.5", + "@urql/core": ">=3.1.0", "wonka": "^6.0.0" } } diff --git a/exchanges/graphcache/package.json b/exchanges/graphcache/package.json index 0160b95266..17d91e7f76 100644 --- a/exchanges/graphcache/package.json +++ b/exchanges/graphcache/package.json @@ -70,13 +70,14 @@ }, "devDependencies": { "@cypress/react": "^7.0.1", - "@urql/exchange-execute": "*", - "@urql/introspection": "*", + "@urql/core": "workspace:@urql/core@*", + "@urql/exchange-execute": "workspace:@urql/exchange-execute@*", + "@urql/introspection": "workspace:@urql/introspection@*", "cypress": "^11.1.0", "graphql": "^16.0.0", "react": "^17.0.1", "react-dom": "^17.0.1", - "urql": "*" + "urql": "workspace:urql@*" }, "publishConfig": { "access": "public" diff --git a/exchanges/graphcache/src/cacheExchange.ts b/exchanges/graphcache/src/cacheExchange.ts index 481e3e1ead..89412840b3 100644 --- a/exchanges/graphcache/src/cacheExchange.ts +++ b/exchanges/graphcache/src/cacheExchange.ts @@ -111,6 +111,7 @@ export const cacheExchange = >( // This registers queries with the data layer to ensure commutativity const prepareForwardedOperation = (operation: Operation) => { + operation.context.bakka + {}; if (operation.kind === 'query') { // Pre-reserve the position of the result layer reserveLayer(store.data, operation.key); diff --git a/exchanges/graphcache/tsconfig.json b/exchanges/graphcache/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/graphcache/tsconfig.json +++ b/exchanges/graphcache/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/multipart-fetch/package.json b/exchanges/multipart-fetch/package.json index f80c3cb835..a0a332fe16 100644 --- a/exchanges/multipart-fetch/package.json +++ b/exchanges/multipart-fetch/package.json @@ -54,6 +54,7 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "publishConfig": { diff --git a/exchanges/multipart-fetch/tsconfig.json b/exchanges/multipart-fetch/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/multipart-fetch/tsconfig.json +++ b/exchanges/multipart-fetch/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/persisted-fetch/package.json b/exchanges/persisted-fetch/package.json index 833f0a732c..91d2994979 100644 --- a/exchanges/persisted-fetch/package.json +++ b/exchanges/persisted-fetch/package.json @@ -53,6 +53,7 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "publishConfig": { diff --git a/exchanges/persisted-fetch/tsconfig.json b/exchanges/persisted-fetch/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/persisted-fetch/tsconfig.json +++ b/exchanges/persisted-fetch/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/populate/package.json b/exchanges/populate/package.json index 9fefdc66af..a506ad17cb 100644 --- a/exchanges/populate/package.json +++ b/exchanges/populate/package.json @@ -53,6 +53,7 @@ "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "publishConfig": { diff --git a/exchanges/populate/tsconfig.json b/exchanges/populate/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/populate/tsconfig.json +++ b/exchanges/populate/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/refocus/package.json b/exchanges/refocus/package.json index b7941032f2..6e25c2219d 100644 --- a/exchanges/refocus/package.json +++ b/exchanges/refocus/package.json @@ -48,6 +48,7 @@ "prepublishOnly": "run-s clean build" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "@types/react": "^17.0.4", "graphql": "^16.0.0" }, diff --git a/exchanges/refocus/tsconfig.json b/exchanges/refocus/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/refocus/tsconfig.json +++ b/exchanges/refocus/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/request-policy/package.json b/exchanges/request-policy/package.json index 197dbb0f8c..a8432c0bee 100644 --- a/exchanges/request-policy/package.json +++ b/exchanges/request-policy/package.json @@ -47,6 +47,7 @@ "prepublishOnly": "run-s clean build" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "peerDependencies": { diff --git a/exchanges/request-policy/tsconfig.json b/exchanges/request-policy/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/request-policy/tsconfig.json +++ b/exchanges/request-policy/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/exchanges/retry/package.json b/exchanges/retry/package.json index 82e88366cb..45d486e399 100644 --- a/exchanges/retry/package.json +++ b/exchanges/retry/package.json @@ -47,6 +47,7 @@ "prepublishOnly": "run-s clean build" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0" }, "peerDependencies": { diff --git a/exchanges/retry/tsconfig.json b/exchanges/retry/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/exchanges/retry/tsconfig.json +++ b/exchanges/retry/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/introspection/tsconfig.json b/packages/introspection/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/introspection/tsconfig.json +++ b/packages/introspection/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/next-urql/package.json b/packages/next-urql/package.json index eec2f32d48..b697b4604c 100644 --- a/packages/next-urql/package.json +++ b/packages/next-urql/package.json @@ -31,6 +31,8 @@ "prepublishOnly": "run-s clean build" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", + "urql": "workspace:urql@*", "@types/enzyme": "^3.10.3", "@types/enzyme-adapter-react-16": "^1.0.5", "@types/node-fetch": "^2.5.4", diff --git a/packages/next-urql/tsconfig.json b/packages/next-urql/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/next-urql/tsconfig.json +++ b/packages/next-urql/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/preact-urql/package.json b/packages/preact-urql/package.json index ef55b48379..13e8f9690d 100644 --- a/packages/preact-urql/package.json +++ b/packages/preact-urql/package.json @@ -48,6 +48,7 @@ "prepublishOnly": "run-s clean build" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "@testing-library/preact": "^2.0.0", "graphql": "^16.0.0", "preact": "^10.5.5" diff --git a/packages/preact-urql/tsconfig.json b/packages/preact-urql/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/preact-urql/tsconfig.json +++ b/packages/preact-urql/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/react-urql/package.json b/packages/react-urql/package.json index 0a83aa6918..cbdd76690f 100644 --- a/packages/react-urql/package.json +++ b/packages/react-urql/package.json @@ -46,6 +46,7 @@ "@testing-library/react-hooks": "^5.1.2", "@types/react": "^17.0.4", "@types/react-test-renderer": "^17.0.1", + "@urql/core": "workspace:@urql/core@*", "cypress": "^11.1.0", "graphql": "^16.0.0", "react": "^17.0.1", diff --git a/packages/react-urql/src/context.ts b/packages/react-urql/src/context.ts index 19d2950e67..39edbcd5dc 100644 --- a/packages/react-urql/src/context.ts +++ b/packages/react-urql/src/context.ts @@ -5,9 +5,12 @@ import { Client, createClient } from '@urql/core'; // but not to error catastrophically if someone is just playing around const defaultClient = createClient({ url: '/graphql' }); -export const Context = createContext(defaultClient); -export const Provider = Context.Provider; -export const Consumer = Context.Consumer; +export const Context: import('react').Context = createContext( + defaultClient +); +export const Provider: import('react').Provider = Context.Provider; +export const Consumer: import('react').Consumer = Context.Consumer; + Context.displayName = 'UrqlContext'; let hasWarnedAboutDefault = false; diff --git a/packages/react-urql/tsconfig.json b/packages/react-urql/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/react-urql/tsconfig.json +++ b/packages/react-urql/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/storage-rn/package.json b/packages/storage-rn/package.json index 186cab687b..87ac75a100 100644 --- a/packages/storage-rn/package.json +++ b/packages/storage-rn/package.json @@ -53,7 +53,8 @@ "@react-native-community/netinfo": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" }, "devDependencies": { - "@urql/exchange-graphcache": "*", + "@urql/core": "workspace:@urql/core@*", + "@urql/exchange-graphcache": "workspace:@urql/exchange-graphcache@*", "@react-native-async-storage/async-storage": "^1.15.5", "@react-native-community/netinfo": "^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" }, diff --git a/packages/storage-rn/tsconfig.json b/packages/storage-rn/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/storage-rn/tsconfig.json +++ b/packages/storage-rn/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/storybook-addon/package.json b/packages/storybook-addon/package.json index 56d38d81d8..398e2905b0 100644 --- a/packages/storybook-addon/package.json +++ b/packages/storybook-addon/package.json @@ -48,15 +48,16 @@ "@storybook/preact": ">=6.0.28", "@storybook/react": ">=6.0.28", "@types/webpack-env": "^1.15.3", + "@urql/core": "workspace:@urql/core@*", "@urql/devtools": "^2.0.2", - "@urql/preact": ">=3.0.0", + "@urql/preact": "workspace:@urql/preact@*", "graphql": "^16.0.0", "preact": "^10.5.5", "react": "^17.0.2", "react-dom": "^17.0.2", "react-is": "^17.0.2", "typescript": ">=4.7.3", - "urql": ">=3.0.0", + "urql": "workspace:urql@*", "webpack": ">=4.4.6", "wonka": "^6.0.0" }, diff --git a/packages/storybook-addon/tsconfig.json b/packages/storybook-addon/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/storybook-addon/tsconfig.json +++ b/packages/storybook-addon/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/svelte-urql/package.json b/packages/svelte-urql/package.json index 1fd2af63cf..3f6543add1 100644 --- a/packages/svelte-urql/package.json +++ b/packages/svelte-urql/package.json @@ -56,6 +56,7 @@ "wonka": "^6.0.0" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0", "svelte": "^3.20.0" }, diff --git a/packages/svelte-urql/tsconfig.json b/packages/svelte-urql/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/svelte-urql/tsconfig.json +++ b/packages/svelte-urql/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/packages/vue-urql/package.json b/packages/vue-urql/package.json index 5357370eac..03580cf861 100644 --- a/packages/vue-urql/package.json +++ b/packages/vue-urql/package.json @@ -48,6 +48,7 @@ "prepublishOnly": "run-s clean build" }, "devDependencies": { + "@urql/core": "workspace:@urql/core@*", "graphql": "^16.0.0", "vue": "^3.0.11" }, diff --git a/packages/vue-urql/tsconfig.json b/packages/vue-urql/tsconfig.json index a5a3089a64..596e2cf729 100644 --- a/packages/vue-urql/tsconfig.json +++ b/packages/vue-urql/tsconfig.json @@ -1,14 +1,4 @@ { "extends": "../../tsconfig.json", - "include": ["src"], - "compilerOptions": { - "baseUrl": "./", - "paths": { - "urql": ["../../packages/react-urql/src"], - "*-urql": ["../../packages/*-urql/src"], - "@urql/exchange-*": ["../../exchanges/*/src"], - "@urql/core/*": ["../../packages/core/src/*"], - "@urql/*": ["../../packages/*-urql/src", "../../packages/*/src"] - } - } + "include": ["src"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4ce297ab93..48f542817c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -155,13 +155,13 @@ importers: specifiers: '@cypress/react': ^7.0.1 '@urql/core': '>=3.1.0' - '@urql/exchange-execute': '*' - '@urql/introspection': '*' + '@urql/exchange-execute': workspace:@urql/exchange-execute@* + '@urql/introspection': workspace:@urql/introspection@* cypress: ^11.1.0 graphql: ^16.0.0 react: ^17.0.2 react-dom: ^17.0.2 - urql: '*' + urql: workspace:urql@* wonka: ^6.1.2 dependencies: '@urql/core': link:../../packages/core @@ -268,6 +268,7 @@ importers: '@types/node-fetch': ^2.5.4 '@types/react': ^17.0.39 '@types/react-dom': ^17.0.3 + '@urql/core': workspace:@urql/core@* enzyme: ^3.11.0 enzyme-adapter-react-16: ^1.15.2 graphql: ^16.0.0 @@ -276,6 +277,7 @@ importers: react-dom: ^17.0.2 react-is: ^17.0.2 react-ssr-prepass: ^1.4.0 + urql: workspace:urql@* dependencies: react-ssr-prepass: 1.4.0_react@17.0.2 devDependencies: @@ -284,6 +286,7 @@ importers: '@types/node-fetch': 2.5.10 '@types/react': 17.0.52 '@types/react-dom': 17.0.18 + '@urql/core': link:../core enzyme: 3.11.0 enzyme-adapter-react-16: 1.15.6_7ltvq4e2railvf5uya4ffxpe2a graphql: 16.0.1 @@ -291,6 +294,7 @@ importers: react: 17.0.2 react-dom: 17.0.2_react@17.0.2 react-is: 17.0.2 + urql: link:../react-urql packages/preact-urql: specifiers: @@ -421,10 +425,12 @@ importers: specifiers: '@react-native-async-storage/async-storage': ^1.15.5 '@react-native-community/netinfo': ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0 - '@urql/exchange-graphcache': '*' + '@urql/core': workspace:@urql/core@* + '@urql/exchange-graphcache': workspace:@urql/exchange-graphcache@* devDependencies: '@react-native-async-storage/async-storage': 1.15.5 '@react-native-community/netinfo': 6.0.0 + '@urql/core': link:../core '@urql/exchange-graphcache': link:../../exchanges/graphcache packages/storybook-addon: @@ -436,14 +442,14 @@ importers: '@types/webpack-env': ^1.15.3 '@urql/core': ^3.0.0 '@urql/devtools': '>=2.0.0' - '@urql/preact': '>=3.0.0' + '@urql/preact': workspace:@urql/preact@* graphql: ^16.0.0 preact: ^10.5.5 react: ^17.0.2 react-dom: ^17.0.2 react-is: ^17.0.2 typescript: '>=4.7.3' - urql: '>=3.0.0' + urql: workspace:urql@* webpack: '>=4.4.6' wonka: ^6.1.2 dependencies: diff --git a/scripts/rollup/cleanup-plugin.mjs b/scripts/rollup/cleanup-plugin.mjs index 4ff02742b3..b847d9ac21 100644 --- a/scripts/rollup/cleanup-plugin.mjs +++ b/scripts/rollup/cleanup-plugin.mjs @@ -1,5 +1,8 @@ import { transformSync as transform } from '@babel/core'; import { createFilter } from '@rollup/pluginutils'; +import { posix as path } from 'path'; + +import * as settings from './settings.mjs'; function removeEmptyImports({ types: t }) { return { @@ -22,24 +25,39 @@ function removeEmptyImports({ types: t }) { }; } -function cleanup(opts = {}) { - const filter = createFilter(opts.include, opts.exclude, { - resolve: false - }); +function cleanup() { + const jsFilter = createFilter(/.m?js$/, null, { resolve: false }); + const dtsFilter = createFilter(/\.d\.ts(\.map)?$/, null, { resolve: false }); return { name: "cleanup", renderChunk(code, chunk) { - if (!filter(chunk.fileName)) { - return null; + if (jsFilter(chunk.fileName)) { + return transform(code, { + plugins: [removeEmptyImports], + babelrc: false + }); } + }, - return transform(code, { - plugins: [removeEmptyImports], - babelrc: false - }); - } + generateBundle(_options, bundle) { + const basePath = path.relative( + path.resolve(settings.cwd, '../..'), + path.join(settings.cwd, 'src'), + ); + + for (const fileName in bundle) { + if (!dtsFilter(fileName)) { + continue; + } else if (fileName.startsWith(basePath)) { + const targetPath = fileName.slice(basePath.length + 1); + bundle[fileName].fileName = path.join('types', targetPath);; + } else { + delete bundle[fileName]; + } + } + }, }; } diff --git a/scripts/rollup/plugins.mjs b/scripts/rollup/plugins.mjs index 8dd85962a8..498d7d7967 100644 --- a/scripts/rollup/plugins.mjs +++ b/scripts/rollup/plugins.mjs @@ -36,16 +36,20 @@ export const makePlugins = () => [ } : {}, }), typescript({ - useTsconfigDeclarationDir: true, + clean: true, tsconfigOverride: { exclude: [ + 'src/**/*.spec.ts', + 'src/**/*.spec.tsx', 'src/**/*.test.ts', 'src/**/*.test.tsx', 'src/**/test-utils/*' ], compilerOptions: { + rootDir: path.resolve(settings.cwd, '../..'), sourceMap: true, noEmit: false, + noResolve: true, declaration: true, declarationDir: settings.types, target: 'esnext', @@ -91,7 +95,7 @@ export const makeOutputPlugins = ({ isProduction, extension }) => { 'process.env.NODE_ENV': JSON.stringify('production') }), cjsCheck({ extension }), - cleanup({ extension, maintainImports: settings.name === 'urql-introspection' }), + cleanup(), isProduction ? terserMinified : (extension !== '.js' ? terserPretty : null), isProduction && settings.isAnalyze && visualizer({ filename: path.resolve(settings.cwd, 'node_modules/.cache/analyze.html'), diff --git a/tsconfig.json b/tsconfig.json index fb1f1c5382..5f7a8af1d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,11 +2,19 @@ "compilerOptions": { "baseUrl": "./", "paths": { - "urql": ["packages/react-urql/src"], - "*-urql": ["packages/*-urql/src"], - "@urql/exchange-*": ["exchanges/*/src"], - "@urql/core/*": ["packages/core/src/*"], - "@urql/*": ["packages/*-urql/src", "packages/*/src"] + "urql": ["node_modules/urql/src", "packages/react-urql/src"], + "*-urql": ["node_modules/*-urql/src", "packages/*-urql/src"], + "@urql/exchange-*": [ + "node_modules/@urql/exchange-*/src", + "exchanges/*/src" + ], + "@urql/core/*": ["node_modules/@urql/core/src/*", "packages/core/src/*"], + "@urql/devtools": ["node_modules/@urql/devtools"], + "@urql/*": [ + "node_modules/@urql/*/src", + "packages/*-urql/src", + "packages/*/src" + ] }, "esModuleInterop": true, "isolatedModules": true, @@ -28,7 +36,8 @@ "**/e2e-tests", "**/examples", "**/dist", - "scripts", - "node_modules" + "**/node_modules", + "node_modules", + "scripts" ] }