veryfront 0.1.573 → 0.1.575
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/deno.d.ts +1 -0
- package/esm/deno.js +2 -1
- package/esm/src/discovery/import-rewriter.d.ts +7 -1
- package/esm/src/discovery/import-rewriter.d.ts.map +1 -1
- package/esm/src/discovery/import-rewriter.js +93 -22
- package/esm/src/discovery/transpiler.d.ts.map +1 -1
- package/esm/src/discovery/transpiler.js +13 -13
- package/esm/src/schemas/index.d.ts +1 -0
- package/esm/src/schemas/index.d.ts.map +1 -1
- package/esm/src/schemas/index.js +1 -0
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -1
package/esm/deno.d.ts
CHANGED
package/esm/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.575",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"workspace": [
|
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
"./workflow/claude-code": "./src/workflow/claude-code/index.ts",
|
|
59
59
|
"./workflow/claude-code/react": "./src/workflow/claude-code/react/index.ts",
|
|
60
60
|
"./workflow/discovery": "./src/workflow/discovery/index.ts",
|
|
61
|
+
"./schemas": "./src/schemas/index.ts",
|
|
61
62
|
"./prompt": "./src/prompt/index.ts",
|
|
62
63
|
"./resource": "./src/resource/index.ts",
|
|
63
64
|
"./jobs": "./src/jobs/index.ts",
|
|
@@ -5,13 +5,18 @@
|
|
|
5
5
|
* (Deno, Node.js) and handles veryfront package resolution.
|
|
6
6
|
*/
|
|
7
7
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
8
|
+
export declare const DISCOVERY_GLOBAL_VERYFRONT_MODULES: readonly ["veryfront/agent", "veryfront/tool", "veryfront/platform", "veryfront/prompt", "veryfront/resource", "veryfront/embedding", "veryfront/workflow", "veryfront/schemas"];
|
|
9
|
+
interface DenoRewriteOptions {
|
|
10
|
+
compiled?: boolean;
|
|
11
|
+
resolveSpecifier?: (specifier: string) => string;
|
|
12
|
+
}
|
|
8
13
|
/**
|
|
9
14
|
* Rewrite imports for Deno runtime
|
|
10
15
|
* - Converts npm package imports to npm: specifier format
|
|
11
16
|
* - Resolves relative imports to absolute file:// URLs
|
|
12
17
|
* - For compiled binaries, rewrites veryfront imports to use globals
|
|
13
18
|
*/
|
|
14
|
-
export declare function rewriteForDeno(code: string, fileDir: string): string;
|
|
19
|
+
export declare function rewriteForDeno(code: string, fileDir: string, options?: DenoRewriteOptions): string;
|
|
15
20
|
/**
|
|
16
21
|
* Rewrite imports for Node.js runtime
|
|
17
22
|
* - Resolves relative imports to file:// URLs
|
|
@@ -19,4 +24,5 @@ export declare function rewriteForDeno(code: string, fileDir: string): string;
|
|
|
19
24
|
* - Handles veryfront package resolution
|
|
20
25
|
*/
|
|
21
26
|
export declare function rewriteDiscoveryImports(code: string, projectDir: string, fs: ReturnType<typeof createFileSystem>, fileDir: string): Promise<string>;
|
|
27
|
+
export {};
|
|
22
28
|
//# sourceMappingURL=import-rewriter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/import-rewriter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D;;;;;GAKG;AACH,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"import-rewriter.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/import-rewriter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,eAAO,MAAM,kCAAkC,kLASrC,CAAC;AAEX,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD;AAiED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CA6BR;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EACvC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAyKjB"}
|
|
@@ -6,13 +6,67 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { isDenoCompiled } from "../platform/compat/runtime.js";
|
|
8
8
|
import * as pathHelper from "../platform/compat/path/index.js";
|
|
9
|
+
export const DISCOVERY_GLOBAL_VERYFRONT_MODULES = [
|
|
10
|
+
"veryfront/agent",
|
|
11
|
+
"veryfront/tool",
|
|
12
|
+
"veryfront/platform",
|
|
13
|
+
"veryfront/prompt",
|
|
14
|
+
"veryfront/resource",
|
|
15
|
+
"veryfront/embedding",
|
|
16
|
+
"veryfront/workflow",
|
|
17
|
+
"veryfront/schemas",
|
|
18
|
+
];
|
|
19
|
+
function escapeRegExp(value) {
|
|
20
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
21
|
+
}
|
|
22
|
+
function toDestructuredBindings(imports) {
|
|
23
|
+
return imports
|
|
24
|
+
.split(",")
|
|
25
|
+
.map((part) => part.trim().replace(/\s+as\s+/g, ": "))
|
|
26
|
+
.filter(Boolean)
|
|
27
|
+
.join(", ");
|
|
28
|
+
}
|
|
29
|
+
function rewriteDenoPublicVeryfrontImports(code, resolveSpecifier) {
|
|
30
|
+
const resolve = (specifier) => {
|
|
31
|
+
try {
|
|
32
|
+
return resolveSpecifier(specifier);
|
|
33
|
+
}
|
|
34
|
+
catch (_) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return code
|
|
39
|
+
.replace(/from\s+["'](veryfront(?:\/[^"']+)?)["']/g, (match, specifier) => {
|
|
40
|
+
const resolved = resolve(specifier);
|
|
41
|
+
return resolved ? `from "${resolved}"` : match;
|
|
42
|
+
})
|
|
43
|
+
.replace(/import\s*\(\s*["'](veryfront(?:\/[^"']+)?)["']\s*\)/g, (match, specifier) => {
|
|
44
|
+
const resolved = resolve(specifier);
|
|
45
|
+
return resolved ? `import("${resolved}")` : match;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function rewriteDenoCompiledVeryfrontImports(code) {
|
|
49
|
+
let transformed = code;
|
|
50
|
+
for (const mod of DISCOVERY_GLOBAL_VERYFRONT_MODULES) {
|
|
51
|
+
const escapedMod = escapeRegExp(mod);
|
|
52
|
+
const importPattern = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*["']${escapedMod}["'];?`, "g");
|
|
53
|
+
transformed = transformed.replace(importPattern, (_match, imports) => {
|
|
54
|
+
return `const { ${toDestructuredBindings(imports)} } = globalThis.__VERYFRONT_MODULES__["${mod}"];`;
|
|
55
|
+
});
|
|
56
|
+
const namespacePattern = new RegExp(`import\\s*\\*\\s*as\\s+(\\w+)\\s*from\\s*["']${escapedMod}["'];?`, "g");
|
|
57
|
+
transformed = transformed.replace(namespacePattern, (_match, name) => {
|
|
58
|
+
return `const ${name} = globalThis.__VERYFRONT_MODULES__["${mod}"];`;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return transformed;
|
|
62
|
+
}
|
|
9
63
|
/**
|
|
10
64
|
* Rewrite imports for Deno runtime
|
|
11
65
|
* - Converts npm package imports to npm: specifier format
|
|
12
66
|
* - Resolves relative imports to absolute file:// URLs
|
|
13
67
|
* - For compiled binaries, rewrites veryfront imports to use globals
|
|
14
68
|
*/
|
|
15
|
-
export function rewriteForDeno(code, fileDir) {
|
|
69
|
+
export function rewriteForDeno(code, fileDir, options = {}) {
|
|
16
70
|
const npmReplacements = [
|
|
17
71
|
[/from\s+["']zod["']/g, 'from "npm:zod"'],
|
|
18
72
|
[/import\s*\(\s*["']zod["']\s*\)/g, 'import("npm:zod")'],
|
|
@@ -24,27 +78,12 @@ export function rewriteForDeno(code, fileDir) {
|
|
|
24
78
|
// Handle relative imports
|
|
25
79
|
transformed = transformed.replace(/from\s+["'](\.\.\/[^"']+)["']/g, (_match, relativePath) => `from "file://${pathHelper.resolve(fileDir, relativePath)}"`);
|
|
26
80
|
// For compiled binaries, rewrite veryfront imports to use globals
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"veryfront/resource",
|
|
34
|
-
];
|
|
35
|
-
for (const mod of veryfrontModules) {
|
|
36
|
-
const escapedMod = mod.replace(/\//g, "\\/");
|
|
37
|
-
// Match: import { ... } from "veryfront/..."
|
|
38
|
-
const importPattern = new RegExp(`import\\s*\\{([^}]+)\\}\\s*from\\s*["']${escapedMod}["']`, "g");
|
|
39
|
-
transformed = transformed.replace(importPattern, (_match, imports) => {
|
|
40
|
-
return `const {${imports}} = globalThis.__VERYFRONT_MODULES__["${mod}"]`;
|
|
41
|
-
});
|
|
42
|
-
// Match: import * as X from "veryfront/..."
|
|
43
|
-
const namespacePattern = new RegExp(`import\\s*\\*\\s*as\\s+(\\w+)\\s*from\\s*["']${escapedMod}["']`, "g");
|
|
44
|
-
transformed = transformed.replace(namespacePattern, (_match, name) => {
|
|
45
|
-
return `const ${name} = globalThis.__VERYFRONT_MODULES__["${mod}"]`;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
81
|
+
const compiled = options.compiled ?? isDenoCompiled;
|
|
82
|
+
if (compiled) {
|
|
83
|
+
transformed = rewriteDenoCompiledVeryfrontImports(transformed);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
transformed = rewriteDenoPublicVeryfrontImports(transformed, options.resolveSpecifier ?? ((specifier) => globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve(specifier)));
|
|
48
87
|
}
|
|
49
88
|
return transformed;
|
|
50
89
|
}
|
|
@@ -104,6 +143,21 @@ export async function rewriteDiscoveryImports(code, projectDir, fs, fileDir) {
|
|
|
104
143
|
for (const pkg of externalPackages) {
|
|
105
144
|
transformed = await rewritePackageImports(transformed, pkg);
|
|
106
145
|
}
|
|
146
|
+
const resolveRuntimeSpecifierToFileUrl = (specifier) => {
|
|
147
|
+
try {
|
|
148
|
+
const resolved = globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).resolve(specifier);
|
|
149
|
+
return resolved && resolved !== specifier ? resolved : null;
|
|
150
|
+
}
|
|
151
|
+
catch (_) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const rewriteResolvedSpecifierImports = (input, specifier, resolvedUrl) => {
|
|
156
|
+
const escapedSpecifier = escapeRegExp(specifier);
|
|
157
|
+
return input
|
|
158
|
+
.replace(new RegExp(`from\\s*["']${escapedSpecifier}["']`, "g"), `from "${resolvedUrl}"`)
|
|
159
|
+
.replace(new RegExp(`import\\s*\\(\\s*["']${escapedSpecifier}["']\\s*\\)`, "g"), `import("${resolvedUrl}")`);
|
|
160
|
+
};
|
|
107
161
|
// Handle veryfront package imports
|
|
108
162
|
let vfPackagePath = pathHelper.join(projectDir, "node_modules", "veryfront");
|
|
109
163
|
let exportsMap = {};
|
|
@@ -139,6 +193,23 @@ export async function rewriteDiscoveryImports(code, projectDir, fs, fileDir) {
|
|
|
139
193
|
return entry;
|
|
140
194
|
return entry.import ?? null;
|
|
141
195
|
};
|
|
196
|
+
const veryfrontSpecifiers = new Set();
|
|
197
|
+
for (const match of transformed.matchAll(/from\s+["'](veryfront(?:\/[^"']+)?)["']/g)) {
|
|
198
|
+
const specifier = match[1];
|
|
199
|
+
if (specifier)
|
|
200
|
+
veryfrontSpecifiers.add(specifier);
|
|
201
|
+
}
|
|
202
|
+
for (const match of transformed.matchAll(/import\s*\(\s*["'](veryfront(?:\/[^"']+)?)["']\s*\)/g)) {
|
|
203
|
+
const specifier = match[1];
|
|
204
|
+
if (specifier)
|
|
205
|
+
veryfrontSpecifiers.add(specifier);
|
|
206
|
+
}
|
|
207
|
+
for (const specifier of veryfrontSpecifiers) {
|
|
208
|
+
const resolvedUrl = resolveRuntimeSpecifierToFileUrl(specifier);
|
|
209
|
+
if (resolvedUrl) {
|
|
210
|
+
transformed = rewriteResolvedSpecifierImports(transformed, specifier, resolvedUrl);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
142
213
|
// Rewrite veryfront subpath imports
|
|
143
214
|
transformed = transformed.replace(/from\s+["'](veryfront\/[^"']+)["']/g, (match, fullSpecifier) => {
|
|
144
215
|
const subpath = "./" + fullSpecifier.replace("veryfront/", "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/transpiler.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"transpiler.d.ts","sourceRoot":"","sources":["../../../src/src/discovery/transpiler.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAmIvD;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAwFlB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -9,13 +9,18 @@ import { isDeno, isDenoCompiled } from "../platform/compat/runtime.js";
|
|
|
9
9
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
10
10
|
import * as pathHelper from "../platform/compat/path/index.js";
|
|
11
11
|
import { getEsbuildLoader } from "../utils/path-utils.js";
|
|
12
|
-
import { rewriteDiscoveryImports, rewriteForDeno } from "./import-rewriter.js";
|
|
12
|
+
import { rewriteDiscoveryImports, rewriteForDeno, } from "./import-rewriter.js";
|
|
13
13
|
import { COMPILATION_ERROR, FILE_NOT_FOUND } from "../errors/error-registry.js";
|
|
14
14
|
import { wrapWithCurrentContext } from "../platform/adapters/fs/veryfront/request-context.js";
|
|
15
|
-
// Static
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
// Static imports ensure deno compile includes public discovery modules in the binary.
|
|
16
|
+
import * as agentMod from "../agent/index.js";
|
|
17
|
+
import * as toolMod from "../tool/index.js";
|
|
18
|
+
import * as platformMod from "../platform/index.js";
|
|
19
|
+
import * as promptMod from "../prompt/index.js";
|
|
20
|
+
import * as resourceMod from "../resource/index.js";
|
|
18
21
|
import * as embeddingMod from "../embedding/index.js";
|
|
22
|
+
import * as workflowMod from "../workflow/index.js";
|
|
23
|
+
import * as schemasMod from "../schemas/index.js";
|
|
19
24
|
const transpileCache = new Map();
|
|
20
25
|
// Setup veryfront modules as globals for compiled binary support
|
|
21
26
|
let veryfrontGlobalsInitialized = false;
|
|
@@ -25,22 +30,17 @@ let veryfrontGlobalsInitialized = false;
|
|
|
25
30
|
async function ensureVeryfrontGlobals() {
|
|
26
31
|
if (veryfrontGlobalsInitialized || !isDenoCompiled)
|
|
27
32
|
return;
|
|
28
|
-
const
|
|
29
|
-
const [agentMod, toolMod, platformMod, promptMod, resourceMod] = await Promise.all([
|
|
30
|
-
loadModule("#veryfront/agent"),
|
|
31
|
-
loadModule("#veryfront/tool"),
|
|
32
|
-
loadModule("#veryfront/platform"),
|
|
33
|
-
loadModule("#veryfront/prompt"),
|
|
34
|
-
loadModule("#veryfront/resource"),
|
|
35
|
-
]);
|
|
36
|
-
dntShim.dntGlobalThis.__VERYFRONT_MODULES__ = {
|
|
33
|
+
const modules = {
|
|
37
34
|
"veryfront/agent": agentMod,
|
|
38
35
|
"veryfront/tool": toolMod,
|
|
39
36
|
"veryfront/platform": platformMod,
|
|
40
37
|
"veryfront/prompt": promptMod,
|
|
41
38
|
"veryfront/resource": resourceMod,
|
|
42
39
|
"veryfront/embedding": embeddingMod,
|
|
40
|
+
"veryfront/workflow": workflowMod,
|
|
41
|
+
"veryfront/schemas": schemasMod,
|
|
43
42
|
};
|
|
43
|
+
dntShim.dntGlobalThis.__VERYFRONT_MODULES__ = modules;
|
|
44
44
|
veryfrontGlobalsInitialized = true;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module schemas
|
|
13
13
|
*/
|
|
14
|
+
import "../../_dnt.polyfills.js";
|
|
14
15
|
export { defineSchema } from "./define.js";
|
|
15
16
|
export { lazySchema } from "./lazy.js";
|
|
16
17
|
export { isOptionalSchema as schemaIsOptional, type JsonSchema, schemaToJsonSchema, } from "./json-schema.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/src/schemas/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EACL,gBAAgB,IAAI,gBAAgB,EACpC,KAAK,UAAU,EACf,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,aAAa,EACb,KAAK,SAAS,EACd,KAAK,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,uBAAuB,EACvB,YAAY,EACZ,aAAa,EACb,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,cAAc,EACnB,KAAK,GAAG,EACR,KAAK,IAAI,GACV,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,GACf,MAAM,iBAAiB,CAAC"}
|
package/esm/src/schemas/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.575",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -121,6 +121,10 @@
|
|
|
121
121
|
"import": "./esm/src/workflow/discovery/index.js",
|
|
122
122
|
"types": "./esm/src/workflow/discovery/index.d.ts"
|
|
123
123
|
},
|
|
124
|
+
"./schemas": {
|
|
125
|
+
"import": "./esm/src/schemas/index.js",
|
|
126
|
+
"types": "./esm/src/schemas/index.d.ts"
|
|
127
|
+
},
|
|
124
128
|
"./prompt": {
|
|
125
129
|
"import": "./esm/src/prompt/index.js",
|
|
126
130
|
"types": "./esm/src/prompt/index.d.ts"
|