@fastly/compute-js-static-publish 6.3.0 → 7.0.0-beta.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 (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 +299 -266
  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 +418 -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
@@ -1,257 +0,0 @@
1
- import { checkIfModifiedSince, getIfModifiedSinceHeader } from "./serve-preconditions/if-modified-since.js";
2
- import { checkIfNoneMatch, getIfNoneMatchHeader } from "./serve-preconditions/if-none-match.js";
3
- import { buildHeadersSubset } from "./util/http.js";
4
- // https://httpwg.org/specs/rfc9110.html#rfc.section.15.4.5
5
- // The server generating a 304 response MUST generate any of the following header fields that would have been sent in
6
- // a 200 (OK) response to the same request:
7
- // * Content-Location, Date, ETag, and Vary
8
- // * Cache-Control and Expires
9
- const headersToPreserveForUnmodified = ['Content-Location', 'ETag', 'Vary', 'Cache-Control', 'Expires'];
10
- function requestAcceptsTextHtml(req) {
11
- const accept = (req.headers.get('Accept') ?? '')
12
- .split(',')
13
- .map(x => x.split(';')[0]);
14
- if (!accept.includes('text/html') && !accept.includes('*/*') && accept.includes('*')) {
15
- return false;
16
- }
17
- return true;
18
- }
19
- export class PublisherServer {
20
- constructor(serverConfig, contentAssets) {
21
- this.serverConfig = serverConfig;
22
- this.contentAssets = contentAssets;
23
- this.staticItems = serverConfig.staticItems
24
- .map((x, i) => {
25
- if (x.startsWith('re:')) {
26
- const fragments = x.slice(3).match(/\/(.*?)\/([a-z]*)?$/i);
27
- if (fragments == null) {
28
- console.warn(`Cannot parse staticItems item index ${i}: '${x}', skipping...`);
29
- return '';
30
- }
31
- return new RegExp(fragments[1], fragments[2] || '');
32
- }
33
- return x;
34
- })
35
- .filter(x => Boolean(x));
36
- }
37
- getMatchingAsset(path) {
38
- const assetKey = this.serverConfig.publicDirPrefix + path;
39
- if (!assetKey.endsWith('/')) {
40
- // A path that does not end in a slash can match an asset directly
41
- const asset = this.contentAssets.getAsset(assetKey);
42
- if (asset != null) {
43
- return asset;
44
- }
45
- // ... or, we can try auto-ext:
46
- // looks for an asset that has the specified suffix (usually extension, such as .html)
47
- for (const extEntry of this.serverConfig.autoExt) {
48
- let assetKeyWithExt = assetKey + extEntry;
49
- const asset = this.contentAssets.getAsset(assetKeyWithExt);
50
- if (asset != null) {
51
- return asset;
52
- }
53
- }
54
- }
55
- if (this.serverConfig.autoIndex.length > 0) {
56
- // try auto-index:
57
- // treats the path as a directory, and looks for an asset with the specified
58
- // suffix (usually an index file, such as index.html)
59
- let assetNameAsDir = assetKey;
60
- // remove all slashes from end, and add one trailing slash
61
- while (assetNameAsDir.endsWith('/')) {
62
- assetNameAsDir = assetNameAsDir.slice(0, -1);
63
- }
64
- assetNameAsDir = assetNameAsDir + '/';
65
- for (const indexEntry of this.serverConfig.autoIndex) {
66
- let assetKeyIndex = assetNameAsDir + indexEntry;
67
- const asset = this.contentAssets.getAsset(assetKeyIndex);
68
- if (asset != null) {
69
- return asset;
70
- }
71
- }
72
- }
73
- return null;
74
- }
75
- findAcceptEncodings(request) {
76
- if (this.serverConfig.compression.length === 0) {
77
- return [];
78
- }
79
- const found = (request.headers.get('accept-encoding') ?? '')
80
- .split(',')
81
- .map(x => {
82
- let [encodingValue, qValueStr] = x.trim().split(';');
83
- let qValue; // q value multiplied by 1000
84
- if (qValueStr == null || !qValueStr.startsWith('q=')) {
85
- // use default of 1.0
86
- qValue = 1000;
87
- }
88
- else {
89
- qValueStr = qValueStr.slice(2); // remove the q=
90
- qValue = parseFloat(qValueStr);
91
- if (Number.isNaN(qValue) || qValue > 1) {
92
- qValue = 1;
93
- }
94
- if (qValue < 0) {
95
- qValue = 0;
96
- }
97
- // q values can have up to 3 decimal digits
98
- qValue = Math.floor(qValue * 1000);
99
- }
100
- return [encodingValue.trim(), qValue];
101
- })
102
- .filter(([encoding]) => this.serverConfig.compression.includes(encoding));
103
- const priorityMap = new Map;
104
- for (const [encoding, qValue] of found) {
105
- let typesForQValue = priorityMap.get(qValue);
106
- if (typesForQValue == null) {
107
- typesForQValue = [];
108
- priorityMap.set(qValue, typesForQValue);
109
- }
110
- typesForQValue.push(encoding);
111
- }
112
- // Sort keys, larger numbers to come first
113
- const keysSorted = [...priorityMap.keys()]
114
- .sort((qValueA, qValueB) => qValueB - qValueA);
115
- return keysSorted
116
- .map(qValue => priorityMap.get(qValue));
117
- }
118
- testExtendedCache(pathname) {
119
- return this.staticItems
120
- .some(x => {
121
- if (x instanceof RegExp) {
122
- return x.test(pathname);
123
- }
124
- if (x.endsWith('/')) {
125
- return pathname.startsWith(x);
126
- }
127
- return x === pathname;
128
- });
129
- }
130
- handlePreconditions(request, asset, responseHeaders) {
131
- // Handle preconditions according to https://httpwg.org/specs/rfc9110.html#rfc.section.13.2.2
132
- // A recipient cache or origin server MUST evaluate the request preconditions defined by this specification in the following order:
133
- // 1. When recipient is the origin server and If-Match is present, evaluate the If-Match precondition:
134
- // - if true, continue to step 3
135
- // - if false, respond 412 (Precondition Failed) unless it can be determined that the state-changing request has already succeeded (see Section 13.1.1)
136
- // 2. When recipient is the origin server, If-Match is not present, and If-Unmodified-Since is present, evaluate the If-Unmodified-Since precondition:
137
- // - if true, continue to step 3
138
- // - if false, respond 412 (Precondition Failed) unless it can be determined that the state-changing request has already succeeded (see Section 13.1.4)
139
- // 3. When If-None-Match is present, evaluate the If-None-Match precondition:
140
- // - if true, continue to step 5
141
- // - if false for GET/HEAD, respond 304 (Not Modified)
142
- // - if false for other methods, respond 412 (Precondition Failed)
143
- let skipIfNoneMatch = false;
144
- {
145
- const headerValue = getIfNoneMatchHeader(request);
146
- if (headerValue.length > 0) {
147
- const result = checkIfNoneMatch(responseHeaders['ETag'], headerValue);
148
- if (result) {
149
- skipIfNoneMatch = true;
150
- }
151
- else {
152
- return new Response(null, {
153
- status: 304,
154
- headers: buildHeadersSubset(responseHeaders, headersToPreserveForUnmodified),
155
- });
156
- }
157
- }
158
- }
159
- // 4. When the method is GET or HEAD, If-None-Match is not present, and If-Modified-Since is present, evaluate the
160
- // If-Modified-Since precondition:
161
- // - if true, continue to step 5
162
- // - if false, respond 304 (Not Modified)
163
- if (!skipIfNoneMatch) {
164
- // For us, method is always GET or HEAD here.
165
- const headerValue = getIfModifiedSinceHeader(request);
166
- if (headerValue != null) {
167
- const result = checkIfModifiedSince(asset, headerValue);
168
- if (!result) {
169
- return new Response(null, {
170
- status: 304,
171
- headers: buildHeadersSubset(responseHeaders, headersToPreserveForUnmodified),
172
- });
173
- }
174
- }
175
- }
176
- // 5. When the method is GET and both Range and If-Range are present, evaluate the If-Range precondition:
177
- // - if true and the Range is applicable to the selected representation, respond 206 (Partial Content)
178
- // - otherwise, ignore the Range header field and respond 200 (OK)
179
- // 6. Otherwise,
180
- // - perform the requested method and respond according to its success or failure.
181
- return null;
182
- }
183
- async serveAsset(request, asset, init) {
184
- const metadata = asset.getMetadata();
185
- const headers = {
186
- 'Content-Type': metadata.contentType,
187
- };
188
- Object.assign(headers, init?.headers);
189
- if (init?.cache != null) {
190
- let cacheControlValue;
191
- switch (init.cache) {
192
- case 'extended':
193
- cacheControlValue = 'max-age=31536000';
194
- break;
195
- case 'never':
196
- cacheControlValue = 'no-store';
197
- break;
198
- }
199
- headers['Cache-Control'] = cacheControlValue;
200
- }
201
- const acceptEncodings = this.findAcceptEncodings(request);
202
- const storeEntry = await asset.getStoreEntry(acceptEncodings);
203
- if (storeEntry.contentEncoding != null) {
204
- headers['Content-Encoding'] = storeEntry.contentEncoding;
205
- }
206
- headers['ETag'] = `"${storeEntry.hash}"`;
207
- if (metadata.lastModifiedTime !== 0) {
208
- headers['Last-Modified'] = (new Date(metadata.lastModifiedTime * 1000)).toUTCString();
209
- }
210
- const preconditionResponse = this.handlePreconditions(request, asset, headers);
211
- if (preconditionResponse != null) {
212
- return preconditionResponse;
213
- }
214
- return new Response(storeEntry.body, {
215
- status: init?.status ?? 200,
216
- headers,
217
- });
218
- }
219
- async serveRequest(request) {
220
- // Only handle GET and HEAD
221
- if (request.method !== 'GET' && request.method !== 'HEAD') {
222
- return null;
223
- }
224
- const url = new URL(request.url);
225
- const pathname = url.pathname;
226
- const asset = this.getMatchingAsset(pathname);
227
- if (asset != null) {
228
- return this.serveAsset(request, asset, {
229
- cache: this.testExtendedCache(pathname) ? 'extended' : null,
230
- });
231
- }
232
- // fallback HTML responses, like SPA and "not found" pages
233
- if (requestAcceptsTextHtml(request)) {
234
- // These are raw asset paths, not relative to public path
235
- const { spaFile } = this.serverConfig;
236
- if (spaFile != null) {
237
- const asset = this.contentAssets.getAsset(spaFile);
238
- if (asset != null) {
239
- return this.serveAsset(request, asset, {
240
- cache: 'never',
241
- });
242
- }
243
- }
244
- const { notFoundPageFile } = this.serverConfig;
245
- if (notFoundPageFile != null) {
246
- const asset = this.contentAssets.getAsset(notFoundPageFile);
247
- if (asset != null) {
248
- return this.serveAsset(request, asset, {
249
- status: 404,
250
- cache: 'never',
251
- });
252
- }
253
- }
254
- }
255
- return null;
256
- }
257
- }
@@ -1,4 +0,0 @@
1
- import { ContentAsset } from "../../types/index.js";
2
- export declare function getIfModifiedSinceHeader(request: Request): number | null;
3
- export declare function checkIfModifiedSince(asset: ContentAsset, ifModifiedSince: number): boolean;
4
- //# sourceMappingURL=if-modified-since.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"if-modified-since.d.ts","sourceRoot":"","sources":["../../../src/server/serve-preconditions/if-modified-since.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgBxE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAW1F"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"if-none-match.d.ts","sourceRoot":"","sources":["../../../src/server/serve-preconditions/if-none-match.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,CAO/D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAmB7E"}
@@ -1,2 +0,0 @@
1
- export declare function buildHeadersSubset(responseHeaders: Record<string, string>, keys: Readonly<string[]>): Record<string, string>;
2
- //# sourceMappingURL=http.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../src/server/util/http.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,0BAQnG"}
@@ -1,9 +0,0 @@
1
- export function buildHeadersSubset(responseHeaders, keys) {
2
- const resultHeaders = {};
3
- for (const value of keys) {
4
- if (value in responseHeaders) {
5
- resultHeaders[value] = responseHeaders[value];
6
- }
7
- }
8
- return resultHeaders;
9
- }
@@ -1,11 +0,0 @@
1
- export interface StoreEntry {
2
- readonly body: ReadableStream<Uint8Array> | null;
3
- readonly bodyUsed: boolean;
4
- arrayBuffer(): Promise<ArrayBuffer>;
5
- json(): Promise<any>;
6
- text(): Promise<string>;
7
- readonly contentEncoding: string | null;
8
- readonly hash: string;
9
- readonly size: number;
10
- }
11
- //# sourceMappingURL=compute.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../src/types/compute.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IAGpC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IACrB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
1
- import type { ContentAssetInclusionTest, ExcludeDirTest, ModuleAssetInclusionTest } from "./config.js";
2
- import type { ContentTypeDef } from "./content-types.js";
3
- import type { ContentCompressionTypes } from "../constants/compression.js";
4
- export type ContentAssetInclusionResultNormalized = {
5
- includeContent: boolean;
6
- inline: boolean;
7
- };
8
- export type ModuleAssetInclusionResultNormalized = {
9
- includeModule: boolean;
10
- useStaticImport: boolean;
11
- };
12
- export type StaticPublisherConfigNormalized = {
13
- rootDir: string;
14
- staticContentRootDir: string;
15
- kvStoreName: string | null;
16
- excludeDirs: ExcludeDirTest[];
17
- excludeDotFiles: boolean;
18
- includeWellKnown: boolean;
19
- contentAssetInclusionTest: ContentAssetInclusionTest | null;
20
- contentCompression: ContentCompressionTypes[];
21
- moduleAssetInclusionTest: ModuleAssetInclusionTest | null;
22
- contentTypes: ContentTypeDef[];
23
- server: PublisherServerConfigNormalized | null;
24
- };
25
- export type PublisherServerConfigNormalized = {
26
- publicDirPrefix: string;
27
- staticItems: string[];
28
- compression: ContentCompressionTypes[];
29
- spaFile: string | null;
30
- notFoundPageFile: string | null;
31
- autoExt: string[];
32
- autoIndex: string[];
33
- };
34
- //# sourceMappingURL=config-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E,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;CAErB,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,37 +0,0 @@
1
- import type { ContentTypeDef } from "./content-types.js";
2
- export interface ExcludeDirTest {
3
- test(name: string): boolean;
4
- }
5
- export type ContentAssetInclusionResult = {
6
- includeContent?: boolean;
7
- inline?: boolean;
8
- };
9
- export type ContentAssetInclusionTest = (assetKey: string, contentType?: string) => ContentAssetInclusionResult | true | 'inline' | false | null;
10
- export type ModuleAssetInclusionResult = {
11
- includeModule?: boolean;
12
- useStaticImport?: boolean;
13
- };
14
- export type ModuleAssetInclusionTest = (assetKey: string, contentType?: string) => ModuleAssetInclusionResult | true | false | 'static-import' | null;
15
- export type StaticPublisherConfig = {
16
- rootDir: string;
17
- staticContentRootDir: string;
18
- kvStoreName?: string | false | null;
19
- excludeDirs?: (string | ExcludeDirTest)[] | string | ExcludeDirTest | null;
20
- excludeDotFiles?: boolean;
21
- includeWellKnown?: boolean;
22
- contentAssetInclusionTest?: ContentAssetInclusionTest | null;
23
- contentCompression?: ('br' | 'gzip')[];
24
- moduleAssetInclusionTest?: ModuleAssetInclusionTest | null;
25
- contentTypes?: ContentTypeDef[];
26
- server?: PublisherServerConfig | null;
27
- };
28
- export type PublisherServerConfig = {
29
- publicDirPrefix?: string;
30
- staticItems?: string[] | string | false | null;
31
- compression?: ('br' | 'gzip')[];
32
- spaFile?: string | false | null;
33
- notFoundPageFile?: string | false | null;
34
- autoExt?: string[] | string | false | null;
35
- autoIndex?: string[] | string | false | null;
36
- };
37
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;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,CAAC,EAAE,MAAM,CAAC;IAQzB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAK/C,WAAW,CAAC,EAAE,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC;IAIhC,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIhC,gBAAgB,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAIzC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;IAI3C,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;CAI9C,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,55 +0,0 @@
1
- import type { ContentCompressionTypes } from "../constants/compression.js";
2
- import type { StoreEntry } from "../types/compute.js";
3
- export type CompressedFileInfos<TData> = Partial<Record<ContentCompressionTypes, TData>>;
4
- export type ContentFileInfo = {
5
- hash: string;
6
- size: number;
7
- };
8
- export type ContentFileInfoForBytes = ContentFileInfo & {
9
- bytes: Uint8Array;
10
- };
11
- export type ContentFileInfoForString = ContentFileInfo & {
12
- content: string;
13
- };
14
- export type ContentFileInfoForStaticPublishing = ContentFileInfo & {
15
- staticFilePath: string;
16
- };
17
- export type ContentFileInfoForWasmInline = ContentFileInfoForStaticPublishing;
18
- export type ContentFileInfoForKVStore = ContentFileInfoForStaticPublishing & {
19
- kvStoreKey: string;
20
- };
21
- export type ContentAssetMetadataMapEntryBase<TFileInfo> = {
22
- assetKey: string;
23
- contentType: string;
24
- text: boolean;
25
- lastModifiedTime: number;
26
- fileInfo: TFileInfo;
27
- compressedFileInfos: CompressedFileInfos<TFileInfo>;
28
- };
29
- export type ContentAssetMetadataMapEntryBytes = {
30
- type: 'bytes';
31
- } & ContentAssetMetadataMapEntryBase<ContentFileInfoForBytes>;
32
- export type ContentAssetMetadataMapEntryString = {
33
- type: 'string';
34
- } & ContentAssetMetadataMapEntryBase<ContentFileInfoForString>;
35
- export type ContentAssetMetadataMapEntryWasmInline = {
36
- type: 'wasm-inline';
37
- } & ContentAssetMetadataMapEntryBase<ContentFileInfoForWasmInline>;
38
- export type ContentAssetMetadataMapEntryKVStore = {
39
- type: 'kv-store';
40
- } & ContentAssetMetadataMapEntryBase<ContentFileInfoForKVStore>;
41
- export type ContentAssetMetadataMapEntry = ContentAssetMetadataMapEntryBytes | ContentAssetMetadataMapEntryString | ContentAssetMetadataMapEntryWasmInline | ContentAssetMetadataMapEntryKVStore;
42
- export type ContentAssetMetadataMap = {
43
- [assetKey: string]: ContentAssetMetadataMapEntry;
44
- };
45
- export interface ContentAsset {
46
- readonly type: string;
47
- readonly isLocal: boolean;
48
- readonly assetKey: string;
49
- getMetadata(): ContentAssetMetadataMapEntry;
50
- getStoreEntry(acceptEncodingsGroups?: ContentCompressionTypes[][]): Promise<StoreEntry>;
51
- getBytes(): Uint8Array;
52
- getText(): string;
53
- getJson<T = unknown>(): T;
54
- }
55
- //# sourceMappingURL=content-assets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-assets.d.ts","sourceRoot":"","sources":["../../src/types/content-assets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,MAAM,mBAAmB,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAC;AAEzF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD,KAAK,EAAE,UAAU,CAAC;CACnB,CAAC;AACF,MAAM,MAAM,wBAAwB,GAAG,eA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M,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,WAAW,IAAI,4BAA4B,CAAC;IAC5C,aAAa,CAAC,qBAAqB,CAAC,EAAE,uBAAuB,EAAE,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACxF,QAAQ,IAAI,UAAU,CAAC;IACvB,OAAO,IAAI,MAAM,CAAC;IAClB,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC;CAC3B"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- export type ContentTypeTest = (name: string) => boolean;
2
- export type ContentTypeDef = {
3
- test: RegExp | ContentTypeTest;
4
- contentType: string;
5
- text?: boolean;
6
- };
7
- export type ContentTypeTestResult = {
8
- contentType: string;
9
- text: boolean;
10
- };
11
- //# sourceMappingURL=content-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-types.d.ts","sourceRoot":"","sources":["../../src/types/content-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAGxD,MAAM,MAAM,cAAc,GAAG;IAE3B,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IAG/B,WAAW,EAAE,MAAM,CAAC;IAIpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export type { StoreEntry, } from './compute.js';
2
- export type { StaticPublisherConfig, ContentAssetInclusionTest, ContentAssetInclusionResult, ModuleAssetInclusionTest, ModuleAssetInclusionResult, } from './config.js';
3
- export type { ContentAssetMetadataMap, ContentAssetMetadataMapEntry, ContentAsset, } from './content-assets.js';
4
- export type { ModuleAssetMap, ModuleAssetMapEntry, ModuleAsset, } from './module-assets.js';
5
- export type { ContentTypeTest, ContentTypeDef, ContentTypeTestResult, } from './content-types.js';
6
- export type { PublisherServerConfigNormalized, } from './config-normalized.js';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,uBAAuB,EACvB,4BAA4B,EAC5B,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,cAAc,EACd,mBAAmB,EACnB,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,cAAc,EACd,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,+BAA+B,GAChC,MAAM,wBAAwB,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- export type ModuleAssetMapEntry = {
2
- isStaticImport: boolean;
3
- module: any | null;
4
- loadModule: () => Promise<any>;
5
- };
6
- export type ModuleAssetMap = {
7
- [assetKey: string]: ModuleAssetMapEntry;
8
- };
9
- export interface ModuleAsset {
10
- readonly assetKey: string;
11
- getModule(): Promise<any>;
12
- getStaticModule(): any | null;
13
- readonly isStaticImport: boolean;
14
- }
15
- //# sourceMappingURL=module-assets.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"module-assets.d.ts","sourceRoot":"","sources":["../../src/types/module-assets.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IACnB,UAAU,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC;CAChC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,eAAe,IAAI,GAAG,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- export type Merge<T, U> = {
2
- [TKey in keyof T]: TKey extends keyof U ? (T[TKey] | U[TKey]) : T[TKey];
3
- };
4
- export type Unmerge<T, U> = Required<{
5
- [TKey in keyof T]: TKey extends keyof U ? (Exclude<T[TKey], U[TKey]>) : T[TKey];
6
- }>;
7
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/types/util.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI;KACvB,IAAI,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;CACxE,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC;KAClC,IAAI,IAAI,MAAM,CAAC,GAAG,IAAI,SAAS,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;CAChF,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"content-types.d.ts","sourceRoot":"","sources":["../../src/util/content-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,qBAAqB,EACtB,MAAM,2BAA2B,CAAC;AAqCnC,wBAAgB,sBAAsB,qBAErC;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,cAAc,EAAE,oBAmD/D;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,cAAc,EAAE,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAcrI"}
@@ -1,3 +0,0 @@
1
- export * from './content-types.js';
2
- export * from './metadata.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './content-types.js';
2
- export * from './metadata.js';
@@ -1,3 +0,0 @@
1
- import type { ContentAssetMetadataMap } from "../types/content-assets.js";
2
- export declare function getKVStoreKeysFromMetadata(contentAssetMetadataMap: ContentAssetMetadataMap): Set<string>;
3
- //# sourceMappingURL=metadata.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../src/util/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,wBAAgB,0BAA0B,CAAC,uBAAuB,EAAE,uBAAuB,GAAG,GAAG,CAAC,MAAM,CAAC,CAexG"}
@@ -1,12 +0,0 @@
1
- export function getKVStoreKeysFromMetadata(contentAssetMetadataMap) {
2
- const results = new Set();
3
- for (const metadata of Object.values(contentAssetMetadataMap)) {
4
- if (metadata.type === 'kv-store') {
5
- results.add(metadata.fileInfo.kvStoreKey);
6
- for (const fileInfo of Object.values(metadata.compressedFileInfos)) {
7
- results.add(fileInfo.kvStoreKey);
8
- }
9
- }
10
- }
11
- return results;
12
- }
@@ -1,3 +0,0 @@
1
- ## Resources
2
-
3
- The files in this directory are copied into the output folder.
@@ -1,10 +0,0 @@
1
- /*
2
- * Generated by @fastly/compute-js-static-publish.
3
- */
4
-
5
- import type {
6
- ContentAssetMetadataMap,
7
- } from "@fastly/compute-js-static-publish";
8
-
9
- export declare const kvStoreName: string | null;
10
- export declare const contentAssetMetadataMap: ContentAssetMetadataMap;
@@ -1,19 +0,0 @@
1
- /*
2
- * Generated by @fastly/compute-js-static-publish.
3
- */
4
-
5
- import type {
6
- ModuleAssetMap,
7
- PublisherServerConfigNormalized,
8
- ContentAssets,
9
- ModuleAssets,
10
- PublisherServer,
11
- } from '@fastly/compute-js-static-publish';
12
-
13
- export declare const moduleAssetMap: ModuleAssetMap;
14
-
15
- export declare const serverConfig: PublisherServerConfigNormalized;
16
- export declare const contentAssets: ContentAssets;
17
- export declare const moduleAssets: ModuleAssets;
18
-
19
- export declare function getServer(): PublisherServer;