Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@emitty/core
Advanced tools
A platform for finding dependencies between files and building tools for incremental compilation or build
A platform for finding dependencies between files and building tools for incremental compilation or build.
Do you like this project? Support it by donating, creating an issue or pull request.
npm install @emitty/core
const emitty = require('@emitty/core').configure();
emitty.language({
extensions: ['.pug', '.jade'],
parser: require('@emitty/language-pug').parse
});
await emitty.filter('home.png'); // true
await emitty.filter('home.png', 'news.png'); // false
Returns an Emitty instance with the methods described below.
false
Options
See Options section.
Adds language support.
true
Language
Specification of the language to be added.
:1234: How to add my own language?
export type Language = {
extensions: string[]; // ['.pug', '.jade']
parser: (filepath: string, buffer: Buffer) => { references: string[] };
};
Loads information from the snapshot to the storage.
true
Snapshot
Snapshot storage.
Returns an object that contains a storage in the snapshot format.
Completely cleans the storage.
Determines whether to compile the changed file if it is passed.
:1234: How does it works?
true
string
The file that is currently being processed by the builder or compiler.
false
string
The file that trigger the build or compile.
string
process.cwd()
The current working directory.
FileSystemAdapter
fs.*
Custom implementation of methods for working with the file system.
export type FileSystemAdapter = {
access?: typeof fs.access;
constants?: typeof fs.constants;
readFile?: typeof fs.readFile;
};
The .configure
method initiates a storage to which all relationships between the files being processed are later written.
When you call the .filter
method without the changed
file, @emitty reads the source
file and builds a dependency tree for that file (with recursive reads of dependencies). In this case, the filter always returns true
to ensure that all files in the project are compiled and collected in the storage.
When you call the .filter
method with the changed
file, @emitty reads only the changed
file and updates its dependencies (without recursive reads of dependencies). In this case, the filter returns true
if there is a reference to the changed
file in the dependency tree of the source
file. Otherwise false
.
gulp
?Look at the gulp.js
file for an example.
You can use the .language
method with any language, even your own. Just implement the parser for your language.
type File = {
references: string[];
};
export function myOwnLanguageParser(filepath: string, buffer: Buffer): Promise<File> {
return Promise.resolve({
references: ['home.own.language', 'components/header.own.language']
});
}
Next, just use it with the .language
method.
See the Releases section of our GitHub project for changelog for each release version.
This software is released under the terms of the MIT license.
FAQs
A platform for finding dependencies between files and building tools for incremental compilation or build
We found that @emitty/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.