pacc 3.1.5 → 3.1.7

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/README.md CHANGED
@@ -29,20 +29,45 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
29
29
 
30
30
  * [AttributeDefinition](#attributedefinition)
31
31
  * [Properties](#properties)
32
- * [Token](#token)
33
- * [Properties](#properties-1)
34
- * [Token](#token-1)
35
- * [Properties](#properties-2)
36
- * [setAttribute](#setattribute)
32
+ * [tokens](#tokens)
33
+ * [tokens](#tokens-1)
37
34
  * [Parameters](#parameters)
38
- * [getAttribute](#getattribute)
35
+ * [setAttribute](#setattribute)
39
36
  * [Parameters](#parameters-1)
40
- * [getAttributeAndOperator](#getattributeandoperator)
37
+ * [getAttribute](#getattribute)
41
38
  * [Parameters](#parameters-2)
42
- * [createToken](#createtoken)
39
+ * [getAttributeAndOperator](#getattributeandoperator)
43
40
  * [Parameters](#parameters-3)
44
- * [tokens](#tokens)
41
+ * [Token](#token)
42
+ * [Properties](#properties-1)
43
+ * [createToken](#createtoken)
45
44
  * [Parameters](#parameters-4)
45
+ * [PLUS](#plus)
46
+ * [MINUS](#minus)
47
+ * [STAR](#star)
48
+ * [DIVIDE](#divide)
49
+ * [NOT](#not)
50
+ * [NOT\_EQUAL](#not_equal)
51
+ * [GREATER](#greater)
52
+ * [GREATER\_EQUAL](#greater_equal)
53
+ * [LESS](#less)
54
+ * [LESS\_EQUAL](#less_equal)
55
+ * [EQUAL](#equal)
56
+ * [OPEN\_ROUND](#open_round)
57
+ * [CLOSE\_ROUND](#close_round)
58
+ * [OPEN\_BRACKET](#open_bracket)
59
+ * [CLOSE\_BRACKET](#close_bracket)
60
+ * [OPEN\_CURLY](#open_curly)
61
+ * [CLOSE\_CURLY](#close_curly)
62
+ * [QUESTION](#question)
63
+ * [COLON](#colon)
64
+ * [SEMICOLON](#semicolon)
65
+ * [COMMA](#comma)
66
+ * [DOT](#dot)
67
+ * [AMPERSAND](#ampersand)
68
+ * [DOUBLE\_AMPERSAND](#double_ampersand)
69
+ * [BAR](#bar)
70
+ * [DOUBLE\_BAR](#double_bar)
46
71
 
47
72
  ## AttributeDefinition
48
73
 
@@ -57,27 +82,21 @@ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Globa
57
82
  * `private` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** should the value be shown
58
83
  * `depends` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** name of an attribute we depend on
59
84
  * `additionalAttributes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** extra attributes that are present in case our attribute is set
60
- * `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
85
+ * `description` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** human readable
61
86
  * `default` **any?** the default value
62
87
  * `set` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** set the value
63
88
  * `get` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** get the value can be used to calculate default values
64
89
  * `env` **([Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))?** environment variable(s) used to provide the value
65
90
 
66
- ## Token
67
-
68
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
69
-
70
- ### Properties
71
-
72
- * `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
91
+ ## tokens
73
92
 
74
- ## Token
93
+ ## tokens
75
94
 
76
- Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
95
+ Split property path into tokens
77
96
 
78
- ### Properties
97
+ ### Parameters
79
98
 
80
- * `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
99
+ * `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
81
100
 
82
101
  ## setAttribute
83
102
 
@@ -114,6 +133,14 @@ The name may be a property path like 'a.b.c <='.
114
133
 
115
134
  Returns **\[any, [Token](#token)]** value associated with the given property name
116
135
 
136
+ ## Token
137
+
138
+ Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
139
+
140
+ ### Properties
141
+
142
+ * `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
143
+
117
144
  ## createToken
118
145
 
119
146
  ### Parameters
@@ -122,13 +149,109 @@ Returns **\[any, [Token](#token)]** value associated with the given property nam
122
149
 
123
150
  Returns **[Token](#token)**&#x20;
124
151
 
125
- ## tokens
152
+ ## PLUS
126
153
 
127
- Split property path into tokens
154
+ Type: [Token](#token)
128
155
 
129
- ### Parameters
156
+ ## MINUS
130
157
 
131
- * `string` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)**&#x20;
158
+ Type: [Token](#token)
159
+
160
+ ## STAR
161
+
162
+ Type: [Token](#token)
163
+
164
+ ## DIVIDE
165
+
166
+ Type: [Token](#token)
167
+
168
+ ## NOT
169
+
170
+ Type: [Token](#token)
171
+
172
+ ## NOT\_EQUAL
173
+
174
+ Type: [Token](#token)
175
+
176
+ ## GREATER
177
+
178
+ Type: [Token](#token)
179
+
180
+ ## GREATER\_EQUAL
181
+
182
+ Type: [Token](#token)
183
+
184
+ ## LESS
185
+
186
+ Type: [Token](#token)
187
+
188
+ ## LESS\_EQUAL
189
+
190
+ Type: [Token](#token)
191
+
192
+ ## EQUAL
193
+
194
+ Type: [Token](#token)
195
+
196
+ ## OPEN\_ROUND
197
+
198
+ Type: [Token](#token)
199
+
200
+ ## CLOSE\_ROUND
201
+
202
+ Type: [Token](#token)
203
+
204
+ ## OPEN\_BRACKET
205
+
206
+ Type: [Token](#token)
207
+
208
+ ## CLOSE\_BRACKET
209
+
210
+ Type: [Token](#token)
211
+
212
+ ## OPEN\_CURLY
213
+
214
+ Type: [Token](#token)
215
+
216
+ ## CLOSE\_CURLY
217
+
218
+ Type: [Token](#token)
219
+
220
+ ## QUESTION
221
+
222
+ Type: [Token](#token)
223
+
224
+ ## COLON
225
+
226
+ Type: [Token](#token)
227
+
228
+ ## SEMICOLON
229
+
230
+ Type: [Token](#token)
231
+
232
+ ## COMMA
233
+
234
+ Type: [Token](#token)
235
+
236
+ ## DOT
237
+
238
+ Type: [Token](#token)
239
+
240
+ ## AMPERSAND
241
+
242
+ Type: [Token](#token)
243
+
244
+ ## DOUBLE\_AMPERSAND
245
+
246
+ Type: [Token](#token)
247
+
248
+ ## BAR
249
+
250
+ Type: [Token](#token)
251
+
252
+ ## DOUBLE\_BAR
253
+
254
+ Type: [Token](#token)
132
255
 
133
256
  # install
134
257
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pacc",
3
- "version": "3.1.5",
3
+ "version": "3.1.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
@@ -21,26 +21,27 @@
21
21
  ],
22
22
  "license": "BSD-2-Clause",
23
23
  "scripts": {
24
- "prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
24
+ "prepare": "npm run prepare:typescript",
25
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
25
26
  "test": "npm run test:browser-ava && npm run test:ava",
26
27
  "test:browser-ava": "browser-ava --headless --no-keep-open tests/*-ava.mjs tests/*-ava-browser.mjs",
27
28
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
28
29
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
29
30
  "docs": "documentation readme --section=API ./src/**/*.mjs",
30
- "lint": "npm run lint:docs && npm run lint:tsc",
31
+ "lint": "npm run lint:docs && npm run lint:typescript",
31
32
  "lint:docs": "documentation lint ./src/**/*.mjs",
32
- "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
33
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
33
34
  },
34
35
  "devDependencies": {
35
- "ava": "^6.1.1",
36
- "browser-ava": "^2.2.0",
36
+ "ava": "^6.1.3",
37
+ "browser-ava": "^2.2.13",
37
38
  "c8": "^9.1.0",
38
39
  "documentation": "^14.0.3",
39
- "semantic-release": "^23.0.2",
40
- "typescript": "^5.3.3"
40
+ "semantic-release": "^23.0.8",
41
+ "typescript": "^5.4.5"
41
42
  },
42
43
  "engines": {
43
- "node": ">=20.11.1"
44
+ "node": ">=20.13.0"
44
45
  },
45
46
  "repository": {
46
47
  "type": "git",
package/src/attribute.mjs CHANGED
@@ -8,7 +8,7 @@
8
8
  * @property {boolean} [private] should the value be shown
9
9
  * @property {string} [depends] name of an attribute we depend on
10
10
  * @property {string[]} additionalAttributes extra attributes that are present in case our attribute is set
11
- * @property {string} [description| human readable
11
+ * @property {string} [description] human readable
12
12
  * @property {any} [default] the default value
13
13
  * @property {Function} [set] set the value
14
14
  * @property {Function} [get] get the value can be used to calculate default values
@@ -16,8 +16,7 @@
16
16
  */
17
17
 
18
18
  /**
19
- * @typedef {Object} Token
20
- * @property {string} str
19
+ * @typedef {import('./tokens.mjs').Token} Token
21
20
  */
22
21
 
23
22
  import {
package/src/tokens.mjs CHANGED
@@ -16,32 +16,32 @@ function createToken(str) {
16
16
  return token;
17
17
  }
18
18
 
19
- export const PLUS = createToken("+");
20
- export const MINUS = createToken("-");
21
- export const STAR = createToken("*");
22
- export const DIVIDE = createToken("/");
23
- export const NOT = createToken("!");
24
- export const NOT_EQUAL = createToken("!=");
25
- export const GREATER = createToken(">");
26
- export const GREATER_EQUAL = createToken(">=");
27
- export const LESS = createToken("<");
28
- export const LESS_EQUAL = createToken("<=");
29
- export const EQUAL = createToken("=");
30
- export const OPEN_ROUND = createToken("(");
31
- export const CLOSE_ROUND = createToken(")");
32
- export const OPEN_BRACKET = createToken("[");
33
- export const CLOSE_BRACKET = createToken("]");
34
- export const OPEN_CURLY = createToken("{");
35
- export const CLOSE_CURLY = createToken("}");
36
- export const QUESTION = createToken("?");
37
- export const COLON = createToken(":");
38
- export const SEMICOLON = createToken(";");
39
- export const COMMA = createToken(",");
40
- export const DOT = createToken(".");
41
- export const AMPERSAND = createToken("&");
42
- export const DOUBLE_AMPERSAND = createToken("&&");
43
- export const BAR = createToken("|");
44
- export const DOUBLE_BAR = createToken("||");
19
+ export /** @type {Token} */ const PLUS = createToken("+");
20
+ export /** @type {Token} */ const MINUS = createToken("-");
21
+ export /** @type {Token} */ const STAR = createToken("*");
22
+ export /** @type {Token} */ const DIVIDE = createToken("/");
23
+ export /** @type {Token} */ const NOT = createToken("!");
24
+ export /** @type {Token} */ const NOT_EQUAL = createToken("!=");
25
+ export /** @type {Token} */ const GREATER = createToken(">");
26
+ export /** @type {Token} */ const GREATER_EQUAL = createToken(">=");
27
+ export /** @type {Token} */ const LESS = createToken("<");
28
+ export /** @type {Token} */ const LESS_EQUAL = createToken("<=");
29
+ export /** @type {Token} */ const EQUAL = createToken("=");
30
+ export /** @type {Token} */ const OPEN_ROUND = createToken("(");
31
+ export /** @type {Token} */ const CLOSE_ROUND = createToken(")");
32
+ export /** @type {Token} */ const OPEN_BRACKET = createToken("[");
33
+ export /** @type {Token} */ const CLOSE_BRACKET = createToken("]");
34
+ export /** @type {Token} */ const OPEN_CURLY = createToken("{");
35
+ export /** @type {Token} */ const CLOSE_CURLY = createToken("}");
36
+ export /** @type {Token} */ const QUESTION = createToken("?");
37
+ export /** @type {Token} */ const COLON = createToken(":");
38
+ export /** @type {Token} */ const SEMICOLON = createToken(";");
39
+ export /** @type {Token} */ const COMMA = createToken(",");
40
+ export /** @type {Token} */ const DOT = createToken(".");
41
+ export /** @type {Token} */ const AMPERSAND = createToken("&");
42
+ export /** @type {Token} */ const DOUBLE_AMPERSAND = createToken("&&");
43
+ export /** @type {Token} */ const BAR = createToken("|");
44
+ export /** @type {Token} */ const DOUBLE_BAR = createToken("||");
45
45
 
46
46
  /**
47
47
  * Split property path into tokens
@@ -56,8 +56,10 @@ export function* tokens(string) {
56
56
  switch (state) {
57
57
  case "string-escaping-hex":
58
58
  hex += c;
59
+ // @ts-ignore
59
60
  if (hex.length === 4) {
60
- buffer += String.fromCharCode(parseInt(hex, 16));
61
+ // @ts-ignore
62
+ buffer += String.fromCharCode(parseInt(hex, 16));
61
63
  state = "string";
62
64
  }
63
65
  continue;
@@ -41,7 +41,7 @@ export type AttributeDefinition = {
41
41
  */
42
42
  additionalAttributes: string[];
43
43
  /**
44
- * | human readable
44
+ * human readable
45
45
  */
46
46
  description?: string;
47
47
  /**
@@ -61,6 +61,4 @@ export type AttributeDefinition = {
61
61
  */
62
62
  env?: string[] | string;
63
63
  };
64
- export type Token = {
65
- str: string;
66
- };
64
+ export type Token = import('./tokens.mjs').Token;