@dgck81lnn/koishi-plugin-music 0.1.3 → 0.1.5

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/browser/synth.js CHANGED
@@ -81,33 +81,33 @@ function encodeWav(samples) {
81
81
 
82
82
  // https://gist.github.com/jonleighton/958841
83
83
  function arrayBufferToBase64(arrayBuffer) {
84
- var base64 = ""
85
- var encodings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
86
- var bytes = new Uint8Array(arrayBuffer)
87
- var byteLength = bytes.byteLength
84
+ var base64 = ''
85
+ var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
86
+ var bytes = new Uint8Array(arrayBuffer)
87
+ var byteLength = bytes.byteLength
88
88
  var byteRemainder = byteLength % 3
89
- var mainLength = byteLength - byteRemainder
89
+ var mainLength = byteLength - byteRemainder
90
90
  var a, b, c, d
91
91
  var chunk
92
92
  for (var i = 0; i < mainLength; i = i + 3) {
93
93
  chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2]
94
94
  a = (chunk & 16515072) >> 18
95
- b = (chunk & 258048) >> 12
96
- c = (chunk & 4032) >> 6
95
+ b = (chunk & 258048) >> 12
96
+ c = (chunk & 4032) >> 6
97
97
  d = chunk & 63
98
98
  base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d]
99
99
  }
100
100
  if (byteRemainder == 1) {
101
101
  chunk = bytes[mainLength]
102
102
  a = (chunk & 252) >> 2
103
- b = (chunk & 3) << 4
104
- base64 += encodings[a] + encodings[b] + "=="
103
+ b = (chunk & 3) << 4
104
+ base64 += encodings[a] + encodings[b] + '=='
105
105
  } else if (byteRemainder == 2) {
106
106
  chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1]
107
107
  a = (chunk & 64512) >> 10
108
- b = (chunk & 1008) >> 4
109
- c = (chunk & 15) << 2
110
- base64 += encodings[a] + encodings[b] + encodings[c] + "="
108
+ b = (chunk & 1008) >> 4
109
+ c = (chunk & 15) << 2
110
+ base64 += encodings[a] + encodings[b] + encodings[c] + '='
111
111
  }
112
112
  return base64
113
113
  }
package/lib/index.js CHANGED
@@ -99,7 +99,7 @@ function apply(ctx, config) {
99
99
  catch (e) {
100
100
  return koishi_1.h.text(String(e));
101
101
  }
102
- let gutteredCode = `(${gutterFunc})(${new Function("$", "with($){" + code + "}")})`;
102
+ let gutteredCode = `(${gutterFunc})(function($){with($){\n${code}\n}})`;
103
103
  if (config.evalCommand !== "eval")
104
104
  gutteredCode = `process.stdout.write(${gutteredCode})`;
105
105
  ctx.logger.debug(config.evalCommand, gutteredCode);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dgck81lnn/koishi-plugin-music",
3
3
  "description": "Synthesize melodies in Koishi",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -9,8 +9,13 @@
9
9
  "browser"
10
10
  ],
11
11
  "license": "MIT",
12
+ "homepage": "https://github.com/DGCK81LNN/koishi-plugin-music",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/DGCK81LNN/koishi-plugin-music.git"
16
+ },
12
17
  "peerDependencies": {
13
- "koishi": "4.17.12"
18
+ "koishi": "^4.17.12"
14
19
  },
15
20
  "devDependencies": {
16
21
  "koishi-plugin-puppeteer": "^3.9.0"