@wsxjs/wsx-vite-plugin 0.0.10 → 0.0.11
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/package.json +5 -2
- package/src/vite-plugin-wsx-babel.ts +25 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wsxjs/wsx-vite-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Vite plugin for WSX Framework",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@babel/plugin-transform-class-static-block": "^7.28.0",
|
|
32
32
|
"@babel/preset-typescript": "^7.28.5",
|
|
33
33
|
"@babel/types": "^7.28.1",
|
|
34
|
-
"@wsxjs/wsx-core": "0.0.
|
|
34
|
+
"@wsxjs/wsx-core": "0.0.11"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/traverse": "^7.28.5",
|
|
@@ -48,6 +48,9 @@
|
|
|
48
48
|
"esbuild": ">=0.25.0",
|
|
49
49
|
"vite": ">=4.0.0"
|
|
50
50
|
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
51
54
|
"scripts": {
|
|
52
55
|
"build": "tsup src/index.ts --format cjs,esm --dts --external esbuild --external @babel/core --external @babel/preset-typescript --external @babel/plugin-proposal-decorators --external @babel/plugin-proposal-class-properties --external @babel/plugin-transform-class-static-block --external @babel/types",
|
|
53
56
|
"dev": "tsup src/index.ts --format cjs,esm --dts --watch --external esbuild --external @babel/core --external @babel/preset-typescript --external @babel/plugin-proposal-decorators --external @babel/plugin-proposal-class-properties --external @babel/plugin-transform-class-static-block --external @babel/types",
|
|
@@ -137,9 +137,32 @@ export function vitePluginWSXWithBabel(options: WSXPluginOptions = {}): Plugin {
|
|
|
137
137
|
|
|
138
138
|
if (babelResult && babelResult.code) {
|
|
139
139
|
transformedCode = babelResult.code;
|
|
140
|
+
} else {
|
|
141
|
+
// Babel returned no code - critical error
|
|
142
|
+
throw new Error(
|
|
143
|
+
`[WSX Plugin] Babel transform returned no code for ${id}. ` +
|
|
144
|
+
`@state decorators will NOT be processed and will cause runtime errors. ` +
|
|
145
|
+
`Please check Babel configuration and plugin setup.`
|
|
146
|
+
);
|
|
140
147
|
}
|
|
141
|
-
} catch {
|
|
142
|
-
// Babel transform failed
|
|
148
|
+
} catch (error) {
|
|
149
|
+
// Babel transform failed - this is critical
|
|
150
|
+
// If Babel fails, @state decorators won't be processed and will cause runtime errors
|
|
151
|
+
// Don't silently fallback - throw error to make it obvious
|
|
152
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
153
|
+
throw new Error(
|
|
154
|
+
`[WSX Plugin] Babel transform failed for ${id}. ` +
|
|
155
|
+
`@state decorators will NOT be processed and will cause runtime errors. ` +
|
|
156
|
+
`\n\n` +
|
|
157
|
+
`Babel Error: ${errorMessage}` +
|
|
158
|
+
`\n\n` +
|
|
159
|
+
`This usually means:` +
|
|
160
|
+
`\n1. Babel plugins are not installed correctly` +
|
|
161
|
+
`\n2. Babel configuration is invalid` +
|
|
162
|
+
`\n3. File contains syntax errors that Babel cannot parse` +
|
|
163
|
+
`\n\n` +
|
|
164
|
+
`Please fix the Babel error above before continuing.`
|
|
165
|
+
);
|
|
143
166
|
}
|
|
144
167
|
|
|
145
168
|
// 2.5. Ensure JSX imports still exist after Babel transformation
|