diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 2b3e2063..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,466 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.0.0-next.0](https://github.com/tracespace/tracespace/compare/v4.2.0...v5.0.0-next.0) (2020-06-28) - - -### Bug Fixes - -* **deps:** update devDependencies, React, and yargs ([#315](https://github.com/tracespace/tracespace/issues/315)) ([34ebb3e](https://github.com/tracespace/tracespace/commit/34ebb3e)) -* **view:** avoid lowercase sentence start in welcome message ([8b7f331](https://github.com/tracespace/tracespace/commit/8b7f331)) -* **view:** fix react hook and typescript lint failures ([4e8f300](https://github.com/tracespace/tracespace/commit/4e8f300)) - - -### chore - -* drop support for Node v8 ([8523152](https://github.com/tracespace/tracespace/commit/8523152)) - - -### Code Refactoring - -* **whats-that-gerber:** convert WTG to TypeScript ([45056c4](https://github.com/tracespace/tracespace/commit/45056c4)) -* **xml-id:** port xml-id to TypeScript ([ff4bbb1](https://github.com/tracespace/tracespace/commit/ff4bbb1)) - - -### Features - -* **parser:** add @tracespace/parser package ([#338](https://github.com/tracespace/tracespace/issues/338)) ([6f974dd](https://github.com/tracespace/tracespace/commit/6f974dd)) - - -### BREAKING CHANGES - -* Node v8 is no longer supported -* **xml-id:** Export scheme of xml-id slightly changed -* **whats-that-gerber:** Switched WTG to named exports only - - - - - -# [4.2.0](https://github.com/tracespace/tracespace/compare/v4.1.1...v4.2.0) (2019-10-10) - - -### Bug Fixes - -* **deps:** update dependencies ([#304](https://github.com/tracespace/tracespace/issues/304)) ([8029e8e](https://github.com/tracespace/tracespace/commit/8029e8e)) -* **deps:** update dependency globby to v10 ([#289](https://github.com/tracespace/tracespace/issues/289)) ([09f6960](https://github.com/tracespace/tracespace/commit/09f6960)) -* **deps:** update type definitions ([#272](https://github.com/tracespace/tracespace/issues/272)) ([6f6eb3f](https://github.com/tracespace/tracespace/commit/6f6eb3f)) -* **deps:** Upgrade all dependencies ([7f3c6f4](https://github.com/tracespace/tracespace/commit/7f3c6f4)) -* **view:** Ensure layer defs are accessible to s in board renders ([#305](https://github.com/tracespace/tracespace/issues/305)) ([0d0ee60](https://github.com/tracespace/tracespace/commit/0d0ee60)), closes [#303](https://github.com/tracespace/tracespace/issues/303) - - -### Features - -* **gerber-parser:** Identify hole-plating in drill files ([#285](https://github.com/tracespace/tracespace/issues/285)) ([497f506](https://github.com/tracespace/tracespace/commit/497f506)) - - - - - -## [4.1.1](https://github.com/tracespace/tracespace/compare/v4.1.0...v4.1.1) (2019-06-05) - - -### Bug Fixes - -* **cli:** Do not append "null" to output filenames ([#253](https://github.com/tracespace/tracespace/issues/253)) ([09f1c4e](https://github.com/tracespace/tracespace/commit/09f1c4e)), closes [#251](https://github.com/tracespace/tracespace/issues/251) -* **deps:** update dependency core-js to ^3.1.3 ([#261](https://github.com/tracespace/tracespace/issues/261)) ([5b60c1e](https://github.com/tracespace/tracespace/commit/5b60c1e)) -* **deps:** update dependency cosmiconfig to ^5.2.1 ([#257](https://github.com/tracespace/tracespace/issues/257)) ([b2586c5](https://github.com/tracespace/tracespace/commit/b2586c5)) -* **deps:** update dependency file-saver to ^2.0.2 ([#255](https://github.com/tracespace/tracespace/issues/255)) ([3dac107](https://github.com/tracespace/tracespace/commit/3dac107)) -* **deps:** update dependency formik to ^1.5.7 ([#259](https://github.com/tracespace/tracespace/issues/259)) ([e47896e](https://github.com/tracespace/tracespace/commit/e47896e)) -* **deps:** update dependency glob to ^7.1.4 ([#250](https://github.com/tracespace/tracespace/issues/250)) ([8f6c5dc](https://github.com/tracespace/tracespace/commit/8f6c5dc)) -* **deps:** update dependency mixpanel-browser to ^2.28.0 ([#256](https://github.com/tracespace/tracespace/issues/256)) ([52b81d6](https://github.com/tracespace/tracespace/commit/52b81d6)) -* **deps:** update dependency readable-stream to ^3.4.0 ([#264](https://github.com/tracespace/tracespace/issues/264)) ([1936088](https://github.com/tracespace/tracespace/commit/1936088)) -* **deps:** update dependency yargs to ^13.2.4 ([#254](https://github.com/tracespace/tracespace/issues/254)) ([04646a3](https://github.com/tracespace/tracespace/commit/04646a3)) -* **deps:** update font awesome ([#249](https://github.com/tracespace/tracespace/issues/249)) ([040b16d](https://github.com/tracespace/tracespace/commit/040b16d)) -* **deps:** update type definitions ([#245](https://github.com/tracespace/tracespace/issues/245)) ([d227db3](https://github.com/tracespace/tracespace/commit/d227db3)) -* **whats-that-gerber:** Support for PCB:NG Eagle, .gbx, .art files ([#268](https://github.com/tracespace/tracespace/issues/268)) ([1449cba](https://github.com/tracespace/tracespace/commit/1449cba)), closes [#246](https://github.com/tracespace/tracespace/issues/246) [#248](https://github.com/tracespace/tracespace/issues/248) - - - - - -# [4.1.0](https://github.com/tracespace/tracespace/compare/v4.0.3...v4.1.0) (2019-05-01) - - -### Bug Fixes - -* **deps:** update dependency dexie to v3.0.0-alpha.8 ([#240](https://github.com/tracespace/tracespace/issues/240)) ([e853602](https://github.com/tracespace/tracespace/commit/e853602)) -* **deps:** update dependency formik to ^1.5.4 ([#241](https://github.com/tracespace/tracespace/issues/241)) ([4584731](https://github.com/tracespace/tracespace/commit/4584731)) -* **deps:** update dependency react-hot-loader to ^4.8.4 ([#209](https://github.com/tracespace/tracespace/issues/209)) ([591bf66](https://github.com/tracespace/tracespace/commit/591bf66)) -* **deps:** update dependency react-transition-group to v4 ([#232](https://github.com/tracespace/tracespace/issues/232)) ([14286fa](https://github.com/tracespace/tracespace/commit/14286fa)) -* **deps:** update dependency untildify to v4 ([#242](https://github.com/tracespace/tracespace/issues/242)) ([207faf1](https://github.com/tracespace/tracespace/commit/207faf1)) -* **deps:** update type definitions ([#238](https://github.com/tracespace/tracespace/issues/238)) ([899777e](https://github.com/tracespace/tracespace/commit/899777e)) - - -### Features - -* **view:** Add optional anonymous usage tracking ([#236](https://github.com/tracespace/tracespace/issues/236)) ([fea6a33](https://github.com/tracespace/tracespace/commit/fea6a33)) - - - - - -## [4.0.3](https://github.com/tracespace/tracespace/compare/v4.0.2...v4.0.3) (2019-04-10) - - -### Bug Fixes - -* **deps:** update dependency @types/node to ^11.13.0 ([#193](https://github.com/tracespace/tracespace/issues/193)) ([44f2d60](https://github.com/tracespace/tracespace/commit/44f2d60)) -* **deps:** update dependency @types/node to ^11.13.2 ([#217](https://github.com/tracespace/tracespace/issues/217)) ([e981a4e](https://github.com/tracespace/tracespace/commit/e981a4e)) -* **deps:** update dependency core-js to ^3.0.1 ([#213](https://github.com/tracespace/tracespace/issues/213)) ([b6a87f1](https://github.com/tracespace/tracespace/commit/b6a87f1)) -* **deps:** update dependency cosmiconfig to ^5.2.0 ([#190](https://github.com/tracespace/tracespace/issues/190)) ([347a9f5](https://github.com/tracespace/tracespace/commit/347a9f5)) -* **deps:** update dependency dot-prop to v5 ([#214](https://github.com/tracespace/tracespace/issues/214)) ([921518e](https://github.com/tracespace/tracespace/commit/921518e)) -* **deps:** update dependency formik to ^1.5.2 ([#204](https://github.com/tracespace/tracespace/issues/204)) ([f84edda](https://github.com/tracespace/tracespace/commit/f84edda)) -* **deps:** update dependency globby to ^9.2.0 ([#200](https://github.com/tracespace/tracespace/issues/200)) ([06f0955](https://github.com/tracespace/tracespace/commit/06f0955)) -* **deps:** update dependency make-dir to v3 ([#201](https://github.com/tracespace/tracespace/issues/201)) ([eff27d5](https://github.com/tracespace/tracespace/commit/eff27d5)) -* **deps:** update dependency react-transition-group to ^2.8.0 ([#202](https://github.com/tracespace/tracespace/issues/202)) ([44a05a1](https://github.com/tracespace/tracespace/commit/44a05a1)) -* **deps:** update dependency readable-stream to ^3.3.0 ([#199](https://github.com/tracespace/tracespace/issues/199)) ([594e947](https://github.com/tracespace/tracespace/commit/594e947)) -* **deps:** update react monorepo and packages ([#191](https://github.com/tracespace/tracespace/issues/191)) ([56320c8](https://github.com/tracespace/tracespace/commit/56320c8)) -* **view:** Make ZIP logic more lenient by checking filename ([#222](https://github.com/tracespace/tracespace/issues/222)) ([a37a02d](https://github.com/tracespace/tracespace/commit/a37a02d)), closes [#220](https://github.com/tracespace/tracespace/issues/220) - - - - - -## [4.0.2](https://github.com/tracespace/tracespace/compare/v4.0.1...v4.0.2) (2019-03-24) - - -### Bug Fixes - -* **deps:** update dependency @types/node to ^11.11.6 ([#184](https://github.com/tracespace/tracespace/issues/184)) ([c3bb301](https://github.com/tracespace/tracespace/commit/c3bb301)) -* **deps:** update dependency jszip to ^3.2.1 ([#163](https://github.com/tracespace/tracespace/issues/163)) ([ee2aeac](https://github.com/tracespace/tracespace/commit/ee2aeac)) -* **deps:** update font awesome ([#173](https://github.com/tracespace/tracespace/issues/173)) ([f9ba8e8](https://github.com/tracespace/tracespace/commit/f9ba8e8)) -* **deps:** update react monorepo and packages ([#155](https://github.com/tracespace/tracespace/issues/155)) ([cd445d8](https://github.com/tracespace/tracespace/commit/cd445d8)) -* **gerber-plotter:** Emit correct 'repeat' object on steprepeat disable ([#188](https://github.com/tracespace/tracespace/issues/188)) ([930d133](https://github.com/tracespace/tracespace/commit/930d133)), closes [#81](https://github.com/tracespace/tracespace/issues/81) -* **gerber-to-svg:** Allow options parameter to be skipped ([#181](https://github.com/tracespace/tracespace/issues/181)) ([bbe5c07](https://github.com/tracespace/tracespace/commit/bbe5c07)) -* **whats-that-gerber:** Add Orcad matchers for .drd and .npt ([#189](https://github.com/tracespace/tracespace/issues/189)) ([2894208](https://github.com/tracespace/tracespace/commit/2894208)) - - - - - -## [4.0.1](https://github.com/tracespace/tracespace/compare/v4.0.0...v4.0.1) (2019-03-23) - - -### Bug Fixes - -* **deps:** update dependency @types/lodash to ^4.14.123 ([#154](https://github.com/tracespace/tracespace/issues/154)) ([ff4856b](https://github.com/tracespace/tracespace/commit/ff4856b)) -* **deps:** update dependency @types/react-dom to ^16.8.3 ([#156](https://github.com/tracespace/tracespace/issues/156)) ([0ee9a03](https://github.com/tracespace/tracespace/commit/0ee9a03)) -* **deps:** update dependency color-string to ^1.5.3 ([#157](https://github.com/tracespace/tracespace/issues/157)) ([611b026](https://github.com/tracespace/tracespace/commit/611b026)) -* **deps:** update dependency cosmiconfig to ^5.1.0 ([#158](https://github.com/tracespace/tracespace/issues/158)) ([100bb59](https://github.com/tracespace/tracespace/commit/100bb59)) -* **deps:** update dependency debug to ^4.1.1 ([#159](https://github.com/tracespace/tracespace/issues/159)) ([153fa22](https://github.com/tracespace/tracespace/commit/153fa22)) -* **deps:** update dependency dexie to v3.0.0-alpha.7 ([#161](https://github.com/tracespace/tracespace/issues/161)) ([0621fe4](https://github.com/tracespace/tracespace/commit/0621fe4)) -* **deps:** update dependency glob to ^7.1.3 ([#162](https://github.com/tracespace/tracespace/issues/162)) ([e20498c](https://github.com/tracespace/tracespace/commit/e20498c)) -* **deps:** update dependency mini-svg-data-uri to ^1.0.3 ([#164](https://github.com/tracespace/tracespace/issues/164)) ([ebc957c](https://github.com/tracespace/tracespace/commit/ebc957c)) -* **deps:** update dependency run-parallel to ^1.1.9 ([#166](https://github.com/tracespace/tracespace/issues/166)) ([a175306](https://github.com/tracespace/tracespace/commit/a175306)) -* **deps:** update dependency run-series to ^1.1.8 ([#170](https://github.com/tracespace/tracespace/issues/170)) ([d5b0082](https://github.com/tracespace/tracespace/commit/d5b0082)) -* **deps:** update dependency run-waterfall to ^1.1.6 ([#172](https://github.com/tracespace/tracespace/issues/172)) ([9e72361](https://github.com/tracespace/tracespace/commit/9e72361)) -* **gerber-parser:** Parse DipTrace drill coordinate format command ([#168](https://github.com/tracespace/tracespace/issues/168)) ([b0de854](https://github.com/tracespace/tracespace/commit/b0de854)), closes [#137](https://github.com/tracespace/tracespace/issues/137) -* **whats-that-gerber:** Recognize DipTrace inner copper layers ([#171](https://github.com/tracespace/tracespace/issues/171)) ([100a95b](https://github.com/tracespace/tracespace/commit/100a95b)), closes [#138](https://github.com/tracespace/tracespace/issues/138) - - - - - -# [4.0.0](https://github.com/tracespace/tracespace/compare/v4.0.0-next.19...v4.0.0) (2019-03-09) - -**Note:** Version bump only for package tracespace - - - - - -# [4.0.0-next.19](https://github.com/tracespace/tracespace/compare/v4.0.0-next.18...v4.0.0-next.19) (2019-03-09) - - -### Bug Fixes - -* **pcb-stackup-core:** Fix defs duplication when collecting layers ([#108](https://github.com/tracespace/tracespace/issues/108)) ([e0be86e](https://github.com/tracespace/tracespace/commit/e0be86e)), closes [#85](https://github.com/tracespace/tracespace/issues/85) - - -### Code Refactoring - -* **pcb-stackup:** Remove special handling of options.createElement ([#110](https://github.com/tracespace/tracespace/issues/110)) ([7d7fbeb](https://github.com/tracespace/tracespace/commit/7d7fbeb)), closes [#43](https://github.com/tracespace/tracespace/issues/43) - - -### Continuous Integration - -* **travis:** Set up deployment to S3 from Travis ([#105](https://github.com/tracespace/tracespace/issues/105)) ([fc915f9](https://github.com/tracespace/tracespace/commit/fc915f9)) - - -### Features - -* Add typescript definitions to all consumable modules ([#103](https://github.com/tracespace/tracespace/issues/103)) ([bb6e8f9](https://github.com/tracespace/tracespace/commit/bb6e8f9)) -* **view:** Add viewer rewrite to monorepo ([#104](https://github.com/tracespace/tracespace/issues/104)) ([4502adf](https://github.com/tracespace/tracespace/commit/4502adf)) -* Update dependencies and enable Greenkeeper ([9db54cc](https://github.com/tracespace/tracespace/commit/9db54cc)) - - -### Performance Improvements - -* Align and simplify parameters, defaults, and return values ([#102](https://github.com/tracespace/tracespace/issues/102)) ([c4e3a84](https://github.com/tracespace/tracespace/commit/c4e3a84)), closes [#99](https://github.com/tracespace/tracespace/issues/99) - - -### BREAKING CHANGES - -* **pcb-stackup:** pcb-stackup no longer tries to help if you use -options.createElement. You can still use it, but you'll have to manually -align your gerber-to-svg options with pcb-stackup's options -* **travis:** Node v6 dropped from CI testing matrix -* Parameters, defaults, and return types have changed in pcb-stackup, -pcb-stackup-core, and gerber-to-svg - - - - - -# [4.0.0-next.18](https://github.com/tracespace/tracespace/compare/v4.0.0-next.17...v4.0.0-next.18) (2019-01-26) - - -### Bug Fixes - -* **fixtures:** Replace macro multi-exposure expected render ([#101](https://github.com/tracespace/tracespace/issues/101)) ([a821588](https://github.com/tracespace/tracespace/commit/a821588)) -* **gerber-to-svg:** Wrap children of nodes in a ([#100](https://github.com/tracespace/tracespace/issues/100)) ([b984e32](https://github.com/tracespace/tracespace/commit/b984e32)), closes [#98](https://github.com/tracespace/tracespace/issues/98) - - - - - -# [4.0.0-next.17](https://github.com/tracespace/tracespace/compare/v4.0.0-next.16...v4.0.0-next.17) (2018-12-20) - - -### Bug Fixes - -* **parser:** Set units with M71/M72 in drill files ([#96](https://github.com/tracespace/tracespace/issues/96)) ([11066d2](https://github.com/tracespace/tracespace/commit/11066d2)) - - - - - -# [4.0.0-next.16](https://github.com/tracespace/tracespace/compare/v4.0.0-next.15...v4.0.0-next.16) (2018-11-26) - - -### Bug Fixes - -* **cli:** Update CLI to be compatible with whats-that-gerber ([#94](https://github.com/tracespace/tracespace/issues/94)) ([8f5f91e](https://github.com/tracespace/tracespace/commit/8f5f91e)) - - - - - -# [4.0.0-next.15](https://github.com/tracespace/tracespace/compare/v4.0.0-next.14...v4.0.0-next.15) (2018-11-13) - - -### Features - -* **whats-that-gerber:** Use collection of filenames to determine type ([#77](https://github.com/tracespace/tracespace/issues/77)) ([6919549](https://github.com/tracespace/tracespace/commit/6919549)) - - -### BREAKING CHANGES - -* **whats-that-gerber:** Output of whats-that-gerber changed from a single string to an -object keyed by the filenames passed in as an array - - - - - - -# [4.0.0-next.14](https://github.com/tracespace/tracespace/compare/v4.0.0-next.13...v4.0.0-next.14) (2018-10-13) - - -### Bug Fixes - -* **xml-id:** Restrict characters to those valid in CSS selectors ([#88](https://github.com/tracespace/tracespace/issues/88)) ([1fe779e](https://github.com/tracespace/tracespace/commit/1fe779e)), closes [#78](https://github.com/tracespace/tracespace/issues/78) - - - - - - -# [4.0.0-next.13](https://github.com/tracespace/tracespace/compare/v4.0.0-next.12...v4.0.0-next.13) (2018-09-12) - - -### Bug Fixes - -* Replace shortid with [@tracespace](https://github.com/tracespace)/xml-id and sanitize IDs ([#79](https://github.com/tracespace/tracespace/issues/79)) ([2cda760](https://github.com/tracespace/tracespace/commit/2cda760)), closes [#78](https://github.com/tracespace/tracespace/issues/78) - - -### Features - -* **whats-that-gerber:** Add support for diptrace filenames ([f3d5d9a](https://github.com/tracespace/tracespace/commit/f3d5d9a)) - - - - - - -# [4.0.0-next.12](https://github.com/tracespace/tracespace/compare/v4.0.0-next.11...v4.0.0-next.12) (2018-07-17) - - -### Bug Fixes - -* **pcb-stackup:** Do not mutate layer options and keep filename ([6cbecde](https://github.com/tracespace/tracespace/commit/6cbecde)) - - -### Code Refactoring - -* **gerber-to-svg:** Remove CLI in favor of [@tracespace](https://github.com/tracespace)/cli ([50e255d](https://github.com/tracespace/tracespace/commit/50e255d)) - - -### Features - -* **cli:** Add [@tracespace](https://github.com/tracespace)/cli package ([486d6fc](https://github.com/tracespace/tracespace/commit/486d6fc)), closes [#13](https://github.com/tracespace/tracespace/issues/13) -* **whats-that-gerber:** Add support for eagle 9+ filenames ([#76](https://github.com/tracespace/tracespace/issues/76)) ([3b8f570](https://github.com/tracespace/tracespace/commit/3b8f570)) - - -### BREAKING CHANGES - -* **gerber-to-svg:** Removed gerber-to-svg (gerber2svg) CLI - - - - - - -# [4.0.0-next.11](https://github.com/tracespace/tracespace/compare/v4.0.0-next.10...v4.0.0-next.11) (2018-07-02) - - -### Bug Fixes - -* **whats-that-gerber:** Improve Altium mech layer recognition ([#70](https://github.com/tracespace/tracespace/issues/70)) ([e48d03f](https://github.com/tracespace/tracespace/commit/e48d03f)), closes [#69](https://github.com/tracespace/tracespace/issues/69) - - - - - - -# [4.0.0-next.10](https://github.com/tracespace/tracespace/compare/v4.0.0-next.9...v4.0.0-next.10) (2018-06-27) - - -### Features - -* **whats-that-gerber:** Match Altium internal planes as icu layer ([#68](https://github.com/tracespace/tracespace/issues/68)) ([f0155e2](https://github.com/tracespace/tracespace/commit/f0155e2)), closes [#67](https://github.com/tracespace/tracespace/issues/67) - - - - - - -# [4.0.0-next.9](https://github.com/tracespace/tracespace/compare/v4.0.0-next.8...v4.0.0-next.9) (2018-06-19) - - -### Bug Fixes - -* **gerber-plotter:** Fix outline regression with duplicate paths([#64](https://github.com/tracespace/tracespace/issues/64)) ([23b4bcb](https://github.com/tracespace/tracespace/commit/23b4bcb)) - - -### Features - -* **fixtures:** Add usbvil and bus-pirate boards ([#65](https://github.com/tracespace/tracespace/issues/65)) ([394e130](https://github.com/tracespace/tracespace/commit/394e130)) - - - - - - -# [4.0.0-next.8](https://github.com/tracespace/tracespace/compare/v4.0.0-next.7...v4.0.0-next.8) (2018-06-16) - -**Note:** Version bump only for package tracespace - - - - - - -# [4.0.0-next.7](https://github.com/tracespace/tracespace/compare/v4.0.0-next.6...v4.0.0-next.7) (2018-06-16) - - -### Bug Fixes - -* **gerber-plotter:** Fix gap fill ruining arcs (mcous/gerber-plotter[#13](https://github.com/tracespace/tracespace/issues/13)) ([6cf04b7](https://github.com/tracespace/tracespace/commit/6cf04b7)) - - - - - - -# [4.0.0-next.6](https://github.com/tracespace/tracespace/compare/v4.0.0-next.5...v4.0.0-next.6) (2018-06-15) - - -### Bug Fixes - -* **gerber-to-svg:** Fix append-ext check using old short-option ([cde8cda](https://github.com/tracespace/tracespace/commit/cde8cda)) - - - - - - -# [4.0.0-next.5](https://github.com/tracespace/tracespace/compare/v4.0.0-next.4...v4.0.0-next.5) (2018-06-15) - - -### Features - -* **gerber-to-svg:** Replace non-functional CLI options ([5633375](https://github.com/tracespace/tracespace/commit/5633375)) - - -### BREAKING CHANGES - -* **gerber-to-svg:** Short option for --append-ext was changed from -a to --e, short option for --optimize-paths was changed to from -z to -t to -match documentation and because -z was already used by --zero - - - - - - -# [4.0.0-next.4](https://github.com/tracespace/tracespace/compare/v4.0.0-next.3...v4.0.0-next.4) (2018-04-27) - - -### Bug Fixes - -* **pcb-stackup-core:** Fix rgba to rgb+opacity conversion ([e07b4be](https://github.com/tracespace/tracespace/commit/e07b4be)) - - -### Features - -* **tracespace:** Add pcb-stackup-core@3.0.0 to monorepo ([44a24c1](https://github.com/tracespace/tracespace/commit/44a24c1)) -* **fixtures:** Move common render server into fixtures module ([523f681](https://github.com/tracespace/tracespace/commit/523f681)) - - - - - - -# [4.0.0-next.3](https://github.com/tracespace/tracespace/compare/v4.0.0-next.2...v4.0.0-next.3) (2018-04-18) - - -### Features - -* **tracespace:** Add whats-that-gerber@3.0.0 to monorepo ([5d755ed](https://github.com/tracespace/tracespace/commit/5d755ed)) - - - - - - -# [4.0.0-next.2](https://github.com/tracespace/tracespace/compare/v4.0.0-next.1...v4.0.0-next.2) (2018-04-17) - -### Features - -* **tracespace:** Add pcb-stackup@3.0.0 to monorepo ([4b08b2d](https://github.com/tracespace/tracespace/commit/4b08b2d)) - - - - - - -# [4.0.0-next.1](https://github.com/tracespace/tracespace/compare/v4.0.0-next.0...v4.0.0-next.1) (2018-04-17) - - -### Features - -* **fixtures:** Add [@tracespace](https://github.com/tracespace)/fixtures module ([526a330](https://github.com/tracespace/tracespace/commit/526a330)) diff --git a/README.md b/README.md index 8bd134b9..820a4d8e 100644 --- a/README.md +++ b/README.md @@ -2,42 +2,86 @@

tracespace

Printed circuit board visualization tools for JavaScript

- +

+

+ https://tracespace.io +

## Work in progress -**Welcome to the development branch for tracespace v5!** This version of tracespace is still in early development. Documentation may not be accurate, and package APIs may change without warning. - -### To do - -- [x] Use TypeScript -- `@tracespace/parser` package to generate [unist][] abstract syntax trees - - [x] Parses Gerber files - - [x] Parses drill files - - [x] Synchronous by default but streaming compatible - - [x] Fully covered by tests - - [x] In-code documentation -- `@tracespace/plotter` package to take a board's collection of Gerber ASTs and generate image description trees - - [ ] Can plot any Gerber file - - [ ] Can plot any drill file - - [ ] Infers coordinate format settings using the full context of all layers - - [ ] Infers board outline - - [ ] Fully covered by tests - - [ ] In-code documentation -- `@tracespace/renderer` package to output [hast][] ASTs of the SVG translation of the image trees - - [ ] Renders individual layer views - - [ ] Renders board views - - [ ] Covered by tests - - [ ] In-code documentation -- [ ] tracespace CLI powered by new libraries -- [ ] tracespace view powered by new libraries -- [ ] documentation website - +**Welcome to tracespace v5!** This version of tracespace is still in development, so documentation may not be accurate and package APIs may change without warning. + +See the [main branch][] for the current v4 release. + +[main branch]: https://github.com/tracespace/tracespace/tree/main + +## Packages + +| package | | description | +| --------------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------- | +| [![cli version][]][cli npm] | [@tracespace/cli][] | Use Gerber/drill files to create an SVG render of a finished PCB from the command line. | +| [![core version][]][core npm] | [@tracespace/core][] | Use Gerber/drill files to create an SVG render of a finished PCB in Node.js or the browser. | +| [![fixtures version][]][fixtures npm] | [@tracespace/fixtures][] | Sample Gerber/drill files for use as test fixtures. | +| [![identify-layers version][]][identify-layers npm] | [@tracespace/identify-layers][] | Try to guess Gerber files' layer types based on filenames. | +| [![parser version][]][parser npm] | [@tracespace/parser][] | Parse Gerber/drill files into abstract syntax trees. | +| [![plotter version][]][plotter npm] | [@tracespace/plotter][] | Plot @tracespace/parser ASTs into image trees. | +| [![renderer version][]][renderer npm] | [@tracespace/renderer][] | Render @tracespace/plotter image trees as SVGs | +| [![xml-id version][]][xml-id npm] | [@tracespace/xml-id][] | XML element ID generation and sanitation utilities. | + +[@tracespace/cli]: ./packages/cli +[@tracespace/core]: ./packages/parser +[@tracespace/fixtures]: ./packages/fixtures +[@tracespace/identify-layers]: ./packages/identify-layers +[@tracespace/parser]: ./packages/parser +[@tracespace/plotter]: ./packages/plotter +[@tracespace/renderer]: ./packages/renderer +[@tracespace/xml-id]: ./packages/xml-id +[cli npm]: https://www.npmjs.com/package/@tracespace/cli/v/next +[core npm]: https://www.npmjs.com/package/@tracespace/core/v/next +[fixtures npm]: https://www.npmjs.com/package/@tracespace/fixtures/v/next +[identify-layers npm]: https://www.npmjs.com/package/@tracespace/identify-layers/v/next +[parser npm]: https://www.npmjs.com/package/@tracespace/parser/v/next +[plotter npm]: https://www.npmjs.com/package/@tracespace/plotter/v/next +[renderer npm]: https://www.npmjs.com/package/@tracespace/renderer/v/next +[xml-id npm]: https://www.npmjs.com/package/@tracespace/xml-id/v/next +[cli version]: https://img.shields.io/npm/v/@tracespace/cli/next?style=flat-square +[core version]: https://img.shields.io/npm/v/@tracespace/core/next?style=flat-square +[fixtures version]: https://img.shields.io/npm/v/@tracespace/fixtures/next?style=flat-square +[identify-layers version]: https://img.shields.io/npm/v/@tracespace/identify-layers/next?style=flat-square +[parser version]: https://img.shields.io/npm/v/@tracespace/parser/next?style=flat-square +[plotter version]: https://img.shields.io/npm/v/@tracespace/plotter/next?style=flat-square +[renderer version]: https://img.shields.io/npm/v/@tracespace/renderer/next?style=flat-square +[xml-id version]: https://img.shields.io/npm/v/@tracespace/xml-id/next?style=flat-square + +## Roadmap + +[I][] work on tracespace in my free time, so this roadmap should be taken with several grains of salt. While the new version is in development, pre-production versions of libraries will be periodically released under the `next` tag in npm. + +- [x] New build tools based on [vite][] and [TypeScript][] +- [x] Create [@tracespace/parser][] package to generate [unist][] abstract syntax trees + - Replaces gerber-parser from tracespace v4 +- [x] Create [@tracespace/plotter][] package convert ASTs to image trees + - Replaces gerber-plotter from tracespace v4 +- [x] Create [@tracespace/renderer][] package convert image trees to [hast][] SVG trees + - Replaces gerber-to-svg from tracespace v4 +- [x] Rename whats-that-gerber to [@tracespace/identify-layers][] +- [x] Create [@tracespace/core][] package to hold the core render pipeline + - Replaces pcb-stackup and pcb-stackup-core from tracespace v4 +- [x] Rewrite [@tracespace/cli] to use new render pipeline +- [ ] Rewrite to use new render pipeline +- [ ] Build documentation website for tracespace libraries +- [ ] Ensure all important Gerber / drill features are supported +- [ ] Release tracespace v5 + +[i]: https://github.com/mcous +[vite]: https://vitejs.dev/ + +[Typescript]: [unist]: https://unifiedjs.com/ [hast]: https://github.com/syntax-tree/hast @@ -45,15 +89,17 @@ The v5 release will attempt to fix / address the following open issues: -- [ ] Handle disagreements between filename type vs parsed type ([#49][]) -- [ ] Reduce number of `` tags in SVG output ([#80][]) -- [ ] Arc plotting should be more lenient ([#82][]) -- [ ] Operation with non-existent tool should no-op with a warning ([#83][]) +- [x] Handle disagreements between filename type vs parsed type ([#49][]) +- [x] Reduce number of `` tags in SVG output ([#80][]) +- [x] Arc plotting should be more lenient ([#82][]) +- [x] Operation with non-existent tool should no-op with a warning ([#83][]) - [x] Fails to detect units if format spec combined with units spec ([#234][]) -- [ ] clipPath for outline breaks in Firefox if outline has clear layers ([#302][]) +- [x] clipPath for outline breaks in Firefox if outline has clear layers ([#302][]) - [x] gerberParser.parseSync clobbers filetype option ([#306][]) - [x] Gerber file starting with newline incorrectly identified as drill file ([#307][]) -- [ ] Generate consistent document size for all layers. ([#324][]) +- [x] Generate consistent document size for all layers. ([#324][]) +- [x] G93 code in drill file rendered as drilled hole ([#353][]) +- [x] Allow soldermask layer to cover vias in board render ([#399][]) [#49]: https://github.com/tracespace/tracespace/issues/49 [#80]: https://github.com/tracespace/tracespace/issues/80 @@ -64,59 +110,8 @@ The v5 release will attempt to fix / address the following open issues: [#306]: https://github.com/tracespace/tracespace/issues/306 [#307]: https://github.com/tracespace/tracespace/issues/307 [#324]: https://github.com/tracespace/tracespace/issues/324 - -## Examples - -Renders of the [Arduino Uno][arduino] produced by tracespace: - -![arduino uno top][top] -![arduino uno bottom][bottom] - -Arduino Uno design files used under the terms of the [Creative Commons Attribution Share-Alike license][arduino-osh]. - -
- Individual layers -

top copper

- - -

drill hits

- - -

outline

- - -

top silkscreen

- - -

bottom copper

- - -

top soldermask

- - -

bottom soldermask

- -
- -[arduino]: https://www.arduino.cc/ -[arduino-osh]: https://www.arduino.cc/en/Main/FAQ -[top]: https://unpkg.com/pcb-stackup@latest/example/arduino-uno-top.svg -[bottom]: https://unpkg.com/pcb-stackup@latest/example/arduino-uno-bottom.svg +[#353]: https://github.com/tracespace/tracespace/issues/353 +[#399]: https://github.com/tracespace/tracespace/issues/399 ## tracespace in the wild diff --git a/packages/cli/package.json b/packages/cli/package.json index f017245b..c9e63240 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "5.0.0-next.0", + "version": "5.0.0-alpha.0", "description": "Use Gerber/drill files to render a PCB to SVG from the command line.", "bin": { "tracespace": "./bin/cli.js" diff --git a/packages/core/package.json b/packages/core/package.json index 45ecd61c..f0afb45f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,7 +3,7 @@ "publishConfig": { "access": "public" }, - "version": "5.0.0-next.0", + "version": "5.0.0-alpha.0", "description": "Use Gerber/drill files to create an SVG render of a finished PCB in Node.js or the browser.", "types": "./lib/index.d.ts", "exports": { diff --git a/packages/fixtures/CHANGELOG.md b/packages/fixtures/CHANGELOG.md deleted file mode 100644 index ceca4faf..00000000 --- a/packages/fixtures/CHANGELOG.md +++ /dev/null @@ -1,224 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.0.0-next.0](https://github.com/tracespace/tracespace/compare/v4.2.0...v5.0.0-next.0) (2020-06-28) - - -### Features - -* **parser:** add @tracespace/parser package ([#338](https://github.com/tracespace/tracespace/issues/338)) ([6f974dd](https://github.com/tracespace/tracespace/commit/6f974dd)) - - - - - -# [4.2.0](https://github.com/tracespace/tracespace/compare/v4.1.1...v4.2.0) (2019-10-10) - - -### Bug Fixes - -* **deps:** Upgrade all dependencies ([7f3c6f4](https://github.com/tracespace/tracespace/commit/7f3c6f4)) - - - - - -## [4.1.1](https://github.com/tracespace/tracespace/compare/v4.1.0...v4.1.1) (2019-06-05) - - -### Bug Fixes - -* **deps:** update dependency glob to ^7.1.4 ([#250](https://github.com/tracespace/tracespace/issues/250)) ([8f6c5dc](https://github.com/tracespace/tracespace/commit/8f6c5dc)) -* **whats-that-gerber:** Support for PCB:NG Eagle, .gbx, .art files ([#268](https://github.com/tracespace/tracespace/issues/268)) ([1449cba](https://github.com/tracespace/tracespace/commit/1449cba)), closes [#246](https://github.com/tracespace/tracespace/issues/246) [#248](https://github.com/tracespace/tracespace/issues/248) - - - - - -## [4.0.2](https://github.com/tracespace/tracespace/compare/v4.0.1...v4.0.2) (2019-03-24) - - -### Bug Fixes - -* **whats-that-gerber:** Add Orcad matchers for .drd and .npt ([#189](https://github.com/tracespace/tracespace/issues/189)) ([2894208](https://github.com/tracespace/tracespace/commit/2894208)) - - - - - -## [4.0.1](https://github.com/tracespace/tracespace/compare/v4.0.0...v4.0.1) (2019-03-23) - - -### Bug Fixes - -* **deps:** update dependency glob to ^7.1.3 ([#162](https://github.com/tracespace/tracespace/issues/162)) ([e20498c](https://github.com/tracespace/tracespace/commit/e20498c)) -* **deps:** update dependency run-parallel to ^1.1.9 ([#166](https://github.com/tracespace/tracespace/issues/166)) ([a175306](https://github.com/tracespace/tracespace/commit/a175306)) -* **deps:** update dependency run-series to ^1.1.8 ([#170](https://github.com/tracespace/tracespace/issues/170)) ([d5b0082](https://github.com/tracespace/tracespace/commit/d5b0082)) -* **deps:** update dependency run-waterfall to ^1.1.6 ([#172](https://github.com/tracespace/tracespace/issues/172)) ([9e72361](https://github.com/tracespace/tracespace/commit/9e72361)) -* **whats-that-gerber:** Recognize DipTrace inner copper layers ([#171](https://github.com/tracespace/tracespace/issues/171)) ([100a95b](https://github.com/tracespace/tracespace/commit/100a95b)), closes [#138](https://github.com/tracespace/tracespace/issues/138) - - - - - -# [4.0.0](https://github.com/tracespace/tracespace/compare/v4.0.0-next.19...v4.0.0) (2019-03-09) - -**Note:** Version bump only for package @tracespace/fixtures - - - - - -# [4.0.0-next.19](https://github.com/tracespace/tracespace/compare/v4.0.0-next.18...v4.0.0-next.19) (2019-03-09) - - -### Performance Improvements - -* Align and simplify parameters, defaults, and return values ([#102](https://github.com/tracespace/tracespace/issues/102)) ([c4e3a84](https://github.com/tracespace/tracespace/commit/c4e3a84)), closes [#99](https://github.com/tracespace/tracespace/issues/99) - - -### BREAKING CHANGES - -* Parameters, defaults, and return types have changed in pcb-stackup, -pcb-stackup-core, and gerber-to-svg - - - - - -# [4.0.0-next.18](https://github.com/tracespace/tracespace/compare/v4.0.0-next.17...v4.0.0-next.18) (2019-01-26) - - -### Bug Fixes - -* **fixtures:** Replace macro multi-exposure expected render ([#101](https://github.com/tracespace/tracespace/issues/101)) ([a821588](https://github.com/tracespace/tracespace/commit/a821588)) - - - - - -# [4.0.0-next.15](https://github.com/tracespace/tracespace/compare/v4.0.0-next.14...v4.0.0-next.15) (2018-11-13) - - -### Features - -* **whats-that-gerber:** Use collection of filenames to determine type ([#77](https://github.com/tracespace/tracespace/issues/77)) ([6919549](https://github.com/tracespace/tracespace/commit/6919549)) - - -### BREAKING CHANGES - -* **whats-that-gerber:** Output of whats-that-gerber changed from a single string to an -object keyed by the filenames passed in as an array - - - - - - -# [4.0.0-next.13](https://github.com/tracespace/tracespace/compare/v4.0.0-next.12...v4.0.0-next.13) (2018-09-12) - - -### Bug Fixes - -* Replace shortid with [@tracespace](https://github.com/tracespace)/xml-id and sanitize IDs ([#79](https://github.com/tracespace/tracespace/issues/79)) ([2cda760](https://github.com/tracespace/tracespace/commit/2cda760)), closes [#78](https://github.com/tracespace/tracespace/issues/78) - - - - - - -# [4.0.0-next.12](https://github.com/tracespace/tracespace/compare/v4.0.0-next.11...v4.0.0-next.12) (2018-07-17) - - -### Features - -* **whats-that-gerber:** Add support for eagle 9+ filenames ([#76](https://github.com/tracespace/tracespace/issues/76)) ([3b8f570](https://github.com/tracespace/tracespace/commit/3b8f570)) - - - - - - -# [4.0.0-next.11](https://github.com/tracespace/tracespace/compare/v4.0.0-next.10...v4.0.0-next.11) (2018-07-02) - - -### Bug Fixes - -* **whats-that-gerber:** Improve Altium mech layer recognition ([#70](https://github.com/tracespace/tracespace/issues/70)) ([e48d03f](https://github.com/tracespace/tracespace/commit/e48d03f)), closes [#69](https://github.com/tracespace/tracespace/issues/69) - - - - - - -# [4.0.0-next.10](https://github.com/tracespace/tracespace/compare/v4.0.0-next.9...v4.0.0-next.10) (2018-06-27) - - -### Features - -* **whats-that-gerber:** Match Altium internal planes as icu layer ([#68](https://github.com/tracespace/tracespace/issues/68)) ([f0155e2](https://github.com/tracespace/tracespace/commit/f0155e2)), closes [#67](https://github.com/tracespace/tracespace/issues/67) - - - - - - -# [4.0.0-next.9](https://github.com/tracespace/tracespace/compare/v4.0.0-next.8...v4.0.0-next.9) (2018-06-19) - - -### Features - -* **fixtures:** Add usbvil and bus-pirate boards ([#65](https://github.com/tracespace/tracespace/issues/65)) ([394e130](https://github.com/tracespace/tracespace/commit/394e130)) - - - - - - -# [4.0.0-next.7](https://github.com/tracespace/tracespace/compare/v4.0.0-next.6...v4.0.0-next.7) (2018-06-16) - -**Note:** Version bump only for package @tracespace/fixtures - - - - - - -# [4.0.0-next.5](https://github.com/tracespace/tracespace/compare/v4.0.0-next.4...v4.0.0-next.5) (2018-06-15) - -**Note:** Version bump only for package @tracespace/fixtures - - - - - - -# [4.0.0-next.4](https://github.com/tracespace/tracespace/compare/v4.0.0-next.3...v4.0.0-next.4) (2018-04-27) - - -### Features - -* **fixtures:** Move common render server into fixtures module ([523f681](https://github.com/tracespace/tracespace/commit/523f681)) - - - - - - -# [4.0.0-next.2](https://github.com/tracespace/tracespace/compare/v4.0.0-next.1...v4.0.0-next.2) (2018-04-17) - -**Note:** Version bump only for package @tracespace/fixtures - - - - - - -# [4.0.0-next.1](https://github.com/tracespace/tracespace/compare/4.0.0-next.0...4.0.0-next.1) (2018-04-17) - - -### Features - -* **fixtures:** Add [@tracespace](https://github.com/tracespace)/fixtures module ([526a330](https://github.com/tracespace/tracespace/commit/526a330)) diff --git a/packages/fixtures/README.md b/packages/fixtures/README.md index e26dda99..f6977049 100644 --- a/packages/fixtures/README.md +++ b/packages/fixtures/README.md @@ -1,45 +1,31 @@ # tracespace fixtures -[![latest][@tracespace/fixtures-latest-badge]][npm] -[![next][@tracespace/fixtures-next-badge]][npm-next] -[![david][@tracespace/fixtures-david-badge]][david] +[![npm][npm badge]][npm package] -> Test fixtures for tracespace projects +Sample Gerber/drill files for use as test fixtures. Part of the [tracespace][] collection of PCB visualization tools. This module is a collection of data, including real-world open-source Gerber and drill files, used to drive tests on tracespace projects. It's published to npm so that any tool can use this data. -Part of the [tracespace][] collection of PCB visualization tools. - [tracespace]: https://github.com/tracespace/tracespace -[npm]: https://www.npmjs.com/package/@tracespace/fixtures -[npm-next]: https://www.npmjs.com/package/@tracespace/fixtures/v/next -[david]: https://david-dm.org/tracespace/tracespace?path=packages/fixtures -[@tracespace/fixtures-latest-badge]: https://flat.badgen.net/npm/v/@tracespace/fixtures -[@tracespace/fixtures-next-badge]: https://flat.badgen.net/npm/v/@tracespace/fixtures/next -[@tracespace/fixtures-david-badge]: https://flat.badgen.net/david/dep/tracespace/tracespace/packages/fixtures +[npm package]: https://www.npmjs.com/package/@tracespace/core/v/next +[npm badge]: https://img.shields.io/npm/v/@tracespace/core/next?style=flat-square ## install -Please note: because this package is a collection of test fixtures, it may not follow semver and changes could be introduced in _any_ version bump that cause your tests to fail. **You should install an exact version.** +Because this package is a collection of test fixtures, it may not follow semver and changes could be introduced in _any_ version bump that cause your tests to fail. **You should install an exact version.** ```shell -npm install --save-dev --save-exact @tracespace/fixtures +npm install --save-dev --save-exact @tracespace/fixtures@next ``` ## usage -```js -const fixtures = require('@tracespace/fixtures') -``` - ### gerber filenames `gerber-filenames.json` is a JSON file with a collection of example Gerber / drill filenames along with what PCB layer type they represent organized by CAD package. This fixture is primarily used to test `@tracespace/identify-layers`. ```js -const {gerberFilenames} = require('@tracespace/fixtures') -// or -const gerberFilenames = require('@tracespace/fixtures/gerber-filenames.json') +import gerberFilenames from '@tracespace/fixtures/gerber-filenames.json' ``` Where `gerberFilenames` looks like: @@ -58,141 +44,10 @@ Array<{ }> ``` -For non-npm projects, this file is also available via [the unpkg CDN][unpkg]: +For non-npm projects, this file is also available via the [unpkg][] CDN: ```shell -curl https://unpkg.com/@tracespace/fixtures@${version}/gerber-filenames.json +curl https://unpkg.com/@tracespace/fixtures@next/gerber-filenames.json ``` [unpkg]: https://unpkg.com - -### example boards - -`@tracespace/fixtures` has a collection of sample open-source PCB files to test rendering full circuit boards. This fixture is primarily used to test `pcb-stackup` and `pcb-stackup-core`. - -```js -const {getBoards} = require('@tracespace/fixtures') - -// async -getBoards((error, boards) => { - if (error) return console.error(error) - console.log(boards) -}) - -// sync -const boards = getBoards.sync() -``` - -Where `boards` looks like: - -```js -Array<{ - /** name of the board */ - name: string, - /** path to the board's manifest */ - filepath: string, - /** array of individual board layers */ - layers: Array<{ - /** name of the layer */ - name: string, - /** path to the layer's gerber / drill file */ - filepath: string, - /** basename of filepath */ - filename: string, - /** format of the file */ - format: 'gerber' | 'drill', - /** @tracespace/identify-layers type of the layer */ - type: string, - /** file contents (i.e. results of fs.readFile on filepath) */ - source: string - }> -}> -``` - -### gerber specs - -`@tracespace/fixtures` has a collection of simple Gerber and NC drill files to ensure proper rendering of different image primitives and structures. This fixture is primarily used to test `gerber-to-svg`. - -```js -const {getGerberSpecs} = require('@tracespace/fixtures') - -// async -getGerberSpecs((error, suites) => { - if (error) return console.error(error) - console.log(suites) -}) - -// sync -const suites = getGerberSpecs.sync() -``` - -Where `suites` looks like: - -```js -Array<{ - /** name of the suite */ - name: string, - /** array of individual specs in the suite */ - specs: Array<{ - /** name of the spec */ - name: string, - /** category of the spec (matches suite's name) */ - category: string, - /** path to the spec's gerber / drill file */ - filepath: string, - /** file contents (i.e. results of fs.readFile on filepath) */ - source: string, - /** SVG string of the expected render */ - expected: string - }> -}> -``` - -### render suite server - -Simple server to display the results of a render test. Has a peer dependency on Express, which you must install yourself before usage: - -```shell -npm install --save-dev @tracespace/fixtures express -``` - -Usage: - -```js -const {server, getGerberSpecs} = require('@tracespace/fixtures') - -const app = server('suite name', getGerberSpecs, getSuiteResults) - -app.listen(9000, () => console.log('listening on http://localhost:9000')) - -function getSuiteResults(suite, done) { - // get results of a single suite somehow and pass them to done - done(null, suiteResults) -} -``` - -`server` is a function that takes: - -1. `name` - A string name of the server -2. `getSuites` - One of `getGerberSpecs` or `getBoards` -3. `getSuiteResults` - An asynchronous function to render the results of one of the suites from `getSuites` - -`getSuiteResults` should call its `done` callback with: - -```js -{ - /** name of the suite */ - name: string, - /** array of spec results in the suite */ - specs: Array<{ - /** name of the spec */ - name: string, - /** spec render to display (SVG) */ - render: string, - /** optional comparison render (SVG) */ - expected?: string, - /** optional test source to display */ - source?: string, - }> -} -``` diff --git a/packages/fixtures/package.json b/packages/fixtures/package.json index 76af4731..370100bc 100644 --- a/packages/fixtures/package.json +++ b/packages/fixtures/package.json @@ -4,8 +4,13 @@ "publishConfig": { "access": "public" }, - "version": "5.0.0-next.0", - "description": "Test fixtures for tracespace projects", + "version": "5.0.0-alpha.0", + "description": "Sample Gerber/drill files for use as test fixtures.", + "exports": { + "./gerber-filenames.json": "./gerber-filenames.json" + }, + "type": "module", + "sideEffects": false, "repository": { "type": "git", "url": "git+https://github.com/tracespace/tracespace.git" diff --git a/packages/identify-layers/CHANGELOG.md b/packages/identify-layers/CHANGELOG.md deleted file mode 100644 index a9584025..00000000 --- a/packages/identify-layers/CHANGELOG.md +++ /dev/null @@ -1,178 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.0.0-next.0](https://github.com/tracespace/tracespace/compare/v4.2.0...v5.0.0-next.0) (2020-06-28) - - -### Code Refactoring - -* **whats-that-gerber:** convert WTG to TypeScript ([45056c4](https://github.com/tracespace/tracespace/commit/45056c4)) -* **xml-id:** port xml-id to TypeScript ([ff4bbb1](https://github.com/tracespace/tracespace/commit/ff4bbb1)) - - -### Features - -* **parser:** add @tracespace/parser package ([#338](https://github.com/tracespace/tracespace/issues/338)) ([6f974dd](https://github.com/tracespace/tracespace/commit/6f974dd)) - - -### BREAKING CHANGES - -* **xml-id:** Export scheme of xml-id slightly changed -* **whats-that-gerber:** Switched WTG to named exports only - - - - - -# [4.2.0](https://github.com/tracespace/tracespace/compare/v4.1.1...v4.2.0) (2019-10-10) - - -### Bug Fixes - -* **deps:** Upgrade all dependencies ([7f3c6f4](https://github.com/tracespace/tracespace/commit/7f3c6f4)) - - - - - -## [4.1.1](https://github.com/tracespace/tracespace/compare/v4.1.0...v4.1.1) (2019-06-05) - - -### Bug Fixes - -* **whats-that-gerber:** Support for PCB:NG Eagle, .gbx, .art files ([#268](https://github.com/tracespace/tracespace/issues/268)) ([1449cba](https://github.com/tracespace/tracespace/commit/1449cba)), closes [#246](https://github.com/tracespace/tracespace/issues/246) [#248](https://github.com/tracespace/tracespace/issues/248) - - - - - -## [4.0.2](https://github.com/tracespace/tracespace/compare/v4.0.1...v4.0.2) (2019-03-24) - - -### Bug Fixes - -* **whats-that-gerber:** Add Orcad matchers for .drd and .npt ([#189](https://github.com/tracespace/tracespace/issues/189)) ([2894208](https://github.com/tracespace/tracespace/commit/2894208)) - - - - - -## [4.0.1](https://github.com/tracespace/tracespace/compare/v4.0.0...v4.0.1) (2019-03-23) - - -### Bug Fixes - -* **whats-that-gerber:** Recognize DipTrace inner copper layers ([#171](https://github.com/tracespace/tracespace/issues/171)) ([100a95b](https://github.com/tracespace/tracespace/commit/100a95b)), closes [#138](https://github.com/tracespace/tracespace/issues/138) - - - - - -# [4.0.0](https://github.com/tracespace/tracespace/compare/v4.0.0-next.19...v4.0.0) (2019-03-09) - -**Note:** Version bump only for package whats-that-gerber - - - - - -# [4.0.0-next.19](https://github.com/tracespace/tracespace/compare/v4.0.0-next.18...v4.0.0-next.19) (2019-03-09) - - -### Features - -* Add typescript definitions to all consumable modules ([#103](https://github.com/tracespace/tracespace/issues/103)) ([bb6e8f9](https://github.com/tracespace/tracespace/commit/bb6e8f9)) - - - - - -# [4.0.0-next.15](https://github.com/tracespace/tracespace/compare/v4.0.0-next.14...v4.0.0-next.15) (2018-11-13) - - -### Features - -* **whats-that-gerber:** Use collection of filenames to determine type ([#77](https://github.com/tracespace/tracespace/issues/77)) ([6919549](https://github.com/tracespace/tracespace/commit/6919549)) - - -### BREAKING CHANGES - -* **whats-that-gerber:** Output of whats-that-gerber changed from a single string to an -object keyed by the filenames passed in as an array - - - - - - -# [4.0.0-next.13](https://github.com/tracespace/tracespace/compare/v4.0.0-next.12...v4.0.0-next.13) (2018-09-12) - - -### Features - -* **whats-that-gerber:** Add support for diptrace filenames ([f3d5d9a](https://github.com/tracespace/tracespace/commit/f3d5d9a)) - - - - - - -# [4.0.0-next.12](https://github.com/tracespace/tracespace/compare/v4.0.0-next.11...v4.0.0-next.12) (2018-07-17) - - -### Features - -* **whats-that-gerber:** Add support for eagle 9+ filenames ([#76](https://github.com/tracespace/tracespace/issues/76)) ([3b8f570](https://github.com/tracespace/tracespace/commit/3b8f570)) - - - - - - -# [4.0.0-next.11](https://github.com/tracespace/tracespace/compare/v4.0.0-next.10...v4.0.0-next.11) (2018-07-02) - - -### Bug Fixes - -* **whats-that-gerber:** Improve Altium mech layer recognition ([#70](https://github.com/tracespace/tracespace/issues/70)) ([e48d03f](https://github.com/tracespace/tracespace/commit/e48d03f)), closes [#69](https://github.com/tracespace/tracespace/issues/69) - - - - - - -# [4.0.0-next.10](https://github.com/tracespace/tracespace/compare/v4.0.0-next.9...v4.0.0-next.10) (2018-06-27) - - -### Features - -* **whats-that-gerber:** Match Altium internal planes as icu layer ([#68](https://github.com/tracespace/tracespace/issues/68)) ([f0155e2](https://github.com/tracespace/tracespace/commit/f0155e2)), closes [#67](https://github.com/tracespace/tracespace/issues/67) - - - - - - -# [4.0.0-next.9](https://github.com/tracespace/tracespace/compare/v4.0.0-next.8...v4.0.0-next.9) (2018-06-19) - -**Note:** Version bump only for package whats-that-gerber - - - - - - -# [4.0.0-next.4](https://github.com/tracespace/tracespace/compare/v4.0.0-next.3...v4.0.0-next.4) (2018-04-27) - -**Note:** Version bump only for package whats-that-gerber - - - - - - -# [4.0.0-next.3](https://github.com/tracespace/tracespace/compare/v4.0.0-next.2...v4.0.0-next.3) (2018-04-18) - -**Note:** Version bump only for package whats-that-gerber diff --git a/packages/identify-layers/README.md b/packages/identify-layers/README.md index fb781be2..67ab5a6e 100644 --- a/packages/identify-layers/README.md +++ b/packages/identify-layers/README.md @@ -1,37 +1,26 @@ # @tracespace/identify-layers -Have you got a bunch of Gerber files lying around without any idea what they're for? We've all been there. `@tracespace/identify-layers` is here to help. +[![npm][npm badge]][npm package] -This module examines a set of Gerber and NC drill file names and tries to guess the layer type of each file from the filename. +Try to guess Gerber files' layer types based on filenames. Part of the [tracespace][] collection of PCB visualization tools. -Part of the [tracespace][] collection of PCB visualization tools. - -[tracespace]: https://github.com/tracespace/tracespace - -## install +This module is one part of the tracespace render pipeline, and you may not need to use it directly. See [@tracespace/core][] to integrate the full render pipeline into your project. ```shell npm install @tracespace/identify-layers ``` -Or, use a script tag: - -```html - - -``` +[tracespace]: https://github.com/tracespace/tracespace +[@tracespace/core]: ../core +[npm package]: https://www.npmjs.com/package/@tracespace/identify-layers/v/next +[npm badge]: https://img.shields.io/npm/v/@tracespace/identify-layers/next?style=flat-square ## usage Pass `identifyLayers` an array of filenames from a PCB, and it will give you back an object keyed by filename with the best guess it can make for the type and side of each file. If both `side` and `type` are `null`, the filename cannot be identified as a Gerber / drill file. ```js -const {identifyLayers} = require('@tracespace/identify-layers') -// ES Modules work, too -// import {identifyLayers} from '@tracespace/identify-layers' +import {identifyLayers} from '@tracespace/identify-layers' const filenames = ['my-board-F_Cu.gbr', 'my-board-B_Cu.gbr', 'foo.bar'] const typeByFilename = identifyLayers(filenames) @@ -57,9 +46,7 @@ There are 12 available layer types, were a type is an object of the format: You can get an array of all types with: ```js -const {getAllLayers} = require('@tracespace/identify-layers') -// ES Modules work, too -// import {getAllLayers} from '@tracespace/identify-layers' +import {getAllLayers} from '@tracespace/identify-layers' const allLayers = getAllLayers() ``` @@ -84,7 +71,7 @@ const allLayers = getAllLayers() Side and type constants are exported for your usage: ```js -const { +import { // layer types TYPE_COPPER, // 'copper' TYPE_SOLDERMASK, // 'soldermask' @@ -99,10 +86,7 @@ const { SIDE_BOTTOM, // 'bottom' SIDE_INNER, // 'inner' SIDE_ALL, // 'all' -} = require('@tracespace/identify-layers') - -// ES Modules work, too -// import {TYPE_COPPER} from '@tracespace/identify-layers' +} from '@tracespace/identify-layers' ``` #### checking if a layer type is valid @@ -110,9 +94,7 @@ const { You can check if any given string is a valid layer type with: ```js -const {validate} = require('@tracespace/identify-layers') -// ES Modules work, too -// import {validate} from '@tracespace/identify-layers' +import {validate} from '@tracespace/identify-layers' const type1 = {side: 'top', type: 'copper'} const type2 = {side: 'foo', type: 'silkscreen'} @@ -136,6 +118,6 @@ We should be able to identify files output by the following programs: ## contributing -Please read the [Contributing Section](../README.md#contributing) of the main README for development setup instructions. +Please read the [Contributing Guide](../CONTRIBUTING.md) for development setup instructions. If you're adding or modifying a filetype matcher, please remember to add or modify an example filename in [`@tracespace/fixtures/gerber-filenames.json`](../fixtures/gerber-filenames.json) to ensure your change is tested. diff --git a/packages/identify-layers/package.json b/packages/identify-layers/package.json index 60d638ad..1b30139d 100644 --- a/packages/identify-layers/package.json +++ b/packages/identify-layers/package.json @@ -3,8 +3,8 @@ "publishConfig": { "access": "public" }, - "version": "5.0.0-next.0", - "description": "Identify Gerber and drill files by filename", + "version": "5.0.0-alpha.0", + "description": "Try to guess Gerber files' layer types based on filenames.", "types": "./lib/index.d.ts", "exports": { "types": "./lib/index.d.ts", diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md deleted file mode 100644 index 7a36840b..00000000 --- a/packages/parser/CHANGELOG.md +++ /dev/null @@ -1,11 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.0.0-next.0](https://github.com/tracespace/tracespace/compare/v4.2.0...v5.0.0-next.0) (2020-06-28) - - -### Features - -* **parser:** add @tracespace/parser package ([#338](https://github.com/tracespace/tracespace/issues/338)) ([6f974dd](https://github.com/tracespace/tracespace/commit/6f974dd)) diff --git a/packages/parser/README.md b/packages/parser/README.md index 78539c00..080fff3e 100644 --- a/packages/parser/README.md +++ b/packages/parser/README.md @@ -1,38 +1,31 @@ # @tracespace/parser -A parser for printed circuit board manufacturing files. Compiles [Gerber][gerber] and [NC drill][nc-drill] files into abstract syntax trees based on the [unist][] format. +[![npm][npm badge]][npm package] -Part of the [tracespace][] collection of PCB visualization tools. +Parse [Gerber][]/[drill][] files into abstract syntax trees based on the [unist][] format. Part of the [tracespace][] collection of PCB visualization tools. -**This package is still in development and available as a prerelease.** +This module is one part of the tracespace render pipeline, and you may not need to use it directly. See [@tracespace/core][] to integrate the full render pipeline into your project. ```shell npm install @tracespace/parser@next ``` [gerber]: https://en.wikipedia.org/wiki/Gerber_format -[nc-drill]: https://en.wikipedia.org/wiki/PCB_NC_formats +[drill]: https://en.wikipedia.org/wiki/PCB_NC_formats [unist]: https://unifiedjs.com/ [tracespace]: https://github.com/tracespace/tracespace +[@tracespace/core]: ../core +[npm package]: https://www.npmjs.com/package/@tracespace/parser/v/next +[npm badge]: https://img.shields.io/npm/v/@tracespace/parser/next?style=flat-square ## usage ```js -import {createParser} from '@tracespace/parser' +import fs from 'node:fs/promises' +import {parse} from '@tracespace/parser' -const parser = createParser() -parser.feed(/* ...some gerber string... */) -const tree = parser.results() -``` - -### script tag - -If you're not using a bundler and you want to try out the parser in a browser, you can use a `script` tag: +const gerberContents = await fs.readFile('gerber.gbr', 'utf-8') +const syntaxTree = parse(gerberContents) -```html - - +await fs.writeFile('parse.json', JSON.stringify(syntaxTree, null, 2), 'utf-8') ``` diff --git a/packages/parser/package.json b/packages/parser/package.json index 2a457915..95c34cfe 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -3,8 +3,8 @@ "publishConfig": { "access": "public" }, - "version": "5.0.0-next.0", - "description": "Gerber and NC drill file parser", + "version": "5.0.0-alpha.0", + "description": "Parse Gerber/drill files into abstract syntax trees.", "types": "./lib/index.d.ts", "exports": { "types": "./lib/index.d.ts", diff --git a/packages/plotter/README.md b/packages/plotter/README.md index 894257de..ccb4567e 100644 --- a/packages/plotter/README.md +++ b/packages/plotter/README.md @@ -1,39 +1,31 @@ # @tracespace/plotter -An image plotter for [@tracespace/parser][] ASTs. +[![npm][npm badge]][npm package] -Part of the [tracespace][] collection of PCB visualization tools. +Plot [@tracespace/parser][] ASTs into image trees. Part of the [tracespace][] collection of PCB visualization tools. -**This package is still in development and is not yet published.** +This module is one part of the tracespace render pipeline, and you may not need to use it directly. See [@tracespace/core][] to integrate the full render pipeline into your project. ```shell npm install @tracespace/plotter@next ``` -[@tracespace/parser]: https://www.npmjs.com/package/@tracespace/parser [tracespace]: https://github.com/tracespace/tracespace +[@tracespace/parser]: ../parser +[@tracespace/core]: ../core +[npm package]: https://www.npmjs.com/package/@tracespace/plotter/v/next +[npm badge]: https://img.shields.io/npm/v/@tracespace/plotter/next?style=flat-square ## usage ```js -import {createParser} from '@tracespace/parser' +import fs from 'node:fs/promises' +import {parse} from '@tracespace/parser' import {plot} from '@tracespace/plotter' -const syntaxTree = createParser().feed(/* ...some gerber string... */).results() - +const gerberContents = await fs.readFile('gerber.gbr', 'utf-8') +const syntaxTree = parse(gerberContents) const imageTree = plot(syntaxTree) -``` - -### script tag - -If you're not using a bundler and you want to try out the parser in a browser, you can use a `script` tag: -```html - - - +await fs.writeFile('plot.json', JSON.stringify(imageTree, null, 2), 'utf-8') ``` diff --git a/packages/plotter/package.json b/packages/plotter/package.json index 035bd43a..390458a9 100644 --- a/packages/plotter/package.json +++ b/packages/plotter/package.json @@ -4,7 +4,7 @@ "access": "public" }, "version": "0.0.0-unreleased", - "description": "Build image trees from @tracespace/parser ASTs", + "description": "Plot @tracespace/parser ASTs into image trees.", "types": "./lib/index.d.ts", "exports": { "types": "./lib/index.d.ts", diff --git a/packages/renderer/README.md b/packages/renderer/README.md index 0978b204..ee21a57c 100644 --- a/packages/renderer/README.md +++ b/packages/renderer/README.md @@ -1,42 +1,35 @@ # @tracespace/renderer -An SVG renderer for [@tracespace/plotter][] images. +[![npm][npm badge]][npm package] -Part of the [tracespace][] collection of PCB visualization tools. +Render [@tracespace/plotter][] image trees as SVGs. Part of the [tracespace][] collection of PCB visualization tools. -**This package is still in development and is not yet published.** +This module is one part of the tracespace render pipeline, and you may not need to use it directly. See [@tracespace/core][] to integrate the full render pipeline into your project. ```shell npm install @tracespace/renderer@next ``` -[@tracespace/plotter]: https://www.npmjs.com/package/@tracespace/plotter [tracespace]: https://github.com/tracespace/tracespace +[@tracespace/plotter]: ../plotter +[@tracespace/core]: ../core +[npm package]: https://www.npmjs.com/package/@tracespace/renderer/v/next +[npm badge]: https://img.shields.io/npm/v/@tracespace/renderer/next?style=flat-square ## usage ```js -import {createParser} from '@tracespace/parser' +import fs from 'node:fs/promises' +import {toHtml} from 'hast-util-to-html' + +import {parse} from '@tracespace/parser' import {plot} from '@tracespace/plotter' import {render} from '@tracespace/renderer' -const syntaxTree = createParser().feed(/* ...some gerber string... */).results() +const gerberContents = await fs.readFile('gerber.gbr', 'utf-8') +const syntaxTree = parse(gerberContents) const imageTree = plot(syntaxTree) const image = render(imageTree) -``` - -### script tag - -If you're not using a bundler and you want to try out the parser in a browser, you can use a `script` tag: -```html - - - - +await fs.writeFile('render.svg', toHtml(image), 'utf-8) ``` diff --git a/packages/renderer/package.json b/packages/renderer/package.json index 1d415d6a..ca1a5cf7 100644 --- a/packages/renderer/package.json +++ b/packages/renderer/package.json @@ -3,8 +3,8 @@ "publishConfig": { "access": "public" }, - "version": "0.0.0-unreleased", - "description": "Render @tracespace/plotter image trees as SVGs", + "version": "5.0.0-alpha.0", + "description": "Render @tracespace/plotter image trees as SVGs.", "types": "./lib/index.d.ts", "exports": { "types": "./lib/index.d.ts", diff --git a/packages/xml-id/CHANGELOG.md b/packages/xml-id/CHANGELOG.md deleted file mode 100644 index 121ffb4a..00000000 --- a/packages/xml-id/CHANGELOG.md +++ /dev/null @@ -1,92 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [5.0.0-next.0](https://github.com/tracespace/tracespace/compare/v4.2.0...v5.0.0-next.0) (2020-06-28) - - -### Code Refactoring - -* **xml-id:** port xml-id to TypeScript ([ff4bbb1](https://github.com/tracespace/tracespace/commit/ff4bbb1)) - - -### Features - -* **parser:** add @tracespace/parser package ([#338](https://github.com/tracespace/tracespace/issues/338)) ([6f974dd](https://github.com/tracespace/tracespace/commit/6f974dd)) - - -### BREAKING CHANGES - -* **xml-id:** Export scheme of xml-id slightly changed - - - - - -# [4.0.0](https://github.com/tracespace/tracespace/compare/v4.0.0-next.19...v4.0.0) (2019-03-09) - -**Note:** Version bump only for package @tracespace/xml-id - - - - - -# [4.0.0-next.19](https://github.com/tracespace/tracespace/compare/v4.0.0-next.18...v4.0.0-next.19) (2019-03-09) - - -### Features - -* Add typescript definitions to all consumable modules ([#103](https://github.com/tracespace/tracespace/issues/103)) ([bb6e8f9](https://github.com/tracespace/tracespace/commit/bb6e8f9)) - - -### Performance Improvements - -* Align and simplify parameters, defaults, and return values ([#102](https://github.com/tracespace/tracespace/issues/102)) ([c4e3a84](https://github.com/tracespace/tracespace/commit/c4e3a84)), closes [#99](https://github.com/tracespace/tracespace/issues/99) - - -### BREAKING CHANGES - -* Parameters, defaults, and return types have changed in pcb-stackup, -pcb-stackup-core, and gerber-to-svg - - - - - -# [4.0.0-next.15](https://github.com/tracespace/tracespace/compare/v4.0.0-next.14...v4.0.0-next.15) (2018-11-13) - - -### Features - -* **whats-that-gerber:** Use collection of filenames to determine type ([#77](https://github.com/tracespace/tracespace/issues/77)) ([6919549](https://github.com/tracespace/tracespace/commit/6919549)) - - -### BREAKING CHANGES - -* **whats-that-gerber:** Output of whats-that-gerber changed from a single string to an -object keyed by the filenames passed in as an array - - - - - - -# [4.0.0-next.14](https://github.com/tracespace/tracespace/compare/v4.0.0-next.13...v4.0.0-next.14) (2018-10-13) - - -### Bug Fixes - -* **xml-id:** Restrict characters to those valid in CSS selectors ([#88](https://github.com/tracespace/tracespace/issues/88)) ([1fe779e](https://github.com/tracespace/tracespace/commit/1fe779e)), closes [#78](https://github.com/tracespace/tracespace/issues/78) - - - - - - -# [4.0.0-next.13](https://github.com/tracespace/tracespace/compare/v4.0.0-next.12...v4.0.0-next.13) (2018-09-12) - - -### Bug Fixes - -* Replace shortid with [@tracespace](https://github.com/tracespace)/xml-id and sanitize IDs ([#79](https://github.com/tracespace/tracespace/issues/79)) ([2cda760](https://github.com/tracespace/tracespace/commit/2cda760)), closes [#78](https://github.com/tracespace/tracespace/issues/78) diff --git a/packages/xml-id/README.md b/packages/xml-id/README.md index a655e99f..38fa6d31 100644 --- a/packages/xml-id/README.md +++ b/packages/xml-id/README.md @@ -1,52 +1,50 @@ # xml id -[![latest][@tracespace/xml-id-latest-badge]][npm] -[![next][@tracespace/xml-id-next-badge]][npm-next] -[![david][@tracespace/xml-id-david-badge]][david] +[![npm][npm badge]][npm package] -> XML ID generation and sanitation utilities for tracespace projects +XML element ID generation and sanitation utilities. Part of the [tracespace][] collection of PCB visualization tools. -ID attributes in XML documents (e.g. SVG images) have certain requirements. This module provides utility methods for sanitizing and generating strings to meet those requirements so they can safely be used as XML IDs. - -Part of the [tracespace][] collection of PCB visualization tools. - -[tracespace]: https://github.com/tracespace/tracespace -[npm]: https://www.npmjs.com/package/@tracespace/xml-id -[npm-next]: https://www.npmjs.com/package/@tracespace/xml-id/v/next -[david]: https://david-dm.org/tracespace/tracespace?path=packages/xml-id -[@tracespace/xml-id-latest-badge]: https://flat.badgen.net/npm/v/@tracespace/xml-id -[@tracespace/xml-id-next-badge]: https://flat.badgen.net/npm/v/@tracespace/xml-id/next -[@tracespace/xml-id-david-badge]: https://flat.badgen.net/david/dep/tracespace/tracespace/packages/xml-id - -## install - -Please note: because this package is an internal utility library, it may not follow semver and breaking changes could be introduced in _any_ version bump. **You should install an exact version.** +ID attributes in XML documents (e.g. SVG images) have certain requirements. This module provides utility methods for sanitizing and generating strings to meet those requirements so they can safely be used element IDs, CSS identifiers, and URLs. ```shell -npm install --save --save-exact @tracespace/xml-id +npm install @tracespace/xml-id@next ``` +[tracespace]: https://github.com/tracespace/tracespace +[npm package]: https://www.npmjs.com/package/@tracespace/xml-id/v/next +[npm badge]: https://img.shields.io/npm/v/@tracespace/xml-id/next?style=flat-square + ## usage ```js -const {sanitize, random} = require('@tracespace/xml-id') +import {sanitize, random} from '@tracespace/xml-id' ``` The alphabet used by this module is a subset of what is valid for XML which is also CSS identifier and URL friendly. +### random(length?: number): string + +Returns a basic, (non-cryptographically-secure) random string that can be safely used as an XML ID. If unspecified or 0, `length` will be 12. + +```js +const id1 = random() // maybe 'w57gH_nT3-o8' +const id2 = random(8) // maybe 'Gi3ma2Ef' +``` + ### sanitize(source: string): string Takes a string and replaces any characters that would be invalid in an XML ID with underscores (`_`). ```js -const id = sanitize('0abc def.') // id === _abc_def_ +const id1 = sanitize('0abc def.') // '_abc_def_' ``` -### random(length: number): string +### ensure(source: unknown, length?: number): string -Returns a basic, (non-cryptographically-secure) random string that can be safely used as an XML ID. If unspecified or 0, `length` will be 12. +Given an input `source`, returns a sanitized `source` if it was a string. Otherwise, generates a random ID with length `length` (defaulting to 12 if unspecified). ```js -const id = random() // maybe "w57gH_nT3-o8" -const id = random(8) // maybe "Gi3ma2Ef" +const id1 = ensure(undefined) // 'w57gH_nT3-o8' +const id2 = ensure(undefined, 8) // 'Gi3ma2Ef' +const id3 = ensure('0abc def.') // '_abc_def_' ``` diff --git a/packages/xml-id/package.json b/packages/xml-id/package.json index 1710f0f8..da7bf49f 100644 --- a/packages/xml-id/package.json +++ b/packages/xml-id/package.json @@ -3,8 +3,8 @@ "publishConfig": { "access": "public" }, - "version": "5.0.0-next.0", - "description": "XML ID generation and sanitation utilities", + "version": "5.0.0-alpha.0", + "description": "XML element ID generation and sanitation utilities.", "types": "./lib/index.d.ts", "exports": { "types": "./lib/index.d.ts", diff --git a/www/package.json b/www/package.json index 8b45d3af..55ed06a8 100644 --- a/www/package.json +++ b/www/package.json @@ -1,6 +1,6 @@ { "name": "@tracespace/www", - "version": "5.0.0-next.0", + "version": "5.0.0-alpha.0", "description": "tracespace website", "type": "module", "private": true,