@expo/metro-config 0.17.2 → 0.17.4
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 +239 -366
- package/build/ExpoMetroConfig.js.map +1 -1
- package/build/babel-core.js +6 -23
- package/build/babel-core.js.map +1 -1
- package/build/babel-transformer.js +117 -162
- package/build/babel-transformer.js.map +1 -1
- package/build/customizeFrame.js +84 -78
- package/build/customizeFrame.js.map +1 -1
- package/build/env.js +23 -37
- package/build/env.js.map +1 -1
- package/build/file-store.js +13 -21
- package/build/file-store.js.map +1 -1
- package/build/getModulesPaths.js +31 -48
- package/build/getModulesPaths.js.map +1 -1
- package/build/getWatchFolders.js +70 -98
- package/build/getWatchFolders.js.map +1 -1
- package/build/loadBabelConfig.js +30 -49
- package/build/loadBabelConfig.js.map +1 -1
- package/build/rewriteRequestUrl.js +82 -142
- package/build/rewriteRequestUrl.js.map +1 -1
- package/build/serializer/debugId.js +23 -22
- package/build/serializer/debugId.js.map +1 -1
- package/build/serializer/environmentVariableSerializerPlugin.js +90 -101
- package/build/serializer/environmentVariableSerializerPlugin.js.map +1 -1
- package/build/serializer/exportHermes.js +96 -133
- package/build/serializer/exportHermes.js.map +1 -1
- package/build/serializer/exportPath.js +18 -35
- package/build/serializer/exportPath.js.map +1 -1
- package/build/serializer/fork/baseJSBundle.js +124 -147
- package/build/serializer/fork/baseJSBundle.js.map +1 -1
- package/build/serializer/fork/js.js +81 -116
- package/build/serializer/fork/js.js.map +1 -1
- package/build/serializer/fork/processModules.js +22 -36
- package/build/serializer/fork/processModules.js.map +1 -1
- package/build/serializer/getCssDeps.js +64 -95
- package/build/serializer/getCssDeps.js.map +1 -1
- package/build/serializer/jsOutput.js +6 -16
- package/build/serializer/jsOutput.js.map +1 -1
- package/build/serializer/serializeChunks.js +406 -483
- package/build/serializer/serializeChunks.js.map +1 -1
- package/build/serializer/serializerAssets.js +1 -0
- package/build/serializer/serializerAssets.js.map +1 -1
- package/build/serializer/withExpoSerializers.js +165 -236
- package/build/serializer/withExpoSerializers.js.map +1 -1
- package/build/transform-worker/asset-transformer.js +21 -44
- package/build/transform-worker/asset-transformer.js.map +1 -1
- package/build/transform-worker/css-modules.js +57 -84
- package/build/transform-worker/css-modules.js.map +1 -1
- package/build/transform-worker/css.js +21 -20
- package/build/transform-worker/css.js.map +1 -1
- package/build/transform-worker/getAssets.js +38 -75
- package/build/transform-worker/getAssets.js.map +1 -1
- package/build/transform-worker/metro-transform-worker.js +384 -489
- package/build/transform-worker/metro-transform-worker.js.map +1 -1
- package/build/transform-worker/postcss.js +176 -233
- package/build/transform-worker/postcss.js.map +1 -1
- package/build/transform-worker/sass.js +30 -38
- package/build/transform-worker/sass.js.map +1 -1
- package/build/transform-worker/transform-worker.js +156 -188
- package/build/transform-worker/transform-worker.js.map +1 -1
- package/build/transform-worker/utils/require.js +30 -28
- package/build/transform-worker/utils/require.js.map +1 -1
- package/build/transformSync.js +40 -28
- package/build/transformSync.js.map +1 -1
- package/build/transformer/createExoticTransformer.js +96 -129
- package/build/transformer/createExoticTransformer.js.map +1 -1
- package/build/transformer/createMatcher.js +37 -46
- package/build/transformer/createMatcher.js.map +1 -1
- package/build/transformer/createMultiRuleTransformer.js +170 -240
- package/build/transformer/createMultiRuleTransformer.js.map +1 -1
- package/build/transformer/generateFunctionMap.js +20 -23
- package/build/transformer/generateFunctionMap.js.map +1 -1
- package/build/transformer/getBabelConfig.js +94 -127
- package/build/transformer/getBabelConfig.js.map +1 -1
- package/build/transformer/getCacheKey.js +17 -31
- package/build/transformer/getCacheKey.js.map +1 -1
- package/build/transformer/index.js +11 -62
- package/build/transformer/index.js.map +1 -1
- package/build/transformer/metro-expo-exotic-babel-transformer.js +3 -12
- package/build/transformer/metro-expo-exotic-babel-transformer.js.map +1 -1
- package/build/traveling/metro-config.js +12 -19
- package/build/traveling/metro-config.js.map +1 -1
- package/build/utils/hash.js +8 -14
- package/build/utils/hash.js.map +1 -1
- package/package.json +6 -6
package/build/customizeFrame.js
CHANGED
|
@@ -1,91 +1,97 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.INTERNAL_CALLSITES_REGEX = void 0;
|
|
7
|
-
exports.getDefaultCustomizeFrame = getDefaultCustomizeFrame;
|
|
8
|
-
function _url() {
|
|
9
|
-
const data = require("url");
|
|
10
|
-
_url = function () {
|
|
11
|
-
return data;
|
|
12
|
-
};
|
|
13
|
-
return data;
|
|
14
|
-
}
|
|
15
|
-
// Copyright 2023-present 650 Industries (Expo). All rights reserved.
|
|
16
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultCustomizeFrame = exports.INTERNAL_CALLSITES_REGEX = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
17
5
|
// Import only the types here, the values will be imported from the project, at runtime.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
'/
|
|
23
|
-
|
|
24
|
-
'
|
|
25
|
-
|
|
26
|
-
'node_modules/
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
//
|
|
30
|
-
'
|
|
31
|
-
//
|
|
32
|
-
'
|
|
33
|
-
|
|
34
|
-
'/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
6
|
+
exports.INTERNAL_CALLSITES_REGEX = new RegExp([
|
|
7
|
+
'/Libraries/Renderer/implementations/.+\\.js$',
|
|
8
|
+
'/Libraries/BatchedBridge/MessageQueue\\.js$',
|
|
9
|
+
'/Libraries/YellowBox/.+\\.js$',
|
|
10
|
+
'/Libraries/LogBox/.+\\.js$',
|
|
11
|
+
'/Libraries/Core/Timers/.+\\.js$',
|
|
12
|
+
'node_modules/react-devtools-core/.+\\.js$',
|
|
13
|
+
'node_modules/react-refresh/.+\\.js$',
|
|
14
|
+
'node_modules/scheduler/.+\\.js$',
|
|
15
|
+
// Metro replaces `require()` with a different method,
|
|
16
|
+
// we want to omit this method from the stack trace.
|
|
17
|
+
// This is akin to most React tooling.
|
|
18
|
+
'/metro/.*/polyfills/require.js$',
|
|
19
|
+
// Hide frames related to a fast refresh.
|
|
20
|
+
'/metro/.*/lib/bundle-modules/.+\\.js$',
|
|
21
|
+
'node_modules/react-native/Libraries/Utilities/HMRClient.js$',
|
|
22
|
+
'node_modules/eventemitter3/index.js',
|
|
23
|
+
'node_modules/event-target-shim/dist/.+\\.js$',
|
|
24
|
+
// Improve errors thrown by invariant (ex: `Invariant Violation: "main" has not been registered`).
|
|
25
|
+
'node_modules/invariant/.+\\.js$',
|
|
26
|
+
// Remove babel runtime additions
|
|
27
|
+
'node_modules/regenerator-runtime/.+\\.js$',
|
|
28
|
+
// Remove react native setImmediate ponyfill
|
|
29
|
+
'node_modules/promise/setimmediate/.+\\.js$',
|
|
30
|
+
// Babel helpers that implement language features
|
|
31
|
+
'node_modules/@babel/runtime/.+\\.js$',
|
|
32
|
+
// Hide Hermes internal bytecode
|
|
33
|
+
'/InternalBytecode/InternalBytecode\\.js$',
|
|
34
|
+
// Block native code invocations
|
|
35
|
+
`\\[native code\\]`,
|
|
36
|
+
// Hide react-dom (web)
|
|
37
|
+
'node_modules/react-dom/.+\\.js$',
|
|
38
|
+
// Hide node.js evaluation code
|
|
39
|
+
'node_modules/require-from-string/.+\\.js$',
|
|
40
|
+
// Block expo's metro-runtime
|
|
41
|
+
'@expo/metro-runtime/.+\\.ts',
|
|
42
|
+
// Block upstream metro-runtime
|
|
43
|
+
'/metro-runtime/.+\\.js$',
|
|
44
|
+
// Block all whatwg polyfills
|
|
45
|
+
'node_modules/whatwg-.+\\.js$',
|
|
46
|
+
// Hide expo-router warnings which are often wrapping all routes and imports.
|
|
47
|
+
'node_modules/expo-router/build/',
|
|
48
|
+
// No Expo CLI logs
|
|
49
|
+
'/@expo/cli/.+',
|
|
50
|
+
// No context modules as these are virtual
|
|
51
|
+
'.+?ctx=[a-zA-Z0-9]+$',
|
|
52
|
+
// Hide react-native-web warning wrappers. These are most likely related to style deprecations.
|
|
53
|
+
'/react-native-web/dist/.+\\.js$',
|
|
54
|
+
].join('|'));
|
|
48
55
|
function isUrl(value) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
try {
|
|
57
|
+
// eslint-disable-next-line no-new
|
|
58
|
+
new url_1.URL(value);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
56
64
|
}
|
|
57
|
-
|
|
58
65
|
/**
|
|
59
66
|
* The default frame processor. This is used to modify the stack traces.
|
|
60
67
|
* This method attempts to collapse all frames that aren't relevant to
|
|
61
68
|
* the user by default.
|
|
62
69
|
*/
|
|
63
70
|
function getDefaultCustomizeFrame() {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
collapse
|
|
71
|
+
return (frame) => {
|
|
72
|
+
if (frame.file && isUrl(frame.file)) {
|
|
73
|
+
return {
|
|
74
|
+
...frame,
|
|
75
|
+
// HACK: This prevents Metro from attempting to read the invalid file URL it sent us.
|
|
76
|
+
lineNumber: null,
|
|
77
|
+
column: null,
|
|
78
|
+
// This prevents the invalid frame from being shown by default.
|
|
79
|
+
collapse: true,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
let collapse = Boolean(frame.file && exports.INTERNAL_CALLSITES_REGEX.test(frame.file));
|
|
83
|
+
if (!collapse) {
|
|
84
|
+
// This represents the first frame of the stacktrace.
|
|
85
|
+
// Often this looks like: `__r(0);`.
|
|
86
|
+
// The URL will also be unactionable in the app and therefore not very useful to the developer.
|
|
87
|
+
if (frame.column === 3 &&
|
|
88
|
+
frame.methodName === 'global code' &&
|
|
89
|
+
frame.file?.match(/^https?:\/\//g)) {
|
|
90
|
+
collapse = true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { ...(frame || {}), collapse };
|
|
88
94
|
};
|
|
89
|
-
};
|
|
90
95
|
}
|
|
96
|
+
exports.getDefaultCustomizeFrame = getDefaultCustomizeFrame;
|
|
91
97
|
//# sourceMappingURL=customizeFrame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customizeFrame.js","
|
|
1
|
+
{"version":3,"file":"customizeFrame.js","sourceRoot":"","sources":["../src/customizeFrame.ts"],"names":[],"mappings":";;;AAEA,6BAA0B;AAI1B,wFAAwF;AAC3E,QAAA,wBAAwB,GAAG,IAAI,MAAM,CAChD;IACE,8CAA8C;IAC9C,6CAA6C;IAC7C,+BAA+B;IAC/B,4BAA4B;IAC5B,iCAAiC;IACjC,2CAA2C;IAC3C,qCAAqC;IACrC,iCAAiC;IACjC,sDAAsD;IACtD,oDAAoD;IACpD,sCAAsC;IACtC,iCAAiC;IACjC,yCAAyC;IACzC,uCAAuC;IACvC,6DAA6D;IAC7D,qCAAqC;IACrC,8CAA8C;IAC9C,kGAAkG;IAClG,iCAAiC;IACjC,iCAAiC;IACjC,2CAA2C;IAC3C,4CAA4C;IAC5C,4CAA4C;IAC5C,iDAAiD;IACjD,sCAAsC;IACtC,gCAAgC;IAChC,0CAA0C;IAC1C,gCAAgC;IAChC,mBAAmB;IACnB,uBAAuB;IACvB,iCAAiC;IACjC,+BAA+B;IAC/B,2CAA2C;IAC3C,6BAA6B;IAC7B,6BAA6B;IAC7B,+BAA+B;IAC/B,yBAAyB;IAEzB,6BAA6B;IAC7B,8BAA8B;IAC9B,6EAA6E;IAC7E,iCAAiC;IACjC,mBAAmB;IACnB,eAAe;IACf,0CAA0C;IAC1C,sBAAsB;IACtB,+FAA+F;IAC/F,iCAAiC;CAClC,CAAC,IAAI,CAAC,GAAG,CAAC,CACZ,CAAC;AAEF,SAAS,KAAK,CAAC,KAAa;IAC1B,IAAI;QACF,kCAAkC;QAClC,IAAI,SAAG,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAED;;;;GAIG;AACH,SAAgB,wBAAwB;IACtC,OAAO,CAAC,KAAwC,EAAE,EAAE;QAClD,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACnC,OAAO;gBACL,GAAG,KAAK;gBACR,qFAAqF;gBACrF,UAAU,EAAE,IAAI;gBAChB,MAAM,EAAE,IAAI;gBACZ,+DAA+D;gBAC/D,QAAQ,EAAE,IAAI;aACf,CAAC;SACH;QACD,IAAI,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,gCAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAEhF,IAAI,CAAC,QAAQ,EAAE;YACb,qDAAqD;YACrD,oCAAoC;YACpC,+FAA+F;YAC/F,IACE,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,UAAU,KAAK,aAAa;gBAClC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,eAAe,CAAC,EAClC;gBACA,QAAQ,GAAG,IAAI,CAAC;aACjB;SACF;QAED,OAAO,EAAE,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxC,CAAC,CAAC;AACJ,CAAC;AA7BD,4DA6BC"}
|
package/build/env.js
CHANGED
|
@@ -1,42 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.env = void 0;
|
|
7
|
-
|
|
8
|
-
const data = require("getenv");
|
|
9
|
-
_getenv = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
4
|
+
const getenv_1 = require("getenv");
|
|
14
5
|
class Env {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** Disable Environment Variable injection in client bundles. */
|
|
36
|
-
get EXPO_NO_CLIENT_ENV_VARS() {
|
|
37
|
-
return (0, _getenv().boolish)('EXPO_NO_CLIENT_ENV_VARS', false);
|
|
38
|
-
}
|
|
6
|
+
/** Enable debug logging */
|
|
7
|
+
get EXPO_DEBUG() {
|
|
8
|
+
return (0, getenv_1.boolish)('EXPO_DEBUG', false);
|
|
9
|
+
}
|
|
10
|
+
/** Enable the experimental "exotic" mode. [Learn more](https://blog.expo.dev/drastically-faster-bundling-in-react-native-a54f268e0ed1). */
|
|
11
|
+
get EXPO_USE_EXOTIC() {
|
|
12
|
+
return (0, getenv_1.boolish)('EXPO_USE_EXOTIC', false);
|
|
13
|
+
}
|
|
14
|
+
/** The React Metro port that's baked into react-native scripts and tools. */
|
|
15
|
+
get RCT_METRO_PORT() {
|
|
16
|
+
return (0, getenv_1.int)('RCT_METRO_PORT', 8081);
|
|
17
|
+
}
|
|
18
|
+
/** Enable auto server root detection for Metro. This will change the server root to the workspace root. */
|
|
19
|
+
get EXPO_USE_METRO_WORKSPACE_ROOT() {
|
|
20
|
+
return (0, getenv_1.boolish)('EXPO_USE_METRO_WORKSPACE_ROOT', false);
|
|
21
|
+
}
|
|
22
|
+
/** Disable Environment Variable injection in client bundles. */
|
|
23
|
+
get EXPO_NO_CLIENT_ENV_VARS() {
|
|
24
|
+
return (0, getenv_1.boolish)('EXPO_NO_CLIENT_ENV_VARS', false);
|
|
25
|
+
}
|
|
39
26
|
}
|
|
40
|
-
|
|
41
|
-
exports.env = env;
|
|
27
|
+
exports.env = new Env();
|
|
42
28
|
//# sourceMappingURL=env.js.map
|
package/build/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAEtC,MAAM,GAAG;IACP,2BAA2B;IAC3B,IAAI,UAAU;QACZ,OAAO,IAAA,gBAAO,EAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,2IAA2I;IAC3I,IAAI,eAAe;QACjB,OAAO,IAAA,gBAAO,EAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,6EAA6E;IAC7E,IAAI,cAAc;QAChB,OAAO,IAAA,YAAG,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,2GAA2G;IAC3G,IAAI,6BAA6B;QAC/B,OAAO,IAAA,gBAAO,EAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC;IAED,gEAAgE;IAChE,IAAI,uBAAuB;QACzB,OAAO,IAAA,gBAAO,EAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;CACF;AAEY,QAAA,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC"}
|
package/build/file-store.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FileStore = void 0;
|
|
7
|
-
|
|
8
|
-
const data = _interopRequireDefault(require("metro-cache/src/stores/FileStore"));
|
|
9
|
-
_FileStore = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
|
+
const FileStore_1 = __importDefault(require("metro-cache/src/stores/FileStore"));
|
|
15
8
|
const debug = require('debug')('expo:metro:cache');
|
|
16
|
-
class FileStore extends
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
class FileStore extends FileStore_1.default {
|
|
10
|
+
async set(key, value) {
|
|
11
|
+
// Prevent caching of CSS files that have the skipCache flag set.
|
|
12
|
+
if (value?.output?.[0]?.data?.css?.skipCache) {
|
|
13
|
+
debug('Skipping caching for CSS file:', value.path);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return await super.set(key, value);
|
|
23
17
|
}
|
|
24
|
-
return await super.set(key, value);
|
|
25
|
-
}
|
|
26
18
|
}
|
|
27
19
|
exports.FileStore = FileStore;
|
|
28
20
|
//# sourceMappingURL=file-store.js.map
|
package/build/file-store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-store.js","
|
|
1
|
+
{"version":3,"file":"file-store.js","sourceRoot":"","sources":["../src/file-store.ts"],"names":[],"mappings":";;;;;;AAAA,iFAAiE;AAEjE,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAuB,CAAC;AAEzE,MAAa,SAAa,SAAQ,mBAAoB;IACpD,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAU;QAC/B,iEAAiE;QACjE,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE;YAC5C,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACpD,OAAO;SACR;QACD,OAAO,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AATD,8BASC"}
|
package/build/getModulesPaths.js
CHANGED
|
@@ -1,58 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.getModulesPaths =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const data = _interopRequireDefault(require("find-yarn-workspace-root"));
|
|
11
|
-
_findYarnWorkspaceRoot = function () {
|
|
12
|
-
return data;
|
|
13
|
-
};
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
function _path() {
|
|
17
|
-
const data = _interopRequireDefault(require("path"));
|
|
18
|
-
_path = function () {
|
|
19
|
-
return data;
|
|
20
|
-
};
|
|
21
|
-
return data;
|
|
22
|
-
}
|
|
23
|
-
function _env() {
|
|
24
|
-
const data = require("./env");
|
|
25
|
-
_env = function () {
|
|
26
|
-
return data;
|
|
27
|
-
};
|
|
28
|
-
return data;
|
|
29
|
-
}
|
|
30
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getServerRoot = exports.getModulesPaths = exports.getWorkspaceRoot = void 0;
|
|
7
|
+
const find_yarn_workspace_root_1 = __importDefault(require("find-yarn-workspace-root"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const env_1 = require("./env");
|
|
31
10
|
/** Wraps `findWorkspaceRoot` and guards against having an empty `package.json` file in an upper directory. */
|
|
32
11
|
function getWorkspaceRoot(projectRoot) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
12
|
+
try {
|
|
13
|
+
return (0, find_yarn_workspace_root_1.default)(projectRoot);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (error.message.includes('Unexpected end of JSON input')) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
throw error;
|
|
38
20
|
}
|
|
39
|
-
throw error;
|
|
40
|
-
}
|
|
41
21
|
}
|
|
22
|
+
exports.getWorkspaceRoot = getWorkspaceRoot;
|
|
42
23
|
function getModulesPaths(projectRoot) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return paths;
|
|
24
|
+
const paths = [];
|
|
25
|
+
// Only add the project root if it's not the current working directory
|
|
26
|
+
// this minimizes the chance of Metro resolver breaking on new Node.js versions.
|
|
27
|
+
const workspaceRoot = getWorkspaceRoot(path_1.default.resolve(projectRoot)); // Absolute path or null
|
|
28
|
+
if (workspaceRoot) {
|
|
29
|
+
paths.push(path_1.default.resolve(projectRoot, 'node_modules'));
|
|
30
|
+
paths.push(path_1.default.resolve(workspaceRoot, 'node_modules'));
|
|
31
|
+
}
|
|
32
|
+
return paths;
|
|
53
33
|
}
|
|
34
|
+
exports.getModulesPaths = getModulesPaths;
|
|
54
35
|
function getServerRoot(projectRoot) {
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
return env_1.env.EXPO_USE_METRO_WORKSPACE_ROOT
|
|
37
|
+
? getWorkspaceRoot(projectRoot) ?? projectRoot
|
|
38
|
+
: projectRoot;
|
|
57
39
|
}
|
|
40
|
+
exports.getServerRoot = getServerRoot;
|
|
58
41
|
//# sourceMappingURL=getModulesPaths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getModulesPaths.js","
|
|
1
|
+
{"version":3,"file":"getModulesPaths.js","sourceRoot":"","sources":["../src/getModulesPaths.ts"],"names":[],"mappings":";;;;;;AAAA,wFAAyD;AACzD,gDAAwB;AAExB,+BAA4B;AAE5B,8GAA8G;AAC9G,SAAgB,gBAAgB,CAAC,WAAmB;IAClD,IAAI;QACF,OAAO,IAAA,kCAAiB,EAAC,WAAW,CAAC,CAAC;KACvC;IAAC,OAAO,KAAU,EAAE;QACnB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAC,EAAE;YAC1D,OAAO,IAAI,CAAC;SACb;QACD,MAAM,KAAK,CAAC;KACb;AACH,CAAC;AATD,4CASC;AAED,SAAgB,eAAe,CAAC,WAAmB;IACjD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,sEAAsE;IACtE,gFAAgF;IAChF,MAAM,aAAa,GAAG,gBAAgB,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,wBAAwB;IAC3F,IAAI,aAAa,EAAE;QACjB,KAAK,CAAC,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;KACzD;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAZD,0CAYC;AAED,SAAgB,aAAa,CAAC,WAAmB;IAC/C,OAAO,SAAG,CAAC,6BAA6B;QACtC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,IAAI,WAAW;QAC9C,CAAC,CAAC,WAAW,CAAC;AAClB,CAAC;AAJD,sCAIC"}
|