react-native-boost 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugin/esm/index.mjs +8 -8
- package/dist/plugin/esm/index.mjs.map +1 -1
- package/dist/plugin/index.js +8 -8
- package/dist/plugin/index.js.map +1 -1
- package/dist/runtime/esm/index.mjs +17 -16
- package/dist/runtime/esm/index.mjs.map +1 -1
- package/dist/runtime/esm/index.web.mjs +4 -6
- package/dist/runtime/esm/index.web.mjs.map +1 -1
- package/dist/runtime/index.d.ts +9 -14
- package/dist/runtime/index.js +18 -17
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/index.web.d.ts +5 -14
- package/dist/runtime/index.web.js +5 -7
- package/dist/runtime/index.web.js.map +1 -1
- package/package.json +1 -1
- package/src/plugin/optimizers/text/index.ts +8 -8
- package/src/plugin/types/index.ts +2 -2
- package/src/plugin/utils/common/base.ts +2 -2
- package/src/runtime/index.ts +5 -26
- package/src/runtime/index.web.ts +4 -30
- package/src/runtime/utils/constants.ts +16 -0
|
@@ -420,18 +420,18 @@ function processProps(path, file, originalAttributes) {
|
|
|
420
420
|
);
|
|
421
421
|
const normalizeIdentifier = addFileImportHint({
|
|
422
422
|
file,
|
|
423
|
-
nameHint: "
|
|
423
|
+
nameHint: "processAccessibilityProps",
|
|
424
424
|
path,
|
|
425
|
-
importName: "
|
|
425
|
+
importName: "processAccessibilityProps",
|
|
426
426
|
moduleName: RUNTIME_MODULE_NAME
|
|
427
427
|
});
|
|
428
428
|
const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);
|
|
429
429
|
const accessibilityExpr = types.callExpression(types.identifier(normalizeIdentifier.name), [accessibilityObject]);
|
|
430
430
|
const flattenIdentifier = addFileImportHint({
|
|
431
431
|
file,
|
|
432
|
-
nameHint: "
|
|
432
|
+
nameHint: "processTextStyle",
|
|
433
433
|
path,
|
|
434
|
-
importName: "
|
|
434
|
+
importName: "processTextStyle",
|
|
435
435
|
moduleName: RUNTIME_MODULE_NAME
|
|
436
436
|
});
|
|
437
437
|
const flattenedStyleExpr = types.callExpression(types.identifier(flattenIdentifier.name), [styleExpr]);
|
|
@@ -439,9 +439,9 @@ function processProps(path, file, originalAttributes) {
|
|
|
439
439
|
} else if (styleExpr) {
|
|
440
440
|
const flattenIdentifier = addFileImportHint({
|
|
441
441
|
file,
|
|
442
|
-
nameHint: "
|
|
442
|
+
nameHint: "processTextStyle",
|
|
443
443
|
path,
|
|
444
|
-
importName: "
|
|
444
|
+
importName: "processTextStyle",
|
|
445
445
|
moduleName: RUNTIME_MODULE_NAME
|
|
446
446
|
});
|
|
447
447
|
const flattened = types.callExpression(types.identifier(flattenIdentifier.name), [styleExpr]);
|
|
@@ -449,9 +449,9 @@ function processProps(path, file, originalAttributes) {
|
|
|
449
449
|
} else if (hasA11y) {
|
|
450
450
|
const normalizeIdentifier = addFileImportHint({
|
|
451
451
|
file,
|
|
452
|
-
nameHint: "
|
|
452
|
+
nameHint: "processAccessibilityProps",
|
|
453
453
|
path,
|
|
454
|
-
importName: "
|
|
454
|
+
importName: "processAccessibilityProps",
|
|
455
455
|
moduleName: RUNTIME_MODULE_NAME
|
|
456
456
|
});
|
|
457
457
|
const propsObject = buildPropertiesFromAttributes(originalAttributes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/plugin/utils/plugin-error.ts","../../../src/plugin/utils/constants.ts","../../../src/plugin/utils/common/base.ts","../../../src/plugin/utils/helpers.ts","../../../src/plugin/utils/common/validation.ts","../../../src/plugin/utils/common/attributes.ts","../../../src/plugin/utils/common/node-types.ts","../../../src/plugin/utils/common/ancestors.ts","../../../src/plugin/optimizers/text/index.ts","../../../src/plugin/utils/logger.ts","../../../src/plugin/optimizers/view/index.ts","../../../src/plugin/index.ts"],"sourcesContent":["export default class PluginError extends Error {\n constructor(message: string) {\n super(`[react-native-boost] Babel plugin exception: ${message}`);\n this.name = 'PluginError';\n }\n}\n","export const RUNTIME_MODULE_NAME = 'react-native-boost/runtime';\n\n/**\n * The set of accessibility properties that need to be normalized.\n */\nexport const ACCESSIBILITY_PROPERTIES = new Set([\n 'accessibilityLabel',\n 'aria-label',\n 'accessibilityState',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-selected',\n 'accessible',\n]);\n","import { NodePath, types as t } from '@babel/core';\nimport { addDefault, addNamed } from '@babel/helper-module-imports';\nimport { FileImportOptions, HubFile } from '../../types';\nimport { RUNTIME_MODULE_NAME } from '../constants';\n\n/**\n * Adds a hint to the file object to ensure that a specific import is added only once and cached on the file object.\n *\n * @param opts - Object containing the function arguments:\n * - file: The Babel file object (e.g. HubFile)\n * - nameHint: The name hint which also acts as the cache key to ensure the import is only added once (e.g. 'normalizeAccessibilityProps')\n * - path: The current Babel NodePath\n * - importName: The named import string (e.g. 'normalizeAccessibilityProps'), used when importType is 'named'\n * - moduleName: The module to import from (e.g. 'react-native-boost/runtime')\n * - importType: Either 'named' (default) or 'default' to determine the type of import to use.\n *\n * @returns The identifier returned by addNamed or addDefault.\n */\nexport function addFileImportHint({\n file,\n nameHint,\n path,\n importName,\n moduleName,\n importType = 'named',\n}: FileImportOptions): t.Identifier {\n if (!file.__hasImports?.[nameHint]) {\n file.__hasImports = file.__hasImports || {};\n file.__hasImports[nameHint] =\n importType === 'default'\n ? addDefault(path, moduleName, { nameHint })\n : addNamed(path, importName, moduleName, { nameHint });\n }\n return file.__hasImports[nameHint];\n}\n\n/**\n * Replaces a component with its native counterpart.\n * This function handles both the opening and closing tags.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @param file - The Babel file object.\n * @param nativeComponentName - The name of the native component to import.\n * @param moduleName - The module to import the native component from.\n * @returns The identifier for the imported native component.\n */\nexport const replaceWithNativeComponent = (\n path: NodePath<t.JSXOpeningElement>,\n parent: t.JSXElement,\n file: HubFile,\n nativeComponentName: string\n): t.Identifier => {\n // Add native component import (cached on file) to prevent duplicate imports\n const nativeIdentifier = addFileImportHint({\n file,\n nameHint: nativeComponentName,\n path,\n importName: nativeComponentName,\n moduleName: RUNTIME_MODULE_NAME,\n importType: 'named',\n });\n\n // Get the current name of the component, which may be aliased (i.e. Text -> RNText)\n const currentName = (path.node.name as t.JSXIdentifier).name;\n\n // Replace the component with its native counterpart\n const jsxName = path.node.name as t.JSXIdentifier;\n jsxName.name = nativeIdentifier.name;\n\n // If the element is not self-closing, update the closing element as well\n if (\n !path.node.selfClosing &&\n parent.closingElement &&\n t.isJSXIdentifier(parent.closingElement.name) &&\n parent.closingElement.name.name === currentName\n ) {\n parent.closingElement.name.name = nativeIdentifier.name;\n }\n\n return nativeIdentifier;\n};\n","export const ensureArray = <T>(value: T | T[]): T[] => {\n if (Array.isArray(value)) return value;\n return [value];\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ensureArray } from '../helpers';\nimport { HubFile } from '../../types';\nimport { minimatch } from 'minimatch';\nimport nodePath from 'node:path';\nimport PluginError from '../plugin-error';\n\n/**\n * Checks if the file is in the list of ignored files.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param ignores - List of glob paths (absolute or relative to import.meta.dirname).\n * @returns true if the file matches any of the ignore patterns.\n */\nexport const isIgnoredFile = (path: NodePath<t.JSXOpeningElement>, ignores: string[]): boolean => {\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const fileName = file.opts.filename;\n\n // Use the current working directory which typically corresponds to the user's project root.\n const baseDirectory = 'cwd' in file.opts ? (file.opts.cwd as string) : process.cwd();\n\n // Iterate through the ignore patterns.\n for (const pattern of ignores) {\n // If the pattern is not absolute, join it with the baseDir\n const absolutePattern = nodePath.isAbsolute(pattern) ? pattern : nodePath.join(baseDirectory, pattern);\n\n // Check if the file name matches the glob pattern.\n if (minimatch(fileName, absolutePattern, { dot: true })) {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Checks if the JSX element should be ignored based on a preceding comment.\n *\n * The function looks up the JSXOpeningElement's own leading comments as well as\n * the parent element's comments before falling back to inspect siblings.\n *\n * @param path - The path to the JSXOpeningElement.\n * @returns true if the JSX element should be ignored.\n */\nexport const isIgnoredLine = (path: NodePath<t.JSXOpeningElement>): boolean => {\n // Check for @boost-ignore in the leading comments on the JSX opening element.\n if (path.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // Check for @boost-ignore in the leading comments on the parent JSX element.\n const jsxElementPath = path.parentPath;\n if (jsxElementPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // NEW: Check for @boost-ignore in the leading comments on the ObjectProperty (if it exists)\n // This handles cases where the JSX element is used as a value inside an object literal.\n const propertyPath = jsxElementPath.parentPath;\n if (\n propertyPath &&\n propertyPath.isObjectProperty() &&\n propertyPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n\n if (!jsxElementPath.parentPath) return false;\n\n // Get the container that holds this element (for example, a JSX fragment or JSX element)\n const containerPath = jsxElementPath.parentPath;\n const siblings = ensureArray(containerPath.get('children'));\n const index = siblings.findIndex((sibling) => sibling.node === jsxElementPath.node);\n if (index === -1) return false;\n\n // Look backward from the current element for a non-empty node.\n for (let index_ = index - 1; index_ >= 0; index_--) {\n const sibling = siblings[index_];\n // Skip over any whitespace (only in JSXText nodes)\n if (sibling.isJSXText() && sibling.node.value.trim() === '') {\n continue;\n }\n // If the sibling is a JSX expression container, check its empty expression's comments.\n if (sibling.isJSXExpressionContainer()) {\n const expression = sibling.get('expression');\n if (expression && expression.node) {\n const comments = [\n ...(expression.node.leadingComments || []),\n ...(expression.node.trailingComments || []),\n ...(expression.node.innerComments || []),\n ].map((comment) => comment.value.trim());\n if (comments.some((comment) => comment.includes('@boost-ignore'))) {\n return true;\n }\n }\n }\n // Also check if the node itself carries a leadingComments property.\n if (\n sibling.node.leadingComments &&\n sibling.node.leadingComments.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n break; // if the immediate non-whitespace node is not our ignore marker, stop\n }\n return false;\n};\n\n/**\n * Checks if the path represents a valid JSX component with the specified name.\n *\n * @param path - The NodePath to check.\n * @param componentName - The name of the component to validate against.\n * @returns true if the path is a valid JSX component with the specified name.\n */\nexport const isValidJSXComponent = (path: NodePath<t.JSXOpeningElement>, componentName: string): boolean => {\n // Check if the node name is a JSX identifier\n if (!t.isJSXIdentifier(path.node.name)) return false;\n\n // Check if the parent is a JSX element\n const parent = path.parent;\n if (!t.isJSXElement(parent)) return false;\n\n // For aliasing, we check if the underlying imported name matches the expected name\n const componentIdentifier = path.node.name.name;\n const binding = path.scope.getBinding(componentIdentifier);\n if (!binding) return false;\n if (\n binding.kind === 'module' &&\n t.isImportDeclaration(binding.path.parent) &&\n t.isImportSpecifier(binding.path.node)\n ) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === componentName;\n }\n }\n\n // Fallback to string match if binding is not available\n return path.node.name.name === componentName;\n};\n\n/**\n * Checks if the component is imported from 'react-native' and not from a custom module.\n *\n * @param path - The NodePath to check.\n * @param expectedImportedName - The expected import name of the component (we'll also check for aliased imports).\n * @returns true if the component is imported from 'react-native'\n */\nexport const isReactNativeImport = (path: NodePath<t.JSXOpeningElement>, expectedImportedName: string): boolean => {\n if (!t.isJSXIdentifier(path.node.name)) return false;\n const localName = path.node.name.name;\n const binding = path.scope.getBinding(localName);\n if (!binding) return false;\n if (binding.kind === 'module') {\n const importDeclaration = binding.path.parent;\n if (!t.isImportDeclaration(importDeclaration)) return false;\n // Verify it's imported from 'react-native'\n if (importDeclaration.source.value !== 'react-native') return false;\n\n // For named imports, check the imported name (not the alias)\n if (t.isImportSpecifier(binding.path.node)) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === expectedImportedName;\n }\n }\n\n // For default imports, we just assume it's valid if imported from react-native.\n if (t.isImportDefaultSpecifier(binding.path.node)) {\n return true;\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ACCESSIBILITY_PROPERTIES } from '../constants';\n\n/**\n * Checks if the JSX element has a blacklisted property.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param blacklist - The set of blacklisted properties.\n * @returns true if the JSX element has a blacklisted property.\n */\nexport const hasBlacklistedProperty = (path: NodePath<t.JSXOpeningElement>, blacklist: Set<string>): boolean => {\n return path.node.attributes.some((attribute) => {\n // Check direct attributes (e.g., onPress={handler})\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name) && blacklist.has(attribute.name.name)) {\n return true;\n }\n\n // Check spread attributes (e.g., {...props})\n if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n let objectExpression: t.ObjectExpression | undefined;\n if (binding) {\n // If the binding node is a VariableDeclarator, use its initializer\n if (t.isVariableDeclarator(binding.path.node)) {\n objectExpression = binding.path.node.init as t.ObjectExpression;\n } else if (t.isObjectExpression(binding.path.node)) {\n objectExpression = binding.path.node;\n }\n }\n if (objectExpression && t.isObjectExpression(objectExpression)) {\n return objectExpression.properties.some((property) => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n return blacklist.has(property.key.name);\n }\n return false;\n });\n }\n }\n // Bail if we can't resolve the spread attribute\n return true;\n }\n\n // For other attribute types, assume no blacklisting\n return false;\n });\n};\n\n/**\n * Helper that builds an Object.assign expression out of the existing JSX attributes.\n * It handles both plain JSXAttributes and spread attributes.\n *\n * @param attributes - The attributes to build the expression from.\n * @returns The Object.assign expression.\n */\nexport const buildPropertiesFromAttributes = (attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]): t.Expression => {\n const arguments_: t.Expression[] = [];\n for (const attribute of attributes) {\n if (t.isJSXSpreadAttribute(attribute)) {\n arguments_.push(attribute.argument);\n } else if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n let value: t.Expression;\n if (!attribute.value) {\n value = t.booleanLiteral(true);\n } else if (t.isStringLiteral(attribute.value)) {\n value = attribute.value;\n } else if (t.isJSXExpressionContainer(attribute.value)) {\n value = t.isJSXEmptyExpression(attribute.value.expression)\n ? t.booleanLiteral(true)\n : attribute.value.expression;\n } else {\n value = t.nullLiteral();\n }\n // If the key is not a valid JavaScript identifier (e.g. \"aria-label\"), use a string literal.\n const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n const keyNode =\n typeof key === 'string' && validIdentifierRegex.test(key) ? t.identifier(key) : t.stringLiteral(key.toString());\n\n arguments_.push(t.objectExpression([t.objectProperty(keyNode, value)]));\n }\n }\n if (arguments_.length === 0) {\n return t.objectExpression([]);\n }\n return t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('assign')), [\n t.objectExpression([]),\n ...arguments_,\n ]);\n};\n\n/**\n * Checks if the JSX element has an accessibility property.\n *\n * @param path - The NodePath for the JSXOpeningElement, used for scope lookup.\n * @param attributes - The attributes to check.\n * @returns true if the JSX element has an accessibility property.\n */\nexport const hasAccessibilityProperty = (\n path: NodePath<t.JSXOpeningElement>,\n attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]\n): boolean => {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n if (typeof key === 'string' && ACCESSIBILITY_PROPERTIES.has(key)) {\n return true;\n }\n } else if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isObjectExpression(attribute.argument)) {\n for (const property of attribute.argument.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n } else if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n if (binding && t.isVariableDeclarator(binding.path.node)) {\n const declarator = binding.path.node as t.VariableDeclarator;\n if (declarator.init && t.isObjectExpression(declarator.init)) {\n for (const property of declarator.init.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n continue;\n }\n }\n return true;\n } else {\n return true;\n }\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if a node represents a string value.\n */\nexport const isStringNode = (path: NodePath<t.JSXOpeningElement>, child: t.Node): boolean => {\n if (t.isJSXText(child) || t.isStringLiteral(child)) return true;\n\n // Check for JSX expressions\n if (t.isJSXExpressionContainer(child)) {\n const expression = child.expression;\n if (t.isIdentifier(expression)) {\n const binding = path.scope.getBinding(expression.name);\n if (binding && binding.path.node && t.isVariableDeclarator(binding.path.node)) {\n return !!binding.path.node.init && t.isStringLiteral(binding.path.node.init);\n }\n return false;\n }\n if (t.isStringLiteral(expression)) return true;\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if any ancestor element is of the specified component type or contains that component type.\n * This function handles both direct ancestors and custom components that may contain the specified component.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param componentName - The name of the component to check for in ancestors.\n * @param skipComponents - Optional array of component names to skip when checking ancestors.\n * @returns true if any ancestor is or contains the specified component.\n */\nexport function hasComponentAncestor(\n path: NodePath<t.JSXOpeningElement>,\n componentName: string,\n skipComponents: string[] = ['Fragment']\n): boolean {\n // Check for direct ancestors of the specified component type\n const directAncestor = path.findParent((parentPath) => {\n return (\n t.isJSXElement(parentPath.node) && t.isJSXIdentifier(parentPath.node.openingElement.name, { name: componentName })\n );\n });\n\n if (directAncestor) return true;\n\n // Check for indirect ancestors (custom components that contain the specified component)\n return !!path.findParent((parentPath) => {\n // Only check JSX elements\n if (!t.isJSXElement(parentPath.node)) return false;\n\n // Get the component name\n const openingElement = parentPath.node.openingElement;\n if (!t.isJSXIdentifier(openingElement.name)) return false;\n\n const ancestorComponentName = openingElement.name.name;\n\n // Skip the component we're looking for\n if (ancestorComponentName === componentName) {\n return false;\n }\n\n // Skip components in the skipComponents list\n if (skipComponents.includes(ancestorComponentName)) {\n return false;\n }\n\n // Skip lowercase components (built-in HTML elements)\n if (ancestorComponentName[0] === ancestorComponentName[0].toLowerCase()) {\n return false;\n }\n\n // Try to find the component definition through variable binding\n const binding = parentPath.scope.getBinding(ancestorComponentName);\n if (!binding) return false;\n\n // Now check the component definition for the specified component\n if (t.isVariableDeclarator(binding.path.node)) {\n const init = binding.path.node.init;\n\n // Handle arrow functions or function expressions\n if (t.isArrowFunctionExpression(init) || t.isFunctionExpression(init)) {\n // Check the function body for the specified component\n return t.isBlockStatement(init.body)\n ? hasComponentInReturnStatement(init.body, componentName)\n : hasComponentInExpression(init.body, componentName);\n }\n } else if (t.isFunctionDeclaration(binding.path.node)) {\n // Handle function declarations\n return hasComponentInReturnStatement(binding.path.node.body, componentName);\n }\n\n return false;\n });\n}\n\n/**\n * Check if a block statement contains a return statement with the specified component\n *\n * @param blockStatement - The block statement to check\n * @param componentName - The name of the component to look for\n * @returns true if the block statement contains a return with the specified component\n */\nfunction hasComponentInReturnStatement(blockStatement: t.BlockStatement, componentName: string): boolean {\n for (const statement of blockStatement.body) {\n if (\n t.isReturnStatement(statement) &&\n statement.argument &&\n hasComponentInExpression(statement.argument, componentName)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if an expression contains the specified component\n *\n * @param expression - The expression to check\n * @param componentName - The name of the component to look for\n * @returns true if the expression contains the specified component\n */\nfunction hasComponentInExpression(expression: t.Expression, componentName: string): boolean {\n // If directly returning a JSX element\n if (t.isJSXElement(expression)) {\n // Check if it's the specified component\n if (t.isJSXIdentifier(expression.openingElement.name, { name: componentName })) {\n return true;\n }\n\n // Check if any children are the specified component\n for (const child of expression.children) {\n if (t.isJSXElement(child) && t.isJSXIdentifier(child.openingElement.name, { name: componentName })) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import { NodePath, types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n addFileImportHint,\n buildPropertiesFromAttributes,\n hasAccessibilityProperty,\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n isStringNode,\n} from '../../utils/common';\nimport { RUNTIME_MODULE_NAME } from '../../utils/constants';\n\nexport const textBlacklistedProperties = new Set([\n 'allowFontScaling',\n 'ellipsizeMode',\n 'id',\n 'nativeID',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'suppressHighlighting',\n 'selectable',\n 'selectionColor',\n]);\n\nexport const textOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'Text')) return;\n if (!isReactNativeImport(path, 'Text')) return;\n if (hasBlacklistedProperty(path, textBlacklistedProperties)) return;\n\n // Verify that the Text only has string children\n const parent = path.parent as t.JSXElement;\n if (hasInvalidChildren(path, parent)) return;\n\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing Text component in ${filename}:${lineNumber}`);\n\n // Process props\n const originalAttributes = [...path.node.attributes];\n fixNegativeNumberOfLines({ path, log });\n processProps(path, file, originalAttributes);\n\n // Replace the Text component with NativeText\n replaceWithNativeComponent(path, parent, file, 'NativeText');\n};\n\n/**\n * Checks if the Text component has any invalid children or blacklisted properties.\n * This function combines the checks for both attribute-based children and JSX children.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @returns true if the component has invalid children or blacklisted properties.\n */\nfunction hasInvalidChildren(path: NodePath<t.JSXOpeningElement>, parent: t.JSXElement): boolean {\n for (const attribute of path.node.attributes) {\n if (t.isJSXSpreadAttribute(attribute)) continue; // Spread attributes are handled in hasBlacklistedProperty\n\n if (\n t.isJSXIdentifier(attribute.name) &&\n attribute.value &&\n // For a \"children\" attribute, optimization is allowed only if it is a string\n attribute.name.name === 'children' &&\n !isStringNode(path, attribute.value)\n ) {\n return true;\n }\n }\n\n // Return true if any child is not a string node\n return !parent.children.every((child) => isStringNode(path, child));\n}\n\n/**\n * Fixes negative numberOfLines values by setting them to 0.\n */\nfunction fixNegativeNumberOfLines({\n path,\n log,\n}: {\n path: NodePath<t.JSXOpeningElement>;\n log: (message: string) => void;\n}) {\n for (const attribute of path.node.attributes) {\n if (\n t.isJSXAttribute(attribute) &&\n t.isJSXIdentifier(attribute.name, { name: 'numberOfLines' }) &&\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value)\n ) {\n let originalValue: number | undefined;\n if (t.isNumericLiteral(attribute.value.expression)) {\n originalValue = attribute.value.expression.value;\n } else if (\n t.isUnaryExpression(attribute.value.expression) &&\n attribute.value.expression.operator === '-' &&\n t.isNumericLiteral(attribute.value.expression.argument)\n ) {\n originalValue = -attribute.value.expression.argument.value;\n }\n if (originalValue !== undefined && originalValue < 0) {\n log(\n `Warning: 'numberOfLines' in <Text> must be a non-negative number, received: ${originalValue}. The value will be set to 0.`\n );\n attribute.value.expression = t.numericLiteral(0);\n }\n }\n }\n}\n\n/**\n * Extracts the style attribute from JSX attributes.\n */\nfunction extractStyleAttribute(attributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>): {\n styleAttribute?: t.JSXAttribute;\n styleExpr?: t.Expression;\n} {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' })) {\n if (\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value) &&\n !t.isJSXEmptyExpression(attribute.value.expression)\n ) {\n return {\n styleAttribute: attribute,\n styleExpr: attribute.value.expression,\n };\n }\n return { styleAttribute: attribute };\n }\n }\n return {};\n}\n\n/**\n * Processes style and accessibility attributes, replacing them with optimized versions.\n */\nfunction processProps(\n path: NodePath<t.JSXOpeningElement>,\n file: HubFile,\n originalAttributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>\n) {\n const { styleExpr } = extractStyleAttribute(originalAttributes);\n const hasA11y = hasAccessibilityProperty(path, originalAttributes);\n\n if (styleExpr && hasA11y) {\n // When both style and accessibility properties exist, we split them into two separate spread attributes\n const accessibilityAttributes = originalAttributes.filter(\n (attribute) => !(t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' }))\n );\n\n // Set up the accessibility import\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'normalizeAccessibilityProps',\n path,\n importName: 'normalizeAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);\n const accessibilityExpr = t.callExpression(t.identifier(normalizeIdentifier.name), [accessibilityObject]);\n\n // Set up the style import\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'flattenTextStyle',\n path,\n importName: 'flattenTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattenedStyleExpr = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n\n // Use two separate JSX spread attributes\n path.node.attributes = [t.jsxSpreadAttribute(accessibilityExpr), t.jsxSpreadAttribute(flattenedStyleExpr)];\n } else if (styleExpr) {\n // Only style attribute is present\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'flattenTextStyle',\n path,\n importName: 'flattenTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattened = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n path.node.attributes = [t.jsxSpreadAttribute(flattened)];\n } else if (hasA11y) {\n // Only accessibility properties are present\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'normalizeAccessibilityProps',\n path,\n importName: 'normalizeAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const propsObject = buildPropertiesFromAttributes(originalAttributes);\n const normalized = t.callExpression(t.identifier(normalizeIdentifier.name), [propsObject]);\n path.node.attributes = [t.jsxSpreadAttribute(normalized)];\n }\n}\n","export const log = (message: string) => {\n console.log(`[react-native-boost] ${message}`);\n};\n","import { types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n hasComponentAncestor,\n} from '../../utils/common';\n\nexport const viewBlacklistedProperties = new Set([\n 'accessible',\n 'accessibilityLabel',\n 'accessibilityState',\n 'allowFontScaling',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-label',\n 'aria-selected',\n 'ellipsizeMode',\n 'disabled',\n 'id',\n 'nativeID',\n 'numberOfLines',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'selectable',\n 'selectionColor',\n 'suppressHighlighting',\n 'style',\n]);\n\n// Components to skip when checking for indirect Text ancestors\nconst skipComponents = ['View', 'Fragment', 'ScrollView', 'FlatList'];\n\nexport const viewOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'View')) return;\n if (!isReactNativeImport(path, 'View')) return;\n if (hasBlacklistedProperty(path, viewBlacklistedProperties)) return;\n if (hasComponentAncestor(path, 'Text', skipComponents)) return;\n\n // Extract the file from the Babel hub\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing View component in ${filename}:${lineNumber}`);\n\n const parent = path.parent as t.JSXElement;\n\n // Replace the View component with NativeView\n replaceWithNativeComponent(path, parent, file, 'NativeView');\n};\n","import { declare } from '@babel/helper-plugin-utils';\nimport { textOptimizer } from './optimizers/text';\nimport { PluginOptions } from './types';\nimport { log } from './utils/logger';\nimport { viewOptimizer } from './optimizers/view';\nimport { isIgnoredFile } from './utils/common';\n\nexport default declare((api) => {\n api.assertVersion(7);\n\n return {\n name: 'react-native-boost',\n visitor: {\n JSXOpeningElement(path, state) {\n const options = (state.opts ?? {}) as PluginOptions;\n const logger = options.verbose ? log : () => {};\n if (isIgnoredFile(path, options.ignores ?? [])) return;\n if (options.optimizations?.text !== false) textOptimizer(path, logger);\n if (options.optimizations?.view !== false) viewOptimizer(path, logger);\n },\n },\n };\n});\n"],"names":["t"],"mappings":";;;;;;AAAA,MAAqB,oBAAoB,KAAM,CAAA;AAAA,EAC7C,YAAY,OAAiB,EAAA;AAC3B,IAAM,KAAA,CAAA,CAAA,6CAAA,EAAgD,OAAO,CAAE,CAAA,CAAA;AAC/D,IAAA,IAAA,CAAK,IAAO,GAAA,aAAA;AAAA;AAEhB;;ACLO,MAAM,mBAAsB,GAAA,4BAAA;AAKtB,MAAA,wBAAA,uBAA+B,GAAI,CAAA;AAAA,EAC9C,oBAAA;AAAA,EACA,YAAA;AAAA,EACA,oBAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC,CAAA;;ACGM,SAAS,iBAAkB,CAAA;AAAA,EAChC,IAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAa,GAAA;AACf,CAAoC,EAAA;AAzBpC,EAAA,IAAA,EAAA;AA0B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AChC,QAAA,MAAM,MAAS,GAAA,OAAA,CAAQ,OAAU,GAAA,GAAA,GAAM,MAAM;AAAA,SAAC;AAC9C,QAAA,IAAI,cAAc,IAAM,EAAA,CAAA,EAAA,GAAA,OAAA,CAAQ,YAAR,IAAmB,GAAA,EAAA,GAAA,EAAE,CAAG,EAAA;AAChD,QAAA,IAAA,CAAA,CAAI,aAAQ,aAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAuB,UAAS,KAAO,EAAA,aAAA,CAAc,MAAM,MAAM,CAAA;AACrE,QAAA,IAAA,CAAA,CAAI,aAAQ,aAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAuB,UAAS,KAAO,EAAA,aAAA,CAAc,MAAM,MAAM,CAAA;AAAA;AACvE;AACF,GACF;AACF,CAAC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/plugin/utils/plugin-error.ts","../../../src/plugin/utils/constants.ts","../../../src/plugin/utils/common/base.ts","../../../src/plugin/utils/helpers.ts","../../../src/plugin/utils/common/validation.ts","../../../src/plugin/utils/common/attributes.ts","../../../src/plugin/utils/common/node-types.ts","../../../src/plugin/utils/common/ancestors.ts","../../../src/plugin/optimizers/text/index.ts","../../../src/plugin/utils/logger.ts","../../../src/plugin/optimizers/view/index.ts","../../../src/plugin/index.ts"],"sourcesContent":["export default class PluginError extends Error {\n constructor(message: string) {\n super(`[react-native-boost] Babel plugin exception: ${message}`);\n this.name = 'PluginError';\n }\n}\n","export const RUNTIME_MODULE_NAME = 'react-native-boost/runtime';\n\n/**\n * The set of accessibility properties that need to be normalized.\n */\nexport const ACCESSIBILITY_PROPERTIES = new Set([\n 'accessibilityLabel',\n 'aria-label',\n 'accessibilityState',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-selected',\n 'accessible',\n]);\n","import { NodePath, types as t } from '@babel/core';\nimport { addDefault, addNamed } from '@babel/helper-module-imports';\nimport { FileImportOptions, HubFile } from '../../types';\nimport { RUNTIME_MODULE_NAME } from '../constants';\n\n/**\n * Adds a hint to the file object to ensure that a specific import is added only once and cached on the file object.\n *\n * @param opts - Object containing the function arguments:\n * - file: The Babel file object (e.g. HubFile)\n * - nameHint: The name hint which also acts as the cache key to ensure the import is only added once (e.g. 'processAccessibilityProps')\n * - path: The current Babel NodePath\n * - importName: The named import string (e.g. 'processAccessibilityProps'), used when importType is 'named'\n * - moduleName: The module to import from (e.g. 'react-native-boost/runtime')\n * - importType: Either 'named' (default) or 'default' to determine the type of import to use.\n *\n * @returns The identifier returned by addNamed or addDefault.\n */\nexport function addFileImportHint({\n file,\n nameHint,\n path,\n importName,\n moduleName,\n importType = 'named',\n}: FileImportOptions): t.Identifier {\n if (!file.__hasImports?.[nameHint]) {\n file.__hasImports = file.__hasImports || {};\n file.__hasImports[nameHint] =\n importType === 'default'\n ? addDefault(path, moduleName, { nameHint })\n : addNamed(path, importName, moduleName, { nameHint });\n }\n return file.__hasImports[nameHint];\n}\n\n/**\n * Replaces a component with its native counterpart.\n * This function handles both the opening and closing tags.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @param file - The Babel file object.\n * @param nativeComponentName - The name of the native component to import.\n * @param moduleName - The module to import the native component from.\n * @returns The identifier for the imported native component.\n */\nexport const replaceWithNativeComponent = (\n path: NodePath<t.JSXOpeningElement>,\n parent: t.JSXElement,\n file: HubFile,\n nativeComponentName: string\n): t.Identifier => {\n // Add native component import (cached on file) to prevent duplicate imports\n const nativeIdentifier = addFileImportHint({\n file,\n nameHint: nativeComponentName,\n path,\n importName: nativeComponentName,\n moduleName: RUNTIME_MODULE_NAME,\n importType: 'named',\n });\n\n // Get the current name of the component, which may be aliased (i.e. Text -> RNText)\n const currentName = (path.node.name as t.JSXIdentifier).name;\n\n // Replace the component with its native counterpart\n const jsxName = path.node.name as t.JSXIdentifier;\n jsxName.name = nativeIdentifier.name;\n\n // If the element is not self-closing, update the closing element as well\n if (\n !path.node.selfClosing &&\n parent.closingElement &&\n t.isJSXIdentifier(parent.closingElement.name) &&\n parent.closingElement.name.name === currentName\n ) {\n parent.closingElement.name.name = nativeIdentifier.name;\n }\n\n return nativeIdentifier;\n};\n","export const ensureArray = <T>(value: T | T[]): T[] => {\n if (Array.isArray(value)) return value;\n return [value];\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ensureArray } from '../helpers';\nimport { HubFile } from '../../types';\nimport { minimatch } from 'minimatch';\nimport nodePath from 'node:path';\nimport PluginError from '../plugin-error';\n\n/**\n * Checks if the file is in the list of ignored files.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param ignores - List of glob paths (absolute or relative to import.meta.dirname).\n * @returns true if the file matches any of the ignore patterns.\n */\nexport const isIgnoredFile = (path: NodePath<t.JSXOpeningElement>, ignores: string[]): boolean => {\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const fileName = file.opts.filename;\n\n // Use the current working directory which typically corresponds to the user's project root.\n const baseDirectory = 'cwd' in file.opts ? (file.opts.cwd as string) : process.cwd();\n\n // Iterate through the ignore patterns.\n for (const pattern of ignores) {\n // If the pattern is not absolute, join it with the baseDir\n const absolutePattern = nodePath.isAbsolute(pattern) ? pattern : nodePath.join(baseDirectory, pattern);\n\n // Check if the file name matches the glob pattern.\n if (minimatch(fileName, absolutePattern, { dot: true })) {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Checks if the JSX element should be ignored based on a preceding comment.\n *\n * The function looks up the JSXOpeningElement's own leading comments as well as\n * the parent element's comments before falling back to inspect siblings.\n *\n * @param path - The path to the JSXOpeningElement.\n * @returns true if the JSX element should be ignored.\n */\nexport const isIgnoredLine = (path: NodePath<t.JSXOpeningElement>): boolean => {\n // Check for @boost-ignore in the leading comments on the JSX opening element.\n if (path.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // Check for @boost-ignore in the leading comments on the parent JSX element.\n const jsxElementPath = path.parentPath;\n if (jsxElementPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // NEW: Check for @boost-ignore in the leading comments on the ObjectProperty (if it exists)\n // This handles cases where the JSX element is used as a value inside an object literal.\n const propertyPath = jsxElementPath.parentPath;\n if (\n propertyPath &&\n propertyPath.isObjectProperty() &&\n propertyPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n\n if (!jsxElementPath.parentPath) return false;\n\n // Get the container that holds this element (for example, a JSX fragment or JSX element)\n const containerPath = jsxElementPath.parentPath;\n const siblings = ensureArray(containerPath.get('children'));\n const index = siblings.findIndex((sibling) => sibling.node === jsxElementPath.node);\n if (index === -1) return false;\n\n // Look backward from the current element for a non-empty node.\n for (let index_ = index - 1; index_ >= 0; index_--) {\n const sibling = siblings[index_];\n // Skip over any whitespace (only in JSXText nodes)\n if (sibling.isJSXText() && sibling.node.value.trim() === '') {\n continue;\n }\n // If the sibling is a JSX expression container, check its empty expression's comments.\n if (sibling.isJSXExpressionContainer()) {\n const expression = sibling.get('expression');\n if (expression && expression.node) {\n const comments = [\n ...(expression.node.leadingComments || []),\n ...(expression.node.trailingComments || []),\n ...(expression.node.innerComments || []),\n ].map((comment) => comment.value.trim());\n if (comments.some((comment) => comment.includes('@boost-ignore'))) {\n return true;\n }\n }\n }\n // Also check if the node itself carries a leadingComments property.\n if (\n sibling.node.leadingComments &&\n sibling.node.leadingComments.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n break; // if the immediate non-whitespace node is not our ignore marker, stop\n }\n return false;\n};\n\n/**\n * Checks if the path represents a valid JSX component with the specified name.\n *\n * @param path - The NodePath to check.\n * @param componentName - The name of the component to validate against.\n * @returns true if the path is a valid JSX component with the specified name.\n */\nexport const isValidJSXComponent = (path: NodePath<t.JSXOpeningElement>, componentName: string): boolean => {\n // Check if the node name is a JSX identifier\n if (!t.isJSXIdentifier(path.node.name)) return false;\n\n // Check if the parent is a JSX element\n const parent = path.parent;\n if (!t.isJSXElement(parent)) return false;\n\n // For aliasing, we check if the underlying imported name matches the expected name\n const componentIdentifier = path.node.name.name;\n const binding = path.scope.getBinding(componentIdentifier);\n if (!binding) return false;\n if (\n binding.kind === 'module' &&\n t.isImportDeclaration(binding.path.parent) &&\n t.isImportSpecifier(binding.path.node)\n ) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === componentName;\n }\n }\n\n // Fallback to string match if binding is not available\n return path.node.name.name === componentName;\n};\n\n/**\n * Checks if the component is imported from 'react-native' and not from a custom module.\n *\n * @param path - The NodePath to check.\n * @param expectedImportedName - The expected import name of the component (we'll also check for aliased imports).\n * @returns true if the component is imported from 'react-native'\n */\nexport const isReactNativeImport = (path: NodePath<t.JSXOpeningElement>, expectedImportedName: string): boolean => {\n if (!t.isJSXIdentifier(path.node.name)) return false;\n const localName = path.node.name.name;\n const binding = path.scope.getBinding(localName);\n if (!binding) return false;\n if (binding.kind === 'module') {\n const importDeclaration = binding.path.parent;\n if (!t.isImportDeclaration(importDeclaration)) return false;\n // Verify it's imported from 'react-native'\n if (importDeclaration.source.value !== 'react-native') return false;\n\n // For named imports, check the imported name (not the alias)\n if (t.isImportSpecifier(binding.path.node)) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === expectedImportedName;\n }\n }\n\n // For default imports, we just assume it's valid if imported from react-native.\n if (t.isImportDefaultSpecifier(binding.path.node)) {\n return true;\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ACCESSIBILITY_PROPERTIES } from '../constants';\n\n/**\n * Checks if the JSX element has a blacklisted property.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param blacklist - The set of blacklisted properties.\n * @returns true if the JSX element has a blacklisted property.\n */\nexport const hasBlacklistedProperty = (path: NodePath<t.JSXOpeningElement>, blacklist: Set<string>): boolean => {\n return path.node.attributes.some((attribute) => {\n // Check direct attributes (e.g., onPress={handler})\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name) && blacklist.has(attribute.name.name)) {\n return true;\n }\n\n // Check spread attributes (e.g., {...props})\n if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n let objectExpression: t.ObjectExpression | undefined;\n if (binding) {\n // If the binding node is a VariableDeclarator, use its initializer\n if (t.isVariableDeclarator(binding.path.node)) {\n objectExpression = binding.path.node.init as t.ObjectExpression;\n } else if (t.isObjectExpression(binding.path.node)) {\n objectExpression = binding.path.node;\n }\n }\n if (objectExpression && t.isObjectExpression(objectExpression)) {\n return objectExpression.properties.some((property) => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n return blacklist.has(property.key.name);\n }\n return false;\n });\n }\n }\n // Bail if we can't resolve the spread attribute\n return true;\n }\n\n // For other attribute types, assume no blacklisting\n return false;\n });\n};\n\n/**\n * Helper that builds an Object.assign expression out of the existing JSX attributes.\n * It handles both plain JSXAttributes and spread attributes.\n *\n * @param attributes - The attributes to build the expression from.\n * @returns The Object.assign expression.\n */\nexport const buildPropertiesFromAttributes = (attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]): t.Expression => {\n const arguments_: t.Expression[] = [];\n for (const attribute of attributes) {\n if (t.isJSXSpreadAttribute(attribute)) {\n arguments_.push(attribute.argument);\n } else if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n let value: t.Expression;\n if (!attribute.value) {\n value = t.booleanLiteral(true);\n } else if (t.isStringLiteral(attribute.value)) {\n value = attribute.value;\n } else if (t.isJSXExpressionContainer(attribute.value)) {\n value = t.isJSXEmptyExpression(attribute.value.expression)\n ? t.booleanLiteral(true)\n : attribute.value.expression;\n } else {\n value = t.nullLiteral();\n }\n // If the key is not a valid JavaScript identifier (e.g. \"aria-label\"), use a string literal.\n const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n const keyNode =\n typeof key === 'string' && validIdentifierRegex.test(key) ? t.identifier(key) : t.stringLiteral(key.toString());\n\n arguments_.push(t.objectExpression([t.objectProperty(keyNode, value)]));\n }\n }\n if (arguments_.length === 0) {\n return t.objectExpression([]);\n }\n return t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('assign')), [\n t.objectExpression([]),\n ...arguments_,\n ]);\n};\n\n/**\n * Checks if the JSX element has an accessibility property.\n *\n * @param path - The NodePath for the JSXOpeningElement, used for scope lookup.\n * @param attributes - The attributes to check.\n * @returns true if the JSX element has an accessibility property.\n */\nexport const hasAccessibilityProperty = (\n path: NodePath<t.JSXOpeningElement>,\n attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]\n): boolean => {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n if (typeof key === 'string' && ACCESSIBILITY_PROPERTIES.has(key)) {\n return true;\n }\n } else if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isObjectExpression(attribute.argument)) {\n for (const property of attribute.argument.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n } else if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n if (binding && t.isVariableDeclarator(binding.path.node)) {\n const declarator = binding.path.node as t.VariableDeclarator;\n if (declarator.init && t.isObjectExpression(declarator.init)) {\n for (const property of declarator.init.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n continue;\n }\n }\n return true;\n } else {\n return true;\n }\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if a node represents a string value.\n */\nexport const isStringNode = (path: NodePath<t.JSXOpeningElement>, child: t.Node): boolean => {\n if (t.isJSXText(child) || t.isStringLiteral(child)) return true;\n\n // Check for JSX expressions\n if (t.isJSXExpressionContainer(child)) {\n const expression = child.expression;\n if (t.isIdentifier(expression)) {\n const binding = path.scope.getBinding(expression.name);\n if (binding && binding.path.node && t.isVariableDeclarator(binding.path.node)) {\n return !!binding.path.node.init && t.isStringLiteral(binding.path.node.init);\n }\n return false;\n }\n if (t.isStringLiteral(expression)) return true;\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if any ancestor element is of the specified component type or contains that component type.\n * This function handles both direct ancestors and custom components that may contain the specified component.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param componentName - The name of the component to check for in ancestors.\n * @param skipComponents - Optional array of component names to skip when checking ancestors.\n * @returns true if any ancestor is or contains the specified component.\n */\nexport function hasComponentAncestor(\n path: NodePath<t.JSXOpeningElement>,\n componentName: string,\n skipComponents: string[] = ['Fragment']\n): boolean {\n // Check for direct ancestors of the specified component type\n const directAncestor = path.findParent((parentPath) => {\n return (\n t.isJSXElement(parentPath.node) && t.isJSXIdentifier(parentPath.node.openingElement.name, { name: componentName })\n );\n });\n\n if (directAncestor) return true;\n\n // Check for indirect ancestors (custom components that contain the specified component)\n return !!path.findParent((parentPath) => {\n // Only check JSX elements\n if (!t.isJSXElement(parentPath.node)) return false;\n\n // Get the component name\n const openingElement = parentPath.node.openingElement;\n if (!t.isJSXIdentifier(openingElement.name)) return false;\n\n const ancestorComponentName = openingElement.name.name;\n\n // Skip the component we're looking for\n if (ancestorComponentName === componentName) {\n return false;\n }\n\n // Skip components in the skipComponents list\n if (skipComponents.includes(ancestorComponentName)) {\n return false;\n }\n\n // Skip lowercase components (built-in HTML elements)\n if (ancestorComponentName[0] === ancestorComponentName[0].toLowerCase()) {\n return false;\n }\n\n // Try to find the component definition through variable binding\n const binding = parentPath.scope.getBinding(ancestorComponentName);\n if (!binding) return false;\n\n // Now check the component definition for the specified component\n if (t.isVariableDeclarator(binding.path.node)) {\n const init = binding.path.node.init;\n\n // Handle arrow functions or function expressions\n if (t.isArrowFunctionExpression(init) || t.isFunctionExpression(init)) {\n // Check the function body for the specified component\n return t.isBlockStatement(init.body)\n ? hasComponentInReturnStatement(init.body, componentName)\n : hasComponentInExpression(init.body, componentName);\n }\n } else if (t.isFunctionDeclaration(binding.path.node)) {\n // Handle function declarations\n return hasComponentInReturnStatement(binding.path.node.body, componentName);\n }\n\n return false;\n });\n}\n\n/**\n * Check if a block statement contains a return statement with the specified component\n *\n * @param blockStatement - The block statement to check\n * @param componentName - The name of the component to look for\n * @returns true if the block statement contains a return with the specified component\n */\nfunction hasComponentInReturnStatement(blockStatement: t.BlockStatement, componentName: string): boolean {\n for (const statement of blockStatement.body) {\n if (\n t.isReturnStatement(statement) &&\n statement.argument &&\n hasComponentInExpression(statement.argument, componentName)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if an expression contains the specified component\n *\n * @param expression - The expression to check\n * @param componentName - The name of the component to look for\n * @returns true if the expression contains the specified component\n */\nfunction hasComponentInExpression(expression: t.Expression, componentName: string): boolean {\n // If directly returning a JSX element\n if (t.isJSXElement(expression)) {\n // Check if it's the specified component\n if (t.isJSXIdentifier(expression.openingElement.name, { name: componentName })) {\n return true;\n }\n\n // Check if any children are the specified component\n for (const child of expression.children) {\n if (t.isJSXElement(child) && t.isJSXIdentifier(child.openingElement.name, { name: componentName })) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import { NodePath, types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n addFileImportHint,\n buildPropertiesFromAttributes,\n hasAccessibilityProperty,\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n isStringNode,\n} from '../../utils/common';\nimport { RUNTIME_MODULE_NAME } from '../../utils/constants';\n\nexport const textBlacklistedProperties = new Set([\n 'allowFontScaling',\n 'ellipsizeMode',\n 'id',\n 'nativeID',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'suppressHighlighting',\n 'selectable',\n 'selectionColor',\n]);\n\nexport const textOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'Text')) return;\n if (!isReactNativeImport(path, 'Text')) return;\n if (hasBlacklistedProperty(path, textBlacklistedProperties)) return;\n\n // Verify that the Text only has string children\n const parent = path.parent as t.JSXElement;\n if (hasInvalidChildren(path, parent)) return;\n\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing Text component in ${filename}:${lineNumber}`);\n\n // Process props\n const originalAttributes = [...path.node.attributes];\n fixNegativeNumberOfLines({ path, log });\n processProps(path, file, originalAttributes);\n\n // Replace the Text component with NativeText\n replaceWithNativeComponent(path, parent, file, 'NativeText');\n};\n\n/**\n * Checks if the Text component has any invalid children or blacklisted properties.\n * This function combines the checks for both attribute-based children and JSX children.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @returns true if the component has invalid children or blacklisted properties.\n */\nfunction hasInvalidChildren(path: NodePath<t.JSXOpeningElement>, parent: t.JSXElement): boolean {\n for (const attribute of path.node.attributes) {\n if (t.isJSXSpreadAttribute(attribute)) continue; // Spread attributes are handled in hasBlacklistedProperty\n\n if (\n t.isJSXIdentifier(attribute.name) &&\n attribute.value &&\n // For a \"children\" attribute, optimization is allowed only if it is a string\n attribute.name.name === 'children' &&\n !isStringNode(path, attribute.value)\n ) {\n return true;\n }\n }\n\n // Return true if any child is not a string node\n return !parent.children.every((child) => isStringNode(path, child));\n}\n\n/**\n * Fixes negative numberOfLines values by setting them to 0.\n */\nfunction fixNegativeNumberOfLines({\n path,\n log,\n}: {\n path: NodePath<t.JSXOpeningElement>;\n log: (message: string) => void;\n}) {\n for (const attribute of path.node.attributes) {\n if (\n t.isJSXAttribute(attribute) &&\n t.isJSXIdentifier(attribute.name, { name: 'numberOfLines' }) &&\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value)\n ) {\n let originalValue: number | undefined;\n if (t.isNumericLiteral(attribute.value.expression)) {\n originalValue = attribute.value.expression.value;\n } else if (\n t.isUnaryExpression(attribute.value.expression) &&\n attribute.value.expression.operator === '-' &&\n t.isNumericLiteral(attribute.value.expression.argument)\n ) {\n originalValue = -attribute.value.expression.argument.value;\n }\n if (originalValue !== undefined && originalValue < 0) {\n log(\n `Warning: 'numberOfLines' in <Text> must be a non-negative number, received: ${originalValue}. The value will be set to 0.`\n );\n attribute.value.expression = t.numericLiteral(0);\n }\n }\n }\n}\n\n/**\n * Extracts the style attribute from JSX attributes.\n */\nfunction extractStyleAttribute(attributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>): {\n styleAttribute?: t.JSXAttribute;\n styleExpr?: t.Expression;\n} {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' })) {\n if (\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value) &&\n !t.isJSXEmptyExpression(attribute.value.expression)\n ) {\n return {\n styleAttribute: attribute,\n styleExpr: attribute.value.expression,\n };\n }\n return { styleAttribute: attribute };\n }\n }\n return {};\n}\n\n/**\n * Processes style and accessibility attributes, replacing them with optimized versions.\n */\nfunction processProps(\n path: NodePath<t.JSXOpeningElement>,\n file: HubFile,\n originalAttributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>\n) {\n const { styleExpr } = extractStyleAttribute(originalAttributes);\n const hasA11y = hasAccessibilityProperty(path, originalAttributes);\n\n if (styleExpr && hasA11y) {\n // When both style and accessibility properties exist, we split them into two separate spread attributes\n const accessibilityAttributes = originalAttributes.filter(\n (attribute) => !(t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' }))\n );\n\n // Set up the accessibility import\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'processAccessibilityProps',\n path,\n importName: 'processAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);\n const accessibilityExpr = t.callExpression(t.identifier(normalizeIdentifier.name), [accessibilityObject]);\n\n // Set up the style import\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'processTextStyle',\n path,\n importName: 'processTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattenedStyleExpr = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n\n // Use two separate JSX spread attributes\n path.node.attributes = [t.jsxSpreadAttribute(accessibilityExpr), t.jsxSpreadAttribute(flattenedStyleExpr)];\n } else if (styleExpr) {\n // Only style attribute is present\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'processTextStyle',\n path,\n importName: 'processTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattened = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n path.node.attributes = [t.jsxSpreadAttribute(flattened)];\n } else if (hasA11y) {\n // Only accessibility properties are present\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'processAccessibilityProps',\n path,\n importName: 'processAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const propsObject = buildPropertiesFromAttributes(originalAttributes);\n const normalized = t.callExpression(t.identifier(normalizeIdentifier.name), [propsObject]);\n path.node.attributes = [t.jsxSpreadAttribute(normalized)];\n }\n}\n","export const log = (message: string) => {\n console.log(`[react-native-boost] ${message}`);\n};\n","import { types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n hasComponentAncestor,\n} from '../../utils/common';\n\nexport const viewBlacklistedProperties = new Set([\n 'accessible',\n 'accessibilityLabel',\n 'accessibilityState',\n 'allowFontScaling',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-label',\n 'aria-selected',\n 'ellipsizeMode',\n 'disabled',\n 'id',\n 'nativeID',\n 'numberOfLines',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'selectable',\n 'selectionColor',\n 'suppressHighlighting',\n 'style',\n]);\n\n// Components to skip when checking for indirect Text ancestors\nconst skipComponents = ['View', 'Fragment', 'ScrollView', 'FlatList'];\n\nexport const viewOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'View')) return;\n if (!isReactNativeImport(path, 'View')) return;\n if (hasBlacklistedProperty(path, viewBlacklistedProperties)) return;\n if (hasComponentAncestor(path, 'Text', skipComponents)) return;\n\n // Extract the file from the Babel hub\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing View component in ${filename}:${lineNumber}`);\n\n const parent = path.parent as t.JSXElement;\n\n // Replace the View component with NativeView\n replaceWithNativeComponent(path, parent, file, 'NativeView');\n};\n","import { declare } from '@babel/helper-plugin-utils';\nimport { textOptimizer } from './optimizers/text';\nimport { PluginOptions } from './types';\nimport { log } from './utils/logger';\nimport { viewOptimizer } from './optimizers/view';\nimport { isIgnoredFile } from './utils/common';\n\nexport default declare((api) => {\n api.assertVersion(7);\n\n return {\n name: 'react-native-boost',\n visitor: {\n JSXOpeningElement(path, state) {\n const options = (state.opts ?? {}) as PluginOptions;\n const logger = options.verbose ? log : () => {};\n if (isIgnoredFile(path, options.ignores ?? [])) return;\n if (options.optimizations?.text !== false) textOptimizer(path, logger);\n if (options.optimizations?.view !== false) viewOptimizer(path, logger);\n },\n },\n };\n});\n"],"names":["t"],"mappings":";;;;;;AAAA,MAAqB,oBAAoB,KAAM,CAAA;AAAA,EAC7C,YAAY,OAAiB,EAAA;AAC3B,IAAM,KAAA,CAAA,CAAA,6CAAA,EAAgD,OAAO,CAAE,CAAA,CAAA;AAC/D,IAAA,IAAA,CAAK,IAAO,GAAA,aAAA;AAAA;AAEhB;;ACLO,MAAM,mBAAsB,GAAA,4BAAA;AAKtB,MAAA,wBAAA,uBAA+B,GAAI,CAAA;AAAA,EAC9C,oBAAA;AAAA,EACA,YAAA;AAAA,EACA,oBAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC,CAAA;;ACGM,SAAS,iBAAkB,CAAA;AAAA,EAChC,IAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAa,GAAA;AACf,CAAoC,EAAA;AAzBpC,EAAA,IAAA,EAAA;AA0BE,EAAA,IAAI,EAAC,CAAA,EAAA,GAAA,IAAA,CAAK,YAAL,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAoB,QAAW,CAAA,CAAA,EAAA;AAClC,IAAK,IAAA,CAAA,YAAA,GAAe,IAAK,CAAA,YAAA,IAAgB,EAAC;AAC1C,IAAA,IAAA,CAAK,aAAa,QAAQ,CAAA,GACxB,eAAe,SACX,GAAA,UAAA,CAAW,MAAM,UAAY,EAAA,EAAE,QAAS,EAAC,IACzC,QAAS,CAAA,IAAA,EAAM,YAA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E,QAAA,IAAA,CAAA,CAAI,aAAQ,aAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAuB,UAAS,KAAO,EAAA,aAAA,CAAc,MAAM,MAAM,CAAA;AAAA;AACvE;AACF,GACF;AACF,CAAC,CAAA;;;;"}
|
package/dist/plugin/index.js
CHANGED
|
@@ -422,18 +422,18 @@ function processProps(path, file, originalAttributes) {
|
|
|
422
422
|
);
|
|
423
423
|
const normalizeIdentifier = addFileImportHint({
|
|
424
424
|
file,
|
|
425
|
-
nameHint: "
|
|
425
|
+
nameHint: "processAccessibilityProps",
|
|
426
426
|
path,
|
|
427
|
-
importName: "
|
|
427
|
+
importName: "processAccessibilityProps",
|
|
428
428
|
moduleName: RUNTIME_MODULE_NAME
|
|
429
429
|
});
|
|
430
430
|
const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);
|
|
431
431
|
const accessibilityExpr = core.types.callExpression(core.types.identifier(normalizeIdentifier.name), [accessibilityObject]);
|
|
432
432
|
const flattenIdentifier = addFileImportHint({
|
|
433
433
|
file,
|
|
434
|
-
nameHint: "
|
|
434
|
+
nameHint: "processTextStyle",
|
|
435
435
|
path,
|
|
436
|
-
importName: "
|
|
436
|
+
importName: "processTextStyle",
|
|
437
437
|
moduleName: RUNTIME_MODULE_NAME
|
|
438
438
|
});
|
|
439
439
|
const flattenedStyleExpr = core.types.callExpression(core.types.identifier(flattenIdentifier.name), [styleExpr]);
|
|
@@ -441,9 +441,9 @@ function processProps(path, file, originalAttributes) {
|
|
|
441
441
|
} else if (styleExpr) {
|
|
442
442
|
const flattenIdentifier = addFileImportHint({
|
|
443
443
|
file,
|
|
444
|
-
nameHint: "
|
|
444
|
+
nameHint: "processTextStyle",
|
|
445
445
|
path,
|
|
446
|
-
importName: "
|
|
446
|
+
importName: "processTextStyle",
|
|
447
447
|
moduleName: RUNTIME_MODULE_NAME
|
|
448
448
|
});
|
|
449
449
|
const flattened = core.types.callExpression(core.types.identifier(flattenIdentifier.name), [styleExpr]);
|
|
@@ -451,9 +451,9 @@ function processProps(path, file, originalAttributes) {
|
|
|
451
451
|
} else if (hasA11y) {
|
|
452
452
|
const normalizeIdentifier = addFileImportHint({
|
|
453
453
|
file,
|
|
454
|
-
nameHint: "
|
|
454
|
+
nameHint: "processAccessibilityProps",
|
|
455
455
|
path,
|
|
456
|
-
importName: "
|
|
456
|
+
importName: "processAccessibilityProps",
|
|
457
457
|
moduleName: RUNTIME_MODULE_NAME
|
|
458
458
|
});
|
|
459
459
|
const propsObject = buildPropertiesFromAttributes(originalAttributes);
|
package/dist/plugin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/plugin/utils/plugin-error.ts","../../src/plugin/utils/constants.ts","../../src/plugin/utils/common/base.ts","../../src/plugin/utils/helpers.ts","../../src/plugin/utils/common/validation.ts","../../src/plugin/utils/common/attributes.ts","../../src/plugin/utils/common/node-types.ts","../../src/plugin/utils/common/ancestors.ts","../../src/plugin/optimizers/text/index.ts","../../src/plugin/utils/logger.ts","../../src/plugin/optimizers/view/index.ts","../../src/plugin/index.ts"],"sourcesContent":["export default class PluginError extends Error {\n constructor(message: string) {\n super(`[react-native-boost] Babel plugin exception: ${message}`);\n this.name = 'PluginError';\n }\n}\n","export const RUNTIME_MODULE_NAME = 'react-native-boost/runtime';\n\n/**\n * The set of accessibility properties that need to be normalized.\n */\nexport const ACCESSIBILITY_PROPERTIES = new Set([\n 'accessibilityLabel',\n 'aria-label',\n 'accessibilityState',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-selected',\n 'accessible',\n]);\n","import { NodePath, types as t } from '@babel/core';\nimport { addDefault, addNamed } from '@babel/helper-module-imports';\nimport { FileImportOptions, HubFile } from '../../types';\nimport { RUNTIME_MODULE_NAME } from '../constants';\n\n/**\n * Adds a hint to the file object to ensure that a specific import is added only once and cached on the file object.\n *\n * @param opts - Object containing the function arguments:\n * - file: The Babel file object (e.g. HubFile)\n * - nameHint: The name hint which also acts as the cache key to ensure the import is only added once (e.g. 'normalizeAccessibilityProps')\n * - path: The current Babel NodePath\n * - importName: The named import string (e.g. 'normalizeAccessibilityProps'), used when importType is 'named'\n * - moduleName: The module to import from (e.g. 'react-native-boost/runtime')\n * - importType: Either 'named' (default) or 'default' to determine the type of import to use.\n *\n * @returns The identifier returned by addNamed or addDefault.\n */\nexport function addFileImportHint({\n file,\n nameHint,\n path,\n importName,\n moduleName,\n importType = 'named',\n}: FileImportOptions): t.Identifier {\n if (!file.__hasImports?.[nameHint]) {\n file.__hasImports = file.__hasImports || {};\n file.__hasImports[nameHint] =\n importType === 'default'\n ? addDefault(path, moduleName, { nameHint })\n : addNamed(path, importName, moduleName, { nameHint });\n }\n return file.__hasImports[nameHint];\n}\n\n/**\n * Replaces a component with its native counterpart.\n * This function handles both the opening and closing tags.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @param file - The Babel file object.\n * @param nativeComponentName - The name of the native component to import.\n * @param moduleName - The module to import the native component from.\n * @returns The identifier for the imported native component.\n */\nexport const replaceWithNativeComponent = (\n path: NodePath<t.JSXOpeningElement>,\n parent: t.JSXElement,\n file: HubFile,\n nativeComponentName: string\n): t.Identifier => {\n // Add native component import (cached on file) to prevent duplicate imports\n const nativeIdentifier = addFileImportHint({\n file,\n nameHint: nativeComponentName,\n path,\n importName: nativeComponentName,\n moduleName: RUNTIME_MODULE_NAME,\n importType: 'named',\n });\n\n // Get the current name of the component, which may be aliased (i.e. Text -> RNText)\n const currentName = (path.node.name as t.JSXIdentifier).name;\n\n // Replace the component with its native counterpart\n const jsxName = path.node.name as t.JSXIdentifier;\n jsxName.name = nativeIdentifier.name;\n\n // If the element is not self-closing, update the closing element as well\n if (\n !path.node.selfClosing &&\n parent.closingElement &&\n t.isJSXIdentifier(parent.closingElement.name) &&\n parent.closingElement.name.name === currentName\n ) {\n parent.closingElement.name.name = nativeIdentifier.name;\n }\n\n return nativeIdentifier;\n};\n","export const ensureArray = <T>(value: T | T[]): T[] => {\n if (Array.isArray(value)) return value;\n return [value];\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ensureArray } from '../helpers';\nimport { HubFile } from '../../types';\nimport { minimatch } from 'minimatch';\nimport nodePath from 'node:path';\nimport PluginError from '../plugin-error';\n\n/**\n * Checks if the file is in the list of ignored files.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param ignores - List of glob paths (absolute or relative to import.meta.dirname).\n * @returns true if the file matches any of the ignore patterns.\n */\nexport const isIgnoredFile = (path: NodePath<t.JSXOpeningElement>, ignores: string[]): boolean => {\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const fileName = file.opts.filename;\n\n // Use the current working directory which typically corresponds to the user's project root.\n const baseDirectory = 'cwd' in file.opts ? (file.opts.cwd as string) : process.cwd();\n\n // Iterate through the ignore patterns.\n for (const pattern of ignores) {\n // If the pattern is not absolute, join it with the baseDir\n const absolutePattern = nodePath.isAbsolute(pattern) ? pattern : nodePath.join(baseDirectory, pattern);\n\n // Check if the file name matches the glob pattern.\n if (minimatch(fileName, absolutePattern, { dot: true })) {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Checks if the JSX element should be ignored based on a preceding comment.\n *\n * The function looks up the JSXOpeningElement's own leading comments as well as\n * the parent element's comments before falling back to inspect siblings.\n *\n * @param path - The path to the JSXOpeningElement.\n * @returns true if the JSX element should be ignored.\n */\nexport const isIgnoredLine = (path: NodePath<t.JSXOpeningElement>): boolean => {\n // Check for @boost-ignore in the leading comments on the JSX opening element.\n if (path.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // Check for @boost-ignore in the leading comments on the parent JSX element.\n const jsxElementPath = path.parentPath;\n if (jsxElementPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // NEW: Check for @boost-ignore in the leading comments on the ObjectProperty (if it exists)\n // This handles cases where the JSX element is used as a value inside an object literal.\n const propertyPath = jsxElementPath.parentPath;\n if (\n propertyPath &&\n propertyPath.isObjectProperty() &&\n propertyPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n\n if (!jsxElementPath.parentPath) return false;\n\n // Get the container that holds this element (for example, a JSX fragment or JSX element)\n const containerPath = jsxElementPath.parentPath;\n const siblings = ensureArray(containerPath.get('children'));\n const index = siblings.findIndex((sibling) => sibling.node === jsxElementPath.node);\n if (index === -1) return false;\n\n // Look backward from the current element for a non-empty node.\n for (let index_ = index - 1; index_ >= 0; index_--) {\n const sibling = siblings[index_];\n // Skip over any whitespace (only in JSXText nodes)\n if (sibling.isJSXText() && sibling.node.value.trim() === '') {\n continue;\n }\n // If the sibling is a JSX expression container, check its empty expression's comments.\n if (sibling.isJSXExpressionContainer()) {\n const expression = sibling.get('expression');\n if (expression && expression.node) {\n const comments = [\n ...(expression.node.leadingComments || []),\n ...(expression.node.trailingComments || []),\n ...(expression.node.innerComments || []),\n ].map((comment) => comment.value.trim());\n if (comments.some((comment) => comment.includes('@boost-ignore'))) {\n return true;\n }\n }\n }\n // Also check if the node itself carries a leadingComments property.\n if (\n sibling.node.leadingComments &&\n sibling.node.leadingComments.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n break; // if the immediate non-whitespace node is not our ignore marker, stop\n }\n return false;\n};\n\n/**\n * Checks if the path represents a valid JSX component with the specified name.\n *\n * @param path - The NodePath to check.\n * @param componentName - The name of the component to validate against.\n * @returns true if the path is a valid JSX component with the specified name.\n */\nexport const isValidJSXComponent = (path: NodePath<t.JSXOpeningElement>, componentName: string): boolean => {\n // Check if the node name is a JSX identifier\n if (!t.isJSXIdentifier(path.node.name)) return false;\n\n // Check if the parent is a JSX element\n const parent = path.parent;\n if (!t.isJSXElement(parent)) return false;\n\n // For aliasing, we check if the underlying imported name matches the expected name\n const componentIdentifier = path.node.name.name;\n const binding = path.scope.getBinding(componentIdentifier);\n if (!binding) return false;\n if (\n binding.kind === 'module' &&\n t.isImportDeclaration(binding.path.parent) &&\n t.isImportSpecifier(binding.path.node)\n ) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === componentName;\n }\n }\n\n // Fallback to string match if binding is not available\n return path.node.name.name === componentName;\n};\n\n/**\n * Checks if the component is imported from 'react-native' and not from a custom module.\n *\n * @param path - The NodePath to check.\n * @param expectedImportedName - The expected import name of the component (we'll also check for aliased imports).\n * @returns true if the component is imported from 'react-native'\n */\nexport const isReactNativeImport = (path: NodePath<t.JSXOpeningElement>, expectedImportedName: string): boolean => {\n if (!t.isJSXIdentifier(path.node.name)) return false;\n const localName = path.node.name.name;\n const binding = path.scope.getBinding(localName);\n if (!binding) return false;\n if (binding.kind === 'module') {\n const importDeclaration = binding.path.parent;\n if (!t.isImportDeclaration(importDeclaration)) return false;\n // Verify it's imported from 'react-native'\n if (importDeclaration.source.value !== 'react-native') return false;\n\n // For named imports, check the imported name (not the alias)\n if (t.isImportSpecifier(binding.path.node)) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === expectedImportedName;\n }\n }\n\n // For default imports, we just assume it's valid if imported from react-native.\n if (t.isImportDefaultSpecifier(binding.path.node)) {\n return true;\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ACCESSIBILITY_PROPERTIES } from '../constants';\n\n/**\n * Checks if the JSX element has a blacklisted property.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param blacklist - The set of blacklisted properties.\n * @returns true if the JSX element has a blacklisted property.\n */\nexport const hasBlacklistedProperty = (path: NodePath<t.JSXOpeningElement>, blacklist: Set<string>): boolean => {\n return path.node.attributes.some((attribute) => {\n // Check direct attributes (e.g., onPress={handler})\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name) && blacklist.has(attribute.name.name)) {\n return true;\n }\n\n // Check spread attributes (e.g., {...props})\n if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n let objectExpression: t.ObjectExpression | undefined;\n if (binding) {\n // If the binding node is a VariableDeclarator, use its initializer\n if (t.isVariableDeclarator(binding.path.node)) {\n objectExpression = binding.path.node.init as t.ObjectExpression;\n } else if (t.isObjectExpression(binding.path.node)) {\n objectExpression = binding.path.node;\n }\n }\n if (objectExpression && t.isObjectExpression(objectExpression)) {\n return objectExpression.properties.some((property) => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n return blacklist.has(property.key.name);\n }\n return false;\n });\n }\n }\n // Bail if we can't resolve the spread attribute\n return true;\n }\n\n // For other attribute types, assume no blacklisting\n return false;\n });\n};\n\n/**\n * Helper that builds an Object.assign expression out of the existing JSX attributes.\n * It handles both plain JSXAttributes and spread attributes.\n *\n * @param attributes - The attributes to build the expression from.\n * @returns The Object.assign expression.\n */\nexport const buildPropertiesFromAttributes = (attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]): t.Expression => {\n const arguments_: t.Expression[] = [];\n for (const attribute of attributes) {\n if (t.isJSXSpreadAttribute(attribute)) {\n arguments_.push(attribute.argument);\n } else if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n let value: t.Expression;\n if (!attribute.value) {\n value = t.booleanLiteral(true);\n } else if (t.isStringLiteral(attribute.value)) {\n value = attribute.value;\n } else if (t.isJSXExpressionContainer(attribute.value)) {\n value = t.isJSXEmptyExpression(attribute.value.expression)\n ? t.booleanLiteral(true)\n : attribute.value.expression;\n } else {\n value = t.nullLiteral();\n }\n // If the key is not a valid JavaScript identifier (e.g. \"aria-label\"), use a string literal.\n const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n const keyNode =\n typeof key === 'string' && validIdentifierRegex.test(key) ? t.identifier(key) : t.stringLiteral(key.toString());\n\n arguments_.push(t.objectExpression([t.objectProperty(keyNode, value)]));\n }\n }\n if (arguments_.length === 0) {\n return t.objectExpression([]);\n }\n return t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('assign')), [\n t.objectExpression([]),\n ...arguments_,\n ]);\n};\n\n/**\n * Checks if the JSX element has an accessibility property.\n *\n * @param path - The NodePath for the JSXOpeningElement, used for scope lookup.\n * @param attributes - The attributes to check.\n * @returns true if the JSX element has an accessibility property.\n */\nexport const hasAccessibilityProperty = (\n path: NodePath<t.JSXOpeningElement>,\n attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]\n): boolean => {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n if (typeof key === 'string' && ACCESSIBILITY_PROPERTIES.has(key)) {\n return true;\n }\n } else if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isObjectExpression(attribute.argument)) {\n for (const property of attribute.argument.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n } else if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n if (binding && t.isVariableDeclarator(binding.path.node)) {\n const declarator = binding.path.node as t.VariableDeclarator;\n if (declarator.init && t.isObjectExpression(declarator.init)) {\n for (const property of declarator.init.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n continue;\n }\n }\n return true;\n } else {\n return true;\n }\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if a node represents a string value.\n */\nexport const isStringNode = (path: NodePath<t.JSXOpeningElement>, child: t.Node): boolean => {\n if (t.isJSXText(child) || t.isStringLiteral(child)) return true;\n\n // Check for JSX expressions\n if (t.isJSXExpressionContainer(child)) {\n const expression = child.expression;\n if (t.isIdentifier(expression)) {\n const binding = path.scope.getBinding(expression.name);\n if (binding && binding.path.node && t.isVariableDeclarator(binding.path.node)) {\n return !!binding.path.node.init && t.isStringLiteral(binding.path.node.init);\n }\n return false;\n }\n if (t.isStringLiteral(expression)) return true;\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if any ancestor element is of the specified component type or contains that component type.\n * This function handles both direct ancestors and custom components that may contain the specified component.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param componentName - The name of the component to check for in ancestors.\n * @param skipComponents - Optional array of component names to skip when checking ancestors.\n * @returns true if any ancestor is or contains the specified component.\n */\nexport function hasComponentAncestor(\n path: NodePath<t.JSXOpeningElement>,\n componentName: string,\n skipComponents: string[] = ['Fragment']\n): boolean {\n // Check for direct ancestors of the specified component type\n const directAncestor = path.findParent((parentPath) => {\n return (\n t.isJSXElement(parentPath.node) && t.isJSXIdentifier(parentPath.node.openingElement.name, { name: componentName })\n );\n });\n\n if (directAncestor) return true;\n\n // Check for indirect ancestors (custom components that contain the specified component)\n return !!path.findParent((parentPath) => {\n // Only check JSX elements\n if (!t.isJSXElement(parentPath.node)) return false;\n\n // Get the component name\n const openingElement = parentPath.node.openingElement;\n if (!t.isJSXIdentifier(openingElement.name)) return false;\n\n const ancestorComponentName = openingElement.name.name;\n\n // Skip the component we're looking for\n if (ancestorComponentName === componentName) {\n return false;\n }\n\n // Skip components in the skipComponents list\n if (skipComponents.includes(ancestorComponentName)) {\n return false;\n }\n\n // Skip lowercase components (built-in HTML elements)\n if (ancestorComponentName[0] === ancestorComponentName[0].toLowerCase()) {\n return false;\n }\n\n // Try to find the component definition through variable binding\n const binding = parentPath.scope.getBinding(ancestorComponentName);\n if (!binding) return false;\n\n // Now check the component definition for the specified component\n if (t.isVariableDeclarator(binding.path.node)) {\n const init = binding.path.node.init;\n\n // Handle arrow functions or function expressions\n if (t.isArrowFunctionExpression(init) || t.isFunctionExpression(init)) {\n // Check the function body for the specified component\n return t.isBlockStatement(init.body)\n ? hasComponentInReturnStatement(init.body, componentName)\n : hasComponentInExpression(init.body, componentName);\n }\n } else if (t.isFunctionDeclaration(binding.path.node)) {\n // Handle function declarations\n return hasComponentInReturnStatement(binding.path.node.body, componentName);\n }\n\n return false;\n });\n}\n\n/**\n * Check if a block statement contains a return statement with the specified component\n *\n * @param blockStatement - The block statement to check\n * @param componentName - The name of the component to look for\n * @returns true if the block statement contains a return with the specified component\n */\nfunction hasComponentInReturnStatement(blockStatement: t.BlockStatement, componentName: string): boolean {\n for (const statement of blockStatement.body) {\n if (\n t.isReturnStatement(statement) &&\n statement.argument &&\n hasComponentInExpression(statement.argument, componentName)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if an expression contains the specified component\n *\n * @param expression - The expression to check\n * @param componentName - The name of the component to look for\n * @returns true if the expression contains the specified component\n */\nfunction hasComponentInExpression(expression: t.Expression, componentName: string): boolean {\n // If directly returning a JSX element\n if (t.isJSXElement(expression)) {\n // Check if it's the specified component\n if (t.isJSXIdentifier(expression.openingElement.name, { name: componentName })) {\n return true;\n }\n\n // Check if any children are the specified component\n for (const child of expression.children) {\n if (t.isJSXElement(child) && t.isJSXIdentifier(child.openingElement.name, { name: componentName })) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import { NodePath, types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n addFileImportHint,\n buildPropertiesFromAttributes,\n hasAccessibilityProperty,\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n isStringNode,\n} from '../../utils/common';\nimport { RUNTIME_MODULE_NAME } from '../../utils/constants';\n\nexport const textBlacklistedProperties = new Set([\n 'allowFontScaling',\n 'ellipsizeMode',\n 'id',\n 'nativeID',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'suppressHighlighting',\n 'selectable',\n 'selectionColor',\n]);\n\nexport const textOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'Text')) return;\n if (!isReactNativeImport(path, 'Text')) return;\n if (hasBlacklistedProperty(path, textBlacklistedProperties)) return;\n\n // Verify that the Text only has string children\n const parent = path.parent as t.JSXElement;\n if (hasInvalidChildren(path, parent)) return;\n\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing Text component in ${filename}:${lineNumber}`);\n\n // Process props\n const originalAttributes = [...path.node.attributes];\n fixNegativeNumberOfLines({ path, log });\n processProps(path, file, originalAttributes);\n\n // Replace the Text component with NativeText\n replaceWithNativeComponent(path, parent, file, 'NativeText');\n};\n\n/**\n * Checks if the Text component has any invalid children or blacklisted properties.\n * This function combines the checks for both attribute-based children and JSX children.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @returns true if the component has invalid children or blacklisted properties.\n */\nfunction hasInvalidChildren(path: NodePath<t.JSXOpeningElement>, parent: t.JSXElement): boolean {\n for (const attribute of path.node.attributes) {\n if (t.isJSXSpreadAttribute(attribute)) continue; // Spread attributes are handled in hasBlacklistedProperty\n\n if (\n t.isJSXIdentifier(attribute.name) &&\n attribute.value &&\n // For a \"children\" attribute, optimization is allowed only if it is a string\n attribute.name.name === 'children' &&\n !isStringNode(path, attribute.value)\n ) {\n return true;\n }\n }\n\n // Return true if any child is not a string node\n return !parent.children.every((child) => isStringNode(path, child));\n}\n\n/**\n * Fixes negative numberOfLines values by setting them to 0.\n */\nfunction fixNegativeNumberOfLines({\n path,\n log,\n}: {\n path: NodePath<t.JSXOpeningElement>;\n log: (message: string) => void;\n}) {\n for (const attribute of path.node.attributes) {\n if (\n t.isJSXAttribute(attribute) &&\n t.isJSXIdentifier(attribute.name, { name: 'numberOfLines' }) &&\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value)\n ) {\n let originalValue: number | undefined;\n if (t.isNumericLiteral(attribute.value.expression)) {\n originalValue = attribute.value.expression.value;\n } else if (\n t.isUnaryExpression(attribute.value.expression) &&\n attribute.value.expression.operator === '-' &&\n t.isNumericLiteral(attribute.value.expression.argument)\n ) {\n originalValue = -attribute.value.expression.argument.value;\n }\n if (originalValue !== undefined && originalValue < 0) {\n log(\n `Warning: 'numberOfLines' in <Text> must be a non-negative number, received: ${originalValue}. The value will be set to 0.`\n );\n attribute.value.expression = t.numericLiteral(0);\n }\n }\n }\n}\n\n/**\n * Extracts the style attribute from JSX attributes.\n */\nfunction extractStyleAttribute(attributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>): {\n styleAttribute?: t.JSXAttribute;\n styleExpr?: t.Expression;\n} {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' })) {\n if (\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value) &&\n !t.isJSXEmptyExpression(attribute.value.expression)\n ) {\n return {\n styleAttribute: attribute,\n styleExpr: attribute.value.expression,\n };\n }\n return { styleAttribute: attribute };\n }\n }\n return {};\n}\n\n/**\n * Processes style and accessibility attributes, replacing them with optimized versions.\n */\nfunction processProps(\n path: NodePath<t.JSXOpeningElement>,\n file: HubFile,\n originalAttributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>\n) {\n const { styleExpr } = extractStyleAttribute(originalAttributes);\n const hasA11y = hasAccessibilityProperty(path, originalAttributes);\n\n if (styleExpr && hasA11y) {\n // When both style and accessibility properties exist, we split them into two separate spread attributes\n const accessibilityAttributes = originalAttributes.filter(\n (attribute) => !(t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' }))\n );\n\n // Set up the accessibility import\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'normalizeAccessibilityProps',\n path,\n importName: 'normalizeAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);\n const accessibilityExpr = t.callExpression(t.identifier(normalizeIdentifier.name), [accessibilityObject]);\n\n // Set up the style import\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'flattenTextStyle',\n path,\n importName: 'flattenTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattenedStyleExpr = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n\n // Use two separate JSX spread attributes\n path.node.attributes = [t.jsxSpreadAttribute(accessibilityExpr), t.jsxSpreadAttribute(flattenedStyleExpr)];\n } else if (styleExpr) {\n // Only style attribute is present\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'flattenTextStyle',\n path,\n importName: 'flattenTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattened = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n path.node.attributes = [t.jsxSpreadAttribute(flattened)];\n } else if (hasA11y) {\n // Only accessibility properties are present\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'normalizeAccessibilityProps',\n path,\n importName: 'normalizeAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const propsObject = buildPropertiesFromAttributes(originalAttributes);\n const normalized = t.callExpression(t.identifier(normalizeIdentifier.name), [propsObject]);\n path.node.attributes = [t.jsxSpreadAttribute(normalized)];\n }\n}\n","export const log = (message: string) => {\n console.log(`[react-native-boost] ${message}`);\n};\n","import { types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n hasComponentAncestor,\n} from '../../utils/common';\n\nexport const viewBlacklistedProperties = new Set([\n 'accessible',\n 'accessibilityLabel',\n 'accessibilityState',\n 'allowFontScaling',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-label',\n 'aria-selected',\n 'ellipsizeMode',\n 'disabled',\n 'id',\n 'nativeID',\n 'numberOfLines',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'selectable',\n 'selectionColor',\n 'suppressHighlighting',\n 'style',\n]);\n\n// Components to skip when checking for indirect Text ancestors\nconst skipComponents = ['View', 'Fragment', 'ScrollView', 'FlatList'];\n\nexport const viewOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'View')) return;\n if (!isReactNativeImport(path, 'View')) return;\n if (hasBlacklistedProperty(path, viewBlacklistedProperties)) return;\n if (hasComponentAncestor(path, 'Text', skipComponents)) return;\n\n // Extract the file from the Babel hub\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing View component in ${filename}:${lineNumber}`);\n\n const parent = path.parent as t.JSXElement;\n\n // Replace the View component with NativeView\n replaceWithNativeComponent(path, parent, file, 'NativeView');\n};\n","import { declare } from '@babel/helper-plugin-utils';\nimport { textOptimizer } from './optimizers/text';\nimport { PluginOptions } from './types';\nimport { log } from './utils/logger';\nimport { viewOptimizer } from './optimizers/view';\nimport { isIgnoredFile } from './utils/common';\n\nexport default declare((api) => {\n api.assertVersion(7);\n\n return {\n name: 'react-native-boost',\n visitor: {\n JSXOpeningElement(path, state) {\n const options = (state.opts ?? {}) as PluginOptions;\n const logger = options.verbose ? log : () => {};\n if (isIgnoredFile(path, options.ignores ?? [])) return;\n if (options.optimizations?.text !== false) textOptimizer(path, logger);\n if (options.optimizations?.view !== false) viewOptimizer(path, logger);\n },\n },\n };\n});\n"],"names":["addDefault","addNamed","t","minimatch","declare"],"mappings":";;;;;;;;AAAA,MAAqB,oBAAoB,KAAM,CAAA;AAAA,EAC7C,YAAY,OAAiB,EAAA;AAC3B,IAAM,KAAA,CAAA,CAAA,6CAAA,EAAgD,OAAO,CAAE,CAAA,CAAA;AAC/D,IAAA,IAAA,CAAK,IAAO,GAAA,aAAA;AAAA;AAEhB;;ACLO,MAAM,mBAAsB,GAAA,4BAAA;AAKtB,MAAA,wBAAA,uBAA+B,GAAI,CAAA;AAAA,EAC9C,oBAAA;AAAA,EACA,YAAA;AAAA,EACA,oBAAA;AAAA,EACA,WAAA;AAAA,EACA,cAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC,CAAA;;ACGM,SAAS,iBAAkB,CAAA;AAAA,EAChC,IAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAa,GAAA;AACf,CAAoC,EAAA;AAzBpC,EAAA,IAAA,EAAA;AA0BE,EAAA,IAAI,EAAC,CAAA,EAAA,GAAA,IAAA,CAAK,YAAL,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAoB,QAAW,CAAA,CAAA,EAAA;AAClC,IAAK,IAAA,CAAA,YAAA,GAAe,IAAK,CAAA,YAAA,IAAgB,EAAC;AAC1C,IAAA,IAAA,CAAK,aAAa,QAAQ,CAAA,GACxB,eAAe,SACX,GAAAA,8BAAA,CAAW,MAAM,UAAY,EAAA,EAAE,QAAS,EAAC,IACzCC,4BAAS,CAAA,IAAA,EAAM,YAAY,UAAY,EAAA,EAAE,UAAU,CAAA;AAAA;AAE3D,EAAO,OAAA,IAAA,CAAK,aAAa,QAA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,CAAuB,UAAS,KAAO,EAAA,aAAA,CAAc,MAAM,MAAM,CAAA;AAAA;AACvE;AACF,GACF;AACF,CAAC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/plugin/utils/plugin-error.ts","../../src/plugin/utils/constants.ts","../../src/plugin/utils/common/base.ts","../../src/plugin/utils/helpers.ts","../../src/plugin/utils/common/validation.ts","../../src/plugin/utils/common/attributes.ts","../../src/plugin/utils/common/node-types.ts","../../src/plugin/utils/common/ancestors.ts","../../src/plugin/optimizers/text/index.ts","../../src/plugin/utils/logger.ts","../../src/plugin/optimizers/view/index.ts","../../src/plugin/index.ts"],"sourcesContent":["export default class PluginError extends Error {\n constructor(message: string) {\n super(`[react-native-boost] Babel plugin exception: ${message}`);\n this.name = 'PluginError';\n }\n}\n","export const RUNTIME_MODULE_NAME = 'react-native-boost/runtime';\n\n/**\n * The set of accessibility properties that need to be normalized.\n */\nexport const ACCESSIBILITY_PROPERTIES = new Set([\n 'accessibilityLabel',\n 'aria-label',\n 'accessibilityState',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-selected',\n 'accessible',\n]);\n","import { NodePath, types as t } from '@babel/core';\nimport { addDefault, addNamed } from '@babel/helper-module-imports';\nimport { FileImportOptions, HubFile } from '../../types';\nimport { RUNTIME_MODULE_NAME } from '../constants';\n\n/**\n * Adds a hint to the file object to ensure that a specific import is added only once and cached on the file object.\n *\n * @param opts - Object containing the function arguments:\n * - file: The Babel file object (e.g. HubFile)\n * - nameHint: The name hint which also acts as the cache key to ensure the import is only added once (e.g. 'processAccessibilityProps')\n * - path: The current Babel NodePath\n * - importName: The named import string (e.g. 'processAccessibilityProps'), used when importType is 'named'\n * - moduleName: The module to import from (e.g. 'react-native-boost/runtime')\n * - importType: Either 'named' (default) or 'default' to determine the type of import to use.\n *\n * @returns The identifier returned by addNamed or addDefault.\n */\nexport function addFileImportHint({\n file,\n nameHint,\n path,\n importName,\n moduleName,\n importType = 'named',\n}: FileImportOptions): t.Identifier {\n if (!file.__hasImports?.[nameHint]) {\n file.__hasImports = file.__hasImports || {};\n file.__hasImports[nameHint] =\n importType === 'default'\n ? addDefault(path, moduleName, { nameHint })\n : addNamed(path, importName, moduleName, { nameHint });\n }\n return file.__hasImports[nameHint];\n}\n\n/**\n * Replaces a component with its native counterpart.\n * This function handles both the opening and closing tags.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @param file - The Babel file object.\n * @param nativeComponentName - The name of the native component to import.\n * @param moduleName - The module to import the native component from.\n * @returns The identifier for the imported native component.\n */\nexport const replaceWithNativeComponent = (\n path: NodePath<t.JSXOpeningElement>,\n parent: t.JSXElement,\n file: HubFile,\n nativeComponentName: string\n): t.Identifier => {\n // Add native component import (cached on file) to prevent duplicate imports\n const nativeIdentifier = addFileImportHint({\n file,\n nameHint: nativeComponentName,\n path,\n importName: nativeComponentName,\n moduleName: RUNTIME_MODULE_NAME,\n importType: 'named',\n });\n\n // Get the current name of the component, which may be aliased (i.e. Text -> RNText)\n const currentName = (path.node.name as t.JSXIdentifier).name;\n\n // Replace the component with its native counterpart\n const jsxName = path.node.name as t.JSXIdentifier;\n jsxName.name = nativeIdentifier.name;\n\n // If the element is not self-closing, update the closing element as well\n if (\n !path.node.selfClosing &&\n parent.closingElement &&\n t.isJSXIdentifier(parent.closingElement.name) &&\n parent.closingElement.name.name === currentName\n ) {\n parent.closingElement.name.name = nativeIdentifier.name;\n }\n\n return nativeIdentifier;\n};\n","export const ensureArray = <T>(value: T | T[]): T[] => {\n if (Array.isArray(value)) return value;\n return [value];\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ensureArray } from '../helpers';\nimport { HubFile } from '../../types';\nimport { minimatch } from 'minimatch';\nimport nodePath from 'node:path';\nimport PluginError from '../plugin-error';\n\n/**\n * Checks if the file is in the list of ignored files.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param ignores - List of glob paths (absolute or relative to import.meta.dirname).\n * @returns true if the file matches any of the ignore patterns.\n */\nexport const isIgnoredFile = (path: NodePath<t.JSXOpeningElement>, ignores: string[]): boolean => {\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const fileName = file.opts.filename;\n\n // Use the current working directory which typically corresponds to the user's project root.\n const baseDirectory = 'cwd' in file.opts ? (file.opts.cwd as string) : process.cwd();\n\n // Iterate through the ignore patterns.\n for (const pattern of ignores) {\n // If the pattern is not absolute, join it with the baseDir\n const absolutePattern = nodePath.isAbsolute(pattern) ? pattern : nodePath.join(baseDirectory, pattern);\n\n // Check if the file name matches the glob pattern.\n if (minimatch(fileName, absolutePattern, { dot: true })) {\n return true;\n }\n }\n\n return false;\n};\n\n/**\n * Checks if the JSX element should be ignored based on a preceding comment.\n *\n * The function looks up the JSXOpeningElement's own leading comments as well as\n * the parent element's comments before falling back to inspect siblings.\n *\n * @param path - The path to the JSXOpeningElement.\n * @returns true if the JSX element should be ignored.\n */\nexport const isIgnoredLine = (path: NodePath<t.JSXOpeningElement>): boolean => {\n // Check for @boost-ignore in the leading comments on the JSX opening element.\n if (path.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // Check for @boost-ignore in the leading comments on the parent JSX element.\n const jsxElementPath = path.parentPath;\n if (jsxElementPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))) {\n return true;\n }\n\n // NEW: Check for @boost-ignore in the leading comments on the ObjectProperty (if it exists)\n // This handles cases where the JSX element is used as a value inside an object literal.\n const propertyPath = jsxElementPath.parentPath;\n if (\n propertyPath &&\n propertyPath.isObjectProperty() &&\n propertyPath.node.leadingComments?.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n\n if (!jsxElementPath.parentPath) return false;\n\n // Get the container that holds this element (for example, a JSX fragment or JSX element)\n const containerPath = jsxElementPath.parentPath;\n const siblings = ensureArray(containerPath.get('children'));\n const index = siblings.findIndex((sibling) => sibling.node === jsxElementPath.node);\n if (index === -1) return false;\n\n // Look backward from the current element for a non-empty node.\n for (let index_ = index - 1; index_ >= 0; index_--) {\n const sibling = siblings[index_];\n // Skip over any whitespace (only in JSXText nodes)\n if (sibling.isJSXText() && sibling.node.value.trim() === '') {\n continue;\n }\n // If the sibling is a JSX expression container, check its empty expression's comments.\n if (sibling.isJSXExpressionContainer()) {\n const expression = sibling.get('expression');\n if (expression && expression.node) {\n const comments = [\n ...(expression.node.leadingComments || []),\n ...(expression.node.trailingComments || []),\n ...(expression.node.innerComments || []),\n ].map((comment) => comment.value.trim());\n if (comments.some((comment) => comment.includes('@boost-ignore'))) {\n return true;\n }\n }\n }\n // Also check if the node itself carries a leadingComments property.\n if (\n sibling.node.leadingComments &&\n sibling.node.leadingComments.some((comment) => comment.value.includes('@boost-ignore'))\n ) {\n return true;\n }\n break; // if the immediate non-whitespace node is not our ignore marker, stop\n }\n return false;\n};\n\n/**\n * Checks if the path represents a valid JSX component with the specified name.\n *\n * @param path - The NodePath to check.\n * @param componentName - The name of the component to validate against.\n * @returns true if the path is a valid JSX component with the specified name.\n */\nexport const isValidJSXComponent = (path: NodePath<t.JSXOpeningElement>, componentName: string): boolean => {\n // Check if the node name is a JSX identifier\n if (!t.isJSXIdentifier(path.node.name)) return false;\n\n // Check if the parent is a JSX element\n const parent = path.parent;\n if (!t.isJSXElement(parent)) return false;\n\n // For aliasing, we check if the underlying imported name matches the expected name\n const componentIdentifier = path.node.name.name;\n const binding = path.scope.getBinding(componentIdentifier);\n if (!binding) return false;\n if (\n binding.kind === 'module' &&\n t.isImportDeclaration(binding.path.parent) &&\n t.isImportSpecifier(binding.path.node)\n ) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === componentName;\n }\n }\n\n // Fallback to string match if binding is not available\n return path.node.name.name === componentName;\n};\n\n/**\n * Checks if the component is imported from 'react-native' and not from a custom module.\n *\n * @param path - The NodePath to check.\n * @param expectedImportedName - The expected import name of the component (we'll also check for aliased imports).\n * @returns true if the component is imported from 'react-native'\n */\nexport const isReactNativeImport = (path: NodePath<t.JSXOpeningElement>, expectedImportedName: string): boolean => {\n if (!t.isJSXIdentifier(path.node.name)) return false;\n const localName = path.node.name.name;\n const binding = path.scope.getBinding(localName);\n if (!binding) return false;\n if (binding.kind === 'module') {\n const importDeclaration = binding.path.parent;\n if (!t.isImportDeclaration(importDeclaration)) return false;\n // Verify it's imported from 'react-native'\n if (importDeclaration.source.value !== 'react-native') return false;\n\n // For named imports, check the imported name (not the alias)\n if (t.isImportSpecifier(binding.path.node)) {\n const imported = binding.path.node.imported;\n if (t.isIdentifier(imported)) {\n return imported.name === expectedImportedName;\n }\n }\n\n // For default imports, we just assume it's valid if imported from react-native.\n if (t.isImportDefaultSpecifier(binding.path.node)) {\n return true;\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\nimport { ACCESSIBILITY_PROPERTIES } from '../constants';\n\n/**\n * Checks if the JSX element has a blacklisted property.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param blacklist - The set of blacklisted properties.\n * @returns true if the JSX element has a blacklisted property.\n */\nexport const hasBlacklistedProperty = (path: NodePath<t.JSXOpeningElement>, blacklist: Set<string>): boolean => {\n return path.node.attributes.some((attribute) => {\n // Check direct attributes (e.g., onPress={handler})\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name) && blacklist.has(attribute.name.name)) {\n return true;\n }\n\n // Check spread attributes (e.g., {...props})\n if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n let objectExpression: t.ObjectExpression | undefined;\n if (binding) {\n // If the binding node is a VariableDeclarator, use its initializer\n if (t.isVariableDeclarator(binding.path.node)) {\n objectExpression = binding.path.node.init as t.ObjectExpression;\n } else if (t.isObjectExpression(binding.path.node)) {\n objectExpression = binding.path.node;\n }\n }\n if (objectExpression && t.isObjectExpression(objectExpression)) {\n return objectExpression.properties.some((property) => {\n if (t.isObjectProperty(property) && t.isIdentifier(property.key)) {\n return blacklist.has(property.key.name);\n }\n return false;\n });\n }\n }\n // Bail if we can't resolve the spread attribute\n return true;\n }\n\n // For other attribute types, assume no blacklisting\n return false;\n });\n};\n\n/**\n * Helper that builds an Object.assign expression out of the existing JSX attributes.\n * It handles both plain JSXAttributes and spread attributes.\n *\n * @param attributes - The attributes to build the expression from.\n * @returns The Object.assign expression.\n */\nexport const buildPropertiesFromAttributes = (attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]): t.Expression => {\n const arguments_: t.Expression[] = [];\n for (const attribute of attributes) {\n if (t.isJSXSpreadAttribute(attribute)) {\n arguments_.push(attribute.argument);\n } else if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n let value: t.Expression;\n if (!attribute.value) {\n value = t.booleanLiteral(true);\n } else if (t.isStringLiteral(attribute.value)) {\n value = attribute.value;\n } else if (t.isJSXExpressionContainer(attribute.value)) {\n value = t.isJSXEmptyExpression(attribute.value.expression)\n ? t.booleanLiteral(true)\n : attribute.value.expression;\n } else {\n value = t.nullLiteral();\n }\n // If the key is not a valid JavaScript identifier (e.g. \"aria-label\"), use a string literal.\n const validIdentifierRegex = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;\n const keyNode =\n typeof key === 'string' && validIdentifierRegex.test(key) ? t.identifier(key) : t.stringLiteral(key.toString());\n\n arguments_.push(t.objectExpression([t.objectProperty(keyNode, value)]));\n }\n }\n if (arguments_.length === 0) {\n return t.objectExpression([]);\n }\n return t.callExpression(t.memberExpression(t.identifier('Object'), t.identifier('assign')), [\n t.objectExpression([]),\n ...arguments_,\n ]);\n};\n\n/**\n * Checks if the JSX element has an accessibility property.\n *\n * @param path - The NodePath for the JSXOpeningElement, used for scope lookup.\n * @param attributes - The attributes to check.\n * @returns true if the JSX element has an accessibility property.\n */\nexport const hasAccessibilityProperty = (\n path: NodePath<t.JSXOpeningElement>,\n attributes: (t.JSXAttribute | t.JSXSpreadAttribute)[]\n): boolean => {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute)) {\n const key = attribute.name.name;\n if (typeof key === 'string' && ACCESSIBILITY_PROPERTIES.has(key)) {\n return true;\n }\n } else if (t.isJSXSpreadAttribute(attribute)) {\n if (t.isObjectExpression(attribute.argument)) {\n for (const property of attribute.argument.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n } else if (t.isIdentifier(attribute.argument)) {\n const binding = path.scope.getBinding(attribute.argument.name);\n if (binding && t.isVariableDeclarator(binding.path.node)) {\n const declarator = binding.path.node as t.VariableDeclarator;\n if (declarator.init && t.isObjectExpression(declarator.init)) {\n for (const property of declarator.init.properties) {\n if (\n t.isObjectProperty(property) &&\n t.isIdentifier(property.key) &&\n ACCESSIBILITY_PROPERTIES.has(property.key.name)\n ) {\n return true;\n }\n }\n continue;\n }\n }\n return true;\n } else {\n return true;\n }\n }\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if a node represents a string value.\n */\nexport const isStringNode = (path: NodePath<t.JSXOpeningElement>, child: t.Node): boolean => {\n if (t.isJSXText(child) || t.isStringLiteral(child)) return true;\n\n // Check for JSX expressions\n if (t.isJSXExpressionContainer(child)) {\n const expression = child.expression;\n if (t.isIdentifier(expression)) {\n const binding = path.scope.getBinding(expression.name);\n if (binding && binding.path.node && t.isVariableDeclarator(binding.path.node)) {\n return !!binding.path.node.init && t.isStringLiteral(binding.path.node.init);\n }\n return false;\n }\n if (t.isStringLiteral(expression)) return true;\n }\n return false;\n};\n","import { NodePath, types as t } from '@babel/core';\n\n/**\n * Checks if any ancestor element is of the specified component type or contains that component type.\n * This function handles both direct ancestors and custom components that may contain the specified component.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param componentName - The name of the component to check for in ancestors.\n * @param skipComponents - Optional array of component names to skip when checking ancestors.\n * @returns true if any ancestor is or contains the specified component.\n */\nexport function hasComponentAncestor(\n path: NodePath<t.JSXOpeningElement>,\n componentName: string,\n skipComponents: string[] = ['Fragment']\n): boolean {\n // Check for direct ancestors of the specified component type\n const directAncestor = path.findParent((parentPath) => {\n return (\n t.isJSXElement(parentPath.node) && t.isJSXIdentifier(parentPath.node.openingElement.name, { name: componentName })\n );\n });\n\n if (directAncestor) return true;\n\n // Check for indirect ancestors (custom components that contain the specified component)\n return !!path.findParent((parentPath) => {\n // Only check JSX elements\n if (!t.isJSXElement(parentPath.node)) return false;\n\n // Get the component name\n const openingElement = parentPath.node.openingElement;\n if (!t.isJSXIdentifier(openingElement.name)) return false;\n\n const ancestorComponentName = openingElement.name.name;\n\n // Skip the component we're looking for\n if (ancestorComponentName === componentName) {\n return false;\n }\n\n // Skip components in the skipComponents list\n if (skipComponents.includes(ancestorComponentName)) {\n return false;\n }\n\n // Skip lowercase components (built-in HTML elements)\n if (ancestorComponentName[0] === ancestorComponentName[0].toLowerCase()) {\n return false;\n }\n\n // Try to find the component definition through variable binding\n const binding = parentPath.scope.getBinding(ancestorComponentName);\n if (!binding) return false;\n\n // Now check the component definition for the specified component\n if (t.isVariableDeclarator(binding.path.node)) {\n const init = binding.path.node.init;\n\n // Handle arrow functions or function expressions\n if (t.isArrowFunctionExpression(init) || t.isFunctionExpression(init)) {\n // Check the function body for the specified component\n return t.isBlockStatement(init.body)\n ? hasComponentInReturnStatement(init.body, componentName)\n : hasComponentInExpression(init.body, componentName);\n }\n } else if (t.isFunctionDeclaration(binding.path.node)) {\n // Handle function declarations\n return hasComponentInReturnStatement(binding.path.node.body, componentName);\n }\n\n return false;\n });\n}\n\n/**\n * Check if a block statement contains a return statement with the specified component\n *\n * @param blockStatement - The block statement to check\n * @param componentName - The name of the component to look for\n * @returns true if the block statement contains a return with the specified component\n */\nfunction hasComponentInReturnStatement(blockStatement: t.BlockStatement, componentName: string): boolean {\n for (const statement of blockStatement.body) {\n if (\n t.isReturnStatement(statement) &&\n statement.argument &&\n hasComponentInExpression(statement.argument, componentName)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Check if an expression contains the specified component\n *\n * @param expression - The expression to check\n * @param componentName - The name of the component to look for\n * @returns true if the expression contains the specified component\n */\nfunction hasComponentInExpression(expression: t.Expression, componentName: string): boolean {\n // If directly returning a JSX element\n if (t.isJSXElement(expression)) {\n // Check if it's the specified component\n if (t.isJSXIdentifier(expression.openingElement.name, { name: componentName })) {\n return true;\n }\n\n // Check if any children are the specified component\n for (const child of expression.children) {\n if (t.isJSXElement(child) && t.isJSXIdentifier(child.openingElement.name, { name: componentName })) {\n return true;\n }\n }\n }\n\n return false;\n}\n","import { NodePath, types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n addFileImportHint,\n buildPropertiesFromAttributes,\n hasAccessibilityProperty,\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n isStringNode,\n} from '../../utils/common';\nimport { RUNTIME_MODULE_NAME } from '../../utils/constants';\n\nexport const textBlacklistedProperties = new Set([\n 'allowFontScaling',\n 'ellipsizeMode',\n 'id',\n 'nativeID',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'suppressHighlighting',\n 'selectable',\n 'selectionColor',\n]);\n\nexport const textOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'Text')) return;\n if (!isReactNativeImport(path, 'Text')) return;\n if (hasBlacklistedProperty(path, textBlacklistedProperties)) return;\n\n // Verify that the Text only has string children\n const parent = path.parent as t.JSXElement;\n if (hasInvalidChildren(path, parent)) return;\n\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing Text component in ${filename}:${lineNumber}`);\n\n // Process props\n const originalAttributes = [...path.node.attributes];\n fixNegativeNumberOfLines({ path, log });\n processProps(path, file, originalAttributes);\n\n // Replace the Text component with NativeText\n replaceWithNativeComponent(path, parent, file, 'NativeText');\n};\n\n/**\n * Checks if the Text component has any invalid children or blacklisted properties.\n * This function combines the checks for both attribute-based children and JSX children.\n *\n * @param path - The path to the JSXOpeningElement.\n * @param parent - The parent JSX element.\n * @returns true if the component has invalid children or blacklisted properties.\n */\nfunction hasInvalidChildren(path: NodePath<t.JSXOpeningElement>, parent: t.JSXElement): boolean {\n for (const attribute of path.node.attributes) {\n if (t.isJSXSpreadAttribute(attribute)) continue; // Spread attributes are handled in hasBlacklistedProperty\n\n if (\n t.isJSXIdentifier(attribute.name) &&\n attribute.value &&\n // For a \"children\" attribute, optimization is allowed only if it is a string\n attribute.name.name === 'children' &&\n !isStringNode(path, attribute.value)\n ) {\n return true;\n }\n }\n\n // Return true if any child is not a string node\n return !parent.children.every((child) => isStringNode(path, child));\n}\n\n/**\n * Fixes negative numberOfLines values by setting them to 0.\n */\nfunction fixNegativeNumberOfLines({\n path,\n log,\n}: {\n path: NodePath<t.JSXOpeningElement>;\n log: (message: string) => void;\n}) {\n for (const attribute of path.node.attributes) {\n if (\n t.isJSXAttribute(attribute) &&\n t.isJSXIdentifier(attribute.name, { name: 'numberOfLines' }) &&\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value)\n ) {\n let originalValue: number | undefined;\n if (t.isNumericLiteral(attribute.value.expression)) {\n originalValue = attribute.value.expression.value;\n } else if (\n t.isUnaryExpression(attribute.value.expression) &&\n attribute.value.expression.operator === '-' &&\n t.isNumericLiteral(attribute.value.expression.argument)\n ) {\n originalValue = -attribute.value.expression.argument.value;\n }\n if (originalValue !== undefined && originalValue < 0) {\n log(\n `Warning: 'numberOfLines' in <Text> must be a non-negative number, received: ${originalValue}. The value will be set to 0.`\n );\n attribute.value.expression = t.numericLiteral(0);\n }\n }\n }\n}\n\n/**\n * Extracts the style attribute from JSX attributes.\n */\nfunction extractStyleAttribute(attributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>): {\n styleAttribute?: t.JSXAttribute;\n styleExpr?: t.Expression;\n} {\n for (const attribute of attributes) {\n if (t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' })) {\n if (\n attribute.value &&\n t.isJSXExpressionContainer(attribute.value) &&\n !t.isJSXEmptyExpression(attribute.value.expression)\n ) {\n return {\n styleAttribute: attribute,\n styleExpr: attribute.value.expression,\n };\n }\n return { styleAttribute: attribute };\n }\n }\n return {};\n}\n\n/**\n * Processes style and accessibility attributes, replacing them with optimized versions.\n */\nfunction processProps(\n path: NodePath<t.JSXOpeningElement>,\n file: HubFile,\n originalAttributes: Array<t.JSXAttribute | t.JSXSpreadAttribute>\n) {\n const { styleExpr } = extractStyleAttribute(originalAttributes);\n const hasA11y = hasAccessibilityProperty(path, originalAttributes);\n\n if (styleExpr && hasA11y) {\n // When both style and accessibility properties exist, we split them into two separate spread attributes\n const accessibilityAttributes = originalAttributes.filter(\n (attribute) => !(t.isJSXAttribute(attribute) && t.isJSXIdentifier(attribute.name, { name: 'style' }))\n );\n\n // Set up the accessibility import\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'processAccessibilityProps',\n path,\n importName: 'processAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);\n const accessibilityExpr = t.callExpression(t.identifier(normalizeIdentifier.name), [accessibilityObject]);\n\n // Set up the style import\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'processTextStyle',\n path,\n importName: 'processTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattenedStyleExpr = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n\n // Use two separate JSX spread attributes\n path.node.attributes = [t.jsxSpreadAttribute(accessibilityExpr), t.jsxSpreadAttribute(flattenedStyleExpr)];\n } else if (styleExpr) {\n // Only style attribute is present\n const flattenIdentifier = addFileImportHint({\n file,\n nameHint: 'processTextStyle',\n path,\n importName: 'processTextStyle',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const flattened = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);\n path.node.attributes = [t.jsxSpreadAttribute(flattened)];\n } else if (hasA11y) {\n // Only accessibility properties are present\n const normalizeIdentifier = addFileImportHint({\n file,\n nameHint: 'processAccessibilityProps',\n path,\n importName: 'processAccessibilityProps',\n moduleName: RUNTIME_MODULE_NAME,\n });\n const propsObject = buildPropertiesFromAttributes(originalAttributes);\n const normalized = t.callExpression(t.identifier(normalizeIdentifier.name), [propsObject]);\n path.node.attributes = [t.jsxSpreadAttribute(normalized)];\n }\n}\n","export const log = (message: string) => {\n console.log(`[react-native-boost] ${message}`);\n};\n","import { types as t } from '@babel/core';\nimport { HubFile, Optimizer } from '../../types';\nimport PluginError from '../../utils/plugin-error';\nimport {\n hasBlacklistedProperty,\n isIgnoredLine,\n isValidJSXComponent,\n isReactNativeImport,\n replaceWithNativeComponent,\n hasComponentAncestor,\n} from '../../utils/common';\n\nexport const viewBlacklistedProperties = new Set([\n 'accessible',\n 'accessibilityLabel',\n 'accessibilityState',\n 'allowFontScaling',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-label',\n 'aria-selected',\n 'ellipsizeMode',\n 'disabled',\n 'id',\n 'nativeID',\n 'numberOfLines',\n 'onLongPress',\n 'onPress',\n 'onPressIn',\n 'onPressOut',\n 'onResponderGrant',\n 'onResponderMove',\n 'onResponderRelease',\n 'onResponderTerminate',\n 'onResponderTerminationRequest',\n 'onStartShouldSetResponder',\n 'pressRetentionOffset',\n 'selectable',\n 'selectionColor',\n 'suppressHighlighting',\n 'style',\n]);\n\n// Components to skip when checking for indirect Text ancestors\nconst skipComponents = ['View', 'Fragment', 'ScrollView', 'FlatList'];\n\nexport const viewOptimizer: Optimizer = (path, log = () => {}) => {\n if (isIgnoredLine(path)) return;\n if (!isValidJSXComponent(path, 'View')) return;\n if (!isReactNativeImport(path, 'View')) return;\n if (hasBlacklistedProperty(path, viewBlacklistedProperties)) return;\n if (hasComponentAncestor(path, 'Text', skipComponents)) return;\n\n // Extract the file from the Babel hub\n const hub = path.hub as unknown;\n const file = typeof hub === 'object' && hub !== null && 'file' in hub ? (hub.file as HubFile) : undefined;\n\n if (!file) {\n throw new PluginError('No file found in Babel hub');\n }\n\n const filename = file.opts?.filename || 'unknown file';\n const lineNumber = path.node.loc?.start.line ?? 'unknown line';\n log(`Optimizing View component in ${filename}:${lineNumber}`);\n\n const parent = path.parent as t.JSXElement;\n\n // Replace the View component with NativeView\n replaceWithNativeComponent(path, parent, file, 'NativeView');\n};\n","import { declare } from '@babel/helper-plugin-utils';\nimport { textOptimizer } from './optimizers/text';\nimport { PluginOptions } from './types';\nimport { log } from './utils/logger';\nimport { viewOptimizer } from './optimizers/view';\nimport { isIgnoredFile } from './utils/common';\n\nexport default declare((api) => {\n api.assertVersion(7);\n\n return {\n name: 'react-native-boost',\n visitor: {\n JSXOpeningElement(path, state) {\n const options = (state.opts ?? {}) as PluginOptions;\n const logger = options.verbose ? log : () => {};\n if (isIgnoredFile(path, options.ignores ?? [])) return;\n if (options.optimizations?.text !== false) textOptimizer(path, logger);\n if (options.optimizations?.view !== false) viewOptimizer(path, logger);\n },\n },\n };\n});\n"],"names":["addDefault","addNamed","t","minimatch","declare"],"mappings":";;;;;;;;AAAA,MAAqB,oBAAoB,KAAM,CAAA;AAAA,EAC7C,YAAY,OAAiB,EAAA;AAC3B,IAAM,KAAA,CAAA,CAAA,6CAAA,EAAgD,OAAO,CAAE,CAAA,CAAA;A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MAAM,SAAS,IAAK,CAAA,MAAA;AAGpB,EAA2B,0BAAA,CAAA,IAAA,EAAM,MAAQ,EAAA,IAAA,EAAM,YAAY,CAAA;AAC7D,CAAA;;AChEA,YAAeE,yBAAA,CAAQ,CAAC,GAAQ,KAAA;AAC9B,EAAA,GAAA,CAAI,cAAc,CAAC,CAAA;AAEnB,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,oBAAA;AAAA,IACN,OAAS,EAAA;AAAA,MACP,iBAAA,CAAkB,MAAM,KAAO,EAAA;AAbrC,QAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAcQ,QAAA,MAAM,OAAW,GAAA,CAAA,EAAA,GAAA,KAAA,CAAM,IAAN,KAAA,IAAA,GAAA,EAAA,GAAc,EAAC;AAChC,QAAA,MAAM,MAAS,GAAA,OAAA,CAAQ,OAAU,GAAA,GAAA,GAAM,MAAM;AAAA,SAAC;AAC9C,QAAA,IAAI,cAAc,IAAM,EAAA,CAAA,EAAA,GAAA,OAAA,CAAQ,YAAR,IAAmB,GAAA,EAAA,GAAA,EAAE,CAAG,EAAA;AAChD,QAAA,IAAA,CAAA,CAAI,aAAQ,aAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAuB,UAAS,KAAO,EAAA,aAAA,CAAc,MAAM,MAAM,CAAA;AACrE,QAAA,IAAA,CAAA,CAAI,aAAQ,aAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAuB,UAAS,KAAO,EAAA,aAAA,CAAc,MAAM,MAAM,CAAA;AAAA;AACvE;AACF,GACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';
|
|
2
2
|
import { Platform } from 'react-native';
|
|
3
3
|
|
|
4
|
+
const userSelectToSelectableMap = {
|
|
5
|
+
auto: true,
|
|
6
|
+
text: true,
|
|
7
|
+
none: false,
|
|
8
|
+
contain: true,
|
|
9
|
+
all: true
|
|
10
|
+
};
|
|
11
|
+
const verticalAlignToTextAlignVerticalMap = {
|
|
12
|
+
auto: "auto",
|
|
13
|
+
top: "top",
|
|
14
|
+
bottom: "bottom",
|
|
15
|
+
middle: "center"
|
|
16
|
+
};
|
|
17
|
+
|
|
4
18
|
const NativeText = Platform.OS === "web" ? require("react-native").Text : require("react-native/Libraries/Text/TextNativeComponent").NativeText;
|
|
5
19
|
|
|
6
20
|
const NativeView = Platform.OS === "web" ? require("react-native").View : require("react-native/Libraries/Components/View/ViewNativeComponent").default;
|
|
7
21
|
|
|
8
22
|
const propsCache = /* @__PURE__ */ new WeakMap();
|
|
9
|
-
function
|
|
23
|
+
function processTextStyle(style) {
|
|
10
24
|
if (!style) return {};
|
|
11
25
|
let props = propsCache.get(style);
|
|
12
26
|
if (props) return props;
|
|
@@ -28,20 +42,7 @@ function flattenTextStyle(style) {
|
|
|
28
42
|
props.style = style;
|
|
29
43
|
return props;
|
|
30
44
|
}
|
|
31
|
-
|
|
32
|
-
auto: true,
|
|
33
|
-
text: true,
|
|
34
|
-
none: false,
|
|
35
|
-
contain: true,
|
|
36
|
-
all: true
|
|
37
|
-
};
|
|
38
|
-
const verticalAlignToTextAlignVerticalMap = {
|
|
39
|
-
auto: "auto",
|
|
40
|
-
top: "top",
|
|
41
|
-
bottom: "bottom",
|
|
42
|
-
middle: "center"
|
|
43
|
-
};
|
|
44
|
-
function normalizeAccessibilityProperties(props) {
|
|
45
|
+
function processAccessibilityProps(props) {
|
|
45
46
|
const {
|
|
46
47
|
accessibilityLabel,
|
|
47
48
|
["aria-label"]: ariaLabel,
|
|
@@ -80,5 +81,5 @@ function normalizeAccessibilityProperties(props) {
|
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
export { NativeText, NativeView,
|
|
84
|
+
export { NativeText, NativeView, processAccessibilityProps, processTextStyle, userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap };
|
|
84
85
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../src/runtime/components/native-text.tsx","../../../src/runtime/components/native-view.tsx","../../../src/runtime/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeText =\n Platform.OS === 'web'\n ? require('react-native').Text\n : require('react-native/Libraries/Text/TextNativeComponent').NativeText;\n","/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeView =\n Platform.OS === 'web'\n ? require('react-native').View\n : require('react-native/Libraries/Components/View/ViewNativeComponent').default;\n","import { TextStyle } from 'react-native';\nimport flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';\nimport { GenericStyleProp } from './types';\n\nconst propsCache = new WeakMap();\n\nexport function
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../src/runtime/utils/constants.ts","../../../src/runtime/components/native-text.tsx","../../../src/runtime/components/native-view.tsx","../../../src/runtime/index.ts"],"sourcesContent":["// Maps the `userSelect` prop to the native `selectable` prop\nexport const userSelectToSelectableMap = {\n auto: true,\n text: true,\n none: false,\n contain: true,\n all: true,\n};\n\n// Maps the `verticalAlign` prop to the native `textAlignVertical` prop\nexport const verticalAlignToTextAlignVerticalMap = {\n auto: 'auto',\n top: 'top',\n bottom: 'bottom',\n middle: 'center',\n};\n","/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeText =\n Platform.OS === 'web'\n ? require('react-native').Text\n : require('react-native/Libraries/Text/TextNativeComponent').NativeText;\n","/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeView =\n Platform.OS === 'web'\n ? require('react-native').View\n : require('react-native/Libraries/Components/View/ViewNativeComponent').default;\n","import { TextProps, TextStyle } from 'react-native';\nimport flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';\nimport { GenericStyleProp } from './types';\nimport { userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap } from './utils/constants';\n\nconst propsCache = new WeakMap();\n\nexport function processTextStyle(style: GenericStyleProp<TextStyle>): Partial<TextProps> {\n if (!style) return {};\n\n // Cache the computed props\n let props = propsCache.get(style);\n if (props) return props;\n\n props = {};\n propsCache.set(style, props);\n\n style = flattenStyle(style);\n\n if (!style) return {};\n\n if (typeof style?.fontWeight === 'number') {\n style.fontWeight = style.fontWeight.toString() as TextStyle['fontWeight'];\n }\n\n if (style?.userSelect != null) {\n props.selectable = userSelectToSelectableMap[style.userSelect];\n delete style.userSelect;\n }\n\n if (style?.verticalAlign != null) {\n style.textAlignVertical = verticalAlignToTextAlignVerticalMap[\n style.verticalAlign\n ] as TextStyle['textAlignVertical'];\n delete style.verticalAlign;\n }\n\n props.style = style;\n return props;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function processAccessibilityProps(props: Record<string, any>): Record<string, any> {\n const {\n accessibilityLabel,\n ['aria-label']: ariaLabel,\n accessibilityState,\n ['aria-busy']: ariaBusy,\n ['aria-checked']: ariaChecked,\n ['aria-disabled']: ariaDisabled,\n ['aria-expanded']: ariaExpanded,\n ['aria-selected']: ariaSelected,\n accessible,\n ...restProperties\n } = props;\n\n // Merge label props: prefer the aria-label if defined.\n const normalizedLabel = ariaLabel ?? accessibilityLabel;\n\n // Merge the accessibilityState with any provided ARIA properties.\n let normalizedState = accessibilityState;\n if (ariaBusy != null || ariaChecked != null || ariaDisabled != null || ariaExpanded != null || ariaSelected != null) {\n normalizedState =\n normalizedState == null\n ? {\n busy: ariaBusy,\n checked: ariaChecked,\n disabled: ariaDisabled,\n expanded: ariaExpanded,\n selected: ariaSelected,\n }\n : {\n busy: ariaBusy ?? normalizedState.busy,\n checked: ariaChecked ?? normalizedState.checked,\n disabled: ariaDisabled ?? normalizedState.disabled,\n expanded: ariaExpanded ?? normalizedState.expanded,\n selected: ariaSelected ?? normalizedState.selected,\n };\n }\n\n // For the accessible prop, if not provided, default to `true`\n const normalizedAccessible = accessible == null ? true : accessible;\n\n return {\n ...restProperties,\n accessibilityLabel: normalizedLabel,\n accessibilityState: normalizedState,\n accessible: normalizedAccessible,\n };\n}\n\nexport * from './types';\nexport * from './utils/constants';\nexport * from './components/native-text';\nexport * from './components/native-view';\n"],"names":[],"mappings":";;;AACO,MAAM,yBAA4B,GAAA;AAAA,EACvC,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,KAAA;AAAA,EACN,OAAS,EAAA,IAAA;AAAA,EACT,GAAK,EAAA;AACP;AAGO,MAAM,mCAAsC,GAAA;AAAA,EACjD,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA,EACL,MAAQ,EAAA,QAAA;AAAA,EACR,MAAQ,EAAA;AACV;;ACZa,MAAA,UAAA,GACX,QAAS,CAAA,EAAA,KAAO,KACZ,GAAA,OAAA,CAAQ,cAAc,CAAE,CAAA,IAAA,GACxB,OAAQ,CAAA,iDAAiD,CAAE,CAAA;;ACHpD,MAAA,UAAA,GACX,QAAS,CAAA,EAAA,KAAO,KACZ,GAAA,OAAA,CAAQ,cAAc,CAAE,CAAA,IAAA,GACxB,OAAQ,CAAA,4DAA4D,CAAE,CAAA;;ACD5E,MAAM,UAAA,uBAAiB,OAAQ,EAAA;AAExB,SAAS,iBAAiB,KAAwD,EAAA;AACvF,EAAI,IAAA,CAAC,KAAO,EAAA,OAAO,EAAC;AAGpB,EAAI,IAAA,KAAA,GAAQ,UAAW,CAAA,GAAA,CAAI,KAAK,CAAA;AAChC,EAAA,IAAI,OAAc,OAAA,KAAA;AAElB,EAAA,KAAA,GAAQ,EAAC;AACT,EAAW,UAAA,CAAA,GAAA,CAAI,OAAO,KAAK,CAAA;AAE3B,EAAA,KAAA,GAAQ,aAAa,KAAK,CAAA;AAE1B,EAAI,IAAA,CA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,gBAAgB,IAAQ,IAAA,YAAA,IAAgB,IAAQ,IAAA,YAAA,IAAgB,IAAM,EAAA;AACnH,IAAA,eAAA,GACE,mBAAmB,IACf,GAAA;AAAA,MACE,IAAM,EAAA,QAAA;AAAA,MACN,OAAS,EAAA,WAAA;AAAA,MACT,QAAU,EAAA,YAAA;AAAA,MACV,QAAU,EAAA,YAAA;AAAA,MACV,QAAU,EAAA;AAAA,KAEZ,GAAA;AAAA,MACE,IAAA,EAAM,8BAAY,eAAgB,CAAA,IAAA;AAAA,MAClC,OAAA,EAAS,oCAAe,eAAgB,CAAA,OAAA;AAAA,MACxC,QAAA,EAAU,sCAAgB,eAAgB,CAAA,QAAA;AAAA,MAC1C,QAAA,EAAU,sCAAgB,eAAgB,CAAA,QAAA;AAAA,MAC1C,QAAA,EAAU,sCAAgB,eAAgB,CAAA;AAAA,KAC5C;AAAA;AAIR,EAAM,MAAA,oBAAA,GAAuB,UAAc,IAAA,IAAA,GAAO,IAAO,GAAA,UAAA;AAEzD,EAAO,OAAA;AAAA,IACL,GAAG,cAAA;AAAA,IACH,kBAAoB,EAAA,eAAA;AAAA,IACpB,kBAAoB,EAAA,eAAA;AAAA,IACpB,UAAY,EAAA;AAAA,GACd;AACF;;;;"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
function flattenTextStyle(style) {
|
|
2
|
-
if (!style) return {};
|
|
3
|
-
return { style };
|
|
4
|
-
}
|
|
5
1
|
const userSelectToSelectableMap = {
|
|
6
2
|
auto: true,
|
|
7
3
|
text: true,
|
|
@@ -15,11 +11,13 @@ const verticalAlignToTextAlignVerticalMap = {
|
|
|
15
11
|
bottom: "bottom",
|
|
16
12
|
middle: "center"
|
|
17
13
|
};
|
|
18
|
-
|
|
14
|
+
|
|
15
|
+
const processTextStyle = (style) => ({ style });
|
|
16
|
+
function processAccessibilityProps(props) {
|
|
19
17
|
return props;
|
|
20
18
|
}
|
|
21
19
|
const NativeText = require("react-native").Text;
|
|
22
20
|
const NativeView = require("react-native").View;
|
|
23
21
|
|
|
24
|
-
export { NativeText, NativeView,
|
|
22
|
+
export { NativeText, NativeView, processAccessibilityProps, processTextStyle, userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap };
|
|
25
23
|
//# sourceMappingURL=index.web.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.mjs","sources":["../../../src/runtime/index.web.ts"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"file":"index.web.mjs","sources":["../../../src/runtime/utils/constants.ts","../../../src/runtime/index.web.ts"],"sourcesContent":["// Maps the `userSelect` prop to the native `selectable` prop\nexport const userSelectToSelectableMap = {\n auto: true,\n text: true,\n none: false,\n contain: true,\n all: true,\n};\n\n// Maps the `verticalAlign` prop to the native `textAlignVertical` prop\nexport const verticalAlignToTextAlignVerticalMap = {\n auto: 'auto',\n top: 'top',\n bottom: 'bottom',\n middle: 'center',\n};\n","// This is a dummy file to ensure that nothing breaks when using the runtime in a web environment.\n\nimport { TextProps, TextStyle } from 'react-native';\nimport { GenericStyleProp } from './types';\n\nexport const processTextStyle = (style: GenericStyleProp<TextStyle>) => ({ style }) as Partial<TextProps>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function processAccessibilityProps(props: Record<string, any>): Record<string, any> {\n return props;\n}\n\nexport * from './types';\nexport * from './utils/constants';\n\n// On Web, the native components are not available, so we use the standard components that'll be replaced by their DOM\n// equivalents by react-native-web.\n/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nexport const NativeText = require('react-native').Text;\nexport const NativeView = require('react-native').View;\n/* eslint-enable @typescript-eslint/no-require-imports,unicorn/prefer-module */\n"],"names":[],"mappings":"AACO,MAAM,yBAA4B,GAAA;AAAA,EACvC,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,KAAA;AAAA,EACN,OAAS,EAAA,IAAA;AAAA,EACT,GAAK,EAAA;AACP;AAGO,MAAM,mCAAsC,GAAA;AAAA,EACjD,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA,EACL,MAAQ,EAAA,QAAA;AAAA,EACR,MAAQ,EAAA;AACV;;ACVO,MAAM,gBAAmB,GAAA,CAAC,KAAwC,MAAA,EAAE,KAAM,EAAA;AAG1E,SAAS,0BAA0B,KAAiD,EAAA;AACzF,EAAO,OAAA,KAAA;AACT;AAQa,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAc,CAAE,CAAA;AACrC,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAc,CAAE,CAAA;;;;"}
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { TextStyle } from 'react-native';
|
|
1
|
+
import { TextStyle, TextProps } from 'react-native';
|
|
2
2
|
|
|
3
3
|
type GenericStyleProp<T> = null | void | T | false | '' | ReadonlyArray<GenericStyleProp<T>>;
|
|
4
4
|
|
|
5
|
-
declare const NativeText: any;
|
|
6
|
-
|
|
7
|
-
declare const NativeView: any;
|
|
8
|
-
|
|
9
|
-
declare function flattenTextStyle(style: GenericStyleProp<TextStyle>): any;
|
|
10
5
|
declare const userSelectToSelectableMap: {
|
|
11
6
|
auto: boolean;
|
|
12
7
|
text: boolean;
|
|
@@ -20,12 +15,12 @@ declare const verticalAlignToTextAlignVerticalMap: {
|
|
|
20
15
|
bottom: string;
|
|
21
16
|
middle: string;
|
|
22
17
|
};
|
|
23
|
-
/**
|
|
24
|
-
* Normalizes accessibility props.
|
|
25
|
-
*
|
|
26
|
-
* @param props - The props to normalize.
|
|
27
|
-
* @returns The normalized props.
|
|
28
|
-
*/
|
|
29
|
-
declare function normalizeAccessibilityProperties(props: Record<string, any>): Record<string, any>;
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
declare const NativeText: any;
|
|
20
|
+
|
|
21
|
+
declare const NativeView: any;
|
|
22
|
+
|
|
23
|
+
declare function processTextStyle(style: GenericStyleProp<TextStyle>): Partial<TextProps>;
|
|
24
|
+
declare function processAccessibilityProps(props: Record<string, any>): Record<string, any>;
|
|
25
|
+
|
|
26
|
+
export { type GenericStyleProp, NativeText, NativeView, processAccessibilityProps, processTextStyle, userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap };
|
package/dist/runtime/index.js
CHANGED
|
@@ -3,12 +3,26 @@
|
|
|
3
3
|
var flattenStyle = require('react-native/Libraries/StyleSheet/flattenStyle');
|
|
4
4
|
var reactNative = require('react-native');
|
|
5
5
|
|
|
6
|
+
const userSelectToSelectableMap = {
|
|
7
|
+
auto: true,
|
|
8
|
+
text: true,
|
|
9
|
+
none: false,
|
|
10
|
+
contain: true,
|
|
11
|
+
all: true
|
|
12
|
+
};
|
|
13
|
+
const verticalAlignToTextAlignVerticalMap = {
|
|
14
|
+
auto: "auto",
|
|
15
|
+
top: "top",
|
|
16
|
+
bottom: "bottom",
|
|
17
|
+
middle: "center"
|
|
18
|
+
};
|
|
19
|
+
|
|
6
20
|
const NativeText = reactNative.Platform.OS === "web" ? require("react-native").Text : require("react-native/Libraries/Text/TextNativeComponent").NativeText;
|
|
7
21
|
|
|
8
22
|
const NativeView = reactNative.Platform.OS === "web" ? require("react-native").View : require("react-native/Libraries/Components/View/ViewNativeComponent").default;
|
|
9
23
|
|
|
10
24
|
const propsCache = /* @__PURE__ */ new WeakMap();
|
|
11
|
-
function
|
|
25
|
+
function processTextStyle(style) {
|
|
12
26
|
if (!style) return {};
|
|
13
27
|
let props = propsCache.get(style);
|
|
14
28
|
if (props) return props;
|
|
@@ -30,20 +44,7 @@ function flattenTextStyle(style) {
|
|
|
30
44
|
props.style = style;
|
|
31
45
|
return props;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
auto: true,
|
|
35
|
-
text: true,
|
|
36
|
-
none: false,
|
|
37
|
-
contain: true,
|
|
38
|
-
all: true
|
|
39
|
-
};
|
|
40
|
-
const verticalAlignToTextAlignVerticalMap = {
|
|
41
|
-
auto: "auto",
|
|
42
|
-
top: "top",
|
|
43
|
-
bottom: "bottom",
|
|
44
|
-
middle: "center"
|
|
45
|
-
};
|
|
46
|
-
function normalizeAccessibilityProperties(props) {
|
|
47
|
+
function processAccessibilityProps(props) {
|
|
47
48
|
const {
|
|
48
49
|
accessibilityLabel,
|
|
49
50
|
["aria-label"]: ariaLabel,
|
|
@@ -84,8 +85,8 @@ function normalizeAccessibilityProperties(props) {
|
|
|
84
85
|
|
|
85
86
|
exports.NativeText = NativeText;
|
|
86
87
|
exports.NativeView = NativeView;
|
|
87
|
-
exports.
|
|
88
|
-
exports.
|
|
88
|
+
exports.processAccessibilityProps = processAccessibilityProps;
|
|
89
|
+
exports.processTextStyle = processTextStyle;
|
|
89
90
|
exports.userSelectToSelectableMap = userSelectToSelectableMap;
|
|
90
91
|
exports.verticalAlignToTextAlignVerticalMap = verticalAlignToTextAlignVerticalMap;
|
|
91
92
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/runtime/components/native-text.tsx","../../src/runtime/components/native-view.tsx","../../src/runtime/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeText =\n Platform.OS === 'web'\n ? require('react-native').Text\n : require('react-native/Libraries/Text/TextNativeComponent').NativeText;\n","/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeView =\n Platform.OS === 'web'\n ? require('react-native').View\n : require('react-native/Libraries/Components/View/ViewNativeComponent').default;\n","import { TextStyle } from 'react-native';\nimport flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';\nimport { GenericStyleProp } from './types';\n\nconst propsCache = new WeakMap();\n\nexport function
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/runtime/utils/constants.ts","../../src/runtime/components/native-text.tsx","../../src/runtime/components/native-view.tsx","../../src/runtime/index.ts"],"sourcesContent":["// Maps the `userSelect` prop to the native `selectable` prop\nexport const userSelectToSelectableMap = {\n auto: true,\n text: true,\n none: false,\n contain: true,\n all: true,\n};\n\n// Maps the `verticalAlign` prop to the native `textAlignVertical` prop\nexport const verticalAlignToTextAlignVerticalMap = {\n auto: 'auto',\n top: 'top',\n bottom: 'bottom',\n middle: 'center',\n};\n","/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeText =\n Platform.OS === 'web'\n ? require('react-native').Text\n : require('react-native/Libraries/Text/TextNativeComponent').NativeText;\n","/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nimport { Platform } from 'react-native';\n\nexport const NativeView =\n Platform.OS === 'web'\n ? require('react-native').View\n : require('react-native/Libraries/Components/View/ViewNativeComponent').default;\n","import { TextProps, TextStyle } from 'react-native';\nimport flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';\nimport { GenericStyleProp } from './types';\nimport { userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap } from './utils/constants';\n\nconst propsCache = new WeakMap();\n\nexport function processTextStyle(style: GenericStyleProp<TextStyle>): Partial<TextProps> {\n if (!style) return {};\n\n // Cache the computed props\n let props = propsCache.get(style);\n if (props) return props;\n\n props = {};\n propsCache.set(style, props);\n\n style = flattenStyle(style);\n\n if (!style) return {};\n\n if (typeof style?.fontWeight === 'number') {\n style.fontWeight = style.fontWeight.toString() as TextStyle['fontWeight'];\n }\n\n if (style?.userSelect != null) {\n props.selectable = userSelectToSelectableMap[style.userSelect];\n delete style.userSelect;\n }\n\n if (style?.verticalAlign != null) {\n style.textAlignVertical = verticalAlignToTextAlignVerticalMap[\n style.verticalAlign\n ] as TextStyle['textAlignVertical'];\n delete style.verticalAlign;\n }\n\n props.style = style;\n return props;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function processAccessibilityProps(props: Record<string, any>): Record<string, any> {\n const {\n accessibilityLabel,\n ['aria-label']: ariaLabel,\n accessibilityState,\n ['aria-busy']: ariaBusy,\n ['aria-checked']: ariaChecked,\n ['aria-disabled']: ariaDisabled,\n ['aria-expanded']: ariaExpanded,\n ['aria-selected']: ariaSelected,\n accessible,\n ...restProperties\n } = props;\n\n // Merge label props: prefer the aria-label if defined.\n const normalizedLabel = ariaLabel ?? accessibilityLabel;\n\n // Merge the accessibilityState with any provided ARIA properties.\n let normalizedState = accessibilityState;\n if (ariaBusy != null || ariaChecked != null || ariaDisabled != null || ariaExpanded != null || ariaSelected != null) {\n normalizedState =\n normalizedState == null\n ? {\n busy: ariaBusy,\n checked: ariaChecked,\n disabled: ariaDisabled,\n expanded: ariaExpanded,\n selected: ariaSelected,\n }\n : {\n busy: ariaBusy ?? normalizedState.busy,\n checked: ariaChecked ?? normalizedState.checked,\n disabled: ariaDisabled ?? normalizedState.disabled,\n expanded: ariaExpanded ?? normalizedState.expanded,\n selected: ariaSelected ?? normalizedState.selected,\n };\n }\n\n // For the accessible prop, if not provided, default to `true`\n const normalizedAccessible = accessible == null ? true : accessible;\n\n return {\n ...restProperties,\n accessibilityLabel: normalizedLabel,\n accessibilityState: normalizedState,\n accessible: normalizedAccessible,\n };\n}\n\nexport * from './types';\nexport * from './utils/constants';\nexport * from './components/native-text';\nexport * from './components/native-view';\n"],"names":["Platform"],"mappings":";;;;;AACO,MAAM,yBAA4B,GAAA;AAAA,EACvC,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,KAAA;AAAA,EACN,OAAS,EAAA,IAAA;AAAA,EACT,GAAK,EAAA;AACP;AAGO,MAAM,mCAAsC,GAAA;AAAA,EACjD,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA,EACL,MAAQ,EAAA,QAAA;AAAA,EACR,MAAQ,EAAA;AACV;;ACZa,MAAA,UAAA,GACXA,oBAAS,CAAA,EAAA,KAAO,KACZ,GAAA,OAAA,CAAQ,cAAc,CAAE,CAAA,IAAA,GACxB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oB,EAAA,eAAA;AAAA,IACpB,kBAAoB,EAAA,eAAA;AAAA,IACpB,UAAY,EAAA;AAAA,GACd;AACF;;;;;;;;;"}
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { TextStyle } from 'react-native';
|
|
1
|
+
import { TextStyle, TextProps } from 'react-native';
|
|
2
2
|
|
|
3
3
|
type GenericStyleProp<T> = null | void | T | false | '' | ReadonlyArray<GenericStyleProp<T>>;
|
|
4
4
|
|
|
5
|
-
declare function flattenTextStyle(style: GenericStyleProp<TextStyle>): {
|
|
6
|
-
style?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
style: TextStyle | readonly GenericStyleProp<TextStyle>[];
|
|
9
|
-
};
|
|
10
5
|
declare const userSelectToSelectableMap: {
|
|
11
6
|
auto: boolean;
|
|
12
7
|
text: boolean;
|
|
@@ -20,15 +15,11 @@ declare const verticalAlignToTextAlignVerticalMap: {
|
|
|
20
15
|
bottom: string;
|
|
21
16
|
middle: string;
|
|
22
17
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
* @param props - The props to normalize.
|
|
27
|
-
* @returns The normalized props.
|
|
28
|
-
*/
|
|
29
|
-
declare function normalizeAccessibilityProperties(props: Record<string, any>): Record<string, any>;
|
|
18
|
+
|
|
19
|
+
declare const processTextStyle: (style: GenericStyleProp<TextStyle>) => Partial<TextProps>;
|
|
20
|
+
declare function processAccessibilityProps(props: Record<string, any>): Record<string, any>;
|
|
30
21
|
|
|
31
22
|
declare const NativeText: any;
|
|
32
23
|
declare const NativeView: any;
|
|
33
24
|
|
|
34
|
-
export { type GenericStyleProp, NativeText, NativeView,
|
|
25
|
+
export { type GenericStyleProp, NativeText, NativeView, processAccessibilityProps, processTextStyle, userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function flattenTextStyle(style) {
|
|
4
|
-
if (!style) return {};
|
|
5
|
-
return { style };
|
|
6
|
-
}
|
|
7
3
|
const userSelectToSelectableMap = {
|
|
8
4
|
auto: true,
|
|
9
5
|
text: true,
|
|
@@ -17,7 +13,9 @@ const verticalAlignToTextAlignVerticalMap = {
|
|
|
17
13
|
bottom: "bottom",
|
|
18
14
|
middle: "center"
|
|
19
15
|
};
|
|
20
|
-
|
|
16
|
+
|
|
17
|
+
const processTextStyle = (style) => ({ style });
|
|
18
|
+
function processAccessibilityProps(props) {
|
|
21
19
|
return props;
|
|
22
20
|
}
|
|
23
21
|
const NativeText = require("react-native").Text;
|
|
@@ -25,8 +23,8 @@ const NativeView = require("react-native").View;
|
|
|
25
23
|
|
|
26
24
|
exports.NativeText = NativeText;
|
|
27
25
|
exports.NativeView = NativeView;
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
26
|
+
exports.processAccessibilityProps = processAccessibilityProps;
|
|
27
|
+
exports.processTextStyle = processTextStyle;
|
|
30
28
|
exports.userSelectToSelectableMap = userSelectToSelectableMap;
|
|
31
29
|
exports.verticalAlignToTextAlignVerticalMap = verticalAlignToTextAlignVerticalMap;
|
|
32
30
|
//# sourceMappingURL=index.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.js","sources":["../../src/runtime/index.web.ts"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"file":"index.web.js","sources":["../../src/runtime/utils/constants.ts","../../src/runtime/index.web.ts"],"sourcesContent":["// Maps the `userSelect` prop to the native `selectable` prop\nexport const userSelectToSelectableMap = {\n auto: true,\n text: true,\n none: false,\n contain: true,\n all: true,\n};\n\n// Maps the `verticalAlign` prop to the native `textAlignVertical` prop\nexport const verticalAlignToTextAlignVerticalMap = {\n auto: 'auto',\n top: 'top',\n bottom: 'bottom',\n middle: 'center',\n};\n","// This is a dummy file to ensure that nothing breaks when using the runtime in a web environment.\n\nimport { TextProps, TextStyle } from 'react-native';\nimport { GenericStyleProp } from './types';\n\nexport const processTextStyle = (style: GenericStyleProp<TextStyle>) => ({ style }) as Partial<TextProps>;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function processAccessibilityProps(props: Record<string, any>): Record<string, any> {\n return props;\n}\n\nexport * from './types';\nexport * from './utils/constants';\n\n// On Web, the native components are not available, so we use the standard components that'll be replaced by their DOM\n// equivalents by react-native-web.\n/* eslint-disable @typescript-eslint/no-require-imports,unicorn/prefer-module */\nexport const NativeText = require('react-native').Text;\nexport const NativeView = require('react-native').View;\n/* eslint-enable @typescript-eslint/no-require-imports,unicorn/prefer-module */\n"],"names":[],"mappings":";;AACO,MAAM,yBAA4B,GAAA;AAAA,EACvC,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,IAAA;AAAA,EACN,IAAM,EAAA,KAAA;AAAA,EACN,OAAS,EAAA,IAAA;AAAA,EACT,GAAK,EAAA;AACP;AAGO,MAAM,mCAAsC,GAAA;AAAA,EACjD,IAAM,EAAA,MAAA;AAAA,EACN,GAAK,EAAA,KAAA;AAAA,EACL,MAAQ,EAAA,QAAA;AAAA,EACR,MAAQ,EAAA;AACV;;ACVO,MAAM,gBAAmB,GAAA,CAAC,KAAwC,MAAA,EAAE,KAAM,EAAA;AAG1E,SAAS,0BAA0B,KAAiD,EAAA;AACzF,EAAO,OAAA,KAAA;AACT;AAQa,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAc,CAAE,CAAA;AACrC,MAAA,UAAA,GAAa,OAAQ,CAAA,cAAc,CAAE,CAAA;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -174,9 +174,9 @@ function processProps(
|
|
|
174
174
|
// Set up the accessibility import
|
|
175
175
|
const normalizeIdentifier = addFileImportHint({
|
|
176
176
|
file,
|
|
177
|
-
nameHint: '
|
|
177
|
+
nameHint: 'processAccessibilityProps',
|
|
178
178
|
path,
|
|
179
|
-
importName: '
|
|
179
|
+
importName: 'processAccessibilityProps',
|
|
180
180
|
moduleName: RUNTIME_MODULE_NAME,
|
|
181
181
|
});
|
|
182
182
|
const accessibilityObject = buildPropertiesFromAttributes(accessibilityAttributes);
|
|
@@ -185,9 +185,9 @@ function processProps(
|
|
|
185
185
|
// Set up the style import
|
|
186
186
|
const flattenIdentifier = addFileImportHint({
|
|
187
187
|
file,
|
|
188
|
-
nameHint: '
|
|
188
|
+
nameHint: 'processTextStyle',
|
|
189
189
|
path,
|
|
190
|
-
importName: '
|
|
190
|
+
importName: 'processTextStyle',
|
|
191
191
|
moduleName: RUNTIME_MODULE_NAME,
|
|
192
192
|
});
|
|
193
193
|
const flattenedStyleExpr = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);
|
|
@@ -198,9 +198,9 @@ function processProps(
|
|
|
198
198
|
// Only style attribute is present
|
|
199
199
|
const flattenIdentifier = addFileImportHint({
|
|
200
200
|
file,
|
|
201
|
-
nameHint: '
|
|
201
|
+
nameHint: 'processTextStyle',
|
|
202
202
|
path,
|
|
203
|
-
importName: '
|
|
203
|
+
importName: 'processTextStyle',
|
|
204
204
|
moduleName: RUNTIME_MODULE_NAME,
|
|
205
205
|
});
|
|
206
206
|
const flattened = t.callExpression(t.identifier(flattenIdentifier.name), [styleExpr]);
|
|
@@ -209,9 +209,9 @@ function processProps(
|
|
|
209
209
|
// Only accessibility properties are present
|
|
210
210
|
const normalizeIdentifier = addFileImportHint({
|
|
211
211
|
file,
|
|
212
|
-
nameHint: '
|
|
212
|
+
nameHint: 'processAccessibilityProps',
|
|
213
213
|
path,
|
|
214
|
-
importName: '
|
|
214
|
+
importName: 'processAccessibilityProps',
|
|
215
215
|
moduleName: RUNTIME_MODULE_NAME,
|
|
216
216
|
});
|
|
217
217
|
const propsObject = buildPropertiesFromAttributes(originalAttributes);
|
|
@@ -42,12 +42,12 @@ export type HubFile = t.File & {
|
|
|
42
42
|
*/
|
|
43
43
|
export interface FileImportOptions {
|
|
44
44
|
file: HubFile;
|
|
45
|
-
/** The name hint which also acts as the cache key to ensure the import is only added once (e.g. '
|
|
45
|
+
/** The name hint which also acts as the cache key to ensure the import is only added once (e.g. 'processAccessibilityProps') */
|
|
46
46
|
nameHint: string;
|
|
47
47
|
/** The current Babel NodePath */
|
|
48
48
|
path: NodePath;
|
|
49
49
|
/**
|
|
50
|
-
* The named import string (e.g. '
|
|
50
|
+
* The named import string (e.g. 'processAccessibilityProps'). Ignored if importType is "default".
|
|
51
51
|
*/
|
|
52
52
|
importName: string;
|
|
53
53
|
/** The module to import from (e.g. 'react-native-boost/runtime') */
|
|
@@ -8,9 +8,9 @@ import { RUNTIME_MODULE_NAME } from '../constants';
|
|
|
8
8
|
*
|
|
9
9
|
* @param opts - Object containing the function arguments:
|
|
10
10
|
* - file: The Babel file object (e.g. HubFile)
|
|
11
|
-
* - nameHint: The name hint which also acts as the cache key to ensure the import is only added once (e.g. '
|
|
11
|
+
* - nameHint: The name hint which also acts as the cache key to ensure the import is only added once (e.g. 'processAccessibilityProps')
|
|
12
12
|
* - path: The current Babel NodePath
|
|
13
|
-
* - importName: The named import string (e.g. '
|
|
13
|
+
* - importName: The named import string (e.g. 'processAccessibilityProps'), used when importType is 'named'
|
|
14
14
|
* - moduleName: The module to import from (e.g. 'react-native-boost/runtime')
|
|
15
15
|
* - importType: Either 'named' (default) or 'default' to determine the type of import to use.
|
|
16
16
|
*
|
package/src/runtime/index.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { TextStyle } from 'react-native';
|
|
1
|
+
import { TextProps, TextStyle } from 'react-native';
|
|
2
2
|
import flattenStyle from 'react-native/Libraries/StyleSheet/flattenStyle';
|
|
3
3
|
import { GenericStyleProp } from './types';
|
|
4
|
+
import { userSelectToSelectableMap, verticalAlignToTextAlignVerticalMap } from './utils/constants';
|
|
4
5
|
|
|
5
6
|
const propsCache = new WeakMap();
|
|
6
7
|
|
|
7
|
-
export function
|
|
8
|
+
export function processTextStyle(style: GenericStyleProp<TextStyle>): Partial<TextProps> {
|
|
8
9
|
if (!style) return {};
|
|
9
10
|
|
|
10
11
|
// Cache the computed props
|
|
@@ -38,31 +39,8 @@ export function flattenTextStyle(style: GenericStyleProp<TextStyle>) {
|
|
|
38
39
|
return props;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
// Maps the `userSelect` prop to the native `selectable` prop
|
|
42
|
-
export const userSelectToSelectableMap = {
|
|
43
|
-
auto: true,
|
|
44
|
-
text: true,
|
|
45
|
-
none: false,
|
|
46
|
-
contain: true,
|
|
47
|
-
all: true,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
// Maps the `verticalAlign` prop to the native `textAlignVertical` prop
|
|
51
|
-
export const verticalAlignToTextAlignVerticalMap = {
|
|
52
|
-
auto: 'auto',
|
|
53
|
-
top: 'top',
|
|
54
|
-
bottom: 'bottom',
|
|
55
|
-
middle: 'center',
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Normalizes accessibility props.
|
|
60
|
-
*
|
|
61
|
-
* @param props - The props to normalize.
|
|
62
|
-
* @returns The normalized props.
|
|
63
|
-
*/
|
|
64
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
65
|
-
export function
|
|
43
|
+
export function processAccessibilityProps(props: Record<string, any>): Record<string, any> {
|
|
66
44
|
const {
|
|
67
45
|
accessibilityLabel,
|
|
68
46
|
['aria-label']: ariaLabel,
|
|
@@ -112,5 +90,6 @@ export function normalizeAccessibilityProperties(props: Record<string, any>): Re
|
|
|
112
90
|
}
|
|
113
91
|
|
|
114
92
|
export * from './types';
|
|
93
|
+
export * from './utils/constants';
|
|
115
94
|
export * from './components/native-text';
|
|
116
95
|
export * from './components/native-view';
|
package/src/runtime/index.web.ts
CHANGED
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
// This is a dummy file to ensure that nothing breaks when using the runtime in a web environment.
|
|
2
2
|
|
|
3
|
-
import { TextStyle } from 'react-native';
|
|
3
|
+
import { TextProps, TextStyle } from 'react-native';
|
|
4
4
|
import { GenericStyleProp } from './types';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
if (!style) return {};
|
|
6
|
+
export const processTextStyle = (style: GenericStyleProp<TextStyle>) => ({ style }) as Partial<TextProps>;
|
|
8
7
|
|
|
9
|
-
return { style };
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Maps the `userSelect` prop to the native `selectable` prop
|
|
13
|
-
export const userSelectToSelectableMap = {
|
|
14
|
-
auto: true,
|
|
15
|
-
text: true,
|
|
16
|
-
none: false,
|
|
17
|
-
contain: true,
|
|
18
|
-
all: true,
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Maps the `verticalAlign` prop to the native `textAlignVertical` prop
|
|
22
|
-
export const verticalAlignToTextAlignVerticalMap = {
|
|
23
|
-
auto: 'auto',
|
|
24
|
-
top: 'top',
|
|
25
|
-
bottom: 'bottom',
|
|
26
|
-
middle: 'center',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Normalizes accessibility props.
|
|
31
|
-
*
|
|
32
|
-
* @param props - The props to normalize.
|
|
33
|
-
* @returns The normalized props.
|
|
34
|
-
*/
|
|
35
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
-
export function
|
|
9
|
+
export function processAccessibilityProps(props: Record<string, any>): Record<string, any> {
|
|
37
10
|
return props;
|
|
38
11
|
}
|
|
39
12
|
|
|
40
13
|
export * from './types';
|
|
14
|
+
export * from './utils/constants';
|
|
41
15
|
|
|
42
16
|
// On Web, the native components are not available, so we use the standard components that'll be replaced by their DOM
|
|
43
17
|
// equivalents by react-native-web.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Maps the `userSelect` prop to the native `selectable` prop
|
|
2
|
+
export const userSelectToSelectableMap = {
|
|
3
|
+
auto: true,
|
|
4
|
+
text: true,
|
|
5
|
+
none: false,
|
|
6
|
+
contain: true,
|
|
7
|
+
all: true,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// Maps the `verticalAlign` prop to the native `textAlignVertical` prop
|
|
11
|
+
export const verticalAlignToTextAlignVerticalMap = {
|
|
12
|
+
auto: 'auto',
|
|
13
|
+
top: 'top',
|
|
14
|
+
bottom: 'bottom',
|
|
15
|
+
middle: 'center',
|
|
16
|
+
};
|