swc/bundler/tests/.cache/untrusted/567f0327cc8776c5f38979f841d069dbc8b00526.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

54 lines
1.5 KiB
TypeScript

// Loaded from https://dev.jspm.io/npm:jszip@3.5.0/lib/reader/readerFor.dew.js
import { dew as _utilsDewDew } from "../utils.dew.js";
import { dew as _supportDewDew } from "../support.dew.js";
import { dew as _ArrayReaderDewDew } from "./ArrayReader.dew.js";
import { dew as _StringReaderDewDew } from "./StringReader.dew.js";
import { dew as _NodeBufferReaderDewDew } from "./NodeBufferReader.dew.js";
import { dew as _Uint8ArrayReaderDewDew } from "./Uint8ArrayReader.dew.js";
var exports = {},
_dewExec = false;
export function dew() {
if (_dewExec) return exports;
_dewExec = true;
var utils = _utilsDewDew();
var support = _supportDewDew();
var ArrayReader = _ArrayReaderDewDew();
var StringReader = _StringReaderDewDew();
var NodeBufferReader = _NodeBufferReaderDewDew();
var Uint8ArrayReader = _Uint8ArrayReaderDewDew();
/**
* Create a reader adapted to the data.
* @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
* @return {DataReader} the data reader.
*/
exports = function (data) {
var type = utils.getTypeOf(data);
utils.checkSupport(type);
if (type === "string" && !support.uint8array) {
return new StringReader(data);
}
if (type === "nodebuffer") {
return new NodeBufferReader(data);
}
if (support.uint8array) {
return new Uint8ArrayReader(utils.transformTo("uint8array", data));
}
return new ArrayReader(utils.transformTo("array", data));
};
return exports;
}