Skip to content

Commit aa094b7

Browse files
authored
fix(core): allow Parcel.js to bundle the code (#3639)
Refs swagger-api/swagger-ui#9466 (comment) Refs parcel-bundler/parcel#9473
1 parent 915d91b commit aa094b7

File tree

1 file changed

+8
-2
lines changed
  • packages/apidom-core/src/transformers

1 file changed

+8
-2
lines changed

packages/apidom-core/src/transformers/from.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ import defaultNamespaceInstance from '../namespace';
66

77
/**
88
* Transforms data to an Element from a particular namespace.
9+
*
10+
* The name of the function was originally `from`,
11+
* but it was renamed to `fromFn` to avoid issues with Parcel.js:
12+
*
13+
* - https://github.com/parcel-bundler/parcel/issues/9473
14+
* - https://github.com/swagger-api/swagger-ui/issues/9466#issuecomment-1881053410
915
*/
10-
const from = (data: any, namespace: INamespace = defaultNamespaceInstance): Element => {
16+
const fromFn = (data: any, namespace: INamespace = defaultNamespaceInstance): Element => {
1117
if (isString(data)) {
1218
// JSON serialized refract
1319
try {
@@ -24,4 +30,4 @@ const from = (data: any, namespace: INamespace = defaultNamespaceInstance): Elem
2430
return namespace.toElement(data);
2531
};
2632

27-
export default from;
33+
export default fromFn;

0 commit comments

Comments
 (0)