govuk_publishing_components 17.7.0 → 17.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js +3 -24
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_cookie-banner.scss +6 -18
  4. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +35 -45
  5. data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +0 -4
  6. data/lib/govuk_publishing_components.rb +0 -1
  7. data/lib/govuk_publishing_components/version.rb +1 -1
  8. data/node_modules/accessible-autocomplete/package.json +1 -1
  9. data/node_modules/define-properties/package.json +2 -1
  10. data/node_modules/function-bind/package.json +2 -1
  11. data/node_modules/has-symbols/package.json +2 -1
  12. data/node_modules/jsx-ast-utils/CHANGELOG.md +16 -0
  13. data/node_modules/jsx-ast-utils/__tests__/helper.js +2 -0
  14. data/node_modules/jsx-ast-utils/__tests__/src/getPropLiteralValue-test.js +39 -3
  15. data/node_modules/jsx-ast-utils/__tests__/src/getPropValue-test.js +9 -4
  16. data/node_modules/jsx-ast-utils/lib/values/expressions/ObjectExpression.js +9 -2
  17. data/node_modules/jsx-ast-utils/lib/values/expressions/index.js +21 -6
  18. data/node_modules/jsx-ast-utils/lib/values/index.js +5 -1
  19. data/node_modules/jsx-ast-utils/package.json +35 -31
  20. data/node_modules/jsx-ast-utils/src/values/expressions/ObjectExpression.js +3 -1
  21. data/node_modules/jsx-ast-utils/src/values/expressions/index.js +12 -4
  22. data/node_modules/object-keys/package.json +2 -1
  23. data/node_modules/object.assign/CHANGELOG.md +179 -0
  24. data/node_modules/object.assign/LICENSE +21 -0
  25. data/node_modules/object.assign/README.md +135 -0
  26. data/node_modules/object.assign/auto.js +3 -0
  27. data/node_modules/object.assign/dist/browser.js +492 -0
  28. data/node_modules/object.assign/hasSymbols.js +41 -0
  29. data/node_modules/object.assign/implementation.js +41 -0
  30. data/node_modules/object.assign/index.js +17 -0
  31. data/node_modules/object.assign/package.json +148 -0
  32. data/node_modules/object.assign/polyfill.js +51 -0
  33. data/node_modules/object.assign/shim.js +14 -0
  34. data/node_modules/object.assign/test.sh +53 -0
  35. data/node_modules/object.assign/test/index.js +17 -0
  36. data/node_modules/object.assign/test/native.js +47 -0
  37. data/node_modules/object.assign/test/shimmed.js +50 -0
  38. data/node_modules/object.assign/test/tests.js +224 -0
  39. metadata +18 -3
  40. data/lib/govuk_publishing_components/presenters/cookie_banner_helper.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a3c34586d67a16119aeac7a55f462e222d46afedbc1676d9189de64879c69b6
4
- data.tar.gz: 8d3435fb34861e37f3be74f810b8c347142875be94555a35e1e99be964078056
3
+ metadata.gz: 41295a866621f3e54259818f8895a0f862b7c0d6531b653fdc888c77081d4b99
4
+ data.tar.gz: 699bb29b66ac166b9d01b1b6d99fb7200789003ea24c4669c908c64acfd88f39
5
5
  SHA512:
6
- metadata.gz: 35a3fda9195eb7f0449af19ce54086cbb4371a44c352c90395b96092716d5799d1b8438d4b35a2e27d2e3e95f7f6d91eb47df322c1ce5f8760cb792ef2a16444
7
- data.tar.gz: 79dd0c477f41e0e0f9966765e9623ab14860d06c76c6139f65d77e0ddee5f555ceec1bb9619b394a37c6edafd0d85c28d6ec4bc4e78b6816857ae7b5a9465f77
6
+ metadata.gz: b12605c7b190ccb2e35a1a495cc890ac8ab70c86b688bf879f38831858e59d51f7b248ed3fd37079271f71894da0ae888439e8f987526b30b898505ee96437ea
7
+ data.tar.gz: 82e55616e941f2aa976354ef0a4bbdbf042c89f4f220994fda42e93b451ee52dc659cebdb1731c631f7e52d9dc519703d595c51932c739bbab3681dce2919980
@@ -10,29 +10,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
10
10
  this.$module.showConfirmationMessage = this.showConfirmationMessage.bind(this)
11
11
  this.$module.setCookieConsent = this.setCookieConsent.bind(this)
12
12
 
13
- this.$module.newCookieBanner = document.querySelector('.gem-c-cookie-banner--new')
13
+ this.$module.newCookieBanner = document.querySelectorAll('.gem-c-cookie-banner--new, .gem-c-cookie-banner')
14
14
  this.$module.cookieBannerConfirmationMessage = document.querySelector('.gem-c-cookie-banner__confirmation')
15
15
 
16
16
  // Temporary check while we have 2 banners co-existing.
17
17
  // Once the new banner has been deployed, we will be able to remove code relating to the old banner
18
18
  // Separating the code out like this does mean some repetition, but will make it easier to remove later
19
- if (this.$module.newCookieBanner) {
20
- this.setupNewCookieMessage()
21
- } else {
22
- this.setupCookieMessage()
23
- }
19
+ this.setupCookieMessage()
24
20
  }
25
21
 
26
22
  CookieBanner.prototype.setupCookieMessage = function () {
27
- this.$hideLink = this.$module.querySelector('a[data-hide-cookie-banner]')
28
- if (this.$hideLink) {
29
- this.$hideLink.addEventListener('click', this.$module.hideCookieMessage)
30
- }
31
-
32
- this.showCookieMessage()
33
- }
34
-
35
- CookieBanner.prototype.setupNewCookieMessage = function () {
36
23
  this.$hideLink = this.$module.querySelector('button[data-hide-cookie-banner]')
37
24
  if (this.$hideLink) {
38
25
  this.$hideLink.addEventListener('click', this.$module.hideCookieMessage)
@@ -51,18 +38,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
51
38
  }
52
39
  }
53
40
 
54
- this.showNewCookieMessage()
41
+ this.showCookieMessage()
55
42
  }
56
43
 
57
44
  CookieBanner.prototype.showCookieMessage = function () {
58
- var shouldHaveCookieMessage = (this.$module && window.GOVUK.cookie('seen_cookie_message') !== 'true')
59
-
60
- if (shouldHaveCookieMessage) {
61
- this.$module.style.display = 'block'
62
- }
63
- }
64
-
65
- CookieBanner.prototype.showNewCookieMessage = function () {
66
45
  // Hide the cookie banner on the cookie settings page, to avoid circular journeys
67
46
  if (this.$module.newCookieBanner && window.location.pathname === '/help/cookies') {
68
47
  this.$module.style.display = 'none'
@@ -1,5 +1,4 @@
1
- $govuk-cookie-banner-background: #d5e8f3;
2
- $govuk-cookie-banner-background-new: govuk-colour("white");
1
+ $govuk-cookie-banner-background: govuk-colour("white");
3
2
  $govuk-cookie-banner-text-green: #00823b;
4
3
 
5
4
  .js-enabled {
@@ -13,19 +12,7 @@ $govuk-cookie-banner-text-green: #00823b;
13
12
  @include govuk-font($size: 16);
14
13
  padding: govuk-spacing(2) 0;
15
14
  background-color: $govuk-cookie-banner-background;
16
- }
17
-
18
- .gem-c-cookie-banner__message {
19
- margin-top: 0;
20
- margin-bottom: 0;
21
- }
22
-
23
- .gem-c-cookie-banner__hide-link {
24
- display: none;
25
-
26
- .js-enabled & {
27
- display: inline-block;
28
- }
15
+ border: 2px solid govuk-colour("black");
29
16
  }
30
17
 
31
18
  // Styles for the new version of the cookie banner
@@ -34,7 +21,7 @@ $govuk-cookie-banner-text-green: #00823b;
34
21
  border: 2px solid govuk-colour("black");
35
22
  }
36
23
 
37
- .gem-c-cookie-banner--new .gem-c-cookie-banner__message {
24
+ .gem-c-cookie-banner__message {
38
25
  display: inline-block;
39
26
  margin-bottom: govuk-spacing(1);
40
27
  padding-right: govuk-spacing(4);
@@ -134,8 +121,9 @@ $govuk-cookie-banner-text-green: #00823b;
134
121
  // Override the styles from govuk_template
135
122
  // scss-lint:disable IdSelector
136
123
  // sass-lint:disable no-ids
137
- .gem-c-cookie-banner--new#global-cookie-message {
138
- background-color: $govuk-cookie-banner-background-new;
124
+ .gem-c-cookie-banner--new#global-cookie-message,
125
+ .gem-c-cookie-banner#global-cookie-message {
126
+ background-color: $govuk-cookie-banner-background;
139
127
  padding: govuk-spacing(4) 0;
140
128
  box-sizing: border-box;
141
129
 
@@ -1,55 +1,45 @@
1
1
  <%
2
- new_cookie_banner ||= false
3
2
  id ||= 'global-cookie-message'
4
-
5
- cookie_banner_class = new_cookie_banner ? "gem-c-cookie-banner--new" : "gem-c-cookie-banner"
6
-
7
- cookie_banner_helper = GovukPublishingComponents::Presenters::CookieBannerHelper.new(local_assigns)
8
-
9
- message = cookie_banner_helper.message
3
+ message ||= "GOV.UK uses cookies to make the site simpler."
10
4
  %>
11
5
 
12
- <div id="<%= id %>" class="<%= cookie_banner_class %>" data-module="cookie-banner" role="region" aria-label="cookie banner">
6
+ <div id="<%= id %>" class="gem-c-cookie-banner" data-module="cookie-banner" role="region" aria-label="cookie banner">
13
7
  <div class="gem-c-cookie-banner__wrapper govuk-width-container">
14
8
  <p class="gem-c-cookie-banner__message"><%= message %></p>
15
- <% if new_cookie_banner %>
16
- <div class="gem-c-cookie-banner__buttons">
17
- <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-accept">
18
- <%= render "govuk_publishing_components/components/button", {
19
- text: "Accept cookies",
20
- secondary: true,
21
- inline_layout: true,
22
- data_attributes: {
23
- module: "track-click",
24
- "accept-cookies": "true",
25
- "track-category": "cookieBanner",
26
- "track-action": "Cookie banner accepted"
27
- }
28
- } %>
29
- </div>
30
- <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-settings">
31
- <%= render "govuk_publishing_components/components/button", {
32
- text: "Cookie settings",
33
- href: "/help/cookies",
34
- secondary: true,
35
- inline_layout: true,
36
- data_attributes: {
37
- module: "track-click",
38
- "track-category": "cookieBanner",
39
- "track-action": "Cookie banner settings clicked"
40
- }
41
- } %>
42
- </div>
9
+ <div class="gem-c-cookie-banner__buttons">
10
+ <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-accept">
11
+ <%= render "govuk_publishing_components/components/button", {
12
+ text: "Accept cookies",
13
+ secondary: true,
14
+ inline_layout: true,
15
+ data_attributes: {
16
+ module: "track-click",
17
+ "accept-cookies": "true",
18
+ "track-category": "cookieBanner",
19
+ "track-action": "Cookie banner accepted"
20
+ }
21
+ } %>
22
+ </div>
23
+ <div class="gem-c-cookie-banner__button gem-c-cookie-banner__button-settings">
24
+ <%= render "govuk_publishing_components/components/button", {
25
+ text: "Cookie settings",
26
+ href: "/help/cookies",
27
+ secondary: true,
28
+ inline_layout: true,
29
+ data_attributes: {
30
+ module: "track-click",
31
+ "track-category": "cookieBanner",
32
+ "track-action": "Cookie banner settings clicked"
33
+ }
34
+ } %>
43
35
  </div>
44
- <% end %>
36
+ </div>
45
37
  </div>
46
38
 
47
- <% if new_cookie_banner %>
48
- <div class="gem-c-cookie-banner__confirmation govuk-width-container" tabindex="-1">
49
- <p class="gem-c-cookie-banner__confirmation-message">
50
- You&#8217;ve accepted all cookies. You can <a class="govuk-link" href="/help/cookies" data-module="track-click" data-track-category="cookieBanner" data-track-action="Cookie banner settings clicked from confirmation">change your cookie settings</a> at any time.
51
- </p>
52
- <button class="gem-c-cookie-banner__hide-button" data-hide-cookie-banner="true" data-module="track-click" data-track-category="cookieBanner" data-track-action="Hide cookie banner">Hide</button>
53
- </div>
54
- <% end %>
39
+ <div class="gem-c-cookie-banner__confirmation govuk-width-container" tabindex="-1">
40
+ <p class="gem-c-cookie-banner__confirmation-message">
41
+ You&#8217;ve accepted all cookies. You can <a class="govuk-link" href="/help/cookies" data-module="track-click" data-track-category="cookieBanner" data-track-action="Cookie banner settings clicked from confirmation">change your cookie settings</a> at any time.
42
+ </p>
43
+ <button class="gem-c-cookie-banner__hide-button" data-hide-cookie-banner="true" data-module="track-click" data-track-category="cookieBanner" data-track-action="Hide cookie banner">Hide</button>
44
+ </div>
55
45
  </div>
@@ -21,7 +21,3 @@ examples:
21
21
  data:
22
22
  id: custom-message
23
23
  message: GOV.UK uses cookies to make the site simpler. <a class="govuk-link" href="/help/cookies">Find out more about cookies</a>
24
- new_cookie_banner:
25
- description: FOR TESTING PURPOSES ONLY. This is a new proposed iteration of the cookie banner. The current banner will remain the same across the live site for now.
26
- data:
27
- new_cookie_banner: true
@@ -26,7 +26,6 @@ require "govuk_publishing_components/presenters/image_card_helper"
26
26
  require "govuk_publishing_components/presenters/organisation_logo_helper"
27
27
  require "govuk_publishing_components/presenters/highlight_boxes_helper"
28
28
  require "govuk_publishing_components/presenters/taxonomy_list_helper"
29
- require "govuk_publishing_components/presenters/cookie_banner_helper"
30
29
 
31
30
  require "govuk_publishing_components/app_helpers/taxon_breadcrumbs"
32
31
  require "govuk_publishing_components/app_helpers/table_helper"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '17.7.0'.freeze
2
+ VERSION = '17.8.0'.freeze
3
3
  end
@@ -49,7 +49,7 @@
49
49
  "/"
50
50
  ],
51
51
  "_resolved": "git://github.com/alphagov/accessible-autocomplete.git#3523dd9fffc70cbd9f6f555f75863c33a709f49e",
52
- "_shasum": "1f80c0f6496bc9005bdc5742bd3a6f47e3a44be0",
52
+ "_shasum": "541747a32fce9d43242a06a4393c974da99ce3af",
53
53
  "_shrinkwrap": null,
54
54
  "_spec": "accessible-autocomplete@git://github.com/alphagov/accessible-autocomplete.git#add-multiselect-support",
55
55
  "_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
@@ -38,7 +38,8 @@
38
38
  "type": "range"
39
39
  },
40
40
  "_requiredBy": [
41
- "/array-includes"
41
+ "/array-includes",
42
+ "/object.assign"
42
43
  ],
43
44
  "_resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz",
44
45
  "_shasum": "cf88da6cbee26fe6db7094f61d870cbd84cee9f1",
@@ -39,7 +39,8 @@
39
39
  },
40
40
  "_requiredBy": [
41
41
  "/es-abstract",
42
- "/has"
42
+ "/has",
43
+ "/object.assign"
43
44
  ],
44
45
  "_resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
45
46
  "_shasum": "a56899d3ea3c9bab874bb9773b7c5ede92f4895d",
@@ -38,7 +38,8 @@
38
38
  "type": "range"
39
39
  },
40
40
  "_requiredBy": [
41
- "/is-symbol"
41
+ "/is-symbol",
42
+ "/object.assign"
42
43
  ],
43
44
  "_resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz",
44
45
  "_shasum": "ba1a8f1af2a0fc39650f5c850367704122063b44",
@@ -1,3 +1,19 @@
1
+ 2.2.0 / 2019-06-25
2
+ ==================
3
+ - (fix) Fix getLiteralPropValue for TS-specific node types.
4
+ - (chore) upgrade dependencies.
5
+ - (improvement) Stop throwing errors when unknown AST nodes are encountered.
6
+ - (dev) CI changes.
7
+
8
+ 2.1.0 / 2018-04-19
9
+ ==================
10
+ - Fix undefined bug for template strings. #45
11
+ - Adding support for `objectRestSpread` within props #60
12
+ - Accommodate ExperimentalSpreadProperty in prop values #75
13
+ - Account for SpreadElement AST Nodes #76
14
+ - Support OptionalMemberExpression AST nodes #77
15
+ - Add support to Typescript's node types #72
16
+
1
17
  2.0.1 / 2017-08-31
2
18
  ==================
3
19
  - [fix] Add support for BindExpression
@@ -37,3 +37,5 @@ export function extractProp(code, prop = 'foo') {
37
37
  const { attributes: props } = node;
38
38
  return getProp(props, prop);
39
39
  }
40
+
41
+ export const describeIfNotBabylon = fallbackToBabylon ? describe.skip : describe;
@@ -1,7 +1,7 @@
1
1
  /* eslint-env mocha */
2
2
  /* eslint no-template-curly-in-string: 0 */
3
3
  import assert from 'assert';
4
- import { extractProp } from '../helper';
4
+ import { extractProp, describeIfNotBabylon, changePlugins } from '../helper';
5
5
  import { getLiteralPropValue } from '../../src/getPropValue';
6
6
 
7
7
  describe('getLiteralPropValue', () => {
@@ -19,7 +19,7 @@ describe('getLiteralPropValue', () => {
19
19
  assert.equal(expected, actual);
20
20
  });
21
21
 
22
- it('should throw error when trying to get value from unknown node type', () => {
22
+ it('should not throw error when trying to get value from unknown node type', () => {
23
23
  const prop = {
24
24
  type: 'JSXAttribute',
25
25
  value: {
@@ -27,9 +27,11 @@ describe('getLiteralPropValue', () => {
27
27
  },
28
28
  };
29
29
 
30
- assert.throws(() => {
30
+ assert.doesNotThrow(() => {
31
31
  getLiteralPropValue(prop);
32
32
  }, Error);
33
+
34
+ assert.equal(null, getLiteralPropValue(prop));
33
35
  });
34
36
 
35
37
  describe('Null', () => {
@@ -465,4 +467,38 @@ describe('getLiteralPropValue', () => {
465
467
  assert.deepEqual(expected, actual);
466
468
  });
467
469
  });
470
+
471
+ describeIfNotBabylon('Typescript', () => {
472
+ beforeEach(() => {
473
+ changePlugins(pls => [...pls, 'typescript']);
474
+ });
475
+
476
+ it('should return string representation of variable identifier wrapped in a Typescript non-null assertion', () => {
477
+ const prop = extractProp('<div foo={bar!} />');
478
+
479
+ const expected = null;
480
+ const actual = getLiteralPropValue(prop);
481
+
482
+ assert.equal(expected, actual);
483
+ });
484
+
485
+ it('should return string representation of variable identifier wrapped in a deep Typescript non-null assertion', () => {
486
+ const prop = extractProp('<div foo={(bar!)!} />');
487
+
488
+ const expected = null;
489
+ const actual = getLiteralPropValue(prop);
490
+
491
+ assert.equal(expected, actual);
492
+ });
493
+
494
+ it('should return string representation of variable identifier wrapped in a Typescript type coercion', () => {
495
+ changePlugins(pls => [...pls, 'typescript']);
496
+ const prop = extractProp('<div foo={bar as any} />');
497
+
498
+ const expected = null;
499
+ const actual = getLiteralPropValue(prop);
500
+
501
+ assert.equal(expected, actual);
502
+ });
503
+ });
468
504
  });
@@ -1,11 +1,14 @@
1
1
  /* eslint-env mocha */
2
2
  /* eslint no-template-curly-in-string: 0 */
3
3
  import assert from 'assert';
4
- import { extractProp, changePlugins, fallbackToBabylon } from '../helper';
4
+ import {
5
+ extractProp,
6
+ changePlugins,
7
+ fallbackToBabylon,
8
+ describeIfNotBabylon,
9
+ } from '../helper';
5
10
  import getPropValue from '../../src/getPropValue';
6
11
 
7
- const describeIfNotBabylon = fallbackToBabylon ? describe.skip : describe;
8
-
9
12
  describe('getPropValue', () => {
10
13
  it('should export a function', () => {
11
14
  const expected = 'function';
@@ -29,9 +32,11 @@ describe('getPropValue', () => {
29
32
  },
30
33
  };
31
34
 
32
- assert.throws(() => {
35
+ assert.doesNotThrow(() => {
33
36
  getPropValue(prop);
34
37
  }, Error);
38
+
39
+ assert.equal(null, getPropValue(prop));
35
40
  });
36
41
 
37
42
  describe('Null', () => {
@@ -4,6 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = extractValueFromObjectExpression;
7
+
8
+ var _object = require('object.assign');
9
+
10
+ var _object2 = _interopRequireDefault(_object);
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
7
14
  /**
8
15
  * Extractor function for an ObjectExpression type value node.
9
16
  * An object expression is using {}.
@@ -14,11 +21,11 @@ function extractValueFromObjectExpression(value) {
14
21
  // eslint-disable-next-line global-require
15
22
  var getValue = require('./index.js').default;
16
23
  return value.properties.reduce(function (obj, property) {
17
- var object = Object.assign({}, obj);
24
+ var object = (0, _object2.default)({}, obj);
18
25
  // Support types: SpreadProperty and ExperimentalSpreadProperty
19
26
  if (/^(?:Experimental)?Spread(?:Property|Element)$/.test(property.type)) {
20
27
  if (property.argument.type === 'ObjectExpression') {
21
- return Object.assign(object, extractValueFromObjectExpression(property.argument));
28
+ return (0, _object2.default)(object, extractValueFromObjectExpression(property.argument));
22
29
  }
23
30
  } else {
24
31
  object[getValue(property.key)] = getValue(property.value);
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = extract;
7
7
  exports.extractLiteral = extractLiteral;
8
8
 
9
+ var _object = require('object.assign');
10
+
11
+ var _object2 = _interopRequireDefault(_object);
12
+
9
13
  var _Literal = require('../Literal');
10
14
 
11
15
  var _Literal2 = _interopRequireDefault(_Literal);
@@ -145,19 +149,26 @@ function extract(value) {
145
149
 
146
150
 
147
151
  while (type === 'TSNonNullExpression' || type === 'TSAsExpression') {
148
- expression = expression.expression;
149
- type = expression.type;
152
+ var _expression2 = expression;
153
+ type = _expression2.type;
154
+
155
+ if (expression.expression) {
156
+ var _expression3 = expression;
157
+ expression = _expression3.expression;
158
+ }
150
159
  }
151
160
 
152
161
  if (TYPES[type] === undefined) {
153
- throw new Error(errorMessage(type));
162
+ // eslint-disable-next-line no-console
163
+ console.error(errorMessage(type));
164
+ return null;
154
165
  }
155
166
 
156
167
  return TYPES[type](expression);
157
168
  }
158
169
 
159
170
  // Composition map of types to their extractor functions to handle literals.
160
- var LITERAL_TYPES = Object.assign({}, TYPES, {
171
+ var LITERAL_TYPES = (0, _object2.default)({}, TYPES, {
161
172
  Literal: function Literal(value) {
162
173
  var extractedVal = TYPES.Literal.call(undefined, value);
163
174
  var isNull = extractedVal === null;
@@ -196,7 +207,9 @@ var LITERAL_TYPES = Object.assign({}, TYPES, {
196
207
  });
197
208
  },
198
209
  BindExpression: noop,
199
- SpreadElement: noop
210
+ SpreadElement: noop,
211
+ TSNonNullExpression: noop,
212
+ TSAsExpression: noop
200
213
  });
201
214
 
202
215
  /**
@@ -216,7 +229,9 @@ function extractLiteral(value) {
216
229
 
217
230
 
218
231
  if (LITERAL_TYPES[type] === undefined) {
219
- throw new Error(errorMessage(type));
232
+ // eslint-disable-next-line no-console
233
+ console.error(errorMessage(type));
234
+ return null;
220
235
  }
221
236
 
222
237
  return LITERAL_TYPES[type](expression);