Updated the files.

This commit is contained in:
Batuhan Berk Başoğlu 2024-02-08 19:38:41 -05:00
parent 1553e6b971
commit 753967d4f5
23418 changed files with 3784666 additions and 0 deletions

View file

@ -0,0 +1,35 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Path, schema, virtualFs } from '@angular-devkit/core';
import { workflow } from '@angular-devkit/schematics';
import { FileSystemEngine } from '../description';
import { OptionTransform } from '../file-system-engine-host-base';
import { NodeModulesEngineHost } from '../node-module-engine-host';
export interface NodeWorkflowOptions {
force?: boolean;
dryRun?: boolean;
packageManager?: string;
packageManagerForce?: boolean;
packageRegistry?: string;
registry?: schema.CoreSchemaRegistry;
resolvePaths?: string[];
schemaValidation?: boolean;
optionTransforms?: OptionTransform<Record<string, unknown> | null, object>[];
engineHostCreator?: (options: NodeWorkflowOptions) => NodeModulesEngineHost;
}
/**
* A workflow specifically for Node tools.
*/
export declare class NodeWorkflow extends workflow.BaseWorkflow {
constructor(root: string, options: NodeWorkflowOptions);
constructor(host: virtualFs.Host, options: NodeWorkflowOptions & {
root?: Path;
});
get engine(): FileSystemEngine;
get engineHost(): NodeModulesEngineHost;
}

View file

@ -0,0 +1,68 @@
"use strict";
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.NodeWorkflow = void 0;
const core_1 = require("@angular-devkit/core");
const node_1 = require("@angular-devkit/core/node");
const schematics_1 = require("@angular-devkit/schematics");
const node_2 = require("../../tasks/node");
const node_module_engine_host_1 = require("../node-module-engine-host");
const schema_option_transform_1 = require("../schema-option-transform");
/**
* A workflow specifically for Node tools.
*/
class NodeWorkflow extends schematics_1.workflow.BaseWorkflow {
constructor(hostOrRoot, options) {
let host;
let root;
if (typeof hostOrRoot === 'string') {
root = (0, core_1.normalize)(hostOrRoot);
host = new core_1.virtualFs.ScopedHost(new node_1.NodeJsSyncHost(), root);
}
else {
host = hostOrRoot;
root = options.root;
}
const engineHost = options.engineHostCreator?.(options) || new node_module_engine_host_1.NodeModulesEngineHost(options.resolvePaths);
super({
host,
engineHost,
force: options.force,
dryRun: options.dryRun,
registry: options.registry,
});
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.NodePackage, {
allowPackageManagerOverride: true,
packageManager: options.packageManager,
force: options.packageManagerForce,
rootDirectory: root && (0, core_1.getSystemPath)(root),
registry: options.packageRegistry,
});
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.RepositoryInitializer, {
rootDirectory: root && (0, core_1.getSystemPath)(root),
});
engineHost.registerTaskExecutor(node_2.BuiltinTaskExecutor.RunSchematic);
if (options.optionTransforms) {
for (const transform of options.optionTransforms) {
engineHost.registerOptionsTransform(transform);
}
}
if (options.schemaValidation) {
engineHost.registerOptionsTransform((0, schema_option_transform_1.validateOptionsWithSchema)(this.registry));
}
this._context = [];
}
get engine() {
return this._engine;
}
get engineHost() {
return this._engineHost;
}
}
exports.NodeWorkflow = NodeWorkflow;