mirror of
https://github.com/idanoo/GoScrobble
synced 2025-07-01 21:52: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
21
web/node_modules/babel-plugin-named-asset-import/LICENSE
generated
vendored
Normal file
21
web/node_modules/babel-plugin-named-asset-import/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2013-present, Facebook, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
95
web/node_modules/babel-plugin-named-asset-import/index.js
generated
vendored
Normal file
95
web/node_modules/babel-plugin-named-asset-import/index.js
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
'use strict';
|
||||
|
||||
const { extname } = require('path');
|
||||
|
||||
function namedAssetImportPlugin({ types: t }) {
|
||||
const visited = new WeakSet();
|
||||
|
||||
function generateNewSourcePath(loaderMap, moduleName, sourcePath) {
|
||||
const ext = extname(sourcePath).substr(1);
|
||||
const extMap = loaderMap[ext];
|
||||
return extMap[moduleName]
|
||||
? extMap[moduleName].replace(/\[path\]/, sourcePath)
|
||||
: sourcePath;
|
||||
}
|
||||
|
||||
function replaceMatchingSpecifiers(path, loaderMap, callback) {
|
||||
const sourcePath = path.node.source.value;
|
||||
const ext = extname(sourcePath).substr(1);
|
||||
|
||||
if (visited.has(path.node) || sourcePath.indexOf('!') !== -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (loaderMap[ext]) {
|
||||
path.replaceWithMultiple(
|
||||
path.node.specifiers.map(specifier => {
|
||||
const newSpecifier = callback(specifier, sourcePath);
|
||||
visited.add(newSpecifier);
|
||||
|
||||
return newSpecifier;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
visitor: {
|
||||
ExportNamedDeclaration(path, { opts: { loaderMap } }) {
|
||||
if (!path.node.source) {
|
||||
return;
|
||||
}
|
||||
|
||||
replaceMatchingSpecifiers(path, loaderMap, (specifier, sourcePath) => {
|
||||
if (t.isExportDefaultSpecifier(specifier)) {
|
||||
return t.exportDeclaration(
|
||||
[t.exportDefaultSpecifier(t.identifier(specifier.local.name))],
|
||||
t.stringLiteral(sourcePath)
|
||||
);
|
||||
}
|
||||
|
||||
return t.exportNamedDeclaration(
|
||||
null,
|
||||
[
|
||||
t.exportSpecifier(
|
||||
t.identifier(specifier.local.name),
|
||||
t.identifier(specifier.exported.name)
|
||||
),
|
||||
],
|
||||
t.stringLiteral(
|
||||
generateNewSourcePath(loaderMap, specifier.local.name, sourcePath)
|
||||
)
|
||||
);
|
||||
});
|
||||
},
|
||||
ImportDeclaration(path, { opts: { loaderMap } }) {
|
||||
replaceMatchingSpecifiers(path, loaderMap, (specifier, sourcePath) => {
|
||||
if (t.isImportDefaultSpecifier(specifier)) {
|
||||
return t.importDeclaration(
|
||||
[t.importDefaultSpecifier(t.identifier(specifier.local.name))],
|
||||
t.stringLiteral(sourcePath)
|
||||
);
|
||||
}
|
||||
|
||||
return t.importDeclaration(
|
||||
[
|
||||
t.importSpecifier(
|
||||
t.identifier(specifier.local.name),
|
||||
t.identifier(specifier.imported.name)
|
||||
),
|
||||
],
|
||||
t.stringLiteral(
|
||||
generateNewSourcePath(
|
||||
loaderMap,
|
||||
specifier.imported.name,
|
||||
sourcePath
|
||||
)
|
||||
)
|
||||
);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = namedAssetImportPlugin;
|
29
web/node_modules/babel-plugin-named-asset-import/package.json
generated
vendored
Normal file
29
web/node_modules/babel-plugin-named-asset-import/package.json
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "babel-plugin-named-asset-import",
|
||||
"version": "0.3.7",
|
||||
"description": "Babel plugin for named asset imports in Create React App",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/create-react-app.git",
|
||||
"directory": "packages/babel-plugin-named-asset-import"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/facebook/create-react-app/issues"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-tester": "^8.0.1",
|
||||
"jest": "26.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
},
|
||||
"gitHead": "ed958938f642007645dd5ac3466db36202f8754e"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue