@open-pioneer/vite-plugin-pioneer 0.2.3 → 0.2.4
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/client.d.ts +7 -2
- package/dist/index.js +14 -13
- package/dist/index.js.map +3 -3
- package/package.json +3 -3
package/client.d.ts
CHANGED
|
@@ -16,8 +16,8 @@ declare module "open-pioneer:app" {
|
|
|
16
16
|
*/
|
|
17
17
|
declare module "open-pioneer:react-hooks" {
|
|
18
18
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
19
|
-
import { type ServiceType, type InterfaceName } from "@open-pioneer/runtime";
|
|
20
|
-
import { type UseServiceOptions } from "@open-pioneer/react-integration";
|
|
19
|
+
import { type ServiceType, type InterfaceName, type PackageIntl } from "@open-pioneer/runtime";
|
|
20
|
+
import { type UseServiceOptions } from "@open-pioneer/runtime/react-integration";
|
|
21
21
|
export { type UseServiceOptions };
|
|
22
22
|
|
|
23
23
|
/**
|
|
@@ -49,4 +49,9 @@ declare module "open-pioneer:react-hooks" {
|
|
|
49
49
|
* Returns the properties of the calling component's package.
|
|
50
50
|
*/
|
|
51
51
|
export function useProperties(): Readonly<Record<string, unknown>>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Returns the i18n object for the calling component's package.
|
|
55
|
+
*/
|
|
56
|
+
export function useIntl(): PackageIntl;
|
|
52
57
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Te=Object.create;var F=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var ze=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var De=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},Y=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ze(t))!Je.call(e,a)&&a!==n&&F(e,a,{get:()=>t[a],enumerable:!(r=Ve(t,a))||r.enumerable});return e};var x=(e,t,n)=>(n=e!=null?Te(Ge(e)):{},Y(t||!e||!e.__esModule?F(n,"default",{value:e,enumerable:!0}):n,e)),Ke=e=>Y(F({},"__esModule",{value:!0}),e);var Bt={};De(Bt,{pioneer:()=>Kt});module.exports=Ke(Bt);var Ne=require("node:fs"),w=require("node:path"),$=require("vite");var Q=require("debug");function O(e){let t=(0,Q.debug)(e);return function(...r){t(...r)}}var X=x(require("@babel/generator")),M=x(require("@babel/template")),c=x(require("@babel/types"));var L=class{existing=new Map;generate(t){let n=Be(t),r=this.existing,a=r.get(n)??0;return r.set(n,a+1),a===0?n:`${n}_${a}`}};function Be(e){let t=e.replace(/[^A-Za-z0-9_]+/g,"_");return t=t.replace(/[\d_]+$/,""),/^\d/.test(t)&&(t="_"+t),t||"var"}var qe=M.default.statement(`
|
|
2
2
|
import { %%SERVICE_NAME%% as %%IMPORT_NAME%% } from %%IMPORT_SOURCE%%;
|
|
3
|
-
`),He=
|
|
3
|
+
`),He=M.default.expression(`
|
|
4
4
|
{
|
|
5
5
|
name: %%PACKAGE_NAME%%,
|
|
6
6
|
services: %%PACKAGE_SERVICES%%,
|
|
7
7
|
ui: %%PACKAGE_UI%%,
|
|
8
8
|
properties: %%PROPERTIES%%
|
|
9
9
|
}
|
|
10
|
-
`),We=
|
|
10
|
+
`),We=M.default.expression(`
|
|
11
11
|
{
|
|
12
12
|
name: %%SERVICE_NAME%%,
|
|
13
13
|
clazz: %%SERVICE_IMPORT%%,
|
|
14
14
|
provides: %%SERVICE_INTERFACES%%,
|
|
15
15
|
references: %%SERVICE_REFERENCES%%
|
|
16
16
|
}
|
|
17
|
-
`),
|
|
17
|
+
`),Ye=M.default.expression(`
|
|
18
18
|
{
|
|
19
19
|
name: %%INTERFACE_NAME%%,
|
|
20
20
|
qualifier: %%QUALIFIER%%
|
|
21
21
|
}
|
|
22
|
-
`),
|
|
22
|
+
`),Qe=M.default.expression(`
|
|
23
23
|
{
|
|
24
24
|
name: %%INTERFACE_NAME%%,
|
|
25
25
|
qualifier: %%QUALIFIER%%,
|
|
26
26
|
all: %%ALL%%
|
|
27
27
|
}
|
|
28
|
-
`),Ze=
|
|
28
|
+
`),Ze=M.default.expression(`
|
|
29
29
|
{
|
|
30
30
|
references: %%UI_REFERENCES%%
|
|
31
31
|
}
|
|
32
|
-
`),Xe=
|
|
32
|
+
`),Xe=M.default.expression(`
|
|
33
33
|
{
|
|
34
34
|
value: %%VALUE%%,
|
|
35
35
|
required: %%REQUIRED%%
|
|
36
36
|
}
|
|
37
37
|
`);function ee(e){let t=new L,n=c.objectExpression([]),r=[];for(let o of e){let i=et(o,{importServiceClass(s,p,l){let m=t.generate(s),g=qe({SERVICE_NAME:c.identifier(p),IMPORT_NAME:c.identifier(m),IMPORT_SOURCE:c.stringLiteral(l)});return r.push(g),m}});n.properties.push(c.objectProperty(c.stringLiteral(o.name),i))}let a=c.program([...r,c.exportDefaultDeclaration(n)]);return(0,X.default)(a).code}function et(e,t){let n=c.objectExpression([]);for(let i of e.config.services){if(!e.entryPointPath)throw new Error(`Package '${e.name}' must have a valid entry point (typically index.ts or index.js).
|
|
38
|
-
The entry point can be configured by setting the 'main' property in the package.json file.`);let s=t.importServiceClass(e.name+"_"+i.name,i.name,e.entryPointPath),p=We({SERVICE_NAME:c.stringLiteral(i.name),SERVICE_IMPORT:c.identifier(s),SERVICE_INTERFACES:c.arrayExpression(i.provides.map(l=>Qe({INTERFACE_NAME:c.stringLiteral(l.name),QUALIFIER:l.qualifier==null?te():c.stringLiteral(l.qualifier)}))),SERVICE_REFERENCES:c.objectExpression(Object.entries(i.references).map(([l,m])=>c.objectProperty(c.stringLiteral(l),Z(m))))});n.properties.push(c.objectProperty(c.stringLiteral(i.name),p))}let r=Ze({UI_REFERENCES:c.arrayExpression(e.config.ui.references.map(i=>Z(i)))}),a=c.objectExpression(e.config.properties.map(i=>c.objectProperty(c.stringLiteral(i.name),Xe({VALUE:D(i.defaultValue),REQUIRED:c.booleanLiteral(i.required)}))));return He({PACKAGE_NAME:c.stringLiteral(e.name),PACKAGE_SERVICES:n,PACKAGE_UI:r,PROPERTIES:a})}function D(e){if(e==null)return c.nullLiteral();if(typeof e=="string")return c.stringLiteral(e);if(typeof e=="number")return c.numericLiteral(e);if(typeof e=="boolean")return c.booleanLiteral(e);if(Array.isArray(e))return c.arrayExpression(e.map(t=>D(t)));if(typeof e=="object")return c.objectExpression(Object.entries(e).map(([t,n])=>c.objectProperty(c.stringLiteral(t),D(n))));throw new Error(`Unexpected value while serializing JSON: ${e}.`)}function Z(e){return Ye({INTERFACE_NAME:c.stringLiteral(e.name),QUALIFIER:e.qualifier?c.stringLiteral(e.qualifier):te(),ALL:c.booleanLiteral(e.all??!1)})}function te(){return c.unaryExpression("void",c.numericLiteral(0))}var N=require("fs/promises"),_=require("path"),v=require("vite");var f=class extends Error{};var j=I(require("node:fs")),T=require("node:path");function U(e){return j.promises.access(e,j.constants.F_OK).then(()=>!0).catch(()=>!1)}function ne(e,t){let n=(0,T.relative)(t,e);return!!(n&&!n.startsWith("..")&&!(0,T.isAbsolute)(n))}var A=class{values=new Map;jobs=new Map;provider;constructor(t){this.provider=t}invalidate(t){var a,o;let n=this.provider.getId(t),r=this.values.get(n);this.values.delete(n),this.jobs.delete(n),r&&((o=(a=this.provider).onInvalidate)==null||o.call(a,t,r))}async get(t,...n){var m;let r=this.provider,a=r.getId(t),o=this.values,i=o.get(a);if(i)return(m=r.onCachedReturn)==null||m.call(r,t,i),Promise.resolve(i);let s=this.jobs,p=s.get(a);if(p)return p;let l=r.getValue(t,...n);s.set(a,l);try{let g=await l;return s.get(a)===l&&o.set(a,g),g}finally{s.get(a)===l&&s.delete(a)}}};var ie=require("node:url");var d=require("zod"),re=require("zod-validation-error"),tt=d.z.union([d.z.string(),d.z.number(),d.z.boolean(),d.z.null()]),K=d.z.lazy(()=>d.z.union([tt,d.z.array(K),d.z.record(K)])),nt=d.z.strictObject({required:d.z.boolean().optional()}),ae=d.z.strictObject({name:d.z.string(),qualifier:d.z.string().optional(),all:d.z.boolean().optional()}),rt=d.z.strictObject({name:d.z.string(),qualifier:d.z.string().optional()}),at=d.z.strictObject({references:d.z.array(d.z.string().or(ae)).optional()}),ot=d.z.strictObject({provides:d.z.string().or(d.z.array(d.z.string().or(rt))).optional(),references:d.z.record(d.z.string(),d.z.string().or(ae)).optional()}),it=d.z.strictObject({styles:d.z.string().optional(),i18n:d.z.array(d.z.string()).optional(),services:d.z.record(d.z.string(),ot).optional(),ui:at.optional(),properties:d.z.record(d.z.string(),K).optional(),propertiesMeta:d.z.record(d.z.string(),nt).optional()});function oe(e){let t=it.safeParse(e);if(t.success)return t.data;throw(0,re.fromZodError)(t.error)}var B="build.config.mjs",st=0;async function se(e){let n=await import(`${(0,ie.pathToFileURL)(e)}?id=${++st}`);if(!n||!n.default)throw new Error("The module must contain a default export.");let r=n.default;return ct(r)}function ct(e){let t=oe(e);return dt(t)}var pt=/[\\/]build\.config\.mjs($|\?)/;function ce(e){return pt.test(e)}function dt(e){return{styles:e.styles,i18n:e.i18n,services:Object.entries(e.services??{}).map(([t,n])=>gt(t,n)),ui:ut(e.ui),properties:mt(e.properties,e.propertiesMeta)}}function gt(e,t){return{name:e,provides:lt(t.provides),references:ft(t.references)}}function lt(e){return e?typeof e=="string"?[{name:e}]:e.map(t=>typeof t=="string"?{name:t}:t):[]}function ft(e){return e?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,pe(n)])):{}}function pe(e){return typeof e=="string"?{name:e}:e}function ut(e){var t;return{references:((t=e==null?void 0:e.references)==null?void 0:t.map(pe))??[]}}function mt(e,t){var r;let n=[];for(let[a,o]of Object.entries(e??{})){let i=((r=t==null?void 0:t[a])==null?void 0:r.required)??!1;n.push({name:a,defaultValue:o,required:i})}return n}var de=require("fs/promises"),ge=require("js-yaml"),M=require("zod"),le=require("zod-validation-error");var q=M.z.lazy(()=>M.z.record(M.z.union([M.z.string(),q]))),Et=M.z.object({messages:q.or(M.z.null()).optional(),overrides:M.z.record(q).or(M.z.null()).optional()}).strict();async function fe(e){let t;try{t=await(0,de.readFile)(e,"utf-8")}catch(n){throw new f(`Failed to read ${e}: ${n}`)}try{let n=(0,ge.load)(t);return ht(n)}catch(n){throw new f(`Failed to parse ${e}: ${n}`)}}function ht(e){let t=Et.safeParse(e);if(!t.success)throw(0,le.fromZodError)(t.error);let n=t.data;return{messages:ue(n.messages??void 0),overrides:Pt(n.overrides??void 0)}}function ue(e){let t=new Map,n=[],r=o=>{for(let[i,s]of Object.entries(o))typeof s=="string"?a(i,s):s&&(n.push(i),r(s),n.pop())},a=(o,i)=>{let s=[...n,o].join(".");if(t.has(s))throw new Error(`Message '${s}' was already defined.`);t.set(s,i)};return e&&r(e),t}function Pt(e){let t=new Map;if(e)for(let[n,r]of Object.entries(e))t.set(n,ue(r));return t}var P=!!process.env.DEBUG,y=O("open-pioneer:metadata"),V=class{sourceRoot;packageMetadataCache;i18nCache;constructor(t){this.sourceRoot=t,this.packageMetadataCache=this.createPackageMetadataCache(),this.i18nCache=this.createI18nCache()}reset(){this.packageMetadataCache=this.createPackageMetadataCache(),this.i18nCache=this.createI18nCache()}onFileChanged(t){(xt(t)||ce(t))&&this.packageMetadataCache.invalidate((0,_.dirname)(t)),this.i18nCache.invalidate(t)}async getAppMetadata(t,n){P&&y(`Request for app metadata of ${n}`);let r=await this.getPackageMetadata(t,{type:"absolute",directory:n});if(!r)throw new f(`Failed to parse app metadata in ${n}. Ensure that the app is a valid local package.`);let a=Array.from(r.i18nPaths.keys()),o=new Map;o.set(r.name,r);let i=async(p,l)=>{let m=p.map(async g=>{let u=await this.getPackageMetadata(t,{type:"unresolved",packageName:g,importedFrom:l});u&&(o.has(u.name)||o.set(u.name,u),await i(u.dependencies,u.packageJsonPath))});return await Promise.all(m)};return await i(r.dependencies,r.packageJsonPath),{name:r.name,directory:r.directory,locales:a,packageJsonPath:r.packageJsonPath,packages:Array.from(o.values())}}async getPackageMetadata(t,n){P&&y(`Request for package metadata of ${Rt(n)}`);let r=await this.resolvePackageLocation(t,n);if(!kt(r,this.sourceRoot)){P&&y(`Skipping non-local package '${r}'.`);return}let a=await this.packageMetadataCache.get(r,t);me(a.watchFiles,t);for(let o of a.warnings)t.warn(o);return a.metadata}async getI18nFile(t,n){let{i18n:r,watchFiles:a}=await this.i18nCache.get(n,t);return me(a,t),r}async resolvePackageLocation(t,n){if(n.type==="absolute")return await(0,N.realpath)(n.directory);let r=`${n.packageName}/package.json`,a=await t.resolve(r,(0,v.normalizePath)(n.importedFrom),{skipSelf:!0});if(!a||a.external)throw new f(`Request for '${r}' did not result in a local file (required by '${n.importedFrom}').`);let o=await(0,N.realpath)((0,_.dirname)(a.id));return P&&y(`Found package '${n.packageName}' at ${o}`),o}createI18nCache(){return new A({getId(t){return(0,v.normalizePath)(t)},async getValue(t,n){return P&&y(`Loading i18n file ${t}`),n.addWatchFile(t),{i18n:await fe(t),watchFiles:new Set([t])}},onInvalidate(t){P&&y(`Removed cache entry for i18n file ${t}`)},onCachedReturn(t){P&&y(`Returning cached entry for i18n file ${t}`)}})}createPackageMetadataCache(){let t={_byName:new Map,getId(n){return(0,v.normalizePath)(n)},async getValue(n,r){P&&y(`Loading metadata for package at ${n}`);let a=new Set,o=[],i={resolve:r.resolve,addWatchFile(l){r.addWatchFile(l),a.add(l)},warn(l){o.push(typeof l=="string"?{message:l}:l)}},s=await yt(i,n);P&&y(`Metadata for '${s.name}': %O`,s);let p=this._byName.get(s.name);if(p&&(0,v.normalizePath)(p.directory)!==(0,v.normalizePath)(s.directory))throw new f(`Found package '${s.name}' at two different locations ${p.directory} and ${s.directory}`);return this._byName.set(s.name,s),{metadata:s,watchFiles:a,warnings:o}},onInvalidate(n,r){P&&y(`Removed cache entry for '${r.metadata.name}'`),this._byName.delete(r.metadata.name)},onCachedReturn(n,r){P&&y(`Returning cached metadata for '${r.metadata.name}'`)}};return new A(t)}};function me(e,t){for(let n of e)t.addWatchFile(n)}async function yt(e,t){var m;P&&y(`Visiting package directory ${t}.`);let n=(0,_.join)(t,"package.json");e.addWatchFile(n);let{name:r,dependencies:a}=await Ct(e,n),o=(0,_.join)(t,B),i;if(e.addWatchFile((0,v.normalizePath)(o)),await U(o))try{i=await se(o)}catch(g){let u=g.message||"Unknown error";throw new f(`Failed to load build config ${o}: ${u}`)}else throw new f(`Expected a ${B} in ${t}`);let s;if(i.services.length)try{s=(m=await e.resolve(t))==null?void 0:m.id}catch(g){e.warn(`Failed to resolve entry point for package ${t}: ${g}`)}let p;if(i.styles){try{p=await Mt(e,t,i.styles)}catch(g){throw new f(`Failed to resolve css file for package ${t}: ${g}`)}if(!p)throw new f(`Failed to find css file '${i.styles}' in ${t}`)}let l=new Map;if(i.i18n)for(let g of i.i18n){if(l.has(g))throw new f(`Locale '${g}' was defined twice in ${o}`);let u=(0,_.join)(t,"i18n",`${g}.yaml`);if(e.addWatchFile(u),!await U(u))throw new f(`i18n file '${u}' does not exist.`);l.set(g,(0,v.normalizePath)(u))}return{name:r,directory:t,packageJsonPath:n,entryPointPath:s,cssFilePath:p,i18nPaths:l,dependencies:a,config:i}}async function Ct(e,t){if(!await U(t))throw new f(`Expected a 'package.json' file at ${t}`);let n;try{n=JSON.parse(await(0,N.readFile)(t,"utf-8"))}catch(i){throw new f(`Failed to read ${t}: ${i}`)}let r=n.name;if(typeof r!="string")throw new f(`Expected 'name' to be a string in ${t}`);let a=n.dependencies??{};if(typeof a!="object")throw new f(`Expected a valid 'dependencies' object in ${t}`);let o=Object.keys(a);return{name:r,dependencies:o}}async function Mt(e,t,n){let r=await e.resolve(`./${n}`,`${t}/package.json`,{skipSelf:!0});return r==null?void 0:r.id}function Rt(e){switch(e.type){case"absolute":return`${e.directory}`;case"unresolved":return`'${e.packageName}' required by ${e.importedFrom}`}}var vt=/[\\/]node_modules[\\/]/;function kt(e,t){return ne(e,t)&&!vt.test(e)}var wt=/[\\/]package\.json($|\?)/;function xt(e){return wt.test(e)}function Ee(e){let t=n=>`@import ${JSON.stringify(n)};`;return e.filter(n=>!!n.cssFilePath).map(n=>t(n.cssFilePath)).join(`
|
|
39
|
-
`)}var he=require("node:path"),
|
|
38
|
+
The entry point can be configured by setting the 'main' property in the package.json file.`);let s=t.importServiceClass(e.name+"_"+i.name,i.name,e.entryPointPath),p=We({SERVICE_NAME:c.stringLiteral(i.name),SERVICE_IMPORT:c.identifier(s),SERVICE_INTERFACES:c.arrayExpression(i.provides.map(l=>Ye({INTERFACE_NAME:c.stringLiteral(l.name),QUALIFIER:l.qualifier==null?te():c.stringLiteral(l.qualifier)}))),SERVICE_REFERENCES:c.objectExpression(Object.entries(i.references).map(([l,m])=>c.objectProperty(c.stringLiteral(l),Z(m))))});n.properties.push(c.objectProperty(c.stringLiteral(i.name),p))}let r=Ze({UI_REFERENCES:c.arrayExpression(e.config.ui.references.map(i=>Z(i)))}),a=c.objectExpression(e.config.properties.map(i=>c.objectProperty(c.stringLiteral(i.name),Xe({VALUE:D(i.defaultValue),REQUIRED:c.booleanLiteral(i.required)}))));return He({PACKAGE_NAME:c.stringLiteral(e.name),PACKAGE_SERVICES:n,PACKAGE_UI:r,PROPERTIES:a})}function D(e){if(e==null)return c.nullLiteral();if(typeof e=="string")return c.stringLiteral(e);if(typeof e=="number")return c.numericLiteral(e);if(typeof e=="boolean")return c.booleanLiteral(e);if(Array.isArray(e))return c.arrayExpression(e.map(t=>D(t)));if(typeof e=="object")return c.objectExpression(Object.entries(e).map(([t,n])=>c.objectProperty(c.stringLiteral(t),D(n))));throw new Error(`Unexpected value while serializing JSON: ${e}.`)}function Z(e){return Qe({INTERFACE_NAME:c.stringLiteral(e.name),QUALIFIER:e.qualifier?c.stringLiteral(e.qualifier):te(),ALL:c.booleanLiteral(e.all??!1)})}function te(){return c.unaryExpression("void",c.numericLiteral(0))}var N=require("fs/promises"),_=require("path"),R=require("vite");var f=class extends Error{};var j=x(require("node:fs")),U=require("node:path");function T(e){return j.promises.access(e,j.constants.F_OK).then(()=>!0).catch(()=>!1)}function ne(e,t){let n=(0,U.relative)(t,e);return!!(n&&!n.startsWith("..")&&!(0,U.isAbsolute)(n))}var A=class{values=new Map;jobs=new Map;provider;constructor(t){this.provider=t}invalidate(t){var a,o;let n=this.provider.getId(t),r=this.values.get(n);this.values.delete(n),this.jobs.delete(n),r&&((o=(a=this.provider).onInvalidate)==null||o.call(a,t,r))}async get(t,...n){var m;let r=this.provider,a=r.getId(t),o=this.values,i=o.get(a);if(i)return(m=r.onCachedReturn)==null||m.call(r,t,i),Promise.resolve(i);let s=this.jobs,p=s.get(a);if(p)return p;let l=r.getValue(t,...n);s.set(a,l);try{let g=await l;return s.get(a)===l&&o.set(a,g),g}finally{s.get(a)===l&&s.delete(a)}}};var ie=require("node:url");var d=require("zod"),re=require("zod-validation-error"),tt=d.z.union([d.z.string(),d.z.number(),d.z.boolean(),d.z.null()]),K=d.z.lazy(()=>d.z.union([tt,d.z.array(K),d.z.record(K)])),nt=d.z.strictObject({required:d.z.boolean().optional()}),ae=d.z.strictObject({name:d.z.string(),qualifier:d.z.string().optional(),all:d.z.boolean().optional()}),rt=d.z.strictObject({name:d.z.string(),qualifier:d.z.string().optional()}),at=d.z.strictObject({references:d.z.array(d.z.string().or(ae)).optional()}),ot=d.z.strictObject({provides:d.z.string().or(d.z.array(d.z.string().or(rt))).optional(),references:d.z.record(d.z.string(),d.z.string().or(ae)).optional()}),it=d.z.strictObject({styles:d.z.string().optional(),i18n:d.z.array(d.z.string()).optional(),services:d.z.record(d.z.string(),ot).optional(),ui:at.optional(),properties:d.z.record(d.z.string(),K).optional(),propertiesMeta:d.z.record(d.z.string(),nt).optional()});function oe(e){let t=it.safeParse(e);if(t.success)return t.data;throw(0,re.fromZodError)(t.error)}var B="build.config.mjs",st=0;async function se(e){let n=await import(`${(0,ie.pathToFileURL)(e)}?id=${++st}`);if(!n||!n.default)throw new Error("The module must contain a default export.");let r=n.default;return ct(r)}function ct(e){let t=oe(e);return dt(t)}var pt=/[\\/]build\.config\.mjs($|\?)/;function ce(e){return pt.test(e)}function dt(e){return{styles:e.styles,i18n:e.i18n,services:Object.entries(e.services??{}).map(([t,n])=>gt(t,n)),ui:ut(e.ui),properties:mt(e.properties,e.propertiesMeta)}}function gt(e,t){return{name:e,provides:lt(t.provides),references:ft(t.references)}}function lt(e){return e?typeof e=="string"?[{name:e}]:e.map(t=>typeof t=="string"?{name:t}:t):[]}function ft(e){return e?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,pe(n)])):{}}function pe(e){return typeof e=="string"?{name:e}:e}function ut(e){var t;return{references:((t=e==null?void 0:e.references)==null?void 0:t.map(pe))??[]}}function mt(e,t){var r;let n=[];for(let[a,o]of Object.entries(e??{})){let i=((r=t==null?void 0:t[a])==null?void 0:r.required)??!1;n.push({name:a,defaultValue:o,required:i})}return n}var de=require("fs/promises"),ge=require("js-yaml"),I=require("zod"),le=require("zod-validation-error");var q=I.z.lazy(()=>I.z.record(I.z.union([I.z.string(),q]))),Et=I.z.strictObject({messages:q.nullish().optional(),overrides:I.z.record(q).nullish().optional()}).nullish();async function fe(e){let t;try{t=await(0,de.readFile)(e,"utf-8")}catch(n){throw new f(`Failed to read ${e}: ${n}`)}try{return ht(t)}catch(n){throw new f(`Failed to parse ${e}: ${n}`)}}function ht(e){let t=(0,ge.load)(e);return Pt(t)}function Pt(e){let t=Et.safeParse(e);if(!t.success)throw(0,le.fromZodError)(t.error);let n=t.data;return{messages:ue((n==null?void 0:n.messages)??void 0),overrides:yt((n==null?void 0:n.overrides)??void 0)}}function ue(e){let t=new Map,n=[],r=o=>{for(let[i,s]of Object.entries(o))typeof s=="string"?a(i,s):s&&(n.push(i),r(s),n.pop())},a=(o,i)=>{let s=[...n,o].join(".");if(t.has(s))throw new Error(`Message '${s}' was already defined.`);t.set(s,i)};return e&&r(e),t}function yt(e){let t=new Map;if(e)for(let[n,r]of Object.entries(e))t.set(n,ue(r));return t}var P=!!process.env.DEBUG,y=O("open-pioneer:metadata"),V=class{sourceRoot;packageMetadataCache;i18nCache;constructor(t){this.sourceRoot=t,this.packageMetadataCache=this.createPackageMetadataCache(),this.i18nCache=this.createI18nCache()}reset(){this.packageMetadataCache=this.createPackageMetadataCache(),this.i18nCache=this.createI18nCache()}onFileChanged(t){(It(t)||ce(t))&&this.packageMetadataCache.invalidate((0,_.dirname)(t)),this.i18nCache.invalidate(t)}async getAppMetadata(t,n){P&&y(`Request for app metadata of ${n}`);let r=await this.getPackageMetadata(t,{type:"absolute",directory:n});if(!r)throw new f(`Failed to parse app metadata in ${n}. Ensure that the app is a valid local package.`);let a=Array.from(r.i18nPaths.keys()),o=new Map;o.set(r.name,r);let i=async(p,l)=>{let m=p.map(async g=>{let u=await this.getPackageMetadata(t,{type:"unresolved",packageName:g,importedFrom:l});u&&(o.has(u.name)||o.set(u.name,u),await i(u.dependencies,u.packageJsonPath))});return await Promise.all(m)};return await i(r.dependencies,r.packageJsonPath),{name:r.name,directory:r.directory,locales:a,packageJsonPath:r.packageJsonPath,packages:Array.from(o.values())}}async getPackageMetadata(t,n){P&&y(`Request for package metadata of ${vt(n)}`);let r=await this.resolvePackageLocation(t,n);if(!wt(r,this.sourceRoot)){P&&y(`Skipping non-local package '${r}'.`);return}let a=await this.packageMetadataCache.get(r,t);me(a.watchFiles,t);for(let o of a.warnings)t.warn(o);return a.metadata}async getI18nFile(t,n){let{i18n:r,watchFiles:a}=await this.i18nCache.get(n,t);return me(a,t),r}async resolvePackageLocation(t,n){if(n.type==="absolute")return await(0,N.realpath)(n.directory);let r=`${n.packageName}/package.json`,a=await t.resolve(r,(0,R.normalizePath)(n.importedFrom),{skipSelf:!0});if(!a||a.external)throw new f(`Request for '${r}' did not result in a local file (required by '${n.importedFrom}').`);let o=await(0,N.realpath)((0,_.dirname)(a.id));return P&&y(`Found package '${n.packageName}' at ${o}`),o}createI18nCache(){return new A({getId(t){return(0,R.normalizePath)(t)},async getValue(t,n){return P&&y(`Loading i18n file ${t}`),n.addWatchFile(t),{i18n:await fe(t),watchFiles:new Set([t])}},onInvalidate(t){P&&y(`Removed cache entry for i18n file ${t}`)},onCachedReturn(t){P&&y(`Returning cached entry for i18n file ${t}`)}})}createPackageMetadataCache(){let t={_byName:new Map,getId(n){return(0,R.normalizePath)(n)},async getValue(n,r){P&&y(`Loading metadata for package at ${n}`);let a=new Set,o=[],i={resolve:r.resolve,addWatchFile(l){r.addWatchFile(l),a.add(l)},warn(l){o.push(typeof l=="string"?{message:l}:l)}},s=await Ct(i,n);P&&y(`Metadata for '${s.name}': %O`,s);let p=this._byName.get(s.name);if(p&&(0,R.normalizePath)(p.directory)!==(0,R.normalizePath)(s.directory))throw new f(`Found package '${s.name}' at two different locations ${p.directory} and ${s.directory}`);return this._byName.set(s.name,s),{metadata:s,watchFiles:a,warnings:o}},onInvalidate(n,r){P&&y(`Removed cache entry for '${r.metadata.name}'`),this._byName.delete(r.metadata.name)},onCachedReturn(n,r){P&&y(`Returning cached metadata for '${r.metadata.name}'`)}};return new A(t)}};function me(e,t){for(let n of e)t.addWatchFile(n)}async function Ct(e,t){var m;P&&y(`Visiting package directory ${t}.`);let n=(0,_.join)(t,"package.json");e.addWatchFile(n);let{name:r,dependencies:a}=await Mt(e,n),o=(0,_.join)(t,B),i;if(e.addWatchFile((0,R.normalizePath)(o)),await T(o))try{i=await se(o)}catch(g){let u=g.message||"Unknown error";throw new f(`Failed to load build config ${o}: ${u}`)}else throw new f(`Expected a ${B} in ${t}`);let s;if(i.services.length)try{s=(m=await e.resolve(t))==null?void 0:m.id}catch(g){e.warn(`Failed to resolve entry point for package ${t}: ${g}`)}let p;if(i.styles){try{p=await Rt(e,t,i.styles)}catch(g){throw new f(`Failed to resolve css file for package ${t}: ${g}`)}if(!p)throw new f(`Failed to find css file '${i.styles}' in ${t}`)}let l=new Map;if(i.i18n)for(let g of i.i18n){if(l.has(g))throw new f(`Locale '${g}' was defined twice in ${o}`);let u=(0,_.join)(t,"i18n",`${g}.yaml`);if(e.addWatchFile(u),!await T(u))throw new f(`i18n file '${u}' does not exist.`);l.set(g,(0,R.normalizePath)(u))}return{name:r,directory:t,packageJsonPath:n,entryPointPath:s,cssFilePath:p,i18nPaths:l,dependencies:a,config:i}}async function Mt(e,t){if(!await T(t))throw new f(`Expected a 'package.json' file at ${t}`);let n;try{n=JSON.parse(await(0,N.readFile)(t,"utf-8"))}catch(i){throw new f(`Failed to read ${t}: ${i}`)}let r=n.name;if(typeof r!="string")throw new f(`Expected 'name' to be a string in ${t}`);let a=n.dependencies??{};if(typeof a!="object")throw new f(`Expected a valid 'dependencies' object in ${t}`);let o=Object.keys(a);return{name:r,dependencies:o}}async function Rt(e,t,n){let r=await e.resolve(`./${n}`,`${t}/package.json`,{skipSelf:!0});return r==null?void 0:r.id}function vt(e){switch(e.type){case"absolute":return`${e.directory}`;case"unresolved":return`'${e.packageName}' required by ${e.importedFrom}`}}var kt=/[\\/]node_modules[\\/]/;function wt(e,t){return ne(e,t)&&!kt.test(e)}var xt=/[\\/]package\.json($|\?)/;function It(e){return xt.test(e)}function Ee(e){let t=n=>`@import ${JSON.stringify(n)};`;return e.filter(n=>!!n.cssFilePath).map(n=>t(n.cssFilePath)).join(`
|
|
39
|
+
`)}var he=require("node:path"),_t=/[?&]open-pioneer-app(?:$|&)/,St=/[?&]open-pioneer-packages(?:$|&)/,At=/[?&]open-pioneer-styles(?:$|&)/,Nt=/[?&]open-pioneer-i18n-index(?:$|&)/,$t=/[?&]open-pioneer-i18n(?:$|&)/,bt=/[?&]locale=(?<locale>.*?)(?:$|&)/,Ft=/[/\\]@@open-pioneer-react-hooks(?:\?|$)/,Ot=/^(.*?)(?:\?|$)/,Pe="open-pioneer-app",ye="open-pioneer-packages",Ce="open-pioneer-styles",Me="open-pioneer-i18n-index",Lt="open-pioneer-i18n",Re="@@open-pioneer-react-hooks";function ve(e){var t,n;if(e.match(Ft))return{type:"package-hooks",packageDirectory:(0,he.dirname)(S(e))};if(e.match(_t)){let r="app-meta",a=S(e);return{type:r,importer:a}}else if(e.match(St)){let r="app-packages",a=S(e);return{type:r,importer:a}}else if(e.match(At)){let r="app-css",a=S(e);return{type:r,importer:a}}else if(e.match(Nt)){let r="app-i18n-index",a=S(e);return{type:r,importer:a}}else if(e.match($t)){let r="app-i18n",a=S(e),o=(n=(t=e.match(bt))==null?void 0:t.groups)==null?void 0:n.locale;if(!o)throw new Error("Missing locale name in i18n module request");return{type:r,importer:a,locale:o}}}function ke(e,t){return`${e}?${Lt}&locale=${t}`}function S(e){var n;let t=(n=e.match(Ot))==null?void 0:n[1];if(!t||e[0]=="\0")throw new Error(`Failed to get actual source file from '${e}'.`);return t}function we(e,t){let n=`${e}?${ye}`,r=`${e}?${Ce}&inline&lang.css`,a=`${e}?${Me}`;return`
|
|
40
40
|
import { createBox } from ${JSON.stringify(t)};
|
|
41
41
|
import packages from ${JSON.stringify(n)};
|
|
42
42
|
import stylesString from ${JSON.stringify(r)};
|
|
@@ -63,23 +63,24 @@ export {
|
|
|
63
63
|
loadMessages
|
|
64
64
|
};
|
|
65
65
|
`.trim()}var $e=require("node:fs/promises");function xe(e,t){return`
|
|
66
|
-
import { useServiceInternal, useServicesInternal, usePropertiesInternal } from ${JSON.stringify(t)};
|
|
66
|
+
import { useServiceInternal, useServicesInternal, usePropertiesInternal, useIntlInternal } from ${JSON.stringify(t)};
|
|
67
67
|
|
|
68
68
|
const PACKAGE_NAME = ${JSON.stringify(e)};
|
|
69
69
|
export const useService = /*@__PURE__*/ useServiceInternal.bind(undefined, PACKAGE_NAME);
|
|
70
70
|
export const useServices = /*@__PURE__*/ useServicesInternal.bind(undefined, PACKAGE_NAME);
|
|
71
71
|
export const useProperties = /*@__PURE__*/ usePropertiesInternal.bind(undefined, PACKAGE_NAME);
|
|
72
|
-
|
|
72
|
+
export const useIntl = /*@__PURE__*/ useIntlInternal.bind(undefined, PACKAGE_NAME);
|
|
73
|
+
`.trim()}var h=x(require("@babel/types")),z=x(require("@babel/template"));var H=x(require("@babel/generator"));var jt=z.default.program(`
|
|
73
74
|
export const locales = %%LOCALES_ARRAY%%;
|
|
74
75
|
|
|
75
76
|
export function loadMessages(locale) {
|
|
76
77
|
%%LOCALE_SWITCH%%
|
|
77
78
|
throw new Error(\`Unsupported locale: '\${locale}'\`);
|
|
78
79
|
}
|
|
79
|
-
`),
|
|
80
|
+
`),Ut=z.default.statement(`
|
|
80
81
|
return import(%%MODULE_ID%%).then(mod => mod.default);
|
|
81
82
|
`),Tt=z.default.program(`
|
|
82
83
|
const messages = JSON.parse(%%SERIALIZED%%);
|
|
83
84
|
export default messages;
|
|
84
|
-
`);function Ie(e,t){let n=h.arrayExpression(t.map(o=>h.stringLiteral(o))),r=h.switchStatement(h.identifier("locale"),t.map(o=>{let i=ke(e,o),s=
|
|
85
|
+
`);function Ie(e,t){let n=h.arrayExpression(t.map(o=>h.stringLiteral(o))),r=h.switchStatement(h.identifier("locale"),t.map(o=>{let i=ke(e,o),s=Ut({MODULE_ID:h.stringLiteral(i)});return h.switchCase(h.stringLiteral(o),[s])})),a=jt({LOCALES_ARRAY:n,LOCALE_SWITCH:r});return(0,H.default)(a).code}async function _e(e){let{locale:t,appName:n,packages:r,loadI18n:a}=e,o=new Map,i=new Set,s;for(let g of r){g.i18nPaths.size!==0&&i.add(g.name);let u=g.i18nPaths.get(t);if(!u)continue;let{messages:C,overrides:E}=await a(u);if(E.size!==0){if(g.name!==n)throw new f(`Unexpected 'overrides' block in '${u}'. Overrides are only supported in the app.`);s=E}o.set(g.name,C)}if(s)for(let[g,u]of s.entries()){let C=o.get(g);if(!C){o.set(g,u);continue}let E=new Map([...C,...u]);o.set(g,E)}for(let g of i)if(!o.get(g))throw new f(`Package '${g}' requires messages for locale '${t}'. Either update the package or add messages from the app via 'overrides'.`);let p={};for(let[g,u]of o.entries())p[g]=Object.fromEntries(u.entries());let l=JSON.stringify(p),m=Tt({SERIALIZED:h.stringLiteral(l)});return(0,H.default)(m).code}var v=!!process.env.DEBUG,k=O("open-pioneer:codegen");function be(){let e=new Map,t,n,r,a,o;return{name:"pioneer:codegen",async buildStart(){e.clear(),n==null||n.reset();let i=async s=>{let p=await this.resolve(s,__filename);return p||this.error(`Failed to find '${s}'.`),p.id};a=await i("@open-pioneer/runtime/react-integration"),o=await i("@open-pioneer/runtime/metadata")},configResolved(i){t=i,n=new V(t.root)},configureServer(i){r=i,i.watcher.on("all",(s,p)=>{let l=e.get((0,$.normalizePath)(p));if(l){v&&k(`File changed: ${p}`),n.onFileChanged(p);for(let m of l){let g=i.moduleGraph.getModuleById(m);g&&(v&&k(`Triggering hmr of ${m}`),i.reloadModule(g).catch(u=>{t.logger.error(`Failed to trigger hmr: ${u}`)}))}}})},async resolveId(i,s){try{if(i==="open-pioneer:app"){if(!s)throw new f("Must be imported from a source file.");return s+"?"+Pe}if(i==="open-pioneer:react-hooks"){if(!s)throw new f("Must be imported from a source file.");let p=Ae((0,w.dirname)(s),t.root);if(!p)throw new f(`Failed to find package.json for package from '${s}'.`);return`${(0,w.dirname)(p)}/${Re}`}}catch(p){Se(this,p)}},async load(i){var s;try{let p=ve(i);if(!p)return;if(p.type==="package-hooks"){let E=p.packageDirectory,b=(s=await this.resolve(E+"/package.json"))==null?void 0:s.id;if(!b)throw new f(`Failed to resolve package.json in ${E}`);let Ue=await Gt(this,b),W=xe(Ue,a);return v&&k("Generated hooks code: %O",W),W}let l=p.importer;if(p.type==="app-meta")return we(p.importer,o);let m=Ae((0,w.dirname)(l),t.root);if(!m)throw new f(`Failed to find package.json for app from '${l}'.`);let g=Vt(this,i,r,e),u=(0,w.dirname)(m),C=await n.getAppMetadata(g,u);switch(p.type){case"app-packages":{let E=ee(C.packages);return v&&k("Generated app metadata: %O",E),E}case"app-css":{let E=Ee(C.packages);return v&&k("Generated app css: %O",E),E}case"app-i18n-index":{let E=Ie(l,C.locales);return v&&k("Generated i18n lookup: %O",E),E}case"app-i18n":{let E=await _e({locale:p.locale,appName:C.name,packages:C.packages,loadI18n(b){return n.getI18nFile(g,b)}});return v&&k("Generated i18n messages: %O",E),E}}}catch(p){Se(this,p)}}}}function Vt(e,t,n,r){return{warn:e.warn,resolve:e.resolve,addWatchFile:a=>{n&&(v&&k(`Adding manual watch for ${a}`),n.watcher.add(a),zt(r,a,t)),e.addWatchFile(a)}}}function Se(e,t){t instanceof f&&e.error(t);let n=String(t.message)||"Unknown error";e.error("Internal error: "+n)}function zt(e,t,n){let r=(0,$.normalizePath)(t),a=e.get(r);a||(a=new Set,e.set(r,a)),a.add(n)}function Ae(e,t){let n=e;for(;n;){let r=(0,w.join)(n,"package.json");if((0,Ne.existsSync)(r))return r;if((0,$.normalizePath)(n)==(0,$.normalizePath)(t))return;let a=(0,w.dirname)(n);n=a===n||a==="."?"":a}}async function Gt(e,t){let n;try{let r=await(0,$e.readFile)(t,"utf-8");n=JSON.parse(r).name}catch(r){throw new f(`Failed to read package.json file: ${r}`)}if(!n)throw new f(`Failed to read package name from ${t}.`);return n}var J=require("node:fs"),G=require("node:path"),Oe=require("node:path"),Le=require("node:process");function je(e){let t=(e==null?void 0:e.rootSite)??!1,n=(e==null?void 0:e.apps)||[],r=(e==null?void 0:e.sites)||[],a;return{name:"pioneer:mpa",config(o){let i=o.root??(0,Le.cwd)();return{build:{rollupOptions:{input:Jt({apps:n,sites:r,rootSite:t,sourceRoot:i}),output:{entryFileNames(l){return n.includes(l.name)?"[name].js":Oe.posix.join(a.build.assetsDir,"[name]-[hash].js")}}}}}},configResolved(o){a=o}}}function Jt(e){let t=e.apps.map(o=>{let i=(0,G.resolve)(e.sourceRoot,"apps",o,"app"),s=Dt(i);return{name:o,path:s}}),n=e.sites.map(o=>{let i=(0,G.resolve)(e.sourceRoot,"sites",o,"index.html");if(!(0,J.existsSync)(i))throw new Error(`Failed to find site '${o}' at ${i}. Please ensure that the site name is spelled correctly.`);return{name:o,path:i}});if(e.rootSite){let o=(0,G.resolve)(e.sourceRoot,"index.html");if(!(0,J.existsSync)(o))throw new Error(`Failed to find root site at ${o}. Please create the missing file.`);n.push({name:"index",path:o})}let r={},a=0;for(let{name:o,path:i}of[t,n].flat()){let s=r[o];if(s)throw new Error(`Entry point '${o}' was defined twice (paths ${s} and ${i}). Please remove the duplicated entry.`);r[o]=i,++a}if(a===0)throw new Error("You must configure at least one site or one app in the pioneer plugin options.");return r}var Fe=[".ts",".tsx",".js",".jsx"];function Dt(e){for(let n of Fe){let r=e+n;if((0,J.existsSync)(r))return r}let t=Fe.join(", ");throw new Error(`Failed to find a matching entry point file for '${e}'. Supported extensions are ${t}. Ensure that the app name is spelled correctly or create the missing file.`)}function Kt(e){return[je(e),be()]}0&&(module.exports={pioneer});
|
|
85
86
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/codegenPlugin.ts", "../src/utils/debug.ts", "../src/codegen/generatePackagesMetadata.ts", "../src/codegen/IdGenerator.ts", "../src/metadata/MetadataRepository.ts", "../src/ReportableError.ts", "../src/utils/fileUtils.ts", "../src/utils/Cache.ts", "../src/metadata/parseBuildConfig.ts", "../src/metadata/BuildConfigSchema.ts", "../src/metadata/parseI18nYaml.ts", "../src/codegen/generateCombinedCss.ts", "../src/codegen/shared.ts", "../src/codegen/generateAppMetadata.ts", "../src/codegen/generateReactHooks.ts", "../src/codegen/generateI18n.ts", "../src/mpaPlugin.ts"],
|
|
4
|
-
"sourcesContent": ["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { Plugin } from \"vite\";\nimport { codegenPlugin } from \"./codegenPlugin\";\nimport { mpaPlugin } from \"./mpaPlugin\";\nimport type { PioneerPluginOptions } from \"../types\";\nexport { type PioneerPluginOptions };\n\nexport function pioneer(options?: PioneerPluginOptions): Plugin[] {\n return [mpaPlugin(options), codegenPlugin()];\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { PluginContext } from \"rollup\";\nimport { normalizePath, Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport { createDebugger } from \"./utils/debug\";\nimport { generatePackagesMetadata } from \"./codegen/generatePackagesMetadata\";\nimport { MetadataContext, MetadataRepository } from \"./metadata/MetadataRepository\";\nimport { generateCombinedCss } from \"./codegen/generateCombinedCss\";\nimport { generateAppMetadata } from \"./codegen/generateAppMetadata\";\nimport { APP_META_QUERY, PACKAGE_HOOKS, parseVirtualAppModuleId } from \"./codegen/shared\";\nimport { readFile } from \"node:fs/promises\";\nimport { generateReactHooks } from \"./codegen/generateReactHooks\";\nimport { ReportableError } from \"./ReportableError\";\nimport { generateI18nIndex, generateI18nMessages } from \"./codegen/generateI18n\";\n\nconst isDebug = !!process.env.DEBUG;\nconst debug = createDebugger(\"open-pioneer:codegen\");\n\nexport function codegenPlugin(): Plugin {\n // key: normalized path to package json.\n // value: set of module ids that must be invalidated.\n const manualDeps = new Map<string, Set<string>>();\n\n let config!: ResolvedConfig;\n let repository!: MetadataRepository;\n let devServer: ViteDevServer | undefined;\n\n let reactIntegrationId!: string;\n let metadataId!: string;\n return {\n name: \"pioneer:codegen\",\n\n async buildStart(this: PluginContext) {\n manualDeps.clear();\n repository?.reset();\n\n // TODO: use require.resolve instead (requires built js?).\n const resolve = async (rawModuleId: string) => {\n const resolvedResult = await this.resolve(rawModuleId, __filename);\n if (!resolvedResult) {\n this.error(`Failed to find '${rawModuleId}'.`);\n }\n return resolvedResult.id;\n };\n\n reactIntegrationId = await resolve(\"@open-pioneer/runtime/react-integration\");\n metadataId = await resolve(\"@open-pioneer/runtime/metadata\");\n },\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n repository = new MetadataRepository(config.root);\n },\n\n configureServer(server) {\n devServer = server;\n\n // Trigger manual module reload when a watched file changes.\n server.watcher.on(\"all\", (_, path) => {\n const moduleIds = manualDeps.get(normalizePath(path));\n if (!moduleIds) {\n return;\n }\n\n isDebug && debug(`File changed: ${path}`);\n repository.onFileChanged(path);\n for (const moduleId of moduleIds) {\n const mod = server.moduleGraph.getModuleById(moduleId);\n if (mod) {\n isDebug && debug(`Triggering hmr of ${moduleId}`);\n server.reloadModule(mod).catch((err) => {\n config.logger.error(`Failed to trigger hmr: ${err}`);\n });\n }\n }\n });\n },\n\n async resolveId(this: PluginContext, moduleId, importer) {\n try {\n if (moduleId === \"open-pioneer:app\") {\n if (!importer) {\n throw new ReportableError(\"Must be imported from a source file.\");\n }\n return importer + \"?\" + APP_META_QUERY;\n }\n if (moduleId === \"open-pioneer:react-hooks\") {\n if (!importer) {\n throw new ReportableError(\"Must be imported from a source file.\");\n }\n\n const packageJsonPath = findPackageJson(dirname(importer), config.root);\n if (!packageJsonPath) {\n throw new ReportableError(\n `Failed to find package.json for package from '${importer}'.`\n );\n }\n return `${dirname(packageJsonPath)}/${PACKAGE_HOOKS}`;\n }\n } catch (e) {\n reportError(this, e);\n }\n },\n\n async load(this: PluginContext, moduleId) {\n try {\n const virtualModule = parseVirtualAppModuleId(moduleId);\n if (!virtualModule) {\n return undefined;\n }\n\n if (virtualModule.type === \"package-hooks\") {\n const directory = virtualModule.packageDirectory;\n // use forward slashes instead of platform separator\n const packageJsonPath = (await this.resolve(directory + \"/package.json\"))?.id;\n if (!packageJsonPath) {\n throw new ReportableError(`Failed to resolve package.json in ${directory}`);\n }\n\n const packageName = await getPackageName(this, packageJsonPath);\n const generatedSourceCode = generateReactHooks(packageName, reactIntegrationId);\n isDebug && debug(\"Generated hooks code: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n\n const importer = virtualModule.importer;\n if (virtualModule.type === \"app-meta\") {\n return generateAppMetadata(virtualModule.importer, metadataId);\n }\n\n const pkgJsonPath = findPackageJson(dirname(importer), config.root);\n if (!pkgJsonPath) {\n throw new ReportableError(\n `Failed to find package.json for app from '${importer}'.`\n );\n }\n\n const context = buildMetadataContext(this, moduleId, devServer, manualDeps);\n const appDir = dirname(pkgJsonPath);\n const appMetadata = await repository.getAppMetadata(context, appDir);\n switch (virtualModule.type) {\n case \"app-packages\": {\n const generatedSourceCode = generatePackagesMetadata(appMetadata.packages);\n isDebug && debug(\"Generated app metadata: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n case \"app-css\": {\n const generatedSourceCode = generateCombinedCss(appMetadata.packages);\n isDebug && debug(\"Generated app css: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n case \"app-i18n-index\": {\n const generatedSourceCode = generateI18nIndex(\n importer,\n appMetadata.locales\n );\n isDebug && debug(\"Generated i18n lookup: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n case \"app-i18n\": {\n const generatedSourceCode = await generateI18nMessages({\n locale: virtualModule.locale,\n appName: appMetadata.name,\n packages: appMetadata.packages,\n loadI18n(path) {\n return repository.getI18nFile(context, path);\n }\n });\n isDebug && debug(\"Generated i18n messages: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n }\n } catch (e) {\n reportError(this, e);\n }\n }\n };\n}\n\n// Patches the addWatchFile function for manual watching\nfunction buildMetadataContext(\n ctx: PluginContext,\n moduleId: string,\n devServer: ViteDevServer | undefined,\n manualDeps: Map<string, Set<string>>\n): MetadataContext {\n return {\n warn: ctx.warn,\n resolve: ctx.resolve,\n addWatchFile: (id) => {\n if (devServer) {\n // TODO: Is there a better way? We want to trigger a hot reload when\n // one of the build.config files or package.json files change!\n isDebug && debug(`Adding manual watch for ${id}`);\n devServer.watcher.add(id);\n addManualDep(manualDeps, id, moduleId);\n }\n ctx.addWatchFile(id);\n }\n };\n}\n\nfunction reportError(ctx: PluginContext, error: unknown) {\n if (error instanceof ReportableError) {\n ctx.error(error);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const message = String((error as any).message) || \"Unknown error\";\n ctx.error(\"Internal error: \" + message);\n}\n\nfunction addManualDep(manualDeps: Map<string, Set<string>>, file: string, moduleId: string) {\n const normalizedPath = normalizePath(file);\n let moduleIds = manualDeps.get(normalizedPath);\n if (!moduleIds) {\n moduleIds = new Set();\n manualDeps.set(normalizedPath, moduleIds);\n }\n moduleIds.add(moduleId);\n}\n\nfunction findPackageJson(startDir: string, rootDir: string) {\n let dir = startDir;\n while (dir) {\n const candidate = join(dir, \"package.json\");\n if (existsSync(candidate)) {\n return candidate;\n }\n\n if (normalizePath(dir) == normalizePath(rootDir)) {\n return undefined;\n }\n\n const parent = dirname(dir);\n dir = parent === dir || parent === \".\" ? \"\" : parent;\n }\n return undefined;\n}\n\nasync function getPackageName(ctx: PluginContext, packageJsonPath: string) {\n let name: string;\n try {\n const content = await readFile(packageJsonPath, \"utf-8\");\n name = JSON.parse(content).name;\n } catch (e) {\n throw new ReportableError(`Failed to read package.json file: ${e}`);\n }\n if (!name) {\n throw new ReportableError(`Failed to read package name from ${packageJsonPath}.`);\n }\n return name;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { debug } from \"debug\";\n\nexport interface Debugger {\n (msg: string, ...args: unknown[]): void;\n}\n\nexport function createDebugger(namespace: string): Debugger {\n const logger = debug(namespace);\n return function debugFunction(...args) {\n logger(...args);\n };\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport generate from \"@babel/generator\";\nimport template from \"@babel/template\";\nimport * as nodes from \"@babel/types\";\nimport { ReferenceConfig } from \"@open-pioneer/build-support\";\nimport { PackageMetadata } from \"../metadata/MetadataRepository\";\nimport { IdGenerator } from \"./IdGenerator\";\n\nconst SERVICE_IMPORT = template.statement(`\n import { %%SERVICE_NAME%% as %%IMPORT_NAME%% } from %%IMPORT_SOURCE%%;\n`);\n\nconst PKG_OBJECT = template.expression(`\n {\n name: %%PACKAGE_NAME%%,\n services: %%PACKAGE_SERVICES%%,\n ui: %%PACKAGE_UI%%,\n properties: %%PROPERTIES%%\n }\n`);\n\nconst SERVICE_OBJECT = template.expression(`\n {\n name: %%SERVICE_NAME%%,\n clazz: %%SERVICE_IMPORT%%,\n provides: %%SERVICE_INTERFACES%%,\n references: %%SERVICE_REFERENCES%%\n }\n`);\n\nconst INTERFACE_OBJECT = template.expression(`\n {\n name: %%INTERFACE_NAME%%,\n qualifier: %%QUALIFIER%%\n }\n`);\n\nconst REFERENCE_OBJECT = template.expression(`\n {\n name: %%INTERFACE_NAME%%,\n qualifier: %%QUALIFIER%%,\n all: %%ALL%%\n }\n`);\n\nconst UI_OBJECT = template.expression(`\n {\n references: %%UI_REFERENCES%%\n }\n`);\n\nconst PROPERTY_OBJECT = template.expression(`\n {\n value: %%VALUE%%,\n required: %%REQUIRED%%\n }\n`);\n\nexport type PackageMetadataInput = Pick<PackageMetadata, \"name\" | \"config\" | \"entryPointPath\">;\n\n/**\n * Generates a combined metadata structure that is essentially a Record<string, metadata.PackageMetadata>.\n * The object contents must match the shape required by the runtime (declared in runtime/metadata/index.ts).\n */\nexport function generatePackagesMetadata(packages: PackageMetadataInput[]): string {\n const idGenerator = new IdGenerator();\n const packagesMetadata = nodes.objectExpression([]);\n const imports: nodes.Statement[] = [];\n for (const pkg of packages) {\n const packageMetadata = generatePackageMetadata(pkg, {\n importServiceClass(variableName, className, entryPoint) {\n const id = idGenerator.generate(variableName);\n const renderedImporter = SERVICE_IMPORT({\n SERVICE_NAME: nodes.identifier(className),\n IMPORT_NAME: nodes.identifier(id),\n IMPORT_SOURCE: nodes.stringLiteral(entryPoint)\n });\n imports.push(renderedImporter);\n return id;\n }\n });\n packagesMetadata.properties.push(\n nodes.objectProperty(nodes.stringLiteral(pkg.name), packageMetadata)\n );\n }\n\n const program = nodes.program([...imports, nodes.exportDefaultDeclaration(packagesMetadata)]);\n return generate(program).code;\n}\n\n/**\n * Generates the metadata object for a single package.\n * As a side effect, service imports for required service classes will be emitted through a callback.\n */\nfunction generatePackageMetadata(\n pkg: PackageMetadataInput,\n options: {\n /**\n * Adds an import to the containing module.\n * Returns the actual variable name associated with the service.\n */\n importServiceClass(variableName: string, className: string, entryPoint: string): string;\n }\n): nodes.Expression {\n const servicesObject = nodes.objectExpression([]);\n for (const service of pkg.config.services) {\n if (!pkg.entryPointPath) {\n throw new Error(\n `Package '${pkg.name}' must have a valid entry point (typically index.ts or index.js).\\n` +\n \"The entry point can be configured by setting the 'main' property in the package.json file.\"\n );\n }\n\n const importName = options.importServiceClass(\n pkg.name + \"_\" + service.name,\n service.name,\n pkg.entryPointPath\n );\n const serviceObject = SERVICE_OBJECT({\n SERVICE_NAME: nodes.stringLiteral(service.name),\n SERVICE_IMPORT: nodes.identifier(importName),\n SERVICE_INTERFACES: nodes.arrayExpression(\n service.provides.map((p) =>\n INTERFACE_OBJECT({\n INTERFACE_NAME: nodes.stringLiteral(p.name),\n QUALIFIER:\n p.qualifier == null ? undefinedNode() : nodes.stringLiteral(p.qualifier)\n })\n )\n ),\n SERVICE_REFERENCES: nodes.objectExpression(\n Object.entries(service.references).map(([referenceName, referenceConfig]) =>\n nodes.objectProperty(\n nodes.stringLiteral(referenceName),\n referenceObject(referenceConfig)\n )\n )\n )\n });\n\n servicesObject.properties.push(\n nodes.objectProperty(nodes.stringLiteral(service.name), serviceObject)\n );\n }\n\n const uiObject = UI_OBJECT({\n UI_REFERENCES: nodes.arrayExpression(\n pkg.config.ui.references.map((r) => referenceObject(r))\n )\n });\n\n const propertiesObject = nodes.objectExpression(\n pkg.config.properties.map((prop) =>\n nodes.objectProperty(\n nodes.stringLiteral(prop.name),\n PROPERTY_OBJECT({\n VALUE: jsonToExpression(prop.defaultValue),\n REQUIRED: nodes.booleanLiteral(prop.required)\n })\n )\n )\n );\n\n const pkgObject = PKG_OBJECT({\n PACKAGE_NAME: nodes.stringLiteral(pkg.name),\n PACKAGE_SERVICES: servicesObject,\n PACKAGE_UI: uiObject,\n PROPERTIES: propertiesObject\n });\n return pkgObject;\n}\n\nfunction jsonToExpression(json: unknown): nodes.Expression {\n if (json == null) {\n return nodes.nullLiteral();\n }\n if (typeof json === \"string\") {\n return nodes.stringLiteral(json);\n }\n if (typeof json === \"number\") {\n return nodes.numericLiteral(json);\n }\n if (typeof json === \"boolean\") {\n return nodes.booleanLiteral(json);\n }\n if (Array.isArray(json)) {\n return nodes.arrayExpression(json.map((item) => jsonToExpression(item)));\n }\n if (typeof json === \"object\") {\n return nodes.objectExpression(\n Object.entries(json).map(([name, value]) =>\n nodes.objectProperty(nodes.stringLiteral(name), jsonToExpression(value))\n )\n );\n }\n throw new Error(`Unexpected value while serializing JSON: ${json}.`);\n}\n\nfunction referenceObject(referenceConfig: ReferenceConfig): nodes.Expression {\n return REFERENCE_OBJECT({\n INTERFACE_NAME: nodes.stringLiteral(referenceConfig.name),\n QUALIFIER: referenceConfig.qualifier\n ? nodes.stringLiteral(referenceConfig.qualifier)\n : undefinedNode(),\n ALL: nodes.booleanLiteral(referenceConfig.all ?? false)\n });\n}\n\nfunction undefinedNode() {\n return nodes.unaryExpression(\"void\", nodes.numericLiteral(0));\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport class IdGenerator {\n private existing = new Map<string, number>();\n\n /**\n * Returns a unique identifier (in the context of this instance) that resembles the input value.\n */\n generate(input: string): string {\n const clean = cleanName(input);\n\n const existing = this.existing;\n const count = existing.get(clean) ?? 0;\n existing.set(clean, count + 1);\n return count === 0 ? clean : `${clean}_${count}`;\n }\n}\n\nfunction cleanName(input: string) {\n let clean = input.replace(/[^A-Za-z0-9_]+/g, \"_\"); // remove non-alphanumeric\n clean = clean.replace(/[\\d_]+$/, \"\"); // strip trailing numbers / underscore to prevent conflicts\n if (/^\\d/.test(clean)) {\n clean = \"_\" + clean; // ensure variable name does not start with a number\n }\n return clean || \"var\";\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { readFile, realpath } from \"fs/promises\";\nimport { dirname, join } from \"path\";\nimport { PluginContext, RollupWarning } from \"rollup\";\nimport { normalizePath } from \"vite\";\nimport { ReportableError } from \"../ReportableError\";\nimport { createDebugger } from \"../utils/debug\";\nimport { fileExists, isInDirectory } from \"../utils/fileUtils\";\nimport { Cache } from \"../utils/Cache\";\nimport {\n BUILD_CONFIG_NAME,\n isBuildConfig,\n loadBuildConfig,\n NormalizedPackageConfig\n} from \"./parseBuildConfig\";\nimport { I18nFile, loadI18nFile } from \"./parseI18nYaml\";\n\nconst isDebug = !!process.env.DEBUG;\nconst debug = createDebugger(\"open-pioneer:metadata\");\n\n/**\n * Contains build-time information about an app.\n */\nexport interface AppMetadata {\n /** App name. */\n name: string;\n\n /** Directory on disk. */\n directory: string;\n\n /** Path to package.json file. */\n packageJsonPath: string;\n\n /** Locales required by the application. */\n locales: string[];\n\n /**\n * Packages used by the app.\n * Includes the app package itself!\n */\n packages: PackageMetadata[];\n}\n\n/**\n * Contains build-time information about a package.\n */\nexport interface PackageMetadata {\n /** Package name. */\n name: string;\n\n /** Directory on disk. */\n directory: string;\n\n /** Path to package.json file. */\n packageJsonPath: string;\n\n /** Path to entry point (contains service exports). */\n entryPointPath: string | undefined;\n\n /** Path to the resolved css file (if any). */\n cssFilePath: string | undefined;\n\n /**\n * Paths to i18n yaml config for any defined lang in build config.\n * Key: locale, value: file path\n */\n i18nPaths: Map<string, string>;\n\n /** Runtime dependencies (from package.json). */\n dependencies: string[];\n\n /** Parsed metadata (from build config file). */\n config: NormalizedPackageConfig;\n}\n\nexport type MetadataContext = Pick<PluginContext, \"addWatchFile\" | \"resolve\" | \"warn\">;\n\nexport interface ResolvedPackageLocation {\n type: \"absolute\";\n directory: string;\n}\n\nexport interface UnresolvedPackageLocation {\n type: \"unresolved\";\n packageName: string;\n importedFrom: string;\n}\n\nexport type PackageLocation = ResolvedPackageLocation | UnresolvedPackageLocation;\n\n/**\n * Tracks metadata and the files that were used to parse that metadata.\n * watchFiles should be propagated when a caller receives a cached result,\n * otherwise hot reloading may not be triggered correctly on file changes.\n */\ninterface MetadataEntry {\n metadata: PackageMetadata;\n watchFiles: ReadonlySet<string>;\n warnings: RollupWarning[];\n}\n\ninterface I18nEntry {\n i18n: I18nFile;\n watchFiles: ReadonlySet<string>;\n}\n\n/**\n * Provides metadata about apps and packages.\n * Metadata is read from disk on demand and will then be cached\n * until one of the file dependencies has changed.\n */\nexport class MetadataRepository {\n private sourceRoot: string;\n\n // Key: package directory on disk, value: existing metadata\n private packageMetadataCache: Cache<string, MetadataEntry, [ctx: MetadataContext]>;\n\n // Cache for the contents of i18n files.\n // Key: path on disk.\n private i18nCache: Cache<string, I18nEntry, [ctx: MetadataContext]>;\n\n /**\n * @param sourceRoot Source folder on disk, needed to detect 'local' packages\n */\n constructor(sourceRoot: string) {\n this.sourceRoot = sourceRoot;\n this.packageMetadataCache = this.createPackageMetadataCache();\n this.i18nCache = this.createI18nCache();\n }\n\n reset() {\n this.packageMetadataCache = this.createPackageMetadataCache();\n this.i18nCache = this.createI18nCache();\n }\n\n /**\n * Called by the plugin when a file has been changed.\n * The cached data associated with that file (if any) will be removed.\n */\n onFileChanged(path: string) {\n if (isPackageJson(path) || isBuildConfig(path)) {\n this.packageMetadataCache.invalidate(dirname(path));\n }\n this.i18nCache.invalidate(path);\n }\n\n /**\n * Returns the combined application metadata of the app in `appDirectory`.\n * Starting from the app's package.json, dependencies will be visited recursively.\n *\n * For packages that use our package extensions (services etc.), metadata will be gathered and\n * will be returned here.\n */\n async getAppMetadata(ctx: MetadataContext, appDirectory: string): Promise<AppMetadata> {\n isDebug && debug(`Request for app metadata of ${appDirectory}`);\n\n const appPackageMetadata = await this.getPackageMetadata(ctx, {\n type: \"absolute\",\n directory: appDirectory\n });\n if (!appPackageMetadata) {\n throw new ReportableError(\n `Failed to parse app metadata in ${appDirectory}. Ensure that the app is a valid local package.`\n );\n }\n\n // App's locales define which locales must be supported.\n const appLocales = Array.from(appPackageMetadata.i18nPaths.keys());\n\n // Map to ensure that we don't return duplicates. Key: package name\n const packageMetadataByName = new Map<string, PackageMetadata>();\n packageMetadataByName.set(appPackageMetadata.name, appPackageMetadata);\n\n // Recursively visit all dependencies.\n // Detected metadata is placed into `packageMetadata`.\n const visitDependencies = async (dependencies: string[], importedFrom: string) => {\n const jobs = dependencies.map(async (packageName) => {\n const packageMetadata = await this.getPackageMetadata(ctx, {\n type: \"unresolved\",\n packageName,\n importedFrom\n });\n if (packageMetadata) {\n if (!packageMetadataByName.has(packageMetadata.name)) {\n packageMetadataByName.set(packageMetadata.name, packageMetadata);\n }\n await visitDependencies(\n packageMetadata.dependencies,\n packageMetadata.packageJsonPath\n );\n }\n });\n return await Promise.all(jobs);\n };\n await visitDependencies(\n appPackageMetadata.dependencies,\n appPackageMetadata.packageJsonPath\n );\n\n const appMetadata: AppMetadata = {\n name: appPackageMetadata.name,\n directory: appPackageMetadata.directory,\n locales: appLocales,\n packageJsonPath: appPackageMetadata.packageJsonPath,\n packages: Array.from(packageMetadataByName.values())\n };\n return appMetadata;\n }\n\n /**\n * Returns package metadata associated with the given package.\n */\n async getPackageMetadata(\n ctx: MetadataContext,\n loc: PackageLocation\n ): Promise<PackageMetadata | undefined> {\n isDebug && debug(`Request for package metadata of ${formatPackageLocation(loc)}`);\n\n const packageDir = await this.resolvePackageLocation(ctx, loc);\n\n // This would have to be changed when packages from the 'outside' are also supported in the future.\n if (!isLocalPackage(packageDir, this.sourceRoot)) {\n isDebug && debug(`Skipping non-local package '${packageDir}'.`);\n return undefined;\n }\n\n const entry = await this.packageMetadataCache.get(packageDir, ctx);\n propagateWatchFiles(entry.watchFiles, ctx);\n for (const warning of entry.warnings) {\n ctx.warn(warning);\n }\n return entry.metadata;\n }\n\n /**\n * Returns the parsed contents of the given i18n file.\n */\n async getI18nFile(ctx: MetadataContext, path: string): Promise<I18nFile> {\n const { i18n, watchFiles } = await this.i18nCache.get(path, ctx);\n propagateWatchFiles(watchFiles, ctx);\n return i18n;\n }\n\n private async resolvePackageLocation(ctx: MetadataContext, loc: PackageLocation) {\n if (loc.type === \"absolute\") {\n return await realpath(loc.directory);\n }\n\n // Try to locate the package via rollup resolve.\n const unresolvedPackageJson = `${loc.packageName}/package.json`;\n const packageJsonLocation = await ctx.resolve(\n unresolvedPackageJson,\n normalizePath(loc.importedFrom),\n {\n skipSelf: true\n }\n );\n if (!packageJsonLocation || packageJsonLocation.external) {\n throw new ReportableError(\n `Request for '${unresolvedPackageJson}' did not result in a local file (required by '${loc.importedFrom}').`\n );\n }\n\n const packageDir = await realpath(dirname(packageJsonLocation.id));\n isDebug && debug(`Found package '${loc.packageName}' at ${packageDir}`);\n return packageDir;\n }\n\n private createI18nCache(): Cache<string, I18nEntry, [ctx: MetadataContext]> {\n return new Cache({\n getId(path) {\n return normalizePath(path);\n },\n async getValue(path, ctx) {\n isDebug && debug(`Loading i18n file ${path}`);\n\n // watch before loading. this protects against rare race conditions\n // caused by our manual watch workaround in the codegen plugin.\n // essentially, we must watch for changes BEFORE the files are loaded\n // to get reliable notifications.\n ctx.addWatchFile(path);\n const entry: I18nEntry = {\n i18n: await loadI18nFile(path),\n watchFiles: new Set([path])\n };\n return entry;\n },\n onInvalidate(path) {\n isDebug && debug(`Removed cache entry for i18n file ${path}`);\n },\n onCachedReturn(path) {\n isDebug && debug(`Returning cached entry for i18n file ${path}`);\n }\n });\n }\n\n private createPackageMetadataCache(): Cache<string, MetadataEntry, [ctx: MetadataContext]> {\n const provider = {\n _byName: new Map<string, PackageMetadata>(),\n\n getId(directory: string) {\n return normalizePath(directory);\n },\n async getValue(directory: string, ctx: MetadataContext): Promise<MetadataEntry> {\n isDebug && debug(`Loading metadata for package at ${directory}`);\n\n const watchFiles = new Set<string>();\n const warnings: RollupWarning[] = [];\n const trackingCtx: MetadataContext = {\n resolve: ctx.resolve,\n addWatchFile(id) {\n ctx.addWatchFile(id);\n watchFiles.add(id);\n },\n warn(msg: string | RollupWarning) {\n warnings.push(typeof msg === \"string\" ? { message: msg } : msg);\n }\n };\n const metadata = await parsePackageMetadata(trackingCtx, directory);\n isDebug && debug(`Metadata for '${metadata.name}': %O`, metadata);\n\n // Ensure only one version of a package exists in the app\n const existingMetadata = this._byName.get(metadata.name);\n if (\n existingMetadata &&\n normalizePath(existingMetadata.directory) !== normalizePath(metadata.directory)\n ) {\n throw new ReportableError(\n `Found package '${metadata.name}' at two different locations ${existingMetadata.directory} and ${metadata.directory}`\n );\n }\n this._byName.set(metadata.name, metadata);\n\n return {\n metadata,\n watchFiles,\n warnings\n };\n },\n onInvalidate(directory: string, entry: MetadataEntry) {\n isDebug && debug(`Removed cache entry for '${entry.metadata.name}'`);\n this._byName.delete(entry.metadata.name);\n },\n onCachedReturn(directory: string, entry: MetadataEntry) {\n isDebug && debug(`Returning cached metadata for '${entry.metadata.name}'`);\n }\n };\n return new Cache(provider);\n }\n}\n\nfunction propagateWatchFiles(watchFiles: Iterable<string>, ctx: MetadataContext) {\n for (const file of watchFiles) {\n ctx.addWatchFile(file);\n }\n}\n\nexport async function parsePackageMetadata(\n ctx: MetadataContext,\n packageDir: string\n): Promise<PackageMetadata> {\n isDebug && debug(`Visiting package directory ${packageDir}.`);\n\n const packageJsonPath = join(packageDir, \"package.json\");\n\n ctx.addWatchFile(packageJsonPath);\n const { name: packageName, dependencies } = await parsePackageJson(ctx, packageJsonPath);\n\n const buildConfigPath = join(packageDir, BUILD_CONFIG_NAME);\n let buildConfig: NormalizedPackageConfig | undefined;\n ctx.addWatchFile(normalizePath(buildConfigPath));\n if (await fileExists(buildConfigPath)) {\n try {\n buildConfig = await loadBuildConfig(buildConfigPath);\n } catch (e) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const msg = (e as any).message || \"Unknown error\";\n throw new ReportableError(`Failed to load build config ${buildConfigPath}: ${msg}`);\n }\n } else {\n throw new ReportableError(`Expected a ${BUILD_CONFIG_NAME} in ${packageDir}`);\n }\n\n let entryPoint: string | undefined;\n if (buildConfig.services.length) {\n try {\n entryPoint = (await ctx.resolve(packageDir))?.id;\n } catch (e) {\n ctx.warn(`Failed to resolve entry point for package ${packageDir}: ${e}`);\n }\n }\n\n let cssFile: string | undefined;\n if (buildConfig.styles) {\n try {\n cssFile = await resolveLocalFile(ctx, packageDir, buildConfig.styles);\n } catch (e) {\n throw new ReportableError(`Failed to resolve css file for package ${packageDir}: ${e}`);\n }\n if (!cssFile) {\n throw new ReportableError(\n `Failed to find css file '${buildConfig.styles}' in ${packageDir}`\n );\n }\n }\n\n const i18nPaths = new Map<string, string>();\n if (buildConfig.i18n) {\n for (const locale of buildConfig.i18n) {\n if (i18nPaths.has(locale)) {\n throw new ReportableError(\n `Locale '${locale}' was defined twice in ${buildConfigPath}`\n );\n }\n\n const path = join(packageDir, \"i18n\", `${locale}.yaml`);\n ctx.addWatchFile(path);\n if (!(await fileExists(path))) {\n throw new ReportableError(`i18n file '${path}' does not exist.`);\n }\n\n i18nPaths.set(locale, normalizePath(path));\n }\n }\n\n return {\n name: packageName,\n directory: packageDir,\n packageJsonPath: packageJsonPath,\n entryPointPath: entryPoint,\n cssFilePath: cssFile,\n i18nPaths,\n dependencies,\n config: buildConfig\n };\n}\n\nasync function parsePackageJson(ctx: MetadataContext, packageJsonPath: string) {\n if (!(await fileExists(packageJsonPath))) {\n throw new ReportableError(`Expected a 'package.json' file at ${packageJsonPath}`);\n }\n\n let packageJsonContent;\n try {\n packageJsonContent = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n } catch (e) {\n throw new ReportableError(`Failed to read ${packageJsonPath}: ${e}`);\n }\n\n const packageName = packageJsonContent.name;\n if (typeof packageName !== \"string\") {\n throw new ReportableError(`Expected 'name' to be a string in ${packageJsonPath}`);\n }\n\n const dependencies = packageJsonContent.dependencies ?? {};\n if (typeof dependencies !== \"object\") {\n throw new ReportableError(`Expected a valid 'dependencies' object in ${packageJsonPath}`);\n }\n\n const dependencyNames = Object.keys(dependencies);\n return {\n name: packageName,\n dependencies: dependencyNames\n };\n}\n\nasync function resolveLocalFile(ctx: MetadataContext, packageDir: string, localModuleId: string) {\n const result = await ctx.resolve(`./${localModuleId}`, `${packageDir}/package.json`, {\n skipSelf: true\n });\n return result?.id;\n}\n\nfunction formatPackageLocation(loc: PackageLocation) {\n switch (loc.type) {\n case \"absolute\":\n return `${loc.directory}`;\n case \"unresolved\":\n return `'${loc.packageName}' required by ${loc.importedFrom}`;\n }\n}\n\nconst NODE_MODULES_RE = /[\\\\/]node_modules[\\\\/]/;\n\nfunction isLocalPackage(file: string, sourceDir: string) {\n return isInDirectory(file, sourceDir) && !NODE_MODULES_RE.test(file);\n}\n\nconst PACKAGE_JSON_RE = /[\\\\/]package\\.json($|\\?)/;\n\nfunction isPackageJson(file: string) {\n return PACKAGE_JSON_RE.test(file);\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport class ReportableError extends Error {}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport * as fs from \"node:fs\";\nimport { isAbsolute, relative } from \"node:path\";\n\n/**\n * Asynchronously checks for the existence of `file`.\n */\nexport function fileExists(file: string): Promise<boolean> {\n return fs.promises\n .access(file, fs.constants.F_OK)\n .then(() => true)\n .catch(() => false);\n}\n\n/**\n * Returns true if `candidate` is a child of `directory`.\n */\nexport function isInDirectory(candidate: string, directory: string): boolean {\n const rel = relative(directory, candidate);\n const isChild = rel && !rel.startsWith(\"..\") && !isAbsolute(rel);\n return !!isChild;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * A simple cache implementing read-through semantics.\n *\n * The {@link CacheProvider} passed to the cache's constructor\n * implements the actual computation of values.\n *\n * The cache deduplicates computations and caches their results\n * until they are invalidated.\n */\nexport class Cache<Key, Value, Context extends unknown[] = []> {\n private values = new Map<string, Value>();\n private jobs = new Map<string, Promise<Value>>();\n private provider: CacheProvider<Key, Value, Context>;\n\n constructor(provider: CacheProvider<Key, Value, Context>) {\n this.provider = provider;\n }\n\n /**\n * Removes an entry associated with the given key.\n */\n invalidate(key: Key): void {\n const id = this.provider.getId(key);\n const oldValue = this.values.get(id);\n this.values.delete(id);\n this.jobs.delete(id);\n if (oldValue) {\n this.provider.onInvalidate?.(key, oldValue);\n }\n }\n\n /**\n * Retrieves the value associated with `key`.\n * A cached result will be used if present, otherwise the\n * cache provider will be called.\n *\n * Note: computations may throw errors.\n * Errors will not be cached.\n *\n * @param key the lookup key\n * @param context an arbitrary set of values that will be forwarded to the provider\n * should be provider be called.\n * @returns the value associated with `key`\n */\n async get(key: Key, ...context: Context): Promise<Value> {\n const provider = this.provider;\n const id = provider.getId(key);\n\n const values = this.values;\n const existingValue = values.get(id);\n if (existingValue) {\n provider.onCachedReturn?.(key, existingValue);\n return Promise.resolve(existingValue);\n }\n\n const jobs = this.jobs;\n const existingJob = jobs.get(id);\n if (existingJob) {\n return existingJob;\n }\n\n const job = provider.getValue(key, ...context);\n jobs.set(id, job);\n try {\n const value = await job;\n if (jobs.get(id) === job) {\n values.set(id, value);\n }\n return value;\n } finally {\n if (jobs.get(id) === job) {\n jobs.delete(id);\n }\n }\n }\n}\n\nexport interface CacheProvider<Key, Value, Context extends unknown[] = []> {\n /**\n * Maps the `key` to a unique id.\n * The id is used internally to store the result values.\n *\n * Keys mapping to the same `id` are treated as equivalent.\n */\n getId(key: Key): string;\n\n /**\n * Given a `key`, compute its associated `value`.\n * Only one computation for each `key` is started at a time.\n */\n getValue(key: Key, ...context: Context): Promise<Value>;\n\n /**\n * Called when the cache successfully invalidated an old value.\n */\n onInvalidate?(key: Key, oldValue: Value): void;\n\n /**\n * Called when the cache successfully returns a cached result.\n */\n onCachedReturn?(key: Key, value: Value): void;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { pathToFileURL } from \"node:url\";\nimport {\n BuildConfig,\n PropertyMetaConfig,\n ProvidesConfig,\n ReferenceConfig,\n ServiceConfig\n} from \"@open-pioneer/build-support\";\nimport { verifyBuildConfigSchema } from \"./BuildConfigSchema\";\n\nexport const BUILD_CONFIG_NAME = \"build.config.mjs\";\n\nexport interface NormalizedPackageConfig {\n services: NormalizedServiceConfig[];\n styles: string | undefined;\n i18n: string[] | undefined;\n ui: NormalizedUiConfig;\n properties: NormalizedProperty[];\n}\n\nexport interface NormalizedServiceConfig {\n name: string;\n provides: ProvidesConfig[];\n references: Record<string, ReferenceConfig>;\n}\n\nexport interface NormalizedUiConfig {\n references: ReferenceConfig[];\n}\n\nexport interface NormalizedProperty {\n name: string;\n defaultValue: unknown;\n required: boolean;\n}\n\nlet requestId = 0;\n\n/**\n * Loads and parses a build configuration file from the given path on disk.\n */\nexport async function loadBuildConfig(path: string): Promise<NormalizedPackageConfig> {\n const fileURL = pathToFileURL(path);\n const importedModule = (await import(`${fileURL}?id=${++requestId}`)) as Record<\n string,\n unknown\n >;\n if (!importedModule || !importedModule.default) {\n throw new Error(`The module must contain a default export.`);\n }\n\n const config = importedModule.default;\n return parseBuildConfig(config);\n}\n\n/**\n * Parses a build configuration object and validates it.\n */\nexport function parseBuildConfig(object: unknown): NormalizedPackageConfig {\n const rawConfig = verifyBuildConfigSchema(object);\n return normalizeConfig(rawConfig);\n}\n\nconst BUILD_CONFIG_RE = /[\\\\/]build\\.config\\.mjs($|\\?)/;\n\nexport function isBuildConfig(file: string) {\n return BUILD_CONFIG_RE.test(file);\n}\n\nfunction normalizeConfig(rawConfig: BuildConfig): NormalizedPackageConfig {\n return {\n styles: rawConfig.styles,\n i18n: rawConfig.i18n,\n services: Object.entries(rawConfig.services ?? {}).map(([serviceName, serviceConfig]) => {\n return normalizeServiceConfig(serviceName, serviceConfig);\n }),\n ui: normalizeUiConfig(rawConfig.ui),\n properties: normalizeProperties(rawConfig.properties, rawConfig.propertiesMeta)\n };\n}\n\nfunction normalizeServiceConfig(name: string, rawConfig: ServiceConfig): NormalizedServiceConfig {\n return {\n name: name,\n provides: normalizeProvidesConfig(rawConfig.provides),\n references: normalizeReferencesConfig(rawConfig.references)\n };\n}\n\nfunction normalizeProvidesConfig(rawConfig: ServiceConfig[\"provides\"]): ProvidesConfig[] {\n if (!rawConfig) {\n return [];\n }\n\n if (typeof rawConfig === \"string\") {\n return [\n {\n name: rawConfig\n }\n ];\n }\n\n return rawConfig.map((providesConfig) => {\n const normalized: ProvidesConfig =\n typeof providesConfig === \"string\" ? { name: providesConfig } : providesConfig;\n return normalized;\n });\n}\n\nfunction normalizeReferencesConfig(\n rawConfig: ServiceConfig[\"references\"]\n): Record<string, ReferenceConfig> {\n if (!rawConfig) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(rawConfig).map(([referenceName, referenceConfig]) => {\n return [referenceName, normalizeReferenceConfig(referenceConfig)];\n })\n );\n}\n\nfunction normalizeReferenceConfig(rawConfig: string | ReferenceConfig): ReferenceConfig {\n if (typeof rawConfig === \"string\") {\n return { name: rawConfig };\n }\n return rawConfig;\n}\n\nfunction normalizeUiConfig(rawConfig: BuildConfig[\"ui\"]): NormalizedUiConfig {\n return {\n references: rawConfig?.references?.map(normalizeReferenceConfig) ?? []\n };\n}\n\nfunction normalizeProperties(\n properties: Record<string, unknown> | undefined,\n propertiesMeta: Record<string, PropertyMetaConfig> | undefined\n): NormalizedProperty[] {\n const result: NormalizedProperty[] = [];\n for (const [name, defaultValue] of Object.entries(properties ?? {})) {\n const required = propertiesMeta?.[name]?.required ?? false;\n result.push({\n name,\n defaultValue,\n required\n });\n }\n return result;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { z } from \"zod\";\nimport {\n BuildConfig,\n PropertyMetaConfig,\n ProvidesConfig,\n ReferenceConfig,\n ServiceConfig,\n UiConfig\n} from \"@open-pioneer/build-support\";\nimport { fromZodError } from \"zod-validation-error\";\n\nconst LITERAL_SCHEMA = z.union([z.string(), z.number(), z.boolean(), z.null()]);\n\ntype Literal = z.infer<typeof LITERAL_SCHEMA>;\n\ntype Json = Literal | { [key: string]: Json } | Json[];\n\nconst JSON_SCHEMA: z.ZodType<Json> = z.lazy(() =>\n z.union([LITERAL_SCHEMA, z.array(JSON_SCHEMA), z.record(JSON_SCHEMA)])\n);\n\nconst PROPERTY_META_SCHEMA: z.ZodType<PropertyMetaConfig> = z.strictObject({\n required: z.boolean().optional()\n});\n\nconst REFERENCE_CONFIG_SCHEMA: z.ZodType<ReferenceConfig> = z.strictObject({\n name: z.string(),\n qualifier: z.string().optional(),\n all: z.boolean().optional()\n});\n\nconst PROVIDES_CONFIG_SCHEMA: z.ZodType<ProvidesConfig> = z.strictObject({\n name: z.string(),\n qualifier: z.string().optional()\n});\n\nconst UI_CONFIG_SCHEMA: z.ZodType<UiConfig> = z.strictObject({\n references: z.array(z.string().or(REFERENCE_CONFIG_SCHEMA)).optional()\n});\n\nconst SERVICE_CONFIG_SCHEMA: z.ZodType<ServiceConfig> = z.strictObject({\n provides: z\n .string()\n .or(z.array(z.string().or(PROVIDES_CONFIG_SCHEMA)))\n .optional(),\n references: z.record(z.string(), z.string().or(REFERENCE_CONFIG_SCHEMA)).optional()\n});\n\nconst BUILD_CONFIG_SCHEMA: z.ZodType<BuildConfig> = z.strictObject({\n styles: z.string().optional(),\n i18n: z.array(z.string()).optional(),\n services: z.record(z.string(), SERVICE_CONFIG_SCHEMA).optional(),\n ui: UI_CONFIG_SCHEMA.optional(),\n properties: z.record(z.string(), JSON_SCHEMA).optional(),\n propertiesMeta: z.record(z.string(), PROPERTY_META_SCHEMA).optional()\n});\n\n/**\n * Ensures that `value` conforms to the {@link BuildConfig} interface.\n * Throws an error if that is not the case.\n *\n * @returns `value` but casted to the appropriate type.\n */\nexport function verifyBuildConfigSchema(value: unknown): BuildConfig {\n const result = BUILD_CONFIG_SCHEMA.safeParse(value);\n if (result.success) {\n return result.data;\n }\n throw fromZodError(result.error);\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { readFile } from \"fs/promises\";\nimport { load as loadYaml } from \"js-yaml\";\nimport { z } from \"zod\";\nimport { fromZodError } from \"zod-validation-error\";\nimport { ReportableError } from \"../ReportableError\";\n\nexport interface I18nFile {\n /**\n * Direct messages for the current package.\n *\n * Key: message id, Value: message template string\n */\n messages: Map<string, string>;\n\n /**\n * Overrides for other packages.\n * Can be used from an app.\n *\n * Key: package name, Value: message record as in {@link messages}.\n */\n overrides: Map<string, Map<string, string>>;\n}\n\ninterface RawI18nFile {\n messages?: RecursiveMessages | null | undefined;\n overrides?: Record<string, RecursiveMessages> | null | undefined;\n}\n\ninterface RecursiveMessages {\n [key: string]: string | RecursiveMessages;\n}\n\nconst MESSAGES_SCHEMA: z.ZodType<RecursiveMessages> = z.lazy(() =>\n z.record(z.union([z.string(), MESSAGES_SCHEMA]))\n);\n\n// allow null for empty yaml objects\nconst I18N_SCHEMA: z.ZodType<RawI18nFile> = z\n .object({\n messages: MESSAGES_SCHEMA.or(z.null()).optional(),\n overrides: z.record(MESSAGES_SCHEMA).or(z.null()).optional()\n })\n .strict();\n\n/**\n * Loads an i18n.yaml file from the file system and parses it.\n */\nexport async function loadI18nFile(path: string): Promise<I18nFile> {\n let content;\n try {\n content = await readFile(path, \"utf-8\");\n } catch (e) {\n throw new ReportableError(`Failed to read ${path}: ${e}`);\n }\n\n try {\n const data = loadYaml(content);\n return parseI18nFile(data);\n } catch (e) {\n throw new ReportableError(`Failed to parse ${path}: ${e}`);\n }\n}\n\n/**\n * Parses the JavaScript object representing an i18n file.\n */\nexport function parseI18nFile(data: unknown): I18nFile {\n const result = I18N_SCHEMA.safeParse(data);\n if (!result.success) {\n throw fromZodError(result.error);\n }\n\n const rawI18n = result.data;\n return {\n messages: gatherMessages(rawI18n.messages ?? undefined),\n overrides: gatherOverrides(rawI18n.overrides ?? undefined)\n };\n}\n\nfunction gatherMessages(data: RecursiveMessages | undefined): Map<string, string> {\n const messages = new Map<string, string>();\n const prefix: string[] = [];\n const visitChildren = (record: RecursiveMessages) => {\n for (const [key, value] of Object.entries(record)) {\n if (typeof value === \"string\") {\n visitMessage(key, value);\n } else if (value) {\n prefix.push(key);\n visitChildren(value);\n prefix.pop();\n }\n }\n };\n const visitMessage = (key: string, message: string) => {\n const id = [...prefix, key].join(\".\");\n if (messages.has(id)) {\n throw new Error(`Message '${id}' was already defined.`);\n }\n messages.set(id, message);\n };\n\n if (data) {\n visitChildren(data);\n }\n return messages;\n}\n\nfunction gatherOverrides(\n data: Record<string, RecursiveMessages> | undefined\n): Map<string, Map<string, string>> {\n const overrides = new Map<string, Map<string, string>>();\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n overrides.set(key, gatherMessages(value));\n }\n }\n return overrides;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { PackageMetadata } from \"../metadata/MetadataRepository\";\n\nexport type PackageMetadataInput = Pick<PackageMetadata, \"cssFilePath\">;\n\n/**\n * Generates a css file that imports the css file defined by the packages.\n */\nexport function generateCombinedCss(packages: PackageMetadataInput[]) {\n const cssImport = (file: string) => `@import ${JSON.stringify(file)};`;\n return packages\n .filter((pkg) => !!pkg.cssFilePath)\n .map((pkg) => cssImport(pkg.cssFilePath!)) // eslint-disable-line @typescript-eslint/no-non-null-assertion\n .join(\"\\n\");\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { dirname } from \"node:path\";\n\nconst APP_META_RE = /[?&]open-pioneer-app(?:$|&)/;\nconst APP_PACKAGES_RE = /[?&]open-pioneer-packages(?:$|&)/;\nconst APP_CSS_RE = /[?&]open-pioneer-styles(?:$|&)/;\nconst APP_I18N_INDEX_RE = /[?&]open-pioneer-i18n-index(?:$|&)/;\nconst APP_I18N_RE = /[?&]open-pioneer-i18n(?:$|&)/;\nconst APP_I18N_LOCALE_RE = /[?&]locale=(?<locale>.*?)(?:$|&)/;\nconst APP_HOOKS_RE = /[/\\\\]@@open-pioneer-react-hooks(?:\\?|$)/;\nconst SOURCE_FILE_RE = /^(.*?)(?:\\?|$)/;\n\nexport const APP_META_QUERY = \"open-pioneer-app\";\nexport const APP_PACKAGES_QUERY = \"open-pioneer-packages\";\nexport const APP_CSS_QUERY = \"open-pioneer-styles\";\nexport const APP_I18N_INDEX_QUERY = \"open-pioneer-i18n-index\";\nexport const APP_I18N_QUERY = \"open-pioneer-i18n\";\nexport const PACKAGE_HOOKS = \"@@open-pioneer-react-hooks\";\n\nexport interface VirtualAppModule {\n type: \"app-meta\" | \"app-packages\" | \"app-css\" | \"app-i18n-index\";\n importer: string;\n}\n\nexport interface VirtualI18nMessages {\n type: \"app-i18n\";\n importer: string;\n locale: string;\n}\n\nexport interface VirtualPackageModule {\n type: \"package-hooks\";\n packageDirectory: string;\n}\n\nexport function parseVirtualAppModuleId(\n moduleId: string\n): VirtualAppModule | VirtualI18nMessages | VirtualPackageModule | undefined {\n if (moduleId.match(APP_HOOKS_RE)) {\n return {\n type: \"package-hooks\",\n packageDirectory: dirname(getSourceFile(moduleId))\n };\n }\n\n if (moduleId.match(APP_META_RE)) {\n const type = \"app-meta\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_PACKAGES_RE)) {\n const type = \"app-packages\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_CSS_RE)) {\n const type = \"app-css\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_I18N_INDEX_RE)) {\n const type = \"app-i18n-index\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_I18N_RE)) {\n const type = \"app-i18n\";\n const importer = getSourceFile(moduleId);\n const locale = moduleId.match(APP_I18N_LOCALE_RE)?.groups?.[\"locale\"];\n if (!locale) {\n throw new Error(\"Missing locale name in i18n module request\");\n }\n return { type, importer, locale };\n }\n return undefined;\n}\n\nexport function appLocaleFileId(appModuleId: string, locale: string) {\n return `${appModuleId}?${APP_I18N_QUERY}&locale=${locale}`;\n}\n\nfunction getSourceFile(moduleId: string) {\n const sourceFile = moduleId.match(SOURCE_FILE_RE)?.[1];\n if (!sourceFile || moduleId[0] == \"\\0\") {\n throw new Error(`Failed to get actual source file from '${moduleId}'.`);\n }\n return sourceFile;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { APP_CSS_QUERY, APP_I18N_INDEX_QUERY, APP_PACKAGES_QUERY } from \"./shared\";\n\n/**\n * Generates the main app metadata module.\n * It delegates the actual metadata generation to auxiliary modules.\n */\nexport function generateAppMetadata(importer: string, metadataModuleId: string) {\n /*\n CSS loading: \n - 'inline' loads the css as a string literal.\n - the suffix (e.g. '.css') at the very end is important to trigger the correct vite plugin!\n - I would like to import css as an url instead (separate file),\n but that currently hinges on https://github.com/vitejs/vite/pull/11084\n\n - TODO: .scss support (will currently trigger the esbuild plugin and an error because the file contains both .ts and .scss)\n\n Hot reloading:\n - See https://vitejs.dev/guide/api-hmr.html for vite's HMR API\n - When a css string changes, the module exporting the `stylesString` below changes.\n We accept those changes through the `import.meta.hot.accept` mechanism by\n calling the `setValue` method on the old observable box value.\n The runtime has a reference to the box and watches for changes (only during development!)\n - The code below takes care to use the _correct_ `styles` box (every module has its own, even the new version).\n `import.meta.hot.data` is shared between all versions of the module, so we always use the first box.\n */\n const packagesModule = `${importer}?${APP_PACKAGES_QUERY}`;\n const cssModule = `${importer}?${APP_CSS_QUERY}&inline&lang.css`;\n const i18nModule = `${importer}?${APP_I18N_INDEX_QUERY}`;\n return `\nimport { createBox } from ${JSON.stringify(metadataModuleId)};\nimport packages from ${JSON.stringify(packagesModule)};\nimport stylesString from ${JSON.stringify(cssModule)};\nimport { locales, loadMessages } from ${JSON.stringify(i18nModule)};\n\nconst styles = createBox(stylesString);\nif (import.meta.hot) {\n import.meta.hot.data.styles ??= styles;\n import.meta.hot.accept((mod) => {\n if (mod && mod.packages === packages && mod.locales === locales && mod.loadMessages === loadMessages) {\n import.meta.hot.data.styles.setValue(mod.styles.value);\n return;\n }\n \n // Cannot handle all other changes the moment; trigger reload.\n import.meta.hot.invalidate();\n });\n}\n\nexport {\n packages,\n styles,\n locales,\n loadMessages\n};\n`.trim();\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport function generateReactHooks(packageName: string, runtimeModuleId: string) {\n return `\nimport { useServiceInternal, useServicesInternal, usePropertiesInternal } from ${JSON.stringify(\n runtimeModuleId\n )};\n\nconst PACKAGE_NAME = ${JSON.stringify(packageName)};\nexport const useService = /*@__PURE__*/ useServiceInternal.bind(undefined, PACKAGE_NAME);\nexport const useServices = /*@__PURE__*/ useServicesInternal.bind(undefined, PACKAGE_NAME);\nexport const useProperties = /*@__PURE__*/ usePropertiesInternal.bind(undefined, PACKAGE_NAME);\n `.trim();\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport * as nodes from \"@babel/types\";\nimport template from \"@babel/template\";\nimport { appLocaleFileId } from \"./shared\";\nimport generate from \"@babel/generator\";\nimport { PackageMetadata } from \"../metadata/MetadataRepository\";\nimport { ReportableError } from \"../ReportableError\";\nimport { I18nFile } from \"../metadata/parseI18nYaml\";\n\nconst INDEX_TEMPLATE = template.program(`\n export const locales = %%LOCALES_ARRAY%%;\n\n export function loadMessages(locale) {\n %%LOCALE_SWITCH%%\n throw new Error(\\`Unsupported locale: '\\${locale}'\\`);\n }\n`);\n\nconst IMPORT_TEMPLATE = template.statement(`\n return import(%%MODULE_ID%%).then(mod => mod.default);\n`);\n\nconst MESSAGES_TEMPLATE = template.program(`\n const messages = JSON.parse(%%SERIALIZED%%);\n export default messages;\n`);\n\n/**\n * Generates a lookup table for the languages supported by the given application.\n */\nexport function generateI18nIndex(importer: string, locales: string[]): string {\n const localesArray = nodes.arrayExpression(\n locales.map((locale) => nodes.stringLiteral(locale))\n );\n const switchStmt = nodes.switchStatement(\n nodes.identifier(\"locale\"),\n locales.map((locale) => {\n const localeModuleId = appLocaleFileId(importer, locale);\n const importStatement = IMPORT_TEMPLATE({\n MODULE_ID: nodes.stringLiteral(localeModuleId)\n });\n return nodes.switchCase(nodes.stringLiteral(locale), [importStatement]);\n })\n );\n\n const program = INDEX_TEMPLATE({\n LOCALES_ARRAY: localesArray,\n LOCALE_SWITCH: switchStmt\n });\n return generate(program).code;\n}\n\nexport interface I18nMessageOptions {\n /** The locale to generate. */\n locale: string;\n\n /** The name of the current application. */\n appName: string;\n\n /** All packages in the application (including the app). */\n packages: Pick<PackageMetadata, \"name\" | \"i18nPaths\">[];\n\n /** Called by the function when the contents of an i18n file (in i18nPaths) is required. */\n loadI18n: (path: string) => Promise<I18nFile>;\n}\n\n/**\n * Generates a messages module containing a single default export: the messages record.\n *\n * Messages are taken from the given packages (for the specified locale).\n */\nexport async function generateI18nMessages(options: I18nMessageOptions): Promise<string> {\n const { locale, appName, packages, loadI18n } = options;\n const packageMessages = new Map<string, Map<string, string>>();\n const packagesNeedingMessages = new Set<string>();\n let packageOverrides: Map<string, Map<string, string>> | undefined;\n for (const pkg of packages) {\n if (pkg.i18nPaths.size !== 0) {\n // Remember packages that have i18n settings. If they are not supported\n // in a given language, and the app does not specify custom messages for this package, an error is emitted.\n packagesNeedingMessages.add(pkg.name);\n }\n\n const filePath = pkg.i18nPaths.get(locale);\n if (!filePath) {\n continue;\n }\n\n const { messages, overrides } = await loadI18n(filePath);\n if (overrides.size !== 0) {\n if (pkg.name !== appName) {\n throw new ReportableError(\n `Unexpected 'overrides' block in '${filePath}'. Overrides are only supported in the app.`\n );\n }\n packageOverrides = overrides;\n }\n\n packageMessages.set(pkg.name, messages);\n }\n\n // Override messages\n if (packageOverrides) {\n for (const [packageName, messages] of packageOverrides.entries()) {\n const existingMessages = packageMessages.get(packageName);\n if (!existingMessages) {\n packageMessages.set(packageName, messages);\n continue;\n }\n\n const updatedMessages = new Map([...existingMessages, ...messages]);\n packageMessages.set(packageName, updatedMessages);\n }\n }\n\n // Verify that required messages are present\n for (const packageName of packagesNeedingMessages) {\n const messages = packageMessages.get(packageName);\n if (!messages) {\n throw new ReportableError(\n `Package '${packageName}' requires messages for locale '${locale}'. Either update the package or add messages from the app via 'overrides'.`\n );\n }\n }\n\n // Translate to json for codegen. Package name -> key -> i18n message template\n const allMessages: Record<string, Record<string, string>> = {};\n for (const [packageName, messages] of packageMessages.entries()) {\n allMessages[packageName] = Object.fromEntries(messages.entries());\n }\n\n // Transport the object as a json string for improved parsing performance\n const serialized = JSON.stringify(allMessages);\n const program = MESSAGES_TEMPLATE({\n SERIALIZED: nodes.stringLiteral(serialized)\n });\n return generate(program).code;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { Plugin, ResolvedConfig } from \"vite\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { posix } from \"node:path\";\nimport { cwd } from \"node:process\";\nimport { type PioneerPluginOptions } from \".\";\nimport { RollupOptions } from \"rollup\";\n\nexport function mpaPlugin(options: PioneerPluginOptions | undefined): Plugin {\n const rootSite = options?.rootSite ?? false;\n const apps = options?.apps || [];\n const sites = options?.sites || [];\n\n let resolvedConfig: ResolvedConfig;\n return {\n name: \"pioneer:mpa\",\n\n config(config) {\n const sourceRoot = config.root ?? cwd();\n const entryPoints = gatherEntryPoints({ apps, sites, rootSite, sourceRoot });\n const rollupOptions: RollupOptions = {\n input: entryPoints,\n output: {\n entryFileNames(chunk) {\n if (apps.includes(chunk.name)) {\n return \"[name].js\";\n }\n\n // This will rename the .js files that belong to a .html site, they don't need a public name.\n return posix.join(resolvedConfig.build.assetsDir, \"[name]-[hash].js\");\n }\n }\n };\n\n return {\n build: {\n rollupOptions\n }\n };\n },\n\n configResolved(config) {\n resolvedConfig = config;\n }\n };\n}\n\nfunction gatherEntryPoints(options: {\n apps: string[];\n sites: string[];\n rootSite: boolean;\n sourceRoot: string;\n}): Record<string, string> {\n const apps = options.apps.map((appName) => {\n const prefix = resolve(options.sourceRoot, \"apps\", appName, \"app\");\n const path = findMatchingEntryPointFile(prefix);\n return {\n name: appName,\n path: path\n };\n });\n\n /*\n * Vite does not respect the entry point name for html files, it\n * put each html site at a location mirroring the source directory structure (e.g. site/<SITE>/index.html\n * instead of SITE.html).\n *\n * There are multiple vite mpa plugins that handle custom html paths which can either be used\n * directly or as inspiration.\n */\n const sites = options.sites.map((siteName) => {\n const path = resolve(options.sourceRoot, \"sites\", siteName, \"index.html\");\n if (!existsSync(path)) {\n throw new Error(\n `Failed to find site '${siteName}' at ${path}. Please ensure that the site name is spelled correctly.`\n );\n }\n return {\n name: siteName,\n path: path\n };\n });\n if (options.rootSite) {\n const path = resolve(options.sourceRoot, \"index.html\");\n if (!existsSync(path)) {\n throw new Error(`Failed to find root site at ${path}. Please create the missing file.`);\n }\n sites.push({\n name: \"index\",\n path: path\n });\n }\n\n const entryPoints: Record<string, string> = {};\n let entryPointCount = 0;\n for (const { name, path } of [apps, sites].flat()) {\n const existingPath = entryPoints[name];\n if (existingPath) {\n throw new Error(\n `Entry point '${name}' was defined twice (paths ${existingPath} and ${path}). Please remove the duplicated entry.`\n );\n }\n entryPoints[name] = path;\n ++entryPointCount;\n }\n if (entryPointCount === 0) {\n throw new Error(\n \"You must configure at least one site or one app in the pioneer plugin options.\"\n );\n }\n return entryPoints;\n}\n\nconst EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".jsx\"];\n\nfunction findMatchingEntryPointFile(prefix: string) {\n for (const ext of EXTENSIONS) {\n const candidate = prefix + ext;\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n const extensions = EXTENSIONS.join(\", \");\n throw new Error(\n `Failed to find a matching entry point file for '${prefix}'. Supported extensions are ${extensions}. Ensure that the app name is spelled correctly or create the missing file.`\n );\n}\n"],
|
|
5
|
-
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,ICEA,IAAAI,GAA2B,mBAC3BC,EAA8B,qBAE9BC,EAAqE,gBCHrE,IAAAC,EAAsB,iBAMf,SAASC,EAAeC,EAA6B,CACxD,IAAMC,KAAS,SAAMD,CAAS,EAC9B,OAAO,YAA0BE,EAAM,CACnCD,EAAO,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A,IAAoB,EACpB,MAAM,IAAI,MACN,gFACJ,EAEJ,OAAOD,CACX,CAEA,IAAMI,GAAa,CAAC,MAAO,OAAQ,MAAO,MAAM,EAEhD,SAASN,GAA2BF,EAAgB,CAChD,QAAWS,KAAOD,GAAY,CAC1B,IAAME,EAAYV,EAASS,EAC3B,MAAI,cAAWC,CAAS,EACpB,OAAOA,CAEf,CAEA,IAAMC,EAAaH,GAAW,KAAK,IAAI,EACvC,MAAM,IAAI,MACN,mDAAmDR,gCAAqCW,8EAC5F,CACJ,CjBzHO,SAASC,GAAQC,EAA0C,CAC9D,MAAO,CAACC,GAAUD,CAAO,EAAGE,GAAc,CAAC,CAC/C",
|
|
6
|
-
"names": ["src_exports", "__export", "pioneer", "__toCommonJS", "import_node_fs", "import_node_path", "import_vite", "import_debug", "createDebugger", "namespace", "logger", "args", "import_generator", "import_template", "nodes", "IdGenerator", "input", "clean", "cleanName", "existing", "count", "SERVICE_IMPORT", "template", "PKG_OBJECT", "SERVICE_OBJECT", "INTERFACE_OBJECT", "REFERENCE_OBJECT", "UI_OBJECT", "PROPERTY_OBJECT", "generatePackagesMetadata", "packages", "idGenerator", "IdGenerator", "packagesMetadata", "imports", "pkg", "packageMetadata", "generatePackageMetadata", "variableName", "className", "entryPoint", "id", "renderedImporter", "program", "generate", "options", "servicesObject", "service", "importName", "serviceObject", "p", "undefinedNode", "referenceName", "referenceConfig", "referenceObject", "uiObject", "r", "propertiesObject", "prop", "jsonToExpression", "json", "item", "name", "value", "import_promises", "import_path", "import_vite", "ReportableError", "fs", "import_node_path", "fileExists", "file", "isInDirectory", "candidate", "directory", "rel", "Cache", "provider", "key", "_a", "_b", "id", "oldValue", "context", "values", "existingValue", "jobs", "existingJob", "job", "value", "import_node_url", "import_zod", "import_zod_validation_error", "LITERAL_SCHEMA", "JSON_SCHEMA", "PROPERTY_META_SCHEMA", "REFERENCE_CONFIG_SCHEMA", "PROVIDES_CONFIG_SCHEMA", "UI_CONFIG_SCHEMA", "SERVICE_CONFIG_SCHEMA", "BUILD_CONFIG_SCHEMA", "verifyBuildConfigSchema", "value", "result", "BUILD_CONFIG_NAME", "requestId", "loadBuildConfig", "path", "importedModule", "config", "parseBuildConfig", "object", "rawConfig", "verifyBuildConfigSchema", "normalizeConfig", "BUILD_CONFIG_RE", "isBuildConfig", "file", "serviceName", "serviceConfig", "normalizeServiceConfig", "normalizeUiConfig", "normalizeProperties", "name", "normalizeProvidesConfig", "normalizeReferencesConfig", "providesConfig", "referenceName", "referenceConfig", "normalizeReferenceConfig", "_a", "properties", "propertiesMeta", "result", "defaultValue", "required", "import_promises", "import_js_yaml", "import_zod", "import_zod_validation_error", "MESSAGES_SCHEMA", "I18N_SCHEMA", "loadI18nFile", "path", "content", "e", "ReportableError", "data", "loadYaml", "parseI18nFile", "result", "rawI18n", "gatherMessages", "gatherOverrides", "messages", "prefix", "visitChildren", "record", "key", "value", "visitMessage", "message", "id", "overrides", "isDebug", "debug", "createDebugger", "MetadataRepository", "sourceRoot", "path", "isPackageJson", "isBuildConfig", "ctx", "appDirectory", "appPackageMetadata", "ReportableError", "appLocales", "packageMetadataByName", "visitDependencies", "dependencies", "importedFrom", "jobs", "packageName", "packageMetadata", "loc", "formatPackageLocation", "packageDir", "isLocalPackage", "entry", "propagateWatchFiles", "warning", "i18n", "watchFiles", "unresolvedPackageJson", "packageJsonLocation", "Cache", "loadI18nFile", "provider", "directory", "warnings", "trackingCtx", "id", "msg", "metadata", "parsePackageMetadata", "existingMetadata", "file", "_a", "packageJsonPath", "parsePackageJson", "buildConfigPath", "BUILD_CONFIG_NAME", "buildConfig", "fileExists", "loadBuildConfig", "e", "entryPoint", "cssFile", "resolveLocalFile", "i18nPaths", "locale", "packageJsonContent", "dependencyNames", "localModuleId", "result", "NODE_MODULES_RE", "sourceDir", "isInDirectory", "PACKAGE_JSON_RE", "generateCombinedCss", "packages", "cssImport", "file", "pkg", "import_node_path", "APP_META_RE", "APP_PACKAGES_RE", "APP_CSS_RE", "APP_I18N_INDEX_RE", "APP_I18N_RE", "APP_I18N_LOCALE_RE", "APP_HOOKS_RE", "SOURCE_FILE_RE", "APP_META_QUERY", "APP_PACKAGES_QUERY", "APP_CSS_QUERY", "APP_I18N_INDEX_QUERY", "APP_I18N_QUERY", "PACKAGE_HOOKS", "parseVirtualAppModuleId", "moduleId", "_a", "_b", "getSourceFile", "type", "importer", "locale", "appLocaleFileId", "appModuleId", "sourceFile", "generateAppMetadata", "importer", "metadataModuleId", "packagesModule", "APP_PACKAGES_QUERY", "cssModule", "APP_CSS_QUERY", "i18nModule", "APP_I18N_INDEX_QUERY", "import_promises", "generateReactHooks", "packageName", "runtimeModuleId", "nodes", "import_template", "import_generator", "INDEX_TEMPLATE", "template", "IMPORT_TEMPLATE", "MESSAGES_TEMPLATE", "generateI18nIndex", "importer", "locales", "localesArray", "locale", "switchStmt", "localeModuleId", "appLocaleFileId", "importStatement", "program", "generate", "generateI18nMessages", "options", "appName", "packages", "loadI18n", "packageMessages", "packagesNeedingMessages", "packageOverrides", "pkg", "filePath", "messages", "overrides", "ReportableError", "packageName", "existingMessages", "updatedMessages", "allMessages", "serialized", "isDebug", "debug", "createDebugger", "codegenPlugin", "manualDeps", "config", "repository", "devServer", "reactIntegrationId", "metadataId", "resolve", "rawModuleId", "resolvedResult", "resolvedConfig", "MetadataRepository", "server", "_", "path", "moduleIds", "moduleId", "mod", "err", "importer", "ReportableError", "APP_META_QUERY", "packageJsonPath", "findPackageJson", "PACKAGE_HOOKS", "e", "reportError", "_a", "virtualModule", "parseVirtualAppModuleId", "directory", "packageName", "getPackageName", "generatedSourceCode", "generateReactHooks", "generateAppMetadata", "pkgJsonPath", "context", "buildMetadataContext", "appDir", "appMetadata", "generatePackagesMetadata", "generateCombinedCss", "generateI18nIndex", "generateI18nMessages", "ctx", "id", "addManualDep", "error", "message", "file", "normalizedPath", "startDir", "rootDir", "dir", "candidate", "parent", "name", "content", "import_node_fs", "import_node_path", "import_node_process", "mpaPlugin", "options", "rootSite", "apps", "sites", "resolvedConfig", "config", "sourceRoot", "gatherEntryPoints", "chunk", "appName", "prefix", "path", "findMatchingEntryPointFile", "siteName", "entryPoints", "entryPointCount", "name", "existingPath", "EXTENSIONS", "ext", "candidate", "extensions", "pioneer", "options", "mpaPlugin", "codegenPlugin"]
|
|
4
|
+
"sourcesContent": ["// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { Plugin } from \"vite\";\nimport { codegenPlugin } from \"./codegenPlugin\";\nimport { mpaPlugin } from \"./mpaPlugin\";\nimport type { PioneerPluginOptions } from \"../types\";\nexport { type PioneerPluginOptions };\n\nexport function pioneer(options?: PioneerPluginOptions): Plugin[] {\n return [mpaPlugin(options), codegenPlugin()];\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { existsSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { PluginContext } from \"rollup\";\nimport { normalizePath, Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport { createDebugger } from \"./utils/debug\";\nimport { generatePackagesMetadata } from \"./codegen/generatePackagesMetadata\";\nimport { MetadataContext, MetadataRepository } from \"./metadata/MetadataRepository\";\nimport { generateCombinedCss } from \"./codegen/generateCombinedCss\";\nimport { generateAppMetadata } from \"./codegen/generateAppMetadata\";\nimport { APP_META_QUERY, PACKAGE_HOOKS, parseVirtualAppModuleId } from \"./codegen/shared\";\nimport { readFile } from \"node:fs/promises\";\nimport { generateReactHooks } from \"./codegen/generateReactHooks\";\nimport { ReportableError } from \"./ReportableError\";\nimport { generateI18nIndex, generateI18nMessages } from \"./codegen/generateI18n\";\n\nconst isDebug = !!process.env.DEBUG;\nconst debug = createDebugger(\"open-pioneer:codegen\");\n\nexport function codegenPlugin(): Plugin {\n // key: normalized path to package json.\n // value: set of module ids that must be invalidated.\n const manualDeps = new Map<string, Set<string>>();\n\n let config!: ResolvedConfig;\n let repository!: MetadataRepository;\n let devServer: ViteDevServer | undefined;\n\n let reactIntegrationId!: string;\n let metadataId!: string;\n return {\n name: \"pioneer:codegen\",\n\n async buildStart(this: PluginContext) {\n manualDeps.clear();\n repository?.reset();\n\n // TODO: use require.resolve instead (requires built js?).\n const resolve = async (rawModuleId: string) => {\n const resolvedResult = await this.resolve(rawModuleId, __filename);\n if (!resolvedResult) {\n this.error(`Failed to find '${rawModuleId}'.`);\n }\n return resolvedResult.id;\n };\n\n reactIntegrationId = await resolve(\"@open-pioneer/runtime/react-integration\");\n metadataId = await resolve(\"@open-pioneer/runtime/metadata\");\n },\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n repository = new MetadataRepository(config.root);\n },\n\n configureServer(server) {\n devServer = server;\n\n // Trigger manual module reload when a watched file changes.\n server.watcher.on(\"all\", (_, path) => {\n const moduleIds = manualDeps.get(normalizePath(path));\n if (!moduleIds) {\n return;\n }\n\n isDebug && debug(`File changed: ${path}`);\n repository.onFileChanged(path);\n for (const moduleId of moduleIds) {\n const mod = server.moduleGraph.getModuleById(moduleId);\n if (mod) {\n isDebug && debug(`Triggering hmr of ${moduleId}`);\n server.reloadModule(mod).catch((err) => {\n config.logger.error(`Failed to trigger hmr: ${err}`);\n });\n }\n }\n });\n },\n\n async resolveId(this: PluginContext, moduleId, importer) {\n try {\n if (moduleId === \"open-pioneer:app\") {\n if (!importer) {\n throw new ReportableError(\"Must be imported from a source file.\");\n }\n return importer + \"?\" + APP_META_QUERY;\n }\n if (moduleId === \"open-pioneer:react-hooks\") {\n if (!importer) {\n throw new ReportableError(\"Must be imported from a source file.\");\n }\n\n const packageJsonPath = findPackageJson(dirname(importer), config.root);\n if (!packageJsonPath) {\n throw new ReportableError(\n `Failed to find package.json for package from '${importer}'.`\n );\n }\n return `${dirname(packageJsonPath)}/${PACKAGE_HOOKS}`;\n }\n } catch (e) {\n reportError(this, e);\n }\n },\n\n async load(this: PluginContext, moduleId) {\n try {\n const virtualModule = parseVirtualAppModuleId(moduleId);\n if (!virtualModule) {\n return undefined;\n }\n\n if (virtualModule.type === \"package-hooks\") {\n const directory = virtualModule.packageDirectory;\n // use forward slashes instead of platform separator\n const packageJsonPath = (await this.resolve(directory + \"/package.json\"))?.id;\n if (!packageJsonPath) {\n throw new ReportableError(`Failed to resolve package.json in ${directory}`);\n }\n\n const packageName = await getPackageName(this, packageJsonPath);\n const generatedSourceCode = generateReactHooks(packageName, reactIntegrationId);\n isDebug && debug(\"Generated hooks code: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n\n const importer = virtualModule.importer;\n if (virtualModule.type === \"app-meta\") {\n return generateAppMetadata(virtualModule.importer, metadataId);\n }\n\n const pkgJsonPath = findPackageJson(dirname(importer), config.root);\n if (!pkgJsonPath) {\n throw new ReportableError(\n `Failed to find package.json for app from '${importer}'.`\n );\n }\n\n const context = buildMetadataContext(this, moduleId, devServer, manualDeps);\n const appDir = dirname(pkgJsonPath);\n const appMetadata = await repository.getAppMetadata(context, appDir);\n switch (virtualModule.type) {\n case \"app-packages\": {\n const generatedSourceCode = generatePackagesMetadata(appMetadata.packages);\n isDebug && debug(\"Generated app metadata: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n case \"app-css\": {\n const generatedSourceCode = generateCombinedCss(appMetadata.packages);\n isDebug && debug(\"Generated app css: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n case \"app-i18n-index\": {\n const generatedSourceCode = generateI18nIndex(\n importer,\n appMetadata.locales\n );\n isDebug && debug(\"Generated i18n lookup: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n case \"app-i18n\": {\n const generatedSourceCode = await generateI18nMessages({\n locale: virtualModule.locale,\n appName: appMetadata.name,\n packages: appMetadata.packages,\n loadI18n(path) {\n return repository.getI18nFile(context, path);\n }\n });\n isDebug && debug(\"Generated i18n messages: %O\", generatedSourceCode);\n return generatedSourceCode;\n }\n }\n } catch (e) {\n reportError(this, e);\n }\n }\n };\n}\n\n// Patches the addWatchFile function for manual watching\nfunction buildMetadataContext(\n ctx: PluginContext,\n moduleId: string,\n devServer: ViteDevServer | undefined,\n manualDeps: Map<string, Set<string>>\n): MetadataContext {\n return {\n warn: ctx.warn,\n resolve: ctx.resolve,\n addWatchFile: (id) => {\n if (devServer) {\n // TODO: Is there a better way? We want to trigger a hot reload when\n // one of the build.config files or package.json files change!\n isDebug && debug(`Adding manual watch for ${id}`);\n devServer.watcher.add(id);\n addManualDep(manualDeps, id, moduleId);\n }\n ctx.addWatchFile(id);\n }\n };\n}\n\nfunction reportError(ctx: PluginContext, error: unknown) {\n if (error instanceof ReportableError) {\n ctx.error(error);\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const message = String((error as any).message) || \"Unknown error\";\n ctx.error(\"Internal error: \" + message);\n}\n\nfunction addManualDep(manualDeps: Map<string, Set<string>>, file: string, moduleId: string) {\n const normalizedPath = normalizePath(file);\n let moduleIds = manualDeps.get(normalizedPath);\n if (!moduleIds) {\n moduleIds = new Set();\n manualDeps.set(normalizedPath, moduleIds);\n }\n moduleIds.add(moduleId);\n}\n\nfunction findPackageJson(startDir: string, rootDir: string) {\n let dir = startDir;\n while (dir) {\n const candidate = join(dir, \"package.json\");\n if (existsSync(candidate)) {\n return candidate;\n }\n\n if (normalizePath(dir) == normalizePath(rootDir)) {\n return undefined;\n }\n\n const parent = dirname(dir);\n dir = parent === dir || parent === \".\" ? \"\" : parent;\n }\n return undefined;\n}\n\nasync function getPackageName(ctx: PluginContext, packageJsonPath: string) {\n let name: string;\n try {\n const content = await readFile(packageJsonPath, \"utf-8\");\n name = JSON.parse(content).name;\n } catch (e) {\n throw new ReportableError(`Failed to read package.json file: ${e}`);\n }\n if (!name) {\n throw new ReportableError(`Failed to read package name from ${packageJsonPath}.`);\n }\n return name;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { debug } from \"debug\";\n\nexport interface Debugger {\n (msg: string, ...args: unknown[]): void;\n}\n\nexport function createDebugger(namespace: string): Debugger {\n const logger = debug(namespace);\n return function debugFunction(...args) {\n logger(...args);\n };\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport generate from \"@babel/generator\";\nimport template from \"@babel/template\";\nimport * as nodes from \"@babel/types\";\nimport { ReferenceConfig } from \"@open-pioneer/build-support\";\nimport { PackageMetadata } from \"../metadata/MetadataRepository\";\nimport { IdGenerator } from \"./IdGenerator\";\n\nconst SERVICE_IMPORT = template.statement(`\n import { %%SERVICE_NAME%% as %%IMPORT_NAME%% } from %%IMPORT_SOURCE%%;\n`);\n\nconst PKG_OBJECT = template.expression(`\n {\n name: %%PACKAGE_NAME%%,\n services: %%PACKAGE_SERVICES%%,\n ui: %%PACKAGE_UI%%,\n properties: %%PROPERTIES%%\n }\n`);\n\nconst SERVICE_OBJECT = template.expression(`\n {\n name: %%SERVICE_NAME%%,\n clazz: %%SERVICE_IMPORT%%,\n provides: %%SERVICE_INTERFACES%%,\n references: %%SERVICE_REFERENCES%%\n }\n`);\n\nconst INTERFACE_OBJECT = template.expression(`\n {\n name: %%INTERFACE_NAME%%,\n qualifier: %%QUALIFIER%%\n }\n`);\n\nconst REFERENCE_OBJECT = template.expression(`\n {\n name: %%INTERFACE_NAME%%,\n qualifier: %%QUALIFIER%%,\n all: %%ALL%%\n }\n`);\n\nconst UI_OBJECT = template.expression(`\n {\n references: %%UI_REFERENCES%%\n }\n`);\n\nconst PROPERTY_OBJECT = template.expression(`\n {\n value: %%VALUE%%,\n required: %%REQUIRED%%\n }\n`);\n\nexport type PackageMetadataInput = Pick<PackageMetadata, \"name\" | \"config\" | \"entryPointPath\">;\n\n/**\n * Generates a combined metadata structure that is essentially a Record<string, metadata.PackageMetadata>.\n * The object contents must match the shape required by the runtime (declared in runtime/metadata/index.ts).\n */\nexport function generatePackagesMetadata(packages: PackageMetadataInput[]): string {\n const idGenerator = new IdGenerator();\n const packagesMetadata = nodes.objectExpression([]);\n const imports: nodes.Statement[] = [];\n for (const pkg of packages) {\n const packageMetadata = generatePackageMetadata(pkg, {\n importServiceClass(variableName, className, entryPoint) {\n const id = idGenerator.generate(variableName);\n const renderedImporter = SERVICE_IMPORT({\n SERVICE_NAME: nodes.identifier(className),\n IMPORT_NAME: nodes.identifier(id),\n IMPORT_SOURCE: nodes.stringLiteral(entryPoint)\n });\n imports.push(renderedImporter);\n return id;\n }\n });\n packagesMetadata.properties.push(\n nodes.objectProperty(nodes.stringLiteral(pkg.name), packageMetadata)\n );\n }\n\n const program = nodes.program([...imports, nodes.exportDefaultDeclaration(packagesMetadata)]);\n return generate(program).code;\n}\n\n/**\n * Generates the metadata object for a single package.\n * As a side effect, service imports for required service classes will be emitted through a callback.\n */\nfunction generatePackageMetadata(\n pkg: PackageMetadataInput,\n options: {\n /**\n * Adds an import to the containing module.\n * Returns the actual variable name associated with the service.\n */\n importServiceClass(variableName: string, className: string, entryPoint: string): string;\n }\n): nodes.Expression {\n const servicesObject = nodes.objectExpression([]);\n for (const service of pkg.config.services) {\n if (!pkg.entryPointPath) {\n throw new Error(\n `Package '${pkg.name}' must have a valid entry point (typically index.ts or index.js).\\n` +\n \"The entry point can be configured by setting the 'main' property in the package.json file.\"\n );\n }\n\n const importName = options.importServiceClass(\n pkg.name + \"_\" + service.name,\n service.name,\n pkg.entryPointPath\n );\n const serviceObject = SERVICE_OBJECT({\n SERVICE_NAME: nodes.stringLiteral(service.name),\n SERVICE_IMPORT: nodes.identifier(importName),\n SERVICE_INTERFACES: nodes.arrayExpression(\n service.provides.map((p) =>\n INTERFACE_OBJECT({\n INTERFACE_NAME: nodes.stringLiteral(p.name),\n QUALIFIER:\n p.qualifier == null ? undefinedNode() : nodes.stringLiteral(p.qualifier)\n })\n )\n ),\n SERVICE_REFERENCES: nodes.objectExpression(\n Object.entries(service.references).map(([referenceName, referenceConfig]) =>\n nodes.objectProperty(\n nodes.stringLiteral(referenceName),\n referenceObject(referenceConfig)\n )\n )\n )\n });\n\n servicesObject.properties.push(\n nodes.objectProperty(nodes.stringLiteral(service.name), serviceObject)\n );\n }\n\n const uiObject = UI_OBJECT({\n UI_REFERENCES: nodes.arrayExpression(\n pkg.config.ui.references.map((r) => referenceObject(r))\n )\n });\n\n const propertiesObject = nodes.objectExpression(\n pkg.config.properties.map((prop) =>\n nodes.objectProperty(\n nodes.stringLiteral(prop.name),\n PROPERTY_OBJECT({\n VALUE: jsonToExpression(prop.defaultValue),\n REQUIRED: nodes.booleanLiteral(prop.required)\n })\n )\n )\n );\n\n const pkgObject = PKG_OBJECT({\n PACKAGE_NAME: nodes.stringLiteral(pkg.name),\n PACKAGE_SERVICES: servicesObject,\n PACKAGE_UI: uiObject,\n PROPERTIES: propertiesObject\n });\n return pkgObject;\n}\n\nfunction jsonToExpression(json: unknown): nodes.Expression {\n if (json == null) {\n return nodes.nullLiteral();\n }\n if (typeof json === \"string\") {\n return nodes.stringLiteral(json);\n }\n if (typeof json === \"number\") {\n return nodes.numericLiteral(json);\n }\n if (typeof json === \"boolean\") {\n return nodes.booleanLiteral(json);\n }\n if (Array.isArray(json)) {\n return nodes.arrayExpression(json.map((item) => jsonToExpression(item)));\n }\n if (typeof json === \"object\") {\n return nodes.objectExpression(\n Object.entries(json).map(([name, value]) =>\n nodes.objectProperty(nodes.stringLiteral(name), jsonToExpression(value))\n )\n );\n }\n throw new Error(`Unexpected value while serializing JSON: ${json}.`);\n}\n\nfunction referenceObject(referenceConfig: ReferenceConfig): nodes.Expression {\n return REFERENCE_OBJECT({\n INTERFACE_NAME: nodes.stringLiteral(referenceConfig.name),\n QUALIFIER: referenceConfig.qualifier\n ? nodes.stringLiteral(referenceConfig.qualifier)\n : undefinedNode(),\n ALL: nodes.booleanLiteral(referenceConfig.all ?? false)\n });\n}\n\nfunction undefinedNode() {\n return nodes.unaryExpression(\"void\", nodes.numericLiteral(0));\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport class IdGenerator {\n private existing = new Map<string, number>();\n\n /**\n * Returns a unique identifier (in the context of this instance) that resembles the input value.\n */\n generate(input: string): string {\n const clean = cleanName(input);\n\n const existing = this.existing;\n const count = existing.get(clean) ?? 0;\n existing.set(clean, count + 1);\n return count === 0 ? clean : `${clean}_${count}`;\n }\n}\n\nfunction cleanName(input: string) {\n let clean = input.replace(/[^A-Za-z0-9_]+/g, \"_\"); // remove non-alphanumeric\n clean = clean.replace(/[\\d_]+$/, \"\"); // strip trailing numbers / underscore to prevent conflicts\n if (/^\\d/.test(clean)) {\n clean = \"_\" + clean; // ensure variable name does not start with a number\n }\n return clean || \"var\";\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { readFile, realpath } from \"fs/promises\";\nimport { dirname, join } from \"path\";\nimport { PluginContext, RollupWarning } from \"rollup\";\nimport { normalizePath } from \"vite\";\nimport { ReportableError } from \"../ReportableError\";\nimport { createDebugger } from \"../utils/debug\";\nimport { fileExists, isInDirectory } from \"../utils/fileUtils\";\nimport { Cache } from \"../utils/Cache\";\nimport {\n BUILD_CONFIG_NAME,\n isBuildConfig,\n loadBuildConfig,\n NormalizedPackageConfig\n} from \"./parseBuildConfig\";\nimport { I18nFile, loadI18nFile } from \"./parseI18nYaml\";\n\nconst isDebug = !!process.env.DEBUG;\nconst debug = createDebugger(\"open-pioneer:metadata\");\n\n/**\n * Contains build-time information about an app.\n */\nexport interface AppMetadata {\n /** App name. */\n name: string;\n\n /** Directory on disk. */\n directory: string;\n\n /** Path to package.json file. */\n packageJsonPath: string;\n\n /** Locales required by the application. */\n locales: string[];\n\n /**\n * Packages used by the app.\n * Includes the app package itself!\n */\n packages: PackageMetadata[];\n}\n\n/**\n * Contains build-time information about a package.\n */\nexport interface PackageMetadata {\n /** Package name. */\n name: string;\n\n /** Directory on disk. */\n directory: string;\n\n /** Path to package.json file. */\n packageJsonPath: string;\n\n /** Path to entry point (contains service exports). */\n entryPointPath: string | undefined;\n\n /** Path to the resolved css file (if any). */\n cssFilePath: string | undefined;\n\n /**\n * Paths to i18n yaml config for any defined lang in build config.\n * Key: locale, value: file path\n */\n i18nPaths: Map<string, string>;\n\n /** Runtime dependencies (from package.json). */\n dependencies: string[];\n\n /** Parsed metadata (from build config file). */\n config: NormalizedPackageConfig;\n}\n\nexport type MetadataContext = Pick<PluginContext, \"addWatchFile\" | \"resolve\" | \"warn\">;\n\nexport interface ResolvedPackageLocation {\n type: \"absolute\";\n directory: string;\n}\n\nexport interface UnresolvedPackageLocation {\n type: \"unresolved\";\n packageName: string;\n importedFrom: string;\n}\n\nexport type PackageLocation = ResolvedPackageLocation | UnresolvedPackageLocation;\n\n/**\n * Tracks metadata and the files that were used to parse that metadata.\n * watchFiles should be propagated when a caller receives a cached result,\n * otherwise hot reloading may not be triggered correctly on file changes.\n */\ninterface MetadataEntry {\n metadata: PackageMetadata;\n watchFiles: ReadonlySet<string>;\n warnings: RollupWarning[];\n}\n\ninterface I18nEntry {\n i18n: I18nFile;\n watchFiles: ReadonlySet<string>;\n}\n\n/**\n * Provides metadata about apps and packages.\n * Metadata is read from disk on demand and will then be cached\n * until one of the file dependencies has changed.\n */\nexport class MetadataRepository {\n private sourceRoot: string;\n\n // Key: package directory on disk, value: existing metadata\n private packageMetadataCache: Cache<string, MetadataEntry, [ctx: MetadataContext]>;\n\n // Cache for the contents of i18n files.\n // Key: path on disk.\n private i18nCache: Cache<string, I18nEntry, [ctx: MetadataContext]>;\n\n /**\n * @param sourceRoot Source folder on disk, needed to detect 'local' packages\n */\n constructor(sourceRoot: string) {\n this.sourceRoot = sourceRoot;\n this.packageMetadataCache = this.createPackageMetadataCache();\n this.i18nCache = this.createI18nCache();\n }\n\n reset() {\n this.packageMetadataCache = this.createPackageMetadataCache();\n this.i18nCache = this.createI18nCache();\n }\n\n /**\n * Called by the plugin when a file has been changed.\n * The cached data associated with that file (if any) will be removed.\n */\n onFileChanged(path: string) {\n if (isPackageJson(path) || isBuildConfig(path)) {\n this.packageMetadataCache.invalidate(dirname(path));\n }\n this.i18nCache.invalidate(path);\n }\n\n /**\n * Returns the combined application metadata of the app in `appDirectory`.\n * Starting from the app's package.json, dependencies will be visited recursively.\n *\n * For packages that use our package extensions (services etc.), metadata will be gathered and\n * will be returned here.\n */\n async getAppMetadata(ctx: MetadataContext, appDirectory: string): Promise<AppMetadata> {\n isDebug && debug(`Request for app metadata of ${appDirectory}`);\n\n const appPackageMetadata = await this.getPackageMetadata(ctx, {\n type: \"absolute\",\n directory: appDirectory\n });\n if (!appPackageMetadata) {\n throw new ReportableError(\n `Failed to parse app metadata in ${appDirectory}. Ensure that the app is a valid local package.`\n );\n }\n\n // App's locales define which locales must be supported.\n const appLocales = Array.from(appPackageMetadata.i18nPaths.keys());\n\n // Map to ensure that we don't return duplicates. Key: package name\n const packageMetadataByName = new Map<string, PackageMetadata>();\n packageMetadataByName.set(appPackageMetadata.name, appPackageMetadata);\n\n // Recursively visit all dependencies.\n // Detected metadata is placed into `packageMetadata`.\n const visitDependencies = async (dependencies: string[], importedFrom: string) => {\n const jobs = dependencies.map(async (packageName) => {\n const packageMetadata = await this.getPackageMetadata(ctx, {\n type: \"unresolved\",\n packageName,\n importedFrom\n });\n if (packageMetadata) {\n if (!packageMetadataByName.has(packageMetadata.name)) {\n packageMetadataByName.set(packageMetadata.name, packageMetadata);\n }\n await visitDependencies(\n packageMetadata.dependencies,\n packageMetadata.packageJsonPath\n );\n }\n });\n return await Promise.all(jobs);\n };\n await visitDependencies(\n appPackageMetadata.dependencies,\n appPackageMetadata.packageJsonPath\n );\n\n const appMetadata: AppMetadata = {\n name: appPackageMetadata.name,\n directory: appPackageMetadata.directory,\n locales: appLocales,\n packageJsonPath: appPackageMetadata.packageJsonPath,\n packages: Array.from(packageMetadataByName.values())\n };\n return appMetadata;\n }\n\n /**\n * Returns package metadata associated with the given package.\n */\n async getPackageMetadata(\n ctx: MetadataContext,\n loc: PackageLocation\n ): Promise<PackageMetadata | undefined> {\n isDebug && debug(`Request for package metadata of ${formatPackageLocation(loc)}`);\n\n const packageDir = await this.resolvePackageLocation(ctx, loc);\n\n // This would have to be changed when packages from the 'outside' are also supported in the future.\n if (!isLocalPackage(packageDir, this.sourceRoot)) {\n isDebug && debug(`Skipping non-local package '${packageDir}'.`);\n return undefined;\n }\n\n const entry = await this.packageMetadataCache.get(packageDir, ctx);\n propagateWatchFiles(entry.watchFiles, ctx);\n for (const warning of entry.warnings) {\n ctx.warn(warning);\n }\n return entry.metadata;\n }\n\n /**\n * Returns the parsed contents of the given i18n file.\n */\n async getI18nFile(ctx: MetadataContext, path: string): Promise<I18nFile> {\n const { i18n, watchFiles } = await this.i18nCache.get(path, ctx);\n propagateWatchFiles(watchFiles, ctx);\n return i18n;\n }\n\n private async resolvePackageLocation(ctx: MetadataContext, loc: PackageLocation) {\n if (loc.type === \"absolute\") {\n return await realpath(loc.directory);\n }\n\n // Try to locate the package via rollup resolve.\n const unresolvedPackageJson = `${loc.packageName}/package.json`;\n const packageJsonLocation = await ctx.resolve(\n unresolvedPackageJson,\n normalizePath(loc.importedFrom),\n {\n skipSelf: true\n }\n );\n if (!packageJsonLocation || packageJsonLocation.external) {\n throw new ReportableError(\n `Request for '${unresolvedPackageJson}' did not result in a local file (required by '${loc.importedFrom}').`\n );\n }\n\n const packageDir = await realpath(dirname(packageJsonLocation.id));\n isDebug && debug(`Found package '${loc.packageName}' at ${packageDir}`);\n return packageDir;\n }\n\n private createI18nCache(): Cache<string, I18nEntry, [ctx: MetadataContext]> {\n return new Cache({\n getId(path) {\n return normalizePath(path);\n },\n async getValue(path, ctx) {\n isDebug && debug(`Loading i18n file ${path}`);\n\n // watch before loading. this protects against rare race conditions\n // caused by our manual watch workaround in the codegen plugin.\n // essentially, we must watch for changes BEFORE the files are loaded\n // to get reliable notifications.\n ctx.addWatchFile(path);\n const entry: I18nEntry = {\n i18n: await loadI18nFile(path),\n watchFiles: new Set([path])\n };\n return entry;\n },\n onInvalidate(path) {\n isDebug && debug(`Removed cache entry for i18n file ${path}`);\n },\n onCachedReturn(path) {\n isDebug && debug(`Returning cached entry for i18n file ${path}`);\n }\n });\n }\n\n private createPackageMetadataCache(): Cache<string, MetadataEntry, [ctx: MetadataContext]> {\n const provider = {\n _byName: new Map<string, PackageMetadata>(),\n\n getId(directory: string) {\n return normalizePath(directory);\n },\n async getValue(directory: string, ctx: MetadataContext): Promise<MetadataEntry> {\n isDebug && debug(`Loading metadata for package at ${directory}`);\n\n const watchFiles = new Set<string>();\n const warnings: RollupWarning[] = [];\n const trackingCtx: MetadataContext = {\n resolve: ctx.resolve,\n addWatchFile(id) {\n ctx.addWatchFile(id);\n watchFiles.add(id);\n },\n warn(msg: string | RollupWarning) {\n warnings.push(typeof msg === \"string\" ? { message: msg } : msg);\n }\n };\n const metadata = await parsePackageMetadata(trackingCtx, directory);\n isDebug && debug(`Metadata for '${metadata.name}': %O`, metadata);\n\n // Ensure only one version of a package exists in the app\n const existingMetadata = this._byName.get(metadata.name);\n if (\n existingMetadata &&\n normalizePath(existingMetadata.directory) !== normalizePath(metadata.directory)\n ) {\n throw new ReportableError(\n `Found package '${metadata.name}' at two different locations ${existingMetadata.directory} and ${metadata.directory}`\n );\n }\n this._byName.set(metadata.name, metadata);\n\n return {\n metadata,\n watchFiles,\n warnings\n };\n },\n onInvalidate(directory: string, entry: MetadataEntry) {\n isDebug && debug(`Removed cache entry for '${entry.metadata.name}'`);\n this._byName.delete(entry.metadata.name);\n },\n onCachedReturn(directory: string, entry: MetadataEntry) {\n isDebug && debug(`Returning cached metadata for '${entry.metadata.name}'`);\n }\n };\n return new Cache(provider);\n }\n}\n\nfunction propagateWatchFiles(watchFiles: Iterable<string>, ctx: MetadataContext) {\n for (const file of watchFiles) {\n ctx.addWatchFile(file);\n }\n}\n\nexport async function parsePackageMetadata(\n ctx: MetadataContext,\n packageDir: string\n): Promise<PackageMetadata> {\n isDebug && debug(`Visiting package directory ${packageDir}.`);\n\n const packageJsonPath = join(packageDir, \"package.json\");\n\n ctx.addWatchFile(packageJsonPath);\n const { name: packageName, dependencies } = await parsePackageJson(ctx, packageJsonPath);\n\n const buildConfigPath = join(packageDir, BUILD_CONFIG_NAME);\n let buildConfig: NormalizedPackageConfig | undefined;\n ctx.addWatchFile(normalizePath(buildConfigPath));\n if (await fileExists(buildConfigPath)) {\n try {\n buildConfig = await loadBuildConfig(buildConfigPath);\n } catch (e) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const msg = (e as any).message || \"Unknown error\";\n throw new ReportableError(`Failed to load build config ${buildConfigPath}: ${msg}`);\n }\n } else {\n throw new ReportableError(`Expected a ${BUILD_CONFIG_NAME} in ${packageDir}`);\n }\n\n let entryPoint: string | undefined;\n if (buildConfig.services.length) {\n try {\n entryPoint = (await ctx.resolve(packageDir))?.id;\n } catch (e) {\n ctx.warn(`Failed to resolve entry point for package ${packageDir}: ${e}`);\n }\n }\n\n let cssFile: string | undefined;\n if (buildConfig.styles) {\n try {\n cssFile = await resolveLocalFile(ctx, packageDir, buildConfig.styles);\n } catch (e) {\n throw new ReportableError(`Failed to resolve css file for package ${packageDir}: ${e}`);\n }\n if (!cssFile) {\n throw new ReportableError(\n `Failed to find css file '${buildConfig.styles}' in ${packageDir}`\n );\n }\n }\n\n const i18nPaths = new Map<string, string>();\n if (buildConfig.i18n) {\n for (const locale of buildConfig.i18n) {\n if (i18nPaths.has(locale)) {\n throw new ReportableError(\n `Locale '${locale}' was defined twice in ${buildConfigPath}`\n );\n }\n\n const path = join(packageDir, \"i18n\", `${locale}.yaml`);\n ctx.addWatchFile(path);\n if (!(await fileExists(path))) {\n throw new ReportableError(`i18n file '${path}' does not exist.`);\n }\n\n i18nPaths.set(locale, normalizePath(path));\n }\n }\n\n return {\n name: packageName,\n directory: packageDir,\n packageJsonPath: packageJsonPath,\n entryPointPath: entryPoint,\n cssFilePath: cssFile,\n i18nPaths,\n dependencies,\n config: buildConfig\n };\n}\n\nasync function parsePackageJson(ctx: MetadataContext, packageJsonPath: string) {\n if (!(await fileExists(packageJsonPath))) {\n throw new ReportableError(`Expected a 'package.json' file at ${packageJsonPath}`);\n }\n\n let packageJsonContent;\n try {\n packageJsonContent = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n } catch (e) {\n throw new ReportableError(`Failed to read ${packageJsonPath}: ${e}`);\n }\n\n const packageName = packageJsonContent.name;\n if (typeof packageName !== \"string\") {\n throw new ReportableError(`Expected 'name' to be a string in ${packageJsonPath}`);\n }\n\n const dependencies = packageJsonContent.dependencies ?? {};\n if (typeof dependencies !== \"object\") {\n throw new ReportableError(`Expected a valid 'dependencies' object in ${packageJsonPath}`);\n }\n\n const dependencyNames = Object.keys(dependencies);\n return {\n name: packageName,\n dependencies: dependencyNames\n };\n}\n\nasync function resolveLocalFile(ctx: MetadataContext, packageDir: string, localModuleId: string) {\n const result = await ctx.resolve(`./${localModuleId}`, `${packageDir}/package.json`, {\n skipSelf: true\n });\n return result?.id;\n}\n\nfunction formatPackageLocation(loc: PackageLocation) {\n switch (loc.type) {\n case \"absolute\":\n return `${loc.directory}`;\n case \"unresolved\":\n return `'${loc.packageName}' required by ${loc.importedFrom}`;\n }\n}\n\nconst NODE_MODULES_RE = /[\\\\/]node_modules[\\\\/]/;\n\nfunction isLocalPackage(file: string, sourceDir: string) {\n return isInDirectory(file, sourceDir) && !NODE_MODULES_RE.test(file);\n}\n\nconst PACKAGE_JSON_RE = /[\\\\/]package\\.json($|\\?)/;\n\nfunction isPackageJson(file: string) {\n return PACKAGE_JSON_RE.test(file);\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport class ReportableError extends Error {}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport * as fs from \"node:fs\";\nimport { isAbsolute, relative } from \"node:path\";\n\n/**\n * Asynchronously checks for the existence of `file`.\n */\nexport function fileExists(file: string): Promise<boolean> {\n return fs.promises\n .access(file, fs.constants.F_OK)\n .then(() => true)\n .catch(() => false);\n}\n\n/**\n * Returns true if `candidate` is a child of `directory`.\n */\nexport function isInDirectory(candidate: string, directory: string): boolean {\n const rel = relative(directory, candidate);\n const isChild = rel && !rel.startsWith(\"..\") && !isAbsolute(rel);\n return !!isChild;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * A simple cache implementing read-through semantics.\n *\n * The {@link CacheProvider} passed to the cache's constructor\n * implements the actual computation of values.\n *\n * The cache deduplicates computations and caches their results\n * until they are invalidated.\n */\nexport class Cache<Key, Value, Context extends unknown[] = []> {\n private values = new Map<string, Value>();\n private jobs = new Map<string, Promise<Value>>();\n private provider: CacheProvider<Key, Value, Context>;\n\n constructor(provider: CacheProvider<Key, Value, Context>) {\n this.provider = provider;\n }\n\n /**\n * Removes an entry associated with the given key.\n */\n invalidate(key: Key): void {\n const id = this.provider.getId(key);\n const oldValue = this.values.get(id);\n this.values.delete(id);\n this.jobs.delete(id);\n if (oldValue) {\n this.provider.onInvalidate?.(key, oldValue);\n }\n }\n\n /**\n * Retrieves the value associated with `key`.\n * A cached result will be used if present, otherwise the\n * cache provider will be called.\n *\n * Note: computations may throw errors.\n * Errors will not be cached.\n *\n * @param key the lookup key\n * @param context an arbitrary set of values that will be forwarded to the provider\n * should be provider be called.\n * @returns the value associated with `key`\n */\n async get(key: Key, ...context: Context): Promise<Value> {\n const provider = this.provider;\n const id = provider.getId(key);\n\n const values = this.values;\n const existingValue = values.get(id);\n if (existingValue) {\n provider.onCachedReturn?.(key, existingValue);\n return Promise.resolve(existingValue);\n }\n\n const jobs = this.jobs;\n const existingJob = jobs.get(id);\n if (existingJob) {\n return existingJob;\n }\n\n const job = provider.getValue(key, ...context);\n jobs.set(id, job);\n try {\n const value = await job;\n if (jobs.get(id) === job) {\n values.set(id, value);\n }\n return value;\n } finally {\n if (jobs.get(id) === job) {\n jobs.delete(id);\n }\n }\n }\n}\n\nexport interface CacheProvider<Key, Value, Context extends unknown[] = []> {\n /**\n * Maps the `key` to a unique id.\n * The id is used internally to store the result values.\n *\n * Keys mapping to the same `id` are treated as equivalent.\n */\n getId(key: Key): string;\n\n /**\n * Given a `key`, compute its associated `value`.\n * Only one computation for each `key` is started at a time.\n */\n getValue(key: Key, ...context: Context): Promise<Value>;\n\n /**\n * Called when the cache successfully invalidated an old value.\n */\n onInvalidate?(key: Key, oldValue: Value): void;\n\n /**\n * Called when the cache successfully returns a cached result.\n */\n onCachedReturn?(key: Key, value: Value): void;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { pathToFileURL } from \"node:url\";\nimport {\n BuildConfig,\n PropertyMetaConfig,\n ProvidesConfig,\n ReferenceConfig,\n ServiceConfig\n} from \"@open-pioneer/build-support\";\nimport { verifyBuildConfigSchema } from \"./BuildConfigSchema\";\n\nexport const BUILD_CONFIG_NAME = \"build.config.mjs\";\n\nexport interface NormalizedPackageConfig {\n services: NormalizedServiceConfig[];\n styles: string | undefined;\n i18n: string[] | undefined;\n ui: NormalizedUiConfig;\n properties: NormalizedProperty[];\n}\n\nexport interface NormalizedServiceConfig {\n name: string;\n provides: ProvidesConfig[];\n references: Record<string, ReferenceConfig>;\n}\n\nexport interface NormalizedUiConfig {\n references: ReferenceConfig[];\n}\n\nexport interface NormalizedProperty {\n name: string;\n defaultValue: unknown;\n required: boolean;\n}\n\nlet requestId = 0;\n\n/**\n * Loads and parses a build configuration file from the given path on disk.\n */\nexport async function loadBuildConfig(path: string): Promise<NormalizedPackageConfig> {\n const fileURL = pathToFileURL(path);\n const importedModule = (await import(`${fileURL}?id=${++requestId}`)) as Record<\n string,\n unknown\n >;\n if (!importedModule || !importedModule.default) {\n throw new Error(`The module must contain a default export.`);\n }\n\n const config = importedModule.default;\n return parseBuildConfig(config);\n}\n\n/**\n * Parses a build configuration object and validates it.\n */\nexport function parseBuildConfig(object: unknown): NormalizedPackageConfig {\n const rawConfig = verifyBuildConfigSchema(object);\n return normalizeConfig(rawConfig);\n}\n\nconst BUILD_CONFIG_RE = /[\\\\/]build\\.config\\.mjs($|\\?)/;\n\nexport function isBuildConfig(file: string) {\n return BUILD_CONFIG_RE.test(file);\n}\n\nfunction normalizeConfig(rawConfig: BuildConfig): NormalizedPackageConfig {\n return {\n styles: rawConfig.styles,\n i18n: rawConfig.i18n,\n services: Object.entries(rawConfig.services ?? {}).map(([serviceName, serviceConfig]) => {\n return normalizeServiceConfig(serviceName, serviceConfig);\n }),\n ui: normalizeUiConfig(rawConfig.ui),\n properties: normalizeProperties(rawConfig.properties, rawConfig.propertiesMeta)\n };\n}\n\nfunction normalizeServiceConfig(name: string, rawConfig: ServiceConfig): NormalizedServiceConfig {\n return {\n name: name,\n provides: normalizeProvidesConfig(rawConfig.provides),\n references: normalizeReferencesConfig(rawConfig.references)\n };\n}\n\nfunction normalizeProvidesConfig(rawConfig: ServiceConfig[\"provides\"]): ProvidesConfig[] {\n if (!rawConfig) {\n return [];\n }\n\n if (typeof rawConfig === \"string\") {\n return [\n {\n name: rawConfig\n }\n ];\n }\n\n return rawConfig.map((providesConfig) => {\n const normalized: ProvidesConfig =\n typeof providesConfig === \"string\" ? { name: providesConfig } : providesConfig;\n return normalized;\n });\n}\n\nfunction normalizeReferencesConfig(\n rawConfig: ServiceConfig[\"references\"]\n): Record<string, ReferenceConfig> {\n if (!rawConfig) {\n return {};\n }\n\n return Object.fromEntries(\n Object.entries(rawConfig).map(([referenceName, referenceConfig]) => {\n return [referenceName, normalizeReferenceConfig(referenceConfig)];\n })\n );\n}\n\nfunction normalizeReferenceConfig(rawConfig: string | ReferenceConfig): ReferenceConfig {\n if (typeof rawConfig === \"string\") {\n return { name: rawConfig };\n }\n return rawConfig;\n}\n\nfunction normalizeUiConfig(rawConfig: BuildConfig[\"ui\"]): NormalizedUiConfig {\n return {\n references: rawConfig?.references?.map(normalizeReferenceConfig) ?? []\n };\n}\n\nfunction normalizeProperties(\n properties: Record<string, unknown> | undefined,\n propertiesMeta: Record<string, PropertyMetaConfig> | undefined\n): NormalizedProperty[] {\n const result: NormalizedProperty[] = [];\n for (const [name, defaultValue] of Object.entries(properties ?? {})) {\n const required = propertiesMeta?.[name]?.required ?? false;\n result.push({\n name,\n defaultValue,\n required\n });\n }\n return result;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { z } from \"zod\";\nimport {\n BuildConfig,\n PropertyMetaConfig,\n ProvidesConfig,\n ReferenceConfig,\n ServiceConfig,\n UiConfig\n} from \"@open-pioneer/build-support\";\nimport { fromZodError } from \"zod-validation-error\";\n\nconst LITERAL_SCHEMA = z.union([z.string(), z.number(), z.boolean(), z.null()]);\n\ntype Literal = z.infer<typeof LITERAL_SCHEMA>;\n\ntype Json = Literal | { [key: string]: Json } | Json[];\n\nconst JSON_SCHEMA: z.ZodType<Json> = z.lazy(() =>\n z.union([LITERAL_SCHEMA, z.array(JSON_SCHEMA), z.record(JSON_SCHEMA)])\n);\n\nconst PROPERTY_META_SCHEMA: z.ZodType<PropertyMetaConfig> = z.strictObject({\n required: z.boolean().optional()\n});\n\nconst REFERENCE_CONFIG_SCHEMA: z.ZodType<ReferenceConfig> = z.strictObject({\n name: z.string(),\n qualifier: z.string().optional(),\n all: z.boolean().optional()\n});\n\nconst PROVIDES_CONFIG_SCHEMA: z.ZodType<ProvidesConfig> = z.strictObject({\n name: z.string(),\n qualifier: z.string().optional()\n});\n\nconst UI_CONFIG_SCHEMA: z.ZodType<UiConfig> = z.strictObject({\n references: z.array(z.string().or(REFERENCE_CONFIG_SCHEMA)).optional()\n});\n\nconst SERVICE_CONFIG_SCHEMA: z.ZodType<ServiceConfig> = z.strictObject({\n provides: z\n .string()\n .or(z.array(z.string().or(PROVIDES_CONFIG_SCHEMA)))\n .optional(),\n references: z.record(z.string(), z.string().or(REFERENCE_CONFIG_SCHEMA)).optional()\n});\n\nconst BUILD_CONFIG_SCHEMA: z.ZodType<BuildConfig> = z.strictObject({\n styles: z.string().optional(),\n i18n: z.array(z.string()).optional(),\n services: z.record(z.string(), SERVICE_CONFIG_SCHEMA).optional(),\n ui: UI_CONFIG_SCHEMA.optional(),\n properties: z.record(z.string(), JSON_SCHEMA).optional(),\n propertiesMeta: z.record(z.string(), PROPERTY_META_SCHEMA).optional()\n});\n\n/**\n * Ensures that `value` conforms to the {@link BuildConfig} interface.\n * Throws an error if that is not the case.\n *\n * @returns `value` but casted to the appropriate type.\n */\nexport function verifyBuildConfigSchema(value: unknown): BuildConfig {\n const result = BUILD_CONFIG_SCHEMA.safeParse(value);\n if (result.success) {\n return result.data;\n }\n throw fromZodError(result.error);\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { readFile } from \"fs/promises\";\nimport { load as loadYaml } from \"js-yaml\";\nimport { z } from \"zod\";\nimport { fromZodError } from \"zod-validation-error\";\nimport { ReportableError } from \"../ReportableError\";\n\nexport interface I18nFile {\n /**\n * Direct messages for the current package.\n *\n * Key: message id, Value: message template string\n */\n messages: Map<string, string>;\n\n /**\n * Overrides for other packages.\n * Can be used from an app.\n *\n * Key: package name, Value: message record as in {@link messages}.\n */\n overrides: Map<string, Map<string, string>>;\n}\n\ninterface RawI18nFile {\n messages?: RecursiveMessages | null | undefined;\n overrides?: Record<string, RecursiveMessages> | null | undefined;\n}\n\ninterface RecursiveMessages {\n [key: string]: string | RecursiveMessages;\n}\n\nconst MESSAGES_SCHEMA: z.ZodType<RecursiveMessages> = z.lazy(() =>\n z.record(z.union([z.string(), MESSAGES_SCHEMA]))\n);\n\n// allow null for empty yaml objects\nconst I18N_SCHEMA: z.ZodType<RawI18nFile | null | undefined> = z\n .strictObject({\n messages: MESSAGES_SCHEMA.nullish().optional(),\n overrides: z.record(MESSAGES_SCHEMA).nullish().optional()\n })\n .nullish();\n\n/**\n * Loads an i18n.yaml file from the file system and parses it.\n */\nexport async function loadI18nFile(path: string): Promise<I18nFile> {\n let content;\n try {\n content = await readFile(path, \"utf-8\");\n } catch (e) {\n throw new ReportableError(`Failed to read ${path}: ${e}`);\n }\n\n try {\n return parseI18nYaml(content);\n } catch (e) {\n throw new ReportableError(`Failed to parse ${path}: ${e}`);\n }\n}\n\n/**\n * Parses an i18n yaml document.\n */\nexport function parseI18nYaml(yaml: string): I18nFile {\n const data = loadYaml(yaml);\n return parseI18nFile(data);\n}\n\n/**\n * Parses the JavaScript object representing an i18n file.\n */\nexport function parseI18nFile(data: unknown): I18nFile {\n const result = I18N_SCHEMA.safeParse(data);\n if (!result.success) {\n throw fromZodError(result.error);\n }\n\n const rawI18n = result.data;\n return {\n messages: gatherMessages(rawI18n?.messages ?? undefined),\n overrides: gatherOverrides(rawI18n?.overrides ?? undefined)\n };\n}\n\nfunction gatherMessages(data: RecursiveMessages | undefined): Map<string, string> {\n const messages = new Map<string, string>();\n const prefix: string[] = [];\n const visitChildren = (record: RecursiveMessages) => {\n for (const [key, value] of Object.entries(record)) {\n if (typeof value === \"string\") {\n visitMessage(key, value);\n } else if (value) {\n prefix.push(key);\n visitChildren(value);\n prefix.pop();\n }\n }\n };\n const visitMessage = (key: string, message: string) => {\n const id = [...prefix, key].join(\".\");\n if (messages.has(id)) {\n throw new Error(`Message '${id}' was already defined.`);\n }\n messages.set(id, message);\n };\n\n if (data) {\n visitChildren(data);\n }\n return messages;\n}\n\nfunction gatherOverrides(\n data: Record<string, RecursiveMessages> | undefined\n): Map<string, Map<string, string>> {\n const overrides = new Map<string, Map<string, string>>();\n if (data) {\n for (const [key, value] of Object.entries(data)) {\n overrides.set(key, gatherMessages(value));\n }\n }\n return overrides;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { PackageMetadata } from \"../metadata/MetadataRepository\";\n\nexport type PackageMetadataInput = Pick<PackageMetadata, \"cssFilePath\">;\n\n/**\n * Generates a css file that imports the css file defined by the packages.\n */\nexport function generateCombinedCss(packages: PackageMetadataInput[]) {\n const cssImport = (file: string) => `@import ${JSON.stringify(file)};`;\n return packages\n .filter((pkg) => !!pkg.cssFilePath)\n .map((pkg) => cssImport(pkg.cssFilePath!)) // eslint-disable-line @typescript-eslint/no-non-null-assertion\n .join(\"\\n\");\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { dirname } from \"node:path\";\n\nconst APP_META_RE = /[?&]open-pioneer-app(?:$|&)/;\nconst APP_PACKAGES_RE = /[?&]open-pioneer-packages(?:$|&)/;\nconst APP_CSS_RE = /[?&]open-pioneer-styles(?:$|&)/;\nconst APP_I18N_INDEX_RE = /[?&]open-pioneer-i18n-index(?:$|&)/;\nconst APP_I18N_RE = /[?&]open-pioneer-i18n(?:$|&)/;\nconst APP_I18N_LOCALE_RE = /[?&]locale=(?<locale>.*?)(?:$|&)/;\nconst APP_HOOKS_RE = /[/\\\\]@@open-pioneer-react-hooks(?:\\?|$)/;\nconst SOURCE_FILE_RE = /^(.*?)(?:\\?|$)/;\n\nexport const APP_META_QUERY = \"open-pioneer-app\";\nexport const APP_PACKAGES_QUERY = \"open-pioneer-packages\";\nexport const APP_CSS_QUERY = \"open-pioneer-styles\";\nexport const APP_I18N_INDEX_QUERY = \"open-pioneer-i18n-index\";\nexport const APP_I18N_QUERY = \"open-pioneer-i18n\";\nexport const PACKAGE_HOOKS = \"@@open-pioneer-react-hooks\";\n\nexport interface VirtualAppModule {\n type: \"app-meta\" | \"app-packages\" | \"app-css\" | \"app-i18n-index\";\n importer: string;\n}\n\nexport interface VirtualI18nMessages {\n type: \"app-i18n\";\n importer: string;\n locale: string;\n}\n\nexport interface VirtualPackageModule {\n type: \"package-hooks\";\n packageDirectory: string;\n}\n\nexport function parseVirtualAppModuleId(\n moduleId: string\n): VirtualAppModule | VirtualI18nMessages | VirtualPackageModule | undefined {\n if (moduleId.match(APP_HOOKS_RE)) {\n return {\n type: \"package-hooks\",\n packageDirectory: dirname(getSourceFile(moduleId))\n };\n }\n\n if (moduleId.match(APP_META_RE)) {\n const type = \"app-meta\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_PACKAGES_RE)) {\n const type = \"app-packages\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_CSS_RE)) {\n const type = \"app-css\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_I18N_INDEX_RE)) {\n const type = \"app-i18n-index\";\n const importer = getSourceFile(moduleId);\n return { type, importer };\n } else if (moduleId.match(APP_I18N_RE)) {\n const type = \"app-i18n\";\n const importer = getSourceFile(moduleId);\n const locale = moduleId.match(APP_I18N_LOCALE_RE)?.groups?.[\"locale\"];\n if (!locale) {\n throw new Error(\"Missing locale name in i18n module request\");\n }\n return { type, importer, locale };\n }\n return undefined;\n}\n\nexport function appLocaleFileId(appModuleId: string, locale: string) {\n return `${appModuleId}?${APP_I18N_QUERY}&locale=${locale}`;\n}\n\nfunction getSourceFile(moduleId: string) {\n const sourceFile = moduleId.match(SOURCE_FILE_RE)?.[1];\n if (!sourceFile || moduleId[0] == \"\\0\") {\n throw new Error(`Failed to get actual source file from '${moduleId}'.`);\n }\n return sourceFile;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { APP_CSS_QUERY, APP_I18N_INDEX_QUERY, APP_PACKAGES_QUERY } from \"./shared\";\n\n/**\n * Generates the main app metadata module.\n * It delegates the actual metadata generation to auxiliary modules.\n */\nexport function generateAppMetadata(importer: string, metadataModuleId: string) {\n /*\n CSS loading: \n - 'inline' loads the css as a string literal.\n - the suffix (e.g. '.css') at the very end is important to trigger the correct vite plugin!\n - I would like to import css as an url instead (separate file),\n but that currently hinges on https://github.com/vitejs/vite/pull/11084\n\n - TODO: .scss support (will currently trigger the esbuild plugin and an error because the file contains both .ts and .scss)\n\n Hot reloading:\n - See https://vitejs.dev/guide/api-hmr.html for vite's HMR API\n - When a css string changes, the module exporting the `stylesString` below changes.\n We accept those changes through the `import.meta.hot.accept` mechanism by\n calling the `setValue` method on the old observable box value.\n The runtime has a reference to the box and watches for changes (only during development!)\n - The code below takes care to use the _correct_ `styles` box (every module has its own, even the new version).\n `import.meta.hot.data` is shared between all versions of the module, so we always use the first box.\n */\n const packagesModule = `${importer}?${APP_PACKAGES_QUERY}`;\n const cssModule = `${importer}?${APP_CSS_QUERY}&inline&lang.css`;\n const i18nModule = `${importer}?${APP_I18N_INDEX_QUERY}`;\n return `\nimport { createBox } from ${JSON.stringify(metadataModuleId)};\nimport packages from ${JSON.stringify(packagesModule)};\nimport stylesString from ${JSON.stringify(cssModule)};\nimport { locales, loadMessages } from ${JSON.stringify(i18nModule)};\n\nconst styles = createBox(stylesString);\nif (import.meta.hot) {\n import.meta.hot.data.styles ??= styles;\n import.meta.hot.accept((mod) => {\n if (mod && mod.packages === packages && mod.locales === locales && mod.loadMessages === loadMessages) {\n import.meta.hot.data.styles.setValue(mod.styles.value);\n return;\n }\n \n // Cannot handle all other changes the moment; trigger reload.\n import.meta.hot.invalidate();\n });\n}\n\nexport {\n packages,\n styles,\n locales,\n loadMessages\n};\n`.trim();\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nexport function generateReactHooks(packageName: string, runtimeModuleId: string) {\n return `\nimport { useServiceInternal, useServicesInternal, usePropertiesInternal, useIntlInternal } from ${JSON.stringify(\n runtimeModuleId\n )};\n\nconst PACKAGE_NAME = ${JSON.stringify(packageName)};\nexport const useService = /*@__PURE__*/ useServiceInternal.bind(undefined, PACKAGE_NAME);\nexport const useServices = /*@__PURE__*/ useServicesInternal.bind(undefined, PACKAGE_NAME);\nexport const useProperties = /*@__PURE__*/ usePropertiesInternal.bind(undefined, PACKAGE_NAME);\nexport const useIntl = /*@__PURE__*/ useIntlInternal.bind(undefined, PACKAGE_NAME);\n `.trim();\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport * as nodes from \"@babel/types\";\nimport template from \"@babel/template\";\nimport { appLocaleFileId } from \"./shared\";\nimport generate from \"@babel/generator\";\nimport { PackageMetadata } from \"../metadata/MetadataRepository\";\nimport { ReportableError } from \"../ReportableError\";\nimport { I18nFile } from \"../metadata/parseI18nYaml\";\n\nconst INDEX_TEMPLATE = template.program(`\n export const locales = %%LOCALES_ARRAY%%;\n\n export function loadMessages(locale) {\n %%LOCALE_SWITCH%%\n throw new Error(\\`Unsupported locale: '\\${locale}'\\`);\n }\n`);\n\nconst IMPORT_TEMPLATE = template.statement(`\n return import(%%MODULE_ID%%).then(mod => mod.default);\n`);\n\nconst MESSAGES_TEMPLATE = template.program(`\n const messages = JSON.parse(%%SERIALIZED%%);\n export default messages;\n`);\n\n/**\n * Generates a lookup table for the languages supported by the given application.\n */\nexport function generateI18nIndex(importer: string, locales: string[]): string {\n const localesArray = nodes.arrayExpression(\n locales.map((locale) => nodes.stringLiteral(locale))\n );\n const switchStmt = nodes.switchStatement(\n nodes.identifier(\"locale\"),\n locales.map((locale) => {\n const localeModuleId = appLocaleFileId(importer, locale);\n const importStatement = IMPORT_TEMPLATE({\n MODULE_ID: nodes.stringLiteral(localeModuleId)\n });\n return nodes.switchCase(nodes.stringLiteral(locale), [importStatement]);\n })\n );\n\n const program = INDEX_TEMPLATE({\n LOCALES_ARRAY: localesArray,\n LOCALE_SWITCH: switchStmt\n });\n return generate(program).code;\n}\n\nexport interface I18nMessageOptions {\n /** The locale to generate. */\n locale: string;\n\n /** The name of the current application. */\n appName: string;\n\n /** All packages in the application (including the app). */\n packages: Pick<PackageMetadata, \"name\" | \"i18nPaths\">[];\n\n /** Called by the function when the contents of an i18n file (in i18nPaths) is required. */\n loadI18n: (path: string) => Promise<I18nFile>;\n}\n\n/**\n * Generates a messages module containing a single default export: the messages record.\n *\n * Messages are taken from the given packages (for the specified locale).\n */\nexport async function generateI18nMessages(options: I18nMessageOptions): Promise<string> {\n const { locale, appName, packages, loadI18n } = options;\n const packageMessages = new Map<string, Map<string, string>>();\n const packagesNeedingMessages = new Set<string>();\n let packageOverrides: Map<string, Map<string, string>> | undefined;\n for (const pkg of packages) {\n if (pkg.i18nPaths.size !== 0) {\n // Remember packages that have i18n settings. If they are not supported\n // in a given language, and the app does not specify custom messages for this package, an error is emitted.\n packagesNeedingMessages.add(pkg.name);\n }\n\n const filePath = pkg.i18nPaths.get(locale);\n if (!filePath) {\n continue;\n }\n\n const { messages, overrides } = await loadI18n(filePath);\n if (overrides.size !== 0) {\n if (pkg.name !== appName) {\n throw new ReportableError(\n `Unexpected 'overrides' block in '${filePath}'. Overrides are only supported in the app.`\n );\n }\n packageOverrides = overrides;\n }\n\n packageMessages.set(pkg.name, messages);\n }\n\n // Override messages\n if (packageOverrides) {\n for (const [packageName, messages] of packageOverrides.entries()) {\n const existingMessages = packageMessages.get(packageName);\n if (!existingMessages) {\n packageMessages.set(packageName, messages);\n continue;\n }\n\n const updatedMessages = new Map([...existingMessages, ...messages]);\n packageMessages.set(packageName, updatedMessages);\n }\n }\n\n // Verify that required messages are present\n for (const packageName of packagesNeedingMessages) {\n const messages = packageMessages.get(packageName);\n if (!messages) {\n throw new ReportableError(\n `Package '${packageName}' requires messages for locale '${locale}'. Either update the package or add messages from the app via 'overrides'.`\n );\n }\n }\n\n // Translate to json for codegen. Package name -> key -> i18n message template\n const allMessages: Record<string, Record<string, string>> = {};\n for (const [packageName, messages] of packageMessages.entries()) {\n allMessages[packageName] = Object.fromEntries(messages.entries());\n }\n\n // Transport the object as a json string for improved parsing performance\n const serialized = JSON.stringify(allMessages);\n const program = MESSAGES_TEMPLATE({\n SERIALIZED: nodes.stringLiteral(serialized)\n });\n return generate(program).code;\n}\n", "// SPDX-FileCopyrightText: con terra GmbH and contributors\n// SPDX-License-Identifier: Apache-2.0\nimport { Plugin, ResolvedConfig } from \"vite\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { posix } from \"node:path\";\nimport { cwd } from \"node:process\";\nimport { type PioneerPluginOptions } from \".\";\nimport { RollupOptions } from \"rollup\";\n\nexport function mpaPlugin(options: PioneerPluginOptions | undefined): Plugin {\n const rootSite = options?.rootSite ?? false;\n const apps = options?.apps || [];\n const sites = options?.sites || [];\n\n let resolvedConfig: ResolvedConfig;\n return {\n name: \"pioneer:mpa\",\n\n config(config) {\n const sourceRoot = config.root ?? cwd();\n const entryPoints = gatherEntryPoints({ apps, sites, rootSite, sourceRoot });\n const rollupOptions: RollupOptions = {\n input: entryPoints,\n output: {\n entryFileNames(chunk) {\n if (apps.includes(chunk.name)) {\n return \"[name].js\";\n }\n\n // This will rename the .js files that belong to a .html site, they don't need a public name.\n return posix.join(resolvedConfig.build.assetsDir, \"[name]-[hash].js\");\n }\n }\n };\n\n return {\n build: {\n rollupOptions\n }\n };\n },\n\n configResolved(config) {\n resolvedConfig = config;\n }\n };\n}\n\nfunction gatherEntryPoints(options: {\n apps: string[];\n sites: string[];\n rootSite: boolean;\n sourceRoot: string;\n}): Record<string, string> {\n const apps = options.apps.map((appName) => {\n const prefix = resolve(options.sourceRoot, \"apps\", appName, \"app\");\n const path = findMatchingEntryPointFile(prefix);\n return {\n name: appName,\n path: path\n };\n });\n\n /*\n * Vite does not respect the entry point name for html files, it\n * put each html site at a location mirroring the source directory structure (e.g. site/<SITE>/index.html\n * instead of SITE.html).\n *\n * There are multiple vite mpa plugins that handle custom html paths which can either be used\n * directly or as inspiration.\n */\n const sites = options.sites.map((siteName) => {\n const path = resolve(options.sourceRoot, \"sites\", siteName, \"index.html\");\n if (!existsSync(path)) {\n throw new Error(\n `Failed to find site '${siteName}' at ${path}. Please ensure that the site name is spelled correctly.`\n );\n }\n return {\n name: siteName,\n path: path\n };\n });\n if (options.rootSite) {\n const path = resolve(options.sourceRoot, \"index.html\");\n if (!existsSync(path)) {\n throw new Error(`Failed to find root site at ${path}. Please create the missing file.`);\n }\n sites.push({\n name: \"index\",\n path: path\n });\n }\n\n const entryPoints: Record<string, string> = {};\n let entryPointCount = 0;\n for (const { name, path } of [apps, sites].flat()) {\n const existingPath = entryPoints[name];\n if (existingPath) {\n throw new Error(\n `Entry point '${name}' was defined twice (paths ${existingPath} and ${path}). Please remove the duplicated entry.`\n );\n }\n entryPoints[name] = path;\n ++entryPointCount;\n }\n if (entryPointCount === 0) {\n throw new Error(\n \"You must configure at least one site or one app in the pioneer plugin options.\"\n );\n }\n return entryPoints;\n}\n\nconst EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".jsx\"];\n\nfunction findMatchingEntryPointFile(prefix: string) {\n for (const ext of EXTENSIONS) {\n const candidate = prefix + ext;\n if (existsSync(candidate)) {\n return candidate;\n }\n }\n\n const extensions = EXTENSIONS.join(\", \");\n throw new Error(\n `Failed to find a matching entry point file for '${prefix}'. Supported extensions are ${extensions}. Ensure that the app name is spelled correctly or create the missing file.`\n );\n}\n"],
|
|
5
|
+
"mappings": "skBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,ICEA,IAAAI,GAA2B,mBAC3BC,EAA8B,qBAE9BC,EAAqE,gBCHrE,IAAAC,EAAsB,iBAMf,SAASC,EAAeC,EAA6B,CACxD,IAAMC,KAAS,SAAMD,CAAS,EAC9B,OAAO,YAA0BE,EAAM,CACnCD,EAAO,GAAGC,CAAI,CAClB,CACJ,CCXA,IAAAC,EAAqB,+BACrBC,EAAqB,8BACrBC,EAAuB,2BCFhB,IAAMC,EAAN,KAAkB,CACb,SAAW,IAAI,IAKvB,SAASC,EAAuB,CAC5B,IAAMC,EAAQC,GAAUF,CAAK,EAEvBG,EAAW,KAAK,SAChBC,EAAQD,EAAS,IAAIF,CAAK,GAAK,EACrC,OAAAE,EAAS,IAAIF,EAAOG,EAAQ,CAAC,EACtBA,IAAU,EAAIH,EAAQ,GAAGA,KAASG,GAC7C,CACJ,EAEA,SAASF,GAAUF,EAAe,CAC9B,IAAIC,EAAQD,EAAM,QAAQ,kBAAmB,GAAG,EAChD,OAAAC,EAAQA,EAAM,QAAQ,UAAW,EAAE,EAC/B,MA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,CAC/C",
|
|
6
|
+
"names": ["src_exports", "__export", "pioneer", "__toCommonJS", "import_node_fs", "import_node_path", "import_vite", "import_debug", "createDebugger", "namespace", "logger", "args", "import_generator", "import_template", "nodes", "IdGenerator", "input", "clean", "cleanName", "existing", "count", "SERVICE_IMPORT", "template", "PKG_OBJECT", "SERVICE_OBJECT", "INTERFACE_OBJECT", "REFERENCE_OBJECT", "UI_OBJECT", "PROPERTY_OBJECT", "generatePackagesMetadata", "packages", "idGenerator", "IdGenerator", "packagesMetadata", "imports", "pkg", "packageMetadata", "generatePackageMetadata", "variableName", "className", "entryPoint", "id", "renderedImporter", "program", "generate", "options", "servicesObject", "service", "importName", "serviceObject", "p", "undefinedNode", "referenceName", "referenceConfig", "referenceObject", "uiObject", "r", "propertiesObject", "prop", "jsonToExpression", "json", "item", "name", "value", "import_promises", "import_path", "import_vite", "ReportableError", "fs", "import_node_path", "fileExists", "file", "isInDirectory", "candidate", "directory", "rel", "Cache", "provider", "key", "_a", "_b", "id", "oldValue", "context", "values", "existingValue", "jobs", "existingJob", "job", "value", "import_node_url", "import_zod", "import_zod_validation_error", "LITERAL_SCHEMA", "JSON_SCHEMA", "PROPERTY_META_SCHEMA", "REFERENCE_CONFIG_SCHEMA", "PROVIDES_CONFIG_SCHEMA", "UI_CONFIG_SCHEMA", "SERVICE_CONFIG_SCHEMA", "BUILD_CONFIG_SCHEMA", "verifyBuildConfigSchema", "value", "result", "BUILD_CONFIG_NAME", "requestId", "loadBuildConfig", "path", "importedModule", "config", "parseBuildConfig", "object", "rawConfig", "verifyBuildConfigSchema", "normalizeConfig", "BUILD_CONFIG_RE", "isBuildConfig", "file", "serviceName", "serviceConfig", "normalizeServiceConfig", "normalizeUiConfig", "normalizeProperties", "name", "normalizeProvidesConfig", "normalizeReferencesConfig", "providesConfig", "referenceName", "referenceConfig", "normalizeReferenceConfig", "_a", "properties", "propertiesMeta", "result", "defaultValue", "required", "import_promises", "import_js_yaml", "import_zod", "import_zod_validation_error", "MESSAGES_SCHEMA", "I18N_SCHEMA", "loadI18nFile", "path", "content", "e", "ReportableError", "parseI18nYaml", "yaml", "data", "loadYaml", "parseI18nFile", "result", "rawI18n", "gatherMessages", "gatherOverrides", "messages", "prefix", "visitChildren", "record", "key", "value", "visitMessage", "message", "id", "overrides", "isDebug", "debug", "createDebugger", "MetadataRepository", "sourceRoot", "path", "isPackageJson", "isBuildConfig", "ctx", "appDirectory", "appPackageMetadata", "ReportableError", "appLocales", "packageMetadataByName", "visitDependencies", "dependencies", "importedFrom", "jobs", "packageName", "packageMetadata", "loc", "formatPackageLocation", "packageDir", "isLocalPackage", "entry", "propagateWatchFiles", "warning", "i18n", "watchFiles", "unresolvedPackageJson", "packageJsonLocation", "Cache", "loadI18nFile", "provider", "directory", "warnings", "trackingCtx", "id", "msg", "metadata", "parsePackageMetadata", "existingMetadata", "file", "_a", "packageJsonPath", "parsePackageJson", "buildConfigPath", "BUILD_CONFIG_NAME", "buildConfig", "fileExists", "loadBuildConfig", "e", "entryPoint", "cssFile", "resolveLocalFile", "i18nPaths", "locale", "packageJsonContent", "dependencyNames", "localModuleId", "result", "NODE_MODULES_RE", "sourceDir", "isInDirectory", "PACKAGE_JSON_RE", "generateCombinedCss", "packages", "cssImport", "file", "pkg", "import_node_path", "APP_META_RE", "APP_PACKAGES_RE", "APP_CSS_RE", "APP_I18N_INDEX_RE", "APP_I18N_RE", "APP_I18N_LOCALE_RE", "APP_HOOKS_RE", "SOURCE_FILE_RE", "APP_META_QUERY", "APP_PACKAGES_QUERY", "APP_CSS_QUERY", "APP_I18N_INDEX_QUERY", "APP_I18N_QUERY", "PACKAGE_HOOKS", "parseVirtualAppModuleId", "moduleId", "_a", "_b", "getSourceFile", "type", "importer", "locale", "appLocaleFileId", "appModuleId", "sourceFile", "generateAppMetadata", "importer", "metadataModuleId", "packagesModule", "APP_PACKAGES_QUERY", "cssModule", "APP_CSS_QUERY", "i18nModule", "APP_I18N_INDEX_QUERY", "import_promises", "generateReactHooks", "packageName", "runtimeModuleId", "nodes", "import_template", "import_generator", "INDEX_TEMPLATE", "template", "IMPORT_TEMPLATE", "MESSAGES_TEMPLATE", "generateI18nIndex", "importer", "locales", "localesArray", "locale", "switchStmt", "localeModuleId", "appLocaleFileId", "importStatement", "program", "generate", "generateI18nMessages", "options", "appName", "packages", "loadI18n", "packageMessages", "packagesNeedingMessages", "packageOverrides", "pkg", "filePath", "messages", "overrides", "ReportableError", "packageName", "existingMessages", "updatedMessages", "allMessages", "serialized", "isDebug", "debug", "createDebugger", "codegenPlugin", "manualDeps", "config", "repository", "devServer", "reactIntegrationId", "metadataId", "resolve", "rawModuleId", "resolvedResult", "resolvedConfig", "MetadataRepository", "server", "_", "path", "moduleIds", "moduleId", "mod", "err", "importer", "ReportableError", "APP_META_QUERY", "packageJsonPath", "findPackageJson", "PACKAGE_HOOKS", "e", "reportError", "_a", "virtualModule", "parseVirtualAppModuleId", "directory", "packageName", "getPackageName", "generatedSourceCode", "generateReactHooks", "generateAppMetadata", "pkgJsonPath", "context", "buildMetadataContext", "appDir", "appMetadata", "generatePackagesMetadata", "generateCombinedCss", "generateI18nIndex", "generateI18nMessages", "ctx", "id", "addManualDep", "error", "message", "file", "normalizedPath", "startDir", "rootDir", "dir", "candidate", "parent", "name", "content", "import_node_fs", "import_node_path", "import_node_process", "mpaPlugin", "options", "rootSite", "apps", "sites", "resolvedConfig", "config", "sourceRoot", "gatherEntryPoints", "chunk", "appName", "prefix", "path", "findMatchingEntryPointFile", "siteName", "entryPoints", "entryPointCount", "name", "existingPath", "EXTENSIONS", "ext", "candidate", "extensions", "pioneer", "options", "mpaPlugin", "codegenPlugin"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-pioneer/vite-plugin-pioneer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "types.d.ts",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"rimraf": "^4.1.2",
|
|
39
39
|
"rollup": "^3.13.0",
|
|
40
40
|
"vite": "^4.1.1",
|
|
41
|
-
"@open-pioneer/
|
|
42
|
-
"@open-pioneer/
|
|
41
|
+
"@open-pioneer/vite-plugin-pioneer": "^0.2.4",
|
|
42
|
+
"@open-pioneer/build-support": "^0.2.1"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"clean": "rimraf dist temp",
|