@jsenv/sourcemap 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/sourcemap",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,8 +19,8 @@
19
19
  "test": "node --conditions=development ./scripts/test.mjs"
20
20
  },
21
21
  "dependencies": {
22
- "@jsenv/urls": "2.1.0",
23
- "magic-string": "0.30.1",
22
+ "@jsenv/urls": "2.2.0",
23
+ "magic-string": "0.30.2",
24
24
  "source-map-js": "1.0.2"
25
25
  }
26
26
  }
@@ -11,6 +11,10 @@ export const SOURCEMAP = {
11
11
  return read ? read(content) : null;
12
12
  },
13
13
 
14
+ removeComment: ({ contentType, content }) => {
15
+ return SOURCEMAP.writeComment({ contentType, content, specifier: "" });
16
+ },
17
+
14
18
  writeComment: ({ contentType, content, specifier }) => {
15
19
  const write = {
16
20
  "text/javascript": setJavaScriptSourceMappingUrl,
@@ -120,9 +124,12 @@ const cssSourceMappingUrlCommentRegExp =
120
124
  /\/\*# ?sourceMappingURL=([^\s'"]+) \*\//g;
121
125
 
122
126
  // ${"//#"} is to avoid a parser thinking there is a sourceMappingUrl for this file
123
- const writeJavaScriptSourceMappingURL = (value) =>
124
- `${"//#"} sourceMappingURL=${value}`;
125
- const writeCssSourceMappingUrl = (value) => `/*# sourceMappingURL=${value} */`;
127
+ const writeJavaScriptSourceMappingURL = (value) => {
128
+ return `${"//#"} sourceMappingURL=${value}`;
129
+ };
130
+ const writeCssSourceMappingUrl = (value) => {
131
+ return `/*# sourceMappingURL=${value} */`;
132
+ };
126
133
 
127
134
  const replaceSourceMappingUrl = (source, regexp, callback) => {
128
135
  let lastSourceMappingUrl;