vite-plugin-xq-cp-dep 1.0.4 → 1.1.0

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # vite-plugin-xq-cp-dep
2
2
 
3
- A vite copy all package.json config item 'dependencies' and project directory 'src/assets' to public directory plugin.
3
+ A vite copy all package.json config item 'dependencies' and project directory 'assets' to public directory plugin.
4
4
 
5
- 一个将package.json配置文件中配置的'dependencies'的所有依赖包和项目目录'src/assets'自动复制到public目录的插件。
5
+ 一个将package.json配置文件中配置的'dependencies'的所有依赖包和项目目录'assets'自动复制到public目录的插件。
6
6
 
7
7
  ## 安装
8
8
  ```bash
@@ -65,4 +65,4 @@ package.json配置示例:
65
65
 
66
66
  ### 如果复制的目录目标目录已经存在,将会跳过操作。
67
67
  ### 例如:复制'node_modules/bootstrap'目录到public目录下时,'public/bootstrap'目录已经存在,将会被跳过。如果需要更新,则需要将'public/bootstrap'手动删除。
68
- ### 如果项目目录'src/assets'存在,整个目录也会被复制到public目录下。
68
+ ### 如果项目目录'assets'存在,整个目录也会被复制到public目录下。
package/dist/index.cjs CHANGED
@@ -1,33 +1,39 @@
1
1
  /*!
2
- * vite-plugin-xq-cp-dep v1.0.4 (http://xqkeji.cn/)
2
+ * vite-plugin-xq-cp-dep v1.1.0 (http://xqkeji.cn/)
3
3
  * Author xqkeji.cn
4
4
  * LICENSE SSPL-1.0
5
- * Copyright 2023 xqkeji.cn
5
+ * Copyright 2026 xqkeji.cn
6
6
  */
7
7
  'use strict';
8
8
 
9
9
  const path = require('path');
10
10
  const fs = require('fs');
11
11
 
12
- const pkg_file = path.resolve(__dirname, "../../../package.json");
13
- const pkg = JSON.parse(fs.readFileSync(pkg_file, "utf8"));
14
- const node_modules_path = path.resolve(__dirname, "../../../node_modules");
12
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
13
+
14
+ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
15
+ const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
16
+
17
+ const pkg_file = path__default.resolve(__dirname, "../../../package.json");
18
+ const pkg = JSON.parse(fs__default.readFileSync(pkg_file, "utf8"));
19
+ const node_modules_path = path__default.resolve(__dirname, "../../../node_modules");
15
20
  function xqCpDep() {
16
21
  return {
17
22
  name: "xq-cp-dep",
23
+ // @ts-ignore
18
24
  config(config) {
19
25
  let root = config.root;
20
- let publicDir = path.join(root, "public");
26
+ let publicDir = path__default.join(root, "public");
21
27
  if (Object.prototype.hasOwnProperty.call(pkg, "dependencies")) {
22
28
  const deps = pkg.dependencies;
23
- if (!fs.existsSync(publicDir)) {
24
- fs.mkdirSync(publicDir);
29
+ if (!fs__default.existsSync(publicDir)) {
30
+ fs__default.mkdirSync(publicDir);
25
31
  }
26
32
  for (const dep in deps) {
27
- const dirPath = path.join(node_modules_path, dep);
28
- const cpDest = path.join(publicDir, dep);
29
- if (!fs.existsSync(cpDest)) {
30
- fs.cp(dirPath, cpDest, { recursive: true }, (err) => {
33
+ const dirPath = path__default.join(node_modules_path, dep);
34
+ const cpDest = path__default.join(publicDir, dep);
35
+ if (!fs__default.existsSync(cpDest)) {
36
+ fs__default.cp(dirPath, cpDest, { recursive: true }, (err) => {
31
37
  if (err) {
32
38
  console.error(err);
33
39
  }
@@ -35,14 +41,13 @@ function xqCpDep() {
35
41
  }
36
42
  }
37
43
  }
38
- let srcDir = path.join(root, "src");
39
- let assetsDir = path.join(srcDir, "assets");
40
- let destAssetsDir = path.join(publicDir, "assets");
41
- if (!fs.existsSync(publicDir)) {
42
- fs.mkdirSync(publicDir);
44
+ let assetsDir = path__default.join(root, "assets");
45
+ let destAssetsDir = path__default.join(publicDir, "assets");
46
+ if (!fs__default.existsSync(publicDir)) {
47
+ fs__default.mkdirSync(publicDir);
43
48
  }
44
- if (fs.existsSync(assetsDir) && !fs.existsSync(destAssetsDir)) {
45
- fs.cp(assetsDir, destAssetsDir, { recursive: true }, (err) => {
49
+ if (fs__default.existsSync(assetsDir) && !fs__default.existsSync(destAssetsDir)) {
50
+ fs__default.cp(assetsDir, destAssetsDir, { recursive: true }, (err) => {
46
51
  if (err) {
47
52
  console.error(err);
48
53
  }
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ declare function xqCpDep(): Plugin;
4
+
5
+ export = xqCpDep;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ declare function xqCpDep(): Plugin;
4
+
5
+ export { xqCpDep as default };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * vite-plugin-xq-cp-dep v1.0.4 (http://xqkeji.cn/)
2
+ * vite-plugin-xq-cp-dep v1.1.0 (http://xqkeji.cn/)
3
3
  * Author xqkeji.cn
4
4
  * LICENSE SSPL-1.0
5
- * Copyright 2023 xqkeji.cn
5
+ * Copyright 2026 xqkeji.cn
6
6
  */
7
7
  import { Plugin } from 'vite';
8
8
 
9
9
  declare function xqCpDep(): Plugin;
10
10
 
11
- export { xqCpDep as default };
11
+ export = xqCpDep;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * vite-plugin-xq-cp-dep v1.0.4 (http://xqkeji.cn/)
2
+ * vite-plugin-xq-cp-dep v1.1.0 (http://xqkeji.cn/)
3
3
  * Author xqkeji.cn
4
4
  * LICENSE SSPL-1.0
5
- * Copyright 2023 xqkeji.cn
5
+ * Copyright 2026 xqkeji.cn
6
6
  */
7
7
  import path from 'path';
8
8
  import fs from 'fs';
@@ -13,6 +13,7 @@ const node_modules_path = path.resolve(__dirname, "../../../node_modules");
13
13
  function xqCpDep() {
14
14
  return {
15
15
  name: "xq-cp-dep",
16
+ // @ts-ignore
16
17
  config(config) {
17
18
  let root = config.root;
18
19
  let publicDir = path.join(root, "public");
@@ -33,8 +34,7 @@ function xqCpDep() {
33
34
  }
34
35
  }
35
36
  }
36
- let srcDir = path.join(root, "src");
37
- let assetsDir = path.join(srcDir, "assets");
37
+ let assetsDir = path.join(root, "assets");
38
38
  let destAssetsDir = path.join(publicDir, "assets");
39
39
  if (!fs.existsSync(publicDir)) {
40
40
  fs.mkdirSync(publicDir);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-xq-cp-dep",
3
- "version": "1.0.4",
4
- "description": "A vite copy all package.json config item 'dependencies' and project directory 'src/assets' to public directory plugin.一个将package.json配置文件中配置的'dependencies'的所有依赖包和项目目录'src/assets'自动复制到public目录的插件。",
3
+ "version": "1.1.0",
4
+ "description": "A vite plugin that copies all package.json 'dependencies' and project 'assets' into the public directory.一个将 package.json 的 dependencies 全部依赖包和项目 assets 自动复制到 public 目录的 Vite 插件。",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"
@@ -35,10 +35,16 @@
35
35
  "license": "SSPL-1.0",
36
36
  "homepage": "http://xqkeji.cn/",
37
37
  "devDependencies": {
38
- "@types/node": "^18.11.0",
39
- "typescript": "^4.8.4",
40
- "unbuild": "^0.9.4",
41
- "vite": "^3.1.8",
42
- "xq-banner": "^1.0.5"
38
+ "@types/node": "^26.5.1",
39
+ "typescript": "^5.9.2",
40
+ "unbuild": "^3.6.1",
41
+ "vite": "^8.0.0",
42
+ "xq-banner": "^1.0.10"
43
+ },
44
+ "peerDependencies": {
45
+ "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
46
+ },
47
+ "engines": {
48
+ "node": ">=18.0.0"
43
49
  }
44
50
  }