@valbuild/server 0.60.24 → 0.60.27
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.
@@ -4,5 +4,5 @@ import { type ValSyntaxErrorTree } from "./patch/ts/syntax.js";
|
|
4
4
|
import { ValSourceFileHandler } from "./ValSourceFileHandler.js";
|
5
5
|
import { QuickJSRuntime } from "quickjs-emscripten";
|
6
6
|
import ts from "typescript";
|
7
|
-
export declare const patchValFile: (id: string,
|
7
|
+
export declare const patchValFile: (id: string, rootDir: string, patch: Patch, sourceFileHandler: ValSourceFileHandler, runtime: QuickJSRuntime) => Promise<void>;
|
8
8
|
export declare const patchSourceFile: (sourceFile: ts.SourceFile | string, patch: Patch) => result.Result<ts.SourceFile, ValSyntaxErrorTree | PatchError>;
|
@@ -633,6 +633,10 @@ class TSOps {
|
|
633
633
|
}
|
634
634
|
}
|
635
635
|
|
636
|
+
function getSyntheticContainingPath(rootDir) {
|
637
|
+
return path__namespace["default"].join(rootDir, "<val>"); // TODO: this is the synthetic path used when evaluating / patching modules. I am not sure <val> is the best choice: val.ts / js better? But that is weird too. At least now it is clear(er) that it is indeed a synthetic file (i.e. not an actual file)
|
638
|
+
}
|
639
|
+
|
636
640
|
const ops$1 = new TSOps(document => {
|
637
641
|
return fp.pipe(analyzeValModule(document), fp.result.map(({
|
638
642
|
source
|
@@ -640,10 +644,10 @@ const ops$1 = new TSOps(document => {
|
|
640
644
|
});
|
641
645
|
|
642
646
|
// TODO: rename to patchValFiles since we may write multiple files
|
643
|
-
const patchValFile = async (id,
|
647
|
+
const patchValFile = async (id, rootDir, patch$1, sourceFileHandler, runtime) => {
|
644
648
|
// const timeId = randomUUID();
|
645
649
|
// console.time("patchValFile" + timeId);
|
646
|
-
const filePath = sourceFileHandler.resolveSourceModulePath(
|
650
|
+
const filePath = sourceFileHandler.resolveSourceModulePath(getSyntheticContainingPath(rootDir), `.${id}.val`);
|
647
651
|
const sourceFile = sourceFileHandler.getSourceFile(filePath);
|
648
652
|
if (!sourceFile) {
|
649
653
|
throw Error(`Source file ${filePath} not found`);
|
@@ -741,9 +745,7 @@ globalThis.valModule = {
|
|
741
745
|
defaultExport: !!valModule?.default,
|
742
746
|
};
|
743
747
|
`;
|
744
|
-
const result = context.evalCode(code,
|
745
|
-
// Synthetic module name
|
746
|
-
path__namespace["default"].join(rootDirPath, "<val>"));
|
748
|
+
const result = context.evalCode(code, getSyntheticContainingPath(rootDirPath));
|
747
749
|
const fatalErrors = [];
|
748
750
|
if (result.error) {
|
749
751
|
const error = result.error.consume(context.dump);
|
@@ -633,6 +633,10 @@ class TSOps {
|
|
633
633
|
}
|
634
634
|
}
|
635
635
|
|
636
|
+
function getSyntheticContainingPath(rootDir) {
|
637
|
+
return path__namespace["default"].join(rootDir, "<val>"); // TODO: this is the synthetic path used when evaluating / patching modules. I am not sure <val> is the best choice: val.ts / js better? But that is weird too. At least now it is clear(er) that it is indeed a synthetic file (i.e. not an actual file)
|
638
|
+
}
|
639
|
+
|
636
640
|
const ops$1 = new TSOps(document => {
|
637
641
|
return fp.pipe(analyzeValModule(document), fp.result.map(({
|
638
642
|
source
|
@@ -640,10 +644,10 @@ const ops$1 = new TSOps(document => {
|
|
640
644
|
});
|
641
645
|
|
642
646
|
// TODO: rename to patchValFiles since we may write multiple files
|
643
|
-
const patchValFile = async (id,
|
647
|
+
const patchValFile = async (id, rootDir, patch$1, sourceFileHandler, runtime) => {
|
644
648
|
// const timeId = randomUUID();
|
645
649
|
// console.time("patchValFile" + timeId);
|
646
|
-
const filePath = sourceFileHandler.resolveSourceModulePath(
|
650
|
+
const filePath = sourceFileHandler.resolveSourceModulePath(getSyntheticContainingPath(rootDir), `.${id}.val`);
|
647
651
|
const sourceFile = sourceFileHandler.getSourceFile(filePath);
|
648
652
|
if (!sourceFile) {
|
649
653
|
throw Error(`Source file ${filePath} not found`);
|
@@ -741,9 +745,7 @@ globalThis.valModule = {
|
|
741
745
|
defaultExport: !!valModule?.default,
|
742
746
|
};
|
743
747
|
`;
|
744
|
-
const result = context.evalCode(code,
|
745
|
-
// Synthetic module name
|
746
|
-
path__namespace["default"].join(rootDirPath, "<val>"));
|
748
|
+
const result = context.evalCode(code, getSyntheticContainingPath(rootDirPath));
|
747
749
|
const fatalErrors = [];
|
748
750
|
if (result.error) {
|
749
751
|
const error = result.error.consume(context.dump);
|
@@ -603,6 +603,10 @@ class TSOps {
|
|
603
603
|
}
|
604
604
|
}
|
605
605
|
|
606
|
+
function getSyntheticContainingPath(rootDir) {
|
607
|
+
return path__default.join(rootDir, "<val>"); // TODO: this is the synthetic path used when evaluating / patching modules. I am not sure <val> is the best choice: val.ts / js better? But that is weird too. At least now it is clear(er) that it is indeed a synthetic file (i.e. not an actual file)
|
608
|
+
}
|
609
|
+
|
606
610
|
const ops$1 = new TSOps(document => {
|
607
611
|
return pipe(analyzeValModule(document), result.map(({
|
608
612
|
source
|
@@ -610,10 +614,10 @@ const ops$1 = new TSOps(document => {
|
|
610
614
|
});
|
611
615
|
|
612
616
|
// TODO: rename to patchValFiles since we may write multiple files
|
613
|
-
const patchValFile = async (id,
|
617
|
+
const patchValFile = async (id, rootDir, patch, sourceFileHandler, runtime) => {
|
614
618
|
// const timeId = randomUUID();
|
615
619
|
// console.time("patchValFile" + timeId);
|
616
|
-
const filePath = sourceFileHandler.resolveSourceModulePath(
|
620
|
+
const filePath = sourceFileHandler.resolveSourceModulePath(getSyntheticContainingPath(rootDir), `.${id}.val`);
|
617
621
|
const sourceFile = sourceFileHandler.getSourceFile(filePath);
|
618
622
|
if (!sourceFile) {
|
619
623
|
throw Error(`Source file ${filePath} not found`);
|
@@ -711,9 +715,7 @@ globalThis.valModule = {
|
|
711
715
|
defaultExport: !!valModule?.default,
|
712
716
|
};
|
713
717
|
`;
|
714
|
-
const result = context.evalCode(code,
|
715
|
-
// Synthetic module name
|
716
|
-
path__default.join(rootDirPath, "<val>"));
|
718
|
+
const result = context.evalCode(code, getSyntheticContainingPath(rootDirPath));
|
717
719
|
const fatalErrors = [];
|
718
720
|
if (result.error) {
|
719
721
|
const error = result.error.consume(context.dump);
|
package/package.json
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
"./package.json": "./package.json"
|
13
13
|
},
|
14
14
|
"types": "dist/valbuild-server.cjs.d.ts",
|
15
|
-
"version": "0.60.
|
15
|
+
"version": "0.60.27",
|
16
16
|
"scripts": {
|
17
17
|
"typecheck": "tsc --noEmit",
|
18
18
|
"test": "jest",
|
@@ -24,9 +24,9 @@
|
|
24
24
|
"concurrently": "^7.6.0"
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
|
-
"@valbuild/core": "~0.60.
|
28
|
-
"@valbuild/shared": "~0.60.
|
29
|
-
"@valbuild/ui": "~0.60.
|
27
|
+
"@valbuild/core": "~0.60.27",
|
28
|
+
"@valbuild/shared": "~0.60.27",
|
29
|
+
"@valbuild/ui": "~0.60.27",
|
30
30
|
"express": "^4.18.2",
|
31
31
|
"image-size": "^1.0.2",
|
32
32
|
"minimatch": "^3.0.4",
|