wgt-node-utils 0.0.23 → 0.0.26
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/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +9 -4
- package/webpack.config.js +3 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -351,11 +351,11 @@ class wgtNodeUtils {
|
|
|
351
351
|
console.error(`${title} [${err.config.method}]: ${err.config.url}`);
|
|
352
352
|
console.error(`request: {params: ${JSON.stringify(err.config.params)}, data: ${JSON.stringify(err.config.data)}}`);
|
|
353
353
|
console.error(`response: ${JSON.stringify(err.response)}`);
|
|
354
|
-
this.sendFeiShu(`${title} [${err.config.method}]: ${err.config.url}`, ENV, components);
|
|
354
|
+
// this.sendFeiShu(`${title} [${err.config.method}]: ${err.config.url}`, ENV, components);
|
|
355
355
|
} else {
|
|
356
356
|
console.error(`============${new Date().toLocaleString()}===========`);
|
|
357
357
|
console.error(`${title} ${err}`);
|
|
358
|
-
this.sendFeiShu(`${title} ${err}`, ENV, components);
|
|
358
|
+
// this.sendFeiShu(`${title} ${err}`, ENV, components);
|
|
359
359
|
}
|
|
360
360
|
} catch (e) {
|
|
361
361
|
|
|
@@ -432,7 +432,7 @@ class wgtNodeUtils {
|
|
|
432
432
|
name: 'English',
|
|
433
433
|
icon: 'cfgv1bursfevmln3akj0.webp'
|
|
434
434
|
}]
|
|
435
|
-
console.log(
|
|
435
|
+
console.log(url, 'url')
|
|
436
436
|
return new Promise((resolve) => {
|
|
437
437
|
axios.get(url).then(res => {
|
|
438
438
|
let list = res.data.data || [];
|
|
@@ -446,7 +446,7 @@ class wgtNodeUtils {
|
|
|
446
446
|
});
|
|
447
447
|
resolve(list || defaultLanList);
|
|
448
448
|
}).catch((e) => {
|
|
449
|
-
console.log(e)
|
|
449
|
+
console.log(e, 'axios 报错信息')
|
|
450
450
|
this.appendLog('语言读取', '语言接口调用失败', 'test', components = '');
|
|
451
451
|
// 调用失败时,返回en
|
|
452
452
|
resolve(defaultLanList);
|
|
@@ -454,6 +454,11 @@ class wgtNodeUtils {
|
|
|
454
454
|
});
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
+
/**
|
|
458
|
+
* 检查域名是否可用
|
|
459
|
+
* @param {url:string} url
|
|
460
|
+
* @returns
|
|
461
|
+
*/
|
|
457
462
|
checkDomainAvailability = (url) => {
|
|
458
463
|
return new Promise((resolve, reject) => {
|
|
459
464
|
const { hostname, path } = new URL(url);
|
package/webpack.config.js
CHANGED
|
@@ -6,7 +6,8 @@ module.exports = {
|
|
|
6
6
|
filename: 'bundle.js', // 输出的文件名
|
|
7
7
|
library: 'wgtNodeUtils', // 暴露库名
|
|
8
8
|
libraryTarget: 'umd', // 使用 UMD 规范
|
|
9
|
-
|
|
9
|
+
// 根据运行环境设置全局对象,确保 Node.js 使用 global,浏览器使用 self 或 window
|
|
10
|
+
globalObject: 'typeof self !== "undefined" ? self : global',
|
|
10
11
|
},
|
|
11
12
|
module: {
|
|
12
13
|
rules: [
|
|
@@ -31,7 +32,7 @@ module.exports = {
|
|
|
31
32
|
fs: 'commonjs fs', // 这样 Webpack 不会尝试解析 fs,运行时从 Node.js 中加载
|
|
32
33
|
path: 'commonjs path',
|
|
33
34
|
https: 'commonjs https',
|
|
34
|
-
lark: 'commonjs lark'
|
|
35
|
+
// lark: 'commonjs lark'
|
|
35
36
|
// 其他可能的 Node.js 内置模块
|
|
36
37
|
},
|
|
37
38
|
};
|