-
Notifications
You must be signed in to change notification settings - Fork 646
Comparing changes
Open a pull request
base repository: facebook/metro
base: v0.74.0
head repository: facebook/metro
compare: v0.74.1
- 15 commits
- 75 files changed
- 6 contributors
Commits on Jan 11, 2023
-
Add
@babel/plugin-proposal-numeric-separator
to the babel plugins w……hen not in Hermes (#681) Summary: Changelog: * **[Feature]**: Enable ES2021 numeric separator syntax in React Native **Summary** This PR solves issue #645. It adds `babel/plugin-proposal-numeric-separator` to the list of babel plugins when not using Hermes to more closely match ES2021. Now that ES2021 has been finalized, people will probably (?—I know I did) expect `1_000_000` to be treated as a valid number. As I noted in a [comment](#645 (comment)) in #645, should `babel/preset-env` be included instead of including many different plugins manually? Even for engines like Hermes which don't need all the same transforms as JSC, I don't think the unneeded transforms would drastically increase the bundle size, right? **Test plan** Tested it using a sample app on `"react-native": "0.65.0-rc.2"`. Solves the `react-native bundle` issue on iOS (only tested on device as I encountered issues compiling for the simulator) and Android production / release builds when not using Hermes. Pull Request resolved: #681 Reviewed By: rubennorte Differential Revision: D29556107 Pulled By: motiz88 fbshipit-source-id: 2d66bf8993cb10dd1f020939f4ad1bbf49cccc19
Configuration menu - View commit details
-
Copy full SHA for 22bc39f - Browse repository at this point
Copy the full SHA 22bc39fView commit details
Commits on Jan 12, 2023
-
Introduce BundlerResolution type
Summary: Changelog: Internal ## This diff Creates a new object type, `BundlerResolution`, to represent the return value of the resolver as seen by the bundler (instead of returning just a single string value). This is a mostly mechanical refactor, but there are some further changes in `ModuleResolution.js` where we remove the reliance on `getModule()` and the `ModuleT` generic (and for `sourceFile` resolutions, we now *directly* return the resolver's output). The intention is to keep this close to the `Resolution` type that is in the resolver's public API (and in `resolveRequest` etc), and possibly remove the distinction between the two. *For now*, it's useful to continue to translate `assetFiles` and `empty` resolutions to `sourceFile` (inside `ModuleResolution.js`), without forcing all call sites to deal with the different resolution types. ## Next steps In future work, `BundlerResolution` will carry more information that will allow the bundler to invalidate resolutions correctly (e.g. candidate paths that were attempted before the successful resolution). Longer term, we might also want to use this structure to keep track of additional file dependencies that invalidate the *contents* of virtual modules (such as assets and `require.context` modules). Currently, asset modules are not invalidated correctly when a secondary asset file (e.g. a different scale variant of an image) is created/modified, and `require.context` invalidation is handled as a special case in DeltaBundler. Reviewed By: robhogan Differential Revision: D42442272 fbshipit-source-id: 12a57bb669791043755c39ac10a284e11678044e
Configuration menu - View commit details
-
Copy full SHA for c6e1990 - Browse repository at this point
Copy the full SHA c6e1990View commit details
Commits on Jan 13, 2023
-
Break up
InternalData
intoFileData
+RawModuleMap
(1/2)Summary: In order to efficiently look up symlinks, we need a more complex structure than a simple `Map` to represent known files. The plan is to: 1. Separate manipulation of the `files` Map from (Haste) `ModuleMap` data. 2. Move access to (and more importantly, mutation of) the `files` map into the `HasteFS` class, implementing a `MutableFileSystem extends FileSystem` interface. 3. Add an alternative `TreeFS` implementation of this interface, with an internal prefix-tree data structure, that we'll use when symlinks are enabled. 4. If and when we have proven reliability and performance parity, remove `HasteFS`. (Note that this also opens up the possibility of a "`LazyFS`" implementation, although for the moment the API will be synchronous) This diff is the first part of that change - split the use of `InternalData`, which is essentially the raw data as read and written from the cache, into two objects - `FileData` and `RawModuleMap` (pre-existing types). Introduce `CacheData` to represent the combination of the two, which is now used only by cache APIs. In the following diff, we'll replace the passing of `FileData` with an instance of `MutableFileSystem`. Point of interest: I think this files/Haste separation is also what Christoph had in mind jestjs/jest#1427. Changelog: [Internal] Reviewed By: jacdebug Differential Revision: D42303308 fbshipit-source-id: a3fa34311818ca3a0214687e6895e0bd2ba6c7b3
Configuration menu - View commit details
-
Copy full SHA for ef9af83 - Browse repository at this point
Copy the full SHA ef9af83View commit details
Commits on Jan 15, 2023
-
Mutate FileData through
MutableFileSystem
interface (2/2)Summary: In order to efficiently look up symlinks, we need a more complex structure than a simple `Map` to represent known files. The plan is to: 1. Separate manipulation of the `files` Map from (Haste) `ModuleMap` data. (D42303308 (ef9af83)) 2. Move access to (and more importantly, mutation of) the `files` map into the `HasteFS` class, implementing a `MutableFileSystem extends FileSystem` interface. 3. Add an alternative `TreeFS` implementation of this interface, with an internal prefix-tree data structure, that we'll use when symlinks are enabled. 4. If and when we have proven reliability and performance parity, remove `HasteFS`. This diff is part 2 - we introduce a new `MutableFileSystem` interface with APIs equivalent to the previous direct mutation of `FileData`, and encapsulate all mutation of the map (and everything in it) within `HasteFS`. ## Startup performance Since we're introducing more indirection on some hot startup paths, we need to ensure there's no noticeable perf hit. The figures in the test plan are single samples but they are consistent over multiple runs - this diff took a few draft iterations to get the speed almost up to the level of raw map manipulation. The key turned out to be minimising path normalisation, since `HasteFS` previously expected absolute paths for all of its APIs and had to normalise everything - it now accepts absolute or relative paths, and has shortcuts for fully normalised relative paths. The `bulkAddOrRemove` API takes `FileData` objects (implicitly pre-normalised, relative paths) and is therefore able to process much faster than multiple calls to `addOrRemove`. Reviewed By: huntie Differential Revision: D42344528 fbshipit-source-id: a47651154e18acb3490bb5158c40f88c2e365b8a
Configuration menu - View commit details
-
Copy full SHA for 0aa87d2 - Browse repository at this point
Copy the full SHA 0aa87d2View commit details
Commits on Jan 16, 2023
-
Emit file type of changed file even on deletion
Summary: We introduced `ChangeEventMetadata` in D41494003 (5d4e7cc) as a direct replacement for `fs.Stat` - inheriting the expectation that it would be present iff the event describes a new/changed file. Now that we can (theoretically) emit events referring to symlinks, the consumer may (will) need to distinguish regular files from links - including for deletion events. This diff changes things around so that `ChangeEventMetadata` is *always* present for all event types, but some of its properties are no longer guaranteed. Changelog: [Internal] Reviewed By: motiz88 Differential Revision: D42454102 fbshipit-source-id: f930d53bded995ac68d45b409fd4b67be284824c
Configuration menu - View commit details
-
Copy full SHA for bdeb55b - Browse repository at this point
Copy the full SHA bdeb55bView commit details
Commits on Jan 17, 2023
-
Remove blog content from website
Summary: - Remove long-outdated blog article from website (`/blog` was previously removed from nav) — we will use the React Native blog for future posts! - Replace blog link on Help page ("Stay up to date") with link to releases. - Remove unused `i18n/en.json` file. Reviewed By: jacdebug Differential Revision: D42536010 fbshipit-source-id: 750098ec14c708338e622cb11ea5c48bcd7b79b9
Configuration menu - View commit details
-
Copy full SHA for 64c0597 - Browse repository at this point
Copy the full SHA 64c0597View commit details -
Reviewed By: motiz88 Differential Revision: D42533126 fbshipit-source-id: 3c9a03d17e92b341e1373c26d10d338385634b1b
Configuration menu - View commit details
-
Copy full SHA for 311fd86 - Browse repository at this point
Copy the full SHA 311fd86View commit details -
Add experimental package exports config options
Summary: Add new experimental/unstable config options which will be used by incoming package exports support. Changelog: **[Experimental]** Add `resolver.unstable_enablePackageExports` config option Reviewed By: motiz88 Differential Revision: D42531005 fbshipit-source-id: a73500523a96106d1551d8796996551f32321cdd
Configuration menu - View commit details
-
Copy full SHA for 5c6897e - Browse repository at this point
Copy the full SHA 5c6897eView commit details
Commits on Jan 18, 2023
-
Pre-suppress errors ahead of 0.197.0 release
Summary: Changelog: [internal] Reviewed By: mroch Differential Revision: D42558696 fbshipit-source-id: 3367fb1233c9630bd31b0ae9950f7b2f13438057
Configuration menu - View commit details
-
Copy full SHA for bdeff42 - Browse repository at this point
Copy the full SHA bdeff42View commit details -
automatic update for docusaurus-plugin-internaldocs-fb@1.4.0
Reviewed By: lblasa Differential Revision: D42547166 fbshipit-source-id: c51d95670c19a4d152066e4d61bd9dd3d905e2ad
Configuration menu - View commit details
-
Copy full SHA for 20920b0 - Browse repository at this point
Copy the full SHA 20920b0View commit details -
Refactor
metro-file-map
workerSummary: Currently, `metro-file-map`'s worker exports a `worker` and a `getSha1` method, which have identical signatures but different behaviour. `worker` could be used for everything, except that it differs from `getSha1` in the following ways: - `worker` will check whether the file is a `package.json`, and if not, whether it passes a Haste / `computeDependencies` exclusion list *even if there's no work to be done*. - `worker` will re-use a memoised `hasteImpl` even if `hasteImplModulePath` is not given. - `worker` is not able to calculate the sha1 of binary files, because it reads contents in `utf8`. This diff changes things around a bit so that we can consolidate on the one `worker` export - the motivation primarily being to bring in symlink support without adding new code paths in several places. - Move lazy loading of `hasteImpl` to where it's required, and use it only if `hasteImplModulePath` is non-null. - Have `getContent` return a `Buffer` and decode it where necessary. - Don't parse a `package.json` as a Haste package unless new option `enableHastePackages = true`. - Don't check `exclusionList` (now `excludedExtensions`) unless there's something to do if the check passes. All this means we can delete `getSha1` and the `worker` can cover all of our needs - so we'll only have one place to add symlink target reads in the next diff. Changelog: [Internal] Reviewed By: jacdebug Differential Revision: D42537300 fbshipit-source-id: 31faa076c3e7fc6ddf9c3e6a906b0f0796a1be51
Configuration menu - View commit details
-
Copy full SHA for 51df674 - Browse repository at this point
Copy the full SHA 51df674View commit details -
Gather symlink targets on crawl/change processing
Summary: The groundwork has been done to store symlink targets in `metro-file-map`'s in-memory (and persisted) map, but we're not yet reading link targets. This diff adds a `readLink` worker option and sets it when appropriate within `_processFile`, and delegates to the worker for consistency with other operations that require a "visit" to gather metadata subsequent to a crawl result or change event. Symlink targets will then be stored for all symlinks in the cache, and we'll avoid any IO if their modification time doesn't change. Changelog: [Internal] Reviewed By: motiz88 Differential Revision: D42546808 fbshipit-source-id: 5c9737971f50dc90ade43f709ef896124023203e
Configuration menu - View commit details
-
Copy full SHA for 5ae4b0d - Browse repository at this point
Copy the full SHA 5ae4b0dView commit details -
Add
resolver.unstable_enableSymlinks
and remove symlinks+watchman r……estriction Summary: **Note: this change does not mean that symlinks are respected by the resolver (yet)!** Add `resolver.unstable_enableSymlinks` (default: `false`) option to Metro config, and pass it though to the existing `enableSymlinks` option in `metro-file-map`. At this point this is purely for ease of testing end-to-end behaviour as we incrementally change Fast Refresh and resolution to cope with symlinks. Removes the Jest-inherited prohibition on using `enableSymlinks` with `useWatchman`, which is no longer necessary or relevant to the new implementation. **Bikeshed: Why under `resolver`?** Symlink support is mostly relevant to the resolver, in that if the resolver resolves to a file through a link, that fact is transparent to the rest of Metro. Third-party solutions for symlink-based projects have focused on the resolver. The fact that 90% of the work for this solution is within `metro-file-map` is an implementation detail of in-memory resolution. That said, we'll have an opportunity to revisit this when the config is promoted from `unstable_` Changlog: [Experimental] - Add `resolver.unstable_enableSymlinks` config for first phase of symlink support. Reviewed By: jacdebug Differential Revision: D42552674 fbshipit-source-id: a6cfe38973b2a484af85f4a11274c4073710a883
Configuration menu - View commit details
-
Copy full SHA for ed55455 - Browse repository at this point
Copy the full SHA ed55455View commit details -
Update Jest type definitions to v29
Summary: @public Changelog: [Internal] TSIA Reviewed By: jacdebug Differential Revision: D42570767 fbshipit-source-id: 26deffc1a749ed9403a71dcef64db02d0bf652e8
Configuration menu - View commit details
-
Copy full SHA for 1d51ffd - Browse repository at this point
Copy the full SHA 1d51ffdView commit details
Commits on Jan 19, 2023
-
Summary: Bump Metro packages to 0.74.1 Reviewed By: huntie Differential Revision: D42610594 fbshipit-source-id: f9e105bdcc9415a78d6e729af9e4d31c70a961f2
Configuration menu - View commit details
-
Copy full SHA for c438dd0 - Browse repository at this point
Copy the full SHA c438dd0View commit details
There are no files selected for viewing