MCPcopy
hub / github.com/lingodotdev/lingo.dev / transformComponent

Function transformComponent

packages/compiler/src/_loader-utils.ts:89–127  ·  view source on GitHub ↗
(options: {
  code: string;
  params: any;
  resourcePath: string;
  sourceRoot: string;
})

Source from the content-addressed store, hash-verified

87 * Please migrate to @lingo.dev/compiler. See https://lingo.dev/compiler
88 */
89export function transformComponent(options: {
90 code: string;
91 params: any;
92 resourcePath: string;
93 sourceRoot: string;
94}) {
95 const { code, params, resourcePath, sourceRoot } = options;
96
97 return _.chain({
98 code,
99 params,
100 relativeFilePath: path
101 .relative(path.resolve(process.cwd(), sourceRoot), resourcePath)
102 .split(path.sep)
103 .join("/"), // Always normalize for consistent dictionaries
104 })
105 .thru(createPayload)
106 .thru(
107 composeMutations(
108 i18nDirectiveMutation,
109 jsxFragmentMutation,
110 jsxAttributeFlagMutation,
111 jsxProviderMutation,
112 jsxHtmlLangMutation,
113 jsxRootFlagMutation,
114 jsxScopeFlagMutation,
115 jsxAttributeScopesExportMutation,
116 jsxScopesExportMutation,
117 lingoJsxAttributeScopeInjectMutation,
118 lingoJsxScopeInjectMutation,
119 rscDictionaryLoaderMutation,
120 reactRouterDictionaryLoaderMutation,
121 jsxRemoveAttributesMutation,
122 clientDictionaryLoaderMutation,
123 ),
124 )
125 .thru(createOutput)
126 .value();
127}

Callers 3

transformFunction · 0.90

Calls 1

composeMutationsFunction · 0.90

Tested by

no test coverage detected