@picked/vite-plugin-picked 0.0.1-dev.1788925875333 → 0.0.45-next.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.
- package/dist/cjs/index.js +1 -917
- package/dist/esm/index.js +24 -781
- package/dist/types/index.d.ts +10 -47
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +21 -32
- package/client.d.ts +0 -26
- package/dist/.tsbuildinfo +0 -1
- package/dist/types/gitignore.d.ts +0 -16
- package/dist/types/gitignore.d.ts.map +0 -1
- package/dist/types/launcher.d.ts +0 -12
- package/dist/types/launcher.d.ts.map +0 -1
- package/dist/types/log.d.ts +0 -21
- package/dist/types/log.d.ts.map +0 -1
- package/dist/types/middleware.d.ts +0 -3
- package/dist/types/middleware.d.ts.map +0 -1
- package/dist/types/prefetch.d.ts +0 -74
- package/dist/types/prefetch.d.ts.map +0 -1
- package/dist/types/retry.d.ts +0 -56
- package/dist/types/retry.d.ts.map +0 -1
- package/dist/types/telemetry.d.ts +0 -44
- package/dist/types/telemetry.d.ts.map +0 -1
- package/dist/types/util.d.ts +0 -34
- package/dist/types/util.d.ts.map +0 -1
- package/dist/types/virtual-module/api.d.ts +0 -17
- package/dist/types/virtual-module/api.d.ts.map +0 -1
- package/dist/types/virtual-module/build.d.ts +0 -33
- package/dist/types/virtual-module/build.d.ts.map +0 -1
- package/dist/types/virtual-module/dev.d.ts +0 -39
- package/dist/types/virtual-module/dev.d.ts.map +0 -1
package/dist/types/log.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
2
|
-
declare function setLevel(level: LogLevel): void;
|
|
3
|
-
declare function banner(): void;
|
|
4
|
-
export declare const log: {
|
|
5
|
-
banner: typeof banner;
|
|
6
|
-
debug: ((message: string, payload?: unknown, namespace?: string) => void) & {
|
|
7
|
-
once(message: string, payload?: unknown, namespace?: string): void;
|
|
8
|
-
};
|
|
9
|
-
info: ((message: string, payload?: unknown, namespace?: string) => void) & {
|
|
10
|
-
once(message: string, payload?: unknown, namespace?: string): void;
|
|
11
|
-
};
|
|
12
|
-
warn: ((message: string, payload?: unknown, namespace?: string) => void) & {
|
|
13
|
-
once(message: string, payload?: unknown, namespace?: string): void;
|
|
14
|
-
};
|
|
15
|
-
error: ((message: string, payload?: unknown, namespace?: string) => void) & {
|
|
16
|
-
once(message: string, payload?: unknown, namespace?: string): void;
|
|
17
|
-
};
|
|
18
|
-
setLevel: typeof setLevel;
|
|
19
|
-
};
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=log.d.ts.map
|
package/dist/types/log.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/log.ts"],"names":[],"mappings":"AAcA,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AA8E9D,iBAAS,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAWvC;AAKD,iBAAS,MAAM,IAAI,IAAI,CAStB;AAED,eAAO,MAAM,GAAG;;sBA3CF,MAAM,YAAY,OAAO,cAAc,MAAM,KAAG,IAAI;sBAI9C,MAAM,YAAY,OAAO,cAAc,MAAM,GAAG,IAAI;;;;;;;;;;;;CA8CvE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAEnC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAoBxF"}
|
package/dist/types/prefetch.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { type ProjectConfig } from '@picked/delivery-api-client';
|
|
2
|
-
interface ManifestExperienceEntry {
|
|
3
|
-
id: string;
|
|
4
|
-
fetchedAt: string;
|
|
5
|
-
}
|
|
6
|
-
interface PickedManifest {
|
|
7
|
-
version: number;
|
|
8
|
-
fetchedAt: string;
|
|
9
|
-
projectVersionId: string;
|
|
10
|
-
workspaceId: string;
|
|
11
|
-
projectId: string;
|
|
12
|
-
experiences: ManifestExperienceEntry[];
|
|
13
|
-
}
|
|
14
|
-
interface PrefetchPaths {
|
|
15
|
-
/** Absolute path to `<root>/.picked/`. */
|
|
16
|
-
pickedDir: string;
|
|
17
|
-
/** Absolute path to `<root>/.picked/manifest.json`. */
|
|
18
|
-
manifestPath: string;
|
|
19
|
-
/** Absolute path to `<root>/.picked/project-config.json`. */
|
|
20
|
-
projectConfigPath: string;
|
|
21
|
-
/** Absolute path to `<root>/.picked/experiences/`. */
|
|
22
|
-
experiencesDir: string;
|
|
23
|
-
}
|
|
24
|
-
interface PrefetchResult {
|
|
25
|
-
config: ProjectConfig;
|
|
26
|
-
manifest: PickedManifest;
|
|
27
|
-
/** Map of experience id → absolute path to its `<id>.json`. */
|
|
28
|
-
experienceContentPaths: Record<string, string>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Resolves the artefact paths under `<root>/.picked/`.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} projectRoot - Vite project root (typically `process.cwd()`).
|
|
34
|
-
* @returns {PrefetchPaths} Absolute paths under `.picked/`.
|
|
35
|
-
* @example
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const paths = resolvePrefetchPaths(process.cwd())
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare function resolvePrefetchPaths(projectRoot: string): PrefetchPaths;
|
|
41
|
-
interface RunPrefetchOptions {
|
|
42
|
-
apiUrl: string;
|
|
43
|
-
projectId: string;
|
|
44
|
-
projectRoot: string;
|
|
45
|
-
/** HTTP headers to forward with every fetch (e.g. `Picked-Client`, `Picked-Version`). */
|
|
46
|
-
headers: Record<string, string>;
|
|
47
|
-
/** Workspace preview token; when set, fetches the draft workspace instead of the live one. */
|
|
48
|
-
previewToken?: string;
|
|
49
|
-
/** When the existing manifest matches the API's versionId+workspaceId, skip per-experience fetches. */
|
|
50
|
-
reuseWhenUnchanged?: boolean;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Runs the full build-mode prefetch: fetches project config, walks CMS-using experiences,
|
|
54
|
-
* fetches each one's content, writes all artefacts under `<root>/.picked/`, and replaces
|
|
55
|
-
* `manifest.json` in full so stale entries cannot accumulate.
|
|
56
|
-
*
|
|
57
|
-
* Hard-fails on any API failure (non-2xx response or network error). Customers shipping
|
|
58
|
-
* with the Vite plugin must ship from a known-good snapshot or not at all.
|
|
59
|
-
*
|
|
60
|
-
* When `reuseWhenUnchanged` is true and the existing manifest's `versionId` + `workspaceId`
|
|
61
|
-
* match the freshly-fetched project config, per-experience fetches are skipped and the
|
|
62
|
-
* existing JSON files are left in place. The manifest is left unchanged.
|
|
63
|
-
*
|
|
64
|
-
* @param {RunPrefetchOptions} options - Prefetch configuration.
|
|
65
|
-
* @returns {Promise<PrefetchResult>} The fetched config, manifest, and content-path map.
|
|
66
|
-
* @throws {Error} When any API request fails or returns malformed data.
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* const result = await runPrefetch({ apiUrl, projectId, projectRoot: cwd, headers })
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare function runPrefetch(options: RunPrefetchOptions): Promise<PrefetchResult>;
|
|
73
|
-
export {};
|
|
74
|
-
//# sourceMappingURL=prefetch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prefetch.d.ts","sourceRoot":"","sources":["../../src/prefetch.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAA;AAepC,UAAU,uBAAuB;IAC/B,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,uBAAuB,EAAE,CAAA;CACvC;AAED,UAAU,aAAa;IACrB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAA;IACpB,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAA;IACzB,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,aAAa,CAAA;IACrB,QAAQ,EAAE,cAAc,CAAA;IACxB,+DAA+D;IAC/D,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/C;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAQvE;AAsFD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,yFAAyF;IACzF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAuEtF"}
|
package/dist/types/retry.d.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file URL-driven retry helper for the build- and dev-mode project-config fetch.
|
|
3
|
-
*
|
|
4
|
-
* Retries are auto-enabled when the configured `apiUrl` points at a host where
|
|
5
|
-
* deploys can race ahead of the API: `localhost`/`127.0.0.1`/`::1` for local
|
|
6
|
-
* development, or any `*.picked.app` host EXCEPT the canonical production host
|
|
7
|
-
* `api.picked.app`. Production and external customer hosts continue to fail fast.
|
|
8
|
-
*
|
|
9
|
-
* The retry schedule is hardcoded — there is no public option. The behavior is
|
|
10
|
-
* an internal deploy-ordering workaround for the Picked monorepo and is not
|
|
11
|
-
* intended for tuning by external SDK consumers.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Whether build- and dev-mode project-config fetches against `apiUrl` should be
|
|
15
|
-
* retried with exponential backoff. True for hosts where the API may briefly
|
|
16
|
-
* be unreachable while a deploy is propagating; false for the canonical
|
|
17
|
-
* production host and every external host.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} apiUrl - The configured API base URL.
|
|
20
|
-
* @returns {boolean} `true` when retries should be attempted, `false` otherwise.
|
|
21
|
-
* @example
|
|
22
|
-
* shouldRetryUrl('http://localhost:54321') // true
|
|
23
|
-
* shouldRetryUrl('https://picked-api-git-foo.picked.app') // true
|
|
24
|
-
* shouldRetryUrl('https://api.picked.app') // false
|
|
25
|
-
*/
|
|
26
|
-
export declare function shouldRetryUrl(apiUrl: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Run `fetchFn` once. If it returns `null` OR throws, retry up to 6 times with
|
|
29
|
-
* exponential backoff (5s → 10s → 20s → 40s → 80s → 160s, ~315 s worst-case wall time).
|
|
30
|
-
*
|
|
31
|
-
* Both thrown errors AND `null` returns are eligible for retry — the SDK's
|
|
32
|
-
* `fetchProject` and `fetchExperienceContent` swallow network errors and return
|
|
33
|
-
* `null`, so retrying only on throws would do nothing useful for the typical
|
|
34
|
-
* "API not yet up" failure mode. If every attempt fails, the most recent thrown
|
|
35
|
-
* error is rethrown; if every attempt simply returned `null`, `null` is returned
|
|
36
|
-
* so the caller can produce its own diagnostic.
|
|
37
|
-
*
|
|
38
|
-
* `onRetry` is invoked once per retry, before the corresponding backoff sleep,
|
|
39
|
-
* with the 1-indexed attempt number, the total retry budget, and the upcoming
|
|
40
|
-
* delay in ms. The callback is the only place log lines are produced — callers
|
|
41
|
-
* own the phrasing and any contextual prefix.
|
|
42
|
-
*
|
|
43
|
-
* @template T - Type of the value resolved by the fetch operation.
|
|
44
|
-
* @param {() => Promise<T | null>} fetchFn - The async fetch operation to run.
|
|
45
|
-
* @param {(attempt: number, totalAttempts: number, nextDelayMs: number) => void} onRetry -
|
|
46
|
-
* Hook invoked before each backoff sleep.
|
|
47
|
-
* @returns {Promise<T | null>} The first non-null result, or `null` after all retries are exhausted.
|
|
48
|
-
* @throws {Error} The last thrown error when every attempt threw.
|
|
49
|
-
* @example
|
|
50
|
-
* const config = await withRetry(
|
|
51
|
-
* () => fetchProject(apiUrl, projectId, { headers }),
|
|
52
|
-
* (attempt, total, ms) => log.info(`retrying in ${ms}ms (${attempt}/${total})`),
|
|
53
|
-
* )
|
|
54
|
-
*/
|
|
55
|
-
export declare function withRetry<T>(fetchFn: () => Promise<T | null>, onRetry: (attempt: number, totalAttempts: number, nextDelayMs: number) => void): Promise<T | null>;
|
|
56
|
-
//# sourceMappingURL=retry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/retry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAsBtD;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAC/B,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,EAChC,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,GAC7E,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CA+BnB"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
import { type SpanAttributes } from '@picked/telemetry';
|
|
3
|
-
/** Collects hook timings and sends them when the build ends. */
|
|
4
|
-
export interface BuildTelemetry {
|
|
5
|
-
/** Records one hook invocation. */
|
|
6
|
-
record: (hook: string, durationMs: number) => void;
|
|
7
|
-
/** Sends everything collected. Always resolves. */
|
|
8
|
-
flush: (attributes: SpanAttributes) => Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Creates a telemetry collector for one build.
|
|
12
|
-
*
|
|
13
|
-
* @param {string} traceId - Trace all of this build's spans belong to.
|
|
14
|
-
* @returns {BuildTelemetry} A collector bound to that trace.
|
|
15
|
-
* @example const telemetry = createBuildTelemetry(createTraceId())
|
|
16
|
-
*/
|
|
17
|
-
export declare function createBuildTelemetry(traceId?: string): BuildTelemetry;
|
|
18
|
-
/**
|
|
19
|
-
* Wraps a hook so its duration is recorded, preserving its return value.
|
|
20
|
-
*
|
|
21
|
-
* @template Args - The hook's argument tuple.
|
|
22
|
-
* @template Result - What the hook returns.
|
|
23
|
-
* @param {string} hook - The hook's name.
|
|
24
|
-
* @param {(...args: Args) => Result} handler - The original hook.
|
|
25
|
-
* @param {BuildTelemetry} telemetry - Where to record the timing.
|
|
26
|
-
* @returns {(...args: Args) => Result} The wrapped hook.
|
|
27
|
-
* @example instrumentHook('config', original, telemetry)
|
|
28
|
-
*/
|
|
29
|
-
export declare function instrumentHook<Args extends unknown[], Result>(hook: string, handler: (...args: Args) => Result, telemetry: BuildTelemetry): (...args: Args) => Result;
|
|
30
|
-
/**
|
|
31
|
-
* Wraps every hook on the plugin so its duration is recorded.
|
|
32
|
-
*
|
|
33
|
-
* Applied to the whole object, so a hook added later is covered automatically.
|
|
34
|
-
* Vite accepts a hook as a function or as `{ order, handler }`, and both shapes
|
|
35
|
-
* are handled. Hooks are mutated in place and never bound, so Rollup's plugin
|
|
36
|
-
* context reaches them as `this`.
|
|
37
|
-
*
|
|
38
|
-
* @param {BuildTelemetry | null} telemetry - Collector, or `null` when telemetry is off.
|
|
39
|
-
* @param {Plugin} plugin - The plugin object to wrap.
|
|
40
|
-
* @returns {Plugin} The same plugin, with its hooks instrumented.
|
|
41
|
-
* @example instrumentPlugin(telemetry, { name: 'picked', config: async () => {} })
|
|
42
|
-
*/
|
|
43
|
-
export declare function instrumentPlugin(telemetry: BuildTelemetry | null, plugin: Plugin): Plugin;
|
|
44
|
-
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,EAKL,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAA;AAW1B,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAA;IAClD,mDAAmD;IACnD,KAAK,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,SAAkB,GAAG,cAAc,CA+D9E;AAaD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM,EAC3D,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,EAClC,SAAS,EAAE,cAAc,GACxB,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,MAAM,CA4B3B;AAgBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,cAAc,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAwBzF"}
|
package/dist/types/util.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Shared utilities for the Picked Vite plugin: a defensive helper for API
|
|
3
|
-
* entity arrays that may be omitted at runtime despite being typed as required,
|
|
4
|
-
* and the console rendering of a feature's traffic split.
|
|
5
|
-
*/
|
|
6
|
-
import type { ProjectConfigFeature } from '@picked/delivery-api-client';
|
|
7
|
-
/**
|
|
8
|
-
* Safely coerce a value to an array, returning an empty array for nullish inputs.
|
|
9
|
-
* Needed because the API response may omit entity arrays at runtime even though
|
|
10
|
-
* the TypeScript type marks them as required.
|
|
11
|
-
*
|
|
12
|
-
* @template T - The element type of the array.
|
|
13
|
-
* @param {ReadonlyArray<T> | null | undefined} value - The value to coerce.
|
|
14
|
-
* @returns {ReadonlyArray<T>} The original array, or an empty array if the input is nullish.
|
|
15
|
-
* @example
|
|
16
|
-
* toArray(undefined) // []
|
|
17
|
-
*/
|
|
18
|
-
export declare function toArray<T>(value: ReadonlyArray<T> | null | undefined): ReadonlyArray<T>;
|
|
19
|
-
/**
|
|
20
|
-
* Renders a feature's traffic split for the dev-server console.
|
|
21
|
-
*
|
|
22
|
-
* A boolean feature reports `weight`, which is already a percentage. A text feature
|
|
23
|
-
* reports each arm against the total of the arms, since an arm's `weight` is a share
|
|
24
|
-
* relative to its siblings: `1` against `1, 2` is a quarter of the traffic.
|
|
25
|
-
*
|
|
26
|
-
* A feature whose arms are absent or all weigh zero reports its own weight.
|
|
27
|
-
*
|
|
28
|
-
* @param {ProjectConfigFeature} feature - The feature to describe.
|
|
29
|
-
* @returns {string} The split, as a percentage or a comma-separated list of arms.
|
|
30
|
-
* @example
|
|
31
|
-
* formatFeatureSplit({ valueType: 'text', variants: [{ key: 'a', value: 'a', weight: 1 }] })
|
|
32
|
-
*/
|
|
33
|
-
export declare function formatFeatureSplit(feature: ProjectConfigFeature): string;
|
|
34
|
-
//# sourceMappingURL=util.d.ts.map
|
package/dist/types/util.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAEvE;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,CAEvF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAcxE"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Synthesis for `virtual:picked/data` when the plugin runs with `mode: 'api'`.
|
|
3
|
-
*
|
|
4
|
-
* The module resolves, so an import a consumer wrote by hand still builds. It exports only
|
|
5
|
-
* `manifestMetadata`, so the SDK's shape guard refuses it and every read stays on the API path.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Synthesises the source for the `mode: 'api'` `virtual:picked/data` module.
|
|
9
|
-
*
|
|
10
|
-
* @returns {string} JavaScript source as a string for Vite's `load` hook.
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const src = apiModeVirtualModuleSource()
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare function apiModeVirtualModuleSource(): string;
|
|
17
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/virtual-module/api.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAQnD"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Build-mode synthesis for `virtual:picked/data`.
|
|
3
|
-
*
|
|
4
|
-
* Generates a JavaScript module that statically imports the prefetched project config
|
|
5
|
-
* (so it's bundled into the customer's main chunk) and lazily imports each experience's
|
|
6
|
-
* content JSON on demand.
|
|
7
|
-
*/
|
|
8
|
-
interface BuildVirtualModuleOptions {
|
|
9
|
-
/** Absolute path to `<root>/.picked/project-config.json`. */
|
|
10
|
-
projectConfigPath: string;
|
|
11
|
-
/** Map of experience id → absolute path to its content JSON file. */
|
|
12
|
-
experienceContentPaths: Record<string, string>;
|
|
13
|
-
/** Manifest metadata that the synthesised module re-exports as `manifestMetadata`. */
|
|
14
|
-
manifestMetadata: {
|
|
15
|
-
mode: 'build';
|
|
16
|
-
fetchedAt: string | null;
|
|
17
|
-
projectVersionId: string | null;
|
|
18
|
-
workspaceId: string | null;
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Synthesises the source code for the build-mode `virtual:picked/data` module.
|
|
23
|
-
*
|
|
24
|
-
* @param {BuildVirtualModuleOptions} options - Build-mode synthesis inputs.
|
|
25
|
-
* @returns {string} JavaScript source as a string for Vite's `load` hook.
|
|
26
|
-
* @example
|
|
27
|
-
* ```typescript
|
|
28
|
-
* const src = buildVirtualModuleSource({ projectConfigPath, experienceContentPaths, manifestMetadata })
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export declare function buildVirtualModuleSource(options: BuildVirtualModuleOptions): string;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/virtual-module/build.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,UAAU,yBAAyB;IACjC,6DAA6D;IAC7D,iBAAiB,EAAE,MAAM,CAAA;IACzB,qEAAqE;IACrE,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC9C,sFAAsF;IACtF,gBAAgB,EAAE;QAChB,IAAI,EAAE,OAAO,CAAA;QACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;QACxB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;QAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAC3B,CAAA;CACF;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAoCnF"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Dev-mode synthesis for `virtual:picked/data`.
|
|
3
|
-
*
|
|
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.
|
|
11
|
-
*/
|
|
12
|
-
import type { ProjectConfig } from '@picked/client/plugins/dynamic-experiences';
|
|
13
|
-
interface DevVirtualModuleOptions {
|
|
14
|
-
/** Absolute API base URL (e.g. `https://api.picked.app`). */
|
|
15
|
-
apiUrl: string;
|
|
16
|
-
/** Picked project ID to fetch. */
|
|
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;
|
|
24
|
-
/** Workspace preview token; when set, fetches the draft workspace instead of the live one. */
|
|
25
|
-
previewToken?: string;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Synthesises the source code for the dev-mode `virtual:picked/data` module.
|
|
29
|
-
*
|
|
30
|
-
* @param {DevVirtualModuleOptions} options - Dev-mode synthesis inputs.
|
|
31
|
-
* @returns {string} JavaScript source as a string for Vite's `load` hook.
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* const src = devVirtualModuleSource({ apiUrl: 'https://api.picked.app', projectId: 'p_1', projectConfig })
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
export declare function devVirtualModuleSource(options: DevVirtualModuleOptions): string;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=dev.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;IACnC,8FAA8F;IAC9F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAuC/E"}
|