@base44-preview/cli 0.0.51-pr.503.1ae2818 → 0.0.51-pr.503.89e310a
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/dist/cli/index.js +31 -31
- package/dist/cli/index.js.map +6 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -234623,7 +234623,7 @@ var SiteConfigSchema = exports_external.object({
|
|
|
234623
234623
|
installCommand: exports_external.string().optional()
|
|
234624
234624
|
});
|
|
234625
234625
|
var PluginMetadataSchema = exports_external.object({
|
|
234626
|
-
|
|
234626
|
+
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty").regex(/^[a-zA-Z0-9_-]+$/, "Plugin namespace can only contain letters, numbers, underscores, and dashes")
|
|
234627
234627
|
});
|
|
234628
234628
|
var PluginReferenceSchema = exports_external.object({
|
|
234629
234629
|
source: exports_external.string().min(1, "Plugin source cannot be empty")
|
|
@@ -241599,28 +241599,28 @@ function resolvePluginRoot(pluginSource, fromRoot) {
|
|
|
241599
241599
|
const req = createRequire2(join3(fromRoot, "package.json"));
|
|
241600
241600
|
return dirname3(req.resolve(`${pluginSource}/package.json`));
|
|
241601
241601
|
}
|
|
241602
|
-
function
|
|
241603
|
-
if (!project.plugin?.
|
|
241604
|
-
throw new ConfigInvalidError(`Plugin loaded from "${pluginSource}" must define plugin.
|
|
241602
|
+
function requirePluginNamespace(project, pluginSource, configPath) {
|
|
241603
|
+
if (!project.plugin?.namespace) {
|
|
241604
|
+
throw new ConfigInvalidError(`Plugin loaded from "${pluginSource}" must define plugin.namespace`, configPath);
|
|
241605
241605
|
}
|
|
241606
|
-
return project.plugin.
|
|
241606
|
+
return project.plugin.namespace;
|
|
241607
241607
|
}
|
|
241608
|
-
function namespacePluginFunctions(functions,
|
|
241608
|
+
function namespacePluginFunctions(functions, pluginNamespace) {
|
|
241609
241609
|
return functions.map((fn) => ({
|
|
241610
241610
|
...fn,
|
|
241611
|
-
name: `${
|
|
241611
|
+
name: `${pluginNamespace}__${fn.name}`,
|
|
241612
241612
|
source: {
|
|
241613
241613
|
type: "plugin",
|
|
241614
|
-
|
|
241614
|
+
namespace: pluginNamespace
|
|
241615
241615
|
}
|
|
241616
241616
|
}));
|
|
241617
241617
|
}
|
|
241618
|
-
function markPluginEntities(entities,
|
|
241618
|
+
function markPluginEntities(entities, pluginNamespace) {
|
|
241619
241619
|
return entities.map((entity) => ({
|
|
241620
241620
|
...entity,
|
|
241621
241621
|
source: {
|
|
241622
241622
|
type: "plugin",
|
|
241623
|
-
|
|
241623
|
+
namespace: pluginNamespace
|
|
241624
241624
|
}
|
|
241625
241625
|
}));
|
|
241626
241626
|
}
|
|
@@ -242782,7 +242782,7 @@ var ResourceSourceSchema = exports_external.discriminatedUnion("type", [
|
|
|
242782
242782
|
}),
|
|
242783
242783
|
exports_external.object({
|
|
242784
242784
|
type: exports_external.literal("plugin"),
|
|
242785
|
-
|
|
242785
|
+
namespace: exports_external.string().min(1, "Plugin namespace cannot be empty")
|
|
242786
242786
|
})
|
|
242787
242787
|
]);
|
|
242788
242788
|
|
|
@@ -243464,7 +243464,7 @@ async function findProjectRoot(startPath) {
|
|
|
243464
243464
|
}
|
|
243465
243465
|
|
|
243466
243466
|
class ProjectConfigReader {
|
|
243467
|
-
|
|
243467
|
+
pluginNamespaces = new Set;
|
|
243468
243468
|
async readProjectConfig(projectRoot) {
|
|
243469
243469
|
const { root, configPath } = await this.findConfigOrThrow(projectRoot);
|
|
243470
243470
|
const project = await this.readConfigFile(configPath);
|
|
@@ -243522,31 +243522,31 @@ class ProjectConfigReader {
|
|
|
243522
243522
|
throw new ConfigInvalidError("Plugin projects cannot define plugins in this version.", configPath);
|
|
243523
243523
|
}
|
|
243524
243524
|
}
|
|
243525
|
-
|
|
243526
|
-
if (this.
|
|
243527
|
-
throw new ConfigInvalidError(`Duplicate plugin
|
|
243525
|
+
registerPluginNamespace(pluginNamespace, configPath) {
|
|
243526
|
+
if (this.pluginNamespaces.has(pluginNamespace)) {
|
|
243527
|
+
throw new ConfigInvalidError(`Duplicate plugin namespace "${pluginNamespace}" in project configuration`, configPath, {
|
|
243528
243528
|
hints: [
|
|
243529
243529
|
{
|
|
243530
|
-
message: "Remove the plugin or change plugin
|
|
243530
|
+
message: "Remove the plugin or change plugin namespace"
|
|
243531
243531
|
}
|
|
243532
243532
|
]
|
|
243533
243533
|
});
|
|
243534
243534
|
}
|
|
243535
|
-
this.
|
|
243535
|
+
this.pluginNamespaces.add(pluginNamespace);
|
|
243536
243536
|
}
|
|
243537
243537
|
async readPluginConfig(plugin, hostRoot) {
|
|
243538
243538
|
const pluginRoot = resolvePluginRoot(plugin.source, hostRoot);
|
|
243539
243539
|
const { configPath } = await this.findConfigOrThrow(pluginRoot);
|
|
243540
243540
|
const project = await this.readConfigFile(configPath);
|
|
243541
|
-
const
|
|
243541
|
+
const pluginNamespace = requirePluginNamespace(project, plugin.source, configPath);
|
|
243542
243542
|
this.assertPluginProjectDoesNotLoadPlugins(project, configPath);
|
|
243543
|
-
return { configPath,
|
|
243543
|
+
return { configPath, pluginNamespace, project };
|
|
243544
243544
|
}
|
|
243545
|
-
async readPluginResources(project, configPath,
|
|
243545
|
+
async readPluginResources(project, configPath, pluginNamespace) {
|
|
243546
243546
|
const resources = await this.readProjectResources(configPath, project);
|
|
243547
243547
|
return {
|
|
243548
|
-
entities: markPluginEntities(resources.entities,
|
|
243549
|
-
functions: namespacePluginFunctions(resources.functions,
|
|
243548
|
+
entities: markPluginEntities(resources.entities, pluginNamespace),
|
|
243549
|
+
functions: namespacePluginFunctions(resources.functions, pluginNamespace),
|
|
243550
243550
|
agents: [],
|
|
243551
243551
|
connectors: [],
|
|
243552
243552
|
authConfig: []
|
|
@@ -243555,15 +243555,15 @@ class ProjectConfigReader {
|
|
|
243555
243555
|
async readPlugins(plugins, projectRoot) {
|
|
243556
243556
|
const entities = [];
|
|
243557
243557
|
const functions = [];
|
|
243558
|
-
const
|
|
243558
|
+
const entityNameByPluginNamespace = new Map;
|
|
243559
243559
|
for (const plugin of plugins) {
|
|
243560
|
-
const { configPath,
|
|
243561
|
-
this.
|
|
243562
|
-
const pluginData = await this.readPluginResources(project, configPath,
|
|
243560
|
+
const { configPath, pluginNamespace, project } = await this.readPluginConfig(plugin, projectRoot);
|
|
243561
|
+
this.registerPluginNamespace(pluginNamespace, configPath);
|
|
243562
|
+
const pluginData = await this.readPluginResources(project, configPath, pluginNamespace);
|
|
243563
243563
|
for (const entity of pluginData.entities) {
|
|
243564
|
-
const
|
|
243565
|
-
if (
|
|
243566
|
-
throw new ConfigInvalidError(`Entity "${entity.name}" is defined by more than one plugin: "${
|
|
243564
|
+
const existingPluginNamespace = entityNameByPluginNamespace.get(entity.name);
|
|
243565
|
+
if (existingPluginNamespace) {
|
|
243566
|
+
throw new ConfigInvalidError(`Entity "${entity.name}" is defined by more than one plugin: "${existingPluginNamespace}" and "${pluginNamespace}".`, configPath, {
|
|
243567
243567
|
hints: [
|
|
243568
243568
|
{
|
|
243569
243569
|
message: "Plugin entity names are not namespaced. Remove one plugin or rename one of the entities."
|
|
@@ -243571,7 +243571,7 @@ class ProjectConfigReader {
|
|
|
243571
243571
|
]
|
|
243572
243572
|
});
|
|
243573
243573
|
}
|
|
243574
|
-
|
|
243574
|
+
entityNameByPluginNamespace.set(entity.name, pluginNamespace);
|
|
243575
243575
|
}
|
|
243576
243576
|
entities.push(...pluginData.entities);
|
|
243577
243577
|
functions.push(...pluginData.functions);
|
|
@@ -261525,4 +261525,4 @@ export {
|
|
|
261525
261525
|
CLIExitError
|
|
261526
261526
|
};
|
|
261527
261527
|
|
|
261528
|
-
//# debugId=
|
|
261528
|
+
//# debugId=90CED69C719B38A364756E2164756E21
|