@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.
@@ -47,10 +47,10 @@ module.exports = cpp;
47
47
 
48
48
  var expatlib_node = expatlib_node$1.exports;
49
49
 
50
- var expatlib = /*#__PURE__*/Object.freeze(/*#__PURE__*/_mergeNamespaces({
50
+ var expatlib = /*#__PURE__*/_mergeNamespaces({
51
51
  __proto__: null,
52
52
  'default': expatlib_node
53
- }, [expatlib_node$1.exports]));
53
+ }, [expatlib_node$1.exports]);
54
54
 
55
55
  function getGlobal() {
56
56
  if (typeof self !== "undefined") {
@@ -64,12 +64,12 @@ function getGlobal() {
64
64
  }
65
65
  throw new Error("unable to locate global object");
66
66
  }
67
- var globalNS = getGlobal();
68
- var _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
67
+ const globalNS = getGlobal();
68
+ let _wasmFolder = globalNS.__hpcc_wasmFolder || undefined;
69
69
  function wasmFolder(_) {
70
70
  if (!arguments.length)
71
71
  return _wasmFolder;
72
- var retVal = _wasmFolder;
72
+ const retVal = _wasmFolder;
73
73
  _wasmFolder = _;
74
74
  return retVal;
75
75
  }
@@ -86,13 +86,13 @@ function trimStart(str, charToRemove) {
86
86
  return str;
87
87
  }
88
88
  function loadWasm(_wasmLib, wf, wasmBinary) {
89
- var wasmLib = _wasmLib.default || _wasmLib;
89
+ const wasmLib = _wasmLib.default || _wasmLib;
90
90
  // Prevent double load ---
91
91
  if (!wasmLib.__hpcc_promise) {
92
92
  wasmLib.__hpcc_promise = wasmLib({
93
- wasmBinary: wasmBinary,
94
- locateFile: function (path, prefix) {
95
- return "".concat(trimEnd(wf || wasmFolder() || prefix || ".", "/"), "/").concat(trimStart(path, "/"));
93
+ wasmBinary,
94
+ locateFile: (path, prefix) => {
95
+ return `${trimEnd(wf || wasmFolder() || prefix || ".", "/")}/${trimStart(path, "/")}`;
96
96
  }
97
97
  });
98
98
  }
@@ -100,66 +100,60 @@ function loadWasm(_wasmLib, wf, wasmBinary) {
100
100
  }
101
101
 
102
102
  // @ts-ignore
103
- var StackElement = /** @class */ (function () {
104
- function StackElement(tag, attrs) {
103
+ class StackElement {
104
+ constructor(tag, attrs) {
105
105
  this.tag = tag;
106
106
  this.attrs = attrs;
107
107
  this._content = "";
108
108
  }
109
- Object.defineProperty(StackElement.prototype, "content", {
110
- get: function () {
111
- return this._content;
112
- },
113
- enumerable: false,
114
- configurable: true
115
- });
116
- StackElement.prototype.appendContent = function (content) {
109
+ get content() {
110
+ return this._content;
111
+ }
112
+ appendContent(content) {
117
113
  this._content += content;
118
- };
119
- return StackElement;
120
- }());
121
- var StackParser = /** @class */ (function () {
122
- function StackParser() {
114
+ }
115
+ }
116
+ class StackParser {
117
+ constructor() {
123
118
  this._stack = [];
124
119
  }
125
- StackParser.prototype.parse = function (xml, wasmFolder, wasmBinary) {
120
+ parse(xml, wasmFolder, wasmBinary) {
126
121
  return parse(xml, this, wasmFolder, wasmBinary);
127
- };
128
- StackParser.prototype.top = function () {
122
+ }
123
+ top() {
129
124
  return this._stack[this._stack.length - 1];
130
- };
131
- StackParser.prototype.startElement = function (tag, attrs) {
132
- var retVal = new StackElement(tag, attrs);
125
+ }
126
+ startElement(tag, attrs) {
127
+ const retVal = new StackElement(tag, attrs);
133
128
  this._stack.push(retVal);
134
129
  return retVal;
135
- };
136
- StackParser.prototype.endElement = function (tag) {
130
+ }
131
+ endElement(tag) {
137
132
  return this._stack.pop();
138
- };
139
- StackParser.prototype.characterData = function (content) {
133
+ }
134
+ characterData(content) {
140
135
  this.top().appendContent(content);
141
- };
142
- return StackParser;
143
- }());
136
+ }
137
+ }
144
138
  function parseAttrs(attrs) {
145
- var retVal = {};
146
- var keys = attrs;
147
- var sep = "".concat(String.fromCharCode(1));
148
- var sep2 = "".concat(sep).concat(sep);
149
- keys.split(sep2).filter(function (key) { return !!key; }).forEach(function (key) {
150
- var parts = key.split(sep);
139
+ const retVal = {};
140
+ const keys = attrs;
141
+ const sep = `${String.fromCharCode(1)}`;
142
+ const sep2 = `${sep}${sep}`;
143
+ keys.split(sep2).filter((key) => !!key).forEach((key) => {
144
+ const parts = key.split(sep);
151
145
  retVal[parts[0]] = parts[1];
152
146
  });
153
147
  return retVal;
154
148
  }
155
149
  function expatVersion(wasmFolder, wasmBinary) {
156
- return loadWasm(expatlib, wasmFolder, wasmBinary).then(function (module) {
150
+ return loadWasm(expatlib, wasmFolder, wasmBinary).then(module => {
157
151
  return module.CExpat.prototype.version();
158
152
  });
159
153
  }
160
154
  function parse(xml, callback, wasmFolder, wasmBinary) {
161
- return loadWasm(expatlib, wasmFolder, wasmBinary).then(function (module) {
162
- var parser = new module.CExpatJS();
155
+ return loadWasm(expatlib, wasmFolder, wasmBinary).then(module => {
156
+ const parser = new module.CExpatJS();
163
157
  parser.startElement = function () {
164
158
  callback.startElement(this.tag(), parseAttrs(this.attrs()));
165
159
  };
@@ -170,7 +164,7 @@ function parse(xml, callback, wasmFolder, wasmBinary) {
170
164
  callback.characterData(this.content());
171
165
  };
172
166
  parser.create();
173
- var retVal = parser.parse(xml);
167
+ const retVal = parser.parse(xml);
174
168
  parser.destroy();
175
169
  module.destroy(parser);
176
170
  return retVal;