Add packages to optimize svgs dynamically
These packages will be used to dynamically optimize SVG images
during the build.
R=jacktfranklin@chromium.org
Bug: 1216402
Change-Id: I04e95aa7d79c9d67beaf8a7861182c52b16b7d0f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2939992
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
diff --git a/node_modules/css-tree/lib/definition-syntax/walk.js b/node_modules/css-tree/lib/definition-syntax/walk.js
new file mode 100644
index 0000000..7ba80e9
--- /dev/null
+++ b/node_modules/css-tree/lib/definition-syntax/walk.js
@@ -0,0 +1,52 @@
+var noop = function() {};
+
+function ensureFunction(value) {
+ return typeof value === 'function' ? value : noop;
+}
+
+module.exports = function(node, options, context) {
+ function walk(node) {
+ enter.call(context, node);
+
+ switch (node.type) {
+ case 'Group':
+ node.terms.forEach(walk);
+ break;
+
+ case 'Multiplier':
+ walk(node.term);
+ break;
+
+ case 'Type':
+ case 'Property':
+ case 'Keyword':
+ case 'AtKeyword':
+ case 'Function':
+ case 'String':
+ case 'Token':
+ case 'Comma':
+ break;
+
+ default:
+ throw new Error('Unknown type: ' + node.type);
+ }
+
+ leave.call(context, node);
+ }
+
+ var enter = noop;
+ var leave = noop;
+
+ if (typeof options === 'function') {
+ enter = options;
+ } else if (options) {
+ enter = ensureFunction(options.enter);
+ leave = ensureFunction(options.leave);
+ }
+
+ if (enter === noop && leave === noop) {
+ throw new Error('Neither `enter` nor `leave` walker handler is set or both aren\'t a function');
+ }
+
+ walk(node, context);
+};