hof 22.9.0-beta.v1 → 22.9.0-beta.v2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. package/package.json +1 -1
  2. package/package/.eslintignore +0 -1
  3. package/package/CHANGELOG.md +0 -232
  4. package/package/LICENSE +0 -21
  5. package/package/README.md +0 -1887
  6. package/package/bin/hof-build +0 -10
  7. package/package/bin/hof-transpiler +0 -12
  8. package/package/build/helpers/importer.js +0 -29
  9. package/package/build/helpers/local.js +0 -35
  10. package/package/build/helpers/resolver/import.js +0 -32
  11. package/package/build/helpers/resolver/nearest-package-root.js +0 -33
  12. package/package/build/helpers/resolver/package.js +0 -29
  13. package/package/build/helpers/resolver.js +0 -16
  14. package/package/build/index.js +0 -49
  15. package/package/build/lib/env.js +0 -36
  16. package/package/build/lib/mkdir.js +0 -9
  17. package/package/build/lib/run.js +0 -17
  18. package/package/build/lib/spawn.js +0 -18
  19. package/package/build/tasks/browserify/compress.js +0 -15
  20. package/package/build/tasks/browserify/index.js +0 -48
  21. package/package/build/tasks/build/index.js +0 -6
  22. package/package/build/tasks/images/index.js +0 -27
  23. package/package/build/tasks/index.js +0 -8
  24. package/package/build/tasks/sass/index.js +0 -67
  25. package/package/build/tasks/translate/index.js +0 -20
  26. package/package/build/tasks/watch/index.js +0 -161
  27. package/package/components/address-lookup/default-model.js +0 -76
  28. package/package/components/address-lookup/defaults.js +0 -25
  29. package/package/components/address-lookup/index.js +0 -251
  30. package/package/components/address-lookup/templates/address-lookup.html +0 -14
  31. package/package/components/address-lookup/templates/address.html +0 -22
  32. package/package/components/address-lookup/templates/postcode.html +0 -9
  33. package/package/components/clear-session/Readme.md +0 -46
  34. package/package/components/clear-session/index.js +0 -26
  35. package/package/components/combine-and-loop-fields/Readme.md +0 -42
  36. package/package/components/combine-and-loop-fields/index.js +0 -156
  37. package/package/components/date/fields.js +0 -16
  38. package/package/components/date/index.js +0 -172
  39. package/package/components/date/templates/date.html +0 -20
  40. package/package/components/emailer/assets/images/govuk_logotype_email.png +0 -0
  41. package/package/components/emailer/assets/images/ho_crest_27px.png +0 -0
  42. package/package/components/emailer/assets/images/spacer.gif +0 -0
  43. package/package/components/emailer/email-service.js +0 -51
  44. package/package/components/emailer/emailer.js +0 -53
  45. package/package/components/emailer/index.js +0 -74
  46. package/package/components/emailer/transports/debug.js +0 -74
  47. package/package/components/emailer/transports/index.js +0 -8
  48. package/package/components/emailer/transports/ses.js +0 -36
  49. package/package/components/emailer/transports/smtp.js +0 -26
  50. package/package/components/emailer/transports/stub.js +0 -5
  51. package/package/components/emailer/views/layout.html +0 -63
  52. package/package/components/homeoffice-countries/index.js +0 -22
  53. package/package/components/index.js +0 -13
  54. package/package/components/notify/index.js +0 -62
  55. package/package/components/notify/notify.js +0 -51
  56. package/package/components/session-timeout-warning/index.js +0 -67
  57. package/package/components/summary/index.js +0 -237
  58. package/package/config/builder-defaults.js +0 -45
  59. package/package/config/component-defaults.js +0 -13
  60. package/package/config/hof-defaults.js +0 -65
  61. package/package/config/rate-limits.js +0 -20
  62. package/package/config/sanitisation-rules.js +0 -32
  63. package/package/controller/base-controller.js +0 -296
  64. package/package/controller/behaviour-hooks.js +0 -51
  65. package/package/controller/behaviour-session.js +0 -64
  66. package/package/controller/controller.js +0 -258
  67. package/package/controller/deprecate-error.js +0 -10
  68. package/package/controller/formatting/formatters.js +0 -70
  69. package/package/controller/formatting/index.js +0 -32
  70. package/package/controller/index.js +0 -17
  71. package/package/controller/validation/email.js +0 -30
  72. package/package/controller/validation/index.js +0 -101
  73. package/package/controller/validation/validators.js +0 -181
  74. package/package/controller/validation-error.js +0 -14
  75. package/package/frontend/govuk-template/build/config.js +0 -24
  76. package/package/frontend/govuk-template/build/govuk_template.html +0 -102
  77. package/package/frontend/govuk-template/build/index.js +0 -23
  78. package/package/frontend/govuk-template/govuk_template_generated.html +0 -102
  79. package/package/frontend/govuk-template/index.js +0 -29
  80. package/package/frontend/index.js +0 -9
  81. package/package/frontend/template-mixins/mixins/helpers.js +0 -103
  82. package/package/frontend/template-mixins/mixins/index.js +0 -37
  83. package/package/frontend/template-mixins/mixins/render.js +0 -12
  84. package/package/frontend/template-mixins/mixins/template-mixins.js +0 -520
  85. package/package/frontend/template-mixins/partials/forms/checkbox-group.html +0 -47
  86. package/package/frontend/template-mixins/partials/forms/checkbox.html +0 -16
  87. package/package/frontend/template-mixins/partials/forms/input-submit.html +0 -1
  88. package/package/frontend/template-mixins/partials/forms/input-text-date.html +0 -37
  89. package/package/frontend/template-mixins/partials/forms/input-text-group.html +0 -45
  90. package/package/frontend/template-mixins/partials/forms/option-group.html +0 -43
  91. package/package/frontend/template-mixins/partials/forms/select.html +0 -17
  92. package/package/frontend/template-mixins/partials/forms/textarea-group.html +0 -37
  93. package/package/frontend/template-mixins/partials/mixins/panel.html +0 -4
  94. package/package/frontend/template-partials/index.js +0 -9
  95. package/package/frontend/template-partials/translations/index.js +0 -26
  96. package/package/frontend/template-partials/translations/src/cy/base.json +0 -4
  97. package/package/frontend/template-partials/translations/src/cy/buttons.json +0 -6
  98. package/package/frontend/template-partials/translations/src/cy/cookies.json +0 -104
  99. package/package/frontend/template-partials/translations/src/cy/errorlist.json +0 -6
  100. package/package/frontend/template-partials/translations/src/cy/errors.json +0 -18
  101. package/package/frontend/template-partials/translations/src/cy/terms.json +0 -28
  102. package/package/frontend/template-partials/translations/src/en/accessibility.json +0 -43
  103. package/package/frontend/template-partials/translations/src/en/base.json +0 -5
  104. package/package/frontend/template-partials/translations/src/en/buttons.json +0 -10
  105. package/package/frontend/template-partials/translations/src/en/cookies.json +0 -116
  106. package/package/frontend/template-partials/translations/src/en/errorlist.json +0 -7
  107. package/package/frontend/template-partials/translations/src/en/errors.json +0 -35
  108. package/package/frontend/template-partials/translations/src/en/exit.json +0 -5
  109. package/package/frontend/template-partials/translations/src/en/fields.json +0 -5
  110. package/package/frontend/template-partials/translations/src/en/journey.json +0 -6
  111. package/package/frontend/template-partials/translations/src/en/save-and-exit.json +0 -4
  112. package/package/frontend/template-partials/translations/src/en/terms.json +0 -28
  113. package/package/frontend/template-partials/views/404.html +0 -9
  114. package/package/frontend/template-partials/views/accessibility.html +0 -55
  115. package/package/frontend/template-partials/views/confirm.html +0 -8
  116. package/package/frontend/template-partials/views/confirmation.html +0 -19
  117. package/package/frontend/template-partials/views/content/en/what-happens-next.md +0 -0
  118. package/package/frontend/template-partials/views/cookie-error.html +0 -1
  119. package/package/frontend/template-partials/views/cookies.html +0 -84
  120. package/package/frontend/template-partials/views/email/data-row.html +0 -4
  121. package/package/frontend/template-partials/views/email/formatted.html +0 -12
  122. package/package/frontend/template-partials/views/email/layout.html +0 -63
  123. package/package/frontend/template-partials/views/email/raw.html +0 -11
  124. package/package/frontend/template-partials/views/email/section-row.html +0 -3
  125. package/package/frontend/template-partials/views/error.html +0 -20
  126. package/package/frontend/template-partials/views/exit.html +0 -9
  127. package/package/frontend/template-partials/views/feedback-submitted.html +0 -11
  128. package/package/frontend/template-partials/views/layout.html +0 -55
  129. package/package/frontend/template-partials/views/partials/analytics-table.html +0 -25
  130. package/package/frontend/template-partials/views/partials/back.html +0 -5
  131. package/package/frontend/template-partials/views/partials/bullet-list.html +0 -7
  132. package/package/frontend/template-partials/views/partials/confirmation-alert.html +0 -6
  133. package/package/frontend/template-partials/views/partials/continue.html +0 -5
  134. package/package/frontend/template-partials/views/partials/cookie-banner.html +0 -29
  135. package/package/frontend/template-partials/views/partials/cookie-notification.html +0 -4
  136. package/package/frontend/template-partials/views/partials/cookie-settings-button.html +0 -1
  137. package/package/frontend/template-partials/views/partials/cookie-settings-radio.html +0 -8
  138. package/package/frontend/template-partials/views/partials/details-summary.html +0 -8
  139. package/package/frontend/template-partials/views/partials/external-link.html +0 -1
  140. package/package/frontend/template-partials/views/partials/form.html +0 -10
  141. package/package/frontend/template-partials/views/partials/gatag.html +0 -60
  142. package/package/frontend/template-partials/views/partials/head.html +0 -31
  143. package/package/frontend/template-partials/views/partials/heading.html +0 -11
  144. package/package/frontend/template-partials/views/partials/items-table.html +0 -32
  145. package/package/frontend/template-partials/views/partials/maincontent-left.html +0 -10
  146. package/package/frontend/template-partials/views/partials/navigation.html +0 -8
  147. package/package/frontend/template-partials/views/partials/page.html +0 -23
  148. package/package/frontend/template-partials/views/partials/panel-indent.html +0 -3
  149. package/package/frontend/template-partials/views/partials/session-cookies-table.html +0 -28
  150. package/package/frontend/template-partials/views/partials/session-timeout-warning.html +0 -38
  151. package/package/frontend/template-partials/views/partials/summary-table-row.html +0 -14
  152. package/package/frontend/template-partials/views/partials/summary-table.html +0 -8
  153. package/package/frontend/template-partials/views/partials/table.html +0 -18
  154. package/package/frontend/template-partials/views/partials/validation-list.html +0 -3
  155. package/package/frontend/template-partials/views/partials/validation-summary.html +0 -25
  156. package/package/frontend/template-partials/views/partials/warn.html +0 -7
  157. package/package/frontend/template-partials/views/rate-limit-error.html +0 -10
  158. package/package/frontend/template-partials/views/save-and-exit.html +0 -17
  159. package/package/frontend/template-partials/views/service-unavailable.html +0 -13
  160. package/package/frontend/template-partials/views/session-timeout.html +0 -7
  161. package/package/frontend/template-partials/views/step.html +0 -14
  162. package/package/frontend/template-partials/views/terms.html +0 -26
  163. package/package/frontend/themes/gov-uk/client-js/cookieSettings.js +0 -145
  164. package/package/frontend/themes/gov-uk/client-js/govuk-cookies.js +0 -121
  165. package/package/frontend/themes/gov-uk/client-js/index.js +0 -27
  166. package/package/frontend/themes/gov-uk/client-js/session-timeout-dialog.js +0 -348
  167. package/package/frontend/themes/gov-uk/client-js/skip-to-main.js +0 -19
  168. package/package/frontend/themes/gov-uk/index.js +0 -9
  169. package/package/frontend/themes/gov-uk/styles/_base.scss +0 -17
  170. package/package/frontend/themes/gov-uk/styles/_check_your_answers.scss +0 -155
  171. package/package/frontend/themes/gov-uk/styles/_cookie-banner.scss +0 -111
  172. package/package/frontend/themes/gov-uk/styles/_cookie-settings.scss +0 -33
  173. package/package/frontend/themes/gov-uk/styles/_govuk_frontend_toolkit.scss +0 -23
  174. package/package/frontend/themes/gov-uk/styles/_helpers.scss +0 -5
  175. package/package/frontend/themes/gov-uk/styles/_layout.scss +0 -125
  176. package/package/frontend/themes/gov-uk/styles/_panel-indent.scss +0 -27
  177. package/package/frontend/themes/gov-uk/styles/_pdf.scss +0 -42
  178. package/package/frontend/themes/gov-uk/styles/_session-timeout-dialog.scss +0 -121
  179. package/package/frontend/themes/gov-uk/styles/_typography.scss +0 -27
  180. package/package/frontend/themes/gov-uk/styles/_variables.scss +0 -11
  181. package/package/frontend/themes/gov-uk/styles/govuk.scss +0 -43
  182. package/package/frontend/themes/gov-uk/styles/mixins.scss +0 -16
  183. package/package/frontend/themes/gov-uk/styles/modules/_alerts.scss +0 -73
  184. package/package/frontend/themes/gov-uk/styles/modules/_buttons.scss +0 -5
  185. package/package/frontend/themes/gov-uk/styles/modules/_character-count.scss +0 -8
  186. package/package/frontend/themes/gov-uk/styles/modules/_confirm-page.scss +0 -20
  187. package/package/frontend/themes/gov-uk/styles/modules/_lists.scss +0 -5
  188. package/package/frontend/themes/gov-uk/styles/modules/_progressive-reveal.scss +0 -17
  189. package/package/frontend/themes/gov-uk/styles/modules/_validation.scss +0 -51
  190. package/package/frontend/themes/index.js +0 -5
  191. package/package/frontend/toolkit/assets/images/passports/new-window-link-blue.png +0 -0
  192. package/package/frontend/toolkit/assets/images/passports/new-window-link.png +0 -0
  193. package/package/frontend/toolkit/assets/images/spinner.gif +0 -0
  194. package/package/frontend/toolkit/assets/javascript/character-count.js +0 -99
  195. package/package/frontend/toolkit/assets/javascript/form-focus.js +0 -101
  196. package/package/frontend/toolkit/assets/javascript/helpers.js +0 -177
  197. package/package/frontend/toolkit/assets/javascript/progressive-reveal.js +0 -72
  198. package/package/frontend/toolkit/assets/javascript/validation.js +0 -71
  199. package/package/frontend/toolkit/assets/javascript/vendor/details.polyfill.js +0 -189
  200. package/package/frontend/toolkit/assets/javascript/vendor/indexof.polyfill.js +0 -39
  201. package/package/frontend/toolkit/assets/javascript/vendor/safari-cachebuster.js +0 -6
  202. package/package/frontend/toolkit/assets/stylesheets/_base.scss +0 -17
  203. package/package/frontend/toolkit/assets/stylesheets/_helpers.scss +0 -5
  204. package/package/frontend/toolkit/assets/stylesheets/_layout.scss +0 -118
  205. package/package/frontend/toolkit/assets/stylesheets/_typography.scss +0 -27
  206. package/package/frontend/toolkit/assets/stylesheets/_variables.scss +0 -11
  207. package/package/frontend/toolkit/assets/stylesheets/app.scss +0 -30
  208. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_buttons.scss +0 -47
  209. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_details.scss +0 -38
  210. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_elements-typography.scss +0 -175
  211. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_forms.scss +0 -167
  212. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_helpers.scss +0 -39
  213. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_layout.scss +0 -67
  214. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_lists.scss +0 -40
  215. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_panels.scss +0 -29
  216. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_reset.scss +0 -33
  217. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/_tables.scss +0 -33
  218. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-block-labels.scss +0 -63
  219. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-date.scss +0 -39
  220. package/package/frontend/toolkit/assets/stylesheets/govuk-elements/forms/_form-validation.scss +0 -63
  221. package/package/frontend/toolkit/assets/stylesheets/mixins.scss +0 -16
  222. package/package/frontend/toolkit/assets/stylesheets/modules/_alerts.scss +0 -73
  223. package/package/frontend/toolkit/assets/stylesheets/modules/_buttons.scss +0 -5
  224. package/package/frontend/toolkit/assets/stylesheets/modules/_confirm-page.scss +0 -20
  225. package/package/frontend/toolkit/assets/stylesheets/modules/_lists.scss +0 -5
  226. package/package/frontend/toolkit/assets/stylesheets/modules/_progressive-reveal.scss +0 -17
  227. package/package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +0 -51
  228. package/package/frontend/toolkit/index.js +0 -10
  229. package/package/index.js +0 -351
  230. package/package/lib/deindex.js +0 -18
  231. package/package/lib/encryption.js +0 -23
  232. package/package/lib/ga-tag.js +0 -89
  233. package/package/lib/health.js +0 -26
  234. package/package/lib/helpers.js +0 -66
  235. package/package/lib/logger.js +0 -65
  236. package/package/lib/markdown.js +0 -46
  237. package/package/lib/router.js +0 -111
  238. package/package/lib/serve-static.js +0 -12
  239. package/package/lib/sessions.js +0 -82
  240. package/package/lib/settings.js +0 -74
  241. package/package/lib/which.js +0 -28
  242. package/package/middleware/cookies.js +0 -43
  243. package/package/middleware/deep-translate.js +0 -32
  244. package/package/middleware/errors.js +0 -119
  245. package/package/middleware/index.js +0 -10
  246. package/package/middleware/not-found.js +0 -38
  247. package/package/middleware/rate-limiter.js +0 -98
  248. package/package/middleware/service-unavailable.js +0 -64
  249. package/package/model/apis/axios-settings.js +0 -21
  250. package/package/model/apis/html-to-pdf-converter.js +0 -35
  251. package/package/model/apis/index.js +0 -5
  252. package/package/model/index.js +0 -348
  253. package/package/package.json +0 -147
  254. package/package/sandbox/README.md +0 -66
  255. package/package/sandbox/apps/sandbox/behaviours/clear-session.js +0 -8
  256. package/package/sandbox/apps/sandbox/behaviours/country-select.js +0 -10
  257. package/package/sandbox/apps/sandbox/behaviours/international-number.js +0 -22
  258. package/package/sandbox/apps/sandbox/fields.js +0 -128
  259. package/package/sandbox/apps/sandbox/index.js +0 -99
  260. package/package/sandbox/apps/sandbox/lib/staticAppealStages.js +0 -189
  261. package/package/sandbox/apps/sandbox/sections/summary-data-sections.js +0 -43
  262. package/package/sandbox/apps/sandbox/translations/src/en/errors.json +0 -5
  263. package/package/sandbox/apps/sandbox/translations/src/en/exit.json +0 -4
  264. package/package/sandbox/apps/sandbox/translations/src/en/fields.json +0 -101
  265. package/package/sandbox/apps/sandbox/translations/src/en/journey.json +0 -7
  266. package/package/sandbox/apps/sandbox/translations/src/en/pages.json +0 -72
  267. package/package/sandbox/apps/sandbox/translations/src/en/validation.json +0 -54
  268. package/package/sandbox/apps/sandbox/views/form-guidance-link.html +0 -8
  269. package/package/sandbox/apps/sandbox/views/save-and-exit.html +0 -19
  270. package/package/sandbox/assets/images/icons/icon-caret-left.png +0 -0
  271. package/package/sandbox/assets/images/icons/icon-complete.png +0 -0
  272. package/package/sandbox/assets/images/icons/icon-cross-remove-sign.png +0 -0
  273. package/package/sandbox/assets/js/index.js +0 -70
  274. package/package/sandbox/assets/scss/app.scss +0 -27
  275. package/package/sandbox/codecept.conf.js +0 -15
  276. package/package/sandbox/config.js +0 -17
  277. package/package/sandbox/package.json +0 -26
  278. package/package/sandbox/server.js +0 -23
  279. package/package/sandbox/yarn.lock +0 -262
  280. package/package/transpiler/index.js +0 -2
  281. package/package/transpiler/lib/aggregate.js +0 -32
  282. package/package/transpiler/lib/build.js +0 -15
  283. package/package/transpiler/lib/compile.js +0 -12
  284. package/package/transpiler/lib/expand-dirs.js +0 -14
  285. package/package/transpiler/lib/write-files.js +0 -24
  286. package/package/utilities/autofill/index.js +0 -189
  287. package/package/utilities/autofill/inputs.js +0 -60
  288. package/package/utilities/countries.js +0 -12
  289. package/package/utilities/helpers/index.js +0 -189
  290. package/package/utilities/index.js +0 -9
  291. package/package/utilities/reqres/index.js +0 -18
  292. package/package/utilities/test-data/data/domain.json +0 -7
  293. package/package/utilities/test-data/data/firstname.json +0 -16
  294. package/package/utilities/test-data/data/lastname.json +0 -10
  295. package/package/utilities/test-data/data/postcode.json +0 -12
  296. package/package/utilities/test-data/data/streetname.json +0 -8
  297. package/package/utilities/test-data/data/streetsuffix.json +0 -7
  298. package/package/utilities/test-data/data/town.json +0 -9
  299. package/package/utilities/test-data/index.js +0 -67
  300. package/package/wizard/behaviours/complete.js +0 -20
  301. package/package/wizard/behaviours/index.js +0 -5
  302. package/package/wizard/index.js +0 -124
  303. package/package/wizard/middleware/back-links.js +0 -68
  304. package/package/wizard/middleware/check-complete.js +0 -13
  305. package/package/wizard/middleware/check-progress.js +0 -139
  306. package/package/wizard/middleware/check-session.js +0 -17
  307. package/package/wizard/middleware/csrf.js +0 -47
  308. package/package/wizard/middleware/session-model.js +0 -11
  309. package/package/wizard/middleware/session.js +0 -9
  310. package/package/wizard/model.js +0 -29
  311. package/package/wizard/util/constants.js +0 -5
  312. package/package/wizard/util/helpers.js +0 -19
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- /* eslint-disable no-process-exit */
5
- const options = require('minimist')(process.argv.slice(2));
6
- require('../build/')(options)
7
- .catch(e => {
8
- console.error(e.stack);
9
- process.exit(1);
10
- });
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const args = require('minimist')(process.argv.slice(2));
5
- const compile = require('../transpiler/lib/compile');
6
-
7
- const options = {};
8
-
9
- options.sources = args._;
10
- options.shared = args.shared || args.s || [];
11
-
12
- compile(options);
@@ -1,29 +0,0 @@
1
- const local = require('./local');
2
- const resolve = require('./resolver');
3
-
4
- module.exports = function (options) {
5
- const importerOptions = options || {};
6
-
7
- function importer(url, file, done) {
8
- let importerUrl = url;
9
- if (importerOptions.aliases && importerOptions.aliases[importerUrl]) {
10
- importerUrl = importerOptions.aliases[importerUrl];
11
- }
12
-
13
- local(importerUrl, file, function (err, isLocal) {
14
- if (err || isLocal) {
15
- done({ file: importerUrl });
16
- } else {
17
- resolve(importerUrl, file)
18
- .catch(function () { return importerUrl; })
19
- .then(function (path) {
20
- const importerPath = path.replace(/\.css$/, '');
21
- return { file: importerPath };
22
- })
23
- .then(done);
24
- }
25
- });
26
- }
27
-
28
- return importer;
29
- };
@@ -1,35 +0,0 @@
1
- const path = require('path');
2
- const glob = require('glob');
3
-
4
- module.exports = function (url, file, done) {
5
- // if url starts with . or / then assume it's a local/relative path
6
- if (['.', path.sep].indexOf(url.substr(0, 1)) > -1) {
7
- return done(null, true);
8
- }
9
-
10
- // otherwise construct a glob to match possible relative file paths
11
- const basedir = path.dirname(file);
12
-
13
- const bits = url.split(path.sep);
14
-
15
- let filename = bits.pop();
16
- const filepath = bits.join(path.sep);
17
-
18
- // support _ prefixing of filenames
19
- if (filename[0] !== '_') {
20
- filename = '?(_)' + filename;
21
- }
22
-
23
- // match .scss, .sass or .css if the extension is not defined
24
- if (filename.indexOf('.') === -1) {
25
- filename += '.@(sa|c|sc)ss';
26
- }
27
-
28
- const target = path.join(basedir, filepath, filename);
29
-
30
- // test the constructed glob against the file system for possible matches
31
- glob(target, function (err, list) {
32
- done(err, list.length);
33
- });
34
- return null;
35
- };
@@ -1,32 +0,0 @@
1
- const path = require('path');
2
-
3
- function Import(importUrl) {
4
- this.importUrl = importUrl;
5
- }
6
-
7
- Import.prototype.isScoped = function () {
8
- return this.importUrl[0] === '@';
9
- };
10
-
11
- Import.prototype.packageName = function () {
12
- if (this.isScoped()) {
13
- return this.importUrl.split(path.sep, 2).join(path.sep);
14
- }
15
- return this.importUrl.split(path.sep, 1)[0];
16
- };
17
-
18
- Import.prototype.isEntrypoint = function () {
19
- const safePathSplitPattern = new RegExp(path.sep + '.');
20
- const pathSegmentCount = this.importUrl.split(safePathSplitPattern).length;
21
-
22
- if (this.isScoped()) {
23
- return pathSegmentCount === 2;
24
- }
25
- return pathSegmentCount === 1;
26
- };
27
-
28
- Import.prototype.specifiedFilePath = function () {
29
- return this.importUrl.slice(this.packageName().length);
30
- };
31
-
32
- module.exports = Import;
@@ -1,33 +0,0 @@
1
- /* eslint-disable no-console */
2
- const path = require('path');
3
- const findup = require('findup');
4
-
5
- /**
6
- * @param {string} importOriginPath Path of file that made @import reference
7
- */
8
- module.exports = function (packageName, importOriginPath) {
9
- const pathToFind = path.join('node_modules', packageName, 'package.json');
10
- const dirnameOfImportOrigin = path.dirname(importOriginPath);
11
- let handleFoundPath;
12
-
13
- const promise = new Promise(function (resolve, reject) {
14
- handleFoundPath = function (err, nearestPackageParent) {
15
- if (err) {
16
- try {
17
- return resolve(path.dirname(require.resolve(`${packageName}/package.json`)));
18
- } catch (e) {
19
- console.log(e);
20
- }
21
- return reject(err);
22
- }
23
-
24
- const packageJSONLocation = path.join(nearestPackageParent, 'node_modules', packageName);
25
-
26
- return resolve(packageJSONLocation);
27
- };
28
- });
29
-
30
- findup(dirnameOfImportOrigin, pathToFind, handleFoundPath);
31
-
32
- return promise;
33
- };
@@ -1,29 +0,0 @@
1
- const path = require('path');
2
-
3
- function Package(rootPath) {
4
- this.root = path.join.bind(null, rootPath);
5
- this.JSON = require(this.root('package.json'));
6
- }
7
-
8
- Package.prototype.fullPathToEntrypoint = function () {
9
- return this.root(this.entrypoint());
10
- };
11
-
12
- Package.prototype.entrypoint = function () {
13
- if (this.JSON.sass) {
14
- return this.JSON.sass;
15
- // look for "style" declaration in package.json
16
- } else if (this.JSON.style) {
17
- return this.JSON.style;
18
- // look for "styles" declaration in package.json
19
- } else if (this.JSON.styles) {
20
- return this.JSON.styles;
21
- // look for a css/sass/scss file in the "main" declaration in package.json
22
- } else if (/\.(sa|c|sc)ss$/.test(this.JSON.main)) {
23
- return this.JSON.main;
24
- // otherwise assume ./styles.scss
25
- }
26
- return 'styles';
27
- };
28
-
29
- module.exports = Package;
@@ -1,16 +0,0 @@
1
- const Package = require('./resolver/package');
2
- const Import = require('./resolver/import');
3
- const nearestPackageRoot = require('./resolver/nearest-package-root');
4
-
5
- module.exports = function (importUrl, importOriginPath) {
6
- const _import = new Import(importUrl);
7
-
8
- return nearestPackageRoot(_import.packageName(), importOriginPath).then(function (packageRoot) {
9
- const _package = new Package(packageRoot);
10
-
11
- if (_import.isEntrypoint()) {
12
- return _package.fullPathToEntrypoint();
13
- }
14
- return _package.root(_import.specifiedFilePath());
15
- });
16
- };
@@ -1,49 +0,0 @@
1
- /* eslint-disable no-console */
2
- 'use strict';
3
-
4
- const path = require('path');
5
- const merge = require('lodash').merge;
6
- const config = require('../config/builder-defaults');
7
-
8
- module.exports = options => {
9
- const settings = {};
10
-
11
- merge(settings, config);
12
-
13
- // load settings from ./hof.settings.json if it exists
14
- let localConfig;
15
- let hofSettings;
16
- try {
17
- localConfig = path.resolve(process.cwd(), './hof.settings');
18
- hofSettings = require(localConfig).build || {};
19
- hofSettings.theme = require(localConfig).theme;
20
- } catch (e) {
21
- // ignore error for missing config file
22
- }
23
-
24
- if (hofSettings) {
25
- console.log(`Found local config at ${localConfig}`);
26
- merge(settings, hofSettings);
27
- }
28
-
29
- // load override config file if defined
30
- if (options.config) {
31
- merge(settings, require(path.resolve(process.cwd(), options.config)));
32
- }
33
-
34
- settings.production = options.production || process.env.NODE_ENV === 'production';
35
- settings.watchNodeModules = options['watch-node-modules'];
36
- settings.watchDotFiles = options['watch-dotfiles'];
37
- settings.verbose = options.verbose;
38
- settings.env = options.env;
39
-
40
- const task = options._[0] || 'build';
41
-
42
- try {
43
- require.resolve(`./tasks/${task}`);
44
- } catch (e) {
45
- throw new Error(`Unknown task: ${task}`);
46
- }
47
-
48
- return require(`./tasks/${task}`)(settings);
49
- };
@@ -1,36 +0,0 @@
1
- /* eslint-disable no-console */
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- const dotenv = require('dotenv');
6
-
7
- function hasenv(envfile) {
8
- return new Promise(resolve => {
9
- fs.stat(envfile, (err, stat) => err ? resolve(false) : resolve(stat.isFile()));
10
- });
11
- }
12
-
13
- function readenv(envfile) {
14
- return new Promise((resolve, reject) => {
15
- fs.readFile(envfile, (err, data) => err ? reject(err) : resolve(data));
16
- });
17
- }
18
-
19
- function loadenv(envfile, enabled) {
20
- return hasenv(envfile)
21
- .then(exists => {
22
- if (!exists && enabled) {
23
- throw new Error(`No env file could be found at ${envfile}`);
24
- } else if (exists && !enabled) {
25
- console.log(`Local env file found at ${envfile}.`);
26
- console.log('To load variables from this file run with --env.');
27
- } else if (exists && enabled) {
28
- console.log(`Loading variables from env file at ${envfile}`);
29
- return readenv(envfile)
30
- .then(env => dotenv.parse(env));
31
- }
32
- return {};
33
- });
34
- }
35
-
36
- module.exports = loadenv;
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- const path = require('path');
4
- const fs = require('fs');
5
-
6
- module.exports = file => new Promise((resolve, reject) => {
7
- const dir = path.dirname(file);
8
- fs.mkdir(dir, {recursive: true}, err => err ? reject(err) : resolve());
9
- });
@@ -1,17 +0,0 @@
1
- /* eslint-disable no-console */
2
- 'use strict';
3
-
4
- module.exports = (tasks, config) => tasks.reduce((promise, task) => {
5
- const name = task.task || 'unknown';
6
- return promise
7
- .then(() => {
8
- console.log(`Executing task: ${name}`);
9
- return task(config);
10
- })
11
- .then(() => {
12
- console.log(`Completed task: ${name}`);
13
- });
14
- }, Promise.resolve())
15
- .then(() => {
16
- console.log();
17
- });
@@ -1,18 +0,0 @@
1
- /* eslint-disable no-param-reassign */
2
- 'use strict';
3
-
4
- const cp = require('child_process');
5
-
6
- module.exports = (cmd, args) => new Promise((resolve, reject) => {
7
- if (process.env.HOF_SANDBOX === 'true') {
8
- cmd = cmd.replace('node_modules/hof', '..');
9
- }
10
-
11
- const child = cp.spawn(cmd, args, {
12
- cwd: process.cwd(),
13
- stdio: 'inherit',
14
- shell: true
15
- });
16
- child.on('error', reject);
17
- child.on('exit', code => code === 0 ? resolve() : reject(new Error(`${cmd} exited with a non-zero code: ${code}`)));
18
- });
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- const duplexify = require('duplexify');
4
- const spawn = require('child_process').spawn;
5
- const which = require('../../../lib/which');
6
- const bin = which('uglify-js', 'uglifyjs');
7
-
8
- const args = ['--comments', '/copyright|licen(c|s)e/i', '--'];
9
-
10
- function uglify() {
11
- const proc = spawn(bin, args, { stdio: 'pipe' });
12
- return duplexify(proc.stdin, proc.stdout);
13
- }
14
-
15
- module.exports = uglify;
@@ -1,48 +0,0 @@
1
- 'use strict';
2
-
3
- const browserify = require('browserify');
4
- const fs = require('fs');
5
- const path = require('path');
6
- const minify = require('./compress');
7
- const exorcist = require('exorcist');
8
-
9
- const mkdir = require('../../lib/mkdir');
10
-
11
- module.exports = config => {
12
- if (!config.browserify) {
13
- return Promise.resolve();
14
- }
15
-
16
- const out = path.resolve(process.cwd(), config.browserify.out);
17
-
18
- // Enable debug mode (builds source maps) only if not in production
19
- const debugMode = !config.production && config.browserify.debug;
20
-
21
- return mkdir(out)
22
- .then(() => new Promise((resolve, reject) => {
23
- const bundler = browserify(config.browserify.src, {debug: debugMode});
24
- if (config.theme) {
25
- bundler.transform(require('aliasify'), {
26
- aliases: {
27
- $$theme: `hof-theme-${config.theme}`
28
- }
29
- });
30
- }
31
- let stream = bundler.bundle();
32
- if (config.browserify.compress || config.production) {
33
- stream = stream.pipe(minify());
34
- }
35
-
36
- // If debugging, use exorcist to extract a source map
37
- if (debugMode) {
38
- const mapPath = path.join(path.dirname(out), path.basename(out) + '.map');
39
- stream = stream.pipe(exorcist(mapPath));
40
- }
41
-
42
- stream = stream.pipe(fs.createWriteStream(out));
43
-
44
- stream.on('finish', resolve).on('error', reject);
45
- }));
46
- };
47
-
48
- module.exports.task = 'browserify';
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- const tasks = require('../');
4
- const run = require('../../lib/run');
5
-
6
- module.exports = config => run(Object.keys(tasks).map(task => tasks[task]), config);
@@ -1,27 +0,0 @@
1
- /* eslint-disable no-console */
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- const chalk = require('chalk');
6
- const spawn = require('../../lib/spawn');
7
- const mkdir = require('../../lib/mkdir');
8
-
9
- module.exports = config => {
10
- if (!config.images) {
11
- return Promise.resolve();
12
- }
13
-
14
- return new Promise((resolve, reject) => {
15
- fs.stat(config.images.src, err => err ? reject(err) : resolve());
16
- })
17
- .then(() => mkdir(config.images.out))
18
- .then(() => spawn('cp', ['-r', config.images.src, config.images.out]))
19
- .catch(e => {
20
- if (e.code !== 'ENOENT') {
21
- throw e;
22
- } else {
23
- console.log(`${chalk.yellow('warning')}: no images directory found at ${config.images.src}`);
24
- }
25
- });
26
- };
27
- module.exports.task = 'copy images';
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = {
4
- browserify: require('./browserify'),
5
- sass: require('./sass'),
6
- translate: require('./translate'),
7
- images: require('./images')
8
- };
@@ -1,67 +0,0 @@
1
- /* eslint-disable no-console */
2
- 'use strict';
3
-
4
- const fs = require('fs');
5
- const path = require('path');
6
- const sass = require('sass');
7
- const importer = require('../../helpers/importer');
8
- const mkdir = require('../../lib/mkdir');
9
- const hofConfig = require('../../../config/hof-defaults');
10
- const logger = require('../../../lib/logger')(hofConfig);
11
-
12
- module.exports = config => {
13
- if (!config.sass) {
14
- return Promise.resolve();
15
- }
16
-
17
- const out = path.resolve(process.cwd(), config.sass.out);
18
-
19
- return mkdir(out)
20
- .then(() => new Promise((resolve, reject) => {
21
- const aliases = {};
22
-
23
- if (config.theme) {
24
- console.log('Applying theme: ' + config.theme);
25
- aliases.$$theme = `hof-theme-${config.theme}`;
26
- }
27
-
28
- // Build source maps if we are not in production
29
- const createSourceMaps = !config.production && config.sass.sourceMaps;
30
-
31
- sass.render({
32
- file: config.sass.src,
33
- importer: importer({ aliases }),
34
- aliases,
35
- outputStyle: config.sass.outputStyle,
36
- quietDeps: config.sass.quietDeps,
37
- outFile: out,
38
- sourceMap: createSourceMaps
39
- }, (err, result) => err ? reject(err) : resolve(result));
40
- }))
41
- .then(result => {
42
- // Write the compiled CSS to the output file
43
- const writeCss = new Promise((resolve, reject) => {
44
- fs.writeFile(out, result.css, err => err ? reject(err) : resolve());
45
- });
46
-
47
- // If a sourcemap was generated, write it to a separate file
48
- if (result.map) {
49
- const mapPath = path.join(path.dirname(out), path.basename(out) + '.map');
50
- const writeMap = new Promise((resolve, reject) => {
51
- fs.writeFile(mapPath, result.map, err => {
52
- if (err) {
53
- logger.error('Failed to create sourcemap:', err);
54
- reject(err);
55
- } else {
56
- logger.info('Sourcemap created successfully:', mapPath);
57
- resolve();
58
- }
59
- });
60
- });
61
- return Promise.all([writeCss, writeMap]);
62
- }
63
-
64
- return writeCss;
65
- });
66
- };
67
- module.exports.task = 'compile sass';
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- const spawn = require('../../lib/spawn');
4
-
5
- module.exports = config => {
6
- if (!config.translate) {
7
- return Promise.resolve();
8
- }
9
-
10
- const args = [config.translate.src];
11
- if (config.translate.shared) {
12
- const shared = [].concat(config.translate.shared);
13
- shared.forEach(path => {
14
- args.push('--shared', path);
15
- });
16
- }
17
-
18
- return spawn('node_modules/hof/bin/hof-transpiler', args);
19
- };
20
- module.exports.task = 'compile translations';