From 751aa10070b764646a65c030c9ac6c90b48f4df5 Mon Sep 17 00:00:00 2001 From: "Jesse.Feng" Date: Wed, 10 Apr 2024 23:12:33 +0800 Subject: [PATCH] =?UTF-8?q?feat(vite-plugin-combine):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?vite-plugin-combine=E6=8F=92=E4=BB=B6'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- docs/assets/highlight.css | 28 +++---- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- .../vite_plugin_combine_src.default.html | 2 +- .../functions/vite_plugin_cp_src.default.html | 4 +- .../vite_plugin_external_src.default.html | 4 +- .../vite_plugin_hook_use_src.default.html | 4 +- .../vite_plugin_include_css_src.default.html | 4 +- .../vite_plugin_mock_data_src.default.html | 4 +- ...vite_plugin_reverse_proxy_src.default.html | 4 +- .../vite_plugin_combine_src.Options.html | 29 +++---- .../vite_plugin_cp_src.Options.html | 14 ++-- .../interfaces/vite_plugin_cp_src.Target.html | 14 ++-- ...vite_plugin_external_src.BasicOptions.html | 8 +- .../vite_plugin_external_src.Options.html | 18 ++-- ...vite_plugin_mock_data_src.HandleRoute.html | 4 +- .../vite_plugin_mock_data_src.Options.html | 14 ++-- ...vite_plugin_mock_data_src.RouteConfig.html | 2 +- ...vite_plugin_reverse_proxy_src.Options.html | 6 +- docs/modules/vite_plugin_combine_src.html | 4 +- docs/modules/vite_plugin_cp_src.html | 2 +- docs/modules/vite_plugin_external_src.html | 2 +- docs/modules/vite_plugin_hook_use_src.html | 2 +- docs/modules/vite_plugin_include_css_src.html | 2 +- docs/modules/vite_plugin_mock_data_src.html | 2 +- .../vite_plugin_reverse_proxy_src.html | 2 +- .../vite_plugin_combine_src.CamelCase.html | 1 - ...vite_plugin_combine_src.TransformName.html | 1 + packages/vite-plugin-combine/dist/index.d.ts | 18 ++-- packages/vite-plugin-combine/dist/index.js | 52 ++++++------ packages/vite-plugin-combine/dist/index.mjs | 54 ++++++------ packages/vite-plugin-combine/package.json | 2 +- packages/vite-plugin-combine/src/index.ts | 83 ++++++++----------- 34 files changed, 185 insertions(+), 211 deletions(-) delete mode 100644 docs/types/vite_plugin_combine_src.CamelCase.html create mode 100644 docs/types/vite_plugin_combine_src.TransformName.html diff --git a/README.md b/README.md index f930614..faeacf2 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,5 @@ * [vite-plugin-external](packages/vite-plugin-external) - Provides a way of excluding dependencies from the runtime code and output bundles. * [vite-plugin-hook-use](packages/vite-plugin-hook-use) - Displays the sequence and frequency of vite calling its hook functions. * [vite-plugin-include-css](packages/vite-plugin-include-css) - build css into individual js files instead of using css links. -* [vite-plugin-mock-data](packages/vite-plugin-mock-data) - Provides a simple way to mock data。 +* [vite-plugin-mock-data](packages/vite-plugin-mock-data) - Provides a simple way to mock data. * [vite-plugin-reverse-proxy](packages/vite-plugin-reverse-proxy) - Makes the script to be served with the text/javascript MIME type instead of module MIME type. diff --git a/docs/assets/highlight.css b/docs/assets/highlight.css index 92a53f8..b9d3517 100644 --- a/docs/assets/highlight.css +++ b/docs/assets/highlight.css @@ -1,18 +1,18 @@ :root { - --light-hl-0: #0000FF; - --dark-hl-0: #569CD6; - --light-hl-1: #A31515; - --dark-hl-1: #CE9178; - --light-hl-2: #AF00DB; - --dark-hl-2: #C586C0; - --light-hl-3: #000000; - --dark-hl-3: #D4D4D4; - --light-hl-4: #001080; - --dark-hl-4: #9CDCFE; - --light-hl-5: #795E26; - --dark-hl-5: #DCDCAA; - --light-hl-6: #008000; - --dark-hl-6: #6A9955; + --light-hl-0: #A31515; + --dark-hl-0: #CE9178; + --light-hl-1: #AF00DB; + --dark-hl-1: #C586C0; + --light-hl-2: #000000; + --dark-hl-2: #D4D4D4; + --light-hl-3: #001080; + --dark-hl-3: #9CDCFE; + --light-hl-4: #795E26; + --dark-hl-4: #DCDCAA; + --light-hl-5: #008000; + --dark-hl-5: #6A9955; + --light-hl-6: #0000FF; + --dark-hl-6: #569CD6; --light-code-background: #FFFFFF; --dark-code-background: #1E1E1E; } diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 947f1a8..a83d71b 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62Vy27CMBBF/8XrpLSoUDXLZsOuUtUdQpZrT4iFY1t+IFDFv1eBFGIQiYOyv3PsOc5Mlr/Iwc6hDG25g1QLv+Yypar64RIm1lCUIE1ciTJUKeYF2EkdxKcgboLYGvpUukqgBG24ZCibJoiWXDADEmXL8yGf2nEl7QXKpQNTENrBbWqu+LP5ITljc1KByImFC9jtdQfzXHBFfX5/e5lNW2QGBfHCXbiFl/R4n7vspiQkz18PqxY2kK0jPOvxFetYu9/ErMHFAk/pLl6sU/2QTtg5MJKIfqn/yWi1H8RyGus3oLcru9Q8BI/gRioPsEPFl0ptUm8jtkadxN7Gr43I6wfcodfnkgrPIKXW9nfQhDG1duwmrtFD+6gU3aSMONLfRR3FdTS6hwWRTMCX8g56v9GQ3qocYwBCeMQEHE/OlSz4eiC8VTnCiIXsoY9rYAvGQqqN2u37H7iJ42N89D/ILX28TXTLvq9q9QcuTdMnxQgAAA==" \ No newline at end of file +window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAE62Vy27CMBBF/8XrpLSoUDXLsumqlaruELJce0KsOLblBwJV/HsVSCEGkTgo+ztnPMcZZ/mLHGwdytCGO0i18GsuU6qqHy5hYg1FCdLEFShDlWJegJ3UQXwM4iaIraEPhasESlDJJUPZNEG04IIZkChbnpp8aseVtGcolw5MTmgHt6m54M/m++SE/TZE2lyZ6oNUcIa7ne7gBkUX9MfXl6fZtNWBQU68cGd27iU9nOsmvykJyfPn/aqFDaTrCN96fNU62jIxa3CxwGO6ixfrVN+lE7YOjCSiX+p/MlrtG7GcxvoN6O3KLjV3wSO4kcoD7FDxhVJl6m3E61Ensbfxz0fk8QPu0ONzSYVnkFJr+ydowphaO/YQl+ihc1SKlikjjvRPUUdxHY2e4Z1IJuBLeQe932hIb1WOsQAhPGIDDp0XSuZ8PRDeqhxhxUL20Ms1sAFjIdVGbXf9F9zE8SE++h/kmj7eS3TNvq1q9QeIl4yXzQgAAA==" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index f703578..2fba562 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE71by47iyBL9l2TrosknULuZnsW9q5FGo7tBJURBVrfVxka26ceU6t+v0k7sCMjANphZUY94nMhzMhxpm3eWZz8K9rx6Z9/idMeeRcTSzd6yZ/Y9Lu3TITl+idOnbbZ/jVP7qci3LGLHPGHPbJ/tjoktPjm7dW239nbrIt9Ov5b7hEVsm2yKwhbsmbGPqMkyW865bnN93uxt8nlT2CZ6+etwJXZjH8gSscMmt2l5pQQARJsGxJ+HMs7SooEQp6XN3zbbKzi8y70o+EyoBgZc44EQJrXvIBinABSccpN/seXNiBr3UUFtL/QyFBeMMCo0+/OQ5eXNKpq0/qPC2t0BaTc+nO2P3e3UVb73wjFgbezb5pi0Gn87ptvKnMTjPe7uPuFme+jus4fuFgs629/99nAdtDYeUNrh3m52kbd/H6tye1dS+ra4ofaJdxsJRG6rH4bDaBxHAvKWbMrSpjcgaT1HgvIlyV5ff/W97F4COvcfCVaZb9LiLcv3N0CCvrfDMVrLdveu124YugfMtAkxENO0ree+melw47h0tbd8zbJvN2SeeL/ea9F1xU/fsnzblyB8sW9cxwJzy55CkG7eVCNc8QNwel/se4Gop9Gb1qV1vQPM8KHjcOO8cb5xwqOG/VnaPN0knQPHyXDQ2PH7poi3PaWIEkDH/jWjYm5X4XUkvQUJ0aAw9Jlm+9X+Eef34mvDPADkyeFOPicwzjgwb7gqIYwPkds+23VeF0gUE+89cH06GKxQZIfbUbUBxgXW8zJKAxtyMR0CLM129vdjnJTxHZKanEUZee28bfyP/cMe7kB5GWhcoEP779XWWxa7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QAAJza8M3rlCAz6KZk13dPHaDTbGSNv0TsEB9sEqeWPa9ePj7+D7FmYlT1QAAA"; \ No newline at end of file +window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAE71bSY/iyBL+L8nVRZMrULdZDu9dZqTR6F1QCVHg6rYabGSbXqZU//0p7bQdYTLwgpkTTVcsX+QXERl2Ju8sTb5n7Hnzzr5G8YE9i4DFu1PIntm3KA+fzsfL5yh+2ien1ygOP2XpngXskh7ZMzslh8sxzD5ZuW0pt3Vy2yzdz7/kpyML2P64y7IwY8+MfQS1l8V6yXXj6+90F2dvSXr6w36vPOQ/zzfsIx2Pt4Cdd2kY5zdCaQAZraWp4Wy31vVoHLNafxAcbAmulm6g/XnOoyTOamxRnIfp225/A6BTuXeJ+EKoGgZMhIEQZqXusKWpwibg5Lv0c5iPRlSrTwvKm9SDsbWsTAox/HFO0nx0Ns0a/UlhHe6AdJgezv77YTScUvdeOAasTfi2uxybXH+7xPtCnMTjNO6tf2JnOHdvCufu/QB0uL/71XJptBQeENr53q525bd/Pzt/alTJ1A+zEbHPnNpEINIw7tOyrmHUihMBeTvu8jyMRyBpNCeC8vmYvL7+7Lv9XgNq608Eq94eRkCCuuPh3BydRoCZD5meIKZ5E899s9N55Nh0s7d8SZKvIzzPnF7vteja8eO3JN33JQhv9rXqVGDG1BSCNLqoJtjxPXB6b/a9QJRT6ah1aVTvADN86DiPnDfaheMfNcIfeZjGu2PnwFEJDho7ft1l0b5nKiIHULF/zCiY8Vl4G0nvhIRokBkS2m7/Jfw9Su/F15h5AMhK4U4+Z9DONDBH7EoI40PS7ZQcOvcFEsXMaQ9cnw4GCxTJeTyqxsC0wHpuozSwIZvpEGBxcgh/vUTHPLojpWYtKxOvnZON/gl/D893oLw2NC3Qof33ZuvNs8NTlD1F8ZcwjfLwMAnAMV24uwE/Auq4XtyjDU8EdvCwg3AOHnmIfuwffOwjwNMl6379bgW3l6z7/fvgaJHlwdGiALqijeL98XIIn/ZZ1hmwk93us2z6mNv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/functions/vite_plugin_combine_src.default.html b/docs/functions/vite_plugin_combine_src.default.html index a0ca762..5bc0375 100644 --- a/docs/functions/vite_plugin_combine_src.default.html +++ b/docs/functions/vite_plugin_combine_src.default.html @@ -1 +1 @@ -default | vite-plugins

Generated using TypeDoc

\ No newline at end of file +default | vite-plugins

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/functions/vite_plugin_cp_src.default.html b/docs/functions/vite_plugin_cp_src.default.html index 7df0c0e..22f5bbd 100644 --- a/docs/functions/vite_plugin_cp_src.default.html +++ b/docs/functions/vite_plugin_cp_src.default.html @@ -1,6 +1,6 @@ default | vite-plugins
  • Copy files and directories.

    Parameters

    Returns Plugin

    a vite plugin

    -

    Example

    import { defineConfig } from 'vite';
    import cp from 'vite-plugin-cp';

    export default defineConfig({
    plugins: [
    cp({
    targets: [
    // copy files of './node_modules/vite/dist' to 'dist/test'
    { src: './node_modules/vite/dist', dest: 'dist/test' },

    // copy files of './node_modules/vite/dist' to 'dist/test2'
    // and keep the directory structure of copied files
    { src: './node_modules/vite/dist', dest: 'dist/test2', flatten: false },

    // copy './node_modules/vite/README.md' to 'dist'
    { src: './node_modules/vite/README.md', dest: 'dist' },
    ]
    })
    ]
    }); +

    Example

    import { defineConfig } from 'vite';
    import cp from 'vite-plugin-cp';

    export default defineConfig({
    plugins: [
    cp({
    targets: [
    // copy files of './node_modules/vite/dist' to 'dist/test'
    { src: './node_modules/vite/dist', dest: 'dist/test' },

    // copy files of './node_modules/vite/dist' to 'dist/test2'
    // and keep the directory structure of copied files
    { src: './node_modules/vite/dist', dest: 'dist/test2', flatten: false },

    // copy './node_modules/vite/README.md' to 'dist'
    { src: './node_modules/vite/README.md', dest: 'dist' },
    ]
    })
    ]
    });
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/functions/vite_plugin_external_src.default.html b/docs/functions/vite_plugin_external_src.default.html index 3f32b27..11fd869 100644 --- a/docs/functions/vite_plugin_external_src.default.html +++ b/docs/functions/vite_plugin_external_src.default.html @@ -1,6 +1,6 @@ default | vite-plugins
  • provides a way of excluding dependencies from the runtime code and output bundles.

    Parameters

    Returns Plugin

    a vite plugin

    -

    Example

    import createExternal from 'vite-plugin-external';

    export default defineConfig({
    plugins: [
    createExternal({
    externals: {
    react: 'React'
    }
    })
    ],
    build: {
    cssCodeSplit: false,
    rollupOptions: {
    output: {
    manualChunks: undefined,
    assetFileNames: 'assets/[name][extname]',
    entryFileNames: '[name].js',
    format: 'iife'
    }
    }
    }
    }); +

    Example

    import createExternal from 'vite-plugin-external';

    export default defineConfig({
    plugins: [
    createExternal({
    externals: {
    react: 'React'
    }
    })
    ],
    build: {
    cssCodeSplit: false,
    rollupOptions: {
    output: {
    manualChunks: undefined,
    assetFileNames: 'assets/[name][extname]',
    entryFileNames: '[name].js',
    format: 'iife'
    }
    }
    }
    });
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/functions/vite_plugin_hook_use_src.default.html b/docs/functions/vite_plugin_hook_use_src.default.html index 3144bde..1f240a8 100644 --- a/docs/functions/vite_plugin_hook_use_src.default.html +++ b/docs/functions/vite_plugin_hook_use_src.default.html @@ -1,5 +1,5 @@ default | vite-plugins
  • Shows the usage of the hook function of the vite plugin.

    Returns Plugin

    a vite plugin

    -

    Example

    import { defineConfig } from 'vite';
    import vitePluginHookUse from 'vite-plugin-hook-use';

    export default defineConfig({
    plugins: [
    vitePluginHookUse()
    ]
    }); +

    Example

    import { defineConfig } from 'vite';
    import vitePluginHookUse from 'vite-plugin-hook-use';

    export default defineConfig({
    plugins: [
    vitePluginHookUse()
    ]
    });
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/functions/vite_plugin_include_css_src.default.html b/docs/functions/vite_plugin_include_css_src.default.html index 4c3411d..d9f06a5 100644 --- a/docs/functions/vite_plugin_include_css_src.default.html +++ b/docs/functions/vite_plugin_include_css_src.default.html @@ -1,5 +1,5 @@ default | vite-plugins
  • build css into individual js files instead of using css links.

    Returns Plugin

    a vite plugin

    -

    Example

    import { defineConfig } from 'vite';
    import includeCSS from 'vite-plugin-include-css';

    export default defineConfig({
    plugins: [
    includeCSS()
    ],
    build: {
    cssCodeSplit: false,
    rollupOptions: {
    output: {
    manualChunks: undefined,
    assetFileNames: 'assets/[name][extname]',
    entryFileNames: '[name].js',
    format: 'iife'
    }
    }
    }
    }); +

    Example

    import { defineConfig } from 'vite';
    import includeCSS from 'vite-plugin-include-css';

    export default defineConfig({
    plugins: [
    includeCSS()
    ],
    build: {
    cssCodeSplit: false,
    rollupOptions: {
    output: {
    manualChunks: undefined,
    assetFileNames: 'assets/[name][extname]',
    entryFileNames: '[name].js',
    format: 'iife'
    }
    }
    }
    });
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/functions/vite_plugin_mock_data_src.default.html b/docs/functions/vite_plugin_mock_data_src.default.html index 1ca03ba..7961aa4 100644 --- a/docs/functions/vite_plugin_mock_data_src.default.html +++ b/docs/functions/vite_plugin_mock_data_src.default.html @@ -1,6 +1,6 @@ default | vite-plugins
  • Provides a simple way to mock data.

    Parameters

    Returns Plugin

    a vite plugin

    -

    Example

    import { defineConfig } from 'vite';
    import mockData from 'vite-plugin-mock-data';

    export default defineConfig({
    plugins: [
    mockData({
    mockRoutesDir: './mock'
    })
    ]
    }); +

    Example

    import { defineConfig } from 'vite';
    import mockData from 'vite-plugin-mock-data';

    export default defineConfig({
    plugins: [
    mockData({
    mockRoutesDir: './mock'
    })
    ]
    });
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/functions/vite_plugin_reverse_proxy_src.default.html b/docs/functions/vite_plugin_reverse_proxy_src.default.html index 3c0604a..97f549c 100644 --- a/docs/functions/vite_plugin_reverse_proxy_src.default.html +++ b/docs/functions/vite_plugin_reverse_proxy_src.default.html @@ -1,6 +1,6 @@ default | vite-plugins
  • Makes the script to be served with the text/javascript MIME type instead of module MIME type.

    Parameters

    Returns {
        name: string;
        config(config): void;
        configResolved(config): void;
        load(id): undefined | string;
    }

    a vite plugin

    -

    Example

    import { defineConfig } from 'vite';
    import reverseProxy from 'vite-plugin-reverse-proxy';

    export default defineConfig({
    plugins: [
    reverseProxy({
    targets: {
    '/app.js':'src/main.jsx'
    }
    }),
    ]
    }); +

    Example

    import { defineConfig } from 'vite';
    import reverseProxy from 'vite-plugin-reverse-proxy';

    export default defineConfig({
    plugins: [
    reverseProxy({
    targets: {
    '/app.js':'src/main.jsx'
    }
    }),
    ]
    });
    -

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_combine_src.Options.html b/docs/interfaces/vite_plugin_combine_src.Options.html index a531c91..77d7f01 100644 --- a/docs/interfaces/vite_plugin_combine_src.Options.html +++ b/docs/interfaces/vite_plugin_combine_src.Options.html @@ -1,25 +1,22 @@ -Options | vite-plugins
interface Options {
    camelCase?: Options;
    cwd?: string;
    dts?: boolean;
    exports?: "named" | "default" | "none";
    src: string | string[];
    target: string;
}

Properties

camelCase? -cwd? +Options | vite-plugins
interface Options {
    cwd?: string;
    dts?: string;
    exports?: "named" | "default" | "none";
    src: string | string[];
    target: string;
    transformName?: boolean | TransformName;
}

Properties

camelCase?: Options

Configuration for the camelcase function. -https://github.com/sindresorhus/camelcase?tab=readme-ov-file#camelcaseinput-options

-

camelcase 函数的配置

-
cwd?: string

Current Working Directory.

+transformName? +

Properties

cwd?: string

Current Working Directory.

当前工作目录

-
dts?: boolean

Whether to generate .d.ts files.

-

是否生成 d.ts 文件

-

Default

false
-
-
exports?: "named" | "default" | "none"

Exported module types.

+
dts?: string

Generate the index.d.ts file to a specified path.

+

生成 index.d.ts 文件到指定路径

+
exports?: "named" | "default" | "none"

Exported module types.

导出的模块类型

-

Default

'named'
+

Default

'named'
 
-
src: string | string[]

Files prepared for merging.

+
src: string | string[]

Files prepared for merging.

准备合并的文件

-
target: string

Merging into the target file.

-

Default

'index.js'
+
target: string

Merging into the target file.

+

Default

'index.js'
 
-

Generated using TypeDoc

\ No newline at end of file +
transformName?: boolean | TransformName

Transform file names

+

转换文件名

+

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_cp_src.Options.html b/docs/interfaces/vite_plugin_cp_src.Options.html index e121dc5..85527f3 100644 --- a/docs/interfaces/vite_plugin_cp_src.Options.html +++ b/docs/interfaces/vite_plugin_cp_src.Options.html @@ -1,4 +1,4 @@ -Options | vite-plugins
interface Options {
    cwd?: string;
    enforce?: "pre" | "post";
    globbyOptions?: Options;
    hook?: string;
    targets: Target[];
}

Properties

cwd? +Options | vite-plugins
interface Options {
    cwd?: string;
    enforce?: "pre" | "post";
    globbyOptions?: Options;
    hook?: string;
    targets: Target[];
}

Properties

cwd? enforce? globbyOptions? hook? @@ -6,14 +6,14 @@

Properties

cwd?: string

Default process.cwd(), The current working directory in which to search.

默认 process.cwd(),用于拼接 src 的路径。

Default

process.cwd()

-
enforce?: "pre" | "post"

The value of enforce can be either "pre" or "post", see more at https://vitejs.dev/guide/api-plugin.html#plugin-ordering.

+
enforce?: "pre" | "post"

The value of enforce can be either "pre" or "post", see more at https://vitejs.dev/guide/api-plugin.html#plugin-ordering.

强制执行顺序,pre 前,post 后,参考 https://cn.vitejs.dev/guide/api-plugin.html#plugin-ordering

-
globbyOptions?: Options

Options for globby. See more at https://github.com/sindresorhus/globby#options

+
globbyOptions?: Options

Options for globby. See more at https://github.com/sindresorhus/globby#options

globby 的选项,设置 src 的匹配参数。

-
hook?: string

Default 'closeBundle', vite hook the plugin should use.

+
hook?: string

Default 'closeBundle', vite hook the plugin should use.

默认 'closeBundle',调用指定钩子函数时开始复制。

-

Default

'closeBundle'
+

Default

'closeBundle'
 
-
targets: Target[]

Array of targets to copy.

+
targets: Target[]

Array of targets to copy.

复制文件的规则配置。

-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_cp_src.Target.html b/docs/interfaces/vite_plugin_cp_src.Target.html index 3db4752..498c024 100644 --- a/docs/interfaces/vite_plugin_cp_src.Target.html +++ b/docs/interfaces/vite_plugin_cp_src.Target.html @@ -1,4 +1,4 @@ -Target | vite-plugins
interface Target {
    dest: string;
    flatten?: boolean;
    globbyOptions?: Options;
    rename?: string | ((name) => string);
    src: string | string[];
    transform?: ((buf, matchedPath) => string | Buffer | Promise<string | Buffer>);
}

Properties

dest +Target | vite-plugins
interface Target {
    dest: string;
    flatten?: boolean;
    globbyOptions?: Options;
    rename?: string | ((name) => string);
    src: string | string[];
    transform?: ((buf, matchedPath) => string | Buffer | Promise<string | Buffer>);
}

Properties

Properties

dest: string

One or more destinations where to copy.

复制到目标目录。

-
flatten?: boolean

Remove the directory structure of copied files, if src is a directory.

+
flatten?: boolean

Remove the directory structure of copied files, if src is a directory.

是否删除复制的文件目录结构,src 为目录时有效。

-
globbyOptions?: Options

Options for globby. See more at https://github.com/sindresorhus/globby#options

+
globbyOptions?: Options

Options for globby. See more at https://github.com/sindresorhus/globby#options

globby 的选项,设置 src 的匹配参数

-
rename?: string | ((name) => string)

Rename the file after copying.

+
rename?: string | ((name) => string)

Rename the file after copying.

复制后重命名文件。

-

Type declaration

    • (name): string
    • Parameters

      • name: string

      Returns string

src: string | string[]

Path or glob of what to copy.

+

Type declaration

    • (name): string
    • Parameters

      • name: string

      Returns string

src: string | string[]

Path or glob of what to copy.

要复制的目录、文件或者 globby 匹配规则。

-
transform?: ((buf, matchedPath) => string | Buffer | Promise<string | Buffer>)

Transform the file before copying.

+
transform?: ((buf, matchedPath) => string | Buffer | Promise<string | Buffer>)

Transform the file before copying.

复制前转换文件内容。

-

Type declaration

    • (buf, matchedPath): string | Buffer | Promise<string | Buffer>
    • Parameters

      • buf: Buffer
      • matchedPath: string

      Returns string | Buffer | Promise<string | Buffer>

Generated using TypeDoc

\ No newline at end of file +

Type declaration

    • (buf, matchedPath): string | Buffer | Promise<string | Buffer>
    • Parameters

      • buf: Buffer
      • matchedPath: string

      Returns string | Buffer | Promise<string | Buffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_external_src.BasicOptions.html b/docs/interfaces/vite_plugin_external_src.BasicOptions.html index 08097ef..75364e8 100644 --- a/docs/interfaces/vite_plugin_external_src.BasicOptions.html +++ b/docs/interfaces/vite_plugin_external_src.BasicOptions.html @@ -1,12 +1,12 @@ -BasicOptions | vite-plugins
interface BasicOptions {
    cacheDir?: string;
    cwd?: string;
    externals?: Record<string, any>;
}

Hierarchy (view full)

Properties

cacheDir? +BasicOptions | vite-plugins
interface BasicOptions {
    cacheDir?: string;
    cwd?: string;
    externals?: Record<string, any>;
}

Hierarchy (view full)

Properties

cacheDir?: string

Cache folder

缓存文件夹

Default

${cwd}/node_modules/.vite_external

-
cwd?: string

The current working directory in which to join cacheDir.

+
cwd?: string

The current working directory in which to join cacheDir.

用于拼接 cacheDir 的路径。

Default

process.cwd()

-
externals?: Record<string, any>

External dependencies

+
externals?: Record<string, any>

External dependencies

配置外部依赖

-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_external_src.Options.html b/docs/interfaces/vite_plugin_external_src.Options.html index 0b15e05..d4745ad 100644 --- a/docs/interfaces/vite_plugin_external_src.Options.html +++ b/docs/interfaces/vite_plugin_external_src.Options.html @@ -1,6 +1,6 @@ Options | vite-plugins
interface Options {
    cacheDir?: string;
    cwd?: string;
    enforce?: "pre" | "post";
    externalizeDeps?: (string | RegExp)[];
    externals?: Record<string, any>;
    interop?: "auto";
    mode?: string;
    nodeBuiltins?: boolean;
    [mode: string]: BasicOptions | any;
}

Hierarchy (view full)

Indexable

[mode: string]: BasicOptions | any

External dependencies for specific mode

针对指定的模式配置外部依赖

-

Properties

Properties

Properties

cacheDir?: string

Cache folder

缓存文件夹

Default

${cwd}/node_modules/.vite_external

-
cwd?: string

The current working directory in which to join cacheDir.

+
cwd?: string

The current working directory in which to join cacheDir.

用于拼接 cacheDir 的路径。

Default

process.cwd()

-
enforce?: "pre" | "post"

The value of enforce can be either "pre" or "post", see more at https://vitejs.dev/guide/api-plugin.html#plugin-ordering.

+
enforce?: "pre" | "post"

The value of enforce can be either "pre" or "post", see more at https://vitejs.dev/guide/api-plugin.html#plugin-ordering.

强制执行顺序,pre 前,post 后,参考 https://cn.vitejs.dev/guide/api-plugin.html#plugin-ordering。

-
externalizeDeps?: (string | RegExp)[]

Specify dependencies to not be included in the bundle

+
externalizeDeps?: (string | RegExp)[]

Specify dependencies to not be included in the bundle

排除不需要打包的依赖。

-
externals?: Record<string, any>

External dependencies

+
externals?: Record<string, any>

External dependencies

配置外部依赖

-
interop?: "auto"

Controls how Rollup handles default.

+
interop?: "auto"

Controls how Rollup handles default.

用于控制读取外部依赖的默认值。

-
mode?: string

Different externals can be specified in different modes.

+
mode?: string

Different externals can be specified in different modes.

在不同的模式下,可以指定不同的外部依赖。

-
nodeBuiltins?: boolean

Whether to exclude nodejs built-in modules in the bundle

+
nodeBuiltins?: boolean

Whether to exclude nodejs built-in modules in the bundle

是否排除 nodejs 内置模块。

-

Generated using TypeDoc

\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_mock_data_src.HandleRoute.html b/docs/interfaces/vite_plugin_mock_data_src.HandleRoute.html index 52d2627..b8c3842 100644 --- a/docs/interfaces/vite_plugin_mock_data_src.HandleRoute.html +++ b/docs/interfaces/vite_plugin_mock_data_src.HandleRoute.html @@ -1,5 +1,5 @@ -HandleRoute | vite-plugins
interface HandleRoute {
    file?: string;
    handler?: any;
    options?: RouteOptions;
    store?: any;
}

Properties

file? +HandleRoute | vite-plugins
interface HandleRoute {
    file?: string;
    handler?: any;
    options?: RouteOptions;
    store?: any;
}

Properties

file?: string
handler?: any
options?: RouteOptions
store?: any

Generated using TypeDoc

\ No newline at end of file +

Properties

file?: string
handler?: any
options?: RouteOptions
store?: any

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_mock_data_src.Options.html b/docs/interfaces/vite_plugin_mock_data_src.Options.html index 106d109..cc75e62 100644 --- a/docs/interfaces/vite_plugin_mock_data_src.Options.html +++ b/docs/interfaces/vite_plugin_mock_data_src.Options.html @@ -1,4 +1,4 @@ -Options | vite-plugins
interface Options {
    cwd?: string;
    isAfter?: boolean;
    mockAssetsDir?: string;
    mockRouterOptions?: Config<V1> | Config<V2>;
    mockRoutes?: RouteConfig | RouteConfig[];
    mockRoutesDir?: string;
}

Properties

cwd? +Options | vite-plugins
interface Options {
    cwd?: string;
    isAfter?: boolean;
    mockAssetsDir?: string;
    mockRouterOptions?: Config<V1> | Config<V2>;
    mockRoutes?: RouteConfig | RouteConfig[];
    mockRoutesDir?: string;
}

Properties

cwd?: string

The directory to serve files from.

Default

process.cwd()

-
isAfter?: boolean

If true, these mock routes is matched after internal middlewares are installed.

+
isAfter?: boolean

If true, these mock routes is matched after internal middlewares are installed.

Default

false

-
mockAssetsDir?: string

Specify the directory to define mock assets.

-
mockRouterOptions?: Config<V1> | Config<V2>

Initial options of find-my-way. see more at https://github.com/delvedor/find-my-way#findmywayoptions

-
mockRoutes?: RouteConfig | RouteConfig[]

Initial list of mock routes that should be added to the dev server.

-
mockRoutesDir?: string

Specify the directory to define mock routes that should be added to the dev server.

-

Generated using TypeDoc

\ No newline at end of file +
mockAssetsDir?: string

Specify the directory to define mock assets.

+
mockRouterOptions?: Config<V1> | Config<V2>

Initial options of find-my-way. see more at https://github.com/delvedor/find-my-way#findmywayoptions

+
mockRoutes?: RouteConfig | RouteConfig[]

Initial list of mock routes that should be added to the dev server.

+
mockRoutesDir?: string

Specify the directory to define mock routes that should be added to the dev server.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_mock_data_src.RouteConfig.html b/docs/interfaces/vite_plugin_mock_data_src.RouteConfig.html index 755ca04..6866005 100644 --- a/docs/interfaces/vite_plugin_mock_data_src.RouteConfig.html +++ b/docs/interfaces/vite_plugin_mock_data_src.RouteConfig.html @@ -1 +1 @@ -RouteConfig | vite-plugins
interface RouteConfig {
    [route: string]: string | Handler<HTTPVersion.V1> | HandleRoute;
}

Indexable

[route: string]: string | Handler<HTTPVersion.V1> | HandleRoute

Generated using TypeDoc

\ No newline at end of file +RouteConfig | vite-plugins
interface RouteConfig {
    [route: string]: string | Handler<HTTPVersion.V1> | HandleRoute;
}

Indexable

[route: string]: string | Handler<HTTPVersion.V1> | HandleRoute

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/interfaces/vite_plugin_reverse_proxy_src.Options.html b/docs/interfaces/vite_plugin_reverse_proxy_src.Options.html index fe8376b..d02105a 100644 --- a/docs/interfaces/vite_plugin_reverse_proxy_src.Options.html +++ b/docs/interfaces/vite_plugin_reverse_proxy_src.Options.html @@ -1,5 +1,5 @@ -Options | vite-plugins
interface Options {
    preambleCode?: string;
    targets: Record<string, string>;
}

Properties

preambleCode? +Options | vite-plugins
interface Options {
    preambleCode?: string;
    targets: Record<string, string>;
}

Properties

preambleCode?: string

The preamble code to be injected before the main script.

-
targets: Record<string, string>

The target script to be proxied.

-

Generated using TypeDoc

\ No newline at end of file +
targets: Record<string, string>

The target script to be proxied.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/vite_plugin_combine_src.html b/docs/modules/vite_plugin_combine_src.html index 3c495db..5f05ebe 100644 --- a/docs/modules/vite_plugin_combine_src.html +++ b/docs/modules/vite_plugin_combine_src.html @@ -1,4 +1,4 @@ -vite-plugin-combine/src | vite-plugins

Module vite-plugin-combine/src

Index

Interfaces

Type Aliases

CamelCase +vite-plugin-combine/src | vite-plugins

Module vite-plugin-combine/src

Index

Interfaces

Type Aliases

Functions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/vite_plugin_cp_src.html b/docs/modules/vite_plugin_cp_src.html index e3f71ea..24d64e1 100644 --- a/docs/modules/vite_plugin_cp_src.html +++ b/docs/modules/vite_plugin_cp_src.html @@ -1,4 +1,4 @@ -vite-plugin-cp/src | vite-plugins

Module vite-plugin-cp/src

Index

Interfaces

Options +vite-plugin-cp/src | vite-plugins

Module vite-plugin-cp/src

Index

Interfaces

Functions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/vite_plugin_external_src.html b/docs/modules/vite_plugin_external_src.html index 999aad4..9c4de02 100644 --- a/docs/modules/vite_plugin_external_src.html +++ b/docs/modules/vite_plugin_external_src.html @@ -1,4 +1,4 @@ -vite-plugin-external/src | vite-plugins

Module vite-plugin-external/src

Index

Interfaces

BasicOptions +vite-plugin-external/src | vite-plugins

Module vite-plugin-external/src

Index

Interfaces

Functions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/vite_plugin_hook_use_src.html b/docs/modules/vite_plugin_hook_use_src.html index 0df026e..0fea0a8 100644 --- a/docs/modules/vite_plugin_hook_use_src.html +++ b/docs/modules/vite_plugin_hook_use_src.html @@ -1,2 +1,2 @@ -vite-plugin-hook-use/src | vite-plugins

Module vite-plugin-hook-use/src

Index

Functions

default +vite-plugin-hook-use/src | vite-plugins

Module vite-plugin-hook-use/src

Index

Functions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/vite_plugin_include_css_src.html b/docs/modules/vite_plugin_include_css_src.html index 3f13b48..89fae79 100644 --- a/docs/modules/vite_plugin_include_css_src.html +++ b/docs/modules/vite_plugin_include_css_src.html @@ -1,2 +1,2 @@ -vite-plugin-include-css/src | vite-plugins

Module vite-plugin-include-css/src

Index

Functions

default +vite-plugin-include-css/src | vite-plugins

Module vite-plugin-include-css/src

Index

Functions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/modules/vite_plugin_mock_data_src.html b/docs/modules/vite_plugin_mock_data_src.html index 304eb29..30b5215 100644 --- a/docs/modules/vite_plugin_mock_data_src.html +++ b/docs/modules/vite_plugin_mock_data_src.html @@ -1,4 +1,4 @@ -vite-plugin-mock-data/src | vite-plugins

Module vite-plugin-mock-data/src

Index

Interfaces

HandleRoute +vite-plugin-mock-data/src | vite-plugins

Module vite-plugin-mock-data/src

Index

Interfaces

Functions

default diff --git a/docs/modules/vite_plugin_reverse_proxy_src.html b/docs/modules/vite_plugin_reverse_proxy_src.html index caaa04f..c0cb6c9 100644 --- a/docs/modules/vite_plugin_reverse_proxy_src.html +++ b/docs/modules/vite_plugin_reverse_proxy_src.html @@ -1,3 +1,3 @@ -vite-plugin-reverse-proxy/src | vite-plugins

Module vite-plugin-reverse-proxy/src

Index

Interfaces

Options +vite-plugin-reverse-proxy/src | vite-plugins

Module vite-plugin-reverse-proxy/src

Index

Interfaces

Functions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/types/vite_plugin_combine_src.CamelCase.html b/docs/types/vite_plugin_combine_src.CamelCase.html deleted file mode 100644 index 5e3f7fd..0000000 --- a/docs/types/vite_plugin_combine_src.CamelCase.html +++ /dev/null @@ -1 +0,0 @@ -CamelCase | vite-plugins
CamelCase: CamelCaseOptions

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/types/vite_plugin_combine_src.TransformName.html b/docs/types/vite_plugin_combine_src.TransformName.html new file mode 100644 index 0000000..430782e --- /dev/null +++ b/docs/types/vite_plugin_combine_src.TransformName.html @@ -0,0 +1 @@ +TransformName | vite-plugins
TransformName: ((name, filePath) => string)

Type declaration

    • (name, filePath): string
    • Parameters

      • name: string
      • filePath: string

      Returns string

Generated using TypeDoc

\ No newline at end of file diff --git a/packages/vite-plugin-combine/dist/index.d.ts b/packages/vite-plugin-combine/dist/index.d.ts index 31be2b7..f843a14 100644 --- a/packages/vite-plugin-combine/dist/index.d.ts +++ b/packages/vite-plugin-combine/dist/index.d.ts @@ -1,6 +1,5 @@ -import { Options as CamelCaseOptions } from 'camelcase'; import { Plugin } from 'vite'; -export type CamelCase = CamelCaseOptions; +export type TransformName = (name: string, filePath: string) => string; export interface Options { /** * Files prepared for merging. @@ -15,12 +14,11 @@ export interface Options { */ target: string; /** - * Configuration for the camelcase function. - * https://github.com/sindresorhus/camelcase?tab=readme-ov-file#camelcaseinput-options + * Transform file names * - * camelcase 函数的配置 + * 转换文件名 */ - camelCase?: CamelCaseOptions; + transformName?: TransformName | boolean; /** * Exported module types. * @@ -30,13 +28,11 @@ export interface Options { */ exports?: 'named' | 'default' | 'none'; /** - * Whether to generate `.d.ts` files. + * Generate the `index.d.ts` file to a specified path. * - * 是否生成 d.ts 文件 - * - * @default false + * 生成 `index.d.ts` 文件到指定路径 */ - dts?: boolean; + dts?: string; /** * Current Working Directory. * diff --git a/packages/vite-plugin-combine/dist/index.js b/packages/vite-plugin-combine/dist/index.js index bc59c17..71c2240 100644 --- a/packages/vite-plugin-combine/dist/index.js +++ b/packages/vite-plugin-combine/dist/index.js @@ -4,30 +4,34 @@ const node_path = require("node:path"); const node_fs = require("node:fs"); const camelCase = require("camelcase"); const globby = require("globby"); -function camelCaseName(file, camelCaseOptions) { - let { name } = node_path.parse(file); - if (camelCaseOptions !== false) { - name = camelCase(name, camelCaseOptions); +function camelCaseName(name, filePath, transformName) { + if (transformName) { + switch (typeof transformName) { + case "boolean": + return camelCase(name); + case "function": + return transformName(name, filePath); + } } return name; } -function namedExport(files, target, camelCaseOptions) { +function namedExport(files, target, transformName) { return files.map((file) => { const { name, dir } = node_path.parse(file); - const exportName = camelCaseName(name, camelCaseOptions); + const exportName = camelCaseName(name, file, transformName); const relativeDir = node_path.relative(node_path.dirname(target), dir); - return `export { default as ${exportName} } from '${relativeDir ? node_path.join(relativeDir, name) : `./${name}`}';`; + return `export { default as ${exportName} } from '${`./${node_path.join(relativeDir, name)}`}';`; }).join(node_os.EOL); } -function defaultExport(files, target, camelCaseOptions) { +function defaultExport(files, target, transformName) { const importDeclare = []; const exportDeclare = []; let exportName; for (const file of files) { const { name, dir } = node_path.parse(file); - exportName = camelCaseName(name, camelCaseOptions); + exportName = camelCaseName(name, file, transformName); const relativeDir = node_path.relative(node_path.dirname(target), dir); - importDeclare[importDeclare.length] = `import ${exportName} from '${relativeDir ? node_path.join(relativeDir, name) : `./${name}`}';`; + importDeclare[importDeclare.length] = `import ${exportName} from '${`./${node_path.join(relativeDir, name)}`}';`; exportDeclare[exportDeclare.length] = exportName; } return exportDeclare.length ? `${importDeclare.join(node_os.EOL)}${node_os.EOL}export default { ${exportDeclare.join(", ")} };${node_os.EOL}` : ""; @@ -43,7 +47,7 @@ function createPlugin(opts) { if (!opts) { opts = {}; } - const { src, camelCase: camelCase2, dts } = opts; + const { src, transformName, dts } = opts; const exportsType = opts.exports || "named"; let target = opts.target || "index.js"; const cwd = opts.cwd || process.cwd(); @@ -80,10 +84,10 @@ function createPlugin(opts) { } switch (exportsType) { case "named": - mainCode = namedExport(files, id, camelCase2); + mainCode = namedExport(files, id, transformName); break; case "default": { - mainCode = defaultExport(files, id, camelCase2); + mainCode = defaultExport(files, id, transformName); break; } default: @@ -92,25 +96,17 @@ function createPlugin(opts) { return mainCode; } }, - writeBundle(options) { - if (dts && ["es", "esm"].includes(options.format)) { - const { dir, file } = options; - let p; - if (file) { - p = node_path.dirname(file); - } else if (dir) { - p = dir; - } - if (p && !node_path.isAbsolute(p)) { - p = node_path.join(cwd, p); + closeBundle() { + if (dts) { + let dtsPath = dts; + if (!node_path.isAbsolute(dtsPath)) { + dtsPath = node_path.join(cwd, dtsPath); } - if (p && mainCode) { - const mainObj = node_path.parse(target); - node_fs.writeFile(node_path.join(p, `${mainObj.name}.d.ts`), mainCode.replace(new RegExp(node_path.join(cwd, mainObj.dir), "g"), "."), (err) => { + if (mainCode) { + node_fs.writeFile(node_path.join(dtsPath, "index.d.ts"), mainCode, (err) => { if (err) { console.error(err); } - mainCode = ""; }); } } diff --git a/packages/vite-plugin-combine/dist/index.mjs b/packages/vite-plugin-combine/dist/index.mjs index a95d5c2..1ffe25c 100644 --- a/packages/vite-plugin-combine/dist/index.mjs +++ b/packages/vite-plugin-combine/dist/index.mjs @@ -1,32 +1,36 @@ import { EOL } from "node:os"; -import { isAbsolute, join, normalize, dirname, parse, relative } from "node:path"; +import { isAbsolute, join, normalize, parse, relative, dirname } from "node:path"; import { writeFile } from "node:fs"; import camelCase from "camelcase"; import { globbySync } from "globby"; -function camelCaseName(file, camelCaseOptions) { - let { name } = parse(file); - if (camelCaseOptions !== false) { - name = camelCase(name, camelCaseOptions); +function camelCaseName(name, filePath, transformName) { + if (transformName) { + switch (typeof transformName) { + case "boolean": + return camelCase(name); + case "function": + return transformName(name, filePath); + } } return name; } -function namedExport(files, target, camelCaseOptions) { +function namedExport(files, target, transformName) { return files.map((file) => { const { name, dir } = parse(file); - const exportName = camelCaseName(name, camelCaseOptions); + const exportName = camelCaseName(name, file, transformName); const relativeDir = relative(dirname(target), dir); - return `export { default as ${exportName} } from '${relativeDir ? join(relativeDir, name) : `./${name}`}';`; + return `export { default as ${exportName} } from '${`./${join(relativeDir, name)}`}';`; }).join(EOL); } -function defaultExport(files, target, camelCaseOptions) { +function defaultExport(files, target, transformName) { const importDeclare = []; const exportDeclare = []; let exportName; for (const file of files) { const { name, dir } = parse(file); - exportName = camelCaseName(name, camelCaseOptions); + exportName = camelCaseName(name, file, transformName); const relativeDir = relative(dirname(target), dir); - importDeclare[importDeclare.length] = `import ${exportName} from '${relativeDir ? join(relativeDir, name) : `./${name}`}';`; + importDeclare[importDeclare.length] = `import ${exportName} from '${`./${join(relativeDir, name)}`}';`; exportDeclare[exportDeclare.length] = exportName; } return exportDeclare.length ? `${importDeclare.join(EOL)}${EOL}export default { ${exportDeclare.join(", ")} };${EOL}` : ""; @@ -42,7 +46,7 @@ function createPlugin(opts) { if (!opts) { opts = {}; } - const { src, camelCase: camelCase2, dts } = opts; + const { src, transformName, dts } = opts; const exportsType = opts.exports || "named"; let target = opts.target || "index.js"; const cwd = opts.cwd || process.cwd(); @@ -79,10 +83,10 @@ function createPlugin(opts) { } switch (exportsType) { case "named": - mainCode = namedExport(files, id, camelCase2); + mainCode = namedExport(files, id, transformName); break; case "default": { - mainCode = defaultExport(files, id, camelCase2); + mainCode = defaultExport(files, id, transformName); break; } default: @@ -91,25 +95,17 @@ function createPlugin(opts) { return mainCode; } }, - writeBundle(options) { - if (dts && ["es", "esm"].includes(options.format)) { - const { dir, file } = options; - let p; - if (file) { - p = dirname(file); - } else if (dir) { - p = dir; - } - if (p && !isAbsolute(p)) { - p = join(cwd, p); + closeBundle() { + if (dts) { + let dtsPath = dts; + if (!isAbsolute(dtsPath)) { + dtsPath = join(cwd, dtsPath); } - if (p && mainCode) { - const mainObj = parse(target); - writeFile(join(p, `${mainObj.name}.d.ts`), mainCode.replace(new RegExp(join(cwd, mainObj.dir), "g"), "."), (err) => { + if (mainCode) { + writeFile(join(dtsPath, "index.d.ts"), mainCode, (err) => { if (err) { console.error(err); } - mainCode = ""; }); } } diff --git a/packages/vite-plugin-combine/package.json b/packages/vite-plugin-combine/package.json index 7137446..19a98a6 100644 --- a/packages/vite-plugin-combine/package.json +++ b/packages/vite-plugin-combine/package.json @@ -1,6 +1,6 @@ { "name": "vite-plugin-combine", - "version": "4.0.0", + "version": "4.0.1", "description": "Combines specified files to produce a single master file.", "types": "./dist/index.d.ts", "module": "./dist/index.mjs", diff --git a/packages/vite-plugin-combine/src/index.ts b/packages/vite-plugin-combine/src/index.ts index e3bb82d..a173c51 100644 --- a/packages/vite-plugin-combine/src/index.ts +++ b/packages/vite-plugin-combine/src/index.ts @@ -1,12 +1,12 @@ import { EOL } from 'node:os'; import { parse, isAbsolute, join, normalize, relative, dirname } from 'node:path'; import { writeFile } from 'node:fs'; -import camelCase, { Options as CamelCaseOptions } from 'camelcase'; +import camelCase from 'camelcase'; import { globbySync } from 'globby'; import { Plugin } from 'vite'; -export type CamelCase = CamelCaseOptions; +export type TransformName = (name: string, filePath: string) => string; export interface Options { /** @@ -23,12 +23,11 @@ export interface Options { target: string; /** - * Configuration for the camelcase function. - * https://github.com/sindresorhus/camelcase?tab=readme-ov-file#camelcaseinput-options + * Transform file names * - * camelcase 函数的配置 + * 转换文件名 */ - camelCase?: CamelCaseOptions; + transformName?: TransformName | boolean; /** * Exported module types. @@ -40,13 +39,11 @@ export interface Options { exports?: 'named' | 'default' | 'none'; /** - * Whether to generate `.d.ts` files. + * Generate the `index.d.ts` file to a specified path. * - * 是否生成 d.ts 文件 - * - * @default false + * 生成 `index.d.ts` 文件到指定路径 */ - dts?: boolean; + dts?: string; /** * Current Working Directory. @@ -56,35 +53,39 @@ export interface Options { cwd?: string; } -function camelCaseName(file: string, camelCaseOptions?: CamelCaseOptions | false): string { - let { name } = parse(file); - if (camelCaseOptions !== false) { - name = camelCase(name, camelCaseOptions); +function camelCaseName(name: string, filePath: string, transformName?: TransformName | boolean): string { + if (transformName) { + switch (typeof transformName) { + case 'boolean': + return camelCase(name); + case 'function': + return transformName(name, filePath); + } } return name; } -function namedExport(files: string[], target: string, camelCaseOptions?: CamelCaseOptions | false): string { +function namedExport(files: string[], target: string, transformName?: TransformName | boolean): string { return files .map((file) => { const { name, dir } = parse(file); - const exportName = camelCaseName(name, camelCaseOptions); + const exportName = camelCaseName(name, file, transformName); const relativeDir = relative(dirname(target), dir); - return `export { default as ${exportName} } from '${relativeDir ? join(relativeDir, name) : `./${name}`}';`; + return `export { default as ${exportName} } from '${`./${join(relativeDir, name)}`}';`; }) .join(EOL); } -function defaultExport(files: string[], target: string, camelCaseOptions?: CamelCaseOptions | false): string { +function defaultExport(files: string[], target: string, transformName?: TransformName | boolean): string { const importDeclare: string[] = []; const exportDeclare: string[] = []; let exportName; for (const file of files) { const { name, dir } = parse(file); - exportName = camelCaseName(name, camelCaseOptions); + exportName = camelCaseName(name, file, transformName); const relativeDir = relative(dirname(target), dir); importDeclare[importDeclare.length] - = `import ${exportName} from '${relativeDir ? join(relativeDir, name) : `./${name}`}';`; + = `import ${exportName} from '${`./${join(relativeDir, name)}`}';`; exportDeclare[exportDeclare.length] = exportName; } return exportDeclare.length @@ -107,7 +108,7 @@ export default function createPlugin(opts: Options): Plugin { opts = {} as Options; } - const { src, camelCase, dts } = opts; + const { src, transformName, dts } = opts; const exportsType = opts.exports || 'named'; let target = opts.target || 'index.js'; @@ -151,10 +152,10 @@ export default function createPlugin(opts: Options): Plugin { switch (exportsType) { case 'named': - mainCode = namedExport(files, id, camelCase); + mainCode = namedExport(files, id, transformName); break; case 'default': { - mainCode = defaultExport(files, id, camelCase); + mainCode = defaultExport(files, id, transformName); break; } default: @@ -164,30 +165,18 @@ export default function createPlugin(opts: Options): Plugin { } }, - writeBundle(options) { - if (dts && ['es', 'esm'].includes(options.format)) { - const { dir, file } = options; - let p; - if (file) { - p = dirname(file); - } - else if (dir) { - p = dir; - } - - if (p && !isAbsolute(p)) { - p = join(cwd, p); + closeBundle() { + if (dts) { + let dtsPath = dts; + if (!isAbsolute(dtsPath)) { + dtsPath = join(cwd, dtsPath); } - if (p && mainCode) { - const mainObj = parse(target); - writeFile( - join(p, `${mainObj.name}.d.ts`), mainCode.replace(new RegExp(join(cwd, mainObj.dir), 'g'), '.'), - (err) => { - if (err) { - console.error(err); - } - mainCode = ''; - }); + if (mainCode) { + writeFile(join(dtsPath, 'index.d.ts'), mainCode, (err) => { + if (err) { + console.error(err); + } + }); } } }