Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make @bonfhir/core compatible with react-native / hermes #139

Open
julienblin opened this issue Dec 14, 2023 · 10 comments
Open

Make @bonfhir/core compatible with react-native / hermes #139

julienblin opened this issue Dec 14, 2023 · 10 comments
Assignees
Labels
bug Something isn't working

Comments

@julienblin
Copy link
Contributor

Here is the list of issues spit out by hermes compilation:

./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:101783: error: Invalid regular expression: Invalid escape
...revChar=""){let match=this.rules.inline.emStrong.lDelim.exec(src);if(!match)return;if(match[3]&&prevChar.match(/[\p{L}\p{N}]/u))return;const nextChar=match[1]||match[2]||"";if(!nextChar||!prevChar||this.rules.inline.punctuation.exec(prev...
                                                                                                                  ^~~~~~~~~~~~~~~
./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:129690: error: private properties are not supported
...arkdown}postprocess(html){return html}}class Marked{defaults=_getDefaults();options=this.setOptions;parse=this.#parseMarkdown(_Lexer.lex,_Parser.parse);parseInline=this.#parseMarkdown(_Lexer.lexInline,_Parser.parseInline);Parser=_Parser;...
                                                                                                                  ^~~~~~~~~~~~~~
./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:129748: error: private properties are not supported
...ts=_getDefaults();options=this.setOptions;parse=this.#parseMarkdown(_Lexer.lex,_Parser.parse);parseInline=this.#parseMarkdown(_Lexer.lexInline,_Parser.parseInline);Parser=_Parser;parser=_Parser.parse;Renderer=_Renderer;TextRenderer=_Text...
                                                                                                                  ^~~~~~~~~~~~~~
./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:133844: error: private properties are not supported
...={...this.defaults,...opts}}));return this}setOptions(opt){this.defaults={...this.defaults,...opt};return this}#parseMarkdown(lexer,parser){return(src,options)=>{const origOpt={...options};const opt={...this.defaults,...origOpt};if(this....
                                                                                                                  ^~~~~~~~~~~~~~
./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:134200: error: private properties are not supported
...ue by an extension. The async: false option sent to parse will be ignored.")}opt.async=true}const throwError=this.#onError(!!opt.silent,!!opt.async);if(typeof src==="undefined"||src===null){return throwError(new Error("marked(): input pa...
                                                                                                                     ^~~~~~~~
./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:135121: error: private properties are not supported
...tml=parser(tokens,opt);if(opt.hooks){html=opt.hooks.postprocess(html)}return html}catch(e){return throwError(e)}}}#onError(silent,async){return e=>{e.message+="\nPlease report this to https://github.com/markedjs/marked.";if(silent){const...

It seems they all come from the marked package.
Also, this: markedjs/marked#2843

@julienblin julienblin added the bug Something isn't working label Dec 14, 2023
@julienblin julienblin self-assigned this Dec 14, 2023
@julienblin
Copy link
Contributor Author

I have explored a bit the problems.
I can definitely patch the marked library to solve these minor issues.
However, once this is solved, there are many more errors after:

packages/core/dist/r4b/cjs/index.cjs:190:24: warning: the variable "Intl" was not declared in function "formatRelativeDateTime"
  const relative = new Intl.RelativeTimeFormat(locale || undefined, {
                       ^~~~
packages/core/dist/r4b/cjs/index.cjs:361:15: warning: the variable "performance" was not declared in function "uuid"
      (typeof performance !== "undefined" &&
              ^~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:1336:28: warning: the variable "Formatter" was not declared in function "add$1"
          `Unable to add ${Formatter.default.format(
                           ^~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:4211:18: warning: the variable "crypto" was not declared in function "config"
          typeof crypto != "undefined" &&
                 ^~~~~~
packages/core/dist/r4b/cjs/index.cjs:10454:14: warning: the variable "BundleNavigator" was not declared in function "bundleNavigator"
  return new BundleNavigator(bundle, customResourceClass);
             ^~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:10820:18: error: Invalid expression encountered
  const result = class {
                 ^~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11124:16: warning: the variable "FhirJSONPatchBuilder" was not declared in function "fhirJSONPatch"
    return new FhirJSONPatchBuilder();
               ^~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11400:16: warning: the variable "FhirSearchBuilder" was not declared in function "fhirSearch"
    return new FhirSearchBuilder();
               ^~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11404:18: warning: the variable "AccountFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AccountFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11407:18: warning: the variable "ActivityDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ActivityDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11410:18: warning: the variable "AdministrableProductDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AdministrableProductDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11413:18: warning: the variable "AdverseEventFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AdverseEventFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11416:18: warning: the variable "AllergyIntoleranceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AllergyIntoleranceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11419:18: warning: the variable "AppointmentFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AppointmentFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11422:18: warning: the variable "AppointmentResponseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AppointmentResponseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11425:18: warning: the variable "AuditEventFhirSearchBuilder" was not declared in function "fhirSearch"
      return new AuditEventFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11428:18: warning: the variable "BasicFhirSearchBuilder" was not declared in function "fhirSearch"
      return new BasicFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11431:18: warning: the variable "BinaryFhirSearchBuilder" was not declared in function "fhirSearch"
      return new BinaryFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11434:18: warning: the variable "BiologicallyDerivedProductFhirSearchBuilder" was not declared in function "fhirSearch"
      return new BiologicallyDerivedProductFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11437:18: warning: the variable "BodyStructureFhirSearchBuilder" was not declared in function "fhirSearch"
      return new BodyStructureFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11440:18: warning: the variable "BundleFhirSearchBuilder" was not declared in function "fhirSearch"
      return new BundleFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11443:18: warning: the variable "CapabilityStatementFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CapabilityStatementFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11446:18: warning: the variable "CarePlanFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CarePlanFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11449:18: warning: the variable "CareTeamFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CareTeamFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11452:18: warning: the variable "CatalogEntryFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CatalogEntryFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11455:18: warning: the variable "ChargeItemFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ChargeItemFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11458:18: warning: the variable "ChargeItemDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ChargeItemDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11461:18: warning: the variable "CitationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CitationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11464:18: warning: the variable "ClaimFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ClaimFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11467:18: warning: the variable "ClaimResponseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ClaimResponseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11470:18: warning: the variable "ClinicalImpressionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ClinicalImpressionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11473:18: warning: the variable "ClinicalUseDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ClinicalUseDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11476:18: warning: the variable "CodeSystemFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CodeSystemFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11479:18: warning: the variable "CommunicationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CommunicationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11482:18: warning: the variable "CommunicationRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CommunicationRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11485:18: warning: the variable "CompartmentDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CompartmentDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11488:18: warning: the variable "CompositionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CompositionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11491:18: warning: the variable "ConceptMapFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ConceptMapFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11494:18: warning: the variable "ConditionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ConditionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11497:18: warning: the variable "ConsentFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ConsentFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11500:18: warning: the variable "ContractFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ContractFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11503:18: warning: the variable "CoverageFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CoverageFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11506:18: warning: the variable "CoverageEligibilityRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CoverageEligibilityRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11509:18: warning: the variable "CoverageEligibilityResponseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new CoverageEligibilityResponseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11512:18: warning: the variable "DetectedIssueFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DetectedIssueFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11515:18: warning: the variable "DeviceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DeviceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11518:18: warning: the variable "DeviceDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DeviceDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11521:18: warning: the variable "DeviceMetricFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DeviceMetricFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11524:18: warning: the variable "DeviceRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DeviceRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11527:18: warning: the variable "DeviceUseStatementFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DeviceUseStatementFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11530:18: warning: the variable "DiagnosticReportFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DiagnosticReportFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11533:18: warning: the variable "DocumentManifestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DocumentManifestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11536:18: warning: the variable "DocumentReferenceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new DocumentReferenceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11539:18: warning: the variable "EncounterFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EncounterFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11542:18: warning: the variable "EndpointFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EndpointFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11545:18: warning: the variable "EnrollmentRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EnrollmentRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11548:18: warning: the variable "EnrollmentResponseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EnrollmentResponseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11551:18: warning: the variable "EpisodeOfCareFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EpisodeOfCareFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11554:18: warning: the variable "EventDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EventDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11557:18: warning: the variable "EvidenceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EvidenceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11560:18: warning: the variable "EvidenceReportFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EvidenceReportFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11563:18: warning: the variable "EvidenceVariableFhirSearchBuilder" was not declared in function "fhirSearch"
      return new EvidenceVariableFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11566:18: warning: the variable "ExampleScenarioFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ExampleScenarioFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11569:18: warning: the variable "ExplanationOfBenefitFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ExplanationOfBenefitFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11572:18: warning: the variable "FamilyMemberHistoryFhirSearchBuilder" was not declared in function "fhirSearch"
      return new FamilyMemberHistoryFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11575:18: warning: the variable "FlagFhirSearchBuilder" was not declared in function "fhirSearch"
      return new FlagFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11578:18: warning: the variable "GoalFhirSearchBuilder" was not declared in function "fhirSearch"
      return new GoalFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11581:18: warning: the variable "GraphDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new GraphDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11584:18: warning: the variable "GroupFhirSearchBuilder" was not declared in function "fhirSearch"
      return new GroupFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11587:18: warning: the variable "GuidanceResponseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new GuidanceResponseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11590:18: warning: the variable "HealthcareServiceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new HealthcareServiceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11593:18: warning: the variable "ImagingStudyFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ImagingStudyFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11596:18: warning: the variable "ImmunizationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ImmunizationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11599:18: warning: the variable "ImmunizationEvaluationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ImmunizationEvaluationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11602:18: warning: the variable "ImmunizationRecommendationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ImmunizationRecommendationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11605:18: warning: the variable "ImplementationGuideFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ImplementationGuideFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11608:18: warning: the variable "IngredientFhirSearchBuilder" was not declared in function "fhirSearch"
      return new IngredientFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11611:18: warning: the variable "InsurancePlanFhirSearchBuilder" was not declared in function "fhirSearch"
      return new InsurancePlanFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11614:18: warning: the variable "InvoiceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new InvoiceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11617:18: warning: the variable "LibraryFhirSearchBuilder" was not declared in function "fhirSearch"
      return new LibraryFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11620:18: warning: the variable "LinkageFhirSearchBuilder" was not declared in function "fhirSearch"
      return new LinkageFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11623:18: warning: the variable "ListFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ListFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11626:18: warning: the variable "LocationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new LocationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11629:18: warning: the variable "ManufacturedItemDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ManufacturedItemDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11632:18: warning: the variable "MeasureFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MeasureFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11635:18: warning: the variable "MeasureReportFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MeasureReportFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11638:18: warning: the variable "MediaFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MediaFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11641:18: warning: the variable "MedicationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11644:18: warning: the variable "MedicationAdministrationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicationAdministrationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11647:18: warning: the variable "MedicationDispenseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicationDispenseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11650:18: warning: the variable "MedicationKnowledgeFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicationKnowledgeFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11653:18: warning: the variable "MedicationRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicationRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11656:18: warning: the variable "MedicationStatementFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicationStatementFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11659:18: warning: the variable "MedicinalProductDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MedicinalProductDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11662:18: warning: the variable "MessageDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MessageDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11665:18: warning: the variable "MessageHeaderFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MessageHeaderFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11668:18: warning: the variable "MolecularSequenceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new MolecularSequenceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11671:18: warning: the variable "NamingSystemFhirSearchBuilder" was not declared in function "fhirSearch"
      return new NamingSystemFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11674:18: warning: the variable "NutritionOrderFhirSearchBuilder" was not declared in function "fhirSearch"
      return new NutritionOrderFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11677:18: warning: the variable "NutritionProductFhirSearchBuilder" was not declared in function "fhirSearch"
      return new NutritionProductFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11680:18: warning: the variable "ObservationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ObservationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11683:18: warning: the variable "ObservationDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ObservationDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11686:18: warning: the variable "OperationDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new OperationDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11689:18: warning: the variable "OperationOutcomeFhirSearchBuilder" was not declared in function "fhirSearch"
      return new OperationOutcomeFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11692:18: warning: the variable "OrganizationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new OrganizationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11695:18: warning: the variable "OrganizationAffiliationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new OrganizationAffiliationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11698:18: warning: the variable "PackagedProductDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PackagedProductDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11701:18: warning: the variable "ParametersFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ParametersFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11704:18: warning: the variable "PatientFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PatientFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11707:18: warning: the variable "PaymentNoticeFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PaymentNoticeFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11710:18: warning: the variable "PaymentReconciliationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PaymentReconciliationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11713:18: warning: the variable "PersonFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PersonFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11716:18: warning: the variable "PlanDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PlanDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11719:18: warning: the variable "PractitionerFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PractitionerFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11722:18: warning: the variable "PractitionerRoleFhirSearchBuilder" was not declared in function "fhirSearch"
      return new PractitionerRoleFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11725:18: warning: the variable "ProcedureFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ProcedureFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11728:18: warning: the variable "ProvenanceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ProvenanceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11731:18: warning: the variable "QuestionnaireFhirSearchBuilder" was not declared in function "fhirSearch"
      return new QuestionnaireFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11734:18: warning: the variable "QuestionnaireResponseFhirSearchBuilder" was not declared in function "fhirSearch"
      return new QuestionnaireResponseFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11737:18: warning: the variable "RegulatedAuthorizationFhirSearchBuilder" was not declared in function "fhirSearch"
      return new RegulatedAuthorizationFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11740:18: warning: the variable "RelatedPersonFhirSearchBuilder" was not declared in function "fhirSearch"
      return new RelatedPersonFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11743:18: warning: the variable "RequestGroupFhirSearchBuilder" was not declared in function "fhirSearch"
      return new RequestGroupFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11746:18: warning: the variable "ResearchDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ResearchDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11749:18: warning: the variable "ResearchElementDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ResearchElementDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11752:18: warning: the variable "ResearchStudyFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ResearchStudyFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11755:18: warning: the variable "ResearchSubjectFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ResearchSubjectFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11758:18: warning: the variable "RiskAssessmentFhirSearchBuilder" was not declared in function "fhirSearch"
      return new RiskAssessmentFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11761:18: warning: the variable "ScheduleFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ScheduleFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11764:18: warning: the variable "SearchParameterFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SearchParameterFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11767:18: warning: the variable "ServiceRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ServiceRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11770:18: warning: the variable "SlotFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SlotFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11773:18: warning: the variable "SpecimenFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SpecimenFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11776:18: warning: the variable "SpecimenDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SpecimenDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11779:18: warning: the variable "StructureDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new StructureDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11782:18: warning: the variable "StructureMapFhirSearchBuilder" was not declared in function "fhirSearch"
      return new StructureMapFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11785:18: warning: the variable "SubscriptionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SubscriptionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11788:18: warning: the variable "SubscriptionStatusFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SubscriptionStatusFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11791:18: warning: the variable "SubscriptionTopicFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SubscriptionTopicFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11794:18: warning: the variable "SubstanceFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SubstanceFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11797:18: warning: the variable "SubstanceDefinitionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SubstanceDefinitionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11800:18: warning: the variable "SupplyDeliveryFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SupplyDeliveryFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11803:18: warning: the variable "SupplyRequestFhirSearchBuilder" was not declared in function "fhirSearch"
      return new SupplyRequestFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11806:18: warning: the variable "TaskFhirSearchBuilder" was not declared in function "fhirSearch"
      return new TaskFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11809:18: warning: the variable "TerminologyCapabilitiesFhirSearchBuilder" was not declared in function "fhirSearch"
      return new TerminologyCapabilitiesFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11812:18: warning: the variable "TestReportFhirSearchBuilder" was not declared in function "fhirSearch"
      return new TestReportFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11815:18: warning: the variable "TestScriptFhirSearchBuilder" was not declared in function "fhirSearch"
      return new TestScriptFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11818:18: warning: the variable "ValueSetFhirSearchBuilder" was not declared in function "fhirSearch"
      return new ValueSetFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11821:18: warning: the variable "VerificationResultFhirSearchBuilder" was not declared in function "fhirSearch"
      return new VerificationResultFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11824:18: warning: the variable "VisionPrescriptionFhirSearchBuilder" was not declared in function "fhirSearch"
      return new VisionPrescriptionFhirSearchBuilder();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:18694:27: warning: the variable "FhirClientError" was not declared in function "isFhirClientError"
  return error instanceof FhirClientError;
                          ^~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:5116:1: error: invalid statement encountered.
class _Tokenizer {
^~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:6043:1: error: invalid statement encountered.
class _Lexer {
^~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:6432:1: error: invalid statement encountered.
class _Renderer {
^~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:6544:1: error: invalid statement encountered.
class _TextRenderer {
^~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:6573:1: error: invalid statement encountered.
class _Parser {
^~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:6871:1: error: invalid statement encountered.
class _Hooks {
^~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:6891:1: error: invalid statement encountered.
class Marked {
^~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:7203:28: warning: the variable "Marked" was not declared in function "global"
const markedInstance = new Marked();
                           ^~~~~~
packages/core/dist/r4b/cjs/index.cjs:7225:17: warning: the variable "_Parser" was not declared in function "global"
marked.Parser = _Parser;
                ^~~~~~~
packages/core/dist/r4b/cjs/index.cjs:7227:19: warning: the variable "_Renderer" was not declared in function "global"
marked.Renderer = _Renderer;
                  ^~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:7228:23: warning: the variable "_TextRenderer" was not declared in function "global"
marked.TextRenderer = _TextRenderer;
                      ^~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:7229:16: warning: the variable "_Lexer" was not declared in function "global"
marked.Lexer = _Lexer;
               ^~~~~~
packages/core/dist/r4b/cjs/index.cjs:7231:20: warning: the variable "_Tokenizer" was not declared in function "global"
marked.Tokenizer = _Tokenizer;
                   ^~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:7232:16: warning: the variable "_Hooks" was not declared in function "global"
marked.Hooks = _Hooks;
               ^~~~~~
packages/core/dist/r4b/cjs/index.cjs:7528:1: error: invalid statement encountered.
class Formatter {
^~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:10456:1: error: invalid statement encountered.
class BundleNavigator {
^~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11102:1: error: invalid statement encountered.
class FhirJSONPatchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11128:1: error: invalid statement encountered.
class FhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11833:1: error: invalid statement encountered.
class ResourceFhirSearchBuilder extends FhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11885:1: error: invalid statement encountered.
class DomainResourceFhirSearchBuilder extends ResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11898:1: error: invalid statement encountered.
class AccountFhirSearchBuilder extends DomainResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:11933:1: error: invalid statement encountered.
class ActivityDefinitionFhirSearchBuilder extends DomainResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:12010:1: error: invalid statement encountered.
class AdministrableProductDefinitionFhirSearchBuilder extends DomainResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:12045:1: error: invalid statement encountered.
class AdverseEventFhirSearchBuilder extends DomainResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:12092:1: error: invalid statement encountered.
class AllergyIntoleranceFhirSearchBuilder extends DomainResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
packages/core/dist/r4b/cjs/index.cjs:12151:1: error: invalid statement encountered.
class AppointmentFhirSearchBuilder extends DomainResourceFhirSearchBuilder {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<unknown>:0: error: too many errors emitted

Proeminent problems:

We will need at least those 2 features to be implemented for this to make sense.
Closing this for now.

@opiation
Copy link
Member

Likely good news:

  • The unicode support that marked depends on for regular expressions seems to be coming very soon Hermes with the PR being actively worked on so any patches we make to marked would likely be short-lived
  • Intl support for Hermes was apparently added last year as per this comment though I think the comment since the implementation is not complete is liking including a lot of missing features. Nonetheless, it might be good to gather exactly which Intl features bonfhir packages rely on so we assemble a basic smoke test for Hermes compatibility. That might also make it easier to accept polyfills or workarounds if we're really desperate.
  • It seems ECMAScript classes are possibly now or soon-to-be supported according to this issue comment, though we'd need to validate this.

On a somewhat related side note though, it seems strange for to require class support in Hermes in an Expo app when Expo can already transpile JS. Maybe I'm missing something but is this because Expo doesn't transpile down classes or doesn't transpile dependencies?

In the meantime, I'm going to test out using bonfhir with the latest Expo / React Native to see what's actually still needed and/or still failing.

@opiation
Copy link
Member

When using the "hermes" jsEngine, I no longer get any errors reported about the use of private fields so I think the class syntax support has actually been added. We'll be certain when we actually get it fully working but still, this is promising.

I can't validate if the Intl support needed by Bonfhir has been added to Hermes because I'm still getting errors for the p{P} use in a RegExp by the marked library. I'm going to test using remarkable as a replacement for marked given that we only used marked.parse which is essentially (markdown: string) => string (HTML). I realize that Remarked is probably a little heavy but getting functional Android/iOS support might be worth it, and I might learn exactly what's left to address after the markdown formatter is compatible.

@opiation opiation assigned opiation and unassigned julienblin Apr 26, 2024
@opiation opiation reopened this Apr 26, 2024
@opiation
Copy link
Member

opiation commented Apr 26, 2024

The regular expression syntax causing the first error reported in the issue description come from marked's punctuation regular expression string '\\p{P}\\p{S}'. This isn't exactly the error reported but is typically the first error encountered on load. While the regex is initial defined as a string, the very next line in the rules.ts module immediately creates a RegExp with it which is what throws the exception running in the Hermes engine. Had the marked library created the RegExp lazily on first use, we could have offered a kind of dependency inversion in the markdown.ts formatter to allow Bonfhir users to provide their own Markdown formatter for and avoid the error.

I was however able to replace marked with remarkable in @bonfhir/core, build the library locally and copy the dist/ into an Expo project's node_modules/@bonfhir/core/dist. Remarkable does not seem to use regular expressions at all for its Markdown parsing so the library loads in the Expo app without a hitch. The existing tests for the Markdown formatter also pass using new Remarkable().render(myMarkdownValue) so that's promising. I normally wouldn't advocate for ditching a library solely on the grounds of some regular expression syntax but I think this might be worthwhile to get some basic Android support for Expo apps.

I'll dig a little deeper to confirm this is actually a viable solution. If I can get an Expo app working on my Android device and actually formatting some Bonfhir-fetched Markdown from a dummy EHR, I'll submit a PR to replace marked with remarkable and compare the bundle sizes as well for good measure.

@julienblin, any objections to such a change if this actually gets Bonfhir working on the Hermes engine?

@julienblin
Copy link
Contributor Author

@opiation - great job and investigation.

If it gets React Native Android to work, by all means make the switch!

@opiation
Copy link
Member

I can confirm getting Markdown formatting work with the following snippet on my Android device in Expo Go:

import { Formatter } from "@bonfhir/core/r4b";
import { Text } from "react-native";

const formatter = Formatter.default;
const exampleMarkdown = "# Footer\n\nThis is a footer";

export default function RootLayout() {
  return <Text>{Formatter.default.format("markdown", exampleMarkdown)}</Text>
}

image

This confirms that remarkable is a viable option for replace marked.

@opiation
Copy link
Member

I'm now facing a new issue that we could not reach before with DOMPurify.sanitize being undefined at runtime.

FWIW, I've gotten this issue before in a previous Expo project without Bonfhir. If memory serves, DOMPurify's implementation is a factory function that returns an object with a bunch of methods including sanitize that Bonfhir uses for sanitizing "html" output from the Markdown renderer. The library has a default export which calls this factory function, effectively returning an instance of their purifier. For some reason though, Metro Bundler doesn't load it correctly or something and DOMPurify.sanitize is undefined at runtime. Bonfhir is not the only library affected. There are similar reported issues (e.g.: cure53/DOMPurify#705) though I have not found an elegant way to solve this.

I'm going to try a little defensive coding by checking for a DOMPurify.sanitize function on first load and trying a few different options depending on what is revealed.

@opiation
Copy link
Member

opiation commented Apr 26, 2024

I found out why DOMPurify is not working for React Native. It's not supported 🤦. This early return when creating the DOMPurify instance is taking effect in React Native environments which is why sanitize does not exist on the object at runtime. The sanitize function gets added after that early return.

I think this makes a lot of sense because React Native doesn't support any HTML by itself. It requires using a WebView or similar tooling to turn HTML strings into React Native UI.

I'll explore some React Native solutions to rendering HTML strings. I suspect that whatever solution we find will require conditionally using DOMPurify.sanitize and/or allowing the dependency to be passed in for React Native alternatives.

@opiation
Copy link
Member

@julienblin, I propose the following for supporting React Native with @bonfhir/react's FhirValue component:

  1. Conditionally sanitize the HTML string generated from Markdown based on DOMPurify's isSupported flag.
  2. Document the conditional sanitation of the FhirValue component in JSDoc.

If someone wants to render Markdown into a React Native application, they might consider rendering Markdown directly with something like react-native-markdown-display or use react-native-webview to render the formatted HTML.

I'm assuming this a reasonable compromise to get better React Native compatibility here so I'm going to include this slight change in the PR migrating from marked to remarkable.

@opiation
Copy link
Member

So, I think #283 should address the errors reported in the issue description.

Specifically, the switch to remarkable in #283 addresses the this error by using a different library that happens to not use regular expressions in its Markdown parser. (This could be undone if/when the Hermes team addresses facebook/hermes#1027)

./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:101783: error: Invalid regular expression: Invalid escape

The Hermes team addressed this one by implementing ES classes in facebook/hermes#685.

./bonfhir-core/node_modules/@bonfhir/core/dist/r4b/cjs/index.cjs:1:129690: error: private properties are not supported

The issue title however is about @bonfhir/core being compatible with Hermes / React Native which may need to be much more thorough than just fixing those 2 errors. What do you think, @julienblin?

Hermes doesn't support import/export yet so getting the whole test suite to run in CI with Hermes would probably require running the test suite as a synchronous script, bundling it and executing it with Hermes. That feels a little hacky but it could be cool to have some packages in Bonfhir whose implementation and test suite are known to compile and execute successfully on Hermes as tested in CI 🤷.

opiation added a commit that referenced this issue May 1, 2024
Contributes to #139

This PR uses the [`remarkable`][remarkable] library to transform
Markdown into HTML instead of `marked`. While `marked` is a competent
library, it uses regular expressions to parse Markdown which include a
[syntax currently unsupported by the Hermes JS
engine](facebook/hermes#1027). In contrast,
`remarkable` does use any regular expressions to parse so it seems to
work just fine in React Native.

After switching to `remarkable`, using `<FhirValue>` in an Expo
application to display Markdown content in HTML resulted in a new error.
This turned to be a straightforward issue that the `dompurify` library
cannot sanitize an HTML string with access to the DOM. Thus, this PR
narrows HTML sanitizing to only be done when `dompurify` can do so.

## How can I test this change?

Create a new Expo app using the bonfhir template for it. Add a
`<FhirValue>` with some example Markdown content styled as HTML and
validate that the HTML shows up literally on the Android screen.

```tsx
const exampleMarkdown = "# Footer\n\nThis is a footer";

function ExampleScreen() {
  return <FhirValue
    options={{ style: "html" }}
    type="markdown"
    value={exampleMarkdown}
  />
}
```

The above should show something like:
```html
<h1>Footer</h1>
<p>This is a footer</p>
```

## Caveat

This helps make `@bonfhir/core` and `@bonfhir/react` more compatible
with React Native configured with Hermes by addressing specific issues.
Full Hermes compatibility is not confirmed yet however as testing the
complete surface of Bonfhir libraries and APIs is out of scope of this
fix. We welcome the community finding more compatibility issues however
that we can prioritize and address as needed!

[remarkable]: https://github.com/jonschlinkert/remarkable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants