@ajaxjs/util 1.1.2 → 1.2.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 +65 -0
- package/dist/index.esm.js +64 -508
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +64 -511
- package/dist/index.umd.js.map +1 -0
- package/dist/src/index.d.ts +2 -5
- package/dist/src/xhr.d.ts +17 -0
- package/package.json +41 -39
- package/dist/src/core/cookies.d.ts +0 -18
- package/dist/src/core/dom.d.ts +0 -17
- package/dist/src/core/utils.d.ts +0 -51
- package/dist/src/core/xhr-config.d.ts +0 -22
- package/dist/src/core/xhr.d.ts +0 -71
- package/src/core/cookies.ts +0 -43
- package/src/core/dom.ts +0 -47
- package/src/core/utils.ts +0 -179
- package/src/core/xhr-config.ts +0 -25
- package/src/core/xhr.ts +0 -296
- package/src/index.ts +0 -6
package/README.md
CHANGED
|
@@ -1,66 +1,131 @@
|
|
|
1
1
|
[](https://www.npmjs.com/package/@ajaxjs/util)
|
|
2
|
+
|
|
2
3
|
[](https://www.typescriptlang.org/)
|
|
4
|
+
|
|
3
5
|
[](http://www.apache.org/licenses/LICENSE-2.0.txt)
|
|
6
|
+
|
|
4
7
|
[](mailto:frank@ajaxjs.com)
|
|
8
|
+
|
|
5
9
|
[](https://shang.qq.com/wpa/qunwpa?idkey=3877893a4ed3a5f0be01e809e7ac120e346102bd550deb6692239bb42de38e22)
|
|
6
10
|
|
|
11
|
+
|
|
12
|
+
|
|
7
13
|
# AjaxJS JS Utils
|
|
14
|
+
|
|
8
15
|
Some common JS functions.
|
|
9
16
|
|
|
17
|
+
|
|
18
|
+
|
|
10
19
|
NPM: https://www.npmjs.com/package/@ajaxjs/util
|
|
11
20
|
|
|
12
21
|
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
13
25
|
# How to create a NPM package?
|
|
26
|
+
|
|
14
27
|
Use Rollup to build your package.
|
|
15
28
|
|
|
29
|
+
|
|
30
|
+
|
|
16
31
|
```
|
|
32
|
+
|
|
17
33
|
npm init
|
|
34
|
+
|
|
18
35
|
npm add typescript -D
|
|
36
|
+
|
|
19
37
|
tsc --init
|
|
20
38
|
|
|
39
|
+
|
|
40
|
+
|
|
21
41
|
npm install rollup -g # 全局安装
|
|
42
|
+
|
|
22
43
|
npm install rollup -D # 项目本地安装
|
|
44
|
+
|
|
23
45
|
npm install @rollup/plugin-typescript -D # 将Typescript转换成为 ES6+ 标准
|
|
46
|
+
|
|
24
47
|
npm install @rollup/plugin-commonjs -D # rollup默认不支持CommonJS,自己写的时候可以尽量避免使用CommonJS模块的语法,但有些外部库的是cjs或者umd(由webpack打包的)。如果使用这些外部库就需要支持CommonJS模块。
|
|
48
|
+
|
|
25
49
|
npm install @rollup/plugin-node-resolve -D
|
|
50
|
+
|
|
26
51
|
npm init @eslint/config
|
|
52
|
+
|
|
27
53
|
npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
|
|
54
|
+
|
|
28
55
|
```
|
|
29
56
|
|
|
57
|
+
|
|
58
|
+
|
|
30
59
|
https://chieminchan.vercel.app/articles/Project%20Management/%E6%89%8B%E6%8A%8A%E6%89%8B%E6%95%99%E4%BD%A0%E5%8F%91%E4%B8%AAnpm%E5%8C%85.html
|
|
31
60
|
|
|
61
|
+
|
|
62
|
+
|
|
32
63
|
# Rollup Config
|
|
64
|
+
|
|
33
65
|
## 1
|
|
34
66
|
|
|
67
|
+
|
|
68
|
+
|
|
35
69
|
升级到最新版本 rollup: 4.14.3 后 rollup.config.js 配置文件中却不能使用 es6 import 语法了!
|
|
36
70
|
|
|
71
|
+
|
|
72
|
+
|
|
37
73
|
rollup: 4.14.3 时报错:SyntaxError: Cannot use import statement outside a module
|
|
38
74
|
|
|
75
|
+
|
|
76
|
+
|
|
39
77
|
解决方法1
|
|
78
|
+
|
|
40
79
|
打包命令添加: `--bundleConfigAsCjs`
|
|
80
|
+
|
|
41
81
|
修改打包命令: `"dev": "rollup -c rollup.config.js --bundleConfigAsCjs -w"` 重新执行则解决
|
|
42
82
|
|
|
43
83
|
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
44
87
|
解决方法2
|
|
88
|
+
|
|
45
89
|
package.json 中添加:"type": "module",
|
|
90
|
+
|
|
46
91
|
这样设置只是支持 es6语法,但 import 语法是不可以引入 .json文件的!
|
|
47
92
|
|
|
48
93
|
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
49
97
|
链接:https://juejin.cn/post/7359893210797015051
|
|
50
98
|
|
|
99
|
+
|
|
100
|
+
|
|
51
101
|
## 2
|
|
102
|
+
|
|
52
103
|
项目至少包含一个扩展名为 `.ts` 的文件
|
|
53
104
|
|
|
105
|
+
|
|
106
|
+
|
|
54
107
|
error TS18003: No inputs were found in config file '/Users/jiyik/workspace/ts/tsconfig.json'. Specified 'include' paths were '["src/**/*"]' and 'exclude' paths were '["node_modules"]'
|
|
55
108
|
|
|
109
|
+
|
|
110
|
+
|
|
56
111
|
`tsconfig.json` 文件中设置:
|
|
57
112
|
|
|
113
|
+
|
|
114
|
+
|
|
58
115
|
```json
|
|
116
|
+
|
|
59
117
|
{
|
|
118
|
+
|
|
60
119
|
"compilerOptions": {
|
|
120
|
+
|
|
61
121
|
// ... 配置项
|
|
122
|
+
|
|
62
123
|
},
|
|
124
|
+
|
|
63
125
|
"include": ["src/**/*"],
|
|
126
|
+
|
|
64
127
|
"exclude": ["node_modules"]
|
|
128
|
+
|
|
65
129
|
}
|
|
130
|
+
|
|
66
131
|
```
|