@mindful-web/marko-web 1.0.0
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.
- package/.eslintignore +3 -0
- package/LICENSE +21 -0
- package/browser/.eslintrc.js +1 -0
- package/browser/components/element-id.js +1 -0
- package/browser/components/gated-download/wufoo.vue +97 -0
- package/browser/components/image-slide.vue +54 -0
- package/browser/components/image-slider.vue +87 -0
- package/browser/components/index.js +15 -0
- package/browser/components/load-more-trigger.vue +129 -0
- package/browser/components/oembed.vue +133 -0
- package/browser/components/trigger-in-view-event.vue +41 -0
- package/browser/components/trigger-screen-change-event.vue +94 -0
- package/browser/event-bus.js +5 -0
- package/browser/index.js +83 -0
- package/browser/jquery-full.js +3 -0
- package/browser/jquery.js +3 -0
- package/browser/utils/clean-path.js +4 -0
- package/browser/vue.js +3 -0
- package/components/browser-component/script.marko +10 -0
- package/components/browser-component/script.marko.js +39 -0
- package/components/browser-component.marko +25 -0
- package/components/browser-component.marko.js +75 -0
- package/components/deferred-stylesheet.marko +6 -0
- package/components/deferred-stylesheet.marko.js +28 -0
- package/components/document/components/body-wrapper.marko +8 -0
- package/components/document/components/body-wrapper.marko.js +33 -0
- package/components/document/components/error.marko +26 -0
- package/components/document/components/error.marko.js +88 -0
- package/components/document/components/live-reload.marko +7 -0
- package/components/document/components/live-reload.marko.js +30 -0
- package/components/document/components/polyfill.marko +8 -0
- package/components/document/components/polyfill.marko.js +33 -0
- package/components/document/components/styles.marko +20 -0
- package/components/document/components/styles.marko.js +61 -0
- package/components/document/container.marko +15 -0
- package/components/document/container.marko.js +54 -0
- package/components/document/index.marko +63 -0
- package/components/document/index.marko.js +139 -0
- package/components/document/marko.json +46 -0
- package/components/element/array.marko +19 -0
- package/components/element/array.marko.js +67 -0
- package/components/element/audio.marko +5 -0
- package/components/element/audio.marko.js +33 -0
- package/components/element/block.marko +11 -0
- package/components/element/block.marko.js +44 -0
- package/components/element/clear.marko +4 -0
- package/components/element/clear.marko.js +32 -0
- package/components/element/components/image.marko +32 -0
- package/components/element/components/image.marko.js +62 -0
- package/components/element/components/text.marko +11 -0
- package/components/element/components/text.marko.js +37 -0
- package/components/element/content/address1.marko +14 -0
- package/components/element/content/address1.marko.js +40 -0
- package/components/element/content/address2.marko +14 -0
- package/components/element/content/address2.marko.js +40 -0
- package/components/element/content/audio.marko +13 -0
- package/components/element/content/audio.marko.js +39 -0
- package/components/element/content/authors.marko +12 -0
- package/components/element/content/authors.marko.js +43 -0
- package/components/element/content/body.marko +28 -0
- package/components/element/content/body.marko.js +66 -0
- package/components/element/content/byline.marko +15 -0
- package/components/element/content/byline.marko.js +41 -0
- package/components/element/content/city-state-zip.marko +14 -0
- package/components/element/content/city-state-zip.marko.js +40 -0
- package/components/element/content/contributors.marko +12 -0
- package/components/element/content/contributors.marko.js +43 -0
- package/components/element/content/country.marko +14 -0
- package/components/element/content/country.marko.js +40 -0
- package/components/element/content/embed-code.marko +15 -0
- package/components/element/content/embed-code.marko.js +41 -0
- package/components/element/content/end-date.marko +17 -0
- package/components/element/content/end-date.marko.js +43 -0
- package/components/element/content/ends.marko +14 -0
- package/components/element/content/ends.marko.js +40 -0
- package/components/element/content/fax.marko +14 -0
- package/components/element/content/fax.marko.js +40 -0
- package/components/element/content/images.marko +12 -0
- package/components/element/content/images.marko.js +43 -0
- package/components/element/content/marko.json +328 -0
- package/components/element/content/mobile.marko +14 -0
- package/components/element/content/mobile.marko.js +40 -0
- package/components/element/content/name.marko +15 -0
- package/components/element/content/name.marko.js +41 -0
- package/components/element/content/phone.marko +14 -0
- package/components/element/content/phone.marko.js +40 -0
- package/components/element/content/photographers.marko +12 -0
- package/components/element/content/photographers.marko.js +43 -0
- package/components/element/content/public-email.marko +19 -0
- package/components/element/content/public-email.marko.js +47 -0
- package/components/element/content/published.marko +17 -0
- package/components/element/content/published.marko.js +43 -0
- package/components/element/content/short-name.marko +15 -0
- package/components/element/content/short-name.marko.js +41 -0
- package/components/element/content/sidebar-stubs.marko +24 -0
- package/components/element/content/sidebar-stubs.marko.js +63 -0
- package/components/element/content/sidebars.marko +27 -0
- package/components/element/content/sidebars.marko.js +63 -0
- package/components/element/content/source.marko +14 -0
- package/components/element/content/source.marko.js +40 -0
- package/components/element/content/sponsors.marko +12 -0
- package/components/element/content/sponsors.marko.js +43 -0
- package/components/element/content/start-date.marko +17 -0
- package/components/element/content/start-date.marko.js +43 -0
- package/components/element/content/starts.marko +14 -0
- package/components/element/content/starts.marko.js +40 -0
- package/components/element/content/teaser.marko +15 -0
- package/components/element/content/teaser.marko.js +41 -0
- package/components/element/content/title.marko +14 -0
- package/components/element/content/title.marko.js +40 -0
- package/components/element/content/tollfree.marko +14 -0
- package/components/element/content/tollfree.marko.js +40 -0
- package/components/element/content/transcript.marko +22 -0
- package/components/element/content/transcript.marko.js +53 -0
- package/components/element/content/website.marko +22 -0
- package/components/element/content/website.marko.js +51 -0
- package/components/element/date.marko +2 -0
- package/components/element/date.marko.js +27 -0
- package/components/element/extract-render.js +1 -0
- package/components/element/image/caption.marko +15 -0
- package/components/element/image/caption.marko.js +41 -0
- package/components/element/image/credit.marko +15 -0
- package/components/element/image/credit.marko.js +41 -0
- package/components/element/image/display-name.marko +14 -0
- package/components/element/image/display-name.marko.js +40 -0
- package/components/element/image/marko.json +38 -0
- package/components/element/image/slider.marko +18 -0
- package/components/element/image/slider.marko.js +50 -0
- package/components/element/img.marko +12 -0
- package/components/element/img.marko.js +43 -0
- package/components/element/index.marko +12 -0
- package/components/element/index.marko.js +47 -0
- package/components/element/link.marko +25 -0
- package/components/element/link.marko.js +54 -0
- package/components/element/magazine-issue/description.marko +14 -0
- package/components/element/magazine-issue/description.marko.js +40 -0
- package/components/element/magazine-issue/digital-edition-url.marko +22 -0
- package/components/element/magazine-issue/digital-edition-url.marko.js +51 -0
- package/components/element/magazine-issue/marko.json +42 -0
- package/components/element/magazine-issue/name.marko +14 -0
- package/components/element/magazine-issue/name.marko.js +40 -0
- package/components/element/magazine-issue/pdf-url.marko +22 -0
- package/components/element/magazine-issue/pdf-url.marko.js +51 -0
- package/components/element/magazine-publication/cancel-url.marko +22 -0
- package/components/element/magazine-publication/cancel-url.marko.js +51 -0
- package/components/element/magazine-publication/change-address-url.marko +22 -0
- package/components/element/magazine-publication/change-address-url.marko.js +51 -0
- package/components/element/magazine-publication/description.marko +14 -0
- package/components/element/magazine-publication/description.marko.js +40 -0
- package/components/element/magazine-publication/einquiry-url.marko +22 -0
- package/components/element/magazine-publication/einquiry-url.marko.js +51 -0
- package/components/element/magazine-publication/marko.json +82 -0
- package/components/element/magazine-publication/name.marko +14 -0
- package/components/element/magazine-publication/name.marko.js +40 -0
- package/components/element/magazine-publication/renewal-url.marko +22 -0
- package/components/element/magazine-publication/renewal-url.marko.js +51 -0
- package/components/element/magazine-publication/reprints-url.marko +22 -0
- package/components/element/magazine-publication/reprints-url.marko.js +51 -0
- package/components/element/magazine-publication/subscribe-url.marko +22 -0
- package/components/element/magazine-publication/subscribe-url.marko.js +51 -0
- package/components/element/marko.json +211 -0
- package/components/element/obj-array.marko +17 -0
- package/components/element/obj-array.marko.js +56 -0
- package/components/element/obj-audio.marko +20 -0
- package/components/element/obj-audio.marko.js +50 -0
- package/components/element/obj-date.marko +25 -0
- package/components/element/obj-date.marko.js +55 -0
- package/components/element/obj-nodes.marko +20 -0
- package/components/element/obj-nodes.marko.js +62 -0
- package/components/element/obj-text.marko +23 -0
- package/components/element/obj-text.marko.js +53 -0
- package/components/element/obj.marko +23 -0
- package/components/element/obj.marko.js +61 -0
- package/components/element/object-link.js +49 -0
- package/components/element/object-type.js +9 -0
- package/components/element/picture.marko +38 -0
- package/components/element/picture.marko.js +85 -0
- package/components/element/show-element.js +8 -0
- package/components/element/text.marko +37 -0
- package/components/element/text.marko.js +76 -0
- package/components/element/website-section/description.marko +16 -0
- package/components/element/website-section/description.marko.js +44 -0
- package/components/element/website-section/hierarchy.marko +19 -0
- package/components/element/website-section/hierarchy.marko.js +60 -0
- package/components/element/website-section/marko.json +31 -0
- package/components/element/website-section/name.marko +18 -0
- package/components/element/website-section/name.marko.js +46 -0
- package/components/font/google.marko +6 -0
- package/components/font/google.marko.js +41 -0
- package/components/font/link.marko +14 -0
- package/components/font/link.marko.js +45 -0
- package/components/font/marko.json +21 -0
- package/components/font/typekit.marko +5 -0
- package/components/font/typekit.marko.js +38 -0
- package/components/load-more/index.marko +53 -0
- package/components/load-more/index.marko.js +119 -0
- package/components/load-more/marko.json +30 -0
- package/components/load-more/trigger.marko +11 -0
- package/components/load-more/trigger.marko.js +40 -0
- package/components/marko.json +37 -0
- package/components/node/body.marko +40 -0
- package/components/node/body.marko.js +112 -0
- package/components/node/element.marko +6 -0
- package/components/node/element.marko.js +39 -0
- package/components/node/footer.marko +19 -0
- package/components/node/footer.marko.js +63 -0
- package/components/node/header.marko +19 -0
- package/components/node/header.marko.js +63 -0
- package/components/node/image-inner-wrapper.marko +61 -0
- package/components/node/image-inner-wrapper.marko.js +116 -0
- package/components/node/image-wrapper.marko +34 -0
- package/components/node/image-wrapper.marko.js +98 -0
- package/components/node/image.marko +51 -0
- package/components/node/image.marko.js +93 -0
- package/components/node/index.marko +35 -0
- package/components/node/index.marko.js +100 -0
- package/components/node/marko.json +189 -0
- package/components/node/utils/image-height.js +3 -0
- package/components/node/utils/image-values.js +17 -0
- package/components/node-list/body.marko +19 -0
- package/components/node-list/body.marko.js +50 -0
- package/components/node-list/element.marko +3 -0
- package/components/node-list/element.marko.js +35 -0
- package/components/node-list/footer.marko +19 -0
- package/components/node-list/footer.marko.js +50 -0
- package/components/node-list/header.marko +19 -0
- package/components/node-list/header.marko.js +50 -0
- package/components/node-list/index.marko +36 -0
- package/components/node-list/index.marko.js +93 -0
- package/components/node-list/marko.json +121 -0
- package/components/node-list/node.marko +15 -0
- package/components/node-list/node.marko.js +49 -0
- package/components/node-list/nodes.marko +82 -0
- package/components/node-list/nodes.marko.js +126 -0
- package/components/page/container.marko +13 -0
- package/components/page/container.marko.js +46 -0
- package/components/page/description.marko +4 -0
- package/components/page/description.marko.js +26 -0
- package/components/page/image.marko +50 -0
- package/components/page/image.marko.js +122 -0
- package/components/page/layouts/content.marko +23 -0
- package/components/page/layouts/content.marko.js +63 -0
- package/components/page/layouts/default.marko +20 -0
- package/components/page/layouts/default.marko.js +61 -0
- package/components/page/layouts/dynamic-page.marko +19 -0
- package/components/page/layouts/dynamic-page.marko.js +59 -0
- package/components/page/layouts/magazine-issue.marko +19 -0
- package/components/page/layouts/magazine-issue.marko.js +59 -0
- package/components/page/layouts/magazine-publication.marko +19 -0
- package/components/page/layouts/magazine-publication.marko.js +59 -0
- package/components/page/layouts/marko.json +86 -0
- package/components/page/layouts/website-section.marko +25 -0
- package/components/page/layouts/website-section.marko.js +78 -0
- package/components/page/marko.json +93 -0
- package/components/page/metadata/components/common.marko +54 -0
- package/components/page/metadata/components/common.marko.js +117 -0
- package/components/page/metadata/content.marko +147 -0
- package/components/page/metadata/content.marko.js +216 -0
- package/components/page/metadata/default.marko +2 -0
- package/components/page/metadata/default.marko.js +29 -0
- package/components/page/metadata/dynamic-page.marko +40 -0
- package/components/page/metadata/dynamic-page.marko.js +84 -0
- package/components/page/metadata/google-structured-data/content.js +138 -0
- package/components/page/metadata/magazine-issue.marko +39 -0
- package/components/page/metadata/magazine-issue.marko.js +83 -0
- package/components/page/metadata/magazine-publication.marko +35 -0
- package/components/page/metadata/magazine-publication.marko.js +79 -0
- package/components/page/metadata/marko.json +32 -0
- package/components/page/metadata/website-section.marko +48 -0
- package/components/page/metadata/website-section.marko.js +92 -0
- package/components/page/rel-canonical.marko +13 -0
- package/components/page/rel-canonical.marko.js +42 -0
- package/components/page/title.marko +18 -0
- package/components/page/title.marko.js +46 -0
- package/components/page/wrapper.marko +16 -0
- package/components/page/wrapper.marko.js +63 -0
- package/components/resolve/marko.json +6 -0
- package/components/resolve/page.marko +10 -0
- package/components/resolve/page.marko.js +49 -0
- package/components/rss/marko.json +10 -0
- package/components/rss/website-section.marko +17 -0
- package/components/rss/website-section.marko.js +46 -0
- package/config/abstract-config.js +42 -0
- package/config/core.js +48 -0
- package/config/site.js +6 -0
- package/express/apollo.js +34 -0
- package/express/asset-loader.js +55 -0
- package/express/cdn.js +27 -0
- package/express/css-loader.js +117 -0
- package/express/embedded-media.js +31 -0
- package/express/error-handlers.js +113 -0
- package/express/find-content-alias.js +30 -0
- package/express/get-redirect.js +44 -0
- package/express/graphql-proxy.js +17 -0
- package/express/index.js +153 -0
- package/express/json-error-handler.js +30 -0
- package/express/load-document.js +3 -0
- package/express/load-more.js +6 -0
- package/express/load-object.js +10 -0
- package/express/oembed.js +18 -0
- package/express/rss.js +19 -0
- package/express/sitemaps.js +16 -0
- package/express/website-context.js +19 -0
- package/index.js +8 -0
- package/integration/test-website-boot.js +198 -0
- package/marko.json +6 -0
- package/middleware/disabled-features.js +15 -0
- package/middleware/index.js +15 -0
- package/middleware/page-node/index.js +45 -0
- package/middleware/page-node/resolved.js +26 -0
- package/middleware/with-content.js +54 -0
- package/middleware/with-dynamic-page.js +37 -0
- package/middleware/with-load-more.js +9 -0
- package/middleware/with-magazine-issue.js +24 -0
- package/middleware/with-magazine-publication.js +24 -0
- package/middleware/with-website-section.js +47 -0
- package/package.json +64 -0
- package/scss/carousel.scss +42 -0
- package/scss/document.scss +55 -0
- package/scss/fonts/alata-fallback.scss +7 -0
- package/scss/fonts/alegreya-fallback.scss +6 -0
- package/scss/fonts/arimo-fallback.scss +7 -0
- package/scss/fonts/fira-sans-fallback.scss +7 -0
- package/scss/fonts/ibm-plex-sans-fallback.scss +7 -0
- package/scss/fonts/informapro-fallback.scss +6 -0
- package/scss/fonts/lato-fallback.scss +7 -0
- package/scss/fonts/manrope-fallback.scss +6 -0
- package/scss/fonts/merriweather-fallback.scss +7 -0
- package/scss/fonts/montserrat-fallback.scss +7 -0
- package/scss/fonts/open-sans-condensed-fallback.scss +6 -0
- package/scss/fonts/open-sans-fallback.scss +7 -0
- package/scss/fonts/oswald-fallback.scss +7 -0
- package/scss/fonts/poppins-fallback.scss +6 -0
- package/scss/fonts/pt-sans-fallback.scss +6 -0
- package/scss/fonts/pt-serif-fallback.scss +6 -0
- package/scss/fonts/public-sans-fallback.scss +7 -0
- package/scss/fonts/raleway-fallback.scss +6 -0
- package/scss/fonts/roboto-condensed-fallback.scss +7 -0
- package/scss/fonts/roboto-fallback.scss +7 -0
- package/scss/fonts/roboto-slab-fallback.scss +7 -0
- package/scss/fonts/solitaire-mvb-pro-fallback.scss +6 -0
- package/scss/fonts/source-sans-4-fallback.scss +7 -0
- package/scss/fonts/source-serif-pro-fallback.scss +7 -0
- package/scss/fonts/synthese-fallback.scss +6 -0
- package/scss/fonts/zilla-slab-fallback.scss +6 -0
- package/scss/load-more.scss +3 -0
- package/scss/node-list.scss +144 -0
- package/scss/node.scss +371 -0
- package/scss/page-image.scss +15 -0
- package/start-server.js +169 -0
- package/utils/apply-query-params.js +16 -0
- package/utils/build-content-input.js +9 -0
- package/utils/build-marko-global.js +1 -0
- package/utils/default-value.js +1 -0
- package/utils/embedded-media/facebook-oembed.js +50 -0
- package/utils/embedded-media/image.js +71 -0
- package/utils/embedded-media/index.js +8 -0
- package/utils/embedded-media/instagram-oembed.js +57 -0
- package/utils/embedded-media/oembed.js +18 -0
- package/utils/hierarchy-aliases.js +3 -0
- package/utils/hierarchy-ids.js +3 -0
- package/utils/index.js +11 -0
- package/utils/is-dev.js +1 -0
- package/utils/published-content/description.js +1 -0
- package/utils/render-ssr-component-from-marko.js +18 -0
- package/utils/render-ssr-component.js +15 -0
- package/utils/should-collapse.js +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getAsArray } from "@mindful-web/object-path";
|
|
2
|
+
|
|
3
|
+
$ const blockName = input.blockName || "page-wrapper";
|
|
4
|
+
$ const tag = input.tag || "div";
|
|
5
|
+
$ const sections = getAsArray(input.sections);
|
|
6
|
+
|
|
7
|
+
$ const modifiers = [...getAsArray(input.modifiers)];
|
|
8
|
+
$ const classNames = [blockName, ...modifiers.map(mod => `${blockName}--${mod}`), input.class];
|
|
9
|
+
|
|
10
|
+
<if(sections.length)>
|
|
11
|
+
<${tag} ...input.attrs class=classNames>
|
|
12
|
+
<for|section| of=sections>
|
|
13
|
+
<marko-web-element ...section block-name=blockName name="section" />
|
|
14
|
+
</for>
|
|
15
|
+
</>
|
|
16
|
+
</if>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web$1.0.0/components/page/wrapper.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
8
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
9
|
+
getAsArray = module_objectPath_module.getAsArray,
|
|
10
|
+
marko_forOf = require("marko/dist/runtime/helpers/for-of"),
|
|
11
|
+
marko_assign = require("marko/dist/runtime/helpers/assign"),
|
|
12
|
+
marko_web_element_template = require("../element/index.marko"),
|
|
13
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
14
|
+
marko_web_element_tag = marko_loadTag(marko_web_element_template),
|
|
15
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag");
|
|
16
|
+
|
|
17
|
+
function render(input, out, __component, component, state) {
|
|
18
|
+
var data = input;
|
|
19
|
+
|
|
20
|
+
const blockName = input.blockName || "page-wrapper";
|
|
21
|
+
|
|
22
|
+
const tag = input.tag || "div";
|
|
23
|
+
|
|
24
|
+
const sections = getAsArray(input.sections);
|
|
25
|
+
|
|
26
|
+
const modifiers = [...getAsArray(input.modifiers)];
|
|
27
|
+
|
|
28
|
+
const classNames = [blockName, ...modifiers.map(mod => `${blockName}--${mod}`), input.class];
|
|
29
|
+
|
|
30
|
+
if (sections.length) {
|
|
31
|
+
marko_dynamicTag(out, tag, function() {
|
|
32
|
+
return marko_assign({}, input.attrs, {
|
|
33
|
+
class: classNames
|
|
34
|
+
});
|
|
35
|
+
}, function(out) {
|
|
36
|
+
var $for$0 = 0;
|
|
37
|
+
|
|
38
|
+
marko_forOf(sections, function(section) {
|
|
39
|
+
var $keyScope$0 = "[" + (($for$0++) + "]");
|
|
40
|
+
|
|
41
|
+
marko_web_element_tag(marko_assign({
|
|
42
|
+
name: "default",
|
|
43
|
+
tag: "div"
|
|
44
|
+
}, section, {
|
|
45
|
+
blockName: blockName,
|
|
46
|
+
name: "section"
|
|
47
|
+
}), out, __component, "1" + $keyScope$0);
|
|
48
|
+
});
|
|
49
|
+
}, null, null, __component, "0");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
marko_template._ = marko_renderer(render, {
|
|
54
|
+
d_: true,
|
|
55
|
+
e_: marko_componentType
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
marko_template.meta = {
|
|
59
|
+
id: "/@mindful-web/marko-web$1.0.0/components/page/wrapper.marko",
|
|
60
|
+
tags: [
|
|
61
|
+
"../element/index.marko"
|
|
62
|
+
]
|
|
63
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isFunction } from "@mindful-web/utils";
|
|
2
|
+
import { getAsObject } from "@mindful-web/object-path";
|
|
3
|
+
|
|
4
|
+
$ const node = getAsObject(input, "node");
|
|
5
|
+
|
|
6
|
+
<if(isFunction(node.load))>
|
|
7
|
+
<marko-web-resolve|{ resolved }| promise=node.load()>
|
|
8
|
+
<${input.renderBody} resolved=resolved data=resolved.data />
|
|
9
|
+
</marko-web-resolve>
|
|
10
|
+
</if>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web$1.0.0/components/resolve/page.marko",
|
|
6
|
+
marko_component = require("./page.marko"),
|
|
7
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
8
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
9
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
10
|
+
isFunction = module_utils_module.isFunction,
|
|
11
|
+
module_objectPath_module = require("@mindful-web/object-path"),
|
|
12
|
+
objectPath_module = module_objectPath_module.default || module_objectPath_module,
|
|
13
|
+
getAsObject = module_objectPath_module.getAsObject,
|
|
14
|
+
marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
|
|
15
|
+
marko_web_resolve_template = require("@mindful-web/marko-core/components/resolve.marko"),
|
|
16
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
17
|
+
marko_web_resolve_tag = marko_loadTag(marko_web_resolve_template);
|
|
18
|
+
|
|
19
|
+
function render(input, out, __component, component, state) {
|
|
20
|
+
var data = input;
|
|
21
|
+
|
|
22
|
+
const node = getAsObject(input, "node");
|
|
23
|
+
|
|
24
|
+
if (isFunction(node.load)) {
|
|
25
|
+
marko_web_resolve_tag({
|
|
26
|
+
promise: node.load(),
|
|
27
|
+
renderBody: function(out, { resolved }) {
|
|
28
|
+
marko_dynamicTag(out, input.renderBody, function() {
|
|
29
|
+
return {
|
|
30
|
+
resolved: resolved,
|
|
31
|
+
data: resolved.data
|
|
32
|
+
};
|
|
33
|
+
}, null, null, null, __component, "1");
|
|
34
|
+
}
|
|
35
|
+
}, out, __component, "0");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
marko_template._ = marko_renderer(render, {
|
|
40
|
+
e_: marko_componentType
|
|
41
|
+
}, marko_component);
|
|
42
|
+
|
|
43
|
+
marko_template.meta = {
|
|
44
|
+
id: "/@mindful-web/marko-web$1.0.0/components/resolve/page.marko",
|
|
45
|
+
component: "./page.marko",
|
|
46
|
+
tags: [
|
|
47
|
+
"@mindful-web/marko-core/components/resolve.marko"
|
|
48
|
+
]
|
|
49
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { URLSearchParams } from "url";
|
|
2
|
+
|
|
3
|
+
$ const { config } = out.global;
|
|
4
|
+
|
|
5
|
+
$ const { queryName, queryParams, channelParams } = input;
|
|
6
|
+
$ const defaultTitle = input.name ? `RSS Feed for ${input.name}` : "RSS Feed";
|
|
7
|
+
$ const title = input.title || defaultTitle;
|
|
8
|
+
|
|
9
|
+
$ const query = new URLSearchParams();
|
|
10
|
+
$ query.append("input", JSON.stringify(queryParams));
|
|
11
|
+
$ if (channelParams) query.append("channel", JSON.stringify(channelParams));
|
|
12
|
+
|
|
13
|
+
$ const href = `${config.rssMountPoint()}/${queryName}.xml?${query}`;
|
|
14
|
+
|
|
15
|
+
<if(queryName)>
|
|
16
|
+
<link rel="alternate" type="application/rss+xml" title=title href=href />
|
|
17
|
+
</if>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web$1.0.0/components/rss/website-section.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_url_module = require("url"),
|
|
8
|
+
url_module = module_url_module.default || module_url_module,
|
|
9
|
+
URLSearchParams = module_url_module.URLSearchParams,
|
|
10
|
+
marko_attr = require("marko/dist/runtime/html/helpers/attr");
|
|
11
|
+
|
|
12
|
+
function render(input, out, __component, component, state) {
|
|
13
|
+
var data = input;
|
|
14
|
+
|
|
15
|
+
const { config } = out.global;
|
|
16
|
+
|
|
17
|
+
const { queryName, queryParams, channelParams } = input;
|
|
18
|
+
|
|
19
|
+
const defaultTitle = input.name ? `RSS Feed for ${input.name}` : "RSS Feed";
|
|
20
|
+
|
|
21
|
+
const title = input.title || defaultTitle;
|
|
22
|
+
|
|
23
|
+
const query = new URLSearchParams();
|
|
24
|
+
|
|
25
|
+
query.append("input", JSON.stringify(queryParams));
|
|
26
|
+
|
|
27
|
+
if (channelParams) query.append("channel", JSON.stringify(channelParams));
|
|
28
|
+
|
|
29
|
+
const href = `${config.rssMountPoint()}/${queryName}.xml?${query}`;
|
|
30
|
+
|
|
31
|
+
if (queryName) {
|
|
32
|
+
out.w("<link rel=\"alternate\" type=\"application/rss+xml\"" +
|
|
33
|
+
marko_attr("title", title) +
|
|
34
|
+
marko_attr("href", href) +
|
|
35
|
+
">");
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
marko_template._ = marko_renderer(render, {
|
|
40
|
+
d_: true,
|
|
41
|
+
e_: marko_componentType
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
marko_template.meta = {
|
|
45
|
+
id: "/@mindful-web/marko-web$1.0.0/components/rss/website-section.marko"
|
|
46
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const {
|
|
2
|
+
get,
|
|
3
|
+
getAsArray,
|
|
4
|
+
getAsObject,
|
|
5
|
+
} = require('@mindful-web/object-path');
|
|
6
|
+
|
|
7
|
+
class AbstractConfig {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {object} config
|
|
11
|
+
*/
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @param {string} path
|
|
19
|
+
* @param {*} def
|
|
20
|
+
*/
|
|
21
|
+
get(path, def) {
|
|
22
|
+
return get(this.config, path, def);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param {string} path
|
|
28
|
+
*/
|
|
29
|
+
getAsArray(path) {
|
|
30
|
+
return getAsArray(this.config, path);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
* @param {string} path
|
|
36
|
+
*/
|
|
37
|
+
getAsObject(path) {
|
|
38
|
+
return getAsObject(this.config, path);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = AbstractConfig;
|
package/config/core.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const { get } = require('@mindful-web/object-path');
|
|
2
|
+
const AbstractConfig = require('./abstract-config');
|
|
3
|
+
|
|
4
|
+
class CoreConfig extends AbstractConfig {
|
|
5
|
+
setWebsiteContext(context) {
|
|
6
|
+
this.websiteContext = context;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
website(path, def) {
|
|
10
|
+
return get(this.websiteContext, path, def);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use this.website('language.code') instead
|
|
15
|
+
*/
|
|
16
|
+
locale() {
|
|
17
|
+
return this.website('language.code', 'en-us');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
lazyloadImages() {
|
|
21
|
+
return this.get('images.lazyload', true);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fallbackImage() {
|
|
25
|
+
return this.get('images.fallback');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
loadMoreMountPoint() {
|
|
29
|
+
return this.get('loadMore.mountPoint', '/__load-more');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
oembedMountPoint() {
|
|
33
|
+
return this.get('oembed.mountPoint', '/__oembed');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
rssMountPoint() {
|
|
37
|
+
return this.get('rss.mountPoint', '/__rss');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use this.website('name') instead
|
|
42
|
+
*/
|
|
43
|
+
siteName() {
|
|
44
|
+
return this.website('name', '');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = CoreConfig;
|
package/config/site.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { apolloClient } = require('@mindful-web/express-apollo');
|
|
2
|
+
const { parseBooleanHeader } = require('@mindful-web/utils');
|
|
3
|
+
const pkg = require('../package.json');
|
|
4
|
+
|
|
5
|
+
const { MINDFUL_NAMESPACE } = process.env;
|
|
6
|
+
|
|
7
|
+
module.exports = (app, uri, config = {}) => {
|
|
8
|
+
/**
|
|
9
|
+
* Force sets GraphQL cache headers when cookies are present on the site.
|
|
10
|
+
* This can either force enable cache when globally disabled, or force disable cache
|
|
11
|
+
* when globally enabled.
|
|
12
|
+
*/
|
|
13
|
+
const contextFn = ({ req }) => {
|
|
14
|
+
const headers = ['x-cache-site-context', 'x-cache-responses'].reduce((o, key) => {
|
|
15
|
+
const value = req.query[key] || req.cookies[key];
|
|
16
|
+
if (!value) return o; // do nothing if no cookie or query param is set.
|
|
17
|
+
// otherwise parse the value and set the GraphQL header to match.
|
|
18
|
+
return { ...o, [key]: parseBooleanHeader(value) };
|
|
19
|
+
}, {
|
|
20
|
+
'x-marko-web-request': JSON.stringify({
|
|
21
|
+
id: req.id,
|
|
22
|
+
env: process.env.NODE_ENV || 'unknonwn',
|
|
23
|
+
ua: req.get('user-agent'),
|
|
24
|
+
origin: `${req.protocol}://${req.get('host')}`,
|
|
25
|
+
path: req.path,
|
|
26
|
+
query: req.query,
|
|
27
|
+
}),
|
|
28
|
+
...(MINDFUL_NAMESPACE && { 'x-namespace': MINDFUL_NAMESPACE }),
|
|
29
|
+
'user-agent': `marko-web-express-apollo/${pkg.version} via node-fetch/1.0`,
|
|
30
|
+
});
|
|
31
|
+
return { headers };
|
|
32
|
+
};
|
|
33
|
+
app.use(apolloClient(uri, config, config.link, contextFn));
|
|
34
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { readFile } = require('fs').promises;
|
|
3
|
+
const { asyncRoute } = require('@mindful-web/utils');
|
|
4
|
+
|
|
5
|
+
const readManifest = async (loc) => {
|
|
6
|
+
try {
|
|
7
|
+
const contents = await readFile(loc, 'utf8');
|
|
8
|
+
return JSON.parse(contents);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
if (e.code === 'ENOENT') return null;
|
|
11
|
+
throw e;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const getRelPathFromManifest = async ({ distDir, type, entry }) => {
|
|
16
|
+
const file = path.resolve(distDir, type, 'manifest.json');
|
|
17
|
+
const manifest = await readManifest(file);
|
|
18
|
+
if (!manifest) throw new Error(`Unable to load the asset manifest for type ${type}`);
|
|
19
|
+
|
|
20
|
+
const asset = manifest[entry];
|
|
21
|
+
if (!asset) throw new Error(`Unable to extract an asset for type ${type} using manifest entry ${entry}`);
|
|
22
|
+
return `${type}/${asset.file}`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
26
|
+
const types = [
|
|
27
|
+
{ type: 'js', entry: 'browser/index.js' },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
module.exports = ({ distDir }) => asyncRoute(async (req, res, next) => {
|
|
31
|
+
const { cdn } = res.locals;
|
|
32
|
+
const { app } = req;
|
|
33
|
+
|
|
34
|
+
if (!app.locals.assets) app.locals.assets = {};
|
|
35
|
+
const { assets } = app.locals;
|
|
36
|
+
|
|
37
|
+
// when on production, only load the file paths from the manifest once
|
|
38
|
+
// as long as the cdn configs are the same (allows for changing the cdn env var in prod)
|
|
39
|
+
if (isProduction && assets.files && assets.cdn === cdn.enabled) return next();
|
|
40
|
+
|
|
41
|
+
// get file paths from manifests
|
|
42
|
+
const rels = await Promise.all(types.map(async ({ type, entry }) => {
|
|
43
|
+
const rel = await getRelPathFromManifest({ distDir, type, entry });
|
|
44
|
+
return { type, rel };
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
assets.files = rels.reduce((map, { type, rel }) => {
|
|
48
|
+
const href = cdn.dist(rel);
|
|
49
|
+
map.set(type, [href]);
|
|
50
|
+
return map;
|
|
51
|
+
}, new Map());
|
|
52
|
+
assets.cdn = cdn.enabled;
|
|
53
|
+
|
|
54
|
+
return next();
|
|
55
|
+
});
|
package/express/cdn.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { cleanPath } = require('@mindful-web/utils');
|
|
2
|
+
|
|
3
|
+
module.exports = ({ enabled = false, origin, siteVersion } = {}) => (req, res, next) => {
|
|
4
|
+
const { config, tenantKey } = req.app.locals;
|
|
5
|
+
const url = `${cleanPath(origin)}/web-assets/${tenantKey}/${config.website('id')}/v${siteVersion}`;
|
|
6
|
+
|
|
7
|
+
const key = '__cdn';
|
|
8
|
+
const values = new Set(['true', '1']);
|
|
9
|
+
let isEnabled = enabled;
|
|
10
|
+
if (values.has(req.query[key])) isEnabled = true;
|
|
11
|
+
if (values.has(req.cookies[key])) isEnabled = true;
|
|
12
|
+
|
|
13
|
+
res.locals.cdn = {
|
|
14
|
+
enabled: isEnabled,
|
|
15
|
+
origin,
|
|
16
|
+
url,
|
|
17
|
+
dist: (path) => {
|
|
18
|
+
const cleaned = `dist/${cleanPath(path)}`;
|
|
19
|
+
return isEnabled ? `${url}/${cleaned}` : `/${cleaned}`;
|
|
20
|
+
},
|
|
21
|
+
public: (path) => {
|
|
22
|
+
const cleaned = cleanPath(path);
|
|
23
|
+
return isEnabled ? `${url}/public/${cleaned}` : `/${cleaned}`;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
next();
|
|
27
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { readFile } = require('fs').promises;
|
|
3
|
+
const { readFileSync } = require('fs');
|
|
4
|
+
const { asyncRoute } = require('@mindful-web/utils');
|
|
5
|
+
|
|
6
|
+
const modes = new Set(['main', 'purged', 'optimized', 'critical']);
|
|
7
|
+
|
|
8
|
+
const readManifest = async (loc) => {
|
|
9
|
+
try {
|
|
10
|
+
const contents = await readFile(loc, 'utf8');
|
|
11
|
+
return JSON.parse(contents);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
if (e.code === 'ENOENT') return null;
|
|
14
|
+
throw e;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {import("@mindful-web/web-cli/build/utils/css.js")
|
|
20
|
+
* .WrittenCSSOutputAsset} WrittenCSSOutputAsset
|
|
21
|
+
*
|
|
22
|
+
* @param {object} params
|
|
23
|
+
* @param {string} params.distDir
|
|
24
|
+
* @returns {Promise<WrittenCSSOutputAsset[]>}
|
|
25
|
+
*/
|
|
26
|
+
const loadManifestEntries = async ({ distDir }) => {
|
|
27
|
+
const file = path.resolve(distDir, 'css', 'manifest.json');
|
|
28
|
+
const manifest = await readManifest(file);
|
|
29
|
+
if (!manifest) throw new Error('Unable to load the CSS asset manifest');
|
|
30
|
+
return Object.keys(manifest).map((key) => {
|
|
31
|
+
const asset = { key, ...manifest[key] };
|
|
32
|
+
return asset;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
37
|
+
|
|
38
|
+
module.exports = ({ distDir }) => asyncRoute(async (req, res, next) => {
|
|
39
|
+
const { cdn } = res.locals;
|
|
40
|
+
const { app } = req;
|
|
41
|
+
if (!app.locals.css) app.locals.css = {};
|
|
42
|
+
const { css } = app.locals;
|
|
43
|
+
|
|
44
|
+
// determine the current CSS mode
|
|
45
|
+
// use the env first and fallback to main (all).
|
|
46
|
+
let mode = process.env.CSS_MODE || 'main';
|
|
47
|
+
if (!modes.has(mode)) mode = 'main';
|
|
48
|
+
|
|
49
|
+
// then allow the request query or a cookie to override this.
|
|
50
|
+
const key = '__css';
|
|
51
|
+
if (modes.has(req.query[key])) {
|
|
52
|
+
mode = req.query[key];
|
|
53
|
+
} else if (modes.has(req.cookies[key])) {
|
|
54
|
+
mode = req.cookies[key];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// always set the mode to the app on every request.
|
|
58
|
+
css.mode = mode;
|
|
59
|
+
|
|
60
|
+
// when on production, only load the file paths and/or contents from the manifest once
|
|
61
|
+
// as long as the cdn configs are the same (allows for changing the cdn env var in prod)
|
|
62
|
+
if (isProduction && css.ready && css.cdn === cdn.enabled) return next();
|
|
63
|
+
|
|
64
|
+
css.cdn = cdn.enabled;
|
|
65
|
+
|
|
66
|
+
const items = await loadManifestEntries({ distDir });
|
|
67
|
+
const files = items.reduce((map, asset) => {
|
|
68
|
+
if (asset.embedded) return map;
|
|
69
|
+
map.set(asset.key, cdn.dist(`css/${asset.file}`));
|
|
70
|
+
return map;
|
|
71
|
+
}, new Map());
|
|
72
|
+
css.files = files;
|
|
73
|
+
|
|
74
|
+
const embeddable = items.reduce((map, asset) => {
|
|
75
|
+
if (!asset.embedded) return map;
|
|
76
|
+
map.set(asset.key, path.resolve(distDir, 'css', asset.file));
|
|
77
|
+
return map;
|
|
78
|
+
}, new Map());
|
|
79
|
+
css.embeddable = embeddable;
|
|
80
|
+
|
|
81
|
+
css.main = () => files.get('main');
|
|
82
|
+
css.purged = () => files.get('purged');
|
|
83
|
+
|
|
84
|
+
css.optimized = ({ kind, type } = {}) => {
|
|
85
|
+
// attempt to load the optimized file from most to least specific.
|
|
86
|
+
const keys = [];
|
|
87
|
+
if (kind && type) keys.push(`optimized-${kind}.${type}`);
|
|
88
|
+
if (kind) keys.push(`optimized-${kind}`);
|
|
89
|
+
keys.push('optimized');
|
|
90
|
+
|
|
91
|
+
return keys.reduce((file, k) => {
|
|
92
|
+
if (file) return file;
|
|
93
|
+
return files.get(k) || null;
|
|
94
|
+
}, null);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
css.critical = ({ kind, type } = {}) => {
|
|
98
|
+
// attempt to load the critical file from most to least specific.
|
|
99
|
+
const keys = [];
|
|
100
|
+
if (kind && type) keys.push(`critical-${kind}.${type}`);
|
|
101
|
+
if (kind) keys.push(`critical-${kind}`);
|
|
102
|
+
keys.push('critical');
|
|
103
|
+
|
|
104
|
+
const critical = keys.reduce((file, k) => {
|
|
105
|
+
if (file) return file;
|
|
106
|
+
return embeddable.get(k) || null;
|
|
107
|
+
}, null);
|
|
108
|
+
if (!critical) return null;
|
|
109
|
+
// @todo determine if this should read contents all the time or store in memory?
|
|
110
|
+
const contents = readFileSync(critical, 'utf8');
|
|
111
|
+
return `/* ${critical.split('/').pop()} */ ${contents}`;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
css.ready = true;
|
|
115
|
+
|
|
116
|
+
return next();
|
|
117
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const { isFunction: isFn } = require('@mindful-web/utils');
|
|
2
|
+
const { extractEmbeddedTags } = require('@mindful-web/embedded-media');
|
|
3
|
+
const buildMarkoGlobal = require('../utils/build-marko-global');
|
|
4
|
+
const { imageHandler, oembedHandler, invalidHandler } = require('../utils/embedded-media');
|
|
5
|
+
|
|
6
|
+
module.exports = (app, { image, oembed, invalid } = {}) => {
|
|
7
|
+
const handlers = {
|
|
8
|
+
image: isFn(image) ? image : imageHandler,
|
|
9
|
+
oembed: isFn(oembed) ? oembed : oembedHandler,
|
|
10
|
+
invalid: isFn(invalid) ? invalid : invalidHandler,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line no-param-reassign
|
|
14
|
+
app.locals.parseEmbeddedMedia = (body, res, options, lazyloadFirstImage = true) => {
|
|
15
|
+
const $global = buildMarkoGlobal(res);
|
|
16
|
+
|
|
17
|
+
const replacements = extractEmbeddedTags(body).map((tag, index) => {
|
|
18
|
+
const type = ['image', 'oembed'].includes(tag.type) && tag.isValid() ? tag.type : 'invalid';
|
|
19
|
+
const pattern = tag.getRegExp();
|
|
20
|
+
const replacementOptions = (index === 0 && type === 'image' && !lazyloadFirstImage) ? { ...options, lazyloadImages: false } : options;
|
|
21
|
+
const replacement = handlers[type](tag, $global, replacementOptions);
|
|
22
|
+
return { pattern, replacement };
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
let parsed = body;
|
|
26
|
+
replacements.forEach(({ pattern, replacement }) => {
|
|
27
|
+
parsed = parsed.replace(pattern, replacement);
|
|
28
|
+
});
|
|
29
|
+
return parsed;
|
|
30
|
+
};
|
|
31
|
+
};
|