@fastly/compute-js-static-publish 8.1.0-beta.3 → 8.1.0-beta.5

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 (79) hide show
  1. package/CHANGELOG.md +602 -0
  2. package/DOCUMENTATION.md +53 -14
  3. package/MIGRATING.md +289 -0
  4. package/build/cli/cli/commands/manage/deploy.d.ts.map +1 -1
  5. package/build/cli/cli/commands/manage/deploy.js +27 -7
  6. package/build/cli/cli/commands/manage/index.d.ts +1 -0
  7. package/build/cli/cli/commands/manage/index.d.ts.map +1 -1
  8. package/build/cli/cli/commands/manage/index.js +13 -11
  9. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  10. package/build/cli/cli/commands/manage/publish-content.js +5 -3
  11. package/build/cli/cli/commands/manage/status.d.ts.map +1 -1
  12. package/build/cli/cli/commands/manage/status.js +7 -5
  13. package/build/cli/cli/commands/manage/template/init.js +6 -6
  14. package/build/cli/cli/commands/scaffold/generate-app.d.ts +2 -0
  15. package/build/cli/cli/commands/scaffold/generate-app.d.ts.map +1 -1
  16. package/build/cli/cli/commands/scaffold/generate-app.js +6 -0
  17. package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
  18. package/build/cli/cli/commands/scaffold/index.js +12 -6
  19. package/build/cli/cli/index.js +15 -1
  20. package/build/cli/cli/managed/fastly-service.d.ts +7 -0
  21. package/build/cli/cli/managed/fastly-service.d.ts.map +1 -1
  22. package/build/cli/cli/managed/fastly-service.js +31 -1
  23. package/build/cli/cli/managed/fingerprint.d.ts +12 -0
  24. package/build/cli/cli/managed/fingerprint.d.ts.map +1 -1
  25. package/build/cli/cli/managed/fingerprint.js +25 -0
  26. package/build/cli/cli/managed/project-file.d.ts.map +1 -1
  27. package/build/cli/cli/managed/project-file.js +9 -1
  28. package/build/cli/cli/managed/template-init.d.ts.map +1 -1
  29. package/build/cli/cli/managed/template-init.js +3 -1
  30. package/build/cli/cli/util/collection-selection-flags.d.ts +1 -1
  31. package/build/cli/cli/util/collection-selection-flags.d.ts.map +1 -1
  32. package/build/cli/cli/util/collection-selection-flags.js +31 -5
  33. package/build/cli/cli/util/config.d.ts +4 -0
  34. package/build/cli/cli/util/config.d.ts.map +1 -1
  35. package/build/cli/cli/util/config.js +33 -0
  36. package/build/cli/cli/util/fastly-options.d.ts +2 -0
  37. package/build/cli/cli/util/fastly-options.d.ts.map +1 -0
  38. package/build/cli/cli/util/fastly-options.js +52 -0
  39. package/build/cli/cli/util/output.js +1 -1
  40. package/build/cli/cli/util/package.d.ts.map +1 -1
  41. package/build/cli/cli/util/package.js +10 -4
  42. package/build/cli/models/config/collection-selection.d.ts +2 -0
  43. package/build/cli/models/config/collection-selection.d.ts.map +1 -1
  44. package/build/cli/models/config/collection-selection.js +48 -8
  45. package/build/cli/models/config/s3-storage-config.d.ts +1 -0
  46. package/build/cli/models/config/s3-storage-config.d.ts.map +1 -1
  47. package/build/cli/models/config/s3-storage-config.js +1 -0
  48. package/build/cli/models/config/static-publish-rc.d.ts +1 -0
  49. package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
  50. package/build/cli/models/config/static-publish-rc.js +3 -1
  51. package/build/server/hono/extensions.d.ts +3 -1
  52. package/build/server/hono/extensions.d.ts.map +1 -1
  53. package/build/server/hono/extensions.js +12 -7
  54. package/build/server/hono/index.d.ts +6 -1
  55. package/build/server/hono/index.d.ts.map +1 -1
  56. package/build/server/hono/index.js +21 -13
  57. package/build/server/models/config/collection-selection.d.ts +2 -0
  58. package/build/server/models/config/collection-selection.d.ts.map +1 -1
  59. package/build/server/models/config/collection-selection.js +48 -8
  60. package/build/server/models/config/s3-storage-config.d.ts +1 -0
  61. package/build/server/models/config/s3-storage-config.d.ts.map +1 -1
  62. package/build/server/models/config/s3-storage-config.js +1 -0
  63. package/build/server/models/config/static-publish-rc.d.ts +1 -0
  64. package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
  65. package/build/server/models/config/static-publish-rc.js +3 -1
  66. package/build/server/server/collection-selection/index.d.ts.map +1 -1
  67. package/build/server/server/collection-selection/index.js +16 -6
  68. package/build/server/server/publisher-server/index.d.ts +2 -0
  69. package/build/server/server/publisher-server/index.d.ts.map +1 -1
  70. package/build/server/server/publisher-server/index.js +4 -4
  71. package/build/server/server/storage/s3-storage-provider.d.ts +2 -1
  72. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  73. package/build/server/server/storage/s3-storage-provider.js +15 -7
  74. package/package.json +4 -2
  75. package/resources/app/fastly.toml.njk +8 -8
  76. package/resources/app/static-publish.project.js.njk +6 -0
  77. package/resources/app/static-publish.rc.js.njk +6 -0
  78. package/resources/template-init/hono/gitignore +1 -0
  79. package/resources/templates/hono/src/index.ts +6 -4
@@ -8,5 +8,6 @@ export function getS3StorageConfigFromRc(rc) {
8
8
  bucket: rc.s3.bucket,
9
9
  endpoint: rc.s3.endpoint,
10
10
  fastlyBackendName: rc.s3.fastlyBackendName,
11
+ secretStoreLinkName: rc.s3.secretStoreLinkName,
11
12
  };
12
13
  }
@@ -47,6 +47,7 @@ export type StaticPublishPartialS3Storage = {
47
47
  bucket: string;
48
48
  endpoint?: string;
49
49
  fastlyBackendName?: string;
50
+ secretStoreLinkName?: string;
50
51
  };
51
52
  };
52
53
  export type StaticPublishS3Storage = StaticPublishPartialS3Storage & StaticPublishRcBase;
@@ -1 +1 @@
1
- {"version":3,"file":"static-publish-rc.d.ts","sourceRoot":"","sources":["../../../../src/models/config/static-publish-rc.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,MAAM,mBAAmB,GAAG;IAGhC,SAAS,EAAE,MAAM,CAAC;IAGlB,qBAAqB,EAAE,MAAM,CAAC;IAK9B,yBAAyB,EAAE,MAAM,CAAC;IAGlC,aAAa,CAAC,EAAE,aAAa,CAAC;IAK9B,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAG1C,KAAK,CAAC,EAAE,kB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M,2BAA2B,GACnC,2BAA2B,GAC3B,6BAA6B,CAChC;AAED,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,sBAAsB,CACzB;AAQD,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAuB5E"}
@@ -32,7 +32,9 @@ export function isS3StorageConfigRc(rc) {
32
32
  rc.s3.endpoint === undefined ||
33
33
  typeof rc.s3.endpoint === 'string') && (!('fastlyBackendName' in rc.s3) ||
34
34
  rc.s3.fastlyBackendName === undefined ||
35
- typeof rc.s3.fastlyBackendName === 'string')) {
35
+ typeof rc.s3.fastlyBackendName === 'string') && (!('secretStoreLinkName' in rc.s3) ||
36
+ rc.s3.secretStoreLinkName === undefined ||
37
+ (typeof rc.s3.secretStoreLinkName === 'string' && rc.s3.secretStoreLinkName !== ''))) {
36
38
  return true;
37
39
  }
38
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/collection-selection/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,6BAA6B,EAKnC,MAAM,6CAA6C,CAAC;AAGrD,MAAM,MAAM,uBAAuB,GAAG;IAEpC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,SAAS,CAAC,EAAE,6BAA6B,CAAC;CAC3C,CAAC;AA6FF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAmCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAGhG;AAKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,uBAAuB,CAoE3H"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/collection-selection/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,6BAA6B,EAKnC,MAAM,6CAA6C,CAAC;AAGrD,MAAM,MAAM,uBAAuB,GAAG;IAEpC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAG9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,SAAS,CAAC,EAAE,6BAA6B,CAAC;CAC3C,CAAC;AAuGF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAmCD,wBAAgB,eAAe,CAAC,MAAM,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAGhG;AAKD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,GAAG,uBAAuB,CAoE3H"}
@@ -33,6 +33,11 @@ function compile(config) {
33
33
  const matchers = config.sources.map((source) => {
34
34
  switch (source.type) {
35
35
  case 'host': {
36
+ if (source.value != null) {
37
+ const hostname = source.pattern.toLowerCase();
38
+ const value = source.value;
39
+ return (url) => url.hostname.toLowerCase() === hostname && allowed(value) ? { collectionName: value } : null;
40
+ }
36
41
  const parts = splitPattern(source.pattern);
37
42
  const re = new RegExp(`^${escapeRegExp(parts.before.toLowerCase())}${NAME_GROUP}${escapeRegExp(parts.after.toLowerCase())}$`);
38
43
  return (url) => {
@@ -41,11 +46,16 @@ function compile(config) {
41
46
  };
42
47
  }
43
48
  case 'path': {
44
- const parts = splitPattern(source.prefix);
45
- const re = new RegExp(`^${escapeRegExp(parts.before)}${NAME_GROUP}${escapeRegExp(parts.after)}(/.*)?$`);
49
+ // With value, the whole prefix is fixed text.
50
+ const value = source.value;
51
+ const parts = value != null ? null : splitPattern(source.prefix);
52
+ const re = parts != null ?
53
+ new RegExp(`^${escapeRegExp(parts.before)}${NAME_GROUP}${escapeRegExp(parts.after)}(/.*)?$`) :
54
+ new RegExp(`^${escapeRegExp(source.prefix)}()(/.*)?$`);
46
55
  return (url) => {
47
56
  const match = re.exec(url.pathname);
48
- if (match == null || !allowed(match[1])) {
57
+ const name = value ?? match?.[1];
58
+ if (match == null || !allowed(name)) {
49
59
  return null;
50
60
  }
51
61
  let pathname;
@@ -55,7 +65,7 @@ function compile(config) {
55
65
  catch {
56
66
  return null;
57
67
  }
58
- return { collectionName: match[1], pathname };
68
+ return { collectionName: name, pathname };
59
69
  };
60
70
  }
61
71
  case 'query':
@@ -174,8 +184,8 @@ export function resolveCollection(request, config) {
174
184
  let location;
175
185
  if (source.type === 'path') {
176
186
  // The path without the prefix, not decoded.
177
- const parts = splitPattern(source.prefix);
178
- const prefix = parts.before + match.collectionName + parts.after;
187
+ const parts = source.value != null ? null : splitPattern(source.prefix);
188
+ const prefix = parts != null ? parts.before + match.collectionName + parts.after : source.prefix;
179
189
  location = (url.pathname.slice(prefix.length) || '/') + url.search;
180
190
  }
181
191
  else {
@@ -25,9 +25,11 @@ export type ServeRequestOptions = {
25
25
  pathname?: string;
26
26
  fallback?: boolean;
27
27
  healthCheck?: boolean;
28
+ onMissing?: 'not-found' | 'default';
28
29
  };
29
30
  export type ServeFallbackOptions = {
30
31
  collectionName?: string | null;
32
+ onMissing?: 'not-found' | 'default';
31
33
  };
32
34
  export declare class PublisherServer {
33
35
  constructor(publishId: string, storageProvider: StorageProvider, defaultCollectionName: string);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/publisher-server/index.ts"],"names":[],"mappings":"AASA,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,KAAK,+BAA+B,EACrC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,K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kC;IA6D7B,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAEtH;YAEa,mBAAmB;YA8BnB,wCAAwC;IAyChD,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEzF;YAEa,aAAa;IAmErB,WAAW,CACf,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,GACtD,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAE1B;YAEa,cAAc;IAiH5B,OAAO,CAAC,iBAAiB;IAgCnB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAoChG;IAMK,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA6BlG;IAIK,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAE7F;YAEa,wBAAwB;YASxB,uBAAuB;IAyBrC,OAAO,CAAC,mBAAmB;IAqB3B,OAAO,CAAC,eAAe;YAQT,uBAAuB;YAyCvB,wBAAwB;CAiCvC"}
@@ -663,7 +663,7 @@ export class PublisherServer {
663
663
  if (options.healthCheck !== false && pathname === '/healthz') {
664
664
  return new Response("OK", { status: 200 });
665
665
  }
666
- const selected = await this.checkSelectedCollection(request, scope);
666
+ const selected = await this.checkSelectedCollection(request, scope, options.onMissing);
667
667
  if (selected instanceof Response) {
668
668
  return selected;
669
669
  }
@@ -688,7 +688,7 @@ export class PublisherServer {
688
688
  if (!requestAcceptsTextHtml(request)) {
689
689
  return null;
690
690
  }
691
- const selected = await this.checkSelectedCollection(request, scope);
691
+ const selected = await this.checkSelectedCollection(request, scope, options.onMissing);
692
692
  if (selected instanceof Response) {
693
693
  return selected;
694
694
  }
@@ -717,7 +717,7 @@ export class PublisherServer {
717
717
  // whether to mark the response as a preview, or a 404 response for onMissing:
718
718
  // 'not-found'. The check reads the index, also when the response cache has the
719
719
  // response.
720
- async checkSelectedCollection(request, scope) {
720
+ async checkSelectedCollection(request, scope, onMissing) {
721
721
  const config = this.collectionSelection;
722
722
  if (config == null || scope.collectionName === this.defaultCollectionName) {
723
723
  return { scope, preview: false };
@@ -725,7 +725,7 @@ export class PublisherServer {
725
725
  if (await this.isCollectionAvailableFor(scope)) {
726
726
  return { scope, preview: true };
727
727
  }
728
- if (config.onMissing === 'default') {
728
+ if ((onMissing ?? config.onMissing) === 'default') {
729
729
  this.currentScope = this.scopeForRequest(request, this.defaultCollectionName);
730
730
  return { scope: this.currentScope, preview: false };
731
731
  }
@@ -8,7 +8,8 @@ export declare const buildStoreProvider: StorageProviderBuilder;
8
8
  /**
9
9
  * Sets the resource link name of the Secret Store that has the S3 credentials.
10
10
  * This is the name of the link between the service and the Secret Store, not
11
- * the name of the Secret Store. The default is 'S3_CREDENTIALS'.
11
+ * the name of the Secret Store. It is used in place of s3.secretStoreLinkName of
12
+ * static-publish.rc.js. The default is 'S3_CREDENTIALS'.
12
13
  */
13
14
  export declare function setSecretStoreForS3Credentials(resourceLinkName: string): void;
14
15
  export declare function setSecretStoreKeyForS3AccessKeyId(secretStoreKey: string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"s3-storage-provider.d.ts","sourceRoot":"","sources":["../../../../src/server/storage/s3-storage-provider.ts"],"names":[],"mappings":"AAiBA,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM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AAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAmD1E;IAEK,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAiCzE;CACF"}
@@ -14,21 +14,28 @@ export const buildStoreProvider = (config) => {
14
14
  return null;
15
15
  }
16
16
  const s3StorageConfig = getS3StorageConfigFromRc(config);
17
+ _secretStoreLinkNameFromRc = s3StorageConfig.secretStoreLinkName;
17
18
  return new S3StorageProvider(s3StorageConfig.region, s3StorageConfig.bucket, {
18
19
  s3Endpoint: s3StorageConfig.endpoint,
19
20
  s3FastlyBackendName: s3StorageConfig.fastlyBackendName,
20
21
  });
21
22
  };
22
- let _secretStoreLinkNameForS3Credentials = 'S3_CREDENTIALS';
23
+ // The resource link name of the Secret Store with the S3 credentials:
24
+ // setSecretStoreForS3Credentials(), else s3.secretStoreLinkName of
25
+ // static-publish.rc.js, else 'S3_CREDENTIALS'.
26
+ let _secretStoreLinkNameFromCode = undefined;
27
+ let _secretStoreLinkNameFromRc = undefined;
28
+ const secretStoreLinkNameForS3Credentials = () => _secretStoreLinkNameFromCode ?? _secretStoreLinkNameFromRc ?? 'S3_CREDENTIALS';
23
29
  let _secretStoreKeyForS3AccessKeyId = 'S3_ACCESS_KEY_ID';
24
30
  let _secretStoreKeyForS3SecretAccessKey = 'S3_SECRET_ACCESS_KEY';
25
31
  /**
26
32
  * Sets the resource link name of the Secret Store that has the S3 credentials.
27
33
  * This is the name of the link between the service and the Secret Store, not
28
- * the name of the Secret Store. The default is 'S3_CREDENTIALS'.
34
+ * the name of the Secret Store. It is used in place of s3.secretStoreLinkName of
35
+ * static-publish.rc.js. The default is 'S3_CREDENTIALS'.
29
36
  */
30
37
  export function setSecretStoreForS3Credentials(resourceLinkName) {
31
- _secretStoreLinkNameForS3Credentials = resourceLinkName;
38
+ _secretStoreLinkNameFromCode = resourceLinkName;
32
39
  }
33
40
  export function setSecretStoreKeyForS3AccessKeyId(secretStoreKey) {
34
41
  _secretStoreKeyForS3AccessKeyId = secretStoreKey;
@@ -41,21 +48,22 @@ export async function buildS3CredentialsFromSecretStore() {
41
48
  if (_s3CredentialsFromSecretStore != null) {
42
49
  return _s3CredentialsFromSecretStore;
43
50
  }
51
+ const linkName = secretStoreLinkNameForS3Credentials();
44
52
  let secretStore;
45
53
  try {
46
- secretStore = new SecretStore(_secretStoreLinkNameForS3Credentials);
54
+ secretStore = new SecretStore(linkName);
47
55
  }
48
56
  catch {
49
- throw new Error(`Could not open the secret store for S3 credentials with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
57
+ throw new Error(`Could not open the secret store for S3 credentials with the resource link name '${linkName}'`);
50
58
  }
51
59
  const accessKeyIdEntry = await secretStore.get(_secretStoreKeyForS3AccessKeyId);
52
60
  if (accessKeyIdEntry == null) {
53
- throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in the secret store with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
61
+ throw new Error(`Could not retrieve value '${_secretStoreKeyForS3AccessKeyId}' in the secret store with the resource link name '${linkName}'`);
54
62
  }
55
63
  const accessKeyId = accessKeyIdEntry.plaintext();
56
64
  const secretAccessKeyEntry = await secretStore.get(_secretStoreKeyForS3SecretAccessKey);
57
65
  if (secretAccessKeyEntry == null) {
58
- throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in the secret store with the resource link name '${_secretStoreLinkNameForS3Credentials}'`);
66
+ throw new Error(`Could not retrieve value '${_secretStoreKeyForS3SecretAccessKey}' in the secret store with the resource link name '${linkName}'`);
59
67
  }
60
68
  const secretAccessKey = secretAccessKeyEntry.plaintext();
61
69
  _s3CredentialsFromSecretStore = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastly/compute-js-static-publish",
3
3
  "type": "module",
4
- "version": "8.1.0-beta.3",
4
+ "version": "8.1.0-beta.5",
5
5
  "description": "Static Publisher for Fastly Compute JavaScript",
6
6
  "main": "build/server/server/index.js",
7
7
  "exports": {
@@ -74,7 +74,7 @@
74
74
  "@types/nunjucks": "^3.2.6",
75
75
  "esbuild": "^0.28.2",
76
76
  "hono": "^4.13.14",
77
- "rimraf": "^4.3.0",
77
+ "rimraf": "^6.1.4",
78
78
  "typescript": "^7.0.2"
79
79
  },
80
80
  "engines": {
@@ -87,6 +87,8 @@
87
87
  "package.json",
88
88
  "README.md",
89
89
  "DOCUMENTATION.md",
90
+ "CHANGELOG.md",
91
+ "MIGRATING.md",
90
92
  "SECURITY.md"
91
93
  ]
92
94
  }
@@ -27,32 +27,32 @@ build = "npm run build"
27
27
  [local_server]
28
28
 
29
29
  [local_server.secret_stores]
30
- [[local_server.secret_stores.S3_CREDENTIALS]]
30
+ [[local_server.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}]]
31
31
  key = "S3_ACCESS_KEY_ID"
32
32
  env = "S3_ACCESS_KEY_ID"
33
- [[local_server.secret_stores.S3_CREDENTIALS]]
33
+ [[local_server.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}]]
34
34
  key = "S3_SECRET_ACCESS_KEY"
35
35
  env = "S3_SECRET_ACCESS_KEY"
36
36
 
37
37
  [local_server.backends]
38
- [local_server.backends.s3_storage]
38
+ [local_server.backends.{{ s3BackendName | tomlKey }}]
39
39
  url = {{ s3EndpointUrl | toml }}
40
40
  override_host = {{ s3EndpointHostname | toml }}
41
41
 
42
42
  [setup]
43
43
 
44
44
  [setup.backends]
45
- [setup.backends.s3_storage]
45
+ [setup.backends.{{ s3BackendName | tomlKey }}]
46
46
  address = {{ s3EndpointHostname | toml }}
47
47
  description = "S3 API endpoint"
48
48
  port = 443
49
49
  [setup.secret_stores]
50
- [setup.secret_stores.S3_CREDENTIALS]
50
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}]
51
51
  description = "Credentials for S3 storage"
52
- [setup.secret_stores.S3_CREDENTIALS.entries]
53
- [setup.secret_stores.S3_CREDENTIALS.entries.S3_ACCESS_KEY_ID]
52
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}.entries]
53
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}.entries.S3_ACCESS_KEY_ID]
54
54
  description = "Access Key ID"
55
- [setup.secret_stores.S3_CREDENTIALS.entries.S3_SECRET_ACCESS_KEY]
55
+ [setup.secret_stores.{{ s3SecretStoreLinkName | tomlKey }}.entries.S3_SECRET_ACCESS_KEY]
56
56
  description = "Secret Access Key"
57
57
  {% endif %}
58
58
 
@@ -21,6 +21,12 @@ const project = {
21
21
  bucket: {{ storage.bucket | js }},
22
22
  {% if not storage.endpointGenerated %}
23
23
  endpoint: {{ s3EndpointUrl | js }},
24
+ {% endif %}
25
+ {% if storage.fastlyBackendName %}
26
+ fastlyBackendName: {{ storage.fastlyBackendName | js }},
27
+ {% endif %}
28
+ {% if storage.secretStoreLinkName %}
29
+ secretStoreLinkName: {{ storage.secretStoreLinkName | js }},
24
30
  {% endif %}
25
31
  },
26
32
  {% endif %}
@@ -16,6 +16,12 @@ const rc = {
16
16
  bucket: {{ storage.bucket | js }},
17
17
  {% if not storage.endpointGenerated %}
18
18
  endpoint: {{ s3EndpointUrl | js }},
19
+ {% endif %}
20
+ {% if storage.fastlyBackendName %}
21
+ fastlyBackendName: {{ storage.fastlyBackendName | js }},
22
+ {% endif %}
23
+ {% if storage.secretStoreLinkName %}
24
+ secretStoreLinkName: {{ storage.secretStoreLinkName | js }},
19
25
  {% endif %}
20
26
  },
21
27
  {% endif %}
@@ -0,0 +1 @@
1
+ /node_modules
@@ -1,4 +1,3 @@
1
- /// <reference types="@fastly/js-compute" />
2
1
  import { Hono } from 'hono';
3
2
  import { type BindingsDefs, buildFire, logFastlyServiceVersion } from '@fastly/hono-fastly-compute';
4
3
  import {
@@ -17,7 +16,10 @@ const honoOptions = rc.templateOptions?.hono;
17
16
  // with two different resources stops the build.
18
17
  const fire = buildFire(mergeBindings(honoOptions?.bindings, extensions) as BindingsDefs);
19
18
 
20
- const { serveStatic, serveFallback, selectCollection } = fromStaticPublishRc(rc);
19
+ const { serveStatic, staticResponse, serveFallback, selectCollection, publisherServer } = fromStaticPublishRc(rc);
20
+
21
+ // The helpers of the app that each phase of the extensions gets.
22
+ const helpers = { serveStatic, staticResponse, serveFallback, publisherServer };
21
23
 
22
24
  const app = new Hono<{ Bindings: typeof fire.Bindings, Variables: StaticPublisherVariables }>();
23
25
 
@@ -31,7 +33,7 @@ app.use('*', selectCollection());
31
33
  // them, then the beforeFiles phase.
32
34
  for (const phase of [ 'middleware', 'beforeFiles' ] as const) {
33
35
  for (const e of extensions) {
34
- e.module.phases[phase]?.(app, honoOptions?.extensions?.[e.name]);
36
+ e.module.phases[phase]?.(app, honoOptions?.extensions?.[e.name], helpers);
35
37
  }
36
38
  }
37
39
 
@@ -44,7 +46,7 @@ app.use('*', serveStatic());
44
46
  // The afterFiles phase of the extensions: only for the requests that no
45
47
  // published file matches.
46
48
  for (const e of extensions) {
47
- e.module.phases.afterFiles?.(app, honoOptions?.extensions?.[e.name]);
49
+ e.module.phases.afterFiles?.(app, honoOptions?.extensions?.[e.name], helpers);
48
50
  }
49
51
 
50
52
  // When nothing matches, serve the SPA file or the 404 page.