-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
3,623 additions
and
2,620 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# http://editorconfig.org | ||
|
||
root = true | ||
lib | ||
|
||
[*] | ||
charset = utf-8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { | ||
createDebug, | ||
chalk | ||
} from '@umijs/utils'; | ||
|
||
export default class Logger { | ||
LOG = chalk.black.bgBlue('LOG'); | ||
|
||
INFO = chalk.black.bgBlue('INFO'); | ||
|
||
WARN = chalk.black.bgHex('#faad14')('WARN'); | ||
|
||
ERROR = chalk.black.bgRed('ERROR'); | ||
|
||
PROFILE = chalk.black.bgCyan('PROFILE'); | ||
|
||
constructor(namespace) { | ||
// TODO: get namespace filename accounding caller function | ||
if (!namespace) { | ||
throw new Error('logger needs namespace'); | ||
} | ||
this.namespace = namespace; | ||
this.profilers = {}; | ||
this.debug = createDebug(this.namespace); | ||
} | ||
|
||
log(...args) { | ||
// TODO: node env production | ||
console.log(this.LOG, ...args); | ||
} | ||
|
||
/** | ||
* The {@link logger.info} function is an alias for {@link logger.log()}. | ||
* @param args | ||
*/ | ||
info(...args) { | ||
console.log(this.INFO, ...args); | ||
} | ||
|
||
error(...args) { | ||
console.error(this.ERROR, ...args); | ||
} | ||
|
||
warn(...args) { | ||
console.warn(this.WARN, ...args); | ||
} | ||
|
||
formatTiming(timing) { | ||
return timing < 60 * 1000 | ||
? `${Math.round(timing / 10) / 100}s` | ||
: `${Math.round(timing / 600) / 100}m`; | ||
} | ||
|
||
profile(id, message) { | ||
const time = Date.now(); | ||
const namespace = `${this.namespace}:${id}`; | ||
// for test | ||
let msg; | ||
if (this.profilers[id]) { | ||
const timeEnd = this.profilers[id]; | ||
delete this.profilers[id]; | ||
process.stderr.write(`${this.PROFILE} `); | ||
msg = `${this.PROFILE} ${chalk.cyan( | ||
`└ ${namespace}`, | ||
)} Completed in ${this.formatTiming(time - timeEnd)}`; | ||
console.log(msg); | ||
} else { | ||
msg = `${this.PROFILE} ${chalk.cyan(`┌ ${namespace}`)} ${message || ''}`; | ||
console.log(msg); | ||
} | ||
|
||
this.profilers[id] = time; | ||
return msg; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
disableTypeCheck: false, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@webank/fes-plugin-built-in", | ||
"version": "2.0.0", | ||
"description": "@webank/fes-plugin-built-in", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"files": [ | ||
"lib" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "" | ||
}, | ||
"keywords": [ | ||
"fes" | ||
], | ||
"authors": [ | ||
"" | ||
], | ||
"license": "MIT", | ||
"bugs": "", | ||
"homepage": "", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@umijs/utils": "^3.2.24", | ||
"@umijs/bundler-webpack": "^3.2.23", | ||
"@umijs/server": "^3.2.23", | ||
"@vue/babel-plugin-jsx": "^1.0.0-rc.3", | ||
"@webank/fes-core": "^2.0.0", | ||
"cliui": "6.0.0", | ||
"vue-loader": "^16.0.0-rc.1", | ||
"html-webpack-plugin": "^3.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// TODO 拆成独立的包作为内置插件包 | ||
|
||
export default [ | ||
// register methods | ||
require.resolve('./plugins/registerMethods'), | ||
|
||
// misc | ||
require.resolve('./plugins/routes'), | ||
|
||
// generate files | ||
require.resolve('./plugins/generateFiles/core/plugin'), | ||
require.resolve('./plugins/generateFiles/core/routes'), | ||
require.resolve('./plugins/generateFiles/core/fesExports'), | ||
require.resolve('./plugins/generateFiles/fes'), | ||
|
||
// bundle configs | ||
require.resolve('./plugins/features/alias'), | ||
require.resolve('./plugins/features/analyze'), | ||
require.resolve('./plugins/features/autoprefixer'), | ||
require.resolve('./plugins/features/base'), | ||
require.resolve('./plugins/features/chainWebpack'), | ||
require.resolve('./plugins/features/chunks'), | ||
require.resolve('./plugins/features/cssLoader'), | ||
require.resolve('./plugins/features/cssnano'), | ||
require.resolve('./plugins/features/copy'), | ||
require.resolve('./plugins/features/define'), | ||
require.resolve('./plugins/features/devServer'), | ||
require.resolve('./plugins/features/devtool'), | ||
require.resolve('./plugins/features/externals'), | ||
require.resolve('./plugins/features/extraBabelPlugins'), | ||
require.resolve('./plugins/features/extraBabelPresets'), | ||
require.resolve('./plugins/features/extraPostCSSPlugins'), | ||
require.resolve('./plugins/features/hash'), | ||
require.resolve('./plugins/features/html'), | ||
require.resolve('./plugins/features/inlineLimit'), | ||
require.resolve('./plugins/features/lessLoader'), | ||
require.resolve('./plugins/features/mountElementId'), | ||
require.resolve('./plugins/features/nodeModulesTransform'), | ||
require.resolve('./plugins/features/outputPath'), | ||
require.resolve('./plugins/features/plugins'), | ||
require.resolve('./plugins/features/postcssLoader'), | ||
require.resolve('./plugins/features/proxy'), | ||
require.resolve('./plugins/features/publicPath'), | ||
require.resolve('./plugins/features/styleLoader'), | ||
require.resolve('./plugins/features/targets'), | ||
require.resolve('./plugins/features/terserOptions'), | ||
require.resolve('./plugins/features/theme'), | ||
require.resolve('./plugins/features/vueLoader'), | ||
|
||
// commands | ||
require.resolve('./plugins/commands/build/build'), | ||
require.resolve('./plugins/commands/dev/dev') | ||
]; |
Oops, something went wrong.