metadatafy 1.1.2 → 1.3.0
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/README.md +236 -7
- package/dist/chunk-ESZLTJIF.js +1 -0
- package/dist/{chunk-BT3J264A.cjs → chunk-GHNW3BJ2.cjs} +1 -1
- package/dist/{chunk-WUEHYY36.js → chunk-SEPU4O45.js} +1 -1
- package/dist/chunk-XR3EVOXW.cjs +1 -0
- package/dist/cli.cjs +86 -31
- package/dist/cli.js +86 -31
- package/dist/custom-api-MPVFDKPU.js +1 -0
- package/dist/custom-api-THEHQ4IR.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/next.cjs +6 -6
- package/dist/next.d.cts +26 -2
- package/dist/next.d.ts +26 -2
- package/dist/next.js +6 -6
- package/dist/supabase-HWODZTEI.cjs +1 -0
- package/dist/supabase-TGVJDKHE.js +1 -0
- package/dist/{types-DlsgsNoY.d.cts → types-CXa1hvME.d.cts} +26 -0
- package/dist/{types-DlsgsNoY.d.ts → types-CXa1hvME.d.ts} +26 -0
- package/dist/vite.cjs +3 -3
- package/dist/vite.d.cts +26 -2
- package/dist/vite.d.ts +26 -2
- package/dist/vite.js +3 -3
- package/package.json +1 -1
package/dist/next.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
|
-
import { P as PluginConfig } from './types-
|
|
3
|
-
export { A as AnalysisResult, c as CodeIndexItem } from './types-
|
|
2
|
+
import { P as PluginConfig } from './types-CXa1hvME.cjs';
|
|
3
|
+
export { A as AnalysisResult, c as CodeIndexItem } from './types-CXa1hvME.cjs';
|
|
4
4
|
|
|
5
5
|
interface NextPluginOptions extends Partial<PluginConfig> {
|
|
6
6
|
/**
|
|
@@ -10,6 +10,30 @@ interface NextPluginOptions extends Partial<PluginConfig> {
|
|
|
10
10
|
* - 'both': 둘 다
|
|
11
11
|
*/
|
|
12
12
|
runOn?: 'build' | 'dev' | 'both';
|
|
13
|
+
/**
|
|
14
|
+
* Supabase 설정 (직접 전달)
|
|
15
|
+
* 환경변수를 직접 전달할 때 사용
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* withMetadatafy({
|
|
19
|
+
* supabase: {
|
|
20
|
+
* url: process.env.SUPABASE_URL,
|
|
21
|
+
* serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
|
22
|
+
* tableName: 'project_metadata',
|
|
23
|
+
* }
|
|
24
|
+
* })
|
|
25
|
+
*/
|
|
26
|
+
supabase?: {
|
|
27
|
+
url: string;
|
|
28
|
+
serviceRoleKey: string;
|
|
29
|
+
tableName: string;
|
|
30
|
+
fields?: {
|
|
31
|
+
projectId?: string;
|
|
32
|
+
metadata?: string;
|
|
33
|
+
createdAt?: string;
|
|
34
|
+
updatedAt?: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
13
37
|
}
|
|
14
38
|
/**
|
|
15
39
|
* Next.js 16+ Build Adapter 생성
|
package/dist/next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
|
-
import { P as PluginConfig } from './types-
|
|
3
|
-
export { A as AnalysisResult, c as CodeIndexItem } from './types-
|
|
2
|
+
import { P as PluginConfig } from './types-CXa1hvME.js';
|
|
3
|
+
export { A as AnalysisResult, c as CodeIndexItem } from './types-CXa1hvME.js';
|
|
4
4
|
|
|
5
5
|
interface NextPluginOptions extends Partial<PluginConfig> {
|
|
6
6
|
/**
|
|
@@ -10,6 +10,30 @@ interface NextPluginOptions extends Partial<PluginConfig> {
|
|
|
10
10
|
* - 'both': 둘 다
|
|
11
11
|
*/
|
|
12
12
|
runOn?: 'build' | 'dev' | 'both';
|
|
13
|
+
/**
|
|
14
|
+
* Supabase 설정 (직접 전달)
|
|
15
|
+
* 환경변수를 직접 전달할 때 사용
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* withMetadatafy({
|
|
19
|
+
* supabase: {
|
|
20
|
+
* url: process.env.SUPABASE_URL,
|
|
21
|
+
* serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
|
22
|
+
* tableName: 'project_metadata',
|
|
23
|
+
* }
|
|
24
|
+
* })
|
|
25
|
+
*/
|
|
26
|
+
supabase?: {
|
|
27
|
+
url: string;
|
|
28
|
+
serviceRoleKey: string;
|
|
29
|
+
tableName: string;
|
|
30
|
+
fields?: {
|
|
31
|
+
projectId?: string;
|
|
32
|
+
metadata?: string;
|
|
33
|
+
createdAt?: string;
|
|
34
|
+
updatedAt?: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
13
37
|
}
|
|
14
38
|
/**
|
|
15
39
|
* Next.js 16+ Build Adapter 생성
|
package/dist/next.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {d,e,y as
|
|
2
|
-
${
|
|
3
|
-
`)}`);return {name:"metadata-adapter",async onBuildComplete({projectDir:
|
|
1
|
+
import {a}from'./chunk-ESZLTJIF.js';import {d,e,y,z,A as A$1}from'./chunk-SEPU4O45.js';import*as u from'path';import*as v from'fs/promises';async function f(a$1,t,e){let i=new y(a$1),n=new z(a$1),l=a$1.output.api?.enabled?new A$1(a$1):null;a$1.verbose&&console.log("[metadata-plugin] Starting analysis...");let r=await i.analyze(t);if(a$1.output.file?.enabled){let s=u.resolve(t,a$1.output.file.path);await n.write(r,s),a$1.verbose&&console.log(`[metadata-plugin] Wrote metadata to ${s}`);}if(l&&(await l.send(r),a$1.verbose&&console.log("[metadata-plugin] Sent metadata to API")),e?.url&&e?.serviceRoleKey)try{let s={provider:"supabase",enabled:!0,url:e.url,serviceRoleKey:e.serviceRoleKey,tableName:e.tableName,fields:{projectId:e.fields?.projectId||"project_id",metadata:e.fields?.metadata||"metadata",createdAt:e.fields?.createdAt||"created_at",updatedAt:e.fields?.updatedAt||"updated_at"}},p=await(await a(s)).upload(r);a$1.verbose&&(p.success?console.log(`[metadata-plugin] ${p.message} (Supabase)`):console.log(`[metadata-plugin] Supabase upload failed: ${p.error}`));}catch(s){console.error("[metadata-plugin] Supabase upload error:",s);}}function A(a={}){let t=d(a),e$1=a.supabase,i=e(t);if(i.length>0)throw new Error(`[metadata-plugin] Invalid config:
|
|
2
|
+
${i.join(`
|
|
3
|
+
`)}`);return {name:"metadata-adapter",async onBuildComplete({projectDir:n}){t.verbose&&console.log("[metadata-plugin] Build completed, running analysis..."),await f(t,n,e$1),t.verbose&&console.log("[metadata-plugin] Analysis completed");}}}async function N(a,t={}){let e=u.join(a,".metadata-adapter.js"),i=`
|
|
4
4
|
// Auto-generated by metadatafy
|
|
5
5
|
// This adapter enables metadata extraction with Turbopack (Next.js 16+)
|
|
6
6
|
|
|
7
7
|
const { createMetadataAdapter } = require('metadatafy/next');
|
|
8
8
|
|
|
9
9
|
module.exports = createMetadataAdapter(${JSON.stringify(t,null,2)});
|
|
10
|
-
`;return await
|
|
11
|
-
${
|
|
12
|
-
`)}`);let
|
|
10
|
+
`;return await v.writeFile(e,i.trim()),e}function x(a={}){let t=d(a),e$1=a.runOn||"build",i=a.supabase,n=e(t);if(n.length>0)throw new Error(`[metadata-plugin] Invalid config:
|
|
11
|
+
${n.join(`
|
|
12
|
+
`)}`);let l=false;return r=>{let s=r.compiler?.runAfterProductionCompile;return {...r,compiler:{...r.compiler,async runAfterProductionCompile(o){s&&await s(o),!(e$1!=="build"&&e$1!=="both")&&(l=true,t.verbose&&console.log("[metadata-plugin] runAfterProductionCompile triggered"),await f(t,o.projectDir,i),t.verbose&&console.log("[metadata-plugin] Analysis completed"));}},webpack(o,p){let{dev:g,isServer:P}=p;return !P||l||(e$1==="both"||e$1==="build"&&!g||e$1==="dev"&&g)&&(o.plugins=o.plugins||[],o.plugins.push(new m(t,i))),typeof r.webpack=="function"?r.webpack(o,p):o}}}}var m=class{constructor(t,e){this.hasRun=false;this.config=t,this.supabaseOptions=e;}apply(t){let e="MetadataWebpackPlugin";t.hooks.beforeCompile.tapAsync(e,async(i,n)=>{if(this.hasRun)return n();this.hasRun=true;try{await f(this.config,t.context,this.supabaseOptions),n();}catch(l){n(l);}}),t.hooks.watchRun.tap(e,()=>{});}};export{A as createMetadataAdapter,x as default,N as generateAdapterFile,x as withMetadata};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';var i=class{constructor(e){this.name="Supabase";this.config=e;}getRestUrl(e){return `${this.config.url.replace(/\/$/,"")}/rest/v1/${e}`}async testConnection(){try{let e=await fetch(this.getRestUrl(this.config.tableName),{method:"GET",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json",Range:"0-0"}});return e.ok||e.status===416}catch{return false}}async upload(e){let{fields:t,tableName:o}=this.config,s=await this.findByProjectId(e.projectId),a={[t.projectId]:e.projectId,[t.metadata]:e};t.updatedAt&&(a[t.updatedAt]=new Date().toISOString()),!s&&t.createdAt&&(a[t.createdAt]=new Date().toISOString());try{let r;if(s?r=await fetch(`${this.getRestUrl(o)}?${t.projectId}=eq.${e.projectId}`,{method:"PATCH",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json",Prefer:"return=representation"},body:JSON.stringify(a)}):r=await fetch(this.getRestUrl(o),{method:"POST",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json",Prefer:"return=representation"},body:JSON.stringify(a)}),!r.ok){let c=await r.text();return {success:!1,message:`Supabase API error: ${r.status}`,error:c}}let n=await r.json();return {success:!0,message:s?"Metadata updated":"Metadata created",data:n}}catch(r){return {success:false,message:"Failed to upload metadata",error:r instanceof Error?r.message:String(r)}}}async findByProjectId(e){try{let{fields:t,tableName:o}=this.config,s=await fetch(`${this.getRestUrl(o)}?${t.projectId}=eq.${e}&limit=1`,{method:"GET",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json"}});if(!s.ok)return null;let a=await s.json();return Array.isArray(a)&&a.length>0?a[0]:null}catch{return null}}};exports.SupabaseProvider=i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var i=class{constructor(e){this.name="Supabase";this.config=e;}getRestUrl(e){return `${this.config.url.replace(/\/$/,"")}/rest/v1/${e}`}async testConnection(){try{let e=await fetch(this.getRestUrl(this.config.tableName),{method:"GET",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json",Range:"0-0"}});return e.ok||e.status===416}catch{return false}}async upload(e){let{fields:t,tableName:o}=this.config,s=await this.findByProjectId(e.projectId),a={[t.projectId]:e.projectId,[t.metadata]:e};t.updatedAt&&(a[t.updatedAt]=new Date().toISOString()),!s&&t.createdAt&&(a[t.createdAt]=new Date().toISOString());try{let r;if(s?r=await fetch(`${this.getRestUrl(o)}?${t.projectId}=eq.${e.projectId}`,{method:"PATCH",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json",Prefer:"return=representation"},body:JSON.stringify(a)}):r=await fetch(this.getRestUrl(o),{method:"POST",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json",Prefer:"return=representation"},body:JSON.stringify(a)}),!r.ok){let c=await r.text();return {success:!1,message:`Supabase API error: ${r.status}`,error:c}}let n=await r.json();return {success:!0,message:s?"Metadata updated":"Metadata created",data:n}}catch(r){return {success:false,message:"Failed to upload metadata",error:r instanceof Error?r.message:String(r)}}}async findByProjectId(e){try{let{fields:t,tableName:o}=this.config,s=await fetch(`${this.getRestUrl(o)}?${t.projectId}=eq.${e}&limit=1`,{method:"GET",headers:{apikey:this.config.serviceRoleKey,Authorization:`Bearer ${this.config.serviceRoleKey}`,"Content-Type":"application/json"}});if(!s.ok)return null;let a=await s.json();return Array.isArray(a)&&a.length>0?a[0]:null}catch{return null}}};export{i as SupabaseProvider};
|
|
@@ -102,11 +102,37 @@ interface OutputConfig {
|
|
|
102
102
|
endpoint: string;
|
|
103
103
|
headers?: Record<string, string>;
|
|
104
104
|
};
|
|
105
|
+
database?: DatabaseOutputConfig;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 데이터베이스 출력 설정
|
|
109
|
+
* 값에 ${ENV_VAR} 형식을 사용하면 환경변수에서 로드
|
|
110
|
+
*/
|
|
111
|
+
interface DatabaseOutputConfig {
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
provider: 'supabase' | 'custom';
|
|
114
|
+
supabase?: {
|
|
115
|
+
url: string;
|
|
116
|
+
serviceRoleKey: string;
|
|
117
|
+
tableName: string;
|
|
118
|
+
fields: {
|
|
119
|
+
projectId: string;
|
|
120
|
+
metadata: string;
|
|
121
|
+
createdAt?: string;
|
|
122
|
+
updatedAt?: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
custom?: {
|
|
126
|
+
endpoint: string;
|
|
127
|
+
method: 'POST' | 'PUT' | 'PATCH';
|
|
128
|
+
headers?: Record<string, string>;
|
|
129
|
+
};
|
|
105
130
|
}
|
|
106
131
|
/**
|
|
107
132
|
* 분석 결과
|
|
108
133
|
*/
|
|
109
134
|
interface AnalysisResult {
|
|
135
|
+
projectId: string;
|
|
110
136
|
items: CodeIndexItem[];
|
|
111
137
|
stats: AnalysisStats;
|
|
112
138
|
timestamp: string;
|
|
@@ -102,11 +102,37 @@ interface OutputConfig {
|
|
|
102
102
|
endpoint: string;
|
|
103
103
|
headers?: Record<string, string>;
|
|
104
104
|
};
|
|
105
|
+
database?: DatabaseOutputConfig;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 데이터베이스 출력 설정
|
|
109
|
+
* 값에 ${ENV_VAR} 형식을 사용하면 환경변수에서 로드
|
|
110
|
+
*/
|
|
111
|
+
interface DatabaseOutputConfig {
|
|
112
|
+
enabled: boolean;
|
|
113
|
+
provider: 'supabase' | 'custom';
|
|
114
|
+
supabase?: {
|
|
115
|
+
url: string;
|
|
116
|
+
serviceRoleKey: string;
|
|
117
|
+
tableName: string;
|
|
118
|
+
fields: {
|
|
119
|
+
projectId: string;
|
|
120
|
+
metadata: string;
|
|
121
|
+
createdAt?: string;
|
|
122
|
+
updatedAt?: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
custom?: {
|
|
126
|
+
endpoint: string;
|
|
127
|
+
method: 'POST' | 'PUT' | 'PATCH';
|
|
128
|
+
headers?: Record<string, string>;
|
|
129
|
+
};
|
|
105
130
|
}
|
|
106
131
|
/**
|
|
107
132
|
* 분석 결과
|
|
108
133
|
*/
|
|
109
134
|
interface AnalysisResult {
|
|
135
|
+
projectId: string;
|
|
110
136
|
items: CodeIndexItem[];
|
|
111
137
|
stats: AnalysisStats;
|
|
112
138
|
timestamp: string;
|
package/dist/vite.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var
|
|
2
|
-
${
|
|
3
|
-
`)}`)},async buildStart(){if(
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkXR3EVOXW_cjs=require('./chunk-XR3EVOXW.cjs'),chunkGHNW3BJ2_cjs=require('./chunk-GHNW3BJ2.cjs'),v=require('path');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var v__namespace=/*#__PURE__*/_interopNamespace(v);async function P(e,l,t){let s=new chunkGHNW3BJ2_cjs.y(e),n=new chunkGHNW3BJ2_cjs.z(e),o=e.output.api?.enabled?new chunkGHNW3BJ2_cjs.A(e):null;e.verbose&&console.log("[metadata-plugin] Starting analysis...");let a=await s.analyze(l);if(e.output.file?.enabled){let r=v__namespace.resolve(l,e.output.file.path);await n.write(a,r),e.verbose&&console.log(`[metadata-plugin] Wrote metadata to ${r}`);}if(o&&(await o.send(a),e.verbose&&console.log("[metadata-plugin] Sent metadata to API")),t?.url&&t?.serviceRoleKey)try{let r={provider:"supabase",enabled:!0,url:t.url,serviceRoleKey:t.serviceRoleKey,tableName:t.tableName,fields:{projectId:t.fields?.projectId||"project_id",metadata:t.fields?.metadata||"metadata",createdAt:t.fields?.createdAt||"created_at",updatedAt:t.fields?.updatedAt||"updated_at"}},i=await(await chunkXR3EVOXW_cjs.a(r)).upload(a);e.verbose&&(i.success?console.log(`[metadata-plugin] ${i.message} (Supabase)`):console.log(`[metadata-plugin] Supabase upload failed: ${i.error}`));}catch(r){console.error("[metadata-plugin] Supabase upload error:",r);}return a}function b(e={}){let l=chunkGHNW3BJ2_cjs.d(e),t=e.runOn||"build",s=e.emitStatsFile!==false,n=e.supabase,o,a=null,r=false;return {name:"vite-metadata-plugin",enforce:"post",configResolved(d){o=d;let i=chunkGHNW3BJ2_cjs.e(l);if(i.length>0)throw new Error(`[metadata-plugin] Invalid config:
|
|
2
|
+
${i.join(`
|
|
3
|
+
`)}`)},async buildStart(){if(r||!(t==="both"||t==="build"&&o.command==="build"||t==="serve"&&o.command==="serve"))return;r=true;let i=o.root;try{a=await P(l,i,n);}catch(u){if(console.error("[metadata-plugin] Analysis failed:",u),o.command==="build")throw u}},generateBundle(){!a||!s||this.emitFile({type:"asset",fileName:"metadata-stats.json",source:JSON.stringify(a.stats,null,2)});},closeBundle(){l.verbose&&a&&console.log(`[metadata-plugin] Build complete. Analyzed ${a.stats.totalFiles} files.`),r=false,a=null;}}}exports.default=b;exports.metadataPlugin=b;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { P as PluginConfig } from './types-
|
|
3
|
-
export { A as AnalysisResult, c as CodeIndexItem } from './types-
|
|
2
|
+
import { P as PluginConfig } from './types-CXa1hvME.cjs';
|
|
3
|
+
export { A as AnalysisResult, c as CodeIndexItem } from './types-CXa1hvME.cjs';
|
|
4
4
|
|
|
5
5
|
interface VitePluginOptions extends Partial<PluginConfig> {
|
|
6
6
|
/**
|
|
@@ -15,6 +15,30 @@ interface VitePluginOptions extends Partial<PluginConfig> {
|
|
|
15
15
|
* 기본값: true
|
|
16
16
|
*/
|
|
17
17
|
emitStatsFile?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Supabase 설정 (직접 전달)
|
|
20
|
+
* 환경변수를 직접 전달할 때 사용
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* metadataPlugin({
|
|
24
|
+
* supabase: {
|
|
25
|
+
* url: process.env.SUPABASE_URL,
|
|
26
|
+
* serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
|
27
|
+
* tableName: 'project_metadata',
|
|
28
|
+
* }
|
|
29
|
+
* })
|
|
30
|
+
*/
|
|
31
|
+
supabase?: {
|
|
32
|
+
url: string;
|
|
33
|
+
serviceRoleKey: string;
|
|
34
|
+
tableName: string;
|
|
35
|
+
fields?: {
|
|
36
|
+
projectId?: string;
|
|
37
|
+
metadata?: string;
|
|
38
|
+
createdAt?: string;
|
|
39
|
+
updatedAt?: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
18
42
|
}
|
|
19
43
|
/**
|
|
20
44
|
* Vite 메타데이터 플러그인
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { P as PluginConfig } from './types-
|
|
3
|
-
export { A as AnalysisResult, c as CodeIndexItem } from './types-
|
|
2
|
+
import { P as PluginConfig } from './types-CXa1hvME.js';
|
|
3
|
+
export { A as AnalysisResult, c as CodeIndexItem } from './types-CXa1hvME.js';
|
|
4
4
|
|
|
5
5
|
interface VitePluginOptions extends Partial<PluginConfig> {
|
|
6
6
|
/**
|
|
@@ -15,6 +15,30 @@ interface VitePluginOptions extends Partial<PluginConfig> {
|
|
|
15
15
|
* 기본값: true
|
|
16
16
|
*/
|
|
17
17
|
emitStatsFile?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Supabase 설정 (직접 전달)
|
|
20
|
+
* 환경변수를 직접 전달할 때 사용
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* metadataPlugin({
|
|
24
|
+
* supabase: {
|
|
25
|
+
* url: process.env.SUPABASE_URL,
|
|
26
|
+
* serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
|
|
27
|
+
* tableName: 'project_metadata',
|
|
28
|
+
* }
|
|
29
|
+
* })
|
|
30
|
+
*/
|
|
31
|
+
supabase?: {
|
|
32
|
+
url: string;
|
|
33
|
+
serviceRoleKey: string;
|
|
34
|
+
tableName: string;
|
|
35
|
+
fields?: {
|
|
36
|
+
projectId?: string;
|
|
37
|
+
metadata?: string;
|
|
38
|
+
createdAt?: string;
|
|
39
|
+
updatedAt?: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
18
42
|
}
|
|
19
43
|
/**
|
|
20
44
|
* Vite 메타데이터 플러그인
|
package/dist/vite.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {d,e,y
|
|
2
|
-
${
|
|
3
|
-
`)}`)},async buildStart(){if(
|
|
1
|
+
import {a}from'./chunk-ESZLTJIF.js';import {d,e,y,z,A}from'./chunk-SEPU4O45.js';import*as v from'path';async function P(e,l,t){let s=new y(e),n=new z(e),o=e.output.api?.enabled?new A(e):null;e.verbose&&console.log("[metadata-plugin] Starting analysis...");let a$1=await s.analyze(l);if(e.output.file?.enabled){let r=v.resolve(l,e.output.file.path);await n.write(a$1,r),e.verbose&&console.log(`[metadata-plugin] Wrote metadata to ${r}`);}if(o&&(await o.send(a$1),e.verbose&&console.log("[metadata-plugin] Sent metadata to API")),t?.url&&t?.serviceRoleKey)try{let r={provider:"supabase",enabled:!0,url:t.url,serviceRoleKey:t.serviceRoleKey,tableName:t.tableName,fields:{projectId:t.fields?.projectId||"project_id",metadata:t.fields?.metadata||"metadata",createdAt:t.fields?.createdAt||"created_at",updatedAt:t.fields?.updatedAt||"updated_at"}},i=await(await a(r)).upload(a$1);e.verbose&&(i.success?console.log(`[metadata-plugin] ${i.message} (Supabase)`):console.log(`[metadata-plugin] Supabase upload failed: ${i.error}`));}catch(r){console.error("[metadata-plugin] Supabase upload error:",r);}return a$1}function b(e$1={}){let l=d(e$1),t=e$1.runOn||"build",s=e$1.emitStatsFile!==false,n=e$1.supabase,o,a=null,r=false;return {name:"vite-metadata-plugin",enforce:"post",configResolved(d){o=d;let i=e(l);if(i.length>0)throw new Error(`[metadata-plugin] Invalid config:
|
|
2
|
+
${i.join(`
|
|
3
|
+
`)}`)},async buildStart(){if(r||!(t==="both"||t==="build"&&o.command==="build"||t==="serve"&&o.command==="serve"))return;r=true;let i=o.root;try{a=await P(l,i,n);}catch(u){if(console.error("[metadata-plugin] Analysis failed:",u),o.command==="build")throw u}},generateBundle(){!a||!s||this.emitFile({type:"asset",fileName:"metadata-stats.json",source:JSON.stringify(a.stats,null,2)});},closeBundle(){l.verbose&&a&&console.log(`[metadata-plugin] Build complete. Analyzed ${a.stats.totalFiles} files.`),r=false,a=null;}}}export{b as default,b as metadataPlugin};
|