Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
feat(externals-registry): manage module external dependencies (#143)
Browse files Browse the repository at this point in the history
* feat(externals-registry): manage module external dependencies

* chore(readme): external registry api

* chore(externals): remove warn

* chore(loadModule): refactor

* refactor: moved externals registry

* chore: test coverage

* feat(loadModule): safely load modules

* feat(loadModule): legacy requiredExternals

* fix(loadModule): correct fallback url for browser

* chore(loadModule): use fetch.json()

---------

Co-authored-by: Giuliano Kranevitter <[email protected]>
  • Loading branch information
JAdshead and giulianok authored Aug 18, 2023
1 parent d9977d7 commit f66aebf
Show file tree
Hide file tree
Showing 14 changed files with 2,357 additions and 318 deletions.
8 changes: 8 additions & 0 deletions packages/holocron/__tests__/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
exports[`public API should not have anything removed 1`] = `
Object {
"RenderModule": [Function],
"clearModulesUsingExternals": [Function],
"composeModules": [Function],
"createHolocronStore": [Function],
"failedToLoad": [Function],
"forceLoadModule": [Function],
"getExternal": [Function],
"getLoadError": [Function],
"getLoadingPromise": [Function],
"getModule": [Function],
"getModuleMap": [Function],
"getModules": [Function],
"getModulesUsingExternals": [Function],
"getRegisteredExternals": [Function],
"getRequiredExternals": [Function],
"getRequiredExternalsRegistry": [Function],
"holocronModule": [Function],
"isLoaded": [Function],
"isLoading": [Function],
"loadModule": [Function],
"registerExternal": [Function],
"registerModule": [Function],
"setModuleMap": [Function],
"setRequiredExternalsRegistry": [Function],
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ exports[`loadModule.node loading a module retries 3`] = `
Retrying (3)..."
`;

exports[`loadModule.node loading a module retries 4`] = `
"Holocron module \\"awesome\\" at \\"https://example.com/cdn/awesome/1.0.0/awesome.node.js\\" failed to execute.
[Error Message]: \\"test error, like a socket disconnect\\"
Please fix any errors and wait for it to be reloaded."
`;

exports[`loadModule.node throws if integrity shas dont match prior to loading the module if NODE_ENV is production 1`] = `
"SRI for module at https://example.com/cdn/awesome/1.0.0/awesome.node.js must match SRI in module map.
Expected 123, received sha256-evq7fP0ACz7W6Pw88Bd/+QhKzbka11+gBAdTJKQmWpg= sha384-01XUEQX9oGXC/uWhoIoKiK7M15P55kBqx2K+He5OtvDfu+EA0N1r+ezQ3JVquFux"
Expand Down
Loading

0 comments on commit f66aebf

Please sign in to comment.