@tramvai/module-render 3.25.5 → 3.25.6

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.
@@ -1,4 +1,5 @@
1
1
  import type { PageResource } from '@tramvai/tokens-render';
2
+ export declare const removeSourceMapFromString: (file: string) => string;
2
3
  export interface ResourcesInlinerType {
3
4
  shouldAddResource(resource: PageResource): boolean;
4
5
  shouldInline(resource: PageResource): boolean;
@@ -31,6 +31,9 @@ const getResourceUrl = (resource) => {
31
31
  }
32
32
  return result;
33
33
  };
34
+ const removeSourceMapFromString = (file) => {
35
+ return file.replace(/(\n\/\/# sourceMappingURL=.*)/g, '');
36
+ };
34
37
  class ResourcesInliner {
35
38
  constructor({ resourcesRegistryCache, resourceInlineThreshold, logger }) {
36
39
  this.internalFilesCache = new Map();
@@ -199,7 +202,7 @@ class ResourcesInliner {
199
202
  result.push({
200
203
  ...resource,
201
204
  type: getInlineType(resource.type),
202
- payload: text,
205
+ payload: removeSourceMapFromString(text),
203
206
  });
204
207
  if (resource.type === ResourceType.style) {
205
208
  // If we don't add data-href then extract-css-chunks-webpack-plugin
@@ -231,4 +234,4 @@ class ResourcesInliner {
231
234
  }
232
235
  }
233
236
 
234
- export { ResourcesInliner };
237
+ export { ResourcesInliner, removeSourceMapFromString };
@@ -40,6 +40,9 @@ const getResourceUrl = (resource) => {
40
40
  }
41
41
  return result;
42
42
  };
43
+ const removeSourceMapFromString = (file) => {
44
+ return file.replace(/(\n\/\/# sourceMappingURL=.*)/g, '');
45
+ };
43
46
  class ResourcesInliner {
44
47
  constructor({ resourcesRegistryCache, resourceInlineThreshold, logger }) {
45
48
  this.internalFilesCache = new Map();
@@ -208,7 +211,7 @@ class ResourcesInliner {
208
211
  result.push({
209
212
  ...resource,
210
213
  type: getInlineType(resource.type),
211
- payload: text,
214
+ payload: removeSourceMapFromString(text),
212
215
  });
213
216
  if (resource.type === tokensRender.ResourceType.style) {
214
217
  // If we don't add data-href then extract-css-chunks-webpack-plugin
@@ -241,3 +244,4 @@ class ResourcesInliner {
241
244
  }
242
245
 
243
246
  exports.ResourcesInliner = ResourcesInliner;
247
+ exports.removeSourceMapFromString = removeSourceMapFromString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-render",
3
- "version": "3.25.5",
3
+ "version": "3.25.6",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -26,13 +26,13 @@
26
26
  "@tinkoff/layout-factory": "0.4.1",
27
27
  "@tinkoff/errors": "0.4.2",
28
28
  "@tinkoff/url": "0.9.2",
29
- "@tinkoff/user-agent": "0.5.61",
30
- "@tramvai/module-client-hints": "3.25.5",
31
- "@tramvai/module-router": "3.25.5",
32
- "@tramvai/react": "3.25.5",
29
+ "@tinkoff/user-agent": "0.5.62",
30
+ "@tramvai/module-client-hints": "3.25.6",
31
+ "@tramvai/module-router": "3.25.6",
32
+ "@tramvai/react": "3.25.6",
33
33
  "@tramvai/safe-strings": "0.6.2",
34
- "@tramvai/tokens-render": "3.25.5",
35
- "@tramvai/experiments": "3.25.5",
34
+ "@tramvai/tokens-render": "3.25.6",
35
+ "@tramvai/experiments": "3.25.6",
36
36
  "@types/loadable__server": "^5.12.6",
37
37
  "node-fetch": "^2.6.1"
38
38
  },
@@ -40,14 +40,14 @@
40
40
  "@tinkoff/dippy": "0.9.2",
41
41
  "@tinkoff/utils": "^2.1.2",
42
42
  "@tinkoff/react-hooks": "0.2.1",
43
- "@tramvai/cli": "3.25.5",
44
- "@tramvai/core": "3.25.5",
45
- "@tramvai/module-common": "3.25.5",
46
- "@tramvai/state": "3.25.5",
47
- "@tramvai/test-helpers": "3.25.5",
48
- "@tramvai/tokens-common": "3.25.5",
49
- "@tramvai/tokens-router": "3.25.5",
50
- "@tramvai/tokens-server-private": "3.25.5",
43
+ "@tramvai/cli": "3.25.6",
44
+ "@tramvai/core": "3.25.6",
45
+ "@tramvai/module-common": "3.25.6",
46
+ "@tramvai/state": "3.25.6",
47
+ "@tramvai/test-helpers": "3.25.6",
48
+ "@tramvai/tokens-common": "3.25.6",
49
+ "@tramvai/tokens-router": "3.25.6",
50
+ "@tramvai/tokens-server-private": "3.25.6",
51
51
  "express": "^4.17.1",
52
52
  "prop-types": "^15.6.2",
53
53
  "react": ">=16.14.0",