deeke-script-app 1.1.3 → 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/.vscode/settings.json +1 -1
- package/@deekeScript/@type/Class/UiSelector.d.ts +191 -192
- package/@deekeScript/@type/interface/App.d.ts +87 -87
- package/@deekeScript/@type/interface/Storage.d.ts +110 -109
- package/deekeScript.json +28 -1519
- package/deekeScript.zip +0 -0
- package/{src/deekeScriptZipBuild → deekeScriptZipBuild} +2 -1
- package/images/test/ad.png +0 -0
- package/images/test/add.png +0 -0
- package/images/test/ai-back.png +0 -0
- package/images/test/ai.png +0 -0
- package/images/test/anchor_focus.png +0 -0
- package/images/test/auto-2.png +0 -0
- package/images/test/back.png +0 -0
- package/images/test/barrage.png +0 -0
- package/images/test/cancel_focus.png +0 -0
- package/images/test/cancel_zan.png +0 -0
- package/images/test/city.png +0 -0
- package/images/test/clear.png +0 -0
- package/images/test/clear_fans.png +0 -0
- package/images/test/close.png +0 -0
- package/images/test/comment-2.png +0 -0
- package/images/test/delete.png +0 -0
- package/images/test/edit.png +0 -0
- package/images/test/fans-inc.png +0 -0
- package/images/test/fans.png +0 -0
- package/images/test/finger.png +0 -0
- package/images/test/friend.png +0 -0
- package/images/test/grab.png +0 -0
- package/images/test/home-top.png +0 -0
- package/images/test/home.png +0 -0
- package/images/test/hot.png +0 -0
- package/images/test/into.png +0 -0
- package/images/test/invite.png +0 -0
- package/images/test/jubao.png +0 -0
- package/images/test/kefu.png +0 -0
- package/images/test/live-zan.png +0 -0
- package/images/test/live.png +0 -0
- package/images/test/manual.png +0 -0
- package/images/test/member.png +0 -0
- package/images/test/msg_back.png +0 -0
- package/images/test/new_user.png +0 -0
- package/images/test/notice-2.png +0 -0
- package/images/test/notice.png +0 -0
- package/images/test/openai-icon.png +0 -0
- package/images/test/precise-user.png +0 -0
- package/images/test/private-2.png +0 -0
- package/images/test/qingsong.png +0 -0
- package/images/test/robot.png +0 -0
- package/images/test/rocket.png +0 -0
- package/images/test/score.png +0 -0
- package/images/test/score_live.png +0 -0
- package/images/test/sett.png +0 -0
- package/images/test/setting-top.png +0 -0
- package/images/test/setting.png +0 -0
- package/images/test/show.png +0 -0
- package/images/test/show_password.png +0 -0
- package/images/test/speech-say.png +0 -0
- package/images/test/speech.png +0 -0
- package/images/test/task.png +0 -0
- package/images/test/team-buy.png +0 -0
- package/images/test/tool.png +0 -0
- package/images/test/tuandui.png +0 -0
- package/images/test/update.png +0 -0
- package/images/test/upload.png +0 -0
- package/images/test/user-get.png +0 -0
- package/images/test/vertical.png +0 -0
- package/images/test/view_back.png +0 -0
- package/images/test/weixin.png +0 -0
- package/images/test/xhs-fans.png +0 -0
- package/images/test/xhs-wanneng.png +0 -0
- package/images/test/xhs-zan.png +0 -0
- package/images/test/zan-1.png +0 -0
- package/images/test/zan.png +0 -0
- package/init +1 -1
- package/jsconfig.json +11 -0
- package/obfuscator.config.json +14 -0
- package/package.json +11 -14
- package/script/index.js +1 -45
- package/script/index.js.map +1 -1
- package/script/statistics/statistics.js +120 -0
- package/script/task/dy.js +56 -0
- package/script/task/dy.js.map +1 -0
- package/script/task/dyApp.js +55 -0
- package/script/task/dyApp.js.map +1 -0
- package/script/task/dyCity.js +43 -0
- package/script/task/dyCity.js.map +1 -0
- package/script/task/tool.js +62 -0
- package/script/task/tool.js.map +1 -0
- package/script/task.html +4 -0
- package/src/statistics/statistics.js +120 -0
- package/src/task/dy.js +14 -0
- package/src/task/dyApp.js +7 -0
- package/src/task/dyCity.js +1 -0
- package/src/task/tool.js +19 -0
- package/src/task.html +4 -0
- package/test/console.js +5 -0
- package/test/encrypt.js +4 -0
- package/test/engines.js +5 -0
- package/test/extension.js +26 -0
- package/test/files.js +7 -0
- package/test/http.js +4 -0
- package/test/log.js +10 -0
- package/test/package.js +3 -0
- package/test/permise.js +14 -0
- package/test/thread.js +11 -0
- package/test/timer.js +25 -0
- package/script/task/task.js +0 -88
- package/script/task/task.js.map +0 -1
- package/script/task/test.js +0 -56
- package/script/task/test.js.map +0 -1
- package/src/task/task.ts +0 -25
- package/test.js +0 -169
- package/tsconfig.json +0 -107
- package/webpack.config.js +0 -56
- /package/images/{app.png → test/app.png} +0 -0
- /package/src/{index.ts → index.js} +0 -0
package/test.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
const Common = {
|
|
2
|
-
id(name) {
|
|
3
|
-
return UiSelector().id(this.fullId(name));
|
|
4
|
-
},
|
|
5
|
-
|
|
6
|
-
fullId(name) {
|
|
7
|
-
return this.package() + ':id/' + name;
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
package() {
|
|
11
|
-
return 'com.tencent.mm';
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
click(tag) {
|
|
15
|
-
return Gesture.click(tag.bounds().left + tag.bounds().width() * Math.random(), tag.bounds().top + tag.bounds().height() * Math.random());
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
sleep(mill, randMill) {
|
|
19
|
-
if (!randMill) {
|
|
20
|
-
randMill = mill / 2 * Math.random();
|
|
21
|
-
mill /= 2;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
System.sleep(mill + randMill);
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
back(times) {
|
|
28
|
-
while (times-- > 0) {
|
|
29
|
-
Gesture.back();
|
|
30
|
-
System.sleep(500);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
find(func) {
|
|
35
|
-
let i = 5;
|
|
36
|
-
while (i-- > 0) {
|
|
37
|
-
let res = func();
|
|
38
|
-
if (res) {
|
|
39
|
-
return res;
|
|
40
|
-
}
|
|
41
|
-
System.sleep(1000);//查找3次,每次都没有就休眠1秒钟
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const task = {
|
|
48
|
-
run(name) {
|
|
49
|
-
const concat = Common.find(() => UiSelector().textContains('通讯录').filter(v => {
|
|
50
|
-
return v && v.id() == Common.fullId('icon_tv');
|
|
51
|
-
}).findOne());
|
|
52
|
-
|
|
53
|
-
console.log(concat);
|
|
54
|
-
if (!concat) {
|
|
55
|
-
throw new Error('找不到通讯录');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
Common.click(concat);
|
|
59
|
-
System.sleep(1200);
|
|
60
|
-
|
|
61
|
-
const tag = Common.find(() => UiSelector().textContains('标签').filter(v => {
|
|
62
|
-
return v.id() == Common.fullId('n9');
|
|
63
|
-
}).findOne());
|
|
64
|
-
console.log(tag);
|
|
65
|
-
if (!tag) {
|
|
66
|
-
throw new Error('找不到标签');
|
|
67
|
-
}
|
|
68
|
-
Common.click(tag);
|
|
69
|
-
System.sleep(1200);
|
|
70
|
-
|
|
71
|
-
const myTag = Common.find(() => UiSelector().textContains(name).filter(v => {
|
|
72
|
-
return v.id() === Common.fullId('hs8');
|
|
73
|
-
}).findOne());
|
|
74
|
-
console.log(myTag);
|
|
75
|
-
if (!myTag) {
|
|
76
|
-
throw new Error('找不到标签:' + name);
|
|
77
|
-
}
|
|
78
|
-
Common.click(myTag);
|
|
79
|
-
System.sleep(1200);
|
|
80
|
-
|
|
81
|
-
let tags = UiSelector().textMatches('[\\s\\S]+').className('android.widget.TextView').filter(v => {
|
|
82
|
-
return v.id() === Common.fullId('kbq');
|
|
83
|
-
}).find();
|
|
84
|
-
if (tags.length == 0) {
|
|
85
|
-
console.log('没有记录')
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
for (let i in tags) {
|
|
90
|
-
Common.click(tags[i]);
|
|
91
|
-
Common.sleep(2000);
|
|
92
|
-
|
|
93
|
-
this.clickSendMsg();
|
|
94
|
-
this.sendMsg(msg);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return true;
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
clickSendMsg() {
|
|
101
|
-
let tags = Common.find(() => UiSelector().clickable(false).filter(v => {
|
|
102
|
-
return v.bounds().width() === v.bounds().height() && v.id() === Common.fullId('h5n');
|
|
103
|
-
}).find());
|
|
104
|
-
|
|
105
|
-
if (tags.length === 0) {
|
|
106
|
-
throw new Error('出错了,找不到发送消息按钮');
|
|
107
|
-
}
|
|
108
|
-
Common.click(tags[0]);
|
|
109
|
-
Common.sleep(2000);
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
sendMsg(msg) {
|
|
113
|
-
let ipt = Common.find(UiSelector().className('android.widget.EditText').filter(v => {
|
|
114
|
-
return v.id() === Common.fullId('bkk');
|
|
115
|
-
}).findOne());
|
|
116
|
-
|
|
117
|
-
if (!ipt) {
|
|
118
|
-
throw new Error('找不到输入框');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Common.click(ipt);
|
|
122
|
-
Common.sleep(2000);
|
|
123
|
-
|
|
124
|
-
ipt = Common.find(UiSelector().className('android.widget.EditText').filter(v => {
|
|
125
|
-
return v.id() === Common.fullId('bkk');
|
|
126
|
-
}).findOne());
|
|
127
|
-
|
|
128
|
-
if (!ipt) {
|
|
129
|
-
throw new Error('找不到输入框');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
Gesture.back();
|
|
133
|
-
ipt.setText(msg);
|
|
134
|
-
Common.sleep(2000);
|
|
135
|
-
|
|
136
|
-
const send = Common.find(UiSelector().className('android.widget.Button').filter(v => {
|
|
137
|
-
return v.bounds().left > Device.width() * 0.8 && v.bounds().top > Device.height() * 0.8;
|
|
138
|
-
}).findOne());
|
|
139
|
-
if (!send) {
|
|
140
|
-
throw new Error('找不到发送按钮');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
Common.click(send);
|
|
144
|
-
Common.sleep(2000);
|
|
145
|
-
Common.back(2);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
let k = 3;
|
|
150
|
-
// while (k-- > 0) {
|
|
151
|
-
// try {
|
|
152
|
-
// App.launch(Common.package());//打开抖音
|
|
153
|
-
// Common.sleep(8000);
|
|
154
|
-
// if (task.run('嘀客', '😄 你好呀~')) {
|
|
155
|
-
// FloatDialogs.show('温馨提示', '执行完成');
|
|
156
|
-
// }
|
|
157
|
-
// } catch (e) {
|
|
158
|
-
// console.log(e);
|
|
159
|
-
// }
|
|
160
|
-
// }
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// const concat = Common.find(() => UiSelector().textContains('通讯录').filter(v => {
|
|
164
|
-
// return true;
|
|
165
|
-
// }).findOne());
|
|
166
|
-
|
|
167
|
-
// console.log(concat);
|
|
168
|
-
|
|
169
|
-
console.log(UiSelector().textContains('标签').find());
|
package/tsconfig.json
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
/* Projects */
|
|
5
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
6
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
7
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
8
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
9
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
10
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
11
|
-
/* Language and Environment */
|
|
12
|
-
"target": "ES5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
13
|
-
"lib": ["ES5"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
14
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
15
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
16
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
17
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
18
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
19
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
20
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
21
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
22
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
23
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
24
|
-
/* Modules */
|
|
25
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
26
|
-
"rootDir": "./src", /* Specify the root folder within your source files. */
|
|
27
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
28
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
29
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
30
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
31
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
32
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
33
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
34
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
35
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
36
|
-
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
37
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
38
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
39
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
40
|
-
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
41
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
42
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
43
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
44
|
-
/* JavaScript Support */
|
|
45
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
46
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
47
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
48
|
-
/* Emit */
|
|
49
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
50
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
51
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
52
|
-
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
53
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
54
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
55
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
56
|
-
"outDir": "./script", /* Specify an output folder for all emitted files. */
|
|
57
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
58
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
59
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
60
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
61
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
62
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
63
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
64
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
65
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
66
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
67
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
68
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
69
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
70
|
-
/* Interop Constraints */
|
|
71
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
72
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
73
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
74
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
75
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
76
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
77
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
78
|
-
/* Type Checking */
|
|
79
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
80
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
81
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
82
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
83
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
84
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
85
|
-
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
86
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
87
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
88
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
89
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
90
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
91
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
92
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
93
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
94
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
95
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
96
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
97
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
98
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
99
|
-
/* Completeness */
|
|
100
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
101
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
-
},
|
|
103
|
-
|
|
104
|
-
"exclude": [
|
|
105
|
-
"node_modules",
|
|
106
|
-
]
|
|
107
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const glob = require('glob');
|
|
3
|
-
const scriptDir = 'script';
|
|
4
|
-
const WebpackObfuscator = require('webpack-obfuscator');//代码混淆
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
devtool: 'source-map',
|
|
8
|
-
entry: {
|
|
9
|
-
index: './src/index.ts', // 主入口文件
|
|
10
|
-
// 动态获取 src/task 下所有的 .ts 文件
|
|
11
|
-
...glob.sync('./src/**/*.ts').reduce((entries, file) => {
|
|
12
|
-
// 使用文件路径作为输出文件的键
|
|
13
|
-
const name = path.relative('./src', file).replace('.ts', '');
|
|
14
|
-
entries[name] = './' + file;
|
|
15
|
-
return entries;
|
|
16
|
-
}, {}),
|
|
17
|
-
},
|
|
18
|
-
output: {
|
|
19
|
-
// 动态计算输出路径,保证文件夹结构与入口目录一致
|
|
20
|
-
filename: (pathData) => {
|
|
21
|
-
// 获取入口文件的相对路径,去掉 .ts 后缀
|
|
22
|
-
const relativePath = pathData.chunk.name;
|
|
23
|
-
|
|
24
|
-
// 根据相对路径生成对应的输出路径
|
|
25
|
-
return `${relativePath}.js`; // 输出结构与入口文件相同
|
|
26
|
-
},
|
|
27
|
-
path: path.resolve(__dirname, scriptDir),
|
|
28
|
-
},
|
|
29
|
-
resolve: {
|
|
30
|
-
extensions: ['.ts', '.js'], // 解析扩展名
|
|
31
|
-
},
|
|
32
|
-
module: {
|
|
33
|
-
rules: [
|
|
34
|
-
{
|
|
35
|
-
test: /\.ts$/,
|
|
36
|
-
use: 'ts-loader', // 使用 ts-loader 编译 TypeScript
|
|
37
|
-
exclude: /node_modules/,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
optimization: {
|
|
42
|
-
minimize: false, // 关闭代码压缩 开启后,代码行数会减少
|
|
43
|
-
},
|
|
44
|
-
plugins: [
|
|
45
|
-
new WebpackObfuscator({
|
|
46
|
-
compact: false, //代码压缩 不建议开启,否则代码错误很难排查
|
|
47
|
-
rotateStringArray: true, // 启用字符串数组混淆
|
|
48
|
-
controlFlowFlattening: true, // 控制流扁平化
|
|
49
|
-
deadCodeInjection: true, // 注入死代码
|
|
50
|
-
stringArray: true, // 启用字符串数组化 不能启用,否则rhino无法处理
|
|
51
|
-
stringArrayThreshold: 0.75, // 配置字符串数组化的阈值
|
|
52
|
-
disableConsoleOutput: false, // 禁用 console 输出
|
|
53
|
-
sourceMap: true, // 启用生成 sourcemap
|
|
54
|
-
}), // 指定要混淆的文件
|
|
55
|
-
]
|
|
56
|
-
};
|
|
File without changes
|
|
File without changes
|