feat: 초기 프로젝트 설정 및 룰.md 파일 추가
This commit is contained in:
21
api.hyungi.net/node_modules/module-details-from-path/LICENSE
generated
vendored
Normal file
21
api.hyungi.net/node_modules/module-details-from-path/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2025 Thomas Watson Steen
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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 OR COPYRIGHT HOLDERS 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.
|
||||
32
api.hyungi.net/node_modules/module-details-from-path/README.md
generated
vendored
Normal file
32
api.hyungi.net/node_modules/module-details-from-path/README.md
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# module-details-from-path
|
||||
|
||||
Resolve npm package details, like name and base path, given an absolute path to a file inside a package.
|
||||
|
||||
[](https://github.com/feross/standard)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install module-details-from-path --save
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const assert = require('assert')
|
||||
const parse = require('module-details-from-path')
|
||||
|
||||
const path = '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube/bin/tube.js'
|
||||
|
||||
assert.deepStrictEqual(parse(path), {
|
||||
name: 'picture-tube',
|
||||
basedir: '/Users/watson/code/node_modules/blackjack/node_modules/picture-tube',
|
||||
path: 'bin/tube.js'
|
||||
})
|
||||
```
|
||||
|
||||
Returns `undefined` if module details cannot be found.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
41
api.hyungi.net/node_modules/module-details-from-path/index.js
generated
vendored
Normal file
41
api.hyungi.net/node_modules/module-details-from-path/index.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
|
||||
var sep = require('path').sep
|
||||
|
||||
module.exports = function (file) {
|
||||
var segments = file.split(sep)
|
||||
var index = segments.lastIndexOf('node_modules')
|
||||
|
||||
if (index === -1) return
|
||||
if (!segments[index + 1]) return
|
||||
|
||||
var scoped = segments[index + 1][0] === '@'
|
||||
var name = scoped ? segments[index + 1] + '/' + segments[index + 2] : segments[index + 1]
|
||||
var offset = scoped ? 3 : 2
|
||||
|
||||
var basedir = ''
|
||||
var lastBaseDirSegmentIndex = index + offset - 1
|
||||
for (var i = 0; i <= lastBaseDirSegmentIndex; i++) {
|
||||
if (i === lastBaseDirSegmentIndex) {
|
||||
basedir += segments[i]
|
||||
} else {
|
||||
basedir += segments[i] + sep
|
||||
}
|
||||
}
|
||||
|
||||
var path = ''
|
||||
var lastSegmentIndex = segments.length - 1
|
||||
for (var i2 = index + offset; i2 <= lastSegmentIndex; i2++) {
|
||||
if (i2 === lastSegmentIndex) {
|
||||
path += segments[i2]
|
||||
} else {
|
||||
path += segments[i2] + sep
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
name: name,
|
||||
basedir: basedir,
|
||||
path: path
|
||||
}
|
||||
}
|
||||
47
api.hyungi.net/node_modules/module-details-from-path/package.json
generated
vendored
Normal file
47
api.hyungi.net/node_modules/module-details-from-path/package.json
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "module-details-from-path",
|
||||
"version": "1.0.4",
|
||||
"description": "Resolve npm package details, like name and base path, given an absolute path to a file inside a package",
|
||||
"main": "index.js",
|
||||
"files": [],
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"bench-node": "^0.5.4",
|
||||
"standard": "^15.0.1",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node --allow-natives-syntax bench.js",
|
||||
"lint": "standard",
|
||||
"test": "standard && node test.js",
|
||||
"test:ci": "node test.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/watson/module-details-from-path.git"
|
||||
},
|
||||
"keywords": [
|
||||
"node",
|
||||
"nodejs",
|
||||
"npm",
|
||||
"module",
|
||||
"package",
|
||||
"extract",
|
||||
"parse",
|
||||
"name",
|
||||
"basedir",
|
||||
"directory",
|
||||
"path",
|
||||
"relative"
|
||||
],
|
||||
"author": "Thomas Watson <w@tson.dk> (https://wa.tson.dk/)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/watson/module-details-from-path/issues"
|
||||
},
|
||||
"homepage": "https://github.com/watson/module-details-from-path#readme",
|
||||
"coordinates": [
|
||||
55.666507,
|
||||
12.5798711
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user