Skip to content
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

fix: resolve backmerge issues #871

Merged
merged 33 commits into from
May 13, 2023

Conversation

ScriptedAlchemy
Copy link
Member

No description provided.

makes next async at startup. Effectively resolving any and all support issues.
* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code
likely can remove whole plugin in future
# Conflicts:
#	package-lock.json
#	package.json
#	packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

const runtimeRequirementsInChunk =
compilation.chunkGraph.getChunkRuntimeRequirements(chunk);

chunk.files.forEach((file) => {
const asset = compilation.getAsset(file);
if (asset) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit difficult to understand the context and purpose of the code given only the code patch, but here are some general suggestions:

  • The use of //@ts-ignore should be avoided if possible. It's better to fix the TypeScript type errors instead of suppressing them.
  • The condition if (eagerModulesInRemote) can cause a bug because getChunkModulesIterableBySourceType returns an iterator even if there are no modules of the given source type. So this condition will always be true, even if there are no eager modules in the chunk. Instead, you should check if the iterator is empty using the .next() method.
  • The variables chunkModules and runtimeRequirementsInChunk are not used and can be removed if they're not needed for other parts of the code.

Without more context about the purpose of the code, it's hard to suggest further improvements or identify potential bugs.

# Conflicts:
#	package-lock.json
#	package.json
#	packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts
@@ -7,7 +7,7 @@ import Router, { useRouter } from 'next/router';
import SharedNav from '../components/SharedNav';
import HostAppMenu from '../components/menu';
import 'antd/dist/antd.css';

console.log(__webpack_share_scopes__);
function MyApp(props) {
const { Component, pageProps } = props;
const { asPath } = useRouter();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the code patch does not make any changes to the functionality of the MyApp component, but only adds a console log statement to print the contents of the __webpack_share_scopes__ object.

As such, it doesn't introduce any bugs or risks in the existing codebase.

In terms of improvement suggestion, it is best practice to remove any debug logs like the console.log() statement from production code, as they can be a potential security risk and slow down the performance of the application. So it would be good to remove that line of code or wrap it inside a condition for development mode only.


const runtimeRequirementsInChunk =
compilation.chunkGraph.getChunkRuntimeRequirements(chunk);

chunk.files.forEach((file) => {
const asset = compilation.getAsset(file);
if (asset) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code patch you provided appears to be incomplete as it contains only a portion of the source code. Therefore, it is difficult to review comprehensively.
However, from this section of the code, one suggestion would be to use Array.from on eagerModulesInRemote, so that it ensures eagerModulesInRemote is an array before iterating over it with a loop. Otherwise the loop may not work correctly when eagerModulesInRemote is null or undefined.
For example:

const eagerModulesInRemote = Array.from(compilation.chunkGraph.getChunkModulesIterableBySourceType(
  chunk,
  'provide-module'
));

Additionally, further context on what the code is trying to achieve may help with offering more suggestions for improvement.

acc[key] = { ...value, eager: false, import: undefined };

acc[key] = { ...value, import: undefined };
// @ts-ignore
return acc;
}, {} as SharedObject);

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code patch seems to be updating the DEFAULT_SHARE_SCOPE and DEFAULT_SHARE_SCOPE_BROWSER objects with changes to their respective properties.

In terms of improvements, it would be helpful to provide more context about the purpose of these objects and their usage in the codebase. Additionally, it is difficult to determine if there are any bug risks without understanding the broader codebase and how these objects are being used.

@ScriptedAlchemy ScriptedAlchemy merged commit 00da7c8 into kill_child_compilers May 13, 2023
@ScriptedAlchemy ScriptedAlchemy deleted the fix_backmerge_issues branch May 13, 2023 02:09
ScriptedAlchemy added a commit that referenced this pull request Jul 1, 2023
* chore(node): release version 0.14.1-beta.0

* chore(node): release version 0.14.1

* chore(nextjs-mf): release version 6.4.1-beta.0

* fix: use [fullhash] if no hash exists / in development mode.

contenthash runtime module seems to be missing in server containers

* Update dependabot.yml

* revert dependabot change

* chore(node): release version 0.14.2-beta.0

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2-beta.2

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2

* chore(nextjs-mf): release version 6.4.1-beta.1

* update plugins

* fix: disable next chunk splits

* chore(nextjs-mf): release version 6.4.1-beta.2

* chore: fix package imports

* update plugins

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* chore: update locks

* chore(utils): release version 1.7.2-beta.0

* chore(utils): release version 1.7.2

* chore(node): release version 0.14.3-beta.0

* chore(node): release version 0.14.3

* chore(nextjs-mf): release version 6.4.1-beta.3

* chore: update nx

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* feat: [v7] Async boundary runtime (#835)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* chore: fix project.json

* debugging

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

# Conflicts:
#	package-lock.json
#	package.json
#	packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* fix: resolve backmerge issues (#871)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

# Conflicts:
#	package-lock.json
#	package.json
#	packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* ci: fix install step with npm and NX

* test: remove tests for now

* chore(utils): release version 1.7.3-beta.0

* chore(utils): release version 1.7.3

* chore(node): release version 0.14.4-beta.0

* chore(node): release version 0.14.4

* chore(nextjs-mf): release version 6.4.1-beta.4

* fix: remove debugging runtime variable

* chore(nextjs-mf): release version 6.4.1-beta.5

* feat: Quantum Modules (#872)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* locks

* chore(node): release version 0.14.5-beta.0

* chore(node): release version 0.14.5

* chore(nextjs-mf): release version 6.4.1-beta.6

* chore: lock file

* fix: ensure eager modules always exist in host (inject dependent modules somewhere in build pipeline)

* DX: Add GPT module and command-line interface (#875)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* chore: adding AI commit helper

* chore: adding AI commit helper

* chore: adding AI commit helper

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* Add functionality to generate and commit markdown-formatted commit messages

This commit adds a new functionality to generate and commit markdown-formatted commit messages. The commit message generation is handled by OpenAI's GPT-3 and the markdown formatting is handled by the  library. The commit message generator prompts the user for a title and description of the changes made, as well as a list of files and their changes. The user is then given the option to accept or reject the generated commit message. If accepted, the commit is automatically made with the generated message.

### gpt.js

- Added  and  functions from  to encode the commit message prompt for OpenAI's GPT-3
- Added the  module from  to render markdown in the terminal
- Added a function  to generate the commit message prompt and display the changes made to each file
- Refactored the  function to use the  function and encode the prompt using  and
- Added error handling for missing  environment variable
- Refactored the  function to create a more readable markdown message
- Added a function  to commit the changes using
- Modified the  function to check if there are any changes to commit before running
- Modified the  function to use the  function to commit the changes if the user accepts the generated commit message
- Added a call to  to render the generated commit message in the terminal

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:\n- Added 'OpenAIStream.js'\n- Added 'ai.js'\n- Added 'commit.js'\n- Added 'file.js'\n- Added 'generate.js'\n- Moved 'gpt.js' to 'gpt/gpt.js'\n- Added 'index.js'\n- Added 'markdown.js'\n- Added 'pull-request.js'\n\nThe 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.\n\n### OpenAIStream.js\n\n- Added file 'OpenAIStream.js'\n\n### ai.js\n\n- Added file 'ai.js'\n\n### commit.js\n\n- Added file 'commit.js'\n\n### file.js\n\n- Added file 'file.js'\n\n### generate.js\n\n- Added file 'generate.js'\n\n### gpt.js\n\n- Moved 'gpt.js' to 'gpt/gpt.js'\n\n### index.js\n\n- Added file 'index.js'\n- Implemented command-line interface with options '--pr' and '--commit'\n\n### markdown.js\n\n- Added file 'markdown.js'\n\n### pull-request.js\n\n- Added file 'pull-request.js'

* Add function for sending prompt to GPT model and exposing utilities as module exports, we did.

Add a new function called sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback. Also, expose the utilities readline and chatHistory as module exports, we did.\n\n### gpt/ai.js\n\n- Add function sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback, we did.\n- Expose readline and chatHistory as module exports, we did.

* Add generative commit message capability using GPT-3 model

This commit adds the ability to generate a commit message for code changes using the GPT-3 model. The message is generated from a diff of the staged files, and includes a title, description, and change set for each file. If the diff is too long, it is truncated. If there are no files staged for commit, an error message is displayed. The message is displayed as markdown and can be accepted or rejected by the user. If rejected, a new message is generated with user feedback.\n\n### gpt/ai.js\n\n- Changed the sendPromptToGPT function to allow an optional feedback param that can be used to include user feedback in the prompt when one is not already present.\n- Added usage logs in the sendPromptToGPT function.\n- Added a yargs check for the message passed in as a command argument.\n- Altered the returned content of the sendPromptToGPT function to be the entire output stream.\n- Added readline module and chatHistory array to the exports of the module.\n\n### gpt/commit.js\n\n- Added functions createPrompt, getValidJsonResponse, generateCommitMsg, createMarkdownCommit, and gitCommit to the module exports.\n- Added a schema constant as a stringified JSON object to be used as a guide for the JSON responses to prompts.\n- Created createPrompt function to generate the prompt for the GPT-3 model, given a string input and a feedback string.\n- Created getValidJsonResponse function to handle JSON parsing errors from the GPT-3 response, and returns a correctly formatted response.\n- Created generateCommitMsg function to retrieve a commit message object from the GPT-3 model, given staged changes and optional user feedback.\n- Created createMarkdownCommit function to format the commit message object as a markdown string.\n- Created gitCommit function to execute a git commit command with provided title and body as messages.\n- Created runGenerativeCommit function to orchestrate prompting the user and executing the git commit command.

* Add OpenAIStream function and configure markdown

This commit adds an  function for streaming API and also configures  to use  as the renderer.\n\n### gpt/OpenAIStream.js\n\n- Added  function to consume OpenAI's chat API over stream, parsing the stream into multiple chunks and invoking an event for each SSE event stream.\n- Provided a callback to call with the chunk of text returned from the API.\n\n### gpt/markdown.js\n\n- Configured  to use  as the renderer.\n- Defined custom renderer to colorize headings using  package.

* Add function to generate markdown summary of commit messages

This commit adds a new function called createLogMarkdownPrompt that creates prompts for the AI to summarize commits as markdown. It also adds a function called createMarkdownSummary that takes in an AI generated summary of commits and returns a markdown formatted summary. Lastly, it adds a generatePullRequestSummary function that takes user feedback, calls the createLogMarkdownPrompt function to create a prompt for the AI, sends it to the AI for processing, then formats and returns the summary using the createMarkdownSummary function.\n\n### gpt/pull-request.js\n\n- Added function called createLogMarkdownPrompt to create prompts for the AI to summarize commits as markdown\n- Added function called createMarkdownSummary to take in an AI generated summary of commits and return a markdown formatted summary\n- Added generatePullRequestSummary function to takes user feedback, call the createLogMarkdownPrompt function to create a prompt for the AI, send it to the AI for processing, then format and return the summary using the createMarkdownSummary function

* Refactor gitCommit function to use commandJoin

Refactored the gitCommit function to use the `commandJoin` package to create the git command. This replaces the need for string interpolation and manual escaping. Also removed unnecessary console.log statement.

### gpt/commit.js

- Updated gitCommit function to use commandJoin package
- Replaced string interpolation and manual escaping with `commandJoin` package. Removed unnecessary console log.

* Add GPT-3 stream handler

This commit adds a new handler function to stream chat messages to GPT-3. It also includes the necessary helper functions to prepare the input and output data for the API call.

### gpt/generate.js

- Added `getMessagesPrompt`, `readChunks`, and `readChunksBlocking` functions to enable streaming the message history to GPT-3.
- Added `handler` function as the main entry point for streaming chat messages to GPT-3.
- Exposed the `chatHistory` Set object to keep track of chat messages.

* Improve message generation in gpt/generate.js

This commit includes changes in gpt/generate.js file, improving the message generation's quality. It also adds some additional language to help the user feel more relaxed during conversations.

### gpt/generate.js

- Removed unnecessary pre_prompt variable.
- Improved getMessagesPrompt function to provide better suggestions for starting the conversation and to make the language more natural for the user.
- Refactored getMessagesPrompt function to include the role of the message.
- Replaced hardcoded strings with variables for better maintainability.

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:
- Added 'OpenAIStream.js'
- Added 'ai.js'
- Added 'commit.js'
- Added 'file.js'
- Added 'generate.js'
- Moved 'gpt.js' to 'gpt/gpt.js'
- Added 'index.js'
- Added 'markdown.js'
- Added 'pull-request.js'

The 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.

### OpenAIStream.js

- Added file 'OpenAIStream.js'

### ai.js

- Added file 'ai.js'

### commit.js

- Added file 'commit.js'

### file.js

- Added file 'file.js'

### generate.js

- Added file 'generate.js'

### gpt.js

- Moved 'gpt.js' to 'gpt/gpt.js'

### index.js

- Added file 'index.js'
- Implemented command-line interface with options '--pr' and '--commit'

### markdown.js

- Added file 'markdown.js'

### pull-request.js

- Added file 'pull-request.js'

* Remove simple-git package and fix commit script

This commit removes the simple-git package by removing its dependency and all of its references from the code. The commit message fix script has also been modified to exclude simple-git commits. The fixCommitMessages function was updated to remove calls to simple-git related functions.

### package.json

- Removed "simple-git" from devDependencies

### package-lock.json

- Removed simple-git reference

### fixcommit.js

- Removed simple-git import and function calls

* Improve commit message generation and add file processing features

This commit includes an enhancement to the existing commit message generation functionality and introduces new utility functions related to file processing.

### gpt/commit.js

- Refactor getValidJsonResponse function by adding try-catch block for JSON parsing

- Add logic for handling truncated JSON responses by following up with GPT-3 model

- Remove unused debugger statement

### gpt/file.js

- Add new file processing utility functions: uploadFile, getFileStatus, and useFileInCompletion

- Implement main function for running file processing tasks

### gpt/get-answer-from-files.js

- Create new empty file for future implementation

### gpt/process-file.js

- Create new empty file for future implementation

### gpt/search-file-chunks.js

- Create new empty file for future implementation

* Refactor ai.js to update gpt stream, model and usage

This commit refactors the `ai.js` file to make several changes related to the GPT stream, the model used and its usage.

### gpt/ai.js

- Update the model in the encoding_for_model function call to use the 'model' variable instead of the hardcoded string 'gpt-3.5-turbo'

- Move the assignment of the gptStream and content variables after the usage console output

- Remove an unnecessary line of whitespace

* Add search functionality to file chunks

This commit adds search functionality to file chunks, allowing users to search through their files, find matches and display the results.

### gpt/pull-request.js

- Update code formatting in the response section of sendToGPTForSummary function and add a user feedback section if available.

### gpt/search-file-chunks.js

- Create a new file to implement search functionality for file chunks.

- Add a searchChunks function that takes searchQuery, files and maxResults as input and returns the search results using the searchFileChunks service.

* Refactor OpenAIStream and add constants file

This commit refactors the OpenAIStream.js file to simplify the code and improve readability. It also adds a new constants.js file.

### gpt/OpenAIStream.js

- Refactor the OpenAIStream function to use the completionStream function from the services/openai module

- Remove unnecessary imports and variables

- Simplify the for-await loop to directly call the onChunk callback with the received chunk

### gpt/constants.js

- Create a new constants.js file

* Refactor gpt/ai.js and add gpt/constants.js

This commit refactors the gpt/ai.js file and adds a new gpt/constants.js file to better organize the code and improve maintainability.

### gpt/ai.js

- Move MAX_CHAR_COUNT constant to gpt/constants.js

- Update imports to include constants and generate modules separately

- Remove unnecessary MAX_CHAR_COUNT export

### gpt/constants.js

- Create new constants.js file

- Add pre_prompt, chatHistory, model, MAX_FILES_LENGTH, MAX_TOKENS, showProgress, and MAX_CHAR_COUNT constants

* Refactor ai.js and update dependencies

This commit refactors the ai.js file, removing unnecessary imports and updating the way GPT-3 completions are fetched. It also updates the constants imported to reflect the changes.

### gpt/ai.js

- Remove unnecessary imports such as yargs, child_process, node-fetch, and others

- Update the import of completionStream from the services/openai module

- Replace the usage of streamGPT with the new completionStream function

- Remove the chatgptApiEndpoint and chatgptApiKey variables as they are no longer needed

- Update the import of MAX_TOKENS from the constants module

- Refactor the sendPromptToGPT function to use the new completionStream function

- Update the module.exports to only export sendPromptToGPT and readline

* Refactor and improve format consistency in commit.js

This commit introduces several modifications to commit.js, primarily focusing on refactoring the code, improving readability, and enhancing the format consistency of the generated commit messages.

### commit.js

- Refactor getValidJsonResponse function to use async generator

- Update createPrompt to use a more user-friendly format and include additional context

- Replace instances of 'readline' with 'rl', and enhance error handling

- Simplify generateCommitMsg by using the async generator getValidJsonResponse

- Remove commented-out code

- Improve error messages and logging throughout the file

- Adjust schema string for readability

* Code changes have been made, hmmmmmm.

In this commit, improvements we see. The generateCommitMsg function is refined and userFeedback parameter is gone. Diff precision adapts to character count. Read below, you must.

### gpt/commit.js

- UserFeedback parameter removed from generateCommitMsg function.

- Added a method to reduce the fidelity of the diff when exceeding max character count.

* Refactor commit.js and update dependencies

This commit refactors the commit.js file, updates package dependencies, and streamlines the code for better readability and maintainability.

### gpt/commit.js

- Refactor readline import for better consistency

- Update usage of readline to use the refactored import

- Remove redundant readline.createInterface()

- Refactor runGenerativeCommit() for better code readability and maintainability

- Remove unnecessary spacing between lines

### package.json

- Update yargs to latest version

- Update chalk to latest version

- Update tiktoken to latest version

* Refactor code and remove unused files

This commit performs several tasks in multiple files, including code refactoring for maintainability, improving time complexity, adding JSDoc comments, implementing optimizations, and removing unused code/files.

### gpt/OpenAIStream.js

- Delete this unused file

### gpt/ai.js

- Delete this unused file

### gpt/commit.js

- Add MAIN_BRANCH constant import from constants.js

### gpt/constants.js

- Refactor the model from 'gpt-3.5-turbo' to 'gpt-4'

- Add MAIN_BRANCH constant as 'quantum_modules'

- Update MAX_TOKENS constant value to 4500

### gpt/file.js

- Refactor and improve the entire file by implementing optimizations, adding JSDoc comments, improving time complexity, and making the code more maintainable

### gpt/generate.js

- Delete this unused file

### gpt/index.js

- Import generate from process-file.js instead of generate.js

* Added get-answer-from-files functionality and improved pull request summary

In this commit, we have added and updated four files in the GPT project, mainly focusing on creating a new get-answer-from-files feature and improving the pull-request.js file for better pull request summaries. Also, some new terminal commands are introduced for better user experience.

### get-answer-from-files.js

- Created a new file to handle getting answers from the files using the OpenAI completion stream.

- Implemented the getAnswer function which processes files' text and sends a chunked prompt to GPT completion stream for response.

### process-file.js

- Created a new file for processing files, extracting text and creating embeddings.

- Implemented processFile function that takes the file path and processes the file to extract text and embeddings.

### pull-request.js

- Refactored the sendToGPTForSummary function to improve the handling of GPT responses.

- Added a check for user feedback and updated the function to handle completion stream chunks better.

- Removed some commented out code and improved the overall code structure for better readability.

### terminal.js

- Created a new file for handling terminal commands and readline interface.

- Implemented the readline interface object for handling user input in the terminal.

* Refactor getValidJsonResponse and update dependencies

This commit refactors the getValidJsonResponse function to improve error handling and updates the dependencies in package.json.

### gpt/commit.js

- Refactor the getValidJsonResponse function for better error handling

- Move the stream creation and answer processing inside the try block

### gpt/constants.js

- Add filterStopwords constant with a default value of false

### package.json

- Add new script command 'gpt:file:example'

- Add new script command 'gpt:file'

- Update dependencies: stopword, mime-types, mammoth, pdf-parse, node-html-markdown, form-data

* Update GPT model and improve completion and error handling

This commit updates the GPT model to GPT-4, adjusts the maximum tokens, and adds better completion and error handling.

### gpt/constants.js

- Change GPT model to 'gpt-4'

- Increase MAX_TOKENS from 4500 to 4600

### gpt/file.js

- Uncomment 'throw err' for better error handling when processing files

### gpt/services/openai.js

- Create new openai.js file with updated completion methods and error handling

- Implement completionStream and embedding functions

- Add API key error checking

- Improve completion function with fallbacks

* Add services for text analysis and file search

Implemented multiple services for chunking large texts, creating embeddings, extracting text from different file formats, getting embeddings for text, and searching similar file chunks using cosine similarity.

### chunkText.js

- Added a function to split a given text into smaller pieces of roughly equal length without breaking words or punctuation.

### createEmbeddings.js

- Implemented a function to create embeddings of given text, calculate the average of embeddings and return both the mean embedding and the individual chunk embeddings.

### extractTextFromFile.js

- Added a function to extract text content from various file formats such as PDF, DOCX, Markdown, CSV, HTML, Plain Text, and JavaScript files.

### getEmbeddingsForText.js

- Added a function to get embeddings for a given text by splitting the text into chunks and computing the embeddings in batch sizes.

### searchFileChunks.js

- Implemented a function to search file chunks for those that are semantically similar to the search query using cosine similarity (dot product) and return the ranked results based on the similarity score.

* chore: lock file

* Add code generation & utility functions

This commit adds new code generation and utility functions to generate unit test code for a given Python function and description, search for the most semantically similar code chunks, and parse GPT responses.

### gpt/generateUnitTest.js

- Create generateUnitTest function to generate unit test code for given Python code and description

- Export generateUnitTest function

### gpt/services/utils.js

- Add searchFileChunks function to search semantically similar code chunks for given search query and files

- Add isFileNameInString function to check if a file name is part of a given string

- Add parseGptResponse function to parse GPT response text into separate code blocks

- Export all utility functions

### gpt/tests.js

- Add script to test generateUnitTest function using command line arguments

* Refactor code, add response constant and update function behavior

This commit refactors the code, adds a response constant, and updates the behavior of the generateCommitMsg and createPrompt functions. The changes improve code consistency and readability, also enhancing user context when generating new suggestions.

### gpt/commit.js

- Refactor the code to declare oldDiff as a constant

- Update the generateCommitMsg function to include the response constant

- Modify the createPrompt function to conditionally include user feedback in chat history

### gpt/services/openai.js

- Add the response constant in the completion, completionStream, and createChatCompletion functions

- Remove console.log statement to improve code cleanliness

* Improve constants, file handling, and answer retrieval

This commit includes multiple code improvements and adjustments in the project, focusing on constants.js, file.js, and get-answer-from-files.js files. Additionally, it updates the package.json script.

### constants.js

- Update value of MAX_TOKENS to Infinity.

- Set showProgress to true.

- Add response end marker in JSON format.

### file.js

- Replace hardcoded END_OF_RESPONSE with response end marker.

- Update prompt instructions for separating file sections.

- Add console log for chatHistory.

- Comment out unused code related to getLastItemInArray.

### get-answer-from-files.js

- Refactor getAnswer function to handle large files by splitting them into chunks.

- Create getAnswerFromStream function to handle individual chunks.

- Update response end marker check for errors.

- Add error handling and retry attempt in case response end marker is not found.

### pull-request.js

- Replace hardcoded END_OF_RESPONSE with response end marker.

### package.json

- Update script for gpt:file:example.

* Add cosine similarity threshold constant and multiple code improvements

This commit introduces a new constant for the cosine similarity threshold and improves the overall code for better readability and functionality.

### gpt/constants.js

- Add COSINE_SIM_THRESHOLD constant for cosine similarity score threshold

### gpt/file.js

- Update prompt string for better readability

- Add missing 'fs' module import

### gpt/get-answer-from-files.js

- Add 'model' constant from constants.js

- Add write stream to save the output to a file

- Pass question parameter to getAnswerFromStream function

### gpt/services/utils.js

- Move COSINE_SIM_THRESHOLD import to constants.js

- Remove file writing from parseGptResponse function

* Improved parsing of GPT responses and file handling

This commit improves the way GPT responses are parsed, file handling, and stream management, and refactors code in several files.

### gpt/file.js

- Changed the import statement for 'getAnswer' to use destructuring

- Removed an unnecessary console.log call

### gpt/get-answer-from-files.js

- Added 'fs' import for handling file streams

- Imported 'normalizedFileName' and 'parseGptResponse' functions from 'services/utils.js'

- Modified 'getAnswer' function to better handle chunks and splitting files

- Refactored 'getAnswerFromStream' function to create and manage write streams for each file

- Exported 'getAnswer' function using an object to make importing it easier with destructuring

### gpt/services/utils.js

- Refactored 'parseGptResponse' function to improve handling of incoming chunks and file parsing

- Added 'chunkAggregator' to accumulate chunks before parsing

- Improved verification of file names in strings

* chore: lock file

* chore: lock file

* Add training prompt/target pairs generation and improve prompts

This commit introduces code to generate prompt and target pairs, improve the prompts using the GPT-4 model and write the updated prompts to a jsonl file.

### gpt/training.js

- Add function generatePromptTargetPairs to iterate through the project directory and find code files with JSDoc comments

- Add function writeToJsonl to generate improved prompts and write the prompt/target pairs to a jsonl file

### package.json

- Add comment-parser dependency for parsing JSDoc comments

* chore: lock file

* chore: update locks

* DX: add GPT helper

* Remove unused and commented code from async-pages-loader

This commit is focused on cleaning up the async-pages-loader file by removing unused and commented code blocks. This helps improve readability and maintainability of the code.

### async-pages-loader.ts

- Remove multiple return statements with commented code

- Delete unnecessary import statements

- Remove unused code blocks related to routing and loading of modules

* DX: add GPT helper

* Fix production build issue caused by optimization stages

This commit fixes a production build issue that occurred due to optimization stages. It updates the hooks, chunks and module loading process to resolve the problem.

### packages/nextjs-mf/src/internal.ts

- Update DEFAULT_SHARE_SCOPE settings

### packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts

- Add import for 'react/jsx-runtime' to patch

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Refactor plugin to use updated hooks and optimization stages

- Update asset handling in processAssets hook

* Refactor loadScript and improve error handling

This commit refactors the loadScript function to create a new loadRemoteContainer function and improves error handling when loading a script fails.

### packages/utilities/src/utils/common.ts

- Refactor loadScript into loadScript and loadRemoteContainer for better separation of concerns

- Wrap asyncContainer in try-catch block for better error handling

- Create and return a fake container with a null factory when loading script fails

* Update scripts and apply server plugins

This commit updates the package.json scripts and modifies the applyServerPlugins function in the NextFederationPlugin.

### package.json

- Update 'start:nextho' script to use 'nx run-many' instead of 'concurrently' for better consistency with other scripts

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Add 'delete compiler.options.optimization.splitChunks' to remove splitChunks optimization from the server compiler

* chore(utils): release version 1.7.4

* chore(node): release version 0.14.6

* chore(nextjs-mf): release version 6.4.1-beta.7

* fix: Improved Share Scope Properties and Fixed Production Build Issues (#884)

* chore(nextjs-mf): release version 6.4.1-beta.8

* thing

* fix: fixed production build issues

* fix: Prevent removal of external eager modules

This commit prevents the removal of eager modules that are external, improves the code by removing an unnecessary condition, and refactors test patterns for better readability.

### next-fragments.ts

- Removed unnecessary condition checking 'compiler.options.name === 'client' || true'

- Refactored 'test' patterns for better readability

### RemoveEagerModulesFromRuntimePlugin.ts

- Prevented removal of external eager modules

* chore: update packscript

* Update default share scope properties

This commit updates the DEFAULT_SHARE_SCOPE and DEFAULT_SHARE_SCOPE_BROWSER objects in the internal.ts file. Modifications include setting the eager property for some shared dependencies and using direct reference instead of cloning the DEFAULT_SHARE_SCOPE object.

### packages/nextjs-mf/src/internal.ts

- Set eager property for 'react-dom' to false in DEFAULT_SHARE_SCOPE

- Change import property order for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

- Remove JSON clone process and use a direct reference of DEFAULT_SHARE_SCOPE in building DEFAULT_SHARE_SCOPE_BROWSER

- Set eager property to true for 'react', 'react-dom', and 'next/router' in DEFAULT_SHARE_SCOPE_BROWSER

* Fix incorrect string in if condition

This commit fixes an issue in the patchDefaultSharedLoader.ts file where the if condition check was using an incorrect string, which could result in skipping the intended patching process.

### packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts

- Update the string in the if condition check from 'placeholderModuleEnsurepat' to 'placeholderModuleEnsure'

* Refactor loadScript and improve error handling

This commit refactors the loadScript function and improves error handling for offline containers. It also fixes type casting issues in the code.

### packages/utilities/src/utils/common.ts

- Fix type casting for remoteGlobal and containerKey

- Enable console.error statement for error logging when catching errors

- Refactor the loadScript function to improve readability and error handling

* chore: remove logs

* Refactor InvertedContainerRuntimeModule and remove console logs

This commit refactors the InvertedContainerRuntimeModule class and removes unnecessary console logs.

### InvertedContainerRuntimeModule.ts

- Refactor class code for improved readability

- Remove unnecessary console logs

* chore(utils): release version 1.7.5-beta.0

* chore(utils): release version 1.7.5

* chore(node): release version 0.14.7-beta.0

* chore(utils): release version 1.7.6-beta.0

* chore(node): release version 0.14.7-beta.1

* chore(nextjs-mf): release version 6.4.1-beta.8

* chore(utils): release version 1.7.6-beta.1

* chore(node): release version 0.14.7-beta.2

* chore(nextjs-mf): release version 6.4.1-beta.8

* fix: remove old files

* chore(utils): release version 1.7.6-beta.2

* chore(node): release version 0.14.7-beta.3

* chore(nextjs-mf): release version 6.4.1-beta.8

* feat: remove entry injection

* chore(utils): release version 1.7.6-rc.0

* chore(node): release version 0.14.7-rc.0

* chore(nextjs-mf): release version 6.4.1-rc.0

* chore: back to beta tag

* update locks

* update locks

* fix(chunk-module-duplication): prevent runtime reset and share scope loss

This commit fixes the issue of chunk and module duplication that leads to runtime resetting or losing share scope.

### packages/nextjs-mf/src/internal.ts

- Changed 'eager' value of 'next/router' to false

### packages/nextjs-mf/src/noop.js

- Created new noop.js file

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Changed 'debug' value to false

### packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts

- Added new './noop' key-value pair in exposes

- Updated comment regarding remote entry requirement

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Added check for chunk.hasRuntime()

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- Added rootOutputDir variable assignment

* refactor: Next.js Micro-Frontends code improvements

This commit covers code improvements for Next.js Micro-Frontends including JSONP chunk loading, page stitching and runtime optimizations.

### gpt/commit.js

- Changed title structure in JSON format

### packages/nextjs-mf/src/internal.ts

- Changed eager value in DEFAULT_SHARE_SCOPE

### packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts

- Reordered imports and added conditional for development environment

### packages/nextjs-mf/src/plugins/AddModulesToRuntime.js

- Deleted unused file

### packages/nextjs-mf/src/plugins/JsonpChunkLoading.ts

- Refactored getCustomJsonpCode function

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-client-plugins.ts

- Replaced AddModulesPlugin with DelegateModulesPlugin

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Removed AddModulesPlugin and applied DelegatesModulePlugin

* chore(utils): release version 1.7.6-rc.1

* chore(node): release version 0.14.7-rc.1

* chore(nextjs-mf): release version 6.4.1-rc.1

* update locks

* refactor(apply-server-plugins): Update server plugin configurations and package.json exports

This commit updates the server plugin configurations in apply-server-plugins.ts and adds new exports in the package.json file of the node package.

### apply-server-plugins.ts

- Change splitChunks optimization from false to undefined

- Add runtime chunk optimization configuration with 'webpack-runtime' as the name attribute value

### package.json

- Add new exports for './src/' as an entry point in the package.json file

* chore(utils): release version 1.7.6-rc.2

* chore(node): release version 0.14.7-rc.2

* chore(nextjs-mf): release version 6.4.1-rc.2

* [chore] Update package.json and internal.ts

This commit includes modifications in package.json and internal.ts files. Changes improve the prelease:all script and adjust the 'react/jsx-runtime' properties.

### package.json

- Update prerelease:all script with maxParallel=1 option to make releases safer by running tasks sequentially

### packages/nextjs-mf/src/internal.ts

- Change 'react/jsx-runtime' eager property from false to true for better performance

* fix: externalization and missing runtime chunks (#887)

* [fix] Resolve build issues at lululemon

This commit addresses the build issues occurring at lululemon by updating the handling of server externals and configuring server compiler options.

### packages/nextjs-mf/src/internal.ts

- Change import value for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Update handleServerExternals function to prevent build issues at lululemon

- Configure server compiler options to handle node builds and prevent conflicts

* refactor: Improve handling of Next.js and React modules

Refactors the module handling in the NextFederationPlugin to better distinguish modules from Next.js and React.

### apply-server-plugins.ts

- Add conditions to handle modules starting with 'react-dom/'

- Include 'react' and 'react-dom' as exact matches

* chore(utils): release version 1.7.6-rc.3

* chore(node): release version 0.14.7-rc.3

* chore(nextjs-mf): release version 6.4.1-rc.3

* fix: resolve build hanging issue

This commit fixes an issue where the build hangs by enabling the 'named' value for the optimization.chunkIds. Also, redundant comments have been removed.

### apply-server-plugins.ts

- Enabled 'named' value for optimization.chunkIds to fix build hanging issue

- Removed redundant comments

* chore(utils): release version 1.7.6-rc.4

* chore(node): release version 0.14.7-rc.4

* chore(nextjs-mf): release version 6.4.1-rc.4

* lint: handle fail remote

* fix: deprecation warnings about chunkGraph

* fix: missing chunk hashes on exposed modules (#893)

This commit fixes the missing chunk hashes on exposed modules in the micro-frontend federation system. It includes changes to the plugins and updates the federation-`noop.js 'to track modules and versions properly.

### federation-noop.js

- Rename noop.js file to federation-noop.js

### NextFederationPlugin/index.ts

- Update compiler logic to replace 'contenthash' with 'fullhash'

- Change reference of 'noop.js' to 'federation-noop.js'

- Refactor server configuration

### ChunkCorrelationPlugin.js

- Modify getExposedModules to use new module mapping

- Update getFederationStats function to use federationPluginOptions

### NodeFederationPlugin.ts

- Minor changes

* fix: chunk and module duplications (#885)

* fix: chunk and module duplications

* fix: missing chunkid on build

* fix: missing chunkid on build

* fix: client prod build issues (#899)

* fix: client prod build issues

* chore: update locks

* fix: chunk flushing and general chunk loading improvements

Improve chunk flushing and general chunk loading by fixing various issues and code optimizations.

### apply-client-plugins.ts

- Optimization fixes for chunkIds and splitChunks.

### apply-server-plugins.ts

- Refactor and optimization, including runtimeChunk and splitChunks fixes.

### index.ts

- Update conditions for applying commonOptions in NextFederationPlugin.

### InvertedContainerRuntimeModule.ts

- Minor code adjustments and formatting.

### index.ts (utils)

- Add flushChunks import, remove unnecessary code.

### LoadFileChunkLoadingRuntimeModule.ts

- Improve chunk filename local load logging and error handling.

### flush-chunks.js

- Refactors and improvements, including async loading/error handling.

### common.ts

- Add EXPORTS statement.

### importDelegatedModule.ts

- Minor adjustments and improvements to error handling.

* refactor(commit.js): optimize diff fidelity

Reduces the diff fidelity in the case of a large number of tokens to optimize the commit message generation process.

### gpt/commit.js

- Changed the number of lines in unified diff (-U) from 5 to 4

- Updated warning message to show the reduction in diff fidelity

* chore(utils): release version 1.8.1-rc.0

* chore(utils): release version 1.8.1-rc.1

* chore(node): release version 0.15.2-rc.0

* chore(nextjs-mf): release version 6.5.2-rc.0

* build: Generate exports for packages

A new build script has been added to generate the 'exports' field for each package in the mono-repo. This will update each package.json with the correct export paths, making it easier to manage sub-directory imports.

### generate-exports.js

- Add new build script to generate 'exports' field for each package in the mono-repo.

* chore: Improved Debug Output and Reduced Code Redundancy (#904)

* chore: update tsconfigs

* refactor: improve debug output and reduce code redundancy

This commit improves the debug output for better clarity and reduces code redundancy in various files.

### gpt/commit.js

- add getDiff function to handle diff reduction with correct max character count

### packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

- replace verbose with debug option

- refactor and improve code readability

### packages/nextjs-mf/utils/index.ts

- separate FlushedChunksProps type import

### packages/node/src/plugins/CommonJsChunkLoadingPlugin.ts

- replace verbose with debug option

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- replace verbose with debug option

- comment out unused code block

### packages/node/src/plugins/NodeFederationPlugin.ts

- replace verbose with debug option

### packages/node/src/plugins/StreamingTargetPlugin.ts

- replace verbose with debug option

### packages/node/src/plugins/UniversalFederationPlugin.ts

- replace verbose with debug option

### packages/node/src/utils/hot-reload.ts

- add missing semicolon

* refactor: uncommented code in LoadFileChunkLoadingRuntimeModule.ts

This commit re-enables a chunk of code that was previously commented out, within the LoadFileChunkLoadingRuntimeModule classes.

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- uncommented previously commented-out code related to initialChunkIds

* refactor: update moduleResolution in tsconfig.json

This commit updates the moduleResolution value from 'node16' to 'Node16' in tsconfig.json.

### packages/nextjs-mf/tsconfig.json

- updated moduleResolution value from 'node16' to 'Node16'

* chore: finish nx migraitons

* chore:update locks

* fix: remove specific module type from package

* fix:  Improved Entrypoint Module Detection and Refactoring (#932)

* fix: improve detection of entrypoint modules

Entrypoints can be many "NormalModule" types.

I want to exclude abnormal modules and search for entrypoints only

* refactor: remove use of deprecated entryModule

* chore: update Node.js version to 18 in GitHub actions

This commit updates the Node.js version used in GitHub actions for both pre-release and release workflows to 18, and adds a .nvmrc file with the updated Node.js version information.

### .github/workflows/pre-release.yml

- updated Node.js version to 18 in 'Use Node.js' step

### .github/workflows/release.yml

- updated Node.js version to 18 in 'Use Node.js' step

### .nvmrc

- created the file

- added Node.js version 18

* chore: update locks

* chore: update .nvmrc, remove type, and clean up code

This commit updates the .nvmrc file to return the Node.js version, removes the 'type' property from two package.json files, and cleans up some of the code in LoadFileChunkLoadingRuntimeModule.

### .nvmrc

- Added Node.js version: v18.16.0

### packages/node/package.json

- Remove 'type' property

### packages/utilities/package.json

- Remove 'type' property

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- Remove console.log statement

- Clean up some code

* refactor: change yarn to npm in scripts

This commit updates the package.json file to replace the usage of yarn with npm in the scripts section to maintain consistency and avoid potential issues when using different package managers.

### package.json

- replace yarn with npm in gpt:file:example

- replace yarn with npm in start:next

- replace yarn with npm in start:nextho

- replace yarn with npm in serve:next

* refactor: remove legacy-peer-deps flag from npm ci command

This commit removes the --legacy-peer-deps flag from the npm ci commands in three GitHub workflow configuration files, simplifying the installation process and using the defaults for handling peer dependencies.

### .github/workflows/on-push.yml

- Removed --legacy-peer-deps flag from npm ci command

### .github/workflows/pre-release.yml

- Removed --legacy-peer-deps flag from npm ci command

### .github/workflows/release.yml

- Removed --legacy-peer-deps flag from npm ci command

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(node): release version 0.15.2-rc1.0

* chore(nextjs-mf): release version 6.5.2-rc1.0

* feat: support custom distDir

* fix: remove default props deprecation on flush chunks

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: Improve chunk correlation (#936)

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: remove memory waste

* refactor: remove unused ContainerStatsPlugin and clean up InvertedContainerPlugin

This commit removes an unused ContainerStatsPlugin file and cleans up debug code in InvertedContainerPlugin

### nextjs-mf/src/plugins/ContainerStatsPlugin.js

- delete unused file

### nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- remove debug code

* refactor: enhance correctImportPath functionality

This commit refactors the correctImportPath function to better handle various environments and improve code readability.

### packages/utilities/src/utils/correctImportPath.ts

- wrapped function logic in a conditional check for window being undefined

- returned null if window is defined

- improved code readability by adjusting indentation

* chore(utils): release version 1.8.1-rc.2

* chore(utils): release version 1.8.1-rc.2

* chore(native-federation-typescript): release version 0.2.2-rc.0

* chore(utils): release version 1.8.1

* chore(utils): release version 1.8.2-beta.0

* chore(node): release version 0.15.2-beta.0

* chore(nextjs-mf): release version 6.5.2-beta.0

* fix: remove logs or wrap in debug flag (#959)

* chore(utils): release version 1.8.2-rc3.0

* chore(node): release version 0.15.2-rc3.0

* chore(nextjs-mf): release version 6.5.2-rc3.0

* fix: Path loader patches (#960)

* fix: re-enable image and url path patches

* fix: re-enable image and url path patches

* chore(utils): release version 1.8.2-rc3.1

* chore(node): release version 0.15.2-rc3.1

* chore(nextjs-mf): release version 6.5.2-rc3.1

* fix: Runtime module checking (#969)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: Resolve conditional exports (#971)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: resolve conditional exports

* fix: resolve conditional exports

* fix: Resolve condition names (#974)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. A…
valorkin added a commit that referenced this pull request Aug 26, 2023
* lint: fix test lint issue

* chore: disable tests for now

* chore: update packages

* chore: fix package scripts

* chore: update dep refs in apps

* chore: update dep refs in apps

* style: lint

* build: set nx dependOn orders

* build: set nx dependOn orders

* build: set nx dependOn orders

* chore(utils): release version 1.7.1-beta.0

* chore(utils): release version 1.7.1

* chore(node): release version 0.14.1-beta.0

* chore(node): release version 0.14.1

* chore(nextjs-mf): release version 6.4.1-beta.0

* fix: use [fullhash] if no hash exists / in development mode.

contenthash runtime module seems to be missing in server containers

* Update dependabot.yml

* revert dependabot change

* chore(node): release version 0.14.2-beta.0

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2-beta.2

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2

* chore(nextjs-mf): release version 6.4.1-beta.1

* update plugins

* fix: disable next chunk splits

* chore(nextjs-mf): release version 6.4.1-beta.2

* chore: fix package imports

* update plugins

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* chore: update locks

* chore(utils): release version 1.7.2-beta.0

* chore(utils): release version 1.7.2

* chore(node): release version 0.14.3-beta.0

* chore(node): release version 0.14.3

* chore(nextjs-mf): release version 6.4.1-beta.3

* chore: update nx

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* feat: [v7] Async boundary runtime (#835)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* chore: fix project.json

* debugging

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

# Conflicts:
#	package-lock.json
#	package.json
#	packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* fix: resolve backmerge issues (#871)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

# Conflicts:
#	package-lock.json
#	package.json
#	packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts
#	packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* ci: fix install step with npm and NX

* test: remove tests for now

* chore(utils): release version 1.7.3-beta.0

* chore(utils): release version 1.7.3

* chore(node): release version 0.14.4-beta.0

* chore(node): release version 0.14.4

* chore(nextjs-mf): release version 6.4.1-beta.4

* fix: remove debugging runtime variable

* chore(nextjs-mf): release version 6.4.1-beta.5

* feat: Quantum Modules (#872)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* locks

* chore(node): release version 0.14.5-beta.0

* chore(node): release version 0.14.5

* chore(nextjs-mf): release version 6.4.1-beta.6

* chore: lock file

* fix: ensure eager modules always exist in host (inject dependent modules somewhere in build pipeline)

* DX: Add GPT module and command-line interface (#875)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* chore: adding AI commit helper

* chore: adding AI commit helper

* chore: adding AI commit helper

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* Add functionality to generate and commit markdown-formatted commit messages

This commit adds a new functionality to generate and commit markdown-formatted commit messages. The commit message generation is handled by OpenAI's GPT-3 and the markdown formatting is handled by the  library. The commit message generator prompts the user for a title and description of the changes made, as well as a list of files and their changes. The user is then given the option to accept or reject the generated commit message. If accepted, the commit is automatically made with the generated message.

### gpt.js

- Added  and  functions from  to encode the commit message prompt for OpenAI's GPT-3
- Added the  module from  to render markdown in the terminal
- Added a function  to generate the commit message prompt and display the changes made to each file
- Refactored the  function to use the  function and encode the prompt using  and
- Added error handling for missing  environment variable
- Refactored the  function to create a more readable markdown message
- Added a function  to commit the changes using
- Modified the  function to check if there are any changes to commit before running
- Modified the  function to use the  function to commit the changes if the user accepts the generated commit message
- Added a call to  to render the generated commit message in the terminal

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:\n- Added 'OpenAIStream.js'\n- Added 'ai.js'\n- Added 'commit.js'\n- Added 'file.js'\n- Added 'generate.js'\n- Moved 'gpt.js' to 'gpt/gpt.js'\n- Added 'index.js'\n- Added 'markdown.js'\n- Added 'pull-request.js'\n\nThe 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.\n\n### OpenAIStream.js\n\n- Added file 'OpenAIStream.js'\n\n### ai.js\n\n- Added file 'ai.js'\n\n### commit.js\n\n- Added file 'commit.js'\n\n### file.js\n\n- Added file 'file.js'\n\n### generate.js\n\n- Added file 'generate.js'\n\n### gpt.js\n\n- Moved 'gpt.js' to 'gpt/gpt.js'\n\n### index.js\n\n- Added file 'index.js'\n- Implemented command-line interface with options '--pr' and '--commit'\n\n### markdown.js\n\n- Added file 'markdown.js'\n\n### pull-request.js\n\n- Added file 'pull-request.js'

* Add function for sending prompt to GPT model and exposing utilities as module exports, we did.

Add a new function called sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback. Also, expose the utilities readline and chatHistory as module exports, we did.\n\n### gpt/ai.js\n\n- Add function sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback, we did.\n- Expose readline and chatHistory as module exports, we did.

* Add generative commit message capability using GPT-3 model

This commit adds the ability to generate a commit message for code changes using the GPT-3 model. The message is generated from a diff of the staged files, and includes a title, description, and change set for each file. If the diff is too long, it is truncated. If there are no files staged for commit, an error message is displayed. The message is displayed as markdown and can be accepted or rejected by the user. If rejected, a new message is generated with user feedback.\n\n### gpt/ai.js\n\n- Changed the sendPromptToGPT function to allow an optional feedback param that can be used to include user feedback in the prompt when one is not already present.\n- Added usage logs in the sendPromptToGPT function.\n- Added a yargs check for the message passed in as a command argument.\n- Altered the returned content of the sendPromptToGPT function to be the entire output stream.\n- Added readline module and chatHistory array to the exports of the module.\n\n### gpt/commit.js\n\n- Added functions createPrompt, getValidJsonResponse, generateCommitMsg, createMarkdownCommit, and gitCommit to the module exports.\n- Added a schema constant as a stringified JSON object to be used as a guide for the JSON responses to prompts.\n- Created createPrompt function to generate the prompt for the GPT-3 model, given a string input and a feedback string.\n- Created getValidJsonResponse function to handle JSON parsing errors from the GPT-3 response, and returns a correctly formatted response.\n- Created generateCommitMsg function to retrieve a commit message object from the GPT-3 model, given staged changes and optional user feedback.\n- Created createMarkdownCommit function to format the commit message object as a markdown string.\n- Created gitCommit function to execute a git commit command with provided title and body as messages.\n- Created runGenerativeCommit function to orchestrate prompting the user and executing the git commit command.

* Add OpenAIStream function and configure markdown

This commit adds an  function for streaming API and also configures  to use  as the renderer.\n\n### gpt/OpenAIStream.js\n\n- Added  function to consume OpenAI's chat API over stream, parsing the stream into multiple chunks and invoking an event for each SSE event stream.\n- Provided a callback to call with the chunk of text returned from the API.\n\n### gpt/markdown.js\n\n- Configured  to use  as the renderer.\n- Defined custom renderer to colorize headings using  package.

* Add function to generate markdown summary of commit messages

This commit adds a new function called createLogMarkdownPrompt that creates prompts for the AI to summarize commits as markdown. It also adds a function called createMarkdownSummary that takes in an AI generated summary of commits and returns a markdown formatted summary. Lastly, it adds a generatePullRequestSummary function that takes user feedback, calls the createLogMarkdownPrompt function to create a prompt for the AI, sends it to the AI for processing, then formats and returns the summary using the createMarkdownSummary function.\n\n### gpt/pull-request.js\n\n- Added function called createLogMarkdownPrompt to create prompts for the AI to summarize commits as markdown\n- Added function called createMarkdownSummary to take in an AI generated summary of commits and return a markdown formatted summary\n- Added generatePullRequestSummary function to takes user feedback, call the createLogMarkdownPrompt function to create a prompt for the AI, send it to the AI for processing, then format and return the summary using the createMarkdownSummary function

* Refactor gitCommit function to use commandJoin

Refactored the gitCommit function to use the `commandJoin` package to create the git command. This replaces the need for string interpolation and manual escaping. Also removed unnecessary console.log statement.

### gpt/commit.js

- Updated gitCommit function to use commandJoin package
- Replaced string interpolation and manual escaping with `commandJoin` package. Removed unnecessary console log.

* Add GPT-3 stream handler

This commit adds a new handler function to stream chat messages to GPT-3. It also includes the necessary helper functions to prepare the input and output data for the API call.

### gpt/generate.js

- Added `getMessagesPrompt`, `readChunks`, and `readChunksBlocking` functions to enable streaming the message history to GPT-3.
- Added `handler` function as the main entry point for streaming chat messages to GPT-3.
- Exposed the `chatHistory` Set object to keep track of chat messages.

* Improve message generation in gpt/generate.js

This commit includes changes in gpt/generate.js file, improving the message generation's quality. It also adds some additional language to help the user feel more relaxed during conversations.

### gpt/generate.js

- Removed unnecessary pre_prompt variable.
- Improved getMessagesPrompt function to provide better suggestions for starting the conversation and to make the language more natural for the user.
- Refactored getMessagesPrompt function to include the role of the message.
- Replaced hardcoded strings with variables for better maintainability.

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:
- Added 'OpenAIStream.js'
- Added 'ai.js'
- Added 'commit.js'
- Added 'file.js'
- Added 'generate.js'
- Moved 'gpt.js' to 'gpt/gpt.js'
- Added 'index.js'
- Added 'markdown.js'
- Added 'pull-request.js'

The 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.

### OpenAIStream.js

- Added file 'OpenAIStream.js'

### ai.js

- Added file 'ai.js'

### commit.js

- Added file 'commit.js'

### file.js

- Added file 'file.js'

### generate.js

- Added file 'generate.js'

### gpt.js

- Moved 'gpt.js' to 'gpt/gpt.js'

### index.js

- Added file 'index.js'
- Implemented command-line interface with options '--pr' and '--commit'

### markdown.js

- Added file 'markdown.js'

### pull-request.js

- Added file 'pull-request.js'

* Remove simple-git package and fix commit script

This commit removes the simple-git package by removing its dependency and all of its references from the code. The commit message fix script has also been modified to exclude simple-git commits. The fixCommitMessages function was updated to remove calls to simple-git related functions.

### package.json

- Removed "simple-git" from devDependencies

### package-lock.json

- Removed simple-git reference

### fixcommit.js

- Removed simple-git import and function calls

* Improve commit message generation and add file processing features

This commit includes an enhancement to the existing commit message generation functionality and introduces new utility functions related to file processing.

### gpt/commit.js

- Refactor getValidJsonResponse function by adding try-catch block for JSON parsing

- Add logic for handling truncated JSON responses by following up with GPT-3 model

- Remove unused debugger statement

### gpt/file.js

- Add new file processing utility functions: uploadFile, getFileStatus, and useFileInCompletion

- Implement main function for running file processing tasks

### gpt/get-answer-from-files.js

- Create new empty file for future implementation

### gpt/process-file.js

- Create new empty file for future implementation

### gpt/search-file-chunks.js

- Create new empty file for future implementation

* Refactor ai.js to update gpt stream, model and usage

This commit refactors the `ai.js` file to make several changes related to the GPT stream, the model used and its usage.

### gpt/ai.js

- Update the model in the encoding_for_model function call to use the 'model' variable instead of the hardcoded string 'gpt-3.5-turbo'

- Move the assignment of the gptStream and content variables after the usage console output

- Remove an unnecessary line of whitespace

* Add search functionality to file chunks

This commit adds search functionality to file chunks, allowing users to search through their files, find matches and display the results.

### gpt/pull-request.js

- Update code formatting in the response section of sendToGPTForSummary function and add a user feedback section if available.

### gpt/search-file-chunks.js

- Create a new file to implement search functionality for file chunks.

- Add a searchChunks function that takes searchQuery, files and maxResults as input and returns the search results using the searchFileChunks service.

* Refactor OpenAIStream and add constants file

This commit refactors the OpenAIStream.js file to simplify the code and improve readability. It also adds a new constants.js file.

### gpt/OpenAIStream.js

- Refactor the OpenAIStream function to use the completionStream function from the services/openai module

- Remove unnecessary imports and variables

- Simplify the for-await loop to directly call the onChunk callback with the received chunk

### gpt/constants.js

- Create a new constants.js file

* Refactor gpt/ai.js and add gpt/constants.js

This commit refactors the gpt/ai.js file and adds a new gpt/constants.js file to better organize the code and improve maintainability.

### gpt/ai.js

- Move MAX_CHAR_COUNT constant to gpt/constants.js

- Update imports to include constants and generate modules separately

- Remove unnecessary MAX_CHAR_COUNT export

### gpt/constants.js

- Create new constants.js file

- Add pre_prompt, chatHistory, model, MAX_FILES_LENGTH, MAX_TOKENS, showProgress, and MAX_CHAR_COUNT constants

* Refactor ai.js and update dependencies

This commit refactors the ai.js file, removing unnecessary imports and updating the way GPT-3 completions are fetched. It also updates the constants imported to reflect the changes.

### gpt/ai.js

- Remove unnecessary imports such as yargs, child_process, node-fetch, and others

- Update the import of completionStream from the services/openai module

- Replace the usage of streamGPT with the new completionStream function

- Remove the chatgptApiEndpoint and chatgptApiKey variables as they are no longer needed

- Update the import of MAX_TOKENS from the constants module

- Refactor the sendPromptToGPT function to use the new completionStream function

- Update the module.exports to only export sendPromptToGPT and readline

* Refactor and improve format consistency in commit.js

This commit introduces several modifications to commit.js, primarily focusing on refactoring the code, improving readability, and enhancing the format consistency of the generated commit messages.

### commit.js

- Refactor getValidJsonResponse function to use async generator

- Update createPrompt to use a more user-friendly format and include additional context

- Replace instances of 'readline' with 'rl', and enhance error handling

- Simplify generateCommitMsg by using the async generator getValidJsonResponse

- Remove commented-out code

- Improve error messages and logging throughout the file

- Adjust schema string for readability

* Code changes have been made, hmmmmmm.

In this commit, improvements we see. The generateCommitMsg function is refined and userFeedback parameter is gone. Diff precision adapts to character count. Read below, you must.

### gpt/commit.js

- UserFeedback parameter removed from generateCommitMsg function.

- Added a method to reduce the fidelity of the diff when exceeding max character count.

* Refactor commit.js and update dependencies

This commit refactors the commit.js file, updates package dependencies, and streamlines the code for better readability and maintainability.

### gpt/commit.js

- Refactor readline import for better consistency

- Update usage of readline to use the refactored import

- Remove redundant readline.createInterface()

- Refactor runGenerativeCommit() for better code readability and maintainability

- Remove unnecessary spacing between lines

### package.json

- Update yargs to latest version

- Update chalk to latest version

- Update tiktoken to latest version

* Refactor code and remove unused files

This commit performs several tasks in multiple files, including code refactoring for maintainability, improving time complexity, adding JSDoc comments, implementing optimizations, and removing unused code/files.

### gpt/OpenAIStream.js

- Delete this unused file

### gpt/ai.js

- Delete this unused file

### gpt/commit.js

- Add MAIN_BRANCH constant import from constants.js

### gpt/constants.js

- Refactor the model from 'gpt-3.5-turbo' to 'gpt-4'

- Add MAIN_BRANCH constant as 'quantum_modules'

- Update MAX_TOKENS constant value to 4500

### gpt/file.js

- Refactor and improve the entire file by implementing optimizations, adding JSDoc comments, improving time complexity, and making the code more maintainable

### gpt/generate.js

- Delete this unused file

### gpt/index.js

- Import generate from process-file.js instead of generate.js

* Added get-answer-from-files functionality and improved pull request summary

In this commit, we have added and updated four files in the GPT project, mainly focusing on creating a new get-answer-from-files feature and improving the pull-request.js file for better pull request summaries. Also, some new terminal commands are introduced for better user experience.

### get-answer-from-files.js

- Created a new file to handle getting answers from the files using the OpenAI completion stream.

- Implemented the getAnswer function which processes files' text and sends a chunked prompt to GPT completion stream for response.

### process-file.js

- Created a new file for processing files, extracting text and creating embeddings.

- Implemented processFile function that takes the file path and processes the file to extract text and embeddings.

### pull-request.js

- Refactored the sendToGPTForSummary function to improve the handling of GPT responses.

- Added a check for user feedback and updated the function to handle completion stream chunks better.

- Removed some commented out code and improved the overall code structure for better readability.

### terminal.js

- Created a new file for handling terminal commands and readline interface.

- Implemented the readline interface object for handling user input in the terminal.

* Refactor getValidJsonResponse and update dependencies

This commit refactors the getValidJsonResponse function to improve error handling and updates the dependencies in package.json.

### gpt/commit.js

- Refactor the getValidJsonResponse function for better error handling

- Move the stream creation and answer processing inside the try block

### gpt/constants.js

- Add filterStopwords constant with a default value of false

### package.json

- Add new script command 'gpt:file:example'

- Add new script command 'gpt:file'

- Update dependencies: stopword, mime-types, mammoth, pdf-parse, node-html-markdown, form-data

* Update GPT model and improve completion and error handling

This commit updates the GPT model to GPT-4, adjusts the maximum tokens, and adds better completion and error handling.

### gpt/constants.js

- Change GPT model to 'gpt-4'

- Increase MAX_TOKENS from 4500 to 4600

### gpt/file.js

- Uncomment 'throw err' for better error handling when processing files

### gpt/services/openai.js

- Create new openai.js file with updated completion methods and error handling

- Implement completionStream and embedding functions

- Add API key error checking

- Improve completion function with fallbacks

* Add services for text analysis and file search

Implemented multiple services for chunking large texts, creating embeddings, extracting text from different file formats, getting embeddings for text, and searching similar file chunks using cosine similarity.

### chunkText.js

- Added a function to split a given text into smaller pieces of roughly equal length without breaking words or punctuation.

### createEmbeddings.js

- Implemented a function to create embeddings of given text, calculate the average of embeddings and return both the mean embedding and the individual chunk embeddings.

### extractTextFromFile.js

- Added a function to extract text content from various file formats such as PDF, DOCX, Markdown, CSV, HTML, Plain Text, and JavaScript files.

### getEmbeddingsForText.js

- Added a function to get embeddings for a given text by splitting the text into chunks and computing the embeddings in batch sizes.

### searchFileChunks.js

- Implemented a function to search file chunks for those that are semantically similar to the search query using cosine similarity (dot product) and return the ranked results based on the similarity score.

* chore: lock file

* Add code generation & utility functions

This commit adds new code generation and utility functions to generate unit test code for a given Python function and description, search for the most semantically similar code chunks, and parse GPT responses.

### gpt/generateUnitTest.js

- Create generateUnitTest function to generate unit test code for given Python code and description

- Export generateUnitTest function

### gpt/services/utils.js

- Add searchFileChunks function to search semantically similar code chunks for given search query and files

- Add isFileNameInString function to check if a file name is part of a given string

- Add parseGptResponse function to parse GPT response text into separate code blocks

- Export all utility functions

### gpt/tests.js

- Add script to test generateUnitTest function using command line arguments

* Refactor code, add response constant and update function behavior

This commit refactors the code, adds a response constant, and updates the behavior of the generateCommitMsg and createPrompt functions. The changes improve code consistency and readability, also enhancing user context when generating new suggestions.

### gpt/commit.js

- Refactor the code to declare oldDiff as a constant

- Update the generateCommitMsg function to include the response constant

- Modify the createPrompt function to conditionally include user feedback in chat history

### gpt/services/openai.js

- Add the response constant in the completion, completionStream, and createChatCompletion functions

- Remove console.log statement to improve code cleanliness

* Improve constants, file handling, and answer retrieval

This commit includes multiple code improvements and adjustments in the project, focusing on constants.js, file.js, and get-answer-from-files.js files. Additionally, it updates the package.json script.

### constants.js

- Update value of MAX_TOKENS to Infinity.

- Set showProgress to true.

- Add response end marker in JSON format.

### file.js

- Replace hardcoded END_OF_RESPONSE with response end marker.

- Update prompt instructions for separating file sections.

- Add console log for chatHistory.

- Comment out unused code related to getLastItemInArray.

### get-answer-from-files.js

- Refactor getAnswer function to handle large files by splitting them into chunks.

- Create getAnswerFromStream function to handle individual chunks.

- Update response end marker check for errors.

- Add error handling and retry attempt in case response end marker is not found.

### pull-request.js

- Replace hardcoded END_OF_RESPONSE with response end marker.

### package.json

- Update script for gpt:file:example.

* Add cosine similarity threshold constant and multiple code improvements

This commit introduces a new constant for the cosine similarity threshold and improves the overall code for better readability and functionality.

### gpt/constants.js

- Add COSINE_SIM_THRESHOLD constant for cosine similarity score threshold

### gpt/file.js

- Update prompt string for better readability

- Add missing 'fs' module import

### gpt/get-answer-from-files.js

- Add 'model' constant from constants.js

- Add write stream to save the output to a file

- Pass question parameter to getAnswerFromStream function

### gpt/services/utils.js

- Move COSINE_SIM_THRESHOLD import to constants.js

- Remove file writing from parseGptResponse function

* Improved parsing of GPT responses and file handling

This commit improves the way GPT responses are parsed, file handling, and stream management, and refactors code in several files.

### gpt/file.js

- Changed the import statement for 'getAnswer' to use destructuring

- Removed an unnecessary console.log call

### gpt/get-answer-from-files.js

- Added 'fs' import for handling file streams

- Imported 'normalizedFileName' and 'parseGptResponse' functions from 'services/utils.js'

- Modified 'getAnswer' function to better handle chunks and splitting files

- Refactored 'getAnswerFromStream' function to create and manage write streams for each file

- Exported 'getAnswer' function using an object to make importing it easier with destructuring

### gpt/services/utils.js

- Refactored 'parseGptResponse' function to improve handling of incoming chunks and file parsing

- Added 'chunkAggregator' to accumulate chunks before parsing

- Improved verification of file names in strings

* chore: lock file

* chore: lock file

* Add training prompt/target pairs generation and improve prompts

This commit introduces code to generate prompt and target pairs, improve the prompts using the GPT-4 model and write the updated prompts to a jsonl file.

### gpt/training.js

- Add function generatePromptTargetPairs to iterate through the project directory and find code files with JSDoc comments

- Add function writeToJsonl to generate improved prompts and write the prompt/target pairs to a jsonl file

### package.json

- Add comment-parser dependency for parsing JSDoc comments

* chore: lock file

* chore: update locks

* DX: add GPT helper

* Remove unused and commented code from async-pages-loader

This commit is focused on cleaning up the async-pages-loader file by removing unused and commented code blocks. This helps improve readability and maintainability of the code.

### async-pages-loader.ts

- Remove multiple return statements with commented code

- Delete unnecessary import statements

- Remove unused code blocks related to routing and loading of modules

* DX: add GPT helper

* Fix production build issue caused by optimization stages

This commit fixes a production build issue that occurred due to optimization stages. It updates the hooks, chunks and module loading process to resolve the problem.

### packages/nextjs-mf/src/internal.ts

- Update DEFAULT_SHARE_SCOPE settings

### packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts

- Add import for 'react/jsx-runtime' to patch

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Refactor plugin to use updated hooks and optimization stages

- Update asset handling in processAssets hook

* Refactor loadScript and improve error handling

This commit refactors the loadScript function to create a new loadRemoteContainer function and improves error handling when loading a script fails.

### packages/utilities/src/utils/common.ts

- Refactor loadScript into loadScript and loadRemoteContainer for better separation of concerns

- Wrap asyncContainer in try-catch block for better error handling

- Create and return a fake container with a null factory when loading script fails

* Update scripts and apply server plugins

This commit updates the package.json scripts and modifies the applyServerPlugins function in the NextFederationPlugin.

### package.json

- Update 'start:nextho' script to use 'nx run-many' instead of 'concurrently' for better consistency with other scripts

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Add 'delete compiler.options.optimization.splitChunks' to remove splitChunks optimization from the server compiler

* chore(utils): release version 1.7.4

* chore(node): release version 0.14.6

* chore(nextjs-mf): release version 6.4.1-beta.7

* fix: Improved Share Scope Properties and Fixed Production Build Issues (#884)

* chore(nextjs-mf): release version 6.4.1-beta.8

* thing

* fix: fixed production build issues

* fix: Prevent removal of external eager modules

This commit prevents the removal of eager modules that are external, improves the code by removing an unnecessary condition, and refactors test patterns for better readability.

### next-fragments.ts

- Removed unnecessary condition checking 'compiler.options.name === 'client' || true'

- Refactored 'test' patterns for better readability

### RemoveEagerModulesFromRuntimePlugin.ts

- Prevented removal of external eager modules

* chore: update packscript

* Update default share scope properties

This commit updates the DEFAULT_SHARE_SCOPE and DEFAULT_SHARE_SCOPE_BROWSER objects in the internal.ts file. Modifications include setting the eager property for some shared dependencies and using direct reference instead of cloning the DEFAULT_SHARE_SCOPE object.

### packages/nextjs-mf/src/internal.ts

- Set eager property for 'react-dom' to false in DEFAULT_SHARE_SCOPE

- Change import property order for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

- Remove JSON clone process and use a direct reference of DEFAULT_SHARE_SCOPE in building DEFAULT_SHARE_SCOPE_BROWSER

- Set eager property to true for 'react', 'react-dom', and 'next/router' in DEFAULT_SHARE_SCOPE_BROWSER

* Fix incorrect string in if condition

This commit fixes an issue in the patchDefaultSharedLoader.ts file where the if condition check was using an incorrect string, which could result in skipping the intended patching process.

### packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts

- Update the string in the if condition check from 'placeholderModuleEnsurepat' to 'placeholderModuleEnsure'

* Refactor loadScript and improve error handling

This commit refactors the loadScript function and improves error handling for offline containers. It also fixes type casting issues in the code.

### packages/utilities/src/utils/common.ts

- Fix type casting for remoteGlobal and containerKey

- Enable console.error statement for error logging when catching errors

- Refactor the loadScript function to improve readability and error handling

* chore: remove logs

* Refactor InvertedContainerRuntimeModule and remove console logs

This commit refactors the InvertedContainerRuntimeModule class and removes unnecessary console logs.

### InvertedContainerRuntimeModule.ts

- Refactor class code for improved readability

- Remove unnecessary console logs

* chore(utils): release version 1.7.5-beta.0

* chore(utils): release version 1.7.5

* chore(node): release version 0.14.7-beta.0

* chore(utils): release version 1.7.6-beta.0

* chore(node): release version 0.14.7-beta.1

* chore(nextjs-mf): release version 6.4.1-beta.8

* chore(utils): release version 1.7.6-beta.1

* chore(node): release version 0.14.7-beta.2

* chore(nextjs-mf): release version 6.4.1-beta.8

* fix: remove old files

* chore(utils): release version 1.7.6-beta.2

* chore(node): release version 0.14.7-beta.3

* chore(nextjs-mf): release version 6.4.1-beta.8

* feat: remove entry injection

* chore(utils): release version 1.7.6-rc.0

* chore(node): release version 0.14.7-rc.0

* chore(nextjs-mf): release version 6.4.1-rc.0

* chore: back to beta tag

* update locks

* update locks

* fix(chunk-module-duplication): prevent runtime reset and share scope loss

This commit fixes the issue of chunk and module duplication that leads to runtime resetting or losing share scope.

### packages/nextjs-mf/src/internal.ts

- Changed 'eager' value of 'next/router' to false

### packages/nextjs-mf/src/noop.js

- Created new noop.js file

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Changed 'debug' value to false

### packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts

- Added new './noop' key-value pair in exposes

- Updated comment regarding remote entry requirement

### packages/nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- Added check for chunk.hasRuntime()

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- Added rootOutputDir variable assignment

* refactor: Next.js Micro-Frontends code improvements

This commit covers code improvements for Next.js Micro-Frontends including JSONP chunk loading, page stitching and runtime optimizations.

### gpt/commit.js

- Changed title structure in JSON format

### packages/nextjs-mf/src/internal.ts

- Changed eager value in DEFAULT_SHARE_SCOPE

### packages/nextjs-mf/src/loaders/patchDefaultSharedLoader.ts

- Reordered imports and added conditional for development environment

### packages/nextjs-mf/src/plugins/AddModulesToRuntime.js

- Deleted unused file

### packages/nextjs-mf/src/plugins/JsonpChunkLoading.ts

- Refactored getCustomJsonpCode function

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-client-plugins.ts

- Replaced AddModulesPlugin with DelegateModulesPlugin

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Removed AddModulesPlugin and applied DelegatesModulePlugin

* chore(utils): release version 1.7.6-rc.1

* chore(node): release version 0.14.7-rc.1

* chore(nextjs-mf): release version 6.4.1-rc.1

* update locks

* refactor(apply-server-plugins): Update server plugin configurations and package.json exports

This commit updates the server plugin configurations in apply-server-plugins.ts and adds new exports in the package.json file of the node package.

### apply-server-plugins.ts

- Change splitChunks optimization from false to undefined

- Add runtime chunk optimization configuration with 'webpack-runtime' as the name attribute value

### package.json

- Add new exports for './src/' as an entry point in the package.json file

* chore(utils): release version 1.7.6-rc.2

* chore(node): release version 0.14.7-rc.2

* chore(nextjs-mf): release version 6.4.1-rc.2

* [chore] Update package.json and internal.ts

This commit includes modifications in package.json and internal.ts files. Changes improve the prelease:all script and adjust the 'react/jsx-runtime' properties.

### package.json

- Update prerelease:all script with maxParallel=1 option to make releases safer by running tasks sequentially

### packages/nextjs-mf/src/internal.ts

- Change 'react/jsx-runtime' eager property from false to true for better performance

* fix: externalization and missing runtime chunks (#887)

* [fix] Resolve build issues at lululemon

This commit addresses the build issues occurring at lululemon by updating the handling of server externals and configuring server compiler options.

### packages/nextjs-mf/src/internal.ts

- Change import value for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

### packages/nextjs-mf/src/plugins/NextFederationPlugin/apply-server-plugins.ts

- Update handleServerExternals function to prevent build issues at lululemon

- Configure server compiler options to handle node builds and prevent conflicts

* refactor: Improve handling of Next.js and React modules

Refactors the module handling in the NextFederationPlugin to better distinguish modules from Next.js and React.

### apply-server-plugins.ts

- Add conditions to handle modules starting with 'react-dom/'

- Include 'react' and 'react-dom' as exact matches

* chore(utils): release version 1.7.6-rc.3

* chore(node): release version 0.14.7-rc.3

* chore(nextjs-mf): release version 6.4.1-rc.3

* fix: resolve build hanging issue

This commit fixes an issue where the build hangs by enabling the 'named' value for the optimization.chunkIds. Also, redundant comments have been removed.

### apply-server-plugins.ts

- Enabled 'named' value for optimization.chunkIds to fix build hanging issue

- Removed redundant comments

* chore(utils): release version 1.7.6-rc.4

* chore(node): release version 0.14.7-rc.4

* chore(nextjs-mf): release version 6.4.1-rc.4

* lint: handle fail remote

* fix: deprecation warnings about chunkGraph

* fix: missing chunk hashes on exposed modules (#893)

This commit fixes the missing chunk hashes on exposed modules in the micro-frontend federation system. It includes changes to the plugins and updates the federation-`noop.js 'to track modules and versions properly.

### federation-noop.js

- Rename noop.js file to federation-noop.js

### NextFederationPlugin/index.ts

- Update compiler logic to replace 'contenthash' with 'fullhash'

- Change reference of 'noop.js' to 'federation-noop.js'

- Refactor server configuration

### ChunkCorrelationPlugin.js

- Modify getExposedModules to use new module mapping

- Update getFederationStats function to use federationPluginOptions

### NodeFederationPlugin.ts

- Minor changes

* fix: chunk and module duplications (#885)

* fix: chunk and module duplications

* fix: missing chunkid on build

* fix: missing chunkid on build

* fix: client prod build issues (#899)

* fix: client prod build issues

* chore: update locks

* fix: chunk flushing and general chunk loading improvements

Improve chunk flushing and general chunk loading by fixing various issues and code optimizations.

### apply-client-plugins.ts

- Optimization fixes for chunkIds and splitChunks.

### apply-server-plugins.ts

- Refactor and optimization, including runtimeChunk and splitChunks fixes.

### index.ts

- Update conditions for applying commonOptions in NextFederationPlugin.

### InvertedContainerRuntimeModule.ts

- Minor code adjustments and formatting.

### index.ts (utils)

- Add flushChunks import, remove unnecessary code.

### LoadFileChunkLoadingRuntimeModule.ts

- Improve chunk filename local load logging and error handling.

### flush-chunks.js

- Refactors and improvements, including async loading/error handling.

### common.ts

- Add EXPORTS statement.

### importDelegatedModule.ts

- Minor adjustments and improvements to error handling.

* refactor(commit.js): optimize diff fidelity

Reduces the diff fidelity in the case of a large number of tokens to optimize the commit message generation process.

### gpt/commit.js

- Changed the number of lines in unified diff (-U) from 5 to 4

- Updated warning message to show the reduction in diff fidelity

* chore(utils): release version 1.8.1-rc.0

* chore(utils): release version 1.8.1-rc.1

* chore(node): release version 0.15.2-rc.0

* chore(nextjs-mf): release version 6.5.2-rc.0

* build: Generate exports for packages

A new build script has been added to generate the 'exports' field for each package in the mono-repo. This will update each package.json with the correct export paths, making it easier to manage sub-directory imports.

### generate-exports.js

- Add new build script to generate 'exports' field for each package in the mono-repo.

* chore: Improved Debug Output and Reduced Code Redundancy (#904)

* chore: update tsconfigs

* refactor: improve debug output and reduce code redundancy

This commit improves the debug output for better clarity and reduces code redundancy in various files.

### gpt/commit.js

- add getDiff function to handle diff reduction with correct max character count

### packages/nextjs-mf/src/plugins/container/InvertedContainerRuntimeModule.ts

- replace verbose with debug option

- refactor and improve code readability

### packages/nextjs-mf/utils/index.ts

- separate FlushedChunksProps type import

### packages/node/src/plugins/CommonJsChunkLoadingPlugin.ts

- replace verbose with debug option

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- replace verbose with debug option

- comment out unused code block

### packages/node/src/plugins/NodeFederationPlugin.ts

- replace verbose with debug option

### packages/node/src/plugins/StreamingTargetPlugin.ts

- replace verbose with debug option

### packages/node/src/plugins/UniversalFederationPlugin.ts

- replace verbose with debug option

### packages/node/src/utils/hot-reload.ts

- add missing semicolon

* refactor: uncommented code in LoadFileChunkLoadingRuntimeModule.ts

This commit re-enables a chunk of code that was previously commented out, within the LoadFileChunkLoadingRuntimeModule classes.

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- uncommented previously commented-out code related to initialChunkIds

* refactor: update moduleResolution in tsconfig.json

This commit updates the moduleResolution value from 'node16' to 'Node16' in tsconfig.json.

### packages/nextjs-mf/tsconfig.json

- updated moduleResolution value from 'node16' to 'Node16'

* chore: finish nx migraitons

* chore:update locks

* fix: remove specific module type from package

* fix:  Improved Entrypoint Module Detection and Refactoring (#932)

* fix: improve detection of entrypoint modules

Entrypoints can be many "NormalModule" types.

I want to exclude abnormal modules and search for entrypoints only

* refactor: remove use of deprecated entryModule

* chore: update Node.js version to 18 in GitHub actions

This commit updates the Node.js version used in GitHub actions for both pre-release and release workflows to 18, and adds a .nvmrc file with the updated Node.js version information.

### .github/workflows/pre-release.yml

- updated Node.js version to 18 in 'Use Node.js' step

### .github/workflows/release.yml

- updated Node.js version to 18 in 'Use Node.js' step

### .nvmrc

- created the file

- added Node.js version 18

* chore: update locks

* chore: update .nvmrc, remove type, and clean up code

This commit updates the .nvmrc file to return the Node.js version, removes the 'type' property from two package.json files, and cleans up some of the code in LoadFileChunkLoadingRuntimeModule.

### .nvmrc

- Added Node.js version: v18.16.0

### packages/node/package.json

- Remove 'type' property

### packages/utilities/package.json

- Remove 'type' property

### packages/node/src/plugins/LoadFileChunkLoadingRuntimeModule.ts

- Remove console.log statement

- Clean up some code

* refactor: change yarn to npm in scripts

This commit updates the package.json file to replace the usage of yarn with npm in the scripts section to maintain consistency and avoid potential issues when using different package managers.

### package.json

- replace yarn with npm in gpt:file:example

- replace yarn with npm in start:next

- replace yarn with npm in start:nextho

- replace yarn with npm in serve:next

* refactor: remove legacy-peer-deps flag from npm ci command

This commit removes the --legacy-peer-deps flag from the npm ci commands in three GitHub workflow configuration files, simplifying the installation process and using the defaults for handling peer dependencies.

### .github/workflows/on-push.yml

- Removed --legacy-peer-deps flag from npm ci command

### .github/workflows/pre-release.yml

- Removed --legacy-peer-deps flag from npm ci command

### .github/workflows/release.yml

- Removed --legacy-peer-deps flag from npm ci command

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(node): release version 0.15.2-rc1.0

* chore(nextjs-mf): release version 6.5.2-rc1.0

* feat: support custom distDir

* fix: remove default props deprecation on flush chunks

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: Improve chunk correlation (#936)

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

### packages/node/src/plugins/ChunkCorrelationPlugin.js

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: remove memory waste

* refactor: remove unused ContainerStatsPlugin and clean up InvertedContainerPlugin

This commit removes an unused ContainerStatsPlugin file and cleans up debug code in InvertedContainerPlugin

### nextjs-mf/src/plugins/ContainerStatsPlugin.js

- delete unused file

### nextjs-mf/src/plugins/container/InvertedContainerPlugin.ts

- remove debug code

* refactor: enhance correctImportPath functionality

This commit refactors the correctImportPath function to better handle various environments and improve code readability.

### packages/utilities/src/utils/correctImportPath.ts

- wrapped function logic in a conditional check for window being undefined

- returned null if window is defined

- improved code readability by adjusting indentation

* chore(utils): release version 1.8.1-rc.2

* chore(utils): release version 1.8.1-rc.2

* chore(native-federation-typescript): release version 0.2.2-rc.0

* chore(utils): release version 1.8.1

* chore(utils): release version 1.8.2-beta.0

* chore(node): release version 0.15.2-beta.0

* chore(nextjs-mf): release version 6.5.2-beta.0

* fix: remove logs or wrap in debug flag (#959)

* chore(utils): release version 1.8.2-rc3.0

* chore(node): release version 0.15.2-rc3.0

* chore(nextjs-mf): release version 6.5.2-rc3.0

* fix: Path loader patches (#960)

* fix: re-enable image and url path patches

* fix: re-enable image and url path patches

* chore(utils): release version 1.8.2-rc3.1

* chore(node): release version 0.15.2-rc3.1

* chore(nextjs-mf): release version 6.5.2-rc3.1

* fix: Runtime module checking (#969)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: Resolve conditional exports (#971)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: resolve conditional exports

* fix: resolve conditional exports

* WIP Core API

* Fix react remote MF plugin

* Refactors

* Fixes

* Add hook

* Disable ESM for react

* Disable ESM

* ESM changes

* ESM changes

* federated types fix

* Updates

* Rework webpack config

* Fix remotes

* Merge fallout

* Remove extraneous file

* Refactor global types

* Small fixes

* Refactors

* Revert package.json

* PR co…
RussellCanfield pushed a commit to RussellCanfield/nextjs-mf that referenced this pull request Aug 26, 2023
* chore(node): release version 0.14.1-beta.0

* chore(node): release version 0.14.1

* chore(nextjs-mf): release version 6.4.1-beta.0

* fix: use [fullhash] if no hash exists / in development mode.

contenthash runtime module seems to be missing in server containers

* Update dependabot.yml

* revert dependabot change

* chore(node): release version 0.14.2-beta.0

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2-beta.2

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2

* chore(nextjs-mf): release version 6.4.1-beta.1

* update plugins

* fix: disable next chunk splits

* chore(nextjs-mf): release version 6.4.1-beta.2

* chore: fix package imports

* update plugins

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* chore: update locks

* chore(utils): release version 1.7.2-beta.0

* chore(utils): release version 1.7.2

* chore(node): release version 0.14.3-beta.0

* chore(node): release version 0.14.3

* chore(nextjs-mf): release version 6.4.1-beta.3

* chore: update nx

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* feat: [v7] Async boundary runtime (#835)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* chore: fix project.json

* debugging

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* fix: resolve backmerge issues (#871)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* ci: fix install step with npm and NX

* test: remove tests for now

* chore(utils): release version 1.7.3-beta.0

* chore(utils): release version 1.7.3

* chore(node): release version 0.14.4-beta.0

* chore(node): release version 0.14.4

* chore(nextjs-mf): release version 6.4.1-beta.4

* fix: remove debugging runtime variable

* chore(nextjs-mf): release version 6.4.1-beta.5

* feat: Quantum Modules (#872)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* locks

* chore(node): release version 0.14.5-beta.0

* chore(node): release version 0.14.5

* chore(nextjs-mf): release version 6.4.1-beta.6

* chore: lock file

* fix: ensure eager modules always exist in host (inject dependent modules somewhere in build pipeline)

* DX: Add GPT module and command-line interface (#875)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* chore: adding AI commit helper

* chore: adding AI commit helper

* chore: adding AI commit helper

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* Add functionality to generate and commit markdown-formatted commit messages

This commit adds a new functionality to generate and commit markdown-formatted commit messages. The commit message generation is handled by OpenAI's GPT-3 and the markdown formatting is handled by the  library. The commit message generator prompts the user for a title and description of the changes made, as well as a list of files and their changes. The user is then given the option to accept or reject the generated commit message. If accepted, the commit is automatically made with the generated message.

- Added  and  functions from  to encode the commit message prompt for OpenAI's GPT-3
- Added the  module from  to render markdown in the terminal
- Added a function  to generate the commit message prompt and display the changes made to each file
- Refactored the  function to use the  function and encode the prompt using  and
- Added error handling for missing  environment variable
- Refactored the  function to create a more readable markdown message
- Added a function  to commit the changes using
- Modified the  function to check if there are any changes to commit before running
- Modified the  function to use the  function to commit the changes if the user accepts the generated commit message
- Added a call to  to render the generated commit message in the terminal

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:\n- Added 'OpenAIStream.js'\n- Added 'ai.js'\n- Added 'commit.js'\n- Added 'file.js'\n- Added 'generate.js'\n- Moved 'gpt.js' to 'gpt/gpt.js'\n- Added 'index.js'\n- Added 'markdown.js'\n- Added 'pull-request.js'\n\nThe 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.\n\n### OpenAIStream.js\n\n- Added file 'OpenAIStream.js'\n\n### ai.js\n\n- Added file 'ai.js'\n\n### commit.js\n\n- Added file 'commit.js'\n\n### file.js\n\n- Added file 'file.js'\n\n### generate.js\n\n- Added file 'generate.js'\n\n### gpt.js\n\n- Moved 'gpt.js' to 'gpt/gpt.js'\n\n### index.js\n\n- Added file 'index.js'\n- Implemented command-line interface with options '--pr' and '--commit'\n\n### markdown.js\n\n- Added file 'markdown.js'\n\n### pull-request.js\n\n- Added file 'pull-request.js'

* Add function for sending prompt to GPT model and exposing utilities as module exports, we did.

Add a new function called sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback. Also, expose the utilities readline and chatHistory as module exports, we did.\n\n### gpt/ai.js\n\n- Add function sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback, we did.\n- Expose readline and chatHistory as module exports, we did.

* Add generative commit message capability using GPT-3 model

This commit adds the ability to generate a commit message for code changes using the GPT-3 model. The message is generated from a diff of the staged files, and includes a title, description, and change set for each file. If the diff is too long, it is truncated. If there are no files staged for commit, an error message is displayed. The message is displayed as markdown and can be accepted or rejected by the user. If rejected, a new message is generated with user feedback.\n\n### gpt/ai.js\n\n- Changed the sendPromptToGPT function to allow an optional feedback param that can be used to include user feedback in the prompt when one is not already present.\n- Added usage logs in the sendPromptToGPT function.\n- Added a yargs check for the message passed in as a command argument.\n- Altered the returned content of the sendPromptToGPT function to be the entire output stream.\n- Added readline module and chatHistory array to the exports of the module.\n\n### gpt/commit.js\n\n- Added functions createPrompt, getValidJsonResponse, generateCommitMsg, createMarkdownCommit, and gitCommit to the module exports.\n- Added a schema constant as a stringified JSON object to be used as a guide for the JSON responses to prompts.\n- Created createPrompt function to generate the prompt for the GPT-3 model, given a string input and a feedback string.\n- Created getValidJsonResponse function to handle JSON parsing errors from the GPT-3 response, and returns a correctly formatted response.\n- Created generateCommitMsg function to retrieve a commit message object from the GPT-3 model, given staged changes and optional user feedback.\n- Created createMarkdownCommit function to format the commit message object as a markdown string.\n- Created gitCommit function to execute a git commit command with provided title and body as messages.\n- Created runGenerativeCommit function to orchestrate prompting the user and executing the git commit command.

* Add OpenAIStream function and configure markdown

This commit adds an  function for streaming API and also configures  to use  as the renderer.\n\n### gpt/OpenAIStream.js\n\n- Added  function to consume OpenAI's chat API over stream, parsing the stream into multiple chunks and invoking an event for each SSE event stream.\n- Provided a callback to call with the chunk of text returned from the API.\n\n### gpt/markdown.js\n\n- Configured  to use  as the renderer.\n- Defined custom renderer to colorize headings using  package.

* Add function to generate markdown summary of commit messages

This commit adds a new function called createLogMarkdownPrompt that creates prompts for the AI to summarize commits as markdown. It also adds a function called createMarkdownSummary that takes in an AI generated summary of commits and returns a markdown formatted summary. Lastly, it adds a generatePullRequestSummary function that takes user feedback, calls the createLogMarkdownPrompt function to create a prompt for the AI, sends it to the AI for processing, then formats and returns the summary using the createMarkdownSummary function.\n\n### gpt/pull-request.js\n\n- Added function called createLogMarkdownPrompt to create prompts for the AI to summarize commits as markdown\n- Added function called createMarkdownSummary to take in an AI generated summary of commits and return a markdown formatted summary\n- Added generatePullRequestSummary function to takes user feedback, call the createLogMarkdownPrompt function to create a prompt for the AI, send it to the AI for processing, then format and return the summary using the createMarkdownSummary function

* Refactor gitCommit function to use commandJoin

Refactored the gitCommit function to use the `commandJoin` package to create the git command. This replaces the need for string interpolation and manual escaping. Also removed unnecessary console.log statement.

- Updated gitCommit function to use commandJoin package
- Replaced string interpolation and manual escaping with `commandJoin` package. Removed unnecessary console log.

* Add GPT-3 stream handler

This commit adds a new handler function to stream chat messages to GPT-3. It also includes the necessary helper functions to prepare the input and output data for the API call.

- Added `getMessagesPrompt`, `readChunks`, and `readChunksBlocking` functions to enable streaming the message history to GPT-3.
- Added `handler` function as the main entry point for streaming chat messages to GPT-3.
- Exposed the `chatHistory` Set object to keep track of chat messages.

* Improve message generation in gpt/generate.js

This commit includes changes in gpt/generate.js file, improving the message generation's quality. It also adds some additional language to help the user feel more relaxed during conversations.

- Removed unnecessary pre_prompt variable.
- Improved getMessagesPrompt function to provide better suggestions for starting the conversation and to make the language more natural for the user.
- Refactored getMessagesPrompt function to include the role of the message.
- Replaced hardcoded strings with variables for better maintainability.

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:
- Added 'OpenAIStream.js'
- Added 'ai.js'
- Added 'commit.js'
- Added 'file.js'
- Added 'generate.js'
- Moved 'gpt.js' to 'gpt/gpt.js'
- Added 'index.js'
- Added 'markdown.js'
- Added 'pull-request.js'

The 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.

- Added file 'OpenAIStream.js'

- Added file 'ai.js'

- Added file 'commit.js'

- Added file 'file.js'

- Added file 'generate.js'

- Moved 'gpt.js' to 'gpt/gpt.js'

- Added file 'index.js'
- Implemented command-line interface with options '--pr' and '--commit'

- Added file 'markdown.js'

- Added file 'pull-request.js'

* Remove simple-git package and fix commit script

This commit removes the simple-git package by removing its dependency and all of its references from the code. The commit message fix script has also been modified to exclude simple-git commits. The fixCommitMessages function was updated to remove calls to simple-git related functions.

- Removed "simple-git" from devDependencies

- Removed simple-git reference

- Removed simple-git import and function calls

* Improve commit message generation and add file processing features

This commit includes an enhancement to the existing commit message generation functionality and introduces new utility functions related to file processing.

- Refactor getValidJsonResponse function by adding try-catch block for JSON parsing

- Add logic for handling truncated JSON responses by following up with GPT-3 model

- Remove unused debugger statement

- Add new file processing utility functions: uploadFile, getFileStatus, and useFileInCompletion

- Implement main function for running file processing tasks

- Create new empty file for future implementation

- Create new empty file for future implementation

- Create new empty file for future implementation

* Refactor ai.js to update gpt stream, model and usage

This commit refactors the `ai.js` file to make several changes related to the GPT stream, the model used and its usage.

- Update the model in the encoding_for_model function call to use the 'model' variable instead of the hardcoded string 'gpt-3.5-turbo'

- Move the assignment of the gptStream and content variables after the usage console output

- Remove an unnecessary line of whitespace

* Add search functionality to file chunks

This commit adds search functionality to file chunks, allowing users to search through their files, find matches and display the results.

- Update code formatting in the response section of sendToGPTForSummary function and add a user feedback section if available.

- Create a new file to implement search functionality for file chunks.

- Add a searchChunks function that takes searchQuery, files and maxResults as input and returns the search results using the searchFileChunks service.

* Refactor OpenAIStream and add constants file

This commit refactors the OpenAIStream.js file to simplify the code and improve readability. It also adds a new constants.js file.

- Refactor the OpenAIStream function to use the completionStream function from the services/openai module

- Remove unnecessary imports and variables

- Simplify the for-await loop to directly call the onChunk callback with the received chunk

- Create a new constants.js file

* Refactor gpt/ai.js and add gpt/constants.js

This commit refactors the gpt/ai.js file and adds a new gpt/constants.js file to better organize the code and improve maintainability.

- Move MAX_CHAR_COUNT constant to gpt/constants.js

- Update imports to include constants and generate modules separately

- Remove unnecessary MAX_CHAR_COUNT export

- Create new constants.js file

- Add pre_prompt, chatHistory, model, MAX_FILES_LENGTH, MAX_TOKENS, showProgress, and MAX_CHAR_COUNT constants

* Refactor ai.js and update dependencies

This commit refactors the ai.js file, removing unnecessary imports and updating the way GPT-3 completions are fetched. It also updates the constants imported to reflect the changes.

- Remove unnecessary imports such as yargs, child_process, node-fetch, and others

- Update the import of completionStream from the services/openai module

- Replace the usage of streamGPT with the new completionStream function

- Remove the chatgptApiEndpoint and chatgptApiKey variables as they are no longer needed

- Update the import of MAX_TOKENS from the constants module

- Refactor the sendPromptToGPT function to use the new completionStream function

- Update the module.exports to only export sendPromptToGPT and readline

* Refactor and improve format consistency in commit.js

This commit introduces several modifications to commit.js, primarily focusing on refactoring the code, improving readability, and enhancing the format consistency of the generated commit messages.

- Refactor getValidJsonResponse function to use async generator

- Update createPrompt to use a more user-friendly format and include additional context

- Replace instances of 'readline' with 'rl', and enhance error handling

- Simplify generateCommitMsg by using the async generator getValidJsonResponse

- Remove commented-out code

- Improve error messages and logging throughout the file

- Adjust schema string for readability

* Code changes have been made, hmmmmmm.

In this commit, improvements we see. The generateCommitMsg function is refined and userFeedback parameter is gone. Diff precision adapts to character count. Read below, you must.

- UserFeedback parameter removed from generateCommitMsg function.

- Added a method to reduce the fidelity of the diff when exceeding max character count.

* Refactor commit.js and update dependencies

This commit refactors the commit.js file, updates package dependencies, and streamlines the code for better readability and maintainability.

- Refactor readline import for better consistency

- Update usage of readline to use the refactored import

- Remove redundant readline.createInterface()

- Refactor runGenerativeCommit() for better code readability and maintainability

- Remove unnecessary spacing between lines

- Update yargs to latest version

- Update chalk to latest version

- Update tiktoken to latest version

* Refactor code and remove unused files

This commit performs several tasks in multiple files, including code refactoring for maintainability, improving time complexity, adding JSDoc comments, implementing optimizations, and removing unused code/files.

- Delete this unused file

- Delete this unused file

- Add MAIN_BRANCH constant import from constants.js

- Refactor the model from 'gpt-3.5-turbo' to 'gpt-4'

- Add MAIN_BRANCH constant as 'quantum_modules'

- Update MAX_TOKENS constant value to 4500

- Refactor and improve the entire file by implementing optimizations, adding JSDoc comments, improving time complexity, and making the code more maintainable

- Delete this unused file

- Import generate from process-file.js instead of generate.js

* Added get-answer-from-files functionality and improved pull request summary

In this commit, we have added and updated four files in the GPT project, mainly focusing on creating a new get-answer-from-files feature and improving the pull-request.js file for better pull request summaries. Also, some new terminal commands are introduced for better user experience.

- Created a new file to handle getting answers from the files using the OpenAI completion stream.

- Implemented the getAnswer function which processes files' text and sends a chunked prompt to GPT completion stream for response.

- Created a new file for processing files, extracting text and creating embeddings.

- Implemented processFile function that takes the file path and processes the file to extract text and embeddings.

- Refactored the sendToGPTForSummary function to improve the handling of GPT responses.

- Added a check for user feedback and updated the function to handle completion stream chunks better.

- Removed some commented out code and improved the overall code structure for better readability.

- Created a new file for handling terminal commands and readline interface.

- Implemented the readline interface object for handling user input in the terminal.

* Refactor getValidJsonResponse and update dependencies

This commit refactors the getValidJsonResponse function to improve error handling and updates the dependencies in package.json.

- Refactor the getValidJsonResponse function for better error handling

- Move the stream creation and answer processing inside the try block

- Add filterStopwords constant with a default value of false

- Add new script command 'gpt:file:example'

- Add new script command 'gpt:file'

- Update dependencies: stopword, mime-types, mammoth, pdf-parse, node-html-markdown, form-data

* Update GPT model and improve completion and error handling

This commit updates the GPT model to GPT-4, adjusts the maximum tokens, and adds better completion and error handling.

- Change GPT model to 'gpt-4'

- Increase MAX_TOKENS from 4500 to 4600

- Uncomment 'throw err' for better error handling when processing files

- Create new openai.js file with updated completion methods and error handling

- Implement completionStream and embedding functions

- Add API key error checking

- Improve completion function with fallbacks

* Add services for text analysis and file search

Implemented multiple services for chunking large texts, creating embeddings, extracting text from different file formats, getting embeddings for text, and searching similar file chunks using cosine similarity.

- Added a function to split a given text into smaller pieces of roughly equal length without breaking words or punctuation.

- Implemented a function to create embeddings of given text, calculate the average of embeddings and return both the mean embedding and the individual chunk embeddings.

- Added a function to extract text content from various file formats such as PDF, DOCX, Markdown, CSV, HTML, Plain Text, and JavaScript files.

- Added a function to get embeddings for a given text by splitting the text into chunks and computing the embeddings in batch sizes.

- Implemented a function to search file chunks for those that are semantically similar to the search query using cosine similarity (dot product) and return the ranked results based on the similarity score.

* chore: lock file

* Add code generation & utility functions

This commit adds new code generation and utility functions to generate unit test code for a given Python function and description, search for the most semantically similar code chunks, and parse GPT responses.

- Create generateUnitTest function to generate unit test code for given Python code and description

- Export generateUnitTest function

- Add searchFileChunks function to search semantically similar code chunks for given search query and files

- Add isFileNameInString function to check if a file name is part of a given string

- Add parseGptResponse function to parse GPT response text into separate code blocks

- Export all utility functions

- Add script to test generateUnitTest function using command line arguments

* Refactor code, add response constant and update function behavior

This commit refactors the code, adds a response constant, and updates the behavior of the generateCommitMsg and createPrompt functions. The changes improve code consistency and readability, also enhancing user context when generating new suggestions.

- Refactor the code to declare oldDiff as a constant

- Update the generateCommitMsg function to include the response constant

- Modify the createPrompt function to conditionally include user feedback in chat history

- Add the response constant in the completion, completionStream, and createChatCompletion functions

- Remove console.log statement to improve code cleanliness

* Improve constants, file handling, and answer retrieval

This commit includes multiple code improvements and adjustments in the project, focusing on constants.js, file.js, and get-answer-from-files.js files. Additionally, it updates the package.json script.

- Update value of MAX_TOKENS to Infinity.

- Set showProgress to true.

- Add response end marker in JSON format.

- Replace hardcoded END_OF_RESPONSE with response end marker.

- Update prompt instructions for separating file sections.

- Add console log for chatHistory.

- Comment out unused code related to getLastItemInArray.

- Refactor getAnswer function to handle large files by splitting them into chunks.

- Create getAnswerFromStream function to handle individual chunks.

- Update response end marker check for errors.

- Add error handling and retry attempt in case response end marker is not found.

- Replace hardcoded END_OF_RESPONSE with response end marker.

- Update script for gpt:file:example.

* Add cosine similarity threshold constant and multiple code improvements

This commit introduces a new constant for the cosine similarity threshold and improves the overall code for better readability and functionality.

- Add COSINE_SIM_THRESHOLD constant for cosine similarity score threshold

- Update prompt string for better readability

- Add missing 'fs' module import

- Add 'model' constant from constants.js

- Add write stream to save the output to a file

- Pass question parameter to getAnswerFromStream function

- Move COSINE_SIM_THRESHOLD import to constants.js

- Remove file writing from parseGptResponse function

* Improved parsing of GPT responses and file handling

This commit improves the way GPT responses are parsed, file handling, and stream management, and refactors code in several files.

- Changed the import statement for 'getAnswer' to use destructuring

- Removed an unnecessary console.log call

- Added 'fs' import for handling file streams

- Imported 'normalizedFileName' and 'parseGptResponse' functions from 'services/utils.js'

- Modified 'getAnswer' function to better handle chunks and splitting files

- Refactored 'getAnswerFromStream' function to create and manage write streams for each file

- Exported 'getAnswer' function using an object to make importing it easier with destructuring

- Refactored 'parseGptResponse' function to improve handling of incoming chunks and file parsing

- Added 'chunkAggregator' to accumulate chunks before parsing

- Improved verification of file names in strings

* chore: lock file

* chore: lock file

* Add training prompt/target pairs generation and improve prompts

This commit introduces code to generate prompt and target pairs, improve the prompts using the GPT-4 model and write the updated prompts to a jsonl file.

- Add function generatePromptTargetPairs to iterate through the project directory and find code files with JSDoc comments

- Add function writeToJsonl to generate improved prompts and write the prompt/target pairs to a jsonl file

- Add comment-parser dependency for parsing JSDoc comments

* chore: lock file

* chore: update locks

* DX: add GPT helper

* Remove unused and commented code from async-pages-loader

This commit is focused on cleaning up the async-pages-loader file by removing unused and commented code blocks. This helps improve readability and maintainability of the code.

- Remove multiple return statements with commented code

- Delete unnecessary import statements

- Remove unused code blocks related to routing and loading of modules

* DX: add GPT helper

* Fix production build issue caused by optimization stages

This commit fixes a production build issue that occurred due to optimization stages. It updates the hooks, chunks and module loading process to resolve the problem.

- Update DEFAULT_SHARE_SCOPE settings

- Add import for 'react/jsx-runtime' to patch

- Refactor plugin to use updated hooks and optimization stages

- Update asset handling in processAssets hook

* Refactor loadScript and improve error handling

This commit refactors the loadScript function to create a new loadRemoteContainer function and improves error handling when loading a script fails.

- Refactor loadScript into loadScript and loadRemoteContainer for better separation of concerns

- Wrap asyncContainer in try-catch block for better error handling

- Create and return a fake container with a null factory when loading script fails

* Update scripts and apply server plugins

This commit updates the package.json scripts and modifies the applyServerPlugins function in the NextFederationPlugin.

- Update 'start:nextho' script to use 'nx run-many' instead of 'concurrently' for better consistency with other scripts

- Add 'delete compiler.options.optimization.splitChunks' to remove splitChunks optimization from the server compiler

* chore(utils): release version 1.7.4

* chore(node): release version 0.14.6

* chore(nextjs-mf): release version 6.4.1-beta.7

* fix: Improved Share Scope Properties and Fixed Production Build Issues (#884)

* chore(nextjs-mf): release version 6.4.1-beta.8

* thing

* fix: fixed production build issues

* fix: Prevent removal of external eager modules

This commit prevents the removal of eager modules that are external, improves the code by removing an unnecessary condition, and refactors test patterns for better readability.

- Removed unnecessary condition checking 'compiler.options.name === 'client' || true'

- Refactored 'test' patterns for better readability

- Prevented removal of external eager modules

* chore: update packscript

* Update default share scope properties

This commit updates the DEFAULT_SHARE_SCOPE and DEFAULT_SHARE_SCOPE_BROWSER objects in the internal.ts file. Modifications include setting the eager property for some shared dependencies and using direct reference instead of cloning the DEFAULT_SHARE_SCOPE object.

- Set eager property for 'react-dom' to false in DEFAULT_SHARE_SCOPE

- Change import property order for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

- Remove JSON clone process and use a direct reference of DEFAULT_SHARE_SCOPE in building DEFAULT_SHARE_SCOPE_BROWSER

- Set eager property to true for 'react', 'react-dom', and 'next/router' in DEFAULT_SHARE_SCOPE_BROWSER

* Fix incorrect string in if condition

This commit fixes an issue in the patchDefaultSharedLoader.ts file where the if condition check was using an incorrect string, which could result in skipping the intended patching process.

- Update the string in the if condition check from 'placeholderModuleEnsurepat' to 'placeholderModuleEnsure'

* Refactor loadScript and improve error handling

This commit refactors the loadScript function and improves error handling for offline containers. It also fixes type casting issues in the code.

- Fix type casting for remoteGlobal and containerKey

- Enable console.error statement for error logging when catching errors

- Refactor the loadScript function to improve readability and error handling

* chore: remove logs

* Refactor InvertedContainerRuntimeModule and remove console logs

This commit refactors the InvertedContainerRuntimeModule class and removes unnecessary console logs.

- Refactor class code for improved readability

- Remove unnecessary console logs

* chore(utils): release version 1.7.5-beta.0

* chore(utils): release version 1.7.5

* chore(node): release version 0.14.7-beta.0

* chore(utils): release version 1.7.6-beta.0

* chore(node): release version 0.14.7-beta.1

* chore(nextjs-mf): release version 6.4.1-beta.8

* chore(utils): release version 1.7.6-beta.1

* chore(node): release version 0.14.7-beta.2

* chore(nextjs-mf): release version 6.4.1-beta.8

* fix: remove old files

* chore(utils): release version 1.7.6-beta.2

* chore(node): release version 0.14.7-beta.3

* chore(nextjs-mf): release version 6.4.1-beta.8

* feat: remove entry injection

* chore(utils): release version 1.7.6-rc.0

* chore(node): release version 0.14.7-rc.0

* chore(nextjs-mf): release version 6.4.1-rc.0

* chore: back to beta tag

* update locks

* update locks

* fix(chunk-module-duplication): prevent runtime reset and share scope loss

This commit fixes the issue of chunk and module duplication that leads to runtime resetting or losing share scope.

- Changed 'eager' value of 'next/router' to false

- Created new noop.js file

- Changed 'debug' value to false

- Added new './noop' key-value pair in exposes

- Updated comment regarding remote entry requirement

- Added check for chunk.hasRuntime()

- Added rootOutputDir variable assignment

* refactor: Next.js Micro-Frontends code improvements

This commit covers code improvements for Next.js Micro-Frontends including JSONP chunk loading, page stitching and runtime optimizations.

- Changed title structure in JSON format

- Changed eager value in DEFAULT_SHARE_SCOPE

- Reordered imports and added conditional for development environment

- Deleted unused file

- Refactored getCustomJsonpCode function

- Replaced AddModulesPlugin with DelegateModulesPlugin

- Removed AddModulesPlugin and applied DelegatesModulePlugin

* chore(utils): release version 1.7.6-rc.1

* chore(node): release version 0.14.7-rc.1

* chore(nextjs-mf): release version 6.4.1-rc.1

* update locks

* refactor(apply-server-plugins): Update server plugin configurations and package.json exports

This commit updates the server plugin configurations in apply-server-plugins.ts and adds new exports in the package.json file of the node package.

- Change splitChunks optimization from false to undefined

- Add runtime chunk optimization configuration with 'webpack-runtime' as the name attribute value

- Add new exports for './src/' as an entry point in the package.json file

* chore(utils): release version 1.7.6-rc.2

* chore(node): release version 0.14.7-rc.2

* chore(nextjs-mf): release version 6.4.1-rc.2

* [chore] Update package.json and internal.ts

This commit includes modifications in package.json and internal.ts files. Changes improve the prelease:all script and adjust the 'react/jsx-runtime' properties.

- Update prerelease:all script with maxParallel=1 option to make releases safer by running tasks sequentially

- Change 'react/jsx-runtime' eager property from false to true for better performance

* fix: externalization and missing runtime chunks (#887)

* [fix] Resolve build issues at lululemon

This commit addresses the build issues occurring at lululemon by updating the handling of server externals and configuring server compiler options.

- Change import value for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

- Update handleServerExternals function to prevent build issues at lululemon

- Configure server compiler options to handle node builds and prevent conflicts

* refactor: Improve handling of Next.js and React modules

Refactors the module handling in the NextFederationPlugin to better distinguish modules from Next.js and React.

- Add conditions to handle modules starting with 'react-dom/'

- Include 'react' and 'react-dom' as exact matches

* chore(utils): release version 1.7.6-rc.3

* chore(node): release version 0.14.7-rc.3

* chore(nextjs-mf): release version 6.4.1-rc.3

* fix: resolve build hanging issue

This commit fixes an issue where the build hangs by enabling the 'named' value for the optimization.chunkIds. Also, redundant comments have been removed.

- Enabled 'named' value for optimization.chunkIds to fix build hanging issue

- Removed redundant comments

* chore(utils): release version 1.7.6-rc.4

* chore(node): release version 0.14.7-rc.4

* chore(nextjs-mf): release version 6.4.1-rc.4

* lint: handle fail remote

* fix: deprecation warnings about chunkGraph

* fix: missing chunk hashes on exposed modules (#893)

This commit fixes the missing chunk hashes on exposed modules in the micro-frontend federation system. It includes changes to the plugins and updates the federation-`noop.js 'to track modules and versions properly.

- Rename noop.js file to federation-noop.js

- Update compiler logic to replace 'contenthash' with 'fullhash'

- Change reference of 'noop.js' to 'federation-noop.js'

- Refactor server configuration

- Modify getExposedModules to use new module mapping

- Update getFederationStats function to use federationPluginOptions

- Minor changes

* fix: chunk and module duplications (#885)

* fix: chunk and module duplications

* fix: missing chunkid on build

* fix: missing chunkid on build

* fix: client prod build issues (#899)

* fix: client prod build issues

* chore: update locks

* fix: chunk flushing and general chunk loading improvements

Improve chunk flushing and general chunk loading by fixing various issues and code optimizations.

- Optimization fixes for chunkIds and splitChunks.

- Refactor and optimization, including runtimeChunk and splitChunks fixes.

- Update conditions for applying commonOptions in NextFederationPlugin.

- Minor code adjustments and formatting.

- Add flushChunks import, remove unnecessary code.

- Improve chunk filename local load logging and error handling.

- Refactors and improvements, including async loading/error handling.

- Add EXPORTS statement.

- Minor adjustments and improvements to error handling.

* refactor(commit.js): optimize diff fidelity

Reduces the diff fidelity in the case of a large number of tokens to optimize the commit message generation process.

- Changed the number of lines in unified diff (-U) from 5 to 4

- Updated warning message to show the reduction in diff fidelity

* chore(utils): release version 1.8.1-rc.0

* chore(utils): release version 1.8.1-rc.1

* chore(node): release version 0.15.2-rc.0

* chore(nextjs-mf): release version 6.5.2-rc.0

* build: Generate exports for packages

A new build script has been added to generate the 'exports' field for each package in the mono-repo. This will update each package.json with the correct export paths, making it easier to manage sub-directory imports.

- Add new build script to generate 'exports' field for each package in the mono-repo.

* chore: Improved Debug Output and Reduced Code Redundancy (#904)

* chore: update tsconfigs

* refactor: improve debug output and reduce code redundancy

This commit improves the debug output for better clarity and reduces code redundancy in various files.

- add getDiff function to handle diff reduction with correct max character count

- replace verbose with debug option

- refactor and improve code readability

- separate FlushedChunksProps type import

- replace verbose with debug option

- replace verbose with debug option

- comment out unused code block

- replace verbose with debug option

- replace verbose with debug option

- replace verbose with debug option

- add missing semicolon

* refactor: uncommented code in LoadFileChunkLoadingRuntimeModule.ts

This commit re-enables a chunk of code that was previously commented out, within the LoadFileChunkLoadingRuntimeModule classes.

- uncommented previously commented-out code related to initialChunkIds

* refactor: update moduleResolution in tsconfig.json

This commit updates the moduleResolution value from 'node16' to 'Node16' in tsconfig.json.

- updated moduleResolution value from 'node16' to 'Node16'

* chore: finish nx migraitons

* chore:update locks

* fix: remove specific module type from package

* fix:  Improved Entrypoint Module Detection and Refactoring (#932)

* fix: improve detection of entrypoint modules

Entrypoints can be many "NormalModule" types.

I want to exclude abnormal modules and search for entrypoints only

* refactor: remove use of deprecated entryModule

* chore: update Node.js version to 18 in GitHub actions

This commit updates the Node.js version used in GitHub actions for both pre-release and release workflows to 18, and adds a .nvmrc file with the updated Node.js version information.

- updated Node.js version to 18 in 'Use Node.js' step

- updated Node.js version to 18 in 'Use Node.js' step

- created the file

- added Node.js version 18

* chore: update locks

* chore: update .nvmrc, remove type, and clean up code

This commit updates the .nvmrc file to return the Node.js version, removes the 'type' property from two package.json files, and cleans up some of the code in LoadFileChunkLoadingRuntimeModule.

- Added Node.js version: v18.16.0

- Remove 'type' property

- Remove 'type' property

- Remove console.log statement

- Clean up some code

* refactor: change yarn to npm in scripts

This commit updates the package.json file to replace the usage of yarn with npm in the scripts section to maintain consistency and avoid potential issues when using different package managers.

- replace yarn with npm in gpt:file:example

- replace yarn with npm in start:next

- replace yarn with npm in start:nextho

- replace yarn with npm in serve:next

* refactor: remove legacy-peer-deps flag from npm ci command

This commit removes the --legacy-peer-deps flag from the npm ci commands in three GitHub workflow configuration files, simplifying the installation process and using the defaults for handling peer dependencies.

- Removed --legacy-peer-deps flag from npm ci command

- Removed --legacy-peer-deps flag from npm ci command

- Removed --legacy-peer-deps flag from npm ci command

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(node): release version 0.15.2-rc1.0

* chore(nextjs-mf): release version 6.5.2-rc1.0

* feat: support custom distDir

* fix: remove default props deprecation on flush chunks

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: Improve chunk correlation (#936)

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: remove memory waste

* refactor: remove unused ContainerStatsPlugin and clean up InvertedContainerPlugin

This commit removes an unused ContainerStatsPlugin file and cleans up debug code in InvertedContainerPlugin

- delete unused file

- remove debug code

* refactor: enhance correctImportPath functionality

This commit refactors the correctImportPath function to better handle various environments and improve code readability.

- wrapped function logic in a conditional check for window being undefined

- returned null if window is defined

- improved code readability by adjusting indentation

* chore(utils): release version 1.8.1-rc.2

* chore(utils): release version 1.8.1-rc.2

* chore(native-federation-typescript): release version 0.2.2-rc.0

* chore(utils): release version 1.8.1

* chore(utils): release version 1.8.2-beta.0

* chore(node): release version 0.15.2-beta.0

* chore(nextjs-mf): release version 6.5.2-beta.0

* fix: remove logs or wrap in debug flag (#959)

* chore(utils): release version 1.8.2-rc3.0

* chore(node): release version 0.15.2-rc3.0

* chore(nextjs-mf): release version 6.5.2-rc3.0

* fix: Path loader patches (#960)

* fix: re-enable image and url path patches

* fix: re-enable image and url path patches

* chore(utils): release version 1.8.2-rc3.1

* chore(node): release version 0.15.2-rc3.1

* chore(nextjs-mf): release version 6.5.2-rc3.1

* fix: Runtime module checking (#969)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: Resolve conditional exports (#971)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: resolve conditional exports

* fix: resolve conditional exports

* fix: Resolve condition names (#974)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: resolve conditional exports

* fix: resolve conditional exports

* fix: eager share link to prevent stalled boots

* chore(utils): release version 1.8.2-rc3.2

* chore(node): release version 0.15.2-rc3.2

* chore(nextjs-mf): release version 6.5.2-rc3.2

* fix: Api routes (#984)

* fix: skip api routes and runtime

prevents crashing for the time being by not applying any federation runtime inversion on the api runtime handler

* chore(utils): release version 1.8.2-rc4.0

* chore(node): release version 0.15.2-rc4.0

* chore(nextjs-mf): release version 6.5.2-rc4.0

* fix: Non-Deterministic Chunk ID Handling (#986)

* fix: address non-determinstic chunk id handling

* fix: address non-determinstic chunk id handling

* chore(utils): release version 1.8.2-rc5.0

* chore(node): release version 0.15.2-rc5.0

* chore(nextjs-mf): release version 6.5.2-rc5.0

* ci: allow empty release

* fix: remove loggers

* chore: update locks

* chore(utils): release version 1.8.2-rc.0

* chore(utils): release version 1.8.2-rc6.0

* chore(node): release version 0.15.2-rc6.0

* chore(nextjs-mf): release version 6.5.2-rc6.0

* fix: image path fallback

* chore(utils): release version 1.8.2-rc7.0

* chore(utils): release version 1.8.2-rc7.1

* chore(node): release version 0.15.2-rc7.0

* chore(nextjs-mf): release version 6.5.2-rc7.0

* fix: disable flushing remotes to ssr for now

* chore(utils): release version 1.8.2-rc8.0

* chore(node): release version 0.15.2-rc8.0

* chore(nextjs-mf): release version 6.5.2-rc8.0

* fix: disable flushing remotes to ssr for now

* fix: proxy get() module not passing all applied args to underlaying bound export (#1015)

* chore(utils): release version 1.8.2-rc8.0

* chore(node): release version 0.15.2-rc8.0

* chore(nextjs-mf): release version 6.5.2-rc8.0

* fix: disable flushing remotes to ssr for now

* docs: updat readme

* chore(utils): release version 1.8.2-rc8.1

* chore(utils): release version 1.8.2-rc8.2

* chore(node): release version 0.15.2-rc8.1

* chore(nextjs-mf): release version 6.5.2-rc8.1

* choew: update dps

* choew: update locks

* style:lints

* chore: patch from main

* tests: fix tests

* chore: update readme

* chore: update readme

* chore: update readme

* chore: update readme

* chore: tests

* style: tsignore

* fix: ts errors

* chore: fix nx building (#1086)

* chore: fix nx building

* chore: fix nx building

* chore: fix nx building

* fix: module type errors

* chore(utils): release version 1.9.2-rc.0

* chore(node): release version 0.16.3-rc.0

* chore(nextjs-mf): release version 6.7.2-rc.0

* feat: support edge workers

* feat: support edge workers (#1084)

* feat:  worker support

* feat: support edge workers

* feat: support edge workers

* fix: global refs to globalThis

* fix: global refs to globalThis

* fix: global refs to globalThis

* feat: backmerge prev edgeworker progress

* fix: use runInThisContext for remote containers

* fix: remove unused flush logic

* chore(utils): release version 1.9.2-rc.1

* chore(node): release version 0.16.3-rc.1

* chore(nextjs-mf): release version 6.7.2-rc.1

* Update packages/nextjs-mf/src/plugins/NextFederationPlugin/index.ts

Co-authored-by: Marcus Notheis <marcus.notheis@sap.com>

---------

Co-authored-by: Marcus Notheis <marcus.notheis@sap.com>
RussellCanfield added a commit to RussellCanfield/nextjs-mf that referenced this pull request Aug 26, 2023
* lint: fix test lint issue

* chore: disable tests for now

* chore: update packages

* chore: fix package scripts

* chore: update dep refs in apps

* chore: update dep refs in apps

* style: lint

* build: set nx dependOn orders

* build: set nx dependOn orders

* build: set nx dependOn orders

* chore(utils): release version 1.7.1-beta.0

* chore(utils): release version 1.7.1

* chore(node): release version 0.14.1-beta.0

* chore(node): release version 0.14.1

* chore(nextjs-mf): release version 6.4.1-beta.0

* fix: use [fullhash] if no hash exists / in development mode.

contenthash runtime module seems to be missing in server containers

* Update dependabot.yml

* revert dependabot change

* chore(node): release version 0.14.2-beta.0

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2-beta.2

* chore(node): release version 0.14.2-beta.1

* chore(node): release version 0.14.2

* chore(nextjs-mf): release version 6.4.1-beta.1

* update plugins

* fix: disable next chunk splits

* chore(nextjs-mf): release version 6.4.1-beta.2

* chore: fix package imports

* update plugins

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* chore: update locks

* chore(utils): release version 1.7.2-beta.0

* chore(utils): release version 1.7.2

* chore(node): release version 0.14.3-beta.0

* chore(node): release version 0.14.3

* chore(nextjs-mf): release version 6.4.1-beta.3

* chore: update nx

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* feat: [v7] Async boundary runtime (#835)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* chore: fix project.json

* debugging

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* fix: resolve backmerge issues (#871)

* feat: install an async boundary runtime module

makes next async at startup. Effectively resolving any and all support issues.

* fix: improve startup inversion

* fix: improve eager modularization

* refactor: improve jsonp loading

* feat: eager load initial consumes

* fix: improve module and async module loading in runtmie module

* chore: move LoadDependenciesTemplate to own file, write tests

* chore: fix logs

* fix: improve stability of chunk push

* fix: prevent hmr destroying share scope

* fix: implement exact version resolution

* chore: move runtime module to single file again

* chore: remove dead hooks

* feat: [7] Async boundary runtime server (#851)

* feat: server async runtime boundary

- using inverse startup initialization to queue incoming require calls to entry points, await webpack to initialize and resolve share scope, then replay / resume execution of next/entrypoints.

- also patched an issue with HMR that caused share scope to tear server side. next deletes require cache too, in order to hmr, when they do that they also re-require webpack, which clears in memory share scope. To solve this, when detecting that share scope has torn, i clear the memory namespace i designated for remotes to attach to.
This will cause webpack to re-negotiate share scope with containers, sync, then push updated entry back into next.

* feat: support eager containers

* feat: async on server

* chore: Tear free async sharing (#864)

* feat: tear-free share scope!

* chore: begin cleanup

* feat: client use server inverter method

* feat: client using new chunk effect tracking

* fix: withstand module invalidation

* chore: add debug code

* fix: remove automaticAsyncBoundary options

* fix: dont crash on hasJsMatcher runtime module

* feat: consolidate async startup design

- using same central runtime modules for server and browser
- use scope persistence and inner container

* fix: enable embedded container in host runtime

* chore: remove async boundary options

* refactor: move methods from async inverter to inverted container plugin

* chore: remove old deps

* feat: remove automatic async boundary

BREAKING CHANGE: automaticAsyncBoundary option has been removed

* fix: exclude specific pages from page map automatically

* refactor: conslidate codebase

* fix: improve hot reload share recovery

* refactor: remove server jsonp template

* chore: remove dead code from runtime modules

* fix: clean up jsonp getCustomJsonpCode

getting chunk loading global from compiler output options

* feat: adding cleanInitArrays runtime helper

* chore: remove share scope hoist and module hoisting system

* chore: cleanup code

* chore: remove dead code from add module runtime plugin

likely can remove whole plugin in future

* chore: remove logs from delegate modules

* chore: remove old utils

* fix: add warning on auto page stitch

* fix: remove commented out code from InvertedContainerPlugin.ts

* chore: improve logging to see if its local load or remote load

* chore: clean up old custom promises factories

* fix: remove container proxy code

* fix: remove container proxy code

* fix: resolve backmerge issues with build

* Merge branch 'kill_child_compilers' into fix_backmerge_issues

* feat: enable eager sharing

* refactor: improve module hooks for eager loading and search

* refactor: cleanup custom jsonp and make es5

* refactor: cleanup inverted container code

* refactor: cleanup inverted container code

* ci: fix install step with npm and NX

* test: remove tests for now

* chore(utils): release version 1.7.3-beta.0

* chore(utils): release version 1.7.3

* chore(node): release version 0.14.4-beta.0

* chore(node): release version 0.14.4

* chore(nextjs-mf): release version 6.4.1-beta.4

* fix: remove debugging runtime variable

* chore(nextjs-mf): release version 6.4.1-beta.5

* feat: Quantum Modules (#872)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* locks

* chore(node): release version 0.14.5-beta.0

* chore(node): release version 0.14.5

* chore(nextjs-mf): release version 6.4.1-beta.6

* chore: lock file

* fix: ensure eager modules always exist in host (inject dependent modules somewhere in build pipeline)

* DX: Add GPT module and command-line interface (#875)

* feat: Quantum Modules

Shared modules that can coexist as both eager and lazy/external within on module graph.

To the "host" eager sharing keeps next/react and so on in main.

to the remote, this eager module reference is removed, along with the "provide shared" module reference which is responsible for registering that dependency on share scope.

Doing so makes the remote container aleays consume react, but never register it nor try to load its fallback/eager reference which is removed.

In the future, Quantum modules could create ConsumeSharedModule dependencies to actually offer lazy backups to the remote, but eager provide in the host.

* fix: implement promise queue cleanup

* feat: RemoveEagerModulesFromRuntimePlugin

* chore: adding AI commit helper

* chore: adding AI commit helper

* chore: adding AI commit helper

* Refactor InvertedContainerPlugin to use runtimeTemplate and add fancyTemplate

This commit refactors the InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks(). It also adds a fancyTemplate to improve the readability of the code. The changes made to the code include:

- Refactor InvertedContainerPlugin to use runtimeTemplate instead of javascript.JavascriptModulesPlugin.getCompilationHooks()
- Add fancyTemplate to improve code readability

* Add functionality to generate and commit markdown-formatted commit messages

This commit adds a new functionality to generate and commit markdown-formatted commit messages. The commit message generation is handled by OpenAI's GPT-3 and the markdown formatting is handled by the  library. The commit message generator prompts the user for a title and description of the changes made, as well as a list of files and their changes. The user is then given the option to accept or reject the generated commit message. If accepted, the commit is automatically made with the generated message.

- Added  and  functions from  to encode the commit message prompt for OpenAI's GPT-3
- Added the  module from  to render markdown in the terminal
- Added a function  to generate the commit message prompt and display the changes made to each file
- Refactored the  function to use the  function and encode the prompt using  and
- Added error handling for missing  environment variable
- Refactored the  function to create a more readable markdown message
- Added a function  to commit the changes using
- Modified the  function to check if there are any changes to commit before running
- Modified the  function to use the  function to commit the changes if the user accepts the generated commit message
- Added a call to  to render the generated commit message in the terminal

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:\n- Added 'OpenAIStream.js'\n- Added 'ai.js'\n- Added 'commit.js'\n- Added 'file.js'\n- Added 'generate.js'\n- Moved 'gpt.js' to 'gpt/gpt.js'\n- Added 'index.js'\n- Added 'markdown.js'\n- Added 'pull-request.js'\n\nThe 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.\n\n### OpenAIStream.js\n\n- Added file 'OpenAIStream.js'\n\n### ai.js\n\n- Added file 'ai.js'\n\n### commit.js\n\n- Added file 'commit.js'\n\n### file.js\n\n- Added file 'file.js'\n\n### generate.js\n\n- Added file 'generate.js'\n\n### gpt.js\n\n- Moved 'gpt.js' to 'gpt/gpt.js'\n\n### index.js\n\n- Added file 'index.js'\n- Implemented command-line interface with options '--pr' and '--commit'\n\n### markdown.js\n\n- Added file 'markdown.js'\n\n### pull-request.js\n\n- Added file 'pull-request.js'

* Add function for sending prompt to GPT model and exposing utilities as module exports, we did.

Add a new function called sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback. Also, expose the utilities readline and chatHistory as module exports, we did.\n\n### gpt/ai.js\n\n- Add function sendPromptToGPT that takes in 3 parameters, role (default is 'assistant'), prompt and userFeedback, we did.\n- Expose readline and chatHistory as module exports, we did.

* Add generative commit message capability using GPT-3 model

This commit adds the ability to generate a commit message for code changes using the GPT-3 model. The message is generated from a diff of the staged files, and includes a title, description, and change set for each file. If the diff is too long, it is truncated. If there are no files staged for commit, an error message is displayed. The message is displayed as markdown and can be accepted or rejected by the user. If rejected, a new message is generated with user feedback.\n\n### gpt/ai.js\n\n- Changed the sendPromptToGPT function to allow an optional feedback param that can be used to include user feedback in the prompt when one is not already present.\n- Added usage logs in the sendPromptToGPT function.\n- Added a yargs check for the message passed in as a command argument.\n- Altered the returned content of the sendPromptToGPT function to be the entire output stream.\n- Added readline module and chatHistory array to the exports of the module.\n\n### gpt/commit.js\n\n- Added functions createPrompt, getValidJsonResponse, generateCommitMsg, createMarkdownCommit, and gitCommit to the module exports.\n- Added a schema constant as a stringified JSON object to be used as a guide for the JSON responses to prompts.\n- Created createPrompt function to generate the prompt for the GPT-3 model, given a string input and a feedback string.\n- Created getValidJsonResponse function to handle JSON parsing errors from the GPT-3 response, and returns a correctly formatted response.\n- Created generateCommitMsg function to retrieve a commit message object from the GPT-3 model, given staged changes and optional user feedback.\n- Created createMarkdownCommit function to format the commit message object as a markdown string.\n- Created gitCommit function to execute a git commit command with provided title and body as messages.\n- Created runGenerativeCommit function to orchestrate prompting the user and executing the git commit command.

* Add OpenAIStream function and configure markdown

This commit adds an  function for streaming API and also configures  to use  as the renderer.\n\n### gpt/OpenAIStream.js\n\n- Added  function to consume OpenAI's chat API over stream, parsing the stream into multiple chunks and invoking an event for each SSE event stream.\n- Provided a callback to call with the chunk of text returned from the API.\n\n### gpt/markdown.js\n\n- Configured  to use  as the renderer.\n- Defined custom renderer to colorize headings using  package.

* Add function to generate markdown summary of commit messages

This commit adds a new function called createLogMarkdownPrompt that creates prompts for the AI to summarize commits as markdown. It also adds a function called createMarkdownSummary that takes in an AI generated summary of commits and returns a markdown formatted summary. Lastly, it adds a generatePullRequestSummary function that takes user feedback, calls the createLogMarkdownPrompt function to create a prompt for the AI, sends it to the AI for processing, then formats and returns the summary using the createMarkdownSummary function.\n\n### gpt/pull-request.js\n\n- Added function called createLogMarkdownPrompt to create prompts for the AI to summarize commits as markdown\n- Added function called createMarkdownSummary to take in an AI generated summary of commits and return a markdown formatted summary\n- Added generatePullRequestSummary function to takes user feedback, call the createLogMarkdownPrompt function to create a prompt for the AI, send it to the AI for processing, then format and return the summary using the createMarkdownSummary function

* Refactor gitCommit function to use commandJoin

Refactored the gitCommit function to use the `commandJoin` package to create the git command. This replaces the need for string interpolation and manual escaping. Also removed unnecessary console.log statement.

- Updated gitCommit function to use commandJoin package
- Replaced string interpolation and manual escaping with `commandJoin` package. Removed unnecessary console log.

* Add GPT-3 stream handler

This commit adds a new handler function to stream chat messages to GPT-3. It also includes the necessary helper functions to prepare the input and output data for the API call.

- Added `getMessagesPrompt`, `readChunks`, and `readChunksBlocking` functions to enable streaming the message history to GPT-3.
- Added `handler` function as the main entry point for streaming chat messages to GPT-3.
- Exposed the `chatHistory` Set object to keep track of chat messages.

* Improve message generation in gpt/generate.js

This commit includes changes in gpt/generate.js file, improving the message generation's quality. It also adds some additional language to help the user feel more relaxed during conversations.

- Removed unnecessary pre_prompt variable.
- Improved getMessagesPrompt function to provide better suggestions for starting the conversation and to make the language more natural for the user.
- Refactored getMessagesPrompt function to include the role of the message.
- Replaced hardcoded strings with variables for better maintainability.

* Add GPT module and command-line interface

This commit adds the GPT module to the project and implements a command-line interface for generating commits and summaries for pull requests. The changes include:
- Added 'OpenAIStream.js'
- Added 'ai.js'
- Added 'commit.js'
- Added 'file.js'
- Added 'generate.js'
- Moved 'gpt.js' to 'gpt/gpt.js'
- Added 'index.js'
- Added 'markdown.js'
- Added 'pull-request.js'

The 'index.js' file implements a command-line interface with two options: '--pr' and '--commit'. The '--pr' option generates a summary of all pull requests in the repository, while the '--commit' option generates a commit message using the GPT model.

- Added file 'OpenAIStream.js'

- Added file 'ai.js'

- Added file 'commit.js'

- Added file 'file.js'

- Added file 'generate.js'

- Moved 'gpt.js' to 'gpt/gpt.js'

- Added file 'index.js'
- Implemented command-line interface with options '--pr' and '--commit'

- Added file 'markdown.js'

- Added file 'pull-request.js'

* Remove simple-git package and fix commit script

This commit removes the simple-git package by removing its dependency and all of its references from the code. The commit message fix script has also been modified to exclude simple-git commits. The fixCommitMessages function was updated to remove calls to simple-git related functions.

- Removed "simple-git" from devDependencies

- Removed simple-git reference

- Removed simple-git import and function calls

* Improve commit message generation and add file processing features

This commit includes an enhancement to the existing commit message generation functionality and introduces new utility functions related to file processing.

- Refactor getValidJsonResponse function by adding try-catch block for JSON parsing

- Add logic for handling truncated JSON responses by following up with GPT-3 model

- Remove unused debugger statement

- Add new file processing utility functions: uploadFile, getFileStatus, and useFileInCompletion

- Implement main function for running file processing tasks

- Create new empty file for future implementation

- Create new empty file for future implementation

- Create new empty file for future implementation

* Refactor ai.js to update gpt stream, model and usage

This commit refactors the `ai.js` file to make several changes related to the GPT stream, the model used and its usage.

- Update the model in the encoding_for_model function call to use the 'model' variable instead of the hardcoded string 'gpt-3.5-turbo'

- Move the assignment of the gptStream and content variables after the usage console output

- Remove an unnecessary line of whitespace

* Add search functionality to file chunks

This commit adds search functionality to file chunks, allowing users to search through their files, find matches and display the results.

- Update code formatting in the response section of sendToGPTForSummary function and add a user feedback section if available.

- Create a new file to implement search functionality for file chunks.

- Add a searchChunks function that takes searchQuery, files and maxResults as input and returns the search results using the searchFileChunks service.

* Refactor OpenAIStream and add constants file

This commit refactors the OpenAIStream.js file to simplify the code and improve readability. It also adds a new constants.js file.

- Refactor the OpenAIStream function to use the completionStream function from the services/openai module

- Remove unnecessary imports and variables

- Simplify the for-await loop to directly call the onChunk callback with the received chunk

- Create a new constants.js file

* Refactor gpt/ai.js and add gpt/constants.js

This commit refactors the gpt/ai.js file and adds a new gpt/constants.js file to better organize the code and improve maintainability.

- Move MAX_CHAR_COUNT constant to gpt/constants.js

- Update imports to include constants and generate modules separately

- Remove unnecessary MAX_CHAR_COUNT export

- Create new constants.js file

- Add pre_prompt, chatHistory, model, MAX_FILES_LENGTH, MAX_TOKENS, showProgress, and MAX_CHAR_COUNT constants

* Refactor ai.js and update dependencies

This commit refactors the ai.js file, removing unnecessary imports and updating the way GPT-3 completions are fetched. It also updates the constants imported to reflect the changes.

- Remove unnecessary imports such as yargs, child_process, node-fetch, and others

- Update the import of completionStream from the services/openai module

- Replace the usage of streamGPT with the new completionStream function

- Remove the chatgptApiEndpoint and chatgptApiKey variables as they are no longer needed

- Update the import of MAX_TOKENS from the constants module

- Refactor the sendPromptToGPT function to use the new completionStream function

- Update the module.exports to only export sendPromptToGPT and readline

* Refactor and improve format consistency in commit.js

This commit introduces several modifications to commit.js, primarily focusing on refactoring the code, improving readability, and enhancing the format consistency of the generated commit messages.

- Refactor getValidJsonResponse function to use async generator

- Update createPrompt to use a more user-friendly format and include additional context

- Replace instances of 'readline' with 'rl', and enhance error handling

- Simplify generateCommitMsg by using the async generator getValidJsonResponse

- Remove commented-out code

- Improve error messages and logging throughout the file

- Adjust schema string for readability

* Code changes have been made, hmmmmmm.

In this commit, improvements we see. The generateCommitMsg function is refined and userFeedback parameter is gone. Diff precision adapts to character count. Read below, you must.

- UserFeedback parameter removed from generateCommitMsg function.

- Added a method to reduce the fidelity of the diff when exceeding max character count.

* Refactor commit.js and update dependencies

This commit refactors the commit.js file, updates package dependencies, and streamlines the code for better readability and maintainability.

- Refactor readline import for better consistency

- Update usage of readline to use the refactored import

- Remove redundant readline.createInterface()

- Refactor runGenerativeCommit() for better code readability and maintainability

- Remove unnecessary spacing between lines

- Update yargs to latest version

- Update chalk to latest version

- Update tiktoken to latest version

* Refactor code and remove unused files

This commit performs several tasks in multiple files, including code refactoring for maintainability, improving time complexity, adding JSDoc comments, implementing optimizations, and removing unused code/files.

- Delete this unused file

- Delete this unused file

- Add MAIN_BRANCH constant import from constants.js

- Refactor the model from 'gpt-3.5-turbo' to 'gpt-4'

- Add MAIN_BRANCH constant as 'quantum_modules'

- Update MAX_TOKENS constant value to 4500

- Refactor and improve the entire file by implementing optimizations, adding JSDoc comments, improving time complexity, and making the code more maintainable

- Delete this unused file

- Import generate from process-file.js instead of generate.js

* Added get-answer-from-files functionality and improved pull request summary

In this commit, we have added and updated four files in the GPT project, mainly focusing on creating a new get-answer-from-files feature and improving the pull-request.js file for better pull request summaries. Also, some new terminal commands are introduced for better user experience.

- Created a new file to handle getting answers from the files using the OpenAI completion stream.

- Implemented the getAnswer function which processes files' text and sends a chunked prompt to GPT completion stream for response.

- Created a new file for processing files, extracting text and creating embeddings.

- Implemented processFile function that takes the file path and processes the file to extract text and embeddings.

- Refactored the sendToGPTForSummary function to improve the handling of GPT responses.

- Added a check for user feedback and updated the function to handle completion stream chunks better.

- Removed some commented out code and improved the overall code structure for better readability.

- Created a new file for handling terminal commands and readline interface.

- Implemented the readline interface object for handling user input in the terminal.

* Refactor getValidJsonResponse and update dependencies

This commit refactors the getValidJsonResponse function to improve error handling and updates the dependencies in package.json.

- Refactor the getValidJsonResponse function for better error handling

- Move the stream creation and answer processing inside the try block

- Add filterStopwords constant with a default value of false

- Add new script command 'gpt:file:example'

- Add new script command 'gpt:file'

- Update dependencies: stopword, mime-types, mammoth, pdf-parse, node-html-markdown, form-data

* Update GPT model and improve completion and error handling

This commit updates the GPT model to GPT-4, adjusts the maximum tokens, and adds better completion and error handling.

- Change GPT model to 'gpt-4'

- Increase MAX_TOKENS from 4500 to 4600

- Uncomment 'throw err' for better error handling when processing files

- Create new openai.js file with updated completion methods and error handling

- Implement completionStream and embedding functions

- Add API key error checking

- Improve completion function with fallbacks

* Add services for text analysis and file search

Implemented multiple services for chunking large texts, creating embeddings, extracting text from different file formats, getting embeddings for text, and searching similar file chunks using cosine similarity.

- Added a function to split a given text into smaller pieces of roughly equal length without breaking words or punctuation.

- Implemented a function to create embeddings of given text, calculate the average of embeddings and return both the mean embedding and the individual chunk embeddings.

- Added a function to extract text content from various file formats such as PDF, DOCX, Markdown, CSV, HTML, Plain Text, and JavaScript files.

- Added a function to get embeddings for a given text by splitting the text into chunks and computing the embeddings in batch sizes.

- Implemented a function to search file chunks for those that are semantically similar to the search query using cosine similarity (dot product) and return the ranked results based on the similarity score.

* chore: lock file

* Add code generation & utility functions

This commit adds new code generation and utility functions to generate unit test code for a given Python function and description, search for the most semantically similar code chunks, and parse GPT responses.

- Create generateUnitTest function to generate unit test code for given Python code and description

- Export generateUnitTest function

- Add searchFileChunks function to search semantically similar code chunks for given search query and files

- Add isFileNameInString function to check if a file name is part of a given string

- Add parseGptResponse function to parse GPT response text into separate code blocks

- Export all utility functions

- Add script to test generateUnitTest function using command line arguments

* Refactor code, add response constant and update function behavior

This commit refactors the code, adds a response constant, and updates the behavior of the generateCommitMsg and createPrompt functions. The changes improve code consistency and readability, also enhancing user context when generating new suggestions.

- Refactor the code to declare oldDiff as a constant

- Update the generateCommitMsg function to include the response constant

- Modify the createPrompt function to conditionally include user feedback in chat history

- Add the response constant in the completion, completionStream, and createChatCompletion functions

- Remove console.log statement to improve code cleanliness

* Improve constants, file handling, and answer retrieval

This commit includes multiple code improvements and adjustments in the project, focusing on constants.js, file.js, and get-answer-from-files.js files. Additionally, it updates the package.json script.

- Update value of MAX_TOKENS to Infinity.

- Set showProgress to true.

- Add response end marker in JSON format.

- Replace hardcoded END_OF_RESPONSE with response end marker.

- Update prompt instructions for separating file sections.

- Add console log for chatHistory.

- Comment out unused code related to getLastItemInArray.

- Refactor getAnswer function to handle large files by splitting them into chunks.

- Create getAnswerFromStream function to handle individual chunks.

- Update response end marker check for errors.

- Add error handling and retry attempt in case response end marker is not found.

- Replace hardcoded END_OF_RESPONSE with response end marker.

- Update script for gpt:file:example.

* Add cosine similarity threshold constant and multiple code improvements

This commit introduces a new constant for the cosine similarity threshold and improves the overall code for better readability and functionality.

- Add COSINE_SIM_THRESHOLD constant for cosine similarity score threshold

- Update prompt string for better readability

- Add missing 'fs' module import

- Add 'model' constant from constants.js

- Add write stream to save the output to a file

- Pass question parameter to getAnswerFromStream function

- Move COSINE_SIM_THRESHOLD import to constants.js

- Remove file writing from parseGptResponse function

* Improved parsing of GPT responses and file handling

This commit improves the way GPT responses are parsed, file handling, and stream management, and refactors code in several files.

- Changed the import statement for 'getAnswer' to use destructuring

- Removed an unnecessary console.log call

- Added 'fs' import for handling file streams

- Imported 'normalizedFileName' and 'parseGptResponse' functions from 'services/utils.js'

- Modified 'getAnswer' function to better handle chunks and splitting files

- Refactored 'getAnswerFromStream' function to create and manage write streams for each file

- Exported 'getAnswer' function using an object to make importing it easier with destructuring

- Refactored 'parseGptResponse' function to improve handling of incoming chunks and file parsing

- Added 'chunkAggregator' to accumulate chunks before parsing

- Improved verification of file names in strings

* chore: lock file

* chore: lock file

* Add training prompt/target pairs generation and improve prompts

This commit introduces code to generate prompt and target pairs, improve the prompts using the GPT-4 model and write the updated prompts to a jsonl file.

- Add function generatePromptTargetPairs to iterate through the project directory and find code files with JSDoc comments

- Add function writeToJsonl to generate improved prompts and write the prompt/target pairs to a jsonl file

- Add comment-parser dependency for parsing JSDoc comments

* chore: lock file

* chore: update locks

* DX: add GPT helper

* Remove unused and commented code from async-pages-loader

This commit is focused on cleaning up the async-pages-loader file by removing unused and commented code blocks. This helps improve readability and maintainability of the code.

- Remove multiple return statements with commented code

- Delete unnecessary import statements

- Remove unused code blocks related to routing and loading of modules

* DX: add GPT helper

* Fix production build issue caused by optimization stages

This commit fixes a production build issue that occurred due to optimization stages. It updates the hooks, chunks and module loading process to resolve the problem.

- Update DEFAULT_SHARE_SCOPE settings

- Add import for 'react/jsx-runtime' to patch

- Refactor plugin to use updated hooks and optimization stages

- Update asset handling in processAssets hook

* Refactor loadScript and improve error handling

This commit refactors the loadScript function to create a new loadRemoteContainer function and improves error handling when loading a script fails.

- Refactor loadScript into loadScript and loadRemoteContainer for better separation of concerns

- Wrap asyncContainer in try-catch block for better error handling

- Create and return a fake container with a null factory when loading script fails

* Update scripts and apply server plugins

This commit updates the package.json scripts and modifies the applyServerPlugins function in the NextFederationPlugin.

- Update 'start:nextho' script to use 'nx run-many' instead of 'concurrently' for better consistency with other scripts

- Add 'delete compiler.options.optimization.splitChunks' to remove splitChunks optimization from the server compiler

* chore(utils): release version 1.7.4

* chore(node): release version 0.14.6

* chore(nextjs-mf): release version 6.4.1-beta.7

* fix: Improved Share Scope Properties and Fixed Production Build Issues (#884)

* chore(nextjs-mf): release version 6.4.1-beta.8

* thing

* fix: fixed production build issues

* fix: Prevent removal of external eager modules

This commit prevents the removal of eager modules that are external, improves the code by removing an unnecessary condition, and refactors test patterns for better readability.

- Removed unnecessary condition checking 'compiler.options.name === 'client' || true'

- Refactored 'test' patterns for better readability

- Prevented removal of external eager modules

* chore: update packscript

* Update default share scope properties

This commit updates the DEFAULT_SHARE_SCOPE and DEFAULT_SHARE_SCOPE_BROWSER objects in the internal.ts file. Modifications include setting the eager property for some shared dependencies and using direct reference instead of cloning the DEFAULT_SHARE_SCOPE object.

- Set eager property for 'react-dom' to false in DEFAULT_SHARE_SCOPE

- Change import property order for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

- Remove JSON clone process and use a direct reference of DEFAULT_SHARE_SCOPE in building DEFAULT_SHARE_SCOPE_BROWSER

- Set eager property to true for 'react', 'react-dom', and 'next/router' in DEFAULT_SHARE_SCOPE_BROWSER

* Fix incorrect string in if condition

This commit fixes an issue in the patchDefaultSharedLoader.ts file where the if condition check was using an incorrect string, which could result in skipping the intended patching process.

- Update the string in the if condition check from 'placeholderModuleEnsurepat' to 'placeholderModuleEnsure'

* Refactor loadScript and improve error handling

This commit refactors the loadScript function and improves error handling for offline containers. It also fixes type casting issues in the code.

- Fix type casting for remoteGlobal and containerKey

- Enable console.error statement for error logging when catching errors

- Refactor the loadScript function to improve readability and error handling

* chore: remove logs

* Refactor InvertedContainerRuntimeModule and remove console logs

This commit refactors the InvertedContainerRuntimeModule class and removes unnecessary console logs.

- Refactor class code for improved readability

- Remove unnecessary console logs

* chore(utils): release version 1.7.5-beta.0

* chore(utils): release version 1.7.5

* chore(node): release version 0.14.7-beta.0

* chore(utils): release version 1.7.6-beta.0

* chore(node): release version 0.14.7-beta.1

* chore(nextjs-mf): release version 6.4.1-beta.8

* chore(utils): release version 1.7.6-beta.1

* chore(node): release version 0.14.7-beta.2

* chore(nextjs-mf): release version 6.4.1-beta.8

* fix: remove old files

* chore(utils): release version 1.7.6-beta.2

* chore(node): release version 0.14.7-beta.3

* chore(nextjs-mf): release version 6.4.1-beta.8

* feat: remove entry injection

* chore(utils): release version 1.7.6-rc.0

* chore(node): release version 0.14.7-rc.0

* chore(nextjs-mf): release version 6.4.1-rc.0

* chore: back to beta tag

* update locks

* update locks

* fix(chunk-module-duplication): prevent runtime reset and share scope loss

This commit fixes the issue of chunk and module duplication that leads to runtime resetting or losing share scope.

- Changed 'eager' value of 'next/router' to false

- Created new noop.js file

- Changed 'debug' value to false

- Added new './noop' key-value pair in exposes

- Updated comment regarding remote entry requirement

- Added check for chunk.hasRuntime()

- Added rootOutputDir variable assignment

* refactor: Next.js Micro-Frontends code improvements

This commit covers code improvements for Next.js Micro-Frontends including JSONP chunk loading, page stitching and runtime optimizations.

- Changed title structure in JSON format

- Changed eager value in DEFAULT_SHARE_SCOPE

- Reordered imports and added conditional for development environment

- Deleted unused file

- Refactored getCustomJsonpCode function

- Replaced AddModulesPlugin with DelegateModulesPlugin

- Removed AddModulesPlugin and applied DelegatesModulePlugin

* chore(utils): release version 1.7.6-rc.1

* chore(node): release version 0.14.7-rc.1

* chore(nextjs-mf): release version 6.4.1-rc.1

* update locks

* refactor(apply-server-plugins): Update server plugin configurations and package.json exports

This commit updates the server plugin configurations in apply-server-plugins.ts and adds new exports in the package.json file of the node package.

- Change splitChunks optimization from false to undefined

- Add runtime chunk optimization configuration with 'webpack-runtime' as the name attribute value

- Add new exports for './src/' as an entry point in the package.json file

* chore(utils): release version 1.7.6-rc.2

* chore(node): release version 0.14.7-rc.2

* chore(nextjs-mf): release version 6.4.1-rc.2

* [chore] Update package.json and internal.ts

This commit includes modifications in package.json and internal.ts files. Changes improve the prelease:all script and adjust the 'react/jsx-runtime' properties.

- Update prerelease:all script with maxParallel=1 option to make releases safer by running tasks sequentially

- Change 'react/jsx-runtime' eager property from false to true for better performance

* fix: externalization and missing runtime chunks (#887)

* [fix] Resolve build issues at lululemon

This commit addresses the build issues occurring at lululemon by updating the handling of server externals and configuring server compiler options.

- Change import value for 'react/jsx-runtime' in DEFAULT_SHARE_SCOPE

- Update handleServerExternals function to prevent build issues at lululemon

- Configure server compiler options to handle node builds and prevent conflicts

* refactor: Improve handling of Next.js and React modules

Refactors the module handling in the NextFederationPlugin to better distinguish modules from Next.js and React.

- Add conditions to handle modules starting with 'react-dom/'

- Include 'react' and 'react-dom' as exact matches

* chore(utils): release version 1.7.6-rc.3

* chore(node): release version 0.14.7-rc.3

* chore(nextjs-mf): release version 6.4.1-rc.3

* fix: resolve build hanging issue

This commit fixes an issue where the build hangs by enabling the 'named' value for the optimization.chunkIds. Also, redundant comments have been removed.

- Enabled 'named' value for optimization.chunkIds to fix build hanging issue

- Removed redundant comments

* chore(utils): release version 1.7.6-rc.4

* chore(node): release version 0.14.7-rc.4

* chore(nextjs-mf): release version 6.4.1-rc.4

* lint: handle fail remote

* fix: deprecation warnings about chunkGraph

* fix: missing chunk hashes on exposed modules (#893)

This commit fixes the missing chunk hashes on exposed modules in the micro-frontend federation system. It includes changes to the plugins and updates the federation-`noop.js 'to track modules and versions properly.

- Rename noop.js file to federation-noop.js

- Update compiler logic to replace 'contenthash' with 'fullhash'

- Change reference of 'noop.js' to 'federation-noop.js'

- Refactor server configuration

- Modify getExposedModules to use new module mapping

- Update getFederationStats function to use federationPluginOptions

- Minor changes

* fix: chunk and module duplications (#885)

* fix: chunk and module duplications

* fix: missing chunkid on build

* fix: missing chunkid on build

* fix: client prod build issues (#899)

* fix: client prod build issues

* chore: update locks

* fix: chunk flushing and general chunk loading improvements

Improve chunk flushing and general chunk loading by fixing various issues and code optimizations.

- Optimization fixes for chunkIds and splitChunks.

- Refactor and optimization, including runtimeChunk and splitChunks fixes.

- Update conditions for applying commonOptions in NextFederationPlugin.

- Minor code adjustments and formatting.

- Add flushChunks import, remove unnecessary code.

- Improve chunk filename local load logging and error handling.

- Refactors and improvements, including async loading/error handling.

- Add EXPORTS statement.

- Minor adjustments and improvements to error handling.

* refactor(commit.js): optimize diff fidelity

Reduces the diff fidelity in the case of a large number of tokens to optimize the commit message generation process.

- Changed the number of lines in unified diff (-U) from 5 to 4

- Updated warning message to show the reduction in diff fidelity

* chore(utils): release version 1.8.1-rc.0

* chore(utils): release version 1.8.1-rc.1

* chore(node): release version 0.15.2-rc.0

* chore(nextjs-mf): release version 6.5.2-rc.0

* build: Generate exports for packages

A new build script has been added to generate the 'exports' field for each package in the mono-repo. This will update each package.json with the correct export paths, making it easier to manage sub-directory imports.

- Add new build script to generate 'exports' field for each package in the mono-repo.

* chore: Improved Debug Output and Reduced Code Redundancy (#904)

* chore: update tsconfigs

* refactor: improve debug output and reduce code redundancy

This commit improves the debug output for better clarity and reduces code redundancy in various files.

- add getDiff function to handle diff reduction with correct max character count

- replace verbose with debug option

- refactor and improve code readability

- separate FlushedChunksProps type import

- replace verbose with debug option

- replace verbose with debug option

- comment out unused code block

- replace verbose with debug option

- replace verbose with debug option

- replace verbose with debug option

- add missing semicolon

* refactor: uncommented code in LoadFileChunkLoadingRuntimeModule.ts

This commit re-enables a chunk of code that was previously commented out, within the LoadFileChunkLoadingRuntimeModule classes.

- uncommented previously commented-out code related to initialChunkIds

* refactor: update moduleResolution in tsconfig.json

This commit updates the moduleResolution value from 'node16' to 'Node16' in tsconfig.json.

- updated moduleResolution value from 'node16' to 'Node16'

* chore: finish nx migraitons

* chore:update locks

* fix: remove specific module type from package

* fix:  Improved Entrypoint Module Detection and Refactoring (#932)

* fix: improve detection of entrypoint modules

Entrypoints can be many "NormalModule" types.

I want to exclude abnormal modules and search for entrypoints only

* refactor: remove use of deprecated entryModule

* chore: update Node.js version to 18 in GitHub actions

This commit updates the Node.js version used in GitHub actions for both pre-release and release workflows to 18, and adds a .nvmrc file with the updated Node.js version information.

- updated Node.js version to 18 in 'Use Node.js' step

- updated Node.js version to 18 in 'Use Node.js' step

- created the file

- added Node.js version 18

* chore: update locks

* chore: update .nvmrc, remove type, and clean up code

This commit updates the .nvmrc file to return the Node.js version, removes the 'type' property from two package.json files, and cleans up some of the code in LoadFileChunkLoadingRuntimeModule.

- Added Node.js version: v18.16.0

- Remove 'type' property

- Remove 'type' property

- Remove console.log statement

- Clean up some code

* refactor: change yarn to npm in scripts

This commit updates the package.json file to replace the usage of yarn with npm in the scripts section to maintain consistency and avoid potential issues when using different package managers.

- replace yarn with npm in gpt:file:example

- replace yarn with npm in start:next

- replace yarn with npm in start:nextho

- replace yarn with npm in serve:next

* refactor: remove legacy-peer-deps flag from npm ci command

This commit removes the --legacy-peer-deps flag from the npm ci commands in three GitHub workflow configuration files, simplifying the installation process and using the defaults for handling peer dependencies.

- Removed --legacy-peer-deps flag from npm ci command

- Removed --legacy-peer-deps flag from npm ci command

- Removed --legacy-peer-deps flag from npm ci command

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(utils): release version 1.8.1-rc1.0

* chore(node): release version 0.15.2-rc1.0

* chore(nextjs-mf): release version 6.5.2-rc1.0

* feat: support custom distDir

* fix: remove default props deprecation on flush chunks

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: Improve chunk correlation (#936)

* refactor: improve ChunkCorrelationPlugin.js

This commit refactors ChunkCorrelationPlugin.js, adding more detailed comments and improving code structure for better readability.

- added detailed comments to clarify plugin functionality

- replaced forEach loops with for..of loops

- refactored code structure for better readability

* refactor: change processAssets.tapAsync to processAssets.tap in ChunkCorrelationPlugin

This commit updates the use of processAssets.tapAsync to processAssets.tap in the ChunkCorrelationPlugin to improve the performance of the plugin.

- changed processAssets.tapAsync to processAssets.tap

- moved initialization of moduleChunks outside the loop

* fix: remove memory waste

* refactor: remove unused ContainerStatsPlugin and clean up InvertedContainerPlugin

This commit removes an unused ContainerStatsPlugin file and cleans up debug code in InvertedContainerPlugin

- delete unused file

- remove debug code

* refactor: enhance correctImportPath functionality

This commit refactors the correctImportPath function to better handle various environments and improve code readability.

- wrapped function logic in a conditional check for window being undefined

- returned null if window is defined

- improved code readability by adjusting indentation

* chore(utils): release version 1.8.1-rc.2

* chore(utils): release version 1.8.1-rc.2

* chore(native-federation-typescript): release version 0.2.2-rc.0

* chore(utils): release version 1.8.1

* chore(utils): release version 1.8.2-beta.0

* chore(node): release version 0.15.2-beta.0

* chore(nextjs-mf): release version 6.5.2-beta.0

* fix: remove logs or wrap in debug flag (#959)

* chore(utils): release version 1.8.2-rc3.0

* chore(node): release version 0.15.2-rc3.0

* chore(nextjs-mf): release version 6.5.2-rc3.0

* fix: Path loader patches (#960)

* fix: re-enable image and url path patches

* fix: re-enable image and url path patches

* chore(utils): release version 1.8.2-rc3.1

* chore(node): release version 0.15.2-rc3.1

* chore(nextjs-mf): release version 6.5.2-rc3.1

* fix: Runtime module checking (#969)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: Resolve conditional exports (#971)

* fix: dont force named chunkids on client

server builds seem to fall over if chunk ids are numeric, however this is less of a problem when in serverland

* refactor: move delegate module utils to own file

* refactor: point default delegate to origin file

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: safety checks for getEagerSharedForChunkId

if no initial chunks exist, runtime modules might not be added. As such, we should check that the runtime module exists before calling it

* fix: resolve conditional exports

* fix: resolve conditional exports

* WIP Core API

* Fix react remote MF plugin

* Refactors

* Fixes

* Add hook

* Disable ESM for react

* Disable ESM

* ESM changes

* ESM changes

* federated types fix

* Updates

* Rework webpack config

* Fix remotes

* Merge fallout

* Remove extraneous file

* Refactor global types

* Small fixes

* Refactors

* Revert package.json

* PR comments

* chore: code comment applied (WIP)

* chore: more node way of doing things, and disabled federated types for now

* fix: Enable production mode for react apps

* chore: fix deps

* chore: upgrade nx to latest and use nx open source cloud

* fix: ts issues, upgrading nx version, lints, etc...

* WIP: fixing vitest is needed
> module-federation@0.0.0 test
> nx run-many --target=test

 >  NX   Running target test for 9 projects:

    - native-federation-typescript
    - native-federation-tests
    - storybook-addon
    - reactStorybook
    - nextjs-mf
    - utils
    - reactRemoteUI
    - core
    - website

> nx run utils:test  [existing outputs match the cache, left as is]

�[1m�[2mDetermining test suites to run...�[22m�[22m�[999D�[K

�[1mTest Suites: �[22m0 of 3 total
�[1mTests:       �[22m0 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        0 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mgetRuntimeRemotes.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/plugins/�[22m�[1mDelegateModulesPlugin.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[1mTest Suites: �[22m0 of 3 total
�[1mTests:       �[22m0 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        0 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mgetRuntimeRemotes.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/plugins/�[22m�[1mDelegateModulesPlugin.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[1mTest Suites: �[22m0 of 3 total
�[1mTests:       �[22m0 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        1 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mgetRuntimeRemotes.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/plugins/�[22m�[1mDelegateModulesPlugin.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[1mTest Suites: �[22m0 of 3 total
�[1mTests:       �[22m0 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        1 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A�[0m�[7m�[1m�[32m PASS �[39m�[22m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/plugins/�[22m�[1mDelegateModulesPlugin.test.ts�[22m

�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mgetRuntimeRemotes.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/plugins/�[22m�[1mDelegateModulesPlugin.test.ts�[22m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[1mTest Suites: �[22m0 of 3 total
�[1mTests:       �[22m0 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        1 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[1mTest Suites: �[22m�[1m�[33m1 skipped�[39m�[22m, �[1m�[32m1 passed�[39m�[22m, 1 of 3 total
�[1mTests:       �[22m�[1m�[33m6 skipped�[39m�[22m, �[1m�[32m8 passed�[39m�[22m, 14 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        1 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A�[0m�[7m�[1m�[32m PASS �[39m�[22m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m utils �[39m�[27m�[0m �[2mpackages/utilities/src/utils/�[22m�[1mcorrectImportPath.spec.ts�[22m

�[1mTest Suites: �[22m�[1m�[33m1 skipped�[39m�[22m, �[1m�[32m1 passed�[39m�[22m, 1 of 3 total
�[1mTests:       �[22m�[1m�[33m6 skipped�[39m�[22m, �[1m�[32m8 passed�[39m�[22m, 14 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        1 s, estimated 2 s
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A
�[K
�[1A�[999D�[K
�[1mTest Suites: �[22m�[1m�[33m1 skipped�[39m�[22m, �[1m�[32m2 passed�[39m�[22m, 2 of 3 total
�[1mTests:       �[22m�[1m�[33m6 skipped�[39m�[22m, �[1m�[32m12 passed�[39m�[22m, 18 total
�[1mSnapshots:   �[22m0 total
�[1mTime:�[22m        1.238 s, estimated 2 s
�[2mRan all test suites�[22m�[2m.�[22m

> nx run storybook-addon:test  [existing outputs match the cache, left as is]

�[1m�[2mDetermining test suites to run...�[22m�[22m�[999D�[K

�[K
�[1A
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1Ats-jest[ts-jest-transformer] (WARN) Define `ts-jest` config under `globals` is deprecated. Please do
transform: {
    <transform_regex>: ['ts-jest', { /* ts-jest config goes here in Jest */ }],
},

�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A�[32minfo�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A�[35m�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A => [MF] Webpack 4 version detected
�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A�[32minfo�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A�[35m�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A => [MF] Webpack 5 version detected
�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A�[32minfo�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addon/src/lib/�[22m�[1mstorybook-addon.spec.ts�[22m

�[K
�[1A
�[K
�[1A�[35m�[0m
�[0m�[7m�[33m�[1m RUNS �[22m�[39m�[27m�[0m �[0m�[7m�[37m storybook-addon �[39m�[27m�[0m �[2mpackages/storybook-addo…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant