Skip to content

Commit 743b95c

Browse files
committed
feat: rename cjs-module to ncjsm
1 parent 2f01ffc commit 743b95c

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,32 @@
33
![Transpilation status][transpilation-image]
44
[![npm version][npm-image]][npm-url]
55

6-
# cjs-module
6+
# ncjsm
77

8-
## CJS (Node.js) modules resolver
8+
## (Node.js) CJS modules resolver
99

10-
Environment agnostic CJS (Node.js) modules resolver.
10+
Environment agnostic (Node.js) CJS modules resolver.
1111
It implements a _strict_ version of Node.js modules resolution logic, differences are as follows:
1212

13-
* [Loading from global folders](https://nodejs.org/api/all.html#all_loading_from_the_global_folders) is not supported
14-
* Only Unix path separators (`/`) are supported in require's _path_ arguments (_Background: even though Node.js internally seems to follow Windows path separator in Windows environment, it won't work in \*nix environments, and even in Window env it's [not reliable](https://github.com/nodejs/node/issues/6049) so by all means should be avoided_)
15-
* There's no awareness of node.js [core modules](https://nodejs.org/api/all.html#all_core_modules)
13+
- [Loading from global folders](https://nodejs.org/api/all.html#all_loading_from_the_global_folders) is not supported
14+
- Only Unix path separators (`/`) are supported in require's _path_ arguments (_Background: even though Node.js internally seems to follow Windows path separator in Windows environment, it won't work in \*nix environments, and even in Window env it's [not reliable](https://github.com/nodejs/node/issues/6049) so by all means should be avoided_)
15+
- There's no awareness of node.js [core modules](https://nodejs.org/api/all.html#all_core_modules)
1616
e.g. `resolve(dir, 'fs')` will naturally result with _null_
1717

1818
### Installation
1919

20-
$ npm install cjs-module
20+
$ npm install ncjsm
2121

2222
### API
2323

2424
#### getResolver(extensions, confirmFile, resolvePackageMain)
2525

2626
For provided configuration, returns a CJS modules resolver:
2727

28-
* **extensions** - List of supported file extensions in order of singificance, e.g. for Node.js it would be `['.js', '.json', '.node']`
29-
* **confirmFile** - a `confirmFile(filepath)` function. Confirms whether there's a module at provided (not normalized, absolute) file path. Returns promise-like object which resolves with either normalized full path of a module or null (if there's no module for given path).
28+
- **extensions** - List of supported file extensions in order of singificance, e.g. for Node.js it would be `['.js', '.json', '.node']`
29+
- **confirmFile** - a `confirmFile(filepath)` function. Confirms whether there's a module at provided (not normalized, absolute) file path. Returns promise-like object which resolves with either normalized full path of a module or null (if there's no module for given path).
3030
Although result is expected to be a promise-like object, resolution can be synchronous.
31-
* **resolvePackageMain** - a `resolvePackageMain(dirpath)` function. Returns value of _package.json_'s `main` property for given path. Returns promise-like object which resolves with either resolved value, or null, when either `package.json` file was not found, or it didn't have _main_ property.
31+
- **resolvePackageMain** - a `resolvePackageMain(dirpath)` function. Returns value of _package.json_'s `main` property for given path. Returns promise-like object which resolves with either resolved value, or null, when either `package.json` file was not found, or it didn't have _main_ property.
3232
Same as with `confirmFile` resolution can be synchronous.
3333

3434
#### resolve(dir, path)
@@ -40,7 +40,7 @@ Returns promise. If no matching module was found, promise resolves with `null` o
4040
full module path becomes a resolved value.
4141

4242
```javascript
43-
var resolve = require("cjs-module/resolve");
43+
var resolve = require("ncjsm/resolve");
4444

4545
// Asynchronously resolve path for 'foo' module against current path
4646
resolve(__dirname, "foo").done(function(fooModulePath) {
@@ -60,7 +60,7 @@ Synchronously resolves module path against provided directory path.
6060
If matching module was found then full module path is returned, otherwise `null`.
6161

6262
```javascript
63-
var resolveSync = require("cjs-module/resolve/sync");
63+
var resolveSync = require("ncjsm/resolve/sync");
6464

6565
// Synchronously resolve path for 'foo' module against current path
6666
var fooModulePath = resolveSync(__dirname, "foo");
@@ -76,7 +76,7 @@ if (!fooModulePath) {
7676
Whether provided path is a root of a package
7777

7878
```javascript
79-
var isPackageRoot = require("cjs-module/is-package-root");
79+
var isPackageRoot = require("ncjsm/is-package-root");
8080

8181
isPackageRoot(dirPath).done(function(isRoot) {
8282
if (isRoot) {
@@ -90,7 +90,7 @@ isPackageRoot(dirPath).done(function(isRoot) {
9090
Resolve package root path for provided path. It is about resolution of first upper package root
9191

9292
```javascript
93-
var resolvePackageRoot = require("cjs-module/resolve-package-root");
93+
var resolvePackageRoot = require("ncjsm/resolve-package-root");
9494

9595
resolvePackageRoot(dirPath).done(function(root) {
9696
if (!root) {
@@ -104,7 +104,7 @@ resolvePackageRoot(dirPath).done(function(root) {
104104
Resolve project root path for provided path. It is about resolution of topmost package root for given path
105105

106106
```javascript
107-
var resolveProjectRoot = require("cjs-module/resolve-project-root");
107+
var resolveProjectRoot = require("ncjsm/resolve-project-root");
108108

109109
resolveProjectRoot(dirPath).done(function(root) {
110110
if (!root) {
@@ -118,21 +118,21 @@ resolveProjectRoot(dirPath).done(function(root) {
118118
Resolve all module dependencies. Returns promise that resolves with an array of paths, that includes path to input module and paths to all its dependencies (it includes deep dependencies, so also dependencies of the dependencies)
119119

120120
```javascript
121-
var getDependencies = require("cjs-module/get-dependencies");
121+
var getDependencies = require("ncjsm/get-dependencies");
122122

123123
getDependencies(modulePath).done(function(deps) {
124124
console.log(deps); // e.g. [pathToModulePath, pathToDep1, pathToDep2, ...pathToDepn]
125125
});
126126
```
127127

128-
## Tests [![Build Status](https://travis-ci.org/medikoo/cjs-module.svg)](https://travis-ci.org/medikoo/cjs-module)
128+
## Tests [![Build Status](https://travis-ci.org/medikoo/ncjsm.svg)](https://travis-ci.org/medikoo/ncjsm)
129129

130130
$ npm test
131131

132-
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/cjs-module/branches/master/shields_badge.svg
133-
[nix-build-url]: https://semaphoreci.com/medikoo-org/cjs-module
132+
[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/ncjsm/branches/master/shields_badge.svg
133+
[nix-build-url]: https://semaphoreci.com/medikoo-org/ncjsm
134134
[win-build-image]: https://ci.appveyor.com/api/projects/status/i68ocohu91ejv77k?svg=true
135-
[win-build-url]: https://ci.appveyor.com/project/medikoo/cjs-module
135+
[win-build-url]: https://ci.appveyor.com/project/medikoo/ncjsm
136136
[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg
137-
[npm-image]: https://img.shields.io/npm/v/cjs-module.svg
138-
[npm-url]: https://www.npmjs.com/package/cjs-module
137+
[npm-image]: https://img.shields.io/npm/v/ncjsm.svg
138+
[npm-url]: https://www.npmjs.com/package/ncjsm

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "cjs-module",
2+
"name": "ncjsm",
33
"version": "1.5.0",
44
"description": "CJS (Node.js) style modules resolver",
55
"author": "Mariusz Nowak <medyk@medikoo.com> (http://www.medikoo.com/)",
@@ -12,7 +12,7 @@
1212
],
1313
"repository": {
1414
"type": "git",
15-
"url": "git://github.com/medikoo/cjs-module.git"
15+
"url": "medikoo/ncjsm"
1616
},
1717
"dependencies": {
1818
"builtin-modules": "2",

0 commit comments

Comments
 (0)