hopple 0.1.0-rc.2 → 0.1.0-rc.3

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
@@ -46,9 +46,10 @@ export default {
46
46
  - **`build`** (optional) is the command that builds the game. It runs first, in
47
47
  the config's directory, and a failed build stops the command. So
48
48
  `npx hopple publish` can't upload a stale build. `--no-build` skips it.
49
- - **`page`** is the built HTML file, relative to the config. It is the one file
50
- that is played in the dev shell and published, so it must contain the whole
51
- game.
49
+ - **`page`** is the built HTML file, relative to the config: the `index.html`
50
+ of the build's output directory, which is played in the dev shell and
51
+ published whole. A page beside the config has no output directory, and is
52
+ published alone.
52
53
  - **`manifest`** is what the game is: its id, title, description, and what it
53
54
  declares. See [the manifest's reference](https://docs.hopple.app/manifest.md).
54
55
 
@@ -68,7 +69,7 @@ and errors in an editor, the manifest's included.
68
69
 
69
70
  ```
70
71
  hopple create <dir>
71
- hopple dev [project] [--port <n>] [--no-build]
72
+ hopple dev [project] [--port <n>] [--server <url>] [--no-build]
72
73
  hopple check [project] [--no-build]
73
74
  hopple publish [project] [--server <url>] [--no-build]
74
75
  hopple list [--server <url>]
@@ -100,8 +101,13 @@ Writes a new project into `<dir>`, which must be new or empty. The directory's
100
101
  name becomes the game's id (lowercase letters, digits and hyphens). It is the
101
102
  recommended setup, not a requirement:
102
103
 
103
- - **Vite** builds it, with `vite-plugin-singlefile` inlining every script,
104
- style and imported asset into `dist/index.html`.
104
+ - **Vite** builds it into `dist/`, with `base: './'` so every address in it
105
+ is relative, and `dist/index.html` as its page.
106
+ - **`index.html` loads the runtime as its first script**,
107
+ `<script src="_rt/1/hopple.js"></script>`. The runtime is the SDK, served
108
+ beside the game by whatever runs it; the `@hopple/sdk` package the game
109
+ imports is its types and a stub that forwards to it. So a fix to the SDK
110
+ reaches the game without a rebuild. Keep the tag first.
105
111
  - **`hopple.config.ts`** builds with `npm run build` (typecheck with `tsc`,
106
112
  then bundle), names `dist/index.html` as the page, and holds the manifest.
107
113
  Being TypeScript, a mistake in the manifest is a type error.
@@ -124,8 +130,13 @@ The dev server serves:
124
130
 
125
131
  - `/`: the dev shell.
126
132
  - `/game/`: the config's `page`, and `/game/…` the other files in its
127
- directory, with CORS enabled and caching disabled. Nothing outside that
128
- directory is served.
133
+ directory, with caching disabled. Nothing outside that directory is
134
+ served.
135
+ - `/game/_rt/1/hopple.js`: the runtime, beside the game as it is beside every
136
+ published version. It is the release the server's players get, fetched
137
+ from the server (`--server`, as for the other commands) when `hopple dev`
138
+ starts, or the copy this CLI carries when the server can't be reached; the
139
+ terminal says which.
129
140
 
130
141
  A valid manifest is shown in the shell. An invalid or missing one is reported
131
142
  in the terminal and on the page, naming the bad fields, and the game still
@@ -152,14 +163,31 @@ npx hopple check --no-build # as it was last built
152
163
  Everything `publish` checks before it uploads, without uploading:
153
164
 
154
165
  1. The manifest validates.
155
- 2. The **page** exists, and loads nothing from outside itself: no
156
- `<script src>`, stylesheet `<link>`, `<img>` or CSS `url()` that isn't a
157
- `data:` URL. Only that one file is published, so it must contain the whole
158
- game, with every script and asset inlined. (Files the game's code fetches
159
- can't be seen this way; they fail the same way.)
166
+ 2. The **page** exists and is its output directory's `index.html`, and loads
167
+ nothing the directory doesn't hold: every `<script src>`, stylesheet
168
+ `<link>`, `<img>` and CSS `url()` is a `data:` URL or a file in the
169
+ directory, referred to relatively. That directory is what is published, at
170
+ the root of the version's own address, and a game reaches nothing else.
171
+ (Files the game's code fetches can't be seen this way; they fail the same
172
+ way.) A page beside its config is published alone, so it must contain the
173
+ whole game. The runtime, `_rt/`, is not the game's: it is served beside
174
+ every game, and the directory may hold nothing there.
175
+ 3. The page loads the runtime as its first script,
176
+ `<script src="_rt/1/hopple.js"></script>`, as it is, and no page or
177
+ script carries a copy of the SDK. Games published before the runtime keep
178
+ the SDK they bundled, but a new upload built that way is refused.
179
+ 4. Nothing is addressed from the root (`/assets/x.png` names the root of
180
+ whatever serves the game, not the game), no page has a `<base>`, and every
181
+ page is UTF-8.
182
+ 5. No script uses `localStorage`, `sessionStorage`, IndexedDB, Cache
183
+ Storage or `document.cookie`: a game's origin keeps nothing past a reload,
184
+ and the runtime makes them throw. Use `save` instead.
185
+
186
+ The server checks the same, in the same words.
160
187
 
161
188
  It exits with 1 and says what is wrong, or prints the game's id, version and
162
- size.
189
+ size. Over 2 MB compressed it warns that a player on a phone waits for the
190
+ game, and over 10 MB `publish` refuses it.
163
191
 
164
192
  ### `hopple publish`
165
193
 
@@ -8,6 +8,32 @@ Licensed under MIT. The package ships no license text.
8
8
 
9
9
  --------------------------------------------------------------------------------
10
10
 
11
+ fflate 0.8.2 (MIT)
12
+
13
+ MIT License
14
+
15
+ Copyright (c) 2023 Arjun Barrett
16
+
17
+ Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ of this software and associated documentation files (the "Software"), to deal
19
+ in the Software without restriction, including without limitation the rights
20
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ copies of the Software, and to permit persons to whom the Software is
22
+ furnished to do so, subject to the following conditions:
23
+
24
+ The above copyright notice and this permission notice shall be included in all
25
+ copies or substantial portions of the Software.
26
+
27
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ SOFTWARE.
34
+
35
+ --------------------------------------------------------------------------------
36
+
11
37
  react-dom 19.2.3 (MIT)
12
38
 
13
39
  MIT License