Components.js
Components.js copied to clipboard
Allow context validation in componentsjs-compile-config to be skipped
Issue type:
- :bug: Bug
Description:
When working on CSS, we noticed that our validation script went from seconds to minutes between 3.x and 4.x:
componentsjs-compile-config urn:solid-server:default:Initializer -c config/default.json -f > /dev/null
Environment:
4.x
Crash log:
Thanks for reporting!
Yes, I'm aware of this (and this is intentional).
That's because of the type-scoped context functionality that is very expensive to handle according to the spec (background: https://github.com/rubensworks/jsonld-context-parser.js/issues/34). The expensive part of the algorithm is usually not needed, so it's disabled in most cases for Components.js. However, I've decided to enable the expensive check when compiling a config, since this is usually not done so often.
(it used to run for much longer than minutes, so it has already been optimized a lot 😅 )
If needed, we can add a CLI param to componentsjs-compile-config to disable this check?
If needed, we can add a CLI param to
componentsjs-compile-configto disable this check?
I'd love that. Thanks!
Another idea: in CSS, I would probably first do the fast check, and then the slow one, just as a smoke test. Maybe that is interesting behavior too.
For future reference, the internals are already in place to do this. It's just a matter of adding the arg here:
- https://github.com/LinkedSoftwareDependencies/Components.js/blob/master/bin/compile-config.ts
- https://github.com/LinkedSoftwareDependencies/Components.js/blob/master/lib/util/CompileUtil.ts#L21