### Project Setup and Development Commands Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/vite-hono/README.md Commands to install dependencies, prepare the project, and run the development server. ```bash bun i && bun prepare bun run dev bun run build ``` -------------------------------- ### Project Setup and Development Commands Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/sveltekit/README.md These commands cover the essential steps for installing dependencies, preparing the project, running the development server, and building the project for deployment. ```sh bun i && bun prepare ``` ```sh bun dev --open ``` ```sh bun run build ``` -------------------------------- ### Project Setup and Development Commands Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/vite-react/README.md This snippet outlines the essential commands for installing dependencies, preparing the project, running the development server, and building the project for deployment. ```sh bun i && bun prepare bun dev --open bun run build ``` -------------------------------- ### Install and Run unplugin-typia with Bun Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/bun-build/README.md This snippet shows the necessary commands to install dependencies, prepare the project, and run the TypeScript file using Bun. ```sh bun i && bun prepare bun run index.ts ``` -------------------------------- ### Installation and Development Commands Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/nextjs/README.md This snippet shows the basic commands for installing dependencies, preparing the project, and running the development server or build process for unplugin-typia in a Next.js environment. ```txt bun i && bun prepare bun run dev bun run build ``` -------------------------------- ### Monorepo Development Setup Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Commands for setting up the development environment for the Unplugin Typia monorepo, which is managed by Bun. This includes installing dependencies with frozen lockfile to ensure reproducible builds. ```sh bun i --frozen-lockfile ``` -------------------------------- ### Install unplugin-typia and typia Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Installs the unplugin-typia package as a development dependency and typia itself. It also includes commands to set up typia and run the prepare script. ```bash # npm npm install -D @ryoppippi/unplugin-typia # install typia! (nypm detects your PM ✨) npx nypm add typia # setup typia! npx typia setup # pnpm dlx typia setup # yarn dlx typia setup # after installing typia, run prepare script npm run prepare ``` -------------------------------- ### Bun.build Configuration with unplugin-typia Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Provides an example of using unplugin-typia with Bun.build for script building. It shows how to import the plugin and include it in the Bun.build configuration. ```typescript // build.ts import UnpluginTypia from '@ryoppippi/unplugin-typia/bun'; await Bun.build({ entrypoints: ['./index.ts'], outdir: './out', plugins: [ UnpluginTypia({ /* your options */}) ] }); ``` -------------------------------- ### Testing API with xh Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/vite-hono/README.md Example of how to test the deployed API endpoint using the 'xh' tool. It shows a POST request with JSON payload. ```sh xh post https://unplugin-typia-vite-hono.pages.dev/ name=john age:=27 ``` -------------------------------- ### Vite Plugin Configuration Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/vite-react/index.html Example of how to configure the unplugin-typia plugin in your Vite project's `vite.config.ts` file. This enables typia's features during the build process. ```typescript import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import typia from 'unplugin-typia/vite'; export default defineConfig({ plugins: [ react(), typia({ // typia options // e.g., output: 'src/typia', // emitter: { // output: 'src/typia', // }, }), ], }); ``` -------------------------------- ### Bun Runtime Plugin Configuration Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Configures the Unplugin Typia plugin for the Bun runtime. This involves importing the plugin and passing any necessary options to it. The configuration is then applied to the Bun runtime via the `preload` option in `bun.toml`. ```ts // preload.ts import { plugin } from 'bun'; import UnpluginTypia from '@ryoppippi/unplugin-typia/bun'; plugin(UnpluginTypia({ /* your options */})); ``` ```toml # bun.toml preload = "preload.ts" [test] preload = "preload.ts" ``` ```sh bun run ./index.ts ``` -------------------------------- ### Next.js Configuration with unplugin-typia Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Illustrates how to integrate unplugin-typia with a Next.js project. It involves importing a specific function for Next.js configuration and applying the plugin with optional settings. ```javascript // next.config.mjs import unTypiaNext from 'unplugin-typia/next'; /** @type {import('next').NextConfig} */ const nextConfig = { /* your next.js config */}; /** @type {import("unplugin-typia").Options} */ const unpluginTypiaOptions = { /* your unplugin-typia options */ }; export default unTypiaNext(nextConfig, unpluginTypiaOptions); // you can omit the unplugin-typia options when you don't need to customize it // export default unTypiaNext(nextConfig); ``` -------------------------------- ### esbuild Configuration with unplugin-typia Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Shows how to add unplugin-typia to an esbuild build configuration. This allows Typia's functionality to be utilized within esbuild-based projects. ```javascript // esbuild.config.js import UnpluginTypia from '@ryoppippi/unplugin-typia/esbuild'; export default { plugins: [ UnpluginTypia({ /* options */ }), ], }; ``` -------------------------------- ### typia CLI Usage Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/vite-react/index.html Demonstrates how to use the typia command-line interface to generate type-safe code. This is often used in conjunction with the Vite plugin for a complete development workflow. ```bash # Install typia globally or as a dev dependency npm install -g typia # or npm install --save-dev typia # Generate code from your TypeScript files typia src/ --output src/typia --transform # For more options, see typia documentation: # https://github.com/samchon/typia ``` -------------------------------- ### Vite Configuration with unplugin-typia Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Demonstrates how to integrate unplugin-typia into a Vite project's configuration file. It shows the import statement and how to include the plugin with optional tsconfig path. ```typescript // vite.config.ts import UnpluginTypia from '@ryoppippi/unplugin-typia/vite'; export default defineConfig({ plugins: [ UnpluginTypia({ tsconfig: './tsconfig.app.json' /* options */ }), // should be placed before other plugins like `react`, `svetle`, etc. ], }); ``` -------------------------------- ### Rollup Plugin Configuration Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Integrates Unplugin Typia into a Rollup build process. This is achieved by importing the plugin and including it in the `plugins` array of the Rollup configuration file. Options can be passed to the plugin as needed. ```ts // rollup.config.js import UnpluginTypia from '@ryoppippi/unplugin-typia/rollup'; export default { plugins: [ UnpluginTypia({ /* options */ }), ], }; ``` -------------------------------- ### Webpack Plugin Configuration Source: https://github.com/ryoppippi/unplugin-typia/blob/main/packages/unplugin-typia/README.md Adds Unplugin Typia to a Webpack build configuration. The plugin is imported using `require` and then added to the `plugins` array in the Webpack configuration. Custom options can be provided to the plugin. ```js // webpack.config.js const { default: UnpluginTypia } = require('@ryoppippi/unplugin-typia/webpack'); module.exports = { plugins: [ UnpluginTypia({ /* options */ }), ], }; ``` -------------------------------- ### Register Service Worker in Webpack Source: https://github.com/ryoppippi/unplugin-typia/blob/main/examples/webpack-minimal/index.html This snippet demonstrates how to register a service worker in a Webpack application. It checks for service worker support in the navigator, and upon page load, attempts to register 'service-worker.js'. Success or failure messages are logged to the console. ```javascript if ("serviceWorker" in navigator) { window.addEventListener("load", () => { navigator.serviceWorker .register("service-worker.js") .then((registration) => { console.log("Service Worker registered: ", registration); }) .catch((registrationError) => { console.error("Service Worker registration failed: ", registrationError); }); }); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.