Project files

This commit is contained in:
2023-11-09 18:47:11 +01:00
parent 695abe054b
commit c415135aae
8554 changed files with 858111 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
## [1.0.3](https://github.com/streamich/fs-monkey/compare/v1.0.2...v1.0.3) (2021-04-05)
### Bug Fixes
* add missing parameter in jsdoc for `patchRequire` ([#233](https://github.com/streamich/fs-monkey/issues/233)) ([28a5d9b](https://github.com/streamich/fs-monkey/commit/28a5d9b46fbdfec42c6d841aec31874ea9ea9ca4))
## [1.0.1](https://github.com/streamich/fs-monkey/compare/v1.0.0...v1.0.1) (2020-05-14)
### Bug Fixes
* release broken import ([70080c5](https://github.com/streamich/fs-monkey/commit/70080c5fbb1e4ac82497016c4e06218cdedacd72))
# [1.0.0](https://github.com/streamich/fs-monkey/compare/v0.3.1...v1.0.0) (2020-02-17)
### Bug Fixes
* export `unixify` from top level ([d274d74](https://github.com/streamich/fs-monkey/commit/d274d74a29c368a5f881f5f2acf81c4772497581))
* export `util` from top level ([16655c5](https://github.com/streamich/fs-monkey/commit/16655c583a7e1a3237ec7351c50a0fae373d8795))
### Continuous Integration
* 🎡 update semantic-release setup ([5553829](https://github.com/streamich/fs-monkey/commit/555382978f50646ec537330e8a50a6f06ef9b6e3))
### BREAKING CHANGES
* 🧨 Release new major

View File

@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

45
receipeServer/frontend_old/node_modules/fs-monkey/README.md generated vendored Executable file
View File

@@ -0,0 +1,45 @@
# fs-monkey
[![][npm-img]][npm-url] [![][travis-badge]][travis-url]
Monkey-patches for filesystem related things.
- Rewrite `require` function to load Node's modules from memory.
- Or rewrite the whole `fs` filesystem module.
## Install
```shell
npm install --save fs-monkey
```
## Terms
An *fs-like* object is an object that implements methods of Node's
[filesystem API](https://nodejs.org/api/fs.html).
It is denoted as `vol`:
```js
let vol = {
readFile: () => { /* ... */ },
readFileSync: () => { /* ... */ },
// etc...
}
```
## Reference
- [`patchFs`](./docs/api/patchFs.md) - rewrites Node's filesystem module `fs` with *fs-like* object `vol`
- [`patchRequire`](./docs/api/patchRequire.md) - rewrites `require` function, patches Node's `module` module to use a given *fs-like* object for module loading
[npm-img]: https://img.shields.io/npm/v/fs-monkey.svg
[npm-url]: https://www.npmjs.com/package/fs-monkey
[travis-url]: https://travis-ci.org/streamich/fs-monkey
[travis-badge]: https://travis-ci.org/streamich/fs-monkey.svg?branch=master
## License
[Unlicense](./LICENSE) - public domain.

View File

@@ -0,0 +1,29 @@
# `patchFs(vol[, fs])`
Rewrites Node's filesystem module `fs` with *fs-like* object.
- `vol` - fs-like object
- `fs` *(optional)* - a filesystem to patch, defaults to `require('fs')`
```js
import {patchFs} from 'fs-monkey';
const myfs = {
readFileSync: () => 'hello world',
};
patchFs(myfs);
console.log(require('fs').readFileSync('/foo/bar')); // hello world
```
You don't need to create *fs-like* objects yourself, use [`memfs`](https://github.com/streamich/memfs)
to create a virtual filesystem for you:
```js
import {vol} from 'memfs';
import {patchFs} from 'fs-monkey';
vol.fromJSON({'/dir/foo': 'bar'});
patchFs(vol);
console.log(require('fs').readdirSync('/')); // [ 'dir' ]
```

View File

@@ -0,0 +1,55 @@
# `patchRequire(vol[, unixifyPaths[, Module]])`
Patches Node's `module` module to use a given *fs-like* object `vol` for module loading.
- `vol` - fs-like object
- `unixifyPaths` *(optional)* - whether to convert Windows paths to unix style paths, defaults to `false`.
- `Module` *(optional)* - a module to patch, defaults to `require('module')`
Monkey-patches the `require` function in Node, this way you can make
Node.js to *require* modules from your custom filesystem.
It expects an object with three filesystem methods implemented that are
needed for the `require` function to work.
```js
let vol = {
readFileSync: () => {},
realpathSync: () => {},
statSync: () => {},
};
```
If you want to make Node.js to *require* your files from memory, you
don't need to implement those functions yourself, just use the
[`memfs`](https://github.com/streamich/memfs) package:
```js
import {vol} from 'memfs';
import {patchRequire} from 'fs-monkey';
vol.fromJSON({'/foo/bar.js': 'console.log("obi trice");'});
patchRequire(vol);
require('/foo/bar'); // obi trice
```
Now the `require` function will only load the files from the `vol` file
system, but not from the actual filesystem on the disk.
If you want the `require` function to load modules from both file
systems, use the [`unionfs`](https://github.com/streamich/unionfs) package
to combine both filesystems into a union:
```js
import {vol} from 'memfs';
import {patchRequire} from 'fs-monkey';
import {ufs} from 'unionfs';
import * as fs from 'fs';
vol.fromJSON({'/foo/bar.js': 'console.log("obi trice");'});
ufs
.use(vol)
.use(fs);
patchRequire(ufs);
require('/foo/bar.js'); // obi trice
```

View File

@@ -0,0 +1,69 @@
{
"name": "fs-monkey",
"version": "1.0.3",
"description": "Monkey patches for file system related things.",
"main": "lib/index.js",
"license": "Unlicense",
"keywords": [
"fs",
"file",
"file system",
"monkey",
"fsmonkey",
"monkeyfs",
"monkeypatch",
"patch"
],
"files": [
"lib",
"!lib/__tests__",
"docs"
],
"directories": {
"doc": "docs"
},
"repository": {
"type": "git",
"url": "https://github.com/streamich/fs-monkey.git"
},
"scripts": {
"build": "babel src --out-dir lib",
"test": "jest"
},
"dependencies": {},
"devDependencies": {
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.14",
"@babel/preset-env": "^7.13.12",
"@semantic-release/changelog": "5.0.1",
"@semantic-release/git": "9.0.0",
"@semantic-release/npm": "7.1.0",
"@types/jest": "26.0.22",
"@types/node": "8.10.66",
"babel-jest": "26.6.3",
"jest": "26.6.3",
"semantic-release": "17.4.2",
"source-map-support": "0.5.19"
},
"release": {
"verifyConditions": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
],
"prepare": [
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.js"
],
"transform": {
"^.+\\.jsx?$": "babel-jest"
},
"testRegex": ".*(__tests__/|/test/unit/).*(test|spec)\\.(t|j)sx?$"
}
}