@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
@@ -0,0 +1,115 @@
1
+ import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ /**
4
+ * The file the build plugin writes beside the Lynx bundle
5
+ * (`@blotch/rsbuild-plugin-angular-lynx`'s native-features.ts, under the
6
+ * same name): which of the shells' optional native code the app needs, from
7
+ * what its main-thread modules name. The leading dot keeps copyBundle from
8
+ * copying it into the app.
9
+ */
10
+ export const NATIVE_FEATURES_FILE = '.angular-lynx-native.json';
11
+ /** Everything: what an app gets when nothing says what it needs. */
12
+ export const ALL_NATIVE_FEATURES = {
13
+ canvas: true,
14
+ webgl: true,
15
+ };
16
+ /**
17
+ * What the bundle in `bundleDir` needs, from NATIVE_FEATURES_FILE.
18
+ *
19
+ * Everything when there's no bundle (`ng serve --platform`'s development
20
+ * app, which loads its bundle from the dev server and gets every edit, so a
21
+ * canvas added while it runs has to draw), or no file or one this version
22
+ * can't read (a bundle from an older plugin or another build): leaving out
23
+ * code the app uses would leave it a blank canvas, while keeping what it
24
+ * doesn't use only costs size. For the same reason a file with
25
+ * `"canvas": true` and no `webgl`, from a plugin before #847, keeps WebGL.
26
+ *
27
+ * @param bundleDir - The rspeedy output folder, or undefined for the
28
+ * development app.
29
+ */
30
+ export const readNativeFeatures = (bundleDir) => {
31
+ if (!bundleDir)
32
+ return ALL_NATIVE_FEATURES;
33
+ const file = path.join(bundleDir, NATIVE_FEATURES_FILE);
34
+ if (!existsSync(file))
35
+ return ALL_NATIVE_FEATURES;
36
+ try {
37
+ const features = JSON.parse(readFileSync(file, 'utf8'));
38
+ if (typeof features === 'object' && features !== null) {
39
+ const { canvas, webgl } = features;
40
+ if (canvas === false)
41
+ return { canvas: false, webgl: false };
42
+ if (canvas === true && webgl === false) {
43
+ return { canvas: true, webgl: false };
44
+ }
45
+ }
46
+ }
47
+ catch {
48
+ // An unreadable file says nothing, so the app gets everything.
49
+ }
50
+ return ALL_NATIVE_FEATURES;
51
+ };
52
+ /**
53
+ * Deletes `files` (relative to `dir`), each of which must be in the
54
+ * template: a renamed file would otherwise stay in every app unnoticed.
55
+ */
56
+ export const removeTemplateFiles = (dir, files) => {
57
+ for (const file of files) {
58
+ const absolute = path.join(dir, file);
59
+ if (!existsSync(absolute)) {
60
+ throw new Error(`The template has no ${file} to leave out.`);
61
+ }
62
+ rmSync(absolute);
63
+ }
64
+ };
65
+ /**
66
+ * Takes out of a source file the lines between `// angular-lynx:<name>` and
67
+ * `// /angular-lynx:<name>`, the markers with them, wherever they are. The
68
+ * templates mark the few lines that use optional code, so the project still
69
+ * builds once it's gone.
70
+ */
71
+ export const removeMarkedLines = (file, name) => {
72
+ const lines = readFileSync(file, 'utf8').split('\n');
73
+ const open = `// angular-lynx:${name}`;
74
+ const close = `// /angular-lynx:${name}`;
75
+ const kept = [];
76
+ let inside = false;
77
+ let blocks = 0;
78
+ for (const line of lines) {
79
+ const marker = line.trim();
80
+ if (marker === open && !inside) {
81
+ inside = true;
82
+ blocks++;
83
+ }
84
+ else if (marker === close && inside) {
85
+ inside = false;
86
+ }
87
+ else if (!inside) {
88
+ kept.push(line);
89
+ }
90
+ }
91
+ if (inside || blocks === 0) {
92
+ throw new Error(`${file} has no complete ${open} … ${close} block to take out.`);
93
+ }
94
+ writeFileSync(file, kept.join('\n'));
95
+ };
96
+ /**
97
+ * Takes out of the Wi-Fi module (`source`, the Swift or Kotlin file) what
98
+ * angular.json's `wifi` doesn't turn on: the whole file without either part,
99
+ * or the lines of the part that's off, between `// angular-lynx:wifi-read`
100
+ * (currentNetwork, and the location code behind it) or
101
+ * `// angular-lynx:wifi-join` (join and leave) markers. Each module's
102
+ * `methodLookup` or `@LynxMethod`s are in those lines too, so the runtime
103
+ * rejects a part that's off with `unavailable`.
104
+ */
105
+ export const leaveOutWifi = (dir, wifi, source) => {
106
+ if (!wifi.join && !wifi.readCurrentNetwork) {
107
+ removeTemplateFiles(dir, [source]);
108
+ return;
109
+ }
110
+ if (!wifi.readCurrentNetwork) {
111
+ removeMarkedLines(path.join(dir, source), 'wifi-read');
112
+ }
113
+ if (!wifi.join)
114
+ removeMarkedLines(path.join(dir, source), 'wifi-join');
115
+ };
@@ -0,0 +1,24 @@
1
+ /** A file found by {@link listFiles}. */
2
+ export type ListedFile = {
3
+ /** Its path under the listed folder, with `/` between the parts. */
4
+ readonly relative: string;
5
+ readonly absolute: string;
6
+ /** Whether it's a folder, which only `folders` lists. */
7
+ readonly folder?: true;
8
+ };
9
+ /**
10
+ * Every file under `dir`, sorted by name, so a hash of them doesn't depend
11
+ * on the file system's order. A symbolic link is followed, so a linked folder
12
+ * is listed as the folder it points at rather than read as a file, and two
13
+ * links to one folder list it twice.
14
+ *
15
+ * @param dir - The folder to list.
16
+ * @param options - Whether to list each folder too, before its files, so
17
+ * an empty one counts.
18
+ * @throws NativeConfigError for a link to a folder it is in, whose files
19
+ * would never end.
20
+ */
21
+ export declare const listFiles: (dir: string, { folders }?: {
22
+ readonly folders?: boolean;
23
+ }) => ListedFile[];
24
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.ts"],"names":[],"mappings":"AAKA,yCAAyC;AACzC,MAAM,MAAM,UAAU,GAAG;IACvB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,EACX,cAAqB;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,KACvD,UAAU,EAiCZ,CAAC"}
package/dist/files.js ADDED
@@ -0,0 +1,41 @@
1
+ import { readdirSync, realpathSync, statSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { NativeConfigError } from "./options.js";
4
+ /**
5
+ * Every file under `dir`, sorted by name, so a hash of them doesn't depend
6
+ * on the file system's order. A symbolic link is followed, so a linked folder
7
+ * is listed as the folder it points at rather than read as a file, and two
8
+ * links to one folder list it twice.
9
+ *
10
+ * @param dir - The folder to list.
11
+ * @param options - Whether to list each folder too, before its files, so
12
+ * an empty one counts.
13
+ * @throws NativeConfigError for a link to a folder it is in, whose files
14
+ * would never end.
15
+ */
16
+ export const listFiles = (dir, { folders = false } = {}) => {
17
+ const list = (folder, prefix,
18
+ // The real path of each folder from `dir` down to this one, to the path
19
+ // it was listed by.
20
+ around) => readdirSync(folder, { withFileTypes: true })
21
+ .sort((a, b) => a.name.localeCompare(b.name))
22
+ .flatMap((entry) => {
23
+ const relative = path.posix.join(prefix, entry.name);
24
+ const absolute = path.join(folder, entry.name);
25
+ if (entry.isSymbolicLink()
26
+ ? !statSync(absolute).isDirectory()
27
+ : !entry.isDirectory()) {
28
+ return [{ relative, absolute }];
29
+ }
30
+ const real = realpathSync(absolute);
31
+ const loop = around.get(real);
32
+ if (loop !== undefined) {
33
+ throw new NativeConfigError(`${relative} in ${dir} links to a folder it is in, ${loop}, so its files would never end. Link to a folder outside it.`);
34
+ }
35
+ return [
36
+ ...(folders ? [{ relative, absolute, folder: true }] : []),
37
+ ...list(absolute, relative, new Map([...around, [real, absolute]])),
38
+ ];
39
+ });
40
+ return list(dir, '', new Map([[realpathSync(dir), dir]]));
41
+ };
@@ -1,3 +1,4 @@
1
+ import { type NativeFeatures } from './features.ts';
1
2
  import { type ResolvedApp } from './options.ts';
2
3
  export type Platform = 'ios' | 'android';
3
4
  /** The shell templates shipped in this package. */
@@ -15,6 +16,23 @@ export type PlatformGenerator = {
15
16
  * true for `ng serve --platform`'s development app.
16
17
  */
17
18
  readonly configure: (dir: string, app: ResolvedApp, projectRoot: string, development?: boolean) => void;
19
+ /**
20
+ * Takes the shells' optional native code the app doesn't use out of the
21
+ * fresh copy, after `configure`: what the bundle doesn't name
22
+ * (`features`), and the modules for permissions the app doesn't ask for
23
+ * (`app`), such as biometrics. Eject keeps every feature unless its caller
24
+ * says otherwise (renderEjectedProject's `features`): an ejected project is
25
+ * the user's to grow.
26
+ */
27
+ readonly leaveOut: (dir: string, features: NativeFeatures, app: ResolvedApp) => void;
28
+ /**
29
+ * Copies the app's native plugins (`nativePlugins`) into the project and
30
+ * writes their registration, replacing what an earlier call wrote. It
31
+ * comes after `leaveOut`, so a plugin is checked against the shell's
32
+ * sources the app keeps, and prepareProject calls it alone when only a
33
+ * plugin's files changed.
34
+ */
35
+ readonly writePlugins: (dir: string, app: ResolvedApp, projectRoot: string) => void;
18
36
  /** Where the Lynx bundle and its assets go inside the native project. */
19
37
  readonly bundleDir: (dir: string) => string;
20
38
  };
@@ -25,6 +43,11 @@ export type PreparedProject = {
25
43
  readonly ejected: boolean;
26
44
  /** False when the cached project matched the inputs and was reused. */
27
45
  readonly regenerated: boolean;
46
+ /**
47
+ * True when the cached project was reused with its plugins written again,
48
+ * because only a plugin's files changed.
49
+ */
50
+ readonly pluginsUpdated?: boolean;
28
51
  /**
29
52
  * The hash of the generated project's inputs, or undefined for an ejected
30
53
  * project, whose inputs are the user's own files.
@@ -37,8 +60,10 @@ export type PreparedProject = {
37
60
  *
38
61
  * Generation is skipped when a hash of every input (this package's version,
39
62
  * the template files, the app options and the icon and splash images) matches the last run, so
40
- * Xcode and Gradle keep their incremental state between builds. The bundle is
41
- * copied in on every build, because it changes on every build.
63
+ * Xcode and Gradle keep their incremental state between builds. When only a
64
+ * native plugin's files changed, the project is kept and its plugins written
65
+ * again. The bundle is copied in on every build, because it changes on every
66
+ * build.
42
67
  *
43
68
  * `ng serve --platform`'s development app is generated in a folder of its
44
69
  * own, `<workDir>/<platform>-dev`, so it and `ng build --platform`'s app each
@@ -46,7 +71,7 @@ export type PreparedProject = {
46
71
  * the other. It gets no bundle (`bundleDir` undefined): it loads the bundle
47
72
  * from the dev server.
48
73
  */
49
- export declare const prepareProject: ({ platform, generator, projectRoot, workDir, app, bundleDir, packageVersion, development, }: {
74
+ export declare const prepareProject: ({ platform, generator, projectRoot, workDir, app, bundleDir, packageVersion, development, features, }: {
50
75
  readonly platform: Platform;
51
76
  readonly generator: PlatformGenerator;
52
77
  readonly projectRoot: string;
@@ -61,6 +86,12 @@ export declare const prepareProject: ({ platform, generator, projectRoot, workDi
61
86
  readonly packageVersion: string;
62
87
  /** The development app `ng serve --platform` runs. */
63
88
  readonly development?: boolean;
89
+ /**
90
+ * The optional native code the app uses (readNativeFeatures), which is in
91
+ * the hash: an app that starts drawing on a canvas regenerates its project
92
+ * with the canvas code back in.
93
+ */
94
+ readonly features?: NativeFeatures;
64
95
  }) => PreparedProject;
65
96
  /**
66
97
  * Up to 22.2.2, native builds worked in `.angular-lynx/` at the project root.
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAaA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;AAEzC,mDAAmD;AACnD,eAAO,MAAM,aAAa,QAEzB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,0BAA0B,CAAC;AAIpD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,CAClB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,OAAO,KAClB,IAAI,CAAC;IACV,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,mCAAmC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EA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AAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,sDAAsD;IACtD,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC;CACpC,KAAG,eA2DH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,MAAM,EACnB,KAAK,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAC7B,IAUF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,KAAG,IAqBrD,CAAC"}
package/dist/generate.js CHANGED
@@ -2,7 +2,10 @@ import { createHash } from 'node:crypto';
2
2
  import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
+ import { ALL_NATIVE_FEATURES } from "./features.js";
5
6
  import { ICON_BACKGROUND_COLOR } from "./options.js";
7
+ import { listFiles } from "./files.js";
8
+ import { pluginInputFiles, readNativePlugins } from "./plugins.js";
6
9
  /** The shell templates shipped in this package. */
7
10
  export const TEMPLATES_DIR = fileURLToPath(new URL('../templates/', import.meta.url));
8
11
  /**
@@ -13,14 +16,17 @@ export const TEMPLATES_DIR = fileURLToPath(new URL('../templates/', import.meta.
13
16
  */
14
17
  export const EJECT_MARKER = '.angular-lynx-ejected';
15
18
  const HASH_FILE = '.angular-lynx-hash';
19
+ const PLUGINS_HASH_FILE = '.angular-lynx-plugins-hash';
16
20
  /**
17
21
  * Makes the native project for a platform ready to build: the generated one in
18
22
  * `<workDir>/<platform>`, or the user's ejected folder.
19
23
  *
20
24
  * Generation is skipped when a hash of every input (this package's version,
21
25
  * the template files, the app options and the icon and splash images) matches the last run, so
22
- * Xcode and Gradle keep their incremental state between builds. The bundle is
23
- * copied in on every build, because it changes on every build.
26
+ * Xcode and Gradle keep their incremental state between builds. When only a
27
+ * native plugin's files changed, the project is kept and its plugins written
28
+ * again. The bundle is copied in on every build, because it changes on every
29
+ * build.
24
30
  *
25
31
  * `ng serve --platform`'s development app is generated in a folder of its
26
32
  * own, `<workDir>/<platform>-dev`, so it and `ng build --platform`'s app each
@@ -28,7 +34,7 @@ const HASH_FILE = '.angular-lynx-hash';
28
34
  * the other. It gets no bundle (`bundleDir` undefined): it loads the bundle
29
35
  * from the dev server.
30
36
  */
31
- export const prepareProject = ({ platform, generator, projectRoot, workDir, app, bundleDir, packageVersion, development = false, }) => {
37
+ export const prepareProject = ({ platform, generator, projectRoot, workDir, app, bundleDir, packageVersion, development = false, features = ALL_NATIVE_FEATURES, }) => {
32
38
  const ejectedDir = path.join(projectRoot, platform);
33
39
  if (existsSync(path.join(ejectedDir, EJECT_MARKER))) {
34
40
  if (bundleDir)
@@ -36,23 +42,54 @@ export const prepareProject = ({ platform, generator, projectRoot, workDir, app,
36
42
  return { dir: ejectedDir, ejected: true, regenerated: false };
37
43
  }
38
44
  const dir = path.join(workDir, development ? `${platform}-dev` : platform);
39
- const hash = inputHash({ platform, app, projectRoot, packageVersion });
45
+ // Before anything is generated, so a broken nativePlugins entry leaves the
46
+ // last project as it was.
47
+ readNativePlugins(app.nativePlugins, projectRoot);
48
+ const projectHash = inputHash({
49
+ platform,
50
+ app,
51
+ projectRoot,
52
+ packageVersion,
53
+ features,
54
+ });
55
+ const plugins = pluginsHash(app, projectRoot);
40
56
  const hashFile = path.join(dir, HASH_FILE);
41
- const upToDate = existsSync(hashFile) && readFileSync(hashFile, 'utf8') === hash;
57
+ const pluginsHashFile = path.join(dir, PLUGINS_HASH_FILE);
58
+ const upToDate = existsSync(hashFile) && readFileSync(hashFile, 'utf8') === projectHash;
59
+ const pluginsUpToDate = upToDate &&
60
+ existsSync(pluginsHashFile) &&
61
+ readFileSync(pluginsHashFile, 'utf8') === plugins;
42
62
  if (!upToDate) {
43
63
  rmSync(dir, { recursive: true, force: true });
44
64
  mkdirSync(dir, { recursive: true });
45
65
  cpSync(path.join(TEMPLATES_DIR, platform), dir, { recursive: true });
46
66
  generator.configure(dir, app, projectRoot, development);
47
- writeFileSync(hashFile, hash);
67
+ generator.leaveOut(dir, features, app);
68
+ writeFileSync(hashFile, projectHash);
48
69
  }
70
+ if (!pluginsUpToDate) {
71
+ // First, so a write that fails partway, after deleting the last copy,
72
+ // leaves no hash that inputs restored to the last copy's would match.
73
+ rmSync(pluginsHashFile, { force: true });
74
+ generator.writePlugins(dir, app, projectRoot);
75
+ writeFileSync(pluginsHashFile, plugins);
76
+ }
77
+ const hash = createHash('sha256')
78
+ .update(`${projectHash}\n${plugins}`)
79
+ .digest('hex');
49
80
  // Generated projects are build output. `ng new` already ignores Angular's
50
81
  // cache, but a moved cache (`cli.cache.path`) or an edited .gitignore may
51
82
  // not be: keep them out of the user's git without asking them to edit it.
52
83
  writeFileSync(path.join(workDir, '.gitignore'), '*\n');
53
84
  if (bundleDir)
54
85
  copyBundle(bundleDir, generator.bundleDir(dir));
55
- return { dir, ejected: false, regenerated: !upToDate, hash };
86
+ return {
87
+ dir,
88
+ ejected: false,
89
+ regenerated: !upToDate,
90
+ ...(upToDate && !pluginsUpToDate && { pluginsUpdated: true }),
91
+ hash,
92
+ };
56
93
  };
57
94
  /**
58
95
  * Up to 22.2.2, native builds worked in `.angular-lynx/` at the project root.
@@ -93,9 +130,16 @@ export const copyBundle = (from, to) => {
93
130
  });
94
131
  }
95
132
  };
96
- const inputHash = ({ platform, app, projectRoot, packageVersion, }) => {
133
+ const inputHash = ({ platform, app, projectRoot, packageVersion, features, }) => {
97
134
  const hash = createHash('sha256');
98
- hash.update(`${packageVersion}\n${platform}\n${JSON.stringify(app)}\n`);
135
+ // The plugins by their folders alone: what each registers is in
136
+ // pluginsHash, so an edit to it updates only the plugins, as an edit to
137
+ // their sources does.
138
+ const options = {
139
+ ...app,
140
+ nativePlugins: app.nativePlugins.map((plugin) => plugin.path),
141
+ };
142
+ hash.update(`${packageVersion}\n${platform}\n${JSON.stringify(options)}\n${JSON.stringify(features)}\n`);
99
143
  for (const file of listFiles(path.join(TEMPLATES_DIR, platform))) {
100
144
  hash.update(file.relative);
101
145
  hash.update(readFileSync(file.absolute));
@@ -119,14 +163,29 @@ const inputHash = ({ platform, app, projectRoot, packageVersion, }) => {
119
163
  return hash.digest('hex');
120
164
  };
121
165
  /**
122
- * Every file under `dir`, sorted, so the hash doesn't depend on fs order.
166
+ * A hash of the plugins' entries in angular.json, then their sources and
167
+ * folders, by path relative to the project root and contents. Apart from
168
+ * inputHash, so an edit to a plugin's entry or files updates only the
169
+ * plugins in the project (`writePlugins`), and Xcode and
170
+ * Gradle keep the rest of their incremental state. Each path ends in a NUL,
171
+ * which no path has, and each file's contents start with their length, so
172
+ * the end of one file can't be read as the next one's path; a folder has
173
+ * `folder` in place of the length.
123
174
  */
124
- const listFiles = (dir, prefix = '') => readdirSync(dir, { withFileTypes: true })
125
- .sort((a, b) => a.name.localeCompare(b.name))
126
- .flatMap((entry) => {
127
- const relative = path.posix.join(prefix, entry.name);
128
- const absolute = path.join(dir, entry.name);
129
- return entry.isDirectory()
130
- ? listFiles(absolute, relative)
131
- : [{ relative, absolute }];
132
- });
175
+ const pluginsHash = (app, projectRoot) => {
176
+ const hash = createHash('sha256');
177
+ // JSON has no NUL outside a string's escapes, so it ends where the paths
178
+ // start.
179
+ hash.update(`${JSON.stringify(app.nativePlugins)}\0`);
180
+ for (const { absolute, folder } of pluginInputFiles(app.nativePlugins, projectRoot)) {
181
+ const relative = path.relative(projectRoot, absolute);
182
+ if (folder) {
183
+ hash.update(`${relative}\0folder\0`);
184
+ continue;
185
+ }
186
+ const contents = readFileSync(absolute);
187
+ hash.update(`${relative}\0${contents.length}\0`);
188
+ hash.update(contents);
189
+ }
190
+ return hash.digest('hex');
191
+ };
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import type { DevServerOptions, RunOptions } from './run.ts';
4
4
  export type { Platform } from './generate.ts';
5
5
  export { EJECT_MARKER, copyBundle, prepareProject } from './generate.ts';
6
6
  export { renderEjectedProject } from './eject.ts';
7
+ export { ALL_NATIVE_FEATURES, NATIVE_FEATURES_FILE, type NativeFeatures, readNativeFeatures, } from './features.ts';
7
8
  export { LYNX_IOS, FRAMEWORKS_ENV } from './ios/frameworks.ts';
8
9
  export type { AndroidOptions, IosExportMethod, IosOptions, NativeAppOptions, Orientation, Permission, ResolvedApp, SplashOptions, } from './options.ts';
9
10
  export { NativeConfigError, resolveAppOptions } from './options.ts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,eAAe,CAAC;AASvB,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,cAAc,CAAC;AAExE,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG7D,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC/D,YAAY,EACV,cAAc,EACd,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAW7D,eAAO,MAAM,eAAe,EAAE,MAErB,CAAC;AAEV,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,QAAQ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E,gBAAgB,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,qBAAqB,KAC7B,OAAO,CAAC;IACT,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CA4KA,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { buildAndroid, resolveAndroidSigning } from "./android/build.js";
5
5
  import { writeAppLinkFile } from "./app-links.js";
6
6
  import { startAndroidDevice } from "./android/run.js";
7
7
  import { devBuildKey, recordDevBuild, reusableDevBuild } from "./dev-build.js";
8
+ import { readNativeFeatures } from "./features.js";
8
9
  import { prepareProject, removeLegacyWorkDir, } from "./generate.js";
9
10
  import { buildIos, missingTeamMessage, resolveIosSigning, } from "./ios/build.js";
10
11
  import { resolveLynxFrameworks } from "./ios/frameworks.js";
@@ -15,6 +16,7 @@ import { NativeBuildError } from "./process.js";
15
16
  import { splashWarnings } from "./splash.js";
16
17
  export { EJECT_MARKER, copyBundle, prepareProject } from "./generate.js";
17
18
  export { renderEjectedProject } from "./eject.js";
19
+ export { ALL_NATIVE_FEATURES, NATIVE_FEATURES_FILE, readNativeFeatures, } from "./features.js";
18
20
  export { LYNX_IOS, FRAMEWORKS_ENV } from "./ios/frameworks.js";
19
21
  export { NativeConfigError, resolveAppOptions } from "./options.js";
20
22
  export { NativeBuildError } from "./process.js";
@@ -70,15 +72,20 @@ export const buildNativeApp = async (options) => {
70
72
  if (target?.iPhone && !iosSigning) {
71
73
  throw new NativeBuildError(await missingTeamMessage(target.iPhone.name));
72
74
  }
75
+ const bundleDir = devServer ? undefined : options.bundleDir;
73
76
  const project = prepareProject({
74
77
  platform,
75
78
  generator: platform === 'ios' ? iosGenerator : androidGenerator,
76
79
  projectRoot,
77
80
  workDir,
78
81
  app,
79
- bundleDir: devServer ? undefined : options.bundleDir,
82
+ bundleDir,
80
83
  packageVersion: PACKAGE_VERSION,
81
84
  development: !!devServer,
85
+ // The native code the bundle uses: an app that never draws on a canvas
86
+ // leaves the canvas, WebGL and video frame code out (issue #837), and
87
+ // one that draws only in 2D leaves out WebGL and ANGLE (issue #847).
88
+ features: readNativeFeatures(bundleDir),
82
89
  });
83
90
  if (devServer &&
84
91
  project.ejected &&
@@ -89,7 +96,14 @@ export const buildNativeApp = async (options) => {
89
96
  ? `Using the ejected ${platform}/ project`
90
97
  : project.regenerated
91
98
  ? `Generated the ${platform} project`
92
- : `Reusing the generated ${platform} project (no config changes)`);
99
+ : project.pluginsUpdated
100
+ ? `Updated the native plugins in the generated ${platform} project`
101
+ : `Reusing the generated ${platform} project (no config changes)`);
102
+ // An ejected project has the plugins' files and registration eject wrote,
103
+ // and builds as it is.
104
+ if (project.ejected && app.nativePlugins.length > 0) {
105
+ (options.warn ?? log)(`nativePlugins doesn't apply to the ejected ${platform}/ project: it builds with the plugins' files and registration eject wrote into it. Change those in ${platform}/ itself.`);
106
+ }
93
107
  // On every build, not only when the project is generated, so a warning
94
108
  // isn't lost once the project is reused. An ejected project draws its
95
109
  // splash from its own files.
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/ios/build.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIlE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,OAAO,EAAE,MAAM,C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capture, run } from "../process.js";
6
6
  import { escapeXml } from "../xml.js";
7
+ import { IOS_ENTITLEMENTS } from "./project.js";
7
8
  /**
8
9
  * Reads the signing options, and the App Store Connect API key from the
9
10
  * environment variables they name. Returns undefined when signing isn't
@@ -278,8 +279,13 @@ const explainSigningFailure = (error, teamId) => {
278
279
  }
279
280
  // xcodebuild then also reports "No profiles for", which alone would point
280
281
  // at the wrong fix.
281
- if (/Personal development teams.*Associated Domains/is.test(error.message)) {
282
- return new NativeBuildError(`Team ${teamId} is a free Personal Team, which can't sign the Associated Domains capability that appLinkDomains adds. Set ios.teamId to a team in the paid Apple Developer Program, or leave appLinkDomains out of the configuration you build for this iPhone.\n\n${error.message}`);
282
+ // Each option that adds an entitlement names its capability as Xcode
283
+ // does, so the message can say which option a Personal Team can't sign.
284
+ const unsupported = /Personal development teams.*?do not support the (.+?) (?:capability|capabilities)/is.exec(error.message)?.[1];
285
+ const entitlement = unsupported &&
286
+ IOS_ENTITLEMENTS.find(({ capability }) => capability.toLowerCase() === unsupported.toLowerCase());
287
+ if (entitlement) {
288
+ return new NativeBuildError(`Team ${teamId} is a free Personal Team, which can't sign the ${entitlement.capability} capability that ${entitlement.option} adds. Set ios.teamId to a team in the paid Apple Developer Program, or leave ${entitlement.option} out of the configuration you build for this iPhone.\n\n${error.message}`);
283
289
  }
284
290
  if (/requires a development team|No profiles for/i.test(error.message)) {
285
291
  return new NativeBuildError(`Xcode couldn't make a provisioning profile for team ${teamId}. Check that ios.teamId is a team your Apple ID in Xcode → Settings → Accounts belongs to, and for an .ipa that the team is in the paid Apple Developer Program.\n\n${error.message}`);
@@ -12,12 +12,13 @@ export declare const LYNX_IOS: {
12
12
  readonly version: "4.1.0";
13
13
  /**
14
14
  * Counts rebuilds of one Lynx version whose frameworks changed (2 added
15
- * XElement, 3 ANGLE); BUILD in the script. It's part of the cache folder,
16
- * so a machine that cached an older zip downloads the new one instead of
17
- * linking frameworks the shell no longer matches.
15
+ * XElement, 3 ANGLE, 4 SDWebImage's signed release); BUILD in the script.
16
+ * It's part of the cache folder, so a machine that cached an older zip
17
+ * downloads the new one instead of linking frameworks the shell no longer
18
+ * matches.
18
19
  */
19
- readonly build: 3;
20
- readonly url: "https://github.com/Blotch-Smart-Frames/AngularLynx/releases/download/lynx-ios-4.1.0-3/lynx-ios-4.1.0-3.zip";
20
+ readonly build: 4;
21
+ readonly url: "https://github.com/Blotch-Smart-Frames/AngularLynx/releases/download/lynx-ios-4.1.0-4/lynx-ios-4.1.0-4.zip";
21
22
  readonly sha256: string | undefined;
22
23
  };
23
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/ios/frameworks.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;IAEnB;;;;;OAKG;;;qBAIC,MAAM,GACN,SAAS;CACL,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gKAYtB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,kCAAmC,CAAC;AAErE;;;GAGG;AACH,eAAO,MAAM,cAAc,uLAGjB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,gCAAgC,CAAC;AAS5D,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,GAChC,SAAS,MAAM,EACf,KAAK,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,KAC7B,OAAO,CAAC,MAAM,CAmDhB,CAAC;AAmBF,uEAAuE;AACvE,eAAO,MAAM,qBAAqB,GAAI,KAAK,MAAM,KAAG,MAAM,GAAG,SAM5D,CAAC"}
1
+ {"version":3,"file":"frameworks.d.ts","sourceRoot":"","sources":["../../src/ios/frameworks.ts"],"names":[],"mappings":"AAcA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ;;IAEnB;;;;;;OAMG;;;qBAIC,MAAM,GACN,SAAS;CACL,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