-
Notifications
You must be signed in to change notification settings - Fork 221
[TBD] feat(nf): Use es-module-shims during initFederation and loadRemoteModule to ensure having latest importMap #513
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
Closed
jogelin
wants to merge
19
commits into
angular-architects:main
from
jogelin:es-module-shims-usage-during-init
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
faf5f94
fix(nf): properly handle outputPath object
wszydlak d36e63c
Write actual contents, not text representation
FlorianRappl 2c687f1
fix(nf): Inject `importmap-shim` to the `<head>` instead of the end o…
jogelin 40849a5
feat(nf): Add `esmsInitOptions` to Angular builder to inject addition…
jogelin 7a4b3af
fix(nf): Remove orphans `</scripts>` tags after `updateScriptTags`
jogelin 7edb1f1
Merge pull request #498 from jogelin/add-builder-esms-init-options
manfredsteyer 9897a1f
Merge pull request #499 from jogelin/inject-importmap-to-head
manfredsteyer 3ee67ba
Merge pull request #500 from jogelin/fix-orphan-close-script-tags
manfredsteyer 3410927
Merge pull request #481 from FlorianRappl/patch-1
manfredsteyer 775db9d
Merge pull request #455 from wszydlak/patch-2
manfredsteyer 4eaa04e
fix(dep): fix peer dependency `browser-sync` not aligned with root de…
jogelin f95cee8
fix(test): fix jest tests
jogelin de0b92f
fix(lint): fix linting
jogelin bbaf18c
ci: init Github actions config file
jogelin d6998ba
Merge pull request #503 from jogelin/fix-npm-install-peer-dep-conflict
manfredsteyer 041d478
Merge pull request #504 from jogelin/fix-tests
manfredsteyer 8fc5f7e
Merge pull request #505 from jogelin/fix-linting
manfredsteyer 1c88a77
Merge pull request #506 from jogelin/init-github-action-config
manfredsteyer b74451f
feat(nf): Use es-module-shims during initFederation and loadRemoteMod…
jogelin 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
actions: read | ||
contents: read | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
- run: npm ci | ||
- uses: nrwl/nx-set-shas@v3 | ||
# This line is needed for nx affected to work when CI is running on a PR | ||
- run: git branch --track main origin/main | ||
|
||
- run: npx nx format:check | ||
- run: npx nx affected -t lint,test,build |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,6 @@ describe('playground', () => { | |
cy.login('[email protected]', 'myPassword'); | ||
|
||
// Function helper example, see `../support/app.po.ts` file | ||
getGreeting().contains('Welcome to playground!'); | ||
getGreeting().contains('Hello Native Federation!'); | ||
}); | ||
}); |
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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
type BootAsyncSchema = {}; | ||
type BootAsyncSchema = object; |
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
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
2 changes: 1 addition & 1 deletion
2
libs/native-federation-core/src/lib/config/with-native-federation.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
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
17 changes: 12 additions & 5 deletions
17
libs/native-federation-core/src/lib/core/write-import-map.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 |
---|---|---|
@@ -1,20 +1,27 @@ | ||
import * as path from 'path'; | ||
import * as fs from 'fs'; | ||
import { SharedInfo } from '@softarc/native-federation-runtime'; | ||
import { FederationInfo } from '@softarc/native-federation-runtime'; | ||
import { FederationOptions } from './federation-options'; | ||
|
||
export function writeImportMap( | ||
sharedInfo: SharedInfo[], | ||
{ name, shared, exposes }: FederationInfo, | ||
fedOption: FederationOptions | ||
) { | ||
const imports = sharedInfo.reduce((acc, cur) => { | ||
const sharedImports = shared.reduce((acc, cur) => { | ||
return { | ||
...acc, | ||
[cur.packageName]: cur.outFileName, | ||
[cur.packageName]: `./${cur.outFileName}`, | ||
}; | ||
}, {}); | ||
|
||
const importMap = { imports }; | ||
const exposesImports = exposes.reduce((acc, cur) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not process host during
|
||
return { | ||
...acc, | ||
[`${name}/${cur.key}`]: `./${cur.outFileName}`, | ||
}; | ||
}, {}); | ||
|
||
const importMap = { imports: { ...sharedImports, ...exposesImports } }; | ||
const importMapPath = path.join( | ||
fedOption.workspaceRoot, | ||
fedOption.outputPath, | ||
|
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.
Do not process host during
initFederation
During the build, an
importmap.json
is already generated.I just adapted the code to apply the same modifications done by the deleted
processHostInfo