PHP 7.4.33
Preview: GenerateThirdPartyFabricComponentsProviderObjCpp.js Size: 3.23 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/@react-native/codegen/lib/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js
/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 *
 * @format
 */

'use strict';

const _require = require('./ComponentsProviderUtils'),
  generateSupportedApplePlatformsMacro =
    _require.generateSupportedApplePlatformsMacro;

// File path -> contents

const FileTemplate = ({lookupMap}) => `
/**
 * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
 *
 * Do not edit this file as changes may cause incorrect behavior and will be lost
 * once the code is regenerated.
 *
 * ${'@'}generated by GenerateRCTThirdPartyFabricComponentsProviderCpp
 */

// OSS-compatibility layer

#import "RCTThirdPartyFabricComponentsProvider.h"

#import <string>
#import <unordered_map>

Class<RCTComponentViewProtocol> RCTThirdPartyFabricComponentsProvider(const char *name) {
  static std::unordered_map<std::string, Class (*)(void)> sFabricComponentsClassMap = {
    #if RCT_NEW_ARCH_ENABLED
    #ifndef RCT_DYNAMIC_FRAMEWORKS
${lookupMap}
    #endif
    #endif
  };

  auto p = sFabricComponentsClassMap.find(name);
  if (p != sFabricComponentsClassMap.end()) {
    auto classFunc = p->second;
    return classFunc();
  }
  return nil;
}
`;
const LookupMapTemplate = ({className, libraryName}) => `
    {"${className}", ${className}Cls}, // ${libraryName}`;
module.exports = {
  generate(schemas, supportedApplePlatforms) {
    const fileName = 'RCTThirdPartyFabricComponentsProvider.mm';
    const lookupMap = Object.keys(schemas)
      .map(libraryName => {
        const schema = schemas[libraryName];
        const librarySupportedApplePlatforms =
          supportedApplePlatforms === null || supportedApplePlatforms === void 0
            ? void 0
            : supportedApplePlatforms[libraryName];
        const generatedLookup = Object.keys(schema.modules)
          .map(moduleName => {
            const module = schema.modules[moduleName];
            if (module.type !== 'Component') {
              return;
            }
            const components = module.components;
            // No components in this module
            if (components == null) {
              return null;
            }
            const componentTemplates = Object.keys(components)
              .filter(componentName => {
                const component = components[componentName];
                return !(
                  component.excludedPlatforms &&
                  component.excludedPlatforms.includes('iOS')
                );
              })
              .map(componentName => {
                const replacedTemplate = LookupMapTemplate({
                  className: componentName,
                  libraryName,
                });
                return replacedTemplate;
              });
            return componentTemplates.length > 0 ? componentTemplates : null;
          })
          .filter(Boolean)
          .join('\n');
        return generateSupportedApplePlatformsMacro(
          generatedLookup,
          librarySupportedApplePlatforms,
        );
      })
      .join('\n');
    const replacedTemplate = FileTemplate({
      lookupMap,
    });
    return new Map([[fileName, replacedTemplate]]);
  },
};

Directory Contents

Dirs: 2 × Files: 42
Name Size Perms Modified Actions
- drwxr-xr-x 2025-03-28 11:04:37
Edit Download
- drwxr-xr-x 2025-03-28 11:04:37
Edit Download
8.09 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
9.54 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
1.46 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
1.53 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
8.16 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
9.20 KB lrw-r--r-- 2025-03-28 11:04:35
Edit Download
2.44 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
2.59 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.43 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
2.58 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
9.34 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
10.35 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
10.78 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
12.08 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
7.99 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
8.90 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
4.33 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
4.54 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
18.22 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
19.69 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
9.54 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
10.24 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
7.35 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
8.00 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.09 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
2.23 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.67 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
2.84 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.01 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
2.15 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.07 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
2.28 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
5.27 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
5.88 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
2.99 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
3.10 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
3.23 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
3.33 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
13.37 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
13.95 KB lrw-r--r-- 2025-03-28 11:04:36
Edit Download
3.58 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
3.99 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).