Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions cli/src/commands/xlr/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ export default class XLRCompile extends BaseCommand {
}

if (generatedCapabilites) {
generatedCapabilites = {
...generatedCapabilites,
};
if (customPrimitives) {
generatedCapabilites = {
...generatedCapabilites,
customPrimitives,
};
}

capabilities = generatedCapabilites;
}
}
Expand All @@ -151,16 +161,19 @@ export default class XLRCompile extends BaseCommand {
})
.join('\n')}

module.exports = {
"pluginName": "${capabilities.pluginName}",
"capabilities": {
${[...(capabilities.capabilities?.entries() ?? [])]
.map(([capabilityName, provides]) => {
return `"${capabilityName}":[${provides.join(',')}],`;
})
.join('\n\t\t')}
}
}
module.exports = {
"pluginName": "${capabilities.pluginName}",
"capabilities": {
${[...(capabilities.capabilities?.entries() ?? [])]
.map(([capabilityName, provides]) => {
return `"${capabilityName}":[${provides.join(',')}],`;
})
.join('\n\t\t')}
},
"customPrimitives": [
${[capabilities.customPrimitives?.map((i) => `'${i}'`).join(',') ?? '']}
]
}
`;

fs.writeFileSync(path.join(outputDirectory, 'manifest.js'), tsManifestFile);
Expand Down
1 change: 0 additions & 1 deletion cli/src/utils/xlr/visitors/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Manifest } from '@player-tools/xlr';
import path from 'path';
import fs from 'fs';
import type { VisitorProps } from './types';

/** export all exported types in the file */
export function fileVisitor(args: VisitorProps): Manifest | undefined {
const { sourceFile, converter, outputDirectory } = args;
Expand Down
10 changes: 9 additions & 1 deletion common/static_xlrs/core/xlr/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@ module.exports = {
"pluginName": "Types",
"capabilities": {
"Types":[Asset,AssetBinding,SwitchCase,Switch,AssetWrapper,AssetWrapperOrSwitch,AssetSwitch,StaticSwitch,DynamicSwitch,Expression,ExpressionRef,Binding,BindingRef,DataModel,Navigation,ExpressionObject,NavigationFlow,NavigationFlowTransition,NavigationBaseState,NavigationFlowTransitionableState,NavigationFlowViewState,NavigationFlowEndState,NavigationFlowActionState,NavigationFlowExternalState,NavigationFlowFlowState,NavigationFlowState,FlowResult,Templatable,Template,View,Flow],
}
},
"customPrimitives":[
'Expression',
'Asset',
'Binding',
'AssetWrapper',
'Schema.DataType',
'ExpressionHandler',
]
}
2 changes: 2 additions & 0 deletions xlr/types/src/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface Manifest {
pluginName: string;
/** Map of capabilities provided by the plugin to the name of the XLR for the capabilities */
capabilities?: Map<string, Array<string>>;
/** CustomPrimitives that are the most basic types in the Payer Ecosystem */
customPrimitives?: Array<string>;
}

export interface TSManifest {
Expand Down