@linktr.ee/linkapp 0.0.28 → 0.0.30
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/dev-server/package-lock.json +318 -1414
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +10 -0
- package/dist/commands/dev.js.map +1 -1
- package/dist/sdk/index.d.ts +4 -4
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +4 -4
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/send-message.d.ts +2 -2
- package/dist/sdk/send-message.js +2 -2
- package/dist/sdk/{use-open-popup.d.ts → use-expand-link-app.d.ts} +4 -4
- package/dist/sdk/use-expand-link-app.d.ts.map +1 -0
- package/dist/sdk/{use-open-popup.js → use-expand-link-app.js} +5 -5
- package/dist/sdk/use-expand-link-app.js.map +1 -0
- package/dist/types.d.ts +3 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -2
- package/dist/components/ThemeStyle.d.ts +0 -30
- package/dist/components/ThemeStyle.d.ts.map +0 -1
- package/dist/components/ThemeStyle.js +0 -33
- package/dist/components/ThemeStyle.js.map +0 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +0 -1
- package/dist/components/index.js +0 -3
- package/dist/components/index.js.map +0 -1
- package/dist/lib/utils/init-git.d.ts +0 -2
- package/dist/lib/utils/init-git.d.ts.map +0 -1
- package/dist/lib/utils/init-git.js +0 -34
- package/dist/lib/utils/init-git.js.map +0 -1
- package/dist/lib/utils/install-dependencies.d.ts +0 -2
- package/dist/lib/utils/install-dependencies.d.ts.map +0 -1
- package/dist/lib/utils/install-dependencies.js +0 -20
- package/dist/lib/utils/install-dependencies.js.map +0 -1
- package/dist/lib/vite/config-factory.d.ts +0 -12
- package/dist/lib/vite/config-factory.d.ts.map +0 -1
- package/dist/lib/vite/config-factory.js +0 -63
- package/dist/lib/vite/config-factory.js.map +0 -1
- package/dist/lib/vite/plugins/asset-versioning.d.ts +0 -11
- package/dist/lib/vite/plugins/asset-versioning.d.ts.map +0 -1
- package/dist/lib/vite/plugins/asset-versioning.js +0 -52
- package/dist/lib/vite/plugins/asset-versioning.js.map +0 -1
- package/dist/lib/vite/plugins/copy-public.d.ts +0 -12
- package/dist/lib/vite/plugins/copy-public.d.ts.map +0 -1
- package/dist/lib/vite/plugins/copy-public.js +0 -31
- package/dist/lib/vite/plugins/copy-public.js.map +0 -1
- package/dist/lib/vite/plugins/route-handler.d.ts +0 -16
- package/dist/lib/vite/plugins/route-handler.d.ts.map +0 -1
- package/dist/lib/vite/plugins/route-handler.js +0 -108
- package/dist/lib/vite/plugins/route-handler.js.map +0 -1
- package/dist/lib/vite/plugins/window-context.d.ts +0 -7
- package/dist/lib/vite/plugins/window-context.d.ts.map +0 -1
- package/dist/lib/vite/plugins/window-context.js +0 -68
- package/dist/lib/vite/plugins/window-context.js.map +0 -1
- package/dist/sdk/use-open-popup.d.ts.map +0 -1
- package/dist/sdk/use-open-popup.js.map +0 -1
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { createHash } from 'node:crypto';
|
|
2
|
-
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { join, dirname } from 'node:path';
|
|
4
|
-
/**
|
|
5
|
-
* Vite plugin that creates a build manifest with versioned assets
|
|
6
|
-
* This helps invalidate cache on deployment
|
|
7
|
-
*/
|
|
8
|
-
export function assetVersioning(options = {}) {
|
|
9
|
-
const manifestPath = options.manifestPath || 'build-manifest.json';
|
|
10
|
-
const manifest = {};
|
|
11
|
-
return {
|
|
12
|
-
name: 'linkapp:asset-versioning',
|
|
13
|
-
enforce: 'post',
|
|
14
|
-
generateBundle(_options, bundle) {
|
|
15
|
-
// Collect all asset mappings
|
|
16
|
-
for (const [fileName, asset] of Object.entries(bundle)) {
|
|
17
|
-
if (asset.type === 'asset' || asset.type === 'chunk') {
|
|
18
|
-
// Store original name -> hashed name mapping
|
|
19
|
-
const originalName = fileName.replace(/\.[a-f0-9]+\./, '.');
|
|
20
|
-
manifest[originalName] = fileName;
|
|
21
|
-
// Add metadata
|
|
22
|
-
if (asset.type === 'chunk' && asset.isEntry) {
|
|
23
|
-
manifest[`${originalName}.entry`] = 'true';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// Add build timestamp
|
|
28
|
-
manifest['_buildTime'] = new Date().toISOString();
|
|
29
|
-
manifest['_buildHash'] = createHash('sha256').update(JSON.stringify(manifest)).digest('hex').slice(0, 8);
|
|
30
|
-
// Emit manifest file
|
|
31
|
-
this.emitFile({
|
|
32
|
-
type: 'asset',
|
|
33
|
-
fileName: manifestPath,
|
|
34
|
-
source: JSON.stringify(manifest, null, 2),
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
closeBundle() {
|
|
38
|
-
// Also write manifest to disk for deployment process
|
|
39
|
-
const outDir = process.env.VITE_OUT_DIR || 'dist';
|
|
40
|
-
const fullPath = join(process.cwd(), outDir, manifestPath);
|
|
41
|
-
try {
|
|
42
|
-
// Ensure the output directory exists
|
|
43
|
-
mkdirSync(dirname(fullPath), { recursive: true });
|
|
44
|
-
writeFileSync(fullPath, JSON.stringify(manifest, null, 2));
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
console.warn('Failed to write build manifest:', error);
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=asset-versioning.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asset-versioning.js","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/asset-versioning.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMzC;;;GAGG;AACH,MAAM,UA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E,IAAI,EAAE,CAAC,CAAC;aAC1C,CAAC,CAAA;QACJ,CAAC;QAED,WAAW;YACT,qDAAqD;YACrD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,MAAM,CAAA;YACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,YAAY,CAAC,CAAA;YAE1D,IAAI,CAAC;gBACH,qCAAqC;gBACrC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;gBACjD,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAA;YACxD,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
interface CopyPublicOptions {
|
|
3
|
-
publicDir: string;
|
|
4
|
-
outDir: string;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Vite plugin that ensures public directory files are copied to dist
|
|
8
|
-
* This is a workaround for cases where Vite's copyPublicDir doesn't work as expected
|
|
9
|
-
*/
|
|
10
|
-
export declare function copyPublicDirectory(options: CopyPublicOptions): Plugin;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=copy-public.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-public.d.ts","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/copy-public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAGlC,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CA0BtE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { cpSync, existsSync } from 'node:fs';
|
|
2
|
-
/**
|
|
3
|
-
* Vite plugin that ensures public directory files are copied to dist
|
|
4
|
-
* This is a workaround for cases where Vite's copyPublicDir doesn't work as expected
|
|
5
|
-
*/
|
|
6
|
-
export function copyPublicDirectory(options) {
|
|
7
|
-
return {
|
|
8
|
-
name: 'linkapp:copy-public',
|
|
9
|
-
writeBundle() {
|
|
10
|
-
const { publicDir, outDir } = options;
|
|
11
|
-
if (!existsSync(publicDir)) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
cpSync(publicDir, outDir, {
|
|
16
|
-
recursive: true,
|
|
17
|
-
force: true,
|
|
18
|
-
filter: (src) => {
|
|
19
|
-
// Skip hidden files and directories
|
|
20
|
-
const basename = src.split('/').pop() || '';
|
|
21
|
-
return !basename.startsWith('.');
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
catch (error) {
|
|
26
|
-
console.warn('Failed to copy public directory:', error);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=copy-public.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-public.js","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/copy-public.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAO5C;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA0B;IAC5D,OAAO;QACL,IAAI,EAAE,qBAAqB;QAE3B,WAAW;YACT,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;YAErC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC3B,OAAM;YACR,CAAC;YAED,IAAI,CAAC;gBACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE;oBACxB,SAAS,EAAE,IAAI;oBACf,KAAK,EAAE,IAAI;oBACX,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;wBACd,oCAAoC;wBACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAA;wBAC3C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAClC,CAAC;iBACF,CAAC,CAAA;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAA;YACzD,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
interface RouteHandlerOptions {
|
|
3
|
-
userProjectPath: string;
|
|
4
|
-
previewPath: string;
|
|
5
|
-
devServerOrigin: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Vite plugin that handles multiple routes in a single dev server
|
|
9
|
-
* Routes:
|
|
10
|
-
* / → Preview UI (linkapp-preview)
|
|
11
|
-
* /classic, /featured, etc. → User layouts (runtime)
|
|
12
|
-
* /layouts.json → JSON endpoint
|
|
13
|
-
*/
|
|
14
|
-
export declare function routeHandler(options: RouteHandlerOptions): Plugin;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=route-handler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-handler.d.ts","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/route-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAA;AASjD,UAAU,mBAAmB;IAC3B,eAAe,EAAE,MAAM,CAAA;IACvB,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CA6GjE"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join, dirname } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { detectLayouts } from '../../build/detect-layouts.js';
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = dirname(__filename);
|
|
7
|
-
/**
|
|
8
|
-
* Vite plugin that handles multiple routes in a single dev server
|
|
9
|
-
* Routes:
|
|
10
|
-
* / → Preview UI (linkapp-preview)
|
|
11
|
-
* /classic, /featured, etc. → User layouts (runtime)
|
|
12
|
-
* /layouts.json → JSON endpoint
|
|
13
|
-
*/
|
|
14
|
-
export function routeHandler(options) {
|
|
15
|
-
const { userProjectPath, previewPath, devServerOrigin } = options;
|
|
16
|
-
// Read HTML templates
|
|
17
|
-
const previewHtmlPath = join(previewPath, 'index.html');
|
|
18
|
-
const runtimeHtmlPath = join(__dirname, '../../../../runtime/index.html');
|
|
19
|
-
return {
|
|
20
|
-
name: 'linkapp:route-handler',
|
|
21
|
-
configureServer(server) {
|
|
22
|
-
// Add middleware before Vite's internal middleware
|
|
23
|
-
server.middlewares.use((req, res, next) => {
|
|
24
|
-
const url = req.url || '/';
|
|
25
|
-
const pathname = url.split('?')[0];
|
|
26
|
-
// Handle /layouts.json endpoint
|
|
27
|
-
if (pathname === '/layouts.json') {
|
|
28
|
-
try {
|
|
29
|
-
const detection = detectLayouts(userProjectPath);
|
|
30
|
-
res.statusCode = 200;
|
|
31
|
-
res.setHeader('Content-Type', 'application/json');
|
|
32
|
-
res.setHeader('Cache-Control', 'no-store');
|
|
33
|
-
res.end(JSON.stringify({
|
|
34
|
-
layouts: detection.layouts,
|
|
35
|
-
devServerUrl: devServerOrigin,
|
|
36
|
-
}));
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
console.error('Failed to read layouts:', error);
|
|
40
|
-
res.statusCode = 500;
|
|
41
|
-
res.setHeader('Content-Type', 'application/json');
|
|
42
|
-
res.end(JSON.stringify({ error: 'Failed to read layouts' }));
|
|
43
|
-
}
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
// Get available layouts
|
|
47
|
-
let layouts = [];
|
|
48
|
-
try {
|
|
49
|
-
layouts = detectLayouts(userProjectPath).layouts;
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
console.error('Failed to detect layouts:', error);
|
|
53
|
-
}
|
|
54
|
-
// Check if this is a layout route
|
|
55
|
-
const matchedLayout = layouts.find(layout => pathname === `/${layout.name}`);
|
|
56
|
-
if (matchedLayout) {
|
|
57
|
-
// Serve runtime HTML with layout query param
|
|
58
|
-
try {
|
|
59
|
-
let html = readFileSync(runtimeHtmlPath, 'utf-8');
|
|
60
|
-
// Add layout query param to the script src
|
|
61
|
-
html = html.replace('src="/.linkapp/main.tsx"', `src="/.linkapp/main.tsx?layout=${matchedLayout.name}"`);
|
|
62
|
-
res.statusCode = 200;
|
|
63
|
-
res.setHeader('Content-Type', 'text/html');
|
|
64
|
-
res.end(html);
|
|
65
|
-
}
|
|
66
|
-
catch (error) {
|
|
67
|
-
console.error('Failed to serve runtime HTML:', error);
|
|
68
|
-
next();
|
|
69
|
-
}
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
// Serve preview HTML at root
|
|
73
|
-
if (pathname === '/') {
|
|
74
|
-
try {
|
|
75
|
-
// Read preview HTML from linkapp-preview package
|
|
76
|
-
const html = readFileSync(previewHtmlPath, 'utf-8');
|
|
77
|
-
res.statusCode = 200;
|
|
78
|
-
res.setHeader('Content-Type', 'text/html');
|
|
79
|
-
res.end(html);
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
console.error('Failed to serve preview HTML:', error);
|
|
83
|
-
next();
|
|
84
|
-
}
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
// Let Vite handle everything else
|
|
88
|
-
next();
|
|
89
|
-
});
|
|
90
|
-
},
|
|
91
|
-
// Transform HTML to handle module resolution
|
|
92
|
-
transformIndexHtml: {
|
|
93
|
-
order: 'pre',
|
|
94
|
-
handler(html, ctx) {
|
|
95
|
-
const url = ctx.originalUrl || '/';
|
|
96
|
-
const pathname = url.split('?')[0];
|
|
97
|
-
// For preview route, update paths to use linkapp-preview alias
|
|
98
|
-
if (pathname === '/') {
|
|
99
|
-
return html
|
|
100
|
-
.replace('href="/src/index.css"', 'href="/linkapp-preview/src/index.css"')
|
|
101
|
-
.replace('src="/src/main.tsx"', 'src="/linkapp-preview/src/main.tsx"');
|
|
102
|
-
}
|
|
103
|
-
return html;
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=route-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-handler.js","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/route-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAE7D,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAQrC;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,EAAE,GAAG,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;wBACpB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;wBAC1C,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;oBACf,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;wBACrD,IAAI,EAAE,CAAA;oBACR,CAAC;oBACD,OAAM;gBACR,CAAC;gBAED,kCAAkC;gBAClC,IAAI,EAAE,CAAA;YACR,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,6CAA6C;QAC7C,kBAAkB,EAAE;YAClB,KAAK,EAAE,KAAK;YACZ,OAAO,CAAC,IAAI,EAAE,GAAG;gBACf,MAAM,GAAG,GAAG,GAAG,CAAC,WAAW,IAAI,GAAG,CAAA;gBAClC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;gBAElC,+DAA+D;gBAC/D,IAAI,QAAQ,KAAK,GAAG,EAAE,CAAC;oBACrB,OAAO,IAAI;yBACR,OAAO,CAAC,uBAAuB,EAAE,uCAAuC,CAAC;yBACzE,OAAO,CAAC,qBAAqB,EAAE,qCAAqC,CAAC,CAAA;gBAC1E,CAAC;gBAED,OAAO,IAAI,CAAA;YACb,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* Vite plugin that injects window.linktree context for development
|
|
4
|
-
* In production, this is handled by the parent Linktree frame
|
|
5
|
-
*/
|
|
6
|
-
export declare function windowContext(): Plugin;
|
|
7
|
-
//# sourceMappingURL=window-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window-context.d.ts","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/window-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAkEtC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
import { pathToFileURL } from 'node:url';
|
|
3
|
-
/**
|
|
4
|
-
* Vite plugin that injects window.linktree context for development
|
|
5
|
-
* In production, this is handled by the parent Linktree frame
|
|
6
|
-
*/
|
|
7
|
-
export function windowContext() {
|
|
8
|
-
return {
|
|
9
|
-
name: 'linkapp:window-context',
|
|
10
|
-
transformIndexHtml: {
|
|
11
|
-
order: 'pre',
|
|
12
|
-
async handler(html) {
|
|
13
|
-
// Only inject in development
|
|
14
|
-
if (process.env.NODE_ENV === 'production') {
|
|
15
|
-
return html;
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const configPath = join(process.cwd(), 'linkapp.config.ts');
|
|
19
|
-
const configUrl = pathToFileURL(configPath).href;
|
|
20
|
-
// Dynamic import the config
|
|
21
|
-
const { default: config } = await import(configUrl);
|
|
22
|
-
const previewProps = config.previewProps || {};
|
|
23
|
-
// Inject window.linktree with preview props
|
|
24
|
-
const script = `
|
|
25
|
-
<script>
|
|
26
|
-
// Development context - in production this comes from parent frame
|
|
27
|
-
window.linktree = ${JSON.stringify(previewProps, null, 2)};
|
|
28
|
-
|
|
29
|
-
// Apply theme CSS variables
|
|
30
|
-
if (window.linktree?.theme) {
|
|
31
|
-
const theme = window.linktree.theme;
|
|
32
|
-
document.documentElement.style.setProperty('--linktree-bg-color', theme.backgroundColor);
|
|
33
|
-
document.documentElement.style.setProperty('--linktree-text-color', theme.textColor);
|
|
34
|
-
document.documentElement.style.setProperty('--linktree-border-color', theme.borderColor);
|
|
35
|
-
document.documentElement.style.setProperty('--linktree-border-radius', theme.borderRadius);
|
|
36
|
-
}
|
|
37
|
-
</script>`;
|
|
38
|
-
return html.replace('</head>', `${script}</head>`);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
console.warn('Failed to load config, using defaults:', error);
|
|
42
|
-
// Fallback to minimal context
|
|
43
|
-
const fallbackScript = `
|
|
44
|
-
<script>
|
|
45
|
-
window.linktree = {
|
|
46
|
-
linkUrl: 'https://example.com',
|
|
47
|
-
theme: {
|
|
48
|
-
textColor: '#000000',
|
|
49
|
-
backgroundColor: '#ffffff',
|
|
50
|
-
borderRadius: '12px',
|
|
51
|
-
borderColor: '#e5e7eb',
|
|
52
|
-
isOutlineStyle: false,
|
|
53
|
-
contrastColor: '#ffffff',
|
|
54
|
-
textHoverColor: '#111827'
|
|
55
|
-
},
|
|
56
|
-
locale: 'en-US',
|
|
57
|
-
currency: 'USD',
|
|
58
|
-
username: 'dev-user',
|
|
59
|
-
viewport: { width: 680, height: 800 }
|
|
60
|
-
};
|
|
61
|
-
</script>`;
|
|
62
|
-
return html.replace('</head>', `${fallbackScript}</head>`);
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=window-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"window-context.js","sourceRoot":"","sources":["../../../../src/lib/vite/plugins/window-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC;;;GAGG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO;QACL,IAAI,EAAE,wBAAwB;QAE9B,kBAAkB,EAAE;YAClB,KAAK,EAAE,KAAK;YACZ,KAAK,CAAC,OAAO,CAAC,IAAI;gBAChB,6BAA6B;gBAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;oBAC1C,OAAO,IAAI,CAAA;gBACb,CAAC;gBAED,IAAI,CAAC;oBACH,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,mBAAmB,CAAC,CAAA;oBAC3D,MAAM,SAAS,GAAG,aAAa,CAAC,UAAU,CAAC,CAAC,IAAI,CAAA;oBAEhD,4BAA4B;oBAC5B,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAA;oBACnD,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,EAAE,CAAA;oBAE9C,4CAA4C;oBAC5C,MAAM,MAAM,GAAG;;;sBAGH,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;;;;;;;;;;UAUjD,CAAA;oBAEA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,MAAM,SAAS,CAAC,CAAA;gBACpD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAA;oBAE7D,8BAA8B;oBAC9B,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;UAkBvB,CAAA;oBAEA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,cAAc,SAAS,CAAC,CAAA;gBAC5D,CAAC;YACH,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-open-popup.d.ts","sourceRoot":"","sources":["../../src/sdk/use-open-popup.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,YACC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAGnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-open-popup.js","sourceRoot":"","sources":["../../src/sdk/use-open-popup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,WAAW,CAAC,CAAC,IAA8B,EAAE,EAAE;QACpD,WAAW,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IACrC,CAAC,EAAE,EAAE,CAAC,CAAA;AACR,CAAC"}
|