[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: load-original-sources.js
var fs = require('fs'); var path = require('path'); var isAllowedResource = require('./is-allowed-resource'); var hasProtocol = require('../utils/has-protocol'); var isRemoteResource = require('../utils/is-remote-resource'); function loadOriginalSources(context, callback) { var loadContext = { callback: callback, fetch: context.options.fetch, index: 0, inline: context.options.inline, inlineRequest: context.options.inlineRequest, inlineTimeout: context.options.inlineTimeout, localOnly: context.localOnly, rebaseTo: context.options.rebaseTo, sourcesContent: context.sourcesContent, uriToSource: uriToSourceMapping(context.inputSourceMapTracker.all()), warnings: context.warnings }; return context.options.sourceMap && context.options.sourceMapInlineSources ? doLoadOriginalSources(loadContext) : callback(); } function uriToSourceMapping(allSourceMapConsumers) { var mapping = {}; var consumer; var uri; var source; var i, l; for (source in allSourceMapConsumers) { consumer = allSourceMapConsumers[source]; for (i = 0, l = consumer.sources.length; i < l; i++) { uri = consumer.sources[i]; source = consumer.sourceContentFor(uri, true); mapping[uri] = source; } } return mapping; } function doLoadOriginalSources(loadContext) { var uris = Object.keys(loadContext.uriToSource); var uri; var source; var total; for (total = uris.length; loadContext.index < total; loadContext.index++) { uri = uris[loadContext.index]; source = loadContext.uriToSource[uri]; if (source) { loadContext.sourcesContent[uri] = source; } else { return loadOriginalSource(uri, loadContext); } } return loadContext.callback(); } function loadOriginalSource(uri, loadContext) { var content; if (isRemoteResource(uri)) { return loadOriginalSourceFromRemoteUri(uri, loadContext, function (content) { loadContext.index++; loadContext.sourcesContent[uri] = content; return doLoadOriginalSources(loadContext); }); } else { content = loadOriginalSourceFromLocalUri(uri, loadContext); loadContext.index++; loadContext.sourcesContent[uri] = content; return doLoadOriginalSources(loadContext); } } function loadOriginalSourceFromRemoteUri(uri, loadContext, whenLoaded) { var isAllowed = isAllowedResource(uri, true, loadContext.inline); var isRuntimeResource = !hasProtocol(uri); if (loadContext.localOnly) { loadContext.warnings.push('Cannot fetch remote resource from "' + uri + '" as no callback given.'); return whenLoaded(null); } else if (isRuntimeResource) { loadContext.warnings.push('Cannot fetch "' + uri + '" as no protocol given.'); return whenLoaded(null); } else if (!isAllowed) { loadContext.warnings.push('Cannot fetch "' + uri + '" as resource is not allowed.'); return whenLoaded(null); } loadContext.fetch(uri, loadContext.inlineRequest, loadContext.inlineTimeout, function (error, content) { if (error) { loadContext.warnings.push('Missing original source at "' + uri + '" - ' + error); } whenLoaded(content); }); } function loadOriginalSourceFromLocalUri(relativeUri, loadContext) { var isAllowed = isAllowedResource(relativeUri, false, loadContext.inline); var absoluteUri = path.resolve(loadContext.rebaseTo, relativeUri); if (!fs.existsSync(absoluteUri) || !fs.statSync(absoluteUri).isFile()) { loadContext.warnings.push('Ignoring local source map at "' + absoluteUri + '" as resource is missing.'); return null; } else if (!isAllowed) { loadContext.warnings.push('Cannot fetch "' + absoluteUri + '" as resource is not allowed.'); return null; } return fs.readFileSync(absoluteUri, 'utf8'); } module.exports = loadOriginalSources;
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.7 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002