-
-
Notifications
You must be signed in to change notification settings - Fork 392
Metro windows path resolution #4442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ScriptedAlchemy
wants to merge
23
commits into
main
Choose a base branch
from
cursor/metro-windows-path-resolution-47f0
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
a1dae1f
fix(metro-core): escape babel transformer path
cursoragent 8735d3d
chore(metro-core): format babel transformer test
cursoragent b0199b3
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 2f2db1e
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy a581c6d
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 95fd501
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 2b12b3b
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy fe538e7
fix(metro-core): align test target and memfs usage
ScriptedAlchemy 0ae9ec4
Merge remote-tracking branch 'origin/main' into cursor/metro-windows-…
ScriptedAlchemy ac39b69
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 750cc90
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy b8f4ac3
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 739bbe5
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 7533d8b
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 50b4759
fix(metro-core): add missing dts in plugin test config
ScriptedAlchemy 6cb430c
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 5c88fdc
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy e2152c0
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 88af643
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 3814913
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 0526242
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 25e2e7d
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy 6b3bd5b
Merge branch 'main' into cursor/metro-windows-path-resolution-47f0
ScriptedAlchemy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
39 changes: 39 additions & 0 deletions
39
packages/metro-core/src/plugin/__tests__/babel-transformer.test.ts
This file contains hidden or 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,39 @@ | ||
| import fs from 'node:fs'; | ||
| import os from 'node:os'; | ||
| import path from 'node:path'; | ||
| import { createBabelTransformer } from '../babel-transformer'; | ||
| import type { ModuleFederationConfigNormalized } from '../../types'; | ||
|
|
||
| function createConfig(): ModuleFederationConfigNormalized { | ||
| return { | ||
| name: 'test-app', | ||
| filename: 'remote.js', | ||
| remotes: {}, | ||
| exposes: {}, | ||
| shared: {}, | ||
| shareStrategy: 'loaded-first', | ||
| plugins: [], | ||
| }; | ||
| } | ||
|
|
||
| describe('createBabelTransformer', () => { | ||
| it('escapes Windows paths for require()', () => { | ||
| const tmpDirPath = fs.mkdtempSync(path.join(os.tmpdir(), 'mf-metro-')); | ||
|
||
| const windowsPath = | ||
| 'C:\\Users\\someone\\project\\node_modules\\metro-babel-transformer\\src\\index.js'; | ||
|
|
||
| const outputPath = createBabelTransformer({ | ||
| blacklistedPaths: [], | ||
| federationConfig: createConfig(), | ||
| originalBabelTransformerPath: windowsPath, | ||
| tmpDirPath, | ||
| enableInitializeCorePatching: false, | ||
| enableRuntimeRequirePatching: false, | ||
| }); | ||
|
|
||
| const output = fs.readFileSync(outputPath, 'utf-8'); | ||
| expect(output).toContain(`require(${JSON.stringify(windowsPath)})`); | ||
|
|
||
| fs.rmSync(tmpDirPath, { recursive: true, force: true }); | ||
| }); | ||
| }); | ||
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs aligning with main, uses vitest now