craft-native 0.0.154 → 0.0.156
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/cli.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/ios/src/index.d.ts +46 -8
- package/dist/ios/src/index.js +289 -98
- package/dist/ios/src/testing.d.ts +71 -0
- package/dist/ios/templates/CraftApp.swift +114 -18
- package/dist/ios/templates/CraftHybrid.swift +269 -31
- package/dist/ios/templates/CraftNativeActions.swift +57 -3
- package/dist/ios/templates/CraftNativeScreen.swift +90 -21
- package/dist/ios/templates/testing/DriverTests.swift.template +305 -0
- package/dist/ios/templates/testing/HostApp.swift +6 -0
- package/dist/ios/templates/testing/MutationValidator.swift +15 -0
- package/dist/ios/templates/testing/project.yml.template +36 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3303,7 +3303,7 @@ function pinCraftNativeDependency(packagePath, craftVersion) {
|
|
|
3303
3303
|
`);
|
|
3304
3304
|
}
|
|
3305
3305
|
// package.json
|
|
3306
|
-
var version = "0.0.
|
|
3306
|
+
var version = "0.0.156";
|
|
3307
3307
|
|
|
3308
3308
|
// bin/cli.ts
|
|
3309
3309
|
var spawnedFrom = process6.env[CRAFT_CLI_SPAWN_MARKER];
|
package/dist/index.cjs
CHANGED
package/dist/index.js
CHANGED
package/dist/ios/src/index.d.ts
CHANGED
|
@@ -83,6 +83,14 @@ export interface CraftConfig {
|
|
|
83
83
|
* Each replaces the generic sentence Craft writes for that key.
|
|
84
84
|
*/
|
|
85
85
|
usageDescriptions?: Record<string, string>;
|
|
86
|
+
/**
|
|
87
|
+
* The app's site. With `renderer: "web"` it is the page the web view loads.
|
|
88
|
+
* With `renderer: "native"` and `nativeScreens` there is no web view: its
|
|
89
|
+
* path is the path the app starts on (`/` when unset), and a path no native
|
|
90
|
+
* screen draws (`craft.navigation.open('/terms')`, or a link to this host)
|
|
91
|
+
* opens in the in-app browser against its origin. Native screens read it as
|
|
92
|
+
* `__stxNativeBridge.appURL`.
|
|
93
|
+
*/
|
|
86
94
|
devServerURL?: string;
|
|
87
95
|
iosVersion?: string;
|
|
88
96
|
watchosVersion?: string;
|
|
@@ -168,16 +176,32 @@ export interface CraftConfig {
|
|
|
168
176
|
orientations?: Array<'portrait' | 'landscape-left' | 'landscape-right' | 'portrait-upside-down'>;
|
|
169
177
|
deviceFamilies?: Array<'iphone' | 'ipad'>;
|
|
170
178
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
179
|
+
* App paths drawn as native stx screens, each to the screen in the native
|
|
180
|
+
* bundle that draws it, e.g. `{ "/m": "Today", "/m/calendar": "Calendar" }`.
|
|
181
|
+
* A segment may be a parameter (`/m/workout/:id`) and the last one `*`.
|
|
182
|
+
* Needs `nativeBundle`.
|
|
183
|
+
*
|
|
184
|
+
* With `renderer: "web"` (hybrid) every other path stays in the web view,
|
|
185
|
+
* and a path whose screen is missing or throws falls back to it.
|
|
186
|
+
*
|
|
187
|
+
* With `renderer: "native"` the app is all native, with the same tabs and
|
|
188
|
+
* path routing and no web view at all: every tab id and the start path (the
|
|
189
|
+
* path of `devServerURL`) must be a native screen's, and any other path
|
|
190
|
+
* opens in the in-app browser on the app's site.
|
|
177
191
|
*/
|
|
178
192
|
nativeScreens?: Record<string, string>;
|
|
179
|
-
/**
|
|
193
|
+
/** The bundle `stx native compile --format bundle` wrote, copied to `dist/native-screen.js`. */
|
|
180
194
|
nativeBundle?: string;
|
|
195
|
+
/**
|
|
196
|
+
* The bundle route of a screen-less script that runs once for the app's
|
|
197
|
+
* whole life, beside the screens (Stacks names it `__app`). It hears the
|
|
198
|
+
* app's events (`craftNotificationResponse`, `craftNotificationReceived`,
|
|
199
|
+
* `craftSilentPush`, `craftBackgroundRefresh`, `craftShortcut`,
|
|
200
|
+
* `craftSiriShortcut`) as `CRAFT_EVENT` messages instead of the page, every
|
|
201
|
+
* `APP_STATE`, and can open paths with `craft.navigation.open`. Needs
|
|
202
|
+
* `nativeScreens` or `renderer: "native"`, and the native bundle.
|
|
203
|
+
*/
|
|
204
|
+
nativeApp?: string;
|
|
181
205
|
/**
|
|
182
206
|
* The native tab bar, shown from the first frame, before the page loads.
|
|
183
207
|
* The page's own `tabBar.set` replaces it later. Each `id` is the tab's
|
|
@@ -214,8 +238,18 @@ export interface NativePathMatch {
|
|
|
214
238
|
export declare function matchNativePath(nativeScreens: Record<string, string> | undefined, raw: string): NativePathMatch | null;
|
|
215
239
|
/** Whether a config mixes native screens into its web page. */
|
|
216
240
|
export declare function isHybrid(config: Pick<CraftConfig, 'renderer' | 'nativeScreens'>): boolean;
|
|
241
|
+
/** Whether a config is an all-native app with routes: `renderer: "native"` and `nativeScreens`, tabs and paths with no web view. */
|
|
242
|
+
export declare function hasNativeRoutes(config: Pick<CraftConfig, 'renderer' | 'nativeScreens'>): boolean;
|
|
243
|
+
/** Whether a config draws any native screen, and so needs `dist/native-screen.js`. */
|
|
244
|
+
export declare function usesNativeBundle(config: Pick<CraftConfig, 'renderer' | 'nativeScreens'>): boolean;
|
|
245
|
+
/**
|
|
246
|
+
* The path the app starts on: the path of `devServerURL` (with its query),
|
|
247
|
+
* `/` when there is none. The shell reads it the same way
|
|
248
|
+
* (`CraftHybridRoutes.appPath`).
|
|
249
|
+
*/
|
|
250
|
+
export declare function nativeStartPath(config: Pick<CraftConfig, 'devServerURL'>): string;
|
|
217
251
|
/** What is wrong with a config's hybrid and tab settings, one sentence each. */
|
|
218
|
-
export declare function hybridConfigProblems(config: Pick<CraftConfig, 'renderer' | 'nativeScreens' | 'tabs' | 'shareStorage'>): string[];
|
|
252
|
+
export declare function hybridConfigProblems(config: Pick<CraftConfig, 'renderer' | 'nativeScreens' | 'tabs' | 'shareStorage' | 'devServerURL' | 'nativeApp'>): string[];
|
|
219
253
|
export interface CraftBackgroundRefresh {
|
|
220
254
|
enabled: boolean;
|
|
221
255
|
/** The BGTaskScheduler identifier. Default `<bundleId>.refresh`. */
|
|
@@ -412,6 +446,8 @@ export declare function installRuntime(output: string, runtimeDir: string): Prom
|
|
|
412
446
|
* valid Swift type.
|
|
413
447
|
*/
|
|
414
448
|
export declare function productName(name: string): string;
|
|
449
|
+
/** Restore package-owned Swift into an existing project, without changing its Xcode metadata or bundled screens. */
|
|
450
|
+
export declare function restoreShell(output: string): void;
|
|
415
451
|
export declare function init(options: InitOptions): Promise<void>;
|
|
416
452
|
/**
|
|
417
453
|
* Build web assets and generate Xcode project
|
|
@@ -475,3 +511,5 @@ export declare function bootSimulator(device: SimulatorDevice): Promise<void>;
|
|
|
475
511
|
*/
|
|
476
512
|
export declare function showSimulator(): Promise<void>;
|
|
477
513
|
export declare function run(options: RunOptions): Promise<void>;
|
|
514
|
+
export { createNativeMutationValidator, initSimulatorDriver, serializeSimulatorSteps } from './testing.js';
|
|
515
|
+
export type { NativeMutationValidator, NativeValidationResult, SimulatorDriverOptions, SimulatorStep } from './testing.js';
|