mazey 3.12.3 → 4.0.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 +15 -12
- package/lib/index.cjs.js +2 -2
- package/lib/index.d.ts +9 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +2 -2
- package/lib/mazey.min.js +2 -2
- package/lib/typing.d.ts +2 -2
- package/package.json +45 -44
- package/scripts/env-win.sh +2 -0
- package/scripts/rollup.config.mjs +152 -0
package/lib/typing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @author
|
|
2
|
+
* @author Cheng
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
interface BrowserInfo {
|
|
@@ -73,4 +73,4 @@ interface UnknownWindow {
|
|
|
73
73
|
[key: string]: any;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export { AnyFunction, BrowserInfo, DebounceFunc, DefineListeners, IsNumberOptions, LoadScriptReturns, RepeatUntilOptions, SimpleObject, SimpleType, TestUa, TestVs, ThrottleFunc, UnknownFn, UnknownFnParams, UnknownFnReturn, UnknownObject, UnknownWindow, UrlParams, ZResIsValidResOptions, ZResResponse };
|
|
76
|
+
export type { AnyFunction, BrowserInfo, DebounceFunc, DefineListeners, IsNumberOptions, LoadScriptReturns, RepeatUntilOptions, SimpleObject, SimpleType, TestUa, TestVs, ThrottleFunc, UnknownFn, UnknownFnParams, UnknownFnReturn, UnknownObject, UnknownWindow, UrlParams, ZResIsValidResOptions, ZResResponse };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mazey",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "A functional library for daily front-end work.",
|
|
5
5
|
"main": "lib/index.cjs.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"jsdelivr": "lib/mazey.min.js",
|
|
15
15
|
"scripts": {
|
|
16
16
|
"dev": "webpack serve --config ./scripts/webpack.config.dev.js --open",
|
|
17
|
-
"build": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=close rollup --config ./scripts/rollup.config.
|
|
18
|
-
"build:debug": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=open rollup --config ./scripts/rollup.config.
|
|
17
|
+
"build": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=close SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version rollup --config ./scripts/rollup.config.mjs",
|
|
18
|
+
"build:debug": "cross-env SCRIPTS_NPM_PACKAGE_DEBUG=open SCRIPTS_NPM_PACKAGE_VERSION=$npm_package_version rollup --config ./scripts/rollup.config.mjs",
|
|
19
19
|
"test": "jest",
|
|
20
20
|
"test:debug": "npm run build:debug && npm run test",
|
|
21
21
|
"lint:fix": "eslint --ext 'js,ts,tsx' --fix ./src ./test ./scripts",
|
|
@@ -65,52 +65,53 @@
|
|
|
65
65
|
},
|
|
66
66
|
"homepage": "https://github.com/mazeyqian/mazey#readme",
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@babel/core": "^7.
|
|
69
|
-
"@babel/plugin-
|
|
70
|
-
"@babel/plugin-
|
|
71
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
72
|
-
"@babel/preset-env": "^7.
|
|
73
|
-
"@babel/preset-typescript": "^7.
|
|
74
|
-
"@babel/runtime": "^7.
|
|
75
|
-
"@babel/runtime-corejs3": "^7.
|
|
76
|
-
"@commitlint/cli": "^8.
|
|
77
|
-
"@commitlint/config-conventional": "^8.
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@
|
|
81
|
-
"
|
|
82
|
-
"
|
|
68
|
+
"@babel/core": "^7.23.2",
|
|
69
|
+
"@babel/plugin-transform-class-properties": "^7.22.5",
|
|
70
|
+
"@babel/plugin-transform-object-rest-spread": "^7.22.15",
|
|
71
|
+
"@babel/plugin-transform-runtime": "^7.23.2",
|
|
72
|
+
"@babel/preset-env": "^7.23.2",
|
|
73
|
+
"@babel/preset-typescript": "^7.23.2",
|
|
74
|
+
"@babel/runtime": "^7.23.2",
|
|
75
|
+
"@babel/runtime-corejs3": "^7.23.2",
|
|
76
|
+
"@commitlint/cli": "^17.8.1",
|
|
77
|
+
"@commitlint/config-conventional": "^17.8.1",
|
|
78
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
79
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
80
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
81
|
+
"@types/jquery": "^3.5.29",
|
|
82
|
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
83
|
+
"@typescript-eslint/parser": "^6.12.0",
|
|
84
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
85
|
+
"core-js": "^3.33.2",
|
|
83
86
|
"cross-env": "^7.0.3",
|
|
84
|
-
"date-fns": "^2.
|
|
85
|
-
"eslint": "^
|
|
86
|
-
"eslint-config-standard": "^
|
|
87
|
-
"eslint-plugin-import": "^2.
|
|
88
|
-
"eslint-plugin-node": "^11.
|
|
89
|
-
"eslint-plugin-promise": "^
|
|
90
|
-
"eslint-plugin-standard": "^4.0
|
|
91
|
-
"execa": "^
|
|
92
|
-
"html-webpack-plugin": "^
|
|
93
|
-
"husky": "^
|
|
94
|
-
"jest": "^
|
|
95
|
-
"
|
|
87
|
+
"date-fns": "^2.30.0",
|
|
88
|
+
"eslint": "^8.54.0",
|
|
89
|
+
"eslint-config-standard": "^17.1.0",
|
|
90
|
+
"eslint-plugin-import": "^2.29.0",
|
|
91
|
+
"eslint-plugin-node": "^11.1.0",
|
|
92
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
93
|
+
"eslint-plugin-standard": "^4.1.0",
|
|
94
|
+
"execa": "^7.2.0",
|
|
95
|
+
"html-webpack-plugin": "^5.5.3",
|
|
96
|
+
"husky": "^8.0.3",
|
|
97
|
+
"jest": "^29.7.0",
|
|
98
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
99
|
+
"lint-staged": "^14.0.1",
|
|
96
100
|
"markdown-toc": "^1.2.0",
|
|
97
|
-
"prettier": "^
|
|
98
|
-
"prettier-eslint-cli": "^
|
|
99
|
-
"rollup": "^
|
|
100
|
-
"rollup-plugin-babel": "^4.3.3",
|
|
101
|
+
"prettier": "^2.8.8",
|
|
102
|
+
"prettier-eslint-cli": "^8.0.1",
|
|
103
|
+
"rollup": "^3.29.4",
|
|
101
104
|
"rollup-plugin-cleaner": "^1.0.0",
|
|
102
|
-
"rollup-plugin-commonjs": "^10.1.0",
|
|
103
105
|
"rollup-plugin-copy": "^3.4.0",
|
|
104
|
-
"rollup-plugin-dts": "^
|
|
105
|
-
"rollup-plugin-
|
|
106
|
-
"
|
|
107
|
-
"ts-loader": "^8.0.2",
|
|
106
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
107
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
108
|
+
"ts-loader": "^9.4.4",
|
|
108
109
|
"tslib": "^2.6.2",
|
|
109
|
-
"typedoc": "^0.
|
|
110
|
-
"typescript": "5.
|
|
111
|
-
"webpack": "^
|
|
112
|
-
"webpack-cli": "^
|
|
113
|
-
"webpack-dev-server": "^
|
|
110
|
+
"typedoc": "^0.25.4",
|
|
111
|
+
"typescript": "5.3.2",
|
|
112
|
+
"webpack": "^5.89.0",
|
|
113
|
+
"webpack-cli": "^5.1.4",
|
|
114
|
+
"webpack-dev-server": "^4.15.1"
|
|
114
115
|
},
|
|
115
116
|
"husky": {
|
|
116
117
|
"hooks": {
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
/* eslint-disable no-undef */
|
|
3
|
+
// import json from '@rollup/plugin-json'
|
|
4
|
+
import { babel } from '@rollup/plugin-babel';
|
|
5
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
6
|
+
import rollupTypescript from 'rollup-plugin-typescript2';
|
|
7
|
+
import { DEFAULT_EXTENSIONS } from '@babel/core';
|
|
8
|
+
import cleaner from 'rollup-plugin-cleaner';
|
|
9
|
+
import terser from '@rollup/plugin-terser';
|
|
10
|
+
import { dts } from 'rollup-plugin-dts';
|
|
11
|
+
// import { version as pkgJSONVersion } from '../package.json';
|
|
12
|
+
// import replace from '@rollup/plugin-replace';
|
|
13
|
+
// import copy from 'rollup-plugin-copy';
|
|
14
|
+
|
|
15
|
+
// const path = require('path');
|
|
16
|
+
// const _resolve = (_path) => path.resolve(__dirname, _path);
|
|
17
|
+
|
|
18
|
+
import path from 'path';
|
|
19
|
+
import { fileURLToPath } from 'url';
|
|
20
|
+
import { dirname } from 'path';
|
|
21
|
+
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = dirname(__filename);
|
|
24
|
+
|
|
25
|
+
const _resolve = (_path) => path.resolve(__dirname, _path);
|
|
26
|
+
|
|
27
|
+
// const { _resolve } = require('./build-helper');
|
|
28
|
+
const pkgVersion = process.env.SCRIPTS_NPM_PACKAGE_VERSION || process.env.VERSION || 'unknown'; // || require('../package.json').version;
|
|
29
|
+
const debugMode = process.env.SCRIPTS_NPM_PACKAGE_DEBUG;
|
|
30
|
+
const banner =
|
|
31
|
+
'/*!\n' +
|
|
32
|
+
` * Mazey v${pkgVersion} https://github.com/mazeyqian/mazey\n` +
|
|
33
|
+
` * (c) 2018-${new Date().getFullYear()} Cheng\n` +
|
|
34
|
+
' * Released under the MIT License.\n' +
|
|
35
|
+
' */';
|
|
36
|
+
|
|
37
|
+
const plugins = [
|
|
38
|
+
// replace({
|
|
39
|
+
// __MAZEY_NPM_PACKAGE_VERSION__: pkgVersion,
|
|
40
|
+
// }),
|
|
41
|
+
// Remove the `lib` directory before rebuilding.
|
|
42
|
+
// https://github.com/aMarCruz/rollup-plugin-cleanup
|
|
43
|
+
// cleaner({
|
|
44
|
+
// targets: [
|
|
45
|
+
// _resolve('../lib/'),
|
|
46
|
+
// ],
|
|
47
|
+
// }),
|
|
48
|
+
rollupTypescript(),
|
|
49
|
+
commonjs({
|
|
50
|
+
include: /node_modules/,
|
|
51
|
+
}),
|
|
52
|
+
babel({
|
|
53
|
+
babelHelpers: 'runtime',
|
|
54
|
+
// 只转换源代码,不运行外部依赖
|
|
55
|
+
exclude: '**/node_modules/**',
|
|
56
|
+
// babel 默认不支持 ts 需要手动添加
|
|
57
|
+
extensions: [
|
|
58
|
+
...DEFAULT_EXTENSIONS,
|
|
59
|
+
'.ts',
|
|
60
|
+
],
|
|
61
|
+
// skipPreflightCheck: true,
|
|
62
|
+
}),
|
|
63
|
+
// dts(),
|
|
64
|
+
// uglify(),
|
|
65
|
+
// https://www.npmjs.com/package/rollup-plugin-copy
|
|
66
|
+
// copy({
|
|
67
|
+
// targets: [
|
|
68
|
+
// {
|
|
69
|
+
// src: _resolve('../src/t.html'),
|
|
70
|
+
// dest: _resolve('../docs'),
|
|
71
|
+
// },
|
|
72
|
+
// ],
|
|
73
|
+
// }),
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
const iifePlugins = [];
|
|
77
|
+
|
|
78
|
+
// console.log('debugMode:', debugMode);
|
|
79
|
+
if (debugMode !== 'open') {
|
|
80
|
+
iifePlugins.push(
|
|
81
|
+
// Add minification.
|
|
82
|
+
// https://github.com/TrySound/rollup-plugin-terser
|
|
83
|
+
terser({ // https://github.com/terser/terser
|
|
84
|
+
format: {
|
|
85
|
+
// https://github.com/terser/terser#format-options
|
|
86
|
+
comments: /^!\n\s\*\sMazey/, // 'some', // `false` to omit comments in the output
|
|
87
|
+
},
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const dTsConf = {
|
|
93
|
+
input: _resolve('../src/typing.d.ts'),
|
|
94
|
+
// https://rollupjs.org/guide/en/#outputformat
|
|
95
|
+
output: [
|
|
96
|
+
{
|
|
97
|
+
file: _resolve('../lib/typing.d.ts'),
|
|
98
|
+
format: 'es',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
plugins: [
|
|
102
|
+
// ...plugins,
|
|
103
|
+
// cleaner({
|
|
104
|
+
// targets: [
|
|
105
|
+
// _resolve('../lib/index.d.ts'),
|
|
106
|
+
// ],
|
|
107
|
+
// }),
|
|
108
|
+
dts(),
|
|
109
|
+
],
|
|
110
|
+
external: [],
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// console.log('dTsConf:', dTsConf);
|
|
114
|
+
|
|
115
|
+
// https://rollupjs.org/guide/en/
|
|
116
|
+
export default [
|
|
117
|
+
{
|
|
118
|
+
input: _resolve('../src/index.ts'),
|
|
119
|
+
// https://rollupjs.org/guide/en/#outputformat
|
|
120
|
+
output: [
|
|
121
|
+
{
|
|
122
|
+
file: _resolve('../lib/index.cjs.js'),
|
|
123
|
+
format: 'cjs',
|
|
124
|
+
banner,
|
|
125
|
+
plugins: iifePlugins,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
file: _resolve('../lib/index.esm.js'),
|
|
129
|
+
format: 'esm',
|
|
130
|
+
banner,
|
|
131
|
+
plugins: iifePlugins,
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
file: _resolve('../lib/mazey.min.js'),
|
|
135
|
+
format: 'iife',
|
|
136
|
+
name: 'mazey',
|
|
137
|
+
banner,
|
|
138
|
+
plugins: iifePlugins,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
plugins: [
|
|
142
|
+
...plugins,
|
|
143
|
+
cleaner({
|
|
144
|
+
targets: [
|
|
145
|
+
_resolve('../lib/'),
|
|
146
|
+
],
|
|
147
|
+
}),
|
|
148
|
+
],
|
|
149
|
+
external: [],
|
|
150
|
+
},
|
|
151
|
+
dTsConf,
|
|
152
|
+
];
|