solid-jsx-oxc 0.1.0-alpha.7 → 0.1.0-alpha.9

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/binding.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface JsTransformOptions {
9
9
  moduleName?: string
10
10
  /**
11
11
  * Generate mode: "dom", "ssr", or "universal"
12
+ * Note: "universal" is currently treated as "dom" (not a separate universal renderer output).
12
13
  * @default "dom"
13
14
  */
14
15
  generate?: string
package/index.d.ts CHANGED
@@ -74,17 +74,16 @@ export function transform(source: string, options?: TransformOptions): Transform
74
74
 
75
75
  /**
76
76
  * Low-level transform function from the native binding.
77
- * Prefers snake_case option names.
78
77
  */
79
78
  export function transformJsx(source: string, options?: {
80
- module_name?: string;
81
- generate?: string;
79
+ moduleName?: string;
80
+ generate?: 'dom' | 'ssr' | 'universal' | string;
82
81
  hydratable?: boolean;
83
- delegate_events?: boolean;
84
- wrap_conditionals?: boolean;
85
- context_to_custom_elements?: boolean;
82
+ delegateEvents?: boolean;
83
+ wrapConditionals?: boolean;
84
+ contextToCustomElements?: boolean;
86
85
  filename?: string;
87
- source_map?: boolean;
86
+ sourceMap?: boolean;
88
87
  } | null): TransformResult;
89
88
 
90
89
  export interface PresetResult {
package/index.js CHANGED
@@ -1,19 +1,16 @@
1
1
  /**
2
2
  * solid-jsx-oxc - OXC-based JSX compiler for SolidJS
3
3
  *
4
- * This is the JavaScript wrapper around the Rust NAPI bindings.
5
- * It provides the same interface as babel-preset-solid.
4
+ * ESM entry point - provides the same interface as babel-preset-solid.
6
5
  */
7
6
 
8
- import { createRequire } from 'module';
9
- const require = createRequire(import.meta.url);
7
+ import { createRequire } from 'node:module';
8
+ import { platform, arch } from 'node:process';
9
+ import { fileURLToPath } from 'node:url';
10
+ import { dirname, join } from 'node:path';
10
11
 
11
- // Try to load the native module
12
- let nativeBinding = null;
13
-
14
- // Detect platform and architecture
15
- const platform = process.platform;
16
- const arch = process.arch;
12
+ const require = createRequire(import.meta.url);
13
+ const __dirname = dirname(fileURLToPath(import.meta.url));
17
14
 
18
15
  // Map Node.js platform/arch to binary file suffix
19
16
  const platformMap = {
@@ -28,18 +25,21 @@ const platformMap = {
28
25
  const platformKey = `${platform}-${arch}`;
29
26
  const nativeTarget = platformMap[platformKey];
30
27
 
28
+ // Try to load the native module
29
+ let nativeBinding = null;
30
+
31
31
  try {
32
32
  if (nativeTarget) {
33
33
  // Try platform-specific binary first
34
- nativeBinding = require(`./solid-jsx-oxc.${nativeTarget}.node`);
34
+ nativeBinding = require(join(__dirname, `solid-jsx-oxc.${nativeTarget}.node`));
35
35
  } else {
36
36
  // Fallback to generic name
37
- nativeBinding = require('./solid-jsx-oxc.node');
37
+ nativeBinding = require(join(__dirname, 'solid-jsx-oxc.node'));
38
38
  }
39
39
  } catch (e) {
40
40
  // Fallback message if native module not found
41
41
  console.warn(`solid-jsx-oxc: Native module not found for ${platformKey}. Run \`npm run build\` to compile.`);
42
- console.warn(e.message);
42
+ console.warn(e instanceof Error ? e.message : String(e));
43
43
  }
44
44
 
45
45
  /**
@@ -103,7 +103,9 @@ export function preset(context, options = {}) {
103
103
  };
104
104
  }
105
105
 
106
- // Also export the raw binding for advanced usage
106
+ /**
107
+ * Low-level transform function from the native binding
108
+ */
107
109
  export const transformJsx = nativeBinding ? nativeBinding.transformJsx : null;
108
110
 
109
111
  // Default export for convenience
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-jsx-oxc",
3
- "version": "0.1.0-alpha.7",
3
+ "version": "0.1.0-alpha.9",
4
4
  "description": "OXC-based JSX compiler for SolidJS",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -8,7 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./index.d.ts",
11
- "default": "./index.js"
11
+ "import": "./index.js"
12
12
  }
13
13
  },
14
14
  "files": [
@@ -60,17 +60,9 @@
60
60
  "release:next": "bun scripts/release.mjs next"
61
61
  },
62
62
  "devDependencies": {
63
- "@napi-rs/cli": "^3.5.1"
63
+ "@napi-rs/cli": "^3.5.0"
64
64
  },
65
65
  "engines": {
66
- "node": ">= 22"
67
- },
68
- "optionalDependencies": {
69
- "solid-jsx-oxc-darwin-x64": "0.1.0-alpha.7",
70
- "solid-jsx-oxc-darwin-arm64": "0.1.0-alpha.7",
71
- "solid-jsx-oxc-linux-x64-gnu": "0.1.0-alpha.7",
72
- "solid-jsx-oxc-win32-x64-msvc": "0.1.0-alpha.7",
73
- "solid-jsx-oxc-linux-arm64-gnu": "0.1.0-alpha.7",
74
- "solid-jsx-oxc-win32-arm64-msvc": "0.1.0-alpha.7"
66
+ "node": ">= 18"
75
67
  }
76
- }
68
+ }
Binary file