any2orca 0.0.0-stage → 0.1.0
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/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/NOTICE +28 -0
- package/README.md +99 -2
- package/dist/archive/adaptModelSettings.d.ts +1 -0
- package/dist/archive/adaptModelSettings.js +50 -0
- package/dist/archive/filamentColorNames.d.ts +8 -0
- package/dist/archive/filamentColorNames.js +760 -0
- package/dist/archive/fmtNum.d.ts +14 -0
- package/dist/archive/fmtNum.js +21 -0
- package/dist/archive/internal/escapeRegExp.d.ts +2 -0
- package/dist/archive/internal/escapeRegExp.js +5 -0
- package/dist/archive/lookupFilamentColorName.d.ts +45 -0
- package/dist/archive/lookupFilamentColorName.js +57 -0
- package/dist/archive/objectWorldBboxXY.d.ts +2 -0
- package/dist/archive/objectWorldBboxXY.js +123 -0
- package/dist/archive/parseItemPositions.d.ts +6 -0
- package/dist/archive/parseItemPositions.js +17 -0
- package/dist/archive/parseObjectMetadata.d.ts +10 -0
- package/dist/archive/parseObjectMetadata.js +97 -0
- package/dist/archive/parsePlateAssignments.d.ts +6 -0
- package/dist/archive/parsePlateAssignments.js +18 -0
- package/dist/archive/parseVertices.d.ts +7 -0
- package/dist/archive/parseVertices.js +12 -0
- package/dist/archive/paths.d.ts +5 -0
- package/dist/archive/paths.js +6 -0
- package/dist/archive/recenterAssembleItems.d.ts +9 -0
- package/dist/archive/recenterAssembleItems.js +53 -0
- package/dist/archive/recenterBuildItems.d.ts +15 -0
- package/dist/archive/recenterBuildItems.js +51 -0
- package/dist/archive/safeUnzip.d.ts +26 -0
- package/dist/archive/safeUnzip.js +126 -0
- package/dist/archive/setApplicationMetadata.d.ts +13 -0
- package/dist/archive/setApplicationMetadata.js +18 -0
- package/dist/archive/shouldDropFromBambu.d.ts +29 -0
- package/dist/archive/shouldDropFromBambu.js +39 -0
- package/dist/archive/streamObjectVertices.d.ts +19 -0
- package/dist/archive/streamObjectVertices.js +57 -0
- package/dist/archive/tolerantJsonParse.d.ts +20 -0
- package/dist/archive/tolerantJsonParse.js +71 -0
- package/dist/archive/transform.d.ts +21 -0
- package/dist/archive/transform.js +39 -0
- package/dist/archive/unwrapBundle.d.ts +24 -0
- package/dist/archive/unwrapBundle.js +41 -0
- package/dist/archive/xmlBlocks.d.ts +10 -0
- package/dist/archive/xmlBlocks.js +31 -0
- package/dist/archive/zip.d.ts +29 -0
- package/dist/archive/zip.js +141 -0
- package/dist/cli/archiveMove.d.ts +15 -0
- package/dist/cli/archiveMove.js +41 -0
- package/dist/cli/commands/convert.d.ts +89 -0
- package/dist/cli/commands/convert.js +311 -0
- package/dist/cli/commands/diff.d.ts +21 -0
- package/dist/cli/commands/diff.js +112 -0
- package/dist/cli/commands/presets.d.ts +51 -0
- package/dist/cli/commands/presets.js +280 -0
- package/dist/cli/commands/profiles.d.ts +5 -0
- package/dist/cli/commands/profiles.js +26 -0
- package/dist/cli/commands/telemetry.d.ts +6 -0
- package/dist/cli/commands/telemetry.js +45 -0
- package/dist/cli/config.d.ts +18 -0
- package/dist/cli/config.js +50 -0
- package/dist/cli/expandWildcards.d.ts +17 -0
- package/dist/cli/expandWildcards.js +81 -0
- package/dist/cli/logger.d.ts +17 -0
- package/dist/cli/logger.js +36 -0
- package/dist/cli/main.d.ts +24 -0
- package/dist/cli/main.js +598 -0
- package/dist/cli/sameFile.d.ts +9 -0
- package/dist/cli/sameFile.js +40 -0
- package/dist/cli/stats.d.ts +34 -0
- package/dist/cli/stats.js +137 -0
- package/dist/cli/table.d.ts +8 -0
- package/dist/cli/table.js +18 -0
- package/dist/cli/terminalText.d.ts +7 -0
- package/dist/cli/terminalText.js +22 -0
- package/dist/cli/updateCheck.d.ts +14 -0
- package/dist/cli/updateCheck.js +78 -0
- package/dist/cli/watchState.d.ts +18 -0
- package/dist/cli/watchState.js +33 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +10 -0
- package/dist/diff/diffSettings.d.ts +81 -0
- package/dist/diff/diffSettings.js +259 -0
- package/dist/diff/reference.d.ts +14 -0
- package/dist/diff/reference.js +22 -0
- package/dist/diff/settingsCatalog.d.ts +28 -0
- package/dist/diff/settingsCatalog.js +605 -0
- package/dist/diff/valueLayout.d.ts +20 -0
- package/dist/diff/valueLayout.js +65 -0
- package/dist/engine/aboveStock.d.ts +20 -0
- package/dist/engine/aboveStock.js +89 -0
- package/dist/engine/applyFilamentComplianceMode.d.ts +40 -0
- package/dist/engine/applyFilamentComplianceMode.js +68 -0
- package/dist/engine/applyFilamentFlowVariants.d.ts +42 -0
- package/dist/engine/applyFilamentFlowVariants.js +109 -0
- package/dist/engine/applyHighFlowHotends.d.ts +52 -0
- package/dist/engine/applyHighFlowHotends.js +115 -0
- package/dist/engine/applyPresetChanges.d.ts +12 -0
- package/dist/engine/applyPresetChanges.js +23 -0
- package/dist/engine/bedCenter.d.ts +19 -0
- package/dist/engine/bedCenter.js +34 -0
- package/dist/engine/buildFilamentConfigs.d.ts +18 -0
- package/dist/engine/buildFilamentConfigs.js +49 -0
- package/dist/engine/buildProjectSettings.d.ts +24 -0
- package/dist/engine/buildProjectSettings.js +164 -0
- package/dist/engine/carrySourceLayerHeight.d.ts +15 -0
- package/dist/engine/carrySourceLayerHeight.js +41 -0
- package/dist/engine/clampColorPenetration.d.ts +12 -0
- package/dist/engine/clampColorPenetration.js +28 -0
- package/dist/engine/clampToMachineLimits.d.ts +21 -0
- package/dist/engine/clampToMachineLimits.js +84 -0
- package/dist/engine/coerceValue.d.ts +15 -0
- package/dist/engine/coerceValue.js +56 -0
- package/dist/engine/collapseNozzleVariants.d.ts +31 -0
- package/dist/engine/collapseNozzleVariants.js +63 -0
- package/dist/engine/computeShifts.d.ts +12 -0
- package/dist/engine/computeShifts.js +339 -0
- package/dist/engine/constants.d.ts +11 -0
- package/dist/engine/constants.js +12 -0
- package/dist/engine/detectNozzleDiameter.d.ts +15 -0
- package/dist/engine/detectNozzleDiameter.js +29 -0
- package/dist/engine/detectVariantIndex.d.ts +39 -0
- package/dist/engine/detectVariantIndex.js +80 -0
- package/dist/engine/extractFilamentSlots.d.ts +18 -0
- package/dist/engine/extractFilamentSlots.js +88 -0
- package/dist/engine/filamentComplianceNames.d.ts +84 -0
- package/dist/engine/filamentComplianceNames.js +87 -0
- package/dist/engine/filamentVariantLayout.d.ts +29 -0
- package/dist/engine/filamentVariantLayout.js +38 -0
- package/dist/engine/fillFilamentSlots.d.ts +16 -0
- package/dist/engine/fillFilamentSlots.js +26 -0
- package/dist/engine/internal/jsonEqual.d.ts +2 -0
- package/dist/engine/internal/jsonEqual.js +5 -0
- package/dist/engine/parseTierName.d.ts +15 -0
- package/dist/engine/parseTierName.js +21 -0
- package/dist/engine/pickNearestProfile.d.ts +21 -0
- package/dist/engine/pickNearestProfile.js +24 -0
- package/dist/engine/pickProfile.d.ts +49 -0
- package/dist/engine/pickProfile.js +67 -0
- package/dist/engine/policy.d.ts +14 -0
- package/dist/engine/policy.js +266 -0
- package/dist/engine/remapBrimType.d.ts +30 -0
- package/dist/engine/remapBrimType.js +34 -0
- package/dist/engine/reshapeToCount.d.ts +15 -0
- package/dist/engine/reshapeToCount.js +27 -0
- package/dist/engine/resizeFlushVolumes.d.ts +27 -0
- package/dist/engine/resizeFlushVolumes.js +57 -0
- package/dist/engine/resolveMinIfLower.d.ts +21 -0
- package/dist/engine/resolveMinIfLower.js +59 -0
- package/dist/engine/runConvertPipeline.d.ts +79 -0
- package/dist/engine/runConvertPipeline.js +281 -0
- package/dist/engine/stripBambuOnlyNozzleVariantKeys.d.ts +2 -0
- package/dist/engine/stripBambuOnlyNozzleVariantKeys.js +35 -0
- package/dist/engine/types.d.ts +2 -0
- package/dist/engine/types.js +1 -0
- package/dist/errors.d.ts +18 -0
- package/dist/errors.js +9 -0
- package/dist/explain/whatChanged.d.ts +102 -0
- package/dist/explain/whatChanged.js +197 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.js +33 -0
- package/dist/inspect.d.ts +63 -0
- package/dist/inspect.js +103 -0
- package/dist/node.d.ts +11 -0
- package/dist/node.js +50 -0
- package/dist/plainText.d.ts +10 -0
- package/dist/plainText.js +14 -0
- package/dist/presets/extractPreset.d.ts +13 -0
- package/dist/presets/extractPreset.js +87 -0
- package/dist/presets/preset.d.ts +124 -0
- package/dist/presets/preset.js +289 -0
- package/dist/presets/presetKeys.d.ts +5 -0
- package/dist/presets/presetKeys.js +42 -0
- package/dist/profiles.d.ts +184 -0
- package/dist/profiles.js +314 -0
- package/dist/project.d.ts +146 -0
- package/dist/project.js +342 -0
- package/dist/schema.d.ts +103 -0
- package/dist/schema.js +87 -0
- package/dist/stamp.d.ts +45 -0
- package/dist/stamp.js +111 -0
- package/dist/telemetry.d.ts +101 -0
- package/dist/telemetry.js +94 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +3 -0
- package/dist/worker-entry.d.ts +1 -0
- package/dist/worker-entry.js +142 -0
- package/dist/worker.d.ts +86 -0
- package/dist/worker.js +97 -0
- package/dist/workerProtocol.d.ts +91 -0
- package/dist/workerProtocol.js +1 -0
- package/package.json +85 -4
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { basename, dirname, join } from "node:path";
|
|
4
|
+
import { describeFsError } from "./sameFile.js";
|
|
5
|
+
/** The most files one pattern may name. A folder holding more than this is a mistake to stop, not a job to start. */
|
|
6
|
+
export const MAX_WILDCARD_MATCHES = 5000;
|
|
7
|
+
const MAX_PATTERN_LENGTH = 512;
|
|
8
|
+
const hasWildcard = (text) => text.includes("*") || text.includes("?");
|
|
9
|
+
/** A file-name pattern as a regular expression: `*` is any run of characters, `?` is one, everything else is itself. */
|
|
10
|
+
function patternToRegExp(pattern, caseInsensitive) {
|
|
11
|
+
let source = "";
|
|
12
|
+
for (const char of pattern) {
|
|
13
|
+
if (char === "*")
|
|
14
|
+
source += "[^/\\\\]*";
|
|
15
|
+
else if (char === "?")
|
|
16
|
+
source += "[^/\\\\]";
|
|
17
|
+
else
|
|
18
|
+
source += char.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
|
|
19
|
+
}
|
|
20
|
+
return new RegExp(`^${source}$`, caseInsensitive ? "iu" : "u");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Expands `*` and `?` in the file-name part of each argument, for shells that
|
|
24
|
+
* leave them for the program (Command Prompt and PowerShell). An argument that
|
|
25
|
+
* names a file that exists is left alone, as is one with no wildcard, so a
|
|
26
|
+
* shell that already expanded the pattern changes nothing.
|
|
27
|
+
*
|
|
28
|
+
* Wildcards work in the file name only, never in folder names, and never
|
|
29
|
+
* reach into subfolders. A name starting with a dot matches only a pattern
|
|
30
|
+
* that starts with one, as in a Unix shell. Matches are files (not folders),
|
|
31
|
+
* sorted by name, and a file already in the list is not added twice.
|
|
32
|
+
* A pattern that matches nothing, or too much, is an error.
|
|
33
|
+
*/
|
|
34
|
+
export function expandInputPatterns(args, options = {}) {
|
|
35
|
+
const caseInsensitive = options.caseInsensitive ?? process.platform === "win32";
|
|
36
|
+
const result = [];
|
|
37
|
+
for (const arg of args) {
|
|
38
|
+
if (!hasWildcard(arg) || existsSync(arg)) {
|
|
39
|
+
result.push(arg);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (arg.length > MAX_PATTERN_LENGTH)
|
|
43
|
+
throw new Error("A file pattern that long can't be right.");
|
|
44
|
+
const dir = dirname(arg);
|
|
45
|
+
const pattern = basename(arg);
|
|
46
|
+
if (hasWildcard(dir))
|
|
47
|
+
throw new Error(`Wildcards work in the file name only, not in folder names: "${arg}"`);
|
|
48
|
+
let names;
|
|
49
|
+
try {
|
|
50
|
+
names = readdirSync(dir);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
throw new Error(`Error reading ${arg}: ${describeFsError(err)}`);
|
|
54
|
+
}
|
|
55
|
+
const matcher = patternToRegExp(pattern, caseInsensitive);
|
|
56
|
+
const showDotFiles = pattern.startsWith(".");
|
|
57
|
+
const matches = [];
|
|
58
|
+
for (const name of names) {
|
|
59
|
+
if (!matcher.test(name) || (name.startsWith(".") && !showDotFiles))
|
|
60
|
+
continue;
|
|
61
|
+
const path = join(dir, name);
|
|
62
|
+
try {
|
|
63
|
+
if (!statSync(path).isFile())
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
matches.push(path);
|
|
70
|
+
if (matches.length > MAX_WILDCARD_MATCHES)
|
|
71
|
+
throw new Error(`"${arg}" matches more than ${MAX_WILDCARD_MATCHES} files. Use a narrower pattern or convert a folder at a time.`);
|
|
72
|
+
}
|
|
73
|
+
if (matches.length === 0)
|
|
74
|
+
throw new Error(`No files match "${arg}".`);
|
|
75
|
+
matches.sort();
|
|
76
|
+
for (const path of matches)
|
|
77
|
+
if (!result.includes(path))
|
|
78
|
+
result.push(path);
|
|
79
|
+
}
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
log(message: string): void;
|
|
3
|
+
error(message: string): void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Wraps console output so an unattended run (--watch, or a plain convert
|
|
7
|
+
* invoked from cron) has a durable record instead of relying on someone
|
|
8
|
+
* watching a terminal that may not exist. --log-file appends every line to
|
|
9
|
+
* a file (with a timestamp) in addition to stdout/stderr; --quiet
|
|
10
|
+
* suppresses stdout/stderr entirely. cli/main.ts refuses --quiet without
|
|
11
|
+
* --log-file -- that combination would silently swallow every error with
|
|
12
|
+
* nowhere for it to go, which is the opposite of what this exists for.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createLogger(options: {
|
|
15
|
+
logFile?: string;
|
|
16
|
+
quiet: boolean;
|
|
17
|
+
}): Logger;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
import { appendFileSync } from "node:fs";
|
|
3
|
+
import { safeTerminalText } from "./terminalText.js";
|
|
4
|
+
function timestampedLine(message) {
|
|
5
|
+
return `${new Date().toISOString()} ${message}\n`;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Wraps console output so an unattended run (--watch, or a plain convert
|
|
9
|
+
* invoked from cron) has a durable record instead of relying on someone
|
|
10
|
+
* watching a terminal that may not exist. --log-file appends every line to
|
|
11
|
+
* a file (with a timestamp) in addition to stdout/stderr; --quiet
|
|
12
|
+
* suppresses stdout/stderr entirely. cli/main.ts refuses --quiet without
|
|
13
|
+
* --log-file -- that combination would silently swallow every error with
|
|
14
|
+
* nowhere for it to go, which is the opposite of what this exists for.
|
|
15
|
+
*/
|
|
16
|
+
export function createLogger(options) {
|
|
17
|
+
// The log file is read in a terminal too, so it gets the same treatment as the screen.
|
|
18
|
+
const writeToFile = (message) => {
|
|
19
|
+
if (options.logFile)
|
|
20
|
+
appendFileSync(options.logFile, timestampedLine(message));
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
log(raw) {
|
|
24
|
+
const message = safeTerminalText(raw);
|
|
25
|
+
writeToFile(message);
|
|
26
|
+
if (!options.quiet)
|
|
27
|
+
console.log(message);
|
|
28
|
+
},
|
|
29
|
+
error(raw) {
|
|
30
|
+
const message = safeTerminalText(raw);
|
|
31
|
+
writeToFile(message);
|
|
32
|
+
if (!options.quiet)
|
|
33
|
+
console.error(message);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Env } from "./config.js";
|
|
2
|
+
export interface CliIo {
|
|
3
|
+
env: Env;
|
|
4
|
+
/** Whether stdout is a terminal (no prompts or update notices otherwise). */
|
|
5
|
+
isTTY: boolean;
|
|
6
|
+
out(line: string): void;
|
|
7
|
+
err(line: string): void;
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
}
|
|
10
|
+
/** Runs the CLI and returns its exit code. Never calls process.exit, so tests can drive it. */
|
|
11
|
+
export declare function runCli(argv: string[], rawIo: CliIo): Promise<number>;
|
|
12
|
+
/**
|
|
13
|
+
* `--max-unpacked 4GB` -> bytes. Takes a number with GB or MB (or plain
|
|
14
|
+
* bytes), from 1 MB to the library's 16 GB ceiling; anything else is refused
|
|
15
|
+
* with the reason, never rounded into range.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseMaxUnpacked(raw: string): number;
|
|
18
|
+
/**
|
|
19
|
+
* `--high-flow-toolheads 1,3` -> `[true, false, true, false]`. Toolheads are
|
|
20
|
+
* numbered 1 to 4 as on the printer. Rejects anything else (empty entries,
|
|
21
|
+
* duplicates, numbers out of range) instead of guessing, since a wrong
|
|
22
|
+
* hotend choice changes the speeds a toolhead prints at.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseHighFlowToolheads(raw: string): boolean[];
|