182 lines
6.6 KiB
JavaScript
182 lines
6.6 KiB
JavaScript
var __bare_os_bundle_exports__ = (() => {
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __commonJS = (cb, mod) => function __require() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
// file that has been converted to a CommonJS file using a Babel-
|
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
|
|
// ../../node_modules/bare-bundle-compile/index.js
|
|
var require_bare_bundle_compile = __commonJS({
|
|
"../../node_modules/bare-bundle-compile/index.js"(exports, module) {
|
|
module.exports = function compile(bundle) {
|
|
return `{
|
|
const __bundle = {
|
|
imports: ${JSON.stringify(bundle.imports)},
|
|
resolutions: ${JSON.stringify(bundle.resolutions)},
|
|
modules: {${[...bundle].map(
|
|
([key, source]) => `${JSON.stringify(key)}: (require, module, exports, __filename, __dirname, __bundle) => {${compileModule(
|
|
key,
|
|
source
|
|
)}}`
|
|
)}
|
|
},
|
|
builtinRequire: typeof require === 'function' ? require : null,
|
|
load(cache, url, referrer = null, attributes = null) {
|
|
const type = url.endsWith('.json')
|
|
? 'json'
|
|
: url.endsWith('.bin')
|
|
? 'binary'
|
|
: url.endsWith('.txt')
|
|
? 'text'
|
|
: 'script'
|
|
|
|
if (typeof attributes === 'object' && attributes !== null && attributes.type !== type) {
|
|
throw new Error(\`Module '\${url}' is not of type '\${attributes.type}'\`)
|
|
}
|
|
|
|
let module = cache[url] || null
|
|
|
|
if (module !== null) return module
|
|
|
|
const { imports, resolutions } = __bundle
|
|
|
|
const filename = url
|
|
const dirname = url.slice(0, url.lastIndexOf('/')) || '/'
|
|
|
|
module = cache[url] = {
|
|
url,
|
|
type,
|
|
filename,
|
|
dirname,
|
|
imports,
|
|
resolutions,
|
|
main: null,
|
|
exports: {}
|
|
}
|
|
|
|
if (url.startsWith('builtin:')) {
|
|
module.exports = __bundle.builtinRequire(url.replace(/^builtin:/, ''))
|
|
|
|
return module
|
|
}
|
|
|
|
module.main = referrer ? referrer.main : module
|
|
|
|
const fn = __bundle.modules[url] || null
|
|
|
|
if (fn === null) throw new Error(\`Cannot find module '\${url}'\`)
|
|
|
|
function require(specifier, opts = {}) {
|
|
const attributes = opts && opts.with
|
|
|
|
return __bundle.load(cache, __bundle.resolve(specifier, url), module, attributes).exports
|
|
}
|
|
|
|
require.main = module.main
|
|
require.cache = cache
|
|
|
|
require.resolve = function resolve(specifier, parentURL = url) {
|
|
return __bundle.resolve(specifier, parentURL)
|
|
}
|
|
|
|
require.addon = function addon(specifier = '.', parentURL = url) {
|
|
return __bundle.builtinRequire.addon(__bundle.addon(specifier, parentURL))
|
|
}
|
|
|
|
require.addon.host = __bundle.builtinRequire.addon?.host
|
|
|
|
require.addon.resolve = function resolve(specifier = '.', parentURL = url) {
|
|
return __bundle.addon(specifier, parentURL)
|
|
}
|
|
|
|
require.asset = function asset(specifier, parentURL = url) {
|
|
return __bundle.asset(specifier, parentURL)
|
|
}
|
|
|
|
fn(require, module, module.exports, module.filename, module.dirname)
|
|
|
|
return module
|
|
},
|
|
resolve(specifier, parentURL) {
|
|
const resolved = __bundle.imports[specifier] || __bundle.resolutions[parentURL]?.[specifier]
|
|
|
|
if (!resolved || (typeof resolved === 'object' && !resolved.default)) {
|
|
throw new Error(\`Cannot find module '\${specifier}' imported from '\${parentURL}'\`)
|
|
}
|
|
|
|
return typeof resolved === 'object' ? resolved.default : resolved
|
|
},
|
|
addon(specifier = '.', parentURL) {
|
|
const resolved = __bundle.imports[specifier] || __bundle.resolutions[parentURL]?.[specifier]
|
|
|
|
if (!resolved || (typeof resolved === 'object' && !resolved.addon)) {
|
|
throw new Error(\`Cannot find addon '\${specifier}' imported from '\${parentURL}'\`)
|
|
}
|
|
|
|
return typeof resolved === 'object' ? resolved.addon : resolved
|
|
},
|
|
asset(specifier, parentURL) {
|
|
const resolved = __bundle.imports[specifier] || __bundle.resolutions[parentURL]?.[specifier]
|
|
|
|
if (!resolved || (typeof resolved === 'object' && !resolved.asset)) {
|
|
throw new Error(\`Cannot find asset '\${specifier}' imported from '\${parentURL}'\`)
|
|
}
|
|
|
|
return typeof resolved === 'object' ? resolved.asset : resolved
|
|
}
|
|
}
|
|
|
|
__bundle.load(Object.create(null), ${JSON.stringify(bundle.main)})
|
|
}`;
|
|
};
|
|
function compileModule(key, source) {
|
|
if (key.endsWith(".json")) {
|
|
return `module.exports = ${source}`;
|
|
}
|
|
if (key.endsWith(".bin")) {
|
|
return `module.exports = new Uint8Array([${Array.from(source)}])`;
|
|
}
|
|
if (key.endsWith(".txt")) {
|
|
return `module.exports = ${JSON.stringify(source.toString())}`;
|
|
}
|
|
return source;
|
|
}
|
|
}
|
|
});
|
|
|
|
// ../../bare-lib-entry-bareBundleCompile.js
|
|
var bare_lib_entry_bareBundleCompile_exports = {};
|
|
__export(bare_lib_entry_bareBundleCompile_exports, {
|
|
default: () => bare_lib_entry_bareBundleCompile_default
|
|
});
|
|
var import_bare_bundle_compile = __toESM(require_bare_bundle_compile());
|
|
var bare_lib_entry_bareBundleCompile_default = import_bare_bundle_compile.default;
|
|
return __toCommonJS(bare_lib_entry_bareBundleCompile_exports);
|
|
})();
|
|
;(function(){var g=globalThis;var s="__bare_os_stdlib__";g[s]=g[s]||{};g[s]["bareBundleCompile"]=typeof __bare_os_bundle_exports__!=="undefined"?__bare_os_bundle_exports__:void 0;})();
|