Skip to content

Commit 918f493

Browse files
committed
[docs] added jsdocs for options
1 parent d90a9cc commit 918f493

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/index.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@ const MagicString = require('magic-string');
44

55
const hasOwnProperty = Object.prototype.hasOwnProperty;
66

7-
function nativePlugin(options) {
7+
/**
8+
* @interface RollupPluginNativesOptions
9+
* @property {string?} [copyTo='./'] Where we want to physically put the extracted .node files
10+
* @property {string?} [destDir='./'] Path to the same folder, relative to the output bundle js
11+
* @property {boolean?} [dlopen=false] Use `dlopen` instead of `require`/`import`. This must be set to true if using a different file extension that '.node'
12+
* @property {function(modulePath:string):(string|{name:string, copyTo:string})?} [map] Modify the final filename for specific modules. A function that receives a full path to the original file,
13+
* and returns a desired filename or desired file name and a specific destination to copy to.
14+
* @property {boolean?} [sourcemap=true] Generate sourcemap
15+
*/
16+
/** */
17+
18+
19+
function nativePlugin(/**RollupPluginNativesOptions*/options) {
820

921
let copyTo = options.copyTo || './';
1022
let destDir = options.destDir || './';
1123
let dlopen = options.dlopen || false;
1224
let map = options.map;
13-
let isSourceMapEnabled = options.sourceMap !== false && options.sourcemap !== false;
25+
let isSourceMapEnabled = options['sourceMap'] !== false && options.sourcemap !== false;
1426

1527
if (typeof map !== 'function') {
1628
map = fullPath => generateDefaultMapping(fullPath);
@@ -123,7 +135,7 @@ function nativePlugin(options) {
123135

124136
return {
125137
name: 'rollup-plugin-natives',
126-
138+
127139
buildStart(_options) {
128140
Fs.mkdirpSync(copyTo, { recursive: true });
129141
},

0 commit comments

Comments
 (0)