codeplay-common 4.11.30 → 4.11.32

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 (58) hide show
  1. package/CHANGELOG.md +115 -115
  2. package/LICENSE +21 -21
  3. package/README.md +368 -368
  4. package/RELEASE_NOTES.md +97 -97
  5. package/files/buildCodeplay/HUAWEI-PRIVACY.md +9 -9
  6. package/files/buildCodeplay/add-splash-screen.js +255 -255
  7. package/files/buildCodeplay/apk-store-builder.js +97 -97
  8. package/files/buildCodeplay/codeplayBeforeBuild.js +4769 -4756
  9. package/files/buildCodeplay/disabled-ads.mjs +45 -45
  10. package/files/buildCodeplay/ensure-current-build.cjs +42 -42
  11. package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
  12. package/files/buildCodeplay/huawei-privacy-entry.js +135 -135
  13. package/files/buildCodeplay/huawei-privacy.cjs +92 -92
  14. package/files/buildCodeplay/huawei-privacy.css +22 -22
  15. package/files/buildCodeplay/iap-alias.cjs +108 -116
  16. package/files/buildCodeplay/ios-ad-consent.cjs +56 -56
  17. package/files/buildCodeplay/ios-emi-admob-modification.js +49 -49
  18. package/files/buildCodeplay/manifestModification.js +38 -38
  19. package/files/buildCodeplay/migrate-system-bars.cjs +122 -115
  20. package/files/buildCodeplay/newly added.txt +89 -89
  21. package/files/buildCodeplay/non-google-billing.pro +3 -3
  22. package/files/buildCodeplay/packageidBaseModification.js +528 -528
  23. package/files/buildCodeplay/project-scripts.cjs +69 -69
  24. package/files/buildCodeplay/release-sync.config.json +4 -4
  25. package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
  26. package/files/buildCodeplay/ruads.cjs +211 -211
  27. package/files/buildCodeplay/saf-mediastore-dependency.cjs +21 -21
  28. package/files/buildCodeplay/setSplashAnimation.js +226 -226
  29. package/files/buildCodeplay/setup-ruads.cjs +55 -55
  30. package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +11 -11
  31. package/files/buildCodeplay/store-billing.cjs +43 -43
  32. package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
  33. package/files/buildCodeplay/tests/huawei-privacy.test.cjs +49 -49
  34. package/files/buildCodeplay/tests/huawei-vite.test.cjs +35 -35
  35. package/files/buildCodeplay/versions.json +28 -28
  36. package/files/finalrelease +1365 -1365
  37. package/files/generate-ai-promo-video.js +23 -23
  38. package/files/ionic.config.json +6 -6
  39. package/files/scripts-common/generate-baseline-profile.js +46 -46
  40. package/files/scripts-common/run-codeplay-sync-after.js +21 -21
  41. package/files/scripts-common/screenshot/background-decorations.js +120 -120
  42. package/files/scripts-common/screenshot/frame-samples.js +117 -117
  43. package/files/scripts-common/setup-baseline-profile.js +291 -291
  44. package/files/take-screen-image.js +4414 -4414
  45. package/files/take-screen-video.js +644 -644
  46. package/package.json +3 -2
  47. package/runtime/vk-ads/vk-ad-configuration.json +39 -39
  48. package/scripts/ensure-current-build.test.cjs +76 -76
  49. package/scripts/iap-alias.test.cjs +78 -117
  50. package/scripts/ios-ad-consent.test.cjs +99 -99
  51. package/scripts/ruads-install.test.cjs +180 -180
  52. package/scripts/ruads-policy.test.cjs +174 -174
  53. package/scripts/saf-mediastore-dependency.test.cjs +44 -44
  54. package/scripts/sync-files.js +120 -120
  55. package/scripts/system-bars-package.test.cjs +38 -0
  56. package/scripts/system-bars.test.cjs +93 -77
  57. package/scripts/uninstall.js +2 -2
  58. package/scripts/vite-build-settings.test.cjs +92 -92
@@ -1,92 +1,92 @@
1
- const { test } = require('node:test');
2
- const assert = require('node:assert/strict');
3
- const fs = require('node:fs');
4
- const path = require('node:path');
5
- const vm = require('node:vm');
6
- const { pathToFileURL } = require('node:url');
7
- const { install } = require('./sync-files.js');
8
-
9
- function fixture(configuration) {
10
- const base = path.resolve(process.env.CODEPLAY_TEST_ROOT || path.join(__dirname, '../agent-temp'));
11
- fs.mkdirSync(base, { recursive: true });
12
- const root = fs.mkdtempSync(path.join(base, 'vite-settings-'));
13
- fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'vite-fixture', scripts: {}, dependencies: {} }));
14
- fs.writeFileSync(path.join(root, 'capacitor.config.json'), JSON.stringify({ appId: 'fixture.app', plugins: {
15
- AdMob: { ADMOB_ENABLED: true }, RuAds: { VK_ADS_ENABLED: true, STORE_IDS: [4, 10] },
16
- } }));
17
- fs.mkdirSync(path.join(root, 'src/js/Ads/vk-ads-1.3'), { recursive: true });
18
- fs.writeFileSync(path.join(root, 'src/js/Ads/vk-ads-1.3/vk-ads.js'), '// manually installed VK controller');
19
- fs.writeFileSync(path.join(root, 'vite.config.mjs'), configuration);
20
- install({ projectRoot: root, copyAssets: false });
21
- // Run the real before-build migration after the real installer. Loading the
22
- // full before-build CLI would also install SDKs and change native platforms.
23
- const source = fs.readFileSync(path.join(root, 'buildCodeplay/codeplayBeforeBuild.js'), 'utf8');
24
- const migration = source.slice(source.indexOf('const migrateViteTreeShaking ='), source.indexOf('// BEGIN IAP BUILD MIGRATION'));
25
- const migrate = vm.runInNewContext(migration + '\nmigrateViteTreeShaking;');
26
- return { root, file: path.join(root, 'vite.config.mjs'), migrate };
27
- }
28
-
29
- const alias = "resolve: { alias: { '@admob': '/original-admob.js' } }";
30
- const build = { outDir: '../www', minify: 'terser', sourcemap: true, emptyOutDir: false,
31
- target: 'es2022', rollupOptions: { external: ['preserved-module'], output: { entryFileNames: 'custom-[name].js' } } };
32
-
33
- test('installer and before-build preserve build settings for object/function/defineConfig exports and all ad providers', async () => {
34
- const previous = { cwd: process.cwd(), store: process.env.VITE_STORE_ID, platform: process.env.CODEPLAY_BUILD_PLATFORM };
35
- try {
36
- delete process.env.CODEPLAY_BUILD_PLATFORM;
37
- const config = `{ build: ${JSON.stringify(build)}, ${alias}, define: { custom: 'true' } }`;
38
- for (const source of [`export default ${config};`, `export default async () => (${config});`, `const defineConfig = c => c;\nexport default defineConfig(${config});`]) {
39
- const f = fixture(source);
40
- const updated = f.migrate(fs.readFileSync(f.file, 'utf8'));
41
- assert.equal(f.migrate(updated), updated);
42
- fs.writeFileSync(f.file, updated);
43
- process.chdir(f.root);
44
- const { default: configure } = await import(pathToFileURL(f.file).href);
45
- for (const store of ['1', '4', '10']) {
46
- process.env.VITE_STORE_ID = store;
47
- const resolved = await configure({ mode: 'production' });
48
- assert.deepEqual(resolved.build, { ...build, rollupOptions: { ...build.rollupOptions, treeshake: true } });
49
- assert.equal(resolved.define.custom, 'true');
50
- assert.equal(resolved.define['import.meta.env.VITE_STORE_ID'], JSON.stringify(store));
51
- assert.equal(resolved.resolve.alias['@admob'], store === '1' ? '/original-admob.js' : path.join(f.root, 'src/js/Ads/vk-ads-1.3/vk-ads.js'));
52
- }
53
- }
54
- } finally {
55
- process.chdir(previous.cwd);
56
- for (const [key, value] of [['VITE_STORE_ID', previous.store], ['CODEPLAY_BUILD_PLATFORM', previous.platform]]) {
57
- if (value === undefined) delete process.env[key]; else process.env[key] = value;
58
- }
59
- }
60
- });
61
-
62
- test('migration preserves custom treeshake options and repairs only the previous generated override', async () => {
63
- const custom = { ...build, rollupOptions: { ...build.rollupOptions, treeshake: { moduleSideEffects: false } } };
64
- const f = fixture(`export default { build: ${JSON.stringify(custom)}, ${alias} };`);
65
- let source = fs.readFileSync(f.file, 'utf8');
66
- source = source.replace('return { ...base,', 'return { ...base, build: { rollupOptions: { treeshake: true } },');
67
- const updated = f.migrate(source);
68
- assert.ok(!updated.includes('...base, build:'));
69
- assert.equal(f.migrate(updated), updated);
70
- fs.writeFileSync(f.file, updated);
71
- const previous = process.cwd();
72
- try {
73
- process.chdir(f.root);
74
- const { default: configure } = await import(pathToFileURL(f.file).href);
75
- assert.deepEqual((await configure({})).build, custom);
76
- } finally { process.chdir(previous); }
77
- const customized = source.replace('build: { rollupOptions: { treeshake: true } },', "build: { outDir: '/custom-wrapper', rollupOptions: { treeshake: true } },");
78
- assert.ok(f.migrate(customized).includes("outDir: '/custom-wrapper'"));
79
- });
80
-
81
- test('missing build/rollup settings are added to the original config; unwrapped configs still migrate', () => {
82
- const f = fixture(`export default { ${alias} };`);
83
- const updated = f.migrate(fs.readFileSync(f.file, 'utf8'));
84
- assert.match(updated, /codeplayOriginalViteConfig\s*=\s*\{[\s\S]*build:/);
85
- assert.ok(!updated.includes('...base, build:'));
86
- assert.equal(f.migrate(updated), updated);
87
- const plain = `export default { build: { outDir: '../www', rollupOptions: { treeshake: false, external: ['keep'] } } };`;
88
- const result = f.migrate(plain);
89
- assert.ok(result.includes("outDir: '../www'"));
90
- assert.ok(result.includes("external: ['keep']"));
91
- assert.ok(result.includes('treeshake: true'));
92
- });
1
+ const { test } = require('node:test');
2
+ const assert = require('node:assert/strict');
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+ const vm = require('node:vm');
6
+ const { pathToFileURL } = require('node:url');
7
+ const { install } = require('./sync-files.js');
8
+
9
+ function fixture(configuration) {
10
+ const base = path.resolve(process.env.CODEPLAY_TEST_ROOT || path.join(__dirname, '../agent-temp'));
11
+ fs.mkdirSync(base, { recursive: true });
12
+ const root = fs.mkdtempSync(path.join(base, 'vite-settings-'));
13
+ fs.writeFileSync(path.join(root, 'package.json'), JSON.stringify({ name: 'vite-fixture', scripts: {}, dependencies: {} }));
14
+ fs.writeFileSync(path.join(root, 'capacitor.config.json'), JSON.stringify({ appId: 'fixture.app', plugins: {
15
+ AdMob: { ADMOB_ENABLED: true }, RuAds: { VK_ADS_ENABLED: true, STORE_IDS: [4, 10] },
16
+ } }));
17
+ fs.mkdirSync(path.join(root, 'src/js/Ads/vk-ads-1.3'), { recursive: true });
18
+ fs.writeFileSync(path.join(root, 'src/js/Ads/vk-ads-1.3/vk-ads.js'), '// manually installed VK controller');
19
+ fs.writeFileSync(path.join(root, 'vite.config.mjs'), configuration);
20
+ install({ projectRoot: root, copyAssets: false });
21
+ // Run the real before-build migration after the real installer. Loading the
22
+ // full before-build CLI would also install SDKs and change native platforms.
23
+ const source = fs.readFileSync(path.join(root, 'buildCodeplay/codeplayBeforeBuild.js'), 'utf8');
24
+ const migration = source.slice(source.indexOf('const migrateViteTreeShaking ='), source.indexOf('// BEGIN IAP BUILD MIGRATION'));
25
+ const migrate = vm.runInNewContext(migration + '\nmigrateViteTreeShaking;');
26
+ return { root, file: path.join(root, 'vite.config.mjs'), migrate };
27
+ }
28
+
29
+ const alias = "resolve: { alias: { '@admob': '/original-admob.js' } }";
30
+ const build = { outDir: '../www', minify: 'terser', sourcemap: true, emptyOutDir: false,
31
+ target: 'es2022', rollupOptions: { external: ['preserved-module'], output: { entryFileNames: 'custom-[name].js' } } };
32
+
33
+ test('installer and before-build preserve build settings for object/function/defineConfig exports and all ad providers', async () => {
34
+ const previous = { cwd: process.cwd(), store: process.env.VITE_STORE_ID, platform: process.env.CODEPLAY_BUILD_PLATFORM };
35
+ try {
36
+ delete process.env.CODEPLAY_BUILD_PLATFORM;
37
+ const config = `{ build: ${JSON.stringify(build)}, ${alias}, define: { custom: 'true' } }`;
38
+ for (const source of [`export default ${config};`, `export default async () => (${config});`, `const defineConfig = c => c;\nexport default defineConfig(${config});`]) {
39
+ const f = fixture(source);
40
+ const updated = f.migrate(fs.readFileSync(f.file, 'utf8'));
41
+ assert.equal(f.migrate(updated), updated);
42
+ fs.writeFileSync(f.file, updated);
43
+ process.chdir(f.root);
44
+ const { default: configure } = await import(pathToFileURL(f.file).href);
45
+ for (const store of ['1', '4', '10']) {
46
+ process.env.VITE_STORE_ID = store;
47
+ const resolved = await configure({ mode: 'production' });
48
+ assert.deepEqual(resolved.build, { ...build, rollupOptions: { ...build.rollupOptions, treeshake: true } });
49
+ assert.equal(resolved.define.custom, 'true');
50
+ assert.equal(resolved.define['import.meta.env.VITE_STORE_ID'], JSON.stringify(store));
51
+ assert.equal(resolved.resolve.alias['@admob'], store === '1' ? '/original-admob.js' : path.join(f.root, 'src/js/Ads/vk-ads-1.3/vk-ads.js'));
52
+ }
53
+ }
54
+ } finally {
55
+ process.chdir(previous.cwd);
56
+ for (const [key, value] of [['VITE_STORE_ID', previous.store], ['CODEPLAY_BUILD_PLATFORM', previous.platform]]) {
57
+ if (value === undefined) delete process.env[key]; else process.env[key] = value;
58
+ }
59
+ }
60
+ });
61
+
62
+ test('migration preserves custom treeshake options and repairs only the previous generated override', async () => {
63
+ const custom = { ...build, rollupOptions: { ...build.rollupOptions, treeshake: { moduleSideEffects: false } } };
64
+ const f = fixture(`export default { build: ${JSON.stringify(custom)}, ${alias} };`);
65
+ let source = fs.readFileSync(f.file, 'utf8');
66
+ source = source.replace('return { ...base,', 'return { ...base, build: { rollupOptions: { treeshake: true } },');
67
+ const updated = f.migrate(source);
68
+ assert.ok(!updated.includes('...base, build:'));
69
+ assert.equal(f.migrate(updated), updated);
70
+ fs.writeFileSync(f.file, updated);
71
+ const previous = process.cwd();
72
+ try {
73
+ process.chdir(f.root);
74
+ const { default: configure } = await import(pathToFileURL(f.file).href);
75
+ assert.deepEqual((await configure({})).build, custom);
76
+ } finally { process.chdir(previous); }
77
+ const customized = source.replace('build: { rollupOptions: { treeshake: true } },', "build: { outDir: '/custom-wrapper', rollupOptions: { treeshake: true } },");
78
+ assert.ok(f.migrate(customized).includes("outDir: '/custom-wrapper'"));
79
+ });
80
+
81
+ test('missing build/rollup settings are added to the original config; unwrapped configs still migrate', () => {
82
+ const f = fixture(`export default { ${alias} };`);
83
+ const updated = f.migrate(fs.readFileSync(f.file, 'utf8'));
84
+ assert.match(updated, /codeplayOriginalViteConfig\s*=\s*\{[\s\S]*build:/);
85
+ assert.ok(!updated.includes('...base, build:'));
86
+ assert.equal(f.migrate(updated), updated);
87
+ const plain = `export default { build: { outDir: '../www', rollupOptions: { treeshake: false, external: ['keep'] } } };`;
88
+ const result = f.migrate(plain);
89
+ assert.ok(result.includes("outDir: '../www'"));
90
+ assert.ok(result.includes("external: ['keep']"));
91
+ assert.ok(result.includes('treeshake: true'));
92
+ });