@appnave/quasar-app-extension-asteroid 3.20.0-beta.32 → 3.20.0-beta.34-alpha.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.32",
4
+ "version": "3.20.0-beta.34-alpha.0",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "src/index.js",
@@ -31,18 +31,17 @@
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@fawmi/vue-google-maps": "0.9.79",
34
- "quasar": "^2.18.0"
34
+ "quasar": "2.22.0"
35
35
  },
36
36
  "dependencies": {
37
- "@appnave/quasar-app-extension-asteroid": "file:",
38
- "@appnave/quasar-ui-asteroid": "3.20.0-beta.32",
37
+ "@appnave/quasar-ui-asteroid": "3.20.0-beta.34-alpha.0",
39
38
  "@bildvitta/store-adapter": "^1.0.0",
40
- "execa": "^7.1.1",
39
+ "execa": "^10.0.0",
41
40
  "fontfaceobserver": "^2.3.0",
42
41
  "humps": "^2.0.1",
43
42
  "laravel-echo": "^1.15.3",
44
43
  "ora": "^8.2.0",
45
- "pusher-js": "^8.4.0-rc2",
44
+ "pusher-js": "8.6.0",
46
45
  "unplugin-vue-components": "28.5.0"
47
46
  }
48
47
  }
package/src/boot/api.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { camelizeKeys, decamelizeKeys } from 'humps'
2
+ import { handleProcess } from 'asteroid'
2
3
 
3
4
  import asteroidConfig from 'asteroid-config'
4
5
 
@@ -17,12 +18,12 @@ function getBaseURL (isProduction) {
17
18
  }
18
19
 
19
20
  // Caso não haja uma URL de preview válida, utiliza a URL base definida nas variáveis de ambiente ou locahost.
20
- return process.env.SERVER_BASE_URL || '/'
21
+ return handleProcess(() => import.meta.env.SERVER_BASE_URL, '/')
21
22
  }
22
23
 
23
24
  export default async ({ app, router }) => {
24
25
  const api = app.config.globalProperties.$axios
25
- const isProduction = process.env.ENVIRONMENT === 'production'
26
+ const isProduction = handleProcess(() => import.meta.env.ENVIRONMENT === 'production', false)
26
27
 
27
28
  // Defaults
28
29
  api.defaults.baseURL = getBaseURL(isProduction)
@@ -32,7 +33,7 @@ export default async ({ app, router }) => {
32
33
  * Permite que parâmetros de query string iniciados com $ sejam propagados para todas as rotas,
33
34
  * útil para ambiente de preview.
34
35
  */
35
- router.beforeEach((to, from, next) => {
36
+ router.beforeEach((to, from) => {
36
37
  // Extrai os parâmetros de query string iniciados com $ da rota de origem (from).
37
38
  const dollarParams = Object.fromEntries(Object.entries(from.query).filter(([key]) => key.startsWith('$')))
38
39
 
@@ -43,9 +44,7 @@ export default async ({ app, router }) => {
43
44
  const hasMissingDollarParams = Object.keys(dollarParams).some(key => !(key in to.query))
44
45
 
45
46
  if (hasMissingDollarParams) {
46
- next({ ...to, query: { ...dollarParams, ...to.query } })
47
- } else {
48
- next()
47
+ return { ...to, query: { ...dollarParams, ...to.query } }
49
48
  }
50
49
  })
51
50
 
@@ -1,11 +1,13 @@
1
1
  import { useHistory, setDefaultFiltersBeforeEach } from 'asteroid'
2
2
 
3
3
  export default ({ router }) => {
4
- router.beforeEach((to, from, next) => {
4
+ router.beforeEach((to, from) => {
5
5
  const { addRoute } = useHistory()
6
6
 
7
7
  addRoute(to)
8
8
 
9
- setDefaultFiltersBeforeEach(to, from, next)
9
+ return new Promise(resolve => {
10
+ setDefaultFiltersBeforeEach(to, from, result => resolve(result))
11
+ })
10
12
  })
11
13
  }
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(() => process.env.DEBUGGING, false)
7
- const debugEnv = handleProcess(() => process.env.DEBUG, '')
6
+ const debuggingEnv = handleProcess(() => import.meta.env.DEBUGGING, false)
7
+ const debugEnv = handleProcess(() => import.meta.env.DEBUG, '')
8
8
 
9
9
  debug.enable(debuggingEnv && !debugEnv ? 'asteroid-*:*' : debugEnv)
10
10
  }
@@ -1,3 +1,5 @@
1
+ import { handleProcess } from 'asteroid'
2
+
1
3
  export default function ({ router }) {
2
4
  const routes = [
3
5
  {
@@ -12,7 +14,7 @@ export default function ({ router }) {
12
14
  }
13
15
  ]
14
16
 
15
- if (process.env.MODE !== 'ssr') {
17
+ if (handleProcess(() => import.meta.env.MODE, '') !== 'ssr') {
16
18
  routes.push({
17
19
  name: 'NotFound',
18
20
  path: '/:catchAll(.*)*',
@@ -1,6 +1,8 @@
1
- import FontFaceObserver from 'fontfaceobserver'
1
+ import * as FontFaceObserverModule from 'fontfaceobserver'
2
2
  import asteroidConfig from 'asteroid-config'
3
3
 
4
+ const FontFaceObserver = FontFaceObserverModule.default || FontFaceObserverModule.FontFaceObserver || FontFaceObserverModule
5
+
4
6
  export default async () => {
5
7
  function setFontFaceObserver () {
6
8
  const font = new FontFaceObserver('Material Symbols Rounded')
@@ -4,19 +4,18 @@ 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, next) => onBeforeEach(to, from, next, router))
7
+ router.beforeEach((to, from) => onBeforeEach(to, from, 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
14
13
  * @param {import('vue-router').Router} router
15
14
  */
16
- async function onBeforeEach (to, from, next, router) {
15
+ async function onBeforeEach (to, from, router) {
17
16
  const useOverlay = to.matched.some(item => item.meta.useOverlay)
18
17
 
19
- if (!useOverlay) return next()
18
+ if (!useOverlay) return
20
19
 
21
20
  const { addRouteToHistory } = useOverlayNavigation()
22
21
 
@@ -83,8 +82,6 @@ async function onBeforeEach (to, from, next, router) {
83
82
  }
84
83
  }
85
84
 
86
- next()
87
-
88
85
  // functions
89
86
 
90
87
  /**
@@ -63,11 +63,11 @@ function setRouteCache (route) {
63
63
  }
64
64
 
65
65
  export default ({ router }) => {
66
- router.beforeEach((to, from, next) => {
66
+ router.beforeEach((to, from) => {
67
67
  if (!useHistory().hasPreviousRoute.value) {
68
68
  clearAll(to.name)
69
69
 
70
- return next()
70
+ return
71
71
  }
72
72
 
73
73
  setRouteCache(from)
@@ -83,11 +83,9 @@ export default ({ router }) => {
83
83
 
84
84
  isReplacingQuery = true
85
85
 
86
- next({ ...to, query: cachedQuery })
87
- } else {
88
- isReplacingQuery = false
89
-
90
- next()
86
+ return { ...to, query: cachedQuery }
91
87
  }
88
+
89
+ isReplacingQuery = false
92
90
  })
93
91
  }
@@ -1,10 +1,12 @@
1
1
  import { isLocalDevelopment, handleProcess } from 'asteroid'
2
2
 
3
3
  import Echo from 'laravel-echo'
4
- import Pusher from 'pusher-js'
4
+ import * as PusherModule from 'pusher-js'
5
5
 
6
6
  import { camelizeKeys } from 'humps'
7
7
 
8
+ const Pusher = PusherModule.default || PusherModule.Pusher || PusherModule
9
+
8
10
  /**
9
11
  * Função para setar configuração do Laravel Echo.
10
12
  *
@@ -14,16 +16,21 @@ export function setLaravelEcho (accessToken) {
14
16
  window.Pusher = Pusher
15
17
 
16
18
  const isLocal = isLocalDevelopment()
19
+ const serverBaseURL = handleProcess(() => import.meta.env.SERVER_BASE_URL, '/')
20
+ const normalizedServerBaseURL = serverBaseURL === '/'
21
+ ? ''
22
+ : serverBaseURL.replace(/\/$/, '')
17
23
 
18
24
  window.Echo = new Echo({
19
25
  broadcaster: 'pusher',
20
- key: isLocal ? 'app-key' : handleProcess(() => process.env.ABLY_KEY, ''),
26
+ key: isLocal ? 'app-key' : handleProcess(() => import.meta.env.ABLY_KEY, ''),
21
27
  wsHost: isLocal ? 'localhost' : 'realtime-pusher.ably.io',
22
28
  wsPort: isLocal ? 6001 : 443,
23
29
  disableStats: true,
24
30
  encrypted: true,
25
31
  cluster: isLocal ? 'mt1' : 'eu',
26
- authEndpoint: `${process.env.SERVER_BASE_URL}/broadcasting/auth`,
32
+ authEndpoint: `${normalizedServerBaseURL}/broadcasting/auth`,
33
+ enabledTransports: ['ws', 'wss'],
27
34
  auth: {
28
35
  headers: {
29
36
  Authorization: accessToken
package/src/index.js CHANGED
@@ -1,7 +1,6 @@
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'
5
4
  import { pathToFileURL } from 'url'
6
5
 
7
6
  const sourcePath = '~@appnave/quasar-app-extension-asteroid/src/'
@@ -28,19 +27,6 @@ function extendQuasar (quasar, api, asteroidConfigFile) {
28
27
  quasar.boot.push(...resolve('boot/notifications'))
29
28
  }
30
29
 
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
-
44
30
  // Adiciona todas classes do asteroid
45
31
  quasar.css.push(...resolve('index.scss'))
46
32
 
@@ -74,7 +60,7 @@ function extendQuasar (quasar, api, asteroidConfigFile) {
74
60
 
75
61
  export default async function (api) {
76
62
  api.compatibleWith('quasar', '^2.0.0')
77
- api.compatibleWith('date-fns', '^2.3.0')
63
+ api.compatibleWith('date-fns', '^4.1.0')
78
64
 
79
65
  const asteroid = 'node_modules/@appnave/quasar-ui-asteroid/src/asteroid.js'
80
66
  const asteroidComponents = 'node_modules/@appnave/quasar-ui-asteroid/src/components'
@@ -91,10 +77,11 @@ export default async function (api) {
91
77
  const { default: asteroidConfigFile } = await import(pathToFileURL(asteroidConfigPath).href)
92
78
 
93
79
  const unpluginVueComponentsConfig = {
94
- dirs: [api.resolve.app(asteroidComponents)], // ajusta o path para a lib
80
+ dirs: [api.resolve.app(asteroidComponents)],
95
81
  extensions: ['vue'],
96
82
  deep: true,
97
- dts: false // desativa geração de types
83
+ dts: false,
84
+ include: [/\.vue$/, /\.vue\?vue/]
98
85
  }
99
86
 
100
87
  const alias = {
@@ -108,45 +95,31 @@ export default async function (api) {
108
95
  'images/marker-icon.png': api.resolve.app('node_modules/leaflet/dist/images/marker-icon.png')
109
96
  }
110
97
 
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))
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))
150
123
  })
151
124
 
152
125
  api.extendQuasarConf(quasar => extendQuasar(quasar, api, asteroidConfigFile))