@scalar/api-reference-react 0.9.18 → 0.9.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @scalar/api-reference-react
2
2
 
3
+ ## 0.9.20
4
+
5
+ ## 0.9.19
6
+
7
+ ### Patch Changes
8
+
9
+ - [#8656](https://github.com/scalar/scalar/pull/8656): fix react wrapper production crash by defining Vue bundler flags before importing api-reference
10
+
3
11
  ## 0.9.18
4
12
 
5
13
  ## 0.9.17
@@ -1,3 +1,4 @@
1
+ import './vue-bundler-flags';
1
2
  import type { AnyApiReferenceConfiguration } from '@scalar/types/api-reference';
2
3
  import './style.css';
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ApiReferenceReact.d.ts","sourceRoot":"","sources":["../src/ApiReferenceReact.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAwB,MAAM,6BAA6B,CAAA;AAGrG,OAAO,aAAa,CAAA;AAOpB;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO;IAAE,aAAa,EAAE,4BAA4B,CAAA;CAAE,4CA4BvF,CAAA"}
1
+ {"version":3,"file":"ApiReferenceReact.d.ts","sourceRoot":"","sources":["../src/ApiReferenceReact.tsx"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,4BAA4B,EAAwB,MAAM,6BAA6B,CAAA;AAGrG,OAAO,aAAa,CAAA;AAEpB;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO;IAAE,aAAa,EAAE,4BAA4B,CAAA;CAAE,4CA4BvF,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ApiReferenceReact.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiReferenceReact.test.d.ts","sourceRoot":"","sources":["../src/ApiReferenceReact.test.ts"],"names":[],"mappings":""}
package/dist/index.js CHANGED
@@ -2,10 +2,12 @@
2
2
  import { createApiReference } from "@scalar/api-reference";
3
3
  import { useEffect, useRef, useState } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- //#region src/ApiReferenceReact.tsx
5
+ //#region src/vue-bundler-flags.ts
6
6
  globalThis.__VUE_OPTIONS_API__ = true;
7
7
  globalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = true;
8
8
  globalThis.__VUE_PROD_DEVTOOLS__ = false;
9
+ //#endregion
10
+ //#region src/ApiReferenceReact.tsx
9
11
  /**
10
12
  * React wrapper around the Scalar API Reference
11
13
  */
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/ApiReferenceReact.tsx"],"sourcesContent":["'use client'\n\nimport { createApiReference } from '@scalar/api-reference'\nimport type { AnyApiReferenceConfiguration, ApiReferenceInstance } from '@scalar/types/api-reference'\nimport { useEffect, useRef, useState } from 'react'\n\nimport './style.css'\n\n// These are required for the vue bundler version\nglobalThis.__VUE_OPTIONS_API__ = true\nglobalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = true\nglobalThis.__VUE_PROD_DEVTOOLS__ = false\n\n/**\n * React wrapper around the Scalar API Reference\n */\nexport const ApiReferenceReact = (props: { configuration: AnyApiReferenceConfiguration }) => {\n const el = useRef<HTMLDivElement | null>(null)\n\n const [reference, setReference] = useState<ApiReferenceInstance | null>(null)\n\n /** handle adding the integration to the config */\n const addIntegration = () =>\n Array.isArray(props.configuration)\n ? props.configuration.map((c) => ({ _integration: 'react' as const, ...c }))\n : { _integration: 'react' as const, ...props.configuration }\n\n useEffect(() => {\n if (!el.current) {\n return reference?.app?.unmount\n }\n\n const instance = createApiReference(el.current, addIntegration())\n setReference(instance)\n\n // Unmount on cleanup\n return instance.destroy\n }, [el])\n\n useEffect(() => {\n reference?.updateConfiguration(addIntegration())\n }, [props.configuration, reference])\n\n return <div ref={el} />\n}\n"],"mappings":";;;;;AASA,WAAW,sBAAsB;AACjC,WAAW,0CAA0C;AACrD,WAAW,wBAAwB;;;;AAKnC,IAAa,qBAAqB,UAA2D;CAC3F,MAAM,KAAK,OAA8B,KAAK;CAE9C,MAAM,CAAC,WAAW,gBAAgB,SAAsC,KAAK;;CAG7E,MAAM,uBACJ,MAAM,QAAQ,MAAM,cAAc,GAC9B,MAAM,cAAc,KAAK,OAAO;EAAE,cAAc;EAAkB,GAAG;EAAG,EAAE,GAC1E;EAAE,cAAc;EAAkB,GAAG,MAAM;EAAe;AAEhE,iBAAgB;AACd,MAAI,CAAC,GAAG,QACN,QAAO,WAAW,KAAK;EAGzB,MAAM,WAAW,mBAAmB,GAAG,SAAS,gBAAgB,CAAC;AACjE,eAAa,SAAS;AAGtB,SAAO,SAAS;IACf,CAAC,GAAG,CAAC;AAER,iBAAgB;AACd,aAAW,oBAAoB,gBAAgB,CAAC;IAC/C,CAAC,MAAM,eAAe,UAAU,CAAC;AAEpC,QAAO,oBAAC,OAAD,EAAK,KAAK,IAAM,CAAA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/vue-bundler-flags.ts","../src/ApiReferenceReact.tsx"],"sourcesContent":["// Ensure Vue ESM-bundler feature flags exist before Vue-based modules are imported.\nglobalThis.__VUE_OPTIONS_API__ = true\nglobalThis.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__ = true\nglobalThis.__VUE_PROD_DEVTOOLS__ = false\n","'use client'\n\nimport './vue-bundler-flags'\nimport { createApiReference } from '@scalar/api-reference'\nimport type { AnyApiReferenceConfiguration, ApiReferenceInstance } from '@scalar/types/api-reference'\nimport { useEffect, useRef, useState } from 'react'\n\nimport './style.css'\n\n/**\n * React wrapper around the Scalar API Reference\n */\nexport const ApiReferenceReact = (props: { configuration: AnyApiReferenceConfiguration }) => {\n const el = useRef<HTMLDivElement | null>(null)\n\n const [reference, setReference] = useState<ApiReferenceInstance | null>(null)\n\n /** handle adding the integration to the config */\n const addIntegration = () =>\n Array.isArray(props.configuration)\n ? props.configuration.map((c) => ({ _integration: 'react' as const, ...c }))\n : { _integration: 'react' as const, ...props.configuration }\n\n useEffect(() => {\n if (!el.current) {\n return reference?.app?.unmount\n }\n\n const instance = createApiReference(el.current, addIntegration())\n setReference(instance)\n\n // Unmount on cleanup\n return instance.destroy\n }, [el])\n\n useEffect(() => {\n reference?.updateConfiguration(addIntegration())\n }, [props.configuration, reference])\n\n return <div ref={el} />\n}\n"],"mappings":";;;;;AACA,WAAW,sBAAsB;AACjC,WAAW,0CAA0C;AACrD,WAAW,wBAAwB;;;;;;ACSnC,IAAa,qBAAqB,UAA2D;CAC3F,MAAM,KAAK,OAA8B,KAAK;CAE9C,MAAM,CAAC,WAAW,gBAAgB,SAAsC,KAAK;;CAG7E,MAAM,uBACJ,MAAM,QAAQ,MAAM,cAAc,GAC9B,MAAM,cAAc,KAAK,OAAO;EAAE,cAAc;EAAkB,GAAG;EAAG,EAAE,GAC1E;EAAE,cAAc;EAAkB,GAAG,MAAM;EAAe;AAEhE,iBAAgB;AACd,MAAI,CAAC,GAAG,QACN,QAAO,WAAW,KAAK;EAGzB,MAAM,WAAW,mBAAmB,GAAG,SAAS,gBAAgB,CAAC;AACjE,eAAa,SAAS;AAGtB,SAAO,SAAS;IACf,CAAC,GAAG,CAAC;AAER,iBAAgB;AACd,aAAW,oBAAoB,gBAAgB,CAAC;IAC/C,CAAC,MAAM,eAAe,UAAU,CAAC;AAEpC,QAAO,oBAAC,OAAD,EAAK,KAAK,IAAM,CAAA"}