@vxrn/vite-plugin-metro 2.18.0 → 2.18.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.
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.cjs +30 -5
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.cjs +30 -5
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js +30 -5
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs +32 -7
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js +32 -7
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/getMetroConfigFromViteConfig.test.ts +107 -0
- package/src/metro-config/getMetroConfigFromViteConfig.ts +42 -7
- package/types/metro-config/getMetroConfigFromViteConfig.d.ts.map +1 -1
|
@@ -156,6 +156,23 @@ function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform
|
|
|
156
156
|
function isBareSpecifier(name) {
|
|
157
157
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
158
158
|
}
|
|
159
|
+
function isUnresolvableModule(error) {
|
|
160
|
+
if (!error || typeof error !== "object") return false;
|
|
161
|
+
if (error.type === "UnableToResolveError") return true;
|
|
162
|
+
const message = error.message;
|
|
163
|
+
if (typeof message === "string" && message.startsWith("Unable to resolve module")) return true;
|
|
164
|
+
const { dirPaths, extraPaths } = error;
|
|
165
|
+
return Array.isArray(dirPaths) && Array.isArray(extraPaths);
|
|
166
|
+
}
|
|
167
|
+
function rootHasPackage(projectRoot, packageName) {
|
|
168
|
+
let directory = projectRoot;
|
|
169
|
+
while (true) {
|
|
170
|
+
if ((0, import_node_fs.existsSync)((0, import_node_path.join)(directory, "node_modules", packageName, "package.json"))) return true;
|
|
171
|
+
const parent = (0, import_node_path.dirname)(directory);
|
|
172
|
+
if (parent === directory) return false;
|
|
173
|
+
directory = parent;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
159
176
|
function bareMainModuleForRequest(moduleName, mainModuleName) {
|
|
160
177
|
if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;
|
|
161
178
|
if (moduleName === `./${mainModuleName}`) return mainModuleName;
|
|
@@ -177,12 +194,20 @@ function enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {
|
|
|
177
194
|
const request = bareMain ?? moduleName;
|
|
178
195
|
const packageEnd = request.indexOf("/", request.startsWith("@") ? request.indexOf("/") + 1 : 0);
|
|
179
196
|
const packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);
|
|
180
|
-
const resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {
|
|
181
|
-
...context,
|
|
182
|
-
originModulePath: rootOrigin
|
|
183
|
-
} : context;
|
|
184
197
|
const resolveRequest = innerResolveRequest || context.resolveRequest;
|
|
185
|
-
|
|
198
|
+
if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {
|
|
199
|
+
return resolveRequest(context, request, platform);
|
|
200
|
+
}
|
|
201
|
+
try {
|
|
202
|
+
return resolveRequest({
|
|
203
|
+
...context,
|
|
204
|
+
originModulePath: rootOrigin
|
|
205
|
+
}, request, platform);
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (!isUnresolvableModule(error)) throw error;
|
|
208
|
+
if (rootHasPackage(projectRoot, packageName)) throw error;
|
|
209
|
+
return resolveRequest(context, request, platform);
|
|
210
|
+
}
|
|
186
211
|
}
|
|
187
212
|
}
|
|
188
213
|
};
|
|
@@ -168,6 +168,23 @@ function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform
|
|
|
168
168
|
function isBareSpecifier(name) {
|
|
169
169
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
170
170
|
}
|
|
171
|
+
function isUnresolvableModule(error) {
|
|
172
|
+
if (!error || typeof error !== "object") return false;
|
|
173
|
+
if (error.type === "UnableToResolveError") return true;
|
|
174
|
+
var message = error.message;
|
|
175
|
+
if (typeof message === "string" && message.startsWith("Unable to resolve module")) return true;
|
|
176
|
+
var { dirPaths, extraPaths } = error;
|
|
177
|
+
return Array.isArray(dirPaths) && Array.isArray(extraPaths);
|
|
178
|
+
}
|
|
179
|
+
function rootHasPackage(projectRoot, packageName) {
|
|
180
|
+
var directory = projectRoot;
|
|
181
|
+
while (true) {
|
|
182
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(directory, "node_modules", packageName, "package.json"))) return true;
|
|
183
|
+
var parent = (0, import_path.dirname)(directory);
|
|
184
|
+
if (parent === directory) return false;
|
|
185
|
+
directory = parent;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
function bareMainModuleForRequest(moduleName, mainModuleName) {
|
|
172
189
|
if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;
|
|
173
190
|
if (moduleName === `./${mainModuleName}`) return mainModuleName;
|
|
@@ -190,12 +207,20 @@ function enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {
|
|
|
190
207
|
var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;
|
|
191
208
|
var packageEnd = request.indexOf("/", request.startsWith("@") ? request.indexOf("/") + 1 : 0);
|
|
192
209
|
var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);
|
|
193
|
-
var resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {
|
|
194
|
-
...context,
|
|
195
|
-
originModulePath: rootOrigin
|
|
196
|
-
} : context;
|
|
197
210
|
var resolveRequest2 = innerResolveRequest || context.resolveRequest;
|
|
198
|
-
|
|
211
|
+
if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {
|
|
212
|
+
return resolveRequest2(context, request, platform);
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
return resolveRequest2({
|
|
216
|
+
...context,
|
|
217
|
+
originModulePath: rootOrigin
|
|
218
|
+
}, request, platform);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
if (!isUnresolvableModule(error)) throw error;
|
|
221
|
+
if (rootHasPackage(projectRoot, packageName)) throw error;
|
|
222
|
+
return resolveRequest2(context, request, platform);
|
|
223
|
+
}
|
|
199
224
|
}
|
|
200
225
|
}
|
|
201
226
|
};
|
|
@@ -168,6 +168,23 @@ function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform
|
|
|
168
168
|
function isBareSpecifier(name) {
|
|
169
169
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
170
170
|
}
|
|
171
|
+
function isUnresolvableModule(error) {
|
|
172
|
+
if (!error || typeof error !== "object") return false;
|
|
173
|
+
if (error.type === "UnableToResolveError") return true;
|
|
174
|
+
var message = error.message;
|
|
175
|
+
if (typeof message === "string" && message.startsWith("Unable to resolve module")) return true;
|
|
176
|
+
var { dirPaths, extraPaths } = error;
|
|
177
|
+
return Array.isArray(dirPaths) && Array.isArray(extraPaths);
|
|
178
|
+
}
|
|
179
|
+
function rootHasPackage(projectRoot, packageName) {
|
|
180
|
+
var directory = projectRoot;
|
|
181
|
+
while (true) {
|
|
182
|
+
if ((0, import_fs.existsSync)((0, import_path.join)(directory, "node_modules", packageName, "package.json"))) return true;
|
|
183
|
+
var parent = (0, import_path.dirname)(directory);
|
|
184
|
+
if (parent === directory) return false;
|
|
185
|
+
directory = parent;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
171
188
|
function bareMainModuleForRequest(moduleName, mainModuleName) {
|
|
172
189
|
if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;
|
|
173
190
|
if (moduleName === `./${mainModuleName}`) return mainModuleName;
|
|
@@ -190,12 +207,20 @@ function enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {
|
|
|
190
207
|
var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;
|
|
191
208
|
var packageEnd = request.indexOf("/", request.startsWith("@") ? request.indexOf("/") + 1 : 0);
|
|
192
209
|
var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);
|
|
193
|
-
var resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {
|
|
194
|
-
...context,
|
|
195
|
-
originModulePath: rootOrigin
|
|
196
|
-
} : context;
|
|
197
210
|
var resolveRequest2 = innerResolveRequest || context.resolveRequest;
|
|
198
|
-
|
|
211
|
+
if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {
|
|
212
|
+
return resolveRequest2(context, request, platform);
|
|
213
|
+
}
|
|
214
|
+
try {
|
|
215
|
+
return resolveRequest2({
|
|
216
|
+
...context,
|
|
217
|
+
originModulePath: rootOrigin
|
|
218
|
+
}, request, platform);
|
|
219
|
+
} catch (error) {
|
|
220
|
+
if (!isUnresolvableModule(error)) throw error;
|
|
221
|
+
if (rootHasPackage(projectRoot, packageName)) throw error;
|
|
222
|
+
return resolveRequest2(context, request, platform);
|
|
223
|
+
}
|
|
199
224
|
}
|
|
200
225
|
}
|
|
201
226
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMetroConfigFromViteConfig.native.js","names":[],"sources":["cjs/metro-config/getMetroConfigFromViteConfig.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar getMetroConfigFromViteConfig_exports = {};\n__export(getMetroConfigFromViteConfig_exports, {\n buildMetroConfigInputFromViteConfig: () => buildMetroConfigInputFromViteConfig,\n getMetroConfigFromViteConfig: () => getMetroConfigFromViteConfig\n});\nmodule.exports = __toCommonJS(getMetroConfigFromViteConfig_exports);\nvar import_vite = require(\"vite\");\nvar import_child_process = require(\"child_process\");\nvar import_fs = require(\"fs\");\nvar import_path = require(\"path\");\nvar import_resolve_workspace_root = __toESM(require(\"resolve-workspace-root\"), 1);\nvar import_tinyglobby = require(\"tinyglobby\");\nvar import_micromatch = __toESM(require(\"micromatch\"), 1);\nvar import_metro_config = require(\"@react-native/metro-config\");\nvar import_compiler = require(\"@vxrn/compiler\");\nvar import_utils = require(\"@vxrn/utils\");\nvar import_desktopReactNativeResolve = require(\"@vxrn/utils/desktopReactNativeResolve\");\nvar import_projectImport = require(\"../utils/projectImport\");\nvar import_getTerminalReporter = require(\"../utils/getTerminalReporter\");\nvar WATCHMAN_PROBE_TIMEOUT_MS = 2e3;\nvar expoEnvAdditionalExts = [\n \"env\",\n \"local\",\n \"development\"\n];\nvar metroSourceExts = [\n \"js\",\n \"jsx\",\n \"json\",\n \"ts\",\n \"tsx\",\n \"mjs\",\n \"cjs\",\n \"swift\",\n \"kt\"\n];\nvar watchmanResponsivePromises = /* @__PURE__ */ new Map();\nvar didWarnAboutWatchmanFallback = false;\nvar rootIndexBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/index\\.(bundle|map|assets)(?=$|[?#])/;\nvar expoVirtualEntryBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/\\.expo\\/\\.virtual-metro-entry\\.bundle(?=$|[?#])/;\nvar metroWatchExclusions = [\n /^(?!.*[/\\\\]node_modules[/\\\\]).*[/\\\\]dist[/\\\\](?:static|server)(?:[/\\\\]|$)/,\n /[/\\\\]tests[/\\\\][^/\\\\]+[/\\\\]dist(?:[/\\\\]|$)/,\n /[/\\\\]\\.docker(?:[/\\\\]|$)/,\n /[/\\\\]\\.vite(?:[/\\\\]|$)/,\n /[/\\\\]node_modules[/\\\\]\\.vxrn(?:[/\\\\]|$)/\n];\nfunction enforceWorkspaceVisibility(config, projectRoot) {\n var _config_watchFolders, _ref;\n var _config_resolver;\n var workspaceRoot = (0, import_vite.searchForWorkspaceRoot)(projectRoot);\n if (workspaceRoot === projectRoot) return config;\n var packages = [];\n try {\n var _workspace_getWorkspaceGlobs;\n packages = ((_workspace_getWorkspaceGlobs = import_resolve_workspace_root.default.getWorkspaceGlobs(workspaceRoot)) !== null && _workspace_getWorkspaceGlobs !== void 0 ? _workspace_getWorkspaceGlobs : []).flatMap(function(pattern) {\n return (0, import_tinyglobby.globSync)(import_path.posix.join(pattern, \"package.json\"), {\n cwd: workspaceRoot,\n absolute: true,\n expandDirectories: false,\n caseSensitiveMatch: process.platform !== \"darwin\" && process.platform !== \"win32\",\n ignore: [\n \"**/@(Carthage|Pods|node_modules)/**\"\n ]\n });\n }).filter(function(manifest) {\n try {\n JSON.parse((0, import_fs.readFileSync)(manifest, \"utf8\"));\n return true;\n } catch (unused) {\n return false;\n }\n }).map(function(manifest) {\n return (0, import_path.dirname)(manifest);\n });\n } catch (unused) {\n packages = [];\n }\n return {\n ...config,\n watchFolders: [\n .../* @__PURE__ */ new Set([\n ...(_config_watchFolders = config.watchFolders) !== null && _config_watchFolders !== void 0 ? _config_watchFolders : [],\n ...packages.length ? [\n (0, import_path.resolve)(workspaceRoot, \"node_modules\"),\n ...packages\n ] : []\n ])\n ],\n resolver: {\n ...config.resolver,\n nodeModulesPaths: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.nodeModulesPaths) !== null && _ref !== void 0 ? _ref : [],\n (0, import_path.resolve)(projectRoot, \"node_modules\"),\n (0, import_path.resolve)(workspaceRoot, \"node_modules\")\n ])\n ]\n }\n };\n}\nfunction getReactNativeDefaultConfig(projectRoot) {\n var _ref;\n var _config_resolver;\n var config = enforceWorkspaceVisibility((0, import_metro_config.getDefaultConfig)(projectRoot), projectRoot);\n return {\n ...config,\n resolver: {\n ...config.resolver,\n assetExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.assetExts) !== null && _ref !== void 0 ? _ref : [],\n \"glb\"\n ])\n ]\n }\n };\n}\nvar oneRoots = /* @__PURE__ */ new Map();\nfunction redirectDesktopReactNative(projectRoot, origin, moduleName, platform) {\n if (platform !== \"macos\" && platform !== \"linux\") return null;\n var file = (0, import_desktopReactNativeResolve.desktopReactNativeFile)(origin, moduleName, oneRootFor(projectRoot, platform), platform);\n if (!file) return null;\n return {\n type: \"sourceFile\",\n filePath: file\n };\n}\nfunction oneRootFor(projectRoot, platform) {\n var root = oneRoots.get(projectRoot);\n if (!root) {\n root = (0, import_desktopReactNativeResolve.requireOnePackageRoot)(projectRoot, platform);\n oneRoots.set(projectRoot, root);\n }\n return root;\n}\nfunction getPlatformFromBundleUrl(url) {\n var _url_match;\n var platform = (_url_match = url.match(/[?&]platform=(ios|android|macos|linux)(?:&|$)/)) === null || _url_match === void 0 ? void 0 : _url_match[1];\n if (platform === \"ios\" || platform === \"android\" || platform === \"macos\" || platform === \"linux\") return platform;\n return \"ios\";\n}\nfunction rewriteMainModuleBundleUrl(url, resolveMainModuleName) {\n var resolvedMainModulePath = resolveMainModuleName({\n platform: getPlatformFromBundleUrl(url)\n });\n if (rootIndexBundleRequestPattern.test(url)) {\n return url.replace(rootIndexBundleRequestPattern, `$1/${resolvedMainModulePath}.$2`);\n }\n return url.replace(expoVirtualEntryBundleRequestPattern, `$1/${resolvedMainModulePath}.bundle`);\n}\nfunction isMainModuleBundleRequest(url) {\n return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);\n}\nfunction isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {\n return !context.dev && (0, import_utils.isBunIosEngine)(projectRoot, platform) && /(^|[\\\\/])polyfillPromise(\\.js)?$/.test(moduleName) && /(^|[\\\\/])react-native[\\\\/]/.test(context.originModulePath);\n}\nfunction isBareSpecifier(name) {\n return name !== \"\" && !name.startsWith(\".\") && !name.startsWith(\"/\");\n}\nfunction bareMainModuleForRequest(moduleName, mainModuleName) {\n if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;\n if (moduleName === `./${mainModuleName}`) return mainModuleName;\n return void 0;\n}\nfunction enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {\n var _config_resolver;\n var dedupedPackages = new Set(dedupe);\n if ((!mainModuleName || !isBareSpecifier(mainModuleName)) && !dedupedPackages.size) {\n return config;\n }\n var rootOrigin = (0, import_path.resolve)(projectRoot, \"package.json\");\n var innerResolveRequest = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.resolveRequest;\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var bareMain = bareMainModuleForRequest(moduleName, mainModuleName);\n var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;\n var packageEnd = request.indexOf(\"/\", request.startsWith(\"@\") ? request.indexOf(\"/\") + 1 : 0);\n var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);\n var resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {\n ...context,\n originModulePath: rootOrigin\n } : context;\n var resolveRequest2 = innerResolveRequest || context.resolveRequest;\n return resolveRequest2(resolutionContext, request, platform);\n }\n }\n };\n}\nasync function isWatchmanResponsive(projectRoot) {\n var probe = watchmanResponsivePromises.get(projectRoot);\n if (probe) {\n return probe;\n }\n probe = new Promise(function(resolve2) {\n var settled = false;\n var finish = function finish2(value) {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n resolve2(value);\n };\n var child = (0, import_child_process.spawn)(\"watchman\", [\n \"watch-project\",\n projectRoot\n ], {\n stdio: \"ignore\"\n });\n var timeout = setTimeout(function() {\n child.kill();\n finish(false);\n }, WATCHMAN_PROBE_TIMEOUT_MS);\n child.once(\"error\", function() {\n finish(false);\n });\n child.once(\"exit\", function(code) {\n finish(code === 0);\n });\n });\n watchmanResponsivePromises.set(projectRoot, probe);\n return probe;\n}\nfunction resolveNativeTransforms(projectRoot, metroPluginOptions) {\n var userBabelConfigPath = projectRoot ? (0, import_compiler.findUserBabelConfig)(projectRoot) : null;\n var hasUserBabelConfig = Boolean(userBabelConfigPath);\n var isNativeTransforms = process.env.ONE_METRO_NATIVE_TRANSFORMS === \"0\" ? false : process.env.ONE_METRO_NATIVE_TRANSFORMS === \"1\" ? true : metroPluginOptions.nativeTransforms === false ? false : metroPluginOptions.nativeTransforms === true ? true : hasUserBabelConfig ? false : true;\n if (userBabelConfigPath && isNativeTransforms) {\n console.warn(`[vxrn/metro] Ignoring user babel config at ${userBabelConfigPath} because native transforms are explicitly enabled (nativeTransforms: true or ONE_METRO_NATIVE_TRANSFORMS=1). Port its plugins to nativeTransformModules, or set nativeTransforms: false (or ONE_METRO_NATIVE_TRANSFORMS=0) to use the babel transformer.`);\n }\n return {\n isNativeTransforms,\n userBabelConfigPath\n };\n}\nasync function buildMetroConfigInputFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = (0, import_path.resolve)((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (import_micromatch.default.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await (0, import_getTerminalReporter.getTerminalReporter)(projectRoot)\n };\n var merged = {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n };\n return {\n defaultConfig: enforcePackageResolution(enforceWorkspaceVisibility(merged, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n projectRoot,\n extraConfig\n };\n}\nasync function getMetroConfigFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = (0, import_path.resolve)((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, argv, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var { loadConfig } = await (0, import_projectImport.projectImport)(projectRoot, \"metro\");\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (import_micromatch.default.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await (0, import_getTerminalReporter.getTerminalReporter)(projectRoot)\n };\n var metroConfig = await loadConfig({\n cwd: projectRoot,\n projectRoot,\n \"reset-cache\": !!process.env.METRO_RESET_CACHE,\n ...argv\n }, {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n });\n return {\n ...enforcePackageResolution(enforceWorkspaceVisibility(metroConfig, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n ...extraConfig\n };\n}\n//# sourceMappingURL=getMetroConfigFromViteConfig.js.map\n"],"mappings":";;;AACA,IAAI,WAAW,OAAO;AACtB,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO;AAC1B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,WAAW,KAAK,YAAY,YAAY,SAAS,OAAO,OAAO,SAAS,aAAa,GAAG,CAAC,IAAI,CAAC,GAAG,YAKnG,cAAc,CAAC,OAAO,CAAC,IAAI,aAAa,UAAU,QAAQ,WAAW;CAAE,OAAO;CAAK,YAAY;AAAK,CAAC,IAA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,WAAW,gBAAgB,GAAG;KAC3C,IAAI,kBAAkB;MACpB,GAAG;MACH,yBAAyB,QAAQ,wBAAwB,OAAO,SAAS,GAAG;OAC1E,OAAO,MAAM;MACf,CAAC;KACH;KACA,OAAO,qBAAqB,iBAAiB,YAAY,QAAQ;IACnE;IACA,IAAI,kBAAkB,2BAA2B,aAAa,QAAQ,kBAAkB,YAAY,QAAQ;IAC5G,IAAI,iBAAiB,OAAO;IAC5B,OAAO,qBAAqB,SAAS,YAAY,QAAQ;GAC3D;EACF;EACA,aAAa;GACX,GAAG,mBAAmB,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAAI,eAAe;GAIlF,8BAA8B;GAC9B,uBAAuB,GAAG,qBAAqB,eAAc,CAAE,aAAa,2CAA2C;EACzH;EAGA,GAAG,mBAAmB,EACpB,iBAAiB,iBACnB,IAAI,CAAC;EACL,UAAU,OAAO,GAAG,2BAA2B,oBAAmB,CAAE,WAAW;CACjF;CACA,IAAI,cAAc,MAAM,WAAW;EACjC,KAAK;EACL;EACA,eAAe,CAAC,CAAC,QAAQ,IAAI;EAC7B,GAAG;CACL,GAAG;EACD,GAAG;EACH,GAAG,OAAO,2BAA2B,aAAa,uBAAuB,aAAa,IAAI;CAC5F,CAAC;CACD,OAAO;EACL,GAAG,yBAAyB,2BAA2B,aAAa,WAAW,GAAG,iBAAiB,SAAS,kBAAkB,OAAO,aAAa,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,YAAY,QAAQ,UAAU,KAAK,IAAI,QAAQ,CAAC,GAAG,WAAW;EAC9Q,GAAG;CACL;AACF"}
|
|
1
|
+
{"version":3,"file":"getMetroConfigFromViteConfig.native.js","names":[],"sources":["cjs/metro-config/getMetroConfigFromViteConfig.native.js"],"sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar getMetroConfigFromViteConfig_exports = {};\n__export(getMetroConfigFromViteConfig_exports, {\n buildMetroConfigInputFromViteConfig: () => buildMetroConfigInputFromViteConfig,\n getMetroConfigFromViteConfig: () => getMetroConfigFromViteConfig\n});\nmodule.exports = __toCommonJS(getMetroConfigFromViteConfig_exports);\nvar import_vite = require(\"vite\");\nvar import_child_process = require(\"child_process\");\nvar import_fs = require(\"fs\");\nvar import_path = require(\"path\");\nvar import_resolve_workspace_root = __toESM(require(\"resolve-workspace-root\"), 1);\nvar import_tinyglobby = require(\"tinyglobby\");\nvar import_micromatch = __toESM(require(\"micromatch\"), 1);\nvar import_metro_config = require(\"@react-native/metro-config\");\nvar import_compiler = require(\"@vxrn/compiler\");\nvar import_utils = require(\"@vxrn/utils\");\nvar import_desktopReactNativeResolve = require(\"@vxrn/utils/desktopReactNativeResolve\");\nvar import_projectImport = require(\"../utils/projectImport\");\nvar import_getTerminalReporter = require(\"../utils/getTerminalReporter\");\nvar WATCHMAN_PROBE_TIMEOUT_MS = 2e3;\nvar expoEnvAdditionalExts = [\n \"env\",\n \"local\",\n \"development\"\n];\nvar metroSourceExts = [\n \"js\",\n \"jsx\",\n \"json\",\n \"ts\",\n \"tsx\",\n \"mjs\",\n \"cjs\",\n \"swift\",\n \"kt\"\n];\nvar watchmanResponsivePromises = /* @__PURE__ */ new Map();\nvar didWarnAboutWatchmanFallback = false;\nvar rootIndexBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/index\\.(bundle|map|assets)(?=$|[?#])/;\nvar expoVirtualEntryBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/\\.expo\\/\\.virtual-metro-entry\\.bundle(?=$|[?#])/;\nvar metroWatchExclusions = [\n /^(?!.*[/\\\\]node_modules[/\\\\]).*[/\\\\]dist[/\\\\](?:static|server)(?:[/\\\\]|$)/,\n /[/\\\\]tests[/\\\\][^/\\\\]+[/\\\\]dist(?:[/\\\\]|$)/,\n /[/\\\\]\\.docker(?:[/\\\\]|$)/,\n /[/\\\\]\\.vite(?:[/\\\\]|$)/,\n /[/\\\\]node_modules[/\\\\]\\.vxrn(?:[/\\\\]|$)/\n];\nfunction enforceWorkspaceVisibility(config, projectRoot) {\n var _config_watchFolders, _ref;\n var _config_resolver;\n var workspaceRoot = (0, import_vite.searchForWorkspaceRoot)(projectRoot);\n if (workspaceRoot === projectRoot) return config;\n var packages = [];\n try {\n var _workspace_getWorkspaceGlobs;\n packages = ((_workspace_getWorkspaceGlobs = import_resolve_workspace_root.default.getWorkspaceGlobs(workspaceRoot)) !== null && _workspace_getWorkspaceGlobs !== void 0 ? _workspace_getWorkspaceGlobs : []).flatMap(function(pattern) {\n return (0, import_tinyglobby.globSync)(import_path.posix.join(pattern, \"package.json\"), {\n cwd: workspaceRoot,\n absolute: true,\n expandDirectories: false,\n caseSensitiveMatch: process.platform !== \"darwin\" && process.platform !== \"win32\",\n ignore: [\n \"**/@(Carthage|Pods|node_modules)/**\"\n ]\n });\n }).filter(function(manifest) {\n try {\n JSON.parse((0, import_fs.readFileSync)(manifest, \"utf8\"));\n return true;\n } catch (unused) {\n return false;\n }\n }).map(function(manifest) {\n return (0, import_path.dirname)(manifest);\n });\n } catch (unused) {\n packages = [];\n }\n return {\n ...config,\n watchFolders: [\n .../* @__PURE__ */ new Set([\n ...(_config_watchFolders = config.watchFolders) !== null && _config_watchFolders !== void 0 ? _config_watchFolders : [],\n ...packages.length ? [\n (0, import_path.resolve)(workspaceRoot, \"node_modules\"),\n ...packages\n ] : []\n ])\n ],\n resolver: {\n ...config.resolver,\n nodeModulesPaths: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.nodeModulesPaths) !== null && _ref !== void 0 ? _ref : [],\n (0, import_path.resolve)(projectRoot, \"node_modules\"),\n (0, import_path.resolve)(workspaceRoot, \"node_modules\")\n ])\n ]\n }\n };\n}\nfunction getReactNativeDefaultConfig(projectRoot) {\n var _ref;\n var _config_resolver;\n var config = enforceWorkspaceVisibility((0, import_metro_config.getDefaultConfig)(projectRoot), projectRoot);\n return {\n ...config,\n resolver: {\n ...config.resolver,\n assetExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.assetExts) !== null && _ref !== void 0 ? _ref : [],\n \"glb\"\n ])\n ]\n }\n };\n}\nvar oneRoots = /* @__PURE__ */ new Map();\nfunction redirectDesktopReactNative(projectRoot, origin, moduleName, platform) {\n if (platform !== \"macos\" && platform !== \"linux\") return null;\n var file = (0, import_desktopReactNativeResolve.desktopReactNativeFile)(origin, moduleName, oneRootFor(projectRoot, platform), platform);\n if (!file) return null;\n return {\n type: \"sourceFile\",\n filePath: file\n };\n}\nfunction oneRootFor(projectRoot, platform) {\n var root = oneRoots.get(projectRoot);\n if (!root) {\n root = (0, import_desktopReactNativeResolve.requireOnePackageRoot)(projectRoot, platform);\n oneRoots.set(projectRoot, root);\n }\n return root;\n}\nfunction getPlatformFromBundleUrl(url) {\n var _url_match;\n var platform = (_url_match = url.match(/[?&]platform=(ios|android|macos|linux)(?:&|$)/)) === null || _url_match === void 0 ? void 0 : _url_match[1];\n if (platform === \"ios\" || platform === \"android\" || platform === \"macos\" || platform === \"linux\") return platform;\n return \"ios\";\n}\nfunction rewriteMainModuleBundleUrl(url, resolveMainModuleName) {\n var resolvedMainModulePath = resolveMainModuleName({\n platform: getPlatformFromBundleUrl(url)\n });\n if (rootIndexBundleRequestPattern.test(url)) {\n return url.replace(rootIndexBundleRequestPattern, `$1/${resolvedMainModulePath}.$2`);\n }\n return url.replace(expoVirtualEntryBundleRequestPattern, `$1/${resolvedMainModulePath}.bundle`);\n}\nfunction isMainModuleBundleRequest(url) {\n return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);\n}\nfunction isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {\n return !context.dev && (0, import_utils.isBunIosEngine)(projectRoot, platform) && /(^|[\\\\/])polyfillPromise(\\.js)?$/.test(moduleName) && /(^|[\\\\/])react-native[\\\\/]/.test(context.originModulePath);\n}\nfunction isBareSpecifier(name) {\n return name !== \"\" && !name.startsWith(\".\") && !name.startsWith(\"/\");\n}\nfunction isUnresolvableModule(error) {\n if (!error || typeof error !== \"object\") return false;\n if (error.type === \"UnableToResolveError\") return true;\n var message = error.message;\n if (typeof message === \"string\" && message.startsWith(\"Unable to resolve module\")) return true;\n var { dirPaths, extraPaths } = error;\n return Array.isArray(dirPaths) && Array.isArray(extraPaths);\n}\nfunction rootHasPackage(projectRoot, packageName) {\n var directory = projectRoot;\n while (true) {\n if ((0, import_fs.existsSync)((0, import_path.join)(directory, \"node_modules\", packageName, \"package.json\"))) return true;\n var parent = (0, import_path.dirname)(directory);\n if (parent === directory) return false;\n directory = parent;\n }\n}\nfunction bareMainModuleForRequest(moduleName, mainModuleName) {\n if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;\n if (moduleName === `./${mainModuleName}`) return mainModuleName;\n return void 0;\n}\nfunction enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {\n var _config_resolver;\n var dedupedPackages = new Set(dedupe);\n if ((!mainModuleName || !isBareSpecifier(mainModuleName)) && !dedupedPackages.size) {\n return config;\n }\n var rootOrigin = (0, import_path.resolve)(projectRoot, \"package.json\");\n var innerResolveRequest = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.resolveRequest;\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var bareMain = bareMainModuleForRequest(moduleName, mainModuleName);\n var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;\n var packageEnd = request.indexOf(\"/\", request.startsWith(\"@\") ? request.indexOf(\"/\") + 1 : 0);\n var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);\n var resolveRequest2 = innerResolveRequest || context.resolveRequest;\n if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {\n return resolveRequest2(context, request, platform);\n }\n try {\n return resolveRequest2({\n ...context,\n originModulePath: rootOrigin\n }, request, platform);\n } catch (error) {\n if (!isUnresolvableModule(error)) throw error;\n if (rootHasPackage(projectRoot, packageName)) throw error;\n return resolveRequest2(context, request, platform);\n }\n }\n }\n };\n}\nasync function isWatchmanResponsive(projectRoot) {\n var probe = watchmanResponsivePromises.get(projectRoot);\n if (probe) {\n return probe;\n }\n probe = new Promise(function(resolve2) {\n var settled = false;\n var finish = function finish2(value) {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n resolve2(value);\n };\n var child = (0, import_child_process.spawn)(\"watchman\", [\n \"watch-project\",\n projectRoot\n ], {\n stdio: \"ignore\"\n });\n var timeout = setTimeout(function() {\n child.kill();\n finish(false);\n }, WATCHMAN_PROBE_TIMEOUT_MS);\n child.once(\"error\", function() {\n finish(false);\n });\n child.once(\"exit\", function(code) {\n finish(code === 0);\n });\n });\n watchmanResponsivePromises.set(projectRoot, probe);\n return probe;\n}\nfunction resolveNativeTransforms(projectRoot, metroPluginOptions) {\n var userBabelConfigPath = projectRoot ? (0, import_compiler.findUserBabelConfig)(projectRoot) : null;\n var hasUserBabelConfig = Boolean(userBabelConfigPath);\n var isNativeTransforms = process.env.ONE_METRO_NATIVE_TRANSFORMS === \"0\" ? false : process.env.ONE_METRO_NATIVE_TRANSFORMS === \"1\" ? true : metroPluginOptions.nativeTransforms === false ? false : metroPluginOptions.nativeTransforms === true ? true : hasUserBabelConfig ? false : true;\n if (userBabelConfigPath && isNativeTransforms) {\n console.warn(`[vxrn/metro] Ignoring user babel config at ${userBabelConfigPath} because native transforms are explicitly enabled (nativeTransforms: true or ONE_METRO_NATIVE_TRANSFORMS=1). Port its plugins to nativeTransformModules, or set nativeTransforms: false (or ONE_METRO_NATIVE_TRANSFORMS=0) to use the babel transformer.`);\n }\n return {\n isNativeTransforms,\n userBabelConfigPath\n };\n}\nasync function buildMetroConfigInputFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = (0, import_path.resolve)((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (import_micromatch.default.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await (0, import_getTerminalReporter.getTerminalReporter)(projectRoot)\n };\n var merged = {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n };\n return {\n defaultConfig: enforcePackageResolution(enforceWorkspaceVisibility(merged, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n projectRoot,\n extraConfig\n };\n}\nasync function getMetroConfigFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = (0, import_path.resolve)((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, argv, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var { loadConfig } = await (0, import_projectImport.projectImport)(projectRoot, \"metro\");\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (import_micromatch.default.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: (0, import_projectImport.projectResolve)(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await (0, import_getTerminalReporter.getTerminalReporter)(projectRoot)\n };\n var metroConfig = await loadConfig({\n cwd: projectRoot,\n projectRoot,\n \"reset-cache\": !!process.env.METRO_RESET_CACHE,\n ...argv\n }, {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n });\n return {\n ...enforcePackageResolution(enforceWorkspaceVisibility(metroConfig, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n ...extraConfig\n };\n}\n//# sourceMappingURL=getMetroConf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aAAa,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,YAAY,QAAQ,UAAU,KAAK,IAAI,QAAQ,CAAC,GAAG,WAAW;EAC9Q,GAAG;CACL;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { searchForWorkspaceRoot } from "vite";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { dirname, posix, resolve } from "node:path";
|
|
3
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
+
import { dirname, join, posix, resolve } from "node:path";
|
|
5
5
|
import workspace from "resolve-workspace-root";
|
|
6
6
|
import { globSync } from "tinyglobby";
|
|
7
7
|
import micromatch from "micromatch";
|
|
@@ -125,6 +125,23 @@ function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform
|
|
|
125
125
|
function isBareSpecifier(name) {
|
|
126
126
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
127
127
|
}
|
|
128
|
+
function isUnresolvableModule(error) {
|
|
129
|
+
if (!error || typeof error !== "object") return false;
|
|
130
|
+
if (error.type === "UnableToResolveError") return true;
|
|
131
|
+
const message = error.message;
|
|
132
|
+
if (typeof message === "string" && message.startsWith("Unable to resolve module")) return true;
|
|
133
|
+
const { dirPaths, extraPaths } = error;
|
|
134
|
+
return Array.isArray(dirPaths) && Array.isArray(extraPaths);
|
|
135
|
+
}
|
|
136
|
+
function rootHasPackage(projectRoot, packageName) {
|
|
137
|
+
let directory = projectRoot;
|
|
138
|
+
while (true) {
|
|
139
|
+
if (existsSync(join(directory, "node_modules", packageName, "package.json"))) return true;
|
|
140
|
+
const parent = dirname(directory);
|
|
141
|
+
if (parent === directory) return false;
|
|
142
|
+
directory = parent;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
128
145
|
function bareMainModuleForRequest(moduleName, mainModuleName) {
|
|
129
146
|
if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;
|
|
130
147
|
if (moduleName === `./${mainModuleName}`) return mainModuleName;
|
|
@@ -146,12 +163,20 @@ function enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {
|
|
|
146
163
|
const request = bareMain ?? moduleName;
|
|
147
164
|
const packageEnd = request.indexOf("/", request.startsWith("@") ? request.indexOf("/") + 1 : 0);
|
|
148
165
|
const packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);
|
|
149
|
-
const resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {
|
|
150
|
-
...context,
|
|
151
|
-
originModulePath: rootOrigin
|
|
152
|
-
} : context;
|
|
153
166
|
const resolveRequest = innerResolveRequest || context.resolveRequest;
|
|
154
|
-
|
|
167
|
+
if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {
|
|
168
|
+
return resolveRequest(context, request, platform);
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
return resolveRequest({
|
|
172
|
+
...context,
|
|
173
|
+
originModulePath: rootOrigin
|
|
174
|
+
}, request, platform);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
if (!isUnresolvableModule(error)) throw error;
|
|
177
|
+
if (rootHasPackage(projectRoot, packageName)) throw error;
|
|
178
|
+
return resolveRequest(context, request, platform);
|
|
179
|
+
}
|
|
155
180
|
}
|
|
156
181
|
}
|
|
157
182
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMetroConfigFromViteConfig.js","names":["globPackagesSync"],"sources":["esm/metro-config/getMetroConfigFromViteConfig.js"],"sourcesContent":["import { searchForWorkspaceRoot } from \"vite\";\nimport { spawn } from \"node:child_process\";\nimport { readFileSync } from \"node:fs\";\nimport { dirname, posix, resolve } from \"node:path\";\nimport workspace from \"resolve-workspace-root\";\nimport { globSync as globPackagesSync } from \"tinyglobby\";\nimport micromatch from \"micromatch\";\nimport { getDefaultConfig } from \"@react-native/metro-config\";\nimport { findUserBabelConfig } from \"@vxrn/compiler\";\nimport { isBunIosEngine } from \"@vxrn/utils\";\nimport {\n desktopReactNativeFile,\n requireOnePackageRoot\n} from \"@vxrn/utils/desktopReactNativeResolve\";\nimport { projectImport, projectResolve } from \"../utils/projectImport\";\nimport { getTerminalReporter } from \"../utils/getTerminalReporter\";\nconst WATCHMAN_PROBE_TIMEOUT_MS = 2e3;\nconst expoEnvAdditionalExts = [\"env\", \"local\", \"development\"];\nconst metroSourceExts = [\"js\", \"jsx\", \"json\", \"ts\", \"tsx\", \"mjs\", \"cjs\", \"swift\", \"kt\"];\nconst watchmanResponsivePromises = /* @__PURE__ */ new Map();\nlet didWarnAboutWatchmanFallback = false;\nconst rootIndexBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/index\\.(bundle|map|assets)(?=$|[?#])/;\nconst expoVirtualEntryBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/\\.expo\\/\\.virtual-metro-entry\\.bundle(?=$|[?#])/;\nconst metroWatchExclusions = [\n /^(?!.*[/\\\\]node_modules[/\\\\]).*[/\\\\]dist[/\\\\](?:static|server)(?:[/\\\\]|$)/,\n /[/\\\\]tests[/\\\\][^/\\\\]+[/\\\\]dist(?:[/\\\\]|$)/,\n /[/\\\\]\\.docker(?:[/\\\\]|$)/,\n /[/\\\\]\\.vite(?:[/\\\\]|$)/,\n /[/\\\\]node_modules[/\\\\]\\.vxrn(?:[/\\\\]|$)/\n];\nfunction enforceWorkspaceVisibility(config, projectRoot) {\n const workspaceRoot = searchForWorkspaceRoot(projectRoot);\n if (workspaceRoot === projectRoot) return config;\n let packages = [];\n try {\n packages = (workspace.getWorkspaceGlobs(workspaceRoot) ?? []).flatMap(\n (pattern) => globPackagesSync(posix.join(pattern, \"package.json\"), {\n cwd: workspaceRoot,\n absolute: true,\n expandDirectories: false,\n caseSensitiveMatch: process.platform !== \"darwin\" && process.platform !== \"win32\",\n ignore: [\"**/@(Carthage|Pods|node_modules)/**\"]\n })\n ).filter((manifest) => {\n try {\n JSON.parse(readFileSync(manifest, \"utf8\"));\n return true;\n } catch {\n return false;\n }\n }).map((manifest) => dirname(manifest));\n } catch {\n packages = [];\n }\n return {\n ...config,\n watchFolders: [\n .../* @__PURE__ */ new Set([\n ...config.watchFolders ?? [],\n ...packages.length ? [resolve(workspaceRoot, \"node_modules\"), ...packages] : []\n ])\n ],\n resolver: {\n ...config.resolver,\n nodeModulesPaths: [\n .../* @__PURE__ */ new Set([\n ...config.resolver?.nodeModulesPaths ?? [],\n resolve(projectRoot, \"node_modules\"),\n resolve(workspaceRoot, \"node_modules\")\n ])\n ]\n }\n };\n}\nfunction getReactNativeDefaultConfig(projectRoot) {\n const config = enforceWorkspaceVisibility(\n getDefaultConfig(projectRoot),\n projectRoot\n );\n return {\n ...config,\n resolver: {\n ...config.resolver,\n assetExts: [.../* @__PURE__ */ new Set([...config.resolver?.assetExts ?? [], \"glb\"])]\n }\n };\n}\nconst oneRoots = /* @__PURE__ */ new Map();\nfunction redirectDesktopReactNative(projectRoot, origin, moduleName, platform) {\n if (platform !== \"macos\" && platform !== \"linux\") return null;\n const file = desktopReactNativeFile(\n origin,\n moduleName,\n oneRootFor(projectRoot, platform),\n platform\n );\n if (!file) return null;\n return { type: \"sourceFile\", filePath: file };\n}\nfunction oneRootFor(projectRoot, platform) {\n let root = oneRoots.get(projectRoot);\n if (!root) {\n root = requireOnePackageRoot(projectRoot, platform);\n oneRoots.set(projectRoot, root);\n }\n return root;\n}\nfunction getPlatformFromBundleUrl(url) {\n const platform = url.match(/[?&]platform=(ios|android|macos|linux)(?:&|$)/)?.[1];\n if (platform === \"ios\" || platform === \"android\" || platform === \"macos\" || platform === \"linux\")\n return platform;\n return \"ios\";\n}\nfunction rewriteMainModuleBundleUrl(url, resolveMainModuleName) {\n const resolvedMainModulePath = resolveMainModuleName({\n platform: getPlatformFromBundleUrl(url)\n });\n if (rootIndexBundleRequestPattern.test(url)) {\n return url.replace(\n rootIndexBundleRequestPattern,\n `$1/${resolvedMainModulePath}.$2`\n );\n }\n return url.replace(\n expoVirtualEntryBundleRequestPattern,\n `$1/${resolvedMainModulePath}.bundle`\n );\n}\nfunction isMainModuleBundleRequest(url) {\n return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);\n}\nfunction isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {\n return !context.dev && isBunIosEngine(projectRoot, platform) && /(^|[\\\\/])polyfillPromise(\\.js)?$/.test(moduleName) && /(^|[\\\\/])react-native[\\\\/]/.test(context.originModulePath);\n}\nfunction isBareSpecifier(name) {\n return name !== \"\" && !name.startsWith(\".\") && !name.startsWith(\"/\");\n}\nfunction bareMainModuleForRequest(moduleName, mainModuleName) {\n if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;\n if (moduleName === `./${mainModuleName}`) return mainModuleName;\n return void 0;\n}\nfunction enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {\n const dedupedPackages = new Set(dedupe);\n if ((!mainModuleName || !isBareSpecifier(mainModuleName)) && !dedupedPackages.size) {\n return config;\n }\n const rootOrigin = resolve(projectRoot, \"package.json\");\n const innerResolveRequest = config.resolver?.resolveRequest;\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: (context, moduleName, platform) => {\n const bareMain = bareMainModuleForRequest(moduleName, mainModuleName);\n const request = bareMain ?? moduleName;\n const packageEnd = request.indexOf(\n \"/\",\n request.startsWith(\"@\") ? request.indexOf(\"/\") + 1 : 0\n );\n const packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);\n const resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? { ...context, originModulePath: rootOrigin } : context;\n const resolveRequest = innerResolveRequest || context.resolveRequest;\n return resolveRequest(resolutionContext, request, platform);\n }\n }\n };\n}\nasync function isWatchmanResponsive(projectRoot) {\n let probe = watchmanResponsivePromises.get(projectRoot);\n if (probe) {\n return probe;\n }\n probe = new Promise((resolve2) => {\n let settled = false;\n const finish = (value) => {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n resolve2(value);\n };\n const child = spawn(\"watchman\", [\"watch-project\", projectRoot], {\n stdio: \"ignore\"\n });\n const timeout = setTimeout(() => {\n child.kill();\n finish(false);\n }, WATCHMAN_PROBE_TIMEOUT_MS);\n child.once(\"error\", () => {\n finish(false);\n });\n child.once(\"exit\", (code) => {\n finish(code === 0);\n });\n });\n watchmanResponsivePromises.set(projectRoot, probe);\n return probe;\n}\nfunction resolveNativeTransforms(projectRoot, metroPluginOptions) {\n const userBabelConfigPath = projectRoot ? findUserBabelConfig(projectRoot) : null;\n const hasUserBabelConfig = Boolean(userBabelConfigPath);\n const isNativeTransforms = process.env.ONE_METRO_NATIVE_TRANSFORMS === \"0\" ? false : process.env.ONE_METRO_NATIVE_TRANSFORMS === \"1\" ? true : metroPluginOptions.nativeTransforms === false ? false : metroPluginOptions.nativeTransforms === true ? true : hasUserBabelConfig ? false : true;\n if (userBabelConfigPath && isNativeTransforms) {\n console.warn(\n `[vxrn/metro] Ignoring user babel config at ${userBabelConfigPath} because native transforms are explicitly enabled (nativeTransforms: true or ONE_METRO_NATIVE_TRANSFORMS=1). Port its plugins to nativeTransformModules, or set nativeTransforms: false (or ONE_METRO_NATIVE_TRANSFORMS=0) to use the babel transformer.`\n );\n }\n return { isNativeTransforms, userBabelConfigPath };\n}\nasync function buildMetroConfigInputFromViteConfig(config, metroPluginOptions) {\n const extraConfig = {};\n const projectRoot = resolve(metroPluginOptions.argv?.projectRoot ?? config.root);\n const { mainModuleName, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n const useWatchman = watchman ?? await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\n \"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\"\n );\n }\n const _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n const origRewriteRequestUrl = _defaultConfig.server?.rewriteRequestUrl;\n const resolveMainModuleName = () => mainModuleName;\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = (url) => {\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return origRewriteRequestUrl?.(url) ?? url;\n };\n }\n const existingBlockList = _defaultConfig?.resolver?.blockList;\n const blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [existingBlockList] : [],\n ...metroWatchExclusions\n ];\n const { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n let nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\"\n );\n }\n const defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig?.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ..._defaultConfig?.watcher?.additionalExts ?? [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig?.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([..._defaultConfig?.resolver?.platforms ?? [], \"macos\", \"linux\"])\n ],\n resolveRequest: (context, moduleName, platform) => {\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return { type: \"empty\" };\n const origResolveRequestFn = _defaultConfig?.resolver?.resolveRequest || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n const contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(\n (c) => c !== \"import\"\n )\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n const desktopRedirect = redirectDesktopReactNative(\n projectRoot,\n context.originModulePath,\n moduleName,\n platform\n );\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig?.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/babel-transformer\"\n )\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? { transformerPath: nativeWorkerPath } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n const merged = {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n };\n return {\n defaultConfig: enforcePackageResolution(\n enforceWorkspaceVisibility(merged, projectRoot),\n mainModuleName,\n config.resolve?.dedupe ?? [],\n projectRoot\n ),\n projectRoot,\n extraConfig\n };\n}\nasync function getMetroConfigFromViteConfig(config, metroPluginOptions) {\n const extraConfig = {};\n const projectRoot = resolve(metroPluginOptions.argv?.projectRoot ?? config.root);\n const { mainModuleName, argv, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n const useWatchman = watchman ?? await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\n \"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\"\n );\n }\n const { loadConfig } = await projectImport(projectRoot, \"metro\");\n const _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n const origRewriteRequestUrl = _defaultConfig.server?.rewriteRequestUrl;\n const resolveMainModuleName = () => mainModuleName;\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = (url) => {\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return origRewriteRequestUrl?.(url) ?? url;\n };\n }\n const existingBlockList = _defaultConfig?.resolver?.blockList;\n const blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [existingBlockList] : [],\n ...metroWatchExclusions\n ];\n const { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n let nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\"\n );\n }\n const defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig?.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ..._defaultConfig?.watcher?.additionalExts ?? [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig?.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([..._defaultConfig?.resolver?.platforms ?? [], \"macos\", \"linux\"])\n ],\n resolveRequest: (context, moduleName, platform) => {\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return { type: \"empty\" };\n const origResolveRequestFn = _defaultConfig?.resolver?.resolveRequest || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n const contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(\n (c) => c !== \"import\"\n )\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n const desktopRedirect = redirectDesktopReactNative(\n projectRoot,\n context.originModulePath,\n moduleName,\n platform\n );\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig?.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/babel-transformer\"\n )\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? { transformerPath: nativeWorkerPath } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n const metroConfig = await loadConfig(\n {\n cwd: projectRoot,\n projectRoot,\n \"reset-cache\": !!process.env.METRO_RESET_CACHE,\n ...argv\n },\n {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n }\n );\n return {\n ...enforcePackageResolution(\n enforceWorkspaceVisibility(metroConfig, projectRoot),\n mainModuleName,\n config.resolve?.dedupe ?? [],\n projectRoot\n ),\n ...extraConfig\n };\n}\nexport {\n buildMetroConfigInputFromViteConfig,\n getMetroConfigFromViteConfig\n};\n//# sourceMappingURL=getMetroConfigFromViteConfig.js.map\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,4BAA4B;AAClC,MAAM,wBAAwB;CAAC;CAAO;CAAS;AAAa;AAC5D,MAAM,kBAAkB;CAAC;CAAM;CAAO;CAAQ;CAAM;CAAO;CAAO;CAAO;CAAS;AAAI;AACtF,MAAM,6CAA6C,IAAI,IAAI;AAC3D,IAAI,+BAA+B;AACnC,MAAM,gCAAgC;AACtC,MAAM,uCAAuC;AAC7C,MAAM,uBAAuB;CAC3B;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,2BAA2B,QAAQ,aAAa;CACvD,MAAM,gBAAgB,uBAAuB,WAAW;CACxD,IAAI,kBAAkB,aAAa,OAAO;CAC1C,IAAI,WAAW,CAAC;CAChB,IAAI;EACF,YAAY,UAAU,kBAAkB,aAAa,KAAK,CAAC,EAAC,CAAE,SAC3D,YAAYA,SAAiB,MAAM,KAAK,SAAS,cAAc,GAAG;GACjE,KAAK;GACL,UAAU;GACV,mBAAmB;GACnB,oBAAoB,QAAQ,aAAa,YAAY,QAAQ,aAAa;GAC1E,QAAQ,CAAC,qCAAqC;EAChD,CA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B,SAAS,YAAY,aAAa;IACjD,IAAI,6BAA6B,SAAS,YAAY,aAAa,QAAQ,GAAG,OAAO,EAAE,MAAM,QAAQ;IACrG,MAAM,uBAAuB,gBAAgB,UAAU,kBAAkB,QAAQ;IACjF,IAAI,kBAAkB,eAAe,SAAS,GAAG;KAC/C,IAAI,WAAW,QAAQ,YAAY,cAAc,GAAG;MAClD,OAAO,qBAAqB,SAAS,qBAAqB,QAAQ;KACpE;IACF;IACA,IAAI,WAAW,WAAW,gBAAgB,GAAG;KAC3C,MAAM,kBAAkB;MACtB,GAAG;MACH,yBAAyB,QAAQ,wBAAwB,QACtD,MAAM,MAAM,QACf;KACF;KACA,OAAO,qBAAqB,iBAAiB,YAAY,QAAQ;IACnE;IACA,MAAM,kBAAkB,2BACtB,aACA,QAAQ,kBACR,YACA,QACF;IACA,IAAI,iBAAiB,OAAO;IAC5B,OAAO,qBAAqB,SAAS,YAAY,QAAQ;GAC3D;EACF;EACA,aAAa;GACX,GAAG,gBAAgB;GAInB,8BAA8B;GAC9B,sBAAsB,eACpB,aACA,2CACF;EACF;EAGA,GAAG,mBAAmB,EAAE,iBAAiB,iBAAiB,IAAI,CAAC;EAC/D,UAAU,MAAM,oBAAoB,WAAW;CACjD;CACA,MAAM,cAAc,MAAM,WACxB;EACE,KAAK;EACL;EACA,eAAe,CAAC,CAAC,QAAQ,IAAI;EAC7B,GAAG;CACL,GACA;EACE,GAAG;EACH,GAAG,OAAO,2BAA2B,aAAa,uBAAuB,aAAa,IAAI;CAC5F,CACF;CACA,OAAO;EACL,GAAG,yBACD,2BAA2B,aAAa,WAAW,GACnD,gBACA,OAAO,SAAS,UAAU,CAAC,GAC3B,WACF;EACA,GAAG;CACL;AACF"}
|
|
1
|
+
{"version":3,"file":"getMetroConfigFromViteConfig.js","names":["globPackagesSync"],"sources":["esm/metro-config/getMetroConfigFromViteConfig.js"],"sourcesContent":["import { searchForWorkspaceRoot } from \"vite\";\nimport { spawn } from \"node:child_process\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, join, posix, resolve } from \"node:path\";\nimport workspace from \"resolve-workspace-root\";\nimport { globSync as globPackagesSync } from \"tinyglobby\";\nimport micromatch from \"micromatch\";\nimport { getDefaultConfig } from \"@react-native/metro-config\";\nimport { findUserBabelConfig } from \"@vxrn/compiler\";\nimport { isBunIosEngine } from \"@vxrn/utils\";\nimport {\n desktopReactNativeFile,\n requireOnePackageRoot\n} from \"@vxrn/utils/desktopReactNativeResolve\";\nimport { projectImport, projectResolve } from \"../utils/projectImport\";\nimport { getTerminalReporter } from \"../utils/getTerminalReporter\";\nconst WATCHMAN_PROBE_TIMEOUT_MS = 2e3;\nconst expoEnvAdditionalExts = [\"env\", \"local\", \"development\"];\nconst metroSourceExts = [\"js\", \"jsx\", \"json\", \"ts\", \"tsx\", \"mjs\", \"cjs\", \"swift\", \"kt\"];\nconst watchmanResponsivePromises = /* @__PURE__ */ new Map();\nlet didWarnAboutWatchmanFallback = false;\nconst rootIndexBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/index\\.(bundle|map|assets)(?=$|[?#])/;\nconst expoVirtualEntryBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/\\.expo\\/\\.virtual-metro-entry\\.bundle(?=$|[?#])/;\nconst metroWatchExclusions = [\n /^(?!.*[/\\\\]node_modules[/\\\\]).*[/\\\\]dist[/\\\\](?:static|server)(?:[/\\\\]|$)/,\n /[/\\\\]tests[/\\\\][^/\\\\]+[/\\\\]dist(?:[/\\\\]|$)/,\n /[/\\\\]\\.docker(?:[/\\\\]|$)/,\n /[/\\\\]\\.vite(?:[/\\\\]|$)/,\n /[/\\\\]node_modules[/\\\\]\\.vxrn(?:[/\\\\]|$)/\n];\nfunction enforceWorkspaceVisibility(config, projectRoot) {\n const workspaceRoot = searchForWorkspaceRoot(projectRoot);\n if (workspaceRoot === projectRoot) return config;\n let packages = [];\n try {\n packages = (workspace.getWorkspaceGlobs(workspaceRoot) ?? []).flatMap(\n (pattern) => globPackagesSync(posix.join(pattern, \"package.json\"), {\n cwd: workspaceRoot,\n absolute: true,\n expandDirectories: false,\n caseSensitiveMatch: process.platform !== \"darwin\" && process.platform !== \"win32\",\n ignore: [\"**/@(Carthage|Pods|node_modules)/**\"]\n })\n ).filter((manifest) => {\n try {\n JSON.parse(readFileSync(manifest, \"utf8\"));\n return true;\n } catch {\n return false;\n }\n }).map((manifest) => dirname(manifest));\n } catch {\n packages = [];\n }\n return {\n ...config,\n watchFolders: [\n .../* @__PURE__ */ new Set([\n ...config.watchFolders ?? [],\n ...packages.length ? [resolve(workspaceRoot, \"node_modules\"), ...packages] : []\n ])\n ],\n resolver: {\n ...config.resolver,\n nodeModulesPaths: [\n .../* @__PURE__ */ new Set([\n ...config.resolver?.nodeModulesPaths ?? [],\n resolve(projectRoot, \"node_modules\"),\n resolve(workspaceRoot, \"node_modules\")\n ])\n ]\n }\n };\n}\nfunction getReactNativeDefaultConfig(projectRoot) {\n const config = enforceWorkspaceVisibility(\n getDefaultConfig(projectRoot),\n projectRoot\n );\n return {\n ...config,\n resolver: {\n ...config.resolver,\n assetExts: [.../* @__PURE__ */ new Set([...config.resolver?.assetExts ?? [], \"glb\"])]\n }\n };\n}\nconst oneRoots = /* @__PURE__ */ new Map();\nfunction redirectDesktopReactNative(projectRoot, origin, moduleName, platform) {\n if (platform !== \"macos\" && platform !== \"linux\") return null;\n const file = desktopReactNativeFile(\n origin,\n moduleName,\n oneRootFor(projectRoot, platform),\n platform\n );\n if (!file) return null;\n return { type: \"sourceFile\", filePath: file };\n}\nfunction oneRootFor(projectRoot, platform) {\n let root = oneRoots.get(projectRoot);\n if (!root) {\n root = requireOnePackageRoot(projectRoot, platform);\n oneRoots.set(projectRoot, root);\n }\n return root;\n}\nfunction getPlatformFromBundleUrl(url) {\n const platform = url.match(/[?&]platform=(ios|android|macos|linux)(?:&|$)/)?.[1];\n if (platform === \"ios\" || platform === \"android\" || platform === \"macos\" || platform === \"linux\")\n return platform;\n return \"ios\";\n}\nfunction rewriteMainModuleBundleUrl(url, resolveMainModuleName) {\n const resolvedMainModulePath = resolveMainModuleName({\n platform: getPlatformFromBundleUrl(url)\n });\n if (rootIndexBundleRequestPattern.test(url)) {\n return url.replace(\n rootIndexBundleRequestPattern,\n `$1/${resolvedMainModulePath}.$2`\n );\n }\n return url.replace(\n expoVirtualEntryBundleRequestPattern,\n `$1/${resolvedMainModulePath}.bundle`\n );\n}\nfunction isMainModuleBundleRequest(url) {\n return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);\n}\nfunction isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {\n return !context.dev && isBunIosEngine(projectRoot, platform) && /(^|[\\\\/])polyfillPromise(\\.js)?$/.test(moduleName) && /(^|[\\\\/])react-native[\\\\/]/.test(context.originModulePath);\n}\nfunction isBareSpecifier(name) {\n return name !== \"\" && !name.startsWith(\".\") && !name.startsWith(\"/\");\n}\nfunction isUnresolvableModule(error) {\n if (!error || typeof error !== \"object\") return false;\n if (error.type === \"UnableToResolveError\") return true;\n const message = error.message;\n if (typeof message === \"string\" && message.startsWith(\"Unable to resolve module\")) return true;\n const { dirPaths, extraPaths } = error;\n return Array.isArray(dirPaths) && Array.isArray(extraPaths);\n}\nfunction rootHasPackage(projectRoot, packageName) {\n let directory = projectRoot;\n while (true) {\n if (existsSync(join(directory, \"node_modules\", packageName, \"package.json\"))) return true;\n const parent = dirname(directory);\n if (parent === directory) return false;\n directory = parent;\n }\n}\nfunction bareMainModuleForRequest(moduleName, mainModuleName) {\n if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;\n if (moduleName === `./${mainModuleName}`) return mainModuleName;\n return void 0;\n}\nfunction enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {\n const dedupedPackages = new Set(dedupe);\n if ((!mainModuleName || !isBareSpecifier(mainModuleName)) && !dedupedPackages.size) {\n return config;\n }\n const rootOrigin = resolve(projectRoot, \"package.json\");\n const innerResolveRequest = config.resolver?.resolveRequest;\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: (context, moduleName, platform) => {\n const bareMain = bareMainModuleForRequest(moduleName, mainModuleName);\n const request = bareMain ?? moduleName;\n const packageEnd = request.indexOf(\n \"/\",\n request.startsWith(\"@\") ? request.indexOf(\"/\") + 1 : 0\n );\n const packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);\n const resolveRequest = innerResolveRequest || context.resolveRequest;\n if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {\n return resolveRequest(context, request, platform);\n }\n try {\n return resolveRequest({ ...context, originModulePath: rootOrigin }, request, platform);\n } catch (error) {\n if (!isUnresolvableModule(error)) throw error;\n if (rootHasPackage(projectRoot, packageName)) throw error;\n return resolveRequest(context, request, platform);\n }\n }\n }\n };\n}\nasync function isWatchmanResponsive(projectRoot) {\n let probe = watchmanResponsivePromises.get(projectRoot);\n if (probe) {\n return probe;\n }\n probe = new Promise((resolve2) => {\n let settled = false;\n const finish = (value) => {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n resolve2(value);\n };\n const child = spawn(\"watchman\", [\"watch-project\", projectRoot], {\n stdio: \"ignore\"\n });\n const timeout = setTimeout(() => {\n child.kill();\n finish(false);\n }, WATCHMAN_PROBE_TIMEOUT_MS);\n child.once(\"error\", () => {\n finish(false);\n });\n child.once(\"exit\", (code) => {\n finish(code === 0);\n });\n });\n watchmanResponsivePromises.set(projectRoot, probe);\n return probe;\n}\nfunction resolveNativeTransforms(projectRoot, metroPluginOptions) {\n const userBabelConfigPath = projectRoot ? findUserBabelConfig(projectRoot) : null;\n const hasUserBabelConfig = Boolean(userBabelConfigPath);\n const isNativeTransforms = process.env.ONE_METRO_NATIVE_TRANSFORMS === \"0\" ? false : process.env.ONE_METRO_NATIVE_TRANSFORMS === \"1\" ? true : metroPluginOptions.nativeTransforms === false ? false : metroPluginOptions.nativeTransforms === true ? true : hasUserBabelConfig ? false : true;\n if (userBabelConfigPath && isNativeTransforms) {\n console.warn(\n `[vxrn/metro] Ignoring user babel config at ${userBabelConfigPath} because native transforms are explicitly enabled (nativeTransforms: true or ONE_METRO_NATIVE_TRANSFORMS=1). Port its plugins to nativeTransformModules, or set nativeTransforms: false (or ONE_METRO_NATIVE_TRANSFORMS=0) to use the babel transformer.`\n );\n }\n return { isNativeTransforms, userBabelConfigPath };\n}\nasync function buildMetroConfigInputFromViteConfig(config, metroPluginOptions) {\n const extraConfig = {};\n const projectRoot = resolve(metroPluginOptions.argv?.projectRoot ?? config.root);\n const { mainModuleName, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n const useWatchman = watchman ?? await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\n \"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\"\n );\n }\n const _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n const origRewriteRequestUrl = _defaultConfig.server?.rewriteRequestUrl;\n const resolveMainModuleName = () => mainModuleName;\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = (url) => {\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return origRewriteRequestUrl?.(url) ?? url;\n };\n }\n const existingBlockList = _defaultConfig?.resolver?.blockList;\n const blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [existingBlockList] : [],\n ...metroWatchExclusions\n ];\n const { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n let nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\"\n );\n }\n const defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig?.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ..._defaultConfig?.watcher?.additionalExts ?? [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig?.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([..._defaultConfig?.resolver?.platforms ?? [], \"macos\", \"linux\"])\n ],\n resolveRequest: (context, moduleName, platform) => {\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return { type: \"empty\" };\n const origResolveRequestFn = _defaultConfig?.resolver?.resolveRequest || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n const contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(\n (c) => c !== \"import\"\n )\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n const desktopRedirect = redirectDesktopReactNative(\n projectRoot,\n context.originModulePath,\n moduleName,\n platform\n );\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig?.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/babel-transformer\"\n )\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? { transformerPath: nativeWorkerPath } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n const merged = {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n };\n return {\n defaultConfig: enforcePackageResolution(\n enforceWorkspaceVisibility(merged, projectRoot),\n mainModuleName,\n config.resolve?.dedupe ?? [],\n projectRoot\n ),\n projectRoot,\n extraConfig\n };\n}\nasync function getMetroConfigFromViteConfig(config, metroPluginOptions) {\n const extraConfig = {};\n const projectRoot = resolve(metroPluginOptions.argv?.projectRoot ?? config.root);\n const { mainModuleName, argv, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n const useWatchman = watchman ?? await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\n \"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\"\n );\n }\n const { loadConfig } = await projectImport(projectRoot, \"metro\");\n const _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n const origRewriteRequestUrl = _defaultConfig.server?.rewriteRequestUrl;\n const resolveMainModuleName = () => mainModuleName;\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = (url) => {\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return origRewriteRequestUrl?.(url) ?? url;\n };\n }\n const existingBlockList = _defaultConfig?.resolver?.blockList;\n const blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [existingBlockList] : [],\n ...metroWatchExclusions\n ];\n const { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n let nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\"\n );\n }\n const defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig?.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ..._defaultConfig?.watcher?.additionalExts ?? [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig?.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([..._defaultConfig?.resolver?.platforms ?? [], \"macos\", \"linux\"])\n ],\n resolveRequest: (context, moduleName, platform) => {\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return { type: \"empty\" };\n const origResolveRequestFn = _defaultConfig?.resolver?.resolveRequest || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n const contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(\n (c) => c !== \"import\"\n )\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n const desktopRedirect = redirectDesktopReactNative(\n projectRoot,\n context.originModulePath,\n moduleName,\n platform\n );\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig?.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(\n projectRoot,\n \"@vxrn/vite-plugin-metro/babel-transformer\"\n )\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? { transformerPath: nativeWorkerPath } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n const metroConfig = await loadConfig(\n {\n cwd: projectRoot,\n projectRoot,\n \"reset-cache\": !!process.env.METRO_RESET_CACHE,\n ...argv\n },\n {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n }\n );\n return {\n ...enforcePackageResolution(\n enforceWorkspaceVisibility(metroConfig, projectRoot),\n mainModuleName,\n config.resolve?.dedupe ?? [],\n projectRoot\n ),\n ...extraConfig\n };\n}\nexport {\n buildMetroConfigInputFromViteConfig,\n getMetroConfigFromViteConfig\n};\n//# sourceMappingURL=getMetroConfigFromViteConfig.js.map\n"],"mappings":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1,7 @@
|
|
|
1
1
|
import { searchForWorkspaceRoot } from "vite";
|
|
2
2
|
import { spawn } from "child_process";
|
|
3
|
-
import { readFileSync } from "fs";
|
|
4
|
-
import { dirname, posix, resolve } from "path";
|
|
3
|
+
import { existsSync, readFileSync } from "fs";
|
|
4
|
+
import { dirname, join, posix, resolve } from "path";
|
|
5
5
|
import workspace from "resolve-workspace-root";
|
|
6
6
|
import { globSync } from "tinyglobby";
|
|
7
7
|
import micromatch from "micromatch";
|
|
@@ -135,6 +135,23 @@ function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform
|
|
|
135
135
|
function isBareSpecifier(name) {
|
|
136
136
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
137
137
|
}
|
|
138
|
+
function isUnresolvableModule(error) {
|
|
139
|
+
if (!error || typeof error !== "object") return false;
|
|
140
|
+
if (error.type === "UnableToResolveError") return true;
|
|
141
|
+
var message = error.message;
|
|
142
|
+
if (typeof message === "string" && message.startsWith("Unable to resolve module")) return true;
|
|
143
|
+
var { dirPaths, extraPaths } = error;
|
|
144
|
+
return Array.isArray(dirPaths) && Array.isArray(extraPaths);
|
|
145
|
+
}
|
|
146
|
+
function rootHasPackage(projectRoot, packageName) {
|
|
147
|
+
var directory = projectRoot;
|
|
148
|
+
while (true) {
|
|
149
|
+
if (existsSync(join(directory, "node_modules", packageName, "package.json"))) return true;
|
|
150
|
+
var parent = dirname(directory);
|
|
151
|
+
if (parent === directory) return false;
|
|
152
|
+
directory = parent;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
138
155
|
function bareMainModuleForRequest(moduleName, mainModuleName) {
|
|
139
156
|
if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;
|
|
140
157
|
if (moduleName === `./${mainModuleName}`) return mainModuleName;
|
|
@@ -157,12 +174,20 @@ function enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {
|
|
|
157
174
|
var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;
|
|
158
175
|
var packageEnd = request.indexOf("/", request.startsWith("@") ? request.indexOf("/") + 1 : 0);
|
|
159
176
|
var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);
|
|
160
|
-
var resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {
|
|
161
|
-
...context,
|
|
162
|
-
originModulePath: rootOrigin
|
|
163
|
-
} : context;
|
|
164
177
|
var resolveRequest2 = innerResolveRequest || context.resolveRequest;
|
|
165
|
-
|
|
178
|
+
if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {
|
|
179
|
+
return resolveRequest2(context, request, platform);
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
return resolveRequest2({
|
|
183
|
+
...context,
|
|
184
|
+
originModulePath: rootOrigin
|
|
185
|
+
}, request, platform);
|
|
186
|
+
} catch (error) {
|
|
187
|
+
if (!isUnresolvableModule(error)) throw error;
|
|
188
|
+
if (rootHasPackage(projectRoot, packageName)) throw error;
|
|
189
|
+
return resolveRequest2(context, request, platform);
|
|
190
|
+
}
|
|
166
191
|
}
|
|
167
192
|
}
|
|
168
193
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMetroConfigFromViteConfig.native.js","names":["globPackagesSync"],"sources":["esm/metro-config/getMetroConfigFromViteConfig.native.js"],"sourcesContent":["import { searchForWorkspaceRoot } from \"vite\";\nimport { spawn } from \"child_process\";\nimport { readFileSync } from \"fs\";\nimport { dirname, posix, resolve } from \"path\";\nimport workspace from \"resolve-workspace-root\";\nimport { globSync as globPackagesSync } from \"tinyglobby\";\nimport micromatch from \"micromatch\";\nimport { getDefaultConfig } from \"@react-native/metro-config\";\nimport { findUserBabelConfig } from \"@vxrn/compiler\";\nimport { isBunIosEngine } from \"@vxrn/utils\";\nimport { desktopReactNativeFile, requireOnePackageRoot } from \"@vxrn/utils/desktopReactNativeResolve\";\nimport { projectImport, projectResolve } from \"../utils/projectImport\";\nimport { getTerminalReporter } from \"../utils/getTerminalReporter\";\nvar WATCHMAN_PROBE_TIMEOUT_MS = 2e3;\nvar expoEnvAdditionalExts = [\n \"env\",\n \"local\",\n \"development\"\n];\nvar metroSourceExts = [\n \"js\",\n \"jsx\",\n \"json\",\n \"ts\",\n \"tsx\",\n \"mjs\",\n \"cjs\",\n \"swift\",\n \"kt\"\n];\nvar watchmanResponsivePromises = /* @__PURE__ */ new Map();\nvar didWarnAboutWatchmanFallback = false;\nvar rootIndexBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/index\\.(bundle|map|assets)(?=$|[?#])/;\nvar expoVirtualEntryBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/\\.expo\\/\\.virtual-metro-entry\\.bundle(?=$|[?#])/;\nvar metroWatchExclusions = [\n /^(?!.*[/\\\\]node_modules[/\\\\]).*[/\\\\]dist[/\\\\](?:static|server)(?:[/\\\\]|$)/,\n /[/\\\\]tests[/\\\\][^/\\\\]+[/\\\\]dist(?:[/\\\\]|$)/,\n /[/\\\\]\\.docker(?:[/\\\\]|$)/,\n /[/\\\\]\\.vite(?:[/\\\\]|$)/,\n /[/\\\\]node_modules[/\\\\]\\.vxrn(?:[/\\\\]|$)/\n];\nfunction enforceWorkspaceVisibility(config, projectRoot) {\n var _config_watchFolders, _ref;\n var _config_resolver;\n var workspaceRoot = searchForWorkspaceRoot(projectRoot);\n if (workspaceRoot === projectRoot) return config;\n var packages = [];\n try {\n var _workspace_getWorkspaceGlobs;\n packages = ((_workspace_getWorkspaceGlobs = workspace.getWorkspaceGlobs(workspaceRoot)) !== null && _workspace_getWorkspaceGlobs !== void 0 ? _workspace_getWorkspaceGlobs : []).flatMap(function(pattern) {\n return globPackagesSync(posix.join(pattern, \"package.json\"), {\n cwd: workspaceRoot,\n absolute: true,\n expandDirectories: false,\n caseSensitiveMatch: process.platform !== \"darwin\" && process.platform !== \"win32\",\n ignore: [\n \"**/@(Carthage|Pods|node_modules)/**\"\n ]\n });\n }).filter(function(manifest) {\n try {\n JSON.parse(readFileSync(manifest, \"utf8\"));\n return true;\n } catch (unused) {\n return false;\n }\n }).map(function(manifest) {\n return dirname(manifest);\n });\n } catch (unused) {\n packages = [];\n }\n return {\n ...config,\n watchFolders: [\n .../* @__PURE__ */ new Set([\n ...(_config_watchFolders = config.watchFolders) !== null && _config_watchFolders !== void 0 ? _config_watchFolders : [],\n ...packages.length ? [\n resolve(workspaceRoot, \"node_modules\"),\n ...packages\n ] : []\n ])\n ],\n resolver: {\n ...config.resolver,\n nodeModulesPaths: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.nodeModulesPaths) !== null && _ref !== void 0 ? _ref : [],\n resolve(projectRoot, \"node_modules\"),\n resolve(workspaceRoot, \"node_modules\")\n ])\n ]\n }\n };\n}\nfunction getReactNativeDefaultConfig(projectRoot) {\n var _ref;\n var _config_resolver;\n var config = enforceWorkspaceVisibility(getDefaultConfig(projectRoot), projectRoot);\n return {\n ...config,\n resolver: {\n ...config.resolver,\n assetExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.assetExts) !== null && _ref !== void 0 ? _ref : [],\n \"glb\"\n ])\n ]\n }\n };\n}\nvar oneRoots = /* @__PURE__ */ new Map();\nfunction redirectDesktopReactNative(projectRoot, origin, moduleName, platform) {\n if (platform !== \"macos\" && platform !== \"linux\") return null;\n var file = desktopReactNativeFile(origin, moduleName, oneRootFor(projectRoot, platform), platform);\n if (!file) return null;\n return {\n type: \"sourceFile\",\n filePath: file\n };\n}\nfunction oneRootFor(projectRoot, platform) {\n var root = oneRoots.get(projectRoot);\n if (!root) {\n root = requireOnePackageRoot(projectRoot, platform);\n oneRoots.set(projectRoot, root);\n }\n return root;\n}\nfunction getPlatformFromBundleUrl(url) {\n var _url_match;\n var platform = (_url_match = url.match(/[?&]platform=(ios|android|macos|linux)(?:&|$)/)) === null || _url_match === void 0 ? void 0 : _url_match[1];\n if (platform === \"ios\" || platform === \"android\" || platform === \"macos\" || platform === \"linux\") return platform;\n return \"ios\";\n}\nfunction rewriteMainModuleBundleUrl(url, resolveMainModuleName) {\n var resolvedMainModulePath = resolveMainModuleName({\n platform: getPlatformFromBundleUrl(url)\n });\n if (rootIndexBundleRequestPattern.test(url)) {\n return url.replace(rootIndexBundleRequestPattern, `$1/${resolvedMainModulePath}.$2`);\n }\n return url.replace(expoVirtualEntryBundleRequestPattern, `$1/${resolvedMainModulePath}.bundle`);\n}\nfunction isMainModuleBundleRequest(url) {\n return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);\n}\nfunction isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {\n return !context.dev && isBunIosEngine(projectRoot, platform) && /(^|[\\\\/])polyfillPromise(\\.js)?$/.test(moduleName) && /(^|[\\\\/])react-native[\\\\/]/.test(context.originModulePath);\n}\nfunction isBareSpecifier(name) {\n return name !== \"\" && !name.startsWith(\".\") && !name.startsWith(\"/\");\n}\nfunction bareMainModuleForRequest(moduleName, mainModuleName) {\n if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;\n if (moduleName === `./${mainModuleName}`) return mainModuleName;\n return void 0;\n}\nfunction enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {\n var _config_resolver;\n var dedupedPackages = new Set(dedupe);\n if ((!mainModuleName || !isBareSpecifier(mainModuleName)) && !dedupedPackages.size) {\n return config;\n }\n var rootOrigin = resolve(projectRoot, \"package.json\");\n var innerResolveRequest = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.resolveRequest;\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var bareMain = bareMainModuleForRequest(moduleName, mainModuleName);\n var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;\n var packageEnd = request.indexOf(\"/\", request.startsWith(\"@\") ? request.indexOf(\"/\") + 1 : 0);\n var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);\n var resolutionContext = isBareSpecifier(request) && dedupedPackages.has(packageName) ? {\n ...context,\n originModulePath: rootOrigin\n } : context;\n var resolveRequest2 = innerResolveRequest || context.resolveRequest;\n return resolveRequest2(resolutionContext, request, platform);\n }\n }\n };\n}\nasync function isWatchmanResponsive(projectRoot) {\n var probe = watchmanResponsivePromises.get(projectRoot);\n if (probe) {\n return probe;\n }\n probe = new Promise(function(resolve2) {\n var settled = false;\n var finish = function finish2(value) {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n resolve2(value);\n };\n var child = spawn(\"watchman\", [\n \"watch-project\",\n projectRoot\n ], {\n stdio: \"ignore\"\n });\n var timeout = setTimeout(function() {\n child.kill();\n finish(false);\n }, WATCHMAN_PROBE_TIMEOUT_MS);\n child.once(\"error\", function() {\n finish(false);\n });\n child.once(\"exit\", function(code) {\n finish(code === 0);\n });\n });\n watchmanResponsivePromises.set(projectRoot, probe);\n return probe;\n}\nfunction resolveNativeTransforms(projectRoot, metroPluginOptions) {\n var userBabelConfigPath = projectRoot ? findUserBabelConfig(projectRoot) : null;\n var hasUserBabelConfig = Boolean(userBabelConfigPath);\n var isNativeTransforms = process.env.ONE_METRO_NATIVE_TRANSFORMS === \"0\" ? false : process.env.ONE_METRO_NATIVE_TRANSFORMS === \"1\" ? true : metroPluginOptions.nativeTransforms === false ? false : metroPluginOptions.nativeTransforms === true ? true : hasUserBabelConfig ? false : true;\n if (userBabelConfigPath && isNativeTransforms) {\n console.warn(`[vxrn/metro] Ignoring user babel config at ${userBabelConfigPath} because native transforms are explicitly enabled (nativeTransforms: true or ONE_METRO_NATIVE_TRANSFORMS=1). Port its plugins to nativeTransformModules, or set nativeTransforms: false (or ONE_METRO_NATIVE_TRANSFORMS=0) to use the babel transformer.`);\n }\n return {\n isNativeTransforms,\n userBabelConfigPath\n };\n}\nasync function buildMetroConfigInputFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = resolve((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n var merged = {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n };\n return {\n defaultConfig: enforcePackageResolution(enforceWorkspaceVisibility(merged, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n projectRoot,\n extraConfig\n };\n}\nasync function getMetroConfigFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = resolve((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, argv, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var { loadConfig } = await projectImport(projectRoot, \"metro\");\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n var metroConfig = await loadConfig({\n cwd: projectRoot,\n projectRoot,\n \"reset-cache\": !!process.env.METRO_RESET_CACHE,\n ...argv\n }, {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n });\n return {\n ...enforcePackageResolution(enforceWorkspaceVisibility(metroConfig, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n ...extraConfig\n };\n}\nexport {\n buildMetroConfigInputFromViteConfig,\n getMetroConfigFromViteConfig\n};\n//# sourceMappingURL=getMetroConfigFromViteConfig.js.map\n"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAI,4BAA4B;AAChC,IAAI,wBAAwB;CAC1B;CACA;CACA;AACF;AACA,IAAI,kBAAkB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAI,6CAA6C,IAAI,IAAI;AACzD,IAAI,+BAA+B;AACnC,IAAI,gCAAgC;AACpC,IAAI,uCAAuC;AAC3C,IAAI,uBAAuB;CACzB;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,2BAA2B,QAAQ,aAAa;CACvD,IAAI,sBAAsB;CAC1B,IAAI;CACJ,IAAI,gBAAgB,uBAAuB,WAAW;CACtD,IAAI,kBAAkB,aAAa,OAAO;CAC1C,IAAI,WAAW,CAAC;CAChB,IAAI;EACF,IAAI;EACJ,aAAa,+BAA+B,UAAU,kBAAkB,aAAa,OAAO,QAAQ,iCAAiC,KAAK,IAAI,+BAA+B,CAAC,EAAC,CAAE,QAAQ,SAAS,SAAS;GACzM,OAAOA,SAAiB,MAAM,KAAK,SAAS,cAAc,GAAG;IAC3D,KAAK;IACL,UAAU;IACV,mBAAmB;IACnB,oBAAoB,QAAQ,aAAa,YAAY,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AAC,QAAQ,IAAI;EAC7B,GAAG;CACL,GAAG;EACD,GAAG;EACH,GAAG,OAAO,2BAA2B,aAAa,uBAAuB,aAAa,IAAI;CAC5F,CAAC;CACD,OAAO;EACL,GAAG,yBAAyB,2BAA2B,aAAa,WAAW,GAAG,iBAAiB,SAAS,kBAAkB,OAAO,aAAa,QAAQ,oBAAoB,KAAK,IAAI,KAAK,IAAI,gBAAgB,YAAY,QAAQ,UAAU,KAAK,IAAI,QAAQ,CAAC,GAAG,WAAW;EAC9Q,GAAG;CACL;AACF"}
|
|
1
|
+
{"version":3,"file":"getMetroConfigFromViteConfig.native.js","names":["globPackagesSync"],"sources":["esm/metro-config/getMetroConfigFromViteConfig.native.js"],"sourcesContent":["import { searchForWorkspaceRoot } from \"vite\";\nimport { spawn } from \"child_process\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { dirname, join, posix, resolve } from \"path\";\nimport workspace from \"resolve-workspace-root\";\nimport { globSync as globPackagesSync } from \"tinyglobby\";\nimport micromatch from \"micromatch\";\nimport { getDefaultConfig } from \"@react-native/metro-config\";\nimport { findUserBabelConfig } from \"@vxrn/compiler\";\nimport { isBunIosEngine } from \"@vxrn/utils\";\nimport { desktopReactNativeFile, requireOnePackageRoot } from \"@vxrn/utils/desktopReactNativeResolve\";\nimport { projectImport, projectResolve } from \"../utils/projectImport\";\nimport { getTerminalReporter } from \"../utils/getTerminalReporter\";\nvar WATCHMAN_PROBE_TIMEOUT_MS = 2e3;\nvar expoEnvAdditionalExts = [\n \"env\",\n \"local\",\n \"development\"\n];\nvar metroSourceExts = [\n \"js\",\n \"jsx\",\n \"json\",\n \"ts\",\n \"tsx\",\n \"mjs\",\n \"cjs\",\n \"swift\",\n \"kt\"\n];\nvar watchmanResponsivePromises = /* @__PURE__ */ new Map();\nvar didWarnAboutWatchmanFallback = false;\nvar rootIndexBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/index\\.(bundle|map|assets)(?=$|[?#])/;\nvar expoVirtualEntryBundleRequestPattern = /^(https?:\\/\\/[^/]+)?\\/\\.expo\\/\\.virtual-metro-entry\\.bundle(?=$|[?#])/;\nvar metroWatchExclusions = [\n /^(?!.*[/\\\\]node_modules[/\\\\]).*[/\\\\]dist[/\\\\](?:static|server)(?:[/\\\\]|$)/,\n /[/\\\\]tests[/\\\\][^/\\\\]+[/\\\\]dist(?:[/\\\\]|$)/,\n /[/\\\\]\\.docker(?:[/\\\\]|$)/,\n /[/\\\\]\\.vite(?:[/\\\\]|$)/,\n /[/\\\\]node_modules[/\\\\]\\.vxrn(?:[/\\\\]|$)/\n];\nfunction enforceWorkspaceVisibility(config, projectRoot) {\n var _config_watchFolders, _ref;\n var _config_resolver;\n var workspaceRoot = searchForWorkspaceRoot(projectRoot);\n if (workspaceRoot === projectRoot) return config;\n var packages = [];\n try {\n var _workspace_getWorkspaceGlobs;\n packages = ((_workspace_getWorkspaceGlobs = workspace.getWorkspaceGlobs(workspaceRoot)) !== null && _workspace_getWorkspaceGlobs !== void 0 ? _workspace_getWorkspaceGlobs : []).flatMap(function(pattern) {\n return globPackagesSync(posix.join(pattern, \"package.json\"), {\n cwd: workspaceRoot,\n absolute: true,\n expandDirectories: false,\n caseSensitiveMatch: process.platform !== \"darwin\" && process.platform !== \"win32\",\n ignore: [\n \"**/@(Carthage|Pods|node_modules)/**\"\n ]\n });\n }).filter(function(manifest) {\n try {\n JSON.parse(readFileSync(manifest, \"utf8\"));\n return true;\n } catch (unused) {\n return false;\n }\n }).map(function(manifest) {\n return dirname(manifest);\n });\n } catch (unused) {\n packages = [];\n }\n return {\n ...config,\n watchFolders: [\n .../* @__PURE__ */ new Set([\n ...(_config_watchFolders = config.watchFolders) !== null && _config_watchFolders !== void 0 ? _config_watchFolders : [],\n ...packages.length ? [\n resolve(workspaceRoot, \"node_modules\"),\n ...packages\n ] : []\n ])\n ],\n resolver: {\n ...config.resolver,\n nodeModulesPaths: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.nodeModulesPaths) !== null && _ref !== void 0 ? _ref : [],\n resolve(projectRoot, \"node_modules\"),\n resolve(workspaceRoot, \"node_modules\")\n ])\n ]\n }\n };\n}\nfunction getReactNativeDefaultConfig(projectRoot) {\n var _ref;\n var _config_resolver;\n var config = enforceWorkspaceVisibility(getDefaultConfig(projectRoot), projectRoot);\n return {\n ...config,\n resolver: {\n ...config.resolver,\n assetExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.assetExts) !== null && _ref !== void 0 ? _ref : [],\n \"glb\"\n ])\n ]\n }\n };\n}\nvar oneRoots = /* @__PURE__ */ new Map();\nfunction redirectDesktopReactNative(projectRoot, origin, moduleName, platform) {\n if (platform !== \"macos\" && platform !== \"linux\") return null;\n var file = desktopReactNativeFile(origin, moduleName, oneRootFor(projectRoot, platform), platform);\n if (!file) return null;\n return {\n type: \"sourceFile\",\n filePath: file\n };\n}\nfunction oneRootFor(projectRoot, platform) {\n var root = oneRoots.get(projectRoot);\n if (!root) {\n root = requireOnePackageRoot(projectRoot, platform);\n oneRoots.set(projectRoot, root);\n }\n return root;\n}\nfunction getPlatformFromBundleUrl(url) {\n var _url_match;\n var platform = (_url_match = url.match(/[?&]platform=(ios|android|macos|linux)(?:&|$)/)) === null || _url_match === void 0 ? void 0 : _url_match[1];\n if (platform === \"ios\" || platform === \"android\" || platform === \"macos\" || platform === \"linux\") return platform;\n return \"ios\";\n}\nfunction rewriteMainModuleBundleUrl(url, resolveMainModuleName) {\n var resolvedMainModulePath = resolveMainModuleName({\n platform: getPlatformFromBundleUrl(url)\n });\n if (rootIndexBundleRequestPattern.test(url)) {\n return url.replace(rootIndexBundleRequestPattern, `$1/${resolvedMainModulePath}.$2`);\n }\n return url.replace(expoVirtualEntryBundleRequestPattern, `$1/${resolvedMainModulePath}.bundle`);\n}\nfunction isMainModuleBundleRequest(url) {\n return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);\n}\nfunction isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {\n return !context.dev && isBunIosEngine(projectRoot, platform) && /(^|[\\\\/])polyfillPromise(\\.js)?$/.test(moduleName) && /(^|[\\\\/])react-native[\\\\/]/.test(context.originModulePath);\n}\nfunction isBareSpecifier(name) {\n return name !== \"\" && !name.startsWith(\".\") && !name.startsWith(\"/\");\n}\nfunction isUnresolvableModule(error) {\n if (!error || typeof error !== \"object\") return false;\n if (error.type === \"UnableToResolveError\") return true;\n var message = error.message;\n if (typeof message === \"string\" && message.startsWith(\"Unable to resolve module\")) return true;\n var { dirPaths, extraPaths } = error;\n return Array.isArray(dirPaths) && Array.isArray(extraPaths);\n}\nfunction rootHasPackage(projectRoot, packageName) {\n var directory = projectRoot;\n while (true) {\n if (existsSync(join(directory, \"node_modules\", packageName, \"package.json\"))) return true;\n var parent = dirname(directory);\n if (parent === directory) return false;\n directory = parent;\n }\n}\nfunction bareMainModuleForRequest(moduleName, mainModuleName) {\n if (!mainModuleName || !isBareSpecifier(mainModuleName)) return void 0;\n if (moduleName === `./${mainModuleName}`) return mainModuleName;\n return void 0;\n}\nfunction enforcePackageResolution(config, mainModuleName, dedupe, projectRoot) {\n var _config_resolver;\n var dedupedPackages = new Set(dedupe);\n if ((!mainModuleName || !isBareSpecifier(mainModuleName)) && !dedupedPackages.size) {\n return config;\n }\n var rootOrigin = resolve(projectRoot, \"package.json\");\n var innerResolveRequest = (_config_resolver = config.resolver) === null || _config_resolver === void 0 ? void 0 : _config_resolver.resolveRequest;\n return {\n ...config,\n resolver: {\n ...config.resolver,\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var bareMain = bareMainModuleForRequest(moduleName, mainModuleName);\n var request = bareMain !== null && bareMain !== void 0 ? bareMain : moduleName;\n var packageEnd = request.indexOf(\"/\", request.startsWith(\"@\") ? request.indexOf(\"/\") + 1 : 0);\n var packageName = packageEnd === -1 ? request : request.slice(0, packageEnd);\n var resolveRequest2 = innerResolveRequest || context.resolveRequest;\n if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {\n return resolveRequest2(context, request, platform);\n }\n try {\n return resolveRequest2({\n ...context,\n originModulePath: rootOrigin\n }, request, platform);\n } catch (error) {\n if (!isUnresolvableModule(error)) throw error;\n if (rootHasPackage(projectRoot, packageName)) throw error;\n return resolveRequest2(context, request, platform);\n }\n }\n }\n };\n}\nasync function isWatchmanResponsive(projectRoot) {\n var probe = watchmanResponsivePromises.get(projectRoot);\n if (probe) {\n return probe;\n }\n probe = new Promise(function(resolve2) {\n var settled = false;\n var finish = function finish2(value) {\n if (settled) return;\n settled = true;\n clearTimeout(timeout);\n resolve2(value);\n };\n var child = spawn(\"watchman\", [\n \"watch-project\",\n projectRoot\n ], {\n stdio: \"ignore\"\n });\n var timeout = setTimeout(function() {\n child.kill();\n finish(false);\n }, WATCHMAN_PROBE_TIMEOUT_MS);\n child.once(\"error\", function() {\n finish(false);\n });\n child.once(\"exit\", function(code) {\n finish(code === 0);\n });\n });\n watchmanResponsivePromises.set(projectRoot, probe);\n return probe;\n}\nfunction resolveNativeTransforms(projectRoot, metroPluginOptions) {\n var userBabelConfigPath = projectRoot ? findUserBabelConfig(projectRoot) : null;\n var hasUserBabelConfig = Boolean(userBabelConfigPath);\n var isNativeTransforms = process.env.ONE_METRO_NATIVE_TRANSFORMS === \"0\" ? false : process.env.ONE_METRO_NATIVE_TRANSFORMS === \"1\" ? true : metroPluginOptions.nativeTransforms === false ? false : metroPluginOptions.nativeTransforms === true ? true : hasUserBabelConfig ? false : true;\n if (userBabelConfigPath && isNativeTransforms) {\n console.warn(`[vxrn/metro] Ignoring user babel config at ${userBabelConfigPath} because native transforms are explicitly enabled (nativeTransforms: true or ONE_METRO_NATIVE_TRANSFORMS=1). Port its plugins to nativeTransformModules, or set nativeTransforms: false (or ONE_METRO_NATIVE_TRANSFORMS=0) to use the babel transformer.`);\n }\n return {\n isNativeTransforms,\n userBabelConfigPath\n };\n}\nasync function buildMetroConfigInputFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = resolve((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n var merged = {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n };\n return {\n defaultConfig: enforcePackageResolution(enforceWorkspaceVisibility(merged, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n projectRoot,\n extraConfig\n };\n}\nasync function getMetroConfigFromViteConfig(config, metroPluginOptions) {\n var _ref, _ref1, _ref2, _ref3;\n var _metroPluginOptions_argv, _defaultConfig_resolver, _defaultConfig_watcher, _defaultConfig_resolver1, _config_resolve;\n var extraConfig = {};\n var projectRoot = resolve((_ref = (_metroPluginOptions_argv = metroPluginOptions.argv) === null || _metroPluginOptions_argv === void 0 ? void 0 : _metroPluginOptions_argv.projectRoot) !== null && _ref !== void 0 ? _ref : config.root);\n var { mainModuleName, argv, defaultConfigOverrides, watchman, excludeModules } = metroPluginOptions;\n var useWatchman = watchman !== null && watchman !== void 0 ? watchman : await isWatchmanResponsive(projectRoot);\n if (watchman === void 0 && !useWatchman && !didWarnAboutWatchmanFallback) {\n didWarnAboutWatchmanFallback = true;\n console.warn(\"[vxrn/metro] Watchman is unavailable or unresponsive; falling back to Node file watching.\");\n }\n var { loadConfig } = await projectImport(projectRoot, \"metro\");\n var _defaultConfig = getReactNativeDefaultConfig(projectRoot);\n if (mainModuleName) {\n var _defaultConfig_server;\n var origRewriteRequestUrl = (_defaultConfig_server = _defaultConfig.server) === null || _defaultConfig_server === void 0 ? void 0 : _defaultConfig_server.rewriteRequestUrl;\n var resolveMainModuleName = function resolveMainModuleName2() {\n return mainModuleName;\n };\n extraConfig.getResolveMainModuleName = resolveMainModuleName;\n _defaultConfig.server.rewriteRequestUrl = function(url) {\n var _ref4;\n if (isMainModuleBundleRequest(url)) {\n return rewriteMainModuleBundleUrl(url, resolveMainModuleName);\n }\n return (_ref4 = origRewriteRequestUrl === null || origRewriteRequestUrl === void 0 ? void 0 : origRewriteRequestUrl(url)) !== null && _ref4 !== void 0 ? _ref4 : url;\n };\n }\n var existingBlockList = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver = _defaultConfig.resolver) === null || _defaultConfig_resolver === void 0 ? void 0 : _defaultConfig_resolver.blockList;\n var blockList = [\n ...existingBlockList ? Array.isArray(existingBlockList) ? existingBlockList : [\n existingBlockList\n ] : [],\n ...metroWatchExclusions\n ];\n var { isNativeTransforms } = resolveNativeTransforms(projectRoot, metroPluginOptions);\n var nativeWorkerPath;\n if (isNativeTransforms) {\n nativeWorkerPath = projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/transformer/metroNativeWorker\");\n }\n var defaultConfig = {\n ..._defaultConfig,\n watcher: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.watcher,\n additionalExts: [\n .../* @__PURE__ */ new Set([\n ...(_ref1 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_watcher = _defaultConfig.watcher) === null || _defaultConfig_watcher === void 0 ? void 0 : _defaultConfig_watcher.additionalExts) !== null && _ref1 !== void 0 ? _ref1 : [],\n ...expoEnvAdditionalExts\n ])\n ]\n },\n resolver: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.resolver,\n useWatchman,\n blockList,\n sourceExts: metroSourceExts,\n platforms: [\n .../* @__PURE__ */ new Set([\n ...(_ref2 = _defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver1 = _defaultConfig.resolver) === null || _defaultConfig_resolver1 === void 0 ? void 0 : _defaultConfig_resolver1.platforms) !== null && _ref2 !== void 0 ? _ref2 : [],\n \"macos\",\n \"linux\"\n ])\n ],\n resolveRequest: function resolveRequest(context, moduleName, platform) {\n var _defaultConfig_resolver2;\n if (isReactNativePromisePolyfill(context, moduleName, projectRoot, platform)) return {\n type: \"empty\"\n };\n var origResolveRequestFn = (_defaultConfig === null || _defaultConfig === void 0 ? void 0 : (_defaultConfig_resolver2 = _defaultConfig.resolver) === null || _defaultConfig_resolver2 === void 0 ? void 0 : _defaultConfig_resolver2.resolveRequest) || context.resolveRequest;\n if (excludeModules && excludeModules.length > 0) {\n if (micromatch.isMatch(moduleName, excludeModules)) {\n return origResolveRequestFn(context, \"@vxrn/utils/empty\", platform);\n }\n }\n if (moduleName.startsWith(\"@babel/runtime\")) {\n var contextOverride = {\n ...context,\n unstable_conditionNames: context.unstable_conditionNames.filter(function(c) {\n return c !== \"import\";\n })\n };\n return origResolveRequestFn(contextOverride, moduleName, platform);\n }\n var desktopRedirect = redirectDesktopReactNative(projectRoot, context.originModulePath, moduleName, platform);\n if (desktopRedirect) return desktopRedirect;\n return origResolveRequestFn(context, moduleName, platform);\n }\n },\n transformer: {\n ..._defaultConfig === null || _defaultConfig === void 0 ? void 0 : _defaultConfig.transformer,\n // one's router and Expo's optional development env module both use\n // require.context. Metro installs a throwing runtime stub unless this\n // graph feature is enabled.\n unstable_allowRequireContext: true,\n babelTransformerPath: projectResolve(projectRoot, \"@vxrn/vite-plugin-metro/babel-transformer\")\n },\n // transformerPath is a TOP-LEVEL metro config key, not a transformer option.\n // nesting it under transformer silently leaves metro on its default worker.\n ...nativeWorkerPath ? {\n transformerPath: nativeWorkerPath\n } : {},\n reporter: await getTerminalReporter(projectRoot)\n };\n var metroConfig = await loadConfig({\n cwd: projectRoot,\n projectRoot,\n \"reset-cache\": !!process.env.METRO_RESET_CACHE,\n ...argv\n }, {\n ...defaultConfig,\n ...typeof defaultConfigOverrides === \"function\" ? defaultConfigOverrides(defaultConfig) : defaultConfigOverrides\n });\n return {\n ...enforcePackageResolution(enforceWorkspaceVisibility(metroConfig, projectRoot), mainModuleName, (_ref3 = (_config_resolve = config.resolve) === null || _config_resolve === void 0 ? void 0 : _config_resolve.dedupe) !== null && _ref3 !== void 0 ? _ref3 : [], projectRoot),\n ...extraConfig\n };\n}\nexport {\n buildMetroConfigInputFromViteConfig,\n getMetroConfigFromViteConfig\n};\n//# sourceMappingURL=getMetroConfigFromViteConfig.js.map\n"],"mappings":";;;;;;;;;;;;;;;AAaA,IAAI,4BAA4B;AAChC,IAAI,wBAAwB;CAC1B;CACA;CACA;AACF;AACA,IAAI,kBAAkB;CACpB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAI,6CAA6C,IAAI,IAAI;AACzD,IAAI,+BAA+B;AACnC,IAAI,gCAAgC;AACpC,IAAI,uCAAuC;AAC3C,IAAI,uBAAuB;CACzB;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,2BAA2B,QAAQ,aAAa;CACvD,IAAI,sBAAsB;CAC1B,IAAI;CACJ,IAAI,gBAAgB,uBAAuB,WAAW;CACtD,IAAI,kBAAkB,aAAa,OAAO;CAC1C,IAAI,WAAW,CAAC;CAChB,IAAI;EACF,IAAI;EACJ,aAAa,+BAA+B,UAAU,kBAAkB,aAAa,OAAO,QAAQ,iCAAiC,KAAK,IAAI,+BAA+B,CAAC,EAAC,CAAE,QAAQ,SAAS,SAAS;GACzM,OAAOA,SAAiB,MAAM,K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-metro",
|
|
3
|
-
"version": "2.18.
|
|
3
|
+
"version": "2.18.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"@oxc-project/runtime": "^0.112.0",
|
|
70
70
|
"@react-native/babel-preset": "^0.88.0",
|
|
71
71
|
"@react-native/metro-config": "^0.88.0",
|
|
72
|
-
"@vxrn/compiler": "2.18.
|
|
73
|
-
"@vxrn/debug": "2.18.
|
|
74
|
-
"@vxrn/utils": "2.18.
|
|
72
|
+
"@vxrn/compiler": "2.18.1",
|
|
73
|
+
"@vxrn/debug": "2.18.1",
|
|
74
|
+
"@vxrn/utils": "2.18.1",
|
|
75
75
|
"esbuild": "^0.28.1",
|
|
76
76
|
"flow-parser": "^0.336.0",
|
|
77
77
|
"launch-editor": "^2.14.2",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"publishConfig": {
|
|
100
100
|
"access": "public"
|
|
101
101
|
},
|
|
102
|
-
"releaseSourceCommit": "
|
|
102
|
+
"releaseSourceCommit": "e396bf155a7146feef14b61804cdf181c5786dd7",
|
|
103
103
|
"repository": {
|
|
104
104
|
"type": "git",
|
|
105
105
|
"url": "git+https://github.com/onejs/one.git",
|
|
@@ -184,6 +184,113 @@ require('@fixture/registry-extra'), require('plain'), require('./local'), requir
|
|
|
184
184
|
)
|
|
185
185
|
})
|
|
186
186
|
|
|
187
|
+
describe('deduped packages under an isolated install', () => {
|
|
188
|
+
const bundleConsumer = async (layout: {
|
|
189
|
+
rootShared?: string
|
|
190
|
+
nestedShared: string
|
|
191
|
+
nestedSubpath?: string
|
|
192
|
+
consumerSource: string
|
|
193
|
+
}) => {
|
|
194
|
+
const workspaceRoot = path.resolve(__dirname, '../../../../')
|
|
195
|
+
const scratch = path.join(workspaceRoot, 'scripts/tmp')
|
|
196
|
+
fs.mkdirSync(scratch, { recursive: true })
|
|
197
|
+
const fixtureRoot = fs.mkdtempSync(path.join(scratch, 'metro-isolated-'))
|
|
198
|
+
tmpDirs.push(fixtureRoot)
|
|
199
|
+
fs.writeFileSync(path.join(fixtureRoot, 'package.json'), '{"private":true}')
|
|
200
|
+
const writePackage = (directory: string, name: string, source: string) => {
|
|
201
|
+
fs.mkdirSync(directory, { recursive: true })
|
|
202
|
+
fs.writeFileSync(
|
|
203
|
+
path.join(directory, 'package.json'),
|
|
204
|
+
JSON.stringify({ name, version: '1.0.0', main: 'index.js' })
|
|
205
|
+
)
|
|
206
|
+
fs.writeFileSync(path.join(directory, 'index.js'), source)
|
|
207
|
+
}
|
|
208
|
+
if (layout.rootShared !== undefined) {
|
|
209
|
+
writePackage(
|
|
210
|
+
path.join(fixtureRoot, 'node_modules/@fixture/shared'),
|
|
211
|
+
'@fixture/shared',
|
|
212
|
+
`module.exports=${JSON.stringify(layout.rootShared)};`
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
const consumer = path.join(fixtureRoot, 'node_modules/@fixture/consumer')
|
|
216
|
+
writePackage(consumer, '@fixture/consumer', layout.consumerSource)
|
|
217
|
+
const nested = path.join(consumer, 'node_modules/@fixture/shared')
|
|
218
|
+
writePackage(nested, '@fixture/shared', `module.exports=${JSON.stringify(layout.nestedShared)};`)
|
|
219
|
+
if (layout.nestedSubpath !== undefined) {
|
|
220
|
+
fs.writeFileSync(
|
|
221
|
+
path.join(nested, 'sub.js'),
|
|
222
|
+
`module.exports=${JSON.stringify(layout.nestedSubpath)};`
|
|
223
|
+
)
|
|
224
|
+
}
|
|
225
|
+
const viteConfig = await resolveConfig(
|
|
226
|
+
{
|
|
227
|
+
root: workspaceRoot,
|
|
228
|
+
configFile: false,
|
|
229
|
+
resolve: { dedupe: ['@fixture/shared'] },
|
|
230
|
+
},
|
|
231
|
+
'build'
|
|
232
|
+
)
|
|
233
|
+
const options = {
|
|
234
|
+
watchman: false,
|
|
235
|
+
argv: { projectRoot: fixtureRoot },
|
|
236
|
+
} satisfies MetroPluginOptions
|
|
237
|
+
const require = createRequire(path.join(workspaceRoot, 'package.json'))
|
|
238
|
+
const { loadConfig } = require('metro-config')
|
|
239
|
+
const config = await loadConfig(
|
|
240
|
+
{ cwd: fixtureRoot, projectRoot: fixtureRoot },
|
|
241
|
+
(await buildMetroConfigInputFromViteConfig(viteConfig, options)).defaultConfig
|
|
242
|
+
)
|
|
243
|
+
const entry = path.join(fixtureRoot, 'entry.js')
|
|
244
|
+
fs.writeFileSync(entry, "globalThis.value=require('@fixture/consumer');")
|
|
245
|
+
const Server = require('metro/private/Server').default
|
|
246
|
+
const output = require('metro/private/shared/output/bundle')
|
|
247
|
+
const server = new Server({ ...config, maxWorkers: 1 })
|
|
248
|
+
try {
|
|
249
|
+
const bundle = await output.build(server, {
|
|
250
|
+
entryFile: entry,
|
|
251
|
+
platform: 'android',
|
|
252
|
+
dev: false,
|
|
253
|
+
minify: false,
|
|
254
|
+
})
|
|
255
|
+
const observed = { value: undefined as unknown }
|
|
256
|
+
runInNewContext(bundle.code, observed)
|
|
257
|
+
return observed.value
|
|
258
|
+
} finally {
|
|
259
|
+
await server.end()
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
it('resolves a deduped package from the importing package when the app lacks it', async () => {
|
|
264
|
+
await expect(
|
|
265
|
+
bundleConsumer({
|
|
266
|
+
nestedShared: 'nested',
|
|
267
|
+
consumerSource: "module.exports=require('@fixture/shared');",
|
|
268
|
+
})
|
|
269
|
+
).resolves.toBe('nested')
|
|
270
|
+
}, 180_000)
|
|
271
|
+
|
|
272
|
+
it('keeps the single app copy when the app lists the deduped package', async () => {
|
|
273
|
+
await expect(
|
|
274
|
+
bundleConsumer({
|
|
275
|
+
rootShared: 'root',
|
|
276
|
+
nestedShared: 'nested',
|
|
277
|
+
consumerSource: "module.exports=require('@fixture/shared');",
|
|
278
|
+
})
|
|
279
|
+
).resolves.toBe('root')
|
|
280
|
+
}, 180_000)
|
|
281
|
+
|
|
282
|
+
it('fails instead of splitting copies when the app copy lacks the subpath', async () => {
|
|
283
|
+
await expect(
|
|
284
|
+
bundleConsumer({
|
|
285
|
+
rootShared: 'root',
|
|
286
|
+
nestedShared: 'nested',
|
|
287
|
+
nestedSubpath: 'nested-sub',
|
|
288
|
+
consumerSource: "module.exports=require('@fixture/shared/sub');",
|
|
289
|
+
})
|
|
290
|
+
).rejects.toThrow(/Unable to resolve module/)
|
|
291
|
+
}, 180_000)
|
|
292
|
+
})
|
|
293
|
+
|
|
187
294
|
afterAll(() => {
|
|
188
295
|
for (const tmpDir of tmpDirs) {
|
|
189
296
|
fs.rmSync(tmpDir, { recursive: true, force: true })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { searchForWorkspaceRoot, type ResolvedConfig } from 'vite'
|
|
2
2
|
import { spawn } from 'node:child_process'
|
|
3
|
-
import { readFileSync } from 'node:fs'
|
|
4
|
-
import { dirname, posix, resolve } from 'node:path'
|
|
3
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
4
|
+
import { dirname, join, posix, resolve } from 'node:path'
|
|
5
5
|
import workspace from 'resolve-workspace-root'
|
|
6
6
|
import { globSync as globPackagesSync } from 'tinyglobby'
|
|
7
7
|
import micromatch from 'micromatch'
|
|
@@ -213,6 +213,31 @@ function isBareSpecifier(name: string) {
|
|
|
213
213
|
return name !== '' && !name.startsWith('.') && !name.startsWith('/')
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
+
// metro reports a missing module as UnableToResolveError, or as
|
|
217
|
+
// metro-resolver's FailedToResolveNameError whose dirPaths/extraPaths
|
|
218
|
+
// pair identifies it. duck-type both because metro itself loads from
|
|
219
|
+
// the app and stays unimported here.
|
|
220
|
+
function isUnresolvableModule(error: unknown) {
|
|
221
|
+
if (!error || typeof error !== 'object') return false
|
|
222
|
+
if ((error as { type?: unknown }).type === 'UnableToResolveError') return true
|
|
223
|
+
const message = (error as { message?: unknown }).message
|
|
224
|
+
if (typeof message === 'string' && message.startsWith('Unable to resolve module')) return true
|
|
225
|
+
const { dirPaths, extraPaths } = error as { dirPaths?: unknown; extraPaths?: unknown }
|
|
226
|
+
return Array.isArray(dirPaths) && Array.isArray(extraPaths)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// whether node-style lookup from the app root finds the package at all,
|
|
230
|
+
// following the same upward node_modules walk a missing copy needs.
|
|
231
|
+
function rootHasPackage(projectRoot: string, packageName: string) {
|
|
232
|
+
let directory = projectRoot
|
|
233
|
+
while (true) {
|
|
234
|
+
if (existsSync(join(directory, 'node_modules', packageName, 'package.json'))) return true
|
|
235
|
+
const parent = dirname(directory)
|
|
236
|
+
if (parent === directory) return false
|
|
237
|
+
directory = parent
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
216
241
|
// metro parses `/one/metro-entry.bundle` to the entry `./one/metro-entry`
|
|
217
242
|
// relative to the server root, which misses node_modules package lookup.
|
|
218
243
|
function bareMainModuleForRequest(
|
|
@@ -251,12 +276,22 @@ function enforcePackageResolution(
|
|
|
251
276
|
request.startsWith('@') ? request.indexOf('/') + 1 : 0
|
|
252
277
|
)
|
|
253
278
|
const packageName = packageEnd === -1 ? request : request.slice(0, packageEnd)
|
|
254
|
-
const resolutionContext =
|
|
255
|
-
isBareSpecifier(request) && dedupedPackages.has(packageName)
|
|
256
|
-
? { ...context, originModulePath: rootOrigin }
|
|
257
|
-
: context
|
|
258
279
|
const resolveRequest = innerResolveRequest || context.resolveRequest
|
|
259
|
-
|
|
280
|
+
if (!isBareSpecifier(request) || !dedupedPackages.has(packageName)) {
|
|
281
|
+
return resolveRequest(context, request, platform)
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
return resolveRequest({ ...context, originModulePath: rootOrigin }, request, platform)
|
|
285
|
+
} catch (error) {
|
|
286
|
+
// under an isolated install the app may not list a package one
|
|
287
|
+
// depends on; the copy beside the importing package then wins over
|
|
288
|
+
// failing the bundle. an app that lists the package keeps that
|
|
289
|
+
// single copy even when one subpath fails, so no second copy
|
|
290
|
+
// splits the deduped registration.
|
|
291
|
+
if (!isUnresolvableModule(error)) throw error
|
|
292
|
+
if (rootHasPackage(projectRoot, packageName)) throw error
|
|
293
|
+
return resolveRequest(context, request, platform)
|
|
294
|
+
}
|
|
260
295
|
},
|
|
261
296
|
},
|
|
262
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMetroConfigFromViteConfig.d.ts","sourceRoot":"","sources":["../../src/metro-config/getMetroConfigFromViteConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,MAAM,CAAA;AAsBlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"getMetroConfigFromViteConfig.d.ts","sourceRoot":"","sources":["../../src/metro-config/getMetroConfigFromViteConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,MAAM,CAAA;AAsBlE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAmW/D;;;;;;;GAOG;AACH,wBAAsB,mCAAmC,CACvD,MAAM,EAAE,cAAc,EACtB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAAC;IAAE,aAAa,EAAE,GAAG,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,CAAC,CA+IhF;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,cAAc,EACtB,kBAAkB,EAAE,kBAAkB,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAqK9B"}
|