diff --git a/README.md b/README.md index ffd38cd..540c80d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,22 @@ npm install --save react-native-tcp react-native link react-native-tcp ``` -***Step 3 Profit*** +## Additional dependencies + +### Due to limitations in the react-native packager, streams need to be hacked in with [rn-nodeify](https://www.npmjs.com/package/rn-nodeify) + +1. install rn-nodeify as a dev-dependency +``` +npm install --save-dev rn-nodeify +``` +2. run rn-nodeify manually +``` +rn-nodeify --install stream,process,util --hack +``` +3. optionally you can add this as a postinstall script +``` +"postinstall": "rn-nodeify --install stream,process,util --hack" +``` ## Usage @@ -59,14 +74,6 @@ client.on('data', function(data) { }); ``` -### Note - -If you want to send and receive node Buffer objects, you'll have to "npm install buffer" and set it as a global for TcpSockets to pick it up: - -```js -global.Buffer = global.Buffer || require('buffer').Buffer -``` - ### TODO add select tests from node's tests for net diff --git a/examples/rctsockets/.flowconfig b/examples/rctsockets/.flowconfig index f565799..5c5a16d 100644 --- a/examples/rctsockets/.flowconfig +++ b/examples/rctsockets/.flowconfig @@ -17,6 +17,7 @@ # Ignore unexpected extra @providesModule .*/node_modules/commoner/test/source/widget/share.js +.*/node_modules/.*/node_modules/fbjs/.* # Ignore duplicate module providers # For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root @@ -48,11 +49,11 @@ suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-2]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-2]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-3]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-3]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy unsafe.enable_getters_and_setters=true [version] -^0.32.0 +^0.33.0 diff --git a/examples/rctsockets/.gitignore b/examples/rctsockets/.gitignore index eb1535e..73359e1 100644 --- a/examples/rctsockets/.gitignore +++ b/examples/rctsockets/.gitignore @@ -38,4 +38,4 @@ npm-debug.log buck-out/ \.buckd/ android/app/libs -android/keystores/debug.keystore +*.keystore diff --git a/examples/rctsockets/android/app/build.gradle b/examples/rctsockets/android/app/build.gradle index 70815e9..293f3ab 100644 --- a/examples/rctsockets/android/app/build.gradle +++ b/examples/rctsockets/android/app/build.gradle @@ -135,6 +135,6 @@ dependencies { // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' + from configurations.compile + into 'libs' } diff --git a/examples/rctsockets/android/app/src/main/java/com/rctsockets/MainApplication.java b/examples/rctsockets/android/app/src/main/java/com/rctsockets/MainApplication.java index e511e92..31344b8 100644 --- a/examples/rctsockets/android/app/src/main/java/com/rctsockets/MainApplication.java +++ b/examples/rctsockets/android/app/src/main/java/com/rctsockets/MainApplication.java @@ -9,6 +9,7 @@ import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; +import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; @@ -25,13 +26,19 @@ public class MainApplication extends Application implements ReactApplication { protected List getPackages() { return Arrays.asList( new MainReactPackage(), - new TcpSocketsModule() + new TcpSocketsModule() ); } }; @Override public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; + return mReactNativeHost; + } + + @Override + public void onCreate() { + super.onCreate(); + SoLoader.init(this, /* native exopackage */ false); } } diff --git a/examples/rctsockets/index.android.js b/examples/rctsockets/index.android.js index 3b32771..5196006 100644 --- a/examples/rctsockets/index.android.js +++ b/examples/rctsockets/index.android.js @@ -3,6 +3,7 @@ * https://github.com/facebook/react-native * @flow */ +import './shim'; import React, { Component } from 'react'; import { diff --git a/examples/rctsockets/index.ios.js b/examples/rctsockets/index.ios.js index d688f8b..8e3fccb 100644 --- a/examples/rctsockets/index.ios.js +++ b/examples/rctsockets/index.ios.js @@ -3,6 +3,7 @@ * https://github.com/facebook/react-native * @flow */ +import './shim'; import React, { Component } from 'react'; import { diff --git a/examples/rctsockets/ios/rctsockets.xcodeproj/project.pbxproj b/examples/rctsockets/ios/rctsockets.xcodeproj/project.pbxproj index 6e2f2a2..472f6e6 100644 --- a/examples/rctsockets/ios/rctsockets.xcodeproj/project.pbxproj +++ b/examples/rctsockets/ios/rctsockets.xcodeproj/project.pbxproj @@ -22,8 +22,8 @@ 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; + 38C3F544637943F2A70A8910 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 767A2E82AB414DB2959EF685 /* libTcpSockets.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; - CF1C98E577754DD8AFFCB590 /* libTcpSockets.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 64A7F078FFB14A09981B4BBF /* libTcpSockets.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -104,9 +104,58 @@ remoteGlobalIDString = 58B5119B1A9E6C1200147676; remoteInfo = RCTText; }; - 961BE88A1DBEC99E007758FB /* PBXContainerItemProxy */ = { + 963394341DF0B9340040F547 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = 2D0C8116D9644B818C1B8ECB /* TcpSockets.xcodeproj */; + containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; + remoteInfo = "RCTImage-tvOS"; + }; + 963394381DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A28471D9B043800D4039D; + remoteInfo = "RCTLinking-tvOS"; + }; + 9633943C1DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A28541D9B044C00D4039D; + remoteInfo = "RCTNetwork-tvOS"; + }; + 963394401DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A28611D9B046600D4039D; + remoteInfo = "RCTSettings-tvOS"; + }; + 963394441DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A287B1D9B048500D4039D; + remoteInfo = "RCTText-tvOS"; + }; + 963394491DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A28881D9B049200D4039D; + remoteInfo = "RCTWebSocket-tvOS"; + }; + 9633944D1DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 2D2A28131D9B038B00D4039D; + remoteInfo = "React-tvOS"; + }; + 963394501DF0B9340040F547 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9EEBD8DA2B8E477D9ECD815E /* TcpSockets.xcodeproj */; proxyType = 2; remoteGlobalIDString = 134814201AA4EA6300B7C361; remoteInfo = TcpSockets; @@ -133,10 +182,10 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RctSockets/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RctSockets/main.m; sourceTree = ""; }; 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 2D0C8116D9644B818C1B8ECB /* TcpSockets.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = TcpSockets.xcodeproj; path = "../node_modules/react-native-tcp/ios/TcpSockets.xcodeproj"; sourceTree = ""; }; - 64A7F078FFB14A09981B4BBF /* libTcpSockets.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libTcpSockets.a; sourceTree = ""; }; + 767A2E82AB414DB2959EF685 /* libTcpSockets.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libTcpSockets.a; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; + 9EEBD8DA2B8E477D9ECD815E /* TcpSockets.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = TcpSockets.xcodeproj; path = "../node_modules/react-native-tcp/ios/TcpSockets.xcodeproj"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -162,7 +211,7 @@ 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - CF1C98E577754DD8AFFCB590 /* libTcpSockets.a in Frameworks */, + 38C3F544637943F2A70A8910 /* libTcpSockets.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -189,6 +238,7 @@ isa = PBXGroup; children = ( 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, + 963394351DF0B9340040F547 /* libRCTImage-tvOS.a */, ); name = Products; sourceTree = ""; @@ -197,6 +247,7 @@ isa = PBXGroup; children = ( 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, + 9633943D1DF0B9340040F547 /* libRCTNetwork-tvOS.a */, ); name = Products; sourceTree = ""; @@ -230,6 +281,7 @@ isa = PBXGroup; children = ( 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, + 963394411DF0B9340040F547 /* libRCTSettings-tvOS.a */, ); name = Products; sourceTree = ""; @@ -238,6 +290,7 @@ isa = PBXGroup; children = ( 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, + 9633944A1DF0B9340040F547 /* libRCTWebSocket-tvOS.a */, ); name = Products; sourceTree = ""; @@ -260,6 +313,7 @@ isa = PBXGroup; children = ( 146834041AC3E56700842450 /* libReact.a */, + 9633944E1DF0B9340040F547 /* libReact-tvOS.a */, ); name = Products; sourceTree = ""; @@ -268,6 +322,7 @@ isa = PBXGroup; children = ( 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, + 963394391DF0B9340040F547 /* libRCTLinking-tvOS.a */, ); name = Products; sourceTree = ""; @@ -285,7 +340,7 @@ 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - 2D0C8116D9644B818C1B8ECB /* TcpSockets.xcodeproj */, + 9EEBD8DA2B8E477D9ECD815E /* TcpSockets.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -294,6 +349,7 @@ isa = PBXGroup; children = ( 832341B51AAA6A8300B99B32 /* libRCTText.a */, + 963394451DF0B9340040F547 /* libRCTText-tvOS.a */, ); name = Products; sourceTree = ""; @@ -319,10 +375,10 @@ name = Products; sourceTree = ""; }; - 961BE87D1DBEC99D007758FB /* Products */ = { + 9633942E1DF0B9340040F547 /* Products */ = { isa = PBXGroup; children = ( - 961BE88B1DBEC99E007758FB /* libTcpSockets.a */, + 963394511DF0B9340040F547 /* libTcpSockets.a */, ); name = Products; sourceTree = ""; @@ -434,8 +490,8 @@ ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; }, { - ProductGroup = 961BE87D1DBEC99D007758FB /* Products */; - ProjectRef = 2D0C8116D9644B818C1B8ECB /* TcpSockets.xcodeproj */; + ProductGroup = 9633942E1DF0B9340040F547 /* Products */; + ProjectRef = 9EEBD8DA2B8E477D9ECD815E /* TcpSockets.xcodeproj */; }, ); projectRoot = ""; @@ -517,11 +573,60 @@ remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - 961BE88B1DBEC99E007758FB /* libTcpSockets.a */ = { + 963394351DF0B9340040F547 /* libRCTImage-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTImage-tvOS.a"; + remoteRef = 963394341DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 963394391DF0B9340040F547 /* libRCTLinking-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTLinking-tvOS.a"; + remoteRef = 963394381DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9633943D1DF0B9340040F547 /* libRCTNetwork-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTNetwork-tvOS.a"; + remoteRef = 9633943C1DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 963394411DF0B9340040F547 /* libRCTSettings-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTSettings-tvOS.a"; + remoteRef = 963394401DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 963394451DF0B9340040F547 /* libRCTText-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTText-tvOS.a"; + remoteRef = 963394441DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9633944A1DF0B9340040F547 /* libRCTWebSocket-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libRCTWebSocket-tvOS.a"; + remoteRef = 963394491DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9633944E1DF0B9340040F547 /* libReact-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libReact-tvOS.a"; + remoteRef = 9633944D1DF0B9340040F547 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 963394511DF0B9340040F547 /* libTcpSockets.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; path = libTcpSockets.a; - remoteRef = 961BE88A1DBEC99E007758FB /* PBXContainerItemProxy */; + remoteRef = 963394501DF0B9340040F547 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ diff --git a/examples/rctsockets/ios/rctsockets.xcodeproj/xcshareddata/xcschemes/rctsockets.xcscheme b/examples/rctsockets/ios/rctsockets.xcodeproj/xcshareddata/xcschemes/rctsockets.xcscheme index 6c6d170..0cdc154 100644 --- a/examples/rctsockets/ios/rctsockets.xcodeproj/xcshareddata/xcschemes/rctsockets.xcscheme +++ b/examples/rctsockets/ios/rctsockets.xcodeproj/xcshareddata/xcschemes/rctsockets.xcscheme @@ -17,7 +17,7 @@ BlueprintIdentifier = "13B07F861A680F5B00A75B9A" BuildableName = "RctSockets.app" BlueprintName = "RctSockets" - ReferencedContainer = "container:RctSockets.xcodeproj"> + ReferencedContainer = "container:rctsockets.xcodeproj"> + ReferencedContainer = "container:rctsockets.xcodeproj"> + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -49,7 +49,7 @@ BlueprintIdentifier = "00E356ED1AD99517003FC87E" BuildableName = "RctSocketsTests.xctest" BlueprintName = "RctSocketsTests" - ReferencedContainer = "container:RctSockets.xcodeproj"> + ReferencedContainer = "container:rctsockets.xcodeproj"> @@ -59,18 +59,21 @@ BlueprintIdentifier = "13B07F861A680F5B00A75B9A" BuildableName = "RctSockets.app" BlueprintName = "RctSockets" - ReferencedContainer = "container:RctSockets.xcodeproj"> + ReferencedContainer = "container:rctsockets.xcodeproj"> + + @@ -79,17 +82,17 @@ BlueprintIdentifier = "13B07F861A680F5B00A75B9A" BuildableName = "RctSockets.app" BlueprintName = "RctSockets" - ReferencedContainer = "container:RctSockets.xcodeproj"> + ReferencedContainer = "container:rctsockets.xcodeproj"> @@ -98,7 +101,7 @@ BlueprintIdentifier = "13B07F861A680F5B00A75B9A" BuildableName = "RctSockets.app" BlueprintName = "RctSockets" - ReferencedContainer = "container:RctSockets.xcodeproj"> + ReferencedContainer = "container:rctsockets.xcodeproj"> diff --git a/examples/rctsockets/ios/rctsockets/Info.plist b/examples/rctsockets/ios/rctsockets/Info.plist index e98ebb0..2fb6a11 100644 --- a/examples/rctsockets/ios/rctsockets/Info.plist +++ b/examples/rctsockets/ios/rctsockets/Info.plist @@ -45,7 +45,7 @@ localhost - NSTemporaryExceptionAllowsInsecureHTTPLoads + NSExceptionAllowsInsecureHTTPLoads diff --git a/examples/rctsockets/package.json b/examples/rctsockets/package.json index f303373..2b76d97 100644 --- a/examples/rctsockets/package.json +++ b/examples/rctsockets/package.json @@ -3,14 +3,20 @@ "version": "1.0.0", "private": true, "scripts": { - "start": "node node_modules/react-native/local-cli/cli.js start" + "start": "node node_modules/react-native/local-cli/cli.js start", + "ios": "node node_modules/react-native/local-cli/cli.js bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ios/main.jsbundle", + "droid": "node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle", + "postinstall": "rn-nodeify --install stream,process,util --hack" }, "browser": { "net": "react-native-tcp" }, "dependencies": { "react": "^15.1.0", - "react-native": "^0.35.0", + "react-native": "^0.38.0", "react-native-tcp": "../../" + }, + "devDependencies": { + "rn-nodeify": "^7.0.1" } } diff --git a/examples/rctsockets/shim.js b/examples/rctsockets/shim.js new file mode 100644 index 0000000..ad29253 --- /dev/null +++ b/examples/rctsockets/shim.js @@ -0,0 +1,22 @@ +if (typeof __dirname === 'undefined') global.__dirname = '/' +if (typeof __filename === 'undefined') global.__filename = '' +if (typeof process === 'undefined') { + global.process = require('process') +} else { + var bProcess = require('process') + for (var p in bProcess) { + if (!(p in process)) { + process[p] = bProcess[p] + } + } +} + +process.browser = false +if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer + +// global.location = global.location || { port: 80 } +var isDev = typeof __DEV__ === 'boolean' && __DEV__ +process.env['NODE_ENV'] = isDev ? 'development' : 'production' +if (typeof localStorage !== 'undefined') { + localStorage.debug = isDev ? '*' : '' +} diff --git a/package.json b/package.json index 5374847..75685c5 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ ], "author": { "name": "Andy Prock", - "email": "aprock@gmail.com" + "email": "aprock@protonmail.com" }, "license": "MIT", "bugs": { @@ -38,7 +38,6 @@ "events": "^1.0.2", "ip-regex": "^1.0.3", "process": "^0.11.9", - "stream-browserify": "^2.0.1", "util": "^0.10.3" }, "devDependencies": {