From e947bcbf6a0dc450b9196a0338c42f40a6ee9f9d Mon Sep 17 00:00:00 2001 From: pipinet Date: Mon, 30 Sep 2024 22:30:20 +0800 Subject: [PATCH] chore: add apollo --- package.json | 5 +- packages/apollo/README.md | 1 + packages/apollo/package.json | 52 ++++ packages/apollo/scripts/postbuild.ts | 11 + packages/apollo/scripts/prebuild.ts | 5 + packages/apollo/src/graphql-client.ts | 94 ++++++++ packages/apollo/src/graphql-helpers.ts | 13 + packages/apollo/src/index.ts | 3 + packages/apollo/src/models.ts | 53 ++++ packages/apollo/tsconfig.json | 11 + packages/apollo/tsup.config.ts | 8 + packages/lang/package.json | 7 +- packages/lang/tsconfig.json | 12 +- pnpm-lock.yaml | 319 +++++++++++++++++++++++++ scripts/build-helper.ts | 20 +- tsconfig.json | 27 --- 16 files changed, 592 insertions(+), 49 deletions(-) create mode 100644 packages/apollo/README.md create mode 100644 packages/apollo/package.json create mode 100644 packages/apollo/scripts/postbuild.ts create mode 100644 packages/apollo/scripts/prebuild.ts create mode 100644 packages/apollo/src/graphql-client.ts create mode 100644 packages/apollo/src/graphql-helpers.ts create mode 100644 packages/apollo/src/index.ts create mode 100644 packages/apollo/src/models.ts create mode 100644 packages/apollo/tsconfig.json create mode 100644 packages/apollo/tsup.config.ts delete mode 100644 tsconfig.json diff --git a/package.json b/package.json index 6c7220e..b4c546c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@dorami/monorepo", "module": "index.ts", "type": "module", - "version": "0.0.2", + "version": "0.0.0", "private": true, "scripts": { "setup": "rm -rf **/node_modules **/dist ./pnpm-lock.yaml && pnpm install", @@ -10,8 +10,7 @@ "release": "pnpm run build && pnpm recursive publish --filter './packages/*' --no-git-checks --report-summary", "build": "NODE_ENV=production pnpm run build:check && pnpm run build:packages", "build:check": "pnpm run format:check && pnpm run security:check", - "build:packages": "pnpm run build:lang", - "build:lang": "pnpm --filter lang build", + "build:packages": "pnpm --filter './packages/*' build", "dev": "pnpm --filter showcase dev", "hot:dev": "DEV_ENV=hot pnpm --filter showcase dev", "security:check": "pnpm audit --prod --audit-level high", diff --git a/packages/apollo/README.md b/packages/apollo/README.md new file mode 100644 index 0000000..f7942a7 --- /dev/null +++ b/packages/apollo/README.md @@ -0,0 +1 @@ +- TODO diff --git a/packages/apollo/package.json b/packages/apollo/package.json new file mode 100644 index 0000000..d5bccb6 --- /dev/null +++ b/packages/apollo/package.json @@ -0,0 +1,52 @@ +{ + "name": "@dorami/apollo", + "version": "0.0.0", + "main": "./src/index.ts", + "module": "./src/index.ts", + "types": "./src/index.ts", + "publishConfig": { + "main": "./index.mjs", + "module": "./index.mjs", + "types": "./index.d.mts", + "exports": { + ".": { + "types": "./index.d.mts", + "import": "./index.mjs" + } + }, + "directory": "dist", + "linkDirectory": false, + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "scripts": { + "build": "NODE_ENV=production INPUT_DIR=./ OUTPUT_DIR=dist/ pnpm run build:package", + "build:package": "pnpm run build:prebuild && tsup && pnpm run build:postbuild", + "build:prebuild": "tsx ./scripts/prebuild.ts", + "build:postbuild": "tsx ./scripts/postbuild.ts", + "dev:link": "pnpm link --global && npm link" + }, + "dependencies": { + "@apollo/client": "^3.11.8", + "@vue/apollo-composable": "^4.2.1" + }, + "devDependencies": { + "tsup": "^8.2.4", + "tsx": "^4.16.2" + }, + "author": "Qwlabs", + "homepage": "https://github.com/qwlabs/dorami", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/qwlabs/dorami.git", + "directory": "packages/apollo" + }, + "bugs": { + "url": "https://github.com/qwlabs/dorami/issues" + }, + "engines": { + "node": ">=20.17.0", + "pnpm": ">=9" + } +} \ No newline at end of file diff --git a/packages/apollo/scripts/postbuild.ts b/packages/apollo/scripts/postbuild.ts new file mode 100644 index 0000000..3ce9d3f --- /dev/null +++ b/packages/apollo/scripts/postbuild.ts @@ -0,0 +1,11 @@ +import * as path from 'node:path'; +import * as fs from 'fs-extra'; +import { clearPackageJson, resolvePath } from '../../../scripts/build-helper'; + +const { __dirname, __workspace, OUTPUT_DIR } = resolvePath(import.meta.url); + +fs.copySync(path.resolve(__dirname, '../package.json'), `${OUTPUT_DIR}/package.json`); +fs.copySync(path.resolve(__dirname, '../README.md'), `${OUTPUT_DIR}/README.md`); +fs.copySync(path.resolve(__workspace, './LICENSE.md'), `${OUTPUT_DIR}/LICENSE.md`); + +clearPackageJson(path.resolve(__dirname, `../${OUTPUT_DIR}/package.json`)); diff --git a/packages/apollo/scripts/prebuild.ts b/packages/apollo/scripts/prebuild.ts new file mode 100644 index 0000000..c74f4b3 --- /dev/null +++ b/packages/apollo/scripts/prebuild.ts @@ -0,0 +1,5 @@ +import * as path from 'node:path'; +import { removeBuild, resolvePath, updatePackageJson } from '../../../scripts/build-helper'; + +removeBuild(import.meta.url); +updatePackageJson(path.resolve(resolvePath(import.meta.url).__dirname, '../package.json')); diff --git a/packages/apollo/src/graphql-client.ts b/packages/apollo/src/graphql-client.ts new file mode 100644 index 0000000..9cd986f --- /dev/null +++ b/packages/apollo/src/graphql-client.ts @@ -0,0 +1,94 @@ +import type { ApolloCache, NormalizedCacheObject, Operation } from '@apollo/client/core'; +import type { GraphqlApiClientConfig } from './models'; +import { ApolloClient, ApolloLink, createHttpLink, InMemoryCache, split } from '@apollo/client/core'; +import { onError } from '@apollo/client/link/error'; +import { getMainDefinition } from '@apollo/client/utilities'; +import { DEFAULT_OPTIONS } from './models'; + +const loadHeaders = (config: GraphqlApiClientConfig): Record => { + let headers: Record = {}; + headers['Content-Type'] = 'application/json;charset=UTF-8'; + headers['Accept-Language'] = 'zh-CN'; + if (config.headerAugmentor) { + headers = config.headerAugmentor(headers); + } + return headers; +}; + +const createAHttpLink = (config: GraphqlApiClientConfig): ApolloLink => { + const normalHttpLink = createHttpLink({ + uri: (params: Operation) => { + return `${config.url}?op=${params.operationName}`; + }, + }); + const batchHttpLink = createHttpLink({ + uri: config.url, + }); + return split(() => config.batchEnabled, batchHttpLink, normalHttpLink); +}; + +const createWSLink = (config: GraphqlApiClientConfig): ApolloLink => { + return ApolloLink.from([]); +}; + +const createGraphqlLink = (config: GraphqlApiClientConfig): ApolloLink => { + const httpLink = createAHttpLink(config); + const wsLink = createWSLink(config); + return split( + ({ query }) => { + const definition = getMainDefinition(query); + return definition.kind === 'OperationDefinition' && definition.operation === 'subscription'; + }, + wsLink, + httpLink + ); +}; + +const createErrorLink = (config: GraphqlApiClientConfig): ApolloLink => { + return onError(({ graphQLErrors, networkError }) => { + if (graphQLErrors != null && graphQLErrors.length > 0) { + graphQLErrors.forEach((graphQLError) => { + const handler = config.graphQLErrorHandlers.find((handler) => handler.match(graphQLError)); + handler?.handle(graphQLError); + }); + } + if (networkError) { + const handler = config.networkErrorHandlers.find((handler) => handler.match(networkError)); + handler?.handle(networkError); + } + }); +}; + +const createMiddleware = (config: GraphqlApiClientConfig): ApolloLink => { + return new ApolloLink((operation, forward) => { + operation.setContext({ + headers: loadHeaders(config), + }); + return forward(operation); + }); +}; + +const createLink = (config: GraphqlApiClientConfig): ApolloLink => { + const middleware = createMiddleware(config); + const graphqlLink = createGraphqlLink(config); + const errorLink = createErrorLink(config); + return ApolloLink.from([errorLink, middleware, graphqlLink]); +}; + +export const createClient = (config: GraphqlApiClientConfig): { client: ApolloClient; cache: ApolloCache } => { + const link = createLink(config); + const cache = new InMemoryCache({ + resultCaching: true, + }); + const client = new ApolloClient({ + link, + cache, + ssrMode: config.ssrMode, + queryDeduplication: true, + defaultOptions: config.defaultOptions ?? DEFAULT_OPTIONS, + devtools: { + enabled: config.connectToDevTools, + } + }); + return { client, cache }; +}; diff --git a/packages/apollo/src/graphql-helpers.ts b/packages/apollo/src/graphql-helpers.ts new file mode 100644 index 0000000..125e59c --- /dev/null +++ b/packages/apollo/src/graphql-helpers.ts @@ -0,0 +1,13 @@ +export interface RelyEdge { + node: N; +} + +export interface RelyConnection { + edges: RelyEdge[]; +} + +export const extractRelyData = (connection: unknown, mapping?: (node: N) => R): R[] => { + return ((connection as RelyConnection)?.edges ?? []).map((edge: RelyEdge) => { + return mapping ? mapping(edge.node) : (edge.node as unknown as R); + }); +}; diff --git a/packages/apollo/src/index.ts b/packages/apollo/src/index.ts new file mode 100644 index 0000000..566f7ea --- /dev/null +++ b/packages/apollo/src/index.ts @@ -0,0 +1,3 @@ +export * from './graphql-client'; +export * from './graphql-helpers'; +export * from './models'; diff --git a/packages/apollo/src/models.ts b/packages/apollo/src/models.ts new file mode 100644 index 0000000..38cce0a --- /dev/null +++ b/packages/apollo/src/models.ts @@ -0,0 +1,53 @@ +import type { FetchResult, Observable } from '@apollo/client'; +import type { DefaultOptions } from '@apollo/client/core/ApolloClient'; +import type { NetworkError } from '@apollo/client/errors'; +import type { GraphQLFormattedError } from 'graphql/error/GraphQLError'; + +export type RequestHeaderAugmentor = (headers: Record) => Record; + +export interface ErrorMatchHandler { + match: (error: Error) => boolean; + + handle: (error: Error) => Observable | void; +} + +export interface NetworkErrorMatchHandler extends ErrorMatchHandler { + match: (error: NetworkError) => boolean; + + handle: (error: NetworkError) => Observable | void; +} + +export interface GraphQLErrorMatchHandler extends ErrorMatchHandler { + match: (error: GraphQLFormattedError) => boolean; + + handle: (error: GraphQLFormattedError) => Observable | void; +} + +export interface GraphqlApiClientConfig { + ssrMode: boolean; + connectToDevTools: boolean; + url: string; + subscriptionUrl?: string; + batchEnabled: boolean; + headerAugmentor?: RequestHeaderAugmentor; + networkErrorHandlers: NetworkErrorMatchHandler[]; + graphQLErrorHandlers: GraphQLErrorMatchHandler[]; + defaultOptions?: DefaultOptions; +} + +export const DEFAULT_OPTIONS: DefaultOptions = { + query: { + notifyOnNetworkStatusChange: true, + fetchPolicy: 'no-cache', + }, + mutate: { + fetchPolicy: 'no-cache', + keepRootFields: true, + }, + watchQuery: { + notifyOnNetworkStatusChange: true, + fetchPolicy: 'no-cache', + nextFetchPolicy: 'no-cache', + returnPartialData: true, + }, +}; diff --git a/packages/apollo/tsconfig.json b/packages/apollo/tsconfig.json new file mode 100644 index 0000000..d9ea889 --- /dev/null +++ b/packages/apollo/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "Node", + "baseUrl": "." + }, + "exclude": [ + "node_modules", + "dist" + ] +} diff --git a/packages/apollo/tsup.config.ts b/packages/apollo/tsup.config.ts new file mode 100644 index 0000000..6302f95 --- /dev/null +++ b/packages/apollo/tsup.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + format: ['esm'], + dts: true, + splitting: false, +}); diff --git a/packages/lang/package.json b/packages/lang/package.json index 33a06a4..02d1511 100644 --- a/packages/lang/package.json +++ b/packages/lang/package.json @@ -1,8 +1,9 @@ { "name": "@dorami/lang", - "version": "0.0.2", + "version": "0.0.0", "main": "./src/index.ts", "module": "./src/index.ts", + "types": "./src/index.ts", "publishConfig": { "main": "./index.mjs", "module": "./index.mjs", @@ -34,14 +35,14 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/qwlabs/dorami.git" + "url": "git+https://github.com/qwlabs/dorami.git", + "directory": "packages/lang" }, "bugs": { "url": "https://github.com/qwlabs/dorami/issues" }, "engines": { "node": ">=20.17.0", - "bun": ">=1", "pnpm": ">=9" } } \ No newline at end of file diff --git a/packages/lang/tsconfig.json b/packages/lang/tsconfig.json index 36d34ac..e25b24e 100644 --- a/packages/lang/tsconfig.json +++ b/packages/lang/tsconfig.json @@ -1,8 +1,8 @@ { - "compilerOptions": { - "module": "ESNext", - "moduleResolution": "Node", - "baseUrl": ".", - }, - "exclude": ["node_modules", "dist"] + "compilerOptions": { + "module": "ESNext", + "moduleResolution": "Node", + "baseUrl": ".", + }, + "exclude": ["node_modules", "dist"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d7e4a5e..396fb1a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,6 +58,23 @@ importers: version: 5.6.2 publishDirectory: dist + packages/apollo: + dependencies: + '@apollo/client': + specifier: ^3.11.8 + version: 3.11.8(graphql@16.9.0) + '@vue/apollo-composable': + specifier: ^4.2.1 + version: 4.2.1(@apollo/client@3.11.8(graphql@16.9.0))(graphql@16.9.0)(typescript@5.6.2)(vue@3.5.10(typescript@5.6.2)) + devDependencies: + tsup: + specifier: ^8.2.4 + version: 8.3.0(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.6.2)(yaml@2.5.1) + tsx: + specifier: ^4.16.2 + version: 4.19.1 + publishDirectory: dist + packages/lang: devDependencies: tsup: @@ -126,6 +143,24 @@ packages: '@antfu/utils@0.7.10': resolution: {integrity: sha512-+562v9k4aI80m1+VuMHehNJWLOFjBnXn3tdOitzD0il5b7smkSBal4+a3oKiQTbrwMmN/TBUMDvbdoWDehgOww==} + '@apollo/client@3.11.8': + resolution: {integrity: sha512-CgG1wbtMjsV2pRGe/eYITmV5B8lXUCYljB2gB/6jWTFQcrvirUVvKg7qtFdjYkQSFbIffU1IDyxgeaN81eTjbA==} + peerDependencies: + graphql: ^15.0.0 || ^16.0.0 + graphql-ws: ^5.5.5 + react: ^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 + react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0 + subscriptions-transport-ws: ^0.9.0 || ^0.11.0 + peerDependenciesMeta: + graphql-ws: + optional: true + react: + optional: true + react-dom: + optional: true + subscriptions-transport-ws: + optional: true + '@babel/code-frame@7.24.7': resolution: {integrity: sha512-BcYH1CVJBO9tvyIZ2jVeXgSIMvGZ2FDRvDdOIVQyuklNKSsx+eppDEBq/g47Ayw+RqNFE+URvOShmf+f/qwAlA==} engines: {node: '>=6.9.0'} @@ -499,6 +534,11 @@ packages: resolution: {integrity: sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@graphql-typed-document-node/core@3.2.0': + resolution: {integrity: sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==} + peerDependencies: + graphql: ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 + '@humanwhocodes/module-importer@1.0.1': resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} engines: {node: '>=12.22'} @@ -737,6 +777,17 @@ packages: vitest: optional: true + '@vue/apollo-composable@4.2.1': + resolution: {integrity: sha512-9PZ/pSl4Miqgg9uUOkAbg38ALyjm1j7QL9iZeppgUCBcJI3Sa7SA3LOCB2IV1jYsLjXuKVMHh2cwHJE1wzhfSA==} + peerDependencies: + '@apollo/client': ^3.4.13 + '@vue/composition-api': ^1.0.0 + graphql: '>=15' + vue: ^2.6.0 || ^3.1.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + '@vue/compiler-core@3.5.10': resolution: {integrity: sha512-iXWlk+Cg/ag7gLvY0SfVucU8Kh2CjysYZjhhP70w9qI4MvSox4frrP+vDGvtQuzIcgD8+sxM6lZvCtdxGunTAA==} @@ -749,9 +800,43 @@ packages: '@vue/compiler-ssr@3.5.10': resolution: {integrity: sha512-hxP4Y3KImqdtyUKXDRSxKSRkSm1H9fCvhojEYrnaoWhE4w/y8vwWhnosJoPPe2AXm5sU7CSbYYAgkt2ZPhDz+A==} + '@vue/reactivity@3.5.10': + resolution: {integrity: sha512-kW08v06F6xPSHhid9DJ9YjOGmwNDOsJJQk0ax21wKaUYzzuJGEuoKNU2Ujux8FLMrP7CFJJKsHhXN9l2WOVi2g==} + + '@vue/runtime-core@3.5.10': + resolution: {integrity: sha512-9Q86I5Qq3swSkFfzrZ+iqEy7Vla325M7S7xc1NwKnRm/qoi1Dauz0rT6mTMmscqx4qz0EDJ1wjB+A36k7rl8mA==} + + '@vue/runtime-dom@3.5.10': + resolution: {integrity: sha512-t3x7ht5qF8ZRi1H4fZqFzyY2j+GTMTDxRheT+i8M9Ph0oepUxoadmbwlFwMoW7RYCpNQLpP2Yx3feKs+fyBdpA==} + + '@vue/server-renderer@3.5.10': + resolution: {integrity: sha512-IVE97tt2kGKwHNq9yVO0xdh1IvYfZCShvDSy46JIh5OQxP1/EXSpoDqetVmyIzL7CYOWnnmMkVqd7YK2QSWkdw==} + peerDependencies: + vue: 3.5.10 + '@vue/shared@3.5.10': resolution: {integrity: sha512-VkkBhU97Ki+XJ0xvl4C9YJsIZ2uIlQ7HqPpZOS3m9VCvmROPaChZU6DexdMJqvz9tbgG+4EtFVrSuailUq5KGQ==} + '@wry/caches@1.0.1': + resolution: {integrity: sha512-bXuaUNLVVkD20wcGBWRyo7j9N3TxePEWFZj2Y+r9OoUzfqmavM84+mFykRicNsBqatba5JLay1t48wxaXaWnlA==} + engines: {node: '>=8'} + + '@wry/context@0.7.4': + resolution: {integrity: sha512-jmT7Sb4ZQWI5iyu3lobQxICu2nC/vbUhP0vIdd6tHC9PTfenmRmuIFqktc6GH9cgi+ZHnsLWPvfSvc4DrYmKiQ==} + engines: {node: '>=8'} + + '@wry/equality@0.5.7': + resolution: {integrity: sha512-BRFORjsTuQv5gxcXsuDXx6oGRhuVsEGwZy6LOzRRfgu+eSfxbhUQ9L9YtSEIuIjY/o7g3iWFjrc5eSY1GXP2Dw==} + engines: {node: '>=8'} + + '@wry/trie@0.4.3': + resolution: {integrity: sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==} + engines: {node: '>=8'} + + '@wry/trie@0.5.0': + resolution: {integrity: sha512-FNoYzHawTMk/6KMQoEG5O4PuioX19UbwdQKF44yw0nLfOypfQdjtfZzo/UIJWAJ23sNIFbD1Ug9lbaDGMwbqQA==} + engines: {node: '>=8'} + acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: @@ -918,6 +1003,9 @@ packages: engines: {node: '>=4'} hasBin: true + csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: @@ -1305,6 +1393,16 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + graphql-tag@2.12.6: + resolution: {integrity: sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==} + engines: {node: '>=10'} + peerDependencies: + graphql: ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 + + graphql@16.9.0: + resolution: {integrity: sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==} + engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0} + has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} @@ -1317,6 +1415,9 @@ packages: resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} engines: {node: '>= 0.4'} + hoist-non-react-statics@3.3.2: + resolution: {integrity: sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==} + hosted-git-info@2.8.9: resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} @@ -1481,6 +1582,10 @@ packages: longest-streak@3.1.0: resolution: {integrity: sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==} + loose-envify@1.4.0: + resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} + hasBin: true + lru-cache@10.4.3: resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} @@ -1688,6 +1793,9 @@ packages: resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} engines: {node: '>=6'} + optimism@0.18.0: + resolution: {integrity: sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==} + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -1809,6 +1917,9 @@ packages: engines: {node: '>=14'} hasBin: true + prop-types@15.8.1: + resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} + punycode@2.3.1: resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} engines: {node: '>=6'} @@ -1816,6 +1927,9 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + react-is@16.13.1: + resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + read-pkg-up@7.0.1: resolution: {integrity: sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==} engines: {node: '>=8'} @@ -1844,6 +1958,17 @@ packages: resolution: {integrity: sha512-qx+xQGZVsy55CH0a1hiVwHmqjLryfh7wQyF5HO07XJ9f7dQMY/gPQHhlyDkIzJKC+x2fUCpCcUODUUUFrm7SHA==} hasBin: true + rehackt@0.1.0: + resolution: {integrity: sha512-7kRDOuLHB87D/JESKxQoRwv4DzbIdwkAGQ7p6QKGdVlY1IZheUnVhlk/4UZlNUVxdAXpyxikE3URsG067ybVzw==} + peerDependencies: + '@types/react': '*' + react: '*' + peerDependenciesMeta: + '@types/react': + optional: true + react: + optional: true + require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} @@ -1863,6 +1988,10 @@ packages: resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} hasBin: true + response-iterator@0.2.6: + resolution: {integrity: sha512-pVzEEzrsg23Sh053rmDUvLSkGXluZio0qu8VT6ukrYuvtjVfCbDZH9d6PGXb8HZfzdNZt8feXv/jvUzlhRgLnw==} + engines: {node: '>=0.8'} + reusify@1.0.4: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -1980,6 +2109,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + symbol-observable@4.0.0: + resolution: {integrity: sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ==} + engines: {node: '>=0.10'} + synckit@0.6.2: resolution: {integrity: sha512-Vhf+bUa//YSTYKseDiiEuQmhGCoIF3CVBhunm3r/DQnYiGT4JssmnKQc44BIyOZRK2pKjXXAgbhfmbeoC9CJpA==} engines: {node: '>=12.20'} @@ -2006,6 +2139,10 @@ packages: thenify@3.3.1: resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + throttle-debounce@5.0.2: + resolution: {integrity: sha512-B71/4oyj61iNH0KeCamLuE2rmKuTO5byTOSVwECM5FA7TiAiAW+UqTKZ9ERueC4qvgSttUhdmq1mXC3kJqGX7A==} + engines: {node: '>=12.22'} + tinyexec@0.3.0: resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} @@ -2038,9 +2175,21 @@ packages: peerDependencies: typescript: '>=4.2.0' + ts-essentials@9.4.2: + resolution: {integrity: sha512-mB/cDhOvD7pg3YCLk2rOtejHjjdSi9in/IBYE13S+8WA5FBSraYf4V/ws55uvs0IvQ/l0wBOlXy5yBNZ9Bl8ZQ==} + peerDependencies: + typescript: '>=4.1.0' + peerDependenciesMeta: + typescript: + optional: true + ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + ts-invariant@0.10.3: + resolution: {integrity: sha512-uivwYcQaxAucv1CzRp2n/QdYPo4ILf9VXgH19zEIjFx2EJufV16P0JtJVpYHy89DItG6Kwj2oIUjrcK5au+4tQ==} + engines: {node: '>=8'} + tslib@2.7.0: resolution: {integrity: sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==} @@ -2129,12 +2278,31 @@ packages: validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + vue-demi@0.14.10: + resolution: {integrity: sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==} + engines: {node: '>=12'} + hasBin: true + peerDependencies: + '@vue/composition-api': ^1.0.0-rc.1 + vue: ^3.0.0-0 || ^2.6.0 + peerDependenciesMeta: + '@vue/composition-api': + optional: true + vue-eslint-parser@9.4.3: resolution: {integrity: sha512-2rYRLWlIpaiN8xbPiDyXZXRgLGOtWxERV7ND5fFAv5qo1D2N9Fu9MNajBNc6o13lZ+24DAWCkQCvj4klgmcITg==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' + vue@3.5.10: + resolution: {integrity: sha512-Vy2kmJwHPlouC/tSnIgXVg03SG+9wSqT1xu1Vehc+ChsXsRd7jLkKgMltVEFOzUdBr3uFwBCG+41LJtfAcBRng==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + webidl-conversions@4.0.2: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} @@ -2187,6 +2355,12 @@ packages: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} + zen-observable-ts@1.2.5: + resolution: {integrity: sha512-QZWQekv6iB72Naeake9hS1KxHlotfRpe+WGNbNx5/ta+R3DNjVO2bswf63gXlWDcs+EMd7XY8HfVQyP1X6T4Zg==} + + zen-observable@0.8.15: + resolution: {integrity: sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ==} + zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} @@ -2247,6 +2421,26 @@ snapshots: '@antfu/utils@0.7.10': {} + '@apollo/client@3.11.8(graphql@16.9.0)': + dependencies: + '@graphql-typed-document-node/core': 3.2.0(graphql@16.9.0) + '@wry/caches': 1.0.1 + '@wry/equality': 0.5.7 + '@wry/trie': 0.5.0 + graphql: 16.9.0 + graphql-tag: 2.12.6(graphql@16.9.0) + hoist-non-react-statics: 3.3.2 + optimism: 0.18.0 + prop-types: 15.8.1 + rehackt: 0.1.0 + response-iterator: 0.2.6 + symbol-observable: 4.0.0 + ts-invariant: 0.10.3 + tslib: 2.7.0 + zen-observable-ts: 1.2.5 + transitivePeerDependencies: + - '@types/react' + '@babel/code-frame@7.24.7': dependencies: '@babel/highlight': 7.24.7 @@ -2490,6 +2684,10 @@ snapshots: dependencies: levn: 0.4.1 + '@graphql-typed-document-node/core@3.2.0(graphql@16.9.0)': + dependencies: + graphql: 16.9.0 + '@humanwhocodes/module-importer@1.0.1': {} '@humanwhocodes/retry@0.3.0': {} @@ -2716,6 +2914,17 @@ snapshots: '@typescript-eslint/utils': 8.7.0(eslint@9.11.1(jiti@1.21.6))(typescript@5.6.2) typescript: 5.6.2 + '@vue/apollo-composable@4.2.1(@apollo/client@3.11.8(graphql@16.9.0))(graphql@16.9.0)(typescript@5.6.2)(vue@3.5.10(typescript@5.6.2))': + dependencies: + '@apollo/client': 3.11.8(graphql@16.9.0) + graphql: 16.9.0 + throttle-debounce: 5.0.2 + ts-essentials: 9.4.2(typescript@5.6.2) + vue: 3.5.10(typescript@5.6.2) + vue-demi: 0.14.10(vue@3.5.10(typescript@5.6.2)) + transitivePeerDependencies: + - typescript + '@vue/compiler-core@3.5.10': dependencies: '@babel/parser': 7.25.6 @@ -2746,8 +2955,50 @@ snapshots: '@vue/compiler-dom': 3.5.10 '@vue/shared': 3.5.10 + '@vue/reactivity@3.5.10': + dependencies: + '@vue/shared': 3.5.10 + + '@vue/runtime-core@3.5.10': + dependencies: + '@vue/reactivity': 3.5.10 + '@vue/shared': 3.5.10 + + '@vue/runtime-dom@3.5.10': + dependencies: + '@vue/reactivity': 3.5.10 + '@vue/runtime-core': 3.5.10 + '@vue/shared': 3.5.10 + csstype: 3.1.3 + + '@vue/server-renderer@3.5.10(vue@3.5.10(typescript@5.6.2))': + dependencies: + '@vue/compiler-ssr': 3.5.10 + '@vue/shared': 3.5.10 + vue: 3.5.10(typescript@5.6.2) + '@vue/shared@3.5.10': {} + '@wry/caches@1.0.1': + dependencies: + tslib: 2.7.0 + + '@wry/context@0.7.4': + dependencies: + tslib: 2.7.0 + + '@wry/equality@0.5.7': + dependencies: + tslib: 2.7.0 + + '@wry/trie@0.4.3': + dependencies: + tslib: 2.7.0 + + '@wry/trie@0.5.0': + dependencies: + tslib: 2.7.0 + acorn-jsx@5.3.2(acorn@8.12.1): dependencies: acorn: 8.12.1 @@ -2898,6 +3149,8 @@ snapshots: cssesc@3.0.0: {} + csstype@3.1.3: {} + debug@3.2.7: dependencies: ms: 2.1.3 @@ -3400,6 +3653,13 @@ snapshots: graphemer@1.4.0: {} + graphql-tag@2.12.6(graphql@16.9.0): + dependencies: + graphql: 16.9.0 + tslib: 2.7.0 + + graphql@16.9.0: {} + has-flag@3.0.0: {} has-flag@4.0.0: {} @@ -3408,6 +3668,10 @@ snapshots: dependencies: function-bind: 1.1.2 + hoist-non-react-statics@3.3.2: + dependencies: + react-is: 16.13.1 + hosted-git-info@2.8.9: {} human-signals@2.1.0: {} @@ -3546,6 +3810,10 @@ snapshots: longest-streak@3.1.0: {} + loose-envify@1.4.0: + dependencies: + js-tokens: 4.0.0 + lru-cache@10.4.3: {} magic-string@0.30.11: @@ -3923,6 +4191,13 @@ snapshots: dependencies: mimic-fn: 2.1.0 + optimism@0.18.0: + dependencies: + '@wry/caches': 1.0.1 + '@wry/context': 0.7.4 + '@wry/trie': 0.4.3 + tslib: 2.7.0 + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -4025,10 +4300,18 @@ snapshots: prettier@3.3.3: {} + prop-types@15.8.1: + dependencies: + loose-envify: 1.4.0 + object-assign: 4.1.1 + react-is: 16.13.1 + punycode@2.3.1: {} queue-microtask@1.2.3: {} + react-is@16.13.1: {} + read-pkg-up@7.0.1: dependencies: find-up: 4.1.0 @@ -4061,6 +4344,8 @@ snapshots: dependencies: jsesc: 0.5.0 + rehackt@0.1.0: {} + require-directory@2.1.1: {} resolve-from@4.0.0: {} @@ -4075,6 +4360,8 @@ snapshots: path-parse: 1.0.7 supports-preserve-symlinks-flag: 1.0.0 + response-iterator@0.2.6: {} + reusify@1.0.4: {} rollup@4.22.5: @@ -4202,6 +4489,8 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + symbol-observable@4.0.0: {} + synckit@0.6.2: dependencies: tslib: 2.7.0 @@ -4235,6 +4524,8 @@ snapshots: dependencies: any-promise: 1.3.0 + throttle-debounce@5.0.2: {} + tinyexec@0.3.0: {} tinyglobby@0.2.6: @@ -4262,8 +4553,16 @@ snapshots: dependencies: typescript: 5.6.2 + ts-essentials@9.4.2(typescript@5.6.2): + optionalDependencies: + typescript: 5.6.2 + ts-interface-checker@0.1.13: {} + ts-invariant@0.10.3: + dependencies: + tslib: 2.7.0 + tslib@2.7.0: {} tsup@8.3.0(jiti@1.21.6)(postcss@8.4.47)(tsx@4.19.1)(typescript@5.6.2)(yaml@2.5.1): @@ -4362,6 +4661,10 @@ snapshots: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 + vue-demi@0.14.10(vue@3.5.10(typescript@5.6.2)): + dependencies: + vue: 3.5.10(typescript@5.6.2) + vue-eslint-parser@9.4.3(eslint@9.11.1(jiti@1.21.6)): dependencies: debug: 4.3.7 @@ -4375,6 +4678,16 @@ snapshots: transitivePeerDependencies: - supports-color + vue@3.5.10(typescript@5.6.2): + dependencies: + '@vue/compiler-dom': 3.5.10 + '@vue/compiler-sfc': 3.5.10 + '@vue/runtime-dom': 3.5.10 + '@vue/server-renderer': 3.5.10(vue@3.5.10(typescript@5.6.2)) + '@vue/shared': 3.5.10 + optionalDependencies: + typescript: 5.6.2 + webidl-conversions@4.0.2: {} whatwg-url@7.1.0: @@ -4427,4 +4740,10 @@ snapshots: yocto-queue@0.1.0: {} + zen-observable-ts@1.2.5: + dependencies: + zen-observable: 0.8.15 + + zen-observable@0.8.15: {} + zwitch@2.0.4: {} diff --git a/scripts/build-helper.ts b/scripts/build-helper.ts index 97529e4..098ebed 100644 --- a/scripts/build-helper.ts +++ b/scripts/build-helper.ts @@ -64,17 +64,17 @@ export const copyDependencies = (inFolder: string, outFolder: string, subFolder: if (entry.isDirectory()) { copyDependencies(sourcePath, destPath, subFolder); - } else { - if (fileName.endsWith('d.ts') || fileName.endsWith('.vue')) { - if (subFolder && sourcePath.includes(subFolder)) { - const subDestPath = path.join(outFolder, fileName.replace(subFolder, '')); + return; + } + if (fileName.endsWith('d.ts') || fileName.endsWith('.vue')) { + if (subFolder && sourcePath.includes(subFolder)) { + const subDestPath = path.join(outFolder, fileName.replace(subFolder, '')); - fs.ensureDirSync(path.dirname(subDestPath)); - fs.copyFileSync(sourcePath, subDestPath); - } else { - fs.ensureDirSync(path.dirname(destPath)); - fs.copyFileSync(sourcePath, destPath); - } + fs.ensureDirSync(path.dirname(subDestPath)); + fs.copyFileSync(sourcePath, subDestPath); + } else { + fs.ensureDirSync(path.dirname(destPath)); + fs.copyFileSync(sourcePath, destPath); } } }); diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 238655f..0000000 --- a/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - // Enable latest features - "lib": ["ESNext", "DOM"], - "target": "ESNext", - "module": "ESNext", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, - - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, - - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } -}