|
| 1 | +# Shinylive package methods |
| 2 | + |
| 3 | +## Methods |
| 4 | + |
| 5 | +### R |
| 6 | + |
| 7 | +Interaction: |
| 8 | + |
| 9 | +``` |
| 10 | +Rscript -e 'shinylive:::quarto_ext()' [methods] [args] |
| 11 | +``` |
| 12 | + |
| 13 | +### Python |
| 14 | + |
| 15 | +Interaction: |
| 16 | + |
| 17 | +``` |
| 18 | +shinylive [methods] [args] |
| 19 | +``` |
| 20 | + |
| 21 | +## CLI Methods |
| 22 | + |
| 23 | +* `extension info` |
| 24 | + * Package, version, asset version, and script paths information |
| 25 | +* `extension base-htmldeps` |
| 26 | + * Quarto html dependencies for the base shinylive integration |
| 27 | +* `extension language-resources` |
| 28 | + * Language specific resource files for the quarto html dependency named `shinylive` |
| 29 | +* `extension app-resources` |
| 30 | + * App specific resource files for the quarto html dependency named `shinylive` |
| 31 | + |
| 32 | +### CLI Interface |
| 33 | +* `extension info` |
| 34 | + * Prints information about the extension including: |
| 35 | + * `version`: The version of the R package |
| 36 | + * `assets_version`: The version of the web assets |
| 37 | + * `scripts`: A list of paths scripts that are used by the extension, |
| 38 | + mainly `codeblock-to-json` |
| 39 | + * Example |
| 40 | + ``` |
| 41 | + { |
| 42 | + "version": "0.1.0", |
| 43 | + "assets_version": "0.2.0", |
| 44 | + "scripts": { |
| 45 | + "codeblock-to-json": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/scripts/codeblock-to-json.js" |
| 46 | + } |
| 47 | + } |
| 48 | + ``` |
| 49 | +* `extension base-htmldeps` |
| 50 | + * Prints the language agnostic quarto html dependencies as a JSON array. |
| 51 | + * The first html dependency is the `shinylive` service workers. |
| 52 | + * The second html dependency is the `shinylive` base dependencies. This |
| 53 | + dependency will contain the core `shinylive` asset scripts (JS files |
| 54 | + automatically sourced), stylesheets (CSS files that are automatically |
| 55 | + included), and resources (additional files that the JS and CSS files can |
| 56 | + source). |
| 57 | + * Example |
| 58 | + ``` |
| 59 | + [ |
| 60 | + { |
| 61 | + "name": "shinylive-serviceworker", |
| 62 | + "version": "0.2.0", |
| 63 | + "meta": { "shinylive:serviceworker_dir": "." }, |
| 64 | + "serviceworkers": [ |
| 65 | + { |
| 66 | + "source": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive-sw.js", |
| 67 | + "destination": "/shinylive-sw.js" |
| 68 | + } |
| 69 | + ] |
| 70 | + }, |
| 71 | + { |
| 72 | + "name": "shinylive", |
| 73 | + "version": "0.2.0", |
| 74 | + "scripts": [{ |
| 75 | + "name": "shinylive/load-shinylive-sw.js", |
| 76 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/load-shinylive-sw.js", |
| 77 | + "attribs": { "type": "module" } |
| 78 | + }], |
| 79 | + "stylesheets": [{ |
| 80 | + "name": "shinylive/shinylive.css", |
| 81 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/shinylive.css" |
| 82 | + }], |
| 83 | + "resources": [ |
| 84 | + { |
| 85 | + "name": "shinylive/shinylive.js", |
| 86 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/shinylive.js" |
| 87 | + }, |
| 88 | + ... # [ truncated ] |
| 89 | + ] |
| 90 | + } |
| 91 | + ] |
| 92 | + ``` |
| 93 | +* `extension language-resources` |
| 94 | + * Prints the language-specific resource files as JSON that should be added to the quarto html dependency. |
| 95 | + * For r-shinylive, this includes the webr resource files |
| 96 | + * For py-shinylive, this includes the pyodide and pyright resource files. |
| 97 | + * Example |
| 98 | + ``` |
| 99 | + [ |
| 100 | + { |
| 101 | + "name": "shinylive/webr/esbuild.d.ts", |
| 102 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/webr/esbuild.d.ts" |
| 103 | + }, |
| 104 | + { |
| 105 | + "name": "shinylive/webr/libRblas.so", |
| 106 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/webr/libRblas.so" |
| 107 | + }, |
| 108 | + ... # [ truncated ] |
| 109 | + ] |
| 110 | +* `extension app-resources` |
| 111 | + * Prints app-specific resource files as JSON that should be added to the `"shinylive"` quarto html dependency. |
| 112 | + * Currently, r-shinylive does not return any resource files. |
| 113 | + * Example |
| 114 | + ``` |
| 115 | + [ |
| 116 | + { |
| 117 | + "name": "shinylive/pyodide/anyio-3.7.0-py3-none-any.whl", |
| 118 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/pyodide/anyio-3.7.0-py3-none-any.whl" |
| 119 | + }, |
| 120 | + { |
| 121 | + "name": "shinylive/pyodide/appdirs-1.4.4-py2.py3-none-any.whl", |
| 122 | + "path": "/<ASSETS_CACHE_DIR>/shinylive-0.2.0/shinylive/pyodide/appdirs-1.4.4-py2.py3-none-any.whl" |
| 123 | + }, |
| 124 | + ... # [ truncated ] |
| 125 | + ] |
| 126 | + ``` |
0 commit comments