@expo/metro-config 0.3.17 → 0.3.20
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/build/ExpoMetroConfig.js +320 -221
- package/build/ExpoMetroConfig.js.map +1 -1
- package/build/getModulesPaths.js +49 -26
- package/build/getModulesPaths.js.map +1 -1
- package/build/getWatchFolders.js +118 -65
- package/build/getWatchFolders.js.map +1 -1
- package/build/importMetroFromProject.js +40 -25
- package/build/importMetroFromProject.js.map +1 -1
- package/build/transformer/createExoticTransformer.js +132 -96
- package/build/transformer/createExoticTransformer.js.map +1 -1
- package/build/transformer/createMatcher.js +48 -39
- package/build/transformer/createMatcher.js.map +1 -1
- package/build/transformer/createMultiRuleTransformer.js +267 -168
- package/build/transformer/createMultiRuleTransformer.js.map +1 -1
- package/build/transformer/generateFunctionMap.js +39 -26
- package/build/transformer/generateFunctionMap.js.map +1 -1
- package/build/transformer/getBabelConfig.js +142 -94
- package/build/transformer/getBabelConfig.js.map +1 -1
- package/build/transformer/getCacheKey.js +40 -19
- package/build/transformer/getCacheKey.js.map +1 -1
- package/build/transformer/index.js +74 -11
- package/build/transformer/index.js.map +1 -1
- package/build/transformer/metro-expo-babel-transformer.js +43 -22
- package/build/transformer/metro-expo-babel-transformer.js.map +1 -1
- package/build/transformer/metro-expo-exotic-babel-transformer.js +14 -3
- package/build/transformer/metro-expo-exotic-babel-transformer.js.map +1 -1
- package/package.json +11 -16
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createExoticTransformer = createExoticTransformer;
|
|
7
|
+
|
|
8
|
+
function _createMatcher() {
|
|
9
|
+
const data = require("./createMatcher");
|
|
10
|
+
|
|
11
|
+
_createMatcher = function () {
|
|
12
|
+
return data;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return data;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function _createMultiRuleTransformer() {
|
|
19
|
+
const data = require("./createMultiRuleTransformer");
|
|
20
|
+
|
|
21
|
+
_createMultiRuleTransformer = function () {
|
|
22
|
+
return data;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return data;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function _getCacheKey() {
|
|
29
|
+
const data = require("./getCacheKey");
|
|
30
|
+
|
|
31
|
+
_getCacheKey = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return data;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Copyright 2021-present 650 Industries (Expo). All rights reserved.
|
|
39
|
+
|
|
7
40
|
/**
|
|
8
41
|
* Create an experimental multi-rule transformer for a React Native app.
|
|
9
42
|
*
|
|
@@ -19,96 +52,99 @@ const getCacheKey_1 = require("./getCacheKey");
|
|
|
19
52
|
* @param props.transpileModules matchers for module names that should be transpiled using the project Babel configuration. Example: `['@stripe/stripe-react-native']`
|
|
20
53
|
* @returns a Metro `transformer` function and default `getCacheKey` function.
|
|
21
54
|
*/
|
|
22
|
-
function createExoticTransformer({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
55
|
+
function createExoticTransformer({
|
|
56
|
+
nodeModulesPaths,
|
|
57
|
+
transpileModules
|
|
58
|
+
}) {
|
|
59
|
+
if (!nodeModulesPaths) {
|
|
60
|
+
nodeModulesPaths = ['node_modules'];
|
|
61
|
+
} // Match any node modules, or monorepo module.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
const nodeModuleMatcher = (0, _createMatcher().createModuleMatcher)({
|
|
65
|
+
folders: nodeModulesPaths,
|
|
66
|
+
moduleIds: []
|
|
67
|
+
}); // Match node modules which are so oddly written that we must
|
|
68
|
+
// transpile them with every possible option (most expensive).
|
|
69
|
+
|
|
70
|
+
const impossibleNodeModuleMatcher = (0, _createMatcher().createModuleMatcher)({
|
|
71
|
+
moduleIds: [// victory is too wild
|
|
72
|
+
// SyntaxError in ../../node_modules/victory-native/lib/components/victory-primitives/bar.js: Missing semicolon. (9:1)
|
|
73
|
+
'victory', // vector icons has some hidden issues that break NCL
|
|
74
|
+
'@expo/vector-icons', ...(transpileModules || [])],
|
|
75
|
+
folders: nodeModulesPaths
|
|
76
|
+
});
|
|
77
|
+
const transform = (0, _createMultiRuleTransformer().createMultiRuleTransformer)({
|
|
78
|
+
// Specify which rules to use on a per-file basis, basically
|
|
79
|
+
// this is used to determine which modules are node modules, and which are application code.
|
|
80
|
+
getRuleType({
|
|
81
|
+
filename
|
|
82
|
+
}) {
|
|
83
|
+
// Is a node module, and is not one of the impossible modules.
|
|
84
|
+
return nodeModuleMatcher.test(filename) && !impossibleNodeModuleMatcher.test(filename) ? 'module' : 'app';
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// Order is very important, we use wild card matchers to transpile
|
|
88
|
+
// "every unhandled node module" and "every unhandled application module".
|
|
89
|
+
rules: [// Match bob compiler modules, use the passthrough loader.
|
|
90
|
+
{
|
|
91
|
+
name: 'bob',
|
|
92
|
+
type: 'module',
|
|
93
|
+
test: (0, _createMatcher().createModuleMatcher)({
|
|
94
|
+
moduleIds: ['.*/lib/commonjs/'],
|
|
95
|
+
folders: nodeModulesPaths
|
|
96
|
+
}),
|
|
97
|
+
transform: _createMultiRuleTransformer().loaders.passthroughModule,
|
|
98
|
+
warn: true
|
|
99
|
+
}, // Match React Native modules, convert them statically using sucrase.
|
|
100
|
+
{
|
|
101
|
+
name: 'react-native',
|
|
102
|
+
type: 'module',
|
|
103
|
+
test: (0, _createMatcher().createReactNativeMatcher)({
|
|
104
|
+
folders: nodeModulesPaths
|
|
105
|
+
}),
|
|
106
|
+
transform: _createMultiRuleTransformer().loaders.reactNativeModule,
|
|
107
|
+
warn: true
|
|
108
|
+
}, // Match Expo SDK modules, convert them statically using sucrase.
|
|
109
|
+
{
|
|
110
|
+
name: 'expo-module',
|
|
111
|
+
type: 'module',
|
|
112
|
+
test: (0, _createMatcher().createExpoMatcher)({
|
|
113
|
+
folders: nodeModulesPaths
|
|
114
|
+
}),
|
|
115
|
+
transform: _createMultiRuleTransformer().loaders.expoModule,
|
|
116
|
+
warn: true
|
|
117
|
+
}, // Match known problematic modules, convert them statically using an expensive, dynamic sucrase.
|
|
118
|
+
{
|
|
119
|
+
name: 'sucrase',
|
|
120
|
+
type: 'module',
|
|
121
|
+
test: (0, _createMatcher().createKnownCommunityMatcher)({
|
|
122
|
+
folders: nodeModulesPaths
|
|
123
|
+
}),
|
|
124
|
+
transform: _createMultiRuleTransformer().loaders.untranspiledModule,
|
|
125
|
+
warn: true
|
|
126
|
+
}, // Pass through any unhandled node modules as passthrough, this is where the most savings occur.
|
|
127
|
+
// Ideally, you want your project to pass all node modules through this loader.
|
|
128
|
+
// This should be the last "module" rule.
|
|
129
|
+
// Message library authors and ask them to ship their modules as pre-transpiled
|
|
130
|
+
// commonjs, to improve the development speed of your project.
|
|
131
|
+
{
|
|
132
|
+
name: 'skip-module',
|
|
133
|
+
type: 'module',
|
|
134
|
+
test: () => true,
|
|
135
|
+
transform: _createMultiRuleTransformer().loaders.passthroughModule
|
|
136
|
+
}, // All application code should be transpiled with the user's babel preset,
|
|
137
|
+
// this is the most expensive operation but provides the most customization to the user.
|
|
138
|
+
// The goal is to use this as sparingly as possible.
|
|
139
|
+
{
|
|
140
|
+
name: 'babel',
|
|
141
|
+
test: () => true,
|
|
142
|
+
transform: _createMultiRuleTransformer().loaders.app
|
|
143
|
+
}]
|
|
144
|
+
});
|
|
145
|
+
return {
|
|
146
|
+
transform,
|
|
147
|
+
getCacheKey: _getCacheKey().getCacheKey
|
|
148
|
+
};
|
|
112
149
|
}
|
|
113
|
-
exports.createExoticTransformer = createExoticTransformer;
|
|
114
150
|
//# sourceMappingURL=createExoticTransformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createExoticTransformer.js","
|
|
1
|
+
{"version":3,"file":"createExoticTransformer.js","names":["createExoticTransformer","nodeModulesPaths","transpileModules","nodeModuleMatcher","createModuleMatcher","folders","moduleIds","impossibleNodeModuleMatcher","transform","createMultiRuleTransformer","getRuleType","filename","test","rules","name","type","loaders","passthroughModule","warn","createReactNativeMatcher","reactNativeModule","createExpoMatcher","expoModule","createKnownCommunityMatcher","untranspiledModule","app","getCacheKey"],"sources":["../../src/transformer/createExoticTransformer.ts"],"sourcesContent":["// Copyright 2021-present 650 Industries (Expo). All rights reserved.\nimport { BabelTransformer } from 'metro-babel-transformer';\n\nimport {\n createExpoMatcher,\n createKnownCommunityMatcher,\n createModuleMatcher,\n createReactNativeMatcher,\n} from './createMatcher';\nimport { createMultiRuleTransformer, loaders } from './createMultiRuleTransformer';\nimport { getCacheKey } from './getCacheKey';\n\n/**\n * Create an experimental multi-rule transformer for a React Native app.\n *\n * @example\n * ```\n * module.exports = createExoticTransformer({\n * nodeModulesPaths: ['react-native'],\n * transpileModules: ['@stripe/stripe-react-native'],\n * });\n * ```\n *\n * @param props.nodeModulesPaths paths to node_modules folders, relative to project root. Default: `['node_modules']`\n * @param props.transpileModules matchers for module names that should be transpiled using the project Babel configuration. Example: `['@stripe/stripe-react-native']`\n * @returns a Metro `transformer` function and default `getCacheKey` function.\n */\nexport function createExoticTransformer({\n nodeModulesPaths,\n transpileModules,\n}: {\n nodeModulesPaths?: string[];\n transpileModules?: string[];\n}): BabelTransformer {\n if (!nodeModulesPaths) {\n nodeModulesPaths = ['node_modules'];\n }\n // Match any node modules, or monorepo module.\n const nodeModuleMatcher = createModuleMatcher({ folders: nodeModulesPaths, moduleIds: [] });\n\n // Match node modules which are so oddly written that we must\n // transpile them with every possible option (most expensive).\n const impossibleNodeModuleMatcher = createModuleMatcher({\n moduleIds: [\n // victory is too wild\n // SyntaxError in ../../node_modules/victory-native/lib/components/victory-primitives/bar.js: Missing semicolon. (9:1)\n 'victory',\n // vector icons has some hidden issues that break NCL\n '@expo/vector-icons',\n ...(transpileModules || []),\n ],\n folders: nodeModulesPaths,\n });\n\n const transform = createMultiRuleTransformer({\n // Specify which rules to use on a per-file basis, basically\n // this is used to determine which modules are node modules, and which are application code.\n getRuleType({ filename }) {\n // Is a node module, and is not one of the impossible modules.\n return nodeModuleMatcher.test(filename) && !impossibleNodeModuleMatcher.test(filename)\n ? 'module'\n : 'app';\n },\n\n // Order is very important, we use wild card matchers to transpile\n // \"every unhandled node module\" and \"every unhandled application module\".\n rules: [\n // Match bob compiler modules, use the passthrough loader.\n {\n name: 'bob',\n type: 'module',\n test: createModuleMatcher({ moduleIds: ['.*/lib/commonjs/'], folders: nodeModulesPaths }),\n transform: loaders.passthroughModule,\n warn: true,\n },\n // Match React Native modules, convert them statically using sucrase.\n {\n name: 'react-native',\n type: 'module',\n test: createReactNativeMatcher({ folders: nodeModulesPaths }),\n transform: loaders.reactNativeModule,\n warn: true,\n },\n // Match Expo SDK modules, convert them statically using sucrase.\n {\n name: 'expo-module',\n type: 'module',\n test: createExpoMatcher({ folders: nodeModulesPaths }),\n transform: loaders.expoModule,\n warn: true,\n },\n // Match known problematic modules, convert them statically using an expensive, dynamic sucrase.\n {\n name: 'sucrase',\n type: 'module',\n test: createKnownCommunityMatcher({\n folders: nodeModulesPaths,\n }),\n transform: loaders.untranspiledModule,\n warn: true,\n },\n // Pass through any unhandled node modules as passthrough, this is where the most savings occur.\n // Ideally, you want your project to pass all node modules through this loader.\n // This should be the last \"module\" rule.\n // Message library authors and ask them to ship their modules as pre-transpiled\n // commonjs, to improve the development speed of your project.\n {\n name: 'skip-module',\n type: 'module',\n test: () => true,\n transform: loaders.passthroughModule,\n },\n // All application code should be transpiled with the user's babel preset,\n // this is the most expensive operation but provides the most customization to the user.\n // The goal is to use this as sparingly as possible.\n {\n name: 'babel',\n test: () => true,\n transform: loaders.app,\n },\n ],\n });\n\n return {\n transform,\n getCacheKey,\n };\n}\n"],"mappings":";;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAVA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,uBAAT,CAAiC;EACtCC,gBADsC;EAEtCC;AAFsC,CAAjC,EAMc;EACnB,IAAI,CAACD,gBAAL,EAAuB;IACrBA,gBAAgB,GAAG,CAAC,cAAD,CAAnB;EACD,CAHkB,CAInB;;;EACA,MAAME,iBAAiB,GAAG,IAAAC,oCAAA,EAAoB;IAAEC,OAAO,EAAEJ,gBAAX;IAA6BK,SAAS,EAAE;EAAxC,CAApB,CAA1B,CALmB,CAOnB;EACA;;EACA,MAAMC,2BAA2B,GAAG,IAAAH,oCAAA,EAAoB;IACtDE,SAAS,EAAE,CACT;IACA;IACA,SAHS,EAIT;IACA,oBALS,EAMT,IAAIJ,gBAAgB,IAAI,EAAxB,CANS,CAD2C;IAStDG,OAAO,EAAEJ;EAT6C,CAApB,CAApC;EAYA,MAAMO,SAAS,GAAG,IAAAC,wDAAA,EAA2B;IAC3C;IACA;IACAC,WAAW,CAAC;MAAEC;IAAF,CAAD,EAAe;MACxB;MACA,OAAOR,iBAAiB,CAACS,IAAlB,CAAuBD,QAAvB,KAAoC,CAACJ,2BAA2B,CAACK,IAA5B,CAAiCD,QAAjC,CAArC,GACH,QADG,GAEH,KAFJ;IAGD,CAR0C;;IAU3C;IACA;IACAE,KAAK,EAAE,CACL;IACA;MACEC,IAAI,EAAE,KADR;MAEEC,IAAI,EAAE,QAFR;MAGEH,IAAI,EAAE,IAAAR,oCAAA,EAAoB;QAAEE,SAAS,EAAE,CAAC,kBAAD,CAAb;QAAmCD,OAAO,EAAEJ;MAA5C,CAApB,CAHR;MAIEO,SAAS,EAAEQ,qCAAA,CAAQC,iBAJrB;MAKEC,IAAI,EAAE;IALR,CAFK,EASL;IACA;MACEJ,IAAI,EAAE,cADR;MAEEC,IAAI,EAAE,QAFR;MAGEH,IAAI,EAAE,IAAAO,yCAAA,EAAyB;QAAEd,OAAO,EAAEJ;MAAX,CAAzB,CAHR;MAIEO,SAAS,EAAEQ,qCAAA,CAAQI,iBAJrB;MAKEF,IAAI,EAAE;IALR,CAVK,EAiBL;IACA;MACEJ,IAAI,EAAE,aADR;MAEEC,IAAI,EAAE,QAFR;MAGEH,IAAI,EAAE,IAAAS,kCAAA,EAAkB;QAAEhB,OAAO,EAAEJ;MAAX,CAAlB,CAHR;MAIEO,SAAS,EAAEQ,qCAAA,CAAQM,UAJrB;MAKEJ,IAAI,EAAE;IALR,CAlBK,EAyBL;IACA;MACEJ,IAAI,EAAE,SADR;MAEEC,IAAI,EAAE,QAFR;MAGEH,IAAI,EAAE,IAAAW,4CAAA,EAA4B;QAChClB,OAAO,EAAEJ;MADuB,CAA5B,CAHR;MAMEO,SAAS,EAAEQ,qCAAA,CAAQQ,kBANrB;MAOEN,IAAI,EAAE;IAPR,CA1BK,EAmCL;IACA;IACA;IACA;IACA;IACA;MACEJ,IAAI,EAAE,aADR;MAEEC,IAAI,EAAE,QAFR;MAGEH,IAAI,EAAE,MAAM,IAHd;MAIEJ,SAAS,EAAEQ,qCAAA,CAAQC;IAJrB,CAxCK,EA8CL;IACA;IACA;IACA;MACEH,IAAI,EAAE,OADR;MAEEF,IAAI,EAAE,MAAM,IAFd;MAGEJ,SAAS,EAAEQ,qCAAA,CAAQS;IAHrB,CAjDK;EAZoC,CAA3B,CAAlB;EAqEA,OAAO;IACLjB,SADK;IAELkB,WAAW,EAAXA;EAFK,CAAP;AAID"}
|
|
@@ -1,48 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createKnownCommunityMatcher = exports.createExpoMatcher = void 0;
|
|
7
|
+
exports.createModuleMatcher = createModuleMatcher;
|
|
8
|
+
exports.createReactNativeMatcher = void 0;
|
|
9
|
+
|
|
2
10
|
// Copyright 2021-present 650 Industries (Expo). All rights reserved.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
function createModuleMatcher({
|
|
12
|
+
folders = ['node_modules'],
|
|
13
|
+
moduleIds
|
|
14
|
+
}) {
|
|
15
|
+
const modulePathsGroup = folders.join('|');
|
|
16
|
+
const moduleMatchersGroup = moduleIds.join('|');
|
|
17
|
+
const moduleMatcherId = '^' + [modulePathsGroup, moduleMatchersGroup].map(value => `(?:${value})`).join('/');
|
|
18
|
+
return new RegExp(moduleMatcherId);
|
|
10
19
|
}
|
|
11
|
-
|
|
12
|
-
const createReactNativeMatcher = ({
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
|
|
21
|
+
const createReactNativeMatcher = ({
|
|
22
|
+
folders
|
|
23
|
+
}) => createModuleMatcher({
|
|
24
|
+
folders,
|
|
25
|
+
moduleIds: ['react-native/']
|
|
15
26
|
});
|
|
27
|
+
|
|
16
28
|
exports.createReactNativeMatcher = createReactNativeMatcher;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
29
|
+
|
|
30
|
+
const createExpoMatcher = ({
|
|
31
|
+
folders
|
|
32
|
+
}) => createModuleMatcher({
|
|
33
|
+
folders,
|
|
34
|
+
// We'll work to start reducing this.
|
|
35
|
+
moduleIds: ['expo', '@expo', '@unimodules', '@use-expo']
|
|
36
|
+
}); // TODO: Make this list as short as possible before releasing.
|
|
24
37
|
// TODO: Add SDK version compat list.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// Special case for testing expo/expo repo
|
|
42
|
-
'html-elements/',
|
|
43
|
-
// shared-element
|
|
44
|
-
'react-navigation-',
|
|
45
|
-
],
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
exports.createExpoMatcher = createExpoMatcher;
|
|
41
|
+
|
|
42
|
+
const createKnownCommunityMatcher = ({
|
|
43
|
+
folders,
|
|
44
|
+
moduleIds = []
|
|
45
|
+
} = {}) => createModuleMatcher({
|
|
46
|
+
folders,
|
|
47
|
+
moduleIds: [...moduleIds, // The more complex, the longer the entire project takes...
|
|
48
|
+
// react-native-community, react-native-masked-view, react-native-picker, react-native-segmented-control, react-native
|
|
49
|
+
'@react-', // @sentry/react-native
|
|
50
|
+
'@(?:[\\w|-]+)/react-native', 'react-native-', 'victory-', 'native-base', 'styled-components', // three.js
|
|
51
|
+
'three/build/three.module.js', 'three/examples/jsm', // Special case for testing expo/expo repo
|
|
52
|
+
'html-elements/', // shared-element
|
|
53
|
+
'react-navigation-']
|
|
46
54
|
});
|
|
55
|
+
|
|
47
56
|
exports.createKnownCommunityMatcher = createKnownCommunityMatcher;
|
|
48
57
|
//# sourceMappingURL=createMatcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMatcher.js","
|
|
1
|
+
{"version":3,"file":"createMatcher.js","names":["createModuleMatcher","folders","moduleIds","modulePathsGroup","join","moduleMatchersGroup","moduleMatcherId","map","value","RegExp","createReactNativeMatcher","createExpoMatcher","createKnownCommunityMatcher"],"sources":["../../src/transformer/createMatcher.ts"],"sourcesContent":["// Copyright 2021-present 650 Industries (Expo). All rights reserved.\n\nexport function createModuleMatcher({\n folders = ['node_modules'],\n moduleIds,\n}: {\n folders?: string[];\n moduleIds: string[];\n}) {\n const modulePathsGroup = folders.join('|');\n\n const moduleMatchersGroup = moduleIds.join('|');\n\n const moduleMatcherId =\n '^' + [modulePathsGroup, moduleMatchersGroup].map(value => `(?:${value})`).join('/');\n\n return new RegExp(moduleMatcherId);\n}\n\nexport const createReactNativeMatcher = ({ folders }: { folders?: string[] }) =>\n createModuleMatcher({\n folders,\n moduleIds: ['react-native/'],\n });\n\nexport const createExpoMatcher = ({ folders }: { folders?: string[] }) =>\n createModuleMatcher({\n folders,\n // We'll work to start reducing this.\n moduleIds: ['expo', '@expo', '@unimodules', '@use-expo'],\n });\n\n// TODO: Make this list as short as possible before releasing.\n// TODO: Add SDK version compat list.\nexport const createKnownCommunityMatcher = ({\n folders,\n moduleIds = [],\n}: {\n folders?: string[];\n moduleIds?: string[];\n} = {}) =>\n createModuleMatcher({\n folders,\n moduleIds: [\n ...moduleIds,\n // The more complex, the longer the entire project takes...\n // react-native-community, react-native-masked-view, react-native-picker, react-native-segmented-control, react-native\n '@react-',\n // @sentry/react-native\n '@(?:[\\\\w|-]+)/react-native',\n 'react-native-',\n 'victory-',\n 'native-base',\n 'styled-components',\n // three.js\n 'three/build/three.module.js',\n 'three/examples/jsm',\n // Special case for testing expo/expo repo\n 'html-elements/',\n // shared-element\n 'react-navigation-',\n ],\n });\n"],"mappings":";;;;;;;;;AAAA;AAEO,SAASA,mBAAT,CAA6B;EAClCC,OAAO,GAAG,CAAC,cAAD,CADwB;EAElCC;AAFkC,CAA7B,EAMJ;EACD,MAAMC,gBAAgB,GAAGF,OAAO,CAACG,IAAR,CAAa,GAAb,CAAzB;EAEA,MAAMC,mBAAmB,GAAGH,SAAS,CAACE,IAAV,CAAe,GAAf,CAA5B;EAEA,MAAME,eAAe,GACnB,MAAM,CAACH,gBAAD,EAAmBE,mBAAnB,EAAwCE,GAAxC,CAA4CC,KAAK,IAAK,MAAKA,KAAM,GAAjE,EAAqEJ,IAArE,CAA0E,GAA1E,CADR;EAGA,OAAO,IAAIK,MAAJ,CAAWH,eAAX,CAAP;AACD;;AAEM,MAAMI,wBAAwB,GAAG,CAAC;EAAET;AAAF,CAAD,KACtCD,mBAAmB,CAAC;EAClBC,OADkB;EAElBC,SAAS,EAAE,CAAC,eAAD;AAFO,CAAD,CADd;;;;AAMA,MAAMS,iBAAiB,GAAG,CAAC;EAAEV;AAAF,CAAD,KAC/BD,mBAAmB,CAAC;EAClBC,OADkB;EAElB;EACAC,SAAS,EAAE,CAAC,MAAD,EAAS,OAAT,EAAkB,aAAlB,EAAiC,WAAjC;AAHO,CAAD,CADd,C,CAOP;AACA;;;;;AACO,MAAMU,2BAA2B,GAAG,CAAC;EAC1CX,OAD0C;EAE1CC,SAAS,GAAG;AAF8B,IAMxC,EANuC,KAOzCF,mBAAmB,CAAC;EAClBC,OADkB;EAElBC,SAAS,EAAE,CACT,GAAGA,SADM,EAET;EACA;EACA,SAJS,EAKT;EACA,4BANS,EAOT,eAPS,EAQT,UARS,EAST,aATS,EAUT,mBAVS,EAWT;EACA,6BAZS,EAaT,oBAbS,EAcT;EACA,gBAfS,EAgBT;EACA,mBAjBS;AAFO,CAAD,CAPd"}
|