Criada a API do site

This commit is contained in:
Caio1w
2025-10-29 19:56:41 -03:00
parent f201c8edbd
commit 4a14f533d2
3074 changed files with 780728 additions and 41 deletions

22
node_modules/@babel/plugin-proposal-decorators/LICENSE generated vendored Normal file
View 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.

View File

@@ -0,0 +1,19 @@
# @babel/plugin-proposal-decorators
> Compile class and object decorators to ES5
See our website [@babel/plugin-proposal-decorators](https://babeljs.io/docs/babel-plugin-proposal-decorators) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/plugin-proposal-decorators
```
or using yarn:
```sh
yarn add @babel/plugin-proposal-decorators --dev
```

View File

@@ -0,0 +1,41 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _helperPluginUtils = require("@babel/helper-plugin-utils");
var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
var _helperCreateClassFeaturesPlugin = require("@babel/helper-create-class-features-plugin");
var _transformerLegacy = require("./transformer-legacy.js");
var _default = exports.default = (0, _helperPluginUtils.declare)((api, options) => {
api.assertVersion(7);
{
var {
legacy
} = options;
}
const {
version
} = options;
if (legacy || version === "legacy") {
return {
name: "proposal-decorators",
inherits: _pluginSyntaxDecorators.default,
visitor: _transformerLegacy.default
};
} else if (!version || version === "2018-09" || version === "2021-12" || version === "2022-03" || version === "2023-01" || version === "2023-05" || version === "2023-11") {
api.assertVersion("^7.0.2");
return (0, _helperCreateClassFeaturesPlugin.createClassFeaturePlugin)({
name: "proposal-decorators",
api,
feature: _helperCreateClassFeaturesPlugin.FEATURES.decorators,
inherits: _pluginSyntaxDecorators.default,
decoratorVersion: version
});
} else {
throw new Error("The '.version' option must be one of 'legacy', '2023-11', '2023-05', '2023-01', '2022-03', or '2021-12'.");
}
});
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"names":["_helperPluginUtils","require","_pluginSyntaxDecorators","_helperCreateClassFeaturesPlugin","_transformerLegacy","_default","exports","default","declare","api","options","assertVersion","legacy","version","name","inherits","syntaxDecorators","visitor","legacyVisitor","createClassFeaturePlugin","feature","FEATURES","decorators","decoratorVersion","Error"],"sources":["../src/index.ts"],"sourcesContent":["/* eslint-disable @babel/development/plugin-name */\n\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport syntaxDecorators from \"@babel/plugin-syntax-decorators\";\nimport {\n createClassFeaturePlugin,\n FEATURES,\n} from \"@babel/helper-create-class-features-plugin\";\nimport legacyVisitor from \"./transformer-legacy.ts\";\nimport type { Options as SyntaxOptions } from \"@babel/plugin-syntax-decorators\";\n\ninterface Options extends SyntaxOptions {\n /** @deprecated use `constantSuper` assumption instead. Only supported in 2021-12 version. */\n loose?: boolean;\n}\n\nexport type { Options };\n\nexport default declare((api, options: Options) => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n // Options are validated in @babel/plugin-syntax-decorators\n if (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var { legacy } = options;\n }\n const { version } = options;\n\n if (\n process.env.BABEL_8_BREAKING\n ? version === \"legacy\"\n : legacy || version === \"legacy\"\n ) {\n return {\n name: \"proposal-decorators\",\n inherits: syntaxDecorators,\n visitor: legacyVisitor,\n };\n } else if (\n !version ||\n version === \"2018-09\" ||\n version === \"2021-12\" ||\n version === \"2022-03\" ||\n version === \"2023-01\" ||\n version === \"2023-05\" ||\n version === \"2023-11\"\n ) {\n api.assertVersion(REQUIRED_VERSION(\"^7.0.2\"));\n return createClassFeaturePlugin({\n name: \"proposal-decorators\",\n\n api,\n feature: FEATURES.decorators,\n inherits: syntaxDecorators,\n // @ts-expect-error version must not be \"legacy\" here\n decoratorVersion: version,\n // loose: options.loose, Not supported\n });\n } else {\n throw new Error(\n \"The '.version' option must be one of 'legacy', '2023-11', '2023-05', '2023-01', '2022-03', or '2021-12'.\",\n );\n }\n});\n"],"mappings":";;;;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,gCAAA,GAAAF,OAAA;AAIA,IAAAG,kBAAA,GAAAH,OAAA;AAAoD,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAUrC,IAAAC,0BAAO,EAAC,CAACC,GAAG,EAAEC,OAAgB,KAAK;EAChDD,GAAG,CAACE,aAAa,CAAkB,CAAE,CAAC;EAGH;IAEjC,IAAI;MAAEC;IAAO,CAAC,GAAGF,OAAO;EAC1B;EACA,MAAM;IAAEG;EAAQ,CAAC,GAAGH,OAAO;EAE3B,IAGME,MAAM,IAAIC,OAAO,KAAK,QAAQ,EAClC;IACA,OAAO;MACLC,IAAI,EAAE,qBAAqB;MAC3BC,QAAQ,EAAEC,+BAAgB;MAC1BC,OAAO,EAAEC;IACX,CAAC;EACH,CAAC,MAAM,IACL,CAACL,OAAO,IACRA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,IACrBA,OAAO,KAAK,SAAS,EACrB;IACAJ,GAAG,CAACE,aAAa,CAAkB,QAAS,CAAC;IAC7C,OAAO,IAAAQ,yDAAwB,EAAC;MAC9BL,IAAI,EAAE,qBAAqB;MAE3BL,GAAG;MACHW,OAAO,EAAEC,yCAAQ,CAACC,UAAU;MAC5BP,QAAQ,EAAEC,+BAAgB;MAE1BO,gBAAgB,EAAEV;IAEpB,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,MAAM,IAAIW,KAAK,CACb,0GACF,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _core = require("@babel/core");
const buildClassDecorator = _core.template.statement(`
DECORATOR(CLASS_REF = INNER) || CLASS_REF;
`);
const buildClassPrototype = (0, _core.template)(`
CLASS_REF.prototype;
`);
const buildGetDescriptor = (0, _core.template)(`
Object.getOwnPropertyDescriptor(TARGET, PROPERTY);
`);
const buildGetObjectInitializer = (0, _core.template)(`
(TEMP = Object.getOwnPropertyDescriptor(TARGET, PROPERTY), (TEMP = TEMP ? TEMP.value : undefined), {
enumerable: true,
configurable: true,
writable: true,
initializer: function(){
return TEMP;
}
})
`);
const WARNING_CALLS = new WeakSet();
function applyEnsureOrdering(path) {
const decorators = (path.isClass() ? [path, ...path.get("body.body")] : path.get("properties")).reduce((acc, prop) => acc.concat(prop.node.decorators || []), []);
const identDecorators = decorators.filter(decorator => !_core.types.isIdentifier(decorator.expression));
if (identDecorators.length === 0) return;
return _core.types.sequenceExpression(identDecorators.map(decorator => {
const expression = decorator.expression;
const id = decorator.expression = path.scope.generateDeclaredUidIdentifier("dec");
return _core.types.assignmentExpression("=", id, expression);
}).concat([path.node]));
}
function applyClassDecorators(classPath) {
if (!hasClassDecorators(classPath.node)) return;
const decorators = classPath.node.decorators || [];
classPath.node.decorators = null;
const name = classPath.scope.generateDeclaredUidIdentifier("class");
return decorators.map(dec => dec.expression).reverse().reduce(function (acc, decorator) {
return buildClassDecorator({
CLASS_REF: _core.types.cloneNode(name),
DECORATOR: _core.types.cloneNode(decorator),
INNER: acc
}).expression;
}, classPath.node);
}
function hasClassDecorators(classNode) {
var _classNode$decorators;
return !!((_classNode$decorators = classNode.decorators) != null && _classNode$decorators.length);
}
function applyMethodDecorators(path, state) {
if (!hasMethodDecorators(path.node.body.body)) return;
return applyTargetDecorators(path, state, path.node.body.body);
}
function hasMethodDecorators(body) {
return body.some(node => {
var _node$decorators;
return ((_node$decorators = node.decorators) == null ? void 0 : _node$decorators.length
);
});
}
function applyObjectDecorators(path, state) {
if (!hasMethodDecorators(path.node.properties)) return;
return applyTargetDecorators(path, state, path.node.properties.filter(prop => prop.type !== "SpreadElement"));
}
function applyTargetDecorators(path, state, decoratedProps) {
const name = path.scope.generateDeclaredUidIdentifier(path.isClass() ? "class" : "obj");
const exprs = decoratedProps.reduce(function (acc, node) {
let decorators = [];
if (node.decorators != null) {
decorators = node.decorators;
node.decorators = null;
}
if (decorators.length === 0) return acc;
if (node.computed) {
throw path.buildCodeFrameError("Computed method/property decorators are not yet supported.");
}
const property = _core.types.isLiteral(node.key) ? node.key : _core.types.stringLiteral(node.key.name);
const target = path.isClass() && !node.static ? buildClassPrototype({
CLASS_REF: name
}).expression : name;
if (_core.types.isClassProperty(node, {
static: false
})) {
const descriptor = path.scope.generateDeclaredUidIdentifier("descriptor");
const initializer = node.value ? _core.types.functionExpression(null, [], _core.types.blockStatement([_core.types.returnStatement(node.value)])) : _core.types.nullLiteral();
node.value = _core.types.callExpression(state.addHelper("initializerWarningHelper"), [descriptor, _core.types.thisExpression()]);
WARNING_CALLS.add(node.value);
acc.push(_core.types.assignmentExpression("=", _core.types.cloneNode(descriptor), _core.types.callExpression(state.addHelper("applyDecoratedDescriptor"), [_core.types.cloneNode(target), _core.types.cloneNode(property), _core.types.arrayExpression(decorators.map(dec => _core.types.cloneNode(dec.expression))), _core.types.objectExpression([_core.types.objectProperty(_core.types.identifier("configurable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("enumerable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("writable"), _core.types.booleanLiteral(true)), _core.types.objectProperty(_core.types.identifier("initializer"), initializer)])])));
} else {
acc.push(_core.types.callExpression(state.addHelper("applyDecoratedDescriptor"), [_core.types.cloneNode(target), _core.types.cloneNode(property), _core.types.arrayExpression(decorators.map(dec => _core.types.cloneNode(dec.expression))), _core.types.isObjectProperty(node) || _core.types.isClassProperty(node, {
static: true
}) ? buildGetObjectInitializer({
TEMP: path.scope.generateDeclaredUidIdentifier("init"),
TARGET: _core.types.cloneNode(target),
PROPERTY: _core.types.cloneNode(property)
}).expression : buildGetDescriptor({
TARGET: _core.types.cloneNode(target),
PROPERTY: _core.types.cloneNode(property)
}).expression, _core.types.cloneNode(target)]));
}
return acc;
}, []);
return _core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(name), path.node), _core.types.sequenceExpression(exprs), _core.types.cloneNode(name)]);
}
function decoratedClassToExpression({
node,
scope
}) {
if (!hasClassDecorators(node) && !hasMethodDecorators(node.body.body)) {
return;
}
const ref = node.id ? _core.types.cloneNode(node.id) : scope.generateUidIdentifier("class");
return _core.types.variableDeclaration("let", [_core.types.variableDeclarator(ref, _core.types.toExpression(node))]);
}
const visitor = {
ExportDefaultDeclaration(path) {
const decl = path.get("declaration");
if (!decl.isClassDeclaration()) return;
const replacement = decoratedClassToExpression(decl);
if (replacement) {
const [varDeclPath] = path.replaceWithMultiple([replacement, _core.types.exportNamedDeclaration(null, [_core.types.exportSpecifier(_core.types.cloneNode(replacement.declarations[0].id), _core.types.identifier("default"))])]);
if (!decl.node.id) {
path.scope.registerDeclaration(varDeclPath);
}
}
},
ClassDeclaration(path) {
const replacement = decoratedClassToExpression(path);
if (replacement) {
const [newPath] = path.replaceWith(replacement);
const decl = newPath.get("declarations.0");
const id = decl.node.id;
const binding = path.scope.getOwnBinding(id.name);
binding.identifier = id;
binding.path = decl;
}
},
ClassExpression(path, state) {
const decoratedClass = applyEnsureOrdering(path) || applyClassDecorators(path) || applyMethodDecorators(path, state);
if (decoratedClass) path.replaceWith(decoratedClass);
},
ObjectExpression(path, state) {
const decoratedObject = applyEnsureOrdering(path) || applyObjectDecorators(path, state);
if (decoratedObject) path.replaceWith(decoratedObject);
},
AssignmentExpression(path, state) {
if (!WARNING_CALLS.has(path.node.right)) return;
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("left.object").node), _core.types.stringLiteral(path.get("left.property").node.name || path.get("left.property").node.value), _core.types.cloneNode(path.get("right.arguments")[0].node), _core.types.cloneNode(path.get("right.arguments")[1].node)]));
},
CallExpression(path, state) {
if (path.node.arguments.length !== 3) return;
if (!WARNING_CALLS.has(path.node.arguments[2])) return;
if (path.node.callee.name !== state.addHelper("defineProperty").name) {
return;
}
path.replaceWith(_core.types.callExpression(state.addHelper("initializerDefineProperty"), [_core.types.cloneNode(path.get("arguments")[0].node), _core.types.cloneNode(path.get("arguments")[1].node), _core.types.cloneNode(path.get("arguments.2.arguments")[0].node), _core.types.cloneNode(path.get("arguments.2.arguments")[1].node)]));
}
};
var _default = exports.default = visitor;
//# sourceMappingURL=transformer-legacy.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,42 @@
{
"name": "@babel/plugin-proposal-decorators",
"version": "7.28.0",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"description": "Compile class and object decorators to ES5",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-plugin-proposal-decorators"
},
"homepage": "https://babel.dev/docs/en/next/babel-plugin-proposal-decorators",
"main": "./lib/index.js",
"keywords": [
"babel",
"babel-plugin",
"decorators"
],
"dependencies": {
"@babel/helper-create-class-features-plugin": "^7.27.1",
"@babel/helper-plugin-utils": "^7.27.1",
"@babel/plugin-syntax-decorators": "^7.27.1"
},
"peerDependencies": {
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.28.0",
"@babel/helper-plugin-test-runner": "^7.27.1",
"@babel/traverse": "^7.28.0",
"array.prototype.concat": "^1.0.2",
"babel-plugin-polyfill-es-shims": "^0.10.8",
"object.getownpropertydescriptors": "^2.1.1"
},
"engines": {
"node": ">=6.9.0"
},
"type": "commonjs"
}