@blotch/angular-lynx-native 22.3.1 → 22.3.3

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 (123) hide show
  1. package/README.md +47 -15
  2. package/dist/android/project.d.ts +114 -1
  3. package/dist/android/project.d.ts.map +1 -1
  4. package/dist/android/project.js +440 -5
  5. package/dist/eject.d.ts +15 -1
  6. package/dist/eject.d.ts.map +1 -1
  7. package/dist/eject.js +14 -2
  8. package/dist/features.d.ts +70 -0
  9. package/dist/features.d.ts.map +1 -0
  10. package/dist/features.js +115 -0
  11. package/dist/files.d.ts +24 -0
  12. package/dist/files.d.ts.map +1 -0
  13. package/dist/files.js +41 -0
  14. package/dist/generate.d.ts +34 -3
  15. package/dist/generate.d.ts.map +1 -1
  16. package/dist/generate.js +78 -19
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +16 -2
  20. package/dist/ios/build.d.ts.map +1 -1
  21. package/dist/ios/build.js +8 -2
  22. package/dist/ios/frameworks.d.ts +6 -5
  23. package/dist/ios/frameworks.d.ts.map +1 -1
  24. package/dist/ios/frameworks.js +46 -15
  25. package/dist/ios/project.d.ts +192 -11
  26. package/dist/ios/project.d.ts.map +1 -1
  27. package/dist/ios/project.js +823 -33
  28. package/dist/options.d.ts +208 -1
  29. package/dist/options.d.ts.map +1 -1
  30. package/dist/options.js +154 -0
  31. package/dist/permissions.d.ts +18 -1
  32. package/dist/permissions.d.ts.map +1 -1
  33. package/dist/permissions.js +79 -4
  34. package/dist/plugins.d.ts +245 -0
  35. package/dist/plugins.d.ts.map +1 -0
  36. package/dist/plugins.js +1244 -0
  37. package/package.json +1 -1
  38. package/templates/android/README.md +46 -5
  39. package/templates/android/angular-lynx.properties +2 -0
  40. package/templates/android/app/build.gradle.kts +78 -11
  41. package/templates/android/app/src/main/AndroidManifest.xml +19 -3
  42. package/templates/android/app/src/main/java/dev/angularlynx/shell/AngularLynxPlugins.kt +13 -0
  43. package/templates/android/app/src/main/java/dev/angularlynx/shell/AudioRecorderModule.kt +520 -0
  44. package/templates/android/app/src/main/java/dev/angularlynx/shell/BarcodeScannerModule.kt +144 -0
  45. package/templates/android/app/src/main/java/dev/angularlynx/shell/BiometricsModule.kt +433 -0
  46. package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapPresenter.kt +98 -0
  47. package/templates/android/app/src/main/java/dev/angularlynx/shell/BitmapRendererContext.kt +175 -0
  48. package/templates/android/app/src/main/java/dev/angularlynx/shell/BluetoothModule.kt +1288 -0
  49. package/templates/android/app/src/main/java/dev/angularlynx/shell/CalendarModule.kt +127 -0
  50. package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DContext.kt +1557 -0
  51. package/templates/android/app/src/main/java/dev/angularlynx/shell/Canvas2DOps.kt +63 -0
  52. package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasFilter.kt +357 -0
  53. package/templates/android/app/src/main/java/dev/angularlynx/shell/CanvasUI.kt +4 -3
  54. package/templates/android/app/src/main/java/dev/angularlynx/shell/EdgeToEdgeOverlay.kt +24 -0
  55. package/templates/android/app/src/main/java/dev/angularlynx/shell/EngineThreadHint.kt +156 -0
  56. package/templates/android/app/src/main/java/dev/angularlynx/shell/FilePickerModule.kt +263 -0
  57. package/templates/android/app/src/main/java/dev/angularlynx/shell/GeolocationModule.kt +557 -0
  58. package/templates/android/app/src/main/java/dev/angularlynx/shell/HapticsModule.kt +82 -0
  59. package/templates/android/app/src/main/java/dev/angularlynx/shell/HostElementUI.kt +331 -0
  60. package/templates/android/app/src/main/java/dev/angularlynx/shell/ImagePickerModule.kt +143 -0
  61. package/templates/android/app/src/main/java/dev/angularlynx/shell/ImagePipeline.kt +83 -0
  62. package/templates/android/app/src/main/java/dev/angularlynx/shell/MainActivity.kt +523 -9
  63. package/templates/android/app/src/main/java/dev/angularlynx/shell/ModuleBytes.kt +58 -0
  64. package/templates/android/app/src/main/java/dev/angularlynx/shell/MotionModule.kt +332 -0
  65. package/templates/android/app/src/main/java/dev/angularlynx/shell/NetworkStatus.kt +121 -0
  66. package/templates/android/app/src/main/java/dev/angularlynx/shell/NfcModule.kt +274 -0
  67. package/templates/android/app/src/main/java/dev/angularlynx/shell/PermissionRequests.kt +35 -0
  68. package/templates/android/app/src/main/java/dev/angularlynx/shell/PhotoLibraryModule.kt +355 -0
  69. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShareTargetModule.kt +234 -0
  70. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellApplication.kt +7 -8
  71. package/templates/android/app/src/main/java/dev/angularlynx/shell/ShellModule.kt +58 -4
  72. package/templates/android/app/src/main/java/dev/angularlynx/shell/StoreReviewModule.kt +66 -0
  73. package/templates/android/app/src/main/java/dev/angularlynx/shell/SystemFontFamilies.kt +68 -0
  74. package/templates/android/app/src/main/java/dev/angularlynx/shell/TrackingModule.kt +74 -0
  75. package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoFrameTarget.kt +429 -0
  76. package/templates/android/app/src/main/java/dev/angularlynx/shell/VideoUI.kt +676 -0
  77. package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLContext.kt +128 -13
  78. package/templates/android/app/src/main/java/dev/angularlynx/shell/WebGLModule.kt +493 -65
  79. package/templates/android/app/src/main/java/dev/angularlynx/shell/WifiModule.kt +429 -0
  80. package/templates/android/app/src/main/res/values/biometrics.xml +9 -0
  81. package/templates/android/app/src/main/res/values/share_target.xml +11 -0
  82. package/templates/android/app/src/main/res/xml/backup_rules.xml +5 -3
  83. package/templates/android/app/src/main/res/xml/data_extraction_rules.xml +6 -3
  84. package/templates/android/app/src/main/res/xml/share_paths.xml +7 -2
  85. package/templates/android/build.gradle.kts +1 -1
  86. package/templates/android/gradle/wrapper/gradle-wrapper.properties +2 -2
  87. package/templates/ios/App/AngularLynxBitmapRendererContext.m +188 -0
  88. package/templates/ios/App/AngularLynxCanvas2DContext.m +2467 -0
  89. package/templates/ios/App/AngularLynxCanvas2DOps.h +61 -0
  90. package/templates/ios/App/AngularLynxPlugins.swift +22 -0
  91. package/templates/ios/App/AngularLynxVideo.h +37 -0
  92. package/templates/ios/App/AngularLynxVideo.m +435 -0
  93. package/templates/ios/App/AngularLynxWebGL.h +69 -7
  94. package/templates/ios/App/AngularLynxWebGL.m +538 -29
  95. package/templates/ios/App/AngularLynxWebGLContext.m +148 -46
  96. package/templates/ios/App/AnimationFrameRate.swift +66 -0
  97. package/templates/ios/App/AppDelegate.swift +37 -3
  98. package/templates/ios/App/AppleSignInButton.swift +106 -0
  99. package/templates/ios/App/AppleSignInModule.swift +222 -0
  100. package/templates/ios/App/AudioRecorderModule.swift +433 -0
  101. package/templates/ios/App/BarcodeScannerModule.swift +284 -0
  102. package/templates/ios/App/BiometricsModule.swift +256 -0
  103. package/templates/ios/App/BluetoothModule.swift +1086 -0
  104. package/templates/ios/App/CalendarModule.swift +158 -0
  105. package/templates/ios/App/FilePickerModule.swift +240 -0
  106. package/templates/ios/App/GeolocationModule.swift +455 -0
  107. package/templates/ios/App/HapticsModule.swift +90 -0
  108. package/templates/ios/App/HostElementUI.swift +270 -0
  109. package/templates/ios/App/ImagePickerModule.swift +160 -1
  110. package/templates/ios/App/Info.plist +2 -0
  111. package/templates/ios/App/LynxViewController.swift +274 -9
  112. package/templates/ios/App/MotionModule.swift +430 -0
  113. package/templates/ios/App/NetworkStatus.swift +41 -0
  114. package/templates/ios/App/NfcModule.swift +346 -0
  115. package/templates/ios/App/PhotoLibraryModule.swift +169 -0
  116. package/templates/ios/App/ShareTargetModule.swift +150 -0
  117. package/templates/ios/App/ShellModule.swift +17 -0
  118. package/templates/ios/App/StoreReviewModule.swift +61 -0
  119. package/templates/ios/App/TrackingModule.swift +121 -0
  120. package/templates/ios/App/WifiModule.swift +237 -0
  121. package/templates/ios/App/XElementRegistry.swift +13 -3
  122. package/templates/ios/ShareExtension/Info.plist +42 -0
  123. package/templates/ios/ShareExtension/ShareViewController.swift +387 -0
@@ -1,13 +1,20 @@
1
- import { chmodSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
1
+ import { chmodSync, existsSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
+ import { leaveOutWifi, removeMarkedLines, removeTemplateFiles, } from "../features.js";
4
5
  import { shortcutIdentifier, } from "../options.js";
5
6
  import { PERMISSION_MAP } from "../permissions.js";
7
+ import { androidPluginsKotlin, checkAndroidResources, checkJvmPackages, copyPluginResources, copyPluginSources, readNativePlugins, } from "../plugins.js";
6
8
  import { writeAndroidSplash } from "../splash.js";
7
9
  import { writeAndroidIcon } from "./icon.js";
8
10
  import { escapeXml, replaceMarker } from "../xml.js";
9
11
  const MANIFEST = 'app/src/main/AndroidManifest.xml';
10
12
  const RESOURCES = 'app/src/main/res';
13
+ const APP_BUILD_FILE = 'app/build.gradle.kts';
14
+ const BARCODE_SCANNER_MARKER = '// angular-lynx:barcode-scanner';
15
+ /** LynxBarcodeScanner's module, which needs the `camera` permission. */
16
+ export const ANDROID_BARCODE_SCANNER_SOURCE = 'app/src/main/java/dev/angularlynx/shell/BarcodeScannerModule.kt';
17
+ const BLUETOOTH_MODULE = 'app/src/main/java/dev/angularlynx/shell/BluetoothModule.kt';
11
18
  const SCREEN_ORIENTATIONS = {
12
19
  portrait: 'portrait',
13
20
  landscape: 'sensorLandscape',
@@ -19,7 +26,16 @@ const SCREEN_ORIENTATIONS = {
19
26
  * deep links and the apps canOpenURL can see go between the manifest's
20
27
  * `angular-lynx:*` markers, the icon options become the launcher icon's
21
28
  * resources, the shortcuts become the static shortcuts' resources, and the
22
- * splash becomes the splash theme's color and image.
29
+ * splash becomes the splash theme's color and image. The barcode scanner's
30
+ * module and the library behind it stay only in an app with the `camera`
31
+ * permission, and the Bluetooth module only in an app with the `bluetooth`
32
+ * permission. The store review module stays only in an app with
33
+ * `storeReview`, the calendar module only in one with `calendar`, the
34
+ * tracking module only in one with `permissions.tracking`, the NFC module
35
+ * only in one with `permissions.nfc`, the audio recorder's module only in one
36
+ * with `permissions.microphone`, the geolocation module only in one with
37
+ * `permissions.location`, the motion module only in one with `motion`, and
38
+ * the Wi-Fi module only in one with `wifi`, with only the parts it turns on.
23
39
  */
24
40
  export const androidGenerator = {
25
41
  configure: (dir, app, projectRoot) => {
@@ -32,6 +48,7 @@ export const androidGenerator = {
32
48
  manifest = replaceMarker(manifest, 'permissions', permissionEntries(app));
33
49
  manifest = replaceMarker(manifest, 'deep-links', deepLinkEntries(app));
34
50
  manifest = replaceMarker(manifest, 'queries', queriesEntries(app));
51
+ manifest = replaceMarker(manifest, 'share-target', shareTargetEntries(app));
35
52
  writeFileSync(manifestPath, manifest);
36
53
  // The template's shortcuts.xml is an empty list, which an app without
37
54
  // shortcuts keeps.
@@ -39,11 +56,315 @@ export const androidGenerator = {
39
56
  writeFileSync(path.join(dir, RESOURCES, 'xml/shortcuts.xml'), shortcutsXml(app));
40
57
  writeFileSync(path.join(dir, RESOURCES, 'values/shortcuts.xml'), shortcutStringsXml(app));
41
58
  }
59
+ // As on iOS (see iosGenerator), an app that doesn't ask for the camera
60
+ // ships no scanner: neither the module nor Google's code scanner, which
61
+ // brings Play services' libraries. MainActivity registers the module
62
+ // only when its class is there.
63
+ if (!app.permissions.camera) {
64
+ rmSync(path.join(dir, ANDROID_BARCODE_SCANNER_SOURCE), { force: true });
65
+ const buildFile = path.join(dir, APP_BUILD_FILE);
66
+ // Configuring the same copy twice finds the lines already gone.
67
+ if (readFileSync(buildFile, 'utf8').includes(BARCODE_SCANNER_MARKER)) {
68
+ removeMarkedLines(buildFile, 'barcode-scanner');
69
+ }
70
+ }
71
+ // As on iOS (see iosGenerator), an app that doesn't ask for Bluetooth
72
+ // ships no Bluetooth code. MainActivity registers the module only when
73
+ // its class is there.
74
+ if (!app.permissions.bluetooth) {
75
+ rmSync(path.join(dir, BLUETOOTH_MODULE), { force: true });
76
+ }
42
77
  writeAndroidIcon(dir, app, projectRoot);
43
78
  writeAndroidSplash(dir, app, projectRoot);
79
+ // The types ShareTargetModule checks each shared file against.
80
+ if (app.shareTarget) {
81
+ writeFileSync(path.join(dir, SHARE_TARGET_STRINGS), shareTargetStringsXml(app.shareTarget.mimeTypes));
82
+ }
83
+ // The prompt's subtitle when the app gives none, as iOS shows
84
+ // NSFaceIDUsageDescription. leaveOut deletes the file without it.
85
+ const reason = app.permissions.biometrics;
86
+ if (reason) {
87
+ writeFileSync(path.join(dir, BIOMETRICS_STRINGS), biometricsStringsXml(reason));
88
+ }
89
+ },
90
+ // The plugins' Kotlin and Java: Gradle compiles everything under
91
+ // src/main/java, whatever its package. Their resources, a resource folder
92
+ // each, which build.gradle.kts adds to the app module's. The registration
93
+ // replaces the template's, which registers nothing.
94
+ writePlugins: (dir, app, projectRoot) => {
95
+ const plugins = readNativePlugins(app.nativePlugins, projectRoot);
96
+ checkJvmPackages(plugins);
97
+ checkAndroidResources(plugins, path.join(dir, 'app'));
98
+ copyPluginSources(plugins, 'android', path.join(dir, ANDROID_PLUGIN_SOURCES));
99
+ copyPluginResources(plugins, path.join(dir, ANDROID_PLUGIN_RESOURCES));
100
+ writeFileSync(path.join(dir, SHELL_SOURCES, 'AngularLynxPlugins.kt'), androidPluginsKotlin(plugins));
101
+ },
102
+ leaveOut: (dir, features, app) => {
103
+ // The biometrics module, AndroidX Biometric and the lines that register
104
+ // it are only for an app that asks for biometrics.
105
+ if (!app.permissions.biometrics) {
106
+ removeTemplateFiles(dir, [
107
+ ...ANDROID_BIOMETRICS_SOURCES.map((file) => path.join(SHELL_SOURCES, file)),
108
+ BIOMETRICS_STRINGS,
109
+ ]);
110
+ for (const file of ANDROID_BIOMETRICS_MARKED) {
111
+ removeMarkedLines(path.join(dir, file), 'biometrics');
112
+ }
113
+ }
114
+ // The document picker is only for an app that turns it on with
115
+ // `filePicker`: the module, and MainActivity's lines that launch the
116
+ // pickers and register it.
117
+ if (!app.filePicker) {
118
+ removeTemplateFiles(dir, ANDROID_FILE_PICKER_SOURCES.map((file) => path.join(SHELL_SOURCES, file)));
119
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'file-picker');
120
+ }
121
+ // As on iOS, an app that doesn't ask for ratings in the app leaves the
122
+ // module out, with the lines that register it and Google Play's review
123
+ // library (`// angular-lynx:store-review`), so its APK carries none of
124
+ // Play's review code.
125
+ if (!app.storeReview) {
126
+ removeTemplateFiles(dir, [ANDROID_STORE_REVIEW_SOURCE]);
127
+ for (const file of ANDROID_STORE_REVIEW_MARKED) {
128
+ removeMarkedLines(path.join(dir, file), 'store-review');
129
+ }
130
+ }
131
+ // An app that doesn't add events to the calendar (angular.json's
132
+ // `calendar`) leaves out the module and MainActivity's lines that open
133
+ // the calendar app's editor for it (`// angular-lynx:calendar`).
134
+ if (!app.calendar) {
135
+ removeTemplateFiles(dir, [ANDROID_CALENDAR_SOURCE]);
136
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'calendar');
137
+ }
138
+ // An app that isn't a share target (angular.json's `shareTarget`) has
139
+ // no intent filters for it (configure writes none), and leaves out the
140
+ // module, its types and MainActivity's lines that hand it the intents
141
+ // (`// angular-lynx:share-target`).
142
+ if (!app.shareTarget) {
143
+ removeTemplateFiles(dir, [
144
+ ANDROID_SHARE_TARGET_SOURCE,
145
+ SHARE_TARGET_STRINGS,
146
+ ]);
147
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'share-target');
148
+ }
149
+ // As on iOS, an app that doesn't say why it tracks
150
+ // (`permissions.tracking`) leaves out the module, the lines that register
151
+ // it and Play's advertising ID library (`// angular-lynx:tracking`),
152
+ // which would otherwise declare AD_ID for it.
153
+ if (!app.permissions.tracking) {
154
+ removeTemplateFiles(dir, [ANDROID_TRACKING_SOURCE]);
155
+ for (const file of ANDROID_TRACKING_MARKED) {
156
+ removeMarkedLines(path.join(dir, file), 'tracking');
157
+ }
158
+ }
159
+ // As on iOS, the NFC module is only for an app that says why it reads
160
+ // tags (`permissions.nfc`, which also declares the NFC permission): the
161
+ // module and MainActivity's lines that register it
162
+ // (`// angular-lynx:nfc`).
163
+ if (!app.permissions.nfc) {
164
+ removeTemplateFiles(dir, [ANDROID_NFC_SOURCE]);
165
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'nfc');
166
+ }
167
+ // As on iOS, the recorder is only for an app that says why it uses the
168
+ // microphone (`permissions.microphone`, which also declares
169
+ // RECORD_AUDIO): the module and MainActivity's lines that register it
170
+ // (`// angular-lynx:audio-recorder`).
171
+ if (!app.permissions.microphone) {
172
+ removeTemplateFiles(dir, [ANDROID_AUDIO_RECORDER_SOURCE]);
173
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'audio-recorder');
174
+ }
175
+ // As on iOS, the geolocation module is only for an app that says why it
176
+ // finds the phone (`permissions.location`, which also declares the
177
+ // location permissions): the module and MainActivity's lines that
178
+ // register it (`// angular-lynx:geolocation`).
179
+ if (!app.permissions.location) {
180
+ removeTemplateFiles(dir, [ANDROID_GEOLOCATION_SOURCE]);
181
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'geolocation');
182
+ }
183
+ // The photo library module, and the lines that register it, are only
184
+ // for an app that asks for savePhotos.
185
+ if (!app.permissions.savePhotos) {
186
+ removeTemplateFiles(dir, ANDROID_PHOTO_LIBRARY_SOURCES.map((file) => path.join(SHELL_SOURCES, file)));
187
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'photo-library');
188
+ }
189
+ // As on iOS, an app keeps only the Wi-Fi code of the parts of `wifi` it
190
+ // turns on, and none, nor MainActivity's lines that register the module
191
+ // (`// angular-lynx:wifi`), without either.
192
+ if (!app.wifi.join && !app.wifi.readCurrentNetwork) {
193
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'wifi');
194
+ }
195
+ leaveOutWifi(dir, app.wifi, ANDROID_WIFI_SOURCE);
196
+ // As on iOS, an app that doesn't read the motion sensors leaves the
197
+ // module out, with the lines in MainActivity that register it
198
+ // (`// angular-lynx:motion`).
199
+ if (!app.motion) {
200
+ removeTemplateFiles(dir, [ANDROID_MOTION_SOURCE]);
201
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'motion');
202
+ }
203
+ // As on iOS, LynxImagePicker's camera is only for an app that says why
204
+ // it uses the camera (`permissions.camera`, which also declares CAMERA):
205
+ // the module's takePhoto, MainActivity's camera launcher
206
+ // (`// angular-lynx:image-picker-camera`), and the folder FileProvider
207
+ // shares the photo from.
208
+ if (!app.permissions.camera) {
209
+ for (const file of ANDROID_IMAGE_PICKER_CAMERA_MARKED) {
210
+ removeMarkedLines(path.join(dir, file), 'image-picker-camera');
211
+ }
212
+ const paths = path.join(dir, FILE_PROVIDER_PATHS);
213
+ writeFileSync(paths, replaceMarker(readFileSync(paths, 'utf8'), 'image-picker-camera', ''));
214
+ }
215
+ leaveOutCanvas(dir, features);
44
216
  },
45
217
  bundleDir: (dir) => path.join(dir, 'app/src/main/assets'),
46
218
  };
219
+ /**
220
+ * Takes out the canvas code the bundle doesn't use (see NativeFeatures).
221
+ */
222
+ const leaveOutCanvas = (dir, features) => {
223
+ if (features.webgl)
224
+ return;
225
+ if (features.canvas) {
226
+ // A 2D canvas keeps the module, without the WebGL2 context and the
227
+ // module's lines that make one (`// angular-lynx:webgl`).
228
+ removeTemplateFiles(dir, ANDROID_WEBGL_SOURCES.map((file) => path.join(SHELL_SOURCES, file)));
229
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'WebGLModule.kt'), 'webgl');
230
+ return;
231
+ }
232
+ removeTemplateFiles(dir, ANDROID_CANVAS_SOURCES.map((file) => path.join(SHELL_SOURCES, file)));
233
+ // The lines that register them (`// angular-lynx:canvas`).
234
+ removeMarkedLines(path.join(dir, SHELL_SOURCES, 'MainActivity.kt'), 'canvas');
235
+ };
236
+ const SHELL_SOURCES = 'app/src/main/java/dev/angularlynx/shell';
237
+ /** The module behind `LynxStoreReview`, which only `storeReview` keeps. */
238
+ export const ANDROID_STORE_REVIEW_SOURCE = `${SHELL_SOURCES}/StoreReviewModule.kt`;
239
+ /** The module behind `LynxWifi`, which only `wifi` keeps. */
240
+ export const ANDROID_WIFI_SOURCE = `${SHELL_SOURCES}/WifiModule.kt`;
241
+ /** The module behind `LynxCalendar`, which only `calendar` keeps. */
242
+ export const ANDROID_CALENDAR_SOURCE = `${SHELL_SOURCES}/CalendarModule.kt`;
243
+ /**
244
+ * The module behind `LynxAudioRecorder`, which only `permissions.microphone`
245
+ * keeps.
246
+ */
247
+ export const ANDROID_AUDIO_RECORDER_SOURCE = `${SHELL_SOURCES}/AudioRecorderModule.kt`;
248
+ /** The module behind `LynxNfc`, which only `permissions.nfc` keeps. */
249
+ export const ANDROID_NFC_SOURCE = `${SHELL_SOURCES}/NfcModule.kt`;
250
+ /**
251
+ * The files with LynxImagePicker's camera in them, between
252
+ * `// angular-lynx:image-picker-camera` markers, which only an app with
253
+ * `permissions.camera` keeps.
254
+ */
255
+ export const ANDROID_IMAGE_PICKER_CAMERA_MARKED = [
256
+ `${SHELL_SOURCES}/ImagePickerModule.kt`,
257
+ `${SHELL_SOURCES}/MainActivity.kt`,
258
+ ];
259
+ /**
260
+ * The folders FileProvider shares from: the camera's, between
261
+ * `<!-- angular-lynx:image-picker-camera -->` markers, is only in an app
262
+ * with `permissions.camera`.
263
+ */
264
+ const FILE_PROVIDER_PATHS = 'app/src/main/res/xml/share_paths.xml';
265
+ /**
266
+ * The module behind `LynxGeolocation`, which only `permissions.location`
267
+ * keeps.
268
+ */
269
+ export const ANDROID_GEOLOCATION_SOURCE = `${SHELL_SOURCES}/GeolocationModule.kt`;
270
+ /**
271
+ * The module behind `LynxTracking`, which only an app with
272
+ * `permissions.tracking` keeps.
273
+ */
274
+ export const ANDROID_TRACKING_SOURCE = `${SHELL_SOURCES}/TrackingModule.kt`;
275
+ /**
276
+ * The files with lines for the tracking module: MainActivity registers it,
277
+ * and app/build.gradle.kts adds Google Play's advertising ID library.
278
+ */
279
+ const ANDROID_TRACKING_MARKED = [
280
+ `${SHELL_SOURCES}/MainActivity.kt`,
281
+ 'app/build.gradle.kts',
282
+ ];
283
+ /**
284
+ * The files with lines for the store review module: MainActivity registers
285
+ * it, and app/build.gradle.kts adds Google Play's review library.
286
+ */
287
+ const ANDROID_STORE_REVIEW_MARKED = [
288
+ `${SHELL_SOURCES}/MainActivity.kt`,
289
+ 'app/build.gradle.kts',
290
+ ];
291
+ /** The module behind `LynxMotion`, which only `motion` keeps. */
292
+ export const ANDROID_MOTION_SOURCE = `${SHELL_SOURCES}/MotionModule.kt`;
293
+ /**
294
+ * The shell's biometrics module, `AngularLynxBiometrics` (LynxBiometrics, and
295
+ * the values LynxSecureStorage keeps behind a fingerprint or a face), which
296
+ * only an app with `permissions.biometrics` keeps.
297
+ */
298
+ export const ANDROID_BIOMETRICS_SOURCES = ['BiometricsModule.kt'];
299
+ /**
300
+ * The shell's file picker module, `AngularLynxFilePicker` (LynxFilePicker),
301
+ * which only an app with `filePicker` keeps.
302
+ */
303
+ export const ANDROID_FILE_PICKER_SOURCES = ['FilePickerModule.kt'];
304
+ /**
305
+ * The shell's photo library module, `AngularLynxPhotoLibrary`
306
+ * (LynxPhotoLibrary), which only an app with `permissions.savePhotos` keeps.
307
+ */
308
+ export const ANDROID_PHOTO_LIBRARY_SOURCES = ['PhotoLibraryModule.kt'];
309
+ /** The prompt's default reason, from `permissions.biometrics`. */
310
+ const BIOMETRICS_STRINGS = `${RESOURCES}/values/biometrics.xml`;
311
+ /**
312
+ * The files whose lines between `// angular-lynx:biometrics` markers name
313
+ * the module or AndroidX Biometric: MainActivity's registration and the
314
+ * Gradle dependency.
315
+ */
316
+ const ANDROID_BIOMETRICS_MARKED = [
317
+ 'app/build.gradle.kts',
318
+ `${SHELL_SOURCES}/MainActivity.kt`,
319
+ ];
320
+ /**
321
+ * res/values/biometrics.xml: the reason a biometric prompt shows when the
322
+ * app gives none, angular.json's `permissions.biometrics`.
323
+ */
324
+ export const biometricsStringsXml = (reason) => [
325
+ '<?xml version="1.0" encoding="utf-8"?>',
326
+ "<!-- Written from angular.json's permissions.biometrics on every build. -->",
327
+ '<resources>',
328
+ ` <string name="angular_lynx_biometrics_reason">${stringResource(reason)}</string>`,
329
+ '</resources>',
330
+ '',
331
+ ].join('\n');
332
+ /** Where the plugins' Kotlin and Java go, a folder per plugin. */
333
+ export const ANDROID_PLUGIN_SOURCES = 'app/src/main/java/plugins';
334
+ /**
335
+ * Where the plugins' Android resources go, a resource folder per plugin,
336
+ * which the template's build.gradle.kts adds to the app module's.
337
+ */
338
+ export const ANDROID_PLUGIN_RESOURCES = 'app/src/main/plugin-res';
339
+ /**
340
+ * The shell's `<canvas>`, its `AngularLynxWebGL` module and its contexts, and
341
+ * `<video>`'s readable frames, which only MainActivity's marked lines reach.
342
+ * R8 can't drop them while those lines register them, so they go with the
343
+ * lines.
344
+ */
345
+ export const ANDROID_CANVAS_SOURCES = [
346
+ 'BitmapPresenter.kt',
347
+ 'BitmapRendererContext.kt',
348
+ 'Canvas2DContext.kt',
349
+ 'Canvas2DOps.kt',
350
+ 'CanvasFilter.kt',
351
+ 'CanvasUI.kt',
352
+ 'VideoFrameTarget.kt',
353
+ 'VideoUI.kt',
354
+ 'WebGLContext.kt',
355
+ 'WebGLModule.kt',
356
+ 'WebGLOps.kt',
357
+ ];
358
+ /**
359
+ * The WebGL2 context, which an app that draws only in 2D leaves out, and
360
+ * `WebGLModule.kt`'s lines that make one (issue #847). `VideoFrameTarget.kt`
361
+ * reads a video's frames with an EGL context of its own, for the 2D
362
+ * context's `drawImage()` too, so it stays.
363
+ */
364
+ export const ANDROID_WEBGL_SOURCES = [
365
+ 'WebGLContext.kt',
366
+ 'WebGLOps.kt',
367
+ ];
47
368
  /**
48
369
  * Escapes a value for a Java properties file. `Properties.load` reads the
49
370
  * file as ISO-8859-1, so anything outside ASCII (an app named "Café" or
@@ -63,19 +384,92 @@ export const properties = (app) => [
63
384
  `appName=${propertyValue(app.name)}`,
64
385
  `screenOrientation=${SCREEN_ORIENTATIONS[app.orientation]}`,
65
386
  `edgeToEdge=${app.edgeToEdge}`,
387
+ // MainActivity's font scale: the system's, capped at the max (0 for
388
+ // none), or 1 when it's off.
389
+ `textScaling=${app.textScaling.enabled}`,
390
+ `maxTextScale=${app.textScaling.max ?? 0}`,
66
391
  '',
67
392
  ].join('\n');
393
+ /**
394
+ * The manifest permissions `LynxWifi`'s parts need, all granted at install:
395
+ * reading the network (`WifiManager.getConnectionInfo`, with the location
396
+ * permission `permissions.location` adds) and joining one
397
+ * (`WifiNetworkSuggestion`, and `ConnectivityManager.requestNetwork` for a
398
+ * `WifiNetworkSpecifier`). Both need `ACCESS_NETWORK_STATE` too, which the
399
+ * manifest template declares for every app, since `LynxNetwork` needs it.
400
+ */
401
+ const wifiPermissions = (app) => [
402
+ ...(app.wifi.readCurrentNetwork
403
+ ? ['android.permission.ACCESS_WIFI_STATE']
404
+ : []),
405
+ ...(app.wifi.join
406
+ ? [
407
+ 'android.permission.ACCESS_WIFI_STATE',
408
+ 'android.permission.CHANGE_WIFI_STATE',
409
+ 'android.permission.CHANGE_NETWORK_STATE',
410
+ ]
411
+ : []),
412
+ ];
68
413
  export const permissionEntries = (app) => {
69
414
  const entries = Object.keys(app.permissions).map((permission) => PERMISSION_MAP[permission]);
70
- const permissions = [...new Set(entries.flatMap((entry) => entry.android))];
71
415
  const features = [
72
- ...new Set(entries.flatMap((entry) => entry.androidFeatures ?? [])),
416
+ ...new Set([
417
+ ...entries.flatMap((entry) => entry.androidFeatures ?? []),
418
+ ...(app.wifi.join || app.wifi.readCurrentNetwork
419
+ ? ['android.hardware.wifi']
420
+ : []),
421
+ ]),
73
422
  ];
74
423
  return [
75
- ...permissions.map((name) => `<uses-permission android:name="${escapeXml(name)}" />`),
424
+ ...usesPermissions([
425
+ ...entries.flatMap((entry) => entry.android),
426
+ ...wifiPermissions(app),
427
+ ]),
76
428
  ...features.map((name) => `<uses-feature android:name="${escapeXml(name)}" android:required="false" />`),
77
429
  ].join('\n');
78
430
  };
431
+ /**
432
+ * One `<uses-permission>` for each name, in the order the names first come.
433
+ * Two of the app's permissions can need the same Android one: `bluetooth`
434
+ * needs fine location to scan on old Android versions only, and `location`
435
+ * needs it on every version. The one element has to give each what it needs,
436
+ * so it keeps an attribute only when every declaration has it: the highest
437
+ * `maxSdkVersion`, and only the `usesPermissionFlags` they all promise.
438
+ *
439
+ * `usesPermissionFlags` came in Android 12 (codename S), which the app's
440
+ * minSdk predates. Older versions ignore it, and `tools:targetApi` tells
441
+ * Android lint that's intended.
442
+ */
443
+ export const usesPermissions = (permissions) => {
444
+ const declarations = new Map();
445
+ for (const permission of permissions) {
446
+ const declaration = typeof permission === 'string' ? { name: permission } : permission;
447
+ declarations.set(declaration.name, [
448
+ ...(declarations.get(declaration.name) ?? []),
449
+ declaration,
450
+ ]);
451
+ }
452
+ return [...declarations].map(([name, all]) => {
453
+ const maxSdkVersions = all.map((each) => each.maxSdkVersion);
454
+ const flags = all
455
+ .map((each) => each.usesPermissionFlags?.split('|') ?? [])
456
+ .reduce((common, each) => common.filter((flag) => each.includes(flag)));
457
+ return [
458
+ '<uses-permission',
459
+ `android:name="${escapeXml(name)}"`,
460
+ ...(maxSdkVersions.every((version) => version !== undefined)
461
+ ? [`android:maxSdkVersion="${Math.max(...maxSdkVersions)}"`]
462
+ : []),
463
+ ...(flags.length > 0
464
+ ? [
465
+ `android:usesPermissionFlags="${escapeXml(flags.join('|'))}"`,
466
+ 'tools:targetApi="s"',
467
+ ]
468
+ : []),
469
+ '/>',
470
+ ].join(' ');
471
+ });
472
+ };
79
473
  /**
80
474
  * The intent filters for the links that open the app: one for the
81
475
  * `deepLinkSchemes`, and one for https links to the `appLinkDomains`.
@@ -106,6 +500,47 @@ export const deepLinkEntries = (app) => [
106
500
  '</intent-filter>',
107
501
  ]),
108
502
  ].join('\n');
503
+ /** The module behind `LynxShareTarget`, which only `shareTarget` keeps. */
504
+ export const ANDROID_SHARE_TARGET_SOURCE = `${SHELL_SOURCES}/ShareTargetModule.kt`;
505
+ /** `shareTarget.mimeTypes`, which ShareTargetModule reads. */
506
+ const SHARE_TARGET_STRINGS = 'app/src/main/res/values/share_target.xml';
507
+ /**
508
+ * The intent filters that put the app in other apps' share sheets for
509
+ * `shareTarget.mimeTypes`: one for a share of one thing (`ACTION_SEND`) and
510
+ * one for several (`ACTION_SEND_MULTIPLE`), each with every type.
511
+ *
512
+ * Android shares a link as text: Chrome sends a page's URL as `text/plain`,
513
+ * and few apps send `text/uri-list`. So `text/uri-list` keeps its own type
514
+ * and also takes `text/plain`, and ShareTargetModule hands the app only the shares whose
515
+ * text is one link when `text/plain` itself isn't listed.
516
+ */
517
+ export const shareTargetEntries = (app) => {
518
+ if (!app.shareTarget)
519
+ return '';
520
+ const types = [
521
+ ...new Set(app.shareTarget.mimeTypes.flatMap((type) => type === 'text/uri-list' ? ['text/uri-list', 'text/plain'] : [type])),
522
+ ];
523
+ return ['SEND', 'SEND_MULTIPLE']
524
+ .flatMap((action) => [
525
+ '<intent-filter>',
526
+ ` <action android:name="android.intent.action.${action}" />`,
527
+ ' <category android:name="android.intent.category.DEFAULT" />',
528
+ ...types.map((type) => ` <data android:mimeType="${escapeXml(type)}" />`),
529
+ '</intent-filter>',
530
+ ])
531
+ .join('\n');
532
+ };
533
+ /** res/values/share_target.xml: the types the app takes, for ShareTargetModule. */
534
+ export const shareTargetStringsXml = (mimeTypes) => [
535
+ '<?xml version="1.0" encoding="utf-8"?>',
536
+ '<!-- Written by @blotch/angular-lynx-native from shareTarget in angular.json. -->',
537
+ '<resources>',
538
+ ' <string-array name="angular_lynx_share_mime_types" translatable="false">',
539
+ ...mimeTypes.map((type) => ` <item>${escapeXml(type)}</item>`),
540
+ ' </string-array>',
541
+ '</resources>',
542
+ '',
543
+ ].join('\n');
109
544
  /** What an intent filter for links a browser can follow opens on. */
110
545
  const VIEW_INTENT = [
111
546
  ' <action android:name="android.intent.action.VIEW" />',
package/dist/eject.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { type NativeFeatures } from './features.ts';
1
2
  import { type Platform } from './generate.ts';
2
3
  import { type NativeAppOptions } from './options.ts';
3
4
  /**
@@ -5,8 +6,16 @@ import { type NativeAppOptions } from './options.ts';
5
6
  * `ng generate @blotch/angular-lynx:eject`: the same project the builder
6
7
  * generates, plus the marker that tells the builder to build it as it is.
7
8
  * Returns its files (relative path → contents), for the schematic to write.
9
+ *
10
+ * It keeps all the shells' optional native code unless `features` says
11
+ * otherwise. The builder never leaves anything out of an ejected project
12
+ * (it's built as it is), so the schematic passes none: the project is the
13
+ * user's to grow, and a canvas added later has to draw. A script that renders
14
+ * a project only to build it, as the benchmark's ReactLynx iOS app does
15
+ * (issue #858), passes what its bundle uses, so the shell leaves out what a
16
+ * generated one would.
8
17
  */
9
- export declare const renderEjectedProject: ({ platform, projectRoot, projectName, packageVersion, app, generatorVersion, }: {
18
+ export declare const renderEjectedProject: ({ platform, projectRoot, projectName, packageVersion, app, generatorVersion, features, }: {
10
19
  readonly platform: Platform;
11
20
  readonly projectRoot: string;
12
21
  readonly projectName: string;
@@ -14,5 +23,10 @@ export declare const renderEjectedProject: ({ platform, projectRoot, projectName
14
23
  readonly app: NativeAppOptions;
15
24
  /** This package's version, recorded in the marker for later upgrades. */
16
25
  readonly generatorVersion: string;
26
+ /**
27
+ * The optional native code to keep, as readNativeFeatures reads it from a
28
+ * bundle. Everything by default.
29
+ */
30
+ readonly features?: NativeFeatures;
17
31
  }) => Map<string, Buffer>;
18
32
  //# sourceMappingURL=eject.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"eject.d.ts","sourceRoot":"","sources":["../src/eject.ts"],"names":[],"mappings":"AAYA,OAAO,EAAgB,KAAK,QAAQ,EAAiB,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AA+BxE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,gFAOlC;IACD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC,KAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CA8BrB,CAAC"}
1
+ {"version":3,"file":"eject.d.ts","sourceRoot":"","sources":["../src/eject.ts"],"names":[],"mappings":"AAYA,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAgB,KAAK,QAAQ,EAAiB,MAAM,eAAe,CAAC;AAE3E,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AA+BxE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,oBAAoB,GAAI,0FAQlC;IACD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,gBAAgB,CAAC;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;CACpC,KAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CA6BrB,CAAC"}
package/dist/eject.js CHANGED
@@ -2,6 +2,7 @@ import { cpSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync,
2
2
  import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { androidGenerator } from "./android/project.js";
5
+ import { ALL_NATIVE_FEATURES } from "./features.js";
5
6
  import { EJECT_MARKER, TEMPLATES_DIR } from "./generate.js";
6
7
  import { iosGenerator } from "./ios/project.js";
7
8
  import { resolveAppOptions } from "./options.js";
@@ -38,13 +39,24 @@ const GITIGNORE = {
38
39
  * `ng generate @blotch/angular-lynx:eject`: the same project the builder
39
40
  * generates, plus the marker that tells the builder to build it as it is.
40
41
  * Returns its files (relative path → contents), for the schematic to write.
42
+ *
43
+ * It keeps all the shells' optional native code unless `features` says
44
+ * otherwise. The builder never leaves anything out of an ejected project
45
+ * (it's built as it is), so the schematic passes none: the project is the
46
+ * user's to grow, and a canvas added later has to draw. A script that renders
47
+ * a project only to build it, as the benchmark's ReactLynx iOS app does
48
+ * (issue #858), passes what its bundle uses, so the shell leaves out what a
49
+ * generated one would.
41
50
  */
42
- export const renderEjectedProject = ({ platform, projectRoot, projectName, packageVersion, app, generatorVersion, }) => {
51
+ export const renderEjectedProject = ({ platform, projectRoot, projectName, packageVersion, app, generatorVersion, features = ALL_NATIVE_FEATURES, }) => {
43
52
  const resolved = resolveAppOptions(app, { projectName, packageVersion });
44
53
  const dir = mkdtempSync(path.join(os.tmpdir(), `angular-lynx-eject-`));
45
54
  try {
46
55
  cpSync(path.join(TEMPLATES_DIR, platform), dir, { recursive: true });
47
- (platform === 'ios' ? iosGenerator : androidGenerator).configure(dir, resolved, projectRoot);
56
+ const generator = platform === 'ios' ? iosGenerator : androidGenerator;
57
+ generator.configure(dir, resolved, projectRoot);
58
+ generator.leaveOut(dir, features, resolved);
59
+ generator.writePlugins(dir, resolved, projectRoot);
48
60
  writeFileSync(path.join(dir, '.gitignore'), GITIGNORE[platform]);
49
61
  writeFileSync(path.join(dir, EJECT_MARKER), [
50
62
  `Ejected from @blotch/angular-lynx-native ${generatorVersion}.`,
@@ -0,0 +1,70 @@
1
+ /**
2
+ * The file the build plugin writes beside the Lynx bundle
3
+ * (`@blotch/rsbuild-plugin-angular-lynx`'s native-features.ts, under the
4
+ * same name): which of the shells' optional native code the app needs, from
5
+ * what its main-thread modules name. The leading dot keeps copyBundle from
6
+ * copying it into the app.
7
+ */
8
+ export declare const NATIVE_FEATURES_FILE = ".angular-lynx-native.json";
9
+ /**
10
+ * The shells' optional native code. `canvas` is `<canvas>` and its
11
+ * `AngularLynxWebGL` module (the WebGL2, 2D and `bitmaprenderer` contexts,
12
+ * and the decoding behind `Image` and `createImageBitmap()`), `<video>`'s
13
+ * frames a canvas reads, and on iOS ANGLE, which WebGL draws with. Without
14
+ * it, an app's iOS executable is about 176 kB smaller and it embeds no ANGLE
15
+ * frameworks, about 6 MB (issue #837).
16
+ *
17
+ * `webgl` is the part of it only the WebGL2 context uses: the context itself
18
+ * (`AngularLynxWebGLContext.m`, `WebGLContext.kt`), its command numbers and,
19
+ * on iOS, ANGLE. An app that draws only in 2D (a chart, a signature pad, an
20
+ * image editor) keeps the canvas without it, since the 2D context draws with
21
+ * Core Graphics and `android.graphics.Canvas` (issue #847). It's never true
22
+ * without `canvas`.
23
+ */
24
+ export type NativeFeatures = {
25
+ readonly canvas: boolean;
26
+ readonly webgl: boolean;
27
+ };
28
+ /** Everything: what an app gets when nothing says what it needs. */
29
+ export declare const ALL_NATIVE_FEATURES: NativeFeatures;
30
+ /**
31
+ * What the bundle in `bundleDir` needs, from NATIVE_FEATURES_FILE.
32
+ *
33
+ * Everything when there's no bundle (`ng serve --platform`'s development
34
+ * app, which loads its bundle from the dev server and gets every edit, so a
35
+ * canvas added while it runs has to draw), or no file or one this version
36
+ * can't read (a bundle from an older plugin or another build): leaving out
37
+ * code the app uses would leave it a blank canvas, while keeping what it
38
+ * doesn't use only costs size. For the same reason a file with
39
+ * `"canvas": true` and no `webgl`, from a plugin before #847, keeps WebGL.
40
+ *
41
+ * @param bundleDir - The rspeedy output folder, or undefined for the
42
+ * development app.
43
+ */
44
+ export declare const readNativeFeatures: (bundleDir: string | undefined) => NativeFeatures;
45
+ /**
46
+ * Deletes `files` (relative to `dir`), each of which must be in the
47
+ * template: a renamed file would otherwise stay in every app unnoticed.
48
+ */
49
+ export declare const removeTemplateFiles: (dir: string, files: readonly string[]) => void;
50
+ /**
51
+ * Takes out of a source file the lines between `// angular-lynx:<name>` and
52
+ * `// /angular-lynx:<name>`, the markers with them, wherever they are. The
53
+ * templates mark the few lines that use optional code, so the project still
54
+ * builds once it's gone.
55
+ */
56
+ export declare const removeMarkedLines: (file: string, name: string) => void;
57
+ /**
58
+ * Takes out of the Wi-Fi module (`source`, the Swift or Kotlin file) what
59
+ * angular.json's `wifi` doesn't turn on: the whole file without either part,
60
+ * or the lines of the part that's off, between `// angular-lynx:wifi-read`
61
+ * (currentNetwork, and the location code behind it) or
62
+ * `// angular-lynx:wifi-join` (join and leave) markers. Each module's
63
+ * `methodLookup` or `@LynxMethod`s are in those lines too, so the runtime
64
+ * rejects a part that's off with `unavailable`.
65
+ */
66
+ export declare const leaveOutWifi: (dir: string, wifi: {
67
+ readonly join: boolean;
68
+ readonly readCurrentNetwork: boolean;
69
+ }, source: string) => void;
70
+ //# sourceMappingURL=features.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../src/features.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,EAAE,cAGjC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,MAAM,GAAG,SAAS,KAC5B,cAoBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,KAAK,MAAM,EACX,OAAO,SAAS,MAAM,EAAE,KACvB,IAQF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,IAwB9D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,MAAM;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;CAAE,EACtE,QAAQ,MAAM,KACb,IASF,CAAC"}