einsteinjs 0.1.0 → 0.1.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/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # EinsteinJS
2
+
3
+ A type-safe snippet registry and compiler for VSCode and Cursor.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ bun add einsteinjs
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { registry, build } from "einsteinjs"
15
+
16
+ const rfc = registry
17
+ .it("React Functional Component")
18
+ .scope(["typescriptreact"])
19
+ .prefix("rfc")
20
+ .body([
21
+ "export default function ${1:Component}() {",
22
+ " return <div>$0</div>",
23
+ "}"
24
+ ])
25
+ .tag(["react"])
26
+ ```
27
+
28
+ ## Features
29
+
30
+ - Type-safe API
31
+ - Duplicate prefix validation
32
+ - Duplicate name validation
33
+ - VSCode-compatible output
34
+ - Extensible compiler architecture
package/dist/index.d.ts CHANGED
@@ -61,19 +61,6 @@ interface Config {
61
61
  */
62
62
  declare function defineConfig(config: Config): Config;
63
63
 
64
- /**
65
- * Processo completo:
66
- *
67
- * builder
68
- * ↓
69
- * schema validation
70
- * ↓
71
- * semantic validation
72
- * ↓
73
- * compilation
74
- * ↓
75
- * output
76
- */
77
64
  declare function build(config: Config): Promise<void>;
78
65
 
79
66
  /**
package/dist/index.js CHANGED
@@ -5,7 +5,8 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/build.ts
8
- import { writeFile } from "fs/promises";
8
+ import { mkdir, writeFile } from "fs/promises";
9
+ import { dirname } from "path";
9
10
 
10
11
  // src/compiler/compile-snippet.ts
11
12
  function compileSnippet(snippet) {
@@ -14596,9 +14597,14 @@ async function build(config2) {
14596
14597
  validateDuplicateNames(snippets);
14597
14598
  validateDuplicatePrefixes(snippets);
14598
14599
  const json2 = compile(snippets);
14600
+ const outputDir = dirname(config2.output);
14601
+ await mkdir(outputDir, {
14602
+ recursive: true
14603
+ });
14599
14604
  await writeFile(
14600
14605
  config2.output,
14601
- JSON.stringify(json2, null, 4)
14606
+ JSON.stringify(json2, null, 2),
14607
+ "utf-8"
14602
14608
  );
14603
14609
  }
14604
14610
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "einsteinjs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",