Repository navigation
feat: upgrade cad-viewer to v1.7.8 with open options - #3
Merged
Merged
Conversation
Upgrade the whole @mlightcad stack to 1.7.8 (data-model 1.15.21, libredwg-converter 3.15.21, three 0.186.1) and expose the new open-time options on the upload screen. Features - Curve quality: pass ACDB_DRAW_CIRCLE_SIDES_* as open options.circleSides. - Paper background: set sysVars.paperbkcolor via layoutBackgroundColorFromRgb() for new drawings. - Export toggle: forward disableExport to MlCadViewer. - Group all open options into one AcApOpenOptionsPayload instead of six positional emit arguments. - Draw thread control is now labelled by what it does (Worker / Main thread) rather than "Text rendering"; the default stays on the main thread, matching the library default. Integration fixes required by 1.7.x - Install the viewer's own vue-i18n instance once before mounting, and merge host command messages into both AcApI18n and that instance. - Pin this demo's localStorage key through AcApSettingManager.configure() so it does not share persisted prefs with other cad-* demos. - Capture the Vue app context at setup time; getCurrentInstance() is null inside the async loader. - Resolve three / @mlightcad renderer peers from this package so imports inside the viewer's prebuilt dist bundle correctly under pnpm. Bundling - Move the Rollup chunking rules into vite/rollupOutput.ts alongside the peer aliases, and add vue / @vue/* / lodash to a vendor chunk plus Vite's \0 virtual helpers to their own chunk. Without those two rules Rollup folds the framework runtime into a viewer chunk, the entry statically depends on it, and eager JS grows from ~184 kB to ~5.2 MB. - Copy the LibreDWG wasm next to its worker, and skip worker/runtime copies whose source is missing instead of failing the build. - Exclude the lazily imported viewer packages from dev pre-bundling and pre-bundle the PDF stack so the first PDF plugin import does not force a full page reload. - Add `pnpm analyze` (rollup-plugin-visualizer, output gitignored). Also document the chunking invariants and the exact-peer version alignment in the README.
✅ Deploy Preview for mlightcad ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrades the whole
@mlightcadstack to 1.7.8 and exposes the new open-time options on the upload screen.Dependencies
@mlightcad/cad-viewer(and plugins / simple-viewer)1.6.01.7.8@mlightcad/data-model^1.13.01.15.21@mlightcad/libredwg-converter^3.13.03.15.21three^0.172.0^0.186.1@mlightcad/cad-viewer1.7.8 declares exact peers, sodata-model/libredwg-converterare now pinned exactly instead of using^ranges. Two copies ofdata-modelmake the DWG converter register against a differentAcDbDatabaseConverterManagerthan the one the viewer opens with.Features
ACDB_DRAW_CIRCLE_SIDES_*ascircleSides(Memory / Standard / Quality).sysVars.paperbkcolorvialayoutBackgroundColorFromRgb()for new drawings.disableExporttoMlCadViewer.AcApOpenOptionsPayloadinstead of six positional emit arguments, so adding an option touches one interface.Integration fixes required by 1.7.x
vue-i18ninstance once before mounting (app.use(i18n)), otherwise components throwNeed to install with app.use function. Host command messages are merged into bothAcApI18nand that instance.AcApSettingManager.configure({ storageKey })so it stops sharing persisted prefs with othercad-*demos on the same origin.getCurrentInstance()isnullinside the async loader.three/@mlightcadrenderer peers from this package so imports inside the viewer's prebuiltdistbundle correctly under pnpm's isolated layout.Bundling
The chunking rules moved to
vite/rollupOutput.ts, next to the peer aliases. Two rules are load-bearing for the lazyimport()of@mlightcad/cad-viewerand are easy to lose when tuningmanualChunks:vue,@vue/*,lodash-es,lodash-unified→vendor. The upload screen imports Vue statically through element-plus; if Rollup folds Vue into a viewer package chunk, the entry statically depends on that whole chunk.\0virtual helpers (preload-helper.js,commonjsHelpers.js) →vite-helpers. They are pulled in statically by modules that also use a dynamicimport(), so wherever Rollup parks them, their importer follows.Measured effect on the eager entry payload (entry + everything it statically imports):
mainbefore this PRmainwith upgrade but without the two rulesThe rest stays lazy:
cad-viewer1.4 MB,cad-simple-viewer1.4 MB,data-model1.4 MB,three-renderer1.0 MB,cad-pdf-plugin4.6 MB.Also:
pnpm analyze(rollup-plugin-visualizer,stats.htmlis gitignored).html/body/#appreset inindex.html— it was dropped accidentally, and the upload screen relies on it for full-height layout.vite-svg-loaderplugin; nothing in this app or in the viewerdistimports an.svgfile as a component.Verification
pnpm install --frozen-lockfile— reproducible, singledata-modelcopy.vue-tsc --noEmitandpnpm build— clean.pnpm analyze— writesstats.html.disableExport=false), zero console errors.