-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DESC-79 Added the name function for zimlet identification.
- Loading branch information
1 parent
4626520
commit 604c8fb
Showing
3 changed files
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,45 @@ | ||
/** This is the real webpack entry file. It manages setting up the zimlet and HMR. | ||
* The user-defined entry file (index.js) is imported here via a `zimlet-cli-entrypoint` alias. | ||
*/ | ||
( () => { | ||
function init() { | ||
zimlet( context => { | ||
let { zimbra, config, plugins, shims, components, store, meta } = context; | ||
(() => | ||
getZimlet({ | ||
code: (() => { | ||
function init() { | ||
return (context) => { | ||
let { zimbra, config, plugins, shims, components, store, meta } = | ||
context; | ||
|
||
// Add shims to the global scope to expose dependencies to Zimlets | ||
// Shimmed dependencies include preact, preact-router, react-apollo | ||
global.shims = shims; | ||
// Add shims to the global scope to expose dependencies to Zimlets | ||
// Shimmed dependencies include preact, preact-router, react-apollo | ||
global.shims = shims; | ||
|
||
global.zimbra = zimbra; | ||
global.config = config; | ||
global.plugins = plugins; | ||
global.components = components; | ||
global.store = store; | ||
global.zimbra = zimbra; | ||
global.config = config; | ||
global.plugins = plugins; | ||
global.components = components; | ||
global.store = store; | ||
|
||
global.ZIMLET_STYLES = []; | ||
global.ZIMLET_STYLES = []; | ||
|
||
global.meta = meta; | ||
global.meta = meta; | ||
|
||
let entry = require('zimlet-cli-entrypoint'); | ||
let r = entry && entry.default || entry; | ||
let entry = require('zimlet-cli-entrypoint'); | ||
let r = (entry && entry.default) || entry; | ||
|
||
// If export is a factory, pass it context. Otherwise it's a singleton. | ||
let instance = typeof r==='function' ? r(context) : r; | ||
// If export is a factory, pass it context. Otherwise it's a singleton. | ||
let instance = typeof r === 'function' ? r(context) : r; | ||
|
||
context.styles.set(global.ZIMLET_STYLES.join('\n')); | ||
context.styles.set(global.ZIMLET_STYLES.join('\n')); | ||
|
||
return instance; | ||
}); | ||
} | ||
return instance; | ||
}; | ||
} | ||
|
||
init(); | ||
if (process.env.NODE_ENV === 'development' && module.hot) { | ||
module.hot.accept('zimlet-cli-entrypoint', init); | ||
} | ||
|
||
if (process.env.NODE_ENV==='development' && module.hot) { | ||
module.hot.accept('zimlet-cli-entrypoint', init); | ||
} | ||
})(); | ||
return init(); | ||
})(), | ||
name: () => require('zimlet-cli-entrypoint-package').name | ||
}))(); |
This file contains 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