UNPKG

906 BJavaScriptView Raw
1"use strict";
2/*
3 Adapted from https://github.com/lydell/source-map-url
4 Which carries the licensing:
5 Copyright 2014 Simon Lydell
6 X11 (“MIT”) Licensed.
7
8 Forked here because that one doesn't anchor to the end of the file, and that's pretty important for us.
9*/
10Object.defineProperty(exports, "__esModule", { value: true });
11const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
12const regex = RegExp("(?:" +
13 "/\\*" +
14 "(?:\\s*\r?\n(?://)?)?" +
15 "(?:" + innerRegex.source + ")" +
16 "\\s*" +
17 "\\*/" +
18 "|" +
19 "//(?:" + innerRegex.source + ")" +
20 ")" +
21 "\\s*$");
22function insertBefore(code, string) {
23 let match = code.match(regex);
24 if (match) {
25 return code.slice(0, match.index) + string + code.slice(match.index);
26 }
27 else {
28 return code + string;
29 }
30}
31exports.insertBefore = insertBefore;
32//# sourceMappingURL=source-map-url.js.map
\No newline at end of file