@uniweb/core 0.3.8 → 0.3.9

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/website.js +17 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/core",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
5
5
  "type": "module",
6
6
  "exports": {
package/src/website.js CHANGED
@@ -76,6 +76,9 @@ export default class Website {
76
76
  // Route translations: locale → { forward, reverse } maps
77
77
  this._routeTranslations = this._buildRouteTranslations(config)
78
78
 
79
+ // Deployment base path (set by runtime via setBasePath())
80
+ this.basePath = ''
81
+
79
82
  // Versioned scopes: route → { versions, latestId }
80
83
  // Scopes are routes where versioning starts (e.g., '/docs')
81
84
  this.versionedScopes = versionedScopes
@@ -505,6 +508,20 @@ export default class Website {
505
508
  }
506
509
  }
507
510
 
511
+ /**
512
+ * Set the deployment base path
513
+ * Called by runtime during initialization from Vite's BASE_URL
514
+ *
515
+ * @param {string} path - The base path (e.g., '/templates/international')
516
+ */
517
+ setBasePath(path) {
518
+ if (!path || path === '/') {
519
+ this.basePath = ''
520
+ } else {
521
+ this.basePath = path.endsWith('/') ? path.slice(0, -1) : path
522
+ }
523
+ }
524
+
508
525
  /**
509
526
  * Get remote layout component from foundation config
510
527
  */