codeplay-common 4.11.34 → 4.11.37

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +115 -115
  2. package/LICENSE +21 -21
  3. package/README.md +6 -0
  4. package/RELEASE_NOTES.md +110 -110
  5. package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -9
  6. package/files/buildCodeplay/add-splash-screen.js +256 -256
  7. package/files/buildCodeplay/apk-store-builder.js +97 -97
  8. package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
  9. package/files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs +31 -31
  10. package/files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs +28 -28
  11. package/files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle +9 -9
  12. package/files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs +30 -30
  13. package/files/buildCodeplay/huawei-privacy.cjs +102 -92
  14. package/files/buildCodeplay/iap-alias.cjs +116 -108
  15. package/files/buildCodeplay/ios-emi-admob-modification.js +24 -24
  16. package/files/buildCodeplay/manifestModification.js +38 -38
  17. package/files/buildCodeplay/migrate-system-bars.cjs +122 -122
  18. package/files/buildCodeplay/packageidBaseModification.js +528 -528
  19. package/files/buildCodeplay/project-scripts.cjs +69 -69
  20. package/files/buildCodeplay/ruads.cjs +10 -1
  21. package/files/buildCodeplay/setSplashAnimation.js +228 -228
  22. package/files/buildCodeplay/setup-ruads.cjs +9 -2
  23. package/files/buildCodeplay/splash-setup.cjs +88 -88
  24. package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +11 -11
  25. package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
  26. package/files/buildCodeplay/tests/huawei-live-reload.test.cjs +60 -0
  27. package/files/buildCodeplay/tests/huawei-multiple-entries.test.cjs +80 -0
  28. package/files/buildCodeplay/tests/huawei-vite.test.cjs +38 -35
  29. package/files/buildCodeplay/versions.json +28 -28
  30. package/files/finalrelease +1365 -1365
  31. package/files/generate-ai-promo-video.js +23 -23
  32. package/files/ionic.config.json +6 -6
  33. package/files/scripts-common/run-codeplay-sync-after.js +21 -21
  34. package/files/scripts-common/screenshot/background-decorations.js +120 -120
  35. package/files/scripts-common/screenshot/frame-samples.js +117 -117
  36. package/files/scripts-common/setup-baseline-profile.js +291 -291
  37. package/files/take-screen-video.js +644 -644
  38. package/package.json +1 -1
  39. package/runtime/splash-ready.mjs +52 -52
  40. package/scripts/iap-alias.test.cjs +117 -78
  41. package/scripts/ruads-install.test.cjs +20 -3
  42. package/scripts/splash-setup.test.cjs +142 -142
  43. package/scripts/sync-files.js +119 -119
  44. package/scripts/system-bars-package.test.cjs +37 -37
  45. package/scripts/system-bars.test.cjs +93 -93
  46. package/scripts/uninstall.js +2 -2
  47. package/scripts/vite-build-settings.test.cjs +1 -0
@@ -1,122 +1,122 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { createRequire } = require('module');
4
- const { execSync } = require('child_process');
5
-
6
- // Keep legacy color support below Android 15; modern Android uses the existing
7
- // inset-sized protection views and WindowInsetsController icon appearance.
8
- function migrateSystemBars(projectRoot = process.cwd()) {
9
- const pluginPath = path.join(projectRoot, 'node_modules/capacitor-codeplay-system-bars/android/src/main/java/com/codeplay/systembars/CodeplaySystemBarsPlugin.java');
10
- if (!fs.existsSync(pluginPath)) return false;
11
- const original = fs.readFileSync(pluginPath, 'utf8');
12
- const newline = original.includes('\r\n') ? '\r\n' : '\n';
13
- const marker = '// Codeplay: navigation bar colors are supplied by protection views on Android 15+.';
14
- if (original.includes(marker)) return false;
15
-
16
- const oldLine = ' window.setNavigationBarColor(Color.TRANSPARENT);';
17
- if (original.split(oldLine).length !== 2 || !original.includes('window.getDecorView().post(this::updateNavigationBarProtection);')) {
18
- throw new Error('System-bars plugin structure changed; review the Android 15 migration before building.');
19
- }
20
-
21
- const replacement = [
22
- ` ${marker}`,
23
- ' if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {',
24
- ' window.setNavigationBarColor(Color.TRANSPARENT);',
25
- ' }'
26
- ].join(newline);
27
- fs.writeFileSync(pluginPath, original.replace(oldLine, replacement), 'utf8');
28
- return true;
29
- }
30
-
31
- function sourceFiles(directory, extensions, files = []) {
32
- if (!fs.existsSync(directory)) return files;
33
- for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
34
- if (entry.isSymbolicLink() || ['node_modules', '.git', 'agent-temp', 'test-results', 'www', 'public', 'Pods', 'build', 'dist'].includes(entry.name)) continue;
35
- const file = path.join(directory, entry.name);
36
- if (entry.isDirectory()) sourceFiles(file, extensions, files);
37
- else if (extensions.test(entry.name)) files.push(file);
38
- }
39
- return files;
40
- }
41
-
42
- async function auditLegacyStatusBar(projectRoot = process.cwd()) {
43
- const pkg = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
44
- const dependency = '@capacitor/status-bar';
45
- if (!pkg.dependencies?.[dependency] && !pkg.devDependencies?.[dependency] && !fs.existsSync(path.join(projectRoot, 'node_modules', dependency))) {
46
- return { status: 'absent', references: [] };
47
- }
48
- let minify;
49
- try {
50
- // Copied app helpers must also support npm nesting Terser inside this package.
51
- const packagePath = require.resolve('codeplay-common/package.json', { paths: [projectRoot] });
52
- ({ minify } = createRequire(packagePath)('terser'));
53
- } catch {
54
- try {
55
- // Source checkout and package-local execution resolve the declared dependency here.
56
- ({ minify } = require('terser'));
57
- } catch {
58
- return { status: 'retained', references: ['JavaScript parser unavailable; cannot prove the plugin is unused.'] };
59
- }
60
- }
61
- const files = sourceFiles(path.join(projectRoot, 'src'), /\.(?:js|cjs|mjs|ts|tsx|jsx|f7|vue|html)$/);
62
- for (const entry of fs.readdirSync(projectRoot, { withFileTypes: true })) {
63
- if (entry.isFile() && /\.(?:js|mjs|cjs|ts|tsx|jsx)$/.test(entry.name)) files.push(path.join(projectRoot, entry.name));
64
- }
65
- const references = [];
66
- let modern = false;
67
- for (const file of files) {
68
- let code = fs.readFileSync(file, 'utf8');
69
- if (!/StatusBar|@capacitor\/status-bar|\bSystemBars\b/.test(code)) continue;
70
- try {
71
- if (/\.(?:f7|vue|html)$/.test(file)) {
72
- code = Array.from(code.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi), match => match[1]).join('\n');
73
- }
74
- code = (await minify(code, { compress: false, mangle: false, module: true, format: { comments: false } })).code;
75
- if (/\bSystemBars\b/.test(code) && /from["']@capacitor\/core["']/.test(code)) modern = true;
76
- // This is the modern Capacitor enum, not the legacy StatusBar plugin.
77
- code = code.replace(/\bSystemBarType\.StatusBar\b/g, '');
78
- if (/\bStatusBar\b|@capacitor\/status-bar/.test(code)) references.push(path.relative(projectRoot, file));
79
- } catch {
80
- references.push(`${path.relative(projectRoot, file)} (parse review required)`);
81
- }
82
- }
83
- const native = [
84
- ...sourceFiles(path.join(projectRoot, 'android/app/src/main/java'), /\.(?:java|kt)$/),
85
- ...sourceFiles(path.join(projectRoot, 'ios/App/App'), /\.(?:swift|m|mm)$/)
86
- ];
87
- for (const file of native) {
88
- if (/StatusBarPlugin|com\.capacitorjs\.plugins\.statusbar|CapacitorStatusBar/.test(fs.readFileSync(file, 'utf8'))) references.push(path.relative(projectRoot, file));
89
- }
90
- if (!modern) references.push('Modern Capacitor SystemBars usage not confirmed.');
91
- return { status: references.length ? 'retained' : 'unused', references };
92
- }
93
-
94
- async function migrateLegacyStatusBar(projectRoot = process.cwd(), options = {}) {
95
- const result = await auditLegacyStatusBar(projectRoot);
96
- if (result.status !== 'unused') return result;
97
- const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'pipe' }));
98
- // Suppress lifecycle hooks: removing this plugin must not reinstall shared
99
- // templates, run a build, or change app-owned configuration.
100
- runNpm('npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund');
101
- if (fs.existsSync(path.join(projectRoot, 'android/capacitor.settings.gradle'))) {
102
- runNpm('npx --no-install cap update android');
103
- }
104
- const podfile = path.join(projectRoot, 'ios/App/Podfile');
105
- if (fs.existsSync(podfile)) {
106
- const original = fs.readFileSync(podfile, 'utf8');
107
- const updated = original.replace(/^[ \t]*pod ['"]CapacitorStatusBar['"], :path => ['"]\.\.\/\.\.\/node_modules\/@capacitor\/status-bar['"][ \t]*\r?\n/gm, '');
108
- if (updated !== original) fs.writeFileSync(podfile, updated, 'utf8');
109
- }
110
- return { status: 'removed', references: [] };
111
- }
112
-
113
- module.exports = { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar };
114
- if (require.main === module) {
115
- migrateSystemBars();
116
- if (process.argv.includes('--remove-unused')) {
117
- migrateLegacyStatusBar().then(result => console.log(JSON.stringify(result))).catch(error => {
118
- console.error(error.message);
119
- process.exitCode = 1;
120
- });
121
- }
122
- }
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { createRequire } = require('module');
4
+ const { execSync } = require('child_process');
5
+
6
+ // Keep legacy color support below Android 15; modern Android uses the existing
7
+ // inset-sized protection views and WindowInsetsController icon appearance.
8
+ function migrateSystemBars(projectRoot = process.cwd()) {
9
+ const pluginPath = path.join(projectRoot, 'node_modules/capacitor-codeplay-system-bars/android/src/main/java/com/codeplay/systembars/CodeplaySystemBarsPlugin.java');
10
+ if (!fs.existsSync(pluginPath)) return false;
11
+ const original = fs.readFileSync(pluginPath, 'utf8');
12
+ const newline = original.includes('\r\n') ? '\r\n' : '\n';
13
+ const marker = '// Codeplay: navigation bar colors are supplied by protection views on Android 15+.';
14
+ if (original.includes(marker)) return false;
15
+
16
+ const oldLine = ' window.setNavigationBarColor(Color.TRANSPARENT);';
17
+ if (original.split(oldLine).length !== 2 || !original.includes('window.getDecorView().post(this::updateNavigationBarProtection);')) {
18
+ throw new Error('System-bars plugin structure changed; review the Android 15 migration before building.');
19
+ }
20
+
21
+ const replacement = [
22
+ ` ${marker}`,
23
+ ' if (Build.VERSION.SDK_INT < Build.VERSION_CODES.VANILLA_ICE_CREAM) {',
24
+ ' window.setNavigationBarColor(Color.TRANSPARENT);',
25
+ ' }'
26
+ ].join(newline);
27
+ fs.writeFileSync(pluginPath, original.replace(oldLine, replacement), 'utf8');
28
+ return true;
29
+ }
30
+
31
+ function sourceFiles(directory, extensions, files = []) {
32
+ if (!fs.existsSync(directory)) return files;
33
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
34
+ if (entry.isSymbolicLink() || ['node_modules', '.git', 'agent-temp', 'test-results', 'www', 'public', 'Pods', 'build', 'dist'].includes(entry.name)) continue;
35
+ const file = path.join(directory, entry.name);
36
+ if (entry.isDirectory()) sourceFiles(file, extensions, files);
37
+ else if (extensions.test(entry.name)) files.push(file);
38
+ }
39
+ return files;
40
+ }
41
+
42
+ async function auditLegacyStatusBar(projectRoot = process.cwd()) {
43
+ const pkg = JSON.parse(fs.readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
44
+ const dependency = '@capacitor/status-bar';
45
+ if (!pkg.dependencies?.[dependency] && !pkg.devDependencies?.[dependency] && !fs.existsSync(path.join(projectRoot, 'node_modules', dependency))) {
46
+ return { status: 'absent', references: [] };
47
+ }
48
+ let minify;
49
+ try {
50
+ // Copied app helpers must also support npm nesting Terser inside this package.
51
+ const packagePath = require.resolve('codeplay-common/package.json', { paths: [projectRoot] });
52
+ ({ minify } = createRequire(packagePath)('terser'));
53
+ } catch {
54
+ try {
55
+ // Source checkout and package-local execution resolve the declared dependency here.
56
+ ({ minify } = require('terser'));
57
+ } catch {
58
+ return { status: 'retained', references: ['JavaScript parser unavailable; cannot prove the plugin is unused.'] };
59
+ }
60
+ }
61
+ const files = sourceFiles(path.join(projectRoot, 'src'), /\.(?:js|cjs|mjs|ts|tsx|jsx|f7|vue|html)$/);
62
+ for (const entry of fs.readdirSync(projectRoot, { withFileTypes: true })) {
63
+ if (entry.isFile() && /\.(?:js|mjs|cjs|ts|tsx|jsx)$/.test(entry.name)) files.push(path.join(projectRoot, entry.name));
64
+ }
65
+ const references = [];
66
+ let modern = false;
67
+ for (const file of files) {
68
+ let code = fs.readFileSync(file, 'utf8');
69
+ if (!/StatusBar|@capacitor\/status-bar|\bSystemBars\b/.test(code)) continue;
70
+ try {
71
+ if (/\.(?:f7|vue|html)$/.test(file)) {
72
+ code = Array.from(code.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi), match => match[1]).join('\n');
73
+ }
74
+ code = (await minify(code, { compress: false, mangle: false, module: true, format: { comments: false } })).code;
75
+ if (/\bSystemBars\b/.test(code) && /from["']@capacitor\/core["']/.test(code)) modern = true;
76
+ // This is the modern Capacitor enum, not the legacy StatusBar plugin.
77
+ code = code.replace(/\bSystemBarType\.StatusBar\b/g, '');
78
+ if (/\bStatusBar\b|@capacitor\/status-bar/.test(code)) references.push(path.relative(projectRoot, file));
79
+ } catch {
80
+ references.push(`${path.relative(projectRoot, file)} (parse review required)`);
81
+ }
82
+ }
83
+ const native = [
84
+ ...sourceFiles(path.join(projectRoot, 'android/app/src/main/java'), /\.(?:java|kt)$/),
85
+ ...sourceFiles(path.join(projectRoot, 'ios/App/App'), /\.(?:swift|m|mm)$/)
86
+ ];
87
+ for (const file of native) {
88
+ if (/StatusBarPlugin|com\.capacitorjs\.plugins\.statusbar|CapacitorStatusBar/.test(fs.readFileSync(file, 'utf8'))) references.push(path.relative(projectRoot, file));
89
+ }
90
+ if (!modern) references.push('Modern Capacitor SystemBars usage not confirmed.');
91
+ return { status: references.length ? 'retained' : 'unused', references };
92
+ }
93
+
94
+ async function migrateLegacyStatusBar(projectRoot = process.cwd(), options = {}) {
95
+ const result = await auditLegacyStatusBar(projectRoot);
96
+ if (result.status !== 'unused') return result;
97
+ const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'pipe' }));
98
+ // Suppress lifecycle hooks: removing this plugin must not reinstall shared
99
+ // templates, run a build, or change app-owned configuration.
100
+ runNpm('npm uninstall @capacitor/status-bar --ignore-scripts --no-audit --no-fund');
101
+ if (fs.existsSync(path.join(projectRoot, 'android/capacitor.settings.gradle'))) {
102
+ runNpm('npx --no-install cap update android');
103
+ }
104
+ const podfile = path.join(projectRoot, 'ios/App/Podfile');
105
+ if (fs.existsSync(podfile)) {
106
+ const original = fs.readFileSync(podfile, 'utf8');
107
+ const updated = original.replace(/^[ \t]*pod ['"]CapacitorStatusBar['"], :path => ['"]\.\.\/\.\.\/node_modules\/@capacitor\/status-bar['"][ \t]*\r?\n/gm, '');
108
+ if (updated !== original) fs.writeFileSync(podfile, updated, 'utf8');
109
+ }
110
+ return { status: 'removed', references: [] };
111
+ }
112
+
113
+ module.exports = { migrateSystemBars, auditLegacyStatusBar, migrateLegacyStatusBar };
114
+ if (require.main === module) {
115
+ migrateSystemBars();
116
+ if (process.argv.includes('--remove-unused')) {
117
+ migrateLegacyStatusBar().then(result => console.log(JSON.stringify(result))).catch(error => {
118
+ console.error(error.message);
119
+ process.exitCode = 1;
120
+ });
121
+ }
122
+ }