Skip to content

Commit ed7e73f

Browse files
committed
feat: wire up new critical polyfill package as a reference + prep to wire it up to Drupal Lab
1 parent d15c6d0 commit ed7e73f

File tree

5 files changed

+159
-0
lines changed

5 files changed

+159
-0
lines changed

docs-site/.boltrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ const config = {
151151
],
152152
},
153153
copy: [
154+
{
155+
from: require.resolve(`@bolt/critical-path-polyfills`),
156+
to: path.join(__dirname, '../www/build'),
157+
},
154158
{
155159
from: `src/assets/bolt-sketch.zip`,
156160
to: path.join(__dirname, '../www/assets'),

docs-site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"watch": "bolt watch"
2727
},
2828
"dependencies": {
29+
"@bolt/critical-path-polyfills": "^0.0.0",
2930
"@bolt/analytics-autolink": "^2.5.1",
3031
"@bolt/analytics-autotrack": "^2.4.2",
3132
"@bolt/build-tools": "^2.5.6",

docs-site/src/templates/_site-head.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<!DOCTYPE html>
3333
<html lang="en-US" class="{{ htmlClasses|join(' ') }}">
3434
<head>
35+
{% if fileExists("@bolt-assets/bolt-critical-path-polyfills.cjs.js") %}
36+
<script>{{ inline(assets["bolt-critical-path-polyfills.cjs.js"] | default("")) }}</script>
37+
{% endif %}
38+
3539
<script src="https://www.google-analytics.com/analytics.js" defer></script>
3640
<script>
3741
window.drupalSettings = {
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{#
2+
/**
3+
* @file
4+
* Default theme implementation for the basic structure of a single Drupal page.
5+
*
6+
* Variables:
7+
* - logged_in: A flag indicating if user is logged in.
8+
* - root_path: The root path of the current page (e.g., node, admin, user).
9+
* - node_type: The content type for the current node, if the page is a node.
10+
* - head_title: List of text elements that make up the head_title variable.
11+
* May contain one or more of the following:
12+
* - title: The title of the page.
13+
* - name: The name of the site.
14+
* - slogan: The slogan of the site.
15+
* - page_top: Initial rendered markup. This should be printed before 'page'.
16+
* - page: The rendered page markup.
17+
* - page_bottom: Closing rendered markup. This variable should be printed after
18+
* 'page'.
19+
* - db_offline: A flag indicating if the database is offline.
20+
* - placeholder_token: The token for generating head, css, js and js-bottom
21+
* placeholders.
22+
*
23+
* @see template_preprocess_html()
24+
*
25+
* @ingroup themeable
26+
*/
27+
#}
28+
29+
{# {% if bolt.data.config.lang is iterable %}
30+
{% set lang = bolt.data.config.lang[0] %}
31+
{% else %}
32+
{% set lang = bolt.data.config.lang %}
33+
{% endif %}
34+
35+
{% set manifestConfigFile = "@bolt-assets/bolt-webpack-manifest#{lang != "" ? "-" ~ lang : ""}.json" %}
36+
37+
{% set assets = [] %}
38+
{% if fileExists(manifestConfigFile) %}
39+
{% set assets = get_data(manifestConfigFile) %}
40+
{% endif %} #}
41+
42+
<!DOCTYPE html>
43+
<html{{ html_attributes }}>
44+
<head>
45+
<head-placeholder token="{{ placeholder_token }}">
46+
{# <script>{{ inline(assets["bolt-critical-path-polyfills.cjs.js"] | default("")) }}</script> #}
47+
<title>{{ head_title|safe_join(' | ') }}</title>
48+
<css-placeholder token="{{ placeholder_token }}">
49+
<js-placeholder token="{{ placeholder_token }}">
50+
</head>
51+
<body{{ attributes }}>
52+
{#
53+
Keyboard navigation/accessibility link to main content section in
54+
page.html.twig.
55+
#}
56+
<a href="#main-content" class="visually-hidden focusable">
57+
{{ 'Skip to main content'|t }}
58+
</a>
59+
{{ page_top }}
60+
{{ page }}
61+
{{ page_bottom }}
62+
<js-bottom-placeholder token="{{ placeholder_token }}">
63+
</body>
64+
</html>

yarn.lock

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,6 +2370,11 @@
23702370
dependencies:
23712371
"@babel/types" "^7.3.0"
23722372

2373+
"@types/estree@0.0.39":
2374+
version "0.0.39"
2375+
resolved "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
2376+
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==
2377+
23732378
"@types/events@*":
23742379
version "3.0.0"
23752380
resolved "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
@@ -2426,6 +2431,11 @@
24262431
resolved "https://registry.npmjs.org/@types/node/-/node-12.6.2.tgz#a5ccec6abb6060d5f20d256fb03ed743e9774999"
24272432
integrity sha512-gojym4tX0FWeV2gsW4Xmzo5wxGjXGm550oVUII7f7G5o4BV6c7DBdiG1RRQd+y1bvqRyYtPfMK85UM95vsapqQ==
24282433

2434+
"@types/node@^12.6.9":
2435+
version "12.7.1"
2436+
resolved "https://registry.npmjs.org/@types/node/-/node-12.7.1.tgz#3b5c3a26393c19b400844ac422bd0f631a94d69d"
2437+
integrity sha512-aK9jxMypeSrhiYofWWBf/T7O+KwaiAHzM4sveCdWPn71lzUSMimRnKzhXDKfKwV1kWoBo2P1aGgaIYGLf9/ljw==
2438+
24292439
"@types/node@^8.0.7":
24302440
version "8.10.50"
24312441
resolved "https://registry.npmjs.org/@types/node/-/node-8.10.50.tgz#f3d68482b1f54b5f4fba8daaac385db12bb6a706"
@@ -2759,6 +2769,11 @@ acorn@^6.0.1, acorn@^6.0.5, acorn@^6.0.7, acorn@^6.1.1, acorn@^6.2.0:
27592769
resolved "https://registry.npmjs.org/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3"
27602770
integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw==
27612771

2772+
acorn@^6.2.1:
2773+
version "6.2.1"
2774+
resolved "https://registry.npmjs.org/acorn/-/acorn-6.2.1.tgz#3ed8422d6dec09e6121cc7a843ca86a330a86b51"
2775+
integrity sha512-JD0xT5FCRDNyjDda3Lrg/IxFscp9q4tiYtxE1/nOzlKCk7hIRuYjhq1kCNkbPjMRMZuFq20HNQn1I9k8Oj0E+Q==
2776+
27622777
add-stream@^1.0.0:
27632778
version "1.0.0"
27642779
resolved "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa"
@@ -7223,6 +7238,11 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0:
72237238
resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
72247239
integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=
72257240

7241+
estree-walker@^0.6.1:
7242+
version "0.6.1"
7243+
resolved "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
7244+
integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==
7245+
72267246
esutils@^2.0.0, esutils@^2.0.2:
72277247
version "2.0.2"
72287248
resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
@@ -10412,6 +10432,13 @@ is-redirect@^1.0.0:
1041210432
resolved "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz#1d03dded53bd8db0f30c26e4f95d36fc7c87dc24"
1041310433
integrity sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=
1041410434

10435+
is-reference@^1.1.2:
10436+
version "1.1.3"
10437+
resolved "https://registry.npmjs.org/is-reference/-/is-reference-1.1.3.tgz#e99059204b66fdbe09305cfca715a29caa5c8a51"
10438+
integrity sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==
10439+
dependencies:
10440+
"@types/estree" "0.0.39"
10441+
1041510442
is-regex@^1.0.4:
1041610443
version "1.0.4"
1041710444
resolved "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491"
@@ -12548,6 +12575,13 @@ macos-release@^2.2.0:
1254812575
resolved "https://registry.npmjs.org/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f"
1254912576
integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA==
1255012577

12578+
magic-string@^0.25.2:
12579+
version "0.25.3"
12580+
resolved "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz#34b8d2a2c7fec9d9bdf9929a3fd81d271ef35be9"
12581+
integrity sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==
12582+
dependencies:
12583+
sourcemap-codec "^1.4.4"
12584+
1255112585
make-dir@^1.0.0, make-dir@^1.1.0:
1255212586
version "1.3.0"
1255312587
resolved "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz#79c1033b80515bd6d24ec9933e860ca75ee27f0c"
@@ -17246,6 +17280,17 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
1724617280
hash-base "^3.0.0"
1724717281
inherits "^2.0.1"
1724817282

17283+
rollup-plugin-commonjs@^10.0.2:
17284+
version "10.0.2"
17285+
resolved "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.0.2.tgz#61328f3a29945e2c35f2b2e824c18944fd88a54d"
17286+
integrity sha512-DxeR4QXTgTOFseYls1V7vgKbrSJmPYNdEMOs0OvH+7+89C3GiIonU9gFrE0u39Vv1KWm3wepq8KAvKugtoM2Zw==
17287+
dependencies:
17288+
estree-walker "^0.6.1"
17289+
is-reference "^1.1.2"
17290+
magic-string "^0.25.2"
17291+
resolve "^1.11.0"
17292+
rollup-pluginutils "^2.8.1"
17293+
1724917294
rollup-plugin-memory@^2.0.0:
1725017295
version "2.0.0"
1725117296
resolved "https://registry.npmjs.org/rollup-plugin-memory/-/rollup-plugin-memory-2.0.0.tgz#0a8ac6b57fa0e714f89a15c3ac82bc93f89c47c5"
@@ -17260,13 +17305,40 @@ rollup-plugin-node-resolve@^3.0.0:
1726017305
is-module "^1.0.0"
1726117306
resolve "^1.1.6"
1726217307

17308+
rollup-plugin-terser@^5.1.1:
17309+
version "5.1.1"
17310+
resolved "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.1.1.tgz#e9d2545ec8d467f96ba99b9216d2285aad8d5b66"
17311+
integrity sha512-McIMCDEY8EU6Y839C09UopeRR56wXHGdvKKjlfiZG/GrP6wvZQ62u2ko/Xh1MNH2M9WDL+obAAHySljIZYCuPQ==
17312+
dependencies:
17313+
"@babel/code-frame" "^7.0.0"
17314+
jest-worker "^24.6.0"
17315+
rollup-pluginutils "^2.8.1"
17316+
serialize-javascript "^1.7.0"
17317+
terser "^4.1.0"
17318+
17319+
rollup-pluginutils@^2.8.1:
17320+
version "2.8.1"
17321+
resolved "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97"
17322+
integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg==
17323+
dependencies:
17324+
estree-walker "^0.6.1"
17325+
1726317326
rollup@^0.41.4:
1726417327
version "0.41.6"
1726517328
resolved "https://registry.npmjs.org/rollup/-/rollup-0.41.6.tgz#e0d05497877a398c104d816d2733a718a7a94e2a"
1726617329
integrity sha1-4NBUl4d6OYwQTYFtJzOnGKepTio=
1726717330
dependencies:
1726817331
source-map-support "^0.4.0"
1726917332

17333+
rollup@^1.19.4:
17334+
version "1.19.4"
17335+
resolved "https://registry.npmjs.org/rollup/-/rollup-1.19.4.tgz#0cb4e4d6fa127adab59b11d0be50e8dd1c78123a"
17336+
integrity sha512-G24w409GNj7i/Yam2cQla6qV2k6Nug8bD2DZg9v63QX/cH/dEdbNJg8H4lUm5M1bRpPKRUC465Rm9H51JTKOfQ==
17337+
dependencies:
17338+
"@types/estree" "0.0.39"
17339+
"@types/node" "^12.6.9"
17340+
acorn "^6.2.1"
17341+
1727017342
root-check@^1.0.0:
1727117343
version "1.0.0"
1727217344
resolved "https://registry.npmjs.org/root-check/-/root-check-1.0.0.tgz#c52a794bf0db9fad567536e41898f0c9e0a86697"
@@ -18251,6 +18323,11 @@ source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@~0.5.0:
1825118323
resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
1825218324
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
1825318325

18326+
sourcemap-codec@^1.4.4:
18327+
version "1.4.6"
18328+
resolved "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz#e30a74f0402bad09807640d39e971090a08ce1e9"
18329+
integrity sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==
18330+
1825418331
space-separated-tokens@^1.0.0:
1825518332
version "1.1.4"
1825618333
resolved "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.4.tgz#27910835ae00d0adfcdbd0ad7e611fb9544351fa"
@@ -19221,6 +19298,15 @@ terser@^4.0.0:
1922119298
source-map "~0.6.1"
1922219299
source-map-support "~0.5.12"
1922319300

19301+
terser@^4.1.0:
19302+
version "4.1.3"
19303+
resolved "https://registry.npmjs.org/terser/-/terser-4.1.3.tgz#6074fbcf3517561c3272ea885f422c7a8c32d689"
19304+
integrity sha512-on13d+cnpn5bMouZu+J8tPYQecsdRJCJuxFJ+FVoPBoLJgk5bCBkp+Uen2hWyi0KIUm6eDarnlAlH+KgIx/PuQ==
19305+
dependencies:
19306+
commander "^2.20.0"
19307+
source-map "~0.6.1"
19308+
source-map-support "~0.5.12"
19309+
1922419310
test-exclude@^5.2.3:
1922519311
version "5.2.3"
1922619312
resolved "https://registry.npmjs.org/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0"

0 commit comments

Comments
 (0)