@bildit-platform/engine 0.1.4 → 0.1.5

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.
@@ -20,7 +20,7 @@
20
20
 
21
21
  Object.defineProperty(exports, '__esModule', { value: true });
22
22
 
23
- var ReactImport = require('react');
23
+ var React = require('react');
24
24
  var jsxRuntime = require('react/jsx-runtime');
25
25
 
26
26
  /**
@@ -37,7 +37,7 @@ function createModuleWithDependencies(dependencies, moduleFactory, extraDependen
37
37
  // Collect all data exported from the remote code.
38
38
  const exports = {};
39
39
  const coreDependencies = {
40
- react: ReactImport,
40
+ react: React,
41
41
  'react/jsx-runtime': jsxRuntime,
42
42
  };
43
43
  const extraDependencies = Object.keys(extraDependenciesConfig).reduce((acc, key) => {
@@ -1,2 +1,3 @@
1
+ export type { ExtraDependencyConfig } from '../types';
1
2
  export { default as interpretModuleString } from './interpretModuleString';
2
3
  export { default as createModuleWithDependencies } from './createModuleWithDependencies';
@@ -20,7 +20,7 @@
20
20
 
21
21
  Object.defineProperty(exports, '__esModule', { value: true });
22
22
 
23
- var ReactImport = require('react');
23
+ var React = require('react');
24
24
  var createModuleWithDependencies = require('./createModuleWithDependencies.js');
25
25
 
26
26
  function _interopNamespaceDefault(e) {
@@ -40,7 +40,7 @@ function _interopNamespaceDefault(e) {
40
40
  return Object.freeze(n);
41
41
  }
42
42
 
43
- var ReactImport__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactImport);
43
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
44
44
 
45
45
  /**
46
46
  * Registers the module creator in the global scope for use by evaluated code
@@ -53,24 +53,14 @@ const registerGlobalModuleCreator = (extraDependenciesConfig = {}) => {
53
53
  const nodeJsEnvironment = typeof process !== 'undefined' &&
54
54
  process.versions != null &&
55
55
  process.versions.node != null;
56
- if (nodeJsEnvironment) {
57
- globalThis.define = define;
58
- globalThis.React = ReactImport__namespace;
56
+ if (nodeJsEnvironment || typeof window !== 'undefined') {
57
+ const globalScope = nodeJsEnvironment ? globalThis : window;
58
+ globalScope.define = define;
59
+ globalScope.React = React__namespace;
59
60
  for (const [_, value] of Object.entries(extraDependenciesConfig)) {
60
61
  const { module, globalName } = value;
61
62
  if (globalName) {
62
- globalThis[globalName] = module;
63
- }
64
- }
65
- }
66
- else {
67
- // We're in a browser or other environment
68
- window.define = define;
69
- window.React = ReactImport__namespace;
70
- for (const [_, value] of Object.entries(extraDependenciesConfig)) {
71
- const { module, globalName } = value;
72
- if (globalName) {
73
- window[globalName] = module;
63
+ globalScope[globalName] = module;
74
64
  }
75
65
  }
76
66
  }
@@ -16,7 +16,7 @@
16
16
  * DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
17
17
  * OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
18
  */
19
- import ReactImport__default from 'react';
19
+ import React__default from 'react';
20
20
  import jsxRuntime from 'react/jsx-runtime';
21
21
 
22
22
  /**
@@ -33,7 +33,7 @@ function createModuleWithDependencies(dependencies, moduleFactory, extraDependen
33
33
  // Collect all data exported from the remote code.
34
34
  const exports = {};
35
35
  const coreDependencies = {
36
- react: ReactImport__default,
36
+ react: React__default,
37
37
  'react/jsx-runtime': jsxRuntime,
38
38
  };
39
39
  const extraDependencies = Object.keys(extraDependenciesConfig).reduce((acc, key) => {
@@ -1,2 +1,3 @@
1
+ export type { ExtraDependencyConfig } from '../types';
1
2
  export { default as interpretModuleString } from './interpretModuleString';
2
3
  export { default as createModuleWithDependencies } from './createModuleWithDependencies';
@@ -16,7 +16,7 @@
16
16
  * DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
17
17
  * OUT OF, OR IN CONNECTION WITH, THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18
18
  */
19
- import * as ReactImport from 'react';
19
+ import * as React from 'react';
20
20
  import createModuleWithDependencies from './createModuleWithDependencies.js';
21
21
 
22
22
  /**
@@ -30,24 +30,14 @@ const registerGlobalModuleCreator = (extraDependenciesConfig = {}) => {
30
30
  const nodeJsEnvironment = typeof process !== 'undefined' &&
31
31
  process.versions != null &&
32
32
  process.versions.node != null;
33
- if (nodeJsEnvironment) {
34
- globalThis.define = define;
35
- globalThis.React = ReactImport;
33
+ if (nodeJsEnvironment || typeof window !== 'undefined') {
34
+ const globalScope = nodeJsEnvironment ? globalThis : window;
35
+ globalScope.define = define;
36
+ globalScope.React = React;
36
37
  for (const [_, value] of Object.entries(extraDependenciesConfig)) {
37
38
  const { module, globalName } = value;
38
39
  if (globalName) {
39
- globalThis[globalName] = module;
40
- }
41
- }
42
- }
43
- else {
44
- // We're in a browser or other environment
45
- window.define = define;
46
- window.React = ReactImport;
47
- for (const [_, value] of Object.entries(extraDependenciesConfig)) {
48
- const { module, globalName } = value;
49
- if (globalName) {
50
- window[globalName] = module;
40
+ globalScope[globalName] = module;
51
41
  }
52
42
  }
53
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bildit-platform/engine",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "BILDIT Render Engine",
5
5
  "files": [
6
6
  "dist"