aboutsummaryrefslogtreecommitdiff
path: root/node_modules/time-fix-plugin
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/time-fix-plugin
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/time-fix-plugin')
-rw-r--r--node_modules/time-fix-plugin/LICENSE21
-rw-r--r--node_modules/time-fix-plugin/README.md55
-rw-r--r--node_modules/time-fix-plugin/index.js32
l---------node_modules/time-fix-plugin/node_modules/.bin/webpack1
-rw-r--r--node_modules/time-fix-plugin/package.json33
5 files changed, 142 insertions, 0 deletions
diff --git a/node_modules/time-fix-plugin/LICENSE b/node_modules/time-fix-plugin/LICENSE
new file mode 100644
index 00000000..0fa9bb51
--- /dev/null
+++ b/node_modules/time-fix-plugin/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) EGOIST <0x142857@gmail.com> (https://github.com/egoist)
+
+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.
diff --git a/node_modules/time-fix-plugin/README.md b/node_modules/time-fix-plugin/README.md
new file mode 100644
index 00000000..20ffe049
--- /dev/null
+++ b/node_modules/time-fix-plugin/README.md
@@ -0,0 +1,55 @@
+
+# time-fix-plugin
+
+[![NPM version](https://img.shields.io/npm/v/time-fix-plugin.svg?style=flat)](https://npmjs.com/package/time-fix-plugin) [![NPM downloads](https://img.shields.io/npm/dm/time-fix-plugin.svg?style=flat)](https://npmjs.com/package/time-fix-plugin) [![CircleCI](https://circleci.com/gh/egoist/time-fix-plugin/tree/master.svg?style=shield)](https://circleci.com/gh/egoist/time-fix-plugin/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) [![chat](https://img.shields.io/badge/chat-on%20discord-7289DA.svg?style=flat)](https://chat.egoist.moe)
+
+Why? https://github.com/webpack/watchpack/issues/25
+
+## Install
+
+
+```bash
+npm i time-fix-plugin
+```
+
+This is for webpack v4 and above, for lower version please use `time-fix-plugin@1`.
+
+## Usage
+
+```js
+// webpack.config.js
+const TimeFixPlugin = require('time-fix-plugin')
+
+module.exports = {
+ plugins: [
+ new TimeFixPlugin(),
+ // ...other plugins
+ ]
+}
+```
+
+## Development
+
+```bash
+# without timefix
+node example/run
+
+# with timefix
+node example/run --timefix
+```
+
+## Contributing
+
+1. Fork it!
+2. Create your feature branch: `git checkout -b my-new-feature`
+3. Commit your changes: `git commit -am 'Add some feature'`
+4. Push to the branch: `git push origin my-new-feature`
+5. Submit a pull request :D
+
+
+## Author
+
+**time-fix-plugin** © [EGOIST](https://github.com/egoist), Released under the [MIT](./LICENSE) License.<br>
+Authored and maintained by EGOIST with help from contributors ([list](https://github.com/egoist/time-fix-plugin/contributors)).
+
+> [github.com/egoist](https://github.com/egoist) · GitHub [@EGOIST](https://github.com/egoist) · Twitter [@_egoistlily](https://twitter.com/_egoistlily)
diff --git a/node_modules/time-fix-plugin/index.js b/node_modules/time-fix-plugin/index.js
new file mode 100644
index 00000000..4b7eb0f0
--- /dev/null
+++ b/node_modules/time-fix-plugin/index.js
@@ -0,0 +1,32 @@
+module.exports = class TimeFixPlugin {
+ constructor(watchOffset = 11000) {
+ this.watchOffset = watchOffset
+ }
+
+ apply(compiler) {
+ const context = this
+ const watch = compiler.watch
+ let watching
+
+ // Modify the time for first run
+ compiler.watch = function () {
+ watching = watch.apply(this, arguments)
+ watching.startTime += context.watchOffset
+ return watching
+ }
+
+ // Modify the time for subsequent runs
+ compiler.hooks.watchRun.tap('time-fix-plugin', () => {
+ if (watching) {
+ watching.startTime += this.watchOffset
+ }
+ })
+
+ // Reset time
+ compiler.hooks.done.tap('time-fix-plugin', stats => {
+ if (watching) {
+ stats.startTime -= this.watchOffset
+ }
+ })
+ }
+}
diff --git a/node_modules/time-fix-plugin/node_modules/.bin/webpack b/node_modules/time-fix-plugin/node_modules/.bin/webpack
new file mode 120000
index 00000000..8a1900f6
--- /dev/null
+++ b/node_modules/time-fix-plugin/node_modules/.bin/webpack
@@ -0,0 +1 @@
+../../../webpack/bin/webpack.js \ No newline at end of file
diff --git a/node_modules/time-fix-plugin/package.json b/node_modules/time-fix-plugin/package.json
new file mode 100644
index 00000000..a606d2e4
--- /dev/null
+++ b/node_modules/time-fix-plugin/package.json
@@ -0,0 +1,33 @@
+{
+ "name": "time-fix-plugin",
+ "version": "2.0.5",
+ "description": "Fix startTime for webpack watcher",
+ "repository": {
+ "url": "egoist/time-fix-plugin",
+ "type": "git"
+ },
+ "main": "index.js",
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "test": "npm run lint && echo 'no tests!'",
+ "lint": "xo"
+ },
+ "author": "egoist <0x142857@gmail.com>",
+ "license": "MIT",
+ "peerDependencies": {
+ "webpack": ">=4.0.0"
+ },
+ "devDependencies": {
+ "eslint-config-rem": "^3.0.0",
+ "webpack": "^4.0.1",
+ "xo": "^0.18.0"
+ },
+ "xo": {
+ "extends": "rem",
+ "ignores": [
+ "example/**"
+ ]
+ }
+}