@oxc-solid-js/compiler 1.1.1 → 1.1.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.
Files changed (2) hide show
  1. package/index.js +30 -3
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -32,22 +32,49 @@ const platformMap = {
32
32
  const platformKey = `${platform}-${arch}`;
33
33
  const nativeTarget = platformMap[platformKey];
34
34
 
35
+ const optionalBinaryPackageMap = {
36
+ 'darwin-arm64': '@oxc-solid-js/compiler-darwin-arm64',
37
+ 'darwin-x64': '@oxc-solid-js/compiler-darwin-x64',
38
+ 'linux-x64': '@oxc-solid-js/compiler-linux-x64-gnu',
39
+ 'win32-x64': '@oxc-solid-js/compiler-win32-x64-msvc',
40
+ };
41
+
35
42
  // Try to load the native module
36
43
  if (!nativeBinding) {
44
+ const loadErrors = [];
45
+
37
46
  try {
38
47
  if (nativeTarget) {
39
- // Try platform-specific binary first
48
+ // Try platform-specific binary colocated with package first
40
49
  nativeBinding = require(join(__dirname, `oxc-solid-js-compiler.${nativeTarget}.node`));
41
50
  } else {
42
51
  // Fallback to generic name
43
52
  nativeBinding = require(join(__dirname, 'oxc-solid-js-compiler.node'));
44
53
  }
45
54
  } catch (e) {
46
- // Fallback message if native module not found
55
+ loadErrors.push(e);
56
+ }
57
+
58
+ if (!nativeBinding) {
59
+ const optionalPackage = optionalBinaryPackageMap[platformKey];
60
+
61
+ if (optionalPackage) {
62
+ try {
63
+ nativeBinding = require(optionalPackage);
64
+ } catch (e) {
65
+ loadErrors.push(e);
66
+ }
67
+ }
68
+ }
69
+
70
+ if (!nativeBinding) {
47
71
  console.warn(
48
72
  `@oxc-solid-js/compiler: Native module not found for ${platformKey}. Run \`npm run build\` to compile.`,
49
73
  );
50
- console.warn(e instanceof Error ? e.message : String(e));
74
+
75
+ for (const err of loadErrors) {
76
+ console.warn(err instanceof Error ? err.message : String(err));
77
+ }
51
78
  }
52
79
  }
53
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxc-solid-js/compiler",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Port of babel-jsx-dom-expressions to oxc",
5
5
  "keywords": [
6
6
  "N-API",
@@ -72,9 +72,9 @@
72
72
  },
73
73
  "packageManager": "pnpm@10.32.1",
74
74
  "optionalDependencies": {
75
- "@oxc-solid-js/compiler-darwin-x64": "1.1.1",
76
- "@oxc-solid-js/compiler-darwin-arm64": "1.1.1",
77
- "@oxc-solid-js/compiler-linux-x64-gnu": "1.1.1",
78
- "@oxc-solid-js/compiler-win32-x64-msvc": "1.1.1"
75
+ "@oxc-solid-js/compiler-darwin-x64": "1.1.3",
76
+ "@oxc-solid-js/compiler-darwin-arm64": "1.1.3",
77
+ "@oxc-solid-js/compiler-linux-x64-gnu": "1.1.3",
78
+ "@oxc-solid-js/compiler-win32-x64-msvc": "1.1.3"
79
79
  }
80
80
  }