mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2025-12-11 23:50:05 +01:00
Prevent circular dependencies in $extends
This commit is contained in:
parent
dd6ff93a89
commit
887220abe3
6 changed files with 17 additions and 4 deletions
|
|
@ -6,12 +6,18 @@
|
||||||
|
|
||||||
### Major
|
### Major
|
||||||
|
|
||||||
- Un-exclude kicad8 template during default kicad version switch!
|
- Straightforward-ize `extends` behaviour for tagging (see #129)
|
||||||
|
- Un-exclude kicad8 template from coverage during default kicad version switch!
|
||||||
- Merge, generalize, uniform-ize and externalize footprints!
|
- Merge, generalize, uniform-ize and externalize footprints!
|
||||||
- onnx-like incremental opset versioning
|
- onnx-like incremental opset versioning
|
||||||
- Template for creating them, built-in variables they can use, documentation, external links, etc.
|
- Template for creating them, built-in variables they can use, documentation, external links, etc.
|
||||||
- Add access to whole set of points + filtering logic, so they can implement their own connection logic as well maybe (see daisy chaining)
|
- Add access to whole set of points + filtering logic, so they can implement their own connection logic as well maybe (see daisy chaining)
|
||||||
|
- Maybe ordering for the filter (so every instance can know that it really is the next in line)
|
||||||
|
- Add `chain` to footprint API similarly to how `local_net` behaves, only for daisy chaining
|
||||||
|
- Also, rename `local_net` to `local`, probably
|
||||||
- Also considering how (or, on which layer) they define their silks, universal mirroring behaviour (see ixy/xy/sxy note), etc.
|
- Also considering how (or, on which layer) they define their silks, universal mirroring behaviour (see ixy/xy/sxy note), etc.
|
||||||
|
- When breaking anyway, remove a lot of footprints from built-in status
|
||||||
|
- And make sure the external infrastructure + bundling support is there to make up for it
|
||||||
|
|
||||||
### Minor
|
### Minor
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,12 @@ exports.inherit = config => traverse(config, config, [], (target, key, val, root
|
||||||
const list = [val]
|
const list = [val]
|
||||||
while (candidates.length) {
|
while (candidates.length) {
|
||||||
const path = candidates.shift()
|
const path = candidates.shift()
|
||||||
const other = u.deepcopy(u.deep(root, path))
|
const other = u.deep(root, path)
|
||||||
a.assert(other, `"${path}" (reached from "${breadcrumbs.join('.')}.$extends") does not name a valid inheritance target!`)
|
a.assert(other, `"${path}" (reached from "${breadcrumbs.join('.')}.$extends") does not name a valid inheritance target!`)
|
||||||
let parents = other.$extends || []
|
let parents = other.$extends || []
|
||||||
if (a.type(parents)() !== 'array') parents = [parents]
|
if (a.type(parents)() !== 'array') parents = [parents]
|
||||||
candidates = candidates.concat(parents)
|
candidates = candidates.concat(parents)
|
||||||
|
a.assert(!list.includes(other), `"${path}" (reached from "${breadcrumbs.join('.')}.$extends") leads to a circular dependency!`)
|
||||||
list.unshift(other)
|
list.unshift(other)
|
||||||
}
|
}
|
||||||
val = extend.apply(null, list)
|
val = extend.apply(null, list)
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Custom template override. The secret is 42. MakerJS is 0.17.0. Ergogen is 4.0.5.
|
Custom template override. The secret is 42. MakerJS is loaded. Ergogen is loaded.
|
||||||
BIN
test/fixtures/bundle.zip
vendored
BIN
test/fixtures/bundle.zip
vendored
Binary file not shown.
|
|
@ -4,6 +4,6 @@ const version = require('package.json').version
|
||||||
module.exports = {
|
module.exports = {
|
||||||
convert_outline: () => {},
|
convert_outline: () => {},
|
||||||
body: params => {
|
body: params => {
|
||||||
return `Custom template override. The secret is ${params.custom.secret}. MakerJS is ${m.version}. Ergogen is ${version}.`
|
return `Custom template override. The secret is ${params.custom.secret}. MakerJS is ${m.version.length ? 'loaded' : ''}. Ergogen is ${version.length ? 'loaded' : ''}.`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -61,6 +61,12 @@ describe('Prepare', function() {
|
||||||
y: 2,
|
y: 2,
|
||||||
z: 3
|
z: 3
|
||||||
})
|
})
|
||||||
|
// should be able to detect circular dependencies and error out
|
||||||
|
p.inherit.bind(this, {
|
||||||
|
a: {
|
||||||
|
$extends: 'a'
|
||||||
|
}
|
||||||
|
}).should.throw('circular dependency')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('parameterize', function() {
|
it('parameterize', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue