Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@bronifty/fs-utils
Advanced tools
pnpm add @bronifty/fs-utils
import { getProjectRoot } from '@bronifty/fs-utils';
// same result as process.cwd()
console.log('getProjectRoot()', getProjectRoot());
console.log('process.cwd()', process.cwd());
import { getProjectRoot } from '@bronifty/fs-utils';
// same result as process.cwd()
console.log('getProjectRoot()', getProjectRoot());
console.log('process.cwd()', process.cwd());
const {
getProjectRoot,
readJsonFileRelativeToRoot,
} = require('@bronifty/fs-utils');
const json = await readJsonFileRelativeToRoot('./package.json');
const jsonWithGetProjectRoot = await readJsonFileRelativeToRoot(
`${getProjectRoot()}/package.json`,
);
// same result
console.log(json);
console.log(jsonWithGetProjectRoot);
import { readJsonFileRelativeToRoot, getProjectRoot } from '@bronifty/fs-utils';
const json = await readJsonFileRelativeToRoot('./package.json');
const jsonWithGetProjectRoot = await readJsonFileRelativeToRoot(
`${getProjectRoot()}/package.json`,
);
// same result
console.log(json);
console.log(jsonWithGetProjectRoot);
import { ObservableFactory } from '@bronifty/fs-utils';
const [getter, setter, subscriber] = ObservableFactory.useState([]);
let count = 0;
subscriber(() => count++);
const arr = [1, 2];
setter(arr);
arr.push(3);
setter([1, 2, 3]);
console.log('should equal 2: ', count);
arr.push(4);
console.log('should equal 2: ', count);
setter([1, 2, 3, 4]);
console.log('should equal 3: ', count);
console.log('should equal [1,2,3,4]: ', getter());
import React from 'react';
import MarcsObservable from '@bronifty/marcs-observable';
// declaring our observable state outside the component to maintain state across re-renders; this could also be done in a store and imported
const [
childObservableGetter,
childObservableSetter,
childObservableSubscriber,
] = MarcsObservable.useState(0);
const [parentObservableGetter] = MarcsObservable.useState(
() => childObservableGetter() * 2,
);
let unsubscribe = () => {};
const App = () => {
// subscribing react hook for ui update to observable value update inside a useEffect so it runs once on mount and doesn't get re-assigned every re-render
const [input1, setInput1] = React.useState(childObservableGetter());
React.useEffect(() => {
unsubscribe = childObservableSubscriber((newVal: any) => {
setInput1(newVal);
});
return () => {
unsubscribe();
};
}, []); // Empty dependency array ensures this effect runs only once on mount
const handleInputChange = (e: any) => {
childObservableSetter(e.target.value); // Update observable state
};
return (
<>
<section>
<h2>numeric input</h2>
<input type="number" value={input1} onChange={handleInputChange} />
<p>
childObservableGetter value (childObservableGetter()):{' '}
{childObservableGetter()}
</p>
<p>
parentObservableGetter value (parentObservableGetter()):{' '}
{parentObservableGetter()}
</p>
<button onClick={unsubscribe}>unsubscribe from ui updates</button>
</section>
</>
);
};
export default App;
{
"compilerOptions": {
"target": "ES2020",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"outDir": "./dist",
"rootDir": "./src",
"typeRoots": ["./node_modules/@bronifty/fs-utils/dist/types"]
},
"include": ["src/**/*"],
"exclude": ["node_modules"]
}
FAQs
### Using [ByteDance Web-Infra modern.js module-tools](https://modernjs.dev/module-tools/en/api/plugin-api/plugin-hooks.html) to build an npm library which uses umd (works with import and require)
The npm package @bronifty/fs-utils receives a total of 4 weekly downloads. As such, @bronifty/fs-utils popularity was classified as not popular.
We found that @bronifty/fs-utils demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.