pacc 4.6.0 → 4.7.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.
- package/README.md +10 -0
- package/package.json +2 -2
- package/src/common-attributes.mjs +8 -0
- package/src/tokens.mjs +41 -26
- package/types/common-attributes.d.mts +4 -0
package/README.md
CHANGED
|
@@ -43,6 +43,7 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
43
43
|
* [string\_collection\_attribute\_writable](#string_collection_attribute_writable)
|
|
44
44
|
* [name\_attribute](#name_attribute)
|
|
45
45
|
* [email\_attribute](#email_attribute)
|
|
46
|
+
* [version\_attribute\_writable](#version_attribute_writable)
|
|
46
47
|
* [description\_attribute](#description_attribute)
|
|
47
48
|
* [boolean\_attribute\_writable](#boolean_attribute_writable)
|
|
48
49
|
* [boolean\_attribute\_writable\_true](#boolean_attribute_writable_true)
|
|
@@ -67,6 +68,7 @@ const result = getAttribute({ a: [0,{ b: 4 }]}, "a[1].b");
|
|
|
67
68
|
* [integer\_attribute\_writable](#integer_attribute_writable)
|
|
68
69
|
* [object\_attribute](#object_attribute)
|
|
69
70
|
* [url\_attribute](#url_attribute)
|
|
71
|
+
* [url\_attribute\_writble](#url_attribute_writble)
|
|
70
72
|
* [hostname\_attribute](#hostname_attribute)
|
|
71
73
|
* [port\_attribute](#port_attribute)
|
|
72
74
|
* [id\_attribute](#id_attribute)
|
|
@@ -206,6 +208,10 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
206
208
|
|
|
207
209
|
Type: [AttributeDefinition](#attributedefinition)
|
|
208
210
|
|
|
211
|
+
## version\_attribute\_writable
|
|
212
|
+
|
|
213
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
214
|
+
|
|
209
215
|
## description\_attribute
|
|
210
216
|
|
|
211
217
|
The description of the object content.
|
|
@@ -304,6 +310,10 @@ Type: [AttributeDefinition](#attributedefinition)
|
|
|
304
310
|
|
|
305
311
|
Type: [AttributeDefinition](#attributedefinition)
|
|
306
312
|
|
|
313
|
+
## url\_attribute\_writble
|
|
314
|
+
|
|
315
|
+
Type: [AttributeDefinition](#attributedefinition)
|
|
316
|
+
|
|
307
317
|
## hostname\_attribute
|
|
308
318
|
|
|
309
319
|
Type: [AttributeDefinition](#attributedefinition)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "^5.9.2"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=22.
|
|
44
|
+
"node": ">=22.18.0"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
|
@@ -255,6 +255,14 @@ export const url_attribute = {
|
|
|
255
255
|
description: "home of the object"
|
|
256
256
|
};
|
|
257
257
|
|
|
258
|
+
/**
|
|
259
|
+
* @type {AttributeDefinition}
|
|
260
|
+
*/
|
|
261
|
+
export const url_attribute_writble = {
|
|
262
|
+
...url_attribute,
|
|
263
|
+
writable: true
|
|
264
|
+
};
|
|
265
|
+
|
|
258
266
|
/**
|
|
259
267
|
* @type {AttributeDefinition}
|
|
260
268
|
*/
|
package/src/tokens.mjs
CHANGED
|
@@ -53,7 +53,7 @@ export /** @type {Token} */ const DOUBLE_BAR = createToken("||");
|
|
|
53
53
|
* @yields {Token}
|
|
54
54
|
*/
|
|
55
55
|
export function* tokens(string) {
|
|
56
|
-
let state,
|
|
56
|
+
let state, value, hex, divider;
|
|
57
57
|
|
|
58
58
|
for (const c of string) {
|
|
59
59
|
switch (state) {
|
|
@@ -62,7 +62,7 @@ export function* tokens(string) {
|
|
|
62
62
|
// @ts-ignore
|
|
63
63
|
if (hex.length === 4) {
|
|
64
64
|
// @ts-ignore
|
|
65
|
-
|
|
65
|
+
value += String.fromCharCode(parseInt(hex, 16));
|
|
66
66
|
state = "string";
|
|
67
67
|
}
|
|
68
68
|
continue;
|
|
@@ -78,7 +78,7 @@ export function* tokens(string) {
|
|
|
78
78
|
r: "\r",
|
|
79
79
|
t: "\t"
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
value += esc[c] || c;
|
|
82
82
|
state = "string";
|
|
83
83
|
}
|
|
84
84
|
continue;
|
|
@@ -91,12 +91,13 @@ export function* tokens(string) {
|
|
|
91
91
|
case undefined:
|
|
92
92
|
break;
|
|
93
93
|
case "string":
|
|
94
|
-
|
|
94
|
+
value += c;
|
|
95
95
|
break;
|
|
96
|
+
case "number-fraction":
|
|
96
97
|
case "number":
|
|
97
98
|
case "identifier":
|
|
98
|
-
yield
|
|
99
|
-
|
|
99
|
+
yield value;
|
|
100
|
+
value = "";
|
|
100
101
|
state = undefined;
|
|
101
102
|
break;
|
|
102
103
|
default:
|
|
@@ -116,22 +117,23 @@ export function* tokens(string) {
|
|
|
116
117
|
case "'":
|
|
117
118
|
switch (state) {
|
|
118
119
|
case undefined:
|
|
119
|
-
|
|
120
|
+
value = "";
|
|
120
121
|
state = "string";
|
|
121
122
|
break;
|
|
122
123
|
case "string":
|
|
123
|
-
yield
|
|
124
|
+
yield value;
|
|
124
125
|
state = undefined;
|
|
125
126
|
break;
|
|
127
|
+
case "number-fraction":
|
|
126
128
|
case "number":
|
|
127
129
|
case "identifier":
|
|
128
|
-
yield
|
|
129
|
-
|
|
130
|
+
yield value;
|
|
131
|
+
value = "";
|
|
130
132
|
state = "string";
|
|
131
133
|
break;
|
|
132
134
|
default:
|
|
133
135
|
yield lookup[state];
|
|
134
|
-
|
|
136
|
+
value = "";
|
|
135
137
|
state = "string";
|
|
136
138
|
}
|
|
137
139
|
break;
|
|
@@ -156,11 +158,13 @@ export function* tokens(string) {
|
|
|
156
158
|
state = c;
|
|
157
159
|
break;
|
|
158
160
|
case "string":
|
|
159
|
-
|
|
161
|
+
value += c;
|
|
160
162
|
break;
|
|
163
|
+
|
|
164
|
+
case "number-fraction":
|
|
161
165
|
case "number":
|
|
162
166
|
case "identifier":
|
|
163
|
-
yield
|
|
167
|
+
yield value;
|
|
164
168
|
state = c;
|
|
165
169
|
break;
|
|
166
170
|
default:
|
|
@@ -175,21 +179,27 @@ export function* tokens(string) {
|
|
|
175
179
|
state = c;
|
|
176
180
|
break;
|
|
177
181
|
case "string":
|
|
178
|
-
|
|
182
|
+
value += c;
|
|
179
183
|
break;
|
|
184
|
+
case "number-fraction":
|
|
180
185
|
case "number":
|
|
181
186
|
case "identifier":
|
|
182
|
-
yield
|
|
187
|
+
yield value;
|
|
183
188
|
state = c;
|
|
184
189
|
break;
|
|
185
190
|
default:
|
|
186
191
|
state += c;
|
|
187
192
|
}
|
|
188
193
|
break;
|
|
194
|
+
case ".":
|
|
195
|
+
if (state === "number") {
|
|
196
|
+
state = "number-fraction";
|
|
197
|
+
divider = 10;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
189
200
|
case ":":
|
|
190
201
|
case ";":
|
|
191
202
|
case ",":
|
|
192
|
-
case ".":
|
|
193
203
|
case "+":
|
|
194
204
|
case "-":
|
|
195
205
|
case "*":
|
|
@@ -205,11 +215,12 @@ export function* tokens(string) {
|
|
|
205
215
|
state = c;
|
|
206
216
|
break;
|
|
207
217
|
case "string":
|
|
208
|
-
|
|
218
|
+
value += c;
|
|
209
219
|
break;
|
|
210
220
|
case "number":
|
|
221
|
+
case "number-fraction":
|
|
211
222
|
case "identifier":
|
|
212
|
-
yield
|
|
223
|
+
yield value;
|
|
213
224
|
state = c;
|
|
214
225
|
break;
|
|
215
226
|
default:
|
|
@@ -217,7 +228,6 @@ export function* tokens(string) {
|
|
|
217
228
|
state = c;
|
|
218
229
|
}
|
|
219
230
|
break;
|
|
220
|
-
|
|
221
231
|
case "0":
|
|
222
232
|
case "1":
|
|
223
233
|
case "2":
|
|
@@ -232,16 +242,20 @@ export function* tokens(string) {
|
|
|
232
242
|
default:
|
|
233
243
|
yield lookup[state];
|
|
234
244
|
case undefined:
|
|
235
|
-
|
|
245
|
+
value = c.charCodeAt(0) - 48;
|
|
236
246
|
state = "number";
|
|
237
247
|
break;
|
|
248
|
+
case "number-fraction":
|
|
249
|
+
value = value + (c.charCodeAt(0) - 48) / divider;
|
|
250
|
+
divider *= 10;
|
|
251
|
+
break;
|
|
238
252
|
case "number":
|
|
239
253
|
// @ts-ignore
|
|
240
|
-
|
|
254
|
+
value = value * 10 + c.charCodeAt(0) - 48;
|
|
241
255
|
break;
|
|
242
256
|
case "string":
|
|
243
257
|
case "identifier":
|
|
244
|
-
|
|
258
|
+
value += c;
|
|
245
259
|
break;
|
|
246
260
|
}
|
|
247
261
|
break;
|
|
@@ -249,17 +263,17 @@ export function* tokens(string) {
|
|
|
249
263
|
default:
|
|
250
264
|
switch (state) {
|
|
251
265
|
case undefined:
|
|
252
|
-
|
|
266
|
+
value = c;
|
|
253
267
|
state = "identifier";
|
|
254
268
|
break;
|
|
255
269
|
case "string":
|
|
256
270
|
case "identifier":
|
|
257
|
-
|
|
271
|
+
value += c;
|
|
258
272
|
break;
|
|
259
273
|
default:
|
|
260
274
|
yield lookup[state];
|
|
261
275
|
state = "identifier";
|
|
262
|
-
|
|
276
|
+
value = c;
|
|
263
277
|
}
|
|
264
278
|
}
|
|
265
279
|
}
|
|
@@ -272,9 +286,10 @@ export function* tokens(string) {
|
|
|
272
286
|
// @ts-ignore
|
|
273
287
|
error.expression = string;
|
|
274
288
|
throw error;
|
|
289
|
+
case "number-fraction":
|
|
275
290
|
case "number":
|
|
276
291
|
case "identifier":
|
|
277
|
-
yield
|
|
292
|
+
yield value;
|
|
278
293
|
break;
|
|
279
294
|
default:
|
|
280
295
|
yield lookup[state];
|
|
@@ -120,6 +120,10 @@ export const object_attribute: AttributeDefinition;
|
|
|
120
120
|
* @type {AttributeDefinition}
|
|
121
121
|
*/
|
|
122
122
|
export const url_attribute: AttributeDefinition;
|
|
123
|
+
/**
|
|
124
|
+
* @type {AttributeDefinition}
|
|
125
|
+
*/
|
|
126
|
+
export const url_attribute_writble: AttributeDefinition;
|
|
123
127
|
/**
|
|
124
128
|
* @type {AttributeDefinition}
|
|
125
129
|
*/
|