pacc 9.2.5 → 9.2.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 +37 -0
- package/benchmark/first.mjs +6 -10
- package/package.json +9 -9
- package/types/ast.d.mts +1 -1
- package/types/attributes.d.mts +3 -3
- package/types/common-attributes.d.mts +28 -28
- package/types/environment.d.mts +1 -1
- package/types/expand.d.mts +3 -3
- package/types/filter.d.mts +1 -1
- package/types/multiple.d.mts +3 -3
- package/types/settergetter.d.mts +3 -3
- package/types/types.d.mts +5 -5
package/README.md
CHANGED
|
@@ -24,6 +24,43 @@ const result = expand("${a + 1}",{ root: { a: 2 }});
|
|
|
24
24
|
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
+
# Benchmark
|
|
28
|
+
|
|
29
|
+
benchmark avg (min … max) p75 / p99 (min … top 1%)
|
|
30
|
+
|
|
31
|
+
***
|
|
32
|
+
|
|
33
|
+
"\[n<5].l" 1.17 µs/iter 1.67 µs █
|
|
34
|
+
(833.64 ns … 2.47 µs) 2.42 µs █
|
|
35
|
+
(281.78 b … 3.28 kb) 3.01 kb █▇▂▁▃▂▁▁▁▁▁▃▂▄▄▂▂▁▁▂▁
|
|
36
|
+
4.72 ipc ( 2.55% stalls) 98.55% L1 data cache
|
|
37
|
+
3.75k cycles 17.68k instructions 39.84% retired LD/ST ( 7.04k)
|
|
38
|
+
|
|
39
|
+
parse a.b.c.d.e.f.g.h.i.j.k.l.m.n 2.96 µs/iter 3.25 µs ▂█▂ ▅
|
|
40
|
+
(2.60 µs … 3.44 µs) 3.41 µs ███▅▅ ▅█▂▂▂▂
|
|
41
|
+
( 6.10 kb … 6.11 kb) 6.10 kb █████▄▁▁▁▁▁▁▄▄▁██████
|
|
42
|
+
5.09 ipc ( 2.02% stalls) 99.10% L1 data cache
|
|
43
|
+
9.40k cycles 47.87k instructions 40.50% retired LD/ST ( 19.38k)
|
|
44
|
+
|
|
45
|
+
parseOnly a.b.c.d.e.f.g.h.i.j.k.l.m.n 2.51 µs/iter 2.85 µs █
|
|
46
|
+
(2.18 µs … 3.36 µs) 3.35 µs █▆
|
|
47
|
+
( 4.54 kb … 5.43 kb) 5.41 kb ██▄▄▂▁▁▁▁▃▂█▇█▂▁▂▁▂▁▂
|
|
48
|
+
5.12 ipc ( 2.18% stalls) 98.98% L1 data cache
|
|
49
|
+
8.05k cycles 41.20k instructions 40.73% retired LD/ST ( 16.78k)
|
|
50
|
+
|
|
51
|
+
tokens a.b.c.d.e.f.g.h.i.j.k.l.m.n 1.66 µs/iter 1.68 µs ▆ █▄ ▃
|
|
52
|
+
(1.61 µs … 1.75 µs) 1.74 µs ▅█▄██▄ █▂ ▂▅
|
|
53
|
+
( 4.41 kb … 4.42 kb) 4.41 kb ██████▅▁██▃▅▃▆▆██▃▃▁▆
|
|
54
|
+
5.67 ipc ( 2.53% stalls) 99.12% L1 data cache
|
|
55
|
+
5.32k cycles 30.18k instructions 40.68% retired LD/ST ( 12.27k)
|
|
56
|
+
|
|
57
|
+
tokens "abc" "
|
|
58
|
+
" "abcdefghijklmnopqrstuvwxyz" 1.23 µs/iter 1.12 µs █
|
|
59
|
+
(1.02 µs … 2.23 µs) 1.85 µs █▆
|
|
60
|
+
( 2.52 kb … 4.17 kb) 3.43 kb ███▁▁▁▁▁▁▁▁▁▁▁▁▁▂▂▇▄▃
|
|
61
|
+
6.02 ipc ( 2.26% stalls) 99.24% L1 data cache
|
|
62
|
+
3.94k cycles 23.72k instructions 39.67% retired LD/ST ( 9.41k)
|
|
63
|
+
|
|
27
64
|
# API
|
|
28
65
|
|
|
29
66
|
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
package/benchmark/first.mjs
CHANGED
|
@@ -31,18 +31,14 @@ const root2 = {
|
|
|
31
31
|
|
|
32
32
|
bench('"[n<5].l"', () => parse("[n<5].l", { root }));
|
|
33
33
|
|
|
34
|
-
|
|
35
34
|
const expression = "a.b.c.d.e.f.g.h.i.j.k.l.m.n";
|
|
36
35
|
|
|
37
|
-
bench(
|
|
38
|
-
|
|
39
|
-
);
|
|
36
|
+
bench(`parse ${expression}`, () => parse(expression, { root: root2 }));
|
|
37
|
+
bench(`parseOnly ${expression}`, () => parseOnly(expression, {}));
|
|
38
|
+
bench(`tokens ${expression}`, () => Array.from(tokens(expression, {})));
|
|
39
|
+
|
|
40
|
+
const expression2 = '"abc" "\t\n" "abcdefghijklmnopqrstuvwxyz"';
|
|
40
41
|
|
|
41
|
-
bench(
|
|
42
|
-
parseOnly(expression, { })
|
|
43
|
-
);
|
|
44
|
-
bench('tokens "a.b.c.d.e.f.g.h.i.j.k.l.m.n"', () =>
|
|
45
|
-
Array.from(tokens(expression, { }))
|
|
46
|
-
);
|
|
42
|
+
bench(`tokens ${expression2}`, () => Array.from(tokens(expression2, {})));
|
|
47
43
|
|
|
48
44
|
await run();
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pacc",
|
|
3
|
-
"version": "9.2.
|
|
3
|
+
"version": "9.2.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"provenance": true
|
|
7
7
|
},
|
|
8
|
-
"packageManager": "npm@11.
|
|
8
|
+
"packageManager": "npm@11.13.0",
|
|
9
9
|
"types": "./types/module.d.mts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "0BSD",
|
|
31
31
|
"scripts": {
|
|
32
|
-
"benchmark": "node benchmark/*.mjs",
|
|
33
32
|
"prepare": "node --run prepare:typescript",
|
|
34
33
|
"prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
|
|
35
34
|
"test": "node --run test:browser-ava && node --run test:ava",
|
|
@@ -39,20 +38,21 @@
|
|
|
39
38
|
"docs": "documentation readme --section=API ./src**/*.mjs",
|
|
40
39
|
"lint": "node --run lint:docs && node --run lint:typescript",
|
|
41
40
|
"lint:docs": "documentation lint ./src**/*.mjs",
|
|
42
|
-
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
|
|
41
|
+
"lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule --target esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
|
|
42
|
+
"benchmark": "node benchmark/*.mjs"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@mitata/counters": "^0.0.8",
|
|
46
|
-
"ava": "^
|
|
47
|
-
"browser-ava": "^2.3.
|
|
48
|
-
"c8": "^
|
|
46
|
+
"ava": "^8.0.0",
|
|
47
|
+
"browser-ava": "^2.3.57",
|
|
48
|
+
"c8": "^11.0.0",
|
|
49
49
|
"documentation": "^14.0.3",
|
|
50
50
|
"mitata": "^1.0.34",
|
|
51
51
|
"semantic-release": "^25.0.3",
|
|
52
|
-
"typescript": "^
|
|
52
|
+
"typescript": "^6.0.3"
|
|
53
53
|
},
|
|
54
54
|
"engines": {
|
|
55
|
-
"node": ">=24.
|
|
55
|
+
"node": ">=24.15.0"
|
|
56
56
|
},
|
|
57
57
|
"repository": {
|
|
58
58
|
"type": "git",
|
package/types/ast.d.mts
CHANGED
package/types/attributes.d.mts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param {Object} [presentDefinitions] optional merge in attributes
|
|
5
5
|
* @return {Object} attributes
|
|
6
6
|
*/
|
|
7
|
-
export function prepareAttributesDefinitions(newDefinitions:
|
|
7
|
+
export function prepareAttributesDefinitions(newDefinitions: Object, presentDefinitions?: Object): Object;
|
|
8
8
|
/**
|
|
9
9
|
* Iterate over all attributes.
|
|
10
10
|
* @param {Object} definition
|
|
@@ -12,8 +12,8 @@ export function prepareAttributesDefinitions(newDefinitions: any, presentDefinit
|
|
|
12
12
|
* @param {string[]} path
|
|
13
13
|
* @return {Iterable<[string[],object]>}
|
|
14
14
|
*/
|
|
15
|
-
export function attributeIterator(definition:
|
|
16
|
-
export function writableAttributeIterator(definition: any): Generator<[string[],
|
|
15
|
+
export function attributeIterator(definition: Object, filter?: Function, path?: string[]): Iterable<[string[], object]>;
|
|
16
|
+
export function writableAttributeIterator(definition: any): Generator<[string[], object], void, any>;
|
|
17
17
|
export function toInternal(value: any, attribute: any): any;
|
|
18
18
|
export function toExternal(value: any, attribute: any): any;
|
|
19
19
|
export function mandatoryAttributesPresent(object: any, attributes: any): boolean;
|
|
@@ -102,23 +102,23 @@ export namespace yesno_attribute_writable {
|
|
|
102
102
|
export let isKey: boolean;
|
|
103
103
|
export let mandatory: boolean;
|
|
104
104
|
export let collection: boolean;
|
|
105
|
-
export let constructor: Function;
|
|
106
|
-
let _private: boolean;
|
|
105
|
+
export let constructor: Function | undefined;
|
|
106
|
+
let _private: boolean | undefined;
|
|
107
107
|
export { _private as private };
|
|
108
|
-
export let credential: boolean;
|
|
109
|
-
export let persistent: boolean;
|
|
110
|
-
export let depends: string;
|
|
111
|
-
export let description: string;
|
|
108
|
+
export let credential: boolean | undefined;
|
|
109
|
+
export let persistent: boolean | undefined;
|
|
110
|
+
export let depends: string | undefined;
|
|
111
|
+
export let description: string | undefined;
|
|
112
112
|
let _default: any;
|
|
113
113
|
export { _default as default };
|
|
114
|
-
export let set: Function;
|
|
115
|
-
export let get: Function;
|
|
116
|
-
export let toInternal: Function;
|
|
117
|
-
export let toExternal: Function;
|
|
118
|
-
export let values: Set<any
|
|
119
|
-
export let externalName: string;
|
|
120
|
-
export let env: string[] |
|
|
121
|
-
export let additionalValues: object;
|
|
114
|
+
export let set: Function | undefined;
|
|
115
|
+
export let get: Function | undefined;
|
|
116
|
+
export let toInternal: Function | undefined;
|
|
117
|
+
export let toExternal: Function | undefined;
|
|
118
|
+
export let values: Set<any> | undefined;
|
|
119
|
+
export let externalName: string | undefined;
|
|
120
|
+
export let env: string | string[] | undefined;
|
|
121
|
+
export let additionalValues: object | undefined;
|
|
122
122
|
}
|
|
123
123
|
/**
|
|
124
124
|
* @type {AttributeDefinition}
|
|
@@ -232,27 +232,27 @@ export type AttributeDefinition = {
|
|
|
232
232
|
/**
|
|
233
233
|
* (collection) constructor
|
|
234
234
|
*/
|
|
235
|
-
constructor?: Function;
|
|
235
|
+
constructor?: Function | undefined;
|
|
236
236
|
/**
|
|
237
237
|
* should the value be shown
|
|
238
238
|
*/
|
|
239
|
-
private?: boolean;
|
|
239
|
+
private?: boolean | undefined;
|
|
240
240
|
/**
|
|
241
241
|
* any type of credential
|
|
242
242
|
*/
|
|
243
|
-
credential?: boolean;
|
|
243
|
+
credential?: boolean | undefined;
|
|
244
244
|
/**
|
|
245
245
|
* should we be stored (especially critical for credentials)
|
|
246
246
|
*/
|
|
247
|
-
persistent?: boolean;
|
|
247
|
+
persistent?: boolean | undefined;
|
|
248
248
|
/**
|
|
249
249
|
* name of an attribute we depend on
|
|
250
250
|
*/
|
|
251
|
-
depends?: string;
|
|
251
|
+
depends?: string | undefined;
|
|
252
252
|
/**
|
|
253
253
|
* human readable
|
|
254
254
|
*/
|
|
255
|
-
description?: string;
|
|
255
|
+
description?: string | undefined;
|
|
256
256
|
/**
|
|
257
257
|
* the default value
|
|
258
258
|
*/
|
|
@@ -260,28 +260,28 @@ export type AttributeDefinition = {
|
|
|
260
260
|
/**
|
|
261
261
|
* set the value
|
|
262
262
|
*/
|
|
263
|
-
set?: Function;
|
|
263
|
+
set?: Function | undefined;
|
|
264
264
|
/**
|
|
265
265
|
* get the value can be used to calculate default values
|
|
266
266
|
*/
|
|
267
|
-
get?: Function;
|
|
268
|
-
toInternal?: Function;
|
|
269
|
-
toExternal?: Function;
|
|
267
|
+
get?: Function | undefined;
|
|
268
|
+
toInternal?: Function | undefined;
|
|
269
|
+
toExternal?: Function | undefined;
|
|
270
270
|
/**
|
|
271
271
|
* allowed values
|
|
272
272
|
*/
|
|
273
|
-
values?: Set<any
|
|
273
|
+
values?: Set<any> | undefined;
|
|
274
274
|
/**
|
|
275
275
|
* attribute name used by external system
|
|
276
276
|
*/
|
|
277
|
-
externalName?: string;
|
|
277
|
+
externalName?: string | undefined;
|
|
278
278
|
/**
|
|
279
279
|
* environment variable(s) used to provide the value
|
|
280
280
|
*/
|
|
281
|
-
env?: string[] |
|
|
281
|
+
env?: string | string[] | undefined;
|
|
282
282
|
/**
|
|
283
283
|
* other values to be set in case our attribute is set
|
|
284
284
|
*/
|
|
285
|
-
additionalValues?: object;
|
|
285
|
+
additionalValues?: object | undefined;
|
|
286
286
|
};
|
|
287
287
|
export { default_attribute as string_attribute, default_attribute_writable as string_attribute_writable, description_attribute as description_attribute_writable, default_attribute as type_attribute, default_attribute_writable as state_attribute_writable, boolean_attribute_writable_true as active_attribute, boolean_attribute as empty_attribute, secret_attribute as username_attribute, secret_attribute as password_attribute, secret_attribute as token_attribute, secret_attribute as certificate_attribute, integer_attribute as count_attribute, integer_attribute_writable as count_attribute_writable, integer_attribute as size_attribute, default_attribute_writable as body_attribute_writable };
|
package/types/environment.d.mts
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* @param {string} instanceIdentifier part of variable name.
|
|
6
6
|
* @return {Object|undefined} undefined if no suitable environment variables have been found
|
|
7
7
|
*/
|
|
8
|
-
export function environmentValues(env:
|
|
8
|
+
export function environmentValues(env: Object, attributes: Object, instanceIdentifier: string): Object | undefined;
|
package/types/expand.d.mts
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export function expand(object: any, context: {
|
|
12
12
|
root?: any;
|
|
13
|
-
stopClass?: Function;
|
|
14
|
-
leadIn?: string;
|
|
15
|
-
leadOut?: string;
|
|
13
|
+
stopClass?: Function | undefined;
|
|
14
|
+
leadIn?: string | undefined;
|
|
15
|
+
leadOut?: string | undefined;
|
|
16
16
|
}): any | Promise<any>;
|
|
17
17
|
export namespace expandContextDefault {
|
|
18
18
|
let root: {};
|
package/types/filter.d.mts
CHANGED
package/types/multiple.d.mts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @param {Object} definitions attribute definitions to be used
|
|
6
6
|
* @param {function?} cb callback to be executed for each copied value
|
|
7
7
|
*/
|
|
8
|
-
export function setAttributes(object:
|
|
8
|
+
export function setAttributes(object: Object, source: Object, definitions: Object, cb: Function | null): void;
|
|
9
9
|
/**
|
|
10
10
|
* Retrive attribute values from an object.
|
|
11
11
|
* @param {Object} object attribute value source
|
|
@@ -13,7 +13,7 @@ export function setAttributes(object: any, source: any, definitions: any, cb: Fu
|
|
|
13
13
|
* @param {Function} [filter]
|
|
14
14
|
* @return {Object} values
|
|
15
15
|
*/
|
|
16
|
-
export function getAttributes(object:
|
|
16
|
+
export function getAttributes(object: Object, definitions: Object, filter?: Function): Object;
|
|
17
17
|
/**
|
|
18
18
|
* Retrive attribute values from an object.
|
|
19
19
|
* @param {Object} object attribute value source
|
|
@@ -21,4 +21,4 @@ export function getAttributes(object: any, definitions: any, filter?: Function):
|
|
|
21
21
|
* @param {Function} [filter]
|
|
22
22
|
* @return {Object} values
|
|
23
23
|
*/
|
|
24
|
-
export function getAttributesJSON(object:
|
|
24
|
+
export function getAttributesJSON(object: Object, definitions: Object, filter?: Function): Object;
|
package/types/settergetter.d.mts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {any} value
|
|
7
7
|
* @param {Object} [definition] type def
|
|
8
8
|
*/
|
|
9
|
-
export function setAttribute(object:
|
|
9
|
+
export function setAttribute(object: Object, expression: string, value: any, definition?: Object): void;
|
|
10
10
|
/**
|
|
11
11
|
* Deliver attribute value.
|
|
12
12
|
* The name may be a property path like 'a.b.c' or a[2]
|
|
@@ -15,7 +15,7 @@ export function setAttribute(object: any, expression: string, value: any, defini
|
|
|
15
15
|
* @param {Object} [definition]
|
|
16
16
|
* @returns {any} value associated with the given property name
|
|
17
17
|
*/
|
|
18
|
-
export function getAttribute(object:
|
|
18
|
+
export function getAttribute(object: Object, expression: string, definition?: Object): any;
|
|
19
19
|
/**
|
|
20
20
|
* Deliver attribute value and operator.
|
|
21
21
|
* The name may be a property path like 'a.b.c <='.
|
|
@@ -23,5 +23,5 @@ export function getAttribute(object: any, expression: string, definition?: any):
|
|
|
23
23
|
* @param {string} expression
|
|
24
24
|
* @returns {[any,Token]} value associated with the given property name
|
|
25
25
|
*/
|
|
26
|
-
export function getAttributeAndOperator(object:
|
|
26
|
+
export function getAttributeAndOperator(object: Object, expression: string): [any, Token];
|
|
27
27
|
export type Token = import("./tokens.mjs").Token;
|
package/types/types.d.mts
CHANGED
|
@@ -23,7 +23,7 @@ export const types: {
|
|
|
23
23
|
name: string;
|
|
24
24
|
primitive: boolean;
|
|
25
25
|
toInternal: (value: any, attribute: any) => any;
|
|
26
|
-
toExternal: (value: any) => "no" | "yes";
|
|
26
|
+
toExternal: (value: any) => "no" | "yes" | undefined;
|
|
27
27
|
};
|
|
28
28
|
integer: {
|
|
29
29
|
name: string;
|
|
@@ -39,7 +39,7 @@ export const types: {
|
|
|
39
39
|
name: string;
|
|
40
40
|
primitive: boolean;
|
|
41
41
|
toInternal: (value: any) => number;
|
|
42
|
-
toExternal: (value: any) => string;
|
|
42
|
+
toExternal: (value: any) => string | undefined;
|
|
43
43
|
};
|
|
44
44
|
duration_ms: {
|
|
45
45
|
name: string;
|
|
@@ -63,8 +63,8 @@ export const types: {
|
|
|
63
63
|
};
|
|
64
64
|
export type Type = {
|
|
65
65
|
name: string;
|
|
66
|
-
primitive?: boolean;
|
|
67
|
-
toInternal?: Function;
|
|
68
|
-
toExternal?: Function;
|
|
66
|
+
primitive?: boolean | undefined;
|
|
67
|
+
toInternal?: Function | undefined;
|
|
68
|
+
toExternal?: Function | undefined;
|
|
69
69
|
};
|
|
70
70
|
import { parseBytes } from "./bytes.mjs";
|