@picked/vite-plugin-picked 0.0.1-dev.1785826066660 → 0.0.1-dev.1785908062293

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.
@@ -1,15 +1,26 @@
1
1
  /**
2
2
  * @file Dev-mode synthesis for `virtual:picked/data`.
3
3
  *
4
- * Generates a JavaScript module that fetches the project config at module-evaluation time
5
- * via top-level `await`, and resolves per-experience content with per-call API requests.
6
- * No filesystem writes; matches the customer's runtime API behaviour.
4
+ * Generates a JavaScript module exposing the project config the plugin's `config()` hook
5
+ * already fetched, and resolving per-experience content with per-call API requests. The
6
+ * config travels as a literal so module evaluation does not block on a network round trip:
7
+ * the module is reached by a dynamic `import()` from inside the SDK's `onStart` hook, and a
8
+ * top-level `await` there puts the fetch on the start-chain critical path.
9
+ *
10
+ * No filesystem writes; content behaviour matches the customer's runtime API behaviour.
7
11
  */
12
+ import type { ProjectConfig } from '@picked/client/plugins/dynamic-experiences';
8
13
  interface DevVirtualModuleOptions {
9
14
  /** Absolute API base URL (e.g. `https://api.picked.app`). */
10
15
  apiUrl: string;
11
16
  /** Picked project ID to fetch. */
12
17
  projectId: string;
18
+ /**
19
+ * The config the plugin's `config()` hook fetched, inlined into the module. `null` when
20
+ * that fetch failed, which keeps the runtime fetch so a dev server started before the API
21
+ * was reachable still recovers once it comes up.
22
+ */
23
+ projectConfig: ProjectConfig | null;
13
24
  }
14
25
  /**
15
26
  * Synthesises the source code for the dev-mode `virtual:picked/data` module.
@@ -18,7 +29,7 @@ interface DevVirtualModuleOptions {
18
29
  * @returns {string} JavaScript source as a string for Vite's `load` hook.
19
30
  * @example
20
31
  * ```typescript
21
- * const src = devVirtualModuleSource({ apiUrl: 'https://api.picked.app', projectId: 'p_1' })
32
+ * const src = devVirtualModuleSource({ apiUrl: 'https://api.picked.app', projectId: 'p_1', projectConfig })
22
33
  * ```
23
34
  */
24
35
  export declare function devVirtualModuleSource(options: DevVirtualModuleOptions): string;
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/virtual-module/dev.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,UAAU,uBAAuB;IAC/B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAuB/E"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/virtual-module/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAA;AAE/E,UAAU,uBAAuB;IAC/B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,aAAa,EAAE,aAAa,GAAG,IAAI,CAAA;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CA+B/E"}
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@picked/vite-plugin-picked",
3
3
  "description": "Vite plugin for build-time config injection",
4
- "version": "0.0.1-dev.1785826066660",
4
+ "version": "0.0.1-dev.1785908062293",
5
5
  "dependencies": {
6
- "@picked/client": "0.0.1-dev.1785826066660"
6
+ "@picked/client": "0.0.1-dev.1785908062293"
7
7
  },
8
8
  "devDependencies": {
9
9
  "@repo/eslint-config": "workspace:*",