msgpackr-extract 1.1.3 → 2.0.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/binding.gyp CHANGED
@@ -19,8 +19,7 @@
19
19
  ],
20
20
  "targets": [
21
21
  {
22
- "target_name": "msgpackr-extract",
23
- "win_delay_load_hook": "false",
22
+ "target_name": "extract",
24
23
  "sources": [
25
24
  "src/extract.cpp",
26
25
  ],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "msgpackr-extract",
3
3
  "author": "Kris Zyp",
4
- "version": "1.1.3",
4
+ "version": "2.0.0",
5
5
  "description": "Node addon for string extraction for msgpackr",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -10,17 +10,17 @@
10
10
  },
11
11
  "scripts": {
12
12
  "install": "node-gyp-build-optional-packages",
13
- "recompile": "node-gyp build",
14
- "before-publish": "prebuildify-ci download && prebuildify --target 16.14.2 && set ENABLE_V8_FUNCTIONS=false&& prebuildify --optional-packages --napi --target 16.14.2 && node set-optional-deps.cjs",
13
+ "recompile": "node-gyp rebuild",
14
+ "before-publish": "prebuildify-ci download && prebuildify --target 16.14.2 && set ENABLE_V8_FUNCTIONS=false&& prebuildify --platform-packages --napi --target 16.14.2 && node set-optional-deps.cjs",
15
15
  "prebuild": "prebuildify --target 16.14.2",
16
- "prebuild-libc": "prebuildify --tag-libc --target 16.14.2 && ENABLE_V8_FUNCTIONS=false prebuildify --optional-packages --napi --tag-libc --target 16.14.2",
17
- "publish-all": "cd prebuilds/win32-x64 && npm publish --otp %OTP% && cd ../darwin-x64 && npm publish --otp %OTP% && cd ../darwin-arm64 && npm publish --otp %OTP% && cd ../linux-x64 && npm publish --otp %OTP% && cd ../linux-arm64 && npm publish --otp %OTP% && cd ../linux-arm && npm publish --otp %OTP% && cd ../.. && npm publish --otp %OTP%",
16
+ "prebuild-libc": "prebuildify --tag-libc --target 16.14.2 && ENABLE_V8_FUNCTIONS=false prebuildify --platform-packages --napi --tag-libc --target 16.14.2",
17
+ "publish-all": "cd prebuilds/win32-x64 && npm publish --access public && cd ../darwin-x64 && npm publish --access public && cd ../darwin-arm64 && npm publish --access public && cd ../linux-x64 && npm publish --access public && cd ../linux-arm64 && npm publish --access public && cd ../linux-arm && npm publish --access public && cd ../.. && npm publish --access public",
18
18
  "test": "node ./index.js"
19
19
  },
20
20
  "main": "./index.js",
21
21
  "gypfile": true,
22
22
  "dependencies": {
23
- "node-gyp-build-optional-packages": "^4.3.1"
23
+ "node-gyp-build-optional-packages": "5.0.1"
24
24
  },
25
25
  "files": [
26
26
  "index.js",
@@ -28,12 +28,12 @@
28
28
  "/*.gyp"
29
29
  ],
30
30
  "optionalDependencies": {
31
- "msgpackr-extract-darwin-arm64": "1.1.0",
32
- "msgpackr-extract-darwin-x64": "1.1.0",
33
- "msgpackr-extract-linux-arm": "1.1.0",
34
- "msgpackr-extract-linux-arm64": "1.1.0",
35
- "msgpackr-extract-linux-x64": "1.1.0",
36
- "msgpackr-extract-win32-x64": "1.1.0"
31
+ "@msgpackr-extract/msgpackr-extract-darwin-arm64": "2.0.0",
32
+ "@msgpackr-extract/msgpackr-extract-darwin-x64": "2.0.0",
33
+ "@msgpackr-extract/msgpackr-extract-linux-arm": "2.0.0",
34
+ "@msgpackr-extract/msgpackr-extract-linux-arm64": "2.0.0",
35
+ "@msgpackr-extract/msgpackr-extract-linux-x64": "2.0.0",
36
+ "@msgpackr-extract/msgpackr-extract-win32-x64": "2.0.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "prebuildify": "kriszyp/prebuildify#optional-packages",
package/src/extract.cpp CHANGED
@@ -154,18 +154,10 @@ public:
154
154
  napi_value value;
155
155
  napi_create_string_latin1(env, (const char*) source + stringStart, lastStringEnd - stringStart, &value);
156
156
  if (writePosition == 0) {
157
- /*if (!hasTargetArray) {
158
- hasTargetArray = true;
159
- napi_create_reference(env, array, 1, &targetArray);
160
- }*/
161
157
  return value;
162
158
  }
163
159
  target[writePosition++] = value;
164
160
  } else if (writePosition == 1) {
165
- /*if (!hasTargetArray) {
166
- hasTargetArray = true;
167
- napi_create_reference(env, array, 1, &targetArray);
168
- }*/
169
161
  return target[0];
170
162
  }
171
163
  napi_value array;
@@ -174,17 +166,9 @@ public:
174
166
  memcpy(&array, &v8Array, sizeof(array));
175
167
  #else
176
168
  napi_create_array_with_length(env, writePosition, &array);
177
- /*if (hasTargetArray) {
178
- napi_get_reference_value(env, targetArray, &array);
179
- hasTargetArray = false;
180
- }*/
181
169
  for (int i = 0; i < writePosition; i++) {
182
170
  napi_set_element(env, array, i, target[i]);
183
- }/*
184
- napi_value length;
185
- napi_create_int32(env, i, &length);
186
- return length;
187
- napi_set_element(env, array, i, undefined); */
171
+ }
188
172
  #endif
189
173
  return array;
190
174
  }
@@ -280,11 +264,9 @@ napi_value extractStrings(napi_env env, napi_callback_info info) {
280
264
  return extractor->extractStrings(env, position, size, source);
281
265
  }
282
266
  #define EXPORT_NAPI_FUNCTION(name, func) { napi_property_descriptor desc = { name, 0, func, 0, 0, 0, (napi_property_attributes) (napi_writable | napi_configurable), 0 }; napi_define_properties(env, exports, 1, &desc); }
283
- napi_value Init(napi_env env, napi_value exports) {
267
+ NAPI_MODULE_INIT() {
284
268
  extractor = new Extractor(); // create our thread-local extractor
285
269
  setupTokenTable();
286
270
  EXPORT_NAPI_FUNCTION("extractStrings", extractStrings);
287
271
  return exports;
288
- }
289
-
290
- NAPI_MODULE(extractor, Init)
272
+ }