-
Notifications
You must be signed in to change notification settings - Fork 203
WIP: Framing #365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Framing #365
Conversation
This gets much of framing complete. More to do, but I may have a gap in working on it, so this can be reviewed and hopefully merged). This leaves nine failing tests. Some tests are failing with Node6, which perhaps someone with more experience in the differences can see what might be going on. |
It looks like the Node 6 failure is due to if (!Object.entries) {
Object.entries = function( obj ){
var ownProps = Object.keys( obj ),
i = ownProps.length,
resArray = new Array(i); // preallocate the Array
while (i--)
resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};
} Where would be the best place to apply this? |
Short answer is to hack it to work for now. core-js for Object.entries, and a shim for Object.fromEntries. I'll try adding it. Was trying to avoid this nonsense in jsonld.js 2.x. Once 1.1 support is mostly or all done I think we'll get radical with changes for a 3.x release. That'll include updating to core-js 3, which has Object.fromEntries, and just dropping node6 support and see if anyone notices. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gkellogg! This is looking good. I left some comments that are almost all (all?) related to style or ES6/7 stuff. Hopefully they can be batched together. @davidlehn -- we should look into getting linting turned on/fixed for this repo so devs don't have to deal with these nits, do you know what needs to be done there?
Regarding node 6 support ... we should drop it, node 6 is EOL. It's fine to wait on that until another PR (I noticed a FIXME about it in here).
return false; | ||
} | ||
matchThis = true; | ||
} else if(types.isObject(thisFrame)) { // XXX only framing keywords |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this "XXX" comment need to be addressed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was in my code, and it could relate to some of the yet-to-be fixed issues.
@dlongley Re linting, we do have eslint config here, and a "lint" command, but our rules didn't check for 'brace-style'. Added a PR to consider for that: |
lib/frame.js
Outdated
Object.keys(state.graphMap[id]).sort(), [subframe], output, '@graph'); | ||
state.graph = state.graphStack.pop; | ||
state.graphStack.pop; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be calling pop? Should it have been calling it before? Should there be a test that detects this one way or the other?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We pushed on to the stack before recursing, so need to pop it back off when done. We don't need to save that, since state.graph
was set just for the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before it was setting state.graph
to the pop function. Now it's just doing nothing. I assume this should be pop()
, but it doesn't seem to matter either way in the test suite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you're right, should be pop()
(Ruby-isms :) ). It doesn't matter for the tests, but it might in production.
I'll test before committing an update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing and filing an issue about it.
- Changes in object embedding. - Better support for graph framing.
Replaced removePreserve with cleanupPreserve and cleanupNulls.
Co-Authored-By: Dave Longley <[email protected]>
Co-Authored-By: Dave Longley <[email protected]>
- Static '@' keywords should be safe to use with 'in'.
embed
to"@once"
and warn on"@first"
or"@last"
.pruneBlankNodeIdentifiers
based on processingMode.omitGraph
based on processingMode.@graph
omitted ifomitGraph
istrue
.@embed
.@type
when framing.