@fastly/compute-js-static-publish 6.3.0 → 7.0.0-beta.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 (238) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +31 -586
  3. package/README.short.md +53 -0
  4. package/build/cli/commands/clean.d.ts +2 -0
  5. package/build/cli/commands/clean.d.ts.map +1 -0
  6. package/build/cli/commands/clean.js +121 -0
  7. package/build/cli/commands/collections/delete.d.ts +2 -0
  8. package/build/cli/commands/collections/delete.d.ts.map +1 -0
  9. package/build/cli/commands/collections/delete.js +88 -0
  10. package/build/cli/commands/collections/index.d.ts +2 -0
  11. package/build/cli/commands/collections/index.d.ts.map +1 -0
  12. package/build/cli/commands/collections/index.js +52 -0
  13. package/build/cli/commands/collections/list.d.ts +2 -0
  14. package/build/cli/commands/collections/list.d.ts.map +1 -0
  15. package/build/cli/commands/collections/list.js +62 -0
  16. package/build/cli/commands/index.d.ts +2 -0
  17. package/build/cli/commands/index.d.ts.map +1 -0
  18. package/build/cli/commands/index.js +67 -0
  19. package/build/cli/commands/init-app.d.ts +18 -2
  20. package/build/cli/commands/init-app.d.ts.map +1 -1
  21. package/build/cli/commands/init-app.js +291 -264
  22. package/build/cli/commands/publish-content.d.ts +2 -0
  23. package/build/cli/commands/publish-content.d.ts.map +1 -0
  24. package/build/cli/commands/publish-content.js +472 -0
  25. package/build/cli/compression/brotli.d.ts +1 -1
  26. package/build/cli/compression/brotli.d.ts.map +1 -1
  27. package/build/cli/compression/brotli.js +8 -11
  28. package/build/cli/compression/gzip.d.ts +1 -1
  29. package/build/cli/compression/gzip.d.ts.map +1 -1
  30. package/build/cli/compression/gzip.js +8 -11
  31. package/build/cli/compression/index.d.ts +3 -6
  32. package/build/cli/compression/index.d.ts.map +1 -1
  33. package/build/cli/compression/index.js +8 -9
  34. package/build/cli/fastly-api/api-token.d.ts +17 -0
  35. package/build/cli/fastly-api/api-token.d.ts.map +1 -0
  36. package/build/cli/fastly-api/api-token.js +94 -0
  37. package/build/cli/fastly-api/kv-store.d.ts +24 -0
  38. package/build/cli/fastly-api/kv-store.d.ts.map +1 -0
  39. package/build/cli/{util → fastly-api}/kv-store.js +42 -22
  40. package/build/cli/index.js +7 -91
  41. package/build/cli/util/args.d.ts +16 -0
  42. package/build/cli/util/args.d.ts.map +1 -0
  43. package/build/cli/util/args.js +55 -0
  44. package/build/cli/util/config.d.ts +13 -0
  45. package/build/cli/util/config.d.ts.map +1 -0
  46. package/build/cli/{load-config.js → util/config.js} +234 -187
  47. package/build/{util → cli/util}/content-types.d.ts +1 -2
  48. package/build/cli/util/content-types.d.ts.map +1 -0
  49. package/build/{util → cli/util}/content-types.js +11 -6
  50. package/build/cli/util/data.d.ts +3 -3
  51. package/build/cli/util/data.d.ts.map +1 -1
  52. package/build/cli/util/data.js +6 -2
  53. package/build/cli/util/files.d.ts +10 -2
  54. package/build/cli/util/files.d.ts.map +1 -1
  55. package/build/cli/util/files.js +53 -6
  56. package/build/cli/util/kv-store-items.d.ts +12 -0
  57. package/build/cli/util/kv-store-items.d.ts.map +1 -0
  58. package/build/cli/util/kv-store-items.js +161 -0
  59. package/build/cli/util/kv-store-local-server.d.ts +3 -0
  60. package/build/cli/util/kv-store-local-server.d.ts.map +1 -0
  61. package/build/cli/util/kv-store-local-server.js +35 -0
  62. package/build/cli/util/package.d.ts +9 -0
  63. package/build/cli/util/package.d.ts.map +1 -0
  64. package/build/cli/util/package.js +44 -0
  65. package/build/cli/util/retryable.d.ts +12 -0
  66. package/build/cli/util/retryable.d.ts.map +1 -0
  67. package/build/cli/util/retryable.js +43 -0
  68. package/build/cli/util/variants.d.ts +4 -0
  69. package/build/cli/util/variants.d.ts.map +1 -0
  70. package/build/cli/util/variants.js +27 -0
  71. package/build/index.d.ts +5 -5
  72. package/build/index.d.ts.map +1 -1
  73. package/build/index.js +7 -6
  74. package/build/models/assets/kvstore-assets.d.ts +17 -0
  75. package/build/models/assets/kvstore-assets.d.ts.map +1 -0
  76. package/build/models/assets/kvstore-assets.js +28 -0
  77. package/build/{constants/compression.d.ts → models/compression/index.d.ts} +2 -1
  78. package/build/models/compression/index.d.ts.map +1 -0
  79. package/build/models/compression/index.js +11 -0
  80. package/build/models/config/publish-content-config.d.ts +41 -0
  81. package/build/models/config/publish-content-config.d.ts.map +1 -0
  82. package/build/models/config/publish-content-config.js +5 -0
  83. package/build/models/config/publisher-server-config.d.ts +20 -0
  84. package/build/models/config/publisher-server-config.d.ts.map +1 -0
  85. package/build/models/config/publisher-server-config.js +5 -0
  86. package/build/models/config/static-publish-rc.d.ts +6 -0
  87. package/build/models/config/static-publish-rc.d.ts.map +1 -0
  88. package/build/models/config/static-publish-rc.js +5 -0
  89. package/build/server/collection-selector/from-config-store.d.ts +2 -0
  90. package/build/server/collection-selector/from-config-store.d.ts.map +1 -0
  91. package/build/server/collection-selector/from-config-store.js +15 -0
  92. package/build/server/collection-selector/from-cookie.d.ts +23 -0
  93. package/build/server/collection-selector/from-cookie.d.ts.map +1 -0
  94. package/build/server/collection-selector/from-cookie.js +98 -0
  95. package/build/server/collection-selector/from-request.d.ts +13 -0
  96. package/build/server/collection-selector/from-request.d.ts.map +1 -0
  97. package/build/server/collection-selector/from-request.js +22 -0
  98. package/build/server/collection-selector/index.d.ts +5 -0
  99. package/build/server/collection-selector/index.d.ts.map +1 -0
  100. package/build/server/collection-selector/index.js +7 -0
  101. package/build/server/collection-selector/request-collection-selector.d.ts +5 -0
  102. package/build/server/collection-selector/request-collection-selector.d.ts.map +1 -0
  103. package/build/server/collection-selector/request-collection-selector.js +5 -0
  104. package/build/server/publisher-server/index.d.ts +38 -0
  105. package/build/server/publisher-server/index.d.ts.map +1 -0
  106. package/build/server/publisher-server/index.js +415 -0
  107. package/build/server/publisher-server/serve-preconditions/if-modified-since.d.ts +3 -0
  108. package/build/server/publisher-server/serve-preconditions/if-modified-since.d.ts.map +1 -0
  109. package/build/server/{serve-preconditions → publisher-server/serve-preconditions}/if-modified-since.js +6 -2
  110. package/build/server/publisher-server/serve-preconditions/if-none-match.d.ts.map +1 -0
  111. package/build/server/{serve-preconditions → publisher-server/serve-preconditions}/if-none-match.js +4 -0
  112. package/build/server/util/cookies.d.ts +2 -0
  113. package/build/server/util/cookies.d.ts.map +1 -0
  114. package/build/server/util/cookies.js +14 -0
  115. package/build/server/util/kv-store.d.ts +3 -0
  116. package/build/server/util/kv-store.d.ts.map +1 -0
  117. package/build/server/util/kv-store.js +95 -0
  118. package/package.json +18 -10
  119. package/build/cli/commands/build-static.d.ts +0 -3
  120. package/build/cli/commands/build-static.d.ts.map +0 -1
  121. package/build/cli/commands/build-static.js +0 -541
  122. package/build/cli/commands/clean-kv-store.d.ts +0 -3
  123. package/build/cli/commands/clean-kv-store.d.ts.map +0 -1
  124. package/build/cli/commands/clean-kv-store.js +0 -55
  125. package/build/cli/load-config.d.ts +0 -6
  126. package/build/cli/load-config.d.ts.map +0 -1
  127. package/build/cli/presets/implementations/astro.d.ts +0 -7
  128. package/build/cli/presets/implementations/astro.d.ts.map +0 -1
  129. package/build/cli/presets/implementations/astro.js +0 -23
  130. package/build/cli/presets/implementations/create-react-app.d.ts +0 -11
  131. package/build/cli/presets/implementations/create-react-app.d.ts.map +0 -1
  132. package/build/cli/presets/implementations/create-react-app.js +0 -34
  133. package/build/cli/presets/implementations/docusaurus.d.ts +0 -7
  134. package/build/cli/presets/implementations/docusaurus.d.ts.map +0 -1
  135. package/build/cli/presets/implementations/docusaurus.js +0 -13
  136. package/build/cli/presets/implementations/gatsby.d.ts +0 -7
  137. package/build/cli/presets/implementations/gatsby.d.ts.map +0 -1
  138. package/build/cli/presets/implementations/gatsby.js +0 -13
  139. package/build/cli/presets/implementations/next.d.ts +0 -7
  140. package/build/cli/presets/implementations/next.d.ts.map +0 -1
  141. package/build/cli/presets/implementations/next.js +0 -13
  142. package/build/cli/presets/implementations/sveltekit.d.ts +0 -7
  143. package/build/cli/presets/implementations/sveltekit.d.ts.map +0 -1
  144. package/build/cli/presets/implementations/sveltekit.js +0 -13
  145. package/build/cli/presets/implementations/vite.d.ts +0 -7
  146. package/build/cli/presets/implementations/vite.d.ts.map +0 -1
  147. package/build/cli/presets/implementations/vite.js +0 -13
  148. package/build/cli/presets/implementations/vue.d.ts +0 -7
  149. package/build/cli/presets/implementations/vue.d.ts.map +0 -1
  150. package/build/cli/presets/implementations/vue.js +0 -24
  151. package/build/cli/presets/index.d.ts +0 -3
  152. package/build/cli/presets/index.d.ts.map +0 -1
  153. package/build/cli/presets/index.js +0 -20
  154. package/build/cli/presets/preset-base.d.ts +0 -21
  155. package/build/cli/presets/preset-base.d.ts.map +0 -1
  156. package/build/cli/presets/preset-base.js +0 -1
  157. package/build/cli/util/fastly-api.d.ts +0 -10
  158. package/build/cli/util/fastly-api.d.ts.map +0 -1
  159. package/build/cli/util/fastly-api.js +0 -47
  160. package/build/cli/util/hash.d.ts +0 -5
  161. package/build/cli/util/hash.d.ts.map +0 -1
  162. package/build/cli/util/hash.js +0 -9
  163. package/build/cli/util/id.d.ts +0 -3
  164. package/build/cli/util/id.d.ts.map +0 -1
  165. package/build/cli/util/id.js +0 -17
  166. package/build/cli/util/kv-store.d.ts +0 -16
  167. package/build/cli/util/kv-store.d.ts.map +0 -1
  168. package/build/cli/util/publish-id.d.ts +0 -5
  169. package/build/cli/util/publish-id.d.ts.map +0 -1
  170. package/build/cli/util/publish-id.js +0 -26
  171. package/build/compute-js.d.ts +0 -3
  172. package/build/compute-js.d.ts.map +0 -1
  173. package/build/compute-js.js +0 -2
  174. package/build/constants/compression.d.ts.map +0 -1
  175. package/build/constants/compression.js +0 -4
  176. package/build/server/assets/asset-manager.d.ts +0 -8
  177. package/build/server/assets/asset-manager.d.ts.map +0 -1
  178. package/build/server/assets/asset-manager.js +0 -14
  179. package/build/server/assets/content-asset-kv-store.d.ts +0 -19
  180. package/build/server/assets/content-asset-kv-store.d.ts.map +0 -1
  181. package/build/server/assets/content-asset-kv-store.js +0 -70
  182. package/build/server/assets/content-asset-wasm-inline.d.ts +0 -18
  183. package/build/server/assets/content-asset-wasm-inline.d.ts.map +0 -1
  184. package/build/server/assets/content-asset-wasm-inline.js +0 -52
  185. package/build/server/assets/content-assets.d.ts +0 -46
  186. package/build/server/assets/content-assets.d.ts.map +0 -1
  187. package/build/server/assets/content-assets.js +0 -100
  188. package/build/server/assets/module-assets.d.ts +0 -23
  189. package/build/server/assets/module-assets.d.ts.map +0 -1
  190. package/build/server/assets/module-assets.js +0 -45
  191. package/build/server/kv-store/inline-store-entry.d.ts +0 -25
  192. package/build/server/kv-store/inline-store-entry.d.ts.map +0 -1
  193. package/build/server/kv-store/inline-store-entry.js +0 -100
  194. package/build/server/publisher-server.d.ts +0 -23
  195. package/build/server/publisher-server.d.ts.map +0 -1
  196. package/build/server/publisher-server.js +0 -257
  197. package/build/server/serve-preconditions/if-modified-since.d.ts +0 -4
  198. package/build/server/serve-preconditions/if-modified-since.d.ts.map +0 -1
  199. package/build/server/serve-preconditions/if-none-match.d.ts.map +0 -1
  200. package/build/server/util/http.d.ts +0 -2
  201. package/build/server/util/http.d.ts.map +0 -1
  202. package/build/server/util/http.js +0 -9
  203. package/build/types/compute.d.ts +0 -11
  204. package/build/types/compute.d.ts.map +0 -1
  205. package/build/types/compute.js +0 -1
  206. package/build/types/config-normalized.d.ts +0 -34
  207. package/build/types/config-normalized.d.ts.map +0 -1
  208. package/build/types/config-normalized.js +0 -1
  209. package/build/types/config.d.ts +0 -37
  210. package/build/types/config.d.ts.map +0 -1
  211. package/build/types/config.js +0 -1
  212. package/build/types/content-assets.d.ts +0 -55
  213. package/build/types/content-assets.d.ts.map +0 -1
  214. package/build/types/content-assets.js +0 -1
  215. package/build/types/content-types.d.ts +0 -11
  216. package/build/types/content-types.d.ts.map +0 -1
  217. package/build/types/content-types.js +0 -1
  218. package/build/types/index.d.ts +0 -7
  219. package/build/types/index.d.ts.map +0 -1
  220. package/build/types/index.js +0 -1
  221. package/build/types/module-assets.d.ts +0 -15
  222. package/build/types/module-assets.d.ts.map +0 -1
  223. package/build/types/module-assets.js +0 -1
  224. package/build/types/util.d.ts +0 -7
  225. package/build/types/util.d.ts.map +0 -1
  226. package/build/types/util.js +0 -1
  227. package/build/util/content-types.d.ts.map +0 -1
  228. package/build/util/index.d.ts +0 -3
  229. package/build/util/index.d.ts.map +0 -1
  230. package/build/util/index.js +0 -2
  231. package/build/util/metadata.d.ts +0 -3
  232. package/build/util/metadata.d.ts.map +0 -1
  233. package/build/util/metadata.js +0 -12
  234. package/resources/README.md +0 -3
  235. package/resources/statics-metadata.d.ts +0 -10
  236. package/resources/statics.d.ts +0 -19
  237. package/resources/webpack.config.js +0 -41
  238. /package/build/server/{serve-preconditions → publisher-server/serve-preconditions}/if-none-match.d.ts +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2022 Fastly, Inc.
3
+ Copyright (c) 2025 Fastly, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,608 +1,53 @@
1
- # Static Publisher for JavaScript on Fastly Compute
1
+ # @fastly/compute-js-static-publish
2
2
 
3
- Using a static site generator to build your website? Do you simply need to serve some static files? With `compute-js-static-publish`, now you can deploy and serve everything from Fastly's blazing-fast [Compute](https://developer.fastly.com/learning/compute/).
3
+ Fastly Compute + KV Store for static websites and web apps.
4
4
 
5
- ## Prerequisites
5
+ This CLI tool helps you:
6
6
 
7
- Node 18 or newer is required during the build step, as we now rely on its `experimental-fetch` feature.
7
+ - ✅ Deploy static sites to Fastly Compute with zero backend
8
+ - 📦 Store files in Fastly KV Store efficiently
9
+ - 🗂 Publish to named collections (`live`, `preview-42`, etc.)
10
+ - 🔄 Switch between collections at runtime
11
+ - 🧹 Clean up old or expired assets
8
12
 
9
- ## How it works
13
+ ---
10
14
 
11
- You have some HTML files, along with some accompanying CSS, JavaScript, image, and font files in a directory. Perhaps you've used a framework or static site generator to build these files.
15
+ ## Quick Start
12
16
 
13
- Assuming the root directory that contains your static files is `./public`,
17
+ Create a directory for your project, place your static files in `./public`, then type:
14
18
 
15
- ### 1. Run `compute-js-static-publish`
16
-
17
- ```shell
18
- npx @fastly/compute-js-static-publish@latest --root-dir=./public
19
+ ```sh
20
+ npx @fastly/compute-js-static-publish --root-dir=./public --kv-store-name=site-content
19
21
  ```
20
22
 
21
- This will generate a Compute application at `./compute-js`. It will add a default `./compute-js/src/index.js` file that instantiates the [`PublisherServer`](#publisherserver) class and runs it to serve the static files from your project.
22
-
23
- > [!TIP]
24
- > This process creates a `./compute-js/static-publish.rc.js` to hold your configuration. This, as well as the other files created in your new Compute program at `./compute-js`, can be committed to source control (except for the ones we specify in `.gitignore`!)
25
-
26
- > [!IMPORTANT]
27
- > This step generates an application that includes your files and a program that serves them, and needs to be run only once. To make modifications to your application, simply make changes to your static files and rebuild it. Read the rest of this section for more details.
23
+ ### 🔧 Local Preview
28
24
 
29
- ### 2. Test your application locally
30
-
31
- The `start` script builds and runs your application using [Fastly's local development server](https://developer.fastly.com/learning/compute/testing/#running-a-local-testing-server).
32
-
33
- ```shell
34
- cd ./compute-js
25
+ ```sh
26
+ cd compute-js
35
27
  npm install
36
- npm run start
28
+ npm run start # preview locally
37
29
  ```
38
30
 
39
- The build process scans your `./public` directory to generate files in the `./compute-js/static-publisher` directory. These files are packaged into your application's Wasm binary.
40
-
41
- Once your application is running, your files will be served under `http://127.0.0.1:7676/` at the corresponding paths relative to the `./public` directory. For example, making a request to `http://127.0.0.1:7676/foo/bar.html` will attempt to serve the file at `./public/foo/bar.html`.
31
+ Serves your app at `http://127.0.0.1:7676`, powered by a simulated KV Store.
42
32
 
43
- ### 3. Make changes to your application
33
+ ### 🚀 Deploy to Production
44
34
 
45
- Now, you're free to make changes to your static files. Add, modify, or remove files in the `./public` directory, and then re-build and re-run your application by typing `npm run start` again.
35
+ When you're ready to go live, [create a free Fastly account](https://www.fastly.com/signup/?tier=free) if you haven't already, and then:
46
36
 
47
- Each time you re-build the project, `compute-js-static-publish` will re-scan your `./public` directory and regenerate the files in the `./compute-js/static-publisher` directory.
48
-
49
- > [!TIP]
50
- > You can make further customizations to the behavior of your application, such as specifying directories of your static files, specifying whether to use GZIP compression on your files, specifying custom MIME types of your files, and more. You can also run custom code alongside the default server behavior, or even access the contents of the files directly from custom code. See [Advanced Usages](#advanced-usages) below for details. Rebuilding will not modify the files in your `./compute-js/src` directory, so feel safe making customizations to your code.
51
-
52
- ### 4. When you're ready to go live, deploy your Compute service
53
-
54
- The `deploy` script builds and [publishes your application to a Compute service in your Fastly account](https://developer.fastly.com/reference/cli/compute/publish/).
55
-
56
- ```shell
57
- npm run deploy
37
+ ```sh
38
+ cd compute-js
39
+ npm run deploy # deploy the app
40
+ npm run publish-content # upload your static files
58
41
  ```
59
42
 
60
43
  ## Features
61
44
 
62
- - Simple to set up, with a built-in server module.
63
- - Or, make file contents directly available to your application, so you can write your own server.
64
- - Content and metadata are available to your application, accessible by files' pre-package file paths.
65
- - Brotli and Gzip compression.
66
- - Support for `If-None-Match` and `If-Modified-Since` request headers.
67
- - Optionally use webpack as a module bundler.
68
- - Selectively serve files from Fastly's [KV Store](#kv-store), or embedded into your Wasm module.
69
- - Supports loading JavaScript files as code into your Compute application.
70
- - Presets for several static site generators.
71
-
72
- Some of these features are new! If you wish to update to this version, you may need to re-scaffold your application, or follow the steps outlined in [MIGRATING.md](./MIGRATING.md).
73
-
74
- ## How does it work? Where are the files?
75
-
76
- Once your application is scaffolded, `@fastly/compute-js-static-publish` integrates into your development process by
77
- running as part of your build process.
78
-
79
- The files you have configured to be included (`--root-dir`) are enumerated and prepared. Their contents are included into
80
- your Wasm binary (or made available via [KV Store](#kv-store), if so configured). This process is called "publishing".
81
-
82
- Once the files are published, they are available to the other source files in the Compute application. For example,
83
- the stock application runs the [PublisherServer](#publisherserver) class to serve these files.
84
-
85
- For more advanced uses, such as accessing the contents of these file in your application, see the
86
- [Using the packaged objects in your own application](#using-published-assets-in-your-own-application) section below.
87
-
88
- Publishing is meant to run each time before building your Compute application into a Wasm file.
89
- If the files in `--root-dir` have changed, then a new set of files will be published.
90
-
91
- ### Content Compression
92
-
93
- During publishing, this tool supports pre-compression of content. By default, your assets are compressed using the Brotli
94
- and gzip algorithms, and then stored alongside the original files in your Wasm binary (or [KV Store](#kv-store)).
95
-
96
- > [!IMPORTANT]
97
- > By default, pre-compressed content assets are not generated when the KV Store is not used.
98
- This is done to prevent the inclusion multiple of copies of each asset from making the Wasm binary too large.
99
- If you want to pre-compress assets when not using KV Store, add a value for 'contentCompression' to your
100
- `static-publish.rc.js` file.
101
-
102
- ## CLI options
103
-
104
- Except for `--root-dir`, most arguments are optional.
105
-
106
- ```shell
107
- npx @fastly/compute-js-static-publish \
108
- --root-dir=./build \
109
- --public-dir=./build/public \
110
- --static-dir=./build/public/static \
111
- --output=./compute-js \
112
- --spa=./build/spa.html
113
- ```
114
-
115
- If you provide options, they override the defaults described below.
116
-
117
- Any configuration options will be written to a `static-publish.rc.js` file, and used each time you build your Compute
118
- application.
119
-
120
- On subsequent builds of your Compute application, `compute-js-static-publish` will run with a special flag, `build-static`,
121
- reading from stored configuration, then scanning the `--public-dir` directory to recreate `./compute-js/static-publisher/statics.js`.
122
-
123
- Any relative file and directory paths passed at the command line are handled as relative to the current directory.
124
-
125
- ### Publishing options:
126
-
127
- | Option | Default | Description |
128
- |-----------------------------|------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
129
- | `--preset` | (None) | Apply default options from a specified preset. See ["Frameworks and Static Site Generators"](#usage-with-frameworks-and-static-site-generators). |
130
- | `--output` | `./compute-js` | The directory in which to create the Compute application. |
131
- | `--static-content-root-dir` | (output directory) + `/static-publisher` | The directory under the Compute application where static asset and metadata are written. |
132
- | `--root-dir` | (None) | **Required**. The root of the directory that contains the files to include in the publishing. All files you wish to include must reside under this root. |
133
-
134
- ### Server options:
135
-
136
- Used to populate the `server` key under `static-publish.rc.js`.
137
-
138
- | Option | Default | Description |
139
- |--------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
140
- | `--public-dir` | <root-dir> | The directory that contains your website's public files. |
141
- | `--static-dir` | (None) | Any directories under `--public-dir` that contain the website's static assets that will be served with a very long TTL. You can specify as many such directories as you wish, by listing multiple items. |
142
- | `--auto-ext` | `.html,.htm` | Specify automatic file extensions. |
143
- | `--auto-index` | `index.html,index.htm` | Specify filenames for automatically serving an index file. |
144
- | `--spa` | (None) | Path to a fallback file for SPA applications. |
145
- | `--not-found-page` | `<public-dir>/404.html` | Path to a fallback file for 404 Not Found. |
146
-
147
- See [PublisherServer](#publisherserver) for more information about these features.
148
-
149
- For backwards compatibility, if you do not specify a `--root-dir` but you have provided a `--public-dir`, then that value is used for `--root-dir`.
150
-
151
- Note that the files referenced by `--spa` and `--not-found-page` do not necessarily have to reside inside `--public-dir`.
152
-
153
- ### Fastly service options
154
-
155
- These arguments are used to populate the `fastly.toml` and `package.json` files of your Compute application.
156
-
157
- | Option | Default | Description |
158
- |-------------------|--------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
159
- | `--name` | `name` from `package.json`, or `compute-js-static-site` | The name of your Compute application. |
160
- | `--description` | `description` from `package.json`, or `Compute static site` | The description of your Compute application. |
161
- | `--author` | `author` from `package.json`, or `you@example.com` | The author of your Compute application. |
162
- | `--service-id` | (None) | The ID of an existing Fastly WASM service for your Compute application. |
163
- | `--kv-store-name` | (None) | The name of an existing [Fastly KV Store](https://developer.fastly.com/learning/concepts/data-stores/#kv-stores) to hold the content assets. In addition to already existing, it must be linked to the service specified by `--service-id`. |
164
-
165
- ## Usage with frameworks and static site generators
166
-
167
- `compute-js-static-publish` supports preset defaults for a number of frameworks and static site generators:
168
-
169
- | `--preset` | `--root-dir` | `--static-dir` | Notes |
170
- |-------------------------------|--------------|------------------|-------------------------------------------------------------------------------------------------------------------------------------|
171
- | `cra` (or `create-react-app`) | `./build` | `./build/static` | For apps written using [Create React App](https://create-react-app.dev). Checks for a dependency on `react-scripts`. |
172
- | `cra-eject` | `./build` | `./build/static` | For apps written using Create React App, but which have since been ejected via `npm run eject`. Does not check for `react-scripts`. |
173
- | `vite` | `./dist` | (None) | For apps written using [Vite](https://vitejs.dev). |
174
- | `sveltekit` | `./dist` | (None) | For apps written using [SvelteKit](https://kit.svelte.dev). |
175
- | `vue` | `./dist` | (None) | For apps written using [Vue](https://vuejs.org), and that were created using [create-vue](https://github.com/vuejs/create-vue). |
176
- | `next` | `./out` | (None) | For apps written using [Next.js](https://nextjs.org), using `npm run export`. *1 |
177
- | `astro` | `./dist` | (None) | For apps written using [Astro](https://astro.build) (static apps only). *2 |
178
- | `gatsby` | `./public` | (None) | For apps written using [Gatsby](https://www.gatsbyjs.com). |
179
- | `docusaurus` | `./build` | (None) | For apps written using [Docusaurus](https://docusaurus.io) |
180
-
181
- You may still override any of these options individually.
182
-
183
- *1 - For Next.js, consider using `@fastly/next-compute-js`, a Next.js server implementation that allows you to run
184
- your Next.js application on Compute.
185
-
186
- *2 - Astro support does not support SSR.
187
-
188
- ## PublisherServer
189
-
190
- `PublisherServer` is a simple yet powerful server that can be used out of the box to serve the files prepared by this tool.
191
-
192
- This server handles the following automatically:
193
-
194
- * Maps the path of your request to a path under `--public-dir` and serves the content of the asset
195
- * Sources the content from the content packaged in the Wasm binary, or from the [KV Store](#kv-store), if configured.
196
- * Applies long-lived cache headers to files served from `--static-dir` directories. Files under these directories will be cached by the browser for 1 year. (Use versioned or hashed filenames to avoid serving stale assets.)
197
- * Performs Brotli and gzip compression as requested by the `Accept-Encoding` headers.
198
- * Provides `Last-Modified` and `ETag` response headers, and uses them with `If-Modified-Since` and `If-None-Match` request headers to produce `304 Not Modified` responses.
199
- * If an exact match is not found for the request path, applies automatic extensions (e.g., `.html`) and automatic index files (e.g., `index.html`).
200
- * Can be configured to serve a fallback file for SPA apps. Useful for apps that use [client-side routing](https://create-react-app.dev/docs/deployment#serving-apps-with-client-side-routing).
201
- * Can be configured to serve a 404 not found file.
202
- * Returns `null` if nothing matches, so that you can add your own handling if necessary.
203
-
204
- During initial scaffolding, the configuration based on the command-line parameters and preset are written to your `./static-publisher.rc.js` file under the `server` key.
205
-
206
- ### Configuring PublisherServer
207
-
208
- You can further configure the server by making modifications to the `server` key under `./static-publisher.rc.js`.
209
-
210
- | Key | Default | Description |
211
- |--------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
212
- | `publicDirPrefix` | `''` | Prefix to apply to web requests. Effectively, a directory within `rootDir` that is used by the web server to determine the asset to respond with. |
213
- | `staticItems` | `[]` | A test to apply to item names to decide whether to serve them as "static" files, in other words, with a long TTL. These are used for files that are not expected to change. They can be provided as a string or array of strings. |
214
- | `compression` | `[ 'br', 'gzip' ]` | If the request contains an `Accept-Encoding` header, they are checked for the values listed here. The compression algorithm that produces the smallest transfer size is applied. |
215
- | `autoExt` | `[]` | When a file is not found, and it doesn't end in a slash, then try auto-ext: we try to serve a file with the same name post-fixed with the specified strings, tested in the order listed. These are tested before auto-index, if any. |
216
- | `autoIndex` | `[]` | When a file is not found, then try auto-index: we treat it as a directory, then try to serve a file that has the specified strings, tested in the order listed. |
217
- | `spaFile` | `null` | Asset key of a content item to serve with a status code of `200` when a GET request comes arrives for an unknown asset, and the Accept header includes text/html. |
218
- | `notFoundPageFile` | `null` | Asset key of a content item to serve with a status code of `404` when a GET request comes arrives for an unknown asset, and the Accept header includes text/html. |
219
-
220
- For `staticItems`:
221
- * Items that contain asterisks are interpreted as glob patterns (for example, `/public/static/**/*.js`)
222
- * Items that end with a trailing slash are interpreted as a directory name.
223
- * Items that don't contain asterisks and that do not end in slash are checked for exact match.
224
-
225
- For `compression`, the following values are allowed:
226
- * `'br'` - Brotli
227
- * `'gzip'` - Gzip
228
-
229
- ## Associating your project with a Fastly Service
230
-
231
- The project created by this tool is a Fastly Compute JavaScript application, complete with a `fastly.toml` file that
232
- describes your project to the Fastly CLI.
233
-
234
- To deploy your project to production, you deploy it to a [Fastly service](https://developer.fastly.com/reference/glossary#term-service)
235
- in your account. Usually, you create your service automatically as part of your first deployment of the project.
236
-
237
- In this case, `fastly.toml` has no value for `service_id` at the time you deploy, so the Fastly CLI will prompt
238
- you to create a Fastly service in your account, after which it will save the new service's ID to your `fastly.toml` file.
239
-
240
- Alternatively, you may deploy to a service that already exists. You can create this service using the
241
- [Fastly CLI](https://developer.fastly.com/reference/cli/service/create/) or the [Fastly web app](https://manage.fastly.com/).
242
- Note that since this is a Compute application, the service must be created as a Wasm service.
243
-
244
- Before deploying your application, specify the service by setting the `service_id` value in the `fastly.toml` file to the
245
- ID of the service. The Fastly CLI will deploy to the service identified by this value.
246
-
247
- To specify the service at the time you are scaffolding the project (for example, if you are running this tool and deploying
248
- as part of a CI process), specify the `--service-id` command line argument to populate `fastly.toml` with this value.
249
-
250
- ## Using the KV Store (BETA)
251
-
252
- <div id="kv-store"></div>
253
-
254
- Starting with v4, it's now possible to upload assets to and serve them from a [Fastly KV Store](https://developer.fastly.com/learning/concepts/data-stores/#kv-stores).
255
-
256
- When this mode is enabled, you build your application as normal, and as a step during the build, your files
257
- are uploaded to the Fastly KV Store, and metadata in the application is marked to source them from there instead
258
- of from bytes in the Wasm binary.
259
-
260
- You can enable the use of KV Store with `@fastly/compute-js-static-publish` as you scaffold your application, or
261
- at any later time.
262
-
263
- At the time you enable the use of KV Store:
264
-
265
- * Your Fastly service must already exist. See [Associating your project with a Fastly Service](#associating-your-project-with-a-fastly-service) above.
266
-
267
- * Your KV Store must already exist under the same Fastly account, and be linked to the service.
268
- As of this writing, to create the KV Store you will need to use either the Fastly CLI [fastly kv-store create](https://developer.fastly.com/reference/cli/kv-store/create/)
269
- or the Fastly [KV Store API](https://developer.fastly.com/reference/api/services/resources/kv-store/#create-store).
270
- Once the KV Store is created, you must link it to your Fastly service using the [Resource API](https://developer.fastly.com/reference/api/services/resource/#create-resource).
271
-
272
- ```shell
273
- # Create a KV Store
274
- $ curl -i -X POST "https://api.fastly.com/resources/stores/kv" -H "Fastly-Key: YOUR_FASTLY_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"name":"example-store"}'
275
-
276
- # Link the KV Store to a service
277
- $ curl -i -X POST "https://api.fastly.com/service/YOUR_FASTLY_SERVICE_ID/version/YOUR_FASTLY_SERVICE_VERSION/resource" -H "Fastly-Key: YOUR_FASTLY_TOKEN" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: application/json" -d "name=example-store-service-a&resource_id=YOUR_KV_STORE_ID"
278
- ```
279
-
280
- Once the KV Store is created and linked to your service, add its name to your `static-publish.rc.js`
281
- file under the `kvStoreName` key.
282
-
283
- To specify the KV Store at the time you are scaffolding the project (for example, if you are running this tool and
284
- deploying as part of a CI process), specify the `--service-id` and `--kv-store-name` command line arguments to populate
285
- the respective files with these values.
286
-
287
- After you have performed the above steps, go ahead and build your application as normal.
288
- As a new step during the build process, the tool will send these files to the KV Store.
289
-
290
- > [!IMPORTANT]
291
- > This step writes to your KV Store. When building your application, you must set the environment variable `FASTLY_API_TOKEN` to a Fastly API token that has access to write to this KV Store.
292
- >
293
- > Alternatively, if this environment variable is not found, the tool will attempt to detect an API token by calling `fastly profile token`.
294
-
295
- > [!TIP]
296
- > By running `npx @fastly/cli compute build --verbose` (or `npm run build` directly), you should see output in your logs saying that files are being sent to the KV Store.
297
-
298
- The `statics-metadata.js` file should now show `"type": "kv-store"` for content assets.
299
- Your Wasm binary should also be smaller, as the content of the files are no longer inlined in the build artifact.
300
- You can deploy this and run it from Fastly, and the referenced files will be served from KV Store.
301
-
302
- You will also see entries in `fastly.toml` that represent the local KV Store.
303
- These enable the site to also run correctly when served using the local development environment.
304
-
305
- ### Cleaning unused items from KV Store
306
-
307
- The files that are uploaded to the KV Store are submitted using keys of the following format:
308
-
309
- `<publish-id>:<asset-path>_<alg>_<hash>`
310
-
311
- For example:
312
- `12345abcde67890ABCDE00:/public/index.html_br_aeed29478691e67f6d5s36b4ded20c17e9eae437614617067a8751882368b965`
313
-
314
- Using such a key ensures that whenever the file contents are identical, the same key will be generated.
315
- This enables to detect whether an unchanged file already exists in the KV Store, avoiding having to re-submit
316
- files that have not changed. If the file contents have changed, then a new hash is generated. This ensures that
317
- even during the brief amount of time between deploys, any request served by a prior version will still serve the same
318
- corresponding previous version of the content.
319
-
320
- However, this system never deletes files automatically. After many deployments, extraneous files may be left over.
321
-
322
- `@fastly/compute-js-static-publish` includes a feature to delete these old versions of the files that are no longer being
323
- used. To run it, type the following command:
324
-
325
- `npx @fastly/compute-js-static-publish --clean-kv-store`
326
-
327
- It works by scanning `statics-metadata.js` for all currently-used keys. Then it enumerates all the existing
328
- keys in the configured KV Store and that belong to this application (can do so by narrowing down all keys to the ones
329
- that begin with the "publish id"). If any of the keys is not in the list of currently-used keys, then a request is made
330
- to delete that KV Store value.
331
-
332
- And that's it! It should be possible to run this task to clean up once in a while.
333
-
334
- ## Advanced Usages
335
-
336
- ### The `static-publish.rc.js` config file <a name="static-publish-rc"></a>
337
-
338
- * `rootDir` - All files under this root directory will be included by default in the publishing,
339
- except for those that are excluded using some of the following features. Files outside this root cannot be
340
- included in the publishing.
341
-
342
- * `staticContentRootDir` - Static asset loader and metadata files are created under this directory.
343
- For legacy compatibility, if not provided, defaults to `'./src'`.
344
-
345
- * `kvStoreName` - Set this value to the _name_ of an existing KV Store to enable uploading of content assets
346
- to Fastly KV Store. See [Using the KV Store](#kv-store) for more information.
347
-
348
- * `excludeDirs` - Specifies names of files and directories within `rootDir` to exclude from the publishing. Each entry can
349
- be a string or a JavaScript `RegExp` object. Every file and directory under `rootDir` is checked against each entry of
350
- the array by testing its path relative to `rootDir`. The file or directory (included all children) and excluded if the
351
- condition matches:
352
- * If a string is specified, then an exact match is checked.
353
- * If a `RegExp` is specified, then it is tested with the regular expression.
354
- * If this setting is not set, then the default value is `['./node_modules']`.
355
- * If you specifically set this to the empty array, then no files are excluded by this mechanism.
356
-
357
- * `excludeDotfiles` - Unless disabled, will exclude all files and directories (and their children)
358
- whose names begin with a `'.''`. This is `true` by default.
359
-
360
- * `includeWellKnown` - Unless disabled, will include a file or directory called `.well-known`
361
- even if `excludeDotfiles` would normally exclude it. This is `true` by default.
362
-
363
- * `contentAssetInclusionTest` - Optionally specify a test function that can be run against each enumerated asset during
364
- the publishing, to determine whether to include the asset as a content asset. For every file, this function is passed
365
- the [asset key](#asset-keys), as well as its content type (MIME type string). You may return one of three values from
366
- this function:
367
- * Boolean `true` - Include the file as a content asset in this publishing. Upload the file to and serve it from the
368
- KV Store if KV Store mode is enabled, or include the contents of the file in the Wasm binary if KV Store
369
- mode is not enabled.
370
- * String `"inline"` - Include the file as a content asset in this publishing. Include the contents of the file in the
371
- Wasm binary, regardless of whether KV Store mode is enabled.
372
- * Boolean `false` - Do not include this file as a content asset in this publishing.
373
-
374
- If you do not provide a function, then every file will be included in this publishing as a content asset, and their
375
- contents will be uploaded to and served from the KV Store if KV Store mode is enabled, or included in the Wasm
376
- binary if KV Store mode is not enabled.
377
-
378
- * `contentCompression` - During the publishing, the tool will pre-generate compressed versions of content assets in these
379
- formats and make them available to the Publisher Server or your application. Default value is [ 'br' | 'gzip' ] if
380
- KV Store is enabled, or [] if KV Store is not enabled.
381
-
382
- * `moduleAssetInclusionTest` - Optionally specify a test function that can be run against each enumerated asset during
383
- the publishing, to determine whether to include the asset as a module asset. For every file, this function is passed
384
- the [asset key](#asset-keys), as well as its content type (MIME type string). You may return one of three values from this function:
385
- * `true` (boolean) - Include the file as a module asset in this publishing.
386
- * `"static-import"` (string) - Include the file as a module asset in this publishing, and statically import it. This causes
387
- any top-level code in these modules to run at application initialization time.
388
- * `false` (boolean) - Do not include this file as a module asset in this publishing.
389
-
390
- If you do not provide a function, then no module assets will be included in this publishing.
391
-
392
- * `contentTypes` - Provide custom content types and/or override them.
393
-
394
- This tool comes with a [default set of content types](./src/util/content-types.ts) defined for many common
395
- file extensions. This list can be used to add to and/or override items in the default list.
396
- Content type definitions are checked in the provided order, and if none of them match, the default content types are
397
- tested afterward.
398
-
399
- Provide these as an array of content type definition objects, each with the following keys and values:
400
- * `test` - a RegExp or function to perform on the asset key. If the test succeeds, then the content asset is considered
401
- to be of this content type definition.
402
- * `contentType` - The content type header to apply when serving an asset of this content type definition.
403
- * `text` - If `true`, this content type definition is considered to contain textual data. This makes `.text()` and `.json()`
404
- available for calling on store entries. If not specified, this is treated as `false`.
405
-
406
- For example, to add a custom content type `application/x-custom` for files that have a `.custom` extension, and not treat
407
- it as a text file, add the following to your `static-publish.rc.js` file:
408
-
409
- ```javascript
410
- const config = {
411
- /* ... other config ... */
412
- contentTypes: [
413
- { test: /\.custom$/, contentType: 'application/x-custom', text: false },
414
- ],
415
- };
416
- ```
417
-
418
- > Note that content types are tested at publishing time, not at runtime.
419
-
420
- * `server` - [Configuration of `PublisherServer()`](#configuring-publisherserver).
421
- above.
422
-
423
- ### Running custom code alongside Publisher Server
424
-
425
- The generated `./src/index.js` program instantiates the server and simply asks it to respond to a request.
426
-
427
- You are free to add code to this file.
428
-
429
- For example, if the `PublisherServer` is unable to formulate a response to the request, then it returns `null`. You may
430
- add your own code to handle these cases, such as to provide custom responses.
431
-
432
- ```js
433
- import { getServer } from './statics.js';
434
- const staticContentServer = getServer();
435
-
436
- addEventListener("fetch", (event) => event.respondWith(handleRequest(event)));
437
- async function handleRequest(event) {
438
-
439
- const response = await staticContentServer.serveRequest(event.request);
440
- if (response != null) {
441
- return response;
442
- }
443
-
444
- // Do custom things here!
445
- // Handle API requests, serve non-static responses, etc.
446
-
447
- return new Response('Not found', { status: 404 });
448
- }
449
- ```
450
-
451
- ### Using published assets in your own application
452
-
453
- Publishing, as described earlier, is the process of preparing files for inclusion into your application.
454
- This process also makes metadata available about each of the files that are included, such as its content type, the last
455
- modified date, the file hash, and so on.
456
-
457
- The [`PublisherServer` class](#publisherserver) used by the default scaffolded application is a simple application of this content
458
- and metadata. By importing `./statics.js` into your Compute application, you can just as easily access this
459
- information about the assets that were included during publishing.
460
-
461
- > IMPORTANT: Use a static `import` statement, rather than using `await import()` to load `./statics.js`, in order to
462
- ensure that its top-level code runs during the initialization phase of your Compute application.
463
-
464
- #### Assets
465
-
466
- There are two categories of assets: Content Assets and Module Assets.
467
-
468
- * A Content Asset is a type of asset where your application or a user of your application is interested in the text or
469
- binary contents of an asset.
470
-
471
- The data of each content asset can exist in one of two stores:
472
- * Inline Store - this is a data store that exists within the Wasm binary.
473
- * Fastly KV Store - Fastly's distributed edge data store. Data can be placed here without impacting the size of
474
- your Wasm binary.
475
-
476
- Your application can stream the contents of these assets to a visitor, or read from the stream itself and access its
477
- contents.
478
-
479
- * A Module Asset is a type of asset where your application wants to load the asset as a module, and use it as part of its
480
- running code. Their contents are actually built at publishing time and their built representation is included in the Wasm
481
- binary. They can be imported statically at will, and your application is able to execute the code exported by these modules.
482
-
483
- ##### Asset Keys
484
-
485
- When working with content assets or module assets from your application, they are referenced by their asset key, which
486
- is the relative path of the file from `rootDir`, including the leading slash.
487
-
488
- #### Content Assets
489
-
490
- You can obtain the content assets included in publishing by importing the `contentAssets` object exported from
491
- `./statics.js`.
492
-
493
- ```js
494
- import { contentAssets } from './statics';
495
-
496
- // Obtain a content asset named '/public/index.html'
497
- const asset = contentAssets.getAsset('/public/index.html');
498
-
499
- // 'wasm-inline' if object's data is 'inlined' into Wasm binary
500
- // 'kv-store' if object's data exists in Fastly KV Store
501
- asset.type;
502
-
503
- // Get the "store entry"
504
- const storeEntry = await asset.getStoreEntry();
505
-
506
- storeEntry.contentEncoding; // null, 'br', 'gzip'
507
- storeEntry.hash; // SHA256 of the contents of the file
508
- storeEntry.size; // Size of file in bytes
509
- ```
510
-
511
- Regardless of which store these objects come from, they implement the `Body` interface as defined by `@fastly/js-compute`.
512
- As such, you are able to work with them in the same way to obtain their contents:
513
-
514
- ```js
515
- storeEntry.body; // ReadableStream<Uint8Array>
516
- storeEntry.bodyUsed; // true if consumed or distrubed
517
-
518
- // Get the data as ArrayBuffer, parsed JSON, or string
519
- // The latter two are only available if the data is a text type
520
- const arrayBuffer = await storeEntry.arrayBuffer();
521
- const json = await storeEntry.json();
522
- const text = await storeEntry.text();
523
- ```
524
-
525
- Or, if you don't care about the contents but just want to stream it to the visitor, you can pass the `.body` field directly
526
- to the Response constructor:
527
-
528
- ```js
529
- const response = new Response(storeEntry.body, { status: 200 });
530
- ```
531
-
532
- > IMPORTANT: Once a store entry is consumed, its body cannot be read from again. If you need to access the contents of the
533
- same asset more than once, you may obtain another store entry, as in the following example:
534
- ```js
535
- import { contentAssets } from './statics';
536
- const asset = contentAssets.getAsset('/public/index.html');
537
- const entry1 = await asset.getStoreEntry(); // Get a new store entry
538
- const json1a = await entry1.json();
539
- const json1b = await entry1.json(); // Can't do this, the body has already been consumed!
540
-
541
- const entry2 = await asset.getStoreEntry(); // Get a new store entry for same asset
542
- const json2a = await entry2.json(); // This will work.
543
- ```
544
-
545
- #### Module Assets
546
-
547
- Module assets are useful when an asset includes executable JavaScript code that you may want to execute at runtime.
548
-
549
- You can obtain the module assets included in publishing by importing the `moduleAssets` object exported from
550
- `./statics.js`. Keep in mind that by default, no modules are included in `moduleAssets`. If you wish to include module
551
- assets, you must configure your publishing to include them. See [`moduleAssetInclusionTest` in the `static-publish.rc.js`
552
- config file](#static-publish-rc) for more details.
553
-
554
- `/module/hello.js`
555
- ```js
556
- export function hello() {
557
- console.log('Hello, World!');
558
- }
559
- ```
560
-
561
- ```js
562
- import { moduleAssets } from './statics';
563
-
564
- // Obtain a module asset named '/module/hello.js'
565
- const asset = contentAssets.getAsset('/module/hello.js');
566
-
567
- // Load the module
568
- const helloModule = await asset.getModule();
569
-
570
- helloModule.hello(); // Will print "Hello, World!"
571
- ```
572
-
573
- #### Metadata
574
-
575
- In some use cases, you may have a use case where you need to know about the files that were included during publishing,
576
- but not in the context of Compute. (e.g., a tool that runs in Node.js that performs some maintenance task on assets).
577
-
578
- You cannot import `./statics.js` from a Node.js application, as it holds dependencies on Compute.
579
-
580
- Instead, you can import `./statics-metadata.js`, a companion file that is generated in the same directory. This file
581
- exposes plain JavaScript objects that contain the metadata about your content assets that were included in the final
582
- publishing event.
583
-
584
- See the definition of `ContentAssetMetadataMapEntry` in the [`types/content-assets` file](./src/types/content-assets.ts) for more details.
585
-
586
- ### Using webpack
587
-
588
- As of v4, webpack is no longer required, and is no longer part of the default scaffolded application.
589
- If you wish to use some features of webpack, you may include webpack in your generated application by specifying
590
- `--webpack` at the command line.
591
-
592
- ## Migrating
593
-
594
- See [MIGRATING.md](./MIGRATING.md).
595
-
596
- ## Issues
597
-
598
- If you encounter any non-security-related bug or unexpected behavior, please [file an issue][bug].
599
-
600
- [bug]: https://github.com/fastly/compute-js-static-publish/issues/new?labels=bug
601
-
602
- ### Security issues
603
-
604
- Please see our [SECURITY.md](./SECURITY.md) for guidance on reporting security-related issues.
45
+ - Named collections for previews, staging, production
46
+ - SPA + fallback handling
47
+ - Precompressed Brotli/gzip support
48
+ - CLI tools for publish, promote, and cleanup
605
49
 
606
- ## License
50
+ ## Documentation
607
51
 
608
- [MIT](./LICENSE).
52
+ 📘 Full documentation available on GitHub:
53
+ [https://github.com/fastly/compute-js-static-publish](https://github.com/fastly/compute-js-static-publish)