-
Notifications
You must be signed in to change notification settings - Fork 830
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate off of source-map-url (#3031)
* WIP * getSourceMapURL in webpack plugin
- Loading branch information
1 parent
55e8144
commit c57f076
Showing
8 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright 2022 Google LLC | ||
Use of this source code is governed by an MIT-style | ||
license that can be found in the LICENSE file or at | ||
https://opensource.org/licenses/MIT. | ||
*/ | ||
|
||
// Adapted from https://github.com/lydell/source-map-url/blob/master/source-map-url.js | ||
// See https://github.com/GoogleChrome/workbox/issues/3019 | ||
const innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/; | ||
const regex = RegExp( | ||
'(?:' + | ||
'/\\*' + | ||
'(?:\\s*\r?\n(?://)?)?' + | ||
'(?:' + | ||
innerRegex.source + | ||
')' + | ||
'\\s*' + | ||
'\\*/' + | ||
'|' + | ||
'//(?:' + | ||
innerRegex.source + | ||
')' + | ||
')' + | ||
'\\s*', | ||
); | ||
|
||
export function getSourceMapURL(srcContents: string): string | null { | ||
const match = srcContents.match(regex); | ||
return match ? match[1] || match[2] || '' : null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.