Commit e55d7832 by 蒋勇

modi version

parents f466ef30 d2db2c2e

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
../lib/node_modules/cnpm/bin/cnpm
\ No newline at end of file
../lib/node_modules/http-server/bin/http-server
\ No newline at end of file
../lib/node_modules/http-server/bin/http-server
\ No newline at end of file
../lib/node_modules/npm/bin/npm-cli.js
\ No newline at end of file
../lib/node_modules/npm/bin/npx-cli.js
\ No newline at end of file
../lib/node_modules/@quasar/cli/bin/quasar
\ No newline at end of file
../lib/node_modules/@vue/cli/bin/vue.js
\ No newline at end of file
#!/usr/bin/env node
require('../lib/node-version-check')
const updateNotifier = require('update-notifier')
const pkg = require('../package.json')
updateNotifier({ pkg }).notify()
function getQuasarAppExecutable (which, root) {
try {
return require.resolve(which, {
paths: [ root ]
})
}
catch (e) {
return false
}
}
let cmd = process.argv[2]
if (cmd === 'create') {
process.argv.splice(2, 1)
require(`./quasar-create`)
}
else if (cmd === 'serve') {
process.argv.splice(2, 1)
require(`./quasar-serve`)
}
else if (cmd === 'upgrade') {
process.argv.splice(2, 1)
require(`./quasar-upgrade`)
}
else {
const root = require('../lib/get-project-root')()
const localFile = root
? (
getQuasarAppExecutable('@quasar/app/bin/quasar', root) ||
getQuasarAppExecutable('quasar-cli/bin/quasar', root) // legacy <1.0
)
: void 0
if (localFile) {
process.env.QUASAR_CLI_VERSION = require('../package.json').version
global.quasarCli = {
help: `
upgrade Check (and optionally) upgrade Quasar packages
from a Quasar project folder
serve Create an ad-hoc server on App's distributables
`
}
// deferring to local @quasar/app or pre-v1 quasar-cli
require(localFile)
}
else {
const commands = [
'info',
'help'
]
if (cmd) {
if (cmd === '-h') {
cmd = 'help'
}
else if (cmd === 'i') {
cmd = 'info'
}
if (commands.includes(cmd)) {
process.argv.splice(2, 1)
}
else {
if (cmd === '-v' || cmd === '--version') {
console.log(require('../package.json').version)
process.exit(0)
}
const chalk = require('chalk')
console.log(`\n ${chalk.red(`Error`)} Unknown command "${ cmd }"`)
if (cmd.indexOf('-') === 0) {
console.log(`\n ${chalk.red(`Error`)} Command must come before the options`)
}
console.log()
cmd = 'help'
}
}
else {
cmd = 'help'
}
require(`./quasar-${cmd}`)
}
}
#!/usr/bin/env node
const parseArgs = require('minimist')
const chalk = require('chalk')
const argv = parseArgs(process.argv.slice(2), {
alias: {
b: 'branch',
k: 'kit',
c: 'clone',
o: 'offline',
h: 'help'
},
boolean: ['c', 'o', 'h'],
string: ['k', 'b']
})
if (argv.help) {
console.log(`
Description
Creates a Quasar App or App Extension project folder
Usage
$ quasar create <project-name> [--kit <kit-name>] [--branch <version-name>]
App Examples
$ quasar create my-project
# installs an App project with the latest App starter kit
$ quasar create my-project --branch v0.17
# installs an App project from a specific version (only major+minor version)
$ quasar create my-project --kit user/github-starter-kit
# installs an App project with a custom starter kit from GitHub
$ quasar create my-project --kit ./starter-kit-folder
# installs an App project using a starter kit located at ./starter-kit-folder
App Extension Examples
$ quasar create my-extension-project --kit app-extension
# installs an App Extension project with the latest Quasar App Extension starter kit
$ quasar create my-extension-project --kit user/github-extension-starter-kit
# installs an App Extension project with a custom starter kit from GitHub
$ quasar create my-extension-project --kit user/github-extension-starter-kit --branch dev
# installs an App Extension project with a custom starter kit from GitHub using the dev branch
Options
--kit, -k Use specific starter kit
--branch, -b Use specific branch of the starter kit
--clone, -c Use git clone
--offline, -o Use a cached starter kit
--help, -h Displays this message
`)
process.exit(0)
}
require('../lib/ensure-outside-project')()
console.log()
console.log(
require('fs').readFileSync(
require('path').join(__dirname, '../assets/logo.art'),
'utf8'
)
)
// Following is adapted from Vue CLI v2 "init" command
const download = require('download-git-repo')
const exists = require('fs').existsSync
const path = require('path')
const ora = require('ora')
const home = require('user-home')
const tildify = require('tildify')
const inquirer = require('inquirer')
const rm = require('rimraf').sync
const generate = require('../lib/generate')
const logger = require('../lib/logger')
const { isLocalPath, getTemplatePath } = require('../lib/local-path')
let template = argv.kit
? (
argv.kit.indexOf('/') > -1
? argv.kit
: 'quasarframework/quasar-starter-kit-' + argv.kit
)
: 'quasarframework/quasar-starter-kit'
const rawName = argv._[0]
const inPlace = !rawName || rawName === '.'
const name = inPlace ? path.relative('../', process.cwd()) : rawName
const to = path.resolve(rawName || '.')
if (isLocalPath(template) !== true) {
template += '#' + (argv.branch || 'master')
}
const tmp = path.join(home, '.quasar-starter-kits', template.replace(/[\/:]/g, '-'))
if (argv.offline) {
console.log(`> Use cached template at ${chalk.yellow(tildify(tmp))}`)
template = tmp
}
console.log()
process.on('exit', () => {
console.log()
})
if (inPlace || exists(to)) {
inquirer.prompt([{
type: 'confirm',
message: inPlace
? 'Generate project in current directory?'
: 'Target directory exists. Continue?',
name: 'ok'
}]).then(answers => {
if (answers.ok) {
run()
}
}).catch(logger.fatal)
}
else {
run()
}
function run () {
// check if template isn't local
if (isLocalPath(template) !== true) {
downloadAndGenerate(template)
return
}
const templatePath = getTemplatePath(template)
if (exists(templatePath)) {
generate(name, templatePath, to, err => {
if (err) logger.fatal(err)
console.log()
logger.success('Generated "%s".', name)
})
}
else {
logger.fatal('Local template "%s" not found.', template)
}
}
function downloadAndGenerate (template) {
const spinner = ora(' Downloading Quasar starter kit')
spinner.start()
// Remove if local template exists
if (exists(tmp)) {
rm(tmp)
}
download(template, tmp, { clone: argv.clone }, err => {
spinner.stop()
if (err) {
logger.fatal('Failed to download repo ' + template + ': ' + err.message.trim())
}
generate(name, tmp, to, err => {
if (err) {
logger.fatal(err)
}
console.log()
logger.success('Generated "%s".', name)
})
})
}
#!/usr/bin/env node
console.log()
console.log(
require('fs').readFileSync(
require('path').join(__dirname, '../assets/logo.art'),
'utf8'
)
)
console.log(' Running @quasar/cli v' + require('../package.json').version)
const chalk = require('chalk')
console.log(`
Example usage
$ quasar <command> <options>
Help for a command
$ quasar <command> --help
$ quasar <command> -h
Options
--version, -v Print Quasar CLI version
Commands
create Create a project folder
info Display info about your machine
(and your App if in a project folder)
upgrade Check (and optionally) upgrade Quasar packages
from a Quasar project folder
serve Create an ad-hoc server on App's distributables
help, -h Displays this message
--------------
=> IMPORTANT !
=> ${chalk.italic('Trigger this inside of a Quasar project (and npm/yarn install) for more commands.')}
--------------
`)
#!/usr/bin/env node
const parseArgs = require('minimist')
const chalk = require('chalk')
const argv = parseArgs(process.argv.slice(2), {
alias: {
h: 'help'
},
boolean: ['h']
})
if (argv.help) {
console.log(`
Description
Displays information about your machine and your Quasar App.
Usage
$ quasar info
Options
--help, -h Displays this message
`)
process.exit(0)
}
const os = require('os')
const spawn = require('cross-spawn').sync
function getSpawnOutput (command) {
try {
const child = spawn(command, ['--version'])
return child.status === 0
? chalk.green(String(child.output[1]).trim())
: chalk.red('Not installed')
}
catch (err) {
return chalk.red('Not installed')
}
}
const getExternalIPs = require('../lib/net').getExternalNetworkInterface
const output = [
{ key: 'Operating System', value: chalk.green(`${os.type()}(${os.release()}) - ${os.platform()}/${os.arch()}`), section: true },
{ key: 'NodeJs', value: chalk.green(process.version.slice(1)) },
{ key: 'Global packages', section: true },
{ key: ' NPM', value: getSpawnOutput('npm') },
{ key: ' yarn', value: getSpawnOutput('yarn') },
{ key: ' @quasar/cli', value: chalk.green(require('../package.json').version) },
{ key: ' cordova', value: getSpawnOutput('cordova') }
]
output.push(
{ key: 'Networking', section: true },
{ key: ' Host', value: chalk.green(os.hostname()) }
)
getExternalIPs().forEach(intf => {
output.push({
key: ` ${ intf.deviceName }`,
value: chalk.green(intf.address)
})
})
const spaces = output.reduce((acc, v) => Math.max(acc, v.key.length), 0)
console.log(
output
.map(m => `${m.section ? '\n' : ''}${ m.key }${' '.repeat(spaces - m.key.length)}\t${ m.value === undefined ? '' : m.value }`).join('\n')
)
console.log()
#!/usr/bin/env node
const parseArgs = require('minimist')
const argv = parseArgs(process.argv.slice(2), {
alias: {
i: 'install',
p: 'prerelease',
m: 'major',
h: 'help'
},
boolean: ['h', 'i', 'p', 'm']
})
if (argv.help) {
console.log(`
Description
Upgrades all quasar packages to their latest version
which are compatible with the API that you are currently using
(unless -m/--major param is used which may include breaking changes).
Works only in a project folder by upgrading to latest minor versions
(or latest major versions if chosen to) of all quasar related packages.
This will also upgrade official Quasar App Extensions.
Usage
# checks for non-breaking change upgrades and displays them,
# but it does not also installs
$ quasar upgrade
# checks for pre-releases (alpha/beta) also:
$ quasar upgrade -p
# checks for major new releases (includes breaking changes):
$ quasar upgrade -m
# to perform the actual upgrade,
# combine any of the params above and add "-i" (or "--install"):
$ quasar upgrade -i
Options
--install, -i Also perform package upgrades
--prerelease, -p Allow pre-release versions (alpha/beta)
--major, -m Allow newer major versions (breaking changes)
--help, -h Displays this message
`)
process.exit(0)
}
const fs = require('fs')
const path = require('path')
const execSync = require('child_process').execSync
const { green, red } = require('chalk')
const root = require('../lib/get-project-root')()
const { log, fatal } = require('../lib/logger')
if (!root) {
fatal(`⚠️ Error. This command must be executed inside a Quasar project folder only.`)
}
if (!fs.existsSync(path.join(root, 'node_modules'))) {
fatal('⚠️ Please run "yarn" / "npm install" first\n')
}
const pkg = require(path.join(root, 'package.json'))
const versionRegex = /^(\d+)\.[\d]+\.[\d]+-?(alpha|beta)?/
function getLatestVersion (packager, packageName, curVersion) {
let versions
try {
versions = JSON.parse(
execSync(
`${packager} info ${packageName} versions --json`,
{ stdio: ['ignore', 'pipe', 'pipe'] }
)
)
}
catch (err) {
return null
}
if (versions.type === 'error') {
return null
}
if (packager === 'yarn') {
versions = versions.data
}
if (curVersion === null) {
return versions[versions.length - 1]
}
const [, major, prerelease] = curVersion.match(versionRegex)
const majorSyntax = argv.major ? `(\\d+)` : major
const regex = new RegExp(
prerelease || argv.prerelease
? `^${majorSyntax}\\.(\\d+)\\.(\\d+)-?(alpha|beta)?`
: `^${majorSyntax}\\.(\\d+)\\.(\\d+)$`
)
versions = versions.filter(version => regex.test(version))
return versions[versions.length - 1]
}
function upgradeQuasar () {
const deps = {
dependencies: [],
devDependencies: []
}
const packager = require('../lib/node-packager')(root)
const getPackageJson = require('../lib/get-package-json')(root)
console.log()
log(`Gathering information with ${packager}...`)
console.log()
let updateAvailable = false
for (const type of Object.keys(deps)) {
for (const packageName of Object.keys(pkg[type] || {})) {
// is it a Quasar package?
if (packageName !== 'quasar' && packageName !== 'eslint-plugin-quasar' && !packageName.startsWith('@quasar/')) {
continue
}
const json = getPackageJson(packageName)
const curVersion = json !== null
? json.version
: null
const latestVersion = getLatestVersion(packager, packageName, curVersion)
const current = curVersion === null
? red('Missing!')
: curVersion
if (latestVersion === null) {
console.log(` ${green(packageName)}: ${current}${red('Skipping!')}`)
console.log(` (⚠️ NPM server returned an error, so we cannot detect latest version)`)
}
else if (curVersion !== latestVersion) {
deps[type].push({
packageName,
latestVersion
})
updateAvailable = true
console.log(` ${green(packageName)}: ${current}${latestVersion}`)
}
}
}
if (!updateAvailable) {
// The string `Congrats!` in the following log line is parsed by
// @quasar/wizard AE. Do not change under any circumstances.
console.log(' Congrats! All Quasar packages are up to date.\n')
return
}
if (!argv.install) {
const params = [ '-i' ]
argv.prerelease && params.push('-p')
argv.major && params.push('-m')
console.log()
console.log(` See ${green('https://quasar.dev/start/release-notes')} for release notes.`)
console.log(` Run "quasar upgrade ${params.join(' ')}" to do the actual upgrade.`)
console.log()
return
}
const { removeSync } = require('fs-extra')
const spawn = require('../lib/spawn')
for (const type of Object.keys(deps)) {
if (deps[type].length === 0) {
continue
}
const params = packager === 'yarn'
? (type === 'devDependencies' ? [ 'add', '--dev' ] : [ 'add' ])
: [ `install`, `--save${type === 'devDependencies' ? '--dev' : ''}` ]
deps[type].forEach(dep => {
// need to delete tha package otherwise
// installing the new version might fail on Windows
removeSync(path.join(root, 'node_modules', dep.packageName))
const pinned = /^\d/.test(
pkg.dependencies[dep.packageName] ||
pkg.devDependencies[dep.packageName] ||
'^' // fallback, just in case
)
params.push(`${dep.packageName}@${pinned ? '' : '^'}${dep.latestVersion}`)
})
console.log()
spawn(packager, params, root)
}
console.log()
log('Successfully upgraded Quasar packages.\n')
}
upgradeQuasar()
../_metalsmith@2.3.0@metalsmith/bin/_metalsmith
\ No newline at end of file
../_handlebars@4.7.6@handlebars/bin/handlebars
\ No newline at end of file
../_metalsmith@2.3.0@metalsmith/bin/metalsmith
\ No newline at end of file
../_rimraf@3.0.2@rimraf/bin.js
\ No newline at end of file
../_@sindresorhus_is@0.14.0@@sindresorhus/is
\ No newline at end of file
../_@szmarczak_http-timer@1.1.2@@szmarczak/http-timer
\ No newline at end of file
../_@types_color-name@1.1.1@@types/color-name
\ No newline at end of file
../_@types_http-proxy@1.17.4@@types/http-proxy
\ No newline at end of file
../_@types_minimatch@3.0.3@@types/minimatch
\ No newline at end of file
../_@types_node@14.0.23@@types/node
\ No newline at end of file
MIT License
Copyright (c) 2018 Szymon Marczak
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.
# http-timer
> Timings for HTTP requests
[![Build Status](https://travis-ci.org/szmarczak/http-timer.svg?branch=master)](https://travis-ci.org/szmarczak/http-timer)
[![Coverage Status](https://coveralls.io/repos/github/szmarczak/http-timer/badge.svg?branch=master)](https://coveralls.io/github/szmarczak/http-timer?branch=master)
[![install size](https://packagephobia.now.sh/badge?p=@szmarczak/http-timer)](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)
Inspired by the [`request` package](https://github.com/request/request).
## Usage
```js
'use strict';
const https = require('https');
const timer = require('@szmarczak/http-timer');
const request = https.get('https://httpbin.org/anything');
const timings = timer(request);
request.on('response', response => {
response.on('data', () => {}); // Consume the data somehow
response.on('end', () => {
console.log(timings);
});
});
// { start: 1535708511443,
// socket: 1535708511444,
// lookup: 1535708511444,
// connect: 1535708511582,
// upload: 1535708511887,
// response: 1535708512037,
// end: 1535708512040,
// phases:
// { wait: 1,
// dns: 0,
// tcp: 138,
// request: 305,
// firstByte: 150,
// download: 3,
// total: 597 } }
```
## API
### timer(request)
Returns: `Object`
- `start` - Time when the request started.
- `socket` - Time when a socket was assigned to the request.
- `lookup` - Time when the DNS lookup finished.
- `connect` - Time when the socket successfully connected.
- `upload` - Time when the request finished uploading.
- `response` - Time when the request fired the `response` event.
- `end` - Time when the response fired the `end` event.
- `error` - Time when the request fired the `error` event.
- `phases`
- `wait` - `timings.socket - timings.start`
- `dns` - `timings.lookup - timings.socket`
- `tcp` - `timings.connect - timings.lookup`
- `request` - `timings.upload - timings.connect`
- `firstByte` - `timings.response - timings.upload`
- `download` - `timings.end - timings.response`
- `total` - `timings.end - timings.start` or `timings.error - timings.start`
**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
## License
MIT
'use strict';
const deferToConnect = require('defer-to-connect');
module.exports = request => {
const timings = {
start: Date.now(),
socket: null,
lookup: null,
connect: null,
upload: null,
response: null,
end: null,
error: null,
phases: {
wait: null,
dns: null,
tcp: null,
request: null,
firstByte: null,
download: null,
total: null
}
};
const handleError = origin => {
const emit = origin.emit.bind(origin);
origin.emit = (event, ...args) => {
// Catches the `error` event
if (event === 'error') {
timings.error = Date.now();
timings.phases.total = timings.error - timings.start;
origin.emit = emit;
}
// Saves the original behavior
return emit(event, ...args);
};
};
let uploadFinished = false;
const onUpload = () => {
timings.upload = Date.now();
timings.phases.request = timings.upload - timings.connect;
};
handleError(request);
request.once('socket', socket => {
timings.socket = Date.now();
timings.phases.wait = timings.socket - timings.start;
const lookupListener = () => {
timings.lookup = Date.now();
timings.phases.dns = timings.lookup - timings.socket;
};
socket.once('lookup', lookupListener);
deferToConnect(socket, () => {
timings.connect = Date.now();
if (timings.lookup === null) {
socket.removeListener('lookup', lookupListener);
timings.lookup = timings.connect;
timings.phases.dns = timings.lookup - timings.socket;
}
timings.phases.tcp = timings.connect - timings.lookup;
if (uploadFinished && !timings.upload) {
onUpload();
}
});
});
request.once('finish', () => {
uploadFinished = true;
if (timings.connect) {
onUpload();
}
});
request.once('response', response => {
timings.response = Date.now();
timings.phases.firstByte = timings.response - timings.upload;
handleError(response);
response.once('end', () => {
timings.end = Date.now();
timings.phases.download = timings.end - timings.response;
timings.phases.total = timings.end - timings.start;
});
});
return timings;
};
../../_readable-stream@2.3.7@readable-stream
\ No newline at end of file
../../_url-to-options@1.0.1@url-to-options
\ No newline at end of file
../../_escape-string-regexp@1.0.5@escape-string-regexp
\ No newline at end of file
../../_escape-string-regexp@1.0.5@escape-string-regexp
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment