Skip to content

Commit 9959992

Browse files
committed
docs(compiled): ns compiled verify, build hooks, core's parity on iOS, web globals, what is still open
1 parent 43ff399 commit 9959992

1 file changed

Lines changed: 32 additions & 12 deletions

File tree

‎content/guide/publishing/compiled.md‎

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ your app (TypeScript, templates, CSS) plugins (their TypeScript sourc
154154
| Octane | Supported |
155155
| Plain TypeScript with XML | Supported: core's own Builder makes the views from your XML, as in the JavaScript build: `{{ }}` bindings, code-behind, custom components (`xmlns:my`) and ListView templates |
156156

157+
Core's own behavior comes with it on iOS, where the kit is core: RTL layout, Dynamic Type through
158+
`ios-a11y-adjusts-font-size`, `font://` icons, `background-image: url()`, box shadows and the accessibility
159+
properties render as in the JavaScript build, pixel for pixel. The web globals the NativeScript runtime provides are
160+
there too: `crypto` (`randomUUID`, `getRandomValues`, and `subtle` with SHA digests, HMAC and RSA-OAEP),
161+
`TextEncoder`/`TextDecoder`, `atob`/`btoa`, timers, `queueMicrotask` and `console`. `fetch` and `XMLHttpRequest`
162+
are not yet available in a compiled release.
163+
157164
### Platforms
158165

159166
| | iOS | Android |
@@ -188,9 +195,12 @@ The compiler refuses what it cannot compile faithfully, and says so with the fil
188195
`async`, more than one Angular `@Component` in a file, Vue `<style module>`, JSX spread attributes, and Vue
189196
Options-API keys beyond the common ones.
190197
- **Plugin native code the build does not carry yet:** a prebuilt `.framework` or `.a` (an `.xcframework` is
191-
fine), a resource `.bundle`, a `.podspec`, Android `jniLibs`/`.so` files, and plugin hooks.
192-
- **Not at parity yet:** RTL layout, Dynamic Type and font scale, `background-image: url()`, inset box shadows,
193-
`font://` icons. Accessibility and localization are not yet checked against core.
198+
fine), a resource `.bundle`, a `.podspec`, and Android `jniLibs`/`.so` files.
199+
200+
Your project's hooks run as they do for a JavaScript build: `before-prepare`/`after-prepare` and
201+
`before-buildIOS`/`after-buildIOS` (`buildAndroid` on Android), with the same arguments. In a compiled build
202+
`projectRoot` is the compiled project (`platforms/compiled/<platform>`), so a hook that edits the runtime's Xcode or
203+
Gradle project under `platforms/ios` or `platforms/android` has nothing to change there.
194204

195205
## What your app may need
196206

@@ -237,7 +247,18 @@ Treat a compiled release like any new build: compare it with the JavaScript rele
237247
expected.
238248
3. Watch for crashes as well as pixels: a screen can match and still fail on interaction.
239249

240-
A command that runs this comparison for you (`ns compiled verify`) is planned.
250+
`ns compiled verify` does this for you on an iOS Simulator. It builds both releases, runs the same steps on each
251+
(from the project's `verify.json`: taps, swipes, typing, waits and shots, each screen from a fresh launch), compares
252+
every shot pixel by pixel once the screen settles, and fails on a difference or on an app that stops running. The
253+
screenshots and a `report.json` go to `platforms/compiled/verify`.
254+
255+
```json
256+
{
257+
"screens": [
258+
{ "name": "home", "steps": [["shot", "start"], ["tap", 200, 400], ["wait", 1], ["type", "Ada"], ["shot", "typed"]] }
259+
]
260+
}
261+
```
241262

242263
## FAQ
243264

@@ -352,14 +373,13 @@ runs the proof apps; Android still uses the hand port.
352373
## What is still open
353374

354375
- Publishing `@nativescript/compiler` and releasing the CLI flag.
355-
- Core's own test app (`apps/automated`) run as a compiled app, as a measure of compliance: it compiles to Swift; the
356-
last of its Swift build is in progress.
357-
- Plugins: `.framework` and static libraries, resource bundles, plugin hooks, and a way for plugin authors to ship
358-
native counterparts of engine-bound code.
359-
- Android: the kit generated from core, and real-device verification.
360-
- Accessibility, RTL, Dynamic Type and localization at core parity.
361-
- A command that compares a compiled release with its JavaScript release for you (`ns compiled verify`), and
362-
uploading the compiled code's TypeScript line maps to crash reporters.
376+
- Core's own apps as compliance: `apps/automated` (core's unit tests) and `apps/toolbox`, compiled, run and
377+
compared with their JavaScript builds.
378+
- Plugins: `.framework` and static libraries, resource bundles, and a way for plugin authors to ship native
379+
counterparts of engine-bound code. A corpus of widely used plugins and npm libraries, built in CI.
380+
- Android: the kit generated from core (in progress), WinterTC globals, and real-device verification.
381+
- `fetch` and `XMLHttpRequest`; localization checked against core.
382+
- Uploading the compiled code's TypeScript line maps to crash reporters.
363383

364384
## See also
365385

0 commit comments

Comments
 (0)