@fastly/compute-js-static-publish 8.1.0-beta.2 → 8.1.0-beta.4

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 (90) hide show
  1. package/CHANGELOG.md +601 -0
  2. package/DOCUMENTATION.md +28 -19
  3. package/README.md +18 -5
  4. package/README.short.md +18 -5
  5. package/build/cli/cli/commands/manage/collections/list.d.ts.map +1 -1
  6. package/build/cli/cli/commands/manage/collections/list.js +8 -10
  7. package/build/cli/cli/commands/manage/deploy.d.ts.map +1 -1
  8. package/build/cli/cli/commands/manage/deploy.js +68 -12
  9. package/build/cli/cli/commands/manage/eject.d.ts.map +1 -1
  10. package/build/cli/cli/commands/manage/eject.js +22 -5
  11. package/build/cli/cli/commands/manage/publish-content.d.ts.map +1 -1
  12. package/build/cli/cli/commands/manage/publish-content.js +9 -4
  13. package/build/cli/cli/commands/manage/status.d.ts.map +1 -1
  14. package/build/cli/cli/commands/manage/status.js +6 -0
  15. package/build/cli/cli/commands/manage/template/init.js +6 -6
  16. package/build/cli/cli/commands/run-dev-watch.d.ts +1 -0
  17. package/build/cli/cli/commands/run-dev-watch.d.ts.map +1 -1
  18. package/build/cli/cli/commands/run-dev-watch.js +45 -9
  19. package/build/cli/cli/commands/scaffold/generate-app.d.ts +10 -3
  20. package/build/cli/cli/commands/scaffold/generate-app.d.ts.map +1 -1
  21. package/build/cli/cli/commands/scaffold/generate-app.js +17 -1
  22. package/build/cli/cli/commands/scaffold/index.d.ts +3 -3
  23. package/build/cli/cli/commands/scaffold/index.d.ts.map +1 -1
  24. package/build/cli/cli/commands/scaffold/index.js +27 -24
  25. package/build/cli/cli/managed/app.d.ts +1 -1
  26. package/build/cli/cli/managed/app.d.ts.map +1 -1
  27. package/build/cli/cli/managed/app.js +5 -3
  28. package/build/cli/cli/managed/lockfile.js +1 -1
  29. package/build/cli/cli/managed/project-file.d.ts.map +1 -1
  30. package/build/cli/cli/managed/project-file.js +13 -4
  31. package/build/cli/cli/managed/template-init.d.ts.map +1 -1
  32. package/build/cli/cli/managed/template-init.js +3 -1
  33. package/build/cli/cli/util/collection-selection-flags.d.ts +1 -1
  34. package/build/cli/cli/util/collection-selection-flags.d.ts.map +1 -1
  35. package/build/cli/cli/util/collection-selection-flags.js +31 -5
  36. package/build/cli/cli/util/config.d.ts.map +1 -1
  37. package/build/cli/cli/util/config.js +9 -0
  38. package/build/cli/cli/util/fastly-options.d.ts +2 -0
  39. package/build/cli/cli/util/fastly-options.d.ts.map +1 -0
  40. package/build/cli/cli/util/fastly-options.js +52 -0
  41. package/build/cli/cli/util/global-options.js +1 -1
  42. package/build/cli/cli/util/package.d.ts +2 -1
  43. package/build/cli/cli/util/package.d.ts.map +1 -1
  44. package/build/cli/cli/util/package.js +47 -9
  45. package/build/cli/cli/util/s3.d.ts +10 -4
  46. package/build/cli/cli/util/s3.d.ts.map +1 -1
  47. package/build/cli/cli/util/s3.js +13 -35
  48. package/build/cli/models/config/collection-selection.d.ts +2 -0
  49. package/build/cli/models/config/collection-selection.d.ts.map +1 -1
  50. package/build/cli/models/config/collection-selection.js +48 -8
  51. package/build/cli/models/config/publish-content-config.d.ts +1 -0
  52. package/build/cli/models/config/publish-content-config.d.ts.map +1 -1
  53. package/build/cli/models/config/s3-storage-config.d.ts +1 -0
  54. package/build/cli/models/config/s3-storage-config.d.ts.map +1 -1
  55. package/build/cli/models/config/s3-storage-config.js +1 -0
  56. package/build/cli/models/config/static-publish-rc.d.ts +1 -0
  57. package/build/cli/models/config/static-publish-rc.d.ts.map +1 -1
  58. package/build/cli/models/config/static-publish-rc.js +3 -1
  59. package/build/cli/models/server/index.d.ts +2 -0
  60. package/build/cli/models/server/index.d.ts.map +1 -1
  61. package/build/cli/models/server/index.js +13 -1
  62. package/build/server/hono/extensions.d.ts.map +1 -1
  63. package/build/server/hono/extensions.js +12 -7
  64. package/build/server/models/config/collection-selection.d.ts +2 -0
  65. package/build/server/models/config/collection-selection.d.ts.map +1 -1
  66. package/build/server/models/config/collection-selection.js +48 -8
  67. package/build/server/models/config/publish-content-config.d.ts +1 -0
  68. package/build/server/models/config/publish-content-config.d.ts.map +1 -1
  69. package/build/server/models/config/s3-storage-config.d.ts +1 -0
  70. package/build/server/models/config/s3-storage-config.d.ts.map +1 -1
  71. package/build/server/models/config/s3-storage-config.js +1 -0
  72. package/build/server/models/config/static-publish-rc.d.ts +1 -0
  73. package/build/server/models/config/static-publish-rc.d.ts.map +1 -1
  74. package/build/server/models/config/static-publish-rc.js +3 -1
  75. package/build/server/models/server/index.d.ts +2 -0
  76. package/build/server/models/server/index.d.ts.map +1 -1
  77. package/build/server/models/server/index.js +13 -1
  78. package/build/server/server/collection-selection/index.d.ts.map +1 -1
  79. package/build/server/server/collection-selection/index.js +16 -6
  80. package/build/server/server/storage/s3-storage-provider.d.ts +2 -1
  81. package/build/server/server/storage/s3-storage-provider.d.ts.map +1 -1
  82. package/build/server/server/storage/s3-storage-provider.js +15 -7
  83. package/package.json +2 -1
  84. package/resources/app/fastly.toml.njk +8 -8
  85. package/resources/app/publish-content.config.js.njk +1 -0
  86. package/resources/app/static-publish.project.js.njk +6 -0
  87. package/resources/app/static-publish.rc.js.njk +6 -0
  88. package/resources/template-init/hono/gitignore +1 -0
  89. package/resources/templates/hono/src/index.ts +0 -1
  90. package/resources/templates/plain/src/index.js +12 -2
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/config.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,KAAK,2BAA2B,EAIjC,MAAM,+CAA+C,CAAC;AAWvD,OAAO,EACL,KAAK,8BAA8B,EAEpC,MAAM,+CAA+C,CAAC;AAOvD,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AAEtG,qBAAa,eAAgB,SAAQ,KAAK;IACxC,MAAM,EAAE,MAAM,EAAE,CAAC;I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G,qBAAa,eAAgB,SAAQ,KAAK;IACxC,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB,YAAY,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAGnD;CACF;AAGD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAE1E,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAY,GAAG,WAAW,CAOhE;AAKD,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAGD,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,EAAE,EAAE,eAAe,CAAC;IAEpB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAsBF,eAAO,MAAM,uBAAuB,yEAoBlC,CAAC;AAGH,wBAAsB,eAAe,IAAI,OAAO,CAAC,8BAA8B,CAAC,CAsB/E;AAID,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,CAmC1E;AAGD,eAAO,MAAM,0BAA0B,6DAgGrC,CAAC;AAKH,wBAAsB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAWtH;AAED,wBAAsB,4BAA4B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,8BAA8B,CAAC,CA6B9G;AAwED,eAAO,MAAM,6BAA6B,4EAiLxC,CAAC;AAEH,eAAO,MAAM,8BAA8B,6EA2GzC,CAAC"}
@@ -89,6 +89,12 @@ export async function loadProjectFile() {
89
89
  if (!('publishContent' in configRaw) || configRaw.publishContent == null || typeof configRaw.publishContent !== 'object') {
90
90
  errors.push('publishContent must be specified.');
91
91
  }
92
+ else {
93
+ // Checked here, so that each command shows the errors in the same way.
94
+ const publishContentErrors = [];
95
+ normalizePublishContentConfig(configRaw.publishContent, publishContentErrors);
96
+ errors.push(...publishContentErrors.map(error => `publishContent: ${error}`));
97
+ }
92
98
  let managed = {};
93
99
  if ('managed' in configRaw && configRaw.managed != null) {
94
100
  managed = normalizeProjectManaged(configRaw.managed, errors);
@@ -407,10 +413,12 @@ export const normalizePublishContentConfig = buildNormalizeFunctionForObject((co
407
413
  else {
408
414
  errors.push('assetInclusionTest, if specified, must be null or a function.');
409
415
  }
416
+ let hiddenItemsAsWritten = [];
410
417
  if (!isSpecified(config, 'hiddenItems')) {
411
418
  hiddenItems = [];
412
419
  }
413
420
  else {
421
+ hiddenItemsAsWritten = (Array.isArray(hiddenItems) ? hiddenItems : [hiddenItems]).filter((x) => typeof x === 'string');
414
422
  hiddenItems = normalizeItemList('hiddenItems', hiddenItems, errors);
415
423
  }
416
424
  if (!isSpecified(config, 'contentCompression')) {
@@ -479,6 +487,7 @@ export const normalizePublishContentConfig = buildNormalizeFunctionForObject((co
479
487
  includeWellKnown,
480
488
  assetInclusionTest,
481
489
  hiddenItems,
490
+ hiddenItemsAsWritten,
482
491
  contentCompression,
483
492
  brotliQuality,
484
493
  contentTypes,
@@ -0,0 +1,2 @@
1
+ export declare function findRefusedFastlyOption(args: string[]): string | null;
2
+ //# sourceMappingURL=fastly-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fastly-options.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/fastly-options.ts"],"names":[],"mappings":"AAiCA,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAqBrE"}
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright Fastly, Inc.
3
+ * Licensed under the MIT license. See LICENSE file for details.
4
+ */
5
+ // The options after -- of deploy, which go to 'fastly compute deploy' (or
6
+ // 'fastly compute publish' in an ejected app). deploy refuses the options that
7
+ // it sets itself, and the options that make the Fastly CLI deploy another
8
+ // package, from another directory, or with another manifest or token.
9
+ const REFUSED = new Map([
10
+ ['comment', `deploy sets the comment of the service version. Use the --comment option of deploy (before --).`],
11
+ ['service-id', `Use --fastly-service-id or FASTLY_SERVICE_ID.`],
12
+ ['token', `Use --fastly-api-token or FASTLY_API_TOKEN.`],
13
+ ['package', `deploy deploys the package that it builds.`],
14
+ ['dir', `deploy deploys the app of the project.`],
15
+ ['env', `deploy uses the fastly.toml of the app.`],
16
+ ]);
17
+ // The short forms of the refused options. In 'fastly compute deploy' and
18
+ // 'fastly compute publish', these are the only short options that take a
19
+ // value. The other short options (-i, -y, -d, -v, -q, -h) take no value, so a
20
+ // group such as -is is -i and then -s.
21
+ const REFUSED_SHORT = new Map([
22
+ ['s', 'service-id'],
23
+ ['t', 'token'],
24
+ ['p', 'package'],
25
+ ['C', 'dir'],
26
+ ]);
27
+ // Returns the error message for the first refused option in args, or null if
28
+ // args has none. A value that starts with '-' (for example --service-name -s)
29
+ // looks like an option, so it can also be refused.
30
+ export function findRefusedFastlyOption(args) {
31
+ for (const arg of args) {
32
+ if (arg.startsWith('--')) {
33
+ const name = arg.slice(2).split('=')[0];
34
+ const reason = REFUSED.get(name);
35
+ if (reason != null) {
36
+ return `--${name} cannot be given to the Fastly CLI. ${reason}`;
37
+ }
38
+ }
39
+ else if (arg.startsWith('-') && arg.length > 1) {
40
+ for (const letter of arg.slice(1)) {
41
+ if (letter === '=') {
42
+ break;
43
+ }
44
+ const name = REFUSED_SHORT.get(letter);
45
+ if (name != null) {
46
+ return `-${letter} (--${name}) cannot be given to the Fastly CLI. ${REFUSED.get(name)}`;
47
+ }
48
+ }
49
+ }
50
+ }
51
+ return null;
52
+ }
@@ -22,7 +22,7 @@ export function parseGlobalOptions(args, env = {}) {
22
22
  if (arg.startsWith(`${option}=`)) {
23
23
  secrets.push(arg.slice(option.length + 1));
24
24
  }
25
- else if (arg === option && args[i + 1] != null) {
25
+ else if (arg === option && args[i + 1] != null && !args[i + 1].startsWith('-')) {
26
26
  secrets.push(args[i + 1]);
27
27
  }
28
28
  }
@@ -8,8 +8,9 @@ export type PackageJson = {
8
8
  export declare function getOwnPackageDir(): string;
9
9
  export declare function readOwnPackageJson(): Record<string, any>;
10
10
  export declare function getOwnVersion(): string;
11
+ export declare function isLocalCopy(dir?: string): boolean;
11
12
  export declare function cliCommand(options?: {
12
13
  latest?: boolean;
13
- }, version?: string): string;
14
+ }, version?: string, localCopy?: boolean): string;
14
15
  export declare function findComputeJsStaticPublisherVersion(packageJson: PackageJson | null): string;
15
16
  //# sourceMappingURL=package.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/package.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAGF,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAExD;AAGD,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAQD,wBAAgB,UAAU,CAAC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,EAAE,OAAO,GAAE,MAAwB,GAAG,MAAM,CAIxG;AAED,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,UA8ClF"}
1
+ {"version":3,"file":"package.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/package.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C,CAAC;AAGF,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAGD,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAExD;AAGD,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAKD,wBAAgB,WAAW,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAoBhE;AAWD,wBAAgB,UAAU,CACxB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,EAClC,OAAO,GAAE,MAAwB,EACjC,SAAS,GAAE,OAAuB,GACjC,MAAM,CAaR;AAED,wBAAgB,mCAAmC,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI,UA8ClF"}
@@ -16,16 +16,54 @@ export function readOwnPackageJson() {
16
16
  export function getOwnVersion() {
17
17
  return readOwnPackageJson().version;
18
18
  }
19
- // The npx command of this package, for the messages of the CLI. The version of
20
- // a prerelease (for example 8.1.0-beta.1) gives the dist-tag of the prerelease
21
- // (@beta), because npx without a dist-tag runs the latest stable version, which
22
- // does not have the features of the prerelease. A stable version gives no
23
- // dist-tag, or @latest with { latest: true } (the command that makes a new
24
- // app).
25
- export function cliCommand(options = {}, version = getOwnVersion()) {
19
+ // True if this copy of the package is the one that a plain `npx
20
+ // @fastly/compute-js-static-publish` runs in the directory: the nearest
21
+ // node_modules/@fastly/compute-js-static-publish, from the directory upwards.
22
+ export function isLocalCopy(dir = process.cwd()) {
23
+ let ownDir;
24
+ try {
25
+ ownDir = fs.realpathSync(getOwnPackageDir());
26
+ }
27
+ catch {
28
+ return false;
29
+ }
30
+ for (let current = path.resolve(dir);; current = path.dirname(current)) {
31
+ const candidate = path.join(current, 'node_modules', '@fastly', 'compute-js-static-publish');
32
+ if (fs.existsSync(candidate)) {
33
+ try {
34
+ return fs.realpathSync(candidate) === ownDir;
35
+ }
36
+ catch {
37
+ return false;
38
+ }
39
+ }
40
+ if (path.dirname(current) === current) {
41
+ return false;
42
+ }
43
+ }
44
+ }
45
+ // The npx command of this package, for the messages of the CLI.
46
+ // - If a plain npx runs this copy (it is installed in the project or the app),
47
+ // the command has no dist-tag. A dist-tag makes npx get the version of that
48
+ // tag from npm, which can be a different version from the installed one.
49
+ // - Else, the version of a prerelease (for example 8.1.0-beta.1) gives the
50
+ // dist-tag of the prerelease (@beta), because npx without a dist-tag runs
51
+ // the latest stable version, which does not have the features of the
52
+ // prerelease. A stable version gives no dist-tag, or @latest with
53
+ // { latest: true } (the command that makes a new app).
54
+ export function cliCommand(options = {}, version = getOwnVersion(), localCopy = isLocalCopy()) {
55
+ const command = 'npx @fastly/compute-js-static-publish';
56
+ if (localCopy) {
57
+ return command;
58
+ }
26
59
  const prerelease = /^\d+\.\d+\.\d+-([a-z][a-z0-9-]*)/.exec(version)?.[1];
27
- const distTag = prerelease ?? (options.latest ? 'latest' : undefined);
28
- return `npx @fastly/compute-js-static-publish${distTag != null ? `@${distTag}` : ''}`;
60
+ if (prerelease != null) {
61
+ return `${command}@${prerelease}`;
62
+ }
63
+ if (options.latest) {
64
+ return `${command}@latest`;
65
+ }
66
+ return command;
29
67
  }
30
68
  export function findComputeJsStaticPublisherVersion(packageJson) {
31
69
  // Get the current compute js static publisher version.
@@ -1,7 +1,13 @@
1
1
  /**
2
- * Resolve the AWS S3 hostname for a given region and bucket.
3
- * - Uses client-s3's own endpoint resolution logic (so it's always accurate).
4
- * - No network calls; intercepts at the build step.
2
+ * The AWS S3 host name of a bucket, for the backend of the app:
3
+ * <bucket>.s3.<region>.amazonaws.com. The server uses the same host name for a
4
+ * bucket without an endpoint (see objectUrl() in
5
+ * src/server/storage/s3-storage-provider.ts). It needs no credentials and no
6
+ * network.
7
+ *
8
+ * Returns null for a bucket name with a dot: under HTTPS, such a name does not
9
+ * match the certificate of *.s3.<region>.amazonaws.com. Such a bucket needs
10
+ * an endpoint, so that the bucket is in the path of the URL.
5
11
  */
6
- export declare function findHostnameForAwsS3RegionAndBucket(region: string, bucket: string): Promise<string>;
12
+ export declare function findHostnameForAwsS3RegionAndBucket(region: string, bucket: string): string | null;
7
13
  //# sourceMappingURL=s3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/s3.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,wBAAsB,mCAAmC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqCzG"}
1
+ {"version":3,"file":"s3.d.ts","sourceRoot":"","sources":["../../../../src/cli/util/s3.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;GAUG;AACH,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKjG"}
@@ -2,42 +2,20 @@
2
2
  * Copyright Fastly, Inc.
3
3
  * Licensed under the MIT license. See LICENSE file for details.
4
4
  */
5
- import { S3Client, HeadObjectCommand } from '@aws-sdk/client-s3';
6
- const DUMMY_KEY = 'dummy.dat'; // placeholder, never sent over the network
7
5
  /**
8
- * Resolve the AWS S3 hostname for a given region and bucket.
9
- * - Uses client-s3's own endpoint resolution logic (so it's always accurate).
10
- * - No network calls; intercepts at the build step.
6
+ * The AWS S3 host name of a bucket, for the backend of the app:
7
+ * <bucket>.s3.<region>.amazonaws.com. The server uses the same host name for a
8
+ * bucket without an endpoint (see objectUrl() in
9
+ * src/server/storage/s3-storage-provider.ts). It needs no credentials and no
10
+ * network.
11
+ *
12
+ * Returns null for a bucket name with a dot: under HTTPS, such a name does not
13
+ * match the certificate of *.s3.<region>.amazonaws.com. Such a bucket needs
14
+ * an endpoint, so that the bucket is in the path of the URL.
11
15
  */
12
- export async function findHostnameForAwsS3RegionAndBucket(region, bucket) {
13
- const client = new S3Client({ region });
14
- let hostname = '';
15
- const captureHostname = (_next) => async (args) => {
16
- if (typeof args.request === 'object' &&
17
- args.request != null &&
18
- 'hostname' in args.request &&
19
- typeof args.request['hostname'] === 'string') {
20
- hostname = args.request['hostname'];
21
- }
22
- const err = new Error('SHORT_CIRCUIT');
23
- err.name = 'SHORT_CIRCUIT';
24
- throw err; // short-circuit before auth/send
25
- };
26
- client.middlewareStack.add(captureHostname, {
27
- name: 'captureS3Hostname',
28
- step: 'build',
29
- priority: 'high', // run early in build
30
- });
31
- try {
32
- await client.send(new HeadObjectCommand({ Bucket: bucket, Key: DUMMY_KEY }));
16
+ export function findHostnameForAwsS3RegionAndBucket(region, bucket) {
17
+ if (bucket.includes('.')) {
18
+ return null;
33
19
  }
34
- catch (e) {
35
- if (typeof e !== 'object' ||
36
- e == null ||
37
- !('name' in e) ||
38
- e.name !== 'SHORT_CIRCUIT') {
39
- throw e;
40
- }
41
- }
42
- return hostname;
20
+ return `${bucket}.s3.${region}.amazonaws.com`;
43
21
  }
@@ -2,10 +2,12 @@ export declare const COLLECTION_PLACEHOLDER = "{collection}";
2
2
  export type CollectionSelectionHostSource = {
3
3
  type: 'host';
4
4
  pattern: string;
5
+ value?: string;
5
6
  };
6
7
  export type CollectionSelectionPathSource = {
7
8
  type: 'path';
8
9
  prefix: string;
10
+ value?: string;
9
11
  sticky?: 'cookie';
10
12
  };
11
13
  export type CollectionSelectionQuerySource = {
@@ -1 +1 @@
1
- {"version":3,"file":"collection-selection.d.ts","sourceRoot":"","sources":["../../../../src/models/config/collection-selection.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IAGb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,IAAI,EAAE,MAAM,CAAC;IAGb,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,CAAC,E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cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,OAAO,CAQ7G;AAGD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAsIrE;AAOD,wBAAgB,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CA6C9G;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG;IAAE,IAAI,EAAE,6BAA6B,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAqBxI"}
@@ -67,6 +67,20 @@ export function validateCollectionSelection(config) {
67
67
  return ['collectionSelection must be an object.'];
68
68
  }
69
69
  const { sources, allow, onMissing, noindex } = config;
70
+ const allowIsValid = allow === undefined ||
71
+ (Array.isArray(allow) && allow.every(x => typeof x === 'string' && ALLOW_PATTERN.test(x)));
72
+ // The value of a host or path source: a collection name that allow (if set) matches.
73
+ const checkValue = (name, value, patternField, pattern) => {
74
+ if (typeof value !== 'string' || !isValidCollectionName(value)) {
75
+ errors.push(`${name}.value must be a valid collection name. ${COLLECTION_NAME_RULE}`);
76
+ }
77
+ else if (allowIsValid && !isCollectionNameAllowed(value, allow)) {
78
+ errors.push(`${name}.value '${value}' is not in collectionSelection.allow.`);
79
+ }
80
+ if (typeof pattern === 'string' && pattern.includes(COLLECTION_PLACEHOLDER)) {
81
+ errors.push(`${name}: use ${COLLECTION_PLACEHOLDER} in ${patternField}, or value, not both.`);
82
+ }
83
+ };
70
84
  if (!Array.isArray(sources)) {
71
85
  errors.push('collectionSelection.sources must be an array.');
72
86
  }
@@ -86,9 +100,17 @@ export function validateCollectionSelection(config) {
86
100
  }
87
101
  switch (s.type) {
88
102
  case 'host': {
103
+ if (s.value !== undefined) {
104
+ checkValue(name, s.value, 'pattern', s.pattern);
105
+ if (typeof s.pattern !== 'string' ||
106
+ (!s.pattern.includes(COLLECTION_PLACEHOLDER) && !/^[a-z0-9-]+(\.[a-z0-9-]+)*$/i.test(s.pattern))) {
107
+ errors.push(`${name}.pattern must be a hostname: use only a-z, 0-9, '-', and '.'.`);
108
+ }
109
+ break;
110
+ }
89
111
  const parts = typeof s.pattern === 'string' ? splitPattern(s.pattern) : null;
90
112
  if (parts == null) {
91
- errors.push(`${name}.pattern must be a string with exactly one ${COLLECTION_PLACEHOLDER}.`);
113
+ errors.push(`${name}.pattern must be a string with exactly one ${COLLECTION_PLACEHOLDER}, or a hostname with value.`);
92
114
  }
93
115
  else if (!/^[a-z0-9.-]*$/i.test(parts.before + parts.after)) {
94
116
  errors.push(`${name}.pattern must be a hostname: use only a-z, 0-9, '-', and '.' around ${COLLECTION_PLACEHOLDER}.`);
@@ -99,14 +121,19 @@ export function validateCollectionSelection(config) {
99
121
  break;
100
122
  }
101
123
  case 'path': {
102
- const parts = typeof s.prefix === 'string' ? splitPattern(s.prefix) : null;
124
+ if (s.value !== undefined) {
125
+ checkValue(name, s.value, 'prefix', s.prefix);
126
+ }
127
+ const parts = typeof s.prefix !== 'string' ? null :
128
+ s.value !== undefined ? { before: s.prefix, after: '' } :
129
+ splitPattern(s.prefix);
103
130
  if (parts == null) {
104
- errors.push(`${name}.prefix must be a string with exactly one ${COLLECTION_PLACEHOLDER}.`);
131
+ errors.push(`${name}.prefix must be a string with exactly one ${COLLECTION_PLACEHOLDER}, or a prefix with value.`);
105
132
  }
106
133
  else if (!parts.before.startsWith('/')) {
107
134
  errors.push(`${name}.prefix must start with '/'.`);
108
135
  }
109
- else if (parts.after.endsWith('/')) {
136
+ else if ((s.value !== undefined ? parts.before : parts.after).endsWith('/')) {
110
137
  errors.push(`${name}.prefix must not end with '/'.`);
111
138
  }
112
139
  else if (/[?#]/.test(parts.before + parts.after)) {
@@ -139,6 +166,9 @@ export function validateCollectionSelection(config) {
139
166
  }
140
167
  break;
141
168
  }
169
+ if (s.value !== undefined && s.type !== 'host' && s.type !== 'path') {
170
+ errors.push(`${name}.value is only for the 'host' and 'path' sources.`);
171
+ }
142
172
  if (s.sticky !== undefined) {
143
173
  if (s.type !== 'path' && s.type !== 'query') {
144
174
  errors.push(`${name}.sticky is only for the 'path' and 'query' sources.`);
@@ -158,10 +188,8 @@ export function validateCollectionSelection(config) {
158
188
  errors.push(`sticky: 'cookie' needs a 'cookie' source in collectionSelection.sources, for the settings of the cookie.`);
159
189
  }
160
190
  }
161
- if (allow !== undefined) {
162
- if (!Array.isArray(allow) || !allow.every(x => typeof x === 'string' && ALLOW_PATTERN.test(x))) {
163
- errors.push(`collectionSelection.allow must be an array of patterns. Use a-z, 0-9, '-', and '*'.`);
164
- }
191
+ if (!allowIsValid) {
192
+ errors.push(`collectionSelection.allow must be an array of patterns. Use a-z, 0-9, '-', and '*'.`);
165
193
  }
166
194
  if (onMissing !== undefined && onMissing !== 'not-found' && onMissing !== 'default') {
167
195
  errors.push(`collectionSelection.onMissing must be 'not-found' or 'default'.`);
@@ -187,6 +215,12 @@ export function previewUrl(collectionName, baseUrl, config) {
187
215
  for (const source of config.sources) {
188
216
  switch (source.type) {
189
217
  case 'host': {
218
+ if (source.value != null) {
219
+ if (source.value === collectionName) {
220
+ return `${base.protocol}//${source.pattern.toLowerCase()}/`;
221
+ }
222
+ continue;
223
+ }
190
224
  const maxLength = maxCollectionNameLengthForHost(source.pattern);
191
225
  if (collectionName.length > maxLength) {
192
226
  throw new Error(`'${collectionName}' is too long for the host pattern '${source.pattern}': a host label has at most ${MAX_LABEL_LENGTH} characters, so the name can have at most ${maxLength}.`);
@@ -194,6 +228,12 @@ export function previewUrl(collectionName, baseUrl, config) {
194
228
  return `${base.protocol}//${source.pattern.replace(COLLECTION_PLACEHOLDER, collectionName).toLowerCase()}/`;
195
229
  }
196
230
  case 'path':
231
+ if (source.value != null) {
232
+ if (source.value === collectionName) {
233
+ return `${base.origin}${source.prefix}/`;
234
+ }
235
+ continue;
236
+ }
197
237
  return `${base.origin}${source.prefix.replace(COLLECTION_PLACEHOLDER, collectionName)}/`;
198
238
  case 'query': {
199
239
  const url = new URL('/', base);
@@ -39,6 +39,7 @@ export type PublishContentConfigNormalized = {
39
39
  includeWellKnown: boolean;
40
40
  assetInclusionTest: AssetInclusionTest | null;
41
41
  hiddenItems: string[];
42
+ hiddenItemsAsWritten: string[];
42
43
  contentCompression: ContentCompressionTypes[];
43
44
  brotliQuality: number | undefined;
44
45
  contentTypes: ContentTypeDef[];
@@ -1 +1 @@
1
- {"version":3,"file":"publish-content-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/publish-content-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,+BAA+B,EACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAEjC,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;IAIf,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,OAAO,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7B;AAID,MAAM,MAAM,wBAAwB,GAAG,OAAO,GAAG;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,kBAAkB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,KAAK,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AAE,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE,CAAC;IAIvC,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,YAAY,CAAC,EAAE,cAAc,EAAE,CAAC;IAGhC,MAAM,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9C,WAAW,EAAE,MAAM,EAAE,CAAC;IAGtB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,kBAAkB,EAAE,uBAAuB,EAAE,CAAC;IAC9C,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,cAAc,EAAE,CAAC;IAC/B,MAAM,EAAE,+BAA+B,GAAG,IAAI,CAAC;CAChD,CAAC"}
@@ -4,6 +4,7 @@ export type S3StorageConfig = {
4
4
  bucket: string;
5
5
  endpoint?: string;
6
6
  fastlyBackendName?: string;
7
+ secretStoreLinkName?: string;
7
8
  };
8
9
  export declare function getS3StorageConfigFromRc(rc: StaticPublishS3Storage): S3StorageConfig;
9
10
  //# sourceMappingURL=s3-storage-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"s3-storage-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/s3-storage-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,sBAAsB,GAAG,eAAe,CAOpF"}
1
+ {"version":3,"file":"s3-storage-config.d.ts","sourceRoot":"","sources":["../../../../src/models/config/s3-storage-config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,KAAK,sBAAsB,EAC5B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,sBAAsB,GAAG,eAAe,CAQpF"}
@@ -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,CAA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BAAsB,CA6B7E;AAED,MAAM,MAAM,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
  }
@@ -2,6 +2,8 @@ export type IndexMetadata = {
2
2
  publishedTime?: number;
3
3
  expirationTime?: number;
4
4
  requires?: string[];
5
+ fileCount?: number;
6
+ hiddenFileCount?: number;
5
7
  otherFields?: Record<string, string>;
6
8
  };
7
9
  export declare const SUPPORTED_INDEX_FEATURES: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/server/index.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAGrD,CAAC;AAIF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAqBxF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CA2BjG;AAGD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,GAAE,SAAS,MAAM,EAA6B,GAC9D,MAAM,EAAE,CAEV"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/server/index.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,aAAa,GAAG;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IAIxB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAGpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAMF,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAGrD,CAAC;AAIF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4BxF;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,aAAa,GAAG,IAAI,CAkCjG;AAGD,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,GAAE,SAAS,MAAM,EAA6B,GAC9D,MAAM,EAAE,CAEV"}
@@ -12,7 +12,7 @@ export const SUPPORTED_INDEX_FEATURES = [
12
12
  // Hidden files: index keys that start with 'hidden:'.
13
13
  HIDDEN_INDEX_FEATURE,
14
14
  ];
15
- const KNOWN_FIELDS = ['publishedTime', 'expirationTime', 'requires'];
15
+ const KNOWN_FIELDS = ['publishedTime', 'expirationTime', 'requires', 'fileCount', 'hiddenFileCount'];
16
16
  export function encodeIndexMetadata(indexMetadata) {
17
17
  const result = { ...indexMetadata.otherFields };
18
18
  if (indexMetadata.publishedTime != null && !isNaN(indexMetadata.publishedTime)) {
@@ -29,6 +29,12 @@ export function encodeIndexMetadata(indexMetadata) {
29
29
  }
30
30
  result['requires'] = indexMetadata.requires.join(',');
31
31
  }
32
+ for (const field of ['fileCount', 'hiddenFileCount']) {
33
+ const value = indexMetadata[field];
34
+ if (value != null && Number.isInteger(value) && value >= 0) {
35
+ result[field] = String(value);
36
+ }
37
+ }
32
38
  return result;
33
39
  }
34
40
  export function decodeIndexMetadata(obj) {
@@ -50,10 +56,16 @@ export function decodeIndexMetadata(obj) {
50
56
  otherFields[key] = String(value);
51
57
  }
52
58
  }
59
+ const count = (field) => {
60
+ const value = getMetadataFieldValue(obj, field);
61
+ return value != null && /^\d+$/.test(String(value)) ? Number(value) : undefined;
62
+ };
53
63
  return {
54
64
  publishedTime: !isNaN(publishedTime) ? publishedTime : undefined,
55
65
  expirationTime: !isNaN(expirationTime) ? expirationTime : undefined,
56
66
  requires: requires.length > 0 ? requires : undefined,
67
+ fileCount: count('fileCount'),
68
+ hiddenFileCount: count('hiddenFileCount'),
57
69
  otherFields,
58
70
  };
59
71
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.d.ts","sourceRoot":"","sources":["../../../src/hono/extensions.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAA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O,EAAE,sBAAsB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,sBAAsB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC;AAwBzL,wBAAgB,aAAa,CAAC,WAAW,EAAE,iBAAiB,GAAG,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAgDtH"}
@@ -26,16 +26,21 @@ const isPlainObject = (value) => typeof value === 'object' && value != null && !
26
26
  // one name with two different resources; the message names the file. Call it at
27
27
  // the top level of the app, so that an error stops the build.
28
28
  export function mergeBindings(appBindings, entries) {
29
- const merged = {};
30
- const sourceOf = {};
29
+ // Maps, so that a binding name such as 'toString' is not found on
30
+ // Object.prototype.
31
+ const merged = new Map();
32
+ const sourceOf = new Map();
31
33
  const add = (bindings, source) => {
32
34
  for (const [name, resource] of Object.entries(bindings)) {
33
- if (name in merged && merged[name] !== resource) {
34
- throw new Error(`The binding '${name}' is '${merged[name]}' in ${sourceOf[name]}, ` +
35
+ const existing = merged.get(name);
36
+ if (existing != null && existing !== resource) {
37
+ throw new Error(`The binding '${name}' is '${existing}' in ${sourceOf.get(name)}, ` +
35
38
  `but '${resource}' in ${source}. Use the same resource, or another name.`);
36
39
  }
37
- merged[name] = resource;
38
- sourceOf[name] ??= source;
40
+ merged.set(name, resource);
41
+ if (!sourceOf.has(name)) {
42
+ sourceOf.set(name, source);
43
+ }
39
44
  }
40
45
  };
41
46
  add(appBindings ?? {}, 'templateOptions.hono.bindings');
@@ -61,5 +66,5 @@ export function mergeBindings(appBindings, entries) {
61
66
  }
62
67
  add(module.bindings ?? {}, source);
63
68
  }
64
- return merged;
69
+ return Object.fromEntries(merged);
65
70
  }
@@ -2,10 +2,12 @@ export declare const COLLECTION_PLACEHOLDER = "{collection}";
2
2
  export type CollectionSelectionHostSource = {
3
3
  type: 'host';
4
4
  pattern: string;
5
+ value?: string;
5
6
  };
6
7
  export type CollectionSelectionPathSource = {
7
8
  type: 'path';
8
9
  prefix: string;
10
+ value?: string;
9
11
  sticky?: 'cookie';
10
12
  };
11
13
  export type CollectionSelectionQuerySource = {