@vxrn/vite-plugin-metro 2.23.1 → 2.24.0
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 +1 -1
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.cjs +1 -1
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js +1 -1
- package/dist/cjs/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs +2 -2
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.mjs.map +1 -1
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js +2 -2
- package/dist/esm/metro-config/getMetroConfigFromViteConfig.native.js.map +1 -1
- package/package.json +5 -5
- package/src/metro-config/getMetroConfigFromViteConfig.ts +2 -2
|
@@ -151,7 +151,7 @@ function isMainModuleBundleRequest(url) {
|
|
|
151
151
|
return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);
|
|
152
152
|
}
|
|
153
153
|
function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {
|
|
154
|
-
return !context.dev && (0, import_utils.
|
|
154
|
+
return !context.dev && (0, import_utils.isBunEngine)(projectRoot, platform) && /(^|[\\/])polyfillPromise(\.js)?$/.test(moduleName) && /(^|[\\/])react-native[\\/]/.test(context.originModulePath);
|
|
155
155
|
}
|
|
156
156
|
function isBareSpecifier(name) {
|
|
157
157
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
@@ -163,7 +163,7 @@ function isMainModuleBundleRequest(url) {
|
|
|
163
163
|
return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);
|
|
164
164
|
}
|
|
165
165
|
function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {
|
|
166
|
-
return !context.dev && (0, import_utils.
|
|
166
|
+
return !context.dev && (0, import_utils.isBunEngine)(projectRoot, platform) && /(^|[\\/])polyfillPromise(\.js)?$/.test(moduleName) && /(^|[\\/])react-native[\\/]/.test(context.originModulePath);
|
|
167
167
|
}
|
|
168
168
|
function isBareSpecifier(name) {
|
|
169
169
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
@@ -163,7 +163,7 @@ function isMainModuleBundleRequest(url) {
|
|
|
163
163
|
return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);
|
|
164
164
|
}
|
|
165
165
|
function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {
|
|
166
|
-
return !context.dev && (0, import_utils.
|
|
166
|
+
return !context.dev && (0, import_utils.isBunEngine)(projectRoot, platform) && /(^|[\\/])polyfillPromise(\.js)?$/.test(moduleName) && /(^|[\\/])react-native[\\/]/.test(context.originModulePath);
|
|
167
167
|
}
|
|
168
168
|
function isBareSpecifier(name) {
|
|
169
169
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
@@ -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 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=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,I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AAW,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.isBunEngine)(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=getMetroCon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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"}
|
|
@@ -7,7 +7,7 @@ import { globSync } from "tinyglobby";
|
|
|
7
7
|
import micromatch from "micromatch";
|
|
8
8
|
import { getDefaultConfig } from "@react-native/metro-config";
|
|
9
9
|
import { findUserBabelConfig } from "@vxrn/compiler";
|
|
10
|
-
import {
|
|
10
|
+
import { isBunEngine } from "@vxrn/utils";
|
|
11
11
|
import { desktopReactNativeFile, requireOnePackageRoot } from "@vxrn/utils/desktopReactNativeResolve";
|
|
12
12
|
import { projectImport, projectResolve } from "../utils/projectImport.mjs";
|
|
13
13
|
import { getTerminalReporter } from "../utils/getTerminalReporter.mjs";
|
|
@@ -120,7 +120,7 @@ function isMainModuleBundleRequest(url) {
|
|
|
120
120
|
return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);
|
|
121
121
|
}
|
|
122
122
|
function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {
|
|
123
|
-
return !context.dev &&
|
|
123
|
+
return !context.dev && isBunEngine(projectRoot, platform) && /(^|[\\/])polyfillPromise(\.js)?$/.test(moduleName) && /(^|[\\/])react-native[\\/]/.test(context.originModulePath);
|
|
124
124
|
}
|
|
125
125
|
function isBareSpecifier(name) {
|
|
126
126
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
@@ -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 { 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":";;;;;;;;;;;;;;;AAgBA,MAAM,4BAA4B;AAClC,MAAM,wBAAwB;CAAC;CAAO;CAAS;AAAa;AAC5D,MAAM,kBAAkB;CAAC;CAAM;C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S;GAAO,CAAC,CAC7F;GACA,iBAAiB,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 { isBunEngine } 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 && isBunEngine(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=getMetro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CACL;AACF"}
|
|
@@ -7,7 +7,7 @@ import { globSync } from "tinyglobby";
|
|
|
7
7
|
import micromatch from "micromatch";
|
|
8
8
|
import { getDefaultConfig } from "@react-native/metro-config";
|
|
9
9
|
import { findUserBabelConfig } from "@vxrn/compiler";
|
|
10
|
-
import {
|
|
10
|
+
import { isBunEngine } from "@vxrn/utils";
|
|
11
11
|
import { desktopReactNativeFile, requireOnePackageRoot } from "@vxrn/utils/desktopReactNativeResolve";
|
|
12
12
|
import { projectImport, projectResolve } from "../utils/projectImport.native.js";
|
|
13
13
|
import { getTerminalReporter } from "../utils/getTerminalReporter.native.js";
|
|
@@ -130,7 +130,7 @@ function isMainModuleBundleRequest(url) {
|
|
|
130
130
|
return rootIndexBundleRequestPattern.test(url) || expoVirtualEntryBundleRequestPattern.test(url);
|
|
131
131
|
}
|
|
132
132
|
function isReactNativePromisePolyfill(context, moduleName, projectRoot, platform) {
|
|
133
|
-
return !context.dev &&
|
|
133
|
+
return !context.dev && isBunEngine(projectRoot, platform) && /(^|[\\/])polyfillPromise(\.js)?$/.test(moduleName) && /(^|[\\/])react-native[\\/]/.test(context.originModulePath);
|
|
134
134
|
}
|
|
135
135
|
function isBareSpecifier(name) {
|
|
136
136
|
return name !== "" && !name.startsWith(".") && !name.startsWith("/");
|
|
@@ -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 { 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;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AAc,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":["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 { isBunEngine } 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 && isBunEngine(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,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
|
|
1
1
|
{
|
|
2
2
|
"name": "@vxrn/vite-plugin-metro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
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.
|
|
73
|
-
"@vxrn/debug": "2.
|
|
74
|
-
"@vxrn/utils": "2.
|
|
72
|
+
"@vxrn/compiler": "2.24.0",
|
|
73
|
+
"@vxrn/debug": "2.24.0",
|
|
74
|
+
"@vxrn/utils": "2.24.0",
|
|
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": "eee5231f271e6b3ef5a54835b090ae69307707ad",
|
|
103
103
|
"repository": {
|
|
104
104
|
"type": "git",
|
|
105
105
|
"url": "git+https://github.com/onejs/one.git",
|
|
@@ -12,7 +12,7 @@ import { getDefaultConfig } from '@react-native/metro-config'
|
|
|
12
12
|
import type { loadConfig as loadConfigT } from 'metro'
|
|
13
13
|
|
|
14
14
|
import { findUserBabelConfig } from '@vxrn/compiler'
|
|
15
|
-
import {
|
|
15
|
+
import { isBunEngine } from '@vxrn/utils'
|
|
16
16
|
import {
|
|
17
17
|
desktopReactNativeFile,
|
|
18
18
|
requireOnePackageRoot,
|
|
@@ -203,7 +203,7 @@ function isReactNativePromisePolyfill(
|
|
|
203
203
|
) {
|
|
204
204
|
return (
|
|
205
205
|
!context.dev &&
|
|
206
|
-
|
|
206
|
+
isBunEngine(projectRoot, platform) &&
|
|
207
207
|
/(^|[\\/])polyfillPromise(\.js)?$/.test(moduleName) &&
|
|
208
208
|
/(^|[\\/])react-native[\\/]/.test(context.originModulePath)
|
|
209
209
|
)
|