react-obsidian 2.31.0-alpha.1 → 2.31.0-alpha.2

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.
@@ -40,7 +40,7 @@ const isRN = (0, reactNativeAvailability_1.isReactNativeAvailable)();
40
40
  // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
41
41
  const Element = isRN ? require('react-native').View : 'div';
42
42
  const RetainContainer = (0, react_1.forwardRef)((props, ref) => (react_1.default.createElement(Element, { ref: ref, style: isRN ? undefined : { display: 'contents' } }, props.children)));
43
- const PassthroughContainer = (0, react_1.forwardRef)((props) => (react_1.default.createElement(react_1.default.Fragment, null, props.children)));
43
+ const PassthroughContainer = (0, react_1.forwardRef)((props, _ref) => (react_1.default.createElement(react_1.default.Fragment, null, props.children)));
44
44
  function useGraphContainer(graph) {
45
45
  return graph.inactiveBehavior === 'retain' ? RetainContainer : PassthroughContainer;
46
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useGraphContainer.js","sourceRoot":"","sources":["../../../../src/injectors/components/useGraphContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,oCAEC;AAlBD,+CAA6D;AAE7D,iFAA6E;AAE7E,MAAM,IAAI,GAAG,IAAA,gDAAsB,GAAE,CAAC;AACtC,iFAAiF;AACjF,MAAM,OAAO,GAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAEjE,MAAM,eAAe,GAAG,IAAA,kBAAU,EAAyB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,CACzE,8BAAC,OAAO,IAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,IAAG,KAAK,CAAC,QAAQ,CAAW,CACjG,CAAC,CAA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@@
1
- {"version":3,"file":"reactAvailability.d.ts","sourceRoot":"","sources":["../../../src/utils/reactAvailability.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAOxE"}
1
+ {"version":3,"file":"reactAvailability.d.ts","sourceRoot":"","sources":["../../../src/utils/reactAvailability.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,OAAO,CAU1C;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,GAAG,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAOxE"}
@@ -2,9 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isReactAvailable = isReactAvailable;
4
4
  exports.createReactRequiredError = createReactRequiredError;
5
- const packageAvailability_1 = require("./packageAvailability");
5
+ let cache;
6
6
  function isReactAvailable() {
7
- return (0, packageAvailability_1.isPackageAvailable)('react');
7
+ if (cache !== undefined)
8
+ return cache;
9
+ try {
10
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
11
+ require('react');
12
+ cache = true;
13
+ }
14
+ catch (_a) {
15
+ cache = false;
16
+ }
17
+ return cache;
8
18
  }
9
19
  /**
10
20
  * Creates a function that throws an error when called if React is not available.
@@ -1 +1 @@
1
- {"version":3,"file":"reactAvailability.js","sourceRoot":"","sources":["../../../src/utils/reactAvailability.ts"],"names":[],"mappings":";;AAEA,4CAEC;AAMD,4DAOC;AAjBD,+DAA2D;AAE3D,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,wCAAkB,EAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAU,WAAmB;IACnE,OAAO,SAAS,iBAAiB,CAAC,GAAG,KAAY;QAC/C,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,mCAAmC;cAC/C,yCAAyC,CAC5C,CAAC;IACJ,CAAM,CAAC;AACT,CAAC"}
1
+ {"version":3,"file":"reactAvailability.js","sourceRoot":"","sources":["../../../src/utils/reactAvailability.ts"],"names":[],"mappings":";;AAEA,4CAUC;AAMD,4DAOC;AAzBD,IAAI,KAA0B,CAAC;AAE/B,SAAgB,gBAAgB;IAC9B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,CAAC;QACH,iFAAiF;QACjF,OAAO,CAAC,OAAO,CAAC,CAAC;QACjB,KAAK,GAAG,IAAI,CAAC;IACf,CAAC;IAAC,WAAM,CAAC;QACP,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,SAAgB,wBAAwB,CAAU,WAAmB;IACnE,OAAO,SAAS,iBAAiB,CAAC,GAAG,KAAY;QAC/C,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,mCAAmC;cAC/C,yCAAyC,CAC5C,CAAC;IACJ,CAAM,CAAC;AACT,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeAvailability.d.ts","sourceRoot":"","sources":["../../../src/utils/reactNativeAvailability.ts"],"names":[],"mappings":"AAIA,wBAAgB,sBAAsB,IAAI,OAAO,CAQhD"}
1
+ {"version":3,"file":"reactNativeAvailability.d.ts","sourceRoot":"","sources":["../../../src/utils/reactNativeAvailability.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,IAAI,OAAO,CAchD"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isReactNativeAvailable = isReactNativeAvailable;
4
- const packageAvailability_1 = require("./packageAvailability");
5
4
  let cache;
6
5
  function isReactNativeAvailable() {
7
6
  if (cache !== undefined)
@@ -10,7 +9,14 @@ function isReactNativeAvailable() {
10
9
  cache = true;
11
10
  return cache;
12
11
  }
13
- cache = (0, packageAvailability_1.isPackageAvailable)('react-native');
12
+ try {
13
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
14
+ require('react-native');
15
+ cache = true;
16
+ }
17
+ catch (_a) {
18
+ cache = false;
19
+ }
14
20
  return cache;
15
21
  }
16
22
  //# sourceMappingURL=reactNativeAvailability.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactNativeAvailability.js","sourceRoot":"","sources":["../../../src/utils/reactNativeAvailability.ts"],"names":[],"mappings":";;AAIA,wDAQC;AAZD,+DAA2D;AAE3D,IAAI,KAA0B,CAAC;AAE/B,SAAgB,sBAAsB;IACpC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;QAC5E,KAAK,GAAG,IAAI,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,GAAG,IAAA,wCAAkB,EAAC,cAAc,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"reactNativeAvailability.js","sourceRoot":"","sources":["../../../src/utils/reactNativeAvailability.ts"],"names":[],"mappings":";;AAEA,wDAcC;AAhBD,IAAI,KAA0B,CAAC;AAE/B,SAAgB,sBAAsB;IACpC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,OAAO,KAAK,aAAa,EAAE,CAAC;QAC5E,KAAK,GAAG,IAAI,CAAC;QACb,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,iFAAiF;QACjF,OAAO,CAAC,cAAc,CAAC,CAAC;QACxB,KAAK,GAAG,IAAI,CAAC;IACf,CAAC;IAAC,WAAM,CAAC;QACP,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-obsidian",
3
- "version": "2.31.0-alpha.1",
3
+ "version": "2.31.0-alpha.2",
4
4
  "description": "Dependency injection framework for React and React Native applications",
5
5
  "scripts": {
6
6
  "prepack": "yarn lint && tsc --project tsconfig.prod.json",
@@ -10,7 +10,7 @@ const RetainContainer = forwardRef<any, PropsWithChildren>((props, ref) => (
10
10
  <Element ref={ref} style={isRN ? undefined : { display: 'contents' }}>{props.children}</Element>
11
11
  ));
12
12
 
13
- const PassthroughContainer = forwardRef<any, PropsWithChildren>((props) => (
13
+ const PassthroughContainer = forwardRef<any, PropsWithChildren>((props, _ref) => (
14
14
  <>{props.children}</>
15
15
  ));
16
16
 
@@ -1,7 +1,15 @@
1
- import { isPackageAvailable } from './packageAvailability';
1
+ let cache: boolean | undefined;
2
2
 
3
3
  export function isReactAvailable(): boolean {
4
- return isPackageAvailable('react');
4
+ if (cache !== undefined) return cache;
5
+ try {
6
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
7
+ require('react');
8
+ cache = true;
9
+ } catch {
10
+ cache = false;
11
+ }
12
+ return cache;
5
13
  }
6
14
 
7
15
  /**
@@ -1,5 +1,3 @@
1
- import { isPackageAvailable } from './packageAvailability';
2
-
3
1
  let cache: boolean | undefined;
4
2
 
5
3
  export function isReactNativeAvailable(): boolean {
@@ -8,6 +6,12 @@ export function isReactNativeAvailable(): boolean {
8
6
  cache = true;
9
7
  return cache;
10
8
  }
11
- cache = isPackageAvailable('react-native');
9
+ try {
10
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
11
+ require('react-native');
12
+ cache = true;
13
+ } catch {
14
+ cache = false;
15
+ }
12
16
  return cache;
13
17
  }
@@ -1,2 +0,0 @@
1
- export declare function isPackageAvailable(name: string): boolean;
2
- //# sourceMappingURL=packageAvailability.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageAvailability.d.ts","sourceRoot":"","sources":["../../../src/utils/packageAvailability.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUxD"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isPackageAvailable = isPackageAvailable;
4
- const cache = new Map();
5
- function isPackageAvailable(name) {
6
- if (cache.has(name))
7
- return cache.get(name);
8
- try {
9
- // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
10
- require(name);
11
- cache.set(name, true);
12
- }
13
- catch (_a) {
14
- cache.set(name, false);
15
- }
16
- return cache.get(name);
17
- }
18
- //# sourceMappingURL=packageAvailability.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"packageAvailability.js","sourceRoot":"","sources":["../../../src/utils/packageAvailability.ts"],"names":[],"mappings":";;AAEA,gDAUC;AAZD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEzC,SAAgB,kBAAkB,CAAC,IAAY;IAC7C,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;IAC7C,IAAI,CAAC;QACH,iFAAiF;QACjF,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxB,CAAC;IAAC,WAAM,CAAC;QACP,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC;AAC1B,CAAC"}
@@ -1,13 +0,0 @@
1
- const cache = new Map<string, boolean>();
2
-
3
- export function isPackageAvailable(name: string): boolean {
4
- if (cache.has(name)) return cache.get(name)!;
5
- try {
6
- // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
7
- require(name);
8
- cache.set(name, true);
9
- } catch {
10
- cache.set(name, false);
11
- }
12
- return cache.get(name)!;
13
- }