Initial commit: GamePortrait 竖屏版 - 深色豪华主题

This commit is contained in:
li
2026-01-16 17:47:53 +08:00
commit 40976e4b45
26611 changed files with 2843638 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
# editorconfig.org
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
+14
View File
@@ -0,0 +1,14 @@
{
"env": {
"node": true
},
"parserOptions": {
"sourceType": "module"
},
"extends": "standard",
"rules": {
"eol-last": "off",
"import/no-dynamic-require": "off",
"space-before-function-paren":"off"
}
}
+5
View File
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "8.10.0"
env:
- NODE_ENV:test
+43
View File
@@ -0,0 +1,43 @@
progress-webpack-plugin [![npm version](https://badge.fury.io/js/progress-webpack-plugin.svg)](https://badge.fury.io/js/progress-webpack-plugin)
===
[![NPM](https://nodei.co/npm/progress-webpack-plugin.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/progress-webpack-plugin/)
inspired by [progress-bar-webpack-plugin](https://github.com/clessg/progress-bar-webpack-plugin),simple Webpack plugin that display nice progress when build
Install
===
```javascript
npm install progress-webpack-plugin --save--dev
```
Usage
===
add plugin in your webpack.config.js
```javascript
var ProgressPlugin = require('progress-webpack-plugin')
module.exports = {
...
plugins:[
new ProgressPlugin(true)
]
}
```
Plugin Options
===
- **minimal**: enable minimal mode or not,default value is false
- **identifier**: identifier of webpack bundle
- **onStart**: callback function when webpack bundler started
- **onFinish**: callback function when webpack bundler finished
- **onProgress**: callback function when webpack bundler running
- **clear**: whether clear console when webpack bundler finished
## License
[MIT License](http://en.wikipedia.org/wiki/MIT_License)
+139
View File
@@ -0,0 +1,139 @@
let chalk = require('chalk')
let ProgressPlugin = require('webpack/lib/ProgressPlugin')
let log = require('log-update')
let path = require('path')
const thresholder = 0.99
function now() {
return new Date().toTimeString().split(' ')[0]
}
function isEqual(arr1, arr2) {
let equal = arr1.length === arr2.length
for (let i = 0; i < arr1.length; i++) {
if (arr1[i] !== arr2[i]) {
equal = false
break
}
}
return equal
}
class Progress {
constructor(options) {
this.delegate = new ProgressPlugin(options)
}
apply(compiler) {
this.delegate.apply(compiler)
let invalid = () => {
console.log(chalk.white('Compiling...'))
}
if (compiler.hooks) {
compiler.hooks.invalid.tap('ProgressWebpckPlugin', invalid)
} else {
compiler.plugin('invalid', invalid)
}
}
}
function progressPlugin(options = {}) {
let identifier = options.identifier || ''
let id = identifier && identifier + ' '
let onStart = options.onStart || (() => {})
let onFinish = options.onFinish
let onProgress = options.onProgress
let coloring = onProgress === undefined
let clear = typeof options.clear === 'boolean' ? options.clear : true
let startTime
let finishTime
let duration
let prev = {}
const handler = (percentage, message, ...args) => {
startTime = Date.now()
let output = []
if (percentage > thresholder) {
return
}
if (percentage === 0) onStart()
if (percentage > 0 && percentage < thresholder) {
if (message === '') return
if (
prev.percentage === percentage &&
prev.message === message &&
isEqual(prev.args, args)
) {
return
}
prev = { percentage, message, args }
const banner = `[${Math.round(percentage * 100)}%] `
output.push(coloring ? chalk.yellow(banner) : banner)
output.push(
coloring ? chalk.white(`${message} ${id}`) : `${message} ${id}`
)
if (args.length > 0) {
let details = args.join(' ')
if (
/^\d+\/\d+\s{1}modules/.test(args[0]) === true &&
args.length === 2
) {
const rootPath = path.resolve('.')
details = [args[0]].concat([args[1].replace(rootPath, '')]).join(' ')
}
if (/^import\s{1}loader/.test(args[0]) === true && args.length === 1) {
const matches = args[0].match(
/^import\s{1}loader\s{1}(.+\/node_modules\/)/
)
if (matches) {
details = args[0].replace(matches[1], '')
}
}
output.push(coloring ? chalk.grey(`(${details})`) : `(${details})`)
}
}
// // 5. finished
if (percentage === thresholder) {
finishTime = Date.now()
duration = (finishTime - startTime) / 1000
duration = duration.toFixed(3)
if (typeof onFinish === 'function') {
onFinish(id, now(), duration)
} else {
output.push(
coloring
? chalk.white(`Build ${id}finished at ${now()} by ${duration}s`)
: `Build ${id}finished at ${now()} by ${duration}s`
)
}
}
if (onProgress) {
if (percentage > 0 && percentage < thresholder) {
onProgress(output, percentage)
}
} else {
log(output.join(''))
if (percentage === thresholder) {
if (clear) {
log.clear()
} else {
log.done()
}
}
}
}
return new Progress({
handler,
entries: false,
activeModules: false,
modules: true,
modulesCount: 5000,
dependencies: false,
dependenciesCount: 10000,
percentBy: 'entries'
})
}
module.exports = progressPlugin
+43
View File
@@ -0,0 +1,43 @@
{
"name": "progress-webpack-plugin",
"version": "1.0.16",
"description": "progress webpack plugin",
"main": "index.js",
"scripts": {
"test": "mocha test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ali322/progress-webpack-plugin.git"
},
"keywords": [
"progress"
],
"author": "alichen",
"license": "MIT",
"bugs": {
"url": "https://github.com/ali322/progress-webpack-plugin/issues"
},
"homepage": "https://github.com/ali322/progress-webpack-plugin#readme",
"engines": {
"node": ">= 10.13.0"
},
"dependencies": {
"chalk": "^2.1.0",
"figures": "^2.0.0",
"log-update": "^2.3.0"
},
"peerDependencies": {
"webpack": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0"
},
"devDependencies": {
"chai": "^4.1.2",
"eslint": "^8.12.0",
"eslint-config-standard": "^11.0.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.7.0",
"eslint-plugin-standard": "^3.0.1",
"mocha": "^9.2.2"
}
}
+1
View File
@@ -0,0 +1 @@
console.log("hello world");
+1
View File
@@ -0,0 +1 @@
console.log('hello world')
+32
View File
@@ -0,0 +1,32 @@
let webpack = require('webpack')
let expect = require('chai').expect
let path = require('path')
let ProgressPlugin = require('../')
const OUTPUT_PATH = path.join(__dirname, 'dist')
describe('Progress Plugin', () => {
it('should output correctly', done => {
let compiler = webpack(
{
entry: {
main: path.join(__dirname, 'fixture', 'entry.js')
},
mode: 'production',
output: {
path: OUTPUT_PATH,
filename: '[name].min.js'
},
plugins: [
new ProgressPlugin({
identifier: 'test'
})
]
},
(err, stats) => {
expect(err).to.equal(null)
done()
}
)
})
})