@whitesev/utils 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "一个常用的工具库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/node/index.esm.js",
@@ -23,6 +23,7 @@
23
23
  "author": "WhiteSev",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
+ "@rollup/plugin-babel": "^6.0.4",
26
27
  "@rollup/plugin-commonjs": "^25.0.8",
27
28
  "@rollup/plugin-node-resolve": "^15.2.3",
28
29
  "@rollup/plugin-typescript": "^11.1.6",
package/rollup.config.js CHANGED
@@ -1,9 +1,11 @@
1
1
  // 允许使用 node 或 umd 包
2
2
  const commonjs = require("@rollup/plugin-commonjs");
3
+ // 解析导入的依赖模块路径,以便 Rollup 能够正确找到依赖模块。
3
4
  const { nodeResolve } = require("@rollup/plugin-node-resolve");
4
5
  // 编译 TS 代码
5
6
  const typescript = require("@rollup/plugin-typescript");
6
7
 
8
+ const moduleName = "Utils";
7
9
  module.exports = {
8
10
  plugins: [nodeResolve(), commonjs(), typescript()],
9
11
  input: "./index.ts", // 源文件入口
@@ -20,9 +22,26 @@ module.exports = {
20
22
  },
21
23
  {
22
24
  file: "dist/index.umd.js",
23
- name: "Utils", // 模块名
25
+ name: moduleName, // 模块名
24
26
  format: "umd", // umd 兼容形式的包, 可以直接应用于网页 script
25
27
  sourcemap: true,
26
28
  },
29
+ {
30
+ file: "dist/index.amd.js",
31
+ format: "amd", // amd 兼容形式的包, 适用于浏览器环境中使用 AMD 加载器加载模块
32
+ sourcemap: true,
33
+ },
34
+ {
35
+ file: "dist/index.iife.js",
36
+ name: moduleName, // 模块名
37
+ format: "iife", // iife 兼容形式的包, 将模块包裹在一个立即执行的函数中。适用于直接在浏览器中使用
38
+ sourcemap: true,
39
+ },
40
+ {
41
+ file: "dist/index.system.js",
42
+ name: moduleName, // 模块名
43
+ format: "system", // system 兼容形式的包, 可以在浏览器和 Node.js 环境下加载
44
+ sourcemap: true,
45
+ },
27
46
  ],
28
47
  };
package/src/ajaxHooker.js CHANGED
@@ -1,9 +1,7 @@
1
- // ==UserScript==
2
1
  // @name ajaxHooker
3
2
  // @author cxxjackie
4
3
  // @version 1.4.1
5
4
  // @supportURL https://bbs.tampermonkey.net.cn/thread-3284-1-1.html
6
- // ==/UserScript==
7
5
 
8
6
  var ajaxHooker = (function () {
9
7
  "use strict";