Skip to content

Commit

Permalink
Merge pull request #153 from ryoppippi/feature/update-typiascript
Browse files Browse the repository at this point in the history
feat(dependencies): update TypeScript/ts-patch/typia
  • Loading branch information
ryoppippi authored Jun 27, 2024
2 parents d6653f4 + 8049001 commit 55d2325
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 31 deletions.
Binary file modified bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions examples/bun-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"@types/bun": "latest",
"npm-run-all2": "^6.2.0",
"std-env": "^3.7.0",
"typia": "^6.1.0"
"typia": "^6.3.1"
},
"peerDependencies": {
"ts-patch": "^3.1.2",
"ts-patch": "^3.2.1",
"tslib": "^2.4.1",
"typescript": "^5.4.5",
"typescript": "~5.5.2",
"@ryoppippi/unplugin-typia": "workspace:*"
}
}
6 changes: 3 additions & 3 deletions examples/esbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"dax-sh": "^0.41.0",
"esbuild": "^0.20.2",
"tsx": "^4.7.2",
"ts-patch": "^3.1.2",
"ts-patch": "^3.2.1",
"tslib": "^2.4.1",
"typescript": "^5.4.5",
"typescript": "~5.5.2",
"@ryoppippi/unplugin-typia": "workspace:*"
},
"dependencies": {
"typia": "^6.1.0"
"typia": "^6.3.1"
}
}
6 changes: 3 additions & 3 deletions examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"ts-patch": "^3.1.2",
"ts-patch": "^3.2.1",
"tslib": "^2.4.1",
"type-fest": "^4.19.0",
"typescript": "^5.4.5",
"typia": "^6.1.0",
"typescript": "~5.5.2",
"typia": "^6.3.1",
"@ryoppippi/unplugin-typia": "workspace:*"
}
}
6 changes: 3 additions & 3 deletions examples/sveltekit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"svelte": "^5.0.0-next.165",
"svelte-check": "^3.6.0",
"ts-patch": "^3.1.2",
"ts-patch": "^3.2.1",
"tslib": "^2.4.1",
"typescript": "^5.4.5",
"typia": "^6.1.0",
"typescript": "~5.5.2",
"typia": "^6.3.1",
"vite": "^5.0.3"
},
"type": "module",
Expand Down
6 changes: 3 additions & 3 deletions examples/vite-hono/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"@hono/typia-validator": "^0.0.4",
"@hono/vite-cloudflare-pages": "^0.4.1",
"@hono/vite-dev-server": "^0.12.1",
"ts-patch": "^3.1.2",
"typescript": "^5.4.5",
"typia": "^6.1.0",
"ts-patch": "^3.2.1",
"typescript": "~5.5.2",
"typia": "^6.3.1",
"vite": "^5.2.12",
"@ryoppippi/unplugin-typia": "workspace:*"
}
Expand Down
6 changes: 3 additions & 3 deletions examples/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"@types/react-dom": "^18.2.22",
"@types/uuid": "^9.0.8",
"@vitejs/plugin-react": "^4.3.1",
"ts-patch": "^3.1.2",
"typescript": "^5.4.5",
"typia": "^6.1.0",
"ts-patch": "^3.2.1",
"typescript": "~5.5.2",
"typia": "^6.3.1",
"vite": "^5.2.0",
"@ryoppippi/unplugin-typia": "workspace:*"
}
Expand Down
6 changes: 3 additions & 3 deletions examples/vite-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"devDependencies": {
"vite": "^5.0.4",
"vite-plugin-inspect": "^0.8.4",
"ts-patch": "^3.1.2",
"typescript": "^5.4.5",
"typia": "^6.1.0",
"ts-patch": "^3.2.1",
"typescript": "~5.5.2",
"typia": "^6.3.1",
"@ryoppippi/unplugin-typia": "workspace:*"
}
}
6 changes: 3 additions & 3 deletions examples/webpack-minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"prettier": "^3.3.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"ts-patch": "^3.2.0",
"ts-patch": "^3.2.1",
"tsx": "^4.15.7",
"typescript": "~5.4.2",
"typescript": "~5.5.2",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
Expand All @@ -28,6 +28,6 @@
"dependencies": {
"@ryoppippi/unplugin-typia": "workspace:*",
"cross-env": "^7.0.3",
"typia": "^6.1.0"
"typia": "^6.3.1"
}
}
5 changes: 3 additions & 2 deletions packages/unplugin-typia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"magic-string": "^0.30.10",
"mlly": "^1.7.1",
"pathe": "^1.1.2",
"typescript": "~5.4.5",
"ts-patch": "^3.2.1",
"typescript": "~5.5.2",
"unplugin": "^1.5.1"
},
"devDependencies": {
Expand All @@ -103,6 +104,6 @@
"pkg-types": "^1.1.1",
"rollup": "^4.6.1",
"type-fest": "^4.19.0",
"typia": "^6.1.0"
"typia": "^6.3.1"
}
}
19 changes: 14 additions & 5 deletions packages/unplugin-typia/src/core/typia.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ts from 'typescript';
import { resolve } from 'pathe';
import { readTSConfig } from 'pkg-types';
import { resolveTSConfig } from 'pkg-types';
import type { UnpluginBuildContext, UnpluginContext } from 'unplugin';
import { transform as typiaTransform } from 'typia/lib/transform.js';

Expand Down Expand Up @@ -60,7 +60,19 @@ export async function transformTypia(
* @param tsconfigId - The tsconfig.json path. @default undefined
*/
async function getTsCompilerOption(cacheEnable = true, tsconfigId?: string): Promise<ts.CompilerOptions> {
const parseTsComilerOptions = async () => (({ ...(await readTSConfig(tsconfigId))?.compilerOptions, moduleResolution: undefined }));
const parseTsComilerOptions = async () => {
const readFile = (path: string) => ts.sys.readFile(path);
const id = await resolveTSConfig(tsconfigId);

const tsconfigParseResult = ts.readConfigFile(id, readFile);
if (tsconfigParseResult.error != null) {
throw new Error(tsconfigParseResult.error.messageText.toString());
}

const tsconfig = ts.parseJsonConfigFileContent(tsconfigParseResult.config, ts.sys, id);

return tsconfig.options;
};

/** parse tsconfig compilerOptions */
if (cacheEnable) {
Expand All @@ -70,9 +82,6 @@ async function getTsCompilerOption(cacheEnable = true, tsconfigId?: string): Pro
compilerOptions = await parseTsComilerOptions();
}

if (compilerOptions == null) {
throw new Error('No compilerOptions found in tsconfig.json');
}
return compilerOptions;
}

Expand Down

0 comments on commit 55d2325

Please sign in to comment.