@vedivad/typst-web-service 0.15.2 → 0.15.4
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/compiler-worker.js +23 -24
- package/dist/compiler-worker.js.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/compiler-worker.js
CHANGED
|
@@ -2136,34 +2136,33 @@ var CompilerWorker = class {
|
|
|
2136
2136
|
});
|
|
2137
2137
|
}
|
|
2138
2138
|
async compile(entry) {
|
|
2139
|
-
const
|
|
2140
|
-
mainFilePath: entry ?? MAIN_FILE,
|
|
2141
|
-
|
|
2142
|
-
|
|
2139
|
+
const { rawDiagnostics, vector } = await this.#ensureCompiler().runWithWorld(
|
|
2140
|
+
{ mainFilePath: entry ?? MAIN_FILE },
|
|
2141
|
+
async (world) => {
|
|
2142
|
+
const v = await world.vector({ diagnostics: "full" });
|
|
2143
|
+
if (!("result" in v)) {
|
|
2144
|
+
return { rawDiagnostics: v.diagnostics, vector: void 0 };
|
|
2145
|
+
}
|
|
2146
|
+
let rawDiagnostics2 = [];
|
|
2147
|
+
try {
|
|
2148
|
+
const c = await world.compile({ diagnostics: "full" });
|
|
2149
|
+
rawDiagnostics2 = c.diagnostics;
|
|
2150
|
+
} catch (err) {
|
|
2151
|
+
console.error("[typst-web-service] compile() threw after vector():", err);
|
|
2152
|
+
}
|
|
2153
|
+
return { rawDiagnostics: rawDiagnostics2, vector: v.result };
|
|
2154
|
+
}
|
|
2155
|
+
);
|
|
2143
2156
|
const diagnostics = sortDiagnosticsByFileAndRange(
|
|
2144
|
-
|
|
2157
|
+
rawDiagnostics.map((d) => {
|
|
2145
2158
|
const m = d.range.match(/(\d+):(\d+)-(\d+):(\d+)/);
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
}
|
|
2152
|
-
return [
|
|
2153
|
-
{
|
|
2154
|
-
...d,
|
|
2155
|
-
severity: d.severity,
|
|
2156
|
-
range: {
|
|
2157
|
-
startLine: +m[1],
|
|
2158
|
-
startCol: +m[2],
|
|
2159
|
-
endLine: +m[3],
|
|
2160
|
-
endCol: +m[4]
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
];
|
|
2159
|
+
return {
|
|
2160
|
+
...d,
|
|
2161
|
+
severity: d.severity,
|
|
2162
|
+
range: m ? { startLine: +m[1], startCol: +m[2], endLine: +m[3], endCol: +m[4] } : { startLine: 0, startCol: 0, endLine: 0, endCol: 0 }
|
|
2163
|
+
};
|
|
2164
2164
|
})
|
|
2165
2165
|
);
|
|
2166
|
-
const vector = result.result ?? void 0;
|
|
2167
2166
|
if (vector) {
|
|
2168
2167
|
return Comlink.transfer({ diagnostics, vector }, [
|
|
2169
2168
|
vector.buffer
|