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

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.
@@ -36,9 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.default = useGraphContainer;
37
37
  const react_1 = __importStar(require("react"));
38
38
  const reactNativeAvailability_1 = require("../../utils/reactNativeAvailability");
39
- const packageAvailability_1 = require("../../utils/packageAvailability");
40
39
  const isRN = (0, reactNativeAvailability_1.isReactNativeAvailable)();
41
- const Element = isRN ? (0, packageAvailability_1.dynamicRequire)('react-native').View : 'div';
40
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
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
43
  const PassthroughContainer = (0, react_1.forwardRef)((props) => (react_1.default.createElement(react_1.default.Fragment, null, props.children)));
44
44
  function useGraphContainer(graph) {
@@ -1 +1 @@
1
- {"version":3,"file":"useGraphContainer.js","sourceRoot":"","sources":["../../../../src/injectors/components/useGraphContainer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,oCAEC;AAlBD,+CAA6D;AAE7D,iFAA6E;AAC7E,yEAAiE;AAEjE,MAAM,IAAI,GAAG,IAAA,gDAAsB,GAAE,CAAC;AACtC,MAAM,OAAO,GAAQ,IAAI,CAAC,CAAC,CAAC,IAAA,oCAAc,EAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAExE,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,CA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AC,CAAC,eAAe,CAAC,CAAC,CAAC,oBAAoB,CAAC;AACtF,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export declare function isPackageAvailable(name: string): boolean;
2
- export declare function dynamicRequire(name: string): any;
3
2
  //# sourceMappingURL=packageAvailability.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageAvailability.d.ts","sourceRoot":"","sources":["../../../src/utils/packageAvailability.ts"],"names":[],"mappings":"AAkBA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASxD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAEhD"}
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,36 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isPackageAvailable = isPackageAvailable;
4
- exports.dynamicRequire = dynamicRequire;
5
4
  const cache = new Map();
6
- // Indirection makes require non-statically-analyzable so bundlers won't try to resolve the module name.
7
- // eval is wrapped in try/catch to gracefully handle strict CSP environments.
8
- function getDynamicRequireFn() {
9
- if (typeof require === 'undefined') {
10
- return undefined;
11
- }
12
- try {
13
- // eslint-disable-next-line @typescript-eslint/no-require-imports, no-eval
14
- return eval('require');
15
- }
16
- catch (_a) {
17
- return undefined;
18
- }
19
- }
20
- const dynamicRequireFn = getDynamicRequireFn();
21
5
  function isPackageAvailable(name) {
22
6
  if (cache.has(name))
23
7
  return cache.get(name);
24
8
  try {
25
- dynamicRequireFn === null || dynamicRequireFn === void 0 ? void 0 : dynamicRequireFn(name);
26
- cache.set(name, !!dynamicRequireFn);
9
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
10
+ require(name);
11
+ cache.set(name, true);
27
12
  }
28
13
  catch (_a) {
29
14
  cache.set(name, false);
30
15
  }
31
16
  return cache.get(name);
32
17
  }
33
- function dynamicRequire(name) {
34
- return dynamicRequireFn === null || dynamicRequireFn === void 0 ? void 0 : dynamicRequireFn(name);
35
- }
36
18
  //# sourceMappingURL=packageAvailability.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageAvailability.js","sourceRoot":"","sources":["../../../src/utils/packageAvailability.ts"],"names":[],"mappings":";;AAkBA,gDASC;AAED,wCAEC;AA/BD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAmB,CAAC;AAEzC,wGAAwG;AACxG,6EAA6E;AAC7E,SAAS,mBAAmB;IAC1B,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC;QACH,0EAA0E;QAC1E,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC;IACzB,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAED,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;AAE/C,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,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,IAAI,CAAC,CAAC;QACzB,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACtC,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;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAG,IAAI,CAAC,CAAC;AAClC,CAAC"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-obsidian",
3
- "version": "2.31.0-alpha.0",
3
+ "version": "2.31.0-alpha.1",
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",
@@ -1,10 +1,10 @@
1
1
  import React, { forwardRef, PropsWithChildren } from 'react';
2
2
  import { ObjectGraph } from '../../graph/ObjectGraph';
3
3
  import { isReactNativeAvailable } from '../../utils/reactNativeAvailability';
4
- import { dynamicRequire } from '../../utils/packageAvailability';
5
4
 
6
5
  const isRN = isReactNativeAvailable();
7
- const Element: any = isRN ? dynamicRequire('react-native').View : 'div';
6
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
7
+ const Element: any = isRN ? require('react-native').View : 'div';
8
8
 
9
9
  const RetainContainer = forwardRef<any, PropsWithChildren>((props, ref) => (
10
10
  <Element ref={ref} style={isRN ? undefined : { display: 'contents' }}>{props.children}</Element>
@@ -1,32 +1,13 @@
1
1
  const cache = new Map<string, boolean>();
2
2
 
3
- // Indirection makes require non-statically-analyzable so bundlers won't try to resolve the module name.
4
- // eval is wrapped in try/catch to gracefully handle strict CSP environments.
5
- function getDynamicRequireFn(): ((name: string) => any) | undefined {
6
- if (typeof require === 'undefined') {
7
- return undefined;
8
- }
9
- try {
10
- // eslint-disable-next-line @typescript-eslint/no-require-imports, no-eval
11
- return eval('require');
12
- } catch {
13
- return undefined;
14
- }
15
- }
16
-
17
- const dynamicRequireFn = getDynamicRequireFn();
18
-
19
3
  export function isPackageAvailable(name: string): boolean {
20
4
  if (cache.has(name)) return cache.get(name)!;
21
5
  try {
22
- dynamicRequireFn?.(name);
23
- cache.set(name, !!dynamicRequireFn);
6
+ // eslint-disable-next-line @typescript-eslint/no-require-imports, global-require
7
+ require(name);
8
+ cache.set(name, true);
24
9
  } catch {
25
10
  cache.set(name, false);
26
11
  }
27
12
  return cache.get(name)!;
28
13
  }
29
-
30
- export function dynamicRequire(name: string): any {
31
- return dynamicRequireFn?.(name);
32
- }