veryfront 0.0.7 → 0.0.10
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/ai/index.js +408 -53
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/react.d.ts +103 -2
- package/dist/cli.js +5098 -1444
- package/dist/components.js +166 -78
- package/dist/components.js.map +4 -4
- package/dist/config.js +20 -5
- package/dist/config.js.map +3 -3
- package/dist/data.js +20 -2
- package/dist/data.js.map +4 -4
- package/dist/index.js +195 -89
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/components.js
CHANGED
|
@@ -525,7 +525,7 @@ var init_deno = __esm({
|
|
|
525
525
|
"deno.json"() {
|
|
526
526
|
deno_default = {
|
|
527
527
|
name: "veryfront",
|
|
528
|
-
version: "0.0.
|
|
528
|
+
version: "0.0.10",
|
|
529
529
|
nodeModulesDir: "auto",
|
|
530
530
|
workspace: [
|
|
531
531
|
"./examples/async-worker-redis",
|
|
@@ -654,6 +654,7 @@ var init_deno = __esm({
|
|
|
654
654
|
dev: "deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev",
|
|
655
655
|
build: "deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts",
|
|
656
656
|
"build:npm": "deno run -A scripts/build-npm.ts",
|
|
657
|
+
release: "deno run -A scripts/release.ts",
|
|
657
658
|
test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",
|
|
658
659
|
"test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",
|
|
659
660
|
"test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",
|
|
@@ -1236,22 +1237,44 @@ var init_bundle_manifest_init = __esm({
|
|
|
1236
1237
|
}
|
|
1237
1238
|
});
|
|
1238
1239
|
|
|
1240
|
+
// src/platform/compat/runtime.ts
|
|
1241
|
+
var isDeno, isNode, isBun, isCloudflare;
|
|
1242
|
+
var init_runtime = __esm({
|
|
1243
|
+
"src/platform/compat/runtime.ts"() {
|
|
1244
|
+
"use strict";
|
|
1245
|
+
isDeno = typeof Deno !== "undefined";
|
|
1246
|
+
isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
|
|
1247
|
+
isBun = typeof globalThis.Bun !== "undefined";
|
|
1248
|
+
isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
|
|
1252
|
+
// src/platform/compat/process.ts
|
|
1253
|
+
import process2 from "node:process";
|
|
1254
|
+
function getEnv(key) {
|
|
1255
|
+
if (isDeno) {
|
|
1256
|
+
return process2.env(key);
|
|
1257
|
+
}
|
|
1258
|
+
return process2.env[key];
|
|
1259
|
+
}
|
|
1260
|
+
var init_process = __esm({
|
|
1261
|
+
"src/platform/compat/process.ts"() {
|
|
1262
|
+
"use strict";
|
|
1263
|
+
init_runtime();
|
|
1264
|
+
}
|
|
1265
|
+
});
|
|
1266
|
+
|
|
1239
1267
|
// src/core/utils/feature-flags.ts
|
|
1240
1268
|
function isRSCEnabled(config) {
|
|
1241
1269
|
if (config?.experimental?.rsc !== void 0) {
|
|
1242
1270
|
return config.experimental.rsc;
|
|
1243
1271
|
}
|
|
1244
|
-
|
|
1245
|
-
return process.env("VERYFRONT_EXPERIMENTAL_RSC") === "1";
|
|
1246
|
-
}
|
|
1247
|
-
if (typeof process !== "undefined" && process?.env) {
|
|
1248
|
-
return process.env.VERYFRONT_EXPERIMENTAL_RSC === "1";
|
|
1249
|
-
}
|
|
1250
|
-
return false;
|
|
1272
|
+
return getEnv("VERYFRONT_EXPERIMENTAL_RSC") === "1";
|
|
1251
1273
|
}
|
|
1252
1274
|
var init_feature_flags = __esm({
|
|
1253
1275
|
"src/core/utils/feature-flags.ts"() {
|
|
1254
1276
|
"use strict";
|
|
1277
|
+
init_process();
|
|
1255
1278
|
}
|
|
1256
1279
|
});
|
|
1257
1280
|
|
|
@@ -1707,6 +1730,7 @@ var init_define_config = __esm({
|
|
|
1707
1730
|
"src/core/config/define-config.ts"() {
|
|
1708
1731
|
"use strict";
|
|
1709
1732
|
init_veryfront_error();
|
|
1733
|
+
init_process();
|
|
1710
1734
|
}
|
|
1711
1735
|
});
|
|
1712
1736
|
|
|
@@ -2191,20 +2215,20 @@ var init_filesystem_adapter = __esm({
|
|
|
2191
2215
|
});
|
|
2192
2216
|
|
|
2193
2217
|
// src/platform/adapters/node/environment-adapter.ts
|
|
2194
|
-
import
|
|
2218
|
+
import process3 from "node:process";
|
|
2195
2219
|
var NodeEnvironmentAdapter;
|
|
2196
2220
|
var init_environment_adapter = __esm({
|
|
2197
2221
|
"src/platform/adapters/node/environment-adapter.ts"() {
|
|
2198
2222
|
"use strict";
|
|
2199
2223
|
NodeEnvironmentAdapter = class {
|
|
2200
2224
|
get(key) {
|
|
2201
|
-
return
|
|
2225
|
+
return process3.env[key];
|
|
2202
2226
|
}
|
|
2203
2227
|
set(key, value) {
|
|
2204
|
-
|
|
2228
|
+
process3.env[key] = value;
|
|
2205
2229
|
}
|
|
2206
2230
|
toObject() {
|
|
2207
|
-
return { ...
|
|
2231
|
+
return { ...process3.env };
|
|
2208
2232
|
}
|
|
2209
2233
|
};
|
|
2210
2234
|
}
|
|
@@ -7149,18 +7173,6 @@ var init_error_catalog = __esm({
|
|
|
7149
7173
|
}
|
|
7150
7174
|
});
|
|
7151
7175
|
|
|
7152
|
-
// src/platform/compat/runtime.ts
|
|
7153
|
-
var isDeno, isNode, isBun, isCloudflare;
|
|
7154
|
-
var init_runtime = __esm({
|
|
7155
|
-
"src/platform/compat/runtime.ts"() {
|
|
7156
|
-
"use strict";
|
|
7157
|
-
isDeno = typeof Deno !== "undefined";
|
|
7158
|
-
isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;
|
|
7159
|
-
isBun = typeof globalThis.Bun !== "undefined";
|
|
7160
|
-
isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;
|
|
7161
|
-
}
|
|
7162
|
-
});
|
|
7163
|
-
|
|
7164
7176
|
// src/platform/compat/console/ansi.ts
|
|
7165
7177
|
var ansi, red, green, yellow, blue, magenta, cyan, white, gray, bold, dim, italic, underline, strikethrough, reset;
|
|
7166
7178
|
var init_ansi = __esm({
|
|
@@ -7343,14 +7355,6 @@ var init_error_formatter = __esm({
|
|
|
7343
7355
|
}
|
|
7344
7356
|
});
|
|
7345
7357
|
|
|
7346
|
-
// src/platform/compat/process.ts
|
|
7347
|
-
import process3 from "node:process";
|
|
7348
|
-
var init_process = __esm({
|
|
7349
|
-
"src/platform/compat/process.ts"() {
|
|
7350
|
-
init_runtime();
|
|
7351
|
-
}
|
|
7352
|
-
});
|
|
7353
|
-
|
|
7354
7358
|
// src/core/errors/user-friendly/error-wrapper.ts
|
|
7355
7359
|
var init_error_wrapper = __esm({
|
|
7356
7360
|
"src/core/errors/user-friendly/error-wrapper.ts"() {
|
|
@@ -7782,16 +7786,16 @@ function createMockAdapter() {
|
|
|
7782
7786
|
files.set(path, content);
|
|
7783
7787
|
return Promise.resolve();
|
|
7784
7788
|
},
|
|
7785
|
-
exists:
|
|
7789
|
+
exists: (path) => {
|
|
7786
7790
|
if (files.has(path))
|
|
7787
|
-
return true;
|
|
7791
|
+
return Promise.resolve(true);
|
|
7788
7792
|
if (directories.has(path))
|
|
7789
|
-
return true;
|
|
7793
|
+
return Promise.resolve(true);
|
|
7790
7794
|
for (const filePath of files.keys()) {
|
|
7791
7795
|
if (filePath.startsWith(path + "/"))
|
|
7792
|
-
return true;
|
|
7796
|
+
return Promise.resolve(true);
|
|
7793
7797
|
}
|
|
7794
|
-
return false;
|
|
7798
|
+
return Promise.resolve(false);
|
|
7795
7799
|
},
|
|
7796
7800
|
readDir: async function* (path) {
|
|
7797
7801
|
const entries = /* @__PURE__ */ new Map();
|
|
@@ -8466,6 +8470,7 @@ var LRUCacheAdapter = class {
|
|
|
8466
8470
|
|
|
8467
8471
|
// src/core/utils/lru-wrapper.ts
|
|
8468
8472
|
init_utils();
|
|
8473
|
+
init_process();
|
|
8469
8474
|
var LRUCache = class {
|
|
8470
8475
|
adapter;
|
|
8471
8476
|
cleanupTimer;
|
|
@@ -8541,7 +8546,7 @@ function shouldDisableInterval() {
|
|
|
8541
8546
|
return true;
|
|
8542
8547
|
}
|
|
8543
8548
|
try {
|
|
8544
|
-
return
|
|
8549
|
+
return getEnv("VF_DISABLE_LRU_INTERVAL") === "1";
|
|
8545
8550
|
} catch {
|
|
8546
8551
|
return false;
|
|
8547
8552
|
}
|
|
@@ -8871,9 +8876,122 @@ ${transformed}`;
|
|
|
8871
8876
|
|
|
8872
8877
|
// src/build/transforms/mdx/parser.ts
|
|
8873
8878
|
init_utils();
|
|
8879
|
+
|
|
8880
|
+
// src/build/transforms/mdx/module-loader/metadata-extractor.ts
|
|
8881
|
+
init_utils();
|
|
8882
|
+
|
|
8883
|
+
// src/build/transforms/mdx/module-loader/string-parser.ts
|
|
8884
|
+
function extractBalancedBlock(source, startIndex, open, close) {
|
|
8885
|
+
const closeCh = close || (open === "{" ? "}" : open === "[" ? "]" : ")");
|
|
8886
|
+
let depth = 0;
|
|
8887
|
+
let i = startIndex;
|
|
8888
|
+
while (i < source.length) {
|
|
8889
|
+
const ch = source[i];
|
|
8890
|
+
if (ch === '"' || ch === "'") {
|
|
8891
|
+
const quote = ch;
|
|
8892
|
+
i++;
|
|
8893
|
+
while (i < source.length) {
|
|
8894
|
+
const q = source[i];
|
|
8895
|
+
if (q === "\\") {
|
|
8896
|
+
i += 2;
|
|
8897
|
+
continue;
|
|
8898
|
+
}
|
|
8899
|
+
if (q === quote) {
|
|
8900
|
+
i++;
|
|
8901
|
+
break;
|
|
8902
|
+
}
|
|
8903
|
+
i++;
|
|
8904
|
+
}
|
|
8905
|
+
continue;
|
|
8906
|
+
}
|
|
8907
|
+
if (ch === open)
|
|
8908
|
+
depth++;
|
|
8909
|
+
if (ch === closeCh) {
|
|
8910
|
+
depth--;
|
|
8911
|
+
if (depth === 0) {
|
|
8912
|
+
return source.slice(startIndex, i + 1);
|
|
8913
|
+
}
|
|
8914
|
+
}
|
|
8915
|
+
i++;
|
|
8916
|
+
}
|
|
8917
|
+
return "";
|
|
8918
|
+
}
|
|
8919
|
+
function parseJsonish(value) {
|
|
8920
|
+
const jsonish = value.replace(/'([^']*)'/g, '"$1"').replace(/([{,]\s*)([A-Za-z_$][\w$]*)\s*:/g, '$1"$2":');
|
|
8921
|
+
return JSON.parse(jsonish);
|
|
8922
|
+
}
|
|
8923
|
+
|
|
8924
|
+
// src/build/transforms/mdx/module-loader/metadata-extractor.ts
|
|
8925
|
+
function extractFrontmatter(moduleCode) {
|
|
8926
|
+
try {
|
|
8927
|
+
const fmIndex = moduleCode.search(/(?:export\s+)?const\s+frontmatter\s*=\s*/);
|
|
8928
|
+
if (fmIndex < 0)
|
|
8929
|
+
return void 0;
|
|
8930
|
+
const braceStart = moduleCode.indexOf("{", fmIndex);
|
|
8931
|
+
if (braceStart < 0)
|
|
8932
|
+
return void 0;
|
|
8933
|
+
const raw = extractBalancedBlock(moduleCode, braceStart, "{", "}");
|
|
8934
|
+
if (!raw)
|
|
8935
|
+
return void 0;
|
|
8936
|
+
const jsonish = raw.replace(/([^\s"{[:,]+)\s*:/g, '"$1":').replace(/'([^']*)'/g, '"$1"');
|
|
8937
|
+
try {
|
|
8938
|
+
return JSON.parse(jsonish);
|
|
8939
|
+
} catch (e) {
|
|
8940
|
+
rendererLogger.debug("[mdx] frontmatter JSON parse failed", e);
|
|
8941
|
+
return void 0;
|
|
8942
|
+
}
|
|
8943
|
+
} catch (e) {
|
|
8944
|
+
rendererLogger.debug("[mdx] frontmatter extraction failed", e);
|
|
8945
|
+
return void 0;
|
|
8946
|
+
}
|
|
8947
|
+
}
|
|
8948
|
+
var METADATA_PATTERNS = [
|
|
8949
|
+
{ regex: /(?:export\s+)?const\s+title\s*=\s*["']([^"']+)["']/, key: "title" },
|
|
8950
|
+
{ regex: /(?:export\s+)?const\s+description\s*=\s*["']([^"']+)["']/, key: "description" },
|
|
8951
|
+
{ regex: /(?:export\s+)?const\s+layout\s*=\s*(true|false|["'][^"']+["'])/, key: "layout" },
|
|
8952
|
+
{ regex: /(?:export\s+)?const\s+headings\s*=\s*(\[[\s\S]*?\])/, key: "headings" },
|
|
8953
|
+
{ regex: /(?:export\s+)?const\s+nested\s*=\s*({[\s\S]*?})/, key: "nested" },
|
|
8954
|
+
{ regex: /(?:export\s+)?const\s+tags\s*=\s*(\[[\s\S]*?\])/, key: "tags" },
|
|
8955
|
+
{ regex: /(?:export\s+)?const\s+date\s*=\s*["']([^"']+)["']/, key: "date" },
|
|
8956
|
+
{ regex: /(?:export\s+)?const\s+draft\s*=\s*(true|false)/, key: "draft" }
|
|
8957
|
+
];
|
|
8958
|
+
function extractMetadata(moduleCode) {
|
|
8959
|
+
const exports = {};
|
|
8960
|
+
METADATA_PATTERNS.forEach(({ regex, key }) => {
|
|
8961
|
+
const match = moduleCode.match(regex);
|
|
8962
|
+
if (!match)
|
|
8963
|
+
return;
|
|
8964
|
+
const value = match[1];
|
|
8965
|
+
switch (key) {
|
|
8966
|
+
case "title":
|
|
8967
|
+
case "description":
|
|
8968
|
+
case "date":
|
|
8969
|
+
exports[key] = value;
|
|
8970
|
+
break;
|
|
8971
|
+
case "layout":
|
|
8972
|
+
exports[key] = value === "true" ? true : value === "false" ? false : String(value).replace(/^"|"$/g, "");
|
|
8973
|
+
break;
|
|
8974
|
+
case "headings":
|
|
8975
|
+
case "tags":
|
|
8976
|
+
case "nested":
|
|
8977
|
+
try {
|
|
8978
|
+
exports[key] = parseJsonish(value);
|
|
8979
|
+
} catch (e) {
|
|
8980
|
+
rendererLogger.warn(`Failed to parse ${key}`, e);
|
|
8981
|
+
}
|
|
8982
|
+
break;
|
|
8983
|
+
case "draft":
|
|
8984
|
+
exports[key] = value === "true";
|
|
8985
|
+
break;
|
|
8986
|
+
}
|
|
8987
|
+
});
|
|
8988
|
+
return exports;
|
|
8989
|
+
}
|
|
8990
|
+
|
|
8991
|
+
// src/build/transforms/mdx/parser.ts
|
|
8874
8992
|
function parseMDXCode(compiledCode) {
|
|
8875
8993
|
rendererLogger.debug("Parsing MDX code, first 200 chars:", compiledCode.substring(0, 200));
|
|
8876
|
-
const importRegex =
|
|
8994
|
+
const importRegex = /^\s*import\s+(?:{([^}]+)}|(\w+))\s+from\s+['"]([^'"]+)['"]\s*;?\s*$/gm;
|
|
8877
8995
|
const imports = /* @__PURE__ */ new Map();
|
|
8878
8996
|
let match;
|
|
8879
8997
|
while ((match = importRegex.exec(compiledCode)) !== null) {
|
|
@@ -8894,7 +9012,7 @@ function parseMDXCode(compiledCode) {
|
|
|
8894
9012
|
}
|
|
8895
9013
|
}
|
|
8896
9014
|
}
|
|
8897
|
-
const cleanedCode = compiledCode.replace(
|
|
9015
|
+
const cleanedCode = compiledCode.replace(importRegex, "").replace(/^\s*export\s+\{[\s\S]*?\};?\s*$/gm, "").replace(/^\s*export\s+default\s+function/gm, "function").replace(/^\s*export\s+default\s+/gm, "").replace(/^\s*export\s+const\s+/gm, "const ").replace(/^\s*export\s+function\s+/gm, "function ").replace(/^\s*const\s+React\s*=.*?;?\s*$/gm, "").replace(/^\s*import\s+React\s+from.*?;?\s*$/gm, "").replace(/^\s*const\s+(Fragment|Fragment2)\s*=.*?;?\s*$/gm, "").replace(/^\s*const\s+(jsx|jsx2)\s*=.*?;?\s*$/gm, "").replace(/^\s*const\s+(jsxs|jsxs2)\s*=.*?;?\s*$/gm, "");
|
|
8898
9016
|
if (cleanedCode.includes("import React")) {
|
|
8899
9017
|
rendererLogger.warn("Import React still in cleaned code");
|
|
8900
9018
|
}
|
|
@@ -8903,46 +9021,16 @@ function parseMDXCode(compiledCode) {
|
|
|
8903
9021
|
rendererLogger.debug("Code snippet:", cleanedCode.substring(0, 200));
|
|
8904
9022
|
}
|
|
8905
9023
|
const exports = {};
|
|
8906
|
-
const
|
|
8907
|
-
if (
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
9024
|
+
const frontmatter = extractFrontmatter(cleanedCode);
|
|
9025
|
+
if (frontmatter) {
|
|
9026
|
+
exports.frontmatter = frontmatter;
|
|
9027
|
+
}
|
|
9028
|
+
const metadata = extractMetadata(cleanedCode);
|
|
9029
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
9030
|
+
if (value !== void 0) {
|
|
9031
|
+
exports[key] = value;
|
|
8913
9032
|
}
|
|
8914
9033
|
}
|
|
8915
|
-
const exportMatches = [
|
|
8916
|
-
{ regex: /const\s+title\s*=\s*["']([^"']+)["']/, key: "title", parse: (v) => v },
|
|
8917
|
-
{
|
|
8918
|
-
regex: /const\s+description\s*=\s*["']([^"']+)["']/,
|
|
8919
|
-
key: "description",
|
|
8920
|
-
parse: (v) => v
|
|
8921
|
-
},
|
|
8922
|
-
{ regex: /const\s+layout\s*=\s*true/, key: "layout", parse: () => true },
|
|
8923
|
-
{ regex: /const\s+layout\s*=\s*false/, key: "layout", parse: () => false },
|
|
8924
|
-
{ regex: /const\s+layout\s*=\s*["']([^"']+)["']/, key: "layout", parse: (v) => v },
|
|
8925
|
-
{
|
|
8926
|
-
regex: /const\s+headings\s*=\s*(\[[\s\S]*?\]);/,
|
|
8927
|
-
key: "headings",
|
|
8928
|
-
parse: (v) => {
|
|
8929
|
-
try {
|
|
8930
|
-
return JSON.parse(v.replace(/'/g, '"'));
|
|
8931
|
-
} catch {
|
|
8932
|
-
return [];
|
|
8933
|
-
}
|
|
8934
|
-
}
|
|
8935
|
-
}
|
|
8936
|
-
];
|
|
8937
|
-
exportMatches.forEach(({ regex, key, parse }) => {
|
|
8938
|
-
const m = cleanedCode.match(regex);
|
|
8939
|
-
if (m) {
|
|
8940
|
-
try {
|
|
8941
|
-
exports[key] = parse(m[1] || m[0]);
|
|
8942
|
-
} catch (_error) {
|
|
8943
|
-
}
|
|
8944
|
-
}
|
|
8945
|
-
});
|
|
8946
9034
|
return { code: cleanedCode, imports, exports };
|
|
8947
9035
|
}
|
|
8948
9036
|
|