New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ng-morph

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-morph - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

2

package.json
{
"name": "ng-morph",
"version": "1.5.1",
"version": "1.6.0",
"peerDependencies": {

@@ -5,0 +5,0 @@ "@angular-devkit/core": ">=11.0.0",

@@ -17,5 +17,5 @@ /**

export declare class DevkitFileSystem extends FileSystem {
private _tree;
readonly tree: Tree;
private _updateRecorderCache;
constructor(_tree: Tree);
constructor(tree: Tree);
resolve(...segments: string[]): Path;

@@ -22,0 +22,0 @@ edit(filePath: Path): UpdateRecorder;

@@ -20,5 +20,5 @@ "use strict";

class DevkitFileSystem extends file_system_1.FileSystem {
constructor(_tree) {
constructor(tree) {
super();
this._tree = _tree;
this.tree = tree;
this._updateRecorderCache = new Map();

@@ -34,3 +34,3 @@ }

}
const recorder = this._tree.beginUpdate(filePath);
const recorder = this.tree.beginUpdate(filePath);
this._updateRecorderCache.set(filePath, recorder);

@@ -40,3 +40,3 @@ return recorder;

commitEdits() {
this._updateRecorderCache.forEach((r) => this._tree.commitUpdate(r));
this._updateRecorderCache.forEach((r) => this.tree.commitUpdate(r));
this._updateRecorderCache.clear();

@@ -49,3 +49,3 @@ }

try {
return this._tree.get(fileOrDirPath) !== null;
return this.tree.get(fileOrDirPath) !== null;
}

@@ -60,12 +60,12 @@ catch (e) {

overwrite(filePath, content) {
this._tree.overwrite(filePath, content);
this.tree.overwrite(filePath, content);
}
create(filePath, content) {
this._tree.create(filePath, content);
this.tree.create(filePath, content);
}
delete(filePath) {
this._tree.delete(filePath);
this.tree.delete(filePath);
}
read(filePath) {
const buffer = this._tree.read(filePath);
const buffer = this.tree.read(filePath);
return buffer !== null ? buffer.toString() : null;

@@ -75,3 +75,3 @@ }

try {
const { subdirs: directories, subfiles: files } = this._tree.getDir(dirPath);
const { subdirs: directories, subfiles: files } = this.tree.getDir(dirPath);
return { directories, files };

@@ -78,0 +78,0 @@ }

@@ -10,2 +10,3 @@ /**

import { FileSystemHost } from 'ts-morph';
import { DevkitFileSystem } from './devkit-file-system';
/**

@@ -74,4 +75,4 @@ * A workspace path semantically is equivalent to the `Path` type provided by the

export declare class NgCliFileSystem implements FileSystemHost {
fs: FileSystem;
constructor(fs: FileSystem);
fs: DevkitFileSystem;
constructor(fs: DevkitFileSystem);
copy(srcPath: string, destPath: string): Promise<void>;

@@ -78,0 +79,0 @@ copySync(srcPath: string, destPath: string): void;

@@ -7,2 +7,5 @@ import { Project } from 'ts-morph';

getFileSystem(): NgCliFileSystem;
save(): Promise<void>;
saveSync(): void;
private trySaveTree;
}

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

const file_system_1 = require("./file-system");
const ng_morph_tree_1 = require("./ng-morph-tree");
class NgCliProject extends ts_morph_1.Project {

@@ -17,4 +18,25 @@ constructor(_a) {

}
save() {
const _super = Object.create(null, {
save: { get: () => super.save }
});
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield _super.save.call(this);
yield this.trySaveTree();
});
}
saveSync() {
super.saveSync();
this.trySaveTree();
}
trySaveTree() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const tree = this.getFileSystem().fs.tree;
if (tree instanceof ng_morph_tree_1.NgMorphTree) {
return tree.commitChanges();
}
});
}
}
exports.NgCliProject = NgCliProject;
//# sourceMappingURL=ng-cli-project.js.map
import { HostTree } from '@angular-devkit/schematics';
export declare class NgMorphTree extends HostTree {
private hostSink;
constructor(root?: string);
commitChanges(): Promise<void>;
}

@@ -10,6 +10,11 @@ "use strict";

constructor(root = process.cwd()) {
super(new host_1.ScopedHost(new node_1.NodeJsSyncHost(), core_1.normalize(root)));
const host = new host_1.ScopedHost(new node_1.NodeJsSyncHost(), core_1.normalize(root));
super(host);
this.hostSink = new schematics_1.HostSink(host);
}
commitChanges() {
return this.hostSink.commit(this).toPromise();
}
}
exports.NgMorphTree = NgMorphTree;
//# sourceMappingURL=ng-morph-tree.js.map
import { SourceFile } from 'ts-morph';
export declare function createSourceFile(filePath: string, content?: string): SourceFile;
export declare function createSourceFile(filePath: string, content?: string, { overwrite }?: {
overwrite?: boolean;
}): SourceFile;

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

const project_1 = require("ng-morph/project");
function createSourceFile(filePath, content) {
return project_1.getActiveProject().createSourceFile(filePath, content);
function createSourceFile(filePath, content, { overwrite = false } = {}) {
return project_1.getActiveProject().createSourceFile(filePath, content, { overwrite });
}
exports.createSourceFile = createSourceFile;
//# sourceMappingURL=create-source-file.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