veryfront 0.1.1094 → 0.1.1095
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.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/file-resolver/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/src/rendering/orchestrator/file-resolver/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAYzE,wBAAgB,cAAc,IAAI,MAAM,CASvC;AAED,wBAAsB,gBAAgB,CACpC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,cAAc,GAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYxB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmDxB"}
|
|
@@ -11,6 +11,12 @@ import { buildCandidatePaths, findFirstExisting } from "./candidates.js";
|
|
|
11
11
|
export { buildCandidatePaths, findFirstExisting } from "./candidates.js";
|
|
12
12
|
const SOURCE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mdx", ".md"];
|
|
13
13
|
const COMPONENT_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js"];
|
|
14
|
+
function stripSourceExtension(path) {
|
|
15
|
+
const matched = SOURCE_EXTENSIONS.find((ext) => path.endsWith(ext));
|
|
16
|
+
return matched
|
|
17
|
+
? { stem: path.slice(0, -matched.length), hasExt: true }
|
|
18
|
+
: { stem: path, hasExt: false };
|
|
19
|
+
}
|
|
14
20
|
export function getLocalLibDir() {
|
|
15
21
|
const currentFile = new URL(globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta).url).pathname;
|
|
16
22
|
const srcIndex = currentFile.indexOf("/src/");
|
|
@@ -27,11 +33,23 @@ export async function findLocalLibFile(relativePath, localAdapter) {
|
|
|
27
33
|
return result;
|
|
28
34
|
}
|
|
29
35
|
export async function findSourceFile(basePath, projectDir, adapter) {
|
|
36
|
+
// When the specifier already carries an explicit source extension
|
|
37
|
+
// (e.g. `@/components/Welcome.tsx`), the literal on-disk path must be a
|
|
38
|
+
// candidate. `buildCandidatePaths` only produces `${fileName}${ext}` and
|
|
39
|
+
// `${fileName}/index${ext}` variants, so without stripping the extension
|
|
40
|
+
// here the file would never match.
|
|
41
|
+
const { stem, hasExt: hasExplicitExt } = stripSourceExtension(basePath);
|
|
30
42
|
if (adapter.fs.resolveFile) {
|
|
31
|
-
const directBases = [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
const directBases = [];
|
|
44
|
+
if (hasExplicitExt)
|
|
45
|
+
directBases.push(join(projectDir, basePath));
|
|
46
|
+
directBases.push(join(projectDir, stem));
|
|
47
|
+
const stemWithoutComponents = stem.replace(/^components\//, "");
|
|
48
|
+
if (stemWithoutComponents !== stem) {
|
|
49
|
+
if (hasExplicitExt) {
|
|
50
|
+
directBases.push(join(projectDir, basePath.replace(/^components\//, "")));
|
|
51
|
+
}
|
|
52
|
+
directBases.push(join(projectDir, stemWithoutComponents));
|
|
35
53
|
}
|
|
36
54
|
for (const candidateBase of directBases) {
|
|
37
55
|
const resolved = await adapter.fs.resolveFile(candidateBase, {
|
|
@@ -43,10 +61,16 @@ export async function findSourceFile(basePath, projectDir, adapter) {
|
|
|
43
61
|
}
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
|
-
const candidates =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
const candidates = [];
|
|
65
|
+
if (hasExplicitExt)
|
|
66
|
+
candidates.push(join(projectDir, basePath));
|
|
67
|
+
candidates.push(...buildCandidatePaths(projectDir, stem, SOURCE_EXTENSIONS));
|
|
68
|
+
const stemWithoutComponents = stem.replace(/^components\//, "");
|
|
69
|
+
if (stemWithoutComponents !== stem) {
|
|
70
|
+
if (hasExplicitExt) {
|
|
71
|
+
candidates.push(join(projectDir, basePath.replace(/^components\//, "")));
|
|
72
|
+
}
|
|
73
|
+
candidates.push(...buildCandidatePaths(projectDir, stemWithoutComponents, SOURCE_EXTENSIONS));
|
|
50
74
|
}
|
|
51
75
|
const result = await findFirstExisting(candidates, (p) => adapter.fs.stat(p));
|
|
52
76
|
logger.debug(result ? "[FileResolver] Found file:" : "[FileResolver] File not found:", result ?? basePath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1095",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -328,10 +328,10 @@
|
|
|
328
328
|
"@types/react": "19.2.14",
|
|
329
329
|
"@types/react-dom": "19.2.3",
|
|
330
330
|
"ws": "8.21.0",
|
|
331
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
332
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
333
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
334
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
331
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1095",
|
|
332
|
+
"@veryfront/ext-content-mdx": "0.1.1095",
|
|
333
|
+
"@veryfront/ext-css-tailwind": "0.1.1095",
|
|
334
|
+
"@veryfront/ext-parser-babel": "0.1.1095"
|
|
335
335
|
},
|
|
336
336
|
"devDependencies": {
|
|
337
337
|
"@types/node": "20.9.0"
|