From 40f5b54e31ba486188b1c68b4b63d174797f44c2 Mon Sep 17 00:00:00 2001 From: "yong.teng" Date: Thu, 10 Apr 2025 13:02:40 +0800 Subject: [PATCH 1/5] Upgrade 4.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index db688f5..387abfd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@buession/prototype", "alias": "prototype", - "version": "v4.1.2", + "version": "v4.1.3", "description": "A native object extension framework for Javascript.", "homepage": "https://prototype.buession.com/", "author": { From 805ecfb20f0707ad36c91602ebab6555f70fac33 Mon Sep 17 00:00:00 2001 From: "yong.teng" Date: Thu, 10 Apr 2025 13:05:57 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=20babel=20=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- babel.config.js | 2 -- package.json | 2 -- 2 files changed, 4 deletions(-) diff --git a/babel.config.js b/babel.config.js index b8b6959..a877d79 100644 --- a/babel.config.js +++ b/babel.config.js @@ -10,8 +10,6 @@ module.exports = { } ], '@babel/plugin-transform-optional-chaining', - '@babel/plugin-transform-object-assign', - '@babel/plugin-transform-object-rest-spread', '@babel/plugin-proposal-export-default-from', '@babel/plugin-transform-export-namespace-from', '@babel/plugin-transform-class-properties', diff --git a/package.json b/package.json index 387abfd..a000dd8 100644 --- a/package.json +++ b/package.json @@ -48,8 +48,6 @@ "@babel/plugin-transform-class-properties": "^7.25.9", "@babel/plugin-transform-export-namespace-from": "^7.25.9", "@babel/plugin-transform-member-expression-literals": "^7.8.3", - "@babel/plugin-transform-object-assign": "^7.25.9", - "@babel/plugin-transform-object-rest-spread": "^7.25.9", "@babel/plugin-transform-optional-chaining": "^7.25.9", "@babel/plugin-transform-property-literals": "^7.8.3", "@babel/plugin-transform-runtime": "^7.26.10", From fc9688ac33934c5c0938228d8dee1a478ce0ff65 Mon Sep 17 00:00:00 2001 From: "yong.teng" Date: Thu, 10 Apr 2025 13:17:05 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=9F=E6=88=90=20AMD?= =?UTF-8?q?=20=E5=92=8C=20CommonJS=20=E6=97=B6=EF=BC=8C=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E7=AC=A6=E6=9C=AA=E8=A2=AB=E6=9B=BF=E6=8D=A2?= =?UTF-8?q?=E6=88=90=E5=AE=9E=E9=99=85=E7=89=88=E6=9C=AC=E7=9A=84=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/gulpfile.js | 4 +++- build/utils/CleanUpStatsPlugin.js | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build/gulpfile.js b/build/gulpfile.js index 355693a..ff698fa 100644 --- a/build/gulpfile.js +++ b/build/gulpfile.js @@ -18,6 +18,8 @@ const getTSCommonConfig = require('./getTSCommonConfig'); const replaceLib = require('./replaceLib'); const sortApiTable = require('./sortApiTable'); +const pkg = require('../package.json'); + const tsDefaultReporter = ts.reporter.defaultReporter(); const libDir = getProjectPath('lib'); @@ -37,7 +39,7 @@ function babelify(js, modules) { if (modules !== false) { const content = file.contents.toString(encoding); file.contents = Buffer.from( - content.replace(/lodash-es/g, 'lodash') + content.replace(/lodash-es/g, 'lodash').replace('__VERSION__', pkg.version) ); this.push(file); } diff --git a/build/utils/CleanUpStatsPlugin.js b/build/utils/CleanUpStatsPlugin.js index 6ec1af9..17cb7bf 100644 --- a/build/utils/CleanUpStatsPlugin.js +++ b/build/utils/CleanUpStatsPlugin.js @@ -2,15 +2,12 @@ class CleanUpStatsPlugin { constructor(option) { this.option = { - MiniCSSExtractPlugin: true, tsLoader: true, ...option, }; } shouldPickStatChild(child) { - const { MiniCSSExtractPlugin } = this.option; - if (MiniCSSExtractPlugin && child.name.includes('mini-css-extract-plugin')) return false; return true; } From 0b708f00e41e5efdc17d9e931127e2264148d7dc Mon Sep 17 00:00:00 2001 From: "yong.teng" Date: Thu, 10 Apr 2025 13:29:16 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=85=B6=E5=AE=83=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/array.ts | 4 +--- src/core.ts | 2 ++ src/date.ts | 6 +++--- src/number.ts | 4 ++-- src/prototype.ts | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/array.ts b/src/array.ts index 11733de..49d255b 100644 --- a/src/array.ts +++ b/src/array.ts @@ -187,9 +187,7 @@ Array.prototype.unique = function(): Array { * @return 不包括参数中任意一个指定值的数组 */ Array.prototype.without = function(...values: T[]): Array { - return this.filter(function(v: T) { - return values.includes(v) === false; - }); + return this.filter((value)=>values.includes(value) === false); } /** diff --git a/src/core.ts b/src/core.ts index 29b3eeb..c700c1d 100644 --- a/src/core.ts +++ b/src/core.ts @@ -8,6 +8,8 @@ export type Oun = T | Un; export type MaybeArray = T | T[]; +export type MaybePromise = T | Promise; + export type GenericData = Record; export type Data = GenericData; diff --git a/src/date.ts b/src/date.ts index 124c942..6b4c17b 100644 --- a/src/date.ts +++ b/src/date.ts @@ -112,11 +112,11 @@ Date.prototype.getSeason = function(): number { * @return 年份中的第几天 */ Date.prototype.getDayOfYear = function(): number { - const month_days = this.isLeapYear() == true ? [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] : [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - let days = this.getDate(); + const daysInMonth = [31, this.isLeapYear() ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; + let days = 0; for (let m = 0, month = this.getMonth(); m < month; m++) { - days += month_days[m]; + days += daysInMonth[m]; } return days; diff --git a/src/number.ts b/src/number.ts index 1f5772e..d15d0b7 100644 --- a/src/number.ts +++ b/src/number.ts @@ -86,8 +86,8 @@ Number.isEven = function(num: number): boolean { * @return boolean 数字是否在另两个数字之间,返回 true;否则返回 false */ Number.isBetween = function(num: number, min: number, max: number, match: boolean | undefined = false): boolean { - min = min||0; - max = max||0; + min = min || 0; + max = max || 0; if (min > max) { min ^= max; diff --git a/src/prototype.ts b/src/prototype.ts index 3b45600..63af697 100644 --- a/src/prototype.ts +++ b/src/prototype.ts @@ -18,10 +18,10 @@ const Prototype = { }, /** - * - * @param x 任意参数 - * @return 任意值 - */ + * + * @param x 任意参数 + * @return 任意值 + */ K: function (x: any): any { return x; } From def3e03bf2363a39d4a48420072e437c44df7eaa Mon Sep 17 00:00:00 2001 From: "yong.teng" Date: Thu, 10 Apr 2025 13:29:33 +0800 Subject: [PATCH 5/5] Release 4.1.3 --- CHANGELOG.md | 12 ++++++++++++ site/src/index.jsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6585d75..94166bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # 更新日志 +## [v4.1.3](https://github.com/buession/buession-prototype/releases/tag/4.1.3)(2025-04-10) + +### 🐞 BUG 修复 + +- 修复生成 AMD 和 CommonJS 时,版本占位符未被替换成实际版本的 BUG +- 修复 Date.prototype.getDayOfYear 错误的 BUG + +### ⏪ 优化 + +- 其它优化 + + ## [v4.1.2](https://github.com/buession/buession-prototype/releases/tag/4.1.2)(2025-04-09) diff --git a/site/src/index.jsx b/site/src/index.jsx index 74ccc96..2c4cffb 100644 --- a/site/src/index.jsx +++ b/site/src/index.jsx @@ -5,7 +5,7 @@ banner: btns: - { name: '开 始', href: '/docs/quickstart.html', primary: true } - { name: 'Github >', href: 'https://github.com/buession/buession-prototype' } - caption: '当前版本: v4.1.1' + caption: '当前版本: v4.1.3' features: - { name: '优雅', desc: '旨在提供便捷的、可靠的基于原生 JavaScript/TypeScript 扩展的类库,拥有完善的文档和高可读性的源码' } - { name: '易用', desc: '觉大部分 API 基于原生 JavaScript/TypeScript 对象/类的扩展,参考学习 prototype.js' }