profoundjs 5.7.0 → 5.7.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.
@@ -15,7 +15,7 @@
15
15
  "node": ">=10"
16
16
  },
17
17
  "dependencies": {
18
- "profoundjs": "^5.7.0"
18
+ "profoundjs": "^5.7.1"
19
19
  },
20
20
  "scripts": {
21
21
  "start": "node start.js"
Binary file
package/setup/setup.js CHANGED
@@ -586,7 +586,7 @@ function createConfig(profounduiLibrary, connectorLibrary, connectorIASP, callba
586
586
  // Update config.js if we made any chanegs
587
587
  if (isConfigChanged) {
588
588
 
589
- fs.writeFile(deployDir + dirSep + "config.js", "\nmodule.exports = " + JSON.stringify(config, null, " ") + "\n", (err) => {
589
+ fs.writeFile(deployDir + dirSep + "config.js", stringifyConfig(config), (err) => {
590
590
  if (err)
591
591
  console.log('An error occurred updating config.js file : ' + err);
592
592
  else
@@ -886,6 +886,35 @@ function askServerInstance(callback) {
886
886
  });
887
887
  }
888
888
 
889
+
890
+ function stringifyConfig(config) {
891
+
892
+ // JavaScript functions (like connectorIPFilter) will be lost when doing JSON.stringify,
893
+ // so we need to do some magic to preserve them.
894
+
895
+ let funkz = [];
896
+ let configString = "\nmodule.exports = ";
897
+
898
+ configString += JSON.stringify(config, (key, val) => {
899
+ if (typeof val === 'function') {
900
+ let n = funkz.length;
901
+ funkz.push(val.toString());
902
+ return `___function${n}___`;
903
+ }
904
+ return val;
905
+ }, " ");
906
+
907
+ configString += "\n";
908
+
909
+ for (var i=0; i<funkz.length; i++) {
910
+ configString = configString.replace(`"___function${i}___"`, funkz[i]);
911
+ }
912
+
913
+ return configString;
914
+
915
+ }
916
+
917
+
889
918
  if (["win32", "darwin", "linux"].includes(os.platform()))
890
919
  installNodeGit();
891
920
  createPackageFile();