@platformatic/vite 2.0.0-alpha.5 → 2.0.0-alpha.6

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/index.js CHANGED
@@ -21,8 +21,6 @@ export class ViteStackable extends BaseStackable {
21
21
  }
22
22
 
23
23
  async init () {
24
- globalThis[Symbol.for('plt.runtime.itc')].handle('getServiceMeta', this.getMeta.bind(this))
25
-
26
24
  this.#vite = dirname(createRequire(this.root).resolve('vite'))
27
25
  const vitePackage = JSON.parse(await readFile(resolve(this.#vite, 'package.json'), 'utf-8'))
28
26
 
@@ -54,7 +52,7 @@ export class ViteStackable extends BaseStackable {
54
52
  https,
55
53
  cors,
56
54
  origin: 'http://localhost',
57
- hmr: true,
55
+ hmr: true
58
56
  }
59
57
 
60
58
  // Require Vite
@@ -70,7 +68,7 @@ export class ViteStackable extends BaseStackable {
70
68
  logLevel: this.logger.level,
71
69
  clearScreen: false,
72
70
  optimizeDeps: { force: false },
73
- server: serverOptions,
71
+ server: serverOptions
74
72
  })
75
73
 
76
74
  await this.#app.listen()
@@ -85,7 +83,7 @@ export class ViteStackable extends BaseStackable {
85
83
  /* c8 ignore next 5 */
86
84
  async getWatchConfig () {
87
85
  return {
88
- enabled: false,
86
+ enabled: false
89
87
  }
90
88
  }
91
89
 
@@ -99,10 +97,14 @@ export class ViteStackable extends BaseStackable {
99
97
  tcp: true,
100
98
  url: this.url,
101
99
  prefix: this.#basePath,
102
- wantsAbsoluteUrls: true,
103
- },
100
+ wantsAbsoluteUrls: true
101
+ }
104
102
  }
105
103
  }
104
+
105
+ _getVite () {
106
+ return this.#app
107
+ }
106
108
  }
107
109
 
108
110
  export class ViteSSRStackable extends NodeStackable {
@@ -115,20 +117,18 @@ export class ViteSSRStackable extends NodeStackable {
115
117
  }
116
118
 
117
119
  async init () {
118
- globalThis[Symbol.for('plt.runtime.itc')].handle('getServiceMeta', this.getMeta.bind(this))
119
-
120
120
  const config = this.configManager.current
121
121
 
122
122
  this.#basePath = config.application?.basePath
123
123
  ? `/${config.application?.basePath}`.replaceAll(/\/+/g, '/').replace(/\/$/, '')
124
124
  : ''
125
125
 
126
- globalThis.platformatic = {
126
+ this.registerGlobals({
127
127
  // Always use URL to avoid serialization problem in Windows
128
128
  root: pathToFileURL(this.root),
129
129
  basePath: this.#basePath,
130
- logger: { id: this.id, level: this.logger.level },
131
- }
130
+ logger: { id: this.id, level: this.logger.level }
131
+ })
132
132
  }
133
133
 
134
134
  async start ({ listen }) {
@@ -152,8 +152,8 @@ export class ViteSSRStackable extends NodeStackable {
152
152
  tcp: true,
153
153
  url: this.url,
154
154
  prefix: this.#basePath,
155
- wantsAbsoluteUrls: true,
156
- },
155
+ wantsAbsoluteUrls: true
156
+ }
157
157
  }
158
158
  }
159
159
  }
@@ -190,9 +190,9 @@ export async function buildStackable (opts) {
190
190
  export default {
191
191
  configType: 'vite',
192
192
  configManagerConfig: {
193
- transformConfig,
193
+ transformConfig
194
194
  },
195
195
  buildStackable,
196
196
  schema,
197
- version: packageJson.version,
197
+ version: packageJson.version
198
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/vite",
3
- "version": "2.0.0-alpha.5",
3
+ "version": "2.0.0-alpha.6",
4
4
  "description": "Platformatic Vite Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -16,25 +16,25 @@
16
16
  "homepage": "https://github.com/platformatic/platformatic#readme",
17
17
  "dependencies": {
18
18
  "semver": "^7.6.3",
19
- "@platformatic/basic": "2.0.0-alpha.5",
20
- "@platformatic/config": "2.0.0-alpha.5",
21
- "@platformatic/node": "2.0.0-alpha.5",
22
- "@platformatic/utils": "2.0.0-alpha.5"
19
+ "@platformatic/basic": "2.0.0-alpha.6",
20
+ "@platformatic/node": "2.0.0-alpha.6",
21
+ "@platformatic/config": "2.0.0-alpha.6",
22
+ "@platformatic/utils": "2.0.0-alpha.6"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@fastify/vite": "^6.0.7",
26
26
  "borp": "^0.17.0",
27
27
  "eslint": "9",
28
28
  "fastify": "^4.28.1",
29
+ "json-schema-to-typescript": "^15.0.1",
29
30
  "neostandard": "^0.11.1",
30
- "json-schema-to-typescript": "^15.0.0",
31
31
  "react": "^18.3.1",
32
32
  "react-dom": "^18.3.1",
33
33
  "typescript": "^5.5.4",
34
34
  "vite": "^5.4.0",
35
35
  "ws": "^8.18.0",
36
- "@platformatic/composer": "2.0.0-alpha.5",
37
- "@platformatic/service": "2.0.0-alpha.5"
36
+ "@platformatic/composer": "2.0.0-alpha.6",
37
+ "@platformatic/service": "2.0.0-alpha.6"
38
38
  },
39
39
  "scripts": {
40
40
  "test": "npm run lint && borp --concurrency=1 --timeout=180000",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/vite/2.0.0-alpha.5.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/vite/2.0.0-alpha.6.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Vite Stackable",
5
5
  "type": "object",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://schemas.platformatic.dev/@platformatic/basic/2.0.0.json",
2
+ "$schema": "https://schemas.platformatic.dev/@platformatic/vite/2.0.0.json",
3
3
  "server": {
4
4
  "logger": {
5
5
  "level": "error"