From 38cf809144d11dc3de649df2a7db40f182294a27 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Tue, 22 Jul 2025 00:14:38 +1000 Subject: [PATCH 01/37] Add operation-location-migration --- nx.json | 15 +- package.json | 2 + packages/operation-location-migration/.swcrc | 29 + .../operation-location-migration/README.md | 11 + .../eslint.config.mjs | 19 + .../jest.config.ts | 30 + .../operation-location-migration/package.json | 11 + .../operation-location-migration/project.json | 26 + .../operation-location-migration/src/index.ts | 1 + .../gcg-operation-location-migration.spec.ts | 9 + .../lib/gcg-operation-location-migration.ts | 3 + .../tsconfig.json | 23 + .../tsconfig.lib.json | 10 + .../tsconfig.spec.json | 15 + tsconfig.base.json | 3 + yarn.lock | 759 +++++++++++++++++- 16 files changed, 954 insertions(+), 12 deletions(-) create mode 100644 packages/operation-location-migration/.swcrc create mode 100644 packages/operation-location-migration/README.md create mode 100644 packages/operation-location-migration/eslint.config.mjs create mode 100644 packages/operation-location-migration/jest.config.ts create mode 100644 packages/operation-location-migration/package.json create mode 100644 packages/operation-location-migration/project.json create mode 100644 packages/operation-location-migration/src/index.ts create mode 100644 packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts create mode 100644 packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts create mode 100644 packages/operation-location-migration/tsconfig.json create mode 100644 packages/operation-location-migration/tsconfig.lib.json create mode 100644 packages/operation-location-migration/tsconfig.spec.json diff --git a/nx.json b/nx.json index 60a49e7c..e5e3ffef 100644 --- a/nx.json +++ b/nx.json @@ -36,6 +36,11 @@ "{projectRoot}/package.json" ] } + }, + "@nx/js:swc": { + "cache": true, + "dependsOn": ["^build"], + "inputs": ["production", "^production"] } }, "namedInputs": { @@ -57,5 +62,13 @@ "workspaceLayout": { "appsDir": "packages", "libsDir": "packages" - } + }, + "plugins": [ + { + "plugin": "@nx/eslint/plugin", + "options": { + "targetName": "eslint:lint" + } + } + ] } diff --git a/package.json b/package.json index d11cc92d..d37c579e 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,10 @@ "@nx/plugin": "21.3.1", "@nx/workspace": "21.3.1", "@swc-node/register": "1.9.2", + "@swc/cli": "~0.6.0", "@swc/core": "1.5.7", "@swc/helpers": "0.5.12", + "@swc/jest": "~0.2.38", "@types/jest": "30.0.0", "@types/micromatch": "4.0.6", "@types/node": "22.0.3", diff --git a/packages/operation-location-migration/.swcrc b/packages/operation-location-migration/.swcrc new file mode 100644 index 00000000..d54df2b9 --- /dev/null +++ b/packages/operation-location-migration/.swcrc @@ -0,0 +1,29 @@ +{ + "jsc": { + "target": "es2017", + "parser": { + "syntax": "typescript", + "decorators": true, + "dynamicImport": true + }, + "transform": { + "decoratorMetadata": true, + "legacyDecorator": true + }, + "keepClassNames": true, + "externalHelpers": true, + "loose": true + }, + "module": { + "type": "commonjs" + }, + "sourceMaps": true, + "exclude": [ + "jest.config.ts", + ".*\\.spec.tsx?$", + ".*\\.test.tsx?$", + "./src/jest-setup.ts$", + "./**/jest-setup.ts$", + ".*.js$" + ] +} diff --git a/packages/operation-location-migration/README.md b/packages/operation-location-migration/README.md new file mode 100644 index 00000000..7f736a42 --- /dev/null +++ b/packages/operation-location-migration/README.md @@ -0,0 +1,11 @@ +# gcg-operation-location-migration + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build gcg-operation-location-migration` to build the library. + +## Running unit tests + +Run `nx test gcg-operation-location-migration` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/packages/operation-location-migration/eslint.config.mjs b/packages/operation-location-migration/eslint.config.mjs new file mode 100644 index 00000000..c334bc0b --- /dev/null +++ b/packages/operation-location-migration/eslint.config.mjs @@ -0,0 +1,19 @@ +import baseConfig from '../../eslint.config.mjs'; + +export default [ + ...baseConfig, + { + files: ['**/*.json'], + rules: { + '@nx/dependency-checks': [ + 'error', + { + ignoredFiles: ['{projectRoot}/eslint.config.{js,cjs,mjs,ts,cts,mts}'], + }, + ], + }, + languageOptions: { + parser: await import('jsonc-eslint-parser'), + }, + }, +]; diff --git a/packages/operation-location-migration/jest.config.ts b/packages/operation-location-migration/jest.config.ts new file mode 100644 index 00000000..c252e481 --- /dev/null +++ b/packages/operation-location-migration/jest.config.ts @@ -0,0 +1,30 @@ +/* eslint-disable */ +import { readFileSync } from 'fs'; + +// Reading the SWC compilation config and remove the "exclude" +// for the test files to be compiled by SWC +const { exclude: _, ...swcJestConfig } = JSON.parse( + readFileSync(`${__dirname}/.swcrc`, 'utf-8') +); + +// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves. +// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude" +if (swcJestConfig.swcrc === undefined) { + swcJestConfig.swcrc = false; +} + +// Uncomment if using global setup/teardown files being transformed via swc +// https://nx.dev/nx-api/jest/documents/overview#global-setupteardown-with-nx-libraries +// jest needs EsModule Interop to find the default exported setup/teardown functions +// swcJestConfig.module.noInterop = false; + +export default { + displayName: '@eddeee888/gcg-operation-location-migration', + preset: '../../jest.preset.js', + transform: { + '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + testEnvironment: 'node', + coverageDirectory: '../../coverage/packages/operation-location-migration', +}; diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json new file mode 100644 index 00000000..a35ae955 --- /dev/null +++ b/packages/operation-location-migration/package.json @@ -0,0 +1,11 @@ +{ + "name": "@eddeee888/gcg-operation-location-migration", + "version": "0.0.1", + "private": true, + "type": "commonjs", + "main": "./src/index.js", + "types": "./src/index.d.ts", + "dependencies": { + "@swc/helpers": "~0.5.11" + } +} diff --git a/packages/operation-location-migration/project.json b/packages/operation-location-migration/project.json new file mode 100644 index 00000000..4683fbf2 --- /dev/null +++ b/packages/operation-location-migration/project.json @@ -0,0 +1,26 @@ +{ + "name": "@eddeee888/gcg-operation-location-migration", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/operation-location-migration/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nx/js:swc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/packages/operation-location-migration", + "main": "packages/operation-location-migration/src/index.ts", + "tsConfig": "packages/operation-location-migration/tsconfig.lib.json", + "assets": ["packages/operation-location-migration/*.md"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/operation-location-migration/jest.config.ts" + } + } + } +} diff --git a/packages/operation-location-migration/src/index.ts b/packages/operation-location-migration/src/index.ts new file mode 100644 index 00000000..3b60c6b7 --- /dev/null +++ b/packages/operation-location-migration/src/index.ts @@ -0,0 +1 @@ +export * from './lib/gcg-operation-location-migration'; diff --git a/packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts b/packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts new file mode 100644 index 00000000..d39fc72f --- /dev/null +++ b/packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts @@ -0,0 +1,9 @@ +import { gcgOperationLocationMigration } from './gcg-operation-location-migration'; + +describe('gcgOperationLocationMigration', () => { + it('should work', () => { + expect(gcgOperationLocationMigration()).toEqual( + 'gcg-operation-location-migration' + ); + }); +}); diff --git a/packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts b/packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts new file mode 100644 index 00000000..72d64aa4 --- /dev/null +++ b/packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts @@ -0,0 +1,3 @@ +export function gcgOperationLocationMigration(): string { + return 'gcg-operation-location-migration'; +} diff --git a/packages/operation-location-migration/tsconfig.json b/packages/operation-location-migration/tsconfig.json new file mode 100644 index 00000000..ea985582 --- /dev/null +++ b/packages/operation-location-migration/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "importHelpers": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noPropertyAccessFromIndexSignature": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/operation-location-migration/tsconfig.lib.json b/packages/operation-location-migration/tsconfig.lib.json new file mode 100644 index 00000000..33eca2c2 --- /dev/null +++ b/packages/operation-location-migration/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/packages/operation-location-migration/tsconfig.spec.json b/packages/operation-location-migration/tsconfig.spec.json new file mode 100644 index 00000000..0d3c604e --- /dev/null +++ b/packages/operation-location-migration/tsconfig.spec.json @@ -0,0 +1,15 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "moduleResolution": "node10", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 4942be1c..4d8f8246 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -15,6 +15,9 @@ "skipDefaultLibCheck": true, "baseUrl": ".", "paths": { + "@eddeee888/gcg-operation-location-migration": [ + "packages/operation-location-migration/src/index.ts" + ], "@eddeee888/gcg-server-config": ["packages/server-config/src/index.ts"], "@eddeee888/gcg-typescript-resolver-files": [ "packages/typescript-resolver-files/src/index.ts" diff --git a/yarn.lock b/yarn.lock index 27f42ce7..60d6abce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2450,6 +2450,13 @@ pretty-format "30.0.2" slash "^3.0.0" +"@jest/create-cache-key-function@^30.0.0": + version "30.0.2" + resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-30.0.2.tgz#10fac5359f210c1072689aa3d0294e021e662d1b" + integrity sha512-AwlDAHwEHDi+etw9vKWx9HeIApVos8GD/sSTpHtDkqhm9OWuEUPKKPP6EaS17yv0GSzBB3TeeJFLyJ5LPjRqWg== + dependencies: + "@jest/types" "30.0.1" + "@jest/diff-sequences@30.0.1": version "30.0.1" resolved "https://registry.yarnpkg.com/@jest/diff-sequences/-/diff-sequences-30.0.1.tgz#0ededeae4d071f5c8ffe3678d15f3a1be09156be" @@ -2744,6 +2751,108 @@ globby "^11.0.0" read-yaml-file "^1.1.0" +"@napi-rs/nice-android-arm-eabi@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-android-arm-eabi/-/nice-android-arm-eabi-1.0.4.tgz#d6b0194f10b1fac2b49d303aeab920651abf10f7" + integrity sha512-OZFMYUkih4g6HCKTjqJHhMUlgvPiDuSLZPbPBWHLjKmFTv74COzRlq/gwHtmEVaR39mJQ6ZyttDl2HNMUbLVoA== + +"@napi-rs/nice-android-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-android-arm64/-/nice-android-arm64-1.0.4.tgz#254ecc462693698ecf597c792d57b6b1b1a9467f" + integrity sha512-k8u7cjeA64vQWXZcRrPbmwjH8K09CBnNaPnI9L1D5N6iMPL3XYQzLcN6WwQonfcqCDv5OCY3IqX89goPTV4KMw== + +"@napi-rs/nice-darwin-arm64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-darwin-arm64/-/nice-darwin-arm64-1.0.4.tgz#7db12e6babb8fae50289ab604401501a7c2c452a" + integrity sha512-GsLdQvUcuVzoyzmtjsThnpaVEizAqH5yPHgnsBmq3JdVoVZHELFo7PuJEdfOH1DOHi2mPwB9sCJEstAYf3XCJA== + +"@napi-rs/nice-darwin-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-darwin-x64/-/nice-darwin-x64-1.0.4.tgz#f1f11a045934a4d4a2a22064cd3550fd20d5e2cb" + integrity sha512-1y3gyT3e5zUY5SxRl3QDtJiWVsbkmhtUHIYwdWWIQ3Ia+byd/IHIEpqAxOGW1nhhnIKfTCuxBadHQb+yZASVoA== + +"@napi-rs/nice-freebsd-x64@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-freebsd-x64/-/nice-freebsd-x64-1.0.4.tgz#79672daa873cd070d94118f0674d77e24ed65062" + integrity sha512-06oXzESPRdXUuzS8n2hGwhM2HACnDfl3bfUaSqLGImM8TA33pzDXgGL0e3If8CcFWT98aHows5Lk7xnqYNGFeA== + +"@napi-rs/nice-linux-arm-gnueabihf@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm-gnueabihf/-/nice-linux-arm-gnueabihf-1.0.4.tgz#ebd0fe94ecbf1a05be29aa04928eea8f97f57550" + integrity sha512-CgklZ6g8WL4+EgVVkxkEvvsi2DSLf9QIloxWO0fvQyQBp6VguUSX3eHLeRpqwW8cRm2Hv/Q1+PduNk7VK37VZw== + +"@napi-rs/nice-linux-arm64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm64-gnu/-/nice-linux-arm64-gnu-1.0.4.tgz#714d62af0ec354a60b134e8c3bbc018667248b5a" + integrity sha512-wdAJ7lgjhAlsANUCv0zi6msRwq+D4KDgU+GCCHssSxWmAERZa2KZXO0H2xdmoJ/0i03i6YfK/sWaZgUAyuW2oQ== + +"@napi-rs/nice-linux-arm64-musl@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-arm64-musl/-/nice-linux-arm64-musl-1.0.4.tgz#fa068003a1e18289b7ee9e58dfceb77a0f0b1d08" + integrity sha512-4b1KYG+sriufhFrpUS9uNOEYYJqSfcbnwGx6uGX7JjrH8tELG90cOpCawz5THNIwlS3DhLgnCOcn0+4p6z26QA== + +"@napi-rs/nice-linux-ppc64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-ppc64-gnu/-/nice-linux-ppc64-gnu-1.0.4.tgz#8e4ae1b53c200e6bfe80b31751685e97d4feb368" + integrity sha512-iaf3vMRgr23oe1PUaKpxaH3DS0IMN0+N9iEiWVwYPm/U15vZFYdqVegGfN2PzrZLUl5lc8ZxbmEKDfuqslhAMA== + +"@napi-rs/nice-linux-riscv64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-riscv64-gnu/-/nice-linux-riscv64-gnu-1.0.4.tgz#5de54f35ad57663b0121bcb8705ecc11e7f0bbda" + integrity sha512-UXoREY6Yw6rHrGuTwQgBxpfjK34t6mTjibE9/cXbefL9AuUCJ9gEgwNKZiONuR5QGswChqo9cnthjdKkYyAdDg== + +"@napi-rs/nice-linux-s390x-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-s390x-gnu/-/nice-linux-s390x-gnu-1.0.4.tgz#6fa0fe90d97278ce30f556165bdaaffca8d5bf15" + integrity sha512-eFbgYCRPmsqbYPAlLYU5hYTNbogmIDUvknilehHsFhCH1+0/kN87lP+XaLT0Yeq4V/rpwChSd9vlz4muzFArtw== + +"@napi-rs/nice-linux-x64-gnu@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-x64-gnu/-/nice-linux-x64-gnu-1.0.4.tgz#2b94c9dc0116c906dbbe0e3509075365e44e1081" + integrity sha512-4T3E6uTCwWT6IPnwuPcWVz3oHxvEp/qbrCxZhsgzwTUBEwu78EGNXGdHfKJQt3soth89MLqZJw+Zzvnhrsg1mQ== + +"@napi-rs/nice-linux-x64-musl@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-linux-x64-musl/-/nice-linux-x64-musl-1.0.4.tgz#5c8a7b1305b154747b47c7f9a69ae25441891179" + integrity sha512-NtbBkAeyBPLvCBkWtwkKXkNSn677eaT0cX3tygq+2qVv71TmHgX4gkX6o9BXjlPzdgPGwrUudavCYPT9tzkEqQ== + +"@napi-rs/nice-win32-arm64-msvc@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-arm64-msvc/-/nice-win32-arm64-msvc-1.0.4.tgz#95e2920ae08b11ae61dbdbc55320013391af01f9" + integrity sha512-vubOe3i+YtSJGEk/++73y+TIxbuVHi+W8ZzrRm2eETCjCRwNlgbfToQZ85dSA+4iBB/NJRGNp+O4hfdbbttZWA== + +"@napi-rs/nice-win32-ia32-msvc@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-ia32-msvc/-/nice-win32-ia32-msvc-1.0.4.tgz#ceed828b2ef32675430c69f110eb49e80d7c0aa7" + integrity sha512-BMOVrUDZeg1RNRKVlh4eyLv5djAAVLiSddfpuuQ47EFjBcklg0NUeKMFKNrKQR4UnSn4HAiACLD7YK7koskwmg== + +"@napi-rs/nice-win32-x64-msvc@1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice-win32-x64-msvc/-/nice-win32-x64-msvc-1.0.4.tgz#38148eac5fb12244e39dceef6e291d0aa5ba763d" + integrity sha512-kCNk6HcRZquhw/whwh4rHsdPyOSCQCgnVDVik+Y9cuSVTDy3frpiCJTScJqPPS872h4JgZKkr/+CwcwttNEo9Q== + +"@napi-rs/nice@^1.0.1": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@napi-rs/nice/-/nice-1.0.4.tgz#a5dbd1d4ab1767108f9bbe55e482e03c62845f60" + integrity sha512-Sqih1YARrmMoHlXGgI9JrrgkzxcaaEso0AH+Y7j8NHonUs+xe4iDsgC3IBIDNdzEewbNpccNN6hip+b5vmyRLw== + optionalDependencies: + "@napi-rs/nice-android-arm-eabi" "1.0.4" + "@napi-rs/nice-android-arm64" "1.0.4" + "@napi-rs/nice-darwin-arm64" "1.0.4" + "@napi-rs/nice-darwin-x64" "1.0.4" + "@napi-rs/nice-freebsd-x64" "1.0.4" + "@napi-rs/nice-linux-arm-gnueabihf" "1.0.4" + "@napi-rs/nice-linux-arm64-gnu" "1.0.4" + "@napi-rs/nice-linux-arm64-musl" "1.0.4" + "@napi-rs/nice-linux-ppc64-gnu" "1.0.4" + "@napi-rs/nice-linux-riscv64-gnu" "1.0.4" + "@napi-rs/nice-linux-s390x-gnu" "1.0.4" + "@napi-rs/nice-linux-x64-gnu" "1.0.4" + "@napi-rs/nice-linux-x64-musl" "1.0.4" + "@napi-rs/nice-win32-arm64-msvc" "1.0.4" + "@napi-rs/nice-win32-ia32-msvc" "1.0.4" + "@napi-rs/nice-win32-x64-msvc" "1.0.4" + "@napi-rs/wasm-runtime@0.2.4": version "0.2.4" resolved "https://registry.yarnpkg.com/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.4.tgz#d27788176f250d86e498081e3c5ff48a17606918" @@ -3005,6 +3114,11 @@ resolved "https://registry.yarnpkg.com/@repeaterjs/repeater/-/repeater-3.0.6.tgz#be23df0143ceec3c69f8b6c2517971a5578fdaa2" integrity sha512-Javneu5lsuhwNCryN+pXH93VPQ8g0dBX7wItHFgYiwQmzE1sVdg5tWHiOgHywzL2W21XQopa7IwIEnNbmeUJYA== +"@sec-ant/readable-stream@^0.4.1": + version "0.4.1" + resolved "https://registry.yarnpkg.com/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz#60de891bb126abfdc5410fdc6166aca065f10a0c" + integrity sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -3015,6 +3129,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.34.38.tgz#2365df7c23406a4d79413a766567bfbca708b49d" integrity sha512-HpkxMmc2XmZKhvaKIZZThlHmx1L0I/V1hWK1NubtlFnr6ZqdiOpV72TKudZUNQjZNsyDBay72qFEhEvb+bcwcA== +"@sindresorhus/is@^5.2.0": + version "5.6.0" + resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-5.6.0.tgz#41dd6093d34652cddb5d5bdeee04eafc33826668" + integrity sha512-TV7t8GKYaJWsn00tFDqBw8+Uqmr8A0fRU1tvTQhyZzGv0sJCGRQL3JGMI3ucuKo3XIZdUP+Lx7/gh2t3lewy7g== + "@sinonjs/commons@^3.0.1": version "3.0.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" @@ -3054,6 +3173,21 @@ source-map-support "^0.5.21" tslib "^2.6.3" +"@swc/cli@~0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@swc/cli/-/cli-0.6.0.tgz#fe986a436797c9d3850938366dbd660c9ba1101f" + integrity sha512-Q5FsI3Cw0fGMXhmsg7c08i4EmXCrcl+WnAxb6LYOLHw4JFFC3yzmx9LaXZ7QMbA+JZXbigU2TirI7RAfO0Qlnw== + dependencies: + "@swc/counter" "^0.1.3" + "@xhmikosr/bin-wrapper" "^13.0.5" + commander "^8.3.0" + fast-glob "^3.2.5" + minimatch "^9.0.3" + piscina "^4.3.1" + semver "^7.3.8" + slash "3.0.0" + source-map "^0.7.3" + "@swc/core-darwin-arm64@1.5.7": version "1.5.7" resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.5.7.tgz#2b5cdbd34e4162e50de6147dd1a5cb12d23b08e8" @@ -3135,6 +3269,22 @@ dependencies: tslib "^2.4.0" +"@swc/helpers@~0.5.11": + version "0.5.17" + resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.17.tgz#5a7be95ac0f0bf186e7e6e890e7a6f6cda6ce971" + integrity sha512-5IKx/Y13RsYd+sauPb2x+U/xZikHjolzfuDgTAl/Tdf3Q8rslRvC19NKDLgAJQ6wsqADk10ntlv08nPFw/gO/A== + dependencies: + tslib "^2.8.0" + +"@swc/jest@~0.2.38": + version "0.2.39" + resolved "https://registry.yarnpkg.com/@swc/jest/-/jest-0.2.39.tgz#482bee0adb0726fab1487a4f902a278ec563a6b7" + integrity sha512-eyokjOwYd0Q8RnMHri+8/FS1HIrIUKK/sRrFp8c1dThUOfNeCWbLmBP1P5VsKdvmkd25JaH+OKYwEYiAYg9YAA== + dependencies: + "@jest/create-cache-key-function" "^30.0.0" + "@swc/counter" "^0.1.3" + jsonc-parser "^3.2.0" + "@swc/types@0.1.7": version "0.1.7" resolved "https://registry.yarnpkg.com/@swc/types/-/types-0.1.7.tgz#ea5d658cf460abff51507ca8d26e2d391bafb15e" @@ -3142,6 +3292,18 @@ dependencies: "@swc/counter" "^0.1.3" +"@szmarczak/http-timer@^5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@szmarczak/http-timer/-/http-timer-5.0.1.tgz#c7c1bf1141cdd4751b0399c8fc7b8b664cd5be3a" + integrity sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw== + dependencies: + defer-to-connect "^2.0.1" + +"@tokenizer/token@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@tokenizer/token/-/token-0.3.0.tgz#fe98a93fe789247e998c75e74e9c7c63217aa276" + integrity sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A== + "@ts-morph/common@~0.23.0": version "0.23.0" resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.23.0.tgz#bd4ddbd3f484f29476c8bd985491592ae5fc147e" @@ -3229,6 +3391,11 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.8.tgz#958b91c991b1867ced318bedea0e215ee050726e" integrity sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w== +"@types/http-cache-semantics@^4.0.2": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.4.tgz#b979ebad3919799c979b17c72621c0bc0a31c6c4" + integrity sha512-1m0bIFVc7eJWyve9S0RnuRgcQqF/Xd5QsUZAZeQFr1Q3/p9JWoQQEqmVy+DPTNpGXwhgIetAoYF8JSc33q29QA== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1", "@types/istanbul-lib-coverage@^2.0.6": version "2.0.6" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz#7739c232a1fee9b4d3ce8985f314c0c6d33549d7" @@ -3660,6 +3827,104 @@ busboy "^1.6.0" tslib "^2.6.3" +"@xhmikosr/archive-type@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@xhmikosr/archive-type/-/archive-type-7.0.0.tgz#74746a210b59d7d8a77aa69a422f0dae025b3798" + integrity sha512-sIm84ZneCOJuiy3PpWR5bxkx3HaNt1pqaN+vncUBZIlPZCq8ASZH+hBVdu5H8znR7qYC6sKwx+ie2Q7qztJTxA== + dependencies: + file-type "^19.0.0" + +"@xhmikosr/bin-check@^7.0.3": + version "7.0.3" + resolved "https://registry.yarnpkg.com/@xhmikosr/bin-check/-/bin-check-7.0.3.tgz#9ce53f339db419f08e799f4c55b82b38ede13c95" + integrity sha512-4UnCLCs8DB+itHJVkqFp9Zjg+w/205/J2j2wNBsCEAm/BuBmtua2hhUOdAMQE47b1c7P9Xmddj0p+X1XVsfHsA== + dependencies: + execa "^5.1.1" + isexe "^2.0.0" + +"@xhmikosr/bin-wrapper@^13.0.5": + version "13.0.6" + resolved "https://registry.yarnpkg.com/@xhmikosr/bin-wrapper/-/bin-wrapper-13.0.6.tgz#db12a2ebf618e53ac22c34647b76c0a40b830a0b" + integrity sha512-07ht1n1F3L7mmfv51Egbtc6HGZ9IuXt2zu10d0yDXL7IqZ7m0ToAnkW2NFWMRTKkaI6FnC5YA4WbPx+874MJKA== + dependencies: + "@xhmikosr/bin-check" "^7.0.3" + "@xhmikosr/downloader" "^15.0.2" + "@xhmikosr/os-filter-obj" "^3.0.0" + binary-version-check "^6.1.0" + +"@xhmikosr/decompress-tar@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@xhmikosr/decompress-tar/-/decompress-tar-8.0.1.tgz#ca9cc65453b5ac59bb5eb897b6f1390a4905b565" + integrity sha512-dpEgs0cQKJ2xpIaGSO0hrzz3Kt8TQHYdizHsgDtLorWajuHJqxzot9Hbi0huRxJuAGG2qiHSQkwyvHHQtlE+fg== + dependencies: + file-type "^19.0.0" + is-stream "^2.0.1" + tar-stream "^3.1.7" + +"@xhmikosr/decompress-tarbz2@^8.0.1": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@xhmikosr/decompress-tarbz2/-/decompress-tarbz2-8.0.2.tgz#1c19b4a59585321a7c64ab0ff1f85f92b66fca1a" + integrity sha512-p5A2r/AVynTQSsF34Pig6olt9CvRj6J5ikIhzUd3b57pUXyFDGtmBstcw+xXza0QFUh93zJsmY3zGeNDlR2AQQ== + dependencies: + "@xhmikosr/decompress-tar" "^8.0.1" + file-type "^19.6.0" + is-stream "^2.0.1" + seek-bzip "^2.0.0" + unbzip2-stream "^1.4.3" + +"@xhmikosr/decompress-targz@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@xhmikosr/decompress-targz/-/decompress-targz-8.0.1.tgz#54dbd48e83861db43857970c2fcdbd431371e95b" + integrity sha512-mvy5AIDIZjQ2IagMI/wvauEiSNHhu/g65qpdM4EVoYHUJBAmkQWqcPJa8Xzi1aKVTmOA5xLJeDk7dqSjlHq8Mg== + dependencies: + "@xhmikosr/decompress-tar" "^8.0.1" + file-type "^19.0.0" + is-stream "^2.0.1" + +"@xhmikosr/decompress-unzip@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@xhmikosr/decompress-unzip/-/decompress-unzip-7.0.0.tgz#dcf9417829bf9fe474f6064513017949915e14c0" + integrity sha512-GQMpzIpWTsNr6UZbISawsGI0hJ4KA/mz5nFq+cEoPs12UybAqZWKbyIaZZyLbJebKl5FkLpsGBkrplJdjvUoSQ== + dependencies: + file-type "^19.0.0" + get-stream "^6.0.1" + yauzl "^3.1.2" + +"@xhmikosr/decompress@^10.0.1": + version "10.0.1" + resolved "https://registry.yarnpkg.com/@xhmikosr/decompress/-/decompress-10.0.1.tgz#63650498b4f3dd0fb5ee645dc5a35e1a7baad632" + integrity sha512-6uHnEEt5jv9ro0CDzqWlFgPycdE+H+kbJnwyxgZregIMLQ7unQSCNVsYG255FoqU8cP46DyggI7F7LohzEl8Ag== + dependencies: + "@xhmikosr/decompress-tar" "^8.0.1" + "@xhmikosr/decompress-tarbz2" "^8.0.1" + "@xhmikosr/decompress-targz" "^8.0.1" + "@xhmikosr/decompress-unzip" "^7.0.0" + graceful-fs "^4.2.11" + make-dir "^4.0.0" + strip-dirs "^3.0.0" + +"@xhmikosr/downloader@^15.0.2": + version "15.0.2" + resolved "https://registry.yarnpkg.com/@xhmikosr/downloader/-/downloader-15.0.2.tgz#1a6aa6792c6375e88a44723cda880938e72e78b7" + integrity sha512-u4evdXmgQJdhF1nMXldUFfkFUeQAAqr5HZ0g+jvlyOqi6uwajft3RUunriio3jVGzgYR7B5jIf8qwYHangyJnQ== + dependencies: + "@xhmikosr/archive-type" "^7.0.0" + "@xhmikosr/decompress" "^10.0.1" + content-disposition "^0.5.4" + defaults "^3.0.0" + ext-name "^5.0.0" + file-type "^19.6.0" + filenamify "^6.0.0" + get-stream "^6.0.1" + got "^13.0.0" + +"@xhmikosr/os-filter-obj@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@xhmikosr/os-filter-obj/-/os-filter-obj-3.0.0.tgz#917d380868d03ce853f90a919716ef73f6b26808" + integrity sha512-siPY6BD5dQ2SZPl3I0OZBHL27ZqZvLEosObsZRQ1NUB8qcxegwt0T9eKtV96JMFQpIz1elhkzqOg4c/Ri6Dp9A== + dependencies: + arch "^3.0.0" + "@yarnpkg/lockfile@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" @@ -3789,6 +4054,11 @@ anymatch@^3.1.3: normalize-path "^3.0.0" picomatch "^2.0.4" +arch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/arch/-/arch-3.0.0.tgz#a44e7077da4615fc5f1e3da21fbfc201d2c1817c" + integrity sha512-AmIAC+Wtm2AU8lGfTtHsw0Y9Qtftx2YXEEtiBP10xFUtMOA+sHHx6OAddyL52mUKh1vsXQ6/w1mVDptZCyUt4Q== + arg@^4.1.0: version "4.1.3" resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" @@ -3889,6 +4159,11 @@ axios@^1.8.3: form-data "^4.0.0" proxy-from-env "^1.1.0" +b4a@^1.6.4: + version "1.6.7" + resolved "https://registry.yarnpkg.com/b4a/-/b4a-1.6.7.tgz#a99587d4ebbfbd5a6e3b21bdb5d5fa385767abe4" + integrity sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg== + babel-jest@30.0.4: version "30.0.4" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-30.0.4.tgz#63945c1b27227312fc687689073124dba5b28282" @@ -4043,6 +4318,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +bare-events@^2.2.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/bare-events/-/bare-events-2.6.0.tgz#11d9506da109e363a2f3af050fbb005ccdb3ee8f" + integrity sha512-EKZ5BTXYExaNqi3I3f9RtEsaI/xBSGjE0XZCZilPzFAV/goswFHuPd9jEZlPIZ/iNZJwDSao9qRiScySz7MbQg== + base64-js@^1.3.1: version "1.5.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" @@ -4055,6 +4335,23 @@ better-path-resolve@1.0.0: dependencies: is-windows "^1.0.0" +binary-version-check@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/binary-version-check/-/binary-version-check-6.1.0.tgz#5db7b0199dd32cdc35cada48d7535c5c1c169dcd" + integrity sha512-REKdLKmuViV2WrtWXvNSiPX04KbIjfUV3Cy8batUeOg+FtmowavzJorfFhWq95cVJzINnL/44ixP26TrdJZACA== + dependencies: + binary-version "^7.1.0" + semver "^7.6.0" + semver-truncate "^3.0.0" + +binary-version@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/binary-version/-/binary-version-7.1.0.tgz#672f045628e6cd416a2292d4c1e06567f7e560cc" + integrity sha512-Iy//vPc3ANPNlIWd242Npqc8MK0a/i4kVcHDlDA6HNMv5zMxz4ulIFhOSYJVKw/8AbHdHy0CnGYEt1QqSXxPsw== + dependencies: + execa "^8.0.1" + find-versions "^6.0.0" + bl@^4.0.3, bl@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -4134,12 +4431,17 @@ bser@2.1.1: dependencies: node-int64 "^0.4.0" +buffer-crc32@~0.2.3: + version "0.2.13" + resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" + integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== + buffer-from@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer@^5.5.0: +buffer@^5.2.1, buffer@^5.5.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== @@ -4161,6 +4463,24 @@ busboy@^1.6.0: dependencies: streamsearch "^1.1.0" +cacheable-lookup@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz#3476a8215d046e5a3202a9209dd13fec1f933a27" + integrity sha512-+qJyx4xiKra8mZrcwhjMRMUhD5NR1R8esPkzIYxX96JiecFoxAXFuz/GpR3+ev4PE1WamHip78wV0vcmPQtp8w== + +cacheable-request@^10.2.8: + version "10.2.14" + resolved "https://registry.yarnpkg.com/cacheable-request/-/cacheable-request-10.2.14.tgz#eb915b665fda41b79652782df3f553449c406b9d" + integrity sha512-zkDT5WAF4hSSoUgyfg5tFIxz8XQK+25W/TLVojJTMKBaxevLBBtLxgqguAuVQB8PVW79FVjHcU+GJ9tVbDZ9mQ== + dependencies: + "@types/http-cache-semantics" "^4.0.2" + get-stream "^6.0.1" + http-cache-semantics "^4.1.1" + keyv "^4.5.3" + mimic-response "^4.0.0" + normalize-url "^8.0.0" + responselike "^3.0.0" + call-bind@^1.0.2, call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" @@ -4416,6 +4736,16 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +commander@^6.0.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== + +commander@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + common-tags@1.8.2: version "1.8.2" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" @@ -4440,6 +4770,18 @@ constant-case@^3.0.4: tslib "^2.0.3" upper-case "^2.0.2" +content-disposition@^0.5.4: + version "0.5.4" + resolved "https://registry.yarnpkg.com/content-disposition/-/content-disposition-0.5.4.tgz#8b82b4efac82512a02bb0b1dcec9d2c5e8eb5bfe" + integrity sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ== + dependencies: + safe-buffer "5.2.1" + +convert-hrtime@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/convert-hrtime/-/convert-hrtime-5.0.0.tgz#f2131236d4598b95de856926a67100a0a97e9fa3" + integrity sha512-lOETlkIeYSJWcbbcvjRKGxVMXJR+8+OQb/mTPbA4ObPMytYIsUbuOE0Jzy60hjARYszq1id0j8KgVhC+WGZVTg== + convert-source-map@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" @@ -4636,6 +4978,13 @@ decimal.js@^10.5.0: resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.6.0.tgz#e649a43e3ab953a72192ff5983865e509f37ed9a" integrity sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg== +decompress-response@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc" + integrity sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ== + dependencies: + mimic-response "^3.1.0" + dedent@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/dedent/-/dedent-1.6.0.tgz#79d52d6389b1ffa67d2bcef59ba51847a9d503b2" @@ -4658,6 +5007,16 @@ defaults@^1.0.3: dependencies: clone "^1.0.2" +defaults@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-3.0.0.tgz#60b9e0003df1018737c2ce3f4289d8f64786c9c4" + integrity sha512-RsqXDEAALjfRTro+IFNKpcPCt0/Cy2FqHSIlnomiJp9YGadpQnrtbRpSgN2+np21qHcIKiva4fiOQGjS9/qR/A== + +defer-to-connect@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/defer-to-connect/-/defer-to-connect-2.0.1.tgz#8016bdb4143e4632b77a3449c6236277de520587" + integrity sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg== + define-data-property@^1.0.1, define-data-property@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" @@ -5081,6 +5440,21 @@ execa@^5.1.1: signal-exit "^3.0.3" strip-final-newline "^2.0.0" +execa@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c" + integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^8.0.1" + human-signals "^5.0.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^4.1.0" + strip-final-newline "^3.0.0" + exit-x@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/exit-x/-/exit-x-0.2.2.tgz#1f9052de3b8d99a696b10dad5bced9bdd5c3aa64" @@ -5098,6 +5472,21 @@ expect@30.0.4, expect@^30.0.0: jest-mock "30.0.2" jest-util "30.0.2" +ext-list@^2.0.0: + version "2.2.2" + resolved "https://registry.yarnpkg.com/ext-list/-/ext-list-2.2.2.tgz#0b98e64ed82f5acf0f2931babf69212ef52ddd37" + integrity sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA== + dependencies: + mime-db "^1.28.0" + +ext-name@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ext-name/-/ext-name-5.0.0.tgz#70781981d183ee15d13993c8822045c506c8f0a6" + integrity sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ== + dependencies: + ext-list "^2.0.0" + sort-keys-length "^1.0.0" + extendable-error@^0.1.5: version "0.1.7" resolved "https://registry.yarnpkg.com/extendable-error/-/extendable-error-0.1.7.tgz#60b9adf206264ac920058a7395685ae4670c2b96" @@ -5127,6 +5516,22 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-fifo@^1.2.0, fast-fifo@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/fast-fifo/-/fast-fifo-1.3.2.tgz#286e31de96eb96d38a97899815740ba2a4f3640c" + integrity sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ== + +fast-glob@^3.2.5: + version "3.3.3" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.3.tgz#d06d585ce8dba90a16b0505c543c3ccfb3aeb818" + integrity sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.8" + fast-glob@^3.2.9, fast-glob@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" @@ -5206,6 +5611,16 @@ file-entry-cache@^8.0.0: dependencies: flat-cache "^4.0.0" +file-type@^19.0.0, file-type@^19.6.0: + version "19.6.0" + resolved "https://registry.yarnpkg.com/file-type/-/file-type-19.6.0.tgz#b43d8870453363891884cf5e79bb3e4464f2efd3" + integrity sha512-VZR5I7k5wkD0HgFnMsq5hOsSc710MJMu5Nc5QYsbe38NN5iPV/XTObYLc/cpttRTf6lX538+5uO1ZQRhYibiZQ== + dependencies: + get-stream "^9.0.1" + strtok3 "^9.0.1" + token-types "^6.0.0" + uint8array-extras "^1.3.0" + filelist@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" @@ -5213,6 +5628,18 @@ filelist@^1.0.4: dependencies: minimatch "^5.0.1" +filename-reserved-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/filename-reserved-regex/-/filename-reserved-regex-3.0.0.tgz#3d5dd6d4e2d73a3fed2ebc4cd0b3448869a081f7" + integrity sha512-hn4cQfU6GOT/7cFHXBqeBg2TbrMBgdD0kcjLhvSQYYwm3s4B6cjvBfb7nBALJLAXqmU5xajSa7X2NnUud/VCdw== + +filenamify@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/filenamify/-/filenamify-6.0.0.tgz#38def94098c62154c42a41d822650f5f55bcbac2" + integrity sha512-vqIlNogKeyD3yzrm0yhRMQg8hOVwYcYRfjEoODd49iCprMn4HL85gK3HcykQE53EPIpX3HcAbGA5ELQv216dAQ== + dependencies: + filename-reserved-regex "^3.0.0" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -5243,6 +5670,14 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" +find-versions@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-6.0.0.tgz#fda285d3bb7c0c098f09e0727c54d31735f0c7d1" + integrity sha512-2kCCtc+JvcZ86IGAz3Z2Y0A1baIz9fL31pH/0S1IqZr9Iwnjq8izfPtrCyQKO6TLMPELLsQMre7VDqeIKCsHkA== + dependencies: + semver-regex "^4.0.5" + super-regex "^1.0.0" + find-yarn-workspace-root2@1.2.16: version "1.2.16" resolved "https://registry.yarnpkg.com/find-yarn-workspace-root2/-/find-yarn-workspace-root2-1.2.16.tgz#60287009dd2f324f59646bdb4b7610a6b301c2a9" @@ -5289,6 +5724,11 @@ foreground-child@^3.1.0: cross-spawn "^7.0.0" signal-exit "^4.0.1" +form-data-encoder@^2.1.2: + version "2.1.4" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-2.1.4.tgz#261ea35d2a70d48d30ec7a9603130fa5515e9cd5" + integrity sha512-yDYSgNMraqvnxiEXO4hi88+YZxaHC6QKzb5N84iRCTDeRO7ZALpir/lVmf/uXUhnwUr2O4HU8s/n6x+yNjQkHw== + form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -5343,6 +5783,11 @@ function-bind@^1.1.2: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== +function-timeout@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/function-timeout/-/function-timeout-1.0.2.tgz#e5a7b6ffa523756ff20e1231bbe37b5f373aadd5" + integrity sha512-939eZS4gJ3htTHAldmyyuzlrD58P03fHG49v2JfFXbV6OhvZKRC9j2yAtdHw/zrp2zXHuv05zMIy40F0ge7spA== + function.prototype.name@^1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" @@ -5384,11 +5829,24 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== -get-stream@^6.0.0: +get-stream@^6.0.0, get-stream@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +get-stream@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2" + integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA== + +get-stream@^9.0.1: + version "9.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-9.0.1.tgz#95157d21df8eb90d1647102b63039b1df60ebd27" + integrity sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA== + dependencies: + "@sec-ant/readable-stream" "^0.4.1" + is-stream "^4.0.1" + get-symbol-description@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.2.tgz#533744d5aa20aca4e079c8e5daf7fd44202821f5" @@ -5493,6 +5951,23 @@ gopd@^1.0.1: dependencies: get-intrinsic "^1.1.3" +got@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/got/-/got-13.0.0.tgz#a2402862cef27a5d0d1b07c0fb25d12b58175422" + integrity sha512-XfBk1CxOOScDcMr9O1yKkNaQyy865NbYs+F7dr4H0LZMVgCj2Le59k6PqbNHoL5ToeaEQUYh6c6yMfVcc6SJxA== + dependencies: + "@sindresorhus/is" "^5.2.0" + "@szmarczak/http-timer" "^5.0.1" + cacheable-lookup "^7.0.0" + cacheable-request "^10.2.8" + decompress-response "^6.0.0" + form-data-encoder "^2.1.2" + get-stream "^6.0.1" + http2-wrapper "^2.1.10" + lowercase-keys "^3.0.0" + p-cancelable "^3.0.0" + responselike "^3.0.0" + graceful-fs@^4.1.2, graceful-fs@^4.1.5, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.11, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" @@ -5645,6 +6120,11 @@ html-escaper@^2.0.0: resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453" integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg== +http-cache-semantics@^4.1.1: + version "4.2.0" + resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz#205f4db64f8562b76a4ff9235aa5279839a09dd5" + integrity sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ== + http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.2: version "7.0.2" resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz#9a8b1f246866c028509486585f62b8f2c18c270e" @@ -5653,6 +6133,14 @@ http-proxy-agent@^7.0.0, http-proxy-agent@^7.0.2: agent-base "^7.1.0" debug "^4.3.4" +http2-wrapper@^2.1.10: + version "2.2.1" + resolved "https://registry.yarnpkg.com/http2-wrapper/-/http2-wrapper-2.2.1.tgz#310968153dcdedb160d8b72114363ef5fce1f64a" + integrity sha512-V5nVw1PAOgfI3Lmeaj2Exmeg7fenjhRUgz1lPSezy1CuhPYbgQtbQj4jZfEAEMlaL+vupsvhjqCyjzob0yxsmQ== + dependencies: + quick-lru "^5.1.1" + resolve-alpn "^1.2.0" + https-proxy-agent@^7.0.0: version "7.0.5" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz#9e8b5013873299e11fab6fd548405da2d6c602b2" @@ -5679,6 +6167,11 @@ human-signals@^2.1.0: resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +human-signals@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28" + integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ== + iconv-lite@0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501" @@ -5700,7 +6193,7 @@ identity-obj-proxy@3.0.0: dependencies: harmony-reflect "^1.4.6" -ieee754@^1.1.13: +ieee754@^1.1.13, ieee754@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== @@ -5785,6 +6278,13 @@ inquirer@^8.0.0: through "^2.3.6" wrap-ansi "^6.0.1" +inspect-with-kind@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/inspect-with-kind/-/inspect-with-kind-1.0.5.tgz#fce151d4ce89722c82ca8e9860bb96f9167c316c" + integrity sha512-MAQUJuIo7Xqk8EVNP+6d3CKq9c80hi4tjIbIAT6lmGW9W6WzlHiu9PS8uSuUYU+Do+j1baiFp3H25XEVxDIG2g== + dependencies: + kind-of "^6.0.2" + internal-slot@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802" @@ -5931,7 +6431,7 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-plain-obj@^1.1.0: +is-plain-obj@^1.0.0, is-plain-obj@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== @@ -5963,11 +6463,21 @@ is-shared-array-buffer@^1.0.2, is-shared-array-buffer@^1.0.3: dependencies: call-bind "^1.0.7" -is-stream@^2.0.0: +is-stream@^2.0.0, is-stream@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== +is-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== + +is-stream@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-4.0.1.tgz#375cf891e16d2e4baec250b85926cffc14720d9b" + integrity sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A== + is-string@^1.0.5, is-string@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" @@ -6647,6 +7157,11 @@ jsonc-parser@3.2.0: resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== +jsonc-parser@^3.2.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.3.1.tgz#f2a524b4f7fd11e3d791e559977ad60b98b798b4" + integrity sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ== + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -6654,7 +7169,7 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" -keyv@^4.5.4: +keyv@^4.5.3, keyv@^4.5.4: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== @@ -6669,7 +7184,7 @@ kill-port@^1.6.1: get-them-args "1.3.2" shell-exec "1.0.2" -kind-of@^6.0.3: +kind-of@^6.0.2, kind-of@^6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== @@ -6809,6 +7324,11 @@ lower-case@^2.0.2: dependencies: tslib "^2.0.3" +lowercase-keys@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-3.0.0.tgz#c5e7d442e37ead247ae9db117a9d0a467c89d4f2" + integrity sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ== + lru-cache@^10.0.1, lru-cache@^10.2.0: version "10.2.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3" @@ -6936,6 +7456,11 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== +mime-db@^1.28.0: + version "1.54.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.54.0.tgz#cddb3ee4f9c64530dff640236661d42cb6a314f5" + integrity sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ== + mime-types@^2.1.12: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" @@ -6948,6 +7473,21 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== +mimic-fn@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" + integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== + +mimic-response@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9" + integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ== + +mimic-response@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-4.0.0.tgz#35468b19e7c75d10f5165ea25e75a5ceea7cf70f" + integrity sha512-e5ISH9xMYU0DzrT+jl8q2ze9D6eWBto+I8CNpe+VI+K2J/F/k3PdkdTdz4wvGVH4NTpo+NRYTVIuMQEMMcsLqg== + min-indent@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" @@ -7099,6 +7639,11 @@ normalize-path@^3.0.0: resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +normalize-url@^8.0.0: + version "8.0.2" + resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-8.0.2.tgz#3b343a42f837e4dae2b01917c04e8de3782e9170" + integrity sha512-Ee/R3SyN4BuynXcnTaekmaVdbDAEiNrHqjQIA37mHU8G9pf7aaAD4ZX3XjBLo6rsdcxA/gtkcNYZLt30ACgynw== + npm-package-arg@11.0.1: version "11.0.1" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-11.0.1.tgz#f208b0022c29240a1c532a449bdde3f0a4708ebc" @@ -7116,6 +7661,13 @@ npm-run-path@^4.0.1: dependencies: path-key "^3.0.0" +npm-run-path@^5.1.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.3.0.tgz#e23353d0ebb9317f174e93417e4a4d82d0249e9f" + integrity sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ== + dependencies: + path-key "^4.0.0" + nullthrows@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" @@ -7217,6 +7769,13 @@ onetime@^5.1.0, onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" +onetime@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" + integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== + dependencies: + mimic-fn "^4.0.0" + open@^8.4.0: version "8.4.2" resolved "https://registry.yarnpkg.com/open/-/open-8.4.2.tgz#5b5ffe2a8f793dcd2aad73e550cb87b59cb084f9" @@ -7277,6 +7836,11 @@ outdent@^0.5.0: resolved "https://registry.yarnpkg.com/outdent/-/outdent-0.5.0.tgz#9e10982fdc41492bb473ad13840d22f9655be2ff" integrity sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q== +p-cancelable@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/p-cancelable/-/p-cancelable-3.0.0.tgz#63826694b54d61ca1c20ebcb6d3ecf5e14cd8050" + integrity sha512-mlVgR3PGuzlo0MmTdk4cXqXWlwQDLnONTAg6sm62XkMJEiRxN3GL3SffkYvqwonbkJBcrI7Uvv5Zh9yjvn2iUw== + p-filter@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-filter/-/p-filter-2.1.0.tgz#1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c" @@ -7418,6 +7982,11 @@ path-key@^3.0.0, path-key@^3.1.0: resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== +path-key@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" + integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== + path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" @@ -7456,6 +8025,16 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +peek-readable@^5.3.1: + version "5.4.2" + resolved "https://registry.yarnpkg.com/peek-readable/-/peek-readable-5.4.2.tgz#aff1e1ba27a7d6911ddb103f35252ffc1787af49" + integrity sha512-peBp3qZyuS6cNIJ2akRNG1uo1WJ1d0wTxg/fxMdZ0BqCVhx242bSFHM9eNqflfJVS9SsgkzgT/1UgnsurBOTMg== + +pend@~1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" + integrity sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -7491,6 +8070,13 @@ pirates@^4.0.7: resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.7.tgz#643b4a18c4257c8a65104b73f3049ce9a0a15e22" integrity sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA== +piscina@^4.3.1: + version "4.9.2" + resolved "https://registry.yarnpkg.com/piscina/-/piscina-4.9.2.tgz#80f2c2375231720337c703e443941adfac8caf75" + integrity sha512-Fq0FERJWFEUpB4eSY59wSNwXD4RYqR+nR/WiEVcZW8IWfVBxJJafcgTEZDQo8k3w0sUarJ8RyVbbUF4GQ2LGbQ== + optionalDependencies: + "@napi-rs/nice" "^1.0.1" + pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" @@ -7574,6 +8160,11 @@ quick-lru@^4.0.1: resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-4.0.1.tgz#5b8878f113a58217848c6482026c73e1ba57727f" integrity sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g== +quick-lru@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932" + integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA== + react-is@^18.3.1: version "18.3.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e" @@ -7712,6 +8303,11 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +resolve-alpn@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9" + integrity sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g== + resolve-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" @@ -7752,6 +8348,13 @@ resolve@^1.19.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +responselike@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/responselike/-/responselike-3.0.0.tgz#20decb6c298aff0dbee1c355ca95461d42823626" + integrity sha512-40yHxbNcl2+rzXvZuVkrYohathsSJlMTXKryG5y8uciHv1+xDLHQpgjG64JUO9nrEq2jGLH6IZ8BcZyw3wrweg== + dependencies: + lowercase-keys "^3.0.0" + restore-cursor@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-3.1.0.tgz#39f67c54b3a7a58cea5236d95cf0034239631f7e" @@ -7811,7 +8414,7 @@ safe-array-concat@^1.1.2: has-symbols "^1.0.3" isarray "^2.0.5" -safe-buffer@~5.2.0: +safe-buffer@5.2.1, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -7842,6 +8445,25 @@ scuid@^1.1.0: resolved "https://registry.yarnpkg.com/scuid/-/scuid-1.1.0.tgz#d3f9f920956e737a60f72d0e4ad280bf324d5dab" integrity sha512-MuCAyrGZcTLfQoH2XoBlQ8C6bzwN88XT/0slOGz0pn8+gIP85BOAfYa44ZXQUTOwRwPU0QvgU+V+OSajl/59Xg== +seek-bzip@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/seek-bzip/-/seek-bzip-2.0.0.tgz#f0478ab6acd0ac72345d18dc7525dd84d3c706a2" + integrity sha512-SMguiTnYrhpLdk3PwfzHeotrcwi8bNV4iemL9tx9poR/yeaMYwB9VzR1w7b57DuWpuqR8n6oZboi0hj3AxZxQg== + dependencies: + commander "^6.0.0" + +semver-regex@^4.0.5: + version "4.0.5" + resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-4.0.5.tgz#fbfa36c7ba70461311f5debcb3928821eb4f9180" + integrity sha512-hunMQrEy1T6Jr2uEVjrAIqjwWcQTgOAcIM52C8MY1EZSD3DDNft04XzvYKPqjED65bNVVko0YI38nYeEHCX3yw== + +semver-truncate@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/semver-truncate/-/semver-truncate-3.0.0.tgz#0e3b4825d4a4225d8ae6e7c72231182b42edba40" + integrity sha512-LJWA9kSvMolR51oDE6PN3kALBNaUdkxzAGcexw8gjMA8xr5zUqK0JiR3CgARSqanYF3Z1YHvsErb1KDgh+v7Rg== + dependencies: + semver "^7.3.5" + "semver@2 || 3 || 4 || 5": version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" @@ -7859,7 +8481,7 @@ semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.7.2: +semver@^7.3.8, semver@^7.7.2: version "7.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.2.tgz#67d99fdcd35cec21e6f8b87a7fd515a33f982b58" integrity sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA== @@ -7954,7 +8576,7 @@ signal-exit@^3.0.2, signal-exit@^3.0.3: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1: +signal-exit@^4.0.1, signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -7964,7 +8586,7 @@ signedsource@^1.0.0: resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" integrity sha512-6+eerH9fEnNmi/hyM1DXcRK3pWdoMQtlkQ+ns0ntzunjKqp5i3sKCc80ym8Fib3iaYhdJUOPdhlJWj1tvge2Ww== -slash@^3.0.0: +slash@3.0.0, slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== @@ -8007,6 +8629,20 @@ snake-case@^3.0.4: dot-case "^3.0.4" tslib "^2.0.3" +sort-keys-length@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sort-keys-length/-/sort-keys-length-1.0.1.tgz#9cb6f4f4e9e48155a6aa0671edd336ff1479a188" + integrity sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw== + dependencies: + sort-keys "^1.0.0" + +sort-keys@^1.0.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/sort-keys/-/sort-keys-1.1.2.tgz#441b6d4d346798f1b4e49e8920adfba0e543f9ad" + integrity sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg== + dependencies: + is-plain-obj "^1.0.0" + source-map-support@0.5.13: version "0.5.13" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" @@ -8036,6 +8672,11 @@ source-map@^0.6.0: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +source-map@^0.7.3: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + spawndamnit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/spawndamnit/-/spawndamnit-2.0.0.tgz#9f762ac5c3476abb994b42ad592b5ad22bb4b0ad" @@ -8101,6 +8742,16 @@ streamsearch@^1.1.0: resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== +streamx@^2.15.0: + version "2.22.1" + resolved "https://registry.yarnpkg.com/streamx/-/streamx-2.22.1.tgz#c97cbb0ce18da4f4db5a971dc9ab68ff5dc7f5a5" + integrity sha512-znKXEBxfatz2GBNK02kRnCXjV+AA4kjZIUxeWSr3UGirZMJfTE9uiwKHobnbgxWyL/JWro8tTq+vOqAK1/qbSA== + dependencies: + fast-fifo "^1.3.2" + text-decoder "^1.1.0" + optionalDependencies: + bare-events "^2.2.0" + string-env-interpolation@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" @@ -8207,11 +8858,24 @@ strip-bom@^4.0.0: resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== +strip-dirs@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-dirs/-/strip-dirs-3.0.0.tgz#7c9a5d7822ce079a9db40387a4b20d5654746f42" + integrity sha512-I0sdgcFTfKQlUPZyAqPJmSG3HLO9rWDFnxonnIbskYNM3DwFOeTNB5KzVq3dA1GdRAc/25b5Y7UO2TQfKWw4aQ== + dependencies: + inspect-with-kind "^1.0.5" + is-plain-obj "^1.1.0" + strip-final-newline@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== +strip-final-newline@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" + integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== + strip-indent@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-3.0.0.tgz#c32e1cee940b6b3432c771bc2c54bcce73cd3001" @@ -8224,6 +8888,22 @@ strip-json-comments@^3.1.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== +strtok3@^9.0.1: + version "9.1.1" + resolved "https://registry.yarnpkg.com/strtok3/-/strtok3-9.1.1.tgz#f8feb188b3fcdbf9b8819cc9211a824c3731df38" + integrity sha512-FhwotcEqjr241ZbjFzjlIYg6c5/L/s4yBGWSMvJ9UoExiSqL+FnFA/CaeZx17WGaZMS/4SOZp8wH18jSS4R4lw== + dependencies: + "@tokenizer/token" "^0.3.0" + peek-readable "^5.3.1" + +super-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/super-regex/-/super-regex-1.0.0.tgz#dd90d944a925a1083e7d8570919b21cb76e3d925" + integrity sha512-CY8u7DtbvucKuquCmOFEKhr9Besln7n9uN8eFbwcoGYWXOMW07u2o8njWaiXt11ylS3qoGF55pILjRmPlbodyg== + dependencies: + function-timeout "^1.0.1" + time-span "^5.1.0" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -8269,6 +8949,15 @@ synckit@^0.11.8: dependencies: "@pkgr/core" "^0.2.9" +tar-stream@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-3.1.7.tgz#24b3fb5eabada19fe7338ed6d26e5f7c482e792b" + integrity sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ== + dependencies: + b4a "^1.6.4" + fast-fifo "^1.2.0" + streamx "^2.15.0" + tar-stream@~2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-2.2.0.tgz#acad84c284136b060dc3faa64474aa9aebd77287" @@ -8302,11 +8991,25 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +text-decoder@^1.1.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/text-decoder/-/text-decoder-1.2.3.tgz#b19da364d981b2326d5f43099c310cc80d770c65" + integrity sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA== + dependencies: + b4a "^1.6.4" + through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== +time-span@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/time-span/-/time-span-5.1.0.tgz#80c76cf5a0ca28e0842d3f10a4e99034ce94b90d" + integrity sha512-75voc/9G4rDIJleOo4jPvN4/YC4GRZrY8yy1uU4lwrB3XEQbWve8zXoO5No4eFrGcTAMYyoY67p8jRQdtA1HbA== + dependencies: + convert-hrtime "^5.0.0" + tinyglobby@^0.2.12: version "0.2.14" resolved "https://registry.yarnpkg.com/tinyglobby/-/tinyglobby-0.2.14.tgz#5280b0cf3f972b050e74ae88406c0a6a58f4079d" @@ -8363,6 +9066,14 @@ to-regex-range@^5.0.1: dependencies: is-number "^7.0.0" +token-types@^6.0.0: + version "6.0.3" + resolved "https://registry.yarnpkg.com/token-types/-/token-types-6.0.3.tgz#684f4f40e0750078ec644c826207a2c160b827a8" + integrity sha512-IKJ6EzuPPWtKtEIEPpIdXv9j5j2LGJEYk0CKY2efgKoYKLBiZdh6iQkLVBow/CB3phyWAWCyk+bZeaimJn6uRQ== + dependencies: + "@tokenizer/token" "^0.3.0" + ieee754 "^1.2.1" + tough-cookie@^5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-5.1.2.tgz#66d774b4a1d9e12dc75089725af3ac75ec31bed7" @@ -8467,6 +9178,11 @@ tslib@^2.3.1, tslib@^2.6.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== +tslib@^2.8.0: + version "2.8.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" + integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== + tty-table@^4.1.5: version "4.2.3" resolved "https://registry.yarnpkg.com/tty-table/-/tty-table-4.2.3.tgz#e33eb4007a0a9c976c97c37fa13ba66329a5c515" @@ -8576,6 +9292,11 @@ ua-parser-js@^1.0.35: resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-1.0.37.tgz#b5dc7b163a5c1f0c510b08446aed4da92c46373f" integrity sha512-bhTyI94tZofjo+Dn8SN6Zv8nBDvyXTymAdM3LDI/0IboIUwTu1rEhW7v2TfiVsoYWgkQ4kOVqnI8APUFbIQIFQ== +uint8array-extras@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/uint8array-extras/-/uint8array-extras-1.4.0.tgz#e42a678a6dd335ec2d21661333ed42f44ae7cc74" + integrity sha512-ZPtzy0hu4cZjv3z5NW9gfKnNLjoz4y6uv4HlelAjDK7sY/xOkKZv9xK/WQpcsBB3jEybChz9DPC2U/+cusjJVQ== + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -8586,6 +9307,14 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +unbzip2-stream@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz#b0da04c4371311df771cdc215e87f2130991ace7" + integrity sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg== + dependencies: + buffer "^5.2.1" + through "^2.3.8" + unc-path-regex@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" @@ -9009,6 +9738,14 @@ yargs@^17.0.0, yargs@^17.6.2, yargs@^17.7.1, yargs@^17.7.2: y18n "^5.0.5" yargs-parser "^21.1.1" +yauzl@^3.1.2: + version "3.2.0" + resolved "https://registry.yarnpkg.com/yauzl/-/yauzl-3.2.0.tgz#7b6cb548f09a48a6177ea0be8ece48deb7da45c0" + integrity sha512-Ow9nuGZE+qp1u4JIPvg+uCiUr7xGQWdff7JQSk5VGYTAZMDe2q8lxJ10ygv10qmSj031Ty/6FNJpLO4o1Sgc+w== + dependencies: + buffer-crc32 "~0.2.3" + pend "~1.2.0" + yn@3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" From 509ce6da57ad1b1363f088f424a8d2c61afe8c16 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Tue, 22 Jul 2025 00:17:18 +1000 Subject: [PATCH 02/37] Set up basic preset structure --- .../operation-location-migration/package.json | 1 + .../operation-location-migration/src/index.ts | 2 +- .../gcg-operation-location-migration.spec.ts | 9 --------- .../lib/gcg-operation-location-migration.ts | 3 --- .../src/preset.ts | 20 +++++++++++++++++++ 5 files changed, 22 insertions(+), 13 deletions(-) delete mode 100644 packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts delete mode 100644 packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts create mode 100644 packages/operation-location-migration/src/preset.ts diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index a35ae955..eec8df06 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -6,6 +6,7 @@ "main": "./src/index.js", "types": "./src/index.d.ts", "dependencies": { + "@graphql-codegen/plugin-helpers": "5.1.0", "@swc/helpers": "~0.5.11" } } diff --git a/packages/operation-location-migration/src/index.ts b/packages/operation-location-migration/src/index.ts index 3b60c6b7..60cc2d4b 100644 --- a/packages/operation-location-migration/src/index.ts +++ b/packages/operation-location-migration/src/index.ts @@ -1 +1 @@ -export * from './lib/gcg-operation-location-migration'; +export { preset } from './preset'; diff --git a/packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts b/packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts deleted file mode 100644 index d39fc72f..00000000 --- a/packages/operation-location-migration/src/lib/gcg-operation-location-migration.spec.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { gcgOperationLocationMigration } from './gcg-operation-location-migration'; - -describe('gcgOperationLocationMigration', () => { - it('should work', () => { - expect(gcgOperationLocationMigration()).toEqual( - 'gcg-operation-location-migration' - ); - }); -}); diff --git a/packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts b/packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts deleted file mode 100644 index 72d64aa4..00000000 --- a/packages/operation-location-migration/src/lib/gcg-operation-location-migration.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function gcgOperationLocationMigration(): string { - return 'gcg-operation-location-migration'; -} diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts new file mode 100644 index 00000000..6eb6a07c --- /dev/null +++ b/packages/operation-location-migration/src/preset.ts @@ -0,0 +1,20 @@ +import { + type Types, + createNoopProfiler, +} from '@graphql-codegen/plugin-helpers'; + +export const preset: Types.OutputPreset = { + buildGeneratesSection: async ({ + schema, + schemaAst, + presetConfig, + baseOutputDir, + profiler = createNoopProfiler(), + }) => { + if (!schemaAst) { + throw new Error('Missing schemaAst'); + } + + return []; + }, +}; From 61d55eb40dabd92a4971711e2f363f3e91e69e2e Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Tue, 22 Jul 2025 00:26:30 +1000 Subject: [PATCH 03/37] Set up base e2e --- .../README.md | 3 +++ .../eslint.config.mjs | 3 +++ .../project.json | 13 ++++++++++++ .../src/index.ts | 1 + .../lib/operation-location-migration-e2e.ts | 3 +++ .../tsconfig.json | 20 +++++++++++++++++++ .../tsconfig.lib.json | 9 +++++++++ .../operation-location-migration/project.json | 5 ++++- 8 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 packages/operation-location-migration-e2e/README.md create mode 100644 packages/operation-location-migration-e2e/eslint.config.mjs create mode 100644 packages/operation-location-migration-e2e/project.json create mode 100644 packages/operation-location-migration-e2e/src/index.ts create mode 100644 packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts create mode 100644 packages/operation-location-migration-e2e/tsconfig.json create mode 100644 packages/operation-location-migration-e2e/tsconfig.lib.json diff --git a/packages/operation-location-migration-e2e/README.md b/packages/operation-location-migration-e2e/README.md new file mode 100644 index 00000000..528c0ced --- /dev/null +++ b/packages/operation-location-migration-e2e/README.md @@ -0,0 +1,3 @@ +# operation-location-migration-e2e + +This library was generated with [Nx](https://nx.dev). diff --git a/packages/operation-location-migration-e2e/eslint.config.mjs b/packages/operation-location-migration-e2e/eslint.config.mjs new file mode 100644 index 00000000..b7f62772 --- /dev/null +++ b/packages/operation-location-migration-e2e/eslint.config.mjs @@ -0,0 +1,3 @@ +import baseConfig from '../../eslint.config.mjs'; + +export default [...baseConfig]; diff --git a/packages/operation-location-migration-e2e/project.json b/packages/operation-location-migration-e2e/project.json new file mode 100644 index 00000000..acb7c96c --- /dev/null +++ b/packages/operation-location-migration-e2e/project.json @@ -0,0 +1,13 @@ +{ + "name": "operation-location-migration-e2e", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/operation-location-migration-e2e/src", + "projectType": "library", + "tags": [], + "implicitDependencies": ["operation-location-migration"], + "targets": { + "lint": { + "executor": "@nx/eslint:lint" + } + } +} diff --git a/packages/operation-location-migration-e2e/src/index.ts b/packages/operation-location-migration-e2e/src/index.ts new file mode 100644 index 00000000..a52fc0b5 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/index.ts @@ -0,0 +1 @@ +export * from './lib/operation-location-migration-e2e'; diff --git a/packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts b/packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts new file mode 100644 index 00000000..f0e273ce --- /dev/null +++ b/packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts @@ -0,0 +1,3 @@ +export function operationLocationMigrationE2e(): string { + return 'operation-location-migration-e2e'; +} diff --git a/packages/operation-location-migration-e2e/tsconfig.json b/packages/operation-location-migration-e2e/tsconfig.json new file mode 100644 index 00000000..e97cb764 --- /dev/null +++ b/packages/operation-location-migration-e2e/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "importHelpers": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noPropertyAccessFromIndexSignature": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/packages/operation-location-migration-e2e/tsconfig.lib.json b/packages/operation-location-migration-e2e/tsconfig.lib.json new file mode 100644 index 00000000..8675a0b4 --- /dev/null +++ b/packages/operation-location-migration-e2e/tsconfig.lib.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/operation-location-migration/project.json b/packages/operation-location-migration/project.json index 4683fbf2..56d8faf9 100644 --- a/packages/operation-location-migration/project.json +++ b/packages/operation-location-migration/project.json @@ -1,5 +1,5 @@ { - "name": "@eddeee888/gcg-operation-location-migration", + "name": "operation-location-migration", "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/operation-location-migration/src", "projectType": "library", @@ -21,6 +21,9 @@ "options": { "jestConfig": "packages/operation-location-migration/jest.config.ts" } + }, + "lint": { + "executor": "@nx/eslint:lint" } } } From 2958a27816e3a871f3fa8fd144064dba21f0bc1a Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Tue, 22 Jul 2025 00:56:24 +1000 Subject: [PATCH 04/37] Set up base e2e tests --- .../README.md | 4 ++- .../project.json | 25 +++++++++++++++++-- .../src/index.ts | 1 - .../lib/operation-location-migration-e2e.ts | 3 --- .../test-arbitrary-to-colocation/codegen.ts | 23 +++++++++++++++++ .../components/MeComponent.lazy-query.ts | 6 +++++ .../components/MeComponent.query.ts | 6 +++++ .../components/MeComponent.suspense-query.ts | 6 +++++ .../components/UserComponent.ts | 6 +++++ .../generated/hooks.generated.ts | 19 ++++++++++++++ .../operations/Me.graphql | 5 ++++ .../operations/User.graphql | 5 ++++ .../schema.graphqls | 8 ++++++ .../src/defineConfig.ts | 18 +++++++++++++ .../operation-location-migration/src/index.ts | 1 + .../src/preset.ts | 9 +++---- 16 files changed, 132 insertions(+), 13 deletions(-) delete mode 100644 packages/operation-location-migration-e2e/src/index.ts delete mode 100644 packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.lazy-query.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.query.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.suspense-query.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/User.graphql create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/schema.graphqls create mode 100644 packages/operation-location-migration/src/defineConfig.ts diff --git a/packages/operation-location-migration-e2e/README.md b/packages/operation-location-migration-e2e/README.md index 528c0ced..657b049c 100644 --- a/packages/operation-location-migration-e2e/README.md +++ b/packages/operation-location-migration-e2e/README.md @@ -1,3 +1,5 @@ # operation-location-migration-e2e -This library was generated with [Nx](https://nx.dev). +```bash +nx graphql-codegen operation-location-migration-e2e -c test-arbitrary-to-colocation +``` diff --git a/packages/operation-location-migration-e2e/project.json b/packages/operation-location-migration-e2e/project.json index acb7c96c..f19e4d53 100644 --- a/packages/operation-location-migration-e2e/project.json +++ b/packages/operation-location-migration-e2e/project.json @@ -3,11 +3,32 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/operation-location-migration-e2e/src", "projectType": "library", - "tags": [], "implicitDependencies": ["operation-location-migration"], "targets": { + "graphql-codegen": { + "executor": "@eddeee888/nx-graphql-code-generator:codegen", + "options": {}, + "configurations": { + "test-arbitrary-to-colocation": { + "configFile": "{projectRoot}/src/test-arbitrary-to-colocation/codegen.ts" + } + }, + "dependsOn": ["prepare-e2e-modules"] + }, + "prepare-e2e-modules": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "rimraf node_modules/@eddeee888/gcg-operation-location-migration", + "cp -r dist/packages/operation-location-migration node_modules/@eddeee888/gcg-operation-location-migration" + ], + "parallel": false + }, + "dependsOn": ["^build"] + }, "lint": { "executor": "@nx/eslint:lint" } - } + }, + "tags": [] } diff --git a/packages/operation-location-migration-e2e/src/index.ts b/packages/operation-location-migration-e2e/src/index.ts deleted file mode 100644 index a52fc0b5..00000000 --- a/packages/operation-location-migration-e2e/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './lib/operation-location-migration-e2e'; diff --git a/packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts b/packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts deleted file mode 100644 index f0e273ce..00000000 --- a/packages/operation-location-migration-e2e/src/lib/operation-location-migration-e2e.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function operationLocationMigrationE2e(): string { - return 'operation-location-migration-e2e'; -} diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts new file mode 100644 index 00000000..36a1863c --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts @@ -0,0 +1,23 @@ +import type { CodegenConfig } from '@graphql-codegen/cli'; +import { defineConfig } from '@eddeee888/gcg-operation-location-migration'; + +const config: CodegenConfig = { + schema: [ + 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/**/*.graphqls', + ], + hooks: { + afterAllFileWrite: ['prettier --write'], + }, + generates: { + 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation': + defineConfig( + {}, + { + documents: + 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/*.graphql', + } + ), + }, +}; + +export default config; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.lazy-query.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.lazy-query.ts new file mode 100644 index 00000000..c0ad4295 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.lazy-query.ts @@ -0,0 +1,6 @@ +import { useMeLazyQuery } from '../generated/hooks.generated'; + +export const MeComponent = () => { + useMeLazyQuery(); + return 'Me'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.query.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.query.ts new file mode 100644 index 00000000..c30e3596 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.query.ts @@ -0,0 +1,6 @@ +import { useMeQuery } from '../generated/hooks.generated'; + +export const MeComponent = () => { + useMeQuery(); + return 'Me'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.suspense-query.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.suspense-query.ts new file mode 100644 index 00000000..e242ef6d --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.suspense-query.ts @@ -0,0 +1,6 @@ +import { useMeSuspenseQuery } from '../generated/hooks.generated'; + +export const MeComponent = () => { + useMeSuspenseQuery(); + return 'Me'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts new file mode 100644 index 00000000..7e7cd150 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts @@ -0,0 +1,6 @@ +import { useMeQuery } from '../generated/hooks.generated'; + +export const UserComponent = () => { + useMeQuery(); + return 'User'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts new file mode 100644 index 00000000..0d7b7b6c --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts @@ -0,0 +1,19 @@ +export function useMeQuery() { + return null; +} +export function useMeLazyQuery() { + return null; +} +export function useMeSuspenseQuery() { + return null; +} + +export function useUserQuery() { + return null; +} +export function useUserLazyQuery() { + return null; +} +export function useUserSuspenseQuery() { + return null; +} diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql new file mode 100644 index 00000000..e39a9f82 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql @@ -0,0 +1,5 @@ +query Me { + me { + __typename + } +} diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/User.graphql b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/User.graphql new file mode 100644 index 00000000..dda30949 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/User.graphql @@ -0,0 +1,5 @@ +query User($id: ID!) { + user(id: $id) { + __typename + } +} diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/schema.graphqls b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/schema.graphqls new file mode 100644 index 00000000..a9075c97 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/schema.graphqls @@ -0,0 +1,8 @@ +type Query { + me: User + user(id: ID): User +} + +type User { + id: ID! +} diff --git a/packages/operation-location-migration/src/defineConfig.ts b/packages/operation-location-migration/src/defineConfig.ts new file mode 100644 index 00000000..4b89a1a4 --- /dev/null +++ b/packages/operation-location-migration/src/defineConfig.ts @@ -0,0 +1,18 @@ +import type { Types } from '@graphql-codegen/plugin-helpers'; +import { preset } from './preset'; + +export const defineConfig = ( + presetConfig: Record, + context: { + schema?: Types.ConfiguredOutput['schema']; + documents?: Types.ConfiguredOutput['documents']; + } = {} +): Pick => { + const { schema, documents } = context; + + return { + schema, + documents, + preset, + }; +}; diff --git a/packages/operation-location-migration/src/index.ts b/packages/operation-location-migration/src/index.ts index 60cc2d4b..c20a9c8a 100644 --- a/packages/operation-location-migration/src/index.ts +++ b/packages/operation-location-migration/src/index.ts @@ -1 +1,2 @@ +export { defineConfig } from './defineConfig'; export { preset } from './preset'; diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 6eb6a07c..db37b295 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -5,15 +5,12 @@ import { export const preset: Types.OutputPreset = { buildGeneratesSection: async ({ - schema, - schemaAst, - presetConfig, baseOutputDir, + documents, + presetConfig, profiler = createNoopProfiler(), }) => { - if (!schemaAst) { - throw new Error('Missing schemaAst'); - } + console.log({ documents }); return []; }, From 35ee06c6bb4a83b52d41d42a1a795aa8ca8a9ca1 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Tue, 22 Jul 2025 01:25:26 +1000 Subject: [PATCH 05/37] WIP --- .../test-arbitrary-to-colocation/codegen.ts | 5 ++- .../test-arbitrary-to-colocation/gql/index.ts | 1 + .../operations/Me.graphql.ts | 8 ++++ .../operation-location-migration/package.json | 1 + .../src/config.ts | 4 ++ .../src/defineConfig.ts | 9 +++- .../src/preset.ts | 42 +++++++++++++++++-- 7 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/gql/index.ts create mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts create mode 100644 packages/operation-location-migration/src/config.ts diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts index 36a1863c..d996ab1e 100644 --- a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts @@ -11,7 +11,10 @@ const config: CodegenConfig = { generates: { 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation': defineConfig( - {}, + { + artifactDirectory: './gql', + gqlTagName: 'graphql', + }, { documents: 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/*.graphql', diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/gql/index.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/gql/index.ts new file mode 100644 index 00000000..10db86f0 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/gql/index.ts @@ -0,0 +1 @@ +export const graphql = (doc: string) => doc; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts new file mode 100644 index 00000000..5e754f29 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts @@ -0,0 +1,8 @@ +import { graphql } from '../gql'; +export const SOMETHINGDoc = graphql(` + query Me { + me { + __typename + } + } +`); diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index eec8df06..5a757b23 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -6,6 +6,7 @@ "main": "./src/index.js", "types": "./src/index.d.ts", "dependencies": { + "@graphql-codegen/add": "5.0.3", "@graphql-codegen/plugin-helpers": "5.1.0", "@swc/helpers": "~0.5.11" } diff --git a/packages/operation-location-migration/src/config.ts b/packages/operation-location-migration/src/config.ts new file mode 100644 index 00000000..7c4995e8 --- /dev/null +++ b/packages/operation-location-migration/src/config.ts @@ -0,0 +1,4 @@ +export interface TypedPresetConfig { + artifactDirectory: string; + gqlTagName: string; +} diff --git a/packages/operation-location-migration/src/defineConfig.ts b/packages/operation-location-migration/src/defineConfig.ts index 4b89a1a4..06f9d4b1 100644 --- a/packages/operation-location-migration/src/defineConfig.ts +++ b/packages/operation-location-migration/src/defineConfig.ts @@ -1,18 +1,23 @@ import type { Types } from '@graphql-codegen/plugin-helpers'; +import type { TypedPresetConfig } from './config'; import { preset } from './preset'; export const defineConfig = ( - presetConfig: Record, + presetConfig: TypedPresetConfig, context: { schema?: Types.ConfiguredOutput['schema']; documents?: Types.ConfiguredOutput['documents']; } = {} -): Pick => { +): Pick< + Types.ConfiguredOutput, + 'schema' | 'documents' | 'preset' | 'presetConfig' +> => { const { schema, documents } = context; return { schema, documents, preset, + presetConfig, }; }; diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index db37b295..1d28e5d3 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -1,17 +1,53 @@ +import * as path from 'path'; +import * as addPlugin from '@graphql-codegen/add'; import { type Types, createNoopProfiler, } from '@graphql-codegen/plugin-helpers'; +import type { TypedPresetConfig } from './config'; -export const preset: Types.OutputPreset = { +export const preset: Types.OutputPreset = { buildGeneratesSection: async ({ baseOutputDir, + schema, documents, presetConfig, profiler = createNoopProfiler(), }) => { - console.log({ documents }); + console.log(documents[0]); - return []; + const document = documents[0]; + + const documentPath = path.parse(document.location || ''); + const documentSDL = document.rawSDL || ''; + const gqlTagPath = path.posix.join( + baseOutputDir, + presetConfig.artifactDirectory + ); // FIXME: handle absolute path + + const newFilename = path.join( + documentPath.dir, + `${documentPath.name}.graphql.ts` + ); + const gqlTagImportPath = path.posix.relative(documentPath.dir, gqlTagPath); + + console.log({ documentPath, documentSDL, newFilename, gqlTagPath }); + + return [ + { + filename: newFilename, + pluginMap: { add: addPlugin }, + plugins: [ + { + add: { + content: `import { ${presetConfig.gqlTagName} } from '${gqlTagImportPath}'; export const FIXMEDoc = graphql(\`${documentSDL}\`);\n`, + }, + }, + ], + config: {}, + schema, + documents: [], + }, + ]; }, }; From 62ebe071acd59f768982db573916723c632becb7 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 00:57:23 +1000 Subject: [PATCH 06/37] Rename e2e test --- package.json | 1 + .../project.json | 4 +- .../test-arbitrary-to-colocation/codegen.ts | 26 --- .../components/UserComponent.ts | 6 - .../generated/hooks.generated.ts | 19 -- .../operations/Me.graphql.ts | 8 - .../src/test-index-to-colocation/codegen.mts | 39 ++++ .../components/MeComponent.lazy-query.ts | 0 .../components/MeComponent.query.ts | 0 .../components/MeComponent.suspense-query.ts | 0 .../components/UserComponent.ts | 6 + .../generated/hooks.generated.ts | 176 ++++++++++++++++++ .../gql/index.ts | 0 .../operations/Me.graphql | 0 .../operations/User.graphql | 0 .../schema.graphqls | 0 .../test-index-to-colocation/tsconfig.json | 9 + yarn.lock | 77 +++++++- 18 files changed, 308 insertions(+), 63 deletions(-) delete mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts delete mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts delete mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts delete mode 100644 packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/components/MeComponent.lazy-query.ts (100%) rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/components/MeComponent.query.ts (100%) rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/components/MeComponent.suspense-query.ts (100%) create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/gql/index.ts (100%) rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/operations/Me.graphql (100%) rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/operations/User.graphql (100%) rename packages/operation-location-migration-e2e/src/{test-arbitrary-to-colocation => test-index-to-colocation}/schema.graphqls (100%) create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json diff --git a/package.json b/package.json index d37c579e..54380ac6 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@graphql-codegen/plugin-helpers": "5.1.0", "@graphql-codegen/schema-ast": "4.1.0", "@graphql-codegen/typescript": "4.1.3", + "@graphql-codegen/typescript-react-apollo": "4.3.3", "@graphql-codegen/typescript-resolvers": "4.4.2", "@graphql-tools/merge": "9.0.4", "@nx/devkit": "21.3.1", diff --git a/packages/operation-location-migration-e2e/project.json b/packages/operation-location-migration-e2e/project.json index f19e4d53..5da52d68 100644 --- a/packages/operation-location-migration-e2e/project.json +++ b/packages/operation-location-migration-e2e/project.json @@ -9,8 +9,8 @@ "executor": "@eddeee888/nx-graphql-code-generator:codegen", "options": {}, "configurations": { - "test-arbitrary-to-colocation": { - "configFile": "{projectRoot}/src/test-arbitrary-to-colocation/codegen.ts" + "test-index-to-colocation": { + "configFile": "{projectRoot}/src/test-index-to-colocation/codegen.mts" } }, "dependsOn": ["prepare-e2e-modules"] diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts deleted file mode 100644 index d996ab1e..00000000 --- a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/codegen.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { CodegenConfig } from '@graphql-codegen/cli'; -import { defineConfig } from '@eddeee888/gcg-operation-location-migration'; - -const config: CodegenConfig = { - schema: [ - 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/**/*.graphqls', - ], - hooks: { - afterAllFileWrite: ['prettier --write'], - }, - generates: { - 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation': - defineConfig( - { - artifactDirectory: './gql', - gqlTagName: 'graphql', - }, - { - documents: - 'packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/*.graphql', - } - ), - }, -}; - -export default config; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts deleted file mode 100644 index 7e7cd150..00000000 --- a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/UserComponent.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { useMeQuery } from '../generated/hooks.generated'; - -export const UserComponent = () => { - useMeQuery(); - return 'User'; -}; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts deleted file mode 100644 index 0d7b7b6c..00000000 --- a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/generated/hooks.generated.ts +++ /dev/null @@ -1,19 +0,0 @@ -export function useMeQuery() { - return null; -} -export function useMeLazyQuery() { - return null; -} -export function useMeSuspenseQuery() { - return null; -} - -export function useUserQuery() { - return null; -} -export function useUserLazyQuery() { - return null; -} -export function useUserSuspenseQuery() { - return null; -} diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts b/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts deleted file mode 100644 index 5e754f29..00000000 --- a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { graphql } from '../gql'; -export const SOMETHINGDoc = graphql(` - query Me { - me { - __typename - } - } -`); diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts new file mode 100644 index 00000000..50a41a7f --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts @@ -0,0 +1,39 @@ +import type { CodegenConfig } from '@graphql-codegen/cli'; +import { defineConfig } from '@eddeee888/gcg-operation-location-migration'; + +const config: CodegenConfig = { + schema: [ + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/**/*.graphqls', + ], + hooks: { + afterAllFileWrite: ['prettier --write'], + }, + generates: { + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts': + { + documents: [ + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/*.graphql', + ], + plugins: [ + 'typescript', + 'typescript-operations', + 'typescript-react-apollo', + ], + }, + 'packages/operation-location-migration-e2e/src/test-index-to-colocation': + defineConfig( + { + artifactDirectory: './gql', + gqlTagName: 'graphql', + tsConfigFilePath: + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json', + }, + { + documents: + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/*.graphql', + } + ), + }, +}; + +export default config; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.lazy-query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.lazy-query.ts rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.query.ts rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.suspense-query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/components/MeComponent.suspense-query.ts rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts new file mode 100644 index 00000000..f68820c4 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts @@ -0,0 +1,6 @@ +import { useMeQuery, useMeLazyQuery } from '../generated/hooks.generated'; + +export const UserComponent = () => { + useMeQuery(); + return 'User'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts new file mode 100644 index 00000000..898e79b9 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts @@ -0,0 +1,176 @@ +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe; +}; +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe; +}; +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T +> = { [_ in K]?: never }; +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never; + }; +const defaultOptions = {} as const; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; +}; + +export type Query = { + __typename?: 'Query'; + me?: Maybe; + user?: Maybe; +}; + +export type QueryUserArgs = { + id?: InputMaybe; +}; + +export type User = { + __typename?: 'User'; + id: Scalars['ID']['output']; +}; + +export type MeQueryVariables = Exact<{ [key: string]: never }>; + +export type MeQuery = { + __typename?: 'Query'; + me?: { __typename: 'User' } | null; +}; + +export type UserQueryVariables = Exact<{ + id: Scalars['ID']['input']; +}>; + +export type UserQuery = { + __typename?: 'Query'; + user?: { __typename: 'User' } | null; +}; + +export const MeDocument = gql` + query Me { + me { + __typename + } + } +`; + +/** + * __useMeQuery__ + * + * To run a query within a React component, call `useMeQuery` and pass it any options that fit your needs. + * When your component renders, `useMeQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMeQuery({ + * variables: { + * }, + * }); + */ +export function useMeQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery(MeDocument, options); +} +export function useMeLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery(MeDocument, options); +} +export function useMeSuspenseQuery( + baseOptions?: + | Apollo.SkipToken + | Apollo.SuspenseQueryHookOptions +) { + const options = + baseOptions === Apollo.skipToken + ? baseOptions + : { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery( + MeDocument, + options + ); +} +export type MeQueryHookResult = ReturnType; +export type MeLazyQueryHookResult = ReturnType; +export type MeSuspenseQueryHookResult = ReturnType; +export type MeQueryResult = Apollo.QueryResult; +export const UserDocument = gql` + query User($id: ID!) { + user(id: $id) { + __typename + } + } +`; + +/** + * __useUserQuery__ + * + * To run a query within a React component, call `useUserQuery` and pass it any options that fit your needs. + * When your component renders, `useUserQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useUserQuery({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useUserQuery( + baseOptions: Apollo.QueryHookOptions & + ({ variables: UserQueryVariables; skip?: boolean } | { skip: boolean }) +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery(UserDocument, options); +} +export function useUserLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + UserDocument, + options + ); +} +export function useUserSuspenseQuery( + baseOptions?: + | Apollo.SkipToken + | Apollo.SuspenseQueryHookOptions +) { + const options = + baseOptions === Apollo.skipToken + ? baseOptions + : { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery( + UserDocument, + options + ); +} +export type UserQueryHookResult = ReturnType; +export type UserLazyQueryHookResult = ReturnType; +export type UserSuspenseQueryHookResult = ReturnType< + typeof useUserSuspenseQuery +>; +export type UserQueryResult = Apollo.QueryResult; diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/gql/index.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/gql/index.ts similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/gql/index.ts rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/gql/index.ts diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql b/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/Me.graphql similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/Me.graphql rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/Me.graphql diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/User.graphql b/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/User.graphql similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/operations/User.graphql rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/User.graphql diff --git a/packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/schema.graphqls b/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls similarity index 100% rename from packages/operation-location-migration-e2e/src/test-arbitrary-to-colocation/schema.graphqls rename to packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json b/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json new file mode 100644 index 00000000..2b229a8e --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "rootDir": ".", + "baseUrl": ".", + "module": "commonjs", + "strict": true + }, + "include": ["./**/*.ts"] +} diff --git a/yarn.lock b/yarn.lock index 60d6abce..031aaf59 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1962,6 +1962,18 @@ lodash "~4.17.0" tslib "~2.6.0" +"@graphql-codegen/plugin-helpers@^3.0.0", "@graphql-codegen/plugin-helpers@^3.1.2": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-3.1.2.tgz#69a2e91178f478ea6849846ade0a59a844d34389" + integrity sha512-emOQiHyIliVOIjKVKdsI5MXj312zmRDwmHpyUTZMjfpvxq/UVAHUJIVdVf+lnjjrI+LXBTgMlTWTgHQfmICxjg== + dependencies: + "@graphql-tools/utils" "^9.0.0" + change-case-all "1.0.15" + common-tags "1.8.2" + import-from "4.0.0" + lodash "~4.17.0" + tslib "~2.4.0" + "@graphql-codegen/plugin-helpers@^5.0.3": version "5.0.3" resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.0.3.tgz#7027b9d911d7cb594663590fcf5d63e9cf7ec2ff" @@ -2014,6 +2026,17 @@ auto-bind "~4.0.0" tslib "~2.6.0" +"@graphql-codegen/typescript-react-apollo@4.3.3": + version "4.3.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-react-apollo/-/typescript-react-apollo-4.3.3.tgz#1780199b685c6b59046d67513b42f6848e570766" + integrity sha512-ecuzzqoZEHCtlxaEXL1LQTrfzVYwNNtbVUBHc/KQDfkJIQZon+dG5ZXOoJ4BpbRA2L99yTx+TZc2VkpOVfSypw== + dependencies: + "@graphql-codegen/plugin-helpers" "^3.0.0" + "@graphql-codegen/visitor-plugin-common" "2.13.8" + auto-bind "~4.0.0" + change-case-all "1.0.15" + tslib "^2.8.1" + "@graphql-codegen/typescript-resolvers@4.4.2", "@graphql-codegen/typescript-resolvers@^4.4.2": version "4.4.2" resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-resolvers/-/typescript-resolvers-4.4.2.tgz#b0886e33d0d6d2354d3a2b92af44f4bf228ead40" @@ -2037,6 +2060,22 @@ auto-bind "~4.0.0" tslib "~2.6.0" +"@graphql-codegen/visitor-plugin-common@2.13.8": + version "2.13.8" + resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-2.13.8.tgz#09bc6317b227e5a278f394f4cef0d6c2d1910597" + integrity sha512-IQWu99YV4wt8hGxIbBQPtqRuaWZhkQRG2IZKbMoSvh0vGeWb3dB0n0hSgKaOOxDY+tljtOf9MTcUYvJslQucMQ== + dependencies: + "@graphql-codegen/plugin-helpers" "^3.1.2" + "@graphql-tools/optimize" "^1.3.0" + "@graphql-tools/relay-operation-optimizer" "^6.5.0" + "@graphql-tools/utils" "^9.0.0" + auto-bind "~4.0.0" + change-case-all "1.0.15" + dependency-graph "^0.11.0" + graphql-tag "^2.11.0" + parse-filepath "^1.0.2" + tslib "~2.4.0" + "@graphql-codegen/visitor-plugin-common@5.6.1", "@graphql-codegen/visitor-plugin-common@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-5.6.1.tgz#492ed514530e43a38d875cdbc8b312a565ac8ce0" @@ -2245,6 +2284,13 @@ "@graphql-tools/utils" "^10.0.13" tslib "^2.4.0" +"@graphql-tools/optimize@^1.3.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/optimize/-/optimize-1.4.0.tgz#20d6a9efa185ef8fc4af4fd409963e0907c6e112" + integrity sha512-dJs/2XvZp+wgHH8T5J2TqptT9/6uVzIYvA6uFACha+ufvdMBedkfR4b4GbT8jAKLRARiqRTxy3dctnwkTM2tdw== + dependencies: + tslib "^2.4.0" + "@graphql-tools/optimize@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@graphql-tools/optimize/-/optimize-2.0.0.tgz#7a9779d180824511248a50c5a241eff6e7a2d906" @@ -2274,6 +2320,15 @@ tslib "^2.4.0" yaml-ast-parser "^0.0.43" +"@graphql-tools/relay-operation-optimizer@^6.5.0": + version "6.5.18" + resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-6.5.18.tgz#a1b74a8e0a5d0c795b8a4d19629b654cf66aa5ab" + integrity sha512-mc5VPyTeV+LwiM+DNvoDQfPqwQYhPV/cl5jOBjTgSniyaq8/86aODfMkrE2OduhQ5E00hqrkuL2Fdrgk0w1QJg== + dependencies: + "@ardatan/relay-compiler" "12.0.0" + "@graphql-tools/utils" "^9.2.1" + tslib "^2.4.0" + "@graphql-tools/relay-operation-optimizer@^7.0.0": version "7.0.1" resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-7.0.1.tgz#8ac33e1d2626b6816d9283769c4a05c062b8065a" @@ -2332,6 +2387,14 @@ dset "^3.1.2" tslib "^2.4.0" +"@graphql-tools/utils@^9.0.0", "@graphql-tools/utils@^9.2.1": + version "9.2.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-9.2.1.tgz#1b3df0ef166cfa3eae706e3518b17d5922721c57" + integrity sha512-WUw506Ql6xzmOORlriNrD6Ugx+HjVgYxt9KCXD9mHAak+eaXSwuGGPyE60hy9xaDEoXKBsG7SkG69ybitaVl6A== + dependencies: + "@graphql-typed-document-node/core" "^3.1.1" + tslib "^2.4.0" + "@graphql-tools/wrap@^10.0.2": version "10.0.5" resolved "https://registry.yarnpkg.com/@graphql-tools/wrap/-/wrap-10.0.5.tgz#614b964a158887b4a644f5425b2b9a57b5751f72" @@ -4560,7 +4623,7 @@ chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -change-case-all@1.0.15: +change-case-all@1.0.15, change-case-all@^1.0.0: version "1.0.15" resolved "https://registry.yarnpkg.com/change-case-all/-/change-case-all-1.0.15.tgz#de29393167fc101d646cd76b0ef23e27d09756ad" integrity sha512-3+GIFhk3sNuvFAJKU46o26OdzudQlPNBCu1ZQi3cMeMHhty1bhDxu2WrEilVNYaGvqUtR1VSigFcJOiS13dRhQ== @@ -6032,6 +6095,11 @@ graphql@16.10.0: resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.10.0.tgz#24c01ae0af6b11ea87bf55694429198aaa8e220c" integrity sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ== +graphql@^16.0.0: + version "16.11.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.11.0.tgz#96d17f66370678027fdf59b2d4c20b4efaa8a633" + integrity sha512-mS1lbMsxgQj6hge1XZ6p7GPhbrtFwUFYi3wRzXAC/FmYnyXMTvvI3td3rjmQ2u8ewXueaSvRPWaEcgVVOT9Jnw== + hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" @@ -9178,11 +9246,16 @@ tslib@^2.3.1, tslib@^2.6.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== -tslib@^2.8.0: +tslib@^2.8.0, tslib@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f" integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w== +tslib@~2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" + integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== + tty-table@^4.1.5: version "4.2.3" resolved "https://registry.yarnpkg.com/tty-table/-/tty-table-4.2.3.tgz#e33eb4007a0a9c976c97c37fa13ba66329a5c515" From 9b3133e7be614b18a4972ed2cc74d4e5f9e70dae Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 00:58:02 +1000 Subject: [PATCH 07/37] WIP replace --- .../operation-location-migration/package.json | 5 +- .../src/config.ts | 1 + .../src/preset.ts | 179 +++++++++++++++--- 3 files changed, 155 insertions(+), 30 deletions(-) diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index 5a757b23..ec3410f7 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -8,6 +8,9 @@ "dependencies": { "@graphql-codegen/add": "5.0.3", "@graphql-codegen/plugin-helpers": "5.1.0", - "@swc/helpers": "~0.5.11" + "@swc/helpers": "~0.5.11", + "change-case-all": "^1.0.0", + "graphql": "^16.0.0", + "ts-morph": "^22.0.0" } } diff --git a/packages/operation-location-migration/src/config.ts b/packages/operation-location-migration/src/config.ts index 7c4995e8..4cde1706 100644 --- a/packages/operation-location-migration/src/config.ts +++ b/packages/operation-location-migration/src/config.ts @@ -1,4 +1,5 @@ export interface TypedPresetConfig { artifactDirectory: string; gqlTagName: string; + tsConfigFilePath: string; } diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 1d28e5d3..f20b299c 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -1,9 +1,13 @@ import * as path from 'path'; +import * as fs from 'fs'; import * as addPlugin from '@graphql-codegen/add'; import { type Types, createNoopProfiler, } from '@graphql-codegen/plugin-helpers'; +import { pascalCase } from 'change-case-all'; +import { OperationTypeNode, visit } from 'graphql'; +import { CallExpression, ImportSpecifier, Project, SyntaxKind } from 'ts-morph'; import type { TypedPresetConfig } from './config'; export const preset: Types.OutputPreset = { @@ -14,40 +18,157 @@ export const preset: Types.OutputPreset = { presetConfig, profiler = createNoopProfiler(), }) => { - console.log(documents[0]); + // lo + const absoluteTsConfigFilePath = path.join( + cwd(), + presetConfig.tsConfigFilePath + ); + if (!fs.existsSync(absoluteTsConfigFilePath)) { + throw new Error('Requires tsconfig'); + } + const tsProject = new Project({ + tsConfigFilePath: absoluteTsConfigFilePath, + }); + const tsSourceFiles = tsProject.getSourceFiles(); - const document = documents[0]; + const hooksToReplace: Record< + string, + { name: string; importFrom: path.ParsedPath } + > = {}; - const documentPath = path.parse(document.location || ''); - const documentSDL = document.rawSDL || ''; - const gqlTagPath = path.posix.join( - baseOutputDir, - presetConfig.artifactDirectory - ); // FIXME: handle absolute path + documents.forEach((documentFile) => { + const documentPath = path.parse(documentFile.location || ''); + const documentSDL = documentFile.rawSDL || ''; - const newFilename = path.join( - documentPath.dir, - `${documentPath.name}.graphql.ts` - ); - const gqlTagImportPath = path.posix.relative(documentPath.dir, gqlTagPath); + if (!documentFile.document) { + throw new Error('Document does not exist!'); // FIXME: should not throw + } + + visit(documentFile.document, { + OperationDefinition(node) { + if (!node.name) { + throw new Error('Anonimous operation!'); // FIXME: should not throw + } + + if (node.operation === OperationTypeNode.QUERY) { + const queryHookName = `use${pascalCase(node.name.value)}Query`; + hooksToReplace[queryHookName] = { + name: queryHookName, + importFrom: documentPath, + }; + + const lazyHookName = `use${pascalCase(node.name.value)}LazyQuery`; + hooksToReplace[lazyHookName] = { + name: lazyHookName, + importFrom: documentPath, + }; + + const suspenseHookName = `use${pascalCase( + node.name.value + )}SuspenseQuery`; + hooksToReplace[suspenseHookName] = { + name: suspenseHookName, + importFrom: documentPath, + }; + } else { + const hookName = `use${pascalCase(node.name.value)}${pascalCase( + node.operation + )}`; + hooksToReplace[hookName] = { + name: hookName, + importFrom: documentPath, + }; + } + }, + }); + + const gqlTagPath = path.posix.join( + baseOutputDir, + presetConfig.artifactDirectory + ); // FIXME: handle absolute path - console.log({ documentPath, documentSDL, newFilename, gqlTagPath }); + const newFilename = path.join( + documentPath.dir, + `${documentPath.name}.graphql.ts` + ); + const gqlTagImportPath = path.posix.relative( + documentPath.dir, + gqlTagPath + ); + }); - return [ - { - filename: newFilename, - pluginMap: { add: addPlugin }, - plugins: [ + tsSourceFiles.forEach((tsSourceFile) => { + console.log( + '***filepath: ', + path.basename(tsSourceFile.getFilePath()), + 'START:' + ); + // find imports + const fileMetadata: { + hasNodeToReplace: boolean; + functionsToReplace: Record< + string, { - add: { - content: `import { ${presetConfig.gqlTagName} } from '${gqlTagImportPath}'; export const FIXMEDoc = graphql(\`${documentSDL}\`);\n`, - }, - }, - ], - config: {}, - schema, - documents: [], - }, - ]; + importSpecifierNode: ImportSpecifier; + callExpression: CallExpression | null; + } + >; + } = { + hasNodeToReplace: false, + functionsToReplace: {}, + }; + + tsSourceFile + .getDescendantsOfKind(SyntaxKind.ImportDeclaration) + .forEach((node) => { + node + .getDescendantsOfKind(SyntaxKind.ImportSpecifier) + .forEach((importSpecifier) => { + if (hooksToReplace[importSpecifier.getName()]) { + // FIXME: we are assuming same name means must replace. Should check import path as well? + fileMetadata.functionsToReplace[importSpecifier.getName()] = { + importSpecifierNode: importSpecifier, + callExpression: null, + }; + } + }); + }); + + // find call expressions + tsSourceFile + .getDescendantsOfKind(SyntaxKind.CallExpression) + .forEach((callExpression) => { + const calledFunctionName = callExpression + .getFirstDescendantByKindOrThrow(SyntaxKind.Identifier) + .getText(); + if ( + hooksToReplace[calledFunctionName] && + fileMetadata.functionsToReplace[calledFunctionName] + ) { + fileMetadata.hasNodeToReplace = true; + fileMetadata.functionsToReplace[calledFunctionName].callExpression = + callExpression; + } + }); + + if (!fileMetadata.hasNodeToReplace) { + return; + } + + console.log( + '***filepath: ', + path.basename(tsSourceFile.getFilePath()), + 'END\n' + ); + }); + + return []; }, }; + +/** + * It is process.cwd() but normalised for all OS + */ +const cwd = (): string => { + return process.cwd().split(path.sep).join(path.posix.sep); +}; From 2491b1e1f4bb18c1a3035ecbe3044adadc74ef79 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 02:03:57 +1000 Subject: [PATCH 08/37] POC --- .../src/preset.ts | 153 ++++++++++++++---- 1 file changed, 120 insertions(+), 33 deletions(-) diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index f20b299c..6b04dbe9 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -7,7 +7,13 @@ import { } from '@graphql-codegen/plugin-helpers'; import { pascalCase } from 'change-case-all'; import { OperationTypeNode, visit } from 'graphql'; -import { CallExpression, ImportSpecifier, Project, SyntaxKind } from 'ts-morph'; +import { + CallExpression, + ImportDeclaration, + ImportSpecifier, + Project, + SyntaxKind, +} from 'ts-morph'; import type { TypedPresetConfig } from './config'; export const preset: Types.OutputPreset = { @@ -18,7 +24,6 @@ export const preset: Types.OutputPreset = { presetConfig, profiler = createNoopProfiler(), }) => { - // lo const absoluteTsConfigFilePath = path.join( cwd(), presetConfig.tsConfigFilePath @@ -26,6 +31,11 @@ export const preset: Types.OutputPreset = { if (!fs.existsSync(absoluteTsConfigFilePath)) { throw new Error('Requires tsconfig'); } + const gqlTagPath = path.posix.join( + baseOutputDir, + presetConfig.artifactDirectory + ); // FIXME: handle absolute path + const tsProject = new Project({ tsConfigFilePath: absoluteTsConfigFilePath, }); @@ -33,7 +43,18 @@ export const preset: Types.OutputPreset = { const hooksToReplace: Record< string, - { name: string; importFrom: path.ParsedPath } + { + hookName: string; + hookType: + | 'useQuery' + | 'useLazyQuery' + | 'useSuspenseQuery' + | 'useMutation' + | 'useSubscription'; + importFrom: path.ParsedPath; + operationName: string; + documentSDL: string; + } > = {}; documents.forEach((documentFile) => { @@ -47,74 +68,77 @@ export const preset: Types.OutputPreset = { visit(documentFile.document, { OperationDefinition(node) { if (!node.name) { - throw new Error('Anonimous operation!'); // FIXME: should not throw + throw new Error('Anonymous operation!'); // FIXME: should not throw } + const operationName = pascalCase(node.name.value); + if (node.operation === OperationTypeNode.QUERY) { - const queryHookName = `use${pascalCase(node.name.value)}Query`; + // Query + const queryHookName = `use${operationName}Query`; hooksToReplace[queryHookName] = { - name: queryHookName, + hookName: queryHookName, + hookType: 'useQuery', importFrom: documentPath, + operationName, + documentSDL, }; const lazyHookName = `use${pascalCase(node.name.value)}LazyQuery`; hooksToReplace[lazyHookName] = { - name: lazyHookName, + hookName: lazyHookName, + hookType: 'useLazyQuery', importFrom: documentPath, + operationName, + documentSDL, }; const suspenseHookName = `use${pascalCase( node.name.value )}SuspenseQuery`; hooksToReplace[suspenseHookName] = { - name: suspenseHookName, + hookName: suspenseHookName, + hookType: 'useSuspenseQuery', importFrom: documentPath, + operationName, + documentSDL, }; } else { + // Mutation & Subscription const hookName = `use${pascalCase(node.name.value)}${pascalCase( node.operation )}`; hooksToReplace[hookName] = { - name: hookName, + hookName: hookName, + hookType: + node.operation === OperationTypeNode.MUTATION + ? 'useMutation' + : 'useSubscription', importFrom: documentPath, + operationName, + documentSDL, }; } }, }); - - const gqlTagPath = path.posix.join( - baseOutputDir, - presetConfig.artifactDirectory - ); // FIXME: handle absolute path - - const newFilename = path.join( - documentPath.dir, - `${documentPath.name}.graphql.ts` - ); - const gqlTagImportPath = path.posix.relative( - documentPath.dir, - gqlTagPath - ); }); tsSourceFiles.forEach((tsSourceFile) => { - console.log( - '***filepath: ', - path.basename(tsSourceFile.getFilePath()), - 'START:' - ); // find imports const fileMetadata: { hasNodeToReplace: boolean; + needsToImport: string[]; functionsToReplace: Record< string, { + importDeclarationNode: ImportDeclaration; importSpecifierNode: ImportSpecifier; callExpression: CallExpression | null; } >; } = { hasNodeToReplace: false, + needsToImport: [], functionsToReplace: {}, }; @@ -127,6 +151,7 @@ export const preset: Types.OutputPreset = { if (hooksToReplace[importSpecifier.getName()]) { // FIXME: we are assuming same name means must replace. Should check import path as well? fileMetadata.functionsToReplace[importSpecifier.getName()] = { + importDeclarationNode: node, importSpecifierNode: importSpecifier, callExpression: null, }; @@ -148,6 +173,9 @@ export const preset: Types.OutputPreset = { fileMetadata.hasNodeToReplace = true; fileMetadata.functionsToReplace[calledFunctionName].callExpression = callExpression; + fileMetadata.needsToImport.push( + hooksToReplace[calledFunctionName].hookType + ); } }); @@ -155,14 +183,73 @@ export const preset: Types.OutputPreset = { return; } - console.log( - '***filepath: ', - path.basename(tsSourceFile.getFilePath()), - 'END\n' + // Codemod files to co-locate the document nodes + tsSourceFile.addImportDeclaration({ + moduleSpecifier: '@apollo/client/react', // FIXME: option to import from different module + namedImports: fileMetadata.needsToImport.map((importName) => ({ + name: importName, + })), + }); + + tsSourceFile.addImportDeclaration({ + moduleSpecifier: path.posix.relative( + path.dirname(tsSourceFile.getFilePath()), // TODO: would this break in windows? + gqlTagPath + ), // TODO: add relative path to codegen gql + namedImports: [{ name: presetConfig.gqlTagName }], + }); + + Object.values(fileMetadata.functionsToReplace).forEach( + (functionToReplace) => { + if (functionToReplace.callExpression) { + const graphqlDocument = + hooksToReplace[functionToReplace.importSpecifierNode.getName()]; + const documentNodeName = `${graphqlDocument.operationName}Doc`; + + functionToReplace.callExpression + .getFirstDescendantByKindOrThrow(SyntaxKind.Identifier) + .replaceWithText(graphqlDocument.hookType); + functionToReplace.callExpression.insertArgument( + 0, + documentNodeName + ); + + // Remove import specifier of hooks, and if no specifiers left, remove the whole import declaration + functionToReplace.importSpecifierNode.remove(); + if ( + functionToReplace.importDeclarationNode.getDescendantsOfKind( + SyntaxKind.ImportSpecifier + ).length === 0 + ) { + functionToReplace.importDeclarationNode.remove(); + } + + // Add documentNode to file + const lastImportIndex = tsSourceFile.getDescendantsOfKind( + SyntaxKind.ImportDeclaration + ).length; + tsSourceFile.insertStatements( + lastImportIndex, + `const ${documentNodeName} = graphql(\`${graphqlDocument.documentSDL}\`)` + ); + } + } ); + + console.log('*** after update:'); + console.log(tsSourceFile.getFullText()); + + console.log('END\n'); }); - return []; + return tsSourceFiles.map((tsSourceFile) => ({ + filename: tsSourceFile.getFilePath(), + pluginMap: { add: addPlugin }, + plugins: [{ add: { content: tsSourceFile.getFullText() } }], + config: {}, + schema, + documents: [], + })); }, }; From 042f2d796de4733d4876e98a1904d34a4baf30e0 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 02:06:03 +1000 Subject: [PATCH 09/37] Remove unused generation --- .../src/test-index-to-colocation/codegen.mts | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts index 50a41a7f..a82b4822 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts @@ -9,17 +9,6 @@ const config: CodegenConfig = { afterAllFileWrite: ['prettier --write'], }, generates: { - 'packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts': - { - documents: [ - 'packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/*.graphql', - ], - plugins: [ - 'typescript', - 'typescript-operations', - 'typescript-react-apollo', - ], - }, 'packages/operation-location-migration-e2e/src/test-index-to-colocation': defineConfig( { From bb8d32a2e9bffb5ed009866a284de749fc080e91 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 02:11:06 +1000 Subject: [PATCH 10/37] Set up test with params --- .../test-index-to-colocation/components/MeComponent.query.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts index c30e3596..0caa31b0 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts @@ -1,6 +1,6 @@ import { useMeQuery } from '../generated/hooks.generated'; export const MeComponent = () => { - useMeQuery(); + useMeQuery({ skip: true }); return 'Me'; }; From 3d7170befd07ba7535d2ac8f8037988c4edfb5b4 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 21:21:57 +1000 Subject: [PATCH 11/37] QOL formatting --- packages/operation-location-migration/src/preset.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 6b04dbe9..4de4790d 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -228,10 +228,10 @@ export const preset: Types.OutputPreset = { const lastImportIndex = tsSourceFile.getDescendantsOfKind( SyntaxKind.ImportDeclaration ).length; - tsSourceFile.insertStatements( - lastImportIndex, - `const ${documentNodeName} = graphql(\`${graphqlDocument.documentSDL}\`)` - ); + tsSourceFile.insertStatements(lastImportIndex, [ + '\n', + `const ${documentNodeName} = graphql(\`${graphqlDocument.documentSDL}\`)`, + ]); } } ); From 2c534128e27827ebc43ccfeb75b66bc3703fd143 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 21:22:11 +1000 Subject: [PATCH 12/37] Update e2e test --- .../test-index-to-colocation/components/UserComponent.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts index f68820c4..caaef391 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts @@ -1,6 +1,11 @@ -import { useMeQuery, useMeLazyQuery } from '../generated/hooks.generated'; +import { + useMeQuery, + useMeLazyQuery, + useMeSuspenseQuery, +} from '../generated/hooks.generated'; export const UserComponent = () => { - useMeQuery(); + useMeQuery({ onCompleted: () => {} }); + const res = useMeSuspenseQuery(); return 'User'; }; From c019e285b11ffd6f9dc47a9f7b30cddd2a7129d6 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 21:34:25 +1000 Subject: [PATCH 13/37] Ensure no double Doc --- .../components/UserComponent.ts | 2 + .../generated/hooks.generated.ts | 75 +++++++++++++++++++ .../operations/User.graphql | 7 ++ .../test-index-to-colocation/schema.graphqls | 10 +++ .../src/preset.ts | 8 +- 5 files changed, 101 insertions(+), 1 deletion(-) diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts index caaef391..138d4de6 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts @@ -2,10 +2,12 @@ import { useMeQuery, useMeLazyQuery, useMeSuspenseQuery, + useUpdateUserMutation, } from '../generated/hooks.generated'; export const UserComponent = () => { useMeQuery({ onCompleted: () => {} }); const res = useMeSuspenseQuery(); + useUpdateUserMutation(); return 'User'; }; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts index 898e79b9..873a6ce6 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts @@ -30,6 +30,15 @@ export type Scalars = { Float: { input: number; output: number }; }; +export type Mutation = { + __typename?: 'Mutation'; + updateUser: User; +}; + +export type MutationUpdateUserArgs = { + input: UpdateUserInput; +}; + export type Query = { __typename?: 'Query'; me?: Maybe; @@ -40,9 +49,15 @@ export type QueryUserArgs = { id?: InputMaybe; }; +export type UpdateUserInput = { + id: Scalars['ID']['input']; + name: Scalars['String']['input']; +}; + export type User = { __typename?: 'User'; id: Scalars['ID']['output']; + name: Scalars['String']['output']; }; export type MeQueryVariables = Exact<{ [key: string]: never }>; @@ -61,6 +76,15 @@ export type UserQuery = { user?: { __typename: 'User' } | null; }; +export type UpdateUserMutationVariables = Exact<{ + input: UpdateUserInput; +}>; + +export type UpdateUserMutation = { + __typename?: 'Mutation'; + updateUser: { __typename?: 'User'; id: string; name: string }; +}; + export const MeDocument = gql` query Me { me { @@ -174,3 +198,54 @@ export type UserSuspenseQueryHookResult = ReturnType< typeof useUserSuspenseQuery >; export type UserQueryResult = Apollo.QueryResult; +export const UpdateUserDocument = gql` + mutation UpdateUser($input: UpdateUserInput!) { + updateUser(input: $input) { + id + name + } + } +`; +export type UpdateUserMutationFn = Apollo.MutationFunction< + UpdateUserMutation, + UpdateUserMutationVariables +>; + +/** + * __useUpdateUserMutation__ + * + * To run a mutation, you first call `useUpdateUserMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUpdateUserMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [updateUserMutation, { data, loading, error }] = useUpdateUserMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useUpdateUserMutation( + baseOptions?: Apollo.MutationHookOptions< + UpdateUserMutation, + UpdateUserMutationVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useMutation( + UpdateUserDocument, + options + ); +} +export type UpdateUserMutationHookResult = ReturnType< + typeof useUpdateUserMutation +>; +export type UpdateUserMutationResult = + Apollo.MutationResult; +export type UpdateUserMutationOptions = Apollo.BaseMutationOptions< + UpdateUserMutation, + UpdateUserMutationVariables +>; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/User.graphql b/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/User.graphql index dda30949..020f850b 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/User.graphql +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/User.graphql @@ -3,3 +3,10 @@ query User($id: ID!) { __typename } } + +mutation UpdateUser($input: UpdateUserInput!) { + updateUser(input: $input) { + id + name + } +} diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls b/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls index a9075c97..73c30fdc 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls @@ -3,6 +3,16 @@ type Query { user(id: ID): User } +type Mutation { + updateUser(input: UpdateUserInput!): User! +} + +input UpdateUserInput { + id: ID! + name: String! +} + type User { id: ID! + name: String! } diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 4de4790d..4716fbee 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -199,6 +199,8 @@ export const preset: Types.OutputPreset = { namedImports: [{ name: presetConfig.gqlTagName }], }); + const addedDocMap: Record = {}; + Object.values(fileMetadata.functionsToReplace).forEach( (functionToReplace) => { if (functionToReplace.callExpression) { @@ -224,7 +226,10 @@ export const preset: Types.OutputPreset = { functionToReplace.importDeclarationNode.remove(); } - // Add documentNode to file + // Add documentNode to file if it's not already there + if (addedDocMap[documentNodeName]) { + return; + } const lastImportIndex = tsSourceFile.getDescendantsOfKind( SyntaxKind.ImportDeclaration ).length; @@ -232,6 +237,7 @@ export const preset: Types.OutputPreset = { '\n', `const ${documentNodeName} = graphql(\`${graphqlDocument.documentSDL}\`)`, ]); + addedDocMap[documentNodeName] = true; } } ); From 6b37abf1b39fa615b263ddd3172fd5904ca8c03c Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 23:09:23 +1000 Subject: [PATCH 14/37] Add testing-utils lib --- package.json | 1 + packages/testing-utils/bin/assert-e2e.sh | 19 ++ packages/testing-utils/eslint.config.mjs | 3 + packages/testing-utils/project.json | 8 + packages/testing-utils/src/createTestSetup.ts | 33 ++++ packages/testing-utils/src/index.ts | 1 + packages/testing-utils/tsconfig.json | 13 ++ packages/testing-utils/tsconfig.lib.json | 9 + tsconfig.base.json | 3 +- yarn.lock | 186 +++++++++++++++++- 10 files changed, 274 insertions(+), 2 deletions(-) create mode 100755 packages/testing-utils/bin/assert-e2e.sh create mode 100644 packages/testing-utils/eslint.config.mjs create mode 100644 packages/testing-utils/project.json create mode 100644 packages/testing-utils/src/createTestSetup.ts create mode 100644 packages/testing-utils/src/index.ts create mode 100644 packages/testing-utils/tsconfig.json create mode 100644 packages/testing-utils/tsconfig.lib.json diff --git a/package.json b/package.json index 54380ac6..ed3e1955 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "ts-jest": "29.1.0", "ts-morph": "22.0.0", "ts-node": "10.9.1", + "tsx": "4.20.3", "typescript": "5.8.3", "typescript-eslint": "8.37.0" }, diff --git a/packages/testing-utils/bin/assert-e2e.sh b/packages/testing-utils/bin/assert-e2e.sh new file mode 100755 index 00000000..72836cbb --- /dev/null +++ b/packages/testing-utils/bin/assert-e2e.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -eu + +output_pattern=packages/typescript-resolver-files-e2e/src/**/*.ts + +# Assert committed files are the same +echo -e "\n=> Checking if actual output matches commited files..." +if [[ `git status --porcelain "$output_pattern"` ]]; then + echo -e "\nx> Error!\n" + echo "=> Following files do not have expected result:" + git --no-pager diff HEAD --color -- "$output_pattern" + git ls-files --others --exclude-standard + echo -e "=> Run 'nx e2e typescript-resolver-files-e2e', commit the changes and try again.\n" + exit 1 +fi + +echo -e "=> No errors.\n" +exit 0 diff --git a/packages/testing-utils/eslint.config.mjs b/packages/testing-utils/eslint.config.mjs new file mode 100644 index 00000000..b7f62772 --- /dev/null +++ b/packages/testing-utils/eslint.config.mjs @@ -0,0 +1,3 @@ +import baseConfig from '../../eslint.config.mjs'; + +export default [...baseConfig]; diff --git a/packages/testing-utils/project.json b/packages/testing-utils/project.json new file mode 100644 index 00000000..6db2979c --- /dev/null +++ b/packages/testing-utils/project.json @@ -0,0 +1,8 @@ +{ + "name": "testing-utils", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/testing-utils/src", + "projectType": "library", + "tags": [], + "targets": {} +} diff --git a/packages/testing-utils/src/createTestSetup.ts b/packages/testing-utils/src/createTestSetup.ts new file mode 100644 index 00000000..71cf62c2 --- /dev/null +++ b/packages/testing-utils/src/createTestSetup.ts @@ -0,0 +1,33 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +export const createTestSetup = ({ + baseDir, + files, +}: { + baseDir: string; + files: (string | { file: string; content: string })[]; +}) => { + try { + files.forEach((item) => { + let filename: string; + let content = ''; + + if (typeof item === 'string') { + filename = path.join(baseDir, item); + } else { + filename = path.join(baseDir, item.file); + content = item.content; + } + + const dir = path.dirname(filename); + fs.mkdirSync(dir, { recursive: true }); + fs.writeFileSync( + filename, + `/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */\n\n${content}` + ); + }); + } catch (err) { + console.error(err); + } +}; diff --git a/packages/testing-utils/src/index.ts b/packages/testing-utils/src/index.ts new file mode 100644 index 00000000..2a8a3991 --- /dev/null +++ b/packages/testing-utils/src/index.ts @@ -0,0 +1 @@ +export { createTestSetup } from './createTestSetup'; diff --git a/packages/testing-utils/tsconfig.json b/packages/testing-utils/tsconfig.json new file mode 100644 index 00000000..4b222562 --- /dev/null +++ b/packages/testing-utils/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs" + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/packages/testing-utils/tsconfig.lib.json b/packages/testing-utils/tsconfig.lib.json new file mode 100644 index 00000000..8675a0b4 --- /dev/null +++ b/packages/testing-utils/tsconfig.lib.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json index 4d8f8246..ca81b86b 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -24,7 +24,8 @@ ], "@graphql-code-generator-plugins/workspace-plugin": [ "tools/workspace-plugin/src/index.ts" - ] + ], + "@workspace/testing-utils": ["packages/testing-utils/src/index.ts"] } }, "exclude": ["node_modules", "tmp"] diff --git a/yarn.lock b/yarn.lock index 031aaf59..20c57826 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1783,6 +1783,136 @@ dependencies: tslib "^2.4.0" +"@esbuild/aix-ppc64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.8.tgz#a1414903bb38027382f85f03dda6065056757727" + integrity sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA== + +"@esbuild/android-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.25.8.tgz#c859994089e9767224269884061f89dae6fb51c6" + integrity sha512-OD3p7LYzWpLhZEyATcTSJ67qB5D+20vbtr6vHlHWSQYhKtzUYrETuWThmzFpZtFsBIxRvhO07+UgVA9m0i/O1w== + +"@esbuild/android-arm@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.25.8.tgz#96a8f2ca91c6cd29ea90b1af79d83761c8ba0059" + integrity sha512-RONsAvGCz5oWyePVnLdZY/HHwA++nxYWIX1atInlaW6SEkwq6XkP3+cb825EUcRs5Vss/lGh/2YxAb5xqc07Uw== + +"@esbuild/android-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.25.8.tgz#a3a626c4fec4a024a9fa8c7679c39996e92916f0" + integrity sha512-yJAVPklM5+4+9dTeKwHOaA+LQkmrKFX96BM0A/2zQrbS6ENCmxc4OVoBs5dPkCCak2roAD+jKCdnmOqKszPkjA== + +"@esbuild/darwin-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.8.tgz#a5e1252ca2983d566af1c0ea39aded65736fc66d" + integrity sha512-Jw0mxgIaYX6R8ODrdkLLPwBqHTtYHJSmzzd+QeytSugzQ0Vg4c5rDky5VgkoowbZQahCbsv1rT1KW72MPIkevw== + +"@esbuild/darwin-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.25.8.tgz#5271b0df2bb12ce8df886704bfdd1c7cc01385d2" + integrity sha512-Vh2gLxxHnuoQ+GjPNvDSDRpoBCUzY4Pu0kBqMBDlK4fuWbKgGtmDIeEC081xi26PPjn+1tct+Bh8FjyLlw1Zlg== + +"@esbuild/freebsd-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.8.tgz#d0a0e7fdf19733b8bb1566b81df1aa0bb7e46ada" + integrity sha512-YPJ7hDQ9DnNe5vxOm6jaie9QsTwcKedPvizTVlqWG9GBSq+BuyWEDazlGaDTC5NGU4QJd666V0yqCBL2oWKPfA== + +"@esbuild/freebsd-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.8.tgz#2de8b2e0899d08f1cb1ef3128e159616e7e85343" + integrity sha512-MmaEXxQRdXNFsRN/KcIimLnSJrk2r5H8v+WVafRWz5xdSVmWLoITZQXcgehI2ZE6gioE6HirAEToM/RvFBeuhw== + +"@esbuild/linux-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.25.8.tgz#a4209efadc0c2975716458484a4e90c237c48ae9" + integrity sha512-WIgg00ARWv/uYLU7lsuDK00d/hHSfES5BzdWAdAig1ioV5kaFNrtK8EqGcUBJhYqotlUByUKz5Qo6u8tt7iD/w== + +"@esbuild/linux-arm@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.25.8.tgz#ccd9e291c24cd8d9142d819d463e2e7200d25b19" + integrity sha512-FuzEP9BixzZohl1kLf76KEVOsxtIBFwCaLupVuk4eFVnOZfU+Wsn+x5Ryam7nILV2pkq2TqQM9EZPsOBuMC+kg== + +"@esbuild/linux-ia32@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.25.8.tgz#006ad1536d0c2b28fb3a1cf0b53bcb85aaf92c4d" + integrity sha512-A1D9YzRX1i+1AJZuFFUMP1E9fMaYY+GnSQil9Tlw05utlE86EKTUA7RjwHDkEitmLYiFsRd9HwKBPEftNdBfjg== + +"@esbuild/linux-loong64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.25.8.tgz#127b3fbfb2c2e08b1397e985932f718f09a8f5c4" + integrity sha512-O7k1J/dwHkY1RMVvglFHl1HzutGEFFZ3kNiDMSOyUrB7WcoHGf96Sh+64nTRT26l3GMbCW01Ekh/ThKM5iI7hQ== + +"@esbuild/linux-mips64el@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.8.tgz#837d1449517791e3fa7d82675a2d06d9f56cb340" + integrity sha512-uv+dqfRazte3BzfMp8PAQXmdGHQt2oC/y2ovwpTteqrMx2lwaksiFZ/bdkXJC19ttTvNXBuWH53zy/aTj1FgGw== + +"@esbuild/linux-ppc64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.8.tgz#aa2e3bd93ab8df084212f1895ca4b03c42d9e0fe" + integrity sha512-GyG0KcMi1GBavP5JgAkkstMGyMholMDybAf8wF5A70CALlDM2p/f7YFE7H92eDeH/VBtFJA5MT4nRPDGg4JuzQ== + +"@esbuild/linux-riscv64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.8.tgz#a340620e31093fef72767dd28ab04214b3442083" + integrity sha512-rAqDYFv3yzMrq7GIcen3XP7TUEG/4LK86LUPMIz6RT8A6pRIDn0sDcvjudVZBiiTcZCY9y2SgYX2lgK3AF+1eg== + +"@esbuild/linux-s390x@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.25.8.tgz#ddfed266c8c13f5efb3105a0cd47f6dcd0e79e71" + integrity sha512-Xutvh6VjlbcHpsIIbwY8GVRbwoviWT19tFhgdA7DlenLGC/mbc3lBoVb7jxj9Z+eyGqvcnSyIltYUrkKzWqSvg== + +"@esbuild/linux-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.25.8.tgz#9a4f78c75c051e8c060183ebb39a269ba936a2ac" + integrity sha512-ASFQhgY4ElXh3nDcOMTkQero4b1lgubskNlhIfJrsH5OKZXDpUAKBlNS0Kx81jwOBp+HCeZqmoJuihTv57/jvQ== + +"@esbuild/netbsd-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.8.tgz#902c80e1d678047926387230bc037e63e00697d0" + integrity sha512-d1KfruIeohqAi6SA+gENMuObDbEjn22olAR7egqnkCD9DGBG0wsEARotkLgXDu6c4ncgWTZJtN5vcgxzWRMzcw== + +"@esbuild/netbsd-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.8.tgz#2d9eb4692add2681ff05a14ce99de54fbed7079c" + integrity sha512-nVDCkrvx2ua+XQNyfrujIG38+YGyuy2Ru9kKVNyh5jAys6n+l44tTtToqHjino2My8VAY6Lw9H7RI73XFi66Cg== + +"@esbuild/openbsd-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.8.tgz#89c3b998c6de739db38ab7fb71a8a76b3fa84a45" + integrity sha512-j8HgrDuSJFAujkivSMSfPQSAa5Fxbvk4rgNAS5i3K+r8s1X0p1uOO2Hl2xNsGFppOeHOLAVgYwDVlmxhq5h+SQ== + +"@esbuild/openbsd-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.8.tgz#2f01615cf472b0e48c077045cfd96b5c149365cc" + integrity sha512-1h8MUAwa0VhNCDp6Af0HToI2TJFAn1uqT9Al6DJVzdIBAd21m/G0Yfc77KDM3uF3T/YaOgQq3qTJHPbTOInaIQ== + +"@esbuild/openharmony-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.8.tgz#a201f720cd2c3ebf9a6033fcc3feb069a54b509a" + integrity sha512-r2nVa5SIK9tSWd0kJd9HCffnDHKchTGikb//9c7HX+r+wHYCpQrSgxhlY6KWV1nFo1l4KFbsMlHk+L6fekLsUg== + +"@esbuild/sunos-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.25.8.tgz#07046c977985a3334667f19e6ab3a01a80862afb" + integrity sha512-zUlaP2S12YhQ2UzUfcCuMDHQFJyKABkAjvO5YSndMiIkMimPmxA+BYSBikWgsRpvyxuRnow4nS5NPnf9fpv41w== + +"@esbuild/win32-arm64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.25.8.tgz#4a5470caf0d16127c05d4833d4934213c69392d1" + integrity sha512-YEGFFWESlPva8hGL+zvj2z/SaK+pH0SwOM0Nc/d+rVnW7GSTFlLBGzZkuSU9kFIGIo8q9X3ucpZhu8PDN5A2sQ== + +"@esbuild/win32-ia32@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.25.8.tgz#3de3e8470b7b328d99dbc3e9ec1eace207e5bbc4" + integrity sha512-hiGgGC6KZ5LZz58OL/+qVVoZiuZlUYlYHNAmczOm7bs2oE1XriPFi5ZHHrS8ACpV5EjySrnoCKmcbQMN+ojnHg== + +"@esbuild/win32-x64@0.25.8": + version "0.25.8" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.25.8.tgz#610d7ea539d2fcdbe39237b5cc175eb2c4451f9c" + integrity sha512-cn3Yr7+OaaZq1c+2pe+8yxC8E144SReCQjN6/2ynubzYjvyqZjTXfQJpAcQpsdJq3My7XADANiYGHoFC69pLQw== + "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -5340,6 +5470,38 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +esbuild@~0.25.0: + version "0.25.8" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.25.8.tgz#482d42198b427c9c2f3a81b63d7663aecb1dda07" + integrity sha512-vVC0USHGtMi8+R4Kz8rt6JhEWLxsv9Rnu/lGYbPR8u47B+DCBksq9JarW0zOO7bs37hyOK1l2/oqtbciutL5+Q== + optionalDependencies: + "@esbuild/aix-ppc64" "0.25.8" + "@esbuild/android-arm" "0.25.8" + "@esbuild/android-arm64" "0.25.8" + "@esbuild/android-x64" "0.25.8" + "@esbuild/darwin-arm64" "0.25.8" + "@esbuild/darwin-x64" "0.25.8" + "@esbuild/freebsd-arm64" "0.25.8" + "@esbuild/freebsd-x64" "0.25.8" + "@esbuild/linux-arm" "0.25.8" + "@esbuild/linux-arm64" "0.25.8" + "@esbuild/linux-ia32" "0.25.8" + "@esbuild/linux-loong64" "0.25.8" + "@esbuild/linux-mips64el" "0.25.8" + "@esbuild/linux-ppc64" "0.25.8" + "@esbuild/linux-riscv64" "0.25.8" + "@esbuild/linux-s390x" "0.25.8" + "@esbuild/linux-x64" "0.25.8" + "@esbuild/netbsd-arm64" "0.25.8" + "@esbuild/netbsd-x64" "0.25.8" + "@esbuild/openbsd-arm64" "0.25.8" + "@esbuild/openbsd-x64" "0.25.8" + "@esbuild/openharmony-arm64" "0.25.8" + "@esbuild/sunos-x64" "0.25.8" + "@esbuild/win32-arm64" "0.25.8" + "@esbuild/win32-ia32" "0.25.8" + "@esbuild/win32-x64" "0.25.8" + escalade@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" @@ -5836,7 +5998,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.3: +fsevents@^2.3.3, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -5924,6 +6086,13 @@ get-them-args@1.3.2: resolved "https://registry.yarnpkg.com/get-them-args/-/get-them-args-1.3.2.tgz#74a20ba8a4abece5ae199ad03f2bcc68fdfc9ba5" integrity sha512-LRn8Jlk+DwZE4GTlDbT3Hikd1wSHgLMme/+7ddlqKd7ldwR6LjJgTVWzBnR01wnYGe4KgrXjg287RaI22UHmAw== +get-tsconfig@^4.7.5: + version "4.10.1" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.10.1.tgz#d34c1c01f47d65a606c37aa7a177bc3e56ab4b2e" + integrity sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ== + dependencies: + resolve-pkg-maps "^1.0.0" + glob-parent@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -8393,6 +8562,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-pkg-maps@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" + integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== + resolve.exports@2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.3.tgz#41955e6f1b4013b7586f873749a635dea07ebe3f" @@ -9256,6 +9430,16 @@ tslib@~2.4.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e" integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA== +tsx@4.20.3: + version "4.20.3" + resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.20.3.tgz#f913e4911d59ad177c1bcee19d1035ef8dd6e2fb" + integrity sha512-qjbnuR9Tr+FJOMBqJCW5ehvIo/buZq7vH7qD7JziU98h6l3qGy0a/yPFjwO+y0/T7GFpNgNAvEcPPVfyT8rrPQ== + dependencies: + esbuild "~0.25.0" + get-tsconfig "^4.7.5" + optionalDependencies: + fsevents "~2.3.3" + tty-table@^4.1.5: version "4.2.3" resolved "https://registry.yarnpkg.com/tty-table/-/tty-table-4.2.3.tgz#e33eb4007a0a9c976c97c37fa13ba66329a5c515" From f64a7204aae17f79839fb167aa65a7c43edb151e Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 23:10:52 +1000 Subject: [PATCH 15/37] Add test setup --- .../project.json | 19 +++++++ .../components/MeComponent.lazy-query.ts | 12 +++-- .../components/MeComponent.query.ts | 12 +++-- .../components/MeComponent.suspense-query.ts | 20 ++++++-- .../src/test-index-to-colocation/testSetup.ts | 51 +++++++++++++++++++ .../test-index-to-colocation/tsconfig.json | 2 +- packages/testing-utils/bin/assert-e2e.sh | 2 +- packages/testing-utils/src/createTestSetup.ts | 2 +- 8 files changed, 102 insertions(+), 18 deletions(-) create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts diff --git a/packages/operation-location-migration-e2e/project.json b/packages/operation-location-migration-e2e/project.json index 5da52d68..a7579966 100644 --- a/packages/operation-location-migration-e2e/project.json +++ b/packages/operation-location-migration-e2e/project.json @@ -5,6 +5,25 @@ "projectType": "library", "implicitDependencies": ["operation-location-migration"], "targets": { + "e2e": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "nx test-setup operation-location-migration-e2e", + "nx graphql-codegen operation-location-migration-e2e -c test-index-to-colocation", + "OUTPUT_PATTERN=\"{projectRoot}/src/**/*.ts\" bash packages/testing-utils/bin/assert-e2e.sh" + ], + "parallel": false + } + }, + "test-setup": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-index-to-colocation/testSetup.ts" + ] + } + }, "graphql-codegen": { "executor": "@eddeee888/nx-graphql-code-generator:codegen", "options": {}, diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts index c0ad4295..6a09f2c3 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts @@ -1,6 +1,8 @@ -import { useMeLazyQuery } from '../generated/hooks.generated'; +/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */ -export const MeComponent = () => { - useMeLazyQuery(); - return 'Me'; -}; +import { useMeLazyQuery } from '../generated/hooks.generated'; + + export const MeComponent = () => { + useMeLazyQuery(); + return 'Me'; + }; \ No newline at end of file diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts index 0caa31b0..ff644990 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts @@ -1,6 +1,8 @@ -import { useMeQuery } from '../generated/hooks.generated'; +/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */ -export const MeComponent = () => { - useMeQuery({ skip: true }); - return 'Me'; -}; +import { useMeQuery } from '../generated/hooks.generated'; + + export const MeComponent = () => { + useMeQuery({ skip: true }); + return 'Me'; + }; \ No newline at end of file diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts index e242ef6d..4c91545b 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts @@ -1,6 +1,16 @@ -import { useMeSuspenseQuery } from '../generated/hooks.generated'; +/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */ -export const MeComponent = () => { - useMeSuspenseQuery(); - return 'Me'; -}; +import { + useMeQuery, + useMeLazyQuery, + useMeSuspenseQuery, + useUpdateUserMutation, + } from '../generated/hooks.generated'; + + export const UserComponent = () => { + useMeQuery({ onCompleted: () => {} }); + const res = useMeSuspenseQuery(); + useUpdateUserMutation(); + return 'User'; + }; + \ No newline at end of file diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts new file mode 100644 index 00000000..7e843c69 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts @@ -0,0 +1,51 @@ +import { createTestSetup } from '@workspace/testing-utils'; + +createTestSetup({ + baseDir: __dirname, + files: [ + { + file: 'components/MeComponent.lazy-query.ts', + content: `import { useMeLazyQuery } from '../generated/hooks.generated'; + + export const MeComponent = () => { + useMeLazyQuery(); + return 'Me'; + };`, + }, + { + file: 'components/MeComponent.query.ts', + content: `import { useMeQuery } from '../generated/hooks.generated'; + + export const MeComponent = () => { + useMeQuery({ skip: true }); + return 'Me'; + };`, + }, + { + file: 'components/MeComponent.suspense-query.ts', + content: `import { useMeSuspenseQuery } from '../generated/hooks.generated'; + + export const MeComponent = () => { + useMeSuspenseQuery(); + return 'Me'; + };`, + }, + { + file: 'components/MeComponent.suspense-query.ts', + content: `import { + useMeQuery, + useMeLazyQuery, + useMeSuspenseQuery, + useUpdateUserMutation, + } from '../generated/hooks.generated'; + + export const UserComponent = () => { + useMeQuery({ onCompleted: () => {} }); + const res = useMeSuspenseQuery(); + useUpdateUserMutation(); + return 'User'; + }; + `, + }, + ], +}); diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json b/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json index 2b229a8e..58b80f8b 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json @@ -5,5 +5,5 @@ "module": "commonjs", "strict": true }, - "include": ["./**/*.ts"] + "include": ["./gql/**/*.ts", "./generated/**/*.ts", "./components/**/*.ts"] } diff --git a/packages/testing-utils/bin/assert-e2e.sh b/packages/testing-utils/bin/assert-e2e.sh index 72836cbb..96655850 100755 --- a/packages/testing-utils/bin/assert-e2e.sh +++ b/packages/testing-utils/bin/assert-e2e.sh @@ -2,7 +2,7 @@ set -eu -output_pattern=packages/typescript-resolver-files-e2e/src/**/*.ts +output_pattern=$OUTPUT_PATTERN # Assert committed files are the same echo -e "\n=> Checking if actual output matches commited files..." diff --git a/packages/testing-utils/src/createTestSetup.ts b/packages/testing-utils/src/createTestSetup.ts index 71cf62c2..e143982a 100644 --- a/packages/testing-utils/src/createTestSetup.ts +++ b/packages/testing-utils/src/createTestSetup.ts @@ -24,7 +24,7 @@ export const createTestSetup = ({ fs.mkdirSync(dir, { recursive: true }); fs.writeFileSync( filename, - `/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */\n\n${content}` + `/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */\n\n${content}` ); }); } catch (err) { From 803a3d56fb98b4f5a143dc1614ef5960047c0568 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 23:20:29 +1000 Subject: [PATCH 16/37] Baseline tests --- .../components/MeComponent.lazy-query.ts | 22 ++++++++---- .../components/MeComponent.query.ts | 22 ++++++++---- .../components/MeComponent.suspense-query.ts | 30 ++++++++-------- .../components/UserComponent.ts | 34 ++++++++++++++----- .../src/test-index-to-colocation/testSetup.ts | 2 +- 5 files changed, 71 insertions(+), 39 deletions(-) diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts index 6a09f2c3..b5cbdfc7 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.lazy-query.ts @@ -1,8 +1,16 @@ -/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */ +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ +import { useLazyQuery } from '@apollo/client/react'; +import { graphql } from '../gql'; -import { useMeLazyQuery } from '../generated/hooks.generated'; - - export const MeComponent = () => { - useMeLazyQuery(); - return 'Me'; - }; \ No newline at end of file +const MeDoc = graphql(` + query Me { + me { + __typename + } + } +`); + +export const MeComponent = () => { + useLazyQuery(MeDoc); + return 'Me'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts index ff644990..9a67fe6d 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.query.ts @@ -1,8 +1,16 @@ -/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */ +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ +import { useQuery } from '@apollo/client/react'; +import { graphql } from '../gql'; -import { useMeQuery } from '../generated/hooks.generated'; - - export const MeComponent = () => { - useMeQuery({ skip: true }); - return 'Me'; - }; \ No newline at end of file +const MeDoc = graphql(` + query Me { + me { + __typename + } + } +`); + +export const MeComponent = () => { + useQuery(MeDoc, { skip: true }); + return 'Me'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts index 4c91545b..635f9675 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/MeComponent.suspense-query.ts @@ -1,16 +1,16 @@ -/* This file has been created on filesystem by src/test-resolvers/auto-wireup/test-setup.js */ +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ +import { useSuspenseQuery } from '@apollo/client/react'; +import { graphql } from '../gql'; -import { - useMeQuery, - useMeLazyQuery, - useMeSuspenseQuery, - useUpdateUserMutation, - } from '../generated/hooks.generated'; - - export const UserComponent = () => { - useMeQuery({ onCompleted: () => {} }); - const res = useMeSuspenseQuery(); - useUpdateUserMutation(); - return 'User'; - }; - \ No newline at end of file +const MeDoc = graphql(` + query Me { + me { + __typename + } + } +`); + +export const MeComponent = () => { + useSuspenseQuery(MeDoc); + return 'Me'; +}; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts index 138d4de6..bcd428ad 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserComponent.ts @@ -1,13 +1,29 @@ -import { - useMeQuery, - useMeLazyQuery, - useMeSuspenseQuery, - useUpdateUserMutation, -} from '../generated/hooks.generated'; +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ + +import { useMeLazyQuery } from '../generated/hooks.generated'; +import { useQuery, useSuspenseQuery, useMutation } from '@apollo/client/react'; +import { graphql } from '../gql'; + +const UpdateUserDoc = graphql(` + mutation UpdateUser($input: UpdateUserInput!) { + updateUser(input: $input) { + id + name + } + } +`); + +const MeDoc = graphql(` + query Me { + me { + __typename + } + } +`); export const UserComponent = () => { - useMeQuery({ onCompleted: () => {} }); - const res = useMeSuspenseQuery(); - useUpdateUserMutation(); + useQuery(MeDoc, { onCompleted: () => {} }); + const res = useSuspenseQuery(MeDoc); + useMutation(UpdateUserDoc); return 'User'; }; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts index 7e843c69..1d42dcfe 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts @@ -31,7 +31,7 @@ createTestSetup({ };`, }, { - file: 'components/MeComponent.suspense-query.ts', + file: 'components/UserComponent.ts', content: `import { useMeQuery, useMeLazyQuery, From 1c2e1aa415ee7ae8aabdf7a21d8fad5db8170a32 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 23:43:06 +1000 Subject: [PATCH 17/37] Fix import issues --- .../src/preset.ts | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 4716fbee..b1983987 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -142,22 +142,18 @@ export const preset: Types.OutputPreset = { functionsToReplace: {}, }; - tsSourceFile - .getDescendantsOfKind(SyntaxKind.ImportDeclaration) - .forEach((node) => { - node - .getDescendantsOfKind(SyntaxKind.ImportSpecifier) - .forEach((importSpecifier) => { - if (hooksToReplace[importSpecifier.getName()]) { - // FIXME: we are assuming same name means must replace. Should check import path as well? - fileMetadata.functionsToReplace[importSpecifier.getName()] = { - importDeclarationNode: node, - importSpecifierNode: importSpecifier, - callExpression: null, - }; - } - }); + tsSourceFile.getImportDeclarations().forEach((node) => { + node.getNamedImports().forEach((importSpecifier) => { + if (hooksToReplace[importSpecifier.getName()]) { + // FIXME: we are assuming same name means must replace. Should check import path as well? + fileMetadata.functionsToReplace[importSpecifier.getName()] = { + importDeclarationNode: node, + importSpecifierNode: importSpecifier, + callExpression: null, + }; + } }); + }); // find call expressions tsSourceFile @@ -219,9 +215,8 @@ export const preset: Types.OutputPreset = { // Remove import specifier of hooks, and if no specifiers left, remove the whole import declaration functionToReplace.importSpecifierNode.remove(); if ( - functionToReplace.importDeclarationNode.getDescendantsOfKind( - SyntaxKind.ImportSpecifier - ).length === 0 + functionToReplace.importDeclarationNode.getNamedImports() + .length === 0 ) { functionToReplace.importDeclarationNode.remove(); } @@ -230,10 +225,17 @@ export const preset: Types.OutputPreset = { if (addedDocMap[documentNodeName]) { return; } - const lastImportIndex = tsSourceFile.getDescendantsOfKind( - SyntaxKind.ImportDeclaration - ).length; - tsSourceFile.insertStatements(lastImportIndex, [ + + // Find insertIndex, which is after the last import declaration + const importDeclarations = tsSourceFile.getImportDeclarations(); + const insertPos = + importDeclarations[importDeclarations.length - 1].getEnd(); + const insertIndex = + tsSourceFile + .getStatements() + .findIndex((stmt) => stmt.getStart() > insertPos) + 1; + + tsSourceFile.insertStatements(insertIndex, [ '\n', `const ${documentNodeName} = graphql(\`${graphqlDocument.documentSDL}\`)`, ]); From b7d1a6b303b6cbb523a4c8365e06ce11cb17acde Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 23:50:50 +1000 Subject: [PATCH 18/37] Fix multiple docs being put incorrectly into graphql tag --- packages/operation-location-migration-e2e/project.json | 2 +- packages/operation-location-migration/src/preset.ts | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/operation-location-migration-e2e/project.json b/packages/operation-location-migration-e2e/project.json index a7579966..496bf671 100644 --- a/packages/operation-location-migration-e2e/project.json +++ b/packages/operation-location-migration-e2e/project.json @@ -10,7 +10,7 @@ "options": { "commands": [ "nx test-setup operation-location-migration-e2e", - "nx graphql-codegen operation-location-migration-e2e -c test-index-to-colocation", + "nx graphql-codegen operation-location-migration-e2e --verbose -c test-index-to-colocation", "OUTPUT_PATTERN=\"{projectRoot}/src/**/*.ts\" bash packages/testing-utils/bin/assert-e2e.sh" ], "parallel": false diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index b1983987..43641b64 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -6,7 +6,7 @@ import { createNoopProfiler, } from '@graphql-codegen/plugin-helpers'; import { pascalCase } from 'change-case-all'; -import { OperationTypeNode, visit } from 'graphql'; +import { OperationTypeNode, print, visit } from 'graphql'; import { CallExpression, ImportDeclaration, @@ -59,7 +59,6 @@ export const preset: Types.OutputPreset = { documents.forEach((documentFile) => { const documentPath = path.parse(documentFile.location || ''); - const documentSDL = documentFile.rawSDL || ''; if (!documentFile.document) { throw new Error('Document does not exist!'); // FIXME: should not throw @@ -72,6 +71,7 @@ export const preset: Types.OutputPreset = { } const operationName = pascalCase(node.name.value); + const documentSDL = print(node); if (node.operation === OperationTypeNode.QUERY) { // Query @@ -243,11 +243,6 @@ export const preset: Types.OutputPreset = { } } ); - - console.log('*** after update:'); - console.log(tsSourceFile.getFullText()); - - console.log('END\n'); }); return tsSourceFiles.map((tsSourceFile) => ({ From e91fd535450d325e4ce68ddb5db15d445b7bf2b3 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Wed, 23 Jul 2025 23:59:43 +1000 Subject: [PATCH 19/37] Set up subscription test --- .../components/UserSubscription.ts | 16 ++++++ .../generated/hooks.generated.ts | 57 +++++++++++++++++++ .../operations/UserChanges.graphql | 6 ++ .../test-index-to-colocation/schema.graphqls | 4 ++ .../src/test-index-to-colocation/testSetup.ts | 19 +++++-- 5 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserSubscription.ts create mode 100644 packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/UserChanges.graphql diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserSubscription.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserSubscription.ts new file mode 100644 index 00000000..be1bc85c --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/components/UserSubscription.ts @@ -0,0 +1,16 @@ +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ +import { useSubscription } from '@apollo/client/react'; +import { graphql } from '../gql'; + +const UserChangesDoc = graphql(` + subscription UserChanges { + userChanges(id: "10") { + id + name + } + } +`); + +export const UserSubscription = () => { + useSubscription(UserChangesDoc, {}); +}; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts index 873a6ce6..53f54f37 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts @@ -49,6 +49,15 @@ export type QueryUserArgs = { id?: InputMaybe; }; +export type Subscription = { + __typename?: 'Subscription'; + userChanges?: Maybe; +}; + +export type SubscriptionUserChangesArgs = { + id?: InputMaybe; +}; + export type UpdateUserInput = { id: Scalars['ID']['input']; name: Scalars['String']['input']; @@ -85,6 +94,13 @@ export type UpdateUserMutation = { updateUser: { __typename?: 'User'; id: string; name: string }; }; +export type UserChangesSubscriptionVariables = Exact<{ [key: string]: never }>; + +export type UserChangesSubscription = { + __typename?: 'Subscription'; + userChanges?: { __typename?: 'User'; id: string; name: string } | null; +}; + export const MeDocument = gql` query Me { me { @@ -249,3 +265,44 @@ export type UpdateUserMutationOptions = Apollo.BaseMutationOptions< UpdateUserMutation, UpdateUserMutationVariables >; +export const UserChangesDocument = gql` + subscription UserChanges { + userChanges(id: "10") { + id + name + } + } +`; + +/** + * __useUserChangesSubscription__ + * + * To run a query within a React component, call `useUserChangesSubscription` and pass it any options that fit your needs. + * When your component renders, `useUserChangesSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useUserChangesSubscription({ + * variables: { + * }, + * }); + */ +export function useUserChangesSubscription( + baseOptions?: Apollo.SubscriptionHookOptions< + UserChangesSubscription, + UserChangesSubscriptionVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSubscription< + UserChangesSubscription, + UserChangesSubscriptionVariables + >(UserChangesDocument, options); +} +export type UserChangesSubscriptionHookResult = ReturnType< + typeof useUserChangesSubscription +>; +export type UserChangesSubscriptionResult = + Apollo.SubscriptionResult; diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/UserChanges.graphql b/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/UserChanges.graphql new file mode 100644 index 00000000..b91e55fc --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/UserChanges.graphql @@ -0,0 +1,6 @@ +subscription UserChanges { + userChanges(id: "10") { + id + name + } +} diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls b/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls index 73c30fdc..2b894ec5 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/schema.graphqls @@ -7,6 +7,10 @@ type Mutation { updateUser(input: UpdateUserInput!): User! } +type Subscription { + userChanges(id: ID): User +} + input UpdateUserInput { id: ID! name: String! diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts index 1d42dcfe..149e9877 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/testSetup.ts @@ -6,7 +6,7 @@ createTestSetup({ { file: 'components/MeComponent.lazy-query.ts', content: `import { useMeLazyQuery } from '../generated/hooks.generated'; - + export const MeComponent = () => { useMeLazyQuery(); return 'Me'; @@ -15,7 +15,7 @@ createTestSetup({ { file: 'components/MeComponent.query.ts', content: `import { useMeQuery } from '../generated/hooks.generated'; - + export const MeComponent = () => { useMeQuery({ skip: true }); return 'Me'; @@ -24,7 +24,7 @@ createTestSetup({ { file: 'components/MeComponent.suspense-query.ts', content: `import { useMeSuspenseQuery } from '../generated/hooks.generated'; - + export const MeComponent = () => { useMeSuspenseQuery(); return 'Me'; @@ -38,14 +38,21 @@ createTestSetup({ useMeSuspenseQuery, useUpdateUserMutation, } from '../generated/hooks.generated'; - + export const UserComponent = () => { useMeQuery({ onCompleted: () => {} }); const res = useMeSuspenseQuery(); useUpdateUserMutation(); return 'User'; - }; - `, + };`, + }, + { + file: 'components/UserSubscription.ts', + content: `import { useUserChangesSubscription } from '../generated/hooks.generated'; + + export const UserSubscription = () => { + useUserChangesSubscription({}); + };`, }, ], }); From d16c34eff3f6b8b14575616f765fdcc5e3a4c2f9 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Thu, 24 Jul 2025 00:14:59 +1000 Subject: [PATCH 20/37] Add TODO --- .../src/preset.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 43641b64..3cf1c2bb 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -1,10 +1,7 @@ import * as path from 'path'; import * as fs from 'fs'; import * as addPlugin from '@graphql-codegen/add'; -import { - type Types, - createNoopProfiler, -} from '@graphql-codegen/plugin-helpers'; +import type { Types } from '@graphql-codegen/plugin-helpers'; import { pascalCase } from 'change-case-all'; import { OperationTypeNode, print, visit } from 'graphql'; import { @@ -16,13 +13,22 @@ import { } from 'ts-morph'; import type { TypedPresetConfig } from './config'; +/** + * TODO + * 1. handle `artifactDirectoryType`: "relative" ✅ and "absolute" + * 2. warn if unable to handle documents e.g. not valid or anonymous + * 3. currently, make naive assumption that imports of the same name means they need to be replaced. We should check import module, but it's more complex + * 4. handle `migrationDestination`: "co-location" ✅ | "near-operation-file" + * 5. handle `library`: { importFrom: '@apollo/client' | '@apollo/client/react' } + * - Note: in theory we can allow migrating to other libraries. To achieve this, we will need to refactor away Apollo Client assumptions. + */ + export const preset: Types.OutputPreset = { buildGeneratesSection: async ({ baseOutputDir, schema, documents, presetConfig, - profiler = createNoopProfiler(), }) => { const absoluteTsConfigFilePath = path.join( cwd(), @@ -212,8 +218,10 @@ export const preset: Types.OutputPreset = { documentNodeName ); - // Remove import specifier of hooks, and if no specifiers left, remove the whole import declaration + // Remove import specifier of hooks... functionToReplace.importSpecifierNode.remove(); + + // and if no specifiers left, remove the whole import declaration if ( functionToReplace.importDeclarationNode.getNamedImports() .length === 0 @@ -221,7 +229,7 @@ export const preset: Types.OutputPreset = { functionToReplace.importDeclarationNode.remove(); } - // Add documentNode to file if it's not already there + // If documentNode is already added, do nothing, otherwise insert it if (addedDocMap[documentNodeName]) { return; } From d26442f2d8f29052926e5d6e5c015d303f1db77c Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Thu, 24 Jul 2025 23:05:08 +1000 Subject: [PATCH 21/37] Handle dynamic config for gqlTag and hook imports --- .../src/test-index-to-colocation/codegen.mts | 8 ++- .../src/config.ts | 57 ++++++++++++++++++- .../src/preset.ts | 35 ++++++------ 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts index a82b4822..aa4413dd 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts @@ -12,10 +12,14 @@ const config: CodegenConfig = { 'packages/operation-location-migration-e2e/src/test-index-to-colocation': defineConfig( { - artifactDirectory: './gql', - gqlTagName: 'graphql', tsConfigFilePath: 'packages/operation-location-migration-e2e/src/test-index-to-colocation/tsconfig.json', + gqlTag: { + name: 'graphql', + importFrom: './gql', + importType: 'relative', + }, + hooksImportFrom: '@apollo/client/react', }, { documents: diff --git a/packages/operation-location-migration/src/config.ts b/packages/operation-location-migration/src/config.ts index 4cde1706..ea2bca51 100644 --- a/packages/operation-location-migration/src/config.ts +++ b/packages/operation-location-migration/src/config.ts @@ -1,5 +1,58 @@ export interface TypedPresetConfig { - artifactDirectory: string; - gqlTagName: string; + /** + * Path to the TypeScript configuration file (tsconfig.json) used by the project. + * This is used to resolve TypeScript compilation settings and module resolution. + * + * @example + * ```typescript + * { + * tsConfigFilePath: './tsconfig.json' + * } + * ``` + */ tsConfigFilePath: string; + + /** + * Configuration for the GraphQL tag function used in your project. + * This defines how GraphQL queries are tagged and imported in your codebase. + */ + gqlTag: { + /** + * The name of the GraphQL tag function. + * + * @example 'gql' + * @example 'graphql' + */ + name: string; + + /** + * The module path from which the GraphQL tag function is imported. + * + * @example '@apollo/client' for Apollo Client + * @example 'graphql' for the graphql-tag library + */ + importFrom: string; + + /** + * Specifies whether the import path should be treated as absolute or relative. + * + * 'absolute': The import is treated as an absolute import + * @example `import { graphql } from 'src/gql'` + * @example `import { gql } from '@apollo/client'` + * + * 'relative': The import is treated as a relative file path from the preset base path. + * The preset automatically constructs the relative path to the import. + * @example `import { graphql }` from '../../gql'` + */ + importType: 'absolute' | 'relative'; + }; + + /** + * The module path from which GraphQL hooks are imported. + * This is typically the same as the GraphQL client library being used. + * + * @example '@apollo/client' for Apollo Client v3 + * @example '@apollo/client/react' for Apollo Client v4 + */ + hooksImportFrom: string; } diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 3cf1c2bb..c2b1ab34 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -14,13 +14,13 @@ import { import type { TypedPresetConfig } from './config'; /** - * TODO - * 1. handle `artifactDirectoryType`: "relative" ✅ and "absolute" - * 2. warn if unable to handle documents e.g. not valid or anonymous - * 3. currently, make naive assumption that imports of the same name means they need to be replaced. We should check import module, but it's more complex - * 4. handle `migrationDestination`: "co-location" ✅ | "near-operation-file" - * 5. handle `library`: { importFrom: '@apollo/client' | '@apollo/client/react' } - * - Note: in theory we can allow migrating to other libraries. To achieve this, we will need to refactor away Apollo Client assumptions. + * TODO: + * 1. Warn if unable to handle documents e.g. not valid or anonymous + * 2. Don't make naive assumption that imports of the same name means they need to be replaced. + * - We should check import module, but it's more complex + * 3. Handle `migrationDestination`: + * - ✅ "co-location" + * - [] "near-operation-file" */ export const preset: Types.OutputPreset = { @@ -37,10 +37,6 @@ export const preset: Types.OutputPreset = { if (!fs.existsSync(absoluteTsConfigFilePath)) { throw new Error('Requires tsconfig'); } - const gqlTagPath = path.posix.join( - baseOutputDir, - presetConfig.artifactDirectory - ); // FIXME: handle absolute path const tsProject = new Project({ tsConfigFilePath: absoluteTsConfigFilePath, @@ -187,18 +183,23 @@ export const preset: Types.OutputPreset = { // Codemod files to co-locate the document nodes tsSourceFile.addImportDeclaration({ - moduleSpecifier: '@apollo/client/react', // FIXME: option to import from different module + moduleSpecifier: presetConfig.hooksImportFrom, namedImports: fileMetadata.needsToImport.map((importName) => ({ name: importName, })), }); + const gqlTagModule = + presetConfig.gqlTag.importType === 'absolute' + ? presetConfig.gqlTag.importFrom + : path.posix.relative( + path.dirname(tsSourceFile.getFilePath()), // TODO: would this break in windows? + path.posix.join(baseOutputDir, presetConfig.gqlTag.importFrom) + ); + tsSourceFile.addImportDeclaration({ - moduleSpecifier: path.posix.relative( - path.dirname(tsSourceFile.getFilePath()), // TODO: would this break in windows? - gqlTagPath - ), // TODO: add relative path to codegen gql - namedImports: [{ name: presetConfig.gqlTagName }], + moduleSpecifier: gqlTagModule, + namedImports: [{ name: presetConfig.gqlTag.name }], }); const addedDocMap: Record = {}; From 761ec77afd69c63651ca884e1f1c3204062b4948 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Thu, 24 Jul 2025 23:25:49 +1000 Subject: [PATCH 22/37] Prepare for near-operation-file --- package.json | 1 + yarn.lock | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index ed3e1955..fedb7e82 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "@eslint/eslintrc": "3.3.1", "@graphql-codegen/add": "5.0.3", "@graphql-codegen/cli": "5.0.4", + "@graphql-codegen/near-operation-file-preset": "3.1.0", "@graphql-codegen/plugin-helpers": "5.1.0", "@graphql-codegen/schema-ast": "4.1.0", "@graphql-codegen/typescript": "4.1.3", diff --git a/yarn.lock b/yarn.lock index 20c57826..ff7dc1a1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1999,6 +1999,14 @@ "@graphql-codegen/plugin-helpers" "^5.0.3" tslib "~2.6.0" +"@graphql-codegen/add@^3.2.1": + version "3.2.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-3.2.3.tgz#f1ecee085987e7c21841edc4b1fd48877c663e1a" + integrity sha512-sQOnWpMko4JLeykwyjFTxnhqjd/3NOG2OyMuvK76Wnnwh8DRrNf2VEs2kmSvLl7MndMlOj7Kh5U154dVcvhmKQ== + dependencies: + "@graphql-codegen/plugin-helpers" "^3.1.1" + tslib "~2.4.0" + "@graphql-codegen/cli@5.0.4": version "5.0.4" resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-5.0.4.tgz#22a8fc492ff20028f236dda16ecd9f5bd9783c5a" @@ -2080,6 +2088,18 @@ auto-bind "~4.0.0" tslib "~2.6.0" +"@graphql-codegen/near-operation-file-preset@3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/near-operation-file-preset/-/near-operation-file-preset-3.1.0.tgz#5c60a9ec137bb78d83eeab39a97595a09ad6bd9a" + integrity sha512-sXIIi0BPP3IcARdzSztpE51oJTcGB67hi7ddBYfLinks/R/5aFG1Ry/J61707Kt+6Q5WhTnf5XAQUAqi6200yA== + dependencies: + "@graphql-codegen/add" "^3.2.1" + "@graphql-codegen/plugin-helpers" "^3.0.0" + "@graphql-codegen/visitor-plugin-common" "2.13.8" + "@graphql-tools/utils" "^10.0.0" + parse-filepath "^1.0.2" + tslib "^2.8.1" + "@graphql-codegen/plugin-helpers@5.1.0", "@graphql-codegen/plugin-helpers@^5.1.0": version "5.1.0" resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-5.1.0.tgz#5c4ace748b9761d082ec1a0c19a82047bacce553" @@ -2092,7 +2112,7 @@ lodash "~4.17.0" tslib "~2.6.0" -"@graphql-codegen/plugin-helpers@^3.0.0", "@graphql-codegen/plugin-helpers@^3.1.2": +"@graphql-codegen/plugin-helpers@^3.0.0", "@graphql-codegen/plugin-helpers@^3.1.1", "@graphql-codegen/plugin-helpers@^3.1.2": version "3.1.2" resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-3.1.2.tgz#69a2e91178f478ea6849846ade0a59a844d34389" integrity sha512-emOQiHyIliVOIjKVKdsI5MXj312zmRDwmHpyUTZMjfpvxq/UVAHUJIVdVf+lnjjrI+LXBTgMlTWTgHQfmICxjg== From 6f4c7c169314825198a29ac728d31e76d5b9c98b Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Thu, 24 Jul 2025 23:32:24 +1000 Subject: [PATCH 23/37] Update test setup --- .../project.json | 23 ++++-- .../src/test-index-to-colocation/codegen.mts | 11 +++ .../codegen.mts | 42 ++++++++++ .../components/Me/Me.generated.ts | 67 ++++++++++++++++ .../components/Me/Me.graphql | 5 ++ .../components/Me/Me.ts | 15 ++++ .../components/User.fragment.generated.ts | 15 ++++ .../components/User.fragment.graphql | 4 + .../components/User/User.generated.ts | 76 +++++++++++++++++++ .../components/User/User.graphql | 5 ++ .../components/User/User.ts | 15 ++++ .../components/types.generated.ts | 67 ++++++++++++++++ .../gql/index.ts | 1 + .../schema.graphqls | 22 ++++++ .../testSetup.ts | 22 ++++++ .../tsconfig.json | 9 +++ 16 files changed, 394 insertions(+), 5 deletions(-) create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/codegen.mts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.generated.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.graphql create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.generated.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.graphql create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.generated.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.graphql create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/types.generated.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/gql/index.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/schema.graphqls create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts create mode 100644 packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/tsconfig.json diff --git a/packages/operation-location-migration-e2e/project.json b/packages/operation-location-migration-e2e/project.json index 496bf671..d53c04e2 100644 --- a/packages/operation-location-migration-e2e/project.json +++ b/packages/operation-location-migration-e2e/project.json @@ -9,8 +9,10 @@ "executor": "nx:run-commands", "options": { "commands": [ - "nx test-setup operation-location-migration-e2e", + "nx test-setup operation-location-migration-e2e -c test-index-to-colocation", "nx graphql-codegen operation-location-migration-e2e --verbose -c test-index-to-colocation", + "nx test-setup operation-location-migration-e2e -c test-near-operation-file-to-colocation", + "nx graphql-codegen operation-location-migration-e2e --verbose -c test-near-operation-file-to-colocation", "OUTPUT_PATTERN=\"{projectRoot}/src/**/*.ts\" bash packages/testing-utils/bin/assert-e2e.sh" ], "parallel": false @@ -18,10 +20,18 @@ }, "test-setup": { "executor": "nx:run-commands", - "options": { - "commands": [ - "tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-index-to-colocation/testSetup.ts" - ] + "options": {}, + "configurations": { + "test-index-to-colocation": { + "commands": [ + "tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-index-to-colocation/testSetup.ts" + ] + }, + "test-near-operation-file-to-colocation": { + "commands": [ + "tsx --tsconfig={projectRoot}/tsconfig.json {projectRoot}/src/test-near-operation-file-to-colocation/testSetup.ts" + ] + } } }, "graphql-codegen": { @@ -30,6 +40,9 @@ "configurations": { "test-index-to-colocation": { "configFile": "{projectRoot}/src/test-index-to-colocation/codegen.mts" + }, + "test-near-operation-file-to-colocation": { + "configFile": "{projectRoot}/src/test-near-operation-file-to-colocation/codegen.mts" } }, "dependsOn": ["prepare-e2e-modules"] diff --git a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts index aa4413dd..b989837c 100644 --- a/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts +++ b/packages/operation-location-migration-e2e/src/test-index-to-colocation/codegen.mts @@ -9,6 +9,17 @@ const config: CodegenConfig = { afterAllFileWrite: ['prettier --write'], }, generates: { + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/generated/hooks.generated.ts': + { + documents: [ + 'packages/operation-location-migration-e2e/src/test-index-to-colocation/operations/*.graphql', + ], + plugins: [ + 'typescript', + 'typescript-operations', + 'typescript-react-apollo', + ], + }, 'packages/operation-location-migration-e2e/src/test-index-to-colocation': defineConfig( { diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/codegen.mts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/codegen.mts new file mode 100644 index 00000000..ab5f19f8 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/codegen.mts @@ -0,0 +1,42 @@ +import type { CodegenConfig } from '@graphql-codegen/cli'; +import { defineConfig } from '@eddeee888/gcg-operation-location-migration'; + +const config: CodegenConfig = { + schema: [ + 'packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/**/*.graphqls', + ], + documents: [ + 'packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/**/*.graphql', + ], + hooks: { + afterAllFileWrite: ['prettier --write'], + }, + generates: { + 'packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/': + { + preset: 'near-operation-file', + presetConfig: { + baseTypesPath: './types.generated.ts', + extension: '.generated.ts', + }, + plugins: ['typescript-operations', 'typescript-react-apollo'], + }, + 'packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/types.generated.ts': + { + plugins: ['typescript'], + }, + 'packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation': + defineConfig({ + tsConfigFilePath: + 'packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/tsconfig.json', + gqlTag: { + name: 'graphql', + importFrom: './gql', + importType: 'relative', + }, + hooksImportFrom: '@apollo/client', + }), + }, +}; + +export default config; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.generated.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.generated.ts new file mode 100644 index 00000000..9f196326 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.generated.ts @@ -0,0 +1,67 @@ +import * as Types from '../types.generated'; + +import { gql } from '@apollo/client'; +import { UserFragmentFragmentDoc } from '../User.fragment.generated'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MeQueryVariables = Types.Exact<{ [key: string]: never }>; + +export type MeQuery = { + __typename?: 'Query'; + me?: { __typename?: 'User'; id: string; name: string } | null; +}; + +export const MeDocument = gql` + query Me { + me { + ...UserFragment + } + } + ${UserFragmentFragmentDoc} +`; + +/** + * __useMeQuery__ + * + * To run a query within a React component, call `useMeQuery` and pass it any options that fit your needs. + * When your component renders, `useMeQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMeQuery({ + * variables: { + * }, + * }); + */ +export function useMeQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery(MeDocument, options); +} +export function useMeLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery(MeDocument, options); +} +export function useMeSuspenseQuery( + baseOptions?: + | Apollo.SkipToken + | Apollo.SuspenseQueryHookOptions +) { + const options = + baseOptions === Apollo.skipToken + ? baseOptions + : { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery( + MeDocument, + options + ); +} +export type MeQueryHookResult = ReturnType; +export type MeLazyQueryHookResult = ReturnType; +export type MeSuspenseQueryHookResult = ReturnType; +export type MeQueryResult = Apollo.QueryResult; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.graphql b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.graphql new file mode 100644 index 00000000..60e7cadd --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.graphql @@ -0,0 +1,5 @@ +query Me { + me { + ...UserFragment + } +} diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts new file mode 100644 index 00000000..e4b77c03 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts @@ -0,0 +1,15 @@ +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ +import { useQuery } from '@apollo/client'; +import { graphql } from '../../gql'; + +const MeDoc = graphql(` + query Me { + me { + ...UserFragment + } + } +`); + +export const Me = () => { + useQuery(MeDoc); +}; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.generated.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.generated.ts new file mode 100644 index 00000000..434a5a7c --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.generated.ts @@ -0,0 +1,15 @@ +import * as Types from './types.generated'; + +import { gql } from '@apollo/client'; +export type UserFragmentFragment = { + __typename?: 'User'; + id: string; + name: string; +}; + +export const UserFragmentFragmentDoc = gql` + fragment UserFragment on User { + id + name + } +`; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.graphql b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.graphql new file mode 100644 index 00000000..27f397df --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User.fragment.graphql @@ -0,0 +1,4 @@ +fragment UserFragment on User { + id + name +} diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.generated.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.generated.ts new file mode 100644 index 00000000..fd1dea6d --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.generated.ts @@ -0,0 +1,76 @@ +import * as Types from '../types.generated'; + +import { gql } from '@apollo/client'; +import { UserFragmentFragmentDoc } from '../User.fragment.generated'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type UserQueryVariables = Types.Exact<{ + id: Types.Scalars['ID']['input']; +}>; + +export type UserQuery = { + __typename?: 'Query'; + user?: { __typename?: 'User'; id: string; name: string } | null; +}; + +export const UserDocument = gql` + query User($id: ID!) { + user(id: $id) { + ...UserFragment + } + } + ${UserFragmentFragmentDoc} +`; + +/** + * __useUserQuery__ + * + * To run a query within a React component, call `useUserQuery` and pass it any options that fit your needs. + * When your component renders, `useUserQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useUserQuery({ + * variables: { + * id: // value for 'id' + * }, + * }); + */ +export function useUserQuery( + baseOptions: Apollo.QueryHookOptions & + ({ variables: UserQueryVariables; skip?: boolean } | { skip: boolean }) +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery(UserDocument, options); +} +export function useUserLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + UserDocument, + options + ); +} +export function useUserSuspenseQuery( + baseOptions?: + | Apollo.SkipToken + | Apollo.SuspenseQueryHookOptions +) { + const options = + baseOptions === Apollo.skipToken + ? baseOptions + : { ...defaultOptions, ...baseOptions }; + return Apollo.useSuspenseQuery( + UserDocument, + options + ); +} +export type UserQueryHookResult = ReturnType; +export type UserLazyQueryHookResult = ReturnType; +export type UserSuspenseQueryHookResult = ReturnType< + typeof useUserSuspenseQuery +>; +export type UserQueryResult = Apollo.QueryResult; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.graphql b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.graphql new file mode 100644 index 00000000..f0c866a8 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.graphql @@ -0,0 +1,5 @@ +query User($id: ID!) { + user(id: $id) { + ...UserFragment + } +} diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.ts new file mode 100644 index 00000000..3983501a --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/User/User.ts @@ -0,0 +1,15 @@ +/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ +import { useSuspenseQuery } from '@apollo/client'; +import { graphql } from '../../gql'; + +const UserDoc = graphql(` + query User($id: ID!) { + user(id: $id) { + ...UserFragment + } + } +`); + +export const Me = () => { + useSuspenseQuery(UserDoc); +}; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/types.generated.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/types.generated.ts new file mode 100644 index 00000000..5334a71b --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/types.generated.ts @@ -0,0 +1,67 @@ +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe; +}; +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe; +}; +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T +> = { [_ in K]?: never }; +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never; + }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; +}; + +export type Mutation = { + __typename?: 'Mutation'; + updateUser: User; +}; + +export type MutationUpdateUserArgs = { + input: UpdateUserInput; +}; + +export type Query = { + __typename?: 'Query'; + me?: Maybe; + user?: Maybe; +}; + +export type QueryUserArgs = { + id?: InputMaybe; +}; + +export type Subscription = { + __typename?: 'Subscription'; + userChanges?: Maybe; +}; + +export type SubscriptionUserChangesArgs = { + id?: InputMaybe; +}; + +export type UpdateUserInput = { + id: Scalars['ID']['input']; + name: Scalars['String']['input']; +}; + +export type User = { + __typename?: 'User'; + id: Scalars['ID']['output']; + name: Scalars['String']['output']; +}; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/gql/index.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/gql/index.ts new file mode 100644 index 00000000..10db86f0 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/gql/index.ts @@ -0,0 +1 @@ +export const graphql = (doc: string) => doc; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/schema.graphqls b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/schema.graphqls new file mode 100644 index 00000000..2b894ec5 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/schema.graphqls @@ -0,0 +1,22 @@ +type Query { + me: User + user(id: ID): User +} + +type Mutation { + updateUser(input: UpdateUserInput!): User! +} + +type Subscription { + userChanges(id: ID): User +} + +input UpdateUserInput { + id: ID! + name: String! +} + +type User { + id: ID! + name: String! +} diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts new file mode 100644 index 00000000..a04180d9 --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts @@ -0,0 +1,22 @@ +import { createTestSetup } from '@workspace/testing-utils'; + +createTestSetup({ + baseDir: __dirname, + files: [ + { + file: 'components/Me/Me.ts', + content: `import { useMeQuery } from './Me.generated'; + export const Me = () => { + useMeQuery(); + };`, + }, + { + file: 'components/User/User.ts', + content: `import { useUserSuspenseQuery } from './User.generated'; + + export const Me = () => { + useUserSuspenseQuery(); + };`, + }, + ], +}); diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/tsconfig.json b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/tsconfig.json new file mode 100644 index 00000000..324508ff --- /dev/null +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "rootDir": ".", + "baseUrl": ".", + "module": "commonjs", + "strict": true + }, + "include": ["./components/**/*.ts", "./gql/**/*.ts"] +} From 9d3a6081b0a6a9e577904e0fd4a20afc424858fe Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Thu, 24 Jul 2025 23:48:17 +1000 Subject: [PATCH 24/37] Add test setup to testdefault comment --- .../components/Me/Me.ts | 1 - .../testSetup.ts | 1 + .../operation-location-migration/src/preset.ts | 7 +++---- packages/testing-utils/src/createTestSetup.ts | 17 ++++++++++++----- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts index e4b77c03..1a3de13e 100644 --- a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/components/Me/Me.ts @@ -1,4 +1,3 @@ -/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */ import { useQuery } from '@apollo/client'; import { graphql } from '../../gql'; diff --git a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts index a04180d9..0641d0f8 100644 --- a/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts +++ b/packages/operation-location-migration-e2e/src/test-near-operation-file-to-colocation/testSetup.ts @@ -9,6 +9,7 @@ createTestSetup({ export const Me = () => { useMeQuery(); };`, + disableDefaultComment: true, }, { file: 'components/User/User.ts', diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index c2b1ab34..39073c11 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -239,10 +239,9 @@ export const preset: Types.OutputPreset = { const importDeclarations = tsSourceFile.getImportDeclarations(); const insertPos = importDeclarations[importDeclarations.length - 1].getEnd(); - const insertIndex = - tsSourceFile - .getStatements() - .findIndex((stmt) => stmt.getStart() > insertPos) + 1; + const insertIndex = tsSourceFile + .getStatementsWithComments() + .findIndex((stmt) => stmt.getStart() > insertPos); tsSourceFile.insertStatements(insertIndex, [ '\n', diff --git a/packages/testing-utils/src/createTestSetup.ts b/packages/testing-utils/src/createTestSetup.ts index e143982a..4f5457c0 100644 --- a/packages/testing-utils/src/createTestSetup.ts +++ b/packages/testing-utils/src/createTestSetup.ts @@ -6,26 +6,33 @@ export const createTestSetup = ({ files, }: { baseDir: string; - files: (string | { file: string; content: string })[]; + files: ( + | string + | { file: string; content: string; disableDefaultComment?: boolean } + )[]; }) => { try { files.forEach((item) => { let filename: string; let content = ''; + let disableDefaultComment = false; if (typeof item === 'string') { filename = path.join(baseDir, item); } else { filename = path.join(baseDir, item.file); content = item.content; + disableDefaultComment = item.disableDefaultComment; } const dir = path.dirname(filename); fs.mkdirSync(dir, { recursive: true }); - fs.writeFileSync( - filename, - `/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */\n\n${content}` - ); + if (!disableDefaultComment) { + fs.writeFileSync( + filename, + `/* This file has been created on filesystem by @workspace/testing-utils#createTestSetup */\n\n${content}` + ); + } }); } catch (err) { console.error(err); From 9eaae2b59ccf246334918088b79ce845200ad0bc Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Thu, 24 Jul 2025 23:59:14 +1000 Subject: [PATCH 25/37] Warn, not throw --- .../src/preset.ts | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/operation-location-migration/src/preset.ts b/packages/operation-location-migration/src/preset.ts index 39073c11..59ae486b 100644 --- a/packages/operation-location-migration/src/preset.ts +++ b/packages/operation-location-migration/src/preset.ts @@ -15,14 +15,12 @@ import type { TypedPresetConfig } from './config'; /** * TODO: - * 1. Warn if unable to handle documents e.g. not valid or anonymous - * 2. Don't make naive assumption that imports of the same name means they need to be replaced. - * - We should check import module, but it's more complex - * 3. Handle `migrationDestination`: - * - ✅ "co-location" - * - [] "near-operation-file" + * - Don't make naive assumption that imports of the same name means they need to be replaced. + * - Note: We should check import module, but it's more complex. So let's release first and look for feedback */ +const presetName = '@eddeee888/operation-location-migration'; + export const preset: Types.OutputPreset = { buildGeneratesSection: async ({ baseOutputDir, @@ -60,16 +58,24 @@ export const preset: Types.OutputPreset = { > = {}; documents.forEach((documentFile) => { - const documentPath = path.parse(documentFile.location || ''); + const documentFilename = documentFile.location || ''; + const documentPath = path.parse(documentFilename); if (!documentFile.document) { - throw new Error('Document does not exist!'); // FIXME: should not throw + console.warn( + `[${presetName}] Source does not have a valid DocumentNode: ${documentFilename}` + ); + return; } visit(documentFile.document, { OperationDefinition(node) { if (!node.name) { - throw new Error('Anonymous operation!'); // FIXME: should not throw + // Note: Codegen may fail, but we have this here just in case + console.warn( + `[${presetName}] Anonymous operation is not supported: ${documentFilename}` + ); + return; } const operationName = pascalCase(node.name.value); From bd6de9eb1de605201b0a3144585fc7d9ab9d4040 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 00:11:32 +1000 Subject: [PATCH 26/37] Set up CI for operation-location-migration --- .github/workflows/ci.yml | 4 ++ .../operation-location-migration.yml | 67 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 .github/workflows/operation-location-migration.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bdf403aa..5080a18e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,8 @@ jobs: outputs: affected-typescript-resolver-files: ${{ steps.affected.outputs.typescript-resolver-files }} affected-typescript-resolver-files-e2e: ${{ steps.affected.outputs.typescript-resolver-files-e2e }} + affected-operation-location-migration: ${{ steps.affected.outputs.operation-location-migration }} + affected-operation-location-migration-e2e: ${{ steps.affected.outputs.operation-location-migration-e2e }} steps: - name: Check out repository uses: actions/checkout@v4 @@ -37,6 +39,8 @@ jobs: run: | echo "typescript-resolver-files=$(./tools/ci/bin/check-affected.sh lib typescript-resolver-files origin/master)" >> $GITHUB_OUTPUT echo "typescript-resolver-files-e2e=$(./tools/ci/bin/check-affected.sh lib typescript-resolver-files-e2e origin/master)" >> $GITHUB_OUTPUT + echo "operation-location-migration=$(./tools/ci/bin/check-affected.sh lib operation-location-migration origin/master)" >> $GITHUB_OUTPUT + echo "operation-location-migration-e2e=$(./tools/ci/bin/check-affected.sh lib operation-location-migration-e2e origin/master)" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT typescript-resolver-files: diff --git a/.github/workflows/operation-location-migration.yml b/.github/workflows/operation-location-migration.yml new file mode 100644 index 00000000..5d1e3c09 --- /dev/null +++ b/.github/workflows/operation-location-migration.yml @@ -0,0 +1,67 @@ +on: + workflow_call: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + node-version: '22.x' + +jobs: + operation-location-migration: + strategy: + matrix: + os: [ubuntu-22.04, windows-latest] + node-version: [18.x, 20.x, 22.x] + runs-on: ${{ matrix.os }} + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + cache-dependency-path: '**/yarn.lock' + + - name: Install deps + run: yarn install --prefer-offline + + - name: Lint + run: yarn nx lint operation-location-migration + + - name: Test + run: yarn nx test operation-location-migration + + - name: Build + run: yarn nx build operation-location-migration + + operation-location-migration-e2e: + strategy: + matrix: + os: [ubuntu-22.04, windows-latest] + node-version: [18.x, 20.x, 22.x] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + cache-dependency-path: '**/yarn.lock' + + - name: Install deps + run: yarn install --prefer-offline + + - name: e2e + run: yarn nx e2e operation-location-migration-e2e From ae89f2b5c56174be16f4e623db3c85d778ba9afd Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 00:38:26 +1000 Subject: [PATCH 27/37] Add package README --- .../operation-location-migration/README.md | 121 +++++++++++++++++- 1 file changed, 115 insertions(+), 6 deletions(-) diff --git a/packages/operation-location-migration/README.md b/packages/operation-location-migration/README.md index 7f736a42..2d25e89a 100644 --- a/packages/operation-location-migration/README.md +++ b/packages/operation-location-migration/README.md @@ -1,11 +1,120 @@ -# gcg-operation-location-migration +# @eddeee888/gcg-operation-location-migration -This library was generated with [Nx](https://nx.dev). +This [GraphQL Code Generator](https://the-guild.dev/graphql/codegen) preset is a tool to migrate various operation and codegen style to the recommended Client Preset approach. -## Building +For example: -Run `nx build gcg-operation-location-migration` to build the library. +- From index-style to document node co-location +- From near-operation-file to document node co-location -## Running unit tests +## Installation -Run `nx test gcg-operation-location-migration` to execute the unit tests via [Jest](https://jestjs.io). +```sh +yarn add -D @eddeee888/gcg-operation-location-migration +``` + +## Usage + +This preset is a migration tool so you only need to run it once with codegen command. It may not catch all edge cases, so it is recommended to review the code changes to ensure nothing breaks. + +The general workflow has a few main steps: + +1. Add the migration preset to your Codegen config +2. Comment out other Codegen generates config +3. Run codegen +4. Remove old documents +5. Add [Client Preset](https://the-guild.dev/graphql/codegen/plugins/presets/preset-client) config + +### From index-style to document node co-location + +```ts +import type { CodegenConfig } from '@graphql-codegen/cli'; +import { defineConfig } from '@eddeee888/gcg-operation-location-migration'; + +const config: CodegenConfig = { + schema: 'src/**/*.graphqls', + documents: 'src/**/*.graphql', + generates: { + /* + * Example of index-style generation where all types and hooks go to one file. + * Once migrated, you can remove this completely + */ + // 'src/generated/types-and-hooks.ts': { + // plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'], + // }, + + 'src/': defineConfig({ + tsConfigFilePath: 'path-to-your/tsconfig.json', + gqlTag: { + name: 'graphql', + importFrom: './gql', + importType: 'relative', + }, + hooksImportFrom: '@apollo/client/react', // Use @apollo/client for v3 + }), + }, +}; + +export default config; +``` + +### From near-operation-file to document node co-location + +```ts +import type { CodegenConfig } from '@graphql-codegen/cli'; +import { defineConfig } from '@eddeee888/gcg-operation-location-migration'; + +const config: CodegenConfig = { + schema: 'src/**/*.graphqls', + documents: 'src/**/*.graphql', + generates: { + /* + * Example of near-operation-file generation where hooks are generated next to the operation file. + * Once migrated, you can remove this completely + */ + // 'src/graphql/types.generated.ts': { + // plugins: ['typescript'], + // }, + // './src/': { + // preset: 'near-operation-file', + // presetConfig: { + // baseTypesPath: './graphql/types.generated.ts', + // extension: '.generated.ts', + // }, + // plugins: ['typescript-operations', 'typescript-react-apollo'], + // }, + + 'src/': defineConfig({ + tsConfigFilePath: 'path-to-your/tsconfig.json', + gqlTag: { + name: 'graphql', + importFrom: './gql', + importType: 'relative', + }, + hooksImportFrom: '@apollo/client/react', // Use @apollo/client for v3 + }), + }, +}; + +export default config; +``` + +### Switching to Client Preset + +Once done, you can easily switch to Client Preset as everything should be in the right place: + +```ts +import type { CodegenConfig } from '@graphql-codegen/cli'; + +const config: CodegenConfig = { + schema: 'src/**/*.graphqls', + documents: 'src/**/*.tsx', // 👈 Your documents should be in your components, so this is updated to target them. + generates: { + 'src/gql': { + preset: 'client', + }, + }, +}; + +export default config; +``` From fe1572a23f194909a058fde71978af41c04c3eda Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 00:39:11 +1000 Subject: [PATCH 28/37] Add changeset --- .changeset/curvy-dolls-dream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/curvy-dolls-dream.md diff --git a/.changeset/curvy-dolls-dream.md b/.changeset/curvy-dolls-dream.md new file mode 100644 index 00000000..2bcfc99d --- /dev/null +++ b/.changeset/curvy-dolls-dream.md @@ -0,0 +1,5 @@ +--- +'@eddeee888/gcg-operation-location-migration': patch +--- + +Add base preset to migrate to co-location and Server Preset From 8a2c2de7cdba1be022b363b07e2fb2950276a2b5 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 00:42:40 +1000 Subject: [PATCH 29/37] Update package.json --- packages/operation-location-migration/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index ec3410f7..4658843c 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -6,8 +6,8 @@ "main": "./src/index.js", "types": "./src/index.d.ts", "dependencies": { - "@graphql-codegen/add": "5.0.3", - "@graphql-codegen/plugin-helpers": "5.1.0", + "@graphql-codegen/add": "^5.0.3", + "@graphql-codegen/plugin-helpers": "^5.1.0", "@swc/helpers": "~0.5.11", "change-case-all": "^1.0.0", "graphql": "^16.0.0", From ef9c0cc1666e500590db7ad8e732e48761a474aa Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 01:07:48 +1000 Subject: [PATCH 30/37] Allow publishing --- packages/operation-location-migration/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index 4658843c..30beac13 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -1,7 +1,6 @@ { "name": "@eddeee888/gcg-operation-location-migration", "version": "0.0.1", - "private": true, "type": "commonjs", "main": "./src/index.js", "types": "./src/index.d.ts", From 6888105b093660537b08510f2a0ffa3729855ba9 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 01:13:53 +1000 Subject: [PATCH 31/37] Update package.json publish config --- packages/operation-location-migration/package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index 30beac13..1bf76226 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -11,5 +11,8 @@ "change-case-all": "^1.0.0", "graphql": "^16.0.0", "ts-morph": "^22.0.0" + }, + "publishConfig": { + "directory": "../../dist/packages/operation-location-migration" } } From 963b496a1df898606b8e28adc5887a0bf8744492 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 01:24:55 +1000 Subject: [PATCH 32/37] Finalise --- .../operation-location-migration/README.md | 2 +- .../operation-location-migration/package.json | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/operation-location-migration/README.md b/packages/operation-location-migration/README.md index 2d25e89a..02c050ab 100644 --- a/packages/operation-location-migration/README.md +++ b/packages/operation-location-migration/README.md @@ -110,7 +110,7 @@ const config: CodegenConfig = { schema: 'src/**/*.graphqls', documents: 'src/**/*.tsx', // 👈 Your documents should be in your components, so this is updated to target them. generates: { - 'src/gql': { + 'src/gql/': { preset: 'client', }, }, diff --git a/packages/operation-location-migration/package.json b/packages/operation-location-migration/package.json index 1bf76226..6b460d40 100644 --- a/packages/operation-location-migration/package.json +++ b/packages/operation-location-migration/package.json @@ -1,6 +1,23 @@ { "name": "@eddeee888/gcg-operation-location-migration", - "version": "0.0.1", + "version": "0.0.0", + "repository": { + "type": "git", + "url": "https://github.com/eddeee888/graphql-code-generator-plugins.git", + "directory": "packages/operation-location-migration" + }, + "homepage": "https://github.com/eddeee888/graphql-code-generator-plugins/blob/master/packages/operation-location-migration/README.md", + "keywords": [ + "plugins", + "graphql", + "code", + "generator", + "preset", + "codegen", + "codemod" + ], + "author": "Eddy Nguyen ", + "license": "MIT", "type": "commonjs", "main": "./src/index.js", "types": "./src/index.d.ts", From 66bebfe696c177256aef062da523cef57de6c3f6 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 21:30:22 +1000 Subject: [PATCH 33/37] Update e2e README --- packages/operation-location-migration-e2e/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/operation-location-migration-e2e/README.md b/packages/operation-location-migration-e2e/README.md index 657b049c..d9803507 100644 --- a/packages/operation-location-migration-e2e/README.md +++ b/packages/operation-location-migration-e2e/README.md @@ -1,5 +1,5 @@ # operation-location-migration-e2e ```bash -nx graphql-codegen operation-location-migration-e2e -c test-arbitrary-to-colocation +nx e2e operation-location-migration-e2e ``` From fe121838a3a8c427ffea01268fd4b7c418f0ef15 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 21:49:14 +1000 Subject: [PATCH 34/37] Test CI --- .../operation-location-migration.yml | 97 ++++++++++--------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/.github/workflows/operation-location-migration.yml b/.github/workflows/operation-location-migration.yml index 5d1e3c09..f6bac5bf 100644 --- a/.github/workflows/operation-location-migration.yml +++ b/.github/workflows/operation-location-migration.yml @@ -9,59 +9,64 @@ env: node-version: '22.x' jobs: - operation-location-migration: - strategy: - matrix: - os: [ubuntu-22.04, windows-latest] - node-version: [18.x, 20.x, 22.x] - runs-on: ${{ matrix.os }} + test-workflow: + runs-on: ubuntu-22.04 steps: - - name: Check out repository - uses: actions/checkout@v4 + - name: Test + run: echo "READY" + # operation-location-migration: + # strategy: + # matrix: + # os: [ubuntu-22.04, windows-latest] + # node-version: [18.x, 20.x, 22.x] + # runs-on: ${{ matrix.os }} + # steps: + # - name: Check out repository + # uses: actions/checkout@v4 - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: yarn - cache-dependency-path: '**/yarn.lock' + # - name: Set up Node.js ${{ matrix.node-version }} + # uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node-version }} + # cache: yarn + # cache-dependency-path: '**/yarn.lock' - - name: Install deps - run: yarn install --prefer-offline + # - name: Install deps + # run: yarn install --prefer-offline - - name: Lint - run: yarn nx lint operation-location-migration + # - name: Lint + # run: yarn nx lint operation-location-migration - - name: Test - run: yarn nx test operation-location-migration + # - name: Test + # run: yarn nx test operation-location-migration - - name: Build - run: yarn nx build operation-location-migration + # - name: Build + # run: yarn nx build operation-location-migration - operation-location-migration-e2e: - strategy: - matrix: - os: [ubuntu-22.04, windows-latest] - node-version: [18.x, 20.x, 22.x] - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # operation-location-migration-e2e: + # strategy: + # matrix: + # os: [ubuntu-22.04, windows-latest] + # node-version: [18.x, 20.x, 22.x] + # runs-on: ${{ matrix.os }} + # defaults: + # run: + # shell: bash + # steps: + # - name: Check out repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: yarn - cache-dependency-path: '**/yarn.lock' + # - name: Set up Node.js ${{ matrix.node-version }} + # uses: actions/setup-node@v4 + # with: + # node-version: ${{ matrix.node-version }} + # cache: yarn + # cache-dependency-path: '**/yarn.lock' - - name: Install deps - run: yarn install --prefer-offline + # - name: Install deps + # run: yarn install --prefer-offline - - name: e2e - run: yarn nx e2e operation-location-migration-e2e + # - name: e2e + # run: yarn nx e2e operation-location-migration-e2e From de033924a195d100edcaa2aead1926a5e057ab55 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 21:57:40 +1000 Subject: [PATCH 35/37] Shuffle job location --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5080a18e..f53dfa49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,11 @@ jobs: echo "operation-location-migration-e2e=$(./tools/ci/bin/check-affected.sh lib operation-location-migration-e2e origin/master)" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT + start-operation-location-migration: + needs: precheck + if: ${{ needs.precheck.outputs.affected-operation-location-migration == 'true' || needs.precheck.outputs.affected-operation-location-migration-e2e == 'true' }} + uses: ./.github/workflows/operation-location-migration.yml + typescript-resolver-files: needs: precheck if: ${{ needs.precheck.outputs.affected-typescript-resolver-files == 'true' }} From 7d7b09a3347b9c78523c7cc579c5ab6049e1da67 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 22:44:09 +1000 Subject: [PATCH 36/37] Fix sub-workflow for operation-location-migration --- .github/workflows/ci.yml | 19 +++-- .../operation-location-migration.yml | 72 ------------------- .../operation-location-migration-e2e.yml | 34 +++++++++ .../projects/operation-location-migration.yml | 35 +++++++++ .../typescript-resolver-files-e2e.yml | 0 .../typescript-resolver-files.yml | 0 6 files changed, 81 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/operation-location-migration.yml create mode 100644 .github/workflows/projects/operation-location-migration-e2e.yml create mode 100644 .github/workflows/projects/operation-location-migration.yml rename .github/workflows/{ => projects}/typescript-resolver-files-e2e.yml (100%) rename .github/workflows/{ => projects}/typescript-resolver-files.yml (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f53dfa49..f8cd8901 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,17 +43,22 @@ jobs: echo "operation-location-migration-e2e=$(./tools/ci/bin/check-affected.sh lib operation-location-migration-e2e origin/master)" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT - start-operation-location-migration: - needs: precheck - if: ${{ needs.precheck.outputs.affected-operation-location-migration == 'true' || needs.precheck.outputs.affected-operation-location-migration-e2e == 'true' }} - uses: ./.github/workflows/operation-location-migration.yml - typescript-resolver-files: needs: precheck if: ${{ needs.precheck.outputs.affected-typescript-resolver-files == 'true' }} - uses: ./.github/workflows/typescript-resolver-files.yml + uses: ./.github/workflows/projects/typescript-resolver-files.yml typescript-resolver-files-e2e: needs: precheck if: ${{ needs.precheck.outputs.affected-typescript-resolver-files == 'true' || needs.precheck.outputs.affected-typescript-resolver-files-e2e == 'true' }} - uses: ./.github/workflows/typescript-resolver-files-e2e.yml + uses: ./.github/workflows/projects/typescript-resolver-files-e2e.yml + + operation-location-migration: + needs: precheck + if: ${{ needs.precheck.outputs.affected-operation-location-migration == 'true' }} + uses: ./.github/workflows/projects/operation-location-migration.yml + + operation-location-migration-e2e: + needs: precheck + if: ${{ needs.precheck.outputs.affected-operation-location-migration == 'true' || needs.precheck.outputs.affected-operation-location-migration-e2e == 'true' }} + uses: ./.github/workflows/projects/operation-location-migration-e2e.yml diff --git a/.github/workflows/operation-location-migration.yml b/.github/workflows/operation-location-migration.yml deleted file mode 100644 index f6bac5bf..00000000 --- a/.github/workflows/operation-location-migration.yml +++ /dev/null @@ -1,72 +0,0 @@ -on: - workflow_call: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - node-version: '22.x' - -jobs: - test-workflow: - runs-on: ubuntu-22.04 - steps: - - name: Test - run: echo "READY" - # operation-location-migration: - # strategy: - # matrix: - # os: [ubuntu-22.04, windows-latest] - # node-version: [18.x, 20.x, 22.x] - # runs-on: ${{ matrix.os }} - # steps: - # - name: Check out repository - # uses: actions/checkout@v4 - - # - name: Set up Node.js ${{ matrix.node-version }} - # uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node-version }} - # cache: yarn - # cache-dependency-path: '**/yarn.lock' - - # - name: Install deps - # run: yarn install --prefer-offline - - # - name: Lint - # run: yarn nx lint operation-location-migration - - # - name: Test - # run: yarn nx test operation-location-migration - - # - name: Build - # run: yarn nx build operation-location-migration - - # operation-location-migration-e2e: - # strategy: - # matrix: - # os: [ubuntu-22.04, windows-latest] - # node-version: [18.x, 20.x, 22.x] - # runs-on: ${{ matrix.os }} - # defaults: - # run: - # shell: bash - # steps: - # - name: Check out repository - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - - # - name: Set up Node.js ${{ matrix.node-version }} - # uses: actions/setup-node@v4 - # with: - # node-version: ${{ matrix.node-version }} - # cache: yarn - # cache-dependency-path: '**/yarn.lock' - - # - name: Install deps - # run: yarn install --prefer-offline - - # - name: e2e - # run: yarn nx e2e operation-location-migration-e2e diff --git a/.github/workflows/projects/operation-location-migration-e2e.yml b/.github/workflows/projects/operation-location-migration-e2e.yml new file mode 100644 index 00000000..7b4ab45b --- /dev/null +++ b/.github/workflows/projects/operation-location-migration-e2e.yml @@ -0,0 +1,34 @@ +on: + workflow_call: + +env: + node-version: '22.x' + +jobs: + operation-location-migration-e2e: + strategy: + matrix: + os: [ubuntu-22.04, windows-latest] + node-version: [18.x, 20.x, 22.x] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + cache-dependency-path: '**/yarn.lock' + + - name: Install deps + run: yarn install --prefer-offline + + - name: e2e + run: yarn nx e2e operation-location-migration-e2e diff --git a/.github/workflows/projects/operation-location-migration.yml b/.github/workflows/projects/operation-location-migration.yml new file mode 100644 index 00000000..ed3d19dc --- /dev/null +++ b/.github/workflows/projects/operation-location-migration.yml @@ -0,0 +1,35 @@ +on: + workflow_call: + +env: + node-version: '22.x' + +jobs: + operation-location-migration: + strategy: + matrix: + os: [ubuntu-22.04, windows-latest] + node-version: [18.x, 20.x, 22.x] + runs-on: ${{ matrix.os }} + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: yarn + cache-dependency-path: '**/yarn.lock' + + - name: Install deps + run: yarn install --prefer-offline + + - name: Lint + run: yarn nx lint operation-location-migration + + - name: Test + run: yarn nx test operation-location-migration + + - name: Build + run: yarn nx build operation-location-migration diff --git a/.github/workflows/typescript-resolver-files-e2e.yml b/.github/workflows/projects/typescript-resolver-files-e2e.yml similarity index 100% rename from .github/workflows/typescript-resolver-files-e2e.yml rename to .github/workflows/projects/typescript-resolver-files-e2e.yml diff --git a/.github/workflows/typescript-resolver-files.yml b/.github/workflows/projects/typescript-resolver-files.yml similarity index 100% rename from .github/workflows/typescript-resolver-files.yml rename to .github/workflows/projects/typescript-resolver-files.yml From d255f492e2c0b5437288db94603bc4edb1823513 Mon Sep 17 00:00:00 2001 From: Eddy Nguyen Date: Fri, 25 Jul 2025 22:59:05 +1000 Subject: [PATCH 37/37] Disable windows for now --- .github/workflows/projects/operation-location-migration-e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/projects/operation-location-migration-e2e.yml b/.github/workflows/projects/operation-location-migration-e2e.yml index 7b4ab45b..d34c62f5 100644 --- a/.github/workflows/projects/operation-location-migration-e2e.yml +++ b/.github/workflows/projects/operation-location-migration-e2e.yml @@ -8,7 +8,7 @@ jobs: operation-location-migration-e2e: strategy: matrix: - os: [ubuntu-22.04, windows-latest] + os: [ubuntu-22.04] # TODO: test with windows node-version: [18.x, 20.x, 22.x] runs-on: ${{ matrix.os }} defaults: