@platformatic/vite 2.2.1 → 2.2.2-alpha.1

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.
Files changed (3) hide show
  1. package/index.js +17 -36
  2. package/package.json +7 -7
  3. package/schema.json +1 -1
package/index.js CHANGED
@@ -125,29 +125,14 @@ export class ViteStackable extends BaseStackable {
125
125
  }
126
126
 
127
127
  getMeta () {
128
- let composer = { prefix: this.servicePrefix, wantsAbsoluteUrls: true, needsRootRedirect: true }
129
-
130
- if (this.isProduction) {
131
- composer = {
132
- tcp: typeof this.url !== 'undefined',
133
- url: this.url,
134
- prefix: (this.subprocessConfig?.base ?? this.#basePath).replace(/(^\/)|(\/$)/g, ''),
135
- wantsAbsoluteUrls: true,
136
- needsRootRedirect: true
137
- }
138
- } else if (this.url) {
139
- if (!this.#basePath) {
140
- const config = this.subprocessConfig ?? this.#app.config
141
- this.#basePath = config.base.replace(/(^\/)|(\/$)/g, '')
142
- }
143
-
144
- composer = {
145
- tcp: true,
146
- url: this.url,
147
- prefix: this.#basePath.replace(/(^\/)|(\/$)/g, ''),
148
- wantsAbsoluteUrls: true,
149
- needsRootRedirect: true
150
- }
128
+ const config = this.subprocessConfig ?? this.#app?.config
129
+
130
+ const composer = {
131
+ tcp: typeof this.url !== 'undefined',
132
+ url: this.url,
133
+ prefix: this.basePath ?? config?.base ?? this.#basePath,
134
+ wantsAbsoluteUrls: true,
135
+ needsRootRedirect: true
151
136
  }
152
137
 
153
138
  return { composer }
@@ -370,20 +355,16 @@ export class ViteSSRStackable extends NodeStackable {
370
355
  getMeta () {
371
356
  let composer = { prefix: this.servicePrefix, wantsAbsoluteUrls: true, needsRootRedirect: true }
372
357
 
373
- if (this.url) {
374
- if (!this.#basePath) {
375
- const application = this._getApplication()
376
- const config = application.vite.devServer?.config ?? application.vite.config.vite
377
- this.#basePath = (config.base ?? '').replace(/(^\/)|(\/$)/g, '')
378
- }
358
+ const vite = this._getApplication()?.vite
359
+ const config = vite?.devServer?.config ?? vite?.config.vite
360
+ const applicationBasePath = config?.base
379
361
 
380
- composer = {
381
- tcp: true,
382
- url: this.url,
383
- prefix: this.#basePath ?? this.servicePrefix,
384
- wantsAbsoluteUrls: true,
385
- needsRootRedirect: true
386
- }
362
+ composer = {
363
+ tcp: typeof this.url !== 'undefined',
364
+ url: this.url,
365
+ prefix: this.basePath ?? applicationBasePath ?? this.#basePath,
366
+ wantsAbsoluteUrls: true,
367
+ needsRootRedirect: true
387
368
  }
388
369
 
389
370
  return { composer }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/vite",
3
- "version": "2.2.1",
3
+ "version": "2.2.2-alpha.1",
4
4
  "description": "Platformatic Vite Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -18,10 +18,10 @@
18
18
  "@fastify/static": "^8.0.0",
19
19
  "fastify": "^5.0.0",
20
20
  "semver": "^7.6.3",
21
- "@platformatic/basic": "2.2.1",
22
- "@platformatic/config": "2.2.1",
23
- "@platformatic/node": "2.2.1",
24
- "@platformatic/utils": "2.2.1"
21
+ "@platformatic/basic": "2.2.2-alpha.1",
22
+ "@platformatic/utils": "2.2.2-alpha.1",
23
+ "@platformatic/config": "2.2.2-alpha.1",
24
+ "@platformatic/node": "2.2.2-alpha.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@fastify/vite": "^7.0.1",
@@ -34,8 +34,8 @@
34
34
  "typescript": "^5.5.4",
35
35
  "vite": "^5.4.0",
36
36
  "ws": "^8.18.0",
37
- "@platformatic/composer": "2.2.1",
38
- "@platformatic/service": "2.2.1"
37
+ "@platformatic/service": "2.2.2-alpha.1",
38
+ "@platformatic/composer": "2.2.2-alpha.1"
39
39
  },
40
40
  "scripts": {
41
41
  "test": "npm run lint && borp --concurrency=1 --no-timeout",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/vite/2.2.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/vite/2.2.2-alpha.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Vite Stackable",
5
5
  "type": "object",