@uniweb/build 0.1.11 → 0.1.13

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/site/config.js +10 -72
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -24,10 +24,6 @@ import { existsSync, readFileSync } from 'node:fs'
24
24
  import { resolve, dirname } from 'node:path'
25
25
  import yaml from 'js-yaml'
26
26
 
27
- // Virtual module ID for the site entry
28
- const VIRTUAL_ENTRY_ID = 'virtual:uniweb-site-entry'
29
- const RESOLVED_VIRTUAL_ENTRY_ID = '\0' + VIRTUAL_ENTRY_ID
30
-
31
27
  /**
32
28
  * Detect foundation type from the foundation config value
33
29
  *
@@ -90,60 +86,6 @@ function detectFoundationType(foundation, siteRoot) {
90
86
  }
91
87
  }
92
88
 
93
- /**
94
- * Generate the virtual entry module code based on foundation config
95
- *
96
- * @param {{ type: string, url?: string, cssUrl?: string }} foundationInfo
97
- * @param {boolean} isRuntimeMode
98
- * @returns {string}
99
- */
100
- function generateEntryCode(foundationInfo, isRuntimeMode) {
101
- if (isRuntimeMode || foundationInfo.type === 'url') {
102
- // Runtime loading - foundation loaded dynamically
103
- const url = foundationInfo.url || '/foundation/foundation.js'
104
- const cssUrl = foundationInfo.cssUrl || '/foundation/assets/style.css'
105
-
106
- return `
107
- import { initRuntime } from '@uniweb/runtime'
108
-
109
- initRuntime({
110
- url: '${url}',
111
- cssUrl: '${cssUrl}'
112
- })
113
- `
114
- }
115
-
116
- // Bundled mode - foundation imported at build time
117
- return `
118
- import { initRuntime } from '@uniweb/runtime'
119
- import foundation from '#foundation'
120
- import '#foundation/styles'
121
-
122
- initRuntime(foundation)
123
- `
124
- }
125
-
126
- /**
127
- * Create the virtual entry plugin
128
- */
129
- function virtualEntryPlugin(foundationInfo, isRuntimeMode) {
130
- const entryCode = generateEntryCode(foundationInfo, isRuntimeMode)
131
-
132
- return {
133
- name: 'uniweb:virtual-entry',
134
- resolveId(id) {
135
- if (id === VIRTUAL_ENTRY_ID) {
136
- return RESOLVED_VIRTUAL_ENTRY_ID
137
- }
138
- },
139
- load(id) {
140
- if (id === RESOLVED_VIRTUAL_ENTRY_ID) {
141
- return entryCode
142
- }
143
- }
144
- }
145
- }
146
-
147
89
  /**
148
90
  * Read and parse site.yml configuration
149
91
  *
@@ -220,9 +162,6 @@ export async function defineSiteConfig(options = {}) {
220
162
 
221
163
  // Build the plugins array
222
164
  const plugins = [
223
- // Virtual entry module
224
- virtualEntryPlugin(foundationInfo, isRuntimeMode),
225
-
226
165
  // Standard plugins
227
166
  tailwindcss(),
228
167
  react(),
@@ -259,20 +198,20 @@ export async function defineSiteConfig(options = {}) {
259
198
  alias['#foundation'] = foundationInfo.name
260
199
  }
261
200
 
262
- // Merge with user overrides
263
- const resolveConfig = {
264
- alias: {
265
- ...alias,
266
- ...resolveOverrides.alias
267
- },
268
- ...resolveOverrides
201
+ // Build foundation config for runtime
202
+ const foundationConfig = {
203
+ mode: isRuntimeMode ? 'runtime' : 'bundled',
204
+ url: foundationInfo.url || '/foundation/foundation.js',
205
+ cssUrl: foundationInfo.cssUrl || '/foundation/assets/style.css'
269
206
  }
270
- delete resolveConfig.alias // We'll add it back properly
271
- resolveConfig.alias = { ...alias, ...resolveOverrides.alias }
272
207
 
273
208
  return {
274
209
  plugins,
275
210
 
211
+ define: {
212
+ __FOUNDATION_CONFIG__: JSON.stringify(foundationConfig)
213
+ },
214
+
276
215
  resolve: {
277
216
  alias: {
278
217
  ...alias,
@@ -291,8 +230,7 @@ export async function defineSiteConfig(options = {}) {
291
230
  },
292
231
 
293
232
  optimizeDeps: {
294
- include: ['react', 'react-dom', 'react-dom/client', 'react-router-dom'],
295
- exclude: ['virtual:uniweb-site-entry']
233
+ include: ['react', 'react-dom', 'react-dom/client', 'react-router-dom']
296
234
  },
297
235
 
298
236
  ...restOptions