mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-13 16:24:06 +07:00
Improve code quality and write tests
This commit is contained in:
22
node_modules/@babel/plugin-transform-modules-amd/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/plugin-transform-modules-amd/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
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.
|
19
node_modules/@babel/plugin-transform-modules-amd/README.md
generated
vendored
Normal file
19
node_modules/@babel/plugin-transform-modules-amd/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# @babel/plugin-transform-modules-amd
|
||||
|
||||
> This plugin transforms ES2015 modules to AMD
|
||||
|
||||
See our website [@babel/plugin-transform-modules-amd](https://babeljs.io/docs/en/next/babel-plugin-transform-modules-amd.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/plugin-transform-modules-amd
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/plugin-transform-modules-amd --dev
|
||||
```
|
193
node_modules/@babel/plugin-transform-modules-amd/lib/index.js
generated
vendored
Normal file
193
node_modules/@babel/plugin-transform-modules-amd/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,193 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
function _helperPluginUtils() {
|
||||
const data = require("@babel/helper-plugin-utils");
|
||||
|
||||
_helperPluginUtils = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _helperModuleTransforms() {
|
||||
const data = require("@babel/helper-module-transforms");
|
||||
|
||||
_helperModuleTransforms = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _core() {
|
||||
const data = require("@babel/core");
|
||||
|
||||
_core = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _utils() {
|
||||
const data = require("babel-plugin-dynamic-import-node/utils");
|
||||
|
||||
_utils = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const buildWrapper = (0, _core().template)(`
|
||||
define(MODULE_NAME, AMD_ARGUMENTS, function(IMPORT_NAMES) {
|
||||
})
|
||||
`);
|
||||
const buildAnonymousWrapper = (0, _core().template)(`
|
||||
define(["require"], function(REQUIRE) {
|
||||
})
|
||||
`);
|
||||
|
||||
function injectWrapper(path, wrapper) {
|
||||
const {
|
||||
body,
|
||||
directives
|
||||
} = path.node;
|
||||
path.node.directives = [];
|
||||
path.node.body = [];
|
||||
const amdWrapper = path.pushContainer("body", wrapper)[0];
|
||||
const amdFactory = amdWrapper.get("expression.arguments").filter(arg => arg.isFunctionExpression())[0].get("body");
|
||||
amdFactory.pushContainer("directives", directives);
|
||||
amdFactory.pushContainer("body", body);
|
||||
}
|
||||
|
||||
var _default = (0, _helperPluginUtils().declare)((api, options) => {
|
||||
api.assertVersion(7);
|
||||
const {
|
||||
loose,
|
||||
allowTopLevelThis,
|
||||
strict,
|
||||
strictMode,
|
||||
noInterop
|
||||
} = options;
|
||||
return {
|
||||
name: "transform-modules-amd",
|
||||
|
||||
pre() {
|
||||
this.file.set("@babel/plugin-transform-modules-*", "amd");
|
||||
},
|
||||
|
||||
visitor: {
|
||||
CallExpression(path, state) {
|
||||
if (!this.file.has("@babel/plugin-proposal-dynamic-import")) return;
|
||||
if (!path.get("callee").isImport()) return;
|
||||
let {
|
||||
requireId,
|
||||
resolveId,
|
||||
rejectId
|
||||
} = state;
|
||||
|
||||
if (!requireId) {
|
||||
requireId = path.scope.generateUidIdentifier("require");
|
||||
state.requireId = requireId;
|
||||
}
|
||||
|
||||
if (!resolveId || !rejectId) {
|
||||
resolveId = path.scope.generateUidIdentifier("resolve");
|
||||
rejectId = path.scope.generateUidIdentifier("reject");
|
||||
state.resolveId = resolveId;
|
||||
state.rejectId = rejectId;
|
||||
}
|
||||
|
||||
let result = _core().types.identifier("imported");
|
||||
|
||||
if (!noInterop) result = (0, _helperModuleTransforms().wrapInterop)(path, result, "namespace");
|
||||
path.replaceWith(_core().template.expression.ast`
|
||||
new Promise((${resolveId}, ${rejectId}) =>
|
||||
${requireId}(
|
||||
[${(0, _utils().getImportSource)(_core().types, path.node)}],
|
||||
imported => ${resolveId}(${result}),
|
||||
${rejectId}
|
||||
)
|
||||
)`);
|
||||
},
|
||||
|
||||
Program: {
|
||||
exit(path, {
|
||||
requireId
|
||||
}) {
|
||||
if (!(0, _helperModuleTransforms().isModule)(path)) {
|
||||
if (requireId) {
|
||||
injectWrapper(path, buildAnonymousWrapper({
|
||||
REQUIRE: requireId
|
||||
}));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const amdArgs = [];
|
||||
const importNames = [];
|
||||
|
||||
if (requireId) {
|
||||
amdArgs.push(_core().types.stringLiteral("require"));
|
||||
importNames.push(requireId);
|
||||
}
|
||||
|
||||
let moduleName = this.getModuleName();
|
||||
if (moduleName) moduleName = _core().types.stringLiteral(moduleName);
|
||||
const {
|
||||
meta,
|
||||
headers
|
||||
} = (0, _helperModuleTransforms().rewriteModuleStatementsAndPrepareHeader)(path, {
|
||||
loose,
|
||||
strict,
|
||||
strictMode,
|
||||
allowTopLevelThis,
|
||||
noInterop
|
||||
});
|
||||
|
||||
if ((0, _helperModuleTransforms().hasExports)(meta)) {
|
||||
amdArgs.push(_core().types.stringLiteral("exports"));
|
||||
importNames.push(_core().types.identifier(meta.exportName));
|
||||
}
|
||||
|
||||
for (const [source, metadata] of meta.source) {
|
||||
amdArgs.push(_core().types.stringLiteral(source));
|
||||
importNames.push(_core().types.identifier(metadata.name));
|
||||
|
||||
if (!(0, _helperModuleTransforms().isSideEffectImport)(metadata)) {
|
||||
const interop = (0, _helperModuleTransforms().wrapInterop)(path, _core().types.identifier(metadata.name), metadata.interop);
|
||||
|
||||
if (interop) {
|
||||
const header = _core().types.expressionStatement(_core().types.assignmentExpression("=", _core().types.identifier(metadata.name), interop));
|
||||
|
||||
header.loc = metadata.loc;
|
||||
headers.push(header);
|
||||
}
|
||||
}
|
||||
|
||||
headers.push(...(0, _helperModuleTransforms().buildNamespaceInitStatements)(meta, metadata, loose));
|
||||
}
|
||||
|
||||
(0, _helperModuleTransforms().ensureStatementsHoisted)(headers);
|
||||
path.unshiftContainer("body", headers);
|
||||
injectWrapper(path, buildWrapper({
|
||||
MODULE_NAME: moduleName,
|
||||
AMD_ARGUMENTS: _core().types.arrayExpression(amdArgs),
|
||||
IMPORT_NAMES: importNames
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
exports.default = _default;
|
59
node_modules/@babel/plugin-transform-modules-amd/package.json
generated
vendored
Normal file
59
node_modules/@babel/plugin-transform-modules-amd/package.json
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/plugin-transform-modules-amd@7.5.0",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "@babel/plugin-transform-modules-amd@7.5.0",
|
||||
"_id": "@babel/plugin-transform-modules-amd@7.5.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg==",
|
||||
"_location": "/@babel/plugin-transform-modules-amd",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/plugin-transform-modules-amd@7.5.0",
|
||||
"name": "@babel/plugin-transform-modules-amd",
|
||||
"escapedName": "@babel%2fplugin-transform-modules-amd",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.5.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.5.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/preset-env"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz",
|
||||
"_spec": "7.5.0",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"dependencies": {
|
||||
"@babel/helper-module-transforms": "^7.1.0",
|
||||
"@babel/helper-plugin-utils": "^7.0.0",
|
||||
"babel-plugin-dynamic-import-node": "^2.3.0"
|
||||
},
|
||||
"description": "This plugin transforms ES2015 modules to AMD",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.5.0",
|
||||
"@babel/helper-plugin-test-runner": "^7.0.0"
|
||||
},
|
||||
"gitHead": "49da9a07c81156e997e60146eb001ea77b7044c4",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/plugin-transform-modules-amd",
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-modules-amd"
|
||||
},
|
||||
"version": "7.5.0"
|
||||
}
|
Reference in New Issue
Block a user