@graphql-mesh/cross-helpers 0.1.5 → 0.1.6-alpha-737fb8ff0.0

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,11 @@
1
1
  # @graphql-mesh/cross-helpers
2
2
 
3
+ ## 0.1.6-alpha-737fb8ff0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 030e01d45: Support import.meta.env instead of process.env
8
+
3
9
  ## 0.1.5
4
10
 
5
11
  ### Patch Changes
package/browser.js CHANGED
@@ -1,7 +1,33 @@
1
1
  import path from 'path-browserify';
2
+ import { inspect } from '@graphql-tools/utils';
3
+ import { promisify } from './promisify';
2
4
 
3
5
  export const fs = {
4
6
  promises: {},
5
7
  };
6
8
 
7
9
  export { path };
10
+
11
+ const processObj =
12
+ typeof process !== 'undefined'
13
+ ? process
14
+ : {
15
+ get env() {
16
+ try {
17
+ // eslint-disable-next-line no-new-func
18
+ return new Function('return import.meta.env')();
19
+ } catch {
20
+ return {
21
+ NODE_ENV: 'production',
22
+ platform: 'linux',
23
+ };
24
+ }
25
+ },
26
+ };
27
+
28
+ export { processObj as process };
29
+
30
+ export const util = {
31
+ promisify,
32
+ inspect,
33
+ };
package/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
+ /* eslint-disable import/no-nodejs-modules */
1
2
  import fs from 'fs';
2
3
  import path from 'path';
4
+ import process from 'process';
5
+ import util from 'util';
3
6
 
4
- export { fs, path };
7
+ export { fs, path, process, util };
package/index.js CHANGED
@@ -1,2 +1,5 @@
1
+ /* eslint-disable import/no-nodejs-modules */
1
2
  module.exports.fs = require('fs');
2
3
  module.exports.path = require('path');
4
+ module.exports.process = require('process');
5
+ module.exports.util = require('util');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-mesh/cross-helpers",
3
- "version": "0.1.5",
3
+ "version": "0.1.6-alpha-737fb8ff0.0",
4
4
  "description": "Cross Platform Helpers for GraphQL Mesh",
5
5
  "author": "Arda TANRIKULU <ardatanrikulu@gmail.com>",
6
6
  "repository": {
@@ -15,6 +15,7 @@
15
15
  "react-native": "react-native.js",
16
16
  "types": "index.d.ts",
17
17
  "dependencies": {
18
+ "@graphql-tools/utils": "8.6.12",
18
19
  "react-native-fs": "2.20.0",
19
20
  "react-native-path": "0.0.5",
20
21
  "path-browserify": "1.0.1"
package/promisify.js ADDED
@@ -0,0 +1,13 @@
1
+ module.exports.promisify = function promisify(oldSchoolFn, thisContext) {
2
+ return function promisifiedFn(...args) {
3
+ return new Promise(function executor(resolve, reject) {
4
+ oldSchoolFn.call(thisContext, ...args, function cb(err, result) {
5
+ if (err) {
6
+ reject(err);
7
+ } else {
8
+ resolve(result);
9
+ }
10
+ });
11
+ });
12
+ };
13
+ };
package/react-native.js CHANGED
@@ -18,3 +18,21 @@ Promise.allSettled =
18
18
  }))
19
19
  )
20
20
  ));
21
+
22
+ module.exports.process =
23
+ typeof process !== 'undefined'
24
+ ? process
25
+ : {
26
+ env: {
27
+ NODE_ENV: 'production',
28
+ },
29
+ platform: 'linux',
30
+ };
31
+
32
+ const { promisify } = require('./promisify');
33
+ const { inspect } = require('@graphql-tools/utils');
34
+
35
+ module.exports.util = {
36
+ promisify,
37
+ inspect,
38
+ };