@appnave/quasar-app-extension-asteroid 3.20.0-beta.34-alpha.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@appnave/quasar-app-extension-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.20.0-beta.34-alpha.0",
4
+ "version": "3.20.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
@@ -31,17 +31,18 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@fawmi/vue-google-maps": "0.9.79",
34
- "quasar": "2.22.0"
34
+ "quasar": "^2.18.0"
35
35
  },
36
36
  "dependencies": {
37
- "@appnave/quasar-ui-asteroid": "3.20.0-beta.34-alpha.0",
37
+ "@appnave/quasar-app-extension-asteroid": "file:",
38
+ "@appnave/quasar-ui-asteroid": "3.20.0",
38
39
  "@bildvitta/store-adapter": "^1.0.0",
39
- "execa": "^10.0.0",
40
+ "execa": "^7.1.1",
40
41
  "fontfaceobserver": "^2.3.0",
41
42
  "humps": "^2.0.1",
42
43
  "laravel-echo": "^1.15.3",
43
44
  "ora": "^8.2.0",
44
- "pusher-js": "8.6.0",
45
+ "pusher-js": "^8.4.0-rc2",
45
46
  "unplugin-vue-components": "28.5.0"
46
47
  }
47
48
  }
package/src/boot/api.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { camelizeKeys, decamelizeKeys } from 'humps'
2
- import { handleProcess } from 'asteroid'
3
2
 
4
3
  import asteroidConfig from 'asteroid-config'
5
4
 
@@ -18,12 +17,12 @@ function getBaseURL (isProduction) {
18
17
  }
19
18
 
20
19
  // Caso não haja uma URL de preview válida, utiliza a URL base definida nas variáveis de ambiente ou locahost.
21
- return handleProcess(() => import.meta.env.SERVER_BASE_URL, '/')
20
+ return process.env.SERVER_BASE_URL || '/'
22
21
  }
23
22
 
24
23
  export default async ({ app, router }) => {
25
24
  const api = app.config.globalProperties.$axios
26
- const isProduction = handleProcess(() => import.meta.env.ENVIRONMENT === 'production', false)
25
+ const isProduction = process.env.ENVIRONMENT === 'production'
27
26
 
28
27
  // Defaults
29
28
  api.defaults.baseURL = getBaseURL(isProduction)
@@ -33,7 +32,7 @@ export default async ({ app, router }) => {
33
32
  * Permite que parâmetros de query string iniciados com $ sejam propagados para todas as rotas,
34
33
  * útil para ambiente de preview.
35
34
  */
36
- router.beforeEach((to, from) => {
35
+ router.beforeEach((to, from, next) => {
37
36
  // Extrai os parâmetros de query string iniciados com $ da rota de origem (from).
38
37
  const dollarParams = Object.fromEntries(Object.entries(from.query).filter(([key]) => key.startsWith('$')))
39
38
 
@@ -44,7 +43,9 @@ export default async ({ app, router }) => {
44
43
  const hasMissingDollarParams = Object.keys(dollarParams).some(key => !(key in to.query))
45
44
 
46
45
  if (hasMissingDollarParams) {
47
- return { ...to, query: { ...dollarParams, ...to.query } }
46
+ next({ ...to, query: { ...dollarParams, ...to.query } })
47
+ } else {
48
+ next()
48
49
  }
49
50
  })
50
51
 
@@ -1,13 +1,11 @@
1
1
  import { useHistory, setDefaultFiltersBeforeEach } from 'asteroid'
2
2
 
3
3
  export default ({ router }) => {
4
- router.beforeEach((to, from) => {
4
+ router.beforeEach((to, from, next) => {
5
5
  const { addRoute } = useHistory()
6
6
 
7
7
  addRoute(to)
8
8
 
9
- return new Promise(resolve => {
10
- setDefaultFiltersBeforeEach(to, from, result => resolve(result))
11
- })
9
+ setDefaultFiltersBeforeEach(to, from, next)
12
10
  })
13
11
  }
package/src/boot/debug.js CHANGED
@@ -3,8 +3,8 @@ import { handleProcess } from 'asteroid'
3
3
  import debug from 'debug'
4
4
 
5
5
  export default async () => {
6
- const debuggingEnv = handleProcess(() => import.meta.env.DEBUGGING, false)
7
- const debugEnv = handleProcess(() => import.meta.env.DEBUG, '')
6
+ const debuggingEnv = handleProcess(() => process.env.DEBUGGING, false)
7
+ const debugEnv = handleProcess(() => process.env.DEBUG, '')
8
8
 
9
9
  debug.enable(debuggingEnv && !debugEnv ? 'asteroid-*:*' : debugEnv)
10
10
  }
@@ -1,5 +1,3 @@
1
- import { handleProcess } from 'asteroid'
2
-
3
1
  export default function ({ router }) {
4
2
  const routes = [
5
3
  {
@@ -14,7 +12,7 @@ export default function ({ router }) {
14
12
  }
15
13
  ]
16
14
 
17
- if (handleProcess(() => import.meta.env.MODE, '') !== 'ssr') {
15
+ if (process.env.MODE !== 'ssr') {
18
16
  routes.push({
19
17
  name: 'NotFound',
20
18
  path: '/:catchAll(.*)*',
@@ -1,8 +1,6 @@
1
- import * as FontFaceObserverModule from 'fontfaceobserver'
1
+ import FontFaceObserver from 'fontfaceobserver'
2
2
  import asteroidConfig from 'asteroid-config'
3
3
 
4
- const FontFaceObserver = FontFaceObserverModule.default || FontFaceObserverModule.FontFaceObserver || FontFaceObserverModule
5
-
6
4
  export default async () => {
7
5
  function setFontFaceObserver () {
8
6
  const font = new FontFaceObserver('Material Symbols Rounded')
@@ -4,18 +4,19 @@ import { useOverlayNavigation } from 'asteroid'
4
4
  * @param {import('vue-router').Router} router
5
5
  */
6
6
  export default async function ({ router }) {
7
- router.beforeEach((to, from) => onBeforeEach(to, from, router))
7
+ router.beforeEach((to, from, next) => onBeforeEach(to, from, next, router))
8
8
  }
9
9
 
10
10
  /**
11
11
  * @param {import('vue-router').RouteLocationNormalized} to
12
12
  * @param {import('vue-router').RouteLocationNormalized} from
13
+ * @param {Function} next
13
14
  * @param {import('vue-router').Router} router
14
15
  */
15
- async function onBeforeEach (to, from, router) {
16
+ async function onBeforeEach (to, from, next, router) {
16
17
  const useOverlay = to.matched.some(item => item.meta.useOverlay)
17
18
 
18
- if (!useOverlay) return
19
+ if (!useOverlay) return next()
19
20
 
20
21
  const { addRouteToHistory } = useOverlayNavigation()
21
22
 
@@ -82,6 +83,8 @@ async function onBeforeEach (to, from, router) {
82
83
  }
83
84
  }
84
85
 
86
+ next()
87
+
85
88
  // functions
86
89
 
87
90
  /**
@@ -63,11 +63,11 @@ function setRouteCache (route) {
63
63
  }
64
64
 
65
65
  export default ({ router }) => {
66
- router.beforeEach((to, from) => {
66
+ router.beforeEach((to, from, next) => {
67
67
  if (!useHistory().hasPreviousRoute.value) {
68
68
  clearAll(to.name)
69
69
 
70
- return
70
+ return next()
71
71
  }
72
72
 
73
73
  setRouteCache(from)
@@ -83,9 +83,11 @@ export default ({ router }) => {
83
83
 
84
84
  isReplacingQuery = true
85
85
 
86
- return { ...to, query: cachedQuery }
87
- }
86
+ next({ ...to, query: cachedQuery })
87
+ } else {
88
+ isReplacingQuery = false
88
89
 
89
- isReplacingQuery = false
90
+ next()
91
+ }
90
92
  })
91
93
  }
@@ -1,12 +1,10 @@
1
1
  import { isLocalDevelopment, handleProcess } from 'asteroid'
2
2
 
3
3
  import Echo from 'laravel-echo'
4
- import * as PusherModule from 'pusher-js'
4
+ import Pusher from 'pusher-js'
5
5
 
6
6
  import { camelizeKeys } from 'humps'
7
7
 
8
- const Pusher = PusherModule.default || PusherModule.Pusher || PusherModule
9
-
10
8
  /**
11
9
  * Função para setar configuração do Laravel Echo.
12
10
  *
@@ -16,21 +14,16 @@ export function setLaravelEcho (accessToken) {
16
14
  window.Pusher = Pusher
17
15
 
18
16
  const isLocal = isLocalDevelopment()
19
- const serverBaseURL = handleProcess(() => import.meta.env.SERVER_BASE_URL, '/')
20
- const normalizedServerBaseURL = serverBaseURL === '/'
21
- ? ''
22
- : serverBaseURL.replace(/\/$/, '')
23
17
 
24
18
  window.Echo = new Echo({
25
19
  broadcaster: 'pusher',
26
- key: isLocal ? 'app-key' : handleProcess(() => import.meta.env.ABLY_KEY, ''),
20
+ key: isLocal ? 'app-key' : handleProcess(() => process.env.ABLY_KEY, ''),
27
21
  wsHost: isLocal ? 'localhost' : 'realtime-pusher.ably.io',
28
22
  wsPort: isLocal ? 6001 : 443,
29
23
  disableStats: true,
30
24
  encrypted: true,
31
25
  cluster: isLocal ? 'mt1' : 'eu',
32
- authEndpoint: `${normalizedServerBaseURL}/broadcasting/auth`,
33
- enabledTransports: ['ws', 'wss'],
26
+ authEndpoint: `${process.env.SERVER_BASE_URL}/broadcasting/auth`,
34
27
  auth: {
35
28
  headers: {
36
29
  Authorization: accessToken
package/src/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import asteroidConfigHandler from './helpers/asteroid-config-handler.js'
2
2
 
3
3
  import ComponentsVite from 'unplugin-vue-components/vite'
4
+ import ComponentsWebpack from 'unplugin-vue-components/webpack'
4
5
  import { pathToFileURL } from 'url'
5
6
 
6
7
  const sourcePath = '~@appnave/quasar-app-extension-asteroid/src/'
@@ -27,6 +28,19 @@ function extendQuasar (quasar, api, asteroidConfigFile) {
27
28
  quasar.boot.push(...resolve('boot/notifications'))
28
29
  }
29
30
 
31
+ // Transpilação de arquivos!
32
+ if (api.hasWebpack) {
33
+ const transpileTarget = (
34
+ quasar.build.webpackTranspileDependencies || // q/app-webpack >= v4
35
+ quasar.build.transpileDependencies // q/app-webpack v3
36
+ )
37
+
38
+ transpileTarget.push(
39
+ /quasar-app-extension-asteroid[\\/]src/,
40
+ /@bildvitta[\\/]quasar-ui-asteroid[\\/]src/
41
+ )
42
+ }
43
+
30
44
  // Adiciona todas classes do asteroid
31
45
  quasar.css.push(...resolve('index.scss'))
32
46
 
@@ -60,7 +74,7 @@ function extendQuasar (quasar, api, asteroidConfigFile) {
60
74
 
61
75
  export default async function (api) {
62
76
  api.compatibleWith('quasar', '^2.0.0')
63
- api.compatibleWith('date-fns', '^4.1.0')
77
+ api.compatibleWith('date-fns', '^2.3.0')
64
78
 
65
79
  const asteroid = 'node_modules/@appnave/quasar-ui-asteroid/src/asteroid.js'
66
80
  const asteroidComponents = 'node_modules/@appnave/quasar-ui-asteroid/src/components'
@@ -77,11 +91,10 @@ export default async function (api) {
77
91
  const { default: asteroidConfigFile } = await import(pathToFileURL(asteroidConfigPath).href)
78
92
 
79
93
  const unpluginVueComponentsConfig = {
80
- dirs: [api.resolve.app(asteroidComponents)],
94
+ dirs: [api.resolve.app(asteroidComponents)], // ajusta o path para a lib
81
95
  extensions: ['vue'],
82
96
  deep: true,
83
- dts: false,
84
- include: [/\.vue$/, /\.vue\?vue/]
97
+ dts: false // desativa geração de types
85
98
  }
86
99
 
87
100
  const alias = {
@@ -95,31 +108,45 @@ export default async function (api) {
95
108
  'images/marker-icon.png': api.resolve.app('node_modules/leaflet/dist/images/marker-icon.png')
96
109
  }
97
110
 
98
- api.compatibleWith('@quasar/app-vite', '^3.2.0')
99
-
100
- api.extendViteConf(viteConf => {
101
- Object.assign(viteConf.resolve.alias, alias)
102
-
103
- // optimizeDeps (necessário para funcionamento do QasMap)
104
- viteConf.optimizeDeps = viteConf.optimizeDeps || {}
105
- viteConf.optimizeDeps.include = viteConf.optimizeDeps.include || []
106
- viteConf.optimizeDeps.include.push(...[
107
- '@fawmi/vue-google-maps',
108
- 'fast-deep-equal',
109
- 'humps',
110
- 'debug',
111
- 'pica',
112
- 'hammerjs',
113
- 'lodash-es',
114
- 'date-fns',
115
- 'date-fns/locale',
116
- 'leaflet',
117
- 'fontfaceobserver',
118
- 'autonumeric'
119
- ])
120
-
121
- viteConf.plugins = viteConf.plugins || []
122
- viteConf.plugins.push(ComponentsVite(unpluginVueComponentsConfig))
111
+ if (api.hasVite) {
112
+ api.compatibleWith('@quasar/app-vite', '^2.0.0')
113
+
114
+ api.extendViteConf(viteConf => {
115
+ Object.assign(viteConf.resolve.alias, alias)
116
+
117
+ // optimizeDeps (necessário para funcionamento do QasMap)
118
+ viteConf.optimizeDeps = viteConf.optimizeDeps || {}
119
+ viteConf.optimizeDeps.include = viteConf.optimizeDeps.include || []
120
+ viteConf.optimizeDeps.include.push(...[
121
+ '@fawmi/vue-google-maps',
122
+ 'fast-deep-equal',
123
+ 'humps',
124
+ 'debug',
125
+ 'pica',
126
+ 'hammerjs',
127
+ 'lodash-es',
128
+ 'date-fns',
129
+ 'date-fns/locale',
130
+ 'leaflet'
131
+ ])
132
+
133
+ viteConf.plugins = viteConf.plugins || []
134
+ viteConf.plugins.push(ComponentsVite(unpluginVueComponentsConfig))
135
+ })
136
+
137
+ api.extendQuasarConf(quasar => extendQuasar(quasar, api, asteroidConfigFile))
138
+
139
+ return
140
+ }
141
+
142
+ api.compatibleWith('@quasar/app', '^3.10.0 || ^4.0.0')
143
+
144
+ api.extendWebpack(webpack => {
145
+ Object.assign(webpack.resolve.alias, alias)
146
+
147
+ // Adiciona o plugin de componentes
148
+ webpack.plugins = webpack.plugins || []
149
+ webpack.plugins.push(ComponentsWebpack(unpluginVueComponentsConfig))
123
150
  })
124
151
 
125
152
  api.extendQuasarConf(quasar => extendQuasar(quasar, api, asteroidConfigFile))