@diagonal-hq/cli 0.25.2 → 0.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +25 -8
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -326316,6 +326316,16 @@ function listFiles(root) {
|
|
|
326316
326316
|
return files.toSorted((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
326317
326317
|
}
|
|
326318
326318
|
var MODULE_ENTITY_TYPES = { layouts: "layout", components: "component" };
|
|
326319
|
+
var ENTRY_TYPES = /* @__PURE__ */ new Map([
|
|
326320
|
+
["layout", { output: "layouts", build: (path, source, ast, root) => buildLayout2(path, path, source, ast, root) }],
|
|
326321
|
+
[
|
|
326322
|
+
"component",
|
|
326323
|
+
{
|
|
326324
|
+
output: "components",
|
|
326325
|
+
build: (path, source, ast, root) => path.endsWith(".tsx") && isComponentModule(path, ast) ? buildComponent(path, path, source, ast, root) : null
|
|
326326
|
+
}
|
|
326327
|
+
]
|
|
326328
|
+
]);
|
|
326319
326329
|
var MODULE_ENTITY_EXTENSIONS = /* @__PURE__ */ new Set([".tsx", ".ts", ".jsx", ".js"]);
|
|
326320
326330
|
function moduleEntityType(path) {
|
|
326321
326331
|
const type = MODULE_ENTITY_TYPES[topDirectory(path)] ?? null;
|
|
@@ -327467,15 +327477,20 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327467
327477
|
for (const path of otherFiles) {
|
|
327468
327478
|
buildFile(path);
|
|
327469
327479
|
}
|
|
327470
|
-
const
|
|
327471
|
-
|
|
327472
|
-
|
|
327473
|
-
|
|
327474
|
-
|
|
327475
|
-
|
|
327476
|
-
|
|
327480
|
+
const unitTypes = new Map([
|
|
327481
|
+
...entryPaths.map((path) => [path, moduleEntityType(path)]),
|
|
327482
|
+
...output.pages.filter((page) => page.layout !== null).map((page) => [page.layout, "layout"])
|
|
327483
|
+
]);
|
|
327484
|
+
for (const path of [...unitTypes.keys()].toSorted()) {
|
|
327485
|
+
const type = ENTRY_TYPES.get(unitTypes.get(path));
|
|
327486
|
+
if (type === void 0) {
|
|
327487
|
+
throw new Error(`The entry [${path}] is not a module that builds as an entry`);
|
|
327488
|
+
}
|
|
327477
327489
|
const entry = buildUnit(path, ({ source, ast }) => {
|
|
327478
|
-
|
|
327490
|
+
const unit = type.build(path, source, ast, root);
|
|
327491
|
+
if (unit !== null) {
|
|
327492
|
+
output[type.output].push(unit);
|
|
327493
|
+
}
|
|
327479
327494
|
});
|
|
327480
327495
|
if (entry !== null && !uiEntries.some((item) => item.path === path)) {
|
|
327481
327496
|
uiEntries.push(entry);
|
|
@@ -327678,6 +327693,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327678
327693
|
recordBindings.entries
|
|
327679
327694
|
);
|
|
327680
327695
|
const layouts = output.layouts.map(({ lint: _lint, ...layout }) => layout);
|
|
327696
|
+
const entryComponents = [...output.components, ...output.layouts].filter((unit) => entryPaths.includes(unit.path) && moduleEntityType(unit.path) === "component").map(({ path, compiled_code }) => ({ path, compiled_code }));
|
|
327681
327697
|
const pages = output.pages.map(
|
|
327682
327698
|
({ layoutNode: _layoutNode, resourceNodes: _resourceNodes, seoReads: _seoReads, seoAsset: _seoAsset, warnings: _warnings, lint: _lint, ...page }) => page
|
|
327683
327699
|
);
|
|
@@ -327716,6 +327732,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327716
327732
|
})),
|
|
327717
327733
|
pages,
|
|
327718
327734
|
layouts,
|
|
327735
|
+
entry_components: entryComponents,
|
|
327719
327736
|
workflows: workflowBuild.workflows,
|
|
327720
327737
|
workflow_tests: workflowBuild.workflowTests,
|
|
327721
327738
|
migrations: migrationBuild.migrations,
|