-
-
Notifications
You must be signed in to change notification settings - Fork 376
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
1 parent
8db8794
commit e9407b7
Showing
38 changed files
with
8,448 additions
and
1,607 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,9 +1,13 @@ | ||
root = true | ||
# editorconfig.org | ||
|
||
[*.js] | ||
indent_style=tab | ||
trim_trailing_whitespace=true | ||
|
||
[*.yml,package.json] | ||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[.md] | ||
insert_final_newline = false | ||
trim_trailing_whitespace = 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 |
---|---|---|
@@ -1,54 +1,15 @@ | ||
{ | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
"rules": { | ||
"indent": [2, "tab", { "SwitchCase": 1 }], | ||
"brace-style": ["error", "1tbs"], | ||
"quotes": ["error", "double"], | ||
"semi": "error", | ||
"no-eval": "error", | ||
"eol-last": "error", | ||
"no-redeclare": "error", | ||
"no-extra-bind": "error", | ||
"no-process-exit": "error", | ||
"no-inner-declarations": "warn", | ||
"no-loop-func": "warn", | ||
"no-undef": "error", | ||
"no-trailing-spaces": "error", | ||
"space-before-function-paren": ["error", "never"], | ||
"no-multi-spaces": "error", | ||
"space-in-parens": "error", | ||
"space-before-blocks": "error", | ||
"no-unused-vars": "error", | ||
"no-dupe-keys": "error", | ||
"valid-typeof": "error", | ||
"object-curly-spacing": ["error", "always"], | ||
"key-spacing": "error", | ||
"space-infix-ops": "error", | ||
"no-negated-in-lhs": "error", | ||
"no-octal": "error", | ||
"no-regex-spaces": "error", | ||
"no-self-assign": "error", | ||
"no-sparse-arrays": "error", | ||
"no-unexpected-multiline": "error", | ||
"no-unreachable": "error", | ||
"no-extra-semi": "error", | ||
"no-func-assign": "error", | ||
"no-invalid-regexp": "error", | ||
"keyword-spacing": ["error", { | ||
"after": false, | ||
"overrides": { | ||
"try": {"after": true}, | ||
"else": {"after": true}, | ||
"throw": {"after": true}, | ||
"case": {"after": true}, | ||
"return": {"after": true}, | ||
"finally": {"after": true}, | ||
"do": {"after": true} | ||
} | ||
}] | ||
} | ||
"extends": "webpack", | ||
"parserOptions": { | ||
"sourceType": "script" | ||
}, | ||
"rules": { | ||
"brace-style": ["error", "1tbs", { allowSingleLine: false }], | ||
"comma-dangle": ["error", "never"], | ||
"curly": ["error"], | ||
"consistent-return": "off", | ||
"no-param-reassign": "off", | ||
"no-undefined": "off", | ||
"strict": ["error", "safe"] | ||
} | ||
} |
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,2 +1,2 @@ | ||
/node_modules | ||
/coverage | ||
node_modules | ||
coverage |
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,11 +1,14 @@ | ||
sudo: false | ||
language: node_js | ||
|
||
node_js: | ||
- "4" | ||
- "6" | ||
- "7" | ||
- "8" | ||
script: npm run travis | ||
- '9' | ||
- '8' | ||
- '6' | ||
|
||
script: | ||
npm run ci | ||
|
||
after_success: | ||
- cat ./coverage/coverage.json | node_modules/codecov.io/bin/codecov.io.js | ||
- rm -rf ./coverage |
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,18 @@ | ||
## Node Version Support | ||
|
||
webpack-dev-middleware version 2 and higher will only support Node 6.x and higher. Active | ||
LTS for Node 4.x ended October 31st, 2017 and entered maintenance on that date. | ||
Likewise, the version 1.x branch of webpack-dev-middleware will enter maintenance on | ||
that date. | ||
|
||
## Informative Changes | ||
|
||
- logging is now handled by `log-level` and follows the same patterns as | ||
`webpack-dev-server`. | ||
|
||
## Breaking Changes | ||
|
||
- `reportTime` option renamed to `logTime` | ||
- `noInfo` option removed in favor of setting a `logLevel` higher than `'info'` | ||
- `quiet` option removed in favor of `logLevel: 'silent'` | ||
- `reporter` signature changed to `reporter(middlewareOptions, reporterOptions)` |
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,95 @@ | ||
'use strict'; | ||
|
||
const mime = require('mime'); | ||
const createContext = require('./lib/context'); | ||
const middleware = require('./lib/middleware'); | ||
const reporter = require('./lib/reporter'); | ||
const { getFilenameFromUrl, noop, ready, setFs } = require('./lib/util'); | ||
|
||
require('loud-rejection/register'); | ||
|
||
const defaults = { | ||
logLevel: 'info', | ||
logTime: false, | ||
logger: null, | ||
mimeTypes: null, | ||
reporter, | ||
stats: { | ||
context: process.cwd() | ||
}, | ||
watchOptions: { | ||
aggregateTimeout: 200 | ||
} | ||
}; | ||
|
||
module.exports = function wdm(compiler, opts) { | ||
const options = Object.assign({}, defaults, opts); | ||
|
||
if (options.lazy) { | ||
if (typeof options.filename === 'string') { | ||
const filename = options.filename | ||
.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&') // eslint-disable-line no-useless-escape | ||
.replace(/\\\[[a-z]+\\\]/ig, '.+'); | ||
|
||
options.filename = new RegExp(`^[/]{0,1}${filename}$`); | ||
} | ||
} | ||
|
||
// defining custom MIME type | ||
if (options.mimeTypes) { | ||
mime.define(options.mimeTypes); | ||
} | ||
|
||
const context = createContext(compiler, options); | ||
|
||
// start watching | ||
if (!options.lazy) { | ||
const watching = compiler.watch(options.watchOptions, (err) => { | ||
if (err) { | ||
context.log.error(err.stack || err); | ||
if (err.details) { | ||
context.log.error(err.details); | ||
} | ||
} | ||
}); | ||
|
||
context.watching = watching; | ||
} else { | ||
context.state = true; | ||
} | ||
|
||
setFs(context, compiler); | ||
|
||
return Object.assign(middleware(context), { | ||
close(callback) { | ||
callback = callback || noop; | ||
|
||
if (context.watching) { | ||
context.watching.close(callback); | ||
} else { | ||
callback(); | ||
} | ||
}, | ||
|
||
context, | ||
|
||
fileSystem: context.fs, | ||
|
||
getFilenameFromUrl: getFilenameFromUrl.bind(this, context.options.publicPath, context.compiler), | ||
|
||
invalidate(callback) { | ||
callback = callback || noop; | ||
if (context.watching) { | ||
ready(context, callback, {}); | ||
context.watching.invalidate(); | ||
} else { | ||
callback(); | ||
} | ||
}, | ||
|
||
waitUntilValid(callback) { | ||
callback = callback || noop; | ||
ready(context, callback, {}); | ||
} | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.