advanced-poe-filter-parser 0.3.0 → 0.9.1

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.
@@ -0,0 +1,178 @@
1
+ type Activity = "Show" | "Hide" | "Unset" | "Ignore"
2
+
3
+ type BranchType = "Fork" | "Mixin"
4
+
5
+ type MatchOperator = "==" | "="
6
+ type NumOperator = "<=" | ">=" | "<" | ">" | "="
7
+
8
+ type Rarity = "Normal" | "Magic" | "Rare" | "Unique"
9
+ type Influence = "Shaper" | "Elder" | "Crusader" | "Hunter" | "Redeemer" | "Warlord" | "None"
10
+ type GemQualityType = "Superior" | "Divergent" | "Anomalous" | "Phantasmal"
11
+ type SocketType = "R" | "G" | "B" | "W" | "A" | "D"
12
+
13
+ type ColorName = "Red" | "Green" | "Blue" | "Brown" | "White" | "Yellow" | "Cyan" | "Grey" | "Orange" | "Pink" | "Purple"
14
+
15
+ type MinimapIconSize = 0 | 1 | 2 | "0" | "1" | "2" | "Largest" | "Medium" | "Small"
16
+ type MinimapIconColor = ColorName
17
+ type MinimapIconShape =
18
+ | "Circle"
19
+ | "Diamond"
20
+ | "Hexagon"
21
+ | "Square"
22
+ | "Star"
23
+ | "Triangle"
24
+ | "Cross"
25
+ | "Moon"
26
+ | "Raindrop"
27
+ | "Kite"
28
+ | "Pentagon"
29
+ | "UpsideDownHouse"
30
+ type PlayEffectColor = ColorName
31
+ type SoundId =
32
+ | "1"
33
+ | "2"
34
+ | "3"
35
+ | "4"
36
+ | "5"
37
+ | "6"
38
+ | "7"
39
+ | "8"
40
+ | "9"
41
+ | "10"
42
+ | "11"
43
+ | "12"
44
+ | "13"
45
+ | "14"
46
+ | "15"
47
+ | "16"
48
+ | "Sh01"
49
+ | "Sh02"
50
+ | "Sh03"
51
+ | "Sh04"
52
+ | "Sh05"
53
+ | "Sh06"
54
+ | "Sh07"
55
+ | "Sh08"
56
+ | "Sh09"
57
+ | "Sh10"
58
+ | "Sh11"
59
+ | "Sh12"
60
+ | "Sh13"
61
+ | "Sh14"
62
+ | "Sh15"
63
+ | "Sh16"
64
+ | "ShAlchemy"
65
+ | "ShBlessed"
66
+ | "ShChaos"
67
+ | "ShDivine"
68
+ | "ShExalted"
69
+ | "ShFusing"
70
+ | "ShGeneral"
71
+ | "ShMirror"
72
+ | "ShRegal"
73
+ | "ShVaal"
74
+
75
+ type RGBA = { rgb: { r: number; g: number; b: number }; alpha: number }
76
+ type Sound = { id: SoundId; volume: number | undefined }
77
+
78
+ type AdvancedBlock = {
79
+ id: string
80
+ name: string
81
+ activity: Activity
82
+ conditions: {
83
+ Class?: { ope: MatchOperator; vals: string[] }
84
+ BaseType?: { ope: MatchOperator; vals: string[] }
85
+ Rarity?: `${MatchOperator} ${Rarity}` | Rarity
86
+ BaseDefencePercentile?: `${NumOperator} ${number}`
87
+ BaseArmour?: `${NumOperator} ${number}`
88
+ BaseEnergyShield?: `${NumOperator} ${number}`
89
+ BaseEvasion?: `${NumOperator} ${number}`
90
+ BaseWard?: `${NumOperator} ${number}`
91
+ DropLevel?: `${NumOperator} ${number}`
92
+ ItemLevel?: `${NumOperator} ${number}`
93
+ AreaLevel?: `${NumOperator} ${number}`
94
+ GemLevel?: `${NumOperator} ${number}`
95
+ GemQualityType?: { ope: MatchOperator; vals: GemQualityType[] }
96
+ StackSize?: `${NumOperator} ${number}`
97
+ MapTier?: `${NumOperator} ${number}`
98
+ Quality?: `${NumOperator} ${number}`
99
+ LinkedSockets?: `${NumOperator} ${number}`
100
+ Sockets?: `${NumOperator} ${number}`
101
+ SocketGroup?: `${NumOperator} ${string}` | string
102
+ FracturedItem?: boolean
103
+ SynthesisedItem?: boolean
104
+ Corrupted?: boolean
105
+ Mirrored?: boolean
106
+ Identified?: boolean
107
+ Scourged?: boolean
108
+ ShapedMap?: boolean
109
+ ElderMap?: boolean
110
+ BlightedMap?: boolean
111
+ UberBlightedMap?: boolean
112
+ Height?: `${NumOperator} ${number}`
113
+ Width?: `${NumOperator} ${number}`
114
+ CorruptedMods?: `${NumOperator} ${number}`
115
+ EnchantmentPassiveNum?: `${NumOperator} ${number}`
116
+ HasExplicitMod?: { ope: MatchOperator; vals: string[] }
117
+ HasImplicitMod?: boolean
118
+ HasEaterOfWorldsImplicit?: `${NumOperator} ${number}`
119
+ HasSearingExarchImplicit?: `${NumOperator} ${number}`
120
+ AnyEnchantment?: boolean
121
+ HasEnchantment?: { ope: MatchOperator; vals: string[] }
122
+ HasInfluence?: { ope: MatchOperator; vals: Influence[] }
123
+ EnchantmentPassiveNode?: { ope: MatchOperator; vals: string[] }
124
+ AlternateQuality?: boolean
125
+ Replica?: boolean
126
+ ArchnemesisMod?: { ope: MatchOperator; vals: string[] }
127
+ HasCruciblePassiveTree?: boolean
128
+ }
129
+ actions: {
130
+ SetFontSize?: number
131
+ SetTextColor?: RGBA
132
+ SetBackgroundColor?: RGBA
133
+ SetBorderColor?: RGBA
134
+ MinimapIcon?: { size: MinimapIconSize; color: MinimapIconColor; shape: MinimapIconShape }
135
+ PlayEffect?: { color: PlayEffectColor; temp: boolean }
136
+ PlayAlertSound?: Sound
137
+ PlayAlertSoundPositional?: Sound
138
+ CustomAlertSound?: {
139
+ filePath: string
140
+ volume: number | undefined
141
+ }
142
+ DisableDropSound?: boolean
143
+ EnableDropSound?: boolean
144
+ }
145
+ branches: Branch[]
146
+ location: {
147
+ start: { line: number; column: number; offset: number }
148
+ end: { line: number; column: number; offset: number }
149
+ }
150
+ }
151
+
152
+ type Branch = {
153
+ name: string
154
+ type: BranchType
155
+ blocks: AdvancedBlock[]
156
+ }
157
+
158
+ type Condition = keyof AdvancedBlock["conditions"]
159
+ type Action = keyof AdvancedBlock["actions"]
160
+
161
+ type SyntaxError = {
162
+ message: string
163
+ found?: string
164
+ location: {
165
+ start: {
166
+ offset: number
167
+ line: number
168
+ column: number
169
+ }
170
+ end: {
171
+ offset: number
172
+ line: number
173
+ column: number
174
+ }
175
+ }
176
+ }
177
+
178
+ export function parse(input: string): AdvancedBlock[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "advanced-poe-filter-parser",
3
- "version": "0.3.0",
3
+ "version": "0.9.1",
4
4
  "keywords": [
5
5
  "path-of-exile",
6
6
  "filter-of-kalandra",
@@ -8,33 +8,36 @@
8
8
  ],
9
9
  "homepage": "https://github.com/isuke/advanced-poe-filter-parser",
10
10
  "repository": "git@github.com:isuke/advanced-poe-filter-parser.git",
11
- "main": "lib/parser.mjs",
11
+ "main": "lib/parser.cjs",
12
+ "module": "lib/parser.mjs",
13
+ "types": "lib/parser.d.ts",
12
14
  "author": "isuke <isuke770@gmail.com>",
13
15
  "license": "MIT",
14
16
  "private": false,
15
17
  "type": "module",
18
+ "files": [
19
+ "lib",
20
+ "src"
21
+ ],
16
22
  "scripts": {
17
- "lint": "eslint ./*.js test/**/*.js",
18
- "fix": "eslint --fix ./*.js test/**/*.js",
23
+ "lint": "eslint test/**/*.js",
24
+ "lint:fix": "eslint --fix test/**/*.js",
25
+ "prettier": "prettier --write --log-level=warn '**/*.js'",
19
26
  "test": "ava --verbose",
20
- "build": "pegjs --format=es -o lib/parser.mjs src/advanced-poe-filter.pegjs",
27
+ "build:c": "pegjs -o lib/parser.cjs src/advanced-poe-filter.pegjs --format=commonjs",
28
+ "build:m": "pegjs -o lib/parser.mjs src/advanced-poe-filter.pegjs --format=es",
29
+ "build": "npm run --silent build:c; npm rum --silent build:m",
21
30
  "predeploy": "npm run build",
22
31
  "deploy": "npm publish"
23
32
  },
24
33
  "dependencies": {},
25
34
  "devDependencies": {
26
- "@babel/cli": "7.19.3",
27
- "@babel/core": "7.19.6",
28
- "@babel/preset-env": "7.19.4",
29
- "ava": "5.0.1",
30
- "eslint": "8.26.0",
31
- "eslint-config-prettier": "8.5.0",
32
- "eslint-plugin-prettier": "4.2.1",
35
+ "ava": "5.3.1",
36
+ "eslint": "8.48.0",
37
+ "eslint-config-prettier": "9.0.0",
33
38
  "outdent": "0.8.0",
34
39
  "pegjs": "0.11.0-master.b7b87ea",
35
- "prettier": "2.7.1",
36
- "sinon": "14.0.1",
37
- "webpack": "5.74.0",
38
- "webpack-cli": "4.10.00"
40
+ "prettier": "3.0.3",
41
+ "sinon": "15.2.0"
39
42
  }
40
43
  }
package/.eslintrc DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "env": {
3
- "es6": true,
4
- "amd": true,
5
- "node": true
6
- },
7
- "extends": [
8
- "eslint:recommended",
9
- "plugin:prettier/recommended"
10
- ],
11
- "parserOptions": {
12
- "ecmaVersion": 2017,
13
- "sourceType": "module"
14
- },
15
- "rules": {
16
- "no-console": "off",
17
- "no-control-regex": "off",
18
- "no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
19
- "prettier/prettier": [
20
- "error",
21
- {
22
- "semi": false,
23
- "singleQuote": true,
24
- "trailingComma": "es5",
25
- "printWidth": 160,
26
- "arrowParens": "always"
27
- }
28
- ]
29
- }
30
- }
package/.git_consistent DELETED
@@ -1,80 +0,0 @@
1
- type:
2
- type: enum
3
- required: true
4
- description: 'commit type'
5
- values:
6
- -
7
- name: feat
8
- description: 'when implementing function'
9
- -
10
- name: fix
11
- description: 'when fixing a bug'
12
- -
13
- name: refactor
14
- description: 'when refactoring'
15
- -
16
- name: docs
17
- description: 'when writing docs'
18
- -
19
- name: test
20
- description: 'when adding tests'
21
- -
22
- name: chore
23
- description: "when change other that don't modify code or test files"
24
- -
25
- name: remove
26
- description: 'when removing function'
27
- -
28
- name: perf
29
- description: 'when improving performance'
30
- -
31
- name: ci
32
- description: 'when fixing the CI build'
33
- -
34
- name: sec
35
- description: 'when dealing with security'
36
- -
37
- name: up
38
- description: 'when upgrading dependencies'
39
- -
40
- name: down
41
- description: 'when downgrading dependencies'
42
- -
43
- name: tada
44
- description: 'when celebrating'
45
- -
46
- name: revert
47
- description: 'when reverts a previous commit'
48
- subject:
49
- type: string
50
- required: true
51
- description: 'The subject contains succinct description of the change'
52
- rules:
53
- firstLetter: lower
54
- dotAtEnd: false
55
- nonAscii: false
56
- issueKeyword:
57
- type: branch
58
- required: false
59
- description: 'Github issue link'
60
- regExp: 'issue([0-9]+)'
61
- regExpFlag: 'i'
62
- prefix: '(close #'
63
- suffix: ")"
64
- issueLink:
65
- type: branch
66
- required: false
67
- description: 'Github issue link'
68
- regExp: 'issue([0-9]+)'
69
- regExpFlag: 'i'
70
- prefix: 'https://github.com/isuke/git-consistent/issues/'
71
- suffix: "\n"
72
- body:
73
- type: text
74
- default: ''
75
- required: false
76
- description: 'The body contains details of the change'
77
- rules:
78
- firstLetter: upper
79
- dotAtEnd: true
80
- nonAscii: false
@@ -1,3 +0,0 @@
1
- <type>: <subject> <issueKeyword>
2
-
3
- <issueLink><body>
@@ -1,32 +0,0 @@
1
- name: Test and Lint
2
-
3
- on: [push]
4
-
5
- jobs:
6
- test:
7
- runs-on: ubuntu-latest
8
-
9
- strategy:
10
- matrix:
11
- node-version: [14.x, 16.x, 18.x]
12
-
13
- steps:
14
- - uses: actions/checkout@v3
15
- - name: Use Node.js ${{ matrix.node-version }}
16
- uses: actions/setup-node@v3
17
- with:
18
- node-version: ${{ matrix.node-version }}
19
- cache: 'npm'
20
- - run: npm install
21
- - run: npm run build
22
- - run: npm run test
23
- lint:
24
- runs-on: ubuntu-latest
25
- steps:
26
- - uses: actions/checkout@v3
27
- - uses: actions/setup-node@v3
28
- with:
29
- node-version: 18.x
30
- cache: 'npm'
31
- - run: npm install
32
- - run: npm run lint
package/.node-version DELETED
@@ -1 +0,0 @@
1
- 16.18.0
package/babel.config.js DELETED
@@ -1,15 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- '@babel/env',
5
- {
6
- targets: {
7
- firefox: '64',
8
- chrome: '71',
9
- },
10
- useBuiltIns: 'usage',
11
- corejs: 3,
12
- },
13
- ],
14
- ],
15
- }