├── .gitignore ├── README.md ├── index.js ├── node_modules ├── lodash.camelcase │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json └── lodash.upperfirst │ ├── LICENSE │ ├── README.md │ ├── index.js │ └── package.json ├── package-lock.json ├── package.json └── src ├── factory ├── NavigationStructFactory.js ├── RouterFactory.js └── StoreFactory.js └── map ├── ComponentsMap.js ├── FeaturesMap.js └── ModulesMap.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Descontinuado !!! 2 | ## Vue Discover 3 | **Vue Discover** é um plugin para [VueJS](https://vuejs.org/) que propõem agilizar o desenvolvimento de completas aplicações com Vue. 4 | 5 | Vue Discover descobre/mapeia através de uma estrutura pré definida de diretórios `\Features` e `\Modules`, recursos fundamentais da aplicação: `routes`, `vuex` e `components` (de forma global). Descartando a necessidade de importar componentes próprios em sua aplicação. 6 | 7 | Vue Discover provê um array com a estrutura de menu de até dois níveis, podendo ser extendida para 3 níveis ao usar o `navigation group`, este array pode ser invocado em qualquer `vue component`, apenas chamando: `this.$_nav`. 8 | ##### Estrutura de Diretórios 9 | Vue discover exige a seguinte estrutura de Diretórios: 10 | ```shell 11 | .src/ 12 | ├── Features 13 | │   └── Feature1 14 | │   │   ├── index.js 15 | │   │   └── store 16 | │   │   ├── actions.feature.js 17 | │   │   ├── mutations.feature.js 18 | │   │   ├── getters.feature.js 19 | │   │   └── state.feature.js 20 | │ └── ... 21 | │ 22 | ├── Modules 23 | │ ├── module1.vue 24 | │ ├── module2.vue 25 | │ ├── module3.vue 26 | │   └── ... 27 | ├── router 28 | │   └── index.js 29 | └── store 30 |    └── index.js 31 | ``` 32 | >'Feature1' é apenas um nome fictício, você é livre para nomear suas features. 33 | 34 | #### Components 35 | Vue discover mapeia todos os arquivos vue exitentes no diretório `\components`, e os registra globalmente. Permitindo chamá-los baseado em seu atributo `name` 36 | ###### src\components\mybutton.vue 37 | ```vue 38 | 41 | 46 | ``` 47 | Assim você poderá chamar `` em qualquer outro componente vue. 48 | #### Modules 49 | Os módulos são os arquivos base da aplicação. Eles são simplesmente arquivos vue, ou seja `components` que serão renderizados em determinada rota. 50 | Um `componente módulo` deve obrigatóriamente possuir o atributo `signature` de valor único, pois **signature** servirá como identificador do módulo. 51 | #### Features 52 | Uma feature reunirá os módulos de acordo com o contexto desejado. Toda feature pode possuir uma store (`vuex`) representada pelo diretório `\store` com as opções de `actions`, `mutations`, `getters` e/ou `state`, representados como arquivos únicos, acompanhados do pós-fixo 'feature.js'. 53 | ### Instalação 54 | ``` 55 | npm i -S vue-discover 56 | ``` 57 | ### Uso 58 | ```es6 59 | import Vue from 'vue' 60 | import discover from 'vue-discover' 61 | Vue.use(discover) 62 | ``` 63 | 64 | ##### Opções 65 | Vue discover pode receber alguns parâmetros, como `navigation.group` já dito anteriormente, e`routes.joinTo`. 66 | 67 | |objeto|type|valor|descrição| 68 | |-----|----|----|---| 69 | |`routes.joinTo`|string|Recebe como valor o nome de uma rota já existente no arquivo `routes\index.js`.|Injeta todas as rotas construídas pelo Vue Discover no atributo `children` da rota nomeada.| 70 | |`navigation.group`|array| Recebe um array de grupos.|Adiciona grupos que podem relacionar diferentes features. Os únicos parâmetros obrigatórios são: `name` e `label`, embora você possa adicionar quaisquer outros atributos, pois todos estarão visíveis no [prototype](https://br.vuejs.org/v2/cookbook/adding-instance-properties.html) `$_nav`| 71 | 72 | Exemplo de uso com os parâmetros descritos a cima (consideremos a existência de uma rota de `name: 'my.app'` 73 | 74 | ```es6 75 | Vue.use( discover, { 76 | routes: { joinTo: 'my.app' }, 77 | navigation: { 78 | groups: [ 79 | { label: 'Group 01', name: 'group1', icon: 'icon' } 80 | ] 81 | } 82 | }) 83 | ``` 84 | 85 | ### Tutorial 86 | Exemplificaremos com um simples TODO LIST. Você pode acessar [O Repositório Exemplo](https://github.com/lucca-cardial/vue-discover-example) 87 | ###### src\main.js 88 | ```es6 89 | import Vue from 'vue' 90 | import App from './App' 91 | import router from './router' 92 | import store from './store' 93 | import discover from '.vue-discover' 94 | 95 | Vue.use( 96 | discover, { 97 | routes: { joinTo: 'my.app' }, 98 | navigation: { 99 | groups: [ 100 | { label: 'Group 01', name: 'group1', icon: 'icon' } 101 | ] 102 | } 103 | }) 104 | 105 | Vue.config.productionTip = false 106 | /* eslint-disable */ 107 | new Vue({ 108 | el: '#app', 109 | router, 110 | store, 111 | components: { App }, 112 | template: '' 113 | }) 114 | 115 | ``` 116 | ###### src\store\index.js 117 | ```es6 118 | import Vue from 'vue' 119 | import Vuex from 'vuex' 120 | Vue.use(Vuex) 121 | export default new Vuex.Store({}) 122 | 123 | ``` 124 | ###### src\router\index.js 125 | ```es6 126 | import Vue from 'vue' 127 | import Router from 'vue-router' 128 | import layout from '@/views/layouts/base' 129 | 130 | Vue.use(Router) 131 | 132 | export default new Router({ 133 | routes: [ 134 | { 135 | path: '/app', 136 | name: 'my.app', 137 | component: layout 138 | } 139 | ] 140 | }) 141 | ``` 142 | ###### src\views\layouts\base.vue 143 | ```vue 144 | 151 | 159 | ``` 160 | ###### src\components\my-nav.vue 161 | ```vue 162 | 181 | 182 | 187 | ``` 188 | > Note que o v-for recebe o atributo `$_nav` para interação. Como já dito, `$_nav` é provido globalmente. 189 | ##### Criando os módulos 190 | ###### src\Modules\TodoListShow.vue 191 | ```vue 192 | 203 | 204 | 220 | 221 | ``` 222 | 223 | ###### src\Features\Modules\TodoListForm.vue 224 | ```vue 225 | 234 | 235 | 254 | ``` 255 | 256 | > Nota [Estado Centralizado]: 257 | Perceba que em ambos componentes importam funcionalidades do vuex (`mapActions, mapGetters`), e chamam funções pelo namespace `Feature1` em `...mapActions('Feature1', ['addTodo']),` e `...mapGetters('Feature1', ['todoList'])`. O Vue Discover fabrica e injeta os `states` de cada feature diretamente na instância do `Vuex`, nomeando-os pelo namespace de sua Feature. Basicamente, para cada Feature existente, o Vue Discover fabrica os módulos do Vuex assinando a propriedade `namespaced` como `true`. Você não precisa saber como o Vue Discover manipula este dados, mas caso queira saber a respeito, leia a [Documentação](https://vuex.vuejs.org/guide/modules.html) do Vuex para estados modulares. 258 | 259 | > Nota [Rotas]: O botão `Novo` passa no parâmetro `to` o `name` da rota que desejamos navegar. O `name` de cada rota, como dito anteriormente, refere-se à propriedade `signature` de cada `módulo`. O próximo tópico exemplificará melhor as gerações de `routes e states`. 260 | ##### Criando uma Feature 261 | Feature1 262 | > "Feature1" é apenas um nome para exemplo, você é livre para nomear suas features. 263 | 264 | Configuração da store da Feature 265 | ###### src\Features\Feature1\store\actions.feature.js 266 | ```es6 267 | const addTodo = ({commit}, data) => { 268 | commit('ADD_TODO', data) 269 | } 270 | 271 | const deleteTodo = ({commit}, index) => { 272 | commit('DELETE_TODO', index) 273 | } 274 | 275 | export default { 276 | addTodo, 277 | deleteTodo 278 | } 279 | 280 | ``` 281 | ###### src\Features\Feature1\store\mutations.feature.js 282 | ```es6 283 | const ADD_TODO = (state, data) => { 284 | state.todoList.push(data) 285 | } 286 | 287 | const DELETE_TODO = (state, index) => { 288 | state.todoList.splice(index, 1) 289 | } 290 | 291 | export default { 292 | ADD_TODO, 293 | DELETE_TODO 294 | } 295 | ``` 296 | ###### src\Features\Feature1\store\getters.feature.js 297 | ```es6 298 | const todoList = (state) => { 299 | return state.todoList 300 | } 301 | 302 | export default { 303 | todoList 304 | } 305 | ``` 306 | ###### src\Features\Feature1\store\state.feature.js 307 | ```es6 308 | export default { 309 | todoList: [] 310 | } 311 | ``` 312 | Configuração do `index.js` 313 | ###### src\Features\Feature1\index.js 314 | ```es6 315 | const modules = [ 316 | { 317 | name: 'app.modules.todolist.show', 318 | router: { 319 | path: 'todolist', 320 | component: '$name' 321 | }, 322 | nav: { 323 | label: 'Todo List' 324 | } 325 | }, 326 | { 327 | name: 'app.modules.todolist.form', 328 | router: { 329 | path: 'createtodolist', 330 | component: '$name' 331 | }, 332 | nav: { 333 | label: 'Create Todo List' 334 | } 335 | } 336 | ] 337 | export default { 338 | name: 'app.features.feature1', 339 | modules: modules, 340 | router: { 341 | path: '/feature1' 342 | }, 343 | nav: { 344 | label: 'Feature1', 345 | group: 'group1' 346 | } 347 | } 348 | 349 | ``` 350 | ##### Propriedades do index.js 351 | |Nome|Descrição| 352 | |----|---------| 353 | |name|Valor único, pode ser usado na navegação de rotas no parâmetro `:to={name:'nome.sua.feature'}`| 354 | |modules| Recebe um objeto de modules descrito abaixo| 355 | ###### Objeto modules 356 | O objeto modules contém um array de module: 357 | 358 | |Nome|Descrição| 359 | |----|---------| 360 | |name|Pode Rreferer-se à propriedade `signature` criada no `vue component` no diretório `\Modules`, porém você é livre para escoher o melhor `name` que preferir. Caso escolha o nome do module, fique atento ao erro de _rotas com nome duplicados_. Pode ser usado na navegação de rotas no parâmetro `:to={name:'nome.seu.modulo'}`| 361 | |router.path| rota do módulo, lembrando que as rotas de módulos serão filhas da feature, logo para o `component.router.path = '/my-component'`, será acessível pela rota: `my-feature-name/my-component` 362 | |router.component|Recebe um vue component qualquer. Você é livre para importar o seu componente e associá-lo aqui, embora o sugerimos que siga o padrão de criação de módulos descrito anteriormente. Dessa forma, o valor deste atributo poderá ser a `signature` do módulo criado. **BÔNUS**: Caso o atributo `name` do objeto module seja o valor da `signature` do module, e você queira o mesmo valor para este atributo, poderá atribuí-lo o valor `'$name'`. 363 | ###### Objeto router 364 | Objeto para criação das rotas na fábrica de rotas do Vue Discover, ele pode receber absolutamente todos os parâmetros do padrão de rotas do [Vue Router](https://router.vuejs.org/) 365 | 366 | |Nome|Descrição| 367 | |----|---------| 368 | |router.path|rota da feature| 369 | |router.component|Recebe um component vue, caso este atributo seja omitido, a Fábrica do Vue Discover injetará um componente anêmico, apenas para prover um slot do `` para renderização de rotas filhas da Feature.| 370 | 371 | Vue discover fabrica e injeta na instância do Vue as rotas e os estados (`vuex`) mapeados do diretório `Feature`. 372 | #### Acessando os módulos 373 | ![Alt Text](https://github.com/lucca-cardial/common-logos/raw/master/gif-1.gif) 374 | #### Registrando TODOs 375 | ![Alt Text](https://github.com/lucca-cardial/common-logos/raw/master/gif-2.gif) 376 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | import features from './src/map/FeaturesMap' 3 | import modules from './src/map/ModulesMap' 4 | import components from './src/map/ComponentsMap' 5 | import state from './src/factory/StoreFactory' 6 | import router from './src/factory/RouterFactory' 7 | import nav from './src/factory/NavigationStructFactory' 8 | 9 | export default { 10 | components, 11 | install (Vue, options) { 12 | state() 13 | router(features, modules, (options && options.routes) || null) 14 | Vue.prototype.$_nav = nav(features, (options && options.navigation) || []) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors 2 | 3 | Based on Underscore.js, copyright Jeremy Ashkenas, 4 | DocumentCloud and Investigative Reporters & Editors 5 | 6 | This software consists of voluntary contributions made by many 7 | individuals. For exact contribution history, see the revision history 8 | available at https://github.com/lodash/lodash 9 | 10 | The following license applies to all parts of this software except as 11 | documented below: 12 | 13 | ==== 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining 16 | a copy of this software and associated documentation files (the 17 | "Software"), to deal in the Software without restriction, including 18 | without limitation the rights to use, copy, modify, merge, publish, 19 | distribute, sublicense, and/or sell copies of the Software, and to 20 | permit persons to whom the Software is furnished to do so, subject to 21 | the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 30 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 31 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 32 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | 34 | ==== 35 | 36 | Copyright and related rights for sample code are waived via CC0. Sample 37 | code is defined as all source code displayed within the prose of the 38 | documentation. 39 | 40 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 41 | 42 | ==== 43 | 44 | Files located in the node_modules and vendor directories are externally 45 | maintained libraries used by this software which have their own 46 | licenses; we recommend you read them, as their terms may differ from the 47 | terms above. 48 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/README.md: -------------------------------------------------------------------------------- 1 | # lodash.camelcase v4.3.0 2 | 3 | The [lodash](https://lodash.com/) method `_.camelCase` exported as a [Node.js](https://nodejs.org/) module. 4 | 5 | ## Installation 6 | 7 | Using npm: 8 | ```bash 9 | $ {sudo -H} npm i -g npm 10 | $ npm i --save lodash.camelcase 11 | ``` 12 | 13 | In Node.js: 14 | ```js 15 | var camelCase = require('lodash.camelcase'); 16 | ``` 17 | 18 | See the [documentation](https://lodash.com/docs#camelCase) or [package source](https://github.com/lodash/lodash/blob/4.3.0-npm-packages/lodash.camelcase) for more details. 19 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lodash (Custom Build) 3 | * Build: `lodash modularize exports="npm" -o ./` 4 | * Copyright jQuery Foundation and other contributors 5 | * Released under MIT license 6 | * Based on Underscore.js 1.8.3 7 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 8 | */ 9 | 10 | /** Used as references for various `Number` constants. */ 11 | var INFINITY = 1 / 0; 12 | 13 | /** `Object#toString` result references. */ 14 | var symbolTag = '[object Symbol]'; 15 | 16 | /** Used to match words composed of alphanumeric characters. */ 17 | var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; 18 | 19 | /** Used to match Latin Unicode letters (excluding mathematical operators). */ 20 | var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; 21 | 22 | /** Used to compose unicode character classes. */ 23 | var rsAstralRange = '\\ud800-\\udfff', 24 | rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', 25 | rsComboSymbolsRange = '\\u20d0-\\u20f0', 26 | rsDingbatRange = '\\u2700-\\u27bf', 27 | rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', 28 | rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', 29 | rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', 30 | rsPunctuationRange = '\\u2000-\\u206f', 31 | rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', 32 | rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', 33 | rsVarRange = '\\ufe0e\\ufe0f', 34 | rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; 35 | 36 | /** Used to compose unicode capture groups. */ 37 | var rsApos = "['\u2019]", 38 | rsAstral = '[' + rsAstralRange + ']', 39 | rsBreak = '[' + rsBreakRange + ']', 40 | rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', 41 | rsDigits = '\\d+', 42 | rsDingbat = '[' + rsDingbatRange + ']', 43 | rsLower = '[' + rsLowerRange + ']', 44 | rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', 45 | rsFitz = '\\ud83c[\\udffb-\\udfff]', 46 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 47 | rsNonAstral = '[^' + rsAstralRange + ']', 48 | rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 49 | rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 50 | rsUpper = '[' + rsUpperRange + ']', 51 | rsZWJ = '\\u200d'; 52 | 53 | /** Used to compose unicode regexes. */ 54 | var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', 55 | rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', 56 | rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', 57 | rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', 58 | reOptMod = rsModifier + '?', 59 | rsOptVar = '[' + rsVarRange + ']?', 60 | rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 61 | rsSeq = rsOptVar + reOptMod + rsOptJoin, 62 | rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, 63 | rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 64 | 65 | /** Used to match apostrophes. */ 66 | var reApos = RegExp(rsApos, 'g'); 67 | 68 | /** 69 | * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and 70 | * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). 71 | */ 72 | var reComboMark = RegExp(rsCombo, 'g'); 73 | 74 | /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 75 | var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 76 | 77 | /** Used to match complex or compound words. */ 78 | var reUnicodeWord = RegExp([ 79 | rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', 80 | rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', 81 | rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, 82 | rsUpper + '+' + rsOptUpperContr, 83 | rsDigits, 84 | rsEmoji 85 | ].join('|'), 'g'); 86 | 87 | /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ 88 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); 89 | 90 | /** Used to detect strings that need a more robust regexp to match words. */ 91 | var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; 92 | 93 | /** Used to map Latin Unicode letters to basic Latin letters. */ 94 | var deburredLetters = { 95 | // Latin-1 Supplement block. 96 | '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', 97 | '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', 98 | '\xc7': 'C', '\xe7': 'c', 99 | '\xd0': 'D', '\xf0': 'd', 100 | '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', 101 | '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', 102 | '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', 103 | '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', 104 | '\xd1': 'N', '\xf1': 'n', 105 | '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', 106 | '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', 107 | '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', 108 | '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', 109 | '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', 110 | '\xc6': 'Ae', '\xe6': 'ae', 111 | '\xde': 'Th', '\xfe': 'th', 112 | '\xdf': 'ss', 113 | // Latin Extended-A block. 114 | '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', 115 | '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', 116 | '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', 117 | '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', 118 | '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', 119 | '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', 120 | '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', 121 | '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', 122 | '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', 123 | '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', 124 | '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', 125 | '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', 126 | '\u0134': 'J', '\u0135': 'j', 127 | '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', 128 | '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', 129 | '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', 130 | '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', 131 | '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', 132 | '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', 133 | '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', 134 | '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', 135 | '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', 136 | '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', 137 | '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', 138 | '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', 139 | '\u0163': 't', '\u0165': 't', '\u0167': 't', 140 | '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', 141 | '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', 142 | '\u0174': 'W', '\u0175': 'w', 143 | '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', 144 | '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', 145 | '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', 146 | '\u0132': 'IJ', '\u0133': 'ij', 147 | '\u0152': 'Oe', '\u0153': 'oe', 148 | '\u0149': "'n", '\u017f': 'ss' 149 | }; 150 | 151 | /** Detect free variable `global` from Node.js. */ 152 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 153 | 154 | /** Detect free variable `self`. */ 155 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 156 | 157 | /** Used as a reference to the global object. */ 158 | var root = freeGlobal || freeSelf || Function('return this')(); 159 | 160 | /** 161 | * A specialized version of `_.reduce` for arrays without support for 162 | * iteratee shorthands. 163 | * 164 | * @private 165 | * @param {Array} [array] The array to iterate over. 166 | * @param {Function} iteratee The function invoked per iteration. 167 | * @param {*} [accumulator] The initial value. 168 | * @param {boolean} [initAccum] Specify using the first element of `array` as 169 | * the initial value. 170 | * @returns {*} Returns the accumulated value. 171 | */ 172 | function arrayReduce(array, iteratee, accumulator, initAccum) { 173 | var index = -1, 174 | length = array ? array.length : 0; 175 | 176 | if (initAccum && length) { 177 | accumulator = array[++index]; 178 | } 179 | while (++index < length) { 180 | accumulator = iteratee(accumulator, array[index], index, array); 181 | } 182 | return accumulator; 183 | } 184 | 185 | /** 186 | * Converts an ASCII `string` to an array. 187 | * 188 | * @private 189 | * @param {string} string The string to convert. 190 | * @returns {Array} Returns the converted array. 191 | */ 192 | function asciiToArray(string) { 193 | return string.split(''); 194 | } 195 | 196 | /** 197 | * Splits an ASCII `string` into an array of its words. 198 | * 199 | * @private 200 | * @param {string} The string to inspect. 201 | * @returns {Array} Returns the words of `string`. 202 | */ 203 | function asciiWords(string) { 204 | return string.match(reAsciiWord) || []; 205 | } 206 | 207 | /** 208 | * The base implementation of `_.propertyOf` without support for deep paths. 209 | * 210 | * @private 211 | * @param {Object} object The object to query. 212 | * @returns {Function} Returns the new accessor function. 213 | */ 214 | function basePropertyOf(object) { 215 | return function(key) { 216 | return object == null ? undefined : object[key]; 217 | }; 218 | } 219 | 220 | /** 221 | * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A 222 | * letters to basic Latin letters. 223 | * 224 | * @private 225 | * @param {string} letter The matched letter to deburr. 226 | * @returns {string} Returns the deburred letter. 227 | */ 228 | var deburrLetter = basePropertyOf(deburredLetters); 229 | 230 | /** 231 | * Checks if `string` contains Unicode symbols. 232 | * 233 | * @private 234 | * @param {string} string The string to inspect. 235 | * @returns {boolean} Returns `true` if a symbol is found, else `false`. 236 | */ 237 | function hasUnicode(string) { 238 | return reHasUnicode.test(string); 239 | } 240 | 241 | /** 242 | * Checks if `string` contains a word composed of Unicode symbols. 243 | * 244 | * @private 245 | * @param {string} string The string to inspect. 246 | * @returns {boolean} Returns `true` if a word is found, else `false`. 247 | */ 248 | function hasUnicodeWord(string) { 249 | return reHasUnicodeWord.test(string); 250 | } 251 | 252 | /** 253 | * Converts `string` to an array. 254 | * 255 | * @private 256 | * @param {string} string The string to convert. 257 | * @returns {Array} Returns the converted array. 258 | */ 259 | function stringToArray(string) { 260 | return hasUnicode(string) 261 | ? unicodeToArray(string) 262 | : asciiToArray(string); 263 | } 264 | 265 | /** 266 | * Converts a Unicode `string` to an array. 267 | * 268 | * @private 269 | * @param {string} string The string to convert. 270 | * @returns {Array} Returns the converted array. 271 | */ 272 | function unicodeToArray(string) { 273 | return string.match(reUnicode) || []; 274 | } 275 | 276 | /** 277 | * Splits a Unicode `string` into an array of its words. 278 | * 279 | * @private 280 | * @param {string} The string to inspect. 281 | * @returns {Array} Returns the words of `string`. 282 | */ 283 | function unicodeWords(string) { 284 | return string.match(reUnicodeWord) || []; 285 | } 286 | 287 | /** Used for built-in method references. */ 288 | var objectProto = Object.prototype; 289 | 290 | /** 291 | * Used to resolve the 292 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 293 | * of values. 294 | */ 295 | var objectToString = objectProto.toString; 296 | 297 | /** Built-in value references. */ 298 | var Symbol = root.Symbol; 299 | 300 | /** Used to convert symbols to primitives and strings. */ 301 | var symbolProto = Symbol ? Symbol.prototype : undefined, 302 | symbolToString = symbolProto ? symbolProto.toString : undefined; 303 | 304 | /** 305 | * The base implementation of `_.slice` without an iteratee call guard. 306 | * 307 | * @private 308 | * @param {Array} array The array to slice. 309 | * @param {number} [start=0] The start position. 310 | * @param {number} [end=array.length] The end position. 311 | * @returns {Array} Returns the slice of `array`. 312 | */ 313 | function baseSlice(array, start, end) { 314 | var index = -1, 315 | length = array.length; 316 | 317 | if (start < 0) { 318 | start = -start > length ? 0 : (length + start); 319 | } 320 | end = end > length ? length : end; 321 | if (end < 0) { 322 | end += length; 323 | } 324 | length = start > end ? 0 : ((end - start) >>> 0); 325 | start >>>= 0; 326 | 327 | var result = Array(length); 328 | while (++index < length) { 329 | result[index] = array[index + start]; 330 | } 331 | return result; 332 | } 333 | 334 | /** 335 | * The base implementation of `_.toString` which doesn't convert nullish 336 | * values to empty strings. 337 | * 338 | * @private 339 | * @param {*} value The value to process. 340 | * @returns {string} Returns the string. 341 | */ 342 | function baseToString(value) { 343 | // Exit early for strings to avoid a performance hit in some environments. 344 | if (typeof value == 'string') { 345 | return value; 346 | } 347 | if (isSymbol(value)) { 348 | return symbolToString ? symbolToString.call(value) : ''; 349 | } 350 | var result = (value + ''); 351 | return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 352 | } 353 | 354 | /** 355 | * Casts `array` to a slice if it's needed. 356 | * 357 | * @private 358 | * @param {Array} array The array to inspect. 359 | * @param {number} start The start position. 360 | * @param {number} [end=array.length] The end position. 361 | * @returns {Array} Returns the cast slice. 362 | */ 363 | function castSlice(array, start, end) { 364 | var length = array.length; 365 | end = end === undefined ? length : end; 366 | return (!start && end >= length) ? array : baseSlice(array, start, end); 367 | } 368 | 369 | /** 370 | * Creates a function like `_.lowerFirst`. 371 | * 372 | * @private 373 | * @param {string} methodName The name of the `String` case method to use. 374 | * @returns {Function} Returns the new case function. 375 | */ 376 | function createCaseFirst(methodName) { 377 | return function(string) { 378 | string = toString(string); 379 | 380 | var strSymbols = hasUnicode(string) 381 | ? stringToArray(string) 382 | : undefined; 383 | 384 | var chr = strSymbols 385 | ? strSymbols[0] 386 | : string.charAt(0); 387 | 388 | var trailing = strSymbols 389 | ? castSlice(strSymbols, 1).join('') 390 | : string.slice(1); 391 | 392 | return chr[methodName]() + trailing; 393 | }; 394 | } 395 | 396 | /** 397 | * Creates a function like `_.camelCase`. 398 | * 399 | * @private 400 | * @param {Function} callback The function to combine each word. 401 | * @returns {Function} Returns the new compounder function. 402 | */ 403 | function createCompounder(callback) { 404 | return function(string) { 405 | return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); 406 | }; 407 | } 408 | 409 | /** 410 | * Checks if `value` is object-like. A value is object-like if it's not `null` 411 | * and has a `typeof` result of "object". 412 | * 413 | * @static 414 | * @memberOf _ 415 | * @since 4.0.0 416 | * @category Lang 417 | * @param {*} value The value to check. 418 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 419 | * @example 420 | * 421 | * _.isObjectLike({}); 422 | * // => true 423 | * 424 | * _.isObjectLike([1, 2, 3]); 425 | * // => true 426 | * 427 | * _.isObjectLike(_.noop); 428 | * // => false 429 | * 430 | * _.isObjectLike(null); 431 | * // => false 432 | */ 433 | function isObjectLike(value) { 434 | return !!value && typeof value == 'object'; 435 | } 436 | 437 | /** 438 | * Checks if `value` is classified as a `Symbol` primitive or object. 439 | * 440 | * @static 441 | * @memberOf _ 442 | * @since 4.0.0 443 | * @category Lang 444 | * @param {*} value The value to check. 445 | * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 446 | * @example 447 | * 448 | * _.isSymbol(Symbol.iterator); 449 | * // => true 450 | * 451 | * _.isSymbol('abc'); 452 | * // => false 453 | */ 454 | function isSymbol(value) { 455 | return typeof value == 'symbol' || 456 | (isObjectLike(value) && objectToString.call(value) == symbolTag); 457 | } 458 | 459 | /** 460 | * Converts `value` to a string. An empty string is returned for `null` 461 | * and `undefined` values. The sign of `-0` is preserved. 462 | * 463 | * @static 464 | * @memberOf _ 465 | * @since 4.0.0 466 | * @category Lang 467 | * @param {*} value The value to process. 468 | * @returns {string} Returns the string. 469 | * @example 470 | * 471 | * _.toString(null); 472 | * // => '' 473 | * 474 | * _.toString(-0); 475 | * // => '-0' 476 | * 477 | * _.toString([1, 2, 3]); 478 | * // => '1,2,3' 479 | */ 480 | function toString(value) { 481 | return value == null ? '' : baseToString(value); 482 | } 483 | 484 | /** 485 | * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). 486 | * 487 | * @static 488 | * @memberOf _ 489 | * @since 3.0.0 490 | * @category String 491 | * @param {string} [string=''] The string to convert. 492 | * @returns {string} Returns the camel cased string. 493 | * @example 494 | * 495 | * _.camelCase('Foo Bar'); 496 | * // => 'fooBar' 497 | * 498 | * _.camelCase('--foo-bar--'); 499 | * // => 'fooBar' 500 | * 501 | * _.camelCase('__FOO_BAR__'); 502 | * // => 'fooBar' 503 | */ 504 | var camelCase = createCompounder(function(result, word, index) { 505 | word = word.toLowerCase(); 506 | return result + (index ? capitalize(word) : word); 507 | }); 508 | 509 | /** 510 | * Converts the first character of `string` to upper case and the remaining 511 | * to lower case. 512 | * 513 | * @static 514 | * @memberOf _ 515 | * @since 3.0.0 516 | * @category String 517 | * @param {string} [string=''] The string to capitalize. 518 | * @returns {string} Returns the capitalized string. 519 | * @example 520 | * 521 | * _.capitalize('FRED'); 522 | * // => 'Fred' 523 | */ 524 | function capitalize(string) { 525 | return upperFirst(toString(string).toLowerCase()); 526 | } 527 | 528 | /** 529 | * Deburrs `string` by converting 530 | * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) 531 | * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) 532 | * letters to basic Latin letters and removing 533 | * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). 534 | * 535 | * @static 536 | * @memberOf _ 537 | * @since 3.0.0 538 | * @category String 539 | * @param {string} [string=''] The string to deburr. 540 | * @returns {string} Returns the deburred string. 541 | * @example 542 | * 543 | * _.deburr('déjà vu'); 544 | * // => 'deja vu' 545 | */ 546 | function deburr(string) { 547 | string = toString(string); 548 | return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); 549 | } 550 | 551 | /** 552 | * Converts the first character of `string` to upper case. 553 | * 554 | * @static 555 | * @memberOf _ 556 | * @since 4.0.0 557 | * @category String 558 | * @param {string} [string=''] The string to convert. 559 | * @returns {string} Returns the converted string. 560 | * @example 561 | * 562 | * _.upperFirst('fred'); 563 | * // => 'Fred' 564 | * 565 | * _.upperFirst('FRED'); 566 | * // => 'FRED' 567 | */ 568 | var upperFirst = createCaseFirst('toUpperCase'); 569 | 570 | /** 571 | * Splits `string` into an array of its words. 572 | * 573 | * @static 574 | * @memberOf _ 575 | * @since 3.0.0 576 | * @category String 577 | * @param {string} [string=''] The string to inspect. 578 | * @param {RegExp|string} [pattern] The pattern to match words. 579 | * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. 580 | * @returns {Array} Returns the words of `string`. 581 | * @example 582 | * 583 | * _.words('fred, barney, & pebbles'); 584 | * // => ['fred', 'barney', 'pebbles'] 585 | * 586 | * _.words('fred, barney, & pebbles', /[^, ]+/g); 587 | * // => ['fred', 'barney', '&', 'pebbles'] 588 | */ 589 | function words(string, pattern, guard) { 590 | string = toString(string); 591 | pattern = guard ? undefined : pattern; 592 | 593 | if (pattern === undefined) { 594 | return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); 595 | } 596 | return string.match(pattern) || []; 597 | } 598 | 599 | module.exports = camelCase; 600 | -------------------------------------------------------------------------------- /node_modules/lodash.camelcase/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "lodash.camelcase", 3 | "_id": "lodash.camelcase@4.3.0", 4 | "_inBundle": false, 5 | "_integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=", 6 | "_location": "/lodash.camelcase", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "lodash.camelcase", 12 | "name": "lodash.camelcase", 13 | "escapedName": "lodash.camelcase", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", 23 | "_shasum": "b28aa6288a2b9fc651035c7711f65ab6190331a6", 24 | "_spec": "lodash.camelcase", 25 | "_where": "/home/lucas/Code/Testes/vue-discover", 26 | "author": { 27 | "name": "John-David Dalton", 28 | "email": "john.david.dalton@gmail.com", 29 | "url": "http://allyoucanleet.com/" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/lodash/lodash/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "contributors": [ 36 | { 37 | "name": "John-David Dalton", 38 | "email": "john.david.dalton@gmail.com", 39 | "url": "http://allyoucanleet.com/" 40 | }, 41 | { 42 | "name": "Blaine Bublitz", 43 | "email": "blaine.bublitz@gmail.com", 44 | "url": "https://github.com/phated" 45 | }, 46 | { 47 | "name": "Mathias Bynens", 48 | "email": "mathias@qiwi.be", 49 | "url": "https://mathiasbynens.be/" 50 | } 51 | ], 52 | "deprecated": false, 53 | "description": "The lodash method `_.camelCase` exported as a module.", 54 | "homepage": "https://lodash.com/", 55 | "icon": "https://lodash.com/icon.svg", 56 | "keywords": [ 57 | "lodash-modularized", 58 | "camelcase" 59 | ], 60 | "license": "MIT", 61 | "name": "lodash.camelcase", 62 | "repository": { 63 | "type": "git", 64 | "url": "git+https://github.com/lodash/lodash.git" 65 | }, 66 | "scripts": { 67 | "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" 68 | }, 69 | "version": "4.3.0" 70 | } 71 | -------------------------------------------------------------------------------- /node_modules/lodash.upperfirst/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors 2 | 3 | Based on Underscore.js, copyright Jeremy Ashkenas, 4 | DocumentCloud and Investigative Reporters & Editors 5 | 6 | This software consists of voluntary contributions made by many 7 | individuals. For exact contribution history, see the revision history 8 | available at https://github.com/lodash/lodash 9 | 10 | The following license applies to all parts of this software except as 11 | documented below: 12 | 13 | ==== 14 | 15 | Permission is hereby granted, free of charge, to any person obtaining 16 | a copy of this software and associated documentation files (the 17 | "Software"), to deal in the Software without restriction, including 18 | without limitation the rights to use, copy, modify, merge, publish, 19 | distribute, sublicense, and/or sell copies of the Software, and to 20 | permit persons to whom the Software is furnished to do so, subject to 21 | the following conditions: 22 | 23 | The above copyright notice and this permission notice shall be 24 | included in all copies or substantial portions of the Software. 25 | 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 27 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 28 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 29 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 30 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 31 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 32 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 33 | 34 | ==== 35 | 36 | Copyright and related rights for sample code are waived via CC0. Sample 37 | code is defined as all source code displayed within the prose of the 38 | documentation. 39 | 40 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 41 | 42 | ==== 43 | 44 | Files located in the node_modules and vendor directories are externally 45 | maintained libraries used by this software which have their own 46 | licenses; we recommend you read them, as their terms may differ from the 47 | terms above. 48 | -------------------------------------------------------------------------------- /node_modules/lodash.upperfirst/README.md: -------------------------------------------------------------------------------- 1 | # lodash.upperfirst v4.3.1 2 | 3 | The [lodash](https://lodash.com/) method `_.upperFirst` exported as a [Node.js](https://nodejs.org/) module. 4 | 5 | ## Installation 6 | 7 | Using npm: 8 | ```bash 9 | $ {sudo -H} npm i -g npm 10 | $ npm i --save lodash.upperfirst 11 | ``` 12 | 13 | In Node.js: 14 | ```js 15 | var upperFirst = require('lodash.upperfirst'); 16 | ``` 17 | 18 | See the [documentation](https://lodash.com/docs#upperFirst) or [package source](https://github.com/lodash/lodash/blob/4.3.1-npm-packages/lodash.upperfirst) for more details. 19 | -------------------------------------------------------------------------------- /node_modules/lodash.upperfirst/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * lodash (Custom Build) 3 | * Build: `lodash modularize exports="npm" -o ./` 4 | * Copyright jQuery Foundation and other contributors 5 | * Released under MIT license 6 | * Based on Underscore.js 1.8.3 7 | * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 8 | */ 9 | 10 | /** Used as references for various `Number` constants. */ 11 | var INFINITY = 1 / 0; 12 | 13 | /** `Object#toString` result references. */ 14 | var symbolTag = '[object Symbol]'; 15 | 16 | /** Used to compose unicode character classes. */ 17 | var rsAstralRange = '\\ud800-\\udfff', 18 | rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', 19 | rsComboSymbolsRange = '\\u20d0-\\u20f0', 20 | rsVarRange = '\\ufe0e\\ufe0f'; 21 | 22 | /** Used to compose unicode capture groups. */ 23 | var rsAstral = '[' + rsAstralRange + ']', 24 | rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', 25 | rsFitz = '\\ud83c[\\udffb-\\udfff]', 26 | rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', 27 | rsNonAstral = '[^' + rsAstralRange + ']', 28 | rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', 29 | rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', 30 | rsZWJ = '\\u200d'; 31 | 32 | /** Used to compose unicode regexes. */ 33 | var reOptMod = rsModifier + '?', 34 | rsOptVar = '[' + rsVarRange + ']?', 35 | rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', 36 | rsSeq = rsOptVar + reOptMod + rsOptJoin, 37 | rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; 38 | 39 | /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ 40 | var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); 41 | 42 | /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ 43 | var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); 44 | 45 | /** Detect free variable `global` from Node.js. */ 46 | var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 47 | 48 | /** Detect free variable `self`. */ 49 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 50 | 51 | /** Used as a reference to the global object. */ 52 | var root = freeGlobal || freeSelf || Function('return this')(); 53 | 54 | /** 55 | * Converts an ASCII `string` to an array. 56 | * 57 | * @private 58 | * @param {string} string The string to convert. 59 | * @returns {Array} Returns the converted array. 60 | */ 61 | function asciiToArray(string) { 62 | return string.split(''); 63 | } 64 | 65 | /** 66 | * Checks if `string` contains Unicode symbols. 67 | * 68 | * @private 69 | * @param {string} string The string to inspect. 70 | * @returns {boolean} Returns `true` if a symbol is found, else `false`. 71 | */ 72 | function hasUnicode(string) { 73 | return reHasUnicode.test(string); 74 | } 75 | 76 | /** 77 | * Converts `string` to an array. 78 | * 79 | * @private 80 | * @param {string} string The string to convert. 81 | * @returns {Array} Returns the converted array. 82 | */ 83 | function stringToArray(string) { 84 | return hasUnicode(string) 85 | ? unicodeToArray(string) 86 | : asciiToArray(string); 87 | } 88 | 89 | /** 90 | * Converts a Unicode `string` to an array. 91 | * 92 | * @private 93 | * @param {string} string The string to convert. 94 | * @returns {Array} Returns the converted array. 95 | */ 96 | function unicodeToArray(string) { 97 | return string.match(reUnicode) || []; 98 | } 99 | 100 | /** Used for built-in method references. */ 101 | var objectProto = Object.prototype; 102 | 103 | /** 104 | * Used to resolve the 105 | * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 106 | * of values. 107 | */ 108 | var objectToString = objectProto.toString; 109 | 110 | /** Built-in value references. */ 111 | var Symbol = root.Symbol; 112 | 113 | /** Used to convert symbols to primitives and strings. */ 114 | var symbolProto = Symbol ? Symbol.prototype : undefined, 115 | symbolToString = symbolProto ? symbolProto.toString : undefined; 116 | 117 | /** 118 | * The base implementation of `_.slice` without an iteratee call guard. 119 | * 120 | * @private 121 | * @param {Array} array The array to slice. 122 | * @param {number} [start=0] The start position. 123 | * @param {number} [end=array.length] The end position. 124 | * @returns {Array} Returns the slice of `array`. 125 | */ 126 | function baseSlice(array, start, end) { 127 | var index = -1, 128 | length = array.length; 129 | 130 | if (start < 0) { 131 | start = -start > length ? 0 : (length + start); 132 | } 133 | end = end > length ? length : end; 134 | if (end < 0) { 135 | end += length; 136 | } 137 | length = start > end ? 0 : ((end - start) >>> 0); 138 | start >>>= 0; 139 | 140 | var result = Array(length); 141 | while (++index < length) { 142 | result[index] = array[index + start]; 143 | } 144 | return result; 145 | } 146 | 147 | /** 148 | * The base implementation of `_.toString` which doesn't convert nullish 149 | * values to empty strings. 150 | * 151 | * @private 152 | * @param {*} value The value to process. 153 | * @returns {string} Returns the string. 154 | */ 155 | function baseToString(value) { 156 | // Exit early for strings to avoid a performance hit in some environments. 157 | if (typeof value == 'string') { 158 | return value; 159 | } 160 | if (isSymbol(value)) { 161 | return symbolToString ? symbolToString.call(value) : ''; 162 | } 163 | var result = (value + ''); 164 | return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; 165 | } 166 | 167 | /** 168 | * Casts `array` to a slice if it's needed. 169 | * 170 | * @private 171 | * @param {Array} array The array to inspect. 172 | * @param {number} start The start position. 173 | * @param {number} [end=array.length] The end position. 174 | * @returns {Array} Returns the cast slice. 175 | */ 176 | function castSlice(array, start, end) { 177 | var length = array.length; 178 | end = end === undefined ? length : end; 179 | return (!start && end >= length) ? array : baseSlice(array, start, end); 180 | } 181 | 182 | /** 183 | * Creates a function like `_.lowerFirst`. 184 | * 185 | * @private 186 | * @param {string} methodName The name of the `String` case method to use. 187 | * @returns {Function} Returns the new case function. 188 | */ 189 | function createCaseFirst(methodName) { 190 | return function(string) { 191 | string = toString(string); 192 | 193 | var strSymbols = hasUnicode(string) 194 | ? stringToArray(string) 195 | : undefined; 196 | 197 | var chr = strSymbols 198 | ? strSymbols[0] 199 | : string.charAt(0); 200 | 201 | var trailing = strSymbols 202 | ? castSlice(strSymbols, 1).join('') 203 | : string.slice(1); 204 | 205 | return chr[methodName]() + trailing; 206 | }; 207 | } 208 | 209 | /** 210 | * Checks if `value` is object-like. A value is object-like if it's not `null` 211 | * and has a `typeof` result of "object". 212 | * 213 | * @static 214 | * @memberOf _ 215 | * @since 4.0.0 216 | * @category Lang 217 | * @param {*} value The value to check. 218 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 219 | * @example 220 | * 221 | * _.isObjectLike({}); 222 | * // => true 223 | * 224 | * _.isObjectLike([1, 2, 3]); 225 | * // => true 226 | * 227 | * _.isObjectLike(_.noop); 228 | * // => false 229 | * 230 | * _.isObjectLike(null); 231 | * // => false 232 | */ 233 | function isObjectLike(value) { 234 | return !!value && typeof value == 'object'; 235 | } 236 | 237 | /** 238 | * Checks if `value` is classified as a `Symbol` primitive or object. 239 | * 240 | * @static 241 | * @memberOf _ 242 | * @since 4.0.0 243 | * @category Lang 244 | * @param {*} value The value to check. 245 | * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 246 | * @example 247 | * 248 | * _.isSymbol(Symbol.iterator); 249 | * // => true 250 | * 251 | * _.isSymbol('abc'); 252 | * // => false 253 | */ 254 | function isSymbol(value) { 255 | return typeof value == 'symbol' || 256 | (isObjectLike(value) && objectToString.call(value) == symbolTag); 257 | } 258 | 259 | /** 260 | * Converts `value` to a string. An empty string is returned for `null` 261 | * and `undefined` values. The sign of `-0` is preserved. 262 | * 263 | * @static 264 | * @memberOf _ 265 | * @since 4.0.0 266 | * @category Lang 267 | * @param {*} value The value to process. 268 | * @returns {string} Returns the string. 269 | * @example 270 | * 271 | * _.toString(null); 272 | * // => '' 273 | * 274 | * _.toString(-0); 275 | * // => '-0' 276 | * 277 | * _.toString([1, 2, 3]); 278 | * // => '1,2,3' 279 | */ 280 | function toString(value) { 281 | return value == null ? '' : baseToString(value); 282 | } 283 | 284 | /** 285 | * Converts the first character of `string` to upper case. 286 | * 287 | * @static 288 | * @memberOf _ 289 | * @since 4.0.0 290 | * @category String 291 | * @param {string} [string=''] The string to convert. 292 | * @returns {string} Returns the converted string. 293 | * @example 294 | * 295 | * _.upperFirst('fred'); 296 | * // => 'Fred' 297 | * 298 | * _.upperFirst('FRED'); 299 | * // => 'FRED' 300 | */ 301 | var upperFirst = createCaseFirst('toUpperCase'); 302 | 303 | module.exports = upperFirst; 304 | -------------------------------------------------------------------------------- /node_modules/lodash.upperfirst/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "_from": "lodash.upperfirst", 3 | "_id": "lodash.upperfirst@4.3.1", 4 | "_inBundle": false, 5 | "_integrity": "sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984=", 6 | "_location": "/lodash.upperfirst", 7 | "_phantomChildren": {}, 8 | "_requested": { 9 | "type": "tag", 10 | "registry": true, 11 | "raw": "lodash.upperfirst", 12 | "name": "lodash.upperfirst", 13 | "escapedName": "lodash.upperfirst", 14 | "rawSpec": "", 15 | "saveSpec": null, 16 | "fetchSpec": "latest" 17 | }, 18 | "_requiredBy": [ 19 | "#USER", 20 | "/" 21 | ], 22 | "_resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", 23 | "_shasum": "1365edf431480481ef0d1c68957a5ed99d49f7ce", 24 | "_spec": "lodash.upperfirst", 25 | "_where": "/home/lucas/Code/Testes/vue-discover", 26 | "author": { 27 | "name": "John-David Dalton", 28 | "email": "john.david.dalton@gmail.com", 29 | "url": "http://allyoucanleet.com/" 30 | }, 31 | "bugs": { 32 | "url": "https://github.com/lodash/lodash/issues" 33 | }, 34 | "bundleDependencies": false, 35 | "contributors": [ 36 | { 37 | "name": "John-David Dalton", 38 | "email": "john.david.dalton@gmail.com", 39 | "url": "http://allyoucanleet.com/" 40 | }, 41 | { 42 | "name": "Blaine Bublitz", 43 | "email": "blaine.bublitz@gmail.com", 44 | "url": "https://github.com/phated" 45 | }, 46 | { 47 | "name": "Mathias Bynens", 48 | "email": "mathias@qiwi.be", 49 | "url": "https://mathiasbynens.be/" 50 | } 51 | ], 52 | "deprecated": false, 53 | "description": "The lodash method `_.upperFirst` exported as a module.", 54 | "homepage": "https://lodash.com/", 55 | "icon": "https://lodash.com/icon.svg", 56 | "keywords": [ 57 | "lodash-modularized", 58 | "upperfirst" 59 | ], 60 | "license": "MIT", 61 | "name": "lodash.upperfirst", 62 | "repository": { 63 | "type": "git", 64 | "url": "git+https://github.com/lodash/lodash.git" 65 | }, 66 | "scripts": { 67 | "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" 68 | }, 69 | "version": "4.3.1" 70 | } 71 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-discover", 3 | "version": "1.0.5", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "lodash.camelcase": { 8 | "version": "4.3.0", 9 | "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", 10 | "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" 11 | }, 12 | "lodash.upperfirst": { 13 | "version": "4.3.1", 14 | "resolved": "https://registry.npmjs.org/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz", 15 | "integrity": "sha1-E2Xt9DFIBIHvDRxolXpe2Z1J984=" 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-discover", 3 | "version": "1.0.5", 4 | "description": "Vue Discover is a vue plugin to auto discover vue components, register routes and vuex modules based in a pre defined structure folder.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/lucca-cardial/vue-discover.git" 12 | }, 13 | "keywords": [ 14 | "vuejs", 15 | "vuejs auto discover", 16 | "vue auto modules discover", 17 | "vue auto routes discover", 18 | "path", 19 | "auto", 20 | "vuex" 21 | ], 22 | "author": "Lucas Cardial ", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/lucca-cardial/vue-discover/issues" 26 | }, 27 | "homepage": "https://github.com/lucca-cardial/vue-discover#readme", 28 | "dependencies": { 29 | "lodash.camelcase": "^4.3.0", 30 | "lodash.upperfirst": "^4.3.1" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/factory/NavigationStructFactory.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | export default (features, options) => { 3 | 4 | let appNav = features.reduce((nav, feature) => { 5 | if (feature.nav) { 6 | feature.nav['to'] = feature.name 7 | feature.nav['children'] = (!feature.modules) ? null 8 | : feature.modules.reduce((_navs, sub) => { 9 | if (sub.nav) { 10 | sub.nav['to'] = sub.name 11 | _navs.push(sub.nav) 12 | } 13 | return _navs 14 | }, []) 15 | nav.push(feature.nav) 16 | } 17 | return nav 18 | }, []) 19 | 20 | return appNav.reduce((result, nav) => { 21 | if (nav.group && options.groups) { 22 | 23 | let group = options.groups.find(x => x.name === nav.group) 24 | if (group !== undefined && group !== null) { 25 | let _group = result.find(x => x.label === group.label) 26 | if (_group) { 27 | _group['children'].push(nav) 28 | console.log('nav', result) 29 | } else { 30 | group['children'] = [nav] 31 | result.push(group) 32 | } 33 | } else { 34 | console.warn('[Vue Discover] Navigation Factory: the group', nav.group, 35 | 'in nav', nav.label, ', dont exist') 36 | result.push(nav) 37 | } 38 | } else { 39 | result.push(nav) 40 | } 41 | return result 42 | }, []) 43 | } 44 | -------------------------------------------------------------------------------- /src/factory/RouterFactory.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | import Vue from 'vue' 3 | import router from '@/router' 4 | const defaultComponent = () => { 5 | return Vue.component('vue-discover-default-component', { 6 | template: ` 7 |
8 |

{{message}}

9 | 10 |
11 | `, 12 | props: { 13 | message: {default: null} 14 | } 15 | }) 16 | } 17 | const mount = (feature, modules) => { 18 | if (feature.router === undefined) { 19 | console.error( 20 | '[Vue discover] RouterFactory: missing property "route" in', 21 | `"Features/${feature.namespace}/index.js"`) 22 | return false 23 | } 24 | let router = feature.router 25 | router['name'] = feature.name 26 | if (typeof router.component === 'string') { 27 | router.component = (router.component !== '$name') ? router.component : feature.name 28 | const component = modules.find(x => x.signature === router.component) 29 | if (component !== undefined) { 30 | router.component = component.module 31 | } else { 32 | console.error( 33 | '[Vue discover] RouterFactory: Signature of module', 34 | `"${router.component}"`, 'required in component router of', 35 | `"Features/${feature.namespace}/index.js"`, 36 | 'was not found.') 37 | return false 38 | } 39 | } 40 | 41 | if (!router.component) { 42 | router.component = defaultComponent() 43 | router.redirect = '/' 44 | } 45 | return router 46 | } 47 | export default (features, modules, options) => { 48 | let _routes = features.reduce((routes, feature) => { 49 | const route = mount(feature, modules) 50 | if (feature.modules !== undefined) { 51 | route['children'] = feature.modules.reduce((children, nested) => { 52 | children.push(mount(nested, modules)) 53 | return children 54 | }, []) 55 | } 56 | routes.push(route) 57 | return routes 58 | }, []) 59 | if(options && options.joinTo){ 60 | let routeData = router.options.routes.find(r => r.name === options.joinTo) 61 | console.log('options', options) 62 | 63 | if(routeData){ 64 | routeData.children = _routes 65 | router.addRoutes([routeData]) 66 | } 67 | } else { 68 | router.addRoutes(_routes) 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/factory/StoreFactory.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | import upperFirst from 'lodash.upperfirst' 3 | import camelCase from 'lodash.camelcase' 4 | import state from '@/store/index.js' 5 | 6 | const requireStore = require.context('@/Features/', true, /\.feature\.js$/) 7 | 8 | export default () => { 9 | const modules = requireStore.keys().reduce((modules, fileName) => { 10 | const file = requireStore(fileName) 11 | if (file !== undefined || file.default !== undefined) { 12 | let path = fileName.split('store/').join('') 13 | .split('./').join('') 14 | .split('.feature.js').join('') 15 | .split('/') 16 | let namespace = upperFirst(camelCase(path[0])) 17 | if (!(`${namespace}` in modules)) { 18 | modules[namespace] = { 19 | namespaced: true 20 | } 21 | modules[namespace][path[1]] = file.default || file 22 | } else { 23 | modules[namespace][path[1]] = file.default || file 24 | } 25 | return modules 26 | } 27 | }, {}) 28 | 29 | Object.entries(modules).forEach((module) => { 30 | state.registerModule(module[0], module[1]) 31 | }) 32 | 33 | return modules 34 | } 35 | -------------------------------------------------------------------------------- /src/map/ComponentsMap.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | import Vue from 'vue' 3 | import upperFirst from 'lodash.upperfirst' 4 | import camelCase from 'lodash.camelcase' 5 | 6 | const requireComponent = require.context('@/components', true, /\.vue$/) 7 | 8 | requireComponent.keys().forEach(file => { 9 | const componentConfig = requireComponent(file) 10 | 11 | const componentName = upperFirst( 12 | camelCase(file.replace(/^\.\//, '')).replace(/\.\w+$/, '') 13 | ) 14 | 15 | Vue.component(componentConfig.default.name || componentName, componentConfig.default || componentConfig) 16 | }) 17 | 18 | export default new Vue() 19 | -------------------------------------------------------------------------------- /src/map/FeaturesMap.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | import upperFirst from 'lodash.upperfirst' 3 | import camelCase from 'lodash.camelcase' 4 | const requireComponent = require.context('@/Features/', true, /index\.js$/) 5 | 6 | export default requireComponent.keys().reduce((map, file) => { 7 | let component = requireComponent(file) 8 | if (component.default !== undefined) { 9 | component.default['namespace'] = upperFirst(camelCase(file)).split('IndexJs').join('') 10 | map.push(component.default) 11 | } 12 | return map 13 | }, []) 14 | -------------------------------------------------------------------------------- /src/map/ModulesMap.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-new */ 2 | const requireComponent = require.context('@/Modules/', true, /\.vue$/) 3 | 4 | export default requireComponent.keys().reduce((map, file) => { 5 | let config = requireComponent(file) 6 | if (config.default !== undefined) { 7 | map.push({ 8 | signature: config.default.signature, 9 | module: config.default 10 | }) 11 | } 12 | return map 13 | }, []) 14 | --------------------------------------------------------------------------------