unplugin-isolated-decl 0.10.7 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +1 -1
- package/dist/core/ast.d.ts +4 -4
- package/dist/core/options.d.ts +40 -37
- package/dist/core/transformer.d.ts +10 -10
- package/dist/core/utils.d.ts +3 -3
- package/dist/esbuild.d.ts +19 -18
- package/dist/esbuild.js +16 -3
- package/dist/farm.d.ts +20 -19
- package/dist/farm.js +17 -3
- package/dist/index.d.ts +5 -9
- package/dist/index.js +1 -1
- package/dist/rolldown.d.ts +20 -19
- package/dist/rolldown.js +17 -3
- package/dist/rollup.d.ts +20 -19
- package/dist/rollup.js +17 -3
- package/dist/{src-BKZ7wewR.js → src-eMzdAZrI.js} +37 -35
- package/dist/vite.d.ts +20 -19
- package/dist/vite.js +17 -3
- package/package.json +30 -50
- package/dist/api.cjs +0 -5
- package/dist/api.d.cts +0 -1
- package/dist/core/ast.d.cts +0 -8
- package/dist/core/options.d.cts +0 -44
- package/dist/core/transformer.d.cts +0 -20
- package/dist/core/utils.d.cts +0 -9
- package/dist/esbuild.cjs +0 -9
- package/dist/esbuild.d.cts +0 -20
- package/dist/farm.cjs +0 -9
- package/dist/farm.d.cts +0 -21
- package/dist/index.cjs +0 -4
- package/dist/index.d.cts +0 -11
- package/dist/rolldown.cjs +0 -9
- package/dist/rolldown.d.cts +0 -21
- package/dist/rollup.cjs +0 -9
- package/dist/rollup.d.cts +0 -21
- package/dist/src-CimtWZd6.cjs +0 -382
- package/dist/transformer-DzpBM_tn.cjs +0 -162
- package/dist/vite.cjs +0 -9
- package/dist/vite.d.cts +0 -21
package/dist/api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { oxcTransform, swcTransform, tsTransform } from
|
|
1
|
+
export { oxcTransform, swcTransform, tsTransform } from "./core/transformer.js";
|
package/dist/core/ast.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type * as OxcTypes from
|
|
2
|
-
import type MagicString from
|
|
1
|
+
import type * as OxcTypes from "@oxc-project/types";
|
|
2
|
+
import type MagicString from "magic-string";
|
|
3
3
|
export type OxcImport = (OxcTypes.ImportDeclaration | OxcTypes.ExportAllDeclaration | OxcTypes.ExportNamedDeclaration) & {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
source: OxcTypes.StringLiteral
|
|
5
|
+
shouldAddIndex?: boolean
|
|
6
6
|
};
|
|
7
7
|
export declare function filterImports(program: OxcTypes.Program): OxcImport[];
|
|
8
8
|
export declare function rewriteImports(s: MagicString, imports: OxcImport[], entryMap: Record<string, string> | undefined, inputBase: string, entryFileNames: string, srcFilename: string): string;
|
package/dist/core/options.d.ts
CHANGED
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
import type { TranspileOptions } from
|
|
2
|
-
import type { FilterPattern } from
|
|
1
|
+
import type { TranspileOptions } from "typescript";
|
|
2
|
+
import type { FilterPattern } from "unplugin-utils";
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
* Represents the options for the plugin.
|
|
5
|
+
*/
|
|
6
6
|
export type Options = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
7
|
+
include?: FilterPattern
|
|
8
|
+
exclude?: FilterPattern
|
|
9
|
+
enforce?: "pre" | "post" | undefined
|
|
10
|
+
/**
|
|
11
|
+
* Whether to generate declaration source maps.
|
|
12
|
+
*
|
|
13
|
+
* Supported by `typescript` and `oxc` transformer only.
|
|
14
|
+
*
|
|
15
|
+
* @link https://www.typescriptlang.org/tsconfig/#declarationMap
|
|
16
|
+
*/
|
|
17
|
+
sourceMap?: boolean
|
|
18
|
+
ignoreErrors?: boolean
|
|
19
|
+
/** An extra directory layer for output files. */
|
|
20
|
+
extraOutdir?: string
|
|
21
|
+
/** Patch `export default` in `.d.cts` to `export = ` */
|
|
22
|
+
patchCjsDefaultExport?: boolean
|
|
23
|
+
/** Base directory for input files. */
|
|
24
|
+
inputBase?: string
|
|
25
|
+
rewriteImports?: (id: string, importer: string) => string | void | null | undefined
|
|
26
26
|
} & ({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
/**
|
|
28
|
+
* `oxc-transform` or `@swc/core` should be installed yourself
|
|
29
|
+
* if you want to use `oxc` or `swc` transformer.
|
|
30
|
+
*/
|
|
31
|
+
transformer?: "oxc" | "swc"
|
|
32
32
|
} | {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
/**
|
|
34
|
+
* `typescript` should be installed yourself.
|
|
35
|
+
* @default 'typescript'
|
|
36
|
+
*/
|
|
37
|
+
transformer?: "typescript"
|
|
38
|
+
/** Only for typescript transformer */
|
|
39
|
+
transformOptions?: TranspileOptions
|
|
40
40
|
});
|
|
41
|
-
type Overwrite<
|
|
42
|
-
|
|
41
|
+
type Overwrite<
|
|
42
|
+
T,
|
|
43
|
+
U
|
|
44
|
+
> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
45
|
+
export type OptionsResolved = Overwrite<Required<Options>, Pick<Options, "enforce" | "extraOutdir" | "rewriteImports" | "inputBase">>;
|
|
43
46
|
export declare function resolveOptions(options: Options): OptionsResolved;
|
|
44
47
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { TranspileOptions } from
|
|
1
|
+
import type { TranspileOptions } from "typescript";
|
|
2
2
|
export interface TransformResult {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
code: string;
|
|
4
|
+
errors: Array<string>;
|
|
5
|
+
map?: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Transform isolated declarations with `oxc-transform`.
|
|
9
|
+
*/
|
|
10
10
|
export declare function oxcTransform(id: string, code: string, sourceMap?: boolean): Promise<TransformResult>;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
* Transform isolated declarations with `@swc/core`.
|
|
13
|
+
*/
|
|
14
14
|
export declare function swcTransform(id: string, code: string): Promise<TransformResult>;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
* Transform isolated declarations with `typescript`.
|
|
17
|
+
*/
|
|
18
18
|
export declare function tsTransform(id: string, code: string, transformOptions?: TranspileOptions, sourceMap?: boolean): Promise<TransformResult>;
|
|
19
19
|
export declare function appendMapUrl(map: string, filename: string): string;
|
|
20
20
|
export declare function generateDtsMap(mappings: string, src: string, dts: string): string;
|
package/dist/core/utils.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Debug from
|
|
1
|
+
import Debug from "debug";
|
|
2
2
|
export declare const debug: Debug.Debugger;
|
|
3
3
|
export declare function lowestCommonAncestor(...filepaths: string[]): string;
|
|
4
4
|
export declare function stripExt(filename: string): string;
|
|
5
5
|
export declare function resolveEntry(input: string | string[] | Record<string, string>, userInputBase?: string): {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
entryMap: Record<string, string> | undefined
|
|
7
|
+
inputBase: string
|
|
8
8
|
};
|
|
9
9
|
export declare function shouldAddIndex(id: string, resolved: string): boolean;
|
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IsolatedDecl } from
|
|
2
|
+
* This entry file is for esbuild plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from "./index.js";
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
declare const
|
|
20
|
-
export default
|
|
8
|
+
* Esbuild plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* import { build } from 'esbuild'
|
|
13
|
+
*
|
|
14
|
+
* build({
|
|
15
|
+
* plugins: [require('unplugin-isolated-decl/esbuild')()],
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const esbuild: typeof IsolatedDecl.esbuild;
|
|
20
|
+
export default esbuild;
|
|
21
|
+
export { esbuild as "module.exports" };
|
package/dist/esbuild.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import "./transformer-CBYRFUWY.js";
|
|
2
|
-
import { IsolatedDecl } from "./src-
|
|
2
|
+
import { IsolatedDecl } from "./src-eMzdAZrI.js";
|
|
3
3
|
|
|
4
4
|
//#region src/esbuild.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Esbuild plugin
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { build } from 'esbuild'
|
|
11
|
+
*
|
|
12
|
+
* build({
|
|
13
|
+
* plugins: [require('unplugin-isolated-decl/esbuild')()],
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
const esbuild = IsolatedDecl.esbuild;
|
|
18
|
+
var esbuild_default = esbuild;
|
|
6
19
|
|
|
7
20
|
//#endregion
|
|
8
|
-
export { esbuild_default as default };
|
|
21
|
+
export { esbuild_default as default, esbuild as 'module.exports' };
|
package/dist/farm.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IsolatedDecl } from
|
|
2
|
+
* This entry file is for Farm plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from "./index.js";
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
8
|
+
* Farm plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // farm.config.js
|
|
13
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/farm'
|
|
14
|
+
*
|
|
15
|
+
* export default {
|
|
16
|
+
* plugins: [IsolatedDecl()],
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const farm: typeof IsolatedDecl.farm;
|
|
21
|
+
export default farm;
|
|
22
|
+
export { farm as "module.exports" };
|
package/dist/farm.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import "./transformer-CBYRFUWY.js";
|
|
2
|
-
import { IsolatedDecl } from "./src-
|
|
2
|
+
import { IsolatedDecl } from "./src-eMzdAZrI.js";
|
|
3
3
|
|
|
4
4
|
//#region src/farm.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Farm plugin
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // farm.config.js
|
|
11
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/farm'
|
|
12
|
+
*
|
|
13
|
+
* export default {
|
|
14
|
+
* plugins: [IsolatedDecl()],
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const farm = IsolatedDecl.farm;
|
|
19
|
+
var farm_default = farm;
|
|
6
20
|
|
|
7
21
|
//#endregion
|
|
8
|
-
export { farm_default as default };
|
|
22
|
+
export { farm_default as default, farm as 'module.exports' };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
import { type UnpluginInstance } from "unplugin";
|
|
2
|
+
import { type Options } from "./core/options.js";
|
|
3
|
+
export type { Options };
|
|
1
4
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
import { type UnpluginInstance } from 'unplugin';
|
|
6
|
-
import { type Options } from './core/options.js';
|
|
7
|
-
export type { Options };
|
|
8
|
-
/**
|
|
9
|
-
* The main unplugin instance.
|
|
10
|
-
*/
|
|
5
|
+
* The main unplugin instance.
|
|
6
|
+
*/
|
|
11
7
|
export declare const IsolatedDecl: UnpluginInstance<Options | undefined, false>;
|
package/dist/index.js
CHANGED
package/dist/rolldown.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IsolatedDecl } from
|
|
2
|
+
* This entry file is for Rolldown plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from "./index.js";
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
8
|
+
* Rolldown plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // rolldown.config.js
|
|
13
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/rolldown'
|
|
14
|
+
*
|
|
15
|
+
* export default {
|
|
16
|
+
* plugins: [IsolatedDecl()],
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const rolldown: typeof IsolatedDecl.rolldown;
|
|
21
|
+
export default rolldown;
|
|
22
|
+
export { rolldown as "module.exports" };
|
package/dist/rolldown.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import "./transformer-CBYRFUWY.js";
|
|
2
|
-
import { IsolatedDecl } from "./src-
|
|
2
|
+
import { IsolatedDecl } from "./src-eMzdAZrI.js";
|
|
3
3
|
|
|
4
4
|
//#region src/rolldown.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Rolldown plugin
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // rolldown.config.js
|
|
11
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/rolldown'
|
|
12
|
+
*
|
|
13
|
+
* export default {
|
|
14
|
+
* plugins: [IsolatedDecl()],
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const rolldown = IsolatedDecl.rolldown;
|
|
19
|
+
var rolldown_default = rolldown;
|
|
6
20
|
|
|
7
21
|
//#endregion
|
|
8
|
-
export { rolldown_default as default };
|
|
22
|
+
export { rolldown_default as default, rolldown as 'module.exports' };
|
package/dist/rollup.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IsolatedDecl } from
|
|
2
|
+
* This entry file is for Rollup plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from "./index.js";
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
8
|
+
* Rollup plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // rollup.config.js
|
|
13
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/rollup'
|
|
14
|
+
*
|
|
15
|
+
* export default {
|
|
16
|
+
* plugins: [IsolatedDecl()],
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const rollup: typeof IsolatedDecl.rollup;
|
|
21
|
+
export default rollup;
|
|
22
|
+
export { rollup as "module.exports" };
|
package/dist/rollup.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import "./transformer-CBYRFUWY.js";
|
|
2
|
-
import { IsolatedDecl } from "./src-
|
|
2
|
+
import { IsolatedDecl } from "./src-eMzdAZrI.js";
|
|
3
3
|
|
|
4
4
|
//#region src/rollup.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Rollup plugin
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // rollup.config.js
|
|
11
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/rollup'
|
|
12
|
+
*
|
|
13
|
+
* export default {
|
|
14
|
+
* plugins: [IsolatedDecl()],
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const rollup = IsolatedDecl.rollup;
|
|
19
|
+
var rollup_default = rollup;
|
|
6
20
|
|
|
7
21
|
//#endregion
|
|
8
|
-
export { rollup_default as default };
|
|
22
|
+
export { rollup_default as default, rollup as 'module.exports' };
|
|
@@ -281,7 +281,7 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
281
281
|
build.onEnd(async (result) => {
|
|
282
282
|
const esbuildOptions = build.initialOptions;
|
|
283
283
|
const entries = esbuildOptions.entryPoints;
|
|
284
|
-
if (!
|
|
284
|
+
if (!entries || !Array.isArray(entries) || !entries.every((entry) => typeof entry === "string")) throw new Error("unsupported entryPoints, must be an string[]");
|
|
285
285
|
const inputBase = options.inputBase || lowestCommonAncestor(...entries);
|
|
286
286
|
debug("[esbuild] input base:", inputBase);
|
|
287
287
|
const jsExt = esbuildOptions.outExtension?.[".js"];
|
|
@@ -332,41 +332,43 @@ const IsolatedDecl = createUnplugin((rawOptions = {}) => {
|
|
|
332
332
|
});
|
|
333
333
|
async function resolve(context, id, importer) {
|
|
334
334
|
const nativeContext = context.getNativeBuildContext?.();
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
335
|
+
try {
|
|
336
|
+
switch (nativeContext?.framework) {
|
|
337
|
+
case "esbuild": {
|
|
338
|
+
const resolved = await nativeContext?.build.resolve(id, {
|
|
339
|
+
importer,
|
|
340
|
+
resolveDir: path.dirname(importer),
|
|
341
|
+
kind: "import-statement"
|
|
342
|
+
});
|
|
343
|
+
return {
|
|
344
|
+
id: resolved?.path,
|
|
345
|
+
external: resolved?.external
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
case "farm": {
|
|
349
|
+
const resolved = await nativeContext?.context.resolve({
|
|
350
|
+
source: id,
|
|
351
|
+
importer,
|
|
352
|
+
kind: "import"
|
|
353
|
+
}, {
|
|
354
|
+
meta: {},
|
|
355
|
+
caller: "unplugin-isolated-decl"
|
|
356
|
+
});
|
|
357
|
+
return {
|
|
358
|
+
id: resolved.resolvedPath,
|
|
359
|
+
external: !!resolved.external
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
default: {
|
|
363
|
+
const resolved = await context.resolve(id, importer);
|
|
364
|
+
if (!resolved) return;
|
|
365
|
+
return {
|
|
366
|
+
id: resolved.id,
|
|
367
|
+
external: !!resolved.external
|
|
368
|
+
};
|
|
369
|
+
}
|
|
368
370
|
}
|
|
369
|
-
}
|
|
371
|
+
} catch {}
|
|
370
372
|
}
|
|
371
373
|
function patchCjsDefaultExport(source) {
|
|
372
374
|
return source.replace(/(?<=(?:[;}]|^)\s*export\s*)(?:\{\s*([\w$]+)\s*as\s+default\s*\}|default\s+([\w$]+))/, (_, s1, s2) => `= ${s1 || s2}`);
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { IsolatedDecl } from
|
|
2
|
+
* This entry file is for Vite plugin.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { IsolatedDecl } from "./index.js";
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
declare const
|
|
21
|
-
export default
|
|
8
|
+
* Vite plugin
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // vite.config.ts
|
|
13
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/vite'
|
|
14
|
+
*
|
|
15
|
+
* export default defineConfig({
|
|
16
|
+
* plugins: [IsolatedDecl()],
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare const vite: typeof IsolatedDecl.vite;
|
|
21
|
+
export default vite;
|
|
22
|
+
export { vite as "module.exports" };
|
package/dist/vite.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import "./transformer-CBYRFUWY.js";
|
|
2
|
-
import { IsolatedDecl } from "./src-
|
|
2
|
+
import { IsolatedDecl } from "./src-eMzdAZrI.js";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Vite plugin
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // vite.config.ts
|
|
11
|
+
* import IsolatedDecl from 'unplugin-isolated-decl/vite'
|
|
12
|
+
*
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* plugins: [IsolatedDecl()],
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const vite = IsolatedDecl.vite;
|
|
19
|
+
var vite_default = vite;
|
|
6
20
|
|
|
7
21
|
//#endregion
|
|
8
|
-
export { vite_default as default };
|
|
22
|
+
export { vite_default as default, vite as 'module.exports' };
|