@picked/vite-plugin-picked 0.0.1-dev.1786065500148 → 0.0.1-dev.1786072899095
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/.tsbuildinfo +1 -1
- package/dist/cjs/index.js +11 -22
- package/dist/esm/index.js +173 -243
- package/dist/types/index.d.ts +0 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/prefetch.d.ts.map +1 -1
- package/dist/types/virtual-module/build.d.ts.map +1 -1
- package/dist/types/virtual-module/dev.d.ts +4 -15
- package/dist/types/virtual-module/dev.d.ts.map +1 -1
- package/package.json +2 -6
- package/client.d.ts +0 -26
- package/dist/types/virtual-module/api.d.ts +0 -18
- package/dist/types/virtual-module/api.d.ts.map +0 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -6,18 +6,6 @@ export interface PickedPluginOptions {
|
|
|
6
6
|
apiUrl?: string;
|
|
7
7
|
/** Disable the launcher HTML page (dev server + build output). Defaults to false. */
|
|
8
8
|
disableLauncher?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Whether this build carries Picked data. Defaults to `'bundle'`.
|
|
11
|
-
*
|
|
12
|
-
* `'bundle'` prefetches the project config and each experience's content, writes `.picked/`, and
|
|
13
|
-
* emits a module that registers itself with the SDK. `'api'` skips the prefetch altogether —
|
|
14
|
-
* no build-time dependency on the Picked API and no `.picked/` directory — and emits a module
|
|
15
|
-
* the SDK's shape guard refuses, which leaves every read on the API path.
|
|
16
|
-
*
|
|
17
|
-
* This belongs to the build rather than to the SDK: only the build can decide whether data is
|
|
18
|
-
* available to embed, and the SDK reads the answer from whether anything registered.
|
|
19
|
-
*/
|
|
20
|
-
mode?: 'bundle' | 'api';
|
|
21
9
|
}
|
|
22
10
|
/**
|
|
23
11
|
* Vite plugin that fetches Picked project config + per-experience CMS content at build time
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAsIlC,MAAM,WAAW,mBAAmB;IAClC,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qFAAqF;IACrF,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CA2I3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetch.d.ts","sourceRoot":"","sources":["../../src/prefetch.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,4CAA4C,CAAA;AAQnD,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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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,uGAAuG;IACvG,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC,CAiDtF"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,CAiCnF"}
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file Dev-mode synthesis for `virtual:picked/data`.
|
|
3
3
|
*
|
|
4
|
-
* Generates a JavaScript module
|
|
5
|
-
*
|
|
6
|
-
*
|
|
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.
|
|
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.
|
|
11
7
|
*/
|
|
12
|
-
import type { ProjectConfig } from '@picked/client/plugins/dynamic-experiences';
|
|
13
8
|
interface DevVirtualModuleOptions {
|
|
14
9
|
/** Absolute API base URL (e.g. `https://api.picked.app`). */
|
|
15
10
|
apiUrl: string;
|
|
16
11
|
/** Picked project ID to fetch. */
|
|
17
12
|
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
13
|
}
|
|
25
14
|
/**
|
|
26
15
|
* Synthesises the source code for the dev-mode `virtual:picked/data` module.
|
|
@@ -29,7 +18,7 @@ interface DevVirtualModuleOptions {
|
|
|
29
18
|
* @returns {string} JavaScript source as a string for Vite's `load` hook.
|
|
30
19
|
* @example
|
|
31
20
|
* ```typescript
|
|
32
|
-
* const src = devVirtualModuleSource({ apiUrl: 'https://api.picked.app', projectId: 'p_1'
|
|
21
|
+
* const src = devVirtualModuleSource({ apiUrl: 'https://api.picked.app', projectId: 'p_1' })
|
|
33
22
|
* ```
|
|
34
23
|
*/
|
|
35
24
|
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
|
|
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"}
|
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.
|
|
4
|
+
"version": "0.0.1-dev.1786072899095",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@picked/client": "0.0.1-dev.
|
|
6
|
+
"@picked/client": "0.0.1-dev.1786072899095"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@repo/eslint-config": "workspace:*",
|
|
@@ -21,13 +21,9 @@
|
|
|
21
21
|
"import": "./dist/esm/index.js",
|
|
22
22
|
"require": "./dist/cjs/index.js",
|
|
23
23
|
"default": "./dist/esm/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./client": {
|
|
26
|
-
"types": "./client.d.ts"
|
|
27
24
|
}
|
|
28
25
|
},
|
|
29
26
|
"files": [
|
|
30
|
-
"client.d.ts",
|
|
31
27
|
"dist"
|
|
32
28
|
],
|
|
33
29
|
"knip": {
|
package/client.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Ambient declaration for `virtual:picked/data`, the module this plugin registers.
|
|
3
|
-
*
|
|
4
|
-
* Reference it from a consuming project to type an import of the module:
|
|
5
|
-
*
|
|
6
|
-
* ```jsonc
|
|
7
|
-
* // tsconfig.json
|
|
8
|
-
* { "compilerOptions": { "types": ["@picked/vite-plugin-picked/client"] } }
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* ```typescript
|
|
12
|
-
* /// <reference types="@picked/vite-plugin-picked/client" />
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* A project imports the module to hand it to the SDK — `createPickedDataProvider({ bundle })`
|
|
16
|
-
* or `dynamicExperiencesPlugin({ bundle })` — which skips the SDK's dynamic import and places
|
|
17
|
-
* the module in the importer's chunk, since a module that is both statically and dynamically
|
|
18
|
-
* imported is placed in the static chunk.
|
|
19
|
-
*/
|
|
20
|
-
declare module 'virtual:picked/data' {
|
|
21
|
-
import type { VirtualPickedData } from '@picked/client/plugins/dynamic-experiences'
|
|
22
|
-
|
|
23
|
-
export const projectConfig: VirtualPickedData['projectConfig']
|
|
24
|
-
export const experienceContent: VirtualPickedData['experienceContent']
|
|
25
|
-
export const manifestMetadata: VirtualPickedData['manifestMetadata']
|
|
26
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Synthesis for `virtual:picked/data` when the plugin runs with `mode: 'api'`.
|
|
3
|
-
*
|
|
4
|
-
* The module still resolves, so an import a consumer wrote by hand does not break the build. It
|
|
5
|
-
* carries neither `projectConfig` nor `experienceContent`, so the SDK's shape guard refuses it
|
|
6
|
-
* and every read stays on the API path — the absence of a registration is the whole signal.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Synthesises the source for the `mode: 'api'` `virtual:picked/data` module.
|
|
10
|
-
*
|
|
11
|
-
* @returns {string} JavaScript source as a string for Vite's `load` hook.
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const src = apiModeVirtualModuleSource()
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export declare function apiModeVirtualModuleSource(): string;
|
|
18
|
-
//# 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;;;;;;GAMG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,IAAI,MAAM,CAQnD"}
|