nodejs helpers for bit-bundler and bit-imports
npm install bit-bundler-utils
nodejs helpers for bit-bundler and bit-imports
- @param {string} moduleId - module id generated by bit-loader to convert to module id consumed by bit-bundler.
- @returns {int} module id to be consumed by bit-bundler.
> uniqueId.getId will cache the results it produces so that subsequent calls with the same input generates the exact same output.
- @param {string} moduleId - module id generated by bit-loader.
- @param {string} value - unique value to be mapped to the module id.
> uniqueId.setId can be called multiple times with the same value successfully.
resolvePath uses browser-resolve for node.js module resolution.- @param {{ string: name }} input - Object with the property name of the module to be resolved.
- @param {object} browserResolveOptions - Options to be forwarded to browser-resolve. baseUrl defaults to process.cwd().
- @returns {Promise} Promise that when resolved it returns an object with a property path for the module.
`` javascript
var resolver = require("bit-bundler-utils/resolvePath");
resolver({
name: "jquery"
})
.then(function(result) {
console.log(result.path);
return result;
});
`
- @param {{ string: path }} input - Object with property path for the file to be loaded from disk.
- @returns {Promise} That when resolved, returns and object with a string property containing the file content
#### Example
` javascript
var readFile = require("bit-bundler-utils/readFile");
readFile({
path: "./file/path"
})
.then(function(result) {
console.log(result.source);
return result;
});
``
License
===============
Licensed under MIT