DuyTa's picture
Upload folder using huggingface_hub
bc20498 verified
raw
history blame
2.48 kB
'use strict';
// ⚠️ Part of this file is automatically generated
// The :RUNTIMES comment is a delimiter and no code should be written/changed after
// See rollup/build_interpreters.cjs to know more
const { base } = require('./interpreter/_utils.js');
/** @type {Map<string, object>} */
const registry = new Map();
exports.registry = registry;
/** @type {Map<string, object>} */
const configs = new Map();
exports.configs = configs;
/** @type {string[]} */
const selectors = [];
exports.selectors = selectors;
/** @type {string[]} */
const prefixes = [];
exports.prefixes = prefixes;
/* c8 ignore start */
const interpreter = new Proxy(new Map(), {
get(map, id) {
if (!map.has(id)) {
const [type, ...rest] = id.split('@');
const interpreter = registry.get(type);
const url = /^(?:\.?\.?\/|https?:\/\/)/i.test(rest)
? rest.join('@')
: interpreter.module(...rest);
map.set(id, {
url,
module: import(/* webpackIgnore: true */url),
engine: interpreter.engine.bind(interpreter),
});
}
const { url, module, engine } = map.get(id);
return (config, baseURL) =>
module.then((module) => {
configs.set(id, config);
for (const entry of ['files', 'fetch']) {
const value = config?.[entry];
if (value) base.set(value, baseURL);
}
for (const entry of ['main', 'worker']) {
const value = config?.js_modules?.[entry];
if (value) base.set(value, baseURL);
}
return engine(module, config, url);
});
},
});
exports.interpreter = interpreter;
/* c8 ignore stop */
const register = (interpreter) => {
for (const type of [].concat(interpreter.type)) {
registry.set(type, interpreter);
selectors.push(`script[type="${type}"]`);
prefixes.push(`${type}-`);
}
};
//:RUNTIMES
const micropython = (require('./interpreter/micropython.js'));
const pyodide = (require('./interpreter/pyodide.js'));
const ruby_wasm_wasi = (require('./interpreter/ruby-wasm-wasi.js'));
const wasmoon = (require('./interpreter/wasmoon.js'));
const webr = (require('./interpreter/webr.js'));
for (const interpreter of [micropython, pyodide, ruby_wasm_wasi, wasmoon, webr])
register(interpreter);