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

@rushstack/heft

Package Overview
Dependencies
Maintainers
3
Versions
358
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rushstack/heft - npm Package Compare versions

Comparing version 0.48.0-dev.0 to 0.48.0-dev.1

2

lib/operations/runners/LifecycleOperationRunner.js

@@ -41,3 +41,3 @@ "use strict";

for (const pluginDefinition of lifecycle.pluginDefinitions) {
const { lifecycleSession } = await lifecycle.getContextForPluginDefinitionAsync(pluginDefinition);
const lifecycleSession = await lifecycle.getSessionForPluginDefinitionAsync(pluginDefinition);
deleteOperations.push({ sourcePath: lifecycleSession.tempFolderPath });

@@ -44,0 +44,0 @@ // Also delete the cache folder if requested

@@ -5,6 +5,6 @@ import { HeftPluginHost } from './HeftPluginHost';

import type { HeftLifecyclePluginDefinition } from '../configuration/HeftPluginDefinition';
import { HeftLifecycleSession, type IHeftLifecycleHooks } from './HeftLifecycleSession';
import { HeftLifecycleSession, type IHeftLifecycleHooks, type IHeftLifecycleSession } from './HeftLifecycleSession';
export interface IHeftLifecycleContext {
lifecycleSession: HeftLifecycleSession;
pluginOptions?: object;
lifecycleSession?: HeftLifecycleSession;
pluginOptions: object | undefined;
}

@@ -21,7 +21,7 @@ export declare class HeftLifecycle extends HeftPluginHost {

constructor(internalHeftSession: InternalHeftSession, lifecyclePluginSpecifiers: IHeftConfigurationJsonPluginSpecifier[]);
applyPluginsInternalAsync(): Promise<void>;
protected applyPluginsInternalAsync(): Promise<void>;
ensureInitializedAsync(): Promise<void>;
getContextForPluginDefinitionAsync(pluginDefinition: HeftLifecyclePluginDefinition): Promise<IHeftLifecycleContext>;
getSessionForPluginDefinitionAsync(pluginDefinition: HeftLifecyclePluginDefinition): Promise<IHeftLifecycleSession>;
private _getLifecyclePluginForPluginDefinitionAsync;
}
//# sourceMappingURL=HeftLifecycle.d.ts.map

@@ -39,4 +39,18 @@ "use strict";

const loadPluginPromises = [];
for (const [pluginDefinition] of this._lifecycleContextByDefinition) {
loadPluginPromises.push(this._getLifecyclePluginForPluginDefinitionAsync(pluginDefinition));
for (const [pluginDefinition, lifecycleContext] of this._lifecycleContextByDefinition) {
if (!lifecycleContext.lifecycleSession) {
// Generate the plugin-specific session
lifecycleContext.lifecycleSession = new HeftLifecycleSession_1.HeftLifecycleSession({
debug: this._internalHeftSession.debug,
heftConfiguration: this._internalHeftSession.heftConfiguration,
loggingManager: this._internalHeftSession.loggingManager,
metricsCollector: this._internalHeftSession.metricsCollector,
logger: this._internalHeftSession.loggingManager.requestScopedLogger(`lifecycle:${pluginDefinition.pluginName}`),
lifecycleHooks: this.hooks,
lifecycleParameters: this._internalHeftSession.parameterManager.getParametersForPlugin(pluginDefinition),
pluginDefinition: pluginDefinition,
pluginHost: this
});
}
loadPluginPromises.push(this._getLifecyclePluginForPluginDefinitionAsync(pluginDefinition, lifecycleContext.lifecycleSession));
}

@@ -50,2 +64,3 @@ // Promise.all maintains the order of the input array

try {
// Apply the plugin. We know the session should exist because we generated it above.
lifecyclePlugin.apply(lifecycleContext.lifecycleSession, this._internalHeftSession.heftConfiguration, lifecycleContext.pluginOptions);

@@ -91,17 +106,7 @@ }

}
// Generate the plugin-specific session
const lifecycleSession = new HeftLifecycleSession_1.HeftLifecycleSession({
debug: this._internalHeftSession.debug,
heftConfiguration: this._internalHeftSession.heftConfiguration,
loggingManager: this._internalHeftSession.loggingManager,
metricsCollector: this._internalHeftSession.metricsCollector,
logger: this._internalHeftSession.loggingManager.requestScopedLogger(`lifecycle:${pluginDefinition.pluginName}`),
lifecycleHooks: this.hooks,
lifecycleParameters: this._internalHeftSession.parameterManager.getParametersForPlugin(pluginDefinition),
pluginDefinition: pluginDefinition,
pluginHost: this
});
// Validate the plugin options
const pluginOptions = pluginSpecifier.options;
// Set the context
const lifecycleContext = { lifecycleSession, pluginOptions };
pluginDefinition.validateOptions(pluginOptions);
// Partially populate the context. The session will be populated while applying the plugins.
const lifecycleContext = { lifecycleSession: undefined, pluginOptions };
this._lifecycleContextByDefinition.set(pluginDefinition, lifecycleContext);

@@ -111,3 +116,3 @@ }

}
async getContextForPluginDefinitionAsync(pluginDefinition) {
async getSessionForPluginDefinitionAsync(pluginDefinition) {
await this.ensureInitializedAsync();

@@ -118,10 +123,11 @@ const lifecycleContext = this._lifecycleContextByDefinition.get(pluginDefinition);

}
return lifecycleContext;
if (!lifecycleContext.lifecycleSession) {
throw new node_core_library_1.InternalError(`Lifecycle session for plugin ${JSON.stringify(pluginDefinition.pluginName)} has not been created yet.`);
}
return lifecycleContext.lifecycleSession;
}
async _getLifecyclePluginForPluginDefinitionAsync(pluginDefinition) {
async _getLifecyclePluginForPluginDefinitionAsync(pluginDefinition, lifecycleSession) {
let lifecyclePlugin = this._lifecyclePluginsByDefinition.get(pluginDefinition);
if (!lifecyclePlugin) {
// Need to obtain the plugin logger from the session
const lifecycleContext = await this.getContextForPluginDefinitionAsync(pluginDefinition);
lifecyclePlugin = await pluginDefinition.loadPluginAsync(lifecycleContext.lifecycleSession.logger);
lifecyclePlugin = await pluginDefinition.loadPluginAsync(lifecycleSession.logger);
this._lifecyclePluginsByDefinition.set(pluginDefinition, lifecyclePlugin);

@@ -128,0 +134,0 @@ }

@@ -31,4 +31,4 @@ import { AsyncParallelHook } from 'tapable';

*/
applyPluginsInternalAsync(): Promise<void>;
protected applyPluginsInternalAsync(): Promise<void>;
}
//# sourceMappingURL=HeftPhaseSession.d.ts.map

@@ -31,2 +31,5 @@ "use strict";

const internalHeftSession = new InternalHeftSession(heftConfigurationJson, options);
// Initialize the lifecycle and the tasks. This will ensure that we throw an error if a plugin is improperly
// specified, or if the options provided to a plugin are invalid. We will avoid loading the actual plugins
// until they are needed.
await internalHeftSession.lifecycle.ensureInitializedAsync();

@@ -33,0 +36,0 @@ const tasks = getAllTasks(internalHeftSession.phases);

{
"name": "@rushstack/heft",
"version": "0.48.0-dev.0",
"version": "0.48.0-dev.1",
"description": "Build all your JavaScript projects the same way: A way that works.",

@@ -5,0 +5,0 @@ "keywords": [

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

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