source: imaps-frontend/node_modules/webpack/lib/runtime/CreateScriptUrlRuntimeModule.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 959 bytes
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3*/
4
5"use strict";
6
7const RuntimeGlobals = require("../RuntimeGlobals");
8const Template = require("../Template");
9const HelperRuntimeModule = require("./HelperRuntimeModule");
10
11/** @typedef {import("../Compilation")} Compilation */
12
13class CreateScriptUrlRuntimeModule extends HelperRuntimeModule {
14 constructor() {
15 super("trusted types script url");
16 }
17
18 /**
19 * @returns {string | null} runtime code
20 */
21 generate() {
22 const compilation = /** @type {Compilation} */ (this.compilation);
23 const { runtimeTemplate, outputOptions } = compilation;
24 const { trustedTypes } = outputOptions;
25 const fn = RuntimeGlobals.createScriptUrl;
26
27 return Template.asString(
28 `${fn} = ${runtimeTemplate.returningFunction(
29 trustedTypes
30 ? `${RuntimeGlobals.getTrustedTypesPolicy}().createScriptURL(url)`
31 : "url",
32 "url"
33 )};`
34 );
35 }
36}
37
38module.exports = CreateScriptUrlRuntimeModule;
Note: See TracBrowser for help on using the repository browser.