@cloudcrane/app-runtime 0.3.0 → 0.5.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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ const { html, sha256, runtime } = compile(spec);
12
12
  ```
13
13
 
14
14
  - `compile(spec)` returns the page, its sha256 and the runtime it was built
15
- with (`@cloudcrane/app-runtime@0.2.0+<hash>`); it throws `CompileError`
15
+ with (`@cloudcrane/app-runtime@0.4.0+<hash>`); it throws `CompileError`
16
16
  listing every problem when the spec doesn't validate.
17
17
  - `compile(spec, { runtime: "shared" })` links the runtime instead of inlining
18
18
  it: the page names `runtimeFile().path` (`/_cc/runtime/<version>-<hash>.js`)
@@ -39,6 +39,20 @@ const { html, sha256, runtime } = compile(spec);
39
39
  game.random(); // seeded by the page
40
40
  ```
41
41
 
42
+ The page kit runs an HTML page as it is, full screen. Its `localStorage`
43
+ works: what it holds is written into the frame when it opens, and each
44
+ change goes to the page, which keeps it under `<data.key>.coded.<id>` (at
45
+ most 4 MB), so it survives a reload and an update and the frame sees only
46
+ its own. Both kits reach the page through `window.__ccBus`.
47
+
48
+ A component's frame is allowed the device features the spec's `uses`
49
+ declares (its `allow`), and the page must allow them for frames too (in
50
+ Permissions-Policy, `geolocation=*` rather than `(self)`). Browsers give a
51
+ frame with no origin of its own no camera or microphone, so a page kit whose
52
+ spec declares either runs with the page's origin; it's then no more apart
53
+ from the page than an app written straight into it. A game kit always
54
+ stays apart.
55
+
42
56
  - `@cloudcrane/app-runtime/host`: what a host publishing spec apps needs in one
43
57
  import (validate, compile, derive the blueprint).
44
58
 
@@ -43,10 +43,11 @@ export function compile(input, options = {}) {
43
43
  if (spec.manifest.runtime !== RUNTIME_VERSION)
44
44
  throw new CompileError([{ at: "manifest.runtime", problem: `this compiler builds runtime ${RUNTIME_VERSION}` }]);
45
45
  // Only what drawing the app needs goes in the page: not the journeys, promises or tests.
46
- // Coded components go in only when there are some.
46
+ // Coded components go in only when there are some, and the device features they may use only when it uses some.
47
47
  const inPage = {
48
48
  module: spec.module,
49
49
  ...(Object.keys(spec.components).length ? { components: spec.components } : {}),
50
+ ...(spec.uses.length ? { uses: spec.uses } : {}),
50
51
  data: spec.data,
51
52
  logic: spec.logic,
52
53
  surface: spec.surface,