metro 0.76.4 → 0.76.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.
- package/package.json +24 -23
- package/src/Assets.js +35 -3
- package/src/Assets.js.flow +38 -3
- package/src/Bundler/util.js +0 -96
- package/src/Bundler/util.js.flow +0 -124
- package/src/DeltaBundler/DeltaCalculator.js +7 -0
- package/src/DeltaBundler/DeltaCalculator.js.flow +7 -0
- package/src/DeltaBundler/Graph.js +86 -31
- package/src/DeltaBundler/Graph.js.flow +98 -31
- package/src/DeltaBundler/Serializers/helpers/js.js +4 -1
- package/src/DeltaBundler/Serializers/helpers/js.js.flow +4 -1
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +2 -1
- package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +2 -1
- package/src/DeltaBundler/Transformer.js +1 -0
- package/src/DeltaBundler/Transformer.js.flow +1 -0
- package/src/DeltaBundler/types.flow.js.flow +9 -7
- package/src/Server.js +32 -14
- package/src/Server.js.flow +45 -20
- package/src/index.d.ts +3 -1
- package/src/index.flow.js +5 -0
- package/src/index.flow.js.flow +8 -0
- package/src/lib/parseOptionsFromUrl.js +4 -3
- package/src/lib/parseOptionsFromUrl.js.flow +4 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "metro",
|
|
3
|
-
"version": "0.76.
|
|
3
|
+
"version": "0.76.6",
|
|
4
4
|
"description": "🚇 The JavaScript bundler for React Native.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "src/cli.js",
|
|
@@ -29,27 +29,28 @@
|
|
|
29
29
|
"denodeify": "^1.2.1",
|
|
30
30
|
"error-stack-parser": "^2.0.6",
|
|
31
31
|
"graceful-fs": "^4.2.4",
|
|
32
|
-
"hermes-parser": "0.
|
|
32
|
+
"hermes-parser": "0.12.0",
|
|
33
33
|
"image-size": "^1.0.2",
|
|
34
34
|
"invariant": "^2.2.4",
|
|
35
35
|
"jest-worker": "^27.2.0",
|
|
36
|
+
"jsc-safe-url": "^0.2.2",
|
|
36
37
|
"lodash.throttle": "^4.1.1",
|
|
37
|
-
"metro-babel-transformer": "0.76.
|
|
38
|
-
"metro-cache": "0.76.
|
|
39
|
-
"metro-cache-key": "0.76.
|
|
40
|
-
"metro-config": "0.76.
|
|
41
|
-
"metro-core": "0.76.
|
|
42
|
-
"metro-file-map": "0.76.
|
|
43
|
-
"metro-inspector-proxy": "0.76.
|
|
44
|
-
"metro-minify-terser": "0.76.
|
|
45
|
-
"metro-minify-uglify": "0.76.
|
|
46
|
-
"metro-react-native-babel-preset": "0.76.
|
|
47
|
-
"metro-resolver": "0.76.
|
|
48
|
-
"metro-runtime": "0.76.
|
|
49
|
-
"metro-source-map": "0.76.
|
|
50
|
-
"metro-symbolicate": "0.76.
|
|
51
|
-
"metro-transform-plugins": "0.76.
|
|
52
|
-
"metro-transform-worker": "0.76.
|
|
38
|
+
"metro-babel-transformer": "0.76.6",
|
|
39
|
+
"metro-cache": "0.76.6",
|
|
40
|
+
"metro-cache-key": "0.76.6",
|
|
41
|
+
"metro-config": "0.76.6",
|
|
42
|
+
"metro-core": "0.76.6",
|
|
43
|
+
"metro-file-map": "0.76.6",
|
|
44
|
+
"metro-inspector-proxy": "0.76.6",
|
|
45
|
+
"metro-minify-terser": "0.76.6",
|
|
46
|
+
"metro-minify-uglify": "0.76.6",
|
|
47
|
+
"metro-react-native-babel-preset": "0.76.6",
|
|
48
|
+
"metro-resolver": "0.76.6",
|
|
49
|
+
"metro-runtime": "0.76.6",
|
|
50
|
+
"metro-source-map": "0.76.6",
|
|
51
|
+
"metro-symbolicate": "0.76.6",
|
|
52
|
+
"metro-transform-plugins": "0.76.6",
|
|
53
|
+
"metro-transform-worker": "0.76.6",
|
|
53
54
|
"mime-types": "^2.1.27",
|
|
54
55
|
"node-fetch": "^2.2.0",
|
|
55
56
|
"nullthrows": "^1.1.1",
|
|
@@ -62,15 +63,15 @@
|
|
|
62
63
|
"yargs": "^17.6.2"
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
|
-
"@babel/plugin-transform-flow-strip-types": "^7.
|
|
66
|
+
"@babel/plugin-transform-flow-strip-types": "^7.20.0",
|
|
66
67
|
"babel-jest": "^29.2.1",
|
|
67
68
|
"dedent": "^0.7.0",
|
|
68
69
|
"jest-snapshot": "^26.5.2",
|
|
69
70
|
"jest-snapshot-serializer-raw": "^1.2.0",
|
|
70
|
-
"metro-babel-register": "0.76.
|
|
71
|
-
"metro-memory-fs": "0.76.
|
|
72
|
-
"metro-react-native-babel-preset": "0.76.
|
|
73
|
-
"metro-react-native-babel-transformer": "0.76.
|
|
71
|
+
"metro-babel-register": "0.76.6",
|
|
72
|
+
"metro-memory-fs": "0.76.6",
|
|
73
|
+
"metro-react-native-babel-preset": "0.76.6",
|
|
74
|
+
"metro-react-native-babel-transformer": "0.76.6",
|
|
74
75
|
"mock-req": "^0.2.0",
|
|
75
76
|
"mock-res": "^0.6.0",
|
|
76
77
|
"stack-trace": "^0.0.10"
|
package/src/Assets.js
CHANGED
|
@@ -11,15 +11,45 @@
|
|
|
11
11
|
|
|
12
12
|
"use strict";
|
|
13
13
|
|
|
14
|
-
const { isAssetTypeAnImage } = require("./Bundler/util");
|
|
15
14
|
const AssetPaths = require("./node-haste/lib/AssetPaths");
|
|
16
15
|
const crypto = require("crypto");
|
|
17
16
|
const denodeify = require("denodeify");
|
|
18
17
|
const fs = require("fs");
|
|
19
|
-
const
|
|
18
|
+
const getImageSize = require("image-size");
|
|
20
19
|
const path = require("path");
|
|
21
20
|
const readDir = denodeify(fs.readdir);
|
|
22
21
|
const readFile = denodeify(fs.readFile);
|
|
22
|
+
// Test extension against all types supported by image-size module.
|
|
23
|
+
// If it's not one of these, we won't treat it as an image.
|
|
24
|
+
function isAssetTypeAnImage(type) {
|
|
25
|
+
return (
|
|
26
|
+
[
|
|
27
|
+
"png",
|
|
28
|
+
"jpg",
|
|
29
|
+
"jpeg",
|
|
30
|
+
"bmp",
|
|
31
|
+
"gif",
|
|
32
|
+
"webp",
|
|
33
|
+
"psd",
|
|
34
|
+
"svg",
|
|
35
|
+
"tiff",
|
|
36
|
+
"ktx",
|
|
37
|
+
].indexOf(type) !== -1
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function getAssetSize(type, content, filePath) {
|
|
41
|
+
if (!isAssetTypeAnImage(type)) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
if (content.length === 0) {
|
|
45
|
+
throw new Error(`Image asset \`${filePath}\` cannot be an empty file.`);
|
|
46
|
+
}
|
|
47
|
+
const { width, height } = getImageSize(content);
|
|
48
|
+
return {
|
|
49
|
+
width,
|
|
50
|
+
height,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
23
53
|
const hashFiles = denodeify(function hashFilesCb(files, hash, callback) {
|
|
24
54
|
if (!files.length) {
|
|
25
55
|
callback(null);
|
|
@@ -141,7 +171,7 @@ async function getAssetData(
|
|
|
141
171
|
const isImageInput = assetInfo.files[0].includes(".zip/")
|
|
142
172
|
? fs.readFileSync(assetInfo.files[0])
|
|
143
173
|
: assetInfo.files[0];
|
|
144
|
-
const dimensions = isImage ?
|
|
174
|
+
const dimensions = isImage ? getImageSize(isImageInput) : null;
|
|
145
175
|
const scale = assetInfo.scales[0];
|
|
146
176
|
const assetData = {
|
|
147
177
|
__packager_asset: true,
|
|
@@ -227,6 +257,8 @@ function pathBelongsToRoots(pathToCheck, roots) {
|
|
|
227
257
|
}
|
|
228
258
|
module.exports = {
|
|
229
259
|
getAsset,
|
|
260
|
+
getAssetSize,
|
|
230
261
|
getAssetData,
|
|
231
262
|
getAssetFiles,
|
|
263
|
+
isAssetTypeAnImage,
|
|
232
264
|
};
|
package/src/Assets.js.flow
CHANGED
|
@@ -13,12 +13,11 @@
|
|
|
13
13
|
|
|
14
14
|
import type {AssetPath} from './node-haste/lib/AssetPaths';
|
|
15
15
|
|
|
16
|
-
const {isAssetTypeAnImage} = require('./Bundler/util');
|
|
17
16
|
const AssetPaths = require('./node-haste/lib/AssetPaths');
|
|
18
17
|
const crypto = require('crypto');
|
|
19
18
|
const denodeify = require('denodeify');
|
|
20
19
|
const fs = require('fs');
|
|
21
|
-
const
|
|
20
|
+
const getImageSize = require('image-size');
|
|
22
21
|
const path = require('path');
|
|
23
22
|
|
|
24
23
|
const readDir = denodeify(fs.readdir);
|
|
@@ -56,6 +55,40 @@ export type AssetDataFiltered = {
|
|
|
56
55
|
...
|
|
57
56
|
};
|
|
58
57
|
|
|
58
|
+
// Test extension against all types supported by image-size module.
|
|
59
|
+
// If it's not one of these, we won't treat it as an image.
|
|
60
|
+
function isAssetTypeAnImage(type: string): boolean {
|
|
61
|
+
return (
|
|
62
|
+
[
|
|
63
|
+
'png',
|
|
64
|
+
'jpg',
|
|
65
|
+
'jpeg',
|
|
66
|
+
'bmp',
|
|
67
|
+
'gif',
|
|
68
|
+
'webp',
|
|
69
|
+
'psd',
|
|
70
|
+
'svg',
|
|
71
|
+
'tiff',
|
|
72
|
+
'ktx',
|
|
73
|
+
].indexOf(type) !== -1
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function getAssetSize(
|
|
78
|
+
type: string,
|
|
79
|
+
content: Buffer,
|
|
80
|
+
filePath: string,
|
|
81
|
+
): ?{+width: number, +height: number} {
|
|
82
|
+
if (!isAssetTypeAnImage(type)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
if (content.length === 0) {
|
|
86
|
+
throw new Error(`Image asset \`${filePath}\` cannot be an empty file.`);
|
|
87
|
+
}
|
|
88
|
+
const {width, height} = getImageSize(content);
|
|
89
|
+
return {width, height};
|
|
90
|
+
}
|
|
91
|
+
|
|
59
92
|
export type AssetData = AssetDataWithoutFiles & {+files: Array<string>, ...};
|
|
60
93
|
|
|
61
94
|
export type AssetDataPlugin = (
|
|
@@ -209,7 +242,7 @@ async function getAssetData(
|
|
|
209
242
|
const isImageInput = assetInfo.files[0].includes('.zip/')
|
|
210
243
|
? fs.readFileSync(assetInfo.files[0])
|
|
211
244
|
: assetInfo.files[0];
|
|
212
|
-
const dimensions = isImage ?
|
|
245
|
+
const dimensions = isImage ? getImageSize(isImageInput) : null;
|
|
213
246
|
const scale = assetInfo.scales[0];
|
|
214
247
|
|
|
215
248
|
const assetData = {
|
|
@@ -317,6 +350,8 @@ function pathBelongsToRoots(
|
|
|
317
350
|
|
|
318
351
|
module.exports = {
|
|
319
352
|
getAsset,
|
|
353
|
+
getAssetSize,
|
|
320
354
|
getAssetData,
|
|
321
355
|
getAssetFiles,
|
|
356
|
+
isAssetTypeAnImage,
|
|
322
357
|
};
|
package/src/Bundler/util.js
CHANGED
|
@@ -14,11 +14,6 @@
|
|
|
14
14
|
const babylon = require("@babel/parser");
|
|
15
15
|
const template = require("@babel/template").default;
|
|
16
16
|
const babelTypes = require("@babel/types");
|
|
17
|
-
const nullthrows = require("nullthrows");
|
|
18
|
-
const getImageSize = require("image-size");
|
|
19
|
-
|
|
20
|
-
// Structure of the object: dir.name.scale = asset
|
|
21
|
-
|
|
22
17
|
const assetPropertyBlockList = new Set(["files", "fileSystemLocation", "path"]);
|
|
23
18
|
function generateAssetCodeFileAst(assetRegistryPath, assetDescriptor) {
|
|
24
19
|
const properDescriptor = filterObject(
|
|
@@ -45,94 +40,6 @@ function generateAssetCodeFileAst(assetRegistryPath, assetDescriptor) {
|
|
|
45
40
|
])
|
|
46
41
|
);
|
|
47
42
|
}
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Generates the code involved in requiring an asset, but to be loaded remotely.
|
|
51
|
-
* If the asset cannot be found within the map, then it falls back to the
|
|
52
|
-
* standard asset.
|
|
53
|
-
*/
|
|
54
|
-
function generateRemoteAssetCodeFileAst(
|
|
55
|
-
assetUtilsPath,
|
|
56
|
-
assetDescriptor,
|
|
57
|
-
remoteServer,
|
|
58
|
-
remoteFileMap
|
|
59
|
-
) {
|
|
60
|
-
const t = babelTypes;
|
|
61
|
-
const file = remoteFileMap[assetDescriptor.fileSystemLocation];
|
|
62
|
-
const descriptor = file && file[assetDescriptor.name];
|
|
63
|
-
const data = {};
|
|
64
|
-
if (!descriptor) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
for (const scale in descriptor) {
|
|
68
|
-
data[+scale] = descriptor[+scale].handle;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// {2: 'path/to/image@2x', 3: 'path/to/image@3x', ...}
|
|
72
|
-
const astData = babylon.parseExpression(JSON.stringify(data));
|
|
73
|
-
|
|
74
|
-
// URI to remote server
|
|
75
|
-
const URI = t.stringLiteral(remoteServer);
|
|
76
|
-
|
|
77
|
-
// Size numbers.
|
|
78
|
-
const WIDTH = t.numericLiteral(nullthrows(assetDescriptor.width));
|
|
79
|
-
const HEIGHT = t.numericLiteral(nullthrows(assetDescriptor.height));
|
|
80
|
-
const buildRequire = template.program(`
|
|
81
|
-
const {pickScale, getUrlCacheBreaker}= require(ASSET_UTILS_PATH);
|
|
82
|
-
module.exports = {
|
|
83
|
-
"width": WIDTH,
|
|
84
|
-
"height": HEIGHT,
|
|
85
|
-
"uri": URI + OBJECT_AST[pickScale(SCALE_ARRAY)] + getUrlCacheBreaker()
|
|
86
|
-
};
|
|
87
|
-
`);
|
|
88
|
-
return t.file(
|
|
89
|
-
buildRequire({
|
|
90
|
-
WIDTH,
|
|
91
|
-
HEIGHT,
|
|
92
|
-
URI,
|
|
93
|
-
OBJECT_AST: astData,
|
|
94
|
-
ASSET_UTILS_PATH: t.stringLiteral(assetUtilsPath),
|
|
95
|
-
SCALE_ARRAY: t.arrayExpression(
|
|
96
|
-
Object.keys(descriptor)
|
|
97
|
-
.map(Number)
|
|
98
|
-
.sort((a, b) => a - b)
|
|
99
|
-
.map((scale) => t.numericLiteral(scale))
|
|
100
|
-
),
|
|
101
|
-
})
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Test extension against all types supported by image-size module.
|
|
106
|
-
// If it's not one of these, we won't treat it as an image.
|
|
107
|
-
function isAssetTypeAnImage(type) {
|
|
108
|
-
return (
|
|
109
|
-
[
|
|
110
|
-
"png",
|
|
111
|
-
"jpg",
|
|
112
|
-
"jpeg",
|
|
113
|
-
"bmp",
|
|
114
|
-
"gif",
|
|
115
|
-
"webp",
|
|
116
|
-
"psd",
|
|
117
|
-
"svg",
|
|
118
|
-
"tiff",
|
|
119
|
-
"ktx",
|
|
120
|
-
].indexOf(type) !== -1
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
function getAssetSize(type, content, filePath) {
|
|
124
|
-
if (!isAssetTypeAnImage(type)) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
if (content.length === 0) {
|
|
128
|
-
throw new Error(`Image asset \`${filePath}\` cannot be an empty file.`);
|
|
129
|
-
}
|
|
130
|
-
const { width, height } = getImageSize(content);
|
|
131
|
-
return {
|
|
132
|
-
width,
|
|
133
|
-
height,
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
43
|
function filterObject(object, blockList) {
|
|
137
44
|
const copied = {
|
|
138
45
|
...object,
|
|
@@ -213,7 +120,4 @@ class ArrayMap extends Map {
|
|
|
213
120
|
module.exports = {
|
|
214
121
|
createRamBundleGroups,
|
|
215
122
|
generateAssetCodeFileAst,
|
|
216
|
-
generateRemoteAssetCodeFileAst,
|
|
217
|
-
getAssetSize,
|
|
218
|
-
isAssetTypeAnImage,
|
|
219
123
|
};
|
package/src/Bundler/util.js.flow
CHANGED
|
@@ -18,32 +18,6 @@ import type {File} from '@babel/types';
|
|
|
18
18
|
const babylon = require('@babel/parser');
|
|
19
19
|
const template = require('@babel/template').default;
|
|
20
20
|
const babelTypes = require('@babel/types');
|
|
21
|
-
const nullthrows = require('nullthrows');
|
|
22
|
-
const getImageSize = require('image-size');
|
|
23
|
-
|
|
24
|
-
// Structure of the object: dir.name.scale = asset
|
|
25
|
-
export type RemoteFileMap = {
|
|
26
|
-
[string]: {
|
|
27
|
-
[string]: {
|
|
28
|
-
[number]: {
|
|
29
|
-
handle: string,
|
|
30
|
-
hash: string,
|
|
31
|
-
...
|
|
32
|
-
},
|
|
33
|
-
...
|
|
34
|
-
},
|
|
35
|
-
...
|
|
36
|
-
},
|
|
37
|
-
__proto__: null,
|
|
38
|
-
...
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Structure of the object: platform.dir.name.scale = asset
|
|
42
|
-
export type PlatformRemoteFileMap = {
|
|
43
|
-
[string]: RemoteFileMap,
|
|
44
|
-
__proto__: null,
|
|
45
|
-
...
|
|
46
|
-
};
|
|
47
21
|
|
|
48
22
|
type SubTree<T: ModuleTransportLike> = (
|
|
49
23
|
moduleTransport: T,
|
|
@@ -82,101 +56,6 @@ function generateAssetCodeFileAst(
|
|
|
82
56
|
);
|
|
83
57
|
}
|
|
84
58
|
|
|
85
|
-
/**
|
|
86
|
-
* Generates the code involved in requiring an asset, but to be loaded remotely.
|
|
87
|
-
* If the asset cannot be found within the map, then it falls back to the
|
|
88
|
-
* standard asset.
|
|
89
|
-
*/
|
|
90
|
-
function generateRemoteAssetCodeFileAst(
|
|
91
|
-
assetUtilsPath: string,
|
|
92
|
-
assetDescriptor: AssetDataWithoutFiles,
|
|
93
|
-
remoteServer: string,
|
|
94
|
-
remoteFileMap: RemoteFileMap,
|
|
95
|
-
): ?File {
|
|
96
|
-
const t = babelTypes;
|
|
97
|
-
|
|
98
|
-
const file = remoteFileMap[assetDescriptor.fileSystemLocation];
|
|
99
|
-
const descriptor = file && file[assetDescriptor.name];
|
|
100
|
-
const data: {[number]: string} = {};
|
|
101
|
-
|
|
102
|
-
if (!descriptor) {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
for (const scale in descriptor) {
|
|
107
|
-
data[+scale] = descriptor[+scale].handle;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// {2: 'path/to/image@2x', 3: 'path/to/image@3x', ...}
|
|
111
|
-
const astData = babylon.parseExpression(JSON.stringify(data));
|
|
112
|
-
|
|
113
|
-
// URI to remote server
|
|
114
|
-
const URI = t.stringLiteral(remoteServer);
|
|
115
|
-
|
|
116
|
-
// Size numbers.
|
|
117
|
-
const WIDTH = t.numericLiteral(nullthrows(assetDescriptor.width));
|
|
118
|
-
const HEIGHT = t.numericLiteral(nullthrows(assetDescriptor.height));
|
|
119
|
-
|
|
120
|
-
const buildRequire = template.program(`
|
|
121
|
-
const {pickScale, getUrlCacheBreaker}= require(ASSET_UTILS_PATH);
|
|
122
|
-
module.exports = {
|
|
123
|
-
"width": WIDTH,
|
|
124
|
-
"height": HEIGHT,
|
|
125
|
-
"uri": URI + OBJECT_AST[pickScale(SCALE_ARRAY)] + getUrlCacheBreaker()
|
|
126
|
-
};
|
|
127
|
-
`);
|
|
128
|
-
|
|
129
|
-
return t.file(
|
|
130
|
-
buildRequire({
|
|
131
|
-
WIDTH,
|
|
132
|
-
HEIGHT,
|
|
133
|
-
URI,
|
|
134
|
-
OBJECT_AST: astData,
|
|
135
|
-
ASSET_UTILS_PATH: t.stringLiteral(assetUtilsPath),
|
|
136
|
-
SCALE_ARRAY: t.arrayExpression(
|
|
137
|
-
Object.keys(descriptor)
|
|
138
|
-
.map(Number)
|
|
139
|
-
.sort((a: number, b: number) => a - b)
|
|
140
|
-
.map((scale: number) => t.numericLiteral(scale)),
|
|
141
|
-
),
|
|
142
|
-
}),
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Test extension against all types supported by image-size module.
|
|
147
|
-
// If it's not one of these, we won't treat it as an image.
|
|
148
|
-
function isAssetTypeAnImage(type: string): boolean {
|
|
149
|
-
return (
|
|
150
|
-
[
|
|
151
|
-
'png',
|
|
152
|
-
'jpg',
|
|
153
|
-
'jpeg',
|
|
154
|
-
'bmp',
|
|
155
|
-
'gif',
|
|
156
|
-
'webp',
|
|
157
|
-
'psd',
|
|
158
|
-
'svg',
|
|
159
|
-
'tiff',
|
|
160
|
-
'ktx',
|
|
161
|
-
].indexOf(type) !== -1
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function getAssetSize(
|
|
166
|
-
type: string,
|
|
167
|
-
content: Buffer,
|
|
168
|
-
filePath: string,
|
|
169
|
-
): ?{+width: number, +height: number} {
|
|
170
|
-
if (!isAssetTypeAnImage(type)) {
|
|
171
|
-
return null;
|
|
172
|
-
}
|
|
173
|
-
if (content.length === 0) {
|
|
174
|
-
throw new Error(`Image asset \`${filePath}\` cannot be an empty file.`);
|
|
175
|
-
}
|
|
176
|
-
const {width, height} = getImageSize(content);
|
|
177
|
-
return {width, height};
|
|
178
|
-
}
|
|
179
|
-
|
|
180
59
|
function filterObject(
|
|
181
60
|
object: AssetDataWithoutFiles,
|
|
182
61
|
blockList: Set<string>,
|
|
@@ -271,7 +150,4 @@ class ArrayMap<K, V> extends Map<K, Array<V>> {
|
|
|
271
150
|
module.exports = {
|
|
272
151
|
createRamBundleGroups,
|
|
273
152
|
generateAssetCodeFileAst,
|
|
274
|
-
generateRemoteAssetCodeFileAst,
|
|
275
|
-
getAssetSize,
|
|
276
|
-
isAssetTypeAnImage,
|
|
277
153
|
};
|
|
@@ -277,10 +277,17 @@ class DeltaCalculator extends EventEmitter {
|
|
|
277
277
|
reset: false,
|
|
278
278
|
};
|
|
279
279
|
}
|
|
280
|
+
debug("Traversing dependencies for %s paths", modifiedDependencies.length);
|
|
280
281
|
const { added, modified, deleted } = await this._graph.traverseDependencies(
|
|
281
282
|
modifiedDependencies,
|
|
282
283
|
this._options
|
|
283
284
|
);
|
|
285
|
+
debug(
|
|
286
|
+
"Calculated graph delta {added: %s, modified: %d, deleted: %d}",
|
|
287
|
+
added.size,
|
|
288
|
+
modified.size,
|
|
289
|
+
deleted.size
|
|
290
|
+
);
|
|
284
291
|
return {
|
|
285
292
|
added,
|
|
286
293
|
modified,
|
|
@@ -323,10 +323,17 @@ class DeltaCalculator<T> extends EventEmitter {
|
|
|
323
323
|
};
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
+
debug('Traversing dependencies for %s paths', modifiedDependencies.length);
|
|
326
327
|
const {added, modified, deleted} = await this._graph.traverseDependencies(
|
|
327
328
|
modifiedDependencies,
|
|
328
329
|
this._options,
|
|
329
330
|
);
|
|
331
|
+
debug(
|
|
332
|
+
'Calculated graph delta {added: %s, modified: %d, deleted: %d}',
|
|
333
|
+
added.size,
|
|
334
|
+
modified.size,
|
|
335
|
+
deleted.size,
|
|
336
|
+
);
|
|
330
337
|
|
|
331
338
|
return {
|
|
332
339
|
added,
|