commit
38806c13f5
6 changed files with 7 additions and 9 deletions
2
Makefile
2
Makefile
|
|
@ -97,7 +97,7 @@ libs/NopSCADlib:
|
|||
|
||||
public/libraries/NopSCADlib.zip: libs/NopSCADlib
|
||||
mkdir -p public/libraries
|
||||
( cd libs/NopSCADlib ; zip -r ../../public/libraries/NopSCADlib.zip `find . -name '*.scad' | grep -v tests` COPYING )
|
||||
( cd libs/NopSCADlib ; zip -r ../../public/libraries/NopSCADlib.zip `find . -name '*.scad'` COPYING )
|
||||
|
||||
libs/funcutils:
|
||||
git clone --recurse https://github.com/thehans/funcutils.git ${SHALLOW} ${SINGLE_BRANCH} $@
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ export const getParentDir = (path: string) => {
|
|||
let d = path.split('/').slice(0, -1).join('/');
|
||||
return d === '' ? (path.startsWith('/') ? '/' : '.') : d;
|
||||
}
|
||||
export const getFileName = (path: string) => path.split('/').splice(-1)[0];
|
||||
|
||||
export function readDirAsArray(fs: FS, path: string): Promise<string[] | undefined> {
|
||||
return new Promise((res, rej) => fs.readdir(path, (err, files) => err ? rej(err) : res(files)));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { getFileName, getParentDir } from '../fs/filesystem';
|
||||
import { getParentDir } from '../fs/filesystem';
|
||||
import { spawnOpenSCAD } from "./openscad-runner";
|
||||
import { processMergedOutputs } from "./output-parser";
|
||||
import { AbortablePromise, turnIntoDelayableExecution } from '../utils';
|
||||
|
|
@ -14,7 +14,6 @@ export const checkSyntax =
|
|||
// const timestamp = Date.now();
|
||||
|
||||
source = '$preview=true;\n' + source;
|
||||
sourcePath = getFileName(sourcePath);
|
||||
|
||||
const job = spawnOpenSCAD({
|
||||
inputs: [[sourcePath, source + '\n']],
|
||||
|
|
@ -58,7 +57,6 @@ export const render =
|
|||
prefixLines.push('$preview=true;');
|
||||
}
|
||||
source = [...prefixLines, source].join('\n');
|
||||
sourcePath = getFileName(sourcePath);
|
||||
|
||||
const args = [
|
||||
sourcePath,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { getFileName } from '../fs/filesystem';
|
||||
import { MergedOutputs } from "./openscad-worker";
|
||||
|
||||
const ignoredLogs = new Set([
|
||||
|
|
@ -45,10 +44,10 @@ export function parseMergedOutputs(mergedOutputs: MergedOutputs, opts: MergedOut
|
|||
severity: monaco.MarkerSeverity.Error
|
||||
})
|
||||
}
|
||||
const shiftSourceName = opts.shiftSourceLines && getFileName(opts.shiftSourceLines.sourcePath);
|
||||
const shiftSourceName = opts.shiftSourceLines && opts.shiftSourceLines.sourcePath;
|
||||
const getLine = (path: string, lineStr: string) => {
|
||||
const line = Number(lineStr);
|
||||
if (shiftSourceName && getFileName(path) == shiftSourceName) {
|
||||
if (shiftSourceName && (path == shiftSourceName)) {
|
||||
return line - opts.shiftSourceLines!.skipLines;
|
||||
} else {
|
||||
return line;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ async function compressString(input: string): Promise<string> {
|
|||
controller.close();
|
||||
}
|
||||
});
|
||||
// @ts-ignore
|
||||
const compressedStream = stream.pipeThrough(new CompressionStream('gzip'));
|
||||
const compressedData = await new Response(compressedStream).arrayBuffer();
|
||||
return btoa(String.fromCharCode(...new Uint8Array(compressedData)));
|
||||
|
|
@ -31,6 +32,7 @@ async function decompressString(compressedInput: string): Promise<string> {
|
|||
}
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
const decompressedStream = stream.pipeThrough(new DecompressionStream('gzip'));
|
||||
const decompressedData = await new Response(decompressedStream).arrayBuffer();
|
||||
return new TextDecoder().decode(decompressedData);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"ES2023",
|
||||
"ES2021",
|
||||
"WebWorker",
|
||||
],
|
||||
"rootDir": "src",
|
||||
|
|
|
|||
Loading…
Reference in a new issue