@uniweb/build 0.7.1 → 0.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/build",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Build tooling for the Uniweb Component Web Platform",
5
5
  "type": "module",
6
6
  "exports": {
@@ -51,8 +51,8 @@
51
51
  },
52
52
  "optionalDependencies": {
53
53
  "@uniweb/content-reader": "1.1.2",
54
- "@uniweb/schemas": "0.2.1",
55
- "@uniweb/runtime": "0.6.0"
54
+ "@uniweb/runtime": "0.6.0",
55
+ "@uniweb/schemas": "0.2.1"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
package/src/schema.js CHANGED
@@ -476,14 +476,31 @@ export async function buildSchema(srcDir, componentPaths) {
476
476
  // Discover layouts from src/layouts/
477
477
  const layouts = await discoverLayoutsInPath(srcDir)
478
478
 
479
+ // Determine extension role
480
+ const isExtension = !!foundationConfig.extension
481
+
482
+ // Warn if extension declares things it shouldn't
483
+ if (isExtension) {
484
+ if (foundationConfig.vars && Object.keys(foundationConfig.vars).length > 0) {
485
+ console.warn(`Warning: Extension declares theme variables (vars). Extensions don't define theme variables — the primary foundation owns those.`)
486
+ }
487
+ if (Object.keys(layouts).length > 0) {
488
+ console.warn(`Warning: Extension provides layouts. Extensions don't provide layouts — the primary foundation owns the layout.`)
489
+ }
490
+ }
491
+
492
+ // Build _self, stripping the raw extension boolean in favor of normalized role
493
+ const { extension: _ext, ...configWithoutExtension } = foundationConfig
494
+
479
495
  return {
480
496
  _self: {
481
- ...foundationConfig,
497
+ ...configWithoutExtension,
482
498
  ...identity,
483
499
  // foundation.js overrides package.json for editor-facing identity
484
500
  ...(foundationConfig.name && { name: foundationConfig.name }),
485
501
  ...(foundationConfig.description && { description: foundationConfig.description }),
486
502
  ...(foundationConfig.defaultLayout && { defaultLayout: foundationConfig.defaultLayout }),
503
+ ...(isExtension && { role: 'extension' }),
487
504
  },
488
505
  // Layout metadata (full, for editor)
489
506
  ...(Object.keys(layouts).length > 0 && { _layouts: layouts }),
@@ -348,8 +348,18 @@ export async function defineSiteConfig(options = {}) {
348
348
  isBuild = config.command === 'build'
349
349
  },
350
350
 
351
- resolveId(id) {
351
+ resolveId(id, importer) {
352
352
  if (id.startsWith(IMPORT_MAP_PREFIX)) return id
353
+ // Bare specifiers inside our virtual modules (e.g. '@uniweb/core' re-exported
354
+ // from '\0importmap:@uniweb/core') can't be resolved by Rollup because virtual
355
+ // modules have no filesystem context. Resolve from the foundation directory where
356
+ // @uniweb/core is a direct dependency (the site may not have it under pnpm strict).
357
+ if (importer?.startsWith(IMPORT_MAP_PREFIX) && IMPORT_MAP_EXTERNALS.includes(id)) {
358
+ const resolveFrom = foundationInfo.path
359
+ ? resolve(foundationInfo.path, 'package.json')
360
+ : resolve(siteRoot, 'main.js')
361
+ return this.resolve(id, resolveFrom, { skipSelf: true })
362
+ }
353
363
  },
354
364
 
355
365
  async load(id) {