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/dist/next.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { NextConfig } from 'next';
2
- import { P as PluginConfig } from './types-DlsgsNoY.cjs';
3
- export { A as AnalysisResult, c as CodeIndexItem } from './types-DlsgsNoY.cjs';
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-DlsgsNoY.js';
3
- export { A as AnalysisResult, c as CodeIndexItem } from './types-DlsgsNoY.js';
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 y$1,z,A}from'./chunk-WUEHYY36.js';import*as l from'path';import*as y from'fs/promises';async function m(e,t){let a=new y$1(e),o=new z(e),i=e.output.api?.enabled?new A(e):null;e.verbose&&console.log("[metadata-plugin] Starting analysis...");let r=await a.analyze(t);if(e.output.file?.enabled){let s=l.resolve(t,e.output.file.path);await o.write(r,s),e.verbose&&console.log(`[metadata-plugin] Wrote metadata to ${s}`);}i&&(await i.send(r),e.verbose&&console.log("[metadata-plugin] Sent metadata to API"));}function P(e$1={}){let t=d(e$1),a=e(t);if(a.length>0)throw new Error(`[metadata-plugin] Invalid config:
2
- ${a.join(`
3
- `)}`);return {name:"metadata-adapter",async onBuildComplete({projectDir:o}){t.verbose&&console.log("[metadata-plugin] Build completed, running analysis..."),await m(t,o),t.verbose&&console.log("[metadata-plugin] Analysis completed");}}}async function C(e,t={}){let a=l.join(e,".metadata-adapter.js"),o=`
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 y.writeFile(a,o.trim()),a}function b(e$1={}){let t=d(e$1),a=e$1.runOn||"build",o=e(t);if(o.length>0)throw new Error(`[metadata-plugin] Invalid config:
11
- ${o.join(`
12
- `)}`);let i=false;return r=>{let s=r.compiler?.runAfterProductionCompile;return {...r,compiler:{...r.compiler,async runAfterProductionCompile(n){s&&await s(n),!(a!=="build"&&a!=="both")&&(i=true,t.verbose&&console.log("[metadata-plugin] runAfterProductionCompile triggered"),await m(t,n.projectDir),t.verbose&&console.log("[metadata-plugin] Analysis completed"));}},webpack(n,p){let{dev:f,isServer:x}=p;return !x||i||(a==="both"||a==="build"&&!f||a==="dev"&&f)&&(n.plugins=n.plugins||[],n.plugins.push(new c(t))),typeof r.webpack=="function"?r.webpack(n,p):n}}}}var c=class{constructor(t){this.hasRun=false;this.config=t;}apply(t){let a="MetadataWebpackPlugin";t.hooks.beforeCompile.tapAsync(a,async(o,i)=>{if(this.hasRun)return i();this.hasRun=true;try{await m(this.config,t.context),i();}catch(r){i(r);}}),t.hooks.watchRun.tap(a,()=>{});}};export{P as createMetadataAdapter,b as default,C as generateAdapterFile,b as withMetadata};
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 chunkBT3J264A_cjs=require('./chunk-BT3J264A.cjs'),g=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 g__namespace=/*#__PURE__*/_interopNamespace(g);async function v(t,n){let i=new chunkBT3J264A_cjs.y(t),r=new chunkBT3J264A_cjs.z(t),a=t.output.api?.enabled?new chunkBT3J264A_cjs.A(t):null;t.verbose&&console.log("[metadata-plugin] Starting analysis...");let e=await i.analyze(n);if(t.output.file?.enabled){let o=g__namespace.resolve(n,t.output.file.path);await r.write(e,o),t.verbose&&console.log(`[metadata-plugin] Wrote metadata to ${o}`);}return a&&(await a.send(e),t.verbose&&console.log("[metadata-plugin] Sent metadata to API")),e}function y(t={}){let n=chunkBT3J264A_cjs.d(t),i=t.runOn||"build",r=t.emitStatsFile!==false,a,e=null,o=false;return {name:"vite-metadata-plugin",enforce:"post",configResolved(s){a=s;let l=chunkBT3J264A_cjs.e(n);if(l.length>0)throw new Error(`[metadata-plugin] Invalid config:
2
- ${l.join(`
3
- `)}`)},async buildStart(){if(o||!(i==="both"||i==="build"&&a.command==="build"||i==="serve"&&a.command==="serve"))return;o=true;let l=a.root;try{e=await v(n,l);}catch(u){if(console.error("[metadata-plugin] Analysis failed:",u),a.command==="build")throw u}},generateBundle(){!e||!r||this.emitFile({type:"asset",fileName:"metadata-stats.json",source:JSON.stringify(e.stats,null,2)});},closeBundle(){n.verbose&&e&&console.log(`[metadata-plugin] Build complete. Analyzed ${e.stats.totalFiles} files.`),o=false,e=null;}}}exports.default=y;exports.metadataPlugin=y;
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-DlsgsNoY.cjs';
3
- export { A as AnalysisResult, c as CodeIndexItem } from './types-DlsgsNoY.cjs';
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-DlsgsNoY.js';
3
- export { A as AnalysisResult, c as CodeIndexItem } from './types-DlsgsNoY.js';
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 as y$1,z,A}from'./chunk-WUEHYY36.js';import*as g from'path';async function v(t,n){let i=new y$1(t),r=new z(t),a=t.output.api?.enabled?new A(t):null;t.verbose&&console.log("[metadata-plugin] Starting analysis...");let e=await i.analyze(n);if(t.output.file?.enabled){let o=g.resolve(n,t.output.file.path);await r.write(e,o),t.verbose&&console.log(`[metadata-plugin] Wrote metadata to ${o}`);}return a&&(await a.send(e),t.verbose&&console.log("[metadata-plugin] Sent metadata to API")),e}function y(t={}){let n=d(t),i=t.runOn||"build",r=t.emitStatsFile!==false,a,e$1=null,o=false;return {name:"vite-metadata-plugin",enforce:"post",configResolved(s){a=s;let l=e(n);if(l.length>0)throw new Error(`[metadata-plugin] Invalid config:
2
- ${l.join(`
3
- `)}`)},async buildStart(){if(o||!(i==="both"||i==="build"&&a.command==="build"||i==="serve"&&a.command==="serve"))return;o=true;let l=a.root;try{e$1=await v(n,l);}catch(u){if(console.error("[metadata-plugin] Analysis failed:",u),a.command==="build")throw u}},generateBundle(){!e$1||!r||this.emitFile({type:"asset",fileName:"metadata-stats.json",source:JSON.stringify(e$1.stats,null,2)});},closeBundle(){n.verbose&&e$1&&console.log(`[metadata-plugin] Build complete. Analyzed ${e$1.stats.totalFiles} files.`),o=false,e$1=null;}}}export{y as default,y as metadataPlugin};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metadatafy",
3
- "version": "1.1.2",
3
+ "version": "1.3.0",
4
4
  "description": "Build plugin for extracting project metadata for ticket analysis system",
5
5
  "type": "module",
6
6
  "exports": {