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

@ngneat/hot-toast

Package Overview
Dependencies
Maintainers
3
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngneat/hot-toast - npm Package Compare versions

Comparing version 3.4.3 to 4.0.0-beta.1

esm2020/lib/components/animated-icon/animated-icon.component.mjs

3

lib/components/animated-icon/animated-icon.component.d.ts
import { IconTheme } from '../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class AnimatedIconComponent {
iconTheme: IconTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<AnimatedIconComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AnimatedIconComponent, "hot-toast-animated-icon", never, { "iconTheme": "iconTheme"; }, {}, never, ["*"]>;
}

@@ -5,2 +5,3 @@ import { ChangeDetectorRef, QueryList } from '@angular/core';

import { HotToastComponent } from '../hot-toast/hot-toast.component';
import * as i0 from "@angular/core";
export declare class HotToastContainerComponent {

@@ -26,2 +27,4 @@ private cdr;

private updateToasts;
static ɵfac: i0.ɵɵFactoryDeclaration<HotToastContainerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<HotToastContainerComponent, "hot-toast-container", never, { "defaultConfig": "defaultConfig"; }, {}, never, never>;
}
import { AfterViewInit, EventEmitter, Injector, NgZone, OnDestroy, OnInit, Renderer2 } from '@angular/core';
import { CreateHotToastRef, HotToastClose, Toast, ToastConfig } from '../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class HotToastComponent implements OnInit, AfterViewInit, OnDestroy {

@@ -71,2 +72,4 @@ private injector;

private setToastAttributes;
static ɵfac: i0.ɵɵFactoryDeclaration<HotToastComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<HotToastComponent, "hot-toast", never, { "toast": "toast"; "offset": "offset"; "defaultConfig": "defaultConfig"; "toastRef": "toastRef"; }, { "height": "height"; "beforeClosed": "beforeClosed"; "afterClosed": "afterClosed"; }, never, never>;
}
import { IconTheme } from '../../../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class CheckMarkComponent {
theme: IconTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<CheckMarkComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CheckMarkComponent, "hot-toast-checkmark", never, { "theme": "theme"; }, {}, never, never>;
}
import { IconTheme } from '../../../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class ErrorComponent {
theme: IconTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<ErrorComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<ErrorComponent, "hot-toast-error", never, { "theme": "theme"; }, {}, never, never>;
}
import { IconTheme } from '../../../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class InfoComponent {
theme: IconTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<InfoComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<InfoComponent, "hot-toast-info", never, { "theme": "theme"; }, {}, never, never>;
}
import { IconTheme } from '../../../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class LoaderComponent {
theme: IconTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<LoaderComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<LoaderComponent, "hot-toast-loader", never, { "theme": "theme"; }, {}, never, never>;
}
import { IconTheme } from '../../../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class WarningComponent {
theme: IconTheme;
static ɵfac: i0.ɵɵFactoryDeclaration<WarningComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<WarningComponent, "hot-toast-warning", never, { "theme": "theme"; }, {}, never, never>;
}
import { IconTheme, ToastType } from '../../hot-toast.model';
import * as i0 from "@angular/core";
export declare class IndicatorComponent {
theme: IconTheme;
type: ToastType;
static ɵfac: i0.ɵɵFactoryDeclaration<IndicatorComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<IndicatorComponent, "hot-toast-indicator", never, { "theme": "theme"; "type": "type"; }, {}, never, never>;
}

2

lib/hot-toast-ref.d.ts
import { Content } from '@ngneat/overview';
import { Observable } from 'rxjs';
import { HotToastContainerComponent } from './components/hot-toast-container/hot-toast-container.component';
import type { HotToastContainerComponent } from './components/hot-toast-container/hot-toast-container.component';
import { HotToastClose, Toast, UpdateToastOptions, HotToastRefProps, DefaultDataType } from './hot-toast.model';

@@ -5,0 +5,0 @@ export declare class HotToastRef<DataType = DefaultDataType> implements HotToastRefProps<DataType> {

import { ModuleWithProviders } from '@angular/core';
import { ToastConfig } from './hot-toast.model';
import * as i0 from "@angular/core";
import * as i1 from "./components/hot-toast-container/hot-toast-container.component";
import * as i2 from "./components/hot-toast/hot-toast.component";
import * as i3 from "./components/animated-icon/animated-icon.component";
import * as i4 from "./components/indicator/indicator.component";
import * as i5 from "./components/indicator/icons/checkmark/checkmark.component";
import * as i6 from "./components/indicator/icons/error/error.component";
import * as i7 from "./components/indicator/icons/loader/loader.component";
import * as i8 from "./components/indicator/icons/warning/warning.component";
import * as i9 from "./components/indicator/icons/info/info.component";
import * as i10 from "@angular/common";
import * as i11 from "@ngneat/overview";
export declare class HotToastModule {
static forRoot(config?: Partial<ToastConfig>): ModuleWithProviders<HotToastModule>;
static ɵfac: i0.ɵɵFactoryDeclaration<HotToastModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<HotToastModule, [typeof i1.HotToastContainerComponent, typeof i2.HotToastComponent, typeof i3.AnimatedIconComponent, typeof i4.IndicatorComponent, typeof i5.CheckMarkComponent, typeof i6.ErrorComponent, typeof i7.LoaderComponent, typeof i8.WarningComponent, typeof i9.InfoComponent], [typeof i10.CommonModule, typeof i11.DynamicViewModule], never>;
static ɵinj: i0.ɵɵInjectorDeclaration<HotToastModule>;
}
import { Content, ViewService } from '@ngneat/overview';
import { Observable } from 'rxjs';
import { CreateHotToastRef, HotToastServiceMethods, ObservableMessages, ToastConfig, ToastOptions } from './hot-toast.model';
import * as i0 from "@angular/core";
export declare class HotToastService implements HotToastServiceMethods {

@@ -109,2 +110,4 @@ private _viewService;

private createLoadingToast;
static ɵfac: i0.ɵɵFactoryDeclaration<HotToastService, [null, null, { optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<HotToastService>;
}
/**
* Generated bundle index. Do not edit.
*/
/// <amd-module name="@ngneat/hot-toast" />
export * from './public-api';
export { AnimatedIconComponent as ɵc } from './lib/components/animated-icon/animated-icon.component';
export { HotToastContainerComponent as ɵa } from './lib/components/hot-toast-container/hot-toast-container.component';
export { HotToastComponent as ɵb } from './lib/components/hot-toast/hot-toast.component';
export { CheckMarkComponent as ɵe } from './lib/components/indicator/icons/checkmark/checkmark.component';
export { ErrorComponent as ɵf } from './lib/components/indicator/icons/error/error.component';
export { InfoComponent as ɵi } from './lib/components/indicator/icons/info/info.component';
export { LoaderComponent as ɵg } from './lib/components/indicator/icons/loader/loader.component';
export { WarningComponent as ɵh } from './lib/components/indicator/icons/warning/warning.component';
export { IndicatorComponent as ɵd } from './lib/components/indicator/indicator.component';
{
"name": "@ngneat/hot-toast",
"version": "3.4.3",
"version": "4.0.0-beta.1",
"description": "Smoking hot Notifications for Angular. Lightweight, customizable and beautiful by default.",
"schematics": "./schematics/collection.json",
"peerDependencies": {
"@angular/common": ">= 9.1.13 < 13",
"@angular/core": ">= 9.1.13 < 13",
"@ngneat/overview": "^2.0.2"
"@angular/core": ">=13.0.0",
"@ngneat/overview": ">=3.0.0"
},
"dependencies": {
"tslib": "^2.0.0"
},
"keywords": [

@@ -34,10 +30,25 @@ "angular",

},
"main": "bundles/ngneat-hot-toast.umd.js",
"module": "fesm2015/ngneat-hot-toast.js",
"es2015": "fesm2015/ngneat-hot-toast.js",
"esm2015": "esm2015/ngneat-hot-toast.js",
"fesm2015": "fesm2015/ngneat-hot-toast.js",
"module": "fesm2015/ngneat-hot-toast.mjs",
"es2020": "fesm2020/ngneat-hot-toast.mjs",
"esm2020": "esm2020/ngneat-hot-toast.mjs",
"fesm2020": "fesm2020/ngneat-hot-toast.mjs",
"fesm2015": "fesm2015/ngneat-hot-toast.mjs",
"typings": "ngneat-hot-toast.d.ts",
"metadata": "ngneat-hot-toast.metadata.json",
"sideEffects": false
"exports": {
"./package.json": {
"default": "./package.json"
},
".": {
"types": "./ngneat-hot-toast.d.ts",
"esm2020": "./esm2020/ngneat-hot-toast.mjs",
"es2020": "./fesm2020/ngneat-hot-toast.mjs",
"es2015": "./fesm2015/ngneat-hot-toast.mjs",
"node": "./fesm2015/ngneat-hot-toast.mjs",
"default": "./fesm2020/ngneat-hot-toast.mjs"
}
},
"sideEffects": false,
"dependencies": {
"tslib": "^2.3.0"
}
}

@@ -24,2 +24,31 @@ <p align="center">

## Compatibility with Angular Versions
<table>
<thead>
<tr>
<th>@ngneat/hot-toast</th>
<th>Angular</th>
</tr>
</thead>
<tbody>
<tr>
<td>
3.x
</td>
<td>
>= 9.1.13 < 13
</td>
</tr>
<tr>
<td>
4.x
</td>
<td>
>= 13
</td>
</tr>
</tbody>
</table>
## Features

@@ -83,11 +112,11 @@

update() {
saveSettings.pipe(
this.toast.observe(
{
saveSettings
.pipe(
this.toast.observe({
loading: 'Saving...',
success: 'Settings saved!',
error: 'Could not save.',
}
})
)
).subscribe();
.subscribe();
}

@@ -129,7 +158,9 @@ }

@NgModule({
imports: [HotToastModule.forRoot({
reverseOrder: true,
dismissible: true,
autoClose: false
})],
imports: [
HotToastModule.forRoot({
reverseOrder: true,
dismissible: true,
autoClose: false,
}),
],
})

@@ -157,19 +188,19 @@ class AppModule {}

| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- |
| id | `string` | Unique id to associate with hot-toast. There can't be multiple hot-toasts opened with same id. <br>*[Example](https://ngneat.github.io/hot-toast/#only-one-at-a-time)* | No |
| id | `string` | Unique id to associate with hot-toast. There can't be multiple hot-toasts opened with same id. <br>_[Example](https://ngneat.github.io/hot-toast/#only-one-at-a-time)_ | No |
| duration | `number` | Duration in milliseconds after which hot-toast will be auto closed. Can be disabled via `autoClose: false`<br>_Default: `3000, error = 4000, loading = 30000`_ | Yes |
| autoClose | `boolean` | Auto close hot-toast after duration<br>_Default: `true`_ | Yes |
| position | [`ToastPosition`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20ToastPosition) | The position to place the hot-toast.<br>_Default: `top-center`_<br>*[Example](https://ngneat.github.io/hot-toast/#positions)* | Yes |
| dismissible | `boolean` | Show close button in hot-toast<br>_Default: `false`_<br>*[Example](https://ngneat.github.io/hot-toast/#dismissible)* | Yes |
| position | [`ToastPosition`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20ToastPosition) | The position to place the hot-toast.<br>_Default: `top-center`_<br>_[Example](https://ngneat.github.io/hot-toast/#positions)_ | Yes |
| dismissible | `boolean` | Show close button in hot-toast<br>_Default: `false`_<br>_[Example](https://ngneat.github.io/hot-toast/#dismissible)_ | Yes |
| role | [`ToastRole`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20ToastRole) | Role of the live region.<br>_Default: `status`_ | Yes |
| ariaLive | [`ToastAriaLive`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20ToastAriaLive) | aria-live value for the live region.<br>_Default: `polite`_ | Yes |
| theme | [`ToastTheme`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20ToastTheme) | Visual appearance of hot-toast<br>_Default: `toast`_<br>*[Example](https://ngneat.github.io/hot-toast/#snackbar)* | Yes |
| persist | [`{ToastPersistConfig}`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20class%20ToastPersistConfig) | Useful when you want to keep a persistance for toast based on ids, across sessions.<br>*[Example](https://ngneat.github.io/hot-toast/#persistent)* | No |
| icon | [`Content`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/overview/blob/main/projects/ngneat/overview/src/lib/views/types.ts&q=export%20type%20Content) | Icon to show in the hot-toast<br>*[Example](https://ngneat.github.io/hot-toast/#emoji)* | Yes |
| iconTheme | [`IconTheme`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20IconTheme) | Use this to change icon color<br>*[Example](https://ngneat.github.io/hot-toast/#themed)* | Yes |
| theme | [`ToastTheme`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20ToastTheme) | Visual appearance of hot-toast<br>_Default: `toast`_<br>_[Example](https://ngneat.github.io/hot-toast/#snackbar)_ | Yes |
| persist | [`{ToastPersistConfig}`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20class%20ToastPersistConfig) | Useful when you want to keep a persistance for toast based on ids, across sessions.<br>_[Example](https://ngneat.github.io/hot-toast/#persistent)_ | No |
| icon | [`Content`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/overview/blob/main/projects/ngneat/overview/src/lib/views/types.ts&q=export%20type%20Content) | Icon to show in the hot-toast<br>_[Example](https://ngneat.github.io/hot-toast/#emoji)_ | Yes |
| iconTheme | [`IconTheme`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20type%20IconTheme) | Use this to change icon color<br>_[Example](https://ngneat.github.io/hot-toast/#themed)_ | Yes |
| className | `string` | Extra CSS classes to be added to the hot toast container. | Yes |
| attributes | [`Record<string, string>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeystype) | Extra attributes to be added to the hot toast container. Can be used for e2e tests. | Yes |
| style | `style object` | Extra styles to apply for hot-toast.<br>*[Example](https://ngneat.github.io/hot-toast/#themed)* | Yes |
| style | `style object` | Extra styles to apply for hot-toast.<br>_[Example](https://ngneat.github.io/hot-toast/#themed)_ | Yes |
| closeStyle | `style object` | Extra styles to apply for close button | Yes |
| data | [`DataType`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20interface%20Toast%3CDataType%3E) | Allows you to pass data for your template and component. You can access the data using `toastRef.data`.<br>*Examples: [Template with Data](https://ngneat.github.io/hot-toast/#template-data), [Component with Data](https://ngneat.github.io/hot-toast/#component-data)* | No |
| injector | `Injector` | Allows you to pass injector for your component.<br>*[Example](https://ngneat.github.io/hot-toast/#injector)* | No |
| data | [`DataType`](https://github-link.vercel.app/api?ghUrl=https://github.com/ngneat/hot-toast/blob/master/projects/ngneat/hot-toast/src/lib/hot-toast.model.ts&q=export%20interface%20Toast%3CDataType%3E) | Allows you to pass data for your template and component. You can access the data using `toastRef.data`.<br>_Examples: [Template with Data](https://ngneat.github.io/hot-toast/#template-data), [Component with Data](https://ngneat.github.io/hot-toast/#component-data)_ | No |
| injector | `Injector` | Allows you to pass injector for your component.<br>_[Example](https://ngneat.github.io/hot-toast/#injector)_ | No |

@@ -176,0 +207,0 @@ ---

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

}
return schematics_1.chain([
return (0, schematics_1.chain)([
addPackageJsonDependencies(),

@@ -39,3 +39,3 @@ installPackageJsonDependencies(),

dependencies.forEach((dependency) => {
utils_1.addPackageToPackageJson(host, dependency.name, `${dependency.version}`);
(0, utils_1.addPackageToPackageJson)(host, dependency.name, `${dependency.version}`);
context.logger.log('info', `✅️ Added "${dependency.name}`);

@@ -56,4 +56,4 @@ });

if (!options.skipImport) {
const workspace = utils_1.getWorkspace(host);
const project = utils_1.getProjectFromWorkspace(workspace, options.project ? options.project : Object.keys(workspace.projects)[0]);
const workspace = (0, utils_1.getWorkspace)(host);
const project = (0, utils_1.getProjectFromWorkspace)(workspace, options.project ? options.project : Object.keys(workspace.projects)[0]);
if (!project || project.projectType !== 'application') {

@@ -66,12 +66,12 @@ throw new schematics_1.SchematicsException(`A client project type of "application" is required.`);

!project.architect.build.options.main) {
throw project_targets_1.targetBuildNotFoundError();
throw (0, project_targets_1.targetBuildNotFoundError)();
}
const modulePath = ng_ast_utils_1.getAppModulePath(host, project.architect.build.options.main);
const moduleSource = utils_1.getSourceFile(host, modulePath);
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, project.architect.build.options.main);
const moduleSource = (0, utils_1.getSourceFile)(host, modulePath);
importModuleSet.forEach((item) => {
if (ast_utils_1.isImported(moduleSource, item.moduleName, item.importPath)) {
if ((0, ast_utils_1.isImported)(moduleSource, item.moduleName, item.importPath)) {
context.logger.warn(`Could not import "${item.moduleName}" because it's already imported.`);
}
else {
const change = ast_utils_1.insertImport(moduleSource, modulePath, item.moduleName, item.importPath);
const change = (0, ast_utils_1.insertImport)(moduleSource, modulePath, item.moduleName, item.importPath);
if (change) {

@@ -92,4 +92,4 @@ const recorder = host.beginUpdate(modulePath);

if (!options.skipImport) {
const workspace = utils_1.getWorkspace(host);
const project = utils_1.getProjectFromWorkspace(workspace, options.project ? options.project : Object.keys(workspace.projects)[0]);
const workspace = (0, utils_1.getWorkspace)(host);
const project = (0, utils_1.getProjectFromWorkspace)(workspace, options.project ? options.project : Object.keys(workspace.projects)[0]);
if (!project || project.projectType !== 'application') {

@@ -104,9 +104,9 @@ throw new schematics_1.SchematicsException(`A client project type of "application" is required.`);

}
const modulePath = ng_ast_utils_1.getAppModulePath(host, project.architect.build.options.main);
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, project.architect.build.options.main);
importModuleSet.forEach((item) => {
if (ng_module_imports_1.hasNgModuleImport(host, modulePath, item.moduleName)) {
if ((0, ng_module_imports_1.hasNgModuleImport)(host, modulePath, item.moduleName)) {
context.logger.warn(`Could not set up "${item.moduleName}" in "imports[]" because it's already imported.`);
}
else {
utils_1.addModuleImportToRootModule(host, item.importModuleStatement, null, project);
(0, utils_1.addModuleImportToRootModule)(host, item.importModuleStatement, null, project);
context.logger.log('info', '✅ Imported "' + item.moduleName + '" in imports');

@@ -113,0 +113,0 @@ }

@@ -16,2 +16,2 @@ import * as ts from 'typescript';

export declare function getWorkspacePath(host: Tree): string;
export declare function getWorkspace(host: Tree): string | number | boolean | import("@angular-devkit/core").JsonArray | import("@angular-devkit/core").JsonObject | null;
export declare function getWorkspace(host: Tree): any;

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

const tasks_1 = require("@angular-devkit/schematics/tasks");
const core_1 = require("@angular-devkit/core");
const jsonc_parser_1 = require("jsonc-parser");
const schematics_1 = require("@angular-devkit/schematics");

@@ -103,3 +103,3 @@ function installPackageJsonDependencies() {

function removePackageJsonDependency(tree, dependencyName) {
const packageContent = JSON.parse(index_1.getFileContent(tree, '/package.json'));
const packageContent = JSON.parse((0, index_1.getFileContent)(tree, '/package.json'));
delete packageContent.dependencies[dependencyName];

@@ -110,3 +110,3 @@ tree.overwrite('/package.json', JSON.stringify(packageContent, null, 2));

function addModuleImportToRootModule(host, moduleName, src, project) {
const modulePath = ng_ast_utils_1.getAppModulePath(host, project_main_file_1.getProjectMainFile(project));
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, (0, project_main_file_1.getProjectMainFile)(project));
addModuleImportToModule(host, modulePath, moduleName, src);

@@ -120,3 +120,3 @@ }

}
const changes = ast_utils_1.addImportToModule(moduleSource, modulePath, moduleName, src);
const changes = (0, ast_utils_1.addImportToModule)(moduleSource, modulePath, moduleName, src);
const recorder = host.beginUpdate(modulePath);

@@ -153,5 +153,5 @@ changes.forEach((change) => {

const content = configBuffer.toString();
return core_1.parseJson(content, core_1.JsonParseMode.Loose);
return (0, jsonc_parser_1.parse)(content);
}
exports.getWorkspace = getWorkspace;
//# sourceMappingURL=index.js.map

@@ -5,6 +5,18 @@ "use strict";

const ts = require("typescript");
const getNgModuleMetadata = (sf) => {
let ngModuleMetadata = null;
const visit = (node) => {
if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && isNgModuleCallExpression(node.expression)) {
ngModuleMetadata = node.expression.arguments[0];
return;
}
ts.forEachChild(node, visit);
};
ts.forEachChild(sf, visit);
return ngModuleMetadata;
};
/**
* Whether the Angular module in the given path imports the specifed module class name.
*/
exports.hasNgModuleImport = (tree, modulePath, className) => {
const hasNgModuleImport = (tree, modulePath, className) => {
const moduleFileContent = tree.read(modulePath);

@@ -14,16 +26,7 @@ if (!moduleFileContent) {

}
const parsedFile = ts.createSourceFile(modulePath, moduleFileContent.toString(), ts.ScriptTarget.Latest, true);
let ngModuleMetadata = null;
const findModuleDecorator = (node) => {
if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && isNgModuleCallExpression(node.expression)) {
ngModuleMetadata = node.expression.arguments[0];
return;
}
ts.forEachChild(node, findModuleDecorator);
};
ts.forEachChild(parsedFile, findModuleDecorator);
if (!ngModuleMetadata) {
const sf = ts.createSourceFile(modulePath, moduleFileContent.toString(), ts.ScriptTarget.Latest, true);
const ngModuleMetadata = getNgModuleMetadata(sf);
if (ngModuleMetadata === null) {
throw new Error(`Could not find NgModule declaration inside: "${modulePath}"`);
}
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
for (const property of ngModuleMetadata.properties) {

@@ -35,4 +38,3 @@ if (!ts.isPropertyAssignment(property) ||

}
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
if (property.initializer.elements.some((element) => element.getText().includes(className))) {
if (property.initializer.elements.some((element, _index, _array) => element.getText().includes(className))) {
return true;

@@ -43,2 +45,3 @@ }

};
exports.hasNgModuleImport = hasNgModuleImport;
/**

@@ -45,0 +48,0 @@ * Resolves the last identifier that is part of the given expression. This helps resolving

@@ -7,4 +7,4 @@ "use strict";

/** Looks for the main TypeScript file in the given project and returns its path. */
exports.getProjectMainFile = (project) => {
const buildOptions = project_targets_1.getProjectTargetOptions(project, 'build');
const getProjectMainFile = (project) => {
const buildOptions = (0, project_targets_1.getProjectTargetOptions)(project, 'build');
if (!buildOptions.main) {

@@ -15,2 +15,3 @@ throw new schematics_1.SchematicsException(`Could not find the project main file inside of the ` + `workspace config (${project.sourceRoot})`);

};
exports.getProjectMainFile = getProjectMainFile;
//# sourceMappingURL=project-main-file.js.map

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

/** Resolves the architect options for the build target of the given project. */
exports.getProjectTargetOptions = (project, buildTarget) => {
const getProjectTargetOptions = (project, buildTarget) => {
if (project.targets && project.targets[buildTarget] && project.targets[buildTarget].options) {

@@ -16,3 +16,5 @@ return project.targets[buildTarget].options;

};
exports.targetBuildNotFoundError = () => new schematics_1.SchematicsException(`Project target "build" not found.`);
exports.getProjectTargetOptions = getProjectTargetOptions;
const targetBuildNotFoundError = () => new schematics_1.SchematicsException(`Project target "build" not found.`);
exports.targetBuildNotFoundError = targetBuildNotFoundError;
//# sourceMappingURL=project-targets.js.map

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