@ja-platform/parser-core 0.0.0-dev-20261112183707 → 0.0.0-dev-20261113191340

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ParsedValue.js","sourceRoot":"","sources":["../../src/values/ParsedValue.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AAgBzD;;;GAGG;AACH,iBAA4B,SAAQ,2BAAgD;IAQlF,YACmB,SAA0B,EAC3C,SAA2C;QAE3C,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAiB;QANrC,gBAAW,GAAG,CAAC,CAAC;QAChB,aAAQ,GAAG,KAAK,CAAC;QASvB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CACjC,SAAS;aACN,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;aAC5C,MAAM,CAAC,CAAC,KAAK,EAAyC,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACjF,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAClD,KAAK,CAAC,gBAAgB,CAAC;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;SACpC,CAAC,CACH,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,OA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CAAC;YACtC,IAAI,CAAC,OAAO,GAAG,OAAwB,CAAC;YACxC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,EAAE,kBAAC,MAAA,QAAQ,CAAC,OAAO,+CAAhB,QAAQ,EAAW,IAAI,CAAC,OAAO,CAAC,GAAA,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;CACF","sourcesContent":["import { BaseObserver } from '@journeyapps/common-utils';\nimport type { AbstractValueProvider } from './AbstractValueProvider';\nimport { ParsedAttribute } from '../parsed/ParsedAttribute';\nimport { ParsedProviderValue } from './ParsedProviderValue';\n\nexport interface ParsedValueListener<T> {\n changed?: (value: T) => void;\n disposed?: () => void;\n}\n\nexport interface ParsedValueLike<T> {\n readonly current: T;\n registerListener(listener: Partial<ParsedValueListener<T>>): () => void;\n dispose(): void;\n}\n\n/**\n * Creates contributions from providers ordered from lowest to highest priority.\n * Subscribes to every contribution and caches the last active value.\n */\nexport class ParsedValue<T> extends BaseObserver<ParsedValueListener<T | undefined>> {\n current: T | undefined;\n readonly providerValues: readonly ParsedProviderValue<unknown>[];\n private retainCount = 0;\n private released = false;\n private readonly deregister: (() => void)[];\n private selected?: ParsedProviderValue<unknown>;\n\n constructor(\n private readonly attribute: ParsedAttribute,\n providers: readonly AbstractValueProvider[]\n ) {\n super();\n this.providerValues = Object.freeze(\n providers\n .map((provider) => provider.value(attribute))\n .filter((value): value is ParsedProviderValue<unknown> => value !== undefined)\n );\n this.deregister = this.providerValues.map((value) =>\n value.registerListener({\n changed: () => this.refresh(),\n activeChanged: () => this.refresh()\n })\n );\n this.refresh();\n }\n\n get activeValue(): ParsedProviderValue<unknown> | undefined {\n return this.selected;\n }\n\n /**\n * Keep this resolved value and its contributions alive for another consumer.\n */\n retain(): this {\n if (!this.released) {\n this.retainCount++;\n }\n return this;\n }\n\n /**\n * Dispose contributions when the last consumer releases this value.\n */\n release(): void {\n if (this.retainCount > 0) {\n this.retainCount--;\n }\n if (this.retainCount === 0) {\n this.dispose();\n }\n }\n\n dispose(): void {\n if (!this.released) {\n this.released = true;\n this.deregister.forEach((unsubscribe) => unsubscribe());\n this.providerValues.forEach((value) => value.dispose());\n this.iterateListeners((listener) => listener.disposed?.());\n }\n }\n\n private refresh(): void {\n let selected: ParsedProviderValue<unknown> | undefined;\n for (const value of this.providerValues) {\n if (value.active) {\n selected = value;\n }\n }\n // Keep the winning entry current even when another provider supplies the same resolved value.\n this.selected = selected;\n let current = selected?.current;\n if (current != null) {\n current = this.attribute.definition.normalizeValue(current);\n }\n if (!Object.is(this.current, current)) {\n this.current = current as T | undefined;\n this.iterateListeners((listener) => listener.changed?.(this.current));\n }\n }\n}\n"]}
1
+ {"version":3,"file":"ParsedValue.js","sourceRoot":"","sources":["../../src/values/ParsedValue.ts"],"names":[],"mappings":";;;AAAA,4DAAyD;AAgBzD;;;GAGG;AACH,iBAA4B,SAAQ,2BAAgD;IAOlF,YACmB,SAA0B,EAC3C,SAA2C;QAE3C,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAiB;QALrC,aAAQ,GAAG,KAAK,CAAC;QASvB,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,MAAM,CACjC,SAAS;aACN,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;aAC5C,MAAM,CAAC,CAAC,KAAK,EAAyC,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CACjF,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAClD,KAAK,CAAC,gBAAgB,CAAC;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;YAC7B,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE;SACpC,CAAC,CACH,CAAC;QACF,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED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AAW,IAAI,CAAC,OAAO,CAAC,GAAA,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;CACF","sourcesContent":["import { BaseObserver } from '@journeyapps/common-utils';\nimport type { AbstractValueProvider } from './AbstractValueProvider';\nimport type { ParsedAttribute } from '../parsed/ParsedAttribute';\nimport { ParsedProviderValue } from './ParsedProviderValue';\n\nexport interface ParsedValueListener<T> {\n changed?: (value: T) => void;\n disposed?: () => void;\n}\n\nexport interface ParsedValueLike<T> {\n readonly current: T;\n registerListener(listener: Partial<ParsedValueListener<T>>): () => void;\n dispose(): void;\n}\n\n/**\n * Creates contributions from providers ordered from lowest to highest priority.\n * Subscribes to every contribution and keeps the current winning value.\n */\nexport class ParsedValue<T> extends BaseObserver<ParsedValueListener<T | undefined>> {\n current: T | undefined;\n readonly providerValues: readonly ParsedProviderValue<unknown>[];\n private disposed = false;\n private readonly deregister: (() => void)[];\n private selected?: ParsedProviderValue<unknown>;\n\n constructor(\n private readonly attribute: ParsedAttribute,\n providers: readonly AbstractValueProvider[]\n ) {\n super();\n this.providerValues = Object.freeze(\n providers\n .map((provider) => provider.value(attribute))\n .filter((value): value is ParsedProviderValue<unknown> => value !== undefined)\n );\n this.deregister = this.providerValues.map((value) =>\n value.registerListener({\n changed: () => this.refresh(),\n activeChanged: () => this.refresh()\n })\n );\n this.refresh();\n }\n\n get activeValue(): ParsedProviderValue<unknown> | undefined {\n return this.selected;\n }\n\n dispose(): void {\n if (!this.disposed) {\n this.disposed = true;\n this.deregister.forEach((unsubscribe) => unsubscribe());\n this.providerValues.forEach((value) => value.dispose());\n this.iterateListeners((listener) => listener.disposed?.());\n }\n }\n\n private refresh(): void {\n let selected: ParsedProviderValue<unknown> | undefined;\n for (const value of this.providerValues) {\n if (value.active) {\n selected = value;\n }\n }\n // Keep the winning entry current even when another provider supplies the same resolved value.\n this.selected = selected;\n let current = selected?.current;\n if (current != null) {\n current = this.attribute.definition.normalizeValue(current);\n }\n if (!Object.is(this.current, current)) {\n this.current = current as T | undefined;\n this.iterateListeners((listener) => listener.changed?.(this.current));\n }\n }\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ValueProviderContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValueProviderContext.js","sourceRoot":"","sources":["../../src/values/ValueProviderContext.ts"],"names":[],"mappings":"","sourcesContent":["import type { AbstractValueProvider } from './AbstractValueProvider';\n\n/** Supplies the provider order for independently owned parsed-node evaluations. */\nexport interface ValueProviderContext {\n readonly providers: readonly AbstractValueProvider[];\n}\n"]}
package/package.json CHANGED
@@ -9,15 +9,15 @@
9
9
  "registry": "https://registry.npmjs.org/",
10
10
  "access": "public"
11
11
  },
12
- "version": "0.0.0-dev-20261112183707",
12
+ "version": "0.0.0-dev-20261113191340",
13
13
  "description": "Reusable parser definitions, parsed trees and values",
14
14
  "main": "./dist/index.js",
15
15
  "typings": "./dist/@types/index.d.ts",
16
16
  "dependencies": {
17
- "@ja-platform/parser-expressions": "0.0.0-dev-20261112183707",
18
- "@ja-platform/parser-type-system": "0.0.0-dev-20261112183707",
19
- "@journeyapps/common-tree": "0.0.0-dev-20261112182716",
20
- "@journeyapps/common-utils": "0.0.0-dev-20261112182716",
17
+ "@ja-platform/parser-expressions": "0.0.0-dev-20261113191340",
18
+ "@ja-platform/parser-type-system": "0.0.0-dev-20261113191340",
19
+ "@journeyapps/common-tree": "3.0.3",
20
+ "@journeyapps/common-utils": "2.0.0",
21
21
  "lodash": "^4.18.1",
22
22
  "type-fest": "^5.10.0"
23
23
  },
@@ -28,7 +28,7 @@
28
28
  "node": "^22.19.0 || ^24.11.0 || >=26.0.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@journeyapps/common-xml": "0.0.0-dev-20261112182716",
31
+ "@journeyapps/common-xml": "6.0.0",
32
32
  "vitest": "^5.0.5"
33
33
  },
34
34
  "scripts": {