-
Notifications
You must be signed in to change notification settings - Fork 216
Build montage.js bootstrapping using a build script #1267
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
Open
kriskowal
wants to merge
1
commit into
montagejs:master
Choose a base branch
from
kriskowal:build
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
⚠️ This depends on changes to `mr` in the corresponding `build` branch, which has not landed at time of writing. Changes to `mop` in the corresponding `build` branch are also required for compatibility. As such, the `build` branches of all of these repositories must be coordinated and land in a backward-incompatible release. `mr` now includes a `mrs` script for building some stand-alone scripts based on Mr’s dependency analysis if the built modules only need the ability to require and export modules in a static working set. The resulting script has very little overhead for linking the modules. Lazy loading and compiler extensions are not supported, but would be possible with future work. `mrs` is suitable for building the new Mr `boot.js` and the Montage boot script, `montage.js`. This change set introduces the command `npm run build` that updates `montage.js` and also produces `boot/preload-boilerplate.js`. This introduces the need to rebuild `montage.js` whenever modules in the `boot` directory, `mr`, or any of their transitive dependencies are modified. This obviates the need to perform script injection in `montage.js`, reducing code size and complexity in both development and production. This obviates the need to have the `packages` checked into Git and the sub-repository update machinations that entails. These dependencies can be installed normally, with NPM. The relevant modules are incorporated into `montage.js` by the build script. Since `mr` and its dependencies now exist in `node_modules`, this obviates the need for Montage's `package.json` to use Mr-specific `mappings` or `overlays`. This reduces the scope of `montage.js` to only need to support the browser script loading use case. It no longer needs to also serve as a Node.js module. It no longer needs to also serve as the boilerplate for bundling. These cases are now served in simpler and separate ways. The parts of `montage.js` that were needed to bootstrap in Node.js are now in CommonJS modules in the `boot` directory. These are embeded in `montage.js` by the build script, but can also be used as Node.js modules without any wrappers or boilerplate. The parts of `montage.js` that are needed to bootstrap in bundles built by `Mop` are now in `boot/preload-boilerplate.js`, which like `montage.js` is built using `mrs`. This obviates the need to have a hard-coded copy of `mr/mini-url.js`. Mr and Montage can now share this CommonJS module instead of embedding it in their bootstrapping, which will make that function easier to maintain going forward. This also obviates the need for the `mini-url` dependency to be handled specially at run-time. Regardless of the platform, modules may depend on `url`. When used in a browser, the module system will link to `mini-url.js`. In Node.js, where `mini-url.js` would not work at all, it falls back to the `url` module provided by the platform. When Mop prepares a bundle, it is now necessary for it to provide a `data-location` property instead of `data-montage-location` or `data-mr-location` since the code that handles this detection is now unified in `mr/boot/script-params.js`.
Member
Author
|
|
Contributor
|
Closing, will revisit when we decide to have a build step. |
Contributor
|
We going another direction. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
mrin the correspondingbuildbranch, which has not landed at time of writing. Changes tomopin the correspondingbuildbranch are also required for compatibility. As such, thebuildbranches of all of these repositories must be coordinated and land in a backward-incompatible release.mrnow includes amrsscript for building some stand-alone scripts based on Mr’s dependency analysis if the built modules only need the ability to require and export modules in a static working set. The resulting script has very little overhead for linking the modules. Lazy loading and compiler extensions are not supported, but would be possible with future work.mrsis suitable for building the new Mrboot.jsand the Montage boot script,montage.js. This change set introduces the commandnpm run buildthat updatesmontage.jsand also producesboot/preload-boilerplate.js.This introduces the need to rebuild
montage.jswhenever modules in thebootdirectory,mr, or any of their transitive dependencies are modified.This obviates the need to perform script injection in
montage.js, reducing code size and complexity in both development and production.This obviates the need to have the
packageschecked into Git and the sub-repository update machinations that entails. These dependencies can be installed normally, with NPM. The relevant modules are incorporated intomontage.jsby the build script. Sincemrand its dependencies now exist innode_modules, this obviates the need for Montage'spackage.jsonto use Mr-specificmappingsoroverlays.This reduces the scope of
montage.jsto only need to support the browser script loading use case. It no longer needs to also serve as a Node.js module. It no longer needs to also serve as the boilerplate for bundling. These cases are now served in simpler and separate ways.The parts of
montage.jsthat were needed to bootstrap in Node.js are now in CommonJS modules in thebootdirectory. These are embeded inmontage.jsby the build script, but can also be used as Node.js modules without any wrappers or boilerplate.The parts of
montage.jsthat are needed to bootstrap in bundles built byMopare now inboot/preload-boilerplate.js, which likemontage.jsis built usingmrs.This obviates the need to have a hard-coded copy of
mr/mini-url.js. Mr and Montage can now share this CommonJS module instead of embedding it in their bootstrapping, which will make that function easier to maintain going forward. This also obviates the need for themini-urldependency to be handled specially at run-time. Regardless of the platform, modules may depend onurl. When used in a browser, the module system will link tomini-url.js. In Node.js, wheremini-url.jswould not work at all, it falls back to theurlmodule provided by the platform.When Mop prepares a bundle, it is now necessary for it to provide a
data-locationproperty instead ofdata-montage-locationordata-mr-locationsince the code that handles this detection is now unified inmr/boot/script-params.js.