fynixui 1.0.2 → 1.0.3

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.

Potentially problematic release.


This version of fynixui might be problematic. Click here for more details.

@@ -2,5 +2,4 @@ export * from "../runtime.js";
2
2
  export * from "../router/router.js";
3
3
  export { default as createFynix } from "../router/router.js";
4
4
  export { Fynix } from "../runtime.js";
5
- export * from "../types/fnx.js";
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../fynix/index.ts"],"names":[],"mappings":"AAuBA,cAAc,eAAe,CAAC;AAE9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGtC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../fynix/index.ts"],"names":[],"mappings":"AAuBA,cAAc,eAAe,CAAC;AAE9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC"}
@@ -2,4 +2,3 @@ export * from "../runtime.js";
2
2
  export * from "../router/router.js";
3
3
  export { default as createFynix } from "../router/router.js";
4
4
  export { Fynix } from "../runtime.js";
5
- export * from "../types/fnx.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../fynix/index.ts"],
4
- "sourcesContent": ["/* MIT License\r\n\r\n* Copyright (c) 2026 Resty Gonzales\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n* SOFTWARE.\r\n */\r\n// fynix/index.js - Single entry point for all core functionality\r\nexport * from \"../runtime.js\";\r\n// Re-export Fynix namespace and hooks under new names\r\nexport * from \"../router/router.js\";\r\nexport { default as createFynix } from \"../router/router.js\";\r\nexport { Fynix } from \"../runtime.js\";\r\n\r\n// Export types for .fnx module resolution\r\nexport * from \"../types/fnx.js\";\r\n"],
5
- "mappings": "AAuBA,cAAc;AAEd,cAAc;AACd,SAAoB,WAAXA,gBAA8B;AACvC,SAAS,aAAa;AAGtB,cAAc;",
4
+ "sourcesContent": ["/* MIT License\r\n\r\n* Copyright (c) 2026 Resty Gonzales\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining a copy\r\nof this software and associated documentation files (the \"Software\"), to deal\r\nin the Software without restriction, including without limitation the rights\r\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\ncopies of the Software, and to permit persons to whom the Software is\r\nfurnished to do so, subject to the following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be included in all\r\ncopies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n* SOFTWARE.\r\n */\r\n// fynix/index.js - Single entry point for all core functionality\r\nexport * from \"../runtime.js\";\r\n// Re-export Fynix namespace and hooks under new names\r\nexport * from \"../router/router.js\";\r\nexport { default as createFynix } from \"../router/router.js\";\r\nexport { Fynix } from \"../runtime.js\";\r\n"],
5
+ "mappings": "AAuBA,cAAc;AAEd,cAAc;AACd,SAAoB,WAAXA,gBAA8B;AACvC,SAAS,aAAa;",
6
6
  "names": ["default"]
7
7
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fynixui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Core package for Fynix UI framework - A lightweight, reactive UI framework with TypeScript support.",
6
6
  "main": "./dist/fynix/index.js",
@@ -1,29 +1,41 @@
1
- import { type TransformOptions as EsbuildTransformOptions } from "esbuild";
2
- import * as ts from "typescript";
1
+ import { type TransformOptions } from "esbuild";
2
+ import type { HmrContext } from "vite";
3
3
  interface FynixPluginOptions {
4
4
  jsxFactory?: string;
5
5
  jsxFragment?: string;
6
6
  include?: string[];
7
7
  exclude?: string[];
8
8
  sourcemap?: boolean;
9
- esbuildOptions?: Partial<EsbuildTransformOptions>;
10
- enableSFC?: boolean;
11
- debug?: boolean;
12
- showGeneratedCode?: boolean;
13
- typeCheck?: boolean;
14
- tsConfig?: ts.CompilerOptions;
9
+ esbuildOptions?: Partial<TransformOptions>;
15
10
  }
16
- declare class TypeScriptChecker {
17
- private compilerOptions;
18
- private virtualFiles;
19
- private program;
20
- constructor(customOptions?: ts.CompilerOptions);
21
- addFile(fileName: string, content: string): void;
22
- private createCompilerHost;
23
- checkFile(fileName: string): string[];
24
- clear(): void;
25
- }
26
- export default function fynixPlugin(options?: FynixPluginOptions): any;
27
- export { fynixPlugin, TypeScriptChecker };
11
+ export default function fynixPlugin(options?: FynixPluginOptions): {
12
+ name: string;
13
+ enforce: string;
14
+ transform(code: string, id: string): Promise<{
15
+ code: string;
16
+ map: string | null;
17
+ } | null>;
18
+ handleHotUpdate(ctx: HmrContext): never[] | undefined;
19
+ config(): {
20
+ esbuild: {
21
+ jsxFactory: string;
22
+ jsxFragment: string;
23
+ jsxInject: string;
24
+ };
25
+ optimizeDeps: {
26
+ include: string[];
27
+ esbuildOptions: {
28
+ jsx: string;
29
+ jsxFactory: string;
30
+ jsxFragment: string;
31
+ };
32
+ };
33
+ resolve: {
34
+ extensions: string[];
35
+ };
36
+ };
37
+ buildStart(): void;
38
+ };
39
+ export { fynixPlugin };
28
40
  export type { FynixPluginOptions };
29
41
  //# sourceMappingURL=vite-plugin-res.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin-res.d.ts","sourceRoot":"","sources":["../../plugins/vite-plugin-res.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,IAAI,uBAAuB,EACjD,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAyBjC,UAAU,kBAAkB;IAK1B,UAAU,CAAC,EAAE,MAAM,CAAC;IAMpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAMrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAMnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAMnB,SAAS,CAAC,EAAE,OAAO,CAAC;IAKpB,cAAc,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAMlD,SAAS,CAAC,EAAE,OAAO,CAAC;IAMpB,KAAK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;oBAc1C,MAAM,MAAM,MAAM;;;;yBA2DnB,UAAU;;;;;;;;;;;;;;;;;;;;EA2ClC;AAKD,OAAO,EAAE,WAAW,EAAE,CAAC;AAKvB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
@@ -1,140 +1,9 @@
1
- import { transform, } from "esbuild";
1
+ import { transform } from "esbuild";
2
2
  import { normalizePath } from "vite";
3
- import * as ts from "typescript";
4
- import { parseFnxFile, validateParsedFnx, transformToComponent, } from "../parser/fnx-parser.js";
5
- const colors = {
6
- reset: "\x1b[0m",
7
- red: "\x1b[31m",
8
- green: "\x1b[32m",
9
- yellow: "\x1b[33m",
10
- blue: "\x1b[34m",
11
- magenta: "\x1b[35m",
12
- cyan: "\x1b[36m",
13
- gray: "\x1b[90m",
14
- bold: "\x1b[1m",
15
- };
16
- class TypeScriptChecker {
17
- constructor(customOptions) {
18
- this.virtualFiles = new Map();
19
- this.program = null;
20
- this.compilerOptions = {
21
- noEmit: true,
22
- strict: false,
23
- target: ts.ScriptTarget.ESNext,
24
- module: ts.ModuleKind.ESNext,
25
- jsx: ts.JsxEmit.Preserve,
26
- lib: ["lib.es2023.d.ts", "lib.dom.d.ts"],
27
- moduleResolution: ts.ModuleResolutionKind.Bundler,
28
- esModuleInterop: true,
29
- skipLibCheck: true,
30
- allowSyntheticDefaultImports: true,
31
- strictNullChecks: false,
32
- strictFunctionTypes: false,
33
- noImplicitAny: false,
34
- allowJs: true,
35
- checkJs: false,
36
- resolveJsonModule: true,
37
- isolatedModules: true,
38
- ...customOptions,
39
- };
40
- }
41
- addFile(fileName, content) {
42
- this.virtualFiles.set(fileName, content);
43
- this.program = null;
44
- }
45
- createCompilerHost() {
46
- const defaultHost = ts.createCompilerHost(this.compilerOptions);
47
- return {
48
- ...defaultHost,
49
- getSourceFile: (fileName, languageVersion) => {
50
- if (this.virtualFiles.has(fileName)) {
51
- const content = this.virtualFiles.get(fileName);
52
- if (content === undefined)
53
- return undefined;
54
- return ts.createSourceFile(fileName, content, languageVersion, true);
55
- }
56
- try {
57
- if (ts.sys.fileExists(fileName)) {
58
- const content = ts.sys.readFile(fileName);
59
- if (content !== undefined) {
60
- return ts.createSourceFile(fileName, content, languageVersion, true);
61
- }
62
- }
63
- }
64
- catch (err) {
65
- }
66
- return undefined;
67
- },
68
- fileExists: (fileName) => {
69
- if (this.virtualFiles.has(fileName))
70
- return true;
71
- return ts.sys.fileExists(fileName);
72
- },
73
- readFile: (fileName) => {
74
- if (this.virtualFiles.has(fileName)) {
75
- const content = this.virtualFiles.get(fileName);
76
- return content === undefined ? undefined : content;
77
- }
78
- const sysContent = ts.sys.readFile(fileName);
79
- return sysContent === undefined ? undefined : sysContent;
80
- },
81
- writeFile: () => { },
82
- };
83
- }
84
- checkFile(fileName) {
85
- const errors = [];
86
- try {
87
- if (!this.virtualFiles.has(fileName)) {
88
- return ["File not found in virtual file system"];
89
- }
90
- const compilerHost = this.createCompilerHost();
91
- if (!this.program) {
92
- this.program = ts.createProgram([fileName], this.compilerOptions, compilerHost);
93
- }
94
- const sourceFile = this.program.getSourceFile(fileName);
95
- if (!sourceFile) {
96
- return [`Could not get source file for ${fileName}`];
97
- }
98
- const diagnostics = [
99
- ...this.program.getSyntacticDiagnostics(sourceFile),
100
- ...this.program.getSemanticDiagnostics(sourceFile),
101
- ];
102
- const skipCodes = new Set([2307, 2792, 7016, 2304, 7026, 2874]);
103
- diagnostics.forEach((diagnostic) => {
104
- if (skipCodes.has(diagnostic.code)) {
105
- return;
106
- }
107
- if (diagnostic.file && diagnostic.start !== undefined) {
108
- const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
109
- const line = pos?.line ?? 0;
110
- const character = pos?.character ?? 0;
111
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
112
- errors.push(`${colors.yellow}Line ${line + 1}:${character + 1}${colors.reset} - ${message} ${colors.gray}(TS${diagnostic.code})${colors.reset}`);
113
- }
114
- else {
115
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
116
- errors.push(`${message} ${colors.gray}(TS${diagnostic.code})${colors.reset}`);
117
- }
118
- });
119
- }
120
- catch (error) {
121
- errors.push(`${colors.red}Type checking error:${colors.reset} ${error instanceof Error ? error.message : String(error)}`);
122
- }
123
- return errors;
124
- }
125
- clear() {
126
- this.virtualFiles.clear();
127
- this.program = null;
128
- }
129
- }
130
3
  export default function fynixPlugin(options = {}) {
131
- const { jsxFactory = "Fynix", jsxFragment = "Fynix.Fragment", include = [".ts", ".js", ".jsx", ".tsx", ".fnx"], exclude = ["node_modules"], sourcemap = true, esbuildOptions = {}, enableSFC = true, showGeneratedCode = false, typeCheck = false, tsConfig, } = options;
132
- let typeChecker = null;
133
- if (typeCheck) {
134
- typeChecker = new TypeScriptChecker(tsConfig);
135
- }
4
+ const { jsxFactory = "Fynix", jsxFragment = "Fynix.Fragment", include = [".ts", ".js", ".jsx", ".tsx", ".fnx"], exclude = ["node_modules"], sourcemap = true, esbuildOptions = {}, } = options;
136
5
  return {
137
- name: "vite-plugin-fynix-sfc",
6
+ name: "vite-plugin-fynix",
138
7
  enforce: "pre",
139
8
  async transform(code, id) {
140
9
  const normalizedId = normalizePath(id);
@@ -149,72 +18,20 @@ export default function fynixPlugin(options = {}) {
149
18
  ctx.addWatchFile(id);
150
19
  }
151
20
  try {
152
- let codeToTransform = code;
153
21
  let loader = "tsx";
154
- let shouldTypeCheck = false;
155
- if (normalizedId.endsWith(".fnx") && enableSFC) {
156
- const parsed = parseFnxFile(code);
157
- validateParsedFnx(parsed, normalizedId);
158
- const transformResult = transformToComponent(parsed, {
159
- filePath: normalizedId,
160
- jsxFactory,
161
- includeStyleInjection: true,
162
- includeMetaInjection: true,
163
- });
164
- codeToTransform = transformResult.code;
165
- if (showGeneratedCode) {
166
- console.log(`\n${colors.cyan}${"=".repeat(80)}${colors.reset}`);
167
- console.log(`${colors.cyan}[Fynix SFC]${colors.reset} Generated code for: ${colors.gray}${normalizedId}${colors.reset}`);
168
- console.log(`${colors.cyan}${"=".repeat(80)}${colors.reset}`);
169
- console.log(codeToTransform);
170
- console.log(`${colors.cyan}${"=".repeat(80)}${colors.reset}\n`);
171
- }
172
- shouldTypeCheck = typeCheck && parsed.logicLang === "ts";
173
- loader = parsed.logicLang === "ts" ? "tsx" : "jsx";
174
- if (shouldTypeCheck && typeChecker) {
175
- const virtualFileName = normalizedId.replace(/\.fnx$/, ".virtual.tsx");
176
- typeChecker.addFile(virtualFileName, codeToTransform);
177
- const typeErrors = typeChecker.checkFile(virtualFileName);
178
- if (typeErrors.length > 0) {
179
- console.error(`\n${colors.red}${colors.bold}[Fynix SFC] TypeScript Errors${colors.reset} in ${colors.cyan}${normalizedId}${colors.reset}:`);
180
- typeErrors.forEach((error) => console.error(` ${error}`));
181
- console.error("");
182
- if (process.env.NODE_ENV === "production") {
183
- throw new Error(`TypeScript errors in ${normalizedId}`);
184
- }
185
- }
186
- shouldTypeCheck = false;
187
- }
22
+ if (normalizedId.endsWith(".ts") || normalizedId.endsWith(".fnx")) {
23
+ loader = "tsx";
188
24
  }
189
- else {
190
- if (normalizedId.endsWith(".ts")) {
191
- loader = "ts";
192
- shouldTypeCheck = typeCheck;
193
- }
194
- else if (normalizedId.endsWith(".tsx")) {
195
- loader = "tsx";
196
- shouldTypeCheck = typeCheck;
197
- }
198
- else if (normalizedId.endsWith(".jsx")) {
199
- loader = "jsx";
200
- }
201
- else if (normalizedId.endsWith(".js")) {
202
- loader = "js";
203
- }
25
+ else if (normalizedId.endsWith(".tsx")) {
26
+ loader = "tsx";
27
+ }
28
+ else if (normalizedId.endsWith(".jsx")) {
29
+ loader = "jsx";
204
30
  }
205
- if (shouldTypeCheck && typeChecker) {
206
- typeChecker.addFile(normalizedId, codeToTransform);
207
- const typeErrors = typeChecker.checkFile(normalizedId);
208
- if (typeErrors.length > 0) {
209
- console.error(`\n${colors.red}${colors.bold}[Fynix SFC] TypeScript Errors${colors.reset} in ${colors.cyan}${normalizedId}${colors.reset}:`);
210
- typeErrors.forEach((error) => console.error(` ${error}`));
211
- console.error("");
212
- if (process.env.NODE_ENV === "production") {
213
- throw new Error(`TypeScript errors in ${normalizedId}`);
214
- }
215
- }
31
+ else if (normalizedId.endsWith(".js")) {
32
+ loader = "jsx";
216
33
  }
217
- const result = await transform(codeToTransform, {
34
+ const result = await transform(code, {
218
35
  loader,
219
36
  jsxFactory,
220
37
  jsxFragment,
@@ -231,8 +48,6 @@ export default function fynixPlugin(options = {}) {
231
48
  }
232
49
  catch (error) {
233
50
  const err = error;
234
- console.error(`\n${colors.red}${colors.bold}[Fynix SFC] Transform Error${colors.reset} in ${colors.cyan}${id}${colors.reset}:`);
235
- console.error(` ${colors.red}${err.message}${colors.reset}\n`);
236
51
  const ctx = this;
237
52
  if (typeof ctx.error === "function") {
238
53
  ctx.error({
@@ -252,10 +67,6 @@ export default function fynixPlugin(options = {}) {
252
67
  const normalizedFile = normalizePath(file);
253
68
  const shouldReload = include.some((ext) => normalizedFile.endsWith(ext));
254
69
  if (shouldReload) {
255
- console.log(`${colors.green}[HMR]${colors.reset} ${colors.gray}${normalizedFile}${colors.reset}`);
256
- if (typeChecker) {
257
- typeChecker.clear();
258
- }
259
70
  server.ws.send({
260
71
  type: "full-reload",
261
72
  path: "*",
@@ -265,11 +76,11 @@ export default function fynixPlugin(options = {}) {
265
76
  return undefined;
266
77
  },
267
78
  config() {
268
- const config = {
79
+ return {
269
80
  esbuild: {
270
81
  jsxFactory,
271
82
  jsxFragment,
272
- jsxInject: `import { ${jsxFactory} } from 'fynixui'`,
83
+ jsxInject: `import { ${jsxFactory} } from 'fynixoui'`,
273
84
  },
274
85
  optimizeDeps: {
275
86
  include: ["fynixui"],
@@ -283,22 +94,10 @@ export default function fynixPlugin(options = {}) {
283
94
  extensions: [".fnx", ".ts", ".tsx", ".js", ".jsx", ".json"],
284
95
  },
285
96
  };
286
- return config;
287
97
  },
288
98
  buildStart() {
289
- console.log(`${colors.cyan}[vite-plugin-fynix-sfc]${colors.reset} Initialized`);
290
- if (enableSFC) {
291
- console.log(`${colors.cyan}[vite-plugin-fynix-sfc]${colors.reset} SFC support: ${colors.green}enabled${colors.reset}`);
292
- }
293
- if (typeCheck) {
294
- console.log(`${colors.cyan}[vite-plugin-fynix-sfc]${colors.reset} Type checking: ${colors.green}enabled${colors.reset}`);
295
- }
296
- },
297
- buildEnd() {
298
- if (typeChecker) {
299
- typeChecker.clear();
300
- }
99
+ console.log(`[vite-plugin-fynix] Initialized with JSX factory: ${jsxFactory}`);
301
100
  },
302
101
  };
303
102
  }
304
- export { fynixPlugin, TypeScriptChecker };
103
+ export { fynixPlugin };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../plugins/vite-plugin-res.ts"],
4
- "sourcesContent": ["import {\r\n transform,\r\n type TransformOptions as EsbuildTransformOptions,\r\n} from \"esbuild\";\r\nimport type { HmrContext, UserConfig } from \"vite\";\r\nimport { normalizePath } from \"vite\";\r\nimport * as ts from \"typescript\";\r\nimport {\r\n parseFnxFile,\r\n validateParsedFnx,\r\n transformToComponent,\r\n} from \"../parser/fnx-parser.js\";\r\n\r\n/**\r\n * ANSI color codes for terminal output\r\n */\r\nconst colors = {\r\n reset: \"\\x1b[0m\",\r\n red: \"\\x1b[31m\",\r\n green: \"\\x1b[32m\",\r\n yellow: \"\\x1b[33m\",\r\n blue: \"\\x1b[34m\",\r\n magenta: \"\\x1b[35m\",\r\n cyan: \"\\x1b[36m\",\r\n gray: \"\\x1b[90m\",\r\n bold: \"\\x1b[1m\",\r\n};\r\n\r\n/**\r\n * Vite plugin options for Fynix with SFC support\r\n */\r\ninterface FynixPluginOptions {\r\n /**\r\n * JSX factory function name\r\n * @default \"Fynix\"\r\n */\r\n jsxFactory?: string;\r\n\r\n /**\r\n * JSX fragment factory name\r\n * @default \"Fynix.Fragment\"\r\n */\r\n jsxFragment?: string;\r\n\r\n /**\r\n * File extensions to transform\r\n * @default [\".ts\", \".js\", \".jsx\", \".tsx\", \".fnx\"]\r\n */\r\n include?: string[];\r\n\r\n /**\r\n * Paths to exclude from transformation\r\n * @default [\"node_modules\"]\r\n */\r\n exclude?: string[];\r\n\r\n /**\r\n * Enable source maps\r\n * @default true\r\n */\r\n sourcemap?: boolean;\r\n\r\n /**\r\n * Custom esbuild transform options\r\n */\r\n esbuildOptions?: Partial<EsbuildTransformOptions>;\r\n\r\n /**\r\n * Enable SFC parsing for .fnx files\r\n * @default true\r\n */\r\n enableSFC?: boolean;\r\n\r\n /**\r\n * Enable debug logging\r\n * @default false\r\n */\r\n debug?: boolean;\r\n\r\n /**\r\n * Show generated code in console (useful for debugging SFC transformation)\r\n * @default false\r\n */\r\n showGeneratedCode?: boolean;\r\n\r\n /**\r\n * Enable TypeScript type checking (slower but catches type errors)\r\n * @default false\r\n */\r\n typeCheck?: boolean;\r\n\r\n /**\r\n * TypeScript compiler options override\r\n */\r\n tsConfig?: ts.CompilerOptions;\r\n}\r\n\r\n/**\r\n * Extended context type that includes Vite's transform context methods\r\n */\r\ninterface TransformContext {\r\n addWatchFile?: (id: string) => void;\r\n error?: (error: { message: string; stack?: string; id?: string }) => void;\r\n}\r\n\r\n/**\r\n * Improved type checker with better error handling and virtual file system\r\n */\r\nclass TypeScriptChecker {\r\n private compilerOptions: ts.CompilerOptions;\r\n private virtualFiles: Map<string, string> = new Map();\r\n private program: ts.Program | null = null;\r\n\r\n constructor(customOptions?: ts.CompilerOptions) {\r\n this.compilerOptions = {\r\n noEmit: true,\r\n strict: false,\r\n target: ts.ScriptTarget.ESNext,\r\n module: ts.ModuleKind.ESNext,\r\n jsx: ts.JsxEmit.Preserve,\r\n lib: [\"lib.es2023.d.ts\", \"lib.dom.d.ts\"],\r\n moduleResolution: ts.ModuleResolutionKind.Bundler,\r\n esModuleInterop: true,\r\n skipLibCheck: true,\r\n allowSyntheticDefaultImports: true,\r\n strictNullChecks: false,\r\n strictFunctionTypes: false,\r\n noImplicitAny: false,\r\n allowJs: true,\r\n checkJs: false,\r\n resolveJsonModule: true,\r\n isolatedModules: true,\r\n ...customOptions,\r\n };\r\n }\r\n\r\n addFile(fileName: string, content: string): void {\r\n this.virtualFiles.set(fileName, content);\r\n this.program = null;\r\n }\r\n\r\n private createCompilerHost(): ts.CompilerHost {\r\n const defaultHost = ts.createCompilerHost(this.compilerOptions);\r\n\r\n return {\r\n ...defaultHost,\r\n getSourceFile: (fileName, languageVersion) => {\r\n if (this.virtualFiles.has(fileName)) {\r\n const content = this.virtualFiles.get(fileName);\r\n if (content === undefined) return undefined;\r\n return ts.createSourceFile(fileName, content, languageVersion, true);\r\n }\r\n\r\n try {\r\n if (ts.sys.fileExists(fileName)) {\r\n const content = ts.sys.readFile(fileName);\r\n if (content !== undefined) {\r\n return ts.createSourceFile(\r\n fileName,\r\n content,\r\n languageVersion,\r\n true\r\n );\r\n }\r\n }\r\n } catch (err) {\r\n // Silent fail\r\n }\r\n\r\n return undefined;\r\n },\r\n fileExists: (fileName) => {\r\n if (this.virtualFiles.has(fileName)) return true;\r\n return ts.sys.fileExists(fileName);\r\n },\r\n readFile: (fileName) => {\r\n if (this.virtualFiles.has(fileName)) {\r\n const content = this.virtualFiles.get(fileName);\r\n return content === undefined ? undefined : content;\r\n }\r\n const sysContent = ts.sys.readFile(fileName);\r\n return sysContent === undefined ? undefined : sysContent;\r\n },\r\n writeFile: () => { },\r\n };\r\n }\r\n\r\n checkFile(fileName: string): string[] {\r\n const errors: string[] = [];\r\n\r\n try {\r\n if (!this.virtualFiles.has(fileName)) {\r\n return [\"File not found in virtual file system\"];\r\n }\r\n\r\n const compilerHost = this.createCompilerHost();\r\n\r\n if (!this.program) {\r\n this.program = ts.createProgram(\r\n [fileName],\r\n this.compilerOptions,\r\n compilerHost\r\n );\r\n }\r\n\r\n const sourceFile = this.program.getSourceFile(fileName);\r\n if (!sourceFile) {\r\n return [`Could not get source file for ${fileName}`];\r\n }\r\n\r\n const diagnostics = [\r\n ...this.program.getSyntacticDiagnostics(sourceFile),\r\n ...this.program.getSemanticDiagnostics(sourceFile),\r\n ];\r\n\r\n const skipCodes = new Set([2307, 2792, 7016, 2304, 7026, 2874]);\r\n\r\n diagnostics.forEach((diagnostic) => {\r\n if (skipCodes.has(diagnostic.code)) {\r\n return;\r\n }\r\n\r\n if (diagnostic.file && diagnostic.start !== undefined) {\r\n const pos = diagnostic.file.getLineAndCharacterOfPosition(\r\n diagnostic.start\r\n );\r\n const line = pos?.line ?? 0;\r\n const character = pos?.character ?? 0;\r\n const message = ts.flattenDiagnosticMessageText(\r\n diagnostic.messageText,\r\n \"\\n\"\r\n );\r\n errors.push(\r\n `${colors.yellow}Line ${line + 1}:${character + 1}${colors.reset} - ${message} ${colors.gray}(TS${diagnostic.code})${colors.reset}`\r\n );\r\n } else {\r\n const message = ts.flattenDiagnosticMessageText(\r\n diagnostic.messageText,\r\n \"\\n\"\r\n );\r\n errors.push(\r\n `${message} ${colors.gray}(TS${diagnostic.code})${colors.reset}`\r\n );\r\n }\r\n });\r\n } catch (error) {\r\n errors.push(\r\n `${colors.red}Type checking error:${colors.reset} ${error instanceof Error ? error.message : String(error)}`\r\n );\r\n }\r\n\r\n return errors;\r\n }\r\n\r\n clear(): void {\r\n this.virtualFiles.clear();\r\n this.program = null;\r\n }\r\n}\r\n\r\n/**\r\n * Vite plugin for Fynix framework with improved SFC support\r\n */\r\nexport default function fynixPlugin(options: FynixPluginOptions = {}): any {\r\n const {\r\n jsxFactory = \"Fynix\",\r\n jsxFragment = \"Fynix.Fragment\",\r\n include = [\".ts\", \".js\", \".jsx\", \".tsx\", \".fnx\"],\r\n exclude = [\"node_modules\"],\r\n sourcemap = true,\r\n esbuildOptions = {},\r\n enableSFC = true,\r\n showGeneratedCode = false,\r\n typeCheck = false,\r\n tsConfig,\r\n } = options;\r\n\r\n let typeChecker: TypeScriptChecker | null = null;\r\n\r\n if (typeCheck) {\r\n typeChecker = new TypeScriptChecker(tsConfig);\r\n }\r\n\r\n return {\r\n name: \"vite-plugin-fynix-sfc\",\r\n enforce: \"pre\" as const,\r\n\r\n async transform(code: string, id: string) {\r\n const normalizedId = normalizePath(id);\r\n\r\n const shouldExclude = exclude.some((pattern) =>\r\n normalizedId.includes(pattern)\r\n );\r\n if (shouldExclude) return null;\r\n\r\n const shouldInclude = include.some((ext) => normalizedId.endsWith(ext));\r\n if (!shouldInclude) return null;\r\n\r\n const ctx = this as unknown as TransformContext;\r\n if (typeof ctx.addWatchFile === \"function\") {\r\n ctx.addWatchFile(id);\r\n }\r\n\r\n try {\r\n let codeToTransform = code;\r\n let loader: EsbuildTransformOptions[\"loader\"] = \"tsx\";\r\n let shouldTypeCheck = false;\r\n\r\n if (normalizedId.endsWith(\".fnx\") && enableSFC) {\r\n const parsed = parseFnxFile(code);\r\n validateParsedFnx(parsed, normalizedId);\r\n\r\n const transformResult = transformToComponent(parsed, {\r\n filePath: normalizedId,\r\n jsxFactory,\r\n includeStyleInjection: true,\r\n includeMetaInjection: true,\r\n });\r\n\r\n codeToTransform = transformResult.code;\r\n\r\n if (showGeneratedCode) {\r\n console.log(`\\n${colors.cyan}${\"=\".repeat(80)}${colors.reset}`);\r\n console.log(\r\n `${colors.cyan}[Fynix SFC]${colors.reset} Generated code for: ${colors.gray}${normalizedId}${colors.reset}`\r\n );\r\n console.log(`${colors.cyan}${\"=\".repeat(80)}${colors.reset}`);\r\n console.log(codeToTransform);\r\n console.log(`${colors.cyan}${\"=\".repeat(80)}${colors.reset}\\n`);\r\n }\r\n\r\n shouldTypeCheck = typeCheck && parsed.logicLang === \"ts\";\r\n loader = parsed.logicLang === \"ts\" ? \"tsx\" : \"jsx\";\r\n\r\n if (shouldTypeCheck && typeChecker) {\r\n const virtualFileName = normalizedId.replace(\r\n /\\.fnx$/,\r\n \".virtual.tsx\"\r\n );\r\n typeChecker.addFile(virtualFileName, codeToTransform);\r\n const typeErrors = typeChecker.checkFile(virtualFileName);\r\n\r\n if (typeErrors.length > 0) {\r\n console.error(\r\n `\\n${colors.red}${colors.bold}[Fynix SFC] TypeScript Errors${colors.reset} in ${colors.cyan}${normalizedId}${colors.reset}:`\r\n );\r\n typeErrors.forEach((error) => console.error(` ${error}`));\r\n console.error(\"\");\r\n\r\n if (process.env.NODE_ENV === \"production\") {\r\n throw new Error(`TypeScript errors in ${normalizedId}`);\r\n }\r\n }\r\n\r\n shouldTypeCheck = false;\r\n }\r\n } else {\r\n if (normalizedId.endsWith(\".ts\")) {\r\n loader = \"ts\";\r\n shouldTypeCheck = typeCheck;\r\n } else if (normalizedId.endsWith(\".tsx\")) {\r\n loader = \"tsx\";\r\n shouldTypeCheck = typeCheck;\r\n } else if (normalizedId.endsWith(\".jsx\")) {\r\n loader = \"jsx\";\r\n } else if (normalizedId.endsWith(\".js\")) {\r\n loader = \"js\";\r\n }\r\n }\r\n\r\n if (shouldTypeCheck && typeChecker) {\r\n typeChecker.addFile(normalizedId, codeToTransform);\r\n const typeErrors = typeChecker.checkFile(normalizedId);\r\n\r\n if (typeErrors.length > 0) {\r\n console.error(\r\n `\\n${colors.red}${colors.bold}[Fynix SFC] TypeScript Errors${colors.reset} in ${colors.cyan}${normalizedId}${colors.reset}:`\r\n );\r\n typeErrors.forEach((error) => console.error(` ${error}`));\r\n console.error(\"\");\r\n\r\n if (process.env.NODE_ENV === \"production\") {\r\n throw new Error(`TypeScript errors in ${normalizedId}`);\r\n }\r\n }\r\n }\r\n\r\n const result = await transform(codeToTransform, {\r\n loader,\r\n jsxFactory,\r\n jsxFragment,\r\n sourcemap,\r\n sourcefile: id,\r\n target: \"esnext\",\r\n format: \"esm\",\r\n ...esbuildOptions,\r\n });\r\n\r\n return {\r\n code: result.code,\r\n map: result.map || null,\r\n };\r\n } catch (error) {\r\n const err = error as Error;\r\n console.error(\r\n `\\n${colors.red}${colors.bold}[Fynix SFC] Transform Error${colors.reset} in ${colors.cyan}${id}${colors.reset}:`\r\n );\r\n console.error(` ${colors.red}${err.message}${colors.reset}\\n`);\r\n\r\n const ctx = this as unknown as TransformContext;\r\n if (typeof ctx.error === \"function\") {\r\n ctx.error({\r\n message: `Failed to transform ${id}: ${err.message}`,\r\n stack: err.stack,\r\n id,\r\n });\r\n } else {\r\n throw err;\r\n }\r\n return null;\r\n }\r\n },\r\n\r\n handleHotUpdate(ctx: HmrContext) {\r\n const { file, server } = ctx;\r\n const normalizedFile = normalizePath(file);\r\n const shouldReload = include.some((ext) => normalizedFile.endsWith(ext));\r\n\r\n if (shouldReload) {\r\n console.log(\r\n `${colors.green}[HMR]${colors.reset} ${colors.gray}${normalizedFile}${colors.reset}`\r\n );\r\n\r\n if (typeChecker) {\r\n typeChecker.clear();\r\n }\r\n\r\n server.ws.send({\r\n type: \"full-reload\",\r\n path: \"*\",\r\n });\r\n return [];\r\n }\r\n\r\n return undefined;\r\n },\r\n\r\n config() {\r\n const config: Omit<UserConfig, \"plugins\"> = {\r\n esbuild: {\r\n jsxFactory,\r\n jsxFragment,\r\n jsxInject: `import { ${jsxFactory} } from 'fynixui'`,\r\n },\r\n optimizeDeps: {\r\n include: [\"fynixui\"],\r\n esbuildOptions: {\r\n jsx: \"transform\",\r\n jsxFactory,\r\n jsxFragment,\r\n },\r\n },\r\n resolve: {\r\n extensions: [\".fnx\", \".ts\", \".tsx\", \".js\", \".jsx\", \".json\"],\r\n },\r\n };\r\n\r\n return config;\r\n },\r\n\r\n buildStart() {\r\n console.log(\r\n `${colors.cyan}[vite-plugin-fynix-sfc]${colors.reset} Initialized`\r\n );\r\n if (enableSFC) {\r\n console.log(\r\n `${colors.cyan}[vite-plugin-fynix-sfc]${colors.reset} SFC support: ${colors.green}enabled${colors.reset}`\r\n );\r\n }\r\n if (typeCheck) {\r\n console.log(\r\n `${colors.cyan}[vite-plugin-fynix-sfc]${colors.reset} Type checking: ${colors.green}enabled${colors.reset}`\r\n );\r\n }\r\n },\r\n\r\n buildEnd() {\r\n if (typeChecker) {\r\n typeChecker.clear();\r\n }\r\n },\r\n };\r\n}\r\n\r\nexport { fynixPlugin, TypeScriptChecker };\r\nexport type { FynixPluginOptions };\r\n"],
5
- "mappings": ";;AAAA;AA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AAmB,OAAO,KAAK,UAAU,OAAO,KAAK;AAAA,QAC3G;AAAA,MACF;AAAA,IACF;AAAA,IAEA,WAAW;AACT,UAAI,aAAa;AACf,oBAAY,MAAM;AAAA,MACpB;AAAA,IACF;AAAA,EACF;AACF;AArOwB;",
4
+ "sourcesContent": ["import { transform, type TransformOptions } from \"esbuild\";\r\nimport type { HmrContext } from \"vite\";\r\nimport { normalizePath } from \"vite\";\r\n\r\n/**\r\n * Vite plugin options for Fynix\r\n */\r\ninterface FynixPluginOptions {\r\n /**\r\n * JSX factory function name\r\n * @default \"Fynix\"\r\n */\r\n jsxFactory?: string;\r\n\r\n /**\r\n * JSX fragment factory name\r\n * @default \"Fynix.Fragment\"\r\n */\r\n jsxFragment?: string;\r\n\r\n /**\r\n * File extensions to transform\r\n * @default [\".ts\", \".js\", \".jsx\", \".tsx\", \".fnx\"]\r\n */\r\n include?: string[];\r\n\r\n /**\r\n * Paths to exclude from transformation\r\n * @default [\"node_modules\"]\r\n */\r\n exclude?: string[];\r\n\r\n /**\r\n * Enable source maps\r\n * @default true\r\n */\r\n sourcemap?: boolean;\r\n\r\n /**\r\n * Custom esbuild transform options\r\n */\r\n esbuildOptions?: Partial<TransformOptions>;\r\n}\r\n\r\n/**\r\n * Extended context type that includes Vite's transform context methods\r\n */\r\ninterface TransformContext {\r\n addWatchFile?: (id: string) => void;\r\n error?: (error: { message: string; stack?: string; id?: string }) => void;\r\n}\r\n\r\n/**\r\n * Vite plugin for Fynix framework\r\n * Transforms JSX/TSX files using esbuild with custom JSX pragma\r\n */\r\nexport default function fynixPlugin(options: FynixPluginOptions = {}) {\r\n const {\r\n jsxFactory = \"Fynix\",\r\n jsxFragment = \"Fynix.Fragment\",\r\n include = [\".ts\", \".js\", \".jsx\", \".tsx\", \".fnx\"],\r\n exclude = [\"node_modules\"],\r\n sourcemap = true,\r\n esbuildOptions = {},\r\n } = options;\r\n\r\n return {\r\n name: \"vite-plugin-fynix\",\r\n enforce: \"pre\", // must be 'pre', 'post', or undefined\r\n\r\n async transform(code: string, id: string) {\r\n const normalizedId = normalizePath(id);\r\n const shouldExclude = exclude.some((pattern) =>\r\n normalizedId.includes(pattern)\r\n );\r\n if (shouldExclude) return null;\r\n const shouldInclude = include.some((ext) => normalizedId.endsWith(ext));\r\n if (!shouldInclude) return null;\r\n\r\n // Type-safe way to access Vite context methods\r\n const ctx = this as unknown as TransformContext;\r\n if (typeof ctx.addWatchFile === \"function\") {\r\n ctx.addWatchFile(id);\r\n }\r\n\r\n try {\r\n let loader: TransformOptions[\"loader\"] = \"tsx\";\r\n if (normalizedId.endsWith(\".ts\") || normalizedId.endsWith(\".fnx\")) {\r\n loader = \"tsx\";\r\n } else if (normalizedId.endsWith(\".tsx\")) {\r\n loader = \"tsx\";\r\n } else if (normalizedId.endsWith(\".jsx\")) {\r\n loader = \"jsx\";\r\n } else if (normalizedId.endsWith(\".js\")) {\r\n loader = \"jsx\";\r\n }\r\n\r\n const result = await transform(code, {\r\n loader,\r\n jsxFactory,\r\n jsxFragment,\r\n sourcemap,\r\n sourcefile: id,\r\n target: \"esnext\",\r\n format: \"esm\",\r\n ...esbuildOptions,\r\n });\r\n\r\n return {\r\n code: result.code,\r\n map: result.map || null,\r\n };\r\n } catch (error) {\r\n const err = error as Error;\r\n const ctx = this as unknown as TransformContext;\r\n\r\n if (typeof ctx.error === \"function\") {\r\n ctx.error({\r\n message: `Failed to transform ${id}: ${err.message}`,\r\n stack: err.stack,\r\n id,\r\n });\r\n } else {\r\n throw err;\r\n }\r\n return null;\r\n }\r\n },\r\n\r\n handleHotUpdate(ctx: HmrContext) {\r\n const { file, server } = ctx;\r\n const normalizedFile = normalizePath(file);\r\n const shouldReload = include.some((ext) => normalizedFile.endsWith(ext));\r\n\r\n if (shouldReload) {\r\n server.ws.send({\r\n type: \"full-reload\",\r\n path: \"*\",\r\n });\r\n return [];\r\n }\r\n\r\n return undefined;\r\n },\r\n\r\n config() {\r\n return {\r\n esbuild: {\r\n jsxFactory,\r\n jsxFragment,\r\n jsxInject: `import { ${jsxFactory} } from 'fynixoui'`,\r\n },\r\n optimizeDeps: {\r\n include: [\"fynixui\"],\r\n esbuildOptions: {\r\n jsx: \"transform\",\r\n jsxFactory,\r\n jsxFragment,\r\n },\r\n },\r\n resolve: {\r\n extensions: [\".fnx\", \".ts\", \".tsx\", \".js\", \".jsx\", \".json\"],\r\n },\r\n };\r\n },\r\n\r\n buildStart() {\r\n console.log(\r\n `[vite-plugin-fynix] Initialized with JSX factory: ${jsxFactory}`\r\n );\r\n },\r\n };\r\n}\r\n\r\n/**\r\n * Named export for convenience\r\n */\r\nexport { fynixPlugin };\r\n\r\n/**\r\n * Export types for TypeScript users\r\n */\r\nexport type { FynixPluginOptions };\r\n"],
5
+ "mappings": ";;AAAA,SAAS,iBAAwC;AAEjD,SAAS,qBAAqB;AAsDf,SAAR,YAA6B,UAA8B,CAAC,GAAG;AACpE,QAAM;AAAA,IACJ,aAAa;AAAA,IACb,cAAc;AAAA,IACd,UAAU,CAAC,OAAO,OAAO,QAAQ,QAAQ,MAAM;AAAA,IAC/C,UAAU,CAAC,cAAc;AAAA,IACzB,YAAY;AAAA,IACZ,iBAAiB,CAAC;AAAA,EACpB,IAAI;AAEJ,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA;AAAA,IAET,MAAM,UAAU,MAAc,IAAY;AACxC,YAAM,eAAe,cAAc,EAAE;AACrC,YAAM,gBAAgB,QAAQ;AAAA,QAAK,CAAC,YAClC,aAAa,SAAS,OAAO;AAAA,MAC/B;AACA,UAAI,cAAe,QAAO;AAC1B,YAAM,gBAAgB,QAAQ,KAAK,CAAC,QAAQ,aAAa,SAAS,GAAG,CAAC;AACtE,UAAI,CAAC,cAAe,QAAO;AAG3B,YAAM,MAAM;AACZ,UAAI,OAAO,IAAI,iBAAiB,YAAY;AAC1C,YAAI,aAAa,EAAE;AAAA,MACrB;AAEA,UAAI;AACF,YAAI,SAAqC;AACzC,YAAI,aAAa,SAAS,KAAK,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,gBAAgB;AAAA,YACd,KAAK;AAAA,YACL;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,SAAS;AAAA,UACP,YAAY,CAAC,QAAQ,OAAO,QAAQ,OAAO,QAAQ,OAAO;AAAA,QAC5D;AAAA,MACF;AAAA,IACF;AAAA,IAEA,aAAa;AACX,cAAQ;AAAA,QACN,qDAAqD,UAAU;AAAA,MACjE;AAAA,IACF;AAAA,EACF;AACF;AApHwB;",
6
6
  "names": ["ctx"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fynixui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "Core package for Fynix UI framework - A lightweight, reactive UI framework with TypeScript support.",
6
6
  "main": "./dist/fynix/index.js",
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  * SOFTWARE.
22
22
  */
23
23
 
24
- declare module "@fynixorg/ui" {
24
+ declare module "fynixui" {
25
25
  // ============================================
26
26
  // Core Types
27
27
  // ============================================
package/types/jsx.d.ts CHANGED
@@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
25
  // types/jsx.d.ts - JSX Namespace for Fynix Framework
26
26
  // =====================================================
27
27
 
28
- import type { VNode } from "./fnx";
28
+ import type { VNode } from "./fynix-ui";
29
29
 
30
30
  /**
31
31
  * Fynix reactive event handler type
@@ -496,14 +496,6 @@ declare module "*?inline" {
496
496
  export default content;
497
497
  }
498
498
 
499
- /**
500
- * Fynix-specific module patterns
501
- */
502
- declare module "*.fnx" {
503
- const Component: any;
504
- export default Component;
505
- }
506
-
507
499
  /**
508
500
  * TypeScript/JavaScript module re-declarations
509
501
  * (already in global.d.ts but keeping for completeness)
package/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Fynix Core
2
-
3
- This is the core package for the Fynix UI framework. It contains the essential runtime, hooks, context, and utilities for building Fynix-based applications.
4
-
5
- ## Structure
6
- - `runtime.js`: Main runtime logic
7
- - `context/`: Context management
8
- - `custom/`: Custom UI elements
9
- - `error/`: Error overlays and handling
10
- - `fynix/`: Fynix core logic
11
- - `hooks/`: Reactivity and utility hooks
12
- - `plugins/`: Plugins (e.g., Vite integration)
13
- - `router/`: Routing logic
14
- - `types/`: TypeScript type definitions
15
- - `global.d.ts`: Global type extensions
16
-
17
- ## Usage
18
- Install via npm after publishing:
19
-
20
- ```sh
21
- npm install fynix-core
22
- ```
23
-
24
- Then import in your project:
25
-
26
- ```js
27
- import { ... } from 'fynix-core';
28
- ```
29
-
30
- ## Development
31
- - Ensure all files are included in `package.json`.
32
- - Update type definitions in `global.d.ts` as needed.
33
- - Export all public APIs via the `exports` field in `package.json`.
34
-
35
- ## License
36
- MIT
package/dist/README.md DELETED
@@ -1,36 +0,0 @@
1
- # Fynix Core
2
-
3
- This is the core package for the Fynix UI framework. It contains the essential runtime, hooks, context, and utilities for building Fynix-based applications.
4
-
5
- ## Structure
6
- - `runtime.js`: Main runtime logic
7
- - `context/`: Context management
8
- - `custom/`: Custom UI elements
9
- - `error/`: Error overlays and handling
10
- - `fynix/`: Fynix core logic
11
- - `hooks/`: Reactivity and utility hooks
12
- - `plugins/`: Plugins (e.g., Vite integration)
13
- - `router/`: Routing logic
14
- - `types/`: TypeScript type definitions
15
- - `global.d.ts`: Global type extensions
16
-
17
- ## Usage
18
- Install via npm after publishing:
19
-
20
- ```sh
21
- npm install fynix-core
22
- ```
23
-
24
- Then import in your project:
25
-
26
- ```js
27
- import { ... } from 'fynix-core';
28
- ```
29
-
30
- ## Development
31
- - Ensure all files are included in `package.json`.
32
- - Update type definitions in `global.d.ts` as needed.
33
- - Export all public APIs via the `exports` field in `package.json`.
34
-
35
- ## License
36
- MIT
@@ -1,49 +0,0 @@
1
- export interface SourceMap {
2
- originalToTransformed: Map<number, number>;
3
- transformedToOriginal: Map<number, number>;
4
- }
5
- export interface ParsedFnxFile {
6
- logic: string;
7
- view: string;
8
- style: string;
9
- logicLang: "ts" | "js";
10
- hasLogic: boolean;
11
- hasView: boolean;
12
- hasStyle: boolean;
13
- isStyleScoped: boolean;
14
- imports: string[];
15
- exports: string[];
16
- logicStartLine: number;
17
- viewStartLine: number;
18
- styleStartLine: number;
19
- }
20
- export interface TransformResult {
21
- code: string;
22
- lineMap: number[];
23
- sourceMap: SourceMap;
24
- }
25
- export interface ParseOptions {
26
- debug?: boolean;
27
- logger?: (message: string) => void;
28
- }
29
- export interface TransformOptions extends ParseOptions {
30
- filePath: string;
31
- jsxFactory?: string;
32
- includeStyleInjection?: boolean;
33
- includeMetaInjection?: boolean;
34
- }
35
- export declare function parseFnxFile(source: string, options?: ParseOptions): ParsedFnxFile;
36
- export declare function validateParsedFnx(parsed: ParsedFnxFile, filePath: string): void;
37
- export declare function generateStyleId(filePath: string): string;
38
- export declare function scopeStyles(css: string, scopeId: string): string;
39
- export declare function buildSourceMap(originalContent: string, transformedContent: string, lineMap: number[]): SourceMap;
40
- export declare function transformToComponent(parsed: ParsedFnxFile, options: TransformOptions): TransformResult;
41
- export declare function transformToTsx(source: string, options?: ParseOptions): TransformResult;
42
- export declare function getLineAndCharacterOfPosition(text: string, pos: number): {
43
- line: number;
44
- character: number;
45
- };
46
- export declare function getPositionOfLineAndCharacter(text: string, line: number, character: number): number;
47
- export declare function mapTransformedToOriginal(position: number, transformedCode: string, originalContent: string, lineMap: number[], sourceMap: SourceMap): number;
48
- export declare function mapOriginalToTransformed(position: number, transformedCode: string, originalContent: string, lineMap: number[], sourceMap: SourceMap): number;
49
- //# sourceMappingURL=fnx-parser.d.ts.map