Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rushstack/heft-config-file

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/heft-config-file - npm Package Compare versions

Comparing version 0.11.11 to 0.12.0

36

dist/heft-config-file.d.ts

@@ -78,3 +78,3 @@ /**

*/
jsonPathMetadata?: IJsonPathsMetadata;
jsonPathMetadata?: IJsonPathsMetadata<TConfigurationFile>;
/**

@@ -119,3 +119,3 @@ * Use this property to control how root-level properties are handled between parent and child

*/
export declare interface ICustomJsonPathMetadata {
export declare interface ICustomJsonPathMetadata<TConfigurationFile> {
/**

@@ -125,3 +125,3 @@ * If `ICustomJsonPathMetadata.pathResolutionMethod` is set to `PathResolutionMethod.custom`,

*/
customResolver?: (configurationFilePath: string, propertyName: string, propertyValue: string) => string;
customResolver?: (resolverOptions: IJsonPathMetadataResolverOptions<TConfigurationFile>) => string;
/**

@@ -149,5 +149,29 @@ * If this property describes a filesystem path, use this property to describe

*/
export declare type IJsonPathMetadata = ICustomJsonPathMetadata | INonCustomJsonPathMetadata;
export declare type IJsonPathMetadata<T> = ICustomJsonPathMetadata<T> | INonCustomJsonPathMetadata;
/**
* Options provided to the custom resolver specified in {@link ICustomJsonPathMetadata}.
*
* @beta
*/
export declare interface IJsonPathMetadataResolverOptions<TConfigurationFile> {
/**
* The name of the property being resolved.
*/
propertyName: string;
/**
* The value of the path property being resolved.
*/
propertyValue: string;
/**
* The path to the configuration file the property was obtained from.
*/
configurationFilePath: string;
/**
* The configuration file the property was obtained from.
*/
configurationFile: Partial<TConfigurationFile>;
}
/**
* Keys in this object are JSONPaths {@link https://jsonpath.com/}, and values are objects

@@ -158,4 +182,4 @@ * that describe how node(s) selected by the JSONPath are processed after loading.

*/
export declare interface IJsonPathsMetadata {
[jsonPath: string]: IJsonPathMetadata;
export declare interface IJsonPathsMetadata<TConfigurationFile> {
[jsonPath: string]: IJsonPathMetadata<TConfigurationFile>;
}

@@ -162,0 +186,0 @@

@@ -57,2 +57,25 @@ import { ITerminal } from '@rushstack/node-core-library';

/**
* Options provided to the custom resolver specified in {@link ICustomJsonPathMetadata}.
*
* @beta
*/
export interface IJsonPathMetadataResolverOptions<TConfigurationFile> {
/**
* The name of the property being resolved.
*/
propertyName: string;
/**
* The value of the path property being resolved.
*/
propertyValue: string;
/**
* The path to the configuration file the property was obtained from.
*/
configurationFilePath: string;
/**
* The configuration file the property was obtained from.
*/
configurationFile: Partial<TConfigurationFile>;
}
/**
* Used to specify how node(s) in a JSON object should be processed after being loaded.

@@ -62,3 +85,3 @@ *

*/
export interface ICustomJsonPathMetadata {
export interface ICustomJsonPathMetadata<TConfigurationFile> {
/**

@@ -68,3 +91,3 @@ * If `ICustomJsonPathMetadata.pathResolutionMethod` is set to `PathResolutionMethod.custom`,

*/
customResolver?: (configurationFilePath: string, propertyName: string, propertyValue: string) => string;
customResolver?: (resolverOptions: IJsonPathMetadataResolverOptions<TConfigurationFile>) => string;
/**

@@ -125,3 +148,3 @@ * If this property describes a filesystem path, use this property to describe

*/
export declare type IJsonPathMetadata = ICustomJsonPathMetadata | INonCustomJsonPathMetadata;
export declare type IJsonPathMetadata<T> = ICustomJsonPathMetadata<T> | INonCustomJsonPathMetadata;
/**

@@ -133,4 +156,4 @@ * Keys in this object are JSONPaths {@link https://jsonpath.com/}, and values are objects

*/
export interface IJsonPathsMetadata {
[jsonPath: string]: IJsonPathMetadata;
export interface IJsonPathsMetadata<TConfigurationFile> {
[jsonPath: string]: IJsonPathMetadata<TConfigurationFile>;
}

@@ -148,3 +171,3 @@ /**

*/
jsonPathMetadata?: IJsonPathsMetadata;
jsonPathMetadata?: IJsonPathsMetadata<TConfigurationFile>;
/**

@@ -151,0 +174,0 @@ * Use this property to control how root-level properties are handled between parent and child

12

lib/ConfigurationFile.js

@@ -219,3 +219,8 @@ "use strict";

callback: (payload, payloadType, fullPayload) => {
const resolvedPath = this._resolvePathProperty(resolvedConfigurationFilePath, fullPayload.path, fullPayload.value, metadata);
const resolvedPath = this._resolvePathProperty({
propertyName: fullPayload.path,
propertyValue: fullPayload.value,
configurationFilePath: resolvedConfigurationFilePath,
configurationFile: configurationJson
}, metadata);
// eslint-disable-next-line @typescript-eslint/no-explicit-any

@@ -301,3 +306,4 @@ fullPayload.parent[fullPayload.parentProperty] = resolvedPath;

}
_resolvePathProperty(configurationFilePath, propertyName, propertyValue, metadata) {
_resolvePathProperty(resolverOptions, metadata) {
const { propertyValue, configurationFilePath } = resolverOptions;
const resolutionMethod = metadata.pathResolutionMethod;

@@ -330,3 +336,3 @@ if (resolutionMethod === undefined) {

}
return metadata.customResolver(configurationFilePath, propertyName, propertyValue);
return metadata.customResolver(resolverOptions);
}

@@ -333,0 +339,0 @@ default: {

@@ -7,3 +7,3 @@ /**

*/
export { ConfigurationFile, IConfigurationFileOptionsBase, IConfigurationFileOptionsWithJsonSchemaFilePath, IConfigurationFileOptionsWithJsonSchemaObject, IConfigurationFileOptions, ICustomJsonPathMetadata, ICustomPropertyInheritance, IJsonPathMetadata, IJsonPathsMetadata, InheritanceType, INonCustomJsonPathMetadata, IOriginalValueOptions, IPropertiesInheritance, IPropertyInheritance, IPropertyInheritanceDefaults, PathResolutionMethod, PropertyInheritanceCustomFunction } from './ConfigurationFile';
export { ConfigurationFile, IConfigurationFileOptionsBase, IConfigurationFileOptionsWithJsonSchemaFilePath, IConfigurationFileOptionsWithJsonSchemaObject, IConfigurationFileOptions, ICustomJsonPathMetadata, ICustomPropertyInheritance, IJsonPathMetadataResolverOptions, IJsonPathMetadata, IJsonPathsMetadata, InheritanceType, INonCustomJsonPathMetadata, IOriginalValueOptions, IPropertiesInheritance, IPropertyInheritance, IPropertyInheritanceDefaults, PathResolutionMethod, PropertyInheritanceCustomFunction } from './ConfigurationFile';
//# sourceMappingURL=index.d.ts.map
{
"name": "@rushstack/heft-config-file",
"version": "0.11.11",
"version": "0.12.0",
"description": "Configuration file loader for @rushstack/heft",

@@ -19,3 +19,3 @@ "repository": {

"jsonpath-plus": "~4.0.0",
"@rushstack/node-core-library": "3.57.0",
"@rushstack/node-core-library": "3.58.0",
"@rushstack/rig-package": "0.3.18"

@@ -22,0 +22,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc