@schalkneethling/miyagi-core 4.4.2 → 4.4.4

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 (115) hide show
  1. package/README.md +7 -2
  2. package/api/app.js +16 -16
  3. package/api/index.js +263 -262
  4. package/bin/miyagi.js +1 -1
  5. package/dist/css/iframe.css +6 -30
  6. package/frontend/assets/css/iframe/accordion-tabs.css +39 -39
  7. package/frontend/assets/css/iframe/jsontree.js.css +149 -149
  8. package/frontend/assets/css/iframe/prism.css +45 -45
  9. package/frontend/assets/css/iframe/styleguide/colors.css +27 -27
  10. package/frontend/assets/css/iframe/styleguide/fonts.css +23 -23
  11. package/frontend/assets/css/iframe/styleguide/index.css +58 -58
  12. package/frontend/assets/css/iframe/styleguide/spacings.css +10 -10
  13. package/frontend/assets/css/iframe.css +191 -191
  14. package/frontend/assets/css/main/menu/config-switcher.css +21 -21
  15. package/frontend/assets/css/main/menu/config-switchers.css +34 -34
  16. package/frontend/assets/css/main/menu/goto.css +16 -16
  17. package/frontend/assets/css/main/menu/nav.css +49 -49
  18. package/frontend/assets/css/main/menu/search.css +34 -34
  19. package/frontend/assets/css/main/menu/title.css +18 -18
  20. package/frontend/assets/css/main/menu.css +89 -89
  21. package/frontend/assets/css/main/reset.css +47 -47
  22. package/frontend/assets/css/main.css +41 -41
  23. package/frontend/assets/css/shared.css +16 -16
  24. package/frontend/assets/css/tokens.css +108 -107
  25. package/frontend/assets/js/_accordion-tabs.js +392 -392
  26. package/frontend/assets/js/_goto.js +59 -59
  27. package/frontend/assets/js/_iframe-links.js +14 -14
  28. package/frontend/assets/js/_is-triggered.js +3 -3
  29. package/frontend/assets/js/_main.js +369 -369
  30. package/frontend/assets/js/_mock-data.js +8 -8
  31. package/frontend/assets/js/_prism.js +1082 -1081
  32. package/frontend/assets/js/_search.js +186 -186
  33. package/frontend/assets/js/_socket.js +44 -44
  34. package/frontend/assets/js/config-switcher/development-mode.js +38 -38
  35. package/frontend/assets/js/config-switcher/index.js +55 -55
  36. package/frontend/assets/js/config-switcher/text-direction.js +22 -22
  37. package/frontend/assets/js/config-switcher/theme.js +68 -68
  38. package/frontend/assets/js/iframe.build.js +25 -25
  39. package/frontend/assets/js/iframe.js +38 -38
  40. package/frontend/assets/js/jsontree.js +979 -976
  41. package/frontend/assets/js/main.build.js +29 -29
  42. package/frontend/assets/js/main.js +31 -31
  43. package/frontend/assets/js/styleguide/color-converter.js +652 -652
  44. package/frontend/assets/js/styleguide/index.js +100 -100
  45. package/lib/build/index.js +1014 -1020
  46. package/lib/cli/app.js +16 -16
  47. package/lib/cli/component.js +50 -50
  48. package/lib/cli/doctor.js +130 -121
  49. package/lib/cli/drupal-assets.js +163 -157
  50. package/lib/cli/lint.js +196 -196
  51. package/lib/cli/run.js +150 -146
  52. package/lib/config.js +86 -86
  53. package/lib/constants/lint-log-levels.js +6 -6
  54. package/lib/drupal/load-assets-config.js +59 -60
  55. package/lib/drupal/resolve-library-assets.js +132 -141
  56. package/lib/errors.js +20 -20
  57. package/lib/generator/component.js +124 -124
  58. package/lib/generator/mocks.js +156 -156
  59. package/lib/helpers.js +68 -68
  60. package/lib/i18n/en.js +93 -93
  61. package/lib/i18n/index.js +8 -8
  62. package/lib/index.js +13 -13
  63. package/lib/init/args.js +153 -153
  64. package/lib/init/config.js +452 -438
  65. package/lib/init/engines.js +41 -41
  66. package/lib/init/index.js +83 -83
  67. package/lib/init/rendering.js +3 -3
  68. package/lib/init/static.js +90 -90
  69. package/lib/init/twing/cache.js +27 -27
  70. package/lib/init/twing/functions.js +37 -37
  71. package/lib/init/views.js +5 -5
  72. package/lib/logger.js +72 -72
  73. package/lib/mocks/get.js +88 -88
  74. package/lib/mocks/index.js +2 -2
  75. package/lib/mocks/resolve/ref.js +447 -447
  76. package/lib/mocks/resolve/tpl.js +218 -218
  77. package/lib/mocks/resolve.js +154 -154
  78. package/lib/render/helpers/resolve-assets.js +29 -39
  79. package/lib/render/helpers.js +27 -27
  80. package/lib/render/index.js +18 -18
  81. package/lib/render/views/iframe/component.docs.js +50 -50
  82. package/lib/render/views/iframe/component.js +249 -248
  83. package/lib/render/views/iframe/design-tokens/colors.js +38 -38
  84. package/lib/render/views/iframe/design-tokens/index.js +3 -3
  85. package/lib/render/views/iframe/design-tokens/sizes.js +35 -35
  86. package/lib/render/views/iframe/design-tokens/typography.js +37 -37
  87. package/lib/render/views/iframe/docs.js +42 -42
  88. package/lib/render/views/iframe/index.js +28 -28
  89. package/lib/render/views/iframe/variation.js +89 -89
  90. package/lib/render/views/iframe/variation.standalone.js +69 -68
  91. package/lib/render/views/main/component.docs.js +38 -38
  92. package/lib/render/views/main/component.js +55 -55
  93. package/lib/render/views/main/design-tokens.js +38 -38
  94. package/lib/render/views/main/docs.js +33 -33
  95. package/lib/render/views/main/index.js +33 -33
  96. package/lib/state/components.js +99 -99
  97. package/lib/state/css.js +33 -33
  98. package/lib/state/docs.js +72 -72
  99. package/lib/state/file-contents.js +154 -154
  100. package/lib/state/helpers.js +53 -53
  101. package/lib/state/index.js +39 -39
  102. package/lib/state/menu/index.js +202 -202
  103. package/lib/state/menu/structure.js +84 -84
  104. package/lib/state/partials.js +12 -12
  105. package/lib/state/source-tree.js +51 -51
  106. package/lib/styleguide/color-names.js +148 -148
  107. package/lib/styleguide/colors.js +113 -113
  108. package/lib/styleguide/helpers.js +33 -33
  109. package/lib/styleguide/index.js +4 -4
  110. package/lib/styleguide/media-queries.js +18 -18
  111. package/lib/styleguide/spacings.js +22 -22
  112. package/lib/styleguide/typography.js +46 -46
  113. package/lib/validator/mocks.js +110 -83
  114. package/lib/validator/schemas.js +236 -227
  115. package/package.json +120 -117
@@ -9,41 +9,41 @@ import { getSpacings, getMediaQueries } from "../../../../styleguide/index.js";
9
9
  * @param {object} o.cookies
10
10
  */
11
11
  export default async function ({ res, cb, cookies }) {
12
- const spacings = global.state.css
13
- ? getSpacings(
14
- global.state.css,
15
- global.config.assets.customProperties.prefixes.spacing,
16
- )
17
- : [];
18
- const mediaQueries = global.state.css
19
- ? getMediaQueries(global.state.css)
20
- : [];
21
- const themeMode = getThemeMode(cookies);
12
+ const spacings = global.state.css
13
+ ? getSpacings(
14
+ global.state.css,
15
+ global.config.assets.customProperties.prefixes.spacing,
16
+ )
17
+ : [];
18
+ const mediaQueries = global.state.css
19
+ ? getMediaQueries(global.state.css)
20
+ : [];
21
+ const themeMode = getThemeMode(cookies);
22
22
 
23
- await res.render(
24
- "design-tokens/sizes.twig.miyagi",
25
- {
26
- additionalCssFiles: global.config.assets?.customProperties?.files || [],
27
- isBuild: global.config.isBuild,
28
- lang: global.config.ui.lang,
29
- mediaQueries,
30
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
31
- spacings: spacings.length > 0 ? spacings : null,
32
- projectName: config.projectName,
33
- userUiConfig: getUserUiConfig(cookies),
34
- theme: themeMode
35
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
36
- : global.config.ui.theme,
37
- uiTextDirection: global.config.ui.textDirection,
38
- },
39
- (html) => {
40
- if (res.send) {
41
- res.send(html);
42
- }
23
+ await res.render(
24
+ "design-tokens/sizes.twig.miyagi",
25
+ {
26
+ additionalCssFiles: global.config.assets?.customProperties?.files || [],
27
+ isBuild: global.config.isBuild,
28
+ lang: global.config.ui.lang,
29
+ mediaQueries,
30
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
31
+ spacings: spacings.length > 0 ? spacings : null,
32
+ projectName: config.projectName,
33
+ userUiConfig: getUserUiConfig(cookies),
34
+ theme: themeMode
35
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
36
+ : global.config.ui.theme,
37
+ uiTextDirection: global.config.ui.textDirection,
38
+ },
39
+ (html) => {
40
+ if (res.send) {
41
+ res.send(html);
42
+ }
43
43
 
44
- if (cb) {
45
- cb(null, html);
46
- }
47
- },
48
- );
44
+ if (cb) {
45
+ cb(null, html);
46
+ }
47
+ },
48
+ );
49
49
  }
@@ -1,8 +1,8 @@
1
1
  import config from "../../../../default-config.js";
2
2
  import { getUserUiConfig, getThemeMode } from "../../../helpers.js";
3
3
  import {
4
- getTypography,
5
- getMediaQueries,
4
+ getTypography,
5
+ getMediaQueries,
6
6
  } from "../../../../styleguide/index.js";
7
7
 
8
8
  /**
@@ -12,41 +12,41 @@ import {
12
12
  * @param {object} o.cookies
13
13
  */
14
14
  export default async function ({ res, cb, cookies }) {
15
- const typography = global.state.css
16
- ? getTypography(
17
- global.state.css,
18
- global.config.assets.customProperties.prefixes.typo,
19
- )
20
- : [];
21
- const mediaQueries = global.state.css
22
- ? getMediaQueries(global.state.css)
23
- : [];
24
- const themeMode = getThemeMode(cookies);
15
+ const typography = global.state.css
16
+ ? getTypography(
17
+ global.state.css,
18
+ global.config.assets.customProperties.prefixes.typo,
19
+ )
20
+ : [];
21
+ const mediaQueries = global.state.css
22
+ ? getMediaQueries(global.state.css)
23
+ : [];
24
+ const themeMode = getThemeMode(cookies);
25
25
 
26
- await res.render(
27
- "design-tokens/typography.twig.miyagi",
28
- {
29
- additionalCssFiles: global.config.assets?.customProperties?.files || [],
30
- isBuild: global.config.isBuild,
31
- lang: global.config.ui.lang,
32
- mediaQueries,
33
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
34
- typography: typography.length > 0 ? typography : null,
35
- projectName: config.projectName,
36
- userUiConfig: getUserUiConfig(cookies),
37
- theme: themeMode
38
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
39
- : global.config.ui.theme,
40
- uiTextDirection: global.config.ui.textDirection,
41
- },
42
- (html) => {
43
- if (res.send) {
44
- res.send(html);
45
- }
26
+ await res.render(
27
+ "design-tokens/typography.twig.miyagi",
28
+ {
29
+ additionalCssFiles: global.config.assets?.customProperties?.files || [],
30
+ isBuild: global.config.isBuild,
31
+ lang: global.config.ui.lang,
32
+ mediaQueries,
33
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
34
+ typography: typography.length > 0 ? typography : null,
35
+ projectName: config.projectName,
36
+ userUiConfig: getUserUiConfig(cookies),
37
+ theme: themeMode
38
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
39
+ : global.config.ui.theme,
40
+ uiTextDirection: global.config.ui.textDirection,
41
+ },
42
+ (html) => {
43
+ if (res.send) {
44
+ res.send(html);
45
+ }
46
46
 
47
- if (cb) {
48
- cb(null, html);
49
- }
50
- },
51
- );
47
+ if (cb) {
48
+ cb(null, html);
49
+ }
50
+ },
51
+ );
52
52
  }
@@ -10,39 +10,39 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
10
10
  * @param {object} [object.cookies]
11
11
  */
12
12
  export default async function renderIframeDocs({ res, doc, cb, cookies }) {
13
- const fullPath = doc.paths.dir.full;
14
- const shortPath = doc.paths.dir.short;
15
- const componentDocumentation = global.state.fileContents[fullPath];
16
- const componentName = getHeadlineFromFileName(shortPath);
17
- const themeMode = getThemeMode(cookies);
13
+ const fullPath = doc.paths.dir.full;
14
+ const shortPath = doc.paths.dir.short;
15
+ const componentDocumentation = global.state.fileContents[fullPath];
16
+ const componentName = getHeadlineFromFileName(shortPath);
17
+ const themeMode = getThemeMode(cookies);
18
18
 
19
- await res.render(
20
- "iframe_component.twig.miyagi",
21
- {
22
- lang: global.config.ui.lang,
23
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
24
- prod: process.env.NODE_ENV === "production",
25
- projectName: config.projectName,
26
- userProjectName: global.config.projectName,
27
- isBuild: global.config.isBuild,
28
- userUiConfig: getUserUiConfig(cookies),
29
- theme: themeMode
30
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
31
- : global.config.ui.theme,
32
- documentation: componentDocumentation,
33
- name: componentDocumentation?.includes("<h1") ? null : componentName,
34
- uiTextDirection: global.config.ui.textDirection,
35
- },
36
- (html) => {
37
- if (res.send) {
38
- res.send(html);
39
- }
19
+ await res.render(
20
+ "iframe_component.twig.miyagi",
21
+ {
22
+ lang: global.config.ui.lang,
23
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
24
+ prod: process.env.NODE_ENV === "production",
25
+ projectName: config.projectName,
26
+ userProjectName: global.config.projectName,
27
+ isBuild: global.config.isBuild,
28
+ userUiConfig: getUserUiConfig(cookies),
29
+ theme: themeMode
30
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
31
+ : global.config.ui.theme,
32
+ documentation: componentDocumentation,
33
+ name: componentDocumentation?.includes("<h1") ? null : componentName,
34
+ uiTextDirection: global.config.ui.textDirection,
35
+ },
36
+ (html) => {
37
+ if (res.send) {
38
+ res.send(html);
39
+ }
40
40
 
41
- if (cb) {
42
- cb(null, html);
43
- }
44
- },
45
- );
41
+ if (cb) {
42
+ cb(null, html);
43
+ }
44
+ },
45
+ );
46
46
  }
47
47
 
48
48
  /**
@@ -50,19 +50,19 @@ export default async function renderIframeDocs({ res, doc, cb, cookies }) {
50
50
  * @returns {string}
51
51
  */
52
52
  function getHeadlineFromFileName(file) {
53
- if (typeof file !== "string") return "";
53
+ if (typeof file !== "string") return "";
54
54
 
55
- let fileName = file;
55
+ let fileName = file;
56
56
 
57
- if (fileName.startsWith("/")) {
58
- fileName = fileName.slice(1);
59
- }
57
+ if (fileName.startsWith("/")) {
58
+ fileName = fileName.slice(1);
59
+ }
60
60
 
61
- if (file.endsWith("README.md") || file.endsWith("index.md")) {
62
- fileName = path.dirname(fileName);
63
- } else {
64
- fileName = path.basename(fileName, ".md");
65
- }
61
+ if (file.endsWith("README.md") || file.endsWith("index.md")) {
62
+ fileName = path.dirname(fileName);
63
+ } else {
64
+ fileName = path.basename(fileName, ".md");
65
+ }
66
66
 
67
- return fileName.replaceAll("-", " ");
67
+ return fileName.replaceAll("-", " ");
68
68
  }
@@ -10,35 +10,35 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
10
10
  * @returns {Promise}
11
11
  */
12
12
  export default async function renderIframeIndex({ res, cb, cookies }) {
13
- const documentation =
14
- global.state.fileContents[helpers.getFullPathFromShortPath("README.md")];
13
+ const documentation =
14
+ global.state.fileContents[helpers.getFullPathFromShortPath("README.md")];
15
15
 
16
- const themeMode = getThemeMode(cookies);
16
+ const themeMode = getThemeMode(cookies);
17
17
 
18
- await res.render(
19
- "iframe_index.twig.miyagi",
20
- {
21
- lang: global.config.ui.lang,
22
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
23
- prod: process.env.NODE_ENV === "production",
24
- projectName: config.projectName,
25
- userProjectName: global.config.projectName,
26
- isBuild: global.config.isBuild,
27
- userUiConfig: getUserUiConfig(cookies),
28
- theme: themeMode
29
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
30
- : global.config.ui.theme,
31
- documentation,
32
- uiTextDirection: global.config.ui.textDirection,
33
- },
34
- (html) => {
35
- if (res.send) {
36
- res.send(html);
37
- }
18
+ await res.render(
19
+ "iframe_index.twig.miyagi",
20
+ {
21
+ lang: global.config.ui.lang,
22
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
23
+ prod: process.env.NODE_ENV === "production",
24
+ projectName: config.projectName,
25
+ userProjectName: global.config.projectName,
26
+ isBuild: global.config.isBuild,
27
+ userUiConfig: getUserUiConfig(cookies),
28
+ theme: themeMode
29
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
30
+ : global.config.ui.theme,
31
+ documentation,
32
+ uiTextDirection: global.config.ui.textDirection,
33
+ },
34
+ (html) => {
35
+ if (res.send) {
36
+ res.send(html);
37
+ }
38
38
 
39
- if (cb) {
40
- cb(null, html);
41
- }
42
- },
43
- );
39
+ if (cb) {
40
+ cb(null, html);
41
+ }
42
+ },
43
+ );
44
44
  }
@@ -16,101 +16,101 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
16
16
  * @returns {Promise} gets resolved when the variation has been rendered
17
17
  */
18
18
  export default async function renderIframeVariation({
19
- res,
20
- component,
21
- variation,
22
- cb,
23
- cookies,
24
- data,
19
+ res,
20
+ component,
21
+ variation,
22
+ cb,
23
+ cookies,
24
+ data,
25
25
  }) {
26
- const rawComponentData = (data && data.raw) ?? null;
27
- const componentData = (data && data.resolved) ?? null;
28
- const themeMode = getThemeMode(cookies);
26
+ const rawComponentData = (data && data.raw) ?? null;
27
+ const componentData = (data && data.resolved) ?? null;
28
+ const themeMode = getThemeMode(cookies);
29
29
 
30
- const validatedMocks = validateMocks(component, [
31
- {
32
- resolved: componentData,
33
- name: variation,
34
- },
35
- ]);
30
+ const validatedMocks = validateMocks(component, [
31
+ {
32
+ resolved: componentData,
33
+ name: variation,
34
+ },
35
+ ]);
36
36
 
37
- let standaloneUrl;
37
+ let standaloneUrl;
38
38
 
39
- if (global.config.isBuild) {
40
- standaloneUrl = `component-${helpers.normalizeString(
41
- path.dirname(component.paths.tpl.short),
42
- )}-variation-${helpers.normalizeString(variation)}.html`;
43
- } else {
44
- standaloneUrl = `/component?file=${path.dirname(
45
- component.paths.tpl.short,
46
- )}&variation=${encodeURIComponent(variation)}`;
47
- }
39
+ if (global.config.isBuild) {
40
+ standaloneUrl = `component-${helpers.normalizeString(
41
+ path.dirname(component.paths.tpl.short),
42
+ )}-variation-${helpers.normalizeString(variation)}.html`;
43
+ } else {
44
+ standaloneUrl = `/component?file=${path.dirname(
45
+ component.paths.tpl.short,
46
+ )}&variation=${encodeURIComponent(variation)}`;
47
+ }
48
48
 
49
- const mockValidation = validatedMocks
50
- ? {
51
- valid: validatedMocks.length === 0,
52
- copy: t(
53
- `validator.mocks.${validatedMocks.length === 0 ? "valid" : "invalid"}`,
54
- ),
55
- }
56
- : null;
57
- const fileContents = {
58
- mocks: {
59
- type: global.config.files.mocks.extension[0],
60
- },
61
- };
49
+ const mockValidation = validatedMocks
50
+ ? {
51
+ valid: validatedMocks.length === 0,
52
+ copy: t(
53
+ `validator.mocks.${validatedMocks.length === 0 ? "valid" : "invalid"}`,
54
+ ),
55
+ }
56
+ : null;
57
+ const fileContents = {
58
+ mocks: {
59
+ type: global.config.files.mocks.extension[0],
60
+ },
61
+ };
62
62
 
63
- return new Promise((resolve, reject) => {
64
- global.app.render(
65
- component.paths.tpl.full,
66
- componentData ?? {},
67
- async (error, result) => {
68
- if (error) {
69
- if (global.config.isBuild) {
70
- if (cb) {
71
- cb(error);
72
- }
73
- } else {
74
- reject(error);
75
- }
76
- } else if (res) {
77
- await res.render(
78
- "iframe_component_variation.twig.miyagi",
79
- {
80
- html: result,
81
- standaloneUrl,
82
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
83
- prod: process.env.NODE_ENV === "production",
84
- projectName: config.projectName,
85
- isBuild: global.config.isBuild,
86
- userUiConfig: getUserUiConfig(cookies),
87
- theme: themeMode
88
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
89
- : global.config.ui.theme,
90
- mockData: JSON.stringify(rawComponentData),
91
- mockDataResolved: JSON.stringify(componentData),
92
- variation,
93
- normalizedVariation: helpers.normalizeString(variation),
94
- mockValidation,
95
- mocks: fileContents.mocks,
96
- uiTextDirection: global.config.ui.textDirection,
97
- },
98
- (html) => {
99
- if (res.send) {
100
- res.send(html);
101
- }
63
+ return new Promise((resolve, reject) => {
64
+ global.app.render(
65
+ component.paths.tpl.full,
66
+ componentData ?? {},
67
+ async (error, result) => {
68
+ if (error) {
69
+ if (global.config.isBuild) {
70
+ if (cb) {
71
+ cb(error);
72
+ }
73
+ } else {
74
+ reject(error);
75
+ }
76
+ } else if (res) {
77
+ await res.render(
78
+ "iframe_component_variation.twig.miyagi",
79
+ {
80
+ html: result,
81
+ standaloneUrl,
82
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
83
+ prod: process.env.NODE_ENV === "production",
84
+ projectName: config.projectName,
85
+ isBuild: global.config.isBuild,
86
+ userUiConfig: getUserUiConfig(cookies),
87
+ theme: themeMode
88
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
89
+ : global.config.ui.theme,
90
+ mockData: JSON.stringify(rawComponentData),
91
+ mockDataResolved: JSON.stringify(componentData),
92
+ variation,
93
+ normalizedVariation: helpers.normalizeString(variation),
94
+ mockValidation,
95
+ mocks: fileContents.mocks,
96
+ uiTextDirection: global.config.ui.textDirection,
97
+ },
98
+ (html) => {
99
+ if (res.send) {
100
+ res.send(html);
101
+ }
102
102
 
103
- if (cb) {
104
- cb(null, html);
105
- }
106
- },
107
- );
103
+ if (cb) {
104
+ cb(null, html);
105
+ }
106
+ },
107
+ );
108
108
 
109
- resolve();
110
- } else {
111
- resolve(result);
112
- }
113
- },
114
- );
115
- });
109
+ resolve();
110
+ } else {
111
+ resolve(result);
112
+ }
113
+ },
114
+ );
115
+ });
116
116
  }