MyRepo-Ums/node_modules/@angular/ssr/fesm2022/ssr.mjs.map

1 line
26 KiB
Plaintext
Raw Normal View History

2024-01-19 10:09:11 +00:00
{"version":3,"file":"ssr.mjs","sources":["../../../../../../k8-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/inline-css-processor.mjs","../../../../../../k8-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/peformance-profiler.mjs","../../../../../../k8-fastbuild-ST-70f2edae98f4/bin/packages/angular/ssr/src/common-engine.mjs"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport Critters from 'critters';\nimport { readFile } from 'node:fs/promises';\n/**\n * Pattern used to extract the media query set by Critters in an `onload` handler.\n */\nconst MEDIA_SET_HANDLER_PATTERN = /^this\\.media=[\"'](.*)[\"'];?$/;\n/**\n * Name of the attribute used to save the Critters media query so it can be re-assigned on load.\n */\nconst CSP_MEDIA_ATTR = 'ngCspMedia';\n/**\n * Script text used to change the media value of the link tags.\n */\nconst LINK_LOAD_SCRIPT_CONTENT = [\n `(() => {`,\n // Save the `children` in a variable since they're a live DOM node collection.\n // We iterate over the direct descendants, instead of going through a `querySelectorAll`,\n // because we know that the tags will be directly inside the `head`.\n ` const children = document.head.children;`,\n // Declare `onLoad` outside the loop to avoid leaking memory.\n // Can't be an arrow function, because we need `this` to refer to the DOM node.\n ` function onLoad() {this.media = this.getAttribute('${CSP_MEDIA_ATTR}');}`,\n // Has to use a plain for loop, because some browsers don't support\n // `forEach` on `children` which is a `HTMLCollection`.\n ` for (let i = 0; i < children.length; i++) {`,\n ` const child = children[i];`,\n ` child.hasAttribute('${CSP_MEDIA_ATTR}') && child.addEventListener('load', onLoad);`,\n ` }`,\n `})();`,\n].join('\\n');\nclass CrittersExtended extends Critters {\n optionsExtended;\n resourceCache;\n warnings = [];\n errors = [];\n initialEmbedLinkedStylesheet;\n addedCspScriptsDocuments = new WeakSet();\n documentNonces = new WeakMap();\n constructor(optionsExtended, resourceCache) {\n super({\n logger: {\n warn: (s) => this.warnings.push(s),\n error: (s) => this.errors.push(s),\n info: () => { },\n },\n logLevel: 'warn',\n path: optionsExtended.outputPath,\n publicPath: optionsExtended.deployUrl,\n compress: !!optionsExtended.minify,\n pruneSource: false,\n reduceInlineStyles: false,\n mergeStylesheets: false,\n // Note: if `preload` changes to anything other than `media`, the logic in\n // `embedLinkedStylesheetOverride` will have to be updated.\n preload: 'media',\n noscriptFallback: true,\n inlineFonts: true,\n });\n this.optionsExtended = optionsExtended;\n this.resourceCache = resourceCache;\n // We can't use inheritance to override `embedLinkedStylesheet`, because it's not declared in\n // the `Critters` .d.ts which means that we can't call the `super` implementation. TS doesn't\n // allow for `super` to be cast to a different type.\n this.initialEmbedLinkedStylesheet = this.embedLinkedStylesheet;\n this.embedLinkedStylesheet = this.embedLinkedStylesheetOverride;\n }\n async readFile(path) {\n let resourceContent = this.resourceCache.get(path);\n if (resourceContent === undefined) {\n resourceContent = await readFile(path, 'utf-8');\n this.resourceCache.set(path, resourceContent);\n }\n return resourceContent;\n }\n /**\n * Override of the Critters `embedLinkedStylesheet` method\n * that makes it work with Angular's CSP APIs.\n */\n embedLinkedStylesheetOverride = async (link, document) => {\n if (link.getAttribut