@platformatic/vite 3.26.0 → 3.28.0-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.
package/lib/capability.js CHANGED
@@ -6,9 +6,9 @@ import {
6
6
  ensureTrailingSlash,
7
7
  errors,
8
8
  getServerUrl,
9
- importFile,
10
- resolvePackage
9
+ importFile
11
10
  } from '@platformatic/basic'
11
+ import { resolvePackageViaCJS } from '@platformatic/basic/lib/utils.js'
12
12
  import { ensureLoggableError } from '@platformatic/foundation'
13
13
  import { NodeCapability } from '@platformatic/node'
14
14
  import fastify from 'fastify'
@@ -38,7 +38,7 @@ export class ViteCapability extends BaseCapability {
38
38
  return
39
39
  }
40
40
 
41
- this.#vite = dirname(resolvePackage(this.root, 'vite'))
41
+ this.#vite = dirname(await resolvePackageViaCJS(this.root, 'vite'))
42
42
 
43
43
  // In Vite 6, module resolving changed, adjust it
44
44
  if (!existsSync(resolve(this.#vite, 'dist/node/index.js'))) {
@@ -95,12 +95,12 @@ export class ViteCapability extends BaseCapability {
95
95
  }
96
96
 
97
97
  await this.init()
98
- const { build } = await importFile(resolve(this.#vite, 'dist/node/index.js'))
98
+ const { build, createBuilder } = await importFile(resolve(this.#vite, 'dist/node/index.js'))
99
99
 
100
100
  try {
101
101
  globalThis.platformatic.isBuilding = true
102
102
 
103
- await build({
103
+ const buildOptions = {
104
104
  root: this.root,
105
105
  base: basePath,
106
106
  mode: 'production',
@@ -118,7 +118,15 @@ export class ViteCapability extends BaseCapability {
118
118
  }
119
119
  }
120
120
  ]
121
- })
121
+ }
122
+
123
+ // createBuilder was added in Vite 6 and might be needed for multi environment frameworks like TanStack
124
+ if (createBuilder) {
125
+ const builder = await createBuilder(buildOptions, null)
126
+ await builder.buildApp()
127
+ } else {
128
+ await build(buildOptions)
129
+ }
122
130
  } finally {
123
131
  globalThis.platformatic.isBuilding = false
124
132
  }
@@ -361,19 +369,19 @@ export class ViteSSRCapability extends NodeCapability {
361
369
 
362
370
  await this.init()
363
371
 
364
- let vite = dirname(resolvePackage(this.root, 'vite'))
372
+ let vite = dirname(await resolvePackageViaCJS(this.root, 'vite'))
365
373
  // In Vite 6, module resolving changed, adjust it
366
374
  if (!existsSync(resolve(vite, 'dist/node/index.js'))) {
367
375
  vite = resolve(vite, '../..')
368
376
  }
369
377
 
370
- const { build } = await importFile(resolve(vite, 'dist/node/index.js'))
378
+ const { build, createBuilder } = await importFile(resolve(vite, 'dist/node/index.js'))
371
379
 
372
380
  // Build the client
373
381
  try {
374
382
  globalThis.platformatic.isBuilding = true
375
383
 
376
- await build({
384
+ const buildOptions = {
377
385
  root: resolve(this.root, clientDirectory),
378
386
  base: basePath,
379
387
  mode: 'production',
@@ -392,7 +400,15 @@ export class ViteSSRCapability extends NodeCapability {
392
400
  }
393
401
  }
394
402
  ]
395
- })
403
+ }
404
+
405
+ // createBuilder was added in Vite 6 and might be needed for multi environment frameworks like TanStack
406
+ if (createBuilder) {
407
+ const builder = await createBuilder(buildOptions, null)
408
+ await builder.buildApp()
409
+ } else {
410
+ await build(buildOptions)
411
+ }
396
412
  } finally {
397
413
  globalThis.platformatic.isBuilding = false
398
414
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/vite",
3
- "version": "3.26.0",
3
+ "version": "3.28.0-alpha.1",
4
4
  "description": "Platformatic Vite Capability",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -18,9 +18,9 @@
18
18
  "@fastify/static": "^8.0.0",
19
19
  "fastify": "^5.0.0",
20
20
  "semver": "^7.6.3",
21
- "@platformatic/basic": "3.26.0",
22
- "@platformatic/node": "3.26.0",
23
- "@platformatic/foundation": "3.26.0"
21
+ "@platformatic/basic": "3.28.0-alpha.1",
22
+ "@platformatic/node": "3.28.0-alpha.1",
23
+ "@platformatic/foundation": "3.28.0-alpha.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "cleaner-spec-reporter": "^0.5.0",
@@ -32,8 +32,8 @@
32
32
  "typescript": "^5.5.4",
33
33
  "vite": "^7.1.4",
34
34
  "ws": "^8.18.0",
35
- "@platformatic/gateway": "3.26.0",
36
- "@platformatic/service": "3.26.0"
35
+ "@platformatic/gateway": "3.28.0-alpha.1",
36
+ "@platformatic/service": "3.28.0-alpha.1"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22.19.0"
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/vite/3.26.0.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/vite/3.28.0-alpha.1.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Vite Config",
5
5
  "type": "object",