MCPcopy
hub / github.com/ampproject/amphtml / calculateEntryPointScriptUrl

Function calculateEntryPointScriptUrl

src/service/extension-script.js:83–98  ·  view source on GitHub ↗
(
  location,
  entryPoint,
  isLocalDev,
  opt_rtv
)

Source from the content-addressed store, hash-verified

81 * @return {string}
82 */
83export function calculateEntryPointScriptUrl(
84 location,
85 entryPoint,
86 isLocalDev,
87 opt_rtv
88) {
89 const fileExtension = mode.isEsm() ? '.mjs' : '.js';
90 const base = calculateScriptBaseUrl(location, isLocalDev);
91 if (isLocalDev) {
92 return `${base}/${entryPoint}${fileExtension}`;
93 }
94 if (opt_rtv) {
95 return `${base}/rtv/${getMode().rtvVersion}/${entryPoint}${fileExtension}`;
96 }
97 return `${base}/${entryPoint}${fileExtension}`;
98}
99
100/**
101 * Parse the extension version from a given script URL.

Callers 2

constructorMethod · 0.90

Calls 2

getModeFunction · 0.90
calculateScriptBaseUrlFunction · 0.85

Tested by

no test coverage detected