@wasm-fmt/dart_fmt 0.0.3 → 0.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.
- package/README.md +2 -2
- package/dart_fmt.d.ts +10 -10
- package/dart_fmt.js +7 -7
- package/dart_fmt.mjs +164 -154
- package/dart_fmt.unopt.wasm +0 -0
- package/dart_fmt.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# Install
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@wasm-fmt/dart_fmt)
|
|
5
|
+
[](https://www.npmjs.com/package/@wasm-fmt/dart_fmt)
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @wasm-fmt/dart_fmt
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
[](https://jsr.io/@fmt/dart-fmt)
|
|
11
|
+
[](https://jsr.io/@fmt/dart-fmt)
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
npx jsr add @fmt/dart-fmt
|
package/dart_fmt.d.ts
CHANGED
|
@@ -9,16 +9,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
9
9
|
|
|
10
10
|
export type InitOutput = unknown;
|
|
11
11
|
|
|
12
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
13
|
-
/**
|
|
14
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
15
|
-
* a precompiled `WebAssembly.Module`.
|
|
16
|
-
*
|
|
17
|
-
* @param {SyncInitInput} module
|
|
18
|
-
*
|
|
19
|
-
* @returns {InitOutput}
|
|
20
|
-
*/
|
|
21
|
-
export function initSync(module: SyncInitInput): InitOutput;
|
|
12
|
+
// export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
13
|
+
// /**
|
|
14
|
+
// * Instantiates the given `module`, which can either be bytes or
|
|
15
|
+
// * a precompiled `WebAssembly.Module`.
|
|
16
|
+
// *
|
|
17
|
+
// * @param {SyncInitInput} module
|
|
18
|
+
// *
|
|
19
|
+
// * @returns {InitOutput}
|
|
20
|
+
// */
|
|
21
|
+
// export function initSync(module: SyncInitInput): InitOutput;
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
package/dart_fmt.js
CHANGED
|
@@ -5,17 +5,17 @@ let wasm;
|
|
|
5
5
|
function get_imports() {}
|
|
6
6
|
function init_memory() {}
|
|
7
7
|
|
|
8
|
-
export function initSync(module) {
|
|
9
|
-
|
|
8
|
+
// export function initSync(module) {
|
|
9
|
+
// if (wasm !== undefined) return wasm;
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// const imports = get_imports();
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// init_memory(imports);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
// module = normalize(module);
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
// return (wasm = instantiate(module));
|
|
18
|
+
// }
|
|
19
19
|
|
|
20
20
|
function normalize(module) {
|
|
21
21
|
if (!(module instanceof WebAssembly.Module)) {
|
package/dart_fmt.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
let buildArgsList;
|
|
2
2
|
|
|
3
3
|
// `modulePromise` is a promise to the `WebAssembly.module` object to be
|
|
4
4
|
// instantiated.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
export const instantiate = async (modulePromise, importObjectPromise) => {
|
|
11
11
|
let dartInstance;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function stringFromDartString(string) {
|
|
14
14
|
const totalLength = dartInstance.exports.$stringLength(string);
|
|
15
15
|
let result = '';
|
|
16
16
|
let index = 0;
|
|
@@ -46,7 +46,25 @@ export const instantiate = async (modulePromise, importObjectPromise) => {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
// Prints to the console
|
|
50
|
+
function printToConsole(value) {
|
|
51
|
+
if (typeof dartPrint == "function") {
|
|
52
|
+
dartPrint(value);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (typeof console == "object" && typeof console.log != "undefined") {
|
|
56
|
+
console.log(value);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (typeof print == "function") {
|
|
60
|
+
print(value);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
throw "Unable to print message: " + js;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Converts a Dart List to a JS array. Any Dart objects will be converted, but
|
|
50
68
|
// this will be cheap for JSValues.
|
|
51
69
|
function arrayFromDartList(constructor, list) {
|
|
52
70
|
const length = dartInstance.exports.$listLength(list);
|
|
@@ -74,160 +92,18 @@ export const instantiate = async (modulePromise, importObjectPromise) => {
|
|
|
74
92
|
return wrapped;
|
|
75
93
|
}
|
|
76
94
|
|
|
77
|
-
if (WebAssembly.String === undefined) {
|
|
78
|
-
console.log("WebAssembly.String is undefined, adding polyfill");
|
|
79
|
-
WebAssembly.String = {
|
|
80
|
-
"charCodeAt": (s, i) => s.charCodeAt(i),
|
|
81
|
-
"compare": (s1, s2) => {
|
|
82
|
-
if (s1 < s2) return -1;
|
|
83
|
-
if (s1 > s2) return 1;
|
|
84
|
-
return 0;
|
|
85
|
-
},
|
|
86
|
-
"concat": (s1, s2) => s1 + s2,
|
|
87
|
-
"equals": (s1, s2) => s1 === s2,
|
|
88
|
-
"fromCharCode": (i) => String.fromCharCode(i),
|
|
89
|
-
"length": (s) => s.length,
|
|
90
|
-
"substring": (s, a, b) => s.substring(a, b),
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
95
|
// Imports
|
|
95
96
|
const dart2wasm = {
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
_173: o => o === undefined,
|
|
100
|
-
_174: o => typeof o === 'boolean',
|
|
101
|
-
_175: o => typeof o === 'number',
|
|
102
|
-
_177: o => typeof o === 'string',
|
|
103
|
-
_180: o => o instanceof Int8Array,
|
|
104
|
-
_181: o => o instanceof Uint8Array,
|
|
105
|
-
_182: o => o instanceof Uint8ClampedArray,
|
|
106
|
-
_183: o => o instanceof Int16Array,
|
|
107
|
-
_184: o => o instanceof Uint16Array,
|
|
108
|
-
_185: o => o instanceof Int32Array,
|
|
109
|
-
_186: o => o instanceof Uint32Array,
|
|
110
|
-
_187: o => o instanceof Float32Array,
|
|
111
|
-
_188: o => o instanceof Float64Array,
|
|
112
|
-
_189: o => o instanceof ArrayBuffer,
|
|
113
|
-
_190: o => o instanceof DataView,
|
|
114
|
-
_191: o => o instanceof Array,
|
|
115
|
-
_192: o => typeof o === 'function' && o[jsWrappedDartFunctionSymbol] === true,
|
|
116
|
-
_195: o => o instanceof RegExp,
|
|
117
|
-
_196: (l, r) => l === r,
|
|
118
|
-
_197: o => o,
|
|
119
|
-
_198: o => o,
|
|
120
|
-
_199: o => o,
|
|
121
|
-
_200: b => !!b,
|
|
122
|
-
_201: o => o.length,
|
|
123
|
-
_204: (o, i) => o[i],
|
|
124
|
-
_205: f => f.dartFunction,
|
|
125
|
-
_206: l => arrayFromDartList(Int8Array, l),
|
|
126
|
-
_207: l => arrayFromDartList(Uint8Array, l),
|
|
127
|
-
_208: l => arrayFromDartList(Uint8ClampedArray, l),
|
|
128
|
-
_209: l => arrayFromDartList(Int16Array, l),
|
|
129
|
-
_210: l => arrayFromDartList(Uint16Array, l),
|
|
130
|
-
_211: l => arrayFromDartList(Int32Array, l),
|
|
131
|
-
_212: l => arrayFromDartList(Uint32Array, l),
|
|
132
|
-
_213: l => arrayFromDartList(Float32Array, l),
|
|
133
|
-
_214: l => arrayFromDartList(Float64Array, l),
|
|
134
|
-
_215: (data, length) => {
|
|
135
|
-
const view = new DataView(new ArrayBuffer(length));
|
|
136
|
-
for (let i = 0; i < length; i++) {
|
|
137
|
-
view.setUint8(i, dartInstance.exports.$byteDataGetUint8(data, i));
|
|
138
|
-
}
|
|
139
|
-
return view;
|
|
140
|
-
},
|
|
141
|
-
_216: l => arrayFromDartList(Array, l),
|
|
142
|
-
_217: stringFromDartString,
|
|
143
|
-
_218: stringToDartString,
|
|
144
|
-
_225: (o, p) => o[p],
|
|
145
|
-
_162: (s, m) => {
|
|
146
|
-
try {
|
|
147
|
-
return new RegExp(s, m);
|
|
148
|
-
} catch (e) {
|
|
149
|
-
return String(e);
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
_163: (x0,x1) => x0.exec(x1),
|
|
153
|
-
_164: (x0,x1) => x0.test(x1),
|
|
154
|
-
_165: (x0,x1) => x0.exec(x1),
|
|
155
|
-
_166: (x0,x1) => x0.exec(x1),
|
|
156
|
-
_167: x0 => x0.pop(),
|
|
157
|
-
_221: l => new Array(l),
|
|
158
|
-
_229: o => String(o),
|
|
159
|
-
_234: x0 => x0.index,
|
|
160
|
-
_236: x0 => x0.length,
|
|
161
|
-
_238: (x0,x1) => x0[x1],
|
|
162
|
-
_240: (x0,x1) => x0.exec(x1),
|
|
163
|
-
_242: x0 => x0.flags,
|
|
164
|
-
_243: x0 => x0.multiline,
|
|
165
|
-
_244: x0 => x0.ignoreCase,
|
|
166
|
-
_245: x0 => x0.unicode,
|
|
167
|
-
_246: x0 => x0.dotAll,
|
|
168
|
-
_247: (x0,x1) => x0.lastIndex = x1,
|
|
169
|
-
_122: Object.is,
|
|
170
|
-
_124: WebAssembly.String.concat,
|
|
171
|
-
_132: (o) => new DataView(o.buffer, o.byteOffset, o.byteLength),
|
|
172
|
-
_82: (a, i) => a.push(i),
|
|
173
|
-
_92: (a, b) => a == b ? 0 : (a > b ? 1 : -1),
|
|
174
|
-
_93: a => a.length,
|
|
175
|
-
_95: (a, i) => a[i],
|
|
176
|
-
_96: (a, i, v) => a[i] = v,
|
|
177
|
-
_98: a => a.join(''),
|
|
178
|
-
_101: (s, t) => s.split(t),
|
|
179
|
-
_102: s => s.toLowerCase(),
|
|
180
|
-
_103: s => s.toUpperCase(),
|
|
181
|
-
_104: s => s.trim(),
|
|
182
|
-
_106: s => s.trimRight(),
|
|
183
|
-
_108: (s, p, i) => s.indexOf(p, i),
|
|
184
|
-
_109: (s, p, i) => s.lastIndexOf(p, i),
|
|
185
|
-
_111: (o, start, length) => new Uint8Array(o.buffer, o.byteOffset + start, length),
|
|
186
|
-
_112: (o, start, length) => new Int8Array(o.buffer, o.byteOffset + start, length),
|
|
187
|
-
_113: (o, start, length) => new Uint8ClampedArray(o.buffer, o.byteOffset + start, length),
|
|
188
|
-
_114: (o, start, length) => new Uint16Array(o.buffer, o.byteOffset + start, length),
|
|
189
|
-
_115: (o, start, length) => new Int16Array(o.buffer, o.byteOffset + start, length),
|
|
190
|
-
_116: (o, start, length) => new Uint32Array(o.buffer, o.byteOffset + start, length),
|
|
191
|
-
_117: (o, start, length) => new Int32Array(o.buffer, o.byteOffset + start, length),
|
|
192
|
-
_120: (o, start, length) => new Float32Array(o.buffer, o.byteOffset + start, length),
|
|
193
|
-
_121: (o, start, length) => new Float64Array(o.buffer, o.byteOffset + start, length),
|
|
194
|
-
_123: WebAssembly.String.charCodeAt,
|
|
195
|
-
_125: WebAssembly.String.substring,
|
|
196
|
-
_126: WebAssembly.String.length,
|
|
197
|
-
_127: WebAssembly.String.equals,
|
|
198
|
-
_128: WebAssembly.String.compare,
|
|
199
|
-
_129: WebAssembly.String.fromCharCode,
|
|
200
|
-
_136: Function.prototype.call.bind(Object.getOwnPropertyDescriptor(DataView.prototype, 'byteLength').get),
|
|
201
|
-
_137: (b, o) => new DataView(b, o),
|
|
202
|
-
_139: Function.prototype.call.bind(DataView.prototype.getUint8),
|
|
203
|
-
_140: Function.prototype.call.bind(DataView.prototype.setUint8),
|
|
204
|
-
_141: Function.prototype.call.bind(DataView.prototype.getInt8),
|
|
205
|
-
_142: Function.prototype.call.bind(DataView.prototype.setInt8),
|
|
206
|
-
_143: Function.prototype.call.bind(DataView.prototype.getUint16),
|
|
207
|
-
_144: Function.prototype.call.bind(DataView.prototype.setUint16),
|
|
208
|
-
_145: Function.prototype.call.bind(DataView.prototype.getInt16),
|
|
209
|
-
_146: Function.prototype.call.bind(DataView.prototype.setInt16),
|
|
210
|
-
_147: Function.prototype.call.bind(DataView.prototype.getUint32),
|
|
211
|
-
_148: Function.prototype.call.bind(DataView.prototype.setUint32),
|
|
212
|
-
_149: Function.prototype.call.bind(DataView.prototype.getInt32),
|
|
213
|
-
_150: Function.prototype.call.bind(DataView.prototype.setInt32),
|
|
214
|
-
_155: Function.prototype.call.bind(DataView.prototype.getFloat32),
|
|
215
|
-
_156: Function.prototype.call.bind(DataView.prototype.setFloat32),
|
|
216
|
-
_157: Function.prototype.call.bind(DataView.prototype.getFloat64),
|
|
217
|
-
_158: Function.prototype.call.bind(DataView.prototype.setFloat64),
|
|
218
|
-
_80: (c) =>
|
|
219
|
-
queueMicrotask(() => dartInstance.exports.$invokeCallback(c)),
|
|
220
|
-
_159: s => stringToDartString(stringFromDartString(s).toUpperCase()),
|
|
221
|
-
_160: s => stringToDartString(stringFromDartString(s).toLowerCase()),
|
|
222
|
-
_45: v => stringToDartString(v.toString()),
|
|
223
|
-
_59: s => {
|
|
98
|
+
_48: v => stringToDartString(v.toString()),
|
|
99
|
+
_62: s => {
|
|
224
100
|
const jsSource = stringFromDartString(s);
|
|
225
101
|
if (!/^\s*[+-]?(?:Infinity|NaN|(?:\.\d+|\d+(?:\.\d*)?)(?:[eE][+-]?\d+)?)\s*$/.test(jsSource)) {
|
|
226
102
|
return NaN;
|
|
227
103
|
}
|
|
228
104
|
return parseFloat(jsSource);
|
|
229
105
|
},
|
|
230
|
-
|
|
106
|
+
_63: () => {
|
|
231
107
|
let stackString = new Error().stack.toString();
|
|
232
108
|
let frames = stackString.split('\n');
|
|
233
109
|
let drop = 2;
|
|
@@ -236,33 +112,167 @@ _60: () => {
|
|
|
236
112
|
}
|
|
237
113
|
return frames.slice(drop).join('\n');
|
|
238
114
|
},
|
|
239
|
-
|
|
115
|
+
_67: () => {
|
|
240
116
|
// On browsers return `globalThis.location.href`
|
|
241
117
|
if (globalThis.location != null) {
|
|
242
118
|
return stringToDartString(globalThis.location.href);
|
|
243
119
|
}
|
|
244
120
|
return null;
|
|
245
121
|
},
|
|
246
|
-
|
|
122
|
+
_68: () => {
|
|
247
123
|
return typeof process != undefined &&
|
|
248
124
|
Object.prototype.toString.call(process) == "[object process]" &&
|
|
249
125
|
process.platform == "win32"
|
|
250
|
-
}
|
|
251
|
-
|
|
126
|
+
},
|
|
127
|
+
_72: s => stringToDartString(JSON.stringify(stringFromDartString(s))),
|
|
128
|
+
_73: s => printToConsole(stringFromDartString(s)),
|
|
129
|
+
_91: (c) =>
|
|
130
|
+
queueMicrotask(() => dartInstance.exports.$invokeCallback(c)),
|
|
131
|
+
_93: (a, i) => a.push(i),
|
|
132
|
+
_103: (a, b) => a == b ? 0 : (a > b ? 1 : -1),
|
|
133
|
+
_104: a => a.length,
|
|
134
|
+
_106: (a, i) => a[i],
|
|
135
|
+
_107: (a, i, v) => a[i] = v,
|
|
136
|
+
_109: a => a.join(''),
|
|
137
|
+
_112: (s, t) => s.split(t),
|
|
138
|
+
_113: s => s.toLowerCase(),
|
|
139
|
+
_114: s => s.toUpperCase(),
|
|
140
|
+
_115: s => s.trim(),
|
|
141
|
+
_117: s => s.trimRight(),
|
|
142
|
+
_119: (s, p, i) => s.indexOf(p, i),
|
|
143
|
+
_120: (s, p, i) => s.lastIndexOf(p, i),
|
|
144
|
+
_122: (o, start, length) => new Uint8Array(o.buffer, o.byteOffset + start, length),
|
|
145
|
+
_123: (o, start, length) => new Int8Array(o.buffer, o.byteOffset + start, length),
|
|
146
|
+
_124: (o, start, length) => new Uint8ClampedArray(o.buffer, o.byteOffset + start, length),
|
|
147
|
+
_125: (o, start, length) => new Uint16Array(o.buffer, o.byteOffset + start, length),
|
|
148
|
+
_126: (o, start, length) => new Int16Array(o.buffer, o.byteOffset + start, length),
|
|
149
|
+
_127: (o, start, length) => new Uint32Array(o.buffer, o.byteOffset + start, length),
|
|
150
|
+
_128: (o, start, length) => new Int32Array(o.buffer, o.byteOffset + start, length),
|
|
151
|
+
_131: (o, start, length) => new Float32Array(o.buffer, o.byteOffset + start, length),
|
|
152
|
+
_132: (o, start, length) => new Float64Array(o.buffer, o.byteOffset + start, length),
|
|
153
|
+
_133: Object.is,
|
|
154
|
+
_136: (o) => new DataView(o.buffer, o.byteOffset, o.byteLength),
|
|
155
|
+
_140: Function.prototype.call.bind(Object.getOwnPropertyDescriptor(DataView.prototype, 'byteLength').get),
|
|
156
|
+
_141: (b, o) => new DataView(b, o),
|
|
157
|
+
_143: Function.prototype.call.bind(DataView.prototype.getUint8),
|
|
158
|
+
_144: Function.prototype.call.bind(DataView.prototype.setUint8),
|
|
159
|
+
_145: Function.prototype.call.bind(DataView.prototype.getInt8),
|
|
160
|
+
_146: Function.prototype.call.bind(DataView.prototype.setInt8),
|
|
161
|
+
_147: Function.prototype.call.bind(DataView.prototype.getUint16),
|
|
162
|
+
_148: Function.prototype.call.bind(DataView.prototype.setUint16),
|
|
163
|
+
_149: Function.prototype.call.bind(DataView.prototype.getInt16),
|
|
164
|
+
_150: Function.prototype.call.bind(DataView.prototype.setInt16),
|
|
165
|
+
_151: Function.prototype.call.bind(DataView.prototype.getUint32),
|
|
166
|
+
_152: Function.prototype.call.bind(DataView.prototype.setUint32),
|
|
167
|
+
_153: Function.prototype.call.bind(DataView.prototype.getInt32),
|
|
168
|
+
_154: Function.prototype.call.bind(DataView.prototype.setInt32),
|
|
169
|
+
_159: Function.prototype.call.bind(DataView.prototype.getFloat32),
|
|
170
|
+
_160: Function.prototype.call.bind(DataView.prototype.setFloat32),
|
|
171
|
+
_161: Function.prototype.call.bind(DataView.prototype.getFloat64),
|
|
172
|
+
_162: Function.prototype.call.bind(DataView.prototype.setFloat64),
|
|
173
|
+
_168: s => stringToDartString(stringFromDartString(s).toUpperCase()),
|
|
174
|
+
_169: s => stringToDartString(stringFromDartString(s).toLowerCase()),
|
|
175
|
+
_171: (s, m) => {
|
|
176
|
+
try {
|
|
177
|
+
return new RegExp(s, m);
|
|
178
|
+
} catch (e) {
|
|
179
|
+
return String(e);
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
_172: (x0,x1) => x0.exec(x1),
|
|
183
|
+
_173: (x0,x1) => x0.test(x1),
|
|
184
|
+
_174: (x0,x1) => x0.exec(x1),
|
|
185
|
+
_175: (x0,x1) => x0.exec(x1),
|
|
186
|
+
_176: x0 => x0.pop(),
|
|
187
|
+
_182: o => o === undefined,
|
|
188
|
+
_183: o => typeof o === 'boolean',
|
|
189
|
+
_184: o => typeof o === 'number',
|
|
190
|
+
_186: o => typeof o === 'string',
|
|
191
|
+
_189: o => o instanceof Int8Array,
|
|
192
|
+
_190: o => o instanceof Uint8Array,
|
|
193
|
+
_191: o => o instanceof Uint8ClampedArray,
|
|
194
|
+
_192: o => o instanceof Int16Array,
|
|
195
|
+
_193: o => o instanceof Uint16Array,
|
|
196
|
+
_194: o => o instanceof Int32Array,
|
|
197
|
+
_195: o => o instanceof Uint32Array,
|
|
198
|
+
_196: o => o instanceof Float32Array,
|
|
199
|
+
_197: o => o instanceof Float64Array,
|
|
200
|
+
_198: o => o instanceof ArrayBuffer,
|
|
201
|
+
_199: o => o instanceof DataView,
|
|
202
|
+
_200: o => o instanceof Array,
|
|
203
|
+
_201: o => typeof o === 'function' && o[jsWrappedDartFunctionSymbol] === true,
|
|
204
|
+
_204: o => o instanceof RegExp,
|
|
205
|
+
_205: (l, r) => l === r,
|
|
206
|
+
_206: o => o,
|
|
207
|
+
_207: o => o,
|
|
208
|
+
_208: o => o,
|
|
209
|
+
_209: b => !!b,
|
|
210
|
+
_210: o => o.length,
|
|
211
|
+
_213: (o, i) => o[i],
|
|
212
|
+
_214: f => f.dartFunction,
|
|
213
|
+
_215: l => arrayFromDartList(Int8Array, l),
|
|
214
|
+
_216: l => arrayFromDartList(Uint8Array, l),
|
|
215
|
+
_217: l => arrayFromDartList(Uint8ClampedArray, l),
|
|
216
|
+
_218: l => arrayFromDartList(Int16Array, l),
|
|
217
|
+
_219: l => arrayFromDartList(Uint16Array, l),
|
|
218
|
+
_220: l => arrayFromDartList(Int32Array, l),
|
|
219
|
+
_221: l => arrayFromDartList(Uint32Array, l),
|
|
220
|
+
_222: l => arrayFromDartList(Float32Array, l),
|
|
221
|
+
_223: l => arrayFromDartList(Float64Array, l),
|
|
222
|
+
_224: (data, length) => {
|
|
223
|
+
const view = new DataView(new ArrayBuffer(length));
|
|
224
|
+
for (let i = 0; i < length; i++) {
|
|
225
|
+
view.setUint8(i, dartInstance.exports.$byteDataGetUint8(data, i));
|
|
226
|
+
}
|
|
227
|
+
return view;
|
|
228
|
+
},
|
|
229
|
+
_225: l => arrayFromDartList(Array, l),
|
|
230
|
+
_226: stringFromDartString,
|
|
231
|
+
_227: stringToDartString,
|
|
232
|
+
_230: l => new Array(l),
|
|
233
|
+
_234: (o, p) => o[p],
|
|
234
|
+
_238: o => String(o),
|
|
235
|
+
_243: x0 => x0.index,
|
|
236
|
+
_245: x0 => x0.length,
|
|
237
|
+
_247: (x0,x1) => x0[x1],
|
|
238
|
+
_249: (x0,x1) => x0.exec(x1),
|
|
239
|
+
_251: x0 => x0.flags,
|
|
240
|
+
_252: x0 => x0.multiline,
|
|
241
|
+
_253: x0 => x0.ignoreCase,
|
|
242
|
+
_254: x0 => x0.unicode,
|
|
243
|
+
_255: x0 => x0.dotAll,
|
|
244
|
+
_256: (x0,x1) => x0.lastIndex = x1
|
|
245
|
+
};
|
|
252
246
|
|
|
253
247
|
const baseImports = {
|
|
254
248
|
dart2wasm: dart2wasm,
|
|
255
249
|
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
|
|
251
|
+
Math: Math,
|
|
258
252
|
Date: Date,
|
|
259
253
|
Object: Object,
|
|
260
254
|
Array: Array,
|
|
261
255
|
Reflect: Reflect,
|
|
262
256
|
};
|
|
257
|
+
|
|
258
|
+
const jsStringPolyfill = {
|
|
259
|
+
"charCodeAt": (s, i) => s.charCodeAt(i),
|
|
260
|
+
"compare": (s1, s2) => {
|
|
261
|
+
if (s1 < s2) return -1;
|
|
262
|
+
if (s1 > s2) return 1;
|
|
263
|
+
return 0;
|
|
264
|
+
},
|
|
265
|
+
"concat": (s1, s2) => s1 + s2,
|
|
266
|
+
"equals": (s1, s2) => s1 === s2,
|
|
267
|
+
"fromCharCode": (i) => String.fromCharCode(i),
|
|
268
|
+
"length": (s) => s.length,
|
|
269
|
+
"substring": (s, a, b) => s.substring(a, b),
|
|
270
|
+
};
|
|
271
|
+
|
|
263
272
|
dartInstance = await WebAssembly.instantiate(await modulePromise, {
|
|
264
273
|
...baseImports,
|
|
265
274
|
...(await importObjectPromise),
|
|
275
|
+
"wasm:js-string": jsStringPolyfill,
|
|
266
276
|
});
|
|
267
277
|
|
|
268
278
|
return dartInstance;
|
|
Binary file
|
package/dart_fmt.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED