amphora-html 6.0.0-3 → 6.0.0-6
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/.envrc +1 -1
- package/lib/media.js +6 -22
- package/package.json +1 -1
- package/.vscode/.history/amphora-html/lib/media.test_20210527151433.js +0 -797
- package/.vscode/.history/amphora-html/lib/media.test_20210607095503.js +0 -815
- package/.vscode/.history/amphora-html/lib/media.test_20210607095544.js +0 -815
- package/.vscode/.history/amphora-html/lib/media.test_20210607100025.js +0 -817
- package/.vscode/.history/amphora-html/lib/media.test_20210607100402.js +0 -817
- package/.vscode/.history/amphora-html/lib/media.test_20210607100635.js +0 -829
- package/.vscode/.history/amphora-html/lib/media.test_20210607105251.js +0 -852
- package/.vscode/.history/amphora-html/lib/media.test_20210607120734.js +0 -839
- package/.vscode/.history/amphora-html/lib/media.test_20210607121735.js +0 -873
- package/.vscode/.history/amphora-html/lib/media.test_20210608203514.js +0 -908
- package/.vscode/.history/amphora-html/lib/media_20210511135806.js +0 -434
- package/.vscode/.history/amphora-html/lib/media_20210512105948.js +0 -434
- package/.vscode/.history/amphora-html/lib/media_20210512110245.js +0 -434
- package/.vscode/.history/amphora-html/lib/media_20210512114913.js +0 -434
- package/.vscode/.history/amphora-html/lib/media_20210512114917.js +0 -434
- package/.vscode/.history/amphora-html/lib/media_20210512122725.js +0 -429
- package/.vscode/.history/amphora-html/lib/media_20210512123057.js +0 -429
- package/.vscode/.history/amphora-html/lib/media_20210512123102.js +0 -429
- package/.vscode/.history/amphora-html/lib/media_20210512123201.js +0 -429
- package/.vscode/.history/amphora-html/lib/media_20210512152244.js +0 -429
- package/.vscode/.history/amphora-html/lib/media_20210512152536.js +0 -433
- package/.vscode/.history/amphora-html/lib/media_20210512152541.js +0 -433
- package/.vscode/.history/amphora-html/lib/media_20210512152717.js +0 -433
- package/.vscode/.history/amphora-html/lib/media_20210512152931.js +0 -419
- package/.vscode/.history/amphora-html/lib/media_20210512152949.js +0 -420
- package/.vscode/.history/amphora-html/lib/media_20210512152958.js +0 -418
- package/.vscode/.history/amphora-html/lib/media_20210512155619.js +0 -418
- package/.vscode/.history/amphora-html/lib/media_20210512164028.js +0 -418
- package/.vscode/.history/amphora-html/lib/media_20210512170157.js +0 -418
- package/.vscode/.history/amphora-html/lib/media_20210512171030.js +0 -418
- package/.vscode/.history/amphora-html/lib/media_20210607085451.js +0 -454
- package/.vscode/.history/amphora-html/lib/media_20210607085550.js +0 -454
- package/.vscode/.history/amphora-html/lib/media_20210607095350.js +0 -454
- package/.vscode/.history/amphora-html/lib/media_20210607121609.js +0 -455
- package/.vscode/.history/amphora-html/lib/media_20210607121656.js +0 -455
- package/.vscode/.history/amphora-html/lib/media_20210607121742.js +0 -455
- package/.vscode/.history/amphora-html/lib/media_20210608203406.js +0 -454
- package/.vscode/.history/amphora-html/package_20210607131602.json +0 -62
- package/.vscode/.history/amphora-html/package_20210607131617.json +0 -62
- package/.vscode/.history/amphora-html/package_20210608210629.json +0 -62
package/.envrc
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
use node
|
|
1
|
+
use node 14
|
|
2
2
|
layout node
|
package/lib/media.js
CHANGED
|
@@ -332,15 +332,10 @@ function getManifestAssets(state) {
|
|
|
332
332
|
return [];
|
|
333
333
|
}
|
|
334
334
|
|
|
335
|
-
const
|
|
335
|
+
const entrypoints = _.get(manifest, 'entrypoints', []);
|
|
336
|
+
const scriptFiles = _.flatMap(entrypoints, entrypoint => _.get(entrypoint, 'assets.js', []));
|
|
336
337
|
|
|
337
|
-
|
|
338
|
-
const assets = _.get(manifest, ['entrypoints', component, 'assets', 'js'], []);
|
|
339
|
-
|
|
340
|
-
return components.concat(assets);
|
|
341
|
-
}, []);
|
|
342
|
-
|
|
343
|
-
return _.union(runtime, scriptFiles).map(script => url.resolve(assetHost, script));
|
|
338
|
+
return scriptFiles.map(script => url.resolve(assetHost, script));
|
|
344
339
|
}
|
|
345
340
|
|
|
346
341
|
/**
|
|
@@ -413,28 +408,17 @@ function injectScriptsAndStyles(state) {
|
|
|
413
408
|
|
|
414
409
|
if (!locals.edit) {
|
|
415
410
|
mediaMap.styles = combineFileContents(mediaMap.styles, 'public/css', '/css/', STYLE_TAG);
|
|
416
|
-
mediaMap.scripts =
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
// is ready, setting the `async` attribute, the `defer` attribute, or
|
|
420
|
-
// both. Because the order in which they're parsed and executed currently
|
|
421
|
-
// matters, we can't do that safely.
|
|
422
|
-
mediaMap.manifestAssets = injectTags(mediaMap.manifestAssets, locals.site, SCRIPT_TAG);
|
|
411
|
+
mediaMap.scripts = !!mediaMap.manifestAssets && mediaMap.manifestAssets.length > 0
|
|
412
|
+
? injectTags(mediaMap.manifestAssets, locals.site, DEFER_SCRIPT_TAG)
|
|
413
|
+
: combineFileContents(mediaMap.scripts, 'public/js', '/js/', SCRIPT_TAG);
|
|
423
414
|
} else {
|
|
424
415
|
mediaMap.styles = module.exports.editStylesTags ? injectTags(mediaMap.styles, locals.site, STYLE_TAG) : combineFileContents(mediaMap.styles, 'public/css', '/css/', STYLE_TAG);
|
|
425
416
|
mediaMap.scripts = module.exports.editScriptsTags ? injectTags(mediaMap.scripts, locals.site, SCRIPT_TAG) : combineFileContents(mediaMap.scripts, 'public/js', '/js/', SCRIPT_TAG);
|
|
426
|
-
|
|
427
|
-
// FIXME: Some of the logic which excludes client-side scripts from edit
|
|
428
|
-
// mode sits with nymag/sites, in the `resolve-media` module, and some
|
|
429
|
-
// lives here. Since we're currently not using Webpack for Kiln and model
|
|
430
|
-
// assets, this feels like the best place to null out client scripts.
|
|
431
|
-
mediaMap.manifestAssets = null;
|
|
432
417
|
}
|
|
433
418
|
|
|
434
419
|
return bluebird.props(mediaMap)
|
|
435
420
|
.then(combinedFiles => {
|
|
436
421
|
html = combinedFiles.styles ? appendMediaToTop(combinedFiles.styles, html) : html; // If there are styles, append them
|
|
437
|
-
html = combinedFiles.manifestAssets ? appendMediaToBottom(combinedFiles.manifestAssets, html) : html; // If there are assets registered with the manifest, append them
|
|
438
422
|
html = combinedFiles.scripts ? appendMediaToBottom(combinedFiles.scripts, html) : html; // If there are scripts, append them
|
|
439
423
|
return html; // Return the compiled HTML
|
|
440
424
|
});
|