orator 6.1.0 → 6.1.1

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 (2) hide show
  1. package/package.json +5 -4
  2. package/source/Orator.js +16 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orator",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
4
4
  "description": "Unopinionated API http server abstraction - REST or IPC",
5
5
  "main": "source/Orator.js",
6
6
  "scripts": {
@@ -15,7 +15,8 @@
15
15
  "docker-dev-shell": "docker exec -it orator-dev /bin/bash"
16
16
  },
17
17
  "browser": {
18
- "./source/Orator-Default-ServiceServer.js": "./source/Orator-Default-ServiceServer-Web.js"
18
+ "./source/Orator-Default-ServiceServer.js": "./source/Orator-Default-ServiceServer-Web.js",
19
+ "orator-static-server": false
19
20
  },
20
21
  "repository": {
21
22
  "type": "git",
@@ -53,12 +54,12 @@
53
54
  "devDependencies": {
54
55
  "fable": "^3.1.71",
55
56
  "pict-docuserve": "^0.1.5",
56
- "quackage": "^1.1.2"
57
+ "quackage": "^1.1.3"
57
58
  },
58
59
  "dependencies": {
59
60
  "fable-serviceproviderbase": "^3.0.19",
60
61
  "find-my-way": "^9.5.0",
61
62
  "orator-serviceserver-base": "^1.0.7",
62
- "orator-static-server": "^2.1.2"
63
+ "orator-static-server": "^2.1.3"
63
64
  }
64
65
  }
package/source/Orator.js CHANGED
@@ -11,7 +11,19 @@ const libFableServiceProviderBase = require('fable-serviceproviderbase');
11
11
 
12
12
  const libDefaultOratorServiceServer = require('./Orator-Default-ServiceServer.js');
13
13
 
14
- const libOratorStaticServer = require('orator-static-server');
14
+ // orator-static-server is lazy-loaded so that browser bundles using orator's
15
+ // IPC mode don't pay the cost of (or trip over) its server-only deps. Only
16
+ // setMimeHeader / addStaticRoute / addStaticRouteWithFallbacks need it, and
17
+ // none of those are reachable from IPC-only consumers.
18
+ let libOratorStaticServer = null;
19
+ const getOratorStaticServer = () =>
20
+ {
21
+ if (!libOratorStaticServer)
22
+ {
23
+ libOratorStaticServer = require('orator-static-server');
24
+ }
25
+ return libOratorStaticServer;
26
+ };
15
27
 
16
28
  const defaultOratorConfiguration = require('./Orator-Default-Configuration.js');
17
29
 
@@ -381,7 +393,7 @@ class Orator extends libFableServiceProviderBase
381
393
  // Force auto-registration so the method is available
382
394
  if (!this.fable.serviceManager.servicesMap.hasOwnProperty('OratorStaticServer'))
383
395
  {
384
- this.fable.serviceManager.addServiceType('OratorStaticServer', libOratorStaticServer);
396
+ this.fable.serviceManager.addServiceType('OratorStaticServer', getOratorStaticServer());
385
397
  }
386
398
  this.fable.serviceManager.instantiateServiceProvider('OratorStaticServer', {}, 'OratorStaticServer-AutoInit');
387
399
  }
@@ -404,7 +416,7 @@ class Orator extends libFableServiceProviderBase
404
416
  // Auto-register the OratorStaticServer service type if it hasn't been registered yet
405
417
  if (!this.fable.serviceManager.servicesMap.hasOwnProperty('OratorStaticServer'))
406
418
  {
407
- this.fable.serviceManager.addServiceType('OratorStaticServer', libOratorStaticServer);
419
+ this.fable.serviceManager.addServiceType('OratorStaticServer', getOratorStaticServer());
408
420
  }
409
421
 
410
422
  // Auto-instantiate a default OratorStaticServer instance if none exists
@@ -437,7 +449,7 @@ class Orator extends libFableServiceProviderBase
437
449
  {
438
450
  if (!this.fable.serviceManager.servicesMap.hasOwnProperty('OratorStaticServer'))
439
451
  {
440
- this.fable.serviceManager.addServiceType('OratorStaticServer', libOratorStaticServer);
452
+ this.fable.serviceManager.addServiceType('OratorStaticServer', getOratorStaticServer());
441
453
  }
442
454
  if (!this.fable.OratorStaticServer)
443
455
  {