fast-vue-multi-pages 1.0.7 → 1.0.9

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.
@@ -25,9 +25,9 @@ class FastVueMultiDate {
25
25
  */
26
26
  static format(source, pattern) {
27
27
  if (lodash_1.default.isEmpty(pattern)) {
28
- return null;
28
+ return source.toLocaleString();
29
29
  }
30
- if (lodash_1.default.isEmpty(source)) {
30
+ if (!source) {
31
31
  return null;
32
32
  }
33
33
  return (0, moment_1.default)(source).format(pattern);
@@ -49,7 +49,7 @@ class FastVueMultiDate {
49
49
  */
50
50
  static formatNice(source, level) {
51
51
  if (lodash_1.default.isEmpty(source)) {
52
- return null;
52
+ return source;
53
53
  }
54
54
  if (level === undefined) {
55
55
  level = 2;
@@ -63,7 +63,7 @@ class FastVueMultiDate {
63
63
  const time1 = new Date().getTime(); //当前的时间戳
64
64
  const sourceDate = this.parse(source);
65
65
  if (!sourceDate) {
66
- return null;
66
+ return source;
67
67
  }
68
68
  const time2 = sourceDate.getTime();
69
69
  const time = time1 - time2;
@@ -27,9 +27,9 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
27
27
  */
28
28
  FastVueMultiDate.format = function (source, pattern) {
29
29
  if (lodash_1.default.isEmpty(pattern)) {
30
- return null;
30
+ return source.toLocaleString();
31
31
  }
32
- if (lodash_1.default.isEmpty(source)) {
32
+ if (!source) {
33
33
  return null;
34
34
  }
35
35
  return (0, moment_1.default)(source).format(pattern);
@@ -51,7 +51,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
51
51
  */
52
52
  FastVueMultiDate.formatNice = function (source, level) {
53
53
  if (lodash_1.default.isEmpty(source)) {
54
- return null;
54
+ return source;
55
55
  }
56
56
  if (level === undefined) {
57
57
  level = 2;
@@ -65,7 +65,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
65
65
  var time1 = new Date().getTime(); //当前的时间戳
66
66
  var sourceDate = this.parse(source);
67
67
  if (!sourceDate) {
68
- return null;
68
+ return source;
69
69
  }
70
70
  var time2 = sourceDate.getTime();
71
71
  var time = time1 - time2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-vue-multi-pages",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "author": "janesen",
5
5
  "description": "快速搭建VUE项目工具类的基本库,主要用于每个功能页面独立生成html",
6
6
  "main": "./dist/cjs/index.js",
@@ -30,7 +30,8 @@
30
30
  "moment": "^2.30.1",
31
31
  "@types/js-cookie": "^3.0.6",
32
32
  "@types/lodash": "^4.17.6",
33
- "copy-to-clipboard": "^3.3.3"
33
+ "copy-to-clipboard": "^3.3.3",
34
+ "ip": "^2.0.1"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@typescript-eslint/eslint-plugin": "^7.16.0",
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * 获取编译配置的选项配置,配置选项如下:
3
3
  * <br/>
4
+ * {@link devServer } 本地运行服务器配置参考文档:https://webpack.js.org/configuration/dev-server/#devserver
5
+ * <br/>
4
6
  * {@link projectTitle } 项目名称
5
7
  * <br/>
6
8
  * {@link projectPagesDir } 项目存储页面的目录地址 默认:src/pages
@@ -230,6 +232,10 @@ export declare class FastBuildOption {
230
232
  * 编译级别的标签名,默认 build-level
231
233
  */
232
234
  buildLevelTagName: string;
235
+ /**
236
+ * 本地运行服务器配置 https://webpack.js.org/configuration/dev-server/#devserver
237
+ */
238
+ devServer: any;
233
239
  /**
234
240
  * 插入Webpack函数function (config){};
235
241
  */
@@ -4,6 +4,8 @@ exports.FastBuildOption = void 0;
4
4
  /**
5
5
  * 获取编译配置的选项配置,配置选项如下:
6
6
  * <br/>
7
+ * {@link devServer } 本地运行服务器配置参考文档:https://webpack.js.org/configuration/dev-server/#devserver
8
+ * <br/>
7
9
  * {@link projectTitle } 项目名称
8
10
  * <br/>
9
11
  * {@link projectPagesDir } 项目存储页面的目录地址 默认:src/pages
@@ -235,6 +237,10 @@ class FastBuildOption {
235
237
  * 编译级别的标签名,默认 build-level
236
238
  */
237
239
  buildLevelTagName = "build-level";
240
+ /**
241
+ * 本地运行服务器配置 https://webpack.js.org/configuration/dev-server/#devserver
242
+ */
243
+ devServer;
238
244
  /**
239
245
  * 插入Webpack函数function (config){};
240
246
  */
@@ -51,4 +51,8 @@ export declare class FastVueMultiPages {
51
51
  * @param path
52
52
  */
53
53
  private static removeFile;
54
+ /**
55
+ * 获取本机IP地址
56
+ */
57
+ static getLocalIP(): string;
54
58
  }
@@ -76,7 +76,7 @@ class FastVueMultiPages {
76
76
  this.removeFile(cacheDir);
77
77
  }
78
78
  const { defineConfig } = require('@vue/cli-service');
79
- return defineConfig({
79
+ let newConfig = {
80
80
  outputDir: options.projectOutDir,
81
81
  assetsDir: options.projectAssetsDir,
82
82
  productionSourceMap: false,
@@ -172,7 +172,11 @@ class FastVueMultiPages {
172
172
  options.configureWebpack(config);
173
173
  }
174
174
  }
175
- });
175
+ };
176
+ if (options.devServer) {
177
+ newConfig["devServer"] = options.devServer;
178
+ }
179
+ return defineConfig(newConfig);
176
180
  }
177
181
  /**
178
182
  * 设置全局变量值
@@ -275,5 +279,12 @@ class FastVueMultiPages {
275
279
  fs.rmdirSync(path); // 删除文件夹自身
276
280
  }
277
281
  }
282
+ /**
283
+ * 获取本机IP地址
284
+ */
285
+ static getLocalIP() {
286
+ let ip = require('ip');
287
+ return ip.address();
288
+ }
278
289
  }
279
290
  exports.FastVueMultiPages = FastVueMultiPages;