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.
- package/dist/fynix/index.d.ts +0 -1
- package/dist/fynix/index.d.ts.map +1 -1
- package/dist/fynix/index.js +0 -1
- package/dist/fynix/index.js.map +2 -2
- package/dist/package.json +1 -1
- package/dist/plugins/vite-plugin-res.d.ts +32 -20
- package/dist/plugins/vite-plugin-res.d.ts.map +1 -1
- package/dist/plugins/vite-plugin-res.js +17 -218
- package/dist/plugins/vite-plugin-res.js.map +2 -2
- package/package.json +1 -1
- package/types/fynix-ui.d.ts +1 -1
- package/types/jsx.d.ts +1 -1
- package/types/vite-env.d.ts +0 -8
- package/README.md +0 -36
- package/dist/README.md +0 -36
- package/dist/parser/fnx-parser.d.ts +0 -49
- package/dist/parser/fnx-parser.d.ts.map +0 -1
- package/dist/parser/fnx-parser.js +0 -483
- package/dist/parser/fnx-parser.js.map +0 -7
- package/dist/typescript-fynix-plugin/index.js +0 -1065
- package/dist/typescript-fynix-plugin/index.js.map +0 -7
- package/types/fnx.d.ts +0 -72
package/dist/fynix/index.d.ts
CHANGED
|
@@ -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
|
|
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"}
|
package/dist/fynix/index.js
CHANGED
package/dist/fynix/index.js.map
CHANGED
|
@@ -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
|
|
5
|
-
"mappings": "AAuBA,cAAc;AAEd,cAAc;AACd,SAAoB,WAAXA,gBAA8B;AACvC,SAAS,aAAa;
|
|
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,29 +1,41 @@
|
|
|
1
|
-
import { type TransformOptions
|
|
2
|
-
import
|
|
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<
|
|
10
|
-
enableSFC?: boolean;
|
|
11
|
-
debug?: boolean;
|
|
12
|
-
showGeneratedCode?: boolean;
|
|
13
|
-
typeCheck?: boolean;
|
|
14
|
-
tsConfig?: ts.CompilerOptions;
|
|
9
|
+
esbuildOptions?: Partial<TransformOptions>;
|
|
15
10
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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,
|
|
1
|
+
{"version":3,"file":"vite-plugin-res.d.ts","sourceRoot":"","sources":["../../plugins/vite-plugin-res.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAMvC,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,gBAAgB,CAAC,CAAC;CAC5C;AAcD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,OAAO,GAAE,kBAAuB;;;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
|
|
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 = {},
|
|
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
|
|
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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
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 (
|
|
206
|
-
|
|
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(
|
|
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
|
-
|
|
79
|
+
return {
|
|
269
80
|
esbuild: {
|
|
270
81
|
jsxFactory,
|
|
271
82
|
jsxFragment,
|
|
272
|
-
jsxInject: `import { ${jsxFactory} } from '
|
|
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(
|
|
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
|
|
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
|
|
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,KAAK,aAAa,SAAS,MAAM,GAAG;AACjE,mBAAS;AAAA,QACX,WAAW,aAAa,SAAS,MAAM,GAAG;AACxC,mBAAS;AAAA,QACX,WAAW,aAAa,SAAS,MAAM,GAAG;AACxC,mBAAS;AAAA,QACX,WAAW,aAAa,SAAS,KAAK,GAAG;AACvC,mBAAS;AAAA,QACX;AAEA,cAAM,SAAS,MAAM,UAAU,MAAM;AAAA,UACnC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY;AAAA,UACZ,QAAQ;AAAA,UACR,QAAQ;AAAA,UACR,GAAG;AAAA,QACL,CAAC;AAED,eAAO;AAAA,UACL,MAAM,OAAO;AAAA,UACb,KAAK,OAAO,OAAO;AAAA,QACrB;AAAA,MACF,SAAS,OAAO;AACd,cAAM,MAAM;AACZ,cAAMA,OAAM;AAEZ,YAAI,OAAOA,KAAI,UAAU,YAAY;AACnC,UAAAA,KAAI,MAAM;AAAA,YACR,SAAS,uBAAuB,EAAE,KAAK,IAAI,OAAO;AAAA,YAClD,OAAO,IAAI;AAAA,YACX;AAAA,UACF,CAAC;AAAA,QACH,OAAO;AACL,gBAAM;AAAA,QACR;AACA,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IAEA,gBAAgB,KAAiB;AAC/B,YAAM,EAAE,MAAM,OAAO,IAAI;AACzB,YAAM,iBAAiB,cAAc,IAAI;AACzC,YAAM,eAAe,QAAQ,KAAK,CAAC,QAAQ,eAAe,SAAS,GAAG,CAAC;AAEvE,UAAI,cAAc;AAChB,eAAO,GAAG,KAAK;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,QACR,CAAC;AACD,eAAO,CAAC;AAAA,MACV;AAEA,aAAO;AAAA,IACT;AAAA,IAEA,SAAS;AACP,aAAO;AAAA,QACL,SAAS;AAAA,UACP;AAAA,UACA;AAAA,UACA,WAAW,YAAY,UAAU;AAAA,QACnC;AAAA,QACA,cAAc;AAAA,UACZ,SAAS,CAAC,SAAS;AAAA,UACnB,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
package/types/fynix-ui.d.ts
CHANGED
|
@@ -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 "
|
|
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 "./
|
|
28
|
+
import type { VNode } from "./fynix-ui";
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Fynix reactive event handler type
|
package/types/vite-env.d.ts
CHANGED
|
@@ -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
|