brepjs-cad 0.2.0 → 0.2.1

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.1](https://github.com/andymai/brepjs/compare/brepjs-cad-v0.2.0...brepjs-cad-v0.2.1) (2026-06-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **brepjs-cad:** load .ts parts via native type-stripping ([#1207](https://github.com/andymai/brepjs/issues/1207)) ([198078b](https://github.com/andymai/brepjs/commit/198078becf570614c0cbf61537714fc94c2de43a))
9
+
3
10
  ## [0.2.0](https://github.com/andymai/brepjs/compare/brepjs-cad-v0.1.0...brepjs-cad-v0.2.0) (2026-06-04)
4
11
 
5
12
 
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_diff = require("./diff-DyOhTrZ3.cjs");
2
+ const require_diff = require("./diff-DJSNDa-j.cjs");
3
3
  exports.emptyReport = require_diff.emptyReport;
4
4
  exports.runChecks = require_diff.runChecks;
5
5
  exports.runDiff = require_diff.runDiff;
@@ -1,2 +1,2 @@
1
- import { a as emptyReport, c as serializeReport, i as runChecks, n as runMeasure, r as runPart, t as runDiff } from "./diff-DhKrjOVB.js";
1
+ import { a as emptyReport, c as serializeReport, i as runChecks, n as runMeasure, r as runPart, t as runDiff } from "./diff-Bi3sMI-Z.js";
2
2
  export { emptyReport, runChecks, runDiff, runMeasure, runPart, serializeReport };
package/dist/cli/main.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_diff = require("../diff-DyOhTrZ3.cjs");
3
+ const require_diff = require("../diff-DJSNDa-j.cjs");
4
4
  let brepjs = require("brepjs");
5
+ let node_url = require("node:url");
5
6
  let commander = require("commander");
6
7
  let node_fs = require("node:fs");
7
8
  let node_path = require("node:path");
8
9
  let node_os = require("node:os");
9
- let node_url = require("node:url");
10
10
  //#region src/cli/scaffold.ts
11
11
  function partTemplate(name) {
12
12
  return `import { box, cut, unwrap } from 'brepjs';
package/dist/cli/main.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { c as serializeReport, n as runMeasure, o as pushError, r as runPart, s as reportOk, t as runDiff } from "../diff-DhKrjOVB.js";
2
+ import { c as serializeReport, n as runMeasure, o as pushError, r as runPart, s as reportOk, t as runDiff } from "../diff-Bi3sMI-Z.js";
3
3
  import { exportSTL, isOk } from "brepjs";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { Command } from "commander";
5
6
  import { existsSync, mkdirSync, realpathSync, watch, writeFileSync } from "node:fs";
6
7
  import { basename, dirname, join, resolve } from "node:path";
7
8
  import { tmpdir } from "node:os";
8
- import { fileURLToPath } from "node:url";
9
9
  //#region src/cli/scaffold.ts
10
10
  function partTemplate(name) {
11
11
  return `import { box, cut, unwrap } from 'brepjs';
@@ -1,4 +1,5 @@
1
1
  import { cut, exportGlb, exportSTEP, getBounds, init, isCompSolid, isCompound, isEdge, isFace, isOk, isShape3D, isShell, isSolid, isVertex, isWire, measureArea, measureDistance, measureLength, measureVolume, mesh, validSolid } from "brepjs";
2
+ import { pathToFileURL } from "node:url";
2
3
  //#region src/verify/report.ts
3
4
  function emptyReport() {
4
5
  return {
@@ -237,6 +238,15 @@ function runChecks(shape) {
237
238
  }
238
239
  //#endregion
239
240
  //#region src/verify/runPart.ts
241
+ async function loadPart(modulePath) {
242
+ try {
243
+ return await import(pathToFileURL(modulePath).href);
244
+ } catch (e) {
245
+ const msg = e instanceof Error ? e.message : String(e);
246
+ if (/\.[mc]?tsx?$/.test(modulePath) && /import statement|file extension/i.test(msg)) throw new Error(`cannot load TypeScript part "${modulePath}": author parts in an ESM project (set "type": "module" in package.json) or rename the file to .mts. (${msg})`, { cause: e });
247
+ throw e;
248
+ }
249
+ }
240
250
  function isResult(v) {
241
251
  return typeof v === "object" && v !== null && "ok" in v && typeof v.ok === "boolean";
242
252
  }
@@ -271,7 +281,7 @@ async function runPart(modulePath, opts = {}) {
271
281
  }
272
282
  let mod;
273
283
  try {
274
- mod = await import(modulePath);
284
+ mod = await loadPart(modulePath);
275
285
  } catch (e) {
276
286
  pushError(report, toErrorInfo("import failed", e));
277
287
  return finalize({
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let node_url = require("node:url");
2
3
  let node_fs = require("node:fs");
3
4
  let node_path = require("node:path");
4
- let node_url = require("node:url");
5
5
  let node_http = require("node:http");
6
6
  let node_fs_promises = require("node:fs/promises");
7
7
  //#region src/snapshot/static.ts
@@ -1,6 +1,6 @@
1
+ import { fileURLToPath } from "node:url";
1
2
  import { createReadStream } from "node:fs";
2
3
  import { dirname, extname, join, normalize, resolve, sep } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
4
  import { createServer } from "node:http";
5
5
  import { stat } from "node:fs/promises";
6
6
  //#region src/snapshot/static.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brepjs-cad",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Agent skill + verify/preview tooling for authoring parametric brepjs CAD code",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -45,6 +45,7 @@
45
45
  "lint": "eslint src tests viewer bench",
46
46
  "test": "vitest run",
47
47
  "eval": "tsx bench/run.ts",
48
+ "smoke": "node dist/cli/main.js verify tests/fixtures/validBox.brep.ts | node -e \"const r=JSON.parse(require('fs').readFileSync(0,'utf8'));if(r.ok!==true||!(r.measurements.volume>0))process.exit(1)\"",
48
49
  "prepack": "npm run build"
49
50
  },
50
51
  "peerDependencies": {