catalyst-core 1.1.0 → 1.2.0-canary.2

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 (69) hide show
  1. package/bin/catalyst.js +54 -6
  2. package/changelog.md +27 -1
  3. package/dist/errors/registry.js +306 -18
  4. package/dist/errors-index.json +273 -70
  5. package/dist/native/androidProject/app/build.gradle.kts +53 -79
  6. package/dist/native/androidProject/app/src/main/AndroidManifest.xml +1 -1
  7. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/CatalystConstants.kt +3 -1
  8. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/MainActivity.kt +32 -4
  9. package/dist/native/androidProject/app/src/main/java/io/yourname/androidproject/utils/KeyboardUtil.kt +5 -1
  10. package/dist/native/androidProject/app/src/test/java/io/yourname/androidproject/ConfigMappingTest.kt +25 -0
  11. package/dist/native/androidSetup.js +76 -170
  12. package/dist/native/androidToolchain.js +642 -0
  13. package/dist/native/appIcon.js +100 -0
  14. package/dist/native/buildAndroid/assets.js +29 -5
  15. package/dist/native/buildAndroid/build.js +110 -223
  16. package/dist/native/buildAndroid/config.js +57 -65
  17. package/dist/native/buildAndroid/devices.js +176 -0
  18. package/dist/native/buildAndroid/index.js +271 -46
  19. package/dist/native/buildAndroid/output.js +43 -0
  20. package/dist/native/buildAndroid/signing.js +456 -0
  21. package/dist/native/buildAppAndroid.js +27 -7
  22. package/dist/native/buildAppIos.js +139 -20
  23. package/dist/native/buildIos/assets.js +76 -4
  24. package/dist/native/buildIos/build.js +31 -181
  25. package/dist/native/buildIos/config.js +126 -11
  26. package/dist/native/buildIos/index.js +354 -34
  27. package/dist/native/buildIos/localhostCert.js +87 -0
  28. package/dist/native/buildIos/output.js +28 -0
  29. package/dist/native/buildIos/signing.js +596 -0
  30. package/dist/native/credentials.js +309 -0
  31. package/dist/native/exportCredentials.js +51 -0
  32. package/dist/native/iosToolchain.js +583 -0
  33. package/dist/native/iosnativeWebView/Configurations/Shared.xcconfig +1 -3
  34. package/dist/native/iosnativeWebView/iosnativeWebView/Info-Release.plist +2 -0
  35. package/dist/native/iosnativeWebView/iosnativeWebView/PrivacyInfo.xcprivacy +40 -0
  36. package/dist/native/iosnativeWebView/iosnativeWebView/iosnativeWebView.entitlements +0 -2
  37. package/dist/native/iosnativeWebView/iosnativeWebView.xcodeproj/project.pbxproj +4 -4
  38. package/dist/native/localState.js +148 -0
  39. package/dist/native/nativeConfig.js +621 -0
  40. package/dist/native/releaseOutput.js +53 -0
  41. package/dist/native/renameAndroidProject.js +154 -369
  42. package/dist/native/setupEmulatorIos.js +58 -275
  43. package/dist/native/setupServer.js +520 -124
  44. package/dist/native/utils.js +418 -115
  45. package/dist/vite/resolveDevServerConfig.js +21 -0
  46. package/mcp_v2/knowledge-base.json +13 -11
  47. package/mcp_v2/test/config.test.ts +40 -0
  48. package/mcp_v2/tools/build.js +80 -104
  49. package/mcp_v2/tools/config.js +181 -174
  50. package/package.json +1 -1
  51. package/test/cli/nativeFlags.test.ts +97 -0
  52. package/test/native/androidDevices.test.ts +230 -0
  53. package/test/native/androidElfAlignment.test.ts +148 -0
  54. package/test/native/androidSigning.test.ts +646 -0
  55. package/test/native/androidToolchain.test.ts +766 -0
  56. package/test/native/appIcon.test.ts +124 -0
  57. package/test/native/credentials.test.ts +241 -0
  58. package/test/native/interaction.test.ts +179 -0
  59. package/test/native/iosConfigPhase.test.ts +611 -0
  60. package/test/native/iosSigning.test.ts +1060 -0
  61. package/test/native/iosToolchain.test.ts +821 -0
  62. package/test/native/localState.test.ts +80 -0
  63. package/test/native/nativeConfig.test.ts +602 -0
  64. package/test/native/setupServer.test.ts +529 -0
  65. package/test/native/utils.test.ts +102 -127
  66. package/test/vite/resolveDevServerConfig.test.js +25 -0
  67. package/dist/native/androidProject/keystore/Untitled +0 -0
  68. package/dist/native/androidProject/keystore/release-key.jks +0 -0
  69. package/dist/native/iosnativeWebView/iosnativeWebView/localhost.p12 +0 -0
@@ -19,6 +19,7 @@
19
19
  E9F699DC2EE06483005E972E /* CacheManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F699DB2EE06482005E972E /* CacheManagerTests.swift */; };
20
20
  E9F699DE2EE06506005E972E /* FilePickerHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F699DD2EE06506005E972E /* FilePickerHandlerTests.swift */; };
21
21
  F1234AC22E990180008C7F58 /* localhost.p12 in Resources */ = {isa = PBXBuildFile; fileRef = F1234AC32E990180008C7F58 /* localhost.p12 */; };
22
+ C47A11002F2A000100000001 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = C47A11002F2A000100000002 /* PrivacyInfo.xcprivacy */; };
22
23
  F2B100012F11111100AAA001 /* PluginBridgeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2B100022F11111100AAA001 /* PluginBridgeTests.swift */; };
23
24
  /* End PBXBuildFile section */
24
25
 
@@ -58,6 +59,7 @@
58
59
  E9F699DB2EE06482005E972E /* CacheManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CacheManagerTests.swift; sourceTree = "<group>"; };
59
60
  E9F699DD2EE06506005E972E /* FilePickerHandlerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilePickerHandlerTests.swift; sourceTree = "<group>"; };
60
61
  F1234AC32E990180008C7F58 /* localhost.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; path = localhost.p12; sourceTree = "<group>"; };
62
+ C47A11002F2A000100000002 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
61
63
  F2B100022F11111100AAA001 /* PluginBridgeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginBridgeTests.swift; sourceTree = "<group>"; };
62
64
  XCCONFIG001000000001 /* Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
63
65
  XCCONFIG001000000002 /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
@@ -122,6 +124,7 @@
122
124
  4777D5222C60B87700E85AC6 /* Assets.xcassets */,
123
125
  4777D5242C60B87700E85AC6 /* Preview Content */,
124
126
  F1234AC32E990180008C7F58 /* localhost.p12 */,
127
+ C47A11002F2A000100000002 /* PrivacyInfo.xcprivacy */,
125
128
  );
126
129
  path = iosnativeWebView;
127
130
  sourceTree = "<group>";
@@ -270,6 +273,7 @@
270
273
  4777D5262C60B87700E85AC6 /* Preview Assets.xcassets in Resources */,
271
274
  4777D5232C60B87700E85AC6 /* Assets.xcassets in Resources */,
272
275
  F1234AC22E990180008C7F58 /* localhost.p12 in Resources */,
276
+ C47A11002F2A000100000001 /* PrivacyInfo.xcprivacy in Resources */,
273
277
  );
274
278
  runOnlyForDeploymentPostprocessing = 0;
275
279
  };
@@ -462,7 +466,6 @@
462
466
  baseConfigurationReference = XCCONFIG001000000001 /* Debug.xcconfig */;
463
467
  buildSettings = {
464
468
  CODE_SIGN_ENTITLEMENTS = iosnativeWebView/iosnativeWebView.entitlements;
465
- "DEVELOPMENT_TEAM[sdk=iphoneos*]" = BHQQRZ69D3;
466
469
  INFOPLIST_KEY_NSCameraUsageDescription = "This app requires camera access to capture images";
467
470
  INFOPLIST_KEY_NSLocalNetworkUsageDescription = "Debug web content in Safari Web Inspector";
468
471
  INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "This app requires photo library access to select images from your gallery";
@@ -471,9 +474,7 @@
471
474
  INFOPLIST_KEY_UILaunchScreen_Generation = YES;
472
475
  INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
473
476
  INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
474
- PRODUCT_BUNDLE_IDENTIFIER = com.1mg.pos;
475
477
  PRODUCT_NAME = "$(TARGET_NAME)";
476
- "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = Tata1mgPos;
477
478
  };
478
479
  name = Debug;
479
480
  };
@@ -491,7 +492,6 @@
491
492
  INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
492
493
  INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
493
494
  PRODUCT_NAME = "$(TARGET_NAME)";
494
- "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "1mg Development profile";
495
495
  };
496
496
  name = Release;
497
497
  };
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ensureLocalStateDir = ensureLocalStateDir;
7
+ exports.getLastTarget = getLastTarget;
8
+ exports.localStatePath = localStatePath;
9
+ exports.readLocalState = readLocalState;
10
+ exports.saveLastTarget = saveLastTarget;
11
+ exports.writeLocalState = writeLocalState;
12
+ var _fs = _interopRequireDefault(require("fs"));
13
+ var _path = _interopRequireDefault(require("path"));
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ // Per-project, per-machine CLI state in .catalyst/local.json. It only ever
16
+ // holds conveniences (the last emulator/phone pick, one-time migrations,
17
+ // the dev server this CLI started), so every read and write is best effort
18
+ // and never fails a build.
19
+ //
20
+ // Shape:
21
+ // {
22
+ // "android": { "target": "emulator", "avd": "Pixel_8_API_36" }
23
+ // | { "target": "device", "serial": "R58M123ABC" },
24
+ // "ios": { "target": "simulator", "udid": "<sim udid>", "name": "iPhone 17" }
25
+ // | { "target": "device", "udid": "<device udid>", "name": "Jane's iPhone" },
26
+ // "migrations": { "lanAddresses": "2026-10-29T10:00:00.000Z" },
27
+ // "devServer": { "host": "localhost" | "<mac>.local" | "<lan ip>", "port": 3005, "pid": 4242 }
28
+ // }
29
+ //
30
+ // The folder carries its own .gitignore (`*`), so it stays out of git even
31
+ // in an app whose .gitignore predates the `.catalyst/` entry.
32
+
33
+ const DIR_NAME = ".catalyst";
34
+ const FILE_NAME = "local.json";
35
+ const isPlainObject = value => value !== null && typeof value === "object" && !Array.isArray(value);
36
+
37
+ /** @param {string} [cwd] */
38
+ function localStatePath(cwd = process.cwd()) {
39
+ // nosemgrep: javascript.lang.security.audit.path-traversal.path-join-resolve-traversal.path-join-resolve-traversal - cwd is the local app directory; the names are fixed.
40
+ return _path.default.join(cwd, DIR_NAME, FILE_NAME);
41
+ }
42
+
43
+ /**
44
+ * Create .catalyst/ (owner only) with its own `*` .gitignore, and return its
45
+ * path. An existing .gitignore is left as it is.
46
+ *
47
+ * @param {string} [cwd]
48
+ * @returns {string}
49
+ */
50
+ function ensureLocalStateDir(cwd = process.cwd()) {
51
+ const dir = _path.default.dirname(localStatePath(cwd));
52
+ _fs.default.mkdirSync(dir, {
53
+ recursive: true,
54
+ mode: 0o700
55
+ });
56
+ try {
57
+ // "wx": create it only when it is not there, in one step.
58
+ _fs.default.writeFileSync(_path.default.join(dir, ".gitignore"), "*\n", {
59
+ flag: "wx"
60
+ });
61
+ } catch (error) {
62
+ if (error.code !== "EEXIST") throw error;
63
+ }
64
+ return dir;
65
+ }
66
+
67
+ /**
68
+ * The whole state object, or {} when the file is missing or unreadable.
69
+ *
70
+ * @param {object} [options]
71
+ * @param {string} [options.cwd]
72
+ * @returns {Record<string, any>}
73
+ */
74
+ function readLocalState({
75
+ cwd = process.cwd()
76
+ } = {}) {
77
+ try {
78
+ const parsed = JSON.parse(_fs.default.readFileSync(localStatePath(cwd), "utf8"));
79
+ return isPlainObject(parsed) ? parsed : {};
80
+ } catch (error) {
81
+ return {};
82
+ }
83
+ }
84
+
85
+ /**
86
+ * Merge `patch` into the state, one level deep (each top-level key is
87
+ * replaced as a whole). Returns false instead of throwing when it cannot
88
+ * write.
89
+ *
90
+ * @param {Record<string, any>} patch
91
+ * @param {object} [options]
92
+ * @param {string} [options.cwd]
93
+ * @returns {boolean}
94
+ */
95
+ function writeLocalState(patch, {
96
+ cwd = process.cwd()
97
+ } = {}) {
98
+ try {
99
+ const file = _path.default.join(ensureLocalStateDir(cwd), FILE_NAME);
100
+ const next = {
101
+ ...readLocalState({
102
+ cwd
103
+ }),
104
+ ...patch
105
+ };
106
+ _fs.default.writeFileSync(file, JSON.stringify(next, null, 2) + "\n");
107
+ return true;
108
+ } catch (error) {
109
+ return false;
110
+ }
111
+ }
112
+
113
+ /**
114
+ * The last target picked for a platform, or null.
115
+ *
116
+ * @param {"android"|"ios"} platform
117
+ * @param {object} [options]
118
+ * @param {string} [options.cwd]
119
+ * @returns {{ target: string, [key: string]: any } | null}
120
+ */
121
+ function getLastTarget(platform, {
122
+ cwd = process.cwd()
123
+ } = {}) {
124
+ const entry = readLocalState({
125
+ cwd
126
+ })[platform];
127
+ return isPlainObject(entry) && typeof entry.target === "string" ? entry : null;
128
+ }
129
+
130
+ /**
131
+ * Remember the target picked for a platform.
132
+ *
133
+ * @param {"android"|"ios"} platform
134
+ * @param {{ target: string, [key: string]: any }} target
135
+ * @param {object} [options]
136
+ * @param {string} [options.cwd]
137
+ * @returns {boolean}
138
+ */
139
+ function saveLastTarget(platform, target, {
140
+ cwd = process.cwd()
141
+ } = {}) {
142
+ if (!isPlainObject(target) || typeof target.target !== "string") return false;
143
+ return writeLocalState({
144
+ [platform]: target
145
+ }, {
146
+ cwd
147
+ });
148
+ }