mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-03 06:32:19 +00:00
0.2.0 - Mid migration
This commit is contained in:
parent
139e6a915e
commit
7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions
93
web/node_modules/@svgr/core/lib/config.js
generated
vendored
Normal file
93
web/node_modules/@svgr/core/lib/config.js
generated
vendored
Normal file
|
@ -0,0 +1,93 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.resolveConfig = resolveConfig;
|
||||
exports.resolveConfigFile = resolveConfigFile;
|
||||
exports.loadConfig = loadConfig;
|
||||
exports.DEFAULT_CONFIG = void 0;
|
||||
|
||||
var _cosmiconfig = require("cosmiconfig");
|
||||
|
||||
const DEFAULT_CONFIG = {
|
||||
dimensions: true,
|
||||
expandProps: 'end',
|
||||
icon: false,
|
||||
native: false,
|
||||
typescript: false,
|
||||
prettier: true,
|
||||
prettierConfig: null,
|
||||
memo: false,
|
||||
ref: false,
|
||||
replaceAttrValues: null,
|
||||
svgProps: null,
|
||||
svgo: true,
|
||||
svgoConfig: null,
|
||||
template: null,
|
||||
titleProp: false,
|
||||
runtimeConfig: true,
|
||||
plugins: null,
|
||||
namedExport: 'ReactComponent'
|
||||
};
|
||||
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
||||
const explorer = (0, _cosmiconfig.cosmiconfig)('svgr', {
|
||||
sync: true,
|
||||
cache: true,
|
||||
rcExtensions: true
|
||||
});
|
||||
const explorerSync = (0, _cosmiconfig.cosmiconfigSync)('svgr', {
|
||||
sync: true,
|
||||
cache: true,
|
||||
rcExtensions: true
|
||||
});
|
||||
|
||||
async function resolveConfig(searchFrom, configFile) {
|
||||
if (configFile == null) {
|
||||
const result = await explorer.search(searchFrom);
|
||||
return result ? result.config : null;
|
||||
}
|
||||
|
||||
const result = await explorer.load(configFile);
|
||||
return result ? result.config : null;
|
||||
}
|
||||
|
||||
resolveConfig.sync = (searchFrom, configFile) => {
|
||||
if (configFile == null) {
|
||||
const result = explorerSync.search(searchFrom);
|
||||
return result ? result.config : null;
|
||||
}
|
||||
|
||||
const result = explorerSync.load(configFile);
|
||||
return result ? result.config : null;
|
||||
};
|
||||
|
||||
async function resolveConfigFile(filePath) {
|
||||
const result = await explorer.search(filePath);
|
||||
return result ? result.filepath : null;
|
||||
}
|
||||
|
||||
resolveConfigFile.sync = filePath => {
|
||||
const result = explorerSync.search(filePath);
|
||||
return result ? result.filepath : null;
|
||||
};
|
||||
|
||||
async function loadConfig({
|
||||
configFile,
|
||||
...baseConfig
|
||||
}, state = {}) {
|
||||
const rcConfig = state.filePath && baseConfig.runtimeConfig !== false ? await resolveConfig(state.filePath, configFile) : {};
|
||||
return { ...DEFAULT_CONFIG,
|
||||
...rcConfig,
|
||||
...baseConfig
|
||||
};
|
||||
}
|
||||
|
||||
loadConfig.sync = ({
|
||||
configFile,
|
||||
...baseConfig
|
||||
}, state = {}) => {
|
||||
const rcConfig = state.filePath && baseConfig.runtimeConfig !== false ? resolveConfig.sync(state.filePath, configFile) : {};
|
||||
return { ...DEFAULT_CONFIG,
|
||||
...rcConfig,
|
||||
...baseConfig
|
||||
};
|
||||
};
|
35
web/node_modules/@svgr/core/lib/convert.js
generated
vendored
Normal file
35
web/node_modules/@svgr/core/lib/convert.js
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.default = void 0;
|
||||
|
||||
var _state = require("./state");
|
||||
|
||||
var _config = require("./config");
|
||||
|
||||
var _plugins = require("./plugins");
|
||||
|
||||
function run(code, config, state) {
|
||||
const expandedState = (0, _state.expandState)(state);
|
||||
const plugins = (0, _plugins.getPlugins)(config, state).map(_plugins.resolvePlugin);
|
||||
let nextCode = String(code).replace('\0', ''); // eslint-disable-next-line no-restricted-syntax
|
||||
|
||||
for (const plugin of plugins) {
|
||||
nextCode = plugin(nextCode, config, expandedState);
|
||||
}
|
||||
|
||||
return nextCode;
|
||||
}
|
||||
|
||||
async function convert(code, config = {}, state = {}) {
|
||||
config = await (0, _config.loadConfig)(config, state);
|
||||
return run(code, config, state);
|
||||
}
|
||||
|
||||
convert.sync = (code, config = {}, state = {}) => {
|
||||
config = _config.loadConfig.sync(config, state);
|
||||
return run(code, config, state);
|
||||
};
|
||||
|
||||
var _default = convert;
|
||||
exports.default = _default;
|
20
web/node_modules/@svgr/core/lib/index.js
generated
vendored
Normal file
20
web/node_modules/@svgr/core/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
var _exportNames = {};
|
||||
exports.default = void 0;
|
||||
|
||||
var _convert = _interopRequireDefault(require("./convert"));
|
||||
|
||||
exports.default = _convert.default;
|
||||
|
||||
var _config = require("./config");
|
||||
|
||||
Object.keys(_config).forEach(function (key) {
|
||||
if (key === "default" || key === "__esModule") return;
|
||||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
||||
if (key in exports && exports[key] === _config[key]) return;
|
||||
exports[key] = _config[key];
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
58
web/node_modules/@svgr/core/lib/plugins.js
generated
vendored
Normal file
58
web/node_modules/@svgr/core/lib/plugins.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.getPlugins = getPlugins;
|
||||
exports.resolvePlugin = resolvePlugin;
|
||||
exports.loadPlugin = loadPlugin;
|
||||
|
||||
var _pluginJsx = _interopRequireDefault(require("@svgr/plugin-jsx"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const DEFAULT_PLUGINS = [_pluginJsx.default];
|
||||
|
||||
function getPlugins(config, state) {
|
||||
if (config.plugins) {
|
||||
return config.plugins;
|
||||
}
|
||||
|
||||
if (state.caller && state.caller.defaultPlugins) {
|
||||
return state.caller.defaultPlugins;
|
||||
}
|
||||
|
||||
return DEFAULT_PLUGINS;
|
||||
}
|
||||
|
||||
function resolvePlugin(plugin) {
|
||||
if (typeof plugin === 'function') {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
if (typeof plugin === 'string') {
|
||||
return loadPlugin(plugin);
|
||||
}
|
||||
|
||||
throw new Error(`Invalid plugin "${plugin}"`);
|
||||
}
|
||||
|
||||
const pluginCache = {};
|
||||
|
||||
function loadPlugin(moduleName) {
|
||||
if (pluginCache[moduleName]) {
|
||||
return pluginCache[moduleName];
|
||||
}
|
||||
|
||||
try {
|
||||
// eslint-disable-next-line
|
||||
const plugin = require(moduleName);
|
||||
|
||||
if (!plugin.default || !plugin) {
|
||||
throw new Error(`Invalid plugin "${moduleName}"`);
|
||||
}
|
||||
|
||||
pluginCache[moduleName] = plugin.default || plugin;
|
||||
return pluginCache[moduleName];
|
||||
} catch (error) {
|
||||
throw new Error(`Module "${moduleName}" missing. Maybe \`npm install ${moduleName}\` could help!`);
|
||||
}
|
||||
}
|
27
web/node_modules/@svgr/core/lib/state.js
generated
vendored
Normal file
27
web/node_modules/@svgr/core/lib/state.js
generated
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.expandState = expandState;
|
||||
|
||||
var _path = _interopRequireDefault(require("path"));
|
||||
|
||||
var _camelcase = _interopRequireDefault(require("camelcase"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const validCharacters = /[^a-zA-Z0-9_-]/g;
|
||||
|
||||
function getComponentName(state) {
|
||||
if (!state.filePath) return 'SvgComponent';
|
||||
const pascalCaseFileName = (0, _camelcase.default)(_path.default.parse(state.filePath).name.replace(validCharacters, ''), {
|
||||
pascalCase: true
|
||||
});
|
||||
return `Svg${pascalCaseFileName}`;
|
||||
}
|
||||
|
||||
function expandState(state) {
|
||||
return {
|
||||
componentName: state.componentName || getComponentName(state),
|
||||
...state
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue