@zimbra/zimlet-cli 15.0.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/.eslintrc.js +15 -0
  2. package/dist/cli.js +9 -10
  3. package/dist/commands/create.js +39 -75
  4. package/dist/commands/package.js +9 -40
  5. package/dist/entry.js +5 -7
  6. package/dist/index.js +65 -89
  7. package/dist/lib/async-command.js +2 -6
  8. package/dist/lib/setup.js +3 -12
  9. package/dist/lib/webpack/transform-config.js +0 -11
  10. package/dist/shims/@apollo/client/index.js +1 -3
  11. package/dist/shims/@apollo/client/react/components/index.js +1 -3
  12. package/dist/shims/@apollo/client/react/hoc/index.js +1 -3
  13. package/dist/shims/@apollo/client/react/index.js +1 -3
  14. package/dist/shims/@zimbra-client/blocks/index.js +1 -3
  15. package/dist/shims/@zimbra-client/browser/index.js +1 -3
  16. package/dist/shims/@zimbra-client/components/index.js +4 -4
  17. package/dist/shims/@zimbra-client/constants/index.js +1 -3
  18. package/dist/shims/@zimbra-client/enhancers/index.js +1 -3
  19. package/dist/shims/@zimbra-client/errors/index.js +1 -3
  20. package/dist/shims/@zimbra-client/graphql/index.js +1 -3
  21. package/dist/shims/@zimbra-client/hooks/graphql/index.js +1 -3
  22. package/dist/shims/@zimbra-client/hooks/index.js +1 -3
  23. package/dist/shims/@zimbra-client/platform/index.js +1 -3
  24. package/dist/shims/@zimbra-client/util/contacts/index.js +1 -3
  25. package/dist/shims/@zimbra-client/util/index.js +1 -3
  26. package/dist/shims/@zimbra-client/util/redux/index.js +1 -3
  27. package/dist/shims/dompurify/index.js +1 -3
  28. package/dist/shims/index.js +3 -4
  29. package/dist/shims/moment/index.js +1 -3
  30. package/dist/shims/preact/compat/index.js +71 -65
  31. package/dist/shims/preact/hooks/index.js +18 -18
  32. package/dist/shims/preact/index.js +17 -19
  33. package/dist/shims/preact/jsx-runtime/index.js +25 -0
  34. package/dist/shims/preact-context-provider/index.js +1 -5
  35. package/dist/shims/preact-i18n/index.js +1 -5
  36. package/dist/shims/preact-pwa-install/index.js +1 -4
  37. package/dist/shims/preact-render-to-string/index.js +1 -3
  38. package/dist/shims/preact-router/index.js +1 -3
  39. package/dist/shims/preact-router/match/index.js +1 -3
  40. package/dist/shims/react-redux/index.js +6 -10
  41. package/dist/shims/recompose/index.js +1 -3
  42. package/dist/shims/redux-actions/index.js +1 -3
  43. package/dist/util.js +0 -15
  44. package/dist/zimlet-style-loader.js +2 -11
  45. package/package-lock.json +3644 -7386
  46. package/package.json +42 -46
package/.eslintrc.js ADDED
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ parser: '@babel/eslint-parser',
3
+ extends: [
4
+ 'eslint-config-synacor'
5
+ ],
6
+ globals: {
7
+ zimlet: true
8
+ },
9
+ rules: {
10
+ indent: ['error', 'tab', {
11
+ ignoredNodes: ['TemplateLiteral'],
12
+ SwitchCase: 1
13
+ }]
14
+ }
15
+ };
package/dist/cli.js CHANGED
@@ -2,17 +2,11 @@
2
2
  "use strict";
3
3
 
4
4
  require("@babel/polyfill");
5
-
6
5
  var _yargs = _interopRequireDefault(require("yargs"));
7
-
8
6
  var _create = _interopRequireDefault(require("./commands/create"));
9
-
10
7
  var _package = _interopRequireDefault(require("./commands/package"));
11
-
12
8
  var _index = _interopRequireDefault(require("./index"));
13
-
14
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
10
  const optionsForAllCommands = {
17
11
  config: {
18
12
  type: 'string',
@@ -20,7 +14,8 @@ const optionsForAllCommands = {
20
14
  default: './zimlet.config.js'
21
15
  }
22
16
  };
23
- _yargs.default.command(_create.default).command('watch', 'Start a development server', { ...optionsForAllCommands,
17
+ _yargs.default.command(_create.default).command('watch', 'Start a development server', {
18
+ ...optionsForAllCommands,
24
19
  port: {
25
20
  type: 'number',
26
21
  description: 'Port of dev server',
@@ -34,7 +29,8 @@ _yargs.default.command(_create.default).command('watch', 'Start a development se
34
29
  }, argv => {
35
30
  argv.watch = true;
36
31
  runCli(argv);
37
- }).command(['build'], 'Compile a zimlet', { ...optionsForAllCommands,
32
+ }).command(['build'], 'Compile a zimlet', {
33
+ ...optionsForAllCommands,
38
34
  dest: {
39
35
  type: 'string',
40
36
  defaultDescription: './build',
@@ -49,10 +45,13 @@ _yargs.default.command(_create.default).command('watch', 'Start a development se
49
45
  argv.production = true;
50
46
  runCli(argv);
51
47
  }).command(_package.default).demandCommand(1, 'A command must be specified').usage('Zimlet client tool for developing and building Zimlets.\n\nType "zimlet [commmand] --help" for command specific usage information').help().argv;
52
-
53
48
  function runCli(argv) {
54
49
  (0, _index.default)(argv, (err, result) => {
55
- if (err) process.stderr.write(err);else if (result) process.stdout.write(result);
50
+ if (err) {
51
+ process.stderr.write(err);
52
+ } else if (result) {
53
+ process.stdout.write(result);
54
+ }
56
55
  setTimeout(() => {
57
56
  process.exit(err ? 1 : 0);
58
57
  }, 10);
@@ -4,48 +4,33 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _ora = _interopRequireDefault(require("ora"));
9
-
10
8
  var _gittar = _interopRequireDefault(require("gittar"));
11
-
12
9
  var _chalk = require("chalk");
13
-
14
10
  var _fs = _interopRequireDefault(require("fs"));
15
-
16
11
  var _inquirer = require("inquirer");
17
-
18
12
  var _path = require("path");
19
-
20
13
  var _validateNpmPackageName = _interopRequireDefault(require("validate-npm-package-name"));
21
-
22
14
  var _util = require("../util");
23
-
24
15
  var _setup = require("./../lib/setup");
25
-
26
16
  var _asyncCommand = _interopRequireDefault(require("../lib/async-command"));
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
29
-
30
18
  // This command borrows heavily from preact-cli's create command
31
19
  // https://github.com/developit/preact-cli
32
- const ORG = 'zimbra'; //repo we want as an alias for 'default'?
20
+ const ORG = 'zimbra';
33
21
 
22
+ //repo we want as an alias for 'default'?
34
23
  const DEFAULT_REPO = 'zimbra/zm-x-zimlet-template-default';
35
24
  const RGX = /\.(woff2?|ttf|eot|jpe?g|ico|png|gif|mp4|mov|ogg|webm)(\?.*)?$/i;
36
-
37
25
  const isMedia = str => RGX.test(str);
38
-
39
26
  const capitalize = str => str.charAt(0).toUpperCase() + str.substring(1);
40
-
41
27
  const templateDesc = 'Remote template to clone (user/repo#tag)',
42
- destDesc = 'Directory to create the zimlet',
43
- nameDesc = 'The zimlet\'s name',
44
- forceDesc = 'Force `dest` directory to created if it already exists; will overwrite!',
45
- installDesc = 'Install dependencies',
46
- yarnDesc = 'Install with `yarn` instead of `npm`',
47
- gitDesc = 'Initialize a `git` repository';
48
-
28
+ destDesc = 'Directory to create the zimlet',
29
+ nameDesc = 'The zimlet\'s name',
30
+ forceDesc = 'Force `dest` directory to created if it already exists; will overwrite!',
31
+ installDesc = 'Install dependencies',
32
+ yarnDesc = 'Install with `yarn` instead of `npm`',
33
+ gitDesc = 'Initialize a `git` repository';
49
34
  var _default = (0, _asyncCommand.default)({
50
35
  command: 'create [template] [dest]',
51
36
  desc: 'Create a new zimlet.',
@@ -87,34 +72,32 @@ var _default = (0, _asyncCommand.default)({
87
72
  description: destDesc
88
73
  }
89
74
  },
90
-
91
75
  async handler(argv) {
92
76
  let destArg = argv.dest;
93
77
  let templateArg = argv.template;
94
- let nameArg = argv.name; // Prompt if incomplete data
78
+ let nameArg = argv.name;
95
79
 
80
+ // Prompt if incomplete data
96
81
  if (!destArg || !templateArg) {
97
82
  (0, _util.warn)('Insufficient command arguments! Prompting...');
98
83
  (0, _util.info)('Alternatively, run `zimlet create --help` for usage info.');
99
84
  let questions = isMissing(argv);
100
- let response = await (0, _inquirer.prompt)(questions); //trim all args to prevent accidental extra whitespace in user prompted values from messing things up
101
-
85
+ let response = await (0, _inquirer.prompt)(questions);
86
+ //trim all args to prevent accidental extra whitespace in user prompted values from messing things up
102
87
  Object.keys(response).forEach(k => response[k] && response[k].trim && (response[k] = response[k].trim()));
103
88
  Object.assign(argv, response);
104
- } //default is a special keyword that will use the predefiend default repo
105
-
89
+ }
106
90
 
91
+ //default is a special keyword that will use the predefiend default repo
107
92
  if (templateArg === 'default') templateArg = DEFAULT_REPO;
108
93
  let cwd = (0, _path.resolve)(argv.cwd);
109
94
  destArg = destArg || (0, _path.dirname)(cwd);
110
95
  let isYarn = argv.yarn && (0, _util.hasCommand)('yarn');
111
96
  let target = (0, _path.resolve)(cwd, destArg);
112
97
  let exists = (0, _util.isDir)(target);
113
-
114
98
  if (exists && !argv.force) {
115
99
  return (0, _util.error)('Refusing to overwrite current directory! Please specify a different destination or use the `--force` flag', 1);
116
100
  }
117
-
118
101
  if (exists && argv.force) {
119
102
  if (!(await (0, _inquirer.prompt)({
120
103
  type: 'confirm',
@@ -125,26 +108,23 @@ var _default = (0, _asyncCommand.default)({
125
108
  return (0, _util.error)('Refusing to overwrite current directory!', 1);
126
109
  }
127
110
  }
128
-
129
111
  let repo = templateArg;
130
-
131
112
  if (!repo.includes('/')) {
132
113
  repo = `${ORG}/${repo}`;
133
114
  (0, _util.info)(`Fetching ${templateArg} template from ${repo}...`);
134
- } // Use `--name` value or `dest` dir's name
135
-
115
+ }
136
116
 
117
+ // Use `--name` value or `dest` dir's name
137
118
  nameArg = nameArg || destArg;
138
119
  let {
139
120
  errors
140
121
  } = (0, _validateNpmPackageName.default)(nameArg);
141
-
142
122
  if (errors) {
143
123
  errors.unshift(`Invalid package name: ${nameArg}`);
144
124
  return (0, _util.error)(errors.map(capitalize).join('\n ~ '), 1);
145
- } // Attempt to fetch the `template`
146
-
125
+ }
147
126
 
127
+ // Attempt to fetch the `template`
148
128
  let archive = await _gittar.default.fetch(repo).catch(err => {
149
129
  err = err || {
150
130
  message: 'An error occured while fetching template.'
@@ -154,13 +134,13 @@ var _default = (0, _asyncCommand.default)({
154
134
  let spinner = (0, _ora.default)({
155
135
  text: 'Creating project',
156
136
  color: 'magenta'
157
- }).start(); // Extract files from `archive` to `target`
158
- // TODO: read & respond to meta/hooks
137
+ }).start();
159
138
 
139
+ // Extract files from `archive` to `target`
140
+ // TODO: read & respond to meta/hooks
160
141
  let keeps = [];
161
142
  await _gittar.default.extract(archive, target, {
162
143
  strip: 2,
163
-
164
144
  filter(path, obj) {
165
145
  if (path.includes('/template/')) {
166
146
  obj.on('end', () => {
@@ -171,30 +151,28 @@ var _default = (0, _asyncCommand.default)({
171
151
  return true;
172
152
  }
173
153
  }
174
-
175
154
  });
176
-
177
155
  if (keeps.length) {
178
- let dict = new Map(); // TODO: concat author-driven patterns
179
- //globally replace instances of {{name}} with value of name arg
156
+ let dict = new Map();
180
157
 
158
+ // TODO: concat author-driven patterns
159
+ //globally replace instances of {{name}} with value of name arg
181
160
  ['name'].forEach(str => {
182
161
  // if value is defined
183
162
  if (nameArg !== void 0) {
184
163
  dict.set(new RegExp(`{{\\s*${str}\\s*}}`, 'g'), nameArg);
185
164
  }
186
- }); // Update each file's contents
165
+ });
187
166
 
167
+ // Update each file's contents
188
168
  let buf,
189
- entry,
190
- enc = 'utf8';
191
-
169
+ entry,
170
+ enc = 'utf8';
192
171
  for (entry of keeps) {
193
172
  buf = _fs.default.readFileSync(entry, enc);
194
173
  dict.forEach((v, k) => {
195
174
  buf = buf.replace(k, v);
196
175
  });
197
-
198
176
  try {
199
177
  _fs.default.writeFileSync(entry, buf, enc);
200
178
  } catch (err) {
@@ -204,31 +182,28 @@ var _default = (0, _asyncCommand.default)({
204
182
  } else {
205
183
  return (0, _util.error)(`No \`template\` directory found within ${repo}!`, 1);
206
184
  }
185
+ spinner.succeed().start('Parsing `package.json` file');
207
186
 
208
- spinner.succeed().start('Parsing `package.json` file'); // Validate user's `package.json` file
209
-
187
+ // Validate user's `package.json` file
210
188
  let pkgData,
211
- pkgFile = (0, _path.resolve)(target, 'package.json');
212
-
189
+ pkgFile = (0, _path.resolve)(target, 'package.json');
213
190
  if (pkgFile) {
214
191
  try {
215
192
  pkgData = JSON.parse(_fs.default.readFileSync(pkgFile));
216
193
  } catch (err) {
217
194
  return (0, _util.error)(`Could not reach package.json file: ${err}`);
218
- } // Write default "scripts" if none found
219
-
220
-
195
+ }
196
+ // Write default "scripts" if none found
221
197
  pkgData.scripts = pkgData.scripts || (await (0, _setup.addScripts)(pkgData, target, isYarn));
222
198
  } else {
223
199
  (0, _util.warn)('Could not locate `package.json` file!');
224
- } // Update `package.json` key
225
-
200
+ }
226
201
 
202
+ // Update `package.json` key
227
203
  if (pkgData) {
228
204
  spinner.succeed().start('Updating `name` to `' + nameArg + '` within `package.json` file');
229
205
  pkgData.name = nameArg.toLowerCase().replace(/\s+/g, '_');
230
206
  }
231
-
232
207
  if (pkgData) {
233
208
  // Assume changes were made
234
209
  try {
@@ -237,17 +212,14 @@ var _default = (0, _asyncCommand.default)({
237
212
  return (0, _util.error)(`Unable to write back package.json file: ${err}`);
238
213
  }
239
214
  }
240
-
241
215
  if (argv.install) {
242
216
  spinner.succeed().start('Installing dependencies');
243
217
  await (0, _setup.install)(target, isYarn);
244
218
  }
245
-
246
219
  if (argv.git) {
247
220
  spinner.succeed().start('Initializing git repo');
248
221
  await (0, _setup.initGit)(target);
249
222
  }
250
-
251
223
  spinner.succeed().succeed('Done!\n');
252
224
  let pfx = isYarn ? 'yarn' : 'npm run';
253
225
  return (0, _util.trim)(`
@@ -264,15 +236,10 @@ var _default = (0, _asyncCommand.default)({
264
236
  ${(0, _chalk.green)(pfx + ' package')}
265
237
  `) + '\n';
266
238
  }
267
-
268
239
  }); // Formulate Questions if `create` args are missing
269
-
270
-
271
240
  exports.default = _default;
272
-
273
241
  function isMissing(argv) {
274
242
  let out = [];
275
-
276
243
  const ask = (name, message, val) => {
277
244
  let type = typeof val === 'boolean' ? 'confirm' : 'input';
278
245
  out.push({
@@ -281,25 +248,22 @@ function isMissing(argv) {
281
248
  type,
282
249
  default: val
283
250
  });
284
- }; // Required data
285
-
251
+ };
286
252
 
253
+ // Required data
287
254
  !argv.template && ask('template', templateDesc, 'default');
288
- !argv.dest && ask('dest', destDesc); // Extra data / flags
289
-
255
+ !argv.dest && ask('dest', destDesc);
256
+ // Extra data / flags
290
257
  !argv.name && ask('name', nameDesc, _ref => {
291
258
  let {
292
259
  dest
293
260
  } = _ref;
294
261
  return dest;
295
262
  }); //use the current answer for 'dest' as the default
296
-
297
263
  !argv.force && ask('force', forceDesc, false);
298
264
  ask('install', installDesc, true); // defaults `true`, ask anyway
299
-
300
265
  !argv.yarn && ask('yarn', yarnDesc, false);
301
266
  !argv.git && ask('git', gitDesc, false);
302
267
  return out;
303
268
  }
304
-
305
269
  module.exports = exports.default;
@@ -4,19 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _fs = _interopRequireDefault(require("fs"));
9
-
10
8
  var _path = _interopRequireDefault(require("path"));
11
-
12
9
  var _admZip = _interopRequireDefault(require("adm-zip"));
13
-
14
10
  var _util = require("../util");
15
-
16
11
  var _asyncCommand = _interopRequireDefault(require("../lib/async-command"));
17
-
18
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
13
  var _default = (0, _asyncCommand.default)({
21
14
  command: 'package',
22
15
  desc: 'Package a zimlet for deployment',
@@ -60,36 +53,30 @@ var _default = (0, _asyncCommand.default)({
60
53
  description: 'Directory for packaged artifacts'
61
54
  }
62
55
  },
63
-
64
56
  async handler(argv) {
65
57
  // normalize built files source directory and desination package dir
66
58
  let cwd = process.cwd();
67
-
68
59
  let builddir = _path.default.resolve(cwd, argv.builddir || 'build');
60
+ let dest = _path.default.resolve(cwd, argv.dest || 'pkg', `${argv.name}.zip`);
69
61
 
70
- let dest = _path.default.resolve(cwd, argv.dest || 'pkg', `${argv.name}.zip`); // Get label and description from src/intl/en_US.json or from argument
71
-
72
-
62
+ // Get label and description from src/intl/en_US.json or from argument
73
63
  const {
74
64
  label,
75
65
  description
76
66
  } = getZimletLabelDescription() || argv;
77
-
78
67
  if (!(label && description)) {
79
68
  return (0, _util.error)('label and description string are not provided as argument');
80
- } // Create the xml descriptor file for the zimlet
81
-
69
+ }
82
70
 
71
+ // Create the xml descriptor file for the zimlet
83
72
  let xmlFile = `${argv.name}.xml`;
84
73
  let zimletXML = `<zimlet name="${argv.name}" version="${argv.pkgVersion}" description="${description}" label="${label}" zimbraXZimletCompatibleSemVer="${argv.zimbraXVersion}">`;
85
74
  let files;
86
-
87
75
  try {
88
76
  files = _fs.default.readdirSync(builddir);
89
77
  } catch (err) {
90
78
  return (0, _util.error)(`Failed to read ${builddir}: ${err}`, 1);
91
79
  }
92
-
93
80
  files.filter(file => !file.match(/\.properties$/)).forEach(file => {
94
81
  if (file.match(/\.js$/)) {
95
82
  zimletXML += `\n\t<include>${file}</include>`;
@@ -100,35 +87,28 @@ var _default = (0, _asyncCommand.default)({
100
87
  }
101
88
  });
102
89
  zimletXML += '\n</zimlet>';
103
-
104
90
  try {
105
91
  _fs.default.writeFileSync(_path.default.resolve(builddir, xmlFile), zimletXML);
106
92
  } catch (err) {
107
93
  return (0, _util.error)(`Failed to write XML file: ${err}`, 1);
108
94
  }
95
+ createLocalizationFiles(argv.name, label, description);
109
96
 
110
- createLocalizationFiles(argv.name, label, description); //Zip up the contents of the build dir along with the xml file as the final zimlet deliverable
111
-
97
+ //Zip up the contents of the build dir along with the xml file as the final zimlet deliverable
112
98
  let zipFile = new _admZip.default();
113
99
  zipFile.addLocalFolder(builddir, '');
114
100
  zipFile.writeZip(dest);
115
101
  return `Successfully packaged zimlet to: ${dest}\n`;
116
102
  }
117
-
118
103
  });
119
-
120
104
  exports.default = _default;
121
-
122
105
  function getZimletLabelDescription() {
123
106
  const intlDir = _path.default.resolve(process.cwd(), 'src', 'intl');
124
-
125
107
  try {
126
108
  const content = JSON.parse(_fs.default.readFileSync(_path.default.resolve(intlDir, 'en_US.json')));
127
-
128
109
  if (!(content.zimlet?.label && content.zimlet?.description)) {
129
110
  throw new Error('label or description not found');
130
111
  }
131
-
132
112
  return {
133
113
  label: content.zimlet.label,
134
114
  description: content.zimlet.description
@@ -141,24 +121,20 @@ function getZimletLabelDescription() {
141
121
  } \nAs a fallback we are using strings from package.json which is deprecated.\n`);
142
122
  return null;
143
123
  }
144
- } // Add properties file for description and label
145
- // As admin console requires properties file to display label and desciption
146
-
124
+ }
147
125
 
126
+ // Add properties file for description and label
127
+ // As admin console requires properties file to display label and desciption
148
128
  function createLocalizationFiles(zimletName, label, description) {
149
129
  const cwd = process.cwd();
150
-
151
130
  const intlDir = _path.default.resolve(cwd, 'src', 'intl');
152
-
153
131
  let intlFiles;
154
132
  createPropertyFile(zimletName, label, description);
155
-
156
133
  try {
157
134
  intlFiles = _fs.default.readdirSync(intlDir);
158
135
  } catch (err) {
159
136
  console.error(`Failed to read ${intlDir}: ${err}`, 1);
160
137
  }
161
-
162
138
  intlFiles.filter(file => file.match(/\.json$/) && !file.includes('en_US')).forEach(intl => {
163
139
  try {
164
140
  const content = JSON.parse(_fs.default.readFileSync(_path.default.resolve(intlDir, intl)));
@@ -171,33 +147,26 @@ function createLocalizationFiles(zimletName, label, description) {
171
147
  }
172
148
  });
173
149
  }
174
-
175
150
  function createPropertyFile(fileName, label, description) {
176
151
  const builddir = _path.default.resolve(process.cwd(), 'build');
177
-
178
152
  const propertiesFile = `${fileName}.properties`;
179
153
  let zimletProperties = '\n';
180
154
  zimletProperties += `label = ${label}\n`;
181
155
  zimletProperties += `description = ${description}\n`;
182
-
183
156
  try {
184
157
  _fs.default.writeFileSync(_path.default.resolve(builddir, propertiesFile), zimletProperties);
185
158
  } catch (err) {
186
159
  return (0, _util.error)(`Failed to write properties file: ${err}`, 1);
187
160
  }
188
161
  }
189
-
190
162
  function getUnicode(txt) {
191
163
  let hex = '';
192
164
  if (txt.length === 0) return;
193
-
194
165
  for (let i = 0; i < txt.length; i++) {
195
166
  const h = txt.codePointAt(i).toString(16);
196
167
  hex += '\\u' + h.padStart(4, 0);
197
168
  if (h.length > 4) i++;
198
169
  }
199
-
200
170
  return hex;
201
171
  }
202
-
203
172
  module.exports = exports.default;
package/dist/entry.js CHANGED
@@ -14,9 +14,10 @@
14
14
  components,
15
15
  store,
16
16
  meta
17
- } = context; // Add shims to the global scope to expose dependencies to Zimlets
18
- // Shimmed dependencies include preact, preact-router, react-apollo
17
+ } = context;
19
18
 
19
+ // Add shims to the global scope to expose dependencies to Zimlets
20
+ // Shimmed dependencies include preact, preact-router, react-apollo
20
21
  global.shims = shims;
21
22
  global.zimbra = zimbra;
22
23
  global.config = config;
@@ -25,19 +26,16 @@
25
26
  global.store = store;
26
27
  global.ZIMLET_STYLES = [];
27
28
  global.meta = meta;
28
-
29
29
  let entry = require('zimlet-cli-entrypoint');
30
+ let r = entry && entry.default || entry;
30
31
 
31
- let r = entry && entry.default || entry; // If export is a factory, pass it context. Otherwise it's a singleton.
32
-
32
+ // If export is a factory, pass it context. Otherwise it's a singleton.
33
33
  let instance = typeof r === 'function' ? r(context) : r;
34
34
  context.styles.set(global.ZIMLET_STYLES.join('\n'));
35
35
  return instance;
36
36
  });
37
37
  }
38
-
39
38
  init();
40
-
41
39
  if (process.env.NODE_ENV === 'development' && module.hot) {
42
40
  module.hot.accept('zimlet-cli-entrypoint', init);
43
41
  }