@sie-js/vkp 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +5 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sie-js/vkp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Parser and utils for the .VKP files format which is used in the V-Klay.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/index.js CHANGED
@@ -59,7 +59,7 @@ function vkpParse(text, options) {
59
59
  if (pragmas.old_equal_ff && !oldData)
60
60
  oldData = Buffer.alloc(newData.length).fill(0xFF);
61
61
 
62
- if (oldData&& oldData.length < newData.length)
62
+ if (oldData && oldData.length < newData.length)
63
63
  vkp.errors.push(new VkpParseError(`Old data (${oldData.length} bytes) is less than new data (${newData.length} bytes)`, data.old.loc));
64
64
 
65
65
  if (pragmas.warn_no_old_on_apply && !oldData) {
@@ -104,13 +104,15 @@ function vkpParse(text, options) {
104
104
  }
105
105
 
106
106
  function vkpDetectContent(text) {
107
+ if (text.indexOf('{\\rtf1') >= 0)
108
+ return "RTF";
107
109
  let trimmedText = text.replace(/\/\*.*?\*\//gs, '').replace(/(\/\/|;|#).*?$/mg, '');
108
110
  if (trimmedText.match(/^\s*(0x[a-f0-9]+|[a-f0-9]+)\s*:[^\\/]/mi))
109
111
  return "PATCH";
112
+ if (text.match(/;!(к патчу прикреплён файл|There is a file attached to this patch), https?:\/\//i))
113
+ return "DOWNLOAD_STUB";
110
114
  if (!trimmedText.trim().length)
111
115
  return "EMPTY";
112
- if (text.match(/;!к патчу прикреплён файл, https?:\/\//i))
113
- return "DOWNLOAD_STUB";
114
116
  return "UNKNOWN";
115
117
  }
116
118