@react-native-oh/react-native-harmony-cli 0.84.2 → 0.84.4
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/README.md +2 -2
- package/dist/assetResolver.js +1 -1
- package/dist/autolinking/Autolinking.js +4 -2
- package/dist/autolinking/JSON5Writer.js +5 -1
- package/dist/commands/clean-harmony.js +5 -5
- package/dist/commands/init-harmony.js +2 -2
- package/dist/commands/init.js +2 -2
- package/dist/commands/verify-package-harmony.js +1 -0
- package/dist/core/OHPackageJSON5.js +2 -2
- package/dist/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +2 -2
- package/dist/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +3 -3
- package/dist/package-verifier/verify-package.js +1 -1
- package/dist/simulator/LaunchSimulator.js +12 -6
- package/harmony/rnoh-hvigor-plugin-0.84.4.tgz +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/00295336 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/008b46d2 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/00cd4dda +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/04cea04c +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/05456871 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/0ae32abb +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/0b48ad8e +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/0cae97fc +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/1480fa97 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/1605ee89 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/1e6ae961 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/240d2667 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/27934436 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/308da66a +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/3442f3cf +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/349f72a0 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/37767edf +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/37ce5add +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/385deae1 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/3cd62667 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/4387cd63 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/444b6d47 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/45ece0fb +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/47ccd396 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/496f7444 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/4d82696e +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/4eb25953 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/50c3e9bb +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5926231b +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/59c354c2 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5c74cb2d +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5dcb9ab8 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5e5aa298 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/5ebb4e14 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/608a0945 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/62001dcc +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/63177a89 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/690790d2 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/6948fdf0 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/6debf626 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/708bb39b +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/76f64b03 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/78ea606f +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/7b8ac24d +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/7d186843 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/7f12dc56 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8313724a +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/84492c6c +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8449f6fc +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/86506236 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8b8ad1ff +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8f473a16 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/8f91e6a2 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/9ef6c589 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a06f5312 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a25c6436 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a376585e +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a4e0b7a8 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a53962e8 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a576458a +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/a8bbebf8 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/af8536f0 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b00cb392 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b26b36fb +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b3783e31 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b41523d2 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/b45a94bb +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/bb2a0b08 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/bb563230 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/bd3da552 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/c3025482 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/c75a650e +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/c7dc8283 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/cbf6c034 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/cf9197ca +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/cffe922b +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d49ea56c +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d533a666 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d948e745 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/d9f2d22b +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/dc1052ee +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/dde88fbf +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/dfa0a41b +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/edce8119 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/ee4cf060 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/f079d49d +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/f2452d07 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/fb134c38 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/fd1210c0 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/fe159876 +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/ff657ffe +0 -0
- package/node-compile-cache/v24.14.1-x64-cf738c9d-0/ff687756 +0 -0
- package/package.json +5 -5
- package/src/assetResolver.ts +1 -1
- package/src/autolinking/Autolinking.test.ts +78 -10
- package/src/autolinking/Autolinking.ts +7 -3
- package/src/autolinking/JSON5Writer.ts +5 -1
- package/src/commands/bundle-harmony.ts +4 -4
- package/src/commands/clean-harmony.ts +6 -6
- package/src/commands/init-harmony.ts +2 -2
- package/src/commands/init.ts +4 -3
- package/src/commands/run-harmony.ts +1 -1
- package/src/commands/verify-package-harmony.ts +1 -0
- package/src/core/OHPackageJSON5.ts +2 -2
- package/src/init/templates/harmony/entry/src/main/ets/PackageProvider.ets +2 -2
- package/src/init/templates/harmony/entry/src/main/ets/workers/RNOHWorker.ets +3 -3
- package/src/package-verifier/verify-package.ts +1 -1
- package/src/simulator/LaunchSimulator.ts +18 -6
- package/harmony/rnoh-hvigor-plugin-0.84.2.tgz +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/00a68392 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0544a6cc +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/0f36b2db +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/12f23f1e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/13d95d98 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1629e86b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/180c8379 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1a697147 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1a8271b1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/1b7fa689 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/255a9f13 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/268d155b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/27db9aa4 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/28db79ed +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2dc2bbcb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2df5f8c5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/2f88aedb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/31b3a7ea +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/36335b1c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/38fca641 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/397722eb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/397b6432 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/3b17421f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/454f5e18 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/45ec6cce +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/482d51b1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4ac5cd67 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4d40499a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4dcad919 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/4fc31929 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/54edc8f5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/558a5405 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/58d2b670 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/5ec7feca +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/62180f3e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/63981360 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/64096c89 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/64af560b +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6585e783 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6954304f +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/69fd6235 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6d3a0478 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/6e131db7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/778cd8f1 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/788206b6 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7882dc26 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7b3c14f7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/7cdfe667 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8048c487 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/8332d9a3 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/84e5b603 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/854d8127 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/88c97376 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/90d5f644 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/967e25ac +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/969896c2 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9790193e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/97ae40c5 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/9a5bf482 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a07adeb9 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a427f355 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a9dd7eb7 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/a9e9d79e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ab920855 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ab9e3038 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/af054988 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/afe03e51 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b3b83913 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b4db7b4d +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b5225355 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b8c00f06 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b917a081 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/b9e2f3bd +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bd70db0e +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/bdbda648 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/be1e5469 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/c9462295 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ca6e5efa +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/caf52beb +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cb268960 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cca16b15 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/cfc1c937 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d10e6e05 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d172fc04 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d4e94e50 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/d59f8d2c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/da964053 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e0bb712a +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e3e6ca34 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/e50f7385 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f1a1d282 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f2514c3c +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f66207cf +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/f8d129ce +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/fb1e9558 +0 -0
- package/node-compile-cache/v22.14.0-x64-efe9a9df-0/ff7e3608 +0 -0
|
@@ -571,15 +571,58 @@ it('should preserve comments in oh-package.json5', async () => {
|
|
|
571
571
|
expect(ohPackageContent).toContain('@rnoh/test-package');
|
|
572
572
|
});
|
|
573
573
|
|
|
574
|
+
it('should rewrite oh-package.json5 idempotently across repeated autolinking runs', async () => {
|
|
575
|
+
const { runAutolinking, memFS } = createAutolinking({
|
|
576
|
+
fsStructure: {
|
|
577
|
+
...baseFileStructure,
|
|
578
|
+
node_modules: {
|
|
579
|
+
'test-package': {
|
|
580
|
+
harmony: {
|
|
581
|
+
'test_package.har': '',
|
|
582
|
+
},
|
|
583
|
+
'package.json': JSON.stringify({
|
|
584
|
+
name: 'test-package',
|
|
585
|
+
harmony: {
|
|
586
|
+
autolinking: true,
|
|
587
|
+
},
|
|
588
|
+
}),
|
|
589
|
+
},
|
|
590
|
+
},
|
|
591
|
+
harmony: {
|
|
592
|
+
...baseFileStructure.harmony,
|
|
593
|
+
'oh-package.json5': `{
|
|
594
|
+
// This is a top-level comment
|
|
595
|
+
"dependencies": {
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
`,
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
const firstOutput = await runAutolinking();
|
|
604
|
+
const firstContent = memFS.readTextSync(firstOutput.ohPackagePath);
|
|
605
|
+
|
|
606
|
+
// The second run reads the file written by the first run and rewrites it
|
|
607
|
+
await runAutolinking();
|
|
608
|
+
const secondContent = memFS.readTextSync(firstOutput.ohPackagePath);
|
|
609
|
+
|
|
610
|
+
// Rewriting the output of a previous run must not change it (idempotency)
|
|
611
|
+
expect(secondContent).toBe(firstContent);
|
|
612
|
+
// The file must end with exactly one trailing newline
|
|
613
|
+
expect(firstContent.endsWith('\n')).toBe(true);
|
|
614
|
+
expect(firstContent.endsWith('\n\n')).toBe(false);
|
|
615
|
+
});
|
|
616
|
+
|
|
574
617
|
it('should support custom mainHarPath for HAR scanning', async () => {
|
|
575
618
|
const { runAutolinking, memFS } = createAutolinking({
|
|
576
619
|
fsStructure: {
|
|
577
620
|
...baseFileStructure,
|
|
578
621
|
node_modules: {
|
|
579
622
|
'custom-path-package': {
|
|
580
|
-
|
|
623
|
+
custom_harmony: {
|
|
581
624
|
'custom.har': '',
|
|
582
|
-
|
|
625
|
+
subdir: {
|
|
583
626
|
'nested.har': '',
|
|
584
627
|
},
|
|
585
628
|
},
|
|
@@ -646,7 +689,9 @@ it('should support multiple HARs with ohPackageName array mapping', async () =>
|
|
|
646
689
|
|
|
647
690
|
// ETS template should use shared package class name
|
|
648
691
|
const etsContent = memFS.readTextSync(output.etsRNOHPackagesFactoryPath);
|
|
649
|
-
expect(etsContent).toContain(
|
|
692
|
+
expect(etsContent).toContain(
|
|
693
|
+
"import MultiHarPackage from '@rnoh/multi-har--core'"
|
|
694
|
+
);
|
|
650
695
|
expect(etsContent).toContain('new MultiHarPackage(ctx)');
|
|
651
696
|
|
|
652
697
|
// C++ template should use shared package class name
|
|
@@ -670,7 +715,10 @@ it('should use default naming with suffix for unmatched HARs when ohPackageName
|
|
|
670
715
|
harmony: {
|
|
671
716
|
autolinking: {
|
|
672
717
|
ohPackageName: [
|
|
673
|
-
{
|
|
718
|
+
{
|
|
719
|
+
harName: 'matched.har',
|
|
720
|
+
packageName: '@rnoh/partial--matched',
|
|
721
|
+
},
|
|
674
722
|
// unmatched.har is not in the mapping, should use default name with suffix
|
|
675
723
|
],
|
|
676
724
|
},
|
|
@@ -687,7 +735,9 @@ it('should use default naming with suffix for unmatched HARs when ohPackageName
|
|
|
687
735
|
// matched.har should use custom package name
|
|
688
736
|
expect(ohPackageContent).toContain('@rnoh/partial--matched');
|
|
689
737
|
// unmatched.har should use default naming with suffix
|
|
690
|
-
expect(ohPackageContent).toContain(
|
|
738
|
+
expect(ohPackageContent).toContain(
|
|
739
|
+
'@rnoh/partial-mapping-package--unmatched'
|
|
740
|
+
);
|
|
691
741
|
});
|
|
692
742
|
|
|
693
743
|
it('should support remote dependency with version field', async () => {
|
|
@@ -704,7 +754,11 @@ it('should support remote dependency with version field', async () => {
|
|
|
704
754
|
harmony: {
|
|
705
755
|
autolinking: {
|
|
706
756
|
ohPackageName: [
|
|
707
|
-
{
|
|
757
|
+
{
|
|
758
|
+
harName: 'remote.har',
|
|
759
|
+
packageName: '@ohos/remote-lib',
|
|
760
|
+
version: '1.0.0',
|
|
761
|
+
},
|
|
708
762
|
],
|
|
709
763
|
etsPackageClassName: 'RemoteLibPackage',
|
|
710
764
|
cppPackageClassName: 'RemoteLibPackage',
|
|
@@ -725,7 +779,9 @@ it('should support remote dependency with version field', async () => {
|
|
|
725
779
|
|
|
726
780
|
// ETS and C++ templates should still work correctly
|
|
727
781
|
const etsContent = memFS.readTextSync(output.etsRNOHPackagesFactoryPath);
|
|
728
|
-
expect(etsContent).toContain(
|
|
782
|
+
expect(etsContent).toContain(
|
|
783
|
+
"import RemoteLibPackage from '@ohos/remote-lib'"
|
|
784
|
+
);
|
|
729
785
|
|
|
730
786
|
const cppContent = memFS.readTextSync(output.cppRNOHPackagesFactoryPath);
|
|
731
787
|
expect(cppContent).toContain('#include "RemoteLibPackage.h"');
|
|
@@ -749,7 +805,11 @@ it('should support mixed local and remote dependencies in same package', async (
|
|
|
749
805
|
// Local dependency (no version)
|
|
750
806
|
{ harName: 'local.har', packageName: '@rnoh/mixed--local' },
|
|
751
807
|
// Remote dependency (with version)
|
|
752
|
-
{
|
|
808
|
+
{
|
|
809
|
+
harName: 'remote.har',
|
|
810
|
+
packageName: '@ohos/mixed--remote',
|
|
811
|
+
version: '2.0.0',
|
|
812
|
+
},
|
|
753
813
|
],
|
|
754
814
|
etsPackageClassName: 'MixedDepsPackage',
|
|
755
815
|
cppPackageClassName: 'MixedDepsPackage',
|
|
@@ -786,8 +846,16 @@ it('should support multiple remote dependencies', async () => {
|
|
|
786
846
|
harmony: {
|
|
787
847
|
autolinking: {
|
|
788
848
|
ohPackageName: [
|
|
789
|
-
{
|
|
790
|
-
|
|
849
|
+
{
|
|
850
|
+
harName: 'core.har',
|
|
851
|
+
packageName: '@ohos/multi--core',
|
|
852
|
+
version: '^1.0.0',
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
harName: 'ui.har',
|
|
856
|
+
packageName: '@ohos/multi--ui',
|
|
857
|
+
version: '^2.0.0',
|
|
858
|
+
},
|
|
791
859
|
],
|
|
792
860
|
etsPackageClassName: 'MultiRemotePackage',
|
|
793
861
|
cppPackageClassName: 'MultiRemotePackage',
|
|
@@ -359,8 +359,12 @@ export class Autolinking {
|
|
|
359
359
|
};
|
|
360
360
|
});
|
|
361
361
|
autolinkableLibraries.sort((a, b) => {
|
|
362
|
-
if (a.npmPackageName < b.npmPackageName)
|
|
363
|
-
|
|
362
|
+
if (a.npmPackageName < b.npmPackageName) {
|
|
363
|
+
return -1;
|
|
364
|
+
}
|
|
365
|
+
if (a.npmPackageName > b.npmPackageName) {
|
|
366
|
+
return 1;
|
|
367
|
+
}
|
|
364
368
|
return 0;
|
|
365
369
|
});
|
|
366
370
|
|
|
@@ -518,7 +522,7 @@ export class Autolinking {
|
|
|
518
522
|
if (afterNodeModules.startsWith('@')) {
|
|
519
523
|
const parts = afterNodeModules.split('/');
|
|
520
524
|
if (parts.length >= 2) {
|
|
521
|
-
return `${parts[0]}/${parts[1]}`;
|
|
525
|
+
return `${parts[0]}/${parts[1]}`; // @scope/package
|
|
522
526
|
}
|
|
523
527
|
} else {
|
|
524
528
|
// 非 scoped package
|
|
@@ -40,7 +40,11 @@ export class JSON5Writer {
|
|
|
40
40
|
// Return the modified source with JSON5-style formatting
|
|
41
41
|
// Use double quotes for both keys and values, and trailing commas
|
|
42
42
|
// quoteKeys: true ensures keys with special characters (like @, /, -) are properly quoted
|
|
43
|
-
|
|
43
|
+
// NOTE: toSource() preserves the original trailing newlines, so strip them
|
|
44
|
+
// before appending exactly one �� otherwise every rewrite appends an extra
|
|
45
|
+
// blank line and they accumulate across builds (idempotency fix).
|
|
46
|
+
const source = writer.toSource({ quote: 'double', quoteKeys: true, trailingComma: true });
|
|
47
|
+
return source.replace(/(\r?\n)+$/, '') + '\n';
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
/**
|
|
@@ -48,10 +48,10 @@ const ASSETS_DEFAULT_DEST_PATH = pathUtils.normalize(
|
|
|
48
48
|
type Bundle = {
|
|
49
49
|
code: string;
|
|
50
50
|
map: string;
|
|
51
|
-
}
|
|
51
|
+
};
|
|
52
52
|
type RunBuildResult = Bundle & {
|
|
53
53
|
assets?: ReadonlyArray<AssetData>;
|
|
54
|
-
}
|
|
54
|
+
};
|
|
55
55
|
type RunBuildOptions = BuildOptions & {assets?: boolean};
|
|
56
56
|
type Path = string;
|
|
57
57
|
type OSType = 'darwin' | 'linux' | 'win32';
|
|
@@ -163,7 +163,7 @@ export const commandBundleHarmony: Command = {
|
|
|
163
163
|
resetCache: args.resetCache,
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
-
const {assets, ...bundle}= await createBundle(metroConfig, buildOptions);
|
|
166
|
+
const {assets, ...bundle} = await createBundle(metroConfig, buildOptions);
|
|
167
167
|
|
|
168
168
|
if (shouldGenerateHbcBundle) {
|
|
169
169
|
debugLog('Starting Hermes bytecode compilation...');
|
|
@@ -179,7 +179,7 @@ export const commandBundleHarmony: Command = {
|
|
|
179
179
|
await saveJSBundle(logger, bundle, bundleOutput);
|
|
180
180
|
}
|
|
181
181
|
maybeSaveSourceMap(logger, bundle, args.sourcemapOutput);
|
|
182
|
-
if(assets){
|
|
182
|
+
if (assets) {
|
|
183
183
|
await copyAssets(logger, assets, assetsDest);
|
|
184
184
|
debugLog('Assets copy completed, cleaning up...');
|
|
185
185
|
}
|
|
@@ -19,15 +19,15 @@ export const commandCleanHarmony: Command = {
|
|
|
19
19
|
description: 'Remove cached files in the OpenHarmony project.',
|
|
20
20
|
options: [
|
|
21
21
|
{
|
|
22
|
-
name:
|
|
23
|
-
description:
|
|
24
|
-
default:
|
|
22
|
+
name: '--harmony-project-path <path>',
|
|
23
|
+
description: 'Specifies the root of your OpenHarmony project.',
|
|
24
|
+
default: './harmony'
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
27
|
func: async (_argv, _config, rawArgs: any) => {
|
|
28
28
|
const harmonyProjectPath = new AbsolutePath(rawArgs.harmonyProjectPath);
|
|
29
|
-
const md5Path = crypto.createHash(
|
|
30
|
-
const hvigorCachePath = new AbsolutePath(path.join(os.homedir(),
|
|
29
|
+
const md5Path = crypto.createHash('md5').update(harmonyProjectPath.getValue()).digest('hex');
|
|
30
|
+
const hvigorCachePath = new AbsolutePath(path.join(os.homedir(), '.hvigor', 'project_caches', md5Path));
|
|
31
31
|
|
|
32
32
|
if (fs.existsSync(hvigorCachePath.getValue())) {
|
|
33
33
|
fs.rmSync(hvigorCachePath.getValue(), { recursive: true, force: true });
|
|
@@ -42,7 +42,7 @@ export const commandCleanHarmony: Command = {
|
|
|
42
42
|
if (Array.isArray(buildProfile.modules)) {
|
|
43
43
|
buildProfile.modules.forEach((module: any) => {
|
|
44
44
|
if (module && module.srcPath) {
|
|
45
|
-
const modulePath =
|
|
45
|
+
const modulePath = harmonyProjectPath.copyWithNewSegment(module.srcPath);
|
|
46
46
|
const cxxPath = modulePath.copyWithNewSegment('.cxx');
|
|
47
47
|
const buildPath = modulePath.copyWithNewSegment('build');
|
|
48
48
|
|
|
@@ -223,12 +223,12 @@ export const commandInitHarmony: Command = {
|
|
|
223
223
|
fs.writeTextSync(path, content);
|
|
224
224
|
});
|
|
225
225
|
|
|
226
|
-
const buildProfileTemplateComment =
|
|
226
|
+
const buildProfileTemplateComment = 'build-profile.json5 can contain signingConfigs which are unique for each developer, therefore that file is ignored by Git. Create a build-profile.json5 based on this template after cloning this repository to be able to open this project in DevEco Studio.';
|
|
227
227
|
|
|
228
228
|
const buildProfilePath = harmonyDirPath.copyWithNewSegment('build-profile.json5');
|
|
229
229
|
const buildProfileContent = fs.readTextSync(buildProfilePath);
|
|
230
230
|
const contentLines = buildProfileContent.split('\n');
|
|
231
|
-
contentLines.splice(1, 0,
|
|
231
|
+
contentLines.splice(1, 0, '// ' + buildProfileTemplateComment);
|
|
232
232
|
const buildProfileTemplateContent = contentLines.join('\n');
|
|
233
233
|
|
|
234
234
|
fs.writeTextSync(
|
package/src/commands/init.ts
CHANGED
|
@@ -153,7 +153,7 @@ class ValidationHelper {
|
|
|
153
153
|
}
|
|
154
154
|
return reactNativeVersion;
|
|
155
155
|
}
|
|
156
|
-
return
|
|
156
|
+
return '0.77';
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -580,7 +580,7 @@ async function cleanupTempDir(tempDir: string): Promise<void> {
|
|
|
580
580
|
async function getRNOHVersion(rnVersion: string): Promise<string> {
|
|
581
581
|
const versionParts = rnVersion.split('.');
|
|
582
582
|
const majorMinorVersion = `${versionParts[0]}.${versionParts[1]}`;
|
|
583
|
-
let versionInfos =
|
|
583
|
+
let versionInfos = '';
|
|
584
584
|
await runCliCommand(NPM_EXE, ['view', DEFAULT_TEMPLATE_PKG, 'versions', '--json'], process.cwd(), false,
|
|
585
585
|
(data) => {
|
|
586
586
|
versionInfos += data.toString();
|
|
@@ -597,7 +597,8 @@ async function getRNOHVersion(rnVersion: string): Promise<string> {
|
|
|
597
597
|
return matchingVersions.pop();
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
async function handleMissingHarmonyDir(destDir: string, rnVersion: string):
|
|
600
|
+
async function handleMissingHarmonyDir(destDir: string, rnVersion: string):
|
|
601
|
+
Promise<{ rnohTemplateConfig: TemplateConfig, rnohVersion: string, rnohCliVersion: string }> {
|
|
601
602
|
const lastestVersion = await getRNOHVersion(rnVersion);
|
|
602
603
|
const defaultTempDir = await createTempDir();
|
|
603
604
|
try {
|
|
@@ -192,7 +192,7 @@ export const commandRunHarmony: Command = {
|
|
|
192
192
|
message: 'Please select a device:',
|
|
193
193
|
choices: connectedDevices.map((deviceOrSimulator, index) => `${index + 1}. ${deviceOrSimulator.name}`)
|
|
194
194
|
}
|
|
195
|
-
])
|
|
195
|
+
]);
|
|
196
196
|
return connectedDevices[parseInt(answers.selectedDeviceIndex) - 1].name;
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -21,10 +21,10 @@ export class OHPackageJSON5 {
|
|
|
21
21
|
private constructor(private rawData: Record<string, any>) {}
|
|
22
22
|
|
|
23
23
|
get name(): string {
|
|
24
|
-
return this.rawData
|
|
24
|
+
return this.rawData.name;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
get version(): string {
|
|
28
|
-
return this.rawData
|
|
28
|
+
return this.rawData.version;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import type { RNPackageContext, RNOHPackage } from '@rnoh/react-native-openharmony';
|
|
9
|
-
import { createRNOHPackages as createRNOHPackagesAutolinking } from
|
|
9
|
+
import { createRNOHPackages as createRNOHPackagesAutolinking } from './RNOHPackagesFactory';
|
|
10
10
|
|
|
11
11
|
export function getRNOHPackages(ctx: RNPackageContext): RNOHPackage[] {
|
|
12
12
|
return [
|
|
13
13
|
...createRNOHPackagesAutolinking(ctx)
|
|
14
|
-
]
|
|
14
|
+
];
|
|
15
15
|
}
|
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
* It looks like this is ArkTS problem and it may be fixed in the future.
|
|
13
13
|
* For the time being, use direct imports.
|
|
14
14
|
*/
|
|
15
|
-
import { setupRNOHWorker } from
|
|
16
|
-
import { getRNOHPackages } from
|
|
15
|
+
import { setupRNOHWorker } from '@rnoh/react-native-openharmony/src/main/ets/setupRNOHWorker';
|
|
16
|
+
import { getRNOHPackages } from '../PackageProvider';
|
|
17
17
|
|
|
18
18
|
setupRNOHWorker({
|
|
19
19
|
createWorkerRNInstanceConfig: (_rnInstanceName) => {
|
|
20
20
|
return { thirdPartyPackagesFactory: getRNOHPackages }
|
|
21
21
|
}
|
|
22
|
-
})
|
|
22
|
+
});
|
|
23
23
|
|
|
@@ -116,7 +116,7 @@ function findHarPath(packagePath: AbsolutePath): AbsolutePath | null {
|
|
|
116
116
|
const harFilenames = fileOrDirNames.filter((fileOrDirName) =>
|
|
117
117
|
fileOrDirName.endsWith('.har')
|
|
118
118
|
);
|
|
119
|
-
if (harFilenames.length
|
|
119
|
+
if (harFilenames.length !== 1) {
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
122
|
return packageHarmonyPath.copyWithNewSegment(harFilenames[0]);
|
|
@@ -25,13 +25,17 @@ function compareVersionTuple(a: number[], b: number[]): number {
|
|
|
25
25
|
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
26
26
|
const av = a[i] ?? 0;
|
|
27
27
|
const bv = b[i] ?? 0;
|
|
28
|
-
if (av !== bv)
|
|
28
|
+
if (av !== bv) {
|
|
29
|
+
return av - bv;
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
32
|
return 0;
|
|
31
33
|
}
|
|
32
34
|
function isSupportedVersion(versionDir: string): boolean {
|
|
33
35
|
const m = versionDir.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)/);
|
|
34
|
-
if (!m)
|
|
36
|
+
if (!m) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
35
39
|
const current = m.slice(1).map(n => parseInt(n, 10));
|
|
36
40
|
return compareVersionTuple(current, MIN_SUPPORTED_VERSION) >= 0;
|
|
37
41
|
}
|
|
@@ -143,9 +147,13 @@ function parseDeviceManagerXml(xmlContent: string): DevicePathInfo {
|
|
|
143
147
|
while ((m = optionRegex.exec(xmlContent))) {
|
|
144
148
|
const tag = m[0];
|
|
145
149
|
const nameMatch = tag.match(/\bname=["']([^"']+)["']/i);
|
|
146
|
-
if (!nameMatch)
|
|
150
|
+
if (!nameMatch) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
147
153
|
const valueMatch = tag.match(/\bvalue=["']([^"']+)["']/i);
|
|
148
|
-
if (!valueMatch)
|
|
154
|
+
if (!valueMatch) {
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
149
157
|
const name = nameMatch[1];
|
|
150
158
|
const value = valueMatch[1];
|
|
151
159
|
if (name === 'imageDeployPath' && !info.imageRoot) {
|
|
@@ -153,7 +161,9 @@ function parseDeviceManagerXml(xmlContent: string): DevicePathInfo {
|
|
|
153
161
|
} else if (name === 'openharmonyDeployPath' && !info.instancePath) {
|
|
154
162
|
info.instancePath = value;
|
|
155
163
|
}
|
|
156
|
-
if (info.imageRoot && info.instancePath)
|
|
164
|
+
if (info.imageRoot && info.instancePath) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
157
167
|
}
|
|
158
168
|
return info;
|
|
159
169
|
}
|
|
@@ -221,7 +231,9 @@ async function resolveInstanceAndImageRoot(
|
|
|
221
231
|
try {
|
|
222
232
|
const content = await fs.readFile(xmlPath, 'utf-8');
|
|
223
233
|
xmlInfo = parseDeviceManagerXml(content);
|
|
224
|
-
if (xmlInfo.instancePath || xmlInfo.imageRoot)
|
|
234
|
+
if (xmlInfo.instancePath || xmlInfo.imageRoot) {
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
225
237
|
} catch (error) {
|
|
226
238
|
throw new DescriptiveError({
|
|
227
239
|
whatHappened: `Failed to read or parse device manager XML at ${xmlPath}: ${(error as any)?.message || error}`,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|