purus 0.0.0-reserved → 0.0.2

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/bin/purus.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ require("../lib/purus-compiler.js");
package/index.js CHANGED
@@ -1 +1,47 @@
1
- module.exports = console.log("purus is reserved for otoneko.");
1
+ /**
2
+ * Purus - A language that compiles to JavaScript
3
+ *
4
+ * This module provides a programmatic API for compiling Purus source code
5
+ * to JavaScript. Works in both CommonJS and ES Module environments.
6
+ *
7
+ * @example
8
+ * // ESM
9
+ * import { compile } from 'purus';
10
+ * const js = compile('const x be 42');
11
+ *
12
+ * // CJS
13
+ * const { compile } = require('purus');
14
+ * const js = compile('const x be 42');
15
+ */
16
+
17
+ "use strict";
18
+
19
+ const core = require("./lib/purus-core.js");
20
+
21
+ /**
22
+ * Compile Purus source code to JavaScript.
23
+ *
24
+ * @param {string} source - Purus source code
25
+ * @param {Object} [options] - Compilation options
26
+ * @param {boolean} [options.header=true] - Include "Generated by Purus" header comment
27
+ * @returns {string} Generated JavaScript code
28
+ */
29
+ function compile(source, options) {
30
+ return core.compile(source, options);
31
+ }
32
+
33
+ /**
34
+ * Check Purus source code for syntax errors.
35
+ *
36
+ * @param {string} source - Purus source code
37
+ * @returns {true} Returns true if syntax is valid
38
+ * @throws {Error} If syntax is invalid
39
+ */
40
+ function check(source) {
41
+ return core.check(source);
42
+ }
43
+
44
+ /** @type {string} The Purus compiler version */
45
+ const version = core.version;
46
+
47
+ module.exports = { compile, check, version };
package/index.mjs ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Purus - A language that compiles to JavaScript (ESM entry point)
3
+ */
4
+
5
+ import { createRequire } from "module";
6
+ const require = createRequire(import.meta.url);
7
+
8
+ const purus = require("./index.js");
9
+
10
+ export const compile = purus.compile;
11
+ export const check = purus.check;
12
+ export const version = purus.version;
13
+ export default purus;