@wix/ditto-codegen-public 1.0.346 → 1.0.347
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/out.js +37 -16
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -11235,7 +11235,6 @@ var require_constants5 = __commonJS({
|
|
|
11235
11235
|
dashboardMenuPlugin: "dashboard menu plugin",
|
|
11236
11236
|
embeddedScript: "embedded script",
|
|
11237
11237
|
event: "backend event",
|
|
11238
|
-
genericExtension: "extension",
|
|
11239
11238
|
customElement: "custom element",
|
|
11240
11239
|
siteComponent: "editor react component",
|
|
11241
11240
|
editorReactComponent: "editor react component",
|
|
@@ -11248,7 +11247,8 @@ var require_constants5 = __commonJS({
|
|
|
11248
11247
|
ecomPaymentSettings: "service plugin",
|
|
11249
11248
|
bookingsStaffSortingProvider: "service plugin",
|
|
11250
11249
|
contextProvider: "context provider",
|
|
11251
|
-
functionLibrary: "function library"
|
|
11250
|
+
functionLibrary: "function library",
|
|
11251
|
+
dataCollections: "data collection"
|
|
11252
11252
|
};
|
|
11253
11253
|
function normalizeFilePath(filePath) {
|
|
11254
11254
|
return filePath.replace(exports2.CONTAINER_ROOT_PREFIX, "");
|
|
@@ -11257,9 +11257,6 @@ var require_constants5 = __commonJS({
|
|
|
11257
11257
|
return EXTENSION_FILE_PATTERN.test(filePath);
|
|
11258
11258
|
}
|
|
11259
11259
|
function detectExtension(content) {
|
|
11260
|
-
if (content.includes("genericExtension(") && content.includes("DATA_COMPONENT")) {
|
|
11261
|
-
return { extensionType: "dataCollection", label: "collection" };
|
|
11262
|
-
}
|
|
11263
11260
|
for (const [extensionType, label] of Object.entries(exports2.BUILDER_TO_EXTENSION_LABEL)) {
|
|
11264
11261
|
if (content.includes(`extensions.${extensionType}(`) || content.includes(`experimentalExtensions.${extensionType}(`)) {
|
|
11265
11262
|
return { extensionType, label };
|
|
@@ -13494,27 +13491,51 @@ var require_collect_extensions_created = __commonJS({
|
|
|
13494
13491
|
var promises_1 = require("fs/promises");
|
|
13495
13492
|
var ditto_codegen_types_12 = require_dist4();
|
|
13496
13493
|
var constants_1 = require_constants5();
|
|
13494
|
+
var DATA_COLLECTION_MARKER = /import\s+(?:type\s+)?\{[^}]*\bDataCollection\b[^}]*\}\s+from\s+['"]@wix\/astro\/builders['"]/;
|
|
13497
13495
|
var getExtensionDirectory = (extensionDefinitionPath) => `${path_1.posix.dirname(extensionDefinitionPath)}/`;
|
|
13498
13496
|
var isFileInExtensionFolder = (filePath, extensionDefinitionPath) => filePath === extensionDefinitionPath || filePath.startsWith(getExtensionDirectory(extensionDefinitionPath));
|
|
13497
|
+
var resolveFilePath = (outputPath, filePath) => (0, path_1.isAbsolute)(filePath) ? filePath : (0, path_1.join)(outputPath, filePath);
|
|
13498
|
+
var buildJobExtension = (definitionPath, extensionType, contentForTitle, titlePath, files) => ({
|
|
13499
|
+
path: definitionPath,
|
|
13500
|
+
extensionType,
|
|
13501
|
+
title: (0, constants_1.extractExtensionDisplayTitle)(contentForTitle, titlePath),
|
|
13502
|
+
files: [...files]
|
|
13503
|
+
});
|
|
13504
|
+
async function collectDataCollectionEntries(outputPath, parentExtensionFile, folderFiles) {
|
|
13505
|
+
const entries = [];
|
|
13506
|
+
for (const file of folderFiles) {
|
|
13507
|
+
if (file.path === parentExtensionFile.path)
|
|
13508
|
+
continue;
|
|
13509
|
+
try {
|
|
13510
|
+
const content = await (0, promises_1.readFile)(resolveFilePath(outputPath, file.path), "utf-8");
|
|
13511
|
+
if (!DATA_COLLECTION_MARKER.test(content))
|
|
13512
|
+
continue;
|
|
13513
|
+
entries.push(buildJobExtension(parentExtensionFile.path, "dataCollection", content, file.path, [parentExtensionFile, file]));
|
|
13514
|
+
} catch {
|
|
13515
|
+
continue;
|
|
13516
|
+
}
|
|
13517
|
+
}
|
|
13518
|
+
return entries;
|
|
13519
|
+
}
|
|
13499
13520
|
async function collectInsertedExtensionsMetadata(outputPath, files) {
|
|
13500
13521
|
const results = [];
|
|
13501
|
-
for (const
|
|
13502
|
-
if (
|
|
13522
|
+
for (const fileChange of files) {
|
|
13523
|
+
if (fileChange.operation !== ditto_codegen_types_12.ExtensionGenerationOperation.INSERT)
|
|
13503
13524
|
continue;
|
|
13504
|
-
if (!(0, constants_1.isExtensionsFile)(
|
|
13525
|
+
if (!(0, constants_1.isExtensionsFile)(fileChange.path))
|
|
13505
13526
|
continue;
|
|
13506
|
-
const fullPath = (0, path_1.isAbsolute)(f.path) ? f.path : (0, path_1.join)(outputPath, f.path);
|
|
13507
13527
|
try {
|
|
13508
|
-
const content = await (0, promises_1.readFile)(
|
|
13528
|
+
const content = await (0, promises_1.readFile)(resolveFilePath(outputPath, fileChange.path), "utf-8");
|
|
13509
13529
|
const detected = (0, constants_1.detectExtension)(content);
|
|
13510
13530
|
if (!detected)
|
|
13511
13531
|
continue;
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
}
|
|
13532
|
+
const folderFiles = files.filter((file) => isFileInExtensionFolder(file.path, fileChange.path));
|
|
13533
|
+
if (detected.extensionType === "dataCollections") {
|
|
13534
|
+
const dataCollectionEntries = await collectDataCollectionEntries(outputPath, fileChange, folderFiles);
|
|
13535
|
+
results.push(...dataCollectionEntries);
|
|
13536
|
+
continue;
|
|
13537
|
+
}
|
|
13538
|
+
results.push(buildJobExtension(fileChange.path, detected.extensionType, content, fileChange.path, folderFiles));
|
|
13518
13539
|
} catch {
|
|
13519
13540
|
continue;
|
|
13520
13541
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.347",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"esbuild": "^0.27.2",
|
|
29
29
|
"vitest": "^4.0.16"
|
|
30
30
|
},
|
|
31
|
-
"falconPackageHash": "
|
|
31
|
+
"falconPackageHash": "08231ee565611b4b7a817e282b1afc9a2c80d4e437af9683d13fa37c"
|
|
32
32
|
}
|