@hpcc-js/wasm 1.13.0 → 1.14.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.
@@ -38,10 +38,10 @@ module.exports = cpp;
38
38
 
39
39
  var expatlib_node = expatlib_node$1.exports;
40
40
 
41
- var expatlib = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
41
+ var expatlib = /*#__PURE__*/_mergeNamespaces({
42
42
  __proto__: null,
43
43
  'default': expatlib_node
44
- }, [expatlib_node$1.exports]));
44
+ }, [expatlib_node$1.exports]);
45
45
 
46
46
  function getGlobal() {
47
47
  if (typeof self !== "undefined") {
@@ -55,12 +55,12 @@ function getGlobal() {
55
55
  }
56
56
  throw new Error("unable to locate global object");
57
57
  }
58
- var globalNS = getGlobal();
59
- var _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
58
+ const globalNS = getGlobal();
59
+ let _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
60
60
  function wasmFolder(_) {
61
61
  if (!arguments.length)
62
62
  return _wasmFolder;
63
- var retVal = _wasmFolder;
63
+ const retVal = _wasmFolder;
64
64
  _wasmFolder = _;
65
65
  return retVal;
66
66
  }
@@ -77,13 +77,13 @@ function trimStart(str, charToRemove) {
77
77
  return str;
78
78
  }
79
79
  function loadWasm(_wasmLib, wf, wasmBinary) {
80
- var wasmLib = _wasmLib.default || _wasmLib;
80
+ const wasmLib = _wasmLib.default || _wasmLib;
81
81
  // Prevent double load ---
82
82
  if (!wasmLib.__hpcc_promise) {
83
83
  wasmLib.__hpcc_promise = wasmLib({
84
- wasmBinary: wasmBinary,
85
- locateFile: function (path, prefix) {
86
- return "".concat(trimEnd(wf || wasmFolder() || prefix || ".", "/"), "/").concat(trimStart(path, "/"));
84
+ wasmBinary,
85
+ locateFile: (path, prefix) => {
86
+ return `${trimEnd(wf || wasmFolder() || prefix || ".", "/")}/${trimStart(path, "/")}`;
87
87
  }
88
88
  });
89
89
  }
@@ -91,66 +91,60 @@ function loadWasm(_wasmLib, wf, wasmBinary) {
91
91
  }
92
92
 
93
93
  // @ts-ignore
94
- var StackElement = /** @class */ (function () {
95
- function StackElement(tag, attrs) {
94
+ class StackElement {
95
+ constructor(tag, attrs) {
96
96
  this.tag = tag;
97
97
  this.attrs = attrs;
98
98
  this._content = "";
99
99
  }
100
- Object.defineProperty(StackElement.prototype, "content", {
101
- get: function () {
102
- return this._content;
103
- },
104
- enumerable: false,
105
- configurable: true
106
- });
107
- StackElement.prototype.appendContent = function (content) {
100
+ get content() {
101
+ return this._content;
102
+ }
103
+ appendContent(content) {
108
104
  this._content += content;
109
- };
110
- return StackElement;
111
- }());
112
- var StackParser = /** @class */ (function () {
113
- function StackParser() {
105
+ }
106
+ }
107
+ class StackParser {
108
+ constructor() {
114
109
  this._stack = [];
115
110
  }
116
- StackParser.prototype.parse = function (xml, wasmFolder, wasmBinary) {
111
+ parse(xml, wasmFolder, wasmBinary) {
117
112
  return parse(xml, this, wasmFolder, wasmBinary);
118
- };
119
- StackParser.prototype.top = function () {
113
+ }
114
+ top() {
120
115
  return this._stack[this._stack.length - 1];
121
- };
122
- StackParser.prototype.startElement = function (tag, attrs) {
123
- var retVal = new StackElement(tag, attrs);
116
+ }
117
+ startElement(tag, attrs) {
118
+ const retVal = new StackElement(tag, attrs);
124
119
  this._stack.push(retVal);
125
120
  return retVal;
126
- };
127
- StackParser.prototype.endElement = function (tag) {
121
+ }
122
+ endElement(tag) {
128
123
  return this._stack.pop();
129
- };
130
- StackParser.prototype.characterData = function (content) {
124
+ }
125
+ characterData(content) {
131
126
  this.top().appendContent(content);
132
- };
133
- return StackParser;
134
- }());
127
+ }
128
+ }
135
129
  function parseAttrs(attrs) {
136
- var retVal = {};
137
- var keys = attrs;
138
- var sep = "".concat(String.fromCharCode(1));
139
- var sep2 = "".concat(sep).concat(sep);
140
- keys.split(sep2).filter(function (key) { return !!key; }).forEach(function (key) {
141
- var parts = key.split(sep);
130
+ const retVal = {};
131
+ const keys = attrs;
132
+ const sep = `${String.fromCharCode(1)}`;
133
+ const sep2 = `${sep}${sep}`;
134
+ keys.split(sep2).filter((key) => !!key).forEach((key) => {
135
+ const parts = key.split(sep);
142
136
  retVal[parts[0]] = parts[1];
143
137
  });
144
138
  return retVal;
145
139
  }
146
140
  function expatVersion(wasmFolder, wasmBinary) {
147
- return loadWasm(expatlib, wasmFolder, wasmBinary).then(function (module) {
141
+ return loadWasm(expatlib, wasmFolder, wasmBinary).then(module => {
148
142
  return module.CExpat.prototype.version();
149
143
  });
150
144
  }
151
145
  function parse(xml, callback, wasmFolder, wasmBinary) {
152
- return loadWasm(expatlib, wasmFolder, wasmBinary).then(function (module) {
153
- var parser = new module.CExpatJS();
146
+ return loadWasm(expatlib, wasmFolder, wasmBinary).then(module => {
147
+ const parser = new module.CExpatJS();
154
148
  parser.startElement = function () {
155
149
  callback.startElement(this.tag(), parseAttrs(this.attrs()));
156
150
  };
@@ -161,7 +155,7 @@ function parse(xml, callback, wasmFolder, wasmBinary) {
161
155
  callback.characterData(this.content());
162
156
  };
163
157
  parser.create();
164
- var retVal = parser.parse(xml);
158
+ const retVal = parser.parse(xml);
165
159
  parser.destroy();
166
160
  module.destroy(parser);
167
161
  return retVal;