rask-ui 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/plugin.d.ts CHANGED
@@ -1,23 +1,6 @@
1
- import type { Plugin } from 'vite';
2
- export interface RaskPluginOptions {
3
- /**
4
- * Enable transformation of function components to RaskComponent classes
5
- * @default true
6
- */
7
- transformComponents?: boolean;
8
- /**
9
- * Import source for Inferno JSX runtime functions
10
- * @default "rask-ui"
11
- */
12
- importSource?: string;
13
- /**
14
- * Whether to define all arguments for createVNode/createComponentVNode
15
- * @default false
16
- */
17
- defineAllArguments?: boolean;
18
- }
1
+ import type { Plugin } from "vite";
19
2
  /**
20
3
  * Vite plugin for transforming JSX to Inferno and function components to RaskComponent classes
21
4
  */
22
- export default function raskPlugin(options?: RaskPluginOptions): Plugin;
5
+ export default function raskPlugin(): Plugin;
23
6
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAMnC,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAsF1E"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAMnC;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,IAAI,MAAM,CAgF3C"}
package/dist/plugin.js CHANGED
@@ -1,29 +1,27 @@
1
- import path from 'path';
2
- import { fileURLToPath } from 'url';
3
- import { createRequire } from 'module';
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ import { createRequire } from "module";
4
4
  const __filename = fileURLToPath(import.meta.url);
5
5
  const __dirname = path.dirname(__filename);
6
6
  const require = createRequire(import.meta.url);
7
7
  /**
8
8
  * Vite plugin for transforming JSX to Inferno and function components to RaskComponent classes
9
9
  */
10
- export default function raskPlugin(options = {}) {
11
- const { transformComponents = true, importSource = 'rask-ui', defineAllArguments = false, } = options;
10
+ export default function raskPlugin() {
12
11
  // Resolve the path to swc-plugin-inferno WASM file
13
- const infernoPluginPath = require.resolve('swc-plugin-inferno/swc_plugin_inferno.wasm');
12
+ const infernoPluginPath = require.resolve("swc-plugin-inferno/swc_plugin_inferno.wasm");
14
13
  // Resolve the path to our RaskComponent plugin
15
- const componentPluginPath = path.resolve(__dirname, '../swc-plugin/target/wasm32-wasip1/release/swc_plugin_rask_component.wasm');
14
+ const componentPluginPath = path.resolve(__dirname, "../swc-plugin/target/wasm32-wasip1/release/swc_plugin_rask_component.wasm");
16
15
  return {
17
- name: 'rask-plugin',
18
- enforce: 'pre',
16
+ name: "rask-plugin",
17
+ enforce: "pre",
19
18
  config(config, { mode }) {
20
19
  return {
21
- esbuild: false, // Disable esbuild to use SWC
22
20
  resolve: {
23
21
  alias: {
24
22
  // In development mode, use Inferno's development build to avoid the warning
25
- ...(mode === 'development' && {
26
- inferno: 'inferno/dist/index.dev.mjs',
23
+ ...(mode === "development" && {
24
+ inferno: "inferno/dist/index.dev.mjs",
27
25
  }),
28
26
  },
29
27
  },
@@ -35,35 +33,33 @@ export default function raskPlugin(options = {}) {
35
33
  return null;
36
34
  }
37
35
  // Use SWC for transformation
38
- const swc = await import('@swc/core');
36
+ const swc = await import("@swc/core");
39
37
  const plugins = [
40
38
  // 1. FIRST: Inferno JSX transformation
41
39
  [
42
40
  infernoPluginPath,
43
41
  {
44
- importSource,
45
- defineAllArguments,
42
+ importSource: "rask-ui",
43
+ defineAllArguments: false,
46
44
  },
47
45
  ],
48
46
  ];
49
47
  // 2. SECOND: RaskComponent transformation (if enabled)
50
- if (transformComponents) {
51
- plugins.push([
52
- componentPluginPath,
53
- {
54
- importSource,
55
- },
56
- ]);
57
- }
48
+ plugins.push([
49
+ componentPluginPath,
50
+ {
51
+ importSource: "rask-ui",
52
+ },
53
+ ]);
58
54
  const result = await swc.transform(code, {
59
55
  filename: id,
60
56
  jsc: {
61
57
  parser: {
62
- syntax: id.endsWith('.tsx') ? 'typescript' : 'ecmascript',
63
- tsx: id.endsWith('.tsx'),
64
- jsx: id.endsWith('.jsx'),
58
+ syntax: id.endsWith(".tsx") ? "typescript" : "ecmascript",
59
+ tsx: id.endsWith(".tsx"),
60
+ jsx: id.endsWith(".jsx"),
65
61
  },
66
- target: 'es2020',
62
+ target: "es2020",
67
63
  experimental: {
68
64
  plugins,
69
65
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rask-ui",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",