From 6ba2e4e88560c78e92ed965da3e6ddc56dbd8ab4 Mon Sep 17 00:00:00 2001 From: Enoch Riese Date: Mon, 27 Feb 2023 18:58:47 -0600 Subject: [PATCH] change to bin-pack-with-constraints --- config/dependencies.yaml | 2 +- packages/core/package.json | 2 +- packages/core/src/pattern.mjs | 5 +++-- yarn.lock | 8 ++++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/dependencies.yaml b/config/dependencies.yaml index b991c64b10e..faf138ae427 100644 --- a/config/dependencies.yaml +++ b/config/dependencies.yaml @@ -53,7 +53,7 @@ charlie: core: _: 'bezier-js': '6.1.0' - 'bin-pack': '1.0.2' + 'bin-pack-with-constraints': '1.0.1' 'hooks': '0.3.2' 'lodash.get': &_get '4.4.2' 'lodash.set': &_set '4.3.2' diff --git a/packages/core/package.json b/packages/core/package.json index bb3a265071c..44dec9d3660 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -51,7 +51,7 @@ "peerDependencies": {}, "dependencies": { "bezier-js": "6.1.0", - "bin-pack": "1.0.2", + "bin-pack-with-constraints": "1.0.1", "hooks": "0.3.2", "lodash.get": "4.4.2", "lodash.set": "4.3.2", diff --git a/packages/core/src/pattern.mjs b/packages/core/src/pattern.mjs index 5eefc19056f..ee6995ff81a 100644 --- a/packages/core/src/pattern.mjs +++ b/packages/core/src/pattern.mjs @@ -1,5 +1,5 @@ import { Attributes } from './attributes.mjs' -import pack from 'bin-pack' +import pack from 'bin-pack-with-constraints' import { __addNonEnumProp, __macroName } from './utils.mjs' import { Part } from './part.mjs' import { Stack } from './stack.mjs' @@ -72,6 +72,7 @@ Pattern.prototype.addPart = function (part, resolveImmediately = true) { this.__configResolver.isPartValid(part) && !this.designConfig.parts.find((p) => p.name == part.name) ) { + this.store.log.debug(`Adding Part \`${part.name}\` at runtime`) this.designConfig.parts.push(part) if (resolveImmediately) { if (this.__configResolver.addPart(part) && typeof this.draftQueue !== 'undefined') @@ -922,7 +923,7 @@ Pattern.prototype.__pack = function () { } } if (this.settings[0].layout === true) { - let size = pack(bins, { inPlace: true }) + let size = pack(bins, { inPlace: true, maxWidth: this.settings[0].maxWidth }) for (let bin of bins) { this.autoLayout.stacks[bin.id] = { move: {} } let stack = this.stacks[bin.id] diff --git a/yarn.lock b/yarn.lock index ca701533563..fbc7551fec3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6254,10 +6254,10 @@ bin-links@^3.0.0: rimraf "^3.0.0" write-file-atomic "^4.0.0" -bin-pack@1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/bin-pack/-/bin-pack-1.0.2.tgz#c2a014edbf0bed70a3292062ed46577b96120679" - integrity sha512-aOk0SxEon5LF9cMxQFViSKb4qccG6rs7XKyMXIb1J8f8LA2acTIWnHdT0IOTe4gYBbqgjdbuTZ5f+UP+vlh4Mw== +bin-pack-with-constraints@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/bin-pack-with-constraints/-/bin-pack-with-constraints-1.0.1.tgz#47e67b481724a8a5a3644ec9c9ccf881c2725096" + integrity sha512-fiPxvZAWuIqLpK79Ov58PztT/ZiGbpDB7usifleilJ/4aqhSx0ivY5kRifESJnR2rq51pScbUJ0LgCebufGJnA== binary-extensions@^2.0.0: version "2.2.0"