@vercel/build-utils 6.0.0 → 6.0.1

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,11 @@
1
1
  import { Files } from '../types';
2
2
  declare type Delegate = (name: string) => string;
3
+ /**
4
+ * Renames the keys of a `Files` map.
5
+ *
6
+ * @param files A map of filenames to `File` instances
7
+ * @param delegate A function that returns the new filename
8
+ * @returns A new file map with the renamed filenames
9
+ */
3
10
  export default function rename(files: Files, delegate: Delegate): Files;
4
11
  export {};
package/dist/fs/rename.js CHANGED
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Renames the keys of a `Files` map.
5
+ *
6
+ * @param files A map of filenames to `File` instances
7
+ * @param delegate A function that returns the new filename
8
+ * @returns A new file map with the renamed filenames
9
+ */
3
10
  function rename(files, delegate) {
4
- return Object.keys(files).reduce((newFiles, name) => ({
5
- ...newFiles,
6
- [delegate(name)]: files[name],
7
- }), {});
11
+ const result = {};
12
+ for (const [name, file] of Object.entries(files)) {
13
+ result[delegate(name)] = file;
14
+ }
15
+ return result;
8
16
  }
9
17
  exports.default = rename;
package/dist/index.js CHANGED
@@ -30955,11 +30955,19 @@ exports.readConfigFile = readConfigFile;
30955
30955
  "use strict";
30956
30956
 
30957
30957
  Object.defineProperty(exports, "__esModule", ({ value: true }));
30958
+ /**
30959
+ * Renames the keys of a `Files` map.
30960
+ *
30961
+ * @param files A map of filenames to `File` instances
30962
+ * @param delegate A function that returns the new filename
30963
+ * @returns A new file map with the renamed filenames
30964
+ */
30958
30965
  function rename(files, delegate) {
30959
- return Object.keys(files).reduce((newFiles, name) => ({
30960
- ...newFiles,
30961
- [delegate(name)]: files[name],
30962
- }), {});
30966
+ const result = {};
30967
+ for (const [name, file] of Object.entries(files)) {
30968
+ result[delegate(name)] = file;
30969
+ }
30970
+ return result;
30963
30971
  }
30964
30972
  exports.default = rename;
30965
30973
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",
@@ -51,5 +51,5 @@
51
51
  "typescript": "4.3.4",
52
52
  "yazl": "2.5.1"
53
53
  },
54
- "gitHead": "25f6595d3698546ba69c7fe9f601a906167fef3f"
54
+ "gitHead": "ada9a48d57be8f4375494a369aaa98cee1f5eae2"
55
55
  }