Skip to content

Commit ab70fdf

Browse files
authored
Merge pull request #111 from ryoppippi/feature/fix-docs
feature/fix docs
2 parents ce32676 + ab8bf8a commit ab70fdf

File tree

2 files changed

+5
-29
lines changed

2 files changed

+5
-29
lines changed

packages/unplugin-typia/src/bun.ts

+3-27
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,13 @@ import type { BunPlugin } from 'bun';
88
import type { UnpluginContextMeta } from 'unplugin';
99
import { hasCJSSyntax } from 'mlly';
1010
import { resolveOptions, unplugin } from './api.js';
11-
import { type Options, type ResolvedOptions, defaultOptions } from './core/options.js';
11+
import { type Options, defaultOptions } from './core/options.js';
1212
import { isBun } from './core/utils.js';
1313

1414
if (!isBun()) {
1515
throw new Error('You must use this plugin with bun');
1616
}
1717

18-
/**
19-
* Options for the bun plugin.
20-
*/
21-
export interface BunOptions extends Options {
22-
23-
/**
24-
* Whether to resolve the typia mjs path absolutely.
25-
*
26-
* @default true
27-
*/
28-
resolveAbsoluteTypiaPath?: boolean;
29-
}
30-
31-
type ResolvedBunOptions = ResolvedOptions & Required<Pick<BunOptions, 'resolveAbsoluteTypiaPath'>>;
32-
33-
function resolveBunOptions(options: BunOptions) {
34-
const resolvedOptions = resolveOptions(options);
35-
36-
return {
37-
...resolvedOptions,
38-
resolveAbsoluteTypiaPath: options.resolveAbsoluteTypiaPath ?? true,
39-
} satisfies ResolvedBunOptions;
40-
}
41-
4218
/**
4319
* bun plugin
4420
*
@@ -88,7 +64,7 @@ function resolveBunOptions(options: BunOptions) {
8864
* When you run your scripts on Bun.runtime, You cannot use named import for typia value in the source code. Check out the README.md.
8965
*/
9066
function bunTypiaPlugin(
91-
options?: BunOptions,
67+
options?: Options,
9268
): BunPlugin {
9369
const unpluginRaw = unplugin.raw(
9470
options,
@@ -104,7 +80,7 @@ function bunTypiaPlugin(
10480
const bunPlugin = ({
10581
name: 'unplugin-typia',
10682
async setup(build) {
107-
const resolvedOptions = resolveBunOptions(options ?? {});
83+
const resolvedOptions = resolveOptions(options ?? {});
10884
const { include } = resolvedOptions;
10985

11086
const filter = include instanceof RegExp

packages/unplugin-typia/src/core/options.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface Options {
4343
* if `true`, it will enable cache with and will use node_modules/.cache/unplugin_typia (if exists) or {TMP_DIR}/unplugin_typia
4444
* if `false`, it will disable cache.
4545
* if object, it will enable cache with custom path.
46-
* @default { enable: true, base: /* TMP_DIR *\/ }
46+
* @default { enable: true, base: TMP_DIR }
4747
*/
4848
cache?: CacheOptions | true | false;
4949

@@ -66,7 +66,7 @@ export interface CacheOptions {
6666

6767
/**
6868
* The base directory for cache.
69-
* @default '/tmp/unplugin_typia'
69+
* @default will use node_modules/.cache/unplugin_typia (if exists) or {TMP_DIR}/unplugin_typia
7070
*/
7171
base?: string;
7272
};

0 commit comments

Comments
 (0)