From 13da35bea01c4bc7665ec3d5d151c211f6176fb1 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:45:26 +0100 Subject: [PATCH 1/6] refactor(website/setup.mdx): change ESBuild to esbuild in docs This commit changes the capitalization of "ESBuild" to "esbuild" in the setup.mdx document. This change is made to match the official casing of the esbuild project. --- website/pages/docs/setup.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index 3e4f78bcdf..6ad123bbc6 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -75,7 +75,7 @@ If you are using a non-standard TypeScript compiler such as the following, you w - Non-standard TypeScript Compilers - [SWC](https://swc.rs) - - [ESBuild](https://esbuild.github.io/) + - [esbuild](https://esbuild.github.io/) - [Babel](https://babeljs.io/) ## Transformation @@ -310,7 +310,7 @@ If you are using a non-standard TypeScript compiler such as the following, you w - Non-standard TypeScript compilers: - [SWC](https://swc.rs/) in Next.JS - - [ESBuild](https://esbuild.github.io/) in Vite + - [esbuild](https://esbuild.github.io/) in Vite - [Babel](https://babeljs.io/) in Create-React-App Instead you should utilise the generation mode. From 9cc580c4c2b3383a4e3a6ebbe4d84c6252894e80 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:46:10 +0100 Subject: [PATCH 2/6] refactor(webxite/setup.mdx): change Webpack to webpack in docs This commit changes the casing of 'Webpack' to 'webpack' in the documentation. This is to adhere to the official casing of the webpack project. --- website/pages/docs/setup.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index 6ad123bbc6..a5fcf4e72e 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -417,7 +417,7 @@ export default defineConfig({ -## Webpack +## webpack ```bash filename="Terminal" copy showLineNumbers From 66ba4cf22f7755f997455ee5532df32337cb1380 Mon Sep 17 00:00:00 2001 From: ryoppippi <1560508+ryoppippi@users.noreply.github.com> Date: Wed, 5 Jun 2024 12:11:56 +0100 Subject: [PATCH 3/6] feat(website/setup.mdx): add unplugin-typia guide This commit introduces a guide for using unplugin-typia, an experimental plugin for integrating typia into various bundlers. The guide includes installation instructions and examples for Vite, Next.js, and esbuild. --- website/pages/docs/setup.mdx | 100 +++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index a5fcf4e72e..3dd11268d9 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -78,6 +78,8 @@ If you are using a non-standard TypeScript compiler such as the following, you w - [esbuild](https://esbuild.github.io/) - [Babel](https://babeljs.io/) +Or, if you are using a bundler such as `webpack`, `vite`, `esbuild`, or `next.js`, consider using the [unplugin-typia](#unplugin-typia). + ## Transformation ### Concepts AOT (Ahead of Time) compilation mode. @@ -416,6 +418,7 @@ export default defineConfig({ +**Also check out the [unplugin-typia](#unplugin-typia) guide for easier integration.** ## webpack @@ -525,6 +528,8 @@ Additionally, if you're using `typia` in the NodeJS project especially for the b - [Single JS file only](https://nestia.io/docs/setup/#single-js-file-only) +**Also check out the [unplugin-typia](#unplugin-typia) guide for easier integration.** + ## NX @@ -566,3 +571,98 @@ After install `typia` like above, you have to modify `project.json` on each app ... } ``` + +## unplugin-typia + + + + **This is experimental guide** + + + +[unplugin-typia](https://jsr.io/@ryoppippi/unplugin-typia) is an experimental plugin to integrate `typia` into your bundlers seamlessly. + +Currently, `unplugin-typia` supports the following bundlers: + - [Vite](https://vitejs.dev/) + - [Rollup](https://rollupjs.org/) + - [esbuild](https://esbuild.github.io/) + - [webpack](https://webpack.js.org/) + - [Next.js](https://nextjs.org/) + - [Rspack](https://www.rspack.dev/) + - [Rolldown](https://rolldown.rs/) + - [farm](https://farm-fe.github.io/) + + +For using `unplugin-typia`, you have to follow [Manual Setup](#manual-setup) guide. +However, you do not have to configure `tsconfig.json` transformer. + + + + +```bash filename="Terminal" showLineNumbers copy +npx jsr add -D @ryoppippi/unplugin-typia +npm install --save typia +npm install --save-dev typescript ts-patch ts-node +``` + + +```bash filename="Terminal" showLineNumbers copy +pnpm dlx jsr add -D @ryoppippi/unplugin-typia +pnpm install --save typia +pnpm install --save-dev typescript ts-patch ts-node +``` + + +```bash filename="Terminal" showLineNumbers copy +yarn dlx jsr add -D @ryoppippi/unplugin-typia +yarn add typia +yarn add -D typescript ts-patch ts-node +``` + + + +Firstly, install `unplugin-typia` via your favorite package manager. + +Then, open `package.json` file and configure `npm run prepare` command and run the `prepare` command, which is explaind in [Manual Setup](#manual-setup) guide. + +There are a couple of ways to integrate `unplugin-typia` into your bundlers. +For the full integration guide, please refer to the [unplugin-typia documentation](https://jsr.io/@ryoppippi/unplugin-typia/doc). + +Also, you can see the examples projects in [unplugin-typia repository](https://github.com/ryoppippi/unplugin-typia). + +### [Vite](https://jsr.io/@ryoppippi/unplugin-typia/doc/vite/~/default) + +```typescript filename="vite.config.ts" copy showLineNumbers +import UnpluginTypia from 'unplugin-typia/vite' + +export default defineConfig({ + plugins: [UnpluginTypia({ /* options */ })], +}) +``` + +### [Next.js](https://jsr.io/@ryoppippi/unplugin-typia/doc/next/~/default) + +```javascript filename="next.config.mjs" copy showLineNumbers +import unTypiaNext from "unplugin-typia/next"; + +/** @type {import('next').NextConfig} */ +const config = { + // your next.js config +}; + +export default unTypiaNext(config) +``` + +### [esbuild](https://jsr.io/@ryoppippi/unplugin-typia/doc/esbuild/~/default) + +```javascript filename="esbuild.config.js" copy showLineNumbers +import { build } from 'esbuild' +import UnpluginTypia from 'unplugin-typia/esbuild'; + +build({ + plugins: [ + UnpluginTypia({ /* options */ }), + ], +}) +``` + From 1fb24d9741e79bf6c8b6003e1bcd8efff3302c01 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 5 Jun 2024 21:45:40 +0900 Subject: [PATCH 4/6] A little bit emension --- website/package-lock.json | 18 +++++++++--------- website/pages/docs/setup.mdx | 34 +++++++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/website/package-lock.json b/website/package-lock.json index 3212af9926..b44561798c 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -27,7 +27,7 @@ "tgrid": "^1.0.0", "tstl": "^3.0.0", "typescript": "^5.4.5", - "typia": "^6.0.3" + "typia": "^6.0.6" }, "devDependencies": { "@trivago/prettier-plugin-sort-imports": "^4.3.0", @@ -1373,9 +1373,9 @@ } }, "node_modules/@samchon/openapi": { - "version": "0.1.21", - "resolved": "https://registry.npmjs.org/@samchon/openapi/-/openapi-0.1.21.tgz", - "integrity": "sha512-IUCOZpLOx8IZzxW87ySvFRSyGMRRQS5vpUwhUddzVR9vlDvTfVYjQjFuiJBqQIeGSdZExV3JzuHJCogacmd0/g==" + "version": "0.1.22", + "resolved": "https://registry.npmjs.org/@samchon/openapi/-/openapi-0.1.22.tgz", + "integrity": "sha512-SXbXTKwS33agE+GiAskDc7v40wVLnTizxn6YPqD7iNStPckMagJZV1g/IlpqH/hhWOm/MrbEJGvgQ+Fr9TG7mQ==" }, "node_modules/@swc/counter": { "version": "0.1.3", @@ -8796,11 +8796,11 @@ } }, "node_modules/typia": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/typia/-/typia-6.0.3.tgz", - "integrity": "sha512-Yq69N1EbVcU3kXxeEQEdl9J9mhWRJLfGiKBl9e2zLCIVfzYt/WVjEidlpy1BAPybfOTuIZ+jFtsooZ4FQNJffw==", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/typia/-/typia-6.0.6.tgz", + "integrity": "sha512-7SNGNmV7E/gEc5YZ32Hz1Tzd8mIGUOGcJyZlD34KUXX584RPvmcuHZzDRtxp8HgTvpqAMY9oAasH5QJM82jc3A==", "dependencies": { - "@samchon/openapi": "^0.1.16", + "@samchon/openapi": "0.1.22", "commander": "^10.0.0", "comment-json": "^4.2.3", "inquirer": "^8.2.5", @@ -8810,7 +8810,7 @@ "typia": "lib/executable/typia.js" }, "peerDependencies": { - "typescript": ">=4.8.0 <5.5.0" + "typescript": ">=4.8.0 <5.6.0" } }, "node_modules/typia/node_modules/commander": { diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index 3dd11268d9..bd1eba9fe1 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -208,7 +208,7 @@ As `typia` generates optimal operation code through transformation, it must be c ```json filename="package.json" copy showLineNumbers {2-4} { "scripts": { - "prepare": "ts-patch install && typia patch" + "prepare": "ts-patch install" }, "dependencies": { "typia": "^6.0.6" @@ -572,15 +572,16 @@ After install `typia` like above, you have to modify `project.json` on each app } ``` -## unplugin-typia +## `unplugin-typia` +
**This is experimental guide** -[unplugin-typia](https://jsr.io/@ryoppippi/unplugin-typia) is an experimental plugin to integrate `typia` into your bundlers seamlessly. +[`unplugin-typia`](https://jsr.io/@ryoppippi/unplugin-typia) is an experimental plugin to integrate `typia` into your bundlers seamlessly. Currently, `unplugin-typia` supports the following bundlers: - [Vite](https://vitejs.dev/) @@ -593,11 +594,11 @@ Currently, `unplugin-typia` supports the following bundlers: - [farm](https://farm-fe.github.io/) -For using `unplugin-typia`, you have to follow [Manual Setup](#manual-setup) guide. +For using `unplugin-typia`, you have to follow [Manual Setup](#manual-setup) guide. + However, you do not have to configure `tsconfig.json` transformer. - ```bash filename="Terminal" showLineNumbers copy npx jsr add -D @ryoppippi/unplugin-typia @@ -623,12 +624,27 @@ yarn add -D typescript ts-patch ts-node Firstly, install `unplugin-typia` via your favorite package manager. -Then, open `package.json` file and configure `npm run prepare` command and run the `prepare` command, which is explaind in [Manual Setup](#manual-setup) guide. +Secondly, open the `package.json` file, and configure `prepare` script like below. -There are a couple of ways to integrate `unplugin-typia` into your bundlers. -For the full integration guide, please refer to the [unplugin-typia documentation](https://jsr.io/@ryoppippi/unplugin-typia/doc). +At last, run the `npm run prepare` command, and follow the next section steps. + +```json filename="package.json" copy showLineNumbers {2-4} +{ + "scripts": { + "prepare": "ts-patch install" + }, + "dependencies": { + "typia": "^6.0.6" + }, + "devDependencies": { + "ts-node": "^10.9.1", + "ts-patch": "^3.2.0", + "typescript": "^5.4.5" + } +} +``` -Also, you can see the examples projects in [unplugin-typia repository](https://github.com/ryoppippi/unplugin-typia). +> For reference, there are a couple of ways to integrate `unplugin-typia` into your bundlers. For the full integration guide, please refer to the [`unplugin-typia` documentation](https://jsr.io/@ryoppippi/unplugin-typia/doc). Also, you can see the examples projects in [`unplugin-typia` repository](https://github.com/ryoppippi/unplugin-typia). ### [Vite](https://jsr.io/@ryoppippi/unplugin-typia/doc/vite/~/default) From 193b31368241e7772fcdf248e64fa7fc20d3346e Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 5 Jun 2024 21:56:44 +0900 Subject: [PATCH 5/6] Change `unplugin-typia` to utililze `npx typia setup` command. --- website/pages/docs/setup.mdx | 55 +++++++++--------------------------- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index bd1eba9fe1..757e6acba5 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -1,4 +1,4 @@ -import { Tabs, Tab } from 'nextra-theme-docs' +import { Callout, Tabs, Tab } from 'nextra-theme-docs' import Alert from '@mui/material/Alert'; import AlertTitle from '@mui/material/AlertTitle'; @@ -78,7 +78,7 @@ If you are using a non-standard TypeScript compiler such as the following, you w - [esbuild](https://esbuild.github.io/) - [Babel](https://babeljs.io/) -Or, if you are using a bundler such as `webpack`, `vite`, `esbuild`, or `next.js`, consider using the [unplugin-typia](#unplugin-typia). +Or, if you are using a bundler such as `webpack`, `vite`, `esbuild`, or `next.js`, consider using the [`unplugin-typia`](#unplugin-typia). ## Transformation ### Concepts @@ -418,7 +418,7 @@ export default defineConfig({ -**Also check out the [unplugin-typia](#unplugin-typia) guide for easier integration.** +**Also check out the [`unplugin-typia`](#unplugin-typia) guide for easier integration.** ## webpack @@ -528,7 +528,7 @@ Additionally, if you're using `typia` in the NodeJS project especially for the b - [Single JS file only](https://nestia.io/docs/setup/#single-js-file-only) -**Also check out the [unplugin-typia](#unplugin-typia) guide for easier integration.** +**Also check out the [`unplugin-typia`](#unplugin-typia) guide for easier integration.** ## NX @@ -574,12 +574,9 @@ After install `typia` like above, you have to modify `project.json` on each app ## `unplugin-typia` -
- - - **This is experimental guide** - - + + This is an experimental guide + [`unplugin-typia`](https://jsr.io/@ryoppippi/unplugin-typia) is an experimental plugin to integrate `typia` into your bundlers seamlessly. @@ -593,58 +590,34 @@ Currently, `unplugin-typia` supports the following bundlers: - [Rolldown](https://rolldown.rs/) - [farm](https://farm-fe.github.io/) - -For using `unplugin-typia`, you have to follow [Manual Setup](#manual-setup) guide. - -However, you do not have to configure `tsconfig.json` transformer. - ```bash filename="Terminal" showLineNumbers copy npx jsr add -D @ryoppippi/unplugin-typia npm install --save typia -npm install --save-dev typescript ts-patch ts-node +npx typia setup ``` ```bash filename="Terminal" showLineNumbers copy pnpm dlx jsr add -D @ryoppippi/unplugin-typia -pnpm install --save typia -pnpm install --save-dev typescript ts-patch ts-node +pnpm typia setup --manager pnpm ``` ```bash filename="Terminal" showLineNumbers copy +# YARN BERRY IS NOT SUPPORTED yarn dlx jsr add -D @ryoppippi/unplugin-typia -yarn add typia -yarn add -D typescript ts-patch ts-node +yarn typia setup --manager yarn ``` -Firstly, install `unplugin-typia` via your favorite package manager. +At first, install both `unplugin-typia` and `typia`, with `npx typia setup` command. -Secondly, open the `package.json` file, and configure `prepare` script like below. - -At last, run the `npm run prepare` command, and follow the next section steps. - -```json filename="package.json" copy showLineNumbers {2-4} -{ - "scripts": { - "prepare": "ts-patch install" - }, - "dependencies": { - "typia": "^6.0.6" - }, - "devDependencies": { - "ts-node": "^10.9.1", - "ts-patch": "^3.2.0", - "typescript": "^5.4.5" - } -} -``` +After that, follow the next section steps to integrate `unplugin-typia` into your bundlers. -> For reference, there are a couple of ways to integrate `unplugin-typia` into your bundlers. For the full integration guide, please refer to the [`unplugin-typia` documentation](https://jsr.io/@ryoppippi/unplugin-typia/doc). Also, you can see the examples projects in [`unplugin-typia` repository](https://github.com/ryoppippi/unplugin-typia). +For reference, there are a couple of ways to integrate `unplugin-typia` into your bundlers. For the full integration guide, please refer to the [`unplugin-typia` documentation](https://jsr.io/@ryoppippi/unplugin-typia/doc). Also, you can see the examples projects in [`unplugin-typia` repository](https://github.com/ryoppippi/unplugin-typia). ### [Vite](https://jsr.io/@ryoppippi/unplugin-typia/doc/vite/~/default) From 3ed96422fe8c2425c33e7dafe44f8dd98714ed78 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 5 Jun 2024 22:04:34 +0900 Subject: [PATCH 6/6] Fix link typo --- website/pages/docs/setup.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/pages/docs/setup.mdx b/website/pages/docs/setup.mdx index 757e6acba5..a415b7d466 100644 --- a/website/pages/docs/setup.mdx +++ b/website/pages/docs/setup.mdx @@ -31,7 +31,7 @@ yarn typia setup --manager yarn If you're using standard TypeScript compiler, you can use [transform mode](#transformation). -Assuming you are using [transformation mode] simply run `npx typia setup` which will provide sane defaults. +Assuming you are using [transformation mode](#transformation) simply run `npx typia setup` which will provide sane defaults. - Standard TypeScript Compiler: [Microsoft/TypeScript](https://github.com/microsoft/typescript)