@cnguu/vite-plugin-uni-cdn 1.1.0 → 1.1.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/index.cjs CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
3
5
  const fs = require('node:fs/promises');
4
6
  const path = require('node:path');
5
7
  const vite = require('vite');
@@ -1133,7 +1135,7 @@ function replaceStaticToCdn(code, assetDir, cdnBasePath, logger) {
1133
1135
  return transformed;
1134
1136
  }
1135
1137
 
1136
- function UniCdn(opt) {
1138
+ function VitePluginUniCdn(opt) {
1137
1139
  const defaultOption = {
1138
1140
  cdn: "",
1139
1141
  sourceDir: "static/cdn",
@@ -1237,4 +1239,5 @@ function UniCdn(opt) {
1237
1239
  };
1238
1240
  }
1239
1241
 
1240
- module.exports = UniCdn;
1242
+ exports.VitePluginUniCdn = VitePluginUniCdn;
1243
+ exports.default = VitePluginUniCdn;
package/dist/index.d.cts CHANGED
@@ -27,6 +27,9 @@ interface VitePluginUniCdnOption {
27
27
  verbose?: boolean;
28
28
  }
29
29
 
30
- declare function UniCdn(opt: VitePluginUniCdnOption): Plugin;
30
+ declare function VitePluginUniCdn(opt: VitePluginUniCdnOption): Plugin;
31
31
 
32
- export = UniCdn;
32
+ // @ts-ignore
33
+ export = VitePluginUniCdn;
34
+ export { VitePluginUniCdn };
35
+ export type { VitePluginUniCdnOption };
package/dist/index.d.mts CHANGED
@@ -27,6 +27,7 @@ interface VitePluginUniCdnOption {
27
27
  verbose?: boolean;
28
28
  }
29
29
 
30
- declare function UniCdn(opt: VitePluginUniCdnOption): Plugin;
30
+ declare function VitePluginUniCdn(opt: VitePluginUniCdnOption): Plugin;
31
31
 
32
- export { UniCdn as default };
32
+ export { VitePluginUniCdn, VitePluginUniCdn as default };
33
+ export type { VitePluginUniCdnOption };
package/dist/index.d.ts CHANGED
@@ -27,6 +27,9 @@ interface VitePluginUniCdnOption {
27
27
  verbose?: boolean;
28
28
  }
29
29
 
30
- declare function UniCdn(opt: VitePluginUniCdnOption): Plugin;
30
+ declare function VitePluginUniCdn(opt: VitePluginUniCdnOption): Plugin;
31
31
 
32
- export = UniCdn;
32
+ // @ts-ignore
33
+ export = VitePluginUniCdn;
34
+ export { VitePluginUniCdn };
35
+ export type { VitePluginUniCdnOption };
package/dist/index.mjs CHANGED
@@ -1126,7 +1126,7 @@ function replaceStaticToCdn(code, assetDir, cdnBasePath, logger) {
1126
1126
  return transformed;
1127
1127
  }
1128
1128
 
1129
- function UniCdn(opt) {
1129
+ function VitePluginUniCdn(opt) {
1130
1130
  const defaultOption = {
1131
1131
  cdn: "",
1132
1132
  sourceDir: "static/cdn",
@@ -1230,4 +1230,4 @@ function UniCdn(opt) {
1230
1230
  };
1231
1231
  }
1232
1232
 
1233
- export { UniCdn as default };
1233
+ export { VitePluginUniCdn, VitePluginUniCdn as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cnguu/vite-plugin-uni-cdn",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "description": "Vite 插件,在 UniApp 中替换资源链接为 CDN 链接",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/cnguu/vite-plugin-uni-cdn",
package/dist/README.md DELETED
@@ -1,65 +0,0 @@
1
- # vite-plugin-uni-cdn
2
-
3
- Vite 插件,在 UniApp 中替换静态资源链接为 CDN 链接
4
-
5
- [![release](https://badgen.net/github/release/cnguu/vite-plugin-uni-cdn)](https://github.com/cnguu/vite-plugin-uni-cdn/releases)
6
- [![license](https://badgen.net/github/license/cnguu/vite-plugin-uni-cdn)](https://github.com/cnguu/vite-plugin-uni-cdn/blob/main/LICENSE)
7
-
8
- ## 安装
9
-
10
- ```shell
11
- pnpm i -D @cnguu/vite-plugin-uni-cdn
12
- ```
13
-
14
- ## 使用
15
-
16
- ```typescript
17
- // vite.config.ts
18
- import UniCdn from '@cnguu/vite-plugin-uni-cdn'
19
- import Uni from '@dcloudio/vite-plugin-uni'
20
- import { defineConfig } from 'vite'
21
-
22
- export default defineConfig({
23
- plugins: [
24
- UniCdn({
25
- cdn: 'https://cdn.jsdelivr.net/gh/cnguu/vite-plugin-uni-cdn@main/packages/playground/src/static/cdn',
26
- sourceDir: 'src/static/cdn',
27
- }),
28
- Uni(),
29
- ],
30
- })
31
- ```
32
-
33
- > 目前只支持绝对路径,如 `/static/xxx/xxx.png`
34
-
35
- ## 参数
36
-
37
- ### `cdn`
38
-
39
- - cdn 地址
40
- - 默认 `''`
41
-
42
- ### `sourceDir`
43
-
44
- - 替换资源目录,不在该目录下的资源不会被替换
45
- - 默认 `'static/cdn'`
46
-
47
- ### `include`
48
-
49
- - 扫描白名单 GLOB 格式
50
- - 默认 `['**/*.{vue,css,scss,sass,less,styl}']`
51
-
52
- ### `exclude`
53
-
54
- - 扫描黑名单 GLOB 格式
55
- - 默认 `['**/node_modules/**', '**/uni_modules/**', '**/dist/**', '**/unpackage/**']`
56
-
57
- ### `deleteOutputFiles`
58
-
59
- - 是否删除替换资源目录对应的输出目录
60
- - 默认 `true`
61
-
62
- ### `verbose`
63
-
64
- - 是否输出命令行信息
65
- - 默认 `true`
package/dist/package.json DELETED
@@ -1,55 +0,0 @@
1
- {
2
- "name": "@cnguu/vite-plugin-uni-cdn",
3
- "type": "module",
4
- "version": "1.1.0",
5
- "description": "Vite 插件,在 UniApp 中替换资源链接为 CDN 链接",
6
- "license": "MIT",
7
- "homepage": "https://github.com/cnguu/vite-plugin-uni-cdn",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/cnguu/vite-plugin-uni-cdn.git"
11
- },
12
- "bugs": "https://github.com/cnguu/vite-plugin-uni-cdn/issues",
13
- "keywords": [
14
- "vite",
15
- "plugin",
16
- "uni",
17
- "uniapp",
18
- "cdn"
19
- ],
20
- "maintainers": [
21
- {
22
- "name": "cnguu",
23
- "email": "gu642779596@gmail.com",
24
- "url": "https://github.com/cnguu"
25
- }
26
- ],
27
- "sideEffects": false,
28
- "exports": {
29
- ".": {
30
- "import": {
31
- "types": "./index.d.ts",
32
- "default": "./dist/index.mjs"
33
- },
34
- "require": {
35
- "types": "./index.d.ts",
36
- "default": "./dist/index.cjs"
37
- }
38
- }
39
- },
40
- "main": "./dist/index.cjs",
41
- "module": "./dist/index.mjs",
42
- "types": "./index.d.ts",
43
- "files": [
44
- "dist",
45
- "index.d.ts"
46
- ],
47
- "scripts": {
48
- "build": "unbuild",
49
- "debug": "cross-env NODE_ENV=development unbuild --sourcemap",
50
- "stub": "unbuild --stub"
51
- },
52
- "peerDependencies": {
53
- "vite": "^5.0.0"
54
- }
55
- }