Skip to content

Commit

Permalink
fix(core): allow Parcel.js to bundle the code (#3639)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Jan 8, 2024
1 parent 915d91b commit aa094b7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/apidom-core/src/transformers/from.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ import defaultNamespaceInstance from '../namespace';

/**
* Transforms data to an Element from a particular namespace.
*
* The name of the function was originally `from`,
* but it was renamed to `fromFn` to avoid issues with Parcel.js:
*
* - https://github.com/parcel-bundler/parcel/issues/9473
* - https://github.com/swagger-api/swagger-ui/issues/9466#issuecomment-1881053410
*/
const from = (data: any, namespace: INamespace = defaultNamespaceInstance): Element => {
const fromFn = (data: any, namespace: INamespace = defaultNamespaceInstance): Element => {
if (isString(data)) {
// JSON serialized refract
try {
Expand All @@ -24,4 +30,4 @@ const from = (data: any, namespace: INamespace = defaultNamespaceInstance): Elem
return namespace.toElement(data);
};

export default from;
export default fromFn;

0 comments on commit aa094b7

Please sign in to comment.