From eea36ea41c58ab2e27e85dac2c95d6d79e752dc9 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Wed, 4 Oct 2023 22:56:18 +0200 Subject: [PATCH 1/8] add @react-native-community/cli-platform-ios overrdies --- .../cli-platform-ios/overrides.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json diff --git a/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json b/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json new file mode 100644 index 0000000000..577520ce5d --- /dev/null +++ b/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json @@ -0,0 +1,13 @@ +{ + "overrides": { + "build/tools/listIOSDevices.js": { + "rawOutput.filter(device => !device.platform.includes('appletv') && !device.platform.includes('macos')).sort(device => device.simulator ? 1 : -1).map(device => {": "rawOutput.sort(device => device.simulator ? 1 : -1).map(device => { // <= PATCHED BY RENATIVE" + }, + "build/tools/findMatchingSimulator.js": { + "if (!version.includes('iOS')) {": "if (!version.includes('iOS') && !version.includes('tvOS')) { // <= PATCHED BY RENATIVE" + }, + "build/commands/runIOS/index.js": { + "if (device.type === 'simulator') {\n if (selectedDevice.type === 'simulator') {return runOnSimulator(xcodeProject, scheme, modifiedArgs);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs, device); // <= PATCHED BY RENATIVE" + } + } +} \ No newline at end of file From 690273dd6714437e99354ba9b0e0d482e9f39fee Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 00:55:05 +0200 Subject: [PATCH 2/8] rn cli patches and fixes --- packages/core/src/configs/index.ts | 4 ++-- packages/core/src/context/defaults.ts | 7 ++++++- packages/core/src/context/types.ts | 7 ++++++- packages/core/src/plugins/index.ts | 10 +++++----- packages/core/src/templates/index.ts | 2 +- packages/sdk-apple/package.json | 3 +-- .../cli-platform-ios/overrides.json | 2 +- packages/template-starter/package.json | 4 +--- packages/template-starter/renative.json | 18 ++++++------------ yarn.lock | 4 ++-- 10 files changed, 31 insertions(+), 30 deletions(-) diff --git a/packages/core/src/configs/index.ts b/packages/core/src/configs/index.ts index a78558877f..6c7349784d 100644 --- a/packages/core/src/configs/index.ts +++ b/packages/core/src/configs/index.ts @@ -315,7 +315,7 @@ const _loadConfigFiles = ( if (fsExistsSync(pathObj.appConfigsDir)) { const appConfigsDirNames = fsReaddirSync(pathObj.appConfigsDir); - if (parseAppConfigs && extendAppId && appConfigsDirNames.includes(extendAppId)) { + if (parseAppConfigs && extendAppId && extendAppId !== 'base' && appConfigsDirNames.includes(extendAppId)) { const path2 = path.join(pathObj.appConfigsDir, extendAppId); const pathObj2: RnvContextPathObj = { ...generateRnvConfigPathObj(), @@ -346,7 +346,7 @@ const _loadConfigFiles = ( } } - // PATH2: appConfigs/ + // PATH3: appConfigs/ const path3 = pathObj.dir; pathObj.dirs.push(path3); pathObj.fontsDirs.push(path.join(path3, 'fonts')); diff --git a/packages/core/src/context/defaults.ts b/packages/core/src/context/defaults.ts index 7330db0027..46810e83b9 100644 --- a/packages/core/src/context/defaults.ts +++ b/packages/core/src/context/defaults.ts @@ -112,7 +112,12 @@ export const generateContextDefaults = (): RnvContext => ({ project: { ...generateRnvConfigPathObj(), config: '', - appConfigBase: {}, + appConfigBase: { + dir: '', + fontsDir: '', + fontsDirs: [], + pluginsDir: '', + }, builds: {}, assets: {}, platformTemplates: {}, diff --git a/packages/core/src/context/types.ts b/packages/core/src/context/types.ts index 1ed84e8d9e..1301cb0942 100644 --- a/packages/core/src/context/types.ts +++ b/packages/core/src/context/types.ts @@ -203,7 +203,12 @@ export type RnvContextPaths = { }; }; project: RnvContextPathObj & { - appConfigBase: Record; + appConfigBase: { + dir: string; + pluginsDir: string; + fontsDir: string; + fontsDirs: Array; + }; builds: Record; assets: Record; platformTemplates: Record; diff --git a/packages/core/src/plugins/index.ts b/packages/core/src/plugins/index.ts index f6a7b42220..4cc13464e5 100644 --- a/packages/core/src/plugins/index.ts +++ b/packages/core/src/plugins/index.ts @@ -679,6 +679,7 @@ const _overridePlugin = (c: RnvContext, pluginsPath: string, dir: string) => { } const overrideConfig = overridePath ? readObjectSync(overridePath) : null; const overrides = overrideConfig?.overrides; + if (overrides) { Object.keys(overrides).forEach((k) => { const ovDir = path.join(dest, k); @@ -692,6 +693,9 @@ const _overridePlugin = (c: RnvContext, pluginsPath: string, dir: string) => { } }); } + + // const parentDest = path.join(dir, '..') + // console.log('SKSLSL', dir, dest); }; export const overrideFileContents = (dest: string, override: Record, overridePath = '') => { @@ -836,7 +840,7 @@ export const overrideTemplatePlugins = async (c: RnvContext) => { const rnvPluginsDirs = c.paths.rnv.pluginTemplates.dirs; const appPluginDirs = c.paths.appConfig.pluginDirs; - const appBasePluginDir = c.paths.project.appConfigBase.pluginsDir; + parsePlugins( c, c.platform as RnvPluginPlatform, @@ -850,10 +854,6 @@ export const overrideTemplatePlugins = async (c: RnvContext) => { } }); } - - if (appBasePluginDir) { - _overridePlugin(c, appBasePluginDir, key); - } if (appPluginDirs) { for (let k = 0; k < appPluginDirs.length; k++) { _overridePlugin(c, appPluginDirs[k], key); diff --git a/packages/core/src/templates/index.ts b/packages/core/src/templates/index.ts index 943a1182bb..186e348782 100644 --- a/packages/core/src/templates/index.ts +++ b/packages/core/src/templates/index.ts @@ -58,7 +58,7 @@ export const checkIfTemplateConfigured = async (c: RnvContext) => { const _cleanProjectTemplateSync = (c: RnvContext) => { logTask('_cleanProjectTemplateSync'); - const dirsToRemove = [c.paths.project.appConfigBase.dir, c.paths.project.srcDir, c.paths.project.appConfigsDir]; + const dirsToRemove = [c.paths.project.appConfigBase.dir, c.paths.project.srcDir!, c.paths.project.appConfigsDir]; const filesToRemove = c.buildConfig.defaults?.supportedPlatforms?.map((p) => path.join(c.paths.project.dir, `index.${p}.js`) diff --git a/packages/sdk-apple/package.json b/packages/sdk-apple/package.json index a7b3aab517..8e703e9e36 100644 --- a/packages/sdk-apple/package.json +++ b/packages/sdk-apple/package.json @@ -30,7 +30,6 @@ }, "dependencies": { "@react-native-community/cli": "^11.3.8", - "@react-native-community/cli-platform-ios": "^11.3.8", "@rnv/sdk-react-native": "1.0.0-canary.1", "compare-versions": "3.6.0", "ios-mobileprovision-finder": "1.1.0", @@ -47,4 +46,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json b/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json index 577520ce5d..e6016b6131 100644 --- a/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json +++ b/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json @@ -7,7 +7,7 @@ "if (!version.includes('iOS')) {": "if (!version.includes('iOS') && !version.includes('tvOS')) { // <= PATCHED BY RENATIVE" }, "build/commands/runIOS/index.js": { - "if (device.type === 'simulator') {\n if (selectedDevice.type === 'simulator') {return runOnSimulator(xcodeProject, scheme, modifiedArgs);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs, device); // <= PATCHED BY RENATIVE" + "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs, device); // <= PATCHED BY RENATIVE" } } } \ No newline at end of file diff --git a/packages/template-starter/package.json b/packages/template-starter/package.json index 2936423fc3..37dc486181 100644 --- a/packages/template-starter/package.json +++ b/packages/template-starter/package.json @@ -80,8 +80,6 @@ "@flexn/assets-renative-outline": "0.3.2", "@flexn/graybox": "0.21.1", "@flexn/typescript-config": "1.0.0", - "@react-native-community/cli": "11.3.8", - "@react-native-community/cli-platform-ios": "11.3.8", "@rnv/engine-lightning": "1.0.0-canary.1", "@rnv/engine-rn": "1.0.0-canary.1", "@rnv/engine-rn-electron": "1.0.0-canary.1", @@ -125,4 +123,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/packages/template-starter/renative.json b/packages/template-starter/renative.json index 672cb362db..0a94f29a4b 100644 --- a/packages/template-starter/renative.json +++ b/packages/template-starter/renative.json @@ -120,9 +120,7 @@ "org.gradle.configureondemand": true }, "engine": "engine-rn-tvos", - "includedPermissions": [ - "INTERNET" - ] + "includedPermissions": ["INTERNET"] }, "androidwear": { "minSdkVersion": 26, @@ -144,9 +142,7 @@ "org.gradle.parallel": true, "org.gradle.configureondemand": true }, - "includedPermissions": [ - "INTERNET" - ], + "includedPermissions": ["INTERNET"], "mainActivity": { "onCreate": "super.onCreate(null)" } @@ -172,9 +168,7 @@ "org.gradle.configureondemand": true }, "engine": "engine-rn-tvos", - "includedPermissions": [ - "INTERNET" - ] + "includedPermissions": ["INTERNET"] }, "web": { "engine": "engine-rn-next" @@ -202,11 +196,11 @@ "react-dom": "source:rnv", "react-native-gesture-handler": { "version": "2.13.1", - "disablePluginTemplateOverrides": true + "disablePluginTemplateOverrides": false }, "@react-native-community/cli-platform-ios": { "version": "11.3.7", - "disablePluginTemplateOverrides": true + "disablePluginTemplateOverrides": false }, "@react-native-community/cli": { "version": "11.3.8" @@ -238,4 +232,4 @@ } } } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock index dbdff35021..c8df9f4d11 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3470,7 +3470,7 @@ glob "^7.1.3" ora "^5.4.1" -"@react-native-community/cli-platform-ios@11.3.8", "@react-native-community/cli-platform-ios@^11.3.8": +"@react-native-community/cli-platform-ios@11.3.8": version "11.3.8" resolved "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-11.3.8.tgz#5797e1b766875917b74446cf76f064e873353258" integrity sha512-py2g2gDLvsjkgwysgA9UzJqx5EovvaMTxnaF+UciObfHuY6yXsBm2TOEcLDyJ7Qen0Yy2YXvj3BcvNQsJW/WkQ== @@ -3613,7 +3613,7 @@ prompts "^2.4.0" semver "^7.5.2" -"@react-native-community/cli@11.3.8", "@react-native-community/cli@^11.3.8": +"@react-native-community/cli@^11.3.8": version "11.3.8" resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-11.3.8.tgz#3bae488697cf3de4ca2d0c2dee80e40611883801" integrity sha512-myfJCbK6vPqskTnSTm224RZKGo60ND/jcylzEE7WPEU8myX5CAA/et2cK+gyjt2nh8mBvLBVBypsrwUbCIg70g== From fb66bbb8a7dfce3870c9cd44a388b30d6e40ebbb Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 01:37:30 +0200 Subject: [PATCH 3/8] migrate overides --- packages/core/src/context/index.ts | 7 ++++-- packages/core/src/context/types.ts | 2 +- packages/core/src/plugins/index.ts | 22 ++++++++++++++----- .../cli-platform-ios/overrides.json | 0 .../overrides.json | 0 packages/template-starter/renative.json | 2 +- 6 files changed, 23 insertions(+), 10 deletions(-) rename packages/{template-starter/appConfigs/base/plugins => rnv/pluginTemplates}/@react-native-community/cli-platform-ios/overrides.json (100%) rename packages/{template-starter/appConfigs/base/plugins => rnv/pluginTemplates}/react-native-gesture-handler/overrides.json (100%) diff --git a/packages/core/src/context/index.ts b/packages/core/src/context/index.ts index d8b7ac548e..8e267b5843 100644 --- a/packages/core/src/context/index.ts +++ b/packages/core/src/context/index.ts @@ -51,9 +51,12 @@ export const createRnvContext = (ctx?: { c.paths.RNV_NODE_MODULES_DIR = path.join(c.paths.rnv.dir, 'node_modules'); c.paths.rnv.engines.dir = path.join(c.paths.rnv.dir, 'engineTemplates'); - c.paths.rnv.pluginTemplates.dir = path.join(c.paths.rnv.dir, 'pluginTemplates'); + c.paths.rnv.pluginTemplates.overrideDir = path.join(c.paths.rnv.dir, 'pluginTemplates'); - c.paths.rnv.pluginTemplates.config = path.join(c.paths.rnv.pluginTemplates.dir, RENATIVE_CONFIG_PLUGINS_NAME); + c.paths.rnv.pluginTemplates.config = path.join( + c.paths.rnv.pluginTemplates.overrideDir, + RENATIVE_CONFIG_PLUGINS_NAME + ); c.paths.rnv.projectTemplates.dir = path.join(c.paths.rnv.dir, 'coreTemplateFiles'); c.paths.rnv.projectTemplates.config = path.join(c.paths.rnv.projectTemplates.dir, RENATIVE_CONFIG_TEMPLATES_NAME); c.paths.rnv.package = path.join(c.paths.rnv.dir, 'package.json'); diff --git a/packages/core/src/context/types.ts b/packages/core/src/context/types.ts index 1301cb0942..581cfb77d4 100644 --- a/packages/core/src/context/types.ts +++ b/packages/core/src/context/types.ts @@ -162,7 +162,7 @@ export type RnvContextPaths = { pluginTemplates: { configs: Record; //ADDON - dir?: string; + overrideDir?: string; config?: string; dirs: Record; }; diff --git a/packages/core/src/plugins/index.ts b/packages/core/src/plugins/index.ts index 4cc13464e5..65c7f96e31 100644 --- a/packages/core/src/plugins/index.ts +++ b/packages/core/src/plugins/index.ts @@ -522,7 +522,10 @@ export const loadPluginTemplates = async (c: RnvContext) => { rnv: c.files.rnv.pluginTemplates.config, }; - c.paths.rnv.pluginTemplates.dirs = { rnv: flexnPluginTemplatesPath }; + //Override default rnv path with flexn one and add it rnv as overrider + c.paths.rnv.pluginTemplates.dirs = { + rnv: flexnPluginTemplatesPath, + }; const customPluginTemplates = c.files.project.config?.paths?.pluginTemplates; const missingDeps = _parsePluginTemplateDependencies(c, customPluginTemplates); @@ -618,7 +621,14 @@ const _parsePluginTemplateDependencies = ( const getCleanRegExString = (str: string) => str.replace(/[-\\.,_*+?^$[\](){}!=|`]/gi, '\\$&'); const _overridePlugin = (c: RnvContext, pluginsPath: string, dir: string) => { - const source = path.resolve(pluginsPath, dir, 'overrides'); + let source; + + source = path.resolve(c.paths.rnv.pluginTemplates.overrideDir!, dir, 'overrides'); + if (!source) { + console.log('KDDK', source); + + source = path.join(pluginsPath, dir, 'overrides'); + } const dest = doResolve(dir, false); if (!dest) return; @@ -887,10 +897,10 @@ export const copyTemplatePluginsSync = (c: RnvContext) => { }); } // FOLDER MERGES FROM PROJECT CONFIG PLUGIN - if (c.paths.rnv.pluginTemplates.dir) { - const sourcePathRnvPlugin = getBuildsFolder(c, platform, path.join(c.paths.rnv.pluginTemplates.dir, key)); - copyFolderContentsRecursiveSync(sourcePathRnvPlugin, destPath, true, undefined, false, objectInject); - } + // if (c.paths.rnv.pluginTemplates.dir) { + // const sourcePathRnvPlugin = getBuildsFolder(c, platform, path.join(c.paths.rnv.pluginTemplates.dir, key)); + // copyFolderContentsRecursiveSync(sourcePathRnvPlugin, destPath, true, undefined, false, objectInject); + // } // FOLDER MERGES FROM PROJECT CONFIG PLUGIN const sourcePath3 = getBuildsFolder( diff --git a/packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json b/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json similarity index 100% rename from packages/template-starter/appConfigs/base/plugins/@react-native-community/cli-platform-ios/overrides.json rename to packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json diff --git a/packages/template-starter/appConfigs/base/plugins/react-native-gesture-handler/overrides.json b/packages/rnv/pluginTemplates/react-native-gesture-handler/overrides.json similarity index 100% rename from packages/template-starter/appConfigs/base/plugins/react-native-gesture-handler/overrides.json rename to packages/rnv/pluginTemplates/react-native-gesture-handler/overrides.json diff --git a/packages/template-starter/renative.json b/packages/template-starter/renative.json index 0a94f29a4b..ed2af3e1bf 100644 --- a/packages/template-starter/renative.json +++ b/packages/template-starter/renative.json @@ -213,7 +213,7 @@ "disablePluginTemplateOverrides": true }, "react-native-web": { - "version": "0.19.8" + "version": "0.19.9" }, "react-native-tvos": { "version": "0.72.5-0" From fe37b3c46ea75cc229b90fa4c261c984c04caef8 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 02:54:23 +0200 Subject: [PATCH 4/8] fix override logic --- packages/core/src/plugins/index.ts | 18 +++++++++--------- .../cli-platform-ios/overrides.json | 2 +- packages/template-starter/Gemfile.lock | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/core/src/plugins/index.ts b/packages/core/src/plugins/index.ts index 65c7f96e31..5261779aff 100644 --- a/packages/core/src/plugins/index.ts +++ b/packages/core/src/plugins/index.ts @@ -621,14 +621,8 @@ const _parsePluginTemplateDependencies = ( const getCleanRegExString = (str: string) => str.replace(/[-\\.,_*+?^$[\](){}!=|`]/gi, '\\$&'); const _overridePlugin = (c: RnvContext, pluginsPath: string, dir: string) => { - let source; + const source = path.join(pluginsPath, dir, 'overrides'); - source = path.resolve(c.paths.rnv.pluginTemplates.overrideDir!, dir, 'overrides'); - if (!source) { - console.log('KDDK', source); - - source = path.join(pluginsPath, dir, 'overrides'); - } const dest = doResolve(dir, false); if (!dest) return; @@ -689,11 +683,11 @@ const _overridePlugin = (c: RnvContext, pluginsPath: string, dir: string) => { } const overrideConfig = overridePath ? readObjectSync(overridePath) : null; const overrides = overrideConfig?.overrides; - if (overrides) { Object.keys(overrides).forEach((k) => { const ovDir = path.join(dest, k); const override = overrides[k]; + if (fsExistsSync(ovDir)) { if (fsLstatSync(ovDir).isDirectory()) { logWarning('overrides.json: Directories not supported yet. specify path to actual file'); @@ -711,6 +705,7 @@ const _overridePlugin = (c: RnvContext, pluginsPath: string, dir: string) => { export const overrideFileContents = (dest: string, override: Record, overridePath = '') => { if (fsExistsSync(dest)) { let fileToFix = fsReadFileSync(dest).toString(); + let foundRegEx = false; const failTerms: Array = []; Object.keys(override).forEach((fk) => { @@ -860,7 +855,12 @@ export const overrideTemplatePlugins = async (c: RnvContext) => { plugin._scopes.forEach((pluginScope) => { const pluginOverridePath = rnvPluginsDirs[pluginScope]; if (pluginOverridePath) { - _overridePlugin(c, pluginOverridePath, key); + const rnvOverridePath = path.join(c.paths.rnv.pluginTemplates.overrideDir!, key); + if (fsExistsSync(rnvOverridePath)) { + _overridePlugin(c, c.paths.rnv.pluginTemplates.overrideDir!, key); + } else { + _overridePlugin(c, pluginOverridePath, key); + } } }); } diff --git a/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json b/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json index e6016b6131..6228b4e637 100644 --- a/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json +++ b/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides.json @@ -7,7 +7,7 @@ "if (!version.includes('iOS')) {": "if (!version.includes('iOS') && !version.includes('tvOS')) { // <= PATCHED BY RENATIVE" }, "build/commands/runIOS/index.js": { - "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs, device); // <= PATCHED BY RENATIVE" + "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, args);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, args, device); // <= PATCHED BY RENATIVE" } } } \ No newline at end of file diff --git a/packages/template-starter/Gemfile.lock b/packages/template-starter/Gemfile.lock index 9ecf979ff9..89621db947 100644 --- a/packages/template-starter/Gemfile.lock +++ b/packages/template-starter/Gemfile.lock @@ -57,7 +57,7 @@ GEM escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) - ffi (1.16.2) + ffi (1.16.3) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) From b6b088c43919957b1d632126464b604f2e82d2ca Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 03:53:09 +0200 Subject: [PATCH 5/8] tvos support --- .../src/adapters/babelAdapter.ts | 16 + .../src/adapters/metroAdapter.ts | 38 +- .../cli-platform-ios/overrides@11.3.7.json | 13 + packages/template-starter/package.json | 6 +- packages/template-starter/renative.json | 10 +- packages/template-starter/src/entry/index.ts | 4 +- yarn.lock | 477 +++++++++++++++++- 7 files changed, 531 insertions(+), 33 deletions(-) create mode 100644 packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides@11.3.7.json diff --git a/packages/engine-rn-tvos/src/adapters/babelAdapter.ts b/packages/engine-rn-tvos/src/adapters/babelAdapter.ts index cbbe874722..24b0f3b052 100644 --- a/packages/engine-rn-tvos/src/adapters/babelAdapter.ts +++ b/packages/engine-rn-tvos/src/adapters/babelAdapter.ts @@ -1,3 +1,18 @@ +const env: any = process?.env; + +const createEngineAlias = () => { + const projectPath = process.env.RNV_PROJECT_ROOT || process.cwd(); + const isMonorepo = process.env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true; + const rootPath = isMonorepo ? process.env.RNV_MONO_ROOT || projectPath : projectPath; + const alias: any = {}; + + if (process.env.RNV_IS_NATIVE_TV === 'true' || env.RNV_IS_NATIVE_TV === true) { + alias['react-native'] = `${rootPath}/node_modules/react-native-tvos`; + } + + return alias; +}; + export const withRNVBabel = (cnf: any) => { const plugins = cnf?.plugins || []; @@ -10,6 +25,7 @@ export const withRNVBabel = (cnf: any) => { require.resolve('babel-plugin-module-resolver'), { root: [process.env.RNV_MONO_ROOT || '.'], + alias: createEngineAlias(), }, ], ...plugins, diff --git a/packages/engine-rn-tvos/src/adapters/metroAdapter.ts b/packages/engine-rn-tvos/src/adapters/metroAdapter.ts index 67abb74726..2610009589 100644 --- a/packages/engine-rn-tvos/src/adapters/metroAdapter.ts +++ b/packages/engine-rn-tvos/src/adapters/metroAdapter.ts @@ -1,7 +1,11 @@ import { FileStore } from 'metro-cache'; +const { doResolve } = require('@rnv/core'); + import path from 'path'; import os from 'os'; +const env: any = process?.env; + const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); const DEFAULT_CONFIG = { @@ -131,7 +135,39 @@ const DEFAULT_CONFIG = { export const withRNVMetro = (config: any) => { const projectPath = process.env.RNV_PROJECT_ROOT || process.cwd(); - const cfg = mergeConfig(getDefaultConfig(projectPath), DEFAULT_CONFIG); + + const exts: string = env.RNV_EXTENSIONS || ''; + + const cfg = mergeConfig(getDefaultConfig(projectPath), { + ...DEFAULT_CONFIG, + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + // this defeats the RCTDeviceEventEmitter is not a registered callable module + inlineRequires: true, + }, + }), + assetRegistryPath: path.resolve(`${doResolve('react-native-tvos')}/Libraries/Image/AssetRegistry.js`), + ...(config?.transformer || {}), + }, + resolver: { + // blacklistRE: blacklist([ + // /platformBuilds\/.*/, + // /buildHooks\/.*/, + // /projectConfig\/.*/, + // /website\/.*/, + // /appConfigs\/.*/, + // /renative.local.*/, + // /metro.config.local.*/, + // /.expo\/.*/, + // /.rollup.cache\/.*/, + // ]), + ...(config?.resolver || {}), + sourceExts: [...(config?.resolver?.sourceExts || []), ...exts.split(',')], + extraNodeModules: config?.resolver?.extraNodeModules, + }, + }); const cnf = mergeConfig(cfg, config); diff --git a/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides@11.3.7.json b/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides@11.3.7.json new file mode 100644 index 0000000000..e6016b6131 --- /dev/null +++ b/packages/rnv/pluginTemplates/@react-native-community/cli-platform-ios/overrides@11.3.7.json @@ -0,0 +1,13 @@ +{ + "overrides": { + "build/tools/listIOSDevices.js": { + "rawOutput.filter(device => !device.platform.includes('appletv') && !device.platform.includes('macos')).sort(device => device.simulator ? 1 : -1).map(device => {": "rawOutput.sort(device => device.simulator ? 1 : -1).map(device => { // <= PATCHED BY RENATIVE" + }, + "build/tools/findMatchingSimulator.js": { + "if (!version.includes('iOS')) {": "if (!version.includes('iOS') && !version.includes('tvOS')) { // <= PATCHED BY RENATIVE" + }, + "build/commands/runIOS/index.js": { + "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs);": "if (device.type === 'simulator') {\n return runOnSimulator(xcodeProject, scheme, modifiedArgs, device); // <= PATCHED BY RENATIVE" + } + } +} \ No newline at end of file diff --git a/packages/template-starter/package.json b/packages/template-starter/package.json index 37dc486181..2b44ae014a 100644 --- a/packages/template-starter/package.json +++ b/packages/template-starter/package.json @@ -89,7 +89,7 @@ "@rnv/renative": "1.0.0-canary.1", "@types/react": "18.2.22", "@types/react-dom": "18.2.7", - "@types/react-native": "0.72.3", + "@types/react-native": "0.72.2", "babel-jest": "29.2.1", "babel-loader": "9.1.3", "detox": "18.20.2", @@ -100,9 +100,9 @@ "react": "18.2.0", "react-art": "18.2.0", "react-dom": "18.2.0", - "react-native": "0.72.5", + "react-native": "0.72.4", "react-native-gesture-handler": "2.13.1", - "react-native-tvos": "0.72.5-0", + "react-native-tvos": "0.72.4-0", "react-native-web": "0.19.9", "rnv": "1.0.0-canary.1", "xcode": "2.1.0" diff --git a/packages/template-starter/renative.json b/packages/template-starter/renative.json index ed2af3e1bf..a33b5d69c5 100644 --- a/packages/template-starter/renative.json +++ b/packages/template-starter/renative.json @@ -200,13 +200,11 @@ }, "@react-native-community/cli-platform-ios": { "version": "11.3.7", - "disablePluginTemplateOverrides": false - }, - "@react-native-community/cli": { - "version": "11.3.8" + "disablePluginTemplateOverrides": false, + "optionalDependency": true }, "react-native": { - "version": "0.72.5" + "version": "0.72.4" }, "next": { "version": "13.5.2", @@ -216,7 +214,7 @@ "version": "0.19.9" }, "react-native-tvos": { - "version": "0.72.5-0" + "version": "0.72.4-0" } }, "permissions": { diff --git a/packages/template-starter/src/entry/index.ts b/packages/template-starter/src/entry/index.ts index 9f9fad2839..6d81a19bbd 100644 --- a/packages/template-starter/src/entry/index.ts +++ b/packages/template-starter/src/entry/index.ts @@ -1,5 +1,5 @@ -// import 'react-native/Libraries/Core/InitializeCore'; //https://github.com/flexn-io/renative/issues/876 +import 'react-native/Libraries/Core/InitializeCore'; //https://github.com/flexn-io/renative/issues/876 import { AppRegistry } from 'react-native'; import App from '../app'; -AppRegistry.registerComponent('App', () => App); +AppRegistry.registerComponent('RNVApp', () => App); diff --git a/yarn.lock b/yarn.lock index c8df9f4d11..a622264ea4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3308,6 +3308,16 @@ unbzip2-stream "1.4.3" yargs "17.7.1" +"@react-native-community/cli-clean@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-clean/-/cli-clean-11.3.6.tgz#43a06cbee1a5480da804debc4f94662a197720f2" + integrity sha512-jOOaeG5ebSXTHweq1NznVJVAFKtTFWL4lWgUXl845bCGX7t1lL8xQNWHKwT8Oh1pGR2CI3cKmRjY4hBg+pEI9g== + dependencies: + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + execa "^5.0.0" + prompts "^2.4.0" + "@react-native-community/cli-clean@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-clean/-/cli-clean-11.3.7.tgz#cb4c2f225f78593412c2d191b55b8570f409a48f" @@ -3328,6 +3338,18 @@ execa "^5.0.0" prompts "^2.4.0" +"@react-native-community/cli-config@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-config/-/cli-config-11.3.6.tgz#6d3636a8a3c4542ebb123eaf61bbbc0c2a1d2a6b" + integrity sha512-edy7fwllSFLan/6BG6/rznOBCLPrjmJAE10FzkEqNLHowi0bckiAPg1+1jlgQ2qqAxV5kuk+c9eajVfQvPLYDA== + dependencies: + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + cosmiconfig "^5.1.0" + deepmerge "^4.3.0" + glob "^7.1.3" + joi "^17.2.1" + "@react-native-community/cli-config@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-config/-/cli-config-11.3.7.tgz#4ce95548252ecb094b576369abebf9867c95d277" @@ -3352,6 +3374,13 @@ glob "^7.1.3" joi "^17.2.1" +"@react-native-community/cli-debugger-ui@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-11.3.6.tgz#1eb2276450f270a938686b49881fe232a08c01c4" + integrity sha512-jhMOSN/iOlid9jn/A2/uf7HbC3u7+lGktpeGSLnHNw21iahFBzcpuO71ekEdlmTZ4zC/WyxBXw9j2ka33T358w== + dependencies: + serve-static "^1.13.1" + "@react-native-community/cli-debugger-ui@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-debugger-ui/-/cli-debugger-ui-11.3.7.tgz#2147b73313af8de3c9b396406d5d344b904cf2bb" @@ -3366,6 +3395,30 @@ dependencies: serve-static "^1.13.1" +"@react-native-community/cli-doctor@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-doctor/-/cli-doctor-11.3.6.tgz#fa33ee00fe5120af516aa0f17fe3ad50270976e7" + integrity sha512-UT/Tt6omVPi1j6JEX+CObc85eVFghSZwy4GR9JFMsO7gNg2Tvcu1RGWlUkrbmWMAMHw127LUu6TGK66Ugu1NLA== + dependencies: + "@react-native-community/cli-config" "11.3.6" + "@react-native-community/cli-platform-android" "11.3.6" + "@react-native-community/cli-platform-ios" "11.3.6" + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + command-exists "^1.2.8" + envinfo "^7.7.2" + execa "^5.0.0" + hermes-profile-transformer "^0.0.6" + ip "^1.1.5" + node-stream-zip "^1.9.1" + ora "^5.4.1" + prompts "^2.4.0" + semver "^7.5.2" + strip-ansi "^5.2.0" + sudo-prompt "^9.0.0" + wcwidth "^1.0.1" + yaml "^2.2.1" + "@react-native-community/cli-doctor@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-doctor/-/cli-doctor-11.3.7.tgz#7d5f5b1aea78134bba713fa97795986345ff1344" @@ -3414,6 +3467,17 @@ wcwidth "^1.0.1" yaml "^2.2.1" +"@react-native-community/cli-hermes@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-hermes/-/cli-hermes-11.3.6.tgz#b1acc7feff66ab0859488e5812b3b3e8b8e9434c" + integrity sha512-O55YAYGZ3XynpUdePPVvNuUPGPY0IJdctLAOHme73OvS80gNwfntHDXfmY70TGHWIfkK2zBhA0B+2v8s5aTyTA== + dependencies: + "@react-native-community/cli-platform-android" "11.3.6" + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + hermes-profile-transformer "^0.0.6" + ip "^1.1.5" + "@react-native-community/cli-hermes@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-hermes/-/cli-hermes-11.3.7.tgz#091e730a1f8bace6c3729e8744bad6141002e0e8" @@ -3436,6 +3500,17 @@ hermes-profile-transformer "^0.0.6" ip "^1.1.5" +"@react-native-community/cli-platform-android@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-11.3.6.tgz#6f3581ca4eed3deec7edba83c1bc467098c8167b" + integrity sha512-ZARrpLv5tn3rmhZc//IuDM1LSAdYnjUmjrp58RynlvjLDI4ZEjBAGCQmgysRgXAsK7ekMrfkZgemUczfn9td2A== + dependencies: + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + execa "^5.0.0" + glob "^7.1.3" + logkitty "^0.7.1" + "@react-native-community/cli-platform-android@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-platform-android/-/cli-platform-android-11.3.7.tgz#7845bc48258b6bb55df208a23b3690647f113995" @@ -3458,6 +3533,18 @@ glob "^7.1.3" logkitty "^0.7.1" +"@react-native-community/cli-platform-ios@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-11.3.6.tgz#0fa58d01f55d85618c4218925509a4be77867dab" + integrity sha512-tZ9VbXWiRW+F+fbZzpLMZlj93g3Q96HpuMsS6DRhrTiG+vMQ3o6oPWSEEmMGOvJSYU7+y68Dc9ms2liC7VD6cw== + dependencies: + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + execa "^5.0.0" + fast-xml-parser "^4.0.12" + glob "^7.1.3" + ora "^5.4.1" + "@react-native-community/cli-platform-ios@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-platform-ios/-/cli-platform-ios-11.3.7.tgz#87478f907634713b7236c77870446a5ca1f35ff1" @@ -3482,6 +3569,23 @@ glob "^7.1.3" ora "^5.4.1" +"@react-native-community/cli-plugin-metro@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-plugin-metro/-/cli-plugin-metro-11.3.6.tgz#2d632c304313435c9ea104086901fbbeba0f1882" + integrity sha512-D97racrPX3069ibyabJNKw9aJpVcaZrkYiEzsEnx50uauQtPDoQ1ELb/5c6CtMhAEGKoZ0B5MS23BbsSZcLs2g== + dependencies: + "@react-native-community/cli-server-api" "11.3.6" + "@react-native-community/cli-tools" "11.3.6" + chalk "^4.1.2" + execa "^5.0.0" + metro "0.76.7" + metro-config "0.76.7" + metro-core "0.76.7" + metro-react-native-babel-transformer "0.76.7" + metro-resolver "0.76.7" + metro-runtime "0.76.7" + readline "^1.3.0" + "@react-native-community/cli-plugin-metro@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-plugin-metro/-/cli-plugin-metro-11.3.7.tgz#2e8a9deb30b40495c5c1347a1837a824400fa00f" @@ -3516,6 +3620,21 @@ metro-runtime "0.76.8" readline "^1.3.0" +"@react-native-community/cli-server-api@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-server-api/-/cli-server-api-11.3.6.tgz#3a16039518f7f3865f85f8f54b19174448bbcdbb" + integrity sha512-8GUKodPnURGtJ9JKg8yOHIRtWepPciI3ssXVw5jik7+dZ43yN8P5BqCoDaq8e1H1yRer27iiOfT7XVnwk8Dueg== + dependencies: + "@react-native-community/cli-debugger-ui" "11.3.6" + "@react-native-community/cli-tools" "11.3.6" + compression "^1.7.1" + connect "^3.6.5" + errorhandler "^1.5.1" + nocache "^3.0.1" + pretty-format "^26.6.2" + serve-static "^1.13.1" + ws "^7.5.1" + "@react-native-community/cli-server-api@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-server-api/-/cli-server-api-11.3.7.tgz#2cce54b3331c9c51b9067129c297ab2e9a142216" @@ -3546,6 +3665,21 @@ serve-static "^1.13.1" ws "^7.5.1" +"@react-native-community/cli-tools@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-tools/-/cli-tools-11.3.6.tgz#ec213b8409917a56e023595f148c84b9cb3ad871" + integrity sha512-JpmUTcDwAGiTzLsfMlIAYpCMSJ9w2Qlf7PU7mZIRyEu61UzEawyw83DkqfbzDPBuRwRnaeN44JX2CP/yTO3ThQ== + dependencies: + appdirsjs "^1.2.4" + chalk "^4.1.2" + find-up "^5.0.0" + mime "^2.4.1" + node-fetch "^2.6.0" + open "^6.2.0" + ora "^5.4.1" + semver "^7.5.2" + shell-quote "^1.7.3" + "@react-native-community/cli-tools@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-tools/-/cli-tools-11.3.7.tgz#37aa7efc7b4a1b7077d541f1d7bb11a2ab7b6ff2" @@ -3576,6 +3710,13 @@ semver "^7.5.2" shell-quote "^1.7.3" +"@react-native-community/cli-types@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-11.3.6.tgz#34012f1d0cb1c4039268828abc07c9c69f2e15be" + integrity sha512-6DxjrMKx5x68N/tCJYVYRKAtlRHbtUVBZrnAvkxbRWFD9v4vhNgsPM0RQm8i2vRugeksnao5mbnRGpS6c0awCw== + dependencies: + joi "^17.2.1" + "@react-native-community/cli-types@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli-types/-/cli-types-11.3.7.tgz#12fe7cff3da08bd27e11116531b2e001939854b9" @@ -3590,6 +3731,29 @@ dependencies: joi "^17.2.1" +"@react-native-community/cli@11.3.6": + version "11.3.6" + resolved "https://registry.npmjs.org/@react-native-community/cli/-/cli-11.3.6.tgz#d92618d75229eaf6c0391a6b075684eba5d9819f" + integrity sha512-bdwOIYTBVQ9VK34dsf6t3u6vOUU5lfdhKaAxiAVArjsr7Je88Bgs4sAbsOYsNK3tkE8G77U6wLpekknXcanlww== + dependencies: + "@react-native-community/cli-clean" "11.3.6" + "@react-native-community/cli-config" "11.3.6" + "@react-native-community/cli-debugger-ui" "11.3.6" + "@react-native-community/cli-doctor" "11.3.6" + "@react-native-community/cli-hermes" "11.3.6" + "@react-native-community/cli-plugin-metro" "11.3.6" + "@react-native-community/cli-server-api" "11.3.6" + "@react-native-community/cli-tools" "11.3.6" + "@react-native-community/cli-types" "11.3.6" + chalk "^4.1.2" + commander "^9.4.1" + execa "^5.0.0" + find-up "^4.1.0" + fs-extra "^8.1.0" + graceful-fs "^4.1.3" + prompts "^2.4.0" + semver "^7.5.2" + "@react-native-community/cli@11.3.7": version "11.3.7" resolved "https://registry.npmjs.org/@react-native-community/cli/-/cli-11.3.7.tgz#564c0054269d8385fa9d301750b2e56dbb5c0cc9" @@ -3789,7 +3953,7 @@ jscodeshift "^0.14.0" nullthrows "^1.1.1" -"@react-native/codegen@^0.72.7": +"@react-native/codegen@^0.72.6", "@react-native/codegen@^0.72.7": version "0.72.7" resolved "https://registry.npmjs.org/@react-native/codegen/-/codegen-0.72.7.tgz#b6832ce631ac63143024ea094a6b5480a780e589" integrity sha512-O7xNcGeXGbY+VoqBGNlZ3O05gxfATlwE1Q1qQf5E38dK+tXn5BY4u0jaQ9DPjfE8pBba8g/BYI1N44lynidMtg== @@ -4748,10 +4912,10 @@ dependencies: "@types/react" "*" -"@types/react-native@0.72.3": - version "0.72.3" - resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.72.3.tgz#eb5726eb3ec6b79a10db7a295cc0346eb5e9331a" - integrity sha512-9+g+DBJIY3bG7+ZlYzKPr9kxTQxUuZQgLWZhYK4RlIcrsm3qaJhL2PU2e/K4CjnzznWCo2Islgec94x2z1pG4Q== +"@types/react-native@0.72.2": + version "0.72.2" + resolved "https://registry.npmjs.org/@types/react-native/-/react-native-0.72.2.tgz#27c931a899c555b28e20cdd12e570b017808de96" + integrity sha512-/eEjr04Zqo7mTMszuSdrLx90+j5nWhDMMOgtnKZfAYyV3RwmlpSb7F17ilmMMxZWJY81n/JZ4e6wdhMJFpjrCg== dependencies: "@react-native/virtualized-lists" "^0.72.4" "@types/react" "*" @@ -14609,6 +14773,15 @@ methods@~1.1.2: resolved "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w== +metro-babel-transformer@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-babel-transformer/-/metro-babel-transformer-0.76.7.tgz#ba620d64cbaf97d1aa14146d654a3e5d7477fc62" + integrity sha512-bgr2OFn0J4r0qoZcHrwEvccF7g9k3wdgTOgk6gmGHrtlZ1Jn3oCpklW/DfZ9PzHfjY2mQammKTc19g/EFGyOJw== + dependencies: + "@babel/core" "^7.20.0" + hermes-parser "0.12.0" + nullthrows "^1.1.1" + metro-babel-transformer@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-babel-transformer/-/metro-babel-transformer-0.76.8.tgz#5efd1027353b36b73706164ef09c290dceac096a" @@ -14627,6 +14800,11 @@ metro-babel-transformer@0.79.1: hermes-parser "0.15.0" nullthrows "^1.1.1" +metro-cache-key@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-cache-key/-/metro-cache-key-0.76.7.tgz#70913f43b92b313096673c37532edd07438cb325" + integrity sha512-0pecoIzwsD/Whn/Qfa+SDMX2YyasV0ndbcgUFx7w1Ct2sLHClujdhQ4ik6mvQmsaOcnGkIyN0zcceMDjC2+BFQ== + metro-cache-key@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-cache-key/-/metro-cache-key-0.76.8.tgz#8a0a5e991c06f56fcc584acadacb313c312bdc16" @@ -14637,6 +14815,14 @@ metro-cache-key@0.79.1: resolved "https://registry.yarnpkg.com/metro-cache-key/-/metro-cache-key-0.79.1.tgz#80e6f2cd45a3ae04abb6874c75684e91f8c3668e" integrity sha512-/u48AuINgakqYEymRrD6MzKCSYU/JEXrqGX4x6gVHVa99TKPeg5SBi3MIjpZz/tWGpcQHCKItfjLD48YhEJr3Q== +metro-cache@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-cache/-/metro-cache-0.76.7.tgz#e49e51423fa960df4eeff9760d131f03e003a9eb" + integrity sha512-nWBMztrs5RuSxZRI7hgFgob5PhYDmxICh9FF8anm9/ito0u0vpPvRxt7sRu8fyeD2AHdXqE7kX32rWY0LiXgeg== + dependencies: + metro-core "0.76.7" + rimraf "^3.0.2" + metro-cache@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-cache/-/metro-cache-0.76.8.tgz#296c1c189db2053b89735a8f33dbe82575f53661" @@ -14653,6 +14839,19 @@ metro-cache@0.79.1: metro-core "0.79.1" rimraf "^3.0.2" +metro-config@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-config/-/metro-config-0.76.7.tgz#f0fc171707523aa7d3a9311550872136880558c0" + integrity sha512-CFDyNb9bqxZemiChC/gNdXZ7OQkIwmXzkrEXivcXGbgzlt/b2juCv555GWJHyZSlorwnwJfY3uzAFu4A9iRVfg== + dependencies: + connect "^3.6.5" + cosmiconfig "^5.0.5" + jest-validate "^29.2.1" + metro "0.76.7" + metro-cache "0.76.7" + metro-core "0.76.7" + metro-runtime "0.76.7" + metro-config@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-config/-/metro-config-0.76.8.tgz#20bd5397fcc6096f98d2a813a7cecb38b8af062d" @@ -14679,6 +14878,14 @@ metro-config@0.79.1: metro-core "0.79.1" metro-runtime "0.79.1" +metro-core@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-core/-/metro-core-0.76.7.tgz#5d2b8bac2cde801dc22666ad7be1336d1f021b61" + integrity sha512-0b8KfrwPmwCMW+1V7ZQPkTy2tsEKZjYG9Pu1PTsu463Z9fxX7WaR0fcHFshv+J1CnQSUTwIGGjbNvj1teKe+pw== + dependencies: + lodash.throttle "^4.1.1" + metro-resolver "0.76.7" + metro-core@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-core/-/metro-core-0.76.8.tgz#917c8157c63406cb223522835abb8e7c6291dcad" @@ -14695,6 +14902,26 @@ metro-core@0.79.1: lodash.throttle "^4.1.1" metro-resolver "0.79.1" +metro-file-map@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-file-map/-/metro-file-map-0.76.7.tgz#0f041a4f186ac672f0188180310609c8483ffe89" + integrity sha512-s+zEkTcJ4mOJTgEE2ht4jIo1DZfeWreQR3tpT3gDV/Y/0UQ8aJBTv62dE775z0GLsWZApiblAYZsj7ZE8P06nw== + dependencies: + anymatch "^3.0.3" + debug "^2.2.0" + fb-watchman "^2.0.0" + graceful-fs "^4.2.4" + invariant "^2.2.4" + jest-regex-util "^27.0.6" + jest-util "^27.2.0" + jest-worker "^27.2.0" + micromatch "^4.0.4" + node-abort-controller "^3.1.1" + nullthrows "^1.1.1" + walker "^1.0.7" + optionalDependencies: + fsevents "^2.3.2" + metro-file-map@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-file-map/-/metro-file-map-0.76.8.tgz#a1db1185b6c316904ba6b53d628e5d1323991d79" @@ -14734,6 +14961,17 @@ metro-file-map@0.79.1: optionalDependencies: fsevents "^2.3.2" +metro-inspector-proxy@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-inspector-proxy/-/metro-inspector-proxy-0.76.7.tgz#c067df25056e932002a72a4b45cf7b4b749f808e" + integrity sha512-rNZ/6edTl/1qUekAhAbaFjczMphM50/UjtxiKulo6vqvgn/Mjd9hVqDvVYfAMZXqPvlusD88n38UjVYPkruLSg== + dependencies: + connect "^3.6.5" + debug "^2.2.0" + node-fetch "^2.2.0" + ws "^7.5.1" + yargs "^17.6.2" + metro-inspector-proxy@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-inspector-proxy/-/metro-inspector-proxy-0.76.8.tgz#6b8678a7461b0b42f913a7881cc9319b4d3cddff" @@ -14745,6 +14983,13 @@ metro-inspector-proxy@0.76.8: ws "^7.5.1" yargs "^17.6.2" +metro-minify-terser@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-minify-terser/-/metro-minify-terser-0.76.7.tgz#aefac8bb8b6b3a0fcb5ea0238623cf3e100893ff" + integrity sha512-FQiZGhIxCzhDwK4LxyPMLlq0Tsmla10X7BfNGlYFK0A5IsaVKNJbETyTzhpIwc+YFRT4GkFFwgo0V2N5vxO5HA== + dependencies: + terser "^5.15.0" + metro-minify-terser@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-minify-terser/-/metro-minify-terser-0.76.8.tgz#915ab4d1419257fc6a0b9fa15827b83fe69814bf" @@ -14759,6 +15004,13 @@ metro-minify-terser@0.79.1: dependencies: terser "^5.15.0" +metro-minify-uglify@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-minify-uglify/-/metro-minify-uglify-0.76.7.tgz#3e0143786718dcaea4e28a724698d4f8ac199a43" + integrity sha512-FuXIU3j2uNcSvQtPrAJjYWHruPiQ+EpE++J9Z+VznQKEHcIxMMoQZAfIF2IpZSrZYfLOjVFyGMvj41jQMxV1Vw== + dependencies: + uglify-es "^3.1.9" + metro-minify-uglify@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-minify-uglify/-/metro-minify-uglify-0.76.8.tgz#74745045ea2dd29f8783db483b2fce58385ba695" @@ -14766,6 +15018,51 @@ metro-minify-uglify@0.76.8: dependencies: uglify-es "^3.1.9" +metro-react-native-babel-preset@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.76.7.tgz#dfe15c040d0918147a8b0e9f530d558287acbb54" + integrity sha512-R25wq+VOSorAK3hc07NW0SmN8z9S/IR0Us0oGAsBcMZnsgkbOxu77Mduqf+f4is/wnWHc5+9bfiqdLnaMngiVw== + dependencies: + "@babel/core" "^7.20.0" + "@babel/plugin-proposal-async-generator-functions" "^7.0.0" + "@babel/plugin-proposal-class-properties" "^7.18.0" + "@babel/plugin-proposal-export-default-from" "^7.0.0" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.18.0" + "@babel/plugin-proposal-numeric-separator" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.20.0" + "@babel/plugin-proposal-optional-catch-binding" "^7.0.0" + "@babel/plugin-proposal-optional-chaining" "^7.20.0" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" + "@babel/plugin-syntax-export-default-from" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.18.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.0.0" + "@babel/plugin-syntax-optional-chaining" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-async-to-generator" "^7.20.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.20.0" + "@babel/plugin-transform-flow-strip-types" "^7.20.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-self" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" + "@babel/plugin-transform-runtime" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-sticky-regex" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.5.0" + "@babel/plugin-transform-unicode-regex" "^7.0.0" + "@babel/template" "^7.0.0" + babel-plugin-transform-flow-enums "^0.0.2" + react-refresh "^0.4.0" + metro-react-native-babel-preset@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-react-native-babel-preset/-/metro-react-native-babel-preset-0.76.8.tgz#7476efae14363cbdfeeec403b4f01d7348e6c048" @@ -14811,6 +15108,17 @@ metro-react-native-babel-preset@0.76.8: babel-plugin-transform-flow-enums "^0.0.2" react-refresh "^0.4.0" +metro-react-native-babel-transformer@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.76.7.tgz#ccc7c25b49ee8a1860aafdbf48bfa5441d206f8f" + integrity sha512-W6lW3J7y/05ph3c2p3KKJNhH0IdyxdOCbQ5it7aM2MAl0SM4wgKjaV6EYv9b3rHklpV6K3qMH37UKVcjMooWiA== + dependencies: + "@babel/core" "^7.20.0" + babel-preset-fbjs "^3.4.0" + hermes-parser "0.12.0" + metro-react-native-babel-preset "0.76.7" + nullthrows "^1.1.1" + metro-react-native-babel-transformer@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-react-native-babel-transformer/-/metro-react-native-babel-transformer-0.76.8.tgz#c3a98e1f4cd5faf1e21eba8e004b94a90c4db69b" @@ -14822,6 +15130,11 @@ metro-react-native-babel-transformer@0.76.8: metro-react-native-babel-preset "0.76.8" nullthrows "^1.1.1" +metro-resolver@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-resolver/-/metro-resolver-0.76.7.tgz#f00ebead64e451c060f30926ecbf4f797588df52" + integrity sha512-pC0Wgq29HHIHrwz23xxiNgylhI8Rq1V01kQaJ9Kz11zWrIdlrH0ZdnJ7GC6qA0ErROG+cXmJ0rJb8/SW1Zp2IA== + metro-resolver@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-resolver/-/metro-resolver-0.76.8.tgz#0862755b9b84e26853978322464fb37c6fdad76d" @@ -14832,6 +15145,14 @@ metro-resolver@0.79.1: resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.79.1.tgz#80e6e27305eb446188009f54374b642f28f49b65" integrity sha512-hiea5co7c5rhrdD5xYohBq2Sw20Ytzie71raIW9SsXKBKzsS0zAbrwNFW5z71lDUnp719vhobnDXJ+yE7Kq9Gg== +metro-runtime@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-runtime/-/metro-runtime-0.76.7.tgz#4d75f2dbbcd19a4f01e0d89494e140b0ba8247e4" + integrity sha512-MuWHubQHymUWBpZLwuKZQgA/qbb35WnDAKPo83rk7JRLIFPvzXSvFaC18voPuzJBt1V98lKQIonh6MiC9gd8Ug== + dependencies: + "@babel/runtime" "^7.0.0" + react-refresh "^0.4.0" + metro-runtime@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-runtime/-/metro-runtime-0.76.8.tgz#74b2d301a2be5f3bbde91b8f1312106f8ffe50c3" @@ -14848,6 +15169,20 @@ metro-runtime@0.79.1: "@babel/runtime" "^7.0.0" react-refresh "^0.4.0" +metro-source-map@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-source-map/-/metro-source-map-0.76.7.tgz#9a4aa3a35e1e8ffde9a74cd7ab5f49d9d4a4da14" + integrity sha512-Prhx7PeRV1LuogT0Kn5VjCuFu9fVD68eefntdWabrksmNY6mXK8pRqzvNJOhTojh6nek+RxBzZeD6MIOOyXS6w== + dependencies: + "@babel/traverse" "^7.20.0" + "@babel/types" "^7.20.0" + invariant "^2.2.4" + metro-symbolicate "0.76.7" + nullthrows "^1.1.1" + ob1 "0.76.7" + source-map "^0.5.6" + vlq "^1.0.0" + metro-source-map@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-source-map/-/metro-source-map-0.76.8.tgz#f085800152a6ba0b41ca26833874d31ec36c5a53" @@ -14876,6 +15211,18 @@ metro-source-map@0.79.1: source-map "^0.5.6" vlq "^1.0.0" +metro-symbolicate@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-symbolicate/-/metro-symbolicate-0.76.7.tgz#1720e6b4ce5676935d7a8a440f25d3f16638e87a" + integrity sha512-p0zWEME5qLSL1bJb93iq+zt5fz3sfVn9xFYzca1TJIpY5MommEaS64Va87lp56O0sfEIvh4307Oaf/ZzRjuLiQ== + dependencies: + invariant "^2.2.4" + metro-source-map "0.76.7" + nullthrows "^1.1.1" + source-map "^0.5.6" + through2 "^2.0.1" + vlq "^1.0.0" + metro-symbolicate@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-symbolicate/-/metro-symbolicate-0.76.8.tgz#f102ac1a306d51597ecc8fdf961c0a88bddbca03" @@ -14900,6 +15247,17 @@ metro-symbolicate@0.79.1: through2 "^2.0.1" vlq "^1.0.0" +metro-transform-plugins@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-transform-plugins/-/metro-transform-plugins-0.76.7.tgz#5d5f75371706fbf5166288e43ffd36b5e5bd05bc" + integrity sha512-iSmnjVApbdivjuzb88Orb0JHvcEt5veVyFAzxiS5h0QB+zV79w6JCSqZlHCrbNOkOKBED//LqtKbFVakxllnNg== + dependencies: + "@babel/core" "^7.20.0" + "@babel/generator" "^7.20.0" + "@babel/template" "^7.0.0" + "@babel/traverse" "^7.20.0" + nullthrows "^1.1.1" + metro-transform-plugins@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-transform-plugins/-/metro-transform-plugins-0.76.8.tgz#d77c28a6547a8e3b72250f740fcfbd7f5408f8ba" @@ -14922,6 +15280,24 @@ metro-transform-plugins@0.79.1: "@babel/traverse" "^7.20.0" nullthrows "^1.1.1" +metro-transform-worker@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro-transform-worker/-/metro-transform-worker-0.76.7.tgz#b842d5a542f1806cca401633fc002559b3e3d668" + integrity sha512-cGvELqFMVk9XTC15CMVzrCzcO6sO1lURfcbgjuuPdzaWuD11eEyocvkTX0DPiRjsvgAmicz4XYxVzgYl3MykDw== + dependencies: + "@babel/core" "^7.20.0" + "@babel/generator" "^7.20.0" + "@babel/parser" "^7.20.0" + "@babel/types" "^7.20.0" + babel-preset-fbjs "^3.4.0" + metro "0.76.7" + metro-babel-transformer "0.76.7" + metro-cache "0.76.7" + metro-cache-key "0.76.7" + metro-source-map "0.76.7" + metro-transform-plugins "0.76.7" + nullthrows "^1.1.1" + metro-transform-worker@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro-transform-worker/-/metro-transform-worker-0.76.8.tgz#b9012a196cee205170d0c899b8b175b9305acdea" @@ -14957,6 +15333,60 @@ metro-transform-worker@0.79.1: metro-transform-plugins "0.79.1" nullthrows "^1.1.1" +metro@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/metro/-/metro-0.76.7.tgz#4885917ad28738c7d1e556630e0155f687336230" + integrity sha512-67ZGwDeumEPnrHI+pEDSKH2cx+C81Gx8Mn5qOtmGUPm/Up9Y4I1H2dJZ5n17MWzejNo0XAvPh0QL0CrlJEODVQ== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/core" "^7.20.0" + "@babel/generator" "^7.20.0" + "@babel/parser" "^7.20.0" + "@babel/template" "^7.0.0" + "@babel/traverse" "^7.20.0" + "@babel/types" "^7.20.0" + accepts "^1.3.7" + async "^3.2.2" + chalk "^4.0.0" + ci-info "^2.0.0" + connect "^3.6.5" + debug "^2.2.0" + denodeify "^1.2.1" + error-stack-parser "^2.0.6" + graceful-fs "^4.2.4" + hermes-parser "0.12.0" + image-size "^1.0.2" + invariant "^2.2.4" + jest-worker "^27.2.0" + jsc-safe-url "^0.2.2" + lodash.throttle "^4.1.1" + metro-babel-transformer "0.76.7" + metro-cache "0.76.7" + metro-cache-key "0.76.7" + metro-config "0.76.7" + metro-core "0.76.7" + metro-file-map "0.76.7" + metro-inspector-proxy "0.76.7" + metro-minify-terser "0.76.7" + metro-minify-uglify "0.76.7" + metro-react-native-babel-preset "0.76.7" + metro-resolver "0.76.7" + metro-runtime "0.76.7" + metro-source-map "0.76.7" + metro-symbolicate "0.76.7" + metro-transform-plugins "0.76.7" + metro-transform-worker "0.76.7" + mime-types "^2.1.27" + node-fetch "^2.2.0" + nullthrows "^1.1.1" + rimraf "^3.0.2" + serialize-error "^2.1.0" + source-map "^0.5.6" + strip-ansi "^6.0.0" + throat "^5.0.0" + ws "^7.5.1" + yargs "^17.6.2" + metro@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/metro/-/metro-0.76.8.tgz#ba526808b99977ca3f9ac5a7432fd02a340d13a6" @@ -16107,6 +16537,11 @@ oauth-sign@~0.9.0: resolved "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455" integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ== +ob1@0.76.7: + version "0.76.7" + resolved "https://registry.npmjs.org/ob1/-/ob1-0.76.7.tgz#95b68fadafd47e7a6a0ad64cf80f3140dd6d1124" + integrity sha512-BQdRtxxoUNfSoZxqeBGOyuT9nEYSn18xZHwGMb0mMVpn2NBcYbnyKY4BK2LIHRgw33CBGlUmE+KMaNvyTpLLtQ== + ob1@0.76.8: version "0.76.8" resolved "https://registry.npmjs.org/ob1/-/ob1-0.76.8.tgz#ac4c459465b1c0e2c29aaa527e09fc463d3ffec8" @@ -18102,17 +18537,17 @@ react-native-gesture-handler@2.13.1: lodash "^4.17.21" prop-types "^15.7.2" -react-native-tvos@0.72.5-0: - version "0.72.5-0" - resolved "https://registry.yarnpkg.com/react-native-tvos/-/react-native-tvos-0.72.5-0.tgz#4963541c912f98457b9c34aa2255825a46c8f5c8" - integrity sha512-pb5OcC8aW8Z7JW7ML/asKjuGI/rE7GCXcnhlwXbnyyRsRhhv/9DVkV45H52pwhVuf+vq2CjlZ49PfJM40lj79w== +react-native-tvos@0.72.4-0: + version "0.72.4-0" + resolved "https://registry.npmjs.org/react-native-tvos/-/react-native-tvos-0.72.4-0.tgz#beb36bac097e272c0e62c5cfe51cd674c7c2aa57" + integrity sha512-JrQv2Bwbjd0ql4TT1msjxb65zNkQXHjTASQ81tJaR8nNYceJyFntqKPcfkXOH65DcsHIYhhXC+rgc22hL8kjrg== dependencies: "@jest/create-cache-key-function" "^29.2.1" - "@react-native-community/cli" "11.3.7" - "@react-native-community/cli-platform-android" "11.3.7" - "@react-native-community/cli-platform-ios" "11.3.7" + "@react-native-community/cli" "11.3.6" + "@react-native-community/cli-platform-android" "11.3.6" + "@react-native-community/cli-platform-ios" "11.3.6" "@react-native/assets-registry" "^0.72.0" - "@react-native/codegen" "^0.72.7" + "@react-native/codegen" "^0.72.6" "@react-native/gradle-plugin" "^0.72.11" "@react-native/js-polyfills" "^0.72.1" "@react-native/normalize-colors" "^0.72.0" @@ -18204,17 +18639,17 @@ react-native-windows@0.72.10: ws "^6.2.2" yargs "^17.6.2" -react-native@0.72.5: - version "0.72.5" - resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.72.5.tgz#2c343fa6f3ead362cf07376634a33a4078864357" - integrity sha512-oIewslu5DBwOmo7x5rdzZlZXCqDIna0R4dUwVpfmVteORYLr4yaZo5wQnMeR+H7x54GaMhmgeqp0ZpULtulJFg== +react-native@0.72.4: + version "0.72.4" + resolved "https://registry.npmjs.org/react-native/-/react-native-0.72.4.tgz#97b57e22e4d7657eaf4d1f62a678511fcf9bdda7" + integrity sha512-+vrObi0wZR+NeqL09KihAAdVlQ9IdplwznJWtYrjnQ4UbCW6rkzZJebRsugwUneSOKNFaHFEo1uKU89HsgtYBg== dependencies: "@jest/create-cache-key-function" "^29.2.1" - "@react-native-community/cli" "11.3.7" - "@react-native-community/cli-platform-android" "11.3.7" - "@react-native-community/cli-platform-ios" "11.3.7" + "@react-native-community/cli" "11.3.6" + "@react-native-community/cli-platform-android" "11.3.6" + "@react-native-community/cli-platform-ios" "11.3.6" "@react-native/assets-registry" "^0.72.0" - "@react-native/codegen" "^0.72.7" + "@react-native/codegen" "^0.72.6" "@react-native/gradle-plugin" "^0.72.11" "@react-native/js-polyfills" "^0.72.1" "@react-native/normalize-colors" "^0.72.0" From a07d8067a7608873a57ca3816f761e024ce1e260 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 12:03:16 +0200 Subject: [PATCH 6/8] cleanup engine adapters --- package.json | 3 - packages/engine-rn-tvos/src/adapter.ts.old | 120 ---------- .../src/adapters/babelAdapter.ts | 21 +- .../src/adapters/metroAdapter.ts | 208 ++++++------------ packages/engine-rn/src/adapter.ts.old | 96 -------- packages/sdk-webpack/package.json | 1 - packages/template-starter/babel.config.js | 8 +- packages/template-starter/src/config.tsx | 1 + packages/template-starter/src/entry/index.ts | 1 - yarn.lock | 2 +- 10 files changed, 71 insertions(+), 390 deletions(-) delete mode 100644 packages/engine-rn-tvos/src/adapter.ts.old delete mode 100644 packages/engine-rn/src/adapter.ts.old diff --git a/package.json b/package.json index dc797159b4..757098094a 100644 --- a/package.json +++ b/package.json @@ -86,9 +86,6 @@ }, "devDependencies": { "@babel/eslint-parser": "7.17.0", - "@babel/plugin-transform-runtime": "^7.0.0", - "@babel/preset-react": "7.22.15", - "@babel/runtime": "^7.0.0", "@flexn/eslint-config": "1.0.0", "@flexn/prettier-config": "1.0.0", "@flexn/typescript-config": "1.0.0", diff --git a/packages/engine-rn-tvos/src/adapter.ts.old b/packages/engine-rn-tvos/src/adapter.ts.old deleted file mode 100644 index bc4fd98c48..0000000000 --- a/packages/engine-rn-tvos/src/adapter.ts.old +++ /dev/null @@ -1,120 +0,0 @@ -const path = require('path'); -const os = require('os'); -const { doResolve } = require('@rnv/core'); - -const _require2 = require('metro-cache'); - -const { FileStore } = _require2; - -const sharedBlacklist = [ - /node_modules\/react\/dist\/.*/, - /website\/node_modules\/.*/, - /heapCapture\/bundle\.js/, - /.*\/__tests__\/.*/, -]; - -const env: any = process?.env; - -function escapeRegExp(pattern: RegExp | string) { - if (typeof pattern === 'string') { - // eslint-disable-next-line - const escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); // convert the '/' into an escaped local file separator - - return escaped.replace(/\//g, `\\${path.sep}`); - } else if (Object.prototype.toString.call(pattern) === '[object RegExp]') { - return pattern.source.replace(/\//g, path.sep); - } - throw new Error(`Unexpected blacklist pattern: ${pattern}`); -} - -function blacklist(additionalBlacklist: RegExp[]) { - return new RegExp(`(${(additionalBlacklist || []).concat(sharedBlacklist).map(escapeRegExp).join('|')})$`); -} - -export const withRNVMetro = (config: any) => { - const projectPath = env.RNV_PROJECT_ROOT || process.cwd(); - - const watchFolders = [path.resolve(projectPath, 'node_modules')]; - - if (env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true) { - const monoRootPath = env.RNV_MONO_ROOT || projectPath; - watchFolders.push(path.resolve(monoRootPath, 'node_modules')); - watchFolders.push(path.resolve(monoRootPath, 'packages')); - } - if (config?.watchFolders?.length) { - watchFolders.push(...config.watchFolders); - } - - const exts: string = env.RNV_EXTENSIONS || ''; - - const cnf = { - ...config, - cacheStores: [ - new FileStore({ - root: path.join(os.tmpdir(), 'metro-cache-tvos'), - }), - ], - transformer: { - getTransformOptions: async () => ({ - transform: { - experimentalImportSupport: false, - // this defeats the RCTDeviceEventEmitter is not a registered callable module - inlineRequires: true, - }, - }), - assetRegistryPath: path.resolve(`${doResolve('react-native-tvos')}/Libraries/Image/AssetRegistry.js`), - ...(config?.transformer || {}), - }, - resolver: { - blacklistRE: blacklist([ - /platformBuilds\/.*/, - /buildHooks\/.*/, - /projectConfig\/.*/, - /website\/.*/, - /appConfigs\/.*/, - /renative.local.*/, - /metro.config.local.*/, - /.expo\/.*/, - /.rollup.cache\/.*/, - ]), - ...(config?.resolver || {}), - sourceExts: [...(config?.resolver?.sourceExts || []), ...exts.split(',')], - extraNodeModules: config?.resolver?.extraNodeModules, - }, - watchFolders, - projectRoot: path.resolve(projectPath), - }; - - return cnf; -}; - -export const createEngineAlias = (customAlias: any) => { - const projectPath = env.RNV_PROJECT_ROOT || process.cwd(); - const isMonorepo = env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true; - const rootPath = isMonorepo ? env.RNV_MONO_ROOT || projectPath : projectPath; - const alias = customAlias ? { ...customAlias } : {}; - - if (env.RNV_IS_NATIVE_TV === 'true' || env.RNV_IS_NATIVE_TV === true) { - alias['react-native'] = `${rootPath}/node_modules/react-native-tvos`; - } - - return alias; -}; -export const withRNVBabel = (cnf: any) => { - const plugins = cnf?.plugins || []; - - return { - retainLines: true, - presets: ['module:metro-react-native-babel-preset'], - ...cnf, - plugins: [ - [ - require.resolve('babel-plugin-module-resolver'), - { - root: [env.RNV_MONO_ROOT || '.'], - }, - ], - ...plugins, - ], - }; -}; diff --git a/packages/engine-rn-tvos/src/adapters/babelAdapter.ts b/packages/engine-rn-tvos/src/adapters/babelAdapter.ts index 24b0f3b052..5d67bca75f 100644 --- a/packages/engine-rn-tvos/src/adapters/babelAdapter.ts +++ b/packages/engine-rn-tvos/src/adapters/babelAdapter.ts @@ -1,18 +1,3 @@ -const env: any = process?.env; - -const createEngineAlias = () => { - const projectPath = process.env.RNV_PROJECT_ROOT || process.cwd(); - const isMonorepo = process.env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true; - const rootPath = isMonorepo ? process.env.RNV_MONO_ROOT || projectPath : projectPath; - const alias: any = {}; - - if (process.env.RNV_IS_NATIVE_TV === 'true' || env.RNV_IS_NATIVE_TV === true) { - alias['react-native'] = `${rootPath}/node_modules/react-native-tvos`; - } - - return alias; -}; - export const withRNVBabel = (cnf: any) => { const plugins = cnf?.plugins || []; @@ -24,8 +9,10 @@ export const withRNVBabel = (cnf: any) => { [ require.resolve('babel-plugin-module-resolver'), { - root: [process.env.RNV_MONO_ROOT || '.'], - alias: createEngineAlias(), + root: [process.env.RNV_MONO_ROOT], + alias: { + 'react-native': process.env.RNV_REACT_NATIVE_PATH, + }, }, ], ...plugins, diff --git a/packages/engine-rn-tvos/src/adapters/metroAdapter.ts b/packages/engine-rn-tvos/src/adapters/metroAdapter.ts index 2610009589..df12ec6889 100644 --- a/packages/engine-rn-tvos/src/adapters/metroAdapter.ts +++ b/packages/engine-rn-tvos/src/adapters/metroAdapter.ts @@ -1,145 +1,60 @@ -import { FileStore } from 'metro-cache'; +const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); + +const path = require('path'); +const os = require('os'); const { doResolve } = require('@rnv/core'); -import path from 'path'; -import os from 'os'; +const _require2 = require('metro-cache'); + +const { FileStore } = _require2; + +const sharedBlacklist = [ + /node_modules\/react\/dist\/.*/, + /website\/node_modules\/.*/, + /heapCapture\/bundle\.js/, + /.*\/__tests__\/.*/, +]; const env: any = process?.env; -const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); +function escapeRegExp(pattern: RegExp | string) { + if (typeof pattern === 'string') { + // eslint-disable-next-line + const escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); // convert the '/' into an escaped local file separator -const DEFAULT_CONFIG = { - resolver: { - assetExts: [ - 'bmp', - 'gif', - 'jpg', - 'jpeg', - 'png', - 'psd', - 'svg', - 'webp', - 'm4v', - 'mov', - 'mp4', - 'mpeg', - 'mpg', - 'webm', - 'aac', - 'aiff', - 'caf', - 'm4a', - 'mp3', - 'wav', - 'html', - 'pdf', - 'yaml', - 'yml', - 'otf', - 'ttf', - 'zip', - ], - assetResolutions: ['1', '1.5', '2', '3', '4'], - platforms: ['android', 'ios'], - sourceExts: ['js', 'jsx', 'json', 'ts', 'tsx'], - disableHierarchicalLookup: false, - unstable_enableSymlinks: false, - emptyModulePath: '../../node_modules/metro-runtime/src/modules/empty-module.js', - extraNodeModules: {}, - nodeModulesPaths: [], - resolveRequest: null, - resolverMainFields: ['react-native', 'browser', 'main'], - unstable_conditionNames: ['require', 'import', 'react-native'], - unstable_conditionsByPlatform: { - web: ['browser'], - }, - unstable_enablePackageExports: false, - useWatchman: true, - }, - serializer: { - polyfillModuleNames: [], - customSerializer: null, - }, - server: { - port: 8086, - runInspectorProxy: true, - unstable_serverRoot: null, - useGlobalHotkey: true, - verifyConnections: false, - }, - symbolicator: {}, - transformer: { - assetPlugins: [], - asyncRequireModulePath: '../../node_modules/metro-runtime/src/modules/asyncRequire.js', - assetRegistryPath: 'react-native-tvos/Libraries/Image/AssetRegistry', - babelTransformerPath: '../../node_modules/metro-react-native-babel-transformer/src/index.js', - dynamicDepsInPackages: 'throwAtRuntime', - enableBabelRCLookup: true, - enableBabelRuntime: true, - globalPrefix: '', - hermesParser: false, - minifierConfig: { - mangle: { - toplevel: false, - }, - output: { - ascii_only: true, - comments: false, - quote_style: 3, - wrap_iife: true, - }, - sourceMap: { - includeSources: false, - }, - toplevel: false, - compress: { - reduce_funcs: false, - }, - }, - minifierPath: 'metro-minify-terser', - optimizationSizeLimit: 153600, - transformVariants: { - default: {}, - }, - workerPath: 'metro/src/DeltaBundler/Worker', - publicPath: '/assets', - allowOptionalDependencies: true, - unstable_allowRequireContext: false, - unstable_dependencyMapReservedName: null, - unstable_disableModuleWrapping: false, - unstable_disableNormalizePseudoGlobals: false, - unstable_compactOutput: false, - }, - watcher: { - additionalExts: ['cjs', 'mjs'], - healthCheck: { - enabled: false, - filePrefix: '.metro-health-check', - interval: 30000, - timeout: 5000, - }, - watchman: { - deferStates: ['hg.update'], - }, - }, - stickyWorkers: true, - watchFolders: ['../..'], - transformerPath: 'metro-transform-worker', - resetCache: false, - cacheStores: [ - new FileStore({ - root: path.join(os.tmpdir(), 'metro-cache-tvos'), - }), - ], -}; + return escaped.replace(/\//g, `\\${path.sep}`); + } else if (Object.prototype.toString.call(pattern) === '[object RegExp]') { + return pattern.source.replace(/\//g, path.sep); + } + throw new Error(`Unexpected blacklist pattern: ${pattern}`); +} + +function blacklist(additionalBlacklist: RegExp[]) { + return new RegExp(`(${(additionalBlacklist || []).concat(sharedBlacklist).map(escapeRegExp).join('|')})$`); +} export const withRNVMetro = (config: any) => { - const projectPath = process.env.RNV_PROJECT_ROOT || process.cwd(); + const projectPath = env.RNV_PROJECT_ROOT || process.cwd(); + + const watchFolders = [path.resolve(projectPath, 'node_modules')]; + + if (env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true) { + const monoRootPath = env.RNV_MONO_ROOT || projectPath; + watchFolders.push(path.resolve(monoRootPath, 'node_modules')); + watchFolders.push(path.resolve(monoRootPath, 'packages')); + } + if (config?.watchFolders?.length) { + watchFolders.push(...config.watchFolders); + } const exts: string = env.RNV_EXTENSIONS || ''; - const cfg = mergeConfig(getDefaultConfig(projectPath), { - ...DEFAULT_CONFIG, + const cnfRnv = { + cacheStores: [ + new FileStore({ + root: path.join(os.tmpdir(), 'metro-cache-tvos'), + }), + ], transformer: { getTransformOptions: async () => ({ transform: { @@ -149,27 +64,30 @@ export const withRNVMetro = (config: any) => { }, }), assetRegistryPath: path.resolve(`${doResolve('react-native-tvos')}/Libraries/Image/AssetRegistry.js`), - ...(config?.transformer || {}), }, resolver: { - // blacklistRE: blacklist([ - // /platformBuilds\/.*/, - // /buildHooks\/.*/, - // /projectConfig\/.*/, - // /website\/.*/, - // /appConfigs\/.*/, - // /renative.local.*/, - // /metro.config.local.*/, - // /.expo\/.*/, - // /.rollup.cache\/.*/, - // ]), + blacklistRE: blacklist([ + /platformBuilds\/.*/, + /buildHooks\/.*/, + /projectConfig\/.*/, + /website\/.*/, + /appConfigs\/.*/, + /renative.local.*/, + /metro.config.local.*/, + /.expo\/.*/, + /.rollup.cache\/.*/, + ]), ...(config?.resolver || {}), sourceExts: [...(config?.resolver?.sourceExts || []), ...exts.split(',')], extraNodeModules: config?.resolver?.extraNodeModules, }, - }); + watchFolders, + projectRoot: path.resolve(projectPath), + }; + + const cnfWithRnv = mergeConfig(getDefaultConfig(projectPath), cnfRnv); - const cnf = mergeConfig(cfg, config); + const cnf = mergeConfig(cnfWithRnv, config); return cnf; }; diff --git a/packages/engine-rn/src/adapter.ts.old b/packages/engine-rn/src/adapter.ts.old deleted file mode 100644 index 7e292addad..0000000000 --- a/packages/engine-rn/src/adapter.ts.old +++ /dev/null @@ -1,96 +0,0 @@ -// const path = require('path'); - -// const sharedBlacklist = [ -// /node_modules\/react\/dist\/.*/, -// /website\/node_modules\/.*/, -// /heapCapture\/bundle\.js/, -// /.*\/__tests__\/.*/, -// ]; - -// const env: any = process?.env; - -// function escapeRegExp(pattern: RegExp | string) { -// if (typeof pattern === 'string') { -// // eslint-disable-next-line -// const escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); // convert the '/' into an escaped local file separator - -// return escaped.replace(/\//g, `\\${path.sep}`); -// } else if (Object.prototype.toString.call(pattern) === '[object RegExp]') { -// return pattern.source.replace(/\//g, path.sep); -// } -// throw new Error(`Unexpected blacklist pattern: ${pattern}`); -// } - -// function blacklist(additionalBlacklist: RegExp[]) { -// return new RegExp(`(${(additionalBlacklist || []).concat(sharedBlacklist).map(escapeRegExp).join('|')})$`); -// } - -// export const withRNVMetro = (config: any) => { -// const projectPath = process.env.RNV_PROJECT_ROOT || process.cwd(); - -// const watchFolders = [path.resolve(projectPath, 'node_modules')]; - -// if (env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true) { -// const monoRootPath = process.env.RNV_MONO_ROOT || projectPath; -// watchFolders.push(path.resolve(monoRootPath, 'node_modules')); -// watchFolders.push(path.resolve(monoRootPath, 'packages')); -// } -// if (config?.watchFolders?.length) { -// watchFolders.push(...config.watchFolders); -// } - -// const exts: string = env.RNV_EXTENSIONS || ''; - -// const cnf = { -// ...config, -// transformer: { -// getTransformOptions: async () => ({ -// transform: { -// experimentalImportSupport: false, -// // this defeats the RCTDeviceEventEmitter is not a registered callable module -// inlineRequires: true, -// }, -// }), -// ...(config?.transformer || {}), -// }, -// resolver: { -// blacklistRE: blacklist([ -// /platformBuilds\/.*/, -// /buildHooks\/.*/, -// /projectConfig\/.*/, -// /website\/.*/, -// /appConfigs\/.*/, -// /renative.local.*/, -// /metro.config.local.*/, -// /.expo\/.*/, -// /.rollup.cache\/.*/, -// ]), -// ...(config?.resolver || {}), -// sourceExts: [...(config?.resolver?.sourceExts || []), ...exts.split(',')], -// extraNodeModules: config?.resolver?.extraNodeModules, -// }, -// watchFolders, -// projectRoot: path.resolve(projectPath), -// }; - -// return cnf; -// }; - -// export const withRNVBabel = (cnf: any) => { -// const plugins = cnf?.plugins || []; - -// return { -// retainLines: true, -// presets: ['module:metro-react-native-babel-preset'], -// ...cnf, -// plugins: [ -// [ -// require.resolve('babel-plugin-module-resolver'), -// { -// root: [process.env.RNV_MONO_ROOT || '.'], -// }, -// ], -// ...plugins, -// ], -// }; -// }; diff --git a/packages/sdk-webpack/package.json b/packages/sdk-webpack/package.json index 84809ce3ad..e6673e7556 100644 --- a/packages/sdk-webpack/package.json +++ b/packages/sdk-webpack/package.json @@ -29,7 +29,6 @@ "watch": "tsc --watch --preserveWatchOutput" }, "dependencies": { - "@babel/preset-react": "7.22.15", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.3", "@svgr/webpack": "6.3.1", "axios": "0.21.2", diff --git a/packages/template-starter/babel.config.js b/packages/template-starter/babel.config.js index 476fe110e1..8d4e054380 100644 --- a/packages/template-starter/babel.config.js +++ b/packages/template-starter/babel.config.js @@ -1,7 +1,3 @@ -// const { withRNVBabel } = require('rnv'); +const { withRNVBabel } = require('rnv'); -// module.exports = withRNVBabel({}); - -module.exports = { - presets: ['module:metro-react-native-babel-preset'], -} \ No newline at end of file +module.exports = withRNVBabel({}); diff --git a/packages/template-starter/src/config.tsx b/packages/template-starter/src/config.tsx index fae3f2331c..eebdabade3 100644 --- a/packages/template-starter/src/config.tsx +++ b/packages/template-starter/src/config.tsx @@ -1,5 +1,6 @@ import React, { createContext, useState } from 'react'; import { StyleSheet } from 'react-native'; + import { getScaledValue, isPlatformMacos, isPlatformIos, isPlatformTvos, isPlatformWeb } from '@rnv/renative'; import CONFIG from '../platformAssets/renative.runtime.json'; import '../platformAssets/runtime/fontManager'; diff --git a/packages/template-starter/src/entry/index.ts b/packages/template-starter/src/entry/index.ts index 6d81a19bbd..9c8426b5c0 100644 --- a/packages/template-starter/src/entry/index.ts +++ b/packages/template-starter/src/entry/index.ts @@ -1,4 +1,3 @@ -import 'react-native/Libraries/Core/InitializeCore'; //https://github.com/flexn-io/renative/issues/876 import { AppRegistry } from 'react-native'; import App from '../app'; diff --git a/yarn.lock b/yarn.lock index a622264ea4..8fef51a4d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1234,7 +1234,7 @@ "@babel/types" "^7.4.4" esutils "^2.0.2" -"@babel/preset-react@7.22.15", "@babel/preset-react@^7.17.12": +"@babel/preset-react@^7.17.12": version "7.22.15" resolved "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.22.15.tgz#9a776892b648e13cc8ca2edf5ed1264eea6b6afc" integrity sha512-Csy1IJ2uEh/PecCBXXoZGAZBeCATTuePzCSB7dLYWS0vOEj6CNpjxIhW4duWwZodBNueH7QO14WbGn8YyeuN9w== From e2d8823e4b8eb50f2ae347bfa19edf1bfb009f07 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 12:37:13 +0200 Subject: [PATCH 7/8] use metro config defaults --- .../engine-rn/src/adapters/metroAdapter.ts | 234 +++++++++--------- 1 file changed, 117 insertions(+), 117 deletions(-) diff --git a/packages/engine-rn/src/adapters/metroAdapter.ts b/packages/engine-rn/src/adapters/metroAdapter.ts index 79f9ef1932..154917a2ca 100644 --- a/packages/engine-rn/src/adapters/metroAdapter.ts +++ b/packages/engine-rn/src/adapters/metroAdapter.ts @@ -1,123 +1,123 @@ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); const DEFAULT_CONFIG = { - resolver: { - assetExts: [ - 'bmp', - 'gif', - 'jpg', - 'jpeg', - 'png', - 'psd', - 'svg', - 'webp', - 'm4v', - 'mov', - 'mp4', - 'mpeg', - 'mpg', - 'webm', - 'aac', - 'aiff', - 'caf', - 'm4a', - 'mp3', - 'wav', - 'html', - 'pdf', - 'yaml', - 'yml', - 'otf', - 'ttf', - 'zip', - ], - assetResolutions: ['1', '1.5', '2', '3', '4'], - platforms: ['android', 'ios'], - sourceExts: ['js', 'jsx', 'json', 'ts', 'tsx'], - disableHierarchicalLookup: false, - unstable_enableSymlinks: false, - emptyModulePath: '../../node_modules/metro-runtime/src/modules/empty-module.js', - extraNodeModules: {}, - nodeModulesPaths: [], - resolveRequest: null, - resolverMainFields: ['react-native', 'browser', 'main'], - unstable_conditionNames: ['require', 'import', 'react-native'], - unstable_conditionsByPlatform: { - web: ['browser'], - }, - unstable_enablePackageExports: false, - useWatchman: true, - }, - serializer: { - polyfillModuleNames: [], - customSerializer: null, - }, - server: { - port: 8081, - runInspectorProxy: true, - unstable_serverRoot: null, - useGlobalHotkey: true, - verifyConnections: false, - }, - symbolicator: {}, - transformer: { - assetPlugins: [], - asyncRequireModulePath: '../../node_modules/metro-runtime/src/modules/asyncRequire.js', - assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry', - babelTransformerPath: '../../node_modules/metro-react-native-babel-transformer/src/index.js', - dynamicDepsInPackages: 'throwAtRuntime', - enableBabelRCLookup: true, - enableBabelRuntime: true, - globalPrefix: '', - hermesParser: false, - minifierConfig: { - mangle: { - toplevel: false, - }, - output: { - ascii_only: true, - comments: false, - quote_style: 3, - wrap_iife: true, - }, - sourceMap: { - includeSources: false, - }, - toplevel: false, - compress: { - reduce_funcs: false, - }, - }, - minifierPath: 'metro-minify-terser', - optimizationSizeLimit: 153600, - transformVariants: { - default: {}, - }, - workerPath: 'metro/src/DeltaBundler/Worker', - publicPath: '/assets', - allowOptionalDependencies: true, - unstable_allowRequireContext: false, - unstable_dependencyMapReservedName: null, - unstable_disableModuleWrapping: false, - unstable_disableNormalizePseudoGlobals: false, - unstable_compactOutput: false, - }, - watcher: { - additionalExts: ['cjs', 'mjs'], - healthCheck: { - enabled: false, - filePrefix: '.metro-health-check', - interval: 30000, - timeout: 5000, - }, - watchman: { - deferStates: ['hg.update'], - }, - }, - stickyWorkers: true, - watchFolders: ['../..'], - transformerPath: 'metro-transform-worker', - resetCache: false, + // resolver: { + // assetExts: [ + // 'bmp', + // 'gif', + // 'jpg', + // 'jpeg', + // 'png', + // 'psd', + // 'svg', + // 'webp', + // 'm4v', + // 'mov', + // 'mp4', + // 'mpeg', + // 'mpg', + // 'webm', + // 'aac', + // 'aiff', + // 'caf', + // 'm4a', + // 'mp3', + // 'wav', + // 'html', + // 'pdf', + // 'yaml', + // 'yml', + // 'otf', + // 'ttf', + // 'zip', + // ], + // assetResolutions: ['1', '1.5', '2', '3', '4'], + // platforms: ['android', 'ios'], + // sourceExts: ['js', 'jsx', 'json', 'ts', 'tsx'], + // disableHierarchicalLookup: false, + // unstable_enableSymlinks: false, + // emptyModulePath: '../../node_modules/metro-runtime/src/modules/empty-module.js', + // extraNodeModules: {}, + // nodeModulesPaths: [], + // resolveRequest: null, + // resolverMainFields: ['react-native', 'browser', 'main'], + // unstable_conditionNames: ['require', 'import', 'react-native'], + // unstable_conditionsByPlatform: { + // web: ['browser'], + // }, + // unstable_enablePackageExports: false, + // useWatchman: true, + // }, + // serializer: { + // polyfillModuleNames: [], + // customSerializer: null, + // }, + // server: { + // port: 8081, + // runInspectorProxy: true, + // unstable_serverRoot: null, + // useGlobalHotkey: true, + // verifyConnections: false, + // }, + // symbolicator: {}, + // transformer: { + // assetPlugins: [], + // asyncRequireModulePath: '../../node_modules/metro-runtime/src/modules/asyncRequire.js', + // assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry', + // babelTransformerPath: '../../node_modules/metro-react-native-babel-transformer/src/index.js', + // dynamicDepsInPackages: 'throwAtRuntime', + // enableBabelRCLookup: true, + // enableBabelRuntime: true, + // globalPrefix: '', + // hermesParser: false, + // minifierConfig: { + // mangle: { + // toplevel: false, + // }, + // output: { + // ascii_only: true, + // comments: false, + // quote_style: 3, + // wrap_iife: true, + // }, + // sourceMap: { + // includeSources: false, + // }, + // toplevel: false, + // compress: { + // reduce_funcs: false, + // }, + // }, + // minifierPath: 'metro-minify-terser', + // optimizationSizeLimit: 153600, + // transformVariants: { + // default: {}, + // }, + // workerPath: 'metro/src/DeltaBundler/Worker', + // publicPath: '/assets', + // allowOptionalDependencies: true, + // unstable_allowRequireContext: false, + // unstable_dependencyMapReservedName: null, + // unstable_disableModuleWrapping: false, + // unstable_disableNormalizePseudoGlobals: false, + // unstable_compactOutput: false, + // }, + // watcher: { + // additionalExts: ['cjs', 'mjs'], + // healthCheck: { + // enabled: false, + // filePrefix: '.metro-health-check', + // interval: 30000, + // timeout: 5000, + // }, + // watchman: { + // deferStates: ['hg.update'], + // }, + // }, + // stickyWorkers: true, + // watchFolders: ['../..'], + // transformerPath: 'metro-transform-worker', + // resetCache: false, }; export const withRNVMetro = (config: any) => { From c7ebd9427c43da04df08c28c3df11a07d5d96c11 Mon Sep 17 00:00:00 2001 From: Pavel Jacko Date: Thu, 5 Oct 2023 13:31:32 +0200 Subject: [PATCH 8/8] run ios/tvos in parallel --- .../macos/RNVAppMACOS/ViewController.m | 2 +- .../java/rnv_template/MainActivity.java.tpl | 2 +- .../app/src/main/java/rnv/MainActivity.kt | 2 +- .../engine-rn/src/adapters/metroAdapter.ts | 185 ++++++------------ .../java/rnv_template/MainActivity.java.tpl | 2 +- .../app/src/main/java/rnv/MainActivity.kt | 2 +- .../platforms/ios/RNVApp/AppDelegate.mm | 2 +- .../platforms/macos/RNVApp/AppDelegate.swift | 2 +- 8 files changed, 70 insertions(+), 129 deletions(-) diff --git a/packages/engine-rn-macos/templates/platforms/macos/RNVAppMACOS/ViewController.m b/packages/engine-rn-macos/templates/platforms/macos/RNVAppMACOS/ViewController.m index 2667d7f389..5bc4efeb1d 100644 --- a/packages/engine-rn-macos/templates/platforms/macos/RNVAppMACOS/ViewController.m +++ b/packages/engine-rn-macos/templates/platforms/macos/RNVAppMACOS/ViewController.m @@ -9,7 +9,7 @@ - (void)viewDidLoad { [super viewDidLoad]; RCTBridge *bridge = [((AppDelegate *)[NSApp delegate])bridge]; - RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"App" initialProperties:nil]; + RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"RNVApp" initialProperties:nil]; NSView *view = [self view]; diff --git a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl index a631fcada6..2fdae08c2f 100644 --- a/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl +++ b/packages/engine-rn-tvos/templates/platforms/androidtv/app/src/main/java/rnv_template/MainActivity.java.tpl @@ -13,7 +13,7 @@ public class MainActivity extends ReactActivity { */ @Override protected String getMainComponentName() { - return "App"; + return "RNVApp"; } /** diff --git a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv/MainActivity.kt b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv/MainActivity.kt index 8df108997a..3625a29f9a 100644 --- a/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv/MainActivity.kt +++ b/packages/engine-rn-tvos/templates/platforms/firetv/app/src/main/java/rnv/MainActivity.kt @@ -14,7 +14,7 @@ import com.facebook.react.ReactRootView */ class MainActivity : ReactActivity() { - override fun getMainComponentName(): String? = "App" + override fun getMainComponentName(): String? = "RNVApp" override fun onCreate(savedInstanceState: Bundle?) { {{INJECT_ON_CREATE}} diff --git a/packages/engine-rn/src/adapters/metroAdapter.ts b/packages/engine-rn/src/adapters/metroAdapter.ts index 154917a2ca..b54d0be124 100644 --- a/packages/engine-rn/src/adapters/metroAdapter.ts +++ b/packages/engine-rn/src/adapters/metroAdapter.ts @@ -1,130 +1,71 @@ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); +const path = require('path'); -const DEFAULT_CONFIG = { - // resolver: { - // assetExts: [ - // 'bmp', - // 'gif', - // 'jpg', - // 'jpeg', - // 'png', - // 'psd', - // 'svg', - // 'webp', - // 'm4v', - // 'mov', - // 'mp4', - // 'mpeg', - // 'mpg', - // 'webm', - // 'aac', - // 'aiff', - // 'caf', - // 'm4a', - // 'mp3', - // 'wav', - // 'html', - // 'pdf', - // 'yaml', - // 'yml', - // 'otf', - // 'ttf', - // 'zip', - // ], - // assetResolutions: ['1', '1.5', '2', '3', '4'], - // platforms: ['android', 'ios'], - // sourceExts: ['js', 'jsx', 'json', 'ts', 'tsx'], - // disableHierarchicalLookup: false, - // unstable_enableSymlinks: false, - // emptyModulePath: '../../node_modules/metro-runtime/src/modules/empty-module.js', - // extraNodeModules: {}, - // nodeModulesPaths: [], - // resolveRequest: null, - // resolverMainFields: ['react-native', 'browser', 'main'], - // unstable_conditionNames: ['require', 'import', 'react-native'], - // unstable_conditionsByPlatform: { - // web: ['browser'], - // }, - // unstable_enablePackageExports: false, - // useWatchman: true, - // }, - // serializer: { - // polyfillModuleNames: [], - // customSerializer: null, - // }, - // server: { - // port: 8081, - // runInspectorProxy: true, - // unstable_serverRoot: null, - // useGlobalHotkey: true, - // verifyConnections: false, - // }, - // symbolicator: {}, - // transformer: { - // assetPlugins: [], - // asyncRequireModulePath: '../../node_modules/metro-runtime/src/modules/asyncRequire.js', - // assetRegistryPath: 'react-native/Libraries/Image/AssetRegistry', - // babelTransformerPath: '../../node_modules/metro-react-native-babel-transformer/src/index.js', - // dynamicDepsInPackages: 'throwAtRuntime', - // enableBabelRCLookup: true, - // enableBabelRuntime: true, - // globalPrefix: '', - // hermesParser: false, - // minifierConfig: { - // mangle: { - // toplevel: false, - // }, - // output: { - // ascii_only: true, - // comments: false, - // quote_style: 3, - // wrap_iife: true, - // }, - // sourceMap: { - // includeSources: false, - // }, - // toplevel: false, - // compress: { - // reduce_funcs: false, - // }, - // }, - // minifierPath: 'metro-minify-terser', - // optimizationSizeLimit: 153600, - // transformVariants: { - // default: {}, - // }, - // workerPath: 'metro/src/DeltaBundler/Worker', - // publicPath: '/assets', - // allowOptionalDependencies: true, - // unstable_allowRequireContext: false, - // unstable_dependencyMapReservedName: null, - // unstable_disableModuleWrapping: false, - // unstable_disableNormalizePseudoGlobals: false, - // unstable_compactOutput: false, - // }, - // watcher: { - // additionalExts: ['cjs', 'mjs'], - // healthCheck: { - // enabled: false, - // filePrefix: '.metro-health-check', - // interval: 30000, - // timeout: 5000, - // }, - // watchman: { - // deferStates: ['hg.update'], - // }, - // }, - // stickyWorkers: true, - // watchFolders: ['../..'], - // transformerPath: 'metro-transform-worker', - // resetCache: false, -}; +const sharedBlacklist = [ + /node_modules\/react\/dist\/.*/, + /website\/node_modules\/.*/, + /heapCapture\/bundle\.js/, + /.*\/__tests__\/.*/, +]; + +const env: any = process?.env; + +function escapeRegExp(pattern: RegExp | string) { + if (typeof pattern === 'string') { + // eslint-disable-next-line + const escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&'); // convert the '/' into an escaped local file separator + + return escaped.replace(/\//g, `\\${path.sep}`); + } else if (Object.prototype.toString.call(pattern) === '[object RegExp]') { + return pattern.source.replace(/\//g, path.sep); + } + throw new Error(`Unexpected blacklist pattern: ${pattern}`); +} + +function blacklist(additionalBlacklist: RegExp[]) { + return new RegExp(`(${(additionalBlacklist || []).concat(sharedBlacklist).map(escapeRegExp).join('|')})$`); +} export const withRNVMetro = (config: any) => { - const projectPath = process.env.RNV_PROJECT_ROOT || process.cwd(); - const cfg = mergeConfig(getDefaultConfig(projectPath), DEFAULT_CONFIG); + const projectPath = env.RNV_PROJECT_ROOT || process.cwd(); + + const watchFolders = [path.resolve(projectPath, 'node_modules')]; + + if (env.RNV_IS_MONOREPO === 'true' || env.RNV_IS_MONOREPO === true) { + const monoRootPath = env.RNV_MONO_ROOT || projectPath; + watchFolders.push(path.resolve(monoRootPath, 'node_modules')); + watchFolders.push(path.resolve(monoRootPath, 'packages')); + } + if (config?.watchFolders?.length) { + watchFolders.push(...config.watchFolders); + } + + const exts: string = env.RNV_EXTENSIONS || ''; + + const cnfRnv = { + resolver: { + blacklistRE: blacklist([ + /platformBuilds\/.*/, + /buildHooks\/.*/, + /projectConfig\/.*/, + /website\/.*/, + /appConfigs\/.*/, + /renative.local.*/, + /metro.config.local.*/, + /.expo\/.*/, + /.rollup.cache\/.*/, + ]), + ...(config?.resolver || {}), + sourceExts: [...(config?.resolver?.sourceExts || []), ...exts.split(',')], + extraNodeModules: config?.resolver?.extraNodeModules, + }, + watchFolders, + projectRoot: path.resolve(projectPath), + }; + + const cnfWithRnv = mergeConfig(getDefaultConfig(projectPath), cnfRnv); - const cnf = mergeConfig(cfg, config); + const cnf = mergeConfig(cnfWithRnv, config); return cnf; }; diff --git a/packages/engine-rn/templates/platforms/android/app/src/main/java/rnv_template/MainActivity.java.tpl b/packages/engine-rn/templates/platforms/android/app/src/main/java/rnv_template/MainActivity.java.tpl index a631fcada6..2fdae08c2f 100644 --- a/packages/engine-rn/templates/platforms/android/app/src/main/java/rnv_template/MainActivity.java.tpl +++ b/packages/engine-rn/templates/platforms/android/app/src/main/java/rnv_template/MainActivity.java.tpl @@ -13,7 +13,7 @@ public class MainActivity extends ReactActivity { */ @Override protected String getMainComponentName() { - return "App"; + return "RNVApp"; } /** diff --git a/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv/MainActivity.kt b/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv/MainActivity.kt index 8df108997a..3625a29f9a 100644 --- a/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv/MainActivity.kt +++ b/packages/engine-rn/templates/platforms/androidwear/app/src/main/java/rnv/MainActivity.kt @@ -14,7 +14,7 @@ import com.facebook.react.ReactRootView */ class MainActivity : ReactActivity() { - override fun getMainComponentName(): String? = "App" + override fun getMainComponentName(): String? = "RNVApp" override fun onCreate(savedInstanceState: Bundle?) { {{INJECT_ON_CREATE}} diff --git a/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm b/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm index 3420cbd1c9..1179262276 100644 --- a/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm +++ b/packages/engine-rn/templates/platforms/ios/RNVApp/AppDelegate.mm @@ -6,7 +6,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - self.moduleName = @"App"; + self.moduleName = @"RNVApp"; // You can add your custom initial props in the dictionary below. // They will be passed down to the ViewController used by React Native. self.initialProps = @{}; diff --git a/packages/engine-rn/templates/platforms/macos/RNVApp/AppDelegate.swift b/packages/engine-rn/templates/platforms/macos/RNVApp/AppDelegate.swift index bc1ca6f1e6..fad5264cf9 100755 --- a/packages/engine-rn/templates/platforms/macos/RNVApp/AppDelegate.swift +++ b/packages/engine-rn/templates/platforms/macos/RNVApp/AppDelegate.swift @@ -16,7 +16,7 @@ import UserNotifications class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {{APPDELEGATE_EXTENSIONS}} { var window: UIWindow? - let moduleName = "App" + let moduleName = "RNVApp" var uiView: RCTRootView! let bundleUrl = {{BUNDLE}}