@picked/vite-plugin-picked 0.0.1-dev.1771901344537
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 -0
- package/dist/esm/index.js +20 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@picked/client/plugins/dynamic-experiences"),n="https://api.picked.app",r="__PICKED_PROJECT_CONFIG__";function o(e){const c=e.apiUrl??n;return{name:"picked",config:async()=>{const t=await i.fetchProject(c,e.projectId);if(t)return{define:{[r]:JSON.stringify(t)}}}}}exports.picked=o;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { fetchProject as n } from "@picked/client/plugins/dynamic-experiences";
|
|
2
|
+
const r = "https://api.picked.app", e = "__PICKED_PROJECT_CONFIG__";
|
|
3
|
+
function o(t) {
|
|
4
|
+
const i = t.apiUrl ?? r;
|
|
5
|
+
return {
|
|
6
|
+
name: "picked",
|
|
7
|
+
config: async () => {
|
|
8
|
+
const c = await n(i, t.projectId);
|
|
9
|
+
if (c)
|
|
10
|
+
return {
|
|
11
|
+
define: {
|
|
12
|
+
[e]: JSON.stringify(c)
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
o as picked
|
|
20
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
export interface PickedPluginOptions {
|
|
3
|
+
/** The Picked project ID */
|
|
4
|
+
projectId: string;
|
|
5
|
+
/** Custom API URL (defaults to https://api.picked.app) */
|
|
6
|
+
apiUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Vite plugin that fetches Picked project config at build time
|
|
10
|
+
* and injects it via `define`, eliminating the runtime API request.
|
|
11
|
+
*
|
|
12
|
+
* When a preview token is present at runtime, the SDK will still
|
|
13
|
+
* fetch fresh config from the API, ignoring the build-time value.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { picked } from '@picked/vite-plugin-picked'
|
|
18
|
+
*
|
|
19
|
+
* export default defineConfig({
|
|
20
|
+
* plugins: [
|
|
21
|
+
* picked({ projectId: 'your-project-id' })
|
|
22
|
+
* ]
|
|
23
|
+
* })
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function picked(options: PickedPluginOptions): Plugin;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAKlC,MAAM,WAAW,mBAAmB;IAClC,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAmB3D"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@picked/vite-plugin-picked",
|
|
3
|
+
"description": "Vite plugin for build-time config injection",
|
|
4
|
+
"version": "0.0.1-dev.1771901344537",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@picked/client": "0.0.1-dev.1771901344537"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@repo/eslint-config": "workspace:*",
|
|
10
|
+
"@repo/typescript-config": "workspace:*",
|
|
11
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
12
|
+
"@types/node": "^22",
|
|
13
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
14
|
+
"tsx": "^4.20.3",
|
|
15
|
+
"vite": "^7.3.1",
|
|
16
|
+
"vite-plugin-dts": "^4.5.4",
|
|
17
|
+
"vitest": "^4.0.17"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/types/index.d.ts",
|
|
22
|
+
"import": "./dist/esm/index.js",
|
|
23
|
+
"require": "./dist/cjs/index.js",
|
|
24
|
+
"default": "./dist/esm/index.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"knip": {
|
|
31
|
+
"ignoreBinaries": [
|
|
32
|
+
"knip",
|
|
33
|
+
"jscpd",
|
|
34
|
+
"eslint",
|
|
35
|
+
"tsc",
|
|
36
|
+
"attw"
|
|
37
|
+
],
|
|
38
|
+
"ignoreDependencies": [
|
|
39
|
+
"@picked/client",
|
|
40
|
+
"@repo/eslint-config",
|
|
41
|
+
"@repo/typescript-config"
|
|
42
|
+
],
|
|
43
|
+
"ignore": [
|
|
44
|
+
"eslint.config.js"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"main": "./dist/cjs/index.js",
|
|
48
|
+
"module": "./dist/esm/index.js",
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"vite": "^7.3.1"
|
|
51
|
+
},
|
|
52
|
+
"private": false,
|
|
53
|
+
"scripts": {
|
|
54
|
+
"build": "vite build",
|
|
55
|
+
"check": "pnpm type-check && pnpm lint && pnpm knip && pnpm jscpd",
|
|
56
|
+
"dev": "vite build --watch",
|
|
57
|
+
"jscpd": "jscpd src",
|
|
58
|
+
"knip": "knip",
|
|
59
|
+
"lint": "eslint .",
|
|
60
|
+
"lint-files": "eslint",
|
|
61
|
+
"lint:format": "eslint . --fix",
|
|
62
|
+
"lint:report": "eslint . -o './.reports/eslint.json' -f json || true",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"test:coverage": "vitest run --coverage",
|
|
65
|
+
"test:packaged-types": "attw --pack",
|
|
66
|
+
"test:watch": "vitest",
|
|
67
|
+
"type-check": "tsc -p . --noEmit"
|
|
68
|
+
},
|
|
69
|
+
"type": "module",
|
|
70
|
+
"types": "./dist/types/index.d.ts"
|
|
71
|
+
}
|