File tree Expand file tree Collapse file tree 8 files changed +114
-0
lines changed
Expand file tree Collapse file tree 8 files changed +114
-0
lines changed Original file line number Diff line number Diff line change 11import type { FilterPattern } from '@rollup/pluginutils'
22import type { TranspileOptions } from 'typescript'
33
4+ /**
5+ * Represents the options for the plugin.
6+ */
47export type Options = {
58 include ?: FilterPattern
69 exclude ?: FilterPattern
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ function tryImport<T>(pkg: string): Promise<T | null> {
1313 }
1414}
1515
16+ /**
17+ * Transform isolated declarations with `oxc-transform`.
18+ */
1619export async function oxcTransform (
1720 id : string ,
1821 code : string ,
@@ -29,6 +32,9 @@ export async function oxcTransform(
2932 return oxc . isolatedDeclaration ( id , code , { sourcemap : false } )
3033}
3134
35+ /**
36+ * Transform isolated declarations with `@swc/core`.
37+ */
3238export async function swcTransform (
3339 id : string ,
3440 code : string ,
@@ -70,6 +76,9 @@ export async function swcTransform(
7076 }
7177}
7278
79+ /**
80+ * Transform isolated declarations with `typescript`.
81+ */
7382export async function tsTransform (
7483 id : string ,
7584 code : string ,
Original file line number Diff line number Diff line change 1+ /**
2+ * This entry file is for esbuild plugin.
3+ *
4+ * @module
5+ */
6+
17import { IsolatedDecl } from './index'
28
9+ /**
10+ * Esbuild plugin
11+ *
12+ * @example
13+ * ```ts
14+ * import { build } from 'esbuild'
15+ *
16+ * build({
17+ * plugins: [require('unplugin-isolated-decl/esbuild')()],
18+ * })
19+ * ```
20+ */
321export default IsolatedDecl . esbuild as typeof IsolatedDecl . esbuild
Original file line number Diff line number Diff line change 1+ /**
2+ * This entry file is for Farm plugin.
3+ *
4+ * @module
5+ */
16/* eslint-disable import/no-default-export */
7+
28import { IsolatedDecl } from './index'
39
10+ /**
11+ * Farm plugin
12+ *
13+ * @example
14+ * ```ts
15+ * // farm.config.js
16+ * import IsolatedDecl from 'unplugin-isolated-decl/farm'
17+ *
18+ * export default {
19+ * plugins: [IsolatedDecl()],
20+ * }
21+ * ```
22+ */
423export default IsolatedDecl . farm as typeof IsolatedDecl . farm
Original file line number Diff line number Diff line change 1+ /**
2+ * This entry file is for main unplugin.
3+ * @module
4+ */
5+
16import { mkdir , readFile , writeFile } from 'node:fs/promises'
27import path from 'node:path'
38import { createFilter } from '@rollup/pluginutils'
@@ -33,6 +38,9 @@ import type {
3338
3439export type { Options }
3540
41+ /**
42+ * The main unplugin instance.
43+ */
3644export const IsolatedDecl : UnpluginInstance < Options | undefined , false > =
3745 createUnplugin ( ( rawOptions = { } ) => {
3846 const options = resolveOptions ( rawOptions )
Original file line number Diff line number Diff line change 1+ /**
2+ * This entry file is for Rolldown plugin.
3+ *
4+ * @module
5+ */
6+
17import { IsolatedDecl } from './index'
28
9+ /**
10+ * Rolldown plugin
11+ *
12+ * @example
13+ * ```ts
14+ * // rolldown.config.js
15+ * import IsolatedDecl from 'unplugin-isolated-decl/rolldown'
16+ *
17+ * export default {
18+ * plugins: [IsolatedDecl()],
19+ * }
20+ * ```
21+ */
322export default IsolatedDecl . rolldown as typeof IsolatedDecl . rolldown
Original file line number Diff line number Diff line change 1+ /**
2+ * This entry file is for Rollup plugin.
3+ *
4+ * @module
5+ */
6+
17import { IsolatedDecl } from './index'
28
9+ /**
10+ * Rollup plugin
11+ *
12+ * @example
13+ * ```ts
14+ * // rollup.config.js
15+ * import IsolatedDecl from 'unplugin-isolated-decl/rollup'
16+ *
17+ * export default {
18+ * plugins: [IsolatedDecl()],
19+ * }
20+ * ```
21+ */
322export default IsolatedDecl . rollup as typeof IsolatedDecl . rollup
Original file line number Diff line number Diff line change 1+ /**
2+ * This entry file is for Vite plugin.
3+ *
4+ * @module
5+ */
6+
17import { IsolatedDecl } from './index'
28
9+ /**
10+ * Vite plugin
11+ *
12+ * @example
13+ * ```ts
14+ * // vite.config.js
15+ * import IsolatedDecl from 'unplugin-isolated-decl/vite'
16+ *
17+ * export default {
18+ * plugins: [IsolatedDecl()],
19+ * }
20+ * ```
21+ */
322export default IsolatedDecl . vite as typeof IsolatedDecl . vite
You can’t perform that action at this time.
0 commit comments