@jspicl/core 4.0.0 → 4.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.
Files changed (2) hide show
  1. package/README.md +1 -76
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,11 +2,6 @@
2
2
 
3
3
  The core transpiler library for jspicl. Converts JavaScript to PICO-8 Lua.
4
4
 
5
- <a href="https://www.npmjs.com/package/@jspicl/core" target="_blank" rel="noopener noreferrer">
6
- <img alt="npm version" src="https://img.shields.io/npm/v/@jspicl/core.svg?style=for-the-badge" />
7
- <img alt="License" src="https://img.shields.io/npm/l/@jspicl/core.svg?style=for-the-badge">
8
- </a>
9
-
10
5
  ## Installation
11
6
 
12
7
  ```bash
@@ -45,74 +40,4 @@ console.log(result.polyfills);
45
40
  // Output: Any required polyfill implementations
46
41
  ```
47
42
 
48
- ## API
49
-
50
- ### `jspicl(source, options?)`
51
-
52
- Transpiles JavaScript source code to PICO-8 Lua.
53
-
54
- #### Parameters
55
-
56
- - `source` (string) - The JavaScript source code to transpile
57
- - `options` (object, optional)
58
- - `prettify` (boolean, default: `true`) - Whether to format the output with proper indentation
59
- - `customMappers` (object) - Custom AST node handlers to override or extend transpilation
60
-
61
- #### Returns
62
-
63
- An object containing:
64
-
65
- - `code` (string) - The transpiled Lua code
66
- - `polyfills` (object) - Map of required polyfill function names to their Lua implementations
67
-
68
- ### Types
69
-
70
- Types can be imported from `@jspicl/core/types`:
71
-
72
- ```typescript
73
- import type {
74
- JspiclOptions,
75
- JspiclOutput,
76
- AstNodeParser
77
- } from "@jspicl/core/types";
78
- ```
79
-
80
- ## Custom Mappers
81
-
82
- You can provide custom mappers to override how specific AST node types are transpiled:
83
-
84
- ```javascript
85
- import {jspicl} from "@jspicl/core";
86
-
87
- const customMappers = {
88
- Literal: ({raw}) => {
89
- // Custom handling for literals
90
- return raw === "null" ? "nil" : raw;
91
- }
92
- };
93
-
94
- const result = jspicl(source, {customMappers});
95
- ```
96
-
97
- Each mapper receives the AST node and an options object with:
98
-
99
- - `transpile` - Function to recursively transpile child nodes
100
- - `scope` - Object containing variable metadata and scope information
101
-
102
- ## Supported Polyfills
103
-
104
- When your JavaScript uses methods without direct Lua equivalents, jspicl automatically detects and provides polyfill implementations:
105
-
106
- - Array methods: `map`, `filter`, `reduce`, `includes`, `findIndex`, `join`, `pop`, `sort`
107
- - String methods: `split`, `substr`, `substring`, `toString`
108
- - Object methods: `Object.assign`, `Object.keys`, `Object.values`, `Object.entries`
109
-
110
- The polyfills are returned separately so you can include them once at the top of your PICO-8 cartridge.
111
-
112
- ## Requirements
113
-
114
- - Node.js 22+
115
-
116
- ## License
117
-
118
- MIT
43
+ Visit [jspicl.github.io](https://jspicl.github.io/reference/api/) for detailed documentation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jspicl/core",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "A javascript to PICO-8 LUA converter",
5
5
  "license": "MIT",
6
6
  "type": "module",