@atlaspack/utils 2.13.2-dev.3689 → 2.14.1-canary.3710

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": "@atlaspack/utils",
3
- "version": "2.13.2-dev.3689+7a2e6e783",
3
+ "version": "2.14.1-canary.3710+d874396ab",
4
4
  "description": "Blazing fast, zero configuration web application bundler",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@atlaspack/codeframe": "2.13.2-dev.3689+7a2e6e783",
33
- "@atlaspack/diagnostic": "2.13.2-dev.3689+7a2e6e783",
34
- "@atlaspack/logger": "2.13.2-dev.3689+7a2e6e783",
35
- "@atlaspack/markdown-ansi": "2.13.2-dev.3689+7a2e6e783",
36
- "@atlaspack/rust": "2.13.2-dev.3689+7a2e6e783",
32
+ "@atlaspack/codeframe": "2.13.3-canary.3710+d874396ab",
33
+ "@atlaspack/diagnostic": "2.14.1-canary.3710+d874396ab",
34
+ "@atlaspack/logger": "2.14.1-canary.3710+d874396ab",
35
+ "@atlaspack/markdown-ansi": "2.14.1-canary.3710+d874396ab",
36
+ "@atlaspack/rust": "3.0.1-canary.3710+d874396ab",
37
37
  "@parcel/source-map": "^2.1.1",
38
38
  "chalk": "^4.1.0",
39
39
  "nullthrows": "^1.1.1"
@@ -63,5 +63,6 @@
63
63
  "./src/openInBrowser.js": false,
64
64
  "@atlaspack/markdown-ansi": false
65
65
  },
66
- "gitHead": "7a2e6e7835fa846b27021b374097c6a4f37541ba"
66
+ "type": "commonjs",
67
+ "gitHead": "d874396ab648d0d5505d66c7eb73e1748f1eaf68"
67
68
  }
@@ -9,6 +9,8 @@ import type {
9
9
  Dependency,
10
10
  NamedBundle,
11
11
  } from '@atlaspack/types';
12
+ import {performStringReplacements} from '@atlaspack/rust';
13
+ import {getFeatureFlag} from '@atlaspack/feature-flags';
12
14
 
13
15
  import {Readable} from 'stream';
14
16
  import nullthrows from 'nullthrows';
@@ -209,9 +211,18 @@ function performReplacement(
209
211
  map?: ?SourceMap,
210
212
  ): {|+contents: string, +map: ?SourceMap|} {
211
213
  let finalContents = contents;
212
- for (let {from, to} of replacements.values()) {
213
- // Perform replacement
214
- finalContents = finalContents.split(from).join(to);
214
+
215
+ if (getFeatureFlag('inlineStringReplacementPerf')) {
216
+ let replacementList = Array.from(replacements.values());
217
+
218
+ if (replacementList.length > 0) {
219
+ finalContents = performStringReplacements(contents, replacementList);
220
+ }
221
+ } else {
222
+ for (let {from, to} of replacements.values()) {
223
+ // Perform replacement
224
+ finalContents = finalContents.split(from).join(to);
225
+ }
215
226
  }
216
227
 
217
228
  return {