zcw-shared 1.34.1 → 1.36.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/dist/functions/android/integrateUniAppNativePlugin.d.ts +22 -0
- package/dist/functions/android/integrateUniAppNativePlugin.js +464 -0
- package/dist/functions/android/integrateUniAppNativePlugin.js.map +1 -0
- package/dist/functions/android/integrateWechatShare.d.ts +13 -0
- package/dist/functions/android/integrateWechatShare.js +154 -0
- package/dist/functions/android/integrateWechatShare.js.map +1 -0
- package/dist/functions/async/cancellableFetch.d.ts +12 -0
- package/dist/functions/async/cancellableFetch.js +27 -0
- package/dist/functions/async/cancellableFetch.js.map +1 -0
- package/dist/functions/async/cancellableXHR.d.ts +21 -0
- package/dist/functions/async/cancellableXHR.js +96 -0
- package/dist/functions/async/cancellableXHR.js.map +1 -0
- package/dist/functions/functional/constant.d.ts +1 -0
- package/dist/functions/functional/constant.js +4 -0
- package/dist/functions/functional/constant.js.map +1 -0
- package/dist/functions/functional/identity.d.ts +1 -0
- package/dist/functions/functional/identity.js +4 -0
- package/dist/functions/functional/identity.js.map +1 -0
- package/dist/functions/functional/noop.d.ts +1 -0
- package/dist/functions/functional/noop.js +3 -0
- package/dist/functions/functional/noop.js.map +1 -0
- package/dist/functions/image/renderBankCard.d.ts +52 -0
- package/dist/functions/image/renderBankCard.js +177 -0
- package/dist/functions/image/renderBankCard.js.map +1 -0
- package/dist/functions/software/publishToPgyer.d.ts +16 -0
- package/dist/functions/software/publishToPgyer.js +96 -0
- package/dist/functions/software/publishToPgyer.js.map +1 -0
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js +66 -0
- package/dist/functions/uniapp/app-plus/buildAndroidApp.js.map +1 -1
- package/dist/functions/validation/generateFakeBankCard.d.ts +87 -0
- package/dist/functions/validation/generateFakeBankCard.js +152 -0
- package/dist/functions/validation/generateFakeBankCard.js.map +1 -0
- package/package.json +10 -2
- package/references/blob.d.ts +4 -0
- package/references/fetch.d.ts +22 -0
- package/references/xhr.d.ts +47 -0
- package/types/pgyer.d.ts +64 -0
- package/types/uniapp-android-build.d.ts +36 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FileSystem, Path, ChildProcess } from '../../../references/node.d';
|
|
2
|
+
import type { JSON5Parser } from '../../../references/json5.d';
|
|
3
|
+
import { type IntegrateThirdPartyModuleDeps } from './integrateThirdPartyModule';
|
|
4
|
+
export interface UniAppNativePluginItem {
|
|
5
|
+
type: string;
|
|
6
|
+
name: string;
|
|
7
|
+
class: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IntegrateUniAppNativePluginDeps extends IntegrateThirdPartyModuleDeps {
|
|
10
|
+
parse: JSON5Parser['parse'];
|
|
11
|
+
readdirSync: FileSystem['readdirSync'];
|
|
12
|
+
statSync: FileSystem['statSync'];
|
|
13
|
+
exec: ChildProcess['exec'];
|
|
14
|
+
basename: Path['basename'];
|
|
15
|
+
dirname: Path['dirname'];
|
|
16
|
+
}
|
|
17
|
+
export declare function integrateUniAppNativePlugin(projectPath: string, moduleDir: string, packageName: string, pluginPath: string, deps: IntegrateUniAppNativePluginDeps): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
message?: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
logs: string[];
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
import { integrateThirdPartyModule } from './integrateThirdPartyModule';
|
|
2
|
+
async function extractPlugin(pluginPath, extractDir, deps) {
|
|
3
|
+
try {
|
|
4
|
+
if (!deps.existsSync(pluginPath)) {
|
|
5
|
+
return {
|
|
6
|
+
success: false,
|
|
7
|
+
error: `插件路径不存在: ${pluginPath}`
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
const stat = deps.statSync(pluginPath);
|
|
11
|
+
if (stat.isDirectory()) {
|
|
12
|
+
return {
|
|
13
|
+
success: true,
|
|
14
|
+
extractedPath: pluginPath
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (stat.isFile()) {
|
|
18
|
+
const fileName = deps.basename(pluginPath);
|
|
19
|
+
const ext = fileName.split('.').pop()?.toLowerCase();
|
|
20
|
+
if (ext !== 'zip') {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
error: `不支持的插件格式: ${ext},仅支持 zip 格式`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const pluginName = fileName.replace(/\.zip$/i, '');
|
|
27
|
+
const targetDir = deps.join(extractDir, pluginName);
|
|
28
|
+
if (!deps.existsSync(targetDir)) {
|
|
29
|
+
deps.mkdirSync(targetDir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
deps.exec(`unzip -q -o "${pluginPath}" -d "${targetDir}"`, (error, stdout, stderr) => {
|
|
33
|
+
if (error) {
|
|
34
|
+
resolve({
|
|
35
|
+
success: false,
|
|
36
|
+
error: `解压插件失败: ${error.message}${stderr ? `\n${stderr}` : ''}`
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
let extractedPath = targetDir;
|
|
41
|
+
try {
|
|
42
|
+
const entries = deps.readdirSync(targetDir);
|
|
43
|
+
if (entries.length === 1) {
|
|
44
|
+
const singleEntry = deps.join(targetDir, entries[0]);
|
|
45
|
+
const singleStat = deps.statSync(singleEntry);
|
|
46
|
+
if (singleStat.isDirectory()) {
|
|
47
|
+
const packageJsonPath = deps.join(singleEntry, 'package.json');
|
|
48
|
+
const androidDir = deps.join(singleEntry, 'android');
|
|
49
|
+
if (deps.existsSync(packageJsonPath) || deps.existsSync(androidDir)) {
|
|
50
|
+
extractedPath = singleEntry;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
}
|
|
57
|
+
resolve({
|
|
58
|
+
success: true,
|
|
59
|
+
extractedPath: extractedPath
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
success: false,
|
|
67
|
+
error: '插件路径既不是文件也不是目录'
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return {
|
|
72
|
+
success: false,
|
|
73
|
+
error: `解压插件失败: ${error instanceof Error ? error.message : String(error)}`
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function readPluginPackageJson(pluginDir, deps) {
|
|
78
|
+
try {
|
|
79
|
+
const packageJsonPath = deps.join(pluginDir, 'package.json');
|
|
80
|
+
if (!deps.existsSync(packageJsonPath)) {
|
|
81
|
+
return {
|
|
82
|
+
success: false,
|
|
83
|
+
error: `插件 package.json 不存在: ${packageJsonPath}`
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const content = deps.readFileSync(packageJsonPath, 'utf8');
|
|
87
|
+
const packageJson = deps.parse(content);
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
packageJson
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return {
|
|
95
|
+
success: false,
|
|
96
|
+
error: `读取插件 package.json 失败: ${error instanceof Error ? error.message : String(error)}`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function findLibFilesRecursive(dir, deps) {
|
|
101
|
+
const libFiles = [];
|
|
102
|
+
if (!deps.existsSync(dir)) {
|
|
103
|
+
return libFiles;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const entries = deps.readdirSync(dir);
|
|
107
|
+
for (const entry of entries) {
|
|
108
|
+
const entryPath = deps.join(dir, entry);
|
|
109
|
+
const stat = deps.statSync(entryPath);
|
|
110
|
+
if (stat.isFile()) {
|
|
111
|
+
const ext = entry.split('.').pop()?.toLowerCase();
|
|
112
|
+
if (ext === 'aar' || ext === 'jar') {
|
|
113
|
+
libFiles.push(entryPath);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else if (stat.isDirectory()) {
|
|
117
|
+
libFiles.push(...findLibFilesRecursive(entryPath, deps));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
}
|
|
123
|
+
return libFiles;
|
|
124
|
+
}
|
|
125
|
+
function findAndroidLibFiles(pluginDir, deps) {
|
|
126
|
+
const androidDir = deps.join(pluginDir, 'android');
|
|
127
|
+
return findLibFilesRecursive(androidDir, deps);
|
|
128
|
+
}
|
|
129
|
+
function copyAndroidFilesRecursive(sourceDir, projectPath, moduleDir, packageName, excludeFiles, deps) {
|
|
130
|
+
const logs = [];
|
|
131
|
+
let count = 0;
|
|
132
|
+
const excludeSet = new Set(excludeFiles.map(f => deps.join(f).replace(/\\/g, '/')));
|
|
133
|
+
function copyRecursive(currentSource, currentTarget, relativePath = '') {
|
|
134
|
+
if (!deps.existsSync(currentSource)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
try {
|
|
138
|
+
const entries = deps.readdirSync(currentSource);
|
|
139
|
+
for (const entry of entries) {
|
|
140
|
+
const sourcePath = deps.join(currentSource, entry);
|
|
141
|
+
const normalizedSource = sourcePath.replace(/\\/g, '/');
|
|
142
|
+
if (excludeSet.has(normalizedSource)) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const stat = deps.statSync(sourcePath);
|
|
146
|
+
const targetPath = deps.join(currentTarget, entry);
|
|
147
|
+
const newRelativePath = relativePath ? deps.join(relativePath, entry) : entry;
|
|
148
|
+
if (stat.isFile()) {
|
|
149
|
+
const ext = entry.split('.').pop()?.toLowerCase();
|
|
150
|
+
if (ext === 'java' || ext === 'kt') {
|
|
151
|
+
const javaTargetDir = deps.join(projectPath, moduleDir, 'src', 'main', 'java', ...packageName.split('.'));
|
|
152
|
+
const javaTargetPath = deps.join(javaTargetDir, newRelativePath);
|
|
153
|
+
const targetDir = deps.dirname(javaTargetPath);
|
|
154
|
+
if (!deps.existsSync(targetDir)) {
|
|
155
|
+
deps.mkdirSync(targetDir, { recursive: true });
|
|
156
|
+
}
|
|
157
|
+
let content = deps.readFileSync(sourcePath, 'utf8');
|
|
158
|
+
deps.writeFileSync(javaTargetPath, content, 'utf8');
|
|
159
|
+
logs.push(`已拷贝 Java 源文件: ${newRelativePath}`);
|
|
160
|
+
count++;
|
|
161
|
+
}
|
|
162
|
+
else if (ext === 'xml' && (newRelativePath.includes('res/') || newRelativePath.includes('AndroidManifest'))) {
|
|
163
|
+
if (entry === 'AndroidManifest.xml') {
|
|
164
|
+
logs.push(`跳过 AndroidManifest.xml(需要手动合并)`);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
const resTargetPath = deps.join(projectPath, moduleDir, 'src', 'main', 'res', newRelativePath.replace(/^res\//, ''));
|
|
168
|
+
const targetDir = deps.dirname(resTargetPath);
|
|
169
|
+
if (!deps.existsSync(targetDir)) {
|
|
170
|
+
deps.mkdirSync(targetDir, { recursive: true });
|
|
171
|
+
}
|
|
172
|
+
deps.copyFileSync(sourcePath, resTargetPath);
|
|
173
|
+
logs.push(`已拷贝资源文件: ${newRelativePath}`);
|
|
174
|
+
count++;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
const otherTargetPath = deps.join(projectPath, moduleDir, 'src', 'main', newRelativePath);
|
|
179
|
+
const targetDir = deps.dirname(otherTargetPath);
|
|
180
|
+
if (!deps.existsSync(targetDir)) {
|
|
181
|
+
deps.mkdirSync(targetDir, { recursive: true });
|
|
182
|
+
}
|
|
183
|
+
deps.copyFileSync(sourcePath, otherTargetPath);
|
|
184
|
+
logs.push(`已拷贝文件: ${newRelativePath}`);
|
|
185
|
+
count++;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else if (stat.isDirectory()) {
|
|
189
|
+
copyRecursive(sourcePath, targetPath, newRelativePath);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
logs.push(`拷贝文件时出错: ${error instanceof Error ? error.message : String(error)}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const androidTargetBase = deps.join(projectPath, moduleDir, 'src', 'main');
|
|
198
|
+
copyRecursive(sourceDir, androidTargetBase, '');
|
|
199
|
+
return { count, logs };
|
|
200
|
+
}
|
|
201
|
+
function extractPluginConfig(packageJson) {
|
|
202
|
+
try {
|
|
203
|
+
let plugins = null;
|
|
204
|
+
const nativePlugins = packageJson.nativePlugins || packageJson['uni-app']?.nativePlugins;
|
|
205
|
+
if (nativePlugins && Array.isArray(nativePlugins) && nativePlugins.length > 0) {
|
|
206
|
+
for (const pluginGroup of nativePlugins) {
|
|
207
|
+
if (pluginGroup.plugins && Array.isArray(pluginGroup.plugins)) {
|
|
208
|
+
plugins = pluginGroup.plugins;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (!plugins && packageJson._dp_nativeplugin) {
|
|
214
|
+
const androidPlugins = packageJson._dp_nativeplugin.android?.plugins;
|
|
215
|
+
if (androidPlugins && Array.isArray(androidPlugins) && androidPlugins.length > 0) {
|
|
216
|
+
plugins = androidPlugins;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (!plugins || plugins.length === 0) {
|
|
220
|
+
return {
|
|
221
|
+
success: false,
|
|
222
|
+
error: 'package.json 中未找到 nativePlugins 或 _dp_nativeplugin 配置'
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
for (const plugin of plugins) {
|
|
226
|
+
if (plugin.type === 'module' && plugin.name && plugin.class) {
|
|
227
|
+
return {
|
|
228
|
+
success: true,
|
|
229
|
+
pluginItem: {
|
|
230
|
+
type: plugin.type,
|
|
231
|
+
name: plugin.name,
|
|
232
|
+
class: plugin.class
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
238
|
+
success: false,
|
|
239
|
+
error: 'package.json 中未找到有效的 module 类型插件配置'
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
return {
|
|
244
|
+
success: false,
|
|
245
|
+
error: `提取插件配置失败: ${error instanceof Error ? error.message : String(error)}`
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function readOrCreateUniPluginsConfig(assetsDir, deps) {
|
|
250
|
+
const configPath = deps.join(assetsDir, 'dcloud_uniplugins.json');
|
|
251
|
+
try {
|
|
252
|
+
if (!deps.existsSync(assetsDir)) {
|
|
253
|
+
deps.mkdirSync(assetsDir, { recursive: true });
|
|
254
|
+
}
|
|
255
|
+
let config = {
|
|
256
|
+
nativePlugins: []
|
|
257
|
+
};
|
|
258
|
+
if (deps.existsSync(configPath)) {
|
|
259
|
+
const content = deps.readFileSync(configPath, 'utf8');
|
|
260
|
+
try {
|
|
261
|
+
config = deps.parse(content);
|
|
262
|
+
if (!config.nativePlugins || !Array.isArray(config.nativePlugins)) {
|
|
263
|
+
config.nativePlugins = [];
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (parseError) {
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
success: true,
|
|
271
|
+
config
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
return {
|
|
276
|
+
success: false,
|
|
277
|
+
error: `读取或创建 dcloud_uniplugins.json 失败: ${error instanceof Error ? error.message : String(error)}`
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
function updateUniPluginsConfig(assetsDir, pluginItem, deps) {
|
|
282
|
+
try {
|
|
283
|
+
const configPath = deps.join(assetsDir, 'dcloud_uniplugins.json');
|
|
284
|
+
const readResult = readOrCreateUniPluginsConfig(assetsDir, deps);
|
|
285
|
+
if (!readResult.success) {
|
|
286
|
+
return readResult;
|
|
287
|
+
}
|
|
288
|
+
const config = readResult.config;
|
|
289
|
+
let found = false;
|
|
290
|
+
for (const nativePlugin of config.nativePlugins) {
|
|
291
|
+
if (nativePlugin.plugins && Array.isArray(nativePlugin.plugins)) {
|
|
292
|
+
const existingIndex = nativePlugin.plugins.findIndex((p) => p.name === pluginItem.name);
|
|
293
|
+
if (existingIndex !== -1) {
|
|
294
|
+
nativePlugin.plugins[existingIndex] = pluginItem;
|
|
295
|
+
found = true;
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (!found) {
|
|
301
|
+
let targetNativePlugin = config.nativePlugins.find((np) => np.plugins && Array.isArray(np.plugins));
|
|
302
|
+
if (!targetNativePlugin) {
|
|
303
|
+
targetNativePlugin = {
|
|
304
|
+
plugins: []
|
|
305
|
+
};
|
|
306
|
+
config.nativePlugins.push(targetNativePlugin);
|
|
307
|
+
}
|
|
308
|
+
targetNativePlugin.plugins.push(pluginItem);
|
|
309
|
+
}
|
|
310
|
+
const configContent = JSON.stringify(config, null, 2);
|
|
311
|
+
deps.writeFileSync(configPath, configContent, 'utf8');
|
|
312
|
+
return {
|
|
313
|
+
success: true,
|
|
314
|
+
message: found ? `已更新插件配置: ${pluginItem.name}` : `已添加插件配置: ${pluginItem.name}`
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
return {
|
|
319
|
+
success: false,
|
|
320
|
+
error: `更新 dcloud_uniplugins.json 失败: ${error instanceof Error ? error.message : String(error)}`
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
export async function integrateUniAppNativePlugin(projectPath, moduleDir, packageName, pluginPath, deps) {
|
|
325
|
+
const logs = [];
|
|
326
|
+
try {
|
|
327
|
+
logs.push(`开始集成 UniApp 原生插件: ${pluginPath}`);
|
|
328
|
+
logs.push('步骤 1: 解压插件');
|
|
329
|
+
const tempDir = deps.join(projectPath, '.temp');
|
|
330
|
+
if (!deps.existsSync(tempDir)) {
|
|
331
|
+
deps.mkdirSync(tempDir, { recursive: true });
|
|
332
|
+
}
|
|
333
|
+
const extractResult = await extractPlugin(pluginPath, tempDir, {
|
|
334
|
+
existsSync: deps.existsSync,
|
|
335
|
+
readdirSync: deps.readdirSync,
|
|
336
|
+
statSync: deps.statSync,
|
|
337
|
+
join: deps.join,
|
|
338
|
+
exec: deps.exec,
|
|
339
|
+
basename: deps.basename,
|
|
340
|
+
dirname: deps.dirname,
|
|
341
|
+
mkdirSync: deps.mkdirSync
|
|
342
|
+
});
|
|
343
|
+
if (!extractResult.success) {
|
|
344
|
+
return {
|
|
345
|
+
success: false,
|
|
346
|
+
error: extractResult.error,
|
|
347
|
+
logs
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
const pluginDir = extractResult.extractedPath;
|
|
351
|
+
logs.push(`插件已解压到: ${pluginDir}`);
|
|
352
|
+
logs.push('步骤 2: 读取插件配置');
|
|
353
|
+
const packageJsonResult = readPluginPackageJson(pluginDir, {
|
|
354
|
+
existsSync: deps.existsSync,
|
|
355
|
+
readFileSync: deps.readFileSync,
|
|
356
|
+
join: deps.join,
|
|
357
|
+
parse: deps.parse
|
|
358
|
+
});
|
|
359
|
+
if (!packageJsonResult.success) {
|
|
360
|
+
return {
|
|
361
|
+
success: false,
|
|
362
|
+
error: packageJsonResult.error,
|
|
363
|
+
logs
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
const packageJson = packageJsonResult.packageJson;
|
|
367
|
+
const pluginName = packageJson.name || 'UniApp Native Plugin';
|
|
368
|
+
logs.push(`插件名称: ${pluginName}`);
|
|
369
|
+
logs.push('步骤 3: 提取插件配置');
|
|
370
|
+
const pluginConfigResult = extractPluginConfig(packageJson);
|
|
371
|
+
let pluginItem = null;
|
|
372
|
+
if (!pluginConfigResult.success) {
|
|
373
|
+
logs.push(`警告: ${pluginConfigResult.error}`);
|
|
374
|
+
logs.push('将继续处理库文件,但 dcloud_uniplugins.json 可能无法正确配置');
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
pluginItem = pluginConfigResult.pluginItem;
|
|
378
|
+
logs.push(`插件配置: ${pluginItem.name} (${pluginItem.class})`);
|
|
379
|
+
}
|
|
380
|
+
logs.push('步骤 4: 查找 Android 库文件');
|
|
381
|
+
const androidLibFiles = findAndroidLibFiles(pluginDir, {
|
|
382
|
+
existsSync: deps.existsSync,
|
|
383
|
+
readdirSync: deps.readdirSync,
|
|
384
|
+
statSync: deps.statSync,
|
|
385
|
+
join: deps.join
|
|
386
|
+
});
|
|
387
|
+
if (androidLibFiles.length === 0) {
|
|
388
|
+
logs.push('警告: 未找到 android 目录下的 aar/jar 文件');
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
logs.push(`找到 ${androidLibFiles.length} 个库文件: ${androidLibFiles.map(f => deps.basename(f)).join(', ')}`);
|
|
392
|
+
}
|
|
393
|
+
if (androidLibFiles.length > 0) {
|
|
394
|
+
logs.push('步骤 5: 拷贝库文件到 libs 目录');
|
|
395
|
+
const libFiles = androidLibFiles.map(filePath => ({
|
|
396
|
+
source: filePath,
|
|
397
|
+
targetName: deps.basename(filePath)
|
|
398
|
+
}));
|
|
399
|
+
const moduleConfig = {
|
|
400
|
+
name: pluginName,
|
|
401
|
+
libFiles: libFiles
|
|
402
|
+
};
|
|
403
|
+
const thirdPartyResult = await integrateThirdPartyModule(projectPath, moduleDir, packageName, moduleConfig, deps);
|
|
404
|
+
logs.push(...thirdPartyResult.logs);
|
|
405
|
+
if (!thirdPartyResult.success) {
|
|
406
|
+
return {
|
|
407
|
+
success: false,
|
|
408
|
+
error: thirdPartyResult.error,
|
|
409
|
+
logs
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
logs.push('步骤 5: 跳过(未找到库文件)');
|
|
415
|
+
}
|
|
416
|
+
logs.push('步骤 6: 拷贝 android 目录下的其他文件');
|
|
417
|
+
const androidDir = deps.join(pluginDir, 'android');
|
|
418
|
+
if (deps.existsSync(androidDir)) {
|
|
419
|
+
const copiedFiles = copyAndroidFilesRecursive(androidDir, projectPath, moduleDir, packageName, androidLibFiles, deps);
|
|
420
|
+
logs.push(...copiedFiles.logs);
|
|
421
|
+
if (copiedFiles.count > 0) {
|
|
422
|
+
logs.push(`已拷贝 ${copiedFiles.count} 个其他文件`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
logs.push('android 目录不存在,跳过其他文件拷贝');
|
|
427
|
+
}
|
|
428
|
+
if (pluginItem) {
|
|
429
|
+
logs.push('步骤 7: 更新 dcloud_uniplugins.json 配置');
|
|
430
|
+
const assetsDir = deps.join(projectPath, moduleDir, 'src', 'main', 'assets');
|
|
431
|
+
const updateResult = updateUniPluginsConfig(assetsDir, pluginItem, {
|
|
432
|
+
existsSync: deps.existsSync,
|
|
433
|
+
readFileSync: deps.readFileSync,
|
|
434
|
+
writeFileSync: deps.writeFileSync,
|
|
435
|
+
mkdirSync: deps.mkdirSync,
|
|
436
|
+
join: deps.join,
|
|
437
|
+
parse: deps.parse
|
|
438
|
+
});
|
|
439
|
+
if (updateResult.success) {
|
|
440
|
+
logs.push(updateResult.message || 'dcloud_uniplugins.json 配置完成');
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
logs.push(`警告: dcloud_uniplugins.json 配置失败: ${updateResult.error}`);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
logs.push('步骤 7: 跳过 dcloud_uniplugins.json 配置(插件配置提取失败)');
|
|
448
|
+
}
|
|
449
|
+
logs.push(`UniApp 原生插件集成完成: ${pluginName}`);
|
|
450
|
+
return {
|
|
451
|
+
success: true,
|
|
452
|
+
message: `成功集成 UniApp 原生插件: ${pluginName}`,
|
|
453
|
+
logs
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
return {
|
|
458
|
+
success: false,
|
|
459
|
+
error: `集成 UniApp 原生插件失败: ${error instanceof Error ? error.message : String(error)}`,
|
|
460
|
+
logs
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
//# sourceMappingURL=integrateUniAppNativePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrateUniAppNativePlugin.js","sourceRoot":"","sources":["../../../src/functions/android/integrateUniAppNativePlugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,yBAAyB,EAAmE,MAAM,6BAA6B,CAAA;AAmCxI,KAAK,UAAU,aAAa,CAC1B,UAAkB,EAClB,UAAkB,EAClB,IAA+I;IAE/I,IAAI,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,YAAY,UAAU,EAAE;aAChC,CAAA;QACH,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QAGtC,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvB,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,UAAU;aAC1B,CAAA;QACH,CAAC;QAGD,IAAI,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YAClB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;YAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,CAAA;YAEpD,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;gBAClB,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,aAAa,GAAG,aAAa;iBACrC,CAAA;YACH,CAAC;YAGD,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CA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AAE,IAAI,CAAC,YAAY;gBAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAA;YAEF,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;gBACzB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,6BAA6B,CAAC,CAAA;YAClE,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,oCAAoC,YAAY,CAAC,KAAK,EAAE,CAAC,CAAA;YAErE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAA;QAC3D,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,oBAAoB,UAAU,EAAE,CAAC,CAAA;QAC3C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,qBAAqB,UAAU,EAAE;YAC1C,IAAI;SACL,CAAA;IAEH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,qBAAqB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;YACpF,IAAI;SACL,CAAA;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type IntegrateThirdPartyModuleDeps } from './integrateThirdPartyModule';
|
|
2
|
+
export interface WechatShareConfig {
|
|
3
|
+
appId: string;
|
|
4
|
+
secret: string;
|
|
5
|
+
shareAarPath: string;
|
|
6
|
+
wxEntryActivityPath: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function integrateWechatShare(projectPath: string, moduleDir: string, packageName: string, config: WechatShareConfig, deps: IntegrateThirdPartyModuleDeps): Promise<{
|
|
9
|
+
success: boolean;
|
|
10
|
+
message?: string;
|
|
11
|
+
error?: string;
|
|
12
|
+
logs: string[];
|
|
13
|
+
}>;
|