Skip to content

Commit

Permalink
用webpack打包umd
Browse files Browse the repository at this point in the history
  • Loading branch information
saqqdy committed Jul 26, 2021
1 parent 3762a1e commit 72dfdab
Show file tree
Hide file tree
Showing 28 changed files with 384 additions and 66 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 2021.07.26 v1.1.0 更新日志

1. 采用webpack打umd包
# 2021.03.03 v1.0.9 更新日志

1. 新增 all/any/RGBToHex/uuid 等方法
Expand Down
17 changes: 17 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
var path = require('path')
var fs = require('fs')
var pkg = require('./package.json')
var nodeExternals = require('webpack-node-externals')
externals = {}

// externals = [Object.assign({}, externals), nodeExternals() /*, /^core-js\/.+$/, /^js-cool\/.+$/*/]

exports.externals = externals
exports.version = pkg.version

exports.alias = {
'@': path.resolve(__dirname, '../src'),
postmessager: path.resolve(__dirname, './')
}

exports.jsexclude = /node_modules/
4 changes: 2 additions & 2 deletions lib/CSVToArray.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

require('core-js/modules/es.array.index-of.js');
require('core-js/modules/es.array.map.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.split.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.array.index-of.js');

/**
* @description 将一个逗号分隔的值(CSV)字符串转换为一个2D数组。
Expand Down
6 changes: 3 additions & 3 deletions lib/CSVToJSON.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.split.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.array.index-of.js');
require('core-js/modules/es.array.map.js');
require('core-js/modules/es.array.reduce.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.split.js');

/**
* @description 将一个逗号分隔的值(CSV)字符串转换为一个2D对象数组。字符串的第一行作为标题行。
Expand Down
2 changes: 1 addition & 1 deletion lib/JSONToCSV.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

require('core-js/modules/es.array.concat.js');
require('core-js/modules/es.array.join.js');
require('core-js/modules/es.array.concat.js');
require('core-js/modules/es.array.map.js');
require('core-js/modules/es.array.reduce.js');

Expand Down
2 changes: 1 addition & 1 deletion lib/RGBToHex.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

require('core-js/modules/es.string.pad-start.js');
require('core-js/modules/es.date.to-string.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/es.regexp.to-string.js');
require('core-js/modules/es.string.pad-start.js');

/**
* @description 将RGB组件的值转换为颜色代码。
Expand Down
4 changes: 2 additions & 2 deletions lib/cutCHSString.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.replace.js');
require('core-js/modules/es.date.to-string.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.regexp.to-string.js');
require('core-js/modules/es.string.match.js');
require('core-js/modules/es.string.replace.js');

/**
* js截取字符串,中英文都能用
Expand Down
2 changes: 1 addition & 1 deletion lib/download.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.array.iterator.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.iterator.js');
require('core-js/modules/web.dom-collections.iterator.js');
require('core-js/modules/web.url.js');
Expand Down
4 changes: 2 additions & 2 deletions lib/extend.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

require('core-js/modules/es.array.for-each.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.object.get-prototype-of.js');
require('core-js/modules/es.array.slice.js');
require('core-js/modules/es.array.for-each.js');
require('core-js/modules/web.dom-collections.for-each.js');
var isArray = require('./isArray.js');
var getType = require('./getType.js');
Expand Down
2 changes: 1 addition & 1 deletion lib/fixNumber.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

require('core-js/modules/es.parse-float.js');
require('core-js/modules/es.regexp.constructor.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.regexp.to-string.js');
require('core-js/modules/es.parse-float.js');
require('core-js/modules/es.string.replace.js');

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/formatTime.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

require('core-js/modules/es.date.to-string.js');
require('core-js/modules/es.regexp.constructor.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.regexp.to-string.js');
require('core-js/modules/es.string.replace.js');
require('core-js/modules/es.regexp.constructor.js');
require('core-js/modules/es.regexp.to-string.js');

/**
* 日期格式化插件
Expand Down
2 changes: 1 addition & 1 deletion lib/formatTimeStr.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

require('core-js/modules/es.date.to-string.js');
require('core-js/modules/es.parse-int.js');
require('core-js/modules/es.date.to-string.js');
var formatTime = require('./formatTime.js');

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/getAppVersion.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

require('core-js/modules/es.array.includes.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.includes.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.match.js');

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/getDirParam.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';

require('core-js/modules/es.array.includes.js');
require('core-js/modules/es.regexp.constructor.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.regexp.to-string.js');
require('core-js/modules/es.string.includes.js');
require('core-js/modules/es.string.match.js');
require('core-js/modules/es.string.replace.js');
require('core-js/modules/es.string.match.js');
require('core-js/modules/es.array.includes.js');
require('core-js/modules/es.string.includes.js');
require('core-js/modules/es.string.split.js');

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/getOsVersion.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

require('core-js/modules/es.array.includes.js');
require('core-js/modules/es.array.index-of.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.array.includes.js');
require('core-js/modules/es.string.includes.js');
require('core-js/modules/es.string.match.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.replace.js');
require('core-js/modules/es.string.match.js');
var getAppVersion = require('./getAppVersion.js');

/**
Expand Down
2 changes: 0 additions & 2 deletions lib/getType.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

require('core-js/modules/es.date.to-string.js');
require('core-js/modules/es.object.to-string.js');
require('core-js/modules/es.regexp.to-string.js');

/**
* getType
Expand Down
6 changes: 3 additions & 3 deletions lib/getUrlParam.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.split.js');
require('core-js/modules/es.array.index-of.js');
require('core-js/modules/es.string.search.js');
require('core-js/modules/es.array.last-index-of.js');
require('core-js/modules/es.regexp.exec.js');
require('core-js/modules/es.string.replace.js');
require('core-js/modules/es.string.search.js');
require('core-js/modules/es.string.split.js');

/* 获取URL参数 */

Expand Down
101 changes: 93 additions & 8 deletions lib/index.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import 'core-js/modules/es.array.last-index-of.js';
import 'core-js/modules/es.parse-int.js';
import 'core-js/modules/es.array.for-each.js';
import 'core-js/modules/es.array.sort.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import 'core-js/modules/es.object.get-prototype-of.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import 'core-js/modules/es.array.map.js';
import 'core-js/modules/es.array.iterator.js';
import 'core-js/modules/es.string.iterator.js';
Expand Down Expand Up @@ -1108,7 +1108,7 @@ var encodeUtf8 = function encodeUtf8(string) {
return utftext;
};

var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var _keyStr$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/**
* 字符串、数字转base64
* @param {String} input 需要编码的字符串
Expand Down Expand Up @@ -1136,7 +1136,7 @@ var encodeBase64 = function encodeBase64(input) {
enc4 = 64;
}

output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
output = output + _keyStr$1.charAt(enc1) + _keyStr$1.charAt(enc2) + _keyStr$1.charAt(enc3) + _keyStr$1.charAt(enc4);
}

return output;
Expand Down Expand Up @@ -1175,7 +1175,7 @@ var decodeUtf8 = function decodeUtf8(utftext) {
return string;
};

var _keyStr$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
/**
* base64解码
* @param {String} input 需要解码的字符串
Expand All @@ -1190,10 +1190,10 @@ var decodeBase64 = function decodeBase64(input) {
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '');

while (i < input.length) {
enc1 = _keyStr$1.indexOf(input.charAt(i++));
enc2 = _keyStr$1.indexOf(input.charAt(i++));
enc3 = _keyStr$1.indexOf(input.charAt(i++));
enc4 = _keyStr$1.indexOf(input.charAt(i++));
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = enc1 << 2 | enc2 >> 4;
chr2 = (enc2 & 15) << 4 | enc3 >> 2;
chr3 = (enc3 & 3) << 6 | enc4;
Expand Down Expand Up @@ -2031,4 +2031,89 @@ var RGBToHex = function RGBToHex(r, g, b) {
return ((r << 16) + (g << 8) + b).toString(16).padStart(6, '0');
};

// 全局参数
var index = {
//
client: client,
pattern: pattern$1,
trim: trim,
clearAttr: clearAttr,
clearBr: clearBr,
clearHtml: clearHtml,
clearHtmlExpSN: clearHtmlExpSN,
clearHtmlN: clearHtmlN,
clearHtmlNS: clearHtmlNS,
clearHtmlTag: clearHtmlTag,
getNumber: getNumber,
imgAdapt: imgAdapt,
imgChoose: imgChoose,
camel2Dash: camel2Dash,
dash2Camel: dash2Camel,
upperFirst: upperFirst,
getRandomNum: getRandomNum,
getRandomStr: getRandomStr,
getRandomStrWidthSpecialChar: getRandomStrWidthSpecialChar,
getCHSLength: getCHSLength,
cutCHSString: cutCHSString,
textareaInsertText: textareaInsertText,
textareaMoveToEnd: textareaMoveToEnd,
isDigitals: isDigitals,
isExitsFunction: isExitsFunction,
isExitsVariable: isExitsVariable,
getWindowSize: getWindowSize,
getAppVersion: getAppVersion,
getOsVersion: getOsVersion,
getIsAppVersionLastest: getIsAppVersionLastest,
getDirParam: getDirParam,
getParameter: getParameter,
getFileType: getFileType,
getUrlParam: getUrlParam,
formatTime: formatTime,
formatTimeStr: formatTimeStr,
setCookie: setCookie,
setCache: setCache,
setSession: setSession,
getCookie: getCookie,
getCache: getCache,
getSession: getSession,
delCookie: delCookie,
delCache: delCache,
delSession: delSession,
encodeBase64: encodeBase64,
encodeUtf8: encodeUtf8,
decodeBase64: decodeBase64,
decodeUtf8: decodeUtf8,
enWxJumpLink: enWxJumpLink,
enWxJumpLinkOld: enWxJumpLinkOld,
deWxJumpLink: deWxJumpLink,
deWxJumpLinkOld: deWxJumpLinkOld,
debounce: debounce,
throttle: throttle,
stopBubble: stopBubble,
stopDefault: stopDefault,
addEvent: addEvent,
removeEvent: removeEvent,
getScrollPosition: getScrollPosition,
nextIndex: nextIndex,
fixNumber: fixNumber,
delay: delay,
extend: extend,
getType: getType,
isArray: isArray,
cleanData: cleanData,
download: download,
searchTreeObject: searchTreeObject,
openUrl: openUrl,
splitThousand: splitThousand,
all: all,
any: any,
uuid: uuid,
arrayToCSV: arrayToCSV,
CSVToArray: CSVToArray,
CSVToJSON: CSVToJSON,
JSONToCSV: JSONToCSV,
RGBToHex: RGBToHex
};

export default index;
export { CSVToArray, CSVToJSON, JSONToCSV, RGBToHex, addEvent, all, any, arrayToCSV, camel2Dash, cleanData, clearAttr, clearBr, clearHtml, clearHtmlExpSN, clearHtmlN, clearHtmlNS, clearHtmlTag, client, cutCHSString, dash2Camel, deWxJumpLink, deWxJumpLinkOld, debounce, decodeBase64, decodeUtf8, delCache, delCookie, delSession, delay, download, enWxJumpLink, enWxJumpLinkOld, encodeBase64, encodeUtf8, extend, fixNumber, formatTime, formatTimeStr, getAppVersion, getCHSLength, getCache, getCookie, getDirParam, getFileType, getIsAppVersionLastest, getNumber, getOsVersion, getParameter, getRandomNum, getRandomStr, getRandomStrWidthSpecialChar, getScrollPosition, getSession, getType, getUrlParam, getWindowSize, imgAdapt, imgChoose, isArray, isDigitals, isExitsFunction, isExitsVariable, nextIndex, openUrl, pattern$1 as pattern, removeEvent, searchTreeObject, setCache, setCookie, setSession, splitThousand, stopBubble, stopDefault, textareaInsertText, textareaMoveToEnd, throttle, trim, upperFirst, uuid };
Loading

0 comments on commit 72dfdab

Please sign in to comment.