-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(metro-service):
cli-plugin-metro
has been deprecated
Sync to the latest changes and don't depend on it for bundling. `@react-native-community/cli-plugin-metro` is being moved into the `react-native` repository. In the process, it was renamed and its API surface has been reduced to the bare minimum. `buildBundleWithConfig`, which we need to pass our custom config to the bundler, has also been axed. For more details, see facebook/react-native#38795.
- Loading branch information
Showing
9 changed files
with
257 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
"@rnx-kit/metro-service": patch | ||
--- | ||
|
||
`@react-native-community/cli-plugin-metro` has been deprecated. Sync to the | ||
latest changes and don't depend on it for bundling. | ||
|
||
`@react-native-community/cli-plugin-metro` is being moved into the | ||
`react-native` repository. In the process, it was renamed and its API surface | ||
has been reduced to the bare minimum. `buildBundleWithConfig`, which we need to | ||
pass our custom config to the bundler, has also been axed. For more details, see | ||
https://github.com/facebook/react-native/pull/38795. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// https://github.com/react-native-community/cli/blob/716555851b442a83a1bf5e0db27b6226318c9a69/packages/cli-plugin-metro/src/commands/bundle/assetPathUtils.ts | ||
|
||
import type { PackagerAsset } from "./types"; | ||
|
||
function getBasePath(asset: PackagerAsset): string { | ||
let basePath = asset.httpServerLocation; | ||
if (basePath[0] === "/") { | ||
basePath = basePath.substring(1); | ||
} | ||
return basePath; | ||
} | ||
|
||
export function getResourceIdentifier(asset: PackagerAsset): string { | ||
const folderPath = getBasePath(asset); | ||
return `${folderPath}/${asset.name}` | ||
.toLowerCase() | ||
.replace(/\//g, "_") // Encode folder structure in file name | ||
.replace(/([^a-z0-9_])/g, "") // Remove illegal chars | ||
.replace(/^assets_/, ""); // Remove "assets_" prefix | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.