source: frontend/node_modules/workbox-build/src/lib/get-source-map-url.ts

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 781 bytes
Line 
1/*
2 Copyright 2022 Google LLC
3
4 Use of this source code is governed by an MIT-style
5 license that can be found in the LICENSE file or at
6 https://opensource.org/licenses/MIT.
7*/
8
9// Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js
10// See https://github.com/GoogleChrome/workbox/issues/3019
11const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
12const regex = RegExp(
13 '(?:' +
14 '/\\*' +
15 '(?:\\s*\r?\n(?://)?)?' +
16 '(?:' +
17 innerRegex.source +
18 ')' +
19 '\\s*' +
20 '\\*/' +
21 '|' +
22 '//(?:' +
23 innerRegex.source +
24 ')' +
25 ')' +
26 '\\s*',
27);
28
29export function getSourceMapURL(srcContents: string): string | null {
30 const match = srcContents.match(regex);
31 return match ? match[1] || match[2] || '' : null;
32}
Note: See TracBrowser for help on using the repository browser.