@eodash/eodash 5.0.0-alpha.1.11 → 5.0.0-alpha.1.12

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.
@@ -2,17 +2,17 @@
2
2
 
3
3
  import vue from '@vitejs/plugin-vue';
4
4
  import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify';
5
- import virtual, { updateVirtualModule } from 'vite-plugin-virtual'
6
5
  import { fileURLToPath, URL } from 'url';
7
6
  import {
8
7
  runtimeConfigPath,
9
8
  appPath, entryPath,
10
9
  cachePath, publicPath, userConfig,
11
- buildTargetPath
10
+ buildTargetPath,
11
+ logger,
12
+ rootPath
12
13
  } from "./utils.js";
13
14
  import { readFile } from "fs/promises";
14
15
  import { defineConfig, searchForWorkspaceRoot } from "vite"
15
- import { getUserModules } from './utils.js';
16
16
  import { existsSync } from 'fs';
17
17
  import path from "path";
18
18
 
@@ -33,10 +33,6 @@ export const indexHtml = `
33
33
  </body>
34
34
  </html>`
35
35
 
36
- /**
37
- * @type {import('vite').Plugin | null}
38
- */
39
- let virtualPlugin = null;
40
36
  export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(defineConfig(async ({ mode, command }) => {
41
37
  return {
42
38
  base: userConfig.base ?? '',
@@ -57,14 +53,15 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
57
53
  (mode === "development" && {
58
54
  name: "inject-html",
59
55
  configureServer
60
- }),
61
- virtualPlugin = virtual(await getUserModules())
56
+ })
62
57
  ],
58
+ customLogger: logger,
63
59
  define: { 'process.env': {} },
64
60
  resolve: {
65
61
  alias: {
66
62
  '@': fileURLToPath(new URL('../core', import.meta.url)),
67
63
  '^': fileURLToPath(new URL('../widgets', import.meta.url)),
64
+ "user:config": entryPath
68
65
  },
69
66
  extensions: ['.js', '.json', '.jsx', '.mjs', '.ts', '.tsx', '.vue'],
70
67
  },
@@ -105,12 +102,26 @@ export const serverConfig = /** @type {import('vite').UserConfigFnPromise}*/(def
105
102
  async function configureServer(server) {
106
103
  server.watcher.add([entryPath, runtimeConfigPath])
107
104
 
105
+ let updatedPath = ''
106
+ const loggerInfo = logger.info
107
+ logger.info = (msg, options) => {
108
+ if (msg.includes('core')) {
109
+ const removedPath = msg.split('/')[0].split(" ")
110
+ removedPath.pop()
111
+ const updatedMsg = removedPath.join(" ") + " " + updatedPath.replace(rootPath, "")
112
+
113
+ return loggerInfo(updatedMsg, options)
114
+ }
115
+ return loggerInfo(msg, options)
116
+ }
117
+
108
118
  server.watcher.on('change', async (path) => {
109
- if (path == runtimeConfigPath) {
110
- server.hot.send('reload')
111
- } else if (path === entryPath) {
112
- updateVirtualModule(virtualPlugin, 'user:config',
113
- await getUserModules().then(modules => modules['user:config']))
119
+ updatedPath = path
120
+ if (path === runtimeConfigPath) {
121
+ server.hot.send({
122
+ type: 'full-reload',
123
+ path: path
124
+ })
114
125
  }
115
126
  })
116
127
 
package/bin/utils.js CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { readFile } from 'fs/promises';
4
3
  import { existsSync, readFileSync } from 'fs';
5
4
  import path from 'path';
6
5
  import { fileURLToPath } from 'url';
7
- import { searchForWorkspaceRoot } from 'vite';
6
+ import { searchForWorkspaceRoot, createLogger } from 'vite';
8
7
  import { Command } from 'commander';
9
8
 
10
9
  export const rootPath = searchForWorkspaceRoot(process.cwd());
@@ -58,6 +57,8 @@ export const appPath = fileURLToPath(new URL("..", import.meta.url)),
58
57
  cachePath = userConfig.cacheDir ? path.resolve(rootPath, userConfig.cacheDir) : path.join(dotEodashPath, 'cache');
59
58
 
60
59
 
60
+ export const logger = createLogger()
61
+
61
62
  /**
62
63
  * @param {Options} options
63
64
  * @param {string | undefined} command
@@ -86,15 +87,3 @@ async function getUserConfig(options, command) {
86
87
  runtime: options.runtime ?? config?.runtime
87
88
  }
88
89
  }
89
-
90
- export const getUserModules = async () => {
91
- /** @type {Record<string,string>} */
92
- let userModules = {}
93
- const indexJs = await readFile(entryPath, 'utf-8').catch(() => {
94
- if (!existsSync(runtimeConfigPath)) {
95
- console.error(new Error("no eodash configuration found"))
96
- }
97
- })
98
- userModules['user:config'] = typeof indexJs === 'string' ? indexJs : ''
99
- return userModules
100
- }
@@ -11,7 +11,6 @@ import { useSTAcStore } from '@/store/stac';
11
11
  import { defineAsyncComponent } from "vue";
12
12
  import { useDisplay, useLayout } from "vuetify/lib/framework.mjs";
13
13
  import { loadFont } from '@/store/Actions'
14
- import { onUnmounted } from "vue";
15
14
 
16
15
 
17
16
  const eodashConfig = await useEodashRuntime()
@@ -31,15 +30,6 @@ const TemplateComponent = smAndDown.value ?
31
30
  const HeaderComponent = defineAsyncComponent(() => import(`@/components/Header.vue`))
32
31
  const FooterComponent = defineAsyncComponent(() => import(`@/components/Footer.vue`))
33
32
  const { mainRect } = useLayout()
34
-
35
- onUnmounted(() => {
36
- theme.global.name.value = 'light'
37
- })
38
-
39
- import.meta.hot?.on('reload', () => {
40
- window.location.reload()
41
- })
42
-
43
33
  </script>
44
34
 
45
35
  <style scoped lang="scss">
@@ -47,4 +37,3 @@ import.meta.hot?.on('reload', () => {
47
37
  font-family: v-bind('fontFamily');
48
38
  }
49
39
  </style>
50
- @/composables/DefineEodash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eodash/eodash",
3
- "version": "5.0.0-alpha.1.11",
3
+ "version": "5.0.0-alpha.1.12",
4
4
  "type": "module",
5
5
  "types": "./core/types.d.ts",
6
6
  "files": [
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "browser": "./core/main.js",
18
18
  "scripts": {
19
- "dev": "npx eodash dev",
19
+ "dev": "npx eodash dev --entryPoint core/eodash.js",
20
20
  "build": "npx eodash build",
21
21
  "check": "vue-tsc --noEmit --skipLibCheck && eslint .",
22
22
  "check:lint": "eslint .",
@@ -38,7 +38,6 @@
38
38
  "sass": "^1.60.0",
39
39
  "stac-ts": "^1.0.3",
40
40
  "vite": "^5.1.5",
41
- "vite-plugin-virtual": "^0.3.0",
42
41
  "vite-plugin-vuetify": "^2.0.0",
43
42
  "vue": "^3.2.0",
44
43
  "vue-router": "^4.0.0",