@oxy.so/bloom-language-compiler 1.0.0 → 1.1.0

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/js/compile.js CHANGED
@@ -5,8 +5,9 @@ const LANGUAGE_MODULE = '@oxy.so/bloom-language';
5
5
  /**
6
6
  * Compile one module, or return `null` when it has nothing to compile.
7
7
  * A wrong token or modifier throws an error whose message is the compiler's
8
- * rendered diagnostic, with the position Metro and Jest show in their frames;
9
- * a warning is printed with `console.warn`.
8
+ * rendered diagnostic (its help and a `= docs:` link to the section that
9
+ * explains it), with the position Metro and Jest show in their frames, and
10
+ * the links as `error.docs`; a warning is printed with `console.warn`.
10
11
  *
11
12
  * @param {string} source
12
13
  * @param {string} filename
@@ -24,6 +25,7 @@ function compileModule(source, filename) {
24
25
  error.filename = filename;
25
26
  error.lineNumber = first.line;
26
27
  error.column = first.column - 1;
28
+ error.docs = output.diagnostics.flatMap((d) => d.docs ?? []);
27
29
  throw error;
28
30
  }
29
31
  return output.changed ? { code: output.code, map: output.map, hoisted: output.hoisted } : null;
package/js/native.js CHANGED
@@ -21,6 +21,9 @@ const PLATFORMS = {
21
21
  'win32-x64': 'win32-x64-msvc',
22
22
  };
23
23
  const PACKAGE = '@oxy.so/bloom-language-compiler';
24
+ /** Where setting the compiler up (and a platform without a build) is explained. */
25
+ const SETUP_DOC =
26
+ 'https://github.com/OxyHQ/Bloom/blob/main/docs/bloom-language-getting-started.mdx#the-compiler';
24
27
  const WASI = `${PACKAGE}-wasm32-wasi`;
25
28
 
26
29
  function candidates() {
@@ -50,7 +53,8 @@ function load() {
50
53
  }
51
54
  }
52
55
  throw new Error(
53
- `No Bloom language compiler loads on ${process.platform}-${process.arch}:\n ${failures.join('\n ')}`,
56
+ `No Bloom language compiler loads on ${process.platform}-${process.arch}:\n ${failures.join('\n ')}\n` +
57
+ `Build it from a checkout (bun run build:addon in packages/bloom-language-compiler), or install the prebuilt package for this platform. See ${SETUP_DOC}`,
54
58
  );
55
59
  }
56
60
 
@@ -59,5 +63,8 @@ const { addon, binary } = load();
59
63
  /** The binary's digest: a cache key part, so a new compiler invalidates cached transforms. */
60
64
  const digest = crypto.createHash('sha1').update(fs.readFileSync(binary)).digest('hex');
61
65
 
62
- /** `binary` names the build that loaded (a local one, a platform package's, or the WASI module). */
63
- module.exports = { compile: addon.compile, digest, binary };
66
+ /**
67
+ * `binary` names the build that loaded (a local one, a platform package's, or
68
+ * the WASI module); `docLinks()` lists every docs link a diagnostic can carry.
69
+ */
70
+ module.exports = { compile: addon.compile, docLinks: addon.docLinks, digest, binary };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/bloom-language-compiler",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Build-time optimiser for @oxy.so/bloom-language: hoists static chains, opts view bodies into the React Compiler and checks chains against the language spec. A pre-pass in front of Metro's and Jest's own transformers.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build:addon": "./scripts/build-addon.sh",
24
24
  "typescript": "tsc --noEmit -p .",
25
- "test": "cargo test --locked && node --test test/adapter.test.cjs test/platform-packages.test.mjs && jest",
25
+ "test": "cargo test --locked && node --test test/adapter.test.cjs test/platform-packages.test.mjs test/doc-links.test.cjs test/react-compiler.test.cjs && jest",
26
26
  "lint:rust": "cargo fmt --check && cargo clippy --all-targets --locked -- -D warnings",
27
27
  "audit:crates": "python3 scripts/audit-crate-ages.py Cargo.lock",
28
28
  "build:prebuilt": "napi build --platform --release --manifest-path crates/node/Cargo.toml --package bloom_language_compiler_node --no-dts-header",
@@ -37,10 +37,13 @@
37
37
  },
38
38
  "packageManager": "bun@1.4.3",
39
39
  "devDependencies": {
40
+ "@babel/core": "7.29.7",
41
+ "@babel/preset-typescript": "7.29.7",
40
42
  "@emnapi/core": "2.0.0-beta.3",
41
43
  "@emnapi/runtime": "2.0.0-beta.3",
42
44
  "@napi-rs/cli": "3.10.12",
43
45
  "@napi-rs/wasm-runtime": "1.2.7",
46
+ "babel-plugin-react-compiler": "1.0.0",
44
47
  "emnapi": "2.0.0-beta.3"
45
48
  },
46
49
  "napi": {
@@ -56,12 +59,12 @@
56
59
  ]
57
60
  },
58
61
  "optionalDependencies": {
59
- "@oxy.so/bloom-language-compiler-linux-x64-gnu": "1.0.0",
60
- "@oxy.so/bloom-language-compiler-linux-arm64-gnu": "1.0.0",
61
- "@oxy.so/bloom-language-compiler-darwin-x64": "1.0.0",
62
- "@oxy.so/bloom-language-compiler-darwin-arm64": "1.0.0",
63
- "@oxy.so/bloom-language-compiler-win32-x64-msvc": "1.0.0",
64
- "@oxy.so/bloom-language-compiler-wasm32-wasi": "1.0.0"
62
+ "@oxy.so/bloom-language-compiler-linux-x64-gnu": "1.1.0",
63
+ "@oxy.so/bloom-language-compiler-linux-arm64-gnu": "1.1.0",
64
+ "@oxy.so/bloom-language-compiler-darwin-x64": "1.1.0",
65
+ "@oxy.so/bloom-language-compiler-darwin-arm64": "1.1.0",
66
+ "@oxy.so/bloom-language-compiler-win32-x64-msvc": "1.1.0",
67
+ "@oxy.so/bloom-language-compiler-wasm32-wasi": "1.1.0"
65
68
  },
66
69
  "publishConfig": {
67
70
  "access": "public"