@adguard/agtree 2.0.1 → 2.0.2

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/dist/agtree.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v2.0.1 (build date: Fri, 06 Sep 2024 12:11:38 GMT)
2
+ * AGTree v2.0.2 (build date: Tue, 10 Sep 2024 15:46:27 GMT)
3
3
  * (c) 2024 Adguard Software Ltd.
4
4
  * Released under the MIT license
5
5
  * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v2.0.1 (build date: Fri, 06 Sep 2024 12:11:38 GMT)
2
+ * AGTree v2.0.2 (build date: Tue, 10 Sep 2024 15:46:27 GMT)
3
3
  * (c) 2024 Adguard Software Ltd.
4
4
  * Released under the MIT license
5
5
  * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
@@ -24173,12 +24173,14 @@ class PositionProvider {
24173
24173
  if (sourceCode[i] === LF || sourceCode[i] === FF || sourceCode[i] === CR) {
24174
24174
  currentLine += 1;
24175
24175
  this.lineStartOffsets[currentLine] = sourceCode[i] === CR && sourceCode[i + 1] === LF ? i + 2 : i + 1;
24176
- if (sourceCode[i] === CR) {
24176
+ if (sourceCode[i] === CR && sourceCode[i + 1] === LF) {
24177
24177
  // Skip the '\n' in a '\r\n' sequence
24178
24178
  i += 1;
24179
24179
  }
24180
24180
  }
24181
24181
  }
24182
+ // Handle the case where the last offset is at the end of the source code
24183
+ this.offsetToLine[sourceCode.length] = currentLine;
24182
24184
  }
24183
24185
  /**
24184
24186
  * Converts a character offset to a line and column position.
@@ -24187,7 +24189,7 @@ class PositionProvider {
24187
24189
  * @returns A Position object containing the 1-based line and column number, or null if the offset is out of range.
24188
24190
  */
24189
24191
  convertOffsetToPosition(offset) {
24190
- if (offset < 0 || offset >= this.offsetToLine.length) {
24192
+ if (offset < 0 || offset > this.offsetToLine.length - 1) {
24191
24193
  return null;
24192
24194
  }
24193
24195
  const line = this.offsetToLine[offset];
@@ -24944,7 +24946,7 @@ class RuleCategorizer {
24944
24946
  }
24945
24947
  }
24946
24948
  }
24947
- const version = "2.0.1";
24949
+ const version = "2.0.2";
24948
24950
 
24949
24951
  /**
24950
24952
  * @file AGTree version
@@ -1,5 +1,5 @@
1
1
  /*
2
- * AGTree v2.0.1 (build date: Fri, 06 Sep 2024 12:11:38 GMT)
2
+ * AGTree v2.0.2 (build date: Tue, 10 Sep 2024 15:46:27 GMT)
3
3
  * (c) 2024 Adguard Software Ltd.
4
4
  * Released under the MIT license
5
5
  * https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme
@@ -24153,12 +24153,14 @@ class PositionProvider {
24153
24153
  if (sourceCode[i] === LF || sourceCode[i] === FF || sourceCode[i] === CR) {
24154
24154
  currentLine += 1;
24155
24155
  this.lineStartOffsets[currentLine] = sourceCode[i] === CR && sourceCode[i + 1] === LF ? i + 2 : i + 1;
24156
- if (sourceCode[i] === CR) {
24156
+ if (sourceCode[i] === CR && sourceCode[i + 1] === LF) {
24157
24157
  // Skip the '\n' in a '\r\n' sequence
24158
24158
  i += 1;
24159
24159
  }
24160
24160
  }
24161
24161
  }
24162
+ // Handle the case where the last offset is at the end of the source code
24163
+ this.offsetToLine[sourceCode.length] = currentLine;
24162
24164
  }
24163
24165
  /**
24164
24166
  * Converts a character offset to a line and column position.
@@ -24167,7 +24169,7 @@ class PositionProvider {
24167
24169
  * @returns A Position object containing the 1-based line and column number, or null if the offset is out of range.
24168
24170
  */
24169
24171
  convertOffsetToPosition(offset) {
24170
- if (offset < 0 || offset >= this.offsetToLine.length) {
24172
+ if (offset < 0 || offset > this.offsetToLine.length - 1) {
24171
24173
  return null;
24172
24174
  }
24173
24175
  const line = this.offsetToLine[offset];
@@ -24924,7 +24926,7 @@ class RuleCategorizer {
24924
24926
  }
24925
24927
  }
24926
24928
  }
24927
- const version = "2.0.1";
24929
+ const version = "2.0.2";
24928
24930
 
24929
24931
  /**
24930
24932
  * @file AGTree version
package/dist/build.txt CHANGED
@@ -1 +1 @@
1
- version=2.0.1
1
+ version=2.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adguard/agtree",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Universal adblock filter list parser.",
5
5
  "keywords": [
6
6
  "adblock",
@@ -20,19 +20,15 @@
20
20
  "url": "https://github.com/AdguardTeam/tsurlfilter/issues"
21
21
  },
22
22
  "homepage": "https://github.com/AdguardTeam/tsurlfilter/tree/master/packages/agtree#readme",
23
- "main": "dist/agtree.cjs",
24
- "module": "dist/agtree.esm.js",
25
- "browser": "dist/agtree.umd.min.js",
23
+ "main": "dist/agtree.js",
24
+ "module": "dist/agtree.mjs",
26
25
  "types": "dist/agtree.d.ts",
27
26
  "exports": {
28
27
  ".": {
29
28
  "types": "./dist/agtree.d.ts",
30
- "import": "./dist/agtree.esm.js",
31
- "require": "./dist/agtree.cjs"
32
- },
33
- "./es": "./dist/agtree.esm.js",
34
- "./iife": "./dist/agtree.iife.min.js",
35
- "./umd": "./dist/agtree.umd.min.js"
29
+ "import": "./dist/agtree.mjs",
30
+ "require": "./dist/agtree.js"
31
+ }
36
32
  },
37
33
  "files": [
38
34
  "dist"
@@ -48,9 +44,8 @@
48
44
  "@rollup/plugin-commonjs": "^25.0.2",
49
45
  "@rollup/plugin-json": "^6.0.0",
50
46
  "@rollup/plugin-node-resolve": "^15.1.0",
51
- "@rollup/plugin-terser": "^0.4.3",
52
47
  "@rollup/plugin-typescript": "^11.1.2",
53
- "@swc/core": "^1.3.100",
48
+ "@swc/core": "^1.7.24",
54
49
  "@swc/helpers": "^0.5.3",
55
50
  "@swc/jest": "^0.2.29",
56
51
  "@types/benchmark": "^2.1.5",
@@ -91,7 +86,6 @@
91
86
  "rollup": "^3.25.3",
92
87
  "rollup-plugin-dts": "^5.3.0",
93
88
  "rollup-plugin-node-externals": "^6.1.1",
94
- "rollup-plugin-polyfill-node": "^0.12.0",
95
89
  "systeminformation": "^5.22.0",
96
90
  "ts-node": "^10.9.2",
97
91
  "tsx": "^4.7.3",
@@ -124,6 +118,7 @@
124
118
  "lint:md": "markdownlint .",
125
119
  "lint:ts": "eslint . --cache --ext .ts",
126
120
  "precommit": "pnpm check-types && pnpm lint && pnpm test",
127
- "test": "jest --runInBand"
121
+ "test": "jest --runInBand",
122
+ "test:smoke": "(cd test/smoke/esm && pnpm test) && (cd test/smoke/cjs && pnpm test) && (cd test/smoke/typescript && pnpm test)"
128
123
  }
129
124
  }