Comparing version 1.2.0 to 1.3.0
@@ -13,3 +13,3 @@ { | ||
], | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": "Alan K <ack@modeswitch.org> (http://blog.modeswitch.org)", | ||
@@ -49,26 +49,28 @@ "homepage": "http://filerjs.github.io/filer", | ||
"dependencies": { | ||
"es6-promisify": "^6.1.0", | ||
"minimatch": "^3.0.4" | ||
"es6-promisify": "^7.0.0", | ||
"minimatch": "^3.0.4", | ||
"schema-utils": "^3.1.1" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"chai-datetime": "^1.5.0", | ||
"eslint": "^6.8.0", | ||
"fake-indexeddb": "^3.0.0", | ||
"karma": "^5.0.1", | ||
"regenerator-runtime": "^0.13.9", | ||
"chai": "^4.3.4", | ||
"chai-datetime": "^1.8.0", | ||
"eslint": "^7.20.0", | ||
"fake-indexeddb": "^3.1.4", | ||
"karma": "^6.3.4", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-firefox-launcher": "^1.3.0", | ||
"karma-mocha": "^1.3.0", | ||
"karma-firefox-launcher": "^2.1.1", | ||
"karma-mocha": "^2.0.1", | ||
"karma-mocha-reporter": "^2.2.5", | ||
"karma-summary-reporter": "^1.7.2", | ||
"meow": "^6.1.0", | ||
"mocha": "^7.1.1", | ||
"nyc": "^15.0.1", | ||
"parcel-bundler": "^1.12.4", | ||
"pretty-bytes": "^5.3.0", | ||
"release-it": "^13.5.2", | ||
"karma-summary-reporter": "^3.0.0", | ||
"meow": "^10.0.1", | ||
"mocha": "^9.1.3", | ||
"nyc": "^15.1.0", | ||
"parcel-bundler": "^1.12.5", | ||
"pretty-bytes": "^5.6.0", | ||
"release-it": "^14.11.6", | ||
"run.env": "^1.1.0", | ||
"unused-filename": "^2.1.0", | ||
"walk": "^2.3.14" | ||
"unused-filename": "^3.0.1", | ||
"walk": "^2.3.15" | ||
}, | ||
@@ -75,0 +77,0 @@ "main": "./src/index.js", |
@@ -57,2 +57,63 @@ [![NPM](https://nodei.co/npm/filer.png?downloads=true&stars=true)](https://nodei.co/npm/filer/) | ||
### Webpack Plugin | ||
Filer can be used as a drop-in replacement for the node.js [fs](http://nodejs.org/api/fs.html) and | ||
[path](http://nodejs.org/api/path.html) modules. For convenience, filer provides a webpack plugin which | ||
will shim the desired node.js functionality. This plugin can be used by inserting the following into | ||
your webpack config: | ||
```javascript | ||
// webpack.config.js | ||
var filer = require('filer'); | ||
module.exports = { | ||
plugins: [ | ||
new filer.FilerWebpackPlugin(), | ||
], | ||
} | ||
``` | ||
You can then import the node.js [fs](http://nodejs.org/api/fs.html) and [path](http://nodejs.org/api/path.html) | ||
modules as normal and FilerWebpackPlugin will ensure that webpack will resolve references to these modules to | ||
the appropriate filer shims. You will then be able to use these modules as normal (with the exception of the | ||
synchronous fs methods e.g. `mkdirSync()`). | ||
```javascript | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
``` | ||
The filer webpack plugin will, by default, shim the [fs](http://nodejs.org/api/fs.html) and | ||
[path](http://nodejs.org/api/path.html) modules. However, it's behaviour can be customised by passing an | ||
options object. | ||
```javascript | ||
// webpack.config.js | ||
module.exports = { | ||
plugins: [ | ||
new filer.FilerWebpackPlugin({ | ||
// Options | ||
}), | ||
], | ||
} | ||
``` | ||
The following options can be passed to the filer webpack plugin: | ||
| Option | Type | Optional | Default | Description | | ||
|---------------|---------|----------|--------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| filerDir | string | yes | '\<rootDir\>/node_modules/filer' | The directory in which filer is installed. | | ||
| shimsDir | string | yes | '\<rootDir\>/node_modules/filer/shims' | The directory in which the shims are installed. | | ||
| fsProviderDir | string | yes | '\<rootDir\>/node_modules/filer/shims/providers' | The directory in which the shims are located. This option is required when using a custom provider. | | ||
| shimFs | boolean | yes | true | Should the fs module be shimmed. | | ||
| shimPath | boolean | yes | true | Should the path module be shimmed. | | ||
| fsProvider | string | yes | 'default' | The file system provider to use. Should be one of 'default', 'indexeddb', 'memory', 'custom'. The 'default' option is equivalent to 'indexeddb'. | | ||
NOTE: '\<rootDir\>' will be resolved to the current working directory. | ||
Though filer also exposes the Buffer object, it is left up to the user to shim this as appropriate. This is because filer offers | ||
no custom implementation. Currently, filer uses the [node-libs-browser](https://github.com/webpack/node-libs-browser) Buffer implementation | ||
internally, though any faithful implementation of the [node.js Buffer object](http://nodejs.org/api/buffer.html) should play nicely | ||
with filer. | ||
### Getting Started | ||
@@ -792,3 +853,3 @@ | ||
#### fs.readdir(path, callback)<a name="readdir"></a> | ||
#### fs.readdir(path, [options], callback)<a name="readdir"></a> | ||
@@ -814,2 +875,8 @@ Reads the contents of a directory. Asynchronous [readdir(3)](http://pubs.opengroup.org/onlinepubs/009695399/functions/readdir.html). | ||
Optionally accepts an options parameter, which can be either an encoding (e.g. "utf8") or an object with optional properties `encoding` and `withFileTypes`. | ||
The `encoding` property is a `string` which will determine the character encoding to use for the names of each directory entry. The `withFileTypes` property is a `boolean` which defaults to `false`. If `true`, this method will return an array of [fs.Dirent](https://nodejs.org/api/fs.html#fs_class_fs_dirent) objects. | ||
The `name` property on the [fs.Dirent](https://nodejs.org/api/fs.html#fs_class_fs_dirent) objects will be encoded using the specified character encoding. | ||
#### fs.close(fd, callback)<a name="close"></a> | ||
@@ -816,0 +883,0 @@ |
@@ -11,3 +11,4 @@ let fs = null; | ||
Errors: require('./errors.js'), | ||
Shell: require('./shell/shell.js') | ||
Shell: require('./shell/shell.js'), | ||
FilerWebpackPlugin: require('./webpack-plugin'), | ||
}; | ||
@@ -14,0 +15,0 @@ |
@@ -13,3 +13,3 @@ /** | ||
const nodePath = require('path'); | ||
const filerPath = Object.create(nodePath); | ||
const filerPath = Object.assign({}, nodePath); | ||
@@ -16,0 +16,0 @@ /** |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
3709468
36
23020
1744
3
21
5
+ Addedschema-utils@^3.1.1
+ Added@types/json-schema@7.0.15(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedajv-keywords@3.5.2(transitive)
+ Addedes6-promisify@7.0.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedschema-utils@3.3.0(transitive)
+ Addeduri-js@4.4.1(transitive)
- Removedes6-promisify@6.1.1(transitive)
Updatedes6-promisify@^7.0.0