@happyvertical/smrt-core 0.40.57 → 0.40.59
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/README.md +20 -5
- package/dist/manifest/static-manifest.js +1 -1
- package/dist/manifest/static-manifest.js.map +1 -1
- package/dist/manifest/store.js +1 -1
- package/dist/manifest/test-manifest-stub.js +1 -1
- package/dist/manifest/test-manifest-stub.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/dist/vite-plugin/sveltekit-generator.js +35 -10
- package/dist/vite-plugin/sveltekit-generator.js.map +1 -1
- package/package.json +10 -10
package/dist/manifest.json
CHANGED
package/dist/smrt-knowledge.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
4
4
|
"packageName": "@happyvertical/smrt-core",
|
|
5
|
-
"packageVersion": "0.40.
|
|
5
|
+
"packageVersion": "0.40.59",
|
|
6
6
|
"sourceManifestPath": "dist/manifest.json",
|
|
7
7
|
"agentDocPath": "AGENTS.md",
|
|
8
8
|
"sourceHashes": {
|
|
9
|
-
"manifest": "
|
|
10
|
-
"packageJson": "
|
|
9
|
+
"manifest": "384c4ae94adeb769528078f5348773b81d35c10ed3361200bf58a8ee5cd19d47",
|
|
10
|
+
"packageJson": "6a589b7675e2fdf821a6dbd218a42c256bcfea53fedd57197c1c1ceb835d6b7b",
|
|
11
11
|
"agents": "ab30f2e4beb8d45e210d596794be5e7d93c99c21a517876f09d08d9a3b5f13df",
|
|
12
12
|
"moduleDoc:agents/change-feed.md": "5278797d6c049ea21071b011182a9fcd79d17f9d74e0f90a93caa4c05c25294f",
|
|
13
13
|
"moduleDoc:agents/change-signals.md": "d9cb6a5541728ffea46607a6b1d4fa61d4621849f2b4ea86a0645fbb0af892e9",
|
|
@@ -665,7 +665,7 @@ async function generateSvelteKitRoutes(projectRoot, manifest, options) {
|
|
|
665
665
|
if (generateSyncApplyRoute(projectRoot, manifest, options)) generatedRoutePaths.push(join(projectRoot, options.routesDir, "sync", "apply", "+server.ts"));
|
|
666
666
|
if (generateChangesRoute(projectRoot, manifest, options)) generatedRoutePaths.push(join(projectRoot, options.routesDir, "_changes", "+server.ts"));
|
|
667
667
|
if (generateEventsRoute(projectRoot, manifest, options, computeWebManifestHash(manifest))) generatedRoutePaths.push(join(projectRoot, options.routesDir, "_events", "+server.ts"));
|
|
668
|
-
updateGitignore(projectRoot,
|
|
668
|
+
updateGitignore(projectRoot, generatedRoutePaths);
|
|
669
669
|
const skippedMsg = skippedCollections > 0 ? ` (skipped ${skippedCollections} collection classes)` : "";
|
|
670
670
|
console.log(`[smrt] Generated routes for ${generatedCount} SMRT objects${skippedMsg}`);
|
|
671
671
|
}
|
|
@@ -1621,12 +1621,12 @@ function rolesFrom(value: unknown): string[] {
|
|
|
1621
1621
|
/**
|
|
1622
1622
|
* Updates .gitignore to exclude auto-generated routes
|
|
1623
1623
|
*/
|
|
1624
|
-
function updateGitignore(projectRoot,
|
|
1624
|
+
function updateGitignore(projectRoot, generatedRoutePaths) {
|
|
1625
1625
|
const gitignorePath = join(projectRoot, ".gitignore");
|
|
1626
1626
|
let gitignoreContent = "";
|
|
1627
1627
|
if (existsSync(gitignorePath)) gitignoreContent = readFileSync(gitignorePath, "utf-8");
|
|
1628
1628
|
const generatedPaths = [...new Set(generatedRoutePaths.map((path) => gitignorePatternForPath(relative(projectRoot, path))))].sort((a, b) => a.localeCompare(b));
|
|
1629
|
-
const updatedContent = updateGeneratedRouteIgnoreBlock(gitignoreContent,
|
|
1629
|
+
const updatedContent = updateGeneratedRouteIgnoreBlock(gitignoreContent, generatedPaths);
|
|
1630
1630
|
if (updatedContent !== gitignoreContent) {
|
|
1631
1631
|
writeFileSync(gitignorePath, updatedContent, "utf-8");
|
|
1632
1632
|
console.log("[smrt] Updated .gitignore with generated route paths");
|
|
@@ -1635,23 +1635,48 @@ function updateGitignore(projectRoot, options, generatedRoutePaths) {
|
|
|
1635
1635
|
function gitignorePatternForPath(path) {
|
|
1636
1636
|
return path.replaceAll("\\", "/").replaceAll(/([*?[\]\\!#])/g, "\\$1");
|
|
1637
1637
|
}
|
|
1638
|
-
|
|
1638
|
+
/**
|
|
1639
|
+
* Whether a line has the shape versions before #2185 wrote beneath the legacy
|
|
1640
|
+
* header: a recursive `+server.ts` wildcard, optionally negated. The pattern is
|
|
1641
|
+
* matched by shape rather than against the currently configured `routesDir`,
|
|
1642
|
+
* because a project that moved `routesDir` after adopting the plugin (as
|
|
1643
|
+
* `@happyvertical/smrt-content` did, `src/routes/api` -> `src/routes/api/v1`)
|
|
1644
|
+
* still carries the pair its earlier `routesDir` produced.
|
|
1645
|
+
*/
|
|
1646
|
+
function isLegacyGeneratedRoutePattern(line) {
|
|
1647
|
+
if (line.startsWith("#")) return false;
|
|
1648
|
+
return /^!?[^\s].*\/\*\*\/\+server\.ts$/.test(line);
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Drop the generator-owned legacy header together with the contiguous run of
|
|
1652
|
+
* legacy-shaped patterns directly beneath it. Only that recognized run is
|
|
1653
|
+
* migrated: the first line that is not legacy-shaped ends it, so an application
|
|
1654
|
+
* rule — including an identical broad pattern the project owns elsewhere in the
|
|
1655
|
+
* file — survives untouched.
|
|
1656
|
+
*/
|
|
1657
|
+
function stripLegacyGeneratedRouteIgnores(lines) {
|
|
1658
|
+
const headerIndex = lines.indexOf(LEGACY_GITIGNORE_HEADER);
|
|
1659
|
+
if (headerIndex === -1) return;
|
|
1660
|
+
let end = headerIndex + 1;
|
|
1661
|
+
while (end < lines.length && isLegacyGeneratedRoutePattern(lines[end])) end += 1;
|
|
1662
|
+
if (end > headerIndex + 1) lines.splice(headerIndex, end - headerIndex);
|
|
1663
|
+
}
|
|
1664
|
+
function updateGeneratedRouteIgnoreBlock(gitignoreContent, generatedPaths) {
|
|
1639
1665
|
const lines = gitignoreContent.split("\n");
|
|
1640
|
-
const startIndex = lines.indexOf(GITIGNORE_MANAGED_BLOCK_START);
|
|
1641
|
-
const endIndex = lines.indexOf(GITIGNORE_MANAGED_BLOCK_END);
|
|
1642
1666
|
const managedBlock = [
|
|
1643
1667
|
GITIGNORE_MANAGED_BLOCK_START,
|
|
1644
1668
|
...generatedPaths,
|
|
1645
1669
|
GITIGNORE_MANAGED_BLOCK_END
|
|
1646
1670
|
];
|
|
1647
|
-
if (
|
|
1671
|
+
if (lines.includes(GITIGNORE_MANAGED_BLOCK_START) || lines.includes(GITIGNORE_MANAGED_BLOCK_END)) {
|
|
1672
|
+
stripLegacyGeneratedRouteIgnores(lines);
|
|
1673
|
+
const startIndex = lines.indexOf(GITIGNORE_MANAGED_BLOCK_START);
|
|
1674
|
+
const endIndex = lines.indexOf(GITIGNORE_MANAGED_BLOCK_END);
|
|
1648
1675
|
if (startIndex === -1 || endIndex < startIndex) return gitignoreContent;
|
|
1649
1676
|
lines.splice(startIndex, endIndex - startIndex + 1, ...generatedPaths.length > 0 ? managedBlock : []);
|
|
1650
1677
|
return lines.join("\n");
|
|
1651
1678
|
}
|
|
1652
|
-
|
|
1653
|
-
const legacyIndex = lines.findIndex((line, index) => line === LEGACY_GITIGNORE_HEADER && lines[index + 1] === legacyPattern);
|
|
1654
|
-
if (legacyIndex !== -1) lines.splice(legacyIndex, 2);
|
|
1679
|
+
stripLegacyGeneratedRouteIgnores(lines);
|
|
1655
1680
|
if (generatedPaths.length === 0) return lines.join("\n");
|
|
1656
1681
|
let updatedContent = lines.join("\n");
|
|
1657
1682
|
if (updatedContent.length > 0 && !updatedContent.endsWith("\n")) updatedContent += "\n";
|