git ssb

1+

Daan Patchwork / manyverse



Commit 75036cbc8bfd8b02599fdc988390302a6e415132

dx: refactor metro.config.js

Andre Staltz committed on 10/15/2019, 8:57:34 AM
Parent: 3626ff6ef7eab6d4c93d7724ea76e56a3eb1af48

Files changed

metro.config.jschanged
metro.config.jsView
@@ -1,31 +1,9 @@
11 /* Any copyright is dedicated to the Public Domain.
22 * http://creativecommons.org/publicdomain/zero/1.0/ */
33
4-const path = require('path');
4+const blacklist = require('metro-config/src/defaults/blacklist');
55
6-const blacklistRE = new RegExp(
7- '(' +
8- [/nodejs-assets\/.*/, /android\/.*/, /ios\/.*/]
9- .map(escapeRegExp)
10- .join('|') +
11- ')$',
12-);
13-
14-function escapeRegExp(pattern) {
15- if (Object.prototype.toString.call(pattern) === '[object RegExp]') {
16- return pattern.source.replace(/\//g, path.sep);
17- } else if (typeof pattern === 'string') {
18- const escaped = pattern.replace(
19- /[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g,
20- '\\$&',
21- );
22- // convert the '/' into an escaped local file separator
23- return escaped.replace(/\//g, `\\${path.sep}`);
24- }
25- throw new Error(`Unexpected packager blacklist pattern: ${pattern}`);
26-}
27-
286 module.exports = {
297 transformer: {
308 getTransformOptions: async () => ({
319 transform: {
@@ -36,7 +14,16 @@
3614 },
3715
3816 resolver: {
3917 platforms: ['android', 'ios', 'web'],
40- blacklistRE,
18+ blacklistRE: blacklist([
19+ /\/android\/.*/,
20+ /\/e2e\/.*/,
21+ /\/ios\/.*/,
22+ /\/nodejs-assets\/.*/,
23+ /\/patches\/.*/,
24+ /\/tools\/.*/,
25+ // Not used in runtime (is either dev dependency or surely not used)
26+ /\/node_modules\/appium\/.*/,
27+ ]),
4128 },
4229 };

Built with git-ssb-web