@angular-devkit/core
- Version 19.0.5
- Published
- 260 kB
- 6 dependencies
- MIT license
Install
npm i @angular-devkit/core
yarn add @angular-devkit/core
pnpm add @angular-devkit/core
Overview
Angular DevKit - Core Utility Library
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Namespaces
schema
- buildJsonPointer()
- CoreSchemaRegistry
- getTypesOfSchema()
- isJsonSchema()
- joinJsonPointer()
- JsonPointer
- JsonSchema
- JsonSchemaVisitor
- JsonVisitor
- mergeSchemas()
- parseJsonPointer()
- PromptDefinition
- PromptProvider
- ReferenceResolver
- SchemaFormat
- SchemaFormatter
- SchemaKeywordValidator
- SchemaRegistry
- SchemaValidationException
- SchemaValidator
- SchemaValidatorError
- SchemaValidatorOptions
- SchemaValidatorResult
- SmartDefaultProvider
- UriHandler
- visitJson()
- visitJsonSchema()
schema
- buildJsonPointer()
- CoreSchemaRegistry
- getTypesOfSchema()
- isJsonSchema()
- joinJsonPointer()
- JsonPointer
- JsonSchema
- JsonSchemaVisitor
- JsonVisitor
- mergeSchemas()
- parseJsonPointer()
- PromptDefinition
- PromptProvider
- ReferenceResolver
- SchemaFormat
- SchemaFormatter
- SchemaKeywordValidator
- SchemaRegistry
- SchemaValidationException
- SchemaValidator
- SchemaValidatorError
- SchemaValidatorOptions
- SchemaValidatorResult
- SmartDefaultProvider
- UriHandler
- visitJson()
- visitJsonSchema()
virtualFs
- AliasHost
- CordHost
- CordHostCreate
- CordHostDelete
- CordHostOverwrite
- CordHostRecord
- CordHostRename
- createSyncHost()
- Empty
- FileBuffer
- FileBufferLike
- fileBufferToString()
- Host
- HostCapabilities
- HostWatchEvent
- HostWatchEventType
- HostWatchOptions
- PatternMatchingHost
- ReadonlyHost
- ReplacementFunction
- ResolverHost
- SafeReadonlyHost
- ScopedHost
- SimpleMemoryHost
- SimpleMemoryHostStats
- Stats
- stringToFileBuffer()
- SyncDelegateHost
- SyncHostHandler
- SynchronousDelegateExpectedException
Variables
variable NormalizedRoot
const NormalizedRoot: String & { __PRIVATE_DEVKIT_PATH: void };
The root of a normalized path. {Path}
variable NormalizedSep
const NormalizedSep: String & { __PRIVATE_DEVKIT_PATH: void };
The Separator for normalized path. {Path}
variable path
const path: TemplateTag<Path>;
Functions
function asPosixPath
asPosixPath: (path: Path) => PosixPath;
function asWindowsPath
asWindowsPath: (path: Path) => WindowsPath;
function basename
basename: (path: Path) => PathFragment;
Return the basename of the path, as a Path. See path.basename
function deepCopy
deepCopy: <T>(value: T) => T;
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.dev/license
function dirname
dirname: (path: Path) => Path;
Return the dirname of the path, as a Path. See path.dirname
function extname
extname: (path: Path) => string;
function fragment
fragment: (path: string) => PathFragment;
function getSystemPath
getSystemPath: (path: Path) => string;
function isAbsolute
isAbsolute: (p: Path) => boolean;
Returns true if a path is absolute.
function isJsonArray
isJsonArray: (value: JsonValue) => value is JsonArray;
function isJsonObject
isJsonObject: (value: JsonValue) => value is JsonObject;
function isPromise
isPromise: (obj: any) => obj is Promise<any>;
Determine if the argument is shaped like a Promise
function join
join: (p1: Path, ...others: string[]) => Path;
Join multiple paths together, and normalize the result. Accepts strings that will be normalized as well (but the original must be a path).
function noCacheNormalize
noCacheNormalize: (path: string) => Path;
The no cache version of the normalize() function. Used for benchmarking and testing.
function normalize
normalize: (path: string) => Path;
Normalize a string into a Path. This is the only mean to get a Path type from a string that represents a system path. This method cache the results as real world paths tend to be duplicated often. Normalization includes: - Windows backslashes
\\
are replaced with/
. - Windows drivers are replaced with/X/
, where X is the drive letter. - Absolute paths starts with/
. - Multiple/
are replaced by a single one. - Path segments.
are removed. - Path segments..
are resolved. - If a path is absolute, having a..
at the start is invalid (and will throw).Parameter path
The path to be normalized.
function relative
relative: (from: Path, to: Path) => Path;
Returns a path such that
join(from, relative(from, to)) == to
. Both paths must be absolute, otherwise it does not make much sense.
function resetNormalizeCache
resetNormalizeCache: () => void;
Reset the cache. This is only useful for testing.
function resolve
resolve: (p1: Path, p2: Path) => Path;
Returns a Path that is the resolution of p2, from p1. If p2 is absolute, it will return p2, otherwise will join both p1 and p2.
function split
split: (path: Path) => PathFragment[];
Split a path into multiple path fragments. Each fragments except the last one will end with a path separator.
Parameter path
The path to split.
Returns
{Path[]} An array of path fragments.
function template
template: <T>( content: string, options?: TemplateOptions) => (input: T) => string;
An equivalent of EJS templates, which is based on John Resig's
tmpl
implementation (http://ejohn.org/blog/javascript-micro-templating/) and Laura Doktorova's doT.js (https://github.com/olado/doT).This version differs from lodash by removing support from ES6 quasi-literals, and making the code slightly simpler to follow. It also does not depend on any third party, which is nice.
Finally, it supports SourceMap, if you ever need to debug, which is super nice.
Parameter content
The template content.
Parameter options
Optional Options. See TemplateOptions for more description. {(input: T) => string} A function that accept an input object and returns the content of the template with the input applied.
function templateParser
templateParser: (sourceText: string, fileName: string) => TemplateAst;
Given a source text (and a fileName), returns a TemplateAst.
Classes
class BaseException
class BaseException extends Error {}
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.dev/license
constructor
constructor(message?: string);
class CircularDependencyFoundException
class CircularDependencyFoundException extends BaseException {}
constructor
constructor();
class DependencyNotFoundException
class DependencyNotFoundException extends BaseException {}
constructor
constructor();
class FileAlreadyExistException
class FileAlreadyExistException extends BaseException {}
constructor
constructor(path: string);
class FileDoesNotExistException
class FileDoesNotExistException extends BaseException {}
constructor
constructor(path: string);
class InvalidPathException
class InvalidPathException extends BaseException {}
constructor
constructor(path: string);
class PartiallyOrderedSet
class PartiallyOrderedSet<T> implements Set<T> {}
property [Symbol.toStringTag]
readonly [Symbol.toStringTag]: string;
property size
readonly size: number;
method [Symbol.iterator]
[Symbol.iterator]: () => Generator<T, undefined, unknown>;
method add
add: (item: T, deps?: Set<T> | T[]) => this;
method clear
clear: () => void;
method delete
delete: (item: T) => boolean;
method entries
entries: () => SetIterator<[T, T]>;
Returns an iterable of [v,v] pairs for every value
v
in the set.
method forEach
forEach: ( callbackfn: (value: T, value2: T, set: PartiallyOrderedSet<T>) => void, thisArg?: any) => void;
method has
has: (item: T) => boolean;
method keys
keys: () => SetIterator<T>;
Despite its name, returns an iterable of the values in the set,
method values
values: () => SetIterator<T>;
Returns an iterable of values in the set.
class PathCannotBeFragmentException
class PathCannotBeFragmentException extends BaseException {}
constructor
constructor(path: string);
class PathIsDirectoryException
class PathIsDirectoryException extends BaseException {}
constructor
constructor(path: string);
class PathIsFileException
class PathIsFileException extends BaseException {}
constructor
constructor(path: string);
class PathMustBeAbsoluteException
class PathMustBeAbsoluteException extends BaseException {}
constructor
constructor(path: string);
class PriorityQueue
class PriorityQueue<T> {}
Naive priority queue; not intended for large datasets
class UnknownException
class UnknownException extends BaseException {}
constructor
constructor(message: string);
Interfaces
interface JsonArray
interface JsonArray extends Array<JsonValue> {}
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.dev/license
interface JsonObject
interface JsonObject {}
index signature
[prop: string]: JsonValue;
interface TemplateAst
interface TemplateAst {}
A simple AST for templates. There's only one level of AST nodes, but it's still useful to have the information you're looking for.
interface TemplateAstBase
interface TemplateAstBase {}
The base, which contains positions.
interface TemplateAstComment
interface TemplateAstComment extends TemplateAstBase {}
A comment node.
interface TemplateAstContent
interface TemplateAstContent extends TemplateAstBase {}
A static content node.
interface TemplateAstEscape
interface TemplateAstEscape extends TemplateAstBase {}
An escape node, which is the code between
<%- ... %>
.
property expression
expression: string;
property kind
kind: 'escape';
interface TemplateAstEvaluate
interface TemplateAstEvaluate extends TemplateAstBase {}
An evaluate node, which is the code between
<% ... %>
.
property expression
expression: string;
property kind
kind: 'evaluate';
interface TemplateAstInterpolate
interface TemplateAstInterpolate extends TemplateAstBase {}
An interpolation node, which is the code between
<%= ... %>
.
property expression
expression: string;
property kind
kind: 'interpolate';
interface TemplateOptions
interface TemplateOptions {}
property fileName
fileName?: string;
property module
module?: | boolean | { exports: {}; };
property sourceMap
sourceMap?: boolean;
property sourceRoot
sourceRoot?: string;
property sourceURL
sourceURL?: string;
Type Aliases
type JsonValue
type JsonValue = boolean | string | number | JsonArray | JsonObject | null;
type Path
type Path = string & { __PRIVATE_DEVKIT_PATH: void;};
A Path recognized by most methods in the DevKit.
type PathFragment
type PathFragment = Path & { __PRIVATE_DEVKIT_PATH_FRAGMENT: void;};
A Path fragment (file or directory name) recognized by most methods in the DevKit.
type PosixPath
type PosixPath = string & { __PRIVATE_DEVKIT_POSIX_PATH: void;};
type TemplateAstNode
type TemplateAstNode = | TemplateAstContent | TemplateAstEvaluate | TemplateAstComment | TemplateAstEscape | TemplateAstInterpolate;
type WindowsPath
type WindowsPath = string & { __PRIVATE_DEVKIT_WINDOWS_PATH: void;};
Namespaces
namespace json
module 'src/json/index.d.ts' {}
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.dev/license
function isJsonArray
isJsonArray: (value: JsonValue) => value is JsonArray;
function isJsonObject
isJsonObject: (value: JsonValue) => value is JsonObject;
interface JsonArray
interface JsonArray extends Array<JsonValue> {}
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.dev/license
interface JsonObject
interface JsonObject {}
index signature
[prop: string]: JsonValue;
type JsonValue
type JsonValue = boolean | string | number | JsonArray | JsonObject | null;
namespace schema
module 'src/json/schema/index.d.ts' {}
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.dev/license
function buildJsonPointer
buildJsonPointer: (fragments: string[]) => JsonPointer;
function getTypesOfSchema
getTypesOfSchema: (schema: JsonSchema) => Set<string>;
function isJsonSchema
isJsonSchema: (value: unknown) => value is JsonSchema;
function joinJsonPointer
joinJsonPointer: (root: JsonPointer, ...others: string[]) => JsonPointer;
function mergeSchemas
mergeSchemas: (...schemas: (JsonSchema | undefined)[]) => JsonSchema;
Return a schema that is the merge of all subschemas, ie. it should validate all the schemas that were passed in. It is possible to make an invalid schema this way, e.g. by using
mergeSchemas({ type: 'number' }, { type: 'string' })
, which will never validate.Parameter schemas
All schemas to be merged.
function parseJsonPointer
parseJsonPointer: (pointer: JsonPointer) => string[];
function visitJson
visitJson: <ContextT>( json: JsonValue, visitor: JsonVisitor, schema?: JsonSchema, refResolver?: ReferenceResolver<ContextT>, context?: ContextT) => Observable<JsonValue>;
Visit all the properties in a JSON object, allowing to transform them. It supports calling properties synchronously or asynchronously (through Observables). The original object can be mutated or replaced entirely. In case where it's replaced, the new value is returned. When it's mutated though the original object will be changed.
Please note it is possible to have an infinite loop here (which will result in a stack overflow) if you return 2 objects that references each others (or the same object all the time).
Parameter json
The Json value to visit.
Parameter visitor
A function that will be called on every items.
Parameter schema
A JSON schema to pass through to the visitor (where possible).
Parameter refResolver
a function to resolve references in the schema.
Returns
{Observable< | undefined>} The observable of the new root, if the root changed.
function visitJsonSchema
visitJsonSchema: (schema: JsonSchema, visitor: JsonSchemaVisitor) => void;
class CoreSchemaRegistry
class CoreSchemaRegistry implements SchemaRegistry {}
constructor
constructor(formats?: SchemaFormat[]);
method addFormat
addFormat: (format: SchemaFormat) => void;
method addPostTransform
addPostTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step after the validation of any Json. The JSON will not be validated after the POST, so if transformations are not compatible with the Schema it will not result in an error.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addPreTransform
addPreTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step before the validation of any Json.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addSmartDefaultProvider
addSmartDefaultProvider: <T>( source: string, provider: SmartDefaultProvider<T>) => void;
method compile
compile: (schema: JsonSchema) => Promise<SchemaValidator>;
Compile and return a validation function for the Schema.
Parameter schema
The schema to validate. If a string, will fetch the schema before compiling it (using schema as a URI).
method ɵflatten
ɵflatten: (schema: JsonObject) => Promise<JsonObject>;
Flatten the Schema, resolving and replacing all the refs. Makes it into a synchronous schema that is also easier to traverse. Does not cache the result.
Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original. See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2
Parameter schema
The schema or URI to flatten.
Returns
An Observable of the flattened schema object. since 11.2 without replacement.
method registerUriHandler
registerUriHandler: (handler: UriHandler) => void;
method usePromptProvider
usePromptProvider: (provider: PromptProvider) => void;
method useXDeprecatedProvider
useXDeprecatedProvider: (onUsage: (message: string) => void) => void;
class SchemaValidationException
class SchemaValidationException extends BaseException {}
constructor
constructor(errors?: ErrorObject[], baseMessage?: string);
property errors
readonly errors: ErrorObject[];
method createMessages
static createMessages: (errors?: SchemaValidatorError[]) => string[];
interface JsonSchemaVisitor
interface JsonSchemaVisitor {}
call signature
( current: JsonObject | JsonArray, pointer: JsonPointer, parentSchema?: JsonObject | JsonArray, index?: string): void;
interface JsonVisitor
interface JsonVisitor {}
call signature
( value: JsonValue, pointer: JsonPointer, schema?: JsonObject, root?: JsonObject | JsonArray): Observable<JsonValue> | JsonValue;
interface PromptDefinition
interface PromptDefinition {}
property default
default?: string | string[] | number | boolean | null;
property id
id: string;
property items
items?: Array< | string | { value: JsonValue; label: string; }>;
property message
message: string;
property multiselect
multiselect?: boolean;
property propertyTypes
propertyTypes: Set<string>;
property raw
raw?: string | JsonObject;
property type
type: string;
property validator
validator?: (value: JsonValue) => boolean | string | Promise<boolean | string>;
interface ReferenceResolver
interface ReferenceResolver<ContextT> {}
call signature
(ref: string, context?: ContextT): { context?: ContextT; schema?: JsonObject;};
interface SchemaFormat
interface SchemaFormat {}
interface SchemaKeywordValidator
interface SchemaKeywordValidator {}
call signature
( data: JsonValue, schema: JsonValue, parent: JsonObject | JsonArray | undefined, parentProperty: string | number | undefined, pointer: JsonPointer, rootData: JsonValue): boolean | Observable<boolean>;
interface SchemaRegistry
interface SchemaRegistry {}
method addFormat
addFormat: (format: SchemaFormat) => void;
method addPostTransform
addPostTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step after the validation of any Json. The JSON will not be validated after the POST, so if transformations are not compatible with the Schema it will not result in an error.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addPreTransform
addPreTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step before the validation of any Json.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addSmartDefaultProvider
addSmartDefaultProvider: <T>( source: string, provider: SmartDefaultProvider<T>) => void;
method compile
compile: (schema: Object) => Promise<SchemaValidator>;
method ɵflatten
ɵflatten: (schema: JsonObject | string) => Promise<JsonObject>;
method usePromptProvider
usePromptProvider: (provider: PromptProvider) => void;
method useXDeprecatedProvider
useXDeprecatedProvider: (onUsage: (message: string) => void) => void;
interface SchemaValidator
interface SchemaValidator {}
call signature
( data: JsonValue, options?: SchemaValidatorOptions): Promise<SchemaValidatorResult>;
interface SchemaValidatorOptions
interface SchemaValidatorOptions {}
property applyPostTransforms
applyPostTransforms?: boolean;
property applyPreTransforms
applyPreTransforms?: boolean;
property withPrompts
withPrompts?: boolean;
interface SchemaValidatorResult
interface SchemaValidatorResult {}
interface SmartDefaultProvider
interface SmartDefaultProvider<T> {}
call signature
(schema: JsonObject): T | Observable<T>;
type JsonPointer
type JsonPointer = string & { __PRIVATE_DEVKIT_JSON_POINTER: void;};
type JsonSchema
type JsonSchema = JsonObject | boolean;
A specialized interface for JsonSchema (to come). JsonSchemas are also JsonObject.
Modifiers
@public
type PromptProvider
type PromptProvider = (definitions: Array<PromptDefinition>) => ObservableInput<{ [id: string]: JsonValue;}>;
type SchemaFormatter
type SchemaFormatter = Format;
type SchemaValidatorError
type SchemaValidatorError = Partial<ErrorObject>;
type UriHandler
type UriHandler = ( uri: string) => Observable<JsonObject> | Promise<JsonObject> | null | undefined;
namespace transforms
module 'src/json/schema/transforms.d.ts' {}
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.dev/license
function addUndefinedDefaults
addUndefinedDefaults: ( value: JsonValue, _pointer: JsonPointer, schema?: JsonSchema) => JsonValue;
namespace logging
module 'src/logger/index.d.ts' {}
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.dev/license
class IndentLogger
class IndentLogger extends Logger {}
constructor
constructor(name: string, parent?: Logger, indentation?: string);
class LevelCapLogger
class LevelCapLogger extends LevelTransformLogger {}
constructor
constructor(name: string, parent: Logger, levelCap: LogLevel);
property levelCap
readonly levelCap: LogLevel;
property levelMap
static levelMap: { [cap: string]: { [level: string]: string } };
property name
readonly name: string;
property parent
readonly parent: Logger;
class LevelTransformLogger
class LevelTransformLogger extends Logger {}
constructor
constructor( name: string, parent: Logger, levelTransform: (level: LogLevel) => LogLevel);
property levelTransform
readonly levelTransform: (level: LogLevel) => LogLevel;
property name
readonly name: string;
property parent
readonly parent: Logger;
method createChild
createChild: (name: string) => Logger;
method log
log: (level: LogLevel, message: string, metadata?: JsonObject) => void;
class Logger
class Logger extends Observable<LogEntry> implements LoggerApi {}
constructor
constructor(name: string, parent?: Logger);
property name
readonly name: string;
property parent
readonly parent: Logger;
method asApi
asApi: () => LoggerApi;
method complete
complete: () => void;
method createChild
createChild: (name: string) => Logger;
method debug
debug: (message: string, metadata?: JsonObject) => void;
method error
error: (message: string, metadata?: JsonObject) => void;
method fatal
fatal: (message: string, metadata?: JsonObject) => void;
method forEach
forEach: ( next: (value: LogEntry) => void, promiseCtor?: PromiseConstructorLike) => Promise<void>;
method info
info: (message: string, metadata?: JsonObject) => void;
method lift
lift: <R>(operator: Operator<LogEntry, R>) => Observable<R>;
method log
log: (level: LogLevel, message: string, metadata?: JsonObject) => void;
method next
next: (entry: LogEntry) => void;
method subscribe
subscribe: { (): Subscription; (observer: PartialObserver<LogEntry>): Subscription; ( next?: (value: LogEntry) => void, error?: (error: Error) => void, complete?: () => void ): Subscription;};
method toString
toString: () => string;
method warn
warn: (message: string, metadata?: JsonObject) => void;
class NullLogger
class NullLogger extends Logger {}
constructor
constructor(parent?: Logger);
method asApi
asApi: () => LoggerApi;
class TransformLogger
class TransformLogger extends Logger {}
constructor
constructor( name: string, transform: (stream: Observable<LogEntry>) => Observable<LogEntry>, parent?: Logger);
interface LogEntry
interface LogEntry extends LoggerMetadata {}
interface LoggerApi
interface LoggerApi {}
method createChild
createChild: (name: string) => Logger;
method debug
debug: (message: string, metadata?: JsonObject) => void;
method error
error: (message: string, metadata?: JsonObject) => void;
method fatal
fatal: (message: string, metadata?: JsonObject) => void;
method info
info: (message: string, metadata?: JsonObject) => void;
method log
log: (level: LogLevel, message: string, metadata?: JsonObject) => void;
method warn
warn: (message: string, metadata?: JsonObject) => void;
interface LoggerMetadata
interface LoggerMetadata extends JsonObject {}
type LogLevel
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
namespace schema
module 'src/json/schema/index.d.ts' {}
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.dev/license
function buildJsonPointer
buildJsonPointer: (fragments: string[]) => JsonPointer;
function getTypesOfSchema
getTypesOfSchema: (schema: JsonSchema) => Set<string>;
function isJsonSchema
isJsonSchema: (value: unknown) => value is JsonSchema;
function joinJsonPointer
joinJsonPointer: (root: JsonPointer, ...others: string[]) => JsonPointer;
function mergeSchemas
mergeSchemas: (...schemas: (JsonSchema | undefined)[]) => JsonSchema;
Return a schema that is the merge of all subschemas, ie. it should validate all the schemas that were passed in. It is possible to make an invalid schema this way, e.g. by using
mergeSchemas({ type: 'number' }, { type: 'string' })
, which will never validate.Parameter schemas
All schemas to be merged.
function parseJsonPointer
parseJsonPointer: (pointer: JsonPointer) => string[];
function visitJson
visitJson: <ContextT>( json: JsonValue, visitor: JsonVisitor, schema?: JsonSchema, refResolver?: ReferenceResolver<ContextT>, context?: ContextT) => Observable<JsonValue>;
Visit all the properties in a JSON object, allowing to transform them. It supports calling properties synchronously or asynchronously (through Observables). The original object can be mutated or replaced entirely. In case where it's replaced, the new value is returned. When it's mutated though the original object will be changed.
Please note it is possible to have an infinite loop here (which will result in a stack overflow) if you return 2 objects that references each others (or the same object all the time).
Parameter json
The Json value to visit.
Parameter visitor
A function that will be called on every items.
Parameter schema
A JSON schema to pass through to the visitor (where possible).
Parameter refResolver
a function to resolve references in the schema.
Returns
{Observable< | undefined>} The observable of the new root, if the root changed.
function visitJsonSchema
visitJsonSchema: (schema: JsonSchema, visitor: JsonSchemaVisitor) => void;
class CoreSchemaRegistry
class CoreSchemaRegistry implements SchemaRegistry {}
constructor
constructor(formats?: SchemaFormat[]);
method addFormat
addFormat: (format: SchemaFormat) => void;
method addPostTransform
addPostTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step after the validation of any Json. The JSON will not be validated after the POST, so if transformations are not compatible with the Schema it will not result in an error.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addPreTransform
addPreTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step before the validation of any Json.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addSmartDefaultProvider
addSmartDefaultProvider: <T>( source: string, provider: SmartDefaultProvider<T>) => void;
method compile
compile: (schema: JsonSchema) => Promise<SchemaValidator>;
Compile and return a validation function for the Schema.
Parameter schema
The schema to validate. If a string, will fetch the schema before compiling it (using schema as a URI).
method ɵflatten
ɵflatten: (schema: JsonObject) => Promise<JsonObject>;
Flatten the Schema, resolving and replacing all the refs. Makes it into a synchronous schema that is also easier to traverse. Does not cache the result.
Producing a flatten schema document does not in all cases produce a schema with identical behavior to the original. See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2
Parameter schema
The schema or URI to flatten.
Returns
An Observable of the flattened schema object. since 11.2 without replacement.
method registerUriHandler
registerUriHandler: (handler: UriHandler) => void;
method usePromptProvider
usePromptProvider: (provider: PromptProvider) => void;
method useXDeprecatedProvider
useXDeprecatedProvider: (onUsage: (message: string) => void) => void;
class SchemaValidationException
class SchemaValidationException extends BaseException {}
constructor
constructor(errors?: ErrorObject[], baseMessage?: string);
property errors
readonly errors: ErrorObject[];
method createMessages
static createMessages: (errors?: SchemaValidatorError[]) => string[];
interface JsonSchemaVisitor
interface JsonSchemaVisitor {}
call signature
( current: JsonObject | JsonArray, pointer: JsonPointer, parentSchema?: JsonObject | JsonArray, index?: string): void;
interface JsonVisitor
interface JsonVisitor {}
call signature
( value: JsonValue, pointer: JsonPointer, schema?: JsonObject, root?: JsonObject | JsonArray): Observable<JsonValue> | JsonValue;
interface PromptDefinition
interface PromptDefinition {}
property default
default?: string | string[] | number | boolean | null;
property id
id: string;
property items
items?: Array< | string | { value: JsonValue; label: string; }>;
property message
message: string;
property multiselect
multiselect?: boolean;
property propertyTypes
propertyTypes: Set<string>;
property raw
raw?: string | JsonObject;
property type
type: string;
property validator
validator?: (value: JsonValue) => boolean | string | Promise<boolean | string>;
interface ReferenceResolver
interface ReferenceResolver<ContextT> {}
call signature
(ref: string, context?: ContextT): { context?: ContextT; schema?: JsonObject;};
interface SchemaFormat
interface SchemaFormat {}
interface SchemaKeywordValidator
interface SchemaKeywordValidator {}
call signature
( data: JsonValue, schema: JsonValue, parent: JsonObject | JsonArray | undefined, parentProperty: string | number | undefined, pointer: JsonPointer, rootData: JsonValue): boolean | Observable<boolean>;
interface SchemaRegistry
interface SchemaRegistry {}
method addFormat
addFormat: (format: SchemaFormat) => void;
method addPostTransform
addPostTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step after the validation of any Json. The JSON will not be validated after the POST, so if transformations are not compatible with the Schema it will not result in an error.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addPreTransform
addPreTransform: (visitor: JsonVisitor, deps?: JsonVisitor[]) => void;
Add a transformation step before the validation of any Json.
Parameter visitor
The visitor to transform every value.
Parameter deps
A list of other visitors to run before.
method addSmartDefaultProvider
addSmartDefaultProvider: <T>( source: string, provider: SmartDefaultProvider<T>) => void;
method compile
compile: (schema: Object) => Promise<SchemaValidator>;
method ɵflatten
ɵflatten: (schema: JsonObject | string) => Promise<JsonObject>;
method usePromptProvider
usePromptProvider: (provider: PromptProvider) => void;
method useXDeprecatedProvider
useXDeprecatedProvider: (onUsage: (message: string) => void) => void;
interface SchemaValidator
interface SchemaValidator {}
call signature
( data: JsonValue, options?: SchemaValidatorOptions): Promise<SchemaValidatorResult>;
interface SchemaValidatorOptions
interface SchemaValidatorOptions {}
property applyPostTransforms
applyPostTransforms?: boolean;
property applyPreTransforms
applyPreTransforms?: boolean;
property withPrompts
withPrompts?: boolean;
interface SchemaValidatorResult
interface SchemaValidatorResult {}
interface SmartDefaultProvider
interface SmartDefaultProvider<T> {}
call signature
(schema: JsonObject): T | Observable<T>;
type JsonPointer
type JsonPointer = string & { __PRIVATE_DEVKIT_JSON_POINTER: void;};
type JsonSchema
type JsonSchema = JsonObject | boolean;
A specialized interface for JsonSchema (to come). JsonSchemas are also JsonObject.
Modifiers
@public
type PromptProvider
type PromptProvider = (definitions: Array<PromptDefinition>) => ObservableInput<{ [id: string]: JsonValue;}>;
type SchemaFormatter
type SchemaFormatter = Format;
type SchemaValidatorError
type SchemaValidatorError = Partial<ErrorObject>;
type UriHandler
type UriHandler = ( uri: string) => Observable<JsonObject> | Promise<JsonObject> | null | undefined;
namespace transforms
module 'src/json/schema/transforms.d.ts' {}
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.dev/license
function addUndefinedDefaults
addUndefinedDefaults: ( value: JsonValue, _pointer: JsonPointer, schema?: JsonSchema) => JsonValue;
namespace strings
module 'src/utils/strings.d.ts' {}
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.dev/license
function camelize
camelize: (str: string) => string;
Returns the lowerCamelCase form of a string.
```javascript camelize('innerHTML'); // 'innerHTML' camelize('action_name'); // 'actionName' camelize('css-class-name'); // 'cssClassName' camelize('my favorite items'); // 'myFavoriteItems' camelize('My Favorite Items'); // 'myFavoriteItems' ```
camelize
Parameter str
The string to camelize. {String} the camelized string.
function capitalize
capitalize: (str: string) => string;
Returns the Capitalized form of a string
```javascript 'innerHTML'.capitalize() // 'InnerHTML' 'action_name'.capitalize() // 'Action_name' 'css-class-name'.capitalize() // 'Css-class-name' 'my favorite items'.capitalize() // 'My favorite items' ```
capitalize
Parameter str
The string to capitalize. {String} The capitalized string.
function classify
classify: (str: string) => string;
Returns the UpperCamelCase form of a string.
Parameter str
the string to classify {String} the classified string
Example 1
```javascript 'innerHTML'.classify(); // 'InnerHTML' 'action_name'.classify(); // 'ActionName' 'css-class-name'.classify(); // 'CssClassName' 'my favorite items'.classify(); // 'MyFavoriteItems' 'app.component'.classify(); // 'AppComponent' ``` classify
function dasherize
dasherize: (str: string) => string;
Replaces underscores, spaces, or camelCase with dashes.
```javascript dasherize('innerHTML'); // 'inner-html' dasherize('action_name'); // 'action-name' dasherize('css-class-name'); // 'css-class-name' dasherize('my favorite items'); // 'my-favorite-items' ```
dasherize
Parameter str
The string to dasherize. {String} the dasherized string.
function decamelize
decamelize: (str: string) => string;
Converts a camelized string into all lower case separated by underscores.
```javascript decamelize('innerHTML'); // 'inner_html' decamelize('action_name'); // 'action_name' decamelize('css-class-name'); // 'css-class-name' decamelize('my favorite items'); // 'my favorite items' ```
decamelize
Parameter str
The string to decamelize. {String} the decamelized string.
function levenshtein
levenshtein: (a: string, b: string) => number;
Calculate the levenshtein distance of two strings. See https://en.wikipedia.org/wiki/Levenshtein_distance. Based off https://gist.github.com/andrei-m/982927 (for using the faster dynamic programming version).
Parameter a
String a.
Parameter b
String b.
Returns
A number that represents the distance between the two strings. The greater the number the more distant the strings are from each others.
function underscore
underscore: (str: string) => string;
More general than decamelize. Returns the lower_case_and_underscored form of a string.
```javascript 'innerHTML'.underscore(); // 'inner_html' 'action_name'.underscore(); // 'action_name' 'css-class-name'.underscore(); // 'css_class_name' 'my favorite items'.underscore(); // 'my_favorite_items' ```
underscore
Parameter str
The string to underscore. {String} the underscored string.
namespace tags
module 'src/utils/literals.d.ts' {}
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.dev/license
function indentBy
indentBy: (indentations: number) => TemplateTag;
function oneLine
oneLine: (strings: TemplateStringsArray, ...values: any[]) => string;
function stripIndent
stripIndent: (strings: TemplateStringsArray, ...values: any[]) => string;
function stripIndents
stripIndents: (strings: TemplateStringsArray, ...values: any[]) => string;
function trimNewlines
trimNewlines: (strings: TemplateStringsArray, ...values: any[]) => string;
interface TemplateTag
interface TemplateTag<R = string> {}
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.dev/license
call signature
(template: TemplateStringsArray, ...substitutions: any[]): R;
namespace virtualFs
module 'src/virtual-fs/host/index.d.ts' {}
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.dev/license
function createSyncHost
createSyncHost: <StatsT extends object = {}>( handler: SyncHostHandler<StatsT>) => Host<StatsT>;
function fileBufferToString
fileBufferToString: (fileBuffer: FileBuffer) => string;
function stringToFileBuffer
stringToFileBuffer: (str: string) => FileBuffer;
class AliasHost
class AliasHost<StatsT extends object = {}> extends ResolverHost<StatsT> {}
A Virtual Host that allow to alias some paths to other paths.
This does not verify, when setting an alias, that the target or source exist. Neither does it check whether it's a file or a directory. Please not that directories are also renamed/replaced.
No recursion is done on the resolution, which means the following is perfectly valid then:
host.aliases.set(normalize('/file/a'), normalize('/file/b'));host.aliases.set(normalize('/file/b'), normalize('/file/a'));This will result in a proper swap of two files for each others.
Example 1
const host = new SimpleMemoryHost(); host.write(normalize('/some/file'), content).subscribe();
const aHost = new AliasHost(host); aHost.read(normalize('/some/file')) .subscribe(x => expect(x).toBe(content)); aHost.aliases.set(normalize('/some/file'), normalize('/other/path');
// This file will not exist because /other/path does not exist. aHost.read(normalize('/some/file')) .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
Example 2
const host = new SimpleMemoryHost(); host.write(normalize('/some/folder/file'), content).subscribe();
const aHost = new AliasHost(host); aHost.read(normalize('/some/folder/file')) .subscribe(x => expect(x).toBe(content)); aHost.aliases.set(normalize('/some'), normalize('/other');
// This file will not exist because /other/path does not exist. aHost.read(normalize('/some/folder/file')) .subscribe(undefined, err => expect(err.message).toMatch(/does not exist/));
// Create the file with new content and verify that this has the new content. aHost.write(normalize('/other/folder/file'), content2).subscribe(); aHost.read(normalize('/some/folder/file')) .subscribe(x => expect(x).toBe(content2));
property aliases
readonly aliases: Map<Path, Path>;
class CordHost
class CordHost extends SimpleMemoryHost {}
A Host that records changes to the underlying Host, while keeping a record of Create, Overwrite, Rename and Delete of files.
This is fully compatible with Host, but will keep a staging of every changes asked. That staging follows the principle of the Tree (e.g. can create a file that already exists).
Using
create()
andoverwrite()
will force those operations, but usingwrite
will add the create/overwrite records IIF the files does/doesn't already exist.
constructor
constructor(_back: ReadonlyHost<{}>);
property backend
readonly backend: ReadonlyHost<{}>;
property capabilities
readonly capabilities: HostCapabilities;
method clone
clone: () => CordHost;
Create a copy of this host, including all actions made.
Returns
{CordHost} The carbon copy.
method commit
commit: (host: Host, force?: boolean) => Observable<void>;
Commit the changes recorded to a Host. It is assumed that the host does have the same structure as the host that was used for backend (could be the same host).
Parameter host
The host to create/delete/rename/overwrite files to.
Parameter force
Whether to skip existence checks when creating/overwriting. This is faster but might lead to incorrect states. Because Hosts natively don't support creation versus overwriting (it's only writing), we check for existence before completing a request.
Returns
An observable that completes when done, or error if an error occured.
method create
create: (path: Path, content: FileBuffer) => Observable<void>;
Specialized version of CordHost#write which forces the creation of a file whether it exists or not.
Parameter path
Parameter content
Returns
{Observable}
method delete
delete: (path: Path) => Observable<void>;
method exists
exists: (path: Path) => Observable<boolean>;
method isDirectory
isDirectory: (path: Path) => Observable<boolean>;
method isFile
isFile: (path: Path) => Observable<boolean>;
method list
list: (path: Path) => Observable<PathFragment[]>;
method overwrite
overwrite: (path: Path, content: FileBuffer) => Observable<void>;
method read
read: (path: Path) => Observable<ArrayBuffer>;
method records
records: () => CordHostRecord[];
method rename
rename: (from: Path, to: Path) => Observable<void>;
method stat
stat: (path: Path) => Observable<Stats | null> | null;
method watch
watch: (path: Path, options?: HostWatchOptions) => null;
method willCreate
willCreate: (path: Path) => boolean;
method willDelete
willDelete: (path: Path) => boolean;
method willOverwrite
willOverwrite: (path: Path) => boolean;
method willRename
willRename: (path: Path) => boolean;
method willRenameTo
willRenameTo: (path: Path, to: Path) => boolean;
method write
write: (path: Path, content: FileBuffer) => Observable<void>;
class Empty
class Empty implements ReadonlyHost {}
property capabilities
readonly capabilities: HostCapabilities;
method exists
exists: (path: Path) => Observable<boolean>;
method isDirectory
isDirectory: (path: Path) => Observable<boolean>;
method isFile
isFile: (path: Path) => Observable<boolean>;
method list
list: (path: Path) => Observable<PathFragment[]>;
method read
read: (path: Path) => Observable<ArrayBuffer>;
method stat
stat: ( path: Path) => Observable<{ isFile(): boolean; isDirectory(): boolean; readonly size: number; readonly atime: Date; readonly mtime: Date; readonly ctime: Date; readonly birthtime: Date;}>;
class PatternMatchingHost
class PatternMatchingHost<StatsT extends object = {}> extends ResolverHost<StatsT> {}
method addPattern
addPattern: ( pattern: string | string[], replacementFn: ReplacementFunction) => void;
class ResolverHost
abstract class ResolverHost<T extends object> implements Host<T> {}
A Host that runs a method before calling its delegate. This is an abstract class and its actual behaviour is entirely dependant of the subclass.
constructor
constructor(_delegate: Host<T>);
property capabilities
readonly capabilities: HostCapabilities;
method delete
delete: (path: Path) => Observable<void>;
method exists
exists: (path: Path) => Observable<boolean>;
method isDirectory
isDirectory: (path: Path) => Observable<boolean>;
method isFile
isFile: (path: Path) => Observable<boolean>;
method list
list: (path: Path) => Observable<PathFragment[]>;
method read
read: (path: Path) => Observable<ArrayBuffer>;
method rename
rename: (from: Path, to: Path) => Observable<void>;
method stat
stat: (path: Path) => Observable<Stats<T> | null> | null;
method watch
watch: ( path: Path, options?: HostWatchOptions) => Observable<HostWatchEvent> | null;
method write
write: (path: Path, content: FileBuffer) => Observable<void>;
class SafeReadonlyHost
class SafeReadonlyHost<StatsT extends object = {}> implements ReadonlyHost<StatsT> {}
A Host that filters out errors. The only exception is
read()
which will still error out if the delegate returned an error (e.g. NodeJS will error out if the file doesn't exist).
constructor
constructor(_delegate: ReadonlyHost<StatsT>);
property capabilities
readonly capabilities: HostCapabilities;
method exists
exists: (path: Path) => Observable<boolean>;
method isDirectory
isDirectory: (path: Path) => Observable<boolean>;
method isFile
isFile: (path: Path) => Observable<boolean>;
method list
list: (path: Path) => Observable<PathFragment[]>;
method read
read: (path: Path) => Observable<ArrayBuffer>;
method stat
stat: (path: Path) => Observable<Stats<StatsT> | null> | null;
class ScopedHost
class ScopedHost<T extends object> extends ResolverHost<T> {}
constructor
constructor(delegate: Host<T>, _root?: String & { __PRIVATE_DEVKIT_PATH: void });
class SimpleMemoryHost
class SimpleMemoryHost implements Host<{}> {}
constructor
constructor();
property capabilities
readonly capabilities: HostCapabilities;
method delete
delete: (path: Path) => Observable<void>;
method exists
exists: (path: Path) => Observable<boolean>;
method isDirectory
isDirectory: (path: Path) => Observable<boolean>;
method isFile
isFile: (path: Path) => Observable<boolean>;
method list
list: (path: Path) => Observable<PathFragment[]>;
method read
read: (path: Path) => Observable<ArrayBuffer>;
method rename
rename: (from: Path, to: Path) => Observable<void>;
method reset
reset: () => void;
method stat
stat: (path: Path) => Observable<Stats<{}> | null> | null;
method watch
watch: ( path: Path, options?: HostWatchOptions) => Observable<HostWatchEvent> | null;
method write
write: (path: Path, content: FileBuffer) => Observable<void>;
class SyncDelegateHost
class SyncDelegateHost<T extends object = {}> {}
Implement a synchronous-only host interface (remove the Observable parts).
constructor
constructor(_delegate: Host<T>);
property capabilities
readonly capabilities: HostCapabilities;
property delegate
readonly delegate: Host<T>;
method delete
delete: (path: Path) => void;
method exists
exists: (path: Path) => boolean;
method isDirectory
isDirectory: (path: Path) => boolean;
method isFile
isFile: (path: Path) => boolean;
method list
list: (path: Path) => PathFragment[];
method read
read: (path: Path) => FileBuffer;
method rename
rename: (from: Path, to: Path) => void;
method stat
stat: (path: Path) => Stats<T> | null;
method watch
watch: ( path: Path, options?: HostWatchOptions) => Observable<HostWatchEvent> | null;
method write
write: (path: Path, content: FileBufferLike) => void;
class SynchronousDelegateExpectedException
class SynchronousDelegateExpectedException extends BaseException {}
constructor
constructor();
interface CordHostCreate
interface CordHostCreate {}
interface CordHostDelete
interface CordHostDelete {}
interface CordHostOverwrite
interface CordHostOverwrite {}
interface CordHostRename
interface CordHostRename {}
interface Host
interface Host<StatsT extends object = {}> extends ReadonlyHost<StatsT> {}
interface HostCapabilities
interface HostCapabilities {}
property synchronous
synchronous: boolean;
interface HostWatchEvent
interface HostWatchEvent {}
interface HostWatchOptions
interface HostWatchOptions {}
property persistent
readonly persistent?: boolean;
property recursive
readonly recursive?: boolean;
interface ReadonlyHost
interface ReadonlyHost<StatsT extends object = {}> {}
property capabilities
readonly capabilities: HostCapabilities;
method exists
exists: (path: Path) => Observable<boolean>;
method isDirectory
isDirectory: (path: Path) => Observable<boolean>;
method isFile
isFile: (path: Path) => Observable<boolean>;
method list
list: (path: Path) => Observable<PathFragment[]>;
method read
read: (path: Path) => Observable<ArrayBuffer>;
method stat
stat: (path: Path) => Observable<Stats<StatsT> | null> | null;
interface SimpleMemoryHostStats
interface SimpleMemoryHostStats {}
property content
readonly content: FileBuffer | null;
interface SyncHostHandler
interface SyncHostHandler<StatsT extends object = {}> {}
method delete
delete: (path: Path) => void;
method exists
exists: (path: Path) => boolean;
method isDirectory
isDirectory: (path: Path) => boolean;
method isFile
isFile: (path: Path) => boolean;
method list
list: (path: Path) => PathFragment[];
method read
read: (path: Path) => FileBuffer;
method rename
rename: (from: Path, to: Path) => void;
method stat
stat: (path: Path) => Stats<StatsT> | null;
method write
write: (path: Path, content: FileBufferLike) => void;
enum HostWatchEventType
enum HostWatchEventType { Changed = 0, Created = 1, Deleted = 2, Renamed = 3,}
type CordHostRecord
type CordHostRecord = | CordHostCreate | CordHostOverwrite | CordHostRename | CordHostDelete;
type FileBuffer
type FileBuffer = ArrayBuffer;
type FileBufferLike
type FileBufferLike = ArrayBufferLike;
type ReplacementFunction
type ReplacementFunction = (path: Path) => Path;
type Stats
type Stats<T extends object = {}> = T & { isFile(): boolean; isDirectory(): boolean; readonly size: number; readonly atime: Date; readonly mtime: Date; readonly ctime: Date; readonly birthtime: Date;};
namespace test
module 'src/virtual-fs/host/test.d.ts' {}
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.dev/license
class TestHost
class TestHost extends SimpleMemoryHost {}
constructor
constructor(map?: { [path: string]: string });
property files
readonly files: Path[];
property records
readonly records: TestLogRecord[];
property sync
readonly sync: SyncDelegateHost<{}>;
method $exists
$exists: (path: string) => boolean;
method $isDirectory
$isDirectory: (path: string) => boolean;
method $isFile
$isFile: (path: string) => boolean;
method $list
$list: (path: string) => PathFragment[];
method $read
$read: (path: string) => string;
method $write
$write: (path: string, content: string) => void;
method clearRecords
clearRecords: () => void;
method clone
clone: () => TestHost;
type TestLogRecord
type TestLogRecord = | { kind: | 'write' | 'read' | 'delete' | 'list' | 'exists' | 'isDirectory' | 'isFile' | 'stat' | 'watch'; path: Path; } | { kind: 'rename'; from: Path; to: Path; };
namespace workspaces
module 'src/workspace/index.d.ts' {}
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.dev/license
function createWorkspaceHost
createWorkspaceHost: (host: virtualFs.Host) => WorkspaceHost;
function readWorkspace
readWorkspace: ( path: string, host: WorkspaceHost, format?: WorkspaceFormat) => Promise<{ workspace: WorkspaceDefinition }>;
Reads and constructs a
WorkspaceDefinition
. If the function is provided with a path to a directory instead of a file, a search of the directory's files will commence to attempt to locate a known workspace file. Currently the following are considered known workspace files: -angular.json
-.angular.json
Parameter path
The path to either a workspace file or a directory containing a workspace file.
Parameter host
The
WorkspaceHost
to use to access the file and directory data.Parameter format
An optional
WorkspaceFormat
value. Used if the path specifies a non-standard file name that would prevent automatically discovering the format.An
Promise
of the read result object with theWorkspaceDefinition
contained within theworkspace
property.
function writeWorkspace
writeWorkspace: ( workspace: WorkspaceDefinition, host: WorkspaceHost, path?: string, format?: WorkspaceFormat) => Promise<void>;
Writes a
WorkspaceDefinition
to the underlying storage via the providedWorkspaceHost
. If theWorkspaceDefinition
was created via thereadWorkspace
function, metadata will be used to determine the path and format of the Workspace. In all other cases, thepath
andformat
options must be specified as they would be otherwise unknown.Parameter workspace
The
WorkspaceDefinition
that will be written.Parameter host
The
WorkspaceHost
to use to access/write the file and directory data.Parameter path
The path to a file location for the output. Required if
readWorkspace
was not used to create theWorkspaceDefinition
. Optional otherwise; will override theWorkspaceDefinition
metadata if provided.Parameter format
The
WorkspaceFormat
to use for output. Required ifreadWorkspace
was not used to create theWorkspaceDefinition
. Optional otherwise; will override theWorkspaceDefinition
metadata if provided.An
Promise
of typevoid
.
class ProjectDefinitionCollection
class ProjectDefinitionCollection extends DefinitionCollection<ProjectDefinition> {}
constructor
constructor( initial?: Record<string, ProjectDefinition>, listener?: DefinitionCollectionListener<ProjectDefinition>);
method add
add: (definition: { [key: string]: unknown; name: string; root: string; sourceRoot?: string; prefix?: string; targets?: Record<string, TargetDefinition | undefined>;}) => ProjectDefinition;
method set
set: (name: string, value: ProjectDefinition) => this;
class TargetDefinitionCollection
class TargetDefinitionCollection extends DefinitionCollection<TargetDefinition> {}
constructor
constructor( initial?: Record<string, TargetDefinition>, listener?: DefinitionCollectionListener<TargetDefinition>);
method add
add: (definition: { name: string } & TargetDefinition) => TargetDefinition;
method set
set: (name: string, value: TargetDefinition) => this;
interface ProjectDefinition
interface ProjectDefinition {}
property extensions
readonly extensions: Record<string, JsonValue | undefined>;
property prefix
prefix?: string;
property root
root: string;
property sourceRoot
sourceRoot?: string;
property targets
readonly targets: TargetDefinitionCollection;
interface TargetDefinition
interface TargetDefinition {}
property builder
builder: string;
property configurations
configurations?: Record< string, Record<string, JsonValue | undefined> | undefined>;
property defaultConfiguration
defaultConfiguration?: string;
property options
options?: Record<string, JsonValue | undefined>;
interface WorkspaceDefinition
interface WorkspaceDefinition {}
property extensions
readonly extensions: Record<string, JsonValue | undefined>;
property projects
readonly projects: ProjectDefinitionCollection;
interface WorkspaceHost
interface WorkspaceHost {}
method isDirectory
isDirectory: (path: string) => Promise<boolean>;
method isFile
isFile: (path: string) => Promise<boolean>;
method readFile
readFile: (path: string) => Promise<string>;
method writeFile
writeFile: (path: string, data: string) => Promise<void>;
enum WorkspaceFormat
enum WorkspaceFormat { JSON = 0,}
Supported workspace formats
member JSON
JSON = 0
type DefinitionCollectionListener
type DefinitionCollectionListener<V extends object> = ( name: string, newValue: V | undefined, collection: DefinitionCollection<V>) => void;
Package Files (44)
- src/exception.d.ts
- src/index.d.ts
- src/json/index.d.ts
- src/json/schema/index.d.ts
- src/json/schema/interface.d.ts
- src/json/schema/pointer.d.ts
- src/json/schema/registry.d.ts
- src/json/schema/schema.d.ts
- src/json/schema/transforms.d.ts
- src/json/schema/utility.d.ts
- src/json/schema/visitor.d.ts
- src/json/utils.d.ts
- src/logger/indent.d.ts
- src/logger/index.d.ts
- src/logger/level.d.ts
- src/logger/logger.d.ts
- src/logger/null-logger.d.ts
- src/logger/transform-logger.d.ts
- src/utils/lang.d.ts
- src/utils/literals.d.ts
- src/utils/object.d.ts
- src/utils/partially-ordered-set.d.ts
- src/utils/priority-queue.d.ts
- src/utils/strings.d.ts
- src/utils/template.d.ts
- src/virtual-fs/host/alias.d.ts
- src/virtual-fs/host/buffer.d.ts
- src/virtual-fs/host/create.d.ts
- src/virtual-fs/host/empty.d.ts
- src/virtual-fs/host/index.d.ts
- src/virtual-fs/host/interface.d.ts
- src/virtual-fs/host/memory.d.ts
- src/virtual-fs/host/pattern.d.ts
- src/virtual-fs/host/record.d.ts
- src/virtual-fs/host/resolver.d.ts
- src/virtual-fs/host/safe.d.ts
- src/virtual-fs/host/scoped.d.ts
- src/virtual-fs/host/sync.d.ts
- src/virtual-fs/host/test.d.ts
- src/virtual-fs/path.d.ts
- src/workspace/core.d.ts
- src/workspace/definitions.d.ts
- src/workspace/host.d.ts
- src/workspace/index.d.ts
Dependencies (6)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@angular-devkit/core
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@angular-devkit/core)
- HTML<a href="https://www.jsdocs.io/package/@angular-devkit/core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6104 ms. - Missing or incorrect documentation? Open an issue for this package.