@nx/expo 21.4.0-beta.10 → 21.4.0-beta.12

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 (60) hide show
  1. package/.eslintrc.json +2 -1
  2. package/migrations.json +91 -0
  3. package/package.json +12 -14
  4. package/plugins/metro-resolver.d.ts.map +1 -1
  5. package/plugins/metro-resolver.js +25 -8
  6. package/plugins/with-nx-metro.d.ts +2 -2
  7. package/plugins/with-nx-metro.d.ts.map +1 -1
  8. package/plugins/with-nx-metro.js +18 -2
  9. package/src/generators/application/application.js +1 -1
  10. package/src/generators/application/files/base/app.json.template +20 -18
  11. package/src/generators/application/files/base/assets/fonts/.gitkeep +0 -0
  12. package/src/generators/application/files/base/assets/images/splash-icon.png +0 -0
  13. package/src/generators/application/files/base/package.json.template +9 -2
  14. package/src/generators/application/files/base/tsconfig.app.json.template +1 -1
  15. package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
  16. package/src/generators/application/lib/add-e2e.js +2 -2
  17. package/src/generators/application/lib/add-project.d.ts.map +1 -1
  18. package/src/generators/application/lib/add-project.js +2 -0
  19. package/src/generators/application/schema.json +2 -0
  20. package/src/generators/init/init.d.ts.map +1 -1
  21. package/src/generators/init/init.js +2 -0
  22. package/src/generators/library/library.d.ts.map +1 -1
  23. package/src/generators/library/library.js +6 -4
  24. package/src/generators/library/schema.json +3 -1
  25. package/src/migrations/update-21-4-0/add-jest-resolver.d.ts +3 -0
  26. package/src/migrations/update-21-4-0/add-jest-resolver.d.ts.map +1 -0
  27. package/src/migrations/update-21-4-0/add-jest-resolver.js +59 -0
  28. package/src/migrations/update-21-4-0/remove-deprecated-deps.d.ts +6 -0
  29. package/src/migrations/update-21-4-0/remove-deprecated-deps.d.ts.map +1 -0
  30. package/src/migrations/update-21-4-0/remove-deprecated-deps.js +30 -0
  31. package/src/migrations/update-21-4-0/update-splash-screen-config.d.ts +8 -0
  32. package/src/migrations/update-21-4-0/update-splash-screen-config.d.ts.map +1 -0
  33. package/src/migrations/update-21-4-0/update-splash-screen-config.js +186 -0
  34. package/src/utils/add-linting.d.ts +1 -0
  35. package/src/utils/add-linting.d.ts.map +1 -1
  36. package/src/utils/add-linting.js +26 -0
  37. package/src/utils/ensure-dependencies.d.ts.map +1 -1
  38. package/src/utils/ensure-dependencies.js +1 -3
  39. package/src/utils/expo-project-detection.d.ts +7 -0
  40. package/src/utils/expo-project-detection.d.ts.map +1 -0
  41. package/src/utils/expo-project-detection.js +88 -0
  42. package/src/utils/{add-jest.d.ts → jest/add-jest.d.ts} +1 -1
  43. package/src/utils/jest/add-jest.d.ts.map +1 -0
  44. package/src/utils/jest/add-jest.js +59 -0
  45. package/src/utils/jest/files/jest.resolver.js +15 -0
  46. package/src/utils/pod-install-task.d.ts +1 -0
  47. package/src/utils/pod-install-task.d.ts.map +1 -1
  48. package/src/utils/pod-install-task.js +1 -0
  49. package/src/utils/update-tsconfig-files.d.ts +3 -0
  50. package/src/utils/update-tsconfig-files.d.ts.map +1 -0
  51. package/src/utils/update-tsconfig-files.js +45 -0
  52. package/src/utils/versions.d.ts +19 -19
  53. package/src/utils/versions.d.ts.map +1 -1
  54. package/src/utils/versions.js +20 -20
  55. package/src/generators/application/files/base/assets/splash.png +0 -0
  56. package/src/utils/add-jest.d.ts.map +0 -1
  57. package/src/utils/add-jest.js +0 -48
  58. /package/src/generators/application/files/base/assets/{adaptive-icon.png → images/adaptive-icon.png} +0 -0
  59. /package/src/generators/application/files/base/assets/{favicon.png → images/favicon.png} +0 -0
  60. /package/src/generators/application/files/base/assets/{icon.png → images/icon.png} +0 -0
package/.eslintrc.json CHANGED
@@ -24,9 +24,10 @@
24
24
  {
25
25
  "buildTargets": ["build-base"],
26
26
  "ignoredDependencies": [
27
- "tslib",
28
27
  "nx",
28
+ "@nx/jest",
29
29
  "@nx/rollup",
30
+ "@nx/web",
30
31
  "@nx/webpack",
31
32
  "@nx/cypress",
32
33
  "@nx/playwright",
package/migrations.json CHANGED
@@ -17,6 +17,24 @@
17
17
  "cli": "nx",
18
18
  "description": "Remove eas-build-pre-install script from app's package.json",
19
19
  "factory": "./src/migrations/update-19-7-0/remove-eas-pre-install"
20
+ },
21
+ "update-21-4-0-remove-deprecated-deps": {
22
+ "version": "21.4.0-beta.0",
23
+ "cli": "nx",
24
+ "description": "Remove deprecated dependencies from package.json",
25
+ "factory": "./src/migrations/update-21-4-0/remove-deprecated-deps"
26
+ },
27
+ "update-21-4-0-update-splash-screen-config": {
28
+ "version": "21.4.0-beta.0",
29
+ "cli": "nx",
30
+ "description": "Update Expo splash screen configuration to use the new format",
31
+ "factory": "./src/migrations/update-21-4-0/update-splash-screen-config"
32
+ },
33
+ "update-21-4-0-add-jest-resolver": {
34
+ "version": "21.4.0-beta.0",
35
+ "cli": "nx",
36
+ "description": "Add custom Jest resolver to handle Expo winter runtime issues",
37
+ "factory": "./src/migrations/update-21-4-0/add-jest-resolver"
20
38
  }
21
39
  },
22
40
  "packageJsonUpdates": {
@@ -210,6 +228,79 @@
210
228
  "alwaysAddToPackageJson": false
211
229
  }
212
230
  }
231
+ },
232
+ "21.4.0": {
233
+ "version": "21.4.0-beta.0",
234
+ "packages": {
235
+ "expo": {
236
+ "version": "~53.0.10",
237
+ "alwaysAddToPackageJson": false
238
+ },
239
+ "expo-splash-screen": {
240
+ "version": "~0.30.9",
241
+ "alwaysAddToPackageJson": false
242
+ },
243
+ "expo-status-bar": {
244
+ "version": "~2.2.3",
245
+ "alwaysAddToPackageJson": false
246
+ },
247
+ "@expo/cli": {
248
+ "version": "~0.24.14",
249
+ "alwaysAddToPackageJson": false
250
+ },
251
+ "babel-preset-expo": {
252
+ "version": "~13.2.0",
253
+ "alwaysAddToPackageJson": false
254
+ },
255
+ "react": {
256
+ "version": "19.0.0",
257
+ "alwaysAddToPackageJson": false
258
+ },
259
+ "react-dom": {
260
+ "version": "19.0.0",
261
+ "alwaysAddToPackageJson": false
262
+ },
263
+ "@types/react": {
264
+ "version": "~19.0.10",
265
+ "alwaysAddToPackageJson": false
266
+ },
267
+ "react-native": {
268
+ "version": "~0.79.3",
269
+ "alwaysAddToPackageJson": false
270
+ },
271
+ "react-native-web": {
272
+ "version": "~0.20.0",
273
+ "alwaysAddToPackageJson": false
274
+ },
275
+ "@expo/metro-config": {
276
+ "version": "~0.20.14",
277
+ "alwaysAddToPackageJson": false
278
+ },
279
+ "@expo/metro-runtime": {
280
+ "version": "~5.0.4",
281
+ "alwaysAddToPackageJson": false
282
+ },
283
+ "react-native-svg-transformer": {
284
+ "version": "~1.5.1",
285
+ "alwaysAddToPackageJson": false
286
+ },
287
+ "react-native-svg": {
288
+ "version": "~15.11.2",
289
+ "alwaysAddToPackageJson": false
290
+ },
291
+ "@testing-library/react-native": {
292
+ "version": "~13.2.0",
293
+ "alwaysAddToPackageJson": false
294
+ },
295
+ "jest-expo": {
296
+ "version": "~53.0.7",
297
+ "alwaysAddToPackageJson": false
298
+ },
299
+ "@babel/runtime": {
300
+ "version": "~7.27.6",
301
+ "alwaysAddToPackageJson": false
302
+ }
303
+ }
213
304
  }
214
305
  }
215
306
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/expo",
3
- "version": "21.4.0-beta.10",
3
+ "version": "21.4.0-beta.12",
4
4
  "private": false,
5
5
  "description": "The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.",
6
6
  "keywords": [
@@ -28,24 +28,22 @@
28
28
  "main": "./index.js",
29
29
  "types": "index.d.ts",
30
30
  "dependencies": {
31
- "@nx/detox": "21.4.0-beta.10",
32
- "@nx/devkit": "21.4.0-beta.10",
33
- "@nx/eslint": "21.4.0-beta.10",
34
- "@nx/jest": "21.4.0-beta.10",
35
- "@nx/js": "21.4.0-beta.10",
36
- "@nx/react": "21.4.0-beta.10",
37
- "@nx/rollup": "21.4.0-beta.10",
38
- "@nx/web": "21.4.0-beta.10",
39
- "@nx/webpack": "21.4.0-beta.10",
31
+ "@nx/devkit": "21.4.0-beta.12",
32
+ "@nx/eslint": "21.4.0-beta.12",
33
+ "@nx/js": "21.4.0-beta.12",
34
+ "@nx/react": "21.4.0-beta.12",
40
35
  "enhanced-resolve": "^5.8.3",
41
- "metro-config": "~0.80.4",
42
- "metro-resolver": "~0.80.4",
43
36
  "picocolors": "^1.1.0",
44
37
  "tsconfig-paths": "^4.1.2",
45
38
  "tslib": "^2.3.0"
46
39
  },
47
- "devDepndencies": {
48
- "nx": "workspace:*"
40
+ "peerDependencies": {
41
+ "metro-config": ">= 0.82.0",
42
+ "metro-resolver": ">= 0.82.0"
43
+ },
44
+ "optionalDependencies": {
45
+ "@nx/detox": "21.4.0-beta.12",
46
+ "@nx/rollup": "21.4.0-beta.12"
49
47
  },
50
48
  "executors": "./executors.json",
51
49
  "ng-update": {
@@ -1 +1 @@
1
- {"version":3,"file":"metro-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/expo/plugins/metro-resolver.ts"],"names":[],"mappings":"AAeA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAAE,EACpB,qBAAqB,GAAE,MAAM,EAAO,EACpC,UAAU,GAAE,MAAM,EAAO,IAGvB,UAAU,GAAG,EACb,gBAAgB,MAAM,EACtB,UAAU,MAAM,GAAG,IAAI,SAwC1B"}
1
+ {"version":3,"file":"metro-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/expo/plugins/metro-resolver.ts"],"names":[],"mappings":"AAiCA,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAAE,EACpB,qBAAqB,GAAE,MAAM,EAAO,EACpC,UAAU,GAAE,MAAM,EAAO,IAGvB,UAAU,GAAG,EACb,gBAAgB,MAAM,EACtB,UAAU,MAAM,GAAG,IAAI,SAwC1B"}
@@ -1,13 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getResolveRequest = getResolveRequest;
4
- const metroResolver = require("metro-resolver");
5
4
  const tsconfig_paths_1 = require("tsconfig-paths");
6
5
  const pc = require("picocolors");
7
6
  const enhanced_resolve_1 = require("enhanced-resolve");
8
7
  const path_1 = require("path");
9
8
  const fs = require("fs");
10
9
  const devkit_1 = require("@nx/devkit");
10
+ // Cache for metro-resolver module
11
+ let metroResolver = null;
12
+ /**
13
+ * Lazily require metro-resolver to handle cases where it might not be installed
14
+ */
15
+ function getMetroResolver() {
16
+ if (!metroResolver) {
17
+ try {
18
+ metroResolver = require('metro-resolver');
19
+ }
20
+ catch (error) {
21
+ throw new Error('metro-resolver is required but not installed. Please install metro-resolver >= 0.82.0');
22
+ }
23
+ }
24
+ return metroResolver;
25
+ }
11
26
  /*
12
27
  * Use tsconfig to resolve additional workspace libs.
13
28
  *
@@ -46,7 +61,8 @@ function resolveRequestFromContext(resolveRequest, context, realModuleName, plat
46
61
  */
47
62
  function defaultMetroResolver(context, realModuleName, platform, debug) {
48
63
  try {
49
- return metroResolver.resolve(context, realModuleName, platform);
64
+ const resolver = getMetroResolver();
65
+ return resolver.resolve(context, realModuleName, platform);
50
66
  }
51
67
  catch {
52
68
  if (debug)
@@ -60,7 +76,7 @@ function defaultMetroResolver(context, realModuleName, platform, debug) {
60
76
  */
61
77
  function pnpmResolver(extensions, context, realModuleName, debug, exportsConditionNames = [], mainFields = []) {
62
78
  try {
63
- const pnpmResolve = getPnpmResolver(extensions);
79
+ const pnpmResolve = getPnpmResolver(extensions, exportsConditionNames, mainFields);
64
80
  const lookupStartPath = (0, path_1.dirname)(context.originModulePath);
65
81
  const filePath = pnpmResolve.resolveSync({}, lookupStartPath, realModuleName);
66
82
  if (filePath) {
@@ -80,7 +96,8 @@ function tsconfigPathsResolver(context, extensions, realModuleName, platform, de
80
96
  try {
81
97
  const tsConfigPathMatcher = getMatcher(debug);
82
98
  const match = tsConfigPathMatcher(realModuleName, undefined, undefined, extensions.map((ext) => `.${ext}`));
83
- return metroResolver.resolve(context, match, platform);
99
+ const resolver = getMetroResolver();
100
+ return resolver.resolve(context, match, platform);
84
101
  }
85
102
  catch {
86
103
  if (debug) {
@@ -115,15 +132,15 @@ function getMatcher(debug) {
115
132
  * This function returns resolver for pnpm.
116
133
  * It is inspired form https://github.com/vjpr/pnpm-expo-example/blob/main/packages/pnpm-expo-helper/util/make-resolver.js.
117
134
  */
118
- let resolver;
135
+ let pnpmpResolver;
119
136
  function getPnpmResolver(extensions, exportsConditionNames = [], mainFields = []) {
120
- if (!resolver) {
137
+ if (!pnpmpResolver) {
121
138
  // Create a filesystem adapter that matches enhanced-resolve's expected interface
122
139
  // The issue is that Node.js fs types allow withFileTypes: true, but enhanced-resolve expects withFileTypes?: false
123
140
  // This is compatible with the latest version of enhanced-resolve and is the intended way to use it.
124
141
  // See https://github.com/webpack/enhanced-resolve/commit/d55471f20c17bce4def0b53cfe0b7027e7b48d82
125
142
  const fileSystem = new enhanced_resolve_1.CachedInputFileSystem(fs, 4000);
126
- resolver = enhanced_resolve_1.ResolverFactory.createResolver({
143
+ pnpmpResolver = enhanced_resolve_1.ResolverFactory.createResolver({
127
144
  fileSystem,
128
145
  extensions: extensions.map((extension) => '.' + extension),
129
146
  useSyncFileSystemCalls: true,
@@ -141,5 +158,5 @@ function getPnpmResolver(extensions, exportsConditionNames = [], mainFields = []
141
158
  aliasFields: ['browser'],
142
159
  });
143
160
  }
144
- return resolver;
161
+ return pnpmpResolver;
145
162
  }
@@ -1,4 +1,4 @@
1
- import type { MetroConfig } from 'metro-config';
1
+ type MetroConfig = any;
2
2
  interface WithNxOptions {
3
3
  /**
4
4
  * Change this to true to see debugging info.
@@ -21,6 +21,6 @@ interface WithNxOptions {
21
21
  */
22
22
  mainFields?: string[];
23
23
  }
24
- export declare function withNxMetro(userConfig: MetroConfig, opts?: WithNxOptions): Promise<import("metro-config").ConfigT>;
24
+ export declare function withNxMetro(userConfig: MetroConfig, opts?: WithNxOptions): Promise<any>;
25
25
  export {};
26
26
  //# sourceMappingURL=with-nx-metro.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"with-nx-metro.d.ts","sourceRoot":"","sources":["../../../../packages/expo/plugins/with-nx-metro.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMhD,UAAU,aAAa;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAKxB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAsB,WAAW,CAC/B,UAAU,EAAE,WAAW,EACvB,IAAI,GAAE,aAAkB,2CAmCzB"}
1
+ {"version":3,"file":"with-nx-metro.d.ts","sourceRoot":"","sources":["../../../../packages/expo/plugins/with-nx-metro.ts"],"names":[],"mappings":"AAuBA,KAAK,WAAW,GAAG,GAAG,CAAC;AAIvB,UAAU,aAAa;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAKxB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAsB,WAAW,CAC/B,UAAU,EAAE,WAAW,EACvB,IAAI,GAAE,aAAkB,gBAoCzB"}
@@ -2,9 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.withNxMetro = withNxMetro;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const metro_config_1 = require("metro-config");
6
5
  const node_fs_1 = require("node:fs");
7
6
  const path_1 = require("path");
7
+ // Cache for metro-config module
8
+ let metroConfig = null;
9
+ /**
10
+ * Lazily require metro-config to handle cases where it might not be installed
11
+ */
12
+ function getMetroConfig() {
13
+ if (!metroConfig) {
14
+ try {
15
+ metroConfig = require('metro-config');
16
+ }
17
+ catch (error) {
18
+ throw new Error('metro-config is required but not installed. Please install metro-config >= 0.82.0');
19
+ }
20
+ }
21
+ return metroConfig;
22
+ }
8
23
  const metro_resolver_1 = require("./metro-resolver");
9
24
  async function withNxMetro(userConfig, opts = {}) {
10
25
  const extensions = ['', 'ts', 'tsx', 'js', 'jsx', 'json'];
@@ -27,5 +42,6 @@ async function withNxMetro(userConfig, opts = {}) {
27
42
  },
28
43
  watchFolders,
29
44
  };
30
- return (0, metro_config_1.mergeConfig)(userConfig, nxConfig);
45
+ const { mergeConfig } = getMetroConfig();
46
+ return mergeConfig(userConfig, nxConfig);
31
47
  }
@@ -6,7 +6,7 @@ const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
7
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
8
  const add_linting_1 = require("../../utils/add-linting");
9
- const add_jest_1 = require("../../utils/add-jest");
9
+ const add_jest_1 = require("../../utils/jest/add-jest");
10
10
  const normalize_options_1 = require("./lib/normalize-options");
11
11
  const init_1 = require("../init/init");
12
12
  const add_project_1 = require("./lib/add-project");
@@ -4,30 +4,23 @@
4
4
  "slug": "<%= projectName %>",
5
5
  "version": "1.0.0",
6
6
  "orientation": "portrait",
7
- "icon": "./assets/icon.png",
8
- "splash": {
9
- "image": "./assets/splash.png",
10
- "resizeMode": "contain",
11
- "backgroundColor": "#ffffff"
12
- },
13
- "updates": {
14
- "fallbackToCacheTimeout": 0
15
- },
16
- "assetBundlePatterns": [
17
- "**/*"
18
- ],
7
+ "icon": "./assets/images/icon.png",
8
+ "scheme": "<%= projectName %>",
9
+ "userInterfaceStyle": "automatic",
10
+ "newArchEnabled": true,
19
11
  "ios": {
20
12
  "supportsTablet": true
21
13
  },
22
14
  "android": {
23
15
  "adaptiveIcon": {
24
- "foregroundImage": "./assets/adaptive-icon.png",
25
- "backgroundColor": "#FFFFFF"
26
- }
16
+ "foregroundImage": "./assets/images/adaptive-icon.png",
17
+ "backgroundColor": "#ffffff"
18
+ },
19
+ "edgeToEdgeEnabled": true
27
20
  },
28
21
  "web": {
29
- "favicon": "./assets/favicon.png",
30
- "bundler": "metro"
22
+ "bundler": "metro",
23
+ "favicon": "./assets/images/favicon.png"
31
24
  },
32
25
  "plugins": [
33
26
  <% if (e2eTestRunner === 'detox') { %>
@@ -37,8 +30,17 @@
37
30
  "skipProguard": false,
38
31
  "subdomains": ["10.0.2.2", "localhost"]
39
32
  }
40
- ]
33
+ ],
41
34
  <% } %>
35
+ [
36
+ "expo-splash-screen",
37
+ {
38
+ "image": "./assets/images/splash-icon.png",
39
+ "imageWidth": 200,
40
+ "resizeMode": "contain",
41
+ "backgroundColor": "#ffffff"
42
+ }
43
+ ]
42
44
  ]
43
45
  }
44
46
  }
@@ -3,12 +3,19 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "dependencies": {
6
- "@testing-library/jest-native": "*",
6
+ "@expo/metro-config": "*",
7
7
  "@testing-library/react-native": "*",
8
+ "expo": "*",
9
+ "expo-splash-screen": "*",
10
+ "expo-status-bar": "*",
11
+ "expo-system-ui": "*",
12
+ "jest-expo": "*",
8
13
  "metro-config": "*",
14
+ "metro-resolver": "*",
15
+ "react": "*",
9
16
  "react-native": "*",
10
- "expo": "*",
11
17
  "react-native-svg": "*",
18
+ "react-native-svg-transformer": "*",
12
19
  "react-native-web": "*"
13
20
  },
14
21
  "scripts": {
@@ -16,5 +16,5 @@
16
16
  "**/*.spec.jsx",
17
17
  "src/test-setup.ts"
18
18
  ],
19
- "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
19
+ "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", ".expo/types/**/*.ts", "expo-env.d.ts"]
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA4I5B"}
1
+ {"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAGjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAiJ5B"}
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addE2e = addE2e;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
6
- const web_1 = require("@nx/web");
7
6
  const has_expo_plugin_1 = require("../../../utils/has-expo-plugin");
8
7
  const versions_1 = require("../../../utils/versions");
9
8
  async function addE2e(tree, options) {
10
9
  const hasPlugin = (0, has_expo_plugin_1.hasExpoPlugin)(tree);
11
10
  if (!hasPlugin) {
12
- await (0, web_1.webStaticServeGenerator)(tree, {
11
+ const { webStaticServeGenerator } = (0, devkit_1.ensurePackage)('@nx/web', versions_1.nxVersion);
12
+ await webStaticServeGenerator(tree, {
13
13
  buildTarget: `${options.projectName}:export`,
14
14
  targetName: 'serve-static',
15
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"add-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAiD/D"}
1
+ {"version":3,"file":"add-project.d.ts","sourceRoot":"","sources":["../../../../../../../packages/expo/src/generators/application/lib/add-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAEL,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAuD/D"}
@@ -16,7 +16,9 @@ function addProject(host, options) {
16
16
  targets: hasPlugin ? {} : getTargets(options),
17
17
  tags: options.parsedTags,
18
18
  };
19
+ const templatedPackageJson = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'));
19
20
  const packageJson = {
21
+ ...templatedPackageJson,
20
22
  name: options.importPath,
21
23
  version: '0.0.1',
22
24
  private: true,
@@ -45,6 +45,7 @@
45
45
  "type": "string",
46
46
  "enum": ["eslint", "none"],
47
47
  "default": "none",
48
+ "x-prompt": "Which linter would you like to use?",
48
49
  "x-priority": "important"
49
50
  },
50
51
  "unitTestRunner": {
@@ -52,6 +53,7 @@
52
53
  "enum": ["jest", "none"],
53
54
  "description": "Test runner to use for unit tests",
54
55
  "default": "none",
56
+ "x-prompt": "Which unit test runner would you like to use?",
55
57
  "x-priority": "important"
56
58
  },
57
59
  "tags": {
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAE3D;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAwDzE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAgB5D;AAMD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/init/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAcpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAE3D;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAwDzE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,qBAkB5D;AAMD,eAAe,iBAAiB,CAAC"}
@@ -63,6 +63,8 @@ function updateDependencies(host, schema) {
63
63
  }, {
64
64
  '@nx/expo': versions_1.nxVersion,
65
65
  '@expo/cli': versions_1.expoCliVersion,
66
+ 'metro-config': versions_1.metroVersion,
67
+ 'metro-resolver': versions_1.metroVersion,
66
68
  }, undefined, schema.keepExistingVersions);
67
69
  }
68
70
  function moveDependency(host) {
@@ -1 +1 @@
1
- {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAiBlC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAM5B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CA8G5B;AAuJD,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/expo/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAiBlC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAM5B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAiH5B;AAsJD,eAAe,oBAAoB,CAAC"}
@@ -6,7 +6,7 @@ const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
7
  const init_1 = require("../init/init");
8
8
  const add_linting_1 = require("../../utils/add-linting");
9
- const add_jest_1 = require("../../utils/add-jest");
9
+ const add_jest_1 = require("../../utils/jest/add-jest");
10
10
  const normalize_options_1 = require("./lib/normalize-options");
11
11
  const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
12
12
  const init_root_babel_config_1 = require("../../utils/init-root-babel-config");
@@ -60,8 +60,6 @@ async function expoLibraryGeneratorInternal(host, schema) {
60
60
  ],
61
61
  });
62
62
  tasks.push(lintTask);
63
- const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.projectRoot, options.js, options.skipPackageJson, options.addPlugin);
64
- tasks.push(jestTask);
65
63
  const relativeCwd = (0, artifact_name_and_directory_utils_1.getRelativeCwd)();
66
64
  const path = (0, devkit_1.joinPathFragments)(options.projectRoot, 'src/lib', options.fileName);
67
65
  const componentTask = await (0, component_1.expoComponentGenerator)(host, {
@@ -84,6 +82,11 @@ async function expoLibraryGeneratorInternal(host, schema) {
84
82
  }, options.linter === 'eslint'
85
83
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
86
84
  : undefined);
85
+ // Update Jest tsconfig after general tsconfig updates to ensure Jest resolver configuration is preserved
86
+ if (options.unitTestRunner === 'jest') {
87
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.projectRoot, options.js, options.skipPackageJson, options.addPlugin);
88
+ tasks.push(jestTask);
89
+ }
87
90
  (0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
88
91
  if (!options.skipFormat) {
89
92
  await (0, devkit_1.formatFiles)(host);
@@ -150,7 +153,6 @@ async function addProject(host, options) {
150
153
  name: options.projectName,
151
154
  format: ['cjs', 'esm'],
152
155
  style: 'none',
153
- js: options.js,
154
156
  skipFormat: true,
155
157
  }, external);
156
158
  (0, devkit_1.updateJson)(host, `${options.projectRoot}/package.json`, (json) => {
@@ -38,6 +38,7 @@
38
38
  "enum": ["jest", "none"],
39
39
  "description": "Test runner to use for unit tests.",
40
40
  "default": "none",
41
+ "x-prompt": "Which unit test runner would you like to use?",
41
42
  "x-priority": "important"
42
43
  },
43
44
  "tags": {
@@ -88,7 +89,8 @@
88
89
  "skipPackageJson": {
89
90
  "type": "boolean",
90
91
  "description": "Do not add dependencies to `package.json`.",
91
- "default": false
92
+ "default": false,
93
+ "x-priority": "internal"
92
94
  },
93
95
  "useProjectJson": {
94
96
  "type": "boolean",
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function addJestResolver(tree: Tree): Promise<void>;
3
+ //# sourceMappingURL=add-jest-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-jest-resolver.d.ts","sourceRoot":"","sources":["../../../../../../packages/expo/src/migrations/update-21-4-0/add-jest-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,IAAI,EAAE,MAAM,YAAY,CAAC;AAK5D,wBAA8B,eAAe,CAAC,IAAI,EAAE,IAAI,iBAgEvD"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = addJestResolver;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const path_1 = require("path");
6
+ const update_tsconfig_files_1 = require("../../utils/update-tsconfig-files");
7
+ const expo_project_detection_1 = require("../../utils/expo-project-detection");
8
+ async function addJestResolver(tree) {
9
+ const projects = (0, devkit_1.getProjects)(tree);
10
+ for (const [, config] of projects) {
11
+ if (config.targets?.test?.executor === '@nx/jest:jest') {
12
+ // Check if this is an Expo project
13
+ const expoProjectDetectionResult = (0, expo_project_detection_1.isExpoProject)(tree, config.root);
14
+ if (!(await expoProjectDetectionResult).isExpo) {
15
+ continue;
16
+ }
17
+ // Check if this is an Expo project by looking for jest.config file with expo preset
18
+ const jestConfigPath = (0, path_1.join)(config.root, 'jest.config.ts');
19
+ const jestConfigJsPath = (0, path_1.join)(config.root, 'jest.config.js');
20
+ let jestConfigContent = '';
21
+ let configPath = '';
22
+ if (tree.exists(jestConfigPath)) {
23
+ jestConfigContent = tree.read(jestConfigPath, 'utf-8');
24
+ configPath = jestConfigPath;
25
+ }
26
+ else if (tree.exists(jestConfigJsPath)) {
27
+ jestConfigContent = tree.read(jestConfigJsPath, 'utf-8');
28
+ configPath = jestConfigJsPath;
29
+ }
30
+ if (jestConfigContent && jestConfigContent.includes('jest-expo')) {
31
+ // This is an Expo project with Jest configuration
32
+ const resolverPath = (0, path_1.join)(config.root, 'jest.resolver.js');
33
+ // Create the custom resolver if it doesn't exist
34
+ if (!tree.exists(resolverPath)) {
35
+ const resolverContent = `const defaultResolver = require('@nx/jest/plugins/resolver');
36
+
37
+ module.exports = (request, options) => {
38
+ // Check if we're resolving from the winter directory and request is for runtime
39
+ if (options.basedir && options.basedir.includes('expo/src/winter') && request === './runtime') {
40
+ // Force resolution to non-native version to avoid runtime.native.ts
41
+ return defaultResolver('./runtime.ts', options);
42
+ }
43
+
44
+ return defaultResolver(request, options);
45
+ };`;
46
+ tree.write(resolverPath, resolverContent);
47
+ }
48
+ // Update Jest config to use custom resolver
49
+ if (configPath && jestConfigContent) {
50
+ const updatedConfig = jestConfigContent.replace(/resolver:\s*['"]@nx\/jest\/plugins\/resolver['"],?/, "resolver: require.resolve('./jest.resolver.js'),");
51
+ tree.write(configPath, updatedConfig);
52
+ }
53
+ // Update tsconfig files to handle jest.resolver.js properly
54
+ (0, update_tsconfig_files_1.updateTsConfigFiles)(tree, config.name, config.root);
55
+ }
56
+ }
57
+ }
58
+ await (0, devkit_1.formatFiles)(tree);
59
+ }
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * Remove deprecated dependencies from the root and app package.json.
4
+ */
5
+ export default function update(tree: Tree): void;
6
+ //# sourceMappingURL=remove-deprecated-deps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove-deprecated-deps.d.ts","sourceRoot":"","sources":["../../../../../../packages/expo/src/migrations/update-21-4-0/remove-deprecated-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAIL,MAAM,YAAY,CAAC;AAGpB;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,IAAI,EAAE,IAAI,QA4BxC"}