@granite-js/mpack 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/LICENSE +202 -0
- package/README.md +24 -0
- package/dist/bundler/Bundler.d.ts +24 -0
- package/dist/bundler/Bundler.js +175 -0
- package/dist/bundler/PluginDriver.d.ts +9 -0
- package/dist/bundler/PluginDriver.js +47 -0
- package/dist/bundler/index.d.ts +1 -0
- package/dist/bundler/index.js +22 -0
- package/dist/bundler/plugins/buildStatusPlugin/buildStatusPlugin.d.ts +12 -0
- package/dist/bundler/plugins/buildStatusPlugin/buildStatusPlugin.js +75 -0
- package/dist/bundler/plugins/buildStatusPlugin/index.d.ts +1 -0
- package/dist/bundler/plugins/buildStatusPlugin/index.js +28 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/aliasResolver.d.ts +3 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/aliasResolver.js +89 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/dependencyAliasPlugin.d.ts +3 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/dependencyAliasPlugin.js +43 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/index.d.ts +1 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/index.js +28 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/protocolResolver.d.ts +3 -0
- package/dist/bundler/plugins/dependencyAliasPlugin/protocolResolver.js +53 -0
- package/dist/bundler/plugins/index.d.ts +4 -0
- package/dist/bundler/plugins/index.js +28 -0
- package/dist/bundler/plugins/requireContextPlugin/index.d.ts +1 -0
- package/dist/bundler/plugins/requireContextPlugin/index.js +28 -0
- package/dist/bundler/plugins/requireContextPlugin/requireContextPlugin.d.ts +6 -0
- package/dist/bundler/plugins/requireContextPlugin/requireContextPlugin.js +101 -0
- package/dist/bundler/plugins/requireContextPlugin/scripts.d.ts +56 -0
- package/dist/bundler/plugins/requireContextPlugin/scripts.js +65 -0
- package/dist/bundler/plugins/shared/swc.d.ts +11 -0
- package/dist/bundler/plugins/shared/swc.js +70 -0
- package/dist/bundler/plugins/transformPlugin/helpers/preludeScript.d.ts +23 -0
- package/dist/bundler/plugins/transformPlugin/helpers/preludeScript.js +79 -0
- package/dist/bundler/plugins/transformPlugin/index.d.ts +1 -0
- package/dist/bundler/plugins/transformPlugin/index.js +28 -0
- package/dist/bundler/plugins/transformPlugin/steps/createCacheSteps.d.ts +10 -0
- package/dist/bundler/plugins/transformPlugin/steps/createCacheSteps.js +56 -0
- package/dist/bundler/plugins/transformPlugin/steps/createFullyTransformStep.d.ts +8 -0
- package/dist/bundler/plugins/transformPlugin/steps/createFullyTransformStep.js +120 -0
- package/dist/bundler/plugins/transformPlugin/steps/createStripFlowStep.d.ts +6 -0
- package/dist/bundler/plugins/transformPlugin/steps/createStripFlowStep.js +91 -0
- package/dist/bundler/plugins/transformPlugin/steps/createTransformToHermesSyntaxStep.d.ts +8 -0
- package/dist/bundler/plugins/transformPlugin/steps/createTransformToHermesSyntaxStep.js +100 -0
- package/dist/bundler/plugins/transformPlugin/transformPlugin.d.ts +8 -0
- package/dist/bundler/plugins/transformPlugin/transformPlugin.js +88 -0
- package/dist/bundler/plugins/types.d.ts +7 -0
- package/dist/bundler/plugins/types.js +16 -0
- package/dist/bundler/types.d.ts +17 -0
- package/dist/bundler/types.js +16 -0
- package/dist/cache/Cache.d.ts +25 -0
- package/dist/cache/Cache.js +87 -0
- package/dist/cache/index.d.ts +1 -0
- package/dist/cache/index.js +22 -0
- package/dist/constants/index.d.ts +20 -0
- package/dist/constants/index.js +91 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +60 -0
- package/dist/logger/Logger.d.ts +17 -0
- package/dist/logger/Logger.js +115 -0
- package/dist/logger/clientLogger.d.ts +2 -0
- package/dist/logger/clientLogger.js +49 -0
- package/dist/logger/index.d.ts +3 -0
- package/dist/logger/index.js +31 -0
- package/dist/metro/assetRegistry.d.ts +12 -0
- package/dist/metro/assetRegistry.js +57 -0
- package/dist/metro/enhancedResolver.d.ts +7 -0
- package/dist/metro/enhancedResolver.js +127 -0
- package/dist/metro/getMetroConfig.d.ts +12 -0
- package/dist/metro/getMetroConfig.js +138 -0
- package/dist/metro/getMonorepoRoot.d.ts +4 -0
- package/dist/metro/getMonorepoRoot.js +80 -0
- package/dist/metro/index.d.ts +3 -0
- package/dist/metro/index.js +24 -0
- package/dist/metro/pnpapi.d.ts +6 -0
- package/dist/metro/pnpapi.js +32 -0
- package/dist/metro/runBuild.d.ts +12 -0
- package/dist/metro/runBuild.js +66 -0
- package/dist/metro/runtime.d.ts +3 -0
- package/dist/metro/runtime.js +56 -0
- package/dist/metro/types.d.ts +88 -0
- package/dist/metro/types.js +16 -0
- package/dist/operations/constants.d.ts +3 -0
- package/dist/operations/constants.js +34 -0
- package/dist/operations/createDebuggerMiddleware.d.ts +11 -0
- package/dist/operations/createDebuggerMiddleware.js +128 -0
- package/dist/operations/experimental/StartMenuHandler.d.ts +13 -0
- package/dist/operations/experimental/StartMenuHandler.js +86 -0
- package/dist/operations/experimental/runServer.d.ts +16 -0
- package/dist/operations/experimental/runServer.js +137 -0
- package/dist/operations/index.d.ts +3 -0
- package/dist/operations/index.js +26 -0
- package/dist/operations/openDebugger.d.ts +1 -0
- package/dist/operations/openDebugger.js +73 -0
- package/dist/operations/runBundle.d.ts +12 -0
- package/dist/operations/runBundle.js +97 -0
- package/dist/operations/runServer.d.ts +15 -0
- package/dist/operations/runServer.js +134 -0
- package/dist/performance/Performance.d.ts +23 -0
- package/dist/performance/Performance.js +121 -0
- package/dist/performance/index.d.ts +2 -0
- package/dist/performance/index.js +31 -0
- package/dist/performance/printSummary.d.ts +5 -0
- package/dist/performance/printSummary.js +58 -0
- package/dist/plugins/index.d.ts +1 -0
- package/dist/plugins/index.js +22 -0
- package/dist/plugins/statusPlugin.d.ts +2 -0
- package/dist/plugins/statusPlugin.js +64 -0
- package/dist/server/DevServer.d.ts +23 -0
- package/dist/server/DevServer.js +216 -0
- package/dist/server/constants.d.ts +1 -0
- package/dist/server/constants.js +28 -0
- package/dist/server/debugger/DebuggerEventHandler.d.ts +41 -0
- package/dist/server/debugger/DebuggerEventHandler.js +169 -0
- package/dist/server/debugger/parseDomain.d.ts +1 -0
- package/dist/server/debugger/parseDomain.js +30 -0
- package/dist/server/helpers/createBundlerForDevServer.d.ts +10 -0
- package/dist/server/helpers/createBundlerForDevServer.js +75 -0
- package/dist/server/helpers/mergeBundles.d.ts +7 -0
- package/dist/server/helpers/mergeBundles.js +129 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +22 -0
- package/dist/server/middlewares/createLiveReloadMiddleware.d.ts +10 -0
- package/dist/server/middlewares/createLiveReloadMiddleware.js +129 -0
- package/dist/server/middlewares/index.d.ts +1 -0
- package/dist/server/middlewares/index.js +22 -0
- package/dist/server/plugins/debuggerPlugin.d.ts +7 -0
- package/dist/server/plugins/debuggerPlugin.js +68 -0
- package/dist/server/plugins/index.d.ts +5 -0
- package/dist/server/plugins/index.js +30 -0
- package/dist/server/plugins/indexPagePlugin.d.ts +4 -0
- package/dist/server/plugins/indexPagePlugin.js +52 -0
- package/dist/server/plugins/reply.d.ts +3 -0
- package/dist/server/plugins/reply.js +38 -0
- package/dist/server/plugins/serveBundlePlugin.d.ts +8 -0
- package/dist/server/plugins/serveBundlePlugin.js +118 -0
- package/dist/server/plugins/statusPlugin.d.ts +7 -0
- package/dist/server/plugins/statusPlugin.js +50 -0
- package/dist/server/plugins/symbolicatePlugin/index.d.ts +1 -0
- package/dist/server/plugins/symbolicatePlugin/index.js +28 -0
- package/dist/server/plugins/symbolicatePlugin/parseStackFrame.d.ts +25 -0
- package/dist/server/plugins/symbolicatePlugin/parseStackFrame.js +51 -0
- package/dist/server/plugins/symbolicatePlugin/symbolicate.d.ts +25 -0
- package/dist/server/plugins/symbolicatePlugin/symbolicate.js +84 -0
- package/dist/server/plugins/symbolicatePlugin/symbolicatePlugin.d.ts +8 -0
- package/dist/server/plugins/symbolicatePlugin/symbolicatePlugin.js +77 -0
- package/dist/server/types.d.ts +97 -0
- package/dist/server/types.js +16 -0
- package/dist/server/wss/WebSocketServerDelegate.d.ts +23 -0
- package/dist/server/wss/WebSocketServerDelegate.js +50 -0
- package/dist/server/wss/WebSocketServerRouter.d.ts +8 -0
- package/dist/server/wss/WebSocketServerRouter.js +66 -0
- package/dist/server/wss/index.d.ts +2 -0
- package/dist/server/wss/index.js +24 -0
- package/dist/shared/PersistentStorage.d.ts +21 -0
- package/dist/shared/PersistentStorage.js +68 -0
- package/dist/transformer/AsyncTransformPipeline.d.ts +4 -0
- package/dist/transformer/AsyncTransformPipeline.js +58 -0
- package/dist/transformer/TransformPipeline.d.ts +37 -0
- package/dist/transformer/TransformPipeline.js +64 -0
- package/dist/transformer/index.d.ts +1 -0
- package/dist/transformer/index.js +28 -0
- package/dist/types/BuildConfig.d.ts +183 -0
- package/dist/types/BuildConfig.js +16 -0
- package/dist/types/BundlerConfig.d.ts +56 -0
- package/dist/types/BundlerConfig.js +16 -0
- package/dist/types/Config.d.ts +12 -0
- package/dist/types/Config.js +16 -0
- package/dist/types/DevServerConfig.d.ts +9 -0
- package/dist/types/DevServerConfig.js +16 -0
- package/dist/types/Plugin.d.ts +28 -0
- package/dist/types/Plugin.js +16 -0
- package/dist/types/Preset.d.ts +3 -0
- package/dist/types/Preset.js +16 -0
- package/dist/types/PresetContext.d.ts +2 -0
- package/dist/types/PresetContext.js +16 -0
- package/dist/types/ServicesConfig.d.ts +2 -0
- package/dist/types/ServicesConfig.js +16 -0
- package/dist/types/TaskConfig.d.ts +16 -0
- package/dist/types/TaskConfig.js +16 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +38 -0
- package/dist/types/schemas/buildConfigSchema.d.ts +235 -0
- package/dist/types/schemas/buildConfigSchema.js +79 -0
- package/dist/types/schemas/bundlerConfigSchema.d.ts +3 -0
- package/dist/types/schemas/bundlerConfigSchema.js +51 -0
- package/dist/types/schemas/configSchema.d.ts +3 -0
- package/dist/types/schemas/configSchema.js +50 -0
- package/dist/types/schemas/devServerConfigSchema.d.ts +3 -0
- package/dist/types/schemas/devServerConfigSchema.js +43 -0
- package/dist/types/schemas/index.d.ts +6 -0
- package/dist/types/schemas/index.js +32 -0
- package/dist/types/schemas/servicesConfigSchema.d.ts +3 -0
- package/dist/types/schemas/servicesConfigSchema.js +48 -0
- package/dist/types/schemas/taskConfigSchema.d.ts +3 -0
- package/dist/types/schemas/taskConfigSchema.js +45 -0
- package/dist/utils/cleanupOutputDirectory.d.ts +1 -0
- package/dist/utils/cleanupOutputDirectory.js +53 -0
- package/dist/utils/defineStepName.d.ts +2 -0
- package/dist/utils/defineStepName.js +30 -0
- package/dist/utils/esbuildUtils.d.ts +1 -0
- package/dist/utils/esbuildUtils.js +45 -0
- package/dist/utils/getBundleName.d.ts +1 -0
- package/dist/utils/getBundleName.js +30 -0
- package/dist/utils/getBundleOutputs.d.ts +5 -0
- package/dist/utils/getBundleOutputs.js +49 -0
- package/dist/utils/getId.d.ts +2 -0
- package/dist/utils/getId.js +41 -0
- package/dist/utils/getSourcemapName.d.ts +1 -0
- package/dist/utils/getSourcemapName.js +30 -0
- package/dist/utils/isDebugMode.d.ts +1 -0
- package/dist/utils/isDebugMode.js +30 -0
- package/dist/utils/loadConfig.d.ts +2 -0
- package/dist/utils/loadConfig.js +37 -0
- package/dist/utils/loadPresets.d.ts +2 -0
- package/dist/utils/loadPresets.js +40 -0
- package/dist/utils/md5.d.ts +1 -0
- package/dist/utils/md5.js +41 -0
- package/dist/utils/mergeBanners.d.ts +6 -0
- package/dist/utils/mergeBanners.js +35 -0
- package/dist/utils/mergeBuildConfigs.d.ts +2 -0
- package/dist/utils/mergeBuildConfigs.js +59 -0
- package/dist/utils/mergeInject.d.ts +3 -0
- package/dist/utils/mergeInject.js +30 -0
- package/dist/utils/printLogo.d.ts +1 -0
- package/dist/utils/printLogo.js +56 -0
- package/dist/utils/printSummary.d.ts +7 -0
- package/dist/utils/printSummary.js +55 -0
- package/dist/utils/progressBar.d.ts +9 -0
- package/dist/utils/progressBar.js +97 -0
- package/dist/utils/promiseHandler.d.ts +12 -0
- package/dist/utils/promiseHandler.js +54 -0
- package/dist/utils/replaceModulePath.d.ts +1 -0
- package/dist/utils/replaceModulePath.js +31 -0
- package/dist/utils/replacePlaceholders.d.ts +1 -0
- package/dist/utils/replacePlaceholders.js +33 -0
- package/dist/utils/stripExtension.d.ts +1 -0
- package/dist/utils/stripExtension.js +41 -0
- package/dist/utils/writeBundle.d.ts +2 -0
- package/dist/utils/writeBundle.js +52 -0
- package/dist/vendors/@react-native/dev-middleware/Device.d.ts +5 -0
- package/dist/vendors/@react-native/dev-middleware/Device.js +33 -0
- package/dist/vendors/@react-native/dev-middleware/InspectorProxy.d.ts +31 -0
- package/dist/vendors/@react-native/dev-middleware/InspectorProxy.js +169 -0
- package/dist/vendors/@react-native/dev-middleware/index.d.ts +3 -0
- package/dist/vendors/@react-native/dev-middleware/index.js +26 -0
- package/dist/vendors/@react-native/dev-middleware/types.d.ts +54 -0
- package/dist/vendors/@react-native/dev-middleware/types.js +16 -0
- package/dist/vendors/@react-native-community/cli-server-api/createWebSocketEndpoints.d.ts +23 -0
- package/dist/vendors/@react-native-community/cli-server-api/createWebSocketEndpoints.js +47 -0
- package/dist/vendors/@react-native-community/cli-server-api/index.d.ts +1 -0
- package/dist/vendors/@react-native-community/cli-server-api/index.js +22 -0
- package/dist/vendors/index.d.ts +27 -0
- package/dist/vendors/index.js +63 -0
- package/dist/vendors/metro/src/Assets.js +159 -0
- package/dist/vendors/metro/src/Bundler/util.js +131 -0
- package/dist/vendors/metro/src/Bundler.js +43 -0
- package/dist/vendors/metro/src/DeltaBundler/DeltaCalculator.js +176 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/baseBytecodeBundle.js +61 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/baseJSBundle.js +45 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/getAllFiles.js +30 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/getAssets.js +23 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/getExplodedSourceMap.js +17 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/getRamBundleInfo.js +87 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/bytecode.js +51 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.js +6 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js +16 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.js +21 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/js.js +43 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/processBytecodeModules.js +13 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/helpers/processModules.js +13 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/hmrJSBundle.js +66 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/sourceMapGenerator.js +63 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/sourceMapObject.js +18 -0
- package/dist/vendors/metro/src/DeltaBundler/Serializers/sourceMapString.js +8 -0
- package/dist/vendors/metro/src/DeltaBundler/Transformer.js +133 -0
- package/dist/vendors/metro/src/DeltaBundler/Worker.flow.js +64 -0
- package/dist/vendors/metro/src/DeltaBundler/Worker.js +6 -0
- package/dist/vendors/metro/src/DeltaBundler/WorkerFarm.js +128 -0
- package/dist/vendors/metro/src/DeltaBundler/getTransformCacheKey.js +20 -0
- package/dist/vendors/metro/src/DeltaBundler/graphOperations.js +420 -0
- package/dist/vendors/metro/src/DeltaBundler/mergeDeltas.js +52 -0
- package/dist/vendors/metro/src/DeltaBundler/types.flow.js +24 -0
- package/dist/vendors/metro/src/DeltaBundler.js +56 -0
- package/dist/vendors/metro/src/HmrServer.js +224 -0
- package/dist/vendors/metro/src/IncrementalBundler/GraphNotFoundError.js +9 -0
- package/dist/vendors/metro/src/IncrementalBundler/ResourceNotFoundError.js +9 -0
- package/dist/vendors/metro/src/IncrementalBundler/RevisionNotFoundError.js +9 -0
- package/dist/vendors/metro/src/IncrementalBundler.js +213 -0
- package/dist/vendors/metro/src/ModuleGraph/module.js +14 -0
- package/dist/vendors/metro/src/ModuleGraph/node-haste/HasteFS.js +66 -0
- package/dist/vendors/metro/src/ModuleGraph/node-haste/Module.js +22 -0
- package/dist/vendors/metro/src/ModuleGraph/node-haste/ModuleCache.js +43 -0
- package/dist/vendors/metro/src/ModuleGraph/node-haste/Package.js +81 -0
- package/dist/vendors/metro/src/ModuleGraph/node-haste/node-haste.flow.js +1 -0
- package/dist/vendors/metro/src/ModuleGraph/node-haste/node-haste.js +127 -0
- package/dist/vendors/metro/src/ModuleGraph/output/indexed-ram-bundle.js +71 -0
- package/dist/vendors/metro/src/ModuleGraph/output/multiple-files-ram-bundle.js +53 -0
- package/dist/vendors/metro/src/ModuleGraph/output/plain-bundle.js +36 -0
- package/dist/vendors/metro/src/ModuleGraph/output/reverse-dependency-map-references.js +53 -0
- package/dist/vendors/metro/src/ModuleGraph/output/util.js +168 -0
- package/dist/vendors/metro/src/ModuleGraph/silent-console.js +5 -0
- package/dist/vendors/metro/src/ModuleGraph/types.flow.js +1 -0
- package/dist/vendors/metro/src/ModuleGraph/worker/JsFileWrapping.js +87 -0
- package/dist/vendors/metro/src/ModuleGraph/worker/Platforms.js +3 -0
- package/dist/vendors/metro/src/ModuleGraph/worker/collectDependencies.js +440 -0
- package/dist/vendors/metro/src/ModuleGraph/worker/generate.js +21 -0
- package/dist/vendors/metro/src/ModuleGraph/worker/generateImportNames.js +19 -0
- package/dist/vendors/metro/src/ModuleGraph/worker/mergeSourceMaps.js +29 -0
- package/dist/vendors/metro/src/Server/MultipartResponse.js +57 -0
- package/dist/vendors/metro/src/Server/symbolicate.js +109 -0
- package/dist/vendors/metro/src/Server.js +855 -0
- package/dist/vendors/metro/src/cli-utils.js +14 -0
- package/dist/vendors/metro/src/cli.js +9 -0
- package/dist/vendors/metro/src/commands/build.js +67 -0
- package/dist/vendors/metro/src/commands/dependencies.js +75 -0
- package/dist/vendors/metro/src/commands/serve.js +56 -0
- package/dist/vendors/metro/src/index.d.ts +8 -0
- package/dist/vendors/metro/src/index.flow.js +279 -0
- package/dist/vendors/metro/src/index.js +6 -0
- package/dist/vendors/metro/src/isPnP.js +13 -0
- package/dist/vendors/metro/src/lib/BatchProcessor.js +69 -0
- package/dist/vendors/metro/src/lib/CountingSet.js +98 -0
- package/dist/vendors/metro/src/lib/JsonReporter.js +21 -0
- package/dist/vendors/metro/src/lib/RamBundleParser.js +36 -0
- package/dist/vendors/metro/src/lib/TerminalReporter.d.ts +18 -0
- package/dist/vendors/metro/src/lib/TerminalReporter.js +258 -0
- package/dist/vendors/metro/src/lib/bundleToBytecode.js +40 -0
- package/dist/vendors/metro/src/lib/bundleToString.js +22 -0
- package/dist/vendors/metro/src/lib/contextModule.js +73 -0
- package/dist/vendors/metro/src/lib/contextModuleTemplates.js +116 -0
- package/dist/vendors/metro/src/lib/countLines.js +4 -0
- package/dist/vendors/metro/src/lib/createModuleIdFactory.js +14 -0
- package/dist/vendors/metro/src/lib/createWebsocketServer.js +54 -0
- package/dist/vendors/metro/src/lib/debounceAsyncQueue.js +33 -0
- package/dist/vendors/metro/src/lib/formatBundlingError.js +76 -0
- package/dist/vendors/metro/src/lib/getAppendScripts.js +131 -0
- package/dist/vendors/metro/src/lib/getGraphId.js +27 -0
- package/dist/vendors/metro/src/lib/getMaxWorkers.js +6 -0
- package/dist/vendors/metro/src/lib/getPreludeCode.js +32 -0
- package/dist/vendors/metro/src/lib/getPrependedScripts.js +93 -0
- package/dist/vendors/metro/src/lib/logToConsole.js +46 -0
- package/dist/vendors/metro/src/lib/parseCustomResolverOptions.js +13 -0
- package/dist/vendors/metro/src/lib/parseCustomTransformOptions.js +13 -0
- package/dist/vendors/metro/src/lib/parseOptionsFromUrl.js +50 -0
- package/dist/vendors/metro/src/lib/relativizeSourceMap.js +14 -0
- package/dist/vendors/metro/src/lib/reporting.js +26 -0
- package/dist/vendors/metro/src/lib/splitBundleOptions.js +32 -0
- package/dist/vendors/metro/src/lib/transformHelpers.js +112 -0
- package/dist/vendors/metro/src/node-haste/DependencyGraph/ModuleResolution.js +221 -0
- package/dist/vendors/metro/src/node-haste/DependencyGraph/createHasteMap.js +71 -0
- package/dist/vendors/metro/src/node-haste/DependencyGraph.js +223 -0
- package/dist/vendors/metro/src/node-haste/Module.js +21 -0
- package/dist/vendors/metro/src/node-haste/ModuleCache.js +81 -0
- package/dist/vendors/metro/src/node-haste/Package.js +98 -0
- package/dist/vendors/metro/src/node-haste/lib/AssetPaths.js +41 -0
- package/dist/vendors/metro/src/node-haste/lib/parsePlatformFilePath.js +19 -0
- package/dist/vendors/metro/src/shared/output/RamBundle/as-assets.js +61 -0
- package/dist/vendors/metro/src/shared/output/RamBundle/as-indexed-file.js +115 -0
- package/dist/vendors/metro/src/shared/output/RamBundle/buildSourcemapWithMetadata.js +23 -0
- package/dist/vendors/metro/src/shared/output/RamBundle/magic-number.js +2 -0
- package/dist/vendors/metro/src/shared/output/RamBundle/util.js +94 -0
- package/dist/vendors/metro/src/shared/output/RamBundle/write-sourcemap.js +12 -0
- package/dist/vendors/metro/src/shared/output/RamBundle.js +18 -0
- package/dist/vendors/metro/src/shared/output/bundle.flow.js +42 -0
- package/dist/vendors/metro/src/shared/output/bundle.js +6 -0
- package/dist/vendors/metro/src/shared/output/meta.js +31 -0
- package/dist/vendors/metro/src/shared/output/unbundle.js +2 -0
- package/dist/vendors/metro/src/shared/output/writeFile.js +6 -0
- package/dist/vendors/metro/src/shared/types.flow.js +1 -0
- package/dist/vendors/metro-config/src/configTypes.flow.js +1 -0
- package/dist/vendors/metro-config/src/defaults/defaults.js +66 -0
- package/dist/vendors/metro-config/src/defaults/exclusionList.d.ts +3 -0
- package/dist/vendors/metro-config/src/defaults/exclusionList.js +17 -0
- package/dist/vendors/metro-config/src/defaults/index.d.ts +5 -0
- package/dist/vendors/metro-config/src/defaults/index.js +161 -0
- package/dist/vendors/metro-config/src/defaults/validConfig.js +28 -0
- package/dist/vendors/metro-config/src/index.js +9 -0
- package/dist/vendors/metro-config/src/loadConfig.d.ts +4 -0
- package/dist/vendors/metro-config/src/loadConfig.js +188 -0
- package/dist/vendors/metro-core/src/Logger.js +62 -0
- package/dist/vendors/metro-core/src/Terminal.d.ts +30 -0
- package/dist/vendors/metro-core/src/Terminal.js +100 -0
- package/dist/vendors/metro-core/src/canonicalize.js +17 -0
- package/dist/vendors/metro-core/src/errors/AmbiguousModuleResolutionError.js +11 -0
- package/dist/vendors/metro-core/src/errors/PackageResolutionError.js +18 -0
- package/dist/vendors/metro-core/src/errors.js +7 -0
- package/dist/vendors/metro-core/src/index.js +11 -0
- package/dist/vendors/metro-inspector-proxy/src/Device.js +398 -0
- package/dist/vendors/metro-inspector-proxy/src/InspectorProxy.d.ts +21 -0
- package/dist/vendors/metro-inspector-proxy/src/InspectorProxy.js +153 -0
- package/dist/vendors/metro-inspector-proxy/src/cli.js +15 -0
- package/dist/vendors/metro-inspector-proxy/src/index.js +23 -0
- package/dist/vendors/metro-inspector-proxy/src/types.js +1 -0
- package/dist/vendors/metro-transform-worker/src/index.js +430 -0
- package/dist/vendors/metro-transform-worker/src/utils/assetTransformer.js +20 -0
- package/dist/vendors/metro-transform-worker/src/utils/getMinifier.js +11 -0
- package/package.json +162 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
const defaultCreateModuleIdFactory = require("../../../metro/src/lib/createModuleIdFactory");
|
|
25
|
+
exports.assetExts = [
|
|
26
|
+
// Image formats
|
|
27
|
+
"bmp",
|
|
28
|
+
"gif",
|
|
29
|
+
"jpg",
|
|
30
|
+
"jpeg",
|
|
31
|
+
"png",
|
|
32
|
+
"psd",
|
|
33
|
+
"svg",
|
|
34
|
+
"webp",
|
|
35
|
+
// Video formats
|
|
36
|
+
"m4v",
|
|
37
|
+
"mov",
|
|
38
|
+
"mp4",
|
|
39
|
+
"mpeg",
|
|
40
|
+
"mpg",
|
|
41
|
+
"webm",
|
|
42
|
+
// Audio formats
|
|
43
|
+
"aac",
|
|
44
|
+
"aiff",
|
|
45
|
+
"caf",
|
|
46
|
+
"m4a",
|
|
47
|
+
"mp3",
|
|
48
|
+
"wav",
|
|
49
|
+
// Document formats
|
|
50
|
+
"html",
|
|
51
|
+
"pdf",
|
|
52
|
+
"yaml",
|
|
53
|
+
"yml",
|
|
54
|
+
// Font formats
|
|
55
|
+
"otf",
|
|
56
|
+
"ttf",
|
|
57
|
+
// Archives (virtual files)
|
|
58
|
+
"zip"
|
|
59
|
+
];
|
|
60
|
+
exports.assetResolutions = ["1", "1.5", "2", "3", "4"];
|
|
61
|
+
exports.sourceExts = ["js", "jsx", "json", "ts", "tsx"];
|
|
62
|
+
exports.additionalExts = ["cjs", "mjs"];
|
|
63
|
+
exports.moduleSystem = require.resolve("metro-runtime/src/polyfills/require.js");
|
|
64
|
+
exports.platforms = ["ios", "android", "windows", "web"];
|
|
65
|
+
exports.DEFAULT_METRO_MINIFIER_PATH = "metro-minify-uglify";
|
|
66
|
+
exports.defaultCreateModuleIdFactory = defaultCreateModuleIdFactory;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var path = require("path");
|
|
3
|
+
var list = [/\/__tests__\/.*/];
|
|
4
|
+
function escapeRegExp(pattern) {
|
|
5
|
+
if (Object.prototype.toString.call(pattern) === "[object RegExp]") {
|
|
6
|
+
return pattern.source.replace(/\/|\\\//g, "\\" + path.sep);
|
|
7
|
+
} else if (typeof pattern === "string") {
|
|
8
|
+
var escaped = pattern.replace(/[\-\[\]\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
9
|
+
return escaped.replace(/\//g, "\\" + path.sep);
|
|
10
|
+
} else {
|
|
11
|
+
throw new Error("Unexpected exclusion pattern: " + pattern);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function exclusionList(additionalExclusions) {
|
|
15
|
+
return new RegExp("(" + (additionalExclusions || []).concat(list).map(escapeRegExp).join("|") + ")$");
|
|
16
|
+
}
|
|
17
|
+
module.exports = exclusionList;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
const {
|
|
25
|
+
DEFAULT_METRO_MINIFIER_PATH,
|
|
26
|
+
assetExts,
|
|
27
|
+
assetResolutions,
|
|
28
|
+
additionalExts,
|
|
29
|
+
defaultCreateModuleIdFactory,
|
|
30
|
+
platforms,
|
|
31
|
+
sourceExts
|
|
32
|
+
} = require("./defaults");
|
|
33
|
+
const exclusionList = require("./exclusionList");
|
|
34
|
+
const { FileStore } = require("metro-cache");
|
|
35
|
+
const { Terminal } = require("../../../metro-core/src");
|
|
36
|
+
const getMaxWorkers = require("../../../metro/src/lib/getMaxWorkers");
|
|
37
|
+
const TerminalReporter = require("../../../metro/src/lib/TerminalReporter");
|
|
38
|
+
const os = require("os");
|
|
39
|
+
const path = require("path");
|
|
40
|
+
const getDefaultValues = (projectRoot) => ({
|
|
41
|
+
resolver: {
|
|
42
|
+
assetExts,
|
|
43
|
+
assetResolutions,
|
|
44
|
+
platforms,
|
|
45
|
+
sourceExts,
|
|
46
|
+
blockList: exclusionList(),
|
|
47
|
+
dependencyExtractor: void 0,
|
|
48
|
+
disableHierarchicalLookup: false,
|
|
49
|
+
emptyModulePath: require.resolve("metro-runtime/src/modules/empty-module.js"),
|
|
50
|
+
extraNodeModules: {},
|
|
51
|
+
hasteImplModulePath: void 0,
|
|
52
|
+
nodeModulesPaths: [],
|
|
53
|
+
resolveRequest: null,
|
|
54
|
+
resolverMainFields: ["browser", "main"],
|
|
55
|
+
useWatchman: true,
|
|
56
|
+
requireCycleIgnorePatterns: [/(^|\/|\\)node_modules($|\/|\\)/]
|
|
57
|
+
},
|
|
58
|
+
serializer: {
|
|
59
|
+
polyfillModuleNames: [],
|
|
60
|
+
getRunModuleStatement: (moduleId) => `__r(${JSON.stringify(moduleId)});`,
|
|
61
|
+
getPolyfills: () => [],
|
|
62
|
+
postProcessBundleSourcemap: ({ code, map, outFileName }) => ({ code, map }),
|
|
63
|
+
getModulesRunBeforeMainModule: () => [],
|
|
64
|
+
processModuleFilter: (module2) => true,
|
|
65
|
+
createModuleIdFactory: defaultCreateModuleIdFactory,
|
|
66
|
+
experimentalSerializerHook: () => {
|
|
67
|
+
},
|
|
68
|
+
customSerializer: null
|
|
69
|
+
},
|
|
70
|
+
server: {
|
|
71
|
+
useGlobalHotkey: true,
|
|
72
|
+
port: 8080,
|
|
73
|
+
enhanceMiddleware: (middleware) => middleware,
|
|
74
|
+
rewriteRequestUrl: (url) => url,
|
|
75
|
+
runInspectorProxy: true,
|
|
76
|
+
verifyConnections: false,
|
|
77
|
+
unstable_serverRoot: null
|
|
78
|
+
},
|
|
79
|
+
symbolicator: {
|
|
80
|
+
customizeFrame: () => {
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
transformer: {
|
|
84
|
+
assetPlugins: [],
|
|
85
|
+
asyncRequireModulePath: "metro-runtime/src/modules/asyncRequire",
|
|
86
|
+
assetRegistryPath: "missing-asset-registry-path",
|
|
87
|
+
babelTransformerPath: "metro-babel-transformer",
|
|
88
|
+
dynamicDepsInPackages: "throwAtRuntime",
|
|
89
|
+
enableBabelRCLookup: true,
|
|
90
|
+
enableBabelRuntime: true,
|
|
91
|
+
experimentalImportBundleSupport: false,
|
|
92
|
+
getTransformOptions: async () => ({
|
|
93
|
+
transform: {
|
|
94
|
+
experimentalImportSupport: false,
|
|
95
|
+
inlineRequires: false,
|
|
96
|
+
unstable_disableES6Transforms: false
|
|
97
|
+
},
|
|
98
|
+
preloadedModules: false,
|
|
99
|
+
ramGroups: []
|
|
100
|
+
}),
|
|
101
|
+
globalPrefix: "",
|
|
102
|
+
hermesParser: false,
|
|
103
|
+
minifierConfig: {
|
|
104
|
+
mangle: {
|
|
105
|
+
toplevel: false
|
|
106
|
+
},
|
|
107
|
+
output: {
|
|
108
|
+
ascii_only: true,
|
|
109
|
+
quote_style: 3,
|
|
110
|
+
wrap_iife: true
|
|
111
|
+
},
|
|
112
|
+
sourceMap: {
|
|
113
|
+
includeSources: false
|
|
114
|
+
},
|
|
115
|
+
toplevel: false,
|
|
116
|
+
compress: {
|
|
117
|
+
// reduce_funcs inlines single-use functions, which cause perf regressions.
|
|
118
|
+
reduce_funcs: false
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
minifierPath: DEFAULT_METRO_MINIFIER_PATH,
|
|
122
|
+
optimizationSizeLimit: 150 * 1024,
|
|
123
|
+
// 150 KiB.
|
|
124
|
+
transformVariants: { default: {} },
|
|
125
|
+
workerPath: "metro/src/DeltaBundler/Worker",
|
|
126
|
+
publicPath: "/assets",
|
|
127
|
+
allowOptionalDependencies: false,
|
|
128
|
+
unstable_allowRequireContext: false,
|
|
129
|
+
unstable_collectDependenciesPath: "metro/src/ModuleGraph/worker/collectDependencies.js",
|
|
130
|
+
unstable_dependencyMapReservedName: null,
|
|
131
|
+
unstable_disableModuleWrapping: false,
|
|
132
|
+
unstable_disableNormalizePseudoGlobals: false,
|
|
133
|
+
unstable_compactOutput: false
|
|
134
|
+
},
|
|
135
|
+
watcher: {
|
|
136
|
+
additionalExts,
|
|
137
|
+
watchman: {
|
|
138
|
+
deferStates: ["hg.update"]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
cacheStores: [
|
|
142
|
+
new FileStore({
|
|
143
|
+
root: path.join(os.tmpdir(), "metro-cache")
|
|
144
|
+
})
|
|
145
|
+
],
|
|
146
|
+
cacheVersion: "1.0",
|
|
147
|
+
// We assume the default project path is two levels up from
|
|
148
|
+
// node_modules/metro/
|
|
149
|
+
projectRoot: projectRoot || path.resolve(__dirname, "../../.."),
|
|
150
|
+
stickyWorkers: true,
|
|
151
|
+
watchFolders: [],
|
|
152
|
+
transformerPath: "metro-transform-worker",
|
|
153
|
+
maxWorkers: getMaxWorkers(),
|
|
154
|
+
resetCache: false,
|
|
155
|
+
reporter: new TerminalReporter(new Terminal(process.stdout))
|
|
156
|
+
});
|
|
157
|
+
async function getDefaultConfig(rootPath) {
|
|
158
|
+
return getDefaultValues(rootPath);
|
|
159
|
+
}
|
|
160
|
+
module.exports = getDefaultConfig;
|
|
161
|
+
module.exports.getDefaultValues = getDefaultValues;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
module.exports = async () => {
|
|
3
|
+
const defaultConfig = await require("./index")("/path/to/project");
|
|
4
|
+
const validConfig = {
|
|
5
|
+
...defaultConfig,
|
|
6
|
+
resolver: {
|
|
7
|
+
...defaultConfig.resolver,
|
|
8
|
+
resolveRequest: function CustomResolver() {
|
|
9
|
+
},
|
|
10
|
+
hasteImplModulePath: "./path"
|
|
11
|
+
},
|
|
12
|
+
server: {
|
|
13
|
+
...defaultConfig.server,
|
|
14
|
+
unstable_serverRoot: ""
|
|
15
|
+
},
|
|
16
|
+
transformer: {
|
|
17
|
+
...defaultConfig.transformer,
|
|
18
|
+
getTransformOptions: function getTransformOptions() {
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
serializer: {
|
|
22
|
+
...defaultConfig.serializer,
|
|
23
|
+
customSerializer: function customSerializer() {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
return validConfig;
|
|
28
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const getDefaultConfig = require("./defaults");
|
|
3
|
+
const validConfig = require("./defaults/validConfig");
|
|
4
|
+
const { cosmiconfig, defaultLoaders } = require("cosmiconfig");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const { validate } = require("jest-validate");
|
|
7
|
+
const MetroCache = require("metro-cache");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const { dirname, join } = require("path");
|
|
10
|
+
function overrideArgument(arg) {
|
|
11
|
+
if (arg == null) {
|
|
12
|
+
return arg;
|
|
13
|
+
}
|
|
14
|
+
if (Array.isArray(arg)) {
|
|
15
|
+
return arg[arg.length - 1];
|
|
16
|
+
}
|
|
17
|
+
return arg;
|
|
18
|
+
}
|
|
19
|
+
const explorer = cosmiconfig("metro", {
|
|
20
|
+
searchPlaces: ["metro.config.js", "metro.config.json", "package.json"],
|
|
21
|
+
loaders: {
|
|
22
|
+
// MARK: - GRANITE
|
|
23
|
+
...defaultLoaders,
|
|
24
|
+
".es6": defaultLoaders[".js"],
|
|
25
|
+
noExt: cosmiconfig.loadYaml
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const isFile = (filePath) => fs.existsSync(filePath) && !fs.lstatSync(filePath).isDirectory();
|
|
29
|
+
const resolve = (filePath) => {
|
|
30
|
+
try {
|
|
31
|
+
return require.resolve(filePath);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (path.isAbsolute(filePath) || error.code !== "MODULE_NOT_FOUND") {
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const possiblePath = path.resolve(process.cwd(), filePath);
|
|
38
|
+
return isFile(possiblePath) ? possiblePath : filePath;
|
|
39
|
+
};
|
|
40
|
+
async function resolveConfig(filePath, cwd) {
|
|
41
|
+
if (filePath) {
|
|
42
|
+
return explorer.load(resolve(filePath));
|
|
43
|
+
}
|
|
44
|
+
const result = await explorer.search(cwd);
|
|
45
|
+
if (result == null) {
|
|
46
|
+
return {
|
|
47
|
+
isEmpty: true,
|
|
48
|
+
filepath: join(cwd || process.cwd(), "metro.config.stub.js"),
|
|
49
|
+
config: {}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function mergeConfig(defaultConfig, ...configs) {
|
|
55
|
+
return configs.reduce(
|
|
56
|
+
(totalConfig, nextConfig) => ({
|
|
57
|
+
...totalConfig,
|
|
58
|
+
...nextConfig,
|
|
59
|
+
cacheStores: nextConfig.cacheStores != null ? typeof nextConfig.cacheStores === "function" ? nextConfig.cacheStores(MetroCache) : nextConfig.cacheStores : totalConfig.cacheStores,
|
|
60
|
+
resolver: {
|
|
61
|
+
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses
|
|
62
|
+
* an error found when Flow v0.111 was deployed. To see the error,
|
|
63
|
+
* delete this comment and run Flow. */
|
|
64
|
+
...totalConfig.resolver,
|
|
65
|
+
...nextConfig.resolver || {},
|
|
66
|
+
dependencyExtractor: nextConfig.resolver && nextConfig.resolver.dependencyExtractor != null ? resolve(nextConfig.resolver.dependencyExtractor) : totalConfig.resolver.dependencyExtractor,
|
|
67
|
+
hasteImplModulePath: nextConfig.resolver && nextConfig.resolver.hasteImplModulePath != null ? resolve(nextConfig.resolver.hasteImplModulePath) : totalConfig.resolver.hasteImplModulePath
|
|
68
|
+
},
|
|
69
|
+
serializer: {
|
|
70
|
+
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses
|
|
71
|
+
* an error found when Flow v0.111 was deployed. To see the error,
|
|
72
|
+
* delete this comment and run Flow. */
|
|
73
|
+
...totalConfig.serializer,
|
|
74
|
+
...nextConfig.serializer || {}
|
|
75
|
+
},
|
|
76
|
+
transformer: {
|
|
77
|
+
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses
|
|
78
|
+
* an error found when Flow v0.111 was deployed. To see the error,
|
|
79
|
+
* delete this comment and run Flow. */
|
|
80
|
+
...totalConfig.transformer,
|
|
81
|
+
...nextConfig.transformer || {},
|
|
82
|
+
babelTransformerPath: nextConfig.transformer && nextConfig.transformer.babelTransformerPath != null ? resolve(nextConfig.transformer.babelTransformerPath) : totalConfig.transformer.babelTransformerPath
|
|
83
|
+
},
|
|
84
|
+
server: {
|
|
85
|
+
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses
|
|
86
|
+
* an error found when Flow v0.111 was deployed. To see the error,
|
|
87
|
+
* delete this comment and run Flow. */
|
|
88
|
+
...totalConfig.server,
|
|
89
|
+
...nextConfig.server || {}
|
|
90
|
+
},
|
|
91
|
+
symbolicator: {
|
|
92
|
+
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses
|
|
93
|
+
* an error found when Flow v0.111 was deployed. To see the error,
|
|
94
|
+
* delete this comment and run Flow. */
|
|
95
|
+
...totalConfig.symbolicator,
|
|
96
|
+
...nextConfig.symbolicator || {}
|
|
97
|
+
},
|
|
98
|
+
watcher: {
|
|
99
|
+
...totalConfig.watcher,
|
|
100
|
+
...nextConfig.watcher,
|
|
101
|
+
watchman: {
|
|
102
|
+
...totalConfig.watcher?.watchman,
|
|
103
|
+
...nextConfig.watcher?.watchman
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}),
|
|
107
|
+
defaultConfig
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
async function loadMetroConfigFromDisk(path2, cwd, defaultConfigOverrides) {
|
|
111
|
+
const resolvedConfigResults = await resolveConfig(path2, cwd);
|
|
112
|
+
const { config: configModule, filepath } = resolvedConfigResults;
|
|
113
|
+
const rootPath = dirname(filepath);
|
|
114
|
+
const defaults = await getDefaultConfig(rootPath);
|
|
115
|
+
const defaultConfig = mergeConfig(defaults, defaultConfigOverrides);
|
|
116
|
+
if (typeof configModule === "function") {
|
|
117
|
+
const resultedConfig = await configModule(defaultConfig);
|
|
118
|
+
return mergeConfig(defaultConfig, resultedConfig);
|
|
119
|
+
}
|
|
120
|
+
return mergeConfig(defaultConfig, configModule);
|
|
121
|
+
}
|
|
122
|
+
function overrideConfigWithArguments(config, argv) {
|
|
123
|
+
const output = {
|
|
124
|
+
resolver: {},
|
|
125
|
+
serializer: {},
|
|
126
|
+
server: {},
|
|
127
|
+
transformer: {}
|
|
128
|
+
};
|
|
129
|
+
if (argv.port != null) {
|
|
130
|
+
output.server.port = Number(argv.port);
|
|
131
|
+
}
|
|
132
|
+
if (argv.runInspectorProxy != null) {
|
|
133
|
+
output.server.runInspectorProxy = Boolean(argv.runInspectorProxy);
|
|
134
|
+
}
|
|
135
|
+
if (argv.projectRoot != null) {
|
|
136
|
+
output.projectRoot = argv.projectRoot;
|
|
137
|
+
}
|
|
138
|
+
if (argv.watchFolders != null) {
|
|
139
|
+
output.watchFolders = argv.watchFolders;
|
|
140
|
+
}
|
|
141
|
+
if (argv.assetExts != null) {
|
|
142
|
+
output.resolver.assetExts = argv.assetExts;
|
|
143
|
+
}
|
|
144
|
+
if (argv.sourceExts != null) {
|
|
145
|
+
output.resolver.sourceExts = argv.sourceExts;
|
|
146
|
+
}
|
|
147
|
+
if (argv.platforms != null) {
|
|
148
|
+
output.resolver.platforms = argv.platforms;
|
|
149
|
+
}
|
|
150
|
+
if (argv["max-workers"] != null || argv.maxWorkers != null) {
|
|
151
|
+
output.maxWorkers = Number(argv["max-workers"] || argv.maxWorkers);
|
|
152
|
+
}
|
|
153
|
+
if (argv.transformer != null) {
|
|
154
|
+
output.transformer.babelTransformerPath = argv.transformer;
|
|
155
|
+
}
|
|
156
|
+
if (argv["reset-cache"] != null) {
|
|
157
|
+
output.resetCache = argv["reset-cache"];
|
|
158
|
+
}
|
|
159
|
+
if (argv.resetCache != null) {
|
|
160
|
+
output.resetCache = argv.resetCache;
|
|
161
|
+
}
|
|
162
|
+
if (argv.verbose === false) {
|
|
163
|
+
output.reporter = { update: () => {
|
|
164
|
+
} };
|
|
165
|
+
}
|
|
166
|
+
return mergeConfig(config, output);
|
|
167
|
+
}
|
|
168
|
+
async function loadConfig(argv = {}, defaultConfigOverrides = {}) {
|
|
169
|
+
argv.config = overrideArgument(argv.config);
|
|
170
|
+
const configuration = await loadMetroConfigFromDisk(argv.config, argv.cwd, defaultConfigOverrides);
|
|
171
|
+
validate(configuration, {
|
|
172
|
+
exampleConfig: await validConfig(),
|
|
173
|
+
recursiveBlacklist: ["reporter", "resolver", "transformer"],
|
|
174
|
+
deprecatedConfig: {
|
|
175
|
+
blacklistRE: () => `Warning: Metro config option \`blacklistRE\` is deprecated.
|
|
176
|
+
Please use \`blockList\` instead.`
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
const configWithArgs = overrideConfigWithArguments(configuration, argv);
|
|
180
|
+
const overriddenConfig = {};
|
|
181
|
+
overriddenConfig.watchFolders = [configWithArgs.projectRoot, ...configWithArgs.watchFolders];
|
|
182
|
+
return mergeConfig(configWithArgs, overriddenConfig);
|
|
183
|
+
}
|
|
184
|
+
module.exports = {
|
|
185
|
+
loadConfig,
|
|
186
|
+
resolveConfig,
|
|
187
|
+
mergeConfig
|
|
188
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const VERSION = "0.0.0";
|
|
3
|
+
const { EventEmitter } = require("events");
|
|
4
|
+
const os = require("os");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const log_session = `${os.hostname()}-${Date.now()}`;
|
|
7
|
+
const eventEmitter = new EventEmitter();
|
|
8
|
+
function on(event, handler) {
|
|
9
|
+
eventEmitter.on(event, handler);
|
|
10
|
+
}
|
|
11
|
+
function createEntry(data) {
|
|
12
|
+
const logEntry = typeof data === "string" ? { log_entry_label: data } : data;
|
|
13
|
+
const entryPoint = logEntry.entry_point;
|
|
14
|
+
if (entryPoint) {
|
|
15
|
+
logEntry.entry_point = path.relative(process.cwd(), entryPoint);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
...logEntry,
|
|
19
|
+
log_session,
|
|
20
|
+
metro_bundler_version: VERSION
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function createActionStartEntry(data) {
|
|
24
|
+
const logEntry = typeof data === "string" ? { action_name: data } : data;
|
|
25
|
+
const { action_name } = logEntry;
|
|
26
|
+
return createEntry({
|
|
27
|
+
...logEntry,
|
|
28
|
+
action_name,
|
|
29
|
+
action_phase: "start",
|
|
30
|
+
log_entry_label: action_name,
|
|
31
|
+
start_timestamp: process.hrtime()
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function createActionEndEntry(logEntry) {
|
|
35
|
+
const { action_name, action_phase, start_timestamp } = logEntry;
|
|
36
|
+
if (action_phase !== "start" || !Array.isArray(start_timestamp)) {
|
|
37
|
+
throw new Error("Action has not started or has already ended");
|
|
38
|
+
}
|
|
39
|
+
const timeDelta = process.hrtime(start_timestamp);
|
|
40
|
+
const duration_ms = Math.round((timeDelta[0] * 1e9 + timeDelta[1]) / 1e6);
|
|
41
|
+
return createEntry({
|
|
42
|
+
...logEntry,
|
|
43
|
+
action_name,
|
|
44
|
+
action_phase: "end",
|
|
45
|
+
duration_ms,
|
|
46
|
+
/* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
|
|
47
|
+
* error found when Flow v0.111 was deployed. To see the error, delete this
|
|
48
|
+
* comment and run Flow. */
|
|
49
|
+
log_entry_label: action_name
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function log(logEntry) {
|
|
53
|
+
eventEmitter.emit("log", logEntry);
|
|
54
|
+
return logEntry;
|
|
55
|
+
}
|
|
56
|
+
module.exports = {
|
|
57
|
+
on,
|
|
58
|
+
createEntry,
|
|
59
|
+
createActionStartEntry,
|
|
60
|
+
createActionEndEntry,
|
|
61
|
+
log
|
|
62
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as net from 'net';
|
|
2
|
+
import type * as stream from 'stream';
|
|
3
|
+
|
|
4
|
+
type UnderlyingStream = net.Socket | stream.Writable;
|
|
5
|
+
|
|
6
|
+
declare class Terminal {
|
|
7
|
+
constructor(stream: UnderlyingStream);
|
|
8
|
+
/**
|
|
9
|
+
* Shows some text that is meant to be overriden later. Return the previous
|
|
10
|
+
* status that was shown and is no more. Calling `status()` with no argument
|
|
11
|
+
* removes the status altogether. The status is never shown in a
|
|
12
|
+
* non-interactive terminal: for example, if the output is redirected to a
|
|
13
|
+
* file, then we don't care too much about having a progress bar.
|
|
14
|
+
*/
|
|
15
|
+
status(format: string, ...args: unknown[]): string;
|
|
16
|
+
/**
|
|
17
|
+
* Similar to `console.log`, except it moves the status/progress text out of
|
|
18
|
+
* the way correctly. In non-interactive terminals this is the same as
|
|
19
|
+
* `console.log`.
|
|
20
|
+
*/
|
|
21
|
+
log(format: string, ...args: unknown[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Log the current status and start from scratch. This is useful if the last
|
|
24
|
+
* status was the last one of a series of updates.
|
|
25
|
+
*/
|
|
26
|
+
persistStatus(): void;
|
|
27
|
+
flush(): void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default Terminal;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const throttle = require("lodash.throttle");
|
|
3
|
+
const readline = require("readline");
|
|
4
|
+
const tty = require("tty");
|
|
5
|
+
const util = require("util");
|
|
6
|
+
function clearStringBackwards(stream, str) {
|
|
7
|
+
readline.moveCursor(stream, -stream.columns, 0);
|
|
8
|
+
readline.clearLine(stream, 0);
|
|
9
|
+
let lineCount = (str.match(/\n/g) || []).length;
|
|
10
|
+
while (lineCount > 0) {
|
|
11
|
+
readline.moveCursor(stream, 0, -1);
|
|
12
|
+
readline.clearLine(stream, 0);
|
|
13
|
+
--lineCount;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function chunkString(str, size) {
|
|
17
|
+
const ANSI_COLOR = "\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?m";
|
|
18
|
+
const SKIP_ANSI = `(?:${ANSI_COLOR})*`;
|
|
19
|
+
return str.match(new RegExp(`(?:${SKIP_ANSI}.){1,${size}}`, "g")) || [];
|
|
20
|
+
}
|
|
21
|
+
function getTTYStream(stream) {
|
|
22
|
+
if (stream instanceof tty.WriteStream && stream.isTTY && stream.columns >= 1) {
|
|
23
|
+
return stream;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
class Terminal {
|
|
28
|
+
_logLines;
|
|
29
|
+
_nextStatusStr;
|
|
30
|
+
_scheduleUpdate;
|
|
31
|
+
_statusStr;
|
|
32
|
+
_stream;
|
|
33
|
+
constructor(stream) {
|
|
34
|
+
this._logLines = [];
|
|
35
|
+
this._nextStatusStr = "";
|
|
36
|
+
this._scheduleUpdate = throttle(this._update, 33);
|
|
37
|
+
this._statusStr = "";
|
|
38
|
+
this._stream = stream;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Clear and write the new status, logging in bulk in-between. Doing this in a
|
|
42
|
+
* throttled way (in a different tick than the calls to `log()` and
|
|
43
|
+
* `status()`) prevents us from repeatedly rewriting the status in case
|
|
44
|
+
* `terminal.log()` is called several times.
|
|
45
|
+
*/
|
|
46
|
+
_update() {
|
|
47
|
+
const { _statusStr, _stream } = this;
|
|
48
|
+
const ttyStream = getTTYStream(_stream);
|
|
49
|
+
if (_statusStr === this._nextStatusStr && this._logLines.length === 0) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (ttyStream != null) {
|
|
53
|
+
clearStringBackwards(ttyStream, _statusStr);
|
|
54
|
+
}
|
|
55
|
+
this._logLines.forEach((line) => {
|
|
56
|
+
_stream.write(line);
|
|
57
|
+
_stream.write("\n");
|
|
58
|
+
});
|
|
59
|
+
this._logLines = [];
|
|
60
|
+
if (ttyStream != null) {
|
|
61
|
+
this._nextStatusStr = chunkString(this._nextStatusStr, ttyStream.columns).join("\n");
|
|
62
|
+
_stream.write(this._nextStatusStr);
|
|
63
|
+
}
|
|
64
|
+
this._statusStr = this._nextStatusStr;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Shows some text that is meant to be overriden later. Return the previous
|
|
68
|
+
* status that was shown and is no more. Calling `status()` with no argument
|
|
69
|
+
* removes the status altogether. The status is never shown in a
|
|
70
|
+
* non-interactive terminal: for example, if the output is redirected to a
|
|
71
|
+
* file, then we don't care too much about having a progress bar.
|
|
72
|
+
*/
|
|
73
|
+
status(format, ...args) {
|
|
74
|
+
const { _nextStatusStr } = this;
|
|
75
|
+
this._nextStatusStr = util.format(format, ...args);
|
|
76
|
+
this._scheduleUpdate();
|
|
77
|
+
return _nextStatusStr;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Similar to `console.log`, except it moves the status/progress text out of
|
|
81
|
+
* the way correctly. In non-interactive terminals this is the same as
|
|
82
|
+
* `console.log`.
|
|
83
|
+
*/
|
|
84
|
+
log(format, ...args) {
|
|
85
|
+
this._logLines.push(util.format(format, ...args));
|
|
86
|
+
this._scheduleUpdate();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Log the current status and start from scratch. This is useful if the last
|
|
90
|
+
* status was the last one of a series of updates.
|
|
91
|
+
*/
|
|
92
|
+
persistStatus() {
|
|
93
|
+
this.log(this._nextStatusStr);
|
|
94
|
+
this._nextStatusStr = "";
|
|
95
|
+
}
|
|
96
|
+
flush() {
|
|
97
|
+
this._scheduleUpdate.flush();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
module.exports = Terminal;
|