veryfront 0.1.926 → 0.1.928
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/esm/cli/commands/routes/command.d.ts.map +1 -1
- package/esm/cli/commands/routes/command.js +42 -42
- package/esm/cli/commands/workflow/command.d.ts +6 -0
- package/esm/cli/commands/workflow/command.d.ts.map +1 -1
- package/esm/cli/commands/workflow/command.js +6 -1
- package/esm/deno.js +1 -1
- package/esm/src/build/production-build/build/output-generator.d.ts.map +1 -1
- package/esm/src/build/production-build/build/output-generator.js +11 -7
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +9 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/routes/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/routes/command.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,aAAa,CACjC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,OAAO,CAAC,IAAI,CAAC,CA4Df"}
|
|
@@ -1,38 +1,51 @@
|
|
|
1
|
-
import { join } from "../../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
1
|
+
import { join, relative } from "../../../deps/jsr.io/@std/path/1.1.4/mod.js";
|
|
2
2
|
import { runtime } from "../../../src/platform/index.js";
|
|
3
|
-
import { APIRouteHandler } from "../../../src/routing/index.js";
|
|
4
3
|
import { getConfig } from "../../../src/config/index.js";
|
|
5
4
|
import { cliLogger } from "../../utils/index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { ApiRouteMatcher } from "../../../src/routing/api/api-route-matcher.js";
|
|
6
|
+
import { discoverAppRoutes, discoverPagesRoutes } from "../../../src/routing/api/route-discovery.js";
|
|
7
|
+
import { RouteDiscovery } from "../../../src/server/dev-server/route-discovery.js";
|
|
7
8
|
export async function routesCommand(projectDir, options = {}) {
|
|
8
|
-
const fs = createFileSystem();
|
|
9
9
|
const adapter = await runtime.get();
|
|
10
|
-
await getConfig(projectDir, adapter);
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
const pages = [];
|
|
14
|
-
const pagesDir = join(projectDir, "pages");
|
|
10
|
+
const config = await getConfig(projectDir, adapter);
|
|
11
|
+
const pageRouter = new ApiRouteMatcher();
|
|
12
|
+
let pageRoutes = [];
|
|
15
13
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!entry.isFile)
|
|
19
|
-
continue;
|
|
20
|
-
if (!entry.name.endsWith(".mdx") && !entry.name.endsWith(".tsx"))
|
|
21
|
-
continue;
|
|
22
|
-
const slug = entry.name.replace(/\.(mdx|tsx)$/i, "");
|
|
23
|
-
const path = slug === "index" ? "/" : `/${slug}`;
|
|
24
|
-
pages.push({ pattern: path, file: `pages/${entry.name}` });
|
|
25
|
-
}
|
|
14
|
+
await new RouteDiscovery(projectDir, adapter, pageRouter, config).discoverRoutes();
|
|
15
|
+
pageRoutes = pageRouter.listRoutes();
|
|
26
16
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
cliLogger.debug("Could not read pages directory:", error);
|
|
17
|
+
finally {
|
|
18
|
+
pageRouter.destroy();
|
|
30
19
|
}
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
const pages = pageRoutes
|
|
21
|
+
.map((route) => ({
|
|
22
|
+
pattern: route.pattern,
|
|
23
|
+
file: toProjectRelativePath(projectDir, route.page),
|
|
24
|
+
}))
|
|
25
|
+
.sort((a, b) => a.pattern.localeCompare(b.pattern));
|
|
26
|
+
const apiRouter = new ApiRouteMatcher();
|
|
27
|
+
let apiRoutes = [];
|
|
28
|
+
try {
|
|
29
|
+
const pagesDir = config.directories?.pages ?? "pages";
|
|
30
|
+
const apiDir = join(projectDir, pagesDir, "api");
|
|
31
|
+
if (await adapter.fs.exists(apiDir)) {
|
|
32
|
+
await discoverPagesRoutes(apiRouter, apiDir, "/api", adapter);
|
|
33
|
+
}
|
|
34
|
+
const appDir = join(projectDir, config.directories?.app ?? "app");
|
|
35
|
+
if (await adapter.fs.exists(appDir)) {
|
|
36
|
+
await discoverAppRoutes(apiRouter, appDir, "", adapter);
|
|
37
|
+
}
|
|
38
|
+
apiRoutes = apiRouter.listRoutes();
|
|
35
39
|
}
|
|
40
|
+
finally {
|
|
41
|
+
apiRouter.destroy();
|
|
42
|
+
}
|
|
43
|
+
const apis = apiRoutes
|
|
44
|
+
.map((route) => ({
|
|
45
|
+
pattern: route.pattern,
|
|
46
|
+
file: toProjectRelativePath(projectDir, route.page),
|
|
47
|
+
}))
|
|
48
|
+
.sort((a, b) => a.pattern.localeCompare(b.pattern));
|
|
36
49
|
if (options.json) {
|
|
37
50
|
console.log(JSON.stringify({ pages, apis }, null, 2));
|
|
38
51
|
return;
|
|
@@ -43,22 +56,9 @@ export async function routesCommand(projectDir, options = {}) {
|
|
|
43
56
|
}
|
|
44
57
|
cliLogger.info("\nAPI:");
|
|
45
58
|
for (const a of apis) {
|
|
46
|
-
cliLogger.info(` ${a}`);
|
|
59
|
+
cliLogger.info(` ${a.pattern} -> ${a.file}`);
|
|
47
60
|
}
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
for await (const entry of entries) {
|
|
52
|
-
const fullPath = join(dir, entry.name);
|
|
53
|
-
if (entry.isDirectory) {
|
|
54
|
-
await collectApiPatterns(fs, fullPath, `${prefix}/${entry.name}`, out);
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (!entry.isFile || !/\.(ts|js|tsx|jsx)$/i.test(entry.name))
|
|
58
|
-
continue;
|
|
59
|
-
const nameWithoutExt = entry.name.replace(/\.(ts|js|tsx|jsx)$/i, "");
|
|
60
|
-
const routePath = `${prefix}/${nameWithoutExt}`;
|
|
61
|
-
const pattern = routePath.replace(/\/index$/, "");
|
|
62
|
-
out.push(pattern);
|
|
63
|
-
}
|
|
62
|
+
function toProjectRelativePath(projectDir, path) {
|
|
63
|
+
return path.startsWith(projectDir) ? relative(projectDir, path) : path;
|
|
64
64
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { discoverProjectAgentRuntime } from "../../../src/agent/project/agent-runtime.js";
|
|
1
2
|
import type { WorkflowArgs } from "./handler.js";
|
|
2
3
|
export interface WorkflowOptions extends WorkflowArgs {
|
|
3
4
|
projectDir?: string;
|
|
4
5
|
}
|
|
6
|
+
interface WorkflowCommandDependencies {
|
|
7
|
+
discoverProjectAgentRuntime?: typeof discoverProjectAgentRuntime;
|
|
8
|
+
}
|
|
5
9
|
export interface WorkflowDiscoveryError {
|
|
6
10
|
filePath: string;
|
|
7
11
|
error: string;
|
|
8
12
|
}
|
|
9
13
|
export declare function formatWorkflowDiscoveryErrors(errors: WorkflowDiscoveryError[]): string[];
|
|
10
14
|
export declare function workflowCommand(options: WorkflowOptions): Promise<void>;
|
|
15
|
+
export declare function runWorkflowCommand(options: WorkflowOptions, dependencies?: WorkflowCommandDependencies): Promise<void>;
|
|
16
|
+
export {};
|
|
11
17
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/workflow/command.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,2BAA2B,EAAE,MAAM,6CAA6C,CAAC;AAO1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAKjD,MAAM,WAAW,eAAgB,SAAQ,YAAY;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,2BAA2B;IACnC,2BAA2B,CAAC,EAAE,OAAO,2BAA2B,CAAC;CAClE;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,sBAAsB,EAAE,GAC/B,MAAM,EAAE,CAUV;AAuFD,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7E;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,YAAY,GAAE,2BAAgC,GAC7C,OAAO,CAAC,IAAI,CAAC,CA6Ff"}
|
|
@@ -81,6 +81,9 @@ async function waitForWorkflowExit(client, runId) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
export async function workflowCommand(options) {
|
|
84
|
+
await runWorkflowCommand(options);
|
|
85
|
+
}
|
|
86
|
+
export async function runWorkflowCommand(options, dependencies = {}) {
|
|
84
87
|
if (options.action !== "run") {
|
|
85
88
|
cliLogger.error(`Unknown workflow action: ${options.action}`);
|
|
86
89
|
exitProcess(1);
|
|
@@ -104,6 +107,8 @@ export async function workflowCommand(options) {
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
const projectDir = options.projectDir ?? dntShim.Deno.cwd();
|
|
110
|
+
const discoverRuntime = dependencies.discoverProjectAgentRuntime ??
|
|
111
|
+
discoverProjectAgentRuntime;
|
|
107
112
|
await withProjectSourceContext(projectDir, async ({ adapter, proxyContext }) => {
|
|
108
113
|
const sourceLabel = proxyContext?.branchRef
|
|
109
114
|
? `branch ${proxyContext.branchRef}`
|
|
@@ -111,7 +116,7 @@ export async function workflowCommand(options) {
|
|
|
111
116
|
? "main"
|
|
112
117
|
: `${projectDir}/workflows/...`;
|
|
113
118
|
cliLogger.info(`Discovering workflows in ${sourceLabel}`);
|
|
114
|
-
const discovery = await
|
|
119
|
+
const discovery = await discoverRuntime({
|
|
115
120
|
projectDir,
|
|
116
121
|
adapter,
|
|
117
122
|
verbose: options.debug,
|
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/build/production-build/build/output-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAe1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAEvF,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,cAAc,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"output-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/build/production-build/build/output-generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAA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AAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAEhD;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBvF"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Static asset copying
|
|
10
10
|
*/
|
|
11
11
|
import { serverLogger as logger } from "../../../utils/index.js";
|
|
12
|
-
import { join } from "../../../platform/compat/path/index.js";
|
|
12
|
+
import { dirname, join } from "../../../platform/compat/path/index.js";
|
|
13
13
|
import { generateServiceWorker } from "../../../server/build-service-worker.js";
|
|
14
14
|
import { generateProdHydrationModule, getProdHydrationModulePath, } from "../../../html/hydration-script-builder/prod-scripts.js";
|
|
15
15
|
import { copyStaticAssets } from "../asset-generation.js";
|
|
@@ -23,13 +23,17 @@ export async function generateClientScripts(adapter, outputDir, dryRun) {
|
|
|
23
23
|
logger.info("Copying client scripts...");
|
|
24
24
|
if (dryRun)
|
|
25
25
|
return;
|
|
26
|
-
await adapter
|
|
27
|
-
await adapter
|
|
28
|
-
await adapter
|
|
29
|
-
await adapter
|
|
26
|
+
await writeOutputFile(adapter, join(outputDir, "_veryfront/app.js"), generateAppModule());
|
|
27
|
+
await writeOutputFile(adapter, join(outputDir, "_veryfront/client.js"), await generateClientModule());
|
|
28
|
+
await writeOutputFile(adapter, join(outputDir, "_veryfront/router.js"), await generateRouterScript(adapter));
|
|
29
|
+
await writeOutputFile(adapter, join(outputDir, "_veryfront/prefetch.js"), await generatePrefetchScript(adapter));
|
|
30
30
|
const hydrationRuntime = generateProdHydrationModule();
|
|
31
|
-
await adapter
|
|
32
|
-
await adapter
|
|
31
|
+
await writeOutputFile(adapter, join(outputDir, "_veryfront/hydration-runtime.js"), hydrationRuntime);
|
|
32
|
+
await writeOutputFile(adapter, join(outputDir, getProdHydrationModulePath().slice(1)), hydrationRuntime);
|
|
33
|
+
}
|
|
34
|
+
async function writeOutputFile(adapter, path, content) {
|
|
35
|
+
await adapter.fs.mkdir(dirname(path), { recursive: true });
|
|
36
|
+
await adapter.fs.writeFile(path, content);
|
|
33
37
|
}
|
|
34
38
|
/**
|
|
35
39
|
* Generate manifest and service worker
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.928",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -310,12 +310,18 @@
|
|
|
310
310
|
"@opentelemetry/core": {
|
|
311
311
|
"optional": true
|
|
312
312
|
},
|
|
313
|
+
"@opentelemetry/exporter-metrics-otlp-http": {
|
|
314
|
+
"optional": true
|
|
315
|
+
},
|
|
313
316
|
"@opentelemetry/exporter-trace-otlp-http": {
|
|
314
317
|
"optional": true
|
|
315
318
|
},
|
|
316
319
|
"@opentelemetry/resources": {
|
|
317
320
|
"optional": true
|
|
318
321
|
},
|
|
322
|
+
"@opentelemetry/sdk-metrics": {
|
|
323
|
+
"optional": true
|
|
324
|
+
},
|
|
319
325
|
"@opentelemetry/sdk-node": {
|
|
320
326
|
"optional": true
|
|
321
327
|
},
|
|
@@ -332,8 +338,6 @@
|
|
|
332
338
|
"@babel/traverse": "7.29.0",
|
|
333
339
|
"@babel/types": "7.29.0",
|
|
334
340
|
"@mdx-js/mdx": "3.1.1",
|
|
335
|
-
"@opentelemetry/exporter-metrics-otlp-http": "0.219.0",
|
|
336
|
-
"@opentelemetry/sdk-metrics": "2.8.0",
|
|
337
341
|
"@types/hast": "3.0.3",
|
|
338
342
|
"@types/mdast": "4.0.3",
|
|
339
343
|
"@types/unist": "3.0.2",
|
|
@@ -376,8 +380,10 @@
|
|
|
376
380
|
"@opentelemetry/auto-instrumentations-node": "0.77.0",
|
|
377
381
|
"@opentelemetry/context-async-hooks": "2.8.0",
|
|
378
382
|
"@opentelemetry/core": "2.8.0",
|
|
383
|
+
"@opentelemetry/exporter-metrics-otlp-http": "0.219.0",
|
|
379
384
|
"@opentelemetry/exporter-trace-otlp-http": "0.219.0",
|
|
380
385
|
"@opentelemetry/resources": "2.8.0",
|
|
386
|
+
"@opentelemetry/sdk-metrics": "2.8.0",
|
|
381
387
|
"@opentelemetry/sdk-node": "0.219.0",
|
|
382
388
|
"@opentelemetry/sdk-trace-base": "2.8.0",
|
|
383
389
|
"@opentelemetry/semantic-conventions": "1.41.1"
|