asajs 4.1.0 → 4.1.1

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.
@@ -0,0 +1,51 @@
1
+ export function RandomBindingString(length, base = 32) {
2
+ const chars = "0123456789abcdefghijklmnopqrstuvwxyz".slice(0, base)
3
+ const out = new Array()
4
+
5
+ try {
6
+ const buffer = new Uint8Array(length)
7
+ crypto.getRandomValues(buffer)
8
+ for (let i = 0; i < length; i++) {
9
+ out[i] = chars[buffer[i] % base]
10
+ }
11
+ } catch {
12
+ for (let i = 0; i < length; i++) {
13
+ out[i] = chars[Math.floor(Math.random() * base)]
14
+ }
15
+ }
16
+
17
+ return `#${out.join("")}`
18
+ }
19
+
20
+ /**
21
+ * Configuration object for the AsaJS build process.
22
+ * @type {import('./config.d.ts').Config}
23
+ */
24
+ export const config = {
25
+ packinfo: {
26
+ name: "AsaJS",
27
+ description: "Create your Minecraft JSON-UI resource packs using JavaScript.",
28
+ version: [1, 0, 0],
29
+ },
30
+ compiler: {
31
+ enabled: true,
32
+ autoImport: true,
33
+ autoEnable: true,
34
+ importToPreview: false,
35
+ },
36
+ binding_functions: {
37
+ custom_abs: function (number) {
38
+ const randomAbs = RandomBindingString(16)
39
+
40
+ return {
41
+ generate_bindings: [
42
+ {
43
+ source_property_name: `[ abs(${number}) ]`,
44
+ target_property_name: randomAbs,
45
+ },
46
+ ],
47
+ return_value: randomAbs,
48
+ }
49
+ },
50
+ },
51
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asajs",
3
- "version": "4.1.0",
3
+ "version": "4.1.1",
4
4
  "description": "Create your Minecraft JSON-UI resource packs using JavaScript",
5
5
  "keywords": [
6
6
  "Minecraft",
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Configuration object for the AsaJS build process.
3
+ * @type {import('asajs/config.d.ts').Config}
4
+ */
5
+ export const config = {
6
+ packinfo: {
7
+ name: "AsaJS",
8
+ description: "Create your Minecraft JSON-UI resource packs using JavaScript.",
9
+ version: [1, 0, 0],
10
+ },
11
+ compiler: {
12
+ enabled: true,
13
+ autoImport: true,
14
+ autoEnable: true,
15
+ importToPreview: false,
16
+ },
17
+ binding_functions: {
18
+ custom_abs: function (number) {
19
+ const randomAbs = RandomBindingString(16)
20
+
21
+ return {
22
+ generate_bindings: [
23
+ {
24
+ source_property_name: `[ abs(${number}) ]`,
25
+ target_property_name: randomAbs,
26
+ },
27
+ ],
28
+ return_value: randomAbs,
29
+ }
30
+ },
31
+ },
32
+ }