veryfront 0.0.7 → 0.0.9
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 +173 -11
- package/dist/ai/index.js.map +2 -2
- package/dist/cli.js +1203 -596
- package/dist/components.js +125 -41
- package/dist/components.js.map +3 -3
- package/dist/config.js +12 -5
- package/dist/config.js.map +2 -2
- package/dist/data.js +2 -1
- package/dist/data.js.map +2 -2
- package/dist/index.js +129 -41
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -131,6 +131,7 @@ function __loggerResetForTests(options = {}) {
|
|
|
131
131
|
var LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, trackedLoggers, cliLogger, serverLogger, rendererLogger, bundlerLogger, agentLogger, logger;
|
|
132
132
|
var init_logger = __esm({
|
|
133
133
|
"src/core/utils/logger/logger.ts"() {
|
|
134
|
+
"use strict";
|
|
134
135
|
init_env();
|
|
135
136
|
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
136
137
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
@@ -236,6 +237,7 @@ var init_build = __esm({
|
|
|
236
237
|
var SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, MS_PER_SECOND, DEFAULT_LRU_MAX_ENTRIES, COMPONENT_LOADER_MAX_ENTRIES, COMPONENT_LOADER_TTL_MS, MDX_RENDERER_MAX_ENTRIES, MDX_RENDERER_TTL_MS, RENDERER_CORE_MAX_ENTRIES, RENDERER_CORE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, TSX_LAYOUT_TTL_MS, DATA_FETCHING_MAX_ENTRIES, DATA_FETCHING_TTL_MS, MDX_CACHE_TTL_PRODUCTION_MS, MDX_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_CACHE_TTL_PRODUCTION_MS, BUNDLE_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_MANIFEST_PROD_TTL_MS, BUNDLE_MANIFEST_DEV_TTL_MS, RSC_MANIFEST_CACHE_TTL_MS, SERVER_ACTION_DEFAULT_TTL_SEC, DENO_KV_SAFE_SIZE_LIMIT_BYTES, HTTP_CACHE_SHORT_MAX_AGE_SEC, HTTP_CACHE_MEDIUM_MAX_AGE_SEC, HTTP_CACHE_LONG_MAX_AGE_SEC, ONE_DAY_MS, CACHE_CLEANUP_INTERVAL_MS, LRU_DEFAULT_MAX_ENTRIES, LRU_DEFAULT_MAX_SIZE_BYTES, CLEANUP_INTERVAL_MULTIPLIER;
|
|
237
238
|
var init_cache = __esm({
|
|
238
239
|
"src/core/utils/constants/cache.ts"() {
|
|
240
|
+
"use strict";
|
|
239
241
|
SECONDS_PER_MINUTE = 60;
|
|
240
242
|
MINUTES_PER_HOUR = 60;
|
|
241
243
|
HOURS_PER_DAY = 24;
|
|
@@ -309,6 +311,7 @@ function getUnoCSSTailwindResetUrl() {
|
|
|
309
311
|
var ESM_CDN_BASE, JSDELIVR_CDN_BASE, DENO_STD_BASE, REACT_VERSION_17, REACT_VERSION_18_2, REACT_VERSION_18_3, REACT_VERSION_19_RC, REACT_VERSION_19, REACT_DEFAULT_VERSION, DEFAULT_ALLOWED_CDN_HOSTS, DENO_STD_VERSION, UNOCSS_VERSION;
|
|
310
312
|
var init_cdn = __esm({
|
|
311
313
|
"src/core/utils/constants/cdn.ts"() {
|
|
314
|
+
"use strict";
|
|
312
315
|
ESM_CDN_BASE = "https://esm.sh";
|
|
313
316
|
JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";
|
|
314
317
|
DENO_STD_BASE = "https://deno.land";
|
|
@@ -523,7 +526,7 @@ var init_deno = __esm({
|
|
|
523
526
|
"deno.json"() {
|
|
524
527
|
deno_default = {
|
|
525
528
|
name: "veryfront",
|
|
526
|
-
version: "0.0.
|
|
529
|
+
version: "0.0.8",
|
|
527
530
|
nodeModulesDir: "auto",
|
|
528
531
|
workspace: [
|
|
529
532
|
"./examples/async-worker-redis",
|
|
@@ -652,6 +655,7 @@ var init_deno = __esm({
|
|
|
652
655
|
dev: "deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev",
|
|
653
656
|
build: "deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts",
|
|
654
657
|
"build:npm": "deno run -A scripts/build-npm.ts",
|
|
658
|
+
release: "deno run -A scripts/release.ts",
|
|
655
659
|
test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",
|
|
656
660
|
"test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",
|
|
657
661
|
"test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",
|
|
@@ -912,6 +916,7 @@ function fromBase64Url(encoded) {
|
|
|
912
916
|
}
|
|
913
917
|
var init_path_utils = __esm({
|
|
914
918
|
"src/core/utils/path-utils.ts"() {
|
|
919
|
+
"use strict";
|
|
915
920
|
init_logger();
|
|
916
921
|
}
|
|
917
922
|
});
|
|
@@ -8901,9 +8906,122 @@ ${transformed}`;
|
|
|
8901
8906
|
|
|
8902
8907
|
// src/build/transforms/mdx/parser.ts
|
|
8903
8908
|
init_utils();
|
|
8909
|
+
|
|
8910
|
+
// src/build/transforms/mdx/module-loader/metadata-extractor.ts
|
|
8911
|
+
init_utils();
|
|
8912
|
+
|
|
8913
|
+
// src/build/transforms/mdx/module-loader/string-parser.ts
|
|
8914
|
+
function extractBalancedBlock(source, startIndex, open, close) {
|
|
8915
|
+
const closeCh = close || (open === "{" ? "}" : open === "[" ? "]" : ")");
|
|
8916
|
+
let depth = 0;
|
|
8917
|
+
let i = startIndex;
|
|
8918
|
+
while (i < source.length) {
|
|
8919
|
+
const ch = source[i];
|
|
8920
|
+
if (ch === '"' || ch === "'") {
|
|
8921
|
+
const quote = ch;
|
|
8922
|
+
i++;
|
|
8923
|
+
while (i < source.length) {
|
|
8924
|
+
const q = source[i];
|
|
8925
|
+
if (q === "\\") {
|
|
8926
|
+
i += 2;
|
|
8927
|
+
continue;
|
|
8928
|
+
}
|
|
8929
|
+
if (q === quote) {
|
|
8930
|
+
i++;
|
|
8931
|
+
break;
|
|
8932
|
+
}
|
|
8933
|
+
i++;
|
|
8934
|
+
}
|
|
8935
|
+
continue;
|
|
8936
|
+
}
|
|
8937
|
+
if (ch === open)
|
|
8938
|
+
depth++;
|
|
8939
|
+
if (ch === closeCh) {
|
|
8940
|
+
depth--;
|
|
8941
|
+
if (depth === 0) {
|
|
8942
|
+
return source.slice(startIndex, i + 1);
|
|
8943
|
+
}
|
|
8944
|
+
}
|
|
8945
|
+
i++;
|
|
8946
|
+
}
|
|
8947
|
+
return "";
|
|
8948
|
+
}
|
|
8949
|
+
function parseJsonish(value) {
|
|
8950
|
+
const jsonish = value.replace(/'([^']*)'/g, '"$1"').replace(/([{,]\s*)([A-Za-z_$][\w$]*)\s*:/g, '$1"$2":');
|
|
8951
|
+
return JSON.parse(jsonish);
|
|
8952
|
+
}
|
|
8953
|
+
|
|
8954
|
+
// src/build/transforms/mdx/module-loader/metadata-extractor.ts
|
|
8955
|
+
function extractFrontmatter(moduleCode) {
|
|
8956
|
+
try {
|
|
8957
|
+
const fmIndex = moduleCode.search(/(?:export\s+)?const\s+frontmatter\s*=\s*/);
|
|
8958
|
+
if (fmIndex < 0)
|
|
8959
|
+
return void 0;
|
|
8960
|
+
const braceStart = moduleCode.indexOf("{", fmIndex);
|
|
8961
|
+
if (braceStart < 0)
|
|
8962
|
+
return void 0;
|
|
8963
|
+
const raw = extractBalancedBlock(moduleCode, braceStart, "{", "}");
|
|
8964
|
+
if (!raw)
|
|
8965
|
+
return void 0;
|
|
8966
|
+
const jsonish = raw.replace(/([^\s"{[:,]+)\s*:/g, '"$1":').replace(/'([^']*)'/g, '"$1"');
|
|
8967
|
+
try {
|
|
8968
|
+
return JSON.parse(jsonish);
|
|
8969
|
+
} catch (e) {
|
|
8970
|
+
rendererLogger.debug("[mdx] frontmatter JSON parse failed", e);
|
|
8971
|
+
return void 0;
|
|
8972
|
+
}
|
|
8973
|
+
} catch (e) {
|
|
8974
|
+
rendererLogger.debug("[mdx] frontmatter extraction failed", e);
|
|
8975
|
+
return void 0;
|
|
8976
|
+
}
|
|
8977
|
+
}
|
|
8978
|
+
var METADATA_PATTERNS = [
|
|
8979
|
+
{ regex: /(?:export\s+)?const\s+title\s*=\s*["']([^"']+)["']/, key: "title" },
|
|
8980
|
+
{ regex: /(?:export\s+)?const\s+description\s*=\s*["']([^"']+)["']/, key: "description" },
|
|
8981
|
+
{ regex: /(?:export\s+)?const\s+layout\s*=\s*(true|false|["'][^"']+["'])/, key: "layout" },
|
|
8982
|
+
{ regex: /(?:export\s+)?const\s+headings\s*=\s*(\[[\s\S]*?\])/, key: "headings" },
|
|
8983
|
+
{ regex: /(?:export\s+)?const\s+nested\s*=\s*({[\s\S]*?})/, key: "nested" },
|
|
8984
|
+
{ regex: /(?:export\s+)?const\s+tags\s*=\s*(\[[\s\S]*?\])/, key: "tags" },
|
|
8985
|
+
{ regex: /(?:export\s+)?const\s+date\s*=\s*["']([^"']+)["']/, key: "date" },
|
|
8986
|
+
{ regex: /(?:export\s+)?const\s+draft\s*=\s*(true|false)/, key: "draft" }
|
|
8987
|
+
];
|
|
8988
|
+
function extractMetadata(moduleCode) {
|
|
8989
|
+
const exports = {};
|
|
8990
|
+
METADATA_PATTERNS.forEach(({ regex, key }) => {
|
|
8991
|
+
const match = moduleCode.match(regex);
|
|
8992
|
+
if (!match)
|
|
8993
|
+
return;
|
|
8994
|
+
const value = match[1];
|
|
8995
|
+
switch (key) {
|
|
8996
|
+
case "title":
|
|
8997
|
+
case "description":
|
|
8998
|
+
case "date":
|
|
8999
|
+
exports[key] = value;
|
|
9000
|
+
break;
|
|
9001
|
+
case "layout":
|
|
9002
|
+
exports[key] = value === "true" ? true : value === "false" ? false : String(value).replace(/^"|"$/g, "");
|
|
9003
|
+
break;
|
|
9004
|
+
case "headings":
|
|
9005
|
+
case "tags":
|
|
9006
|
+
case "nested":
|
|
9007
|
+
try {
|
|
9008
|
+
exports[key] = parseJsonish(value);
|
|
9009
|
+
} catch (e) {
|
|
9010
|
+
rendererLogger.warn(`Failed to parse ${key}`, e);
|
|
9011
|
+
}
|
|
9012
|
+
break;
|
|
9013
|
+
case "draft":
|
|
9014
|
+
exports[key] = value === "true";
|
|
9015
|
+
break;
|
|
9016
|
+
}
|
|
9017
|
+
});
|
|
9018
|
+
return exports;
|
|
9019
|
+
}
|
|
9020
|
+
|
|
9021
|
+
// src/build/transforms/mdx/parser.ts
|
|
8904
9022
|
function parseMDXCode(compiledCode) {
|
|
8905
9023
|
rendererLogger.debug("Parsing MDX code, first 200 chars:", compiledCode.substring(0, 200));
|
|
8906
|
-
const importRegex =
|
|
9024
|
+
const importRegex = /^\s*import\s+(?:{([^}]+)}|(\w+))\s+from\s+['"]([^'"]+)['"]\s*;?\s*$/gm;
|
|
8907
9025
|
const imports = /* @__PURE__ */ new Map();
|
|
8908
9026
|
let match;
|
|
8909
9027
|
while ((match = importRegex.exec(compiledCode)) !== null) {
|
|
@@ -8924,7 +9042,7 @@ function parseMDXCode(compiledCode) {
|
|
|
8924
9042
|
}
|
|
8925
9043
|
}
|
|
8926
9044
|
}
|
|
8927
|
-
const cleanedCode = compiledCode.replace(
|
|
9045
|
+
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, "");
|
|
8928
9046
|
if (cleanedCode.includes("import React")) {
|
|
8929
9047
|
rendererLogger.warn("Import React still in cleaned code");
|
|
8930
9048
|
}
|
|
@@ -8933,46 +9051,16 @@ function parseMDXCode(compiledCode) {
|
|
|
8933
9051
|
rendererLogger.debug("Code snippet:", cleanedCode.substring(0, 200));
|
|
8934
9052
|
}
|
|
8935
9053
|
const exports = {};
|
|
8936
|
-
const
|
|
8937
|
-
if (
|
|
8938
|
-
|
|
8939
|
-
const objectLiteral = (frontmatterMatch[1] ?? "{}").replace(/(\w+):/g, '"$1":').replace(/'/g, '"');
|
|
8940
|
-
exports.frontmatter = JSON.parse(objectLiteral);
|
|
8941
|
-
} catch {
|
|
8942
|
-
rendererLogger.debug("[MDX] Could not parse frontmatter statically, will extract at runtime");
|
|
8943
|
-
}
|
|
9054
|
+
const frontmatter = extractFrontmatter(cleanedCode);
|
|
9055
|
+
if (frontmatter) {
|
|
9056
|
+
exports.frontmatter = frontmatter;
|
|
8944
9057
|
}
|
|
8945
|
-
const
|
|
8946
|
-
|
|
8947
|
-
{
|
|
8948
|
-
|
|
8949
|
-
key: "description",
|
|
8950
|
-
parse: (v) => v
|
|
8951
|
-
},
|
|
8952
|
-
{ regex: /const\s+layout\s*=\s*true/, key: "layout", parse: () => true },
|
|
8953
|
-
{ regex: /const\s+layout\s*=\s*false/, key: "layout", parse: () => false },
|
|
8954
|
-
{ regex: /const\s+layout\s*=\s*["']([^"']+)["']/, key: "layout", parse: (v) => v },
|
|
8955
|
-
{
|
|
8956
|
-
regex: /const\s+headings\s*=\s*(\[[\s\S]*?\]);/,
|
|
8957
|
-
key: "headings",
|
|
8958
|
-
parse: (v) => {
|
|
8959
|
-
try {
|
|
8960
|
-
return JSON.parse(v.replace(/'/g, '"'));
|
|
8961
|
-
} catch {
|
|
8962
|
-
return [];
|
|
8963
|
-
}
|
|
8964
|
-
}
|
|
9058
|
+
const metadata = extractMetadata(cleanedCode);
|
|
9059
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
9060
|
+
if (value !== void 0) {
|
|
9061
|
+
exports[key] = value;
|
|
8965
9062
|
}
|
|
8966
|
-
|
|
8967
|
-
exportMatches.forEach(({ regex, key, parse }) => {
|
|
8968
|
-
const m = cleanedCode.match(regex);
|
|
8969
|
-
if (m) {
|
|
8970
|
-
try {
|
|
8971
|
-
exports[key] = parse(m[1] || m[0]);
|
|
8972
|
-
} catch (_error) {
|
|
8973
|
-
}
|
|
8974
|
-
}
|
|
8975
|
-
});
|
|
9063
|
+
}
|
|
8976
9064
|
return { code: cleanedCode, imports, exports };
|
|
8977
9065
|
}
|
|
8978
9066
|
|