diff --git a/.github/workflows/test-codegen.yml b/.github/workflows/test-codegen.yml index a0760ee0f8..e34da8699d 100644 --- a/.github/workflows/test-codegen.yml +++ b/.github/workflows/test-codegen.yml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: RTK-Query OpenAPI Codegen Tests +name: RTKQ OpenAPI Codegen defaults: run: working-directory: ./packages/rtk-query-codegen-openapi @@ -23,24 +23,94 @@ jobs: codegen: - 'packages/rtk-query-codegen-openapi/**' - 'yarn.lock' + - '.github/workflows/test-codegen.yml' build: needs: changes if: ${{ needs.changes.outputs.codegen == 'true' }} - runs-on: ubuntu-latest + defaults: + run: + working-directory: ./packages/rtk-query-codegen-openapi + + runs-on: ${{ matrix.os }} + + name: Build artifact for ${{ matrix.os }} with Node ${{ matrix.node-version }} strategy: matrix: node-version: ['20.x'] + os: [ubuntu-latest] steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node ${{ matrix.node-version }} uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node }} + node-version: ${{ matrix.node-version }} cache: 'yarn' - - run: yarn install - - run: yarn test + - name: Install dependencies + run: yarn install + + - name: Pack + run: yarn pack + + - name: Upload artifact + uses: actions/upload-artifact@v4 + id: artifact-upload-step + with: + name: package + path: ./packages/rtk-query-codegen-openapi/package.tgz + + - name: Did we fail? + if: failure() + run: ls -R + + test: + needs: build + defaults: + run: + working-directory: ./packages/rtk-query-codegen-openapi + name: Test final build artifact with Node.js ${{ matrix.node-version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + node-version: [20.x] + os: [ubuntu-latest] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Download artifact + id: download-artifact + uses: actions/download-artifact@v4 + with: + path: ./packages/rtk-query-codegen-openapi + name: package + + - name: Install dependencies + run: yarn install + + - name: Install build artifact + run: yarn add ./package.tgz + + - name: Remove path alias + run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.json + + - name: Run tests + run: yarn test + + - name: Did we fail? + if: failure() + run: ls -R diff --git a/packages/rtk-query-codegen-openapi/package.json b/packages/rtk-query-codegen-openapi/package.json index 8e33b4d51a..f959a5a18b 100644 --- a/packages/rtk-query-codegen-openapi/package.json +++ b/packages/rtk-query-codegen-openapi/package.json @@ -17,13 +17,13 @@ "rtk-query-codegen-openapi": "lib/bin/cli.js" }, "scripts": { - "build": "yarn clean && tsc && chmod +x lib/bin/cli.js", + "build": "yarn clean && tsc -p tsconfig.build.json && chmod +x lib/bin/cli.js", "clean": "rimraf lib", - "prepare": "yarn build && chmod +x lib/bin/cli.js", + "prepack": "yarn build", "format": "prettier --write \"src/**/*.ts\"", "test:update": "vitest --run --update", "test:update:enum": "lib/bin/cli.js test/config.example.enum.ts", - "test": "vitest --run", + "test": "vitest --run --typecheck", "test:watch": "vitest --watch", "cli": "esr src/bin/cli.ts" }, @@ -35,6 +35,7 @@ "@babel/core": "^7.12.10", "@babel/preset-env": "^7.12.11", "@babel/preset-typescript": "^7.12.7", + "@oazapfts/runtime": "^1.0.3", "@reduxjs/toolkit": "^1.6.0", "@types/commander": "^2.12.2", "@types/glob-to-regexp": "^0.4.0", @@ -43,7 +44,7 @@ "@types/semver": "^7.3.9", "chalk": "^4.1.0", "del": "^6.0.0", - "esbuild": "~0.17", + "esbuild": "^0.23.1", "esbuild-runner": "^2.2.1", "husky": "^4.3.6", "msw": "^2.1.5", @@ -52,7 +53,8 @@ "pretty-quick": "^4.0.0", "rimraf": "^5.0.5", "ts-node": "^10.9.2", - "vitest": "^1.6.0", + "vite-tsconfig-paths": "^5.0.1", + "vitest": "^2.0.5", "yalc": "^1.0.0-pre.47" }, "dependencies": { diff --git a/packages/rtk-query-codegen-openapi/test/__snapshots__/generateEndpoints.test.ts.snap b/packages/rtk-query-codegen-openapi/test/__snapshots__/generateEndpoints.test.ts.snap index 3901adce96..82d9379c44 100644 --- a/packages/rtk-query-codegen-openapi/test/__snapshots__/generateEndpoints.test.ts.snap +++ b/packages/rtk-query-codegen-openapi/test/__snapshots__/generateEndpoints.test.ts.snap @@ -1,5 +1,451 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`CLI options testing > generation with \`config.example.js\` 1`] = ` +"import { api } from '../fixtures/emptyApi'; +const injectedRtkApi = api.injectEndpoints({ + endpoints: (build) => ({ + updatePet: build.mutation({ + query: (queryArg) => ({ url: \`/pet\`, method: 'PUT', body: queryArg.pet }), + }), + addPet: build.mutation({ + query: (queryArg) => ({ url: \`/pet\`, method: 'POST', body: queryArg.pet }), + }), + findPetsByStatus: build.query({ + query: (queryArg) => ({ url: \`/pet/findByStatus\`, params: { status: queryArg.status } }), + }), + findPetsByTags: build.query({ + query: (queryArg) => ({ url: \`/pet/findByTags\`, params: { tags: queryArg.tags } }), + }), + getPetById: build.query({ + query: (queryArg) => ({ url: \`/pet/\${queryArg.petId}\` }), + }), + updatePetWithForm: build.mutation({ + query: (queryArg) => ({ + url: \`/pet/\${queryArg.petId}\`, + method: 'POST', + params: { name: queryArg.name, status: queryArg.status }, + }), + }), + deletePet: build.mutation({ + query: (queryArg) => ({ url: \`/pet/\${queryArg.petId}\`, method: 'DELETE', headers: { api_key: queryArg.apiKey } }), + }), + uploadFile: build.mutation({ + query: (queryArg) => ({ + url: \`/pet/\${queryArg.petId}/uploadImage\`, + method: 'POST', + body: queryArg.body, + params: { additionalMetadata: queryArg.additionalMetadata }, + }), + }), + getInventory: build.query({ + query: () => ({ url: \`/store/inventory\` }), + }), + placeOrder: build.mutation({ + query: (queryArg) => ({ url: \`/store/order\`, method: 'POST', body: queryArg.order }), + }), + getOrderById: build.query({ + query: (queryArg) => ({ url: \`/store/order/\${queryArg.orderId}\` }), + }), + deleteOrder: build.mutation({ + query: (queryArg) => ({ url: \`/store/order/\${queryArg.orderId}\`, method: 'DELETE' }), + }), + createUser: build.mutation({ + query: (queryArg) => ({ url: \`/user\`, method: 'POST', body: queryArg.user }), + }), + createUsersWithListInput: build.mutation({ + query: (queryArg) => ({ url: \`/user/createWithList\`, method: 'POST', body: queryArg.body }), + }), + loginUser: build.query({ + query: (queryArg) => ({ + url: \`/user/login\`, + params: { username: queryArg.username, password: queryArg.password }, + }), + }), + logoutUser: build.query({ + query: () => ({ url: \`/user/logout\` }), + }), + getUserByName: build.query({ + query: (queryArg) => ({ url: \`/user/\${queryArg.username}\` }), + }), + updateUser: build.mutation({ + query: (queryArg) => ({ url: \`/user/\${queryArg.username}\`, method: 'PUT', body: queryArg.user }), + }), + deleteUser: build.mutation({ + query: (queryArg) => ({ url: \`/user/\${queryArg.username}\`, method: 'DELETE' }), + }), + }), + overrideExisting: false, +}); +export { injectedRtkApi as enhancedApi }; +export type UpdatePetApiResponse = /** status 200 Successful operation */ Pet; +export type UpdatePetApiArg = { + /** Update an existent pet in the store */ + pet: Pet; +}; +export type AddPetApiResponse = /** status 200 Successful operation */ Pet; +export type AddPetApiArg = { + /** Create a new pet in the store */ + pet: Pet; +}; +export type FindPetsByStatusApiResponse = /** status 200 successful operation */ Pet[]; +export type FindPetsByStatusApiArg = { + /** Status values that need to be considered for filter */ + status?: 'available' | 'pending' | 'sold'; +}; +export type FindPetsByTagsApiResponse = /** status 200 successful operation */ Pet[]; +export type FindPetsByTagsApiArg = { + /** Tags to filter by */ + tags?: string[]; +}; +export type GetPetByIdApiResponse = /** status 200 successful operation */ Pet; +export type GetPetByIdApiArg = { + /** ID of pet to return */ + petId: number; +}; +export type UpdatePetWithFormApiResponse = unknown; +export type UpdatePetWithFormApiArg = { + /** ID of pet that needs to be updated */ + petId: number; + /** Name of pet that needs to be updated */ + name?: string; + /** Status of pet that needs to be updated */ + status?: string; +}; +export type DeletePetApiResponse = unknown; +export type DeletePetApiArg = { + apiKey?: string; + /** Pet id to delete */ + petId: number; +}; +export type UploadFileApiResponse = /** status 200 successful operation */ ApiResponse; +export type UploadFileApiArg = { + /** ID of pet to update */ + petId: number; + /** Additional Metadata */ + additionalMetadata?: string; + body: Blob; +}; +export type GetInventoryApiResponse = /** status 200 successful operation */ { + [key: string]: number; +}; +export type GetInventoryApiArg = void; +export type PlaceOrderApiResponse = /** status 200 successful operation */ Order; +export type PlaceOrderApiArg = { + order: Order; +}; +export type GetOrderByIdApiResponse = /** status 200 successful operation */ Order; +export type GetOrderByIdApiArg = { + /** ID of order that needs to be fetched */ + orderId: number; +}; +export type DeleteOrderApiResponse = unknown; +export type DeleteOrderApiArg = { + /** ID of the order that needs to be deleted */ + orderId: number; +}; +export type CreateUserApiResponse = unknown; +export type CreateUserApiArg = { + /** Created user object */ + user: User; +}; +export type CreateUsersWithListInputApiResponse = /** status 200 Successful operation */ User; +export type CreateUsersWithListInputApiArg = { + body: User[]; +}; +export type LoginUserApiResponse = /** status 200 successful operation */ string; +export type LoginUserApiArg = { + /** The user name for login */ + username?: string; + /** The password for login in clear text */ + password?: string; +}; +export type LogoutUserApiResponse = unknown; +export type LogoutUserApiArg = void; +export type GetUserByNameApiResponse = /** status 200 successful operation */ User; +export type GetUserByNameApiArg = { + /** The name that needs to be fetched. Use user1 for testing. */ + username: string; +}; +export type UpdateUserApiResponse = unknown; +export type UpdateUserApiArg = { + /** name that need to be deleted */ + username: string; + /** Update an existent user in the store */ + user: User; +}; +export type DeleteUserApiResponse = unknown; +export type DeleteUserApiArg = { + /** The name that needs to be deleted */ + username: string; +}; +export type Category = { + id?: number; + name?: string; +}; +export type Tag = { + id?: number; + name?: string; +}; +export type Pet = { + id?: number; + name: string; + category?: Category; + photoUrls: string[]; + tags?: Tag[]; + /** pet status in the store */ + status?: 'available' | 'pending' | 'sold'; +}; +export type ApiResponse = { + code?: number; + type?: string; + message?: string; +}; +export type Order = { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; + /** Order Status */ + status?: 'placed' | 'approved' | 'delivered'; + complete?: boolean; +}; +export type User = { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + /** User Status */ + userStatus?: number; +}; +" +`; + +exports[`CLI options testing > paths are relative to config file, not to cwd 1`] = ` +"import { api } from '../fixtures/emptyApi'; +const injectedRtkApi = api.injectEndpoints({ + endpoints: (build) => ({ + updatePet: build.mutation({ + query: (queryArg) => ({ url: \`/pet\`, method: 'PUT', body: queryArg.pet }), + }), + addPet: build.mutation({ + query: (queryArg) => ({ url: \`/pet\`, method: 'POST', body: queryArg.pet }), + }), + findPetsByStatus: build.query({ + query: (queryArg) => ({ url: \`/pet/findByStatus\`, params: { status: queryArg.status } }), + }), + findPetsByTags: build.query({ + query: (queryArg) => ({ url: \`/pet/findByTags\`, params: { tags: queryArg.tags } }), + }), + getPetById: build.query({ + query: (queryArg) => ({ url: \`/pet/\${queryArg.petId}\` }), + }), + updatePetWithForm: build.mutation({ + query: (queryArg) => ({ + url: \`/pet/\${queryArg.petId}\`, + method: 'POST', + params: { name: queryArg.name, status: queryArg.status }, + }), + }), + deletePet: build.mutation({ + query: (queryArg) => ({ url: \`/pet/\${queryArg.petId}\`, method: 'DELETE', headers: { api_key: queryArg.apiKey } }), + }), + uploadFile: build.mutation({ + query: (queryArg) => ({ + url: \`/pet/\${queryArg.petId}/uploadImage\`, + method: 'POST', + body: queryArg.body, + params: { additionalMetadata: queryArg.additionalMetadata }, + }), + }), + getInventory: build.query({ + query: () => ({ url: \`/store/inventory\` }), + }), + placeOrder: build.mutation({ + query: (queryArg) => ({ url: \`/store/order\`, method: 'POST', body: queryArg.order }), + }), + getOrderById: build.query({ + query: (queryArg) => ({ url: \`/store/order/\${queryArg.orderId}\` }), + }), + deleteOrder: build.mutation({ + query: (queryArg) => ({ url: \`/store/order/\${queryArg.orderId}\`, method: 'DELETE' }), + }), + createUser: build.mutation({ + query: (queryArg) => ({ url: \`/user\`, method: 'POST', body: queryArg.user }), + }), + createUsersWithListInput: build.mutation({ + query: (queryArg) => ({ url: \`/user/createWithList\`, method: 'POST', body: queryArg.body }), + }), + loginUser: build.query({ + query: (queryArg) => ({ + url: \`/user/login\`, + params: { username: queryArg.username, password: queryArg.password }, + }), + }), + logoutUser: build.query({ + query: () => ({ url: \`/user/logout\` }), + }), + getUserByName: build.query({ + query: (queryArg) => ({ url: \`/user/\${queryArg.username}\` }), + }), + updateUser: build.mutation({ + query: (queryArg) => ({ url: \`/user/\${queryArg.username}\`, method: 'PUT', body: queryArg.user }), + }), + deleteUser: build.mutation({ + query: (queryArg) => ({ url: \`/user/\${queryArg.username}\`, method: 'DELETE' }), + }), + }), + overrideExisting: false, +}); +export { injectedRtkApi as enhancedApi }; +export type UpdatePetApiResponse = /** status 200 Successful operation */ Pet; +export type UpdatePetApiArg = { + /** Update an existent pet in the store */ + pet: Pet; +}; +export type AddPetApiResponse = /** status 200 Successful operation */ Pet; +export type AddPetApiArg = { + /** Create a new pet in the store */ + pet: Pet; +}; +export type FindPetsByStatusApiResponse = /** status 200 successful operation */ Pet[]; +export type FindPetsByStatusApiArg = { + /** Status values that need to be considered for filter */ + status?: 'available' | 'pending' | 'sold'; +}; +export type FindPetsByTagsApiResponse = /** status 200 successful operation */ Pet[]; +export type FindPetsByTagsApiArg = { + /** Tags to filter by */ + tags?: string[]; +}; +export type GetPetByIdApiResponse = /** status 200 successful operation */ Pet; +export type GetPetByIdApiArg = { + /** ID of pet to return */ + petId: number; +}; +export type UpdatePetWithFormApiResponse = unknown; +export type UpdatePetWithFormApiArg = { + /** ID of pet that needs to be updated */ + petId: number; + /** Name of pet that needs to be updated */ + name?: string; + /** Status of pet that needs to be updated */ + status?: string; +}; +export type DeletePetApiResponse = unknown; +export type DeletePetApiArg = { + apiKey?: string; + /** Pet id to delete */ + petId: number; +}; +export type UploadFileApiResponse = /** status 200 successful operation */ ApiResponse; +export type UploadFileApiArg = { + /** ID of pet to update */ + petId: number; + /** Additional Metadata */ + additionalMetadata?: string; + body: Blob; +}; +export type GetInventoryApiResponse = /** status 200 successful operation */ { + [key: string]: number; +}; +export type GetInventoryApiArg = void; +export type PlaceOrderApiResponse = /** status 200 successful operation */ Order; +export type PlaceOrderApiArg = { + order: Order; +}; +export type GetOrderByIdApiResponse = /** status 200 successful operation */ Order; +export type GetOrderByIdApiArg = { + /** ID of order that needs to be fetched */ + orderId: number; +}; +export type DeleteOrderApiResponse = unknown; +export type DeleteOrderApiArg = { + /** ID of the order that needs to be deleted */ + orderId: number; +}; +export type CreateUserApiResponse = unknown; +export type CreateUserApiArg = { + /** Created user object */ + user: User; +}; +export type CreateUsersWithListInputApiResponse = /** status 200 Successful operation */ User; +export type CreateUsersWithListInputApiArg = { + body: User[]; +}; +export type LoginUserApiResponse = /** status 200 successful operation */ string; +export type LoginUserApiArg = { + /** The user name for login */ + username?: string; + /** The password for login in clear text */ + password?: string; +}; +export type LogoutUserApiResponse = unknown; +export type LogoutUserApiArg = void; +export type GetUserByNameApiResponse = /** status 200 successful operation */ User; +export type GetUserByNameApiArg = { + /** The name that needs to be fetched. Use user1 for testing. */ + username: string; +}; +export type UpdateUserApiResponse = unknown; +export type UpdateUserApiArg = { + /** name that need to be deleted */ + username: string; + /** Update an existent user in the store */ + user: User; +}; +export type DeleteUserApiResponse = unknown; +export type DeleteUserApiArg = { + /** The name that needs to be deleted */ + username: string; +}; +export type Category = { + id?: number; + name?: string; +}; +export type Tag = { + id?: number; + name?: string; +}; +export type Pet = { + id?: number; + name: string; + category?: Category; + photoUrls: string[]; + tags?: Tag[]; + /** pet status in the store */ + status?: 'available' | 'pending' | 'sold'; +}; +export type ApiResponse = { + code?: number; + type?: string; + message?: string; +}; +export type Order = { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; + /** Order Status */ + status?: 'placed' | 'approved' | 'delivered'; + complete?: boolean; +}; +export type User = { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + /** User Status */ + userStatus?: number; +}; +" +`; + exports[`calling without \`outputFile\` returns the generated api 1`] = ` "import { api } from "./fixtures/emptyApi"; const injectedRtkApi = api.injectEndpoints({ diff --git a/packages/rtk-query-codegen-openapi/test/cli.test.ts b/packages/rtk-query-codegen-openapi/test/cli.test.ts index f8b6aa4dbb..a104cca017 100644 --- a/packages/rtk-query-codegen-openapi/test/cli.test.ts +++ b/packages/rtk-query-codegen-openapi/test/cli.test.ts @@ -1,76 +1,84 @@ -import del from 'del'; -import type { ExecException } from 'node:child_process'; -import { exec } from 'node:child_process'; -import fs from 'node:fs'; +import { exec as _exec } from 'node:child_process'; +import fs from 'node:fs/promises'; import path from 'node:path'; +import { promisify } from 'node:util'; +import { rimraf } from 'rimraf'; -function cli(args: string[], cwd: string): Promise<{ error: ExecException | null; stdout: string; stderr: string }> { - const pwd = process.env?.PWD || '.'; - const cmd = `yarn cli ${args.join(' ')}`; - return new Promise((resolve) => { - exec(cmd, { cwd }, (error, stdout, stderr) => { - resolve({ - error, - stdout, - stderr, - }); - }); - }); -} +const exec = promisify(_exec); + +const cliPath = process.env.TEST_DIST ? 'rtk-query-codegen-openapi' : `yarn cli`; + +const cli = async (args: string[]) => { + return await exec(`${cliPath} ${args.join(' ')}`); +}; const tmpDir = path.resolve(__dirname, 'tmp'); +export const removeTempDir = async () => { + await rimraf(tmpDir); +}; + +export const isDir = async (filePath: string) => { + try { + const stat = await fs.lstat(filePath); + return stat.isDirectory(); + } catch { + return false; + } +}; + describe('CLI options testing', () => { - beforeAll(() => { - if (!fs.existsSync(tmpDir)) fs.mkdirSync(tmpDir, { recursive: true }); + beforeAll(async () => { + if (!(await isDir(tmpDir))) { + await fs.mkdir(tmpDir, { recursive: true }); + } }); - afterEach(() => { - del.sync(`${tmpDir}/*.ts`); + afterEach(async () => { + await rimraf(`${tmpDir}/*.ts`, { glob: true }); }); - test('generation with `config.example.js`', async () => { - const out = await cli(['./test/config.example.js'], __dirname); + test('generation with `config.example.js`', { timeout: 25_000 }, async () => { + const out = await cli(['./test/config.example.js']); expect(out).toEqual({ stdout: `Generating ./tmp/example.ts Done `, stderr: '', - error: null, }); - expect(fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8')).toMatchSnapshot(); - }, 25_000); + expect(await fs.readFile(path.resolve(tmpDir, 'example.ts'), 'utf-8')).toMatchSnapshot(); + }); - test('paths are relative to config file, not to cwd', async () => { - const out = await cli([`./test/config.example.js`], __dirname); + test('paths are relative to config file, not to cwd', { timeout: 25_000 }, async () => { + const out = await cli([`./test/config.example.js`]); expect(out).toEqual({ stdout: `Generating ./tmp/example.ts Done `, stderr: '', - error: null, }); - expect(fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8')).toMatchSnapshot(); - }, 25_000); + expect(await fs.readFile(path.resolve(tmpDir, 'example.ts'), 'utf-8')).toMatchSnapshot(); + }); - test('ts, js and json all work the same', async () => { - await cli([`./test/config.example.js`], __dirname); - const fromJs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8'); - await cli([`./test/config.example.ts`], __dirname); - const fromTs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8'); - await cli([`./test/config.example.json`], __dirname); - const fromJson = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8'); + test('ts, js and json all work the same', { timeout: 120_000 }, async () => { + await cli([`./test/config.example.js`]); + const fromJs = await fs.readFile(path.resolve(tmpDir, 'example.ts'), 'utf-8'); + await cli([`./test/config.example.ts`]); + const fromTs = await fs.readFile(path.resolve(tmpDir, 'example.ts'), 'utf-8'); + await cli([`./test/config.example.json`]); + const fromJson = await fs.readFile(path.resolve(tmpDir, 'example.ts'), 'utf-8'); expect(fromTs).toEqual(fromJs); expect(fromJson).toEqual(fromJs); - }, 120_000); + }); - test("missing parameters doesn't fail", async () => { - const out = await cli([`./test/config.invalid-example.json`], __dirname); - expect(out.stderr).toContain("Error: path parameter petId does not seem to be defined in '/pet/{petId}'!"); - }, 25_000); + test("missing parameters doesn't fail", { timeout: 25_000 }, async () => { + await expect(() => cli([`./test/config.invalid-example.json`])).rejects.toThrowError( + "Error: path parameter petId does not seem to be defined in '/pet/{petId}'!" + ); + }); }); diff --git a/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts b/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts index b91eba46c4..1a5e98ac80 100644 --- a/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts +++ b/packages/rtk-query-codegen-openapi/test/generateEndpoints.test.ts @@ -1,16 +1,20 @@ -import del from 'del'; -import fs from 'node:fs'; +import { generateEndpoints } from '@rtk-query/codegen-openapi'; +import fs from 'node:fs/promises'; import path, { resolve } from 'node:path'; -import { generateEndpoints } from '../src'; +import { rimraf } from 'rimraf'; +import { isDir, removeTempDir } from './cli.test'; const tmpDir = path.resolve(__dirname, 'tmp'); beforeAll(async () => { - if (!fs.existsSync(tmpDir)) fs.mkdirSync(tmpDir, { recursive: true }); + if (!(await isDir(tmpDir))) { + await fs.mkdir(tmpDir, { recursive: true }); + } + return removeTempDir; }); -afterEach(() => { - del.sync(`${tmpDir}/*.ts`); +afterEach(async () => { + await rimraf(`${tmpDir}/*.ts`, { glob: true }); }); test('calling without `outputFile` returns the generated api', async () => { @@ -263,6 +267,16 @@ test('apiImport builds correct `import` statement', async () => { }); describe('import paths', () => { + beforeAll(async () => { + if (!(await isDir(tmpDir))) { + await fs.mkdir(tmpDir, { recursive: true }); + } + }); + + afterEach(async () => { + await rimraf(`${tmpDir}/*.ts`, { glob: true }); + }); + test('should create paths relative to `outFile` when `apiFile` is relative (different folder)', async () => { await generateEndpoints({ unionUndefined: true, @@ -273,13 +287,11 @@ describe('import paths', () => { hooks: true, tag: true, }); - expect(await fs.promises.readFile('./test/tmp/out.ts', 'utf8')).toContain( - "import { api } from '../../fixtures/emptyApi'" - ); + expect(await fs.readFile('./test/tmp/out.ts', 'utf8')).toContain("import { api } from '../../fixtures/emptyApi'"); }); test('should create paths relative to `outFile` when `apiFile` is relative (same folder)', async () => { - await fs.promises.writeFile('./test/tmp/emptyApi.ts', await fs.promises.readFile('./test/fixtures/emptyApi.ts')); + await fs.writeFile('./test/tmp/emptyApi.ts', await fs.readFile('./test/fixtures/emptyApi.ts', 'utf8')); await generateEndpoints({ unionUndefined: true, @@ -290,7 +302,7 @@ describe('import paths', () => { hooks: true, tag: true, }); - expect(await fs.promises.readFile('./test/tmp/out.ts', 'utf8')).toContain("import { api } from './emptyApi'"); + expect(await fs.readFile('./test/tmp/out.ts', 'utf8')).toContain("import { api } from './emptyApi'"); }); }); diff --git a/packages/rtk-query-codegen-openapi/test/tsconfig.json b/packages/rtk-query-codegen-openapi/test/tsconfig.json deleted file mode 100644 index 531a1fac66..0000000000 --- a/packages/rtk-query-codegen-openapi/test/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "paths": { - "@/*": ["./test/fixtures/*"], - "@rtk-query/codegen-openapi": ["./src"] - }, - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "module": "ESNext", - "moduleResolution": "Node", - "strict": true, - "noEmit": true, - "target": "ESNext", - "jsx": "react", - "baseUrl": "..", - "resolveJsonModule": true, - "types": ["vitest/globals", "vitest/importMeta"], - "allowJs": true, - "checkJs": true - } -} diff --git a/packages/rtk-query-codegen-openapi/tsconfig.build.json b/packages/rtk-query-codegen-openapi/tsconfig.build.json new file mode 100644 index 0000000000..dab75d1ecb --- /dev/null +++ b/packages/rtk-query-codegen-openapi/tsconfig.build.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "allowJs": false, + "checkJs": false, + "noEmit": false, + "rootDir": "src" + }, + "include": ["src"] +} diff --git a/packages/rtk-query-codegen-openapi/tsconfig.json b/packages/rtk-query-codegen-openapi/tsconfig.json index 6cad504e5b..3774910f1d 100644 --- a/packages/rtk-query-codegen-openapi/tsconfig.json +++ b/packages/rtk-query-codegen-openapi/tsconfig.json @@ -1,19 +1,29 @@ { "compilerOptions": { - "target": "ESNext", - "module": "ESNext", + "allowJs": true, + "allowSyntheticDefaultImports": true, + "checkJs": true, "declaration": true, - "sourceMap": true, - "outDir": "lib", - "rootDir": "src", - "strict": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "isolatedModules": true, + "jsx": "react", + "module": "ESNext", + "moduleResolution": "Bundler", + "noEmit": true, + "noErrorTruncation": true, + "noImplicitReturns": true, "noUnusedLocals": false, + "outDir": "lib", + "rootDir": ".", + "paths": { + "@rtk-query/codegen-openapi": ["./src/index.ts"] // @remap-prod-remove-line + }, "resolveJsonModule": true, - "moduleResolution": "bundler", - "types": ["vitest/globals", "vitest/importMeta"], - "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true - }, - "exclude": ["test", "lib", "vitest.config.mts"] + "sourceMap": true, + "strict": true, + "target": "ESNext", + "types": ["vitest/globals", "vitest/importMeta"] + } } diff --git a/packages/rtk-query-codegen-openapi/vitest.config.mts b/packages/rtk-query-codegen-openapi/vitest.config.mts index 49b3f4931f..4b912cdba0 100644 --- a/packages/rtk-query-codegen-openapi/vitest.config.mts +++ b/packages/rtk-query-codegen-openapi/vitest.config.mts @@ -1,5 +1,6 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; +import tsconfigPaths from 'vite-tsconfig-paths'; import { defineConfig } from 'vitest/config'; // No __dirname under Node ESM @@ -7,14 +8,11 @@ const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); export default defineConfig({ + plugins: [tsconfigPaths({ projects: ['./tsconfig.json'] })], test: { testTimeout: 10_000, pool: 'forks', globals: true, setupFiles: ['./test/vitest.setup.ts'], - alias: { - '@': path.join(__dirname, 'test/fixtures'), - '@rtk-query/codegen-openapi': path.join(__dirname, 'src'), - }, }, }); diff --git a/yarn.lock b/yarn.lock index ebc88edb40..3c866eb0bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -179,7 +179,7 @@ __metadata: languageName: node linkType: hard -"@ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1": +"@ampproject/remapping@npm:^2.2.0, @ampproject/remapping@npm:^2.2.1, @ampproject/remapping@npm:^2.3.0": version: 2.3.0 resolution: "@ampproject/remapping@npm:2.3.0" dependencies: @@ -5194,10 +5194,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/android-arm64@npm:0.17.19" - conditions: os=android & cpu=arm64 +"@esbuild/aix-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/aix-ppc64@npm:0.23.1" + conditions: os=aix & cpu=ppc64 languageName: node linkType: hard @@ -5215,10 +5215,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-arm@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/android-arm@npm:0.17.19" - conditions: os=android & cpu=arm +"@esbuild/android-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm64@npm:0.23.1" + conditions: os=android & cpu=arm64 languageName: node linkType: hard @@ -5236,10 +5236,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/android-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/android-x64@npm:0.17.19" - conditions: os=android & cpu=x64 +"@esbuild/android-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm@npm:0.23.1" + conditions: os=android & cpu=arm languageName: node linkType: hard @@ -5257,10 +5257,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-arm64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/darwin-arm64@npm:0.17.19" - conditions: os=darwin & cpu=arm64 +"@esbuild/android-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-x64@npm:0.23.1" + conditions: os=android & cpu=x64 languageName: node linkType: hard @@ -5278,10 +5278,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/darwin-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/darwin-x64@npm:0.17.19" - conditions: os=darwin & cpu=x64 +"@esbuild/darwin-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-arm64@npm:0.23.1" + conditions: os=darwin & cpu=arm64 languageName: node linkType: hard @@ -5299,10 +5299,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-arm64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/freebsd-arm64@npm:0.17.19" - conditions: os=freebsd & cpu=arm64 +"@esbuild/darwin-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-x64@npm:0.23.1" + conditions: os=darwin & cpu=x64 languageName: node linkType: hard @@ -5320,10 +5320,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/freebsd-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/freebsd-x64@npm:0.17.19" - conditions: os=freebsd & cpu=x64 +"@esbuild/freebsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-arm64@npm:0.23.1" + conditions: os=freebsd & cpu=arm64 languageName: node linkType: hard @@ -5341,10 +5341,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-arm64@npm:0.17.19" - conditions: os=linux & cpu=arm64 +"@esbuild/freebsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-x64@npm:0.23.1" + conditions: os=freebsd & cpu=x64 languageName: node linkType: hard @@ -5362,10 +5362,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-arm@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-arm@npm:0.17.19" - conditions: os=linux & cpu=arm +"@esbuild/linux-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm64@npm:0.23.1" + conditions: os=linux & cpu=arm64 languageName: node linkType: hard @@ -5383,10 +5383,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ia32@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-ia32@npm:0.17.19" - conditions: os=linux & cpu=ia32 +"@esbuild/linux-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm@npm:0.23.1" + conditions: os=linux & cpu=arm languageName: node linkType: hard @@ -5404,10 +5404,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-loong64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-loong64@npm:0.17.19" - conditions: os=linux & cpu=loong64 +"@esbuild/linux-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ia32@npm:0.23.1" + conditions: os=linux & cpu=ia32 languageName: node linkType: hard @@ -5425,10 +5425,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-mips64el@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-mips64el@npm:0.17.19" - conditions: os=linux & cpu=mips64el +"@esbuild/linux-loong64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-loong64@npm:0.23.1" + conditions: os=linux & cpu=loong64 languageName: node linkType: hard @@ -5446,10 +5446,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-ppc64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-ppc64@npm:0.17.19" - conditions: os=linux & cpu=ppc64 +"@esbuild/linux-mips64el@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-mips64el@npm:0.23.1" + conditions: os=linux & cpu=mips64el languageName: node linkType: hard @@ -5467,10 +5467,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-riscv64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-riscv64@npm:0.17.19" - conditions: os=linux & cpu=riscv64 +"@esbuild/linux-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ppc64@npm:0.23.1" + conditions: os=linux & cpu=ppc64 languageName: node linkType: hard @@ -5488,10 +5488,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-s390x@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-s390x@npm:0.17.19" - conditions: os=linux & cpu=s390x +"@esbuild/linux-riscv64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-riscv64@npm:0.23.1" + conditions: os=linux & cpu=riscv64 languageName: node linkType: hard @@ -5509,10 +5509,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/linux-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/linux-x64@npm:0.17.19" - conditions: os=linux & cpu=x64 +"@esbuild/linux-s390x@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-s390x@npm:0.23.1" + conditions: os=linux & cpu=s390x languageName: node linkType: hard @@ -5530,10 +5530,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/netbsd-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/netbsd-x64@npm:0.17.19" - conditions: os=netbsd & cpu=x64 +"@esbuild/linux-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-x64@npm:0.23.1" + conditions: os=linux & cpu=x64 languageName: node linkType: hard @@ -5551,6 +5551,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/netbsd-x64@npm:0.23.1" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-arm64@npm:0.23.0": version: 0.23.0 resolution: "@esbuild/openbsd-arm64@npm:0.23.0" @@ -5558,10 +5565,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/openbsd-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/openbsd-x64@npm:0.17.19" - conditions: os=openbsd & cpu=x64 +"@esbuild/openbsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-arm64@npm:0.23.1" + conditions: os=openbsd & cpu=arm64 languageName: node linkType: hard @@ -5579,10 +5586,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/sunos-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/sunos-x64@npm:0.17.19" - conditions: os=sunos & cpu=x64 +"@esbuild/openbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-x64@npm:0.23.1" + conditions: os=openbsd & cpu=x64 languageName: node linkType: hard @@ -5600,10 +5607,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-arm64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/win32-arm64@npm:0.17.19" - conditions: os=win32 & cpu=arm64 +"@esbuild/sunos-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/sunos-x64@npm:0.23.1" + conditions: os=sunos & cpu=x64 languageName: node linkType: hard @@ -5621,10 +5628,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-ia32@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/win32-ia32@npm:0.17.19" - conditions: os=win32 & cpu=ia32 +"@esbuild/win32-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-arm64@npm:0.23.1" + conditions: os=win32 & cpu=arm64 languageName: node linkType: hard @@ -5642,10 +5649,10 @@ __metadata: languageName: node linkType: hard -"@esbuild/win32-x64@npm:0.17.19": - version: 0.17.19 - resolution: "@esbuild/win32-x64@npm:0.17.19" - conditions: os=win32 & cpu=x64 +"@esbuild/win32-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-ia32@npm:0.23.1" + conditions: os=win32 & cpu=ia32 languageName: node linkType: hard @@ -5663,6 +5670,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-x64@npm:0.23.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" @@ -7220,7 +7234,7 @@ __metadata: languageName: node linkType: hard -"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.15": +"@jridgewell/sourcemap-codec@npm:^1.4.10, @jridgewell/sourcemap-codec@npm:^1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.15, @jridgewell/sourcemap-codec@npm:^1.5.0": version: 1.5.0 resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" checksum: 10/4ed6123217569a1484419ac53f6ea0d9f3b57e5b57ab30d7c267bdb27792a27eb0e4b08e84a2680aa55cc2f2b411ffd6ec3db01c44fdc6dc43aca4b55f8374fd @@ -7549,6 +7563,13 @@ __metadata: languageName: node linkType: hard +"@oazapfts/runtime@npm:^1.0.3": + version: 1.0.3 + resolution: "@oazapfts/runtime@npm:1.0.3" + checksum: 10/97e1bb8491b609bddae5b19191d961ca28a87c4878bdc4342b79cf0f169d8987f55b62316ac092fcf4a8bc9dd3d961c6bc814d96a6f4c3072ad0062d046fb5f3 + languageName: node + linkType: hard + "@octokit/auth-token@npm:^2.4.4": version: 2.5.0 resolution: "@octokit/auth-token@npm:2.5.0" @@ -8194,6 +8215,7 @@ __metadata: "@babel/core": "npm:^7.12.10" "@babel/preset-env": "npm:^7.12.11" "@babel/preset-typescript": "npm:^7.12.7" + "@oazapfts/runtime": "npm:^1.0.3" "@reduxjs/toolkit": "npm:^1.6.0" "@types/commander": "npm:^2.12.2" "@types/glob-to-regexp": "npm:^0.4.0" @@ -8203,7 +8225,7 @@ __metadata: chalk: "npm:^4.1.0" commander: "npm:^6.2.0" del: "npm:^6.0.0" - esbuild: "npm:~0.17" + esbuild: "npm:^0.23.1" esbuild-runner: "npm:^2.2.1" husky: "npm:^4.3.6" lodash: "npm:^4.17.21" @@ -8218,7 +8240,8 @@ __metadata: swagger2openapi: "npm:^7.0.4" ts-node: "npm:^10.9.2" typescript: "npm:^5.3.3" - vitest: "npm:^1.6.0" + vite-tsconfig-paths: "npm:^5.0.1" + vitest: "npm:^2.0.5" yalc: "npm:^1.0.0-pre.47" bin: rtk-query-codegen-openapi: lib/bin/cli.js @@ -10159,6 +10182,27 @@ __metadata: languageName: node linkType: hard +"@vitest/expect@npm:2.0.5": + version: 2.0.5 + resolution: "@vitest/expect@npm:2.0.5" + dependencies: + "@vitest/spy": "npm:2.0.5" + "@vitest/utils": "npm:2.0.5" + chai: "npm:^5.1.1" + tinyrainbow: "npm:^1.2.0" + checksum: 10/ca9a218f50254b2259fd16166b2d8c9ccc8ee2cc068905e6b3d6281da10967b1590cc7d34b5fa9d429297f97e740450233745583b4cc12272ff11705faf70a37 + languageName: node + linkType: hard + +"@vitest/pretty-format@npm:2.0.5, @vitest/pretty-format@npm:^2.0.5": + version: 2.0.5 + resolution: "@vitest/pretty-format@npm:2.0.5" + dependencies: + tinyrainbow: "npm:^1.2.0" + checksum: 10/70bf452dd0b8525e658795125b3f11110bd6baadfaa38c5bb91ca763bded35ec6dc80e27964ad4e91b91be6544d35e18ea7748c1997693988f975a7283c3e9a0 + languageName: node + linkType: hard + "@vitest/runner@npm:1.6.0": version: 1.6.0 resolution: "@vitest/runner@npm:1.6.0" @@ -10170,6 +10214,16 @@ __metadata: languageName: node linkType: hard +"@vitest/runner@npm:2.0.5": + version: 2.0.5 + resolution: "@vitest/runner@npm:2.0.5" + dependencies: + "@vitest/utils": "npm:2.0.5" + pathe: "npm:^1.1.2" + checksum: 10/464449abb84b3c779e1c6d1bedfc9e7469240ba3ccc4b4fa884386d1752d6572b68b9a87440159d433f17f61aca4012ee3bb78a3718d0e2bc64d810e9fc574a5 + languageName: node + linkType: hard + "@vitest/snapshot@npm:1.6.0": version: 1.6.0 resolution: "@vitest/snapshot@npm:1.6.0" @@ -10181,6 +10235,17 @@ __metadata: languageName: node linkType: hard +"@vitest/snapshot@npm:2.0.5": + version: 2.0.5 + resolution: "@vitest/snapshot@npm:2.0.5" + dependencies: + "@vitest/pretty-format": "npm:2.0.5" + magic-string: "npm:^0.30.10" + pathe: "npm:^1.1.2" + checksum: 10/fb46bc65851d4c8dcbbf86279c4146d5e7c17ad0d1be97132dedd98565d37f70ac8b0bf51ead0c6707786ffb15652535398c14d4304fa2146b0393d3db26fdff + languageName: node + linkType: hard + "@vitest/spy@npm:1.6.0": version: 1.6.0 resolution: "@vitest/spy@npm:1.6.0" @@ -10190,6 +10255,15 @@ __metadata: languageName: node linkType: hard +"@vitest/spy@npm:2.0.5": + version: 2.0.5 + resolution: "@vitest/spy@npm:2.0.5" + dependencies: + tinyspy: "npm:^3.0.0" + checksum: 10/ed19f4c3bb4d3853241e8070979615138e24403ce4c137fa48c903b3af2c8b3ada2cc26aca9c1aa323bb314a457a8130a29acbb18dafd4e42737deefb2abf1ca + languageName: node + linkType: hard + "@vitest/utils@npm:1.6.0": version: 1.6.0 resolution: "@vitest/utils@npm:1.6.0" @@ -10202,6 +10276,18 @@ __metadata: languageName: node linkType: hard +"@vitest/utils@npm:2.0.5": + version: 2.0.5 + resolution: "@vitest/utils@npm:2.0.5" + dependencies: + "@vitest/pretty-format": "npm:2.0.5" + estree-walker: "npm:^3.0.3" + loupe: "npm:^3.1.1" + tinyrainbow: "npm:^1.2.0" + checksum: 10/d631d56d29c33bc8de631166b2b6691c470187a345469dfef7048befe6027e1c6ff9552f2ee11c8a247522c325c4a64bfcc73f8f0f0c525da39cb9f190f119f8 + languageName: node + linkType: hard + "@webassemblyjs/ast@npm:1.11.1": version: 1.11.1 resolution: "@webassemblyjs/ast@npm:1.11.1" @@ -11170,6 +11256,13 @@ __metadata: languageName: node linkType: hard +"assertion-error@npm:^2.0.1": + version: 2.0.1 + resolution: "assertion-error@npm:2.0.1" + checksum: 10/a0789dd882211b87116e81e2648ccb7f60340b34f19877dd020b39ebb4714e475eb943e14ba3e22201c221ef6645b7bfe10297e76b6ac95b48a9898c1211ce66 + languageName: node + linkType: hard + "ast-types-flow@npm:^0.0.7": version: 0.0.7 resolution: "ast-types-flow@npm:0.0.7" @@ -12277,6 +12370,19 @@ __metadata: languageName: node linkType: hard +"chai@npm:^5.1.1": + version: 5.1.1 + resolution: "chai@npm:5.1.1" + dependencies: + assertion-error: "npm:^2.0.1" + check-error: "npm:^2.1.1" + deep-eql: "npm:^5.0.1" + loupe: "npm:^3.1.0" + pathval: "npm:^2.0.0" + checksum: 10/ee67279a5613bd36dc1dc13660042429ae2f1dc5a9030a6abcf381345866dfb5bce7bc10b9d74c8de86b6f656489f654bbbef3f3361e06925591e6a00c72afff + languageName: node + linkType: hard + "chalk-template@npm:0.4.0": version: 0.4.0 resolution: "chalk-template@npm:0.4.0" @@ -12464,6 +12570,13 @@ __metadata: languageName: node linkType: hard +"check-error@npm:^2.1.1": + version: 2.1.1 + resolution: "check-error@npm:2.1.1" + checksum: 10/d785ed17b1d4a4796b6e75c765a9a290098cf52ff9728ce0756e8ffd4293d2e419dd30c67200aee34202463b474306913f2fcfaf1890641026d9fc6966fea27a + languageName: node + linkType: hard + "check-types@npm:^11.1.1": version: 11.1.2 resolution: "check-types@npm:11.1.2" @@ -14062,6 +14175,13 @@ __metadata: languageName: node linkType: hard +"deep-eql@npm:^5.0.1": + version: 5.0.2 + resolution: "deep-eql@npm:5.0.2" + checksum: 10/a529b81e2ef8821621d20a36959a0328873a3e49d393ad11f8efe8559f31239494c2eb889b80342808674c475802ba95b9d6c4c27641b9a029405104c1b59fcf + languageName: node + linkType: hard + "deep-extend@npm:^0.6.0": version: 0.6.0 resolution: "deep-extend@npm:0.6.0" @@ -15123,33 +15243,37 @@ __metadata: languageName: node linkType: hard -"esbuild@npm:~0.17": - version: 0.17.19 - resolution: "esbuild@npm:0.17.19" - dependencies: - "@esbuild/android-arm": "npm:0.17.19" - "@esbuild/android-arm64": "npm:0.17.19" - "@esbuild/android-x64": "npm:0.17.19" - "@esbuild/darwin-arm64": "npm:0.17.19" - "@esbuild/darwin-x64": "npm:0.17.19" - "@esbuild/freebsd-arm64": "npm:0.17.19" - "@esbuild/freebsd-x64": "npm:0.17.19" - "@esbuild/linux-arm": "npm:0.17.19" - "@esbuild/linux-arm64": "npm:0.17.19" - "@esbuild/linux-ia32": "npm:0.17.19" - "@esbuild/linux-loong64": "npm:0.17.19" - "@esbuild/linux-mips64el": "npm:0.17.19" - "@esbuild/linux-ppc64": "npm:0.17.19" - "@esbuild/linux-riscv64": "npm:0.17.19" - "@esbuild/linux-s390x": "npm:0.17.19" - "@esbuild/linux-x64": "npm:0.17.19" - "@esbuild/netbsd-x64": "npm:0.17.19" - "@esbuild/openbsd-x64": "npm:0.17.19" - "@esbuild/sunos-x64": "npm:0.17.19" - "@esbuild/win32-arm64": "npm:0.17.19" - "@esbuild/win32-ia32": "npm:0.17.19" - "@esbuild/win32-x64": "npm:0.17.19" +"esbuild@npm:^0.23.1": + version: 0.23.1 + resolution: "esbuild@npm:0.23.1" + dependencies: + "@esbuild/aix-ppc64": "npm:0.23.1" + "@esbuild/android-arm": "npm:0.23.1" + "@esbuild/android-arm64": "npm:0.23.1" + "@esbuild/android-x64": "npm:0.23.1" + "@esbuild/darwin-arm64": "npm:0.23.1" + "@esbuild/darwin-x64": "npm:0.23.1" + "@esbuild/freebsd-arm64": "npm:0.23.1" + "@esbuild/freebsd-x64": "npm:0.23.1" + "@esbuild/linux-arm": "npm:0.23.1" + "@esbuild/linux-arm64": "npm:0.23.1" + "@esbuild/linux-ia32": "npm:0.23.1" + "@esbuild/linux-loong64": "npm:0.23.1" + "@esbuild/linux-mips64el": "npm:0.23.1" + "@esbuild/linux-ppc64": "npm:0.23.1" + "@esbuild/linux-riscv64": "npm:0.23.1" + "@esbuild/linux-s390x": "npm:0.23.1" + "@esbuild/linux-x64": "npm:0.23.1" + "@esbuild/netbsd-x64": "npm:0.23.1" + "@esbuild/openbsd-arm64": "npm:0.23.1" + "@esbuild/openbsd-x64": "npm:0.23.1" + "@esbuild/sunos-x64": "npm:0.23.1" + "@esbuild/win32-arm64": "npm:0.23.1" + "@esbuild/win32-ia32": "npm:0.23.1" + "@esbuild/win32-x64": "npm:0.23.1" dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true "@esbuild/android-arm": optional: true "@esbuild/android-arm64": @@ -15184,6 +15308,8 @@ __metadata: optional: true "@esbuild/netbsd-x64": optional: true + "@esbuild/openbsd-arm64": + optional: true "@esbuild/openbsd-x64": optional: true "@esbuild/sunos-x64": @@ -15196,7 +15322,7 @@ __metadata: optional: true bin: esbuild: bin/esbuild - checksum: 10/86ada7cad6d37a3445858fee31ca39fc6c0436c7c00b2e07b9ce308235be67f36aefe0dda25da9ab08653fde496d1e759d6ad891ce9479f9e1fb4964c8f2a0fa + checksum: 10/f55fbd0bfb0f86ce67a6d2c6f6780729d536c330999ecb9f5a38d578fb9fda820acbbc67d6d1d377eed8fed50fc38f14ff9cb014f86dafab94269a7fb2177018 languageName: node linkType: hard @@ -20716,6 +20842,15 @@ __metadata: languageName: node linkType: hard +"loupe@npm:^3.1.0, loupe@npm:^3.1.1": + version: 3.1.1 + resolution: "loupe@npm:3.1.1" + dependencies: + get-func-name: "npm:^2.0.1" + checksum: 10/56d71d64c5af109aaf2b5343668ea5952eed468ed2ff837373810e417bf8331f14491c6e4d38e08ff84a29cb18906e06e58ba660c53bd00f2989e1873fa2f54c + languageName: node + linkType: hard + "lower-case-first@npm:^2.0.2": version: 2.0.2 resolution: "lower-case-first@npm:2.0.2" @@ -20805,6 +20940,15 @@ __metadata: languageName: node linkType: hard +"magic-string@npm:^0.30.10": + version: 0.30.11 + resolution: "magic-string@npm:0.30.11" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.5.0" + checksum: 10/b784d2240252f5b1e755d487354ada4c672cbca16f045144f7185a75b059210e5fcca7be7be03ef1bac2ca754c4428b21d36ae64a9057ba429916f06b8c54eb2 + languageName: node + linkType: hard + "magic-string@npm:^0.30.5": version: 0.30.10 resolution: "magic-string@npm:0.30.10" @@ -22917,6 +23061,13 @@ __metadata: languageName: node linkType: hard +"pathval@npm:^2.0.0": + version: 2.0.0 + resolution: "pathval@npm:2.0.0" + checksum: 10/b91575bf9cdf01757afd7b5e521eb8a0b874a49bc972d08e0047cfea0cd3c019f5614521d4bc83d2855e3fcc331db6817dfd533dd8f3d90b16bc76fad2450fc1 + languageName: node + linkType: hard + "performance-now@npm:^2.1.0": version: 2.1.0 resolution: "performance-now@npm:2.1.0" @@ -27456,7 +27607,7 @@ __metadata: languageName: node linkType: hard -"std-env@npm:^3.5.0": +"std-env@npm:^3.5.0, std-env@npm:^3.7.0": version: 3.7.0 resolution: "std-env@npm:3.7.0" checksum: 10/6ee0cca1add3fd84656b0002cfbc5bfa20340389d9ba4720569840f1caa34bce74322aef4c93f046391583e50649d0cf81a5f8fe1d411e50b659571690a45f12 @@ -28344,6 +28495,13 @@ __metadata: languageName: node linkType: hard +"tinybench@npm:^2.8.0": + version: 2.9.0 + resolution: "tinybench@npm:2.9.0" + checksum: 10/cfa1e1418e91289219501703c4693c70708c91ffb7f040fd318d24aef419fb5a43e0c0160df9471499191968b2451d8da7f8087b08c3133c251c40d24aced06c + languageName: node + linkType: hard + "tinycolor2@npm:1.4.1": version: 1.4.1 resolution: "tinycolor2@npm:1.4.1" @@ -28358,6 +28516,20 @@ __metadata: languageName: node linkType: hard +"tinypool@npm:^1.0.0": + version: 1.0.1 + resolution: "tinypool@npm:1.0.1" + checksum: 10/eaceb93784b8e27e60c0e3e2c7d11c29e1e79b2a025b2c232215db73b90fe22bd4753ad53fc8e801c2b5a63b94a823af549555d8361272bc98271de7dd4a9925 + languageName: node + linkType: hard + +"tinyrainbow@npm:^1.2.0": + version: 1.2.0 + resolution: "tinyrainbow@npm:1.2.0" + checksum: 10/2924444db6804355e5ba2b6e586c7f77329d93abdd7257a069a0f4530dff9f16de484e80479094e3f39273462541b003a65ee3a6afc2d12555aa745132deba5d + languageName: node + linkType: hard + "tinyspy@npm:^2.2.0": version: 2.2.1 resolution: "tinyspy@npm:2.2.1" @@ -28365,6 +28537,13 @@ __metadata: languageName: node linkType: hard +"tinyspy@npm:^3.0.0": + version: 3.0.0 + resolution: "tinyspy@npm:3.0.0" + checksum: 10/b5b686acff2b88de60ff8ecf89a2042320406aaeee2fba1828a7ea8a925fad3ed9f5e4d7a068154a9134473c472aa03da8ca92ee994bc57a741c5ede5fa7de4d + languageName: node + linkType: hard + "title-case@npm:^3.0.3": version: 3.0.3 resolution: "title-case@npm:3.0.3" @@ -28659,6 +28838,20 @@ __metadata: languageName: node linkType: hard +"tsconfck@npm:^3.0.3": + version: 3.1.1 + resolution: "tsconfck@npm:3.1.1" + peerDependencies: + typescript: ^5.0.0 + peerDependenciesMeta: + typescript: + optional: true + bin: + tsconfck: bin/tsconfck.js + checksum: 10/a4456577f540212516d7eb530005893739aadd6da00787914a8ed9aa19c3f2f306b8912920aa440b9b8978f10c9dadbd062b8c2a2f0ff1f6c2d4272b5be2ef34 + languageName: node + linkType: hard + "tsconfig-paths@npm:^3.14.1": version: 3.14.1 resolution: "tsconfig-paths@npm:3.14.1" @@ -29774,6 +29967,21 @@ __metadata: languageName: node linkType: hard +"vite-node@npm:2.0.5": + version: 2.0.5 + resolution: "vite-node@npm:2.0.5" + dependencies: + cac: "npm:^6.7.14" + debug: "npm:^4.3.5" + pathe: "npm:^1.1.2" + tinyrainbow: "npm:^1.2.0" + vite: "npm:^5.0.0" + bin: + vite-node: vite-node.mjs + checksum: 10/de259cdf4b9ff82f39ba92ffca99db8a80783efd2764d3553b62cd8c8864488d590114a75bc93a93bf5ba2a2086bea1bee4b0029da9e62c4c0d3bf6c1f364eed + languageName: node + linkType: hard + "vite-tsconfig-paths@npm:^4.3.1": version: 4.3.1 resolution: "vite-tsconfig-paths@npm:4.3.1" @@ -29790,6 +29998,22 @@ __metadata: languageName: node linkType: hard +"vite-tsconfig-paths@npm:^5.0.1": + version: 5.0.1 + resolution: "vite-tsconfig-paths@npm:5.0.1" + dependencies: + debug: "npm:^4.1.1" + globrex: "npm:^0.1.2" + tsconfck: "npm:^3.0.3" + peerDependencies: + vite: "*" + peerDependenciesMeta: + vite: + optional: true + checksum: 10/e3cf1a2b997747cec6af83c3f9acc057e7f452ef91c3f38a9e32eb2e6cc6c723f51026e38f5d114296fc499b10b36bb56d668d9613a7367f5ecf23adb78642d7 + languageName: node + linkType: hard + "vite@npm:^5.0.0": version: 5.3.3 resolution: "vite@npm:5.3.3" @@ -29880,6 +30104,55 @@ __metadata: languageName: node linkType: hard +"vitest@npm:^2.0.5": + version: 2.0.5 + resolution: "vitest@npm:2.0.5" + dependencies: + "@ampproject/remapping": "npm:^2.3.0" + "@vitest/expect": "npm:2.0.5" + "@vitest/pretty-format": "npm:^2.0.5" + "@vitest/runner": "npm:2.0.5" + "@vitest/snapshot": "npm:2.0.5" + "@vitest/spy": "npm:2.0.5" + "@vitest/utils": "npm:2.0.5" + chai: "npm:^5.1.1" + debug: "npm:^4.3.5" + execa: "npm:^8.0.1" + magic-string: "npm:^0.30.10" + pathe: "npm:^1.1.2" + std-env: "npm:^3.7.0" + tinybench: "npm:^2.8.0" + tinypool: "npm:^1.0.0" + tinyrainbow: "npm:^1.2.0" + vite: "npm:^5.0.0" + vite-node: "npm:2.0.5" + why-is-node-running: "npm:^2.3.0" + peerDependencies: + "@edge-runtime/vm": "*" + "@types/node": ^18.0.0 || >=20.0.0 + "@vitest/browser": 2.0.5 + "@vitest/ui": 2.0.5 + happy-dom: "*" + jsdom: "*" + peerDependenciesMeta: + "@edge-runtime/vm": + optional: true + "@types/node": + optional: true + "@vitest/browser": + optional: true + "@vitest/ui": + optional: true + happy-dom: + optional: true + jsdom: + optional: true + bin: + vitest: vitest.mjs + checksum: 10/abb916e3496a3fa9e9d05ecd806332dc4000aa0e433f0cb1e99f9dd1fa5c06d2c66656874b9860a683cec0f32abe1519599babef02e5c0ca80e9afbcdbddfdbd + languageName: node + linkType: hard + "w3c-hr-time@npm:^1.0.2": version: 1.0.2 resolution: "w3c-hr-time@npm:1.0.2" @@ -30501,7 +30774,7 @@ __metadata: languageName: node linkType: hard -"why-is-node-running@npm:^2.2.2": +"why-is-node-running@npm:^2.2.2, why-is-node-running@npm:^2.3.0": version: 2.3.0 resolution: "why-is-node-running@npm:2.3.0" dependencies: