@expo/config-plugins 5.0.4 → 6.0.0

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 (190) hide show
  1. package/build/Plugin.types.d.ts +7 -7
  2. package/build/Plugin.types.js +0 -9
  3. package/build/Plugin.types.js.map +1 -1
  4. package/build/android/AllowBackup.js +0 -15
  5. package/build/android/AllowBackup.js.map +1 -1
  6. package/build/android/BuildProperties.js +2 -16
  7. package/build/android/BuildProperties.js.map +1 -1
  8. package/build/android/Colors.js +3 -25
  9. package/build/android/Colors.js.map +1 -1
  10. package/build/android/EasBuild.js +2 -22
  11. package/build/android/EasBuild.js.map +1 -1
  12. package/build/android/EasBuildGradleScript.js.map +1 -1
  13. package/build/android/GoogleMapsApiKey.js +0 -12
  14. package/build/android/GoogleMapsApiKey.js.map +1 -1
  15. package/build/android/GoogleServices.js +10 -48
  16. package/build/android/GoogleServices.js.map +1 -1
  17. package/build/android/IntentFilters.d.ts +1 -1
  18. package/build/android/IntentFilters.js +8 -24
  19. package/build/android/IntentFilters.js.map +1 -1
  20. package/build/android/Manifest.d.ts +19 -19
  21. package/build/android/Manifest.js +7 -66
  22. package/build/android/Manifest.js.map +1 -1
  23. package/build/android/Name.js +6 -27
  24. package/build/android/Name.js.map +1 -1
  25. package/build/android/Orientation.js +2 -12
  26. package/build/android/Orientation.js.map +1 -1
  27. package/build/android/Package.js +26 -111
  28. package/build/android/Package.js.map +1 -1
  29. package/build/android/Paths.d.ts +2 -2
  30. package/build/android/Paths.js +0 -47
  31. package/build/android/Paths.js.map +1 -1
  32. package/build/android/Permissions.js +8 -52
  33. package/build/android/Permissions.js.map +1 -1
  34. package/build/android/PrimaryColor.js +0 -18
  35. package/build/android/PrimaryColor.js.map +1 -1
  36. package/build/android/Properties.d.ts +1 -1
  37. package/build/android/Properties.js +0 -9
  38. package/build/android/Properties.js.map +1 -1
  39. package/build/android/Resources.d.ts +4 -4
  40. package/build/android/Resources.js +9 -29
  41. package/build/android/Resources.js.map +1 -1
  42. package/build/android/Scheme.d.ts +1 -1
  43. package/build/android/Scheme.js +13 -66
  44. package/build/android/Scheme.js.map +1 -1
  45. package/build/android/StatusBar.js +5 -33
  46. package/build/android/StatusBar.js.map +1 -1
  47. package/build/android/Strings.js +0 -14
  48. package/build/android/Strings.js.map +1 -1
  49. package/build/android/Styles.js +7 -34
  50. package/build/android/Styles.js.map +1 -1
  51. package/build/android/Updates.d.ts +2 -0
  52. package/build/android/Updates.js +50 -47
  53. package/build/android/Updates.js.map +1 -1
  54. package/build/android/Version.js +3 -29
  55. package/build/android/Version.js.map +1 -1
  56. package/build/android/WindowSoftInputMode.js +0 -14
  57. package/build/android/WindowSoftInputMode.js.map +1 -1
  58. package/build/android/codeMod.js +6 -22
  59. package/build/android/codeMod.js.map +1 -1
  60. package/build/android/index.js +0 -94
  61. package/build/android/index.js.map +1 -1
  62. package/build/index.js +2 -65
  63. package/build/index.js.map +1 -1
  64. package/build/ios/Bitcode.d.ts +1 -1
  65. package/build/ios/Bitcode.js +8 -28
  66. package/build/ios/Bitcode.js.map +1 -1
  67. package/build/ios/BuildProperties.js +2 -14
  68. package/build/ios/BuildProperties.js.map +1 -1
  69. package/build/ios/BuildScheme.js +2 -34
  70. package/build/ios/BuildScheme.js.map +1 -1
  71. package/build/ios/BundleIdentifier.js +13 -72
  72. package/build/ios/BundleIdentifier.js.map +1 -1
  73. package/build/ios/DeviceFamily.js +6 -24
  74. package/build/ios/DeviceFamily.js.map +1 -1
  75. package/build/ios/Entitlements.js +4 -45
  76. package/build/ios/Entitlements.js.map +1 -1
  77. package/build/ios/Google.d.ts +2 -2
  78. package/build/ios/Google.js +11 -66
  79. package/build/ios/Google.js.map +1 -1
  80. package/build/ios/IosConfig.types.d.ts +6 -11
  81. package/build/ios/IosConfig.types.js.map +1 -1
  82. package/build/ios/Locales.d.ts +3 -3
  83. package/build/ios/Locales.js +12 -43
  84. package/build/ios/Locales.js.map +1 -1
  85. package/build/ios/Maps.js +15 -53
  86. package/build/ios/Maps.js.map +1 -1
  87. package/build/ios/Name.js +7 -31
  88. package/build/ios/Name.js.map +1 -1
  89. package/build/ios/Orientation.js +2 -10
  90. package/build/ios/Orientation.js.map +1 -1
  91. package/build/ios/Paths.d.ts +2 -2
  92. package/build/ios/Paths.js +8 -73
  93. package/build/ios/Paths.js.map +1 -1
  94. package/build/ios/Permissions.js +1 -16
  95. package/build/ios/Permissions.js.map +1 -1
  96. package/build/ios/ProvisioningProfile.d.ts +1 -1
  97. package/build/ios/ProvisioningProfile.js +0 -18
  98. package/build/ios/ProvisioningProfile.js.map +1 -1
  99. package/build/ios/RequiresFullScreen.js +19 -31
  100. package/build/ios/RequiresFullScreen.js.map +1 -1
  101. package/build/ios/Scheme.js +10 -32
  102. package/build/ios/Scheme.js.map +1 -1
  103. package/build/ios/Swift.js +16 -50
  104. package/build/ios/Swift.js.map +1 -1
  105. package/build/ios/Target.js +0 -30
  106. package/build/ios/Target.js.map +1 -1
  107. package/build/ios/Updates.js +10 -49
  108. package/build/ios/Updates.js.map +1 -1
  109. package/build/ios/UsesNonExemptEncryption.js +4 -10
  110. package/build/ios/UsesNonExemptEncryption.js.map +1 -1
  111. package/build/ios/Version.js +4 -11
  112. package/build/ios/Version.js.map +1 -1
  113. package/build/ios/XcodeProjectFile.js +5 -23
  114. package/build/ios/XcodeProjectFile.js.map +1 -1
  115. package/build/ios/codeMod.js +19 -60
  116. package/build/ios/codeMod.js.map +1 -1
  117. package/build/ios/index.js +0 -97
  118. package/build/ios/index.js.map +1 -1
  119. package/build/ios/utils/Xcodeproj.d.ts +6 -6
  120. package/build/ios/utils/Xcodeproj.js +15 -101
  121. package/build/ios/utils/Xcodeproj.js.map +1 -1
  122. package/build/ios/utils/getInfoPlistPath.js +2 -15
  123. package/build/ios/utils/getInfoPlistPath.js.map +1 -1
  124. package/build/ios/utils/string.js +0 -1
  125. package/build/ios/utils/string.js.map +1 -1
  126. package/build/plugins/android-plugins.d.ts +2 -2
  127. package/build/plugins/android-plugins.js +11 -42
  128. package/build/plugins/android-plugins.js.map +1 -1
  129. package/build/plugins/createBaseMod.d.ts +3 -3
  130. package/build/plugins/createBaseMod.js +8 -25
  131. package/build/plugins/createBaseMod.js.map +1 -1
  132. package/build/plugins/ios-plugins.d.ts +2 -2
  133. package/build/plugins/ios-plugins.js +8 -48
  134. package/build/plugins/ios-plugins.js.map +1 -1
  135. package/build/plugins/mod-compiler.js +21 -72
  136. package/build/plugins/mod-compiler.js.map +1 -1
  137. package/build/plugins/withAndroidBaseMods.d.ts +1 -1
  138. package/build/plugins/withAndroidBaseMods.js +4 -89
  139. package/build/plugins/withAndroidBaseMods.js.map +1 -1
  140. package/build/plugins/withDangerousMod.js +0 -5
  141. package/build/plugins/withDangerousMod.js.map +1 -1
  142. package/build/plugins/withIosBaseMods.d.ts +1 -1
  143. package/build/plugins/withIosBaseMods.js +26 -118
  144. package/build/plugins/withIosBaseMods.js.map +1 -1
  145. package/build/plugins/withMod.d.ts +1 -1
  146. package/build/plugins/withMod.js +24 -59
  147. package/build/plugins/withMod.js.map +1 -1
  148. package/build/plugins/withPlugins.js +0 -9
  149. package/build/plugins/withPlugins.js.map +1 -1
  150. package/build/plugins/withRunOnce.js +3 -9
  151. package/build/plugins/withRunOnce.js.map +1 -1
  152. package/build/plugins/withStaticPlugin.js +21 -43
  153. package/build/plugins/withStaticPlugin.js.map +1 -1
  154. package/build/utils/BuildProperties.types.d.ts +2 -2
  155. package/build/utils/BuildProperties.types.js.map +1 -1
  156. package/build/utils/Updates.d.ts +3 -1
  157. package/build/utils/Updates.js +18 -77
  158. package/build/utils/Updates.js.map +1 -1
  159. package/build/utils/XML.d.ts +1 -1
  160. package/build/utils/XML.js +7 -44
  161. package/build/utils/XML.js.map +1 -1
  162. package/build/utils/commonCodeMod.js +2 -10
  163. package/build/utils/commonCodeMod.js.map +1 -1
  164. package/build/utils/errors.d.ts +1 -1
  165. package/build/utils/errors.js +3 -11
  166. package/build/utils/errors.js.map +1 -1
  167. package/build/utils/fs.js +1 -12
  168. package/build/utils/fs.js.map +1 -1
  169. package/build/utils/generateCode.d.ts +1 -1
  170. package/build/utils/generateCode.js +8 -25
  171. package/build/utils/generateCode.js.map +1 -1
  172. package/build/utils/history.d.ts +1 -1
  173. package/build/utils/history.js +0 -6
  174. package/build/utils/history.js.map +1 -1
  175. package/build/utils/matchBrackets.d.ts +3 -3
  176. package/build/utils/matchBrackets.js +2 -17
  177. package/build/utils/matchBrackets.js.map +1 -1
  178. package/build/utils/modules.js +0 -10
  179. package/build/utils/modules.js.map +1 -1
  180. package/build/utils/obj.js +0 -4
  181. package/build/utils/obj.js.map +1 -1
  182. package/build/utils/plugin-resolver.js +25 -69
  183. package/build/utils/plugin-resolver.js.map +1 -1
  184. package/build/utils/sortObject.js +4 -10
  185. package/build/utils/sortObject.js.map +1 -1
  186. package/build/utils/versions.js +0 -10
  187. package/build/utils/versions.js.map +1 -1
  188. package/build/utils/warnings.js +1 -9
  189. package/build/utils/warnings.js.map +1 -1
  190. package/package.json +5 -5
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.insertContentsAtOffset = insertContentsAtOffset;
7
7
  exports.replaceContentsWithOffset = replaceContentsWithOffset;
8
8
  exports.searchFromOffset = searchFromOffset;
9
-
10
9
  /**
11
10
  * Insert contents at given offset
12
11
  * @param srcContents source contents
@@ -16,21 +15,19 @@ exports.searchFromOffset = searchFromOffset;
16
15
  */
17
16
  function insertContentsAtOffset(srcContents, insertion, offset) {
18
17
  const srcContentsLength = srcContents.length;
19
-
20
18
  if (offset < 0 || offset > srcContentsLength) {
21
19
  throw new Error('Invalid parameters.');
22
20
  }
23
-
24
21
  if (offset === 0) {
25
22
  return `${insertion}${srcContents}`;
26
23
  } else if (offset === srcContentsLength) {
27
24
  return `${srcContents}${insertion}`;
28
25
  }
29
-
30
26
  const prefix = srcContents.substring(0, offset);
31
27
  const suffix = srcContents.substring(offset);
32
28
  return `${prefix}${insertion}${suffix}`;
33
29
  }
30
+
34
31
  /**
35
32
  * Replace contents at given start and end offset
36
33
  *
@@ -40,19 +37,16 @@ function insertContentsAtOffset(srcContents, insertion, offset) {
40
37
  * @param endOffset `contents` end offset for replacement
41
38
  * @returns updated contents
42
39
  */
43
-
44
-
45
40
  function replaceContentsWithOffset(contents, replacement, startOffset, endOffset) {
46
41
  const contentsLength = contents.length;
47
-
48
42
  if (startOffset < 0 || endOffset < 0 || startOffset >= contentsLength || endOffset >= contentsLength || startOffset > endOffset) {
49
43
  throw new Error('Invalid parameters.');
50
44
  }
51
-
52
45
  const prefix = contents.substring(0, startOffset);
53
46
  const suffix = contents.substring(endOffset + 1);
54
47
  return `${prefix}${replacement}${suffix}`;
55
48
  }
49
+
56
50
  /**
57
51
  * String.prototype.search() with offset support
58
52
  *
@@ -61,8 +55,6 @@ function replaceContentsWithOffset(contents, replacement, startOffset, endOffset
61
55
  * @param offset start offset of `source` to search `regexp` pattern
62
56
  * @returns The index of the first match between the regular expression and the given string, or -1 if no match was found.
63
57
  */
64
-
65
-
66
58
  function searchFromOffset(source, regexp, offset) {
67
59
  const target = source.substring(offset);
68
60
  const matchedIndex = target.search(regexp);
@@ -1 +1 @@
1
- {"version":3,"file":"commonCodeMod.js","names":["insertContentsAtOffset","srcContents","insertion","offset","srcContentsLength","length","Error","prefix","substring","suffix","replaceContentsWithOffset","contents","replacement","startOffset","endOffset","contentsLength","searchFromOffset","source","regexp","target","matchedIndex","search"],"sources":["../../src/utils/commonCodeMod.ts"],"sourcesContent":["export interface CodeBlock {\n start: number;\n end: number;\n code: string;\n}\n\n/**\n * Insert contents at given offset\n * @param srcContents source contents\n * @param insertion content to insert\n * @param offset `srcContents` offset to insert `insertion`\n * @returns updated contents\n */\nexport function insertContentsAtOffset(\n srcContents: string,\n insertion: string,\n offset: number\n): string {\n const srcContentsLength = srcContents.length;\n if (offset < 0 || offset > srcContentsLength) {\n throw new Error('Invalid parameters.');\n }\n if (offset === 0) {\n return `${insertion}${srcContents}`;\n } else if (offset === srcContentsLength) {\n return `${srcContents}${insertion}`;\n }\n\n const prefix = srcContents.substring(0, offset);\n const suffix = srcContents.substring(offset);\n return `${prefix}${insertion}${suffix}`;\n}\n\n/**\n * Replace contents at given start and end offset\n *\n * @param contents source contents\n * @param replacement new contents to place in [startOffset:endOffset]\n * @param startOffset `contents` start offset for replacement\n * @param endOffset `contents` end offset for replacement\n * @returns updated contents\n */\nexport function replaceContentsWithOffset(\n contents: string,\n replacement: string,\n startOffset: number,\n endOffset: number\n): string {\n const contentsLength = contents.length;\n if (\n startOffset < 0 ||\n endOffset < 0 ||\n startOffset >= contentsLength ||\n endOffset >= contentsLength ||\n startOffset > endOffset\n ) {\n throw new Error('Invalid parameters.');\n }\n const prefix = contents.substring(0, startOffset);\n const suffix = contents.substring(endOffset + 1);\n return `${prefix}${replacement}${suffix}`;\n}\n\n/**\n * String.prototype.search() with offset support\n *\n * @param source source string to search\n * @param regexp RegExp pattern to search\n * @param offset start offset of `source` to search `regexp` pattern\n * @returns The index of the first match between the regular expression and the given string, or -1 if no match was found.\n */\nexport function searchFromOffset(source: string, regexp: RegExp, offset: number): number {\n const target = source.substring(offset);\n const matchedIndex = target.search(regexp);\n return matchedIndex < 0 ? matchedIndex : matchedIndex + offset;\n}\n"],"mappings":";;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,WADK,EAELC,SAFK,EAGLC,MAHK,EAIG;EACR,MAAMC,iBAAiB,GAAGH,WAAW,CAACI,MAAtC;;EACA,IAAIF,MAAM,GAAG,CAAT,IAAcA,MAAM,GAAGC,iBAA3B,EAA8C;IAC5C,MAAM,IAAIE,KAAJ,CAAU,qBAAV,CAAN;EACD;;EACD,IAAIH,MAAM,KAAK,CAAf,EAAkB;IAChB,OAAQ,GAAED,SAAU,GAAED,WAAY,EAAlC;EACD,CAFD,MAEO,IAAIE,MAAM,KAAKC,iBAAf,EAAkC;IACvC,OAAQ,GAAEH,WAAY,GAAEC,SAAU,EAAlC;EACD;;EAED,MAAMK,MAAM,GAAGN,WAAW,CAACO,SAAZ,CAAsB,CAAtB,EAAyBL,MAAzB,CAAf;EACA,MAAMM,MAAM,GAAGR,WAAW,CAACO,SAAZ,CAAsBL,MAAtB,CAAf;EACA,OAAQ,GAAEI,MAAO,GAAEL,SAAU,GAAEO,MAAO,EAAtC;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,yBAAT,CACLC,QADK,EAELC,WAFK,EAGLC,WAHK,EAILC,SAJK,EAKG;EACR,MAAMC,cAAc,GAAGJ,QAAQ,CAACN,MAAhC;;EACA,IACEQ,WAAW,GAAG,CAAd,IACAC,SAAS,GAAG,CADZ,IAEAD,WAAW,IAAIE,cAFf,IAGAD,SAAS,IAAIC,cAHb,IAIAF,WAAW,GAAGC,SALhB,EAME;IACA,MAAM,IAAIR,KAAJ,CAAU,qBAAV,CAAN;EACD;;EACD,MAAMC,MAAM,GAAGI,QAAQ,CAACH,SAAT,CAAmB,CAAnB,EAAsBK,WAAtB,CAAf;EACA,MAAMJ,MAAM,GAAGE,QAAQ,CAACH,SAAT,CAAmBM,SAAS,GAAG,CAA/B,CAAf;EACA,OAAQ,GAAEP,MAAO,GAAEK,WAAY,GAAEH,MAAO,EAAxC;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,gBAAT,CAA0BC,MAA1B,EAA0CC,MAA1C,EAA0Df,MAA1D,EAAkF;EACvF,MAAMgB,MAAM,GAAGF,MAAM,CAACT,SAAP,CAAiBL,MAAjB,CAAf;EACA,MAAMiB,YAAY,GAAGD,MAAM,CAACE,MAAP,CAAcH,MAAd,CAArB;EACA,OAAOE,YAAY,GAAG,CAAf,GAAmBA,YAAnB,GAAkCA,YAAY,GAAGjB,MAAxD;AACD"}
1
+ {"version":3,"file":"commonCodeMod.js","names":["insertContentsAtOffset","srcContents","insertion","offset","srcContentsLength","length","Error","prefix","substring","suffix","replaceContentsWithOffset","contents","replacement","startOffset","endOffset","contentsLength","searchFromOffset","source","regexp","target","matchedIndex","search"],"sources":["../../src/utils/commonCodeMod.ts"],"sourcesContent":["export interface CodeBlock {\n start: number;\n end: number;\n code: string;\n}\n\n/**\n * Insert contents at given offset\n * @param srcContents source contents\n * @param insertion content to insert\n * @param offset `srcContents` offset to insert `insertion`\n * @returns updated contents\n */\nexport function insertContentsAtOffset(\n srcContents: string,\n insertion: string,\n offset: number\n): string {\n const srcContentsLength = srcContents.length;\n if (offset < 0 || offset > srcContentsLength) {\n throw new Error('Invalid parameters.');\n }\n if (offset === 0) {\n return `${insertion}${srcContents}`;\n } else if (offset === srcContentsLength) {\n return `${srcContents}${insertion}`;\n }\n\n const prefix = srcContents.substring(0, offset);\n const suffix = srcContents.substring(offset);\n return `${prefix}${insertion}${suffix}`;\n}\n\n/**\n * Replace contents at given start and end offset\n *\n * @param contents source contents\n * @param replacement new contents to place in [startOffset:endOffset]\n * @param startOffset `contents` start offset for replacement\n * @param endOffset `contents` end offset for replacement\n * @returns updated contents\n */\nexport function replaceContentsWithOffset(\n contents: string,\n replacement: string,\n startOffset: number,\n endOffset: number\n): string {\n const contentsLength = contents.length;\n if (\n startOffset < 0 ||\n endOffset < 0 ||\n startOffset >= contentsLength ||\n endOffset >= contentsLength ||\n startOffset > endOffset\n ) {\n throw new Error('Invalid parameters.');\n }\n const prefix = contents.substring(0, startOffset);\n const suffix = contents.substring(endOffset + 1);\n return `${prefix}${replacement}${suffix}`;\n}\n\n/**\n * String.prototype.search() with offset support\n *\n * @param source source string to search\n * @param regexp RegExp pattern to search\n * @param offset start offset of `source` to search `regexp` pattern\n * @returns The index of the first match between the regular expression and the given string, or -1 if no match was found.\n */\nexport function searchFromOffset(source: string, regexp: RegExp, offset: number): number {\n const target = source.substring(offset);\n const matchedIndex = target.search(regexp);\n return matchedIndex < 0 ? matchedIndex : matchedIndex + offset;\n}\n"],"mappings":";;;;;;;;AAMA;AACA;AACA;AACA;AACA;A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AACA;AACA;AACA;AACA;AACA;AACO,SAASO,gBAAgB,CAACC,MAAc,EAAEC,MAAc,EAAEf,MAAc,EAAU;EACvF,MAAMgB,MAAM,GAAGF,MAAM,CAACT,SAAS,CAACL,MAAM,CAAC;EACvC,MAAMiB,YAAY,GAAGD,MAAM,CAACE,MAAM,CAACH,MAAM,CAAC;EAC1C,OAAOE,YAAY,GAAG,CAAC,GAAGA,YAAY,GAAGA,YAAY,GAAGjB,MAAM;AAChE"}
@@ -2,7 +2,7 @@ export declare class UnexpectedError extends Error {
2
2
  readonly name = "UnexpectedError";
3
3
  constructor(message: string);
4
4
  }
5
- export declare type PluginErrorCode = 'INVALID_PLUGIN_TYPE' | 'INVALID_PLUGIN_IMPORT' | 'PLUGIN_NOT_FOUND' | 'CONFLICTING_PROVIDER' | 'INVALID_MOD_ORDER' | 'MISSING_PROVIDER';
5
+ export type PluginErrorCode = 'INVALID_PLUGIN_TYPE' | 'INVALID_PLUGIN_IMPORT' | 'PLUGIN_NOT_FOUND' | 'CONFLICTING_PROVIDER' | 'INVALID_MOD_ORDER' | 'MISSING_PROVIDER';
6
6
  /**
7
7
  * Based on `JsonFileError` from `@expo/json-file`
8
8
  */
@@ -4,20 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.UnexpectedError = exports.PluginError = void 0;
7
-
8
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
-
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
9
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
10
10
  class UnexpectedError extends Error {
11
11
  constructor(message) {
12
12
  super(`${message}\nPlease report this as an issue on https://github.com/expo/expo-cli/issues`);
13
-
14
13
  _defineProperty(this, "name", 'UnexpectedError');
15
14
  }
16
-
17
15
  }
18
-
19
16
  exports.UnexpectedError = UnexpectedError;
20
-
21
17
  /**
22
18
  * Based on `JsonFileError` from `@expo/json-file`
23
19
  */
@@ -26,13 +22,9 @@ class PluginError extends Error {
26
22
  super(cause ? `${message}\n└─ Cause: ${cause.name}: ${cause.message}` : message);
27
23
  this.code = code;
28
24
  this.cause = cause;
29
-
30
25
  _defineProperty(this, "name", 'PluginError');
31
-
32
26
  _defineProperty(this, "isPluginError", true);
33
27
  }
34
-
35
28
  }
36
-
37
29
  exports.PluginError = PluginError;
38
30
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["UnexpectedError","Error","constructor","message","PluginError","code","cause","name"],"sources":["../../src/utils/errors.ts"],"sourcesContent":["export class UnexpectedError extends Error {\n readonly name = 'UnexpectedError';\n\n constructor(message: string) {\n super(`${message}\\nPlease report this as an issue on https://github.com/expo/expo-cli/issues`);\n }\n}\n\nexport type PluginErrorCode =\n | 'INVALID_PLUGIN_TYPE'\n | 'INVALID_PLUGIN_IMPORT'\n | 'PLUGIN_NOT_FOUND'\n | 'CONFLICTING_PROVIDER'\n | 'INVALID_MOD_ORDER'\n | 'MISSING_PROVIDER';\n\n/**\n * Based on `JsonFileError` from `@expo/json-file`\n */\nexport class PluginError extends Error {\n readonly name = 'PluginError';\n readonly isPluginError = true;\n\n constructor(message: string, public code: PluginErrorCode, public cause?: Error) {\n super(cause ? `${message}\\n└─ Cause: ${cause.name}: ${cause.message}` : message);\n }\n}\n"],"mappings":";;;;;;;;;AAAO,MAAMA,eAAN,SAA8BC,KAA9B,CAAoC;EAGzCC,WAAW,CAACC,OAAD,EAAkB;IAC3B,MAAO,GAAEA,OAAQ,6EAAjB;;IAD2B,8BAFb,iBAEa;EAE5B;;AALwC;;;;AAgB3C;AACA;AACA;AACO,MAAMC,WAAN,SAA0BH,KAA1B,CAAgC;EAIrCC,WAAW,CAACC,OAAD,EAAyBE,IAAzB,EAAuDC,KAAvD,EAAsE;IAC/E,MAAMA,KAAK,GAAI,GAAEH,OAAQ,eAAcG,KAAK,CAACC,IAAK,KAAID,KAAK,CAACH,OAAQ,EAAzD,GAA6DA,OAAxE;IAD+E,KAA7CE,IAA6C,GAA7CA,IAA6C;IAAA,KAAfC,KAAe,GAAfA,KAAe;;IAAA,8BAHjE,aAGiE;;IAAA,uCAFxD,IAEwD;EAEhF;;AANoC"}
1
+ {"version":3,"file":"errors.js","names":["UnexpectedError","Error","constructor","message","PluginError","code","cause","name"],"sources":["../../src/utils/errors.ts"],"sourcesContent":["export class UnexpectedError extends Error {\n readonly name = 'UnexpectedError';\n\n constructor(message: string) {\n super(`${message}\\nPlease report this as an issue on https://github.com/expo/expo-cli/issues`);\n }\n}\n\nexport type PluginErrorCode =\n | 'INVALID_PLUGIN_TYPE'\n | 'INVALID_PLUGIN_IMPORT'\n | 'PLUGIN_NOT_FOUND'\n | 'CONFLICTING_PROVIDER'\n | 'INVALID_MOD_ORDER'\n | 'MISSING_PROVIDER';\n\n/**\n * Based on `JsonFileError` from `@expo/json-file`\n */\nexport class PluginError extends Error {\n readonly name = 'PluginError';\n readonly isPluginError = true;\n\n constructor(message: string, public code: PluginErrorCode, public cause?: Error) {\n super(cause ? `${message}\\n└─ Cause: ${cause.name}: ${cause.message}` : message);\n }\n}\n"],"mappings":";;;;;;;;;AAAO,MAAMA,eAAe,SAASC,KAAK,CAAC;EAGzCC,WAAW,CAACC,OAAe,EAAE;IAC3B,KAAK,CAAE,GAAEA,OAAQ,6EAA4E,CAAC;IAAC,8BAHjF,iBAAiB;EAIjC;AACF;AAAC;AAUD;AACA;AACA;AACO,MAAMC,WAAW,SAASH,KAAK,CAAC;EAIrCC,WAAW,CAACC,OAAe,EAASE,IAAqB,EAASC,KAAa,EAAE;IAC/E,KAAK,CAACA,KAAK,GAAI,GAAEH,OAAQ,eAAcG,KAAK,CAACC,IAAK,KAAID,KAAK,CAACH,OAAQ,EAAC,GAAGA,OAAO,CAAC;IAAC,KAD/CE,IAAqB,GAArBA,IAAqB;IAAA,KAASC,KAAa,GAAbA,KAAa;IAAA,8BAH/D,aAAa;IAAA,uCACJ,IAAI;EAI7B;AACF;AAAC"}
package/build/utils/fs.js CHANGED
@@ -5,29 +5,21 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.copyFilePathToPathAsync = copyFilePathToPathAsync;
7
7
  exports.removeFile = removeFile;
8
-
9
8
  function _fs() {
10
9
  const data = _interopRequireDefault(require("fs"));
11
-
12
10
  _fs = function () {
13
11
  return data;
14
12
  };
15
-
16
13
  return data;
17
14
  }
18
-
19
15
  function _path() {
20
16
  const data = _interopRequireDefault(require("path"));
21
-
22
17
  _path = function () {
23
18
  return data;
24
19
  };
25
-
26
20
  return data;
27
21
  }
28
-
29
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
30
-
31
23
  /** A basic function that copies a single file to another file location. */
32
24
  async function copyFilePathToPathAsync(src, dest) {
33
25
  const srcFile = await _fs().default.promises.readFile(src);
@@ -36,20 +28,17 @@ async function copyFilePathToPathAsync(src, dest) {
36
28
  });
37
29
  await _fs().default.promises.writeFile(dest, srcFile);
38
30
  }
39
- /** Remove a single file (not directory). Returns `true` if a file was actually deleted. */
40
-
41
31
 
32
+ /** Remove a single file (not directory). Returns `true` if a file was actually deleted. */
42
33
  function removeFile(filePath) {
43
34
  try {
44
35
  _fs().default.unlinkSync(filePath);
45
-
46
36
  return true;
47
37
  } catch (error) {
48
38
  // Skip if the remove did nothing.
49
39
  if (error.code === 'ENOENT') {
50
40
  return false;
51
41
  }
52
-
53
42
  throw error;
54
43
  }
55
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","names":["copyFilePathToPathAsync","src","dest","srcFile","fs","promises","readFile","mkdir","path","dirname","recursive","writeFile","removeFile","filePath","unlinkSync","error","code"],"sources":["../../src/utils/fs.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n/** A basic function that copies a single file to another file location. */\nexport async function copyFilePathToPathAsync(src: string, dest: string): Promise<void> {\n const srcFile = await fs.promises.readFile(src);\n await fs.promises.mkdir(path.dirname(dest), { recursive: true });\n await fs.promises.writeFile(dest, srcFile);\n}\n\n/** Remove a single file (not directory). Returns `true` if a file was actually deleted. */\nexport function removeFile(filePath: string): boolean {\n try {\n fs.unlinkSync(filePath);\n return true;\n } catch (error: any) {\n // Skip if the remove did nothing.\n if (error.code === 'ENOENT') {\n return false;\n }\n throw error;\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AAEA;AACO,eAAeA,uBAAf,CAAuCC,GAAvC,EAAoDC,IAApD,EAAiF;EACtF,MAAMC,OAAO,GAAG,MAAMC,aAAA,CAAGC,QAAH,CAAYC,QAAZ,CAAqBL,GAArB,CAAtB;EACA,MAAMG,aAAA,CAAGC,QAAH,CAAYE,KAAZ,CAAkBC,eAAA,CAAKC,OAAL,CAAaP,IAAb,CAAlB,EAAsC;IAAEQ,SAAS,EAAE;EAAb,CAAtC,CAAN;EACA,MAAMN,aAAA,CAAGC,QAAH,CAAYM,SAAZ,CAAsBT,IAAtB,EAA4BC,OAA5B,CAAN;AACD;AAED;;;AACO,SAASS,UAAT,CAAoBC,QAApB,EAA+C;EACpD,IAAI;IACFT,aAAA,CAAGU,UAAH,CAAcD,QAAd;;IACA,OAAO,IAAP;EACD,CAHD,CAGE,OAAOE,KAAP,EAAmB;IACnB;IACA,IAAIA,KAAK,CAACC,IAAN,KAAe,QAAnB,EAA6B;MAC3B,OAAO,KAAP;IACD;;IACD,MAAMD,KAAN;EACD;AACF"}
1
+ {"version":3,"file":"fs.js","names":["copyFilePathToPathAsync","src","dest","srcFile","fs","promises","readFile","mkdir","path","dirname","recursive","writeFile","removeFile","filePath","unlinkSync","error","code"],"sources":["../../src/utils/fs.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\n/** A basic function that copies a single file to another file location. */\nexport async function copyFilePathToPathAsync(src: string, dest: string): Promise<void> {\n const srcFile = await fs.promises.readFile(src);\n await fs.promises.mkdir(path.dirname(dest), { recursive: true });\n await fs.promises.writeFile(dest, srcFile);\n}\n\n/** Remove a single file (not directory). Returns `true` if a file was actually deleted. */\nexport function removeFile(filePath: string): boolean {\n try {\n fs.unlinkSync(filePath);\n return true;\n } catch (error: any) {\n // Skip if the remove did nothing.\n if (error.code === 'ENOENT') {\n return false;\n }\n throw error;\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAwB;AAExB;AACO,eAAeA,uBAAuB,CAACC,GAAW,EAAEC,IAAY,EAAiB;EACtF,MAAMC,OAAO,GAAG,MAAMC,aAAE,CAACC,QAAQ,CAACC,QAAQ,CAACL,GAAG,CAAC;EAC/C,MAAMG,aAAE,CAACC,QAAQ,CAACE,KAAK,CAACC,eAAI,CAACC,OAAO,CAACP,IAAI,CAAC,EAAE;IAAEQ,SAAS,EAAE;EAAK,CAAC,CAAC;EAChE,MAAMN,aAAE,CAACC,QAAQ,CAACM,SAAS,CAACT,IAAI,EAAEC,OAAO,CAAC;AAC5C;;AAEA;AACO,SAASS,UAAU,CAACC,QAAgB,EAAW;EACpD,IAAI;IACFT,aAAE,CAACU,UAAU,CAACD,QAAQ,CAAC;IACvB,OAAO,IAAI;EACb,CAAC,CAAC,OAAOE,KAAU,EAAE;IACnB;IACA,IAAIA,KAAK,CAACC,IAAI,KAAK,QAAQ,EAAE;MAC3B,OAAO,KAAK;IACd;IACA,MAAMD,KAAK;EACb;AACF"}
@@ -1,4 +1,4 @@
1
- export declare type MergeResults = {
1
+ export type MergeResults = {
2
2
  contents: string;
3
3
  didClear: boolean;
4
4
  didMerge: boolean;
@@ -8,24 +8,20 @@ exports.createHash = createHash;
8
8
  exports.mergeContents = mergeContents;
9
9
  exports.removeContents = removeContents;
10
10
  exports.removeGeneratedContents = removeGeneratedContents;
11
-
12
11
  function _crypto() {
13
12
  const data = _interopRequireDefault(require("crypto"));
14
-
15
13
  _crypto = function () {
16
14
  return data;
17
15
  };
18
-
19
16
  return data;
20
17
  }
21
-
22
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
-
24
19
  /**
25
20
  * Get line indexes for the generated section of a file.
26
21
  *
27
22
  * @param src
28
23
  */
24
+
29
25
  function getGeneratedSectionIndexes(src, tag) {
30
26
  const contents = src.split('\n');
31
27
  const start = contents.findIndex(line => line.includes(`@generated begin ${tag}`));
@@ -36,7 +32,6 @@ function getGeneratedSectionIndexes(src, tag) {
36
32
  end
37
33
  };
38
34
  }
39
-
40
35
  /**
41
36
  * Merge the contents of two files together and add a generated header.
42
37
  *
@@ -56,7 +51,6 @@ function mergeContents({
56
51
  comment
57
52
  }) {
58
53
  const header = createGeneratedHeaderComment(newSrc, tag, comment);
59
-
60
54
  if (!src.includes(header)) {
61
55
  // Ensure the old generated contents are removed.
62
56
  const sanitizedTarget = removeGeneratedContents(src, tag);
@@ -66,14 +60,12 @@ function mergeContents({
66
60
  didClear: !!sanitizedTarget
67
61
  };
68
62
  }
69
-
70
63
  return {
71
64
  contents: src,
72
65
  didClear: false,
73
66
  didMerge: false
74
67
  };
75
68
  }
76
-
77
69
  function removeContents({
78
70
  src,
79
71
  tag
@@ -86,60 +78,51 @@ function removeContents({
86
78
  didClear: !!sanitizedTarget
87
79
  };
88
80
  }
89
-
90
81
  function addLines(content, find, offset, toAdd) {
91
82
  const lines = content.split('\n');
92
83
  let lineIndex = lines.findIndex(line => line.match(find));
93
-
94
84
  if (lineIndex < 0) {
95
- const error = new Error(`Failed to match "${find}" in contents:\n${content}`); // @ts-ignore
96
-
85
+ const error = new Error(`Failed to match "${find}" in contents:\n${content}`);
86
+ // @ts-ignore
97
87
  error.code = 'ERR_NO_MATCH';
98
88
  throw error;
99
89
  }
100
-
101
90
  for (const newLine of toAdd) {
102
91
  lines.splice(lineIndex + offset, 0, newLine);
103
92
  lineIndex++;
104
93
  }
105
-
106
94
  return lines.join('\n');
107
95
  }
96
+
108
97
  /**
109
98
  * Removes the generated section from a file, returns null when nothing can be removed.
110
99
  * This sways heavily towards not removing lines unless it's certain that modifications were not made manually.
111
100
  *
112
101
  * @param src
113
102
  */
114
-
115
-
116
103
  function removeGeneratedContents(src, tag) {
117
104
  const {
118
105
  contents,
119
106
  start,
120
107
  end
121
108
  } = getGeneratedSectionIndexes(src, tag);
122
-
123
109
  if (start > -1 && end > -1 && start < end) {
124
- contents.splice(start, end - start + 1); // TODO: We could in theory check that the contents we're removing match the hash used in the header,
110
+ contents.splice(start, end - start + 1);
111
+ // TODO: We could in theory check that the contents we're removing match the hash used in the header,
125
112
  // this would ensure that we don't accidentally remove lines that someone added or removed from the generated section.
126
-
127
113
  return contents.join('\n');
128
114
  }
129
-
130
115
  return null;
131
116
  }
132
-
133
117
  function createGeneratedHeaderComment(contents, tag, comment) {
134
- const hashKey = createHash(contents); // Everything after the `${tag} ` is unversioned and can be freely modified without breaking changes.
118
+ const hashKey = createHash(contents);
135
119
 
120
+ // Everything after the `${tag} ` is unversioned and can be freely modified without breaking changes.
136
121
  return `${comment} @generated begin ${tag} - expo prebuild (DO NOT MODIFY) ${hashKey}`;
137
122
  }
138
-
139
123
  function createHash(src) {
140
124
  // this doesn't need to be secure, the shorter the better.
141
125
  const hash = _crypto().default.createHash('sha1').update(src).digest('hex');
142
-
143
126
  return `sync-${hash}`;
144
127
  }
145
128
  //# sourceMappingURL=generateCode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generateCode.js","names":["getGeneratedSectionIndexes","src","tag","contents","split","start","findIndex","line","includes","end","mergeContents","newSrc","anchor","offset","comment","header","createGeneratedHeaderComment","sanitizedTarget","removeGeneratedContents","addLines","didMerge","didClear","removeContents","content","find","toAdd","lines","lineIndex","match","error","Error","code","newLine","splice","join","hashKey","createHash","hash","crypto","update","digest"],"sources":["../../src/utils/generateCode.ts"],"sourcesContent":["/**\n * Get line indexes for the generated section of a file.\n *\n * @param src\n */\nimport crypto from 'crypto';\n\nfunction getGeneratedSectionIndexes(\n src: string,\n tag: string\n): { contents: string[]; start: number; end: number } {\n const contents = src.split('\\n');\n const start = contents.findIndex((line) => line.includes(`@generated begin ${tag}`));\n const end = contents.findIndex((line) => line.includes(`@generated end ${tag}`));\n\n return { contents, start, end };\n}\n\nexport type MergeResults = {\n contents: string;\n didClear: boolean;\n didMerge: boolean;\n};\n\n/**\n * Merge the contents of two files together and add a generated header.\n *\n * @param src contents of the original file\n * @param newSrc new contents to merge into the original file\n * @param identifier used to update and remove merges\n * @param anchor regex to where the merge should begin\n * @param offset line offset to start merging at (<1 for behind the anchor)\n * @param comment comment style `//` or `#`\n */\nexport function mergeContents({\n src,\n newSrc,\n tag,\n anchor,\n offset,\n comment,\n}: {\n src: string;\n newSrc: string;\n tag: string;\n anchor: string | RegExp;\n offset: number;\n comment: string;\n}): MergeResults {\n const header = createGeneratedHeaderComment(newSrc, tag, comment);\n if (!src.includes(header)) {\n // Ensure the old generated contents are removed.\n const sanitizedTarget = removeGeneratedContents(src, tag);\n return {\n contents: addLines(sanitizedTarget ?? src, anchor, offset, [\n header,\n ...newSrc.split('\\n'),\n `${comment} @generated end ${tag}`,\n ]),\n didMerge: true,\n didClear: !!sanitizedTarget,\n };\n }\n return { contents: src, didClear: false, didMerge: false };\n}\n\nexport function removeContents({ src, tag }: { src: string; tag: string }): MergeResults {\n // Ensure the old generated contents are removed.\n const sanitizedTarget = removeGeneratedContents(src, tag);\n return {\n contents: sanitizedTarget ?? src,\n didMerge: false,\n didClear: !!sanitizedTarget,\n };\n}\n\nfunction addLines(content: string, find: string | RegExp, offset: number, toAdd: string[]) {\n const lines = content.split('\\n');\n\n let lineIndex = lines.findIndex((line) => line.match(find));\n if (lineIndex < 0) {\n const error = new Error(`Failed to match \"${find}\" in contents:\\n${content}`);\n // @ts-ignore\n error.code = 'ERR_NO_MATCH';\n throw error;\n }\n for (const newLine of toAdd) {\n lines.splice(lineIndex + offset, 0, newLine);\n lineIndex++;\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Removes the generated section from a file, returns null when nothing can be removed.\n * This sways heavily towards not removing lines unless it's certain that modifications were not made manually.\n *\n * @param src\n */\nexport function removeGeneratedContents(src: string, tag: string): string | null {\n const { contents, start, end } = getGeneratedSectionIndexes(src, tag);\n if (start > -1 && end > -1 && start < end) {\n contents.splice(start, end - start + 1);\n // TODO: We could in theory check that the contents we're removing match the hash used in the header,\n // this would ensure that we don't accidentally remove lines that someone added or removed from the generated section.\n return contents.join('\\n');\n }\n return null;\n}\n\nexport function createGeneratedHeaderComment(\n contents: string,\n tag: string,\n comment: string\n): string {\n const hashKey = createHash(contents);\n\n // Everything after the `${tag} ` is unversioned and can be freely modified without breaking changes.\n return `${comment} @generated begin ${tag} - expo prebuild (DO NOT MODIFY) ${hashKey}`;\n}\n\nexport function createHash(src: string): string {\n // this doesn't need to be secure, the shorter the better.\n const hash = crypto.createHash('sha1').update(src).digest('hex');\n return `sync-${hash}`;\n}\n"],"mappings":";;;;;;;;;;;AAKA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AALA;AACA;AACA;AACA;AACA;AAGA,SAASA,0BAAT,CACEC,GADF,EAEEC,GAFF,EAGsD;EACpD,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAJ,CAAU,IAAV,CAAjB;EACA,MAAMC,KAAK,GAAGF,QAAQ,CAACG,SAAT,CAAoBC,IAAD,IAAUA,IAAI,CAACC,QAAL,CAAe,oBAAmBN,GAAI,EAAtC,CAA7B,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,CAAP;EACD;;EACD,OAAO,IAAP;AACD;;AAEM,SAASlB,4BAAT,CACLb,QADK,EAELD,GAFK,EAGLY,OAHK,EAIG;EACR,MAAMqB,OAAO,GAAGC,UAAU,CAACjC,QAAD,CAA1B,CADQ,CAGR;;EACA,OAAQ,GAAEW,OAAQ,qBAAoBZ,GAAI,oCAAmCiC,OAAQ,EAArF;AACD;;AAEM,SAASC,UAAT,CAAoBnC,GAApB,EAAyC;EAC9C;EACA,MAAMoC,IAAI,GAAGC,iBAAA,CAAOF,UAAP,CAAkB,MAAlB,EAA0BG,MAA1B,CAAiCtC,GAAjC,EAAsCuC,MAAtC,CAA6C,KAA7C,CAAb;;EACA,OAAQ,QAAOH,IAAK,EAApB;AACD"}
1
+ {"version":3,"file":"generateCode.js","names":["getGeneratedSectionIndexes","src","tag","contents","split","start","findIndex","line","includes","end","mergeContents","newSrc","anchor","offset","comment","header","createGeneratedHeaderComment","sanitizedTarget","removeGeneratedContents","addLines","didMerge","didClear","removeContents","content","find","toAdd","lines","lineIndex","match","error","Error","code","newLine","splice","join","hashKey","createHash","hash","crypto","update","digest"],"sources":["../../src/utils/generateCode.ts"],"sourcesContent":["/**\n * Get line indexes for the generated section of a file.\n *\n * @param src\n */\nimport crypto from 'crypto';\n\nfunction getGeneratedSectionIndexes(\n src: string,\n tag: string\n): { contents: string[]; start: number; end: number } {\n const contents = src.split('\\n');\n const start = contents.findIndex((line) => line.includes(`@generated begin ${tag}`));\n const end = contents.findIndex((line) => line.includes(`@generated end ${tag}`));\n\n return { contents, start, end };\n}\n\nexport type MergeResults = {\n contents: string;\n didClear: boolean;\n didMerge: boolean;\n};\n\n/**\n * Merge the contents of two files together and add a generated header.\n *\n * @param src contents of the original file\n * @param newSrc new contents to merge into the original file\n * @param identifier used to update and remove merges\n * @param anchor regex to where the merge should begin\n * @param offset line offset to start merging at (<1 for behind the anchor)\n * @param comment comment style `//` or `#`\n */\nexport function mergeContents({\n src,\n newSrc,\n tag,\n anchor,\n offset,\n comment,\n}: {\n src: string;\n newSrc: string;\n tag: string;\n anchor: string | RegExp;\n offset: number;\n comment: string;\n}): MergeResults {\n const header = createGeneratedHeaderComment(newSrc, tag, comment);\n if (!src.includes(header)) {\n // Ensure the old generated contents are removed.\n const sanitizedTarget = removeGeneratedContents(src, tag);\n return {\n contents: addLines(sanitizedTarget ?? src, anchor, offset, [\n header,\n ...newSrc.split('\\n'),\n `${comment} @generated end ${tag}`,\n ]),\n didMerge: true,\n didClear: !!sanitizedTarget,\n };\n }\n return { contents: src, didClear: false, didMerge: false };\n}\n\nexport function removeContents({ src, tag }: { src: string; tag: string }): MergeResults {\n // Ensure the old generated contents are removed.\n const sanitizedTarget = removeGeneratedContents(src, tag);\n return {\n contents: sanitizedTarget ?? src,\n didMerge: false,\n didClear: !!sanitizedTarget,\n };\n}\n\nfunction addLines(content: string, find: string | RegExp, offset: number, toAdd: string[]) {\n const lines = content.split('\\n');\n\n let lineIndex = lines.findIndex((line) => line.match(find));\n if (lineIndex < 0) {\n const error = new Error(`Failed to match \"${find}\" in contents:\\n${content}`);\n // @ts-ignore\n error.code = 'ERR_NO_MATCH';\n throw error;\n }\n for (const newLine of toAdd) {\n lines.splice(lineIndex + offset, 0, newLine);\n lineIndex++;\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Removes the generated section from a file, returns null when nothing can be removed.\n * This sways heavily towards not removing lines unless it's certain that modifications were not made manually.\n *\n * @param src\n */\nexport function removeGeneratedContents(src: string, tag: string): string | null {\n const { contents, start, end } = getGeneratedSectionIndexes(src, tag);\n if (start > -1 && end > -1 && start < end) {\n contents.splice(start, end - start + 1);\n // TODO: We could in theory check that the contents we're removing match the hash used in the header,\n // this would ensure that we don't accidentally remove lines that someone added or removed from the generated section.\n return contents.join('\\n');\n }\n return null;\n}\n\nexport function createGeneratedHeaderComment(\n contents: string,\n tag: string,\n comment: string\n): string {\n const hashKey = createHash(contents);\n\n // Everything after the `${tag} ` is unversioned and can be freely modified without breaking changes.\n return `${comment} @generated begin ${tag} - expo prebuild (DO NOT MODIFY) ${hashKey}`;\n}\n\nexport function createHash(src: string): string {\n // this doesn't need to be secure, the shorter the better.\n const hash = crypto.createHash('sha1').update(src).digest('hex');\n return `sync-${hash}`;\n}\n"],"mappings":";;;;;;;;;;AAKA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4B;AAL5B;AACA;AACA;AACA;AACA;;AAGA,SAASA,0BAA0B,CACjCC,GAAW,EACXC,GAAW,EACyC;EACpD,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,IAAI,CAAC;EAChC,MAAMC,KAAK,GAAGF,QAAQ,CAACG,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACC,QAAQ,CAAE,oBAAmBN,GAAI,EAAC,CAAC,CAAC;EACpF,MAAMO,GAAG,GAAGN,QAAQ,CAACG,SAAS,CAAEC,IAAI,IAAKA,IAAI,CAACC,QAAQ,CAAE,kBAAiBN,GAAI,EAAC,CAAC,CAAC;EAEhF,OAAO;IAAEC,QAAQ;IAAEE,KAAK;IAAEI;EAAI,CAAC;AACjC;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAa,CAAC;EAC5BT,GAAG;EACHU,MAAM;EACNT,GAAG;EACHU,MAAM;EACNC,MAAM;EACNC;AAQF,CAAC,EAAgB;EACf,MAAMC,MAAM,GAAGC,4BAA4B,CAACL,MAAM,EAAET,GAAG,EAAEY,OAAO,CAAC;EACjE,IAAI,CAACb,GAAG,CAACO,QAAQ,CAACO,MAAM,CAAC,EAAE;IACzB;IACA,MAAME,eAAe,GAAGC,uBAAuB,CAACjB,GAAG,EAAEC,GAAG,CAAC;IACzD,OAAO;MACLC,QAAQ,EAAEgB,QAAQ,CAACF,eAAe,aAAfA,eAAe,cAAfA,eAAe,GAAIhB,GAAG,EAAEW,MAAM,EAAEC,MAAM,EAAE,CACzDE,MAAM,EACN,GAAGJ,MAAM,CAACP,KAAK,CAAC,IAAI,CA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,uBAAuB,CAACjB,GAAW,EAAEC,GAAW,EAAiB;EAC/E,MAAM;IAAEC,QAAQ;IAAEE,KAAK;IAAEI;EAAI,CAAC,GAAGT,0BAA0B,CAACC,GAAG,EAAEC,GAAG,CAAC;EACrE,IAAIG,KAAK,GAAG,CAAC,CAAC,IAAII,GAAG,GAAG,CAAC,CAAC,IAAIJ,KAAK,GAAGI,GAAG,EAAE;IACzCN,QAAQ,CAAC8B,MAAM,CAAC5B,KAAK,EAAEI,GAAG,GAAGJ,KAAK,GAAG,CAAC,CAAC;IACvC;IACA;IACA,OAAOF,QAAQ,CAAC+B,IAAI,CAAC,IAAI,CAAC;EAC5B;EACA,OAAO,IAAI;AACb;AAEO,SAASlB,4BAA4B,CAC1Cb,QAAgB,EAChBD,GAAW,EACXY,OAAe,EACP;EACR,MAAMqB,OAAO,GAAGC,UAAU,CAACjC,QAAQ,CAAC;;EAEpC;EACA,OAAQ,GAAEW,OAAQ,qBAAoBZ,GAAI,oCAAmCiC,OAAQ,EAAC;AACxF;AAEO,SAASC,UAAU,CAACnC,GAAW,EAAU;EAC9C;EACA,MAAMoC,IAAI,GAAGC,iBAAM,CAACF,UAAU,CAAC,MAAM,CAAC,CAACG,MAAM,CAACtC,GAAG,CAAC,CAACuC,MAAM,CAAC,KAAK,CAAC;EAChE,OAAQ,QAAOH,IAAK,EAAC;AACvB"}
@@ -1,6 +1,6 @@
1
1
  import { ExpoConfig } from '@expo/config-types';
2
2
  import { ModPlatform } from '../Plugin.types';
3
- export declare type PluginHistoryItem = {
3
+ export type PluginHistoryItem = {
4
4
  name: string;
5
5
  version: string;
6
6
  platform?: ModPlatform;
@@ -5,26 +5,20 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.addHistoryItem = addHistoryItem;
7
7
  exports.getHistoryItem = getHistoryItem;
8
-
9
8
  function getHistoryItem(config, name) {
10
9
  var _config$_internal$plu, _config$_internal, _config$_internal$plu2;
11
-
12
10
  return (_config$_internal$plu = (_config$_internal = config._internal) === null || _config$_internal === void 0 ? void 0 : (_config$_internal$plu2 = _config$_internal.pluginHistory) === null || _config$_internal$plu2 === void 0 ? void 0 : _config$_internal$plu2[name]) !== null && _config$_internal$plu !== void 0 ? _config$_internal$plu : null;
13
11
  }
14
-
15
12
  function addHistoryItem(config, item) {
16
13
  if (!config._internal) {
17
14
  config._internal = {};
18
15
  }
19
-
20
16
  if (!config._internal.pluginHistory) {
21
17
  config._internal.pluginHistory = {};
22
18
  }
23
-
24
19
  if (!item.version) {
25
20
  item.version = 'UNVERSIONED';
26
21
  }
27
-
28
22
  config._internal.pluginHistory[item.name] = item;
29
23
  return config;
30
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","names":["getHistoryItem","config","name","_internal","pluginHistory","addHistoryItem","item","version"],"sources":["../../src/utils/history.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ModPlatform } from '../Plugin.types';\n\nexport type PluginHistoryItem = {\n name: string;\n version: string;\n platform?: ModPlatform;\n};\n\nexport function getHistoryItem(\n config: Pick<ExpoConfig, '_internal'>,\n name: string\n): PluginHistoryItem | null {\n return config._internal?.pluginHistory?.[name] ?? null;\n}\n\nexport function addHistoryItem(\n config: ExpoConfig,\n item: Omit<PluginHistoryItem, 'version'> & { version?: string }\n): ExpoConfig {\n if (!config._internal) {\n config._internal = {};\n }\n if (!config._internal.pluginHistory) {\n config._internal.pluginHistory = {};\n }\n\n if (!item.version) {\n item.version = 'UNVERSIONED';\n }\n\n config._internal.pluginHistory[item.name] = item;\n\n return config;\n}\n"],"mappings":";;;;;;;;AAUO,SAASA,cAAT,CACLC,MADK,EAELC,IAFK,EAGqB;EAAA;;EAC1B,qDAAOD,MAAM,CAACE,SAAd,gFAAO,kBAAkBC,aAAzB,2DAAO,uBAAkCF,IAAlC,CAAP,yEAAkD,IAAlD;AACD;;AAEM,SAASG,cAAT,CACLJ,MADK,EAELK,IAFK,EAGO;EACZ,IAAI,CAACL,MAAM,CAACE,SAAZ,EAAuB;IACrBF,MAAM,CAACE,SAAP,GAAmB,EAAnB;EACD;;EACD,IAAI,CAACF,MAAM,CAACE,SAAP,CAAiBC,aAAtB,EAAqC;IACnCH,MAAM,CAACE,SAAP,CAAiBC,aAAjB,GAAiC,EAAjC;EACD;;EAED,IAAI,CAACE,IAAI,CAACC,OAAV,EAAmB;IACjBD,IAAI,CAACC,OAAL,GAAe,aAAf;EACD;;EAEDN,MAAM,CAACE,SAAP,CAAiBC,aAAjB,CAA+BE,IAAI,CAACJ,IAApC,IAA4CI,IAA5C;EAEA,OAAOL,MAAP;AACD"}
1
+ {"version":3,"file":"history.js","names":["getHistoryItem","config","name","_internal","pluginHistory","addHistoryItem","item","version"],"sources":["../../src/utils/history.ts"],"sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nimport { ModPlatform } from '../Plugin.types';\n\nexport type PluginHistoryItem = {\n name: string;\n version: string;\n platform?: ModPlatform;\n};\n\nexport function getHistoryItem(\n config: Pick<ExpoConfig, '_internal'>,\n name: string\n): PluginHistoryItem | null {\n return config._internal?.pluginHistory?.[name] ?? null;\n}\n\nexport function addHistoryItem(\n config: ExpoConfig,\n item: Omit<PluginHistoryItem, 'version'> & { version?: string }\n): ExpoConfig {\n if (!config._internal) {\n config._internal = {};\n }\n if (!config._internal.pluginHistory) {\n config._internal.pluginHistory = {};\n }\n\n if (!item.version) {\n item.version = 'UNVERSIONED';\n }\n\n config._internal.pluginHistory[item.name] = item;\n\n return config;\n}\n"],"mappings":";;;;;;;AAUO,SAASA,cAAc,CAC5BC,MAAqC,EACrCC,IAAY,EACc;EAAA;EAC1B,qDAAOD,MAAM,CAACE,SAAS,gFAAhB,kBAAkBC,aAAa,2DAA/B,uBAAkCF,IAAI,CAAC,yEAAI,IAAI;AACxD;AAEO,SAASG,cAAc,CAC5BJ,MAAkB,EAClBK,IAA+D,EACnD;EACZ,IAAI,CAACL,MAAM,CAACE,SAAS,EAAE;IACrBF,MAAM,CAACE,SAAS,GAAG,CAAC,CAAC;EACvB;EACA,IAAI,CAACF,MAAM,CAACE,SAAS,CAACC,aAAa,EAAE;IACnCH,MAAM,CAACE,SAAS,CAACC,aAAa,GAAG,CAAC,CAAC;EACrC;EAEA,IAAI,CAACE,IAAI,CAACC,OAAO,EAAE;IACjBD,IAAI,CAACC,OAAO,GAAG,aAAa;EAC9B;EAEAN,MAAM,CAACE,SAAS,CAACC,aAAa,CAACE,IAAI,CAACJ,IAAI,CAAC,GAAGI,IAAI;EAEhD,OAAOL,MAAM;AACf"}
@@ -1,7 +1,7 @@
1
1
  declare const LEFT_BRACKETS: readonly ["(", "{"];
2
2
  declare const RIGHT_BRACKETS: readonly [")", "}"];
3
- declare type LeftBracket = typeof LEFT_BRACKETS[number];
4
- declare type RightBracket = typeof RIGHT_BRACKETS[number];
5
- declare type Bracket = LeftBracket | RightBracket;
3
+ type LeftBracket = typeof LEFT_BRACKETS[number];
4
+ type RightBracket = typeof RIGHT_BRACKETS[number];
5
+ type Bracket = LeftBracket | RightBracket;
6
6
  export declare function findMatchingBracketPosition(contents: string, bracket: Bracket, offset?: number): number;
7
7
  export {};
@@ -6,31 +6,25 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.findMatchingBracketPosition = findMatchingBracketPosition;
7
7
  const LEFT_BRACKETS = ['(', '{'];
8
8
  const RIGHT_BRACKETS = [')', '}'];
9
-
10
9
  function findMatchingBracketPosition(contents, bracket, offset = 0) {
11
10
  // search first occurrence of `bracket`
12
11
  const firstBracketPos = contents.indexOf(bracket, offset);
13
-
14
12
  if (firstBracketPos < 0) {
15
13
  return -1;
16
14
  }
17
-
18
15
  let stackCounter = 0;
19
16
  const matchingBracket = getMatchingBracket(bracket);
20
-
21
17
  if (isLeftBracket(bracket)) {
22
- const contentsLength = contents.length; // search forward
23
-
18
+ const contentsLength = contents.length;
19
+ // search forward
24
20
  for (let i = firstBracketPos + 1; i < contentsLength; ++i) {
25
21
  const c = contents[i];
26
-
27
22
  if (c === bracket) {
28
23
  stackCounter += 1;
29
24
  } else if (c === matchingBracket) {
30
25
  if (stackCounter === 0) {
31
26
  return i;
32
27
  }
33
-
34
28
  stackCounter -= 1;
35
29
  }
36
30
  }
@@ -38,41 +32,32 @@ function findMatchingBracketPosition(contents, bracket, offset = 0) {
38
32
  // search backward
39
33
  for (let i = firstBracketPos - 1; i >= 0; --i) {
40
34
  const c = contents[i];
41
-
42
35
  if (c === bracket) {
43
36
  stackCounter += 1;
44
37
  } else if (c === matchingBracket) {
45
38
  if (stackCounter === 0) {
46
39
  return i;
47
40
  }
48
-
49
41
  stackCounter -= 1;
50
42
  }
51
43
  }
52
44
  }
53
-
54
45
  return -1;
55
46
  }
56
-
57
47
  function isLeftBracket(bracket) {
58
48
  const leftBracketList = LEFT_BRACKETS;
59
49
  return leftBracketList.includes(bracket);
60
50
  }
61
-
62
51
  function getMatchingBracket(bracket) {
63
52
  switch (bracket) {
64
53
  case '(':
65
54
  return ')';
66
-
67
55
  case ')':
68
56
  return '(';
69
-
70
57
  case '{':
71
58
  return '}';
72
-
73
59
  case '}':
74
60
  return '{';
75
-
76
61
  default:
77
62
  throw new Error(`Unsupported bracket - ${bracket}`);
78
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"matchBrackets.js","names":["LEFT_BRACKETS","RIGHT_BRACKETS","findMatchingBracketPosition","contents","bracket","offset","firstBracketPos","indexOf","stackCounter","matchingBracket","getMatchingBracket","isLeftBracket","contentsLength","length","i","c","leftBracketList","includes","Error"],"sources":["../../src/utils/matchBrackets.ts"],"sourcesContent":["const LEFT_BRACKETS = ['(', '{'] as const;\nconst RIGHT_BRACKETS = [')', '}'] as const;\n\ntype LeftBracket = typeof LEFT_BRACKETS[number];\ntype RightBracket = typeof RIGHT_BRACKETS[number];\ntype Bracket = LeftBracket | RightBracket;\n\nexport function findMatchingBracketPosition(\n contents: string,\n bracket: Bracket,\n offset: number = 0\n): number {\n // search first occurrence of `bracket`\n const firstBracketPos = contents.indexOf(bracket, offset);\n if (firstBracketPos < 0) {\n return -1;\n }\n\n let stackCounter = 0;\n const matchingBracket = getMatchingBracket(bracket);\n\n if (isLeftBracket(bracket)) {\n const contentsLength = contents.length;\n // search forward\n for (let i = firstBracketPos + 1; i < contentsLength; ++i) {\n const c = contents[i];\n if (c === bracket) {\n stackCounter += 1;\n } else if (c === matchingBracket) {\n if (stackCounter === 0) {\n return i;\n }\n stackCounter -= 1;\n }\n }\n } else {\n // search backward\n for (let i = firstBracketPos - 1; i >= 0; --i) {\n const c = contents[i];\n if (c === bracket) {\n stackCounter += 1;\n } else if (c === matchingBracket) {\n if (stackCounter === 0) {\n return i;\n }\n stackCounter -= 1;\n }\n }\n }\n\n return -1;\n}\n\nfunction isLeftBracket(bracket: Bracket): boolean {\n const leftBracketList: readonly Bracket[] = LEFT_BRACKETS;\n return leftBracketList.includes(bracket);\n}\n\nfunction getMatchingBracket(bracket: Bracket): Bracket {\n switch (bracket) {\n case '(':\n return ')';\n case ')':\n return '(';\n case '{':\n return '}';\n case '}':\n return '{';\n default:\n throw new Error(`Unsupported bracket - ${bracket}`);\n }\n}\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,CAAC,GAAD,EAAM,GAAN,CAAtB;AACA,MAAMC,cAAc,GAAG,CAAC,GAAD,EAAM,GAAN,CAAvB;;AAMO,SAASC,2BAAT,CACLC,QADK,EAELC,OAFK,EAGLC,MAAc,GAAG,CAHZ,EAIG;EACR;EACA,MAAMC,eAAe,GAAGH,QAAQ,CAACI,OAAT,CAAiBH,OAAjB,EAA0BC,MAA1B,CAAxB;;EACA,IAAIC,eAAe,GAAG,CAAtB,EAAyB;IACvB,OAAO,CAAC,CAAR;EACD;;EAED,IAAIE,YAAY,GAAG,CAAnB;EACA,MAAMC,eAAe,GAAGC,kBAAkB,CAACN,OAAD,CAA1C;;EAEA,IAAIO,aAAa,CAACP,OAAD,CAAjB,EAA4B;IAC1B,MAAMQ,cAAc,GAAGT,QAAQ,CAACU,MAAhC,CAD0B,CAE1B;;IACA,K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":3,"file":"matchBrackets.js","names":["LEFT_BRACKETS","RIGHT_BRACKETS","findMatchingBracketPosition","contents","bracket","offset","firstBracketPos","indexOf","stackCounter","matchingBracket","getMatchingBracket","isLeftBracket","contentsLength","length","i","c","leftBracketList","includes","Error"],"sources":["../../src/utils/matchBrackets.ts"],"sourcesContent":["const LEFT_BRACKETS = ['(', '{'] as const;\nconst RIGHT_BRACKETS = [')', '}'] as const;\n\ntype LeftBracket = typeof LEFT_BRACKETS[number];\ntype RightBracket = typeof RIGHT_BRACKETS[number];\ntype Bracket = LeftBracket | RightBracket;\n\nexport function findMatchingBracketPosition(\n contents: string,\n bracket: Bracket,\n offset: number = 0\n): number {\n // search first occurrence of `bracket`\n const firstBracketPos = contents.indexOf(bracket, offset);\n if (firstBracketPos < 0) {\n return -1;\n }\n\n let stackCounter = 0;\n const matchingBracket = getMatchingBracket(bracket);\n\n if (isLeftBracket(bracket)) {\n const contentsLength = contents.length;\n // search forward\n for (let i = firstBracketPos + 1; i < contentsLength; ++i) {\n const c = contents[i];\n if (c === bracket) {\n stackCounter += 1;\n } else if (c === matchingBracket) {\n if (stackCounter === 0) {\n return i;\n }\n stackCounter -= 1;\n }\n }\n } else {\n // search backward\n for (let i = firstBracketPos - 1; i >= 0; --i) {\n const c = contents[i];\n if (c === bracket) {\n stackCounter += 1;\n } else if (c === matchingBracket) {\n if (stackCounter === 0) {\n return i;\n }\n stackCounter -= 1;\n }\n }\n }\n\n return -1;\n}\n\nfunction isLeftBracket(bracket: Bracket): boolean {\n const leftBracketList: readonly Bracket[] = LEFT_BRACKETS;\n return leftBracketList.includes(bracket);\n}\n\nfunction getMatchingBracket(bracket: Bracket): Bracket {\n switch (bracket) {\n case '(':\n return ')';\n case ')':\n return '(';\n case '{':\n return '}';\n case '}':\n return '{';\n default:\n throw new Error(`Unsupported bracket - ${bracket}`);\n }\n}\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,CAAU;AACzC,MA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AAC;AACX;AAEA,SAASG,aAAa,CAACP,OAAgB,EAAW;EAChD,MAAMY,eAAmC,GAAGhB,aAAa;EACzD,OAAOgB,eAAe,CAACC,QAAQ,CAACb,OAAO,CAAC;AAC1C;AAEA,SAASM,kBAAkB,CAACN,OAAgB,EAAW;EACrD,QAAQA,OAAO;IACb,KAAK,GAAG;MACN,OAAO,GAAG;IACZ,KAAK,GAAG;MACN,OAAO,GAAG;IACZ,KAAK,GAAG;MACN,OAAO,GAAG;IACZ,KAAK,GAAG;MACN,OAAO,GAAG;IACZ;MACE,MAAM,IAAIc,KAAK,CAAE,yBAAwBd,OAAQ,EAAC,CAAC;EAAC;AAE1D"}
@@ -6,19 +6,14 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.directoryExistsAsync = directoryExistsAsync;
7
7
  exports.fileExists = fileExists;
8
8
  exports.fileExistsAsync = fileExistsAsync;
9
-
10
9
  function _fs() {
11
10
  const data = _interopRequireDefault(require("fs"));
12
-
13
11
  _fs = function () {
14
12
  return data;
15
13
  };
16
-
17
14
  return data;
18
15
  }
19
-
20
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
-
22
17
  /**
23
18
  * A non-failing version of async FS stat.
24
19
  *
@@ -31,19 +26,14 @@ async function statAsync(file) {
31
26
  return null;
32
27
  }
33
28
  }
34
-
35
29
  async function fileExistsAsync(file) {
36
30
  var _await$statAsync$isFi, _await$statAsync;
37
-
38
31
  return (_await$statAsync$isFi = (_await$statAsync = await statAsync(file)) === null || _await$statAsync === void 0 ? void 0 : _await$statAsync.isFile()) !== null && _await$statAsync$isFi !== void 0 ? _await$statAsync$isFi : false;
39
32
  }
40
-
41
33
  async function directoryExistsAsync(file) {
42
34
  var _await$statAsync$isDi, _await$statAsync2;
43
-
44
35
  return (_await$statAsync$isDi = (_await$statAsync2 = await statAsync(file)) === null || _await$statAsync2 === void 0 ? void 0 : _await$statAsync2.isDirectory()) !== null && _await$statAsync$isDi !== void 0 ? _await$statAsync$isDi : false;
45
36
  }
46
-
47
37
  function fileExists(file) {
48
38
  try {
49
39
  return _fs().default.statSync(file).isFile();
@@ -1 +1 @@
1
- {"version":3,"file":"modules.js","names":["statAsync","file","fs","promises","stat","fileExistsAsync","isFile","directoryExistsAsync","isDirectory","fileExists","statSync"],"sources":["../../src/utils/modules.ts"],"sourcesContent":["import fs from 'fs';\n\n/**\n * A non-failing version of async FS stat.\n *\n * @param file\n */\nasync function statAsync(file: string): Promise<fs.Stats | null> {\n try {\n return await fs.promises.stat(file);\n } catch {\n return null;\n }\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await statAsync(file))?.isFile() ?? false;\n}\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await statAsync(file))?.isDirectory() ?? false;\n}\n\nexport function fileExists(file: string): boolean {\n try {\n return fs.statSync(file).isFile();\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAeA,SAAf,CAAyBC,IAAzB,EAAiE;EAC/D,IAAI;IACF,OAAO,MAAMC,aAAA,CAAGC,QAAH,CAAYC,IAAZ,CAAiBH,IAAjB,CAAb;EACD,CAFD,CAEE,MAAM;IACN,OAAO,IAAP;EACD;AACF;;AAEM,eAAeI,eAAf,CAA+BJ,IAA/B,EAA+D;EAAA;;EACpE,oDAAQ,MAAMD,SAAS,CAACC,IAAD,CAAvB,qDAAO,iBAAyBK,MAAzB,EAAP,yEAA4C,KAA5C;AACD;;AAEM,eAAeC,oBAAf,CAAoCN,IAApC,EAAoE;EAAA;;EACzE,qDAAQ,MAAMD,SAAS,CAACC,IAAD,CAAvB,sDAAO,kBAAyBO,WAAzB,EAAP,yEAAiD,KAAjD;AACD;;AAEM,SAASC,UAAT,CAAoBR,IAApB,EAA2C;EAChD,IAAI;IACF,OAAOC,aAAA,CAAGQ,QAAH,CAAYT,IAAZ,EAAkBK,MAAlB,EAAP;EACD,CAFD,CAEE,MAAM;IACN,OAAO,KAAP;EACD;AACF"}
1
+ {"version":3,"file":"modules.js","names":["statAsync","file","fs","promises","stat","fileExistsAsync","isFile","directoryExistsAsync","isDirectory","fileExists","statSync"],"sources":["../../src/utils/modules.ts"],"sourcesContent":["import fs from 'fs';\n\n/**\n * A non-failing version of async FS stat.\n *\n * @param file\n */\nasync function statAsync(file: string): Promise<fs.Stats | null> {\n try {\n return await fs.promises.stat(file);\n } catch {\n return null;\n }\n}\n\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await statAsync(file))?.isFile() ?? false;\n}\n\nexport async function directoryExistsAsync(file: string): Promise<boolean> {\n return (await statAsync(file))?.isDirectory() ?? false;\n}\n\nexport function fileExists(file: string): boolean {\n try {\n return fs.statSync(file).isFile();\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAoB;AAEpB;AACA;AACA;AACA;AACA;AACA,eAAeA,SAAS,CAACC,IAAY,EAA4B;EAC/D,IAAI;IACF,OAAO,MAAMC,aAAE,CAACC,QAAQ,CAACC,IAAI,CAACH,IAAI,CAAC;EACrC,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF;AAEO,eAAeI,eAAe,CAACJ,IAAY,EAAoB;EAAA;EACpE,oDAAQ,MAAMD,SAAS,CAACC,IAAI,CAAC,qDAAtB,iBAAyBK,MAAM,EAAE,yEAAI,KAAK;AACnD;AAEO,eAAeC,oBAAoB,CAACN,IAAY,EAAoB;EAAA;EACzE,qDAAQ,MAAMD,SAAS,CAACC,IAAI,CAAC,sDAAtB,kBAAyBO,WAAW,EAAE,yEAAI,KAAK;AACxD;AAEO,SAASC,UAAU,CAACR,IAAY,EAAW;EAChD,IAAI;IACF,OAAOC,aAAE,CAACQ,QAAQ,CAACT,IAAI,CAAC,CAACK,MAAM,EAAE;EACnC,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF"}
@@ -4,21 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.get = get;
7
-
8
7
  /** `lodash.get` */
9
8
  function get(obj, key) {
10
9
  const branches = key.split('.');
11
10
  let current = obj;
12
11
  let branch;
13
-
14
12
  while (branch = branches.shift()) {
15
13
  if (!(branch in current)) {
16
14
  return undefined;
17
15
  }
18
-
19
16
  current = current[branch];
20
17
  }
21
-
22
18
  return current;
23
19
  }
24
20
  //# sourceMappingURL=obj.js.map