Conexio amb la api
This commit is contained in:
parent
207c0ba819
commit
b12369cb47
48513 changed files with 7391639 additions and 7 deletions
374
node_modules/webpack-dev-server/CHANGELOG.md
generated
vendored
Executable file
374
node_modules/webpack-dev-server/CHANGELOG.md
generated
vendored
Executable file
|
|
@ -0,0 +1,374 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [3.11.2](https://github.com/webpack/webpack-dev-server/compare/v3.11.1...v3.11.2) (2021-01-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* cli arguments for `serve` command ([a5fe337](https://github.com/webpack/webpack-dev-server/commit/a5fe3372e306e3c90a5e63e452e3e9ee9a745875))
|
||||
|
||||
### [3.11.1](https://github.com/webpack/webpack-dev-server/compare/v3.11.0...v3.11.1) (2020-12-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* the `open` option works using `webpack serve` without value ([#2948](https://github.com/webpack/webpack-dev-server/issues/2948)) ([4837dc9](https://github.com/webpack/webpack-dev-server/commit/4837dc92b944f8b4cdd7d6e3420367cf338e7f75))
|
||||
* vulnerable deps ([#2949](https://github.com/webpack/webpack-dev-server/issues/2949)) ([78dde50](https://github.com/webpack/webpack-dev-server/commit/78dde50f520c8b78de14272a4ae4cee1281bf2e3))
|
||||
|
||||
## [3.11.0](https://github.com/webpack/webpack-dev-server/compare/v3.10.3...v3.11.0) (2020-05-08)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add icons for directory viewer ([#2441](https://github.com/webpack/webpack-dev-server/issues/2441)) ([e953d01](https://github.com/webpack/webpack-dev-server/commit/e953d01ca93764dabe38cedad8e7b9ef4e7f04bc))
|
||||
* allow multiple `contentBasePublicPath` paths ([#2489](https://github.com/webpack/webpack-dev-server/issues/2489)) ([c6bdfe4](https://github.com/webpack/webpack-dev-server/commit/c6bdfe4afb2ce3612c02142954c68a8e657c3915))
|
||||
* emit progress-update ([#2498](https://github.com/webpack/webpack-dev-server/issues/2498)) ([4808abd](https://github.com/webpack/webpack-dev-server/commit/4808abd434bac0511da688aee861f7e2d8b0c81c)), closes [#1666](https://github.com/webpack/webpack-dev-server/issues/1666)
|
||||
* add invalidate endpoint ([#2493](https://github.com/webpack/webpack-dev-server/issues/2493)) ([89ffb86](https://github.com/webpack/webpack-dev-server/commit/89ffb86cd26425c59e3937ca06a2c804a01b8f1d))
|
||||
* allow open option to accept an object ([#2492](https://github.com/webpack/webpack-dev-server/issues/2492)) ([adeb92e](https://github.com/webpack/webpack-dev-server/commit/adeb92e1e37551a6cbf3063942d6c2c7efbdff10))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* do not swallow errors from server ([#2512](https://github.com/webpack/webpack-dev-server/issues/2512)) ([06583f2](https://github.com/webpack/webpack-dev-server/commit/06583f268b70f4a9715e4b747b1557055c419086))
|
||||
* security vulnerability in yargs-parser ([#2566](https://github.com/webpack/webpack-dev-server/issues/2566)) ([41d1d0c](https://github.com/webpack/webpack-dev-server/commit/41d1d0cf99f53df0569991a85489d3c8bc095af5))
|
||||
* don't crash on setupExitSignals(undefined) ([#2507](https://github.com/webpack/webpack-dev-server/issues/2507)) ([0d5c681](https://github.com/webpack/webpack-dev-server/commit/0d5c68143d780e631cdaf09081822fc87d7cb3ba))
|
||||
* support entry descriptor (closes [#2453](https://github.com/webpack/webpack-dev-server/issues/2453)) ([#2465](https://github.com/webpack/webpack-dev-server/issues/2465)) ([8bbef6a](https://github.com/webpack/webpack-dev-server/commit/8bbef6adf6ae5f6a3109ecd4a6246223d2f77cb2))
|
||||
* update jquery ([#2516](https://github.com/webpack/webpack-dev-server/issues/2516)) ([99ccfd8](https://github.com/webpack/webpack-dev-server/commit/99ccfd84d1db566aa4ed77c441c4674bc4e986df))
|
||||
|
||||
### [3.10.3](https://github.com/webpack/webpack-dev-server/compare/v3.10.2...v3.10.3) (2020-02-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* forward error requests to the proxy ([#2425](https://github.com/webpack/webpack-dev-server/issues/2425)) ([e291cd4](https://github.com/webpack/webpack-dev-server/commit/e291cd4922f66c5c69dfd1fd3839812cfa502de5))
|
||||
|
||||
### [3.10.2](https://github.com/webpack/webpack-dev-server/compare/v3.10.0...v3.10.2) (2020-01-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fallthrough non `GET` and `HEAD` request to routes ([#2374](https://github.com/webpack/webpack-dev-server/issues/2374)) ([ebe8eca](https://github.com/webpack/webpack-dev-server/commit/ebe8eca37957a9009f8627e7dfb82699606846de))
|
||||
* add an optional peer dependency on webpack-cli ([#2396](https://github.com/webpack/webpack-dev-server/issues/2396)) ([aa365df](https://github.com/webpack/webpack-dev-server/commit/aa365dfd7e86c5dca31304bd5dcfe9bb9b767b40))
|
||||
* add heartbeat for the websocket server ([#2404](https://github.com/webpack/webpack-dev-server/issues/2404)) ([1a7c827](https://github.com/webpack/webpack-dev-server/commit/1a7c8273de5a5b164c63c9919950babd7ecfaadb))
|
||||
|
||||
### [3.10.1](https://github.com/webpack/webpack-dev-server/compare/v3.10.0...v3.10.1) (2019-12-19)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* ie11 compatibility ([1306abe](https://github.com/webpack/webpack-dev-server/commit/1306abeb8c5fd125952cdc177fdf38c2c31b3c4f))
|
||||
|
||||
## [3.10.0](https://github.com/webpack/webpack-dev-server/compare/v3.9.0...v3.10.0) (2019-12-18)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **client:** allow sock port to use location's port (`sockPort: 'location'`) ([#2341](https://github.com/webpack/webpack-dev-server/issues/2341)) ([dc10d06](https://github.com/webpack/webpack-dev-server/commit/dc10d0647413ad57814b684b5f6ef3659531f0f6))
|
||||
* **server:** add `contentBasePublicPath` option ([#2150](https://github.com/webpack/webpack-dev-server/issues/2150)) ([cee700d](https://github.com/webpack/webpack-dev-server/commit/cee700d59aff644a499ee310c4a32d5c5693e559))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **client:** don't override protocol for socket connection to 127.0.0.1 ([#2303](https://github.com/webpack/webpack-dev-server/issues/2303)) ([3a31917](https://github.com/webpack/webpack-dev-server/commit/3a31917a02818dabb3dc549e3e4994618475d131)), closes [#2302](https://github.com/webpack/webpack-dev-server/issues/2302)
|
||||
* **server:** respect sockPath on transportMode: 'ws' ([#2310](https://github.com/webpack/webpack-dev-server/issues/2310)) ([#2311](https://github.com/webpack/webpack-dev-server/issues/2311)) ([e188542](https://github.com/webpack/webpack-dev-server/commit/e188542d888dbb55be64c9da2f747343b73c319f))
|
||||
* https on chrome linux ([#2330](https://github.com/webpack/webpack-dev-server/issues/2330)) ([dc8b475](https://github.com/webpack/webpack-dev-server/commit/dc8b47510e24649edb38e5a07579be389898189e))
|
||||
* support webpack@5 ([#2359](https://github.com/webpack/webpack-dev-server/issues/2359)) ([8f89c01](https://github.com/webpack/webpack-dev-server/commit/8f89c0188579a419dc68021f8bc0fbeae70cbe5d))
|
||||
|
||||
## [3.9.0](https://github.com/webpack/webpack-dev-server/compare/v3.8.2...v3.9.0) (2019-10-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add `hostname` and `port` to bonjour name to prevent name collisions ([#2276](https://github.com/webpack/webpack-dev-server/issues/2276)) ([d8af2d9](https://github.com/webpack/webpack-dev-server/commit/d8af2d9))
|
||||
* add `extKeyUsage` to self-signed cert ([#2274](https://github.com/webpack/webpack-dev-server/issues/2274)) ([a4dbc3b](https://github.com/webpack/webpack-dev-server/commit/a4dbc3b))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add multiple `openPage` support ([#2266](https://github.com/webpack/webpack-dev-server/issues/2266)) ([c9e9178](https://github.com/webpack/webpack-dev-server/commit/c9e9178))
|
||||
|
||||
### [3.8.2](https://github.com/webpack/webpack-dev-server/compare/v3.8.1...v3.8.2) (2019-10-02)
|
||||
|
||||
### Security
|
||||
|
||||
* update `selfsigned` package
|
||||
|
||||
### [3.8.1](https://github.com/webpack/webpack-dev-server/compare/v3.8.0...v3.8.1) (2019-09-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add null check for connection.headers ([#2200](https://github.com/webpack/webpack-dev-server/issues/2200)) ([7964997](https://github.com/webpack/webpack-dev-server/commit/7964997))
|
||||
* false positive for an absolute path in the `ContentBase` option on windows ([#2202](https://github.com/webpack/webpack-dev-server/issues/2202)) ([68ecf78](https://github.com/webpack/webpack-dev-server/commit/68ecf78))
|
||||
* add status in quiet log level ([#2235](https://github.com/webpack/webpack-dev-server/issues/2235)) ([7e2224e](https://github.com/webpack/webpack-dev-server/commit/7e2224e))
|
||||
* scriptHost in client ([#2246](https://github.com/webpack/webpack-dev-server/issues/2246)) ([00903f6](https://github.com/webpack/webpack-dev-server/commit/00903f6))
|
||||
|
||||
## [3.8.0](https://github.com/webpack/webpack-dev-server/compare/v3.7.2...v3.8.0) (2019-08-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **server:** fix setupExitSignals usage ([#2181](https://github.com/webpack/webpack-dev-server/issues/2181)) ([bbe410e](https://github.com/webpack/webpack-dev-server/commit/bbe410e))
|
||||
* **server:** set port before instantiating server ([#2143](https://github.com/webpack/webpack-dev-server/issues/2143)) ([cfbf229](https://github.com/webpack/webpack-dev-server/commit/cfbf229))
|
||||
* check for name of HotModuleReplacementPlugin to avoid RangeError ([#2146](https://github.com/webpack/webpack-dev-server/issues/2146)) ([4579775](https://github.com/webpack/webpack-dev-server/commit/4579775))
|
||||
* **server:** check for external urls in array ([#1980](https://github.com/webpack/webpack-dev-server/issues/1980)) ([fa78347](https://github.com/webpack/webpack-dev-server/commit/fa78347))
|
||||
* **server:** fix header check for socket server ([#2077](https://github.com/webpack/webpack-dev-server/issues/2077)) ([7f51859](https://github.com/webpack/webpack-dev-server/commit/7f51859))
|
||||
* **server:** stricter headers security check ([#2092](https://github.com/webpack/webpack-dev-server/issues/2092)) ([078ddca](https://github.com/webpack/webpack-dev-server/commit/078ddca))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **server:** add transportMode ([#2116](https://github.com/webpack/webpack-dev-server/issues/2116)) ([b5b9cb4](https://github.com/webpack/webpack-dev-server/commit/b5b9cb4))
|
||||
* **server:** serverMode 'ws' option ([#2082](https://github.com/webpack/webpack-dev-server/issues/2082)) ([04483f4](https://github.com/webpack/webpack-dev-server/commit/04483f4))
|
||||
* **server/client:** made progress option available to API ([#1961](https://github.com/webpack/webpack-dev-server/issues/1961)) ([56274e4](https://github.com/webpack/webpack-dev-server/commit/56274e4))
|
||||
|
||||
### Potential Breaking changes
|
||||
|
||||
We have migrated `serverMode` and `clientMode` to `transportMode` as an experimental option. If you want to use this feature, you have to change your settings.
|
||||
|
||||
Related PR: https://github.com/webpack/webpack-dev-server/pull/2116
|
||||
|
||||
|
||||
### [3.7.2](https://github.com/webpack/webpack-dev-server/compare/v3.7.1...v3.7.2) (2019-06-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **client:** add default fallback for client ([#2015](https://github.com/webpack/webpack-dev-server/issues/2015)) ([d26b444](https://github.com/webpack/webpack-dev-server/commit/d26b444))
|
||||
* **open:** set `wait: false` to run server.close successfully ([#2001](https://github.com/webpack/webpack-dev-server/issues/2001)) ([2b4cb52](https://github.com/webpack/webpack-dev-server/commit/2b4cb52))
|
||||
* **test:** fixed ProvidePlugin.test.js ([#2002](https://github.com/webpack/webpack-dev-server/issues/2002)) ([47453cb](https://github.com/webpack/webpack-dev-server/commit/47453cb))
|
||||
|
||||
|
||||
|
||||
### [3.7.1](https://github.com/webpack/webpack-dev-server/compare/v3.7.0...v3.7.1) (2019-06-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* retry finding port when port is null and get ports in sequence ([#1993](https://github.com/webpack/webpack-dev-server/issues/1993)) ([bc57514](https://github.com/webpack/webpack-dev-server/commit/bc57514))
|
||||
|
||||
|
||||
|
||||
## [3.7.0](https://github.com/webpack/webpack-dev-server/compare/v3.6.0...v3.7.0) (2019-06-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* change clientLogLevel order to be called first ([#1973](https://github.com/webpack/webpack-dev-server/issues/1973)) ([57c8c92](https://github.com/webpack/webpack-dev-server/commit/57c8c92))
|
||||
* es6 syntax in client ([#1982](https://github.com/webpack/webpack-dev-server/issues/1982)) ([802aa30](https://github.com/webpack/webpack-dev-server/commit/802aa30))
|
||||
|
||||
|
||||
|
||||
## [3.6.0](https://github.com/webpack/webpack-dev-server/compare/v3.5.1...v3.6.0) (2019-06-05)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **config:** enable `--overlay` ([#1968](https://github.com/webpack/webpack-dev-server/issues/1968)) ([dc81e23](https://github.com/webpack/webpack-dev-server/commit/dc81e23))
|
||||
* **server:** don't ignore node_modules by default ([#1970](https://github.com/webpack/webpack-dev-server/issues/1970)) ([699f8b4](https://github.com/webpack/webpack-dev-server/commit/699f8b4)), closes [#1794](https://github.com/webpack/webpack-dev-server/issues/1794)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **server:** add serverMode option ([#1937](https://github.com/webpack/webpack-dev-server/issues/1937)) ([44a8cde](https://github.com/webpack/webpack-dev-server/commit/44a8cde))
|
||||
|
||||
|
||||
|
||||
### [3.5.1](https://github.com/webpack/webpack-dev-server/compare/v3.5.0...v3.5.1) (2019-06-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* allow passing promise function of webpack.config.js ([#1947](https://github.com/webpack/webpack-dev-server/issues/1947)) ([8cf1053](https://github.com/webpack/webpack-dev-server/commit/8cf1053))
|
||||
|
||||
|
||||
|
||||
## [3.5.0](https://github.com/webpack/webpack-dev-server/compare/v3.4.1...v3.5.0) (2019-05-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add client code for `electron-renderer` target ([#1935](https://github.com/webpack/webpack-dev-server/issues/1935)) ([9297988](https://github.com/webpack/webpack-dev-server/commit/9297988))
|
||||
* add client code for `node-webkit` target ([#1942](https://github.com/webpack/webpack-dev-server/issues/1942)) ([c6b2b1f](https://github.com/webpack/webpack-dev-server/commit/c6b2b1f))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **server:** `onListening` option ([#1930](https://github.com/webpack/webpack-dev-server/issues/1930)) ([61d0cdf](https://github.com/webpack/webpack-dev-server/commit/61d0cdf))
|
||||
* **server:** add callback support for invalidate ([#1900](https://github.com/webpack/webpack-dev-server/issues/1900)) ([cd218ef](https://github.com/webpack/webpack-dev-server/commit/cd218ef))
|
||||
* **server:** add `WEBPACK_DEV_SERVER` env variable ([#1929](https://github.com/webpack/webpack-dev-server/issues/1929)) ([856169e](https://github.com/webpack/webpack-dev-server/commit/856169e))
|
||||
|
||||
|
||||
|
||||
### [3.4.1](https://github.com/webpack/webpack-dev-server/compare/v3.4.0...v3.4.1) (2019-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add none and warning to clientLogLevel ([#1901](https://github.com/webpack/webpack-dev-server/issues/1901)) ([0ae9be8](https://github.com/webpack/webpack-dev-server/commit/0ae9be8))
|
||||
* broken hot reload ([#1903](https://github.com/webpack/webpack-dev-server/issues/1903)) ([6a444cd](https://github.com/webpack/webpack-dev-server/commit/6a444cd))
|
||||
|
||||
|
||||
|
||||
## [3.4.0](https://github.com/webpack/webpack-dev-server/compare/v3.3.1...v3.4.0) (2019-05-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't use self.location.port ([#1838](https://github.com/webpack/webpack-dev-server/issues/1838)) ([6d31984](https://github.com/webpack/webpack-dev-server/commit/6d31984))
|
||||
* do not include config files in dist ([#1883](https://github.com/webpack/webpack-dev-server/issues/1883)) ([c535bb2](https://github.com/webpack/webpack-dev-server/commit/c535bb2))
|
||||
* only add client entry to web targets ([#1775](https://github.com/webpack/webpack-dev-server/issues/1775)) ([cf4d0d0](https://github.com/webpack/webpack-dev-server/commit/cf4d0d0))
|
||||
* update clientLogLevel to match docs and error ([#1825](https://github.com/webpack/webpack-dev-server/issues/1825)) ([7f52bbf](https://github.com/webpack/webpack-dev-server/commit/7f52bbf))
|
||||
* add errors-warnings preset ([#1895](https://github.com/webpack/webpack-dev-server/issues/1895)) ([2a81ad2](https://github.com/webpack/webpack-dev-server/commit/2a81ad2))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* added injectClient option ([#1775](https://github.com/webpack/webpack-dev-server/issues/1775)) ([cf4d0d0](https://github.com/webpack/webpack-dev-server/commit/cf4d0d0))
|
||||
* added injectHot option ([#1775](https://github.com/webpack/webpack-dev-server/issues/1775)) ([cf4d0d0](https://github.com/webpack/webpack-dev-server/commit/cf4d0d0))
|
||||
* added sockPort option ([#1792](https://github.com/webpack/webpack-dev-server/issues/1792)) ([58d1682](https://github.com/webpack/webpack-dev-server/commit/58d1682))
|
||||
* added sockHost option ([#1858](https://github.com/webpack/webpack-dev-server/issues/1858)) ([f47dff2](https://github.com/webpack/webpack-dev-server/commit/f47dff2))
|
||||
* support HEAD method ([#1875](https://github.com/webpack/webpack-dev-server/issues/1875)) ([c2360e4](https://github.com/webpack/webpack-dev-server/commit/c2360e4))
|
||||
* added liveReload option ([#1889](https://github.com/webpack/webpack-dev-server/issues/1889)) ([fc4fe32](https://github.com/webpack/webpack-dev-server/commit/fc4fe32))
|
||||
* update express to 4.17 version
|
||||
|
||||
|
||||
## [3.3.1](https://github.com/webpack/webpack-dev-server/compare/v3.3.0...v3.3.1) (2019-04-09)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **regression:** always get necessary stats for hmr ([#1780](https://github.com/webpack/webpack-dev-server/issues/1780)) ([66b04a9](https://github.com/webpack/webpack-dev-server/commit/66b04a9))
|
||||
* **regression:** host and port can be undefined or null ([#1779](https://github.com/webpack/webpack-dev-server/issues/1779)) ([028ceee](https://github.com/webpack/webpack-dev-server/commit/028ceee))
|
||||
* only add entries after compilers have been created ([#1774](https://github.com/webpack/webpack-dev-server/issues/1774)) ([b31cbaa](https://github.com/webpack/webpack-dev-server/commit/b31cbaa))
|
||||
|
||||
|
||||
|
||||
# [3.3.0](https://github.com/webpack/webpack-dev-server/compare/v3.2.1...v3.3.0) (2019-04-08)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* compatibility with webpack-cli@3.3 ([#1754](https://github.com/webpack/webpack-dev-server/issues/1754)) ([fd7cb0d](https://github.com/webpack/webpack-dev-server/commit/fd7cb0d))
|
||||
* ignore proxy when bypass return false ([#1696](https://github.com/webpack/webpack-dev-server/issues/1696)) ([aa7de77](https://github.com/webpack/webpack-dev-server/commit/aa7de77))
|
||||
* respect stats option from webpack config ([#1665](https://github.com/webpack/webpack-dev-server/issues/1665)) ([efaa740](https://github.com/webpack/webpack-dev-server/commit/efaa740))
|
||||
* use location.port when location.hostname is used to infer HMR socket URL ([#1664](https://github.com/webpack/webpack-dev-server/issues/1664)) ([2f7f052](https://github.com/webpack/webpack-dev-server/commit/2f7f052))
|
||||
* don't crash with express.static.mime.types ([#1765](https://github.com/webpack/webpack-dev-server/issues/1765)) ([919ff77](https://github.com/webpack/webpack-dev-server/commit/919ff77))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add option "serveIndex" to enable/disable serveIndex middleware ([#1752](https://github.com/webpack/webpack-dev-server/issues/1752)) ([d5d60cb](https://github.com/webpack/webpack-dev-server/commit/d5d60cb))
|
||||
* add webpack as argument to before and after options ([#1760](https://github.com/webpack/webpack-dev-server/issues/1760)) ([0984d4b](https://github.com/webpack/webpack-dev-server/commit/0984d4b))
|
||||
* http2 option to enable/disable HTTP/2 with HTTPS ([#1721](https://github.com/webpack/webpack-dev-server/issues/1721)) ([dcd2434](https://github.com/webpack/webpack-dev-server/commit/dcd2434))
|
||||
* random port retry logic ([#1692](https://github.com/webpack/webpack-dev-server/issues/1692)) ([419f02e](https://github.com/webpack/webpack-dev-server/commit/419f02e))
|
||||
* relax depth limit from chokidar for content base ([#1697](https://github.com/webpack/webpack-dev-server/issues/1697)) ([7ea9ab9](https://github.com/webpack/webpack-dev-server/commit/7ea9ab9))
|
||||
|
||||
|
||||
|
||||
## [3.2.1](https://github.com/webpack/webpack-dev-server/compare/v3.2.0...v3.2.1) (2019-02-25)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* deprecation message about `setup` now warning about `v4` ([#1684](https://github.com/webpack/webpack-dev-server/issues/1684)) ([523a6ec](https://github.com/webpack/webpack-dev-server/commit/523a6ec))
|
||||
* **regression:** allow `ca`, `key` and `cert` will be string ([#1676](https://github.com/webpack/webpack-dev-server/issues/1676)) ([b8d5c1e](https://github.com/webpack/webpack-dev-server/commit/b8d5c1e))
|
||||
* **regression:** handle `key`, `cert`, `cacert` and `pfx` in CLI ([#1688](https://github.com/webpack/webpack-dev-server/issues/1688)) ([4b2076c](https://github.com/webpack/webpack-dev-server/commit/4b2076c))
|
||||
* **regression:** problem with `idb-connector` after update `internal-ip` ([#1691](https://github.com/webpack/webpack-dev-server/issues/1691)) ([eb48691](https://github.com/webpack/webpack-dev-server/commit/eb48691))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.14"></a>
|
||||
## [3.1.14](https://github.com/webpack/webpack-dev-server/compare/v3.1.13...v3.1.14) (2018-12-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add workaround for Origin header in sockjs ([#1608](https://github.com/webpack/webpack-dev-server/issues/1608)) ([1dfd4fb](https://github.com/webpack/webpack-dev-server/commit/1dfd4fb))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.13"></a>
|
||||
## [3.1.13](https://github.com/webpack/webpack-dev-server/compare/v3.1.12...v3.1.13) (2018-12-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* delete a comma for Node.js <= v7.x ([#1609](https://github.com/webpack/webpack-dev-server/issues/1609)) ([0bab1c0](https://github.com/webpack/webpack-dev-server/commit/0bab1c0))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.12"></a>
|
||||
## [3.1.12](https://github.com/webpack/webpack-dev-server/compare/v3.1.11...v3.1.12) (2018-12-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* regression in `checkHost` for checking Origin header ([#1606](https://github.com/webpack/webpack-dev-server/issues/1606)) ([8bb3ca8](https://github.com/webpack/webpack-dev-server/commit/8bb3ca8))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.11"></a>
|
||||
## [3.1.11](https://github.com/webpack/webpack-dev-server/compare/v3.1.10...v3.1.11) (2018-12-21)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bin/options:** correct check for color support (`options.color`) ([#1555](https://github.com/webpack/webpack-dev-server/issues/1555)) ([55398b5](https://github.com/webpack/webpack-dev-server/commit/55398b5))
|
||||
* **package:** update `spdy` v3.4.1...4.0.0 (assertion error) ([#1491](https://github.com/webpack/webpack-dev-server/issues/1491)) ([#1563](https://github.com/webpack/webpack-dev-server/issues/1563)) ([7a3a257](https://github.com/webpack/webpack-dev-server/commit/7a3a257))
|
||||
* **Server:** correct `node` version checks ([#1543](https://github.com/webpack/webpack-dev-server/issues/1543)) ([927a2b3](https://github.com/webpack/webpack-dev-server/commit/927a2b3))
|
||||
* **Server:** mime type for wasm in contentBase directory ([#1575](https://github.com/webpack/webpack-dev-server/issues/1575)) ([#1580](https://github.com/webpack/webpack-dev-server/issues/1580)) ([fadae5d](https://github.com/webpack/webpack-dev-server/commit/fadae5d))
|
||||
* add url for compatibility with webpack@5 ([#1598](https://github.com/webpack/webpack-dev-server/issues/1598)) ([#1599](https://github.com/webpack/webpack-dev-server/issues/1599)) ([68dd49a](https://github.com/webpack/webpack-dev-server/commit/68dd49a))
|
||||
* check origin header for websocket connection ([#1603](https://github.com/webpack/webpack-dev-server/issues/1603)) ([b3217ca](https://github.com/webpack/webpack-dev-server/commit/b3217ca))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.10"></a>
|
||||
## [3.1.10](https://github.com/webpack/webpack-dev-server/compare/v3.1.9...v3.1.10) (2018-10-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **options:** add `writeToDisk` option to schema ([#1520](https://github.com/webpack/webpack-dev-server/issues/1520)) ([d2f4902](https://github.com/webpack/webpack-dev-server/commit/d2f4902))
|
||||
* **package:** update `sockjs-client` v1.1.5...1.3.0 (`url-parse` vulnerability) ([#1537](https://github.com/webpack/webpack-dev-server/issues/1537)) ([e719959](https://github.com/webpack/webpack-dev-server/commit/e719959))
|
||||
* **Server:** set `tls.DEFAULT_ECDH_CURVE` to `'auto'` ([#1531](https://github.com/webpack/webpack-dev-server/issues/1531)) ([c12def3](https://github.com/webpack/webpack-dev-server/commit/c12def3))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.9"></a>
|
||||
## [3.1.9](https://github.com/webpack/webpack-dev-server/compare/v3.1.8...v3.1.9) (2018-09-24)
|
||||
|
||||
|
||||
|
||||
<a name="3.1.8"></a>
|
||||
## [3.1.8](https://github.com/webpack/webpack-dev-server/compare/v3.1.7...v3.1.8) (2018-09-06)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **package:** `yargs` security vulnerability (`dependencies`) ([#1492](https://github.com/webpack/webpack-dev-server/issues/1492)) ([8fb67c9](https://github.com/webpack/webpack-dev-server/commit/8fb67c9))
|
||||
* **utils/createLogger:** ensure `quiet` always takes precedence (`options.quiet`) ([#1486](https://github.com/webpack/webpack-dev-server/issues/1486)) ([7a6ca47](https://github.com/webpack/webpack-dev-server/commit/7a6ca47))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.7"></a>
|
||||
## [3.1.7](https://github.com/webpack/webpack-dev-server/compare/v3.1.6...v3.1.7) (2018-08-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Server:** don't use `spdy` on `node >= v10.0.0` ([#1451](https://github.com/webpack/webpack-dev-server/issues/1451)) ([8ab9eb6](https://github.com/webpack/webpack-dev-server/commit/8ab9eb6))
|
||||
|
||||
|
||||
|
||||
<a name="3.1.6"></a>
|
||||
## [3.1.6](https://github.com/webpack/webpack-dev-server/compare/v3.1.5...v3.1.6) (2018-08-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bin:** handle `process` signals correctly when the server isn't ready yet ([#1432](https://github.com/webpack/webpack-dev-server/issues/1432)) ([334c3a5](https://github.com/webpack/webpack-dev-server/commit/334c3a5))
|
||||
* **examples/cli:** correct template path in `open-page` example ([#1401](https://github.com/webpack/webpack-dev-server/issues/1401)) ([df30727](https://github.com/webpack/webpack-dev-server/commit/df30727))
|
||||
* **schema:** allow the `output` filename to be a `{Function}` ([#1409](https://github.com/webpack/webpack-dev-server/issues/1409)) ([e2220c4](https://github.com/webpack/webpack-dev-server/commit/e2220c4))
|
||||
20
node_modules/webpack-dev-server/LICENSE
generated
vendored
Executable file
20
node_modules/webpack-dev-server/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
Copyright JS Foundation and other contributors
|
||||
|
||||
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.
|
||||
163
node_modules/webpack-dev-server/README.md
generated
vendored
Executable file
163
node_modules/webpack-dev-server/README.md
generated
vendored
Executable file
|
|
@ -0,0 +1,163 @@
|
|||
<div align="center">
|
||||
<a href="https://github.com/webpack/webpack">
|
||||
<img width="200" height="200" src="https://webpack.js.org/assets/icon-square-big.svg">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
[![npm][npm]][npm-url]
|
||||
[![node][node]][node-url]
|
||||
[![deps][deps]][deps-url]
|
||||
[![tests][tests]][tests-url]
|
||||
[![coverage][cover]][cover-url]
|
||||
[![chat][chat]][chat-url]
|
||||
[![downloads][downloads]][npm-url]
|
||||
[![contributors][contributors]][contributors-url]
|
||||
|
||||
# webpack-dev-server
|
||||
|
||||
Use [webpack](https://webpack.js.org) with a development server that provides
|
||||
live reloading. This should be used for **development only**.
|
||||
|
||||
It uses [webpack-dev-middleware][middleware-url] under the hood, which provides
|
||||
fast in-memory access to the webpack assets.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Getting Started](#getting-started)
|
||||
- [Usage](#usage)
|
||||
- [With the CLI](#with-the-cli)
|
||||
- [With NPM Scripts](#with-npm-scripts)
|
||||
- [The Result](#the-result)
|
||||
- [Browser Support](#browser-support)
|
||||
- [Support](#support)
|
||||
- [Contributing](#contributing)
|
||||
- [Attribution](#attribution)
|
||||
- [License](#license)
|
||||
|
||||
## Getting Started
|
||||
|
||||
First things first, install the module:
|
||||
|
||||
```console
|
||||
npm install webpack-dev-server --save-dev
|
||||
```
|
||||
|
||||
_Note: While you can install and run webpack-dev-server globally, we recommend
|
||||
installing it locally. webpack-dev-server will always use a local installation
|
||||
over a global one._
|
||||
|
||||
## Usage
|
||||
|
||||
There are two main, recommended methods of using the module:
|
||||
|
||||
### With the CLI
|
||||
|
||||
The easiest way to use it is with the CLI. In the directory where your
|
||||
`webpack.config.js` is, run:
|
||||
|
||||
```console
|
||||
node_modules/.bin/webpack-dev-server
|
||||
```
|
||||
|
||||
_**Note**: Many CLI options are available with `webpack-dev-server`. Explore this [link](https://webpack.js.org/configuration/dev-server/)._
|
||||
|
||||
### With NPM Scripts
|
||||
|
||||
NPM package.json scripts are a convenient and useful means to run locally installed
|
||||
binaries without having to be concerned about their full paths. Simply define a
|
||||
script as such:
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"start:dev": "webpack-dev-server"
|
||||
}
|
||||
```
|
||||
|
||||
And run the following in your terminal/console:
|
||||
|
||||
```console
|
||||
npm run start:dev
|
||||
```
|
||||
|
||||
NPM will automagically reference the binary in `node_modules` for you, and
|
||||
execute the file or command.
|
||||
|
||||
### The Result
|
||||
|
||||
Either method will start a server instance and begin listening for connections
|
||||
from `localhost` on port `8080`.
|
||||
|
||||
webpack-dev-server is configured by default to support live-reload of files as
|
||||
you edit your assets while the server is running.
|
||||
|
||||
See [**the documentation**][docs-url] for more use cases and options.
|
||||
|
||||
## Browser Support
|
||||
|
||||
While `webpack-dev-server` transpiles the client (browser) scripts to an ES5
|
||||
state, the project only officially supports the _last two versions of major
|
||||
browsers_. We simply don't have the resources to support every whacky
|
||||
browser out there.
|
||||
|
||||
If you find a bug with an obscure / old browser, we would actively welcome a
|
||||
Pull Request to resolve the bug.
|
||||
|
||||
## Support
|
||||
|
||||
We do our best to keep Issues in the repository focused on bugs, features, and
|
||||
needed modifications to the code for the module. Because of that, we ask users
|
||||
with general support, "how-to", or "why isn't this working" questions to try one
|
||||
of the other support channels that are available.
|
||||
|
||||
Your first-stop-shop for support for webpack-dev-server should by the excellent
|
||||
[documentation][docs-url] for the module. If you see an opportunity for improvement
|
||||
of those docs, please head over to the [webpack.js.org repo][wjo-url] and open a
|
||||
pull request.
|
||||
|
||||
From there, we encourage users to visit the [webpack Gitter chat][chat-url] and
|
||||
talk to the fine folks there. If your quest for answers comes up dry in chat,
|
||||
head over to [StackOverflow][stack-url] and do a quick search or open a new
|
||||
question. Remember; It's always much easier to answer questions that include your
|
||||
`webpack.config.js` and relevant files!
|
||||
|
||||
If you're twitter-savvy you can tweet [#webpack][hash-url] with your question
|
||||
and someone should be able to reach out and lend a hand.
|
||||
|
||||
If you have discovered a :bug:, have a feature suggestion, or would like to see
|
||||
a modification, please feel free to create an issue on Github. _Note: The issue
|
||||
template isn't optional, so please be sure not to remove it, and please fill it
|
||||
out completely._
|
||||
|
||||
## Contributing
|
||||
|
||||
We welcome your contributions! Please have a read of [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to get involved.
|
||||
|
||||
## Attribution
|
||||
|
||||
This project is heavily inspired by [peerigon/nof5](https://github.com/peerigon/nof5).
|
||||
|
||||
## License
|
||||
|
||||
#### [MIT](./LICENSE)
|
||||
|
||||
[npm]: https://img.shields.io/npm/v/webpack-dev-server.svg
|
||||
[npm-url]: https://npmjs.com/package/webpack-dev-server
|
||||
[node]: https://img.shields.io/node/v/webpack-dev-server.svg
|
||||
[node-url]: https://nodejs.org
|
||||
[deps]: https://david-dm.org/webpack/webpack-dev-server.svg
|
||||
[deps-url]: https://david-dm.org/webpack/webpack-dev-server
|
||||
[tests]: https://dev.azure.com/webpack/webpack-dev-server/_apis/build/status/webpack.webpack-dev-server?branchName=master
|
||||
[tests-url]: https://dev.azure.com/webpack/webpack-dev-server/_build/latest?definitionId=7&branchName=master
|
||||
[cover]: https://codecov.io/gh/webpack/webpack-dev-server/branch/master/graph/badge.svg
|
||||
[cover-url]: https://codecov.io/gh/webpack/webpack-dev-server
|
||||
[chat]: https://badges.gitter.im/webpack/webpack.svg
|
||||
[chat-url]: https://gitter.im/webpack/webpack
|
||||
[docs-url]: https://webpack.js.org/configuration/dev-server/#devserver
|
||||
[hash-url]: https://twitter.com/search?q=webpack
|
||||
[middleware-url]: https://github.com/webpack/webpack-dev-middleware
|
||||
[stack-url]: https://stackoverflow.com/questions/tagged/webpack-dev-server
|
||||
[uglify-url]: https://github.com/webpack-contrib/uglifyjs-webpack-plugin
|
||||
[wjo-url]: https://github.com/webpack/webpack.js.org
|
||||
[downloads]: https://img.shields.io/npm/dm/webpack-dev-server.svg
|
||||
[contributors-url]: https://github.com/webpack/webpack-dev-server/graphs/contributors
|
||||
[contributors]: https://img.shields.io/github/contributors/webpack/webpack-dev-server.svg
|
||||
191
node_modules/webpack-dev-server/bin/cli-flags.js
generated
vendored
Executable file
191
node_modules/webpack-dev-server/bin/cli-flags.js
generated
vendored
Executable file
|
|
@ -0,0 +1,191 @@
|
|||
'use strict';
|
||||
|
||||
const ADVANCED_GROUP = 'Advanced options:';
|
||||
const DISPLAY_GROUP = 'Stats options:';
|
||||
const SSL_GROUP = 'SSL options:';
|
||||
const CONNECTION_GROUP = 'Connection options:';
|
||||
const RESPONSE_GROUP = 'Response options:';
|
||||
const BASIC_GROUP = 'Basic options:';
|
||||
|
||||
module.exports = {
|
||||
devServer: [
|
||||
{
|
||||
name: 'bonjour',
|
||||
type: Boolean,
|
||||
describe: 'Broadcasts the server via ZeroConf networking on start',
|
||||
},
|
||||
{
|
||||
name: 'lazy',
|
||||
type: Boolean,
|
||||
describe: 'Lazy',
|
||||
},
|
||||
{
|
||||
name: 'liveReload',
|
||||
type: Boolean,
|
||||
describe: 'Enables/Disables live reloading on changing files',
|
||||
},
|
||||
{
|
||||
name: 'serveIndex',
|
||||
type: Boolean,
|
||||
describe: 'Enables/Disables serveIndex middleware',
|
||||
},
|
||||
{
|
||||
name: 'inline',
|
||||
type: Boolean,
|
||||
describe:
|
||||
'Inline mode (set to false to disable including client scripts like livereload)',
|
||||
},
|
||||
{
|
||||
name: 'profile',
|
||||
type: Boolean,
|
||||
describe: 'Print compilation profile data for progress steps',
|
||||
},
|
||||
{
|
||||
name: 'progress',
|
||||
type: Boolean,
|
||||
describe: 'Print compilation progress in percentage',
|
||||
group: BASIC_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'hot-only',
|
||||
type: Boolean,
|
||||
describe: 'Do not refresh page if HMR fails',
|
||||
group: ADVANCED_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'stdin',
|
||||
type: Boolean,
|
||||
describe: 'close when stdin ends',
|
||||
},
|
||||
{
|
||||
name: 'open',
|
||||
type: [String, Boolean],
|
||||
describe:
|
||||
'Open the default browser, or optionally specify a browser name',
|
||||
},
|
||||
{
|
||||
name: 'useLocalIp',
|
||||
type: Boolean,
|
||||
describe: 'Open default browser with local IP',
|
||||
},
|
||||
{
|
||||
name: 'open-page',
|
||||
type: String,
|
||||
describe: 'Open default browser with the specified page',
|
||||
},
|
||||
{
|
||||
name: 'client-log-level',
|
||||
type: String,
|
||||
group: DISPLAY_GROUP,
|
||||
describe:
|
||||
'Log level in the browser (trace, debug, info, warn, error or silent)',
|
||||
},
|
||||
{
|
||||
name: 'https',
|
||||
type: Boolean,
|
||||
group: SSL_GROUP,
|
||||
describe: 'HTTPS',
|
||||
},
|
||||
{
|
||||
name: 'http2',
|
||||
type: Boolean,
|
||||
group: SSL_GROUP,
|
||||
describe: 'HTTP/2, must be used with HTTPS',
|
||||
},
|
||||
{
|
||||
name: 'key',
|
||||
type: String,
|
||||
describe: 'Path to a SSL key.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'cert',
|
||||
type: String,
|
||||
describe: 'Path to a SSL certificate.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'cacert',
|
||||
type: String,
|
||||
describe: 'Path to a SSL CA certificate.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'pfx',
|
||||
type: String,
|
||||
describe: 'Path to a SSL pfx file.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'pfx-passphrase',
|
||||
type: String,
|
||||
describe: 'Passphrase for pfx file.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'content-base',
|
||||
type: String,
|
||||
describe: 'A directory or URL to serve HTML content from.',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'watch-content-base',
|
||||
type: Boolean,
|
||||
describe: 'Enable live-reloading of the content-base.',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'history-api-fallback',
|
||||
type: Boolean,
|
||||
describe: 'Fallback to /index.html for Single Page Applications.',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'compress',
|
||||
type: Boolean,
|
||||
describe: 'Enable gzip compression',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
// findPort is currently not set up
|
||||
{
|
||||
name: 'port',
|
||||
type: Number,
|
||||
describe: 'The port',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'disable-host-check',
|
||||
type: Boolean,
|
||||
describe: 'Will not check the host',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'socket',
|
||||
type: String,
|
||||
describe: 'Socket to listen',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'public',
|
||||
type: String,
|
||||
describe: 'The public hostname/ip address of the server',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
{
|
||||
name: 'host',
|
||||
type: String,
|
||||
describe: 'The hostname/ip address the server will bind to',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
// use command-line-args "multiple" option, allowing the usage: --allowed-hosts host1 host2 host3
|
||||
// instead of the old, comma-separated syntax: --allowed-hosts host1,host2,host3
|
||||
{
|
||||
name: 'allowed-hosts',
|
||||
type: String,
|
||||
describe:
|
||||
'A list of hosts that are allowed to access the dev server, separated by spaces',
|
||||
group: CONNECTION_GROUP,
|
||||
multiple: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
187
node_modules/webpack-dev-server/bin/options.js
generated
vendored
Executable file
187
node_modules/webpack-dev-server/bin/options.js
generated
vendored
Executable file
|
|
@ -0,0 +1,187 @@
|
|||
'use strict';
|
||||
|
||||
/* eslint-disable
|
||||
multiline-ternary,
|
||||
space-before-function-paren
|
||||
*/
|
||||
const ADVANCED_GROUP = 'Advanced options:';
|
||||
const DISPLAY_GROUP = 'Stats options:';
|
||||
const SSL_GROUP = 'SSL options:';
|
||||
const CONNECTION_GROUP = 'Connection options:';
|
||||
const RESPONSE_GROUP = 'Response options:';
|
||||
const BASIC_GROUP = 'Basic options:';
|
||||
|
||||
const options = {
|
||||
bonjour: {
|
||||
type: 'boolean',
|
||||
describe: 'Broadcasts the server via ZeroConf networking on start',
|
||||
},
|
||||
lazy: {
|
||||
type: 'boolean',
|
||||
describe: 'Lazy',
|
||||
},
|
||||
liveReload: {
|
||||
type: 'boolean',
|
||||
describe: 'Enables/Disables live reloading on changing files',
|
||||
default: true,
|
||||
},
|
||||
serveIndex: {
|
||||
type: 'boolean',
|
||||
describe: 'Enables/Disables serveIndex middleware',
|
||||
default: true,
|
||||
},
|
||||
inline: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
describe:
|
||||
'Inline mode (set to false to disable including client scripts like livereload)',
|
||||
},
|
||||
profile: {
|
||||
type: 'boolean',
|
||||
describe: 'Print compilation profile data for progress steps',
|
||||
},
|
||||
progress: {
|
||||
type: 'boolean',
|
||||
describe: 'Print compilation progress in percentage',
|
||||
group: BASIC_GROUP,
|
||||
},
|
||||
'hot-only': {
|
||||
type: 'boolean',
|
||||
describe: 'Do not refresh page if HMR fails',
|
||||
group: ADVANCED_GROUP,
|
||||
},
|
||||
stdin: {
|
||||
type: 'boolean',
|
||||
describe: 'close when stdin ends',
|
||||
},
|
||||
open: {
|
||||
type: 'string',
|
||||
describe: 'Open the default browser, or optionally specify a browser name',
|
||||
},
|
||||
useLocalIp: {
|
||||
type: 'boolean',
|
||||
describe: 'Open default browser with local IP',
|
||||
},
|
||||
'open-page': {
|
||||
type: 'string',
|
||||
describe: 'Open default browser with the specified page',
|
||||
requiresArg: true,
|
||||
},
|
||||
color: {
|
||||
type: 'boolean',
|
||||
alias: 'colors',
|
||||
default: function supportsColor() {
|
||||
// Use `require('supports-color').stdout` for supports-color >= 5.0.0.
|
||||
// See https://github.com/webpack/webpack-dev-server/pull/1555.
|
||||
return require('supports-color').stdout;
|
||||
},
|
||||
group: DISPLAY_GROUP,
|
||||
describe: 'Enables/Disables colors on the console',
|
||||
},
|
||||
info: {
|
||||
type: 'boolean',
|
||||
group: DISPLAY_GROUP,
|
||||
default: true,
|
||||
describe: 'Info',
|
||||
},
|
||||
quiet: {
|
||||
type: 'boolean',
|
||||
group: DISPLAY_GROUP,
|
||||
describe: 'Quiet',
|
||||
},
|
||||
'client-log-level': {
|
||||
type: 'string',
|
||||
group: DISPLAY_GROUP,
|
||||
default: 'info',
|
||||
describe:
|
||||
'Log level in the browser (trace, debug, info, warn, error or silent)',
|
||||
},
|
||||
https: {
|
||||
type: 'boolean',
|
||||
group: SSL_GROUP,
|
||||
describe: 'HTTPS',
|
||||
},
|
||||
http2: {
|
||||
type: 'boolean',
|
||||
group: SSL_GROUP,
|
||||
describe: 'HTTP/2, must be used with HTTPS',
|
||||
},
|
||||
key: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL key.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
cert: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL certificate.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
cacert: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL CA certificate.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
pfx: {
|
||||
type: 'string',
|
||||
describe: 'Path to a SSL pfx file.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
'pfx-passphrase': {
|
||||
type: 'string',
|
||||
describe: 'Passphrase for pfx file.',
|
||||
group: SSL_GROUP,
|
||||
},
|
||||
'content-base': {
|
||||
type: 'string',
|
||||
describe: 'A directory or URL to serve HTML content from.',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
'watch-content-base': {
|
||||
type: 'boolean',
|
||||
describe: 'Enable live-reloading of the content-base.',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
'history-api-fallback': {
|
||||
type: 'boolean',
|
||||
describe: 'Fallback to /index.html for Single Page Applications.',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
compress: {
|
||||
type: 'boolean',
|
||||
describe: 'Enable gzip compression',
|
||||
group: RESPONSE_GROUP,
|
||||
},
|
||||
port: {
|
||||
describe: 'The port',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
'disable-host-check': {
|
||||
type: 'boolean',
|
||||
describe: 'Will not check the host',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
socket: {
|
||||
type: 'String',
|
||||
describe: 'Socket to listen',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
public: {
|
||||
type: 'string',
|
||||
describe: 'The public hostname/ip address of the server',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
host: {
|
||||
type: 'string',
|
||||
default: 'localhost',
|
||||
describe: 'The hostname/ip address the server will bind to',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
'allowed-hosts': {
|
||||
type: 'string',
|
||||
describe:
|
||||
'A comma-delimited string of hosts that are allowed to access the dev server',
|
||||
group: CONNECTION_GROUP,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = options;
|
||||
167
node_modules/webpack-dev-server/bin/webpack-dev-server.js
generated
vendored
Executable file
167
node_modules/webpack-dev-server/bin/webpack-dev-server.js
generated
vendored
Executable file
|
|
@ -0,0 +1,167 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable no-shadow, no-console */
|
||||
|
||||
const fs = require('fs');
|
||||
const net = require('net');
|
||||
const debug = require('debug')('webpack-dev-server');
|
||||
const importLocal = require('import-local');
|
||||
const yargs = require('yargs');
|
||||
const webpack = require('webpack');
|
||||
const Server = require('../lib/Server');
|
||||
const setupExitSignals = require('../lib/utils/setupExitSignals');
|
||||
const colors = require('../lib/utils/colors');
|
||||
const processOptions = require('../lib/utils/processOptions');
|
||||
const createLogger = require('../lib/utils/createLogger');
|
||||
const getVersions = require('../lib/utils/getVersions');
|
||||
const options = require('./options');
|
||||
|
||||
let server;
|
||||
const serverData = {
|
||||
server: null,
|
||||
};
|
||||
// we must pass an object that contains the server object as a property so that
|
||||
// we can update this server property later, and setupExitSignals will be able to
|
||||
// recognize that the server has been instantiated, because we will set
|
||||
// serverData.server to the new server object.
|
||||
setupExitSignals(serverData);
|
||||
|
||||
// Prefer the local installation of webpack-dev-server
|
||||
if (importLocal(__filename)) {
|
||||
debug('Using local install of webpack-dev-server');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
require.resolve('webpack-cli');
|
||||
} catch (err) {
|
||||
console.error('The CLI moved into a separate package: webpack-cli');
|
||||
console.error(
|
||||
"Please install 'webpack-cli' in addition to webpack itself to use the CLI"
|
||||
);
|
||||
console.error('-> When using npm: npm i -D webpack-cli');
|
||||
console.error('-> When using yarn: yarn add -D webpack-cli');
|
||||
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
yargs.usage(
|
||||
`${getVersions()}\nUsage: https://webpack.js.org/configuration/dev-server/`
|
||||
);
|
||||
|
||||
// webpack-cli@3.3 path : 'webpack-cli/bin/config/config-yargs'
|
||||
let configYargsPath;
|
||||
try {
|
||||
require.resolve('webpack-cli/bin/config/config-yargs');
|
||||
configYargsPath = 'webpack-cli/bin/config/config-yargs';
|
||||
} catch (e) {
|
||||
configYargsPath = 'webpack-cli/bin/config-yargs';
|
||||
}
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
require(configYargsPath)(yargs);
|
||||
|
||||
// It is important that this is done after the webpack yargs config,
|
||||
// so it overrides webpack's version info.
|
||||
yargs.version(getVersions());
|
||||
yargs.options(options);
|
||||
|
||||
const argv = yargs.argv;
|
||||
|
||||
// webpack-cli@3.3 path : 'webpack-cli/bin/utils/convert-argv'
|
||||
let convertArgvPath;
|
||||
try {
|
||||
require.resolve('webpack-cli/bin/utils/convert-argv');
|
||||
convertArgvPath = 'webpack-cli/bin/utils/convert-argv';
|
||||
} catch (e) {
|
||||
convertArgvPath = 'webpack-cli/bin/convert-argv';
|
||||
}
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
const config = require(convertArgvPath)(yargs, argv, {
|
||||
outputFilename: '/bundle.js',
|
||||
});
|
||||
|
||||
function startDevServer(config, options) {
|
||||
const log = createLogger(options);
|
||||
|
||||
let compiler;
|
||||
|
||||
try {
|
||||
compiler = webpack(config);
|
||||
} catch (err) {
|
||||
if (err instanceof webpack.WebpackOptionsValidationError) {
|
||||
log.error(colors.error(options.stats.colors, err.message));
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
try {
|
||||
server = new Server(compiler, options, log);
|
||||
serverData.server = server;
|
||||
} catch (err) {
|
||||
if (err.name === 'ValidationError') {
|
||||
log.error(colors.error(options.stats.colors, err.message));
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
throw err;
|
||||
}
|
||||
|
||||
if (options.socket) {
|
||||
server.listeningApp.on('error', (e) => {
|
||||
if (e.code === 'EADDRINUSE') {
|
||||
const clientSocket = new net.Socket();
|
||||
|
||||
clientSocket.on('error', (err) => {
|
||||
if (err.code === 'ECONNREFUSED') {
|
||||
// No other server listening on this socket so it can be safely removed
|
||||
fs.unlinkSync(options.socket);
|
||||
|
||||
server.listen(options.socket, options.host, (error) => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
clientSocket.connect({ path: options.socket }, () => {
|
||||
throw new Error('This socket is already used');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
server.listen(options.socket, options.host, (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
// chmod 666 (rw rw rw)
|
||||
const READ_WRITE = 438;
|
||||
|
||||
fs.chmod(options.socket, READ_WRITE, (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
server.listen(options.port, options.host, (err) => {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
processOptions(config, argv, (config, options) => {
|
||||
startDevServer(config, options);
|
||||
});
|
||||
25
node_modules/webpack-dev-server/client/clients/BaseClient.js
generated
vendored
Executable file
25
node_modules/webpack-dev-server/client/clients/BaseClient.js
generated
vendored
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
'use strict';
|
||||
/* eslint-disable
|
||||
no-unused-vars
|
||||
*/
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
module.exports = /*#__PURE__*/function () {
|
||||
function BaseClient() {
|
||||
_classCallCheck(this, BaseClient);
|
||||
}
|
||||
|
||||
_createClass(BaseClient, null, [{
|
||||
key: "getClientPath",
|
||||
value: function getClientPath(options) {
|
||||
throw new Error('Client needs implementation');
|
||||
}
|
||||
}]);
|
||||
|
||||
return BaseClient;
|
||||
}();
|
||||
78
node_modules/webpack-dev-server/client/clients/SockJSClient.js
generated
vendored
Executable file
78
node_modules/webpack-dev-server/client/clients/SockJSClient.js
generated
vendored
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
/* eslint-disable
|
||||
no-unused-vars
|
||||
*/
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var SockJS = require('sockjs-client/dist/sockjs');
|
||||
|
||||
var BaseClient = require('./BaseClient');
|
||||
|
||||
module.exports = /*#__PURE__*/function (_BaseClient) {
|
||||
_inherits(SockJSClient, _BaseClient);
|
||||
|
||||
var _super = _createSuper(SockJSClient);
|
||||
|
||||
function SockJSClient(url) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, SockJSClient);
|
||||
|
||||
_this = _super.call(this);
|
||||
_this.sock = new SockJS(url);
|
||||
|
||||
_this.sock.onerror = function (err) {// TODO: use logger to log the error event once client and client-src
|
||||
// are reorganized to have the same directory structure
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(SockJSClient, [{
|
||||
key: "onOpen",
|
||||
value: function onOpen(f) {
|
||||
this.sock.onopen = f;
|
||||
}
|
||||
}, {
|
||||
key: "onClose",
|
||||
value: function onClose(f) {
|
||||
this.sock.onclose = f;
|
||||
} // call f with the message string as the first argument
|
||||
|
||||
}, {
|
||||
key: "onMessage",
|
||||
value: function onMessage(f) {
|
||||
this.sock.onmessage = function (e) {
|
||||
f(e.data);
|
||||
};
|
||||
}
|
||||
}], [{
|
||||
key: "getClientPath",
|
||||
value: function getClientPath(options) {
|
||||
return require.resolve('./SockJSClient');
|
||||
}
|
||||
}]);
|
||||
|
||||
return SockJSClient;
|
||||
}(BaseClient);
|
||||
78
node_modules/webpack-dev-server/client/clients/WebsocketClient.js
generated
vendored
Executable file
78
node_modules/webpack-dev-server/client/clients/WebsocketClient.js
generated
vendored
Executable file
|
|
@ -0,0 +1,78 @@
|
|||
'use strict';
|
||||
/* global WebSocket */
|
||||
|
||||
/* eslint-disable
|
||||
no-unused-vars
|
||||
*/
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var BaseClient = require('./BaseClient');
|
||||
|
||||
module.exports = /*#__PURE__*/function (_BaseClient) {
|
||||
_inherits(WebsocketClient, _BaseClient);
|
||||
|
||||
var _super = _createSuper(WebsocketClient);
|
||||
|
||||
function WebsocketClient(url) {
|
||||
var _this;
|
||||
|
||||
_classCallCheck(this, WebsocketClient);
|
||||
|
||||
_this = _super.call(this);
|
||||
_this.client = new WebSocket(url.replace(/^http/, 'ws'));
|
||||
|
||||
_this.client.onerror = function (err) {// TODO: use logger to log the error event once client and client-src
|
||||
// are reorganized to have the same directory structure
|
||||
};
|
||||
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(WebsocketClient, [{
|
||||
key: "onOpen",
|
||||
value: function onOpen(f) {
|
||||
this.client.onopen = f;
|
||||
}
|
||||
}, {
|
||||
key: "onClose",
|
||||
value: function onClose(f) {
|
||||
this.client.onclose = f;
|
||||
} // call f with the message string as the first argument
|
||||
|
||||
}, {
|
||||
key: "onMessage",
|
||||
value: function onMessage(f) {
|
||||
this.client.onmessage = function (e) {
|
||||
f(e.data);
|
||||
};
|
||||
}
|
||||
}], [{
|
||||
key: "getClientPath",
|
||||
value: function getClientPath(options) {
|
||||
return require.resolve('./WebsocketClient');
|
||||
}
|
||||
}]);
|
||||
|
||||
return WebsocketClient;
|
||||
}(BaseClient);
|
||||
1
node_modules/webpack-dev-server/client/index.bundle.js
generated
vendored
Executable file
1
node_modules/webpack-dev-server/client/index.bundle.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
176
node_modules/webpack-dev-server/client/index.js
generated
vendored
Executable file
176
node_modules/webpack-dev-server/client/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,176 @@
|
|||
'use strict';
|
||||
/* global __resourceQuery WorkerGlobalScope self */
|
||||
|
||||
/* eslint prefer-destructuring: off */
|
||||
|
||||
var stripAnsi = require('strip-ansi');
|
||||
|
||||
var socket = require('./socket');
|
||||
|
||||
var overlay = require('./overlay');
|
||||
|
||||
var _require = require('./utils/log'),
|
||||
log = _require.log,
|
||||
setLogLevel = _require.setLogLevel;
|
||||
|
||||
var sendMessage = require('./utils/sendMessage');
|
||||
|
||||
var reloadApp = require('./utils/reloadApp');
|
||||
|
||||
var createSocketUrl = require('./utils/createSocketUrl');
|
||||
|
||||
var status = {
|
||||
isUnloading: false,
|
||||
currentHash: ''
|
||||
};
|
||||
var options = {
|
||||
hot: false,
|
||||
hotReload: true,
|
||||
liveReload: false,
|
||||
initial: true,
|
||||
useWarningOverlay: false,
|
||||
useErrorOverlay: false,
|
||||
useProgress: false
|
||||
};
|
||||
var socketUrl = createSocketUrl(__resourceQuery);
|
||||
self.addEventListener('beforeunload', function () {
|
||||
status.isUnloading = true;
|
||||
});
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
var qs = window.location.search.toLowerCase();
|
||||
options.hotReload = qs.indexOf('hotreload=false') === -1;
|
||||
}
|
||||
|
||||
var onSocketMessage = {
|
||||
hot: function hot() {
|
||||
options.hot = true;
|
||||
log.info('[WDS] Hot Module Replacement enabled.');
|
||||
},
|
||||
liveReload: function liveReload() {
|
||||
options.liveReload = true;
|
||||
log.info('[WDS] Live Reloading enabled.');
|
||||
},
|
||||
invalid: function invalid() {
|
||||
log.info('[WDS] App updated. Recompiling...'); // fixes #1042. overlay doesn't clear if errors are fixed but warnings remain.
|
||||
|
||||
if (options.useWarningOverlay || options.useErrorOverlay) {
|
||||
overlay.clear();
|
||||
}
|
||||
|
||||
sendMessage('Invalid');
|
||||
},
|
||||
hash: function hash(_hash) {
|
||||
status.currentHash = _hash;
|
||||
},
|
||||
'still-ok': function stillOk() {
|
||||
log.info('[WDS] Nothing changed.');
|
||||
|
||||
if (options.useWarningOverlay || options.useErrorOverlay) {
|
||||
overlay.clear();
|
||||
}
|
||||
|
||||
sendMessage('StillOk');
|
||||
},
|
||||
'log-level': function logLevel(level) {
|
||||
var hotCtx = require.context('webpack/hot', false, /^\.\/log$/);
|
||||
|
||||
if (hotCtx.keys().indexOf('./log') !== -1) {
|
||||
hotCtx('./log').setLogLevel(level);
|
||||
}
|
||||
|
||||
setLogLevel(level);
|
||||
},
|
||||
overlay: function overlay(value) {
|
||||
if (typeof document !== 'undefined') {
|
||||
if (typeof value === 'boolean') {
|
||||
options.useWarningOverlay = false;
|
||||
options.useErrorOverlay = value;
|
||||
} else if (value) {
|
||||
options.useWarningOverlay = value.warnings;
|
||||
options.useErrorOverlay = value.errors;
|
||||
}
|
||||
}
|
||||
},
|
||||
progress: function progress(_progress) {
|
||||
if (typeof document !== 'undefined') {
|
||||
options.useProgress = _progress;
|
||||
}
|
||||
},
|
||||
'progress-update': function progressUpdate(data) {
|
||||
if (options.useProgress) {
|
||||
log.info("[WDS] ".concat(data.percent, "% - ").concat(data.msg, "."));
|
||||
}
|
||||
|
||||
sendMessage('Progress', data);
|
||||
},
|
||||
ok: function ok() {
|
||||
sendMessage('Ok');
|
||||
|
||||
if (options.useWarningOverlay || options.useErrorOverlay) {
|
||||
overlay.clear();
|
||||
}
|
||||
|
||||
if (options.initial) {
|
||||
return options.initial = false;
|
||||
} // eslint-disable-line no-return-assign
|
||||
|
||||
|
||||
reloadApp(options, status);
|
||||
},
|
||||
'content-changed': function contentChanged() {
|
||||
log.info('[WDS] Content base changed. Reloading...');
|
||||
self.location.reload();
|
||||
},
|
||||
warnings: function warnings(_warnings) {
|
||||
log.warn('[WDS] Warnings while compiling.');
|
||||
|
||||
var strippedWarnings = _warnings.map(function (warning) {
|
||||
return stripAnsi(warning);
|
||||
});
|
||||
|
||||
sendMessage('Warnings', strippedWarnings);
|
||||
|
||||
for (var i = 0; i < strippedWarnings.length; i++) {
|
||||
log.warn(strippedWarnings[i]);
|
||||
}
|
||||
|
||||
if (options.useWarningOverlay) {
|
||||
overlay.showMessage(_warnings);
|
||||
}
|
||||
|
||||
if (options.initial) {
|
||||
return options.initial = false;
|
||||
} // eslint-disable-line no-return-assign
|
||||
|
||||
|
||||
reloadApp(options, status);
|
||||
},
|
||||
errors: function errors(_errors) {
|
||||
log.error('[WDS] Errors while compiling. Reload prevented.');
|
||||
|
||||
var strippedErrors = _errors.map(function (error) {
|
||||
return stripAnsi(error);
|
||||
});
|
||||
|
||||
sendMessage('Errors', strippedErrors);
|
||||
|
||||
for (var i = 0; i < strippedErrors.length; i++) {
|
||||
log.error(strippedErrors[i]);
|
||||
}
|
||||
|
||||
if (options.useErrorOverlay) {
|
||||
overlay.showMessage(_errors);
|
||||
}
|
||||
|
||||
options.initial = false;
|
||||
},
|
||||
error: function error(_error) {
|
||||
log.error(_error);
|
||||
},
|
||||
close: function close() {
|
||||
log.error('[WDS] Disconnected!');
|
||||
sendMessage('Close');
|
||||
}
|
||||
};
|
||||
socket(socketUrl, onSocketMessage);
|
||||
25
node_modules/webpack-dev-server/client/live.bundle.js
generated
vendored
Executable file
25
node_modules/webpack-dev-server/client/live.bundle.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
1
node_modules/webpack-dev-server/client/live.html
generated
vendored
Executable file
1
node_modules/webpack-dev-server/client/live.html
generated
vendored
Executable file
|
|
@ -0,0 +1 @@
|
|||
<!DOCTYPE html><html><head><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/><script type="text/javascript" charset="utf-8" src="/__webpack_dev_server__/live.bundle.js"></script></head><body></body></html>
|
||||
120
node_modules/webpack-dev-server/client/overlay.js
generated
vendored
Executable file
120
node_modules/webpack-dev-server/client/overlay.js
generated
vendored
Executable file
|
|
@ -0,0 +1,120 @@
|
|||
'use strict'; // The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app)
|
||||
// They, in turn, got inspired by webpack-hot-middleware (https://github.com/glenjamin/webpack-hot-middleware).
|
||||
|
||||
var ansiHTML = require('ansi-html');
|
||||
|
||||
var _require = require('html-entities'),
|
||||
AllHtmlEntities = _require.AllHtmlEntities;
|
||||
|
||||
var entities = new AllHtmlEntities();
|
||||
var colors = {
|
||||
reset: ['transparent', 'transparent'],
|
||||
black: '181818',
|
||||
red: 'E36049',
|
||||
green: 'B3CB74',
|
||||
yellow: 'FFD080',
|
||||
blue: '7CAFC2',
|
||||
magenta: '7FACCA',
|
||||
cyan: 'C3C2EF',
|
||||
lightgrey: 'EBE7E3',
|
||||
darkgrey: '6D7891'
|
||||
};
|
||||
var overlayIframe = null;
|
||||
var overlayDiv = null;
|
||||
var lastOnOverlayDivReady = null;
|
||||
ansiHTML.setColors(colors);
|
||||
|
||||
function createOverlayIframe(onIframeLoad) {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.id = 'webpack-dev-server-client-overlay';
|
||||
iframe.src = 'about:blank';
|
||||
iframe.style.position = 'fixed';
|
||||
iframe.style.left = 0;
|
||||
iframe.style.top = 0;
|
||||
iframe.style.right = 0;
|
||||
iframe.style.bottom = 0;
|
||||
iframe.style.width = '100vw';
|
||||
iframe.style.height = '100vh';
|
||||
iframe.style.border = 'none';
|
||||
iframe.style.zIndex = 9999999999;
|
||||
iframe.onload = onIframeLoad;
|
||||
return iframe;
|
||||
}
|
||||
|
||||
function addOverlayDivTo(iframe) {
|
||||
var div = iframe.contentDocument.createElement('div');
|
||||
div.id = 'webpack-dev-server-client-overlay-div';
|
||||
div.style.position = 'fixed';
|
||||
div.style.boxSizing = 'border-box';
|
||||
div.style.left = 0;
|
||||
div.style.top = 0;
|
||||
div.style.right = 0;
|
||||
div.style.bottom = 0;
|
||||
div.style.width = '100vw';
|
||||
div.style.height = '100vh';
|
||||
div.style.backgroundColor = 'rgba(0, 0, 0, 0.85)';
|
||||
div.style.color = '#E8E8E8';
|
||||
div.style.fontFamily = 'Menlo, Consolas, monospace';
|
||||
div.style.fontSize = 'large';
|
||||
div.style.padding = '2rem';
|
||||
div.style.lineHeight = '1.2';
|
||||
div.style.whiteSpace = 'pre-wrap';
|
||||
div.style.overflow = 'auto';
|
||||
iframe.contentDocument.body.appendChild(div);
|
||||
return div;
|
||||
}
|
||||
|
||||
function ensureOverlayDivExists(onOverlayDivReady) {
|
||||
if (overlayDiv) {
|
||||
// Everything is ready, call the callback right away.
|
||||
onOverlayDivReady(overlayDiv);
|
||||
return;
|
||||
} // Creating an iframe may be asynchronous so we'll schedule the callback.
|
||||
// In case of multiple calls, last callback wins.
|
||||
|
||||
|
||||
lastOnOverlayDivReady = onOverlayDivReady;
|
||||
|
||||
if (overlayIframe) {
|
||||
// We've already created it.
|
||||
return;
|
||||
} // Create iframe and, when it is ready, a div inside it.
|
||||
|
||||
|
||||
overlayIframe = createOverlayIframe(function () {
|
||||
overlayDiv = addOverlayDivTo(overlayIframe); // Now we can talk!
|
||||
|
||||
lastOnOverlayDivReady(overlayDiv);
|
||||
}); // Zalgo alert: onIframeLoad() will be called either synchronously
|
||||
// or asynchronously depending on the browser.
|
||||
// We delay adding it so `overlayIframe` is set when `onIframeLoad` fires.
|
||||
|
||||
document.body.appendChild(overlayIframe);
|
||||
} // Successful compilation.
|
||||
|
||||
|
||||
function clear() {
|
||||
if (!overlayDiv) {
|
||||
// It is not there in the first place.
|
||||
return;
|
||||
} // Clean up and reset internal state.
|
||||
|
||||
|
||||
document.body.removeChild(overlayIframe);
|
||||
overlayDiv = null;
|
||||
overlayIframe = null;
|
||||
lastOnOverlayDivReady = null;
|
||||
} // Compilation with errors (e.g. syntax error or missing modules).
|
||||
|
||||
|
||||
function showMessage(messages) {
|
||||
ensureOverlayDivExists(function (div) {
|
||||
// Make it look similar to our terminal.
|
||||
div.innerHTML = "<span style=\"color: #".concat(colors.red, "\">Failed to compile.</span><br><br>").concat(ansiHTML(entities.encode(messages[0])));
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
clear: clear,
|
||||
showMessage: showMessage
|
||||
};
|
||||
52
node_modules/webpack-dev-server/client/socket.js
generated
vendored
Executable file
52
node_modules/webpack-dev-server/client/socket.js
generated
vendored
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
'use strict';
|
||||
/* global __webpack_dev_server_client__ */
|
||||
|
||||
/* eslint-disable
|
||||
camelcase
|
||||
*/
|
||||
// this SockJSClient is here as a default fallback, in case inline mode
|
||||
// is off or the client is not injected. This will be switched to
|
||||
// WebsocketClient when it becomes the default
|
||||
// important: the path to SockJSClient here is made to work in the 'client'
|
||||
// directory, but is updated via the webpack compilation when compiled from
|
||||
// the 'client-src' directory
|
||||
|
||||
var Client = typeof __webpack_dev_server_client__ !== 'undefined' ? __webpack_dev_server_client__ : // eslint-disable-next-line import/no-unresolved
|
||||
require('./clients/SockJSClient');
|
||||
var retries = 0;
|
||||
var client = null;
|
||||
|
||||
var socket = function initSocket(url, handlers) {
|
||||
client = new Client(url);
|
||||
client.onOpen(function () {
|
||||
retries = 0;
|
||||
});
|
||||
client.onClose(function () {
|
||||
if (retries === 0) {
|
||||
handlers.close();
|
||||
} // Try to reconnect.
|
||||
|
||||
|
||||
client = null; // After 10 retries stop trying, to prevent logspam.
|
||||
|
||||
if (retries <= 10) {
|
||||
// Exponentially increase timeout to reconnect.
|
||||
// Respectfully copied from the package `got`.
|
||||
// eslint-disable-next-line no-mixed-operators, no-restricted-properties
|
||||
var retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100;
|
||||
retries += 1;
|
||||
setTimeout(function () {
|
||||
socket(url, handlers);
|
||||
}, retryInMs);
|
||||
}
|
||||
});
|
||||
client.onMessage(function (data) {
|
||||
var msg = JSON.parse(data);
|
||||
|
||||
if (handlers[msg.type]) {
|
||||
handlers[msg.type](msg.data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = socket;
|
||||
1
node_modules/webpack-dev-server/client/sockjs.bundle.js
generated
vendored
Executable file
1
node_modules/webpack-dev-server/client/sockjs.bundle.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
88
node_modules/webpack-dev-server/client/utils/createSocketUrl.js
generated
vendored
Executable file
88
node_modules/webpack-dev-server/client/utils/createSocketUrl.js
generated
vendored
Executable file
|
|
@ -0,0 +1,88 @@
|
|||
'use strict';
|
||||
/* global self */
|
||||
|
||||
var url = require('url');
|
||||
|
||||
var getCurrentScriptSource = require('./getCurrentScriptSource');
|
||||
|
||||
function createSocketUrl(resourceQuery, currentLocation) {
|
||||
var urlParts;
|
||||
|
||||
if (typeof resourceQuery === 'string' && resourceQuery !== '') {
|
||||
// If this bundle is inlined, use the resource query to get the correct url.
|
||||
// format is like `?http://0.0.0.0:8096&sockPort=8097&sockHost=localhost`
|
||||
urlParts = url.parse(resourceQuery // strip leading `?` from query string to get a valid URL
|
||||
.substr(1) // replace first `&` with `?` to have a valid query string
|
||||
.replace('&', '?'), true);
|
||||
} else {
|
||||
// Else, get the url from the <script> this file was called with.
|
||||
var scriptHost = getCurrentScriptSource();
|
||||
urlParts = url.parse(scriptHost || '/', true, true);
|
||||
} // Use parameter to allow passing location in unit tests
|
||||
|
||||
|
||||
if (typeof currentLocation === 'string' && currentLocation !== '') {
|
||||
currentLocation = url.parse(currentLocation);
|
||||
} else {
|
||||
currentLocation = self.location;
|
||||
}
|
||||
|
||||
return getSocketUrl(urlParts, currentLocation);
|
||||
}
|
||||
/*
|
||||
* Gets socket URL based on Script Source/Location
|
||||
* (scriptSrc: URL, location: URL) -> URL
|
||||
*/
|
||||
|
||||
|
||||
function getSocketUrl(urlParts, loc) {
|
||||
var auth = urlParts.auth,
|
||||
query = urlParts.query;
|
||||
var hostname = urlParts.hostname,
|
||||
protocol = urlParts.protocol,
|
||||
port = urlParts.port;
|
||||
|
||||
if (!port || port === '0') {
|
||||
port = loc.port;
|
||||
} // check ipv4 and ipv6 `all hostname`
|
||||
// why do we need this check?
|
||||
// hostname n/a for file protocol (example, when using electron, ionic)
|
||||
// see: https://github.com/webpack/webpack-dev-server/pull/384
|
||||
|
||||
|
||||
if ((hostname === '0.0.0.0' || hostname === '::') && loc.hostname && loc.protocol.indexOf('http') === 0) {
|
||||
hostname = loc.hostname;
|
||||
} // `hostname` can be empty when the script path is relative. In that case, specifying
|
||||
// a protocol would result in an invalid URL.
|
||||
// When https is used in the app, secure websockets are always necessary
|
||||
// because the browser doesn't accept non-secure websockets.
|
||||
|
||||
|
||||
if (hostname && hostname !== '127.0.0.1' && (loc.protocol === 'https:' || urlParts.hostname === '0.0.0.0')) {
|
||||
protocol = loc.protocol;
|
||||
} // all of these sock url params are optionally passed in through
|
||||
// resourceQuery, so we need to fall back to the default if
|
||||
// they are not provided
|
||||
|
||||
|
||||
var sockHost = query.sockHost || hostname;
|
||||
var sockPath = query.sockPath || '/sockjs-node';
|
||||
var sockPort = query.sockPort || port;
|
||||
|
||||
if (sockPort === 'location') {
|
||||
sockPort = loc.port;
|
||||
}
|
||||
|
||||
return url.format({
|
||||
protocol: protocol,
|
||||
auth: auth,
|
||||
hostname: sockHost,
|
||||
port: sockPort,
|
||||
// If sockPath is provided it'll be passed in via the resourceQuery as a
|
||||
// query param so it has to be parsed out of the querystring in order for the
|
||||
// client to open the socket to the correct location.
|
||||
pathname: sockPath
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = createSocketUrl;
|
||||
22
node_modules/webpack-dev-server/client/utils/getCurrentScriptSource.js
generated
vendored
Executable file
22
node_modules/webpack-dev-server/client/utils/getCurrentScriptSource.js
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
function getCurrentScriptSource() {
|
||||
// `document.currentScript` is the most accurate way to find the current script,
|
||||
// but is not supported in all browsers.
|
||||
if (document.currentScript) {
|
||||
return document.currentScript.getAttribute('src');
|
||||
} // Fall back to getting all scripts in the document.
|
||||
|
||||
|
||||
var scriptElements = document.scripts || [];
|
||||
var currentScript = scriptElements[scriptElements.length - 1];
|
||||
|
||||
if (currentScript) {
|
||||
return currentScript.getAttribute('src');
|
||||
} // Fail as there was no script to use.
|
||||
|
||||
|
||||
throw new Error('[WDS] Failed to get current script source.');
|
||||
}
|
||||
|
||||
module.exports = getCurrentScriptSource;
|
||||
49
node_modules/webpack-dev-server/client/utils/log.js
generated
vendored
Executable file
49
node_modules/webpack-dev-server/client/utils/log.js
generated
vendored
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
var log = require('loglevel').getLogger('webpack-dev-server');
|
||||
|
||||
var INFO = 'info';
|
||||
var WARN = 'warn';
|
||||
var ERROR = 'error';
|
||||
var DEBUG = 'debug';
|
||||
var TRACE = 'trace';
|
||||
var SILENT = 'silent'; // deprecated
|
||||
// TODO: remove these at major released
|
||||
// https://github.com/webpack/webpack-dev-server/pull/1825
|
||||
|
||||
var WARNING = 'warning';
|
||||
var NONE = 'none'; // Set the default log level
|
||||
|
||||
log.setDefaultLevel(INFO);
|
||||
|
||||
function setLogLevel(level) {
|
||||
switch (level) {
|
||||
case INFO:
|
||||
case WARN:
|
||||
case ERROR:
|
||||
case DEBUG:
|
||||
case TRACE:
|
||||
log.setLevel(level);
|
||||
break;
|
||||
// deprecated
|
||||
|
||||
case WARNING:
|
||||
// loglevel's warning name is different from webpack's
|
||||
log.setLevel('warn');
|
||||
break;
|
||||
// deprecated
|
||||
|
||||
case NONE:
|
||||
case SILENT:
|
||||
log.disableAll();
|
||||
break;
|
||||
|
||||
default:
|
||||
log.error("[WDS] Unknown clientLogLevel '".concat(level, "'"));
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
log: log,
|
||||
setLogLevel: setLogLevel
|
||||
};
|
||||
55
node_modules/webpack-dev-server/client/utils/reloadApp.js
generated
vendored
Executable file
55
node_modules/webpack-dev-server/client/utils/reloadApp.js
generated
vendored
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
'use strict';
|
||||
/* global WorkerGlobalScope self */
|
||||
|
||||
var _require = require('./log'),
|
||||
log = _require.log;
|
||||
|
||||
function reloadApp(_ref, _ref2) {
|
||||
var hotReload = _ref.hotReload,
|
||||
hot = _ref.hot,
|
||||
liveReload = _ref.liveReload;
|
||||
var isUnloading = _ref2.isUnloading,
|
||||
currentHash = _ref2.currentHash;
|
||||
|
||||
if (isUnloading || !hotReload) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hot) {
|
||||
log.info('[WDS] App hot update...');
|
||||
|
||||
var hotEmitter = require('webpack/hot/emitter');
|
||||
|
||||
hotEmitter.emit('webpackHotUpdate', currentHash);
|
||||
|
||||
if (typeof self !== 'undefined' && self.window) {
|
||||
// broadcast update to window
|
||||
self.postMessage("webpackHotUpdate".concat(currentHash), '*');
|
||||
}
|
||||
} // allow refreshing the page only if liveReload isn't disabled
|
||||
else if (liveReload) {
|
||||
var rootWindow = self; // use parent window for reload (in case we're in an iframe with no valid src)
|
||||
|
||||
var intervalId = self.setInterval(function () {
|
||||
if (rootWindow.location.protocol !== 'about:') {
|
||||
// reload immediately if protocol is valid
|
||||
applyReload(rootWindow, intervalId);
|
||||
} else {
|
||||
rootWindow = rootWindow.parent;
|
||||
|
||||
if (rootWindow.parent === rootWindow) {
|
||||
// if parent equals current window we've reached the root which would continue forever, so trigger a reload anyways
|
||||
applyReload(rootWindow, intervalId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function applyReload(rootWindow, intervalId) {
|
||||
clearInterval(intervalId);
|
||||
log.info('[WDS] App updated. Reloading...');
|
||||
rootWindow.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = reloadApp;
|
||||
14
node_modules/webpack-dev-server/client/utils/sendMessage.js
generated
vendored
Executable file
14
node_modules/webpack-dev-server/client/utils/sendMessage.js
generated
vendored
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
/* global __resourceQuery WorkerGlobalScope self */
|
||||
// Send messages to the outside, so plugins can consume it.
|
||||
|
||||
function sendMsg(type, data) {
|
||||
if (typeof self !== 'undefined' && (typeof WorkerGlobalScope === 'undefined' || !(self instanceof WorkerGlobalScope))) {
|
||||
self.postMessage({
|
||||
type: "webpack".concat(type),
|
||||
data: data
|
||||
}, '*');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = sendMsg;
|
||||
1036
node_modules/webpack-dev-server/lib/Server.js
generated
vendored
Executable file
1036
node_modules/webpack-dev-server/lib/Server.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
499
node_modules/webpack-dev-server/lib/options.json
generated
vendored
Executable file
499
node_modules/webpack-dev-server/lib/options.json
generated
vendored
Executable file
|
|
@ -0,0 +1,499 @@
|
|||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"after": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"allowedHosts": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"before": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"bonjour": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"ca": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"cert": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"clientLogLevel": {
|
||||
"enum": [
|
||||
"info",
|
||||
"warn",
|
||||
"error",
|
||||
"debug",
|
||||
"trace",
|
||||
"silent",
|
||||
"none",
|
||||
"warning"
|
||||
]
|
||||
},
|
||||
"compress": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"contentBasePublicPath": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"contentBase": {
|
||||
"anyOf": [
|
||||
{
|
||||
"enum": [false]
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"disableHostCheck": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"filename": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "RegExp"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fs": {
|
||||
"type": "object"
|
||||
},
|
||||
"headers": {
|
||||
"type": "object"
|
||||
},
|
||||
"historyApiFallback": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"host": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"hot": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"hotOnly": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"http2": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"https": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"index": {
|
||||
"type": "string"
|
||||
},
|
||||
"injectClient": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"injectHot": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"inline": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"key": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"lazy": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"liveReload": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"log": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"logLevel": {
|
||||
"enum": ["info", "warn", "error", "debug", "trace", "silent"]
|
||||
},
|
||||
"logTime": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"mimeTypes": {
|
||||
"type": "object"
|
||||
},
|
||||
"noInfo": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"onListening": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"open": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"openPage": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"overlay": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errors": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"warnings": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"pfx": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Buffer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"pfxPassphrase": {
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"profile": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"progress": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"proxy": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
},
|
||||
"minItems": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"public": {
|
||||
"type": "string"
|
||||
},
|
||||
"publicPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"quiet": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"reporter": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"requestCert": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"serveIndex": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"serverSideRender": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"setup": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"sockHost": {
|
||||
"type": "string"
|
||||
},
|
||||
"sockPath": {
|
||||
"type": "string"
|
||||
},
|
||||
"sockPort": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"socket": {
|
||||
"type": "string"
|
||||
},
|
||||
"staticOptions": {
|
||||
"type": "object"
|
||||
},
|
||||
"stats": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"none",
|
||||
"errors-only",
|
||||
"errors-warnings",
|
||||
"minimal",
|
||||
"normal",
|
||||
"verbose"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"transportMode": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"client": {
|
||||
"type": "string"
|
||||
},
|
||||
"server": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"enum": ["sockjs", "ws"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"useLocalIp": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"warn": {
|
||||
"instanceof": "Function"
|
||||
},
|
||||
"watchContentBase": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"watchOptions": {
|
||||
"type": "object"
|
||||
},
|
||||
"writeToDisk": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"instanceof": "Function"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"errorMessage": {
|
||||
"properties": {
|
||||
"after": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserverafter)",
|
||||
"allowedHosts": "should be {Array} (https://webpack.js.org/configuration/dev-server/#devserverallowedhosts)",
|
||||
"before": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserverbefore)",
|
||||
"bonjour": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverbonjour)",
|
||||
"ca": "should be {String|Buffer}",
|
||||
"cert": "should be {String|Buffer}",
|
||||
"clientLogLevel": "should be {String} and equal to one of the allowed values\n\n [ 'none', 'silent', 'info', 'debug', 'trace', 'error', 'warning', 'warn' ]\n\n (https://webpack.js.org/configuration/dev-server/#devserverclientloglevel)",
|
||||
"compress": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devservercompress)",
|
||||
"contentBase": "should be {Number|String|Array} (https://webpack.js.org/configuration/dev-server/#devservercontentbase)",
|
||||
"disableHostCheck": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck)",
|
||||
"features": "should be {Array}",
|
||||
"filename": "should be {String|RegExp|Function} (https://webpack.js.org/configuration/dev-server/#devserverfilename-)",
|
||||
"fs": "should be {Object} (https://github.com/webpack/webpack-dev-middleware#fs)",
|
||||
"headers": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserverheaders-)",
|
||||
"historyApiFallback": "should be {Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserverhistoryapifallback)",
|
||||
"host": "should be {String|Null} (https://webpack.js.org/configuration/dev-server/#devserverhost)",
|
||||
"hot": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverhot)",
|
||||
"hotOnly": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverhotonly)",
|
||||
"http2": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverhttp2)",
|
||||
"https": "should be {Object|Boolean} (https://webpack.js.org/configuration/dev-server/#devserverhttps)",
|
||||
"index": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverindex)",
|
||||
"injectClient": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverinjectclient)",
|
||||
"injectHot": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverinjecthot)",
|
||||
"inline": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverinline)",
|
||||
"key": "should be {String|Buffer}",
|
||||
"lazy": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlazy-)",
|
||||
"liveReload": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlivereload-)",
|
||||
"log": "should be {Function}",
|
||||
"logLevel": "should be {String} and equal to one of the allowed values\n\n [ 'info', 'warn', 'error', 'debug', 'trace', 'silent' ]\n\n (https://github.com/webpack/webpack-dev-middleware#loglevel)",
|
||||
"logTime": "should be {Boolean} (https://github.com/webpack/webpack-dev-middleware#logtime)",
|
||||
"mimeTypes": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devservermimetypes-)",
|
||||
"noInfo": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devservernoinfo-)",
|
||||
"onListening": "should be {Function} (https://webpack.js.org/configuration/dev-server/#onlistening)",
|
||||
"open": "should be {String|Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserveropen)",
|
||||
"openPage": "should be {String|Array} (https://webpack.js.org/configuration/dev-server/#devserveropenpage)",
|
||||
"overlay": "should be {Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserveroverlay)",
|
||||
"pfx": "should be {String|Buffer} (https://webpack.js.org/configuration/dev-server/#devserverpfx)",
|
||||
"pfxPassphrase": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverpfxpassphrase)",
|
||||
"port": "should be {Number|String|Null} (https://webpack.js.org/configuration/dev-server/#devserverport)",
|
||||
"profile": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverprofile)",
|
||||
"progress": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverprogress---cli-only)",
|
||||
"proxy": "should be {Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverproxy)",
|
||||
"public": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverpublic)",
|
||||
"publicPath": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverpublicpath-)",
|
||||
"quiet": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverquiet-)",
|
||||
"reporter": "should be {Function} (https://github.com/webpack/webpack-dev-middleware#reporter)",
|
||||
"requestCert": "should be {Boolean}",
|
||||
"contentBasePublicPath": "should be {String|Array} (https://webpack.js.org/configuration/dev-server/#devservercontentbasepublicpath)",
|
||||
"serveIndex": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverserveindex)",
|
||||
"serverSideRender": "should be {Boolean} (https://github.com/webpack/webpack-dev-middleware#serversiderender)",
|
||||
"setup": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserversetup)",
|
||||
"sockHost": "should be {String|Null} (https://webpack.js.org/configuration/dev-server/#devserversockhost)",
|
||||
"sockPath": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserversockpath)",
|
||||
"sockPort": "should be {Number|String|Null} (https://webpack.js.org/configuration/dev-server/#devserversockport)",
|
||||
"socket": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserversocket)",
|
||||
"staticOptions": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserverstaticoptions)",
|
||||
"stats": "should be {Object|Boolean} (https://webpack.js.org/configuration/dev-server/#devserverstats-)",
|
||||
"transportMode": "should be {String|Object} (https://webpack.js.org/configuration/dev-server/#devservertransportmode)",
|
||||
"useLocalIp": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserveruselocalip)",
|
||||
"warn": "should be {Function}",
|
||||
"watchContentBase": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverwatchcontentbase)",
|
||||
"watchOptions": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserverwatchoptions-)",
|
||||
"writeToDisk": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverwritetodisk-)"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
9
node_modules/webpack-dev-server/lib/servers/BaseServer.js
generated
vendored
Executable file
9
node_modules/webpack-dev-server/lib/servers/BaseServer.js
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
// base class that users should extend if they are making their own
|
||||
// server implementation
|
||||
module.exports = class BaseServer {
|
||||
constructor(server) {
|
||||
this.server = server;
|
||||
}
|
||||
};
|
||||
74
node_modules/webpack-dev-server/lib/servers/SockJSServer.js
generated
vendored
Executable file
74
node_modules/webpack-dev-server/lib/servers/SockJSServer.js
generated
vendored
Executable file
|
|
@ -0,0 +1,74 @@
|
|||
'use strict';
|
||||
|
||||
/* eslint-disable
|
||||
class-methods-use-this,
|
||||
func-names
|
||||
*/
|
||||
const sockjs = require('sockjs');
|
||||
const BaseServer = require('./BaseServer');
|
||||
|
||||
// Workaround for sockjs@~0.3.19
|
||||
// sockjs will remove Origin header, however Origin header is required for checking host.
|
||||
// See https://github.com/webpack/webpack-dev-server/issues/1604 for more information
|
||||
{
|
||||
const SockjsSession = require('sockjs/lib/transport').Session;
|
||||
const decorateConnection = SockjsSession.prototype.decorateConnection;
|
||||
SockjsSession.prototype.decorateConnection = function(req) {
|
||||
decorateConnection.call(this, req);
|
||||
const connection = this.connection;
|
||||
if (
|
||||
connection.headers &&
|
||||
!('origin' in connection.headers) &&
|
||||
'origin' in req.headers
|
||||
) {
|
||||
connection.headers.origin = req.headers.origin;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = class SockJSServer extends BaseServer {
|
||||
// options has: error (function), debug (function), server (http/s server), path (string)
|
||||
constructor(server) {
|
||||
super(server);
|
||||
this.socket = sockjs.createServer({
|
||||
// Use provided up-to-date sockjs-client
|
||||
sockjs_url: '/__webpack_dev_server__/sockjs.bundle.js',
|
||||
// Limit useless logs
|
||||
log: (severity, line) => {
|
||||
if (severity === 'error') {
|
||||
this.server.log.error(line);
|
||||
} else {
|
||||
this.server.log.debug(line);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
this.socket.installHandlers(this.server.listeningApp, {
|
||||
prefix: this.server.sockPath,
|
||||
});
|
||||
}
|
||||
|
||||
send(connection, message) {
|
||||
// prevent cases where the server is trying to send data while connection is closing
|
||||
if (connection.readyState !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
connection.write(message);
|
||||
}
|
||||
|
||||
close(connection) {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
// f should be passed the resulting connection and the connection headers
|
||||
onConnection(f) {
|
||||
this.socket.on('connection', (connection) => {
|
||||
f(connection, connection ? connection.headers : null);
|
||||
});
|
||||
}
|
||||
|
||||
onConnectionClose(connection, f) {
|
||||
connection.on('close', f);
|
||||
}
|
||||
};
|
||||
72
node_modules/webpack-dev-server/lib/servers/WebsocketServer.js
generated
vendored
Executable file
72
node_modules/webpack-dev-server/lib/servers/WebsocketServer.js
generated
vendored
Executable file
|
|
@ -0,0 +1,72 @@
|
|||
'use strict';
|
||||
|
||||
/* eslint-disable
|
||||
class-methods-use-this
|
||||
*/
|
||||
const ws = require('ws');
|
||||
const BaseServer = require('./BaseServer');
|
||||
|
||||
module.exports = class WebsocketServer extends BaseServer {
|
||||
constructor(server) {
|
||||
super(server);
|
||||
this.wsServer = new ws.Server({
|
||||
noServer: true,
|
||||
path: this.server.sockPath,
|
||||
});
|
||||
|
||||
this.server.listeningApp.on('upgrade', (req, sock, head) => {
|
||||
if (!this.wsServer.shouldHandle(req)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.wsServer.handleUpgrade(req, sock, head, (connection) => {
|
||||
this.wsServer.emit('connection', connection, req);
|
||||
});
|
||||
});
|
||||
|
||||
this.wsServer.on('error', (err) => {
|
||||
this.server.log.error(err.message);
|
||||
});
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
setInterval(() => {
|
||||
this.wsServer.clients.forEach((socket) => {
|
||||
if (socket.isAlive === false) {
|
||||
return socket.terminate();
|
||||
}
|
||||
|
||||
socket.isAlive = false;
|
||||
socket.ping(noop);
|
||||
});
|
||||
}, this.server.heartbeatInterval);
|
||||
}
|
||||
|
||||
send(connection, message) {
|
||||
// prevent cases where the server is trying to send data while connection is closing
|
||||
if (connection.readyState !== 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
connection.send(message);
|
||||
}
|
||||
|
||||
close(connection) {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
// f should be passed the resulting connection and the connection headers
|
||||
onConnection(f) {
|
||||
this.wsServer.on('connection', (connection, req) => {
|
||||
connection.isAlive = true;
|
||||
connection.on('pong', () => {
|
||||
connection.isAlive = true;
|
||||
});
|
||||
f(connection, req.headers);
|
||||
});
|
||||
}
|
||||
|
||||
onConnectionClose(connection, f) {
|
||||
connection.on('close', f);
|
||||
}
|
||||
};
|
||||
160
node_modules/webpack-dev-server/lib/utils/addEntries.js
generated
vendored
Executable file
160
node_modules/webpack-dev-server/lib/utils/addEntries.js
generated
vendored
Executable file
|
|
@ -0,0 +1,160 @@
|
|||
'use strict';
|
||||
|
||||
const webpack = require('webpack');
|
||||
const createDomain = require('./createDomain');
|
||||
|
||||
/**
|
||||
* A Entry, it can be of type string or string[] or Object<string | string[],string>
|
||||
* @typedef {(string[] | string | Object<string | string[],string>)} Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* Add entries Method
|
||||
* @param {?Object} config - Webpack config
|
||||
* @param {?Object} options - Dev-Server options
|
||||
* @param {?Object} server
|
||||
* @returns {void}
|
||||
*/
|
||||
function addEntries(config, options, server) {
|
||||
if (options.inline !== false) {
|
||||
// we're stubbing the app in this method as it's static and doesn't require
|
||||
// a server to be supplied. createDomain requires an app with the
|
||||
// address() signature.
|
||||
|
||||
const app = server || {
|
||||
address() {
|
||||
return { port: options.port };
|
||||
},
|
||||
};
|
||||
|
||||
/** @type {string} */
|
||||
const domain = createDomain(options, app);
|
||||
/** @type {string} */
|
||||
const sockHost = options.sockHost ? `&sockHost=${options.sockHost}` : '';
|
||||
/** @type {string} */
|
||||
const sockPath = options.sockPath ? `&sockPath=${options.sockPath}` : '';
|
||||
/** @type {string} */
|
||||
const sockPort = options.sockPort ? `&sockPort=${options.sockPort}` : '';
|
||||
/** @type {string} */
|
||||
const clientEntry = `${require.resolve(
|
||||
'../../client/'
|
||||
)}?${domain}${sockHost}${sockPath}${sockPort}`;
|
||||
|
||||
/** @type {(string[] | string)} */
|
||||
let hotEntry;
|
||||
|
||||
if (options.hotOnly) {
|
||||
hotEntry = require.resolve('webpack/hot/only-dev-server');
|
||||
} else if (options.hot) {
|
||||
hotEntry = require.resolve('webpack/hot/dev-server');
|
||||
}
|
||||
/**
|
||||
* prependEntry Method
|
||||
* @param {Entry} originalEntry
|
||||
* @param {Entry} additionalEntries
|
||||
* @returns {Entry}
|
||||
*/
|
||||
const prependEntry = (originalEntry, additionalEntries) => {
|
||||
if (typeof originalEntry === 'function') {
|
||||
return () =>
|
||||
Promise.resolve(originalEntry()).then((entry) =>
|
||||
prependEntry(entry, additionalEntries)
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof originalEntry === 'object' && !Array.isArray(originalEntry)) {
|
||||
/** @type {Object<string,string>} */
|
||||
const clone = {};
|
||||
|
||||
Object.keys(originalEntry).forEach((key) => {
|
||||
// entry[key] should be a string here
|
||||
const entryDescription = originalEntry[key];
|
||||
if (typeof entryDescription === 'object' && entryDescription.import) {
|
||||
clone[key] = Object.assign({}, entryDescription, {
|
||||
import: prependEntry(entryDescription.import, additionalEntries),
|
||||
});
|
||||
} else {
|
||||
clone[key] = prependEntry(entryDescription, additionalEntries);
|
||||
}
|
||||
});
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
// in this case, entry is a string or an array.
|
||||
// make sure that we do not add duplicates.
|
||||
/** @type {Entry} */
|
||||
const entriesClone = additionalEntries.slice(0);
|
||||
[].concat(originalEntry).forEach((newEntry) => {
|
||||
if (!entriesClone.includes(newEntry)) {
|
||||
entriesClone.push(newEntry);
|
||||
}
|
||||
});
|
||||
return entriesClone;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* Description of the option for checkInject method
|
||||
* @typedef {Function} checkInjectOptionsParam
|
||||
* @param {Object} _config - compilerConfig
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Boolean | checkInjectOptionsParam} option - inject(Hot|Client) it is Boolean | fn => Boolean
|
||||
* @param {Object} _config
|
||||
* @param {Boolean} defaultValue
|
||||
* @return {Boolean}
|
||||
*/
|
||||
// eslint-disable-next-line no-shadow
|
||||
const checkInject = (option, _config, defaultValue) => {
|
||||
if (typeof option === 'boolean') return option;
|
||||
if (typeof option === 'function') return option(_config);
|
||||
return defaultValue;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
[].concat(config).forEach((config) => {
|
||||
/** @type {Boolean} */
|
||||
const webTarget = [
|
||||
'web',
|
||||
'webworker',
|
||||
'electron-renderer',
|
||||
'node-webkit',
|
||||
undefined, // eslint-disable-line
|
||||
null,
|
||||
].includes(config.target);
|
||||
/** @type {Entry} */
|
||||
const additionalEntries = checkInject(
|
||||
options.injectClient,
|
||||
config,
|
||||
webTarget
|
||||
)
|
||||
? [clientEntry]
|
||||
: [];
|
||||
|
||||
if (hotEntry && checkInject(options.injectHot, config, true)) {
|
||||
additionalEntries.push(hotEntry);
|
||||
}
|
||||
|
||||
config.entry = prependEntry(config.entry || './src', additionalEntries);
|
||||
|
||||
if (options.hot || options.hotOnly) {
|
||||
config.plugins = config.plugins || [];
|
||||
if (
|
||||
!config.plugins.find(
|
||||
// Check for the name rather than the constructor reference in case
|
||||
// there are multiple copies of webpack installed
|
||||
(plugin) => plugin.constructor.name === 'HotModuleReplacementPlugin'
|
||||
)
|
||||
) {
|
||||
config.plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = addEntries;
|
||||
22
node_modules/webpack-dev-server/lib/utils/colors.js
generated
vendored
Executable file
22
node_modules/webpack-dev-server/lib/utils/colors.js
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
const colors = {
|
||||
info(useColor, msg) {
|
||||
if (useColor) {
|
||||
// Make text blue and bold, so it *pops*
|
||||
return `\u001b[1m\u001b[34m${msg}\u001b[39m\u001b[22m`;
|
||||
}
|
||||
|
||||
return msg;
|
||||
},
|
||||
error(useColor, msg) {
|
||||
if (useColor) {
|
||||
// Make text red and bold, so it *pops*
|
||||
return `\u001b[1m\u001b[31m${msg}\u001b[39m\u001b[22m`;
|
||||
}
|
||||
|
||||
return msg;
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = colors;
|
||||
69
node_modules/webpack-dev-server/lib/utils/createCertificate.js
generated
vendored
Executable file
69
node_modules/webpack-dev-server/lib/utils/createCertificate.js
generated
vendored
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
'use strict';
|
||||
|
||||
const selfsigned = require('selfsigned');
|
||||
|
||||
function createCertificate(attributes) {
|
||||
return selfsigned.generate(attributes, {
|
||||
algorithm: 'sha256',
|
||||
days: 30,
|
||||
keySize: 2048,
|
||||
extensions: [
|
||||
// {
|
||||
// name: 'basicConstraints',
|
||||
// cA: true,
|
||||
// },
|
||||
{
|
||||
name: 'keyUsage',
|
||||
keyCertSign: true,
|
||||
digitalSignature: true,
|
||||
nonRepudiation: true,
|
||||
keyEncipherment: true,
|
||||
dataEncipherment: true,
|
||||
},
|
||||
{
|
||||
name: 'extKeyUsage',
|
||||
serverAuth: true,
|
||||
clientAuth: true,
|
||||
codeSigning: true,
|
||||
timeStamping: true,
|
||||
},
|
||||
{
|
||||
name: 'subjectAltName',
|
||||
altNames: [
|
||||
{
|
||||
// type 2 is DNS
|
||||
type: 2,
|
||||
value: 'localhost',
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: 'localhost.localdomain',
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: 'lvh.me',
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: '*.lvh.me',
|
||||
},
|
||||
{
|
||||
type: 2,
|
||||
value: '[::1]',
|
||||
},
|
||||
{
|
||||
// type 7 is IP
|
||||
type: 7,
|
||||
ip: '127.0.0.1',
|
||||
},
|
||||
{
|
||||
type: 7,
|
||||
ip: 'fe80::1',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = createCertificate;
|
||||
233
node_modules/webpack-dev-server/lib/utils/createConfig.js
generated
vendored
Executable file
233
node_modules/webpack-dev-server/lib/utils/createConfig.js
generated
vendored
Executable file
|
|
@ -0,0 +1,233 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const isAbsoluteUrl = require('is-absolute-url');
|
||||
const defaultTo = require('./defaultTo');
|
||||
|
||||
function createConfig(config, argv, { port }) {
|
||||
const firstWpOpt = Array.isArray(config) ? config[0] : config;
|
||||
const options = firstWpOpt.devServer || {};
|
||||
|
||||
// This updates both config and firstWpOpt
|
||||
firstWpOpt.mode = defaultTo(firstWpOpt.mode, 'development');
|
||||
|
||||
if (argv.bonjour) {
|
||||
options.bonjour = true;
|
||||
}
|
||||
|
||||
if (argv.host && (argv.host !== 'localhost' || !options.host)) {
|
||||
options.host = argv.host;
|
||||
}
|
||||
|
||||
if (argv.allowedHosts) {
|
||||
options.allowedHosts = argv.allowedHosts.split(',');
|
||||
}
|
||||
|
||||
if (argv.public) {
|
||||
options.public = argv.public;
|
||||
}
|
||||
|
||||
if (argv.socket) {
|
||||
options.socket = argv.socket;
|
||||
}
|
||||
|
||||
if (argv.sockHost) {
|
||||
options.sockHost = argv.sockHost;
|
||||
}
|
||||
|
||||
if (argv.sockPath) {
|
||||
options.sockPath = argv.sockPath;
|
||||
}
|
||||
|
||||
if (argv.sockPort) {
|
||||
options.sockPort = argv.sockPort;
|
||||
}
|
||||
|
||||
if (argv.liveReload === false) {
|
||||
options.liveReload = false;
|
||||
}
|
||||
|
||||
if (argv.profile) {
|
||||
options.profile = argv.profile;
|
||||
}
|
||||
|
||||
if (argv.progress) {
|
||||
options.progress = argv.progress;
|
||||
}
|
||||
|
||||
if (argv.overlay) {
|
||||
options.overlay = argv.overlay;
|
||||
}
|
||||
|
||||
if (!options.publicPath) {
|
||||
// eslint-disable-next-line
|
||||
options.publicPath =
|
||||
(firstWpOpt.output && firstWpOpt.output.publicPath) || '';
|
||||
|
||||
if (
|
||||
!isAbsoluteUrl(String(options.publicPath)) &&
|
||||
options.publicPath[0] !== '/'
|
||||
) {
|
||||
options.publicPath = `/${options.publicPath}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.filename && firstWpOpt.output && firstWpOpt.output.filename) {
|
||||
options.filename = firstWpOpt.output && firstWpOpt.output.filename;
|
||||
}
|
||||
|
||||
if (!options.watchOptions && firstWpOpt.watchOptions) {
|
||||
options.watchOptions = firstWpOpt.watchOptions;
|
||||
}
|
||||
|
||||
if (argv.stdin) {
|
||||
process.stdin.on('end', () => {
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
process.stdin.resume();
|
||||
}
|
||||
|
||||
// TODO https://github.com/webpack/webpack-dev-server/issues/616 (v4)
|
||||
// We should prefer CLI arg under config, now we always prefer `hot` from `devServer`
|
||||
if (!options.hot) {
|
||||
options.hot = argv.hot;
|
||||
}
|
||||
|
||||
// TODO https://github.com/webpack/webpack-dev-server/issues/616 (v4)
|
||||
// We should prefer CLI arg under config, now we always prefer `hotOnly` from `devServer`
|
||||
if (!options.hotOnly) {
|
||||
options.hotOnly = argv.hotOnly;
|
||||
}
|
||||
|
||||
// TODO https://github.com/webpack/webpack-dev-server/issues/616 (v4)
|
||||
// We should prefer CLI arg under config, now we always prefer `clientLogLevel` from `devServer`
|
||||
if (!options.clientLogLevel && argv.clientLogLevel) {
|
||||
options.clientLogLevel = argv.clientLogLevel;
|
||||
}
|
||||
|
||||
if (argv.contentBase) {
|
||||
options.contentBase = argv.contentBase;
|
||||
|
||||
if (Array.isArray(options.contentBase)) {
|
||||
options.contentBase = options.contentBase.map((p) => path.resolve(p));
|
||||
} else if (/^[0-9]$/.test(options.contentBase)) {
|
||||
options.contentBase = +options.contentBase;
|
||||
} else if (!isAbsoluteUrl(String(options.contentBase))) {
|
||||
options.contentBase = path.resolve(options.contentBase);
|
||||
}
|
||||
}
|
||||
// It is possible to disable the contentBase by using
|
||||
// `--no-content-base`, which results in arg["content-base"] = false
|
||||
else if (argv.contentBase === false) {
|
||||
options.contentBase = false;
|
||||
}
|
||||
|
||||
if (argv.watchContentBase) {
|
||||
options.watchContentBase = true;
|
||||
}
|
||||
|
||||
if (!options.stats) {
|
||||
options.stats = defaultTo(firstWpOpt.stats, {
|
||||
cached: false,
|
||||
cachedAssets: false,
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
typeof options.stats === 'object' &&
|
||||
typeof options.stats.colors === 'undefined' &&
|
||||
argv.color
|
||||
) {
|
||||
options.stats = Object.assign({}, options.stats, { colors: argv.color });
|
||||
}
|
||||
|
||||
if (argv.lazy) {
|
||||
options.lazy = true;
|
||||
}
|
||||
|
||||
// TODO remove in `v4`
|
||||
if (!argv.info) {
|
||||
options.noInfo = true;
|
||||
}
|
||||
|
||||
// TODO remove in `v4`
|
||||
if (argv.quiet) {
|
||||
options.quiet = true;
|
||||
}
|
||||
|
||||
if (argv.https) {
|
||||
options.https = true;
|
||||
}
|
||||
|
||||
if (argv.http2) {
|
||||
options.http2 = true;
|
||||
}
|
||||
|
||||
if (argv.key) {
|
||||
options.key = argv.key;
|
||||
}
|
||||
|
||||
if (argv.cert) {
|
||||
options.cert = argv.cert;
|
||||
}
|
||||
|
||||
if (argv.cacert) {
|
||||
options.ca = argv.cacert;
|
||||
}
|
||||
|
||||
if (argv.pfx) {
|
||||
options.pfx = argv.pfx;
|
||||
}
|
||||
|
||||
if (argv.pfxPassphrase) {
|
||||
options.pfxPassphrase = argv.pfxPassphrase;
|
||||
}
|
||||
|
||||
if (argv.inline === false) {
|
||||
options.inline = false;
|
||||
}
|
||||
|
||||
if (argv.historyApiFallback) {
|
||||
options.historyApiFallback = true;
|
||||
}
|
||||
|
||||
if (argv.compress) {
|
||||
options.compress = true;
|
||||
}
|
||||
|
||||
if (argv.disableHostCheck) {
|
||||
options.disableHostCheck = true;
|
||||
}
|
||||
|
||||
if (argv.openPage) {
|
||||
options.open = true;
|
||||
options.openPage = argv.openPage.split(',');
|
||||
}
|
||||
|
||||
if (typeof argv.open !== 'undefined') {
|
||||
options.open = argv.open !== '' ? argv.open : true;
|
||||
}
|
||||
|
||||
if (options.open && !options.openPage) {
|
||||
options.openPage = '';
|
||||
}
|
||||
|
||||
if (argv.useLocalIp) {
|
||||
options.useLocalIp = true;
|
||||
}
|
||||
|
||||
// Kind of weird, but ensures prior behavior isn't broken in cases
|
||||
// that wouldn't throw errors. E.g. both argv.port and options.port
|
||||
// were specified, but since argv.port is 8080, options.port will be
|
||||
// tried first instead.
|
||||
options.port =
|
||||
argv.port === port
|
||||
? defaultTo(options.port, argv.port)
|
||||
: defaultTo(argv.port, options.port);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
module.exports = createConfig;
|
||||
29
node_modules/webpack-dev-server/lib/utils/createDomain.js
generated
vendored
Executable file
29
node_modules/webpack-dev-server/lib/utils/createDomain.js
generated
vendored
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
'use strict';
|
||||
|
||||
const url = require('url');
|
||||
const ip = require('internal-ip');
|
||||
|
||||
function createDomain(options, server) {
|
||||
const protocol = options.https ? 'https' : 'http';
|
||||
const hostname = options.useLocalIp
|
||||
? ip.v4.sync() || 'localhost'
|
||||
: options.host || 'localhost';
|
||||
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
const port = options.socket ? 0 : server ? server.address().port : 0;
|
||||
// use explicitly defined public url
|
||||
// (prefix with protocol if not explicitly given)
|
||||
if (options.public) {
|
||||
return /^[a-zA-Z]+:\/\//.test(options.public)
|
||||
? `${options.public}`
|
||||
: `${protocol}://${options.public}`;
|
||||
}
|
||||
// the formatted domain (url without path) of the webpack server
|
||||
return url.format({
|
||||
protocol,
|
||||
hostname,
|
||||
port,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = createDomain;
|
||||
23
node_modules/webpack-dev-server/lib/utils/createLogger.js
generated
vendored
Executable file
23
node_modules/webpack-dev-server/lib/utils/createLogger.js
generated
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
const log = require('webpack-log');
|
||||
|
||||
function createLogger(options = {}) {
|
||||
let level = options.logLevel || 'info';
|
||||
|
||||
if (options.noInfo === true) {
|
||||
level = 'warn';
|
||||
}
|
||||
|
||||
if (options.quiet === true) {
|
||||
level = 'silent';
|
||||
}
|
||||
|
||||
return log({
|
||||
name: 'wds',
|
||||
level,
|
||||
timestamp: options.logTime,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = createLogger;
|
||||
3
node_modules/webpack-dev-server/lib/utils/defaultPort.js
generated
vendored
Executable file
3
node_modules/webpack-dev-server/lib/utils/defaultPort.js
generated
vendored
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = 8080;
|
||||
7
node_modules/webpack-dev-server/lib/utils/defaultTo.js
generated
vendored
Executable file
7
node_modules/webpack-dev-server/lib/utils/defaultTo.js
generated
vendored
Executable file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
function defaultTo(value, def) {
|
||||
return value == null ? def : value;
|
||||
}
|
||||
|
||||
module.exports = defaultTo;
|
||||
39
node_modules/webpack-dev-server/lib/utils/findPort.js
generated
vendored
Executable file
39
node_modules/webpack-dev-server/lib/utils/findPort.js
generated
vendored
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
const pRetry = require('p-retry');
|
||||
const portfinder = require('portfinder');
|
||||
const defaultPort = require('./defaultPort');
|
||||
const defaultTo = require('./defaultTo');
|
||||
const tryParseInt = require('./tryParseInt');
|
||||
|
||||
function runPortFinder() {
|
||||
return new Promise((resolve, reject) => {
|
||||
portfinder.basePort = defaultPort;
|
||||
portfinder.getPort((error, port) => {
|
||||
if (error) {
|
||||
return reject(error);
|
||||
}
|
||||
|
||||
return resolve(port);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function findPort(port) {
|
||||
if (port) {
|
||||
return Promise.resolve(port);
|
||||
}
|
||||
|
||||
// Try to find unused port and listen on it for 3 times,
|
||||
// if port is not specified in options.
|
||||
// Because NaN == null is false, defaultTo fails if parseInt returns NaN
|
||||
// so the tryParseInt function is introduced to handle NaN
|
||||
const defaultPortRetry = defaultTo(
|
||||
tryParseInt(process.env.DEFAULT_PORT_RETRY),
|
||||
3
|
||||
);
|
||||
|
||||
return pRetry(runPortFinder, { retries: defaultPortRetry });
|
||||
}
|
||||
|
||||
module.exports = findPort;
|
||||
45
node_modules/webpack-dev-server/lib/utils/getCertificate.js
generated
vendored
Executable file
45
node_modules/webpack-dev-server/lib/utils/getCertificate.js
generated
vendored
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const del = require('del');
|
||||
const createCertificate = require('./createCertificate');
|
||||
|
||||
function getCertificate(logger) {
|
||||
// Use a self-signed certificate if no certificate was configured.
|
||||
// Cycle certs every 24 hours
|
||||
const certificatePath = path.join(__dirname, '../../ssl/server.pem');
|
||||
|
||||
let certificateExists = fs.existsSync(certificatePath);
|
||||
|
||||
if (certificateExists) {
|
||||
const certificateTtl = 1000 * 60 * 60 * 24;
|
||||
const certificateStat = fs.statSync(certificatePath);
|
||||
|
||||
const now = new Date();
|
||||
|
||||
// cert is more than 30 days old, kill it with fire
|
||||
if ((now - certificateStat.ctime) / certificateTtl > 30) {
|
||||
logger.info('SSL Certificate is more than 30 days old. Removing.');
|
||||
|
||||
del.sync([certificatePath], { force: true });
|
||||
|
||||
certificateExists = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!certificateExists) {
|
||||
logger.info('Generating SSL Certificate');
|
||||
|
||||
const attributes = [{ name: 'commonName', value: 'localhost' }];
|
||||
const pems = createCertificate(attributes);
|
||||
|
||||
fs.writeFileSync(certificatePath, pems.private + pems.cert, {
|
||||
encoding: 'utf8',
|
||||
});
|
||||
}
|
||||
|
||||
return fs.readFileSync(certificatePath);
|
||||
}
|
||||
|
||||
module.exports = getCertificate;
|
||||
37
node_modules/webpack-dev-server/lib/utils/getSocketClientPath.js
generated
vendored
Executable file
37
node_modules/webpack-dev-server/lib/utils/getSocketClientPath.js
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
function getSocketClientPath(options) {
|
||||
let ClientImplementation;
|
||||
let clientImplFound = true;
|
||||
switch (typeof options.transportMode.client) {
|
||||
case 'string':
|
||||
// could be 'sockjs', 'ws', or a path that should be required
|
||||
if (options.transportMode.client === 'sockjs') {
|
||||
ClientImplementation = require('../../client/clients/SockJSClient');
|
||||
} else if (options.transportMode.client === 'ws') {
|
||||
ClientImplementation = require('../../client/clients/WebsocketClient');
|
||||
} else {
|
||||
try {
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
ClientImplementation = require(options.transportMode.client);
|
||||
} catch (e) {
|
||||
clientImplFound = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
clientImplFound = false;
|
||||
}
|
||||
|
||||
if (!clientImplFound) {
|
||||
throw new Error(
|
||||
"transportMode.client must be a string denoting a default implementation (e.g. 'sockjs', 'ws') or a full path to " +
|
||||
'a JS file which exports a class extending BaseClient (webpack-dev-server/client-src/clients/BaseClient) ' +
|
||||
'via require.resolve(...)'
|
||||
);
|
||||
}
|
||||
|
||||
return ClientImplementation.getClientPath(options);
|
||||
}
|
||||
|
||||
module.exports = getSocketClientPath;
|
||||
42
node_modules/webpack-dev-server/lib/utils/getSocketServerImplementation.js
generated
vendored
Executable file
42
node_modules/webpack-dev-server/lib/utils/getSocketServerImplementation.js
generated
vendored
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
'use strict';
|
||||
|
||||
function getSocketServerImplementation(options) {
|
||||
let ServerImplementation;
|
||||
let serverImplFound = true;
|
||||
switch (typeof options.transportMode.server) {
|
||||
case 'string':
|
||||
// could be 'sockjs', in the future 'ws', or a path that should be required
|
||||
if (options.transportMode.server === 'sockjs') {
|
||||
ServerImplementation = require('../servers/SockJSServer');
|
||||
} else if (options.transportMode.server === 'ws') {
|
||||
ServerImplementation = require('../servers/WebsocketServer');
|
||||
} else {
|
||||
try {
|
||||
// eslint-disable-next-line import/no-dynamic-require
|
||||
ServerImplementation = require(options.transportMode.server);
|
||||
} catch (e) {
|
||||
serverImplFound = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'function':
|
||||
// potentially do more checks here to confirm that the user implemented this properlly
|
||||
// since errors could be difficult to understand
|
||||
ServerImplementation = options.transportMode.server;
|
||||
break;
|
||||
default:
|
||||
serverImplFound = false;
|
||||
}
|
||||
|
||||
if (!serverImplFound) {
|
||||
throw new Error(
|
||||
"transportMode.server must be a string denoting a default implementation (e.g. 'sockjs', 'ws'), a full path to " +
|
||||
'a JS file which exports a class extending BaseServer (webpack-dev-server/lib/servers/BaseServer) ' +
|
||||
'via require.resolve(...), or the class itself which extends BaseServer'
|
||||
);
|
||||
}
|
||||
|
||||
return ServerImplementation;
|
||||
}
|
||||
|
||||
module.exports = getSocketServerImplementation;
|
||||
10
node_modules/webpack-dev-server/lib/utils/getVersions.js
generated
vendored
Executable file
10
node_modules/webpack-dev-server/lib/utils/getVersions.js
generated
vendored
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
function getVersions() {
|
||||
return (
|
||||
`webpack-dev-server ${require('../../package.json').version}\n` +
|
||||
`webpack ${require('webpack/package.json').version}`
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = getVersions;
|
||||
41
node_modules/webpack-dev-server/lib/utils/normalizeOptions.js
generated
vendored
Executable file
41
node_modules/webpack-dev-server/lib/utils/normalizeOptions.js
generated
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
|
||||
/* eslint-disable
|
||||
no-undefined
|
||||
*/
|
||||
|
||||
function normalizeOptions(compiler, options) {
|
||||
// Setup default value
|
||||
options.contentBase =
|
||||
options.contentBase !== undefined ? options.contentBase : process.cwd();
|
||||
|
||||
// Setup default value
|
||||
options.contentBasePublicPath = options.contentBasePublicPath || '/';
|
||||
|
||||
// normalize transportMode option
|
||||
if (options.transportMode === undefined) {
|
||||
options.transportMode = {
|
||||
server: 'sockjs',
|
||||
client: 'sockjs',
|
||||
};
|
||||
} else {
|
||||
switch (typeof options.transportMode) {
|
||||
case 'string':
|
||||
options.transportMode = {
|
||||
server: options.transportMode,
|
||||
client: options.transportMode,
|
||||
};
|
||||
break;
|
||||
// if not a string, it is an object
|
||||
default:
|
||||
options.transportMode.server = options.transportMode.server || 'sockjs';
|
||||
options.transportMode.client = options.transportMode.client || 'sockjs';
|
||||
}
|
||||
}
|
||||
|
||||
if (!options.watchOptions) {
|
||||
options.watchOptions = {};
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = normalizeOptions;
|
||||
44
node_modules/webpack-dev-server/lib/utils/processOptions.js
generated
vendored
Executable file
44
node_modules/webpack-dev-server/lib/utils/processOptions.js
generated
vendored
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
'use strict';
|
||||
|
||||
const createConfig = require('./createConfig');
|
||||
const defaultPort = require('./defaultPort');
|
||||
const findPort = require('./findPort');
|
||||
|
||||
function processOptions(config, argv, callback) {
|
||||
// processOptions {Promise}
|
||||
if (typeof config.then === 'function') {
|
||||
config
|
||||
.then((conf) => processOptions(conf, argv, callback))
|
||||
.catch((err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err.stack || err);
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Taken out of yargs because we must know if
|
||||
// it wasn't given by the user, in which case
|
||||
// we should use portfinder.
|
||||
const options = createConfig(config, argv, { port: defaultPort });
|
||||
|
||||
if (options.socket) {
|
||||
callback(config, options);
|
||||
} else {
|
||||
findPort(options.port)
|
||||
.then((port) => {
|
||||
options.port = port;
|
||||
callback(config, options);
|
||||
})
|
||||
.catch((err) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err.stack || err);
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = processOptions;
|
||||
98
node_modules/webpack-dev-server/lib/utils/routes.js
generated
vendored
Executable file
98
node_modules/webpack-dev-server/lib/utils/routes.js
generated
vendored
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
'use strict';
|
||||
|
||||
const { createReadStream } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
const clientBasePath = join(__dirname, '..', '..', 'client');
|
||||
|
||||
function routes(server) {
|
||||
const app = server.app;
|
||||
const middleware = server.middleware;
|
||||
const options = server.options;
|
||||
|
||||
app.get('/__webpack_dev_server__/live.bundle.js', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/javascript');
|
||||
|
||||
createReadStream(join(clientBasePath, 'live.bundle.js')).pipe(res);
|
||||
});
|
||||
|
||||
app.get('/__webpack_dev_server__/sockjs.bundle.js', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/javascript');
|
||||
|
||||
createReadStream(join(clientBasePath, 'sockjs.bundle.js')).pipe(res);
|
||||
});
|
||||
|
||||
app.get('/webpack-dev-server.js', (req, res) => {
|
||||
res.setHeader('Content-Type', 'application/javascript');
|
||||
|
||||
createReadStream(join(clientBasePath, 'index.bundle.js')).pipe(res);
|
||||
});
|
||||
|
||||
app.get('/webpack-dev-server/invalidate', (_req, res) => {
|
||||
server.invalidate();
|
||||
res.end();
|
||||
});
|
||||
|
||||
app.get('/webpack-dev-server/*', (req, res) => {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
createReadStream(join(clientBasePath, 'live.html')).pipe(res);
|
||||
});
|
||||
|
||||
app.get('/webpack-dev-server', (req, res) => {
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
|
||||
res.write(
|
||||
'<!DOCTYPE html><html><head><meta charset="utf-8"/></head><body>'
|
||||
);
|
||||
|
||||
const outputPath = middleware.getFilenameFromUrl(options.publicPath || '/');
|
||||
const filesystem = middleware.fileSystem;
|
||||
|
||||
writeDirectory(options.publicPath || '/', outputPath);
|
||||
|
||||
res.end('</body></html>');
|
||||
|
||||
function writeDirectory(baseUrl, basePath) {
|
||||
const content = filesystem.readdirSync(basePath);
|
||||
|
||||
res.write('<ul>');
|
||||
|
||||
content.forEach((item) => {
|
||||
const p = `${basePath}/${item}`;
|
||||
|
||||
if (filesystem.statSync(p).isFile()) {
|
||||
res.write(`<li><a href="${baseUrl + item}">${item}</a></li>`);
|
||||
|
||||
if (/\.js$/.test(item)) {
|
||||
const html = item.substr(0, item.length - 3);
|
||||
const containerHref = baseUrl + html;
|
||||
|
||||
const magicHtmlHref =
|
||||
baseUrl.replace(
|
||||
// eslint-disable-next-line
|
||||
/(^(https?:\/\/[^\/]+)?\/)/,
|
||||
'$1webpack-dev-server/'
|
||||
) + html;
|
||||
|
||||
res.write(
|
||||
`<li><a href="${containerHref}">${html}</a>` +
|
||||
` (magic html for ${item}) (<a href="${magicHtmlHref}">webpack-dev-server</a>)` +
|
||||
`</li>`
|
||||
);
|
||||
}
|
||||
} else {
|
||||
res.write(`<li>${item}<br>`);
|
||||
|
||||
writeDirectory(`${baseUrl + item}/`, p);
|
||||
|
||||
res.write('</li>');
|
||||
}
|
||||
});
|
||||
|
||||
res.write('</ul>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = routes;
|
||||
21
node_modules/webpack-dev-server/lib/utils/runBonjour.js
generated
vendored
Executable file
21
node_modules/webpack-dev-server/lib/utils/runBonjour.js
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
function runBonjour({ port }) {
|
||||
const bonjour = require('bonjour')();
|
||||
const os = require('os');
|
||||
|
||||
bonjour.publish({
|
||||
name: `Webpack Dev Server ${os.hostname()}:${port}`,
|
||||
port,
|
||||
type: 'http',
|
||||
subtypes: ['webpack'],
|
||||
});
|
||||
|
||||
process.on('exit', () => {
|
||||
bonjour.unpublishAll(() => {
|
||||
bonjour.destroy();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = runBonjour;
|
||||
37
node_modules/webpack-dev-server/lib/utils/runOpen.js
generated
vendored
Executable file
37
node_modules/webpack-dev-server/lib/utils/runOpen.js
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
const open = require('opn');
|
||||
const isAbsoluteUrl = require('is-absolute-url');
|
||||
|
||||
function runOpen(uri, options, log) {
|
||||
// https://github.com/webpack/webpack-dev-server/issues/1990
|
||||
let openOptions = { wait: false };
|
||||
let openOptionValue = '';
|
||||
|
||||
if (typeof options.open === 'string') {
|
||||
openOptions = Object.assign({}, openOptions, { app: options.open });
|
||||
openOptionValue = `: "${options.open}"`;
|
||||
} else if (typeof options.open === 'object') {
|
||||
openOptions = options.open;
|
||||
openOptionValue = `: "${JSON.stringify(options.open)}"`;
|
||||
}
|
||||
|
||||
const pages =
|
||||
typeof options.openPage === 'string'
|
||||
? [options.openPage]
|
||||
: options.openPage || [''];
|
||||
|
||||
return Promise.all(
|
||||
pages.map((page) => {
|
||||
const pageUrl = page && isAbsoluteUrl(page) ? page : `${uri}${page}`;
|
||||
|
||||
return open(pageUrl, openOptions).catch(() => {
|
||||
log.warn(
|
||||
`Unable to open "${pageUrl}" in browser${openOptionValue}. If you are running in a headless environment, please do not use the --open flag`
|
||||
);
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = runOpen;
|
||||
21
node_modules/webpack-dev-server/lib/utils/setupExitSignals.js
generated
vendored
Executable file
21
node_modules/webpack-dev-server/lib/utils/setupExitSignals.js
generated
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
const signals = ['SIGINT', 'SIGTERM'];
|
||||
|
||||
function setupExitSignals(serverData) {
|
||||
signals.forEach((signal) => {
|
||||
process.on(signal, () => {
|
||||
if (serverData && serverData.server) {
|
||||
serverData.server.close(() => {
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit();
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line no-process-exit
|
||||
process.exit();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = setupExitSignals;
|
||||
61
node_modules/webpack-dev-server/lib/utils/status.js
generated
vendored
Executable file
61
node_modules/webpack-dev-server/lib/utils/status.js
generated
vendored
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
'use strict';
|
||||
|
||||
const logger = require('webpack-log');
|
||||
const colors = require('./colors');
|
||||
const runOpen = require('./runOpen');
|
||||
|
||||
// TODO: don't emit logs when webpack-dev-server is used via Node.js API
|
||||
function status(uri, options, log, useColor) {
|
||||
if (options.quiet === true) {
|
||||
// Add temporary logger to output just the status of the dev server
|
||||
log = logger({
|
||||
name: 'wds',
|
||||
level: 'info',
|
||||
timestamp: options.logTime,
|
||||
});
|
||||
}
|
||||
|
||||
const contentBase = Array.isArray(options.contentBase)
|
||||
? options.contentBase.join(', ')
|
||||
: options.contentBase;
|
||||
|
||||
if (options.socket) {
|
||||
log.info(`Listening to socket at ${colors.info(useColor, options.socket)}`);
|
||||
} else {
|
||||
log.info(`Project is running at ${colors.info(useColor, uri)}`);
|
||||
}
|
||||
|
||||
log.info(
|
||||
`webpack output is served from ${colors.info(useColor, options.publicPath)}`
|
||||
);
|
||||
|
||||
if (contentBase) {
|
||||
log.info(
|
||||
`Content not from webpack is served from ${colors.info(
|
||||
useColor,
|
||||
contentBase
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
if (options.historyApiFallback) {
|
||||
log.info(
|
||||
`404s will fallback to ${colors.info(
|
||||
useColor,
|
||||
options.historyApiFallback.index || '/index.html'
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
if (options.bonjour) {
|
||||
log.info(
|
||||
'Broadcasting "http" with subtype of "webpack" via ZeroConf DNS (Bonjour)'
|
||||
);
|
||||
}
|
||||
|
||||
if (options.open) {
|
||||
runOpen(uri, options, log);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = status;
|
||||
13
node_modules/webpack-dev-server/lib/utils/tryParseInt.js
generated
vendored
Executable file
13
node_modules/webpack-dev-server/lib/utils/tryParseInt.js
generated
vendored
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
'use strict';
|
||||
|
||||
function tryParseInt(input) {
|
||||
const output = parseInt(input, 10);
|
||||
|
||||
if (Number.isNaN(output)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = tryParseInt;
|
||||
73
node_modules/webpack-dev-server/lib/utils/updateCompiler.js
generated
vendored
Executable file
73
node_modules/webpack-dev-server/lib/utils/updateCompiler.js
generated
vendored
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
'use strict';
|
||||
|
||||
/* eslint-disable
|
||||
no-shadow,
|
||||
no-undefined
|
||||
*/
|
||||
const webpack = require('webpack');
|
||||
const addEntries = require('./addEntries');
|
||||
const getSocketClientPath = require('./getSocketClientPath');
|
||||
|
||||
function updateCompiler(compiler, options) {
|
||||
if (options.inline !== false) {
|
||||
const findHMRPlugin = (config) => {
|
||||
if (!config.plugins) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return config.plugins.find(
|
||||
(plugin) => plugin.constructor === webpack.HotModuleReplacementPlugin
|
||||
);
|
||||
};
|
||||
|
||||
const compilers = [];
|
||||
const compilersWithoutHMR = [];
|
||||
let webpackConfig;
|
||||
if (compiler.compilers) {
|
||||
webpackConfig = [];
|
||||
compiler.compilers.forEach((compiler) => {
|
||||
webpackConfig.push(compiler.options);
|
||||
compilers.push(compiler);
|
||||
if (!findHMRPlugin(compiler.options)) {
|
||||
compilersWithoutHMR.push(compiler);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
webpackConfig = compiler.options;
|
||||
compilers.push(compiler);
|
||||
if (!findHMRPlugin(compiler.options)) {
|
||||
compilersWithoutHMR.push(compiler);
|
||||
}
|
||||
}
|
||||
|
||||
// it's possible that we should clone the config before doing
|
||||
// this, but it seems safe not to since it actually reflects
|
||||
// the changes we are making to the compiler
|
||||
// important: this relies on the fact that addEntries now
|
||||
// prevents duplicate new entries.
|
||||
addEntries(webpackConfig, options);
|
||||
compilers.forEach((compiler) => {
|
||||
const config = compiler.options;
|
||||
compiler.hooks.entryOption.call(config.context, config.entry);
|
||||
|
||||
const providePlugin = new webpack.ProvidePlugin({
|
||||
__webpack_dev_server_client__: getSocketClientPath(options),
|
||||
});
|
||||
providePlugin.apply(compiler);
|
||||
});
|
||||
|
||||
// do not apply the plugin unless it didn't exist before.
|
||||
if (options.hot || options.hotOnly) {
|
||||
compilersWithoutHMR.forEach((compiler) => {
|
||||
// addDevServerEntrypoints above should have added the plugin
|
||||
// to the compiler options
|
||||
const plugin = findHMRPlugin(compiler.options);
|
||||
if (plugin) {
|
||||
plugin.apply(compiler);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = updateCompiler;
|
||||
1
node_modules/webpack-dev-server/node_modules/.bin/mime
generated
vendored
Symbolic link
1
node_modules/webpack-dev-server/node_modules/.bin/mime
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../mime/cli.js
|
||||
1
node_modules/webpack-dev-server/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
1
node_modules/webpack-dev-server/node_modules/.bin/mkdirp
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../mkdirp/bin/cmd.js
|
||||
1
node_modules/webpack-dev-server/node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/webpack-dev-server/node_modules/.bin/semver
generated
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../semver/bin/semver.js
|
||||
20
node_modules/webpack-dev-server/node_modules/ajv/.tonic_example.js
generated
vendored
Executable file
20
node_modules/webpack-dev-server/node_modules/ajv/.tonic_example.js
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
var Ajv = require('ajv');
|
||||
var ajv = new Ajv({allErrors: true});
|
||||
|
||||
var schema = {
|
||||
"properties": {
|
||||
"foo": { "type": "string" },
|
||||
"bar": { "type": "number", "maximum": 3 }
|
||||
}
|
||||
};
|
||||
|
||||
var validate = ajv.compile(schema);
|
||||
|
||||
test({"foo": "abc", "bar": 2});
|
||||
test({"foo": 2, "bar": 4});
|
||||
|
||||
function test(data) {
|
||||
var valid = validate(data);
|
||||
if (valid) console.log('Valid!');
|
||||
else console.log('Invalid: ' + ajv.errorsText(validate.errors));
|
||||
}
|
||||
22
node_modules/webpack-dev-server/node_modules/ajv/LICENSE
generated
vendored
Executable file
22
node_modules/webpack-dev-server/node_modules/ajv/LICENSE
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017 Evgeny Poberezkin
|
||||
|
||||
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.
|
||||
|
||||
1497
node_modules/webpack-dev-server/node_modules/ajv/README.md
generated
vendored
Executable file
1497
node_modules/webpack-dev-server/node_modules/ajv/README.md
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
7189
node_modules/webpack-dev-server/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
Executable file
7189
node_modules/webpack-dev-server/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load diff
3
node_modules/webpack-dev-server/node_modules/ajv/dist/ajv.min.js
generated
vendored
Executable file
3
node_modules/webpack-dev-server/node_modules/ajv/dist/ajv.min.js
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
1
node_modules/webpack-dev-server/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
Executable file
1
node_modules/webpack-dev-server/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
397
node_modules/webpack-dev-server/node_modules/ajv/lib/ajv.d.ts
generated
vendored
Executable file
397
node_modules/webpack-dev-server/node_modules/ajv/lib/ajv.d.ts
generated
vendored
Executable file
|
|
@ -0,0 +1,397 @@
|
|||
declare var ajv: {
|
||||
(options?: ajv.Options): ajv.Ajv;
|
||||
new(options?: ajv.Options): ajv.Ajv;
|
||||
ValidationError: typeof AjvErrors.ValidationError;
|
||||
MissingRefError: typeof AjvErrors.MissingRefError;
|
||||
$dataMetaSchema: object;
|
||||
}
|
||||
|
||||
declare namespace AjvErrors {
|
||||
class ValidationError extends Error {
|
||||
constructor(errors: Array<ajv.ErrorObject>);
|
||||
|
||||
message: string;
|
||||
errors: Array<ajv.ErrorObject>;
|
||||
ajv: true;
|
||||
validation: true;
|
||||
}
|
||||
|
||||
class MissingRefError extends Error {
|
||||
constructor(baseId: string, ref: string, message?: string);
|
||||
static message: (baseId: string, ref: string) => string;
|
||||
|
||||
message: string;
|
||||
missingRef: string;
|
||||
missingSchema: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace ajv {
|
||||
type ValidationError = AjvErrors.ValidationError;
|
||||
|
||||
type MissingRefError = AjvErrors.MissingRefError;
|
||||
|
||||
interface Ajv {
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default).
|
||||
* @param {string|object|Boolean} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
validate(schemaKeyRef: object | string | boolean, data: any): boolean | PromiseLike<any>;
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @param {object|Boolean} schema schema object
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
compile(schema: object | boolean): ValidateFunction;
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and node-style callback.
|
||||
* @this Ajv
|
||||
* @param {object|Boolean} schema schema object
|
||||
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
|
||||
* @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function.
|
||||
* @return {PromiseLike<ValidateFunction>} validating function
|
||||
*/
|
||||
compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): PromiseLike<ValidateFunction>;
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addSchema(schema: Array<object> | object, key?: string): Ajv;
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @param {object} schema schema object
|
||||
* @param {string} key optional schema key
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addMetaSchema(schema: object, key?: string): Ajv;
|
||||
/**
|
||||
* Validate schema
|
||||
* @param {object|Boolean} schema schema to validate
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
validateSchema(schema: object | boolean): boolean;
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`). Returns undefined if keyRef can't be resolved to an existing schema.
|
||||
*/
|
||||
getSchema(keyRef: string): ValidateFunction | undefined;
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv;
|
||||
/**
|
||||
* Add custom format
|
||||
* @param {string} name format name
|
||||
* @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv;
|
||||
/**
|
||||
* Define custom keyword
|
||||
* @this Ajv
|
||||
* @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
|
||||
* @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addKeyword(keyword: string, definition: KeywordDefinition): Ajv;
|
||||
/**
|
||||
* Get keyword definition
|
||||
* @this Ajv
|
||||
* @param {string} keyword pre-defined or custom keyword.
|
||||
* @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
|
||||
*/
|
||||
getKeyword(keyword: string): object | boolean;
|
||||
/**
|
||||
* Remove keyword
|
||||
* @this Ajv
|
||||
* @param {string} keyword pre-defined or custom keyword.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
removeKeyword(keyword: string): Ajv;
|
||||
/**
|
||||
* Validate keyword
|
||||
* @this Ajv
|
||||
* @param {object} definition keyword definition object
|
||||
* @param {boolean} throwError true to throw exception if definition is invalid
|
||||
* @return {boolean} validation result
|
||||
*/
|
||||
validateKeyword(definition: KeywordDefinition, throwError: boolean): boolean;
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @param {Array<object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {string} human readable string with all errors descriptions
|
||||
*/
|
||||
errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
|
||||
errors?: Array<ErrorObject> | null;
|
||||
_opts: Options;
|
||||
}
|
||||
|
||||
interface CustomLogger {
|
||||
log(...args: any[]): any;
|
||||
warn(...args: any[]): any;
|
||||
error(...args: any[]): any;
|
||||
}
|
||||
|
||||
interface ValidateFunction {
|
||||
(
|
||||
data: any,
|
||||
dataPath?: string,
|
||||
parentData?: object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: object | Array<any>
|
||||
): boolean | PromiseLike<any>;
|
||||
schema?: object | boolean;
|
||||
errors?: null | Array<ErrorObject>;
|
||||
refs?: object;
|
||||
refVal?: Array<any>;
|
||||
root?: ValidateFunction | object;
|
||||
$async?: true;
|
||||
source?: object;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
$data?: boolean;
|
||||
allErrors?: boolean;
|
||||
verbose?: boolean;
|
||||
jsonPointers?: boolean;
|
||||
uniqueItems?: boolean;
|
||||
unicode?: boolean;
|
||||
format?: false | string;
|
||||
formats?: object;
|
||||
keywords?: object;
|
||||
unknownFormats?: true | string[] | 'ignore';
|
||||
schemas?: Array<object> | object;
|
||||
schemaId?: '$id' | 'id' | 'auto';
|
||||
missingRefs?: true | 'ignore' | 'fail';
|
||||
extendRefs?: true | 'ignore' | 'fail';
|
||||
loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike<object | boolean>;
|
||||
removeAdditional?: boolean | 'all' | 'failing';
|
||||
useDefaults?: boolean | 'empty' | 'shared';
|
||||
coerceTypes?: boolean | 'array';
|
||||
strictDefaults?: boolean | 'log';
|
||||
strictKeywords?: boolean | 'log';
|
||||
strictNumbers?: boolean;
|
||||
async?: boolean | string;
|
||||
transpile?: string | ((code: string) => string);
|
||||
meta?: boolean | object;
|
||||
validateSchema?: boolean | 'log';
|
||||
addUsedSchema?: boolean;
|
||||
inlineRefs?: boolean | number;
|
||||
passContext?: boolean;
|
||||
loopRequired?: number;
|
||||
ownProperties?: boolean;
|
||||
multipleOfPrecision?: boolean | number;
|
||||
errorDataPath?: string,
|
||||
messages?: boolean;
|
||||
sourceCode?: boolean;
|
||||
processCode?: (code: string, schema: object) => string;
|
||||
cache?: object;
|
||||
logger?: CustomLogger | false;
|
||||
nullable?: boolean;
|
||||
serialize?: ((schema: object | boolean) => any) | false;
|
||||
}
|
||||
|
||||
type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike<any>);
|
||||
type NumberFormatValidator = ((data: number) => boolean | PromiseLike<any>);
|
||||
|
||||
interface NumberFormatDefinition {
|
||||
type: "number",
|
||||
validate: NumberFormatValidator;
|
||||
compare?: (data1: number, data2: number) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
interface StringFormatDefinition {
|
||||
type?: "string",
|
||||
validate: FormatValidator;
|
||||
compare?: (data1: string, data2: string) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
type FormatDefinition = NumberFormatDefinition | StringFormatDefinition;
|
||||
|
||||
interface KeywordDefinition {
|
||||
type?: string | Array<string>;
|
||||
async?: boolean;
|
||||
$data?: boolean;
|
||||
errors?: boolean | string;
|
||||
metaSchema?: object;
|
||||
// schema: false makes validate not to expect schema (ValidateFunction)
|
||||
schema?: boolean;
|
||||
statements?: boolean;
|
||||
dependencies?: Array<string>;
|
||||
modifying?: boolean;
|
||||
valid?: boolean;
|
||||
// one and only one of the following properties should be present
|
||||
validate?: SchemaValidateFunction | ValidateFunction;
|
||||
compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction;
|
||||
macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean;
|
||||
inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string;
|
||||
}
|
||||
|
||||
interface CompilationContext {
|
||||
level: number;
|
||||
dataLevel: number;
|
||||
dataPathArr: string[];
|
||||
schema: any;
|
||||
schemaPath: string;
|
||||
baseId: string;
|
||||
async: boolean;
|
||||
opts: Options;
|
||||
formats: {
|
||||
[index: string]: FormatDefinition | undefined;
|
||||
};
|
||||
keywords: {
|
||||
[index: string]: KeywordDefinition | undefined;
|
||||
};
|
||||
compositeRule: boolean;
|
||||
validate: (schema: object) => boolean;
|
||||
util: {
|
||||
copy(obj: any, target?: any): any;
|
||||
toHash(source: string[]): { [index: string]: true | undefined };
|
||||
equal(obj: any, target: any): boolean;
|
||||
getProperty(str: string): string;
|
||||
schemaHasRules(schema: object, rules: any): string;
|
||||
escapeQuotes(str: string): string;
|
||||
toQuotedString(str: string): string;
|
||||
getData(jsonPointer: string, dataLevel: number, paths: string[]): string;
|
||||
escapeJsonPointer(str: string): string;
|
||||
unescapeJsonPointer(str: string): string;
|
||||
escapeFragment(str: string): string;
|
||||
unescapeFragment(str: string): string;
|
||||
};
|
||||
self: Ajv;
|
||||
}
|
||||
|
||||
interface SchemaValidateFunction {
|
||||
(
|
||||
schema: any,
|
||||
data: any,
|
||||
parentSchema?: object,
|
||||
dataPath?: string,
|
||||
parentData?: object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: object | Array<any>
|
||||
): boolean | PromiseLike<any>;
|
||||
errors?: Array<ErrorObject>;
|
||||
}
|
||||
|
||||
interface ErrorsTextOptions {
|
||||
separator?: string;
|
||||
dataVar?: string;
|
||||
}
|
||||
|
||||
interface ErrorObject {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
schemaPath: string;
|
||||
params: ErrorParameters;
|
||||
// Added to validation errors of propertyNames keyword schema
|
||||
propertyName?: string;
|
||||
// Excluded if messages set to false.
|
||||
message?: string;
|
||||
// These are added with the `verbose` option.
|
||||
schema?: any;
|
||||
parentSchema?: object;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams |
|
||||
DependenciesParams | FormatParams | ComparisonParams |
|
||||
MultipleOfParams | PatternParams | RequiredParams |
|
||||
TypeParams | UniqueItemsParams | CustomParams |
|
||||
PatternRequiredParams | PropertyNamesParams |
|
||||
IfParams | SwitchParams | NoParams | EnumParams;
|
||||
|
||||
interface RefParams {
|
||||
ref: string;
|
||||
}
|
||||
|
||||
interface LimitParams {
|
||||
limit: number;
|
||||
}
|
||||
|
||||
interface AdditionalPropertiesParams {
|
||||
additionalProperty: string;
|
||||
}
|
||||
|
||||
interface DependenciesParams {
|
||||
property: string;
|
||||
missingProperty: string;
|
||||
depsCount: number;
|
||||
deps: string;
|
||||
}
|
||||
|
||||
interface FormatParams {
|
||||
format: string
|
||||
}
|
||||
|
||||
interface ComparisonParams {
|
||||
comparison: string;
|
||||
limit: number | string;
|
||||
exclusive: boolean;
|
||||
}
|
||||
|
||||
interface MultipleOfParams {
|
||||
multipleOf: number;
|
||||
}
|
||||
|
||||
interface PatternParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
interface RequiredParams {
|
||||
missingProperty: string;
|
||||
}
|
||||
|
||||
interface TypeParams {
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface UniqueItemsParams {
|
||||
i: number;
|
||||
j: number;
|
||||
}
|
||||
|
||||
interface CustomParams {
|
||||
keyword: string;
|
||||
}
|
||||
|
||||
interface PatternRequiredParams {
|
||||
missingPattern: string;
|
||||
}
|
||||
|
||||
interface PropertyNamesParams {
|
||||
propertyName: string;
|
||||
}
|
||||
|
||||
interface IfParams {
|
||||
failingKeyword: string;
|
||||
}
|
||||
|
||||
interface SwitchParams {
|
||||
caseIndex: number;
|
||||
}
|
||||
|
||||
interface NoParams { }
|
||||
|
||||
interface EnumParams {
|
||||
allowedValues: Array<any>;
|
||||
}
|
||||
}
|
||||
|
||||
export = ajv;
|
||||
506
node_modules/webpack-dev-server/node_modules/ajv/lib/ajv.js
generated
vendored
Executable file
506
node_modules/webpack-dev-server/node_modules/ajv/lib/ajv.js
generated
vendored
Executable file
|
|
@ -0,0 +1,506 @@
|
|||
'use strict';
|
||||
|
||||
var compileSchema = require('./compile')
|
||||
, resolve = require('./compile/resolve')
|
||||
, Cache = require('./cache')
|
||||
, SchemaObject = require('./compile/schema_obj')
|
||||
, stableStringify = require('fast-json-stable-stringify')
|
||||
, formats = require('./compile/formats')
|
||||
, rules = require('./compile/rules')
|
||||
, $dataMetaSchema = require('./data')
|
||||
, util = require('./compile/util');
|
||||
|
||||
module.exports = Ajv;
|
||||
|
||||
Ajv.prototype.validate = validate;
|
||||
Ajv.prototype.compile = compile;
|
||||
Ajv.prototype.addSchema = addSchema;
|
||||
Ajv.prototype.addMetaSchema = addMetaSchema;
|
||||
Ajv.prototype.validateSchema = validateSchema;
|
||||
Ajv.prototype.getSchema = getSchema;
|
||||
Ajv.prototype.removeSchema = removeSchema;
|
||||
Ajv.prototype.addFormat = addFormat;
|
||||
Ajv.prototype.errorsText = errorsText;
|
||||
|
||||
Ajv.prototype._addSchema = _addSchema;
|
||||
Ajv.prototype._compile = _compile;
|
||||
|
||||
Ajv.prototype.compileAsync = require('./compile/async');
|
||||
var customKeyword = require('./keyword');
|
||||
Ajv.prototype.addKeyword = customKeyword.add;
|
||||
Ajv.prototype.getKeyword = customKeyword.get;
|
||||
Ajv.prototype.removeKeyword = customKeyword.remove;
|
||||
Ajv.prototype.validateKeyword = customKeyword.validate;
|
||||
|
||||
var errorClasses = require('./compile/error_classes');
|
||||
Ajv.ValidationError = errorClasses.Validation;
|
||||
Ajv.MissingRefError = errorClasses.MissingRef;
|
||||
Ajv.$dataMetaSchema = $dataMetaSchema;
|
||||
|
||||
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
|
||||
|
||||
var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
|
||||
var META_SUPPORT_DATA = ['/properties'];
|
||||
|
||||
/**
|
||||
* Creates validator instance.
|
||||
* Usage: `Ajv(opts)`
|
||||
* @param {Object} opts optional options
|
||||
* @return {Object} ajv instance
|
||||
*/
|
||||
function Ajv(opts) {
|
||||
if (!(this instanceof Ajv)) return new Ajv(opts);
|
||||
opts = this._opts = util.copy(opts) || {};
|
||||
setLogger(this);
|
||||
this._schemas = {};
|
||||
this._refs = {};
|
||||
this._fragments = {};
|
||||
this._formats = formats(opts.format);
|
||||
|
||||
this._cache = opts.cache || new Cache;
|
||||
this._loadingSchemas = {};
|
||||
this._compilations = [];
|
||||
this.RULES = rules();
|
||||
this._getId = chooseGetId(opts);
|
||||
|
||||
opts.loopRequired = opts.loopRequired || Infinity;
|
||||
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
|
||||
if (opts.serialize === undefined) opts.serialize = stableStringify;
|
||||
this._metaOpts = getMetaSchemaOptions(this);
|
||||
|
||||
if (opts.formats) addInitialFormats(this);
|
||||
if (opts.keywords) addInitialKeywords(this);
|
||||
addDefaultMetaSchema(this);
|
||||
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
|
||||
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
|
||||
addInitialSchemas(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.
|
||||
* @this Ajv
|
||||
* @param {String|Object} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
function validate(schemaKeyRef, data) {
|
||||
var v;
|
||||
if (typeof schemaKeyRef == 'string') {
|
||||
v = this.getSchema(schemaKeyRef);
|
||||
if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
|
||||
} else {
|
||||
var schemaObj = this._addSchema(schemaKeyRef);
|
||||
v = schemaObj.validate || this._compile(schemaObj);
|
||||
}
|
||||
|
||||
var valid = v(data);
|
||||
if (v.$async !== true) this.errors = v.errors;
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
function compile(schema, _meta) {
|
||||
var schemaObj = this._addSchema(schema, undefined, _meta);
|
||||
return schemaObj.validate || this._compile(schemaObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @this Ajv
|
||||
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addSchema(schema, key, _skipValidation, _meta) {
|
||||
if (Array.isArray(schema)){
|
||||
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
|
||||
return this;
|
||||
}
|
||||
var id = this._getId(schema);
|
||||
if (id !== undefined && typeof id != 'string')
|
||||
throw new Error('schema id must be string');
|
||||
key = resolve.normalizeId(key || id);
|
||||
checkUnique(this, key);
|
||||
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {String} key optional schema key
|
||||
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addMetaSchema(schema, key, skipValidation) {
|
||||
this.addSchema(schema, key, skipValidation, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate schema
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to validate
|
||||
* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
function validateSchema(schema, throwOrLogError) {
|
||||
var $schema = schema.$schema;
|
||||
if ($schema !== undefined && typeof $schema != 'string')
|
||||
throw new Error('$schema must be a string');
|
||||
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
|
||||
if (!$schema) {
|
||||
this.logger.warn('meta-schema not available');
|
||||
this.errors = null;
|
||||
return true;
|
||||
}
|
||||
var valid = this.validate($schema, schema);
|
||||
if (!valid && throwOrLogError) {
|
||||
var message = 'schema is invalid: ' + this.errorsText();
|
||||
if (this._opts.validateSchema == 'log') this.logger.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
function defaultMeta(self) {
|
||||
var meta = self._opts.meta;
|
||||
self._opts.defaultMeta = typeof meta == 'object'
|
||||
? self._getId(meta) || meta
|
||||
: self.getSchema(META_SCHEMA_ID)
|
||||
? META_SCHEMA_ID
|
||||
: undefined;
|
||||
return self._opts.defaultMeta;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @this Ajv
|
||||
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`).
|
||||
*/
|
||||
function getSchema(keyRef) {
|
||||
var schemaObj = _getSchemaObj(this, keyRef);
|
||||
switch (typeof schemaObj) {
|
||||
case 'object': return schemaObj.validate || this._compile(schemaObj);
|
||||
case 'string': return this.getSchema(schemaObj);
|
||||
case 'undefined': return _getSchemaFragment(this, keyRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaFragment(self, ref) {
|
||||
var res = resolve.schema.call(self, { schema: {} }, ref);
|
||||
if (res) {
|
||||
var schema = res.schema
|
||||
, root = res.root
|
||||
, baseId = res.baseId;
|
||||
var v = compileSchema.call(self, schema, root, undefined, baseId);
|
||||
self._fragments[ref] = new SchemaObject({
|
||||
ref: ref,
|
||||
fragment: true,
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId,
|
||||
validate: v
|
||||
});
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaObj(self, keyRef) {
|
||||
keyRef = resolve.normalizeId(keyRef);
|
||||
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @this Ajv
|
||||
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function removeSchema(schemaKeyRef) {
|
||||
if (schemaKeyRef instanceof RegExp) {
|
||||
_removeAllSchemas(this, this._schemas, schemaKeyRef);
|
||||
_removeAllSchemas(this, this._refs, schemaKeyRef);
|
||||
return this;
|
||||
}
|
||||
switch (typeof schemaKeyRef) {
|
||||
case 'undefined':
|
||||
_removeAllSchemas(this, this._schemas);
|
||||
_removeAllSchemas(this, this._refs);
|
||||
this._cache.clear();
|
||||
return this;
|
||||
case 'string':
|
||||
var schemaObj = _getSchemaObj(this, schemaKeyRef);
|
||||
if (schemaObj) this._cache.del(schemaObj.cacheKey);
|
||||
delete this._schemas[schemaKeyRef];
|
||||
delete this._refs[schemaKeyRef];
|
||||
return this;
|
||||
case 'object':
|
||||
var serialize = this._opts.serialize;
|
||||
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
|
||||
this._cache.del(cacheKey);
|
||||
var id = this._getId(schemaKeyRef);
|
||||
if (id) {
|
||||
id = resolve.normalizeId(id);
|
||||
delete this._schemas[id];
|
||||
delete this._refs[id];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
function _removeAllSchemas(self, schemas, regex) {
|
||||
for (var keyRef in schemas) {
|
||||
var schemaObj = schemas[keyRef];
|
||||
if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
|
||||
self._cache.del(schemaObj.cacheKey);
|
||||
delete schemas[keyRef];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
|
||||
if (typeof schema != 'object' && typeof schema != 'boolean')
|
||||
throw new Error('schema should be object or boolean');
|
||||
var serialize = this._opts.serialize;
|
||||
var cacheKey = serialize ? serialize(schema) : schema;
|
||||
var cached = this._cache.get(cacheKey);
|
||||
if (cached) return cached;
|
||||
|
||||
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
||||
|
||||
var id = resolve.normalizeId(this._getId(schema));
|
||||
if (id && shouldAddSchema) checkUnique(this, id);
|
||||
|
||||
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
||||
var recursiveMeta;
|
||||
if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
|
||||
this.validateSchema(schema, true);
|
||||
|
||||
var localRefs = resolve.ids.call(this, schema);
|
||||
|
||||
var schemaObj = new SchemaObject({
|
||||
id: id,
|
||||
schema: schema,
|
||||
localRefs: localRefs,
|
||||
cacheKey: cacheKey,
|
||||
meta: meta
|
||||
});
|
||||
|
||||
if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;
|
||||
this._cache.put(cacheKey, schemaObj);
|
||||
|
||||
if (willValidate && recursiveMeta) this.validateSchema(schema, true);
|
||||
|
||||
return schemaObj;
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function _compile(schemaObj, root) {
|
||||
if (schemaObj.compiling) {
|
||||
schemaObj.validate = callValidate;
|
||||
callValidate.schema = schemaObj.schema;
|
||||
callValidate.errors = null;
|
||||
callValidate.root = root ? root : callValidate;
|
||||
if (schemaObj.schema.$async === true)
|
||||
callValidate.$async = true;
|
||||
return callValidate;
|
||||
}
|
||||
schemaObj.compiling = true;
|
||||
|
||||
var currentOpts;
|
||||
if (schemaObj.meta) {
|
||||
currentOpts = this._opts;
|
||||
this._opts = this._metaOpts;
|
||||
}
|
||||
|
||||
var v;
|
||||
try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
|
||||
catch(e) {
|
||||
delete schemaObj.validate;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
schemaObj.compiling = false;
|
||||
if (schemaObj.meta) this._opts = currentOpts;
|
||||
}
|
||||
|
||||
schemaObj.validate = v;
|
||||
schemaObj.refs = v.refs;
|
||||
schemaObj.refVal = v.refVal;
|
||||
schemaObj.root = v.root;
|
||||
return v;
|
||||
|
||||
|
||||
/* @this {*} - custom context, see passContext option */
|
||||
function callValidate() {
|
||||
/* jshint validthis: true */
|
||||
var _validate = schemaObj.validate;
|
||||
var result = _validate.apply(this, arguments);
|
||||
callValidate.errors = _validate.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function chooseGetId(opts) {
|
||||
switch (opts.schemaId) {
|
||||
case 'auto': return _get$IdOrId;
|
||||
case 'id': return _getId;
|
||||
default: return _get$Id;
|
||||
}
|
||||
}
|
||||
|
||||
/* @this Ajv */
|
||||
function _getId(schema) {
|
||||
if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
|
||||
return schema.id;
|
||||
}
|
||||
|
||||
/* @this Ajv */
|
||||
function _get$Id(schema) {
|
||||
if (schema.id) this.logger.warn('schema id ignored', schema.id);
|
||||
return schema.$id;
|
||||
}
|
||||
|
||||
|
||||
function _get$IdOrId(schema) {
|
||||
if (schema.$id && schema.id && schema.$id != schema.id)
|
||||
throw new Error('schema $id is different from id');
|
||||
return schema.$id || schema.id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @this Ajv
|
||||
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {Object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {String} human readable string with all errors descriptions
|
||||
*/
|
||||
function errorsText(errors, options) {
|
||||
errors = errors || this.errors;
|
||||
if (!errors) return 'No errors';
|
||||
options = options || {};
|
||||
var separator = options.separator === undefined ? ', ' : options.separator;
|
||||
var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
|
||||
|
||||
var text = '';
|
||||
for (var i=0; i<errors.length; i++) {
|
||||
var e = errors[i];
|
||||
if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
|
||||
}
|
||||
return text.slice(0, -separator.length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add custom format
|
||||
* @this Ajv
|
||||
* @param {String} name format name
|
||||
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addFormat(name, format) {
|
||||
if (typeof format == 'string') format = new RegExp(format);
|
||||
this._formats[name] = format;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
function addDefaultMetaSchema(self) {
|
||||
var $dataSchema;
|
||||
if (self._opts.$data) {
|
||||
$dataSchema = require('./refs/data.json');
|
||||
self.addMetaSchema($dataSchema, $dataSchema.$id, true);
|
||||
}
|
||||
if (self._opts.meta === false) return;
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
|
||||
self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
|
||||
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
|
||||
}
|
||||
|
||||
|
||||
function addInitialSchemas(self) {
|
||||
var optsSchemas = self._opts.schemas;
|
||||
if (!optsSchemas) return;
|
||||
if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);
|
||||
else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);
|
||||
}
|
||||
|
||||
|
||||
function addInitialFormats(self) {
|
||||
for (var name in self._opts.formats) {
|
||||
var format = self._opts.formats[name];
|
||||
self.addFormat(name, format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addInitialKeywords(self) {
|
||||
for (var name in self._opts.keywords) {
|
||||
var keyword = self._opts.keywords[name];
|
||||
self.addKeyword(name, keyword);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkUnique(self, id) {
|
||||
if (self._schemas[id] || self._refs[id])
|
||||
throw new Error('schema with key or id "' + id + '" already exists');
|
||||
}
|
||||
|
||||
|
||||
function getMetaSchemaOptions(self) {
|
||||
var metaOpts = util.copy(self._opts);
|
||||
for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
|
||||
delete metaOpts[META_IGNORE_OPTIONS[i]];
|
||||
return metaOpts;
|
||||
}
|
||||
|
||||
|
||||
function setLogger(self) {
|
||||
var logger = self._opts.logger;
|
||||
if (logger === false) {
|
||||
self.logger = {log: noop, warn: noop, error: noop};
|
||||
} else {
|
||||
if (logger === undefined) logger = console;
|
||||
if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
|
||||
throw new Error('logger must implement log, warn and error methods');
|
||||
self.logger = logger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function noop() {}
|
||||
26
node_modules/webpack-dev-server/node_modules/ajv/lib/cache.js
generated
vendored
Executable file
26
node_modules/webpack-dev-server/node_modules/ajv/lib/cache.js
generated
vendored
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
var Cache = module.exports = function Cache() {
|
||||
this._cache = {};
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.put = function Cache_put(key, value) {
|
||||
this._cache[key] = value;
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.get = function Cache_get(key) {
|
||||
return this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.del = function Cache_del(key) {
|
||||
delete this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.clear = function Cache_clear() {
|
||||
this._cache = {};
|
||||
};
|
||||
90
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/async.js
generated
vendored
Executable file
90
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/async.js
generated
vendored
Executable file
|
|
@ -0,0 +1,90 @@
|
|||
'use strict';
|
||||
|
||||
var MissingRefError = require('./error_classes').MissingRef;
|
||||
|
||||
module.exports = compileAsync;
|
||||
|
||||
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
|
||||
* @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
|
||||
* @return {Promise} promise that resolves with a validating function.
|
||||
*/
|
||||
function compileAsync(schema, meta, callback) {
|
||||
/* eslint no-shadow: 0 */
|
||||
/* global Promise */
|
||||
/* jshint validthis: true */
|
||||
var self = this;
|
||||
if (typeof this._opts.loadSchema != 'function')
|
||||
throw new Error('options.loadSchema should be a function');
|
||||
|
||||
if (typeof meta == 'function') {
|
||||
callback = meta;
|
||||
meta = undefined;
|
||||
}
|
||||
|
||||
var p = loadMetaSchemaOf(schema).then(function () {
|
||||
var schemaObj = self._addSchema(schema, undefined, meta);
|
||||
return schemaObj.validate || _compileAsync(schemaObj);
|
||||
});
|
||||
|
||||
if (callback) {
|
||||
p.then(
|
||||
function(v) { callback(null, v); },
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
return p;
|
||||
|
||||
|
||||
function loadMetaSchemaOf(sch) {
|
||||
var $schema = sch.$schema;
|
||||
return $schema && !self.getSchema($schema)
|
||||
? compileAsync.call(self, { $ref: $schema }, true)
|
||||
: Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
function _compileAsync(schemaObj) {
|
||||
try { return self._compile(schemaObj); }
|
||||
catch(e) {
|
||||
if (e instanceof MissingRefError) return loadMissingSchema(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
function loadMissingSchema(e) {
|
||||
var ref = e.missingSchema;
|
||||
if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
|
||||
|
||||
var schemaPromise = self._loadingSchemas[ref];
|
||||
if (!schemaPromise) {
|
||||
schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
|
||||
schemaPromise.then(removePromise, removePromise);
|
||||
}
|
||||
|
||||
return schemaPromise.then(function (sch) {
|
||||
if (!added(ref)) {
|
||||
return loadMetaSchemaOf(sch).then(function () {
|
||||
if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
|
||||
});
|
||||
}
|
||||
}).then(function() {
|
||||
return _compileAsync(schemaObj);
|
||||
});
|
||||
|
||||
function removePromise() {
|
||||
delete self._loadingSchemas[ref];
|
||||
}
|
||||
|
||||
function added(ref) {
|
||||
return self._refs[ref] || self._schemas[ref];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
5
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/equal.js
generated
vendored
Executable file
5
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/equal.js
generated
vendored
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
// do NOT remove this file - it would break pre-compiled schemas
|
||||
// https://github.com/ajv-validator/ajv/issues/889
|
||||
module.exports = require('fast-deep-equal');
|
||||
34
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/error_classes.js
generated
vendored
Executable file
34
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/error_classes.js
generated
vendored
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
'use strict';
|
||||
|
||||
var resolve = require('./resolve');
|
||||
|
||||
module.exports = {
|
||||
Validation: errorSubclass(ValidationError),
|
||||
MissingRef: errorSubclass(MissingRefError)
|
||||
};
|
||||
|
||||
|
||||
function ValidationError(errors) {
|
||||
this.message = 'validation failed';
|
||||
this.errors = errors;
|
||||
this.ajv = this.validation = true;
|
||||
}
|
||||
|
||||
|
||||
MissingRefError.message = function (baseId, ref) {
|
||||
return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
|
||||
};
|
||||
|
||||
|
||||
function MissingRefError(baseId, ref, message) {
|
||||
this.message = message || MissingRefError.message(baseId, ref);
|
||||
this.missingRef = resolve.url(baseId, ref);
|
||||
this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
|
||||
}
|
||||
|
||||
|
||||
function errorSubclass(Subclass) {
|
||||
Subclass.prototype = Object.create(Error.prototype);
|
||||
Subclass.prototype.constructor = Subclass;
|
||||
return Subclass;
|
||||
}
|
||||
142
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/formats.js
generated
vendored
Executable file
142
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/formats.js
generated
vendored
Executable file
|
|
@ -0,0 +1,142 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
||||
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
||||
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
||||
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
||||
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
||||
// uri-template: https://tools.ietf.org/html/rfc6570
|
||||
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
||||
// For the source: https://gist.github.com/dperini/729294
|
||||
// For test cases: https://mathiasbynens.be/demo/url-regex
|
||||
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
||||
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
||||
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
||||
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
||||
|
||||
|
||||
module.exports = formats;
|
||||
|
||||
function formats(mode) {
|
||||
mode = mode == 'full' ? 'full' : 'fast';
|
||||
return util.copy(formats[mode]);
|
||||
}
|
||||
|
||||
|
||||
formats.fast = {
|
||||
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
||||
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
|
||||
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
|
||||
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
||||
uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
// email (sources from jsen validator):
|
||||
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
||||
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
|
||||
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
|
||||
hostname: HOSTNAME,
|
||||
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
// uuid: http://tools.ietf.org/html/rfc4122
|
||||
uuid: UUID,
|
||||
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
||||
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
||||
'json-pointer': JSON_POINTER,
|
||||
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
||||
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
formats.full = {
|
||||
date: date,
|
||||
time: time,
|
||||
'date-time': date_time,
|
||||
uri: uri,
|
||||
'uri-reference': URIREF,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
||||
hostname: HOSTNAME,
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
uuid: UUID,
|
||||
'json-pointer': JSON_POINTER,
|
||||
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
function isLeapYear(year) {
|
||||
// https://tools.ietf.org/html/rfc3339#appendix-C
|
||||
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
||||
}
|
||||
|
||||
|
||||
function date(str) {
|
||||
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var matches = str.match(DATE);
|
||||
if (!matches) return false;
|
||||
|
||||
var year = +matches[1];
|
||||
var month = +matches[2];
|
||||
var day = +matches[3];
|
||||
|
||||
return month >= 1 && month <= 12 && day >= 1 &&
|
||||
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
||||
}
|
||||
|
||||
|
||||
function time(str, full) {
|
||||
var matches = str.match(TIME);
|
||||
if (!matches) return false;
|
||||
|
||||
var hour = matches[1];
|
||||
var minute = matches[2];
|
||||
var second = matches[3];
|
||||
var timeZone = matches[5];
|
||||
return ((hour <= 23 && minute <= 59 && second <= 59) ||
|
||||
(hour == 23 && minute == 59 && second == 60)) &&
|
||||
(!full || timeZone);
|
||||
}
|
||||
|
||||
|
||||
var DATE_TIME_SEPARATOR = /t|\s/i;
|
||||
function date_time(str) {
|
||||
// http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var dateTime = str.split(DATE_TIME_SEPARATOR);
|
||||
return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
|
||||
}
|
||||
|
||||
|
||||
var NOT_URI_FRAGMENT = /\/|:/;
|
||||
function uri(str) {
|
||||
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
||||
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
||||
}
|
||||
|
||||
|
||||
var Z_ANCHOR = /[^\\]\\Z/;
|
||||
function regex(str) {
|
||||
if (Z_ANCHOR.test(str)) return false;
|
||||
try {
|
||||
new RegExp(str);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
387
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/index.js
generated
vendored
Executable file
387
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/index.js
generated
vendored
Executable file
|
|
@ -0,0 +1,387 @@
|
|||
'use strict';
|
||||
|
||||
var resolve = require('./resolve')
|
||||
, util = require('./util')
|
||||
, errorClasses = require('./error_classes')
|
||||
, stableStringify = require('fast-json-stable-stringify');
|
||||
|
||||
var validateGenerator = require('../dotjs/validate');
|
||||
|
||||
/**
|
||||
* Functions below are used inside compiled validations function
|
||||
*/
|
||||
|
||||
var ucs2length = util.ucs2length;
|
||||
var equal = require('fast-deep-equal');
|
||||
|
||||
// this error is thrown by async schemas to return validation errors via exception
|
||||
var ValidationError = errorClasses.Validation;
|
||||
|
||||
module.exports = compile;
|
||||
|
||||
|
||||
/**
|
||||
* Compiles schema to validation function
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Object} root object with information about the root schema for this schema
|
||||
* @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
|
||||
* @param {String} baseId base ID for IDs in the schema
|
||||
* @return {Function} validation function
|
||||
*/
|
||||
function compile(schema, root, localRefs, baseId) {
|
||||
/* jshint validthis: true, evil: true */
|
||||
/* eslint no-shadow: 0 */
|
||||
var self = this
|
||||
, opts = this._opts
|
||||
, refVal = [ undefined ]
|
||||
, refs = {}
|
||||
, patterns = []
|
||||
, patternsHash = {}
|
||||
, defaults = []
|
||||
, defaultsHash = {}
|
||||
, customRules = [];
|
||||
|
||||
root = root || { schema: schema, refVal: refVal, refs: refs };
|
||||
|
||||
var c = checkCompiling.call(this, schema, root, baseId);
|
||||
var compilation = this._compilations[c.index];
|
||||
if (c.compiling) return (compilation.callValidate = callValidate);
|
||||
|
||||
var formats = this._formats;
|
||||
var RULES = this.RULES;
|
||||
|
||||
try {
|
||||
var v = localCompile(schema, root, localRefs, baseId);
|
||||
compilation.validate = v;
|
||||
var cv = compilation.callValidate;
|
||||
if (cv) {
|
||||
cv.schema = v.schema;
|
||||
cv.errors = null;
|
||||
cv.refs = v.refs;
|
||||
cv.refVal = v.refVal;
|
||||
cv.root = v.root;
|
||||
cv.$async = v.$async;
|
||||
if (opts.sourceCode) cv.source = v.source;
|
||||
}
|
||||
return v;
|
||||
} finally {
|
||||
endCompiling.call(this, schema, root, baseId);
|
||||
}
|
||||
|
||||
/* @this {*} - custom context, see passContext option */
|
||||
function callValidate() {
|
||||
/* jshint validthis: true */
|
||||
var validate = compilation.validate;
|
||||
var result = validate.apply(this, arguments);
|
||||
callValidate.errors = validate.errors;
|
||||
return result;
|
||||
}
|
||||
|
||||
function localCompile(_schema, _root, localRefs, baseId) {
|
||||
var isRoot = !_root || (_root && _root.schema == _schema);
|
||||
if (_root.schema != root.schema)
|
||||
return compile.call(self, _schema, _root, localRefs, baseId);
|
||||
|
||||
var $async = _schema.$async === true;
|
||||
|
||||
var sourceCode = validateGenerator({
|
||||
isTop: true,
|
||||
schema: _schema,
|
||||
isRoot: isRoot,
|
||||
baseId: baseId,
|
||||
root: _root,
|
||||
schemaPath: '',
|
||||
errSchemaPath: '#',
|
||||
errorPath: '""',
|
||||
MissingRefError: errorClasses.MissingRef,
|
||||
RULES: RULES,
|
||||
validate: validateGenerator,
|
||||
util: util,
|
||||
resolve: resolve,
|
||||
resolveRef: resolveRef,
|
||||
usePattern: usePattern,
|
||||
useDefault: useDefault,
|
||||
useCustomRule: useCustomRule,
|
||||
opts: opts,
|
||||
formats: formats,
|
||||
logger: self.logger,
|
||||
self: self
|
||||
});
|
||||
|
||||
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode, _schema);
|
||||
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
||||
var validate;
|
||||
try {
|
||||
var makeValidate = new Function(
|
||||
'self',
|
||||
'RULES',
|
||||
'formats',
|
||||
'root',
|
||||
'refVal',
|
||||
'defaults',
|
||||
'customRules',
|
||||
'equal',
|
||||
'ucs2length',
|
||||
'ValidationError',
|
||||
sourceCode
|
||||
);
|
||||
|
||||
validate = makeValidate(
|
||||
self,
|
||||
RULES,
|
||||
formats,
|
||||
root,
|
||||
refVal,
|
||||
defaults,
|
||||
customRules,
|
||||
equal,
|
||||
ucs2length,
|
||||
ValidationError
|
||||
);
|
||||
|
||||
refVal[0] = validate;
|
||||
} catch(e) {
|
||||
self.logger.error('Error compiling schema, function code:', sourceCode);
|
||||
throw e;
|
||||
}
|
||||
|
||||
validate.schema = _schema;
|
||||
validate.errors = null;
|
||||
validate.refs = refs;
|
||||
validate.refVal = refVal;
|
||||
validate.root = isRoot ? validate : _root;
|
||||
if ($async) validate.$async = true;
|
||||
if (opts.sourceCode === true) {
|
||||
validate.source = {
|
||||
code: sourceCode,
|
||||
patterns: patterns,
|
||||
defaults: defaults
|
||||
};
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
function resolveRef(baseId, ref, isRoot) {
|
||||
ref = resolve.url(baseId, ref);
|
||||
var refIndex = refs[ref];
|
||||
var _refVal, refCode;
|
||||
if (refIndex !== undefined) {
|
||||
_refVal = refVal[refIndex];
|
||||
refCode = 'refVal[' + refIndex + ']';
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
if (!isRoot && root.refs) {
|
||||
var rootRefId = root.refs[ref];
|
||||
if (rootRefId !== undefined) {
|
||||
_refVal = root.refVal[rootRefId];
|
||||
refCode = addLocalRef(ref, _refVal);
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
refCode = addLocalRef(ref);
|
||||
var v = resolve.call(self, localCompile, root, ref);
|
||||
if (v === undefined) {
|
||||
var localSchema = localRefs && localRefs[ref];
|
||||
if (localSchema) {
|
||||
v = resolve.inlineRef(localSchema, opts.inlineRefs)
|
||||
? localSchema
|
||||
: compile.call(self, localSchema, root, localRefs, baseId);
|
||||
}
|
||||
}
|
||||
|
||||
if (v === undefined) {
|
||||
removeLocalRef(ref);
|
||||
} else {
|
||||
replaceLocalRef(ref, v);
|
||||
return resolvedRef(v, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
function addLocalRef(ref, v) {
|
||||
var refId = refVal.length;
|
||||
refVal[refId] = v;
|
||||
refs[ref] = refId;
|
||||
return 'refVal' + refId;
|
||||
}
|
||||
|
||||
function removeLocalRef(ref) {
|
||||
delete refs[ref];
|
||||
}
|
||||
|
||||
function replaceLocalRef(ref, v) {
|
||||
var refId = refs[ref];
|
||||
refVal[refId] = v;
|
||||
}
|
||||
|
||||
function resolvedRef(refVal, code) {
|
||||
return typeof refVal == 'object' || typeof refVal == 'boolean'
|
||||
? { code: code, schema: refVal, inline: true }
|
||||
: { code: code, $async: refVal && !!refVal.$async };
|
||||
}
|
||||
|
||||
function usePattern(regexStr) {
|
||||
var index = patternsHash[regexStr];
|
||||
if (index === undefined) {
|
||||
index = patternsHash[regexStr] = patterns.length;
|
||||
patterns[index] = regexStr;
|
||||
}
|
||||
return 'pattern' + index;
|
||||
}
|
||||
|
||||
function useDefault(value) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
return '' + value;
|
||||
case 'string':
|
||||
return util.toQuotedString(value);
|
||||
case 'object':
|
||||
if (value === null) return 'null';
|
||||
var valueStr = stableStringify(value);
|
||||
var index = defaultsHash[valueStr];
|
||||
if (index === undefined) {
|
||||
index = defaultsHash[valueStr] = defaults.length;
|
||||
defaults[index] = value;
|
||||
}
|
||||
return 'default' + index;
|
||||
}
|
||||
}
|
||||
|
||||
function useCustomRule(rule, schema, parentSchema, it) {
|
||||
if (self._opts.validateSchema !== false) {
|
||||
var deps = rule.definition.dependencies;
|
||||
if (deps && !deps.every(function(keyword) {
|
||||
return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
|
||||
}))
|
||||
throw new Error('parent schema must have all required keywords: ' + deps.join(','));
|
||||
|
||||
var validateSchema = rule.definition.validateSchema;
|
||||
if (validateSchema) {
|
||||
var valid = validateSchema(schema);
|
||||
if (!valid) {
|
||||
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
|
||||
if (self._opts.validateSchema == 'log') self.logger.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var compile = rule.definition.compile
|
||||
, inline = rule.definition.inline
|
||||
, macro = rule.definition.macro;
|
||||
|
||||
var validate;
|
||||
if (compile) {
|
||||
validate = compile.call(self, schema, parentSchema, it);
|
||||
} else if (macro) {
|
||||
validate = macro.call(self, schema, parentSchema, it);
|
||||
if (opts.validateSchema !== false) self.validateSchema(validate, true);
|
||||
} else if (inline) {
|
||||
validate = inline.call(self, it, rule.keyword, schema, parentSchema);
|
||||
} else {
|
||||
validate = rule.definition.validate;
|
||||
if (!validate) return;
|
||||
}
|
||||
|
||||
if (validate === undefined)
|
||||
throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
|
||||
|
||||
var index = customRules.length;
|
||||
customRules[index] = validate;
|
||||
|
||||
return {
|
||||
code: 'customRule' + index,
|
||||
validate: validate
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the schema is currently compiled
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
|
||||
*/
|
||||
function checkCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var index = compIndex.call(this, schema, root, baseId);
|
||||
if (index >= 0) return { index: index, compiling: true };
|
||||
index = this._compilations.length;
|
||||
this._compilations[index] = {
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId
|
||||
};
|
||||
return { index: index, compiling: false };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the schema from the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
*/
|
||||
function endCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var i = compIndex.call(this, schema, root, baseId);
|
||||
if (i >= 0) this._compilations.splice(i, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index of schema compilation in the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Integer} compilation index
|
||||
*/
|
||||
function compIndex(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
for (var i=0; i<this._compilations.length; i++) {
|
||||
var c = this._compilations[i];
|
||||
if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
function patternCode(i, patterns) {
|
||||
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
||||
}
|
||||
|
||||
|
||||
function defaultCode(i) {
|
||||
return 'var default' + i + ' = defaults[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function refValCode(i, refVal) {
|
||||
return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function customRuleCode(i) {
|
||||
return 'var customRule' + i + ' = customRules[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function vars(arr, statement) {
|
||||
if (!arr.length) return '';
|
||||
var code = '';
|
||||
for (var i=0; i<arr.length; i++)
|
||||
code += statement(i, arr);
|
||||
return code;
|
||||
}
|
||||
270
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/resolve.js
generated
vendored
Executable file
270
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/resolve.js
generated
vendored
Executable file
|
|
@ -0,0 +1,270 @@
|
|||
'use strict';
|
||||
|
||||
var URI = require('uri-js')
|
||||
, equal = require('fast-deep-equal')
|
||||
, util = require('./util')
|
||||
, SchemaObject = require('./schema_obj')
|
||||
, traverse = require('json-schema-traverse');
|
||||
|
||||
module.exports = resolve;
|
||||
|
||||
resolve.normalizeId = normalizeId;
|
||||
resolve.fullPath = getFullPath;
|
||||
resolve.url = resolveUrl;
|
||||
resolve.ids = resolveIds;
|
||||
resolve.inlineRef = inlineRef;
|
||||
resolve.schema = resolveSchema;
|
||||
|
||||
/**
|
||||
* [resolve and compile the references ($ref)]
|
||||
* @this Ajv
|
||||
* @param {Function} compile reference to schema compilation funciton (localCompile)
|
||||
* @param {Object} root object with information about the root schema for the current schema
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
|
||||
*/
|
||||
function resolve(compile, root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var refVal = this._refs[ref];
|
||||
if (typeof refVal == 'string') {
|
||||
if (this._refs[refVal]) refVal = this._refs[refVal];
|
||||
else return resolve.call(this, compile, root, refVal);
|
||||
}
|
||||
|
||||
refVal = refVal || this._schemas[ref];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
return inlineRef(refVal.schema, this._opts.inlineRefs)
|
||||
? refVal.schema
|
||||
: refVal.validate || this._compile(refVal);
|
||||
}
|
||||
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
var schema, v, baseId;
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
|
||||
if (schema instanceof SchemaObject) {
|
||||
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
|
||||
} else if (schema !== undefined) {
|
||||
v = inlineRef(schema, this._opts.inlineRefs)
|
||||
? schema
|
||||
: compile.call(this, schema, root, undefined, baseId);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolve schema, its root and baseId
|
||||
* @this Ajv
|
||||
* @param {Object} root root object with properties schema, refVal, refs
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object} object with properties schema, root, baseId
|
||||
*/
|
||||
function resolveSchema(root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var p = URI.parse(ref)
|
||||
, refPath = _getFullPath(p)
|
||||
, baseId = getFullPath(this._getId(root.schema));
|
||||
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
|
||||
var id = normalizeId(refPath);
|
||||
var refVal = this._refs[id];
|
||||
if (typeof refVal == 'string') {
|
||||
return resolveRecursive.call(this, root, refVal, p);
|
||||
} else if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
root = refVal;
|
||||
} else {
|
||||
refVal = this._schemas[id];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
if (id == normalizeId(ref))
|
||||
return { schema: refVal, root: root, baseId: baseId };
|
||||
root = refVal;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!root.schema) return;
|
||||
baseId = getFullPath(this._getId(root.schema));
|
||||
}
|
||||
return getJsonPointer.call(this, p, baseId, root.schema, root);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveRecursive(root, ref, parsedRef) {
|
||||
/* jshint validthis: true */
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
if (res) {
|
||||
var schema = res.schema;
|
||||
var baseId = res.baseId;
|
||||
root = res.root;
|
||||
var id = this._getId(schema);
|
||||
if (id) baseId = resolveUrl(baseId, id);
|
||||
return getJsonPointer.call(this, parsedRef, baseId, schema, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
||||
/* @this Ajv */
|
||||
function getJsonPointer(parsedRef, baseId, schema, root) {
|
||||
/* jshint validthis: true */
|
||||
parsedRef.fragment = parsedRef.fragment || '';
|
||||
if (parsedRef.fragment.slice(0,1) != '/') return;
|
||||
var parts = parsedRef.fragment.split('/');
|
||||
|
||||
for (var i = 1; i < parts.length; i++) {
|
||||
var part = parts[i];
|
||||
if (part) {
|
||||
part = util.unescapeFragment(part);
|
||||
schema = schema[part];
|
||||
if (schema === undefined) break;
|
||||
var id;
|
||||
if (!PREVENT_SCOPE_CHANGE[part]) {
|
||||
id = this._getId(schema);
|
||||
if (id) baseId = resolveUrl(baseId, id);
|
||||
if (schema.$ref) {
|
||||
var $ref = resolveUrl(baseId, schema.$ref);
|
||||
var res = resolveSchema.call(this, root, $ref);
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schema !== undefined && schema !== root.schema)
|
||||
return { schema: schema, root: root, baseId: baseId };
|
||||
}
|
||||
|
||||
|
||||
var SIMPLE_INLINED = util.toHash([
|
||||
'type', 'format', 'pattern',
|
||||
'maxLength', 'minLength',
|
||||
'maxProperties', 'minProperties',
|
||||
'maxItems', 'minItems',
|
||||
'maximum', 'minimum',
|
||||
'uniqueItems', 'multipleOf',
|
||||
'required', 'enum'
|
||||
]);
|
||||
function inlineRef(schema, limit) {
|
||||
if (limit === false) return false;
|
||||
if (limit === undefined || limit === true) return checkNoRef(schema);
|
||||
else if (limit) return countKeys(schema) <= limit;
|
||||
}
|
||||
|
||||
|
||||
function checkNoRef(schema) {
|
||||
var item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return false;
|
||||
item = schema[key];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function countKeys(schema) {
|
||||
var count = 0, item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object') count += countKeys(item);
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return Infinity;
|
||||
if (SIMPLE_INLINED[key]) {
|
||||
count++;
|
||||
} else {
|
||||
item = schema[key];
|
||||
if (typeof item == 'object') count += countKeys(item) + 1;
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
function getFullPath(id, normalize) {
|
||||
if (normalize !== false) id = normalizeId(id);
|
||||
var p = URI.parse(id);
|
||||
return _getFullPath(p);
|
||||
}
|
||||
|
||||
|
||||
function _getFullPath(p) {
|
||||
return URI.serialize(p).split('#')[0] + '#';
|
||||
}
|
||||
|
||||
|
||||
var TRAILING_SLASH_HASH = /#\/?$/;
|
||||
function normalizeId(id) {
|
||||
return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
|
||||
}
|
||||
|
||||
|
||||
function resolveUrl(baseId, id) {
|
||||
id = normalizeId(id);
|
||||
return URI.resolve(baseId, id);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveIds(schema) {
|
||||
var schemaId = normalizeId(this._getId(schema));
|
||||
var baseIds = {'': schemaId};
|
||||
var fullPaths = {'': getFullPath(schemaId, false)};
|
||||
var localRefs = {};
|
||||
var self = this;
|
||||
|
||||
traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
||||
if (jsonPtr === '') return;
|
||||
var id = self._getId(sch);
|
||||
var baseId = baseIds[parentJsonPtr];
|
||||
var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
|
||||
if (keyIndex !== undefined)
|
||||
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
|
||||
|
||||
if (typeof id == 'string') {
|
||||
id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
|
||||
|
||||
var refVal = self._refs[id];
|
||||
if (typeof refVal == 'string') refVal = self._refs[refVal];
|
||||
if (refVal && refVal.schema) {
|
||||
if (!equal(sch, refVal.schema))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
} else if (id != normalizeId(fullPath)) {
|
||||
if (id[0] == '#') {
|
||||
if (localRefs[id] && !equal(sch, localRefs[id]))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
localRefs[id] = sch;
|
||||
} else {
|
||||
self._refs[id] = fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
baseIds[jsonPtr] = baseId;
|
||||
fullPaths[jsonPtr] = fullPath;
|
||||
});
|
||||
|
||||
return localRefs;
|
||||
}
|
||||
66
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/rules.js
generated
vendored
Executable file
66
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/rules.js
generated
vendored
Executable file
|
|
@ -0,0 +1,66 @@
|
|||
'use strict';
|
||||
|
||||
var ruleModules = require('../dotjs')
|
||||
, toHash = require('./util').toHash;
|
||||
|
||||
module.exports = function rules() {
|
||||
var RULES = [
|
||||
{ type: 'number',
|
||||
rules: [ { 'maximum': ['exclusiveMaximum'] },
|
||||
{ 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
|
||||
{ type: 'string',
|
||||
rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
|
||||
{ type: 'array',
|
||||
rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
|
||||
{ type: 'object',
|
||||
rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
|
||||
{ 'properties': ['additionalProperties', 'patternProperties'] } ] },
|
||||
{ rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
|
||||
];
|
||||
|
||||
var ALL = [ 'type', '$comment' ];
|
||||
var KEYWORDS = [
|
||||
'$schema', '$id', 'id', '$data', '$async', 'title',
|
||||
'description', 'default', 'definitions',
|
||||
'examples', 'readOnly', 'writeOnly',
|
||||
'contentMediaType', 'contentEncoding',
|
||||
'additionalItems', 'then', 'else'
|
||||
];
|
||||
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
|
||||
RULES.all = toHash(ALL);
|
||||
RULES.types = toHash(TYPES);
|
||||
|
||||
RULES.forEach(function (group) {
|
||||
group.rules = group.rules.map(function (keyword) {
|
||||
var implKeywords;
|
||||
if (typeof keyword == 'object') {
|
||||
var key = Object.keys(keyword)[0];
|
||||
implKeywords = keyword[key];
|
||||
keyword = key;
|
||||
implKeywords.forEach(function (k) {
|
||||
ALL.push(k);
|
||||
RULES.all[k] = true;
|
||||
});
|
||||
}
|
||||
ALL.push(keyword);
|
||||
var rule = RULES.all[keyword] = {
|
||||
keyword: keyword,
|
||||
code: ruleModules[keyword],
|
||||
implements: implKeywords
|
||||
};
|
||||
return rule;
|
||||
});
|
||||
|
||||
RULES.all.$comment = {
|
||||
keyword: '$comment',
|
||||
code: ruleModules.$comment
|
||||
};
|
||||
|
||||
if (group.type) RULES.types[group.type] = group;
|
||||
});
|
||||
|
||||
RULES.keywords = toHash(ALL.concat(KEYWORDS));
|
||||
RULES.custom = {};
|
||||
|
||||
return RULES;
|
||||
};
|
||||
9
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/schema_obj.js
generated
vendored
Executable file
9
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/schema_obj.js
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
module.exports = SchemaObject;
|
||||
|
||||
function SchemaObject(obj) {
|
||||
util.copy(obj, this);
|
||||
}
|
||||
20
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/ucs2length.js
generated
vendored
Executable file
20
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/ucs2length.js
generated
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
// https://mathiasbynens.be/notes/javascript-encoding
|
||||
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
||||
module.exports = function ucs2length(str) {
|
||||
var length = 0
|
||||
, len = str.length
|
||||
, pos = 0
|
||||
, value;
|
||||
while (pos < len) {
|
||||
length++;
|
||||
value = str.charCodeAt(pos++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
|
||||
// high surrogate, and there is a next character
|
||||
value = str.charCodeAt(pos);
|
||||
if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
|
||||
}
|
||||
}
|
||||
return length;
|
||||
};
|
||||
239
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/util.js
generated
vendored
Executable file
239
node_modules/webpack-dev-server/node_modules/ajv/lib/compile/util.js
generated
vendored
Executable file
|
|
@ -0,0 +1,239 @@
|
|||
'use strict';
|
||||
|
||||
|
||||
module.exports = {
|
||||
copy: copy,
|
||||
checkDataType: checkDataType,
|
||||
checkDataTypes: checkDataTypes,
|
||||
coerceToTypes: coerceToTypes,
|
||||
toHash: toHash,
|
||||
getProperty: getProperty,
|
||||
escapeQuotes: escapeQuotes,
|
||||
equal: require('fast-deep-equal'),
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
schemaUnknownRules: schemaUnknownRules,
|
||||
toQuotedString: toQuotedString,
|
||||
getPathExpr: getPathExpr,
|
||||
getPath: getPath,
|
||||
getData: getData,
|
||||
unescapeFragment: unescapeFragment,
|
||||
unescapeJsonPointer: unescapeJsonPointer,
|
||||
escapeFragment: escapeFragment,
|
||||
escapeJsonPointer: escapeJsonPointer
|
||||
};
|
||||
|
||||
|
||||
function copy(o, to) {
|
||||
to = to || {};
|
||||
for (var key in o) to[key] = o[key];
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, strictNumbers, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
, NOT = negate ? '' : '!';
|
||||
switch (dataType) {
|
||||
case 'null': return data + EQUAL + 'null';
|
||||
case 'array': return OK + 'Array.isArray(' + data + ')';
|
||||
case 'object': return '(' + OK + data + AND +
|
||||
'typeof ' + data + EQUAL + '"object"' + AND +
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
case 'number': return '(typeof ' + data + EQUAL + '"' + dataType + '"' +
|
||||
(strictNumbers ? (AND + OK + 'isFinite(' + data + ')') : '') + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data, strictNumbers) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, strictNumbers, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
if (types.array && types.object) {
|
||||
code = types.null ? '(': '(!' + data + ' || ';
|
||||
code += 'typeof ' + data + ' !== "object")';
|
||||
delete types.null;
|
||||
delete types.array;
|
||||
delete types.object;
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, strictNumbers, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
||||
function coerceToTypes(optionCoerceTypes, dataTypes) {
|
||||
if (Array.isArray(dataTypes)) {
|
||||
var types = [];
|
||||
for (var i=0; i<dataTypes.length; i++) {
|
||||
var t = dataTypes[i];
|
||||
if (COERCE_TO_TYPES[t]) types[types.length] = t;
|
||||
else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
|
||||
}
|
||||
if (types.length) return types;
|
||||
} else if (COERCE_TO_TYPES[dataTypes]) {
|
||||
return [dataTypes];
|
||||
} else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
|
||||
return ['array'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toHash(arr) {
|
||||
var hash = {};
|
||||
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
var SINGLE_QUOTE = /'|\\/g;
|
||||
function getProperty(key) {
|
||||
return typeof key == 'number'
|
||||
? '[' + key + ']'
|
||||
: IDENTIFIER.test(key)
|
||||
? '.' + key
|
||||
: "['" + escapeQuotes(key) + "']";
|
||||
}
|
||||
|
||||
|
||||
function escapeQuotes(str) {
|
||||
return str.replace(SINGLE_QUOTE, '\\$&')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\f/g, '\\f')
|
||||
.replace(/\t/g, '\\t');
|
||||
}
|
||||
|
||||
|
||||
function varOccurences(str, dataVar) {
|
||||
dataVar += '[^0-9]';
|
||||
var matches = str.match(new RegExp(dataVar, 'g'));
|
||||
return matches ? matches.length : 0;
|
||||
}
|
||||
|
||||
|
||||
function varReplace(str, dataVar, expr) {
|
||||
dataVar += '([^0-9])';
|
||||
expr = expr.replace(/\$/g, '$$$$');
|
||||
return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return !schema;
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRulesExcept(schema, rules, exceptKeyword) {
|
||||
if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
|
||||
for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaUnknownRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return;
|
||||
for (var key in schema) if (!rules[key]) return key;
|
||||
}
|
||||
|
||||
|
||||
function toQuotedString(str) {
|
||||
return '\'' + escapeQuotes(str) + '\'';
|
||||
}
|
||||
|
||||
|
||||
function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
|
||||
var path = jsonPointers // false by default
|
||||
? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
|
||||
: (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
function getPath(currentPath, prop, jsonPointers) {
|
||||
var path = jsonPointers // false by default
|
||||
? toQuotedString('/' + escapeJsonPointer(prop))
|
||||
: toQuotedString(getProperty(prop));
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
||||
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
||||
function getData($data, lvl, paths) {
|
||||
var up, jsonPointer, data, matches;
|
||||
if ($data === '') return 'rootData';
|
||||
if ($data[0] == '/') {
|
||||
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
jsonPointer = $data;
|
||||
data = 'rootData';
|
||||
} else {
|
||||
matches = $data.match(RELATIVE_JSON_POINTER);
|
||||
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
up = +matches[1];
|
||||
jsonPointer = matches[2];
|
||||
if (jsonPointer == '#') {
|
||||
if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
|
||||
return paths[lvl - up];
|
||||
}
|
||||
|
||||
if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
|
||||
data = 'data' + ((lvl - up) || '');
|
||||
if (!jsonPointer) return data;
|
||||
}
|
||||
|
||||
var expr = data;
|
||||
var segments = jsonPointer.split('/');
|
||||
for (var i=0; i<segments.length; i++) {
|
||||
var segment = segments[i];
|
||||
if (segment) {
|
||||
data += getProperty(unescapeJsonPointer(segment));
|
||||
expr += ' && ' + data;
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/([^\\])' \+ '/g, '$1');
|
||||
}
|
||||
|
||||
|
||||
function unescapeFragment(str) {
|
||||
return unescapeJsonPointer(decodeURIComponent(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeFragment(str) {
|
||||
return encodeURIComponent(escapeJsonPointer(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeJsonPointer(str) {
|
||||
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
}
|
||||
|
||||
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
||||
49
node_modules/webpack-dev-server/node_modules/ajv/lib/data.js
generated
vendored
Executable file
49
node_modules/webpack-dev-server/node_modules/ajv/lib/data.js
generated
vendored
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
'use strict';
|
||||
|
||||
var KEYWORDS = [
|
||||
'multipleOf',
|
||||
'maximum',
|
||||
'exclusiveMaximum',
|
||||
'minimum',
|
||||
'exclusiveMinimum',
|
||||
'maxLength',
|
||||
'minLength',
|
||||
'pattern',
|
||||
'additionalItems',
|
||||
'maxItems',
|
||||
'minItems',
|
||||
'uniqueItems',
|
||||
'maxProperties',
|
||||
'minProperties',
|
||||
'required',
|
||||
'additionalProperties',
|
||||
'enum',
|
||||
'format',
|
||||
'const'
|
||||
];
|
||||
|
||||
module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
for (var i=0; i<keywordsJsonPointers.length; i++) {
|
||||
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
||||
var segments = keywordsJsonPointers[i].split('/');
|
||||
var keywords = metaSchema;
|
||||
var j;
|
||||
for (j=1; j<segments.length; j++)
|
||||
keywords = keywords[segments[j]];
|
||||
|
||||
for (j=0; j<KEYWORDS.length; j++) {
|
||||
var key = KEYWORDS[j];
|
||||
var schema = keywords[key];
|
||||
if (schema) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return metaSchema;
|
||||
};
|
||||
37
node_modules/webpack-dev-server/node_modules/ajv/lib/definition_schema.js
generated
vendored
Executable file
37
node_modules/webpack-dev-server/node_modules/ajv/lib/definition_schema.js
generated
vendored
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
|
||||
module.exports = {
|
||||
$id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js',
|
||||
definitions: {
|
||||
simpleTypes: metaSchema.definitions.simpleTypes
|
||||
},
|
||||
type: 'object',
|
||||
dependencies: {
|
||||
schema: ['validate'],
|
||||
$data: ['validate'],
|
||||
statements: ['inline'],
|
||||
valid: {not: {required: ['macro']}}
|
||||
},
|
||||
properties: {
|
||||
type: metaSchema.properties.type,
|
||||
schema: {type: 'boolean'},
|
||||
statements: {type: 'boolean'},
|
||||
dependencies: {
|
||||
type: 'array',
|
||||
items: {type: 'string'}
|
||||
},
|
||||
metaSchema: {type: 'object'},
|
||||
modifying: {type: 'boolean'},
|
||||
valid: {type: 'boolean'},
|
||||
$data: {type: 'boolean'},
|
||||
async: {type: 'boolean'},
|
||||
errors: {
|
||||
anyOf: [
|
||||
{type: 'boolean'},
|
||||
{const: 'full'}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
113
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
Executable file
113
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,113 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{## def.setExclusiveLimit:
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $isMax = $keyword == 'maximum'
|
||||
, $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum'
|
||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
||||
, $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $notOp = $isMax ? '>' : '<'
|
||||
, $errorKeyword = undefined;
|
||||
|
||||
if (!($isData || typeof $schema == 'number' || $schema === undefined)) {
|
||||
throw new Error($keyword + ' must be number');
|
||||
}
|
||||
if (!($isDataExcl || $schemaExcl === undefined
|
||||
|| typeof $schemaExcl == 'number'
|
||||
|| typeof $schemaExcl == 'boolean')) {
|
||||
throw new Error($exclusiveKeyword + ' must be number or boolean');
|
||||
}
|
||||
}}
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $exclType = 'exclType' + $lvl
|
||||
, $exclIsNumber = 'exclIsNumber' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
var {{=$exclusive}};
|
||||
var {{=$exclType}} = typeof {{=$schemaValueExcl}};
|
||||
if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') {
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_exclusiveLimit' }}
|
||||
} else if ({{# def.$dataNotType:'number' }}
|
||||
{{=$exclType}} == 'number'
|
||||
? (
|
||||
({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}})
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
)
|
||||
: (
|
||||
({{=$exclusive}} = {{=$schemaValueExcl}} === true)
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValue}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
)
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{
|
||||
if ($schema === undefined) {
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaValueExcl;
|
||||
$isData = $isDataExcl;
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{
|
||||
var $exclIsNumber = typeof $schemaExcl == 'number'
|
||||
, $opStr = $op; /*used in error*/
|
||||
}}
|
||||
|
||||
{{? $exclIsNumber && $isData }}
|
||||
{{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }}
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
( {{=$schemaValue}} === undefined
|
||||
|| {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}}
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaExcl}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}} )
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{??}}
|
||||
{{
|
||||
if ($exclIsNumber && $schema === undefined) {
|
||||
{{# def.setExclusiveLimit }}
|
||||
$schemaValue = $schemaExcl;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
if ($exclIsNumber)
|
||||
$schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
|
||||
|
||||
if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
|
||||
{{# def.setExclusiveLimit }}
|
||||
$notOp += '=';
|
||||
} else {
|
||||
$exclusive = false;
|
||||
$opStr += '=';
|
||||
}
|
||||
}
|
||||
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
{{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ $errorKeyword = $errorKeyword || $keyword; }}
|
||||
{{# def.error:'_limit' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
12
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
Executable file
12
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
12
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
Executable file
12
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitLength' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
12
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
Executable file
12
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitProperties' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
32
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
Executable file
32
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $allSchemasEmpty = true;
|
||||
}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{? $allSchemasEmpty }}
|
||||
if (true) {
|
||||
{{??}}
|
||||
{{= $closingBraces.slice(0,-1) }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
46
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
Executable file
46
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return {{# def.nonEmptySchema:$sch }};
|
||||
});
|
||||
}}
|
||||
{{? $noEmptySchema }}
|
||||
{{ var $currentBaseId = $it.baseId; }}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = false;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{=$valid}} = {{=$valid}} || {{=$nextValid}};
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'anyOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
51
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/coerce.def
generated
vendored
Executable file
51
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/coerce.def
generated
vendored
Executable file
|
|
@ -0,0 +1,51 @@
|
|||
{{## def.coerceType:
|
||||
{{
|
||||
var $dataType = 'dataType' + $lvl
|
||||
, $coerced = 'coerced' + $lvl;
|
||||
}}
|
||||
var {{=$dataType}} = typeof {{=$data}};
|
||||
var {{=$coerced}} = undefined;
|
||||
|
||||
{{? it.opts.coerceTypes == 'array' }}
|
||||
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}}) && {{=$data}}.length == 1) {
|
||||
{{=$data}} = {{=$data}}[0];
|
||||
{{=$dataType}} = typeof {{=$data}};
|
||||
if ({{=it.util.checkDataType(it.schema.type, $data, it.opts.strictNumbers)}}) {{=$coerced}} = {{=$data}};
|
||||
}
|
||||
{{?}}
|
||||
|
||||
if ({{=$coerced}} !== undefined) ;
|
||||
{{~ $coerceToTypes:$type:$i }}
|
||||
{{? $type == 'string' }}
|
||||
else if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
|
||||
{{=$coerced}} = '' + {{=$data}};
|
||||
else if ({{=$data}} === null) {{=$coerced}} = '';
|
||||
{{?? $type == 'number' || $type == 'integer' }}
|
||||
else if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|
||||
|| ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
|
||||
{{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
|
||||
{{=$coerced}} = +{{=$data}};
|
||||
{{?? $type == 'boolean' }}
|
||||
else if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
|
||||
{{=$coerced}} = false;
|
||||
else if ({{=$data}} === 'true' || {{=$data}} === 1)
|
||||
{{=$coerced}} = true;
|
||||
{{?? $type == 'null' }}
|
||||
else if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
|
||||
{{=$coerced}} = null;
|
||||
{{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
|
||||
else if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
|
||||
{{=$coerced}} = [{{=$data}}];
|
||||
{{?}}
|
||||
{{~}}
|
||||
else {
|
||||
{{# def.error:'type' }}
|
||||
}
|
||||
|
||||
if ({{=$coerced}} !== undefined) {
|
||||
{{# def.setParentData }}
|
||||
{{=$data}} = {{=$coerced}};
|
||||
{{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
|
||||
{{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
|
||||
}
|
||||
#}}
|
||||
9
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/comment.jst
generated
vendored
Executable file
9
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/comment.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,9 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{ var $comment = it.util.toQuotedString($schema); }}
|
||||
{{? it.opts.$comment === true }}
|
||||
console.log({{=$comment}});
|
||||
{{?? typeof it.opts.$comment == 'function' }}
|
||||
self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema);
|
||||
{{?}}
|
||||
11
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/const.jst
generated
vendored
Executable file
11
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/const.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{? !$isData }}
|
||||
var schema{{=$lvl}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}});
|
||||
{{# def.checkError:'const' }}
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
55
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/contains.jst
generated
vendored
Executable file
55
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/contains.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,55 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId
|
||||
, $nonEmptySchema = {{# def.nonEmptySchema:$schema }};
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? $nonEmptySchema }}
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$nextValid}} = false;
|
||||
|
||||
for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
if ({{=$nextValid}}) break;
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
{{??}}
|
||||
if ({{=$data}}.length == 0) {
|
||||
{{?}}
|
||||
|
||||
{{# def.error:'contains' }}
|
||||
} else {
|
||||
{{? $nonEmptySchema }}
|
||||
{{# def.resetErrors }}
|
||||
{{?}}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
191
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/custom.jst
generated
vendored
Executable file
191
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/custom.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,191 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $rule = this
|
||||
, $definition = 'definition' + $lvl
|
||||
, $rDef = $rule.definition
|
||||
, $closingBraces = '';
|
||||
var $validate = $rDef.validate;
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
}}
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
}}
|
||||
var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition;
|
||||
var {{=$validateCode}} = {{=$definition}}.validate;
|
||||
{{??}}
|
||||
{{
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
if (!$ruleValidate) return;
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $ruleErrs = $validateCode + '.errors'
|
||||
, $i = 'i' + $lvl
|
||||
, $ruleErr = 'ruleErr' + $lvl
|
||||
, $asyncKeyword = $rDef.async;
|
||||
|
||||
if ($asyncKeyword && !it.async)
|
||||
throw new Error('async keyword in sync schema');
|
||||
}}
|
||||
|
||||
|
||||
{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{## def.callRuleValidate:
|
||||
{{=$validateCode}}.call(
|
||||
{{? it.opts.passContext }}this{{??}}self{{?}}
|
||||
{{? $compile || $rDef.schema === false }}
|
||||
, {{=$data}}
|
||||
{{??}}
|
||||
, {{=$schemaValue}}
|
||||
, {{=$data}}
|
||||
, validate.schema{{=it.schemaPath}}
|
||||
{{?}}
|
||||
, {{# def.dataPath }}
|
||||
{{# def.passParentData }}
|
||||
, rootData
|
||||
)
|
||||
#}}
|
||||
|
||||
{{## def.extendErrors:_inline:
|
||||
for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
var {{=$ruleErr}} = vErrors[{{=$i}}];
|
||||
if ({{=$ruleErr}}.dataPath === undefined)
|
||||
{{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }};
|
||||
{{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }}
|
||||
{{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}";
|
||||
{{# _inline ? '}' : '' }}
|
||||
{{? it.opts.verbose }}
|
||||
{{=$ruleErr}}.schema = {{=$schemaValue}};
|
||||
{{=$ruleErr}}.data = {{=$data}};
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
if ({{=$schemaValue}} === undefined) {
|
||||
{{=$valid}} = true;
|
||||
} else {
|
||||
{{? $validateSchema }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
|
||||
if ({{=$valid}}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.statements }}
|
||||
{{= $ruleValidate.validate }}
|
||||
{{??}}
|
||||
{{=$valid}} = {{= $ruleValidate.validate }};
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
}}
|
||||
{{# def.setCompositeRule }}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.callRuleValidate }}
|
||||
{{# def.storeDefOut:def_callRuleValidate }}
|
||||
|
||||
{{? $rDef.errors === false }}
|
||||
{{=$valid}} = {{? $asyncKeyword }}await {{?}}{{= def_callRuleValidate }};
|
||||
{{??}}
|
||||
{{? $asyncKeyword }}
|
||||
{{ $ruleErrs = 'customErrors' + $lvl; }}
|
||||
var {{=$ruleErrs}} = null;
|
||||
try {
|
||||
{{=$valid}} = await {{= def_callRuleValidate }};
|
||||
} catch (e) {
|
||||
{{=$valid}} = false;
|
||||
if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors;
|
||||
else throw e;
|
||||
}
|
||||
{{??}}
|
||||
{{=$ruleErrs}} = null;
|
||||
{{=$valid}} = {{= def_callRuleValidate }};
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $rDef.modifying }}
|
||||
if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
|
||||
{{?}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
{{## def.notValidationResult:
|
||||
{{? $rDef.valid === undefined }}
|
||||
!{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}}
|
||||
{{??}}
|
||||
{{= !$rDef.valid }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{? $rDef.valid }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
if ({{# def.notValidationResult }}) {
|
||||
{{ $errorKeyword = $rule.keyword; }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.error:'custom' }}
|
||||
{{# def.storeDefOut:def_customError }}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.errors }}
|
||||
{{? $rDef.errors != 'full' }}
|
||||
{{# def.extendErrors:true }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{= def_customError }}
|
||||
} else {
|
||||
{{# def.extendErrors:true }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.extraError:'custom' }}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if (Array.isArray({{=$ruleErrs}})) {
|
||||
if (vErrors === null) vErrors = {{=$ruleErrs}};
|
||||
else vErrors = vErrors.concat({{=$ruleErrs}});
|
||||
errors = vErrors.length;
|
||||
{{# def.extendErrors:false }}
|
||||
} else {
|
||||
{{= def_customError }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
||||
47
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/defaults.def
generated
vendored
Executable file
47
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/defaults.def
generated
vendored
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
{{## def.assignDefault:
|
||||
{{? it.compositeRule }}
|
||||
{{
|
||||
if (it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored for: ' + $passData;
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
if ({{=$passData}} === undefined
|
||||
{{? it.opts.useDefaults == 'empty' }}
|
||||
|| {{=$passData}} === null
|
||||
|| {{=$passData}} === ''
|
||||
{{?}}
|
||||
)
|
||||
{{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
|
||||
{{= it.useDefault($sch.default) }}
|
||||
{{??}}
|
||||
{{= JSON.stringify($sch.default) }}
|
||||
{{?}};
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultProperties:
|
||||
{{
|
||||
var $schema = it.schema.properties
|
||||
, $schemaKeys = Object.keys($schema); }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + it.util.getProperty($propertyKey); }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultItems:
|
||||
{{~ it.schema.items:$sch:$i }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + '[' + $i + ']'; }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
||||
203
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/definitions.def
generated
vendored
Executable file
203
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/definitions.def
generated
vendored
Executable file
|
|
@ -0,0 +1,203 @@
|
|||
{{## def.setupKeyword:
|
||||
{{
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setCompositeRule:
|
||||
{{
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetCompositeRule:
|
||||
{{ it.compositeRule = $it.compositeRule = $wasComposite; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setupNextLevel:
|
||||
{{
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifResultValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.elseIfValid:
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
else {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.nonEmptySchema:_schema:
|
||||
(it.opts.strictKeywords
|
||||
? (typeof _schema == 'object' && Object.keys(_schema).length > 0)
|
||||
|| _schema === false
|
||||
: it.util.schemaHasRules(_schema, it.RULES.all))
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.strLength:
|
||||
{{? it.opts.unicode === false }}
|
||||
{{=$data}}.length
|
||||
{{??}}
|
||||
ucs2length({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.willOptimize:
|
||||
it.util.varOccurences($code, $nextData) < 2
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.generateSubschemaCode:
|
||||
{{
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.insertSubschemaCode:
|
||||
{{= it.validate($it) }}
|
||||
{{ $it.baseId = $currentBaseId; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._optimizeValidate:
|
||||
it.util.varReplace($code, $nextData, $passData)
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.optimizeValidate:
|
||||
{{? {{# def.willOptimize}} }}
|
||||
{{= {{# def._optimizeValidate }} }}
|
||||
{{??}}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{= $code }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$data:
|
||||
{{
|
||||
var $isData = it.opts.$data && $schema && $schema.$data
|
||||
, $schemaValue;
|
||||
}}
|
||||
{{? $isData }}
|
||||
var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
|
||||
{{ $schemaValue = 'schema' + $lvl; }}
|
||||
{{??}}
|
||||
{{ $schemaValue = $schema; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$dataNotType:_type:
|
||||
{{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.check$dataIsArray:
|
||||
if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
|
||||
else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
|
||||
else {
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.numberKeyword:
|
||||
{{? !($isData || typeof $schema == 'number') }}
|
||||
{{ throw new Error($keyword + ' must be number'); }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.beginDefOut:
|
||||
{{
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.storeDefOut:_variable:
|
||||
{{
|
||||
var _variable = out;
|
||||
out = $$outStack.pop();
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
|
||||
|
||||
{{## def.setParentData:
|
||||
{{
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
|
||||
, $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
}}
|
||||
#}}
|
||||
|
||||
{{## def.passParentData:
|
||||
{{# def.setParentData }}
|
||||
, {{= $parentData }}
|
||||
, {{= $parentDataProperty }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.iterateProperties:
|
||||
{{? $ownProperties }}
|
||||
{{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}});
|
||||
for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) {
|
||||
var {{=$key}} = {{=$dataProperties}}[{{=$idx}}];
|
||||
{{??}}
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.noPropertyInData:
|
||||
{{=$useData}} === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}')
|
||||
#}}
|
||||
79
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
Executable file
79
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.propertyInData:
|
||||
{{=$data}}{{= it.util.getProperty($property) }} !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $schemaDeps = {}
|
||||
, $propertyDeps = {}
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
|
||||
for ($property in $schema) {
|
||||
if ($property == '__proto__') continue;
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
}
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{ var $currentErrorPath = it.errorPath; }}
|
||||
|
||||
var missing{{=$lvl}};
|
||||
{{ for (var $property in $propertyDeps) { }}
|
||||
{{ $deps = $propertyDeps[$property]; }}
|
||||
{{? $deps.length }}
|
||||
if ({{# def.propertyInData }}
|
||||
{{? $breakOnError }}
|
||||
&& ({{# def.checkMissingProperty:$deps }})) {
|
||||
{{# def.errorMissingProperty:'dependencies' }}
|
||||
{{??}}
|
||||
) {
|
||||
{{~ $deps:$propertyKey }}
|
||||
{{# def.allErrorsMissingProperty:'dependencies' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
} {{# def.elseIfValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{
|
||||
it.errorPath = $currentErrorPath;
|
||||
var $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
|
||||
{{ for (var $property in $schemaDeps) { }}
|
||||
{{ var $sch = $schemaDeps[$property]; }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{# def.propertyInData }}) {
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
30
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/enum.jst
generated
vendored
Executable file
30
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/enum.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $vSchema = 'schema' + $lvl;
|
||||
}}
|
||||
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}};
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
{{=$valid}} = false;
|
||||
|
||||
for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++)
|
||||
if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) {
|
||||
{{=$valid}} = true;
|
||||
break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'enum' }}
|
||||
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
194
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/errors.def
generated
vendored
Executable file
194
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/errors.def
generated
vendored
Executable file
|
|
@ -0,0 +1,194 @@
|
|||
{{# def.definitions }}
|
||||
|
||||
{{## def._error:_rule:
|
||||
{{ 'istanbul ignore else'; }}
|
||||
{{? it.createErrors !== false }}
|
||||
{
|
||||
keyword: '{{= $errorKeyword || _rule }}'
|
||||
, dataPath: (dataPath || '') + {{= it.errorPath }}
|
||||
, schemaPath: {{=it.util.toQuotedString($errSchemaPath)}}
|
||||
, params: {{# def._errorParams[_rule] }}
|
||||
{{? it.opts.messages !== false }}
|
||||
, message: {{# def._errorMessages[_rule] }}
|
||||
{{?}}
|
||||
{{? it.opts.verbose }}
|
||||
, schema: {{# def._errorSchemas[_rule] }}
|
||||
, parentSchema: validate.schema{{=it.schemaPath}}
|
||||
, data: {{=$data}}
|
||||
{{?}}
|
||||
}
|
||||
{{??}}
|
||||
{}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._addError:_rule:
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.addError:_rule:
|
||||
var err = {{# def._error:_rule }};
|
||||
{{# def._addError:_rule }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.error:_rule:
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._error:_rule }}
|
||||
{{# def.storeDefOut:__err }}
|
||||
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError([{{=__err}}]);
|
||||
{{??}}
|
||||
validate.errors = [{{=__err}}];
|
||||
return false;
|
||||
{{?}}
|
||||
{{??}}
|
||||
var err = {{=__err}};
|
||||
{{# def._addError:_rule }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.extraError:_rule:
|
||||
{{# def.addError:_rule}}
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError(vErrors);
|
||||
{{??}}
|
||||
validate.errors = vErrors;
|
||||
return false;
|
||||
{{?}}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.checkError:_rule:
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:_rule }}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetErrors:
|
||||
errors = {{=$errs}};
|
||||
if (vErrors !== null) {
|
||||
if ({{=$errs}}) vErrors.length = {{=$errs}};
|
||||
else vErrors = null;
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}}
|
||||
{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}}
|
||||
{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}}
|
||||
|
||||
{{## def._errorMessages = {
|
||||
'false schema': "'boolean schema is false'",
|
||||
$ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'",
|
||||
additionalItems: "'should NOT have more than {{=$schema.length}} items'",
|
||||
additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'",
|
||||
anyOf: "'should match some schema in anyOf'",
|
||||
const: "'should be equal to constant'",
|
||||
contains: "'should contain a valid item'",
|
||||
dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'",
|
||||
'enum': "'should be equal to one of the allowed values'",
|
||||
format: "'should match format \"{{#def.concatSchemaEQ}}\"'",
|
||||
'if': "'should match \"' + {{=$ifClause}} + '\" schema'",
|
||||
_limit: "'should be {{=$opStr}} {{#def.appendSchema}}",
|
||||
_exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'",
|
||||
_limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'",
|
||||
_limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'",
|
||||
_limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'",
|
||||
multipleOf: "'should be multiple of {{#def.appendSchema}}",
|
||||
not: "'should NOT be valid'",
|
||||
oneOf: "'should match exactly one schema in oneOf'",
|
||||
pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'",
|
||||
propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'",
|
||||
required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'",
|
||||
type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'",
|
||||
uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'",
|
||||
custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'",
|
||||
patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''",
|
||||
switch: "'should pass \"switch\" keyword validation'",
|
||||
_formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'",
|
||||
_formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}}
|
||||
{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorSchemas = {
|
||||
'false schema': "false",
|
||||
$ref: "{{=it.util.toQuotedString($schema)}}",
|
||||
additionalItems: "false",
|
||||
additionalProperties: "false",
|
||||
anyOf: "validate.schema{{=$schemaPath}}",
|
||||
const: "validate.schema{{=$schemaPath}}",
|
||||
contains: "validate.schema{{=$schemaPath}}",
|
||||
dependencies: "validate.schema{{=$schemaPath}}",
|
||||
'enum': "validate.schema{{=$schemaPath}}",
|
||||
format: "{{#def.schemaRefOrQS}}",
|
||||
'if': "validate.schema{{=$schemaPath}}",
|
||||
_limit: "{{#def.schemaRefOrVal}}",
|
||||
_exclusiveLimit: "validate.schema{{=$schemaPath}}",
|
||||
_limitItems: "{{#def.schemaRefOrVal}}",
|
||||
_limitLength: "{{#def.schemaRefOrVal}}",
|
||||
_limitProperties:"{{#def.schemaRefOrVal}}",
|
||||
multipleOf: "{{#def.schemaRefOrVal}}",
|
||||
not: "validate.schema{{=$schemaPath}}",
|
||||
oneOf: "validate.schema{{=$schemaPath}}",
|
||||
pattern: "{{#def.schemaRefOrQS}}",
|
||||
propertyNames: "validate.schema{{=$schemaPath}}",
|
||||
required: "validate.schema{{=$schemaPath}}",
|
||||
type: "validate.schema{{=$schemaPath}}",
|
||||
uniqueItems: "{{#def.schemaRefOrVal}}",
|
||||
custom: "validate.schema{{=$schemaPath}}",
|
||||
patternRequired: "validate.schema{{=$schemaPath}}",
|
||||
switch: "validate.schema{{=$schemaPath}}",
|
||||
_formatLimit: "{{#def.schemaRefOrQS}}",
|
||||
_formatExclusiveLimit: "validate.schema{{=$schemaPath}}"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorParams = {
|
||||
'false schema': "{}",
|
||||
$ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }",
|
||||
additionalItems: "{ limit: {{=$schema.length}} }",
|
||||
additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }",
|
||||
anyOf: "{}",
|
||||
const: "{ allowedValue: schema{{=$lvl}} }",
|
||||
contains: "{}",
|
||||
dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }",
|
||||
'enum': "{ allowedValues: schema{{=$lvl}} }",
|
||||
format: "{ format: {{#def.schemaValueQS}} }",
|
||||
'if': "{ failingKeyword: {{=$ifClause}} }",
|
||||
_limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }",
|
||||
_exclusiveLimit: "{}",
|
||||
_limitItems: "{ limit: {{=$schemaValue}} }",
|
||||
_limitLength: "{ limit: {{=$schemaValue}} }",
|
||||
_limitProperties:"{ limit: {{=$schemaValue}} }",
|
||||
multipleOf: "{ multipleOf: {{=$schemaValue}} }",
|
||||
not: "{}",
|
||||
oneOf: "{ passingSchemas: {{=$passingSchemas}} }",
|
||||
pattern: "{ pattern: {{#def.schemaValueQS}} }",
|
||||
propertyNames: "{ propertyName: '{{=$invalidName}}' }",
|
||||
required: "{ missingProperty: '{{=$missingProperty}}' }",
|
||||
type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }",
|
||||
uniqueItems: "{ i: i, j: j }",
|
||||
custom: "{ keyword: '{{=$rule.keyword}}' }",
|
||||
patternRequired: "{ missingPattern: '{{=$missingPattern}}' }",
|
||||
switch: "{ caseIndex: {{=$caseIndex}} }",
|
||||
_formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }",
|
||||
_formatExclusiveLimit: "{}"
|
||||
} #}}
|
||||
106
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/format.jst
generated
vendored
Executable file
106
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/format.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,106 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def.skipFormat:
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormat }}{{?}}
|
||||
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{## def.$dataCheckFormat:
|
||||
{{# def.$dataNotType:'string' }}
|
||||
({{? $unknownFormats != 'ignore' }}
|
||||
({{=$schemaValue}} && !{{=$format}}
|
||||
{{? $allowUnknown }}
|
||||
&& self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1
|
||||
{{?}}) ||
|
||||
{{?}}
|
||||
({{=$format}} && {{=$formatType}} == '{{=$ruleType}}'
|
||||
&& !(typeof {{=$format}} == 'function'
|
||||
? {{? it.async}}
|
||||
(async{{=$lvl}} ? await {{=$format}}({{=$data}}) : {{=$format}}({{=$data}}))
|
||||
{{??}}
|
||||
{{=$format}}({{=$data}})
|
||||
{{?}}
|
||||
: {{=$format}}.test({{=$data}}))))
|
||||
#}}
|
||||
|
||||
{{## def.checkFormat:
|
||||
{{
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
if ($isObject) $formatRef += '.validate';
|
||||
}}
|
||||
{{? typeof $format == 'function' }}
|
||||
{{=$formatRef}}({{=$data}})
|
||||
{{??}}
|
||||
{{=$formatRef}}.test({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $unknownFormats = it.opts.unknownFormats
|
||||
, $allowUnknown = Array.isArray($unknownFormats);
|
||||
}}
|
||||
|
||||
{{? $isData }}
|
||||
{{
|
||||
var $format = 'format' + $lvl
|
||||
, $isObject = 'isObject' + $lvl
|
||||
, $formatType = 'formatType' + $lvl;
|
||||
}}
|
||||
var {{=$format}} = formats[{{=$schemaValue}}];
|
||||
var {{=$isObject}} = typeof {{=$format}} == 'object'
|
||||
&& !({{=$format}} instanceof RegExp)
|
||||
&& {{=$format}}.validate;
|
||||
var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string';
|
||||
if ({{=$isObject}}) {
|
||||
{{? it.async}}
|
||||
var async{{=$lvl}} = {{=$format}}.async;
|
||||
{{?}}
|
||||
{{=$format}} = {{=$format}}.validate;
|
||||
}
|
||||
if ({{# def.$dataCheckFormat }}) {
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schema]; }}
|
||||
{{? !$format }}
|
||||
{{? $unknownFormats == 'ignore' }}
|
||||
{{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{# def.skipFormat }}
|
||||
{{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }}
|
||||
{{# def.skipFormat }}
|
||||
{{??}}
|
||||
{{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{
|
||||
var $isObject = typeof $format == 'object'
|
||||
&& !($format instanceof RegExp)
|
||||
&& $format.validate;
|
||||
var $formatType = $isObject && $format.type || 'string';
|
||||
if ($isObject) {
|
||||
var $async = $format.async === true;
|
||||
$format = $format.validate;
|
||||
}
|
||||
}}
|
||||
{{? $formatType != $ruleType }}
|
||||
{{# def.skipFormat }}
|
||||
{{?}}
|
||||
{{? $async }}
|
||||
{{
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
}}
|
||||
if (!(await {{=$formatRef}}({{=$data}}))) {
|
||||
{{??}}
|
||||
if (!{{# def.checkFormat }}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{# def.error:'format' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
73
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/if.jst
generated
vendored
Executable file
73
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/if.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,73 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateIfClause:_clause:
|
||||
{{
|
||||
$it.schema = it.schema['_clause'];
|
||||
$it.schemaPath = it.schemaPath + '._clause';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/_clause';
|
||||
}}
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{=$valid}} = {{=$nextValid}};
|
||||
{{? $thenPresent && $elsePresent }}
|
||||
{{ $ifClause = 'ifClause' + $lvl; }}
|
||||
var {{=$ifClause}} = '_clause';
|
||||
{{??}}
|
||||
{{ $ifClause = '\'_clause\''; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $thenSch = it.schema['then']
|
||||
, $elseSch = it.schema['else']
|
||||
, $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }}
|
||||
, $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }}
|
||||
, $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
{{? $thenPresent || $elsePresent }}
|
||||
{{
|
||||
var $ifClause;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{ $it.createErrors = true; }}
|
||||
{{# def.resetErrors }}
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{? $thenPresent }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.validateIfClause:then }}
|
||||
}
|
||||
{{? $elsePresent }}
|
||||
else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
if (!{{=$nextValid}}) {
|
||||
{{?}}
|
||||
|
||||
{{? $elsePresent }}
|
||||
{{# def.validateIfClause:else }}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'if' }}
|
||||
}
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
98
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/items.jst
generated
vendored
Executable file
98
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/items.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,98 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateItems:startFrom:
|
||||
for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (!{{=$nextValid}}) break;
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? Array.isArray($schema) }}
|
||||
{{ /* 'items' is an array of schemas */}}
|
||||
{{ var $additionalItems = it.schema.additionalItems; }}
|
||||
{{? $additionalItems === false }}
|
||||
{{=$valid}} = {{=$data}}.length <= {{= $schema.length }};
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{# def.checkError:'additionalItems' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{# def.elseIfValid}}
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{=$i}}) {
|
||||
{{
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }}
|
||||
{{
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{= $schema.length }}) {
|
||||
{{# def.validateItems: $schema.length }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{?? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{ /* 'items' is a single schema */}}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
{{# def.validateItems: 0 }}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
39
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/missing.def
generated
vendored
Executable file
39
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/missing.def
generated
vendored
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
{{## def.checkMissingProperty:_properties:
|
||||
{{~ _properties:$propertyKey:$i }}
|
||||
{{?$i}} || {{?}}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $useData = $data + $prop;
|
||||
}}
|
||||
( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) )
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.errorMissingProperty:_error:
|
||||
{{
|
||||
var $propertyPath = 'missing' + $lvl
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers
|
||||
? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
|
||||
: $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
}}
|
||||
{{# def.error:_error }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.allErrorsMissingProperty:_error:
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey)
|
||||
, $useData = $data + $prop;
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{# def.addError:_error }}
|
||||
}
|
||||
#}}
|
||||
22
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
Executable file
22
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,22 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{# def.numberKeyword }}
|
||||
|
||||
var division{{=$lvl}};
|
||||
if ({{?$isData}}
|
||||
{{=$schemaValue}} !== undefined && (
|
||||
typeof {{=$schemaValue}} != 'number' ||
|
||||
{{?}}
|
||||
(division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
|
||||
{{? it.opts.multipleOfPrecision }}
|
||||
Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
|
||||
{{??}}
|
||||
division{{=$lvl}} !== parseInt(division{{=$lvl}})
|
||||
{{?}}
|
||||
)
|
||||
{{?$isData}} ) {{?}} ) {
|
||||
{{# def.error:'multipleOf' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
43
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/not.jst
generated
vendored
Executable file
43
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/not.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.createErrors = false;
|
||||
var $allErrorsOption;
|
||||
if ($it.opts.allErrors) {
|
||||
$allErrorsOption = $it.opts.allErrors;
|
||||
$it.opts.allErrors = false;
|
||||
}
|
||||
}}
|
||||
{{= it.validate($it) }}
|
||||
{{
|
||||
$it.createErrors = true;
|
||||
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
|
||||
}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.error:'not' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{# def.addError:'not' }}
|
||||
{{? $breakOnError}}
|
||||
if (false) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
54
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/oneOf.jst
generated
vendored
Executable file
54
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/oneOf.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,54 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $prevValid = 'prevValid' + $lvl
|
||||
, $passingSchemas = 'passingSchemas' + $lvl;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors
|
||||
, {{=$prevValid}} = false
|
||||
, {{=$valid}} = false
|
||||
, {{=$passingSchemas}} = null;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{??}}
|
||||
var {{=$nextValid}} = true;
|
||||
{{?}}
|
||||
|
||||
{{? $i }}
|
||||
if ({{=$nextValid}} && {{=$prevValid}}) {
|
||||
{{=$valid}} = false;
|
||||
{{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}];
|
||||
} else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{=$valid}} = {{=$prevValid}} = true;
|
||||
{{=$passingSchemas}} = {{=$i}};
|
||||
}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'oneOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
14
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/pattern.jst
generated
vendored
Executable file
14
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/pattern.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $regexp = $isData
|
||||
? '(new RegExp(' + $schemaValue + '))'
|
||||
: it.usePattern($schema);
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
|
||||
{{# def.error:'pattern' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
245
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/properties.jst
generated
vendored
Executable file
245
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/properties.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,245 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateAdditional:
|
||||
{{ /* additionalProperties is schema */
|
||||
$it.schema = $aProperties;
|
||||
$it.schemaPath = it.schemaPath + '.additionalProperties';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
$it.errorPath = it.opts._errorDataPathProperty
|
||||
? it.errorPath
|
||||
: it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl;
|
||||
|
||||
var $schemaKeys = Object.keys($schema || {}).filter(notProto)
|
||||
, $pProperties = it.schema.patternProperties || {}
|
||||
, $pPropertyKeys = Object.keys($pProperties).filter(notProto)
|
||||
, $aProperties = it.schema.additionalProperties
|
||||
, $someProperties = $schemaKeys.length || $pPropertyKeys.length
|
||||
, $noAdditional = $aProperties === false
|
||||
, $additionalIsSchema = typeof $aProperties == 'object'
|
||||
&& Object.keys($aProperties).length
|
||||
, $removeAdditional = it.opts.removeAdditional
|
||||
, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired) {
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}
|
||||
|
||||
function notProto(p) { return p !== '__proto__'; }
|
||||
}}
|
||||
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$nextValid}} = true;
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
|
||||
{{? $checkAdditional }}
|
||||
{{# def.iterateProperties }}
|
||||
{{? $someProperties }}
|
||||
var isAdditional{{=$lvl}} = !(false
|
||||
{{? $schemaKeys.length }}
|
||||
{{? $schemaKeys.length > 8 }}
|
||||
|| validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}})
|
||||
{{??}}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
|| {{=$key}} == {{= it.util.toQuotedString($propertyKey) }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty:$i }}
|
||||
|| {{= it.usePattern($pProperty) }}.test({{=$key}})
|
||||
{{~}}
|
||||
{{?}}
|
||||
);
|
||||
|
||||
if (isAdditional{{=$lvl}}) {
|
||||
{{?}}
|
||||
{{? $removeAdditional == 'all' }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath;
|
||||
var $additionalProperty = '\' + ' + $key + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
{{? $noAdditional }}
|
||||
{{? $removeAdditional }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
}}
|
||||
{{# def.error:'additionalProperties' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
{{?}}
|
||||
{{?? $additionalIsSchema }}
|
||||
{{? $removeAdditional == 'failing' }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{# def.validateAdditional }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
errors = {{=$errs}};
|
||||
if (validate.errors !== null) {
|
||||
if (errors) validate.errors.length = errors;
|
||||
else validate.errors = null;
|
||||
}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{??}}
|
||||
{{# def.validateAdditional }}
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
{{?}}
|
||||
{{? $someProperties }}
|
||||
}
|
||||
{{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }}
|
||||
|
||||
{{? $schemaKeys.length }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $passData = $data + $prop
|
||||
, $hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + $prop;
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
|
||||
$it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
|
||||
$it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
|
||||
{{? {{# def.willOptimize }} }}
|
||||
{{
|
||||
$code = {{# def._optimizeValidate }};
|
||||
var $useData = $passData;
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $useData = $nextData; }}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{?}}
|
||||
|
||||
{{? $hasDefault }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{? $requiredHash && $requiredHash[$propertyKey] }}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $currErrSchemaPath = $errSchemaPath
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
$errSchemaPath = it.errSchemaPath + '/required';
|
||||
}}
|
||||
{{# def.error:'required' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
} else {
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{=$nextValid}} = true;
|
||||
} else {
|
||||
{{??}}
|
||||
if ({{=$useData}} !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& {{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{= $code }}
|
||||
}
|
||||
{{?}} {{ /* $hasDefault */ }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty }}
|
||||
{{ var $sch = $pProperties[$pProperty]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/'
|
||||
+ it.util.escapeFragment($pProperty);
|
||||
}}
|
||||
|
||||
{{# def.iterateProperties }}
|
||||
if ({{= it.usePattern($pProperty) }}.test({{=$key}})) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
52
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/propertyNames.jst
generated
vendored
Executable file
52
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/propertyNames.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $i = 'i' + $lvl
|
||||
, $invalidName = '\' + ' + $key + ' + \''
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
{{# def.iterateProperties }}
|
||||
var startErrs{{=$lvl}} = errors;
|
||||
|
||||
{{ var $passData = $key; }}
|
||||
{{# def.setCompositeRule }}
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
vErrors[{{=$i}}].propertyName = {{=$key}};
|
||||
}
|
||||
{{# def.extraError:'propertyNames' }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
85
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/ref.jst
generated
vendored
Executable file
85
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/ref.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,85 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def._validateRef:_v:
|
||||
{{? it.opts.passContext }}
|
||||
{{=_v}}.call(this,
|
||||
{{??}}
|
||||
{{=_v}}(
|
||||
{{?}}
|
||||
{{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData)
|
||||
#}}
|
||||
|
||||
{{ var $async, $refCode; }}
|
||||
{{? $schema == '#' || $schema == '#/' }}
|
||||
{{
|
||||
if (it.isRoot) {
|
||||
$async = it.async;
|
||||
$refCode = 'validate';
|
||||
} else {
|
||||
$async = it.root.schema.$async === true;
|
||||
$refCode = 'root.refVal[0]';
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }}
|
||||
{{? $refVal === undefined }}
|
||||
{{ var $message = it.MissingRefError.message(it.baseId, $schema); }}
|
||||
{{? it.opts.missingRefs == 'fail' }}
|
||||
{{ it.logger.error($message); }}
|
||||
{{# def.error:'$ref' }}
|
||||
{{? $breakOnError }} if (false) { {{?}}
|
||||
{{?? it.opts.missingRefs == 'ignore' }}
|
||||
{{ it.logger.warn($message); }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
{{ throw new it.MissingRefError(it.baseId, $schema, $message); }}
|
||||
{{?}}
|
||||
{{?? $refVal.inline }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $refVal.schema;
|
||||
$it.schemaPath = '';
|
||||
$it.errSchemaPath = $schema;
|
||||
}}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }}
|
||||
{{= $code }}
|
||||
{{? $breakOnError}}
|
||||
if ({{=$nextValid}}) {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{
|
||||
$async = $refVal.$async === true || (it.async && $refVal.$async !== false);
|
||||
$refCode = $refVal.code;
|
||||
}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $refCode }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._validateRef:$refCode }}
|
||||
{{# def.storeDefOut:__callValidate }}
|
||||
|
||||
{{? $async }}
|
||||
{{ if (!it.async) throw new Error('async schema referenced by sync schema'); }}
|
||||
{{? $breakOnError }} var {{=$valid}}; {{?}}
|
||||
try {
|
||||
await {{=__callValidate}};
|
||||
{{? $breakOnError }} {{=$valid}} = true; {{?}}
|
||||
} catch (e) {
|
||||
if (!(e instanceof ValidationError)) throw e;
|
||||
if (vErrors === null) vErrors = e.errors;
|
||||
else vErrors = vErrors.concat(e.errors);
|
||||
errors = vErrors.length;
|
||||
{{? $breakOnError }} {{=$valid}} = false; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} if ({{=$valid}}) { {{?}}
|
||||
{{??}}
|
||||
if (!{{=__callValidate}}) {
|
||||
if (vErrors === null) vErrors = {{=$refCode}}.errors;
|
||||
else vErrors = vErrors.concat({{=$refCode}}.errors);
|
||||
errors = vErrors.length;
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
108
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/required.jst
generated
vendored
Executable file
108
node_modules/webpack-dev-server/node_modules/ajv/lib/dot/required.jst
generated
vendored
Executable file
|
|
@ -0,0 +1,108 @@
|
|||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $vSchema = 'schema' + $lvl; }}
|
||||
|
||||
{{## def.setupLoop:
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $propertyPath = 'schema' + $lvl + '[' + $i + ']'
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isRequiredOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}])
|
||||
#}}
|
||||
|
||||
|
||||
{{? !$isData }}
|
||||
{{? $schema.length < it.opts.loopRequired &&
|
||||
it.schema.properties && Object.keys(it.schema.properties).length }}
|
||||
{{ var $required = []; }}
|
||||
{{~ $schema:$property }}
|
||||
{{ var $propertySch = it.schema.properties[$property]; }}
|
||||
{{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
|
||||
{{ $required[$required.length] = $property; }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{??}}
|
||||
{{ var $required = $schema; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $isData || $required.length }}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $loopRequired = $isData || $required.length >= it.opts.loopRequired
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
var missing{{=$lvl}};
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
{{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& {{# def.isRequiredOwnProperty }}
|
||||
{{?}};
|
||||
if (!{{=$valid}}) break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'required' }}
|
||||
else {
|
||||
{{??}}
|
||||
if ({{# def.checkMissingProperty:$required }}) {
|
||||
{{# def.errorMissingProperty:'required' }}
|
||||
} else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
{{? $isData }}
|
||||
if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
|
||||
{{# def.addError:'required' }}
|
||||
} else if ({{=$vSchema}} !== undefined) {
|
||||
{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isRequiredOwnProperty }}
|
||||
{{?}}) {
|
||||
{{# def.addError:'required' }}
|
||||
}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
{{??}}
|
||||
{{~ $required:$propertyKey }}
|
||||
{{# def.allErrorsMissingProperty:'required' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
|
||||
{{?? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue