commit
45e3b12d18
42 changed files with 10373 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||
# http://editorconfig.org |
|||
root = true # 应在文件顶部指定的特殊属性,true表示停止搜索当前文件 |
|||
|
|||
[*] |
|||
charset = utf-8 # 统一字符格式 |
|||
indent_style = space # 缩进方式为空格 |
|||
indent_size = 2 # 缩进为两个空格 |
|||
end_of_line = lf # 换行符统一用lf |
|||
insert_final_newline = true # 保证文件结尾留一个空行 |
|||
trim_trailing_whitespace = true # 移除新一行前的空白字符 |
|||
|
|||
[*.md] |
|||
insert_final_newline = false |
|||
trim_trailing_whitespace = false |
@ -0,0 +1 @@ |
|||
NODE_ENV=development |
@ -0,0 +1,3 @@ |
|||
.vscode |
|||
.idea |
|||
node_modules |
Binary file not shown.
File diff suppressed because it is too large
@ -0,0 +1,30 @@ |
|||
{ |
|||
"name": "hapi-demo", |
|||
"version": "1.0.0", |
|||
"description": "", |
|||
"private": true, |
|||
"main": "index.js", |
|||
"scripts": { |
|||
"start": "npx ts-node-dev --project ./tsconfig.json -r tsconfig-paths/register ./source/main.ts", |
|||
"temp": "nodemon --exec 'npx ts-node-dev -r tsconfig-paths/register ./source/main.ts'" |
|||
}, |
|||
"keywords": [], |
|||
"author": "", |
|||
"license": "ISC", |
|||
"dependencies": { |
|||
"@hapi/hapi": "^20.1.2", |
|||
"@hapi/inert": "^6.0.3", |
|||
"multiparty": "^4.2.2", |
|||
"nodemon": "^2.0.7" |
|||
}, |
|||
"devDependencies": { |
|||
"@hapi/vision": "^6.1.0", |
|||
"@noderun/hapi-router": "link:packages/hapi-router", |
|||
"dotenv": "^10.0.0", |
|||
"ejs": "^3.1.6", |
|||
"file-type": "^16.5.0", |
|||
"ts-node-dev": "^1.1.6", |
|||
"tsconfig-paths": "^3.9.0", |
|||
"typescript": "^4.3.2" |
|||
} |
|||
} |
@ -0,0 +1 @@ |
|||
node_modules |
@ -0,0 +1,4 @@ |
|||
# @noderun/hapi-router |
|||
|
|||
> 发布:npm publish --access public |
|||
> 删除:npm unpublish --force |
@ -0,0 +1,251 @@ |
|||
#!/usr/bin/env node
|
|||
'use strict'; |
|||
|
|||
Object.defineProperty(exports, '__esModule', { value: true }); |
|||
|
|||
var fs = require('fs'); |
|||
var path = require('path'); |
|||
|
|||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } |
|||
|
|||
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); |
|||
var path__default = /*#__PURE__*/_interopDefaultLegacy(path); |
|||
|
|||
/*! ***************************************************************************** |
|||
Copyright (c) Microsoft Corporation. |
|||
|
|||
Permission to use, copy, modify, and/or distribute this software for any |
|||
purpose with or without fee is hereby granted. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH |
|||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY |
|||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, |
|||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM |
|||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
|||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|||
PERFORMANCE OF THIS SOFTWARE. |
|||
***************************************************************************** */ |
|||
|
|||
function __values(o) { |
|||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; |
|||
if (m) return m.call(o); |
|||
if (o && typeof o.length === "number") return { |
|||
next: function () { |
|||
if (o && i >= o.length) o = void 0; |
|||
return { value: o && o[i++], done: !o }; |
|||
} |
|||
}; |
|||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); |
|||
} |
|||
|
|||
function removeIndex(ss) { |
|||
var remove = function (str) { |
|||
if (str.endsWith("/index")) { |
|||
return str.slice(0, -6); |
|||
} |
|||
if (str.endsWith("index")) { |
|||
return str.slice(0, -5); |
|||
} |
|||
return str ? str : "/"; |
|||
}; |
|||
var r = true; |
|||
var rr = ss; |
|||
while (r) { |
|||
if (rr.endsWith("/index")) { |
|||
rr = remove(rr); |
|||
} |
|||
else { |
|||
r = false; |
|||
} |
|||
} |
|||
return rr ? rr : "/"; |
|||
} |
|||
function isIndexEnd(str) { |
|||
return str.length == 1 && str.endsWith("/"); |
|||
} |
|||
function walkDir(filePath, exclude) { |
|||
if (exclude === void 0) { exclude = ["node_modules", "^_", ".git", ".idea", ".gitignore", "client"]; } |
|||
var files = []; |
|||
function Data(opts) { |
|||
this.relativeDir = opts.relativeDir; |
|||
this.relativeFile = opts.relativeFile; |
|||
this.filename = opts.filename; |
|||
this.file = opts.file; |
|||
this.absoluteFile = opts.absoluteFile; |
|||
this.relativeFileNoExt = opts.relativeFileNoExt; |
|||
this.absoluteDir = opts.absoluteDir; |
|||
} |
|||
function readDir(filePath, dirname) { |
|||
if (dirname === void 0) { dirname = "."; } |
|||
var res = fs__default['default'].readdirSync(filePath); |
|||
res.forEach(function (filename) { |
|||
var filepath = path__default['default'].resolve(filePath, filename); |
|||
var stat = fs__default['default'].statSync(filepath); |
|||
var name = filepath.split(path__default['default'].sep).slice(-1)[0]; |
|||
if (typeof exclude === "string" && new RegExp(exclude).test(name)) { |
|||
return; |
|||
} |
|||
if (Array.isArray(exclude)) { |
|||
for (var i = 0; i < exclude.length; i++) { |
|||
var excludeItem = exclude[i]; |
|||
if (new RegExp(excludeItem).test(name)) { |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
if (!stat.isFile()) { |
|||
readDir(filepath, dirname + path__default['default'].sep + name); |
|||
} |
|||
else { |
|||
var data = new Data({ |
|||
relativeDir: dirname, |
|||
relativeFile: dirname + path__default['default'].sep + path__default['default'].parse(filepath).base, |
|||
relativeFileNoExt: dirname + path__default['default'].sep + path__default['default'].parse(filepath).name, |
|||
file: path__default['default'].parse(filepath).base, |
|||
filename: path__default['default'].parse(filepath).name, |
|||
absoluteFile: filepath, |
|||
absoluteDir: path__default['default'].parse(filepath).dir, |
|||
}); |
|||
files.push(data); |
|||
} |
|||
}); |
|||
} |
|||
readDir(filePath); |
|||
return files; |
|||
} |
|||
|
|||
function method(opts) { |
|||
return function (target, propertyKey, descriptor) { |
|||
target[propertyKey].$method = opts; |
|||
}; |
|||
} |
|||
function route(route) { |
|||
return function (target, propertyKey, descriptor) { |
|||
target[propertyKey].$route = route; |
|||
}; |
|||
} |
|||
function config(options) { |
|||
return function (target, propertyKey, descriptor) { |
|||
target[propertyKey].$options = options; |
|||
}; |
|||
} |
|||
function auth(isAuth) { |
|||
if (isAuth === void 0) { isAuth = true; } |
|||
return function (target, propertyKey, descriptor) { |
|||
target[propertyKey].$auth = isAuth; |
|||
}; |
|||
} |
|||
function validate(validate) { |
|||
return function (target, propertyKey, descriptor) { |
|||
target[propertyKey].$validate = validate; |
|||
}; |
|||
} |
|||
function swagger(desc, notes, tags) { |
|||
return function (target, propertyKey, descriptor) { |
|||
target[propertyKey].$swagger = [desc, notes, tags]; |
|||
}; |
|||
} |
|||
|
|||
var routes = ["所有路由路径:"]; |
|||
var index = new ((function () { |
|||
function hapiRouter() { |
|||
this.name = "routePlugin"; |
|||
this.version = "0.0.1"; |
|||
} |
|||
hapiRouter.prototype.register = function (server, options) { |
|||
var sourceDir = options.sourceDir; |
|||
var files = walkDir(sourceDir); |
|||
files.forEach(function (file) { |
|||
var e_1, _a; |
|||
var filename = file.relativeFileNoExt; |
|||
var array = filename.split(path__default['default'].sep).slice(1); |
|||
var fileNoExt = removeIndex("/" + array.join("/")); |
|||
var moduleName = path__default['default'].resolve(sourceDir, filename); |
|||
var obj = require(moduleName); |
|||
if (obj.default) { |
|||
var func = new (obj.default || obj)(); |
|||
var prototype = Object.getPrototypeOf(func); |
|||
var keys = Reflect.ownKeys(prototype); |
|||
try { |
|||
for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) { |
|||
var key = keys_1_1.value; |
|||
if (key !== "constructor") { |
|||
var ff = func[key]; |
|||
var method = ff.$method || "GET"; |
|||
var route = ""; |
|||
if (ff.$route) { |
|||
if (isIndexEnd(fileNoExt)) { |
|||
route = ff.$route; |
|||
} |
|||
else { |
|||
route = fileNoExt + ff.$route; |
|||
} |
|||
} |
|||
else { |
|||
if (isIndexEnd(fileNoExt)) { |
|||
route = fileNoExt + key.toString(); |
|||
} |
|||
else { |
|||
route = fileNoExt + "/" + key.toString(); |
|||
} |
|||
} |
|||
route = removeIndex(route); |
|||
var options_1 = ff.$options ? ff.$options : {}; |
|||
if (!options_1.auth) { |
|||
if (ff.$auth == undefined) { |
|||
if (route.startsWith("/api")) { |
|||
options_1.auth = "jwt"; |
|||
} |
|||
else { |
|||
options_1.auth = false; |
|||
} |
|||
} |
|||
else if (ff.$auth) { |
|||
options_1.auth = "jwt"; |
|||
} |
|||
else { |
|||
options_1.auth = false; |
|||
} |
|||
} |
|||
if (!options_1.validate) { |
|||
if (ff.$validate) { |
|||
options_1.validate = ff.$validate; |
|||
} |
|||
} |
|||
if (ff.$swagger && route.startsWith("/api")) { |
|||
options_1.description = ff.$swagger[0]; |
|||
options_1.notes = ff.$swagger[1]; |
|||
options_1.tags = ff.$swagger[2]; |
|||
} |
|||
routes.push(route); |
|||
server.route({ |
|||
method: method, |
|||
path: route, |
|||
handler: ff, |
|||
options: options_1, |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
catch (e_1_1) { e_1 = { error: e_1_1 }; } |
|||
finally { |
|||
try { |
|||
if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1); |
|||
} |
|||
finally { if (e_1) throw e_1.error; } |
|||
} |
|||
} |
|||
}); |
|||
fs__default['default'].writeFileSync("route.txt", routes.join("\n"), { encoding: "utf-8" }); |
|||
}; |
|||
return hapiRouter; |
|||
}()))(); |
|||
|
|||
exports.auth = auth; |
|||
exports.config = config; |
|||
exports.default = index; |
|||
exports.method = method; |
|||
exports.route = route; |
|||
exports.swagger = swagger; |
|||
exports.validate = validate; |
|||
//# sourceMappingURL=hapi-router.cjs.js.map
|
File diff suppressed because one or more lines are too long
@ -0,0 +1,21 @@ |
|||
// Generated by dts-bundle v0.7.3
|
|||
|
|||
declare module '@noderun/hapi-router' { |
|||
export * from "@noderun/hapi-router/util/decorators"; |
|||
const _default: { |
|||
name: string; |
|||
version: string; |
|||
register(server: any, options: any): void; |
|||
}; |
|||
export default _default; |
|||
} |
|||
|
|||
declare module '@noderun/hapi-router/util/decorators' { |
|||
export function method(opts?: string | Array<string>): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; |
|||
export function route(route?: string): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; |
|||
export function config(options: Object): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; |
|||
export function auth(isAuth?: boolean): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; |
|||
export function validate(validate: Object): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; |
|||
export function swagger(desc: any, notes: any, tags: any): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void; |
|||
} |
|||
|
@ -0,0 +1,4 @@ |
|||
|
|||
|
|||
// 全局替换
|
|||
declare var __DEV__: boolean; |
File diff suppressed because it is too large
@ -0,0 +1,37 @@ |
|||
{ |
|||
"name": "@noderun/hapi-router", |
|||
"version": "0.0.1", |
|||
"description": "", |
|||
"main": "dist/hapi-router.cjs.js", |
|||
"typings": "dist/index.d.ts", |
|||
"buildOptions": { |
|||
"filename": "hapi-router", |
|||
"var": "hapi-router", |
|||
"formats": [ |
|||
"cjs" |
|||
] |
|||
}, |
|||
"scripts": { |
|||
"build": "node scripts/build.js", |
|||
"dev": "node scripts/dev.js" |
|||
}, |
|||
"keywords": [], |
|||
"author": "", |
|||
"license": "ISC", |
|||
"devDependencies": { |
|||
"@rollup/plugin-alias": "^3.1.1", |
|||
"@rollup/plugin-commonjs": "^15.0.0", |
|||
"@rollup/plugin-replace": "^2.3.3", |
|||
"chalk": "^4.1.0", |
|||
"dts-bundle": "^0.7.3", |
|||
"execa": "^4.0.3", |
|||
"fs-extra": "^9.0.1", |
|||
"ftp-deploy": "^2.3.6", |
|||
"lodash": "^4.17.20", |
|||
"rollup": "^2.26.3", |
|||
"rollup-plugin-sourcemaps": "^0.6.2", |
|||
"rollup-plugin-typescript2": "^0.27.2", |
|||
"tslib": "^2.0.1", |
|||
"typescript": "^3.9.7" |
|||
} |
|||
} |
@ -0,0 +1,836 @@ |
|||
lockfileVersion: 5.3 |
|||
|
|||
specifiers: |
|||
'@rollup/plugin-alias': ^3.1.1 |
|||
'@rollup/plugin-commonjs': ^15.0.0 |
|||
'@rollup/plugin-replace': ^2.3.3 |
|||
chalk: ^4.1.0 |
|||
dts-bundle: ^0.7.3 |
|||
execa: ^4.0.3 |
|||
fs-extra: ^9.0.1 |
|||
ftp-deploy: ^2.3.6 |
|||
lodash: ^4.17.20 |
|||
rollup: ^2.26.3 |
|||
rollup-plugin-sourcemaps: ^0.6.2 |
|||
rollup-plugin-typescript2: ^0.27.2 |
|||
tslib: ^2.0.1 |
|||
typescript: ^3.9.7 |
|||
|
|||
devDependencies: |
|||
'@rollup/plugin-alias': 3.1.2_rollup@2.51.2 |
|||
'@rollup/plugin-commonjs': 15.1.0_rollup@2.51.2 |
|||
'@rollup/plugin-replace': 2.4.2_rollup@2.51.2 |
|||
chalk: 4.1.1 |
|||
dts-bundle: 0.7.3 |
|||
execa: 4.1.0 |
|||
fs-extra: 9.1.0 |
|||
ftp-deploy: 2.4.1 |
|||
lodash: 4.17.21 |
|||
rollup: 2.51.2 |
|||
rollup-plugin-sourcemaps: 0.6.3_rollup@2.51.2 |
|||
rollup-plugin-typescript2: 0.27.3_rollup@2.51.2+typescript@3.9.9 |
|||
tslib: 2.3.0 |
|||
typescript: 3.9.9 |
|||
|
|||
packages: |
|||
|
|||
/@icetee/ftp/0.3.15: |
|||
resolution: {integrity: sha512-RxSa9VjcDWgWCYsaLdZItdCnJj7p4LxggaEk+Y3MP0dHKoxez8ioG07DVekVbZZqccsrL+oPB/N9AzVPxj4blg==} |
|||
engines: {node: '>=0.8.0'} |
|||
dependencies: |
|||
readable-stream: 1.1.14 |
|||
xregexp: 2.0.0 |
|||
dev: true |
|||
|
|||
/@rollup/plugin-alias/3.1.2_rollup@2.51.2: |
|||
resolution: {integrity: sha512-wzDnQ6v7CcoRzS0qVwFPrFdYA4Qlr+ookA217Y2Z3DPZE1R8jrFNM3jvGgOf6o6DMjbnQIn5lCIJgHPe1Bt3uw==} |
|||
engines: {node: '>=8.0.0'} |
|||
peerDependencies: |
|||
rollup: ^1.20.0||^2.0.0 |
|||
dependencies: |
|||
rollup: 2.51.2 |
|||
slash: 3.0.0 |
|||
dev: true |
|||
|
|||
/@rollup/plugin-commonjs/15.1.0_rollup@2.51.2: |
|||
resolution: {integrity: sha512-xCQqz4z/o0h2syQ7d9LskIMvBSH4PX5PjYdpSSvgS+pQik3WahkQVNWg3D8XJeYjZoVWnIUQYDghuEMRGrmQYQ==} |
|||
engines: {node: '>= 8.0.0'} |
|||
peerDependencies: |
|||
rollup: ^2.22.0 |
|||
dependencies: |
|||
'@rollup/pluginutils': 3.1.0_rollup@2.51.2 |
|||
commondir: 1.0.1 |
|||
estree-walker: 2.0.2 |
|||
glob: 7.1.7 |
|||
is-reference: 1.2.1 |
|||
magic-string: 0.25.7 |
|||
resolve: 1.20.0 |
|||
rollup: 2.51.2 |
|||
dev: true |
|||
|
|||
/@rollup/plugin-replace/2.4.2_rollup@2.51.2: |
|||
resolution: {integrity: sha512-IGcu+cydlUMZ5En85jxHH4qj2hta/11BHq95iHEyb2sbgiN0eCdzvUcHw5gt9pBL5lTi4JDYJ1acCoMGpTvEZg==} |
|||
peerDependencies: |
|||
rollup: ^1.20.0 || ^2.0.0 |
|||
dependencies: |
|||
'@rollup/pluginutils': 3.1.0_rollup@2.51.2 |
|||
magic-string: 0.25.7 |
|||
rollup: 2.51.2 |
|||
dev: true |
|||
|
|||
/@rollup/pluginutils/3.1.0_rollup@2.51.2: |
|||
resolution: {integrity: sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==} |
|||
engines: {node: '>= 8.0.0'} |
|||
peerDependencies: |
|||
rollup: ^1.20.0||^2.0.0 |
|||
dependencies: |
|||
'@types/estree': 0.0.39 |
|||
estree-walker: 1.0.1 |
|||
picomatch: 2.3.0 |
|||
rollup: 2.51.2 |
|||
dev: true |
|||
|
|||
/@types/detect-indent/0.1.30: |
|||
resolution: {integrity: sha1-3GgrtBK05lugmOcO2tc7SDP7kQ0=} |
|||
dev: true |
|||
|
|||
/@types/estree/0.0.39: |
|||
resolution: {integrity: sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==} |
|||
dev: true |
|||
|
|||
/@types/estree/0.0.48: |
|||
resolution: {integrity: sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==} |
|||
dev: true |
|||
|
|||
/@types/glob/5.0.30: |
|||
resolution: {integrity: sha1-ECZAnFYlqGiQdGAoCNCCsoZ7ilE=} |
|||
dependencies: |
|||
'@types/minimatch': 3.0.4 |
|||
'@types/node': 8.0.0 |
|||
dev: true |
|||
|
|||
/@types/minimatch/3.0.4: |
|||
resolution: {integrity: sha512-1z8k4wzFnNjVK/tlxvrWuK5WMt6mydWWP7+zvH5eFep4oj+UkrfiJTRtjCeBXNpwaA/FYqqtb4/QS4ianFpIRA==} |
|||
dev: true |
|||
|
|||
/@types/mkdirp/0.3.29: |
|||
resolution: {integrity: sha1-fyrX7FX5FEgvybHsS7GuYCjUYGY=} |
|||
dev: true |
|||
|
|||
/@types/node/8.0.0: |
|||
resolution: {integrity: sha512-j2tekvJCO7j22cs+LO6i0kRPhmQ9MXaPZ55TzOc1lzkN5b6BWqq4AFjl04s1oRRQ1v5rSe+KEvnLUSTonuls/A==} |
|||
dev: true |
|||
|
|||
/ansi-styles/4.3.0: |
|||
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
color-convert: 2.0.1 |
|||
dev: true |
|||
|
|||
/asn1/0.2.4: |
|||
resolution: {integrity: sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==} |
|||
dependencies: |
|||
safer-buffer: 2.1.2 |
|||
dev: true |
|||
|
|||
/at-least-node/1.0.0: |
|||
resolution: {integrity: sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==} |
|||
engines: {node: '>= 4.0.0'} |
|||
dev: true |
|||
|
|||
/atob/2.1.2: |
|||
resolution: {integrity: sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==} |
|||
engines: {node: '>= 4.5.0'} |
|||
hasBin: true |
|||
dev: true |
|||
|
|||
/balanced-match/1.0.2: |
|||
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} |
|||
dev: true |
|||
|
|||
/bcrypt-pbkdf/1.0.2: |
|||
resolution: {integrity: sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=} |
|||
dependencies: |
|||
tweetnacl: 0.14.5 |
|||
dev: true |
|||
|
|||
/bluebird/2.11.0: |
|||
resolution: {integrity: sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=} |
|||
dev: true |
|||
|
|||
/bluebird/3.7.2: |
|||
resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} |
|||
dev: true |
|||
|
|||
/brace-expansion/1.1.11: |
|||
resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} |
|||
dependencies: |
|||
balanced-match: 1.0.2 |
|||
concat-map: 0.0.1 |
|||
dev: true |
|||
|
|||
/buffer-from/1.1.1: |
|||
resolution: {integrity: sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==} |
|||
dev: true |
|||
|
|||
/chalk/4.1.1: |
|||
resolution: {integrity: sha512-diHzdDKxcU+bAsUboHLPEDQiw0qEe0qd7SYUn3HgcFlWgbDcfLGswOHYeGrHKzG9z6UYf01d9VFMfZxPM1xZSg==} |
|||
engines: {node: '>=10'} |
|||
dependencies: |
|||
ansi-styles: 4.3.0 |
|||
supports-color: 7.2.0 |
|||
dev: true |
|||
|
|||
/color-convert/2.0.1: |
|||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} |
|||
engines: {node: '>=7.0.0'} |
|||
dependencies: |
|||
color-name: 1.1.4 |
|||
dev: true |
|||
|
|||
/color-name/1.1.4: |
|||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} |
|||
dev: true |
|||
|
|||
/commander/2.20.3: |
|||
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} |
|||
dev: true |
|||
|
|||
/commondir/1.0.1: |
|||
resolution: {integrity: sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=} |
|||
dev: true |
|||
|
|||
/concat-map/0.0.1: |
|||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} |
|||
dev: true |
|||
|
|||
/concat-stream/2.0.0: |
|||
resolution: {integrity: sha512-MWufYdFw53ccGjCA+Ol7XJYpAlW6/prSMzuPOTRnJGcGzuhLn4Scrz7qf6o8bROZ514ltazcIFJZevcfbo0x7A==} |
|||
engines: {'0': node >= 6.0} |
|||
dependencies: |
|||
buffer-from: 1.1.1 |
|||
inherits: 2.0.4 |
|||
readable-stream: 3.6.0 |
|||
typedarray: 0.0.6 |
|||
dev: true |
|||
|
|||
/core-util-is/1.0.2: |
|||
resolution: {integrity: sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=} |
|||
dev: true |
|||
|
|||
/cross-spawn/7.0.3: |
|||
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} |
|||
engines: {node: '>= 8'} |
|||
dependencies: |
|||
path-key: 3.1.1 |
|||
shebang-command: 2.0.0 |
|||
which: 2.0.2 |
|||
dev: true |
|||
|
|||
/decode-uri-component/0.2.0: |
|||
resolution: {integrity: sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=} |
|||
engines: {node: '>=0.10'} |
|||
dev: true |
|||
|
|||
/detect-indent/0.2.0: |
|||
resolution: {integrity: sha1-BCkUSYl5rC2fPHPk/z5od9O8krY=} |
|||
engines: {node: '>=0.10.0'} |
|||
hasBin: true |
|||
dependencies: |
|||
get-stdin: 0.1.0 |
|||
minimist: 0.1.0 |
|||
dev: true |
|||
|
|||
/dts-bundle/0.7.3: |
|||
resolution: {integrity: sha1-Nyt7tpyCB4LmOC9ABzmmnc7T1Zo=} |
|||
engines: {node: '>= 0.10.0'} |
|||
hasBin: true |
|||
dependencies: |
|||
'@types/detect-indent': 0.1.30 |
|||
'@types/glob': 5.0.30 |
|||
'@types/mkdirp': 0.3.29 |
|||
'@types/node': 8.0.0 |
|||
commander: 2.20.3 |
|||
detect-indent: 0.2.0 |
|||
glob: 6.0.4 |
|||
mkdirp: 0.5.5 |
|||
dev: true |
|||
|
|||
/end-of-stream/1.4.4: |
|||
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} |
|||
dependencies: |
|||
once: 1.4.0 |
|||
dev: true |
|||
|
|||
/estree-walker/1.0.1: |
|||
resolution: {integrity: sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==} |
|||
dev: true |
|||
|
|||
/estree-walker/2.0.2: |
|||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} |
|||
dev: true |
|||
|
|||
/execa/4.1.0: |
|||
resolution: {integrity: sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==} |
|||
engines: {node: '>=10'} |
|||
dependencies: |
|||
cross-spawn: 7.0.3 |
|||
get-stream: 5.2.0 |
|||
human-signals: 1.1.1 |
|||
is-stream: 2.0.0 |
|||
merge-stream: 2.0.0 |
|||
npm-run-path: 4.0.1 |
|||
onetime: 5.1.2 |
|||
signal-exit: 3.0.3 |
|||
strip-final-newline: 2.0.0 |
|||
dev: true |
|||
|
|||
/find-cache-dir/3.3.1: |
|||
resolution: {integrity: sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
commondir: 1.0.1 |
|||
make-dir: 3.1.0 |
|||
pkg-dir: 4.2.0 |
|||
dev: true |
|||
|
|||
/find-up/4.1.0: |
|||
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
locate-path: 5.0.0 |
|||
path-exists: 4.0.0 |
|||
dev: true |
|||
|
|||
/fs-extra/8.1.0: |
|||
resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} |
|||
engines: {node: '>=6 <7 || >=8'} |
|||
dependencies: |
|||
graceful-fs: 4.2.6 |
|||
jsonfile: 4.0.0 |
|||
universalify: 0.1.2 |
|||
dev: true |
|||
|
|||
/fs-extra/9.1.0: |
|||
resolution: {integrity: sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==} |
|||
engines: {node: '>=10'} |
|||
dependencies: |
|||
at-least-node: 1.0.0 |
|||
graceful-fs: 4.2.6 |
|||
jsonfile: 6.1.0 |
|||
universalify: 2.0.0 |
|||
dev: true |
|||
|
|||
/fs.realpath/1.0.0: |
|||
resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=} |
|||
dev: true |
|||
|
|||
/fsevents/2.3.2: |
|||
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} |
|||
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} |
|||
os: [darwin] |
|||
dev: true |
|||
optional: true |
|||
|
|||
/ftp-deploy/2.4.1: |
|||
resolution: {integrity: sha512-UglFOxlv7j2jPqX83kKFfXjoazysymEGWb8buqt+X12KAnFdapXdNjOm0Vwwg6BxgjS4jnKcU8+iq2ndivreOw==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
bluebird: 3.7.2 |
|||
minimatch: 3.0.4 |
|||
promise-ftp: 1.3.5 |
|||
read: 1.0.7 |
|||
ssh2-sftp-client: 5.3.2 |
|||
upath: 2.0.1 |
|||
dev: true |
|||
|
|||
/function-bind/1.1.1: |
|||
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} |
|||
dev: true |
|||
|
|||
/get-stdin/0.1.0: |
|||
resolution: {integrity: sha1-WZivJKr8gC0VyCxoVlfuuLENSpE=} |
|||
engines: {node: '>=0.10.0'} |
|||
dev: true |
|||
|
|||
/get-stream/5.2.0: |
|||
resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
pump: 3.0.0 |
|||
dev: true |
|||
|
|||
/glob/6.0.4: |
|||
resolution: {integrity: sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=} |
|||
dependencies: |
|||
inflight: 1.0.6 |
|||
inherits: 2.0.4 |
|||
minimatch: 3.0.4 |
|||
once: 1.4.0 |
|||
path-is-absolute: 1.0.1 |
|||
dev: true |
|||
|
|||
/glob/7.1.7: |
|||
resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} |
|||
dependencies: |
|||
fs.realpath: 1.0.0 |
|||
inflight: 1.0.6 |
|||
inherits: 2.0.4 |
|||
minimatch: 3.0.4 |
|||
once: 1.4.0 |
|||
path-is-absolute: 1.0.1 |
|||
dev: true |
|||
|
|||
/graceful-fs/4.2.6: |
|||
resolution: {integrity: sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==} |
|||
dev: true |
|||
|
|||
/has-flag/4.0.0: |
|||
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} |
|||
engines: {node: '>=8'} |
|||
dev: true |
|||
|
|||
/has/1.0.3: |
|||
resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} |
|||
engines: {node: '>= 0.4.0'} |
|||
dependencies: |
|||
function-bind: 1.1.1 |
|||
dev: true |
|||
|
|||
/human-signals/1.1.1: |
|||
resolution: {integrity: sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==} |
|||
engines: {node: '>=8.12.0'} |
|||
dev: true |
|||
|
|||
/inflight/1.0.6: |
|||
resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} |
|||
dependencies: |
|||
once: 1.4.0 |
|||
wrappy: 1.0.2 |
|||
dev: true |
|||
|
|||
/inherits/2.0.4: |
|||
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} |
|||
dev: true |
|||
|
|||
/is-core-module/2.4.0: |
|||
resolution: {integrity: sha512-6A2fkfq1rfeQZjxrZJGerpLCTHRNEBiSgnu0+obeJpEPZRUooHgsizvzv0ZjJwOz3iWIHdJtVWJ/tmPr3D21/A==} |
|||
dependencies: |
|||
has: 1.0.3 |
|||
dev: true |
|||
|
|||
/is-reference/1.2.1: |
|||
resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} |
|||
dependencies: |
|||
'@types/estree': 0.0.48 |
|||
dev: true |
|||
|
|||
/is-stream/2.0.0: |
|||
resolution: {integrity: sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==} |
|||
engines: {node: '>=8'} |
|||
dev: true |
|||
|
|||
/isarray/0.0.1: |
|||
resolution: {integrity: sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=} |
|||
dev: true |
|||
|
|||
/isexe/2.0.0: |
|||
resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} |
|||
dev: true |
|||
|
|||
/jsonfile/4.0.0: |
|||
resolution: {integrity: sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=} |
|||
optionalDependencies: |
|||
graceful-fs: 4.2.6 |
|||
dev: true |
|||
|
|||
/jsonfile/6.1.0: |
|||
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} |
|||
dependencies: |
|||
universalify: 2.0.0 |
|||
optionalDependencies: |
|||
graceful-fs: 4.2.6 |
|||
dev: true |
|||
|
|||
/locate-path/5.0.0: |
|||
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
p-locate: 4.1.0 |
|||
dev: true |
|||
|
|||
/lodash/4.17.21: |
|||
resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} |
|||
dev: true |
|||
|
|||
/magic-string/0.25.7: |
|||
resolution: {integrity: sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==} |
|||
dependencies: |
|||
sourcemap-codec: 1.4.8 |
|||
dev: true |
|||
|
|||
/make-dir/3.1.0: |
|||
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
semver: 6.3.0 |
|||
dev: true |
|||
|
|||
/merge-stream/2.0.0: |
|||
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} |
|||
dev: true |
|||
|
|||
/mimic-fn/2.1.0: |
|||
resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} |
|||
engines: {node: '>=6'} |
|||
dev: true |
|||
|
|||
/minimatch/3.0.4: |
|||
resolution: {integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==} |
|||
dependencies: |
|||
brace-expansion: 1.1.11 |
|||
dev: true |
|||
|
|||
/minimist/0.1.0: |
|||
resolution: {integrity: sha1-md9lelJXTCHJBXSX33QnkLK0wN4=} |
|||
dev: true |
|||
|
|||
/minimist/1.2.5: |
|||
resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==} |
|||
dev: true |
|||
|
|||
/mkdirp/0.5.5: |
|||
resolution: {integrity: sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==} |
|||
hasBin: true |
|||
dependencies: |
|||
minimist: 1.2.5 |
|||
dev: true |
|||
|
|||
/mute-stream/0.0.8: |
|||
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} |
|||
dev: true |
|||
|
|||
/npm-run-path/4.0.1: |
|||
resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
path-key: 3.1.1 |
|||
dev: true |
|||
|
|||
/once/1.4.0: |
|||
resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=} |
|||
dependencies: |
|||
wrappy: 1.0.2 |
|||
dev: true |
|||
|
|||
/onetime/5.1.2: |
|||
resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} |
|||
engines: {node: '>=6'} |
|||
dependencies: |
|||
mimic-fn: 2.1.0 |
|||
dev: true |
|||
|
|||
/p-limit/2.3.0: |
|||
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} |
|||
engines: {node: '>=6'} |
|||
dependencies: |
|||
p-try: 2.2.0 |
|||
dev: true |
|||
|
|||
/p-locate/4.1.0: |
|||
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
p-limit: 2.3.0 |
|||
dev: true |
|||
|
|||
/p-try/2.2.0: |
|||
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} |
|||
engines: {node: '>=6'} |
|||
dev: true |
|||
|
|||
/path-exists/4.0.0: |
|||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} |
|||
engines: {node: '>=8'} |
|||
dev: true |
|||
|
|||
/path-is-absolute/1.0.1: |
|||
resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=} |
|||
engines: {node: '>=0.10.0'} |
|||
dev: true |
|||
|
|||
/path-key/3.1.1: |
|||
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} |
|||
engines: {node: '>=8'} |
|||
dev: true |
|||
|
|||
/path-parse/1.0.7: |
|||
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} |
|||
dev: true |
|||
|
|||
/picomatch/2.3.0: |
|||
resolution: {integrity: sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==} |
|||
engines: {node: '>=8.6'} |
|||
dev: true |
|||
|
|||
/pkg-dir/4.2.0: |
|||
resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
find-up: 4.1.0 |
|||
dev: true |
|||
|
|||
/promise-ftp-common/1.1.5: |
|||
resolution: {integrity: sha1-tPgIKnQDVkdwNQZ2PtsUIw2YZdo=} |
|||
dev: true |
|||
|
|||
/promise-ftp/1.3.5: |
|||
resolution: {integrity: sha512-v368jPSqzmjjKDIyggulC+dRFcpAOEX7aFdEWkFYQp8Ao3P2N4Y6XnFFdKgK7PtkylwvGQkZR/65HZuzmq0V7A==} |
|||
engines: {node: '>=0.11.13'} |
|||
dependencies: |
|||
'@icetee/ftp': 0.3.15 |
|||
bluebird: 2.11.0 |
|||
promise-ftp-common: 1.1.5 |
|||
dev: true |
|||
|
|||
/pump/3.0.0: |
|||
resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==} |
|||
dependencies: |
|||
end-of-stream: 1.4.4 |
|||
once: 1.4.0 |
|||
dev: true |
|||
|
|||
/read/1.0.7: |
|||
resolution: {integrity: sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=} |
|||
engines: {node: '>=0.8'} |
|||
dependencies: |
|||
mute-stream: 0.0.8 |
|||
dev: true |
|||
|
|||
/readable-stream/1.1.14: |
|||
resolution: {integrity: sha1-fPTFTvZI44EwhMY23SB54WbAgdk=} |
|||
dependencies: |
|||
core-util-is: 1.0.2 |
|||
inherits: 2.0.4 |
|||
isarray: 0.0.1 |
|||
string_decoder: 0.10.31 |
|||
dev: true |
|||
|
|||
/readable-stream/3.6.0: |
|||
resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} |
|||
engines: {node: '>= 6'} |
|||
dependencies: |
|||
inherits: 2.0.4 |
|||
string_decoder: 1.3.0 |
|||
util-deprecate: 1.0.2 |
|||
dev: true |
|||
|
|||
/resolve/1.17.0: |
|||
resolution: {integrity: sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==} |
|||
dependencies: |
|||
path-parse: 1.0.7 |
|||
dev: true |
|||
|
|||
/resolve/1.20.0: |
|||
resolution: {integrity: sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==} |
|||
dependencies: |
|||
is-core-module: 2.4.0 |
|||
path-parse: 1.0.7 |
|||
dev: true |
|||
|
|||
/retry/0.12.0: |
|||
resolution: {integrity: sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=} |
|||
engines: {node: '>= 4'} |
|||
dev: true |
|||
|
|||
/rollup-plugin-sourcemaps/0.6.3_rollup@2.51.2: |
|||
resolution: {integrity: sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==} |
|||
engines: {node: '>=10.0.0'} |
|||
peerDependencies: |
|||
'@types/node': '>=10.0.0' |
|||
rollup: '>=0.31.2' |
|||
peerDependenciesMeta: |
|||
'@types/node': |
|||
optional: true |
|||
dependencies: |
|||
'@rollup/pluginutils': 3.1.0_rollup@2.51.2 |
|||
rollup: 2.51.2 |
|||
source-map-resolve: 0.6.0 |
|||
dev: true |
|||
|
|||
/rollup-plugin-typescript2/0.27.3_rollup@2.51.2+typescript@3.9.9: |
|||
resolution: {integrity: sha512-gmYPIFmALj9D3Ga1ZbTZAKTXq1JKlTQBtj299DXhqYz9cL3g/AQfUvbb2UhH+Nf++cCq941W2Mv7UcrcgLzJJg==} |
|||
peerDependencies: |
|||
rollup: '>=1.26.3' |
|||
typescript: '>=2.4.0' |
|||
dependencies: |
|||
'@rollup/pluginutils': 3.1.0_rollup@2.51.2 |
|||
find-cache-dir: 3.3.1 |
|||
fs-extra: 8.1.0 |
|||
resolve: 1.17.0 |
|||
rollup: 2.51.2 |
|||
tslib: 2.0.1 |
|||
typescript: 3.9.9 |
|||
dev: true |
|||
|
|||
/rollup/2.51.2: |
|||
resolution: {integrity: sha512-ReV2eGEadA7hmXSzjxdDKs10neqH2QURf2RxJ6ayAlq93ugy6qIvXMmbc5cWMGCDh1h5T4thuWO1e2VNbMq8FA==} |
|||
engines: {node: '>=10.0.0'} |
|||
hasBin: true |
|||
optionalDependencies: |
|||
fsevents: 2.3.2 |
|||
dev: true |
|||
|
|||
/safe-buffer/5.2.1: |
|||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} |
|||
dev: true |
|||
|
|||
/safer-buffer/2.1.2: |
|||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} |
|||
dev: true |
|||
|
|||
/semver/6.3.0: |
|||
resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} |
|||
hasBin: true |
|||
dev: true |
|||
|
|||
/shebang-command/2.0.0: |
|||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
shebang-regex: 3.0.0 |
|||
dev: true |
|||
|
|||
/shebang-regex/3.0.0: |
|||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} |
|||
engines: {node: '>=8'} |
|||
dev: true |
|||
|
|||
/signal-exit/3.0.3: |
|||
resolution: {integrity: sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==} |
|||
dev: true |
|||
|
|||
/slash/3.0.0: |
|||
resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} |
|||
engines: {node: '>=8'} |
|||
dev: true |
|||
|
|||
/source-map-resolve/0.6.0: |
|||
resolution: {integrity: sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==} |
|||
dependencies: |
|||
atob: 2.1.2 |
|||
decode-uri-component: 0.2.0 |
|||
dev: true |
|||
|
|||
/sourcemap-codec/1.4.8: |
|||
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} |
|||
dev: true |
|||
|
|||
/ssh2-sftp-client/5.3.2: |
|||
resolution: {integrity: sha512-YD38WQKleuapAZyvqRJq7PN8pC6GnzWdWcnZN4vsPXMHtZpjcg/ipBcFGtDsC5rkHp5qXgRu56WPcDUkM87FiA==} |
|||
dependencies: |
|||
concat-stream: 2.0.0 |
|||
retry: 0.12.0 |
|||
ssh2: 0.8.9 |
|||
dev: true |
|||
|
|||
/ssh2-streams/0.4.10: |
|||
resolution: {integrity: sha512-8pnlMjvnIZJvmTzUIIA5nT4jr2ZWNNVHwyXfMGdRJbug9TpI3kd99ffglgfSWqujVv/0gxwMsDn9j9RVst8yhQ==} |
|||
engines: {node: '>=5.2.0'} |
|||
dependencies: |
|||
asn1: 0.2.4 |
|||
bcrypt-pbkdf: 1.0.2 |
|||
streamsearch: 0.1.2 |
|||
dev: true |
|||
|
|||
/ssh2/0.8.9: |
|||
resolution: {integrity: sha512-GmoNPxWDMkVpMFa9LVVzQZHF6EW3WKmBwL+4/GeILf2hFmix5Isxm7Amamo8o7bHiU0tC+wXsGcUXOxp8ChPaw==} |
|||
engines: {node: '>=5.2.0'} |
|||
dependencies: |
|||
ssh2-streams: 0.4.10 |
|||
dev: true |
|||
|
|||
/streamsearch/0.1.2: |
|||
resolution: {integrity: sha1-gIudDlb8Jz2Am6VzOOkpkZoanxo=} |
|||
engines: {node: '>=0.8.0'} |
|||
dev: true |
|||
|
|||
/string_decoder/0.10.31: |
|||
resolution: {integrity: sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=} |
|||
dev: true |
|||
|
|||
/string_decoder/1.3.0: |
|||
resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} |
|||
dependencies: |
|||
safe-buffer: 5.2.1 |
|||
dev: true |
|||
|
|||
/strip-final-newline/2.0.0: |
|||
resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} |
|||
engines: {node: '>=6'} |
|||
dev: true |
|||
|
|||
/supports-color/7.2.0: |
|||
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} |
|||
engines: {node: '>=8'} |
|||
dependencies: |
|||
has-flag: 4.0.0 |
|||
dev: true |
|||
|
|||
/tslib/2.0.1: |
|||
resolution: {integrity: sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==} |
|||
dev: true |
|||
|
|||
/tslib/2.3.0: |
|||
resolution: {integrity: sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==} |
|||
dev: true |
|||
|
|||
/tweetnacl/0.14.5: |
|||
resolution: {integrity: sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=} |
|||
dev: true |
|||
|
|||
/typedarray/0.0.6: |
|||
resolution: {integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=} |
|||
dev: true |
|||
|
|||
/typescript/3.9.9: |
|||
resolution: {integrity: sha512-kdMjTiekY+z/ubJCATUPlRDl39vXYiMV9iyeMuEuXZh2we6zz80uovNN2WlAxmmdE/Z/YQe+EbOEXB5RHEED3w==} |
|||
engines: {node: '>=4.2.0'} |
|||
hasBin: true |
|||
dev: true |
|||
|
|||
/universalify/0.1.2: |
|||
resolution: {integrity: sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==} |
|||
engines: {node: '>= 4.0.0'} |
|||
dev: true |
|||
|
|||
/universalify/2.0.0: |
|||
resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} |
|||
engines: {node: '>= 10.0.0'} |
|||
dev: true |
|||
|
|||
/upath/2.0.1: |
|||
resolution: {integrity: sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==} |
|||
engines: {node: '>=4'} |
|||
dev: true |
|||
|
|||
/util-deprecate/1.0.2: |
|||
resolution: {integrity: sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=} |
|||
dev: true |
|||
|
|||
/which/2.0.2: |
|||
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} |
|||
engines: {node: '>= 8'} |
|||
hasBin: true |
|||
dependencies: |
|||
isexe: 2.0.0 |
|||
dev: true |
|||
|
|||
/wrappy/1.0.2: |
|||
resolution: {integrity: sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=} |
|||
dev: true |
|||
|
|||
/xregexp/2.0.0: |
|||
resolution: {integrity: sha1-UqY+VsoLhKfzpfPWGHLxJq16WUM=} |
|||
dev: true |
@ -0,0 +1,111 @@ |
|||
import commonjs from "@rollup/plugin-commonjs"; |
|||
import typescript from "rollup-plugin-typescript2"; |
|||
import alias from "@rollup/plugin-alias"; |
|||
import replace from "@rollup/plugin-replace"; |
|||
import sourcemaps from "rollup-plugin-sourcemaps"; |
|||
const pkg = require("./package.json"); |
|||
const path = require("path"); |
|||
|
|||
let isProd = process.env.NODE_ENV === "production"; |
|||
|
|||
const input = "src/index.ts"; |
|||
const openSourceMap = true; |
|||
const buildOptions = pkg.buildOptions; |
|||
buildOptions.formats = process.env.TARGET |
|||
? [process.env.TARGET] |
|||
: buildOptions.formats; |
|||
|
|||
export default createConfig(); |
|||
|
|||
function createConfig() { |
|||
return { |
|||
input, |
|||
output: createOutput(buildOptions), |
|||
plugins: createPlugin(), |
|||
}; |
|||
} |
|||
|
|||
function createPlugin() { |
|||
let plugin = []; |
|||
const aliasPlugin = alias({ |
|||
resolve: [".ts"], |
|||
"@": path.resolve(__dirname, "src"), |
|||
}); |
|||
const tsPlugin = typescript({ |
|||
check: isProd, |
|||
tsconfig: path.resolve(__dirname, "tsconfig.json"), |
|||
cacheRoot: path.resolve(__dirname, "node_modules/.rts2_cache"), |
|||
tsconfigOverride: { |
|||
compilerOptions: { |
|||
declaration: isProd, |
|||
}, |
|||
}, |
|||
}); |
|||
const replacePlugin = replace({ |
|||
__DEV__: isProd, |
|||
}); |
|||
plugin = [sourcemaps(), commonjs(), tsPlugin, aliasPlugin, replacePlugin]; |
|||
return plugin; |
|||
} |
|||
|
|||
function createOutput(options) { |
|||
const output = []; |
|||
const filterType = { |
|||
//可用script标签导入,会输出一个全局变量
|
|||
iife: { |
|||
sourcemap: openSourceMap, |
|||
file: `dist/${options.filename}.iife.js`, |
|||
format: "iife", |
|||
name: options.var, |
|||
}, |
|||
// amd规范,可用require.js加载
|
|||
amd: { |
|||
sourcemap: openSourceMap, |
|||
file: `dist/${options.filename}.amd.js`, |
|||
format: "amd", |
|||
}, |
|||
// 兼容 IIFE, AMD, CJS 三种模块规范
|
|||
umd: { |
|||
sourcemap: openSourceMap, |
|||
file: `dist/${options.filename}.umd.js`, |
|||
format: "umd", |
|||
name: options.var, |
|||
}, |
|||
// CommonJS规范
|
|||
cjs: { |
|||
sourcemap: openSourceMap, |
|||
file: `dist/${options.filename}.cjs.js`, |
|||
format: "cjs", |
|||
exports: "auto", |
|||
banner: "#!/usr/bin/env node", // 提供命令行的可执行权限
|
|||
}, |
|||
// ES2015 Module 规范, 可用 `Webpack`, `Rollup` 加载
|
|||
esm: { |
|||
sourcemap: openSourceMap, |
|||
file: `dist/${options.filename}.esm.js`, |
|||
format: "es", |
|||
}, |
|||
"esm-browser": { |
|||
sourcemap: openSourceMap, |
|||
file: `dist/${options.filename}.esm-browser.js`, |
|||
format: "es", |
|||
}, |
|||
}; |
|||
if (options.formats) { |
|||
options.formats.forEach((format) => { |
|||
if (filterType[format]) { |
|||
output.push(filterType[format]); |
|||
} else { |
|||
console.error("无效类型:" + format); |
|||
} |
|||
}); |
|||
} else { |
|||
for (const key in filterType) { |
|||
if (filterType.hasOwnProperty(key)) { |
|||
const element = filterType[key]; |
|||
output.push(element); |
|||
} |
|||
} |
|||
} |
|||
return output; |
|||
} |
@ -0,0 +1,24 @@ |
|||
const execa = require("execa"); |
|||
const fs = require("fs-extra"); |
|||
const chalk = require('chalk'); |
|||
const dts = require("dts-bundle"); |
|||
const pkg = require("../package.json"); |
|||
|
|||
(async function () { |
|||
console.log(chalk.red("正在清理dist文件夹")); |
|||
await fs.remove(`dist`); |
|||
console.log(chalk.red("清理完成,开始构建")); |
|||
await execa("rollup", ["-c", "--environment", `NODE_ENV:production`], { |
|||
stdio: "inherit", |
|||
}); |
|||
console.log(chalk.red("构建完成,开始生成d.ts")); |
|||
const dtsOptions = { |
|||
name: pkg.name, |
|||
main: `dist/src/index.d.ts`, |
|||
out: `../index.d.ts`, |
|||
}; |
|||
dts.bundle(dtsOptions); |
|||
console.log(chalk.red("生成完毕,开始清理残余")); |
|||
await fs.remove(`dist/src`); |
|||
console.log('所有文件清理完成'); |
|||
})(); |
@ -0,0 +1,7 @@ |
|||
const execa = require("execa"); |
|||
const chalk = require('chalk'); |
|||
|
|||
console.log(chalk.red("开始监听,格式:umd")); |
|||
execa("rollup", ["-wc", "--environment", `NODE_ENV:development,TARGET:cjs`], { |
|||
stdio: "inherit", |
|||
}); |
@ -0,0 +1,92 @@ |
|||
|
|||
// @ts-nocheck
|
|||
|
|||
import { walkDir, removeIndex, isIndexEnd } from "./util"; |
|||
import path from "path"; |
|||
import fs from "fs"; |
|||
|
|||
const routes = ["所有路由路径:"]; |
|||
|
|||
export * from "./util/decorators"; |
|||
|
|||
export default new (class hapiRouter { |
|||
constructor() {} |
|||
public name: string = "routePlugin"; |
|||
public version: string = "0.0.1"; |
|||
public register(server: any, options: any) { |
|||
const sourceDir = options.sourceDir; |
|||
|
|||
const files = walkDir(sourceDir); |
|||
files.forEach((file) => { |
|||
let filename = file.relativeFileNoExt; |
|||
let array = filename.split(path.sep).slice(1); |
|||
let fileNoExt = removeIndex("/" + array.join("/")); |
|||
const moduleName = path.resolve(sourceDir, filename); |
|||
const obj = require(moduleName); |
|||
if (obj.default) { |
|||
const func = new (obj.default || obj)(); |
|||
const prototype = Object.getPrototypeOf(func); |
|||
const keys = Reflect.ownKeys(prototype); |
|||
for (const key of keys) { |
|||
if (key !== "constructor") { |
|||
let ff = func[key]; |
|||
// 默认方法
|
|||
const method = ff.$method || "GET"; |
|||
// 路由收集规则
|
|||
let route = ""; |
|||
if (ff.$route) { |
|||
if (isIndexEnd(fileNoExt)) { |
|||
route = ff.$route; |
|||
} else { |
|||
route = fileNoExt + ff.$route; |
|||
} |
|||
} else { |
|||
if (isIndexEnd(fileNoExt)) { |
|||
route = fileNoExt + key.toString(); |
|||
} else { |
|||
route = fileNoExt + "/" + key.toString(); |
|||
} |
|||
} |
|||
route = removeIndex(route); |
|||
// 配置规则
|
|||
const options = ff.$options ? ff.$options : {}; |
|||
if (!options.auth) { |
|||
if (ff.$auth == undefined) { |
|||
if (route.startsWith("/api")) { |
|||
options.auth = "jwt"; |
|||
} else { |
|||
options.auth = false; |
|||
} |
|||
} else if (ff.$auth) { |
|||
options.auth = "jwt"; |
|||
} else { |
|||
options.auth = false; |
|||
} |
|||
} |
|||
if (!options.validate) { |
|||
if (ff.$validate) { |
|||
options.validate = ff.$validate; |
|||
} |
|||
} |
|||
if (ff.$swagger && route.startsWith("/api")) { |
|||
options.description = ff.$swagger[0]; |
|||
options.notes = ff.$swagger[1]; |
|||
options.tags = ff.$swagger[2]; |
|||
} |
|||
|
|||
routes.push(route); |
|||
server.route({ |
|||
method: method, |
|||
path: route, |
|||
handler: ff, |
|||
options: options, |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
fs.writeFileSync(path.resolve(sourceDir, "route.txt"), routes.join("\n"), { |
|||
encoding: "utf-8", |
|||
}); |
|||
} |
|||
})(); |
@ -0,0 +1,36 @@ |
|||
// @ts-nocheck
|
|||
|
|||
export function method(opts?:string|Array<string>) { |
|||
return function (target, propertyKey: string, descriptor: PropertyDescriptor) { |
|||
target[propertyKey].$method = opts |
|||
} |
|||
} |
|||
export function route(route?:string) { |
|||
return function (target, propertyKey: string, descriptor: PropertyDescriptor) { |
|||
target[propertyKey].$route = route |
|||
} |
|||
} |
|||
|
|||
export function config(options:Object) { |
|||
return function (target, propertyKey: string, descriptor: PropertyDescriptor) { |
|||
target[propertyKey].$options = options |
|||
} |
|||
} |
|||
|
|||
export function auth(isAuth:boolean = true) { |
|||
return function (target, propertyKey: string, descriptor: PropertyDescriptor) { |
|||
target[propertyKey].$auth = isAuth |
|||
} |
|||
} |
|||
|
|||
export function validate(validate:Object) { |
|||
return function (target, propertyKey: string, descriptor: PropertyDescriptor) { |
|||
target[propertyKey].$validate = validate |
|||
} |
|||
} |
|||
|
|||
export function swagger(desc,notes,tags) { |
|||
return function (target, propertyKey: string, descriptor: PropertyDescriptor) { |
|||
target[propertyKey].$swagger = [desc,notes,tags] |
|||
} |
|||
} |
@ -0,0 +1,82 @@ |
|||
// @ts-nocheck
|
|||
|
|||
import fs from "fs" |
|||
import path from "path" |
|||
|
|||
export function removeIndex(ss:any) { |
|||
const remove = (str:any) => { |
|||
if (str.endsWith("/index")) { |
|||
return str.slice(0, -6); |
|||
} |
|||
if (str.endsWith("index")) { |
|||
return str.slice(0, -5); |
|||
} |
|||
return str ? str : "/"; |
|||
}; |
|||
let r = true; |
|||
let rr = ss; |
|||
while (r) { |
|||
if (rr.endsWith("/index")) { |
|||
rr = remove(rr); |
|||
} else { |
|||
r = false; |
|||
} |
|||
} |
|||
return rr ? rr : "/"; |
|||
} |
|||
|
|||
export function isIndexEnd(str:any) { |
|||
return str.length == 1 && str.endsWith("/"); |
|||
} |
|||
|
|||
|
|||
export function walkDir( |
|||
filePath:any, |
|||
exclude = ["node_modules", "^_", ".git", ".idea", ".gitignore", "client"] |
|||
) { |
|||
let files:any[] = []; |
|||
function Data(opts:any) { |
|||
this.relativeDir = opts.relativeDir; |
|||
this.relativeFile = opts.relativeFile; |
|||
this.filename = opts.filename; |
|||
this.file = opts.file; |
|||
this.absoluteFile = opts.absoluteFile; |
|||
this.relativeFileNoExt = opts.relativeFileNoExt; |
|||
this.absoluteDir = opts.absoluteDir; |
|||
} |
|||
function readDir(filePath, dirname = ".") { |
|||
let res = fs.readdirSync(filePath); |
|||
res.forEach((filename) => { |
|||
const filepath = path.resolve(filePath, filename); |
|||
const stat = fs.statSync(filepath); |
|||
const name = filepath.split(path.sep).slice(-1)[0]; |
|||
if (typeof exclude === "string" && new RegExp(exclude).test(name)) { |
|||
return; |
|||
} |
|||
if (Array.isArray(exclude)) { |
|||
for (let i = 0; i < exclude.length; i++) { |
|||
const excludeItem = exclude[i]; |
|||
if (new RegExp(excludeItem).test(name)) { |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
if (!stat.isFile()) { |
|||
readDir(filepath, dirname + path.sep + name); |
|||
} else { |
|||
const data = new Data({ |
|||
relativeDir: dirname, |
|||
relativeFile: dirname + path.sep + path.parse(filepath).base, |
|||
relativeFileNoExt: dirname + path.sep + path.parse(filepath).name, |
|||
file: path.parse(filepath).base, |
|||
filename: path.parse(filepath).name, |
|||
absoluteFile: filepath, |
|||
absoluteDir: path.parse(filepath).dir, |
|||
}); |
|||
files.push(data); |
|||
} |
|||
}); |
|||
} |
|||
readDir(filePath); |
|||
return files; |
|||
} |
@ -0,0 +1,37 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"allowUnreachableCode": true, |
|||
"strictNullChecks": true, |
|||
// 严格模式, 强烈建议开启 |
|||
"strict": true, |
|||
"allowJs": true, |
|||
// 目标js的版本 |
|||
"target": "ES5", |
|||
// 目标代码的模块结构版本 |
|||
"module": "ESNext", |
|||
// 在表达式和声明上有隐含的 any类型时报错。 |
|||
"noImplicitAny": true, |
|||
// "__extends"等函数 |
|||
// 将以"import {__extends} from 'tslib'的形式导入 |
|||
"importHelpers": true, |
|||
// 删除注释 |
|||
"removeComments": true, |
|||
// 保留 const和 enum声明 |
|||
"preserveConstEnums": false, |
|||
// 编译过程中需要引入的库文件的列表 |
|||
"lib": ["dom", "esnext"], |
|||
"sourceMap": true, |
|||
// 额外支持解构/forof等功能 |
|||
"downlevelIteration": true, |
|||
// 此处设置为node,才能解析import xx from 'xx' |
|||
"moduleResolution": "node", |
|||
"esModuleInterop": true, // esModuleInterop选项的作用是支持使用import d from 'cjs'的方式引入commonjs包。 |
|||
"baseUrl": ".", |
|||
"rootDir": ".", // 这个项目这个里的root必须要加上 |
|||
"paths": { |
|||
"@/*": ["./src/*"] |
|||
} |
|||
}, |
|||
"include": ["./src/**/*", "./global.d.ts"], |
|||
"exclude": ["node_modules"] |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,3 @@ |
|||
*{ |
|||
color: red; |
|||
} |
@ -0,0 +1,4 @@ |
|||
所有路由路径: |
|||
/ |
|||
/about |
|||
/upload |
@ -0,0 +1,5 @@ |
|||
require("dotenv").config(); |
|||
|
|||
import { run } from "./run"; |
|||
|
|||
run() |
@ -0,0 +1,29 @@ |
|||
import { publicDir } from "@/util"; |
|||
const Inert = require("@hapi/inert"); |
|||
|
|||
const filePlugin = { |
|||
name: "filePlugin", |
|||
version: "0.0.1", |
|||
register: async function (server, options) { |
|||
server.settings.routes = { |
|||
files: { |
|||
relativeTo: publicDir, |
|||
}, |
|||
}; |
|||
await server.register(Inert); |
|||
server.route({ |
|||
method: "GET", |
|||
path: "/public/{param*}", |
|||
config: { auth: false }, |
|||
handler: { |
|||
directory: { |
|||
path: publicDir, |
|||
index: true, |
|||
redirectToSlash: true, |
|||
}, |
|||
}, |
|||
}); |
|||
}, |
|||
}; |
|||
|
|||
export default filePlugin; |
@ -0,0 +1,16 @@ |
|||
import filePlugin from "./file-plugin"; |
|||
import path from "path"; |
|||
import { sourceDir } from "@/util"; |
|||
import routePlugin from "@noderun/hapi-router"; |
|||
|
|||
export default [ |
|||
{ |
|||
plugin: filePlugin, |
|||
}, |
|||
{ |
|||
plugin: routePlugin, |
|||
options: { |
|||
sourceDir: path.resolve(sourceDir, "route"), |
|||
}, |
|||
}, |
|||
]; |
@ -0,0 +1,80 @@ |
|||
import path from "path"; |
|||
import { gSuccess, gFail, uploadDir } from "@/util"; |
|||
|
|||
const fs = require("fs"); |
|||
const multiparty = require("multiparty"); |
|||
const FileType = require("file-type"); |
|||
|
|||
function saveFile(file) { |
|||
return new Promise(async (resolve, reject) => { |
|||
const filename = file.originalFilename; |
|||
const uploadedPath = file.path; |
|||
const filetype = await FileType.fromFile(uploadedPath); |
|||
console.log(filetype); |
|||
if (filetype && (filetype.ext == "jpg" || filetype.ext == "png")) { |
|||
const dstPath = path.resolve(uploadDir, filename); |
|||
fs.rename(uploadedPath, dstPath, function (err) { |
|||
if (err) { |
|||
console.log("rename error: " + err); |
|||
reject(); |
|||
} else { |
|||
resolve(0); |
|||
} |
|||
}); |
|||
} else { |
|||
fs.unlinkSync(uploadedPath); |
|||
reject(new Error(filename + "文件不是图片")); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
export default function (req, h) { |
|||
const form = new multiparty.Form({ |
|||
uploadDir: uploadDir, //路径需要对应自己的项目更改
|
|||
/*设置文件保存路径 */ |
|||
encoding: "utf-8", |
|||
/*编码设置 */ |
|||
maxFilesSize: 20000 * 1024 * 1024, |
|||
/*设置文件最大值 20MB */ |
|||
keepExtensions: true, |
|||
/*保留后缀*/ |
|||
}); |
|||
return new Promise(async (resolve, reject) => { |
|||
form.on("part", function (part) { |
|||
console.log(part.filename); |
|||
}); |
|||
form.on("progress", function (bytesReceived, bytesExpected) { |
|||
if (bytesExpected === null) { |
|||
return; |
|||
} |
|||
|
|||
var percentComplete = (bytesReceived / bytesExpected) * 100; |
|||
console.log( |
|||
"the form is " + Math.floor(percentComplete) + "%" + " complete" |
|||
); |
|||
}); |
|||
|
|||
form.parse(req.payload, async function (err, fields, files) { |
|||
// console.log(err, fields, files);
|
|||
|
|||
if (err) { |
|||
resolve(err.message); |
|||
return; |
|||
} |
|||
const errList = []; |
|||
for (let i = 0; i < files.file.length; i++) { |
|||
const file = files.file[i]; |
|||
try { |
|||
await saveFile(file); |
|||
} catch (error) { |
|||
errList.push(error.message); |
|||
} |
|||
} |
|||
if (errList.length) { |
|||
resolve(gFail(null, errList.join("\n"))); |
|||
return; |
|||
} |
|||
resolve(h.view("views/upload.ejs")); |
|||
}); |
|||
}); |
|||
} |
@ -0,0 +1,39 @@ |
|||
/* |
|||
* @Author: your name |
|||
* @Date: 2021-06-16 06:38:54 |
|||
* @LastEditTime: 2021-06-16 17:19:23 |
|||
* @LastEditors: your name |
|||
* @Description: In User Settings Edit |
|||
* @FilePath: /hapi-demo/source/route/index/index.ts |
|||
*/ |
|||
import { config, method } from "@noderun/hapi-router"; |
|||
import UploadFunc from "./_upload"; |
|||
|
|||
export default class { |
|||
index(request, h) { |
|||
return h.view("views/index.ejs"); |
|||
} |
|||
about(request, h) { |
|||
return h.view("views/about.ejs"); |
|||
} |
|||
|
|||
@config({ |
|||
payload: { |
|||
maxBytes: 20000 * 1024 * 1024, |
|||
output: "stream", |
|||
parse: false, |
|||
allow: "multipart/form-data", |
|||
}, |
|||
}) |
|||
|
|||
@method("POST") |
|||
async upload(req, h) { |
|||
const startTime = new Date().getTime(); |
|||
const res = await UploadFunc(req, h); |
|||
const endTime = new Date().getTime(); |
|||
console.log( |
|||
`该请求处理时间为:${Number(endTime - startTime).toFixed(2)}ms` |
|||
); |
|||
return res; |
|||
} |
|||
} |
@ -0,0 +1,40 @@ |
|||
"use strict"; |
|||
import plugins from "@/plugins"; |
|||
import { baseDir } from "@/util"; |
|||
const Hapi = require("@hapi/hapi"); |
|||
|
|||
const run = async () => { |
|||
const server = Hapi.server({ |
|||
port: 3000, |
|||
host: "localhost", |
|||
}); |
|||
|
|||
await server.register(plugins, { |
|||
routes: { |
|||
// prefix: "/api",
|
|||
}, |
|||
}); |
|||
|
|||
// https://hapi.dev/module/vision/api/?v=6.1.0
|
|||
await server.register(require("@hapi/vision")); |
|||
server.views({ |
|||
engines: { |
|||
ejs: require("ejs"), |
|||
}, |
|||
isCached: process.env.NODE_ENV === "development" ? false : true, |
|||
compileMode: "sync", |
|||
relativeTo: baseDir, |
|||
layout: true, |
|||
path: "template", |
|||
}); |
|||
|
|||
await server.start(); |
|||
console.log("Server running on %s", server.info.uri); |
|||
}; |
|||
|
|||
process.on("unhandledRejection", (err) => { |
|||
console.log("hh:", err); |
|||
process.exit(1); |
|||
}); |
|||
|
|||
export { run }; |
@ -0,0 +1,9 @@ |
|||
import path from "path"; |
|||
export * from "./res-helper"; |
|||
|
|||
export const baseDir = path.resolve(__dirname, "../../"); |
|||
|
|||
export const sourceDir = path.resolve(__dirname, "../../source"); |
|||
export const publicDir = path.resolve(__dirname, "../../public"); |
|||
export const uploadDir = path.resolve(publicDir, "upload"); |
|||
export const templateDir = path.resolve(publicDir, "template"); |
@ -0,0 +1,29 @@ |
|||
export function gSuccess(data = null, message = "success") { |
|||
if (typeof data === "string") { |
|||
return { |
|||
code: 200, |
|||
message: data, |
|||
data: null, |
|||
}; |
|||
} |
|||
return { |
|||
code: 200, |
|||
message: message, |
|||
data: data, |
|||
}; |
|||
} |
|||
|
|||
export function gFail(data = null, message = "fail") { |
|||
if (typeof data === "string") { |
|||
return { |
|||
code: 400, |
|||
message: data, |
|||
data: null, |
|||
}; |
|||
} |
|||
return { |
|||
code: 400, |
|||
message: message, |
|||
data: data, |
|||
}; |
|||
} |
@ -0,0 +1,2 @@ |
|||
</body> |
|||
</html> |
@ -0,0 +1,22 @@ |
|||
<!-- |
|||
* @Author: your name |
|||
* @Date: 2021-06-16 02:56:55 |
|||
* @LastEditTime: 2021-06-16 17:21:34 |
|||
* @LastEditors: your name |
|||
* @Description: In User Settings Edit |
|||
* @FilePath: /hapi-demo/template/includes/head.ejs |
|||
--> |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="UTF-8" /> |
|||
<meta |
|||
name="viewport" |
|||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" |
|||
/> |
|||
<meta http-equiv="X-UA-Compatible" content="ie=edge" /> |
|||
<title>Document</title> |
|||
<link rel="stylesheet" href="/public/style.css" /> |
|||
</head> |
|||
<body></body> |
|||
</html> |
@ -0,0 +1,4 @@ |
|||
|
|||
<%- include("./includes/head")%> |
|||
<%- content %> |
|||
<%- include("./includes/foot")%> |
@ -0,0 +1,3 @@ |
|||
<div> |
|||
阿萨德 sad撒 |
|||
</div> |
@ -0,0 +1,58 @@ |
|||
<form action="/upload" method="post" enctype="multipart/form-data"> |
|||
<input type="file" name="file" id="file" multiple /> |
|||
<button type="submit" id="upload">上传</button> |
|||
</form> |
|||
<div id="filelist"></div> |
|||
|
|||
<script> |
|||
function $(selector) { |
|||
return document.querySelector(selector); |
|||
} |
|||
var uploadEl = $("#upload"); |
|||
var filelistEl = $("#filelist"); |
|||
var fileEl = $("#file"); |
|||
|
|||
uploadEl.addEventListener("click", function (e) { |
|||
e.preventDefault(); |
|||
|
|||
var xmlhttp; |
|||
if (window.XMLHttpRequest) { |
|||
// code for IE7+, Firefox, Chrome, Opera, Safari |
|||
xmlhttp = new XMLHttpRequest(); |
|||
} else { |
|||
// code for IE6, IE5 |
|||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); |
|||
} |
|||
xmlhttp.open("POST", "/upload", true); |
|||
// 这里不需要自己加,会自己处理 |
|||
// xmlhttp.setRequestHeader("Content-Type", "multipart/form-data"); |
|||
|
|||
if (xmlhttp.upload) { |
|||
//监听上传属性的上传事件,每次上传事件都会执行 progressHandlingFunction |
|||
xmlhttp.upload.addEventListener( |
|||
"progress", |
|||
function (evt) { |
|||
var loaded = evt.loaded; |
|||
var tot = evt.total; |
|||
var per = Math.floor((100 * loaded) / tot); //已经上传的百分比 |
|||
}, |
|||
false |
|||
); |
|||
//xmlhttp.upload.progress = function(){} 也可以 |
|||
} |
|||
|
|||
var formData = new FormData(); |
|||
for (let i = 0; i < fileEl.files.length; i++) { |
|||
const file = fileEl.files[i]; |
|||
formData.append("file", file); |
|||
} |
|||
xmlhttp.send(formData); |
|||
|
|||
xmlhttp.onreadystatechange = function () { |
|||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { |
|||
// console.log(xmlhttp.responseText); |
|||
alert("success"); |
|||
} |
|||
}; |
|||
}); |
|||
</script> |
@ -0,0 +1,3 @@ |
|||
<div> |
|||
uploadsuccess |
|||
</div> |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"compilerOptions": { |
|||
"outDir": "./dist", |
|||
"allowJs": true, |
|||
"target": "es6", |
|||
"sourceMap": false, |
|||
"module": "commonjs", |
|||
"experimentalDecorators": true, |
|||
"moduleResolution": "node", |
|||
"esModuleInterop": true, // esModuleInterop选项的作用是支持使用import d from 'cjs'的方式引入commonjs包。 |
|||
"baseUrl": ".", |
|||
"paths": { |
|||
"@/*": ["./source/*"] |
|||
} |
|||
}, |
|||
"include": [ |
|||
"./source/**/*", |
|||
"./types/global.d.ts" |
|||
], |
|||
"exclude": ["node_modules"] |
|||
} |
@ -0,0 +1 @@ |
|||
|
Loading…
Reference in new issue