@vercel/flags-core 1.10.1 → 1.10.2

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.
@@ -576,7 +576,7 @@ function bulkEvaluate(flags, shared) {
576
576
  }
577
577
 
578
578
  // package.json
579
- var version = "1.10.1";
579
+ var version = "1.10.2";
580
580
 
581
581
  // src/lib/report-value.ts
582
582
  function internalReportValue(key, value, data) {
@@ -1104,7 +1104,7 @@ function unauthorizedMessage(sourceProjectId) {
1104
1104
  if (!sourceProjectId) {
1105
1105
  return "unauthorized (401)";
1106
1106
  }
1107
- return `unauthorized (401): this deployment is not allowed to read the flags of project "${sourceProjectId}". Check that the project is connected.`;
1107
+ return `unauthorized (401): this deployment is not allowed to read the flags of project "${sourceProjectId}". Check that the project is connected. See https://vercel.com/docs/flags/vercel-flags/project-connections`;
1108
1108
  }
1109
1109
  async function getOidcToken() {
1110
1110
  try {
@@ -1159,13 +1159,24 @@ var Authentication = class {
1159
1159
  }
1160
1160
  return await getOidcToken();
1161
1161
  }
1162
- async resolveBundledDefinitionsLookup() {
1162
+ getStaticBundledDefinitionsLookup() {
1163
1163
  if (this.sdkKey) {
1164
1164
  return { type: "sdk-key", sdkKey: this.sdkKey };
1165
1165
  }
1166
1166
  if (this.sourceProjectId) {
1167
1167
  return { type: "project-id", projectId: this.sourceProjectId };
1168
1168
  }
1169
+ const projectId = process.env.VERCEL_PROJECT_ID;
1170
+ if (projectId) {
1171
+ return { type: "project-id", projectId };
1172
+ }
1173
+ return void 0;
1174
+ }
1175
+ async resolveBundledDefinitionsLookup() {
1176
+ const lookup = this.getStaticBundledDefinitionsLookup();
1177
+ if (lookup) {
1178
+ return lookup;
1179
+ }
1169
1180
  const oidcToken = await this.resolveToken();
1170
1181
  return {
1171
1182
  type: "project-id",
@@ -1675,6 +1686,13 @@ var BundledSource = class {
1675
1686
  }
1676
1687
  return void 0;
1677
1688
  }
1689
+ /**
1690
+ * Starts reading bundled definitions without waiting for the result.
1691
+ */
1692
+ preload() {
1693
+ this.getResult().catch(() => {
1694
+ });
1695
+ }
1678
1696
  getResult() {
1679
1697
  if (!this.promise) {
1680
1698
  this.promise = this.options.readBundledDefinitions(this.options.auth);
@@ -2870,6 +2888,9 @@ var Controller = class {
2870
2888
  auth: this.options.auth,
2871
2889
  readBundledDefinitions
2872
2890
  });
2891
+ if (!this.options.datafile && this.options.auth.getStaticBundledDefinitionsLookup()) {
2892
+ this.bundledSource.preload();
2893
+ }
2873
2894
  this.wireSourceEvents();
2874
2895
  if (this.options.datafile) {
2875
2896
  this.cache.seed(tagData({ ...this.options.datafile }, "provided"));
@@ -3745,4 +3766,4 @@ export {
3745
3766
  resetDefaultFlagsClient,
3746
3767
  createClient
3747
3768
  };
3748
- //# sourceMappingURL=chunk-CAVQRHGX.js.map
3769
+ //# sourceMappingURL=chunk-LGS6CVED.js.map