This commit is contained in:
darenhsu
2022-07-17 13:16:16 +08:00
parent 84759556ff
commit befd344ab0
28070 changed files with 4008428 additions and 1 deletions
+751
View File
@@ -0,0 +1,751 @@
# 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.
## [5.12.0](https://github.com/nuxt-community/axios-module/compare/v5.11.0...v5.12.0) (2020-07-10)
### Features
* **plugin:** support runtimeConfig ([#387](https://github.com/nuxt-community/axios-module/issues/387)) ([351ea5e](https://github.com/nuxt-community/axios-module/commit/351ea5ee459eea53b9124de75ebfa7674d7ccd40))
### Bug Fixes
* **types:** add axios-retry type def for more options ([#378](https://github.com/nuxt-community/axios-module/issues/378)) ([40a0c58](https://github.com/nuxt-community/axios-module/commit/40a0c5885819406fec88b212f0219539fbc0d229))
* **types:** add prefix, port, host options to axios types ([#381](https://github.com/nuxt-community/axios-module/issues/381)) ([301805b](https://github.com/nuxt-community/axios-module/commit/301805b5eade85ff30f80e9f34341d586a056d8b))
## [5.11.0](https://github.com/nuxt-community/axios-module/compare/v5.10.3...v5.11.0) (2020-06-05)
### Features
* experimental runtimeConfig support ([07ca13c](https://github.com/nuxt-community/axios-module/commit/07ca13c58194c8c48a61896a07505a936c26eb93))
### Bug Fixes
* **plugin:** always get global `$nuxt` while loading ([#364](https://github.com/nuxt-community/axios-module/issues/364)) ([e848b9d](https://github.com/nuxt-community/axios-module/commit/e848b9d0b0a1804388eb51d328ab6054d89aa979))
### [5.10.3](https://github.com/nuxt-community/axios-module/compare/v5.10.2...v5.10.3) (2020-04-30)
### Bug Fixes
* globalName fallback for nuxt < 2.2.0 ([12da6c8](https://github.com/nuxt-community/axios-module/commit/12da6c8e2feb8cf4f7e918fbbe4693400152c1ff))
### [5.10.2](https://github.com/nuxt-community/axios-module/compare/v5.10.1...v5.10.2) (2020-04-27)
### Bug Fixes
* **plugin:** add missing $ prefix to globalName ([#356](https://github.com/nuxt-community/axios-module/issues/356)) ([47788bd](https://github.com/nuxt-community/axios-module/commit/47788bdd0384807c9d63aa3caa7f2031f44d4c96))
### [5.10.1](https://github.com/nuxt-community/axios-module/compare/v5.10.0...v5.10.1) (2020-04-22)
## [5.10.0](https://github.com/nuxt-community/axios-module/compare/v5.9.7...v5.10.0) (2020-04-21)
### Features
* **plugin:** enable server brotli if supported (closes [#276](https://github.com/nuxt-community/axios-module/issues/276)) ([074f98c](https://github.com/nuxt-community/axios-module/commit/074f98cbdf409473357b2cd24cd6cb13fe75f149))
### Bug Fixes
* **module:** browserBaseURL as empty string (fixes [#303](https://github.com/nuxt-community/axios-module/issues/303)) ([18afe5c](https://github.com/nuxt-community/axios-module/commit/18afe5c1a9aac6380bdd5ffb337a0968a6d504aa))
* **plugin:** preserve default headers (fixes [#323](https://github.com/nuxt-community/axios-module/issues/323)) ([6c5605d](https://github.com/nuxt-community/axios-module/commit/6c5605df0b77e9e4df32ad1eaecb2eac60eb1c1d))
* **plugin:** use `globalName` instead of `$nuxt` (fixes [#345](https://github.com/nuxt-community/axios-module/issues/345)) ([fd1f8ec](https://github.com/nuxt-community/axios-module/commit/fd1f8ec17160f6e88610e3dfa2153423b3140592))
### [5.9.7](https://github.com/nuxt-community/axios-module/compare/v5.9.6...v5.9.7) (2020-03-30)
### Bug Fixes
* **plugin:** don't convert falsy urls to string ([#347](https://github.com/nuxt-community/axios-module/issues/347)) ([b8a510e](https://github.com/nuxt-community/axios-module/commit/b8a510ee989fabf10d93d99a7ae1e17c0fc3eca0))
### [5.9.6](https://github.com/nuxt-community/axios-module/compare/v5.9.5...v5.9.6) (2020-03-27)
### Bug Fixes
* **module:** always set protocol to `https` when `https: true` is set ([#344](https://github.com/nuxt-community/axios-module/issues/344)) ([6f82570](https://github.com/nuxt-community/axios-module/commit/6f82570b163c4d4635321601f05d0c4641a00f19))
### [5.9.5](https://github.com/nuxt-community/axios-module/compare/v5.9.3...v5.9.5) (2020-02-02)
### Bug Fixes
* **types:** add `setBaseURL` ([#329](https://github.com/nuxt-community/axios-module/issues/329)) ([9d00d6a](https://github.com/nuxt-community/axios-module/commit/9d00d6a9b5e21396d3b195f824dd2cfe99ca9012))
### [5.9.4](https://github.com/nuxt-community/axios-module/compare/v5.9.3...v5.9.4) (2020-01-30)
### Bug Fixes
* **types:** add `setBaseURL` ([#329](https://github.com/nuxt-community/axios-module/issues/329)) ([9d00d6a](https://github.com/nuxt-community/axios-module/commit/9d00d6a9b5e21396d3b195f824dd2cfe99ca9012))
### [5.9.3](https://github.com/nuxt-community/axios-module/compare/v5.9.2...v5.9.3) (2020-01-11)
### Bug Fixes
* **types:** extend from `AxiosStatic` ([#319](https://github.com/nuxt-community/axios-module/issues/319)) ([9223a57](https://github.com/nuxt-community/axios-module/commit/9223a57c7ac65b2c414858360126d23bf60f9c82))
### [5.9.2](https://github.com/nuxt-community/axios-module/compare/v5.9.1...v5.9.2) (2020-01-02)
### [5.9.1](https://github.com/nuxt-community/axios-module/compare/v5.9.0...v5.9.1) (2020-01-02)
## [5.9.0](https://github.com/nuxt-community/axios-module/compare/v5.6.0...v5.9.0) (2019-12-17)
### Features
* add `CancelToken` and `isCancel` to axios instance ([#292](https://github.com/nuxt-community/axios-module/issues/292)) ([474910b](https://github.com/nuxt-community/axios-module/commit/474910bd875f2d1f6bf0e39e511db87b08673cdc))
* add function helper `setBaseURL` ([#296](https://github.com/nuxt-community/axios-module/issues/296)) ([c429d55](https://github.com/nuxt-community/axios-module/commit/c429d555202620343bc79b70bad3aa61958fb368))
* allow adding custom headers with nuxt config ([#294](https://github.com/nuxt-community/axios-module/issues/294)) ([af1e86d](https://github.com/nuxt-community/axios-module/commit/af1e86d80065951a2ea47cdb291d159bf174f73a))
* allow creating new instances ([#306](https://github.com/nuxt-community/axios-module/issues/306)) ([2ca95e5](https://github.com/nuxt-community/axios-module/commit/2ca95e58235f10b22317a7c3d53d539d8006f528))
### Bug Fixes
* **docs:** should be response.code instead of code ([#197](https://github.com/nuxt-community/axios-module/issues/197)) ([d07102e](https://github.com/nuxt-community/axios-module/commit/d07102e51f9089988ba2b0184dd442ad4fc9d46a))
* **headers:** don't proxy `content-md5` and `content-type` ([#300](https://github.com/nuxt-community/axios-module/issues/300)) ([46c49e2](https://github.com/nuxt-community/axios-module/commit/46c49e253cb23ffc1cf92ad02a1ab1fc24034906))
* **progress:** handle canceled requests ([#301](https://github.com/nuxt-community/axios-module/issues/301)) ([2903fd5](https://github.com/nuxt-community/axios-module/commit/2903fd579fe5deed693b26660a687089a589ebdf))
* **types:** correct Vuex Store instance ([#227](https://github.com/nuxt-community/axios-module/issues/227)) ([e5747eb](https://github.com/nuxt-community/axios-module/commit/e5747ebb275be56cb4496771911419038952bf4b))
* use `Axios` for `isCancel` (fixes [#301](https://github.com/nuxt-community/axios-module/issues/301)) ([4f71479](https://github.com/nuxt-community/axios-module/commit/4f714791b564b91b915c107299bb3ffecc3a482b))
## [5.8.0](https://github.com/nuxt-community/axios-module/compare/v5.7.1...v5.8.0) (2019-10-23)
### Features
* add `CancelToken` and `isCancel` to axios instance ([#292](https://github.com/nuxt-community/axios-module/issues/292)) ([b9335b1](https://github.com/nuxt-community/axios-module/commit/b9335b1c55b3af34e2d6e5897fedb8372a620ce4))
### [5.7.1](https://github.com/nuxt-community/axios-module/compare/v5.7.0...v5.7.1) (2019-10-22)
### Bug Fixes
* use `Axios` for `isCancel` (fixes [#301](https://github.com/nuxt-community/axios-module/issues/301)) ([82dfccc](https://github.com/nuxt-community/axios-module/commit/82dfccce409e918a91e498af1340408dc0892bf5))
## [5.7.0](https://github.com/nuxt-community/axios-module/compare/v5.6.0...v5.7.0) (2019-10-22)
### Features
* add function helper `setBaseURL` ([#296](https://github.com/nuxt-community/axios-module/issues/296)) ([1028bbc](https://github.com/nuxt-community/axios-module/commit/1028bbcaf2d1a29a33949f05aeb9d519c30b246e))
* allow adding custom headers with nuxt config ([#294](https://github.com/nuxt-community/axios-module/issues/294)) ([3e38906](https://github.com/nuxt-community/axios-module/commit/3e3890616a5ac3eb34b07ec476313bb648aca59a))
### Bug Fixes
* **headers:** don't proxy `content-md5` and `content-type` ([#300](https://github.com/nuxt-community/axios-module/issues/300)) ([f959c58](https://github.com/nuxt-community/axios-module/commit/f959c585254029ac8d623d1472b883022ab115e2))
* **progress:** handle canceled requests ([#301](https://github.com/nuxt-community/axios-module/issues/301)) ([5096060](https://github.com/nuxt-community/axios-module/commit/50960609d913d059758658aa88434bd28faa0c47))
## [5.6.0](https://github.com/nuxt-community/axios-module/compare/v5.5.4...v5.6.0) (2019-08-20)
### Features
* **types:** provide nuxt 2.9 compatible types ([#277](https://github.com/nuxt-community/axios-module/issues/277)) ([7aee77b](https://github.com/nuxt-community/axios-module/commit/7aee77b))
* https detection ([#260](https://github.com/nuxt-community/axios-module/issues/260)) ([953ab8c](https://github.com/nuxt-community/axios-module/commit/953ab8c))
### [5.5.4](https://github.com/nuxt-community/axios-module/compare/v5.5.3...v5.5.4) (2019-06-05)
### Bug Fixes
* ignore content-length header ([41ff27a](https://github.com/nuxt-community/axios-module/commit/41ff27a))
### [5.5.3](https://github.com/nuxt-community/axios-module/compare/v5.5.2...v5.5.3) (2019-05-30)
### Bug Fixes
* bump axios to ^0.19.0 ([ee8f999](https://github.com/nuxt-community/axios-module/commit/ee8f999))
## [5.5.2](https://github.com/nuxt-community/axios-module/compare/v5.5.1...v5.5.2) (2019-05-26)
### Bug Fixes
* vuex typescript type ([#253](https://github.com/nuxt-community/axios-module/issues/253)) ([9205fdf](https://github.com/nuxt-community/axios-module/commit/9205fdf))
## [5.5.1](https://github.com/nuxt-community/axios-module/compare/v5.5.0...v5.5.1) (2019-05-23)
### Bug Fixes
* don't toLowerCase headers for `setHeader` and `setToken` ([#250](https://github.com/nuxt-community/axios-module/issues/250)) ([93469f0](https://github.com/nuxt-community/axios-module/commit/93469f0))
# [5.5.0](https://github.com/nuxt-community/axios-module/compare/v5.4.2...v5.5.0) (2019-05-22)
### Bug Fixes
* lowercase `accept-encoding` header (nuxt/http[#43](https://github.com/nuxt-community/axios-module/issues/43)) ([c17fec2](https://github.com/nuxt-community/axios-module/commit/c17fec2))
### Features
* convert header names to lowercase (nuxt/http[#45](https://github.com/nuxt-community/axios-module/issues/45)) ([2e514a4](https://github.com/nuxt-community/axios-module/commit/2e514a4))
* use `server` of nuxt.config.js to set default baseURL ([#245](https://github.com/nuxt-community/axios-module/issues/245)) ([e1120a9](https://github.com/nuxt-community/axios-module/commit/e1120a9))
## [5.4.1](https://github.com/nuxt-community/axios-module/compare/v5.4.0...v5.4.1) (2019-03-05)
### Bug Fixes
* **types:** correct Vuex Store instance ([#227](https://github.com/nuxt-community/axios-module/issues/227)) ([1ed6e2f](https://github.com/nuxt-community/axios-module/commit/1ed6e2f))
# [5.4.0](https://github.com/nuxt-community/axios-module/compare/v5.3.6...v5.4.0) (2019-03-02)
### Bug Fixes
* **types:** `onResponseError` typo ([#203](https://github.com/nuxt-community/axios-module/issues/203)) ([5fc1441](https://github.com/nuxt-community/axios-module/commit/5fc1441))
* **types:** add AxiosError interface ([efb7191](https://github.com/nuxt-community/axios-module/commit/efb7191))
* **types:** move types in types folder ([deb2834](https://github.com/nuxt-community/axios-module/commit/deb2834))
### Features
* **types:** add Context interface ([7f8952a](https://github.com/nuxt-community/axios-module/commit/7f8952a))
* **types:** add types for helper functions ([#193](https://github.com/nuxt-community/axios-module/issues/193)) ([79909cc](https://github.com/nuxt-community/axios-module/commit/79909cc))
<a name="5.3.6"></a>
## [5.3.6](https://github.com/nuxt-community/axios-module/compare/v5.3.5...v5.3.6) (2018-11-08)
### Bug Fixes
* correctly ignore brotli encoding on server-side ([#180](https://github.com/nuxt-community/axios-module/issues/180)) ([4a52bfd](https://github.com/nuxt-community/axios-module/commit/4a52bfd))
<a name="5.3.5"></a>
## [5.3.5](https://github.com/nuxt-community/axios-module/compare/v5.3.4...v5.3.5) (2018-11-07)
### Bug Fixes
* **defaults:** ignore `cf-ray` and `cf-connecting-ip` headers on server side ([#20](https://github.com/nuxt-community/axios-module/issues/20)) ([#175](https://github.com/nuxt-community/axios-module/issues/175)) ([3ae5416](https://github.com/nuxt-community/axios-module/commit/3ae5416))
* **defaults:** set proper Accept-Encoding for server side ([#176](https://github.com/nuxt-community/axios-module/issues/176)) ([c84fb56](https://github.com/nuxt-community/axios-module/commit/c84fb56))
<a name="5.3.4"></a>
## [5.3.4](https://github.com/nuxt-community/axios-module/compare/v5.3.3...v5.3.4) (2018-10-30)
<a name="5.3.3"></a>
## [5.3.3](https://github.com/nuxt-community/axios-module/compare/v5.3.2...v5.3.3) (2018-09-28)
### Bug Fixes
* **package:** add missing types from index.d.ts ([3a06503](https://github.com/nuxt-community/axios-module/commit/3a06503))
<a name="5.3.2"></a>
## [5.3.2](https://github.com/nuxt-community/axios-module/compare/v5.3.1...v5.3.2) (2018-09-21)
### Bug Fixes
* **types:** replace AxiosPromise to Promise ([#162](https://github.com/nuxt-community/axios-module/issues/162)) ([5fd9214](https://github.com/nuxt-community/axios-module/commit/5fd9214))
<a name="5.3.1"></a>
## [5.3.1](https://github.com/nuxt-community/axios-module/compare/v5.3.0...v5.3.1) (2018-03-31)
<a name="5.3.0"></a>
# [5.3.0](https://github.com/nuxt-community/axios-module/compare/v5.2.0...v5.3.0) (2018-03-31)
### Features
* CLI improvements ([481e6da](https://github.com/nuxt-community/axios-module/commit/481e6da))
<a name="5.2.0"></a>
# [5.2.0](https://github.com/nuxt-community/axios-module/compare/v5.1.1...v5.2.0) (2018-03-31)
### Bug Fixes
* **progress:** onProgress when currentRequests is zero ([#118](https://github.com/nuxt-community/axios-module/issues/118)) ([a90236e](https://github.com/nuxt-community/axios-module/commit/a90236e))
### Features
* consola integration ([4ec3b5d](https://github.com/nuxt-community/axios-module/commit/4ec3b5d))
<a name="5.1.1"></a>
## [5.1.1](https://github.com/nuxt-community/axios-module/compare/v5.1.0...v5.1.1) (2018-03-06)
### Bug Fixes
* **progress:** handle division by zero ([#117](https://github.com/nuxt-community/axios-module/issues/117)) ([040eaf7](https://github.com/nuxt-community/axios-module/commit/040eaf7)), closes [#166](https://github.com/nuxt-community/axios-module/issues/166)
<a name="5.1.0"></a>
# [5.1.0](https://github.com/nuxt-community/axios-module/compare/v5.0.1...v5.1.0) (2018-03-05)
### Features
* allow disable progress per request. closes [#112](https://github.com/nuxt-community/axios-module/issues/112). ([1530bb6](https://github.com/nuxt-community/axios-module/commit/1530bb6))
* disable https for localhost url ([#93](https://github.com/nuxt-community/axios-module/issues/93)) ([dd67734](https://github.com/nuxt-community/axios-module/commit/dd67734))
<a name="5.0.1"></a>
## [5.0.1](https://github.com/nuxt-community/axios-module/compare/v5.0.0...v5.0.1) (2018-02-08)
### Bug Fixes
* don't mutate env.API_URL ([a8ea331](https://github.com/nuxt-community/axios-module/commit/a8ea331))
<a name="5.0.0"></a>
# [5.0.0](https://github.com/nuxt-community/axios-module/compare/v5.0.0-rc.2...v5.0.0) (2018-02-04)
### Bug Fixes
* **progress:** finish on fail ([ea7b569](https://github.com/nuxt-community/axios-module/commit/ea7b569))
### Features
* https option ([#57](https://github.com/nuxt-community/axios-module/issues/57)) ([9ecb547](https://github.com/nuxt-community/axios-module/commit/9ecb547))
* passing options via proxy option ([a923db3](https://github.com/nuxt-community/axios-module/commit/a923db3))
* support retry with axios-retry ([7221cac](https://github.com/nuxt-community/axios-module/commit/7221cac)), closes [#77](https://github.com/nuxt-community/axios-module/issues/77)
<a name="5.0.0-rc.2"></a>
# [5.0.0-rc.2](https://github.com/nuxt-community/axios-module/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2018-01-29)
### Bug Fixes
* **package:** require [@nuxtjs](https://github.com/nuxtjs)/proxy as a peerDependency ([fd1ef47](https://github.com/nuxt-community/axios-module/commit/fd1ef47))
* support dynamic API_URL for SSR ([ea4882a](https://github.com/nuxt-community/axios-module/commit/ea4882a))
<a name="5.0.0-rc.1"></a>
# [5.0.0-rc.1](https://github.com/nuxt-community/axios-module/compare/v5.0.0-rc.0...v5.0.0-rc.1) (2018-01-28)
### Bug Fixes
* **progress:** ensure $loading is valid ([cbdc586](https://github.com/nuxt-community/axios-module/commit/cbdc586))
<a name="5.0.0-rc.0"></a>
# [5.0.0-rc.0](https://github.com/nuxt-community/axios-module/compare/v5.0.0-alpha.1...v5.0.0-rc.0) (2018-01-28)
### Features
* support proxy ([0d3be17](https://github.com/nuxt-community/axios-module/commit/0d3be17))
<a name="5.0.0-alpha.1"></a>
# [5.0.0-alpha.1](https://github.com/nuxt-community/axios-module/compare/v5.0.0-alpha.0...v5.0.0-alpha.1) (2018-01-28)
### Features
* integrate with nuxt progress bar ([41a0964](https://github.com/nuxt-community/axios-module/commit/41a0964))
<a name="5.0.0-alpha.0"></a>
# [5.0.0-alpha.0](https://github.com/nuxt-community/axios-module/compare/v4.5.2...v5.0.0-alpha.0) (2018-01-28)
### Code Refactoring
* a better and more stable way to specify baseURL and browserBaseURL options ([533cf4e](https://github.com/nuxt-community/axios-module/commit/533cf4e))
### Features
* interceptor helpers ([fa3eb47](https://github.com/nuxt-community/axios-module/commit/fa3eb47))
* rewrite plugin ([647b58f](https://github.com/nuxt-community/axios-module/commit/647b58f))
### BREAKING CHANGES
* prefix should be set to `/api` for backward compability. refer to new docs.
<a name="4.5.2"></a>
## [4.5.2](https://github.com/nuxt-community/axios-module/compare/v4.5.1...v4.5.2) (2017-12-29)
<a name="4.5.1"></a>
## [4.5.1](https://github.com/nuxt-community/axios-module/compare/v4.5.0...v4.5.1) (2017-12-29)
<a name="4.5.0"></a>
# [4.5.0](https://github.com/nuxt-community/axios-module/compare/v4.4.0...v4.5.0) (2017-11-16)
### Bug Fixes
* link to the proxy page ([5449939](https://github.com/nuxt-community/axios-module/commit/5449939))
### Features
* disable sefault error handler ([#44](https://github.com/nuxt-community/axios-module/issues/44)) ([f1e95ff](https://github.com/nuxt-community/axios-module/commit/f1e95ff))
<a name="4.4.0"></a>
# [4.4.0](https://github.com/nuxt-community/axios-module/compare/v4.3.1...v4.4.0) (2017-09-30)
### Features
* **proxyHeader:** proxyHeadersIgnore option ([7c13655](https://github.com/nuxt-community/axios-module/commit/7c13655))
<a name="4.3.1"></a>
## [4.3.1](https://github.com/nuxt-community/axios-module/compare/v4.3.0...v4.3.1) (2017-09-28)
<a name="4.3.0"></a>
# [4.3.0](https://github.com/nuxt-community/axios-module/compare/v4.2.1...v4.3.0) (2017-09-11)
### Features
* don't rely on hostname for default values ([dadd7d8](https://github.com/nuxt-community/axios-module/commit/dadd7d8))
<a name="4.2.1"></a>
## [4.2.1](https://github.com/nuxt-community/axios-module/compare/v4.2.0...v4.2.1) (2017-09-08)
<a name="4.2.0"></a>
# [4.2.0](https://github.com/nuxt-community/axios-module/compare/v4.1.1...v4.2.0) (2017-09-08)
### Features
* pass ctx to errorHandlers ([c70749a](https://github.com/nuxt-community/axios-module/commit/c70749a))
<a name="4.1.1"></a>
## [4.1.1](https://github.com/nuxt-community/axios-module/compare/v4.1.0...v4.1.1) (2017-09-06)
### Bug Fixes
* delete accept header ([2f04e30](https://github.com/nuxt-community/axios-module/commit/2f04e30)), closes [#12](https://github.com/nuxt-community/axios-module/issues/12)
<a name="4.1.0"></a>
# [4.1.0](https://github.com/nuxt-community/axios-module/compare/v4.0.1...v4.1.0) (2017-09-06)
### Bug Fixes
* inject $axios in current ctx ([356b31f](https://github.com/nuxt-community/axios-module/commit/356b31f))
### Features
* add options.init ([8e0c0e8](https://github.com/nuxt-community/axios-module/commit/8e0c0e8))
### Performance Improvements
* move init outside of plugin ([bcd4710](https://github.com/nuxt-community/axios-module/commit/bcd4710))
<a name="4.0.1"></a>
## [4.0.1](https://github.com/nuxt-community/axios-module/compare/v4.0.0...v4.0.1) (2017-09-04)
### Bug Fixes
* **package:** make nuxt devDependency ([a36a886](https://github.com/nuxt-community/axios-module/commit/a36a886))
<a name="4.0.0"></a>
# [4.0.0](https://github.com/nuxt-community/axios-module/compare/v3.1.4...v4.0.0) (2017-08-30)
### Features
* better baseURL message ([61432a1](https://github.com/nuxt-community/axios-module/commit/61432a1))
* responseInterceptor and errorHandler ([b16d6bf](https://github.com/nuxt-community/axios-module/commit/b16d6bf))
* upgrade for nuxt rc8 ([a341185](https://github.com/nuxt-community/axios-module/commit/a341185))
### BREAKING CHANGES
* app.axios is not available anymore (without $) should always use app.$axios
<a name="3.1.4"></a>
## [3.1.4](https://github.com/nuxt-community/axios-module/compare/v3.1.3...v3.1.4) (2017-08-13)
### Bug Fixes
* create fresh objects for all default header scopes ([7ba3ae8](https://github.com/nuxt-community/axios-module/commit/7ba3ae8))
<a name="3.1.3"></a>
## [3.1.3](https://github.com/nuxt-community/axios-module/compare/v3.1.1...v3.1.3) (2017-08-13)
### Bug Fixes
* **headers:** fix security bug with default request headers ([9355228](https://github.com/nuxt-community/axios-module/commit/9355228))
<a name="3.1.1"></a>
## 3.1.1 (2017-08-13)
(repository moved from nuxt-community/modules)
### Features
* **axios:** fetch style requests
<a name="3.0.1"></a>
## [3.0.1](https://github.com/nuxt/modules/compare/@nuxtjs/axios@3.0.0...@nuxtjs/axios@3.0.1) (2017-07-25)
### Bug Fixes
* **axios:** typo in default headers ([9697559](https://github.com/nuxt/modules/commit/9697559))
<a name="3.0.0"></a>
# [3.0.0](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.3.0...@nuxtjs/axios@3.0.0) (2017-07-25)
### Code Refactoring
* **axios:** remove $ shortcut mixins ([1ab2bd6](https://github.com/nuxt/modules/commit/1ab2bd6))
### BREAKING CHANGES
* **axios:** You have to explicitly use `this.$axios.[method]` instead of `this.$[method]`
<a name="2.3.0"></a>
# [2.3.0](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.2.4...@nuxtjs/axios@2.3.0) (2017-07-24)
### Features
* **axios:** optionally disable error handling (#74) ([a195feb](https://github.com/nuxt/modules/commit/a195feb))
* **axios:** redirectError ([4ce1a1c](https://github.com/nuxt/modules/commit/4ce1a1c))
<a name="2.2.4"></a>
## [2.2.4](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.2.3...@nuxtjs/axios@2.2.4) (2017-07-20)
### Bug Fixes
* **axios:** temporary fix for nuxt/nuxt.js#1127 ([499b639](https://github.com/nuxt/modules/commit/499b639)), closes [nuxt/nuxt.js#1127](https://github.com/nuxt/nuxt.js/issues/1127)
<a name="2.2.3"></a>
## [2.2.3](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.2.1...@nuxtjs/axios@2.2.3) (2017-07-19)
### Bug Fixes
* **axios:** don't proxy Host header from request (#72, #39) ([61462ca](https://github.com/nuxt/modules/commit/61462ca))
<a name="2.2.2"></a>
## [2.2.2](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.2.1...@nuxtjs/axios@2.2.2) (2017-07-19)
### Bug Fixes
* **axios:** don't proxy Host header from request (#72, #39) ([61462ca](https://github.com/nuxt/modules/commit/61462ca))
<a name="2.2.1"></a>
## [2.2.1](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.2.0...@nuxtjs/axios@2.2.1) (2017-07-15)
### Bug Fixes
* **axios:** problems related to #65 ([4e7dd3f](https://github.com/nuxt/modules/commit/4e7dd3f))
<a name="2.0.3"></a>
## [2.0.3](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.0.2...@nuxtjs/axios@2.0.3) (2017-06-10)
### Bug Fixes
* **axios:** Handle relative baseURL ([19b8453](https://github.com/nuxt/modules/commit/19b8453))
* handle 0.0.0.0 host ([610e0f5](https://github.com/nuxt/modules/commit/610e0f5))
<a name="2.0.2"></a>
## [2.0.2](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.0.1...@nuxtjs/axios@2.0.2) (2017-06-09)
### Bug Fixes
* **axios:** Node 6.x support ([54deac0](https://github.com/nuxt/modules/commit/54deac0))
<a name="2.0.1"></a>
## [2.0.1](https://github.com/nuxt/modules/compare/@nuxtjs/axios@2.0.0...@nuxtjs/axios@2.0.1) (2017-06-09)
### Bug Fixes
* **axios:** ensure store exists before injecting ([23ad7b7](https://github.com/nuxt/modules/commit/23ad7b7))
<a name="2.0.0"></a>
# [2.0.0](https://github.com/nuxt/modules/compare/@nuxtjs/axios@1.0.2...@nuxtjs/axios@2.0.0) (2017-06-09)
### Bug Fixes
* **axios:** install using Vue.use ([184651b](https://github.com/nuxt/modules/commit/184651b))
* **axios:** req typo ([16f28b1](https://github.com/nuxt/modules/commit/16f28b1))
* **axios:** use relative `API_URL` if same host and port else `API_URL` ([3421d19](https://github.com/nuxt/modules/commit/3421d19))
### Features
* **axios:** AXIOS_CREDENTIALS, AXIOS_SSR_HEADERS ([4dfdc2d](https://github.com/nuxt/modules/commit/4dfdc2d))
* **axios:** don't append optional config into env ([fe189e8](https://github.com/nuxt/modules/commit/fe189e8))
* **axios:** Easier API ([f54a434](https://github.com/nuxt/modules/commit/f54a434))
* **axios:** New API ([0194226](https://github.com/nuxt/modules/commit/0194226))
* **axios:** nuxt friendly errors for SSR ([65bc50f](https://github.com/nuxt/modules/commit/65bc50f))
### BREAKING CHANGES
* **axios:** API_PREFIX is deprecated.
<a name="1.0.2"></a>
## [1.0.2](https://github.com/nuxt/modules/compare/@nuxtjs/axios@1.0.0...@nuxtjs/axios@1.0.2) (2017-05-29)
### Bug Fixes
* **axios:** remove extra function call on computed prop ([cd9da0b](https://github.com/nuxt/modules/commit/cd9da0b))
<a name="1.0.1"></a>
## [1.0.1](https://github.com/nuxt/modules/compare/@nuxtjs/axios@1.0.0...@nuxtjs/axios@1.0.1) (2017-05-26)
### Bug Fixes
* **axios:** remove extra function call on computed prop ([cd9da0b](https://github.com/nuxt/modules/commit/cd9da0b))
<a name="1.0.0"></a>
# 1.0.0 (2017-05-26)
### Features
* initial migration to 1.0.0-alpha1 ([05c1b7a](https://github.com/nuxt/modules/commit/05c1b7a))
### BREAKING CHANGES
* New modules system is backward incompatible with nuxt-helpers style modules
<a name="0.0.1"></a>
## 0.0.1 (2017-05-10)
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Nuxt Community
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.
Generated Vendored Executable
+56
View File
@@ -0,0 +1,56 @@
# 📦 Axios Module
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Circle CI][circle-ci-src]][circle-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![Dependencies][david-dm-src]][david-dm-href]
[![Standard JS][standard-js-src]][standard-js-href]
> Secure and Easy <a href="https://github.com/mzabriskie/axios">Axios</a> integration with Nuxt.js
## ✅ Features
✓ Automatically set base URL for client & server side
✓ Exposes `setToken` function to `$axios` so we can easily and globally set authentication tokens
✓ Automatically enables `withCredentials` when requesting to base URL
✓ Proxy request headers in SSR (Useful for auth)
✓ Fetch Style requests
✓ Integrated with Nuxt.js Progressbar while making requests
✓ Integrated with [Proxy Module](https://github.com/nuxt-community/proxy-module)
✓ Auto retry requests with [axios-retry](https://github.com/softonic/axios-retry)
📖 [**Read Documentation**](https://axios.nuxtjs.org)
## Development
1. Clone this repository
2. Install dependencies using `yarn install` or `npm install`
3. Start development server using `npm run dev`
## 📑 License
[MIT License](./LICENSE)
Copyright (c) Nuxt Community
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/dt/@nuxtjs/axios.svg?style=flat-square
[npm-version-href]: https://npmjs.com/package/@nuxtjs/axios
[npm-downloads-src]: https://img.shields.io/npm/v/@nuxtjs/axios/latest.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/axios
[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/axios-module.svg?style=flat-square
[circle-ci-href]: https://circleci.com/gh/nuxt-community/axios-module
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/axios-module.svg?style=flat-square
[codecov-href]: https://codecov.io/gh/nuxt-community/axios-module
[david-dm-src]: https://david-dm.org/nuxt-community/axios-module/status.svg?style=flat-square
[david-dm-href]: https://david-dm.org/nuxt-community/axios-module
[standard-js-src]: https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square
[standard-js-href]: https://standardjs.com
Generated Vendored Executable
+129
View File
@@ -0,0 +1,129 @@
const path = require('path')
const consola = require('consola')
const defu = require('defu')
const logger = consola.withScope('nuxt:axios')
function axiosModule (_moduleOptions) {
const { nuxt } = this
// Combine options
const moduleOptions = {
...nuxt.options.axios,
..._moduleOptions,
...(nuxt.options.runtimeConfig && nuxt.options.runtimeConfig.axios)
}
// Default port
const defaultPort =
process.env.API_PORT ||
moduleOptions.port ||
process.env.PORT ||
process.env.npm_package_config_nuxt_port ||
(this.options.server && this.options.server.port) ||
3000
// Default host
let defaultHost =
process.env.API_HOST ||
moduleOptions.host ||
process.env.HOST ||
process.env.npm_package_config_nuxt_host ||
(this.options.server && this.options.server.host) ||
'localhost'
/* istanbul ignore if */
if (defaultHost === '0.0.0.0') {
defaultHost = 'localhost'
}
// Default prefix
const prefix = process.env.API_PREFIX || moduleOptions.prefix || '/'
// HTTPS
const https = Boolean(this.options.server && this.options.server.https)
// Headers
const headers = {
common: {
Accept: 'application/json, text/plain, */*'
},
delete: {},
get: {},
head: {},
post: {},
put: {},
patch: {}
}
// Apply defaults
const options = defu(moduleOptions, {
baseURL: `http://${defaultHost}:${defaultPort}${prefix}`,
browserBaseURL: undefined,
credentials: false,
debug: false,
progress: true,
proxyHeaders: true,
proxyHeadersIgnore: ['accept', 'host', 'cf-ray', 'cf-connecting-ip', 'content-length', 'content-md5', 'content-type'],
proxy: false,
retry: false,
https,
headers
})
// ENV overrides
/* istanbul ignore if */
if (process.env.API_URL) {
options.baseURL = process.env.API_URL
}
/* istanbul ignore if */
if (process.env.API_URL_BROWSER) {
options.browserBaseURL = process.env.API_URL_BROWSER
}
// Default browserBaseURL
if (typeof options.browserBaseURL === 'undefined') {
options.browserBaseURL = options.proxy ? prefix : options.baseURL
}
// Normalize options
if (options.retry === true) {
options.retry = {}
}
// Convert http:// to https:// if https option is on
if (options.https === true) {
const https = s => s.replace('http://', 'https://')
options.baseURL = https(options.baseURL)
options.browserBaseURL = https(options.browserBaseURL)
}
// globalName
options.globalName = this.nuxt.options.globalName || 'nuxt'
// Register plugin
this.addPlugin({
src: path.resolve(__dirname, 'plugin.js'),
fileName: 'axios.js',
options
})
// Proxy integration
if (options.proxy) {
this.requireModule([
'@nuxtjs/proxy',
typeof options.proxy === 'object' ? options.proxy : {}
])
}
// Set _AXIOS_BASE_URL_ for dynamic SSR baseURL
process.env._AXIOS_BASE_URL_ = options.baseURL
logger.debug(`baseURL: ${options.baseURL}`)
logger.debug(`browserBaseURL: ${options.browserBaseURL}`)
}
module.exports = axiosModule
module.exports.meta = require('../package.json')
+222
View File
@@ -0,0 +1,222 @@
import Axios from 'axios'
import defu from 'defu'
<% if (options.retry) { %>import axiosRetry from 'axios-retry'<% } %>
// Axios.prototype cannot be modified
const axiosExtra = {
setBaseURL (baseURL) {
this.defaults.baseURL = baseURL
},
setHeader (name, value, scopes = 'common') {
for (let scope of Array.isArray(scopes) ? scopes : [ scopes ]) {
if (!value) {
delete this.defaults.headers[scope][name];
return
}
this.defaults.headers[scope][name] = value
}
},
setToken (token, type, scopes = 'common') {
const value = !token ? null : (type ? type + ' ' : '') + token
this.setHeader('Authorization', value, scopes)
},
onRequest(fn) {
this.interceptors.request.use(config => fn(config) || config)
},
onResponse(fn) {
this.interceptors.response.use(response => fn(response) || response)
},
onRequestError(fn) {
this.interceptors.request.use(undefined, error => fn(error) || Promise.reject(error))
},
onResponseError(fn) {
this.interceptors.response.use(undefined, error => fn(error) || Promise.reject(error))
},
onError(fn) {
this.onRequestError(fn)
this.onResponseError(fn)
},
create(options) {
return createAxiosInstance(defu(options, this.defaults))
}
}
// Request helpers ($get, $post, ...)
for (let method of ['request', 'delete', 'get', 'head', 'options', 'post', 'put', 'patch']) {
axiosExtra['$' + method] = function () { return this[method].apply(this, arguments).then(res => res && res.data) }
}
const extendAxiosInstance = axios => {
for (let key in axiosExtra) {
axios[key] = axiosExtra[key].bind(axios)
}
}
const createAxiosInstance = axiosOptions => {
// Create new axios instance
const axios = Axios.create(axiosOptions)
axios.CancelToken = Axios.CancelToken
axios.isCancel = Axios.isCancel
// Extend axios proto
extendAxiosInstance(axios)
// Setup interceptors
<% if (options.debug) { %>setupDebugInterceptor(axios) <% } %>
<% if (options.credentials) { %>setupCredentialsInterceptor(axios)<% } %>
<% if (options.progress) { %>setupProgress(axios) <% } %>
<% if (options.retry) { %>axiosRetry(axios, <%= serialize(options.retry) %>)<% } %>
return axios
}
<% if (options.debug) { %>
const log = (level, ...messages) => console[level]('[Axios]', ...messages)
const setupDebugInterceptor = axios => {
// request
axios.onRequestError(error => {
log('error', 'Request error:', error)
})
// response
axios.onResponseError(error => {
log('error', 'Response error:', error)
})
axios.onResponse(res => {
log(
'info',
'[' + (res.status + ' ' + res.statusText) + ']',
'[' + res.config.method.toUpperCase() + ']',
res.config.url)
if (process.browser) {
console.log(res)
} else {
console.log(JSON.stringify(res.data, undefined, 2))
}
return res
})
}<% } %>
<% if (options.credentials) { %>
const setupCredentialsInterceptor = axios => {
// Send credentials only to relative and API Backend requests
axios.onRequest(config => {
if (config.withCredentials === undefined) {
if (!/^https?:\/\//i.test(config.url) || config.url.indexOf(config.baseURL) === 0) {
config.withCredentials = true
}
}
})
}<% } %>
<% if (options.progress) { %>
const setupProgress = (axios) => {
if (process.server) {
return
}
// A noop loading inteterface for when $nuxt is not yet ready
const noopLoading = {
finish: () => { },
start: () => { },
fail: () => { },
set: () => { }
}
const $loading = () => {
const $nuxt = typeof window !== 'undefined' && window['$<%= options.globalName %>']
return ($nuxt && $nuxt.$loading && $nuxt.$loading.set) ? $nuxt.$loading : noopLoading
}
let currentRequests = 0
axios.onRequest(config => {
if (config && config.progress === false) {
return
}
currentRequests++
})
axios.onResponse(response => {
if (response && response.config && response.config.progress === false) {
return
}
currentRequests--
if (currentRequests <= 0) {
currentRequests = 0
$loading().finish()
}
})
axios.onError(error => {
if (error && error.config && error.config.progress === false) {
return
}
currentRequests--
if (Axios.isCancel(error)) {
return
}
$loading().fail()
$loading().finish()
})
const onProgress = e => {
if (!currentRequests) {
return
}
const progress = ((e.loaded * 100) / (e.total * currentRequests))
$loading().set(Math.min(100, progress))
}
axios.defaults.onUploadProgress = onProgress
axios.defaults.onDownloadProgress = onProgress
}<% } %>
export default (ctx, inject) => {
// runtimeConfig
const runtimeConfig = ctx.$config && ctx.$config.axios || {}
// baseURL
const baseURL = process.browser
? (runtimeConfig.browserBaseURL || runtimeConfig.baseURL || '<%= options.browserBaseURL || '' %>')
: (runtimeConfig.baseURL || process.env._AXIOS_BASE_URL_ || '<%= options.baseURL || '' %>')
// Create fresh objects for all default header scopes
// Axios creates only one which is shared across SSR requests!
// https://github.com/mzabriskie/axios/blob/master/lib/defaults.js
const headers = <%= JSON.stringify(options.headers, null, 4) %>
const axiosOptions = {
baseURL,
headers
}
<% if (options.proxyHeaders) { %>
// Proxy SSR request headers headers
if (process.server && ctx.req && ctx.req.headers) {
const reqHeaders = { ...ctx.req.headers }
for (let h of <%= serialize(options.proxyHeadersIgnore) %>) {
delete reqHeaders[h]
}
axiosOptions.headers.common = { ...reqHeaders, ...axiosOptions.headers.common }
}
<% } %>
if (process.server) {
// Don't accept brotli encoding because Node can't parse it
axiosOptions.headers.common['accept-encoding'] = 'gzip, deflate'
}
const axios = createAxiosInstance(axiosOptions)
// Inject axios to the context as $axios
ctx.$axios = axios
inject('axios', axios)
}
+93
View File
@@ -0,0 +1,93 @@
{
"_args": [
[
"@nuxtjs/axios@5.12.0",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_from": "@nuxtjs/axios@5.12.0",
"_id": "@nuxtjs/axios@5.12.0",
"_inBundle": false,
"_integrity": "sha512-VQI9Nnf12jWknldrgCNGzCQxnWO3/CvMwrkWKNUr3WtGYuOKryUOd1XXxDbaJmopfX4SGjKvDL1G6qTkWLiPew==",
"_location": "/@nuxtjs/axios",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/axios@5.12.0",
"name": "@nuxtjs/axios",
"escapedName": "@nuxtjs%2faxios",
"scope": "@nuxtjs",
"rawSpec": "5.12.0",
"saveSpec": null,
"fetchSpec": "5.12.0"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/axios/-/axios-5.12.0.tgz",
"_spec": "5.12.0",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"bugs": {
"url": "https://github.com/nuxt-community/axios-module/issues"
},
"contributors": [
{
"name": "Pooya Parsa",
"email": "pooya@pi0.ir"
}
],
"dependencies": {
"@nuxtjs/proxy": "^2.0.0",
"axios": "^0.19.2",
"axios-retry": "^3.1.8",
"consola": "^2.14.0",
"defu": "^2.0.4"
},
"description": "Secure and easy axios integration with Nuxt.js",
"devDependencies": {
"@babel/core": "latest",
"@babel/preset-env": "latest",
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@nuxtjs/eslint-config": "latest",
"babel-eslint": "latest",
"babel-jest": "latest",
"codecov": "latest",
"eslint": "latest",
"eslint-config-standard": "latest",
"eslint-plugin-import": "latest",
"eslint-plugin-jest": "latest",
"eslint-plugin-node": "latest",
"eslint-plugin-promise": "latest",
"eslint-plugin-standard": "latest",
"eslint-plugin-vue": "latest",
"husky": "latest",
"jest": "latest",
"nuxt-edge": "latest",
"standard-version": "latest"
},
"files": [
"lib",
"types/*.d.ts"
],
"homepage": "https://github.com/nuxt-community/axios-module#readme",
"license": "MIT",
"main": "lib/module.js",
"name": "@nuxtjs/axios",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt-community/axios-module.git"
},
"scripts": {
"dev": "nuxt test/fixture",
"lint": "eslint lib test",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest"
},
"types": "types/index.d.ts",
"version": "5.12.0"
}
+80
View File
@@ -0,0 +1,80 @@
import { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosStatic } from 'axios'
import { IAxiosRetryConfig } from 'axios-retry'
import Vue from 'vue'
import './vuex'
interface NuxtAxiosInstance extends AxiosStatic {
$request<T = any>(config: AxiosRequestConfig): Promise<T>
$get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$head<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$options<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
setBaseURL(baseURL: string): void
setHeader(name: string, value?: string | false, scopes?: string | string[]): void
setToken(token: string | false, type?: string, scopes?: string | string[]): void
onRequest(callback: (config: AxiosRequestConfig) => void): void
onResponse<T = any>(callback: (response: AxiosResponse<T>) => void): void
onError(callback: (error: AxiosError) => void): void
onRequestError(callback: (error: AxiosError) => void): void
onResponseError(callback: (error: AxiosError) => void): void
}
interface AxiosOptions {
baseURL?: string,
browserBaseURL?: string,
credentials?: boolean,
debug?: boolean,
host?: string,
prefix?: string,
progress?: boolean,
proxyHeaders?: boolean,
proxyHeadersIgnore?: string[],
proxy?: boolean,
port?: string | number,
retry?: boolean | IAxiosRetryConfig,
https?: boolean,
headers?: {
common?: Record<string, string>,
delete?: Record<string, string>,
get?: Record<string, string>,
head?: Record<string, string>,
post?: Record<string, string>,
put?: Record<string, string>,
patch?: Record<string, string>,
},
}
declare module '@nuxt/vue-app' {
interface Context {
$axios: NuxtAxiosInstance
}
interface NuxtAppOptions {
$axios: NuxtAxiosInstance
}
}
// Nuxt 2.9+
declare module '@nuxt/types' {
interface Context {
$axios: NuxtAxiosInstance
}
interface NuxtAppOptions {
$axios: NuxtAxiosInstance
}
interface Configuration {
axios?: AxiosOptions
}
}
declare module 'vue/types/vue' {
interface Vue {
$axios: NuxtAxiosInstance
}
}
+7
View File
@@ -0,0 +1,7 @@
import { NuxtAxiosInstance } from '.'
declare module 'vuex/types/index' {
interface Store<S> {
$axios: NuxtAxiosInstance,
}
}
+64
View File
@@ -0,0 +1,64 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config-typescript@1.0.2...@nuxtjs/eslint-config-typescript@2.0.0) (2020-05-12)
**Note:** Version bump only for package @nuxtjs/eslint-config-typescript
## [1.0.2](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config-typescript@1.0.1...@nuxtjs/eslint-config-typescript@1.0.2) (2020-02-09)
**Note:** Version bump only for package @nuxtjs/eslint-config-typescript
## [1.0.1](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config-typescript@1.0.0...@nuxtjs/eslint-config-typescript@1.0.1) (2020-02-09)
**Note:** Version bump only for package @nuxtjs/eslint-config-typescript
# [1.0.0](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config-typescript@0.1.3...@nuxtjs/eslint-config-typescript@1.0.0) (2019-11-26)
**Note:** Version bump only for package @nuxtjs/eslint-config-typescript
## [0.1.3](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config-typescript@0.1.2...@nuxtjs/eslint-config-typescript@0.1.3) (2019-09-11)
**Note:** Version bump only for package @nuxtjs/eslint-config-typescript
## 0.1.2 (2019-08-10)
**Note:** Version bump only for package @nuxtjs/eslint-config-typescript
## [0.1.1](https://github.com/nuxt/eslint-config/compare/@nuxtjs/typescript-eslint-config@0.1.0...@nuxtjs/typescript-eslint-config@0.1.1) (2019-08-10)
**Note:** Version bump only for package @nuxtjs/typescript-eslint-config
# 0.1.0 (2019-08-10)
* Initial release ([#54](https://github.com/nuxt/eslint-config/pull/54))
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Nuxt.js
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.
+12
View File
@@ -0,0 +1,12 @@
module.exports = {
extends: [
'@nuxtjs'
],
plugins: ['@typescript-eslint'],
parserOptions: {
parser: '@typescript-eslint/parser'
},
rules: {
'@typescript-eslint/no-unused-vars': ['error', { args: 'all', argsIgnorePattern: '^_' }]
}
}
+62
View File
@@ -0,0 +1,62 @@
{
"_args": [
[
"@nuxtjs/eslint-config-typescript@2.0.0",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_development": true,
"_from": "@nuxtjs/eslint-config-typescript@2.0.0",
"_id": "@nuxtjs/eslint-config-typescript@2.0.0",
"_inBundle": false,
"_integrity": "sha512-qqSt9E62QmBE+zRr7e9dTuf2zTYBFd608Bz611y80RfnjhViZlKFHwrjKAejY5UrjKKUoIWUcIVjozWWQzDm3A==",
"_location": "/@nuxtjs/eslint-config-typescript",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/eslint-config-typescript@2.0.0",
"name": "@nuxtjs/eslint-config-typescript",
"escapedName": "@nuxtjs%2feslint-config-typescript",
"scope": "@nuxtjs",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/eslint-config-typescript/-/eslint-config-typescript-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"bugs": {
"url": "https://github.com/nuxt/eslint-config/issues"
},
"contributors": [
{
"name": "Kevin Marrec",
"email": "kevin@marrec.io"
}
],
"dependencies": {
"@nuxtjs/eslint-config": "3.0.0",
"@typescript-eslint/eslint-plugin": "^2.32.0",
"@typescript-eslint/parser": "^2.32.0"
},
"description": "Nuxt.js eslint typescript config",
"files": [
"index.js"
],
"gitHead": "173b586031f3ebd8d9b52c0bf369078ebaa598f7",
"homepage": "https://github.com/nuxt/eslint-config/tree/master/packages/eslint-config-typescript",
"license": "MIT",
"name": "@nuxtjs/eslint-config-typescript",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/eslint-config.git"
},
"version": "2.0.0"
}
+97
View File
@@ -0,0 +1,97 @@
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [3.0.0](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config@2.0.2...@nuxtjs/eslint-config@3.0.0) (2020-05-12)
### Bug Fixes
* eslint-plugin-import ordering errors in windows ([39ad2b4](https://github.com/nuxt/eslint-config/commit/39ad2b46da470198f71ba111ee23d9b037a49a75))
## [2.0.2](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config@2.0.1...@nuxtjs/eslint-config@2.0.2) (2020-02-09)
### Bug Fixes
* eslint-plugin-import ordering errors in windows ([4f6f4a9](https://github.com/nuxt/eslint-config/commit/4f6f4a9566149e438bfdf9046f82151e050d7ce7))
## [2.0.1](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config@2.0.0...@nuxtjs/eslint-config@2.0.1) (2020-02-09)
**Note:** Version bump only for package @nuxtjs/eslint-config
# [2.0.0](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config@1.1.2...@nuxtjs/eslint-config@2.0.0) (2019-11-26)
### Features
* update eslint config packages ([a3bb0bf](https://github.com/nuxt/eslint-config/commit/a3bb0bfb923f18fd11447e048a29d11f29a3aa75))
## [1.1.2](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config@1.1.1...@nuxtjs/eslint-config@1.1.2) (2019-08-10)
**Note:** Version bump only for package @nuxtjs/eslint-config
## [1.1.1](https://github.com/nuxt/eslint-config/compare/@nuxtjs/eslint-config@1.1.0...@nuxtjs/eslint-config@1.1.1) (2019-08-10)
**Note:** Version bump only for package @nuxtjs/eslint-config
# 1.1.0 (2019-08-10)
## Features
* warn console and debugger in dev ([#56](https://github.com/nuxt/eslint-config/issues/56))
### [1.0.1](https://github.com/nuxt/eslint-config/compare/v1.0.0...v1.0.1) (2019-07-07)
### Bug Fixes
* move eslint plugins from peerDeps to deps ([4e8d231](https://github.com/nuxt/eslint-config/commit/4e8d231))
<a name="1.0.0"></a>
# [1.0.0](https://github.com/nuxt/eslint-config/compare/v0.0.1...v1.0.0) (2019-07-07)
### Bug Fixes
* avoid changing basic StandardJS rules ([#25](https://github.com/nuxt/eslint-config/issues/25)) ([38e3582](https://github.com/nuxt/eslint-config/commit/38e3582))
### Features
* add eslint-plugin-unicorn rules ([#35](https://github.com/nuxt/eslint-config/issues/35)) ([03bb05f](https://github.com/nuxt/eslint-config/commit/03bb05f))
* conditional no-console based on env ([#2](https://github.com/nuxt/eslint-config/issues/2)) ([60826b7](https://github.com/nuxt/eslint-config/commit/60826b7))
* force object shorthand ([#29](https://github.com/nuxt/eslint-config/issues/29)) ([b149bc2](https://github.com/nuxt/eslint-config/commit/b149bc2))
* prohibit useless renaming ([#28](https://github.com/nuxt/eslint-config/issues/28)) ([79c9de7](https://github.com/nuxt/eslint-config/commit/79c9de7))
<a name="0.0.1"></a>
## 0.0.1 (2018-10-12)
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Nuxt.js
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.
+132
View File
@@ -0,0 +1,132 @@
module.exports = {
env: {
browser: true,
node: true,
'jest/globals': true
},
extends: [
'standard',
'plugin:import/errors',
'plugin:import/warnings',
'plugin:vue/recommended'
],
plugins: [
'jest',
'unicorn',
'vue'
],
settings: {
'import/resolver': {
node: { extensions: ['.js', '.mjs'] }
}
},
rules: {
/**********************/
/* General Code Rules */
/**********************/
// Enforce import order
'import/order': 'error',
// Imports should come first
'import/first': 'error',
// Other import rules
'import/no-mutable-exports': 'error',
// Allow unresolved imports
'import/no-unresolved': 'off',
// Allow paren-less arrow functions only when there's no braces
'arrow-parens': ['error', 'as-needed', { requireForBlockBody: true }],
// Allow async-await
'generator-star-spacing': 'off',
// Allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'warn',
// Prefer const over let
'prefer-const': ['error', {
destructuring: 'any',
ignoreReadBeforeAssign: false
}],
// No single if in an "else" block
'no-lonely-if': 'error',
// Force curly braces for control flow,
// including if blocks with a single statement
curly: ['error', 'all'],
// No async function without await
'require-await': 'error',
// Force dot notation when possible
'dot-notation': 'error',
'no-var': 'error',
// Force object shorthand where possible
'object-shorthand': 'error',
// No useless destructuring/importing/exporting renames
'no-useless-rename': 'error',
/**********************/
/* Unicorn Rules */
/**********************/
// Pass error message when throwing errors
'unicorn/error-message': 'error',
// Uppercase regex escapes
'unicorn/escape-case': 'error',
// Array.isArray instead of instanceof
'unicorn/no-array-instanceof': 'error',
// Prevent deprecated `new Buffer()`
'unicorn/no-new-buffer': 'error',
// Keep regex literals safe!
'unicorn/no-unsafe-regex': 'off',
// Lowercase number formatting for octal, hex, binary (0x12 instead of 0X12)
'unicorn/number-literal-case': 'error',
// ** instead of Math.pow()
'unicorn/prefer-exponentiation-operator': 'error',
// includes over indexOf when checking for existence
'unicorn/prefer-includes': 'error',
// String methods startsWith/endsWith instead of more complicated stuff
'unicorn/prefer-starts-ends-with': 'error',
// textContent instead of innerText
'unicorn/prefer-text-content': 'error',
// Enforce throwing type error when throwing error while checking typeof
'unicorn/prefer-type-error': 'error',
// Use new when throwing error
'unicorn/throw-new-error': 'error',
/**********************/
/* Vue Rules */
/**********************/
// Disable template errors regarding invalid end tags
'vue/no-parsing-error': ['error', {
'x-invalid-end-tag': false
}],
// Maximum 5 attributes per line instead of one
'vue/max-attributes-per-line': ['error', {
singleline: 5
}]
}
}
+71
View File
@@ -0,0 +1,71 @@
{
"_args": [
[
"@nuxtjs/eslint-config@3.0.0",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_development": true,
"_from": "@nuxtjs/eslint-config@3.0.0",
"_id": "@nuxtjs/eslint-config@3.0.0",
"_inBundle": false,
"_integrity": "sha512-sjAyE0jSuk20Q1jalJ1TwUDJXDunmT4jBZe22cVYE9H2zeKcA8CAhEOvbl9713fJXkRrXDIJDOIHVvT8aWMgyw==",
"_location": "/@nuxtjs/eslint-config",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/eslint-config@3.0.0",
"name": "@nuxtjs/eslint-config",
"escapedName": "@nuxtjs%2feslint-config",
"scope": "@nuxtjs",
"rawSpec": "3.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
},
"_requiredBy": [
"#DEV:/",
"/@nuxtjs/eslint-config-typescript"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/eslint-config/-/eslint-config-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"bugs": {
"url": "https://github.com/nuxt/eslint-config/issues"
},
"contributors": [
{
"name": "Alexander Lichter",
"email": "npm@lichter.io"
}
],
"dependencies": {
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "2.19.1",
"eslint-plugin-jest": "^23.10.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-unicorn": "^19.0.1",
"eslint-plugin-vue": "^6.2.2"
},
"description": "Nuxt.js eslint config",
"files": [
"index.js"
],
"gitHead": "173b586031f3ebd8d9b52c0bf369078ebaa598f7",
"homepage": "https://github.com/nuxt/eslint-config/tree/master/packages/eslint-config",
"license": "MIT",
"name": "@nuxtjs/eslint-config",
"peerDependencies": {
"eslint": "^7.0.0"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/eslint-config.git"
},
"version": "3.0.0"
}
+61
View File
@@ -0,0 +1,61 @@
# 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.
## [2.0.0](https://github.com/nuxt-community/eslint-module/compare/v1.2.0...v2.0.0) (2020-05-05)
### ⚠ BREAKING CHANGES
* drop support for eslint 5 ([28f7ce5](https://github.com/nuxt-community/eslint-module/commit/28f7ce5fb570c5a7bf8bc8093387bb967328f70a))
## [1.2.0](https://github.com/nuxt-community/eslint-module/compare/v1.1.0...v1.2.0) (2020-04-24)
### Features
* new option `extensions` ([#17](https://github.com/nuxt-community/eslint-module/issues/17)) ([4093800](https://github.com/nuxt-community/eslint-module/commit/40938001c0d61bad3a1d16afd15c4eb114bda803))
## [1.1.0](https://github.com/nuxt-community/eslint-module/compare/v1.0.0...v1.1.0) (2019-09-13)
## [1.0.0](https://github.com/nuxt-community/eslint-module/compare/v0.2.1...v1.0.0) (2019-07-26)
### [0.2.1](https://github.com/nuxt-community/eslint-module/compare/v0.2.0...v0.2.1) (2019-07-01)
### Bug Fixes
* add `eslint` in `peerDependencies` ([a17990d](https://github.com/nuxt-community/eslint-module/commit/a17990d))
## [0.2.0](https://github.com/nuxt-community/eslint-module/compare/v0.1.0...v0.2.0) (2019-06-27)
### Features
* watch config file ([1d8fa16](https://github.com/nuxt-community/eslint-module/commit/1d8fa16))
## [0.1.0](https://github.com/nuxt-community/eslint-module/compare/v0.0.1...v0.1.0) (2019-06-27)
### Features
* add options ([f1c9ebd](https://github.com/nuxt-community/eslint-module/commit/f1c9ebd))
* check if `eslint` is available ([#4](https://github.com/nuxt-community/eslint-module/issues/4)) ([5b8ef02](https://github.com/nuxt-community/eslint-module/commit/5b8ef02))
### Tests
* split tests in files ([55dc81b](https://github.com/nuxt-community/eslint-module/commit/55dc81b))
* **module:** move `example` to `test/fixture` ([b98ec30](https://github.com/nuxt-community/eslint-module/commit/b98ec30))
* **module:** use `get-port` ([ca93060](https://github.com/nuxt-community/eslint-module/commit/ca93060))
<a name="0.0.1"></a>
## 0.0.1 (2019-02-12)
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Nuxt Community
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.
+179
View File
@@ -0,0 +1,179 @@
# @nuxtjs/eslint-module
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
> ESLint module for Nuxt.js
[📖 **Release Notes**](./CHANGELOG.md)
## Requirements
You need to ensure that you have `eslint` installed:
```bash
yarn add --dev eslint # or npm install --save-dev eslint
```
## Setup
1. Add `@nuxtjs/eslint-module` dependency to your project
```bash
yarn add --dev @nuxtjs/eslint-module # or npm install --save-dev @nuxtjs/eslint-module
```
2. Add `@nuxtjs/eslint-module` to the `buildModules` section of `nuxt.config.js`
```js
export default {
buildModules: [
// Simple usage
'@nuxtjs/eslint-module',
// With options
['@nuxtjs/eslint-module', { /* module options */ }]
]
}
```
:warning: If you are using Nuxt **< v2.9** you have to install the module as a `dependency` (No `--dev` or `--save-dev` flags) and use `modules` section in `nuxt.config.js` instead of `buildModules`.
### Using top level options
```js
export default {
buildModules: [
'@nuxtjs/eslint-module'
],
eslint: {
/* module options */
}
}
```
## Options
You can pass [eslint options](http://eslint.org/docs/developer-guide/nodejs-api#cliengine).
**Note**: That the config option you provide will be passed to the `CLIEngine`. This is a different set of options than what you'd specify in `package.json` or `.eslintrc`. See the [eslint docs](http://eslint.org/docs/developer-guide/nodejs-api#cliengine) for more detail.
### `cache`
- Type: `Boolean|String`
- Default: `false`
This option will enable caching of the linting results into a file. This is particularly useful in reducing linting time when doing a full build.
This can either be a `boolean` value or the cache directory path(ex: `'./.eslint-loader-cache'`).
If `cache: true` is used, the cache is written to the `./node_modules/.cache/eslint-loader` directory. This is the recommended usage.
### `eslintPath`
- Type: `String`
- Default: `eslint`
Path to `eslint` instance that will be used for linting. If the `eslintPath` is a folder like a official eslint, or specify a `formatter` option. Now you dont have to install `eslint`.
### `extensions`
- Type: `Array[String]`
- Default: `['ts', 'js', 'vue']`
Extensions that will be used by the loader.
### `fix`
- Type: `Boolean`
- Default: `false`
This option will enable [ESLint autofix feature](http://eslint.org/docs/user-guide/command-line-interface#fix).
**Be careful: this option will change source files.**
### `formatter`
- Type: `String|Function`
- Default: `stylish`
This option accepts a function that will have one argument: an array of eslint messages (object). The function must return the output as a string. You can use official [eslint formatters](https://eslint.org/docs/user-guide/formatters/).
### Errors and Warning
**By default the loader will auto adjust error reporting depending on eslint errors/warnings counts.** You can still force this behavior by using `emitError` **or** `emitWarning` options:
#### `emitError`
- Type: `Boolean`
- Default: `false`
Will always return errors, if this option is set to `true`.
#### `emitWarning`
- Type: `Boolean`
- Default: `false`
Will always return warnings, if option is set to `true`.
#### `failOnError`
- Type: `Boolean`
- Default: `false`
Will cause the module build to fail if there are any errors, if option is set to `true`.
#### `failOnWarning`
- Type: `Boolean`
- Default: `false`
Will cause the module build to fail if there are any warnings, if option is set to `true`.
#### `quiet`
- Type: `Boolean`
- Default: `false`
Will process and report errors only and ignore warnings, if this option is set to `true`.
#### `outputReport`
- Type: `Boolean|Object`
- Default: `false`
Write the output of the errors to a file, for example a checkstyle xml file for use for reporting on Jenkins CI.
The `filePath` is an absolute path or relative to the webpack config: `output.path`. You can pass in a different `formatter` for the output file, if none is passed in the default/configured formatter will be used.
## Development
1. Clone this repository
2. Install dependencies using `yarn install` or `npm install`
3. Start development server using `npm run dev`
## License
[MIT License](./LICENSE)
Copyright (c) Nuxt Community
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/eslint-module/latest.svg
[npm-version-href]: https://npmjs.com/package/@nuxtjs/eslint-module
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/eslint-module.svg
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/eslint-module
[github-actions-ci-src]: https://github.com/nuxt-community/eslint-module/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/nuxt-community/eslint-module/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/eslint-module.svg
[codecov-href]: https://codecov.io/gh/nuxt-community/eslint-module
[license-src]: https://img.shields.io/npm/l/@nuxtjs/eslint-module.svg
[license-href]: https://npmjs.com/package/@nuxtjs/eslint-module
+3
View File
@@ -0,0 +1,3 @@
const consola = require('consola')
module.exports = consola.withScope('nuxt:eslint')
+45
View File
@@ -0,0 +1,45 @@
const { resolve } = require('path')
const logger = require('./logger')
const { moduleExists } = require('./utils')
module.exports = function (moduleOptions) {
if (!moduleExists('eslint')) {
logger.warn(
'The dependency `eslint` not found.',
'Please run `yarn add eslint --dev` or `npm install eslint --save-dev`'
)
return
}
const options = {
extensions: ['ts', 'js', 'vue'],
...this.options.eslint,
...moduleOptions
}
const filesToWatch = [
'.eslintrc',
'.eslintrc.json',
'.eslintrc.yaml',
'.eslintrc.yml',
'.eslintrc.js'
]
this.options.watch.push(
...filesToWatch.map(file => resolve(this.options.rootDir, file))
)
this.extendBuild((config, { isDev, isClient }) => {
if (isDev && isClient) {
config.module.rules.push({
enforce: 'pre',
test: RegExp(`\\.(${options.extensions.join('|')})$`),
loader: 'eslint-loader',
exclude: /(node_modules)/,
options
})
}
})
}
module.exports.meta = require('../package.json')
+11
View File
@@ -0,0 +1,11 @@
const moduleExists = (name) => {
try {
return require.resolve(name)
} catch (e) /* istanbul ignore next */ {
return false
}
}
module.exports = {
moduleExists
}
+81
View File
@@ -0,0 +1,81 @@
{
"_args": [
[
"@nuxtjs/eslint-module@2.0.0",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_development": true,
"_from": "@nuxtjs/eslint-module@2.0.0",
"_id": "@nuxtjs/eslint-module@2.0.0",
"_inBundle": false,
"_integrity": "sha512-uL3prMRwSBcxy583O11nMiUtfA2fxF7lZgCCUCsq4FNCqv320euJ7XE3KNZT6IVs/QJ1vaUNLC8tL4SZS99Tjw==",
"_location": "/@nuxtjs/eslint-module",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/eslint-module@2.0.0",
"name": "@nuxtjs/eslint-module",
"escapedName": "@nuxtjs%2feslint-module",
"scope": "@nuxtjs",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"#DEV:/"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/eslint-module/-/eslint-module-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"bugs": {
"url": "https://github.com/nuxt-community/eslint-module/issues"
},
"contributors": [
{
"name": "Ricardo Gobbo de Souza",
"email": "ricardogobbosouza@yahoo.com.br"
}
],
"dependencies": {
"consola": "^2.11.3",
"eslint-loader": "^4.0.2"
},
"description": "ESLint module for Nuxt.js",
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@nuxtjs/eslint-config": "latest",
"@nuxtjs/module-test-utils": "latest",
"eslint": "latest",
"husky": "latest",
"jest": "latest",
"nuxt-edge": "latest",
"standard-version": "latest"
},
"files": [
"lib"
],
"homepage": "https://github.com/nuxt-community/eslint-module#readme",
"license": "MIT",
"main": "lib/module.js",
"name": "@nuxtjs/eslint-module",
"peerDependencies": {
"eslint": ">=6"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt-community/eslint-module.git"
},
"scripts": {
"dev": "nuxt test/fixture",
"lint": "eslint --ext .js,.vue .",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest"
},
"version": "2.0.0"
}
+136
View File
@@ -0,0 +1,136 @@
# 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.
## [2.0.0](https://github.com/nuxt-community/proxy-module/compare/v1.3.3...v2.0.0) (2020-06-03)
### ⚠ BREAKING CHANGES
* Bumping major version as http-proxy-middleware may introduce some usage regressions
### Features
* bump to 2.x ([57eb492](https://github.com/nuxt-community/proxy-module/commit/57eb492c42cea6b6e90e4348065da308274fbc8a))
* upgrade to `http-proxy-middleware` 1.0.1 ([0277f6d](https://github.com/nuxt-community/proxy-module/commit/0277f6d0c753a73b2b4ab15223c1a5f9da0085ca))
### Bug Fixes
* **module:** use logger ([#40](https://github.com/nuxt-community/proxy-module/issues/40)) ([6bfbcad](https://github.com/nuxt-community/proxy-module/commit/6bfbcade52c364647c26084eb66a16ff6a7c7e11))
## [1.3.3](https://github.com/nuxt-community/proxy-module/compare/v1.3.2...v1.3.3) (2019-03-02)
### Bug Fixes
* **module:** generate warn if not SPA and increase coverage ([#31](https://github.com/nuxt-community/proxy-module/issues/31)) ([8baafc9](https://github.com/nuxt-community/proxy-module/commit/8baafc9))
## [1.3.2](https://github.com/nuxt-community/proxy-module/compare/v1.3.1...v1.3.2) (2019-02-18)
### Bug Fixes
* skip generate warn for now because of SPA ([7b23097](https://github.com/nuxt-community/proxy-module/commit/7b23097))
<a name="1.3.1"></a>
## [1.3.1](https://github.com/nuxt-community/proxy-module/compare/v1.3.0...v1.3.1) (2018-10-30)
### Bug Fixes
* add hint for "universal" mode only ([#10](https://github.com/nuxt-community/proxy-module/issues/10)) ([c78b122](https://github.com/nuxt-community/proxy-module/commit/c78b122))
<a name="1.3.0"></a>
# [1.3.0](https://github.com/nuxt-community/proxy-module/compare/v1.2.4...v1.3.0) (2018-10-29)
### Features
* upgrade dependencies ([331fa23](https://github.com/nuxt-community/proxy-module/commit/331fa23))
<a name="1.2.4"></a>
## [1.2.4](https://github.com/nuxt-community/proxy-module/compare/v1.2.3...v1.2.4) (2018-03-31)
<a name="1.2.3"></a>
## [1.2.3](https://github.com/nuxt-community/proxy-module/compare/v1.2.2...v1.2.3) (2018-03-31)
### Bug Fixes
* hide debug logs ([66c1905](https://github.com/nuxt-community/proxy-module/commit/66c1905))
<a name="1.2.2"></a>
## [1.2.2](https://github.com/nuxt-community/proxy-module/compare/v1.2.1...v1.2.2) (2018-03-31)
<a name="1.2.1"></a>
## [1.2.1](https://github.com/nuxt-community/proxy-module/compare/v1.2.0...v1.2.1) (2018-03-31)
<a name="1.2.0"></a>
# [1.2.0](https://github.com/nuxt-community/proxy-module/compare/v1.1.4...v1.2.0) (2018-03-31)
<a name="1.1.4"></a>
## 1.1.4 (2018-01-28)
<a name="1.1.3"></a>
## [1.1.3](https://github.com/nuxt/modules/compare/@nuxtjs/proxy@1.1.2...@nuxtjs/proxy@1.1.3) (2017-11-20)
**Note:** Version bump only for package @nuxtjs/proxy
<a name="1.1.2"></a>
## [1.1.2](https://github.com/nuxt/modules/compare/@nuxtjs/proxy@1.1.1...@nuxtjs/proxy@1.1.2) (2017-09-05)
### Bug Fixes
* **proxy:** disable prefix ([3e2e70f](https://github.com/nuxt/modules/commit/3e2e70f))
<a name="1.1.1"></a>
## [1.1.1](https://github.com/nuxt/modules/compare/@nuxtjs/proxy@1.1.0...@nuxtjs/proxy@1.1.1) (2017-06-09)
### Bug Fixes
* **plugin:** normalize array alternative form path ([811b5a9](https://github.com/nuxt/modules/commit/811b5a9))
<a name="1.1.0"></a>
# 1.1.0 (2017-06-07)
### Bug Fixes
* **proxy:** normalize target in object mode ([e9d4026](https://github.com/nuxt/modules/commit/e9d4026))
### Features
* proxy module ([6dfca4d](https://github.com/nuxt/modules/commit/6dfca4d))
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) Nuxt Community
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.
Generated Vendored Executable
+132
View File
@@ -0,0 +1,132 @@
# @nuxtjs/proxy
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Circle CI][circle-ci-src]][circle-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
> The one-liner node.js http-proxy middleware solution for Nuxt.js using [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware)
[📖 **Release Notes**](./CHANGELOG.md)
✨ Do you know that [Axios Module](https://github.com/nuxt-community/axios-module) has built in support for Proxy Module?
## Features
✓ Path rewrites
✓ Host based router (useful for staging/test)
✓ Logs / Proxy Events
✓ WebSockets
✓ Auth / Cookie
✓ ...and more! (see [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) docs)
⚠ Does not work in generated/static mode!
## Setup
1. Add `@nuxtjs/proxy` dependency to your project
```bash
yarn add @nuxtjs/proxy # or npm install @nuxtjs/proxy
```
2. Add `@nuxtjs/proxy` to the `modules` section of `nuxt.config.js`
```js
{
modules: [
// Simple usage
'@nuxtjs/proxy',
// With options
['@nuxtjs/proxy', { pathRewrite: { '^/api' : '/api/v1' } }]
]
}
```
- Define as many as proxy middleware you want in `proxy` section of `nuxt.config.js` (See [proxy](#proxy) section below)
## Options
- `changeOrigin` and `ws` options are enabled by default.
[optional] You can provide default options to all proxy targets by passing options to module options.
## `proxy`
You can provide proxy config using either object or array.
### Array mode
You can use magic [shorthands](https://github.com/chimurai/http-proxy-middleware#shorthand)
```js
{
proxy: [
// Proxies /foo to http://example.com/foo
'http://example.com/foo',
// Proxies /api/books/*/**.json to http://example.com:8000
'http://example.com:8000/api/books/*/**.json',
// You can also pass more options
[ 'http://example.com/foo', { ws: false } ]
]
}
```
### Object mode
Keys are [context](https://github.com/chimurai/http-proxy-middleware#context-matching)
```js
{
proxy: {
// Simple proxy
'/api': 'http://example.com',
// With options
'/api2': { target: 'http://example.com', ws: false },
// Proxy to backend unix socket
'/api3': {
changeOrigin: false,
target: { socketPath: '/var/run/http-sockets/backend.sock' }
}
}
}
```
## Development
1. Clone this repository
2. Install dependencies using `yarn install` or `npm install`
3. Start development server using `npm run dev`
## License
[MIT License](./LICENSE)
Copyright (c) Nuxt Community
<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/proxy/latest.svg?style=flat-square
[npm-version-href]: https://npmjs.com/package/@nuxtjs/proxy
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/proxy.svg?style=flat-square
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/proxy
[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/proxy-module.svg?style=flat-square
[circle-ci-href]: https://circleci.com/gh/nuxt-community/proxy-module
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/proxy-module.svg?style=flat-square
[codecov-href]: https://codecov.io/gh/nuxt-community/proxy-module
[license-src]: https://img.shields.io/npm/l/@nuxtjs/proxy.svg?style=flat-square
[license-href]: https://npmjs.com/package/@nuxtjs/proxy
+3
View File
@@ -0,0 +1,3 @@
const consola = require('consola')
module.exports = consola.withScope('nuxt:proxy')
+70
View File
@@ -0,0 +1,70 @@
const { createProxyMiddleware } = require('http-proxy-middleware')
const logger = require('./logger')
// Redirect info ~> debug
logger.info = logger.debug
function proxyModule (options) {
if (!this.options.proxy) {
// No proxy defined
logger.warn('No proxy defined on top level.')
return
}
if (this.options.mode !== 'spa') {
this.nuxt.hook('generate:before', () => {
logger.warn('The module `@nuxtjs/proxy` does not work in generated mode.')
})
}
// Defaults
const defaults = Object.assign(
{
// Required for virtual hosted sites
changeOrigin: true,
// Proxy webSockets
ws: true,
// Use consola as default logger
logProvider: () => logger
},
options
)
delete defaults.src
// Normalize options.proxy to middleware arguments
const applyDefaults = o => Object.assign({}, defaults, o)
const normalizeTarget = o => (typeof o === 'object' ? o : { target: o })
const proxy = []
if (Array.isArray(this.options.proxy)) {
// Array mode
this.options.proxy.forEach((p) => {
if (Array.isArray(p)) {
proxy.push([p[0], applyDefaults(normalizeTarget(p[1]))])
} else {
proxy.push([p, applyDefaults()])
}
})
} else {
// Object mode
Object.keys(this.options.proxy).forEach((context) => {
proxy.push([
context,
applyDefaults(normalizeTarget(this.options.proxy[context]))
])
})
}
// Register middleware
proxy.forEach((args) => {
// https://github.com/chimurai/http-proxy-middleware
this.addServerMiddleware({
prefix: false, // http-proxy-middleware uses req.originalUrl
handler: createProxyMiddleware(...args)
})
})
}
module.exports = proxyModule
module.exports.meta = require('../package.json')
+79
View File
@@ -0,0 +1,79 @@
{
"_args": [
[
"@nuxtjs/proxy@2.0.0",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_from": "@nuxtjs/proxy@2.0.0",
"_id": "@nuxtjs/proxy@2.0.0",
"_inBundle": false,
"_integrity": "sha512-ewiOLAhfQlE/QWiQkHH0MQBYrtTRRSuz5SqDly1Zy/M3cN9bxqWd9d5Ty/GnU3nLtwsfW64TrRKuTw8/gT1nFQ==",
"_location": "/@nuxtjs/proxy",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/proxy@2.0.0",
"name": "@nuxtjs/proxy",
"escapedName": "@nuxtjs%2fproxy",
"scope": "@nuxtjs",
"rawSpec": "2.0.0",
"saveSpec": null,
"fetchSpec": "2.0.0"
},
"_requiredBy": [
"/@nuxtjs/axios"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/proxy/-/proxy-2.0.0.tgz",
"_spec": "2.0.0",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"bugs": {
"url": "https://github.com/nuxt-community/proxy-module/issues"
},
"contributors": [
{
"name": "Pooya Parsa",
"email": "pooya@pi0.ir"
}
],
"dependencies": {
"consola": "^2.11.3",
"http-proxy-middleware": "^1.0.4"
},
"description": "The one-liner node.js http-proxy middleware solution for Nuxt.js using http-proxy-middleware",
"devDependencies": {
"@commitlint/cli": "latest",
"@commitlint/config-conventional": "latest",
"@nuxtjs/eslint-config": "latest",
"codecov": "latest",
"eslint": "latest",
"husky": "latest",
"jest": "latest",
"nuxt-edge": "latest",
"request": "latest",
"request-promise-native": "latest",
"standard-version": "latest"
},
"files": [
"lib"
],
"homepage": "https://github.com/nuxt-community/proxy-module#readme",
"license": "MIT",
"main": "lib/module.js",
"name": "@nuxtjs/proxy",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt-community/proxy-module.git"
},
"scripts": {
"dev": "nuxt test/fixture",
"lint": "eslint --ext .js,.vue lib test",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest"
},
"version": "2.0.0"
}
+432
View File
@@ -0,0 +1,432 @@
# 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.
### [1.11.2](https://github.com/nuxt-community/vuetify-module/compare/v1.11.1...v1.11.2) (2020-04-26)
### [1.11.1](https://github.com/nuxt-community/vuetify-module/compare/v1.11.0...v1.11.1) (2020-04-26)
### Bug Fixes
* check if preset is in presetsCDN ([#291](https://github.com/nuxt-community/vuetify-module/issues/291)) ([57a0ceb](https://github.com/nuxt-community/vuetify-module/commit/57a0ceb74551c20ca9fccf53b5083ad805e500a8))
## [1.11.0](https://github.com/nuxt-community/vuetify-module/compare/v1.10.3...v1.11.0) (2020-02-17)
### Features
* allow for list of custom fonts ([#269](https://github.com/nuxt-community/vuetify-module/issues/269)) ([3644437](https://github.com/nuxt-community/vuetify-module/commit/3644437cb01630b43aaa1898bfa352469b8faa91))
### [1.10.3](https://github.com/nuxt-community/vuetify-module/compare/v1.10.2...v1.10.3) (2020-01-30)
### Bug Fixes
* fix VuetifyLoaderOptions match type ([#273](https://github.com/nuxt-community/vuetify-module/issues/273)) ([2923943](https://github.com/nuxt-community/vuetify-module/commit/2923943a05b3940b31277ab64234535eda4c3ceb))
* use minimal vuetify import ([#267](https://github.com/nuxt-community/vuetify-module/issues/267)) ([1dffcbb](https://github.com/nuxt-community/vuetify-module/commit/1dffcbbd4fcce8bae3f9b03d6b83cf0434588790))
### [1.10.2](https://github.com/nuxt-community/vuetify-module/compare/v1.10.1...v1.10.2) (2020-01-17)
### [1.10.1](https://github.com/nuxt-community/vuetify-module/compare/v1.10.0...v1.10.1) (2020-01-15)
### Bug Fixes
* update devDependencies & fix code ([7f37ef6](https://github.com/nuxt-community/vuetify-module/commit/7f37ef64f9fc7d23fcb3a84a9ba7cfe963f3f3ca)), closes [#251](https://github.com/nuxt-community/vuetify-module/issues/251)
## [1.10.0](https://github.com/nuxt-community/vuetify-module/compare/v1.9.1...v1.10.0) (2020-01-13)
### Features
* add preset support ([#247](https://github.com/nuxt-community/vuetify-module/issues/247)) ([25d9813](https://github.com/nuxt-community/vuetify-module/commit/25d98137ded1296d1ddab9a7c4854102021bce66))
### Bug Fixes
* **deps:** bump vuetify version to latest and fix type path ([#237](https://github.com/nuxt-community/vuetify-module/issues/237)) ([b30f5db](https://github.com/nuxt-community/vuetify-module/commit/b30f5db447e74fed1871d59584eb98bbc15dceb6))
### [1.9.1](https://github.com/nuxt-community/vuetify-module/compare/v1.9.0...v1.9.1) (2019-12-05)
## [1.9.0](https://github.com/nuxt-community/vuetify-module/compare/v1.8.6...v1.9.0) (2019-10-02)
### Notes
* **Vuetify** has been bumped to **2.1 (Vanguard)**, check their [**Release notes**](https://togithub.com/vuetifyjs/vuetify/releases/v2.1.0) ! We highly recommend you to check the new [Skeleton Loader](https://vuetifyjs.com/en/components/skeleton-loaders) component 🤩
* **`dart-sass`** has been bumped to **1.23.0**, check their [**Release notes**](https://github.com/sass/dart-sass/releases/1.23.0) ! It includes the new launch of the new **Sass** module system 🤩
### [1.8.6](https://github.com/nuxt-community/vuetify-module/compare/v1.8.5...v1.8.6) (2019-09-28)
### Bug Fixes
* also prepend customVariables in scss files ([75823af](https://github.com/nuxt-community/vuetify-module/commit/75823af))
### [1.8.5](https://github.com/nuxt-community/vuetify-module/compare/v1.8.4...v1.8.5) (2019-09-17)
### [1.8.4](https://github.com/nuxt-community/vuetify-module/compare/v1.8.3...v1.8.4) (2019-09-16)
### [1.8.3](https://github.com/nuxt-community/vuetify-module/compare/v1.8.2...v1.8.3) (2019-09-10)
### Bug Fixes
* fix treeshake types for manual imports ([0b8e274](https://github.com/nuxt-community/vuetify-module/commit/0b8e274)), closes [#160](https://github.com/nuxt-community/vuetify-module/issues/160)
### [1.8.2](https://github.com/nuxt-community/vuetify-module/compare/v1.8.1...v1.8.2) (2019-09-09)
### [1.8.1](https://github.com/nuxt-community/vuetify-module/compare/v1.8.0...v1.8.1) (2019-09-09)
### Bug Fixes
* properly use indentedSyntax for sass files ([d8b7b5a](https://github.com/nuxt-community/vuetify-module/commit/d8b7b5a)), closes [#159](https://github.com/nuxt-community/vuetify-module/issues/159)
## [1.8.0](https://github.com/nuxt-community/vuetify-module/compare/v1.7.3...v1.8.0) (2019-09-08)
### Features
* seamless automatic fonts ([#157](https://github.com/nuxt-community/vuetify-module/issues/157)) ([334a343](https://github.com/nuxt-community/vuetify-module/commit/334a343))
### [1.7.3](https://github.com/nuxt-community/vuetify-module/compare/v1.7.2...v1.7.3) (2019-09-08)
### [1.7.2](https://github.com/nuxt-community/vuetify-module/compare/v1.7.1...v1.7.2) (2019-09-08)
### [1.7.1](https://github.com/nuxt-community/vuetify-module/compare/v1.7.0...v1.7.1) (2019-09-08)
### Bug Fixes
* fix templates location and publish them ([0b930e2](https://github.com/nuxt-community/vuetify-module/commit/0b930e2))
## [1.7.0](https://github.com/nuxt-community/vuetify-module/compare/v1.6.3...v1.7.0) (2019-09-08)
### [1.6.3](https://github.com/nuxt-community/vuetify-module/compare/v1.6.2...v1.6.3) (2019-09-05)
### [1.6.2](https://github.com/nuxt-community/vuetify-module/compare/v1.6.1...v1.6.2) (2019-09-03)
### Bug Fixes
* **types:** vuetify@2.0.12 types update ([#146](https://github.com/nuxt-community/vuetify-module/issues/146)) ([89c59a4](https://github.com/nuxt-community/vuetify-module/commit/89c59a4))
### [1.6.1](https://github.com/nuxt-community/vuetify-module/compare/v1.6.0...v1.6.1) (2019-08-30)
### Bug Fixes
* fix indentedSyntax issue around scss files ([9aaad72](https://github.com/nuxt-community/vuetify-module/commit/9aaad72))
## [1.6.0](https://github.com/nuxt-community/vuetify-module/compare/v1.5.0...v1.6.0) (2019-08-29)
### Notable changes
* update dependency sass-loader to v8 ([#139](https://github.com/nuxt-community/vuetify-module/pull/139)) ([08bff6a](https://github.com/nuxt-community/vuetify-module/commit/08bff6a))
### Bug Fixes
* remove duplicate import of main.sass ([259e0ee](https://github.com/nuxt-community/vuetify-module/commit/259e0ee))
## [1.5.0](https://github.com/nuxt-community/vuetify-module/compare/v1.4.0...v1.5.0) (2019-08-27)
### Bug Fixes
* fix missing comma for manual imports ([#132](https://github.com/nuxt-community/vuetify-module/issues/132)) ([069566b](https://github.com/nuxt-community/vuetify-module/commit/069566b)), closes [#130](https://github.com/nuxt-community/vuetify-module/issues/130) [/github.com/nuxt-community/vuetify-module/pull/132#discussion_r318289697](https://github.com/nuxt-community//github.com/nuxt-community/vuetify-module/pull/132/issues/discussion_r318289697)
### Features
* vuetify-loader options ([#134](https://github.com/nuxt-community/vuetify-module/issues/134)) ([22e82c5](https://github.com/nuxt-community/vuetify-module/commit/22e82c5))
## [1.4.0](https://github.com/nuxt-community/vuetify-module/compare/v1.3.3...v1.4.0) (2019-08-24)
### Features
* manual import of components ([#125](https://github.com/nuxt-community/vuetify-module/issues/125)) ([71c63f5](https://github.com/nuxt-community/vuetify-module/commit/71c63f5)), closes [#110](https://github.com/nuxt-community/vuetify-module/issues/110)
### [1.3.3](https://github.com/nuxt-community/vuetify-module/compare/v1.3.2...v1.3.3) (2019-08-23)
### [1.3.2](https://github.com/nuxt-community/vuetify-module/compare/v1.3.1...v1.3.2) (2019-08-21)
### [1.3.1](https://github.com/nuxt-community/vuetify-module/compare/v1.3.0...v1.3.1) (2019-08-20)
## [1.3.0](https://github.com/nuxt-community/vuetify-module/compare/v1.2.1...v1.3.0) (2019-08-20)
### Features
* **types:** provide nuxt 2.9 compatible types ([#119](https://github.com/nuxt-community/vuetify-module/issues/119)) ([1587e0f](https://github.com/nuxt-community/vuetify-module/commit/1587e0f))
### [1.2.2](https://github.com/nuxt-community/vuetify-module/compare/v1.2.1...v1.2.2) (2019-08-15)
### [1.2.1](https://github.com/nuxt-community/vuetify-module/compare/v1.2.0...v1.2.1) (2019-08-06)
## [1.2.0](https://github.com/nuxt-community/vuetify-module/compare/v1.1.2...v1.2.0) (2019-08-05)
### Features
* optionsPath + function behavior ([#99](https://github.com/nuxt-community/vuetify-module/issues/99)) ([96177a4](https://github.com/nuxt-community/vuetify-module/commit/96177a4))
### [1.1.2](https://github.com/nuxt-community/vuetify-module/compare/v1.1.1...v1.1.2) (2019-08-05)
### Bug Fixes
* fix vuetify transpilation ([#98](https://github.com/nuxt-community/vuetify-module/issues/98)) ([8075afb](https://github.com/nuxt-community/vuetify-module/commit/8075afb))
### [1.1.1](https://github.com/nuxt-community/vuetify-module/compare/v1.1.0...v1.1.1) (2019-08-01)
## [1.1.0](https://github.com/nuxt-community/vuetify-module/compare/v1.0.2...v1.1.0) (2019-07-30)
### Features
* defaultAssets.icons all icons providers support ([#85](https://github.com/nuxt-community/vuetify-module/issues/85)) ([d285b3b](https://github.com/nuxt-community/vuetify-module/commit/d285b3b))
* vuetifyOptions through options file ([#86](https://github.com/nuxt-community/vuetify-module/issues/86)) ([78495a3](https://github.com/nuxt-community/vuetify-module/commit/78495a3))
### [1.0.2](https://github.com/nuxt-community/vuetify-module/compare/v1.0.1...v1.0.2) (2019-07-29)
### [1.0.1](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0...v1.0.1) (2019-07-25)
## [1.0.0](https://github.com/nuxt-community/vuetify-module/compare/v0.5.7...v1.0.0) (2019-07-23)
### Features
- Upgrade to [Vuetify 2](https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0)
- Implements `ctx.$vuetify`
- Custom SASS variables
- TypeScript typings
### BREAKING CHANGES
Nuxt Module for Vuetify 2 brings lot of breaking changes
Overall you'll need to follow [Vuetify 2 Upgrade guide](https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0#user-content-upgrade-guide) to correctly update your layouts, pages & components that were related to Vuetify in your project.
Around the Nuxt module itself, it still passes options to Vuetify, but the custom options that change the behavior of what does the module for you have changed, you can find the new options in the **README** file.
## [1.0.0-beta.8](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2019-07-22)
## [1.0.0-beta.7](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.6...v1.0.0-beta.7) (2019-07-18)
## [1.0.0-beta.6](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.5...v1.0.0-beta.6) (2019-07-11)
## [1.0.0-beta.5](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.4...v1.0.0-beta.5) (2019-07-03)
## [1.0.0-beta.4](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.3...v1.0.0-beta.4) (2019-06-26)
## [1.0.0-beta.3](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.2...v1.0.0-beta.3) (2019-06-19)
## [1.0.0-beta.2](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.1...v1.0.0-beta.2) (2019-06-11)
## [1.0.0-beta.1](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-beta.0...v1.0.0-beta.1) (2019-06-06)
## [1.0.0-beta.0](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.6...v1.0.0-beta.0) (2019-06-04)
### Bug Fixes
* apply vuetify vars only for sass files ([#25](https://github.com/nuxt-community/vuetify-module/issues/25)) ([f8f0392](https://github.com/nuxt-community/vuetify-module/commit/f8f0392))
* don't override sassLoader data ([3c1c1e6](https://github.com/nuxt-community/vuetify-module/commit/3c1c1e6))
* fix tooltip activator behavior ([feeacd8](https://github.com/nuxt-community/vuetify-module/commit/feeacd8))
* use theme primary color for toolbar ([3bc02cc](https://github.com/nuxt-community/vuetify-module/commit/3bc02cc))
### Features
* customVariables ([d2b3b8a](https://github.com/nuxt-community/vuetify-module/commit/d2b3b8a))
* roboto font display swap ([feac192](https://github.com/nuxt-community/vuetify-module/commit/feac192))
# [1.0.0-alpha.6](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2019-05-18)
# [1.0.0-alpha.5](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2019-05-02)
# [1.0.0-alpha.4](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2019-04-18)
### Bug Fixes
* always setup sass loader options ([1709f2b](https://github.com/nuxt-community/vuetify-module/commit/1709f2b))
# [1.0.0-alpha.3](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2019-04-18)
### Bug Fixes
* hotfix when module options is not set in config ([4cfa0ab](https://github.com/nuxt-community/vuetify-module/commit/4cfa0ab))
# [1.0.0-alpha.2](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2019-04-18)
# [1.0.0-alpha.1](https://github.com/nuxt-community/vuetify-module/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2019-04-17)
# [1.0.0-alpha.0](https://github.com/nuxt-community/vuetify-module/compare/v0.5.5...v1.0.0-alpha.0) (2019-04-10)
### Features
* upgrade to new vuetify 2 spec ([6ff1910](https://github.com/nuxt-community/vuetify-module/commit/6ff1910))
### BREAKING CHANGES
* Removed `css`, implemented `assets` option
### [0.5.7](https://github.com/nuxt-community/vuetify-module/compare/v0.5.6...v0.5.7) (2019-07-22)
### [0.5.6](https://github.com/nuxt-community/vuetify-module/compare/v0.5.5...v0.5.6) (2019-06-04)
<a name="0.5.5"></a>
## [0.5.5](https://github.com/nuxt-community/vuetify-module/compare/v0.5.4...v0.5.5) (2019-02-14)
<a name="0.0.1"></a>
## 0.0.1 (2019-02-08)
### Bug Fixes
* **readme:** Typo ([5496ade](https://github.com/nuxt-community/vuetify-module/commit/5496ade))
* run module in build:before hook ([4676a34](https://github.com/nuxt-community/vuetify-module/commit/4676a34)), closes [#1](https://github.com/nuxt-community/vuetify-module/issues/1)
<a name="0.5.0"></a>
# [0.5.0](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.4.3...@nuxtjs/vuetify@0.5.0) (2018-12-19)
### Bug Fixes
* **deps:** update all non-major dependencies ([#231](https://github.com/nuxt/modules/issues/231)) ([345418b](https://github.com/nuxt/modules/commit/345418b))
### Features
* **vuetify:** add tree-shaking option ([#242](https://github.com/nuxt/modules/issues/242)) ([3e25477](https://github.com/nuxt/modules/commit/3e25477))
<a name="0.4.3"></a>
## [0.4.3](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.4.2...@nuxtjs/vuetify@0.4.3) (2018-10-01)
**Note:** Version bump only for package @nuxtjs/vuetify
<a name="0.4.2"></a>
## [0.4.2](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.4.1...@nuxtjs/vuetify@0.4.2) (2018-04-27)
**Note:** Version bump only for package @nuxtjs/vuetify
<a name="0.4.1"></a>
## [0.4.1](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.4.0...@nuxtjs/vuetify@0.4.1) (2018-03-05)
**Note:** Version bump only for package @nuxtjs/vuetify
<a name="0.4.0"></a>
# [0.4.0](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.3.1...@nuxtjs/vuetify@0.4.0) (2017-12-07)
### Features
* **vuetify:** bump vuetify version to 1.0.0-alpha ([#175](https://github.com/nuxt/modules/issues/175)) ([f2b948a](https://github.com/nuxt/modules/commit/f2b948a))
<a name="0.3.1"></a>
## [0.3.1](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.3.0...@nuxtjs/vuetify@0.3.1) (2017-11-24)
**Note:** Version bump only for package @nuxtjs/vuetify
<a name="0.3.0"></a>
# [0.3.0](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.2.0...@nuxtjs/vuetify@0.3.0) (2017-11-24)
### Features
* **vuetify:** allow passing options to vuetify plugin ([f0826f1](https://github.com/nuxt/modules/commit/f0826f1))
<a name="0.2.0"></a>
# [0.2.0](https://github.com/nuxt/modules/compare/@nuxtjs/vuetify@0.1.1...@nuxtjs/vuetify@0.2.0) (2017-11-20)
### Features
* upgrade dependencies ([52f3572](https://github.com/nuxt/modules/commit/52f3572))
<a name="0.1.1"></a>
## 0.1.1 (2017-10-05)
<a name="1.0.1"></a>
## 1.0.1 (2017-06-07)
+23
View File
@@ -0,0 +1,23 @@
MIT License
Copyright (c) Nuxt Community
- Pooya Parsa ([@pi0](https://github.com/pi0))
- Kevin Marrec ([@kevinmarrec](https://github.com/kevinmarrec))
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.
Generated Vendored Executable
+240
View File
@@ -0,0 +1,240 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/904724/59509947-c14eca80-8eb2-11e9-807c-14e7cc72eecc.png" alt="nuxt-tailwindcss" width="500"/>
</p>
<p align="center">
<a href="https://npmjs.com/package/@nuxtjs/vuetify"><img src="https://img.shields.io/npm/v/@nuxtjs/vuetify.svg?style=flat-square" alt="npm downloads"></a>
<a href="https://npmjs.com/package/@nuxtjs/vuetify"><img src="https://img.shields.io/npm/dt/@nuxtjs/vuetify.svg?style=flat-square" alt="npm version"></a>
<a href="https://circleci.com/gh/nuxt-community/vuetify-module"><img src="https://img.shields.io/circleci/project/github/nuxt-community/vuetify-module.svg?style=flat-square" alt="circle ci"></a>
<a href="https://codecov.io/gh/nuxt-community/vuetify-module"><img src="https://img.shields.io/codecov/c/github/nuxt-community/vuetify-module.svg?style=flat-square" alt="coverage"></a>
<a href="https://www.npmjs.com/package/@nuxtjs/vuetify"><img src="https://img.shields.io/npm/l/@nuxtjs/vuetify.svg?style=flat-square" alt="License"></a>
</p>
> [Vuetify 2](https://vuetifyjs.com) module for [Nuxt.js](https://nuxtjs.org)
## Infos
- [📖 **Release Notes**](./CHANGELOG.md)
- [🏀 **Online playground**](https://codesandbox.io/s/nuxtjs-vuetify-v0k7i)
- [🛠 **Migration guide from Vuetify 1.5.x**](./MIGRATION_GUIDE.md)
- [🏷 **Module for Vuetify 1.5.x**](https://github.com/nuxt-community/vuetify-module/tree/0.x)
## Setup
1. Add `@nuxtjs/vuetify` dependency to your project
```bash
yarn add --dev @nuxtjs/vuetify # or npm install --save-dev @nuxtjs/vuetify
```
2. Add `@nuxtjs/vuetify` to the `buildModules` section of `nuxt.config.js`
:warning: If you are using Nuxt `< 2.9.0`, use `modules` instead.
```js
{
buildModules: [
// Simple usage
'@nuxtjs/vuetify',
// With options
['@nuxtjs/vuetify', { /* module options */ }]
]
}
```
### Using top level options
```js
{
buildModules: [
'@nuxtjs/vuetify'
],
vuetify: {
/* module options */
}
}
```
## Options
### `customVariables`
- Type: `Array`
- Items: `String`
- Default: `[]`
Provide a way to customize Vuetify SASS variables.
**Only works with [tree-shaking](#treeShake).**
Usage example :
```scss
// assets/variables.scss
// Variables you want to modify
$btn-border-radius: 0px;
// If you need to extend Vuetify SASS lists
$material-light: ( cards: blue );
@import '~vuetify/src/styles/styles.sass';
```
```js
// nuxt.config.js
export default {
vuetify: {
customVariables: ['~/assets/variables.scss']
}
}
```
> The list of customizable variables can be found by looking at the files [here](https://github.com/vuetifyjs/vuetify/tree/master/packages/vuetify/src/styles/settings).
### `defaultAssets`
- Type: `Object` or `Boolean`
- Default:
```js
{
font: {
family: 'Roboto'
},
icons: 'mdi'
}
```
By default, automatically handle **Roboto** font & **Material Design Icons**.
These assets are handled automatically by default to provide a zero-configuration which let you play directly with Vuetify.
`defaultAssets.font.family` automatically adds the specified font (default **Roboto**) stylesheet from official google fonts to load the font with `font-display: swap`.
If you have [nuxt-webfontloader](https://github.com/Developmint/nuxt-webfontloader) in your `modules`, it will use it automatically.
`defaultAssets.font.size` allows you to specify the root font size in your application.
:warning: If you choose a custom font family (i.e. not **Roboto**), it will automatically override Vuetify SASS variables (`$body-font-family` & `font-size-root`), but you will need [tree-shaking](#treeShake) to be enabled to have them correctly applied.
`defaultAssets.icons` automatically adds the icons stylesheet from a CDN to load all the icons (**not optimized for production**).
Here are the accepted values for this option :
| Value | Icons |
|-------|-------|
| `'mdi'` (default) | [Material Designs Icons](https://materialdesignicons.com/) ([CDN](https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css))
| `'md'` | [Material Icons](https://material.io/resources/icons/) ([CDN](https://fonts.googleapis.com/css?family=Material+Icons))
| `'fa'` | [Font Awesome 5](https://fontawesome.com/icons) ([CDN](https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css))
| `'fa4'` | [Font Awesome 4](https://fontawesome.com/v4.7.0/icons/) ([CDN](https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css))
| `false` | Disable auto add of the icons stylesheet
> This option (if not set to `false`) will automatically override `icons.iconfont` Vuetify option so that Vuetify components use these icons.
Please refer to [Vuetify Icons documentation](https://vuetifyjs.com/en/customization/icons) for more information about icons, notably for using only bunch of SVG icons instead of including all icons in your app.
You can also set the whole `defaultAssets` option to `false` to prevent any automatic add of these two assets.
You can read more about adding your own assets in the [Offline applications](https://github.com/nuxt-community/vuetify-module#offline-applications) section.
### `optionsPath`
- Type: `String`
Location of the Vuetify options that will be passed to Vuetify.
This file will be compiled by **webpack**, which means you'll benefit fast hot reload when changing these options, but also be able to use TypeScript without being forced to use TypeScript runtime.
```js
// nuxt.config.js
export default {
vuetify: {
optionsPath: './vuetify.options.js'
}
}
```
> Note that you can also use [Directory Aliases](https://nuxtjs.org/guide/directory-structure#aliases) like `'~/path/to/option.js'`
All vuetify options are supported, it includes :
- [**Breakpoints**](https://vuetifyjs.com/en/customization/breakpoints)
- [**Icons**](https://vuetifyjs.com/en/customization/icons)
- [**Internationalization (i18n)**](https://vuetifyjs.com/en/customization/internationalization)
- [**RTL (bidirectionality)**](https://vuetifyjs.com/en/customization/rtl)
- [**Theme**](https://vuetifyjs.com/en/customization/theme)
```js
// vuetify.options.js
export default {
breakpoint: {},
icons: {},
lang: {},
rtl: true,
theme: {}
}
```
> Notice that passing the Vuetify options directly to Module options is still supported, but it will trigger Nuxt entire rebuild if options are changed.
If you need to access Nuxt context within the options file, you need to export a function instead :
```js
// vuetify.options.js
export default function ({ app }) {
return {
lang: {
t: (key, ...params) => app.i18n.t(key, params)
}
}
}
```
### `treeShake`
- Type: `Boolean`
- Default: `process.env.NODE_ENV === 'production'`
Uses [vuetify-loader](https://github.com/vuetifyjs/vuetify-loader) to enable automatic [tree-shaking](https://vuetifyjs.com/en/customization/a-la-carte).
Enabled only for production by default.
## TypeScript
If you're using TypeScript, you'll need to add `@nuxtjs/vuetify` in your `compilerOptions` of your `tsconfig.json` :
```json
{
"compilerOptions": {
"types": [
"@types/node",
"@nuxt/vue-app",
"@nuxtjs/vuetify"
]
}
}
```
You'll then be able to have autocompletion in Context (`ctx.$vuetify`) and Vue instances (`this.$vuetify`).
## Offline applications
If you're building an application that will need to work offline (more likely a [**PWA**](https://pwa.nuxtjs.org/)), you will need to bundle your fonts and icons in your app instead of using online resources.
It means you must set [`defaultAssets`](#defaultAssets) option to `false`.
For fonts, you may leverage CSS [**@font-face**](https://www.w3schools.com/cssref/css3_pr_font-face_rule.asp) rule with local path of your fonts. You may find the [google webfonts helper](https://google-webfonts-helper.herokuapp.com/fonts/roboto?subsets=latin) site useful for generating **@font-face** rules and sourcing replacement files for the default CDNs.
For icons, you can either use the same way than above, or leverage tree-shaken SVG libraries like [**Material Design Icons SVG**](https://github.com/Templarian/MaterialDesign-JS) or [**Font Awesome 5 SVG**](https://fontawesome.com/how-to-use/on-the-web/advanced/svg-javascript-core).
## Migration Guide from Vuetify 1.5.x
You'll find a step by step guide to upgrade from 1.5.x to 2.x [here](./MIGRATION_GUIDE.md)
## Development
- Clone this repository
- Install dependencies using `yarn install` or `npm install`
- Start development server using `yarn dev` or `npm run dev`
## License
[MIT License](./LICENSE)
Copyright (c) Nuxt Community
+3
View File
@@ -0,0 +1,3 @@
import { ModuleThis } from '@nuxt/types/config/module';
import { Options } from './options';
export default function setupBuild(this: ModuleThis, options: Options): void;
+42
View File
@@ -0,0 +1,42 @@
import path from 'path';
import fs from 'fs';
export default function setupBuild(options) {
if (!options.treeShake) {
this.options.css.push('vuetify/dist/vuetify.css');
}
// Enable tree-shaking with VuetifyLoader (https://github.com/vuetifyjs/vuetify-loader)
if (options.treeShake) {
const VuetifyLoaderPlugin = this.nuxt.resolver.requireModule('vuetify-loader/lib/plugin');
this.options.build.transpile.push('vuetify/lib');
this.extendBuild((config) => {
config.plugins.push(new VuetifyLoaderPlugin(typeof options.treeShake === 'object' ? options.treeShake.loaderOptions : {}));
});
}
// Remove module options
const vuetifyOptions = { ...options };
delete vuetifyOptions.customVariables;
delete vuetifyOptions.defaultAssets;
delete vuetifyOptions.optionsPath;
delete vuetifyOptions.preset;
delete vuetifyOptions.treeShake;
let optionsPath = this.nuxt.resolver.resolveAlias(options.optionsPath ||
path.join(this.options.dir.app || 'app', 'vuetify', 'options.js'));
optionsPath = fs.existsSync(optionsPath) ? optionsPath : null;
// Register options template
this.addTemplate({
fileName: `vuetify/options.${optionsPath && optionsPath.endsWith('ts') ? 'ts' : 'js'}`,
src: optionsPath || path.resolve(__dirname, '../templates', 'options.js'),
options: vuetifyOptions
});
// Register plugin
this.addPlugin({
fileName: 'vuetify/plugin.js',
src: path.resolve(__dirname, '../templates', 'plugin.js'),
options: {
defaultIconPreset: options.defaultAssets && options.defaultAssets.icons,
preset: options.preset,
treeShake: options.treeShake
}
});
}
//# sourceMappingURL=build.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AAInB,MAAM,CAAC,OAAO,UAAU,UAAU,CAAoB,OAAgB;IACpE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;QACtB,IAAI,CAAC,OAAO,CAAC,GAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;KACnD;IAED,uFAAuF;IACvF,IAAI,OAAO,CAAC,SAAS,EAAE;QACrB,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,2BAA2B,CAAC,CAExF;QAAC,IAAI,CAAC,OAAO,CAAC,KAAM,CAAC,SAAuB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;QAEjE,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,EAAE;YAC1B,MAAM,CAAC,OAAQ,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC7H,CAAC,CAAC,CAAA;KACH;IAED,wBAAwB;IACxB,MAAM,cAAc,GAAG,EAAE,GAAG,OAAO,EAAE,CAAA;IACrC,OAAO,cAAc,CAAC,eAAe,CAAA;IACrC,OAAO,cAAc,CAAC,aAAa,CAAA;IACnC,OAAO,cAAc,CAAC,WAAW,CAAA;IACjC,OAAO,cAAc,CAAC,MAAM,CAAA;IAC5B,OAAO,cAAc,CAAC,SAAS,CAAA;IAE/B,IAAI,WAAW,GAAkB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW;QAChF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAI,CAAC,GAAG,IAAI,KAAK,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAA;IAEvE,WAAW,GAAG,EAAE,CAAC,UAAU,CAAC,WAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA;IAE9D,4BAA4B;IAC5B,IAAI,CAAC,WAAW,CAAC;QACf,QAAQ,EAAE,mBAAmB,WAAW,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;QACtF,GAAG,EAAE,WAAW,IAAI,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,YAAY,CAAC;QACzE,OAAO,EAAE,cAAc;KACxB,CAAC,CAAA;IAEF,kBAAkB;IAClB,IAAI,CAAC,SAAS,CAAC;QACb,QAAQ,EAAE,mBAAmB;QAC7B,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,WAAW,CAAC;QACzD,OAAO,EAAE;YACP,iBAAiB,EAAE,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,KAAK;YACvE,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B;KACF,CAAC,CAAA;AACJ,CAAC"}
+6
View File
@@ -0,0 +1,6 @@
import { ModuleThis } from '@nuxt/types/config/module';
export interface FontOptions {
family?: string | string[];
size?: number;
}
export default function setupFont(this: ModuleThis, options: FontOptions): void;
+28
View File
@@ -0,0 +1,28 @@
export default function setupFont(options) {
const family = `${options.family}:100,300,400,500,700,900&display=swap`;
if (this.options.modules.some(mod => mod === 'nuxt-webfontloader')) {
this.options.webfontloader = this.options.webfontloader || {};
this.options.webfontloader.google = this.options.webfontloader.google || {};
this.options.webfontloader.google.families = [...this.options.webfontloader.google.families || [], family];
}
else {
this.options.head.link.push({
rel: 'stylesheet',
type: 'text/css',
href: `https://fonts.googleapis.com/css?family=${family}`
});
}
const sass = this.options.build.loaders.sass;
// Add font-family custom variable (only if not Roboto, cause already default in Vuetify styles)
if (options.family !== 'Roboto') {
const userFontFamily = Array.isArray(options.family)
? options.family.map(x => `'${x}'`).join(', ')
: `'${options.family}'`;
sass.prependData = [`$body-font-family: ${userFontFamily}, sans-serif`, sass.prependData].join('\n');
}
// Add font-size custom variable
if (options.size) {
sass.prependData = [`$font-size-root: ${options.size}px`, sass.prependData].join('\n');
}
}
//# sourceMappingURL=font.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"font.js","sourceRoot":"","sources":["../src/font.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoB,OAAoB;IACvE,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,uCAAuC,CAAA;IAEvE,IAAI,IAAI,CAAC,OAAO,CAAC,OAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,oBAAoB,CAAC,EAAE;QACnE,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,IAAI,EAAE,CAAA;QAC7D,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,IAAI,EAAE,CAAA;QAC3E,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,EAAE,MAAM,CAAC,CAAA;KAC3G;SAAM;QACL,IAAI,CAAC,OAAO,CAAC,IAAK,CAAC,IAAK,CAAC,IAAI,CAAC;YAC5B,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,2CAA2C,MAAM,EAAE;SAC1D,CAAC,CAAA;KACH;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAM,CAAC,OAAQ,CAAC,IAAK,CAAA;IAE/C,gGAAgG;IAChG,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC/B,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;YAClD,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC9C,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAA;QACzB,IAAI,CAAC,WAAW,GAAG,CAAC,sBAAsB,cAAc,cAAc,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACrG;IAED,gCAAgC;IAChC,IAAI,OAAO,CAAC,IAAI,EAAE;QAChB,IAAI,CAAC,WAAW,GAAG,CAAC,oBAAoB,OAAO,CAAC,IAAI,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACvF;AACH,CAAC"}
+10
View File
@@ -0,0 +1,10 @@
import { ModuleThis } from '@nuxt/types/config/module';
declare const presetsCDN: {
mdi: string;
md: string;
fa: string;
fa4: string;
};
export declare type IconPreset = keyof typeof presetsCDN;
export default function setupIcons(this: ModuleThis, preset: IconPreset): void;
export {};
+17
View File
@@ -0,0 +1,17 @@
const presetsCDN = {
mdi: 'https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css',
md: 'https://fonts.googleapis.com/css?family=Material+Icons',
fa: 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css',
fa4: 'https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css'
};
export default function setupIcons(preset) {
// istanbul ignore else
if (presetsCDN[preset]) {
this.options.head.link.push({
rel: 'stylesheet',
type: 'text/css',
href: presetsCDN[preset]
});
}
}
//# sourceMappingURL=icons.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,GAAG;IACjB,GAAG,EAAE,+EAA+E;IACpF,EAAE,EAAE,wDAAwD;IAC5D,EAAE,EAAE,mFAAmF;IACvF,GAAG,EAAE,0EAA0E;CAChF,CAAA;AAID,MAAM,CAAC,OAAO,UAAU,UAAU,CAAoB,MAAkB;IACtE,uBAAuB;IACvB,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,CAAC,OAAO,CAAC,IAAK,CAAC,IAAK,CAAC,IAAI,CAAC;YAC5B,GAAG,EAAE,YAAY;YACjB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;SACzB,CAAC,CAAA;KACH;AACH,CAAC"}
+14
View File
@@ -0,0 +1,14 @@
import { Module } from '@nuxt/types';
import { Framework } from 'vuetify';
import { Options, TreeShakeOptions, VuetifyLoaderOptions } from './options';
declare module '@nuxt/types' {
interface Configuration {
vuetify?: Options;
}
interface Context {
$vuetify: Framework;
}
}
declare const vuetifyModule: Module<Options>;
export { Options, TreeShakeOptions, VuetifyLoaderOptions };
export default vuetifyModule;
+18
View File
@@ -0,0 +1,18 @@
import initOptions from './options';
import setupBuild from './build';
import setupFont from './font';
import setupIcons from './icons';
import setupSass from './sass';
const vuetifyModule = function (moduleOptions) {
this.nuxt.hook('build:before', () => {
const options = initOptions.call(this, moduleOptions);
if (typeof options.defaultAssets === 'object') {
options.defaultAssets.font && setupFont.call(this, options.defaultAssets.font);
options.defaultAssets.icons && setupIcons.call(this, options.defaultAssets.icons);
}
setupSass.call(this, options.customVariables);
setupBuild.call(this, options);
});
};
export default vuetifyModule;
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,WAAgE,MAAM,WAAW,CAAA;AACxF,OAAO,UAAU,MAAM,SAAS,CAAA;AAChC,OAAO,SAAS,MAAM,QAAQ,CAAA;AAC9B,OAAO,UAAU,MAAM,SAAS,CAAA;AAChC,OAAO,SAAS,MAAM,QAAQ,CAAA;AAY9B,MAAM,aAAa,GAAoB,UAAU,aAAa;IAC5D,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;QAClC,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;QAErD,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ,EAAE;YAC7C,OAAO,CAAC,aAAa,CAAC,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;YAC9E,OAAO,CAAC,aAAa,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;SAClF;QAED,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,CAAA;QAC7C,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAQD,eAAe,aAAa,CAAA"}
+41
View File
@@ -0,0 +1,41 @@
import { SFCDescriptor } from 'vue-template-compiler';
import { VuetifyPreset } from 'vuetify/types/services/presets';
import { ModuleThis } from '@nuxt/types/config/module';
import { FontOptions } from './font';
import { IconPreset } from './icons';
export interface TreeShakeOptions {
components?: string[];
directives?: string[];
loaderOptions?: VuetifyLoaderOptions;
transitions?: string[];
}
export interface VuetifyLoaderOptions {
match?(originalTag: string, context: {
kebabTag: string;
camelTag: string;
path: string;
component: SFCDescriptor;
}): [string, string] | undefined;
}
export interface Options extends Partial<VuetifyPreset> {
customVariables?: string[];
defaultAssets?: {
font?: FontOptions;
icons?: IconPreset | false;
} | false;
optionsPath?: string;
preset?: string;
treeShake?: boolean | TreeShakeOptions;
}
export declare const defaults: {
customVariables: never[];
defaultAssets: {
font: {
family: string;
};
icons: "mdi" | "md" | "fa" | "fa4";
};
optionsPath: undefined;
treeShake: boolean;
};
export default function initOptions(this: ModuleThis, moduleOptions?: Options): Required<Options>;
+21
View File
@@ -0,0 +1,21 @@
import merge from 'deepmerge';
export const defaults = {
customVariables: [],
defaultAssets: {
font: {
family: 'Roboto'
},
icons: 'mdi'
},
optionsPath: undefined,
treeShake: process.env.NODE_ENV === 'production'
};
export default function initOptions(moduleOptions) {
const options = merge.all([
defaults,
this.options.vuetify || {},
moduleOptions || {}
]);
return options;
}
//# sourceMappingURL=options.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"options.js","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,WAAW,CAAA;AAoC7B,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,eAAe,EAAE,EAAE;IACnB,aAAa,EAAE;QACb,IAAI,EAAE;YACJ,MAAM,EAAE,QAAQ;SACjB;QACD,KAAK,EAAE,KAAmB;KAC3B;IACD,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;CACjD,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAoB,aAAuB;IAC5E,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC;QACxB,QAAQ;QACR,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE;QAC1B,aAAa,IAAI,EAAE;KACpB,CAAsB,CAAA;IAEvB,OAAO,OAAO,CAAA;AAChB,CAAC"}
+3
View File
@@ -0,0 +1,3 @@
import { ModuleThis } from '@nuxt/types/config/module';
import { Options } from './options';
export default function setupSass(this: ModuleThis, customVariables: Options['customVariables']): void;
+21
View File
@@ -0,0 +1,21 @@
import dartSass from 'sass';
export default function setupSass(customVariables) {
const { sass, scss } = this.options.build.loaders;
// Use Dart Sass
sass.implementation = scss.implementation = dartSass;
// Ensure compatibility with Nuxt < 2.10 (i.e. before https://github.com/nuxt/nuxt.js/pull/6460)
if (!sass.sassOptions) {
delete sass.indentedSyntax;
sass.sassOptions = {
indentedSyntax: true
};
}
// Custom variables
if (customVariables && customVariables.length > 0) {
const sassImports = customVariables.map(path => `@import '${path}'`).join('\n');
sass.prependData = [sass.prependData, sassImports].join('\n');
const scssImports = customVariables.map(path => `@import '${path}';`).join('\n');
scss.prependData = [scss.prependData, scssImports].join('\n');
}
}
//# sourceMappingURL=sass.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"sass.js","sourceRoot":"","sources":["../src/sass.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,MAAM,CAAA;AAG3B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAoB,eAA2C;IAC9F,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,KAAM,CAAC,OAAoE,CAAA;IAE/G,gBAAgB;IAChB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAA;IAEpD,gGAAgG;IAChG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QACrB,OAAO,IAAI,CAAC,cAAc,CAAA;QAC1B,IAAI,CAAC,WAAW,GAAG;YACjB,cAAc,EAAE,IAAI;SACrB,CAAA;KACF;IAED,mBAAmB;IACnB,IAAI,eAAe,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC/E,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC7D,MAAM,WAAW,GAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChF,IAAI,CAAC,WAAW,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KAC9D;AACH,CAAC"}
+95
View File
@@ -0,0 +1,95 @@
{
"_args": [
[
"@nuxtjs/vuetify@1.11.2",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_from": "@nuxtjs/vuetify@1.11.2",
"_id": "@nuxtjs/vuetify@1.11.2",
"_inBundle": false,
"_integrity": "sha512-8+k/PQG37OAoXvXgKE+BkBQXaoBCz9odK8oPYA4lwmxQ0ekHnh4PFrU/6Fr+OeVHbQbynbuMZnkF9aWxDsTqug==",
"_location": "/@nuxtjs/vuetify",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/vuetify@1.11.2",
"name": "@nuxtjs/vuetify",
"escapedName": "@nuxtjs%2fvuetify",
"scope": "@nuxtjs",
"rawSpec": "1.11.2",
"saveSpec": null,
"fetchSpec": "1.11.2"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/vuetify/-/vuetify-1.11.2.tgz",
"_spec": "1.11.2",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"bugs": {
"url": "https://github.com/nuxt-community/vuetify-module/issues"
},
"contributors": [
{
"name": "Pooya Parsa",
"url": "@pi0"
},
{
"name": "Kevin Marrec",
"url": "@kevinmarrec"
}
],
"dependencies": {
"deepmerge": "^4.2.2",
"fibers": "^4.0.3",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"vuetify": "^2",
"vuetify-loader": "^1.4.3"
},
"description": "Vuetify Module for Nuxt.js",
"devDependencies": {
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@nuxt/typescript-build": "^0.6.6",
"@nuxt/typescript-runtime": "^0.4.6",
"@nuxtjs/eslint-config-typescript": "^1.0.2",
"@types/jest": "^25.2.1",
"@types/sass": "^1.16.0",
"codecov": "^3.6.5",
"eslint": "^6.8.0",
"husky": "^4.2.5",
"jest": "^25.4.0",
"nuxt-edge": "2.11.1-26375059.fd5fefe",
"nuxt-webfontloader": "^1.1.0",
"standard-version": "^7.1.0",
"ts-jest": "^25.4.0",
"typescript": "~3.8"
},
"files": [
"dist",
"templates"
],
"homepage": "https://github.com/nuxt-community/vuetify-module#readme",
"license": "MIT",
"main": "dist/index.js",
"name": "@nuxtjs/vuetify",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt-community/vuetify-module.git"
},
"scripts": {
"build": "tsc",
"dev": "tsc && nuxt-ts test/fixture",
"lint": "eslint --ext .ts,.js,.vue .",
"release": "yarn test && yarn build && standard-version && git push --follow-tags && npm publish",
"test": "yarn lint && jest"
},
"typings": "dist/index.d.ts",
"version": "1.11.2"
}
+1
View File
@@ -0,0 +1 @@
export default <%= serializeFunction(options) %>
+49
View File
@@ -0,0 +1,49 @@
import Vue from 'vue'
import Vuetify from '<%= options.treeShake ? 'vuetify/lib/framework' : 'vuetify' %>'
<% if (options.preset) { %>
import { preset } from '<%= options.preset %>'
<% } %>
<%
const libImports = [
{ key: 'components', location: 'vuetify/lib'},
{ key: 'transitions', location: 'vuetify/lib'},
{ key: 'directives', location: 'vuetify/lib/directives'}
]
if (options.treeShake) {
for (const lib of libImports) {
if (options.treeShake[lib.key] && options.treeShake[lib.key].length > 0) {
%>
import { <%= options.treeShake[lib.key].join(', ') %> } from '<%= lib.location %>'
<%
}
}
}
%>
import options from './options'
Vue.use(Vuetify, {
<% if (options.treeShake) { %>
<%= libImports.filter(lib => options.treeShake[lib.key] && options.treeShake[lib.key].length > 0)
.map(lib => ` ${lib.key}: { ${options.treeShake[lib.key].join(', ')} }`)
.join(',\n') %>
<% } %>
})
export default (ctx) => {
const vuetifyOptions = typeof options === 'function' ? options(ctx) : options
<% if (options.defaultIconPreset) { %>
vuetifyOptions.icons = vuetifyOptions.icons || {}
vuetifyOptions.icons.iconfont = '<%= options.defaultIconPreset %>'
<% } %>
<% if (options.preset) { %>
vuetifyOptions.preset = preset
<% } %>
const vuetify = new Vuetify(vuetifyOptions)
ctx.app.vuetify = vuetify
ctx.$vuetify = vuetify.framework
}
+60
View File
@@ -0,0 +1,60 @@
<a name="2.0.5"></a>
## [2.0.5](https://github.com/poppinss/youch/compare/v2.0.4...v2.0.5) (2017-06-13)
### Bug Fixes
* **template:** improve css for smaller screens ([b07c77d](https://github.com/poppinss/youch/commit/b07c77d))
<a name="2.0.4"></a>
## [2.0.4](https://github.com/poppinss/youch/compare/v2.0.3...v2.0.4) (2017-01-31)
### Bug Fixes
* **test:** use mocha instead of japa ([8bf7039](https://github.com/poppinss/youch/commit/8bf7039))
<a name="2.0.3"></a>
## [2.0.3](https://github.com/poppinss/youch/compare/v2.0.2...v2.0.3) (2017-01-30)
### Bug Fixes
* **regex:** use plain regex over path.sep ([db3e2dc](https://github.com/poppinss/youch/commit/db3e2dc))
<a name="2.0.2"></a>
## [2.0.2](https://github.com/poppinss/youch/compare/v2.0.0...v2.0.2) (2017-01-27)
### Bug Fixes
* **package:** fix path to main file ([5ad3b4a](https://github.com/poppinss/youch/commit/5ad3b4a))
<a name="2.0.1"></a>
## [2.0.1](https://github.com/poppinss/youch/compare/v2.0.0...v2.0.1) (2017-01-26)
### Bug Fixes
* **package:** fix path to main file ([5ad3b4a](https://github.com/poppinss/youch/commit/5ad3b4a))
<a name="2.0.0"></a>
# 2.0.0 (2017-01-26)
### Features
* initial implementation ([aba222a](https://github.com/poppinss/youch/commit/aba222a))
+6
View File
@@ -0,0 +1,6 @@
# Contributing
In favor of active development we accept contributions from everyone. You can contribute by submitting a bug, creating pull requests or even by improving documentation.
Below is the guide to be followed strictly before submitting your pull requests.
http://adonisjs.com/docs/contributing
+89
View File
@@ -0,0 +1,89 @@
# Youch!
> Pretty error reporting for Node.js 🚀 (Modified for Nuxt.js & SSR Bundles)
<br />
<p>
<img src="https://user-images.githubusercontent.com/5158436/28990900-0a4766f8-7997-11e7-9f0b-4336fa2e2e0b.png" style="width: 600px;" />
</p>
<br />
---
<br />
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Downloads Stats][npm-downloads]][npm-url]
[![Appveyor][appveyor-image]][appveyor-url]
[![Gitter Channel][gitter-image]][gitter-url]
[![Trello][trello-image]][trello-url]
[![Patreon][patreon-image]][patreon-url]
Youch is inspired by [Whoops](https://filp.github.io/whoops) but with a modern design. Reading stack trace of the console slows you down from active development. Instead **Youch** print those errors in structured HTML to the browser.
## Features
1. HTML reporter
2. JSON reporter, if request accepts a json instead of text/html.
3. Sorted frames of error stack.
## Installation
```bash
npm i --save @nuxtjs/youch
```
## Basic Usage
Youch is used by [AdonisJs](http://adonisjs.com) and [Nuxt.js](https://nuxtjs.org), but it can be used by express or raw HTTP server as well.
```javascript
const Youch = require('@nuxtjs/youch')
const http = require('http')
http.createServer(function (req, res) {
// PERFORM SOME ACTION
if (error) {
const youch = new Youch(error, req)
youch
.toHTML()
.then((html) => {
res.writeHead(200, {'content-type': 'text/html'})
res.write(html)
res.end()
})
}
}).listen(8000)
```
## Release History
Checkout [CHANGELOG.md](CHANGELOG.md) file for release history.
## Meta
Checkout [LICENSE.txt](LICENSE.txt) for license information
Harminder Virk (Aman) - [https://github.com/thetutlage](https://github.com/thetutlage)
[appveyor-image]: https://ci.appveyor.com/api/projects/status/github/nuxt/youch?branch=master&svg=true&passingText=Passing%20On%20Windows
[appveyor-url]: https://ci.appveyor.com/project/nuxt/youch
[npm-image]: https://img.shields.io/npm/v/@nuxtjs/youch.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@nuxtjs/youch
[travis-image]: https://img.shields.io/travis/nuxt/youch/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/nuxt/youch
[gitter-url]: https://gitter.im/adonisjs/adonis-framework
[gitter-image]: https://img.shields.io/badge/gitter-join%20us-1DCE73.svg?style=flat-square
[trello-url]: https://trello.com/b/yzpqCgdl/adonis-for-humans
[trello-image]: https://img.shields.io/badge/trello-roadmap-89609E.svg?style=flat-square
[patreon-url]: https://www.patreon.com/adonisframework
[patreon-image]: https://img.shields.io/badge/patreon-support%20AdonisJs-brightgreen.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/@nuxtjs/youch.svg?style=flat-square
+21
View File
@@ -0,0 +1,21 @@
environment:
matrix:
- nodejs_version: 'Stable'
init:
git config --global core.autocrlf true
install:
- ps: Install-Product node $env:nodejs_version
- npm install
test_script:
- node --version
- npm --version
- npm run test:win
build: off
clone_depth: 1
matrix:
fast_finish: true
+40
View File
@@ -0,0 +1,40 @@
'use strict'
const http = require('http')
const Youch = require('../src/Youch')
class HttpException extends Error {
constructor (...args) {
super(...args)
this.name = this.constructor.name
}
}
function foo () {
const error = new HttpException('Some weird error')
error.status = 503
throw error
}
http.createServer((req, res) => {
let youch = null
try {
foo()
} catch (e) {
youch = new Youch(e, req)
}
youch
.toHTML()
.then((response) => {
res.writeHead(200, {'content-type': 'text/html'})
res.write(response)
res.end()
}).catch((error) => {
res.writeHead(500)
res.write(error.message)
res.end()
})
}).listen(8000, () => {
console.log('listening to port 8000')
})
+118
View File
@@ -0,0 +1,118 @@
0.3.1 / 2016-05-26
==================
* Fix `sameSite: true` to work with draft-7 clients
- `true` now sends `SameSite=Strict` instead of `SameSite`
0.3.0 / 2016-05-26
==================
* Add `sameSite` option
- Replaces `firstPartyOnly` option, never implemented by browsers
* Improve error message when `encode` is not a function
* Improve error message when `expires` is not a `Date`
0.2.4 / 2016-05-20
==================
* perf: enable strict mode
* perf: use for loop in parse
* perf: use string concatination for serialization
0.2.3 / 2015-10-25
==================
* Fix cookie `Max-Age` to never be a floating point number
0.2.2 / 2015-09-17
==================
* Fix regression when setting empty cookie value
- Ease the new restriction, which is just basic header-level validation
* Fix typo in invalid value errors
0.2.1 / 2015-09-17
==================
* Throw on invalid values provided to `serialize`
- Ensures the resulting string is a valid HTTP header value
0.2.0 / 2015-08-13
==================
* Add `firstPartyOnly` option
* Throw better error for invalid argument to parse
* perf: hoist regular expression
0.1.5 / 2015-09-17
==================
* Fix regression when setting empty cookie value
- Ease the new restriction, which is just basic header-level validation
* Fix typo in invalid value errors
0.1.4 / 2015-09-17
==================
* Throw better error for invalid argument to parse
* Throw on invalid values provided to `serialize`
- Ensures the resulting string is a valid HTTP header value
0.1.3 / 2015-05-19
==================
* Reduce the scope of try-catch deopt
* Remove argument reassignments
0.1.2 / 2014-04-16
==================
* Remove unnecessary files from npm package
0.1.1 / 2014-02-23
==================
* Fix bad parse when cookie value contained a comma
* Fix support for `maxAge` of `0`
0.1.0 / 2013-05-01
==================
* Add `decode` option
* Add `encode` option
0.0.6 / 2013-04-08
==================
* Ignore cookie parts missing `=`
0.0.5 / 2012-10-29
==================
* Return raw cookie value if value unescape errors
0.0.4 / 2012-06-21
==================
* Use encode/decodeURIComponent for cookie encoding/decoding
- Improve server/client interoperability
0.0.3 / 2012-06-06
==================
* Only escape special characters per the cookie RFC
0.0.2 / 2012-06-01
==================
* Fix `maxAge` option to not throw error
0.0.1 / 2012-05-28
==================
* Add more tests
0.0.0 / 2012-05-28
==================
* Initial release
+24
View File
@@ -0,0 +1,24 @@
(The MIT License)
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.com>
Copyright (c) 2015 Douglas Christopher Wilson <doug@somethingdoug.com>
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.
+220
View File
@@ -0,0 +1,220 @@
# cookie
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-version-image]][node-version-url]
[![Build Status][travis-image]][travis-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Basic HTTP cookie parser and serializer for HTTP servers.
## Installation
```sh
$ npm install cookie
```
## API
```js
var cookie = require('cookie');
```
### cookie.parse(str, options)
Parse an HTTP `Cookie` header string and returning an object of all cookie name-value pairs.
The `str` argument is the string representing a `Cookie` header value and `options` is an
optional object containing additional parsing options.
```js
var cookies = cookie.parse('foo=bar; equation=E%3Dmc%5E2');
// { foo: 'bar', equation: 'E=mc^2' }
```
#### Options
`cookie.parse` accepts these properties in the options object.
##### decode
Specifies a function that will be used to decode a cookie's value. Since the value of a cookie
has a limited character set (and must be a simple string), this function can be used to decode
a previously-encoded cookie value into a JavaScript string or other object.
The default function is the global `decodeURIComponent`, which will decode any URL-encoded
sequences into their byte representations.
**note** if an error is thrown from this function, the original, non-decoded cookie value will
be returned as the cookie's value.
### cookie.serialize(name, value, options)
Serialize a cookie name-value pair into a `Set-Cookie` header string. The `name` argument is the
name for the cookie, the `value` argument is the value to set the cookie to, and the `options`
argument is an optional object containing additional serialization options.
```js
var setCookie = cookie.serialize('foo', 'bar');
// foo=bar
```
#### Options
`cookie.serialize` accepts these properties in the options object.
##### domain
Specifies the value for the [`Domain` `Set-Cookie` attribute][rfc-6266-5.2.3]. By default, no
domain is set, and most clients will consider the cookie to apply to only the current domain.
##### encode
Specifies a function that will be used to encode a cookie's value. Since value of a cookie
has a limited character set (and must be a simple string), this function can be used to encode
a value into a string suited for a cookie's value.
The default function is the global `ecodeURIComponent`, which will encode a JavaScript string
into UTF-8 byte sequences and then URL-encode any that fall outside of the cookie range.
##### expires
Specifies the `Date` object to be the value for the [`Expires` `Set-Cookie` attribute][rfc-6266-5.2.1].
By default, no expiration is set, and most clients will consider this a "non-persistent cookie" and
will delete it on a condition like exiting a web browser application.
**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and
`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this,
so if both are set, they should point to the same date and time.
##### httpOnly
Specifies the `boolean` value for the [`HttpOnly` `Set-Cookie` attribute][rfc-6266-5.2.6]. When truthy,
the `HttpOnly` attribute is set, otherwise it is not. By default, the `HttpOnly` attribute is not set.
**note** be careful when setting this to `true`, as compliant clients will not allow client-side
JavaScript to see the cookie in `document.cookie`.
##### maxAge
Specifies the `number` (in seconds) to be the value for the [`Max-Age` `Set-Cookie` attribute][rfc-6266-5.2.2].
The given number will be converted to an integer by rounding down. By default, no maximum age is set.
**note** the [cookie storage model specification][rfc-6266-5.3] states that if both `expires` and
`magAge` are set, then `maxAge` takes precedence, but it is possiblke not all clients by obey this,
so if both are set, they should point to the same date and time.
##### path
Specifies the value for the [`Path` `Set-Cookie` attribute][rfc-6266-5.2.4]. By default, the path
is considered the ["default path"][rfc-6266-5.1.4]. By default, no maximum age is set, and most
clients will consider this a "non-persistent cookie" and will delete it on a condition like exiting
a web browser application.
##### sameSite
Specifies the `boolean` or `string` to be the value for the [`SameSite` `Set-Cookie` attribute][draft-west-first-party-cookies-07].
- `true` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
- `false` will not set the `SameSite` attribute.
- `'lax'` will set the `SameSite` attribute to `Lax` for lax same site enforcement.
- `'strict'` will set the `SameSite` attribute to `Strict` for strict same site enforcement.
More information about the different enforcement levels can be found in the specification
https://tools.ietf.org/html/draft-west-first-party-cookies-07#section-4.1.1
**note** This is an attribute that has not yet been fully standardized, and may change in the future.
This also means many clients may ignore this attribute until they understand it.
##### secure
Specifies the `boolean` value for the [`Secure` `Set-Cookie` attribute][rfc-6266-5.2.5]. When truthy,
the `Secure` attribute is set, otherwise it is not. By default, the `Secure` attribute is not set.
**note** be careful when setting this to `true`, as compliant clients will not send the cookie back to
the server in the future if the browser does not have an HTTPS connection.
## Example
The following example uses this module in conjunction with the Node.js core HTTP server
to prompt a user for their name and display it back on future visits.
```js
var cookie = require('cookie');
var escapeHtml = require('escape-html');
var http = require('http');
var url = require('url');
function onRequest(req, res) {
// Parse the query string
var query = url.parse(req.url, true, true).query;
if (query && query.name) {
// Set a new cookie with the name
res.setHeader('Set-Cookie', cookie.serialize('name', String(query.name), {
httpOnly: true,
maxAge: 60 * 60 * 24 * 7 // 1 week
}));
// Redirect back after setting cookie
res.statusCode = 302;
res.setHeader('Location', req.headers.referer || '/');
res.end();
return;
}
// Parse the cookies on the request
var cookies = cookie.parse(req.headers.cookie || '');
// Get the visitor name set in the cookie
var name = cookies.name;
res.setHeader('Content-Type', 'text/html; charset=UTF-8');
if (name) {
res.write('<p>Welcome back, <b>' + escapeHtml(name) + '</b>!</p>');
} else {
res.write('<p>Hello, new visitor!</p>');
}
res.write('<form method="GET">');
res.write('<input placeholder="enter your name" name="name"> <input type="submit" value="Set Name">');
res.end('</form');
}
http.createServer(onRequest).listen(3000);
```
## Testing
```sh
$ npm test
```
## References
- [RFC 6266: HTTP State Management Mechanism][rfc-6266]
- [Same-site Cookies][draft-west-first-party-cookies-07]
[draft-west-first-party-cookies-07]: https://tools.ietf.org/html/draft-west-first-party-cookies-07
[rfc-6266]: https://tools.ietf.org/html/rfc6266
[rfc-6266-5.1.4]: https://tools.ietf.org/html/rfc6266#section-5.1.4
[rfc-6266-5.2.1]: https://tools.ietf.org/html/rfc6266#section-5.2.1
[rfc-6266-5.2.2]: https://tools.ietf.org/html/rfc6266#section-5.2.2
[rfc-6266-5.2.3]: https://tools.ietf.org/html/rfc6266#section-5.2.3
[rfc-6266-5.2.4]: https://tools.ietf.org/html/rfc6266#section-5.2.4
[rfc-6266-5.3]: https://tools.ietf.org/html/rfc6266#section-5.3
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/cookie.svg
[npm-url]: https://npmjs.org/package/cookie
[node-version-image]: https://img.shields.io/node/v/cookie.svg
[node-version-url]: https://nodejs.org/en/download
[travis-image]: https://img.shields.io/travis/jshttp/cookie/master.svg
[travis-url]: https://travis-ci.org/jshttp/cookie
[coveralls-image]: https://img.shields.io/coveralls/jshttp/cookie/master.svg
[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
[downloads-image]: https://img.shields.io/npm/dm/cookie.svg
[downloads-url]: https://npmjs.org/package/cookie
+195
View File
@@ -0,0 +1,195 @@
/*!
* cookie
* Copyright(c) 2012-2014 Roman Shtylman
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
'use strict';
/**
* Module exports.
* @public
*/
exports.parse = parse;
exports.serialize = serialize;
/**
* Module variables.
* @private
*/
var decode = decodeURIComponent;
var encode = encodeURIComponent;
var pairSplitRegExp = /; */;
/**
* RegExp to match field-content in RFC 7230 sec 3.2
*
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
* field-vchar = VCHAR / obs-text
* obs-text = %x80-FF
*/
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
/**
* Parse a cookie header.
*
* Parse the given cookie header string into an object
* The object has the various cookies as keys(names) => values
*
* @param {string} str
* @param {object} [options]
* @return {object}
* @public
*/
function parse(str, options) {
if (typeof str !== 'string') {
throw new TypeError('argument str must be a string');
}
var obj = {}
var opt = options || {};
var pairs = str.split(pairSplitRegExp);
var dec = opt.decode || decode;
for (var i = 0; i < pairs.length; i++) {
var pair = pairs[i];
var eq_idx = pair.indexOf('=');
// skip things that don't look like key=value
if (eq_idx < 0) {
continue;
}
var key = pair.substr(0, eq_idx).trim()
var val = pair.substr(++eq_idx, pair.length).trim();
// quoted values
if ('"' == val[0]) {
val = val.slice(1, -1);
}
// only assign once
if (undefined == obj[key]) {
obj[key] = tryDecode(val, dec);
}
}
return obj;
}
/**
* Serialize data into a cookie header.
*
* Serialize the a name value pair into a cookie string suitable for
* http headers. An optional options object specified cookie parameters.
*
* serialize('foo', 'bar', { httpOnly: true })
* => "foo=bar; httpOnly"
*
* @param {string} name
* @param {string} val
* @param {object} [options]
* @return {string}
* @public
*/
function serialize(name, val, options) {
var opt = options || {};
var enc = opt.encode || encode;
if (typeof enc !== 'function') {
throw new TypeError('option encode is invalid');
}
if (!fieldContentRegExp.test(name)) {
throw new TypeError('argument name is invalid');
}
var value = enc(val);
if (value && !fieldContentRegExp.test(value)) {
throw new TypeError('argument val is invalid');
}
var str = name + '=' + value;
if (null != opt.maxAge) {
var maxAge = opt.maxAge - 0;
if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
str += '; Max-Age=' + Math.floor(maxAge);
}
if (opt.domain) {
if (!fieldContentRegExp.test(opt.domain)) {
throw new TypeError('option domain is invalid');
}
str += '; Domain=' + opt.domain;
}
if (opt.path) {
if (!fieldContentRegExp.test(opt.path)) {
throw new TypeError('option path is invalid');
}
str += '; Path=' + opt.path;
}
if (opt.expires) {
if (typeof opt.expires.toUTCString !== 'function') {
throw new TypeError('option expires is invalid');
}
str += '; Expires=' + opt.expires.toUTCString();
}
if (opt.httpOnly) {
str += '; HttpOnly';
}
if (opt.secure) {
str += '; Secure';
}
if (opt.sameSite) {
var sameSite = typeof opt.sameSite === 'string'
? opt.sameSite.toLowerCase() : opt.sameSite;
switch (sameSite) {
case true:
str += '; SameSite=Strict';
break;
case 'lax':
str += '; SameSite=Lax';
break;
case 'strict':
str += '; SameSite=Strict';
break;
default:
throw new TypeError('option sameSite is invalid');
}
}
return str;
}
/**
* Try decoding a string using a decoding function.
*
* @param {string} str
* @param {function} decode
* @private
*/
function tryDecode(str, decode) {
try {
return decode(str);
} catch (e) {
return str;
}
}
+74
View File
@@ -0,0 +1,74 @@
{
"_args": [
[
"cookie@0.3.1",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_from": "cookie@0.3.1",
"_id": "cookie@0.3.1",
"_inBundle": false,
"_integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=",
"_location": "/@nuxtjs/youch/cookie",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "cookie@0.3.1",
"name": "cookie",
"escapedName": "cookie",
"rawSpec": "0.3.1",
"saveSpec": null,
"fetchSpec": "0.3.1"
},
"_requiredBy": [
"/@nuxtjs/youch"
],
"_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"_spec": "0.3.1",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"author": {
"name": "Roman Shtylman",
"email": "shtylman@gmail.com"
},
"bugs": {
"url": "https://github.com/jshttp/cookie/issues"
},
"contributors": [
{
"name": "Douglas Christopher Wilson",
"email": "doug@somethingdoug.com"
}
],
"description": "HTTP server cookie parsing and serialization",
"devDependencies": {
"istanbul": "0.4.3",
"mocha": "1.21.5"
},
"engines": {
"node": ">= 0.6"
},
"files": [
"HISTORY.md",
"LICENSE",
"README.md",
"index.js"
],
"homepage": "https://github.com/jshttp/cookie#readme",
"keywords": [
"cookie",
"cookies"
],
"license": "MIT",
"name": "cookie",
"repository": {
"type": "git",
"url": "git+https://github.com/jshttp/cookie.git"
},
"scripts": {
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
},
"version": "0.3.1"
}
+80
View File
@@ -0,0 +1,80 @@
{
"_args": [
[
"@nuxtjs/youch@4.2.3",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
]
],
"_from": "@nuxtjs/youch@4.2.3",
"_id": "@nuxtjs/youch@4.2.3",
"_inBundle": false,
"_integrity": "sha512-XiTWdadTwtmL/IGkNqbVe+dOlT+IMvcBu7TvKI7plWhVQeBCQ9iKhk3jgvVWFyiwL2yHJDlEwOM5v9oVES5Xmw==",
"_location": "/@nuxtjs/youch",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@nuxtjs/youch@4.2.3",
"name": "@nuxtjs/youch",
"escapedName": "@nuxtjs%2fyouch",
"scope": "@nuxtjs",
"rawSpec": "4.2.3",
"saveSpec": null,
"fetchSpec": "4.2.3"
},
"_requiredBy": [
"/@nuxt/server"
],
"_resolved": "https://registry.npmjs.org/@nuxtjs/youch/-/youch-4.2.3.tgz",
"_spec": "4.2.3",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"author": {
"name": "amanvirk"
},
"bugs": {
"url": "https://github.com/poppinss/nuxt/issues"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
},
"dependencies": {
"cookie": "^0.3.1",
"mustache": "^2.3.0",
"stack-trace": "0.0.10"
},
"description": "Pretty error reporting for Node.js 🚀 (Modified for Nuxt.js & SSR Bundles)",
"devDependencies": {
"cz-conventional-changelog": "^2.0.0",
"japa": "^1.0.3",
"japa-cli": "^1.0.1",
"standard": "^10.0.2",
"supertest": "^3.0.0"
},
"directories": {
"example": "examples"
},
"homepage": "https://github.com/poppinss/nuxt#readme",
"keywords": [
"errors",
"error-reporting",
"whoops"
],
"license": "MIT",
"main": "src/Youch/index.js",
"name": "@nuxtjs/youch",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/nuxt/youch.git"
},
"scripts": {
"lint": "standard",
"test": "japa",
"test:win": "node ./node_modules/japa-cli/index.js"
},
"version": "4.2.3"
}
+349
View File
@@ -0,0 +1,349 @@
'use strict'
/*
* youch
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const Mustache = require('mustache')
const path = require('path')
const stackTrace = require('stack-trace')
const fs = require('fs')
const cookie = require('cookie')
const VIEW_PATH = '../resources/error.mustache'
const startingSlashRegex = /\\|\//
const viewTemplate = fs.readFileSync(path.join(__dirname, VIEW_PATH), 'utf-8')
class Youch {
constructor (error, request, readSource, baseURL, addCol) {
this.error = error
this.request = request
this.readSource = typeof readSource === 'function' ? readSource : this._readSource
this.baseURL = baseURL || '/'
this.addCol = addCol === undefined ? true : Boolean(addCol)
this.codeContext = 5
this._filterHeaders = ['cookie', 'connection']
this._filterFrames = [
/regenerator-runtime/,
/babel-runtime/,
/core-js\/library/
]
}
/**
* Reads the source code for a given frame into frame.contents
*
* @param {String} path
* @return {Promise}
*/
_readSource (frame) {
return new Promise((resolve, reject) => {
if(!frame.fileName) {
return resolve()
}
fs.readFile(frame.fileName, 'utf-8', (error, contents) => {
if (!error && contents) {
frame.contents = contents
}
resolve()
})
})
}
/**
* Returns source code for a given frame.
*
* @param {Object} frame
* @return {Promise}
*/
_getFrameSource (frame) {
return this.readSource(frame).then(()=> {
if (!frame.contents) {
return
}
const lines = frame.contents.split(/\r?\n/)
const lineNumber = frame.getLineNumber()
return {
pre: lines.slice(Math.max(0, lineNumber - (this.codeContext + 1)), lineNumber - 1),
line: lines[lineNumber - 1],
post: lines.slice(lineNumber, lineNumber + this.codeContext)
}
})
}
/**
* Parses the error stack and returns serialized
* frames out of it.
*
* @return {Object}
*/
_parseError () {
const stack = stackTrace.parse(this.error)
return Promise.all(stack.map((frame) => {
if (this._isNode(frame)) {
return Promise.resolve(frame)
}
return this._getFrameSource(frame).then((context) => {
frame.context = context
return frame
})
}))
.then(stack => stack.filter(this._isVisible.bind(this)))
.then(stack => {
let hasInternal = false
for (let frame of stack) {
if (!this._isApp(frame) && !this._isNode(frame)) {
hasInternal = true
break
}
}
return {stack, hasInternal}
})
}
/**
* Returns the context with code for a given
* frame.
*
* @param {Object}
* @return {Object}
*/
_getContext (frame) {
if (!frame.context) {
return {}
}
return {
start: frame.getLineNumber() - (frame.context.pre || []).length,
pre: frame.context.pre.join('\n'),
line: frame.context.line,
post: frame.context.post.join('\n'),
}
}
/**
* Returns classes to be used inside HTML when
* displaying the frames list.
*
* @param {Object}
* @param {Number}
*
* @return {String}
*/
_getDisplayClasses (frame, index) {
const classes = []
if (index === 0) {
classes.push('active')
}
if (!this._isApp(frame)) {
classes.push('native-frame')
}
return classes.join(' ')
}
/**
* Compiles the view using HTML
*
* @param {String}
* @param {Object}
*
* @return {String}
*/
_compileView (view, data) {
return Mustache.render(view, data)
}
/**
* Serializes frame to a usable error object.
*
* @param {Object}
*
* @return {Object}
*/
_serializeFrame (frame) {
const relativeFileName = frame.getFileName().indexOf(process.cwd()) > -1
? frame.getFileName().replace(process.cwd(), '').replace(startingSlashRegex, '')
: frame.getFileName()
return {
file: relativeFileName,
method: frame.getFunctionName(),
line: frame.getLineNumber(),
column: frame.getColumnNumber(),
context: this._getContext(frame),
lang: this._getLang(frame),
open: this._openURL(frame)
}
}
_openURL(frame) {
if (!frame.fullPath) {
return
}
return this.baseURL + '__open-in-editor' +
'?file=' + encodeURI(frame.fullPath || frame.fileName) +
':' + (frame.getLineNumber() || 0) +
(this.addCol ? (':' + (frame.getColumnNumber() || 0)) : '')
}
/**
* Returns whether frame belongs to nodejs
* or not.
*
* @return {Boolean} [description]
*/
_isNode (frame) {
if (frame.isNative()) {
return true
}
// const filename = frame.getFileName() || ''
// return !path.isAbsolute(filename) && filename[0] !== '.'
return false
}
/**
* Returns whether code belongs to the app
* or not.
*
* @return {Boolean} [description]
*/
_isApp (frame) {
if (this._isNode(frame)) {
return false
}
return !~(frame.getFileName() || '').indexOf('node_modules' + path.sep)
}
/**
* Returns whether frame should be visible
* or not.
*
* @return {Boolean} [description]
*/
_isVisible (frame) {
return this._filterFrames.every(f => !f.test(frame.getFileName()))
}
_getLang(frame) {
let name = frame.getFileName() || ''
let lang = 'js'
if(name.indexOf('.vue') !== -1) {
lang = 'html'
}
return lang
}
/**
* Serializes stack to Mustache friendly object to
* be used within the view. Optionally can pass
* a callback to customize the frames output.
*
* @param {Object}
* @param {Function} [callback]
*
* @return {Object}
*/
_serializeData (stack, callback) {
callback = callback || this._serializeFrame.bind(this)
return {
message: this.error.message,
name: this.error.name,
status: this.error.status,
frames: stack instanceof Array === true ? stack.filter((frame) => frame.getFileName()).map(callback) : []
}
}
/**
* Returns a serialized object with important
* information.
*
* @return {Object}
*/
_serializeRequest () {
const headers = []
Object.keys(this.request.headers).forEach((key) => {
if (this._filterHeaders.indexOf(key) > -1) {
return
}
headers.push({
key: key.toUpperCase(),
value: this.request.headers[key]
})
})
const parsedCookies = cookie.parse(this.request.headers.cookie || '')
const cookies = Object.keys(parsedCookies).map((key) => {
return {key, value: parsedCookies[key]}
})
return {
url: this.request.url,
httpVersion: this.request.httpVersion,
method: this.request.method,
connection: this.request.headers.connection,
headers: headers,
cookies: cookies
}
}
/**
* Returns error stack as JSON.
*
* @return {Promise}
*/
toJSON () {
return new Promise((resolve, reject) => {
this
._parseError()
.then(({ stack, hasInternal }) => {
resolve({
error: this._serializeData(stack),
hasInternal
})
})
.catch(reject)
})
}
/**
* Returns HTML representation of the error stack
* by parsing the stack into frames and getting
* important info out of it.
*
* @return {Promise}
*/
toHTML () {
return new Promise((resolve, reject) => {
this
._parseError()
.then(({ stack, hasInternal }) => {
const data = this._serializeData(stack, (frame, index) => {
const serializedFrame = this._serializeFrame(frame)
serializedFrame.classes = this._getDisplayClasses(frame, index)
return serializedFrame
})
const request = this._serializeRequest()
data.request = request
data.hasInternal = hasInternal
resolve(this._compileView(viewTemplate, data))
})
.catch(reject)
})
}
}
module.exports = Youch
File diff suppressed because one or more lines are too long
+1359
View File
File diff suppressed because it is too large Load Diff